diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000000..118a058cc1
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,282 @@
+# Javascript Node CircleCI 2.0 configuration file
+#
+# Check https://circleci.com/docs/2.0/language-javascript/ for more details
+#
+version: 2
+jobs:
+ remix-libs:
+ docker:
+ # specify the version you desire here
+ - image: circleci/node:10.18.0-browsers
+
+ # Specify service dependencies here if necessary
+ # CircleCI maintains a library of pre-built images
+ # documented at https://circleci.com/docs/2.0/circleci-images/
+ resource_class: xlarge
+ # - image: circleci/mongo:3.4.4
+ environment:
+ - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org"
+ - COMMIT_AUTHOR: "Circle CI"
+ working_directory: ~/remix-project
+
+ steps:
+ - checkout
+ - run: npm install
+ - run: npm run lint:libs
+ - run: npm run build:libs
+ - run: npm run test:libs
+
+ remix-ide-chrome:
+ docker:
+ # specify the version you desire here
+ - image: circleci/node:10.18.0-browsers
+
+ # Specify service dependencies here if necessary
+ # CircleCI maintains a library of pre-built images
+ # documented at https://circleci.com/docs/2.0/circleci-images/
+ resource_class: xlarge
+ # - image: circleci/mongo:3.4.4
+ environment:
+ - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org"
+ - COMMIT_AUTHOR: "Circle CI"
+ - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico"
+ working_directory: ~/remix-project
+
+ parallelism: 20
+ steps:
+ - checkout
+ - run: npm install
+ - run: npm run lint
+ - run: npm run build:libs
+ - run: npm run downloadsolc_root
+ - run: npm run build
+ - run:
+ name: Download Compatible JAVA Version for Selenium
+ command: |
+ java -version
+ sudo apt-get purge --auto-remove java-common
+ sudo apt-get update
+ sudo apt-get install openjdk-8-jdk
+ java -version
+ - run:
+ name: Download Selenium
+ command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
+ - run:
+ name: Start Selenium
+ command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
+ background: true
+ - run: ./apps/remix-ide/ci/browser_tests_chrome.sh
+ - store_test_results:
+ path: ./reports/tests
+ - store_artifacts:
+ path: ./reports/screenshots
+
+ remix-ide-firefox:
+ docker:
+ # specify the version you desire here
+ - image: circleci/node:10.18.0-browsers
+
+ # Specify service dependencies here if necessary
+ # CircleCI maintains a library of pre-built images
+ # documented at https://circleci.com/docs/2.0/circleci-images/
+ resource_class: xlarge
+ # - image: circleci/mongo:3.4.4
+ environment:
+ - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org"
+ - COMMIT_AUTHOR: "Circle CI"
+ - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico"
+ working_directory: ~/remix-project
+
+ parallelism: 20
+ steps:
+ - checkout
+ - run: npm install
+ - run: npm run lint
+ - run: npm run build:libs
+ - run: npm run downloadsolc_root
+ - run: npm run build
+ - run:
+ name: Download Selenium
+ command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
+ - run:
+ name: Start Selenium
+ command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
+ background: true
+ - run:
+ name: Download Latest Firefox
+ command: sudo apt-get purge -y firefox && wget https://sourceforge.net/projects/ubuntuzilla/files/mozilla/apt/pool/main/f/firefox-mozilla-build/firefox-mozilla-build_73.0.1-0ubuntu1_amd64.deb
+ - run:
+ name: Install Firefox
+ command: sudo dpkg -i firefox-mozilla-build_73.0.1-0ubuntu1_amd64.deb
+ - run: ./apps/remix-ide/ci/browser_tests_firefox.sh
+ - store_test_results:
+ path: ./reports/tests
+ - store_artifacts:
+ path: ./reports/screenshots
+
+ remix-ide-run-deploy:
+ docker:
+ # specify the version you desire here
+ - image: circleci/node:10.18.0-browsers
+
+ # Specify service dependencies here if necessary
+ # CircleCI maintains a library of pre-built images
+ # documented at https://circleci.com/docs/2.0/circleci-images/
+ resource_class: xlarge
+ # - image: circleci/mongo:3.4.4
+ environment:
+ - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org"
+ - COMMIT_AUTHOR: "Circle CI"
+ - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico"
+ working_directory: ~/remix-project
+
+ steps:
+ - checkout
+ - run: npm install
+ - run: npm run lint
+ - run: npm run build:libs
+ - run: npm run downloadsolc_root
+ - run: npm run build
+ - run:
+ name: Download Compatible JAVA Version for Selenium
+ command: |
+ java -version
+ sudo apt-get purge --auto-remove java-common
+ sudo apt-get update
+ sudo apt-get install openjdk-8-jdk
+ java -version
+ - run:
+ name: Download Selenium
+ command: ./node_modules/.bin/selenium-standalone install --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
+ - run:
+ name: Start Selenium
+ command: ./node_modules/.bin/selenium-standalone start --config=../remix-project/apps/remix-ide-e2e/seleniumConfig.js
+ background: true
+ - run: ./apps/remix-ide/ci/browser_tests_run_deploy.sh
+ - store_test_results:
+ path: ./reports/tests
+ - store_artifacts:
+ path: ./reports/screenshots
+
+
+ deploy-remix-live:
+ docker:
+ # specify the version you desire here
+ - image: circleci/node:10.18.0-browsers
+
+ # Specify service dependencies here if necessary
+ # CircleCI maintains a library of pre-built images
+ # documented at https://circleci.com/docs/2.0/circleci-images/
+ resource_class: xlarge
+ # - image: circleci/mongo:3.4.4
+ environment:
+ - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org"
+ - COMMIT_AUTHOR: "Circle CI"
+ - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico"
+ working_directory: ~/remix-project
+
+ steps:
+ - checkout
+ - run: npm install
+ - run: npm run lint
+ - run: npm run build:libs
+ - run: npm run downloadsolc_root
+ - run: npm run build
+ - run:
+ name: Deploy
+ command: |
+ if [ "${CIRCLE_BRANCH}" == "remix_live" ]; then
+ ./apps/remix-ide/ci/deploy_from_travis_remix-live.sh;
+ fi
+
+ publish:
+ docker:
+ # specify the version you desire here
+ - image: circleci/node:10.19.0-buster
+
+ # Specify service dependencies here if necessary
+ # CircleCI maintains a library of pre-built images
+ # documented at https://circleci.com/docs/2.0/circleci-images/
+ resource_class: xlarge
+ # - image: circleci/mongo:3.4.4
+ environment:
+ - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org"
+ - COMMIT_AUTHOR: "Circle CI"
+ - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico"
+ working_directory: ~/remix-project
+
+ steps:
+ - checkout
+ - setup_remote_docker
+ - run: npm install
+ - run: npm run build:libs
+ - run: npm run downloadsolc_root
+ - run: npm run build
+ - run: ./apps/remix-ide/ci/build_and_publish_docker_images.sh
+ - run: ./apps/remix-ide/ci/publishIpfs
+
+ deploy-remix-alpha:
+ docker:
+ # specify the version you desire here
+ - image: circleci/node:10.18.0-browsers
+
+ # Specify service dependencies here if necessary
+ # CircleCI maintains a library of pre-built images
+ resource_class: xlarge
+ # documented at https://circleci.com/docs/2.0/circleci-images/
+ # - image: circleci/mongo:3.4.4
+ environment:
+ - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org"
+ - COMMIT_AUTHOR: "Circle CI"
+ - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico"
+ working_directory: ~/remix-project
+
+ steps:
+ - checkout
+ - run: npm install
+ - run: npm run lint
+ - run: npm run build:libs
+ - run: npm run downloadsolc_root
+ - run: npm run build
+ - run:
+ name: Deploy
+ command: |
+ if [ "${CIRCLE_BRANCH}" == "master" ]; then
+ ./apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh;
+ fi
+
+workflows:
+ version: 2
+ build_all:
+ jobs:
+ - remix-libs
+ - remix-ide-chrome:
+ requires:
+ - remix-libs
+ - remix-ide-firefox:
+ requires:
+ - remix-libs
+ - remix-ide-run-deploy:
+ requires:
+ - remix-libs
+ - publish:
+ requires:
+ - remix-ide-chrome
+ - remix-ide-firefox
+ - remix-ide-run-deploy
+ - deploy-remix-live:
+ requires:
+ - remix-ide-chrome
+ - remix-ide-firefox
+ - remix-ide-run-deploy
+ filters:
+ branches:
+ only: remix_live
+ - deploy-remix-alpha:
+ requires:
+ - remix-ide-chrome
+ - remix-ide-firefox
+ - remix-ide-run-deploy
+ filters:
+ branches:
+ only: master
\ No newline at end of file
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..6e87a003da
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,13 @@
+# Editor configuration, see http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+max_line_length = off
+trim_trailing_whitespace = false
diff --git a/.env b/.env
new file mode 100644
index 0000000000..d3bca64c0b
--- /dev/null
+++ b/.env
@@ -0,0 +1,3 @@
+gist_token=
+account_passphrase=
+account_password=
\ No newline at end of file
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000000..b6bd0ec6ec
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,40 @@
+{
+ "root": true,
+ "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "ecmaVersion": 2018,
+ "sourceType": "module",
+ "project": "./tsconfig.json"
+ },
+ "plugins": ["@typescript-eslint", "@nrwl/nx"],
+ "extends": [
+ "eslint:recommended",
+ "plugin:@typescript-eslint/eslint-recommended",
+ "plugin:@typescript-eslint/recommended",
+ "prettier",
+ "prettier/@typescript-eslint"
+ ],
+ "rules": {
+ "@typescript-eslint/explicit-member-accessibility": "off",
+ "@typescript-eslint/explicit-function-return-type": "off",
+ "@typescript-eslint/no-parameter-properties": "off",
+ "@nrwl/nx/enforce-module-boundaries": [
+ "error",
+ {
+ "enforceBuildableLibDependency": true,
+ "allow": [],
+ "depConstraints": [
+ { "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
+ ]
+ }
+ ]
+ },
+ "overrides": [
+ {
+ "files": ["*.tsx"],
+ "rules": {
+ "@typescript-eslint/no-unused-vars": "off"
+ }
+ }
+ ]
+ }
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..4f0a8bafd7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,54 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+
+build
+dist
+node_modules
+lint.xml
+reports/*
+babelify-src
+docs/_build
+.DS_Store
+.tern-port
+TODO
+soljson.js
+*~
+
+
+# compiled output
+/dist
+/tmp
+/out-tsc
+
+# dependencies
+/node_modules
+
+# IDEs and editors
+/.idea
+.project
+.classpath
+.c9/
+*.launch
+.settings/
+*.sublime-workspace
+
+# IDE - VSCode
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+
+# misc
+/.sass-cache
+/connect.lock
+/coverage
+/libpeerconnection.log
+npm-debug.log
+lerna-debug.log
+yarn-error.log
+testem.log
+/typings
+
+# System Files
+.DS_Store
+Thumbs.db
\ No newline at end of file
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000000..d0b804da2a
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,4 @@
+# Add files here to ignore them from prettier formatting
+
+/dist
+/coverage
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000000..544138be45
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,3 @@
+{
+ "singleQuote": true
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..45fe8a3680
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,17 @@
+# Contributing
+
+Everyone is very welcome to contribute on the codebase of Remix. Please reach us in [Gitter](https://gitter.im/ethereum/remix) in case of any queries.
+
+## Development
+Remix libraries work closely with [Remix IDE](https://remix.ethereum.org). Each library has a readme to explain its application.
+
+When you add a code in any library, please ensure you add related tests. You can visit [here](https://github.com/ethereum/remix-ide#installation) to test your changes by linking the remix libraries with Remix IDE.
+
+## Coding style
+
+Please conform to [standard](https://standardjs.com/) for code styles.
+
+## Submitting Pull Request
+Please follow Github's standard model of making changes & submitting pull request which is very well explained [here](https://guides.github.com/activities/forking/). Make sure your code works fine locally before submitting a pull request.
+
+
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000..7bae0b70ac
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,6 @@
+FROM nginx:alpine
+WORKDIR /
+
+COPY ./temp_publish_docker/ /usr/share/nginx/html/
+
+EXPOSE 80
diff --git a/Dockerfile.dev b/Dockerfile.dev
new file mode 100644
index 0000000000..91fe2eab31
--- /dev/null
+++ b/Dockerfile.dev
@@ -0,0 +1,28 @@
+# This dockerfile is to build each branch seperately (for dev purposes)
+FROM node:10
+# Create Remix user, don't use root!
+# RUN yes | adduser --disabled-password remix && mkdir /app
+# USER remix
+
+# #Now do remix stuff
+# USER remix
+WORKDIR /home/remix
+
+COPY ./ ./
+
+RUN npm ci
+RUN npm run build
+
+FROM nginx:alpine
+WORKDIR /
+
+COPY --from=0 /home/remix/build/ /usr/share/nginx/html/build/
+COPY --from=0 /home/remix/index.html /usr/share/nginx/html/index.html
+COPY --from=0 /home/remix/nginx.conf /etc/nginx/nginx.conf
+COPY --from=0 /home/remix/assets/ /usr/share/nginx/html/assets/
+COPY --from=0 /home/remix/icon.png /usr/share/nginx/html/icon.png
+COPY --from=0 /home/remix/background.js /usr/share/nginx/html/background.js
+COPY --from=0 /home/remix/soljson.js /usr/share/nginx/html/soljson.js
+COPY --from=0 /home/remix/package.json /usr/share/nginx/html/package.json
+
+EXPOSE 80
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000..30fbb3489e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016-2018 Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000..dd7aa66e86
--- /dev/null
+++ b/README.md
@@ -0,0 +1,188 @@
+[![Join the chat at https://gitter.im/ethereum/remix](https://badges.gitter.im/ethereum/remix.svg)](https://gitter.im/ethereum/remix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![CircleCI](https://circleci.com/gh/ethereum/remix-project.svg?style=svg)](https://circleci.com/gh/ethereum/remix-project)
+[![Documentation Status](https://readthedocs.org/projects/docs/badge/?version=latest)](https://remix-ide.readthedocs.io/en/latest/index.html)
+
+# Remix
+
+Remix is a browser-based compiler and IDE that enables users to build **Ethereum contracts with Solidity language** and to debug transactions.
+
+To try it out, visit [https://remix.ethereum.org](https://remix.ethereum.org).
+
+https://github.com/ethereum/remix-project/releases also gives others ways to use Remix locally. Please check it out.
+
+Remix consists of many modules and in this repository you will find Remix related apps, libs and plugins. (remix-ide, remix-analyzer, etc.).
+
+![Remix screenshot](https://github.com/ethereum/remix-project/raw/master/apps/remix-ide/remix_screenshot.png)
+
+## Offline Usage
+
+The `gh-pages` branch has always the latest stable build of Remix. It also contains a ZIP file with the entire build. Download it to use offline.
+
+Note: It contains the latest release of Solidity available at the time of the packaging. No other compiler versions are supported.
+
+
+## INSTALLATION:
+
+Install **npm** and **node.js** (see https://docs.npmjs.com/getting-started/installing-node), then
+install [Nx CLI](https://nx.dev/react/cli/overview) globally to enable running **nx executable commands**.
+```bash
+npm install -g @nrwl/cli
+```
+
+clone the github repository (`wget` need to be installed first) :
+
+```bash
+git clone https://github.com/ethereum/remix-project.git
+
+cd remix-project
+npm install
+nx build remix-ide --with-deps
+nx serve
+```
+
+## Docker:
+
+Prerequisites:
+* Docker (https://docs.docker.com/desktop/)
+* Docker-compose (https://docs.docker.com/compose/install/)
+
+### Run with docker
+
+If you want to run latest changes that are merged into master branch then run:
+
+```
+docker pull remixproject/remix-ide:latest
+docker run -p 8080:80 remixproject/remix-ide:latest
+```
+
+If you want to run latest remix-live release run.
+```
+docker pull remixproject/remix-ide:remix_live
+docker run -p 8080:80 remixproject/remix-ide:remix_live
+```
+
+### Run with docker-compose:
+
+To run locally without building you only need docker-compose.yaml file and you can run:
+
+```
+docker-compose pull
+docker-compose up -d
+```
+
+Then go to http://localhost:8080 and you can use you Remix instance.
+
+To fetch docker-compose file without cloning this repo run:
+```
+curl https://raw.githubusercontent.com/ethereum/remix-ide/master/docker-compose.yaml > docker-compose.yaml
+```
+
+## DEVELOPING:
+
+Run `nx serve` and open `http://127.0.0.1:8080` in your browser.
+
+Then open your `text editor` and start developing.
+The browser will automatically refresh when files are saved.
+
+### Troubleshooting building
+
+Some things to consider if you have trouble building the package:
+
+- Make sure that you have the correct version of `node`, `npm` and `nvm`. Also ensure you have [Nx CLI](https://nx.dev/react/cli/overview) installed globally. You can find the version that is tested on Travis CI by looking at the log in the [build results](https://travis-ci.org/ethereum/remix-ide).
+
+Run:
+
+```bash
+node --version
+npm --version
+nvm --version
+```
+
+- In Debian based OS such as Ubuntu 14.04LTS you may need to run `apt-get install build-essential`. After installing `build-essential` run `npm rebuild`.
+
+## Unit Testing
+
+Run the unit tests via: `nx test `
+```bash
+ nx test remix-analyzer
+```
+
+Running unit tests via `nx test` requires at least node v10.0.0
+
+## Browser Testing
+
+To run the Selenium tests via Nightwatch:
+
+ - Build Remix IDE and serve it: `nx build remix-ide --with-deps && nx serve` # starts web server at localhost:8080
+ - Make sure Selenium is installed `npm run selenium-install` # don't need to repeat
+ - Run a selenium server `npm run selenium`
+ - Run all the tests `npm run nightwatch_local_firefox` or `npm run nightwatch_local_chrome`
+ - Or run a specific test case:
+
+ - npm run nightwatch_local_ballot
+
+ - npm run nightwatch_local_usingWorker
+
+ - npm run nightwatch_local_libraryDeployment
+
+ - npm run nightwatch_local_solidityImport
+
+ - npm run nightwatch_local_recorder
+
+ - npm run nightwatch_local_transactionExecution
+
+ - npm run nightwatch_local_staticAnalysis
+
+ - npm run nightwatch_local_signingMessage
+
+ - npm run nightwatch_local_specialFunctions
+
+ - npm run nightwatch_local_solidityUnitTests
+
+ - npm run nightwatch_local_remixd # remixd needs to be run
+
+ - npm run nightwatch_local_terminal
+
+ - npm run nightwatch_local_gist
+
+ - npm run nightwatch_local_workspace
+
+ - npm run nightwatch_local_defaultLayout
+
+ - npm run nightwatch_local_pluginManager
+
+ - npm run nightwatch_local_publishContract
+
+ - npm run nightwatch_local_generalSettings
+
+ - npm run nightwatch_local_fileExplorer
+
+ - npm run nightwatch_local_debugger
+
+ - npm run nightwatch_local_editor
+
+ - npm run nightwatch_local_compiler
+
+ - npm run nightwatch_local_txListener
+
+ - npm run nightwatch_local_fileManager
+
+ - npm run nightwatch_local_runAndDeploy
+
+
+**NOTE:**
+
+- **the `ballot` tests suite** requires to run `ganache-cli` locally.
+
+- **the `remixd` tests suite** requires to run `remixd` locally.
+
+- **the `gist` tests suite** requires specifying a github access token in **.env file**.
+```
+ gist_token =
+```
+**note that this token should have permission to create a gist.**
+
+
+## Documentation
+
+To see details about how to use Remix for developing and/or debugging Solidity contracts, please see [our documentation page](https://remix-ide.readthedocs.io/en/latest/)
diff --git a/apps/remix-ide-e2e/.eslintrc b/apps/remix-ide-e2e/.eslintrc
new file mode 100644
index 0000000000..0868946880
--- /dev/null
+++ b/apps/remix-ide-e2e/.eslintrc
@@ -0,0 +1,14 @@
+{
+ "rules": {},
+ "overrides": [
+ {
+ "files": ["**/*.ts"],
+ "rules": {
+ "no-undef": "off",
+ "@typescript-eslint/no-var-requires": 0
+ }
+ }
+ ],
+ "extends": ["../../.eslintrc"],
+ "ignorePatterns": ["!**/*"]
+}
\ No newline at end of file
diff --git a/apps/remix-ide-e2e/nightwatch.ts b/apps/remix-ide-e2e/nightwatch.ts
new file mode 100644
index 0000000000..e9af1d2866
--- /dev/null
+++ b/apps/remix-ide-e2e/nightwatch.ts
@@ -0,0 +1,83 @@
+import * as fs from 'fs'
+
+const crxFile = fs.readFileSync('apps/remix-ide-e2e/src/extensions/chrome/metamask.crx')
+const metamaskExtension = Buffer.from(crxFile).toString('base64')
+
+module.exports = {
+ 'src_folders': ['dist/apps/remix-ide-e2e/src/tests'],
+ 'output_folder': './reports/tests',
+ 'custom_commands_path': ['dist/apps/remix-ide-e2e/src/commands'],
+ 'custom_assertions_path': '',
+ 'page_objects_path': '',
+ 'globals_path': '',
+
+ 'test_settings': {
+ 'default': {
+ 'selenium_port': 4444,
+ 'selenium_host': 'localhost',
+ 'globals': {
+ 'waitForConditionTimeout': 10000,
+ 'asyncHookTimeout': 100000
+ },
+ 'screenshots': {
+ 'enabled': true,
+ 'path': './reports/screenshots',
+ 'on_failure': true,
+ 'on_error': true
+ },
+ 'desiredCapabilities': {
+ 'browserName': 'firefox',
+ 'javascriptEnabled': true,
+ 'acceptSslCerts': true
+ },
+ 'exclude': ['dist/apps/remix-ide-e2e/src/tests/runAndDeploy.js']
+ },
+
+ 'chrome': {
+ 'desiredCapabilities': {
+ 'browserName': 'chrome',
+ 'javascriptEnabled': true,
+ 'acceptSslCerts': true,
+ 'goog:chromeOptions': {
+ 'args': ['window-size=2560,1440', 'start-fullscreen']
+ }
+ }
+ },
+
+ 'chrome-runAndDeploy': {
+ 'desiredCapabilities': {
+ 'browserName': 'chrome',
+ 'javascriptEnabled': true,
+ 'acceptSslCerts': true,
+ 'goog:chromeOptions': {
+ 'args': ['window-size=2560,1440', 'start-fullscreen'],
+ 'extensions': [metamaskExtension]
+ }
+ }
+ },
+
+ 'safari': {
+ 'desiredCapabilities': {
+ 'browserName': 'safari',
+ 'javascriptEnabled': true,
+ 'acceptSslCerts': true
+ }
+ },
+
+ 'ie': {
+ 'desiredCapabilities': {
+ 'browserName': 'internet explorer',
+ 'javascriptEnabled': true,
+ 'acceptSslCerts': true
+ }
+ },
+
+ 'firefox': {
+ 'desiredCapabilities': {
+ 'browserName': 'firefox',
+ 'javascriptEnabled': true,
+ 'acceptSslCerts': true
+ }
+ }
+ }
+}
diff --git a/apps/remix-ide-e2e/seleniumConfig.js b/apps/remix-ide-e2e/seleniumConfig.js
new file mode 100644
index 0000000000..210c9b6fa6
--- /dev/null
+++ b/apps/remix-ide-e2e/seleniumConfig.js
@@ -0,0 +1,11 @@
+module.exports = {
+ version: '3.8.1',
+ baseURL: 'https://selenium-release.storage.googleapis.com',
+ drivers: {
+ chrome: {
+ version: '2.39',
+ arch: process.arch,
+ baseURL: 'https://chromedriver.storage.googleapis.com'
+ }
+ }
+}
diff --git a/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts b/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts
new file mode 100644
index 0000000000..2369b576d8
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts
@@ -0,0 +1,36 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class addAtAddressInstance extends EventEmitter {
+ command (this: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean): NightwatchBrowser {
+ this.api.perform((done: VoidFunction) => {
+ addInstance(this.api, address, isValidFormat, isValidChecksum, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function addInstance (browser: NightwatchBrowser, address: string, isValidFormat: boolean, isValidChecksum: boolean, callback: VoidFunction) {
+ browser.clickLaunchIcon('udapp').clearValue('.ataddressinput').setValue('.ataddressinput', address, function () {
+ browser.click('button[id^="runAndDeployAtAdressButton"]')
+ .execute(function () {
+ const ret = document.querySelector('div[class^="modal-body"] div').innerHTML
+ const modal = document.querySelector('#modal-footer-ok') as HTMLElement
+
+ modal.click()
+ return ret
+ }, [], function (result) {
+ if (!isValidFormat) {
+ browser.assert.equal(result.value, 'Invalid address.')
+ } else if (!isValidChecksum) {
+ browser.assert.equal(result.value, 'Invalid checksum address.')
+ }
+ callback()
+ })
+ })
+}
+
+module.exports = addAtAddressInstance
diff --git a/apps/remix-ide-e2e/src/commands/addFile.ts b/apps/remix-ide-e2e/src/commands/addFile.ts
new file mode 100644
index 0000000000..149d0fa43b
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/addFile.ts
@@ -0,0 +1,39 @@
+import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
+import EventEmitter from "events"
+
+class AddFile extends EventEmitter {
+ command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {
+ this.api.perform((done) => {
+ addFile(this.api, name, content, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
+ browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile')
+ .waitForElementVisible('#modal-dialog')
+ .perform((client, done) => {
+ browser.execute(function (fileName) {
+ if (fileName !== 'Untitled.sol') {
+ document.querySelector('#modal-dialog #prompt_text').setAttribute('value', fileName)
+ }
+ const elem = document.querySelector('#modal-footer-ok') as HTMLElement
+
+ elem.click()
+ }, [name], function (result) {
+ console.log(result)
+ done()
+ })
+ })
+ .setEditorValue(content.content)
+ .pause(1000)
+ .perform(function () {
+ done()
+ })
+}
+
+module.exports = AddFile
diff --git a/apps/remix-ide-e2e/src/commands/checkElementStyle.ts b/apps/remix-ide-e2e/src/commands/checkElementStyle.ts
new file mode 100644
index 0000000000..6d3a099833
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/checkElementStyle.ts
@@ -0,0 +1,31 @@
+import EventEmitter from 'events'
+import { NightwatchBrowser } from 'nightwatch'
+
+class checkElementStyle extends EventEmitter {
+ command (this: NightwatchBrowser, cssSelector: string, styleProperty: string, expectedResult: string): NightwatchBrowser {
+ this.api.perform((done) => {
+ checkStyle(this.api, cssSelector, styleProperty, expectedResult, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function checkStyle (browser: NightwatchBrowser, cssSelector: string, styleProperty: string, expectedResult: string, callback: VoidFunction) {
+ browser.execute(function (cssSelector, styleProperty) {
+ return window.getComputedStyle(document.querySelector(cssSelector)).getPropertyValue(styleProperty)
+ }, [cssSelector, styleProperty], function (result) {
+ const value = result.value
+
+ if (typeof value === 'string') {
+ browser.assert.equal(value.trim().toLowerCase(), expectedResult.toLowerCase())
+ } else {
+ browser.assert.fail('Failed with error info :', result.value.toString())
+ }
+ callback()
+ })
+}
+
+module.exports = checkElementStyle
diff --git a/apps/remix-ide-e2e/src/commands/checkTerminalFilter.ts b/apps/remix-ide-e2e/src/commands/checkTerminalFilter.ts
new file mode 100644
index 0000000000..2ebc4cd1f1
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/checkTerminalFilter.ts
@@ -0,0 +1,36 @@
+import EventEmitter from 'events'
+import { NightwatchBrowser } from 'nightwatch'
+
+class CheckTerminalFilter extends EventEmitter {
+ command (this: NightwatchBrowser, filter: string, test: string): NightwatchBrowser {
+ this.api.perform((done) => {
+ checkFilter(this.api, filter, test, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function checkFilter (browser: NightwatchBrowser, filter: string, test: string, done: VoidFunction) {
+ if (browser.options.desiredCapabilities.browserName === 'chrome') { // nightwatch deos not handle well that part.... works locally
+ done()
+ return
+ }
+ const filterClass = '[data-id="terminalInputSearch"]'
+ browser.setValue(filterClass, filter, function () {
+ browser.execute(function () {
+ return document.querySelector('[data-id="terminalJournal"]').innerHTML === test
+ }, [], function (result) {
+ browser.clearValue(filterClass).setValue(filterClass, '', function () {
+ if (!result.value) {
+ browser.assert.fail('useFilter on ' + filter + ' ' + test, 'info about error', '')
+ }
+ done()
+ })
+ })
+ })
+}
+
+module.exports = CheckTerminalFilter
diff --git a/apps/remix-ide-e2e/src/commands/checkVariableDebug.ts b/apps/remix-ide-e2e/src/commands/checkVariableDebug.ts
new file mode 100644
index 0000000000..f899c6f013
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/checkVariableDebug.ts
@@ -0,0 +1,42 @@
+import { NightwatchBrowser, NightwatchCheckVariableDebugValue } from 'nightwatch'
+import EventEmitter from "events"
+
+const deepequal = require('deep-equal')
+
+class CheckVariableDebug extends EventEmitter {
+ command (this: NightwatchBrowser, id: string, debugValue: NightwatchCheckVariableDebugValue): NightwatchBrowser {
+ this.api.perform((done) => {
+ checkDebug(this.api, id, debugValue, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function checkDebug (browser: NightwatchBrowser, id: string, debugValue: NightwatchCheckVariableDebugValue, done: VoidFunction) {
+ // id is soliditylocals or soliditystate
+ browser.execute(function (id: string) {
+ const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement
+
+ return elem.innerText
+ }, [id], function (result) {
+ console.log(id + ' ' + result.value)
+ let value
+ try {
+ value = JSON.parse(result.value)
+ } catch (e) {
+ browser.assert.fail('cant parse solidity state', e.message, '')
+ done()
+ return
+ }
+ const equal = deepequal(debugValue, value)
+ if (!equal) {
+ browser.assert.fail('checkDebug on ' + id, 'info about error\n ' + JSON.stringify(debugValue) + '\n ' + JSON.stringify(value), '')
+ }
+ done()
+ })
+}
+
+module.exports = CheckVariableDebug
diff --git a/apps/remix-ide-e2e/src/commands/clearEditableContent.ts b/apps/remix-ide-e2e/src/commands/clearEditableContent.ts
new file mode 100644
index 0000000000..ad433d3af1
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/clearEditableContent.ts
@@ -0,0 +1,31 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from 'events'
+
+class clearEditablecontent extends EventEmitter {
+ command (this: NightwatchBrowser, cssSelector: string): NightwatchBrowser {
+ this.api.perform((done) => {
+ clearContent(this.api, cssSelector, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function clearContent (browser: NightwatchBrowser, cssSelector: string, callback: VoidFunction) {
+ browser.execute(function (cssSelector) {
+ const selection = window.getSelection()
+ const range = document.createRange()
+
+ range.selectNodeContents(document.querySelector(cssSelector))
+ selection.removeAllRanges()
+ selection.addRange(range)
+ }, [cssSelector], function () {
+ browser.sendKeys(cssSelector, browser.Keys.BACK_SPACE)
+ .pause(5000)
+ callback()
+ })
+}
+
+module.exports = clearEditablecontent
diff --git a/apps/remix-ide-e2e/src/commands/clickElementAtPosition.ts b/apps/remix-ide-e2e/src/commands/clickElementAtPosition.ts
new file mode 100644
index 0000000000..f66315c3b0
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/clickElementAtPosition.ts
@@ -0,0 +1,27 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from 'events'
+
+class ClickElement extends EventEmitter {
+ command (this: NightwatchBrowser, cssSelector: string, index = 0): NightwatchBrowser {
+ this.api.perform((done) => {
+ _clickElement(this.api, cssSelector, index, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function _clickElement (browser: NightwatchBrowser, cssSelector: string, index: number, cb: VoidFunction) {
+ browser.waitForElementPresent(cssSelector)
+ .execute(function (cssSelector: string, index: number) {
+ const elem = document.querySelectorAll(cssSelector)[index] as HTMLElement
+
+ elem.click()
+ }, [cssSelector, index], function () {
+ cb()
+ })
+}
+
+module.exports = ClickElement
diff --git a/apps/remix-ide-e2e/src/commands/clickFunction.ts b/apps/remix-ide-e2e/src/commands/clickFunction.ts
new file mode 100644
index 0000000000..20e44766d4
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/clickFunction.ts
@@ -0,0 +1,26 @@
+import { NightwatchBrowser, NightwatchClickFunctionExpectedInput } from 'nightwatch'
+import EventEmitter from "events"
+
+class ClickFunction extends EventEmitter {
+ command (this: NightwatchBrowser, fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser {
+ this.api.waitForElementPresent('.instance button[title="' + fnFullName + '"]')
+ .perform(function (client, done) {
+ client.execute(function () {
+ document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight
+ }, [], function () {
+ if (expectedInput) {
+ client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, _ => _)
+ }
+ done()
+ })
+ })
+ .click('.instance button[title="' + fnFullName + '"]')
+ .pause(2000)
+ .perform(() => {
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = ClickFunction
diff --git a/apps/remix-ide-e2e/src/commands/clickInstance.ts b/apps/remix-ide-e2e/src/commands/clickInstance.ts
new file mode 100644
index 0000000000..3d92144966
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/clickInstance.ts
@@ -0,0 +1,14 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class ClickInstance extends EventEmitter {
+ command (this: NightwatchBrowser, index: number): NightwatchBrowser {
+ index = index + 2
+ const selector = '.instance:nth-of-type(' + index + ') > div > button'
+
+ this.api.waitForElementPresent(selector).scrollAndClick(selector).perform(() => { this.emit('complete') })
+ return this
+ }
+}
+
+module.exports = ClickInstance
diff --git a/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts b/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts
new file mode 100644
index 0000000000..b458cfb0ac
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts
@@ -0,0 +1,14 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class ClickLaunchIcon extends EventEmitter {
+ command (this: NightwatchBrowser, icon: string): NightwatchBrowser {
+ this.api.waitForElementVisible('#icon-panel div[plugin="' + icon + '"]').click('#icon-panel div[plugin="' + icon + '"]').perform((done) => {
+ done()
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = ClickLaunchIcon
diff --git a/apps/remix-ide-e2e/src/commands/createContract.ts b/apps/remix-ide-e2e/src/commands/createContract.ts
new file mode 100644
index 0000000000..2503a839c9
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/createContract.ts
@@ -0,0 +1,32 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class CreateContract extends EventEmitter {
+ command (this: NightwatchBrowser, inputParams: string): NightwatchBrowser {
+ this.api.perform((done) => {
+ createContract(this.api, inputParams, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function createContract (browser: NightwatchBrowser, inputParams: string, callback: VoidFunction) {
+ if (inputParams) {
+ browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
+ .setValue('div[class^="contractActionsContainerSingle"] input', inputParams, function () {
+ browser.click('#runTabView button[class^="instanceButton"]').pause(500).perform(function () { callback() })
+ })
+ } else {
+ browser
+ .clickLaunchIcon('settings')
+ .clickLaunchIcon('udapp')
+ .click('#runTabView button[class^="instanceButton"]')
+ .pause(500)
+ .perform(function () { callback() })
+ }
+}
+
+module.exports = CreateContract
diff --git a/apps/remix-ide-e2e/src/commands/debugTransaction.ts b/apps/remix-ide-e2e/src/commands/debugTransaction.ts
new file mode 100644
index 0000000000..57174d9a9c
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/debugTransaction.ts
@@ -0,0 +1,26 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class debugTransaction extends EventEmitter {
+ command (this: NightwatchBrowser, index = 0): NightwatchBrowser {
+ this.api.perform((done) => {
+ checkStyle(this.api, index, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function checkStyle (browser: NightwatchBrowser, index: number, callback: VoidFunction) {
+ browser.pause(2000).execute(function (index: number) {
+ const debugBtn = document.querySelectorAll('*[data-shared="txLoggerDebugButton"]')[index] as HTMLInputElement
+
+ debugBtn.click()
+ }, [index], function () {
+ callback()
+ })
+}
+
+module.exports = debugTransaction
diff --git a/apps/remix-ide-e2e/src/commands/editorScroll.ts b/apps/remix-ide-e2e/src/commands/editorScroll.ts
new file mode 100644
index 0000000000..6d48571f68
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/editorScroll.ts
@@ -0,0 +1,22 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+// fix for editor scroll
+class ScrollEditor extends EventEmitter {
+ command (this: NightwatchBrowser, direction: 'up' | 'down', numberOfTimes: number): NightwatchBrowser {
+ const browser = this.api
+
+ browser.waitForElementPresent('.ace_text-input')
+ for (let i = 0; i < numberOfTimes; i++) {
+ if (direction.toLowerCase() === 'up') browser.sendKeys('.ace_text-input', browser.Keys.ARROW_UP)
+ if (direction.toLowerCase() === 'down') browser.sendKeys('.ace_text-input', browser.Keys.ARROW_DOWN)
+ }
+ browser.perform((done) => {
+ done()
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = ScrollEditor
diff --git a/apps/remix-ide-e2e/src/commands/executeScript.ts b/apps/remix-ide-e2e/src/commands/executeScript.ts
new file mode 100644
index 0000000000..c89f6bd500
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/executeScript.ts
@@ -0,0 +1,19 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class ExecuteScript extends EventEmitter {
+ command (this: NightwatchBrowser, script: string): NightwatchBrowser {
+ this.api
+ .clearEditableContent('*[data-id="terminalCliInput"]')
+ .click('*[data-id="terminalCli"]')
+ .sendKeys('*[data-id="terminalCliInput"]', script)
+ .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER)
+ .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER)
+ .perform(() => {
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = ExecuteScript
diff --git a/apps/remix-ide-e2e/src/commands/getAddressAtPosition.ts b/apps/remix-ide-e2e/src/commands/getAddressAtPosition.ts
new file mode 100644
index 0000000000..40319db14d
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/getAddressAtPosition.ts
@@ -0,0 +1,31 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class GetAddressAtPosition extends EventEmitter {
+ command (this: NightwatchBrowser, index: number, cb: (pos: string) => void): NightwatchBrowser {
+ this.api.perform((done) => {
+ getAddressAtPosition(this.api, index, (pos) => {
+ done()
+ cb(pos)
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function getAddressAtPosition (browser: NightwatchBrowser, index: number, callback: (pos: string) => void) {
+ browser.waitForElementPresent('*[data-shared="universalDappUiInstance"]')
+ .execute(function (index) {
+ const deployedContracts = document.querySelectorAll('*[data-shared="universalDappUiInstance"]')
+ const id = deployedContracts[index].getAttribute('id')
+
+ return id.replace('instance', '')
+ }, [index], function (result) {
+ const pos = typeof result.value === 'string' ? result.value : null
+
+ callback(pos)
+ })
+}
+
+module.exports = GetAddressAtPosition
diff --git a/apps/remix-ide-e2e/src/commands/getEditorValue.ts b/apps/remix-ide-e2e/src/commands/getEditorValue.ts
new file mode 100644
index 0000000000..9b8ea7b456
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/getEditorValue.ts
@@ -0,0 +1,23 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class GetEditorValue extends EventEmitter {
+ command (this: NightwatchBrowser, callback: (content: string) => void): NightwatchBrowser {
+ this.api.perform((client, done) => {
+ this.api.execute(function () {
+ const elem: any = document.getElementById('input')
+
+ return elem.editor.getValue()
+ }, [], (result) => {
+ done()
+ const value = typeof result.value === 'string' ? result.value : null
+
+ callback(value)
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+module.exports = GetEditorValue
diff --git a/apps/remix-ide-e2e/src/commands/getInstalledPlugins.ts b/apps/remix-ide-e2e/src/commands/getInstalledPlugins.ts
new file mode 100644
index 0000000000..cbccd215a4
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/getInstalledPlugins.ts
@@ -0,0 +1,28 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class GetInstalledPlugins extends EventEmitter {
+ command (this: NightwatchBrowser, cb: (plugins: string[]) => void): NightwatchBrowser {
+ const browser = this.api
+
+ browser.waitForElementPresent('[plugin]:not([plugin=""]')
+ .perform((done) => {
+ browser.execute(function() {
+ const pluginNames = []
+ const plugins = document.querySelectorAll('[plugin]:not([plugin=""]')
+
+ plugins.forEach(plugin => {
+ pluginNames.push(plugin.getAttribute('plugin'))
+ })
+ return pluginNames
+ }, [], (result) => {
+ done()
+ Array.isArray(result.value) && cb(result.value)
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+module.exports = GetInstalledPlugins
diff --git a/apps/remix-ide-e2e/src/commands/getModalBody.ts b/apps/remix-ide-e2e/src/commands/getModalBody.ts
new file mode 100644
index 0000000000..85ee421aab
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/getModalBody.ts
@@ -0,0 +1,19 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class GetModalBody extends EventEmitter {
+ command (this: NightwatchBrowser, callback: (value: string, cb: VoidFunction) => void) {
+ this.api.waitForElementVisible('.modal-body')
+ .getText('.modal-body', (result) => {
+ console.log(result)
+ const value = typeof result.value === 'string' ? result.value : null
+
+ callback(value, () => {
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+module.exports = GetModalBody
diff --git a/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts
new file mode 100644
index 0000000000..274abb15e7
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts
@@ -0,0 +1,37 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+class GoToVmTraceStep extends EventEmitter {
+ command (this: NightwatchBrowser, step: number, incr?: number): NightwatchBrowser {
+ this.api.perform((done) => {
+ goToVMtraceStep(this.api, step, incr, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function goToVMtraceStep (browser: NightwatchBrowser, step: number, incr: number, done: VoidFunction) {
+ if (!incr) incr = 0
+ browser.execute(function () {
+ return document.querySelector('#stepdetail').innerHTML
+ }, [], function (result) {
+ if (typeof result.value === 'string' && ( result.value.indexOf('vm trace step:') !== -1 && result.value.indexOf(step.toString()) !== -1)) {
+ done()
+ } else if (incr > 1000) {
+ browser.assert.fail('goToVMtraceStep fails', 'info about error', '')
+ done()
+ } else {
+ incr++
+ browser.click('#intoforward')
+ .perform(() => {
+ setTimeout(() => {
+ goToVMtraceStep(browser, step, incr, done)
+ }, 200)
+ })
+ }
+ })
+}
+
+module.exports = GoToVmTraceStep
diff --git a/apps/remix-ide-e2e/src/commands/journalChildIncludes.ts b/apps/remix-ide-e2e/src/commands/journalChildIncludes.ts
new file mode 100644
index 0000000000..a831edc843
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/journalChildIncludes.ts
@@ -0,0 +1,31 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+/*
+ Checks if any child elements of journal (console) contains a matching value.
+*/
+class JournalChildIncludes extends EventEmitter {
+ command (this: NightwatchBrowser, val: string): NightwatchBrowser {
+ let isTextFound = false
+ const browser = this.api
+
+ this.api.elements('css selector', '*[data-id="terminalJournal"]', (res) => {
+ Array.isArray(res.value) && res.value.forEach(function (jsonWebElement) {
+ const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
+
+ browser.elementIdText(jsonWebElementId, (jsonElement) => {
+ const text = jsonElement.value
+
+ if (typeof text === 'string' && text.indexOf(val) !== -1) isTextFound = true
+ })
+ })
+ })
+ browser.perform(() => {
+ browser.assert.ok(isTextFound, isTextFound ? `<*[data-id="terminalJournal"]> contains ${val}.` : `${val} not found in <*[data-id="terminalJournal"]> div:last-child>`)
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = JournalChildIncludes
diff --git a/apps/remix-ide-e2e/src/commands/journalLastChild.ts b/apps/remix-ide-e2e/src/commands/journalLastChild.ts
new file mode 100644
index 0000000000..6837988b8f
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/journalLastChild.ts
@@ -0,0 +1,15 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class JournalLastChild extends EventEmitter {
+ command (this: NightwatchBrowser, val: string): NightwatchBrowser {
+ this.api
+ .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
+ .assert.containsText('*[data-id="terminalJournal"] > div:last-child', val).perform(() => {
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = JournalLastChild
diff --git a/apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts b/apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts
new file mode 100644
index 0000000000..e215e6c24d
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/journalLastChildIncludes.ts
@@ -0,0 +1,21 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+/*
+ Check if the last log in the console contains a specific text
+*/
+class JournalLastChildIncludes extends EventEmitter {
+ command (this: NightwatchBrowser, val: string): NightwatchBrowser {
+ this.api
+ .waitForElementVisible('*[data-id="terminalJournal"] > div:last-child', 10000)
+ .getText('*[data-id="terminalJournal"] > div:last-child', (result) => {
+ console.log('JournalLastChildIncludes', result.value)
+ if (typeof result.value === 'string' && result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`)
+ else this.api.assert.ok(true, `<*[data-id="terminalJournal"] > div:last-child> contains ${val}.`)
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = JournalLastChildIncludes
diff --git a/apps/remix-ide-e2e/src/commands/modalFooterCancelClick.ts b/apps/remix-ide-e2e/src/commands/modalFooterCancelClick.ts
new file mode 100644
index 0000000000..429a423898
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/modalFooterCancelClick.ts
@@ -0,0 +1,20 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class ModalFooterOKClick extends EventEmitter {
+ command (this: NightwatchBrowser): NightwatchBrowser {
+ this.api.waitForElementVisible('#modal-footer-cancel').perform((client, done) => {
+ this.api.execute(function () {
+ const elem = document.querySelector('#modal-footer-cancel') as HTMLElement
+
+ elem.click()
+ }, [], () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+module.exports = ModalFooterOKClick
diff --git a/apps/remix-ide-e2e/src/commands/modalFooterOKClick.ts b/apps/remix-ide-e2e/src/commands/modalFooterOKClick.ts
new file mode 100644
index 0000000000..db9cf29df7
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/modalFooterOKClick.ts
@@ -0,0 +1,20 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class ModalFooterOKClick extends EventEmitter {
+ command (this: NightwatchBrowser): NightwatchBrowser {
+ this.api.waitForElementVisible('#modal-footer-ok').perform((client, done) => {
+ this.api.execute(function () {
+ const elem = document.querySelector('#modal-footer-ok') as HTMLElement
+
+ elem.click()
+ }, [], () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+module.exports = ModalFooterOKClick
diff --git a/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts b/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts
new file mode 100644
index 0000000000..05dab2734e
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts
@@ -0,0 +1,29 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class NoWorkerErrorFor extends EventEmitter {
+ command (this: NightwatchBrowser, version: string): NightwatchBrowser {
+ this.api.perform((done: VoidFunction) => {
+ noWorkerErrorFor(this.api, version, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function noWorkerErrorFor (browser: NightwatchBrowser, version: string, callback: VoidFunction) {
+ browser
+ .setSolidityCompilerVersion(version)
+ .click('*[data-id="compilerContainerCompileBtn"]')
+ .waitForElementPresent('*[data-id="compilationFinishedWith_' + version + '"]', 10000)
+ .notContainsText('*[data-id="compiledErrors"]', 'worker error:undefined')
+ .notContainsText('*[data-id="compiledErrors"]', 'Uncaught RangeError: Maximum call stack size exceeded')
+ .notContainsText('*[data-id="compiledErrors"]', 'RangeError: Maximum call stack size exceeded')
+ .perform(() => {
+ callback()
+ })
+}
+
+module.exports = NoWorkerErrorFor
diff --git a/apps/remix-ide-e2e/src/commands/notContainsText.ts b/apps/remix-ide-e2e/src/commands/notContainsText.ts
new file mode 100644
index 0000000000..8b3794d61e
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/notContainsText.ts
@@ -0,0 +1,19 @@
+import { NightwatchBrowser } from "nightwatch"
+import EventEmitter from "events"
+
+class NotContainsText extends EventEmitter {
+ command (this: NightwatchBrowser, cssSelector: string, text: string): NightwatchBrowser {
+ const browser = this.api
+
+ browser.getText(cssSelector, (result) => {
+ if (typeof result.value === 'string' && result.value.includes(text)) return this.api.assert.fail(`${cssSelector} contains ${text}.`)
+ else this.api.assert.ok(true, `${cssSelector} does not contains ${text}.`)
+ })
+ .perform(() => {
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = NotContainsText
diff --git a/apps/remix-ide-e2e/src/commands/openFile.ts b/apps/remix-ide-e2e/src/commands/openFile.ts
new file mode 100644
index 0000000000..262c9dddaf
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/openFile.ts
@@ -0,0 +1,27 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from 'events'
+
+class OpenFile extends EventEmitter {
+ command (this: NightwatchBrowser, name: string) {
+ this.api.perform((done) => {
+ openFile(this.api, name, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+// click on fileExplorer can toggle it. We go through settings to be sure FE is open
+function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction) {
+ browser.clickLaunchIcon('settings').clickLaunchIcon('fileExplorers')
+ .waitForElementVisible('li[key="' + name + '"]')
+ .click('li[key="' + name + '"]')
+ .pause(2000)
+ .perform(() => {
+ done()
+ })
+}
+
+module.exports = OpenFile
diff --git a/apps/remix-ide-e2e/src/commands/removeFile.ts b/apps/remix-ide-e2e/src/commands/removeFile.ts
new file mode 100644
index 0000000000..512f7c0c3b
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/removeFile.ts
@@ -0,0 +1,49 @@
+import { NightwatchBrowser } from "nightwatch"
+
+const EventEmitter = require('events')
+
+class RemoveFile extends EventEmitter {
+ command (this: NightwatchBrowser, path: string): NightwatchBrowser {
+ this.api.perform((done) => {
+ removeFile(this.api, path, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function removeFile (browser: NightwatchBrowser, path: string, done: VoidFunction) {
+ browser.execute(function (path) {
+ function contextMenuClick (element) {
+ const evt = element.ownerDocument.createEvent('MouseEvents')
+ const RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE
+
+ evt.initMouseEvent('contextmenu', true, true,
+ element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
+ false, false, false, RIGHT_CLICK_BUTTON_CODE, null)
+ if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) {
+ // dispatch for IE
+ return element.fireEvent('onclick', evt)
+ } else {
+ // dispatch for firefox + others
+ return !element.dispatchEvent(evt)
+ }
+ }
+ contextMenuClick(document.querySelector('[data-path="' + path + '"]'))
+ }, [path], function () {
+ browser
+ .waitForElementVisible('#menuitemdelete', 2000)
+ .click('#menuitemdelete')
+ .pause(500)
+ .waitForElementVisible('#modal-footer-ok', 2000)
+ .click('#modal-footer-ok')
+ .waitForElementNotPresent('[data-path="' + path + '"]')
+ .perform(() => {
+ done()
+ })
+ })
+}
+
+module.exports = RemoveFile
diff --git a/apps/remix-ide-e2e/src/commands/renameFile.ts b/apps/remix-ide-e2e/src/commands/renameFile.ts
new file mode 100644
index 0000000000..551ea3365c
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/renameFile.ts
@@ -0,0 +1,56 @@
+import EventEmitter from 'events'
+import { NightwatchBrowser } from 'nightwatch'
+
+class RenameFile extends EventEmitter {
+ command (this: NightwatchBrowser, path: string, newFileName: string, renamedPath: string) {
+ this.api.perform((done) => {
+ renameFile(this.api, path, newFileName, renamedPath, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function renameFile (browser: NightwatchBrowser, path: string, newFileName: string, renamedPath: string, done: VoidFunction) {
+ browser.execute(function (path: string) {
+ function contextMenuClick (element) {
+ const evt = element.ownerDocument.createEvent('MouseEvents')
+ const RIGHT_CLICK_BUTTON_CODE = 2 // the same for FF and IE
+
+ evt.initMouseEvent('contextmenu', true, true,
+ element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
+ false, false, false, RIGHT_CLICK_BUTTON_CODE, null)
+ if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) {
+ // dispatch for IE
+ return element.fireEvent('onclick', evt)
+ } else {
+ // dispatch for firefox + others
+ return !element.dispatchEvent(evt)
+ }
+ }
+ contextMenuClick(document.querySelector('[data-path="' + path + '"]'))
+ }, [path], function () {
+ browser
+ .click('#menuitemrename')
+ .perform((client, doneSetValue) => {
+ browser.execute(function (path, addvalue) {
+ document.querySelector('[data-path="' + path + '"]').innerHTML = addvalue
+ }, [path, newFileName], () => {
+ doneSetValue()
+ })
+ })
+ .click('body') // blur
+ .waitForElementVisible('#modal-footer-ok', 100000)
+ .pause(2000)
+ .click('#modal-footer-ok')
+ .waitForElementNotPresent('[data-path="' + path + '"]')
+ .waitForElementPresent('[data-path="' + renamedPath + '"]')
+ .perform(() => {
+ done()
+ })
+ })
+}
+
+module.exports = RenameFile
\ No newline at end of file
diff --git a/apps/remix-ide-e2e/src/commands/rightClick.ts b/apps/remix-ide-e2e/src/commands/rightClick.ts
new file mode 100644
index 0000000000..c373c99d6b
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/rightClick.ts
@@ -0,0 +1,37 @@
+import EventEmitter from 'events'
+import { NightwatchBrowser } from 'nightwatch'
+
+class RightClick extends EventEmitter {
+ command (this: NightwatchBrowser, cssSelector: string) {
+ this.api.perform((done) => {
+ rightClick(this.api, cssSelector, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function rightClick (browser: NightwatchBrowser, cssSelector: string, callback: VoidFunction) {
+ browser.execute(function (cssSelector: string) {
+ const element: any = document.querySelector(cssSelector)
+ const evt = element.ownerDocument.createEvent('MouseEvents')
+ const RIGHT_CLICK_BUTTON_CODE = 2
+
+ evt.initMouseEvent('contextmenu', true, true,
+ element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
+ false, false, false, RIGHT_CLICK_BUTTON_CODE, null)
+ if (Object.prototype.hasOwnProperty.call(document, 'createEventObject')) {
+ // dispatch for IE
+ return element.fireEvent('onclick', evt)
+ } else {
+ // dispatch for firefox + others
+ return !element.dispatchEvent(evt)
+ }
+ }, [cssSelector], function () {
+ callback()
+ })
+}
+
+module.exports = RightClick
diff --git a/apps/remix-ide-e2e/src/commands/scrollAndClick.ts b/apps/remix-ide-e2e/src/commands/scrollAndClick.ts
new file mode 100644
index 0000000000..cfcf8a016d
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/scrollAndClick.ts
@@ -0,0 +1,16 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class scrollAndClick extends EventEmitter {
+ command (this: NightwatchBrowser, target: string): NightwatchBrowser {
+ this.api
+ .scrollInto(target)
+ .click(target)
+ .perform(() => {
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = scrollAndClick
diff --git a/apps/remix-ide-e2e/src/commands/scrollInto.ts b/apps/remix-ide-e2e/src/commands/scrollInto.ts
new file mode 100644
index 0000000000..7ccab49cc8
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/scrollInto.ts
@@ -0,0 +1,24 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class ScrollInto extends EventEmitter {
+ command (this: NightwatchBrowser, target: string): NightwatchBrowser {
+ this.api.perform((client, done) => {
+ _scrollInto(this.api, target, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function _scrollInto (browser: NightwatchBrowser, target: string, cb: VoidFunction): void {
+ browser.execute(function (target) {
+ document.querySelector(target).scrollIntoView(({block: 'center'}))
+ }, [target], function () {
+ cb()
+ })
+}
+
+module.exports = ScrollInto
diff --git a/apps/remix-ide-e2e/src/commands/selectAccount.ts b/apps/remix-ide-e2e/src/commands/selectAccount.ts
new file mode 100644
index 0000000000..413012acdd
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/selectAccount.ts
@@ -0,0 +1,17 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class SelectAccount extends EventEmitter {
+ command (this: NightwatchBrowser, account?: string): NightwatchBrowser {
+ if (account) {
+ this.api
+ .click(`select[data-id="runTabSelectAccount"] [value="${account}"]`)
+ .perform(() => {
+ this.emit('complete')
+ })
+ } else this.emit('complete')
+ return this
+ }
+}
+
+module.exports = SelectAccount
diff --git a/apps/remix-ide-e2e/src/commands/selectContract.ts b/apps/remix-ide-e2e/src/commands/selectContract.ts
new file mode 100644
index 0000000000..b228ef85f6
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/selectContract.ts
@@ -0,0 +1,23 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class SelectContract extends EventEmitter {
+ command (this: NightwatchBrowser, contractName: string): NightwatchBrowser {
+ this.api.perform((done) => {
+ selectContract(this.api, contractName, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function selectContract (browser: NightwatchBrowser, contractName: string, callback: VoidFunction) {
+ browser.clickLaunchIcon('settings').clickLaunchIcon('udapp')
+ .setValue('#runTabView select[class^="contractNames"]', contractName).perform(() => {
+ callback()
+ })
+}
+
+module.exports = SelectContract
diff --git a/apps/remix-ide-e2e/src/commands/sendLowLevelTx.ts b/apps/remix-ide-e2e/src/commands/sendLowLevelTx.ts
new file mode 100644
index 0000000000..f818a34862
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/sendLowLevelTx.ts
@@ -0,0 +1,21 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class sendLowLevelTx extends EventEmitter {
+ command (this: NightwatchBrowser, address: string, value: string, callData: string): NightwatchBrowser {
+ console.log('low level transact to ', address, value, callData)
+ this.api.waitForElementVisible(`#instance${address} #deployAndRunLLTxSendTransaction`, 1000)
+ .clearValue(`#instance${address} #deployAndRunLLTxCalldata`)
+ .setValue(`#instance${address} #deployAndRunLLTxCalldata`, callData)
+ .waitForElementVisible('#value')
+ .clearValue('#value')
+ .setValue('#value', value)
+ .scrollAndClick(`#instance${address} #deployAndRunLLTxSendTransaction`)
+ .perform(() => {
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = sendLowLevelTx
diff --git a/apps/remix-ide-e2e/src/commands/setEditorValue.ts b/apps/remix-ide-e2e/src/commands/setEditorValue.ts
new file mode 100644
index 0000000000..b8e6e51435
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/setEditorValue.ts
@@ -0,0 +1,23 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from 'events'
+
+class SetEditorValue extends EventEmitter {
+ command (this: NightwatchBrowser, value: string, callback?: VoidFunction): NightwatchBrowser {
+ this.api.perform((client, done) => {
+ this.api.execute(function (value) {
+ const elem: any = document.getElementById('input')
+
+ elem.editor.session.setValue(value)
+ }, [value], () => {
+ done()
+ if (callback) {
+ callback.call(this.api)
+ }
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+module.exports = SetEditorValue
diff --git a/apps/remix-ide-e2e/src/commands/setSolidityCompilerVersion.ts b/apps/remix-ide-e2e/src/commands/setSolidityCompilerVersion.ts
new file mode 100644
index 0000000000..e916e41993
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/setSolidityCompilerVersion.ts
@@ -0,0 +1,16 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from 'events'
+
+class SetSolidityCompilerVersion extends EventEmitter {
+ command (this: NightwatchBrowser, version: string): NightwatchBrowser {
+ this.api
+ .click(`#compileTabView #versionSelector [value="${version}"]`)
+ .pause(5000)
+ .perform(() => {
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = SetSolidityCompilerVersion
diff --git a/apps/remix-ide-e2e/src/commands/setupMetamask.ts b/apps/remix-ide-e2e/src/commands/setupMetamask.ts
new file mode 100644
index 0000000000..1e322aa141
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/setupMetamask.ts
@@ -0,0 +1,40 @@
+import { NightwatchBrowser } from "nightwatch"
+
+const EventEmitter = require('events')
+
+class MetaMask extends EventEmitter {
+ command (this: NightwatchBrowser, passphrase: string, password: string): NightwatchBrowser {
+ this.api.perform((done) => {
+ setupMetaMask(this.api, passphrase, password, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function setupMetaMask (browser: NightwatchBrowser, passphrase: string, password: string, done: VoidFunction) {
+ browser
+ .switchBrowserWindow('chrome-extension://poemojpkcjbpmcccohjnomjffeinlafe/home.html#initialize/welcome', 'MetaMask', (browser) => {
+ browser.waitForElementPresent('.first-time-flow__button')
+ .click('.first-time-flow__button')
+ .waitForElementPresent('.select-action__select-button:nth-of-type(1) > .first-time-flow__button')
+ .click('.select-action__select-button:nth-of-type(1) > .first-time-flow__button')
+ .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
+ .click('.page-container__footer-button:nth-of-type(2)')
+ .waitForElementPresent('.first-time-flow__textarea')
+ .setValue('.first-time-flow__textarea', passphrase)
+ .setValue('*[autocomplete="new-password"]', password)
+ .setValue('*[autocomplete="confirm-password"]', password)
+ .click('.first-time-flow__checkbox')
+ .click('.first-time-flow__button')
+ .pause(5000)
+ .click('.first-time-flow__button')
+ .perform(() => {
+ done()
+ })
+ })
+}
+
+module.exports = MetaMask
diff --git a/apps/remix-ide-e2e/src/commands/signMessage.ts b/apps/remix-ide-e2e/src/commands/signMessage.ts
new file mode 100644
index 0000000000..c62b6b4a27
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/signMessage.ts
@@ -0,0 +1,44 @@
+import { NightwatchBrowser } from "nightwatch"
+
+const EventEmitter = require('events')
+
+class SelectContract extends EventEmitter {
+ command (this: NightwatchBrowser, msg: string, callback: (hash: { value: string }, signature: { value: string }) => void): NightwatchBrowser {
+ this.api.perform((done) => {
+ signMsg(this.api, msg, (hash, signature) => {
+ callback(hash, signature)
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function signMsg (browser: NightwatchBrowser, msg: string, cb: (hash: { value: string }, signature: { value: string }) => void) {
+ let hash, signature
+ browser
+ .waitForElementPresent('i[id="remixRunSignMsg"]')
+ .click('i[id="remixRunSignMsg"]')
+ .waitForElementVisible('textarea[id="prompt_text"]')
+ .setValue('textarea[id="prompt_text"]', msg, () => {
+ browser.modalFooterOKClick().perform(
+ (client, done) => {
+ browser.waitForElementVisible('span[id="remixRunSignMsgHash"]').getText('span[id="remixRunSignMsgHash"]', (v) => { hash = v; done() })
+ }
+ )
+ .perform(
+ (client, done) => {
+ browser.waitForElementVisible('span[id="remixRunSignMsgSignature"]').getText('span[id="remixRunSignMsgSignature"]', (v) => { signature = v; done() })
+ }
+ )
+ .modalFooterOKClick()
+ .perform(
+ () => {
+ cb(hash, signature)
+ }
+ )
+ })
+}
+
+module.exports = SelectContract
diff --git a/apps/remix-ide-e2e/src/commands/switchBrowserTab.ts b/apps/remix-ide-e2e/src/commands/switchBrowserTab.ts
new file mode 100644
index 0000000000..a5ef30228c
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/switchBrowserTab.ts
@@ -0,0 +1,21 @@
+import { NightwatchBrowser, NightwatchAPI } from "nightwatch"
+import EventEmitter from "events"
+
+/*
+ Switches between browser tabs
+*/
+
+class SwitchBrowserTab extends EventEmitter {
+ command (this: NightwatchBrowser, index: number): NightwatchBrowser {
+ this.api.perform((browser: NightwatchAPI, done) => {
+ browser.windowHandles((result) => {
+ browser.switchWindow(result.value[index])
+ done()
+ })
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = SwitchBrowserTab
diff --git a/apps/remix-ide-e2e/src/commands/switchBrowserWindow.ts b/apps/remix-ide-e2e/src/commands/switchBrowserWindow.ts
new file mode 100644
index 0000000000..396e838a58
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/switchBrowserWindow.ts
@@ -0,0 +1,28 @@
+import { NightwatchBrowser, NightwatchCallbackResult } from "nightwatch"
+
+const EventEmitter = require('events')
+
+class SwitchBrowserWindow extends EventEmitter {
+ command (this: NightwatchBrowser, url: string, windowName: string, cb: (browser: NightwatchBrowser, window?: NightwatchCallbackResult) => void): NightwatchBrowser {
+ this.api.perform((done) => {
+ switchWindow(this.api, url, windowName, cb)
+ done()
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+function switchWindow (browser: NightwatchBrowser, url: string, windowName: string, cb: (browser: NightwatchBrowser, window: NightwatchCallbackResult) => void) {
+ browser.execute(function (windowName) {
+ return window.open('', windowName, 'width=2560, height=1440')
+ }, [windowName], (newWindow) => {
+ browser.switchWindow(windowName)
+ .url(url)
+ .pause(5000)
+ .assert.urlContains(url)
+ if (cb) cb(browser, newWindow)
+ })
+}
+
+module.exports = SwitchBrowserWindow
diff --git a/apps/remix-ide-e2e/src/commands/testConstantFunction.ts b/apps/remix-ide-e2e/src/commands/testConstantFunction.ts
new file mode 100644
index 0000000000..1446796a2f
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/testConstantFunction.ts
@@ -0,0 +1,37 @@
+import { NightwatchBrowser, NightwatchTestConstantFunctionExpectedInput } from "nightwatch"
+import EventEmitter from "events"
+
+class TestConstantFunction extends EventEmitter {
+ command (this: NightwatchBrowser, address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput | null, expectedOutput: string): NightwatchBrowser {
+ console.log('TestConstantFunction ' + address + ' fnFullName')
+ this.api.perform((done) => {
+ testConstantFunction(this.api, address, fnFullName, expectedInput, expectedOutput, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function testConstantFunction (browser: NightwatchBrowser, address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput, expectedOutput: string, cb: VoidFunction) {
+ browser.waitForElementPresent('.instance button[title="' + fnFullName + '"]').perform(function (client, done) {
+ client.execute(function () {
+ document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight
+ }, [], function () {
+ if (expectedInput) {
+ client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values)
+ }
+ done()
+ })
+ })
+ .click('.instance button[title="' + fnFullName + '"]')
+ .pause(1000)
+ .waitForElementPresent('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]')
+ .scrollInto('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]')
+ .assert.containsText('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]', expectedOutput).perform(() => {
+ cb()
+ })
+}
+
+module.exports = TestConstantFunction
diff --git a/apps/remix-ide-e2e/src/commands/testContracts.ts b/apps/remix-ide-e2e/src/commands/testContracts.ts
new file mode 100644
index 0000000000..7b7192348e
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/testContracts.ts
@@ -0,0 +1,27 @@
+import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
+import EventEmitter from "events"
+
+class TestContracts extends EventEmitter {
+ command (this: NightwatchBrowser,fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[]): NightwatchBrowser {
+ this.api.perform((done) => {
+ testContracts(this.api, fileName, contractCode, compiledContractNames, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function testContracts (browser: NightwatchBrowser, fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[], callback: VoidFunction) {
+ browser
+ .clickLaunchIcon('solidity')
+ .addFile(fileName, contractCode)
+ .pause(1000)
+ .verifyContracts(compiledContractNames)
+ .perform(() => {
+ callback()
+ })
+}
+
+module.exports = TestContracts
diff --git a/apps/remix-ide-e2e/src/commands/testEditorValue.ts b/apps/remix-ide-e2e/src/commands/testEditorValue.ts
new file mode 100644
index 0000000000..54f65117c8
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/testEditorValue.ts
@@ -0,0 +1,14 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class TestEditorValue extends EventEmitter {
+ command (this: NightwatchBrowser, testvalue: string): NightwatchBrowser {
+ this.api.getEditorValue((value) => {
+ this.api.assert.equal(testvalue, value)
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = TestEditorValue
diff --git a/apps/remix-ide-e2e/src/commands/testFunction.ts b/apps/remix-ide-e2e/src/commands/testFunction.ts
new file mode 100644
index 0000000000..0993f49f99
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/testFunction.ts
@@ -0,0 +1,62 @@
+import { NightwatchBrowser, NightwatchTestFunctionExpectedInput } from 'nightwatch'
+import EventEmitter from "events"
+
+const deepequal = require('deep-equal')
+
+class TestFunction extends EventEmitter {
+ command (this: NightwatchBrowser, txHash: string, expectedValue: NightwatchTestFunctionExpectedInput): NightwatchBrowser {
+ const browser = this.api
+ const logs = {}
+ const setLog = (index: number, value: string) => { logs[Object.keys(logs)[index]] = typeof value === 'string' ? value.trim() : value }
+
+ browser
+ .waitForElementVisible(`[data-id="block_tx${txHash}"]`)
+ .click(`[data-id="block_tx${txHash}"]`)
+ .waitForElementVisible(`*[data-id="txLoggerTable${txHash}"]`)
+
+ // fetch and format transaction logs as key => pair object
+ .elements('css selector', `*[data-shared="key_${txHash}"]`, (res) => {
+ Array.isArray(res.value) && res.value.forEach(function (jsonWebElement) {
+ const jsonWebElementId: string = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
+
+ browser.elementIdText(jsonWebElementId, (jsonElement) => {
+ const key = typeof jsonElement.value === 'string' ? jsonElement.value.trim() : null
+
+ logs[key] = null
+ })
+ })
+ })
+ .elements('css selector', `*[data-shared="pair_${txHash}"]`, (res) => {
+ Array.isArray(res.value) && res.value.forEach(function (jsonWebElement, index) {
+ const jsonWebElementId = jsonWebElement.ELEMENT || jsonWebElement[Object.keys(jsonWebElement)[0]]
+
+ browser.elementIdText(jsonWebElementId, (jsonElement) => {
+ let value = jsonElement.value
+
+ try {
+ value = JSON.parse(jsonElement.value)
+ setLog(index, value)
+ } catch (e) {
+ setLog(index, value)
+ }
+ })
+ })
+ })
+
+ browser.perform(() => {
+ Object.keys(expectedValue).forEach(key => {
+ const equal: boolean = deepequal(logs[key], expectedValue[key])
+
+ if (!equal) {
+ browser.assert.fail(`Expected ${expectedValue[key]} but got ${logs[key]}`)
+ } else {
+ browser.assert.ok(true, `Expected value matched returned value ${expectedValue[key]}`)
+ }
+ })
+ this.emit('complete')
+ })
+ return this
+ }
+}
+
+module.exports = TestFunction
diff --git a/apps/remix-ide-e2e/src/commands/verifyCallReturnValue.ts b/apps/remix-ide-e2e/src/commands/verifyCallReturnValue.ts
new file mode 100644
index 0000000000..0f59662023
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/verifyCallReturnValue.ts
@@ -0,0 +1,34 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from "events"
+
+class VerifyCallReturnValue extends EventEmitter {
+ command (this: NightwatchBrowser, address: string, checks: string[]): NightwatchBrowser {
+ this.api.perform((done) => {
+ verifyCallReturnValue(this.api, address, checks, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function verifyCallReturnValue (browser: NightwatchBrowser, address: string, checks: string[], done: VoidFunction) {
+ browser.execute(function (address: string) {
+ const nodes = document.querySelectorAll('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]') as NodeListOf
+ const ret = []
+ for (let k = 0; k < nodes.length; k++) {
+ const text = nodes[k].innerText ? nodes[k].innerText : nodes[k].textContent
+ ret.push(text.replace('\n', ''))
+ }
+ return ret
+ }, [address], function (result) {
+ console.log('verifyCallReturnValue', result)
+ for (const k in checks) {
+ browser.assert.equal(result.value[k].trim(), checks[k].trim())
+ }
+ done()
+ })
+}
+
+module.exports = VerifyCallReturnValue
diff --git a/apps/remix-ide-e2e/src/commands/verifyContracts.ts b/apps/remix-ide-e2e/src/commands/verifyContracts.ts
new file mode 100644
index 0000000000..bc27e7ba24
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/verifyContracts.ts
@@ -0,0 +1,71 @@
+import { NightwatchBrowser, NightwatchCallbackResult } from 'nightwatch'
+import EventEmitter from "events"
+
+class VerifyContracts extends EventEmitter {
+ command (this: NightwatchBrowser,compiledContractNames: string[], opts = { wait: 1000, version: null }): NightwatchBrowser {
+ this.api.perform((done) => {
+ verifyContracts(this.api, compiledContractNames, opts, () => {
+ done()
+ this.emit('complete')
+ })
+ })
+ return this
+ }
+}
+
+function getCompiledContracts (browser: NightwatchBrowser, opts: { wait: number, version?: string }, callback: (result: NightwatchCallbackResult) => void) {
+ browser
+ .clickLaunchIcon('solidity')
+ .pause(opts.wait)
+ .waitForElementPresent('*[data-id="compiledContracts"] option')
+ .perform((done) => {
+ if (opts.version) {
+ browser
+ .click('*[data-id="compilation-details"]')
+ .waitForElementVisible('*[data-id="treeViewDivcompiler"]')
+ .pause(2000)
+ .click('*[data-id="treeViewDivcompiler"]')
+ .waitForElementVisible('*[data-id="treeViewLicompiler/version"]')
+ .assert.containsText('*[data-id="treeViewLicompiler/version"]', `version:\n ${opts.version}`)
+ .perform(done)
+ } else done()
+ })
+ .execute(function () {
+ const contracts = document.querySelectorAll('*[data-id="compiledContracts"] option') as NodeListOf
+
+ if (!contracts) {
+ return null
+ } else {
+ const ret = []
+
+ for (let c = 0; c < contracts.length; c++) {
+ ret.push(contracts[c].value)
+ }
+ return ret
+ }
+ }, [], function (result) {
+ callback(result)
+ })
+}
+
+function verifyContracts (browser: NightwatchBrowser, compiledContractNames: string[], opts: { wait: number, version?: string }, callback: VoidFunction) {
+ getCompiledContracts(browser, opts, (result: NightwatchCallbackResult) => {
+ if (result.value) {
+ for (const contract in compiledContractNames) {
+ console.log(' - ' + compiledContractNames[contract], result.value)
+ if (result.value.indexOf(compiledContractNames[contract]) === -1) {
+ browser.assert.fail('compiled contract ' + compiledContractNames + ' not found', 'info about error', '')
+ browser.end()
+ return
+ }
+ }
+ } else {
+ browser.assert.fail('compiled contract ' + compiledContractNames + ' not found - none found', 'info about error', '')
+ browser.end()
+ }
+ console.log('contracts all found ' + compiledContractNames)
+ callback()
+ })
+}
+
+module.exports = VerifyContracts
diff --git a/apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts b/apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts
new file mode 100644
index 0000000000..b60fb39e2e
--- /dev/null
+++ b/apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts
@@ -0,0 +1,25 @@
+import { NightwatchBrowser } from 'nightwatch'
+import EventEmitter from 'events'
+
+class WaitForElementContainsText extends EventEmitter {
+ command (this: NightwatchBrowser, id: string, value: string): NightwatchBrowser {
+ let incr = 0
+ const runid = setInterval(() => {
+ this.api.getText(id, (result) => {
+ if (typeof result.value === 'string' && value.indexOf(result.value || '') !== -1) {
+ clearInterval(runid)
+ this.api.assert.ok(true, `WaitForElementContainsText ${id} contains ${value}`)
+ this.emit('complete')
+ } else incr++
+ if (incr > 50) {
+ clearInterval(runid)
+ this.api.assert.fail(`WaitForElementContainsText - expected ${value} but got ${result.value}`)
+ // throw new Error(`WaitForElementContainsText ${id} ${value}`)
+ }
+ })
+ }, 200)
+ return this
+ }
+}
+
+module.exports = WaitForElementContainsText
diff --git a/apps/remix-ide-e2e/src/examples/example-contracts.ts b/apps/remix-ide-e2e/src/examples/example-contracts.ts
new file mode 100644
index 0000000000..6f1a43d19a
--- /dev/null
+++ b/apps/remix-ide-e2e/src/examples/example-contracts.ts
@@ -0,0 +1,249 @@
+'use strict'
+
+const storage = `pragma solidity >=0.4.22 <0.7.0;
+
+/**
+ * @title Storage
+ * @dev Store & retreive value in a variable
+ */
+contract Storage {
+
+ uint256 number;
+
+ /**
+ * @dev Store value in variable
+ * @param num value to store
+ */
+ function store(uint256 num) public {
+ number = num;
+ }
+
+ /**
+ * @dev Return value
+ * @return value of 'number'
+ */
+ function retreive() public view returns (uint256){
+ return number;
+ }
+}`
+
+const owner = `pragma solidity >=0.4.22 <0.7.0;
+
+/**
+ * @title Owner
+ * @dev Set & change owner
+ */
+contract Owner {
+
+ address private owner;
+
+ // event for EVM logging
+ event OwnerSet(address indexed oldOwner, address indexed newOwner);
+
+ // modifier to check if caller is owner
+ modifier isOwner() {
+ // If the first argument of 'require' evaluates to 'false', execution terminates and all
+ // changes to the state and to Ether balances are reverted.
+ // This used to consume all gas in old EVM versions, but not anymore.
+ // It is often a good idea to use 'require' to check if functions are called correctly.
+ // As a second argument, you can also provide an explanation about what went wrong.
+ require(msg.sender == owner, "Caller is not owner");
+ _;
+ }
+
+ /**
+ * @dev Set contract deployer as owner
+ */
+ constructor() public {
+ owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
+ emit OwnerSet(address(0), owner);
+ }
+
+ /**
+ * @dev Change owner
+ * @param newOwner address of new owner
+ */
+ function changeOwner(address newOwner) public isOwner {
+ emit OwnerSet(owner, newOwner);
+ owner = newOwner;
+ }
+
+ /**
+ * @dev Return owner address
+ * @return address of owner
+ */
+ function getOwner() external view returns (address) {
+ return owner;
+ }
+}`
+
+const ballot = `pragma solidity >=0.4.22 <0.7.0;
+
+/**
+ * @title Ballot
+ * @dev Implements voting process along with vote delegation
+ */
+contract Ballot {
+
+ struct Voter {
+ uint weight; // weight is accumulated by delegation
+ bool voted; // if true, that person already voted
+ address delegate; // person delegated to
+ uint vote; // index of the voted proposal
+ }
+
+ struct Proposal {
+ // If you can limit the length to a certain number of bytes,
+ // always use one of bytes1 to bytes32 because they are much cheaper
+ bytes32 name; // short name (up to 32 bytes)
+ uint voteCount; // number of accumulated votes
+ }
+
+ address public chairperson;
+
+ mapping(address => Voter) public voters;
+
+ Proposal[] public proposals;
+
+ /**
+ * @dev Create a new ballot to choose one of 'proposalNames'.
+ * @param proposalNames names of proposals
+ */
+ constructor(bytes32[] memory proposalNames) public {
+ chairperson = msg.sender;
+ voters[chairperson].weight = 1;
+
+ for (uint i = 0; i < proposalNames.length; i++) {
+ // 'Proposal({...})' creates a temporary
+ // Proposal object and 'proposals.push(...)'
+ // appends it to the end of 'proposals'.
+ proposals.push(Proposal({
+ name: proposalNames[i],
+ voteCount: 0
+ }));
+ }
+ }
+
+ /**
+ * @dev Give 'voter' the right to vote on this ballot. May only be called by 'chairperson'.
+ * @param voter address of voter
+ */
+ function giveRightToVote(address voter) public {
+ require(
+ msg.sender == chairperson,
+ "Only chairperson can give right to vote."
+ );
+ require(
+ !voters[voter].voted,
+ "The voter already voted."
+ );
+ require(voters[voter].weight == 0);
+ voters[voter].weight = 1;
+ }
+
+ /**
+ * @dev Delegate your vote to the voter 'to'.
+ * @param to address to which vote is delegated
+ */
+ function delegate(address to) public {
+ Voter storage sender = voters[msg.sender];
+ require(!sender.voted, "You already voted.");
+ require(to != msg.sender, "Self-delegation is disallowed.");
+
+ while (voters[to].delegate != address(0)) {
+ to = voters[to].delegate;
+
+ // We found a loop in the delegation, not allowed.
+ require(to != msg.sender, "Found loop in delegation.");
+ }
+ sender.voted = true;
+ sender.delegate = to;
+ Voter storage delegate_ = voters[to];
+ if (delegate_.voted) {
+ // If the delegate already voted,
+ // directly add to the number of votes
+ proposals[delegate_.vote].voteCount += sender.weight;
+ } else {
+ // If the delegate did not vote yet,
+ // add to her weight.
+ delegate_.weight += sender.weight;
+ }
+ }
+
+ /**
+ * @dev Give your vote (including votes delegated to you) to proposal 'proposals[proposal].name'.
+ * @param proposal index of proposal in the proposals array
+ */
+ function vote(uint proposal) public {
+ Voter storage sender = voters[msg.sender];
+ require(sender.weight != 0, "Has no right to vote");
+ require(!sender.voted, "Already voted.");
+ sender.voted = true;
+ sender.vote = proposal;
+
+ // If 'proposal' is out of the range of the array,
+ // this will throw automatically and revert all
+ // changes.
+ proposals[proposal].voteCount += sender.weight;
+ }
+
+ /**
+ * @dev Computes the winning proposal taking all previous votes into account.
+ * @return winningProposal_ index of winning proposal in the proposals array
+ */
+ function winningProposal() public view
+ returns (uint winningProposal_)
+ {
+ uint winningVoteCount = 0;
+ for (uint p = 0; p < proposals.length; p++) {
+ if (proposals[p].voteCount > winningVoteCount) {
+ winningVoteCount = proposals[p].voteCount;
+ winningProposal_ = p;
+ }
+ }
+ }
+
+ /**
+ * @dev Calls winningProposal() function to get the index of the winner contained in the proposals array and then
+ * @return winnerName_ the name of the winner
+ */
+ function winnerName() public view
+ returns (bytes32 winnerName_)
+ {
+ winnerName_ = proposals[winningProposal()].name;
+ }
+}
+`
+
+const ballotTest = `pragma solidity >=0.4.22 <0.7.0;
+import "remix_tests.sol"; // this import is automatically injected by Remix.
+import "../3_Ballot.sol";
+
+contract BallotTest {
+
+ bytes32[] proposalNames;
+
+ Ballot ballotToTest;
+ function beforeAll () public {
+ proposalNames.push(bytes32("candidate1"));
+ ballotToTest = new Ballot(proposalNames);
+ }
+
+ function checkWinningProposal () public {
+ ballotToTest.vote(0);
+ Assert.equal(ballotToTest.winningProposal(), uint(0), "proposal at index 0 should be the winning proposal");
+ Assert.equal(ballotToTest.winnerName(), bytes32("candidate1"), "candidate1 should be the winner name");
+ }
+
+ function checkWinninProposalWithReturnValue () public view returns (bool) {
+ return ballotToTest.winningProposal() == 0;
+ }
+}
+`
+
+export default {
+ storage: { name: '1_Storage.sol', content: storage },
+ owner: { name: '2_Owner.sol', content: owner },
+ ballot: { name: '3_Ballot.sol', content: ballot },
+ ballot_test: { name: 'tests/4_Ballot_test.sol', content: ballotTest }
+}
diff --git a/apps/remix-ide-e2e/src/extensions/chrome/metamask.crx b/apps/remix-ide-e2e/src/extensions/chrome/metamask.crx
new file mode 100644
index 0000000000..6cde846884
Binary files /dev/null and b/apps/remix-ide-e2e/src/extensions/chrome/metamask.crx differ
diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts
new file mode 100644
index 0000000000..9bbdc1e39f
--- /dev/null
+++ b/apps/remix-ide-e2e/src/helpers/init.ts
@@ -0,0 +1,37 @@
+import { NightwatchBrowser } from "nightwatch"
+
+require('dotenv').config()
+
+export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true): void {
+ browser
+ .url(url || 'http://127.0.0.1:8080')
+ .pause(5000)
+ .switchBrowserTab(0)
+ .fullscreenWindow(() => {
+ if (preloadPlugins) {
+ initModules(browser, () => {
+ browser.clickLaunchIcon('solidity')
+ .waitForElementVisible('[for="autoCompile"]')
+ .click('[for="autoCompile"]')
+ .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked')
+ })
+ }
+ })
+ .perform(() => {
+ callback()
+ })
+}
+
+function initModules (browser: NightwatchBrowser, callback: VoidFunction) {
+ browser.pause(5000)
+ .click('[data-id="verticalIconsKindpluginManager"]')
+ .scrollAndClick('[data-id="pluginManagerComponentActivateButtonsolidityStaticAnalysis"]')
+ .scrollAndClick('[data-id="pluginManagerComponentActivateButtondebugger"]')
+ .scrollAndClick('[data-id="verticalIconsKindfileExplorers"]')
+ .clickLaunchIcon('settings')
+ .click('*[data-id="settingsTabGenerateContractMetadataLabel"]')
+ .setValue('[data-id="settingsTabGistAccessToken"]', process.env.gist_token)
+ .click('[data-id="settingsTabSaveGistToken"]')
+ .click('[data-id="settingsTabThemeLabelFlatly"]') // e2e tests were initially developed with Flatly. Some tests are failing with the default one (Dark), because the dark theme put uppercase everywhere.
+ .perform(() => { callback() })
+}
diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts
new file mode 100644
index 0000000000..cfc18f2f47
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts
@@ -0,0 +1,318 @@
+'use strict'
+
+import { NightwatchBrowser } from 'nightwatch'
+import init from '../helpers/init'
+import sauce from './sauce'
+import examples from '../examples/example-contracts'
+
+const sources = [
+ {'browser/Untitled.sol': { content: examples.ballot.content }}
+]
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+ '@sources': function () {
+ return sources
+ },
+ 'Deploy Ballot': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .clickLaunchIcon('solidity')
+ .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
+ .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
+ .click('*[data-id="Deploy - transact (not payable)"]')
+ .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
+ .click('*[data-id="universalDappUiTitleExpander"]')
+ .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'})
+ .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
+ 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
+ })
+ },
+
+ 'Debug Ballot / delegate': function (browser: NightwatchBrowser) {
+ browser.pause(500)
+ .click('*[data-id="txLoggerDebugButton0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3"]')
+ .pause(2000)
+ // .clickLaunchIcon('debugger')
+ .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
+ .pause(2000)
+ .goToVMTraceStep(79)
+ .pause(1000)
+ .checkVariableDebug('soliditystate', stateCheck)
+ .checkVariableDebug('soliditylocals', localsCheck)
+ },
+
+ 'Access Ballot via at address': function (browser: NightwatchBrowser) {
+ browser.clickLaunchIcon('udapp')
+ .click('*[data-id="universalDappUiUdappClose"]')
+ .addFile('ballot.abi', { content: ballotABI })
+ .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false)
+ .clickLaunchIcon('fileExplorers')
+ .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true)
+ .pause(500)
+ .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
+ .click('*[data-id="universalDappUiTitleExpander"]')
+ .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'})
+ .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
+ {
+ status: '0x0 Transaction mined but execution failed',
+ 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
+ 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
+ })
+ },
+
+ 'Deploy and use Ballot using external web3': function (browser: NightwatchBrowser) {
+ browser
+ .click('*[data-id="settingsWeb3Mode"]')
+ .modalFooterOKClick()
+ .clickLaunchIcon('solidity')
+ .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
+ .clickLaunchIcon('udapp')
+ .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
+ .click('*[data-id="Deploy - transact (not payable)"]')
+ .clickInstance(0)
+ .click('*[data-id="terminalClearConsole"]')
+ .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'})
+ .journalLastChildIncludes('Ballot.delegate(address)')
+ .journalLastChildIncludes('data: 0x5c1...a733c')
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+const localsCheck = {
+ 'to': {
+ 'value': '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB',
+ 'type': 'address'
+ }
+}
+
+const stateCheck = {
+ 'chairperson': {
+ 'value': '0xCA35B7D915458EF540ADE6068DFE2F44E8FA733C',
+ 'type': 'address',
+ 'constant': false
+ },
+ 'voters': {
+ 'value': {
+ '000000000000000000000000ca35b7d915458ef540ade6068dfe2f44e8fa733c': {
+ 'value': {
+ 'weight': {
+ 'value': '1',
+ 'type': 'uint256'
+ },
+ 'voted': {
+ 'value': false,
+ 'type': 'bool'
+ },
+ 'delegate': {
+ 'value': '0x0000000000000000000000000000000000000000',
+ 'type': 'address'
+ },
+ 'vote': {
+ 'value': '0',
+ 'type': 'uint256'
+ }
+ },
+ 'type': 'struct Ballot.Voter'
+ }
+ },
+ 'type': 'mapping(address => struct Ballot.Voter)',
+ 'constant': false
+ },
+ 'proposals': {
+ 'value': [
+ {
+ 'value': {
+ 'name': {
+ 'value': '0x48656C6C6F20576F726C64210000000000000000000000000000000000000000',
+ 'type': 'bytes32'
+ },
+ 'voteCount': {
+ 'value': '0',
+ 'type': 'uint256'
+ }
+ },
+ 'type': 'struct Ballot.Proposal'
+ }
+ ],
+ 'length': '0x1',
+ 'type': 'struct Ballot.Proposal[]',
+ 'constant': false
+ }
+}
+
+const ballotABI = `[
+{
+ "inputs": [
+ {
+ "internalType": "bytes32[]",
+ "name": "proposalNames",
+ "type": "bytes32[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+},
+{
+ "constant": true,
+ "inputs": [],
+ "name": "chairperson",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+},
+{
+ "constant": false,
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ }
+ ],
+ "name": "delegate",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+},
+{
+ "constant": false,
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "voter",
+ "type": "address"
+ }
+ ],
+ "name": "giveRightToVote",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+},
+{
+ "constant": true,
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "proposals",
+ "outputs": [
+ {
+ "internalType": "bytes32",
+ "name": "name",
+ "type": "bytes32"
+ },
+ {
+ "internalType": "uint256",
+ "name": "voteCount",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+},
+{
+ "constant": false,
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "proposal",
+ "type": "uint256"
+ }
+ ],
+ "name": "vote",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+},
+{
+ "constant": true,
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "voters",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "weight",
+ "type": "uint256"
+ },
+ {
+ "internalType": "bool",
+ "name": "voted",
+ "type": "bool"
+ },
+ {
+ "internalType": "address",
+ "name": "delegate",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "vote",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+},
+{
+ "constant": true,
+ "inputs": [],
+ "name": "winnerName",
+ "outputs": [
+ {
+ "internalType": "bytes32",
+ "name": "winnerName_",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+},
+{
+ "constant": true,
+ "inputs": [],
+ "name": "winningProposal",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "winningProposal_",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+}
+]`
diff --git a/apps/remix-ide-e2e/src/tests/compiler_api.test.ts b/apps/remix-ide-e2e/src/tests/compiler_api.test.ts
new file mode 100644
index 0000000000..acb51fbf84
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/compiler_api.test.ts
@@ -0,0 +1,103 @@
+'use strict'
+
+import { NightwatchBrowser } from 'nightwatch'
+import init from '../helpers/init'
+import sauce from './sauce'
+import examples from '../examples/example-contracts'
+
+const sources = [
+ {'browser/Untitled.sol': { content: examples.ballot.content }}
+]
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Should compile using "compileWithParamaters" API': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('test_jsCompile.js', { content: jsCompile })
+ .executeScript('remix.exeCurrent()')
+ .pause(5000)
+ .journalChildIncludes(`"languageversion": "0.6.8+commit.0bbfe453"`)
+ },
+
+ 'Should update the compiler configuration with "setCompilerConfig" API': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('test_updateConfiguration.js', { content: updateConfiguration })
+ .executeScript('remix.exeCurrent()')
+ .pause(5000)
+ .addFile('test_updateConfiguration.sol', { content: simpleContract })
+ .verifyContracts(['StorageTestUpdateConfiguration'], { wait: 5000, version: '0.6.8+commit.0bbfe453' })
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+const simpleContract = `pragma solidity >=0.4.22 <0.7.0;
+
+/**
+* @title Storage
+* @dev Store & retreive value in a variable
+*/
+contract StorageTestUpdateConfiguration {
+
+ uint256 number;
+
+ /**
+ * @dev Store value in variable
+ * @param num value to store
+ */
+ function store(uint256 num) public {
+ number = num;
+ }
+
+ /**
+ * @dev Return value
+ * @return value of 'number'
+ */
+ function retreive() public view returns (uint256){
+ return number;
+ }
+}
+
+ `
+
+const jsCompile = `(async () => {
+
+ try {
+ const contract = {
+ "storage.sol": {content : \`${simpleContract}\` }
+ }
+ console.log('compile')
+ const params = {
+ optimize: false,
+ evmVersion: null,
+ language: 'Solidity',
+ version: '0.6.8+commit.0bbfe453'
+ }
+ const result = await remix.call('solidity', 'compileWithParameters', contract, params)
+ console.log('result ', result)
+ } catch (e) {
+ console.log(e.message)
+ }
+})()`
+
+const updateConfiguration = `(async () => {
+ try {
+ const params = {
+ optimize: false,
+ evmVersion: null,
+ language: 'Solidity',
+ version: '0.6.8+commit.0bbfe453'
+ }
+ await remix.call('solidity', 'setCompilerConfig', params)
+ } catch (e) {
+ console.log(e.message)
+ }
+})()`
diff --git a/apps/remix-ide-e2e/src/tests/debugger.test.ts b/apps/remix-ide-e2e/src/tests/debugger.test.ts
new file mode 100644
index 0000000000..7da6d8db7c
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/debugger.test.ts
@@ -0,0 +1,116 @@
+'use strict'
+import { NightwatchBrowser } from 'nightwatch'
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Should launch debugger': function (browser: NightwatchBrowser) {
+ browser.addFile('blah.sol', sources[0]['browser/blah.sol'])
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[title="Deploy - transact (not payable)"]')
+ .click('*[title="Deploy - transact (not payable)"]')
+ .debugTransaction(0)
+ .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER')
+ },
+
+ 'Should debug failing transaction': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
+ .click('*[data-id="universalDappUiTitleExpander"]')
+ .scrollAndClick('*[title="string name, uint256 goal"]')
+ .setValue('*[title="string name, uint256 goal"]', '"toast", 999')
+ .click('*[data-id="createProject - transact (not payable)"]')
+ .debugTransaction(1)
+ .pause(2000)
+ .scrollAndClick('*[data-id="solidityLocals"]')
+ .assert.containsText('*[data-id="solidityLocals"]', 'toast')
+ .assert.containsText('*[data-id="solidityLocals"]', '999')
+ },
+
+ 'Should debug transaction using slider': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
+ .waitForElementVisible('*[data-id="slider"]')
+ .click('*[data-id="slider"]')
+ .setValue('*[data-id="slider"]', '50')
+ .pause(2000)
+ .assert.containsText('*[data-id="solidityLocals"]', 'no locals')
+ .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92')
+ },
+
+ 'Should step back and forward transaction': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
+ .waitForElementPresent('*[data-id="buttonNavigatorIntoBack"]')
+ .scrollAndClick('*[data-id="buttonNavigatorIntoBack"]')
+ .pause(2000)
+ .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n91')
+ .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n91')
+ .click('*[data-id="buttonNavigatorIntoForward"]')
+ .pause(2000)
+ .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n92')
+ .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n92')
+ },
+
+ 'Should jump through breakpoints': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="editorInput"]')
+ .click('.ace_gutter-cell:nth-of-type(10)')
+ .click('.ace_gutter-cell:nth-of-type(20)')
+ .waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
+ .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
+ .pause(2000)
+ .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n0')
+ .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n0')
+ .click('*[data-id="buttonNavigatorJumpNextBreakpoint"]')
+ .pause(2000)
+ .assert.containsText('*[data-id="stepdetail"]', 'vm trace step:\n184')
+ .assert.containsText('*[data-id="stepdetail"]', 'execution step:\n184')
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+const sources = [
+ {
+ 'browser/blah.sol': {
+ content: `
+ pragma solidity >=0.4.22 <0.6.0;
+
+ contract Kickstarter {
+
+ enum State { Started, Completed }
+
+ struct Project {
+ address owner;
+ string name;
+ uint goal;
+ State state;
+ }
+
+ Project[] public projects;
+
+ constructor() public {
+
+ }
+
+ function createProject(string memory name, uint goal) public {
+ Project storage project = projects[projects.length];
+ project.name = name;
+ project.owner = msg.sender;
+ project.state = State.Started;
+ project.goal = goal;
+ }
+ }
+ `
+ }
+ }
+]
diff --git a/apps/remix-ide-e2e/src/tests/defaultLayout.test.ts b/apps/remix-ide-e2e/src/tests/defaultLayout.test.ts
new file mode 100644
index 0000000000..22ad99fa1d
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/defaultLayout.test.ts
@@ -0,0 +1,80 @@
+'use strict'
+import { NightwatchBrowser } from 'nightwatch'
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done, 'http://127.0.0.1:8080', false)
+ },
+
+ 'Loads Icon\'s Panel': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000)
+ .waitForElementVisible('div[data-id="verticalIconsHomeIcon"]')
+ .waitForElementVisible('div[plugin="fileExplorers"]')
+ .waitForElementVisible('div[plugin="pluginManager"]')
+ .waitForElementVisible('div[plugin="settings"]')
+ },
+
+ 'Loads Side Panel': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
+ .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
+ .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
+ .waitForElementVisible('li[key="browser/3_Ballot.sol"]')
+ },
+
+ 'Loads Main View': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]')
+ .waitForElementVisible('div[data-id="landingPageHomeContainer"]')
+ .waitForElementVisible('div[data-id="landingPageHpSections"]')
+ .waitForElementVisible('div[data-id="terminalContainer"]')
+ },
+
+ 'Loads terminal': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('div[data-id="terminalCli"]', 10000)
+ .journalLastChildIncludes('Welcome to Remix')
+ },
+
+ 'Toggles Side Panel': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
+ .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
+ .clickLaunchIcon('fileExplorers')
+ .assert.hidden('div[data-id="remixIdeSidePanel"]')
+ .clickLaunchIcon('fileExplorers')
+ .assert.visible('div[data-id="remixIdeSidePanel"]')
+ .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
+ },
+
+ 'Toggles Terminal': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('div[data-id="terminalContainer"]')
+ .assert.visible('div[data-id="terminalContainerDisplay"]')
+ .click('i[data-id="terminalToggleIcon"]')
+ .checkElementStyle('div[data-id="terminalToggleMenu"]', 'height', '35px')
+ .click('i[data-id="terminalToggleIcon"]')
+ .assert.visible('div[data-id="terminalContainerDisplay"]')
+ },
+
+ 'Toggles File Explorer Browser': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
+ .assert.visible('ul[key="browser"]')
+ .click('div[data-id="treeViewTogglebrowser"]')
+ .assert.hidden('ul[key="browser"]')
+ .click('div[data-id="treeViewTogglebrowser"]')
+ .assert.visible('ul[key="browser"]')
+ },
+
+ 'Switch Tabs using tabs icon': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('div[data-id="filePanelFileExplorerTree"]')
+ .openFile('browser/3_Ballot.sol')
+ .assert.containsText('div[title="browser/3_Ballot.sol"]', '3_Ballot.sol')
+ .click('span[class^=dropdownCaret]')
+ .click('#homeItem')
+ .assert.containsText('div[title="home"]', 'Home')
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/tests/editor.test.ts b/apps/remix-ide-e2e/src/tests/editor.test.ts
new file mode 100644
index 0000000000..928ab7f4ce
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/editor.test.ts
@@ -0,0 +1,199 @@
+'use strict'
+
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ 'Should zoom in editor': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('div[data-id="mainPanelPluginsContainer"]')
+ .openFile('browser/1_Storage.sol')
+ .waitForElementVisible('*[data-id="editorInput"]')
+ .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px')
+ .click('*[data-id="tabProxyZoomIn"]')
+ .click('*[data-id="tabProxyZoomIn"]')
+ .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px')
+ },
+
+ 'Should zoom out editor': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="editorInput"]')
+ .checkElementStyle('*[data-id="editorInput"]', 'font-size', '14px')
+ .click('*[data-id="tabProxyZoomOut"]')
+ .click('*[data-id="tabProxyZoomOut"]')
+ .checkElementStyle('*[data-id="editorInput"]', 'font-size', '12px')
+ },
+
+ 'Should display compile error in editor': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="editorInput"]')
+ .waitForElementVisible('*[class="ace_content"]')
+ .click('*[class="ace_content"]')
+ .sendKeys('*[class="ace_text-input"]', 'error')
+ .pause(2000)
+ .waitForElementVisible('.ace_error')
+ },
+
+ 'Should minimize and maximize codeblock in editor': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="editorInput"]')
+ .waitForElementVisible('.ace_open')
+ .click('.ace_start:nth-of-type(1)')
+ .waitForElementVisible('.ace_closed')
+ .click('.ace_start:nth-of-type(1)')
+ .waitForElementVisible('.ace_open')
+ },
+
+ 'Should add breakpoint to editor': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="editorInput"]')
+ .waitForElementNotPresent('.ace_breakpoint')
+ .click('.ace_gutter-cell:nth-of-type(1)')
+ .waitForElementVisible('.ace_breakpoint')
+ },
+
+ 'Should load syntax highlighter for ace light theme': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="editorInput"]')
+ .checkElementStyle('.ace_keyword', 'color', aceThemes.light.keyword)
+ .checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.light.comment)
+ .checkElementStyle('.ace_function', 'color', aceThemes.light.function)
+ .checkElementStyle('.ace_variable', 'color', aceThemes.light.variable)
+ },
+
+ 'Should load syntax highlighter for ace dark theme': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]')
+ .click('*[data-id="verticalIconsKindsettings"]')
+ .waitForElementVisible('*[data-id="settingsTabThemeLabelDark"]')
+ .click('*[data-id="settingsTabThemeLabelDark"]')
+ .pause(2000)
+ .waitForElementVisible('*[data-id="editorInput"]')
+ /* @todo(#2863) ch for class and not colors
+ .checkElementStyle('.ace_keyword', 'color', aceThemes.dark.keyword)
+ .checkElementStyle('.ace_comment.ace_doc', 'color', aceThemes.dark.comment)
+ .checkElementStyle('.ace_function', 'color', aceThemes.dark.function)
+ .checkElementStyle('.ace_variable', 'color', aceThemes.dark.variable)
+ */
+ },
+
+ 'Should highlight source code': function (browser: NightwatchBrowser) {
+ browser.addFile('sourcehighlight.js', sourcehighlightScript)
+ .openFile('browser/sourcehighlight.js')
+ .executeScript('remix.exeCurrent()')
+ .editorScroll('down', 60)
+ .waitForElementPresent('.highlightLine32')
+ .checkElementStyle('.highlightLine32', 'background-color', 'rgb(8, 108, 181)')
+ .waitForElementPresent('.highlightLine40')
+ .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
+ .waitForElementPresent('.highlightLine50')
+ .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)')
+ },
+
+ 'Should remove 1 highlight from source code': function (browser: NightwatchBrowser) {
+ browser.addFile('removeSourcehighlightScript.js', removeSourcehighlightScript)
+ .openFile('browser/removeSourcehighlightScript.js')
+ .executeScript('remix.exeCurrent()')
+ .openFile('browser/3_Ballot.sol')
+ .waitForElementNotPresent('.highlightLine32')
+ .checkElementStyle('.highlightLine40', 'background-color', 'rgb(8, 108, 181)')
+ .checkElementStyle('.highlightLine50', 'background-color', 'rgb(8, 108, 181)')
+ },
+
+ 'Should remove all highlights from source code': function (browser: NightwatchBrowser) {
+ browser.addFile('removeAllSourcehighlightScript.js', removeAllSourcehighlightScript)
+ .openFile('browser/removeAllSourcehighlightScript.js')
+ .executeScript('remix.exeCurrent()')
+ .openFile('browser/3_Ballot.sol')
+ .waitForElementNotPresent('.highlightLine32')
+ .waitForElementNotPresent('.highlightLine40')
+ .waitForElementNotPresent('.highlightLine50')
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+const aceThemes = {
+ light: {
+ keyword: 'rgb(147, 15, 128)',
+ comment: 'rgb(35, 110, 36)',
+ function: 'rgb(0, 0, 162)',
+ variable: 'rgb(253, 151, 31)'
+ },
+ dark: {
+ keyword: 'rgb(0, 105, 143)',
+ comment: 'rgb(85, 85, 85)',
+ function: 'rgb(0, 174, 239)',
+ variable: 'rgb(153, 119, 68)'
+ }
+}
+
+const sourcehighlightScript = {
+ content: `
+ (async () => {
+ try {
+ const pos = {
+ start: {
+ line: 32,
+ column: 3
+ },
+ end: {
+ line: 32,
+ column: 20
+ }
+ }
+ await remix.call('editor', 'highlight', pos, 'browser/3_Ballot.sol')
+
+ const pos2 = {
+ start: {
+ line: 40,
+ column: 3
+ },
+ end: {
+ line: 40,
+ column: 20
+ }
+ }
+ await remix.call('editor', 'highlight', pos2, 'browser/3_Ballot.sol')
+
+ const pos3 = {
+ start: {
+ line: 50,
+ column: 3
+ },
+ end: {
+ line: 50,
+ column: 20
+ }
+ }
+ await remix.call('editor', 'highlight', pos3, 'browser/3_Ballot.sol')
+ } catch (e) {
+ console.log(e.message)
+ }
+ })()
+ `
+}
+
+const removeSourcehighlightScript = {
+ content: `
+ (async () => {
+ try {
+ await remix.call('editor', 'discardHighlightAt', 32, 'browser/3_Ballot.sol')
+ } catch (e) {
+ console.log(e.message)
+ }
+ })()
+ `
+}
+
+const removeAllSourcehighlightScript = {
+ content: `
+ (async () => {
+ try {
+ await remix.call('editor', 'discardHighlight')
+ } catch (e) {
+ console.log(e.message)
+ }
+ })()
+ `
+}
diff --git a/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts b/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
new file mode 100644
index 0000000000..5eefef2037
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
@@ -0,0 +1,111 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+import * as path from 'path'
+
+const testData = {
+ testFile1: path.resolve(__dirname + '/editor.test.js'), // eslint-disable-line
+ testFile2: path.resolve(__dirname + '/fileExplorer.test.js'), // eslint-disable-line
+ testFile3: path.resolve(__dirname + '/generalSettings.test.js') // eslint-disable-line
+}
+
+module.exports = {
+
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ 'Should create a new file `5_New_contract.sol` in file explorer': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('div[data-id="remixIdeSidePanel"]')
+ .clickLaunchIcon('fileExplorers')
+ .assert.containsText('h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORERS')
+ .click('*[data-id="fileExplorerNewFilecreateNewFile"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .setValue('*[data-id="modalDialogCustomPromptText"]', '5_New_contract.sol')
+ .modalFooterOKClick()
+ .waitForElementVisible('*[data-id="treeViewLibrowser/5_New_contract.sol"]', 7000)
+ },
+
+ 'Should rename `5_New_contract.sol` to 5_Renamed_Contract.sol': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="treeViewLibrowser/5_New_contract.sol"]')
+ .renameFile('browser/5_New_contract.sol', '5_Renamed_Contract.sol', 'browser/5_Renamed_Contract.sol')
+ .waitForElementVisible('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"]')
+ },
+
+ 'Should delete file `5_Renamed_Contract.sol` from file explorer': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"]')
+ .rightClick('[data-path="browser/5_Renamed_Contract.sol"]')
+ .click('*[id="menuitemdelete"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .modalFooterOKClick()
+ .waitForElementNotPresent('*[data-id="treeViewLibrowser/5_Renamed_Contract.sol"')
+ },
+
+ 'Should create a new folder': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="treeViewLibrowser/1_Storage.sol"]')
+ .rightClick('[data-path="browser/1_Storage.sol"]')
+ .click('*[id="menuitemcreate folder"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .setValue('*[data-id="modalDialogCustomPromptText"]', 'Browser_Tests')
+ .modalFooterOKClick()
+ .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
+ },
+
+ 'Should rename Browser_Tests folder to Browser_E2E_Tests': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
+ .rightClick('[data-path="browser/Browser_Tests"]')
+ .click('*[id="menuitemrename"]')
+ .sendKeys('[data-path="browser/Browser_Tests"]', 'Browser_E2E_Tests')
+ .sendKeys('[data-path="browser/Browser_Tests"]', browser.Keys.ENTER)
+ .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]')
+ },
+
+ 'Should delete Browser_E2E_Tests folder': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]')
+ .rightClick('[data-path="browser/Browser_E2E_Tests"]')
+ .click('*[id="menuitemdelete"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .modalFooterOKClick()
+ .waitForElementNotPresent('*[data-id="treeViewLibrowser/Browser_E2E_Tests"]')
+ },
+
+ 'Should publish all explorer files to github gist': function (browser: NightwatchBrowser) {
+ const runtimeBrowser = browser.options.desiredCapabilities.browserName
+
+ browser
+ .waitForElementVisible('*[data-id="fileExplorerNewFilepublishToGist"]')
+ .click('*[data-id="fileExplorerNewFilepublishToGist"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .modalFooterOKClick()
+ .waitForElementVisible('*[data-id="modalDialogContainer"]', 7000)
+ .modalFooterOKClick()
+ .pause(2000)
+ .perform((done) => {
+ if (runtimeBrowser === 'chrome') {
+ browser.switchBrowserTab(1)
+ .assert.urlContains('https://gist.github.com')
+ .switchBrowserTab(0)
+ }
+ done()
+ })
+ },
+
+ 'Should open local filesystem explorer': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="filePanelFileExplorerTree"]')
+ .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile1)
+ .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile2)
+ .setValue('*[data-id="fileExplorerFileUpload"]', testData.testFile3)
+ .waitForElementVisible('*[key="browser/editor.test.js"]')
+ .waitForElementVisible('*[key="browser/fileExplorer.test.js"]')
+ .waitForElementVisible('*[key="browser/generalSettings.test.js"]')
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/tests/fileManager_api.test.ts b/apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
new file mode 100644
index 0000000000..f9416e4cff
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
@@ -0,0 +1,191 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ 'Should execute `file` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('file.js', { content: executeFile })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .journalLastChildIncludes('browser/file.js')
+ },
+
+ 'Should execute `exists` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('exists.js', { content: executeExists })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .journalChildIncludes('browser/exists.js true')
+ .journalChildIncludes('browser/non-exists.js false')
+ },
+
+ 'Should execute `open` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('open.js', { content: executeOpen })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .journalLastChildIncludes('browser/3_Ballot.sol')
+ },
+
+ 'Should execute `writeFile` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('writeFile.js', { content: executeWriteFile })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .openFile('browser/new_contract.sol')
+ .assert.containsText('[data-id="editorInput"]', 'pragma solidity ^0.6.0')
+ },
+
+ 'Should execute `readFile` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('readFile.js', { content: executeReadFile })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .journalLastChildIncludes('pragma solidity ^0.6.0')
+ },
+
+ 'Should execute `copyFile` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('copyFile.js', { content: executeCopyFile })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .journalLastChildIncludes('pragma solidity >=0.4.22 <0.7.0;')
+ },
+
+ 'Should execute `rename` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('renameFile.js', { content: executeRename })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .waitForElementPresent('[data-id="treeViewLibrowser/old_contract.sol"]')
+ },
+
+ 'Should execute `mkdir` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('mkdirFile.js', { content: executeMkdir })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .waitForElementPresent('[data-id="treeViewLibrowser/Test_Folder"]')
+ },
+
+ 'Should execute `readdir` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('readdirFile.js', { content: executeReaddir })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .journalLastChildIncludes('Test_Folder isDirectory true')
+ },
+
+ 'Should execute `remove` api from file manager external api': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('removeFile.js', { content: executeRemove })
+ .executeScript(`remix.exeCurrent()`)
+ .pause(2000)
+ .waitForElementNotPresent('[data-id="treeViewLibrowser/old_contract.sol"]')
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+const executeFile = `
+ const run = async () => {
+ const result = await remix.call('fileManager', 'file')
+
+ console.log(result)
+ }
+
+ run()
+`
+
+const executeExists = `
+ const run = async () => {
+ const result1 = await remix.call('fileManager', 'exists', 'browser/exists.js')
+ const result2 = await remix.call('fileManager', 'exists', 'browser/non-exists.js')
+
+ console.log('browser/exists.js ' + result1)
+ console.log('browser/non-exists.js ' + result2)
+ }
+
+ run()
+`
+
+const executeOpen = `
+ const run = async () => {
+ await remix.call('fileManager', 'open', 'browser/3_Ballot.sol')
+ const result = await remix.call('fileManager', 'file')
+
+ console.log(result)
+ }
+
+ run()
+`
+
+const executeWriteFile = `
+ const run = async () => {
+ await remix.call('fileManager', 'writeFile', 'browser/new_contract.sol', 'pragma solidity ^0.6.0')
+ }
+
+ run()
+`
+
+const executeReadFile = `
+ const run = async () => {
+ const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol')
+
+ console.log(result)
+ }
+
+ run()
+`
+
+const executeCopyFile = `
+ const run = async () => {
+ await remix.call('fileManager', 'copyFile', 'browser/3_Ballot.sol', 'browser/new_contract.sol')
+ const result = await remix.call('fileManager', 'readFile', 'browser/new_contract.sol')
+
+ console.log(result)
+ }
+
+ run()
+`
+
+const executeRename = `
+ const run = async () => {
+ await remix.call('fileManager', 'rename', 'browser/new_contract.sol', 'browser/old_contract.sol')
+ }
+
+ run()
+`
+
+const executeMkdir = `
+ const run = async () => {
+ await remix.call('fileManager', 'mkdir', 'browser/Test_Folder/')
+ }
+
+ run()
+`
+
+const executeReaddir = `
+ const run = async () => {
+ const result = await remix.call('fileManager', 'readdir', 'browser/')
+
+ console.log('Test_Folder isDirectory ', result["Test_Folder"].isDirectory)
+ }
+
+ run()
+`
+
+const executeRemove = `
+ const run = async () => {
+ await remix.call('fileManager', 'remove', 'browser/old_contract.sol')
+ }
+
+ run()
+`
diff --git a/apps/remix-ide-e2e/src/tests/generalSettings.test.ts b/apps/remix-ide-e2e/src/tests/generalSettings.test.ts
new file mode 100644
index 0000000000..a3ddde4d1d
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/generalSettings.test.ts
@@ -0,0 +1,185 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done, 'http://127.0.0.1:8080', false)
+ },
+
+ 'Should display settings menu': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .click('*[data-id="landingPageStartSolidity"]')
+ .waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="verticalIconsKindsettings"]')
+ .waitForElementContainsText('h6[data-id="sidePanelSwapitTitle"]', 'SETTINGS')
+ },
+
+ 'Should activate `generate contract metadata`': function (browser) {
+ browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
+ .waitForElementVisible('*[data-id="settingsTabGenerateContractMetadataLabel"]', 5000)
+ .click('*[data-id="verticalIconsFileExplorerIcons"]')
+ .openFile('browser/3_Ballot.sol')
+ .click('*[data-id="verticalIconsKindsolidity"]')
+ .pause(2000)
+ .click('*[data-id="compilerContainerCompileBtn"]')
+ .pause(3000)
+ .click('*[data-id="verticalIconsKindfileExplorers"]')
+ .openFile('browser/artifacts/Ballot.json')
+ .openFile('browser/artifacts/Ballot_metadata.json')
+ .getEditorValue((content) => {
+ const metadata = JSON.parse(content)
+ browser.assert.equal(metadata.language, 'Solidity')
+ })
+ },
+
+ 'Should add new github access token': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="verticalIconsKindsettings"]')
+ .setValue('*[data-id="settingsTabGistAccessToken"]', '**********')
+ .click('*[data-id="settingsTabSaveGistToken"]')
+ .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
+ .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token saved')
+ },
+
+ 'Should copy github access token to clipboard': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="copyToClipboardCopyIcon"]')
+ .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
+ .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.')
+ },
+
+ 'Should remove github access token': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="settingsTabRemoveGistToken"]')
+ .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 5000)
+ .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Access token removed')
+ .assert.containsText('*[data-id="settingsTabGistAccessToken"]', '')
+ },
+
+ 'Should load dark theme': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="settingsTabThemeLabelDark"]')
+ .pause(2000)
+ .checkElementStyle(':root', '--primary', remixIdeThemes.dark.primary)
+ .checkElementStyle(':root', '--secondary', remixIdeThemes.dark.secondary)
+ .checkElementStyle(':root', '--success', remixIdeThemes.dark.success)
+ .checkElementStyle(':root', '--info', remixIdeThemes.dark.info)
+ .checkElementStyle(':root', '--warning', remixIdeThemes.dark.warning)
+ .checkElementStyle(':root', '--danger', remixIdeThemes.dark.danger)
+ },
+
+ 'Should load light theme': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="settingsTabThemeLabelLight"]')
+ .pause(2000)
+ .checkElementStyle(':root', '--primary', remixIdeThemes.light.primary)
+ .checkElementStyle(':root', '--secondary', remixIdeThemes.light.secondary)
+ .checkElementStyle(':root', '--success', remixIdeThemes.light.success)
+ .checkElementStyle(':root', '--info', remixIdeThemes.light.info)
+ .checkElementStyle(':root', '--warning', remixIdeThemes.light.warning)
+ .checkElementStyle(':root', '--danger', remixIdeThemes.light.danger)
+ },
+
+ 'Should load Cerulean theme': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="settingsTabThemeLabelCerulean"]')
+ .pause(5000)
+ .checkElementStyle(':root', '--primary', remixIdeThemes.curelean.primary)
+ .checkElementStyle(':root', '--secondary', remixIdeThemes.curelean.secondary)
+ .checkElementStyle(':root', '--success', remixIdeThemes.curelean.success)
+ .checkElementStyle(':root', '--info', remixIdeThemes.curelean.info)
+ .checkElementStyle(':root', '--warning', remixIdeThemes.curelean.warning)
+ .checkElementStyle(':root', '--danger', remixIdeThemes.curelean.danger)
+ },
+
+ 'Should load Flatly theme': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="settingsTabThemeLabelFlatly"]')
+ .pause(2000)
+ .checkElementStyle(':root', '--primary', remixIdeThemes.flatly.primary)
+ .checkElementStyle(':root', '--secondary', remixIdeThemes.flatly.secondary)
+ .checkElementStyle(':root', '--success', remixIdeThemes.flatly.success)
+ .checkElementStyle(':root', '--info', remixIdeThemes.flatly.info)
+ .checkElementStyle(':root', '--warning', remixIdeThemes.flatly.warning)
+ .checkElementStyle(':root', '--danger', remixIdeThemes.flatly.danger)
+ },
+
+ 'Should load Spacelab theme': function (browser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="settingsTabThemeLabelSpacelab"]')
+ .pause(2000)
+ .checkElementStyle(':root', '--primary', remixIdeThemes.spacelab.primary)
+ .checkElementStyle(':root', '--secondary', remixIdeThemes.spacelab.secondary)
+ .checkElementStyle(':root', '--success', remixIdeThemes.spacelab.success)
+ .checkElementStyle(':root', '--info', remixIdeThemes.spacelab.info)
+ .checkElementStyle(':root', '--warning', remixIdeThemes.spacelab.warning)
+ .checkElementStyle(':root', '--danger', remixIdeThemes.spacelab.danger)
+ },
+
+ 'Should load Cyborg theme': function (browser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
+ .click('*[data-id="settingsTabThemeLabelCyborg"]')
+ .pause(2000)
+ .checkElementStyle(':root', '--primary', remixIdeThemes.cyborg.primary)
+ .checkElementStyle(':root', '--secondary', remixIdeThemes.cyborg.secondary)
+ .checkElementStyle(':root', '--success', remixIdeThemes.cyborg.success)
+ .checkElementStyle(':root', '--info', remixIdeThemes.cyborg.info)
+ .checkElementStyle(':root', '--warning', remixIdeThemes.cyborg.warning)
+ .checkElementStyle(':root', '--danger', remixIdeThemes.cyborg.danger)
+ },
+
+ tearDown: sauce
+}
+
+const remixIdeThemes = {
+ dark: {
+ primary: '#007aa6',
+ secondary: '#595c76',
+ success: '#32ba89',
+ info: '#086CB5',
+ warning: '#c97539',
+ danger: '#b84040'
+ },
+ light: {
+ primary: '#007aa6',
+ secondary: '#a8b3bc',
+ success: '#32ba89',
+ info: '#007aa6',
+ warning: '#c97539',
+ danger: '#b84040'
+ },
+ curelean: {
+ primary: '#2FA4E7',
+ secondary: '#e9ecef',
+ success: '#73A839',
+ info: '#033C73',
+ warning: '#DD5600',
+ danger: '#C71C22'
+ },
+ flatly: {
+ primary: '#2C3E50',
+ secondary: '#95a5a6',
+ success: '#18BC9C',
+ info: '#3498DB',
+ warning: '#F39C12',
+ danger: '#E74C3C'
+ },
+ spacelab: {
+ primary: '#446E9B',
+ secondary: '#999',
+ success: '#3CB521',
+ info: '#3399F3',
+ warning: '#D47500',
+ danger: '#CD0200'
+ },
+ cyborg: {
+ primary: '#2A9FD6',
+ secondary: '#555',
+ success: '#77B300',
+ info: '#9933CC',
+ warning: '#FF8800',
+ danger: '#CC0000'
+ }
+}
diff --git a/apps/remix-ide-e2e/src/tests/gist.test.ts b/apps/remix-ide-e2e/src/tests/gist.test.ts
new file mode 100644
index 0000000000..4bcaae4ea5
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/gist.test.ts
@@ -0,0 +1,98 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+const testData = {
+ validGistId: '1859c97c6e1efc91047d725d5225888e',
+ invalidGistId: '6368b389f9302v32902msk2402'
+}
+// 99266d6da54cc12f37f11586e8171546c7700d67
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+ 'UploadToGists': function (browser: NightwatchBrowser) {
+ /*
+ - set the access token
+ - publish to gist
+ - retrieve the gist
+ - switch to a file in the new gist
+ */
+ console.log('token', process.env.gist_token)
+ const runtimeBrowser = browser.options.desiredCapabilities.browserName
+
+ browser
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .clickLaunchIcon('fileExplorers')
+ .rightClick('[data-path="browser/1_Storage.sol"]')
+ .click('*[id="menuitemcreate folder"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .setValue('*[data-id="modalDialogCustomPromptText"]', 'Browser_Tests')
+ .modalFooterOKClick()
+ .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
+ .addFile('File.sol', { content: '' })
+ .click('*[data-id="fileExplorerNewFilepublishToGist"]')
+ .modalFooterOKClick()
+ .getModalBody((value, done) => {
+ const reg = /gist.github.com\/([^.]+)/
+ const id = value.match(reg)
+
+ console.log('gist regex', id)
+ if (!id) {
+ browser.assert.fail('cannot get the gist id', '', '')
+ } else {
+ const gistid = id[1]
+ browser
+ .modalFooterCancelClick()
+ .executeScript(`remix.loadgist('${gistid}')`)
+ .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() })
+ .openFile(`browser/gists/${gistid}/1_Storage.sol`)
+ .perform(done)
+ }
+ })
+ },
+
+ 'Load Gist Modal': function (browser: NightwatchBrowser) {
+ browser.clickLaunchIcon('home')
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .clickLaunchIcon('fileExplorers')
+ .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
+ .waitForElementVisible('*[data-id="modalDialogModalTitle"]')
+ .assert.containsText('*[data-id="modalDialogModalTitle"]', 'Load a Gist')
+ .waitForElementVisible('*[data-id="modalDialogModalBody"]')
+ .assert.containsText('*[data-id="modalDialogModalBody"]', 'Enter the ID of the Gist or URL you would like to load.')
+ .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
+ .modalFooterCancelClick()
+ },
+
+ 'Display Error Message For Invalid Gist ID': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .clickLaunchIcon('fileExplorers')
+ .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
+ .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
+ .setValue('*[data-id="modalDialogCustomPromptText"]', testData.invalidGistId)
+ .modalFooterOKClick()
+ .waitForElementVisible('*[data-id="modalDialogModalBody"]')
+ .assert.containsText('*[data-id="modalDialogModalBody"]', 'Gist load error: Not Found')
+ .modalFooterOKClick()
+ },
+
+ 'Import From Gist For Valid Gist ID': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .clickLaunchIcon('fileExplorers')
+ .scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
+ .waitForElementVisible('*[data-id="modalDialogCustomPromptText"]')
+ .setValue('*[data-id="modalDialogCustomPromptText"]', testData.validGistId)
+ .modalFooterOKClick()
+ .openFile(`browser/gists/${testData.validGistId}/ApplicationRegistry`)
+ .waitForElementVisible(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry']`)
+ .assert.containsText(`div[title='browser/gists/${testData.validGistId}/ApplicationRegistry'] > span`, 'ApplicationRegistry')
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts b/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts
new file mode 100644
index 0000000000..711f87be3c
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts
@@ -0,0 +1,127 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Add Lib Test File': function (browser: NightwatchBrowser) {
+ browser.addFile('Untitled5.sol', sources[0]['browser/Untitled5.sol'])
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
+ },
+
+ 'Test Auto Deploy Lib': function (browser: NightwatchBrowser) {
+ let addressRef: string
+ browser.verifyContracts(['test'])
+ .selectContract('test')
+ .createContract('')
+ .getAddressAtPosition(0, (address) => {
+ console.log('testAutoDeployLib ' + address)
+ addressRef = address
+ })
+ .waitForElementPresent('.instance:nth-of-type(2)')
+ .click('.instance:nth-of-type(2) > div > button')
+ .perform((done) => {
+ browser.testConstantFunction(addressRef, 'get - call', null, '0:\nuint256: 45').perform(() => {
+ done()
+ })
+ })
+ },
+
+ 'Test Manual Deploy Lib': function (browser: NightwatchBrowser) {
+ console.log('testManualDeployLib')
+ browser.click('*[data-id="deployAndRunClearInstances"]')
+ .pause(5000)
+ .clickLaunchIcon('settings')
+ .click('*[data-id="settingsTabGenerateContractMetadataLabel"]')
+ .clickLaunchIcon('solidity')
+ .click('#compileTabView button[title="Compile"]') // that should generate the JSON artefact
+ .verifyContracts(['test'])
+ .selectContract('lib') // deploy lib
+ .createContract('')
+ .perform((done) => {
+ browser.getAddressAtPosition(0, (address) => {
+ console.log(address)
+ checkDeployShouldFail(browser, () => {
+ checkDeployShouldSucceed(browser, address, () => {
+ done()
+ })
+ })
+ })
+ })
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFunction) {
+ let config
+ browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json')
+ .getEditorValue((content) => {
+ config = JSON.parse(content)
+ config.deploy['VM:-'].autoDeployLib = false
+ })
+ .perform(() => {
+ browser.setEditorValue(JSON.stringify(config))
+ })
+ .openFile('browser/Untitled5.sol')
+ .selectContract('test') // deploy lib
+ .createContract('')
+ .getText('div[class^="terminal"]', (value) => {
+ console.log('value: ', value)
+ })
+ .assert.containsText('div[class^="terminal"]', ' is not a valid address')
+ .perform(() => { callback() })
+}
+
+function checkDeployShouldSucceed (browser: NightwatchBrowser, address: string, callback: VoidFunction) {
+ let addressRef: string
+ let config
+ browser.openFile('browser/artifacts').openFile('browser/artifacts/test.json')
+ .getEditorValue((content) => {
+ config = JSON.parse(content)
+ config.deploy['VM:-'].autoDeployLib = false
+ config.deploy['VM:-']['linkReferences']['browser/Untitled5.sol'].lib = address
+ })
+ .perform(() => {
+ browser.setEditorValue(JSON.stringify(config))
+ })
+ .openFile('browser/Untitled5.sol')
+ .selectContract('test') // deploy lib
+ .createContract('')
+ .getAddressAtPosition(1, (address) => {
+ addressRef = address
+ })
+ .waitForElementPresent('.instance:nth-of-type(3)')
+ .click('.instance:nth-of-type(3) > div > button')
+ .perform(() => {
+ browser
+ .testConstantFunction(addressRef, 'get - call', null, '0:\nuint256: 45')
+ .perform(() => { callback() })
+ })
+}
+
+const sources = [
+ {
+ 'browser/Untitled5.sol': {content: `library lib {
+ function getInt () public view returns (uint) {
+ return 45;
+ }
+ }
+
+ contract test {
+ function get () public view returns (uint) {
+ return lib.getInt();
+ }
+ }`}
+ }
+]
diff --git a/apps/remix-ide-e2e/src/tests/pluginManager.test.ts b/apps/remix-ide-e2e/src/tests/pluginManager.test.ts
new file mode 100644
index 0000000000..037b24e168
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/pluginManager.test.ts
@@ -0,0 +1,155 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+const testData = {
+ pluginName: 'remixIde',
+ pluginDisplayName: 'Remix IDE',
+ pluginUrl: 'https://remix-project.org/'
+}
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done, 'http://127.0.0.1:8080', false)
+ },
+
+ 'Should Load Plugin Manager': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]')
+ .pause(3000)
+ .click('*[plugin="pluginManager"]')
+ .waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'PLUGIN MANAGER')
+ },
+
+ 'Should Search for plugins': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .click('*[data-id="pluginManagerComponentSearchInput"]')
+ .keys('debugger')
+ .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
+ .clearValue('*[data-id="pluginManagerComponentSearchInput"]')
+ .click('*[data-id="pluginManagerComponentSearchInput"]')
+ .keys('Vyper')
+ .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]')
+ .clearValue('*[data-id="pluginManagerComponentSearchInput"]')
+ .click('*[data-id="pluginManagerComponentSearchInput"]')
+ .keys('ZoKrates')
+ .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonZoKrates"]')
+ .clearValue('*[data-id="pluginManagerComponentSearchInput"]')
+ .click('*[data-id="pluginManagerComponentSearchInput"]')
+ .keys(browser.Keys.ENTER)
+ },
+
+ 'Should activate plugins': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .click('*[data-id="pluginManagerComponentPluginManager"]')
+ .scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]')
+ .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
+ .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonvyper"]')
+ .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
+ .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonZoKrates"]')
+ .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonZoKrates"]')
+ },
+
+ 'Should deactivate plugins': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .click('*[data-id="pluginManagerComponentPluginManager"]')
+ .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtondebugger"]')
+ .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtondebugger"]')
+ .scrollAndClick('*[data-id="pluginManagerComponentDeactivateButtonvyper"]')
+ .waitForElementVisible('*[data-id="pluginManagerComponentActivateButtonvyper"]')
+ },
+
+ /*
+ 'Should grant plugin permission (ZOKRATES)': function (browser) {
+ browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .click('*[data-id="pluginManagerPermissionsButton"]')
+ .waitForElementVisible('*[data-id="pluginManagerSettingsPermissionForm"]')
+ .assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet')
+ .modalFooterOKClick()
+ .click('*[data-id="verticalIconsFileExplorerIcons"]')
+ .openFile('browser/3_Ballot.sol')
+ .click('*[plugin="ZoKrates"]')
+ .pause(5000)
+ .frame(0)
+ .useXpath().click("//span[text()='Compile']")
+ .pause(2000)
+ .frameParent()
+ .useCss().waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .assert.containsText('*[data-id="permissionHandlerMessage"]', 'ZOKRATES" WOULD LIKE TO ACCESS "FILE MANAGER" :')
+ .pause(2000)
+ .click('*[data-id="permissionHandlerRememberChoice"]')
+ .pause(2000)
+ .modalFooterOKClick()
+ },
+
+ 'Should revert plugin permission (ZOKRATES)': function (browser) {
+ browser.waitForElementVisible('*[data-id="verticalIconsSettingsIcons"]')
+ .click('*[data-id="verticalIconsSettingsIcons"]')
+ .waitForElementVisible('*[data-id="pluginManagerPermissionsButton"]')
+ .click('*[data-id="pluginManagerPermissionsButton"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .click('*[data-id="pluginManagerSettingsPermissionForm"]')
+ .pause(2000)
+ .click('*[data-id="pluginManagerSettingsClearAllPermission"]')
+ .pause(2000)
+ .assert.containsText('*[data-id="pluginManagerSettingsPermissionForm"]', 'No Permission requested yet')
+ .modalFooterOKClick()
+ },
+ */
+
+ 'Should connect a local plugin': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .click('*[data-id="pluginManagerComponentPluginSearchButton"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .click('*[data-id="modalDialogModalBody"]')
+ .waitForElementVisible('*[data-id="localPluginName"]')
+ .setValue('*[data-id="localPluginName"]', testData.pluginName)
+ .setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName)
+ .setValue('*[data-id="localPluginUrl"]', testData.pluginUrl)
+ .click('*[data-id="localPluginRadioButtoniframe"]')
+ .click('*[data-id="localPluginRadioButtonsidePanel"]')
+ .click('*[data-id="modalDialogModalFooter"]')
+ .modalFooterOKClick()
+ .waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtonremixIde"]')
+ },
+
+ 'Should display error message for creating already existing plugin': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .click('*[data-id="pluginManagerComponentPluginSearchButton"]')
+ .waitForElementVisible('*[data-id="modalDialogContainer"]')
+ .click('*[data-id="modalDialogModalBody"]')
+ .waitForElementVisible('*[data-id="localPluginName"]')
+ .clearValue('*[data-id="localPluginName"]').setValue('*[data-id="localPluginName"]', testData.pluginName)
+ .clearValue('*[data-id="localPluginDisplayName"]').setValue('*[data-id="localPluginDisplayName"]', testData.pluginDisplayName)
+ .clearValue('*[data-id="localPluginUrl"]').setValue('*[data-id="localPluginUrl"]', testData.pluginUrl)
+ .click('*[data-id="localPluginRadioButtoniframe"]')
+ .click('*[data-id="localPluginRadioButtonsidePanel"]')
+ .click('*[data-id="modalDialogModalFooter"]')
+ .modalFooterOKClick()
+ .pause(5000)
+ .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1)')
+ .pause(2000)
+ .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Cannot create Plugin : This name has already been used')
+ },
+
+ 'Should load back installed plugins after reload': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
+ .getInstalledPlugins((plugins) => {
+ browser.refresh()
+ .waitForElementVisible('*[data-id="remixIdeSidePanel"]')
+ .pause(3000)
+ .perform((done) => {
+ plugins.forEach(plugin => {
+ if (plugin !== testData.pluginName) {
+ browser.waitForElementVisible(`[plugin="${plugin}"`)
+ }
+ })
+ done()
+ })
+ })
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/tests/publishContract.test.ts b/apps/remix-ide-e2e/src/tests/publishContract.test.ts
new file mode 100644
index 0000000000..3fa9e6c239
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/publishContract.test.ts
@@ -0,0 +1,66 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return []
+ },
+
+ 'Publish on IPFS': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('#icon-panel', 10000)
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/3_Ballot.sol')
+ .verifyContracts(['Ballot'])
+ .click('#publishOnIpfs')
+ .getModalBody((value, done) => {
+ if (value.indexOf('Metadata of "ballot" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed', '', '')
+ if (value.indexOf('dweb:/ipfs') === -1) browser.assert.fail('ipfs deploy failed', '', '')
+ done()
+ })
+ .modalFooterOKClick()
+ },
+
+ 'Publish on Swarm': '' + function (browser: NightwatchBrowser) {
+ browser
+ .click('#publishOnSwarm')
+ .getModalBody((value, done) => {
+ if (value.indexOf('Metadata of "ballot" was successfully.') === -1) browser.assert.fail('swarm deploy failed', '', '')
+ if (value.indexOf('bzz') === -1) browser.assert.fail('swarm deploy failed', '', '')
+ done()
+ })
+ .modalFooterOKClick()
+ },
+
+ 'Should publish contract metadata to ipfs on deploy': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('#icon-panel')
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/1_Storage.sol')
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]')
+ .click('*[data-id="contractDropdownIpfsCheckbox"]')
+ .click('*[data-id="Deploy - transact (not payable)"]')
+ .pause(5000)
+ .assert.containsText('*[data-id="modalDialogModalBody"]', 'Metadata of "storage" was published successfully.')
+ .modalFooterOKClick()
+ },
+
+ 'Should remember choice after page refresh': function (browser: NightwatchBrowser) {
+ browser
+ .refresh()
+ .openFile('browser/1_Storage.sol')
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="contractDropdownIpfsCheckbox"]')
+ .verify.elementPresent('*[data-id="contractDropdownIpfsCheckbox"]:checked')
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/tests/recorder.test.ts b/apps/remix-ide-e2e/src/tests/recorder.test.ts
new file mode 100644
index 0000000000..9c3e4319b2
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/recorder.test.ts
@@ -0,0 +1,300 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Test Recorder': function (browser: NightwatchBrowser) {
+ let addressRef
+ browser.addFile('scenario.json', {content: records})
+ .pause(5000)
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
+ .click('div[class^="cardContainer"] i[class^="arrow"]')
+ .click('#runTabView .runtransaction')
+ .waitForElementPresent('.instance:nth-of-type(2)')
+ .click('.instance:nth-of-type(2) > div > button')
+ .waitForElementPresent('.instance:nth-of-type(3)')
+ .click('.instance:nth-of-type(3) > div > button')
+ .clickFunction('getInt - call')
+ .clickFunction('getAddress - call')
+ .clickFunction('getFromLib - call')
+ .waitForElementPresent('div[class^="contractActionsContainer"] div[class^="value"] ul')
+ .getAddressAtPosition(1, (address) => {
+ console.log('Test Recorder ' + address)
+ addressRef = address
+ })
+ .perform((done) => {
+ browser.verifyCallReturnValue(addressRef, ['0:uint256: 1', '0:uint256: 3456', '0:address: 0xbBF289D846208c16EDc8474705C748aff07732dB'])
+ .perform(() => done())
+ })
+ .click('*[data-id="deployAndRunClearInstances"]')
+ .testContracts('testRecorder.sol', sources[0]['browser/testRecorder.sol'], ['testRecorder'])
+ .createContract('12')
+ .waitForElementPresent('.instance:nth-of-type(2)')
+ .click('.instance:nth-of-type(2) > div > button')
+ .clickFunction('set - transact (not payable)', {types: 'uint256 _p', values: '34'})
+ .click('i.savetransaction')
+ .modalFooterOKClick()
+ .getEditorValue(function (result) {
+ const parsed = JSON.parse(result)
+ browser.assert.equal(JSON.stringify(parsed.transactions[0].record.parameters), JSON.stringify(scenario.transactions[0].record.parameters))
+ browser.assert.equal(JSON.stringify(parsed.transactions[0].record.name), JSON.stringify(scenario.transactions[0].record.name))
+ browser.assert.equal(JSON.stringify(parsed.transactions[0].record.type), JSON.stringify(scenario.transactions[0].record.type))
+ browser.assert.equal(JSON.stringify(parsed.transactions[0].record.from), JSON.stringify(scenario.transactions[0].record.from))
+ browser.assert.equal(JSON.stringify(parsed.transactions[0].record.contractName), JSON.stringify(scenario.transactions[0].record.contractName))
+
+ browser.assert.equal(JSON.stringify(parsed.transactions[1].record.parameters), JSON.stringify(scenario.transactions[1].record.parameters))
+ browser.assert.equal(JSON.stringify(parsed.transactions[1].record.name), JSON.stringify(scenario.transactions[1].record.name))
+ browser.assert.equal(JSON.stringify(parsed.transactions[1].record.type), JSON.stringify(scenario.transactions[1].record.type))
+ browser.assert.equal(JSON.stringify(parsed.transactions[1].record.from), JSON.stringify(scenario.transactions[1].record.from))
+ })
+ .end()
+ },
+ tearDown: sauce
+}
+
+const sources = [{'browser/testRecorder.sol': {content: `contract testRecorder {
+ constructor(uint p) public {
+
+ }
+ function set (uint _p) public {
+
+ }
+}`}}]
+
+const records = `{
+ "accounts": {
+ "account{10}": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c"
+ },
+ "linkReferences": {
+ "testLib": "created{1512830014773}"
+ },
+ "transactions": [
+ {
+ "timestamp": 1512830014773,
+ "record": {
+ "value": "0",
+ "parameters": [],
+ "abi": "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a",
+ "contractName": "testLib",
+ "bytecode": "60606040523415600e57600080fd5b60968061001c6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c146044575b600080fd5b604a6060565b6040518082815260200191505060405180910390f35b6000610d809050905600a165627a7a7230582022d123b15248b8176151f8d45c2dc132063bcc9bb8d5cd652aea7efae362c8050029",
+ "linkReferences": {},
+ "inputs": "()",
+ "type": "constructor",
+ "from": "account{10}"
+ }
+ },
+ {
+ "timestamp": 1512830015080,
+ "record": {
+ "value": "100",
+ "parameters": [
+ 11
+ ],
+ "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec",
+ "contractName": "test",
+ "bytecode": "60606040526040516020806102b183398101604052808051906020019091905050806000819055505061027a806100376000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632f30c6f61461006757806338cc48311461009e57806362738998146100f357806387cc10e11461011c575b600080fd5b61009c600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610145565b005b34156100a957600080fd5b6100b1610191565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fe57600080fd5b6101066101bb565b6040518082815260200191505060405180910390f35b341561012757600080fd5b61012f6101c4565b6040518082815260200191505060405180910390f35b8160008190555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054905090565b600073__browser/ballot.sol:testLib____________636d4ce63c6000604051602001526040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b151561022e57600080fd5b6102c65a03f4151561023f57600080fd5b505050604051805190509050905600a165627a7a72305820e0b2510bb2890a0334bfe5613d96db3e72442e63b514cdeaee8fc2c6bbd19d3a0029",
+ "linkReferences": {
+ "browser/ballot.sol": {
+ "testLib": [
+ {
+ "length": 20,
+ "start": 511
+ }
+ ]
+ }
+ },
+ "name": "",
+ "type": "constructor",
+ "inputs": "(uint256)",
+ "from": "account{10}"
+ }
+ },
+ {
+ "timestamp": 1512830034180,
+ "record": {
+ "value": "1000000000000000000",
+ "parameters": [
+ 1,
+ "created{1512830015080}"
+ ],
+ "to": "created{1512830015080}",
+ "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec",
+ "name": "set",
+ "inputs": "(uint256,address)",
+ "type": "function",
+ "from": "account{10}"
+ }
+ }
+ ],
+ "abis": {
+ "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "get",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ],
+ "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getInt",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getFromLib",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAddress",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_t",
+ "type": "uint256"
+ },
+ {
+ "name": "_add",
+ "type": "address"
+ }
+ ],
+ "name": "set",
+ "outputs": [],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_r",
+ "type": "uint256"
+ }
+ ],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "constructor"
+ }
+ ]
+ }
+}`
+
+const scenario = {
+ 'accounts': {
+ 'account{10}': '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'
+ },
+ 'linkReferences': {},
+ 'transactions': [
+ {
+ 'timestamp': 1512912691086,
+ 'record': {
+ 'value': '0',
+ 'parameters': [
+ "12" // eslint-disable-line
+ ],
+ 'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798',
+ 'contractName': 'testRecorder',
+ 'bytecode': '6060604052341561000f57600080fd5b6040516020806100cd833981016040528080519060200190919050505060938061003a6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b1146044575b600080fd5b3415604e57600080fd5b606260048080359060200190919050506064565b005b505600a165627a7a723058204839660366b94f5f3c8c6da233a2c5fe95ad5635b5c8a2bb630a8b845d68ecdd0029',
+ 'linkReferences': {},
+ 'name': '',
+ 'type': 'constructor',
+ 'inputs': '(uint256)',
+ 'from': 'account{10}'
+ }
+ },
+ {
+ 'timestamp': 1512912696128,
+ 'record': {
+ 'value': '0',
+ 'parameters': [
+ "34" // eslint-disable-line
+ ],
+ 'to': 'created{1512912691086}',
+ 'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798',
+ 'name': 'set',
+ 'inputs': '(uint256)',
+ 'type': 'function',
+ 'from': 'account{10}'
+ }
+ }
+ ],
+ 'abis': {
+ '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798': [
+ {
+ 'constant': false,
+ 'inputs': [
+ {
+ 'name': '_p',
+ 'type': 'uint256'
+ }
+ ],
+ 'name': 'set',
+ 'outputs': [],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'function'
+ },
+ {
+ 'inputs': [
+ {
+ 'name': 'p',
+ 'type': 'uint256'
+ }
+ ],
+ 'payable': false,
+ 'stateMutability': 'nonpayable',
+ 'type': 'constructor'
+ }
+ ]
+ }
+}
diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts
new file mode 100644
index 0000000000..333bb49ff7
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts
@@ -0,0 +1,141 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+const assetsTestContract = `import "./contract.sol";
+contract Assets {
+ uint[] proposals;
+ function add(uint8 _numProposals) public {
+ proposals.length = _numProposals;
+ }
+}
+`
+
+const gmbhTestContract = `contract gmbh {
+ uint[] proposals;
+ function register(uint8 _numProposals) public {
+ proposals.length = _numProposals;
+ }
+}
+`
+const sources = [
+ {
+ 'localhost/folder1/contract2.sol': {content: 'contract test2 { function get () public returns (uint) { return 11; }}'}
+ },
+ {
+ 'localhost/src/gmbh/company.sol': {content: assetsTestContract}
+ },
+ {
+ 'localhost/src/gmbh/company.sol': {content: assetsTestContract},
+ 'localhost/src/gmbh/contract.sol': {content: gmbhTestContract}
+ },
+ {
+ 'browser/test_import_node_modules.sol': {content: 'import "openzeppelin-solidity/contracts/math/SafeMath.sol";'}
+ },
+ {
+ 'browser/test_import_node_modules_with_github_import.sol': {content: 'import "openzeppelin-solidity/contracts/sample.sol";'}
+ }
+]
+
+module.exports = {
+ before: function (browser, done) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Remixd': function (browser) {
+ runTests(browser)
+ },
+ 'Import from node_modules ': function (browser) {
+ /*
+ when a relative import is used (i.e import "openzeppelin-solidity/contracts/math/SafeMath.sol")
+ remix (as well as truffle) try to resolve it against the node_modules and installed_contracts folder.
+ */
+
+ browser.waitForElementVisible('#icon-panel', 2000)
+ .clickLaunchIcon('fileExplorers')
+ .addFile('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol'])
+ .clickLaunchIcon('solidity')
+ .testContracts('test_import_node_modules.sol', sources[3]['browser/test_import_node_modules.sol'], ['SafeMath'])
+ },
+ 'Import from node_modules and reference a github import': function (browser) {
+ browser.waitForElementVisible('#icon-panel', 2000)
+ .clickLaunchIcon('fileExplorers')
+ .addFile('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol'])
+ .clickLaunchIcon('solidity')
+ .setSolidityCompilerVersion('soljson-v0.6.2+commit.bacdbe57.js') // open-zeppelin moved to pragma ^0.6.0
+ .testContracts('test_import_node_modules_with_github_import.sol', sources[4]['browser/test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11'])
+ .clickLaunchIcon('pluginManager')
+ .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button')
+ .end()
+ },
+ tearDown: sauce
+}
+
+function runTests (browser: NightwatchBrowser) {
+ const browserName = browser.options.desiredCapabilities.browserName
+ if (browserName === 'safari' || browserName === 'internet explorer') {
+ console.log('do not run remixd test for ' + browserName + ': sauce labs doesn\'t seems to handle websocket')
+ browser.end()
+ return
+ }
+
+ browser
+ .waitForElementVisible('#icon-panel', 2000)
+ .clickLaunchIcon('fileExplorers')
+ .clickLaunchIcon('pluginManager')
+ .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_remixd"] button')
+ .waitForElementVisible('#modal-footer-ok', 2000)
+ .pause(2000)
+ .click('#modal-footer-ok')
+ .clickLaunchIcon('fileExplorers')
+ .waitForElementVisible('[data-path="localhost/folder1"]')
+ .click('[data-path="localhost/folder1"]')
+ .waitForElementVisible('[data-path="localhost/contract1.sol"]')
+ .assert.containsText('[data-path="localhost/contract1.sol"]', 'contract1.sol')
+ .assert.containsText('[data-path="localhost/contract2.sol"]', 'contract2.sol')
+ .waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]')
+ .assert.containsText('[data-path="localhost/folder1/contract1.sol"]', 'contract1.sol')
+ .assert.containsText('[data-path="localhost/folder1/contract2.sol"]', 'contract2.sol') // load and test sub folder
+ .click('[data-path="localhost/folder1/contract2.sol"]')
+ .click('[data-path="localhost/folder1/contract1.sol"]') // open localhost/folder1/contract1.sol
+ .pause(1000)
+ .testEditorValue('contract test1 { function get () returns (uint) { return 10; }}') // check the content and replace by another
+ .setEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}')
+ .testEditorValue('contract test1Changed { function get () returns (uint) { return 10; }}')
+ .setEditorValue('contract test1 { function get () returns (uint) { return 10; }}')
+ .click('[data-path="localhost/folder1/contract_' + browserName + '.sol"]') // rename a file and check
+ .pause(1000)
+ .renameFile('localhost/folder1/contract_' + browserName + '.sol', 'renamed_contract_' + browserName + '.sol', 'localhost/folder1/renamed_contract_' + browserName + '.sol')
+ .pause(1000)
+ .removeFile('localhost/folder1/contract_' + browserName + '_toremove.sol')
+ .perform(function (done) {
+ testImportFromRemixd(browser, () => { done() })
+ })
+ .clickLaunchIcon('fileExplorers')
+ .waitForElementVisible('[data-path="localhost/folder1"]')
+ .click('[data-path="localhost/folder1"]')
+ .click('[data-path="localhost/folder1"]') // click twice because remixd does not return nested folder details after update
+ .waitForElementVisible('[data-path="localhost/folder1/contract1.sol"]')
+ .waitForElementVisible('[data-path="localhost/folder1/renamed_contract_' + browserName + '.sol"]') // check if renamed file is preset
+ .waitForElementNotPresent('[data-path="localhost/folder1/contract_' + browserName + '.sol"]') // check if renamed (old) file is not present
+ .waitForElementNotPresent('[data-path="localhost/folder1/contract_' + browserName + '_toremove.sol"]') // check if removed (old) file is not present
+ .click('[data-path="localhost/folder1/renamed_contract_' + browserName + '.sol"]')
+}
+
+function testImportFromRemixd (browser: NightwatchBrowser, callback: VoidFunction) {
+ browser
+ .waitForElementVisible('[data-path="localhost/src"]', 100000)
+ .click('[data-path="localhost/src"]')
+ .waitForElementVisible('[data-path="localhost/src/gmbh"]', 100000)
+ .click('[data-path="localhost/src/gmbh"]')
+ .waitForElementVisible('[data-path="localhost/src/gmbh/company.sol"]', 100000)
+ .click('[data-path="localhost/src/gmbh/company.sol"]')
+ .pause(1000)
+ .verifyContracts(['Assets', 'gmbh'])
+ .perform(() => { callback() })
+}
diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy.ts
new file mode 100644
index 0000000000..cb1937314e
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/runAndDeploy.ts
@@ -0,0 +1,208 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+const passphrase = process.env.account_passphrase
+const password = process.env.account_password
+
+module.exports = {
+
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Should load run and deploy tab': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="sidePanelSwapitTitle"]')
+ .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS')
+ },
+
+ 'Should sign message using account key': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="settingsRemixRunSignMsg"]')
+ .click('*[data-id="settingsRemixRunSignMsg"]')
+ .pause(2000)
+ .waitForElementPresent('*[data-id="modalDialogCustomPromptText"]')
+ .setValue('*[data-id="modalDialogCustomPromptText"]', 'Remix is cool!')
+ .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgHash"]')
+ .assert.elementNotPresent('*[data-id="settingsRemixRunSignMsgSignature"]')
+ .modalFooterOKClick()
+ .waitForElementPresent('*[data-id="modalDialogContainer"]', 12000)
+ .assert.elementPresent('*[data-id="settingsRemixRunSignMsgHash"]')
+ .assert.elementPresent('*[data-id="settingsRemixRunSignMsgSignature"]')
+ .modalFooterOKClick()
+ },
+
+ 'Should deploy contract on JavascriptVM': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
+ .clickLaunchIcon('fileExplorers')
+ .addFile('Greet.sol', sources[0]['browser/Greet.sol'])
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
+ .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
+ .click('*[data-id="Deploy - transact (not payable)"]')
+ .pause(5000)
+ .testFunction('0xc39ee005c1e1368c84f02e458de4b41dbb966631a8714d15ef8362dada249ede', {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0xc39ee005c1e1368c84f02e458de4b41dbb966631a8714d15ef8362dada249ede'
+ })
+ },
+
+ 'Should run low level interaction (fallback function)': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
+ .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
+ .click('*[data-id="universalDappUiTitleExpander"]')
+ .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
+ .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
+ .pause(5000)
+ .testFunction('0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b', {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0xfe718871ee0b4d03cdcac0e12e5b164efaf7e23ba952c07db76e62692867019b'
+ })
+ },
+
+ 'Should connect to Goerli Test Network using MetaMask': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
+ .setupMetamask(passphrase, password)
+ .click('.network-indicator__down-arrow')
+ .useXpath().click("//span[text()='Goerli Test Network']")
+ .useCss().switchBrowserTab(0)
+ .refresh()
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .click('*[data-id="landingPageStartSolidity"]')
+ .pause(5000)
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]')
+ .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]')
+ .waitForElementPresent('*[data-id="settingsNetworkEnv"]')
+ .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Goerli (5) network')
+ .switchBrowserTab(2)
+ .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
+ .click('.page-container__footer-button:nth-of-type(2)')
+ .switchBrowserTab(0)
+ },
+
+ 'Should deploy contract on Goerli Test Network using MetaMask': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/Greet.sol')
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
+ .click('*[data-id="Deploy - transact (not payable)"]')
+ .switchBrowserTab(2)
+ .waitForElementPresent('.transaction-status--unapproved')
+ .click('.transaction-status--unapproved')
+ .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
+ .click('.page-container__footer-button:nth-of-type(2)')
+ .waitForElementPresent('.transaction-status--submitted')
+ .pause(25000)
+ .switchBrowserTab(0)
+ },
+
+ 'Should run low level interaction (fallback function) on Goerli Test Network using MetaMask': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
+ .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
+ .click('*[data-id="universalDappUiTitleExpander"]')
+ .waitForElementPresent('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
+ .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]')
+ .switchBrowserTab(2)
+ .waitForElementPresent('.transaction-status--unapproved')
+ .click('.transaction-status--unapproved')
+ .waitForElementPresent('.page-container__footer-button:nth-of-type(2)')
+ .click('.page-container__footer-button:nth-of-type(2)')
+ .waitForElementPresent('.transaction-status--submitted')
+ .pause(25000)
+ .switchBrowserTab(0)
+ },
+
+ 'Should connect to Ethereum Main Network using MetaMask': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
+ .switchBrowserTab(2)
+ .waitForElementPresent('.network-indicator__down-arrow')
+ .click('.network-indicator__down-arrow')
+ .useXpath().click("//span[text()='Main Ethereum Network']")
+ .useCss().switchBrowserTab(0)
+ .refresh()
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .click('*[data-id="landingPageStartSolidity"]')
+ .pause(5000)
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]')
+ .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]')
+ .waitForElementPresent('*[data-id="settingsNetworkEnv"]')
+ .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Main (1) network')
+ },
+
+ 'Should deploy contract on Ethereum Main Network using MetaMask': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="runTabSelectAccount"] option')
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/Greet.sol')
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]')
+ .click('*[data-id="Deploy - transact (not payable)"]')
+ .waitForElementPresent('*[data-id="modalDialogContainer"]', 15000)
+ .pause(10000)
+ .assert.containsText('*[data-id="modalDialogModalBody"]', 'You are creating a transaction on the main network. Click confirm if you are sure to continue.')
+ .modalFooterCancelClick()
+ },
+
+ /*
+ * This test is using 3 differents services:
+ * - Metamask for getting the transaction
+ * - Source Verifier service for fetching the contract code
+ * - Ropsten node for retrieving the trace and storage
+ *
+ */
+ 'Should debug Ropsten transaction with source highlighting using the source verifier service and MetaMask': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="remixIdeSidePanel"]')
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .switchBrowserTab(2)
+ .waitForElementPresent('.network-indicator__down-arrow')
+ .click('.network-indicator__down-arrow')
+ .useXpath().click("//span[text()='Ropsten Test Network']") // switch to Ropsten
+ .useCss().switchBrowserTab(0)
+ .refresh()
+ .clickLaunchIcon('pluginManager') // load debugger and source verification
+ // .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_source-verification"] button')
+ // debugger already activated .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_debugger"] button')
+ .clickLaunchIcon('udapp')
+ .waitForElementPresent('*[data-id="settingsSelectEnvOptions"]')
+ .click('*[data-id="settingsSelectEnvOptions"] option[id="injected-mode"]') // switch to Ropsten in udapp
+ .waitForElementPresent('*[data-id="settingsNetworkEnv"]')
+ .assert.containsText('*[data-id="settingsNetworkEnv"]', 'Ropsten (3) network')
+ .clickLaunchIcon('debugger')
+ .setValue('*[data-id="debuggerTransactionInput"]', '0x959371506b8f6223d71c709ac2eb2d0158104dca2d76ca949f1662712cf0e6db') // debug tx
+ .click('*[data-id="debuggerTransactionStartButton"]')
+ .waitForElementVisible('*[data-id="treeViewDivto"]', 30000)
+ .assert.containsText('*[data-id="stepdetail"]', 'loaded address:\n0x3c943Fb816694d7D1f4C738e3e7823818a88DD6C')
+ .assert.containsText('*[data-id="solidityLocals"]', 'to: 0x6C3CCC7FBA111707D5A1AAF2758E9D4F4AC5E7B1')
+ .end()
+ },
+ tearDown: sauce
+}
+
+const sources = [
+ {
+ 'browser/Greet.sol': {
+ content:
+ `
+ pragma solidity ^0.6.0;
+ contract helloWorld {
+ string public message;
+
+ fallback () external {
+ message = 'Hello World!';
+ }
+
+ function greet(string memory _message) public {
+ message = _message;
+ }
+ }`
+ }
+ }
+]
diff --git a/apps/remix-ide-e2e/src/tests/sauce.ts b/apps/remix-ide-e2e/src/tests/sauce.ts
new file mode 100644
index 0000000000..c1567ac48c
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/sauce.ts
@@ -0,0 +1,60 @@
+
+// const https = require('https')
+
+export default function sauce (callback: VoidFunction): void {
+ if (typeof callback === 'function') return callback()
+ /*
+ const currentTest = this.client.currentTest
+ const username = this.client.options.username
+ const sessionId = this.client.capabilities['webdriver.remote.sessionid']
+ const accessKey = this.client.options.accessKey
+
+ if (!username || !accessKey || !sessionId) {
+ console.log(this.client)
+ console.log('No username, accessKey or sessionId')
+ return callback()
+ }
+
+ const passed = currentTest.results.passed === currentTest.results.tests
+
+ const data = JSON.stringify({passed})
+
+ const requestPath = `/rest/v1/${username}/jobs/${sessionId}`
+
+ function responseCallback (res) {
+ res.setEncoding('utf8')
+ console.log('Response: ', res.statusCode, JSON.stringify(res.headers))
+ res.on('data', function onData (chunk) {
+ console.log('BODY: ' + chunk)
+ })
+ res.on('end', function onEnd () {
+ console.info('Finished updating saucelabs')
+ callback()
+ })
+ }
+
+ try {
+ console.log('Updating saucelabs', requestPath)
+
+ const req = https.request({
+ hostname: 'saucelabs.com',
+ path: requestPath,
+ method: 'PUT',
+ auth: `${username}:${accessKey}`,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Content-Length': data.length
+ }
+ }, responseCallback)
+
+ req.on('error', function onError (e) {
+ console.log('problem with request: ' + e.message)
+ })
+ req.write(data)
+ req.end()
+ } catch (error) {
+ console.log('Error', error)
+ callback()
+ }
+ */
+}
diff --git a/apps/remix-ide-e2e/src/tests/signingMessage.test.ts b/apps/remix-ide-e2e/src/tests/signingMessage.test.ts
new file mode 100644
index 0000000000..67c405d30a
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/signingMessage.test.ts
@@ -0,0 +1,97 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Test Signature': function (browser: NightwatchBrowser) {
+ let hash, signature
+ browser
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
+ .signMessage('test message', (h, s) => {
+ hash = h
+ signature = s
+ console.log('hash', hash)
+ console.log('signature', signature)
+ browser.assert.ok(typeof hash.value === 'string', 'type of hash.value must be String')
+ browser.assert.ok(typeof signature.value === 'string', 'type of signature.value must be String')
+ })
+ .addFile('signMassage.sol', sources[0]['browser/signMassage.sol'])
+ .openFile('browser/signMassage.sol')
+ .pause(5000)
+ .selectContract('ECVerify')
+ .createContract('')
+ .clickInstance(0)
+ .perform((done) => {
+ browser.getAddressAtPosition(0, (address) => {
+ // skip 'instance' part of e.g. 'instance0x692a70d2e424a56d2c6c27aa97d1a86395877b3a'
+ console.log('Test Signature address', address)
+ const inputs = `"${hash.value}","${signature.value}"`
+ console.log('Test Signature Input', inputs)
+ browser.clickFunction('ecrecovery - call', { types: 'bytes32 hash, bytes sig', values: inputs })
+ .pause(5000)
+ .verifyCallReturnValue(
+ address,
+ ['0:address: 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'])
+ .perform(() => {
+ done()
+ })
+ })
+ })
+ .end()
+ },
+ tearDown: sauce
+}
+
+const sources = [
+ {
+ 'browser/signMassage.sol': {content: `
+ pragma solidity >=0.4.22 <0.7.0;
+ contract SignMassageTest {
+ function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
+ return ecrecover(h, v, r, s);
+ }
+ }
+
+ library ECVerify {
+ function ecrecovery(bytes32 hash, bytes memory sig) public pure returns (address) {
+ bytes32 r;
+ bytes32 s;
+ uint8 v;
+
+ if (sig.length != 65) {
+ return address(0);
+ }
+
+ assembly {
+ r := mload(add(sig, 32))
+ s := mload(add(sig, 64))
+ v := and(mload(add(sig, 65)), 255)
+ }
+
+ if (v < 27) {
+ v += 27;
+ }
+
+ if (v != 27 && v != 28) {
+ return address(0);
+ }
+
+ return ecrecover(hash, v, r, s);
+ }
+
+ function ecverify(bytes32 hash, bytes memory sig, address signer) public pure returns (bool) {
+ return signer == ecrecovery(hash, sig);
+ }
+ }`}
+ }
+]
diff --git a/apps/remix-ide-e2e/src/tests/solidityImport.test.ts b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts
new file mode 100644
index 0000000000..fa4c9ff375
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts
@@ -0,0 +1,89 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Test Simple Contract': function (browser: NightwatchBrowser) {
+ browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['test1', 'test2'])
+ },
+
+ 'Test Success Import': function (browser: NightwatchBrowser) {
+ browser.addFile('Untitled1.sol', sources[1]['browser/Untitled1.sol'])
+ .addFile('Untitled2.sol', sources[1]['browser/Untitled2.sol'])
+ .openFile('browser/Untitled1.sol')
+ .verifyContracts(['test6', 'test4', 'test5'])
+ },
+
+ 'Test Failed Import': function (browser: NightwatchBrowser) {
+ browser.addFile('Untitled3.sol', sources[2]['browser/Untitled3.sol'])
+ .clickLaunchIcon('solidity')
+ .assert.containsText('#compileTabView .error pre', 'not found browser/Untitled11.sol')
+ },
+
+ 'Test Github Import - from master branch': function (browser: NightwatchBrowser) {
+ browser
+ .setSolidityCompilerVersion('soljson-v0.6.2+commit.bacdbe57.js') // open-zeppelin moved to pragma ^0.6.0 (master branch)
+ .addFile('Untitled4.sol', sources[3]['browser/Untitled4.sol'])
+ .clickLaunchIcon('fileExplorers')
+ .verifyContracts(['test7', 'ERC20', 'SafeMath'], {wait: 10000})
+ },
+
+ 'Test Github Import - from other branch': function (browser: NightwatchBrowser) {
+ browser
+ .setSolidityCompilerVersion('soljson-v0.5.0+commit.1d4f565a.js') // switch back to 0.5.0 : release-v2.3.0 branch is not solidity 0.6 compliant
+ .addFile('Untitled5.sol', sources[4]['browser/Untitled5.sol'])
+ .clickLaunchIcon('fileExplorers')
+ .verifyContracts(['test8', 'ERC20', 'SafeMath'], {wait: 10000})
+ },
+
+ 'Test Github Import - no branch specified': function (browser: NightwatchBrowser) {
+ browser
+ .setSolidityCompilerVersion('soljson-v0.6.2+commit.bacdbe57.js') // open-zeppelin moved to pragma ^0.6.0 (master branch)
+ .addFile('Untitled6.sol', sources[5]['browser/Untitled6.sol'])
+ .clickLaunchIcon('fileExplorers')
+ .verifyContracts(['test10', 'ERC20', 'SafeMath'], {wait: 10000})
+ },
+
+ 'Test Github Import - raw URL': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('Untitled7.sol', sources[6]['browser/Untitled7.sol'])
+ .clickLaunchIcon('fileExplorers')
+ .verifyContracts(['test11', 'ERC20', 'SafeMath'], {wait: 10000})
+ .end()
+ },
+ tearDown: sauce
+}
+
+const sources = [
+ {
+ 'browser/Untitled.sol': {content: 'contract test1 {} contract test2 {}'}
+ },
+ {
+ 'browser/Untitled1.sol': {content: 'import "./Untitled2.sol"; contract test6 {}'},
+ 'browser/Untitled2.sol': {content: 'contract test4 {} contract test5 {}'}
+ },
+ {
+ 'browser/Untitled3.sol': {content: 'import "./Untitled11.sol"; contract test6 {}'}
+ },
+ {
+ 'browser/Untitled4.sol': {content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; contract test7 {}'}
+ },
+ {
+ 'browser/Untitled5.sol': {content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.3.0/contracts/token/ERC20/ERC20.sol"; contract test8 {}'}
+ },
+ {
+ 'browser/Untitled6.sol': {content: 'import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; contract test10 {}'}
+ },
+ {
+ 'browser/Untitled7.sol': {content: 'import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/ERC20.sol"; contract test11 {}'}
+ }
+]
diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
new file mode 100644
index 0000000000..80757def5d
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
@@ -0,0 +1,382 @@
+'use strict'
+
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+
+ before: function (browser: NightwatchBrowser, done) {
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Should launch solidity unit test plugin': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .clickLaunchIcon('fileExplorers')
+ .addFile('simple_storage.sol', sources[0]['browser/simple_storage.sol'])
+ .addFile('ks2a.sol', sources[0]['browser/ks2a.sol'])
+ .clickLaunchIcon('pluginManager')
+ .scrollAndClick('*[data-id="pluginManagerComponentActivateButtonsolidityUnitTesting"]')
+ .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
+ .waitForElementPresent('*[data-id="sidePanelSwapitTitle"]')
+ .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'SOLIDITY UNIT TESTING')
+ },
+
+ 'Should generate test file': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/simple_storage.sol')
+ .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
+ .waitForElementPresent('*[data-id="testTabGenerateTestFile"]')
+ .click('*[data-id="testTabGenerateTestFile"]')
+ .waitForElementPresent('*[title="browser/tests/simple_storage_test.sol"]')
+ .clickLaunchIcon('fileExplorers')
+ .pause(10000)
+ .openFile('browser/tests/simple_storage_test.sol')
+ .removeFile('browser/tests/simple_storage_test.sol')
+ },
+
+ 'Should run simple unit test `simple_storage_test.sol` ': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .addFile('tests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'])
+ .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
+ .waitForElementPresent('*[data-id="testTabCheckAllTests"]')
+ .click('*[data-id="testTabCheckAllTests"]')
+ .clickElementAtPosition('.singleTestLabel', 1)
+ .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 80000)
+ .pause(5000)
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'MyTest (browser/tests/simple_storage_test.sol)')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Initial value should be100')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Value is set200')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Should fail for wrong value200')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Passing: 2')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'Failing: 1')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'FAIL MyTest (browser/tests/simple_storage_test.sol)')
+ },
+
+ 'Should run advance unit test using natspec and experimental ABIEncoderV2 `ks2b_test.sol` ': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .clickLaunchIcon('fileExplorers')
+ .addFile('tests/ks2b_test.sol', sources[0]['browser/tests/ks2b_test.sol'])
+ .click('*[data-id="verticalIconsKindsolidityUnitTesting"]')
+ .waitForElementPresent('*[data-id="testTabCheckAllTests"]')
+ .click('*[data-id="testTabCheckAllTests"]')
+ .clickElementAtPosition('.singleTestLabel', 2)
+ .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
+ .pause(5000)
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project exists')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong project owner')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong sender')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✘ Check wrong value')
+ .pause(5000)
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', '✓ Check project is fundable')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'owner is incorrect')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong sender')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'wrong value')
+ },
+
+ 'Should stop unit tests during test execution` ': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .waitForElementPresent('*[data-id="testTabRunTestsTabRunAction"]')
+ .clickElementAtPosition('.singleTestLabel', 0)
+ .clickElementAtPosition('.singleTestLabel', 1)
+ .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
+ .pause(5000)
+ .click('*[data-id="testTabRunTestsTabStopAction"]')
+ .pause(1000)
+ .assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol')
+ .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/4_Ballot_test.sol')
+ .notContainsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/simple_storage_test.sol')
+ .pause(7000)
+ .assert.containsText('*[data-id="testTabTestsExecutionStopped"]', 'The test execution has been stopped')
+ },
+
+ 'Should fail on compilation': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .addFile('tests/compilationError_test.sol', sources[0]['browser/compilationError_test.sol'])
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/tests/compilationError_test.sol')
+ .clickLaunchIcon('solidityUnitTesting')
+ .click('*[data-id="testTabCheckAllTests"]')
+ .clickElementAtPosition('.singleTestLabel', 3)
+ .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'SyntaxError: No visibility specified')
+ .assert.containsText('*[data-id="testTabTestsExecutionStoppedError"]', 'The test execution has been stopped because of error(s) in your test file')
+ },
+
+ 'Should fail on deploy': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .addFile('tests/deployError_test.sol', sources[0]['browser/tests/deployError_test.sol'])
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/tests/deployError_test.sol')
+ .clickLaunchIcon('solidityUnitTesting')
+ .click('*[data-id="testTabCheckAllTests"]')
+ .clickElementAtPosition('.singleTestLabel', 4)
+ .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'contract deployment failed after trying twice')
+ },
+
+ 'Should fail when parameters are to method in test contract': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .addFile('tests/methodFailure_test.sol', sources[0]['browser/tests/methodFailure_test.sol'])
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/tests/methodFailure_test.sol')
+ .clickLaunchIcon('solidityUnitTesting')
+ .click('*[data-id="testTabCheckAllTests"]')
+ .clickElementAtPosition('.singleTestLabel', 5)
+ .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
+ .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', `Method 'add' can not have parameters inside a test contract`)
+ },
+
+ 'Changing current path': function (browser: NightwatchBrowser) {
+ browser.waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .addFile('myTests/simple_storage_test.sol', sources[0]['browser/tests/simple_storage_test.sol'])
+ .clickLaunchIcon('solidityUnitTesting')
+ .setValue('*[data-id="uiPathInput"]', 'browser/myTests')
+ .clickElementAtPosition('.singleTestLabel', 0)
+ .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutput"]')
+ .clearValue('*[data-id="uiPathInput"]')
+ .setValue('*[data-id="uiPathInput"]', 'browser/tests')
+ },
+
+ 'Solidity Unittests': function (browser: NightwatchBrowser) {
+ runTests(browser)
+ },
+
+ tearDown: sauce
+}
+
+function runTests (browser: NightwatchBrowser) {
+ browser
+ .waitForElementPresent('*[data-id="verticalIconsKindfileExplorers"]')
+ .clickLaunchIcon('fileExplorers')
+ .openFile('browser/3_Ballot.sol')
+ .clickLaunchIcon('solidityUnitTesting')
+ .pause(500)
+ .scrollAndClick('#runTestsTabRunAction')
+ .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
+ .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 7000)
+ .assert.containsText('#solidityUnittestsOutput', 'browser/tests/4_Ballot_test.sol')
+ .assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal')
+ .assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value')
+ .end()
+}
+
+const sources = [
+ {
+ 'browser/simple_storage.sol': {
+ content: `
+ pragma solidity >=0.4.22 <0.7.0;
+
+ contract SimpleStorage {
+ uint public storedData;
+
+ constructor() public {
+ storedData = 100;
+ }
+
+ function set(uint x) public {
+ storedData = x;
+ }
+
+ function get() public view returns (uint retVal) {
+ return storedData;
+ }
+ }
+ `
+ },
+ 'browser/tests/simple_storage_test.sol': {
+ content: `
+ pragma solidity >=0.4.22 <0.7.0;
+ import "remix_tests.sol";
+ import "../simple_storage.sol";
+
+ contract MyTest {
+ SimpleStorage foo;
+
+ function beforeEach() public {
+ foo = new SimpleStorage();
+ }
+
+ function initialValueShouldBe100() public returns (bool) {
+ return Assert.equal(foo.get(), 100, "initial value is not correct");
+ }
+
+ function valueIsSet200() public returns (bool) {
+ foo.set(200);
+ return Assert.equal(foo.get(), 200, "value is not 200");
+ }
+
+ function shouldFailForWrongValue200() public returns (bool) {
+ foo.set(300);
+ return Assert.equal(foo.get(), 200, "value is not 200");
+ }
+ }
+ `
+ },
+ 'browser/ks2a.sol': {
+ content: `
+ pragma solidity >=0.4.22 <0.6.0;
+ contract Kickstarter {
+ enum State { Started, Completed }
+
+ struct Project {
+ address owner;
+ string name;
+ uint goal;
+ uint fundsAvailable; // added
+ uint amountContributed; // added
+ State state;
+ mapping(address => uint) funders; // added
+ }
+
+ Project[] public projects;
+
+ constructor() public {
+ }
+
+ function createProject(string memory name, uint goal) public {
+ projects.length++; // new line
+ Project storage project = projects[projects.length - 1];
+ project.name = name;
+ project.goal = goal;
+ project.owner = msg.sender;
+ project.state = State.Started;
+ }
+
+ function fundProject(uint projectId) payable public {
+ Project storage project = projects[projectId];
+ // require project exists
+ // PLEASE CHECK / or erase
+ // not this: require(projects[projectId].exists, "the project must exist to be funded");
+
+ // require for... underflow/overflow protection
+ project.funders[msg.sender] += msg.value;
+ project.amountContributed += msg.value;
+ project.fundsAvailable += msg.value;
+
+ if (project.amountContributed >= project.goal) {
+ project.state = State.Completed;
+ }
+ }
+
+ // this function is here because we can't use web3 when using the VM
+ function getContractBalance() public view returns(uint balance) {
+ return address(this).balance;
+ }
+
+ }
+ `
+ },
+ 'browser/tests/ks2b_test.sol': {
+ content: `
+ pragma solidity >=0.4.22 <0.6.0;
+ pragma experimental ABIEncoderV2;
+
+ import "remix_tests.sol"; // this import is automatically injected by Remix.
+ import "remix_accounts.sol";
+ import "../ks2a.sol";
+
+ contract kickstarterTest {
+ enum State { Started, Completed }
+
+ Kickstarter kickstarter;
+
+ function beforeAll () public {
+ kickstarter = new Kickstarter();
+ kickstarter.createProject("ProjectA", 123000);
+ kickstarter.createProject("ProjectB", 100);
+ }
+
+ /// #sender: account-1
+ /// #value: 10000000
+ function checkProjectExists () public payable {
+ (address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
+ Assert.equal(name, "ProjectA", "project name is incorrect");
+ Assert.equal(goal, 123000, "funding goal is incorrect");
+ Assert.equal(owner, address(this), "owner is incorrect");
+ Assert.equal(msg.sender, TestsAccounts.getAccount(1), "wrong sender");
+ Assert.equal(msg.value, 10000000, "wrong value");
+ }
+
+ /// #sender: account-1
+ /// #value: 10000000
+ function checkWrongProjectOwner () public payable {
+ (address owner,,,,,) = kickstarter.projects(0);
+ Assert.equal(owner, TestsAccounts.getAccount(0), "owner is incorrect"); //failing case
+ }
+
+ /// #sender: account-1
+ /// #value: 10000000
+ function checkWrongSender () public payable {
+ Assert.equal(msg.sender, TestsAccounts.getAccount(0), "wrong sender"); //failing case
+ }
+
+ /// #sender: account-1
+ /// #value: 10000000
+ function checkWrongValue () public payable {
+ Assert.equal(msg.value, 5000000, "wrong value"); //failing case
+ }
+
+ function checkProjectIsFundable () public {
+ kickstarter.fundProject.value(120000)(0);
+ (address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
+ Assert.equal(amountContributed, 120000, "contributed amount is incorrect");
+ }
+
+ }
+ `
+ },
+ 'browser/compilationError_test.sol': {
+ content: `
+ pragma solidity ^0.6.1;
+
+ contract failOnCompilation {
+ fallback() {
+
+ }
+ }
+ `
+ },
+ 'browser/tests/deployError_test.sol': {
+ content: `
+ pragma solidity ^0.6.0;
+
+ contract failingDeploy {
+ constructor() public {
+ revert('Deploy Failed');
+ }
+ }
+ `
+ },
+ 'browser/tests/methodFailure_test.sol': {
+ content: `
+ pragma solidity ^0.6.0;
+
+ contract methodfailure {
+ function add(uint a, uint b) public {
+ uint c = a+b;
+ Assert.equal(a+b, c, "wrong value");
+ }
+ }
+ `
+ }
+ }
+]
diff --git a/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts
new file mode 100644
index 0000000000..2b6e1a2ecd
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/specialFunctions.test.ts
@@ -0,0 +1,284 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ // this test suite also contribute testing https://github.com/ethereum/remix/pull/1497 and https://github.com/ethereum/remix-ide/pull/2898
+ // quick explanation:
+ // the goal of https://github.com/ethereum/remix-ide/pull/2898 is to keep track of all the compiled contracts an not only the last one.
+ // this introduce an issue: if 2 compiled contracts have the same name, the second one override the first which is not wanted.
+ // fix's delivered by https://github.com/ethereum/remix/pull/1497: instead of getting contract by name,
+ // which result in name clashing we process the whole contract object (which contain bytecode, deployedbytecode, ...)
+ init(browser, done)
+ },
+
+ '@sources': function () {
+ return sources
+ },
+
+ 'Use special functions receive/fallback - both are declared, sending data': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('#icon-panel', 10000)
+ .testContracts('receiveAndFallback.sol', sources[0]['browser/receiveAndFallback.sol'], ['CheckSpecials']) // compile
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
+ .selectContract('CheckSpecials')
+ .createContract('') // deploy
+ .clickInstance(0)
+ .perform((done) => {
+ browser.getAddressAtPosition(0, (address) => {
+ browser.sendLowLevelTx(address, '0', '0xaa')
+ .pause(1000)
+ .journalLastChildIncludes('to: CheckSpecials.(fallback)')
+ .journalLastChildIncludes('value: 0 wei')
+ .journalLastChildIncludes('data: 0xaa')
+ .perform(done)
+ })
+ })
+ },
+
+ 'Use special functions receive/fallback - both are declared, failing sending data < 1 byte': function (browser: NightwatchBrowser) {
+ // don't need to redeploy it, same contract
+ browser.perform((done) => {
+ browser.getAddressAtPosition(0, (address) => {
+ browser.sendLowLevelTx(address, '0', '0xa')
+ .pause(1000)
+ .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
+ .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `The calldata should be a valid hexadecimal value with size of at least one byte.`)
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - both are declared, failing sending data with odd number of digits': function (browser: NightwatchBrowser) {
+ // don't need to redeploy it, same contract
+ browser.perform((done) => {
+ browser.getAddressAtPosition(0, (address) => {
+ browser.sendLowLevelTx(address, '0', '0x1aa')
+ .pause(1000)
+ .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
+ .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `The calldata should be a valid hexadecimal value.`)
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - both are declared - receive called, sending wei': function (browser: NightwatchBrowser) {
+ // don't need to redeploy it, same contract
+ browser.perform((done) => {
+ browser.getAddressAtPosition(0, (address) => {
+ browser.sendLowLevelTx(address, '1', '')
+ .pause(1000)
+ .journalLastChildIncludes('to: CheckSpecials.(receive)')
+ .journalLastChildIncludes('value: 1 wei')
+ .journalLastChildIncludes('data: 0x')
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - both are declared - fallback should fail cause not payable, sending data and wei': function (browser: NightwatchBrowser) {
+ // don't need to redeploy it, same contract
+ browser.perform((done) => {
+ browser.getAddressAtPosition(0, (address) => {
+ browser.sendLowLevelTx(address, '10', '0xaa')
+ .pause(1000)
+ .journalLastChildIncludes('to CheckSpecials.(fallback) errored:')
+ .journalLastChildIncludes('The called function should be payable if you send value')
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - only receive is declared, sending wei': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('#icon-panel', 10000)
+ .testContracts('receiveOnly.sol', sources[1]['browser/receiveOnly.sol'], ['CheckSpecials'])
+ .clickLaunchIcon('udapp')
+ .selectContract('CheckSpecials')
+ .createContract('')
+ .clickInstance(1)
+ .perform((done) => {
+ browser.getAddressAtPosition(1, (address) => {
+ browser.sendLowLevelTx(address, '1', '')
+ .pause(1000)
+ .journalLastChildIncludes('to: CheckSpecials.(receive)')
+ .journalLastChildIncludes('value: 1 wei')
+ .journalLastChildIncludes('data: 0x')
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - only receive is declared, failing, fallback is not declared, sending data': function (browser: NightwatchBrowser) {
+ // don't need to redeploy it, same contract
+ browser.perform((done) => {
+ browser.getAddressAtPosition(1, (address) => {
+ browser.sendLowLevelTx(address, '0', '0xaa')
+ .pause(1000)
+ .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
+ .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `'Fallback' function is not defined`)
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - only fallback declared and is payable, sending wei': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('#icon-panel', 10000)
+ .testContracts('fallbackOnlyPayable.sol', sources[2]['browser/fallbackOnlyPayable.sol'], ['CheckSpecials'])
+ .clickLaunchIcon('udapp')
+ .selectContract('CheckSpecials')
+ .createContract('')
+ .clickInstance(2)
+ .perform((done) => {
+ browser.getAddressAtPosition(2, (address) => {
+ browser.sendLowLevelTx(address, '1', '')
+ .pause(1000)
+ .journalLastChildIncludes('to: CheckSpecials.(fallback)')
+ .journalLastChildIncludes('value: 1 wei')
+ .journalLastChildIncludes('data: 0x')
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - only fallback is diclared and is payable, sending data and wei': function (browser: NightwatchBrowser) {
+ // don't need to redeploy it, same contract
+ browser.perform((done) => {
+ browser.getAddressAtPosition(2, (address) => {
+ browser.sendLowLevelTx(address, '1', '0xaa')
+ .pause(1000)
+ .journalLastChildIncludes('to: CheckSpecials.(fallback)')
+ .journalLastChildIncludes('value: 1 wei')
+ .journalLastChildIncludes('data: 0xaa')
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - only fallback is declared, fallback should fail cause not payable, sending wei': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('#icon-panel', 10000)
+ .testContracts('fallbackOnlyNotPayable.sol', sources[3]['browser/fallbackOnlyNotPayable.sol'], ['CheckSpecials'])
+ .clickLaunchIcon('udapp')
+ .selectContract('CheckSpecials')
+ .createContract('')
+ .clickInstance(3)
+ .perform((done) => {
+ browser.getAddressAtPosition(3, (address) => {
+ browser.sendLowLevelTx(address, '1', '')
+ .pause(1000)
+ .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
+ .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `should have either 'receive' or payable 'fallback'`)
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - receive and fallback are declared, sending data and wei': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('#icon-panel', 10000)
+ .testContracts('receiveAndFallbackBothPayable.sol', sources[4]['browser/receiveAndFallbackBothPayable.sol'], ['CheckSpecials'])
+ .clickLaunchIcon('udapp')
+ .selectContract('CheckSpecials')
+ .waitForElementVisible('#value')
+ .clearValue('#value')
+ .setValue('#value', '0')
+ .createContract('')
+ .clickInstance(4)
+ .pause(1000)
+ .perform((done) => {
+ browser.getAddressAtPosition(4, (address) => {
+ browser.sendLowLevelTx(address, '1', '0xaa')
+ .pause(1000)
+ .journalLastChildIncludes('to: CheckSpecials.(fallback)')
+ .journalLastChildIncludes('value: 1 wei')
+ .journalLastChildIncludes('data: 0xaa')
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - receive and fallback are declared and payable, sending wei': function (browser: NightwatchBrowser) {
+ browser.perform((done) => {
+ browser.getAddressAtPosition(4, (address) => {
+ browser.sendLowLevelTx(address, '1', '')
+ .pause(1000)
+ .journalLastChildIncludes('to: CheckSpecials.(receive)')
+ .journalLastChildIncludes('value: 1 wei')
+ .journalLastChildIncludes('data: 0x')
+ .perform(done)
+ })
+ })
+ },
+ 'Use special functions receive/fallback - receive and fallback are not declared, sending nothing': function (browser: NightwatchBrowser) {
+ browser.waitForElementVisible('#icon-panel', 10000)
+ .testContracts('notSpecial.sol', sources[5]['browser/notSpecial.sol'], ['CheckSpecials'])
+ .clickLaunchIcon('udapp')
+ .selectContract('CheckSpecials')
+ .waitForElementVisible('#value')
+ .clearValue('#value')
+ .setValue('#value', '0')
+ .createContract('')
+ .clickInstance(5)
+ .pause(1000)
+ .perform((done) => {
+ browser.getAddressAtPosition(5, (address) => {
+ browser.sendLowLevelTx(address, '0', '')
+ .pause(1000)
+ .waitForElementVisible(`#instance${address} label[id="deployAndRunLLTxError"]`)
+ .assert.containsText(`#instance${address} label[id="deployAndRunLLTxError"]`, `Both 'receive' and 'fallback' functions are not defined`)
+ .perform(done)
+ })
+ })
+ .end()
+ },
+ tearDown: sauce
+}
+
+const sources = [
+ {
+ 'browser/receiveAndFallback.sol': {
+ content: `
+ contract CheckSpecials {
+ receive() payable external{}
+ fallback() external {}
+ }
+ `
+ }
+ },
+ {
+ 'browser/receiveOnly.sol': {
+ content: `
+ contract CheckSpecials {
+ receive() payable external {}
+ }
+ `
+ }
+ },
+ {
+ 'browser/fallbackOnlyPayable.sol': {
+ content: `
+ contract CheckSpecials {
+ fallback() payable external {}
+ }
+ `
+ }
+ },
+ {
+ 'browser/fallbackOnlyNotPayable.sol': {
+ content: `
+ contract CheckSpecials {
+ fallback() external {}
+ }
+ `
+ }
+ },
+ {
+ 'browser/receiveAndFallbackBothPayable.sol': {
+ content: `
+ contract CheckSpecials {
+ receive() payable external {}
+ fallback() payable external {}
+ }
+ `
+ }
+ },
+ {
+ 'browser/notSpecial.sol': {
+ content: `
+ contract CheckSpecials {
+ function otherFallback() payable external {}
+ }
+ `
+ }
+ }
+]
diff --git a/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts b/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
new file mode 100644
index 0000000000..c7c37043d2
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
@@ -0,0 +1,70 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+const sources = [
+ {
+ 'browser/Untitled.sol': {content: `
+pragma solidity >=0.4.22 <0.6.0;
+contract test1 { address test = tx.origin; }
+contract test2 {}
+contract TooMuchGas {
+ uint x;
+ function() external {
+ x++;
+ uint test;
+ uint test1;
+ }
+}`}}
+]
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+ '@sources': function () {
+ return sources
+ },
+ 'Static Analysis': function (browser: NightwatchBrowser) {
+ runTests(browser)
+ },
+ tearDown: sauce
+}
+
+function runTests (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('#icon-panel', 10000)
+ .clickLaunchIcon('solidity')
+ .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TooMuchGas', 'test1', 'test2'])
+ .clickLaunchIcon('solidityStaticAnalysis')
+ .click('#staticanalysisView button')
+ .waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () {
+ listSelectorContains(['Use of tx.origin',
+ 'Fallback function of contract TooMuchGas requires too much gas',
+ 'TooMuchGas.() : Variables have very similar names "test" and "test1".'],
+ '#staticanalysisresult .warning',
+ browser, function () {
+ browser.end()
+ }
+ )
+ })
+}
+
+function listSelectorContains (textsToFind: string[], selector: string, browser: NightwatchBrowser, callback: VoidFunction) {
+ browser.execute(function (selector) {
+ const items = document.querySelectorAll(selector)
+ const ret = []
+ for (let k = 0; k < items.length; k++) {
+ ret.push(items[k].innerText)
+ }
+ return ret
+ }, [selector], function (result) {
+ console.log(result.value)
+ for (const k in textsToFind) {
+ console.log('testing `' + result.value[k] + '` against `' + textsToFind[k] + '`')
+ browser.assert.equal(result.value[k].indexOf(textsToFind[k]) !== -1, true)
+ }
+ callback()
+ })
+}
diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts
new file mode 100644
index 0000000000..0ea1427111
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts
@@ -0,0 +1,104 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false)
+ },
+
+ 'Should execution a simple console command': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="terminalCli"]', 10000)
+ .executeScript('console.log(1 + 1)')
+ .journalLastChild('2')
+ },
+
+ 'Should clear console': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="terminalCli"]')
+ .journalChildIncludes('Welcome to Remix')
+ .click('#clearConsole')
+ .assert.containsText('*[data-id="terminalJournal"]', '')
+ },
+
+ 'Should display auto-complete menu': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="terminalCli"]')
+ .click('*[data-id="terminalCli"]')
+ .sendKeys('*[data-id="terminalCliInput"]', 'remix.')
+ .assert.visible('*[data-id="autoCompletePopUpAutoCompleteItem"]')
+ },
+
+ 'Should execute remix.help() command': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="terminalCli"]')
+ .executeScript('remix.help()')
+ .journalChildIncludes('remix.loadgist(id)')
+ .journalChildIncludes('remix.loadurl(url)')
+ .journalChildIncludes('remix.execute(filepath)')
+ .journalChildIncludes('remix.exeCurrent()')
+ .journalChildIncludes('remix.help()')
+ },
+
+ 'Async/Await Script': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('asyncAwait.js', { content: asyncAwait })
+ .openFile('browser/asyncAwait.js')
+ .executeScript(`remix.execute('browser/asyncAwait.js')`)
+ .journalLastChild('Waiting Promise')
+ .pause(5500)
+ .journalLastChild('result - Promise Resolved')
+ },
+
+ 'Call Remix File Manager from a script': function (browser: NightwatchBrowser) {
+ browser
+ .addFile('asyncAwaitWithFileManagerAccess.js', { content: asyncAwaitWithFileManagerAccess })
+ .openFile('browser/asyncAwaitWithFileManagerAccess.js')
+ .pause(5000)
+ .executeScript(`remix.execute('browser/asyncAwaitWithFileManagerAccess.js')`)
+ .pause(6000)
+ .journalLastChildIncludes('contract Ballot {')
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+const asyncAwait = `
+ var p = function () {
+ return new Promise(function (resolve, reject) {
+ setTimeout(function () {
+ resolve("Promise Resolved")
+ }, 5000)
+ })
+ }
+
+ var run = async () => {
+ console.log('Waiting Promise')
+ var result = await p()
+ console.log('result - ', result)
+ }
+
+ run()
+`
+
+const asyncAwaitWithFileManagerAccess = `
+ var p = function () {
+ return new Promise(function (resolve, reject) {
+ setTimeout(function () {
+ resolve("Promise Resolved")
+ }, 0)
+ })
+ }
+
+ var run = async () => {
+ console.log('Waiting Promise')
+ var result = await p()
+ let text = await remix.call('fileManager', 'readFile', 'browser/3_Ballot.sol')
+ console.log('result - ', text)
+ }
+
+ run()
+`
diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
new file mode 100644
index 0000000000..9fd2b57b59
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
@@ -0,0 +1,211 @@
+'use strict'
+import { NightwatchBrowser } from "nightwatch"
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+ '@sources': function () {
+ return sources
+ },
+
+ 'Execute Simple Contract and Test Terminal': function (browser: NightwatchBrowser) {
+ browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract'])
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
+ .click('#runTabView button[class^="instanceButton"]')
+ .waitForElementPresent('.instance:nth-of-type(2)')
+ .click('.instance:nth-of-type(2) > div > button')
+ .click('#runTabView .instance div[class^="title"]')
+ .click('#runTabView .instance div[class^="title"]')
+ .clickFunction('f - transact (not payable)')
+ .testFunction('0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03',
+ 'decoded output': { '0': 'uint256: 8' }
+ })
+ .pause(500)
+ .checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '')
+ .clickFunction('g - transact (not payable)')
+ .testFunction('0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0',
+ 'decoded output': {
+ '0': 'uint256: 345',
+ '1': 'string: comment_comment_',
+ '2': 'bool: true',
+ '3': 'uint256: 4'
+ }
+ })
+ .click('*[data-id="deployAndRunClearInstances"]')
+ },
+
+ 'Test Complex Return Values': function (browser: NightwatchBrowser) {
+ browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues'])
+ .clickLaunchIcon('udapp')
+ .click('#runTabView button[class^="instanceButton"]')
+ .waitForElementPresent('.instance:nth-of-type(2)')
+ .click('.instance:nth-of-type(2) > div > button')
+ .clickFunction('retunValues1 - transact (not payable)')
+ .testFunction('0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d',
+ 'decoded output': {
+ '0': 'bool: _b true',
+ '1': 'uint256: _u 345',
+ '2': 'int256: _i -345',
+ '3': 'address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'
+ }
+ })
+ .clickFunction('retunValues2 - transact (not payable)')
+ .testFunction('0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf',
+ 'decoded output': {
+ '0': 'bytes1: _b 0x12',
+ '1': 'bytes2: _b2 0x1223',
+ '2': 'bytes3: _b3 0x000000',
+ '3': 'bytes: _blit 0x123498',
+ '4': 'bytes5: _b5 0x0432450000',
+ '5': 'bytes6: _b6 0x234553253200',
+ '6': 'string: _str this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string',
+ '7': 'bytes7: _b7 0x03252353253253',
+ '8': 'bytes22: _b22 0x32523523532532532523532500000000000000000000',
+ '9': 'bytes32: _b32 0x0325235325325235325235325235320000000000000000000000000000000000'
+ }
+ }).pause(500)
+ .clickFunction('retunValues3 - transact (not payable)')
+ .testFunction('0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5',
+ 'decoded output': {
+ '0': 'uint8: _en 2',
+ '1': 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7'
+ }
+ }).click('*[data-id="deployAndRunClearInstances"]')
+ },
+
+ 'Test Complex Input Values': function (browser: NightwatchBrowser) {
+ browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test'])
+ .clickLaunchIcon('udapp')
+ .click('#runTabView button[class^="instanceButton"]')
+ .waitForElementPresent('.instance:nth-of-type(2)')
+ .click('.instance:nth-of-type(2) > div > button')
+ .clickFunction('inputValue1 - transact (not payable)', {types: 'uint256 _u, int256 _i, string _str', values: '"2343242", "-4324324", "string _ string _ string _ string _ string _ string _ string _ string _ string _ string _"'})
+ .testFunction('0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97',
+ 'decoded output': {
+ '0': 'uint256: _uret 2343242',
+ '1': 'int256: _iret -4324324',
+ '2': 'string: _strret string _ string _ string _ string _ string _ string _ string _ string _ string _ string _'
+ }
+ })
+ .pause(500)
+ .clickFunction('inputValue2 - transact (not payable)', {types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234000000000000", "0x1234000000000000","0x1234000000000000","0x1234000000000000"]'})
+ .testFunction('0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f', {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f',
+ 'decoded output': {
+ '0': 'uint256[3]: _nret 1,2,3',
+ '1': 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000'
+ },
+ logs: [
+ {
+ 'from': '0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5',
+ 'topic': '0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f',
+ 'event': 'event1',
+ 'args': {
+ '0': '-123',
+ '1': '123',
+ '2': {
+ 'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
+ 'type': 'Indexed'
+ },
+ '3': '0x12340000',
+ '4': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
+ '_i': '-123',
+ '_u': '123',
+ '_str': {
+ 'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
+ 'type': 'Indexed'
+ },
+ '_b': '0x12340000',
+ '_notIndexed': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
+ 'length': 5
+ }
+ }
+ ]
+ })
+ .click('*[data-id="deployAndRunClearInstances"]')
+ .end()
+ },
+
+ tearDown: sauce
+}
+
+// @TODO test: bytes8[3][] type as input
+
+const sources = [
+ {'browser/Untitled.sol': {content: `
+ contract TestContract { function f() public returns (uint) { return 8; }
+ function g() public returns (uint, string memory, bool, uint) {
+ uint payment = 345;
+ bool payed = true;
+ string memory comment = "comment_comment_";
+ uint month = 4;
+ return (payment, comment, payed, month); } }`}},
+ {'browser/returnValues.sol': {content: `
+ contract testReturnValues {
+ enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
+ function retunValues1 () public returns (bool _b, uint _u, int _i, address _a) {
+ _b = true;
+ _u = 345;
+ _i = -345;
+ _a = msg.sender;
+ }
+
+ function retunValues2 () public returns (byte _b, bytes2 _b2, bytes3 _b3, bytes memory _blit, bytes5 _b5, bytes6 _b6, string memory _str, bytes7 _b7, bytes22 _b22, bytes32 _b32) {
+ _b = 0x12;
+ _b2 = 0x1223;
+ _b5 = hex"043245";
+ _b6 = hex"2345532532";
+ _b7 = hex"03252353253253";
+ _b22 = hex"325235235325325325235325";
+ _b32 = hex"032523532532523532523532523532";
+ _blit = hex"123498";
+ _str = "this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string";
+ }
+
+ function retunValues3 () public returns (ActionChoices _en, int[5][] memory _a1) {
+ _en = ActionChoices.GoStraight;
+ int[5][] memory a = new int[5][](3);
+ a[0] = [int(1),-45,-78,56,60];
+ a[1] = [int(-1),42,334,-45455,-446];
+ a[2] = [int(1),10,-5435,45,-7];
+ _a1 = a;
+ }
+ }`}},
+ {'browser/inputValues.sol': {content: `
+ contract test {
+ event event1(int _i, uint indexed _u, string indexed _str, bytes4 _b, string _notIndexed);
+ function inputValue1 (uint _u, int _i, string memory _str) public returns (uint _uret, int _iret, string memory _strret) {
+ _uret = _u;
+ _iret = _i;
+ _strret = _str;
+ }
+ function inputValue2 (uint[3] memory _n, bytes8[4] memory _b8) public returns (uint[3] memory _nret, bytes8[4] memory _b8ret){
+ _nret = _n;
+ _b8ret = _b8;
+ emit event1(-123, 123, "test", hex"1234", "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ");
+ }
+}`}}
+]
diff --git a/apps/remix-ide-e2e/src/tests/txListener.test.ts b/apps/remix-ide-e2e/src/tests/txListener.test.ts
new file mode 100644
index 0000000000..be4056778f
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/txListener.test.ts
@@ -0,0 +1,53 @@
+'use strict'
+import { NightwatchBrowser } from 'nightwatch'
+import init from '../helpers/init'
+import sauce from './sauce'
+import examples from '../examples/example-contracts'
+
+const sources = [
+ {'browser/Untitled.sol': {content: examples.ballot.content}},
+ {'browser/Untitled1.sol': {content: `contract test {}`}}
+]
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+ '@sources': function () {
+ return sources
+ },
+ 'The sequence: Compiling / Deploying / Compiling another contract / calling the first contract - should display in the log the transaction with all the decoded information': function (browser: NightwatchBrowser) {
+ // https://github.com/ethereum/remix-ide/issues/2864
+ browser
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .clickLaunchIcon('solidity')
+ .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
+ .clickLaunchIcon('udapp')
+ .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
+ .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
+ .click('*[data-id="Deploy - transact (not payable)"]')
+ .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
+ .click('*[data-id="universalDappUiTitleExpander"]')
+ .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'})
+ .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
+ {
+ status: '0x1 Transaction mined and execution succeed',
+ 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
+ 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
+ })
+ .clickLaunchIcon('solidity')
+ .testContracts('Untitled1.sol', sources[1]['browser/Untitled1.sol'], ['test'])
+ .clickLaunchIcon('udapp')
+ .clickFunction('delegate - transact (not payable)', {types: 'address to', values: ''})
+ .pause(5000)
+ .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
+ {
+ status: '0x0 Transaction mined but execution failed',
+ 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
+ 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
+ })
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts b/apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts
new file mode 100644
index 0000000000..d5dc8f52cd
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts
@@ -0,0 +1,52 @@
+'use strict'
+import { NightwatchBrowser } from 'nightwatch'
+import init from '../helpers/init'
+import sauce from './sauce'
+
+const sources = [
+ {'browser/basic.sol': { content:
+ `pragma solidity >=0.2.0 <0.7.0;
+
+ /**
+ * @title Basic contract
+ */
+ contract Basic {
+ uint someVar;
+ constructor() public {}
+ }`
+ }}
+]
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done)
+ },
+ '@sources': function () {
+ return sources
+ },
+ 'Using Web Worker': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
+ .clickLaunchIcon('fileExplorers')
+ .addFile('browser/basic.sol', sources[0]['browser/basic.sol'])
+ .clickLaunchIcon('solidity')
+ .execute(function() {
+ const elem = document.getElementById('nightlies') as HTMLInputElement
+
+ elem.checked = true
+ })
+ .noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js')
+ .noWorkerErrorFor('soljson-v0.6.5+commit.f956cc89.js')
+ .noWorkerErrorFor('soljson-v0.6.8-nightly.2020.5.14+commit.a6d0067b.js')
+ .noWorkerErrorFor('soljson-v0.6.0-nightly.2019.12.17+commit.d13438ee.js')
+ .noWorkerErrorFor('soljson-v0.4.26+commit.4563c3fc.js')
+ .execute(function() {
+ const elem = document.getElementById('nightlies') as HTMLInputElement
+
+ elem.checked = false
+ })
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts
new file mode 100644
index 0000000000..ecd87bd9c0
--- /dev/null
+++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts
@@ -0,0 +1,20 @@
+'use strict'
+import { NightwatchBrowser } from 'nightwatch'
+import init from '../helpers/init'
+import sauce from './sauce'
+
+module.exports = {
+ before: function (browser: NightwatchBrowser, done: VoidFunction) {
+ init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false)
+ },
+
+ 'CheckSolidityActivatedAndUDapp': function (browser: NightwatchBrowser) {
+ browser
+ .waitForElementVisible('#icon-panel', 10000)
+ .clickLaunchIcon('solidity')
+ .clickLaunchIcon('udapp')
+ .end()
+ },
+
+ tearDown: sauce
+}
diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts
new file mode 100644
index 0000000000..d8ed811bc9
--- /dev/null
+++ b/apps/remix-ide-e2e/src/types/index.d.ts
@@ -0,0 +1,84 @@
+// Merge custom command types with nightwatch types
+
+import { NightwatchBrowser, NightwatchBrowser, NightwatchBrowser } from "nightwatch";
+
+declare module "nightwatch" {
+ export interface NightwatchCustomCommands {
+ clickLaunchIcon(icon: string): NightwatchBrowser,
+ switchBrowserTab(index: number): NightwatchBrowser,
+ scrollAndClick(target: string): NightwatchBrowser,
+ scrollInto(target: string): NightwatchBrowser,
+ testContracts(fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[]): NightwatchBrowser,
+ setEditorValue(value: string, callback?: () => void): NightwatchBrowser,
+ addFile(name: string, content: NightwatchContractContent): NightwatchBrowser,
+ verifyContracts(compiledContractNames: string[], opts?: { wait: number, version?: string }): NightwatchBrowser,
+ selectAccount(account?: string): NightwatchBrowser,
+ clickFunction(fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser,
+ testFunction(txHash: string, expectedInput: NightwatchTestFunctionExpectedInput): NightwatchBrowser,
+ goToVMTraceStep(step: number, incr?: number): NightwatchBrowser,
+ checkVariableDebug(id: string, debugValue: NightwatchCheckVariableDebugValue): NightwatchBrowser,
+ addAtAddressInstance(address: string, isValidFormat: boolean, isValidChecksum: boolean): NightwatchBrowser,
+ modalFooterOKClick(): NightwatchBrowser,
+ clickInstance(index: number): NightwatchBrowser,
+ journalLastChildIncludes(val: string): NightwatchBrowser,
+ executeScript(script: string): NightwatchBrowser,
+ clearEditableContent(cssSelector: string): NightwatchBrowser,
+ journalChildIncludes(val: string): NightwatchBrowser,
+ debugTransaction(index: number): NightwatchBrowser,
+ checkElementStyle(cssSelector: string, styleProperty: string, expectedResult: string): NightwatchBrowser,
+ openFile(name: string): NightwatchBrowser,
+ editorScroll(direction: 'up' | 'down', numberOfTimes: number): NightwatchBrowser,
+ renameFile(path: string, newFileName: string, renamedPath: string): NightwatchBrowser,
+ rightClick(cssSelector: string): NightwatchBrowser,
+ waitForElementContainsText(id: string, value: string): NightwatchBrowser,
+ getModalBody(callback: (value: string, cb: VoidFunction) => void): NightwatchBrowser,
+ modalFooterCancelClick(): NightwatchBrowser,
+ selectContract(contractName: string): NightwatchBrowser,
+ createContract(inputParams: string): NightwatchBrowser,
+ getAddressAtPosition(index: number, cb: (pos: string) => void): NightwatchBrowser,
+ testConstantFunction(address: string, fnFullName: string, expectedInput: NightwatchTestConstantFunctionExpectedInput | null, expectedOutput: string): NightwatchBrowser,
+ getEditorValue(callback: (content: string) => void): NightwatchBrowser,
+ getInstalledPlugins(cb: (plugins: string[]) => void): NightwatchBrowser,
+ verifyCallReturnValue(address: string, checks: string[]): NightwatchBrowser,
+ testEditorValue(testvalue: string): NightwatchBrowser,
+ removeFile(path: string): NightwatchBrowser,
+ switchBrowserWindow(url: string, windowName: string, cb: (browser: NightwatchBrowser, window?: NightwatchCallbackResult) => void): NightwatchBrowser,
+ setupMetamask(passphrase: string, password: string): NightwatchBrowser,
+ signMessage(msg: string, callback: (hash: { value: string }, signature: { value: string }) => void): NightwatchBrowser,
+ setSolidityCompilerVersion(version: string): NightwatchBrowser,
+ clickElementAtPosition(cssSelector: string, index: number): NightwatchBrowser,
+ notContainsText(cssSelector: string, text: string): NightwatchBrowser,
+ sendLowLevelTx(address: string, value: string, callData: string): NightwatchBrowser,
+ journalLastChild(val: string): NightwatchBrowser,
+ checkTerminalFilter(filter: string, test: string): NightwatchBrowser,
+ noWorkerErrorFor(version: string): NightwatchBrowser
+ }
+
+ export interface NightwatchBrowser {
+ api: this,
+ emit: (status: string) => void,
+ fullscreenWindow: (result?: any) => this,
+ keys(keysToSend: string, callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void): NightwatchBrowser,
+ sendKeys: (selector: string, inputValue: string | string[], callback?: (this: NightwatchAPI, result: NightwatchCallbackResult) => void) => NightwatchBrowser
+ }
+
+ export interface NightwatchContractContent {
+ content: string;
+ }
+
+ export interface NightwatchClickFunctionExpectedInput {
+ types: string,
+ values: string
+ }
+
+ export interface NightwatchTestFunctionExpectedInput {
+ [key: string]: any
+ }
+
+ export interface NightwatchTestConstantFunctionExpectedInput {
+ types: string,
+ values: string
+ }
+
+ export type NightwatchCheckVariableDebugValue = NightwatchTestFunctionExpectedInput
+}
\ No newline at end of file
diff --git a/apps/remix-ide-e2e/tsconfig.e2e.json b/apps/remix-ide-e2e/tsconfig.e2e.json
new file mode 100644
index 0000000000..b8f2aef1cd
--- /dev/null
+++ b/apps/remix-ide-e2e/tsconfig.e2e.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "sourceMap": false,
+ "outDir": "../../dist",
+ "allowJs": true
+ },
+ "include": ["**/*.ts", "**/*.js"]
+}
\ No newline at end of file
diff --git a/apps/remix-ide-e2e/tsconfig.json b/apps/remix-ide-e2e/tsconfig.json
new file mode 100644
index 0000000000..a26c03d891
--- /dev/null
+++ b/apps/remix-ide-e2e/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "types": ["node", "nightwatch"],
+ "esModuleInterop": true
+ },
+ "include": ["**/*.ts", "**/*.js"]
+}
+
\ No newline at end of file
diff --git a/apps/remix-ide/.babelrc b/apps/remix-ide/.babelrc
new file mode 100644
index 0000000000..1320b9a327
--- /dev/null
+++ b/apps/remix-ide/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": ["@babel/preset-env"]
+}
diff --git a/apps/remix-ide/.dockerignore b/apps/remix-ide/.dockerignore
new file mode 100644
index 0000000000..3c3629e647
--- /dev/null
+++ b/apps/remix-ide/.dockerignore
@@ -0,0 +1 @@
+node_modules
diff --git a/apps/remix-ide/.env b/apps/remix-ide/.env
new file mode 100644
index 0000000000..c03ce830c2
--- /dev/null
+++ b/apps/remix-ide/.env
@@ -0,0 +1,3 @@
+gist_token=
+account_passphrase=
+account_password=
diff --git a/apps/remix-ide/.eslintrc b/apps/remix-ide/.eslintrc
new file mode 100644
index 0000000000..65be87f51f
--- /dev/null
+++ b/apps/remix-ide/.eslintrc
@@ -0,0 +1,29 @@
+{
+ "env": {
+ "browser": true,
+ "es6": true
+ },
+ "extends": "../../.eslintrc",
+ "globals": {
+ "Atomics": "readonly",
+ "SharedArrayBuffer": "readonly"
+ },
+ "parserOptions": {
+ "ecmaVersion": 11,
+ "sourceType": "module"
+ },
+ "rules": {
+ "@typescript-eslint/no-var-requires": "off",
+ "@typescript-eslint/no-empty-function": "off",
+ "@typescript-eslint/explicit-module-boundary-types": "off",
+ "@typescript-eslint/no-this-alias": "off",
+ "no-unused-vars": "off",
+ "no-redeclare": "off",
+ "no-empty": "off",
+ "no-constant-condition": "off",
+ "no-async-promise-executor": "off",
+ "no-useless-catch": "off",
+ "no-extra-semi": "off",
+ "no-undef": "off"
+ }
+}
diff --git a/apps/remix-ide/.gitignore b/apps/remix-ide/.gitignore
new file mode 100644
index 0000000000..14d193ff7b
--- /dev/null
+++ b/apps/remix-ide/.gitignore
@@ -0,0 +1,15 @@
+.idea
+.vscode
+build
+node_modules
+docs/_build
+reports
+soljson.js
+soljson.js.*
+npm-debug.log*
+remix
+.DS_Store
+contracts
+TODO
+.tern-port
+temp_publish_docker
\ No newline at end of file
diff --git a/apps/remix-ide/.npmignore b/apps/remix-ide/.npmignore
new file mode 100644
index 0000000000..00282f7e0c
--- /dev/null
+++ b/apps/remix-ide/.npmignore
@@ -0,0 +1,7 @@
+.vscode
+node_modules
+reports
+npm-debug.log*
+package-lock.json
+remix
+.DS_Store
diff --git a/apps/remix-ide/.nvmrc b/apps/remix-ide/.nvmrc
new file mode 100644
index 0000000000..cc5875fabb
--- /dev/null
+++ b/apps/remix-ide/.nvmrc
@@ -0,0 +1 @@
+v10.15.3
diff --git a/apps/remix-ide/.travis.yml b/apps/remix-ide/.travis.yml
new file mode 100644
index 0000000000..ef1c5da85e
--- /dev/null
+++ b/apps/remix-ide/.travis.yml
@@ -0,0 +1,37 @@
+language: node_js
+node_js:
+ - "9"
+addons:
+ chrome: stable
+language: java
+branches:
+ only:
+ - master
+ - remix_live
+script:
+ - npm install
+ - npm run lint && npm run test && npm run make-mock-compiler && npm run build
+ - wget http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar
+ - wget http://chromedriver.storage.googleapis.com/2.30/chromedriver_linux64.zip
+ - unzip chromedriver_linux64.zip
+ - java -Dwebdriver.chrome.driver="chromedriver" -jar selenium-server-standalone-3.5.3.jar &
+ - ./ci/browser_tests.sh
+deploy:
+ - provider: script
+ script: ci/deploy_from_travis_remix-alpha.sh
+ skip_cleanup: true
+ on:
+ branch: master
+ - provider: script
+ script: ci/deploy_from_travis_remix-live.sh
+ skip_cleanup: true
+ on:
+ branch: remix_live
+env:
+ global:
+ - ENCRYPTION_LABEL2="85f76a180658"
+ - ENCRYPTION_LABEL3="3737d4fd78e9"
+ - COMMIT_AUTHOR_EMAIL="chris@ethereum.org"
+ - COMMIT_AUTHOR="Travis CI"
+ - FILES_TO_PACKAGE="assets background.js build icon.png index.html manifest.json README.md soljson.js"
+cache: false
diff --git a/apps/remix-ide/Dockerfile b/apps/remix-ide/Dockerfile
new file mode 100644
index 0000000000..7bae0b70ac
--- /dev/null
+++ b/apps/remix-ide/Dockerfile
@@ -0,0 +1,6 @@
+FROM nginx:alpine
+WORKDIR /
+
+COPY ./temp_publish_docker/ /usr/share/nginx/html/
+
+EXPOSE 80
diff --git a/apps/remix-ide/Dockerfile.dev b/apps/remix-ide/Dockerfile.dev
new file mode 100644
index 0000000000..f4d6ba5738
--- /dev/null
+++ b/apps/remix-ide/Dockerfile.dev
@@ -0,0 +1,28 @@
+# This dockerfile is to build each branch seperately (for dev purpouses)
+FROM node:10
+# Create Remix user, don't use root!
+# RUN yes | adduser --disabled-password remix && mkdir /app
+# USER remix
+
+# #Now do remix stuff
+# USER remix
+WORKDIR /home/remix
+
+COPY ./ ./
+
+RUN npm ci
+RUN npm run build
+
+FROM nginx:alpine
+WORKDIR /
+
+COPY --from=0 /home/remix/build/ /usr/share/nginx/html/build/
+COPY --from=0 /home/remix/index.html /usr/share/nginx/html/index.html
+COPY --from=0 /home/remix/nginx.conf /etc/nginx/nginx.conf
+COPY --from=0 /home/remix/assets/ /usr/share/nginx/html/assets/
+COPY --from=0 /home/remix/icon.png /usr/share/nginx/html/icon.png
+COPY --from=0 /home/remix/background.js /usr/share/nginx/html/background.js
+COPY --from=0 /home/remix/soljson.js /usr/share/nginx/html/soljson.js
+COPY --from=0 /home/remix/package.json /usr/share/nginx/html/package.json
+
+EXPOSE 80
diff --git a/apps/remix-ide/LICENSE.md b/apps/remix-ide/LICENSE.md
new file mode 100644
index 0000000000..f4f62e644d
--- /dev/null
+++ b/apps/remix-ide/LICENSE.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014, 2015, 2019 the individual contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/apps/remix-ide/README.md b/apps/remix-ide/README.md
new file mode 100644
index 0000000000..77535515cb
--- /dev/null
+++ b/apps/remix-ide/README.md
@@ -0,0 +1,174 @@
+[![CircleCI](https://circleci.com/gh/ethereum/remix-project.svg?style=svg)](https://circleci.com/gh/ethereum/remix-project)
+
+# Remix
+
+Remix is a browser-based compiler and IDE that enables users to build **Ethereum contracts with Solidity language** and to debug transactions.
+
+To try it out, visit [https://remix.ethereum.org](https://remix.ethereum.org).
+
+https://github.com/ethereum/remix-ide/releases also gives others ways to use Remix locally. Please check it out.
+
+Remix consists of many modules and in this repository you will find the Remix IDE (aka. Browser-Solidity).
+
+![Remix screenshot](https://github.com/ethereum/remix-ide/raw/master/remix_screenshot.png)
+
+## Offline Usage
+
+The `gh-pages` branch has always the latest stable build of Remix. It also contains a ZIP file with the entire build. Download it to use offline.
+
+Note: It contains the latest release of Solidity available at the time of the packaging. No other compiler versions are supported.
+
+
+## INSTALLATION:
+
+Install **npm** and **node.js** (see https://docs.npmjs.com/getting-started/installing-node), then do:
+
+Remix-ide has been published as an npm module:
+
+```bash
+npm install remix-ide -g
+remix-ide
+```
+Or if you want to clone the github repository (`wget` need to be installed first) :
+
+```bash
+git clone https://github.com/ethereum/remix-ide.git
+git clone https://github.com/ethereum/remix.git # only if you plan to link remix and remix-ide repositories and develop on it.
+
+cd remix # only if you plan to link remix and remix-ide repositories and develop on it.
+npm install # only if you plan to link remix and remix-ide repositories and develop on it.
+npm run bootstrap # only if you plan to link remix and remix-ide repositories and develop on it.
+
+cd remix-ide
+npm install
+npm run setupremix # only if you plan to link remix and remix-ide repositories and develop on it.
+npm start
+```
+
+## Docker:
+
+Prerequisites:
+* Docker (https://docs.docker.com/desktop/)
+* Docker-compose (https://docs.docker.com/compose/install/)
+
+### Run with docker
+
+If you want to run latest changes that are merged into master branch then run:
+
+```
+docker pull remixproject/remix-ide:latest
+docker run -p 8080:80 remixproject/remix-ide:latest
+```
+
+If you want to run latest remix-live release run.
+```
+docker pull remixproject/remix-ide:remix_live
+docker run -p 8080:80 remixproject/remix-ide:remix_live
+```
+
+### Run with docker-compose:
+
+To run locally without building you only need docker-compose.yaml file and you can run:
+
+```
+docker-compose pull
+docker-compose up -d
+```
+
+Then go to http://localhost:8080 and you can use you Remix instance.
+
+To fetch docker-compose file without cloning this repo run:
+```
+curl https://raw.githubusercontent.com/ethereum/remix-ide/master/docker-compose.yaml > docker-compose.yaml
+```
+
+## DEVELOPING:
+
+Run `npm start` and open `http://127.0.0.1:8080` in your browser.
+
+Then open your `text editor` and start developing.
+The browser will automatically refresh when files are saved.
+
+Most of the the time working with other modules (like debugger etc.) hosted in the [Remix repository](https://github.com/ethereum/remix) is not needed.
+
+### Troubleshooting building
+
+Some things to consider if you have trouble building the package:
+
+- Make sure that you have the correct version of `node`, `npm` and `nvm`. You can find the version that is tested on Travis CI by looking at the log in the [build results](https://travis-ci.org/ethereum/remix-ide).
+
+Run:
+
+```bash
+node --version
+npm --version
+nvm --version
+```
+
+- In Debian based OS such as Ubuntu 14.04LTS you may need to run `apt-get install build-essential`. After installing `build-essential` run `npm rebuild`.
+
+## Unit Testing
+
+Register new unit test files in `test/index.js`.
+The tests are written using [tape](https://www.npmjs.com/package/tape).
+
+Run the unit tests via: `npm test`
+
+For local headless browser tests run `npm run test-browser`
+(requires Selenium to be installed - can be done with `npm run selenium-install`)
+
+Running unit tests via `npm test` requires at least node v7.0.0
+
+## Browser Testing
+
+To run the Selenium tests via Nightwatch:
+
+ - Build Remix IDE and serve it: `npm run build && npm run serve` # starts web server at localhost:8080
+ - Make sure Selenium is installed `npm run selenium-install` # don't need to repeat
+ - Run a selenium server `npm run selenium`
+ - Run all the tests `npm run nightwatch_local_firefox` or `npm run nightwatch_local_chrome`
+ - Or run a specific test case:
+
+ - npm run nightwatch_local_ballot
+
+ - npm run nightwatch_local_libraryDeployment
+
+ - npm run nightwatch_local_solidityImport
+
+ - npm run nightwatch_local_recorder
+
+ - npm run nightwatch_local_transactionExecution
+
+ - npm run nightwatch_local_staticAnalysis
+
+ - npm run nightwatch_local_signingMessage
+
+ - npm run nightwatch_local_console
+
+ - npm run nightwatch_local_remixd # remixd needs to be run
+**NOTE:**
+
+- **the `ballot` tests suite** requires to run `ganache-cli` locally.
+
+- **the `remixd` tests suite** requires to run `remixd` locally.
+
+- **the `gist` tests suite** requires specifying a github access token in **.env file**.
+```
+ gist_token =
+```
+**note that this token should have permission to create a gist.**
+
+
+## Usage as a Chrome Extension
+
+If you would like to use this as a Chrome extension, you must either build it first or pull from the `gh-pages` branch, both described above.
+After that, follow these steps:
+
+- Browse to `chrome://extensions/`
+- Make sure 'Developer mode' has been checked
+- Click 'Load unpacked extension...' to pop up a file-selection dialog
+- Select your `remix-ide` folder
+
+## Documentation
+
+To see details about how to use Remix for developing and/or debugging Solidity contracts, please see [our documentation page](https://remix-ide.readthedocs.io/en/latest/)
diff --git a/apps/remix-ide/_config.yml b/apps/remix-ide/_config.yml
new file mode 100644
index 0000000000..c4192631f2
--- /dev/null
+++ b/apps/remix-ide/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-cayman
\ No newline at end of file
diff --git a/apps/remix-ide/background.js b/apps/remix-ide/background.js
new file mode 100644
index 0000000000..8b9269f940
--- /dev/null
+++ b/apps/remix-ide/background.js
@@ -0,0 +1,10 @@
+/* global chrome */
+'use strict'
+
+chrome.browserAction.onClicked.addListener(function (tab) {
+ chrome.storage.sync.set({ 'chrome-app-sync': true })
+
+ chrome.tabs.create({ 'url': chrome.extension.getURL('index.html') }, function (tab) {
+ // tab opened
+ })
+})
diff --git a/apps/remix-ide/best-practices.md b/apps/remix-ide/best-practices.md
new file mode 100644
index 0000000000..915759a054
--- /dev/null
+++ b/apps/remix-ide/best-practices.md
@@ -0,0 +1,153 @@
+# Current "Best Practice" Conventions
+
+
+- Please use [JS Standard Style](https://standardjs.com/) as a coding style guide.
+- `ES6 class` rather than ES5 to create class.
+- CSS declaration using `csjs-inject`.
+- CSS files:
+
+ **if** the CSS section of an UI component is too important, CSS declarations should be put in a different file and in a different folder.
+
+ The folder should be named `styles` and the file should be named with the extension `-styles.css`.
+
+ e.g: `file-explorer.js` being an UI component `file-explorer-styles.css` is created in the `styles` folder right under `file-explorer.js`
+
+ **if** the CSS section of an UI component is rather limited it is preferable to put it in the corresponding JS file.
+
+- HTML declaration using `yo-yo`.
+
+- A module trigger events using `event` property:
+ `self.event = new EventManager()`.
+ Events can then be triggered:
+ `self.event.trigger('eventName', [param1, param2])`
+- `self._view` is the HTML view renderered by `yo-yo` in the `render` function.
+- `render()` this function should be called at the first rendering (make sure that the returned node element is put on the DOM), and should *not* by called again from outside the component.
+- `update()` call this function to update the DOM when the state of the component has changed (this function must be called after the initial call to `render()`).
+- for all functions / properties, prefixing by underscore (`_`) means the scope is private, and they should **not** be accessed not changed from outside the component.
+- constructor arguments: There is no fixed rule whether it is preferrable to use multiples arguments or a single option *{}* argument (or both).
+ We recommend:
+ - use a specific slot for **obligatory** arguments and/or for complex arguments (meaning not boolean, not string, etc...).
+ - put arguments in an option *{}* for non critical and for optionnal arguments.
+ - if a component has more than 4/5 parameters, it is recommended to find a way to group some in one or more *opt* arguments.
+
+- look them up, discuss them, update them.
+
+## Module Definition (example)
+```js
+// user-card.js
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+var EventManager = require('remix-lib').EventManager
+
+var css = csjs`
+ .userCard {
+ position : relative;
+ box-sizing : border-box;
+ display : flex;
+ flex-direction : column;
+ align-items : center;
+ border : 1px solid black;
+ width : 400px;
+ padding : 50px;
+ }
+ .clearFunds { background-color: lightblue; }
+`
+
+class UserCard {
+ constructor (api, events, opts = {}) {
+ var self = this
+
+ self.event = new EventManager()
+ self.opts = opts
+ self._api = api
+ self._consumedEvents = events
+ self._view = undefined
+
+ events.funds.register('fundsChanged', function (amount) {
+ if (amount < self.state._funds) self.state.totalSpend += self.state._funds - amount
+ self.state._funds = amount
+ self.render()
+ })
+ self.event.trigger('eventName', [param1, param2])
+ }
+ render () {
+ var self = this
+ var view = yo`
+
+
@${self.state._nickname}
+
Welcome, ${self.state.title || ''} ${self.state.name || 'anonymous'} ${self.state.surname}
+
User Funds: $${self.state._funds}
+
Spent Funds: $${self.state.totalSpend}
+
self._spendAll.call(self, e)}> spend all funds
+
+ `
+ if (!self._view) {
+ self._view = view
+ }
+ return self._view
+ }
+ update () {
+ yo.update(this._view, this.render())
+ }
+ setNickname (name) {
+ this._nickname = name
+ }
+ getNickname () {
+ var self = this
+ return `@${self.state._nickname}`
+ }
+ getFullName () {
+ var self = this
+ return `${self.state.title} ${self.state.name} ${self.state.surname}`
+ }
+ _spendAll (event) {
+ var self = this
+ self._appAPI.clearUserFunds()
+ }
+ _constraint (msg) { throw new Error(msg) }
+}
+
+module.exports = UserCard
+```
+## Module Usage (example)
+```js
+/*****************************************************************************/
+// 1. SETUP CONTEXT
+var EventManager = require('remix-lib').EventManager
+var funds = { event: new EventManager() }
+var userfunds = 15
+function getUserFunds () { return userfunds }
+function clearUserFunds () {
+ var spent = userfunds
+ userfunds = 0
+ console.log(`all funds of ${usercard.getFullName()} were spent.`)
+ funds.event.trigger('fundsChanged', [userfunds])
+ return spent
+}
+setInterval(function () {
+ userfunds++
+ funds.event.trigger('fundsChanged', [userfunds])
+}, 100)
+
+/*****************************************************************************/
+// 2. EXAMPLE USAGE
+var UserCard = require('./user-card')
+
+var usercard = new UserCard(
+ { getUserFunds, clearUserFunds },
+ { funds: funds.event },
+ {
+ title: 'Dr.',
+ name: 'John',
+ surname: 'Doe',
+ nickname: 'johndoe99'
+ })
+
+var el = usercard.render()
+document.body.appendChild(el)
+setTimeout(function () {
+ userCard.setNickname('new name')
+ usercard.update()
+}, 5000)
+
+```
diff --git a/apps/remix-ide/bin/remix-ide b/apps/remix-ide/bin/remix-ide
new file mode 100755
index 0000000000..887bab51fa
--- /dev/null
+++ b/apps/remix-ide/bin/remix-ide
@@ -0,0 +1,21 @@
+#!/usr/bin/env node
+var path = require('path')
+var httpServer = require('http-server')
+var remixd = require('remixd')
+
+var server = httpServer.createServer({
+ root: path.join(__dirname, '/../')
+})
+
+var folder = process.argv.length > 2 ? process.argv[2] : process.cwd()
+
+server.listen(8080, '127.0.0.1', function () {})
+var router = new remixd.Router(65520, remixd.services.sharedFolder, { remixIdeUrl: 'http://localhost:8080' }, (webSocket) => {
+ remixd.services.sharedFolder.setWebSocket(webSocket)
+ remixd.services.sharedFolder.setupNotifications(folder)
+ remixd.services.sharedFolder.sharedFolder(folder, false)
+})
+
+router.start()
+
+console.log('\x1b[33m%s\x1b[0m', 'Starting Remix IDE at http://localhost:8080 and sharing ' + folder)
diff --git a/apps/remix-ide/build.yaml b/apps/remix-ide/build.yaml
new file mode 100644
index 0000000000..599cbfd8f5
--- /dev/null
+++ b/apps/remix-ide/build.yaml
@@ -0,0 +1,15 @@
+version: "3.7"
+x-project-base:
+ &project-base
+ restart: always
+ networks:
+ - remixide
+
+networks:
+ remixide:
+
+services:
+ remixide:
+ build:
+ context: .
+ dockerfile: Dockerfile
diff --git a/apps/remix-ide/ci/browser_tests.sh b/apps/remix-ide/ci/browser_tests.sh
new file mode 100755
index 0000000000..1e3012feb4
--- /dev/null
+++ b/apps/remix-ide/ci/browser_tests.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+set -e
+
+setupRemixd () {
+ mkdir remixdSharedfolder
+ cd apps/remix-ide/contracts
+ echo 'sharing folder: '
+ echo $PWD
+ ../../../node_modules/.bin/remixd -s $PWD --remix-ide http://127.0.0.1:8080 &
+ cd ../../..
+}
+
+BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
+echo "$BUILD_ID"
+TEST_EXITCODE=0
+
+npm run ganache-cli &
+npm run serve &
+setupRemixd
+
+sleep 5
+
+npm run nightwatch_parallel || TEST_EXITCODE=1
+TESTFILES=$(circleci tests glob "./apps/remix-ide/test-browser/tests/**/*.test.js" | circleci tests split --split-by=timings)
+for TESTFILE in $TESTFILES; do
+ ./node_modules/.bin/nightwatch --config ./apps/remix-ide/nightwatch.js --env chrome $TESTFILE || TEST_EXITCODE=1
+done
+
+echo "$TEST_EXITCODE"
+if [ "$TEST_EXITCODE" -eq 1 ]
+then
+ exit 1
+fi
diff --git a/apps/remix-ide/ci/browser_tests_chrome.sh b/apps/remix-ide/ci/browser_tests_chrome.sh
new file mode 100755
index 0000000000..6a15f1207c
--- /dev/null
+++ b/apps/remix-ide/ci/browser_tests_chrome.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+set -e
+
+setupRemixd () {
+ mkdir remixdSharedfolder
+ cd apps/remix-ide/contracts
+ echo 'sharing folder: '
+ echo $PWD
+ ../../../node_modules/.bin/remixd -s $PWD --remix-ide http://127.0.0.1:8080 &
+ cd ../../..
+}
+
+BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
+echo "$BUILD_ID"
+TEST_EXITCODE=0
+
+npm run ganache-cli &
+npm run serve &
+setupRemixd
+
+sleep 5
+
+npx nx build remix-ide-e2e
+
+TESTFILES=$(circleci tests glob "dist/apps/remix-ide-e2e/src/tests/**/*.test.js" | circleci tests split --split-by=timings)
+for TESTFILE in $TESTFILES; do
+ npx nx e2e remix-ide-e2e --filePath=$TESTFILE --env=chrome || TEST_EXITCODE=1
+done
+
+echo "$TEST_EXITCODE"
+if [ "$TEST_EXITCODE" -eq 1 ]
+then
+ exit 1
+fi
diff --git a/apps/remix-ide/ci/browser_tests_firefox.sh b/apps/remix-ide/ci/browser_tests_firefox.sh
new file mode 100755
index 0000000000..d2058c1afb
--- /dev/null
+++ b/apps/remix-ide/ci/browser_tests_firefox.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+set -e
+
+setupRemixd () {
+ mkdir remixdSharedfolder
+ cd apps/remix-ide/contracts
+ echo 'sharing folder: '
+ echo $PWD
+ ../../../node_modules/.bin/remixd -s $PWD --remix-ide http://127.0.0.1:8080 &
+ cd ../../..
+}
+
+BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
+echo "$BUILD_ID"
+TEST_EXITCODE=0
+
+npm run ganache-cli &
+npm run serve &
+setupRemixd
+
+sleep 5
+
+npx nx build remix-ide-e2e
+
+TESTFILES=$(circleci tests glob "dist/apps/remix-ide-e2e/src/tests/**/*.test.js" | circleci tests split --split-by=timings)
+for TESTFILE in $TESTFILES; do
+ npx nx e2e remix-ide-e2e --filePath=$TESTFILE --env=firefox || TEST_EXITCODE=1
+done
+
+echo "$TEST_EXITCODE"
+if [ "$TEST_EXITCODE" -eq 1 ]
+then
+ exit 1
+fi
diff --git a/apps/remix-ide/ci/browser_tests_run_deploy.sh b/apps/remix-ide/ci/browser_tests_run_deploy.sh
new file mode 100755
index 0000000000..38ec439873
--- /dev/null
+++ b/apps/remix-ide/ci/browser_tests_run_deploy.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -e
+
+setupRemixd () {
+ mkdir remixdSharedfolder
+ cd apps/remix-ide/contracts
+ echo 'sharing folder: '
+ echo $PWD
+ ../../../node_modules/.bin/remixd -s $PWD --remix-ide http://127.0.0.1:8080 &
+ cd ../../..
+}
+
+BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
+echo "$BUILD_ID"
+TEST_EXITCODE=0
+
+npm run ganache-cli &
+npm run serve &
+setupRemixd
+
+sleep 5
+
+npx nx build remix-ide-e2e
+npm run nightwatch_local_runAndDeploy || TEST_EXITCODE=1
+
+echo "$TEST_EXITCODE"
+if [ "$TEST_EXITCODE" -eq 1 ]
+then
+ exit 1
+fi
diff --git a/apps/remix-ide/ci/build_and_publish_docker_images.sh b/apps/remix-ide/ci/build_and_publish_docker_images.sh
new file mode 100755
index 0000000000..249e259952
--- /dev/null
+++ b/apps/remix-ide/ci/build_and_publish_docker_images.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+set -e
+
+export TAG="$CIRCLE_BRANCH"
+
+if [ "$CIRCLE_BRANCH" == "master" ]; then
+ export TAG="latest";
+fi
+
+rm -rf temp_publish_docker
+mkdir temp_publish_docker
+cp -r $FILES_TO_PACKAGE temp_publish_docker
+ls
+
+docker login --username $DOCKER_USER --password $DOCKER_PASS
+docker-compose -f docker-compose.yaml -f build.yaml build
+docker push remixproject/remix-ide:$TAG
diff --git a/apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh b/apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh
new file mode 100755
index 0000000000..cdfd301afc
--- /dev/null
+++ b/apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -e
+
+SHA=`git rev-parse --short --verify HEAD`
+
+git config user.name "$COMMIT_AUTHOR"
+git config user.email "$COMMIT_AUTHOR_EMAIL"
+git checkout --orphan gh-pages
+git rm --cached -r -f .
+echo "# Automatic build" > README.md
+echo "Built website from \`$SHA\`. See https://github.com/ethereum/remix-ide/ for details." >> README.md
+echo "To use an offline copy, download \`remix-$SHA.zip\`." >> README.md
+cp -r $FILES_TO_PACKAGE "./"
+rm -rf dist
+ls
+FILES_TO_DEPLOY="assets index.html main.js polyfills.js runtime.js vendor.js favicon.ico"
+# ZIP the whole directory
+zip -r remix-$SHA.zip $FILES_TO_DEPLOY
+# -f is needed because "build" is part of .gitignore
+git add -f $FILES_TO_DEPLOY remix-$SHA.zip
+git commit -m "Built website from {$SHA}."
+
+git push -f git@github.com:ethereum/remix-live-alpha.git gh-pages
diff --git a/apps/remix-ide/ci/deploy_from_travis_remix-live.sh b/apps/remix-ide/ci/deploy_from_travis_remix-live.sh
new file mode 100755
index 0000000000..88973a9ab1
--- /dev/null
+++ b/apps/remix-ide/ci/deploy_from_travis_remix-live.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+SHA=`git rev-parse --short --verify HEAD`
+
+git config user.name "$COMMIT_AUTHOR"
+git config user.email "$COMMIT_AUTHOR_EMAIL"
+git checkout --orphan gh-pages
+git rm --cached -r -f .
+echo "# Automatic build" > README.md
+echo "Built website from \`$SHA\`. See https://github.com/ethereum/remix-ide/ for details." >> README.md
+echo "To use an offline copy, download \`remix-$SHA.zip\`." >> README.md
+cp -r $FILES_TO_PACKAGE "./"
+rm -rf dist
+FILES_TO_DEPLOY="assets index.html main.js polyfills.js runtime.js vendor.js"
+# ZIP the whole directory
+zip -r remix-$SHA.zip $FILES_TO_DEPLOY
+# -f is needed because "build" is part of .gitignore
+git add -f $FILES_TO_DEPLOY remix-$SHA.zip
+git commit -m "Built website from {$SHA}."
+
+git push -f git@github.com:ethereum/remix-live.git gh-pages
diff --git a/apps/remix-ide/ci/deploy_key_remix-live-alpha.enc b/apps/remix-ide/ci/deploy_key_remix-live-alpha.enc
new file mode 100644
index 0000000000..db21779a32
Binary files /dev/null and b/apps/remix-ide/ci/deploy_key_remix-live-alpha.enc differ
diff --git a/apps/remix-ide/ci/deploy_key_remix-live.enc b/apps/remix-ide/ci/deploy_key_remix-live.enc
new file mode 100644
index 0000000000..03806ec834
Binary files /dev/null and b/apps/remix-ide/ci/deploy_key_remix-live.enc differ
diff --git a/apps/remix-ide/ci/makeMockCompiler.js b/apps/remix-ide/ci/makeMockCompiler.js
new file mode 100644
index 0000000000..5ad561ede7
--- /dev/null
+++ b/apps/remix-ide/ci/makeMockCompiler.js
@@ -0,0 +1,88 @@
+'use strict'
+
+var fs = require('fs')
+var compiler = require('solc')
+var compilerInput = require('@remix-project/remix-solidity').CompilerInput
+var defaultVersion = 'v0.6.6+commit.6c089d02'
+const path = require('path')
+
+compiler.loadRemoteVersion(defaultVersion, (error, solcSnapshot) => {
+ console.log('solcSnapshot: ', solcSnapshot)
+ if (error) console.log(error)
+ var compilationResult = {}
+ const testsFolder = path.resolve(__dirname + '/../test-browser/tests/') + '/' // eslint-disable-line
+
+ gatherCompilationResults(testsFolder, compilationResult, solcSnapshot)
+ replaceSolCompiler(compilationResult, solcSnapshot)
+})
+
+function gatherCompilationResults (dir, compilationResult, solcSnapshot) {
+ var filenames = fs.readdirSync(dir, 'utf8')
+ filenames.map(function (item, i) {
+ if (item.endsWith('.js')) {
+ var testDef = require(dir + item)
+ if ('@sources' in testDef) {
+ var sources = testDef['@sources']()
+ for (var files in sources) {
+ compile(solcSnapshot, sources[files], true, function (result) {
+ compilationResult[result.key] = result
+ })
+ compile(solcSnapshot, sources[files], false, function (result) {
+ compilationResult[result.key] = result
+ })
+ }
+ }
+ }
+ })
+ return compilationResult
+}
+
+function compile (solcSnapshot, source, optimization, addCompilationResult) {
+ var missingInputs = []
+ try {
+ var input = compilerInput(source, {optimize: optimization})
+ var result = solcSnapshot.compileStandardWrapper(input, function (path) {
+ missingInputs.push(path)
+ })
+ input = input.replace(/(\t)|(\n)|(\\n)|( )/g, '')
+ } catch (e) {
+ console.log(e)
+ }
+ if (result && (result.error || (result.errors && result.errors.length > 0))) {
+ console.log(result.error, result.errors)
+ }
+ if (result) {
+ console.log(result.error, result.errors)
+ }
+ var ret = {
+ key: input,
+ source: source,
+ optimization: optimization,
+ missingInputs: missingInputs,
+ result: result
+ }
+ addCompilationResult(ret)
+}
+
+function replaceSolCompiler (results, solcSnapshot) {
+ const compilerPath = path.resolve(__dirname + '/../test-browser/mockcompiler/compiler.js') // eslint-disable-line
+ const soljsonPath = path.resolve(__dirname + '/../soljson.js') // eslint-disable-line
+
+ fs.readFile(compilerPath, 'utf8', function (error, data) {
+ if (error) {
+ console.log(error)
+ process.exit(1)
+ return
+ }
+ console.log(solcSnapshot.version())
+ data = data + '\n\nvar mockCompilerVersion = \'' + solcSnapshot.version() + '\''
+ data = data + '\n\nvar mockData = ' + JSON.stringify(results) + ';\n'
+ fs.writeFile(soljsonPath, data, 'utf8', function (error) {
+ if (error) {
+ console.log(error)
+ process.exit(1)
+ return
+ }
+ })
+ })
+}
diff --git a/apps/remix-ide/ci/publishIpfs b/apps/remix-ide/ci/publishIpfs
new file mode 100755
index 0000000000..c56a5f37bf
--- /dev/null
+++ b/apps/remix-ide/ci/publishIpfs
@@ -0,0 +1,20 @@
+#!/usr/bin/env node
+
+const IpfsHttpClient = require('ipfs-http-client')
+const { globSource } = IpfsHttpClient
+console.log('current folder', process.cwd())
+const folder = process.cwd() + '/temp_publish_docker';
+
+(async () => {
+ const host = 'ipfs.komputing.org' // ethdev berlin ipfs node
+ const ipfs = IpfsHttpClient({ host, port: 443, protocol: 'https' })
+ try {
+ let result = await ipfs.add(globSource(folder, { recursive: true}), { pin: false })
+ const hash = result.cid.toString()
+ console.log('ipfs://' + hash)
+ console.log('https://ipfsgw.komputing.org/ipfs/' + hash)
+ console.log('https://gateway.ipfs.io/ipfs/' + hash)
+ } catch (e) {
+ console.log(e)
+ }
+})()
diff --git a/apps/remix-ide/ci/sauceDisconnect.js b/apps/remix-ide/ci/sauceDisconnect.js
new file mode 100644
index 0000000000..4490a58638
--- /dev/null
+++ b/apps/remix-ide/ci/sauceDisconnect.js
@@ -0,0 +1,74 @@
+'use strict'
+
+const https = require('https')
+
+var userName = process.argv[2]
+var accessKey = process.argv[3]
+var tunnelName = process.argv[4]
+
+function removeTunnel () {
+ const requestPath = `/rest/v1/${userName}/tunnels`
+ console.log(requestPath)
+ callSauce(requestPath, 'GET', function (error, result) {
+ if (error) {
+ console.log(error)
+ } else {
+ var data = JSON.parse(result)
+ for (var k in data) {
+ retrieveTunnel(data[k], function (error, result) {
+ if (error) {
+ console.log(error)
+ } else if (result.identtifier === tunnelName) {
+ deleteTunnel(result.id, function () {
+ console.log('tunnel deleted ' + data[k] + ' ' + tunnelName)
+ })
+ }
+ })
+ }
+ }
+ })
+}
+
+function retrieveTunnel (tunnelid, callback) {
+ const requestPath = `/rest/v1/${userName}/tunnels/${tunnelid}`
+ callSauce(requestPath, 'GET', function (error, result) {
+ if (error) {
+ callback(error)
+ } else {
+ callback(null, {'identtifier': JSON.parse(result).tunnel_identifier, 'id': tunnelid})
+ }
+ })
+}
+
+function deleteTunnel (tunnelid, callback) {
+ const requestPath = `/rest/v1/${userName}/tunnels/${tunnelid}`
+ callSauce(requestPath, 'DELETE', callback)
+}
+
+function callSauce (requestPath, type, callback) {
+ function responseCallback (res) {
+ res.setEncoding('utf8')
+ console.log('Response: ', res.statusCode, JSON.stringify(res.headers))
+ res.on('data', function onData (chunk) {
+ console.log('BODY: ' + chunk)
+ callback(null, chunk)
+ })
+ res.on('end', function onEnd () {})
+ }
+
+ var req = https.request({
+ hostname: 'saucelabs.com',
+ path: requestPath,
+ method: type,
+ auth: userName + ':' + accessKey
+ }, responseCallback)
+
+ req.on('error', function onError (e) {
+ console.log('problem with request: ' + e.message)
+ callback(e.message)
+ })
+ req.write('')
+ req.end()
+}
+
+removeTunnel()
diff --git a/apps/remix-ide/contracts/app/ethereum/constitution.sol b/apps/remix-ide/contracts/app/ethereum/constitution.sol
new file mode 100644
index 0000000000..8c2c9e0da9
--- /dev/null
+++ b/apps/remix-ide/contracts/app/ethereum/constitution.sol
@@ -0,0 +1,6 @@
+contract Constitution {
+
+ function Found(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/app/solidity/mode.sol b/apps/remix-ide/contracts/app/solidity/mode.sol
new file mode 100644
index 0000000000..6027379cfe
--- /dev/null
+++ b/apps/remix-ide/contracts/app/solidity/mode.sol
@@ -0,0 +1,6 @@
+contract Mode {
+
+ function Normal(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/ballot.sol b/apps/remix-ide/contracts/ballot.sol
new file mode 100644
index 0000000000..d55734ed9a
--- /dev/null
+++ b/apps/remix-ide/contracts/ballot.sol
@@ -0,0 +1,143 @@
+pragma solidity ^0.4.0;
+
+/// @title Voting with delegation.
+contract Ballot {
+ // This declares a new complex type which will
+ // be used for variables later.
+ // It will represent a single voter.
+ struct Voter {
+ uint weight; // weight is accumulated by delegation
+ bool voted; // if true, that person already voted
+ address delegate; // person delegated to
+ uint vote; // index of the voted proposal
+ }
+
+ // This is a type for a single proposal.
+ struct Proposal {
+ bytes32 name; // short name (up to 32 bytes)
+ uint voteCount; // number of accumulated votes
+ }
+
+ address public chairperson;
+
+ // This declares a state variable that
+ // stores a \`Voter\` struct for each possible address.
+ mapping(address => Voter) public voters;
+
+ // A dynamically-sized array of \`Proposal\` structs.
+ Proposal[] public proposals;
+
+ /// Create a new ballot to choose one of \`proposalNames\`.
+ function Ballot(bytes32[] proposalNames) {
+ chairperson = msg.sender;
+ voters[chairperson].weight = 1;
+
+ // For each of the provided proposal names,
+ // create a new proposal object and add it
+ // to the end of the array.
+ for (uint i = 0; i < proposalNames.length; i++) {
+ // \`Proposal({...})\` creates a temporary
+ // Proposal object and \`proposals.push(...)\`
+ // appends it to the end of \`proposals\`.
+ proposals.push(Proposal({
+ name: proposalNames[i],
+ voteCount: 0
+ }));
+ }
+ }
+
+ // Give \`voter\` the right to vote on this ballot.
+ // May only be called by \`chairperson\`.
+ function giveRightToVote(address voter) {
+ if (msg.sender != chairperson || voters[voter].voted) {
+ // \`throw\` terminates and reverts all changes to
+ // the state and to Ether balances. It is often
+ // a good idea to use this if functions are
+ // called incorrectly. But watch out, this
+ // will also consume all provided gas.
+ throw;
+ }
+ voters[voter].weight = 1;
+ }
+
+ /// Delegate your vote to the voter \`to\`.
+ function delegate(address to) {
+ // assigns reference
+ Voter sender = voters[msg.sender];
+ if (sender.voted)
+ throw;
+
+ // Forward the delegation as long as
+ // \`to\` also delegated.
+ // In general, such loops are very dangerous,
+ // because if they run too long, they might
+ // need more gas than is available in a block.
+ // In this case, the delegation will not be executed,
+ // but in other situations, such loops might
+ // cause a contract to get "stuck" completely.
+ while (
+ voters[to].delegate != address(0) &&
+ voters[to].delegate != msg.sender
+ ) {
+ to = voters[to].delegate;
+ }
+
+ // We found a loop in the delegation, not allowed.
+ if (to == msg.sender) {
+ throw;
+ }
+
+ // Since \`sender\` is a reference, this
+ // modifies \`voters[msg.sender].voted\`
+ sender.voted = true;
+ sender.delegate = to;
+ Voter delegate = voters[to];
+ if (delegate.voted) {
+ // If the delegate already voted,
+ // directly add to the number of votes
+ proposals[delegate.vote].voteCount += sender.weight;
+ } else {
+ // If the delegate did not vote yet,
+ // add to her weight.
+ delegate.weight += sender.weight;
+ }
+ }
+
+ /// Give your vote (including votes delegated to you)
+ /// to proposal \`proposals[proposal].name\`.
+ function vote(uint proposal) {
+ Voter sender = voters[msg.sender];
+ if (sender.voted)
+ throw;
+ sender.voted = true;
+ sender.vote = proposal;
+
+ // If \`proposal\` is out of the range of the array,
+ // this will throw automatically and revert all
+ // changes.
+ proposals[proposal].voteCount += sender.weight;
+ }
+
+ /// @dev Computes the winning proposal taking all
+ /// previous votes into account.
+ function winningProposal() constant
+ returns (uint winningProposal)
+ {
+ uint winningVoteCount = 0;
+ for (uint p = 0; p < proposals.length; p++) {
+ if (proposals[p].voteCount > winningVoteCount) {
+ winningVoteCount = proposals[p].voteCount;
+ winningProposal = p;
+ }
+ }
+ }
+
+ // Calls winningProposal() function to get the index
+ // of the winner contained in the proposals array and then
+ // returns the name of the winner
+ function winnerName() constant
+ returns (bytes32 winnerName)
+ {
+ winnerName = proposals[winningProposal()].name;
+ }
+}
diff --git a/apps/remix-ide/contracts/contract1.sol b/apps/remix-ide/contracts/contract1.sol
new file mode 100644
index 0000000000..4abefc018b
--- /dev/null
+++ b/apps/remix-ide/contracts/contract1.sol
@@ -0,0 +1 @@
+contract test1 { function get () returns (uint) { return 8; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/contract2.sol b/apps/remix-ide/contracts/contract2.sol
new file mode 100644
index 0000000000..96b59660ba
--- /dev/null
+++ b/apps/remix-ide/contracts/contract2.sol
@@ -0,0 +1 @@
+contract test2 { function get () returns (uint) { return 9; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/folder1/contract1.sol b/apps/remix-ide/contracts/folder1/contract1.sol
new file mode 100644
index 0000000000..11122d3008
--- /dev/null
+++ b/apps/remix-ide/contracts/folder1/contract1.sol
@@ -0,0 +1 @@
+contract test1 { function get () returns (uint) { return 10; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/folder1/contract2.sol b/apps/remix-ide/contracts/folder1/contract2.sol
new file mode 100644
index 0000000000..04f9b2eb26
--- /dev/null
+++ b/apps/remix-ide/contracts/folder1/contract2.sol
@@ -0,0 +1 @@
+contract test2 { function get () returns (uint) { return 11; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/folder1/contract_chrome.sol b/apps/remix-ide/contracts/folder1/contract_chrome.sol
new file mode 100644
index 0000000000..04f9b2eb26
--- /dev/null
+++ b/apps/remix-ide/contracts/folder1/contract_chrome.sol
@@ -0,0 +1 @@
+contract test2 { function get () returns (uint) { return 11; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/folder1/contract_chrome_toremove.sol b/apps/remix-ide/contracts/folder1/contract_chrome_toremove.sol
new file mode 100644
index 0000000000..04f9b2eb26
--- /dev/null
+++ b/apps/remix-ide/contracts/folder1/contract_chrome_toremove.sol
@@ -0,0 +1 @@
+contract test2 { function get () returns (uint) { return 11; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/folder1/contract_firefox.sol b/apps/remix-ide/contracts/folder1/contract_firefox.sol
new file mode 100644
index 0000000000..04f9b2eb26
--- /dev/null
+++ b/apps/remix-ide/contracts/folder1/contract_firefox.sol
@@ -0,0 +1 @@
+contract test2 { function get () returns (uint) { return 11; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/folder1/contract_firefox_toremove.sol b/apps/remix-ide/contracts/folder1/contract_firefox_toremove.sol
new file mode 100644
index 0000000000..04f9b2eb26
--- /dev/null
+++ b/apps/remix-ide/contracts/folder1/contract_firefox_toremove.sol
@@ -0,0 +1 @@
+contract test2 { function get () returns (uint) { return 11; }}
\ No newline at end of file
diff --git a/apps/remix-ide/contracts/node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol b/apps/remix-ide/contracts/node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol
new file mode 100644
index 0000000000..e7091fb226
--- /dev/null
+++ b/apps/remix-ide/contracts/node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol
@@ -0,0 +1,156 @@
+pragma solidity ^0.5.0;
+
+/**
+ * @dev Wrappers over Solidity's arithmetic operations with added overflow
+ * checks.
+ *
+ * Arithmetic operations in Solidity wrap on overflow. This can easily result
+ * in bugs, because programmers usually assume that an overflow raises an
+ * error, which is the standard behavior in high level programming languages.
+ * `SafeMath` restores this intuition by reverting the transaction when an
+ * operation overflows.
+ *
+ * Using this library instead of the unchecked operations eliminates an entire
+ * class of bugs, so it's recommended to use it always.
+ */
+library SafeMath {
+ /**
+ * @dev Returns the addition of two unsigned integers, reverting on
+ * overflow.
+ *
+ * Counterpart to Solidity's `+` operator.
+ *
+ * Requirements:
+ * - Addition cannot overflow.
+ */
+ function add(uint256 a, uint256 b) internal pure returns (uint256) {
+ uint256 c = a + b;
+ require(c >= a, "SafeMath: addition overflow");
+
+ return c;
+ }
+
+ /**
+ * @dev Returns the subtraction of two unsigned integers, reverting on
+ * overflow (when the result is negative).
+ *
+ * Counterpart to Solidity's `-` operator.
+ *
+ * Requirements:
+ * - Subtraction cannot overflow.
+ */
+ function sub(uint256 a, uint256 b) internal pure returns (uint256) {
+ return sub(a, b, "SafeMath: subtraction overflow");
+ }
+
+ /**
+ * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
+ * overflow (when the result is negative).
+ *
+ * Counterpart to Solidity's `-` operator.
+ *
+ * Requirements:
+ * - Subtraction cannot overflow.
+ *
+ * _Available since v2.4.0._
+ */
+ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
+ require(b <= a, errorMessage);
+ uint256 c = a - b;
+
+ return c;
+ }
+
+ /**
+ * @dev Returns the multiplication of two unsigned integers, reverting on
+ * overflow.
+ *
+ * Counterpart to Solidity's `*` operator.
+ *
+ * Requirements:
+ * - Multiplication cannot overflow.
+ */
+ function mul(uint256 a, uint256 b) internal pure returns (uint256) {
+ // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
+ // benefit is lost if 'b' is also tested.
+ // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
+ if (a == 0) {
+ return 0;
+ }
+
+ uint256 c = a * b;
+ require(c / a == b, "SafeMath: multiplication overflow");
+
+ return c;
+ }
+
+ /**
+ * @dev Returns the integer division of two unsigned integers. Reverts on
+ * division by zero. The result is rounded towards zero.
+ *
+ * Counterpart to Solidity's `/` operator. Note: this function uses a
+ * `revert` opcode (which leaves remaining gas untouched) while Solidity
+ * uses an invalid opcode to revert (consuming all remaining gas).
+ *
+ * Requirements:
+ * - The divisor cannot be zero.
+ */
+ function div(uint256 a, uint256 b) internal pure returns (uint256) {
+ return div(a, b, "SafeMath: division by zero");
+ }
+
+ /**
+ * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
+ * division by zero. The result is rounded towards zero.
+ *
+ * Counterpart to Solidity's `/` operator. Note: this function uses a
+ * `revert` opcode (which leaves remaining gas untouched) while Solidity
+ * uses an invalid opcode to revert (consuming all remaining gas).
+ *
+ * Requirements:
+ * - The divisor cannot be zero.
+ *
+ * _Available since v2.4.0._
+ */
+ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
+ // Solidity only automatically asserts when dividing by 0
+ require(b > 0, errorMessage);
+ uint256 c = a / b;
+ // assert(a == b * c + a % b); // There is no case in which this doesn't hold
+
+ return c;
+ }
+
+ /**
+ * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
+ * Reverts when dividing by zero.
+ *
+ * Counterpart to Solidity's `%` operator. This function uses a `revert`
+ * opcode (which leaves remaining gas untouched) while Solidity uses an
+ * invalid opcode to revert (consuming all remaining gas).
+ *
+ * Requirements:
+ * - The divisor cannot be zero.
+ */
+ function mod(uint256 a, uint256 b) internal pure returns (uint256) {
+ return mod(a, b, "SafeMath: modulo by zero");
+ }
+
+ /**
+ * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
+ * Reverts with custom message when dividing by zero.
+ *
+ * Counterpart to Solidity's `%` operator. This function uses a `revert`
+ * opcode (which leaves remaining gas untouched) while Solidity uses an
+ * invalid opcode to revert (consuming all remaining gas).
+ *
+ * Requirements:
+ * - The divisor cannot be zero.
+ *
+ * _Available since v2.4.0._
+ */
+ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
+ require(b != 0, errorMessage);
+ return a % b;
+ }
+}
diff --git a/apps/remix-ide/contracts/node_modules/openzeppelin-solidity/contracts/sample.sol b/apps/remix-ide/contracts/node_modules/openzeppelin-solidity/contracts/sample.sol
new file mode 100644
index 0000000000..73ecf078be
--- /dev/null
+++ b/apps/remix-ide/contracts/node_modules/openzeppelin-solidity/contracts/sample.sol
@@ -0,0 +1 @@
+import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; contract test11 {}
diff --git a/apps/remix-ide/contracts/src/gmbh/company.sol b/apps/remix-ide/contracts/src/gmbh/company.sol
new file mode 100644
index 0000000000..8f907ed55c
--- /dev/null
+++ b/apps/remix-ide/contracts/src/gmbh/company.sol
@@ -0,0 +1,8 @@
+pragma solidity ^0.5.10;
+import "./contract.sol";
+contract Assets {
+ uint[] proposals;
+ function add(uint8 _numProposals) public {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/src/gmbh/contract.sol b/apps/remix-ide/contracts/src/gmbh/contract.sol
new file mode 100644
index 0000000000..480c1f4f77
--- /dev/null
+++ b/apps/remix-ide/contracts/src/gmbh/contract.sol
@@ -0,0 +1,6 @@
+contract gmbh {
+ uint[] proposals;
+ function register(uint8 _numProposals) public {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/src/gmbh/test.sol b/apps/remix-ide/contracts/src/gmbh/test.sol
new file mode 100644
index 0000000000..e04a8bc178
--- /dev/null
+++ b/apps/remix-ide/contracts/src/gmbh/test.sol
@@ -0,0 +1,6 @@
+contract test {
+
+ function Test(uint8 _numProposals) public {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/src/leasing.sol b/apps/remix-ide/contracts/src/leasing.sol
new file mode 100644
index 0000000000..ce3c278aa1
--- /dev/null
+++ b/apps/remix-ide/contracts/src/leasing.sol
@@ -0,0 +1,14 @@
+contract lease {
+
+ function Vote(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
+
+
+contract borrow {
+
+ function Vote(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/src/ug/finance.sol b/apps/remix-ide/contracts/src/ug/finance.sol
new file mode 100644
index 0000000000..0f0dc02842
--- /dev/null
+++ b/apps/remix-ide/contracts/src/ug/finance.sol
@@ -0,0 +1,6 @@
+contract Finance {
+
+ function Loan(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/src/voting.sol b/apps/remix-ide/contracts/src/voting.sol
new file mode 100644
index 0000000000..37a7a96905
--- /dev/null
+++ b/apps/remix-ide/contracts/src/voting.sol
@@ -0,0 +1,6 @@
+contract voting {
+
+ function Vote(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/contracts/test/client/credit.sol b/apps/remix-ide/contracts/test/client/credit.sol
new file mode 100644
index 0000000000..6a8bd4fad8
--- /dev/null
+++ b/apps/remix-ide/contracts/test/client/credit.sol
@@ -0,0 +1,21 @@
+contract credit_1 {
+
+ struct Proposal {
+ uint voteCount;
+ }
+
+ function Ballot(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
+
+contract credit_2 {
+
+ struct Proposal {
+ uint voteCount;
+ }
+
+ function Ballot(uint8 _numProposals) {
+ proposals.length = _numProposals;
+ }
+}
diff --git a/apps/remix-ide/docker-compose.yaml b/apps/remix-ide/docker-compose.yaml
new file mode 100644
index 0000000000..f006b53700
--- /dev/null
+++ b/apps/remix-ide/docker-compose.yaml
@@ -0,0 +1,18 @@
+version: "3.7"
+x-project-base:
+ &project-base
+ restart: always
+ networks:
+ - remixide
+
+networks:
+ remixide:
+
+services:
+ remixide:
+ <<: *project-base
+ image: remixproject/remix-ide:$TAG
+ container_name: remixide-${TAG}
+ ports:
+ - 8080:80
+ - 65520:65520
diff --git a/apps/remix-ide/docs/FAQ.md b/apps/remix-ide/docs/FAQ.md
new file mode 100644
index 0000000000..5bdfad1b72
--- /dev/null
+++ b/apps/remix-ide/docs/FAQ.md
@@ -0,0 +1,87 @@
+FAQ
+===
+
+### Solidity compiler
+
+**Q: Error: compiler might be in a non-sane state**
+```
+error: "Uncaught JavaScript exception: RangeError: Maximum call stack size exceeded.
+The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet.
+It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected)."
+```
+
+**A:** Old versions of solidity compiler had this problem with chrome.
+Please change the compiler version in Solidity Plugin to the newer one or use another browser.
+
+**Q:** I’m getting an issue with Maximum call stack exceed and various other errors, can't compile.
+
+**A:** Try a different browser or a newer solidity compiler version.
+
+**Q:** How to verify a contract that imports other contracts?
+
+**A:** The verification tool does not recursively go through the import statments in a contract. So can only verify a 'flattened' contract.
+
+There is a plugin called `Flattener` which will stuff all the original code and the imported code into a single file.
+
+### Deploy & Run
+
+**Q:** I am using an Infura endpoint in my app, but when I try to deploy against that endpoint in remix IDE selecting "web3 provider" and putting my endpoint in, it's telling me that it can't connect
+
+**A:** If the endpoint you are using is http, it won't work.
+
+**Q:** Where is deploy button?
+
+**A:** Its in the Deploy & Run module. If you haven't activated that module, you should do that by clicking Deploy & Run module in the Plugin Manager.
+You could also activate everything you need to work with solidity on the landing page ( click the remix logo at the top left for the screen) and click the "Solidity" button in the environment section.
+
+**Q:** How to pass a tuple to a public function in Remix?
+
+**A:** Pass it as an array [].
+
+**Q:** How to input a struct as input to a parameter of a function in the Deploy & Run module?
+
+**A:** For inputting a struct, just like a tuple, pass it in as an array []. Also you need to put in the line:
+
+`pragma experimental ABIEncoderV2;` at the top of the solidity file.
+
+For example, here's a solidity file with a struct is an input parameter.
+
+```
+pragma solidity >=0.4.22 <0.6.0;
+pragma experimental ABIEncoderV2;
+
+contract daPeeps {
+ struct Peep {uint a; uint b;} // declaration of Peep type
+ Peep peep; //declaration of an object of Peep type
+
+ constructor () public
+ {
+ peep.a = 0; // definition/initialisation of object
+ peep.b = 0; //
+ }
+
+ function initPeepToPeep(Peep memory i) public payable {
+ peep.a = i.a;
+ peep.b = i.b;
+ }
+ function setPeep(uint a, uint b) public payable {
+ peep.a = a;
+ peep.b = b;
+ }
+
+ function getPeep() public view returns(Peep memory)
+ {
+ return peep;
+ }
+}
+```
+
+The input of initPeepToPeeps takes a struct. If you input
+`[1,2]` the transaction will go through.
+
+
+### General
+
+**Q:** Where do plugin developers go with their questions?
+
+**A:** The Gitter Remix plugin developers room https://gitter.im/ethereum/remix-dev-plugin
diff --git a/apps/remix-ide/docs/Makefile b/apps/remix-ide/docs/Makefile
new file mode 100644
index 0000000000..a04587262d
--- /dev/null
+++ b/apps/remix-ide/docs/Makefile
@@ -0,0 +1,216 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help
+help:
+ @echo "Please use \`make ' where is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " applehelp to make an Apple Help Book"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+ @echo " coverage to run coverage check of the documentation (if enabled)"
+
+.PHONY: clean
+clean:
+ rm -rf $(BUILDDIR)/*
+
+.PHONY: html
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+.PHONY: dirhtml
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+.PHONY: singlehtml
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+.PHONY: pickle
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+.PHONY: json
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+.PHONY: htmlhelp
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+.PHONY: qthelp
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Remix.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Remix.qhc"
+
+.PHONY: applehelp
+applehelp:
+ $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+ @echo
+ @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+ @echo "N.B. You won't be able to view it unless you put it in" \
+ "~/Library/Documentation/Help or install it in your application" \
+ "bundle."
+
+.PHONY: devhelp
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/Remix"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Remix"
+ @echo "# devhelp"
+
+.PHONY: epub
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+.PHONY: latex
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+.PHONY: latexpdf
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: latexpdfja
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+.PHONY: text
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+.PHONY: man
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+.PHONY: texinfo
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+.PHONY: info
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+.PHONY: gettext
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+.PHONY: changes
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+.PHONY: linkcheck
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+.PHONY: doctest
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+.PHONY: coverage
+coverage:
+ $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+ @echo "Testing of coverage in the sources finished, look at the " \
+ "results in $(BUILDDIR)/coverage/python.txt."
+
+.PHONY: xml
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+.PHONY: pseudoxml
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/apps/remix-ide/docs/assert_library.md b/apps/remix-ide/docs/assert_library.md
new file mode 100644
index 0000000000..8b33971294
--- /dev/null
+++ b/apps/remix-ide/docs/assert_library.md
@@ -0,0 +1,95 @@
+Remix Assert Library
+====================
+
+* [Assert.ok(value[, message])](#assert-ok-value-message)
+* [Assert.equal(actual, expected[, message])](#assert-equal-actual-expected-message)
+* [Assert.notEqual(actual, expected[, message])](#assert-notequal-actual-expected-message)
+* [Assert.greaterThan(value1, value2[, message])](#assert-greaterthan-value1-value2-message)
+* [Assert.lesserThan(value1, value2[, message])](#assert-lesserthan-value1-value2-message)
+
+
+## Assert
+
+### Assert.ok(value[, message])
+* `value`: \
+* `message`: \
+
+Tests if value is truthy. `message` is returned in case of failure.
+
+Examples:
+```
+Assert.ok(true);
+// OK
+Assert.ok(false, "it\'s false");
+// error: it's false
+```
+
+### Assert.equal(actual, expected[, message])
+* `actual`: \
+* `expected`: \
+* `message`: \
+
+Tests if `actual` & `expected` values are same. `message` is returned in case of failure.
+
+Examples:
+```
+Assert.equal(string("a"), "a");
+// OK
+Assert.equal(uint(100), 100);
+// OK
+foo.set(200)
+Assert.equal(foo.get(), 200);
+// OK
+Assert.equal(foo.get(), 100, "value should be 200");
+// error: value should be 200
+```
+
+### Assert.notEqual(actual, expected[, message])
+* `actual`: \
+* `expected`: \
+* `message`: \
+
+Tests if `actual` & `expected` values are not same. `message` is returned in case of failure.
+
+Examples:
+```
+Assert.notEqual(string("a"), "b");
+// OK
+foo.set(200)
+Assert.notEqual(foo.get(), 200, "value should not be 200");
+// error: value should not be 200
+```
+
+### Assert.greaterThan(value1, value2[, message])
+* `value1`: \
+* `value2`: \
+* `message`: \
+
+Tests if `value1` is greater than `value2`. `message` is returned in case of failure.
+
+Examples:
+```
+Assert.greaterThan(uint(2), uint(1));
+// OK
+Assert.greaterThan(uint(-2), uint(1));
+// OK
+Assert.greaterThan(int(2), int(1));
+// OK
+Assert.greaterThan(int(-2), int(-1), "-2 is not greater than -1");
+// error: -2 is not greater than -1
+```
+
+### Assert.lesserThan(value1, value2[, message])
+* `value1`: \
+* `value2`: \
+* `message`: \
+
+Tests if `value1` is lesser than `value2`. `message` is returned in case of failure.
+
+Examples:
+```
+Assert.lesserThan(int(-2), int(-1));
+// OK
+Assert.lesserThan(int(2), int(1), "2 is not lesser than 1");
+// error: 2 is not greater than 1
+```
\ No newline at end of file
diff --git a/apps/remix-ide/docs/code_contribution_guide.md b/apps/remix-ide/docs/code_contribution_guide.md
new file mode 100644
index 0000000000..6db3d1294c
--- /dev/null
+++ b/apps/remix-ide/docs/code_contribution_guide.md
@@ -0,0 +1,11 @@
+Code Contribution Guide
+=======================
+
+Remix is an open source tool and we encourage anyone to help us improve our tool.
+You can do that by opening issues, giving feedback or by contributing a pull request
+to our codebase.
+
+The Remix application is built with JavaScript and it doesn't use any framework. We only
+rely on selected set of npm modules, like `yo-yo`, `csjs-inject` and others. Check out the `package.json` files in the Remix submodules to learn more about the stack.
+
+To learn more, please visit our [GitHub page](https://github.com/ethereum/remix-ide).
diff --git a/apps/remix-ide/docs/community.md b/apps/remix-ide/docs/community.md
new file mode 100644
index 0000000000..9d1ca262e8
--- /dev/null
+++ b/apps/remix-ide/docs/community.md
@@ -0,0 +1,14 @@
+Community Support
+=======================
+
+We know that blockchain ecosystem is very new and that lots of information is scattered around the web.
+That is why we created a community support channel where we and other users try to answer your questions if
+you get stuck using Remix. Please, join [the community](https://gitter.im/ethereum/remix) and ask for help.
+
+For anyone who is interested in developing a custom plugin for Remix or who wants to contribute to the codebase,
+we opened a [contributors' channel](https://gitter.im/ethereum/remix-dev) especially for developers working on Remix tools.
+
+We would kindly ask you to respect the space and to use it for
+getting help with your work and the developers' channel for discussions related to working on Remix codebase. If you have
+ideas for collaborations or you want to promote your project, try to find some more appropriate channels to do so. Or you can contact
+the main contributors directly on Gitter or Twitter.
diff --git a/apps/remix-ide/docs/compile.md b/apps/remix-ide/docs/compile.md
new file mode 100644
index 0000000000..66453f0836
--- /dev/null
+++ b/apps/remix-ide/docs/compile.md
@@ -0,0 +1,34 @@
+Compiler (Solidity)
+===================
+
+Clicking the Solidity icon in the icon panel brings you to the Solidty Compiler.
+
+Compiling is triggered when you click the compile button ( **D. in image below**). If you want the file to be compiled each time the file is saved or when another file is selected - check the auto compile checkbox ( **E. in image below**).
+
+Since the Solidity version `0.5.7`, it is possible to compile `Yul` files. Please read the ([solidity documentation about Yul](https://solidity.readthedocs.io/en/latest/yul.html)) which contain some code examples.
+You can use the language dropdown ( **B. in image below**) to switch the language. **This dropdown list is only available for versions greater than or equal to `0.5.7`.**
+
+The fork selection dropdown list ( **C. in image below**) allows to compile code against a specific ethereum hard fork.
+The `compiler default` corresponds to the default hard fork used by a specific version. Please go to "Compilation Details" ( **G. in image below**) in the settings of `Metadata` section to see the harfork name used for the current compilation.
+
+If the contract has a lot of dependencies it can take a while to compile - so you use autocompilation at your discretion.
+
+![](images/a-sol-compiler.png)
+
+After each compilation, a list is updated with all newly compiled
+contracts. A compiled contract can be selected with the Contract pulldown menu ( **F. in the image**). Multiple contracts are compiled when one contract imports other contracts. Selecting a contract will show information about that one.
+
+When the "Compilation Details" button is clicked ( **G. in image**), a modal opens displaying detailed information about the current selected contract.
+
+For those writing your own custom solidity compiler, you can import that by clicking the **+** button (**X. in the image**) to open a modal where you can input the url of the compiler to be loaded.
+
+From the Solidity Compiler module you can also publish your contract to Swarm (only non
+abstract contracts can be published) & IPFS.
+
+Published data notably contains the `abi` and the solidity source code.
+
+After a contract is published, you can find its metadata information
+using the bzz URL located in the details modal dialog `SWARM LOCATION`.
+
+Compilation Errors and Warning are displayed below the contract section.
+At each compilation, the static analysis tab builds a report. It is important to address reported issues even if the compiler doesn't complain. ([see more](static_analysis.html))
diff --git a/apps/remix-ide/docs/conf.py b/apps/remix-ide/docs/conf.py
new file mode 100644
index 0000000000..4d4ccac4eb
--- /dev/null
+++ b/apps/remix-ide/docs/conf.py
@@ -0,0 +1,305 @@
+# -*- coding: utf-8 -*-
+#
+# Remix documentation build configuration file, created by
+# sphinx-quickstart on Mon Feb 20 12:16:16 2017.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+# sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = ['recommonmark'] # required for sphinx v3.0.0
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+source_suffix = ['.rst', '.md']
+
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Remix, Ethereum-IDE'
+copyright = u'2019, Remix'
+author = u'Remix team'
+
+github_doc_root = 'https://github.com/ethereum/remix/tree/master/docs/'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = u'1'
+# The full version, including alpha/beta/rc tags.
+release = u'1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+highlight_language = 'JavaScript'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'sphinx_rtd_theme'
+
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# " v documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (relative to this directory) to use as a favicon of
+# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
+#html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# Now only 'ja' uses this config value
+#html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+#html_search_scorer = 'scorer.js'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Remixdoc'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+
+# Latex figure (float) alignment
+#'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'Remix.tex', u'Remix Documentation',
+ u'yann300', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'remix', u'Remix Documentation',
+ [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'Remix', u'Remix Documentation',
+ author, 'Remix', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+# Uncomment these two lines with sphinx version 1.0.0
+# from recommonmark.parser import CommonMarkParser
+# source_parsers = {'.md': CommonMarkParser}
+
+
+# app setup hook
+# def setup(app):
+# app.add_config_value('recommonmark_config', {
+# 'url_resolver': lambda url: github_doc_root + url,
+# 'enable_auto_toc_tree': True,
+# 'enable_eval_rst': True,
+# 'enable_auto_doc_ref': True,
+# }, True)
+# app.add_transform(AutoStructify)
diff --git a/apps/remix-ide/docs/contract_metadata.md b/apps/remix-ide/docs/contract_metadata.md
new file mode 100644
index 0000000000..8258b78c8f
--- /dev/null
+++ b/apps/remix-ide/docs/contract_metadata.md
@@ -0,0 +1,183 @@
+Build Artifact
+==============
+
+When a compilation succeeds, Remix creates a JSON file for each compiled contract.
+The JSON file contains the compilation's artifact. Actually, for this to happen, you need to check the **Generate contract metadata** box in the **General settings** section of the **Settings** module. The .JSON file with the metadata will appear in the file explorer where the compiled file is located.
+
+This JSON file contains the link to the libraries, the bytecode, the deployed bytecode, the gas estimation, the method identifiers, and the ABI.
+
+You can write scripts that can access this file.
+
+Library Deployment
+------------------
+
+By default Remix automatically deploys needed libraries.
+
+`linkReferences` contains a map representing libraries which depend on the current contract.
+Values are addresses of libraries used for linking the contract.
+
+`autoDeployLib` defines if the libraries should be auto deployed by Remix or if the contract should be linked with libraries described in `linkReferences`
+
+Note that Remix will resolve addresses corresponding to the current network.
+By default, a configuration key follow the form: `:`, but it is also possible
+to define `` or `` as keys.
+
+
+
+```
+{
+ "VM:-": {
+ "linkReferences": {
+ "browser/Untitled.sol": {
+ "lib": "",
+ "lib2": ""
+ }
+ },
+ "autoDeployLib": true
+ },
+ "main:1": {
+ "linkReferences": {
+ "browser/Untitled.sol": {
+ "lib": "",
+ "lib2": ""
+ }
+ },
+ "autoDeployLib": true
+ },
+ "ropsten:3": {
+ "linkReferences": {
+ "browser/Untitled.sol": {
+ "lib": "",
+ "lib2": ""
+ }
+ },
+ "autoDeployLib": true
+ },
+ "rinkeby:4": {
+ "linkReferences": {
+ "browser/Untitled.sol": {
+ "lib": "",
+ "lib2": ""
+ }
+ },
+ "autoDeployLib": true
+ },
+ "kovan:42": {
+ "linkReferences": {
+ "browser/Untitled.sol": {
+ "lib": "",
+ "lib2": ""
+ }
+ },
+ "autoDeployLib": true
+ },
+ "data": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "608060405234801561001057600080fd5b506040516108723803806108728339818101604052602081101561003357600080fd5b8101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055508060ff166002816100fd9190610104565b5050610157565b81548183558181111561012b5781836000526020600020918201910161012a9190610130565b5b505050565b61015491905b808211156101505760008082016000905550600101610136565b5090565b90565b61070c806101666000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80635c19a95c14610051578063609ff1bd146100955780639e7b8d61146100b9578063b3f98adc146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012e565b005b61009d610481565b604051808260ff1660ff16815260200191505060405180910390f35b6100fb600480360360208110156100cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f9565b005b61012c6004803603602081101561011357600080fd5b81019080803560ff1690602001909291905050506105f6565b005b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff161561018e575061047e565b5b600073ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141580156102bc57503373ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b1561032b57600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915061018f565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610365575061047e565b60018160010160006101000a81548160ff021916908315150217905550818160010160026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff161561046457816000015460028260010160019054906101000a900460ff1660ff168154811061044557fe5b906000526020600020016000016000828254019250508190555061047b565b816000015481600001600082825401925050819055505b50505b50565b6000806000905060008090505b6002805490508160ff1610156104f4578160028260ff16815481106104af57fe5b906000526020600020016000015411156104e75760028160ff16815481106104d357fe5b906000526020600020016000015491508092505b808060010191505061048e565b505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415806105a15750600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff165b156105ab576105f3565b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b50565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff168061065e57506002805490508260ff1610155b1561066957506106d4565b60018160010160006101000a81548160ff021916908315150217905550818160010160016101000a81548160ff021916908360ff160217905550806000015460028360ff16815481106106b857fe5b9060005260206000200160000160008282540192505081905550505b5056fea265627a7a72315820457d09494a1d1d64ebd9b931a6c692e671dc1f14d4a0c6600f7aa00fed36011064736f6c634300050b0032",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x872 CODESIZE SUB DUP1 PUSH2 0x872 DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x1 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 ADD DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0xFF AND PUSH1 0x2 DUP2 PUSH2 0xFD SWAP2 SWAP1 PUSH2 0x104 JUMP JUMPDEST POP POP PUSH2 0x157 JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x12B JUMPI DUP2 DUP4 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x12A SWAP2 SWAP1 PUSH2 0x130 JUMP JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH2 0x154 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x150 JUMPI PUSH1 0x0 DUP1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH2 0x136 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x70C DUP1 PUSH2 0x166 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x5C19A95C EQ PUSH2 0x51 JUMPI DUP1 PUSH4 0x609FF1BD EQ PUSH2 0x95 JUMPI DUP1 PUSH4 0x9E7B8D61 EQ PUSH2 0xB9 JUMPI DUP1 PUSH4 0xB3F98ADC EQ PUSH2 0xFD JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x93 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x12E JUMP JUMPDEST STOP JUMPDEST PUSH2 0x9D PUSH2 0x481 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 PUSH1 0xFF AND PUSH1 0xFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xFB PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xCF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x4F9 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x12C PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH1 0xFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x5F6 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SWAP1 POP DUP1 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x18E JUMPI POP PUSH2 0x47E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x2 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO DUP1 ISZERO PUSH2 0x2BC JUMPI POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x2 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x32B JUMPI PUSH1 0x1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x2 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 POP PUSH2 0x18F JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x365 JUMPI POP PUSH2 0x47E JUMP JUMPDEST PUSH1 0x1 DUP2 PUSH1 0x1 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP2 DUP2 PUSH1 0x1 ADD PUSH1 0x2 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SWAP1 POP DUP1 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x464 JUMPI DUP2 PUSH1 0x0 ADD SLOAD PUSH1 0x2 DUP3 PUSH1 0x1 ADD PUSH1 0x1 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x445 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH2 0x47B JUMP JUMPDEST DUP2 PUSH1 0x0 ADD SLOAD DUP2 PUSH1 0x0 ADD PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMPDEST POP POP JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP PUSH1 0x0 DUP1 SWAP1 POP JUMPDEST PUSH1 0x2 DUP1 SLOAD SWAP1 POP DUP2 PUSH1 0xFF AND LT ISZERO PUSH2 0x4F4 JUMPI DUP2 PUSH1 0x2 DUP3 PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x4AF JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD SLOAD GT ISZERO PUSH2 0x4E7 JUMPI PUSH1 0x2 DUP2 PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x4D3 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD SLOAD SWAP2 POP DUP1 SWAP3 POP JUMPDEST DUP1 DUP1 PUSH1 0x1 ADD SWAP2 POP POP PUSH2 0x48E JUMP JUMPDEST POP POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO DUP1 PUSH2 0x5A1 JUMPI POP PUSH1 0x1 PUSH1 0x0 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x5AB JUMPI PUSH2 0x5F3 JUMP JUMPDEST PUSH1 0x1 DUP1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 ADD DUP2 SWAP1 SSTORE POP JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SWAP1 POP DUP1 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP1 PUSH2 0x65E JUMPI POP PUSH1 0x2 DUP1 SLOAD SWAP1 POP DUP3 PUSH1 0xFF AND LT ISZERO JUMPDEST ISZERO PUSH2 0x669 JUMPI POP PUSH2 0x6D4 JUMP JUMPDEST PUSH1 0x1 DUP2 PUSH1 0x1 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP2 DUP2 PUSH1 0x1 ADD PUSH1 0x1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 PUSH1 0xFF AND MUL OR SWAP1 SSTORE POP DUP1 PUSH1 0x0 ADD SLOAD PUSH1 0x2 DUP4 PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x6B8 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP POP JUMPDEST POP JUMP INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 GASLIMIT PUSH30 0x9494A1D1D64EBD9B931A6C692E671DC1F14D4A0C6600F7AA00FED360110 PUSH5 0x736F6C6343 STOP SDIV SIGNEXTEND STOP ORIGIN ",
+ "sourceMap": "33:2130:0:-;;;382:163;8:9:-1;5:2;;;30:1;27;20:12;5:2;382:163:0;;;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;382:163:0;;;;;;;;;;;;;;;;446:10;432:11;;:24;;;;;;;;;;;;;;;;;;495:1;466:6;:19;473:11;;;;;;;;;;;466:19;;;;;;;;;;;;;;;:26;;:30;;;;525:13;506:32;;:9;:32;;;;;:::i;:::-;;382:163;33:2130;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "608060405234801561001057600080fd5b506004361061004c5760003560e01c80635c19a95c14610051578063609ff1bd146100955780639e7b8d61146100b9578063b3f98adc146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012e565b005b61009d610481565b604051808260ff1660ff16815260200191505060405180910390f35b6100fb600480360360208110156100cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f9565b005b61012c6004803603602081101561011357600080fd5b81019080803560ff1690602001909291905050506105f6565b005b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff161561018e575061047e565b5b600073ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141580156102bc57503373ffffffffffffffffffffffffffffffffffffffff16600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b1561032b57600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160029054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915061018f565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610365575061047e565b60018160010160006101000a81548160ff021916908315150217905550818160010160026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff161561046457816000015460028260010160019054906101000a900460ff1660ff168154811061044557fe5b906000526020600020016000016000828254019250508190555061047b565b816000015481600001600082825401925050819055505b50505b50565b6000806000905060008090505b6002805490508160ff1610156104f4578160028260ff16815481106104af57fe5b906000526020600020016000015411156104e75760028160ff16815481106104d357fe5b906000526020600020016000015491508092505b808060010191505061048e565b505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415806105a15750600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff165b156105ab576105f3565b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b50565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010160009054906101000a900460ff168061065e57506002805490508260ff1610155b1561066957506106d4565b60018160010160006101000a81548160ff021916908315150217905550818160010160016101000a81548160ff021916908360ff160217905550806000015460028360ff16815481106106b857fe5b9060005260206000200160000160008282540192505081905550505b5056fea265627a7a72315820457d09494a1d1d64ebd9b931a6c692e671dc1f14d4a0c6600f7aa00fed36011064736f6c634300050b0032",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x5C19A95C EQ PUSH2 0x51 JUMPI DUP1 PUSH4 0x609FF1BD EQ PUSH2 0x95 JUMPI DUP1 PUSH4 0x9E7B8D61 EQ PUSH2 0xB9 JUMPI DUP1 PUSH4 0xB3F98ADC EQ PUSH2 0xFD JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x93 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x12E JUMP JUMPDEST STOP JUMPDEST PUSH2 0x9D PUSH2 0x481 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 PUSH1 0xFF AND PUSH1 0xFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xFB PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xCF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x4F9 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x12C PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x113 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD PUSH1 0xFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH2 0x5F6 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SWAP1 POP DUP1 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x18E JUMPI POP PUSH2 0x47E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x2 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO DUP1 ISZERO PUSH2 0x2BC JUMPI POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x2 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x32B JUMPI PUSH1 0x1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x2 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 POP PUSH2 0x18F JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x365 JUMPI POP PUSH2 0x47E JUMP JUMPDEST PUSH1 0x1 DUP2 PUSH1 0x1 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP2 DUP2 PUSH1 0x1 ADD PUSH1 0x2 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SWAP1 POP DUP1 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x464 JUMPI DUP2 PUSH1 0x0 ADD SLOAD PUSH1 0x2 DUP3 PUSH1 0x1 ADD PUSH1 0x1 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x445 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH2 0x47B JUMP JUMPDEST DUP2 PUSH1 0x0 ADD SLOAD DUP2 PUSH1 0x0 ADD PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMPDEST POP POP JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 POP PUSH1 0x0 DUP1 SWAP1 POP JUMPDEST PUSH1 0x2 DUP1 SLOAD SWAP1 POP DUP2 PUSH1 0xFF AND LT ISZERO PUSH2 0x4F4 JUMPI DUP2 PUSH1 0x2 DUP3 PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x4AF JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD SLOAD GT ISZERO PUSH2 0x4E7 JUMPI PUSH1 0x2 DUP2 PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x4D3 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD SLOAD SWAP2 POP DUP1 SWAP3 POP JUMPDEST DUP1 DUP1 PUSH1 0x1 ADD SWAP2 POP POP PUSH2 0x48E JUMP JUMPDEST POP POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO DUP1 PUSH2 0x5A1 JUMPI POP PUSH1 0x1 PUSH1 0x0 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x5AB JUMPI PUSH2 0x5F3 JUMP JUMPDEST PUSH1 0x1 DUP1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 ADD DUP2 SWAP1 SSTORE POP JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SWAP1 POP DUP1 PUSH1 0x1 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP1 PUSH2 0x65E JUMPI POP PUSH1 0x2 DUP1 SLOAD SWAP1 POP DUP3 PUSH1 0xFF AND LT ISZERO JUMPDEST ISZERO PUSH2 0x669 JUMPI POP PUSH2 0x6D4 JUMP JUMPDEST PUSH1 0x1 DUP2 PUSH1 0x1 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP2 DUP2 PUSH1 0x1 ADD PUSH1 0x1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 PUSH1 0xFF AND MUL OR SWAP1 SSTORE POP DUP1 PUSH1 0x0 ADD SLOAD PUSH1 0x2 DUP4 PUSH1 0xFF AND DUP2 SLOAD DUP2 LT PUSH2 0x6B8 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 ADD PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP POP JUMPDEST POP JUMP INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 GASLIMIT PUSH30 0x9494A1D1D64EBD9B931A6C692E671DC1F14D4A0C6600F7AA00FED360110 PUSH5 0x736F6C6343 STOP SDIV SIGNEXTEND STOP ORIGIN ",
+ "sourceMap": "33:2130:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;33:2130:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;872:577;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;872:577:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;1801:360;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;655:164;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;655:164:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;1509:286;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1509:286:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;872:577;919:20;942:6;:18;949:10;942:18;;;;;;;;;;;;;;;919:41;;995:6;:12;;;;;;;;;;;;991:25;;;1009:7;;;991:25;1025:115;1063:1;1032:33;;:6;:10;1039:2;1032:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;:33;;;;:70;;;;;1092:10;1069:33;;:6;:10;1076:2;1069:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;:33;;;;1032:70;1025:115;;;1121:6;:10;1128:2;1121:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;1116:24;;1025:115;;;1160:10;1154:16;;:2;:16;;;1150:29;;;1172:7;;;1150:29;1203:4;1188:6;:12;;;:19;;;;;;;;;;;;;;;;;;1235:2;1217:6;:15;;;:20;;;;;;;;;;;;;;;;;;1247:24;1274:6;:10;1281:2;1274:10;;;;;;;;;;;;;;;1247:37;;1298:10;:16;;;;;;;;;;;;1294:148;;;1368:6;:13;;;1328:9;1338:10;:15;;;;;;;;;;;;1328:26;;;;;;;;;;;;;;;;;:36;;;:53;;;;;;;;;;;1294:148;;;1429:6;:13;;;1408:10;:17;;;:34;;;;;;;;;;;1294:148;872:577;;;;:::o;1801:360::-;1849:22;1883:24;1910:1;1883:28;;1926:10;1939:1;1926:14;;1921:234;1949:9;:16;;;;1942:4;:23;;;1921:234;;;2019:16;1991:9;2001:4;1991:15;;;;;;;;;;;;;;;;;:25;;;:44;1987:168;;;2074:9;2084:4;2074:15;;;;;;;;;;;;;;;;;:25;;;2055:44;;2136:4;2117:23;;1987:168;1967:6;;;;;;;1921:234;;;;1801:360;;:::o;655:164::-;732:11;;;;;;;;;;;718:25;;:10;:25;;;;:50;;;;747:6;:15;754:7;747:15;;;;;;;;;;;;;;;:21;;;;;;;;;;;;718:50;714:63;;;770:7;;714:63;811:1;786:6;:15;793:7;786:15;;;;;;;;;;;;;;;:22;;:26;;;;655:164;;:::o;1509:286::-;1558:20;1581:6;:18;1588:10;1581:18;;;;;;;;;;;;;;;1558:41;;1613:6;:12;;;;;;;;;;;;:46;;;;1643:9;:16;;;;1629:10;:30;;;;1613:46;1609:59;;;1661:7;;;1609:59;1692:4;1677:6;:12;;;:19;;;;;;;;;;;;;;;;;;1720:10;1706:6;:11;;;:24;;;;;;;;;;;;;;;;;;1775:6;:13;;;1740:9;1750:10;1740:21;;;;;;;;;;;;;;;;;:31;;;:48;;;;;;;;;;;1509:286;;;:::o"
+ },
+ "gasEstimates": {
+ "creation": {
+ "codeDepositCost": "360800",
+ "executionCost": "infinite",
+ "totalCost": "infinite"
+ },
+ "external": {
+ "delegate(address)": "infinite",
+ "giveRightToVote(address)": "20997",
+ "vote(uint8)": "62215",
+ "winningProposal()": "infinite"
+ }
+ },
+ "methodIdentifiers": {
+ "delegate(address)": "5c19a95c",
+ "giveRightToVote(address)": "9e7b8d61",
+ "vote(uint8)": "b3f98adc",
+ "winningProposal()": "609ff1bd"
+ }
+ },
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ }
+ ],
+ "name": "delegate",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "winningProposal",
+ "outputs": [
+ {
+ "internalType": "uint8",
+ "name": "_winningProposal",
+ "type": "uint8"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "toVoter",
+ "type": "address"
+ }
+ ],
+ "name": "giveRightToVote",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "internalType": "uint8",
+ "name": "toProposal",
+ "type": "uint8"
+ }
+ ],
+ "name": "vote",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint8",
+ "name": "_numProposals",
+ "type": "uint8"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ]
+
+}
+```
diff --git a/apps/remix-ide/docs/create_deploy.md b/apps/remix-ide/docs/create_deploy.md
new file mode 100644
index 0000000000..6934c71998
--- /dev/null
+++ b/apps/remix-ide/docs/create_deploy.md
@@ -0,0 +1,107 @@
+Creating and Deploying a Contract
+================================
+
+There are 3 type of environments Remix can be plugged to:
+`Javascript VM`, `Injected provider`, or `Web3 provider`. (for details see [Running transactions](https://remix-ide.readthedocs.io/en/latest/run.html))
+
+Both `Web3 provider` and `Injected provider` require the use of an
+external tool.
+
+The external tool for `Web3 provider` is an Ethereum node and for
+`Injected provider` Metamask.
+
+The `JavaScript VM` mode is convenient because each execution runs in
+your browser and you don't need any other software or Ethereum node to run it.
+
+So, it is the easiest test environment - **no setup required!**
+
+But keep in mind that reloading the browser when you are in the Javascript VM will restart Remix in an empty state.
+
+For performance purposes ( which is to say - for testing in an environment that is closest to the mainnet), it might also be better to use an external node.
+
+Selecting the VM mode
+---------------------
+
+Make sure the VM mode is selected. All accounts displayed in `Accounts`
+should have 100 ether.
+
+Sample contract
+---------------
+
+```
+pragma solidity ^0.5.1;
+
+contract testContract {
+
+ uint value;
+
+ constructor (uint _p) public {
+ value = _p;
+ }
+
+ function setP(uint _n) payable public {
+ value = _n;
+ }
+
+ function setNP(uint _n) public {
+ value = _n;
+ }
+
+ function get () view public returns (uint) {
+ return value;
+ }
+}
+
+```
+
+This contract is very basic. The goal is to quickly start to create and
+to interact with a sample contract.
+
+Deploying an instance
+---------------------
+
+The `Compile tab` displays information related to the current contract
+(note that there can be more than one) ([see compile](compile.html)).
+
+Moving on, in the `Run tab` select, `JavaScript VM` to specify that you
+are going to deploy an instance of the contract in the `JavaScript VM`
+state.
+
+![](images/a-jvm.png)
+
+The constructor of `Ballot.sol` needs a parameter (of type `uint8`).
+Give any value and click on `Deploy`.
+
+The transaction which deploys the instance of `Ballot` is created.
+
+In a "normal" blockchain, it can take several seconds to execute. This
+is the time for the transaction to be mined. However, because we are
+using the `JavaScript VM`, our execution is immediate.
+
+The terminal will inform you about the transaction. You can see details
+there and start debugging.
+
+The newly created instance is displayed in the `run tab`.
+
+![](images/a-jvm-instance.png)
+
+Interacting with an instance
+----------------------------
+
+This new instance contains 3 actions which corresponds to the 3
+functions (`setP`, `setPN`, `get`). Clicking on `SetP` or `SetPN` will
+create a new transaction.
+
+Note that `SetP` is `payable` (red button) : it is possible to send
+value (Ether) to the contract.
+
+`SetPN` is not payable (orange button - depending on the theme) : it is not possible to send
+value (Ether) to the contract.
+
+Clicking on `get` will not execute a transaction (usually its a blue button - depending on the theme). It doesn't execute a transaction because a `get` does not modify the state (variable
+`value`) of this instance.
+
+As `get` is `view` you can see the return value just below the
+action.
+
+![](images/a-jvm-calling-instance.png)
diff --git a/apps/remix-ide/docs/debugger.md b/apps/remix-ide/docs/debugger.md
new file mode 100644
index 0000000000..456e9ba45a
--- /dev/null
+++ b/apps/remix-ide/docs/debugger.md
@@ -0,0 +1,14 @@
+Debugger
+========
+
+This module allows you to debug the transaction. It can be used to
+deploy transactions created from Remix and already mined transactions.
+(debugging works only if the current environment provides the necessary
+features).
+
+To get to the debugger - you can click the debug button in the terminal when a successful or failed transaction appears there. You can also load the module from the plugin manager and then click the bug in the icon panel. Or you can get to the debugger by running the debug command in the console.
+
+
+![](images/a-debugger.png)
+
+To learn more about how to use this tool go to the [debugger tutorial](tutorial_debug.html).
diff --git a/apps/remix-ide/docs/file_explorer.md b/apps/remix-ide/docs/file_explorer.md
new file mode 100644
index 0000000000..545d357d22
--- /dev/null
+++ b/apps/remix-ide/docs/file_explorer.md
@@ -0,0 +1,59 @@
+File Explorers
+=============
+
+To get to the File Explorers module - click the file explorers icon.
+
+![](images/a-file-explorer1.png)
+
+The basic files explorer lists all the files stored in your browser's **browser storage**.
+You can see them in the **browser** folder.
+
+**Important Note:** Clearing the browser storage will **permanently delete** all the
+solidity files stored there. This is an inherent limitation of a browser-based IDE. However, if you want to store files outside of the browser and on your computer's filesystem, use [Remixd](remixd.html) or use the [desktop version of Remix-IDE](https://github.com/ethereum/remix-desktop/releases/). RemixD enables you to have access to a selected folder on your hard drive. Remix Desktop is a version of Remix-IDE in an Electron app.
+
+You can rename, remove or
+add new files to the file explorer.
+
+![](images/a-file-explorer-buttons.png)
+
+We will start by reviewing the icons in the image above.
+
+The book icon - **A.** is the link to the module's documentation.
+
+The icons to the right of the **browser** file explorer in the image above only appear for browser storage.
+
+Create new File
+---------------
+
+The icon marked **B.** above. Creates a new file.
+
+Publish to Gist
+---------------
+
+The icon marked **C.** above. Publishes all files from the browser folder to a gist. Only file in the root of **browser** will be published. Files in subfolders will not be publish to the Gist.
+Gist API has changed in 2018 and **requires** users to be authenticated to be able to publish a gist.
+
+Click [this link](https://github.com/settings/tokens) to Github tokens setup and select Generate new token. Then check the **Create gists** checkbox and generate a new token.
+
+Take the token and paste it in Remix's **Settings** module in the **Github Access Token** section. And then click Save. Now you should be able to use the feature.
+
+Create a folder
+---------------
+
+The icon marked **D.** above. Creates a new folder in **browser** file explorer.
+
+Context Menu (Right Click)
+-----------------------------
+Right click on a file or a folder and the **context menu** will appear.
+
+![](images/a-file-ex-rt-click.png)
+
+You can rename or delete a selected file or a folder. You can also create a folder.
+
+To create a file with the context menu, right click on a folder to get the **Create File** option. A file will be created inside that folder.
+
+![](images/a-file-ex-rt-click-folder.png)
+
+The functionality of the context menu also works with RemixD (which gives you have access to a folder on your hard drive).
+
+**Note:** When working with RemixD, you need to open and close the **localhost** folder to refresh the view.
diff --git a/apps/remix-ide/docs/images/a-Runtab-deploy-atAddress.png b/apps/remix-ide/docs/images/a-Runtab-deploy-atAddress.png
new file mode 100644
index 0000000000..89d3e77ef6
Binary files /dev/null and b/apps/remix-ide/docs/images/a-Runtab-deploy-atAddress.png differ
diff --git a/apps/remix-ide/docs/images/a-contract-inputs.png b/apps/remix-ide/docs/images/a-contract-inputs.png
new file mode 100644
index 0000000000..abf2a1aeae
Binary files /dev/null and b/apps/remix-ide/docs/images/a-contract-inputs.png differ
diff --git a/apps/remix-ide/docs/images/a-debug1-deploy.png b/apps/remix-ide/docs/images/a-debug1-deploy.png
new file mode 100644
index 0000000000..f2dedaf456
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug1-deploy.png differ
diff --git a/apps/remix-ide/docs/images/a-debug2-udapp1.png b/apps/remix-ide/docs/images/a-debug2-udapp1.png
new file mode 100644
index 0000000000..e2f35b3b56
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug2-udapp1.png differ
diff --git a/apps/remix-ide/docs/images/a-debug2-udapp1a.png b/apps/remix-ide/docs/images/a-debug2-udapp1a.png
new file mode 100644
index 0000000000..0b57f61709
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug2-udapp1a.png differ
diff --git a/apps/remix-ide/docs/images/a-debug3-udapp2.png b/apps/remix-ide/docs/images/a-debug3-udapp2.png
new file mode 100644
index 0000000000..56ae6a0dc7
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug3-udapp2.png differ
diff --git a/apps/remix-ide/docs/images/a-debug4-value-loc.png b/apps/remix-ide/docs/images/a-debug4-value-loc.png
new file mode 100644
index 0000000000..61cdcab9ac
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug4-value-loc.png differ
diff --git a/apps/remix-ide/docs/images/a-debug5-term-debug-but.png b/apps/remix-ide/docs/images/a-debug5-term-debug-but.png
new file mode 100644
index 0000000000..96bf3ca56e
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug5-term-debug-but.png differ
diff --git a/apps/remix-ide/docs/images/a-debug6-term-txn-hash.png b/apps/remix-ide/docs/images/a-debug6-term-txn-hash.png
new file mode 100644
index 0000000000..f7553d3cfc
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug6-term-txn-hash.png differ
diff --git a/apps/remix-ide/docs/images/a-debug7-debugger.png b/apps/remix-ide/docs/images/a-debug7-debugger.png
new file mode 100644
index 0000000000..59fe56538d
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug7-debugger.png differ
diff --git a/apps/remix-ide/docs/images/a-debug8-top3.png b/apps/remix-ide/docs/images/a-debug8-top3.png
new file mode 100644
index 0000000000..c1b1166e99
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug8-top3.png differ
diff --git a/apps/remix-ide/docs/images/a-debug9-buttons.png b/apps/remix-ide/docs/images/a-debug9-buttons.png
new file mode 100644
index 0000000000..951cf59006
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debug9-buttons.png differ
diff --git a/apps/remix-ide/docs/images/a-debugger.png b/apps/remix-ide/docs/images/a-debugger.png
new file mode 100644
index 0000000000..2756ab6c47
Binary files /dev/null and b/apps/remix-ide/docs/images/a-debugger.png differ
diff --git a/apps/remix-ide/docs/images/a-file-ex-rt-click-folder.png b/apps/remix-ide/docs/images/a-file-ex-rt-click-folder.png
new file mode 100644
index 0000000000..501bea2c18
Binary files /dev/null and b/apps/remix-ide/docs/images/a-file-ex-rt-click-folder.png differ
diff --git a/apps/remix-ide/docs/images/a-file-ex-rt-click.png b/apps/remix-ide/docs/images/a-file-ex-rt-click.png
new file mode 100644
index 0000000000..122b1ead45
Binary files /dev/null and b/apps/remix-ide/docs/images/a-file-ex-rt-click.png differ
diff --git a/apps/remix-ide/docs/images/a-file-explorer-buttons-big.png b/apps/remix-ide/docs/images/a-file-explorer-buttons-big.png
new file mode 100644
index 0000000000..5f16de4d01
Binary files /dev/null and b/apps/remix-ide/docs/images/a-file-explorer-buttons-big.png differ
diff --git a/apps/remix-ide/docs/images/a-file-explorer-buttons.png b/apps/remix-ide/docs/images/a-file-explorer-buttons.png
new file mode 100644
index 0000000000..a7be0bb5a1
Binary files /dev/null and b/apps/remix-ide/docs/images/a-file-explorer-buttons.png differ
diff --git a/apps/remix-ide/docs/images/a-file-explorer1.png b/apps/remix-ide/docs/images/a-file-explorer1.png
new file mode 100644
index 0000000000..336fbdfdb5
Binary files /dev/null and b/apps/remix-ide/docs/images/a-file-explorer1.png differ
diff --git a/apps/remix-ide/docs/images/a-home-page.png b/apps/remix-ide/docs/images/a-home-page.png
new file mode 100644
index 0000000000..f4ca8b0537
Binary files /dev/null and b/apps/remix-ide/docs/images/a-home-page.png differ
diff --git a/apps/remix-ide/docs/images/a-hometab.png b/apps/remix-ide/docs/images/a-hometab.png
new file mode 100644
index 0000000000..a48d9f61c0
Binary files /dev/null and b/apps/remix-ide/docs/images/a-hometab.png differ
diff --git a/apps/remix-ide/docs/images/a-icon-swap.png b/apps/remix-ide/docs/images/a-icon-swap.png
new file mode 100644
index 0000000000..53cf741bd1
Binary files /dev/null and b/apps/remix-ide/docs/images/a-icon-swap.png differ
diff --git a/apps/remix-ide/docs/images/a-icons-at-load.png b/apps/remix-ide/docs/images/a-icons-at-load.png
new file mode 100644
index 0000000000..ce859729ed
Binary files /dev/null and b/apps/remix-ide/docs/images/a-icons-at-load.png differ
diff --git a/apps/remix-ide/docs/images/a-jvm-calling-instance.png b/apps/remix-ide/docs/images/a-jvm-calling-instance.png
new file mode 100644
index 0000000000..f12dcce662
Binary files /dev/null and b/apps/remix-ide/docs/images/a-jvm-calling-instance.png differ
diff --git a/apps/remix-ide/docs/images/a-jvm-instance.png b/apps/remix-ide/docs/images/a-jvm-instance.png
new file mode 100644
index 0000000000..5ed6615c9d
Binary files /dev/null and b/apps/remix-ide/docs/images/a-jvm-instance.png differ
diff --git a/apps/remix-ide/docs/images/a-jvm.png b/apps/remix-ide/docs/images/a-jvm.png
new file mode 100644
index 0000000000..851236b457
Binary files /dev/null and b/apps/remix-ide/docs/images/a-jvm.png differ
diff --git a/apps/remix-ide/docs/images/a-layout1.png b/apps/remix-ide/docs/images/a-layout1.png
new file mode 100644
index 0000000000..bb8ebbeda0
Binary files /dev/null and b/apps/remix-ide/docs/images/a-layout1.png differ
diff --git a/apps/remix-ide/docs/images/a-layout1c.png b/apps/remix-ide/docs/images/a-layout1c.png
new file mode 100644
index 0000000000..cba77e4ded
Binary files /dev/null and b/apps/remix-ide/docs/images/a-layout1c.png differ
diff --git a/apps/remix-ide/docs/images/a-old-tuto_basicimport.png b/apps/remix-ide/docs/images/a-old-tuto_basicimport.png
new file mode 100644
index 0000000000..81a8009336
Binary files /dev/null and b/apps/remix-ide/docs/images/a-old-tuto_basicimport.png differ
diff --git a/apps/remix-ide/docs/images/a-old-tuto_importgit.png b/apps/remix-ide/docs/images/a-old-tuto_importgit.png
new file mode 100644
index 0000000000..022eb4b011
Binary files /dev/null and b/apps/remix-ide/docs/images/a-old-tuto_importgit.png differ
diff --git a/apps/remix-ide/docs/images/a-old-tuto_importswarm.png b/apps/remix-ide/docs/images/a-old-tuto_importswarm.png
new file mode 100644
index 0000000000..01fba3e646
Binary files /dev/null and b/apps/remix-ide/docs/images/a-old-tuto_importswarm.png differ
diff --git a/apps/remix-ide/docs/images/a-plug.png b/apps/remix-ide/docs/images/a-plug.png
new file mode 100644
index 0000000000..cde70b2d92
Binary files /dev/null and b/apps/remix-ide/docs/images/a-plug.png differ
diff --git a/apps/remix-ide/docs/images/a-plugin-man-local.png b/apps/remix-ide/docs/images/a-plugin-man-local.png
new file mode 100644
index 0000000000..b760bab001
Binary files /dev/null and b/apps/remix-ide/docs/images/a-plugin-man-local.png differ
diff --git a/apps/remix-ide/docs/images/a-receive-fun.png b/apps/remix-ide/docs/images/a-receive-fun.png
new file mode 100644
index 0000000000..556bc2806f
Binary files /dev/null and b/apps/remix-ide/docs/images/a-receive-fun.png differ
diff --git a/apps/remix-ide/docs/images/a-remixd-success.png b/apps/remix-ide/docs/images/a-remixd-success.png
new file mode 100644
index 0000000000..bef13de555
Binary files /dev/null and b/apps/remix-ide/docs/images/a-remixd-success.png differ
diff --git a/apps/remix-ide/docs/images/a-run-icon.png b/apps/remix-ide/docs/images/a-run-icon.png
new file mode 100644
index 0000000000..4aad1a9f0b
Binary files /dev/null and b/apps/remix-ide/docs/images/a-run-icon.png differ
diff --git a/apps/remix-ide/docs/images/a-runtab-recorder.png b/apps/remix-ide/docs/images/a-runtab-recorder.png
new file mode 100644
index 0000000000..36d6b0528b
Binary files /dev/null and b/apps/remix-ide/docs/images/a-runtab-recorder.png differ
diff --git a/apps/remix-ide/docs/images/a-runtab1a.png b/apps/remix-ide/docs/images/a-runtab1a.png
new file mode 100644
index 0000000000..2206479ca6
Binary files /dev/null and b/apps/remix-ide/docs/images/a-runtab1a.png differ
diff --git a/apps/remix-ide/docs/images/a-sol-compiler.png b/apps/remix-ide/docs/images/a-sol-compiler.png
new file mode 100644
index 0000000000..ad470ec8e1
Binary files /dev/null and b/apps/remix-ide/docs/images/a-sol-compiler.png differ
diff --git a/apps/remix-ide/docs/images/a-sol-editor.png b/apps/remix-ide/docs/images/a-sol-editor.png
new file mode 100644
index 0000000000..b6c0cd5c58
Binary files /dev/null and b/apps/remix-ide/docs/images/a-sol-editor.png differ
diff --git a/apps/remix-ide/docs/images/a-static-analysis.png b/apps/remix-ide/docs/images/a-static-analysis.png
new file mode 100644
index 0000000000..f204c3128d
Binary files /dev/null and b/apps/remix-ide/docs/images/a-static-analysis.png differ
diff --git a/apps/remix-ide/docs/images/a-terminal-and-more.png b/apps/remix-ide/docs/images/a-terminal-and-more.png
new file mode 100644
index 0000000000..45d41644ca
Binary files /dev/null and b/apps/remix-ide/docs/images/a-terminal-and-more.png differ
diff --git a/apps/remix-ide/docs/images/a-themes.png b/apps/remix-ide/docs/images/a-themes.png
new file mode 100644
index 0000000000..bc48776de1
Binary files /dev/null and b/apps/remix-ide/docs/images/a-themes.png differ
diff --git a/apps/remix-ide/docs/images/a-udapp-inputs.png b/apps/remix-ide/docs/images/a-udapp-inputs.png
new file mode 100644
index 0000000000..ec68350135
Binary files /dev/null and b/apps/remix-ide/docs/images/a-udapp-inputs.png differ
diff --git a/apps/remix-ide/docs/images/a-udapp-multi-param-man.png b/apps/remix-ide/docs/images/a-udapp-multi-param-man.png
new file mode 100644
index 0000000000..afb7e4f3a8
Binary files /dev/null and b/apps/remix-ide/docs/images/a-udapp-multi-param-man.png differ
diff --git a/apps/remix-ide/docs/images/a-udapp1.png b/apps/remix-ide/docs/images/a-udapp1.png
new file mode 100644
index 0000000000..d6aa53add7
Binary files /dev/null and b/apps/remix-ide/docs/images/a-udapp1.png differ
diff --git a/apps/remix-ide/docs/images/a-udapp2.png b/apps/remix-ide/docs/images/a-udapp2.png
new file mode 100644
index 0000000000..8a5a74aefe
Binary files /dev/null and b/apps/remix-ide/docs/images/a-udapp2.png differ
diff --git a/apps/remix-ide/docs/images/a-unit-testing-custom-compiler-config.png b/apps/remix-ide/docs/images/a-unit-testing-custom-compiler-config.png
new file mode 100644
index 0000000000..8e3719c284
Binary files /dev/null and b/apps/remix-ide/docs/images/a-unit-testing-custom-compiler-config.png differ
diff --git a/apps/remix-ide/docs/images/a-unit-testing-feature.png b/apps/remix-ide/docs/images/a-unit-testing-feature.png
new file mode 100644
index 0000000000..9047c15f14
Binary files /dev/null and b/apps/remix-ide/docs/images/a-unit-testing-feature.png differ
diff --git a/apps/remix-ide/docs/images/a-unit-testing-from-pm.png b/apps/remix-ide/docs/images/a-unit-testing-from-pm.png
new file mode 100644
index 0000000000..80f70e51b7
Binary files /dev/null and b/apps/remix-ide/docs/images/a-unit-testing-from-pm.png differ
diff --git a/apps/remix-ide/docs/images/a-unit-testing-run-result.png b/apps/remix-ide/docs/images/a-unit-testing-run-result.png
new file mode 100644
index 0000000000..911599e990
Binary files /dev/null and b/apps/remix-ide/docs/images/a-unit-testing-run-result.png differ
diff --git a/apps/remix-ide/docs/images/a-user-testing-icon.png b/apps/remix-ide/docs/images/a-user-testing-icon.png
new file mode 100644
index 0000000000..53db354e77
Binary files /dev/null and b/apps/remix-ide/docs/images/a-user-testing-icon.png differ
diff --git a/apps/remix-ide/docs/import.md b/apps/remix-ide/docs/import.md
new file mode 100644
index 0000000000..333a710185
--- /dev/null
+++ b/apps/remix-ide/docs/import.md
@@ -0,0 +1,74 @@
+Importing Source Files in Solidity
+==================================
+
+There are multiple techniques for importing files into Remix.
+
+For a tutorial about importing files click [here](https://github.com/ethereum/remix-workshops/tree/master/LoadingContent). You can also find this tutorial in the Remix Workshops plugin.
+
+For a detailed explanation of the `import` keyword see the
+[Solidity documentation](https://solidity.readthedocs.io/en/develop/layout-of-source-files.html?highlight=import#importing-other-source-files)
+
+Here are a some of the main methods of importing a file:
+
+Importing a file from the browser's local storage
+-------------------------------------------------
+
+Files in Remix can be imported with the `import` key word with the path to the file. Use ```./``` for relative paths to increase portability.
+```
+pragma solidity >=0.4.22 <0.6.0;
+
+import "./ballot.sol";
+```
+
+
+Importing a file from your computer's filesystem
+-------------------------------------------------
+
+This method uses **remixd** - the remix daemon. Please go to the [remixd tutorial](remixd.html) for instructions about how to bridge the divide between the browser and your computers filesystem.
+
+
+Importing from GitHub
+---------------------
+
+It is possible to import files directly from GitHub. You should specify the release tag (where available), otherwise you will get the latest code in the master branch. For OpenZeppelin Contracts you should only use code published in an official release, the example below imports from OpenZeppelin Contracts v2.5.0.
+
+```
+pragma solidity >=0.4.22 <0.6.0;
+
+import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/math/SafeMath.sol";
+
+```
+
+Importing from Swarm
+--------------------
+
+Files can be imported using all URLs supported by swarm.
+If you do not have a swarm node, then use swarm-gateways.net.
+
+```
+import 'bzz-raw://5766400e5d6d822f2029b827331b354c41e0b61f73440851dd0d06f603dd91e5';
+```
+
+Importing from IPFS
+--------------------
+
+Files can be imported from IPFS.
+
+```
+import 'ipfs://Qmdyq9ZmWcaryd1mgGZ4PttRNctLGUSAMpPqufsk6uRMKh';
+```
+
+Importing from the console
+--------------------------
+
+You can also use a remix command remix.loadurl('')in the console. You should specify the release tag (where available), otherwise you will get the latest code in the master branch. For OpenZeppelin Contracts you should only use code published in an official release, the example below imports from OpenZeppelin Contracts v2.5.0.
+
+```
+remix.loadurl('https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/math/SafeMath.sol')
+```
+
+Notice that this will create a `github` folder in the file explorer. To load a file in the `github` folder, you would use a command like this:
+
+```
+import "github/OpenZeppelin/openzeppelin-contracts/contracts/math/SafeMath.sol";
+```
diff --git a/apps/remix-ide/docs/index.rst b/apps/remix-ide/docs/index.rst
new file mode 100644
index 0000000000..eb8488799e
--- /dev/null
+++ b/apps/remix-ide/docs/index.rst
@@ -0,0 +1,83 @@
+Welcome to Remix documentation!
+===============================
+
+Remix is a powerful, open source tool that helps you write Solidity contracts straight from the browser.
+Written in JavaScript, Remix supports both usage in the browser and locally.
+
+Remix also supports testing, debugging and deploying of smart contracts and much more.
+
+Our Remix project with all its features is available
+at `remix.ethereum.org `__ and more information can be found in these
+docs. Our IDE tool is available at `our GitHub repository
+`__.
+
+This set of documents covers instructions on how to use Remix and some tutorials to help you get started.
+
+Useful links:
+
+- `Solidity documentation `__
+
+- `Remix alpha `__ - The version where we test new Remix release (not stable!).
+
+- `Remix on Medium `__
+
+- `Ethereum StackExchange for Remix `__
+
+- `Community support channel `__
+
+- `Ðapp Developer resources (Ethereum wiki) `__
+
+.. toctree::
+ :maxdepth: 2
+ :caption: New Layout Intro
+
+ layout
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Tour of default modules
+
+ file_explorer
+ plugin_manager
+ settings
+ solidity_editor
+ terminal
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Tour of typical solidity modules
+
+ compile
+ run
+ udapp
+ debugger
+ static_analysis
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Solidity Unit Testing
+
+ unittesting
+ assert_library
+ unittesting_examples
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Using Remix
+
+ contract_metadata
+ create_deploy
+ tutorial_debug
+ import
+ remix_commands
+ remixd
+ FAQ
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Miscellaneous
+
+ locations
+ remix_tutorials_github
+ code_contribution_guide
+ community
diff --git a/apps/remix-ide/docs/layout.md b/apps/remix-ide/docs/layout.md
new file mode 100644
index 0000000000..722065e59c
--- /dev/null
+++ b/apps/remix-ide/docs/layout.md
@@ -0,0 +1,54 @@
+Remix-IDE Layout
+==============
+
+The new structure
+--------------------
+![](images/a-layout1c.png)
+
+1. Icon Panel - click to change which plugin appears in the Side Panel
+2. Side Panel - Most but not all plugins will have their GUI here.
+3. Main Panel - In the old layout this was just for editing files. In the tabs can be plugins or files for the IDE to compile.
+4. Terminal - where you will see the results of your interactions with the GUI's. Also you can run scripts here.
+
+Icon Panel at Page Load
+-----------------------
+When you load remix - the icon panel show these icons by default.
+
+![](images/a-icons-at-load.png)
+
+Everything in remix is now a plugin... so the **[Plugin Manager](#plugin-manager)** is very important.
+In the old layout, each basic task in remix was separated into the tabs. Now these tabs are plugins.
+
+But to activate a half a dozen plugins - (or however many you are using) each time the page load is **tedious**. So learn about the **[Environments](#environments)**.
+
+Homepage
+--------
+
+![](images/a-hometab.png)
+
+The homepage is located in a tab in the Main Panel.
+
+You can also get there by clicking the remix logo at the top of the icon panel.
+
+### Environments
+Clicking on one of the environment buttons loads up a collection of plugins. We currently have a **Solidity** Button and a **Vyper** button. In the future you will be able to save your own environment.
+
+To see all the plugins go to the **plugin manager** - by selecting the plug in the icon panel.
+![](images/a-plug.png)
+
+The environment buttons are time & sanity savers - so you don't need to go to the plugin manager to get started everytime you load the page.
+
+
+Plugin Manager
+---------------
+
+In order to make Remix flexible for integrating changes into its functionality and for integrating remix into other projects (your's for example), we've now made everything a plugin. This means that you only load the functionality you need. It also means that you need a place to turn off and on plugins - as your needs change. This all happens in the plug manager.
+
+The Plugin Manager is also the place you go when you are creating your own plugin and you want to load your local plugin into Remix. In that case you'd click on the "Connect to a Local Plugin" link at the top of the Plugin Manager panel.
+
+Themes
+---------------
+
+So you want to work on Remix with a dark theme or a gray theme or just a different theme that the one you are currently looking at? Go to the settings tab and at the bottom is a choice of lots of bootstrap based themes.
+
+![](images/a-themes.png)
diff --git a/apps/remix-ide/docs/locations.md b/apps/remix-ide/docs/locations.md
new file mode 100644
index 0000000000..e193139619
--- /dev/null
+++ b/apps/remix-ide/docs/locations.md
@@ -0,0 +1,10 @@
+Finding Remix
+=============
+
+So if you've found the documentation to Remix but don't know where to find Remix or if you want to run the remix-ide locally and want to find out where to download it - this page is here to help.
+
+- An online version is available at [https://remix.ethereum.org](https://remix.ethereum.org). This version is stable and is updated at almost every release.
+- An alpha online version is available at [https://remix-alpha.ethereum.org](https://remix-alpha.ethereum.org). This is not a stable version.
+- npm `remix-ide` package `npm install remix-ide -g`. `remix-ide` create a new instance of `Remix IDE` available at [http://127.0.0.1:8080](http://127.0.0.1:8080) and make the current folder available to Remix IDE by automatically starting `remixd`.
+see [Connection to `remixd`](https://remix-ide.readthedocs.io/en/latest/remixd.html) for more information about sharing local file with `Remix IDE`.
+- Github release: [https://github.com/ethereum/remix-ide/releases](https://github.com/ethereum/remix-ide/releases) . The source code is packaged at every release but still need to be built using `npm run build`.
diff --git a/apps/remix-ide/docs/make.bat b/apps/remix-ide/docs/make.bat
new file mode 100755
index 0000000000..963594cac0
--- /dev/null
+++ b/apps/remix-ide/docs/make.bat
@@ -0,0 +1,263 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^` where ^ is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. xml to make Docutils-native XML files
+ echo. pseudoxml to make pseudoxml-XML files for display purposes
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ echo. coverage to run coverage check of the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+
+REM Check if sphinx-build is available and fallback to Python version if any
+%SPHINXBUILD% 1>NUL 2>NUL
+if errorlevel 9009 goto sphinx_python
+goto sphinx_ok
+
+:sphinx_python
+
+set SPHINXBUILD=python -m sphinx.__init__
+%SPHINXBUILD% 2> nul
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+:sphinx_ok
+
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Remix.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Remix.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdf" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf
+ cd %~dp0
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdfja" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf-ja
+ cd %~dp0
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "texinfo" (
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
+)
+
+if "%1" == "gettext" (
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+if "%1" == "coverage" (
+ %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of coverage in the sources finished, look at the ^
+results in %BUILDDIR%/coverage/python.txt.
+ goto end
+)
+
+if "%1" == "xml" (
+ %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The XML files are in %BUILDDIR%/xml.
+ goto end
+)
+
+if "%1" == "pseudoxml" (
+ %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+ goto end
+)
+
+:end
diff --git a/apps/remix-ide/docs/plugin_manager.md b/apps/remix-ide/docs/plugin_manager.md
new file mode 100644
index 0000000000..9a5e8d8ead
--- /dev/null
+++ b/apps/remix-ide/docs/plugin_manager.md
@@ -0,0 +1,22 @@
+Plugin Manager
+===================
+
+## Everything is a PLUGIN in Remix
+
+In order to integrate new tools made by us and by ...you into Remix, we've now made everything a plugin.
+This architecture will also allow Remix or just parts of Remix to be integrated into other projects (your's for example).
+
+This means that you only load the functionality you need.
+
+It also means that you can turn off and on plugins - as your needs change.
+
+This all happens in the plug manager.
+
+The Plugin Manager is also the place you go when you are creating your own plugin and you want to load your local plugin into Remix.
+
+To load your local plugin, you'd click on the "Connect to a Local Plugin" link at the top of the Plugin Manager panel.
+
+![](images/a-plugin-man-local.png)
+
+To learn more about how to create your own plugin, go to
+[the README of remix-plugin repo](https://github.com/ethereum/remix-plugin).
diff --git a/apps/remix-ide/docs/remix_commands.md b/apps/remix-ide/docs/remix_commands.md
new file mode 100644
index 0000000000..78ddd0758a
--- /dev/null
+++ b/apps/remix-ide/docs/remix_commands.md
@@ -0,0 +1,93 @@
+Remix Commands
+==============
+
+In the console, you can run the commands listed below. Once you start to type a command, there is *auto completion*. These commands are using the following libraries:
+
++ *ethers*: The [ethers.js](https://docs.ethers.io/ethers.js/html/getting-started.html) library is a compact and complete JavaScript library for Ethereum.
+
++ *remix*: Ethereum IDE and tools for the web.
+
++ *web3*: The [web3.js](https://web3js.readthedocs.io/en/1.0/) library is a collection of modules which contain specific functionality for the ethereum ecosystem.
+
++ *swarmgw*: This library can be used to upload/download files to Swarm via https://swarm-gateways.net/.
+
+#### Here's the list of commands
+**remix.debug(hash)**: Start debugging a transaction.
+
+**remix.debugHelp()**: Display help message for debugging
+
+**remix.execute(filepath)**: Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.
+
+**remix.exeCurrent()**: Run the script currently displayed in the editor.
+
+**remix.getFile(path)**: Returns the content of the file located at the given path
+
+**remix.help()**: Display this help message.
+
+**remix.loadgist(id)**: Load a gist in the file explorer.
+
+**remix.loadurl(url)**: Load the given url in the file explorer. The url can be of type github, swarm or ipfs.
+
+**remix.setFile(path, content)**: set the content of the file located at the given path
+
+**remix.setproviderurl(url)**: Change the current provider to Web3 provider and set the url endpoint.
+
+**swarmgw.get(url, cb)**: Download files from Swarm via https**://swarm-gateways.net/
+
+**swarmgw.put(content, cb)**: Upload files to Swarm via https**://swarm-gateways.net/
+
+**ethers.Contract**: This API provides a graceful connection to a contract deployed on the blockchain, simplifying calling and querying its functions and handling all the binary protocol and conversion as necessarily.
+
+**ethers.HDNode**: A Hierarchical Deterministic Wallet represents a large tree of private keys which can reliably be reproduced from an initial seed.
+
+**ethers.Interface**: The Interface Object is a meta-class that accepts a Solidity (or compatible) Application Binary Interface (ABI) and populates functions to deal with encoding and decoding the parameters to pass in and results returned.
+
+**ethers.providers**: A Provider abstracts a connection to the Ethereum blockchain, for issuing queries and sending state changing transactions.
+
+**ethers.SigningKey**: The SigningKey interface provides an abstraction around the secp256k1 elliptic curve cryptography library.
+
+**ethers.utils**: The utility functions exposed in both the ethers umbrella package and the ethers-utils.
+
+**ethers.utils.AbiCoder**: Create a new ABI Coder object
+
+**ethers.utils.RLP**: This encoding method is used internally for several aspects of Ethereum, such as encoding transactions and determining contract addresses.
+
+**ethers.Wallet**: A wallet manages a private/public key pair which is used to cryptographically sign transactions and prove ownership on the Ethereum network.
+
+**ethers.version**: Contains the version of the ethers container object.
+
+**web3.bzz**: Bzz module for interacting with the swarm network.
+
+**web3.eth**: Eth module for interacting with the Ethereum network.
+
+**web3.eth.accounts**: The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.
+
+**web3.eth.abi**: The web3.eth.abi functions let you de- and encode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).
+
+**web3.eth.ens**: The web3.eth.ens functions let you interacting with ENS.
+
+**web3.eth.Iban**: The web3.eth.Iban function lets convert Ethereum addresses from and to IBAN and BBAN.
+
+**web3.eth.net**: Net module for interacting with network properties.
+
+**web3.eth.personal**: Personal module for interacting with the Ethereum accounts.
+
+**web3.eth.subscribe**: The web3.eth.subscribe function lets you subscribe to specific events in the blockchain.
+
+**web3.givenProvider**: When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise null.
+
+**web3.modules**: Contains the version of the web3 container object.
+
+**web3.providers**: Contains the current available providers.
+
+**web3.shh**: Shh module for interacting with the whisper protocol
+
+**web3.utils**: This package provides utility functions for Ethereum dapps and other **web3.js packages.
+
+**web3.version**: Contains the version of the web3 container object.
+
+**web3.eth.clearSubscriptions();**: Resets subscriptions.
+
+**web3.eth.Contract(jsonInterface[, address][, options])**: The **web3.eth.Contract object makes it easy to interact with smart contracts on the ethereum blockchain.
+
+**web3.eth.accounts.create([entropy]);**: The web3.eth.accounts contains functions to generate Ethereum accounts and sign transactions and data.
diff --git a/apps/remix-ide/docs/remix_tutorials_github.md b/apps/remix-ide/docs/remix_tutorials_github.md
new file mode 100644
index 0000000000..47f708e45a
--- /dev/null
+++ b/apps/remix-ide/docs/remix_tutorials_github.md
@@ -0,0 +1,37 @@
+Remix Github Tutorials
+=======================
+
+There are a series of tutorials in our github repo [remix-workshops](https://github.com/ethereum/remix-workshops).
+
+We are in the process of upgrading these tutorials to use the new Remix layout.
+
+In this repo there tutorials for all levels.
+
+There are tutorials for specific remix functionalities like:
+
+***Deploying***
+
+ Multiple ways of loading files in Remix
+ Deploying with libraries
+ Deploying a proxy contract
+
+***Testing***
+
+ Testing Examples
+ Continuous integration
+
+***Remix Plugin Development***
+
+ Developing a plugin for Remix and deploying it to swarm
+
+***Other***
+
+ EtherAtom (walkthrough slides + screencast)
+ Debugging transactions with Remix IDE
+ Recording and replaying transactions
+ Using a Pipeline plugin for developing Solidity contracts with demo video
+ Running scripts in the Remix terminal (batch deployment) (proxy deployment)
+
+***Additional external workshops***
+
+ Using Oraclize plugin in Remix
diff --git a/apps/remix-ide/docs/remixd.md b/apps/remix-ide/docs/remixd.md
new file mode 100644
index 0000000000..45e2d2062c
--- /dev/null
+++ b/apps/remix-ide/docs/remixd.md
@@ -0,0 +1,60 @@
+Remixd: Access your Local Filesystem
+=========================================
+
+`remixd` is an npm module. Its purpose is to give the remix web
+application access to a folder on your local computer.
+
+The code of `remixd` is
+[here](https://github.com/ethereum/remixd) .
+
+`remixd` can be globally installed using the following command:
+`npm install -g remixd`
+
+Or just install it in the directory of your choice by removing the -g flag:
+`npm install remixd`
+
+Then from the terminal, the command `remixd -s --remix-ide ` will start `remixd` and will share the given folder with remix-ide.
+
+For example, to use remixd with Remix IDE ( and not the alpha version) use this command:
+`remixd -s --remix-ide https://remix.ethereum.org`
+
+Make sure that if you use https://remix.ethereum.org (secure http) in the remixd command (like in the example above), that you are also pointing your browser to https://remix.ethereum.org and not to http://remix.ethereum.org (plain old insecure http). Or if you want to use http in the browser use http in the remixd command.
+
+
+The folder is shared using a websocket connection between `Remix IDE`
+and `remixd`.
+
+Be sure the user executing `remixd` has read/write permission on the
+folder.
+
+There is an option to run remixd in read-only mode, use `--read-only` flag.
+
+**Warning!**
+
+`remixd` provides `full read and write access` to the given folder for `any
+application` that can access the `TCP port 65520` on your local host.
+
+From `Remix IDE`, in the Plugin Manager you need to activate the remixd plugin.
+
+A modal dialog will ask confirmation
+
+Accepting this dialog will start a session.
+
+If you do not have `remixd` running in the background - another modal will open up and it will say:
+
+```
+Cannot connect to the remixd daemon.
+Please make sure you have the remixd running in the background.
+```
+
+Assuming you don't get the 2nd modal, your connection to the remixd daemon is successful. The shared folder will be available in the file explorer.
+
+**When you click the activation of remixd is successful - there will NOT be an icon that loads in the icon panel.**
+
+Click the File Explorers icon and in the swap panel you should now see the folder for `localhost`.
+
+Click on the `localhost connection` icon:
+
+![](images/a-remixd-success.png)
+
+
diff --git a/apps/remix-ide/docs/run.md b/apps/remix-ide/docs/run.md
new file mode 100644
index 0000000000..d067fa53e1
--- /dev/null
+++ b/apps/remix-ide/docs/run.md
@@ -0,0 +1,309 @@
+Deploy & Run
+============
+
+![](images/a-run-icon.png) The Deploy & Run module allows you to send transactions to the current environment.
+
+To use this module, you need to have a contract compiled. So, if there is a contract name in the CONTRACT select box (the select box is under the VALUE input field), you can use this module. If nothing is there or you do not see the contract you want, you need to select a contract in the editor to make it active, go to a compiler module and compile it, and then come back to Deploy & Run.
+
+![](images/a-runtab1a.png)
+
+Environment
+---------
+
+- `JavaScript VM`: All the transactions will be executed in
+ a sandbox blockchain in the browser. This means nothing
+ will be persisted when you reload the page. The JsVM is its own blockchain and on each reload it will start a new blockchain, the old one will not be saved.
+
+- `Injected Provider`: Remix will connect to an injected
+ web3 provider. `Metamask` is an example of a provider that inject web3.
+
+- `Web3 Provider`: Remix will connect to a remote node. You will need to provide the URL to the selected provider: geth, parity or any Ethereum client.
+
+More about Web3 Provider
+-------------
+If you are using Geth & https://remix.ethereum.org, please use the following Geth command to allow requests from Remix:
+
+**geth --rpc --rpccorsdomain https://remix.ethereum.org**
+
+Also see [Geth Docs about the rpc server](https://geth.ethereum.org/docs/rpc/server)
+
+To run Remix using https://remix.ethereum.org & a local test node, use this Geth command:
+
+**geth --rpc --rpccorsdomain="https://remix.ethereum.org" --rpcapi web3,eth,debug,personal,net --vmdebug --datadir --dev console**
+
+If you are using remix-alpha or a local version of remix - replace the url of the --rpccorsdomain with the url of Remix that you are using.
+
+To run Remix Desktop & a local test node, use this Geth command:
+
+**geth --rpc --rpccorsdomain="package://a7df6d3c223593f3550b35e90d7b0b1f.mod" --rpcapi web3,eth,debug,personal,net --vmdebug --datadir --dev console**
+
+Also see [Geth Docs on Dev mode](https://geth.ethereum.org/getting-started/dev-mode)
+
+The Web3 Provider Endpoint for a local node is **http://localhost:8545**
+
+---
+
+**WARNING:** Don't get lazy. It is a bad idea to use the Geth flag --rpccorsdomain with a wildcard: `--rpccorsdomain *`
+
+If you put the wildcard `*`, it means everyone can request the node. Whereas, if you put a URL, it restricts the urls to just that one - e.g. `--rpccorsdomain 'https://remix-alpha.ethereum.org'`
+
+Only use `--rpccorsdomain *` when using a **test chain** AND using only **test accounts**. For real accounts or on the mainchain **specify the url**.
+
+---
+
+
+Account:
+--------
+- Account: the list of accounts associated with the current
+ environment (and their associated balances). On the JsVM, you have a choice of 5 accounts. If using Injected Web3 with MetaMask, you need to change the account in MetaMask.
+
+Gas Limit:
+---------
+- This sets the maximum amount of gas that will be allowed for all the
+ transactions created in Remix.
+
+Value:
+-----
+- This sets the amount of ETH, WEI, GWEI etc that is sent to a contract or a payable function. ( Note: payable functions have a red button). The value is always reset to 0 after each transaction execution). The Value field is **NOT** for gas.
+
+ ![](images/a-Runtab-deploy-atAddress.png)
+
+Initiate Instance
+-----------------
+
+- In the image above, the select box is set to Ballot. This select box will contain the list of compiled contracts.
+
+- `Deploy` send a transaction that deploys the selected contract. When
+ the transaction is mined, the newly created instance will be added
+ (this might take several seconds). Note that if the `constructor`
+ has parameters, you need to specify them.
+
+- `At Address` this is used at access a contract that has already been deployed. It assumes that the given address is an instance of the selected contract. **Note:** There's no check at this point, so be careful when using this feature, and be sure you trust the contract at that address.
+
+
+Pending Instances
+-----------------
+
+Validating a transaction takes several seconds. During this time, the GUI
+shows it in a pending mode. When the transaction is mined, the number of
+pending transactions is updated and the transaction is added to the log
+([see terminal](terminal.html)).
+
+Using the ABI
+------------
+
+Using `Deploy` or `At Address` is a classic use case of Remix. However, it is
+possible to interact with a contract by using its ABI. The ABI is
+a JSON array which describe its interface.
+
+To interact with a contract using the ABI, create a new file in Remix
+with extension `*.abi` and copy the ABI content to it. Then, in the input
+next to `At Address`, put the Address of the contract you want to
+interact with. Click on `At Address`, a new "connection" with the
+contract will popup below.
+
+Using the Recorder
+------------------
+
+The Recorder is a tool used to save a bunch of transactions in a JSON file and
+rerun them later either in the same environment or in another.
+
+Saving to the JSON file ( by default its called scenario.json) allows one to easily check the transaction list, tweak input parameters, change linked library, etc...
+
+There are many use cases for the recorder.
+
+For instance:
+
+- After having coded and tested contracts in a constrained
+ environment (like the JavaScript VM), you could then change the environment and redeploy it to a more realistic environment like a test net with an **injected web3** or to a Geth node. By using the generated **scenario.json** file, you will be using all the same settings that you used in the Javascript VM. And this mean that you won't need to click the interface 100 times or whatever to get the state that you achieved originally. So the recorder could be a tool to protect your sanity.
+
+ You can also change the settings in the scenario.json file to customize the playback.
+
+- Deploying contract does often require more than creating one
+ transaction and so the recorder will automate this deployment.
+
+- Working in a dev environment often requires to setup the
+ state in a first place.
+
+![](images/a-runtab-recorder.png)
+
+### scenario.json
+To create this file in the recorder, you first of course need to have run some transactions. In the image above - it has a `0` next to **Transactions Recorded**. So this isn't the right moment to save transactions because - well because there aren't any. Each time you make a transaction, that number will increment. Then when you are ready, click the floppy disk icon and the scenario.json file will be created.
+
+The JSON file below is an example of the scenario.json file.
+
+In it, 3 transactions are executed:
+
+The first corresponds to the deployment of the lib `testLib`.
+
+The second corresponds to the deployment of the contract `test` with the
+first parameter of the constructor set to 11. That contract depends
+on a library. The linkage is done using the property `linkReferences`.
+In that case we use the address of the previously created library :
+`created{1512830014773}`. The number is the id (timestamp) of the
+transaction that led to the creation of the library.
+
+The third record corresponds to the call to the function `set` of the
+contract `test` (the property to is set to: `created{1512830015080}`) .
+Input parameters are `1` and
+`0xca35b7d915458ef540ade6068dfe2f44e8fa733c`
+
+All these transactions are created using the value of the accounts
+`account{0}`.
+
+```
+{
+"accounts": {
+ "account{0}": "0xca35b7d915458ef540ade6068dfe2f44e8fa733c"
+},
+"linkReferences": {
+ "testLib": "created{1512830014773}"
+},
+"transactions": [
+ {
+ "timestamp": 1512830014773,
+ "record": {
+ "value": "0",
+ "parameters": [],
+ "abi": "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a",
+ "contractName": "testLib",
+ "bytecode": "60606040523415600e57600080fd5b60968061001c6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c146044575b600080fd5b604a6060565b6040518082815260200191505060405180910390f35b6000610d809050905600a165627a7a7230582022d123b15248b8176151f8d45c2dc132063bcc9bb8d5cd652aea7efae362c8050029",
+ "linkReferences": {},
+ "type": "constructor",
+ "from": "account{0}"
+ }
+ },
+ {
+ "timestamp": 1512830015080,
+ "record": {
+ "value": "100",
+ "parameters": [
+ 11
+ ],
+ "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec",
+ "contractName": "test",
+ "bytecode": "60606040526040516020806102b183398101604052808051906020019091905050806000819055505061027a806100376000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632f30c6f61461006757806338cc48311461009e57806362738998146100f357806387cc10e11461011c575b600080fd5b61009c600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610145565b005b34156100a957600080fd5b6100b1610191565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100fe57600080fd5b6101066101bb565b6040518082815260200191505060405180910390f35b341561012757600080fd5b61012f6101c4565b6040518082815260200191505060405180910390f35b8160008190555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054905090565b600073__browser/ballot.sol:testLib____________636d4ce63c6000604051602001526040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b151561022e57600080fd5b6102c65a03f4151561023f57600080fd5b505050604051805190509050905600a165627a7a72305820e0b2510bb2890a0334bfe5613d96db3e72442e63b514cdeaee8fc2c6bbd19d3a0029",
+ "linkReferences": {
+ "browser/ballot.sol": {
+ "testLib": [
+ {
+ "length": 20,
+ "start": 511
+ }
+ ]
+ }
+ },
+ "name": "",
+ "type": "constructor",
+ "from": "account{0}"
+ }
+ },
+ {
+ "timestamp": 1512830034180,
+ "record": {
+ "value": "1000000000000000000",
+ "parameters": [
+ 1,
+ "0xca35b7d915458ef540ade6068dfe2f44e8fa733c"
+ ],
+ "to": "created{1512830015080}",
+ "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec",
+ "name": "set",
+ "type": "function",
+ "from": "account{0}"
+ }
+ }
+],
+"abis": {
+ "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "get",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ],
+ "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getInt",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getFromLib",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAddress",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_t",
+ "type": "uint256"
+ },
+ {
+ "name": "_add",
+ "type": "address"
+ }
+ ],
+ "name": "set",
+ "outputs": [],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_r",
+ "type": "uint256"
+ }
+ ],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "constructor"
+ }
+ ]
+}
+}
+```
diff --git a/apps/remix-ide/docs/settings.md b/apps/remix-ide/docs/settings.md
new file mode 100644
index 0000000000..2f78eb52f0
--- /dev/null
+++ b/apps/remix-ide/docs/settings.md
@@ -0,0 +1,14 @@
+Settings
+========
+
+To get to **Settings** click the gear a the very bottom of the icon panel.
+
+You can find a link to the homepage (if you closed it) as well as a link to our Gitter Channel and for you aesthetes out there, we now have a rather large list of themes.
+
+![](images/a-themes.png)
+
+Another important settings:
+
+- Text wrap: controls if the text in the editor should be wrapped.
+
+- Enable optimization: defines if the compiler should enable optimization during compilation. Enabling this option saves execution gas. It is useful to enable optimization for contracts ready to be deployed in production but could lead to some inconsistencies when debugging such a contract.
diff --git a/apps/remix-ide/docs/solidity_editor.md b/apps/remix-ide/docs/solidity_editor.md
new file mode 100644
index 0000000000..f492dab9a9
--- /dev/null
+++ b/apps/remix-ide/docs/solidity_editor.md
@@ -0,0 +1,18 @@
+Solidity Editor
+===============
+
+The Remix editor recompiles the code each time the current file is
+changed or another file is selected. It also provides syntax
+highlighting mapped to solidity keywords.
+
+![](images/a-sol-editor.png)
+
+Here's the list of some important features:
+
+- It display opened files as tabs.
+- Compilation Warning and Error are displayed in the gutter
+- Remix saves the current file continuously (5s after the last
+ changes)
+- +/- on the top left corner enable you to increase/decrease the font
+ size of the editor
+
diff --git a/apps/remix-ide/docs/static_analysis.md b/apps/remix-ide/docs/static_analysis.md
new file mode 100644
index 0000000000..7a777ef525
--- /dev/null
+++ b/apps/remix-ide/docs/static_analysis.md
@@ -0,0 +1,296 @@
+Solidity Static Analysis
+========================
+
+Static code analysis is a process to debug the code by examining it and without actually executing the code.
+
+`Solidity Static Analysis` plugin performs static analysis on Solidity smart contracts once they are compiled. It checks for security vulnerabilities and bad development practices, among other issues. This plugin comes with `Solidity` environment of Remix IDE. It can also be activated individually from `Plugin Manager`.
+
+How to use
+------------
+
+If you select this plugin, you will see a number of modules listed along with checkboxes, one `Auto run` checkbox and a `Run` button.
+
+![](images/a-static-analysis.png)
+
+By default, all modules are selected for analysis and a new analysis is performed at each compilation.
+
+One can select/deselect the modules under which contract should be analyzed and can run the analysis again for last compiled contract by clicking on `Run`.
+
+If you don't want to run analysis each time you compile a contract, just uncheck the checkbox near to `Auto run`.
+
+Analysis Modules
+-----------------
+Currently, with Remix IDE v0.10.1, there are 21 analysis modules listed under 4 categories. Categories are: `Security`, `Gas & Economy`, `ERC` & `Miscellaneous`.
+
+Here is the list of modules under each category along with the example code which **should be avoided or used very carefully while development**:
+
+### Category: Security
+- **Transaction origin: 'tx.origin' is used**
+
+`tx.origin` is useful only in very exceptional cases. If you use it for authentication, you usually want to replace it by "msg.sender", because otherwise any contract you call can act on your behalf.
+
+_Example:_
+```
+require(tx.origin == owner);
+```
+
+- **Check effects: Potential reentrancy bugs**
+
+Potential Violation of Checks-Effects-Interaction pattern can lead to re-entrancy vulnerability.
+
+_Example:_
+```
+// sending ether first
+msg.sender.transfer(amount);
+
+// updating state afterwards
+balances[msg.sender] -= amount;
+```
+
+- **Inline assembly: Inline assembly used**
+
+Use of inline assembly is advised only in rare cases.
+
+_Example:_
+```
+assembly {
+ // retrieve the size of the code, this needs assembly
+ let size := extcodesize(_addr)
+}
+```
+- **Block timestamp: Semantics maybe unclear**
+
+`now` does not mean current time. `now` is an alias for `block.timestamp`. `block.timestamp` can be influenced by miners to a certain degree, be careful.
+
+_Example:_
+```
+// using now for date comparison
+if(startDate > now)
+ isStarted = true;
+
+// using block.timestamp
+uint c = block.timestamp;
+```
+- **Low level calls: Semantics maybe unclear**
+
+Use of low level `call`, `callcode` or `delegatecall` should be avoided whenever possible. `send` does not throw an exception when not successful, make sure you deal with the failure case accordingly. Use `transfer` whenever failure of the ether transfer should rollback the whole transaction.
+
+_Example:_
+```
+x.call('something');
+x.send(1 wei);
+```
+- **Blockhash usage: Semantics maybe unclear**
+
+`blockhash` is used to access the last 256 block hashes. A miner computes the block hash by "summing up" the information in the current block mined. By summing up the information in a clever way a miner can try to influence the outcome of a transaction in the current block.
+
+_Example:_
+```
+bytes32 b = blockhash(100);
+```
+- **Selfdestruct: Beware of caller contracts**
+
+`selfdestruct` can block calling contracts unexpectedly. Be especially careful if this contract is planned to be used by other contracts (i.e. library contracts, interactions). Selfdestruction of the callee contract can leave callers in an inoperable state.
+
+_Example:_
+```
+selfdestruct(address(0x123abc..));
+```
+
+### Category: Gas & Economy
+- **Gas costs: Too high gas requirement of functions**
+
+If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage
+
+_Example:_
+```
+for (uint8 proposal = 0; proposal < proposals.length; proposal++) {
+ if (proposals[proposal].voteCount > winningVoteCount) {
+ winningVoteCount = proposals[proposal].voteCount;
+ winningProposal = proposal;
+ }
+}
+```
+
+- **This on local calls: Invocation of local functions via 'this'**
+
+Never use `this` to call functions in the same contract, it only consumes more gas than normal local calls.
+
+_Example:_
+```
+contract test {
+
+ function callb() public {
+ address x;
+ this.b(x);
+ }
+
+ function b(address a) public returns (bool) {}
+}
+```
+
+- **Delete on dynamic Array: Use require/assert appropriately**
+
+The `delete` operation when applied to a dynamically sized array in Solidity generates code to delete each of the elements contained. If the array is large, this operation can surpass the block gas limit and raise an OOG exception. Also nested dynamically sized objects can produce the same results.
+
+_Example:_
+```
+contract arr {
+ uint[] users;
+ function resetState() public{
+ delete users;
+ }
+}
+```
+
+- **For loop over dynamic array: Iterations depend on dynamic array's size**
+
+Loops that do not have a fixed number of iterations, for example, loops that depend on storage values, have to be used carefully: Due to the block gas limit, transactions can only consume a certain amount of gas. The number of iterations in a loop can grow beyond the block gas limit which can stall the complete contract at a certain point. Additionally, using unbounded loops can incur in a lot of avoidable gas costs. Carefully test how many items at maximum you can pass to such functions to make it successful.
+
+_Example:_
+```
+contract forLoopArr {
+ uint[] array;
+
+ function shiftArrItem(uint index) public returns(uint[] memory) {
+ for (uint i = index; i < array.length; i++) {
+ array[i] = array[i+1];
+ }
+ return array;
+ }
+}
+```
+
+- **Ether transfer in loop: Transferring Ether in a for/while/do-while loop**
+
+Ether payout should not be done in a loop. Due to the block gas limit, transactions can only consume a certain amount of gas. The number of iterations in a loop can grow beyond the block gas limit which can cause the complete contract to be stalled at a certain point. If required, make sure that number of iterations are low and you trust each address involved.
+
+_Example:_
+```
+contract etherTransferInLoop {
+ address payable owner;
+
+ function transferInForLoop(uint index) public {
+ for (uint i = index; i < 100; i++) {
+ owner.transfer(i);
+ }
+ }
+
+ function transferInWhileLoop(uint index) public {
+ uint i = index;
+ while (i < 100) {
+ owner.transfer(i);
+ i++;
+ }
+ }
+}
+```
+
+### Category: ERC
+- **ERC20: 'decimals' should be 'uint8'**
+
+ERC20 Contracts `decimals` function should have `uint8` as return type.
+
+_Example:_
+```
+contract EIP20 {
+
+ uint public decimals = 12;
+}
+```
+
+### Category: Miscellaneous
+- **Constant/View/Pure functions: Potentially constant/view/pure functions**
+
+It warns for the methods which potentially should be constant/view/pure but are not.
+
+_Example:_
+```
+function b(address a) public returns (bool) {
+ return true;
+}
+```
+- **Similar variable names: Variable names are too similar**
+
+It warns on the usage of similar variable names.
+
+_Example:_
+```
+// Variables have very similar names voter and voters.
+function giveRightToVote(address voter) public {
+ require(voters[voter].weight == 0);
+ voters[voter].weight = 1;
+}
+```
+- **No return: Function with 'returns' not returning**
+
+It warns for the methods which define a return type but never explicitly return a value.
+
+_Example:_
+```
+function noreturn(string memory _dna) public returns (bool) {
+ dna = _dna;
+ }
+```
+- **Guard conditions: Use 'require' and 'assert' appropriately**
+
+Use `assert(x)` if you never ever want x to be false, not in any circumstance (apart from a bug in your code). Use `require(x)` if x can be false, due to e.g. invalid input or a failing external component.
+
+_Example:_
+```
+assert(a.balance == 0);
+```
+- **Result not used: The result of an operation not used**
+
+A binary operation yields a value that is not used in the following. This is often caused by confusing assignment (=) and comparison (==).
+
+_Example:_
+```
+c == 5;
+or
+a + b;
+```
+- **String Length: Bytes length != String length**
+
+Bytes and string length are not the same since strings are assumed to be UTF-8 encoded (according to the ABI defintion) therefore one character is not nessesarily encoded in one byte of data.
+
+_Example:_
+```
+function length(string memory a) public pure returns(uint) {
+ bytes memory x = bytes(a);
+
+ return x.length;
+}
+```
+- **Delete from dynamic array: 'delete' on an array leaves a gap**
+
+Using `delete` on an array leaves a gap. The length of the array remains the same. If you want to remove the empty position you need to shift items manually and update the length property.
+
+_Example:_
+```
+contract arr {
+ uint[] array = [1,2,3];
+
+ function removeAtIndex() public returns (uint[] memory) {
+ delete array[1];
+ return array;
+ }
+}
+```
+- **Data Truncated: Division on int/uint values truncates the result**
+
+Division of integer values yields an integer value again. That means e.g. 10 / 100 = 0 instead of 0.1 since the result is an integer again. This does not hold for division of (only) literal values since those yield rational constants.
+
+_Example:_
+```
+function contribute() payable public {
+ uint fee = msg.value * uint256(feePercentage / 100);
+ fee = msg.value * (p2 / 100);
+}
+```
+
+Remix-analyzer
+-----------------
+`remix-analyzer` is the library which works underneath of remix-ide `Solidity Static Analysis` plugin.
+
+`remix-analyzer` is an [NPM package](https://www.npmjs.com/package/remix-analyzer). It can be used as a library in a solution supporting node.js. Find more information about this type of usage in the [remix-analyzer repository](https://github.com/ethereum/remix/tree/master/remix-analyzer#how-to-use)
\ No newline at end of file
diff --git a/apps/remix-ide/docs/support.md b/apps/remix-ide/docs/support.md
new file mode 100644
index 0000000000..85dfb873c5
--- /dev/null
+++ b/apps/remix-ide/docs/support.md
@@ -0,0 +1,9 @@
+Support chat
+=======================
+
+We know that blockchain ecosystem is very new and that lots of information is scattered around the web.
+That is why we created a community support chat where we and other users try to answer your questions if
+you get stuck using Remix. Please, join [the Remix channel](https://gitter.im/ethereum/remix) and ask the community for help.
+
+For anyone who is interested in developing a custom plugin for Remix or who wants to contribute to the codebase,
+we've opened [another channel](https://gitter.im/ethereum/remix-dev) specially for developers working on Remix tool.
diff --git a/apps/remix-ide/docs/terminal.md b/apps/remix-ide/docs/terminal.md
new file mode 100644
index 0000000000..56fdb7c2fd
--- /dev/null
+++ b/apps/remix-ide/docs/terminal.md
@@ -0,0 +1,21 @@
+Terminal
+========
+
+![](images/a-terminal-and-more.png)
+
+Features, available in the terminal:
+
+- It integrates a JavaScript interpreter and the `web3` object. It
+ enables the execution of the JavaScript script which interacts with
+ the current context. (note that `web3` is only available if the
+ `web provider` or `injected provider` mode is selected).
+- It displays important actions made while interacting with the Remix
+ IDE (i.e. sending a new transaction).
+- It displays transactions that are mined in the current context. You
+ can choose to display all transactions or only transactions that
+ refers to the contracts Remix knows (e.g transaction created from
+ the Remix IDE).
+- It allows searching for the data and clearing the logs from the
+ terminal.
+- You can run scripts by inputting them at the bottom after the `>`.
+
diff --git a/apps/remix-ide/docs/tutorial_debug.md b/apps/remix-ide/docs/tutorial_debug.md
new file mode 100644
index 0000000000..dbf951504e
--- /dev/null
+++ b/apps/remix-ide/docs/tutorial_debug.md
@@ -0,0 +1,225 @@
+Debugging Transactions
+======================
+
+There are two ways to start debugging, each one corresponds to a different use case.
+* from the transaction log in the Terminal - use this when you want to debug a transaction.
+* from the Debugger - use this if you have a *transaction hash*.
+
+### Initiate Debugging from the transaction log in the Terminal
+Let's start with a basic contract ( or replace this one by your own ) :
+- create a blank file in the file explorer (by clicking the + icon) and give it a name.
+- copy the code below.
+- compile the code.
+- click the Run & Deploy icon in the icon panel.
+
+```
+pragma solidity >=0.5.1 <0.6.0;
+contract Donation {
+ address owner;
+ event fundMoved(address _to, uint _amount);
+ modifier onlyowner { if (msg.sender == owner) _; }
+ address[] _giver;
+ uint[] _values;
+
+ constructor() public {
+ owner = msg.sender;
+ }
+
+ function donate() payable public {
+ addGiver(msg.value);
+ }
+
+ function moveFund(address payable _to, uint _amount) onlyowner public {
+ uint balance = address(this).balance;
+ uint amount = _amount;
+ if (_amount <= balance) {
+ if (_to.send(balance)) {
+ emit fundMoved(_to, _amount);
+ } else {
+ revert();
+ }
+ } else {
+ revert();
+ }
+ }
+
+ function addGiver(uint _amount) internal {
+ _giver.push(msg.sender);
+ _values.push(_amount);
+ }
+}
+```
+
+For the purpose of this tutorial, we will run the `JavaScript VM`.
+This simulates a custom blockchain. You could do the same using a proper backend node.
+
+Let's deploy the contract:
+
+Click the `Deploy` button
+
+![](images/a-debug1-deploy.png)
+
+You'll see the deployed instance (AKA the udapp).
+
+![](images/a-debug2-udapp1a.png)
+
+Then open it up (by clicking the caret).
+
+![](images/a-debug3-udapp2.png)
+
+
+We are going to call the `Donate` function and will send it ether.
+
+To do this: in the value input box put in **2** and select Ether as the unit (and not wei like I did in the image below - well you could - it won't really change anything).
+
+![](images/a-debug4-value-loc.png)
+
+Then click the `Donate` button.
+
+This will send Ether to the this function.
+
+Because we are using the `JavaScript VM`, everything happens almost instantly. (If we had been using Injected Web 3, then we would have to need to approve the transaction, pay for gas and wait for the transaction to get mined.)
+
+Remix displays information related to each transaction result in the terminal.
+
+Check in the **terminal** where the transaction you just made is logged.
+
+Click the debug button to start debugging it.
+
+![](images/a-debug5-term-debug-but.png)
+
+Before we get to the actual debugging tool, the next section show how to start debugging session directly from the Debugger.
+
+### Initiate Debugging from the Debugger
+
+Click the bug icon in the icon panel to get to the debugger in the side panel.
+
+If you don't see the bug icon, go to the plugin manager and activate the debugger.
+
+You can start a debug session by providing a `transaction hash`.
+
+To find a transaction hash:
+1. Go to a transaction in the terminal.
+2. Click a line with a transaction - to exand the log.
+3. The transaction hash is there - copy it.
+
+![](images/a-debug6-term-txn-hash.png)
+
+Then click in the debugger paste the hash and click on the `Start debugging` button.
+
+![](images/a-debug7-debugger.png)
+
+Using the debugger
+------------------
+
+![](images/a-debug8-top3.png)
+
+The debugger allows one to see detailed informations about the
+transaction's execution. It uses the editor to display the
+location in the source code where the current execution is.
+
+The navigation part contains a slider and buttons that can be used to
+step through the transaction execution.
+
+
+### More explaination of what these buttons do.
+1. Step Into
+2. Step Over Into
+
+
+11 panels give detailed information about the execution:
+
+### Instructions
+
+The Instructions panel displays the bytecode of the current executing
+contract- with the current step highlighted.
+
+Important note: When this panel is hidden, the slider will have a
+courser granularity and only stop at *expression boundaries*, even if they
+are compiled into multiple EVM instructions. When the panel is
+displayed, it will be possible to step over every instruction, even
+those that refers to the same expression.
+
+### Solidity Locals
+
+The Solidity Locals panel displays local variables associated with the
+current context.
+
+### Solidity State
+
+The Solidity State panel displays state variables of the current
+executing contract.
+
+### Low level panels
+
+These panels display low level informations about the execution:
+
+> - Stack
+> - Storages Changes
+> - Memory
+> - Call Data
+> - Call Stack
+> - Return Value (only if the current step is a RETURN opcode)
+> - Full Storages Changes (only at the end of the execution - display
+> every storage change of every modified contract)
+
+### Reverted Transaction
+
+A transaction can be `reverted` (because of an *out of gas exception* or
+Solidity `revert` statement or because of a low level exception).
+
+It is important to be aware of the exception and to locate
+where the exception is in the source code.
+
+Remix will warn you when the execution throws an exception. The
+`warning` button will jump to the last opcode before the exception
+happened.
+
+### Breakpoints
+
+The two last buttons from the navigation area are used to jump either
+back to the previous breakpoint or forward to the next breakpoint.
+
+Breakpoints can be added and removed by clicking on the line number in the *Editor*.
+
+When using debug session with breakpoints, the execution will jump to the first
+encountered breakpoint.
+
+**Important note:** If you add a breakpoint to a line that declares a
+variable, it might be triggered twice: Once for initializing the
+variable to zero and second time for assigning the actual value. As an
+example, assume you are debugging the following contract:
+
+```
+pragma solidity >=0.5.1 <0.6.0;
+
+contract ctr {
+ function hid () public {
+ uint p = 45;
+ uint m;
+ m = 89;
+ uint l = 34;
+ }
+}
+```
+
+And let's says that breakpoints are set for the lines
+
+`uint p = 45;`
+
+`m = 89;`
+
+`uint l = 34;`
+
+then clicking on `Jump to next breakpoint` will stop at the following
+lines in the given order:
+
+> `uint p = 45;` (declaration of p)
+>
+> `uint l = 34;` (declaration of l)
+>
+> `uint p = 45;` (45 assigned to p)
+>
+> `m = 89;` (89 assigned to m)
+>
+> `uint l = 34;` (34 assigned to l)
diff --git a/apps/remix-ide/docs/udapp.md b/apps/remix-ide/docs/udapp.md
new file mode 100644
index 0000000000..86ddb721e6
--- /dev/null
+++ b/apps/remix-ide/docs/udapp.md
@@ -0,0 +1,139 @@
+Run & Deploy (part 2)
+=====================
+
+## Deployed contracts
+
+This section in the Run tab contains a list of deployed contracts to interact with through autogenerated UI of the deployed contract (also called udapp).
+
+The deployed contract appears but is in its collapsed form.
+
+![](images/a-debug2-udapp1a.png)
+
+Click the sideways caret to open it up.
+
+![](images/a-udapp1.png)
+
+You will see the functions in the contract. The functions buttons can have different color buttons.
+
+- Functions that are `constant` or `pure` functions in Solidity have a blue buttons. Clicking one of this type does not create a new transaction. So clicking will not cause state changes - it will only return a value stored in the contract - so it won't cost you anything in gas fees.
+
+- Functions that change the state of the contract AND that do not accept Ether are called `non-payable` functions and have an orange button. Clicking on them will create a transaction and thus cost gas.
+
+- Functions that have red buttons are `payable` functions in Solidity. Clicking one of these will create a new transaction and this transaction can accept a **value**. The **value** is put in in the Value field which is under the Gas Limit field.
+
+![](images/a-jvm-calling-instance.png)
+
+
+See more information about [Solidity
+modifiers](http://solidity.readthedocs.io/en/develop/miscellaneous.html?highlight=pure#modifiers) in the Solidity docs.
+.
+
+If a function requires input parameters, well.. you gotta put them in.
+
+## Inputting parameters
+
+![](images/a-udapp-inputs.png)
+
+### Inputting parameters in the collapsed view
+
+(Inputting all the parameters in a single input box)
++ The input box tells you what type each parameter needs to be.
++ Numbers and addresses do not need to be wrapped in double quotes.
++ Strings need to be wrapped.
++ Parameters are separated by commas.
+
+In the example above the "delegate" function has 3 parameters.
+
+### Inputting parameters in the expanded view
+Clicking the 'down' caret brings you to the *Multi-param Manager* - where you can input the parameters one at a time. **Much less confusing!**
+
+![](images/a-udapp-multi-param-man.png)
+
+In the expanded view, strings do not need to be wrapped.
+
+Clicking the clipboard icon will encode the inputs and will copy them. Only a valid set of inputs can be encoded.
+
+So if you made a mistake and put a uint8 where an address should have been, clicking the clipboard here will give you an error.
+
+## Low level interactions
+
+Low level interactions are used to send funds or calldata or funds & calldata to a contract through the **recieve()** or **fallback()** function. Typically, you should only need to implement the fallback function if you are following an upgrade or proxy pattern.
+
+The low level interactions section is below the functions in each deployed contract.
+
+![](images/a-udapp1.png)
+
+
+Please note the following:
+
+- If you are executing a plain Ether transfer to a contract, you need to have the receive() function in your contract. If your contract has been deployed and you want to send it funds, you would input the amount of Ether or Wei etc. (see **A** in graphic below), and then input **NOTHING** in the calldata field of **Low level interactions** (see **B** in graphic) and click the Transact button (see **C** in graphic below).
+
+![](images/a-receive-fun.png)
+
+- If you are sending calldata to your contract with Ether, then you need to use the fallback() function and have it with the state mutability of **payable**.
+
+- If you are not sending ether to the contract but **are** sending call data then you need to use the fallback() function.
+
+- If you break the rules when using the **Low level interactions** you will be slapped with a warning.
+
+Please see the [solidity docs](https://solidity.readthedocs.io/en/latest/contracts.html#receive-ether-function) for more specifics about using the **fallback** and **receive** functions.
+
+### Passing in a tuple or a struct to a function
+To pass a tuple in, you need to put in an array [].
+
+Similarly, to pass in a struct as a parameter of a function, it needs to be put in as an array []. Also note that the line
+`pragma experimental ABIEncoderV2;`
+needs to put in at the top of the solidity file.
+
+### Example of passing nested struct to a function
+Consider a nested struct defined like this:
+```
+struct gardenPlot {
+ uint slugCount;
+ uint wormCount;
+ Flower[] theFlowers;
+}
+struct Flower {
+ uint flowerNum;
+ string color;
+}
+```
+If a function has the signature `fertilizer(Garden memory gardenPlot)` then the correct syntax is:
+```
+[1,2,[[3,"Petunia"]]]
+```
+
+To continue on this example, here's a sample contract:
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+pragma experimental ABIEncoderV2;
+
+contract Sunshine {
+ struct Garden {
+ uint slugCount;
+ uint wormCount;
+ Flower[] theFlowers;
+ }
+ struct Flower {
+ uint flowerNum;
+ string color;
+ }
+
+ function picker(Garden memory gardenPlot) public {
+ uint a = gardenPlot.slugCount;
+ uint b = gardenPlot.wormCount;
+ Flower[] memory cFlowers = gardenPlot.theFlowers;
+ uint d = gardenPlot.theFlowers[0].flowerNum;
+ string memory e = gardenPlot.theFlowers[0].color;
+ }
+}
+```
+
+After compiling, deploying the contract and opening up the deployed instance, we can then add the following input parameters to the function named **fertilizer** :
+
+```
+[1,2,[[3,"Black-eyed Susan"],[4,"Pansy"]]]
+```
+
+The function **fertilizer** accepts a single parameter of the type **Garden**. The type **Garden** is a **struct**. Structs are wrapped in **square brackets**. Inside **Garden** is an array that is an array of structs named **theFlowers**. It gets a set of brackets for the array and another set for the struct. Thus the double square brackets.
diff --git a/apps/remix-ide/docs/unittesting.md b/apps/remix-ide/docs/unittesting.md
new file mode 100644
index 0000000000..e2fc3f0a44
--- /dev/null
+++ b/apps/remix-ide/docs/unittesting.md
@@ -0,0 +1,100 @@
+Unit Testing Plugin
+============
+
+Click the
+![double check](images/a-user-testing-icon.png)
+ icon to get to the `Solidity Unit Testing` plugin.
+
+ If you haven't used this plugin before and are not seeing `double check` icon, you have to activate it from Remix plugin manager.
+
+Go to the plugin manager (by click the ![plug](images/a-plug.png) icon) and load up the unit testing plugin.
+
+![](images/a-unit-testing-from-pm.png)
+
+Now `double check` icon will appear on the left side icon bar. Clicking on icon will load the unit testing module in the side panel.
+
+Alternatively, just select `Solidity` environment from remix IDE home page. This will activate `Solidity Unit Testing` plugin along with `Solidity Compiler`, `Deploy & Run Transactions` & `Solidity Static Analysis` plugins.
+
+![](images/a-unit-testing-feature.png)
+
+Generate
+----------
+Select a solidity file which you want to test and click on the button `Generate`. It will generate a new sample solidity test file **in the current folder** suffixed with `_test`. This file contains the minimum you need for running unit testing.
+
+Write Tests
+-----------
+Write tests to check the functionality of your contract. Remix injects a built-in `assert` library which can be used for testing. Visit the library documentation [here](./assert_library).
+
+Apart from this, Remix allows usage of some special functions to make testing more structural. They are:
+
+* `beforeEach()` - Runs before each test
+* `beforeAll()` - Runs before all tests
+* `afterEach()` - Runs after each test
+* `afterAll()` - Runs after all tests
+
+To get started, see [this simple example](./unittesting_examples.html#simple-example).
+
+Run
+-----
+Once you are done with writing tests, select the _test.sol files in the list and click on the button `Run` to execute the tests in the selected files. The execution will run in a separate environment and the result will be displayed below.
+
+![](images/a-unit-testing-run-result.png)
+
+Stop
+-----
+If you have selected multiple files to run the tests and want to stop the execution, click on `Stop` button. It will stop execution after running the tests for current file.
+
+Customization
+------------------
+Remix facilitates users with various types of customizations to test a contract properly.
+
+**1. Custom Compiler Context**
+
+`Solidity Unit Testing` refers `Solidity Compiler` plugin for compiler configurations. One can provide customized inputs for `Compiler`, `EVM Version` & `Enable Optimization` and these will be the configuration settings used for contract compilation before running unit tests.
+
+![](images/a-unit-testing-custom-compiler-config.png)
+
+**2. Custom Transaction Context**
+
+For a contract method interaction, prime parameters of transaction are `from` address, `value` & `gas`. Usually, we need to test a method's behaviour under different values of these parameters.
+
+Remix provides the functionality of custom `msg.sender` & `msg.value` of transaction using method devdoc like:
+
+```
+/// #sender: account-0
+/// #value: 10
+function checkSenderIs0AndValueis10 () public payable {
+ Assert.equal(msg.sender, TestsAccounts.getAccount(0), "wrong sender in checkSenderIs0AndValueis10");
+ Assert.equal(msg.value, 10, "wrong value in checkSenderIs0AndValueis10");
+}
+```
+Things to keep in mind while using custom transaction context:
+
+1. Parameters must be defined in devdoc of related method
+2. Each parameter key should be prefixed with a hash (**#**) and end with a colon following a space (**: **) like `#sender: ` & `#value: `
+3. For now, customization is available for parameters `sender` & `value` only
+4. Sender is `from` address of a transaction which is accessed using `msg.sender` inside a contract method. It should be defined in a fixed format as '**account-**'
+5. `` varies from `0-2` before remix-ide release v0.10.0 and `0-9` afterwards
+6. `remix_accounts.sol` must be imported in your test file to use custom `sender`
+7. Value is `value` sent along with a transaction in `wei` which is accessed using `msg.value` inside a contract method. It should be a number.
+
+Regarding `gas`, Remix estimates the required gas for each transaction internally. Still if a contract deployment fails with `Out-of-Gas` error, it tries to redeploy it by doubling the gas. Deployment failing with double gas will show error: ```contract deployment failed after trying twice: The contract code couldn't be stored, please check your gas limit```
+
+Various test examples can be seen in [examples](./unittesting_examples) section.
+
+
+Points to remember
+------------------
+
+* A test contract cannot have a method with parameters. Having one such method will show error: `Method 'methodname' can not have parameters inside a test contract`
+* Number of test accounts are `3` before remix-ide release v0.10.0 and `10` afterwards
+* A test file which imports `remix_accounts.sol` might not compile successfully with `Solidity Compiler` plugin but it will work fine with Solidity Unit Testing plugin.
+
+Remix-tests
+----------------------
+
+`remix-tests` is the module which works underneath of remix-ide `Solidity Unit Testing` plugin.
+
+`remix-tests` is an [NPM package](https://www.npmjs.com/package/remix-tests). It can also be used as a CLI/CI solution, supporting node.js. Find more information about this type of usage in the [remix-tests repository](https://github.com/ethereum/remix/tree/master/remix-tests#as-command-line-interface)
+
+For CI implementation example, see [Su Squares contract](https://github.com/su-squares/ethereum-contract/tree/e542f37d4f8f6c7b07d90a6554424268384a4186) and [Travis build](https://travis-ci.org/su-squares/ethereum-contract/builds/446186067) that uses `remix-tests` for continuous integration testing.
diff --git a/apps/remix-ide/docs/unittesting_examples.md b/apps/remix-ide/docs/unittesting_examples.md
new file mode 100644
index 0000000000..94b6c6fa65
--- /dev/null
+++ b/apps/remix-ide/docs/unittesting_examples.md
@@ -0,0 +1,329 @@
+Testing by Example
+============
+
+Here are some examples which can give you better understanding to plan your tests.
+
+**Note:** Examples in this section are intended to give you a push for development. We don't recommend to rely on them without verifying at your end.
+
+### 1. Simple example
+In this example, we test setting & getting variables.
+
+Contract/Program to be tested: `Simple_storage.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+
+contract SimpleStorage {
+ uint public storedData;
+
+ constructor() public {
+ storedData = 100;
+ }
+
+ function set(uint x) public {
+ storedData = x;
+ }
+
+ function get() public view returns (uint retVal) {
+ return storedData;
+ }
+}
+```
+Test contract/program: `simple_storage_test.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+import "remix_tests.sol";
+import "./Simple_storage.sol";
+
+contract MyTest {
+ SimpleStorage foo;
+
+ // beforeEach works before running each test
+ function beforeEach() public {
+ foo = new SimpleStorage();
+ }
+
+ /// Test if initial value is set correctly
+ function initialValueShouldBe100() public returns (bool) {
+ return Assert.equal(foo.get(), 100, "initial value is not correct");
+ }
+
+ /// Test if value is set as expected
+ function valueIsSet200() public returns (bool) {
+ foo.set(200);
+ return Assert.equal(foo.get(), 200, "value is not 200");
+ }
+}
+```
+
+### 2. Testing a method involving `msg.sender`
+In Solidity, `msg.sender` plays a great role in access management of a smart contract methods interaction. Different `msg.sender` can help to test a contract involving multiple accounts with different roles. Here is an example for testing such case:
+
+Contract/Program to be tested: `Sender.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+contract Sender {
+ address private owner;
+
+ constructor() public {
+ owner = msg.sender;
+ }
+
+ function updateOwner(address newOwner) public {
+ require(msg.sender == owner, "only current owner can update owner");
+ owner = newOwner;
+ }
+
+ function getOwner() public view returns (address) {
+ return owner;
+ }
+}
+```
+
+Test contract/program: `Sender_test.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+import "remix_tests.sol"; // this import is automatically injected by Remix
+import "remix_accounts.sol";
+import "./Sender.sol";
+
+// Inherit 'Sender' contract
+contract SenderTest is Sender {
+ /// Define variables referring to different accounts
+ address acc0;
+ address acc1;
+ address acc2;
+
+ /// Initiate accounts variable
+ function beforeAll() public {
+ acc0 = TestsAccounts.getAccount(0);
+ acc1 = TestsAccounts.getAccount(1);
+ acc2 = TestsAccounts.getAccount(2);
+ }
+
+ /// Test if initial owner is set correctly
+ function testInitialOwner() public {
+ // account at zero index (account-0) is default account, so current owner should be acc0
+ Assert.equal(getOwner(), acc0, 'owner should be acc0');
+ }
+
+ /// Update owner first time
+ /// This method will be called by default account(account-0) as there is no custom sender defined
+ function updateOwnerOnce() public {
+ // check method caller is as expected
+ Assert.ok(msg.sender == acc0, 'caller should be default account i.e. acc0');
+ // update owner address to acc1
+ updateOwner(acc1);
+ // check if owner is set to expected account
+ Assert.equal(getOwner(), acc1, 'owner should be updated to acc1');
+ }
+
+ /// Update owner again by defining custom sender
+ /// #sender: account-1 (sender is account at index '1')
+ function updateOwnerOnceAgain() public {
+ // check if caller is custom and is as expected
+ Assert.ok(msg.sender == acc1, 'caller should be custom account i.e. acc1');
+ // update owner address to acc2. This will be successful because acc1 is current owner & caller both
+ updateOwner(acc2);
+ // check if owner is set to expected account i.e. account2
+ Assert.equal(getOwner(), acc2, 'owner should be updated to acc2');
+ }
+}
+```
+
+### 3. Testing method execution
+
+With Solidity, one can directly verify the changes made by a method in storage by retrieving those variables from a contract. But testing for a successful method execution takes some strategy. Well that is not entirely true, when a test is successful - it is usually obvious why it passed. However, when a test fails, it is essential to understand why it failed.
+
+To help in such cases, Solidity introduced the `try-catch` statement in version `0.6.0`. Previously, we had to use low-level calls to track down what was going on.
+
+Here is an example test file that use both **try-catch** blocks and **low level calls**:
+
+Contract/Program to be tested: `AttendanceRegister.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+contract AttendanceRegister {
+ struct Student{
+ string name;
+ uint class;
+ }
+
+ event Added(string name, uint class, uint time);
+
+ mapping(uint => Student) public register; // roll number => student details
+
+ function add(uint rollNumber, string memory name, uint class) public returns (uint256){
+ require(class > 0 && class <= 12, "Invalid class");
+ require(register[rollNumber].class == 0, "Roll number not available");
+ Student memory s = Student(name, class);
+ register[rollNumber] = s;
+ emit Added(name, class, now);
+ return rollNumber;
+ }
+
+ function getStudentName(uint rollNumber) public view returns (string memory) {
+ return register[rollNumber].name;
+ }
+}
+```
+
+Test contract/program: `AttendanceRegister_test.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+import "remix_tests.sol"; // this import is automatically injected by Remix.
+import "./AttendanceRegister.sol";
+
+contract AttendanceRegisterTest {
+
+ AttendanceRegister ar;
+
+ /// 'beforeAll' runs before all other tests
+ function beforeAll () public {
+ // Create an instance of contract to be tested
+ ar = new AttendanceRegister();
+ }
+
+ /// For solidity version greater or equal to 0.6.0,
+ /// See: https://solidity.readthedocs.io/en/v0.6.0/control-structures.html#try-catch
+ /// Test 'add' using try-catch
+ function testAddSuccessUsingTryCatch() public {
+ // This will pass
+ try ar.add(101, 'secondStudent', 11) returns (uint256 r) {
+ Assert.equal(r, 101, 'wrong rollNumber');
+ } catch Error(string memory /*reason*/) {
+ // This is executed in case
+ // revert was called inside getData
+ // and a reason string was provided.
+ Assert.ok(false, 'failed with reason');
+ } catch (bytes memory /*lowLevelData*/) {
+ // This is executed in case revert() was used
+ // or there was a failing assertion, division
+ // by zero, etc. inside getData.
+ Assert.ok(false, 'failed unexpected');
+ }
+ }
+
+ /// Test failure case of 'add' using try-catch
+ function testAddFailureUsingTryCatch1() public {
+ // This will revert on 'require(class > 0 && class <= 12, "Invalid class");' for class '13'
+ try ar.add(101, 'secondStudent', 13) returns (uint256 r) {
+ Assert.ok(false, 'method execution should fail');
+ } catch Error(string memory reason) {
+ // Compare failure reason, check if it is as expected
+ Assert.equal(reason, 'Invalid class', 'failed with unexpected reason');
+ } catch (bytes memory /*lowLevelData*/) {
+ Assert.ok(false, 'failed unexpected');
+ }
+ }
+
+ /// Test another failure case of 'add' using try-catch
+ function testAddFailureUsingTryCatch2() public {
+ // This will revert on 'require(register[rollNumber].class == 0, "Roll number not available");' for rollNumber '101'
+ try ar.add(101, 'secondStudent', 11) returns (uint256 r) {
+ Assert.ok(false, 'method execution should fail');
+ } catch Error(string memory reason) {
+ // Compare failure reason, check if it is as expected
+ Assert.equal(reason, 'Roll number not available', 'failed with unexpected reason');
+ } catch (bytes memory /*lowLevelData*/) {
+ Assert.ok(false, 'failed unexpected');
+ }
+ }
+
+ /// For solidity version less than 0.6.0, low level call can be used
+ /// See: https://solidity.readthedocs.io/en/v0.6.0/units-and-global-variables.html#members-of-address-types
+ /// Test success case of 'add' using low level call
+ function testAddSuccessUsingCall() public {
+ bytes memory methodSign = abi.encodeWithSignature('add(uint256,string,uint256)', 102, 'firstStudent', 10);
+ (bool success, bytes memory data) = address(ar).call(methodSign);
+ // 'success' stores the result in bool, this can be used to check whether method call was successful
+ Assert.equal(success, true, 'execution should be successful');
+ // 'data' stores the returned data which can be decoded to get the actual result
+ uint rollNumber = abi.decode(data, (uint256));
+ // check if result is as expected
+ Assert.equal(rollNumber, 102, 'wrong rollNumber');
+ }
+
+ /// Test failure case of 'add' using low level call
+ function testAddFailureUsingCall() public {
+ bytes memory methodSign = abi.encodeWithSignature('add(uint256,string,uint256)', 102, 'duplicate', 10);
+ (bool success, bytes memory data) = address(ar).call(methodSign);
+ // 'success' will be false if method execution is not successful
+ Assert.equal(success, false, 'execution should be successful');
+ }
+}
+```
+
+
+### 4. Testing a method involving `msg.value`
+In Solidity, ether can be passed along with a method call which is accessed inside contract as `msg.value`. Sometimes, multiple calculations in a method are performed based on `msg.value` which can be tested with various values using Remix's Custom transaction context. See the example:
+
+Contract/Program to be tested: `Value.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+contract Value {
+ uint256 public tokenBalance;
+
+ constructor() public {
+ tokenBalance = 0;
+ }
+
+ function addValue() payable public {
+ tokenBalance = tokenBalance + (msg.value/10);
+ }
+
+ function getTokenBalance() view public returns (uint256) {
+ return tokenBalance;
+ }
+}
+```
+Test contract/program: `Value_test.sol`
+
+```
+pragma solidity >=0.4.22 <0.7.0;
+import "remix_tests.sol";
+import "./Value.sol";
+
+contract ValueTest{
+ Value v;
+
+ function beforeAll() public {
+ // create a new instance of Value contract
+ v = new Value();
+ }
+
+ /// Test initial balance
+ function testInitialBalance() public {
+ // initially token balance should be 0
+ Assert.equal(v.getTokenBalance(), 0, 'token balance should be 0 initially');
+ }
+
+ /// For Solidity version greater than 0.6.1
+ /// Test 'addValue' execution by passing custom ether amount
+ /// #value: 200
+ function addValueOnce() public payable {
+ // check if value is same as provided through devdoc
+ Assert.equal(msg.value, 200, 'value should be 200');
+ // execute 'addValue'
+ v.addValue{gas: 40000, value: 200}(); // introduced in Solidity version 0.6.2
+ // As per the calculation, check the total balance
+ Assert.equal(v.getTokenBalance(), 20, 'token balance should be 20');
+ }
+
+ /// For Solidity version less than 0.6.2
+ /// Test 'addValue' execution by passing custom ether amount again using low level call
+ /// #value: 100
+ function addValueAgain() public payable {
+ Assert.equal(msg.value, 100, 'value should be 100');
+ bytes memory methodSign = abi.encodeWithSignature('addValue()');
+ (bool success, bytes memory data) = address(v).call.gas(40000).value(100)(methodSign);
+ Assert.equal(success, true, 'execution should be successful');
+ Assert.equal(v.getTokenBalance(), 30, 'token balance should be 30');
+ }
+}
+```
diff --git a/apps/remix-ide/embark/README.md b/apps/remix-ide/embark/README.md
new file mode 100644
index 0000000000..bea37e1f35
--- /dev/null
+++ b/apps/remix-ide/embark/README.md
@@ -0,0 +1,45 @@
+# embark-remix
+An Embark plugin that allows Remix to connect to a local DApp via [`remixd`](https://github.com/ethereum/remixd). This plugin serves a local copy of Remix IDE from the machine running the plugin or alternatively allows connection from the public [Remix IDE](https://remix.ethereum.org). The URL of the Remix IDE can be specified in the Embark plugin options, specified below.
+
+## Options
+To configure options for the `embark-remix` plugin, modify the `plugins` property of `embark.json` in the DApp.
+
+### How to use default options
+To pass no options to the plugin and use the defaults, simply use an empty object:
+```
+"plugins": {
+ "embark-remix": {}
+}
+```
+This will provide the default options to the plugin (shown below).
+
+### Available options
+The available options for this plugin are below. Default options are shown below. This is equivalent to passing an empty object `{}`.
+```
+"plugins": {
+ "embark-remix": {
+ "readOnly": false,
+ "remixIde": {
+ "protocol": "http",
+ "host": "localhost",
+ "port": 8088
+ }
+ }
+}
+```
+
+
+`readOnly` does not let Remix update the contents on the local filesystem.
+ - Default: `false`
+
+`remixIde` specifies the URL that the Remix IDE will be served from. If this is a `localhost` URL, the plugin creates a server that is responsible for listening on this URL.
+ - Default: `(see above)`
+
+If it is preferred to connect to the public Remix IDE at https://remix.ethereum.org, set the `remixIde` config to:
+```
+"remixIde": {
+ "protocol": "https",
+ "host": "remix.ethereum.org",
+ "port": false
+}
+```
\ No newline at end of file
diff --git a/apps/remix-ide/embark/index.js b/apps/remix-ide/embark/index.js
new file mode 100644
index 0000000000..dcd0b64b39
--- /dev/null
+++ b/apps/remix-ide/embark/index.js
@@ -0,0 +1,66 @@
+const httpServer = require('http-server')
+const remixd = require('remixd')
+const path = require('path')
+const merge = require('merge')
+const colors = require('colors')
+
+const DEFAULT_OPTIONS = {
+ protocol: 'http',
+ host: 'localhost',
+ port: '8088'
+}
+
+module.exports = (embark) => {
+ // plugin options
+ const readOnly = embark.pluginConfig.readOnly || false
+ const { protocol, host, port } = merge.recursive(DEFAULT_OPTIONS, embark.pluginConfig.remixIde)
+
+ // globals
+ const remixIdeUrl = `${protocol}://${host}` + `${port ? `:${port}` : ''}`
+ const sharedFolder = path.join(__dirname, '../../')
+ const sharedFolderService = remixd.services.sharedFolder
+ let server
+
+ // setup HTTP server
+ if (['localhost', '127.0.0.1', '0.0.0.0'].includes(host)) {
+ server = httpServer.createServer({
+ root: path.join(__dirname, '../../node_modules/remix-ide')
+ })
+ server.listen(port, '127.0.0.1', function () {
+ embark.logger.info('Remix IDE (via embark-remix plugin) available at ' + colors.underline(remixIdeUrl))
+ })
+ } else {
+ embark.logger.info('embark-remix is set to connect to a Remix IDE at ' + colors.underline(remixIdeUrl))
+ }
+
+ // setup Embark service check
+ embark.registerServiceCheck('Remix IDE', (cb) => {
+ return cb({ name: `Remix IDE ${host}:${port}`, status: 'on' })
+ })
+
+ // setup remixd shared folder service
+ const sharedFolderRouter = new remixd.Router(65520, sharedFolderService, { remixIdeUrl }, (webSocket) => {
+ sharedFolderService.setWebSocket(webSocket)
+ sharedFolderService.setupNotifications(sharedFolder)
+ sharedFolderService.sharedFolder(sharedFolder, readOnly)
+ })
+ const killRemixD = sharedFolderRouter.start()
+ const kill = () => {
+ if (server) server.close()
+ embark.logger.info(colors.red('embark-remix stopped'))
+ process.exit()
+ }
+
+ if (process.platform === 'win32') {
+ require('readline').createInterface({
+ input: process.stdin,
+ output: process.stdout
+ }).on('SIGINT', function () {
+ process.emit('SIGINT')
+ })
+ }
+
+ process.on('SIGINT', kill) // catch ctrl-c
+ process.on('SIGTERM', kill) // catch kill
+ process.on('exit', killRemixD)
+}
diff --git a/apps/remix-ide/embark/package.json b/apps/remix-ide/embark/package.json
new file mode 100644
index 0000000000..b665450219
--- /dev/null
+++ b/apps/remix-ide/embark/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "embark-remix",
+ "version": "0.0.2",
+ "description": "load remix IDE from embark environment",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "MIT",
+ "dependencies": {
+ "remix-ide": "latest",
+ "remixd": "latest",
+ "http-server": "latest"
+ }
+}
diff --git a/apps/remix-ide/index.html b/apps/remix-ide/index.html
new file mode 100644
index 0000000000..095c829e7e
--- /dev/null
+++ b/apps/remix-ide/index.html
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+ Remix - Ethereum IDE
+
+
+
+
+
+
+
+
+
diff --git a/apps/remix-ide/manifest.json b/apps/remix-ide/manifest.json
new file mode 100644
index 0000000000..edf7247913
--- /dev/null
+++ b/apps/remix-ide/manifest.json
@@ -0,0 +1,31 @@
+{
+ "name": "Solidity",
+ "description": "Realtime compiler and runtime",
+ "update_url": "https://remix.ethereum.org",
+ "version": "1.1",
+ "manifest_version": 2,
+ "background": {
+ "scripts": ["background.js"],
+ "persistent": true
+ },
+
+ "icons": {
+ "32": "icon.png"
+ },
+
+ "browser_action": {
+ "default_icon": "icon.png"
+ },
+
+ "permissions": [
+ "storage",
+ "tabs",
+ "activeTab",
+ "https://ajax.googleapis.com/",
+ "webRequest",
+ "webRequestBlocking",
+ ""
+ ],
+
+ "content_security_policy": "script-src 'self' https://solc-bin.ethereum.org/; object-src 'self'"
+}
diff --git a/apps/remix-ide/meetings.md b/apps/remix-ide/meetings.md
new file mode 100644
index 0000000000..ec606da328
--- /dev/null
+++ b/apps/remix-ide/meetings.md
@@ -0,0 +1,105 @@
+# Team meeting 04/06/2019
+
+## documentation
+
+#### doc update for release
+
+For each remix IDE PR, check whether the documentation needs to be updated.
+If so, either
+ - update the doc with and link to the PR
+ - create an issue with the label "documentation"
+
+Before releasing (better a few days before), we take time to address documentation issues that *needs* to be done. @rob is committing to checking and organize our work on this.
+
+#### monthly doc update
+
+We setup a monthly call where we read through the documentation and check what should be added / updated / improved
+
+#### move to remix IDE
+
+we move the documentation to the remix-ide repository
+
+## medium post policy
+
+Any post that relates to Ethereum could be put in the remix plublication.
+Although that is not mandatory and left up to the writter.
+
+## guided tour
+
+we still need to validate the framework but "shepherd" seems to be the one.
+
+It will work as a native plugin, started by default.
+Each other native plugin can request a guided tour with:
+`this.call('guidedtour', 'start', 'debugger')`
+Other type of plugin may be able to the native plugin guided tour but we won't push this if the integration is not working out of the box.
+We rather update the remix-plugin doc saying that `guided tour framework name` is the prefferred one.
+
+## web site
+
+we commit to have a public web site for general info about us.
+It won't be a branded web site.
+We are asking a designer for improving the Liana's logo.
+We don't need to have a framework (hugo, hexo) if that's too much overhead.
+@liana is testing out the easiest solution.
+
+## solidity tutorial framework
+
+it will be set of file:
+ - md
+ - solidity contract
+ - test contract
+
+we only support md for now and move to supporting other format if needded.
+It requires the "test" native plugin to extend its API.
+@rob/@francois are managing that.
+
+## remix workshops repository
+
+the current workshop should either be removed or converted to the md tutorial framework.
+@rob/@francois are managing that
+
+
+## coding best practices
+
+Use html "id" only if needed.
+"id" has to be explicit enough so the node can be targeted without using nested css target.
+
+## file manager / file explorer / file provider
+
+They are going to be refactored out to a stand alone ts repo / npm module
+
+## npm module structure
+
+will likely looks like:
+
+RemixProject/component:
+/Treeview
+/tab
+/tabs
+/dialog
+/fs
+
+RemixProject/libs:
+/Solidity
+/Tests
+/FsProvider
+
+RemixProject/IDE
+
+## browser test
+
+a PR (https://github.com/ethereum/remix-ide/pull/1961) is waiting for merging @yann
+It iwll be followed by other PRs, aiming to improve process of writting browser tests.
+
+## desktop version
+
+we will propose an offline version using electron (@yann)
+first steps :
+- put all the public link to the local package
+- basic electron wrapper
+
+## out reach beyond community
+
+We agree it is something interesting to explore,
+It is not 100% dev tool nor remix so we should organize call with other people from EF at least
+
diff --git a/apps/remix-ide/nginx.conf b/apps/remix-ide/nginx.conf
new file mode 100644
index 0000000000..05d9c01c52
--- /dev/null
+++ b/apps/remix-ide/nginx.conf
@@ -0,0 +1,40 @@
+user nginx;
+worker_processes 1;
+
+error_log /var/log/nginx/error.log warn;
+pid /var/run/nginx.pid;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+
+ access_log /var/log/nginx/access.log main;
+
+ sendfile on;
+ keepalive_timeout 300;
+ gzip_disable "msie6";
+
+ include /etc/nginx/conf.d/*.conf;
+
+ server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+
+ root /usr/share/nginx/html;
+
+ index index.html index.htm;
+
+ server_name _;
+
+ location / {
+ try_files $uri $uri/ /index.html;
+ }
+ }
+}
diff --git a/apps/remix-ide/package.json b/apps/remix-ide/package.json
new file mode 100644
index 0000000000..f04505ae39
--- /dev/null
+++ b/apps/remix-ide/package.json
@@ -0,0 +1,207 @@
+{
+ "name": "remix-ide",
+ "version": "v0.10.3",
+ "description": "Extendable Web IDE for Ethereum",
+ "devDependencies": {
+ "@babel/core": "^7.4.5",
+ "@babel/plugin-transform-object-assign": "^7.2.0",
+ "@babel/polyfill": "^7.4.4",
+ "@babel/preset-env": "^7.4.5",
+ "@babel/preset-es2015": "latest",
+ "@babel/preset-es2017": "latest",
+ "@babel/preset-stage-0": "^7.0.0",
+ "@babel/register": "^7.4.4",
+ "@fortawesome/fontawesome-free": "^5.8.1",
+ "@resolver-engine/imports": "^0.3.0",
+ "ace-mode-move": "0.0.1",
+ "ace-mode-solidity": "^0.1.0",
+ "ace-mode-zokrates": "^1.0.0",
+ "async": "^2.1.2",
+ "babel-eslint": "^10.0.0",
+ "babel-plugin-fast-async": "^6.1.2",
+ "babel-plugin-transform-object-rest-spread": "^6.26.0",
+ "babel-plugin-yo-yoify": "^2.0.0",
+ "babelify": "^10.0.0",
+ "brace": "^0.8.0",
+ "browserify": "^16.2.3",
+ "browserify-reload": "^1.0.3",
+ "component-type": "^1.2.1",
+ "copy-text-to-clipboard": "^1.0.4",
+ "csjs-inject": "^1.0.1",
+ "csslint": "^1.0.2",
+ "deep-equal": "^1.0.1",
+ "dotenv": "^8.2.0",
+ "ethereumjs-util": "^6.2.0",
+ "ethers": "^4.0.27",
+ "events": "^3.0.0",
+ "execr": "^1.0.1",
+ "exorcist": "^0.4.0",
+ "fast-async": "^7.0.6",
+ "fast-levenshtein": "^2.0.6",
+ "ganache-cli": "^6.8.1",
+ "gists": "^1.0.1",
+ "ipfs-mini": "^1.1.5",
+ "is-electron": "^2.2.0",
+ "javascript-serialize": "^1.6.1",
+ "jquery": "^3.3.1",
+ "js-base64": "^2.1.9",
+ "js-beautify": "1.6.14",
+ "minixhr": "^3.2.2",
+ "mkdirp": "^0.5.1",
+ "nanohtml": "^1.6.3",
+ "nightwatch": "^0.9.20",
+ "notify-error": "^1.2.0",
+ "npm-link-local": "^1.1.0",
+ "npm-merge-driver": "^2.3.5",
+ "npm-run-all": "^4.0.2",
+ "onchange": "^3.2.1",
+ "remix-analyzer": "0.5.3",
+ "remix-astwalker": "0.0.25",
+ "remix-debug": "0.4.5",
+ "remix-lib": "0.4.30",
+ "remix-simulator": "0.1.9-beta.6",
+ "remix-solidity": "0.3.31",
+ "remix-tabs": "1.0.48",
+ "remix-tests": "0.1.34",
+ "remixd": "0.2.3-alpha.4",
+ "request": "^2.83.0",
+ "rimraf": "^2.6.1",
+ "selenium-standalone": "^6.17.0",
+ "semver": "^6.1.2",
+ "solc": "^0.6.0",
+ "swarmgw": "^0.3.1",
+ "tape": "^4.5.1",
+ "uglify-js": "^2.8.16",
+ "vm-browserify": "0.0.4",
+ "watchify": "^3.9.0",
+ "web3": "1.2.4",
+ "webworkify": "^1.2.1",
+ "yo-yo": "^1.2.2",
+ "yo-yoify": "^3.7.3"
+ },
+ "dependencies": {
+ "@remixproject/engine": "^0.2.5",
+ "http-server": "^0.11.1",
+ "standard": "^8.5.0"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/ethereum/remix-ide.git"
+ },
+ "keywords": [
+ "ethereum",
+ "solidity",
+ "compiler"
+ ],
+ "author": "chriseth",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/ethereum/remix-ide/issues"
+ },
+ "homepage": "https://github.com/ethereum/remix-ide#readme",
+ "standard": {
+ "ignore": [
+ "build/",
+ "src/app/editor/mode-solidity.js",
+ "soljson.js",
+ "assets/js/0.7.7/app.js"
+ ],
+ "parser": "babel-eslint"
+ },
+ "browserify": {
+ "transform": [
+ [
+ "babelify",
+ {
+ "sourceMapsAbsolute": false,
+ "sourceMaps": true,
+ "plugins": [
+ [
+ "module:fast-async",
+ {
+ "runtimePattern": null,
+ "compiler": {
+ "es7": true,
+ "noRuntime": true,
+ "promises": true,
+ "wrapAwait": true
+ }
+ }
+ ],
+ [
+ "module:babel-plugin-yo-yoify"
+ ],
+ [
+ "module:@babel/plugin-transform-object-assign"
+ ]
+ ],
+ "presets": [
+ "@babel/preset-env"
+ ]
+ }
+ ]
+ ]
+ },
+ "bin": {
+ "remix-ide": "./bin/remix-ide"
+ },
+ "scripts": {
+ "setupremix": "npm run linkremixdebug && npm run linkremixlib && npm run linkremixsolidity && npm run linkremixanalyzer && npm run linkremixtests && npm run linkremixsimulator",
+ "pullremix": "git clone https://github.com/ethereum/remix",
+ "linkremixlib": "cd node_modules && rm -rf remix-lib && ln -s ../../remix/remix-lib remix-lib && cd ..",
+ "linkremixsolidity": "cd node_modules && rm -rf remix-solidity && ln -s ../../remix/remix-solidity remix-solidity && cd ..",
+ "linkremixtests": "cd node_modules && rm -rf remix-tests && ln -s ../../remix/remix-tests remix-tests && cd ..",
+ "linkremixdebug": "cd node_modules && rm -rf remix-debug && ln -s ../../remix/remix-debug remix-debug && cd ..",
+ "linkremixanalyzer": "cd node_modules && rm -rf remix-analyzer && ln -s ../../remix/remix-analyzer remix-analyzer && cd ..",
+ "linkremixsimulator": "cd node_modules && rm -rf remix-simulator && ln -s ../../remix/remix-simulator remix-simulator && cd ..",
+ "build": "browserify src/index.js -o build/app.js --exclude solc",
+ "build_debugger": "browserify src/app/debugger/remix-debugger/index.js -o src/app/debugger/remix-debugger/build/app.js",
+ "browsertest": "sleep 5 && npm run nightwatch_local",
+ "csslint": "csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='assets/css/font-awesome.min.css' assets/css/",
+ "downloadsolc_root": "wget --no-check-certificate https://solc-bin.ethereum.org/bin/soljson-v0.6.6+commit.6c089d02.js -O soljson.js",
+ "lint": "standard | notify-error",
+ "make-mock-compiler": "node ci/makeMockCompiler.js",
+ "minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false",
+ "nightwatch_parallel": "nightwatch -e chrome,firefox --config nightwatch.js",
+ "nightwatch_local_firefox": "nightwatch --config nightwatch.js --env firefox",
+ "nightwatch_local_chrome": "nightwatch --config nightwatch.js --env chrome",
+ "nightwatch_local_ballot": "nightwatch ./test-browser/tests/ballot.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_usingWorker": "nightwatch ./test-browser/tests/usingWebWorker.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_libraryDeployment": "nightwatch ./test-browser/tests/libraryDeployment.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_solidityImport": "nightwatch ./test-browser/tests/solidityImport.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_recorder": "nightwatch ./test-browser/tests/recorder.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_transactionExecution": "nightwatch ./test-browser/tests/transactionExecution.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_staticAnalysis": "nightwatch ./test-browser/tests/staticAnalysis.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_signingMessage": "nightwatch ./test-browser/tests/signingMessage.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_specialFunctions": "nightwatch ./test-browser/tests/specialFunctions.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_solidityUnitTests": "nightwatch ./test-browser/tests/solidityUnittests.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_remixd": "nightwatch ./test-browser/tests/remixd.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_terminal": "nightwatch ./test-browser/tests/terminal.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_gist": "nightwatch ./test-browser/tests/gist.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_workspace": "nightwatch ./test-browser/tests/workspace.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_defaultLayout": "nightwatch ./test-browser/tests/defaultLayout.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_pluginManager": "nightwatch ./test-browser/tests/pluginManager.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_publishContract": "nightwatch ./test-browser/tests/publishContract.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_generalSettings": "nightwatch ./test-browser/tests/generalSettings.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_fileExplorer": "nightwatch ./test-browser/tests/fileExplorer.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_debugger": "nightwatch ./test-browser/tests/debugger.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_editor": "nightwatch ./test-browser/tests/editor.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_compiler": "nightwatch ./test-browser/tests/compiler_api.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_txListener": "nightwatch ./test-browser/tests/txListener.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_fileManager": "nightwatch ./test-browser/tests/fileManager_api.test.js --config nightwatch.js --env chrome ",
+ "nightwatch_local_runAndDeploy": "nightwatch ./test-browser/tests/runAndDeploy.js --config nightwatch.js --env chrome-runAndDeploy ",
+ "onchange": "onchange build/app.js -- npm-run-all lint",
+ "prepublish": "mkdirp build; npm-run-all -ls downloadsolc_root build",
+ "remixd": "remixd -s ./contracts --remix-ide http://127.0.0.1:8080",
+ "selenium": "selenium-standalone start",
+ "selenium-install": "selenium-standalone install",
+ "serve": "npx http-server .",
+ "sourcemap": "exorcist --root ../ build/app.js.map > build/app.js",
+ "start": "npm-run-all -lpr serve watch onchange remixd",
+ "test": "csslint && standard && node test/index.js",
+ "test-browser": "npm-run-all -lpr selenium downloadsolc_root make-mock-compiler serve browsertest",
+ "watch": "watchify src/index.js -dv -p browserify-reload -o build/app.js --exclude solc",
+ "reinstall": "rm ./node-modules/ -rf; rm package-lock.json; rm ./build/ -rf; npm install; npm run build",
+ "ganache-cli": "npx ganache-cli"
+ }
+}
diff --git a/apps/remix-ide/release-process.md b/apps/remix-ide/release-process.md
new file mode 100644
index 0000000000..45842919b0
--- /dev/null
+++ b/apps/remix-ide/release-process.md
@@ -0,0 +1,55 @@
+This document includes:
+ - how to update remix.ethereum.org.
+ - how to update remix-alpha.ethereum.org.
+ - how to release remix IDE.
+
+# remix IDE release
+
+ - git fetch origin master
+ - git checkout origin/master
+ - git checkout -b bumpVersion
+ - update package.json version
+ - remove package-lock.json version and generate a new one with `npm install`
+ - merge PR
+ - git fetch origin master
+ - git checkout origin/master
+ - git tag v(version-number)
+ - git push --tags
+ - github-changes -o ethereum -r remix-ide -a --only-pulls --use-commit-body --only-merges --between-tags previous_version...next_version
+ - publish a release in github using the changelog
+ - rm -rf node_modules
+ - npm install
+ - remove all soljson.js files in root folder
+ - npm run build
+ - npm publish
+ - after remix_live is updated, drop the zip (from https://github.com/ethereum/remix-live/) to the release.
+
+# remix-ide beta release
+ - git fetch origin master
+ - git checkout origin/master
+ - git checkout -b bumpVersion
+ - update package.json version to the new version "vx.x.x-beta.1"
+ - remove package-lock/json version and generate a new one with `npm install`
+ - merge PR
+ - git fetch origin master
+ - git checkout origin/master
+ - git tag v(version-number) (with "vx.x.x-beta.1")
+ - git push --tags
+ - github-changes -o ethereum -r remix-ide -a --only-pulls --use-commit-body --only-merges --between-tags previous_version...next_version
+ - publish a beta release in github using the changelog
+ - drop zip file to the beta release (from https://github.com/ethereum/remix-live-alpha)
+
+# remix.ethereum.org update
+
+This is not strictly speaking a release. Updating the remix site is done through the Travis build:
+
+ - git co -b remix_live origin/remix_live
+ - git reset --hard -master-commit-hash-
+ - git push -f origin remix_live
+
+ CircleCI will build automaticaly and remix.ethereum.org will be updated
+
+# remix-alpha.ethereum.org update
+
+remix-alpha.ethereum.org is automaticaly updated every time commits are pushed to master
+
diff --git a/apps/remix-ide/remix_screenshot.png b/apps/remix-ide/remix_screenshot.png
new file mode 100644
index 0000000000..cd7ee83f2d
Binary files /dev/null and b/apps/remix-ide/remix_screenshot.png differ
diff --git a/apps/remix-ide/research-project.md b/apps/remix-ide/research-project.md
new file mode 100644
index 0000000000..1d0a37db0e
--- /dev/null
+++ b/apps/remix-ide/research-project.md
@@ -0,0 +1,9 @@
+# Research Project: Improving the Usability of Remix
+
+Researchers from the University of Münster (Germany) and Innsbruck (Austria) are conducting a research project on improving the usability of Remix. Part of the project is to develop a questionnaire and to pretest it in a pilot study. We kindly ask you to **take part in the pilot study** by visiting http://informatik-remix.uibk.ac.at. Your participation is highly appreciated and will contribute to research on Smart Contract development.
+
+If you have any questions, please contact the researcher in charge:
+Dominique Machuletz
+Department of Information Systems
+University of Münster, Germany
+d.machuletz@uni-muenster.de
diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js
new file mode 100644
index 0000000000..8e049113e2
--- /dev/null
+++ b/apps/remix-ide/src/app.js
@@ -0,0 +1,448 @@
+'use strict'
+
+var isElectron = require('is-electron')
+var csjs = require('csjs-inject')
+var yo = require('yo-yo')
+var remixLib = require('@remix-project/remix-lib')
+var registry = require('./global/registry')
+var loadFileFromParent = require('./loadFilesFromParent')
+var { OffsetToLineColumnConverter } = require('./lib/offsetToLineColumnConverter')
+var QueryParams = require('./lib/query-params')
+var GistHandler = require('./lib/gist-handler')
+var Storage = remixLib.Storage
+var RemixDProvider = require('./app/files/remixDProvider')
+var Config = require('./config')
+var Renderer = require('./app/ui/renderer')
+var examples = require('./app/editor/example-contracts')
+var modalDialogCustom = require('./app/ui/modal-dialog-custom')
+var FileManager = require('./app/files/fileManager')
+var FileProvider = require('./app/files/fileProvider')
+var toolTip = require('./app/ui/tooltip')
+var CompilerMetadata = require('./app/files/compiler-metadata')
+var CompilerImport = require('./app/compiler/compiler-imports')
+
+const Blockchain = require('./blockchain/blockchain.js')
+const PluginUDapp = require('./blockchain/pluginUDapp.js')
+
+const PluginManagerComponent = require('./app/components/plugin-manager-component')
+const CompilersArtefacts = require('./app/compiler/compiler-artefacts')
+
+const CompileTab = require('./app/tabs/compile-tab')
+const SettingsTab = require('./app/tabs/settings-tab')
+const AnalysisTab = require('./app/tabs/analysis-tab')
+const DebuggerTab = require('./app/tabs/debugger-tab')
+const TestTab = require('./app/tabs/test-tab')
+const FilePanel = require('./app/panels/file-panel')
+const Editor = require('./app/editor/editor')
+const Terminal = require('./app/panels/terminal')
+const ContextualListener = require('./app/editor/contextualListener')
+import { basicLogo } from './app/ui/svgLogo'
+
+import { RunTab, makeUdapp } from './app/udapp'
+
+import PanelsResize from './lib/panels-resize'
+import { Engine } from '@remixproject/engine'
+import { RemixAppManager } from './remixAppManager'
+import { FramingService } from './framingService'
+import { MainView } from './app/panels/main-view'
+import { ThemeModule } from './app/tabs/theme-module'
+import { NetworkModule } from './app/tabs/network-module'
+import { Web3ProviderModule } from './app/tabs/web3-provider'
+import { SidePanel } from './app/components/side-panel'
+import { HiddenPanel } from './app/components/hidden-panel'
+import { VerticalIcons } from './app/components/vertical-icons'
+import { LandingPage } from './app/ui/landing-page/landing-page'
+import { MainPanel } from './app/components/main-panel'
+import FetchAndCompile from './app/compiler/compiler-sourceVerifier-fetchAndCompile'
+
+import migrateFileSystem from './migrateFileSystem'
+
+var css = csjs`
+ html { box-sizing: border-box; }
+ *, *:before, *:after { box-sizing: inherit; }
+ body {
+ /* font: 14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; */
+ font-size : .8rem;
+ }
+ pre {
+ overflow-x: auto;
+ }
+ .remixIDE {
+ width : 100vw;
+ height : 100vh;
+ overflow : hidden;
+ flex-direction : row;
+ display : flex;
+ }
+ .mainpanel {
+ display : flex;
+ flex-direction : column;
+ overflow : hidden;
+ flex : 1;
+ }
+ .iconpanel {
+ display : flex;
+ flex-direction : column;
+ overflow : hidden;
+ width : 50px;
+ user-select : none;
+ }
+ .sidepanel {
+ display : flex;
+ flex-direction : row-reverse;
+ width : 320px;
+ }
+ .highlightcode {
+ position : absolute;
+ z-index : 20;
+ background-color : var(--info);
+ }
+ .highlightcode_fullLine {
+ position : absolute;
+ z-index : 20;
+ background-color : var(--info);
+ opacity : 0.5;
+ }
+ .centered {
+ position : fixed;
+ top : 20%;
+ left : 45%;
+ width : 200px;
+ height : 200px;
+ }
+ .centered svg path {
+ fill: var(--secondary);
+ }
+ .centered svg polygon {
+ fill: var(--secondary);
+ }
+`
+
+class App {
+ constructor (api = {}, events = {}, opts = {}) {
+ var self = this
+ self.appManager = new RemixAppManager({})
+ self._components = {}
+ self._view = {}
+ self._view.splashScreen = yo`
+
+ ${basicLogo()}
+
+ REMIX IDE
+
+
+ `
+ document.body.appendChild(self._view.splashScreen)
+
+ // setup storage
+ const configStorage = new Storage('config-v0.8:')
+
+ // load app config
+ const config = new Config(configStorage)
+ registry.put({api: config, name: 'config'})
+
+ // load file system
+ self._components.filesProviders = {}
+ self._components.filesProviders['browser'] = new FileProvider('browser')
+ registry.put({api: self._components.filesProviders['browser'], name: 'fileproviders/browser'})
+ self._components.filesProviders['localhost'] = new RemixDProvider(self.appManager)
+ registry.put({api: self._components.filesProviders['localhost'], name: 'fileproviders/localhost'})
+ registry.put({api: self._components.filesProviders, name: 'fileproviders'})
+
+ migrateFileSystem(self._components.filesProviders['browser'])
+ }
+
+ init () {
+ var self = this
+ run.apply(self)
+ }
+
+ render () {
+ var self = this
+ if (self._view.el) return self._view.el
+ // not resizable
+ self._view.iconpanel = yo`
+
+ ${''}
+
+ `
+
+ // center panel, resizable
+ self._view.sidepanel = yo`
+
+ ${''}
+
+ `
+
+ // handle the editor + terminal
+ self._view.mainpanel = yo`
+
+ ${''}
+
+ `
+
+ self._components.resizeFeature = new PanelsResize(self._view.sidepanel)
+
+ self._view.el = yo`
+
+ ${self._view.iconpanel}
+ ${self._view.sidepanel}
+ ${self._components.resizeFeature.render()}
+ ${self._view.mainpanel}
+
+ `
+ return self._view.el
+ }
+}
+
+module.exports = App
+
+async function run () {
+ var self = this
+
+ // check the origin and warn message
+ if (window.location.hostname === 'yann300.github.io') {
+ modalDialogCustom.alert('This UNSTABLE ALPHA branch of Remix has been moved to http://ethereum.github.io/remix-live-alpha.')
+ } else if (window.location.hostname === 'remix-alpha.ethereum.org' ||
+ (window.location.hostname === 'ethereum.github.io' && window.location.pathname.indexOf('/remix-live-alpha') === 0)) {
+ modalDialogCustom.alert(`Welcome to the Remix alpha instance. Please use it to try out latest features. But use preferably https://remix.ethereum.org for any production work.`)
+ } else if (window.location.protocol.indexOf('http') === 0 &&
+ window.location.hostname !== 'remix.ethereum.org' &&
+ window.location.hostname !== 'localhost' &&
+ window.location.hostname !== '127.0.0.1') {
+ modalDialogCustom.alert(`The Remix IDE has moved to http://remix.ethereum.org.\n
+This instance of Remix you are visiting WILL NOT BE UPDATED.\n
+Please make a backup of your contracts and start using http://remix.ethereum.org`)
+ }
+ if (window.location.protocol.indexOf('https') === 0) {
+ toolTip('You are using an `https` connection. Please switch to `http` if you are using Remix against an `http Web3 provider` or allow Mixed Content in your browser.')
+ }
+
+ const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080']
+ // workaround for Electron support
+ if (!isElectron() && !hosts.includes(window.location.host)) {
+ // Oops! Accidentally trigger refresh or bookmark.
+ window.onbeforeunload = function () {
+ return 'Are you sure you want to leave?'
+ }
+ }
+
+ // APP_MANAGER
+ const appManager = self.appManager
+ const pluginLoader = appManager.pluginLoader
+ const workspace = pluginLoader.get()
+ const engine = new Engine(appManager)
+ engine.setPluginOption = ({ name, kind }) => {
+ if (kind === 'provider') return {queueTimeout: 60000 * 2}
+ if (name === 'LearnEth') return {queueTimeout: 60000}
+ return {queueTimeout: 10000}
+ }
+ await engine.onload()
+
+ // SERVICES
+ // ----------------- import content servive ------------------------
+ const contentImport = new CompilerImport()
+ // ----------------- theme servive ---------------------------------
+ const themeModule = new ThemeModule(registry)
+ registry.put({api: themeModule, name: 'themeModule'})
+ themeModule.initTheme(() => {
+ setTimeout(() => {
+ document.body.removeChild(self._view.splashScreen)
+ self._view.el.style.visibility = 'visible'
+ }, 1500)
+ })
+ // ----------------- editor servive ----------------------------
+ const editor = new Editor({}, themeModule) // wrapper around ace editor
+ registry.put({api: editor, name: 'editor'})
+ editor.event.register('requiringToSaveCurrentfile', () => fileManager.saveCurrentFile())
+
+ // ----------------- fileManager servive ----------------------------
+ const fileManager = new FileManager(editor, appManager)
+ registry.put({api: fileManager, name: 'filemanager'})
+
+ const blockchain = new Blockchain(registry.get('config').api)
+ const pluginUdapp = new PluginUDapp(blockchain)
+
+ // ----------------- compilation metadata generation servive ---------
+ const compilerMetadataGenerator = new CompilerMetadata(blockchain, fileManager, registry.get('config').api)
+ // ----------------- compilation result service (can keep track of compilation results) ----------------------------
+ const compilersArtefacts = new CompilersArtefacts() // store all the compilation results (key represent a compiler name)
+ registry.put({api: compilersArtefacts, name: 'compilersartefacts'})
+
+ // service which fetch contract artifacts from sourve-verify, put artifacts in remix and compile it
+ const fetchAndCompile = new FetchAndCompile()
+ // ----------------- network service (resolve network id / name) -----
+ const networkModule = new NetworkModule(blockchain)
+ // ----------------- represent the current selected web3 provider ----
+ const web3Provider = new Web3ProviderModule(blockchain)
+ // ----------------- convert offset to line/column service -----------
+ const offsetToLineColumnConverter = new OffsetToLineColumnConverter()
+ registry.put({api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter'})
+
+ // -------------------Terminal----------------------------------------
+
+ const terminal = new Terminal(
+ { appManager, blockchain },
+ {
+ getPosition: (event) => {
+ var limitUp = 36
+ var limitDown = 20
+ var height = window.innerHeight
+ var newpos = (event.pageY < limitUp) ? limitUp : event.pageY
+ newpos = (newpos < height - limitDown) ? newpos : height - limitDown
+ return height - newpos
+ }
+ }
+ )
+ makeUdapp(blockchain, compilersArtefacts, (domEl) => terminal.logHtml(domEl))
+
+ const contextualListener = new ContextualListener({editor})
+
+ engine.register([
+ contentImport,
+ themeModule,
+ editor,
+ fileManager,
+ compilerMetadataGenerator,
+ compilersArtefacts,
+ networkModule,
+ offsetToLineColumnConverter,
+ contextualListener,
+ terminal,
+ web3Provider,
+ fetchAndCompile
+ ])
+
+ // LAYOUT & SYSTEM VIEWS
+ const appPanel = new MainPanel()
+ const mainview = new MainView(contextualListener, editor, appPanel, fileManager, appManager, terminal)
+ registry.put({ api: mainview, name: 'mainview' })
+
+ engine.register(appPanel)
+
+ // those views depend on app_manager
+ const menuicons = new VerticalIcons(appManager)
+ const landingPage = new LandingPage(appManager, menuicons)
+ const sidePanel = new SidePanel(appManager, menuicons)
+ const hiddenPanel = new HiddenPanel()
+ const pluginManagerComponent = new PluginManagerComponent(appManager, engine)
+ const filePanel = new FilePanel(appManager)
+ let settings = new SettingsTab(
+ registry.get('config').api,
+ editor,
+ appManager
+ )
+
+ // adding Views to the DOM
+ self._view.mainpanel.appendChild(mainview.render())
+ self._view.iconpanel.appendChild(menuicons.render())
+ self._view.sidepanel.appendChild(sidePanel.render())
+ document.body.appendChild(hiddenPanel.render()) // Hidden Panel is display none, it can be directly on body
+
+ engine.register([
+ menuicons,
+ landingPage,
+ hiddenPanel,
+ sidePanel,
+ pluginManagerComponent,
+ filePanel,
+ settings
+ ])
+
+ // CONTENT VIEWS & DEFAULT PLUGINS
+ const compileTab = new CompileTab(
+ editor,
+ registry.get('config').api,
+ new Renderer(),
+ registry.get('fileproviders/browser').api,
+ registry.get('filemanager').api
+ )
+ const run = new RunTab(
+ blockchain,
+ pluginUdapp,
+ registry.get('config').api,
+ registry.get('filemanager').api,
+ registry.get('editor').api,
+ filePanel,
+ registry.get('compilersartefacts').api,
+ networkModule,
+ mainview,
+ registry.get('fileproviders/browser').api,
+ )
+ const analysis = new AnalysisTab(registry)
+ const debug = new DebuggerTab(blockchain)
+ const test = new TestTab(
+ registry.get('filemanager').api,
+ filePanel,
+ compileTab,
+ appManager,
+ new Renderer()
+ )
+
+ engine.register([
+ compileTab,
+ run,
+ debug,
+ analysis,
+ test,
+ filePanel.remixdHandle
+ ])
+
+ try {
+ engine.register(await appManager.registeredPlugins())
+ } catch (e) {
+ console.log('couldn\'t register iframe plugins', e.message)
+ }
+
+ await appManager.activatePlugin(['contentImport', 'theme', 'editor', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'web3Provider', 'offsetToLineColumnConverter'])
+ await appManager.activatePlugin(['mainPanel', 'menuicons'])
+ await appManager.activatePlugin(['sidePanel']) // activating host plugin separately
+ await appManager.activatePlugin(['home', 'hiddenPanel', 'pluginManager', 'fileExplorers', 'settings', 'contextualListener', 'scriptRunner', 'terminal', 'fetchAndCompile'])
+
+ const queryParams = new QueryParams()
+ const params = queryParams.get()
+
+ // Set workspace after initial activation
+ if (Array.isArray(workspace)) {
+ try {
+ await appManager.activatePlugin(workspace)
+ } catch (e) {
+ console.error(e)
+ }
+ } else {
+ // activate solidity plugin
+ appManager.ensureActivated('solidity')
+ appManager.ensureActivated('udapp')
+ }
+
+ // Load and start the service who manager layout and frame
+ const framingService = new FramingService(sidePanel, menuicons, mainview, this._components.resizeFeature)
+ framingService.start(params)
+
+ // If plugins are loaded from the URL params, we focus on the last one.
+ if (pluginLoader.current === 'queryParams' && Array.isArray(workspace) && workspace.length > 0) menuicons.select(workspace[workspace.length - 1])
+
+ // get the file list from the parent iframe
+ loadFileFromParent(fileManager)
+
+ // get the file from gist
+ const gistHandler = new GistHandler()
+ const loadedFromGist = gistHandler.loadFromGist(params, fileManager)
+ if (!loadedFromGist) {
+ // insert example contracts if there are no files to show
+ self._components.filesProviders['browser'].resolveDirectory('/', (error, filesList) => {
+ if (error) console.error(error)
+ if (Object.keys(filesList).length === 0) {
+ for (let file in examples) {
+ fileManager.writeFile(examples[file].name, examples[file].content)
+ }
+ }
+ })
+ }
+
+ if (isElectron()) {
+ appManager.activatePlugin('remixd')
+ }
+
+ if (params.embed) framingService.embed()
+}
diff --git a/apps/remix-ide/src/app/compiler/compiler-abstract.js b/apps/remix-ide/src/app/compiler/compiler-abstract.js
new file mode 100644
index 0000000000..fcfb32a827
--- /dev/null
+++ b/apps/remix-ide/src/app/compiler/compiler-abstract.js
@@ -0,0 +1,46 @@
+'use strict'
+var remixLib = require('@remix-project/remix-lib')
+var txHelper = remixLib.execution.txHelper
+
+module.exports = class CompilerAbstract {
+ constructor (languageversion, data, source) {
+ this.languageversion = languageversion
+ this.data = data
+ this.source = source // source code
+ }
+
+ getContracts () {
+ return this.data.contracts
+ }
+
+ getContract (name) {
+ return txHelper.getContract(name, this.data.contracts)
+ }
+
+ visitContracts (calllback) {
+ return txHelper.visitContracts(this.data.contracts, calllback)
+ }
+
+ getData () {
+ return this.data
+ }
+
+ getAsts () {
+ return this.data.sources // ast
+ }
+
+ getSourceName (fileIndex) {
+ if (this.data && this.data.sources) {
+ return Object.keys(this.data.sources)[fileIndex]
+ } else if (Object.keys(this.source.sources).length === 1) {
+ // if we don't have ast, we return the only one filename present.
+ const sourcesArray = Object.keys(this.source.sources)
+ return sourcesArray[0]
+ }
+ return null
+ }
+
+ getSourceCode () {
+ return this.source
+ }
+}
diff --git a/apps/remix-ide/src/app/compiler/compiler-artefacts.js b/apps/remix-ide/src/app/compiler/compiler-artefacts.js
new file mode 100644
index 0000000000..327c9c3e36
--- /dev/null
+++ b/apps/remix-ide/src/app/compiler/compiler-artefacts.js
@@ -0,0 +1,76 @@
+'use strict'
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+import CompilerAbstract from './compiler-abstract'
+
+const profile = {
+ name: 'compilerArtefacts',
+ methods: [],
+ events: [],
+ version: packageJson.version
+}
+
+module.exports = class CompilerArtefacts extends Plugin {
+ constructor () {
+ super(profile)
+ this.compilersArtefacts = {}
+ this.compilersArtefactsPerFile = {}
+ }
+
+ clear () {
+ this.compilersArtefacts = {}
+ this.compilersArtefactsPerFile = {}
+ }
+
+ onActivation () {
+ const saveCompilationPerFileResult = (file, source, languageVersion, data) => {
+ this.compilersArtefactsPerFile[file] = new CompilerAbstract(languageVersion, data, source)
+ }
+
+ this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
+ this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
+ saveCompilationPerFileResult(file, source, languageVersion, data)
+ })
+
+ this.on('vyper', 'compilationFinished', (file, source, languageVersion, data) => {
+ this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
+ saveCompilationPerFileResult(file, source, languageVersion, data)
+ })
+
+ this.on('lexon', 'compilationFinished', (file, source, languageVersion, data) => {
+ this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
+ saveCompilationPerFileResult(file, source, languageVersion, data)
+ })
+
+ this.on('yulp', 'compilationFinished', (file, source, languageVersion, data) => {
+ this.compilersArtefacts['__last'] = new CompilerAbstract(languageVersion, data, source)
+ saveCompilationPerFileResult(file, source, languageVersion, data)
+ })
+ }
+
+ getAllContractDatas () {
+ const contractsData = {}
+ Object.keys(this.compilersArtefactsPerFile).map((targetFile) => {
+ const contracts = this.compilersArtefactsPerFile[targetFile].getContracts()
+ Object.keys(contracts).map((file) => { contractsData[file] = contracts[file] })
+ })
+ // making sure we save last compilation result in there
+ if (this.compilersArtefacts['__last']) {
+ const contracts = this.compilersArtefacts['__last'].getContracts()
+ Object.keys(contracts).map((file) => { contractsData[file] = contracts[file] })
+ }
+ return contractsData
+ }
+
+ addResolvedContract (address, compilerData) {
+ this.compilersArtefacts[address] = compilerData
+ }
+
+ isResolved (address) {
+ return this.compilersArtefacts[address] !== undefined
+ }
+
+ get (key) {
+ return this.compilersArtefacts[key]
+ }
+}
diff --git a/apps/remix-ide/src/app/compiler/compiler-helpers.js b/apps/remix-ide/src/app/compiler/compiler-helpers.js
new file mode 100644
index 0000000000..b5b84dea0a
--- /dev/null
+++ b/apps/remix-ide/src/app/compiler/compiler-helpers.js
@@ -0,0 +1,20 @@
+'use strict'
+import { canUseWorker, urlFromVersion } from './compiler-utils'
+import { Compiler } from '@remix-project/remix-solidity'
+import CompilerAbstract from './compiler-abstract'
+
+export const compile = async (compilationTargets, settings) => {
+ return await (() => {
+ return new Promise((resolve, reject) => {
+ const compiler = new Compiler(() => {})
+ compiler.set('evmVersion', settings.evmVersion)
+ compiler.set('optimize', settings.optimize)
+ compiler.set('language', settings.language)
+ compiler.loadVersion(canUseWorker(settings.version), urlFromVersion(settings.version))
+ compiler.event.register('compilationFinished', (success, compilationData, source) => {
+ resolve(new CompilerAbstract(settings.version, compilationData, source))
+ })
+ compiler.event.register('compilerLoaded', _ => compiler.compile(compilationTargets, ''))
+ })
+ })()
+}
diff --git a/apps/remix-ide/src/app/compiler/compiler-imports.js b/apps/remix-ide/src/app/compiler/compiler-imports.js
new file mode 100644
index 0000000000..343ca2875e
--- /dev/null
+++ b/apps/remix-ide/src/app/compiler/compiler-imports.js
@@ -0,0 +1,174 @@
+'use strict'
+const globalRegistry = require('../../global/registry')
+var base64 = require('js-base64').Base64
+var swarmgw = require('swarmgw')()
+var resolver = require('@resolver-engine/imports').ImportsEngine()
+var request = require('request')
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+const profile = {
+ name: 'contentImport',
+ displayName: 'content import',
+ version: packageJson.version,
+ methods: ['resolve']
+}
+
+module.exports = class CompilerImports extends Plugin {
+ constructor () {
+ super(profile)
+ this.previouslyHandled = {} // cache import so we don't make the request at each compilation.
+ }
+
+ handleGithubCall (root, path, cb) {
+ let param = '?'
+ // const token = await this.call('settings', 'getGithubAccessToken')
+ const token = globalRegistry.get('config').api.get('settings/gist-access-token') // TODO replace with the plugin call above https://github.com/ethereum/remix-ide/issues/2288
+ param += token ? 'access_token=' + token : ''
+ const regex = path.match(/blob\/([^/]+)\/(.*)/)
+ if (regex) {
+ // if we have /blob/master/+path we extract the branch name "master" and add it as a parameter to the github api
+ // the ref can be branch name, tag, commit id
+ const reference = regex[1]
+ param += '&ref=' + reference
+ path = path.replace(`blob/${reference}/`, '')
+ }
+ return request.get(
+ {
+ url: 'https://api.github.com/repos/' + root + '/contents/' + path + param,
+ json: true
+ },
+ (err, r, data) => {
+ if (err) {
+ return cb(err || 'Unknown transport error')
+ }
+ if ('content' in data) {
+ cb(null, base64.decode(data.content), root + '/' + path)
+ } else if ('message' in data) {
+ cb(data.message)
+ } else {
+ cb('Content not received')
+ }
+ })
+ }
+
+ handleSwarmImport (url, cleanUrl, cb) {
+ swarmgw.get(url, function (err, content) {
+ cb(err, content, cleanUrl)
+ })
+ }
+
+ handleIPFS (url, cb) {
+ // replace ipfs:// with /ipfs/
+ url = url.replace(/^ipfs:\/\/?/, 'ipfs/')
+
+ return request.get(
+ {
+ url: 'https://ipfsgw.komputing.org/' + url
+ },
+ (err, r, data) => {
+ if (err) {
+ return cb(err || 'Unknown transport error')
+ }
+ cb(null, data, url)
+ })
+ }
+
+ handleHttpCall (url, cleanUrl, cb) {
+ return request.get(
+ {
+ url
+ },
+ (err, r, data) => {
+ if (err) {
+ return cb(err || 'Unknown transport error')
+ }
+ cb(null, data, cleanUrl)
+ })
+ }
+
+ handlers () {
+ return [
+ { type: 'github', match: /^(https?:\/\/)?(www.)?github.com\/([^/]*\/[^/]*)\/(.*)/, handler: (match, cb) => { this.handleGithubCall(match[3], match[4], cb) } },
+ { type: 'http', match: /^(http?:\/\/?(.*))$/, handler: (match, cb) => { this.handleHttpCall(match[1], match[2], cb) } },
+ { type: 'https', match: /^(https?:\/\/?(.*))$/, handler: (match, cb) => { this.handleHttpCall(match[1], match[2], cb) } },
+ { type: 'swarm', match: /^(bzz-raw?:\/\/?(.*))$/, handler: (match, cb) => { this.handleSwarmImport(match[1], match[2], cb) } },
+ { type: 'ipfs', match: /^(ipfs:\/\/?.+)/, handler: (match, cb) => { this.handleIPFS(match[1], cb) } }
+ ]
+ }
+
+ isRelativeImport (url) {
+ return /^([^/]+)/.exec(url)
+ }
+
+ resolve (url) {
+ return new Promise((resolve, reject) => {
+ this.import(url, null, (error, content, cleanUrl, type, url) => {
+ if (error) return reject(error)
+ resolve({ content, cleanUrl, type, url })
+ })
+ })
+ }
+
+ import (url, force, loadingCb, cb) {
+ if (typeof force !== 'boolean') {
+ let temp = loadingCb
+ loadingCb = force
+ cb = temp
+ force = false
+ }
+ if (!loadingCb) loadingCb = () => {}
+ if (!cb) cb = () => {}
+
+ var self = this
+ if (force) delete this.previouslyHandled[url]
+ var imported = this.previouslyHandled[url]
+ if (imported) {
+ return cb(null, imported.content, imported.cleanUrl, imported.type, url)
+ }
+ var handlers = this.handlers()
+
+ var found = false
+ handlers.forEach(function (handler) {
+ if (found) {
+ return
+ }
+
+ var match = handler.match.exec(url)
+ if (match) {
+ found = true
+
+ loadingCb('Loading ' + url + ' ...')
+ handler.handler(match, function (err, content, cleanUrl) {
+ if (err) {
+ cb('Unable to import "' + cleanUrl + '": ' + err)
+ return
+ }
+ self.previouslyHandled[url] = {
+ content: content,
+ cleanUrl: cleanUrl,
+ type: handler.type
+ }
+ cb(null, content, cleanUrl, handler.type, url)
+ })
+ }
+ })
+ if (found) return
+
+ resolver
+ .resolve(url)
+ .then(result => {
+ return resolver.require(url)
+ })
+ .then(result => {
+ if (url.indexOf(result.provider + ':') === 0) {
+ url = url.substring(result.provider.length + 1) // remove the github prefix
+ }
+ cb(null, result.source, url, result.provider, result.url)
+ })
+ .catch(err => {
+ err
+ cb('Unable to import "' + url + '": File not found')
+ })
+ }
+}
diff --git a/apps/remix-ide/src/app/compiler/compiler-input.js b/apps/remix-ide/src/app/compiler/compiler-input.js
new file mode 100644
index 0000000000..326eaba816
--- /dev/null
+++ b/apps/remix-ide/src/app/compiler/compiler-input.js
@@ -0,0 +1,21 @@
+'use strict'
+
+module.exports = (sources, opts) => {
+ return JSON.stringify({
+ language: 'Solidity',
+ sources: sources,
+ settings: {
+ optimizer: {
+ enabled: opts.optimize === true || opts.optimize === 1,
+ runs: 200
+ },
+ libraries: opts.libraries,
+ outputSelection: {
+ '*': {
+ '': [ 'legacyAST', 'ast'],
+ '*': [ 'abi', 'metadata', 'devdoc', 'userdoc', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates' ]
+ }
+ }
+ }
+ })
+}
diff --git a/apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js b/apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js
new file mode 100644
index 0000000000..b03ef1f513
--- /dev/null
+++ b/apps/remix-ide/src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js
@@ -0,0 +1,123 @@
+const ethutil = require('ethereumjs-util')
+import * as packageJson from '../../../../../package.json'
+import { Plugin } from '@remixproject/engine'
+import { compile } from './compiler-helpers'
+import globalRegistry from '../../global/registry'
+
+import remixLib from '@remix-project/remix-lib'
+
+const profile = {
+ name: 'fetchAndCompile',
+ methods: ['resolve'],
+ version: packageJson.version
+}
+
+export default class FetchAndCompile extends Plugin {
+
+ constructor () {
+ super(profile)
+ this.unresolvedAddresses = []
+ this.sourceVerifierNetWork = ['Main', 'Rinkeby', 'Ropsten', 'Goerli']
+ }
+
+ /**
+ * Fetch compiliation metadata from source-Verify from a given @arg contractAddress - https://github.com/ethereum/source-verify
+ * Put the artifacts in the file explorer
+ * Compile the code using Solidity compiler
+ * Returns compilation data
+ *
+ * @param {string} contractAddress - Address of the contrac to resolve
+ * @param {string} compilersartefacts - Object containing a mapping of compilation results (byContractAddress and __last)
+ * @return {CompilerAbstract} - compilation data targeting the given @arg contractAddress
+ */
+ async resolve (contractAddress, targetPath, web3) {
+ contractAddress = ethutil.toChecksumAddress(contractAddress)
+ const compilersartefacts = globalRegistry.get('compilersartefacts').api
+
+ const localCompilation = () => compilersartefacts.get('__last') ? compilersartefacts.get('__last') : null
+
+ const resolved = compilersartefacts.get(contractAddress)
+ if (resolved) return resolved
+ if (this.unresolvedAddresses.includes(contractAddress)) return localCompilation()
+
+ // sometimes when doing an internal call, the only available artifact is the Solidity interface.
+ // resolving addresses of internal call would allow to step over the source code, even if the declaration was made using an Interface.
+
+ let network
+ try {
+ network = await this.call('network', 'detectNetwork')
+ } catch (e) {
+ return localCompilation()
+ }
+ if (!network) return localCompilation()
+ if (!this.sourceVerifierNetWork.includes(network.name)) return localCompilation()
+
+ // check if the contract if part of the local compilation result
+ const codeAtAddress = await web3.eth.getCode(contractAddress)
+ const compilation = localCompilation()
+ if (compilation) {
+ let found = false
+ compilation.visitContracts((contract) => {
+ found = remixLib.util.compareByteCode('0x' + contract.object.evm.deployedBytecode.object, codeAtAddress)
+ return found
+ })
+ if (found) {
+ compilersartefacts.addResolvedContract(contractAddress, compilation)
+ setTimeout(_ => this.emit('usingLocalCompilation', contractAddress), 0)
+ return compilation
+ }
+ }
+
+ let name = network.name.toLowerCase()
+ name === 'main' ? 'mainnet' : name // source-verifier api expect "mainnet" and not "main"
+ let data
+ try {
+ data = await this.call('source-verification', 'fetchByNetwork', contractAddress, name.toLowerCase())
+ } catch (e) {
+ setTimeout(_ => this.emit('notFound', contractAddress), 0) // plugin framework returns a time out error although it actually didn't find the source...
+ this.unresolvedAddresses.push(contractAddress)
+ return localCompilation()
+ }
+ if (!data || !data.metadata) {
+ setTimeout(_ => this.emit('notFound', contractAddress), 0)
+ this.unresolvedAddresses.push(contractAddress)
+ return localCompilation()
+ }
+
+ // set the solidity contract code using metadata
+ await this.call('fileManager', 'setFile', `${targetPath}/${name}/${contractAddress}/metadata.json`, JSON.stringify(data.metadata, null, '\t'))
+ let compilationTargets = {}
+ for (let file in data.metadata.sources) {
+ const urls = data.metadata.sources[file].urls
+ for (let url of urls) {
+ if (url.includes('ipfs')) {
+ let stdUrl = `ipfs://${url.split('/')[2]}`
+ const source = await this.call('contentImport', 'resolve', stdUrl)
+ file = file.replace('browser/', '') // should be fixed in the remix IDE end.
+ const path = `${targetPath}/${name}/${contractAddress}/${file}`
+ await this.call('fileManager', 'setFile', path, source.content)
+ compilationTargets[path] = { content: source.content }
+ break
+ }
+ }
+ }
+
+ // compile
+ const settings = {
+ version: data.metadata.compiler.version,
+ language: data.metadata.language,
+ evmVersion: data.metadata.settings.evmVersion,
+ optimize: data.metadata.settings.optimizer.enabled
+ }
+ try {
+ setTimeout(_ => this.emit('compiling', settings), 0)
+ const compData = await compile(compilationTargets, settings)
+ compilersartefacts.addResolvedContract(contractAddress, compData)
+ return compData
+ } catch (e) {
+ this.unresolvedAddresses.push(contractAddress)
+ setTimeout(_ => this.emit('compilationFailed'), 0)
+ return localCompilation()
+ }
+ }
+}
diff --git a/apps/remix-ide/src/app/compiler/compiler-utils.js b/apps/remix-ide/src/app/compiler/compiler-utils.js
new file mode 100644
index 0000000000..f7222f582d
--- /dev/null
+++ b/apps/remix-ide/src/app/compiler/compiler-utils.js
@@ -0,0 +1,44 @@
+const semver = require('semver')
+const minixhr = require('minixhr')
+/* global Worker */
+
+export const baseURLBin = 'https://solc-bin.ethereum.org/bin'
+export const baseURLWasm = 'https://solc-bin.ethereum.org/wasm'
+
+export const pathToURL = {}
+
+/**
+ * Retrieves the URL of the given compiler version
+ * @param version is the version of compiler with or without 'soljson-v' prefix and .js postfix
+ */
+export function urlFromVersion (version) {
+ if (!version.startsWith('soljson-v')) version = 'soljson-v' + version
+ if (!version.endsWith('.js')) version = version + '.js'
+ return `${pathToURL[version]}/${version}`
+}
+
+/**
+ * Checks if the worker can be used to load a compiler.
+ * checks a compiler whitelist, browser support and OS.
+ */
+export function canUseWorker (selectedVersion) {
+ const version = semver.coerce(selectedVersion)
+ const isNightly = selectedVersion.includes('nightly')
+ return browserSupportWorker() && (
+ semver.gt(version, '0.6.3') ||
+ semver.gt(version, '0.3.6') && !isNightly
+ )
+}
+
+function browserSupportWorker () {
+ return document.location.protocol !== 'file:' && Worker !== undefined
+}
+
+// returns a promise for minixhr
+export function promisedMiniXhr (url) {
+ return new Promise((resolve, reject) => {
+ minixhr(url, (json, event) => {
+ resolve({ json, event })
+ })
+ })
+}
diff --git a/apps/remix-ide/src/app/components/hidden-panel.js b/apps/remix-ide/src/app/components/hidden-panel.js
new file mode 100644
index 0000000000..d3724f9274
--- /dev/null
+++ b/apps/remix-ide/src/app/components/hidden-panel.js
@@ -0,0 +1,32 @@
+import { AbstractPanel } from './panel'
+import * as packageJson from '../../../../../package.json'
+const csjs = require('csjs-inject')
+const yo = require('yo-yo')
+
+const css = csjs`
+ .pluginsContainer {
+ display: none;
+ }
+`
+
+const profile = {
+ name: 'hiddenPanel',
+ displayName: 'Hidden Panel',
+ description: '',
+ version: packageJson.version,
+ methods: ['addView', 'removeView']
+}
+
+export class HiddenPanel extends AbstractPanel {
+
+ constructor () {
+ super(profile)
+ }
+
+ render () {
+ return yo`
+
+ ${this.view}
+
`
+ }
+}
diff --git a/apps/remix-ide/src/app/components/local-plugin.js b/apps/remix-ide/src/app/components/local-plugin.js
new file mode 100644
index 0000000000..39d8c5fc68
--- /dev/null
+++ b/apps/remix-ide/src/app/components/local-plugin.js
@@ -0,0 +1,114 @@
+/* global localStorage */
+const yo = require('yo-yo')
+const modalDialog = require('../ui/modaldialog')
+
+const defaultProfile = {
+ methods: [],
+ location: 'sidePanel',
+ type: 'iframe'
+}
+
+module.exports = class LocalPlugin {
+ /**
+ * Open a modal to create a local plugin
+ * @param {Profile[]} plugins The list of the plugins in the store
+ * @returns {Promise<{api: any, profile: any}>} A promise with the new plugin profile
+ */
+ open (plugins) {
+ this.profile = JSON.parse(localStorage.getItem('plugins/local')) || defaultProfile
+ return new Promise((resolve, reject) => {
+ const onValidation = () => {
+ try {
+ const profile = this.create()
+ resolve(profile)
+ } catch (err) {
+ reject(err)
+ }
+ }
+ modalDialog('Local Plugin', this.form(),
+ { fn: () => onValidation() },
+ { fn: () => resolve() }
+ )
+ })
+ }
+
+ /**
+ * Create the object to add to the plugin-list
+ */
+ create () {
+ const profile = {
+ icon: 'assets/img/localPlugin.webp',
+ methods: [],
+ location: 'sidePanel',
+ type: 'iframe',
+ ...this.profile,
+ hash: `local-${this.profile.name}`
+ }
+ if (!profile.location) throw new Error('Plugin should have a location')
+ if (!profile.name) throw new Error('Plugin should have a name')
+ if (!profile.url) throw new Error('Plugin should have an URL')
+ localStorage.setItem('plugins/local', JSON.stringify(profile))
+ return profile
+ }
+
+ updateName ({target}) {
+ this.profile.name = target.value
+ }
+
+ updateUrl ({target}) {
+ this.profile.url = target.value
+ }
+
+ updateDisplayName ({target}) {
+ this.profile.displayName = target.value
+ }
+
+ updateProfile (key, e) {
+ this.profile[key] = e.target.value
+ }
+
+ /** The form to create a local plugin */
+ form () {
+ const name = this.profile.name || ''
+ const url = this.profile.url || ''
+ const displayName = this.profile.displayName || ''
+ const radioSelection = (key, label, message) => {
+ return this.profile[key] === label
+ ? yo`
+
+ ${message}
+
`
+ : yo`
+
+ ${message}
+
`
+ }
+
+ return yo`
+ `
+ }
+}
diff --git a/apps/remix-ide/src/app/components/main-panel.js b/apps/remix-ide/src/app/components/main-panel.js
new file mode 100644
index 0000000000..53b6c0f94c
--- /dev/null
+++ b/apps/remix-ide/src/app/components/main-panel.js
@@ -0,0 +1,33 @@
+import { AbstractPanel } from './panel'
+import * as packageJson from '../../../../../package.json'
+const yo = require('yo-yo')
+const csjs = require('csjs-inject')
+
+const css = csjs`
+ .pluginsContainer {
+ height: 100%;
+ display: flex;
+ overflow-y: hidden;
+ }
+`
+
+const profile = {
+ name: 'mainPanel',
+ displayName: 'Main Panel',
+ description: '',
+ version: packageJson.version,
+ methods: ['addView', 'removeView']
+}
+
+export class MainPanel extends AbstractPanel {
+ constructor () {
+ super(profile)
+ }
+
+ render () {
+ return yo`
+
+ ${this.view}
+
`
+ }
+}
diff --git a/apps/remix-ide/src/app/components/panel.js b/apps/remix-ide/src/app/components/panel.js
new file mode 100644
index 0000000000..bd1d59d176
--- /dev/null
+++ b/apps/remix-ide/src/app/components/panel.js
@@ -0,0 +1,112 @@
+import { EventEmitter } from 'events'
+const csjs = require('csjs-inject')
+const yo = require('yo-yo')
+import { HostPlugin } from '@remixproject/engine'
+
+const css = csjs`
+ .plugins {
+ height: 100%;
+ }
+ .plugItIn {
+ display : none;
+ height : 100%;
+ }
+ .plugItIn > div {
+ overflow-y : auto;
+ height : 100%;
+ width : 100%;
+ }
+ .plugItIn.active {
+ display : block;
+ }
+ .pluginsContainer {
+ height : 100%;
+ overflow-y : hidden;
+ }
+`
+
+/** Abstract class used for hosting the view of a plugin */
+export class AbstractPanel extends HostPlugin {
+
+ constructor (profile) {
+ super(profile)
+ this.events = new EventEmitter()
+ this.contents = {}
+ this.active = undefined
+
+ // View where the plugin HTMLElement leaves
+ this.view = yo`
`
+ }
+
+ /**
+ * Add the plugin to the panel
+ * @param {String} name the name of the plugin
+ * @param {HTMLElement} content the HTMLContent of the plugin
+ */
+ add (view, name) {
+ if (this.contents[name]) throw new Error(`Plugin ${name} already rendered`)
+ view.style.height = '100%'
+ view.style.width = '100%'
+ view.style.border = '0'
+
+ const isIframe = view.tagName === 'IFRAME'
+ view.style.display = isIframe ? 'none' : 'block'
+ const loading = isIframe ? yo`
+
+ ` : ''
+ this.contents[name] = yo`${view}${loading}
`
+
+ if (view.tagName === 'IFRAME') {
+ view.addEventListener('load', () => {
+ if (this.contents[name].contains(loading)) {
+ this.contents[name].removeChild(loading)
+ }
+ view.style.display = 'block'
+ })
+ }
+ this.contents[name].style.display = 'none'
+ this.view.appendChild(this.contents[name])
+ }
+
+ addView (profile, view) {
+ this.add(view, profile.name)
+ }
+
+ removeView (profile) {
+ this.remove(profile.name)
+ }
+
+ /**
+ * Remove a plugin from the panel
+ * @param {String} name The name of the plugin to remove
+ */
+ remove (name) {
+ const el = this.contents[name]
+ delete this.contents[name]
+ if (el) el.parentElement.removeChild(el)
+ if (name === this.active) this.active = undefined
+ }
+
+ /**
+ * Display the content of this specific plugin
+ * @param {String} name The name of the plugin to display the content
+ */
+ showContent (name) {
+ if (!this.contents[name]) throw new Error(`Plugin ${name} is not yet activated`)
+ // hiding the current view and display the `moduleName`
+ if (this.active) {
+ this.contents[this.active].style.display = 'none'
+ }
+ this.contents[name].style.display = 'flex'
+ this.active = name
+ }
+
+ focus (name) {
+ this.showContent(name)
+ }
+}
+
diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js
new file mode 100644
index 0000000000..9538182662
--- /dev/null
+++ b/apps/remix-ide/src/app/components/plugin-manager-component.js
@@ -0,0 +1,240 @@
+const yo = require('yo-yo')
+const csjs = require('csjs-inject')
+const EventEmitter = require('events')
+const LocalPlugin = require('./local-plugin')
+import { ViewPlugin, IframePlugin, WebsocketPlugin } from '@remixproject/engine'
+import { PluginManagerSettings } from './plugin-manager-settings'
+import * as packageJson from '../../../../../package.json'
+const addToolTip = require('../ui/tooltip')
+
+const css = csjs`
+ .pluginSearch {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ background-color: var(--light);
+ padding: 10px;
+ position: sticky;
+ top: 0;
+ z-index: 2;
+ margin-bottom: 0px;
+ }
+ .pluginSearchInput {
+ height: 38px;
+ }
+ .pluginSearchButton {
+ font-size: 13px;
+ }
+ .displayName {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+ .description {
+ font-size: 13px;
+ line-height: 18px;
+ text-transform: capitalize;
+ }
+ .row {
+ display: flex;
+ flex-direction: row;
+ }
+ .isStuck {
+ background-color: var(--primary);
+ color:
+ }
+ .versionWarning {
+ padding: 4px;
+ margin: 0 8px;
+ font-weight: 700;
+ font-size: 9px;
+ line-height: 12px;
+ text-transform: uppercase;
+ cursor: default;
+ border: 1px solid;
+ border-radius: 2px;
+ }
+`
+
+const profile = {
+ name: 'pluginManager',
+ displayName: 'Plugin manager',
+ methods: [],
+ events: [],
+ icon: 'assets/img/pluginManager.webp',
+ description: 'Start/stop services, modules and plugins',
+ kind: 'settings',
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/plugin_manager.html',
+ version: packageJson.version
+}
+
+class PluginManagerComponent extends ViewPlugin {
+
+ constructor (appManager, engine) {
+ super(profile)
+ this.event = new EventEmitter()
+ this.appManager = appManager
+ this.views = {
+ root: null,
+ items: {}
+ }
+ this.localPlugin = new LocalPlugin()
+ this.filter = ''
+ this.appManager.event.on('activate', () => { this.reRender() })
+ this.appManager.event.on('deactivate', () => { this.reRender() })
+ this.appManager.event.on('added', () => { this.reRender() })
+ this.engine = engine
+ }
+
+ isActive (name) {
+ return this.appManager.actives.includes(name)
+ }
+
+ renderItem (profile) {
+ const displayName = (profile.displayName) ? profile.displayName : profile.name
+
+ // Check version of the plugin
+ let versionWarning
+ // Alpha
+ if (profile.version && profile.version.match(/\b(\w*alpha\w*)\b/g)) {
+ versionWarning = yo`alpha `
+ }
+ // Beta
+ if (profile.version && profile.version.match(/\b(\w*beta\w*)\b/g)) {
+ versionWarning = yo`beta `
+ }
+
+ const activationButton = this.isActive(profile.name)
+ ? yo`
+
+ Deactivate
+
+ `
+ : yo`
+
+ Activate
+ `
+
+ return yo`
+
+
+
+ ${displayName}
+ ${versionWarning}
+
+ ${activationButton}
+
+ ${profile.description}
+
+ `
+ }
+
+ /***************
+ * SUB-COMPONENT
+ */
+ /**
+ * Add a local plugin to the list of plugins
+ */
+ async openLocalPlugin () {
+ try {
+ const profile = await this.localPlugin.open(this.appManager.getAll())
+ if (!profile) return
+ if (this.appManager.getIds().includes(profile.name)) {
+ throw new Error('This name has already been used')
+ }
+ const plugin = profile.type === 'iframe' ? new IframePlugin(profile) : new WebsocketPlugin(profile)
+ this.engine.register(plugin)
+ this.appManager.activatePlugin(plugin.name)
+ } catch (err) {
+ // TODO : Use an alert to handle this error instead of a console.log
+ console.log(`Cannot create Plugin : ${err.message}`)
+ addToolTip(`Cannot create Plugin : ${err.message}`)
+ }
+ }
+
+ render () {
+ // Filtering helpers
+ const isFiltered = (profile) => (profile.displayName ? profile.displayName : profile.name).toLowerCase().includes(this.filter)
+ const isNotRequired = (profile) => !this.appManager.isRequired(profile.name)
+ const isNotHome = (profile) => profile.name !== 'home'
+ const sortByName = (profileA, profileB) => {
+ const nameA = ((profileA.displayName) ? profileA.displayName : profileA.name).toUpperCase()
+ const nameB = ((profileB.displayName) ? profileB.displayName : profileB.name).toUpperCase()
+ return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0
+ }
+
+ // Filter all active and inactive modules that are not required
+ const {actives, inactives} = this.appManager.getAll()
+ .filter(isFiltered)
+ .filter(isNotRequired)
+ .filter(isNotHome)
+ .sort(sortByName)
+ .reduce(({actives, inactives}, profile) => {
+ return this.isActive(profile.name)
+ ? { actives: [...actives, profile], inactives }
+ : { inactives: [...inactives, profile], actives }
+ }, { actives: [], inactives: [] })
+
+ const activeTile = actives.length !== 0
+ ? yo`
+
+ Active Modules
+ ${actives.length}
+ `
+ : ''
+ const inactiveTile = inactives.length !== 0
+ ? yo`
+
+ Inactive Modules
+ ${inactives.length}
+ `
+ : ''
+
+ const settings = new PluginManagerSettings().render()
+
+ const rootView = yo`
+
+
+
+ ${activeTile}
+
+ ${actives.map(profile => this.renderItem(profile))}
+
+ ${inactiveTile}
+
+ ${inactives.map(profile => this.renderItem(profile))}
+
+
+ ${settings}
+
+ `
+ if (!this.views.root) this.views.root = rootView
+ return rootView
+ }
+
+ reRender () {
+ if (this.views.root) {
+ yo.update(this.views.root, this.render())
+ }
+ }
+
+ filterPlugins ({ target }) {
+ this.filter = target.value.toLowerCase()
+ this.reRender()
+ }
+}
+
+module.exports = PluginManagerComponent
diff --git a/apps/remix-ide/src/app/components/plugin-manager-settings.js b/apps/remix-ide/src/app/components/plugin-manager-settings.js
new file mode 100644
index 0000000000..04f2744f63
--- /dev/null
+++ b/apps/remix-ide/src/app/components/plugin-manager-settings.js
@@ -0,0 +1,142 @@
+const yo = require('yo-yo')
+const csjs = require('csjs-inject')
+const modalDialog = require('../ui/modaldialog')
+
+const css = csjs`
+.permissions {
+ position: sticky;
+ bottom: 0;
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ padding: 5px 20px;
+}
+.permissions button {
+ padding: 2px 5px;
+ cursor: pointer;
+}
+.permissionForm h4 {
+ font-size: 1.3rem;
+ text-align: center;
+}
+.permissionForm h6 {
+ font-size: 1.1rem;
+}
+.permissionForm hr {
+ width: 80%;
+}
+.permissionKey {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+.permissionKey i {
+ cursor: pointer;
+}
+.checkbox {
+ display: flex;
+ align-items: center;
+}
+.checkbox label {
+ margin: 0;
+ font-size: 1rem;
+}
+`
+
+export class PluginManagerSettings {
+
+ openDialog () {
+ const fromLocal = window.localStorage.getItem('plugins/permissions')
+ this.permissions = JSON.parse(fromLocal || '{}')
+ this.currentSetting = this.settings()
+ modalDialog('Plugin Manager Permissions', this.currentSetting,
+ { fn: () => this.onValidation() },
+ )
+ }
+
+ onValidation () {
+ const permissions = JSON.stringify(this.permissions)
+ window.localStorage.setItem('plugins/permissions', permissions)
+ }
+
+ /** Clear one permission from a plugin */
+ clearPersmission (from, to, method) {
+ if (this.permissions[to] && this.permissions[to][method]) {
+ delete this.permissions[to][method][from]
+ if (Object.keys(this.permissions[to][method]).length === 0) {
+ delete this.permissions[to][method]
+ }
+ if (Object.keys(this.permissions[to]).length === 0) {
+ delete this.permissions[to]
+ }
+ yo.update(this.currentSetting, this.settings())
+ }
+ }
+
+ /** Clear all persmissions from a plugin */
+ clearAllPersmission (to) {
+ if (!this.permissions[to]) return
+ delete this.permissions[to]
+ yo.update(this.currentSetting, this.settings())
+ }
+
+ settings () {
+ const permissionByToPlugin = (toPlugin, funcObj) => {
+ const permissionByMethod = (methodName, fromPlugins) => {
+ const togglePermission = (fromPlugin) => {
+ this.permissions[toPlugin][methodName][fromPlugin].allow = !this.permissions[toPlugin][methodName][fromPlugin].allow
+ }
+ return Object.keys(fromPlugins).map(fromName => {
+ const fromPluginPermission = fromPlugins[fromName]
+ const checkbox = fromPluginPermission.allow
+ ? yo` togglePermission(fromName)} class="mr-2" type="checkbox" checked id="permission-checkbox-${toPlugin}-${methodName}-${toPlugin}" aria-describedby="module ${fromPluginPermission} asks permission for ${methodName}" />`
+ : yo` togglePermission(fromName)} class="mr-2" type="checkbox" id="permission-checkbox-${toPlugin}-${methodName}-${toPlugin}" aria-describedby="module ${fromPluginPermission} asks permission for ${methodName}" />`
+ return yo`
+
+ `
+ })
+ }
+
+ const permissionsByFunctions = Object
+ .keys(funcObj)
+ .map(methodName => permissionByMethod(methodName, funcObj[methodName]))
+
+ return yo`
+
+
+
${toPlugin} permissions:
+
+
+ ${permissionsByFunctions}
+
`
+ }
+
+ const byToPlugin = Object
+ .keys(this.permissions)
+ .map(toPlugin => permissionByToPlugin(toPlugin, this.permissions[toPlugin]))
+
+ const title = byToPlugin.length === 0
+ ? yo`No Permission requested yet. `
+ : yo`Current Permission settings `
+
+ return yo``
+ }
+
+ render () {
+ return yo`
+ `
+ }
+
+}
diff --git a/apps/remix-ide/src/app/components/side-panel.js b/apps/remix-ide/src/app/components/side-panel.js
new file mode 100644
index 0000000000..b68f7430ad
--- /dev/null
+++ b/apps/remix-ide/src/app/components/side-panel.js
@@ -0,0 +1,150 @@
+import { AbstractPanel } from './panel'
+import * as packageJson from '../../../../../package.json'
+const csjs = require('csjs-inject')
+const yo = require('yo-yo')
+
+const css = csjs`
+ .panel {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ flex: auto;
+ }
+ .swapitTitle {
+ margin: 0;
+ text-transform: uppercase;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .swapitTitle i{
+ padding-left: 6px;
+ font-size: 14px;
+ }
+ .swapitHeader {
+ display: flex;
+ align-items: center;
+ padding: 16px 24px 15px;
+ justify-content: space-between;
+ }
+ .icons i {
+ height: 80%;
+ cursor: pointer;
+ }
+ .pluginsContainer {
+ height: 100%;
+ overflow-y: auto;
+ }
+ .titleInfo {
+ padding-left: 10px;
+ }
+ .versionBadge {
+ background-color: var(--light);
+ padding: 0 7px;
+ font-weight: bolder;
+ margin-left: 5px;
+ text-transform: lowercase;
+ cursor: default;
+ }
+`
+
+const sidePanel = {
+ name: 'sidePanel',
+ displayName: 'Side Panel',
+ description: '',
+ version: packageJson.version,
+ methods: ['addView', 'removeView']
+}
+
+// TODO merge with vertical-icons.js
+export class SidePanel extends AbstractPanel {
+
+ constructor (appManager, verticalIcons) {
+ super(sidePanel)
+ this.appManager = appManager
+ this.header = yo``
+ this.renderHeader()
+ this.verticalIcons = verticalIcons
+
+ // Toggle content
+ verticalIcons.events.on('toggleContent', (name) => {
+ if (!this.contents[name]) return
+ if (this.active === name) {
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('toggle', name)
+ this.events.emit('toggle', name)
+ return
+ }
+ this.showContent(name)
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('showing', name)
+ this.events.emit('showing', name)
+ })
+ // Force opening
+ verticalIcons.events.on('showContent', (name) => {
+ if (!this.contents[name]) return
+ this.showContent(name)
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('showing', name)
+ this.events.emit('showing', name)
+ })
+ }
+
+ removeView (profile) {
+ super.removeView(profile)
+ this.verticalIcons.unlinkContent(profile)
+ }
+
+ addView (profile, view) {
+ super.addView(profile, view)
+ this.verticalIcons.linkContent(profile)
+ }
+
+ /**
+ * Display content and update the header
+ * @param {String} name The name of the plugin to display
+ */
+ async showContent (name) {
+ super.showContent(name)
+ this.renderHeader()
+ }
+
+ /** The header of the side panel */
+ async renderHeader () {
+ let name = ' - '
+ let docLink = ''
+ let versionWarning
+ if (this.active) {
+ const profile = await this.appManager.getProfile(this.active)
+ name = profile.displayName ? profile.displayName : profile.name
+ docLink = profile.documentation ? yo` ` : ''
+ if (profile.version && profile.version.match(/\b(\w*alpha\w*)\b/g)) {
+ versionWarning = yo`alpha `
+ }
+ // Beta
+ if (profile.version && profile.version.match(/\b(\w*beta\w*)\b/g)) {
+ versionWarning = yo`beta `
+ }
+ }
+
+ const header = yo`
+
+ `
+ yo.update(this.header, header)
+ }
+
+ render () {
+ return yo`
+
+ ${this.header}
+
+ ${this.view}
+
+ `
+ }
+}
diff --git a/apps/remix-ide/src/app/components/vertical-icons.js b/apps/remix-ide/src/app/components/vertical-icons.js
new file mode 100644
index 0000000000..6e8ea6a370
--- /dev/null
+++ b/apps/remix-ide/src/app/components/vertical-icons.js
@@ -0,0 +1,328 @@
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+var helper = require('../../lib/helper')
+let globalRegistry = require('../../global/registry')
+const { Plugin } = require('@remixproject/engine')
+import * as packageJson from '../../../../../package.json'
+import { basicLogo } from '../ui/svgLogo'
+
+const EventEmitter = require('events')
+
+const profile = {
+ name: 'menuicons',
+ displayName: 'Vertical Icons',
+ description: '',
+ version: packageJson.version,
+ methods: ['select']
+}
+
+// TODO merge with side-panel.js. VerticalIcons should not be a plugin
+export class VerticalIcons extends Plugin {
+
+ constructor (appManager) {
+ super(profile)
+ this.events = new EventEmitter()
+ this.appManager = appManager
+ this.icons = {}
+ this.iconKind = {}
+ this.iconStatus = {}
+
+ let themeModule = globalRegistry.get('themeModule').api
+ themeModule.events.on('themeChanged', (theme) => {
+ this.onThemeChanged(theme.quality)
+ })
+ }
+
+ linkContent (profile) {
+ if (!profile.icon) return
+ this.addIcon(profile)
+ this.listenOnStatus(profile)
+ }
+
+ unlinkContent (profile) {
+ this.removeIcon(profile)
+ }
+
+ listenOnStatus (profile) {
+ // the list of supported keys. 'none' will remove the status
+ const keys = ['edited', 'succeed', 'none', 'loading', 'failed']
+ const types = ['error', 'warning', 'success', 'info', '']
+ const fn = (status) => {
+ if (!types.includes(status.type) && status.type) throw new Error(`type should be ${keys.join()}`)
+ if (status.key === undefined) throw new Error(`status key should be defined`)
+
+ if (typeof status.key === 'string' && (!keys.includes(status.key))) {
+ throw new Error('key should contain either number or ' + keys.join())
+ }
+ this.setIconStatus(profile.name, status)
+ }
+ this.iconStatus[profile.name] = fn
+ this.on(profile.name, 'statusChanged', this.iconStatus[profile.name])
+ }
+
+ /**
+ * Add an icon to the map
+ * @param {ModuleProfile} profile The profile of the module
+ */
+ addIcon ({kind, name, icon, displayName, tooltip}) {
+ let title = (tooltip || displayName || name)
+ title = title.replace(/^\w/, c => c.toUpperCase())
+ this.icons[name] = yo`
+
+
+
`
+ this.iconKind[kind || 'none'].appendChild(this.icons[name])
+ }
+
+ /**
+ * resolve a classes list for @arg key
+ * @param {Object} key
+ * @param {Object} type
+ */
+ resolveClasses (key, type) {
+ let classes = css.status
+ switch (key) {
+ case 'succeed':
+ classes += ' fas fa-check-circle text-' + type + ' ' + css.statusCheck
+ break
+ case 'edited':
+ classes += ' fas fa-sync text-' + type + ' ' + css.statusCheck
+ break
+ case 'loading':
+ classes += ' fas fa-spinner text-' + type + ' ' + css.statusCheck
+ break
+ case 'failed':
+ classes += ' fas fa-exclamation-triangle text-' + type + ' ' + css.statusCheck
+ break
+ default: {
+ classes += ' badge badge-pill badge-' + type
+ }
+ }
+ return classes
+ }
+
+ /**
+ * Set a new status for the @arg name
+ * @param {String} name
+ * @param {Object} status
+ */
+ setIconStatus (name, status) {
+ const el = this.icons[name]
+ if (!el) return
+ let statusEl = el.querySelector('span')
+ if (statusEl) {
+ el.removeChild(statusEl)
+ }
+ if (status.key === 'none') return // remove status
+
+ let text = ''
+ let key = ''
+ if (typeof status.key === 'number') {
+ key = status.key.toString()
+ text = key
+ } else key = helper.checkSpecialChars(status.key) ? '' : status.key
+
+ let type = ''
+ if (status.type === 'error') {
+ type = 'danger' // to use with bootstrap
+ } else type = helper.checkSpecialChars(status.type) ? '' : status.type
+ let title = helper.checkSpecialChars(status.title) ? '' : status.title
+
+ el.appendChild(yo`
+ ${text}
+ `)
+
+ el.classList.add(`${css.icon}`)
+ }
+
+ /**
+ * Remove an icon from the map
+ * @param {ModuleProfile} profile The profile of the module
+ */
+ removeIcon ({kind, name}) {
+ if (this.icons[name]) this.iconKind[kind || 'none'].removeChild(this.icons[name])
+ }
+
+ /**
+ * Remove active for the current activated icons
+ */
+ removeActive () {
+ // reset filters
+ const images = this.view.querySelectorAll(`.image`)
+ images.forEach(function (im) {
+ im.style.setProperty('filter', 'invert(0.5)')
+ })
+
+ // remove active
+ const currentActive = this.view.querySelector(`.active`)
+ if (currentActive) {
+ currentActive.classList.remove(`active`)
+ }
+ }
+
+ /**
+ * Add active for the new activated icon
+ * @param {string} name Name of profile of the module to activate
+ */
+ addActive (name) {
+ if (name === 'home') return
+ const themeType = globalRegistry.get('themeModule').api.currentTheme().quality
+ const invert = themeType === 'dark' ? 1 : 0
+ const brightness = themeType === 'dark' ? '150' : '0' // should be >100 for icons with color
+ const nextActive = this.view.querySelector(`[plugin="${name}"]`)
+ if (nextActive) {
+ let image = nextActive.querySelector('.image')
+ nextActive.classList.add(`active`)
+ image.style.setProperty('filter', `invert(${invert}) grayscale(1) brightness(${brightness}%)`)
+ }
+ }
+
+ /**
+ * Set an icon as active
+ * @param {string} name Name of profile of the module to activate
+ */
+ select (name) {
+ this.updateActivations(name)
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('showContent', name)
+ this.events.emit('showContent', name)
+ }
+
+ /**
+ * Toggles the side panel for plugin
+ * @param {string} name Name of profile of the module to activate
+ */
+ toggle (name) {
+ this.updateActivations(name)
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('toggleContent', name)
+ this.events.emit('toggleContent', name)
+ }
+
+ updateActivations (name) {
+ this.removeActive()
+ this.addActive(name)
+ }
+
+ onThemeChanged (themeType) {
+ const invert = themeType === 'dark' ? 1 : 0
+ const active = this.view.querySelector(`.active`)
+ if (active) {
+ let image = active.querySelector('.image')
+ image.style.setProperty('filter', `invert(${invert})`)
+ }
+ }
+
+ render () {
+ let home = yo`
+
+ ${basicLogo()}
+
+ `
+ this.iconKind['fileexplorer'] = yo`
`
+ this.iconKind['compiler'] = yo`
`
+ this.iconKind['udapp'] = yo`
`
+ this.iconKind['testing'] = yo`
`
+ this.iconKind['analysis'] = yo`
`
+ this.iconKind['debugging'] = yo`
`
+ this.iconKind['none'] = yo`
`
+ this.iconKind['settings'] = yo`
`
+
+ this.view = yo`
+
+ ${home}
+ ${this.iconKind['fileexplorer']}
+ ${this.iconKind['compiler']}
+ ${this.iconKind['udapp']}
+ ${this.iconKind['testing']}
+ ${this.iconKind['analysis']}
+ ${this.iconKind['debugging']}
+ ${this.iconKind['none']}
+ ${this.iconKind['settings']}
+
+ `
+ return this.view
+ }
+}
+
+const css = csjs`
+ .homeIcon {
+ display: block;
+ width: 42px;
+ height: 42px;
+ margin-bottom: 20px;
+ margin-left: -5px;
+ cursor: pointer;
+ }
+ .homeIcon svg path {
+ fill: var(--primary);
+ }
+ .homeIcon svg polygon {
+ fill: var(--primary);
+ }
+ .icons {
+ margin-left: 10px;
+ margin-top: 15px;
+ }
+ .icon {
+ cursor: pointer;
+ margin-bottom: 12px;
+ width: 36px;
+ height: 36px;
+ padding: 3px;
+ position: relative;
+ border-radius: 8px;
+ }
+ .icon img {
+ width: 28px;
+ height: 28px;
+ padding: 4px;
+ filter: invert(0.5);
+ }
+ .image {
+ }
+ .icon svg {
+ width: 28px;
+ height: 28px;
+ padding: 4px;
+ }
+ .icon[title='Settings'] {
+ position: absolute;
+ bottom: 0;
+ }
+ .status {
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ }
+ .statusCheck {
+ font-size: 1.2em;
+ }
+ .statusWithBG
+ border-radius: 8px;
+ background-color: var(--danger);
+ color: var(--light);
+ font-size: 12px;
+ height: 15px;
+ text-align: center;
+ font-weight: bold;
+ padding-left: 5px;
+ padding-right: 5px;
+ }
+`
diff --git a/apps/remix-ide/src/app/editor/SourceHighlighters.js b/apps/remix-ide/src/app/editor/SourceHighlighters.js
new file mode 100644
index 0000000000..7bd678148c
--- /dev/null
+++ b/apps/remix-ide/src/app/editor/SourceHighlighters.js
@@ -0,0 +1,52 @@
+'use strict'
+const SourceHighlighter = require('./sourceHighlighter')
+
+// EditorApi:
+// - methods: ['highlight', 'discardHighlight'],
+
+class SourceHighlighters {
+
+ constructor () {
+ this.highlighters = {}
+ }
+
+ highlight (position, filePath, hexColor, from) {
+ try {
+ if (!this.highlighters[from]) this.highlighters[from] = []
+ const sourceHighlight = new SourceHighlighter()
+ if (
+ !this.highlighters[from].length ||
+ (this.highlighters[from].length && !this.highlighters[from].find((el) => {
+ return el.source === filePath && el.position === position
+ }))
+ ) {
+ sourceHighlight.currentSourceLocationFromfileName(position, filePath, hexColor)
+ this.highlighters[from].push(sourceHighlight)
+ }
+ } catch (e) {
+ throw e
+ }
+ }
+
+ discardHighlight (from) {
+ if (this.highlighters[from]) {
+ for (const index in this.highlighters[from]) this.highlighters[from][index].currentSourceLocation(null)
+ }
+ this.highlighters[from] = []
+ }
+
+ discardHighlightAt (line, filePath, from) {
+ if (this.highlighters[from]) {
+ for (const index in this.highlighters[from]) {
+ const highlight = this.highlighters[from][index]
+ if (highlight.source === filePath &&
+ (highlight.position.start.line === line || highlight.position.end.line === line)) {
+ highlight.currentSourceLocation(null)
+ this.highlighters[from].splice(index, 1)
+ }
+ }
+ }
+ }
+}
+
+module.exports = SourceHighlighters
diff --git a/apps/remix-ide/src/app/editor/contextView.js b/apps/remix-ide/src/app/editor/contextView.js
new file mode 100644
index 0000000000..797ca69d12
--- /dev/null
+++ b/apps/remix-ide/src/app/editor/contextView.js
@@ -0,0 +1,194 @@
+'use strict'
+const yo = require('yo-yo')
+const remixDebug = require('@remix-project/remix-debug')
+const SourceMappingDecoder = remixDebug.SourceMappingDecoder
+const globalRegistry = require('../../global/registry')
+
+const css = require('./styles/contextView-styles')
+
+/*
+ Display information about the current focused code:
+ - if it's a reference, display information about the declaration
+ - jump to the declaration
+ - number of references
+ - rename declaration/references
+*/
+class ContextView {
+ constructor (opts, localRegistry) {
+ this._components = {}
+ this._components.registry = localRegistry || globalRegistry
+ this.contextualListener = opts.contextualListener
+ this.editor = opts.editor
+ this._deps = {
+ compilersArtefacts: this._components.registry.get('compilersartefacts').api,
+ offsetToLineColumnConverter: this._components.registry.get('offsettolinecolumnconverter').api,
+ config: this._components.registry.get('config').api,
+ fileManager: this._components.registry.get('filemanager').api
+ }
+ this._view
+ this._nodes
+ this._current
+ this.sourceMappingDecoder = new SourceMappingDecoder()
+ this.previousElement = null
+ this.contextualListener.event.register('contextChanged', nodes => {
+ this.show()
+ this._nodes = nodes
+ this.update()
+ })
+ this.contextualListener.event.register('stopHighlighting', () => {
+ })
+ }
+
+ render () {
+ const view = yo`
+
+
+ ${this._renderTarget()}
+
+
`
+ if (!this._view) {
+ this._view = view
+ }
+ return view
+ }
+
+ hide () {
+ if (this._view) {
+ this._view.style.display = 'none'
+ }
+ }
+
+ show () {
+ if (this._view) {
+ this._view.style.display = 'block'
+ }
+ }
+
+ update () {
+ if (this._view) {
+ yo.update(this._view, this.render())
+ }
+ }
+
+ _renderTarget () {
+ let last
+ const previous = this._current
+ if (this._nodes && this._nodes.length) {
+ last = this._nodes[this._nodes.length - 1]
+ if (isDefinition(last)) {
+ this._current = last
+ } else {
+ const target = this.contextualListener.declarationOf(last)
+ if (target) {
+ this._current = target
+ } else {
+ this._current = null
+ }
+ }
+ }
+ if (!this._current || !previous || previous.id !== this._current.id || (this.previousElement && !this.previousElement.children.length)) {
+ this.previousElement = this._render(this._current, last)
+ }
+ return this.previousElement
+ }
+
+ _jumpToInternal (position) {
+ const jumpToLine = (lineColumn) => {
+ if (lineColumn.start && lineColumn.start.line && lineColumn.start.column) {
+ this.editor.gotoLine(lineColumn.start.line, lineColumn.end.column + 1)
+ }
+ }
+ let lastCompilationResult = this._deps.compilersArtefacts['__last']
+ if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0 && lastCompilationResult.data) {
+ const lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(
+ position,
+ position.file,
+ lastCompilationResult.getSourceCode().sources,
+ lastCompilationResult.getAsts())
+ const filename = lastCompilationResult.getSourceName(position.file)
+ // TODO: refactor with rendererAPI.errorClick
+ if (filename !== this._deps.config.get('currentFile')) {
+ const provider = this._deps.fileManager.fileProviderOf(filename)
+ if (provider) {
+ provider.exists(filename, (error, exist) => {
+ if (error) return console.log(error)
+ this._deps.fileManager.open(filename)
+ jumpToLine(lineColumn)
+ })
+ }
+ } else {
+ jumpToLine(lineColumn)
+ }
+ }
+ }
+
+ _render (node, nodeAtCursorPosition) {
+ if (!node) return yo`
`
+ let references = this.contextualListener.referencesOf(node)
+ const type = node.typeDescriptions && node.typeDescriptions.typeString ? node.typeDescriptions.typeString : node.nodeType
+ references = `${references ? references.length : '0'} reference(s)`
+
+ let ref = 0
+ const nodes = this.contextualListener.getActiveHighlights()
+ for (const k in nodes) {
+ if (nodeAtCursorPosition.id === nodes[k].nodeId) {
+ ref = k
+ break
+ }
+ }
+
+ // JUMP BETWEEN REFERENCES
+ const jump = (e) => {
+ e.target.dataset.action === 'next' ? ref++ : ref--
+ if (ref < 0) ref = nodes.length - 1
+ if (ref >= nodes.length) ref = 0
+ this._jumpToInternal(nodes[ref].position)
+ }
+
+ const jumpTo = () => {
+ if (node && node.src) {
+ const position = this.sourceMappingDecoder.decode(node.src)
+ if (position) {
+ this._jumpToInternal(position)
+ }
+ }
+ }
+
+ const showGasEstimation = () => {
+ if (node.nodeType === 'FunctionDefinition') {
+ const result = this.contextualListener.gasEstimation(node)
+ const executionCost = ' Execution cost: ' + result.executionCost + ' gas'
+ const codeDepositCost = 'Code deposit cost: ' + result.codeDepositCost + ' gas'
+ const estimatedGas = result.codeDepositCost ? `${codeDepositCost}, ${executionCost}` : `${executionCost}`
+ return yo`
+
+
+ ${estimatedGas}
+
+ `
+ }
+ }
+
+ return yo`
+ ${showGasEstimation()}
+
${type}
+
${node.name}
+
+
${references}
+
+
+
+ `
+ }
+}
+
+function isDefinition (node) {
+ return node.nodeType === 'ContractDefinition' ||
+ node.nodeType === 'FunctionDefinition' ||
+ node.nodeType === 'ModifierDefinition' ||
+ node.nodeType === 'VariableDeclaration' ||
+ node.nodeType === 'StructDefinition' ||
+ node.nodeType === 'EventDefinition'
+}
+
+module.exports = ContextView
diff --git a/apps/remix-ide/src/app/editor/contextualListener.js b/apps/remix-ide/src/app/editor/contextualListener.js
new file mode 100644
index 0000000000..67e6d52c05
--- /dev/null
+++ b/apps/remix-ide/src/app/editor/contextualListener.js
@@ -0,0 +1,244 @@
+'use strict'
+const remixdebug = require('@remix-project/remix-debug')
+const { AstWalker } = require('@remix-project/remix-astwalker')
+const csjs = require('csjs-inject')
+const SourceMappingDecoder = remixdebug.SourceMappingDecoder
+const EventManager = require('../../lib/events')
+const globalRegistry = require('../../global/registry')
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+const profile = {
+ name: 'contextualListener',
+ methods: [],
+ events: [],
+ version: packageJson.version
+}
+
+/*
+ trigger contextChanged(nodes)
+*/
+class ContextualListener extends Plugin {
+ constructor (opts) {
+ super(profile)
+ this.event = new EventManager()
+ this._components = {}
+ this._components.registry = globalRegistry
+ this.editor = opts.editor
+ this.pluginManager = opts.pluginManager
+ this._deps = {
+ compilersArtefacts: this._components.registry.get('compilersartefacts').api,
+ config: this._components.registry.get('config').api,
+ offsetToLineColumnConverter: this._components.registry.get('offsettolinecolumnconverter').api
+ }
+ this._index = {
+ Declarations: {},
+ FlatReferences: {}
+ }
+ this._activeHighlights = []
+ this.editor.event.register('contentChanged', () => { this._stopHighlighting() })
+
+ this.sourceMappingDecoder = new SourceMappingDecoder()
+ this.astWalker = new AstWalker()
+ }
+
+ onActivation () {
+ this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
+ if (languageVersion.indexOf('soljson') !== 0) return
+ this._stopHighlighting()
+ this._index = {
+ Declarations: {},
+ FlatReferences: {}
+ }
+ this._buildIndex(data, source)
+ })
+
+ setInterval(() => {
+ if (this._deps.compilersArtefacts['__last'] && this._deps.compilersArtefacts['__last'].languageversion.indexOf('soljson') === 0) {
+ this._highlightItems(this.editor.getCursorPosition(), this._deps.compilersArtefacts['__last'], this._deps.config.get('currentFile'))
+ }
+ }, 1000)
+ }
+
+ getActiveHighlights () {
+ return [...this._activeHighlights]
+ }
+
+ declarationOf (node) {
+ if (node && node.referencedDeclaration) {
+ return this._index['FlatReferences'][node.referencedDeclaration]
+ }
+ return null
+ }
+
+ referencesOf (node) {
+ return this._index['Declarations'][node.id]
+ }
+
+ _highlightItems (cursorPosition, compilationResult, file) {
+ if (this.currentPosition === cursorPosition) return
+ if (this.currentFile !== file) {
+ this.currentFile = file
+ this.currentPosition = cursorPosition
+ return
+ }
+ this._stopHighlighting()
+ this.currentPosition = cursorPosition
+ this.currentFile = file
+ if (compilationResult && compilationResult.data && compilationResult.data.sources[file]) {
+ const nodes = this.sourceMappingDecoder.nodesAtPosition(null, cursorPosition, compilationResult.data.sources[file])
+ this.nodes = nodes
+ if (nodes && nodes.length && nodes[nodes.length - 1]) {
+ this._highlightExpressions(nodes[nodes.length - 1], compilationResult)
+ }
+ this.event.trigger('contextChanged', [nodes])
+ }
+ }
+
+ _buildIndex (compilationResult, source) {
+ if (compilationResult && compilationResult.sources) {
+ const callback = (node) => {
+ if (node && node.referencedDeclaration) {
+ if (!this._index['Declarations'][node.referencedDeclaration]) {
+ this._index['Declarations'][node.referencedDeclaration] = []
+ }
+ this._index['Declarations'][node.referencedDeclaration].push(node)
+ }
+ this._index['FlatReferences'][node.id] = node
+ }
+ for (const s in compilationResult.sources) {
+ this.astWalker.walkFull(compilationResult.sources[s].ast, callback)
+ }
+ }
+ }
+
+ _highlight (node, compilationResult) {
+ if (!node) return
+ const position = this.sourceMappingDecoder.decode(node.src)
+ const eventId = this._highlightInternal(position, node)
+ let lastCompilationResult = this._deps.compilersArtefacts['__last']
+ if (eventId && lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) {
+ this._activeHighlights.push({ eventId, position, fileTarget: lastCompilationResult.getSourceName(position.file), nodeId: node.id })
+ }
+ }
+
+ _highlightInternal (position, node) {
+ let lastCompilationResult = this._deps.compilersArtefacts['__last']
+ if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) {
+ let lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, lastCompilationResult.getSourceCode().sources, lastCompilationResult.getAsts())
+ const css = csjs`
+ .highlightref_fullLine {
+ position:absolute;
+ z-index:2;
+ opacity: 0.4;
+ background-color: var(--info);
+ }
+ `
+ if (node.nodes && node.nodes.length) {
+ // If node has children, highlight the entire line. if not, just highlight the current source position of the node.
+ lineColumn = {
+ start: {
+ line: lineColumn.start.line,
+ column: 0
+ },
+ end: {
+ line: lineColumn.start.line + 1,
+ column: 0
+ }
+ }
+ }
+ const fileName = lastCompilationResult.getSourceName(position.file)
+ if (fileName) {
+ return this.editor.addMarker(lineColumn, fileName, css.highlightref_fullLine)
+ }
+ }
+ return null
+ }
+
+ _highlightExpressions (node, compilationResult) {
+ const highlights = (id) => {
+ if (this._index['Declarations'] && this._index['Declarations'][id]) {
+ const refs = this._index['Declarations'][id]
+ for (const ref in refs) {
+ const node = refs[ref]
+ this._highlight(node, compilationResult)
+ }
+ }
+ }
+ if (node && node.referencedDeclaration) {
+ highlights(node.referencedDeclaration)
+ const current = this._index['FlatReferences'][node.referencedDeclaration]
+ this._highlight(current, compilationResult)
+ } else {
+ highlights(node.id)
+ this._highlight(node, compilationResult)
+ }
+ this.results = compilationResult
+ }
+
+ _stopHighlighting () {
+ for (const eventKey in this._activeHighlights) {
+ const event = this._activeHighlights[eventKey]
+ this.editor.removeMarker(event.eventId, event.fileTarget)
+ }
+ this.event.trigger('stopHighlighting', [])
+ this._activeHighlights = []
+ }
+
+ gasEstimation (node) {
+ this._loadContractInfos(node)
+ let executionCost, codeDepositCost
+ if (node.nodeType === 'FunctionDefinition') {
+ const visibility = node.visibility
+ if (node.kind !== 'constructor') {
+ const fnName = node.name
+ const fn = fnName + this._getInputParams(node)
+ if (visibility === 'public' || visibility === 'external') {
+ executionCost = this.estimationObj.external[fn]
+ } else if (visibility === 'private' || visibility === 'internal') {
+ executionCost = this.estimationObj.internal[fn]
+ }
+ } else {
+ executionCost = this.creationCost
+ codeDepositCost = this.codeDepositCost
+ }
+ } else {
+ executionCost = '-'
+ }
+ return {executionCost, codeDepositCost}
+ }
+
+ _loadContractInfos (node) {
+ for (const i in this.nodes) {
+ if (this.nodes[i].id === node.scope) {
+ const contract = this.nodes[i]
+ this.contract = this.results.data.contracts[this.results.source.target][contract.name]
+ this.estimationObj = this.contract.evm.gasEstimates
+ this.creationCost = this.estimationObj.creation.totalCost
+ this.codeDepositCost = this.estimationObj.creation.codeDepositCost
+ }
+ }
+ }
+
+ _getInputParams (node) {
+ const params = []
+ let target = node.parameters
+ // for (const i in node.children) {
+ // if (node.children[i].name === 'ParameterList') {
+ // target = node.children[i]
+ // break
+ // }
+ // }
+ if (target) {
+ const children = target.parameters
+ for (const j in children) {
+ if (children[j].nodeType === 'VariableDeclaration') {
+ params.push(children[j].typeDescriptions.typeString)
+ }
+ }
+ }
+ return '(' + params.toString() + ')'
+ }
+}
+
+module.exports = ContextualListener
diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js
new file mode 100644
index 0000000000..996eeedf17
--- /dev/null
+++ b/apps/remix-ide/src/app/editor/editor.js
@@ -0,0 +1,522 @@
+'use strict'
+const EventManager = require('../../lib/events')
+const yo = require('yo-yo')
+const csjs = require('csjs-inject')
+const ace = require('brace')
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+const globalRegistry = require('../../global/registry')
+const SourceHighlighters = require('./SourceHighlighters')
+
+const Range = ace.acequire('ace/range').Range
+require('brace/ext/language_tools')
+require('brace/ext/searchbox')
+const langTools = ace.acequire('ace/ext/language_tools')
+require('ace-mode-solidity/build/remix-ide/mode-solidity')
+require('ace-mode-move/build/remix-ide/mode-move')
+require('ace-mode-zokrates')
+require('ace-mode-lexon')
+require('brace/mode/javascript')
+require('brace/mode/python')
+require('brace/mode/json')
+require('brace/mode/rust')
+require('brace/theme/chrome') // for all light themes
+require('brace/theme/chaos') // for all dark themes
+require('../../assets/js/editor/darkTheme') // a custom one for remix 'Dark' theme
+
+const css = csjs`
+ .ace-editor {
+ width : 100%;
+ }
+`
+document.head.appendChild(yo`
+
+`)
+
+const profile = {
+ displayName: 'Editor',
+ name: 'editor',
+ description: 'service - editor',
+ version: packageJson.version,
+ methods: ['highlight', 'discardHighlight', 'discardHighlightAt', 'clearAnnotations', 'addAnnotation']
+}
+
+class Editor extends Plugin {
+
+ constructor (opts = {}, themeModule) {
+ super(profile)
+ // Dependancies
+ this._components = {}
+ this._components.registry = globalRegistry
+ this._deps = {
+ config: this._components.registry.get('config').api
+ }
+
+ this._themes = {
+ 'light': 'chrome',
+ 'dark': 'chaos',
+ 'remixDark': 'remixDark'
+ }
+ themeModule.events.on('themeChanged', (theme) => {
+ this.setTheme(theme.name === 'Dark' ? 'remixDark' : theme.quality)
+ })
+
+ // Init
+ this.event = new EventManager()
+ this.sessions = {}
+ this.sourceAnnotations = []
+ this.readOnlySessions = {}
+ this.previousInput = ''
+ this.saveTimeout = null
+ this.sourceHighlighters = new SourceHighlighters()
+ this.emptySession = this._createSession('')
+ this.modes = {
+ sol: 'ace/mode/solidity',
+ yul: 'ace/mode/solidity',
+ mvir: 'ace/mode/move',
+ js: 'ace/mode/javascript',
+ py: 'ace/mode/python',
+ vy: 'ace/mode/python',
+ zok: 'ace/mode/zokrates',
+ lex: 'ace/mode/lexon',
+ txt: 'ace/mode/text',
+ json: 'ace/mode/json',
+ abi: 'ace/mode/json',
+ rs: 'ace/mode/rust'
+ }
+
+ // Editor Setup
+ const el = yo`
`
+ this.editor = ace.edit(el)
+
+ ace.acequire('ace/ext/language_tools')
+
+ // Unmap ctrl-l & cmd-l
+ this.editor.commands.bindKeys({
+ 'ctrl-L': null,
+ 'Command-L': null
+ })
+
+ // shortcuts for "Ctrl-"" and "Ctrl+"" to increase/decrease font size of the editor
+ this.editor.commands.addCommand({
+ name: 'increasefontsizeEqual',
+ bindKey: {win: 'Ctrl-=', mac: 'Command-='},
+ exec: (editor) => {
+ this.editorFontSize(1)
+ },
+ readOnly: true
+ })
+
+ this.editor.commands.addCommand({
+ name: 'increasefontsizePlus',
+ bindKey: {win: 'Ctrl-+', mac: 'Command-+'},
+ exec: (editor) => {
+ this.editorFontSize(1)
+ },
+ readOnly: true
+ })
+
+ this.editor.commands.addCommand({
+ name: 'decreasefontsize',
+ bindKey: {win: 'Ctrl--', mac: 'Command--'},
+ exec: (editor) => {
+ this.editorFontSize(-1)
+ },
+ readOnly: true
+ })
+
+ this.editor.setShowPrintMargin(false)
+ this.editor.resize(true)
+
+ this.editor.setOptions({
+ enableBasicAutocompletion: true,
+ enableLiveAutocompletion: true
+ })
+
+ el.className += ' ' + css['ace-editor']
+ el.editor = this.editor // required to access the editor during tests
+ this.render = () => el
+
+ // Completer for editor
+ const flowCompleter = {
+ getCompletions: (editor, session, pos, prefix, callback) => {
+ // @TODO add here other propositions
+ }
+ }
+ langTools.addCompleter(flowCompleter)
+
+ // zoom with Ctrl+wheel
+ window.addEventListener('wheel', (e) => {
+ if (e.ctrlKey && Math.abs(e.wheelY) > 5) {
+ this.editorFontSize(e.wheelY > 0 ? 1 : -1)
+ }
+ })
+
+ // EVENTS LISTENERS
+
+ // Gutter Mouse down
+ this.editor.on('guttermousedown', e => {
+ const target = e.domEvent.target
+ if (target.className.indexOf('ace_gutter-cell') === -1) {
+ return
+ }
+ const row = e.getDocumentPosition().row
+ const breakpoints = e.editor.session.getBreakpoints()
+ for (const k in breakpoints) {
+ if (k === row.toString()) {
+ this.event.trigger('breakpointCleared', [this.currentSession, row])
+ e.editor.session.clearBreakpoint(row)
+ e.stop()
+ return
+ }
+ }
+ this.setBreakpoint(row)
+ this.event.trigger('breakpointAdded', [this.currentSession, row])
+ e.stop()
+ })
+
+ // Do setup on initialisation here
+ this.editor.on('changeSession', () => {
+ this._onChange()
+ this.event.trigger('sessionSwitched', [])
+
+ this.editor.getSession().on('change', () => {
+ this._onChange()
+ this.event.trigger('contentChanged', [])
+ })
+ })
+ }
+
+ highlight (position, filePath, hexColor) {
+ const { from } = this.currentRequest
+ this.sourceHighlighters.highlight(position, filePath, hexColor, from)
+ }
+
+ discardHighlight () {
+ const { from } = this.currentRequest
+ this.sourceHighlighters.discardHighlight(from)
+ }
+
+ discardHighlightAt (line, filePath) {
+ const { from } = this.currentRequest
+ this.sourceHighlighters.discardHighlightAt(line, filePath, from)
+ }
+
+ setTheme (type) {
+ this.editor.setTheme('ace/theme/' + this._themes[type])
+ }
+
+ _onChange () {
+ const currentFile = this._deps.config.get('currentFile')
+ if (!currentFile) {
+ return
+ }
+ const input = this.get(currentFile)
+ if (!input) {
+ return
+ }
+ // if there's no change, don't do anything
+ if (input === this.previousInput) {
+ return
+ }
+ this.previousInput = input
+
+ // fire storage update
+ // NOTE: save at most once per 5 seconds
+ if (this.saveTimeout) {
+ window.clearTimeout(this.saveTimeout)
+ }
+ this.saveTimeout = window.setTimeout(() => {
+ this.event.trigger('requiringToSaveCurrentfile', [])
+ }, 5000)
+ }
+
+ _switchSession (path) {
+ this.currentSession = path
+ this.editor.setSession(this.sessions[this.currentSession])
+ this.editor.setReadOnly(this.readOnlySessions[this.currentSession])
+ this.editor.focus()
+ }
+
+ /**
+ * Get Ace mode base of the extension of the session file
+ * @param {string} path Path of the file
+ */
+ _getMode (path) {
+ if (!path) return this.modes['txt']
+ const root = path.split('#')[0].split('?')[0]
+ let ext = root.indexOf('.') !== -1 ? /[^.]+$/.exec(root) : null
+ if (ext) ext = ext[0]
+ else ext = 'txt'
+ return ext && this.modes[ext] ? this.modes[ext] : this.modes['txt']
+ }
+
+ /**
+ * Create an Ace session
+ * @param {string} content Content of the file to open
+ * @param {string} mode Ace Mode for this file [Default is `text`]
+ */
+ _createSession (content, mode) {
+ const s = new ace.EditSession(content)
+ s.setMode(mode || 'ace/mode/text')
+ s.setUndoManager(new ace.UndoManager())
+ s.setTabSize(4)
+ s.setUseSoftTabs(true)
+ return s
+ }
+
+ /**
+ * Attempts to find the string in the current document
+ * @param {string} string
+ */
+ find (string) {
+ return this.editor.find(string)
+ }
+
+ /**
+ * Display an Empty read-only session
+ */
+ displayEmptyReadOnlySession () {
+ this.currentSession = null
+ this.editor.setSession(this.emptySession)
+ this.editor.setReadOnly(true)
+ }
+
+ /**
+ * Sets a breakpoint on the row number
+ * @param {number} row Line index of the breakpoint
+ * @param {string} className Class of the breakpoint
+ */
+ setBreakpoint (row, className) {
+ this.editor.session.setBreakpoint(row, className)
+ }
+
+ /**
+ * Increment the font size (in pixels) for the editor text.
+ * @param {number} incr The amount of pixels to add to the font.
+ */
+ editorFontSize (incr) {
+ let newSize = this.editor.getFontSize() + incr
+ if (newSize >= 6) {
+ this.editor.setFontSize(newSize)
+ }
+ }
+
+ /**
+ * Set the text in the current session, if any.
+ * @param {string} text New text to be place.
+ */
+ setText (text) {
+ if (this.currentSession && this.sessions[this.currentSession]) {
+ this.sessions[this.currentSession].setValue(text)
+ }
+ }
+
+ /**
+ * Upsert and open a session.
+ * @param {string} path Path of the session to open.
+ * @param {string} content Content of the document or update.
+ */
+ open (path, content) {
+ /*
+ we have the following cases:
+ - URL prepended with "localhost"
+ - URL prepended with "browser"
+ - URL not prepended with the file explorer. We assume (as it is in the whole app, that this is a "browser" URL
+ */
+ if (!path.startsWith('localhost') && !path.startsWith('browser')) path = `browser/${path}`
+ if (!this.sessions[path]) {
+ const session = this._createSession(content, this._getMode(path))
+ this.sessions[path] = session
+ this.readOnlySessions[path] = false
+ } else if (this.sessions[path].getValue() !== content) {
+ this.sessions[path].setValue(content)
+ }
+ this._switchSession(path)
+ }
+
+ /**
+ * Upsert and Open a session and set it as Read-only.
+ * @param {string} path Path of the session to open.
+ * @param {string} content Content of the document or update.
+ */
+ openReadOnly (path, content) {
+ if (!this.sessions[path]) {
+ const session = this._createSession(content, this._getMode(path))
+ this.sessions[path] = session
+ this.readOnlySessions[path] = true
+ }
+ this._switchSession(path)
+ }
+
+ /**
+ * Content of the current session
+ * @return {String} content of the file referenced by @arg path
+ */
+ currentContent () {
+ return this.get(this.current())
+ }
+
+ /**
+ * Content of the session targeted by @arg path
+ * if @arg path is null, the content of the current session is returned
+ * @param {string} path Path of the session to get.
+ * @return {String} content of the file referenced by @arg path
+ */
+ get (path) {
+ if (!path || this.currentSession === path) {
+ return this.editor.getValue()
+ } else if (this.sessions[path]) {
+ return this.sessions[path].getValue()
+ }
+ }
+
+ /**
+ * Path of the currently editing file
+ * returns `undefined` if no session is being editer
+ * @return {String} path of the current session
+ */
+ current () {
+ if (this.editor.getSession() === this.emptySession) {
+ return
+ }
+ return this.currentSession
+ }
+
+ /**
+ * The position of the cursor
+ */
+ getCursorPosition () {
+ return this.editor.session.doc.positionToIndex(
+ this.editor.getCursorPosition(),
+ 0
+ )
+ }
+
+ /**
+ * Remove the current session from the list of sessions.
+ */
+ discardCurrentSession () {
+ if (this.sessions[this.currentSession]) {
+ delete this.sessions[this.currentSession]
+ this.currentSession = null
+ }
+ }
+
+ /**
+ * Remove a session based on its path.
+ * @param {string} path
+ */
+ discard (path) {
+ if (this.sessions[path]) delete this.sessions[path]
+ if (this.currentSession === path) this.currentSession = null
+ }
+
+ /**
+ * Resize the editor, and sets whether or not line wrapping is enabled.
+ * @param {boolean} useWrapMode Enable (or disable) wrap mode
+ */
+ resize (useWrapMode) {
+ this.editor.resize()
+ const session = this.editor.getSession()
+ session.setUseWrapMode(useWrapMode)
+ if (session.getUseWrapMode()) {
+ const characterWidth = this.editor.renderer.characterWidth
+ const contentWidth = this.editor.container.ownerDocument.getElementsByClassName(
+ 'ace_scroller'
+ )[0].clientWidth
+
+ if (contentWidth > 0) {
+ session.setWrapLimit(parseInt(contentWidth / characterWidth, 10))
+ }
+ }
+ }
+
+ /**
+ * Adds a new marker to the given `Range`.
+ * @param {*} lineColumnPos
+ * @param {string} source Path of the session to add the mark on.
+ * @param {string} cssClass css to apply to the mark.
+ */
+ addMarker (lineColumnPos, source, cssClass) {
+ const currentRange = new Range(
+ lineColumnPos.start.line,
+ lineColumnPos.start.column,
+ lineColumnPos.end.line,
+ lineColumnPos.end.column
+ )
+ if (this.sessions[source]) {
+ return this.sessions[source].addMarker(currentRange, cssClass)
+ }
+ return null
+ }
+
+ /**
+ * Scrolls to a line. If center is true, it puts the line in middle of screen (or attempts to).
+ * @param {number} line The line to scroll to
+ * @param {boolean} center If true
+ * @param {boolean} animate If true animates scrolling
+ * @param {Function} callback Function to be called when the animation has finished
+ */
+ scrollToLine (line, center, animate, callback) {
+ this.editor.scrollToLine(line, center, animate, callback)
+ }
+
+ /**
+ * Remove a marker from the session
+ * @param {string} markerId Id of the marker
+ * @param {string} source Path of the session
+ */
+ removeMarker (markerId, source) {
+ if (this.sessions[source]) {
+ this.sessions[source].removeMarker(markerId)
+ }
+ }
+
+ /**
+ * Clears all the annotations for the current session.
+ */
+ clearAnnotations () {
+ this.sourceAnnotations = []
+ this.editor.getSession().clearAnnotations()
+ }
+
+ /**
+ * Add an annotation to the current session.
+ * @param {Object} annotation
+ */
+ addAnnotation (annotation) {
+ this.sourceAnnotations[this.sourceAnnotations.length] = annotation
+ this.setAnnotations(this.sourceAnnotations)
+ }
+
+ /**
+ * Set a list of annotations to the current session.
+ * @param {Array} annotation
+ */
+ setAnnotations (sourceAnnotations) {
+ this.editor.getSession().setAnnotations(sourceAnnotations)
+ }
+
+ /**
+ * Moves the cursor and focus to the specified line and column number
+ * @param {number} line
+ * @param {number} col
+ */
+ gotoLine (line, col) {
+ this.editor.focus()
+ this.editor.gotoLine(line + 1, col - 1, true)
+ }
+}
+
+module.exports = Editor
diff --git a/apps/remix-ide/src/app/editor/example-contracts.js b/apps/remix-ide/src/app/editor/example-contracts.js
new file mode 100644
index 0000000000..a825255904
--- /dev/null
+++ b/apps/remix-ide/src/app/editor/example-contracts.js
@@ -0,0 +1,249 @@
+'use strict'
+
+const storage = `pragma solidity >=0.4.22 <0.7.0;
+
+/**
+ * @title Storage
+ * @dev Store & retrieve value in a variable
+ */
+contract Storage {
+
+ uint256 number;
+
+ /**
+ * @dev Store value in variable
+ * @param num value to store
+ */
+ function store(uint256 num) public {
+ number = num;
+ }
+
+ /**
+ * @dev Return value
+ * @return value of 'number'
+ */
+ function retrieve() public view returns (uint256){
+ return number;
+ }
+}`
+
+const owner = `pragma solidity >=0.4.22 <0.7.0;
+
+/**
+ * @title Owner
+ * @dev Set & change owner
+ */
+contract Owner {
+
+ address private owner;
+
+ // event for EVM logging
+ event OwnerSet(address indexed oldOwner, address indexed newOwner);
+
+ // modifier to check if caller is owner
+ modifier isOwner() {
+ // If the first argument of 'require' evaluates to 'false', execution terminates and all
+ // changes to the state and to Ether balances are reverted.
+ // This used to consume all gas in old EVM versions, but not anymore.
+ // It is often a good idea to use 'require' to check if functions are called correctly.
+ // As a second argument, you can also provide an explanation about what went wrong.
+ require(msg.sender == owner, "Caller is not owner");
+ _;
+ }
+
+ /**
+ * @dev Set contract deployer as owner
+ */
+ constructor() public {
+ owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
+ emit OwnerSet(address(0), owner);
+ }
+
+ /**
+ * @dev Change owner
+ * @param newOwner address of new owner
+ */
+ function changeOwner(address newOwner) public isOwner {
+ emit OwnerSet(owner, newOwner);
+ owner = newOwner;
+ }
+
+ /**
+ * @dev Return owner address
+ * @return address of owner
+ */
+ function getOwner() external view returns (address) {
+ return owner;
+ }
+}`
+
+const ballot = `pragma solidity >=0.4.22 <0.7.0;
+
+/**
+ * @title Ballot
+ * @dev Implements voting process along with vote delegation
+ */
+contract Ballot {
+
+ struct Voter {
+ uint weight; // weight is accumulated by delegation
+ bool voted; // if true, that person already voted
+ address delegate; // person delegated to
+ uint vote; // index of the voted proposal
+ }
+
+ struct Proposal {
+ // If you can limit the length to a certain number of bytes,
+ // always use one of bytes1 to bytes32 because they are much cheaper
+ bytes32 name; // short name (up to 32 bytes)
+ uint voteCount; // number of accumulated votes
+ }
+
+ address public chairperson;
+
+ mapping(address => Voter) public voters;
+
+ Proposal[] public proposals;
+
+ /**
+ * @dev Create a new ballot to choose one of 'proposalNames'.
+ * @param proposalNames names of proposals
+ */
+ constructor(bytes32[] memory proposalNames) public {
+ chairperson = msg.sender;
+ voters[chairperson].weight = 1;
+
+ for (uint i = 0; i < proposalNames.length; i++) {
+ // 'Proposal({...})' creates a temporary
+ // Proposal object and 'proposals.push(...)'
+ // appends it to the end of 'proposals'.
+ proposals.push(Proposal({
+ name: proposalNames[i],
+ voteCount: 0
+ }));
+ }
+ }
+
+ /**
+ * @dev Give 'voter' the right to vote on this ballot. May only be called by 'chairperson'.
+ * @param voter address of voter
+ */
+ function giveRightToVote(address voter) public {
+ require(
+ msg.sender == chairperson,
+ "Only chairperson can give right to vote."
+ );
+ require(
+ !voters[voter].voted,
+ "The voter already voted."
+ );
+ require(voters[voter].weight == 0);
+ voters[voter].weight = 1;
+ }
+
+ /**
+ * @dev Delegate your vote to the voter 'to'.
+ * @param to address to which vote is delegated
+ */
+ function delegate(address to) public {
+ Voter storage sender = voters[msg.sender];
+ require(!sender.voted, "You already voted.");
+ require(to != msg.sender, "Self-delegation is disallowed.");
+
+ while (voters[to].delegate != address(0)) {
+ to = voters[to].delegate;
+
+ // We found a loop in the delegation, not allowed.
+ require(to != msg.sender, "Found loop in delegation.");
+ }
+ sender.voted = true;
+ sender.delegate = to;
+ Voter storage delegate_ = voters[to];
+ if (delegate_.voted) {
+ // If the delegate already voted,
+ // directly add to the number of votes
+ proposals[delegate_.vote].voteCount += sender.weight;
+ } else {
+ // If the delegate did not vote yet,
+ // add to her weight.
+ delegate_.weight += sender.weight;
+ }
+ }
+
+ /**
+ * @dev Give your vote (including votes delegated to you) to proposal 'proposals[proposal].name'.
+ * @param proposal index of proposal in the proposals array
+ */
+ function vote(uint proposal) public {
+ Voter storage sender = voters[msg.sender];
+ require(sender.weight != 0, "Has no right to vote");
+ require(!sender.voted, "Already voted.");
+ sender.voted = true;
+ sender.vote = proposal;
+
+ // If 'proposal' is out of the range of the array,
+ // this will throw automatically and revert all
+ // changes.
+ proposals[proposal].voteCount += sender.weight;
+ }
+
+ /**
+ * @dev Computes the winning proposal taking all previous votes into account.
+ * @return winningProposal_ index of winning proposal in the proposals array
+ */
+ function winningProposal() public view
+ returns (uint winningProposal_)
+ {
+ uint winningVoteCount = 0;
+ for (uint p = 0; p < proposals.length; p++) {
+ if (proposals[p].voteCount > winningVoteCount) {
+ winningVoteCount = proposals[p].voteCount;
+ winningProposal_ = p;
+ }
+ }
+ }
+
+ /**
+ * @dev Calls winningProposal() function to get the index of the winner contained in the proposals array and then
+ * @return winnerName_ the name of the winner
+ */
+ function winnerName() public view
+ returns (bytes32 winnerName_)
+ {
+ winnerName_ = proposals[winningProposal()].name;
+ }
+}
+`
+
+var ballotTest = `pragma solidity >=0.4.22 <0.7.0;
+import "remix_tests.sol"; // this import is automatically injected by Remix.
+import "../3_Ballot.sol";
+
+contract BallotTest {
+
+ bytes32[] proposalNames;
+
+ Ballot ballotToTest;
+ function beforeAll () public {
+ proposalNames.push(bytes32("candidate1"));
+ ballotToTest = new Ballot(proposalNames);
+ }
+
+ function checkWinningProposal () public {
+ ballotToTest.vote(0);
+ Assert.equal(ballotToTest.winningProposal(), uint(0), "proposal at index 0 should be the winning proposal");
+ Assert.equal(ballotToTest.winnerName(), bytes32("candidate1"), "candidate1 should be the winner name");
+ }
+
+ function checkWinninProposalWithReturnValue () public view returns (bool) {
+ return ballotToTest.winningProposal() == 0;
+ }
+}
+`
+
+module.exports = {
+ storage: { name: '1_Storage.sol', content: storage },
+ owner: { name: '2_Owner.sol', content: owner },
+ ballot: { name: '3_Ballot.sol', content: ballot },
+ ballot_test: { name: 'tests/4_Ballot_test.sol', content: ballotTest }
+}
diff --git a/apps/remix-ide/src/app/editor/sourceHighlighter.js b/apps/remix-ide/src/app/editor/sourceHighlighter.js
new file mode 100644
index 0000000000..8b45d3dc49
--- /dev/null
+++ b/apps/remix-ide/src/app/editor/sourceHighlighter.js
@@ -0,0 +1,84 @@
+'use strict'
+const csjs = require('csjs-inject')
+const globlalRegistry = require('../../global/registry')
+
+class SourceHighlighter {
+ constructor (localRegistry) {
+ this._components = {}
+ this._components.registry = localRegistry || globlalRegistry
+ // dependencies
+ this._deps = {
+ editor: this._components.registry.get('editor').api,
+ config: this._components.registry.get('config').api,
+ fileManager: this._components.registry.get('filemanager').api,
+ compilerArtefacts: this._components.registry.get('compilersartefacts').api
+ }
+ this.position = null
+ this.statementMarker = null
+ this.fullLineMarker = null
+ this.source = null
+ }
+
+ currentSourceLocation (lineColumnPos, location) {
+ if (this.statementMarker) this._deps.editor.removeMarker(this.statementMarker, this.source)
+ if (this.fullLineMarker) this._deps.editor.removeMarker(this.fullLineMarker, this.source)
+ let lastCompilationResult = this._deps.compilerArtefacts['__last']
+ if (location && location.file !== undefined && lastCompilationResult) {
+ const path = lastCompilationResult.getSourceName(location.file)
+ if (path) {
+ this.currentSourceLocationFromfileName(lineColumnPos, path)
+ }
+ }
+ }
+
+ async currentSourceLocationFromfileName (lineColumnPos, filePath, style) {
+ if (this.statementMarker) this._deps.editor.removeMarker(this.statementMarker, this.source)
+ if (this.fullLineMarker) this._deps.editor.removeMarker(this.fullLineMarker, this.source)
+ this.statementMarker = null
+ this.fullLineMarker = null
+ this.source = null
+ if (lineColumnPos) {
+ this.source = filePath
+ if (this._deps.fileManager.currentFile() !== this.source) {
+ await this._deps.fileManager.open(this.source)
+ this.source = this._deps.fileManager.currentFile()
+ }
+
+ const css = csjs`
+ .highlightcode {
+ position:absolute;
+ z-index:20;
+ opacity: 0.3;
+ background-color: ${style || 'var(--info)'};
+ }
+ .highlightcode_fullLine {
+ position:absolute;
+ z-index:20;
+ opacity: 0.5;
+ background-color: ${style || 'var(--info)'};
+ }
+ .customBackgroundColor {
+ background-color: ${style || 'var(--info)'};
+ }
+ `
+
+ this.statementMarker = this._deps.editor.addMarker(lineColumnPos, this.source, css.highlightcode.className + ' ' + css.customBackgroundColor.className + ' ' + `highlightLine${lineColumnPos.start.line}`)
+ this._deps.editor.scrollToLine(lineColumnPos.start.line, true, true, function () {})
+ this.position = lineColumnPos
+ if (lineColumnPos.start.line === lineColumnPos.end.line) {
+ this.fullLineMarker = this._deps.editor.addMarker({
+ start: {
+ line: lineColumnPos.start.line,
+ column: 0
+ },
+ end: {
+ line: lineColumnPos.start.line + 1,
+ column: 0
+ }
+ }, this.source, css.highlightcode_fullLine.className)
+ }
+ }
+ }
+}
+
+module.exports = SourceHighlighter
diff --git a/apps/remix-ide/src/app/editor/styles/contextView-styles.js b/apps/remix-ide/src/app/editor/styles/contextView-styles.js
new file mode 100644
index 0000000000..5303a356fa
--- /dev/null
+++ b/apps/remix-ide/src/app/editor/styles/contextView-styles.js
@@ -0,0 +1,59 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .contextview {
+ opacity : 1;
+ position : relative;
+ height : 25px;
+ }
+ .container {
+ padding : 1px 15px;
+ }
+ .line {
+ display : flex;
+ justify-content : flex-end;
+ align-items : center;
+ text-overflow : ellipsis;
+ overflow : hidden;
+ white-space : nowrap;
+ font-size : 13px;
+ }
+ .type {
+ font-style : italic;
+ margin-right : 5px;
+ }
+ .name {
+ font-weight : bold;
+ }
+ .jump {
+ cursor : pointer;
+ margin : 0 5px;
+ }
+ .jump:hover {
+ color : var(--secondary);
+ }
+ .referencesnb {
+ float : right;
+ margin-left : 15px;
+ }
+ .gasEstimation {
+ margin-right : 15px;
+ display : flex;
+ align-items : center;
+ }
+ .gasStationIcon {
+ margin-right : 5px;
+ }
+ .contextviewcontainer {
+ z-index : 50;
+ border-radius : 1px;
+ border : 2px solid var(--secondary);
+ }
+ .contextviewcontainer{
+ z-index : 50;
+ border-radius : 1px;
+ border : 2px solid var(--secondary);
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/files/compiler-metadata.js b/apps/remix-ide/src/app/files/compiler-metadata.js
new file mode 100644
index 0000000000..721457464a
--- /dev/null
+++ b/apps/remix-ide/src/app/files/compiler-metadata.js
@@ -0,0 +1,147 @@
+'use strict'
+var CompilerAbstract = require('../compiler/compiler-abstract')
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+const profile = {
+ name: 'compilerMetadata',
+ methods: ['deployMetadataOf'],
+ events: [],
+ version: packageJson.version
+}
+
+class CompilerMetadata extends Plugin {
+ constructor (blockchain, fileManager, config) {
+ super(profile)
+ this.blockchain = blockchain
+ this.fileManager = fileManager
+ this.config = config
+ this.networks = ['VM:-', 'main:1', 'ropsten:3', 'rinkeby:4', 'kovan:42', 'görli:5', 'Custom']
+ this.innerPath = 'artifacts'
+ }
+
+ _JSONFileName (path, contractName) {
+ return path + '/' + this.innerPath + '/' + contractName + '.json'
+ }
+
+ _MetadataFileName (path, contractName) {
+ return path + '/' + this.innerPath + '/' + contractName + '_metadata' + '.json'
+ }
+
+ onActivation () {
+ var self = this
+ this.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
+ if (!self.config.get('settings/generate-contract-metadata')) return
+ let compiler = new CompilerAbstract(languageVersion, data, source)
+ var provider = self.fileManager.currentFileProvider()
+ var path = self.fileManager.currentPath()
+ if (provider && path) {
+ compiler.visitContracts((contract) => {
+ if (contract.file !== source.target) return
+
+ var fileName = self._JSONFileName(path, contract.name)
+ var metadataFileName = self._MetadataFileName(path, contract.name)
+ provider.get(fileName, (error, content) => {
+ if (!error) {
+ content = content || '{}'
+ var metadata
+ try {
+ metadata = JSON.parse(content)
+ } catch (e) {
+ console.log(e)
+ }
+
+ var deploy = metadata.deploy || {}
+ self.networks.forEach((network) => {
+ deploy[network] = self._syncContext(contract, deploy[network] || {})
+ })
+
+ let parsedMetadata
+ try {
+ parsedMetadata = JSON.parse(contract.object.metadata)
+ } catch (e) {
+ console.log(e)
+ }
+ if (parsedMetadata) provider.set(metadataFileName, JSON.stringify(parsedMetadata, null, '\t'))
+
+ var data = {
+ deploy,
+ data: {
+ bytecode: contract.object.evm.bytecode,
+ deployedBytecode: contract.object.evm.deployedBytecode,
+ gasEstimates: contract.object.evm.gasEstimates,
+ methodIdentifiers: contract.object.evm.methodIdentifiers
+ },
+ abi: contract.object.abi
+ }
+
+ provider.set(fileName, JSON.stringify(data, null, '\t'))
+ }
+ })
+ })
+ }
+ })
+ }
+
+ _syncContext (contract, metadata) {
+ var linkReferences = metadata['linkReferences']
+ var autoDeployLib = metadata['autoDeployLib']
+ if (!linkReferences) linkReferences = {}
+ if (autoDeployLib === undefined) autoDeployLib = true
+
+ for (var libFile in contract.object.evm.bytecode.linkReferences) {
+ if (!linkReferences[libFile]) linkReferences[libFile] = {}
+ for (var lib in contract.object.evm.bytecode.linkReferences[libFile]) {
+ if (!linkReferences[libFile][lib]) {
+ linkReferences[libFile][lib] = ''
+ }
+ }
+ }
+ metadata['linkReferences'] = linkReferences
+ metadata['autoDeployLib'] = autoDeployLib
+ return metadata
+ }
+
+ // TODO: is only called by dropdownLogic and can be moved there
+ deployMetadataOf (contractName, fileLocation) {
+ return new Promise((resolve, reject) => {
+ var provider
+ let path
+ if (fileLocation) {
+ provider = this.fileManager.fileProviderOf(fileLocation)
+ path = fileLocation.split('/')
+ path.pop()
+ path = path.join('/')
+ } else {
+ provider = this.fileManager.currentFileProvider()
+ path = this.fileManager.currentPath()
+ }
+
+ if (provider && path) {
+ this.blockchain.detectNetwork((err, { id, name } = {}) => {
+ if (err) {
+ console.log(err)
+ reject(err)
+ } else {
+ var fileName = this._JSONFileName(path, contractName)
+ provider.get(fileName, (error, content) => {
+ if (error) return reject(error)
+ if (!content) return resolve()
+ try {
+ var metadata = JSON.parse(content)
+ metadata = metadata.deploy || {}
+ return resolve(metadata[name + ':' + id] || metadata[name] || metadata[id] || metadata[name.toLowerCase() + ':' + id] || metadata[name.toLowerCase()])
+ } catch (e) {
+ reject(e.message)
+ }
+ })
+ }
+ })
+ } else {
+ reject(`Please select the folder in the file explorer where the metadata of ${contractName} can be found`)
+ }
+ })
+ }
+}
+
+module.exports = CompilerMetadata
diff --git a/apps/remix-ide/src/app/files/file-explorer.js b/apps/remix-ide/src/app/files/file-explorer.js
new file mode 100644
index 0000000000..1b6d89797e
--- /dev/null
+++ b/apps/remix-ide/src/app/files/file-explorer.js
@@ -0,0 +1,698 @@
+/* global FileReader */
+/* global fetch */
+const async = require('async')
+const Gists = require('gists')
+const modalDialogCustom = require('../ui/modal-dialog-custom')
+const tooltip = require('../ui/tooltip')
+const QueryParams = require('../../lib/query-params')
+const helper = require('../../lib/helper')
+const yo = require('yo-yo')
+const Treeview = require('../ui/TreeView')
+const modalDialog = require('../ui/modaldialog')
+const EventManager = require('../../lib/events')
+const contextMenu = require('../ui/contextMenu')
+const css = require('./styles/file-explorer-styles')
+const globalRegistry = require('../../global/registry')
+const queryParams = new QueryParams()
+let MENU_HANDLE
+
+function fileExplorer (localRegistry, files, menuItems, plugin) {
+ var self = this
+ this.events = new EventManager()
+ // file provider backend
+ this.files = files
+ // element currently focused on
+ this.focusElement = null
+ // path currently focused on
+ this.focusPath = null
+ let allItems =
+ [
+ { action: 'createNewFile',
+ title: 'Create New File',
+ icon: 'fas fa-plus-circle'
+ },
+ { action: 'publishToGist',
+ title: 'Publish all [browser] explorer files to a github gist',
+ icon: 'fab fa-github'
+ },
+ { action: 'uploadFile',
+ title: 'Add Local file to the Browser Storage Explorer',
+ icon: 'far fa-folder-open'
+ },
+ { action: 'updateGist',
+ title: 'Update the current [gist] explorer',
+ icon: 'fab fa-github'
+ }
+ ]
+ // menu items
+ this.menuItems = allItems.filter(
+ (item) => {
+ if (menuItems) return menuItems.find((name) => { return name === item.action })
+ }
+ )
+
+ self._components = {}
+ self._components.registry = localRegistry || globalRegistry
+ self._deps = {
+ config: self._components.registry.get('config').api,
+ editor: self._components.registry.get('editor').api,
+ fileManager: self._components.registry.get('filemanager').api
+ }
+
+ self.events.register('focus', function (path) {
+ self._deps.fileManager.open(path)
+ })
+
+ self._components.registry.put({ api: self, name: `fileexplorer/${self.files.type}` })
+
+ // warn if file changed outside of Remix
+ function remixdDialog () {
+ return yo`This file has been changed outside of Remix IDE.
`
+ }
+
+ this.files.event.register('fileExternallyChanged', (path, file) => {
+ if (self._deps.config.get('currentFile') === path && self._deps.editor.currentContent() && self._deps.editor.currentContent() !== file.content) {
+ if (this.files.isReadOnly(path)) return self._deps.editor.setText(file.content)
+
+ modalDialog(path + ' changed', remixdDialog(),
+ {
+ label: 'Replace by the new content',
+ fn: () => {
+ self._deps.editor.setText(file.content)
+ }
+ },
+ {
+ label: 'Keep the content displayed in Remix',
+ fn: () => {}
+ }
+ )
+ }
+ })
+
+ // register to event of the file provider
+ files.event.register('fileRemoved', fileRemoved)
+ files.event.register('fileRenamed', fileRenamed)
+ files.event.register('fileRenamedError', fileRenamedError)
+ files.event.register('fileAdded', fileAdded)
+ files.event.register('folderAdded', folderAdded)
+
+ function fileRenamedError (error) {
+ modalDialogCustom.alert(error)
+ }
+
+ function fileAdded (filepath) {
+ self.ensureRoot(() => {
+ const folderpath = filepath.split('/').slice(0, -1).join('/')
+ const currentTree = self.treeView.nodeAt(folderpath)
+ if (!self.treeView.isExpanded(folderpath)) self.treeView.expand(folderpath)
+ if (currentTree) {
+ self.files.resolveDirectory(folderpath, (error, fileTree) => {
+ if (error) console.error(error)
+ if (!fileTree) return
+ fileTree = normalize(folderpath, fileTree)
+ self.treeView.updateNodeFromJSON(folderpath, fileTree, true)
+ self.focusElement = self.treeView.labelAt(self.focusPath)
+ // TODO: here we update the selected file (it applicable)
+ // cause we are refreshing the interface of the whole directory when there's a new file.
+ if (self.focusElement && !self.focusElement.classList.contains('bg-secondary')) {
+ self.focusElement.classList.add('bg-secondary')
+ }
+ })
+ }
+ })
+ }
+
+ function extractNameFromKey (key) {
+ const keyPath = key.split('/')
+
+ return keyPath[keyPath.length - 1]
+ }
+
+ function folderAdded (folderpath) {
+ self.ensureRoot(() => {
+ folderpath = folderpath.split('/').slice(0, -1).join('/')
+ self.files.resolveDirectory(folderpath, (error, fileTree) => {
+ if (error) console.error(error)
+ if (!fileTree) return
+ fileTree = normalize(folderpath, fileTree)
+ self.treeView.updateNodeFromJSON(folderpath, fileTree, true)
+ if (!self.treeView.isExpanded(folderpath)) self.treeView.expand(folderpath)
+ })
+ })
+ }
+
+ function fileRemoved (filepath) {
+ const label = self.treeView.labelAt(filepath)
+ filepath = filepath.split('/').slice(0, -1).join('/')
+
+ if (label && label.parentElement) {
+ label.parentElement.removeChild(label)
+ }
+
+ self.updatePath(filepath)
+ }
+
+ function fileRenamed (oldName, newName, isFolder) {
+ fileRemoved(oldName)
+ fileAdded(newName)
+ }
+
+ // make interface and register to nodeClick, leafClick
+ self.treeView = new Treeview({
+ extractData: function extractData (value, tree, key) {
+ var newValue = {}
+ // var isReadOnly = false
+ var isFile = false
+ Object.keys(value).filter(function keep (x) {
+ if (x === '/content') isFile = true
+ if (x[0] !== '/') return true
+ }).forEach(function (x) { newValue[x] = value[x] })
+ return {
+ path: (tree || {}).path ? tree.path + '/' + key : key,
+ children: isFile ? undefined
+ : value instanceof Array ? value.map((item, index) => ({
+ key: index, value: item
+ })) : value instanceof Object ? Object.keys(value).map(subkey => ({
+ key: subkey, value: value[subkey]
+ })) : undefined
+ }
+ },
+ formatSelf: function formatSelf (key, data, li) {
+ const isRoot = data.path === self.files.type
+ const isFolder = !!data.children
+ return yo`
+
+
+ ${key.split('/').pop()}
+
+ ${isRoot ? self.renderMenuItems() : ''}
+
+ `
+ }
+ })
+
+ /**
+ * Extracts first two folders as a subpath from the path.
+ **/
+ function extractExternalFolder (path) {
+ const firstSlIndex = path.indexOf('/', 1)
+ if (firstSlIndex === -1) return ''
+ const secondSlIndex = path.indexOf('/', firstSlIndex + 1)
+ if (secondSlIndex === -1) return ''
+ return path.substring(0, secondSlIndex)
+ }
+
+ self.treeView.event.register('nodeRightClick', function (key, data, label, event) {
+ if (self.files.readonly) return
+ if (key === self.files.type) return
+ MENU_HANDLE && MENU_HANDLE.hide(null, true)
+ let actions = {}
+ const provider = self._deps.fileManager.fileProviderOf(key)
+ actions['Create File'] = () => self.createNewFile(key)
+ actions['Create Folder'] = () => self.createNewFolder(key)
+ // @todo(#2386) not fully implemented. Readd later when fixed
+ if (provider.isExternalFolder(key)) {
+ /* actions['Discard changes'] = () => {
+ modalDialogCustom.confirm(
+ 'Discard changes',
+ 'Are you sure you want to discard all your changes?',
+ () => { self.files.discardChanges(key) },
+ () => {}
+ )
+ } */
+ } else {
+ const folderPath = extractExternalFolder(key)
+ actions['Rename'] = () => {
+ if (self.files.isReadOnly(key)) { return tooltip('cannot rename folder. ' + self.files.type + ' is a read only explorer') }
+ var name = label.querySelector('span[data-path="' + key + '"]')
+ if (name) editModeOn(name)
+ }
+ actions['Delete'] = () => {
+ if (self.files.isReadOnly(key)) { return tooltip('cannot delete folder. ' + self.files.type + ' is a read only explorer') }
+ const currentFoldername = extractNameFromKey(key)
+
+ modalDialogCustom.confirm(`Confirm to delete folder`, `Are you sure you want to delete ${currentFoldername} folder?`,
+ async () => {
+ const fileManager = self._deps.fileManager
+ const removeFolder = await fileManager.remove(key)
+
+ if (!removeFolder) {
+ tooltip(`failed to remove ${key}. Make sure the directory is empty before removing it.`)
+ }
+ }, () => {})
+ }
+ if (folderPath === 'browser/gists') {
+ actions['Push changes to gist'] = () => {
+ const id = key.substr(key.lastIndexOf('/') + 1, key.length - 1)
+ modalDialogCustom.confirm(
+ 'Push back to Gist',
+ 'Are you sure you want to push all your changes back to Gist?',
+ () => { self.toGist(id) },
+ () => {}
+ )
+ }
+ }
+ }
+ MENU_HANDLE = contextMenu(event, actions)
+ })
+
+ self.treeView.event.register('leafRightClick', function (key, data, label, event) {
+ if (key === self.files.type) return
+ MENU_HANDLE && MENU_HANDLE.hide(null, true)
+ let actions = {}
+ const provider = self._deps.fileManager.fileProviderOf(key)
+ if (!provider.isExternalFolder(key)) {
+ actions['Create Folder'] = () => self.createNewFolder(self._deps.fileManager.extractPathOf(key))
+ actions['Rename'] = () => {
+ if (self.files.isReadOnly(key)) { return tooltip('cannot rename file. ' + self.files.type + ' is a read only explorer') }
+ var name = label.querySelector('span[data-path="' + key + '"]')
+ if (name) editModeOn(name)
+ }
+ actions['Delete'] = () => {
+ if (self.files.isReadOnly(key)) { return tooltip('cannot delete file. ' + self.files.type + ' is a read only explorer') }
+ const currentFilename = extractNameFromKey(key)
+
+ modalDialogCustom.confirm(
+ `Delete file`, `Are you sure you want to delete ${currentFilename} file?`,
+ async () => {
+ const fileManager = self._deps.fileManager
+ const removeFile = await fileManager.remove(key)
+
+ if (!removeFile) {
+ tooltip(`Failed to remove file ${key}.`)
+ }
+ },
+ () => {}
+ )
+ }
+ if (key.endsWith('.js')) {
+ actions['Run'] = async () => {
+ provider.get(key, (error, content) => {
+ if (error) return console.log(error)
+ plugin.call('scriptRunner', 'execute', content)
+ })
+ }
+ }
+ }
+ MENU_HANDLE = contextMenu(event, actions)
+ })
+
+ self.treeView.event.register('leafClick', function (key, data, label) {
+ self.events.trigger('focus', [key])
+ })
+
+ self.treeView.event.register('nodeClick', function (path, childrenContainer) {
+ if (!childrenContainer) return
+ if (childrenContainer.style.display === 'none') return
+ self.updatePath(path)
+ })
+
+ // register to main app, trigger when the current file in the editor changed
+ self._deps.fileManager.events.on('currentFileChanged', (newFile) => {
+ const provider = self._deps.fileManager.fileProviderOf(newFile)
+ if (self.focusElement && self.focusPath !== newFile) {
+ self.focusElement.classList.remove('bg-secondary')
+ self.focusElement = null
+ self.focusPath = null
+ }
+ if (provider && (provider.type === files.type)) {
+ self.focusElement = self.treeView.labelAt(newFile)
+ if (self.focusElement) {
+ self.focusElement.classList.add('bg-secondary')
+ self.focusPath = newFile
+ }
+ }
+ })
+
+ self._deps.fileManager.events.on('noFileSelected', () => {
+ if (self.focusElement) {
+ self.focusElement.classList.remove('bg-secondary')
+ self.focusElement = null
+ self.focusPath = null
+ }
+ })
+
+ var textUnderEdit = null
+
+ function selectElementContents (el) {
+ var range = document.createRange()
+ range.selectNodeContents(el)
+ var sel = window.getSelection()
+ sel.removeAllRanges()
+ sel.addRange(range)
+ }
+
+ function editModeOn (label) {
+ textUnderEdit = label.innerText
+ label.setAttribute('contenteditable', true)
+ label.classList.add('bg-light')
+ label.focus()
+ selectElementContents(label)
+ }
+
+ function editModeOff (event) {
+ let label = this
+
+ const isFolder = label.className.indexOf('folder') !== -1
+ function rename () {
+ var newPath = label.dataset.path
+ newPath = newPath.split('/')
+ newPath[newPath.length - 1] = label.innerText
+ newPath = newPath.join('/')
+ if (label.innerText === '') {
+ modalDialogCustom.alert('File name cannot be empty')
+ label.innerText = textUnderEdit
+ } else if (helper.checkSpecialChars(label.innerText)) {
+ modalDialogCustom.alert('Special characters are not allowed')
+ label.innerText = textUnderEdit
+ } else {
+ files.exists(newPath, (error, exist) => {
+ if (error) return modalDialogCustom.alert('Unexpected error while renaming: ' + error)
+ if (!exist) {
+ files.rename(label.dataset.path, newPath, isFolder)
+ } else {
+ modalDialogCustom.alert('File already exists.')
+ label.innerText = textUnderEdit
+ }
+ })
+ }
+ }
+
+ if (event.which === 13) event.preventDefault()
+ if ((event.type === 'blur' || event.which === 13) && label.getAttribute('contenteditable')) {
+ var save = textUnderEdit !== label.innerText
+ if (save) {
+ modalDialogCustom.confirm(
+ 'Confirm to rename a ' + (isFolder ? 'folder' : 'file'),
+ 'Are you sure you want to rename ' + textUnderEdit + '?',
+ () => { rename() },
+ () => { label.innerText = textUnderEdit }
+ )
+ }
+ label.removeAttribute('contenteditable')
+ label.classList.remove('bg-light')
+ }
+ }
+}
+
+fileExplorer.prototype.updatePath = function (path) {
+ this.files.resolveDirectory(path, (error, fileTree) => {
+ if (error) console.error(error)
+ if (!fileTree) return
+ var newTree = normalize(path, fileTree)
+ this.treeView.updateNodeFromJSON(path, newTree, true)
+ })
+}
+
+fileExplorer.prototype.hide = function () {
+ if (this.container) this.container.style.display = 'none'
+}
+
+fileExplorer.prototype.show = function () {
+ if (this.container) this.container.style.display = 'block'
+}
+
+fileExplorer.prototype.init = function () {
+ this.container = yo`
`
+ return this.container
+}
+
+fileExplorer.prototype.publishToGist = function () {
+ modalDialogCustom.confirm(
+ 'Create a public gist',
+ 'Are you sure you want to publish all your files in browser directory anonymously as a public gist on github.com? Note: this will not include directories.',
+ () => { this.toGist() }
+ )
+}
+
+fileExplorer.prototype.uploadFile = function (event) {
+ // TODO The file explorer is merely a view on the current state of
+ // the files module. Please ask the user here if they want to overwrite
+ // a file and then just use `files.add`. The file explorer will
+ // pick that up via the 'fileAdded' event from the files module.
+
+ let self = this
+
+ ;[...event.target.files].forEach((file) => {
+ let files = this.files
+ function loadFile () {
+ var fileReader = new FileReader()
+ fileReader.onload = async function (event) {
+ if (helper.checkSpecialChars(file.name)) {
+ modalDialogCustom.alert('Special characters are not allowed')
+ return
+ }
+ var success = await files.set(name, event.target.result)
+ if (!success) {
+ modalDialogCustom.alert('Failed to create file ' + name)
+ } else {
+ self.events.trigger('focus', [name])
+ }
+ }
+ fileReader.readAsText(file)
+ }
+ var name = files.type + '/' + file.name
+ files.exists(name, (error, exist) => {
+ if (error) console.log(error)
+ if (!exist) {
+ loadFile()
+ } else {
+ modalDialogCustom.confirm('Confirm overwrite', `The file ${name} already exists! Would you like to overwrite it?`, () => { loadFile() })
+ }
+ })
+ })
+}
+
+fileExplorer.prototype.toGist = function (id) {
+ let proccedResult = function (error, data) {
+ if (error) {
+ modalDialogCustom.alert('Failed to manage gist: ' + error)
+ console.log('Failed to manage gist: ' + error)
+ } else {
+ if (data.html_url) {
+ modalDialogCustom.confirm('Gist is ready', `The gist is at ${data.html_url}. Would you like to open it in a new window?`, () => {
+ window.open(data.html_url, '_blank')
+ })
+ } else {
+ modalDialogCustom.alert(data.message + ' ' + data.documentation_url + ' ' + JSON.stringify(data.errors, null, '\t'))
+ }
+ }
+ }
+
+ /**
+ * This function is to get the original content of given gist
+ * @params id is the gist id to fetch
+ */
+ async function getOriginalFiles (id) {
+ if (!id) {
+ return []
+ }
+
+ const url = `https://api.github.com/gists/${id}`
+ const res = await fetch(url)
+ const data = await res.json()
+ return data.files || []
+ }
+
+ // If 'id' is not defined, it is not a gist update but a creation so we have to take the files from the browser explorer.
+ const folder = id ? 'browser/gists/' + id : 'browser/'
+ this.packageFiles(this.files, folder, (error, packaged) => {
+ if (error) {
+ console.log(error)
+ modalDialogCustom.alert('Failed to create gist: ' + error.message)
+ } else {
+ // check for token
+ var tokenAccess = this._deps.config.get('settings/gist-access-token')
+ if (!tokenAccess) {
+ modalDialogCustom.alert(
+ 'Remix requires an access token (which includes gists creation permission). Please go to the settings tab to create one.'
+ )
+ } else {
+ const description = 'Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=' +
+ queryParams.get().version + '&optimize=' + queryParams.get().optimize + '&gist='
+ const gists = new Gists({ token: tokenAccess })
+
+ if (id) {
+ const originalFileList = getOriginalFiles(id)
+ // Telling the GIST API to remove files
+ const updatedFileList = Object.keys(packaged)
+ const allItems = Object.keys(originalFileList)
+ .filter(fileName => updatedFileList.indexOf(fileName) === -1)
+ .reduce((acc, deleteFileName) => ({
+ ...acc,
+ [deleteFileName]: null
+ }), originalFileList)
+ // adding new files
+ updatedFileList.forEach((file) => {
+ const _items = file.split('/')
+ const _fileName = _items[_items.length - 1]
+ allItems[_fileName] = packaged[file]
+ })
+
+ tooltip('Saving gist (' + id + ') ...')
+ gists.edit({
+ description: description,
+ public: true,
+ files: allItems,
+ id: id
+ }, (error, result) => {
+ proccedResult(error, result)
+ if (!error) {
+ for (const key in allItems) {
+ if (allItems[key] === null) delete allItems[key]
+ }
+ }
+ })
+ } else {
+ // id is not existing, need to create a new gist
+ tooltip('Creating a new gist ...')
+ gists.create({
+ description: description,
+ public: true,
+ files: packaged
+ }, (error, result) => {
+ proccedResult(error, result)
+ })
+ }
+ }
+ }
+ })
+}
+
+// return all the files, except the temporary/readonly ones..
+fileExplorer.prototype.packageFiles = function (filesProvider, directory, callback) {
+ let ret = {}
+ filesProvider.resolveDirectory(directory, (error, files) => {
+ if (error) callback(error)
+ else {
+ async.eachSeries(Object.keys(files), (path, cb) => {
+ if (filesProvider.isDirectory(path)) {
+ cb()
+ } else {
+ filesProvider.get(path, (error, content) => {
+ if (error) return cb(error)
+ if (/^\s+$/.test(content) || !content.length) {
+ content = '// this line is added to create a gist. Empty file is not allowed.'
+ }
+ ret[path] = { content }
+ cb()
+ })
+ }
+ }, (error) => {
+ callback(error, ret)
+ })
+ }
+ })
+}
+
+fileExplorer.prototype.createNewFile = function (parentFolder = 'browser') {
+ let self = this
+ modalDialogCustom.prompt('Create new file', 'File Name (e.g Untitled.sol)', 'Untitled.sol', (input) => {
+ if (!input) input = 'New file'
+ helper.createNonClashingName(parentFolder + '/' + input, self.files, async (error, newName) => {
+ if (error) return tooltip('Failed to create file ' + newName + ' ' + error)
+ const fileManager = self._deps.fileManager
+ const createFile = await fileManager.writeFile(newName, '')
+
+ if (!createFile) {
+ tooltip('Failed to create file ' + newName)
+ } else {
+ await fileManager.open(newName)
+ if (newName.includes('_test.sol')) {
+ self.events.trigger('newTestFileCreated', [newName])
+ }
+ }
+ })
+ }, null, true)
+}
+
+fileExplorer.prototype.createNewFolder = function (parentFolder) {
+ let self = this
+ modalDialogCustom.prompt('Create new folder', '', 'New folder', (input) => {
+ if (!input) {
+ return tooltip('Failed to create folder. The name can not be empty')
+ }
+
+ const currentPath = !parentFolder ? self._deps.fileManager.currentPath() : parentFolder
+ let newName = currentPath ? currentPath + '/' + input : self.files.type + '/' + input
+
+ newName = newName + '/'
+ self.files.exists(newName, (error, exist) => {
+ if (error) return tooltip('Unexpected error while creating folder: ' + error)
+ if (!exist) {
+ self.files.set(newName, '')
+ } else {
+ tooltip('Folder already exists.', () => {})
+ }
+ })
+ }, null, true)
+}
+
+fileExplorer.prototype.renderMenuItems = function () {
+ let items = ''
+ if (this.menuItems) {
+ items = this.menuItems.map(({action, title, icon}) => {
+ if (action === 'uploadFile') {
+ return yo`
+
+ {
+ event.stopPropagation()
+ this.uploadFile(event)
+ }} multiple />
+
+ `
+ } else {
+ return yo`
+ { event.stopPropagation(); this[ action ]() }}
+ class="newFile ${icon} ${css.newFile}"
+ title=${title}
+ >
+
+ `
+ }
+ })
+ }
+ return yo``
+}
+
+fileExplorer.prototype.ensureRoot = function (cb) {
+ cb = cb || (() => {})
+ var self = this
+ if (self.element) return cb()
+ const root = {}
+ root[this.files.type] = {}
+ var element = self.treeView.render(root, false)
+ element.classList.add(css.fileexplorer)
+ element.events = self.events
+ element.api = self.api
+ self.container.appendChild(element)
+ self.element = element
+ if (cb) cb()
+ self.treeView.expand(self.files.type)
+}
+
+function normalize (path, filesList) {
+ var prefix = path.split('/')[0]
+ var newList = {}
+ Object.keys(filesList).forEach(key => {
+ newList[prefix + '/' + key] = filesList[key].isDirectory ? {} : { '/content': true }
+ })
+ return newList
+}
+
+module.exports = fileExplorer
diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js
new file mode 100644
index 0000000000..d2d21b6ac3
--- /dev/null
+++ b/apps/remix-ide/src/app/files/fileManager.js
@@ -0,0 +1,583 @@
+'use strict'
+
+import yo from 'yo-yo'
+import async from 'async'
+const EventEmitter = require('events')
+const globalRegistry = require('../../global/registry')
+const CompilerImport = require('../compiler/compiler-imports')
+const toaster = require('../ui/tooltip')
+const modalDialogCustom = require('../ui/modal-dialog-custom')
+const helper = require('../../lib/helper.js')
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+/*
+ attach to files event (removed renamed)
+ trigger: currentFileChanged
+*/
+
+const profile = {
+ name: 'fileManager',
+ displayName: 'File manager',
+ description: 'Service - read/write to any files or folders, require giving permissions',
+ icon: 'assets/img/fileManager.webp',
+ permission: true,
+ version: packageJson.version,
+ methods: ['file', 'exists', 'open', 'writeFile', 'readFile', 'copyFile', 'rename', 'mkdir', 'readdir', 'remove', 'getCurrentFile', 'getFile', 'getFolder', 'setFile', 'switchFile'],
+ kind: 'file-system'
+}
+const errorMsg = {
+ ENOENT: 'No such file or directory',
+ EISDIR: 'Path is a directory',
+ ENOTDIR: 'Path is not on a directory',
+ EEXIST: 'File already exists',
+ EPERM: 'Permission denied'
+}
+const createError = (err) => {
+ return new Error(`${errorMsg[err.code]} ${err.message || ''}`)
+}
+
+class FileManager extends Plugin {
+ constructor (editor, appManager) {
+ super(profile)
+ this.openedFiles = {} // list all opened files
+ this.events = new EventEmitter()
+ this.editor = editor
+ this._components = {}
+ this._components.compilerImport = new CompilerImport()
+ this._components.registry = globalRegistry
+ this.appManager = appManager
+ this.init()
+ }
+
+ /**
+ * Emit error if path doesn't exist
+ * @param {string} path path of the file/directory
+ * @param {string} message message to display if path doesn't exist.
+ */
+ async _handleExists (path, message) {
+ const exists = await this.exists(path)
+
+ if (!exists) {
+ throw createError({ code: 'ENOENT', message })
+ }
+ }
+
+ /**
+ * Emit error if path is not a file
+ * @param {string} path path of the file/directory
+ * @param {string} message message to display if path is not a file.
+ */
+ async _handleIsFile (path, message) {
+ const isFile = await this.isFile(path)
+
+ if (!isFile) {
+ throw createError({ code: 'EISDIR', message })
+ }
+ }
+
+ /**
+ * Emit error if path is not a directory
+ * @param {string} path path of the file/directory
+ * @param {string} message message to display if path is not a directory.
+ */
+ async _handleIsDir (path, message) {
+ const isDir = await this.isDirectory(path)
+
+ if (!isDir) {
+ throw createError({ code: 'ENOTDIR', message })
+ }
+ }
+
+ /** The current opened file */
+ file () {
+ const file = this.currentFile()
+
+ if (!file) throw createError({ code: 'ENOENT', message: 'No file selected' })
+ return file
+ }
+
+ /**
+ * Verify if the path exists (directory or file)
+ * @param {string} path path of the directory or file
+ * @returns {boolean} true if the path exists
+ */
+ exists (path) {
+ const provider = this.fileProviderOf(path)
+ const result = provider.exists(path, (err, result) => {
+ if (err) return false
+ return result
+ })
+
+ return result
+ }
+
+ /**
+ * Verify if the path provided is a file
+ * @param {string} path path of the directory or file
+ * @returns {boolean} true if path is a file.
+ */
+ isFile (path) {
+ const provider = this.fileProviderOf(path)
+ const result = provider.isFile(path)
+
+ return result
+ }
+
+ /**
+ * Verify if the path provided is a directory
+ * @param {string} path path of the directory
+ * @returns {boolean} true if path is a directory.
+ */
+ isDirectory (path) {
+ const provider = this.fileProviderOf(path)
+ const result = provider.isDirectory(path)
+
+ return result
+ }
+
+ /**
+ * Open the content of the file in the context (eg: Editor)
+ * @param {string} path path of the file
+ * @returns {void}
+ */
+ async open (path) {
+ await this._handleExists(path, `Cannot open file ${path}`)
+ await this._handleIsFile(path, `Cannot open file ${path}`)
+ return this.openFile(path)
+ }
+
+ /**
+ * Set the content of a specific file
+ * @param {string} path path of the file
+ * @param {string} data content to write on the file
+ * @returns {void}
+ */
+ async writeFile (path, data) {
+ if (await this.exists(path)) {
+ await this._handleIsFile(path, `Cannot write file ${path}`)
+ return await this.setFileContent(path, data)
+ } else {
+ return await this.setFileContent(path, data)
+ }
+ }
+
+ /**
+ * Return the content of a specific file
+ * @param {string} path path of the file
+ * @returns {string} content of the file
+ */
+ async readFile (path) {
+ await this._handleExists(path, `Cannot read file ${path}`)
+ await this._handleIsFile(path, `Cannot read file ${path}`)
+ return this.getFileContent(path)
+ }
+
+ /**
+ * Upsert a file with the content of the source file
+ * @param {string} src path of the source file
+ * @param {string} dest path of the destrination file
+ * @returns {void}
+ */
+ async copyFile (src, dest) {
+ await this._handleExists(src, `Cannot copy from ${src}`)
+ await this._handleIsFile(src, `Cannot copy from ${src}`)
+ await this._handleIsFile(dest, `Cannot paste content into ${dest}`)
+ const content = await this.readFile(src)
+
+ await this.writeFile(dest, content)
+ }
+
+ /**
+ * Change the path of a file/directory
+ * @param {string} oldPath current path of the file/directory
+ * @param {string} newPath new path of the file/directory
+ * @returns {void}
+ */
+ async rename (oldPath, newPath) {
+ await this._handleExists(oldPath, `Cannot rename ${oldPath}`)
+ const isFile = await this.isFile(oldPath)
+ const newPathExists = await this.exists(newPath)
+ const provider = this.fileProviderOf(oldPath)
+
+ if (isFile) {
+ if (newPathExists) {
+ modalDialogCustom.alert('File already exists.')
+ return
+ }
+ return provider.rename(oldPath, newPath, false)
+ } else {
+ if (newPathExists) {
+ modalDialogCustom.alert('Folder already exists.')
+ return
+ }
+ return provider.rename(oldPath, newPath, true)
+ }
+ }
+
+ /**
+ * Create a directory
+ * @param {string} path path of the new directory
+ * @returns {void}
+ */
+ async mkdir (path) {
+ if (await this.exists(path)) {
+ throw createError({ code: 'EEXIST', message: `Cannot create directory ${path}` })
+ }
+ const provider = this.fileProviderOf(path)
+
+ provider.createDir(path)
+ }
+
+ /**
+ * Get the list of files in the directory
+ * @param {string} path path of the directory
+ * @returns {string[]} list of the file/directory name in this directory
+ */
+ async readdir (path) {
+ await this._handleExists(path)
+ await this._handleIsDir(path)
+
+ return new Promise((resolve, reject) => {
+ const provider = this.fileProviderOf(path)
+
+ provider.resolveDirectory(path, (error, filesProvider) => {
+ if (error) reject(error)
+ resolve(filesProvider)
+ })
+ })
+ }
+
+ /**
+ * Removes a file or directory recursively
+ * @param {string} path path of the directory/file to remove
+ * @returns {void}
+ */
+ async remove (path) {
+ await this._handleExists(path, `Cannot remove file or directory ${path}`)
+ const provider = this.fileProviderOf(path)
+
+ return await provider.remove(path)
+ }
+
+ init () {
+ this._deps = {
+ config: this._components.registry.get('config').api,
+ browserExplorer: this._components.registry.get('fileproviders/browser').api,
+ localhostExplorer: this._components.registry.get('fileproviders/localhost').api,
+ filesProviders: this._components.registry.get('fileproviders').api
+ }
+ this._deps.browserExplorer.event.register('fileChanged', (path) => { this.fileChangedEvent(path) })
+ this._deps.browserExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) })
+ this._deps.localhostExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) })
+ this._deps.browserExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) })
+ this._deps.localhostExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) })
+ this._deps.localhostExplorer.event.register('errored', (event) => { this.removeTabsOf(this._deps.localhostExplorer) })
+ this._deps.localhostExplorer.event.register('closed', (event) => { this.removeTabsOf(this._deps.localhostExplorer) })
+ this.getCurrentFile = this.file
+ this.getFile = this.readFile
+ this.getFolder = this.readdir
+ this.setFile = this.writeFile
+ this.switchFile = this.open
+ }
+
+ fileChangedEvent (path) {
+ // @todo(#2386) use only for discard changes function.
+ // this.syncEditor(path)
+ }
+
+ fileRenamedEvent (oldName, newName, isFolder) {
+ if (!isFolder) {
+ this._deps.config.set('currentFile', '')
+ this.editor.discard(oldName)
+ if (this.openedFiles[oldName]) {
+ delete this.openedFiles[oldName]
+ this.openedFiles[newName] = newName
+ }
+ this.openFile(newName)
+ } else {
+ var newFocus
+ for (var k in this.openedFiles) {
+ if (k.indexOf(oldName + '/') === 0) {
+ var newAbsolutePath = k.replace(oldName, newName)
+ this.openedFiles[newAbsolutePath] = newAbsolutePath
+ delete this.openedFiles[k]
+ if (this._deps.config.get('currentFile') === k) {
+ newFocus = newAbsolutePath
+ }
+ }
+ }
+ if (newFocus) {
+ this.openFile(newFocus)
+ }
+ }
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('fileRenamed', oldName, newName, isFolder)
+ this.events.emit('fileRenamed', oldName, newName, isFolder)
+ }
+
+ currentFileProvider () {
+ var path = this.currentPath()
+ if (path) {
+ return this.fileProviderOf(path)
+ }
+ return null
+ }
+
+ currentFile () {
+ return this._deps.config.get('currentFile')
+ }
+
+ closeFile (name) {
+ delete this.openedFiles[name]
+ if (!Object.keys(this.openedFiles).length) {
+ this._deps.config.set('currentFile', '')
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('noFileSelected')
+ this.events.emit('noFileSelected')
+ }
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('fileClosed', name)
+ this.events.emit('fileClosed', name)
+ }
+
+ currentPath () {
+ var currentFile = this._deps.config.get('currentFile')
+ return this.extractPathOf(currentFile)
+ }
+
+ extractPathOf (file) {
+ var reg = /(.*)(\/).*/
+ var path = reg.exec(file)
+ return path ? path[1] : null
+ }
+
+ getFileContent (path) {
+ const provider = this.fileProviderOf(path)
+
+ if (!provider) throw createError({ code: 'ENOENT', message: `${path} not available` })
+ // TODO: change provider to Promise
+ return new Promise((resolve, reject) => {
+ if (this.currentFile() === path) return resolve(this.editor.currentContent())
+ provider.get(path, (err, content) => {
+ if (err) reject(err)
+ resolve(content)
+ })
+ })
+ }
+
+ async setFileContent (path, content) {
+ if (this.currentRequest) {
+ const canCall = await this.askUserPermission('writeFile', '')
+ if (canCall) {
+ // inform the user about modification after permission is granted and even if permission was saved before
+ toaster(yo`
+
+
+
+ ${this.currentRequest.from}
+
+ is modifying
+ ${path}
+
+
+ `, '', { time: 3000 })
+ }
+ }
+ return await this._setFileInternal(path, content)
+ }
+
+ _setFileInternal (path, content) {
+ const provider = this.fileProviderOf(path)
+ if (!provider) throw createError({ code: 'ENOENT', message: `${path} not available` })
+ // TODO : Add permission
+ // TODO : Change Provider to Promise
+ return new Promise((resolve, reject) => {
+ provider.set(path, content, (error) => {
+ if (error) reject(error)
+ this.syncEditor(path)
+ resolve(true)
+ })
+ })
+ }
+
+ _saveAsCopy (path, content) {
+ const fileProvider = this.fileProviderOf(path)
+ if (fileProvider) {
+ helper.createNonClashingNameWithPrefix(path, fileProvider, '', (error, copyName) => {
+ if (error) {
+ copyName = path + '.' + this.currentRequest.from
+ }
+ this._setFileInternal(copyName, content)
+ this.openFile(copyName)
+ })
+ }
+ }
+
+ removeTabsOf (provider) {
+ for (var tab in this.openedFiles) {
+ if (this.fileProviderOf(tab).type === provider.type) {
+ this.fileRemovedEvent(tab)
+ }
+ }
+ }
+
+ fileRemovedEvent (path) {
+ if (!this.openedFiles[path]) return
+ if (path === this._deps.config.get('currentFile')) {
+ this._deps.config.set('currentFile', '')
+ }
+ this.editor.discard(path)
+ delete this.openedFiles[path]
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('fileRemoved', path)
+ this.events.emit('fileRemoved', path)
+ this.openFile()
+ }
+
+ unselectCurrentFile () {
+ this.saveCurrentFile()
+ this._deps.config.set('currentFile', '')
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('noFileSelected')
+ this.events.emit('noFileSelected')
+ }
+
+ openFile (file) {
+ const _openFile = (file) => {
+ this.saveCurrentFile()
+ const provider = this.fileProviderOf(file)
+ if (!provider) return console.error(`no provider for ${file}`)
+ file = provider.getPathFromUrl(file) || file // in case an external URL is given as input, we resolve it to the right internal path
+ this._deps.config.set('currentFile', file)
+ this.openedFiles[file] = file
+ provider.get(file, (error, content) => {
+ if (error) {
+ console.log(error)
+ } else {
+ if (provider.isReadOnly(file)) {
+ this.editor.openReadOnly(file, content)
+ } else {
+ this.editor.open(file, content)
+ }
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('currentFileChanged', file)
+ this.events.emit('currentFileChanged', file)
+ }
+ })
+ }
+ if (file) return _openFile(file)
+ else {
+ var browserProvider = this._deps.filesProviders['browser']
+ browserProvider.resolveDirectory('browser', (error, filesProvider) => {
+ if (error) console.error(error)
+ var fileList = Object.keys(filesProvider)
+ if (fileList.length) {
+ _openFile(browserProvider.type + '/' + fileList[0])
+ } else {
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('noFileSelected')
+ this.events.emit('noFileSelected')
+ }
+ })
+ }
+ }
+
+ getProvider (name) {
+ return this._deps.filesProviders[name]
+ }
+
+ fileProviderOf (file) {
+ if (file.indexOf('localhost') === 0) {
+ return this._deps.filesProviders['localhost']
+ }
+ return this._deps.filesProviders['browser']
+ }
+
+ // returns the list of directories inside path
+ dirList (path) {
+ const dirPaths = []
+ const collectList = (path) => {
+ return new Promise((resolve, reject) => {
+ this.readdir(path).then((ls) => {
+ const promises = Object.keys(ls).map((item, index) => {
+ const root = (path.indexOf('/') === -1) ? path : path.substr(0, path.indexOf('/'))
+ const curPath = `${root}/${item}` // adding 'browser' or 'localhost'
+ if (ls[item].isDirectory && !dirPaths.includes(curPath)) {
+ dirPaths.push(curPath)
+ resolve(dirPaths)
+ }
+ return new Promise((resolve, reject) => { resolve() })
+ })
+ Promise.all(promises).then(() => { resolve(dirPaths) })
+ })
+ })
+ }
+ return collectList(path)
+ }
+
+ isRemixDActive () {
+ return this.appManager.isActive('remixd')
+ }
+
+ saveCurrentFile () {
+ var currentFile = this._deps.config.get('currentFile')
+ if (currentFile && this.editor.current()) {
+ var input = this.editor.get(currentFile)
+ if (input) {
+ var provider = this.fileProviderOf(currentFile)
+ if (provider) {
+ provider.set(currentFile, input)
+ } else {
+ console.log('cannot save ' + currentFile + '. Does not belong to any explorer')
+ }
+ }
+ }
+ }
+
+ syncEditor (path) {
+ var currentFile = this._deps.config.get('currentFile')
+ if (path !== currentFile) return
+
+ var provider = this.fileProviderOf(currentFile)
+ if (provider) {
+ provider.get(currentFile, (error, content) => {
+ if (error) console.log(error)
+ this.editor.setText(content)
+ })
+ } else {
+ console.log('cannot save ' + currentFile + '. Does not belong to any explorer')
+ }
+ }
+
+ setBatchFiles (filesSet, fileProvider, override, callback) {
+ const self = this
+ if (!fileProvider) fileProvider = 'browser'
+ if (override === undefined) override = false
+
+ async.each(Object.keys(filesSet), (file, callback) => {
+ if (override) {
+ self._deps.filesProviders[fileProvider].set(file, filesSet[file].content)
+ self.syncEditor(fileProvider + file)
+ return callback()
+ }
+
+ helper.createNonClashingName(file, self._deps.filesProviders[fileProvider],
+ (error, name) => {
+ if (error) {
+ modalDialogCustom.alert('Unexpected error loading the file ' + error)
+ } else if (helper.checkSpecialChars(name)) {
+ modalDialogCustom.alert('Special characters are not allowed')
+ } else {
+ self._deps.filesProviders[fileProvider].set(name, filesSet[file].content)
+ self.syncEditor(fileProvider + name)
+ }
+ callback()
+ })
+ }, (error) => {
+ if (callback) callback(error)
+ })
+ }
+}
+
+module.exports = FileManager
diff --git a/apps/remix-ide/src/app/files/fileProvider.js b/apps/remix-ide/src/app/files/fileProvider.js
new file mode 100644
index 0000000000..4fd00db6d4
--- /dev/null
+++ b/apps/remix-ide/src/app/files/fileProvider.js
@@ -0,0 +1,248 @@
+'use strict'
+
+const CompilerImport = require('../compiler/compiler-imports')
+const EventManager = require('../../lib/events')
+const modalDialogCustom = require('../ui/modal-dialog-custom')
+const tooltip = require('../ui/tooltip')
+const remixLib = require('@remix-project/remix-lib')
+const Storage = remixLib.Storage
+
+class FileProvider {
+ constructor (name) {
+ this.event = new EventManager()
+ this.type = name
+ this.providerExternalsStorage = new Storage('providerExternals:')
+ this.externalFolders = [this.type + '/swarm', this.type + '/ipfs', this.type + '/github', this.type + '/gists', this.type + '/https']
+ }
+
+ addNormalizedName (path, url) {
+ this.providerExternalsStorage.set(this.type + '/' + path, url)
+ this.providerExternalsStorage.set('reverse-' + url, this.type + '/' + path)
+ }
+
+ removeNormalizedName (path) {
+ const value = this.providerExternalsStorage.get(path)
+ this.providerExternalsStorage.remove(path)
+ this.providerExternalsStorage.remove('reverse-' + value)
+ }
+
+ normalizedNameExists (path) {
+ return this.providerExternalsStorage.exists(path)
+ }
+
+ getNormalizedName (path) {
+ return this.providerExternalsStorage.get(path)
+ }
+
+ getPathFromUrl (url) {
+ return this.providerExternalsStorage.get('reverse-' + url)
+ }
+
+ isExternalFolder (path) {
+ return this.externalFolders.includes(path)
+ }
+
+ discardChanges (path) {
+ this.remove(path)
+ const compilerImport = new CompilerImport()
+ this.providerExternalsStorage.keys().map(value => {
+ if (value.indexOf(path) === 0) {
+ compilerImport.import(
+ this.getNormalizedName(value),
+ true,
+ (loadingMsg) => { tooltip(loadingMsg) },
+ (error, content, cleanUrl, type, url) => {
+ if (error) {
+ modalDialogCustom.alert(error)
+ } else {
+ this.addExternal(type + '/' + cleanUrl, content, url)
+ }
+ }
+ )
+ }
+ })
+ }
+
+ exists (path, cb) {
+ // todo check the type (directory/file) as well #2386
+ // currently it is not possible to have a file and folder with same path
+ return cb(null, this._exists(path))
+ }
+
+ _exists (path) {
+ var unprefixedpath = this.removePrefix(path)
+ return path === this.type ? true : window.remixFileSystem.existsSync(unprefixedpath)
+ }
+
+ init (cb) {
+ cb()
+ }
+
+ get (path, cb) {
+ cb = cb || function () {}
+ path = this.getPathFromUrl(path) || path // ensure we actually use the normalized path from here
+ var unprefixedpath = this.removePrefix(path)
+ var exists = window.remixFileSystem.existsSync(unprefixedpath)
+ if (!exists) return cb(null, null)
+ window.remixFileSystem.readFile(unprefixedpath, 'utf8', (err, content) => {
+ cb(err, content)
+ })
+ }
+
+ set (path, content, cb) {
+ cb = cb || function () {}
+ var unprefixedpath = this.removePrefix(path)
+ var exists = window.remixFileSystem.existsSync(unprefixedpath)
+ if (exists && window.remixFileSystem.readFileSync(unprefixedpath, 'utf8') === content) {
+ cb()
+ return true
+ }
+ if (!exists && unprefixedpath.indexOf('/') !== -1) {
+ // the last element is the filename and we should remove it
+ this.createDir(path.substr(0, path.lastIndexOf('/')))
+ }
+ try {
+ window.remixFileSystem.writeFileSync(unprefixedpath, content)
+ } catch (e) {
+ cb(e)
+ return false
+ }
+ if (!exists) {
+ this.event.trigger('fileAdded', [this._normalizePath(unprefixedpath), false])
+ } else {
+ this.event.trigger('fileChanged', [this._normalizePath(unprefixedpath)])
+ }
+ cb()
+ return true
+ }
+
+ createDir (path, cb) {
+ const unprefixedpath = this.removePrefix(path)
+ const paths = unprefixedpath.split('/')
+ if (paths.length && paths[0] === '') paths.shift()
+ let currentCheck = ''
+ paths.forEach((value) => {
+ currentCheck = currentCheck + '/' + value
+ if (!window.remixFileSystem.existsSync(currentCheck)) {
+ window.remixFileSystem.mkdirSync(currentCheck)
+ this.event.trigger('folderAdded', [this._normalizePath(currentCheck)])
+ }
+ })
+ if (cb) cb()
+ }
+
+ // this will not add a folder as readonly but keep the original url to be able to restore it later
+ addExternal (path, content, url) {
+ if (url) this.addNormalizedName(path, url)
+ return this.set(path, content)
+ }
+
+ isReadOnly (path) {
+ return false
+ }
+
+ isDirectory (path) {
+ const unprefixedpath = this.removePrefix(path)
+
+ return path === this.type ? true : window.remixFileSystem.statSync(unprefixedpath).isDirectory()
+ }
+
+ isFile (path) {
+ path = this.removePrefix(path)
+ return window.remixFileSystem.statSync(path).isFile()
+ }
+
+ /**
+ * Removes the folder recursively
+ * @param {*} path is the folder to be removed
+ */
+ remove (path) {
+ return new Promise((resolve, reject) => {
+ path = this.removePrefix(path)
+ if (window.remixFileSystem.existsSync(path)) {
+ const stat = window.remixFileSystem.statSync(path)
+ try {
+ if (!stat.isDirectory()) {
+ resolve(this.removeFile(path))
+ } else {
+ const items = window.remixFileSystem.readdirSync(path)
+ if (items.length !== 0) {
+ items.forEach((item, index) => {
+ const curPath = `${path}/${item}`
+ if (window.remixFileSystem.statSync(curPath).isDirectory()) { // delete folder
+ this.remove(curPath)
+ } else { // delete file
+ this.removeFile(curPath)
+ }
+ })
+ if (window.remixFileSystem.readdirSync(path).length === 0) window.remixFileSystem.rmdirSync(path, console.log)
+ } else {
+ // folder is empty
+ window.remixFileSystem.rmdirSync(path, console.log)
+ }
+ this.event.trigger('fileRemoved', [this._normalizePath(path)])
+ }
+ } catch (e) {
+ console.log(e)
+ return resolve(false)
+ }
+ }
+ return resolve(true)
+ })
+ }
+
+ removeFile (path) {
+ path = this.removePrefix(path)
+ if (window.remixFileSystem.existsSync(path) && !window.remixFileSystem.statSync(path).isDirectory()) {
+ window.remixFileSystem.unlinkSync(path, console.log)
+ this.event.trigger('fileRemoved', [this._normalizePath(path)])
+ return true
+ } else return false
+ }
+
+ rename (oldPath, newPath, isFolder) {
+ var unprefixedoldPath = this.removePrefix(oldPath)
+ var unprefixednewPath = this.removePrefix(newPath)
+ if (this._exists(unprefixedoldPath)) {
+ window.remixFileSystem.renameSync(unprefixedoldPath, unprefixednewPath)
+ this.event.trigger('fileRenamed', [
+ this._normalizePath(unprefixedoldPath),
+ this._normalizePath(unprefixednewPath),
+ isFolder
+ ])
+ return true
+ }
+ return false
+ }
+
+ resolveDirectory (path, callback) {
+ if (!path) return callback(null, { [this.type]: {} })
+ path = this.removePrefix(path)
+ if (path.indexOf('/') !== 0) path = '/' + path
+
+ window.remixFileSystem.readdir(path, (error, files) => {
+ var ret = {}
+
+ if (files) {
+ files.forEach(element => {
+ const absPath = (path === '/' ? '' : path) + '/' + element
+ ret[absPath.indexOf('/') === 0 ? absPath.substr(1, absPath.length) : absPath] = { isDirectory: window.remixFileSystem.statSync(absPath).isDirectory() }
+ // ^ ret does not accept path starting with '/'
+ })
+ }
+ callback(error, ret)
+ })
+ }
+
+ removePrefix (path) {
+ path = path.indexOf(this.type) === 0 ? path.replace(this.type, '') : path
+ return path
+ }
+
+ _normalizePath (path) {
+ if (path.indexOf('/') !== 0) path = '/' + path
+ return this.type + path
+ }
+}
+
+module.exports = FileProvider
diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js
new file mode 100644
index 0000000000..30fe62bf14
--- /dev/null
+++ b/apps/remix-ide/src/app/files/remixDProvider.js
@@ -0,0 +1,201 @@
+'use strict'
+var EventManager = require('../../lib/events')
+
+module.exports = class RemixDProvider {
+ constructor (appManager) {
+ this.event = new EventManager()
+ this._appManager = appManager
+ this.type = 'localhost'
+ this.error = { 'EEXIST': 'File already exists' }
+ this._isReady = false
+ this._readOnlyFiles = {}
+ this._readOnlyMode = false
+ this.filesContent = {}
+ this.files = {}
+ }
+
+ _registerEvent () {
+ var remixdEvents = ['connecting', 'connected', 'errored', 'closed']
+ remixdEvents.forEach((value) => {
+ this._appManager.on('remixd', value, (event) => {
+ this.event.trigger(value, [event])
+ })
+ })
+
+ this._appManager.on('remixd', 'folderAdded', (path) => {
+ this.event.trigger('folderAdded', [this.addPrefix(path)])
+ })
+
+ this._appManager.on('remixd', 'fileAdded', (path) => {
+ this.event.trigger('fileAdded', [this.addPrefix(path)])
+ })
+
+ this._appManager.on('remixd', 'fileChanged', (path) => {
+ this.event.trigger('fileChanged', [this.addPrefix(path)])
+ })
+
+ this._appManager.on('remixd', 'fileRemoved', (path) => {
+ this.event.trigger('fileRemoved', [this.addPrefix(path)])
+ })
+
+ this._appManager.on('remixd', 'fileRenamed', (oldPath, newPath) => {
+ this.event.trigger('fileRemoved', [this.addPrefix(oldPath), this.addPrefix(newPath)])
+ })
+ }
+
+ isConnected () {
+ return this._isReady
+ }
+
+ close (cb) {
+ this._isReady = false
+ cb()
+ }
+
+ init (cb) {
+ if (this._isReady) return cb && cb()
+ this._appManager.call('remixd', 'folderIsReadOnly', {})
+ .then((result) => {
+ this._isReady = true
+ this._readOnlyMode = result
+ this._registerEvent()
+ cb && cb()
+ }).catch((error) => {
+ cb && cb(error)
+ })
+ }
+
+ exists (path, cb) {
+ if (!this._isReady) return cb && cb('provider not ready')
+ const unprefixedpath = this.removePrefix(path)
+
+ return this._appManager.call('remixd', 'exists', { path: unprefixedpath })
+ .then((result) => {
+ if (cb) return cb(null, result)
+ return result
+ }).catch((error) => {
+ if (cb) return cb(error)
+ throw new Error(error)
+ })
+ }
+
+ getNormalizedName (path) {
+ return path
+ }
+
+ getPathFromUrl (path) {
+ return path
+ }
+
+ get (path, cb) {
+ if (!this._isReady) return cb && cb('provider not ready')
+ var unprefixedpath = this.removePrefix(path)
+ this._appManager.call('remixd', 'get', { path: unprefixedpath })
+ .then((file) => {
+ this.filesContent[path] = file.content
+ if (file.readonly) { this._readOnlyFiles[path] = 1 }
+ cb(null, file.content)
+ }).catch((error) => {
+ if (error) console.log(error)
+ // display the last known content.
+ // TODO should perhaps better warn the user that the file is not synced.
+ return cb(null, this.filesContent[path])
+ })
+ }
+
+ async set (path, content, cb) {
+ if (!this._isReady) return cb && cb('provider not ready')
+ const unprefixedpath = this.removePrefix(path)
+
+ return this._appManager.call('remixd', 'set', { path: unprefixedpath, content: content }).then(async (result) => {
+ if (cb) return cb(null, result)
+ }).catch((error) => {
+ if (cb) return cb(error)
+ throw new Error(error)
+ })
+ }
+
+ isReadOnly (path) {
+ return this._readOnlyMode || this._readOnlyFiles[path] === 1
+ }
+
+ remove (path) {
+ return new Promise((resolve, reject) => {
+ if (!this._isReady) return reject('provider not ready')
+ const unprefixedpath = this.removePrefix(path)
+ this._appManager.call('remixd', 'remove', { path: unprefixedpath })
+ .then(result => {
+ const path = this.type + '/' + unprefixedpath
+
+ delete this.filesContent[path]
+ resolve(true)
+ this.init()
+ }).catch(error => {
+ if (error) console.log(error)
+ resolve(false)
+ })
+ })
+ }
+
+ rename (oldPath, newPath, isFolder) {
+ const unprefixedoldPath = this.removePrefix(oldPath)
+ const unprefixednewPath = this.removePrefix(newPath)
+ if (!this._isReady) return new Promise((resolve, reject) => reject('provider not ready'))
+ return this._appManager.call('remixd', 'rename', { oldPath: unprefixedoldPath, newPath: unprefixednewPath })
+ .then(result => {
+ const newPath = this.type + '/' + unprefixednewPath
+ const oldPath = this.type + '/' + unprefixedoldPath
+
+ this.filesContent[newPath] = this.filesContent[oldPath]
+ delete this.filesContent[oldPath]
+ this.init(() => {
+ this.event.trigger('fileRenamed', [oldPath, newPath, isFolder])
+ })
+ return result
+ }).catch(error => {
+ console.log(error)
+ if (this.error[error.code]) error = this.error[error.code]
+ this.event.trigger('fileRenamedError', [this.error[error.code]])
+ })
+ }
+
+ isExternalFolder (path) {
+ return false
+ }
+
+ removePrefix (path) {
+ path = path.indexOf(this.type) === 0 ? path.replace(this.type, '') : path
+ if (path[0] === '/') return path.substring(1)
+ return path
+ }
+
+ addPrefix (path) {
+ if (path.indexOf(this.type + '/') === 0) return path
+ if (path[0] === '/') return 'localhost' + path
+ return 'localhost/' + path
+ }
+
+ resolveDirectory (path, callback) {
+ var self = this
+ if (path[0] === '/') path = path.substring(1)
+ if (!path) return callback(null, { [self.type]: { } })
+ const unprefixedpath = this.removePrefix(path)
+
+ if (!this._isReady) return callback && callback('provider not ready')
+ this._appManager.call('remixd', 'resolveDirectory', { path: unprefixedpath }).then((result) => {
+ callback(null, result)
+ }).catch(callback)
+ }
+
+ async isDirectory (path) {
+ const unprefixedpath = this.removePrefix(path)
+ if (!this._isReady) throw new Error('provider not ready')
+ return await this._appManager.call('remixd', 'isDirectory', {path: unprefixedpath})
+ }
+
+ async isFile (path) {
+ const unprefixedpath = this.removePrefix(path)
+ if (!this._isReady) throw new Error('provider not ready')
+ return await this._appManager.call('remixd', 'isFile', { path: unprefixedpath })
+ }
+}
diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js
new file mode 100644
index 0000000000..bcf112779c
--- /dev/null
+++ b/apps/remix-ide/src/app/files/remixd-handle.js
@@ -0,0 +1,144 @@
+import isElectron from 'is-electron'
+import { WebsocketPlugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+var yo = require('yo-yo')
+var modalDialog = require('../ui/modaldialog')
+var modalDialogCustom = require('../ui/modal-dialog-custom')
+
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .dialog {
+ display: flex;
+ flex-direction: column;
+ }
+ .dialogParagraph {
+ margin-bottom: 2em;
+ word-break: break-word;
+ }
+`
+
+const profile = {
+ name: 'remixd',
+ displayName: 'RemixD',
+ url: 'ws://127.0.0.1:65520',
+ methods: ['folderIsReadOnly', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list'],
+ events: [],
+ description: 'Using Remixd daemon, allow to access file system',
+ kind: 'other',
+ version: packageJson.version
+}
+
+export class RemixdHandle extends WebsocketPlugin {
+ constructor (fileSystemExplorer, locahostProvider, appManager) {
+ super(profile)
+ this.fileSystemExplorer = fileSystemExplorer
+ this.locahostProvider = locahostProvider
+ this.appManager = appManager
+ }
+
+ deactivate () {
+ this.fileSystemExplorer.hide()
+ if (super.socket) super.deactivate()
+ this.locahostProvider.close((error) => {
+ if (error) console.log(error)
+ })
+ }
+
+ activate () {
+ this.fileSystemExplorer.show()
+ this.connectToLocalhost()
+ }
+
+ async canceled () {
+ this.appManager.ensureDeactivated('remixd')
+ }
+
+ /**
+ * connect to localhost if no connection and render the explorer
+ * disconnect from localhost if connected and remove the explorer
+ *
+ * @param {String} txHash - hash of the transaction
+ */
+ async connectToLocalhost () {
+ let connection = (error) => {
+ if (error) {
+ console.log(error)
+ modalDialogCustom.alert(
+ 'Cannot connect to the remixd daemon.' +
+ 'Please make sure you have the remixd running in the background.'
+ )
+ this.canceled()
+ } else {
+ const intervalId = setInterval(() => {
+ if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed
+ clearInterval(intervalId)
+ console.log(error)
+ modalDialogCustom.alert(
+ 'Connection to remixd terminated' +
+ 'Please make sure remixd is still running in the background.'
+ )
+ this.canceled()
+ }
+ }, 3000)
+ this.locahostProvider.init(_ => this.fileSystemExplorer.ensureRoot())
+ }
+ }
+ if (this.locahostProvider.isConnected()) {
+ this.deactivate()
+ } else if (!isElectron()) {
+ // warn the user only if he/she is in the browser context
+ modalDialog(
+ 'Connect to localhost',
+ remixdDialog(),
+ { label: 'Connect',
+ fn: () => {
+ try {
+ super.activate()
+ setTimeout(() => {
+ if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed
+ connection(new Error('Connection with daemon failed.'))
+ } else {
+ connection()
+ }
+ }, 3000)
+ } catch (error) {
+ connection(error)
+ }
+ }
+ },
+ { label: 'Cancel',
+ fn: () => {
+ this.canceled()
+ }
+ }
+ )
+ } else {
+ try {
+ super.activate()
+ setTimeout(() => { connection() }, 2000)
+ } catch (error) {
+ connection(error)
+ }
+ }
+ }
+}
+
+function remixdDialog () {
+ return yo`
+
+
Interact with your file system from Remix. Click connect and find shared folder in the Remix file explorer (under localhost).
+ Before you get started, check out the
Remixd tutorial .
+ to find out how to run Remixd.
+
+
If you have looked at that tutorial and are just looking for the remixd command, here it is:
+ remixd -s absolute-path-to-the-shared-folder --remix-ide your-remix-ide-URL-instance
+
+
Connection will start a session between ${window.location.href} and your local file system ws://127.0.0.1:65520
+ so please make sure your system is secured enough (port 65520 neither opened nor forwarded).
+ will show you current connection status.
+
+
This feature is still in Alpha, so we recommend you to keep a copy of the shared folder.
+
+ `
+}
diff --git a/apps/remix-ide/src/app/files/styles/file-explorer-styles.js b/apps/remix-ide/src/app/files/styles/file-explorer-styles.js
new file mode 100644
index 0000000000..7ad4597f12
--- /dev/null
+++ b/apps/remix-ide/src/app/files/styles/file-explorer-styles.js
@@ -0,0 +1,65 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .label {
+ margin-top : 4px;
+ }
+ .leaf {
+ overflow : hidden;
+ text-overflow : ellipsis;
+ width : 90%;
+ margin-bottom : 0px;
+ }
+ .fileexplorer {
+ box-sizing : border-box;
+ }
+ input[type="file"] {
+ display: none;
+ }
+ .folder,
+ .file {
+ font-size : 14px;
+ cursor : pointer;
+ }
+ .file {
+ padding : 4px;
+ }
+ .newFile {
+ padding-right : 10px;
+ }
+ .newFile i {
+ cursor : pointer;
+ }
+ .newFile:hover {
+ transform : scale(1.3);
+ }
+ .menu {
+ margin-left : 20px;
+ }
+ .items {
+ display : inline
+ }
+ .hasFocus {
+ }
+ .rename {
+ }
+ .remove {
+ margin-left : auto;
+ padding-left : 5px;
+ padding-right : 5px;
+ }
+ .activeMode {
+ display : flex;
+ width : 100%;
+ margin-right : 10px;
+ padding-right : 19px;
+ }
+ .activeMode > div {
+ min-width : 10px;
+ }
+ ul {
+ padding : 0;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js
new file mode 100644
index 0000000000..32d8a1e303
--- /dev/null
+++ b/apps/remix-ide/src/app/panels/file-panel.js
@@ -0,0 +1,106 @@
+var yo = require('yo-yo')
+var EventManager = require('../../lib/events')
+var FileExplorer = require('../files/file-explorer')
+var { RemixdHandle } = require('../files/remixd-handle.js')
+var globalRegistry = require('../../global/registry')
+var css = require('./styles/file-panel-styles')
+import { ViewPlugin } from '@remixproject/engine'
+
+import * as packageJson from '../../../../../package.json'
+
+var canUpload = window.File || window.FileReader || window.FileList || window.Blob
+
+/*
+ Overview of APIs:
+ * fileManager: @args fileProviders (browser, shared-folder, swarm, github, etc ...) & config & editor
+ - listen on browser & localhost file provider (`fileRenamed` & `fileRemoved`)
+ - update the tabs, switchFile
+ - trigger `currentFileChanged`
+ - set the current file in the config
+ * fileProvider: currently browser, swarm, localhost, github, gist
+ - link to backend
+ - provide properties `type`, `readonly`
+ - provide API `resolveDirectory`, `remove`, `exists`, `rename`, `get`, `set`
+ - trigger `fileExternallyChanged`, `fileRemoved`, `fileRenamed`, `fileRenamedError`, `fileAdded`
+ * file-explorer: treeview @args fileProvider
+ - listen on events triggered by fileProvider
+ - call fileProvider API
+*/
+
+const profile = {
+ name: 'fileExplorers',
+ displayName: 'File explorers',
+ methods: [],
+ events: [],
+ icon: 'assets/img/fileManager.webp',
+ description: ' - ',
+ kind: 'fileexplorer',
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/file_explorer.html',
+ version: packageJson.version
+}
+
+module.exports = class Filepanel extends ViewPlugin {
+
+ constructor (appManager) {
+ super(profile)
+ var self = this
+ self._components = {}
+ self._components.registry = globalRegistry
+ self._deps = {
+ fileProviders: self._components.registry.get('fileproviders').api,
+ fileManager: self._components.registry.get('filemanager').api,
+ config: self._components.registry.get('config').api
+ }
+
+ function createProvider (key, menuItems) {
+ return new FileExplorer(self._components.registry, self._deps.fileProviders[key], menuItems, self)
+ }
+
+ var fileExplorer = createProvider('browser', ['createNewFile', 'publishToGist', canUpload ? 'uploadFile' : ''])
+ var fileSystemExplorer = createProvider('localhost')
+
+ self.remixdHandle = new RemixdHandle(fileSystemExplorer, self._deps.fileProviders['localhost'], appManager)
+
+ const explorers = yo`
+
+
${fileExplorer.init()}
+
${fileSystemExplorer.init()}
+
+ `
+
+ function template () {
+ return yo`
+
+ `
+ }
+
+ var event = new EventManager()
+ self.event = event
+ var element = template()
+ fileExplorer.ensureRoot()
+ self._deps.fileProviders['localhost'].event.register('connecting', (event) => {
+ })
+
+ self._deps.fileProviders['localhost'].event.register('connected', (event) => {
+ fileSystemExplorer.show()
+ })
+
+ self._deps.fileProviders['localhost'].event.register('errored', (event) => {
+ fileSystemExplorer.hide()
+ })
+
+ self._deps.fileProviders['localhost'].event.register('closed', (event) => {
+ fileSystemExplorer.hide()
+ })
+
+ self.render = function render () { return element }
+ }
+}
+
diff --git a/apps/remix-ide/src/app/panels/main-view.js b/apps/remix-ide/src/app/panels/main-view.js
new file mode 100644
index 0000000000..ef52644d19
--- /dev/null
+++ b/apps/remix-ide/src/app/panels/main-view.js
@@ -0,0 +1,195 @@
+var yo = require('yo-yo')
+var EventManager = require('../../lib/events')
+
+var globalRegistry = require('../../global/registry')
+var { TabProxy } = require('./tab-proxy.js')
+
+var ContextView = require('../editor/contextView')
+
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .mainview {
+ display : flex;
+ flex-direction : column;
+ height : 100%;
+ width : 100%;
+ }
+`
+
+export class MainView {
+ constructor (contextualListener, editor, mainPanel, fileManager, appManager, terminal) {
+ var self = this
+ self.event = new EventManager()
+ self._view = {}
+ self._components = {}
+ self._components.registry = globalRegistry
+ self.editor = editor
+ self.fileManager = fileManager
+ self.mainPanel = mainPanel
+ self.txListener = globalRegistry.get('txlistener').api
+ self._components.terminal = terminal
+ self._components.contextualListener = contextualListener
+ this.appManager = appManager
+ this.init()
+ }
+ showApp (name) {
+ this.fileManager.unselectCurrentFile()
+ this.mainPanel.showContent(name)
+ this._view.editor.style.display = 'none'
+ this._components.contextView.hide()
+ this._view.mainPanel.style.display = 'block'
+ }
+ getAppPanel () {
+ return this.mainPanel
+ }
+ init () {
+ var self = this
+ self._deps = {
+ config: self._components.registry.get('config').api,
+ fileManager: self._components.registry.get('filemanager').api
+ }
+
+ self.tabProxy = new TabProxy(self.fileManager, self.editor, self.appManager)
+ /*
+ We listen here on event from the tab component to display / hide the editor and mainpanel
+ depending on the content that should be displayed
+ */
+ self.fileManager.events.on('currentFileChanged', (file) => {
+ // we check upstream for "fileChanged"
+ self._view.editor.style.display = 'block'
+ self._view.mainPanel.style.display = 'none'
+ self._components.contextView.show()
+ })
+ self.tabProxy.event.on('openFile', (file) => {
+ self._view.editor.style.display = 'block'
+ self._view.mainPanel.style.display = 'none'
+ self._components.contextView.show()
+ })
+ self.tabProxy.event.on('closeFile', (file) => {
+ })
+ self.tabProxy.event.on('switchApp', self.showApp.bind(self))
+ self.tabProxy.event.on('closeApp', (name) => {
+ self._view.editor.style.display = 'block'
+ self._components.contextView.show()
+ self._view.mainPanel.style.display = 'none'
+ })
+ self.tabProxy.event.on('tabCountChanged', (count) => {
+ if (!count) this.editor.displayEmptyReadOnlySession()
+ })
+ self.data = {
+ _layout: {
+ top: {
+ offset: self._terminalTopOffset(),
+ show: true
+ }
+ }
+ }
+
+ const contextView = new ContextView({contextualListener: self._components.contextualListener, editor: self.editor})
+
+ self._components.contextView = contextView
+
+ self._components.terminal.event.register('resize', delta => self._adjustLayout('top', delta))
+ if (self.txListener) {
+ self._components.terminal.event.register('listenOnNetWork', (listenOnNetWork) => {
+ self.txListener.setListenOnNetwork(listenOnNetWork)
+ })
+ }
+ }
+ _terminalTopOffset () {
+ return this._deps.config.get('terminal-top-offset') || 150
+ }
+ _adjustLayout (direction, delta) {
+ var limitUp = 0
+ var limitDown = 32
+ var containerHeight = window.innerHeight - limitUp // - menu bar containerHeight
+ var self = this
+ var layout = self.data._layout[direction]
+ if (layout) {
+ if (delta === undefined) {
+ layout.show = !layout.show
+ if (layout.show) delta = layout.offset
+ else delta = 0
+ } else {
+ layout.show = true
+ self._deps.config.set(`terminal-${direction}-offset`, delta)
+ layout.offset = delta
+ }
+ }
+ var tmp = delta - limitDown
+ delta = tmp > 0 ? tmp : 0
+ if (direction === 'top') {
+ var mainPanelHeight = containerHeight - delta
+ mainPanelHeight = mainPanelHeight < 0 ? 0 : mainPanelHeight
+ self._view.editor.style.height = `${mainPanelHeight}px`
+ self._view.mainPanel.style.height = `${mainPanelHeight}px`
+ self._view.terminal.style.height = `${delta}px` // - menu bar height
+ self.editor.resize((document.querySelector('#editorWrap') || {}).checked)
+ self._components.terminal.scroll2bottom()
+ }
+ }
+ minimizeTerminal () {
+ this._adjustLayout('top')
+ }
+ showTerminal (offset) {
+ this._adjustLayout('top', offset || this._terminalTopOffset())
+ }
+ getTerminal () {
+ return this._components.terminal
+ }
+ getEditor () {
+ var self = this
+ return self.editor
+ }
+ refresh () {
+ var self = this
+ self._view.tabs.onmouseenter()
+ }
+ log (data = {}) {
+ var self = this
+ var command = self._components.terminal.commands[data.type]
+ if (typeof command === 'function') command(data.value)
+ }
+ logMessage (msg) {
+ var self = this
+ self.log({type: 'log', value: msg})
+ }
+ logHtmlMessage (msg) {
+ var self = this
+ self.log({type: 'html', value: msg})
+ }
+ render () {
+ var self = this
+ if (self._view.mainview) return self._view.mainview
+ self._view.editor = self.editor.render()
+ self._view.editor.style.display = 'none'
+ self._view.mainPanel = self.mainPanel.render()
+ self._view.terminal = self._components.terminal.render()
+ self._view.mainview = yo`
+
+ ${self.tabProxy.renderTabsbar()}
+ ${self._view.editor}
+ ${self._view.mainPanel}
+ ${self._components.contextView.render()}
+ ${self._view.terminal}
+
+ `
+ // INIT
+ self._adjustLayout('top', self.data._layout.top.offset)
+
+ document.addEventListener('keydown', (e) => {
+ if (e.altKey && e.keyCode === 84) self.tabProxy.switchNextTab() // alt + t
+ })
+
+ return self._view.mainview
+ }
+ registerCommand (name, command, opts) {
+ var self = this
+ return self._components.terminal.registerCommand(name, command, opts)
+ }
+ updateTerminalFilter (filter) {
+ this._components.terminal.updateJournal(filter)
+ }
+}
+
diff --git a/apps/remix-ide/src/app/panels/styles/file-panel-styles.js b/apps/remix-ide/src/app/panels/styles/file-panel-styles.js
new file mode 100644
index 0000000000..4db78296b9
--- /dev/null
+++ b/apps/remix-ide/src/app/panels/styles/file-panel-styles.js
@@ -0,0 +1,62 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .container {
+ display : flex;
+ flex-direction : row;
+ width : 100%;
+ height : 100%;
+ box-sizing : border-box;
+ }
+ .fileexplorer {
+ display : flex;
+ flex-direction : column;
+ position : relative;
+ width : 100%;
+ padding-left : 6px;
+ padding-top : 6px;
+ }
+ .fileExplorerTree {
+ cursor : default;
+ }
+ .gist {
+ padding : 10px;
+ }
+ .gist i {
+ cursor : pointer;
+ }
+ .gist i:hover {
+ color : orange;
+ }
+ .connectToLocalhost {
+ padding : 10px;
+ }
+ .connectToLocalhost i {
+ cursor : pointer;
+ }
+ .connectToLocalhost i:hover {
+ color : var(--secondary)
+ }
+ .uploadFile {
+ padding : 10px;
+ }
+ .uploadFile label:hover {
+ color : var(--secondary)
+ }
+ .uploadFile label {
+ cursor : pointer;
+ }
+ .treeview {
+ overflow-y : auto;
+ }
+ .dialog {
+ display: flex;
+ flex-direction: column;
+ }
+ .dialogParagraph {
+ margin-bottom: 2em;
+ word-break: break-word;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/panels/styles/terminal-styles.js b/apps/remix-ide/src/app/panels/styles/terminal-styles.js
new file mode 100644
index 0000000000..25d2d598ac
--- /dev/null
+++ b/apps/remix-ide/src/app/panels/styles/terminal-styles.js
@@ -0,0 +1,137 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .panel {
+ position : relative;
+ display : flex;
+ flex-direction : column;
+ font-size : 12px;
+ min-height : 3em;
+ }
+ .bar {
+ display : flex;
+ z-index : 2;
+ }
+ .menu {
+ position : relative;
+ display : flex;
+ align-items : center;
+ width : 100%;
+ max-height : 35px;
+ min-height : 35px;
+ }
+ .toggleTerminal {
+ cursor : pointer;
+ }
+ .toggleTerminal:hover {
+ color : var(--secondary);
+ }
+ .terminal_container {
+ display : flex;
+ flex-direction : column;
+ height : 100%;
+ overflow-y : auto;
+ font-family : monospace;
+ margin : 0px;
+ background-repeat : no-repeat;
+ background-position : center 15%;
+ background-size : auto calc(75% - 1.7em);
+ }
+ .terminal {
+ position : relative;
+ display : flex;
+ flex-direction : column;
+ height : 100%;
+ }
+ .journal {
+ margin-top : auto;
+ font-family : monospace;
+ }
+ .block {
+ word-break : break-word;
+ white-space : pre-wrap;
+ line-height : 2ch;
+ padding : 1ch;
+ margin-top : 2ch;
+ }
+ .cli {
+ line-height : 1.7em;
+ font-family : monospace;
+ padding : .4em;
+ color : var(--primary)
+ border-top : solid 2px var(--secondary);
+ }
+ .prompt {
+ margin-right : 0.5em;
+ font-family : monospace;
+ font-weight : bold;
+ font-size : 14px;
+ }
+ .input {
+ word-break : break-word;
+ outline : none;
+ font-family : monospace;
+ }
+ .search {
+ display : flex;
+ align-items : center;
+ width : 330px;
+ padding-left : 20px;
+ height : 100%;
+ padding-top : 1px;
+ padding-bottom : 1px;
+ }
+ .filter {
+ height : 80%;
+ white-space : nowrap;
+ overflow : hidden;
+ text-overflow : ellipsis;
+ }
+ .searchIcon {
+ height : 100%;
+ width : 25px;
+ border-top-left-radius : 3px;
+ border-bottom-left-radius : 3px;
+ display : flex;
+ align-items : center;
+ justify-content : center;
+ margin-right : 5px;
+ }
+ .listen {
+ margin-right : 30px;
+ min-width : 40px;
+ height : 13px;
+ display : flex;
+ align-items : center;
+ }
+ .listenLabel {
+ min-width: 50px;
+ }
+ .verticalLine {
+ border-left : 1px solid var(--secondary)
+ height : 65%;
+ }
+ .dragbarHorizontal {
+ position : absolute;
+ top : 0;
+ height : 0.5em;
+ right : 0;
+ left : 0;
+ cursor : ns-resize;
+ z-index : 999;
+ }
+ .listenOnNetwork {
+ min-height: auto;
+ }
+ .ghostbar {
+ position : absolute;
+ height : 6px;
+ opacity : 0.5;
+ cursor : row-resize;
+ z-index : 9999;
+ left : 0;
+ right : 0;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js
new file mode 100644
index 0000000000..019283d09c
--- /dev/null
+++ b/apps/remix-ide/src/app/panels/tab-proxy.js
@@ -0,0 +1,220 @@
+var yo = require('yo-yo')
+var $ = require('jquery')
+const EventEmitter = require('events')
+const globalRegistry = require('../../global/registry')
+
+require('remix-tabs')
+
+export class TabProxy {
+ constructor (fileManager, editor, appManager) {
+ this.event = new EventEmitter()
+ this.fileManager = fileManager
+ this.appManager = appManager
+ this.editor = editor
+ this.data = {}
+ this._view = {}
+ this._handlers = {}
+
+ globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => {
+ // update invert for all icons
+ this.updateImgStyles()
+ })
+
+ fileManager.events.on('fileRemoved', (name) => {
+ this.removeTab(name)
+ })
+
+ fileManager.events.on('fileClosed', (name) => {
+ this.removeTab(name)
+ })
+
+ fileManager.events.on('currentFileChanged', (file) => {
+ if (this._handlers[file]) {
+ this._view.filetabs.activateTab(file)
+ return
+ }
+ this.addTab(file, '', () => {
+ this.fileManager.open(file)
+ this.event.emit('openFile', file)
+ },
+ () => {
+ this.fileManager.closeFile(file)
+ this.event.emit('closeFile', file)
+ })
+ })
+
+ fileManager.events.on('fileRenamed', (oldName, newName, isFolder) => {
+ if (isFolder) return
+ // should change the tab title too
+ this.addTab(newName, '', () => {
+ this.fileManager.open(newName)
+ this.event.emit('openFile', newName)
+ },
+ () => {
+ this.fileManager.closeFile(newName)
+ this.event.emit('closeFile', newName)
+ })
+ this.removeTab(oldName)
+ })
+
+ appManager.event.on('activate', ({ name, location, displayName, icon }) => {
+ if (location === 'mainPanel') {
+ this.addTab(
+ name,
+ displayName,
+ () => this.event.emit('switchApp', name),
+ () => {
+ this.event.emit('closeApp', name)
+ this.appManager.deactivatePlugin(name)
+ },
+ icon
+ )
+ this.switchTab(name)
+ }
+ })
+
+ appManager.event.on('deactivate', (profile) => {
+ this.removeTab(profile.name)
+ })
+
+ appManager.event.on('ensureActivated', (name) => {
+ if (name === 'home') {
+ // if someone force activation of home, we switch to it
+ this.event.emit('switchApp', name)
+ this._view.filetabs.activateTab(name)
+ }
+ })
+ }
+ updateImgStyles () {
+ const images = this._view.filetabs.getElementsByClassName('image')
+ if (images.length !== 0) {
+ for (let element of images) {
+ globalRegistry.get('themeModule').api.fixInvert(element)
+ };
+ }
+ }
+
+ switchTab (tabName) {
+ if (this._handlers[tabName]) {
+ this._handlers[tabName].switchTo()
+ this._view.filetabs.activateTab(tabName)
+ }
+ }
+
+ switchNextTab () {
+ const active = this._view.filetabs.active
+ if (active && this._handlers[active]) {
+ const handlers = Object.keys(this._handlers)
+ let i = handlers.indexOf(active)
+ if (i >= 0) {
+ i = handlers[i + 1] ? i + 1 : 0
+ this.switchTab(handlers[i])
+ }
+ }
+ }
+
+ switchPreviousTab () {
+ const active = this._view.filetabs.active
+ if (active && this._handlers[active]) {
+ const handlers = Object.keys(this._handlers)
+ let i = handlers.indexOf(active)
+ if (i >= 0) {
+ i = handlers[i - 1] ? i - 1 : handlers.length - 1
+ this.switchTab(handlers[i])
+ }
+ }
+ }
+
+ switchToActiveTab () {
+ const active = this._view.filetabs.active
+ if (active && this._handlers[active]) {
+ this.switchTab(active)
+ }
+ }
+
+ addTab (name, title, switchTo, close, icon) {
+ if (this._handlers[name]) return
+
+ var slash = name.split('/')
+ if (!title) {
+ title = name.indexOf('/') !== -1 ? slash[slash.length - 1] : name
+ }
+ this._view.filetabs.addTab({
+ id: name,
+ title,
+ icon,
+ tooltip: name
+ })
+ this.updateImgStyles()
+ this._handlers[name] = { switchTo, close }
+ }
+
+ removeTab (name) {
+ this._view.filetabs.removeTab(name)
+ delete this._handlers[name]
+ this.switchToActiveTab()
+ }
+
+ addHandler (type, fn) {
+ this.handlers[type] = fn
+ }
+
+ onZoomOut () {
+ this.editor.editorFontSize(-1)
+ }
+
+ onZoomIn () {
+ this.editor.editorFontSize(1)
+ }
+
+ renderTabsbar () {
+ this._view.filetabs = yo` `
+ this._view.filetabs.addEventListener('tabClosed', (event) => {
+ if (this._handlers[event.detail]) this._handlers[event.detail].close()
+ this.event.emit('tabCountChanged', this._view.filetabs.tabs.length)
+ })
+ this._view.filetabs.addEventListener('tabActivated', (event) => {
+ if (this._handlers[event.detail]) this._handlers[event.detail].switchTo()
+ this.event.emit('tabCountChanged', this._view.filetabs.tabs.length)
+ })
+
+ this._view.filetabs.canAdd = false
+
+ const zoomBtns = yo`
+
+ this.onZoomOut()}>
+ this.onZoomIn()}>
+
+ `
+
+ // @todo(#2492) remove style after the mainPanel layout fix.
+ this._view.tabs = yo`
+
+ ${zoomBtns}
+ ${this._view.filetabs}
+
+ `
+
+ // tabs
+ var $filesEl = $(this._view.filetabs)
+
+ // Switch tab
+ var self = this
+ $filesEl.on('click', '.file:not(.active)', function (ev) {
+ ev.preventDefault()
+ var name = $(this).find('.name').text()
+ self._handlers[name].switchTo()
+ return false
+ })
+
+ // Remove current tab
+ $filesEl.on('click', '.file .remove', function (ev) {
+ ev.preventDefault()
+ var name = $(this).parent().find('.name').text()
+ self._handlers[name].close()
+ return false
+ })
+
+ return this._view.tabs
+ }
+}
diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js
new file mode 100644
index 0000000000..672133986c
--- /dev/null
+++ b/apps/remix-ide/src/app/panels/terminal.js
@@ -0,0 +1,751 @@
+/* global Node, requestAnimationFrame */
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+var yo = require('yo-yo')
+var javascriptserialize = require('javascript-serialize')
+var jsbeautify = require('js-beautify')
+var type = require('component-type')
+var vm = require('vm')
+var EventManager = require('../../lib/events')
+
+var CommandInterpreterAPI = require('../../lib/cmdInterpreterAPI')
+var AutoCompletePopup = require('../ui/auto-complete-popup')
+var TxLogger = require('../../app/ui/txLogger')
+
+var csjs = require('csjs-inject')
+
+var css = require('./styles/terminal-styles')
+
+var KONSOLES = []
+
+function register (api) { KONSOLES.push(api) }
+
+var ghostbar = yo`
`
+
+const profile = {
+ displayName: 'Terminal',
+ name: 'terminal',
+ methods: [],
+ events: [],
+ description: ' - ',
+ version: packageJson.version
+}
+
+class Terminal extends Plugin {
+ constructor (opts, api) {
+ super(profile)
+ var self = this
+ self.event = new EventManager()
+ self.blockchain = opts.blockchain
+ self._api = api
+ self._opts = opts
+ self.data = {
+ lineLength: opts.lineLength || 80, // ????
+ session: [],
+ activeFilters: { commands: {}, input: '' },
+ filterFns: {}
+ }
+ self._view = { el: null, bar: null, input: null, term: null, journal: null, cli: null }
+ self._components = {}
+ self._components.cmdInterpreter = new CommandInterpreterAPI(this, null, self.blockchain)
+ self._components.autoCompletePopup = new AutoCompletePopup(self._opts)
+ self._components.autoCompletePopup.event.register('handleSelect', function (input) {
+ let textList = self._view.input.innerText.split(' ')
+ textList.pop()
+ textList.push(input)
+ self._view.input.innerText = textList
+ self._view.input.focus()
+ self.putCursor2End(self._view.input)
+ })
+ self._commands = {}
+ self.commands = {}
+ self._JOURNAL = []
+ self._jobs = []
+ self._INDEX = {}
+ self._INDEX.all = []
+ self._INDEX.allMain = []
+ self._INDEX.commands = {}
+ self._INDEX.commandsMain = {}
+ self.registerCommand('html', self._blocksRenderer('html'), { activate: true })
+ self.registerCommand('log', self._blocksRenderer('log'), { activate: true })
+ self.registerCommand('info', self._blocksRenderer('info'), { activate: true })
+ self.registerCommand('warn', self._blocksRenderer('warn'), { activate: true })
+ self.registerCommand('error', self._blocksRenderer('error'), { activate: true })
+ self.registerCommand('script', function execute (args, scopedCommands, append) {
+ var script = String(args[0])
+ self._shell(script, scopedCommands, function (error, output) {
+ if (error) scopedCommands.error(error)
+ else if (output) scopedCommands.log(output)
+ })
+ }, { activate: true })
+ function basicFilter (value, query) { try { return value.indexOf(query) !== -1 } catch (e) { return false } }
+
+ self.registerFilter('log', basicFilter)
+ self.registerFilter('info', basicFilter)
+ self.registerFilter('warn', basicFilter)
+ self.registerFilter('error', basicFilter)
+ self.registerFilter('script', basicFilter)
+
+ if (opts.shell) self._shell = opts.shell // ???
+ register(self)
+ }
+ onActivation () {
+ this.on('scriptRunner', 'log', (msg) => {
+ this.commands['log'].apply(this.commands, msg.data)
+ })
+ this.on('scriptRunner', 'info', (msg) => {
+ this.commands['info'].apply(this.commands, msg.data)
+ })
+ this.on('scriptRunner', 'warn', (msg) => {
+ this.commands['warn'].apply(this.commands, msg.data)
+ })
+ this.on('scriptRunner', 'error', (msg) => {
+ this.commands['error'].apply(this.commands, msg.data)
+ })
+ }
+ onDeactivation () {
+ this.off('scriptRunner', 'log')
+ this.off('scriptRunner', 'info')
+ this.off('scriptRunner', 'warn')
+ this.off('scriptRunner', 'error')
+ }
+ logHtml (html) {
+ var command = this.commands['html']
+ if (typeof command === 'function') command(html)
+ }
+ focus () {
+ if (this._view.input) this._view.input.focus()
+ }
+ render () {
+ var self = this
+ if (self._view.el) return self._view.el
+ self._view.journal = yo`
`
+ self._view.input = yo`
+ { this.focus() }} onpaste=${paste} onkeydown=${change}>
+ `
+ self._view.input.setAttribute('spellcheck', 'false')
+ self._view.input.setAttribute('contenteditable', 'true')
+ self._view.input.setAttribute('id', 'terminalCliInput')
+ self._view.input.setAttribute('data-id', 'terminalCliInput')
+
+ self._view.input.innerText = '\n'
+ self._view.cli = yo`
+
+ ${'>'}
+ ${self._view.input}
+
+ `
+
+ self._view.icon = yo`
+ `
+ self._view.dragbar = yo`
+
`
+
+ self._view.pendingTxCount = yo`0
`
+ self._view.inputSearch = yo`
+ `
+ self._view.bar = yo`
+
+ ${self._view.dragbar}
+
+
+ `
+ self._view.term = yo`
+
+ ${self._components.autoCompletePopup.render()}
+
+
+ ${self._view.journal}
+ ${self._view.cli}
+
+
+ `
+ self._view.el = yo`
+
+ ${self._view.bar}
+ ${self._view.term}
+
+ `
+ setInterval(async () => {
+ try {
+ self._view.pendingTxCount.innerHTML = await self.call('udapp', 'pendingTransactionsCount')
+ } catch (err) {}
+ }, 1000)
+
+ function listenOnNetwork (ev) {
+ self.event.trigger('listenOnNetWork', [ev.currentTarget.checked])
+ }
+ function paste (event) {
+ const selection = window.getSelection()
+ if (!selection.rangeCount) return false
+ event.preventDefault()
+ event.stopPropagation()
+ var clipboard = (event.clipboardData || window.clipboardData)
+ var text = clipboard.getData('text/plain')
+ text = text.replace(/[^\x20-\xFF]/gi, '') // remove non-UTF-8 characters
+ var temp = document.createElement('div')
+ temp.innerHTML = text
+ var textnode = document.createTextNode(temp.textContent)
+ selection.getRangeAt(0).insertNode(textnode)
+ selection.empty()
+ self.scroll2bottom()
+ placeCaretAtEnd(event.currentTarget)
+ }
+ function placeCaretAtEnd (el) {
+ el.focus()
+ var range = document.createRange()
+ range.selectNodeContents(el)
+ range.collapse(false)
+ var sel = window.getSelection()
+ sel.removeAllRanges()
+ sel.addRange(range)
+ }
+ function throttle (fn, wait) {
+ var time = Date.now()
+ return function debounce () {
+ if ((time + wait - Date.now()) < 0) {
+ fn.apply(this, arguments)
+ time = Date.now()
+ }
+ }
+ }
+ var css2 = csjs`
+ .anchor {
+ position : static;
+ border-top : 2px dotted blue;
+ height : 10px;
+ }
+ .overlay {
+ position : absolute;
+ width : 100%;
+ display : flex;
+ align-items : center;
+ justify-content : center;
+ bottom : 0;
+ right : 15px;
+ min-height : 20px;
+ }
+ .text {
+ z-index : 2;
+ color : black;
+ font-weight : bold;
+ pointer-events : none;
+ }
+ .background {
+ z-index : 1;
+ opacity : 0.8;
+ background-color : #a6aeba;
+ cursor : pointer;
+ }
+ .ul {
+ padding-left : 20px;
+ padding-bottom : 5px;
+ }
+ `
+ var text = yo`
`
+ var background = yo`
`
+ var placeholder = yo`${background}${text}
`
+ var inserted = false
+
+ window.addEventListener('resize', function (event) {
+ self.event.trigger('resize', [])
+ self.event.trigger('resize', [])
+ })
+
+ function focusinput (event) {
+ if (
+ event.altKey ||
+ event.ctrlKey ||
+ event.metaKey ||
+ event.shiftKey ||
+ event.key === 'Down' ||
+ event.key === 'ArrowDown' ||
+ event.key === 'Up' ||
+ event.key === 'ArrowUp' ||
+ event.key === 'Left' ||
+ event.key === 'ArrowLeft' ||
+ event.key === 'Right' ||
+ event.key === 'ArrowRight' ||
+ event.key === 'Esc' ||
+ event.key === 'Escape'
+ ) return
+
+ refocus()
+ }
+
+ function refocus () {
+ self._view.input.focus()
+ reattach({ currentTarget: self._view.term })
+ delete self.scroll2bottom
+ self.scroll2bottom()
+ }
+ function reattach (event) {
+ var el = event.currentTarget
+ var isBottomed = el.scrollHeight - el.scrollTop - el.clientHeight < 30
+ if (isBottomed) {
+ if (inserted) {
+ text.innerText = ''
+ background.onclick = undefined
+ if (placeholder.parentElement) self._view.journal.removeChild(placeholder)
+ }
+ inserted = false
+ delete self.scroll2bottom
+ } else {
+ if (!inserted) self._view.journal.appendChild(placeholder)
+ inserted = true
+ check()
+ if (!placeholder.nextElementSibling) {
+ placeholder.style.display = 'none'
+ } else {
+ placeholder.style = ''
+ }
+ self.scroll2bottom = function () {
+ var next = placeholder.nextElementSibling
+ if (next) {
+ placeholder.style = ''
+ check()
+ var messages = 1
+ while ((next = next.nextElementSibling)) messages += 1
+ text.innerText = `${messages} new unread log entries`
+ } else {
+ placeholder.style.display = 'none'
+ }
+ }
+ }
+ }
+ function check () {
+ var pos1 = self._view.term.offsetHeight + self._view.term.scrollTop - (self._view.el.offsetHeight * 0.15)
+ var pos2 = placeholder.offsetTop
+ if ((pos1 - pos2) > 0) {
+ text.style.display = 'none'
+ background.style.position = 'relative'
+ background.style.opacity = 0.3
+ background.style.right = 0
+ background.style.borderBox = 'content-box'
+ background.style.padding = '2px'
+ background.style.height = (self._view.journal.offsetHeight - (placeholder.offsetTop + placeholder.offsetHeight)) + 'px'
+ background.onclick = undefined
+ background.style.cursor = 'default'
+ background.style.pointerEvents = 'none'
+ } else {
+ background.style = ''
+ text.style = ''
+ background.onclick = function (event) {
+ placeholder.scrollIntoView()
+ check()
+ }
+ }
+ }
+ function hover (event) { event.currentTarget.classList.toggle(css.hover) }
+ function minimize (event) {
+ event.preventDefault()
+ event.stopPropagation()
+ if (event.button === 0) {
+ var classList = self._view.icon.classList
+ classList.toggle('fa-angle-double-down')
+ classList.toggle('fa-angle-double-up')
+ self.event.trigger('resize', [])
+ }
+ }
+ var filtertimeout = null
+ function filter (event) {
+ if (filtertimeout) {
+ clearTimeout(filtertimeout)
+ }
+ filtertimeout = setTimeout(() => {
+ self.updateJournal({ type: 'search', value: self._view.inputSearch.value })
+ self.scroll2bottom()
+ }, 500)
+ }
+ function clear (event) {
+ refocus()
+ self._view.journal.innerHTML = ''
+ }
+ // ----------------- resizeable ui ---------------
+ function mousedown (event) {
+ event.preventDefault()
+ if (event.which === 1) {
+ moveGhostbar(event)
+ document.body.appendChild(ghostbar)
+ document.addEventListener('mousemove', moveGhostbar)
+ document.addEventListener('mouseup', removeGhostbar)
+ document.addEventListener('keydown', cancelGhostbar)
+ }
+ }
+ function cancelGhostbar (event) {
+ if (event.keyCode === 27) {
+ document.body.removeChild(ghostbar)
+ document.removeEventListener('mousemove', moveGhostbar)
+ document.removeEventListener('mouseup', removeGhostbar)
+ document.removeEventListener('keydown', cancelGhostbar)
+ }
+ }
+ function moveGhostbar (event) { // @NOTE HORIZONTAL ghostbar
+ ghostbar.style.top = self._api.getPosition(event) + 'px'
+ }
+ function removeGhostbar (event) {
+ if (self._view.icon.classList.contains('fa-angle-double-up')) {
+ self._view.icon.classList.toggle('fa-angle-double-down')
+ self._view.icon.classList.toggle('fa-angle-double-up')
+ }
+ document.body.removeChild(ghostbar)
+ document.removeEventListener('mousemove', moveGhostbar)
+ document.removeEventListener('mouseup', removeGhostbar)
+ document.removeEventListener('keydown', cancelGhostbar)
+ self.event.trigger('resize', [self._api.getPosition(event)])
+ }
+
+ self._cmdHistory = []
+ self._cmdIndex = -1
+ self._cmdTemp = ''
+
+ var intro = yo`
+ - Welcome to Remix ${packageJson.version} -
+
You can use this terminal to:
+
+ Check transactions details and start debugging.
+ Execute JavaScript scripts:
+
+ - Input a script directly in the command line interface
+
+ - Select a Javascript file in the file explorer and then run \`remix.execute()\` or \`remix.exeCurrent()\` in the command line interface
+
+ - Right click on a JavaScript file in the file explorer and then click \`Run\`
+ The following libraries are accessible:
+
+
+
+
+
+ `
+
+ self._shell('remix.help()', self.commands, () => {})
+ self.commands.html(intro)
+
+ self._components.txLogger = new TxLogger(this, self.blockchain)
+ self._components.txLogger.event.register('debuggingRequested', async (hash) => {
+ // TODO should probably be in the run module
+ if (!await self._opts.appManager.isActive('debugger')) await self._opts.appManager.activatePlugin('debugger')
+ this.call('debugger', 'debug', hash)
+ this.call('menuicons', 'select', 'debugger')
+ })
+
+ return self._view.el
+
+ function wrapScript (script) {
+ if (script.startsWith('remix.')) return script
+ return `
+ try {
+ const ret = ${script};
+ if (ret instanceof Promise) {
+ ret.then((result) => { console.log(result) }).catch((error) => { console.log(error) })
+ } else {
+ console.log(ret)
+ }
+ } catch (e) {
+ console.log(e.message)
+ }
+ `
+ }
+ function change (event) {
+ if (self._components.autoCompletePopup.handleAutoComplete(
+ event,
+ self._view.input.innerText)) return
+ if (self._view.input.innerText.length === 0) self._view.input.innerText += '\n'
+ if (event.which === 13) {
+ if (event.ctrlKey) { //
+ self._view.input.innerText += '\n'
+ self.putCursor2End(self._view.input)
+ self.scroll2bottom()
+ self._components.autoCompletePopup.removeAutoComplete()
+ } else { //
+ self._cmdIndex = -1
+ self._cmdTemp = ''
+ event.preventDefault()
+ var script = self._view.input.innerText.trim()
+ self._view.input.innerText = '\n'
+ if (script.length) {
+ self._cmdHistory.unshift(script)
+ self.commands.script(wrapScript(script))
+ }
+ self._components.autoCompletePopup.removeAutoComplete()
+ }
+ } else if (event.which === 38) { //
+ var len = self._cmdHistory.length
+ if (len === 0) return event.preventDefault()
+ if (self._cmdHistory.length - 1 > self._cmdIndex) {
+ self._cmdIndex++
+ }
+ self._view.input.innerText = self._cmdHistory[self._cmdIndex]
+ self.putCursor2End(self._view.input)
+ self.scroll2bottom()
+ } else if (event.which === 40) { //
+ if (self._cmdIndex > -1) {
+ self._cmdIndex--
+ }
+ self._view.input.innerText = self._cmdIndex >= 0 ? self._cmdHistory[self._cmdIndex] : self._cmdTemp
+ self.putCursor2End(self._view.input)
+ self.scroll2bottom()
+ } else {
+ self._cmdTemp = self._view.input.innerText
+ }
+ }
+ }
+ putCursor2End (editable) {
+ var range = document.createRange()
+ range.selectNode(editable)
+ var child = editable
+ var chars
+
+ while (child) {
+ if (child.lastChild) child = child.lastChild
+ else break
+ if (child.nodeType === Node.TEXT_NODE) {
+ chars = child.textContent.length
+ } else {
+ chars = child.innerHTML.length
+ }
+ }
+
+ range.setEnd(child, chars)
+ var toStart = true
+ var toEnd = !toStart
+ range.collapse(toEnd)
+
+ var sel = window.getSelection()
+ sel.removeAllRanges()
+ sel.addRange(range)
+
+ editable.focus()
+ }
+ updateJournal (filterEvent) {
+ var self = this
+ var commands = self.data.activeFilters.commands
+ var value = filterEvent.value
+ if (filterEvent.type === 'select') {
+ commands[value] = true
+ if (!self._INDEX.commandsMain[value]) return
+ self._INDEX.commandsMain[value].forEach(item => {
+ item.root.steps.forEach(item => { self._JOURNAL[item.gidx] = item })
+ self._JOURNAL[item.gidx] = item
+ })
+ } else if (filterEvent.type === 'deselect') {
+ commands[value] = false
+ if (!self._INDEX.commandsMain[value]) return
+ self._INDEX.commandsMain[value].forEach(item => {
+ item.root.steps.forEach(item => { self._JOURNAL[item.gidx].hide = true })
+ self._JOURNAL[item.gidx].hide = true
+ })
+ } else if (filterEvent.type === 'search') {
+ if (value !== self.data.activeFilters.input) {
+ var query = self.data.activeFilters.input = value
+ var items = self._JOURNAL
+ for (var gidx = 0, len = items.length; gidx < len; gidx++) {
+ var item = items[gidx]
+ if (item && self.data.filterFns[item.cmd]) {
+ var show = query.length ? self.data.filterFns[item.cmd](item.args, query) : true
+ item.hide = !show
+ }
+ }
+ }
+ }
+ var df = document.createDocumentFragment()
+ self._JOURNAL.forEach(item => {
+ if (item && item.el && !item.hide) df.appendChild(item.el)
+ })
+ self._view.journal.innerHTML = ''
+ requestAnimationFrame(function updateDOM () {
+ self._view.journal.appendChild(df)
+ })
+ }
+ _appendItem (item) {
+ var self = this
+ var { el, gidx } = item
+ self._JOURNAL[gidx] = item
+ if (!self._jobs.length) {
+ requestAnimationFrame(function updateTerminal () {
+ self._jobs.forEach(el => self._view.journal.appendChild(el))
+ self.scroll2bottom()
+ self._jobs = []
+ })
+ }
+ if (self.data.activeFilters.commands[item.cmd]) self._jobs.push(el)
+ }
+ scroll2bottom () {
+ var self = this
+ setTimeout(function () {
+ self._view.term.scrollTop = self._view.term.scrollHeight
+ }, 0)
+ }
+ _blocksRenderer (mode) {
+ if (mode === 'html') {
+ return function logger (args, scopedCommands, append) {
+ if (args.length) append(args[0])
+ }
+ }
+ mode = {
+ log: 'text-info',
+ info: 'text-info',
+ warn: 'text-warning',
+ error: 'text-danger' }[mode] // defaults
+
+ if (mode) {
+ const filterUndefined = (el) => el !== undefined && el !== null
+ return function logger (args, scopedCommands, append) {
+ var types = args.filter(filterUndefined).map(type)
+ var values = javascriptserialize.apply(null, args.filter(filterUndefined)).map(function (val, idx) {
+ if (typeof args[idx] === 'string') val = args[idx]
+ if (types[idx] === 'element') val = jsbeautify.html(val)
+ return val
+ })
+ if (values.length) {
+ append(yo`${values} `)
+ }
+ }
+ } else {
+ throw new Error('mode is not supported')
+ }
+ }
+ _scopeCommands (append) {
+ var self = this
+ var scopedCommands = {}
+ Object.keys(self.commands).forEach(function makeScopedCommand (cmd) {
+ var command = self._commands[cmd]
+ scopedCommands[cmd] = function _command () {
+ var args = [...arguments]
+ command(args, scopedCommands, el => append(cmd, args, blockify(el)))
+ }
+ })
+ return scopedCommands
+ }
+ registerFilter (commandName, filterFn) {
+ this.data.filterFns[commandName] = filterFn
+ }
+ registerCommand (name, command, opts) {
+ var self = this
+ name = String(name)
+ if (self._commands[name]) throw new Error(`command "${name}" exists already`)
+ if (typeof command !== 'function') throw new Error(`invalid command: ${command}`)
+ self._commands[name] = command
+ self._INDEX.commands[name] = []
+ self._INDEX.commandsMain[name] = []
+ self.commands[name] = function _command () {
+ var args = [...arguments]
+ var steps = []
+ var root = { steps, cmd: name }
+ var ITEM = { root, cmd: name }
+ root.gidx = self._INDEX.allMain.push(ITEM) - 1
+ root.idx = self._INDEX.commandsMain[name].push(ITEM) - 1
+ function append (cmd, params, el) {
+ var item
+ if (cmd) { // subcommand
+ item = { el, cmd, root }
+ } else { // command
+ item = ITEM
+ item.el = el
+ cmd = name
+ }
+ item.gidx = self._INDEX.all.push(item) - 1
+ item.idx = self._INDEX.commands[cmd].push(item) - 1
+ item.step = steps.push(item) - 1
+ item.args = params
+ self._appendItem(item)
+ }
+ var scopedCommands = self._scopeCommands(append)
+ command(args, scopedCommands, el => append(null, args, blockify(el)))
+ }
+ var help = typeof command.help === 'string' ? command.help : [
+ '// no help available for:',
+ `terminal.commands.${name}(...)`
+ ].join('\n')
+ self.commands[name].toString = _ => { return help }
+ self.commands[name].help = help
+ self.data.activeFilters.commands[name] = opts && opts.activate
+ if (opts.filterFn) {
+ self.registerFilter(name, opts.filterFn)
+ }
+ return self.commands[name]
+ }
+ async _shell (script, scopedCommands, done) { // default shell
+ if (script.indexOf('remix:') === 0) {
+ return done(null, 'This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.')
+ }
+ var self = this
+ if (script.indexOf('remix.') === 0) {
+ // we keep the old feature. This will basically only be called when the command is querying the "remix" object.
+ // for all the other case, we use the Code Executor plugin
+ var context = domTerminalFeatures(self, scopedCommands, self.blockchain)
+ try {
+ var cmds = vm.createContext(context)
+ var result = vm.runInContext(script, cmds)
+ return done(null, result)
+ } catch (error) {
+ return done(error.message)
+ }
+ }
+ try {
+ await this.call('scriptRunner', 'execute', script)
+ done()
+ } catch (error) {
+ done(error.message)
+ }
+ }
+}
+
+function domTerminalFeatures (self, scopedCommands, blockchain) {
+ return {
+ remix: self._components.cmdInterpreter
+ }
+}
+
+function blockify (el) { return yo`${el}
` }
+
+module.exports = Terminal
diff --git a/apps/remix-ide/src/app/tabs/analysis-tab.js b/apps/remix-ide/src/app/tabs/analysis-tab.js
new file mode 100644
index 0000000000..3ff067f96a
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/analysis-tab.js
@@ -0,0 +1,50 @@
+var yo = require('yo-yo')
+var StaticAnalysis = require('./staticanalysis/staticAnalysisView')
+var EventManager = require('../../lib/events')
+
+import { ViewPlugin } from '@remixproject/engine'
+import { EventEmitter } from 'events'
+import * as packageJson from '../../../../../package.json'
+
+const profile = {
+ name: 'solidityStaticAnalysis',
+ displayName: 'Solidity static analysis',
+ methods: [],
+ events: [],
+ icon: 'assets/img/staticAnalysis.webp',
+ description: 'Checks the contract code for security vulnerabilities and bad practices.',
+ kind: 'analysis',
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/static_analysis.html',
+ version: packageJson.version
+}
+
+class AnalysisTab extends ViewPlugin {
+
+ constructor (registry) {
+ super(profile)
+ this.event = new EventManager()
+ this.events = new EventEmitter()
+ this.registry = registry
+ }
+
+ render () {
+ if (!this.staticanalysis) this.staticanalysis = new StaticAnalysis(this.registry, this)
+ this.staticanalysis.event.register('staticAnaysisWarning', (count) => {
+ if (count > 0) {
+ this.emit('statusChanged', {key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning'})
+ } else if (count === 0) {
+ this.emit('statusChanged', {key: 'succeed', title: 'no warning', type: 'success'})
+ } else {
+ // count ==-1 no compilation result
+ this.emit('statusChanged', {key: 'none'})
+ }
+ })
+ this.registry.put({api: this.staticanalysis, name: 'staticanalysis'})
+
+ return yo`${this.staticanalysis.render()}
`
+ }
+
+}
+
+module.exports = AnalysisTab
diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js
new file mode 100644
index 0000000000..42413443ae
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/compile-tab.js
@@ -0,0 +1,488 @@
+/* global */
+const EventEmitter = require('events')
+const $ = require('jquery')
+const yo = require('yo-yo')
+const copy = require('copy-text-to-clipboard')
+var QueryParams = require('../../lib/query-params')
+const TreeView = require('../ui/TreeView')
+const modalDialog = require('../ui/modaldialog')
+const copyToClipboard = require('../ui/copy-to-clipboard')
+const modalDialogCustom = require('../ui/modal-dialog-custom')
+const parseContracts = require('./compileTab/contractParser')
+const addTooltip = require('../ui/tooltip')
+const globalRegistry = require('../../global/registry')
+
+var css = require('./styles/compile-tab-styles')
+
+const CompileTabLogic = require('./compileTab/compileTab.js')
+const CompilerContainer = require('./compileTab/compilerContainer.js')
+
+import { ViewPlugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+import publishToStorage from '../../publishToStorage'
+import { compile } from '../compiler/compiler-helpers'
+
+const profile = {
+ name: 'solidity',
+ displayName: 'Solidity compiler',
+ icon: 'assets/img/solidity.webp',
+ description: 'Compile solidity contracts',
+ kind: 'compiler',
+ permission: true,
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html',
+ version: packageJson.version,
+ methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig']
+
+}
+
+// EditorApi:
+// - events: ['compilationFinished'],
+// - methods: ['getCompilationResult']
+
+class CompileTab extends ViewPlugin {
+
+ constructor (editor, config, renderer, fileProvider, fileManager) {
+ super(profile)
+ this.events = new EventEmitter()
+ this._view = {
+ el: null,
+ warnCompilationSlow: null,
+ errorContainer: null,
+ contractEl: null
+ }
+ this.queryParams = new QueryParams()
+ this.fileProvider = fileProvider
+ // dependencies
+ this.editor = editor
+ this.config = config
+ this.renderer = renderer
+ this.fileManager = fileManager
+
+ this.data = {
+ contractsDetails: {},
+ eventHandlers: {},
+ loading: false
+ }
+ }
+
+ onActivationInternal () {
+ this.compileTabLogic = new CompileTabLogic(this.queryParams, this.fileManager, this.editor, this.config, this.fileProvider)
+ this.compiler = this.compileTabLogic.compiler
+ this.compileTabLogic.init()
+
+ this.compilerContainer = new CompilerContainer(
+ this.compileTabLogic,
+ this.editor,
+ this.config,
+ this.queryParams
+ )
+ }
+
+ /************
+ * EVENTS
+ */
+
+ listenToEvents () {
+ this.data.eventHandlers.onContentChanged = () => {
+ this.emit('statusChanged', {key: 'edited', title: 'the content has changed, needs recompilation', type: 'info'})
+ }
+ this.editor.event.register('contentChanged', this.data.eventHandlers.onContentChanged)
+
+ this.data.eventHandlers.onLoadingCompiler = () => {
+ this.data.loading = true
+ this.emit('statusChanged', {key: 'loading', title: 'loading compiler...', type: 'info'})
+ }
+ this.compiler.event.register('loadingCompiler', this.data.eventHandlers.onLoadingCompiler)
+
+ this.data.eventHandlers.onCompilerLoaded = () => {
+ this.data.loading = false
+ this.emit('statusChanged', {key: 'none'})
+ }
+ this.compiler.event.register('compilerLoaded', this.data.eventHandlers.onCompilerLoaded)
+
+ this.data.eventHandlers.onStartingCompilation = () => {
+ if (this._view.errorContainer) {
+ this._view.errorContainer.innerHTML = ''
+ }
+ this.emit('statusChanged', {key: 'loading', title: 'compiling...', type: 'info'})
+ }
+ this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation)
+
+ this.data.eventHandlers.onCurrentFileChanged = (name) => {
+ this.compilerContainer.currentFile = name
+ }
+ this.fileManager.events.on('currentFileChanged', this.data.eventHandlers.onCurrentFileChanged)
+
+ this.data.eventHandlers.onNoFileSelected = () => {
+ this.compilerContainer.currentFile = ''
+ }
+ this.fileManager.events.on('noFileSelected', this.data.eventHandlers.onNoFileSelected)
+
+ this.data.eventHandlers.onCompilationFinished = (success, data, source) => {
+ this._view.errorContainer.appendChild(yo` `)
+ if (success) {
+ // forwarding the event to the appManager infra
+ this.emit('compilationFinished', source.target, source, 'soljson', data)
+ if (data.errors && data.errors.length > 0) {
+ this.emit('statusChanged', {
+ key: data.errors.length,
+ title: `compilation finished successful with warning${data.errors.length > 1 ? 's' : ''}`,
+ type: 'warning'
+ })
+ } else this.emit('statusChanged', {key: 'succeed', title: 'compilation successful', type: 'success'})
+ // Store the contracts
+ this.data.contractsDetails = {}
+ this.compiler.visitContracts((contract) => {
+ this.data.contractsDetails[contract.name] = parseContracts(
+ contract.name,
+ contract.object,
+ this.compiler.getSource(contract.file)
+ )
+ })
+ } else {
+ const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + data.error ? 1 : 0)
+ this.emit('statusChanged', {key: count, title: `compilation failed with ${count} error${count.length > 1 ? 's' : ''}`, type: 'error'})
+ }
+ // Update contract Selection
+ let contractMap = {}
+ if (success) this.compiler.visitContracts((contract) => { contractMap[contract.name] = contract })
+ let contractSelection = this.contractSelection(contractMap)
+ yo.update(this._view.contractSelection, contractSelection)
+
+ if (data['error']) {
+ this.renderer.error(
+ data['error'].formattedMessage || data['error'],
+ this._view.errorContainer,
+ {type: data['error'].severity || 'error'}
+ )
+ if (data['error'].mode === 'panic') {
+ return modalDialogCustom.alert(yo`
+
+ The compiler returned with the following internal error:
${data['error'].formattedMessage}.
+ The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet.
+ It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected).
+ Please join
remix gitter channel for more information.
`)
+ }
+ }
+ if (data.errors && data.errors.length) {
+ data.errors.forEach((err) => {
+ if (this.config.get('hideWarnings')) {
+ if (err.severity !== 'warning') {
+ this.renderer.error(err.formattedMessage, this._view.errorContainer, {type: err.severity})
+ }
+ } else {
+ this.renderer.error(err.formattedMessage, this._view.errorContainer, {type: err.severity})
+ }
+ })
+ }
+ }
+ this.compiler.event.register('compilationFinished', this.data.eventHandlers.onCompilationFinished)
+
+ this.data.eventHandlers.onThemeChanged = (theme) => {
+ const invert = theme.quality === 'dark' ? 1 : 0
+ const img = document.getElementById('swarmLogo')
+ if (img) {
+ img.style.filter = `invert(${invert})`
+ }
+ }
+ globalRegistry.get('themeModule').api.events.on('themeChanged', this.data.eventHandlers.onThemeChanged)
+
+ // Run the compiler instead of trying to save the website
+ $(window).keydown((e) => {
+ // ctrl+s or command+s
+ if ((e.metaKey || e.ctrlKey) && e.keyCode === 83) {
+ e.preventDefault()
+ this.compileTabLogic.runCompiler()
+ }
+ })
+ }
+
+ getCompilationResult () {
+ return this.compileTabLogic.compiler.state.lastCompilationResult
+ }
+
+ /**
+ * compile using @arg fileName.
+ * The module UI will be updated accordingly to the new compilation result.
+ * This function is used by remix-plugin compiler API.
+ * @param {string} fileName to compile
+ */
+ compile (fileName) {
+ addTooltip(yo`${this.currentRequest.from} is requiring to compile ${fileName}
`)
+ return this.compileTabLogic.compileFile(fileName)
+ }
+
+ /**
+ * compile using @arg compilationTargets and @arg settings
+ * The module UI will *not* be updated, the compilation result is returned
+ * This function is used by remix-plugin compiler API.
+ * @param {object} map of source files.
+ * @param {object} settings {evmVersion, optimize, version, language}
+ */
+ async compileWithParameters (compilationTargets, settings) {
+ return await compile(compilationTargets, settings)
+ }
+
+ // This function is used for passing the compiler remix-tests
+ getCurrentVersion () {
+ return this.compilerContainer.data.selectedVersion
+ }
+
+ // This function is used for passing the compiler configuration to 'remix-tests'
+ getCurrentCompilerConfig () {
+ return {
+ currentVersion: this.compilerContainer.data.selectedVersion,
+ evmVersion: this.compileTabLogic.evmVersion,
+ optimize: this.compileTabLogic.optimize
+ }
+ }
+
+ /**
+ * set the compiler configuration
+ * This function is used by remix-plugin compiler API.
+ * @param {object} settings {evmVersion, optimize, version, language}
+ */
+ setCompilerConfig (settings) {
+ return new Promise((resolve, reject) => {
+ addTooltip(yo`${this.currentRequest.from} is updating the
Solidity compiler configuration .
${JSON.stringify(settings, null, '\t')} `)
+ this.compilerContainer.setConfiguration(settings)
+ // @todo(#2875) should use loading compiler return value to check whether the compiler is loaded instead of "setInterval"
+ let timeout = 0
+ const id = setInterval(() => {
+ timeout++
+ console.log(this.data.loading)
+ if (!this.data.loading || timeout > 10) {
+ resolve()
+ clearInterval(id)
+ }
+ }, 200)
+ })
+ }
+
+ /*********
+ * SUB-COMPONENTS
+ */
+
+ /**
+ * Section to select the compiled contract
+ * @param {string[]} contractList Names of the compiled contracts
+ */
+ contractSelection (contractMap) {
+ // Return the file name of a path: ex "browser/ballot.sol" -> "ballot.sol"
+ const getFileName = (path) => {
+ const part = path.split('/')
+ return part[part.length - 1]
+ }
+ const contractList = contractMap ? Object.keys(contractMap).map((key) => ({
+ name: key,
+ file: getFileName(contractMap[key].file)
+ })) : []
+ let selectEl = yo`
+
+ ${contractList.map(({name, file}) => yo`${name} (${file}) `)}
+
+ `
+ // define swarm logo
+
+ let result = contractList.length
+ ? yo`
+
+
+ Contract
+ ${selectEl}
+
+
+
+ Publish on Swarm
+
+
+
+ Publish on Ipfs
+
+
+
+ Compilation Details
+
+
+
+
+ `
+ : yo`
+ No Contract Compiled Yet
+ `
+
+ if (contractList.length) {
+ this.selectedContract = selectEl.value
+ } else {
+ delete this.selectedContract
+ }
+ return result
+ }
+
+ // TODO : Add success alert when compilation succeed
+ contractCompiledSuccess () {
+ return yo`
`
+ }
+ // TODO : Add error alert when compilation failed
+ contractCompiledError () {
+ return yo`
`
+ }
+
+ /************
+ * METHODS
+ */
+
+ selectContract (contractName) {
+ this.selectedContract = contractName
+ }
+
+ details () {
+ const help = {
+ 'Assembly': 'Assembly opcodes describing the contract including corresponding solidity source code',
+ 'Opcodes': 'Assembly opcodes describing the contract',
+ 'Runtime Bytecode': 'Bytecode storing the state and being executed during normal contract call',
+ 'bytecode': 'Bytecode being executed during contract creation',
+ 'functionHashes': 'List of declared function and their corresponding hash',
+ 'gasEstimates': 'Gas estimation for each function call',
+ 'metadata': 'Contains all informations related to the compilation',
+ 'metadataHash': 'Hash representing all metadata information',
+ 'abi': 'ABI: describing all the functions (input/output params, scope, ...)',
+ 'name': 'Name of the compiled contract',
+ 'swarmLocation': 'Swarm url where all metadata information can be found (contract needs to be published first)',
+ 'web3Deploy': 'Copy/paste this code to any JavaScript/Web3 console to deploy this contract'
+ }
+ if (!this.selectedContract) throw new Error('No contract compiled yet')
+ const contractProperties = this.data.contractsDetails[this.selectedContract]
+ const log = yo`
`
+ Object.keys(contractProperties).map(propertyName => {
+ const copyDetails = yo`${copyToClipboard(() => contractProperties[propertyName])} `
+ const questionMark = yo` `
+ log.appendChild(yo`
+
${propertyName} ${copyDetails} ${questionMark}
+ ${this.insertValue(contractProperties, propertyName)}
+
`)
+ })
+ modalDialog(this.selectedContract, log, { label: '' }, { label: 'Close' })
+ }
+
+ insertValue (details, propertyName) {
+ var node
+ if (propertyName === 'web3Deploy' || propertyName === 'name' || propertyName === 'Assembly') {
+ node = yo`${details[propertyName]} `
+ } else if (propertyName === 'abi' || propertyName === 'metadata') {
+ const treeView = new TreeView({
+ extractData: function (item, parent, key) {
+ var ret = {}
+ if (item instanceof Array) {
+ ret.children = item.map((item, index) => ({ key: index, value: item }))
+ ret.self = ''
+ } else if (item instanceof Object) {
+ ret.children = Object.keys(item).map((key) => ({key: key, value: item[key]}))
+ ret.self = ''
+ } else {
+ ret.self = item
+ ret.children = []
+ }
+ return ret
+ }
+ })
+ if (details[propertyName] !== '') {
+ try {
+ node = yo`
+
+ ${treeView.render(typeof details[propertyName] === 'object' ? details[propertyName] : JSON.parse(details[propertyName]))}
+
` // catch in case the parsing fails.
+ } catch (e) {
+ node = yo`Unable to display "${propertyName}": ${e.message}
`
+ }
+ } else {
+ node = yo` -
`
+ }
+ } else {
+ node = yo`${JSON.stringify(details[propertyName], null, 4)}
`
+ }
+ return yo`${node || ''} `
+ }
+
+ getContractProperty (property) {
+ if (!this.selectedContract) throw new Error('No contract compiled yet')
+ const contractProperties = this.data.contractsDetails[this.selectedContract]
+ return contractProperties[property] || null
+ }
+
+ copyContractProperty (property) {
+ let content = this.getContractProperty(property)
+ if (!content) {
+ addTooltip('No content available for ' + property)
+ return
+ }
+
+ try {
+ if (typeof content !== 'string') {
+ content = JSON.stringify(content, null, '\t')
+ }
+ } catch (e) {}
+
+ copy(content)
+ addTooltip('Copied value to clipboard')
+ }
+
+ copyABI () {
+ this.copyContractProperty('abi')
+ }
+
+ copyBytecode () {
+ this.copyContractProperty('bytecode')
+ }
+
+ render () {
+ if (this._view.el) return this._view.el
+ this.onActivationInternal()
+ this._view.errorContainer = yo`
`
+ this._view.contractSelection = this.contractSelection()
+ this._view.compilerContainer = this.compilerContainer.render()
+ this.compilerContainer.activate()
+ this._view.el = yo`
+
+ ${this._view.compilerContainer}
+ ${this._view.contractSelection}
+ ${this._view.errorContainer}
+
`
+ return this._view.el
+ }
+
+ onActivation () {
+ this.listenToEvents()
+ }
+
+ onDeactivation () {
+ this.compilerContainer.deactivate()
+ this.editor.event.unregister('contentChanged', this.data.eventHandlers.onContentChanged)
+ this.compiler.event.unregister('loadingCompiler', this.data.eventHandlers.onLoadingCompiler)
+ this.compiler.event.unregister('compilerLoaded', this.data.eventHandlers.onCompilerLoaded)
+ this.compileTabLogic.event.removeListener('startingCompilation', this.data.eventHandlers.onStartingCompilation)
+ this.fileManager.events.removeListener('currentFileChanged', this.data.eventHandlers.onCurrentFileChanged)
+ this.fileManager.events.removeListener('noFileSelected', this.data.eventHandlers.onNoFileSelected)
+ this.compiler.event.unregister('compilationFinished', this.data.eventHandlers.onCompilationFinished)
+ globalRegistry.get('themeModule').api.events.removeListener('themeChanged', this.data.eventHandlers.onThemeChanged)
+ }
+}
+
+module.exports = CompileTab
diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js
new file mode 100644
index 0000000000..c4d2965c4d
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js
@@ -0,0 +1,156 @@
+const async = require('async')
+const EventEmitter = require('events')
+var remixTests = require('@remix-project/remix-tests')
+var Compiler = require('@remix-project/remix-solidity').Compiler
+var CompilerImport = require('../../compiler/compiler-imports')
+
+// TODO: move this to the UI
+const addTooltip = require('../../ui/tooltip')
+
+class CompileTab {
+
+ constructor (queryParams, fileManager, editor, config, fileProvider) {
+ this.event = new EventEmitter()
+ this.queryParams = queryParams
+ this.compilerImport = new CompilerImport()
+ this.compiler = new Compiler((url, cb) => this.importFileCb(url, cb))
+ this.fileManager = fileManager
+ this.editor = editor
+ this.config = config
+ this.fileProvider = fileProvider
+ }
+
+ init () {
+ this.optimize = this.queryParams.get().optimize
+ this.optimize = this.optimize === 'true'
+ this.queryParams.update({ optimize: this.optimize })
+ this.compiler.set('optimize', this.optimize)
+
+ this.evmVersion = this.queryParams.get().evmVersion
+ if (this.evmVersion === 'undefined' || this.evmVersion === 'null' || !this.evmVersion) {
+ this.evmVersion = null
+ }
+ this.queryParams.update({ evmVersion: this.evmVersion })
+ this.compiler.set('evmVersion', this.evmVersion)
+ }
+
+ setOptimize (newOptimizeValue) {
+ this.optimize = newOptimizeValue
+ this.queryParams.update({ optimize: this.optimize })
+ this.compiler.set('optimize', this.optimize)
+ }
+
+ setEvmVersion (newEvmVersion) {
+ this.evmVersion = newEvmVersion
+ this.queryParams.update({ evmVersion: this.evmVersion })
+ this.compiler.set('evmVersion', this.evmVersion)
+ }
+
+ /**
+ * Set the compiler to using Solidity or Yul (default to Solidity)
+ * @params lang {'Solidity' | 'Yul'} ...
+ */
+ setLanguage (lang) {
+ this.compiler.set('language', lang)
+ }
+
+ /**
+ * Compile a specific file of the file manager
+ * @param {string} target the path to the file to compile
+ */
+ compileFile (target) {
+ if (!target) throw new Error('No target provided for compiliation')
+ const provider = this.fileManager.fileProviderOf(target)
+ if (!provider) throw new Error(`cannot compile ${target}. Does not belong to any explorer`)
+ return new Promise((resolve, reject) => {
+ provider.get(target, (error, content) => {
+ if (error) return reject(error)
+ const sources = { [target]: { content } }
+ this.event.emit('startingCompilation')
+ // setTimeout fix the animation on chrome... (animation triggered by 'staringCompilation')
+ setTimeout(() => { this.compiler.compile(sources, target); resolve() }, 100)
+ })
+ })
+ }
+
+ runCompiler () {
+ try {
+ this.fileManager.saveCurrentFile()
+ this.editor.clearAnnotations()
+ var currentFile = this.config.get('currentFile')
+ return this.compileFile(currentFile)
+ } catch (err) {
+ console.error(err)
+ }
+ }
+
+ importExternal (url, cb) {
+ this.compilerImport.import(url,
+
+ // TODO: move to an event that is generated, the UI shouldn't be here
+ (loadingMsg) => { addTooltip(loadingMsg) },
+ (error, content, cleanUrl, type, url) => {
+ if (error) return cb(error)
+
+ if (this.fileProvider) {
+ this.fileProvider.addExternal(type + '/' + cleanUrl, content, url)
+ }
+ cb(null, content)
+ })
+ }
+
+ /**
+ * import the content of @arg url.
+ * first look in the browser localstorage (browser explorer) or locahost explorer. if the url start with `browser/*` or `localhost/*`
+ * then check if the @arg url is located in the localhost, in the node_modules or installed_contracts folder
+ * then check if the @arg url match any external url
+ *
+ * @param {String} url - URL of the content. can be basically anything like file located in the browser explorer, in the localhost explorer, raw HTTP, github address etc...
+ * @param {Function} cb - callback
+ */
+ importFileCb (url, filecb) {
+ if (url.indexOf('remix_tests.sol') !== -1) return filecb(null, remixTests.assertLibCode)
+
+ var provider = this.fileManager.fileProviderOf(url)
+ if (provider) {
+ if (provider.type === 'localhost' && !provider.isConnected()) {
+ return filecb(`file provider ${provider.type} not available while trying to resolve ${url}`)
+ }
+ provider.exists(url, (error, exist) => {
+ if (error) return filecb(error)
+ if (!exist && provider.type === 'localhost') return filecb(`not found ${url}`)
+
+ /*
+ if the path is absolute and the file does not exist, we can stop here
+ Doesn't make sense to try to resolve "localhost/node_modules/localhost/node_modules/" and we'll end in an infinite loop.
+ */
+ if (!exist && url.startsWith('browser/')) return filecb(`not found ${url}`)
+ if (!exist && url.startsWith('localhost/')) return filecb(`not found ${url}`)
+
+ if (exist) return provider.get(url, filecb)
+
+ // try to resolve localhost modules (aka truffle imports) - e.g from the node_modules folder
+ const localhostProvider = this.fileManager.getProvider('localhost')
+ if (localhostProvider.isConnected()) {
+ var splitted = /([^/]+)\/(.*)$/g.exec(url)
+ return async.tryEach([
+ (cb) => { this.importFileCb('localhost/installed_contracts/' + url, cb) },
+ (cb) => { if (!splitted) { cb('URL not parseable: ' + url) } else { this.importFileCb('localhost/installed_contracts/' + splitted[1] + '/contracts/' + splitted[2], cb) } },
+ (cb) => { this.importFileCb('localhost/node_modules/' + url, cb) },
+ (cb) => { if (!splitted) { cb('URL not parseable: ' + url) } else { this.importFileCb('localhost/node_modules/' + splitted[1] + '/contracts/' + splitted[2], cb) } }],
+ (error, result) => {
+ if (error) return this.importExternal(url, filecb)
+ filecb(null, result)
+ }
+ )
+ } else {
+ // try to resolve external content
+ this.importExternal(url, filecb)
+ }
+ })
+ }
+ }
+
+}
+
+module.exports = CompileTab
diff --git a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js
new file mode 100644
index 0000000000..d5b6449d35
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js
@@ -0,0 +1,494 @@
+
+const yo = require('yo-yo')
+const helper = require('../../../lib/helper')
+const addTooltip = require('../../ui/tooltip')
+const semver = require('semver')
+const modalDialogCustom = require('../../ui/modal-dialog-custom')
+const css = require('../styles/compile-tab-styles')
+import { canUseWorker, baseURLBin, baseURLWasm, urlFromVersion, pathToURL, promisedMiniXhr } from '../../compiler/compiler-utils'
+
+class CompilerContainer {
+
+ constructor (compileTabLogic, editor, config, queryParams) {
+ this._view = {}
+ this.compileTabLogic = compileTabLogic
+ this.editor = editor
+ this.config = config
+ this.queryParams = queryParams
+
+ this.data = {
+ hideWarnings: config.get('hideWarnings') || false,
+ autoCompile: config.get('autoCompile'),
+ compileTimeout: null,
+ timeout: 300,
+ allversions: null,
+ selectedVersion: null,
+ defaultVersion: 'soljson-v0.6.6+commit.6c089d02.js' // this default version is defined: in makeMockCompiler (for browser test) and in package.json (downloadsolc_root) for the builtin compiler
+ }
+ }
+
+ /**
+ * Update the compilation button with the name of the current file
+ */
+ set currentFile (name = '') {
+ if (name && name !== '') {
+ this._setCompilerVersionFromPragma(name)
+ }
+ if (!this._view.compilationButton) return
+ const button = this.compilationButton(name.split('/').pop())
+ this._disableCompileBtn(!name || (name && !this.isSolFileSelected(name)))
+ yo.update(this._view.compilationButton, button)
+ }
+
+ isSolFileSelected (currentFile = '') {
+ if (!currentFile) currentFile = this.config.get('currentFile')
+ if (!currentFile) return false
+ const extention = currentFile.substr(currentFile.length - 3, currentFile.length)
+ return extention.toLowerCase() === 'sol' || extention.toLowerCase() === 'yul'
+ }
+
+ deactivate () {
+ // deactivate editor listeners
+ this.editor.event.unregister('contentChanged')
+ this.editor.event.unregister('sessionSwitched')
+ }
+
+ activate () {
+ this.currentFile = this.config.get('currentFile')
+ this.listenToEvents()
+ }
+
+ listenToEvents () {
+ this.editor.event.register('sessionSwitched', () => {
+ if (!this._view.compileIcon) return
+ this.scheduleCompilation()
+ })
+
+ this.compileTabLogic.event.on('startingCompilation', () => {
+ if (!this._view.compileIcon) return
+ this._view.compileIcon.setAttribute('title', 'compiling...')
+ this._view.compileIcon.classList.remove(`${css.bouncingIcon}`)
+ this._view.compileIcon.classList.add(`${css.spinningIcon}`)
+ })
+
+ this.compileTabLogic.compiler.event.register('compilationDuration', (speed) => {
+ if (!this._view.warnCompilationSlow) return
+ if (speed > 1000) {
+ const msg = `Last compilation took ${speed}ms. We suggest to turn off autocompilation.`
+ this._view.warnCompilationSlow.setAttribute('title', msg)
+ this._view.warnCompilationSlow.style.visibility = 'visible'
+ } else {
+ this._view.warnCompilationSlow.style.visibility = 'hidden'
+ }
+ })
+
+ this.editor.event.register('contentChanged', () => {
+ if (!this._view.compileIcon) return
+ this.scheduleCompilation()
+ this._view.compileIcon.classList.add(`${css.bouncingIcon}`) // @TODO: compileView tab
+ })
+
+ this.compileTabLogic.compiler.event.register('loadingCompiler', () => {
+ if (!this._view.compileIcon) return
+ this._disableCompileBtn(true)
+ this._view.compileIcon.setAttribute('title', 'compiler is loading, please wait a few moments.')
+ this._view.compileIcon.classList.add(`${css.spinningIcon}`)
+ this._view.warnCompilationSlow.style.visibility = 'hidden'
+ this._updateLanguageSelector()
+ })
+
+ this.compileTabLogic.compiler.event.register('compilerLoaded', () => {
+ if (!this._view.compileIcon) return
+ this._disableCompileBtn(false)
+ this._view.compileIcon.setAttribute('title', '')
+ this._view.compileIcon.classList.remove(`${css.spinningIcon}`)
+ if (this.data.autoCompile) this.compileIfAutoCompileOn()
+ })
+
+ this.compileTabLogic.compiler.event.register('compilationFinished', (success, data, source) => {
+ if (!this._view.compileIcon) return
+ this._view.compileIcon.setAttribute('title', 'idle')
+ this._view.compileIcon.classList.remove(`${css.spinningIcon}`)
+ this._view.compileIcon.classList.remove(`${css.bouncingIcon}`)
+ })
+ }
+
+ /**************
+ * SUBCOMPONENT
+ */
+ compilationButton (name = '') {
+ const displayed = name || ''
+ const disabled = name && this.isSolFileSelected() ? '' : 'disabled'
+ return yo`
+
+ ${this._view.compileIcon} Compile ${displayed}
+
+ `
+ }
+
+ _disableCompileBtn (shouldDisable) {
+ let btn = document.getElementById('compileBtn')
+ if (!btn) return
+ if (shouldDisable) {
+ btn.classList.add('disabled')
+ } else if (this.isSolFileSelected()) {
+ btn.classList.remove('disabled')
+ }
+ }
+
+ // Load solc compiler version according to pragma in contract file
+ _setCompilerVersionFromPragma (filename) {
+ if (!this.data.allversions) return
+ this.compileTabLogic.fileManager.readFile(filename).then(data => {
+ const pragmaArr = data.match(/(pragma solidity (.+?);)/g)
+ if (pragmaArr && pragmaArr.length === 1) {
+ const pragmaStr = pragmaArr[0].replace('pragma solidity', '').trim()
+ const pragma = pragmaStr.substring(0, pragmaStr.length - 1)
+ const releasedVersions = this.data.allversions.filter(obj => !obj.prerelease).map(obj => obj.version)
+ const allVersions = this.data.allversions.map(obj => this._retrieveVersion(obj.version))
+ const currentCompilerName = this._retrieveVersion(this._view.versionSelector.selectedOptions[0].label)
+ // contains only numbers part, for example '0.4.22'
+ const pureVersion = this._retrieveVersion()
+ // is nightly build newer than the last release
+ const isNewestNightly = currentCompilerName.includes('nightly') && semver.gt(pureVersion, releasedVersions[0])
+ // checking if the selected version is in the pragma range
+ const isInRange = semver.satisfies(pureVersion, pragma)
+ // checking if the selected version is from official compilers list(excluding custom versions) and in range or greater
+ const isOfficial = allVersions.includes(currentCompilerName)
+ if (isOfficial && (!isInRange && !isNewestNightly)) {
+ const compilerToLoad = semver.maxSatisfying(releasedVersions, pragma)
+ const compilerPath = this.data.allversions.filter(obj => !obj.prerelease && obj.version === compilerToLoad)[0].path
+ if (this.data.selectedVersion !== compilerPath) {
+ this.data.selectedVersion = compilerPath
+ this._updateVersionSelector()
+ }
+ }
+ }
+ })
+ }
+
+ _retrieveVersion (version) {
+ if (!version) version = this._view.versionSelector.value
+ return semver.coerce(version) ? semver.coerce(version).version : ''
+ }
+
+ render () {
+ this.compileTabLogic.compiler.event.register('compilerLoaded', (version) => this.setVersionText(version))
+ this.fetchAllVersion((allversions, selectedVersion) => {
+ this.data.allversions = allversions
+ this.data.selectedVersion = selectedVersion
+ if (this._view.versionSelector) this._updateVersionSelector()
+ })
+
+ this._view.warnCompilationSlow = yo` `
+ this._view.compileIcon = yo` `
+ this._view.autoCompile = yo` `
+ this._view.hideWarningsBox = yo` `
+ if (this.data.autoCompile) this._view.autoCompile.setAttribute('checked', '')
+ if (this.data.hideWarnings) this._view.hideWarningsBox.setAttribute('checked', '')
+
+ this._view.optimize = yo` `
+ if (this.compileTabLogic.optimize) this._view.optimize.setAttribute('checked', '')
+
+ this._view.versionSelector = yo`
+
+ ${this.data.defaultVersion}
+ `
+ this._view.languageSelector = yo`
+
+ Solidity
+ Yul
+ `
+ this._view.version = yo` `
+
+ this._view.evmVersionSelector = yo`
+
+ compiler default
+ istanbul
+ petersburg
+ constantinople
+ byzantium
+ spuriousDragon
+ tangerineWhistle
+ homestead
+ `
+ if (this.compileTabLogic.evmVersion) {
+ let s = this._view.evmVersionSelector
+ let i
+ for (i = 0; i < s.options.length; i++) {
+ if (s.options[i].value === this.compileTabLogic.evmVersion) {
+ break
+ }
+ }
+ if (i === s.options.length) { // invalid evmVersion from queryParams
+ s.selectedIndex = 0 // compiler default
+ this.onchangeEvmVersion()
+ } else {
+ s.selectedIndex = i
+ }
+ }
+
+ this._view.compilationButton = this.compilationButton()
+
+ this._view.includeNightlies = yo`
+ this._updateVersionSelector()}>
+ `
+ this._view.compileContainer = yo`
+
+
+
+
+
+
+ Compiler
+
+
+ ${this._view.versionSelector}
+
+
+ ${this._view.includeNightlies}
+ Include nightly builds
+
+
+ Language
+ ${this._view.languageSelector}
+
+
+ EVM Version
+ ${this._view.evmVersionSelector}
+
+
+
Compiler Configuration
+
+ ${this._view.autoCompile}
+ Auto compile
+
+
+ ${this._view.optimize}
+ Enable optimization
+
+
+ ${this._view.hideWarningsBox}
+ Hide warnings
+
+
+ ${this._view.compilationButton}
+
+
+
+ `
+
+ return this._view.compileContainer
+ }
+
+ promtCompiler () {
+ modalDialogCustom.prompt(
+ 'Add a custom compiler',
+ 'URL',
+ '',
+ (url) => this.addCustomCompiler(url)
+ )
+ }
+
+ addCustomCompiler (url) {
+ this.data.selectedVersion = this._view.versionSelector.value
+ this._updateVersionSelector(url)
+ }
+
+ updateAutoCompile (event) {
+ this.config.set('autoCompile', this._view.autoCompile.checked)
+ }
+
+ compile (event) {
+ const currentFile = this.config.get('currentFile')
+ if (!this.isSolFileSelected()) return
+
+ this._setCompilerVersionFromPragma(currentFile)
+ this.compileTabLogic.runCompiler()
+ }
+
+ compileIfAutoCompileOn () {
+ if (this.config.get('autoCompile')) {
+ this.compile()
+ }
+ }
+
+ hideWarnings (event) {
+ this.config.set('hideWarnings', this._view.hideWarningsBox.checked)
+ this.compileIfAutoCompileOn()
+ }
+
+ /*
+ The following functions are handlers for internal events.
+ */
+
+ onchangeOptimize () {
+ this.compileTabLogic.setOptimize(!!this._view.optimize.checked)
+ this.compileIfAutoCompileOn()
+ }
+
+ onchangeLanguage () {
+ this.compileTabLogic.setLanguage(this._view.languageSelector.value)
+ this.compileIfAutoCompileOn()
+ }
+
+ onchangeEvmVersion () {
+ let s = this._view.evmVersionSelector
+ let v = s.value
+ if (v === 'default') {
+ v = null
+ }
+ this.compileTabLogic.setEvmVersion(v)
+ this.compileIfAutoCompileOn()
+ }
+
+ onchangeLoadVersion () {
+ this.data.selectedVersion = this._view.versionSelector.value
+ this._updateVersionSelector()
+ this._updateLanguageSelector()
+ }
+
+ /*
+ The following functions map with the above event handlers.
+ They are an external API for modifying the compiler configuration.
+ */
+
+ setConfiguration (settings) {
+ this.setLanguage(settings.language)
+ this.setEvmVersion(settings.evmVersion)
+ this.setOptimize(settings.optimize)
+ this.setVersion(settings.version)
+ }
+
+ setOptimize (enabled) {
+ this._view.optimize.checked = enabled
+ this.onchangeOptimize()
+ }
+
+ setLanguage (lang) {
+ this._view.languageSelector.value = lang
+ this.onchangeLanguage()
+ }
+
+ setEvmVersion (version) {
+ this._view.evmVersionSelector.value = version || 'default'
+ this.onchangeEvmVersion()
+ }
+
+ setVersion (version) {
+ this._view.versionSelector.value = `soljson-v${version}.js`
+ this.onchangeLoadVersion()
+ }
+
+ _shouldBeAdded (version) {
+ return !version.includes('nightly') ||
+ (version.includes('nightly') && this._view.includeNightlies.checked)
+ }
+
+ _updateVersionSelector (customUrl = '') {
+ // update selectedversion of previous one got filtered out
+ if (!this.data.selectedVersion || !this._shouldBeAdded(this.data.selectedVersion)) {
+ this.data.selectedVersion = this.data.defaultVersion
+ }
+ this._view.versionSelector.innerHTML = ''
+ this.data.allversions.forEach(build => {
+ const option = build.path === this.data.selectedVersion
+ ? yo`${build.longVersion} `
+ : yo`${build.longVersion} `
+
+ if (this._shouldBeAdded(option.innerText)) {
+ this._view.versionSelector.appendChild(option)
+ }
+ })
+ this._view.versionSelector.removeAttribute('disabled')
+ this.queryParams.update({ version: this.data.selectedVersion })
+ let url
+ if (customUrl !== '') {
+ this.data.selectedVersion = customUrl
+ this._view.versionSelector.appendChild(yo`custom `)
+ url = customUrl
+ } else if (this.data.selectedVersion === 'builtin') {
+ let location = window.document.location
+ location = `${location.protocol}//${location.host}/${location.pathname}`
+ if (location.endsWith('index.html')) location = location.substring(0, location.length - 10)
+ if (!location.endsWith('/')) location += '/'
+ url = location + 'soljson.js'
+ } else {
+ if (this.data.selectedVersion.indexOf('soljson') !== 0 || helper.checkSpecialChars(this.data.selectedVersion)) {
+ return console.log('loading ' + this.data.selectedVersion + ' not allowed')
+ }
+ url = `${urlFromVersion(this.data.selectedVersion)}`
+ }
+
+ // Workers cannot load js on "file:"-URLs and we get a
+ // "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
+ // resort to non-worker version in that case.
+ if (this.data.selectedVersion !== 'builtin' && canUseWorker(this.data.selectedVersion)) {
+ this.compileTabLogic.compiler.loadVersion(true, url)
+ this.setVersionText('(loading using worker)')
+ } else {
+ this.compileTabLogic.compiler.loadVersion(false, url)
+ this.setVersionText('(loading)')
+ }
+ }
+
+ _updateLanguageSelector () {
+ // This is the first version when Yul is available
+ if (!semver.valid(this._retrieveVersion()) || semver.lt(this._retrieveVersion(), 'v0.5.7+commit.6da8b019.js')) {
+ this._view.languageSelector.setAttribute('disabled', '')
+ this._view.languageSelector.value = 'Solidity'
+ this.compileTabLogic.setLanguage('Solidity')
+ } else {
+ this._view.languageSelector.removeAttribute('disabled')
+ }
+ }
+
+ setVersionText (text) {
+ if (this._view.version) this._view.version.innerText = text
+ }
+
+ // fetching both normal and wasm builds and creating a [version, baseUrl] map
+ async fetchAllVersion (callback) {
+ let allVersions, selectedVersion, allVersionsWasm
+ // fetch normal builds
+ const binRes = await promisedMiniXhr(`${baseURLBin}/list.json`)
+ // fetch wasm builds
+ const wasmRes = await promisedMiniXhr(`${baseURLWasm}/list.json`)
+ if (binRes.event.type === 'error' && wasmRes.event.type === 'error') {
+ allVersions = [{ path: 'builtin', longVersion: 'latest local version' }]
+ selectedVersion = 'builtin'
+ callback(allVersions, selectedVersion)
+ }
+ try {
+ allVersions = JSON.parse(binRes.json).builds.slice().reverse()
+ selectedVersion = this.data.defaultVersion
+ if (this.queryParams.get().version) selectedVersion = this.queryParams.get().version
+ if (wasmRes.event.type !== 'error') {
+ allVersionsWasm = JSON.parse(wasmRes.json).builds.slice().reverse()
+ }
+ } catch (e) {
+ addTooltip('Cannot load compiler version list. It might have been blocked by an advertisement blocker. Please try deactivating any of them from this page and reload. Error: ' + e)
+ }
+ // replace in allVersions those compiler builds which exist in allVersionsWasm with new once
+ if (allVersionsWasm && allVersions) {
+ allVersions.forEach((compiler, index) => {
+ const wasmIndex = allVersionsWasm.findIndex(wasmCompiler => { return wasmCompiler.longVersion === compiler.longVersion })
+ if (wasmIndex !== -1) {
+ allVersions[index] = allVersionsWasm[wasmIndex]
+ pathToURL[compiler.path] = baseURLWasm
+ } else {
+ pathToURL[compiler.path] = baseURLBin
+ }
+ })
+ }
+ callback(allVersions, selectedVersion)
+ }
+ scheduleCompilation () {
+ if (!this.config.get('autoCompile')) return
+ if (this.data.compileTimeout) window.clearTimeout(this.data.compileTimeout)
+ this.data.compileTimeout = window.setTimeout(() => this.compileIfAutoCompileOn(), this.data.timeout)
+ }
+
+}
+
+module.exports = CompilerContainer
diff --git a/apps/remix-ide/src/app/tabs/compileTab/contractParser.js b/apps/remix-ide/src/app/tabs/compileTab/contractParser.js
new file mode 100644
index 0000000000..9c93940942
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/compileTab/contractParser.js
@@ -0,0 +1,122 @@
+'use strict'
+
+var solcTranslate = require('solc/translate')
+var remixLib = require('@remix-project/remix-lib')
+var txHelper = remixLib.execution.txHelper
+
+module.exports = (contractName, contract, compiledSource) => {
+ return getDetails(contractName, contract, compiledSource)
+}
+
+var getDetails = function (contractName, contract, source) {
+ var detail = {}
+ detail.name = contractName
+ detail.metadata = contract.metadata
+ if (contract.evm.bytecode.object) {
+ detail.bytecode = contract.evm.bytecode.object
+ }
+
+ detail.abi = contract.abi
+
+ if (contract.evm.bytecode.object) {
+ detail.bytecode = contract.evm.bytecode
+ detail.web3Deploy = gethDeploy(contractName.toLowerCase(), contract.abi, contract.evm.bytecode.object)
+
+ detail.metadataHash = retrieveMetadataHash(contract.evm.bytecode.object)
+ if (detail.metadataHash) {
+ detail.swarmLocation = 'bzzr://' + detail.metadataHash
+ }
+ }
+
+ detail.functionHashes = {}
+ for (var fun in contract.evm.methodIdentifiers) {
+ detail.functionHashes[contract.evm.methodIdentifiers[fun]] = fun
+ }
+
+ detail.gasEstimates = formatGasEstimates(contract.evm.gasEstimates)
+
+ detail.devdoc = contract.devdoc
+ detail.userdoc = contract.userdoc
+
+ if (contract.evm.deployedBytecode && contract.evm.deployedBytecode.object.length > 0) {
+ detail['Runtime Bytecode'] = contract.evm.deployedBytecode
+ }
+
+ if (source && contract.assembly !== null) {
+ detail['Assembly'] = solcTranslate.prettyPrintLegacyAssemblyJSON(contract.evm.legacyAssembly, source.content)
+ }
+
+ return detail
+}
+
+var retrieveMetadataHash = function (bytecode) {
+ var match = /a165627a7a72305820([0-9a-f]{64})0029$/.exec(bytecode)
+ if (!match) {
+ match = /a265627a7a72305820([0-9a-f]{64})6c6578706572696d656e74616cf50037$/.exec(bytecode)
+ }
+ if (match) {
+ return match[1]
+ }
+}
+
+var gethDeploy = function (contractName, jsonInterface, bytecode) {
+ var code = ''
+ var funABI = txHelper.getConstructorInterface(jsonInterface)
+
+ funABI.inputs.forEach(function (inp) {
+ code += 'var ' + inp.name + ' = /* var of type ' + inp.type + ' here */ ;\n'
+ })
+
+ contractName = contractName.replace(/[:./]/g, '_')
+ code += 'var ' + contractName + 'Contract = new web3.eth.Contract(' + JSON.stringify(jsonInterface).replace('\n', '') + ');' +
+ '\nvar ' + contractName + ' = ' + contractName + 'Contract.deploy({'
+ "\n data: '0x" + bytecode + "', " +
+ "\n arguments: [";
+
+ funABI.inputs.forEach(function (inp) {
+ code += '\n ' + inp.name + ','
+ })
+
+ code += '\n ]' +
+ '\n}).send({' +
+ '\n from: web3.eth.accounts[0], ' +
+ "\n gas: '4700000'" +
+ '\n }, function (e, contract){' +
+ '\n console.log(e, contract);' +
+ "\n if (typeof contract.address !== 'undefined') {" +
+ "\n console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);" +
+ '\n }' +
+ '\n })'
+
+ return code
+}
+
+var formatGasEstimates = function (data) {
+ if (!data) return {}
+ if (data.creation === undefined && data.external === undefined && data.internal === undefined) return {}
+
+ var gasToText = function (g) {
+ return g === null ? 'unknown' : g
+ }
+
+ var ret = {}
+ var fun
+ if ('creation' in data) {
+ ret['Creation'] = data.creation
+ }
+
+ if ('external' in data) {
+ ret['External'] = {}
+ for (fun in data.external) {
+ ret['External'][fun] = gasToText(data.external[fun])
+ }
+ }
+
+ if ('internal' in data) {
+ ret['Internal'] = {}
+ for (fun in data.internal) {
+ ret['Internal'][fun] = gasToText(data.internal[fun])
+ }
+ }
+ return ret
+}
diff --git a/apps/remix-ide/src/app/tabs/debugger-tab.js b/apps/remix-ide/src/app/tabs/debugger-tab.js
new file mode 100644
index 0000000000..5bc5c32d95
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger-tab.js
@@ -0,0 +1,91 @@
+const yo = require('yo-yo')
+const remixDebug = require('@remix-project/remix-debug')
+const css = require('./styles/debugger-tab-styles')
+import toaster from '../ui/tooltip'
+const DebuggerUI = require('./debugger/debuggerUI')
+import { ViewPlugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+const profile = {
+ name: 'debugger',
+ displayName: 'Debugger',
+ methods: ['debug', 'getTrace'],
+ events: [],
+ icon: 'assets/img/debuggerLogo.webp',
+ description: 'Debug transactions',
+ kind: 'debugging',
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/debugger.html',
+ version: packageJson.version
+}
+
+class DebuggerTab extends ViewPlugin {
+
+ constructor (blockchain) {
+ super(profile)
+ this.el = null
+ this.blockchain = blockchain
+ }
+
+ render () {
+ if (this.el) return this.el
+
+ this.el = yo`
+ `
+
+ this.on('fetchAndCompile', 'compiling', (settings) => {
+ toaster(yo`Recompiling and debugging with params ${JSON.stringify(settings, null, '\t')} `)
+ })
+
+ this.on('fetchAndCompile', 'compilationFailed', (data) => {
+ toaster(yo`Compilation failed... continuing without source code debugging.
`)
+ })
+
+ this.on('fetchAndCompile', 'notFound', (contractAddress) => {
+ toaster(yo`Contract ${contractAddress} not found in source code repository continuing without source code debugging.
`)
+ })
+
+ this.on('fetchAndCompile', 'usingLocalCompilation', (contractAddress) => {
+ toaster(yo`Using compilation result from Solidity module
`)
+ })
+
+ this.on('fetchAndCompile', 'sourceVerificationNotAvailable', () => {
+ toaster(yo`Source verification plugin not activated or not available. continuing without source code debugging.
`)
+ })
+
+ this.debuggerUI = new DebuggerUI(
+ this,
+ this.el.querySelector('#debugger'),
+ (address, receipt) => {
+ const target = (address && remixDebug.traceHelper.isContractCreation(address)) ? receipt.contractAddress : address
+ return this.call('fetchAndCompile', 'resolve', target || receipt.contractAddress || receipt.to, '.debug', this.blockchain.web3())
+ }
+ )
+
+ this.call('manager', 'activatePlugin', 'source-verification').catch(e => console.log(e.message))
+ // this.call('manager', 'activatePlugin', 'udapp')
+
+ return this.el
+ }
+
+ deactivate () {
+ this.debuggerUI.deleteHighlights()
+ super.deactivate()
+ }
+
+ debug (hash) {
+ if (this.debuggerUI) this.debuggerUI.debug(hash)
+ }
+
+ getTrace (hash) {
+ return this.debuggerUI.getTrace(hash)
+ }
+
+ debugger () {
+ return this.debuggerUI
+ }
+}
+
+module.exports = DebuggerTab
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI.js
new file mode 100644
index 0000000000..f37bda0d0c
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI.js
@@ -0,0 +1,230 @@
+var TxBrowser = require('./debuggerUI/TxBrowser')
+var StepManagerUI = require('./debuggerUI/StepManager')
+var VmDebugger = require('./debuggerUI/VmDebugger')
+var toaster = require('../../ui/tooltip')
+
+var Debugger = require('@remix-project/remix-debug').TransactionDebugger
+
+var SourceHighlighter = require('../../editor/sourceHighlighter')
+
+var EventManager = require('../../../lib/events')
+
+var globalRegistry = require('../../../global/registry')
+
+var remixDebug = require('@remix-project/remix-debug')
+
+var init = remixDebug.init
+
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .statusMessage {
+ margin-left: 15px;
+ }
+`
+
+class DebuggerUI {
+
+ constructor (debuggerModule, component, fetchContractAndCompile) {
+ this.debuggerModule = debuggerModule
+ this.fetchContractAndCompile = fetchContractAndCompile
+ this.event = new EventManager()
+
+ this.isActive = false
+
+ this.sourceHighlighter = new SourceHighlighter()
+
+ this.startTxBrowser()
+ this.stepManager = null
+
+ this.statusMessage = ''
+ this.currentReceipt
+
+ this.view
+
+ component.appendChild(this.render())
+
+ this.setEditor()
+ }
+
+ setEditor () {
+ this.editor = globalRegistry.get('editor').api
+
+ this.editor.event.register('breakpointCleared', (fileName, row) => {
+ if (this.debugger) this.debugger.breakPointManager.remove({fileName: fileName, row: row})
+ })
+
+ this.editor.event.register('breakpointAdded', (fileName, row) => {
+ if (this.debugger) this.debugger.breakPointManager.add({fileName: fileName, row: row})
+ })
+
+ this.editor.event.register('contentChanged', () => {
+ if (this.debugger) this.debugger.unload()
+ })
+ }
+
+ listenToEvents () {
+ if (!this.debugger) return
+
+ this.debugger.event.register('debuggerStatus', async (isActive) => {
+ await this.debuggerModule.call('editor', 'discardHighlight')
+ this.isActive = isActive
+ })
+
+ this.debugger.event.register('newSourceLocation', async (lineColumnPos, rawLocation) => {
+ const contracts = await this.fetchContractAndCompile(
+ this.currentReceipt.contractAddress || this.currentReceipt.to,
+ this.currentReceipt)
+ if (contracts) {
+ const path = contracts.getSourceName(rawLocation.file)
+ if (path) {
+ await this.debuggerModule.call('editor', 'discardHighlight')
+ await this.debuggerModule.call('editor', 'highlight', lineColumnPos, path)
+ }
+ }
+ })
+
+ this.debugger.event.register('debuggerUnloaded', () => this.unLoad())
+ }
+
+ startTxBrowser () {
+ let txBrowser = new TxBrowser()
+ this.txBrowser = txBrowser
+
+ txBrowser.event.register('requestDebug', (blockNumber, txNumber, tx) => {
+ if (this.debugger) this.debugger.unload()
+ this.startDebugging(blockNumber, txNumber, tx)
+ })
+
+ txBrowser.event.register('unloadRequested', this, (blockNumber, txIndex, tx) => {
+ if (this.debugger) this.debugger.unload()
+ })
+ }
+
+ isDebuggerActive () {
+ return this.isActive
+ }
+
+ getDebugWeb3 () {
+ return new Promise((resolve, reject) => {
+ this.debuggerModule.blockchain.detectNetwork((error, network) => {
+ let web3
+ if (error || !network) {
+ web3 = init.web3DebugNode(this.debuggerModule.blockchain.web3())
+ } else {
+ const webDebugNode = init.web3DebugNode(network.name)
+ web3 = !webDebugNode ? this.debuggerModule.blockchain.web3() : webDebugNode
+ }
+ init.extendWeb3(web3)
+ resolve(web3)
+ })
+ })
+ }
+
+ async startDebugging (blockNumber, txNumber, tx) {
+ if (this.debugger) this.unLoad()
+
+ let web3 = await this.getDebugWeb3()
+ this.currentReceipt = await web3.eth.getTransactionReceipt(txNumber)
+ this.debugger = new Debugger({
+ web3,
+ offsetToLineColumnConverter: globalRegistry.get('offsettolinecolumnconverter').api,
+ compilationResult: async (address) => {
+ try {
+ return await this.fetchContractAndCompile(address, this.currentReceipt)
+ } catch (e) {
+ console.error(e)
+ }
+ return null
+ }
+ })
+
+ this.listenToEvents()
+ this.debugger.debug(blockNumber, txNumber, tx, () => {
+ this.stepManager = new StepManagerUI(this.debugger.step_manager)
+ this.vmDebugger = new VmDebugger(this.debugger.vmDebuggerLogic)
+ this.txBrowser.setState({ blockNumber, txNumber, debugging: true })
+ this.renderDebugger()
+ }).catch((error) => {
+ toaster(error)
+ this.unLoad()
+ })
+ }
+
+ getTrace (hash) {
+ return new Promise(async (resolve, reject) => {
+ const web3 = await this.getDebugWeb3()
+
+ this.currentReceipt = await web3.eth.getTransactionReceipt(hash)
+ const debug = new Debugger({
+ web3,
+ offsetToLineColumnConverter: globalRegistry.get('offsettolinecolumnconverter').api,
+ compilationResult: async (address) => {
+ try {
+ return await this.fetchContractAndCompile(address, this.currentReceipt)
+ } catch (e) {
+ console.error(e)
+ }
+ return null
+ }
+ })
+ debug.debugger.traceManager.traceRetriever.getTrace(hash, (error, trace) => {
+ if (error) return reject(error)
+ resolve(trace)
+ })
+ })
+ }
+
+ debug (txHash) {
+ this.startDebugging(null, txHash, null)
+ }
+
+ render () {
+ this.debuggerPanelsView = yo`
`
+ this.debuggerHeadPanelsView = yo`
`
+ this.stepManagerView = yo`
`
+
+ var view = yo`
+
+
+ ${this.txBrowser.render()}
+ ${this.stepManagerView}
+ ${this.debuggerHeadPanelsView}
+
+
${this.statusMessage}
+ ${this.debuggerPanelsView}
+
+ `
+ if (!this.view) {
+ this.view = view
+ }
+ return view
+ }
+
+ async unLoad () {
+ yo.update(this.debuggerHeadPanelsView, yo`
`)
+ yo.update(this.debuggerPanelsView, yo`
`)
+ yo.update(this.stepManagerView, yo`
`)
+ if (this.vmDebugger) this.vmDebugger.remove()
+ if (this.stepManager) this.stepManager.remove()
+ if (this.txBrowser) this.txBrowser.setState({debugging: false})
+ this.vmDebugger = null
+ this.stepManager = null
+ if (this.debugger) delete this.debugger
+ this.event.trigger('traceUnloaded')
+ }
+
+ async deleteHighlights () {
+ await this.debuggerModule.call('editor', 'discardHighlight')
+ }
+
+ renderDebugger () {
+ yo.update(this.debuggerHeadPanelsView, this.vmDebugger.renderHead())
+ yo.update(this.debuggerPanelsView, this.vmDebugger.render())
+ yo.update(this.stepManagerView, this.stepManager.render())
+ }
+
+}
+
+module.exports = DebuggerUI
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/ButtonNavigator.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/ButtonNavigator.js
new file mode 100644
index 0000000000..9a84280ba4
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/ButtonNavigator.js
@@ -0,0 +1,130 @@
+'use strict'
+var EventManager = require('../../../../lib/events')
+var yo = require('yo-yo')
+
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .buttons {
+ display: flex;
+ flex-wrap: wrap;
+ }
+ .stepButtons {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ }
+ .stepButton {
+ }
+ .jumpButtons {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ }
+ .jumpButton {
+ }
+ .navigator {
+ }
+ .navigator:hover {
+ }
+`
+
+function ButtonNavigator () {
+ this.event = new EventManager()
+ this.intoBackDisabled = true
+ this.overBackDisabled = true
+ this.intoForwardDisabled = true
+ this.overForwardDisabled = true
+ this.jumpOutDisabled = true
+ this.jumpNextBreakpointDisabled = true
+ this.jumpPreviousBreakpointDisabled = true
+
+ this.view
+}
+
+ButtonNavigator.prototype.render = function () {
+ var self = this
+ var view = yo``
+ if (!this.view) {
+ this.view = view
+ }
+ return view
+}
+
+ButtonNavigator.prototype.reset = function () {
+ this.intoBackDisabled = true
+ this.overBackDisabled = true
+ this.intoForwardDisabled = true
+ this.overForwardDisabled = true
+ this.jumpOutDisabled = true
+ this.jumpNextBreakpointDisabled = true
+ this.jumpPreviousBreakpointDisabled = true
+ this.resetWarning('')
+}
+
+ButtonNavigator.prototype.stepChanged = function (stepState, jumpOutDisabled) {
+ if (stepState === 'invalid') {
+ // TODO: probably not necessary, already implicit done in the next steps
+ this.reset()
+ this.updateAll()
+ return
+ }
+
+ this.intoBackDisabled = (stepState === 'initial')
+ this.overBackDisabled = (stepState === 'initial')
+ this.jumpPreviousBreakpointDisabled = (stepState === 'initial')
+ this.jumpNextBreakpointDisabled = (stepState === 'end')
+ this.intoForwardDisabled = (stepState === 'end')
+ this.overForwardDisabled = (stepState === 'end')
+ this.jumpNextBreakpointDisabled = jumpOutDisabled
+
+ this.updateAll()
+}
+
+ButtonNavigator.prototype.updateAll = function () {
+ this.updateDisabled('intoback', this.intoBackDisabled)
+ this.updateDisabled('overback', this.overBackDisabled)
+ this.updateDisabled('overforward', this.overForwardDisabled)
+ this.updateDisabled('intoforward', this.intoForwardDisabled)
+ this.updateDisabled('jumpout', this.jumpOutDisabled)
+ this.updateDisabled('jumptoexception', this.jumpOutDisabled)
+ this.updateDisabled('jumpnextbreakpoint', this.jumpNextBreakpointDisabled)
+ this.updateDisabled('jumppreviousbreakpoint', this.jumpPreviousBreakpointDisabled)
+}
+
+ButtonNavigator.prototype.updateDisabled = function (id, disabled) {
+ if (disabled) {
+ document.getElementById(id).setAttribute('disabled', true)
+ } else {
+ document.getElementById(id).removeAttribute('disabled')
+ }
+}
+
+ButtonNavigator.prototype.resetWarning = function (revertedReason) {
+ if (!this.view) return
+ this.view.querySelector('#reverted #outofgas').style.display = (revertedReason === 'outofgas') ? 'inline' : 'none'
+ this.view.querySelector('#reverted #parenthasthrown').style.display = (revertedReason === 'parenthasthrown') ? 'inline' : 'none'
+ this.view.querySelector('#reverted').style.display = (revertedReason === '') ? 'none' : 'block'
+}
+
+module.exports = ButtonNavigator
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/Slider.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/Slider.js
new file mode 100644
index 0000000000..2330ede7e5
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/Slider.js
@@ -0,0 +1,57 @@
+'use strict'
+var EventManager = require('../../../../lib/events')
+var yo = require('yo-yo')
+
+class Slider {
+ constructor () {
+ this.event = new EventManager()
+ this.max
+ this.disabled = true
+ this.view
+ this.previousValue = null
+ }
+
+ setSliderLength (length) {
+ if (!this.view) return
+ this.view.querySelector('#slider').setAttribute('max', length - 1)
+ this.max = length - 1
+ this.disabled = (length === 0)
+
+ if (this.disabled) {
+ this.view.querySelector('#slider').setAttribute('disabled', true)
+ } else {
+ this.view.querySelector('#slider').removeAttribute('disabled')
+ }
+
+ this.setValue(0)
+ }
+
+ onChange (event) {
+ if (!this.view) return
+ var value = parseInt(this.view.querySelector('#slider').value)
+ if (value === this.previousValue) return
+
+ this.previousValue = value
+ this.event.trigger('sliderMoved', [value])
+ }
+
+ setValue (value) {
+ if (!this.view) return
+ this.view.querySelector('#slider').value = value
+ }
+
+ render () {
+ var self = this
+ var view = yo`
+
+
`
+ if (!this.view) {
+ this.view = view
+ }
+ return view
+ }
+
+}
+
+module.exports = Slider
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/StepManager.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/StepManager.js
new file mode 100644
index 0000000000..eef36e1778
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/StepManager.js
@@ -0,0 +1,59 @@
+var EventManager = require('../../../../lib/events')
+var yo = require('yo-yo')
+
+var ButtonNavigator = require('./ButtonNavigator')
+var Slider = require('./Slider')
+
+function StepManager (stepManager) {
+ this.event = new EventManager()
+ this.stepManager = stepManager
+ this.startSlider()
+ this.startButtonNavigator()
+ this.stepManager.event.register('stepChanged', this.updateStep.bind(this))
+}
+
+StepManager.prototype.startSlider = function () {
+ this.slider = new Slider()
+ this.slider.event.register('sliderMoved', this.stepManager.jumpTo.bind(this.stepManager))
+ this.stepManager.event.register('traceLengthChanged', this.slider.setSliderLength.bind(this.slider))
+}
+
+StepManager.prototype.startButtonNavigator = function () {
+ this.buttonNavigator = new ButtonNavigator()
+
+ this.stepManager.event.register('revertWarning', this.buttonNavigator.resetWarning.bind(this.buttonNavigator))
+
+ this.buttonNavigator.event.register('stepIntoBack', this.stepManager.stepIntoBack.bind(this.stepManager))
+ this.buttonNavigator.event.register('stepIntoForward', this.stepManager.stepIntoForward.bind(this.stepManager))
+ this.buttonNavigator.event.register('stepOverBack', this.stepManager.stepOverBack.bind(this.stepManager))
+ this.buttonNavigator.event.register('stepOverForward', this.stepManager.stepOverForward.bind(this.stepManager))
+ this.buttonNavigator.event.register('jumpOut', this.stepManager.jumpOut.bind(this.stepManager))
+ this.buttonNavigator.event.register('jumpToException', this.stepManager.jumpToException.bind(this.stepManager))
+ this.buttonNavigator.event.register('jumpNextBreakpoint', this.stepManager.jumpNextBreakpoint.bind(this.stepManager))
+ this.buttonNavigator.event.register('jumpPreviousBreakpoint', this.stepManager.jumpPreviousBreakpoint.bind(this.stepManager))
+}
+
+StepManager.prototype.updateStep = function (step, stepState, jumpOutDisabled) {
+ if (!this.slider) return
+ this.slider.setValue(step)
+ this.buttonNavigator.stepChanged(stepState, jumpOutDisabled)
+ this.event.trigger('stepChanged', [step])
+}
+
+StepManager.prototype.remove = function () {
+ // used to stop listenning on event. bad and should be "refactored"
+ this.slider.view = null
+ this.slider = null
+ this.buttonNavigator.view = null
+ this.buttonNavigator = null
+}
+
+StepManager.prototype.render = function () {
+ return yo`
+
+ ${this.slider.render()}
+ ${this.buttonNavigator.render()}
+
`
+}
+
+module.exports = StepManager
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/TxBrowser.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/TxBrowser.js
new file mode 100644
index 0000000000..302ae5ca21
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/TxBrowser.js
@@ -0,0 +1,137 @@
+var EventManager = require('../../../../lib/events')
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .container {
+ display: flex;
+ flex-direction: column;
+ }
+ .txContainer {
+ display: flex;
+ flex-direction: column;
+ }
+ .txinput {
+ width: inherit;
+ font-size: small;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .txbutton {
+ width: inherit;
+ }
+ .txbutton:hover {
+ }
+ .vmargin {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ }
+`
+
+function TxBrowser () {
+ this.event = new EventManager()
+
+ this.state = {
+ txNumber: undefined,
+ debugging: false
+ }
+ this.view
+}
+
+TxBrowser.prototype.submit = function () {
+ if (this.state.debugging) {
+ this.unload()
+ } else {
+ this.event.trigger('requestDebug', [undefined, this.state.txNumber])
+ }
+ yo.update(this.view, this.render())
+}
+
+TxBrowser.prototype.updateTxN = function (ev) {
+ this.state.txNumber = ev.target.value
+ if (this.view) {
+ yo.update(this.view, this.render())
+ }
+}
+
+TxBrowser.prototype.load = function (txHash, tx) {
+ this.state.txNumber = txHash
+}
+
+TxBrowser.prototype.unload = function () {
+ this.event.trigger('unloadRequested')
+}
+
+TxBrowser.prototype.setState = function (state) {
+ this.state = {...this.state, ...state}
+ if (this.view) {
+ yo.update(this.view, this.render())
+ }
+}
+
+TxBrowser.prototype.render = function () {
+ var self = this
+ this.state.txNumberInput = yo`
+
+ `
+ let txButton = yo`
+
+ ${this.state.debugging ? 'Stop' : 'Start'} debugging
+
+ `
+ var view = yo`
+
+
+
+ ${this.state.txNumberInput}
+
+
+ ${txButton}
+
+
+
+
+ `
+ if (this.state.debugging) {
+ view.querySelectorAll('input').forEach(element => { element.setAttribute('disabled', '') })
+ }
+ if (!this.state.txNumber) {
+ view.querySelector("button[id='load']").setAttribute('disabled', '')
+ } else if (!this.state.debugging) {
+ this.state.txNumberInput.removeAttribute('disabled')
+ }
+ if (!this.view) {
+ this.view = view
+ }
+
+ return view
+}
+
+TxBrowser.prototype.txInputChanged = function (event) {
+ // todo check validation of txnumber in the input element, use
+ // required
+ // oninvalid="setCustomValidity('Please provide a valid transaction number, must start with 0x and have length of 22')"
+ // pattern="^0[x,X]+[0-9a-fA-F]{22}"
+ // this.state.txNumberInput.setCustomValidity('')
+
+ this.state.txNumber = event.target.value
+ yo.update(this.view, this.render())
+}
+
+module.exports = TxBrowser
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/VmDebugger.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/VmDebugger.js
new file mode 100644
index 0000000000..3cd34cdba9
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/VmDebugger.js
@@ -0,0 +1,175 @@
+'use strict'
+var yo = require('yo-yo')
+
+var CodeListView = require('./vmDebugger/CodeListView')
+var CalldataPanel = require('./vmDebugger/CalldataPanel')
+var MemoryPanel = require('./vmDebugger/MemoryPanel')
+var CallstackPanel = require('./vmDebugger/CallstackPanel')
+var FunctionPanel = require('./vmDebugger/FunctionPanel')
+var StackPanel = require('./vmDebugger/StackPanel')
+var StoragePanel = require('./vmDebugger/StoragePanel')
+var StepDetail = require('./vmDebugger/StepDetail')
+var SolidityState = require('./vmDebugger/SolidityState')
+var SolidityLocals = require('./vmDebugger/SolidityLocals')
+var FullStoragesChangesPanel = require('./vmDebugger/FullStoragesChanges')
+var DropdownPanel = require('./vmDebugger/DropdownPanel')
+
+function VmDebugger (vmDebuggerLogic) {
+ var self = this
+ this.view
+
+ this.vmDebuggerLogic = vmDebuggerLogic
+
+ this.asmCode = new CodeListView()
+ this.vmDebuggerLogic.event.register('codeManagerChanged', this.asmCode.changed.bind(this.asmCode))
+ this.vmDebuggerLogic.event.register('traceUnloaded', this.asmCode.reset.bind(this.asmCode))
+
+ this.calldataPanel = new CalldataPanel()
+ this.vmDebuggerLogic.event.register('traceManagerCallDataUpdate', this.calldataPanel.update.bind(this.calldataPanel))
+
+ this.memoryPanel = new MemoryPanel()
+ this.vmDebuggerLogic.event.register('traceManagerMemoryUpdate', this.memoryPanel.update.bind(this.memoryPanel))
+
+ this.callstackPanel = new CallstackPanel()
+ this.vmDebuggerLogic.event.register('traceManagerCallStackUpdate', this.callstackPanel.update.bind(this.callstackPanel))
+
+ this.stackPanel = new StackPanel()
+ this.vmDebuggerLogic.event.register('traceManagerStackUpdate', this.stackPanel.update.bind(this.stackPanel))
+
+ this.functionPanel = new FunctionPanel()
+ this.vmDebuggerLogic.event.register('functionsStackUpdate', (stack) => {
+ if (stack === null) return
+ let functions = []
+ for (let func of stack) {
+ functions.push(func.functionDefinition.name + '(' + func.inputs.join(', ') + ')')
+ }
+ this.functionPanel.update(functions)
+ })
+
+ this.storagePanel = new StoragePanel()
+ this.vmDebuggerLogic.event.register('traceManagerStorageUpdate', this.storagePanel.update.bind(this.storagePanel))
+
+ this.stepDetail = new StepDetail()
+ this.vmDebuggerLogic.event.register('traceUnloaded', this.stepDetail.reset.bind(this.stepDetail))
+ this.vmDebuggerLogic.event.register('newTraceLoaded', this.stepDetail.reset.bind(this.stepDetail))
+
+ this.vmDebuggerLogic.event.register('traceCurrentStepUpdate', function (error, step) {
+ self.stepDetail.updateField('execution step', (error ? '-' : step))
+ })
+
+ this.vmDebuggerLogic.event.register('traceMemExpandUpdate', function (error, addmem) {
+ self.stepDetail.updateField('add memory', (error ? '-' : addmem))
+ })
+
+ this.vmDebuggerLogic.event.register('traceStepCostUpdate', function (error, gas) {
+ self.stepDetail.updateField('gas', (error ? '-' : gas))
+ })
+
+ this.vmDebuggerLogic.event.register('traceCurrentCalledAddressAtUpdate', function (error, address) {
+ self.stepDetail.updateField('loaded address', (error ? '-' : address))
+ })
+
+ this.vmDebuggerLogic.event.register('traceRemainingGasUpdate', function (error, remainingGas) {
+ self.stepDetail.updateField('remaining gas', (error ? '-' : remainingGas))
+ })
+
+ this.vmDebuggerLogic.event.register('indexUpdate', function (index) {
+ self.stepDetail.updateField('vm trace step', index)
+ })
+
+ this.solidityState = new SolidityState()
+ this.vmDebuggerLogic.event.register('solidityState', this.solidityState.update.bind(this.solidityState))
+ this.vmDebuggerLogic.event.register('solidityStateMessage', this.solidityState.setMessage.bind(this.solidityState))
+ this.vmDebuggerLogic.event.register('solidityStateUpdating', this.solidityState.setUpdating.bind(this.solidityState))
+
+ this.solidityLocals = new SolidityLocals()
+ this.vmDebuggerLogic.event.register('solidityLocals', this.solidityLocals.update.bind(this.solidityLocals))
+ this.vmDebuggerLogic.event.register('solidityLocalsMessage', this.solidityLocals.setMessage.bind(this.solidityLocals))
+ this.vmDebuggerLogic.event.register('solidityLocalsUpdating', this.solidityLocals.setUpdating.bind(this.solidityLocals))
+
+ this.returnValuesPanel = new DropdownPanel('Return Value', {json: true})
+ this.returnValuesPanel.data = {}
+ this.vmDebuggerLogic.event.register('traceReturnValueUpdate', this.returnValuesPanel.update.bind(this.returnValuesPanel))
+
+ this.fullStoragesChangesPanel = new FullStoragesChangesPanel()
+ this.addresses = []
+
+ this.vmDebuggerLogic.event.register('traceAddressesUpdate', function (_addresses) {
+ self.fullStoragesChangesPanel.update({})
+ })
+
+ this.vmDebuggerLogic.event.register('traceStorageUpdate', this.fullStoragesChangesPanel.update.bind(this.fullStoragesChangesPanel))
+
+ this.vmDebuggerLogic.event.register('newTrace', () => {
+ if (!self.view) return
+
+ self.asmCode.basicPanel.show()
+ self.stackPanel.basicPanel.show()
+ self.functionPanel.basicPanel.show()
+ self.storagePanel.basicPanel.show()
+ self.memoryPanel.basicPanel.show()
+ self.stepDetail.basicPanel.show()
+ self.calldataPanel.basicPanel.show()
+ self.callstackPanel.basicPanel.show()
+ })
+
+ this.vmDebuggerLogic.event.register('newCallTree', () => {
+ if (!self.view) return
+ self.functionPanel.basicPanel.show()
+ self.solidityLocals.basicPanel.show()
+ self.solidityState.basicPanel.show()
+ self.solidityPanel.hidden = false
+ })
+
+ this.vmDebuggerLogic.start()
+}
+
+VmDebugger.prototype.renderHead = function () {
+ this.solidityPanel = yo`
+
+ ${this.functionPanel.render()}
+ ${this.solidityLocals.render()}
+ ${this.solidityState.render()}
+
+ `
+ const headView = yo`
+
+
+ ${this.solidityPanel}
+
${this.asmCode.render()}
+
${this.stepDetail.render()}
+
+
+ `
+ if (!this.headView) {
+ this.headView = headView
+ }
+ return headView
+}
+
+VmDebugger.prototype.remove = function () {
+ // used to stop listenning on event. bad and should be "refactored"
+ this.view = null
+}
+
+VmDebugger.prototype.render = function () {
+ const view = yo`
+
+
+ ${this.stackPanel.render()}
+ ${this.memoryPanel.render()}
+ ${this.storagePanel.render()}
+ ${this.callstackPanel.render()}
+ ${this.calldataPanel.render()}
+ ${this.returnValuesPanel.render()}
+ ${this.fullStoragesChangesPanel.render()}
+
+
+ `
+ if (!this.view) {
+ this.view = view
+ }
+ return view
+}
+
+module.exports = VmDebugger
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/basicStyles.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/basicStyles.js
new file mode 100644
index 0000000000..bd3cb7477a
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/basicStyles.js
@@ -0,0 +1,76 @@
+'use strict'
+module.exports = {
+ truncate: {
+ 'white-space': 'nowrap',
+ 'overflow': 'hidden',
+ 'text-overflow': 'ellipsis',
+ 'margin-right': '5px'
+ },
+ font: {
+ 'font-family': 'arial,sans-serif'
+ },
+ statusMessage: {
+ 'margin-left': '15px'
+ },
+ address: {
+ 'font-style': 'italic'
+ },
+ instructionsList: {
+ 'width': '52%',
+ 'overflow-y': 'scroll',
+ 'max-height': '250px',
+ 'margin': '0',
+ 'margin-left': '10px',
+ 'padding': '2px'
+ },
+ transactionInfo: {
+ 'margin-top': '5px'
+ },
+ panel: {
+ container: {
+ 'border': '1px solid',
+ 'width': '70%'
+ },
+ tableContainer: {
+ 'height': '50%',
+ 'overflow-y': 'auto'
+ },
+ table: {
+ 'padding': '5px'
+ },
+ title: {
+ 'padding': '5px',
+ 'font-style': 'italic'
+ }
+ },
+ hidden: {
+ 'display': 'none'
+ },
+ display: {
+ 'display': 'block'
+ },
+ inline: {
+ 'display': 'inline-block'
+ },
+ vmargin: {
+ 'margin-top': '10px',
+ 'margin-bottom': '10px'
+ },
+ button: {
+ 'border-color': 'transparent',
+ 'border-radius': '3px',
+ 'border': '.3px solid hsla(0, 0%, 40%, 1)',
+ 'cursor': 'pointer',
+ 'min-height': '25px',
+ 'max-height': '25px',
+ 'padding': '3px',
+ 'min-width': '100px',
+ 'font-size': '12px',
+ 'overflow': 'hidden',
+ 'word-break': 'normal',
+ 'background-color': 'hsla(0, 0%, 40%, .2)',
+ 'color': 'hsla(0, 0%, 40%, 1)',
+ 'margin': '3px',
+ 'text-decoration': 'none'
+ }
+}
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/dropdownPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/dropdownPanel.js
new file mode 100644
index 0000000000..bb9a1e7f2b
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/dropdownPanel.js
@@ -0,0 +1,31 @@
+'use strict'
+module.exports = {
+ title: {
+ 'border': '1px solid #dadada',
+ 'background-color': 'white',
+ 'width': '100%',
+ 'color': '#363f47',
+ 'margin-top': '5px',
+ 'cursor': 'pointer'
+ },
+ titleInner: {
+ 'display': 'inline-block'
+ },
+ content: {
+ 'color': '#111111',
+ 'width': '100%',
+ 'min-height': '20px'
+ },
+ inner: {
+ 'padding': '2px',
+ 'word-break': 'break-all'
+ },
+ copyBtn: {
+ 'float': 'right',
+ 'margin-top': '3px'
+ },
+ caret: {
+ 'margin-left': '10px',
+ 'margin-right': '10px'
+ }
+}
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/sliderStyles.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/sliderStyles.js
new file mode 100644
index 0000000000..45912b6380
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/sliderStyles.js
@@ -0,0 +1,6 @@
+'use strict'
+module.exports = {
+ rule: {
+ 'width': '100%'
+ }
+}
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/treeView.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/treeView.js
new file mode 100644
index 0000000000..b50bacd24f
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/styles/treeView.js
@@ -0,0 +1,30 @@
+'use strict'
+module.exports = {
+ cssUl: {
+ 'list-style-type': 'none',
+ '-webkit-margin-before': '0px',
+ '-webkit-margin-after': '0px',
+ '-webkit-margin-start': '0px',
+ '-webkit-margin-end': '0px',
+ '-webkit-padding-start': '0px'
+ },
+ cssLi: {
+ 'list-style-type': 'none',
+ '-webkit-margin-before': '0px',
+ '-webkit-margin-after': '0px',
+ '-webkit-margin-start': '0px',
+ '-webkit-margin-end': '0px',
+ '-webkit-padding-start': '0px',
+ 'margin-left': '10px'
+ },
+ label: {
+ 'vertical-align': 'top',
+ 'font-family': 'arial,sans-serif'
+ },
+ caret: {
+ 'margin-top': '3px',
+ 'width': '10px'
+ },
+ data: {
+ }
+}
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CalldataPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CalldataPanel.js
new file mode 100644
index 0000000000..07c9f88cdc
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CalldataPanel.js
@@ -0,0 +1,17 @@
+'use strict'
+var DropdownPanel = require('./DropdownPanel')
+var yo = require('yo-yo')
+
+function CalldataPanel () {
+ this.basicPanel = new DropdownPanel('Call Data', {json: true})
+}
+
+CalldataPanel.prototype.update = function (calldata) {
+ this.basicPanel.update(calldata)
+}
+
+CalldataPanel.prototype.render = function () {
+ return yo`${this.basicPanel.render()}
`
+}
+
+module.exports = CalldataPanel
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CallstackPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CallstackPanel.js
new file mode 100644
index 0000000000..ab22c41c4d
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CallstackPanel.js
@@ -0,0 +1,18 @@
+'use strict'
+var DropdownPanel = require('./DropdownPanel')
+var yo = require('yo-yo')
+
+function CallstackPanel () {
+ this.basicPanel = new DropdownPanel('Call Stack', {json: true})
+}
+
+CallstackPanel.prototype.update = function (calldata) {
+ this.basicPanel.update(calldata)
+}
+
+CallstackPanel.prototype.render = function () {
+ return yo`${this.basicPanel.render()}
`
+}
+
+module.exports = CallstackPanel
+
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CodeListView.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CodeListView.js
new file mode 100644
index 0000000000..83f09eff0b
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/CodeListView.js
@@ -0,0 +1,75 @@
+'use strict'
+var style = require('../styles/basicStyles')
+var yo = require('yo-yo')
+var DropdownPanel = require('./DropdownPanel')
+var EventManager = require('../../../../../lib/events')
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .instructions {
+ overflow-y: scroll;
+ max-height: 130px;
+ }
+`
+function CodeListView () {
+ this.event = new EventManager()
+ this.code
+ this.address
+ this.itemSelected
+ this.basicPanel = new DropdownPanel('Instructions', {json: false, displayContentOnly: true})
+ this.basicPanel.event.register('hide', () => {
+ this.event.trigger('hide', [])
+ })
+ this.basicPanel.event.register('show', () => {
+ this.event.trigger('show', [])
+ })
+}
+
+CodeListView.prototype.render = function () {
+ this.view = yo`${this.basicPanel.render({height: style.instructionsList.height})}
`
+ return this.view
+}
+
+CodeListView.prototype.indexChanged = function (index) {
+ if (index < 0) return
+ if (this.itemSelected) {
+ this.itemSelected.removeAttribute('selected')
+ this.itemSelected.removeAttribute('style')
+ if (this.itemSelected.firstChild) {
+ this.itemSelected.firstChild.removeAttribute('style')
+ }
+ }
+ let codeView = this.view.querySelector('#asmitems')
+ this.itemSelected = codeView.children[index]
+ this.itemSelected.style.setProperty('border-color', 'var(--primary)')
+ this.itemSelected.style.setProperty('border-style', 'solid')
+ this.itemSelected.setAttribute('selected', 'selected')
+ codeView.scrollTop = this.itemSelected.offsetTop - parseInt(codeView.offsetTop)
+}
+
+CodeListView.prototype.reset = function () {
+ this.changed([], '', -1)
+}
+
+CodeListView.prototype.changed = function (code, address, index) {
+ if (this.address === address) {
+ return this.indexChanged(index)
+ }
+ this.code = code
+ this.address = address
+ this.basicPanel.setContent(this.renderAssemblyItems())
+ this.indexChanged(index)
+}
+
+CodeListView.prototype.renderAssemblyItems = function () {
+ if (this.code) {
+ var codeView = this.code.map(function (item, i) {
+ return yo`${item}
`
+ })
+ return yo`
+ ${codeView}
+
`
+ }
+}
+
+module.exports = CodeListView
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/DropdownPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/DropdownPanel.js
new file mode 100644
index 0000000000..050a55872f
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/DropdownPanel.js
@@ -0,0 +1,189 @@
+'use strict'
+const yo = require('yo-yo')
+const copyToClipboard = require('../../../../ui/copy-to-clipboard')
+const EventManager = require('../../../../../lib/events')
+const TreeView = require('../../../../ui/TreeView') // TODO setup a direct reference to the UI components
+
+const csjs = require('csjs-inject')
+
+const css = csjs`
+ .title {
+ display: flex;
+ align-items: center;
+ }
+ .name {
+ font-weight: bold;
+ }
+ .nameDetail {
+ font-weight: bold;
+ margin-left: 3px;
+ }
+ .icon {
+ margin-right: 5%;
+ }
+ .eyeButton {
+ margin: 3px;
+ }
+ .dropdownpanel {
+ width: 100%;
+ word-break: break-word;
+ }
+ .dropdownrawcontent {
+ padding: 2px;
+ word-break: break-word;
+ }
+ .message {
+ padding: 2px;
+ word-break: break-word;
+ }
+ .refresh {
+ display: none;
+ margin-left: 4px;
+ margin-top: 4px;
+ animation: spin 2s linear infinite;
+ }
+`
+
+function DropdownPanel (_name, _opts) {
+ this.event = new EventManager()
+ if (!_opts) {
+ _opts = {}
+ }
+ this.name = _name
+ this.header = ''
+ this.json = _opts.json
+ this.displayContentOnly = _opts.displayContentOnly
+ if (this.json) {
+ this.treeView = new TreeView(_opts)
+ }
+ this.view
+}
+
+DropdownPanel.prototype.setMessage = function (message) {
+ if (!this.view) return
+ this.view.querySelector('.dropdownpanel .dropdownrawcontent').style.display = 'none'
+ this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'none'
+ this.view.querySelector('.dropdownpanel > i').style.display = 'none'
+ this.message(message)
+}
+
+DropdownPanel.prototype.setLoading = function () {
+ if (!this.view) return
+ this.view.querySelector('.dropdownpanel .dropdownrawcontent').style.display = 'none'
+ this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'none'
+ this.view.querySelector('.dropdownpanel > i').style.display = 'inline-block'
+ this.message('')
+}
+
+DropdownPanel.prototype.setUpdating = function () {
+ if (!this.view) return
+}
+
+DropdownPanel.prototype.update = function (_data, _header) {
+ if (!this.view) return
+ this.view.querySelector('.dropdownpanel > i').style.display = 'none'
+ this.view.querySelector('.dropdownpanel .dropdowncontent').style.display = 'block'
+ this.view.querySelector('.dropdownpanel .dropdownrawcontent').innerText = JSON.stringify(_data, null, '\t')
+ if (!this.displayContentOnly) {
+ this.view.querySelector('.title i.fa-copy').style.display = 'block'
+ this.view.querySelector('.title span').innerText = _header || ' '
+ }
+ this.message('')
+ if (this.json) {
+ this.treeView.update(_data)
+ }
+}
+
+DropdownPanel.prototype.setContent = function (node) {
+ if (!this.view) return
+ yo.update(this.view, this.render(null, node))
+}
+
+DropdownPanel.prototype.copyClipboard = function () {
+ const content = this.view.querySelector('.dropdownpanel .dropdownrawcontent')
+ return content.innerText ? content.innerText : content.textContent
+}
+
+DropdownPanel.prototype.render = function (overridestyle, node) {
+ var content = yo`Empty
`
+ if (this.json) {
+ content = this.treeView.render({})
+ }
+ overridestyle === undefined ? {} : overridestyle
+ var self = this
+ var contentNode = yo`
+
+
+
${node || content}
+
+
+
`
+ var title = !self.displayContentOnly ? yo`
+
+
${this.name}
+ ${copyToClipboard(() => this.copyClipboard())}
+
` : yo`
`
+
+ var view = yo`
+
+
+ ${title}
+ ${contentNode}
+
`
+ if (!this.view) {
+ this.view = view
+ }
+ if (self.displayContentOnly) contentNode.style.display = 'block'
+ return view
+}
+
+DropdownPanel.prototype.toggle = function () {
+ var el = this.view.querySelector('.dropdownpanel')
+ var caret = this.view.querySelector('.title').firstElementChild
+ if (el.style.display === '') {
+ el.style.display = 'none'
+ caret.className = `${css.icon} fas fa-caret-right`
+ this.event.trigger('hide', [])
+ } else {
+ el.style.display = ''
+ caret.className = `${css.icon} fas fa-caret-down`
+ this.event.trigger('show', [])
+ }
+}
+
+DropdownPanel.prototype.hide = function () {
+ if (!(this.view && !this.displayContentOnly)) return
+ var caret = this.view.querySelector('.title').firstElementChild
+ var el = this.view.querySelector('.dropdownpanel')
+ el.style.display = 'none'
+ caret.className = `${css.icon} fas fa-caret-right`
+ this.event.trigger('hide', [])
+}
+
+DropdownPanel.prototype.show = function () {
+ if (!(this.view && !this.displayContentOnly)) return
+ var caret = this.view.querySelector('.title').firstElementChild
+ var el = this.view.querySelector('.dropdownpanel')
+ el.style.display = ''
+ caret.className = `${css.icon} fas fa-caret-down`
+ this.event.trigger('show', [])
+}
+
+DropdownPanel.prototype.message = function (message) {
+ if (!this.view) return
+ var mes = this.view.querySelector('.dropdownpanel .message')
+ mes.innerText = message
+ mes.style.display = (message === '') ? 'none' : 'block'
+}
+
+module.exports = DropdownPanel
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/FullStoragesChanges.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/FullStoragesChanges.js
new file mode 100644
index 0000000000..32c1cc15b7
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/FullStoragesChanges.js
@@ -0,0 +1,21 @@
+var DropdownPanel = require('./DropdownPanel')
+var yo = require('yo-yo')
+
+function FullStoragesChanges () {
+ this.view
+ this.basicPanel = new DropdownPanel('Full Storages Changes', {json: true})
+}
+
+FullStoragesChanges.prototype.update = function (storageData) {
+ this.basicPanel.update(storageData)
+}
+
+FullStoragesChanges.prototype.render = function () {
+ var view = yo`${this.basicPanel.render()}
`
+ if (!this.view) {
+ this.view = view
+ }
+ return view
+}
+
+module.exports = FullStoragesChanges
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/FunctionPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/FunctionPanel.js
new file mode 100644
index 0000000000..6c9a94118d
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/FunctionPanel.js
@@ -0,0 +1,17 @@
+'use strict'
+var DropdownPanel = require('./DropdownPanel')
+var yo = require('yo-yo')
+
+function FunctionPanel () {
+ this.basicPanel = new DropdownPanel('Function Stack', {json: true, displayContentOnly: false})
+}
+
+FunctionPanel.prototype.update = function (calldata) {
+ this.basicPanel.update(calldata)
+}
+
+FunctionPanel.prototype.render = function () {
+ return yo`${this.basicPanel.render()}
`
+}
+
+module.exports = FunctionPanel
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/MemoryPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/MemoryPanel.js
new file mode 100644
index 0000000000..d4ed48dd80
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/MemoryPanel.js
@@ -0,0 +1,21 @@
+'use strict'
+var DropdownPanel = require('./DropdownPanel')
+var yo = require('yo-yo')
+
+function MemoryPanel () {
+ this.basicPanel = new DropdownPanel('Memory', {
+ json: true,
+ css: {
+ 'font-family': 'monospace'
+ }})
+}
+
+MemoryPanel.prototype.update = function (calldata) {
+ this.basicPanel.update(calldata)
+}
+
+MemoryPanel.prototype.render = function () {
+ return yo`${this.basicPanel.render()}
`
+}
+
+module.exports = MemoryPanel
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/SolidityLocals.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/SolidityLocals.js
new file mode 100644
index 0000000000..592b2ef060
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/SolidityLocals.js
@@ -0,0 +1,37 @@
+'use strict'
+var EventManager = require('../../../../../lib/events')
+var DropdownPanel = require('./DropdownPanel')
+var solidityTypeFormatter = require('./utils/SolidityTypeFormatter')
+var yo = require('yo-yo')
+
+class SolidityLocals {
+
+ constructor (_parent, _traceManager, _internalTreeCall) {
+ this.event = new EventManager()
+ this.basicPanel = new DropdownPanel('Solidity Locals', {
+ json: true,
+ formatSelf: solidityTypeFormatter.formatSelf,
+ extractData: solidityTypeFormatter.extractData
+ })
+ this.view
+ }
+
+ update (data) {
+ this.basicPanel.update(data)
+ }
+
+ setMessage (message) {
+ this.basicPanel.setMessage(message)
+ }
+
+ setUpdating () {
+ this.basicPanel.setUpdating()
+ }
+
+ render () {
+ this.view = yo`${this.basicPanel.render()}
`
+ return this.view
+ }
+}
+
+module.exports = SolidityLocals
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/SolidityState.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/SolidityState.js
new file mode 100644
index 0000000000..cd7363045b
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/SolidityState.js
@@ -0,0 +1,36 @@
+var DropdownPanel = require('./DropdownPanel')
+var solidityTypeFormatter = require('./utils/SolidityTypeFormatter')
+var yo = require('yo-yo')
+
+function SolidityState () {
+ this.basicPanel = new DropdownPanel('Solidity State', {
+ json: true,
+ // TODO: used by TreeView ui
+ formatSelf: solidityTypeFormatter.formatSelf,
+ extractData: solidityTypeFormatter.extractData
+ })
+ this.view
+}
+
+SolidityState.prototype.update = function (data) {
+ this.basicPanel.update(data)
+}
+
+SolidityState.prototype.setMessage = function (message) {
+ this.basicPanel.setMessage(message)
+}
+
+SolidityState.prototype.setUpdating = function () {
+ this.basicPanel.setUpdating()
+}
+
+SolidityState.prototype.render = function () {
+ if (this.view) return
+ this.view = yo`
+
+ ${this.basicPanel.render()}
+
`
+ return this.view
+}
+
+module.exports = SolidityState
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StackPanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StackPanel.js
new file mode 100644
index 0000000000..a29cdb7661
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StackPanel.js
@@ -0,0 +1,17 @@
+'use strict'
+var DropdownPanel = require('./DropdownPanel')
+var yo = require('yo-yo')
+
+function StackPanel () {
+ this.basicPanel = new DropdownPanel('Stack', {json: true, displayContentOnly: false})
+}
+
+StackPanel.prototype.update = function (calldata) {
+ this.basicPanel.update(calldata)
+}
+
+StackPanel.prototype.render = function () {
+ return yo`${this.basicPanel.render()}
`
+}
+
+module.exports = StackPanel
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StepDetail.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StepDetail.js
new file mode 100644
index 0000000000..de8765b190
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StepDetail.js
@@ -0,0 +1,23 @@
+var yo = require('yo-yo')
+var DropdownPanel = require('./DropdownPanel')
+
+function StepDetail () {
+ this.basicPanel = new DropdownPanel('Step details', {json: true, displayContentOnly: false})
+ this.detail = { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' }
+}
+
+StepDetail.prototype.reset = function () {
+ this.detail = { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' }
+ this.basicPanel.update(this.detail)
+}
+
+StepDetail.prototype.updateField = function (key, value) {
+ this.detail[key] = value
+ this.basicPanel.update(this.detail)
+}
+
+StepDetail.prototype.render = function () {
+ return yo`${this.basicPanel.render()}
`
+}
+
+module.exports = StepDetail
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StoragePanel.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StoragePanel.js
new file mode 100644
index 0000000000..c48ce2da01
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/StoragePanel.js
@@ -0,0 +1,17 @@
+'use strict'
+var DropdownPanel = require('./DropdownPanel')
+var yo = require('yo-yo')
+
+function StoragePanel (_parent, _traceManager) {
+ this.basicPanel = new DropdownPanel('Storage', {json: true})
+}
+
+StoragePanel.prototype.update = function (storage, header) {
+ this.basicPanel.update(storage, header)
+}
+
+StoragePanel.prototype.render = function () {
+ return yo`${this.basicPanel.render()}
`
+}
+
+module.exports = StoragePanel
diff --git a/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/utils/SolidityTypeFormatter.js b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/utils/SolidityTypeFormatter.js
new file mode 100644
index 0000000000..025f78bb18
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/utils/SolidityTypeFormatter.js
@@ -0,0 +1,75 @@
+var yo = require('yo-yo')
+var BN = require('ethereumjs-util').BN
+
+module.exports = {
+ formatSelf: formatSelf,
+ extractData: extractData
+}
+
+function formatSelf (key, data) {
+ const style = fontColor(data)
+ const keyStyle = data.isProperty ? 'color: var(--info)' : ''
+ if (data.type === 'string') {
+ data.self = JSON.stringify(data.self)
+ }
+ return yo ` ${' ' + key}:${' ' + data.self} ${data.isProperty || !data.type ? '' : ' ' + data.type} `
+}
+
+function extractData (item, parent, key) {
+ var ret = {}
+ if (item.isProperty) {
+ return item
+ }
+ if (item.type.lastIndexOf(']') === item.type.length - 1) {
+ ret.children = (item.value || []).map(function (item, index) {
+ return {key: index, value: item}
+ })
+ ret.children.unshift({
+ key: 'length',
+ value: {
+ self: (new BN(item.length.replace('0x', ''), 16)).toString(10),
+ type: 'uint',
+ isProperty: true
+ }
+ })
+ ret.isArray = true
+ ret.self = parent.isArray ? '' : item.type
+ } else if (item.type.indexOf('struct') === 0) {
+ ret.children = Object.keys((item.value || {})).map(function (key) {
+ return {key: key, value: item.value[key]}
+ })
+ ret.self = item.type
+ ret.isStruct = true
+ } else if (item.type.indexOf('mapping') === 0) {
+ ret.children = Object.keys((item.value || {})).map(function (key) {
+ return {key: key, value: item.value[key]}
+ })
+ ret.isMapping = true
+ ret.self = item.type
+ } else {
+ ret.children = null
+ ret.self = item.value
+ ret.type = item.type
+ }
+ return ret
+}
+
+function fontColor (data) {
+ let color = 'var(--primary)'
+ if (data.isArray || data.isStruct || data.isMapping) {
+ color = 'var(--info)'
+ } else if (
+ data.type.indexOf('uint') === 0 ||
+ data.type.indexOf('int') === 0 ||
+ data.type.indexOf('bool') === 0 ||
+ data.type.indexOf('enum') === 0
+ ) {
+ color = 'var(--green)'
+ } else if (data.type === 'string') {
+ color = 'var(--teal)'
+ } else if (data.self == 0x0) { // eslint-disable-line
+ color = 'var(--gray)'
+ }
+ return 'color:' + color
+}
+
diff --git a/apps/remix-ide/src/app/tabs/network-module.js b/apps/remix-ide/src/app/tabs/network-module.js
new file mode 100644
index 0000000000..fdae172c15
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/network-module.js
@@ -0,0 +1,72 @@
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+import { Web3 } from 'web3'
+
+export const profile = {
+ name: 'network',
+ description: 'Manage the network (mainnet, ropsten, goerli...) and the provider (web3, vm, injected)',
+ methods: ['getNetworkProvider', 'getEndpoint', 'detectNetwork', 'addNetwork', 'removeNetwork'],
+ version: packageJson.version,
+ kind: 'network'
+}
+
+// Network API has :
+// - events: ['providerChanged']
+// - methods: ['getNetworkProvider', 'getEndpoint', 'detectNetwork', 'addNetwork', 'removeNetwork']
+
+export class NetworkModule extends Plugin {
+ constructor (blockchain) {
+ super(profile)
+ this.blockchain = blockchain
+ // TODO: See with remix-lib to make sementic coherent
+ this.blockchain.event.register('contextChanged', (provider) => {
+ this.emit('providerChanged', provider)
+ })
+ /*
+ // Events that could be implemented later
+ executionContext.event.register('removeProvider', (provider) => {
+ this.events.emit('networkRemoved', provider)
+ })
+ executionContext.event.register('addProvider', (provider) => {
+ this.events.emit('networkAdded', provider)
+ })
+ executionContext.event.register('web3EndpointChanged', (provider) => {
+ this.events.emit('web3EndpointChanged', provider)
+ })
+ */
+ }
+
+ /** Return the current network provider (web3, vm, injected) */
+ getNetworkProvider () {
+ return this.blockchain.getProvider()
+ }
+
+ /** Return the current network */
+ detectNetwork () {
+ return new Promise((resolve, reject) => {
+ this.blockchain.detectNetwork((error, network) => {
+ error ? reject(error) : resolve(network)
+ })
+ })
+ }
+
+ /** Return the url only if network provider is 'web3' */
+ getEndpoint () {
+ const provider = this.blockchain.getProvider()
+ if (provider !== 'web3') {
+ throw new Error('no endpoint: current provider is either injected or vm')
+ }
+ return this.blockchain.web3().currentProvider.host
+ }
+
+ /** Add a custom network to the list of available networks */
+ addNetwork (network) { // { name, url }
+ const provider = network.url === 'ipc' ? new Web3.providers.IpcProvider() : new Web3.providers.HttpProvider(network.url)
+ this.blockchain.addProvider({ name: network.name, provider })
+ }
+
+ /** Remove a network to the list of availble networks */
+ removeNetwork (name) {
+ this.blockchain.removeProvider(name)
+ }
+}
diff --git a/apps/remix-ide/src/app/tabs/plugin-tab.js b/apps/remix-ide/src/app/tabs/plugin-tab.js
new file mode 100644
index 0000000000..a92f92939f
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/plugin-tab.js
@@ -0,0 +1,24 @@
+var yo = require('yo-yo')
+var css = require('./styles/plugin-tab-styles')
+
+class PluginTab {
+
+ constructor (json) {
+ this.el = null
+ this.data = { json }
+ }
+
+ render () {
+ if (this.el) return this.el
+
+ this.el = yo`
+
+
+
`
+
+ return this.el
+ }
+
+}
+
+module.exports = PluginTab
diff --git a/apps/remix-ide/src/app/tabs/runTab/contractDropdown.js b/apps/remix-ide/src/app/tabs/runTab/contractDropdown.js
new file mode 100644
index 0000000000..76ee2343cf
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/runTab/contractDropdown.js
@@ -0,0 +1,341 @@
+var yo = require('yo-yo')
+var css = require('../styles/run-tab-styles')
+var modalDialogCustom = require('../../ui/modal-dialog-custom')
+var remixLib = require('@remix-project/remix-lib')
+var EventManager = remixLib.EventManager
+var confirmDialog = require('../../ui/confirmDialog')
+var modalDialog = require('../../ui/modaldialog')
+var MultiParamManager = require('../../ui/multiParamManager')
+
+import publishToStorage from '../../../publishToStorage'
+
+class ContractDropdownUI {
+ constructor (blockchain, dropdownLogic, logCallback, runView) {
+ this.blockchain = blockchain
+ this.dropdownLogic = dropdownLogic
+ this.logCallback = logCallback
+ this.runView = runView
+ this.event = new EventManager()
+
+ this.listenToEvents()
+ this.ipfsCheckedState = false
+ this.exEnvironment = blockchain.getProvider()
+ this.listenToContextChange()
+ }
+
+ listenToEvents () {
+ this.dropdownLogic.event.register('newlyCompiled', (success, data, source, compiler, compilerFullName, file) => {
+ if (!document.querySelector(`.${css.contractNames.classNames[0]}`)) return
+ var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
+ contractNames.innerHTML = ''
+ if (success) {
+ this.selectContractNames.removeAttribute('disabled')
+ this.dropdownLogic.getCompiledContracts(compiler, compilerFullName).forEach((contract) => {
+ contractNames.appendChild(yo`${contract.name} - ${file} `)
+ })
+ } else {
+ this.selectContractNames.setAttribute('disabled', true)
+ }
+ this.setInputParamsPlaceHolder()
+
+ if (success) {
+ this.compFails.style.display = 'none'
+ } else {
+ this.compFails.style.display = 'block'
+ }
+ })
+ }
+
+ listenToContextChange () {
+ this.blockchain.event.register('contextChanged', () => {
+ this.blockchain.updateNetwork((err, {name} = {}) => {
+ if (err) {
+ console.log(`can't detect network`)
+ return
+ }
+ this.exEnvironment = this.blockchain.getProvider()
+ this.networkName = name
+
+ const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`)
+
+ // check if an already selected option exist else use default workflow
+ if (savedConfig !== null) {
+ this.setCheckedState(savedConfig)
+ } else {
+ this.setCheckedState(this.networkName === 'Main')
+ }
+ })
+ })
+ }
+
+ setCheckedState (value) {
+ value = value === 'true' ? true : value === 'false' ? false : value
+ this.ipfsCheckedState = value
+ if (this.ipfsCheckbox) this.ipfsCheckbox.checked = value
+ }
+
+ toggleCheckedState () {
+ if (this.exEnvironment === 'vm') this.networkName = 'VM'
+ this.ipfsCheckedState = !this.ipfsCheckedState
+ window.localStorage.setItem(`ipfs/${this.exEnvironment}/${this.networkName}`, this.ipfsCheckedState)
+ }
+
+ render () {
+ this.compFails = yo` `
+ var info = yo` `
+ this.atAddress = yo`At Address `
+ this.atAddressButtonInput = yo` `
+ this.selectContractNames = yo` `
+
+ if (this.exEnvironment === 'vm') this.networkName = 'VM'
+
+ const savedConfig = window.localStorage.getItem(`ipfs/${this.exEnvironment}/${this.networkName}`)
+ this.ipfsCheckedState = savedConfig === 'true' ? true : false // eslint-disable-line
+
+ this.ipfsCheckbox = yo`
+ this.toggleCheckedState()}
+ >
+ `
+ if (this.ipfsCheckedState) this.ipfsCheckbox.checked = true
+
+ this.deployCheckBox = yo`
+
+ ${this.ipfsCheckbox}
+
+ Publish to IPFS
+
+
+ `
+ this.createPanel = yo`
`
+ this.orLabel = yo`or
`
+
+ let el = yo`
+
+
Contract
+
+ ${this.selectContractNames} ${this.compFails} ${info}
+
+
+ ${this.createPanel}
+ ${this.orLabel}
+
+ ${this.atAddress}
+ ${this.atAddressButtonInput}
+
+
+
+ `
+ this.selectContractNames.addEventListener('change', this.setInputParamsPlaceHolder.bind(this))
+ this.setInputParamsPlaceHolder()
+ if (!this.el) {
+ this.el = el
+ }
+ return el
+ }
+
+ atAddressChanged (event) {
+ if (!this.atAddressButtonInput.value) {
+ this.atAddress.setAttribute('disabled', 'true')
+ } else {
+ this.atAddress.removeAttribute('disabled')
+ }
+ }
+
+ changeCurrentFile (currentFile) {
+ if (!document.querySelector(`.${css.contractNames}`)) return
+ var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
+ if (/.(.abi)$/.exec(currentFile)) {
+ this.createPanel.style.display = 'none'
+ this.orLabel.style.display = 'none'
+ this.compFails.style.display = 'none'
+ contractNames.appendChild(yo`(abi) `)
+ this.selectContractNames.setAttribute('disabled', true)
+ } else if (/.(.sol)$/.exec(currentFile)) {
+ this.createPanel.style.display = 'block'
+ this.orLabel.style.display = 'block'
+ }
+ }
+
+ setInputParamsPlaceHolder () {
+ this.createPanel.innerHTML = ''
+ if (this.selectContractNames.selectedIndex < 0 || this.selectContractNames.children.length <= 0) {
+ this.createPanel.innerHTML = 'No compiled contracts'
+ return
+ }
+
+ const selectedContract = this.getSelectedContract()
+ const clickCallback = async (valArray, inputsValues) => {
+ var selectedContract = this.getSelectedContract()
+ this.createInstance(selectedContract, inputsValues)
+ }
+ const createConstructorInstance = new MultiParamManager(
+ 0,
+ selectedContract.getConstructorInterface(),
+ clickCallback,
+ selectedContract.getConstructorInputs(),
+ 'Deploy',
+ selectedContract.bytecodeObject,
+ true
+ )
+ this.createPanel.appendChild(createConstructorInstance.render())
+ this.createPanel.appendChild(this.deployCheckBox)
+ }
+
+ getSelectedContract () {
+ var contract = this.selectContractNames.children[this.selectContractNames.selectedIndex]
+ var contractName = contract.getAttribute('value')
+ var compilerAtributeName = contract.getAttribute('compiler')
+
+ return this.dropdownLogic.getSelectedContract(contractName, compilerAtributeName)
+ }
+
+ async createInstance (selectedContract, args) {
+ if (selectedContract.bytecodeObject.length === 0) {
+ return modalDialogCustom.alert('This contract may be abstract, not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.')
+ }
+
+ var continueCb = (error, continueTxExecution, cancelCb) => {
+ if (error) {
+ var msg = typeof error !== 'string' ? error.message : error
+ modalDialog('Gas estimation failed', yo`Gas estimation errored with the following message (see below).
+ The transaction execution will likely fail. Do you want to force sending?
+ ${msg}
+
`,
+ {
+ label: 'Send Transaction',
+ fn: () => {
+ continueTxExecution()
+ }}, {
+ label: 'Cancel Transaction',
+ fn: () => {
+ cancelCb()
+ }
+ })
+ } else {
+ continueTxExecution()
+ }
+ }
+
+ var promptCb = (okCb, cancelCb) => {
+ modalDialogCustom.promptPassphrase('Passphrase requested', 'Personal mode is enabled. Please provide passphrase of account', '', okCb, cancelCb)
+ }
+
+ var statusCb = (msg) => {
+ return this.logCallback(msg)
+ }
+
+ var finalCb = (error, contractObject, address) => {
+ this.event.trigger('clearInstance')
+
+ if (error) {
+ return this.logCallback(error)
+ }
+
+ this.event.trigger('newContractInstanceAdded', [contractObject, address, contractObject.name])
+ if (this.ipfsCheckedState) {
+ publishToStorage('ipfs', this.runView.fileProvider, this.runView.fileManager, selectedContract)
+ }
+ }
+
+ let contractMetadata
+ try {
+ contractMetadata = await this.runView.call('compilerMetadata', 'deployMetadataOf', selectedContract.name, selectedContract.contract.file)
+ } catch (error) {
+ return statusCb(`creation of ${selectedContract.name} errored: ` + (error.message ? error.message : error))
+ }
+
+ const compilerContracts = this.dropdownLogic.getCompilerContracts()
+ const confirmationCb = this.getConfirmationCb(modalDialog, confirmDialog)
+
+ if (selectedContract.isOverSizeLimit()) {
+ return modalDialog('Contract code size over limit', yo`Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails.
+ More info:
eip-170
+
`,
+ {
+ label: 'Force Send',
+ fn: () => {
+ this.deployContract(selectedContract, args, contractMetadata, compilerContracts, {continueCb, promptCb, statusCb, finalCb}, confirmationCb)
+ }}, {
+ label: 'Cancel',
+ fn: () => {
+ this.logCallback(`creation of ${selectedContract.name} canceled by user.`)
+ }
+ })
+ }
+ this.deployContract(selectedContract, args, contractMetadata, compilerContracts, {continueCb, promptCb, statusCb, finalCb}, confirmationCb)
+ }
+
+ deployContract (selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) {
+ const { statusCb } = callbacks
+ if (!contractMetadata || (contractMetadata && contractMetadata.autoDeployLib)) {
+ return this.blockchain.deployContractAndLibraries(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb)
+ }
+ if (Object.keys(selectedContract.bytecodeLinkReferences).length) statusCb(`linking ${JSON.stringify(selectedContract.bytecodeLinkReferences, null, '\t')} using ${JSON.stringify(contractMetadata.linkReferences, null, '\t')}`)
+ this.blockchain.deployContractWithLibrary(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb)
+ }
+
+ getConfirmationCb (modalDialog, confirmDialog) {
+ // this code is the same as in recorder.js. TODO need to be refactored out
+ const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => {
+ if (network.name !== 'Main') {
+ return continueTxExecution(null)
+ }
+ const amount = this.blockchain.fromWei(tx.value, true, 'ether')
+ const content = confirmDialog(tx, amount, gasEstimation, null, this.blockchain.determineGasFees(tx), this.blockchain.determineGasPrice.bind(this.blockchain))
+
+ modalDialog('Confirm transaction', content,
+ { label: 'Confirm',
+ fn: () => {
+ this.blockchain.config.setUnpersistedProperty('doNotShowTransactionConfirmationAgain', content.querySelector('input#confirmsetting').checked)
+ // TODO: check if this is check is still valid given the refactor
+ if (!content.gasPriceStatus) {
+ cancelCb('Given gas price is not correct')
+ } else {
+ var gasPrice = this.blockchain.toWei(content.querySelector('#gasprice').value, 'gwei')
+ continueTxExecution(gasPrice)
+ }
+ }}, {
+ label: 'Cancel',
+ fn: () => {
+ return cancelCb('Transaction canceled by user.')
+ }
+ }
+ )
+ }
+
+ return confirmationCb
+ }
+
+ loadFromAddress () {
+ this.event.trigger('clearInstance')
+
+ var address = this.atAddressButtonInput.value
+ this.dropdownLogic.loadContractFromAddress(address,
+ (cb) => {
+ modalDialogCustom.confirm(null, 'Do you really want to interact with ' + address + ' using the current ABI definition?', cb)
+ },
+ (error, loadType, abi) => {
+ if (error) {
+ return modalDialogCustom.alert(error)
+ }
+ if (loadType === 'abi') {
+ return this.event.trigger('newContractABIAdded', [abi, address])
+ }
+ var selectedContract = this.getSelectedContract()
+ this.event.trigger('newContractInstanceAdded', [selectedContract.object, address, this.selectContractNames.value])
+ }
+ )
+ }
+}
+
+module.exports = ContractDropdownUI
diff --git a/apps/remix-ide/src/app/tabs/runTab/model/dropdownlogic.js b/apps/remix-ide/src/app/tabs/runTab/model/dropdownlogic.js
new file mode 100644
index 0000000000..a5a22c2ae2
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/runTab/model/dropdownlogic.js
@@ -0,0 +1,110 @@
+var ethJSUtil = require('ethereumjs-util')
+var remixLib = require('@remix-project/remix-lib')
+var txHelper = remixLib.execution.txHelper
+var CompilerAbstract = require('../../../compiler/compiler-abstract')
+var EventManager = remixLib.EventManager
+
+class DropdownLogic {
+ constructor (compilersArtefacts, config, editor, runView) {
+ this.compilersArtefacts = compilersArtefacts
+ this.config = config
+ this.editor = editor
+ this.runView = runView
+
+ this.event = new EventManager()
+
+ this.listenToCompilationEvents()
+ }
+
+ // TODO: can be moved up; the event in contractDropdown will have to refactored a method instead
+ listenToCompilationEvents () {
+ let broadcastCompilationResult = (file, source, languageVersion, data) => {
+ // TODO check whether the tab is configured
+ let compiler = new CompilerAbstract(languageVersion, data, source)
+ this.compilersArtefacts[languageVersion] = compiler
+ this.compilersArtefacts['__last'] = compiler
+ this.event.trigger('newlyCompiled', [true, data, source, compiler, languageVersion, file])
+ }
+ this.runView.on('solidity', 'compilationFinished', (file, source, languageVersion, data) =>
+ broadcastCompilationResult(file, source, languageVersion, data)
+ )
+ this.runView.on('vyper', 'compilationFinished', (file, source, languageVersion, data) =>
+ broadcastCompilationResult(file, source, languageVersion, data)
+ )
+ this.runView.on('lexon', 'compilationFinished', (file, source, languageVersion, data) =>
+ broadcastCompilationResult(file, source, languageVersion, data)
+ )
+ this.runView.on('yulp', 'compilationFinished', (file, source, languageVersion, data) =>
+ broadcastCompilationResult(file, source, languageVersion, data)
+ )
+ }
+
+ loadContractFromAddress (address, confirmCb, cb) {
+ if (!ethJSUtil.isValidAddress(address)) {
+ return cb('Invalid address.')
+ }
+ if (/[a-f]/.test(address) && /[A-F]/.test(address) && !ethJSUtil.isValidChecksumAddress(address)) {
+ return cb('Invalid checksum address.')
+ }
+ if (/.(.abi)$/.exec(this.config.get('currentFile'))) {
+ confirmCb(() => {
+ var abi
+ try {
+ abi = JSON.parse(this.editor.currentContent())
+ } catch (e) {
+ return cb('Failed to parse the current file as JSON ABI.')
+ }
+ cb(null, 'abi', abi)
+ })
+ } else {
+ cb(null, 'instance')
+ }
+ }
+
+ getCompiledContracts (compiler, compilerFullName) {
+ var contracts = []
+ compiler.visitContracts((contract) => {
+ contracts.push(contract)
+ })
+ return contracts
+ }
+
+ getSelectedContract (contractName, compilerAtributeName) {
+ if (!contractName) return null
+
+ var compiler = this.compilersArtefacts[compilerAtributeName]
+ if (!compiler) return null
+
+ var contract = compiler.getContract(contractName)
+
+ return {
+ name: contractName,
+ contract: contract,
+ compiler: compiler,
+ abi: contract.object.abi,
+ bytecodeObject: contract.object.evm.bytecode.object,
+ bytecodeLinkReferences: contract.object.evm.bytecode.linkReferences,
+ object: contract.object,
+ deployedBytecode: contract.object.evm.deployedBytecode,
+ getConstructorInterface: () => {
+ return txHelper.getConstructorInterface(contract.object.abi)
+ },
+ getConstructorInputs: () => {
+ var constructorInteface = txHelper.getConstructorInterface(contract.object.abi)
+ return txHelper.inputParametersDeclarationToString(constructorInteface.inputs)
+ },
+ isOverSizeLimit: () => {
+ var deployedBytecode = contract.object.evm.deployedBytecode
+ return (deployedBytecode && deployedBytecode.object.length / 2 > 24576)
+ },
+ metadata: contract.object.metadata
+ }
+ }
+
+ getCompilerContracts () {
+ return this.compilersArtefacts['__last'].getData().contracts
+ }
+
+}
+
+module.exports = DropdownLogic
diff --git a/apps/remix-ide/src/app/tabs/runTab/model/recorder.js b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js
new file mode 100644
index 0000000000..ea2333bc9c
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js
@@ -0,0 +1,329 @@
+var async = require('async')
+var ethutil = require('ethereumjs-util')
+var remixLib = require('@remix-project/remix-lib')
+var EventManager = remixLib.EventManager
+var format = remixLib.execution.txFormat
+var txHelper = remixLib.execution.txHelper
+var helper = require('../../../../lib/helper.js')
+
+/**
+ * Record transaction as long as the user create them.
+ *
+ *
+ */
+class Recorder {
+ constructor (blockchain, fileManager, config) {
+ var self = this
+ self.event = new EventManager()
+ self.blockchain = blockchain
+ self.data = { _listen: true, _replay: false, journal: [], _createdContracts: {}, _createdContractsReverse: {}, _usedAccounts: {}, _abis: {}, _contractABIReferences: {}, _linkReferences: {} }
+ this.fileManager = fileManager
+ this.config = config
+
+ this.blockchain.event.register('initiatingTransaction', (timestamp, tx, payLoad) => {
+ if (tx.useCall) return
+ var { from, to, value } = tx
+
+ // convert to and from to tokens
+ if (this.data._listen) {
+ var record = { value, parameters: payLoad.funArgs }
+ if (!to) {
+ var abi = payLoad.contractABI
+ var keccak = ethutil.bufferToHex(ethutil.keccak(abi))
+ record.abi = keccak
+ record.contractName = payLoad.contractName
+ record.bytecode = payLoad.contractBytecode
+ record.linkReferences = payLoad.linkReferences
+ if (record.linkReferences && Object.keys(record.linkReferences).length) {
+ for (var file in record.linkReferences) {
+ for (var lib in record.linkReferences[file]) {
+ self.data._linkReferences[lib] = ''
+ }
+ }
+ }
+ self.data._abis[keccak] = abi
+
+ this.data._contractABIReferences[timestamp] = keccak
+ } else {
+ var creationTimestamp = this.data._createdContracts[to]
+ record.to = `created{${creationTimestamp}}`
+ record.abi = this.data._contractABIReferences[creationTimestamp]
+ }
+ record.name = payLoad.funAbi.name
+ record.inputs = txHelper.serializeInputs(payLoad.funAbi)
+ record.type = payLoad.funAbi.type
+ for (var p in record.parameters) {
+ var thisarg = record.parameters[p]
+ var thistimestamp = this.data._createdContracts[thisarg]
+ if (thistimestamp) record.parameters[p] = `created{${thistimestamp}}`
+ }
+
+ this.blockchain.getAccounts((error, accounts) => {
+ if (error) return console.log(error)
+ record.from = `account{${accounts.indexOf(from)}}`
+ self.data._usedAccounts[record.from] = from
+ self.append(timestamp, record)
+ })
+ }
+ })
+
+ this.blockchain.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp, _payload, rawAddress) => {
+ if (error) return console.log(error)
+ if (call) return
+
+ if (!rawAddress) return // not a contract creation
+ const stringAddress = this.addressToString(rawAddress)
+ const address = ethutil.toChecksumAddress(stringAddress)
+ // save back created addresses for the convertion from tokens to real adresses
+ this.data._createdContracts[address] = timestamp
+ this.data._createdContractsReverse[timestamp] = address
+ })
+ this.blockchain.event.register('contextChanged', this.clearAll.bind(this))
+ this.event.register('newTxRecorded', (count) => {
+ this.event.trigger('recorderCountChange', [count])
+ })
+ this.event.register('cleared', () => {
+ this.event.trigger('recorderCountChange', [0])
+ })
+ }
+
+ /**
+ * stop/start saving txs. If not listenning, is basically in replay mode
+ *
+ * @param {Bool} listen
+ */
+ setListen (listen) {
+ this.data._listen = listen
+ this.data._replay = !listen
+ }
+
+ extractTimestamp (value) {
+ var stamp = /created{(.*)}/g.exec(value)
+ if (stamp) {
+ return stamp[1]
+ }
+ return null
+ }
+
+ /**
+ * convert back from/to from tokens to real addresses
+ *
+ * @param {Object} record
+ * @param {Object} accounts
+ * @param {Object} options
+ *
+ */
+ resolveAddress (record, accounts, options) {
+ if (record.to) {
+ var stamp = this.extractTimestamp(record.to)
+ if (stamp) {
+ record.to = this.data._createdContractsReverse[stamp]
+ }
+ }
+ record.from = accounts[record.from]
+ // @TODO: writing browser test
+ return record
+ }
+
+ /**
+ * save the given @arg record
+ *
+ * @param {Number/String} timestamp
+ * @param {Object} record
+ *
+ */
+ append (timestamp, record) {
+ var self = this
+ self.data.journal.push({ timestamp, record })
+ self.event.trigger('newTxRecorded', [self.data.journal.length])
+ }
+
+ /**
+ * basically return the records + associate values (like abis / accounts)
+ *
+ */
+ getAll () {
+ var self = this
+ var records = [].concat(self.data.journal)
+ return {
+ accounts: self.data._usedAccounts,
+ linkReferences: self.data._linkReferences,
+ transactions: records.sort((A, B) => {
+ var stampA = A.timestamp
+ var stampB = B.timestamp
+ return stampA - stampB
+ }),
+ abis: self.data._abis
+ }
+ }
+
+ /**
+ * delete the seen transactions
+ *
+ */
+ clearAll () {
+ var self = this
+ self.data._listen = true
+ self.data._replay = false
+ self.data.journal = []
+ self.data._createdContracts = {}
+ self.data._createdContractsReverse = {}
+ self.data._usedAccounts = {}
+ self.data._abis = {}
+ self.data._contractABIReferences = {}
+ self.data._linkReferences = {}
+ self.event.trigger('cleared', [])
+ }
+
+ /**
+ * run the list of records
+ *
+ * @param {Object} accounts
+ * @param {Object} options
+ * @param {Object} abis
+ * @param {Function} newContractFn
+ *
+ */
+ run (records, accounts, options, abis, linkReferences, confirmationCb, continueCb, promptCb, alertCb, logCallBack, newContractFn) {
+ var self = this
+ self.setListen(false)
+ logCallBack(`Running ${records.length} transaction(s) ...`)
+ async.eachOfSeries(records, function (tx, index, cb) {
+ var record = self.resolveAddress(tx.record, accounts, options)
+ var abi = abis[tx.record.abi]
+ if (!abi) {
+ return alertCb('cannot find ABI for ' + tx.record.abi + '. Execution stopped at ' + index)
+ }
+ /* Resolve Library */
+ if (record.linkReferences && Object.keys(record.linkReferences).length) {
+ for (var k in linkReferences) {
+ var link = linkReferences[k]
+ var timestamp = self.extractTimestamp(link)
+ if (timestamp && self.data._createdContractsReverse[timestamp]) {
+ link = self.data._createdContractsReverse[timestamp]
+ }
+ tx.record.bytecode = format.linkLibraryStandardFromlinkReferences(k, link.replace('0x', ''), tx.record.bytecode, tx.record.linkReferences)
+ }
+ }
+ /* Encode params */
+ var fnABI
+ if (tx.record.type === 'constructor') {
+ fnABI = txHelper.getConstructorInterface(abi)
+ } else if (tx.record.type === 'fallback') {
+ fnABI = txHelper.getFallbackInterface(abi)
+ } else if (tx.record.type === 'receive') {
+ fnABI = txHelper.getReceiveInterface(abi)
+ } else {
+ fnABI = txHelper.getFunction(abi, record.name + record.inputs)
+ }
+ if (!fnABI) {
+ alertCb('cannot resolve abi of ' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index)
+ return cb('cannot resolve abi')
+ }
+ if (tx.record.parameters) {
+ /* check if we have some params to resolve */
+ try {
+ tx.record.parameters.forEach((value, index) => {
+ var isString = true
+ if (typeof value !== 'string') {
+ isString = false
+ value = JSON.stringify(value)
+ }
+ for (var timestamp in self.data._createdContractsReverse) {
+ value = value.replace(new RegExp('created\\{' + timestamp + '\\}', 'g'), self.data._createdContractsReverse[timestamp])
+ }
+ if (!isString) value = JSON.parse(value)
+ tx.record.parameters[index] = value
+ })
+ } catch (e) {
+ return alertCb('cannot resolve input parameters ' + JSON.stringify(tx.record.parameters) + '. Execution stopped at ' + index)
+ }
+ }
+ var data = format.encodeData(fnABI, tx.record.parameters, tx.record.bytecode)
+ if (data.error) {
+ alertCb(data.error + '. Record:' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index)
+ return cb(data.error)
+ }
+ logCallBack(`(${index}) ${JSON.stringify(record, null, '\t')}`)
+ logCallBack(`(${index}) data: ${data.data}`)
+ record.data = { dataHex: data.data, funArgs: tx.record.parameters, funAbi: fnABI, contractBytecode: tx.record.bytecode, contractName: tx.record.contractName, timestamp: tx.timestamp }
+
+ self.blockchain.runTx(record, confirmationCb, continueCb, promptCb,
+ function (err, txResult, rawAddress) {
+ if (err) {
+ console.error(err)
+ return logCallBack(err + '. Execution failed at ' + index)
+ }
+ if (rawAddress) {
+ const stringAddress = self.addressToString(rawAddress)
+ const address = ethutil.toChecksumAddress(stringAddress)
+ // save back created addresses for the convertion from tokens to real adresses
+ self.data._createdContracts[address] = tx.timestamp
+ self.data._createdContractsReverse[tx.timestamp] = address
+ newContractFn(abi, address, record.contractName)
+ }
+ cb(err)
+ }
+ )
+ }, () => { self.setListen(true); self.clearAll() })
+ }
+
+ addressToString (address) {
+ if (!address) return null
+ if (typeof address !== 'string') {
+ address = address.toString('hex')
+ }
+ if (address.indexOf('0x') === -1) {
+ address = '0x' + address
+ }
+ return address
+ }
+
+ runScenario (continueCb, promptCb, alertCb, confirmationCb, logCallBack, cb) {
+ var currentFile = this.config.get('currentFile')
+ this.fileManager.fileProviderOf(currentFile).get(currentFile, (error, json) => {
+ if (error) {
+ return cb('Invalid Scenario File ' + error)
+ }
+ if (!currentFile.match('.json$')) {
+ return cb('A scenario file is required. Please make sure a scenario file is currently displayed in the editor. The file must be of type JSON. Use the "Save Transactions" Button to generate a new Scenario File.')
+ }
+ try {
+ var obj = JSON.parse(json)
+ var txArray = obj.transactions || []
+ var accounts = obj.accounts || []
+ var options = obj.options || {}
+ var abis = obj.abis || {}
+ var linkReferences = obj.linkReferences || {}
+ } catch (e) {
+ return cb('Invalid Scenario File, please try again')
+ }
+
+ if (!txArray.length) {
+ return
+ }
+
+ this.run(txArray, accounts, options, abis, linkReferences, confirmationCb, continueCb, promptCb, alertCb, logCallBack, (abi, address, contractName) => {
+ cb(null, abi, address, contractName)
+ })
+ })
+ }
+
+ saveScenario (promptCb, cb) {
+ var txJSON = JSON.stringify(this.getAll(), null, 2)
+ var path = this.fileManager.currentPath()
+ promptCb(path, input => {
+ var fileProvider = this.fileManager.fileProviderOf(path)
+ if (!fileProvider) return
+ var newFile = path + '/' + input
+ helper.createNonClashingName(newFile, fileProvider, (error, newFile) => {
+ if (error) return cb('Failed to create file. ' + newFile + ' ' + error)
+ if (!fileProvider.set(newFile, txJSON)) return cb('Failed to create file ' + newFile)
+ this.fileManager.open(newFile)
+ })
+ })
+ }
+
+}
+
+module.exports = Recorder
diff --git a/apps/remix-ide/src/app/tabs/runTab/recorder.js b/apps/remix-ide/src/app/tabs/runTab/recorder.js
new file mode 100644
index 0000000000..7fa784da6b
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/runTab/recorder.js
@@ -0,0 +1,125 @@
+var yo = require('yo-yo')
+var remixLib = require('@remix-project/remix-lib')
+var EventManager = remixLib.EventManager
+var csjs = require('csjs-inject')
+var css = require('../styles/run-tab-styles')
+
+var modalDialogCustom = require('../../ui/modal-dialog-custom')
+var modalDialog = require('../../ui/modaldialog')
+var confirmDialog = require('../../ui/confirmDialog')
+
+class RecorderUI {
+
+ constructor (blockchain, recorder, logCallBack, config) {
+ this.blockchain = blockchain
+ this.recorder = recorder
+ this.logCallBack = logCallBack
+ this.config = config
+ this.event = new EventManager()
+ }
+
+ render () {
+ var css2 = csjs`
+ .container {}
+ .runTxs {}
+ .recorder {}
+ `
+
+ this.runButton = yo` `
+ this.recordButton = yo`
+
+ `
+
+ this.runButton.onclick = this.runScenario.bind(this)
+ }
+
+ runScenario () {
+ var continueCb = (error, continueTxExecution, cancelCb) => {
+ if (error) {
+ var msg = typeof error !== 'string' ? error.message : error
+ modalDialog('Gas estimation failed', yo`Gas estimation errored with the following message (see below).
+ The transaction execution will likely fail. Do you want to force sending?
+ ${msg}
+
`,
+ {
+ label: 'Send Transaction',
+ fn: () => {
+ continueTxExecution()
+ }}, {
+ label: 'Cancel Transaction',
+ fn: () => {
+ cancelCb()
+ }
+ })
+ } else {
+ continueTxExecution()
+ }
+ }
+
+ var promptCb = (okCb, cancelCb) => {
+ modalDialogCustom.promptPassphrase('Passphrase requested', 'Personal mode is enabled. Please provide passphrase of account', '', okCb, cancelCb)
+ }
+
+ var alertCb = (msg) => {
+ modalDialogCustom.alert(msg)
+ }
+
+ const confirmationCb = this.getConfirmationCb(modalDialog, confirmDialog)
+
+ // TODO: there is still a UI dependency to remove here, it's still too coupled at this point to remove easily
+ this.recorder.runScenario(continueCb, promptCb, alertCb, confirmationCb, this.logCallBack, (error, abi, address, contractName) => {
+ if (error) {
+ return modalDialogCustom.alert(error)
+ }
+
+ this.event.trigger('newScenario', [abi, address, contractName])
+ })
+ }
+
+ getConfirmationCb (modalDialog, confirmDialog) {
+ // this code is the same as in contractDropdown.js. TODO need to be refactored out
+ const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => {
+ if (network.name !== 'Main') {
+ return continueTxExecution(null)
+ }
+ const amount = this.blockchain.fromWei(tx.value, true, 'ether')
+ const content = confirmDialog(tx, amount, gasEstimation, null, this.blockchain.determineGasFees(tx), this.blockchain.determineGasPrice.bind(this.blockchain))
+
+ modalDialog('Confirm transaction', content,
+ { label: 'Confirm',
+ fn: () => {
+ this.config.setUnpersistedProperty('doNotShowTransactionConfirmationAgain', content.querySelector('input#confirmsetting').checked)
+ // TODO: check if this is check is still valid given the refactor
+ if (!content.gasPriceStatus) {
+ cancelCb('Given gas price is not correct')
+ } else {
+ var gasPrice = this.blockchain.toWei(content.querySelector('#gasprice').value, 'gwei')
+ continueTxExecution(gasPrice)
+ }
+ }}, {
+ label: 'Cancel',
+ fn: () => {
+ return cancelCb('Transaction canceled by user.')
+ }
+ }
+ )
+ }
+
+ return confirmationCb
+ }
+
+ triggerRecordButton () {
+ this.recorder.saveScenario(
+ (path, cb) => {
+ modalDialogCustom.prompt('Save transactions as scenario', 'Transactions will be saved in a file under ' + path, 'scenario.json', cb)
+ },
+ (error) => {
+ if (error) return modalDialogCustom.alert(error)
+ }
+ )
+ }
+
+}
+
+module.exports = RecorderUI
diff --git a/apps/remix-ide/src/app/tabs/runTab/settings.js b/apps/remix-ide/src/app/tabs/runTab/settings.js
new file mode 100644
index 0000000000..ca2a445bd4
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/runTab/settings.js
@@ -0,0 +1,374 @@
+const $ = require('jquery')
+const yo = require('yo-yo')
+const remixLib = require('@remix-project/remix-lib')
+const EventManager = remixLib.EventManager
+const css = require('../styles/run-tab-styles')
+const copyToClipboard = require('../../ui/copy-to-clipboard')
+const modalDialogCustom = require('../../ui/modal-dialog-custom')
+const addTooltip = require('../../ui/tooltip')
+const helper = require('../../../lib/helper.js')
+const globalRegistry = require('../../../global/registry')
+
+class SettingsUI {
+
+ constructor (blockchain, networkModule) {
+ this.blockchain = blockchain
+ this.event = new EventManager()
+ this._components = {}
+
+ this.blockchain.event.register('transactionExecuted', (error, from, to, data, lookupOnly, txResult) => {
+ if (error) return
+ if (!lookupOnly) this.el.querySelector('#value').value = '0'
+ this.updateAccountBalances()
+ })
+ this._components = {
+ registry: globalRegistry,
+ networkModule: networkModule
+ }
+ this._components.registry = globalRegistry
+ this._deps = {
+ config: this._components.registry.get('config').api
+ }
+
+ this._deps.config.events.on('settings/personal-mode_changed', this.onPersonalChange.bind(this))
+
+ setInterval(() => {
+ this.updateAccountBalances()
+ }, 1000)
+
+ this.accountListCallId = 0
+ this.loadedAccounts = {}
+ }
+
+ updateAccountBalances () {
+ if (!this.el) return
+ var accounts = $(this.el.querySelector('#txorigin')).children('option')
+ accounts.each((index, account) => {
+ this.blockchain.getBalanceInEther(account.value, (err, balance) => {
+ if (err) return
+ const updated = helper.shortenAddress(account.value, balance)
+ if (updated !== account.innerText) { // check if the balance has been updated and update UI accordingly.
+ account.innerText = updated
+ }
+ })
+ })
+ }
+
+ render () {
+ this.netUI = yo` `
+
+ var environmentEl = yo`
+
+
+ Environment
+
+
+
{ this.updateNetwork() }} class="form-control ${css.select} custom-select">
+ JavaScript VM
+
+ Injected Web3
+
+ Web3 Provider
+
+
+
+
+
+ `
+ const networkEl = yo`
+
+
+
+
+ ${this.netUI}
+
+
+ `
+ const accountEl = yo`
+
+
+ Account
+
+
+
+
+
+
+
${copyToClipboard(() => document.querySelector('#runTabView #txorigin').value)}
+
+
+
+ `
+
+ const gasPriceEl = yo`
+
+ Gas limit
+
+
+ `
+
+ const valueEl = yo`
+
+
Value
+
+
+
+ wei
+ gwei
+ finney
+ ether
+
+
+
+ `
+
+ const el = yo`
+
+ ${environmentEl}
+ ${networkEl}
+ ${accountEl}
+ ${gasPriceEl}
+ ${valueEl}
+
+ `
+
+ var selectExEnv = environmentEl.querySelector('#selectExEnvOptions')
+ this.setDropdown(selectExEnv)
+
+ this.blockchain.event.register('contextChanged', (context, silent) => {
+ this.setFinalContext()
+ })
+
+ setInterval(() => {
+ this.updateNetwork()
+ }, 1000)
+
+ this.el = el
+
+ this.fillAccountsList()
+ return el
+ }
+
+ setDropdown (selectExEnv) {
+ this.selectExEnv = selectExEnv
+
+ const addProvider = (network) => {
+ selectExEnv.appendChild(yo`
+ ${network.name}
+ `)
+ addTooltip(yo`${network.name} provider added `)
+ }
+
+ const removeProvider = (name) => {
+ var env = selectExEnv.querySelector(`option[value="${name}"]`)
+ if (env) {
+ selectExEnv.removeChild(env)
+ addTooltip(yo`${name} provider removed `)
+ }
+ }
+ this.blockchain.event.register('addProvider', provider => addProvider(provider))
+ this.blockchain.event.register('removeProvider', name => removeProvider(name))
+
+ selectExEnv.addEventListener('change', (event) => {
+ let context = selectExEnv.options[selectExEnv.selectedIndex].value
+ this.blockchain.changeExecutionContext(context, () => {
+ modalDialogCustom.prompt('External node request', this.web3ProviderDialogBody(), 'http://127.0.0.1:8545', (target) => {
+ this.blockchain.setProviderFromEndpoint(target, context, (alertMsg) => {
+ if (alertMsg) addTooltip(alertMsg)
+ this.setFinalContext()
+ })
+ }, this.setFinalContext.bind(this))
+ }, (alertMsg) => {
+ addTooltip(alertMsg)
+ }, this.setFinalContext.bind(this))
+ })
+
+ selectExEnv.value = this.blockchain.getProvider()
+ }
+
+ web3ProviderDialogBody () {
+ const thePath = ''
+
+ return yo`
+
+ Note: To use Geth & https://remix.ethereum.org, configure it to allow requests from Remix:(see
Geth Docs on rpc server )
+
geth --rpc --rpccorsdomain https://remix.ethereum.org
+
+ To run Remix & a local Geth test node, use this command: (see
Geth Docs on Dev mode )
+
geth --rpc --rpccorsdomain="${window.origin}" --rpcapi web3,eth,debug,personal,net --vmdebug --datadir ${thePath} --dev console
+
+
+
WARNING: It is not safe to use the --rpccorsdomain flag with a wildcard:
--rpccorsdomain *
+
+
For more info:
Remix Docs on Web3 Provider
+
+
+ Web3 Provider Endpoint
+
+ `
+ }
+
+ setFinalContext () {
+ // set the final context. Cause it is possible that this is not the one we've originaly selected
+ this.selectExEnv.value = this.blockchain.getProvider()
+ this.event.trigger('clearInstance', [])
+ this.updateNetwork()
+ this.updatePlusButton()
+ }
+
+ updatePlusButton () {
+ // enable/disable + button
+ let plusBtn = document.getElementById('remixRunPlus')
+ let plusTitle = document.getElementById('remixRunPlusWraper')
+ switch (this.selectExEnv.value) {
+ case 'injected': {
+ plusBtn.classList.add(css.disableMouseEvents)
+ plusTitle.title = "Unfortunately it's not possible to create an account using injected web3. Please create the account directly from your provider (i.e metamask or other of the same type)."
+ }
+ break
+ case 'vm': {
+ plusBtn.classList.remove(css.disableMouseEvents)
+ plusTitle.title = 'Create a new account'
+ }
+ break
+ case 'web3': {
+ this.onPersonalChange()
+ }
+ break
+ default: {
+ plusBtn.classList.add(css.disableMouseEvents)
+ plusTitle.title = `Unfortunately it's not possible to create an account using an external wallet (${this.selectExEnv.value}).`
+ }
+ }
+ }
+
+ onPersonalChange () {
+ let plusBtn = document.getElementById('remixRunPlus')
+ let plusTitle = document.getElementById('remixRunPlusWraper')
+ if (!this._deps.config.get('settings/personal-mode')) {
+ plusBtn.classList.add(css.disableMouseEvents)
+ plusTitle.title = 'Creating an account is possible only in Personal mode. Please go to Settings to enable it.'
+ } else {
+ plusBtn.classList.remove(css.disableMouseEvents)
+ plusTitle.title = 'Create a new account'
+ }
+ }
+
+ newAccount () {
+ this.blockchain.newAccount(
+ '',
+ (cb) => {
+ modalDialogCustom.promptPassphraseCreation((error, passphrase) => {
+ if (error) {
+ return modalDialogCustom.alert(error)
+ }
+ cb(passphrase)
+ }, () => {})
+ },
+ (error, address) => {
+ if (error) {
+ return addTooltip('Cannot create an account: ' + error)
+ }
+ addTooltip(`account ${address} created`)
+ }
+ )
+ }
+
+ signMessage () {
+ this.blockchain.getAccounts((err, accounts) => {
+ if (err) {
+ return addTooltip(`Cannot get account list: ${err}`)
+ }
+
+ var signMessageDialog = { 'title': 'Sign a message', 'text': 'Enter a message to sign', 'inputvalue': 'Message to sign' }
+ var $txOrigin = this.el.querySelector('#txorigin')
+ if (!$txOrigin.selectedOptions[0] && (this.blockchain.isInjectedWeb3() || this.blockchain.isWeb3Provider())) {
+ return addTooltip(`Account list is empty, please make sure the current provider is properly connected to remix`)
+ }
+
+ var account = $txOrigin.selectedOptions[0].value
+
+ var promptCb = (passphrase) => {
+ const modal = modalDialogCustom.promptMulti(signMessageDialog, (message) => {
+ this.blockchain.signMessage(message, account, passphrase, (err, msgHash, signedData) => {
+ if (err) {
+ return addTooltip(err)
+ }
+ modal.hide()
+ modalDialogCustom.alert(yo`
+
+ hash:
+ ${msgHash}
+ signature:
+ ${signedData}
+
+ `)
+ })
+ }, false)
+ }
+
+ if (this.blockchain.isWeb3Provider()) {
+ return modalDialogCustom.promptPassphrase(
+ 'Passphrase to sign a message',
+ 'Enter your passphrase for this account to sign the message',
+ '',
+ promptCb,
+ false
+ )
+ }
+ promptCb()
+ })
+ }
+
+ updateNetwork () {
+ this.blockchain.updateNetwork((err, {id, name} = {}) => {
+ if (err) {
+ this.netUI.innerHTML = 'can\'t detect network '
+ return
+ }
+ let network = this._components.networkModule.getNetworkProvider.bind(this._components.networkModule)
+ this.netUI.innerHTML = (network() !== 'vm') ? `${name} (${id || '-'}) network` : ''
+ })
+ this.fillAccountsList()
+ }
+
+ // TODO: unclear what's the goal of accountListCallId, feels like it can be simplified
+ fillAccountsList () {
+ this.accountListCallId++
+ var callid = this.accountListCallId
+ var txOrigin = this.el.querySelector('#txorigin')
+ this.blockchain.getAccounts((err, accounts) => {
+ if (this.accountListCallId > callid) return
+ this.accountListCallId++
+ if (err) { addTooltip(`Cannot get account list: ${err}`) }
+ for (var loadedaddress in this.loadedAccounts) {
+ if (accounts.indexOf(loadedaddress) === -1) {
+ txOrigin.removeChild(txOrigin.querySelector('option[value="' + loadedaddress + '"]'))
+ delete this.loadedAccounts[loadedaddress]
+ }
+ }
+ for (var i in accounts) {
+ var address = accounts[i]
+ if (!this.loadedAccounts[address]) {
+ txOrigin.appendChild(yo`${address} `)
+ this.loadedAccounts[address] = 1
+ }
+ }
+ txOrigin.setAttribute('value', accounts[0])
+ })
+ }
+
+}
+
+module.exports = SettingsUI
diff --git a/apps/remix-ide/src/app/tabs/settings-tab.js b/apps/remix-ide/src/app/tabs/settings-tab.js
new file mode 100644
index 0000000000..6b3649bfea
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/settings-tab.js
@@ -0,0 +1,206 @@
+const yo = require('yo-yo')
+const globalRegistry = require('../../global/registry')
+const tooltip = require('../ui/tooltip')
+const copyToClipboard = require('../ui/copy-to-clipboard')
+const EventManager = require('../../lib/events')
+const css = require('./styles/settings-tab-styles')
+import { ViewPlugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+const profile = {
+ name: 'settings',
+ displayName: 'Settings',
+ methods: ['getGithubAccessToken'],
+ events: [],
+ icon: 'assets/img/settings.webp',
+ description: 'Remix-IDE settings',
+ kind: 'settings',
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/settings.html',
+ version: packageJson.version,
+ permission: true
+}
+
+module.exports = class SettingsTab extends ViewPlugin {
+ constructor (config, editor, appManager) {
+ super(profile)
+ this.config = config
+ this.editor = editor
+ this.appManager = appManager
+ this._components = {}
+ this._deps = {
+ themeModule: globalRegistry.get('themeModule').api
+ }
+ this._view = { /* eslint-disable */
+ el: null,
+ optionVM: null,
+ optionVMLabel: null,
+ personal: null,
+ personalLabel: null,
+ warnPersonalMode: null,
+ generateContractMetadata: null,
+ generateContractMetadataLabel: null,
+ config: {
+ general: null, themes: null
+ },
+ textWrap: null,
+ textWrapLabel: null
+ } /* eslint-enable */
+ this.event = new EventManager()
+ }
+
+ createThemeCheckies () {
+ let themes = this._deps.themeModule.getThemes()
+ const onswitchTheme = (event, name) => {
+ this._deps.themeModule.switchTheme(name)
+ }
+ if (themes) {
+ return yo`
+ ${themes.map((aTheme) => {
+ let el = yo`
+ { onswitchTheme(event, aTheme.name) }} class="align-middle custom-control-input" name="theme" id="${aTheme.name}" data-id="settingsTabTheme${aTheme.name}">
+ ${aTheme.name} (${aTheme.quality})
+
`
+ if (this._deps.themeModule.active === aTheme.name) el.querySelector('input').setAttribute('checked', 'checked')
+ return el
+ })}
+
`
+ }
+ }
+
+ render () {
+ const self = this
+ if (self._view.el) return self._view.el
+
+ // Gist settings
+ const token = this.config.get('settings/gist-access-token')
+ const gistAccessToken = yo` `
+ if (token) gistAccessToken.value = token
+ const removeToken = () => { self.config.set('settings/gist-access-token', ''); gistAccessToken.value = ''; tooltip('Access token removed') }
+ const saveToken = () => { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') }
+ const gistAddToken = yo` saveToken()} value="Save" type="button">`
+ const gistRemoveToken = yo` removeToken()}>Remove `
+ this._view.gistToken = yo`${gistAccessToken}
${copyToClipboard(() => gistAccessToken.value)}${gistAddToken}${gistRemoveToken}
`
+ this._view.optionVM = yo` `
+ this._view.optionVMLabel = yo`Always use Ethereum VM at Load `
+ if (this.config.get('settings/always-use-vm') === undefined) this.config.set('settings/always-use-vm', true)
+ if (this.config.get('settings/always-use-vm')) this._view.optionVM.setAttribute('checked', '')
+ elementStateChanged(self._view.optionVMLabel, !this.config.get('settings/always-use-vm'))
+
+ this._view.textWrap = yo` `
+ this._view.textWrapLabel = yo`Text Wrap `
+ if (this.config.get('settings/text-wrap')) this._view.textWrap.setAttribute('checked', '')
+ elementStateChanged(self._view.textWrapLabel, !this.config.get('settings/text-wrap'))
+
+ const warnText = `Transaction sent over Web3 will use the web3.personal API - be sure the endpoint is opened before enabling it.
+ This mode allows to provide the passphrase in the Remix interface without having to unlock the account.
+ Although this is very convenient, you should completely trust the backend you are connected to (Geth, Parity, ...).
+ Remix never persist any passphrase.`.split('\n').map(s => s.trim()).join(' ')
+
+ this._view.personal = yo` `
+ this._view.warnPersonalMode = yo` `
+ this._view.personalLabel = yo` ${this._view.warnPersonalMode} Enable Personal Mode for web3 provider. ${warnText}> `
+ if (this.config.get('settings/personal-mode')) this._view.personal.setAttribute('checked', '')
+ elementStateChanged(self._view.personalLabel, !this.config.get('settings/personal-mode'))
+
+ this._view.generateContractMetadata = yo` `
+ this._view.generateContractMetadataLabel = yo`Generate contract metadata. Generate a JSON file in the contract folder. Allows to specify library addresses the contract depends on. If nothing is specified, Remix deploys libraries automatically. `
+ if (this.config.get('settings/generate-contract-metadata') === undefined) this.config.set('settings/generate-contract-metadata', true)
+ if (this.config.get('settings/generate-contract-metadata')) this._view.generateContractMetadata.setAttribute('checked', '')
+ elementStateChanged(self._view.generateContractMetadataLabel, !this.config.get('settings/generate-contract-metadata'))
+
+ this._view.pluginInput = yo``
+
+ this._view.themes = this._deps.themeModule.getThemes()
+ this._view.themesCheckBoxes = this.createThemeCheckies()
+
+ this._view.config.general = yo`
+
+
+
General settings
+
+ ${this._view.generateContractMetadata}
+ ${this._view.generateContractMetadataLabel}
+
+
+ ${this._view.optionVM}
+ ${this._view.optionVMLabel}
+
+
+ ${this._view.textWrap}
+ ${this._view.textWrapLabel}
+
+
+ ${this._view.personal}>
+ ${this._view.personalLabel}
+
+
+
+ `
+ this._view.gistToken = yo`
+
+
+
Github Access Token
+
Manage the access token used to publish to Gist and retrieve Github contents.
+
Go to github token page (link below) to create a new token and save it in Remix. Make sure this token has only 'create gist' permission.
+
https://github.com/settings/tokens
+
TOKEN: ${this._view.gistToken}
+
+
`
+ this._view.config.themes = yo`
+
+
+
Themes
+ ${this._view.themesCheckBoxes}
+
+
`
+ this._view.el = yo`
+
+ ${this._view.config.general}
+ ${this._view.gistToken}
+ ${this._view.config.themes}
+
`
+
+ function onchangeGenerateContractMetadata (event) {
+ const isChecked = self.config.get('settings/generate-contract-metadata')
+
+ self.config.set('settings/generate-contract-metadata', !isChecked)
+ elementStateChanged(self._view.generateContractMetadataLabel, isChecked)
+ }
+ function onchangeOption (event) {
+ const isChecked = self.config.get('settings/always-use-vm')
+
+ self.config.set('settings/always-use-vm', !isChecked)
+ elementStateChanged(self._view.optionVMLabel, isChecked)
+ }
+ function textWrapEvent (event) {
+ const isChecked = self.config.get('settings/text-wrap')
+
+ self.config.set('settings/text-wrap', !isChecked)
+ elementStateChanged(self._view.textWrapLabel, isChecked)
+ self.editor.resize(!isChecked)
+ }
+ function onchangePersonal (event) {
+ const isChecked = self.config.get('settings/personal-mode')
+
+ self.config.set('settings/personal-mode', !isChecked)
+ elementStateChanged(self._view.personalLabel, isChecked)
+ }
+ function elementStateChanged (el, isChanged) {
+ if (isChanged) {
+ el.classList.remove("text-dark")
+ el.classList.add("text-secondary")
+ } else {
+ el.classList.add("text-dark")
+ el.classList.remove("text-secondary")
+ }
+ }
+
+ this._deps.themeModule.switchTheme()
+ return this._view.el
+ }
+
+ getGithubAccessToken () {
+ return this.config.get('settings/gist-access-token')
+ }
+}
diff --git a/apps/remix-ide/src/app/tabs/staticanalysis/staticAnalysisView.js b/apps/remix-ide/src/app/tabs/staticanalysis/staticAnalysisView.js
new file mode 100644
index 0000000000..14256e96fe
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/staticanalysis/staticAnalysisView.js
@@ -0,0 +1,299 @@
+'use strict'
+var StaticAnalysisRunner = require('@remix-project/remix-analyzer').CodeAnalysis
+var yo = require('yo-yo')
+var $ = require('jquery')
+var remixLib = require('@remix-project/remix-lib')
+var utils = remixLib.util
+var css = require('./styles/staticAnalysisView-styles')
+var Renderer = require('../../ui/renderer')
+const SourceHighlighter = require('../../editor/sourceHighlighter')
+
+var EventManager = require('../../../lib/events')
+
+function staticAnalysisView (localRegistry, analysisModule) {
+ var self = this
+ this.event = new EventManager()
+ this.view = null
+ this.runner = new StaticAnalysisRunner()
+ this.modulesView = this.renderModules()
+ this.lastCompilationResult = null
+ this.lastCompilationSource = null
+ this.currentFile = 'No file compiled'
+ this.sourceHighlighter = new SourceHighlighter()
+ this.analysisModule = analysisModule
+ self._components = {
+ renderer: new Renderer()
+ }
+ self._components.registry = localRegistry
+ // dependencies
+ self._deps = {
+ offsetToLineColumnConverter: self._components.registry.get('offsettolinecolumnconverter').api
+ }
+
+ analysisModule.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
+ self.lastCompilationResult = null
+ self.lastCompilationSource = null
+ if (languageVersion.indexOf('soljson') !== 0) return
+ self.lastCompilationResult = data
+ self.lastCompilationSource = source
+ self.currentFile = file
+ self.correctRunBtnDisabled()
+ if (self.view && self.view.querySelector('#autorunstaticanalysis').checked) {
+ self.run()
+ }
+ })
+}
+
+staticAnalysisView.prototype.render = function () {
+ this.runBtn = yo`Run `
+ const view = yo`
+
+
+
+ ${this.modulesView}
+
+
+ last results for:
+ ${this.currentFile}
+
+
+
+ `
+
+ if (!this.view) {
+ this.view = view
+ }
+ this.correctRunBtnDisabled()
+ return view
+}
+
+staticAnalysisView.prototype.selectedModules = function () {
+ if (!this.view) {
+ return []
+ }
+ const selected = this.view.querySelectorAll('[name="staticanalysismodule"]:checked')
+ var toRun = []
+ for (var i = 0; i < selected.length; i++) {
+ toRun.push(selected[i].attributes['index'].value)
+ }
+ return toRun
+}
+
+staticAnalysisView.prototype.run = function () {
+ if (!this.view) {
+ return
+ }
+ const highlightLocation = async (location, fileName) => {
+ await this.analysisModule.call('editor', 'discardHighlight')
+ await this.analysisModule.call('editor', 'highlight', location, fileName)
+ }
+ const selected = this.selectedModules()
+ const warningContainer = $('#staticanalysisresult')
+ warningContainer.empty()
+ this.view.querySelector('#staticAnalysisCurrentFile').innerText = this.currentFile
+ var self = this
+ if (this.lastCompilationResult && selected.length) {
+ this.runBtn.removeAttribute('disabled')
+ let warningCount = 0
+ this.runner.run(this.lastCompilationResult, selected, (results) => {
+ const groupedModules = utils.groupBy(preProcessModules(this.runner.modules()), 'categoryId')
+ results.map((result, j) => {
+ let moduleName
+ Object.keys(groupedModules).map((key) => {
+ groupedModules[key].forEach((el) => {
+ if (el.name === result.name) {
+ moduleName = groupedModules[key][0].categoryDisplayName
+ return
+ }
+ })
+ })
+ let alreadyExistedEl = this.view.querySelector(`[id="staticAnalysisModule${moduleName}"]`)
+ if (!alreadyExistedEl) {
+ warningContainer.append(`
+
+ ${moduleName}
+
+ `)
+ }
+
+ result.report.map((item, i) => {
+ let location = ''
+ let locationString = 'not available'
+ let column = 0
+ let row = 0
+ let fileName = this.currentFile
+ if (item.location) {
+ var split = item.location.split(':')
+ var file = split[2]
+ location = {
+ start: parseInt(split[0]),
+ length: parseInt(split[1])
+ }
+ location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location,
+ parseInt(file),
+ self.lastCompilationSource.sources,
+ self.lastCompilationResult.sources
+ )
+ row = location.start.line
+ column = location.start.column
+ locationString = (row + 1) + ':' + column + ':'
+ fileName = Object.keys(self.lastCompilationResult.contracts)[file]
+ }
+ warningCount++
+ const msg = yo`
+
+ ${result.name}
+ ${item.warning}
+ ${item.more ? yo`more ` : yo` `}
+ Pos: ${locationString}
+ `
+ self._components.renderer.error(
+ msg,
+ this.view.querySelector(`[id="staticAnalysisModule${moduleName}"]`),
+ {
+ click: () => highlightLocation(location, fileName),
+ type: 'warning',
+ useSpan: true,
+ errFile: fileName,
+ errLine: row,
+ errCol: column
+ }
+ )
+ })
+ })
+ // hide empty staticAnalysisModules sections
+ this.view.querySelectorAll('[name="staticAnalysisModules"]').forEach((section) => {
+ if (!section.getElementsByClassName('alert-warning').length) section.hidden = true
+ })
+ self.event.trigger('staticAnaysisWarning', [warningCount])
+ })
+ } else {
+ this.runBtn.setAttribute('disabled', 'disabled')
+ if (selected.length) {
+ warningContainer.html('No compiled AST available')
+ }
+ self.event.trigger('staticAnaysisWarning', [-1])
+ }
+}
+staticAnalysisView.prototype.checkModule = function (event) {
+ const selected = this.view.querySelectorAll('[name="staticanalysismodule"]:checked')
+ const checkAll = this.view.querySelector('[id="checkAllEntries"]')
+ this.correctRunBtnDisabled()
+ if (event.target.checked) {
+ checkAll.checked = true
+ } else if (!selected.length) {
+ checkAll.checked = false
+ }
+}
+staticAnalysisView.prototype.correctRunBtnDisabled = function () {
+ const selected = this.view.querySelectorAll('[name="staticanalysismodule"]:checked')
+ if (this.lastCompilationResult && selected.length !== 0) {
+ this.runBtn.removeAttribute('disabled')
+ } else {
+ this.runBtn.setAttribute('disabled', 'disabled')
+ }
+}
+staticAnalysisView.prototype.checkAll = function (event) {
+ if (!this.view) {
+ return
+ }
+ // checks/unchecks all
+ const checkBoxes = this.view.querySelectorAll('[name="staticanalysismodule"]')
+ checkBoxes.forEach((checkbox) => { checkbox.checked = event.target.checked })
+ this.correctRunBtnDisabled()
+}
+
+staticAnalysisView.prototype.handleCollapse = function (e) {
+ const downs = e.toElement.parentElement.getElementsByClassName('fas fa-angle-double-right')
+ const iEls = document.getElementsByTagName('i')
+ for (var i = 0; i < iEls.length; i++) { iEls[i].hidden = false }
+ downs[0].hidden = true
+}
+
+staticAnalysisView.prototype.renderModules = function () {
+ const groupedModules = utils.groupBy(preProcessModules(this.runner.modules()), 'categoryId')
+ const moduleEntries = Object.keys(groupedModules).map((categoryId, i) => {
+ const category = groupedModules[categoryId]
+ const entriesDom = category.map((item, i) => {
+ return yo`
+
+ `
+ })
+ return yo`
+
+
this.handleCollapse(e)}"/>
+
+
+ ${entriesDom}
+
+
+ `
+ })
+ // collaps first module
+ moduleEntries[0].getElementsByTagName('input')[0].checked = true
+ moduleEntries[0].getElementsByTagName('i')[0].hidden = true
+ return yo`
+
+ ${moduleEntries}
+
`
+}
+
+module.exports = staticAnalysisView
+
+/**
+ * @dev Process & categorize static analysis modules to show them on UI
+ * @param arr list of static analysis modules received from remix-analyzer module
+ */
+function preProcessModules (arr) {
+ return arr.map((Item, i) => {
+ const itemObj = new Item()
+ itemObj['_index'] = i
+ itemObj.categoryDisplayName = itemObj.category.displayName
+ itemObj.categoryId = itemObj.category.id
+ return itemObj
+ })
+}
diff --git a/apps/remix-ide/src/app/tabs/staticanalysis/styles/staticAnalysisView-styles.js b/apps/remix-ide/src/app/tabs/staticanalysis/styles/staticAnalysisView-styles.js
new file mode 100644
index 0000000000..bd277a03aa
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/staticanalysis/styles/staticAnalysisView-styles.js
@@ -0,0 +1,36 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .analysis {
+ display: flex;
+ flex-direction: column;
+ }
+ .result {
+ margin-top: 1%;
+ max-height: 300px;
+ word-break: break-word;
+ }
+ .buttons {
+ margin: 1rem 0;
+ }
+ .label {
+ display: flex;
+ align-items: center;
+ }
+ .label {
+ display: flex;
+ align-items: center;
+ user-select: none;
+ }
+ .block input[type='radio']:checked ~ .entries{
+ height: auto;
+ transition: .5s ease-in;
+ }
+ .entries{
+ height: 0;
+ overflow: hidden;
+ transition: .5s ease-out;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/analysis-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/analysis-tab-styles.js
new file mode 100644
index 0000000000..a98d5b70af
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/analysis-tab-styles.js
@@ -0,0 +1,6 @@
+var csjs = require('csjs-inject')
+
+const css = csjs`
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/compile-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/compile-tab-styles.js
new file mode 100644
index 0000000000..dc0b7c9842
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/compile-tab-styles.js
@@ -0,0 +1,237 @@
+const csjs = require('csjs-inject')
+
+const css = csjs`
+ .title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-bottom: 1em;
+ }
+ .panicError {
+ color: red;
+ font-size: 20px;
+ }
+ .crow {
+ display: flex;
+ overflow: auto;
+ clear: both;
+ padding: .2em;
+ }
+ .checkboxText {
+ font-weight: normal;
+ }
+ .crow label {
+ cursor:pointer;
+ }
+ .crowNoFlex {
+ overflow: auto;
+ clear: both;
+ }
+ .info {
+ padding: 10px;
+ word-break: break-word;
+ }
+ .contract {
+ display: block;
+ margin: 3% 0;
+ }
+ .nightlyBuilds {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ }
+ .autocompileContainer {
+ display: flex;
+ align-items: center;
+ }
+ .hideWarningsContainer {
+ display: flex;
+ align-items: center;
+ }
+ .autocompile {}
+ .autocompileTitle {
+ font-weight: bold;
+ margin: 1% 0;
+ }
+ .autocompileText {
+ margin: 1% 0;
+ font-size: 12px;
+ overflow: hidden;
+ word-break: normal;
+ line-height: initial;
+ }
+ .warnCompilationSlow {
+ margin-left: 1%;
+ }
+ .compilerConfig {
+ display: flex;
+ align-items: center;
+ }
+ .compilerConfig label {
+ margin: 0;
+ }
+ .compilerSection {
+ padding: 12px 24px 16px;
+ }
+ .compilerLabel {
+ margin-bottom: 2px;
+ font-size: 11px;
+ line-height: 12px;
+ text-transform: uppercase;
+ }
+ .copyButton {
+ padding: 6px;
+ font-weight: bold;
+ font-size: 11px;
+ line-height: 15px;
+ }
+ .name {
+ display: flex;
+ }
+ .size {
+ display: flex;
+ }
+ .checkboxes {
+ display: flex;
+ width: 100%;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ }
+ .compileButton {
+ width: 100%;
+ margin: 15px 0 10px 0;
+ font-size: 12px;
+ }
+ .container {
+ margin: 0;
+ margin-bottom: 2%;
+ }
+ .optimizeContainer {
+ display: flex;
+ }
+ .noContractAlert {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+ .contractHelperButtons {
+ margin-top: 6px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ float: right;
+ }
+ .copyToClipboard {
+ font-size: 1rem;
+ }
+ .copyIcon {
+ margin-right: 5px;
+ }
+ .log {
+ display: flex;
+ flex-direction: column;
+ margin-bottom: 5%;
+ overflow: visible;
+ }
+ .key {
+ margin-right: 5px;
+ text-transform: uppercase;
+ width: 100%;
+ }
+ .value {
+ display: flex;
+ width: 100%;
+ margin-top: 1.5%;
+ }
+ .questionMark {
+ margin-left: 2%;
+ cursor: pointer;
+ }
+ .questionMark:hover {
+ }
+ .detailsJSON {
+ padding: 8px 0;
+ border: none;
+ }
+ .icon {
+ margin-right: 0.3em;
+ }
+ .errorBlobs {
+ padding-left: 5px;
+ padding-right: 5px;
+ word-break: break-word;
+ }
+ .storageLogo {
+ width: 20px;
+ height: 20px;
+ }
+ .spinningIcon {
+ display: inline-block;
+ position: relative;
+ animation: spin 2s infinite linear;
+ -moz-animation: spin 2s infinite linear;
+ -o-animation: spin 2s infinite linear;
+ -webkit-animation: spin 2s infinite linear;
+ }
+ @keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+ @-webkit-keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+ @-moz-keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+ @-o-keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+ @-ms-keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+
+ .bouncingIcon {
+ display: inline-block;
+ position: relative;
+ -moz-animation: bounce 2s infinite linear;
+ -o-animation: bounce 2s infinite linear;
+ -webkit-animation: bounce 2s infinite linear;
+ animation: bounce 2s infinite linear;
+ }
+
+ @-webkit-keyframes bounce {
+ 0% { top: 0; }
+ 50% { top: -0.2em; }
+ 70% { top: -0.3em; }
+ 100% { top: 0; }
+ }
+ @-moz-keyframes bounce {
+ 0% { top: 0; }
+ 50% { top: -0.2em; }
+ 70% { top: -0.3em; }
+ 100% { top: 0; }
+ }
+ @-o-keyframes bounce {
+ 0% { top: 0; }
+ 50% { top: -0.2em; }
+ 70% { top: -0.3em; }
+ 100% { top: 0; }
+ }
+ @-ms-keyframes bounce {
+ 0% { top: 0; }
+ 50% { top: -0.2em; }
+ 70% { top: -0.3em; }
+ 100% { top: 0; }
+ }
+ @keyframes bounce {
+ 0% { top: 0; }
+ 50% { top: -0.2em; }
+ 70% { top: -0.3em; }
+ 100% { top: 0; }
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/debugger-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/debugger-tab-styles.js
new file mode 100644
index 0000000000..6a15d2cf56
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/debugger-tab-styles.js
@@ -0,0 +1,12 @@
+var csjs = require('csjs-inject')
+
+const css = csjs`
+ .debuggerTabView {
+ padding: 2%;
+ }
+ .debugger {
+ margin-bottom: 1%;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/plugin-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/plugin-tab-styles.js
new file mode 100644
index 0000000000..45c593ac46
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/plugin-tab-styles.js
@@ -0,0 +1,15 @@
+var csjs = require('csjs-inject')
+
+const css = csjs`
+ .pluginTabView {
+ height: 100%;
+ width: 100%;
+ }
+ .iframe {
+ height: 100%;
+ width: 100%;
+ border: 0;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/run-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/run-tab-styles.js
new file mode 100644
index 0000000000..357464372f
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/run-tab-styles.js
@@ -0,0 +1,224 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .runTabView {
+ display: flex;
+ flex-direction: column;
+ }
+ .runTabView::-webkit-scrollbar {
+ display: none;
+ }
+ .settings {
+ padding: 0 24px 16px;
+ }
+ .crow {
+ display: block;
+ margin-top: 8px;
+ }
+ .col1 {
+ width: 30%;
+ float: left;
+ align-self: center;
+ }
+ .settingsLabel {
+ font-size: 11px;
+ margin-bottom: 4px;
+ text-transform: uppercase;
+ }
+ .environment {
+ display: flex;
+ align-items: center;
+ position: relative;
+ width: 100%;
+ }
+ .environment a {
+ margin-left: 7px;
+ }
+ .account {
+ display: flex;
+ align-items: center;
+ }
+ .account i {
+ margin-left: 12px;
+ }
+ .col2 {
+ border-radius: 3px;
+ }
+ .col2_1 {
+ width: 164px;
+ min-width: 164px;
+ }
+ .col2_2 {
+ }
+ .select {
+ font-weight: normal;
+ width: 100%;
+ }
+ .instanceContainer {
+ display: flex;
+ flex-direction: column;
+ margin-bottom: 2%;
+ border: none;
+ text-align: center;
+ padding: 0 14px 16px;
+ }
+ .pendingTxsContainer {
+ display: flex;
+ flex-direction: column;
+ margin-top: 2%;
+ border: none;
+ text-align: center;
+ }
+ .container {
+ padding: 0 24px 16px;
+ }
+ .recorderDescription {
+ margin: 0 15px 15px 0;
+ }
+ .contractNames {
+ width: 100%;
+ border: 1px solid
+ }
+ .subcontainer {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ margin-bottom: 8px;
+ }
+ .subcontainer i {
+ width: 16px;
+ display: flex;
+ justify-content: center;
+ margin-left: 1px;
+ }
+ .button button{
+ flex: none;
+ }
+ .button {
+ display: flex;
+ align-items: center;
+ margin-top: 13px;
+ }
+ .transaction {
+ }
+ .atAddress {
+ margin: 0;
+ min-width: 100px;
+ width: 100px;
+ height: 100%;
+ word-break: inherit;
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ border-right: 0;
+ }
+ .atAddressSect {
+ margin-top: 8px;
+ height: 32px;
+ }
+ .atAddressSect input {
+ height: 32px;
+ border-top-left-radius: 0 !important;
+ border-bottom-left-radius: 0 !important;
+ }
+ .ataddressinput {
+ padding: .25rem;
+ }
+ .create {
+ }
+ .input {
+ font-size: 10px !important;
+ }
+ .noInstancesText {
+ font-style: italic;
+ text-align: left;
+ padding-left: 15px;
+ }
+ .pendingTxsText {
+ font-style: italic;
+ display: flex;
+ justify-content: space-evenly;
+ align-items: center;
+ flex-wrap: wrap;
+ }
+ .item {
+ margin-right: 1em;
+ display: flex;
+ align-items: center;
+ }
+ .pendingContainer {
+ display: flex;
+ align-items: baseline;
+ }
+ .pending {
+ height: 25px;
+ text-align: center;
+ padding-left: 10px;
+ border-radius: 3px;
+ margin-left: 5px;
+ }
+ .disableMouseEvents {
+ pointer-events: none;
+ }
+ .icon {
+ cursor: pointer;
+ font-size: 12px;
+ cursor: pointer;
+ margin-left: 5px;
+ }
+ .icon:hover {
+ font-size: 12px;
+ color: var(--warning);
+ }
+ .errorIcon {
+ color: var(--warning);
+ margin-left: 15px;
+ }
+ .failDesc {
+ color: var(--warning);
+ padding-left: 10px;
+ display: inline;
+ }
+ .network {
+ margin-left: 8px;
+ pointer-events: none;
+ }
+ .networkItem {
+ margin-right: 5px;
+ }
+ .transactionActions {
+ display: flex;
+ justify-content: space-evenly;
+ width: 145px;
+ }
+ .orLabel {
+ text-align: center;
+ text-transform: uppercase;
+ }
+ .infoDeployAction {
+ margin-left: 1px;
+ font-size: 13px;
+ color: var(--info);
+ }
+ .gasValueContainer {
+ flex-direction: row;
+ display: flex;
+ }
+ .gasNval {
+ width: 55%;
+ font-size: 0.8rem;
+ }
+ .gasNvalUnit {
+ width: 41%;
+ margin-left: 10px;
+ font-size: 0.8rem;
+ }
+ .deployDropdown {
+ text-align: center;
+ text-transform: uppercase;
+ }
+ .checkboxAlign {
+ padding-top: 2px;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/settings-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/settings-tab-styles.js
new file mode 100644
index 0000000000..90a4e47069
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/settings-tab-styles.js
@@ -0,0 +1,77 @@
+var csjs = require('csjs-inject')
+
+const css = csjs`
+ .settingsTabView {
+ padding: 2%;
+ }
+ .info {
+ word-break: break-word;
+ font-size: .8rem;
+ }
+ .info h7 {
+ margin-bottom: .5rem;
+ }
+ .frow {
+ margin-bottom: .5rem;
+ }
+ .crow label {
+ cursor:pointer;
+ }
+ .crowNoFlex {
+ overflow: auto;
+ clear: both;
+ }
+ .attention {
+ margin-bottom: 1em;
+ padding: .5em;
+ font-weight: bold;
+ }
+ .heading {
+ margin-bottom: 0;
+ }
+ .explaination {
+ margin-top: 3px;
+ margin-bottom: 3px;
+ }
+ input {
+ width: inherit;
+ }
+ input[type=radio] {
+ margin-top: 2px;
+ }
+ .pluginTextArea {
+ font-family: unset;
+ }
+
+ .removePlugin {
+ cursor: pointer;
+ }
+ .icon {
+ margin-right: .5em;
+ }
+ .aPlugin {
+ display: inline-block;
+ padding-left: 10px;
+ padding-top: 4px;
+ padding-bottom: 6px;
+ max-width: 100px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ vertical-align: middle;
+ }
+ .removePlugin{
+ padding-left: 7px;
+ padding-right: 7px;
+ margin-left: 10px;
+ }
+ .inline {
+ display: inline;
+ width: 32%;
+ }
+ .text, .text:hover {
+ text-decoration: none;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/support-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/support-tab-styles.js
new file mode 100644
index 0000000000..7debd88c3f
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/support-tab-styles.js
@@ -0,0 +1,80 @@
+const csjs = require('csjs-inject')
+
+const css = csjs`
+ .supportTabView {
+ height: 100%;
+ padding: 2%;
+ padding-bottom: 3em;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ overflow-y: auto;
+ }
+ .chat {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ height: 85%;
+ padding: 0;
+ }
+ .chatTitle {
+ height: 40px;
+ width: 90%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-top: 15px;
+ }
+ .chatTitle:hover {
+ cursor: pointer;
+ }
+ .icon {
+ height: 70%;
+ margin-right: 2%;
+ }
+ .chatTitleText {
+ font-size: 17px;
+ font-weight: bold;
+ }
+ .chatTitleText {
+ opacity: 0.8;
+ }
+ .chatIframe {
+ width: 100%;
+ height: 100%;
+ transform: scale(0.9);
+ padding: 0;
+ border: none;
+ }
+ .infoBox {
+ }
+ .remixdinstallation {
+ padding: 3px;
+ border-radius: 2px;
+ margin-left: 5px;
+ }
+ .info {
+ margin-top: 1em;
+ word-break: break-word;
+ }
+ .title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-bottom: 1em;
+ }
+ .crow {
+ display: flex;
+ overflow: auto;
+ clear: both;
+ padding: .2em;
+ }
+ .crow label {
+ cursor:pointer;
+ }
+ .crowNoFlex {
+ overflow: auto;
+ clear: both;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/tabbed-menu-styles.js b/apps/remix-ide/src/app/tabs/styles/tabbed-menu-styles.js
new file mode 100644
index 0000000000..f0adb87f55
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/tabbed-menu-styles.js
@@ -0,0 +1,42 @@
+const csjs = require('csjs-inject')
+const styles = require('../../ui/styles-guide/theme-chooser').chooser()
+
+const css = csjs`
+ .menu {
+ display: flex;
+ background-color: ${styles.rightPanel.BackgroundColor_Pre};
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ }
+ .active {
+ background-color: ${styles.rightPanel.backgroundColor_Tab};
+ color: ${styles.appProperties.mainText_Color}
+ }
+ .options {
+ float: left;
+ padding-top: 0.7em;
+ min-width: 60px;
+ font-size: 0.9em;
+ cursor: pointer;
+ font-size: 1em;
+ text-align: center;
+ }
+ .optionViews {
+ background-color: ${styles.rightPanel.backgroundColor_Tab};
+ overflow: scroll;
+ height: 100%;
+ }
+ .optionViews > div {
+ display: none;
+ }
+ .optionViews .pre {
+ word-wrap: break-word;
+ background-color: ${styles.rightPanel.BackgroundColor_Pre};
+ border-radius: 3px;
+ display: inline-block;
+ padding: 0 0.6em;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/styles/test-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/test-tab-styles.js
new file mode 100644
index 0000000000..ce267b02bf
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/styles/test-tab-styles.js
@@ -0,0 +1,52 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .testTabView {}
+ .infoBox {
+ margin: 5%;
+ }
+ .tests {}
+ .testList {
+ line-height: 2em;
+ display: flex;
+ flex-direction: column;
+ margin: 5%;
+ max-height: 300px;
+ overflow-y: auto;
+
+ }
+ .container {
+ margin: 2%;
+ padding-bottom: 5%;
+ max-height: 300px;
+ overflow-y: auto;
+ }
+ .summaryTitle {
+ font-weight: bold;
+ }
+ .testPass {
+ }
+ .testLog {
+ margin-bottom: 1%;
+ border-radius: 4px;
+ padding: 1% 1% 1% 5%;
+ }
+ .testFailure {
+ }
+ .testFailureSummary {
+ }
+ .title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-bottom: 1em;
+ }
+ .label {
+ display: flex;
+ align-items: center;
+ white-space: nowrap;
+ }
+ .labelOnBtn {
+ border: hidden;
+ }
+`
+module.exports = css
diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js
new file mode 100644
index 0000000000..43017bcb1a
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/test-tab.js
@@ -0,0 +1,584 @@
+var yo = require('yo-yo')
+var async = require('async')
+var tooltip = require('../ui/tooltip')
+var css = require('./styles/test-tab-styles')
+var remixTests = require('@remix-project/remix-tests')
+import { ViewPlugin } from '@remixproject/engine'
+import { canUseWorker, urlFromVersion } from '../compiler/compiler-utils'
+
+const TestTabLogic = require('./testTab/testTab')
+
+const profile = {
+ name: 'solidityUnitTesting',
+ displayName: 'Solidity unit testing',
+ methods: ['testFromPath', 'testFromSource'],
+ events: [],
+ icon: 'assets/img/unitTesting.webp',
+ description: 'Fast tool to generate unit tests for your contracts',
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/unittesting.html'
+}
+
+module.exports = class TestTab extends ViewPlugin {
+ constructor (fileManager, filePanel, compileTab, appManager, renderer) {
+ super(profile)
+ this.compileTab = compileTab
+ this._view = { el: null }
+ this.fileManager = fileManager
+ this.filePanel = filePanel
+ this.data = {}
+ this.appManager = appManager
+ this.renderer = renderer
+ this.hasBeenStopped = false
+ this.runningTestsNumber = 0
+ this.readyTestsNumber = 0
+ this.areTestsRunning = false
+ this.defaultPath = 'browser/tests'
+
+ appManager.event.on('activate', (name) => {
+ if (name === 'solidity') this.updateRunAction()
+ })
+ appManager.event.on('deactivate', (name) => {
+ if (name === 'solidity') this.updateRunAction()
+ })
+ }
+
+ onActivationInternal () {
+ this.testTabLogic = new TestTabLogic(this.fileManager)
+ this.listenToEvents()
+ }
+
+ listenToEvents () {
+ this.filePanel.event.register('newTestFileCreated', file => {
+ var testList = this.view.querySelector("[class^='testList']")
+ var test = this.createSingleTest(file)
+ testList.appendChild(test)
+ this.data.allTests.push(file)
+ this.data.selectedTests.push(file)
+ })
+
+ this.fileManager.events.on('noFileSelected', () => {
+ })
+
+ this.fileManager.events.on('currentFileChanged', (file, provider) => this.updateForNewCurrent(file))
+ }
+
+ updateForNewCurrent (file) {
+ this.updateGenerateFileAction(file)
+ if (!this.areTestsRunning) this.updateRunAction(file)
+ this.testTabLogic.getTests((error, tests) => {
+ if (error) return tooltip(error)
+ this.data.allTests = tests
+ this.data.selectedTests = [...this.data.allTests]
+ this.updateTestFileList(tests)
+ if (!this.testsOutput) return
+ })
+ }
+
+ createSingleTest (testFile) {
+ return yo`
+
+ this.toggleCheckbox(e.target.checked, testFile)} type="checkbox" checked="true">
+ ${testFile}
+
+ `
+ }
+
+ listTests () {
+ if (!this.data.allTests) return []
+ return this.data.allTests.map(
+ testFile => this.createSingleTest(testFile)
+ )
+ }
+
+ toggleCheckbox (eChecked, test) {
+ if (!this.data.selectedTests) {
+ this.data.selectedTests = this._view.el.querySelectorAll('.singleTest:checked')
+ }
+ let selectedTests = this.data.selectedTests
+ selectedTests = eChecked ? [...selectedTests, test] : selectedTests.filter(el => el !== test)
+ this.data.selectedTests = selectedTests
+ let checkAll = this._view.el.querySelector('[id="checkAllTests"]')
+ const runBtn = document.getElementById('runTestsTabRunAction')
+
+ if (eChecked) {
+ checkAll.checked = true
+ const stopBtnInnerText = document.getElementById('runTestsTabStopAction').innerText
+ if ((this.readyTestsNumber === this.runningTestsNumber || this.hasBeenStopped) && stopBtnInnerText.trim() === 'Stop') {
+ runBtn.removeAttribute('disabled')
+ runBtn.setAttribute('title', 'Run tests')
+ }
+ } else if (!selectedTests.length) {
+ checkAll.checked = false
+ runBtn.setAttribute('disabled', 'disabled')
+ runBtn.setAttribute('title', 'No test file selected')
+ }
+ }
+
+ checkAll (event) {
+ const checkBoxes = this._view.el.querySelectorAll('.singleTest')
+ const checkboxesLabels = this._view.el.querySelectorAll('.singleTestLabel')
+ // checks/unchecks all
+ for (let i = 0; i < checkBoxes.length; i++) {
+ checkBoxes[i].checked = event.target.checked
+ this.toggleCheckbox(event.target.checked, checkboxesLabels[i].innerText)
+ }
+ }
+
+ testCallback (result) {
+ this.testsOutput.hidden = false
+ if (result.type === 'contract') {
+ this.testSuite = result.value
+ if (this.testSuites) {
+ this.testSuites.push(this.testSuite)
+ } else {
+ this.testSuites = [this.testSuite]
+ }
+ this.rawFileName = result.filename
+ this.runningTestFileName = this.cleanFileName(this.rawFileName, this.testSuite)
+ this.outputHeader = yo`
+
+ ${this.testSuite} (${this.rawFileName})
+
+ `
+ this.testsOutput.appendChild(this.outputHeader)
+ } else if (result.type === 'testPass') {
+ this.testsOutput.appendChild(yo`
+
+ ✓ ${result.value}
+
+ `)
+ } else if (result.type === 'testFailure') {
+ if (!result.assertMethod) {
+ this.testsOutput.appendChild(yo`
+
+ ✘ ${result.value}
+ Error Message:
+ "${result.errMsg}"
+
+ `)
+ } else {
+ const preposition = result.assertMethod === 'equal' || result.assertMethod === 'notEqual' ? 'to' : ''
+ const method = result.assertMethod === 'ok' ? '' : result.assertMethod
+ const expected = result.assertMethod === 'ok' ? `'true'` : result.expected
+ this.testsOutput.appendChild(yo`
+
+
✘ ${result.value}
+
Error Message:
+
"${result.errMsg}"
+
Assertion:
+
+
Expected value should be
+
${method}
+
${preposition} ${expected}
+
+
Received value:
+
${result.returned}
+
Skipping the remaining tests of the function.
+
+ `)
+ }
+ }
+ }
+
+ resultsCallback (_err, result, cb) {
+ // total stats for the test
+ // result.passingNum
+ // result.failureNum
+ // result.timePassed
+ cb()
+ }
+
+ cleanFileName (fileName, testSuite) {
+ return fileName ? fileName.replace(/\//g, '_').replace(/\./g, '_') + testSuite : fileName
+ }
+
+ setHeader (status) {
+ if (status) {
+ const label = yo`
+
+ PASS
+
+ `
+
+ this.outputHeader && yo.update(this.outputHeader, yo`
+
+ ${label} ${this.testSuite} (${this.rawFileName})
+
+ `)
+ } else {
+ const label = yo`
+
+ FAIL
+
+ `
+
+ this.outputHeader && yo.update(this.outputHeader, yo`
+
+ ${label} ${this.testSuite} (${this.rawFileName})
+
+ `)
+ }
+ }
+
+ updateFinalResult (_errors, result, filename) {
+ ++this.readyTestsNumber
+ this.testsOutput.hidden = false
+ if (!result && (_errors || _errors.errors || Array.isArray(_errors) && (_errors[0].message || _errors[0].formattedMessage))) {
+ this.testCallback({ type: 'contract', filename })
+ this.setHeader(false)
+ }
+ if (_errors && _errors.errors) {
+ _errors.errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsOutput, {type: err.severity}))
+ } else if (_errors && Array.isArray(_errors) && (_errors[0].message || _errors[0].formattedMessage)) {
+ _errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsOutput, {type: err.severity}))
+ } else if (_errors && !_errors.errors && !Array.isArray(_errors)) {
+ // To track error like this: https://github.com/ethereum/remix/pull/1438
+ this.renderer.error(_errors.formattedMessage || _errors.message, this.testsOutput, {type: 'error'})
+ }
+ yo.update(this.resultStatistics, this.createResultLabel())
+ if (result) {
+ const totalTime = parseFloat(result.totalTime).toFixed(2)
+
+ if (result.totalPassing > 0 && result.totalFailing > 0) {
+ this.testsOutput.appendChild(yo`
+
+ Result for ${filename}
+ Passing: ${result.totalPassing}
+ Failing: ${result.totalFailing}
+ Total time: ${totalTime}s
+
+ `)
+ } else if (result.totalPassing > 0 && result.totalFailing <= 0) {
+ this.testsOutput.appendChild(yo`
+
+ Result for ${filename}
+ Passing: ${result.totalPassing}
+ Total time: ${totalTime}s
+
+ `)
+ } else if (result.totalPassing <= 0 && result.totalFailing > 0) {
+ this.testsOutput.appendChild(yo`
+
+ Result for ${filename}
+ Failing: ${result.totalFailing}
+ Total time: ${totalTime}s
+
+ `)
+ }
+ // fix for displaying right label for multiple tests (testsuites) in a single file
+ this.testSuites.forEach(testSuite => {
+ this.testSuite = testSuite
+ this.runningTestFileName = this.cleanFileName(filename, this.testSuite)
+ this.outputHeader = document.querySelector(`#${this.runningTestFileName}`)
+ this.setHeader(true)
+ })
+
+ result.errors.forEach((error, index) => {
+ this.testSuite = error.context
+ this.runningTestFileName = this.cleanFileName(filename, error.context)
+ this.outputHeader = document.querySelector(`#${this.runningTestFileName}`)
+ const isFailingLabel = document.querySelector(`.failed_${this.runningTestFileName}`)
+ if (!isFailingLabel) this.setHeader(false)
+ })
+ this.testsOutput.appendChild(yo`
+
+ `)
+ }
+ if (this.hasBeenStopped && (this.readyTestsNumber !== this.runningTestsNumber)) {
+ // if all tests has been through before stopping no need to print this.
+ this.testsExecutionStopped.hidden = false
+ }
+ if (_errors) this.testsExecutionStoppedError.hidden = false
+ if (_errors || this.hasBeenStopped || this.readyTestsNumber === this.runningTestsNumber) {
+ // All tests are ready or the operation has been canceled or there was a compilation error in one of the test files.
+ const stopBtn = document.getElementById('runTestsTabStopAction')
+ stopBtn.setAttribute('disabled', 'disabled')
+ const stopBtnLabel = document.getElementById('runTestsTabStopActionLabel')
+ stopBtnLabel.innerText = 'Stop'
+ if (this.data.selectedTests.length !== 0) {
+ const runBtn = document.getElementById('runTestsTabRunAction')
+ runBtn.removeAttribute('disabled')
+ }
+ this.areTestsRunning = false
+ }
+ }
+
+ async testFromPath (path) {
+ const fileContent = await this.fileManager.readFile(path)
+ return this.testFromSource(fileContent, path)
+ }
+
+ /*
+ Test is not associated with the UI
+ */
+ testFromSource (content, path = 'browser/unit_test.sol') {
+ return new Promise((resolve, reject) => {
+ let runningTest = {}
+ runningTest[path] = { content }
+ const {currentVersion, evmVersion, optimize} = this.compileTab.getCurrentCompilerConfig()
+ const currentCompilerUrl = urlFromVersion(currentVersion)
+ const compilerConfig = {
+ currentCompilerUrl,
+ evmVersion,
+ optimize,
+ usingWorker: canUseWorker(currentVersion)
+ }
+ remixTests.runTestSources(runningTest, compilerConfig, () => {}, () => {}, (error, result) => {
+ if (error) return reject(error)
+ resolve(result)
+ }, (url, cb) => {
+ return this.compileTab.compileTabLogic.importFileCb(url, cb)
+ })
+ })
+ }
+
+ runTest (testFilePath, callback) {
+ if (this.hasBeenStopped) {
+ this.updateFinalResult()
+ return
+ }
+ this.resultStatistics.hidden = false
+ this.fileManager.readFile(testFilePath).then((content) => {
+ const runningTest = {}
+ runningTest[testFilePath] = { content }
+ const {currentVersion, evmVersion, optimize} = this.compileTab.getCurrentCompilerConfig()
+ const currentCompilerUrl = urlFromVersion(currentVersion)
+ const compilerConfig = {
+ currentCompilerUrl,
+ evmVersion,
+ optimize,
+ usingWorker: canUseWorker(currentVersion)
+ }
+ remixTests.runTestSources(
+ runningTest,
+ compilerConfig,
+ (result) => this.testCallback(result),
+ (_err, result, cb) => this.resultsCallback(_err, result, cb),
+ (error, result) => {
+ this.updateFinalResult(error, result, testFilePath)
+ callback(error)
+ }, (url, cb) => {
+ return this.compileTab.compileTabLogic.importFileCb(url, cb)
+ }
+ )
+ }).catch((error) => {
+ if (error) return
+ })
+ }
+
+ updateCurrentPath (e) {
+ const newValue = e.target.value === '' ? this.defaultPath : e.target.value
+ this.testTabLogic.setCurrentPath(newValue)
+ this.updateRunAction()
+ this.updateForNewCurrent()
+ }
+
+ runTests () {
+ this.areTestsRunning = true
+ this.hasBeenStopped = false
+ this.readyTestsNumber = 0
+ this.runningTestsNumber = this.data.selectedTests.length
+ yo.update(this.resultStatistics, this.createResultLabel())
+ const stopBtn = document.getElementById('runTestsTabStopAction')
+ stopBtn.removeAttribute('disabled')
+ const runBtn = document.getElementById('runTestsTabRunAction')
+ runBtn.setAttribute('disabled', 'disabled')
+ this.call('editor', 'clearAnnotations')
+ this.testsOutput.innerHTML = ''
+ this.testsOutput.hidden = true
+ this.testsExecutionStopped.hidden = true
+ this.testsExecutionStoppedError.hidden = true
+ const tests = this.data.selectedTests
+ if (!tests) return
+ this.resultStatistics.hidden = tests.length === 0
+ async.eachOfSeries(tests, (value, key, callback) => {
+ if (this.hasBeenStopped) return
+ this.runTest(value, callback)
+ })
+ }
+
+ stopTests () {
+ this.hasBeenStopped = true
+ const stopBtnLabel = document.getElementById('runTestsTabStopActionLabel')
+ stopBtnLabel.innerText = 'Stopping'
+ const stopBtn = document.getElementById('runTestsTabStopAction')
+ stopBtn.setAttribute('disabled', 'disabled')
+ const runBtn = document.getElementById('runTestsTabRunAction')
+ runBtn.setAttribute('disabled', 'disabled')
+ }
+
+ updateGenerateFileAction (currentFile) {
+ let el = yo`
+
+ Generate
+
+ `
+ if (!this.generateFileActionElement) {
+ this.generateFileActionElement = el
+ } else {
+ yo.update(this.generateFileActionElement, el)
+ }
+ return this.generateFileActionElement
+ }
+
+ updateRunAction (currentFile) {
+ let el = yo`
+
+
+ Run
+
+ `
+ const isSolidityActive = this.appManager.isActive('solidity')
+ if (!isSolidityActive || !this.listTests().length) {
+ el.setAttribute('disabled', 'disabled')
+ if (!currentFile || (currentFile && currentFile.split('.').pop().toLowerCase() !== 'sol')) {
+ el.setAttribute('title', 'No solidity file selected')
+ } else {
+ el.setAttribute('title', 'The "Solidity Plugin" should be activated')
+ // @todo(#2747) we can activate the plugin here
+ }
+ }
+ if (!this.runActionElement) {
+ this.runActionElement = el
+ } else {
+ yo.update(this.runActionElement, el)
+ }
+ return this.runActionElement
+ }
+
+ updateStopAction () {
+ return yo`
+ this.stopTests()}">
+
+ Stop
+
+ `
+ }
+
+ updateTestFileList (tests) {
+ const testsMessage = (tests && tests.length ? this.listTests() : 'No test file available')
+ let el = yo`${testsMessage}
`
+ if (!this.testFilesListElement) {
+ this.testFilesListElement = el
+ } else {
+ yo.update(this.testFilesListElement, el)
+ }
+ this.updateRunAction()
+ return this.testFilesListElement
+ }
+
+ selectAll () {
+ return yo`
+
+
+ Select all
+
+ `
+ }
+
+ infoButton () {
+ return yo`
+
+ How to use...
+
+ `
+ }
+
+ createResultLabel () {
+ if (!this.data.selectedTests) return yo` `
+ const ready = this.readyTestsNumber ? `${this.readyTestsNumber}` : '0'
+ return yo`Progress: ${ready} finished (of ${this.runningTestsNumber}) `
+ }
+
+ updateDirList () {
+ for (var o of this.uiPathList.querySelectorAll('option')) o.remove()
+ this.uiPathList.appendChild(yo`browser `)
+ if (this.testTabLogic.isRemixDActive()) this.uiPathList.appendChild(yo`localhost `)
+ if (!this._view.el) return
+ this.testTabLogic.dirList(this.inputPath.value).then((options) => {
+ options.forEach((path) => this.uiPathList.appendChild(yo`${path} `))
+ })
+ }
+
+ render () {
+ this.onActivationInternal()
+ this.testsOutput = yo``
+ this.testsExecutionStopped = yo`
The test execution has been stopped `
+ this.testsExecutionStoppedError = yo`
The test execution has been stopped because of error(s) in your test file `
+ this.uiPathList = yo`
`
+ this.inputPath = yo`
{ if (e.keyCode === 191) this.updateDirList() }}
+ onchange=${(e) => this.updateCurrentPath(e)}/>`
+
+ const availablePaths = yo`
+
+ ${this.inputPath}
+ ${this.uiPathList}
+
+ `
+ this.updateDirList()
+ this.testsExecutionStopped.hidden = true
+ this.testsExecutionStoppedError.hidden = true
+ this.resultStatistics = this.createResultLabel()
+ this.resultStatistics.hidden = true
+ const el = yo`
+
+
+
Test your smart contract in Solidity.
+
Select directory to load and generate test files.
+
Test directory:
+ ${availablePaths}
+
+
+
+ ${this.updateGenerateFileAction()}
+ ${this.infoButton()}
+
+
+ ${this.updateRunAction()}
+ ${this.updateStopAction()}
+
+ ${this.selectAll()}
+ ${this.updateTestFileList()}
+
+ ${this.resultStatistics}
+ ${this.testsExecutionStopped}
+ ${this.testsExecutionStoppedError}
+
+ ${this.testsOutput}
+
+
+ `
+ this._view.el = el
+ this.testTabLogic.setCurrentPath(this.defaultPath)
+ this.updateForNewCurrent(this.fileManager.currentFile())
+ return el
+ }
+
+}
diff --git a/apps/remix-ide/src/app/tabs/testTab/testTab.js b/apps/remix-ide/src/app/tabs/testTab/testTab.js
new file mode 100644
index 0000000000..964b431337
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/testTab/testTab.js
@@ -0,0 +1,101 @@
+const helper = require('../../../lib/helper.js')
+const modalDialogCustom = require('../../ui/modal-dialog-custom')
+const remixPath = require('path')
+
+class TestTabLogic {
+
+ constructor (fileManager) {
+ this.fileManager = fileManager
+ this.currentPath = 'browser/tests'
+ }
+
+ setCurrentPath (path) {
+ if (path.indexOf('/') === 0) return
+ this.currentPath = path
+ const fileProvider = this.fileManager.fileProviderOf(path.split('/')[0])
+ fileProvider.exists(path, (e, res) => { if (!res) fileProvider.createDir(path) })
+ }
+
+ generateTestFile () {
+ let fileName = this.fileManager.currentFile()
+ const hasCurrent = !!fileName && this.fileManager.currentFile().split('.').pop().toLowerCase() === 'sol'
+ if (!hasCurrent) fileName = this.currentPath + '/newFile.sol'
+ const fileProvider = this.fileManager.fileProviderOf(this.currentPath)
+ if (!fileProvider) return
+ const splittedFileName = fileName.split('/')
+ let fileNameToImport = (!hasCurrent) ? fileName : this.currentPath + '/' + splittedFileName[splittedFileName.length - 1]
+ helper.createNonClashingNameWithPrefix(fileNameToImport, fileProvider, '_test', (error, newFile) => {
+ if (error) return modalDialogCustom.alert('Failed to create file. ' + newFile + ' ' + error)
+ if (!fileProvider.set(newFile, this.generateTestContractSample(hasCurrent, fileName))) return modalDialogCustom.alert('Failed to create test file ' + newFile)
+ this.fileManager.open(newFile)
+ this.fileManager.syncEditor(newFile)
+ })
+ }
+
+ dirList (path) {
+ return this.fileManager.dirList(path)
+ }
+
+ isRemixDActive () {
+ return this.fileManager.isRemixDActive()
+ }
+
+ async getTests (cb) {
+ if (!this.currentPath) return cb(null, [])
+ const provider = this.fileManager.fileProviderOf(this.currentPath)
+ if (!provider) return cb(null, [])
+ const tests = []
+ let files
+ try {
+ files = await this.fileManager.readdir(this.currentPath)
+ } catch (e) {
+ cb(e.message)
+ }
+ for (var file in files) {
+ if (/.(_test.sol)$/.exec(file)) tests.push(provider.type + '/' + file)
+ }
+ cb(null, tests, this.currentPath)
+ }
+
+ // @todo(#2758): If currently selected file is compiled and compilation result is available,
+ // 'contractName' should be
+ '_testSuite'
+ generateTestContractSample (hasCurrent, fileToImport, contractName = 'testSuite') {
+ let relative = remixPath.relative(this.currentPath, remixPath.dirname(fileToImport))
+ if (relative === '') relative = '.'
+ const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// Import here the file to test.'
+ return `pragma solidity >=0.4.22 <0.7.0;
+import "remix_tests.sol"; // this import is automatically injected by Remix.
+${comment}
+
+// File name has to end with '_test.sol', this file can contain more than one testSuite contracts
+contract ${contractName} {
+
+ /// 'beforeAll' runs before all other tests
+ /// More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll'
+ function beforeAll() public {
+ // Here should instantiate tested contract
+ Assert.equal(uint(1), uint(1), "1 should be equal to 1");
+ }
+
+ function checkSuccess() public {
+ // Use 'Assert' to test the contract,
+ // See documentation: https://remix-ide.readthedocs.io/en/latest/assert_library.html
+ Assert.equal(uint(2), uint(2), "2 should be equal to 2");
+ Assert.notEqual(uint(2), uint(3), "2 should not be equal to 3");
+ }
+
+ function checkSuccess2() public pure returns (bool) {
+ // Use the return value (true or false) to test the contract
+ return true;
+ }
+
+ function checkFailure() public {
+ Assert.equal(uint(1), uint(2), "1 is not equal to 2");
+ }
+}
+`
+ }
+
+}
+
+module.exports = TestTabLogic
diff --git a/apps/remix-ide/src/app/tabs/theme-module.js b/apps/remix-ide/src/app/tabs/theme-module.js
new file mode 100644
index 0000000000..53cd18c8b8
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/theme-module.js
@@ -0,0 +1,99 @@
+import { Plugin } from '@remixproject/engine'
+import { EventEmitter } from 'events'
+import QueryParams from '../../lib/query-params'
+import * as packageJson from '../../../../../package.json'
+import yo from 'yo-yo'
+
+const themes = [
+ {name: 'Dark', quality: 'dark', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-dark_tvx1s2.css'},
+ {name: 'Light', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1597918237/remix-themes/PR365/remix-light_powaqg.css'},
+ {name: 'Midcentury', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014334/remix-themes/PR365/remix-midcentury_hrzph3.css'},
+ {name: 'Black', quality: 'dark', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014334/remix-themes/PR365/remix-black_undtds.css'},
+ {name: 'Candy', quality: 'light', url: 'https://res.cloudinary.com/lianahus/raw/upload/v1598014799/remix-themes/PR365/remix-candy_ikhg4m.css'},
+
+ {name: 'Cerulean', quality: 'light', url: 'https://bootswatch.com/4/cerulean/bootstrap.min.css'},
+ {name: 'Flatly', quality: 'light', url: 'https://bootswatch.com/4/flatly/bootstrap.min.css'},
+ {name: 'Spacelab', quality: 'light', url: 'https://bootswatch.com/4/spacelab/bootstrap.min.css'},
+ {name: 'Cyborg', quality: 'dark', url: 'https://bootswatch.com/4/cyborg/bootstrap.min.css'}
+]
+
+const profile = {
+ name: 'theme',
+ events: ['themeChanged'],
+ methods: ['switchTheme', 'getThemes', 'currentTheme'],
+ version: packageJson.version,
+ kind: 'theme'
+}
+
+export class ThemeModule extends Plugin {
+
+ constructor (registry) {
+ super(profile)
+ this.events = new EventEmitter()
+ this._deps = {
+ config: registry.get('config').api
+ }
+ this.themes = themes.reduce((acc, theme) => ({ ...acc, [theme.name]: theme }), {})
+ let queryTheme = (new QueryParams()).get().theme
+ queryTheme = this.themes[queryTheme] ? queryTheme : null
+ let currentTheme = this._deps.config.get('settings/theme')
+ currentTheme = this.themes[currentTheme] ? currentTheme : null
+ this.active = queryTheme || currentTheme || 'Dark'
+ this.forced = queryTheme !== undefined
+ }
+
+ /** Return the active theme */
+ currentTheme () {
+ return this.themes[this.active]
+ }
+
+ /** Returns all themes as an array */
+ getThemes () {
+ return Object.keys(this.themes).map(key => this.themes[key])
+ }
+
+ /**
+ * Init the theme
+ */
+ initTheme (callback) {
+ if (this.active) {
+ const nextTheme = this.themes[this.active] // Theme
+ document.documentElement.style.setProperty('--theme', nextTheme.quality)
+ const theme = yo` `
+ theme.addEventListener('load', () => {
+ if (callback) callback()
+ })
+ document.head.insertBefore(theme, document.head.firstChild)
+ }
+ }
+
+ /**
+ * Change the current theme
+ * @param {string} [themeName] - The name of the theme
+ */
+ switchTheme (themeName) {
+ if (themeName && !Object.keys(this.themes).includes(themeName)) {
+ throw new Error(`Theme ${themeName} doesn't exist`)
+ }
+ const next = themeName || this.active // Name
+ const nextTheme = this.themes[next] // Theme
+ if (!this.forced) this._deps.config.set('settings/theme', next)
+ document.getElementById('theme-link').setAttribute('href', nextTheme.url)
+ document.documentElement.style.setProperty('--theme', nextTheme.quality)
+ if (themeName) this.active = themeName
+ // TODO: Only keep `this.emit` (issue#2210)
+ this.emit('themeChanged', nextTheme)
+ this.events.emit('themeChanged', nextTheme)
+ }
+
+ /**
+ * fixes the invertion for images since this should be adjusted when we switch between dark/light qualified themes
+ * @param {element} [image] - the dom element which invert should be fixed to increase visibility
+ */
+ fixInvert (image) {
+ const invert = this.currentTheme().quality === 'dark' ? 1 : 0
+ if (image) {
+ image.style.filter = `invert(${invert})`
+ }
+ }
+}
diff --git a/apps/remix-ide/src/app/tabs/web3-provider.js b/apps/remix-ide/src/app/tabs/web3-provider.js
new file mode 100644
index 0000000000..4ab36888ef
--- /dev/null
+++ b/apps/remix-ide/src/app/tabs/web3-provider.js
@@ -0,0 +1,31 @@
+import { Plugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+export const profile = {
+ name: 'web3Provider',
+ displayName: 'Global Web3 Provider',
+ description: 'Represent the current web3 provider used by the app at global scope',
+ methods: ['sendAsync'],
+ version: packageJson.version,
+ kind: 'provider'
+}
+
+export class Web3ProviderModule extends Plugin {
+ constructor (blockchain) {
+ super(profile)
+ this.blockchain = blockchain
+ }
+
+ /*
+ that is used by plugins to call the current ethereum provider.
+ Should be taken carefully and probably not be release as it is now.
+ */
+ sendAsync (payload) {
+ return new Promise((resolve, reject) => {
+ this.blockchain.web3().currentProvider.sendAsync(payload, (error, message) => {
+ if (error) return reject(error)
+ resolve(message)
+ })
+ })
+ }
+}
diff --git a/apps/remix-ide/src/app/udapp/index.js b/apps/remix-ide/src/app/udapp/index.js
new file mode 100644
index 0000000000..8f1c93711f
--- /dev/null
+++ b/apps/remix-ide/src/app/udapp/index.js
@@ -0,0 +1,2 @@
+export * from './run-tab'
+export * from './make-udapp'
diff --git a/apps/remix-ide/src/app/udapp/make-udapp.js b/apps/remix-ide/src/app/udapp/make-udapp.js
new file mode 100644
index 0000000000..b7f8dff5b2
--- /dev/null
+++ b/apps/remix-ide/src/app/udapp/make-udapp.js
@@ -0,0 +1,56 @@
+var registry = require('../../global/registry')
+var remixLib = require('@remix-project/remix-lib')
+var yo = require('yo-yo')
+var EventsDecoder = remixLib.execution.EventsDecoder
+var TransactionReceiptResolver = require('../../lib/transactionReceiptResolver')
+
+const transactionDetailsLinks = {
+ 'Main': 'https://www.etherscan.io/tx/',
+ 'Rinkeby': 'https://rinkeby.etherscan.io/tx/',
+ 'Ropsten': 'https://ropsten.etherscan.io/tx/',
+ 'Kovan': 'https://kovan.etherscan.io/tx/',
+ 'Goerli': 'https://goerli.etherscan.io/tx/'
+}
+
+function txDetailsLink (network, hash) {
+ if (transactionDetailsLinks[network]) {
+ return transactionDetailsLinks[network] + hash
+ }
+}
+
+export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) {
+ // ----------------- UniversalDApp -----------------
+ // TODO: to remove when possible
+ blockchain.event.register('transactionBroadcasted', (txhash, networkName) => {
+ var txLink = txDetailsLink(networkName, txhash)
+ if (txLink && logHtmlCallback) logHtmlCallback(yo`${txLink} `)
+ })
+
+ // ----------------- Tx listener -----------------
+ const transactionReceiptResolver = new TransactionReceiptResolver(blockchain)
+
+ const txlistener = blockchain.getTxListener({
+ api: {
+ contracts: function () {
+ if (compilersArtefacts['__last']) return compilersArtefacts.getAllContractDatas()
+ return null
+ },
+ resolveReceipt: function (tx, cb) {
+ transactionReceiptResolver.resolve(tx, cb)
+ }
+ }
+ })
+
+ registry.put({api: txlistener, name: 'txlistener'})
+ blockchain.startListening(txlistener)
+
+ const eventsDecoder = new EventsDecoder({
+ api: {
+ resolveReceipt: function (tx, cb) {
+ transactionReceiptResolver.resolve(tx, cb)
+ }
+ }
+ })
+ txlistener.startListening()
+ registry.put({api: eventsDecoder, name: 'eventsDecoder'})
+}
diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js
new file mode 100644
index 0000000000..a12adbb1d8
--- /dev/null
+++ b/apps/remix-ide/src/app/udapp/run-tab.js
@@ -0,0 +1,229 @@
+import { LibraryPlugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+
+const $ = require('jquery')
+const yo = require('yo-yo')
+const ethJSUtil = require('ethereumjs-util')
+const Web3 = require('web3')
+const EventManager = require('../../lib/events')
+const Card = require('../ui/card')
+
+const css = require('../tabs/styles/run-tab-styles')
+const SettingsUI = require('../tabs/runTab/settings.js')
+const Recorder = require('../tabs/runTab/model/recorder.js')
+const RecorderUI = require('../tabs/runTab/recorder.js')
+const DropdownLogic = require('../tabs/runTab/model/dropdownlogic.js')
+const ContractDropdownUI = require('../tabs/runTab/contractDropdown.js')
+
+const UniversalDAppUI = require('../ui/universal-dapp-ui')
+
+const profile = {
+ name: 'udapp',
+ displayName: 'Deploy & run transactions',
+ icon: 'assets/img/deployAndRun.webp',
+ description: 'execute and save transactions',
+ kind: 'udapp',
+ location: 'sidePanel',
+ documentation: 'https://remix-ide.readthedocs.io/en/latest/run.html',
+ version: packageJson.version,
+ permission: true,
+ events: ['newTransaction'],
+ methods: ['createVMAccount', 'sendTransaction', 'getAccounts', 'pendingTransactionsCount']
+}
+
+export class RunTab extends LibraryPlugin {
+
+ constructor (blockchain, pluginUDapp, config, fileManager, editor, filePanel, compilersArtefacts, networkModule, mainView, fileProvider) {
+ super(pluginUDapp, profile)
+ this.event = new EventManager()
+ this.config = config
+ this.blockchain = blockchain
+ this.fileManager = fileManager
+ this.editor = editor
+ this.logCallback = (msg) => { mainView.getTerminal().logHtml(msg) }
+ this.filePanel = filePanel
+ this.compilersArtefacts = compilersArtefacts
+ this.networkModule = networkModule
+ this.fileProvider = fileProvider
+ }
+
+ renderContainer () {
+ this.container = yo`
`
+
+ var el = yo`
+
+ ${this.settingsUI.render()}
+ ${this.contractDropdownUI.render()}
+ ${this.recorderCard.render()}
+ ${this.instanceContainer}
+
+ `
+ this.container.appendChild(el)
+ return this.container
+ }
+
+ renderInstanceContainer () {
+ this.instanceContainer = yo`
`
+
+ const instanceContainerTitle = yo`
+
+ Deployed Contracts
+ this.event.trigger('clearInstance', [])}
+ title="Clear instances list and reset recorder" aria-hidden="true">
+
+
`
+
+ this.noInstancesText = yo`
+
+ Currently you have no contract instances to interact with.
+ `
+
+ this.event.register('clearInstance', () => {
+ this.instanceContainer.innerHTML = '' // clear the instances list
+ this.instanceContainer.appendChild(instanceContainerTitle)
+ this.instanceContainer.appendChild(this.noInstancesText)
+ })
+
+ this.instanceContainer.appendChild(instanceContainerTitle)
+ this.instanceContainer.appendChild(this.noInstancesText)
+ }
+
+ renderSettings () {
+ this.settingsUI = new SettingsUI(this.blockchain, this.networkModule)
+
+ this.settingsUI.event.register('clearInstance', () => {
+ this.event.trigger('clearInstance', [])
+ })
+ }
+
+ renderDropdown (udappUI, fileManager, compilersArtefacts, config, editor, logCallback) {
+ const dropdownLogic = new DropdownLogic(compilersArtefacts, config, editor, this)
+ this.contractDropdownUI = new ContractDropdownUI(this.blockchain, dropdownLogic, logCallback, this)
+
+ fileManager.events.on('currentFileChanged', this.contractDropdownUI.changeCurrentFile.bind(this.contractDropdownUI))
+
+ this.contractDropdownUI.event.register('clearInstance', () => {
+ const noInstancesText = this.noInstancesText
+ if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
+ })
+ this.contractDropdownUI.event.register('newContractABIAdded', (abi, address) => {
+ this.instanceContainer.appendChild(udappUI.renderInstanceFromABI(abi, address, ''))
+ })
+ this.contractDropdownUI.event.register('newContractInstanceAdded', (contractObject, address, value) => {
+ this.instanceContainer.appendChild(udappUI.renderInstance(contractObject, address, value))
+ })
+ }
+
+ renderRecorder (udappUI, fileManager, config, logCallback) {
+ this.recorderCount = yo`0 `
+
+ const recorder = new Recorder(this.blockchain, fileManager, config)
+ recorder.event.register('recorderCountChange', (count) => {
+ this.recorderCount.innerText = count
+ })
+ this.event.register('clearInstance', recorder.clearAll.bind(recorder))
+
+ this.recorderInterface = new RecorderUI(this.blockchain, recorder, logCallback, config)
+
+ this.recorderInterface.event.register('newScenario', (abi, address, contractName) => {
+ var noInstancesText = this.noInstancesText
+ if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
+ this.instanceContainer.appendChild(udappUI.renderInstanceFromABI(abi, address, contractName))
+ })
+
+ this.recorderInterface.render()
+ }
+
+ renderRecorderCard () {
+ const collapsedView = yo`
+
+
${this.recorderCount}
+
`
+
+ const expandedView = yo`
+
+
+ All transactions (deployed contracts and function executions) in this environment can be saved and replayed in
+ another environment. e.g Transactions created in Javascript VM can be replayed in the Injected Web3.
+
+
+ ${this.recorderInterface.recordButton}
+ ${this.recorderInterface.runButton}
+
+
+ `
+
+ this.recorderCard = new Card({}, {}, { title: 'Transactions recorded', collapsedView: collapsedView })
+ this.recorderCard.event.register('expandCollapseCard', (arrow, body, status) => {
+ body.innerHTML = ''
+ status.innerHTML = ''
+ if (arrow === 'down') {
+ status.appendChild(collapsedView)
+ body.appendChild(expandedView)
+ } else if (arrow === 'up') {
+ status.appendChild(collapsedView)
+ }
+ })
+ }
+
+ render () {
+ this.udappUI = new UniversalDAppUI(this.blockchain, this.logCallback)
+ this.blockchain.resetAndInit(this.config, {
+ getAddress: (cb) => {
+ cb(null, $('#txorigin').val())
+ },
+ getValue: (cb) => {
+ try {
+ const number = document.querySelector('#value').value
+ const select = document.getElementById('unit')
+ const index = select.selectedIndex
+ const selectedUnit = select.querySelectorAll('option')[index].dataset.unit
+ let unit = 'ether' // default
+ if (['ether', 'finney', 'gwei', 'wei'].indexOf(selectedUnit) >= 0) {
+ unit = selectedUnit
+ }
+ cb(null, Web3.utils.toWei(number, unit))
+ } catch (e) {
+ cb(e)
+ }
+ },
+ getGasLimit: (cb) => {
+ try {
+ cb(null, '0x' + new ethJSUtil.BN($('#gasLimit').val(), 10).toString(16))
+ } catch (e) {
+ cb(e.message)
+ }
+ }
+ })
+ this.renderInstanceContainer()
+ this.renderSettings()
+ this.renderDropdown(this.udappUI, this.fileManager, this.compilersArtefacts, this.config, this.editor, this.logCallback)
+ this.renderRecorder(this.udappUI, this.fileManager, this.config, this.logCallback)
+ this.renderRecorderCard()
+
+ const addPluginProvider = (profile) => {
+ if (profile.kind === 'provider') {
+ ((profile, app) => {
+ const web3Provider = {
+ async sendAsync (payload, callback) {
+ try {
+ const result = await app.call(profile.name, 'sendAsync', payload)
+ callback(null, result)
+ } catch (e) {
+ callback(e)
+ }
+ }
+ }
+ app.blockchain.addProvider({ name: profile.displayName, provider: web3Provider })
+ })(profile, this)
+ }
+ }
+ const removePluginProvider = (profile) => {
+ if (profile.kind === 'provider') this.blockchain.removeProvider(profile.displayName)
+ }
+ this.on('manager', 'pluginActivated', addPluginProvider.bind(this))
+ this.on('manager', 'pluginDeactivated', removePluginProvider.bind(this))
+ return this.renderContainer()
+ }
+}
diff --git a/apps/remix-ide/src/app/ui/TreeView.js b/apps/remix-ide/src/app/ui/TreeView.js
new file mode 100644
index 0000000000..5fc62d9552
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/TreeView.js
@@ -0,0 +1,206 @@
+'use strict'
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+var css = csjs`
+ .li_tv {
+ list-style-type: none;
+ -webkit-margin-before: 0px;
+ -webkit-margin-after: 0px;
+ -webkit-margin-start: 0px;
+ -webkit-margin-end: 0px;
+ -webkit-padding-start: 0px;
+ }
+ .ul_tv {
+ list-style-type: none;
+ -webkit-margin-before: 0px;
+ -webkit-margin-after: 0px;
+ -webkit-margin-start: 0px;
+ -webkit-margin-end: 0px;
+ -webkit-padding-start: 0px;
+ }
+ .caret_tv {
+ width: 10px;
+ flex-shrink: 0;
+ padding-right: 5px;
+ }
+ .label_item {
+ word-break: break-all;
+ }
+ .label_key {
+ min-width: 15%;
+ max-width: 80%;
+ word-break: break-word;
+ }
+ .label_value {
+ min-width: 10%;
+ }
+`
+
+var EventManager = require('../../lib/events')
+
+/**
+ * TreeView
+ * - extendable by specifying custom `extractData` and `formatSelf` function
+ * - trigger `nodeClick` and `leafClick`
+ */
+class TreeView {
+
+ constructor (opts) {
+ this.event = new EventManager()
+ this.extractData = opts.extractData || this.extractDataDefault
+ this.formatSelf = opts.formatSelf || this.formatSelfDefault
+ this.view = null
+ this.expandPath = []
+ }
+
+ render (json, expand) {
+ var view = this.renderProperties(json, expand)
+ if (!this.view) {
+ this.view = view
+ }
+ return view
+ }
+
+ update (json) {
+ if (this.view) {
+ yo.update(this.view, this.render(json))
+ }
+ }
+
+ renderObject (item, parent, key, expand, keyPath) {
+ var data = this.extractData(item, parent, key)
+ var children = (data.children || []).map((child, index) => {
+ return this.renderObject(child.value, data, child.key, expand, keyPath + '/' + child.key)
+ })
+ return this.formatData(key, data, children, expand, keyPath)
+ }
+
+ renderProperties (json, expand, key) {
+ key = key || ''
+ var children = Object.keys(json).map((innerkey) => {
+ return this.renderObject(json[innerkey], json, innerkey, expand, innerkey)
+ })
+ return yo``
+ }
+
+ formatData (key, data, children, expand, keyPath) {
+ var self = this
+ var li = yo` `
+ var caret = yo`
`
+ var label = yo`
+
+ ${caret}
+ ${self.formatSelf(key, data, li)}
+
`
+ const expanded = self.expandPath.includes(keyPath)
+ li.appendChild(label)
+ if (data.children) {
+ var list = yo``
+ list.style.display = expanded ? 'block' : 'none'
+ caret.className = list.style.display === 'none' ? `fas fa-caret-right caret ${css.caret_tv}` : `fas fa-caret-down caret ${css.caret_tv}`
+ caret.setAttribute('data-id', `treeViewToggle${keyPath}`)
+ label.onclick = function () {
+ self.expand(keyPath)
+ if (self.isExpanded(keyPath)) {
+ if (!self.expandPath.includes(keyPath)) self.expandPath.push(keyPath)
+ } else {
+ self.expandPath = self.expandPath.filter(path => !path.startsWith(keyPath))
+ }
+ }
+ label.oncontextmenu = function (event) {
+ self.event.trigger('nodeRightClick', [keyPath, data, label, event])
+ }
+ li.appendChild(list)
+ } else {
+ caret.style.visibility = 'hidden'
+ label.oncontextmenu = function (event) {
+ self.event.trigger('leafRightClick', [keyPath, data, label, event])
+ }
+ label.onclick = function (event) {
+ self.event.trigger('leafClick', [keyPath, data, label, event])
+ }
+ }
+ return li
+ }
+
+ isExpanded (path) {
+ var current = this.nodeAt(path)
+ if (current) {
+ return current.style.display !== 'none'
+ }
+ return false
+ }
+
+ expand (path) {
+ var caret = this.caretAt(path)
+ var node = this.nodeAt(path)
+ if (node) {
+ node.style.display = node.style.display === 'none' ? 'block' : 'none'
+ caret.className = node.style.display === 'none' ? `fas fa-caret-right caret ${css.caret_tv}` : `fas fa-caret-down caret ${css.caret_tv}`
+ this.event.trigger('nodeClick', [path, node])
+ }
+ }
+
+ caretAt (path) {
+ var label = this.labelAt(path)
+ if (label) {
+ return label.querySelector('.caret')
+ }
+ }
+
+ itemAt (path) {
+ return this.view.querySelector(`li[key="${path}"]`)
+ }
+
+ labelAt (path) {
+ return this.view.querySelector(`div[key="${path}"]`)
+ }
+
+ nodeAt (path) {
+ return this.view.querySelector(`ul[key="${path}"]`)
+ }
+
+ updateNodeFromJSON (path, jsonTree, expand) {
+ var newTree = this.renderProperties(jsonTree, expand, path)
+ var current = this.nodeAt(path)
+ if (current && current.parentElement) {
+ current.parentElement.replaceChild(newTree, current)
+ }
+ }
+
+ formatSelfDefault (key, data) {
+ return yo`
+
+ ${key}:
+ ${data.self}
+
+ `
+ }
+
+ extractDataDefault (item, parent, key) {
+ var ret = {}
+ if (item instanceof Array) {
+ ret.children = item.map((item, index) => {
+ return {key: index, value: item}
+ })
+ ret.self = 'Array'
+ ret.isNode = true
+ ret.isLeaf = false
+ } else if (item instanceof Object) {
+ ret.children = Object.keys(item).map((key) => {
+ return {key: key, value: item[key]}
+ })
+ ret.self = 'Object'
+ ret.isNode = true
+ ret.isLeaf = false
+ } else {
+ ret.self = item
+ ret.children = null
+ ret.isNode = false
+ ret.isLeaf = true
+ }
+ return ret
+ }
+}
+
+module.exports = TreeView
diff --git a/apps/remix-ide/src/app/ui/auto-complete-popup.js b/apps/remix-ide/src/app/ui/auto-complete-popup.js
new file mode 100644
index 0000000000..1bb1ec3386
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/auto-complete-popup.js
@@ -0,0 +1,213 @@
+var yo = require('yo-yo')
+var remixLib = require('@remix-project/remix-lib')
+var EventManager = remixLib.EventManager
+var Commands = require('../../lib/commands')
+
+// -------------- styling ----------------------
+var css = require('./styles/auto-complete-popup-styles')
+
+/* USAGE:
+
+ var autoCompletePopup = new AutoCompletePopup({
+ options: []
+ })
+ autoCompletePopup.event.register('handleSelect', function (input) { })
+ autoCompletePopup.event.register('updateList', function () { })
+
+*/
+
+class AutoCompletePopup {
+ constructor (opts = {}) {
+ var self = this
+ self.event = new EventManager()
+ self.isOpen = false
+ self.opts = opts
+ self.data = {
+ _options: []
+ }
+ self._components = {}
+ self._view
+ self._startingElement = 0
+ self._elementsToShow = 4
+ self._selectedElement = 0
+ this.extraCommands = []
+ this.extendAutocompletion()
+ }
+
+ render () {
+ var self = this
+ let autoComplete = yo`
+
+ `
+ function setUpPopUp (autoComplete) {
+ handleOpenPopup(autoComplete)
+ handleListSize(autoComplete)
+ }
+
+ function handleOpenPopup (autoComplete) {
+ autoComplete.style.display = self.data._options.length > 0 ? 'block' : 'none'
+ }
+
+ function handleListSize (autoComplete) {
+ if (self.data._options.length >= self._startingElement) {
+ for (let i = self._startingElement; i < (self._elementsToShow + self._startingElement); i++) {
+ let el = autoComplete.querySelectorAll('.item')[i]
+ if (el) {
+ el.classList.remove(css.listHandlerHide)
+ el.classList.add(css.listHandlerShow)
+ }
+ }
+ }
+ }
+ setUpPopUp(autoComplete)
+ if (!this._view) this._view = autoComplete
+ return autoComplete
+ }
+
+ handleSelect (text) {
+ this.removeAutoComplete()
+ this.event.trigger('handleSelect', [text])
+ }
+
+ moveUp () {
+ if (this._selectedElement === 0) return
+ this._selectedElement--
+ this._startingElement = this._selectedElement > 0 ? this._selectedElement - 1 : 0
+ this.event.trigger('updateList')
+ yo.update(this._view, this.render())
+ }
+
+ moveDown () {
+ if (this.data._options.length <= this._selectedElement + 1) return
+ this._selectedElement++
+ this._startingElement = this._selectedElement - 1
+ this.event.trigger('updateList')
+ yo.update(this._view, this.render())
+ }
+
+ handleAutoComplete (event, inputString) {
+ if (this.isOpen && (event.which === 27 || event.which === 8 || event.which === 46)) {
+ // backspace or any key that should remove the autocompletion
+ this.removeAutoComplete()
+ return true
+ }
+ if (this.isOpen && (event.which === 13 || event.which === 9)) {
+ // enter and tab (validate completion)
+ event.preventDefault()
+ if (this.data._options[this._selectedElement]) {
+ this.handleSelect(getKeyOf(this.data._options[this._selectedElement]))
+ }
+ this.removeAutoComplete()
+ return true
+ }
+ if (this.isOpen && event.which === 38) {
+ // move up
+ event.preventDefault()
+ this.isOpen = true
+ this.moveUp()
+ return true
+ }
+ if (this.isOpen && event.which === 40) {
+ // move down
+ event.preventDefault()
+ this.isOpen = true
+ this.moveDown()
+ return true
+ }
+ if (event.which === 13 || event.which === 9) {
+ // enter || tab and autocompletion is off, just returning false
+ return false
+ }
+ let textList = inputString.split(' ')
+ let autoCompleteInput = textList.length > 1 ? textList[textList.length - 1] : textList[0]
+ if (inputString.length >= 2) {
+ // more than 2 letters, start completion
+ this.data._options = []
+ Commands.allPrograms.forEach(item => {
+ const program = getKeyOf(item)
+ if (program.substring(0, program.length - 1).includes(autoCompleteInput.trim())) {
+ this.data._options.push(item)
+ } else if (autoCompleteInput.trim().includes(program) || (program === autoCompleteInput.trim())) {
+ Commands.allCommands.forEach(item => {
+ const command = getKeyOf(item)
+ if (command.includes(autoCompleteInput.trim())) {
+ this.data._options.push(item)
+ }
+ })
+ }
+ })
+ this.extraCommands.forEach(item => {
+ const command = getKeyOf(item)
+ if (command.includes(autoCompleteInput.trim())) {
+ this.data._options.push(item)
+ }
+ })
+
+ if (this.data._options.length === 1 && event.which === 9) {
+ // if only one option and tab is pressed, we resolve it
+ event.preventDefault()
+ textList.pop()
+ textList.push(getKeyOf(this.data._options[0]))
+ this.handleSelect(`${textList}`.replace(/,/g, ' '))
+ this.removeAutoComplete()
+ return
+ }
+ if (this.data._options.length) this.isOpen = true
+ yo.update(this._view, this.render())
+ return true
+ }
+ return false
+ }
+
+ removeAutoComplete () {
+ if (!this.isOpen) return
+ this._view.style.display = 'none'
+ this.isOpen = false
+ this.data._options = []
+ this._startingElement = 0
+ this._selectedElement = 0
+ yo.update(this._view, this.render())
+ }
+
+ extendAutocompletion () {
+ // TODO: this is not using the appManager interface. Terminal should be put as module
+ this.opts.appManager.event.on('activate', async (profile) => {
+ if (!profile.methods) return
+ profile.methods.forEach((method) => {
+ const key = `remix.call('${profile.name}', '${method}')`
+ const keyValue = {}
+ keyValue[key] = `call ${profile.name} - ${method}`
+ if (this.extraCommands.includes(keyValue)) return
+ this.extraCommands.push(keyValue)
+ })
+ })
+ }
+}
+
+function getKeyOf (item) {
+ return Object.keys(item)[0]
+}
+
+function getValueOf (item) {
+ return Object.values(item)[0]
+}
+
+module.exports = AutoCompletePopup
diff --git a/apps/remix-ide/src/app/ui/card.js b/apps/remix-ide/src/app/ui/card.js
new file mode 100644
index 0000000000..182d61659f
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/card.js
@@ -0,0 +1,70 @@
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+var EventManager = require('../../lib/events')
+
+module.exports = class Card {
+ constructor (api, events, opts) {
+ const self = this
+ self._api = api
+ self._events = events
+ self._opts = opts
+ self._view = {}
+ self.event = new EventManager()
+ }
+ render () {
+ const self = this
+ if (self._view.el) return self._view.el
+
+ self._view.cardBody = yo`
`
+ self._view.arrow = yo` `
+
+ self._view.expandCollapseButton = yo`
+ ${self._view.arrow}
`
+
+ self._view.statusBar = yo`${self._opts.collapsedView}
`
+ self._view.cardHeader = yo`
+ trigger(self._view.arrow)}>
+
+
${self._opts.title}
+ ${self._view.statusBar}
+
+
${self._view.expandCollapseButton}
+
`
+
+ function trigger (el) {
+ var body = self._view.cardBody
+ var status = self._view.statusBar
+ if (el.classList) {
+ el.classList.toggle('fa-angle-up')
+ var arrow = el.classList.toggle('fa-angle-down') ? 'up' : 'down'
+ self.event.trigger('expandCollapseCard', [arrow, body, status])
+ }
+ }
+
+ // HTML
+ self._view.el = yo`
+
+ ${self._view.cardHeader}
+ ${self._view.cardBody}
+
`
+
+ return self._view.el
+ }
+
+}
+
+const css = csjs`
+ .cardContainer {
+ padding : 0 24px 16px;
+ margin : 0;
+ background : none;
+ }
+ .arrow {
+ font-weight : bold;
+ cursor : pointer;
+ font-size : 14px;
+ }
+ .arrow:hover {
+ }
+
+`
diff --git a/apps/remix-ide/src/app/ui/confirmDialog.js b/apps/remix-ide/src/app/ui/confirmDialog.js
new file mode 100644
index 0000000000..596b84d423
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/confirmDialog.js
@@ -0,0 +1,64 @@
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+const copyToClipboard = require('./copy-to-clipboard')
+
+var css = csjs`
+ .txInfoBox {
+ }
+ .wrapword {
+ white-space: pre-wrap; /* Since CSS 2.1 */
+ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
+ }
+`
+
+// TODO: self is not actually used and can be removed
+function confirmDialog (tx, amount, gasEstimation, self, newGasPriceCb, initialParamsCb) {
+ var onGasPriceChange = function () {
+ var gasPrice = el.querySelector('#gasprice').value
+ newGasPriceCb(gasPrice, (txFeeText, priceStatus) => {
+ el.querySelector('#txfee').innerHTML = txFeeText
+ el.gasPriceStatus = priceStatus
+ })
+ }
+
+ var el = yo`
+
+
You are creating a transaction on the main network. Click confirm if you are sure to continue.
+
+
From: ${tx.from}
+
To: ${tx.to ? tx.to : '(Contract Creation)'}
+
Amount: ${amount} Ether
+
Gas estimation: ${gasEstimation}
+
Gas limit: ${tx.gas}
+
+
Max transaction fee:
+
Data:
+
${tx.data && tx.data.length > 50 ? tx.data.substring(0, 49) + '...' : tx.data} ${copyToClipboard(() => { return tx.data })}
+
+
+
+ Do not ask for confirmation again. (the setting will not be persisted for the next page reload)
+
+
+ `
+
+ initialParamsCb((txFeeText, gasPriceValue, gasPriceStatus) => {
+ if (txFeeText) {
+ el.querySelector('#txfee').innerHTML = txFeeText
+ }
+ if (gasPriceValue) {
+ el.querySelector('#gasprice').value = gasPriceValue
+ onGasPriceChange()
+ }
+ if (gasPriceStatus !== undefined) {
+ el.gasPriceStatus = gasPriceStatus
+ }
+ })
+
+ return el
+}
+
+module.exports = confirmDialog
diff --git a/apps/remix-ide/src/app/ui/contextMenu.js b/apps/remix-ide/src/app/ui/contextMenu.js
new file mode 100644
index 0000000000..f97720c6cd
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/contextMenu.js
@@ -0,0 +1,69 @@
+var yo = require('yo-yo')
+// -------------- copyToClipboard ----------------------
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .container
+ {
+ display: none;
+ position: fixed;
+ border-radius: 2px;
+ z-index: 1000;
+ box-shadow: 0 0 4px var(--dark);
+ }
+ .liitem
+ {
+ padding: 2px;
+ padding-left: 6px;
+ cursor: pointer;
+ color: var(--text-dark);
+ background-color: var(--light);
+ }
+ .liitem:hover
+ {
+ background-color: var(--secondary);
+ }
+ #menuitems
+ {
+ list-style: none;
+ margin: 0px;
+ }
+`
+
+module.exports = (event, items) => {
+ event.preventDefault()
+
+ function hide (event, force) {
+ if (container && container.parentElement && (force || (event.target !== container))) {
+ container.parentElement.removeChild(container)
+ }
+ window.removeEventListener('click', hide)
+ }
+
+ const menu = Object.keys(items).map((item, index) => {
+ const current = yo``
+ current.onclick = () => { hide(null, true); items[item]() }
+ return current
+ })
+ const container = yo`
`
+
+ container.style.left = event.pageX + 'px'
+ container.style.top = event.pageY + 'px'
+ container.style.display = 'block'
+ document.querySelector('body').appendChild(container)
+
+ const menuItemsContainer = document.getElementById('menuItemsContainer')
+ const boundary = menuItemsContainer.getBoundingClientRect()
+
+ if (boundary.bottom > (window.innerHeight || document.documentElement.clientHeight)) {
+ menuItemsContainer.style.position = 'absolute'
+ menuItemsContainer.style.bottom = '10px'
+ menuItemsContainer.style.top = null
+ }
+
+ setTimeout(() => {
+ window.addEventListener('click', hide)
+ }, 500)
+
+ return { hide }
+}
diff --git a/apps/remix-ide/src/app/ui/copy-to-clipboard.js b/apps/remix-ide/src/app/ui/copy-to-clipboard.js
new file mode 100644
index 0000000000..85f88d0dd9
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/copy-to-clipboard.js
@@ -0,0 +1,39 @@
+var yo = require('yo-yo')
+// -------------- copyToClipboard ----------------------
+const copy = require('copy-text-to-clipboard')
+var addTooltip = require('./tooltip')
+// -------------- styling ----------------------
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .copyIcon {
+ margin-left: 5px;
+ cursor: pointer;
+ }
+`
+
+module.exports = function copyToClipboard (getContent, tip = 'Copy value to clipboard', icon = 'fa-copy') {
+ var copyIcon = yo` `
+ copyIcon.onclick = (event) => {
+ event.stopPropagation()
+ var copiableContent
+ try {
+ copiableContent = getContent()
+ } catch (e) {
+ addTooltip(e.message)
+ return
+ }
+ if (copiableContent) { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory
+ try {
+ if (typeof copiableContent !== 'string') {
+ copiableContent = JSON.stringify(copiableContent, null, '\t')
+ }
+ } catch (e) {}
+ copy(copiableContent)
+ addTooltip('Copied value to clipboard.')
+ } else {
+ addTooltip('Cannot copy empty content!')
+ }
+ }
+ return copyIcon
+}
diff --git a/apps/remix-ide/src/app/ui/draggableContent.js b/apps/remix-ide/src/app/ui/draggableContent.js
new file mode 100644
index 0000000000..77892a7e45
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/draggableContent.js
@@ -0,0 +1,127 @@
+'use strict'
+var yo = require('yo-yo')
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .containerDraggableModal {
+ position: absolute;
+ z-index: 1000;
+ text-align: center;
+ width: 500px;
+ height: 500px;
+ overflow-y: hidden;
+ }
+
+ .headerDraggableModal {
+ cursor: move;
+ z-index: 10;
+ text-overflow: ellipsis;
+ overflow-x: hidden;
+ }
+
+ .modalActions {
+ float: right;
+ }
+
+ .modalAction {
+ padding-right: 1px;
+ padding-left: 1px;
+ cursor: pointer;
+ }
+`
+
+module.exports =
+ class DraggableContent {
+ constructor (closeCb) {
+ this.closeCb = closeCb
+ this.isMaximised = false
+ }
+
+ render (title, url, content) {
+ this.content = content
+ var el = yo`
+ `
+ dragElement(el)
+ el.style.top = '20%'
+ el.style.left = '50%'
+ this.el = el
+ return el
+ }
+ setTitle (title) {
+ this.el.querySelector('.title span').innerHTML = title
+ }
+ minimize () {
+ this.isMaximised = false
+ this.content.style.display = 'none'
+ this.el.style.height = 'inherit'
+ this.el.style.width = '150px'
+ this.el.querySelector('.title').style.width = '146px'
+ }
+ maximise () {
+ this.content.style.display = 'block'
+ var body = document.querySelector('body')
+ this.el.style.height = this.isMaximised ? '500px' : body.offsetHeight + 'px'
+ this.el.style.width = this.isMaximised ? '500px' : body.offsetWidth + 'px'
+ this.isMaximised = !this.isMaximised
+ this.el.style.top = this.isMaximised ? '0%' : '20%'
+ this.el.style.left = this.isMaximised ? '0%' : '50%'
+ this.el.querySelector('.title').style.width = 'inherit'
+ }
+ close () {
+ if (this.closeCb) this.closeCb()
+ if (this.el.parentElement) {
+ this.el.parentElement.removeChild(this.el)
+ }
+ }
+}
+
+function dragElement (elmnt) {
+ var pos1 = 0
+ var pos2 = 0
+ var pos3 = 0
+ var pos4 = 0
+
+ elmnt.querySelector('.title').onmousedown = dragMouseDown
+
+ function dragMouseDown (e) {
+ e = e || window.event
+ if (e.button !== 0) return
+ e.preventDefault()
+ // get the mouse cursor position at startup:
+ pos3 = e.clientX
+ pos4 = e.clientY
+ document.onmouseup = closeDragElement
+ // call a function whenever the cursor moves:
+ document.onmousemove = elementDrag
+ }
+
+ function elementDrag (e) {
+ e = e || window.event
+ e.preventDefault()
+ // calculate the new cursor position:
+ pos1 = pos3 - e.clientX
+ pos2 = pos4 - e.clientY
+ pos3 = e.clientX
+ pos4 = e.clientY
+ // set the element's new position:
+ elmnt.style.top = (elmnt.offsetTop - pos2) + 'px'
+ elmnt.style.left = (elmnt.offsetLeft - pos1) + 'px'
+ }
+
+ function closeDragElement () {
+ /* stop moving when mouse button is released: */
+ document.onmouseup = null
+ document.onmousemove = null
+ }
+}
diff --git a/apps/remix-ide/src/app/ui/dropdown.js b/apps/remix-ide/src/app/ui/dropdown.js
new file mode 100644
index 0000000000..4edad93849
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/dropdown.js
@@ -0,0 +1,127 @@
+var yo = require('yo-yo')
+var EventManager = require('../../lib/events')
+
+// -------------- styling ----------------------
+
+var css = require('./styles/dropdown-styles')
+
+/* USAGE:
+
+ var dropdown = new Dropdown({
+ options: [
+ 'knownTransaction',
+ 'unknownTransaction',
+ 'log',
+ 'info',
+ 'error'
+ ],
+ defaults: ['knownTransaction']
+ })
+ dropdown.event.register('deselect', function (label) { })
+ dropdown.event.register('select', function (label) { })
+
+*/
+class Dropdown {
+ constructor (opts = {}) {
+ var self = this
+ self.event = new EventManager()
+ self.data = {
+ _options: opts.options || [],
+ _dependencies: opts.dependencies || [],
+ selected: opts.defaults || [],
+ _elements: []
+ }
+ self._view = {}
+ self._api = opts.api
+ self._events = opts.events
+ }
+ render () {
+ var self = this
+ if (self._view.el) return self._view.el
+ self._view.selected = yo`
+
+ [${self.data.selected.length}] ${self.data.selected.join(', ')}
+
+
+ `
+ self._view.el = yo`
+
+ `
+ return self._view.el
+ function emit (event) {
+ var input = event.currentTarget
+ var label = input.nextSibling.innerText
+ if (input.checked) {
+ self.data.selected.push(label)
+ if (event.type === 'change') {
+ self.event.trigger('select', [label])
+ updateDependencies(label)
+ }
+ } else {
+ var idx = self.data.selected.indexOf(label)
+ self.data.selected.splice(idx, 1)
+ if (event.type === 'change') {
+ self.event.trigger('deselect', [label])
+ updateDependencies(label)
+ }
+ }
+ self._view.selected.children[0].innerText = `[${self.data.selected.length}] ${self.data.selected.join(', ')}`
+ }
+ function updateDependencies (changed) {
+ if (self.data._dependencies[changed]) {
+ for (var dep in self.data._dependencies[changed]) {
+ var label = self.data._dependencies[changed][dep]
+ var el = self.data._elements[self.data._options.indexOf(label)]
+ el.checked = !el.checked
+ emit({currentTarget: el, type: 'changeDependencies'})
+ }
+ }
+ }
+ function show (event) {
+ event.stopPropagation()
+ var options = event.currentTarget.children[1]
+ var parent = event.target.parentElement
+ var isOption = parent === options || parent.parentElement === options
+ if (isOption) return
+ if (options.style.display === 'none') {
+ options.style.display = ''
+ document.body.addEventListener('click', handler)
+ } else {
+ options.style.display = 'none'
+ document.body.removeEventListener('click', handler)
+ }
+ function handler (event) {
+ options.style.display = 'none'
+ document.body.removeEventListener('click', handler)
+ }
+ }
+ }
+}
+
+module.exports = Dropdown
diff --git a/apps/remix-ide/src/app/ui/landing-page/landing-page.js b/apps/remix-ide/src/app/ui/landing-page/landing-page.js
new file mode 100644
index 0000000000..defeac4676
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/landing-page/landing-page.js
@@ -0,0 +1,441 @@
+import * as packageJson from '../../../../../../package.json'
+import { ViewPlugin } from '@remixproject/engine'
+
+let yo = require('yo-yo')
+let csjs = require('csjs-inject')
+let globalRegistry = require('../../../global/registry')
+let CompilerImport = require('../../compiler/compiler-imports')
+var modalDialogCustom = require('../modal-dialog-custom')
+var tooltip = require('../tooltip')
+var GistHandler = require('../../../lib/gist-handler')
+var QueryParams = require('../../../lib/query-params.js')
+
+let css = csjs`
+ .text {
+ cursor: pointer;
+ font-weight: normal;
+ max-width: 300px;
+ user-select: none;
+ }
+ .text:hover {
+ text-decoration: underline;
+ }
+ .homeContainer {
+ user-select: none;
+ overflow-y: hidden;
+ }
+ .mainContent {
+ overflow-y: auto;
+ flex-grow: 3;
+ }
+ .hpLogoContainer {
+ margin: 30px;
+ padding-right: 90px;
+ }
+ .mediaBadge {
+ font-size: 2em;
+ height: 2em;
+ width: 2em;
+ }
+ .mediaBadge:focus {
+ outline: none;
+ }
+ .logoImg {
+ height: 10em;
+ }
+ .hpSections {
+ }
+ .rightPanel {
+ right: 0;
+ position: absolute;
+ z-index: 1000;
+ }
+ .remixHomeMedia {
+ overflow-y: auto;
+ overflow-x: hidden;
+ max-height: 720px;
+ }
+ .panels {
+ box-shadow: 0px 0px 17px -7px;
+ }
+ .labelIt {
+ margin-bottom: 0;
+ }
+ .seeAll {
+ margin-top: 7px;
+ white-space: nowrap;
+ }
+ .importFrom p {
+ margin-right: 10px;
+ }
+ .logoContainer img{
+ height: 150px;
+ opacity: 0.7;
+ }
+ .envLogo {
+ height: 16px;
+ }
+ .cursorStyle {
+ cursor: pointer;
+ }
+ .envButton {
+ width: 120px;
+ height: 70px;
+ }
+ .media {
+ overflow: hidden;
+ width: 400px;
+ transition: .5s ease-out;
+ z-index: 1000;
+ }
+}
+`
+
+const profile = {
+ name: 'home',
+ displayName: 'Home',
+ methods: [],
+ events: [],
+ description: ' - ',
+ icon: 'assets/img/remixLogo.webp',
+ location: 'mainPanel',
+ version: packageJson.version
+}
+
+export class LandingPage extends ViewPlugin {
+
+ constructor (appManager, verticalIcons) {
+ super(profile)
+ this.profile = profile
+ this.appManager = appManager
+ this.verticalIcons = verticalIcons
+ this.gistHandler = new GistHandler()
+ const themeQuality = globalRegistry.get('themeModule').api.currentTheme().quality
+ window.addEventListener('resize', () => this.adjustMediaPanel())
+ window.addEventListener('click', (e) => this.hideMediaPanel(e))
+ this.twitterFrame = yo`
+
+
+
+
+ `
+ this.badgeTwitter = yo``
+ this.badgeMedium = yo` this.showMediaPanel(e)}
+ > `
+ this.twitterPanel = yo`
+
+ `
+ this.mediumPanel = yo`
+
+ `
+ this.adjustMediaPanel()
+ globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => {
+ console.log("theme is ", theme.quality)
+ this.onThemeChanged(theme.quality)
+ })
+ }
+
+ adjustMediaPanel () {
+ this.twitterPanel.style.maxHeight = Math.max(window.innerHeight - 150, 200) + 'px'
+ this.mediumPanel.style.maxHeight = Math.max(window.innerHeight - 150, 200) + 'px'
+ }
+
+ hideMediaPanel (e) {
+ const mediaPanelsTitle = document.getElementById('remixIDEMediaPanelsTitle')
+ const mediaPanels = document.getElementById('remixIDEMediaPanels')
+ if (!mediaPanelsTitle.contains(e.target) && !mediaPanels.contains(e.target)) {
+ this.mediumPanel.classList.remove('d-block')
+ this.mediumPanel.classList.add('d-none')
+ this.twitterPanel.classList.remove('d-block')
+ this.twitterPanel.classList.add('d-none')
+ }
+ }
+
+ onThemeChanged (themeQuality) {
+ console.log("themes in listener is", themeQuality)
+ let twitterFrame = yo`
+
+
+
+
+ `
+ yo.update(this.twitterFrame, twitterFrame)
+ }
+
+ showMediaPanel (e) {
+ console.log(e)
+ if (e.target.id === 'remixIDEHomeTwitterbtn') {
+ this.mediumPanel.classList.remove('d-block')
+ this.mediumPanel.classList.add('d-none')
+ this.twitterPanel.classList.toggle('d-block')
+ } else {
+ this.twitterPanel.classList.remove('d-block')
+ this.twitterPanel.classList.add('d-none')
+ this.mediumPanel.classList.toggle('d-block')
+ }
+ }
+ render () {
+ let load = (service, item, examples, info) => {
+ let compilerImport = new CompilerImport()
+ let fileProviders = globalRegistry.get('fileproviders').api
+ const msg = yo`
+
+
Enter the ${item} you would like to load.
+
${info}
+
e.g ${examples.map((url) => { return yo`
` })}
+
`
+
+ modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => {
+ if (target !== '') {
+ compilerImport.import(
+ target,
+ (loadingMsg) => { tooltip(loadingMsg) },
+ (error, content, cleanUrl, type, url) => {
+ if (error) {
+ modalDialogCustom.alert(error)
+ } else {
+ fileProviders['browser'].addExternal(type + '/' + cleanUrl, content, url)
+ this.verticalIcons.select('fileExplorers')
+ }
+ }
+ )
+ }
+ })
+ }
+
+ const startSolidity = () => {
+ this.appManager.ensureActivated('solidity')
+ this.appManager.ensureActivated('udapp')
+ this.appManager.ensureActivated('solidityStaticAnalysis')
+ this.appManager.ensureActivated('solidityUnitTesting')
+ this.verticalIcons.select('solidity')
+ }
+ /*
+ const startWorkshop = () => {
+ this.appManager.ensureActivated('box')
+ this.appManager.ensureActivated('solidity')
+ this.appManager.ensureActivated('solidityUnitTesting')
+ this.appManager.ensureActivated('workshops')
+ this.verticalIcons.select('workshops')
+ }
+ */
+
+ const startPipeline = () => {
+ this.appManager.ensureActivated('solidity')
+ this.appManager.ensureActivated('pipeline')
+ this.appManager.ensureActivated('udapp')
+ }
+ const startDebugger = () => {
+ this.appManager.ensureActivated('debugger')
+ this.verticalIcons.select('debugger')
+ }
+ const startMythX = () => {
+ this.appManager.ensureActivated('solidity')
+ this.appManager.ensureActivated('mythx')
+ this.verticalIcons.select('mythx')
+ }
+ const startSourceVerify = () => {
+ this.appManager.ensureActivated('solidity')
+ this.appManager.ensureActivated('source-verification')
+ this.verticalIcons.select('source-verification')
+ }
+ const startPluginManager = () => {
+ this.appManager.ensureActivated('pluginManager')
+ this.verticalIcons.select('pluginManager')
+ }
+
+ const createNewFile = () => {
+ let fileExplorer = globalRegistry.get('fileexplorer/browser').api
+ fileExplorer.createNewFile()
+ }
+ const connectToLocalhost = () => {
+ this.appManager.ensureActivated('remixd')
+ }
+ const importFromGist = () => {
+ this.gistHandler.loadFromGist({gist: ''}, globalRegistry.get('filemanager').api)
+ this.verticalIcons.select('fileExplorers')
+ }
+
+ globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => {
+ globalRegistry.get('themeModule').api.fixInvert(document.getElementById('remixLogo'))
+ globalRegistry.get('themeModule').api.fixInvert(document.getElementById('solidityLogo'))
+ globalRegistry.get('themeModule').api.fixInvert(document.getElementById('pipelineLogo'))
+ globalRegistry.get('themeModule').api.fixInvert(document.getElementById('debuggerLogo'))
+ globalRegistry.get('themeModule').api.fixInvert(document.getElementById('workshopLogo'))
+ globalRegistry.get('themeModule').api.fixInvert(document.getElementById('moreLogo'))
+ })
+
+ const createLargeButton = (imgPath, envID, envText, callback) => {
+ return yo`
+ callback()}
+ >
+
+ ${envText}
+
+ `
+ }
+
+ // main
+ const solEnv = createLargeButton('assets/img/solidityLogo.webp', 'solidityLogo', 'Solidity', startSolidity)
+ // Featured
+ const pipelineEnv = createLargeButton('assets/img/pipelineLogo.webp', 'pipelineLogo', 'Pipeline', startPipeline)
+ const debuggerEnv = createLargeButton('assets/img/debuggerLogo.webp', 'debuggerLogo', 'Debugger', startDebugger)
+ const mythXEnv = createLargeButton('assets/img/mythxLogo.webp', 'mythxLogo', 'MythX', startMythX)
+ const sourceVerifyEnv = createLargeButton('assets/img/sourceVerifyLogo.webp', 'sourceVerifyLogo', 'Sourcify', startSourceVerify)
+ const moreEnv = createLargeButton('assets/img/moreLogo.webp', 'moreLogo', 'More', startPluginManager)
+
+ const themeQuality = globalRegistry.get('themeModule').api.currentTheme().quality
+ const invertNum = (themeQuality === 'dark') ? 1 : 0
+ solEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
+ pipelineEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
+ debuggerEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
+ mythXEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
+ sourceVerifyEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
+ moreEnv.getElementsByTagName('img')[0].style.filter = `invert(${invertNum})`
+
+ let switchToPreviousVersion = () => {
+ const query = new QueryParams()
+ query.update({appVersion: '0.7.7'})
+ document.location.reload()
+ }
+ const img = yo` `
+
+ // to retrieve medium posts
+ document.body.appendChild(yo``)
+ const container = yo`
+
+
+
+
+
+
+
+
+
+
Featured Plugins
+
+ ${solEnv}
+ ${pipelineEnv}
+ ${mythXEnv}
+ ${sourceVerifyEnv}
+ ${debuggerEnv}
+ ${moreEnv}
+
+
+
+
+
File
+
+
+ createNewFile()}>New File
+
+
+
+
+ Open Files
+
+
+
+
+
+ connectToLocalhost()}>Connect to Localhost
+
+
IMPORT FROM:
+
+ Gist
+ GitHub
+ Swarm
+ Ipfs
+ https
+ https://github.com/Crypto-Punkers/resolver-engine for more information`)}">Resolver-engine
+
+
+
+
+
+
+
+
+
+ ${this.badgeTwitter}
+ ${this.badgeMedium}
+
+
+ ${this.mediumPanel}
+ ${this.twitterPanel}
+
+
+
+
+
+ `
+ return container
+ }
+}
diff --git a/apps/remix-ide/src/app/ui/landing-page/workspace.js b/apps/remix-ide/src/app/ui/landing-page/workspace.js
new file mode 100644
index 0000000000..c415d596dd
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/landing-page/workspace.js
@@ -0,0 +1,48 @@
+export class Workspace {
+ constructor (title, description, isMain, activate, deactivate) {
+ this.title = title
+ this.description = description
+ this.isMain = isMain
+ this.activate = activate
+ this.deactivate = deactivate
+ }
+}
+
+export const defaultWorkspaces = (appManager) => {
+ return [
+ new Workspace(
+ 'Solidity',
+ 'Writing smart contracts. It is used for implementing smart contracts on various blockchain platforms',
+ true,
+ () => {
+ appManager.ensureActivated('solidity')
+ appManager.ensureActivated('udapp')
+ appManager.ensureActivated('solidityStaticAnalysis')
+ appManager.ensureActivated('solidityUnitTesting')
+ }, () => {}),
+ new Workspace(
+ 'Vyper',
+ 'Vyper is a contract-oriented, pythonic programming language that targets the Ethereum Virtual Machine (EVM)',
+ true,
+ () => {
+ appManager.ensureActivated('vyper')
+ appManager.ensureActivated('udapp')
+ }, () => {}),
+ new Workspace(
+ 'Lexon',
+ 'Lexon is a language modelling legal contracts that compiles down to ethereum smart contracts',
+ true,
+ () => {
+ appManager.ensureActivated('lexon')
+ appManager.ensureActivated('udapp')
+ }, () => {}),
+ new Workspace('Debugger', 'Debug transactions with remix', false, () => {
+ appManager.ensureActivated('debugger')
+ }, () => {}),
+ new Workspace('Pipeline', '', false, () => {
+ appManager.ensureActivated('solidity')
+ appManager.ensureActivated('pipeline')
+ appManager.ensureActivated('udapp')
+ })
+ ]
+}
diff --git a/apps/remix-ide/src/app/ui/modal-dialog-custom.js b/apps/remix-ide/src/app/ui/modal-dialog-custom.js
new file mode 100644
index 0000000000..ec4535ecc6
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/modal-dialog-custom.js
@@ -0,0 +1,80 @@
+var modal = require('./modaldialog.js')
+var yo = require('yo-yo')
+var css = require('./styles/modal-dialog-custom-styles')
+
+module.exports = {
+ alert: function (title, text) {
+ if (text) return modal(title, yo`${text}
`, null, { label: null })
+ return modal('', yo`${title}
`, null, { label: null })
+ },
+ prompt: function (title, text, inputValue, ok, cancel, focus) {
+ return prompt(title, text, false, inputValue, ok, cancel, focus)
+ },
+ promptPassphrase: function (title, text, inputValue, ok, cancel) {
+ return prompt(title, text, true, inputValue, ok, cancel)
+ },
+ promptPassphraseCreation: function (ok, cancel) {
+ var text = 'Please provide a Passphrase for the account creation'
+ var input = yo`
+
+
+
+
+
`
+ return modal(null, yo``,
+ {
+ fn: () => {
+ if (typeof ok === 'function') {
+ if (input.querySelector('#prompt1').value === input.querySelector('#prompt2').value) {
+ ok(null, input.querySelector('#prompt1').value)
+ } else {
+ ok('Passphase does not match')
+ }
+ }
+ }
+ },
+ {
+ fn: () => {
+ if (typeof cancel === 'function') cancel()
+ }
+ }
+ )
+ },
+ promptMulti: function ({ title, text, inputValue }, ok, cancel) {
+ if (!inputValue) inputValue = ''
+ var input = yo``
+ return modal(title, yo``,
+ {
+ fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) }
+ },
+ {
+ fn: () => { if (typeof cancel === 'function') cancel() }
+ }
+ )
+ },
+ confirm: function (title, text, ok, cancel) {
+ return modal(title, yo`${text}
`,
+ {
+ fn: () => { if (typeof ok === 'function') ok() }
+ },
+ {
+ fn: () => { if (typeof cancel === 'function') cancel() }
+ }
+ )
+ }
+}
+
+function prompt (title, text, hidden, inputValue, ok, cancel, focus) {
+ if (!inputValue) inputValue = ''
+ var type = hidden ? 'password' : 'text'
+ var input = yo` `
+ modal(title, yo``,
+ {
+ fn: () => { if (typeof ok === 'function') ok(document.getElementById('prompt_text').value) }
+ },
+ {
+ fn: () => { if (typeof cancel === 'function') cancel() }
+ },
+ focus ? '#prompt_text' : undefined
+ )
+}
diff --git a/apps/remix-ide/src/app/ui/modaldialog.js b/apps/remix-ide/src/app/ui/modaldialog.js
new file mode 100644
index 0000000000..a72b4a0941
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/modaldialog.js
@@ -0,0 +1,150 @@
+var yo = require('yo-yo')
+var css = require('./styles/modaldialog-styles')
+
+let incomingModal = false // in case modals are queued, ensure we are not hiding the last one.
+module.exports = (title, content, ok, cancel, focusSelector, opts) => {
+ let agreed = true
+ let footerIsActive = false
+ opts = opts || {}
+ var container = document.querySelector(`.modal`)
+ if (!container) {
+ document.querySelector('body').appendChild(html(opts))
+ container = document.querySelector(`.modal`)
+ incomingModal = false
+ } else incomingModal = true
+
+ var closeDiv = document.getElementById('modal-close')
+ if (opts.hideClose) closeDiv.style.display = 'none'
+
+ var okDiv = document.getElementById('modal-footer-ok')
+ okDiv.innerHTML = (ok && ok.label !== undefined) ? ok.label : 'OK'
+ okDiv.style.display = okDiv.innerHTML === '' ? 'none' : 'inline-block'
+
+ var cancelDiv = document.getElementById('modal-footer-cancel')
+ cancelDiv.innerHTML = (cancel && cancel.label !== undefined) ? cancel.label : 'Cancel'
+ cancelDiv.style.display = cancelDiv.innerHTML === '' ? 'none' : 'inline-block'
+
+ var modal = document.querySelector(`.modal-body`)
+ var modalTitle = document.querySelector(`.modal-header h6`)
+
+ modalTitle.innerHTML = ''
+ if (title) modalTitle.innerText = title
+
+ modal.innerHTML = ''
+ if (content) modal.appendChild(content)
+
+ setFocusOn('ok')
+
+ show()
+
+ function setFocusOn (btn) {
+ var okDiv = document.getElementById('modal-footer-ok')
+ var cancelDiv = document.getElementById('modal-footer-cancel')
+ if (btn === 'ok') {
+ okDiv.className = okDiv.className.replace(/\bbtn-light\b/g, 'btn-dark')
+ cancelDiv.className = cancelDiv.className.replace(/\bbtn-dark\b/g, 'btn-light')
+ } else {
+ cancelDiv.className = cancelDiv.className.replace(/\bbtn-light\b/g, 'btn-dark')
+ okDiv.className = okDiv.className.replace(/\bbtn-dark\b/g, 'btn-light')
+ }
+ }
+
+ function okListener () {
+ removeEventListener()
+ if (ok && ok.fn && agreed) ok.fn()
+ if (!incomingModal) hide()
+ incomingModal = false
+ }
+
+ function cancelListener () {
+ removeEventListener()
+ if (cancel && cancel.fn) cancel.fn()
+ if (!incomingModal) hide()
+ incomingModal = false
+ }
+
+ function modalKeyEvent (e) {
+ if (e.keyCode === 27) { // Esc
+ cancelListener()
+ } else if (e.keyCode === 13) { // Enter
+ e.preventDefault()
+ okListener()
+ } else if (e.keyCode === 37 && footerIsActive) { // Arrow Left
+ e.preventDefault()
+ agreed = true
+ setFocusOn('ok')
+ } else if (e.keyCode === 39 && footerIsActive) { // Arrow Right
+ e.preventDefault()
+ agreed = false
+ setFocusOn('cancel')
+ }
+ }
+
+ function hide () {
+ if (!container) return
+ container.style.display = 'none'
+ if (container.parentElement) container.parentElement.removeChild(container)
+ container = null
+ incomingModal = false
+ }
+
+ function show () {
+ if (!container) return
+ container.style.display = 'block'
+ if (focusSelector) {
+ const focusTarget = document.querySelector(`.modal ${focusSelector}`)
+ if (focusTarget) {
+ focusTarget.focus()
+ if (typeof focusTarget.setSelectionRange === 'function') {
+ focusTarget.setSelectionRange(0, focusTarget.value.length)
+ }
+ }
+ }
+ }
+
+ function removeEventListener () {
+ okDiv.removeEventListener('click', okListener)
+ cancelDiv.removeEventListener('click', cancelListener)
+ closeDiv.removeEventListener('click', cancelListener)
+ document.removeEventListener('keydown', modalKeyEvent)
+ if (document.getElementById('modal-background')) {
+ document.getElementById('modal-background').removeEventListener('click', cancelListener)
+ }
+ }
+ okDiv.addEventListener('click', okListener)
+ cancelDiv.addEventListener('click', cancelListener)
+ closeDiv.addEventListener('click', cancelListener)
+ document.addEventListener('keydown', modalKeyEvent)
+
+ let modalDialog = document.getElementById('modal-dialog')
+ if (modalDialog) {
+ modalDialog.addEventListener('click', (e) => {
+ footerIsActive = document.activeElement === modalDialog
+ if (e.toElement === modalDialog) {
+ cancelListener() // click is outside of modal-content
+ }
+ })
+ }
+ return { container, okListener, cancelListener, hide }
+}
+
+function html (opts) {
+ return yo`
+ `
+}
diff --git a/apps/remix-ide/src/app/ui/multiParamManager.js b/apps/remix-ide/src/app/ui/multiParamManager.js
new file mode 100644
index 0000000000..221578add8
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/multiParamManager.js
@@ -0,0 +1,229 @@
+'use strict'
+
+var yo = require('yo-yo')
+var css = require('../../universal-dapp-styles')
+var copyToClipboard = require('./copy-to-clipboard')
+var remixLib = require('@remix-project/remix-lib')
+var txFormat = remixLib.execution.txFormat
+
+class MultiParamManager {
+
+ /**
+ *
+ * @param {bool} lookupOnly
+ * @param {Object} funABI
+ * @param {Function} clickMultiCallBack
+ * @param {string} inputs
+ * @param {string} title
+ * @param {string} evmBC
+ *
+ */
+ constructor (lookupOnly, funABI, clickCallBack, inputs, title, evmBC, isDeploy) {
+ this.lookupOnly = lookupOnly
+ this.funABI = funABI
+ this.clickCallBack = clickCallBack
+ this.inputs = inputs
+ this.title = title
+ this.evmBC = evmBC
+ this.basicInputField
+ this.multiFields
+ this.isDeploy = isDeploy
+ }
+
+ switchMethodViewOn () {
+ this.contractActionsContainerSingle.style.display = 'none'
+ this.contractActionsContainerMulti.style.display = 'flex'
+ this.makeMultiVal()
+ }
+
+ switchMethodViewOff () {
+ this.contractActionsContainerSingle.style.display = 'flex'
+ this.contractActionsContainerMulti.style.display = 'none'
+ var multiValString = this.getMultiValsString()
+ if (multiValString) this.basicInputField.value = multiValString
+ }
+
+ getValue (item, index) {
+ var valStr = item.value.join('')
+ return valStr
+ }
+
+ getMultiValsString () {
+ var valArray = this.multiFields.querySelectorAll('input')
+ var ret = ''
+ var valArrayTest = []
+
+ for (var j = 0; j < valArray.length; j++) {
+ if (ret !== '') ret += ','
+ var elVal = valArray[j].value
+ valArrayTest.push(elVal)
+ elVal = elVal.replace(/(^|,\s+|,)(\d+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted number by quoted number
+ elVal = elVal.replace(/(^|,\s+|,)(0[xX][0-9a-fA-F]+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted hex string by quoted hex string
+ try {
+ JSON.parse(elVal)
+ } catch (e) {
+ elVal = '"' + elVal + '"'
+ }
+ ret += elVal
+ }
+ var valStringTest = valArrayTest.join('')
+ if (valStringTest) {
+ return ret
+ } else {
+ return ''
+ }
+ }
+
+ emptyInputs () {
+ var valArray = this.multiFields.querySelectorAll('input')
+ for (var k = 0; k < valArray.length; k++) {
+ valArray[k].value = ''
+ }
+ this.basicInputField.value = ''
+ }
+
+ makeMultiVal () {
+ var inputString = this.basicInputField.value
+ if (inputString) {
+ inputString = inputString.replace(/(^|,\s+|,)(\d+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted number by quoted number
+ inputString = inputString.replace(/(^|,\s+|,)(0[xX][0-9a-fA-F]+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted hex string by quoted hex string
+ var inputJSON = JSON.parse('[' + inputString + ']')
+ var multiInputs = this.multiFields.querySelectorAll('input')
+ for (var k = 0; k < multiInputs.length; k++) {
+ if (inputJSON[k]) {
+ multiInputs[k].value = JSON.stringify(inputJSON[k])
+ }
+ }
+ }
+ }
+
+ createMultiFields () {
+ if (this.funABI.inputs) {
+ return yo`
+ ${this.funABI.inputs.map(function (inp) {
+ return yo`
${inp.name}:
`
+ })}
+
`
+ }
+ }
+
+ render () {
+ var title
+ if (this.title) {
+ title = this.title
+ } else if (this.funABI.name) {
+ title = this.funABI.name
+ } else {
+ title = this.funABI.type === 'receive' ? '(receive)' : '(fallback)'
+ }
+
+ this.basicInputField = yo` `
+ this.basicInputField.setAttribute('placeholder', this.inputs)
+ this.basicInputField.setAttribute('title', this.inputs)
+ this.basicInputField.setAttribute('data-id', this.inputs)
+
+ var onClick = () => {
+ this.clickCallBack(this.funABI.inputs, this.basicInputField.value)
+ }
+ const width = this.isDeploy ? '' : 'w-50'
+ let funcButton = yo` onClick()} class="${css.instanceButton} ${width} btn btn-sm" data-id="multiParamManagerFuncButton">${title} `
+ this.contractActionsContainerSingle = yo`
+
+ ${funcButton}
+ ${this.basicInputField}
+ this.switchMethodViewOn()} title=${title} >
+
`
+
+ this.multiFields = this.createMultiFields()
+
+ var multiOnClick = () => {
+ var valsString = this.getMultiValsString()
+ if (valsString) {
+ this.clickCallBack(this.funABI.inputs, valsString)
+ } else {
+ this.clickCallBack(this.funABI.inputs, '')
+ }
+ }
+
+ var expandedButton = yo` { multiOnClick() }} class="${css.instanceButton}" data-id="multiParamManagerExpandedButton"> `
+
+ this.contractActionsContainerMulti = yo`
+
+
{ this.switchMethodViewOff() }} class="${css.multiHeader}">
+
${title}
+
+
+ ${this.multiFields}
+
+ ${copyToClipboard(
+ () => {
+ var multiString = this.getMultiValsString()
+ var multiJSON = JSON.parse('[' + multiString + ']')
+ var encodeObj
+ if (this.evmBC) {
+ encodeObj = txFormat.encodeData(this.funABI, multiJSON, this.evmBC)
+ } else {
+ encodeObj = txFormat.encodeData(this.funABI, multiJSON)
+ }
+ if (encodeObj.error) {
+ throw new Error(encodeObj.error)
+ } else {
+ return encodeObj.data
+ }
+ }, 'Encode values of input fields & copy to clipboard', 'fa-clipboard')}
+ ${expandedButton}
+
+
+
`
+
+ var contractProperty = yo`
+
+ ${this.contractActionsContainerSingle} ${this.contractActionsContainerMulti}
+
+ `
+ if (this.lookupOnly) {
+ // call. stateMutability is either pure or view
+ expandedButton.setAttribute('title', (title + ' - call'))
+ expandedButton.innerHTML = 'call'
+ expandedButton.classList.add('btn-info')
+ expandedButton.setAttribute('data-id', (title + ' - call'))
+ funcButton.setAttribute('title', (title + ' - call'))
+ funcButton.classList.add('btn-info')
+ funcButton.setAttribute('data-id', (title + ' - call'))
+ } else if (this.funABI.stateMutability === 'payable' || this.funABI.payable) {
+ // transact. stateMutability = payable
+ expandedButton.setAttribute('title', (title + ' - transact (payable)'))
+ expandedButton.innerHTML = 'transact'
+ expandedButton.classList.add('btn-danger')
+ expandedButton.setAttribute('data-id', (title + ' - transact (payable)'))
+ funcButton.setAttribute('title', (title + ' - transact (payable)'))
+ funcButton.classList.add('btn-danger')
+ funcButton.setAttribute('data-id', (title + ' - transact (payable)'))
+ } else {
+ // transact. stateMutability = nonpayable
+ expandedButton.setAttribute('title', (title + ' - transact (not payable)'))
+ expandedButton.innerHTML = 'transact'
+ expandedButton.classList.add('btn-warning')
+ expandedButton.setAttribute('data-id', (title + ' - transact (not payable)'))
+ funcButton.classList.add('btn-warning')
+ funcButton.setAttribute('title', (title + ' - transact (not payable)'))
+ funcButton.setAttribute('data-id', (title + ' - transact (not payable)'))
+ }
+
+ if (this.funABI.inputs && this.funABI.inputs.length > 0) {
+ contractProperty.classList.add(css.hasArgs)
+ } else if (this.funABI.type === 'fallback' || this.funABI.type === 'receive') {
+ contractProperty.classList.add(css.hasArgs)
+ this.basicInputField.setAttribute('title', `'(${this.funABI.type}')`) // probably should pass name instead
+ this.contractActionsContainerSingle.querySelector('i').style.visibility = 'hidden'
+ this.basicInputField.setAttribute('data-id', `'(${this.funABI.type}')`)
+ } else {
+ this.contractActionsContainerSingle.querySelector('i').style.visibility = 'hidden'
+ this.basicInputField.style.visibility = 'hidden'
+ }
+
+ return contractProperty
+ }
+}
+
+module.exports = MultiParamManager
diff --git a/apps/remix-ide/src/app/ui/persmission-handler.js b/apps/remix-ide/src/app/ui/persmission-handler.js
new file mode 100644
index 0000000000..03566be4e9
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/persmission-handler.js
@@ -0,0 +1,202 @@
+/* global localStorage */
+const yo = require('yo-yo')
+const csjs = require('csjs-inject')
+const addTooltip = require('./tooltip')
+const modalDialog = require('./modaldialog')
+const globalRegistry = require('../../global/registry')
+
+const css = csjs`
+.permission h4 {
+ text-transform: uppercase;
+ text-align: center;
+}
+.permission h6 {
+ text-transform: uppercase;
+}
+.remember {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+.images {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ padding: 10px;
+}
+.images img {
+ width: 40px;
+ height: 40px;
+}
+.images i {
+ margin: 0 20px;
+}
+`
+
+function notAllowWarning (from, to, method) {
+ return `${from.displayName || from.name} is not allowed to call ${method} method of ${to.displayName || to.name}.`
+}
+
+export class PermissionHandler {
+
+ constructor () {
+ this.permissions = this._getFromLocal()
+ this.currentVersion = 1
+ // here we remove the old permissions saved before adding 'permissionVersion'
+ // since with v1 the structure has been changed because of new engine ^0.2.0-alpha.6 changes
+ if (!localStorage.getItem('permissionVersion')) {
+ localStorage.setItem('plugins/permissions', '')
+ localStorage.setItem('permissionVersion', this.currentVersion)
+ }
+ }
+
+ _getFromLocal () {
+ const permission = localStorage.getItem('plugins/permissions')
+ return permission ? JSON.parse(permission) : {}
+ }
+
+ persistPermissions () {
+ const permissions = JSON.stringify(this.permissions)
+ localStorage.setItem('plugins/permissions', permissions)
+ }
+
+ clear () {
+ localStorage.removeItem('plugins/permissions')
+ addTooltip('All Permissions have been reset')
+ }
+
+ /**
+ * Show a message to ask the user for a permission
+ * @param {PluginProfile} from The name and hash of the plugin that make the call
+ * @param {ModuleProfile} to The name of the plugin that receive the call
+ * @param {string} method The name of the function to be called
+ * @param {string} message from the caller plugin to add more details if needed
+ * @returns {Promise<{ allow: boolean; remember: boolean }} Answer from the user to the permission
+ */
+ async openPermission (from, to, method, message) {
+ return new Promise((resolve, reject) => {
+ modalDialog(
+ `Permission needed for ${to.displayName || to.name}`,
+ this.form(from, to, method, message),
+ {
+ label: 'Accept',
+ fn: () => {
+ if (this.permissions[to.name][method][from.name]) {
+ this.permissions[to.name][method][from.name] = {
+ allow: true,
+ hash: from.hash
+ }
+ this.persistPermissions()
+ }
+ resolve(true)
+ }
+ },
+ {
+ label: 'Decline',
+ fn: () => {
+ if (this.permissions[to.name][method][from.name]) {
+ this.permissions[to.name][method][from.name] = {
+ allow: false,
+ hash: from.hash
+ }
+ this.persistPermissions()
+ }
+ reject(notAllowWarning(from, to, method))
+ }
+ }
+ )
+ })
+ }
+
+ /**
+ * Check if a plugin has the permission to call another plugin and askPermission if needed
+ * @param {PluginProfile} from the profile of the plugin that make the call
+ * @param {ModuleProfile} to The profile of the module that receive the call
+ * @param {string} method The name of the function to be called
+ * @param {string} message from the caller plugin to add more details if needed
+ * @returns {Promise}
+ */
+ async askPermission (from, to, method, message) {
+ try {
+ this.permissions = this._getFromLocal()
+ if (!this.permissions[to.name]) this.permissions[to.name] = {}
+ if (!this.permissions[to.name][method]) this.permissions[to.name][method] = {}
+ if (!this.permissions[to.name][method][from.name]) return this.openPermission(from, to, method, message)
+
+ const { allow, hash } = this.permissions[to.name][method][from.name]
+ if (!allow) {
+ const warning = notAllowWarning(from, to, method)
+ addTooltip(warning)
+ return false
+ }
+ return hash === from.hash
+ ? true // Allow
+ : this.openPermission(from, to, method, message) // New version of a plugin
+ } catch (err) {
+ throw new Error(err)
+ }
+ }
+
+ /**
+ * The permission form
+ * @param {PluginProfile} from The name and hash of the plugin that make the call
+ * @param {ModuleProfile} to The name of the plugin that receive the call
+ * @param {string} method The name of te methode to be called
+ * @param {string} message from the caller plugin to add more details if needed
+ */
+ form (from, to, method, message) {
+ const fromName = from.displayName || from.name
+ const toName = to.displayName || to.name
+ const remember = this.permissions[to.name][method][from.name]
+
+ const switchMode = (e) => {
+ e.target.checked
+ ? this.permissions[to.name][method][from.name] = {}
+ : delete this.permissions[to.name][method][from.name]
+ }
+ const rememberSwitch = remember
+ ? yo` `
+ : yo` `
+ const text = `"${fromName}" ${(remember ? `has changed and` : ``)} would like to access to "${method}" of "${toName}"`
+ const imgFrom = yo` `
+ const imgTo = yo` `
+ const pluginsImages = yo`
+
+ ${imgFrom}
+
+ ${imgTo}
+
+ `
+
+ globalRegistry.get('themeModule').api.fixInvert(imgFrom)
+ globalRegistry.get('themeModule').api.fixInvert(imgTo)
+
+ const pluginMessage = message ? yo`
+
+
Description
+
${message}
+
+ ` : ``
+ return yo`
+
+ ${pluginsImages}
+
+ ${text} :
+ ${fromName}
+ ${from.description || yo`No description Provided `}
+ ${toName} :
+ ${to.description || yo`No description Provided `}
+ ${pluginMessage}
+
+
+
+
+ ${rememberSwitch}
+ Remember this choice
+
+ Reset all Permissions
+
+
+ `
+ }
+}
diff --git a/apps/remix-ide/src/app/ui/renderer.js b/apps/remix-ide/src/app/ui/renderer.js
new file mode 100644
index 0000000000..e948adbc9f
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/renderer.js
@@ -0,0 +1,130 @@
+'use strict'
+
+var $ = require('jquery')
+var yo = require('yo-yo')
+var css = require('./styles/renderer-styles')
+var globlalRegistry = require('../../global/registry')
+
+/**
+ * After refactor, the renderer is only used to render error/warning
+ * TODO: This don't need to be an object anymore. Simplify and just export the renderError function.
+ *
+ */
+function Renderer (localRegistry) {
+ const self = this
+ self._components = {}
+ self._components.registry = localRegistry || globlalRegistry
+ // dependencies
+ self._deps = {
+ fileManager: self._components.registry.get('filemanager').api,
+ config: self._components.registry.get('config').api
+ }
+ if (document && document.head) {
+ document.head.appendChild(css)
+ }
+}
+
+Renderer.prototype._error = function (file, error) {
+ const self = this
+ const editor = self._components.registry.get('editor').api
+ if (file === self._deps.config.get('currentFile')) {
+ editor.addAnnotation(error)
+ }
+}
+
+Renderer.prototype._errorClick = function (errFile, errLine, errCol) {
+ const self = this
+ const editor = self._components.registry.get('editor').api
+ if (errFile !== self._deps.config.get('currentFile')) {
+ // TODO: refactor with this._components.contextView.jumpTo
+ var provider = self._deps.fileManager.fileProviderOf(errFile)
+ if (provider) {
+ provider.exists(errFile, (error, exist) => {
+ if (error) return console.log(error)
+ self._deps.fileManager.open(errFile)
+ editor.gotoLine(errLine, errCol)
+ })
+ }
+ } else {
+ editor.gotoLine(errLine, errCol)
+ }
+}
+
+/**
+ * format msg like error or warning,
+ *
+ * @param {String or DOMElement} message
+ * @param {DOMElement} container
+ * @param {Object} options {
+ * useSpan,
+ * noAnnotations,
+ * click:(Function),
+ * type:(
+ * warning,
+ * error
+ * ),
+ * errFile,
+ * errLine,
+ * errCol
+ * }
+ */
+Renderer.prototype.error = function (message, container, opt) {
+ if (!message) return
+ if (container === undefined) return
+ opt = opt || {}
+
+ var text
+ if (typeof message === 'string') {
+ text = message
+ message = yo`${message} `
+ } else if (message.innerText) {
+ text = message.innerText
+ }
+
+ var errLocation = text.match(/^([^:]*):([0-9]*):(([0-9]*):)? /)
+ if ((!opt.errFile || !opt.errCol || !opt.errLine) && errLocation) {
+ errLocation = parseRegExError(errLocation)
+ opt.errFile = errLocation.errFile
+ opt.errLine = errLocation.errLine
+ opt.errCol = errLocation.errCol
+ }
+
+ if (!opt.noAnnotations && errLocation) {
+ this._error(errLocation.errFile, {
+ row: errLocation.errLine,
+ column: errLocation.errCol,
+ text: text,
+ type: opt.type
+ })
+ }
+
+ var $pre = $(opt.useSpan ? yo` ` : yo` `).html(message)
+
+ let classList = opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning'
+ var $error = $(yo``).prepend($pre)
+ $(container).append($error)
+
+ $error.click((ev) => {
+ if (opt.click) {
+ opt.click(message)
+ } else if (opt.errFile && opt.errLine && opt.errCol) {
+ this._errorClick(opt.errFile, opt.errLine, opt.errCol)
+ }
+ })
+
+ $error.find('.close').click(function (ev) {
+ ev.preventDefault()
+ $error.remove()
+ return false
+ })
+}
+
+function parseRegExError (err) {
+ return {
+ errFile: err[1],
+ errLine: parseInt(err[2], 10) - 1,
+ errCol: err[4] ? parseInt(err[4], 10) : 0
+ }
+}
+
+module.exports = Renderer
diff --git a/apps/remix-ide/src/app/ui/sendTxCallbacks.js b/apps/remix-ide/src/app/ui/sendTxCallbacks.js
new file mode 100644
index 0000000000..9f30937c95
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/sendTxCallbacks.js
@@ -0,0 +1,109 @@
+const yo = require('yo-yo')
+const remixLib = require('@remix-project/remix-lib')
+const confirmDialog = require('./confirmDialog')
+const modalCustom = require('./modal-dialog-custom')
+const modalDialog = require('./modaldialog')
+const typeConversion = remixLib.execution.typeConversion
+const Web3 = require('web3')
+
+module.exports = {
+ getCallBacksWithContext: (udappUI, blockchain) => {
+ let callbacks = {}
+ callbacks.confirmationCb = confirmationCb
+ callbacks.continueCb = continueCb
+ callbacks.promptCb = promptCb
+ callbacks.udappUI = udappUI
+ callbacks.blockchain = blockchain
+ return callbacks
+ }
+}
+
+const continueCb = function (error, continueTxExecution, cancelCb) {
+ if (error) {
+ const msg = typeof error !== 'string' ? error.message : error
+ modalDialog(
+ 'Gas estimation failed',
+ yo`
+ Gas estimation errored with the following message (see below).
+ The transaction execution will likely fail. Do you want to force sending? ${msg}
+ `,
+ {
+ label: 'Send Transaction',
+ fn: () => continueTxExecution()
+ },
+ {
+ label: 'Cancel Transaction',
+ fn: () => cancelCb()
+ }
+ )
+ } else {
+ continueTxExecution()
+ }
+}
+
+const promptCb = function (okCb, cancelCb) {
+ modalCustom.promptPassphrase('Passphrase requested', 'Personal mode is enabled. Please provide passphrase of account', '', okCb, cancelCb)
+}
+
+const confirmationCb = function (network, tx, gasEstimation, continueTxExecution, cancelCb) {
+ let self = this
+ if (network.name !== 'Main') {
+ return continueTxExecution(null)
+ }
+ var amount = Web3.utils.fromWei(typeConversion.toInt(tx.value), 'ether')
+ var content = confirmDialog(tx, amount, gasEstimation, self.udappUI,
+ (gasPrice, cb) => {
+ let txFeeText, priceStatus
+ // TODO: this try catch feels like an anti pattern, can/should be
+ // removed, but for now keeping the original logic
+ try {
+ var fee = Web3.utils.toBN(tx.gas).mul(Web3.utils.toBN(Web3.utils.toWei(gasPrice.toString(10), 'gwei')))
+ txFeeText = ' ' + Web3.utils.fromWei(fee.toString(10), 'ether') + ' Ether'
+ priceStatus = true
+ } catch (e) {
+ txFeeText = ' Please fix this issue before sending any transaction. ' + e.message
+ priceStatus = false
+ }
+ cb(txFeeText, priceStatus)
+ },
+ (cb) => {
+ self.blockchain.web3().eth.getGasPrice((error, gasPrice) => {
+ const warnMessage = ' Please fix this issue before sending any transaction. '
+ if (error) {
+ return cb('Unable to retrieve the current network gas price.' + warnMessage + error)
+ }
+ try {
+ var gasPriceValue = Web3.utils.fromWei(gasPrice.toString(10), 'gwei')
+ cb(null, gasPriceValue)
+ } catch (e) {
+ cb(warnMessage + e.message, null, false)
+ }
+ })
+ }
+ )
+ modalDialog(
+ 'Confirm transaction',
+ content,
+ { label: 'Confirm',
+ fn: () => {
+ self.blockchain.config.setUnpersistedProperty(
+ 'doNotShowTransactionConfirmationAgain',
+ content.querySelector('input#confirmsetting').checked
+ )
+ // TODO: check if this is check is still valid given the refactor
+ if (!content.gasPriceStatus) {
+ cancelCb('Given gas price is not correct')
+ } else {
+ var gasPrice = Web3.utils.toWei(content.querySelector('#gasprice').value, 'gwei')
+ continueTxExecution(gasPrice)
+ }
+ }
+ },
+ {
+ label: 'Cancel',
+ fn: () => {
+ return cancelCb('Transaction canceled by user.')
+ }
+ }
+ )
+}
diff --git a/apps/remix-ide/src/app/ui/styles-guide/styleGuideClean.js b/apps/remix-ide/src/app/ui/styles-guide/styleGuideClean.js
new file mode 100644
index 0000000000..19ab6ca254
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/styles-guide/styleGuideClean.js
@@ -0,0 +1,855 @@
+// var csjs = require('csjs-inject')
+
+module.exports = styleGuideClean
+
+function styleGuideClean () {
+ /* --------------------------------------------------------------------------
+
+ CSS PROPERTIES
+
+ -------------------------------------------------------------------------- */
+ var cssProperties = {
+ /* ------------------------------------------------------
+ COLORS
+ ------------------------------------------------------ */
+ colors: {
+ // BASIC COLORS (B&W and transparent)
+ transparent: 'transparent',
+ white: 'hsl(0, 0%, 100%)',
+ black: 'black',
+ opacityBlack: 'hsla(0, 0%, 0%, .4)',
+
+ // BLUE
+ blue: 'hsla(229, 75%, 87%, 1)',
+ lightBlue: 'hsla(229, 75%, 87%, .5)',
+ backgroundBlue: 'hsla(229, 100%, 97%, 1)',
+ brightBlue: 'hsla(233, 91%, 58%, 1)',
+ azure: '#dbe9f4',
+ // GREY
+ grey: 'hsla(0, 0%, 40%, 1)',
+ lightGrey: 'hsla(0, 0%, 40%, .5)',
+ veryLightGrey: 'hsla(0, 0%, 40%, .2)',
+ // RED
+ strongRed: 'hsla(0, 100%, 71%, 1)',
+ red: 'hsla(0, 82%, 82%, 1)',
+ lightRed: 'hsla(0, 82%, 82%, .5)',
+ // GREEN
+ green: 'hsla(141, 75%, 84%, 1)',
+ lightGreen: 'hsla(141, 75%, 84%, .5)',
+ greenZing: 'hsla(148, 79%, 47%, 1)',
+ // PINK
+ pink: 'hsla(300, 69%, 76%, 1)',
+ lightPink: 'hsla(300, 69%, 76%, .5)',
+ // ORANGE
+ orange: 'hsla(44, 100%, 50%, 1)',
+ lightOrange: 'hsla(44, 100%, 50%, .5)',
+ // VIOLET
+ violet: 'hsla(240, 64%, 68%, 1)',
+ lightViolet: 'hsla(240, 64%, 68%, .5)'
+ },
+
+ /* ------------------------------------------------------
+ FONTS
+ ------------------------------------------------------ */
+ fonts: {
+ font: '14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif'
+ },
+
+ /* ------------------------------------------------------
+ BORDERS
+ ------------------------------------------------------ */
+ borders: {
+ secondary_borderRadius: '5px'
+ }
+ }
+
+ /* --------------------------------------------------------------------------
+
+ APP PROPERTIES
+
+ -------------------------------------------------------------------------- */
+
+ var appProperties = {
+
+ /* ------------------------------------------------------
+ ACE THEME
+ ------------------------------------------------------ */
+
+ aceTheme: '',
+
+ /* ------------------------------------------------------
+ BACKGROUND COLORS
+ ------------------------------------------------------ */
+ primary_BackgroundColor: cssProperties.colors.white,
+ secondary_BackgroundColor: cssProperties.colors.white,
+ tertiary_BackgroundColor: cssProperties.colors.white,
+ quaternary_BackgroundColor: cssProperties.colors.white,
+ fifth_BackgroundColor: cssProperties.colors.white,
+ seventh_BackgroundColor: cssProperties.colors.white,
+ dark_BackgroundColor: cssProperties.colors.black,
+ light_BackgroundColor: cssProperties.colors.white,
+ debuggingMode_BackgroundColor: cssProperties.colors.veryLightGrey,
+ highlight_BackgroundColor: cssProperties.colors.veryLightGrey,
+ /* ------------------------------------------------------
+ RESIZING
+ ******************************************************** */
+ ghostBar: cssProperties.colors.veryLightGrey,
+ draggingBar: cssProperties.colors.veryLightGrey,
+
+ /* ------------------------------------------------------
+ TEXT COLORS
+ ******************************************************** */
+ mainText_Color: cssProperties.colors.black,
+ supportText_Color: cssProperties.colors.grey,
+
+ sub_supportText_Color: cssProperties.colors.black,
+ specialText_Color: cssProperties.colors.greenZing,
+ brightText_Color: cssProperties.colors.brightBlue,
+ oppositeText_Color: cssProperties.colors.black,
+ additionalText_Color: cssProperties.colors.veryLightGrey,
+
+ errorText_Color: cssProperties.colors.strongRed,
+ warningText_Color: cssProperties.colors.orange,
+ infoText_Color: cssProperties.colors.violet,
+ greyedText_color: cssProperties.colors.veryLightGrey,
+ /* ------------------------------------------------------
+ ICONS
+ ******************************************************** */
+ icon_Color: cssProperties.colors.black,
+ icon_AltColor: cssProperties.colors.white,
+ icon_HoverColor: cssProperties.colors.grey,
+ icon_ConstantColor: cssProperties.colors.black,
+
+ /* ------------------------------------------------------
+ MESSAGES
+ ******************************************************** */
+ // Success
+ success_TextColor: cssProperties.colors.black,
+ success_BackgroundColor: cssProperties.colors.lightGreen,
+ success_BorderColor: cssProperties.colors.green,
+
+ // Danger
+ danger_TextColor: cssProperties.colors.black,
+ danger_BackgroundColor: cssProperties.colors.lightRed,
+ danger_BorderColor: cssProperties.colors.red,
+
+ // Warning
+ warning_TextColor: cssProperties.colors.black,
+ warning_BackgroundColor: cssProperties.colors.lightOrange,
+ warning_BorderColor: cssProperties.colors.orange,
+
+ // Tooltip
+ tooltip_Color: cssProperties.colors.white,
+ tooltip_BackgroundColor: cssProperties.colors.grey,
+ tooltip_BorderColor: cssProperties.colors.grey,
+
+ /* ------------------------------------------------------
+ DROPDOWN
+ ******************************************************** */
+ dropdown_TextColor: cssProperties.colors.black,
+ dropdown_BackgroundColor: cssProperties.colors.white,
+ dropdown_SecondaryBackgroundColor: cssProperties.colors.white,
+ dropdown_BorderColor: cssProperties.colors.veryLightGrey,
+
+ /* ------------------------------------------------------
+ INPUT
+ ******************************************************** */
+ input_TextColor: cssProperties.colors.black,
+ input_BackgroundColor: cssProperties.colors.white,
+ input_BorderColor: cssProperties.colors.veryLightGrey,
+
+ /* ------------------------------------------------------
+ SOLID BORDER BOX
+ ******************************************************** */
+ solidBorderBox_TextColor: cssProperties.colors.black,
+ solidBorderBox_BackgroundColor: cssProperties.colors.white,
+ solidBorderBox_BorderColor: cssProperties.colors.white,
+
+ /* ------------------------------------------------------
+ SOLID BOX
+ ******************************************************** */
+ solidBox_TextColor: cssProperties.colors.black,
+ solidBox_BackgroundColor: cssProperties.colors.white,
+
+ /* ------------------------------------------------------
+ BUTTONS
+ ******************************************************** */
+
+ /* .................
+ PRIMARY
+ .................. */
+ primaryButton_TextColor: cssProperties.colors.black,
+ primaryButton_BackgroundColor: cssProperties.colors.white,
+ primaryButton_BorderColor: cssProperties.colors.black,
+ primaryButton_BorderWidth: '1px',
+
+ /* .................
+ SECONDARY
+ .................. */
+ secondaryButton_TextColor: cssProperties.colors.black,
+ secondaryButton_BackgroundColor: cssProperties.colors.white,
+ secondaryButton_BorderColor: cssProperties.colors.black,
+
+ /* .................
+ Teriary
+ .................. */
+ teriaryButton_TextColor: cssProperties.colors.black,
+ teriaryButton_BackgroundColor: cssProperties.colors.white,
+ teriaryButton_BorderColor: cssProperties.colors.black,
+ /* .................
+
+ /* .................
+ Quaternary
+ .................. */
+ quaternaryButton_TextColor: cssProperties.colors.black,
+ quaternaryButton_BackgroundColor: cssProperties.colors.white,
+ quaternaryButton_BorderColor: cssProperties.colors.black,
+ /* .................
+
+ /* .................
+ Fifth
+ .................. */
+ fifthButton_TextColor: cssProperties.colors.black,
+ fifthButton_BackgroundColor: cssProperties.colors.white,
+ fifthButton_BorderColor: cssProperties.colors.black,
+ /* .................
+
+ /* .................
+ Sixth
+ .................. */
+ sixthButton_TextColor: cssProperties.colors.black,
+ sixthButton_BackgroundColor: cssProperties.colors.white,
+ sixthButton_BorderColor: cssProperties.colors.black,
+ /* .................
+
+ SUCCESS
+ .................. */
+ successButton_TextColor: cssProperties.colors.white,
+ successButton_BackgroundColor: cssProperties.colors.green,
+ successButton_BorderColor: cssProperties.colors.green,
+
+ /* .................
+ DANGER
+ .................. */
+ dangerButton_TextColor: cssProperties.colors.white,
+ dangerButton_BackgroundColor: cssProperties.colors.red,
+ dangerButton_BorderColor: cssProperties.colors.red,
+
+ /* .................
+ WARNING
+ .................. */
+ warningButton_TextColor: cssProperties.colors.white,
+ warningButton_BackgroundColor: cssProperties.colors.lightOrange,
+ warningButton_BorderColor: cssProperties.colors.lightOrange,
+
+ /* .................
+ INFO
+ .................. */
+ infoButton_TextColor: cssProperties.colors.black,
+ infoButton_BackgroundColor: cssProperties.colors.white,
+ infoButton_BorderColor: cssProperties.colors.black,
+
+ /* .................
+ SOLIDITY
+ .................. */
+
+ // CALL
+ callButton_TextColor: cssProperties.colors.black,
+ callButton_BackgroundColor: cssProperties.colors.lightBlue,
+ callButton_BorderColor: cssProperties.colors.lightBlue,
+
+ // TRANSACTION
+ transactButton_TextColor: cssProperties.colors.black,
+ transactButton_BackgroundColor: cssProperties.colors.lightRed,
+ transactButton_BorderColor: cssProperties.colors.lightRed,
+
+ // CONSTANT
+ constantButton_TextColor: cssProperties.colors.black,
+ constantButton_BackgroundColor: cssProperties.colors.lightBlue,
+ constantButton_BorderColor: cssProperties.colors.lightBlue,
+
+ // PAYABLE TRANSACTION
+ transactPayableButton_TextColor: cssProperties.colors.black,
+ transactPayableButton_BackgroundColor: cssProperties.colors.red,
+ transactPayableButton_BorderColor: cssProperties.colors.red,
+
+ /* ------------------------------------------------------
+ UI ELEMENTS
+ ******************************************************** */
+
+ uiElements: {
+ solidBorderBox: (opts = {}) => `
+ background-color : ${opts.BackgroundColor};
+ border : 1px solid ${opts.BorderColor};
+ color : ${opts.Color};
+ border-radius : ${cssProperties.borders.primary_borderRadius}
+ font-size : 12px;
+ padding : 10px 15px;
+ line-height : 20px;
+ overflow : hidden;
+ word-break : break-word;
+ width : 100%;
+ `,
+
+ solidBox: (opts = {}) => `
+ background-color : ${opts.BackgroundColor};
+ color : ${opts.Color};
+ font-size : 12px;
+ padding : 10px 15px;
+ line-height : 20px;
+ overflow : hidden;
+ word-break : break-word;
+ width : 100%;
+ `,
+
+ dottedBorderBox: (opts = {}) => `
+ background-color : ${opts.BackgroundColor};
+ border : .2em dotted ${opts.BorderColor};
+ color : ${opts.Color};
+ border-radius : ${cssProperties.borders.secondary_borderRadius};
+ line-height : 20px;
+ padding : 8px 15px;
+ margin-bottom : 1em;
+ overflow : hidden;
+ word-break : break-word;
+ `,
+
+ inputField: (opts = {}) => `
+ background-color : ${opts.BackgroundColor};
+ border : 1px solid ${opts.BorderColor};
+ color : ${opts.Color};
+ border-radius : ${cssProperties.borders.secondary_borderRadius};
+ height : 25px;
+ width : 250px;
+ padding : 0 8px;
+ overflow : hidden;
+ word-break : normal;
+ `,
+
+ dropdown: (opts = {}) => `
+ background-color : ${opts.BackgroundColor};
+ border : 1px solid ${opts.BorderColor};
+ color : ${opts.Color};
+ font-size : 12px;
+ font-weight : bold;
+ padding : 0 8px;
+ text-decoration : none;
+ cursor : pointer;
+ border-radius : 3px;
+ height : 25px;
+ width : 100%;
+ text-align : center;
+ overflow : hidden;
+ word-break : normal;
+ `,
+
+ button: (opts = {}) => `
+ margin : 1px;
+ background-color : ${opts.BackgroundColor};
+ color : ${opts.Color};
+ border : 1px solid;
+ display : flex;
+ align-items : center;
+ justify-content : center;
+ cursor : pointer;
+ min-height : 25px;
+ max-height : 25px;
+ width : 70px;
+ min-width : 70px;
+ font-size : 12px;
+ overflow : hidden;
+ word-break : normal;
+ border-radius : ${opts.BorderRadius};
+ border-width : ${opts.BorderWidth};
+ border-color : ${opts.BorderColor};
+ border-style : ${opts.BorderStyle};
+ `
+ }
+ }
+
+ /* --------------------------------------------------------------------------
+
+ REMIX PROPERTIES
+
+ -------------------------------------------------------------------------- */
+
+ var remixProperties = {
+ /* ------------------------------------------------------
+ REMIX GENERAL
+ /* ------------------------------------------------------ */
+ remix: {
+ modalDialog_BackgroundColor_Primary: appProperties.primary_BackgroundColor,
+ modalDialog_text_Primary: appProperties.mainText_Color,
+ modalDialog_text_Secondary: appProperties.supportText_Color,
+ modalDialog_text_Link: appProperties.brightText_Color,
+ modalDialog_text_Em: appProperties.specialText_Color,
+ modalDialog_Header_Footer_BackgroundColor: appProperties.secondary_BackgroundColor,
+ modalDialog_Header_Footer_Color: appProperties.mainText_Color,
+ modalDialog_BoxDottedBorder_BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ modalDialog_BoxDottedBorder_BorderColor: appProperties.solidBorderBox_BorderColor,
+ modalDialog_BoxDottedBorder_Color: appProperties.solidBorderBox_TextColor,
+
+ tooltip_CopyToClipboard_BackgroundColor: appProperties.tooltip_BackgroundColor,
+ tooltip_CopyToClipboard_Color: appProperties.tooltip_Color,
+
+ icon_Color_CopyToClipboard: appProperties.icon_Color,
+ icon_HoverColor_CopyToClipboard: appProperties.icon_HoverColor,
+
+ solidBox: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.solidBox_BackgroundColor,
+ Color: appProperties.solidBox_TextColor
+ })
+ },
+
+ /* ------------------------------------------------------
+ LEFT PANEL (FILE PANEL)
+ /* ------------------------------------------------------ */
+ leftPanel: {
+ backgroundColor_Panel: appProperties.primary_BackgroundColor,
+ backgroundColor_FileExplorer: appProperties.tertiary_BackgroundColor,
+
+ text_Primary: appProperties.mainText_Color,
+ text_Secondary: appProperties.supportText_Color,
+ text_Teriary: appProperties.sub_supportText_Color,
+
+ bar_Ghost: appProperties.ghostBar,
+ bar_Dragging: appProperties.draggingBar,
+ dragbarBorderRight: '2px solid ' + cssProperties.colors.veryLightGrey,
+
+ icon_Color_Menu: appProperties.icon_Color,
+ icon_HoverColor_Menu: appProperties.icon_HoverColor,
+
+ icon_Color_TogglePanel: appProperties.icon_Color,
+ icon_HoverColor_TogglePanel: appProperties.icon_HoverColor
+
+ },
+
+ /* ------------------------------------------------------
+ EDITOR
+ /* ------------------------------------------------------ */
+ editor: {
+ backgroundColor_Panel: appProperties.primary_BackgroundColor,
+ backgroundColor_Editor: appProperties.light_BackgroundColor,
+ backgroundColor_Tabs_Highlights: appProperties.secondary_BackgroundColor,
+ backgroundColor_Editor_Context_Highlights: appProperties.secondary_BackgroundColor,
+ backgroundColor_Editor_Context_Error_Highlights: appProperties.error_BackgroundColor,
+ backgroundColor_DebuggerMode: appProperties.debuggingMode_BackgroundColor,
+
+ text_Primary: appProperties.mainText_Color,
+ text_Secondary: appProperties.supportText_Color,
+ text_Teriary: appProperties.sub_supportText_Color,
+ text_Editor: '',
+
+ icon_Color_Editor: appProperties.icon_Color,
+ icon_HoverColor_Editor: appProperties.icon_HoverColor
+
+ },
+
+ /* ------------------------------------------------------
+ TERMINAL
+ /* ------------------------------------------------------ */
+ terminal: {
+ backgroundColor_Menu: appProperties.secondary_BackgroundColor,
+ backgroundColor_Terminal: appProperties.seventh_BackgroundColor,
+ backgroundColor_TerminalCLI: appProperties.seventh_BackgroundColor,
+ backgroundImage_Terminal: "url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iNTEycHgiIGhlaWdodD0iNTEycHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCgk8ZyBvcGFjaXR5PSIwLjEiPg0KCQk8Zz4NCgkJCTxwYXRoIGZpbGw9IiM0MTQwNDIiIGQ9Ik03MC41ODIsNDI4LjkwNGMwLjgxMSwwLDEuNjIyLDAuMjg1LDIuNDM3LDAuODUzYzAuODExLDAuNTcxLDEuMjE4LDEuMzQsMS4yMTgsMi4zMTQNCgkJCQljMCwyLjI3Ny0xLjA1OSwzLjQ5Ni0zLjE2OCwzLjY1NmMtNS4wMzgsMC44MTQtOS4zODEsMi4zNTYtMTMuMDM3LDQuNjNjLTMuNjU1LDIuMjc2LTYuNjYzLDUuMTE3LTkuMDE2LDguNTI4DQoJCQkJYy0yLjM1NywzLjQxMS00LjEwNCw3LjI3Mi01LjIzOSwxMS41NzVjLTEuMTM5LDQuMzA3LTEuNzA2LDguODE0LTEuNzA2LDEzLjUyNHYzMi42NTNjMCwyLjI3My0xLjEzOSwzLjQxMS0zLjQxMiwzLjQxMQ0KCQkJCWMtMi4yNzcsMC0zLjQxMi0xLjEzOC0zLjQxMi0zLjQxMXYtNzQuMzIzYzAtMi4yNzMsMS4xMzUtMy40MTEsMy40MTItMy40MTFjMi4yNzMsMCwzLjQxMiwxLjEzOCwzLjQxMiwzLjQxMXYxNS4xMDgNCgkJCQljMS40NjItMi40MzcsMy4yMDYtNC43NTIsNS4yMzktNi45NDVjMi4wMjktMi4xOTMsNC4yNjQtNC4xNDMsNi43MDEtNS44NDhjMi40MzctMS43MDYsNS4wNzYtMy4wODUsNy45MTktNC4xNDMNCgkJCQlDNjQuNzcxLDQyOS40MzMsNjcuNjU4LDQyOC45MDQsNzAuNTgyLDQyOC45MDR6Ii8+DQoJCQk8cGF0aCBmaWxsPSIjNDE0MDQyIiBkPSJNMTM3Ljc3Myw0MjcuMTk4YzUuNjg1LDAsMTAuOTY2LDEuMTgxLDE1LjgzOSwzLjUzNGM0Ljg3NCwyLjM1Niw5LjA1NSw1LjQ4MiwxMi41NSw5LjM4MQ0KCQkJCWMzLjQ5MiwzLjg5OSw2LjIxNCw4LjQwNyw4LjE2NCwxMy41MjRjMS45NDksNS4xMTcsMi45MjQsMTAuNDQsMi45MjQsMTUuOTYxYzAsMC45NzYtMC4zNjYsMS43OS0xLjA5NywyLjQzOA0KCQkJCWMtMC43MzEsMC42NS0xLjU4MywwLjk3NS0yLjU1OSwwLjk3NWgtNjcuOTg3YzAuNDg3LDQuMjI2LDEuNTg0LDguMjg1LDMuMjksMTIuMTg0YzEuNzA2LDMuODk5LDMuOTM3LDcuMzEyLDYuNzAxLDEwLjIzNA0KCQkJCWMyLjc2MSwyLjkyNSw2LjAwOCw1LjI4MSw5Ljc0OCw3LjA2N2MzLjczNSwxLjc4OSw3Ljg3NywyLjY4MSwxMi40MjgsMi42ODFjMTIuMDIxLDAsMjEuMzYtNC43OSwyOC4wMjMtMTQuMzc3DQoJCQkJYzAuNjQ3LTEuMTM2LDEuNjIyLTEuNzA2LDIuOTI0LTEuNzA2YzIuMjczLDAsMy40MTIsMS4xMzksMy40MTIsMy40MTJjMCwwLjE2My0wLjE2NCwwLjczLTAuNDg3LDEuNzA1DQoJCQkJYy0zLjQxMiw2LjAxMy04LjIwNSwxMC40NzktMTQuMzc3LDEzLjQwMmMtNi4xNzYsMi45MjQtMTIuNjcxLDQuMzg3LTE5LjQ5NSw0LjM4N2MtNS42ODksMC0xMC45MjgtMS4xODEtMTUuNzE4LTMuNTMzDQoJCQkJYy00Ljc5My0yLjM1NC04LjkzNi01LjQ4My0xMi40MjgtOS4zODJjLTMuNDk1LTMuODk5LTYuMjE0LTguNDA3LTguMTYzLTEzLjUyNGMtMS45NS01LjExOC0yLjkyNC0xMC40MzctMi45MjQtMTUuOTYyDQoJCQkJYzAtNS41MjEsMC45NzUtMTAuODQ0LDIuOTI0LTE1Ljk2MWMxLjk0OS01LjExNyw0LjY2OC05LjYyNSw4LjE2My0xMy41MjRjMy40OTItMy44OTgsNy42MzQtNy4wMjQsMTIuNDI4LTkuMzgxDQoJCQkJQzEyNi44NDYsNDI4LjM3OSwxMzIuMDg0LDQyNy4xOTgsMTM3Ljc3Myw0MjcuMTk4eiBNMTY5Ljk0LDQ2Ni4xODhjLTAuMzI4LTQuMjIzLTEuMzQxLTguMjg1LTMuMDQ2LTEyLjE4NA0KCQkJCWMtMS43MDYtMy44OTktMy45ODItNy4zMTItNi44MjMtMTAuMjM1Yy0yLjg0NC0yLjkyNC02LjE3NS01LjI3Ny05Ljk5MS03LjA2N2MtMy44MTktMS43ODUtNy45Mi0yLjY4LTEyLjMwNi0yLjY4DQoJCQkJYy00LjU1LDAtOC42OTIsMC44OTUtMTIuNDI4LDIuNjhjLTMuNzM5LDEuNzktNi45ODcsNC4xNDQtOS43NDgsNy4wNjdjLTIuNzY0LDIuOTI0LTQuOTk1LDYuMzM2LTYuNzAxLDEwLjIzNQ0KCQkJCWMtMS43MDYsMy44OTgtMi44MDIsNy45NjEtMy4yOSwxMi4xODRIMTY5Ljk0eiIvPg0KCQkJPHBhdGggZmlsbD0iIzQxNDA0MiIgZD0iTTMwNC42OSw0MjcuNDQxYzUuMDM0LDAsOS41MDQsMS4wMTgsMTMuNDAyLDMuMDQ3YzMuODk5LDIuMDMzLDcuMTg5LDQuNjcyLDkuODcsNy45Mg0KCQkJCWMyLjY4LDMuMjUxLDQuNzA5LDcuMDY2LDYuMDkyLDExLjQ1MmMxLjM3OSw0LjM4NywyLjA3LDguODU2LDIuMDcsMTMuNDAydjQzLjYyYzAsMC45NzUtMC4zNjUsMS43ODktMS4wOTcsMi40MzgNCgkJCQljLTAuNzMsMC42NDYtMS41MDMsMC45NzUtMi4zMTMsMC45NzVjLTIuMjc2LDAtMy40MTItMS4xNC0zLjQxMi0zLjQxMnYtNDMuNjJjMC0zLjU3MS0wLjUyOS03LjEwNC0xLjU4NC0xMC42DQoJCQkJYy0xLjA1OS0zLjQ5MS0yLjYwMi02LjYxOC00LjYzLTkuMzgyYy0yLjAzMy0yLjc2MS00LjU5Mi00Ljk1My03LjY3Ny02LjU4Yy0zLjA4OC0xLjYyMS02LjY2Mi0yLjQzNi0xMC43MjItMi40MzYNCgkJCQljLTUuMiwwLTkuNTg3LDEuMjE4LTEzLjE1OSwzLjY1NGMtMy41NzQsMi40MzgtNi40NTcsNS41NjYtOC42NSw5LjM4MmMtMi4xOTMsMy44MTktMy44MTgsOC4wNDItNC44NzQsMTIuNjcyDQoJCQkJYy0xLjA1OSw0LjYzLTEuNTg0LDkuMDU4LTEuNTg0LDEzLjI4djMzLjYyOWMwLDAuOTc1LTAuMzY1LDEuNzg5LTEuMDk2LDIuNDM4Yy0wLjczMSwwLjY0Ni0xLjUwNSwwLjk3NS0yLjMxNSwwLjk3NQ0KCQkJCWMtMi4yNzYsMC0zLjQxMS0xLjE0LTMuNDExLTMuNDEydi00My42MmMwLTMuNTcxLTAuNTMtNy4xMDQtMS41ODUtMTAuNmMtMS4wNTgtMy40OTEtMi42MDEtNi42MTgtNC42MjktOS4zODINCgkJCQljLTIuMDM0LTIuNzYxLTQuNTkyLTQuOTUzLTcuNjc3LTYuNThjLTMuMDg3LTEuNjIxLTYuNjYzLTIuNDM2LTEwLjcyMi0yLjQzNmMtNS4wMzcsMC05LjM0NCwwLjg5NS0xMi45MTUsMi42OA0KCQkJCWMtMy41NzUsMS43OS02LjU0Miw0LjI2Ni04Ljg5NSw3LjQzM2MtMi4zNTcsMy4xNjctNC4wNjMsNi45NDQtNS4xMTcsMTEuMzMxYy0xLjA1OSw0LjM4Ni0xLjU4NCw5LjEtMS41ODQsMTQuMTM0djMuODk5djAuMjQzDQoJCQkJdjMyLjg5N2MwLDIuMjcyLTEuMTM4LDMuNDEyLTMuNDEyLDMuNDEyYy0yLjI3NiwwLTMuNDExLTEuMTQtMy40MTEtMy40MTJ2LTc0LjU2N2MwLTIuMjczLDEuMTM1LTMuNDExLDMuNDExLTMuNDExDQoJCQkJYzIuMjczLDAsMy40MTIsMS4xMzgsMy40MTIsMy40MTF2MTIuNDI4YzIuOTI0LTUuMTk3LDYuODYxLTkuMzgyLDExLjgxOS0xMi41NWM0Ljk1NC0zLjE2NywxMC41MTctNC43NTIsMTYuNjkyLTQuNzUyDQoJCQkJYzYuOTgzLDAsMTIuOTk1LDEuOTkxLDE4LjAzMiw1Ljk3YzUuMDMzLDMuOTgzLDguNjg4LDkuMjIzLDEwLjk2NiwxNS43MTljMi43Ni02LjMzNiw2LjczOS0xMS41MzMsMTEuOTQtMTUuNTk2DQoJCQkJQzI5MS4xMjUsNDI5LjQ3NSwyOTcuMzgsNDI3LjQ0MSwzMDQuNjksNDI3LjQ0MXoiLz4NCgkJCTxwYXRoIGZpbGw9IiM0MTQwNDIiIGQ9Ik0zNzguNzUzLDQyOS4zOTJjMC44MTEsMCwxLjU4NCwwLjM2NSwyLjMxNCwxLjA5N2MwLjczMSwwLjczLDEuMDk3LDEuNTA0LDEuMDk3LDIuMzE0djc0LjA4DQoJCQkJYzAsMC44MTQtMC4zNjUsMS41ODQtMS4wOTcsMi4zMTVjLTAuNzMsMC43My0xLjUwNCwxLjA5Ny0yLjMxNCwxLjA5N2MtMC45NzUsMC0xLjc5LTAuMzY2LTIuNDM4LTEuMDk3DQoJCQkJYy0wLjY1LTAuNzMxLTAuOTc1LTEuNTAxLTAuOTc1LTIuMzE1di03NC4wOGMwLTAuODExLDAuMzI0LTEuNTg0LDAuOTc1LTIuMzE0QzM3Ni45NjMsNDI5Ljc1NywzNzcuNzc4LDQyOS4zOTIsMzc4Ljc1Myw0MjkuMzkyeiINCgkJCQkvPg0KCQkJPHBhdGggZmlsbD0iIzQxNDA0MiIgZD0iTTQ3My4zNCw0MjguNjZjMi4yNzMsMCwzLjQxMiwxLjEzOSwzLjQxMiwzLjQxMWwtMC40ODcsMS45NWwtMjQuMzY4LDM1LjMzNGwyNC4zNjgsMzUuNTc3DQoJCQkJYzAuMzIzLDAuOTc2LDAuNDg3LDEuNjI2LDAuNDg3LDEuOTVjMCwyLjI3Mi0xLjEzOSwzLjQxMi0zLjQxMiwzLjQxMmMtMS4zMDIsMC0yLjE5My0wLjQ4OC0yLjY4LTEuNDYzbC0yMi45MDYtMzMuMzg0DQoJCQkJbC0yMi42NjMsMzMuMzg0Yy0wLjgxNCwwLjk3NS0xLjc5LDEuNDYzLTIuOTI0LDEuNDYzYy0yLjI3NywwLTMuNDExLTEuMTQtMy40MTEtMy40MTJjMC0wLjMyNCwwLjE1OS0wLjk3NSwwLjQ4Ni0xLjk1DQoJCQkJbDI0LjM2OS0zNS41NzdsLTI0LjM2OS0zNS4zMzRsLTAuNDg2LTEuOTVjMC0yLjI3MiwxLjEzNC0zLjQxMSwzLjQxMS0zLjQxMWMxLjEzNCwwLDIuMTA5LDAuNDg3LDIuOTI0LDEuNDYybDIyLjY2MywzMy4xNDENCgkJCQlsMjIuOTA2LTMzLjE0MUM0NzEuMTQ2LDQyOS4xNDcsNDcyLjAzOCw0MjguNjYsNDczLjM0LDQyOC42NnoiLz4NCgkJPC9nPg0KCQk8Zz4NCgkJCTxnPg0KCQkJCTxnIG9wYWNpdHk9IjAuNDUiPg0KCQkJCQk8Zz4NCgkJCQkJCTxwb2x5Z29uIGZpbGw9IiMwMTAxMDEiIHBvaW50cz0iMTUwLjczNCwxOTYuMjEyIDI1NS45NjksMzQ0LjUwOCAyNTUuOTY5LDI1OC4zODciLz4NCgkJCQkJPC9nPg0KCQkJCTwvZz4NCgkJCQk8ZyBvcGFjaXR5PSIwLjgiPg0KCQkJCQk8Zz4NCgkJCQkJCTxwb2x5Z29uIGZpbGw9IiMwMTAxMDEiIHBvaW50cz0iMjU1Ljk2OSwyNTguMzg3IDI1NS45NjksMzQ0LjUwOCAzNjEuMjY3LDE5Ni4yMTIiLz4NCgkJCQkJPC9nPg0KCQkJCTwvZz4NCgkJCQk8ZyBvcGFjaXR5PSIwLjYiPg0KCQkJCQk8Zz4NCgkJCQkJCTxwb2x5Z29uIGZpbGw9IiMwMTAxMDEiIHBvaW50cz0iMjU1Ljk2OSwxMjYuNzgxIDE1MC43MzMsMTc0LjYxMSAyNTUuOTY5LDIzNi44MTggMzYxLjIwNCwxNzQuNjExIi8+DQoJCQkJCTwvZz4NCgkJCQk8L2c+DQoJCQkJPGcgb3BhY2l0eT0iMC40NSI+DQoJCQkJCTxnPg0KCQkJCQkJPHBvbHlnb24gZmlsbD0iIzAxMDEwMSIgcG9pbnRzPSIxNTAuNzM0LDE3NC42MTIgMjU1Ljk2OSwyMzYuODE4IDI1NS45NjksMTI2Ljc4MiAyNTUuOTY5LDAuMDAxIi8+DQoJCQkJCTwvZz4NCgkJCQk8L2c+DQoJCQkJPGcgb3BhY2l0eT0iMC44Ij4NCgkJCQkJPGc+DQoJCQkJCQk8cG9seWdvbiBmaWxsPSIjMDEwMTAxIiBwb2ludHM9IjI1NS45NjksMCAyNTUuOTY5LDEyNi43ODEgMjU1Ljk2OSwyMzYuODE4IDM2MS4yMDQsMTc0LjYxMSIvPg0KCQkJCQk8L2c+DQoJCQkJPC9nPg0KCQkJPC9nPg0KCQk8L2c+DQoJPC9nPg0KPC9zdmc+DQo=')",
+
+ text_Primary: appProperties.mainText_Color,
+ text_Secondary: appProperties.supportText_Color,
+ text_RegularLog: appProperties.mainText_Color,
+ text_InfoLog: appProperties.supportText_Color,
+ text_ErrorLog: appProperties.errorText_Color,
+ text_WarnLog: appProperties.warningText_Color,
+ text_Title_TransactionLog: appProperties.infoText_Color,
+ text_Regular_TransactionLog: appProperties.supportText_Color,
+ text_Button: appProperties.oppositeText_Color,
+
+ blockBorderTop: '2px solid ' + cssProperties.colors.veryLightGrey,
+
+ icon_Color_Log_Succeed: appProperties.success_BorderColor,
+ icon_Color_Log_Failed: appProperties.errorText_Color,
+ icon_BackgroundColor_Log_Call: appProperties.infoText_Color,
+ icon_Color_Log_Call: appProperties.icon_AltColor,
+
+ icon_Color_TogglePanel: appProperties.icon_Color,
+ icon_HoverColor_TogglePanel: appProperties.icon_HoverColor,
+ icon_Color_Menu: appProperties.icon_Color,
+ icon_HoverColor_Menu: appProperties.icon_HoverColor,
+
+ bar_Ghost: appProperties.ghostBar,
+ bar_Dragging: appProperties.draggingBar,
+
+ input_Search_MenuBar: appProperties.uiElements.inputField({
+ BackgroundColor: appProperties.input_BackgroundColor,
+ BorderColor: appProperties.input_BorderColor,
+ Color: appProperties.input_TextColor
+ }),
+
+ dropdown_Filter_MenuBar: appProperties.uiElements.dropdown({
+ BackgroundColor: appProperties.dropdown_BackgroundColor,
+ BorderColor: appProperties.dropdown_BorderColor,
+ Color: appProperties.dropdown_TextColor
+ }),
+
+ button_Log_Debug: appProperties.uiElements.button({
+ BackgroundColor: appProperties.quaternaryButton_BackgroundColor,
+ BorderColor: appProperties.infoButton_BorderColor,
+ Color: appProperties.infoButton_TextColor
+ }),
+
+ button_Log_Details: appProperties.uiElements.button({
+ BackgroundColor: appProperties.quaternaryButton_BackgroundColor,
+ BorderColor: appProperties.quaternaryButton_BorderColor,
+ Color: appProperties.quaternaryButton_TextColor
+ })
+
+ },
+
+ /* ------------------------------------------------------
+ RIGHT PANEL
+ /* ------------------------------------------------------ */
+ rightPanel: {
+ backgroundColor_Panel: appProperties.fifth_BackgroundColor,
+ backgroundColor_Tab: appProperties.fifth_BackgroundColor,
+ BackgroundColor_Pre: appProperties.primary_BackgroundColor,
+
+ text_Primary: appProperties.mainText_Color,
+ text_Secondary: appProperties.supportText_Color,
+ text_Teriary: appProperties.sub_supportText_Color,
+ text_link: appProperties.brightText_Color,
+
+ bar_Ghost: appProperties.ghostBar,
+ bar_Dragging: appProperties.draggingBar,
+ dragbarWidth: '2px',
+ dragbarBackgroundColor: cssProperties.colors.veryLightGrey,
+
+ icon_Color_TogglePanel: appProperties.icon_Color,
+ icon_HoverColor_TogglePanel: appProperties.icon_HoverColor,
+
+ message_Warning_BackgroundColor: appProperties.warning_BackgroundColor,
+ message_Warning_BorderColor: appProperties.warning_BorderColor,
+ message_Warning_Color: appProperties.warning_TextColor,
+
+ message_Error_BackgroundColor: appProperties.danger_BackgroundColor,
+ message_Error_BorderColor: appProperties.danger_BorderColor,
+ message_Error_Color: appProperties.danger_TextColor,
+
+ message_Success_BackgroundColor: appProperties.success_BackgroundColor,
+ message_Success_BorderColor: appProperties.success_BorderColor,
+ message_Success_Color: appProperties.success_TextColor,
+
+ /* ::::::::::::::
+ COMPILE TAB
+ ::::::::::::::: */
+ compileTab: {
+ button_Compile: appProperties.uiElements.button({
+ BackgroundColor: appProperties.primaryButton_BackgroundColor,
+ BorderColor: appProperties.primaryButton_BorderColor,
+ Color: appProperties.primaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ button_Details: appProperties.uiElements.button({
+ BackgroundColor: appProperties.secondaryButton_BackgroundColor,
+ BorderColor: appProperties.secondaryButton_BorderColor,
+ Color: appProperties.secondaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ button_Publish: appProperties.uiElements.button({
+ BackgroundColor: appProperties.secondaryButton_BackgroundColor,
+ BorderColor: appProperties.secondaryButton_BorderColor,
+ Color: appProperties.secondaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ dropdown_CompileContract: appProperties.uiElements.dropdown({
+ BackgroundColor: appProperties.dropdown_BackgroundColor,
+ BorderColor: appProperties.dropdown_BorderColor,
+ Color: appProperties.dropdown_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ box_CompileContainer: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.quaternary_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BackgroundColor,
+ Color: appProperties.solidBorderBox_TextColor
+ }),
+
+ icon_WarnCompilation_Color: appProperties.warning_BackgroundColor
+
+ },
+
+ /* ::::::::::::::
+ RUN TAB
+ ::::::::::::::: */
+ runTab: {
+
+ additionalText_Color: appProperties.additionalText_Color,
+
+ box_RunTab: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.solidBox_BackgroundColor,
+ Color: appProperties.solidBox_TextColor
+ }),
+
+ box_Info_RunTab: appProperties.uiElements.dottedBorderBox({
+ BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BorderColor,
+ Color: appProperties.solidBorderBox_TextColor
+ }),
+
+ dropdown_RunTab: appProperties.uiElements.dropdown({
+ BackgroundColor: appProperties.dropdown_BackgroundColor,
+ BorderColor: appProperties.dropdown_BorderColor,
+ Color: appProperties.dropdown_TextColor
+ }),
+ titlebox_RunTab: appProperties.uiElements.dropdown({
+ BackgroundColor: appProperties.dropdown_SecondaryBackgroundColor,
+ BorderColor: appProperties.dropdown_BorderColor,
+ Color: appProperties.dropdown_TextColor
+ }),
+
+ input_RunTab: appProperties.uiElements.inputField({
+ BackgroundColor: appProperties.input_BackgroundColor,
+ BorderColor: appProperties.input_BorderColor,
+ Color: appProperties.input_TextColor
+ }),
+
+ box_Instance: appProperties.uiElements.solidBox({
+ BackgroundColor: appProperties.solidBox_BackgroundColor,
+ Color: appProperties.solidBox_TextColor
+ }),
+
+ borderBox_Instance: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.solidBox_BackgroundColor,
+ Color: appProperties.solidBox_TextColor,
+ BorderColor: appProperties.solidBorderBox_BorderColor
+ }),
+
+ button_atAddress: appProperties.uiElements.button({
+ BackgroundColor: appProperties.primaryButton_BackgroundColor,
+ BorderColor: appProperties.primaryButton_BorderColor,
+ Color: appProperties.primaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+ button_Create: appProperties.uiElements.button({
+ BackgroundColor: appProperties.transactButton_BackgroundColor,
+ BorderColor: appProperties.transactButton_BorderColor,
+ Color: appProperties.transactButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+ button_Constant: appProperties.uiElements.button({
+ BackgroundColor: appProperties.constantButton_BackgroundColor,
+ BorderColor: appProperties.constantButton_BorderColor,
+ Color: appProperties.constantButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+ button_Instance_Call: appProperties.uiElements.button({
+ BackgroundColor: appProperties.callButton_BackgroundColor,
+ BorderColor: appProperties.callButton_BorderColor,
+ Color: appProperties.callButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+ button_Instance_Transact: appProperties.uiElements.button({
+ BackgroundColor: appProperties.transactButton_BackgroundColor,
+ BorderColor: appProperties.transactButton_BorderColor,
+ Color: appProperties.transactButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ button_Instance_TransactPayable: appProperties.uiElements.button({
+ BackgroundColor: appProperties.transactPayableButton_BackgroundColor,
+ BorderColor: appProperties.transactPayableButton_BorderColor,
+ Color: appProperties.transactPayableButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ icon_Color_Instance_CopyToClipboard: appProperties.icon_Color,
+ icon_AltColor_Instance_CopyToClipboard: appProperties.icon_AltColor,
+ icon_HoverColor_Instance_CopyToClipboard: appProperties.icon_HoverColor,
+
+ icon_Color: appProperties.icon_Color,
+ icon_HoverColor: appProperties.icon_HoverColor
+
+ },
+
+ /* ::::::::::::::
+ TEST TAB
+ ::::::::::::::: */
+ testTab: {
+ box_listTests: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BackgroundColor,
+ Color: appProperties.solidBorderBox_TextColor
+ }),
+
+ button_runTests: appProperties.uiElements.button({
+ BackgroundColor: appProperties.primaryButton_BackgroundColor,
+ BorderColor: appProperties.primaryButton_BorderColor,
+ Color: appProperties.primaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ button_generateTestFile: appProperties.uiElements.button({
+ BackgroundColor: appProperties.primaryButton_BackgroundColor,
+ BorderColor: appProperties.primaryButton_BorderColor,
+ Color: appProperties.primaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ color_testPass: appProperties.success_BackgroundColor,
+ color_testFail: appProperties.danger_BackgroundColor
+ },
+
+ /* ::::::::::::::
+ SETTINGS TAB
+ ::::::::::::::: */
+ settingsTab: {
+ box_SolidityVersionInfo: appProperties.uiElements.dottedBorderBox({
+ BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BorderColor,
+ Color: appProperties.solidBorderBox_TextColor
+ }),
+
+ dropdown_SelectCompiler: appProperties.uiElements.dropdown({
+ BackgroundColor: appProperties.dropdown_BackgroundColor,
+ BorderColor: appProperties.dropdown_BorderColor,
+ Color: appProperties.dropdown_TextColor
+ }),
+
+ button_LoadPlugin: appProperties.uiElements.button({
+ BackgroundColor: appProperties.secondaryButton_BackgroundColor,
+ BorderColor: appProperties.secondaryButton_BorderColor,
+ Color: appProperties.secondaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+ button_initPlugin: appProperties.uiElements.button({
+ BackgroundColor: appProperties.transactButton_BackgroundColor,
+ BorderColor: appProperties.transactButton_BorderColor,
+ Color: appProperties.secondaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ })
+ },
+
+ /* ::::::::::::::
+ DEBUGGER TAB
+ ::::::::::::::: */
+ debuggerTab: {
+ text_Primary: appProperties.mainText_Color,
+ text_Secondary: appProperties.supportText_Color,
+ text_BgHighlight: appProperties.highlight_BackgroundColor,
+
+ box_Debugger: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BackgroundColor,
+ Color: appProperties.solidBorderBox_TextColor
+ }),
+
+ button_Debugger: appProperties.uiElements.button({
+ BackgroundColor: appProperties.secondaryButton_BackgroundColor,
+ BorderColor: appProperties.secondaryButton_BorderColor,
+ Color: appProperties.secondaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ button_Debugger_icon_Color: appProperties.icon_ConstantColor,
+ button_Debugger_icon_HoverColor: appProperties.icon_HoverColor,
+
+ dropdown_Debugger: appProperties.uiElements.dropdown({
+ BackgroundColor: cssProperties.colors.veryLightGrey,
+ BorderColor: appProperties.dropdown_BorderColor,
+ Color: appProperties.dropdown_TextColor
+ }),
+
+ input_Debugger: appProperties.uiElements.inputField({
+ BackgroundColor: appProperties.input_BackgroundColor,
+ BorderColor: appProperties.input_BorderColor,
+ Color: appProperties.input_TextColor
+ }),
+
+ debuggerDropdowns_Instructions_Highlight_BackgroundColor: appProperties.secondary_BackgroundColor
+
+ },
+
+ /* ::::::::::::::
+ ANALYSIS TAB
+ ::::::::::::::: */
+ analysisTab: {
+ button_Run_AnalysisTab: appProperties.uiElements.button({
+ BackgroundColor: appProperties.primaryButton_BackgroundColor,
+ BorderColor: appProperties.primaryButton_BorderColor,
+ Color: appProperties.primaryButton_TextColor,
+ BorderWidth: appProperties.primaryButton_BorderWidth,
+ BorderRadius: cssProperties.borders.primary_borderRadius,
+ BorderStyle: 'solid'
+ }),
+
+ box_AnalysisContainer: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BackgroundColor,
+ Color: appProperties.solidBorderBox_TextColor
+ })
+ },
+
+ /* ::::::::::::::
+ SUPPORT TAB
+ ::::::::::::::: */
+ supportTab: {
+ box_IframeContainer: appProperties.uiElements.solidBorderBox({
+ BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BackgroundColor,
+ Color: appProperties.solidBorderBox_TextColor
+ }),
+
+ box_SupportInfo: appProperties.uiElements.dottedBorderBox({
+ BackgroundColor: appProperties.solidBorderBox_BackgroundColor,
+ BorderColor: appProperties.solidBorderBox_BorderColor,
+ Color: appProperties.solidBorderBox_TextColor
+ })
+
+ }
+
+ }
+ }
+
+ return {
+ colors: cssProperties.colors,
+ appProperties: appProperties,
+ borders: cssProperties.borders,
+ leftPanel: remixProperties.leftPanel,
+ editor: remixProperties.editor,
+ terminal: remixProperties.terminal,
+ rightPanel: remixProperties.rightPanel,
+ remix: remixProperties.remix
+ }
+}
diff --git a/apps/remix-ide/src/app/ui/styles/auto-complete-popup-styles.js b/apps/remix-ide/src/app/ui/styles/auto-complete-popup-styles.js
new file mode 100644
index 0000000000..114cbce501
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/styles/auto-complete-popup-styles.js
@@ -0,0 +1,73 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .popup {
+ position : absolute;
+ text-align : left;
+ display : none;
+ width : 95%;
+ font-family : monospace;
+ background-color : var(--secondary);
+ overflow : auto;
+ padding-bottom : 13px;
+ z-index : 80;
+ bottom : 1em;
+ border-width : 4px;
+ left : 2em;
+ }
+
+ .autoCompleteItem {
+ padding : 4px;
+ border-radius : 2px;
+ }
+
+ .popup a {
+ cursor : pointer;
+ }
+
+ .listHandlerShow {
+ display : block;
+ }
+
+ .listHandlerHide {
+ display : none;
+ }
+
+ .listHandlerButtonShow {
+ position : fixed;
+ width : 46%;
+ }
+
+ .pageNumberAlignment {
+ font-size : 10px;
+ float : right;
+ }
+
+ .modalContent {
+ position : absolute;
+ margin-left : 20%;
+ margin-bottom : 32px;
+ bottom : 0px;
+ padding : 0;
+ line-height : 18px;
+ font-size : 12px;
+ width : 40%;
+ box-shadow : 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
+ -webkit-animation-name: animatebottom;
+ -webkit-animation-duration: 0.4s;
+ animation-name : animatetop;
+ animation-duration: 0.4s
+ }
+
+ @-webkit-keyframes animatetop {
+ from {bottom: -300px; opacity: 0}
+ to {bottom: 0; opacity: 1}
+ }
+
+ @keyframes animatetop {
+ from {bottom: -300px; opacity: 0}
+ to {bottom: 0; opacity: 1}
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/ui/styles/dropdown-styles.js b/apps/remix-ide/src/app/ui/styles/dropdown-styles.js
new file mode 100644
index 0000000000..6868788b35
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/styles/dropdown-styles.js
@@ -0,0 +1,51 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .dropdown {
+ overflow : visible;
+ position : relative;
+ display : flex;
+ flex-direction : column;
+ margin-left : 10px;
+ width : auto;
+ margin-top : 2px;
+ max-height : 24px;
+ }
+ .selectbox {
+ display : flex;
+ align-items : center;
+ cursor : pointer;
+ }
+ .selected {
+ display : inline-block;
+ max-width : 30ch;
+ white-space : nowrap;
+ text-overflow : ellipsis;
+ overflow : hidden;
+ margin-right : 10px;
+ min-width : 200px;
+ }
+ .icon {
+ padding : 0px 5px;
+ }
+ .options {
+ position : absolute;
+ display : flex;
+ flex-direction : column;
+ align-items : end;
+ top : 23px;
+ left : 0;
+ width : 245px;
+ border : 1px solid var(--dark);
+ border-radius : 3px;
+ border-top : 0;
+ padding-left : 5px;
+ }
+ .option {
+ margin-left : 5px;
+ margin-top : 5px;
+ width : -webkit-fill-available;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/ui/styles/modal-dialog-custom-styles.js b/apps/remix-ide/src/app/ui/styles/modal-dialog-custom-styles.js
new file mode 100644
index 0000000000..6fb0055f2f
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/styles/modal-dialog-custom-styles.js
@@ -0,0 +1,9 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .prompt_text {
+ width: 100%;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/ui/styles/modaldialog-styles.js b/apps/remix-ide/src/app/ui/styles/modaldialog-styles.js
new file mode 100644
index 0000000000..da028aafb9
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/styles/modaldialog-styles.js
@@ -0,0 +1,33 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+
+ .modalFooter {
+ }
+ .modalContent {
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
+ -webkit-animation-name: animatetop;
+ -webkit-animation-duration: 0.4s;
+ animation-name: animatetop;
+ animation-duration: 0.4s
+ }
+ .modalBody {
+ word-break: break-word;
+ overflow-y: auto;
+ max-height: 600px;
+ }
+ .modalFooterOk {
+ }
+ .modalFooterCancel {
+ }
+ @-webkit-keyframes animatetop {
+ from {top: -300px; opacity: 0}
+ to {top: 0; opacity: 1}
+ }
+ @keyframes animatetop {
+ from {top: -300px; opacity: 0}
+ to {top: 0; opacity: 1}
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/ui/styles/renderer-styles.js b/apps/remix-ide/src/app/ui/styles/renderer-styles.js
new file mode 100644
index 0000000000..7dc047c440
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/styles/renderer-styles.js
@@ -0,0 +1,52 @@
+var yo = require('yo-yo')
+
+var css = yo``
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/ui/styles/tooltip-styles.js b/apps/remix-ide/src/app/ui/styles/tooltip-styles.js
new file mode 100644
index 0000000000..da1bcdd904
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/styles/tooltip-styles.js
@@ -0,0 +1,50 @@
+var csjs = require('csjs-inject')
+
+var css = csjs`
+ .tooltip {
+ z-index: 1001;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ position: fixed;
+ min-height: 50px;
+ padding: 16px 24px 12px;
+ border-radius: 3px;
+ bottom: -300;
+ left: 40%;
+ font-size: 14px;
+ text-align: center;
+ bottom: 0;
+ flex-direction: row;
+ }
+ @-webkit-keyframes animatebottom {
+ 0% {bottom: -300px}
+ 100% {bottom: 0}
+ }
+ @keyframes animatebottom {
+ 0% {bottom: -300px}
+ 100% {bottom: 0}
+ }
+ @-webkit-keyframes animatetop {
+ 0% {bottom: 0}
+ 100% {bottom: -300px}
+ }
+ @keyframes animatetop {
+ 0% {bottom: 0}
+ 100% {bottom: -300px}
+ }
+ .animateTop {
+ -webkit-animation-name: animatetop;
+ -webkit-animation-duration: 2s;
+ animation-name: animatetop;
+ animation-duration: 2s;
+ }
+ .animateBottom {
+ -webkit-animation-name: animatebottom;
+ -webkit-animation-duration: 2s;
+ animation-name: animatebottom;
+ animation-duration: 2s;
+ }
+`
+
+module.exports = css
diff --git a/apps/remix-ide/src/app/ui/svgLogo.js b/apps/remix-ide/src/app/ui/svgLogo.js
new file mode 100644
index 0000000000..ccce67bfef
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/svgLogo.js
@@ -0,0 +1,9 @@
+import yo from 'yo-yo'
+export function basicLogo () {
+ return yo`
+remix_logo1
+
+
+
+ `
+}
diff --git a/apps/remix-ide/src/app/ui/tooltip.js b/apps/remix-ide/src/app/ui/tooltip.js
new file mode 100644
index 0000000000..955a30fedc
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/tooltip.js
@@ -0,0 +1,118 @@
+/* global Element */
+var yo = require('yo-yo')
+var css = require('./styles/tooltip-styles')
+var modal = require('./modal-dialog-custom')
+
+/**
+ * Open a tooltip
+ * @param {string} tooltipText The text shown by the tooltip
+ * @param {function} [action] Returns An HTMLElement to display for action
+ */
+module.exports = function addTooltip (tooltipText, action, opts) {
+ action = action || function () { return yo`
` }
+ let t = new Toaster()
+ return t.render(tooltipText, action(t), opts)
+}
+
+class Toaster {
+ hide () {
+ if (this.id) clearTimeout(this.id)
+ setTimeout(() => {
+ // remove from body after the animation is finished
+ if (this.tooltip.parentElement) this.tooltip.parentElement.removeChild(this.tooltip)
+ }, 2000)
+ animation(this.tooltip, css.animateTop.className)
+ }
+
+ /**
+ * Force resolve the promise to close
+ * the toaster ignoring timeout
+ */
+ forceResolve () {
+ if (this.id) clearTimeout(this.id)
+ if (this.resolveFn) this.resolveFn()
+ }
+
+ render (tooltipText, actionElement, opts) {
+ opts = defaultOptions(opts)
+ let canShorten = true
+ if (tooltipText instanceof Element) {
+ canShorten = false
+ } else {
+ if (typeof tooltipText === 'object') {
+ if (tooltipText.message) {
+ tooltipText = tooltipText.message
+ } else {
+ try {
+ tooltipText = JSON.stringify(tooltipText)
+ } catch (e) {
+ }
+ }
+ }
+ }
+
+ return new Promise((resolve, reject) => {
+ const shortTooltipText = (canShorten && tooltipText.length > 201) ? tooltipText.substring(0, 200) + '...' : tooltipText
+ this.resolveFn = resolve
+
+ function showFullMessage () {
+ modal.alert(tooltipText)
+ }
+
+ function closeTheToaster (self) {
+ self.hide()
+ over()
+ resolve()
+ }
+ let button = tooltipText.length > 201 ? yo`
+ showFullMessage()}>Show full message
+ ` : ``
+
+ this.tooltip = yo`
+ { over() }} onmouseleave=${() => { out() }}>
+
+ ${shortTooltipText}
+ ${button}
+ ${actionElement}
+
+
+ closeTheToaster(this)}>
+
+
`
+ let timeOut = () => {
+ return setTimeout(() => {
+ if (this.id) {
+ this.hide()
+ resolve()
+ }
+ }, opts.time)
+ }
+ let over = () => {
+ if (this.id) {
+ clearTimeout(this.id)
+ this.id = null
+ }
+ }
+ let out = () => {
+ if (!this.id) this.id = timeOut()
+ }
+ this.id = timeOut()
+ document.body.appendChild(this.tooltip)
+ animation(this.tooltip, css.animateBottom.className)
+ })
+ }
+}
+
+let defaultOptions = (opts) => {
+ opts = opts || {}
+ return {
+ time: opts.time || 7000
+ }
+}
+
+let animation = (tooltip, anim) => {
+ tooltip.classList.remove(css.animateTop.className)
+ tooltip.classList.remove(css.animateBottom.className)
+ void tooltip.offsetWidth // trick for restarting the animation
+ tooltip.classList.add(anim)
+}
diff --git a/apps/remix-ide/src/app/ui/txLogger.js b/apps/remix-ide/src/app/ui/txLogger.js
new file mode 100644
index 0000000000..bcb8fb8427
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/txLogger.js
@@ -0,0 +1,567 @@
+'use strict'
+var yo = require('yo-yo')
+var copyToClipboard = require('./copy-to-clipboard')
+
+// -------------- styling ----------------------
+var csjs = require('csjs-inject')
+var remixLib = require('@remix-project/remix-lib')
+
+var EventManager = require('../../lib/events')
+var helper = require('../../lib/helper')
+var modalDialog = require('./modal-dialog-custom')
+var typeConversion = remixLib.execution.typeConversion
+var globlalRegistry = require('../../global/registry')
+
+var css = csjs`
+ .log {
+ display: flex;
+ cursor: pointer;
+ align-items: center;
+ cursor: pointer;
+ }
+ .log:hover {
+ opacity: 0.8;
+ }
+ .arrow {
+ color: var(--text-info);
+ font-size: 20px;
+ cursor: pointer;
+ display: flex;
+ margin-left: 10px;
+ }
+ .arrow:hover {
+ color: var(--secondary);
+ }
+ .txLog {
+ }
+ .txStatus {
+ display: flex;
+ font-size: 20px;
+ margin-right: 20px;
+ float: left;
+ }
+ .succeeded {
+ color: var(--success);
+ }
+ .failed {
+ color: var(--danger);
+ }
+ .notavailable {
+ }
+ .call {
+ font-size: 7px;
+ border-radius: 50%;
+ min-width: 20px;
+ min-height: 20px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ color: var(--text-info);
+ text-transform: uppercase;
+ font-weight: bold;
+ }
+ .txItem {
+ color: var(--text-info);
+ margin-right: 5px;
+ float: left;
+ }
+ .txItemTitle {
+ font-weight: bold;
+ }
+ .tx {
+ color: var(--text-info);
+ font-weight: bold;
+ float: left;
+ margin-right: 10px;
+ }
+ .txTable,
+ .tr,
+ .td {
+ border-collapse: collapse;
+ font-size: 10px;
+ color: var(--text-info);
+ border: 1px solid var(--text-info);
+ }
+ #txTable {
+ margin-top: 1%;
+ margin-bottom: 5%;
+ align-self: center;
+ width: 85%;
+ }
+ .tr, .td {
+ padding: 4px;
+ vertical-align: baseline;
+ }
+ .td:first-child {
+ min-width: 30%;
+ width: 30%;
+ align-items: baseline;
+ font-weight: bold;
+ }
+ .tableTitle {
+ width: 25%;
+ }
+ .buttons {
+ display: flex;
+ margin-left: auto;
+ }
+ .debug {
+ white-space: nowrap;
+ }
+ .debug:hover {
+ opacity: 0.8;
+ }`
+/**
+ * This just export a function that register to `newTransaction` and forward them to the logger.
+ *
+ */
+class TxLogger {
+ constructor (terminal, blockchain) {
+ this.event = new EventManager()
+ this.seen = {}
+ function filterTx (value, query) {
+ if (value.length) {
+ return helper.find(value, query)
+ }
+ return false
+ }
+ this.eventsDecoder = globlalRegistry.get('eventsDecoder').api
+ this.txListener = globlalRegistry.get('txlistener').api
+ this.terminal = terminal
+ // dependencies
+ this._deps = {
+ compilersArtefacts: globlalRegistry.get('compilersartefacts').api
+ }
+
+ this.logKnownTX = this.terminal.registerCommand('knownTransaction', (args, cmds, append) => {
+ var data = args[0]
+ var el
+ if (data.tx.isCall) {
+ el = renderCall(this, data)
+ } else {
+ el = renderKnownTransaction(this, data, blockchain)
+ }
+ this.seen[data.tx.hash] = el
+ append(el)
+ }, { activate: true, filterFn: filterTx })
+
+ this.logUnknownTX = this.terminal.registerCommand('unknownTransaction', (args, cmds, append) => {
+ // triggered for transaction AND call
+ var data = args[0]
+ var el = renderUnknownTransaction(this, data, blockchain)
+ append(el)
+ }, { activate: false, filterFn: filterTx })
+
+ this.logEmptyBlock = this.terminal.registerCommand('emptyBlock', (args, cmds, append) => {
+ var data = args[0]
+ var el = renderEmptyBlock(this, data)
+ append(el)
+ }, { activate: true })
+
+ this.txListener.event.register('newBlock', (block) => {
+ if (!block.transactions || block.transactions && !block.transactions.length) {
+ this.logEmptyBlock({ block: block })
+ }
+ })
+
+ this.txListener.event.register('newTransaction', (tx, receipt) => {
+ log(this, tx, receipt)
+ })
+
+ this.txListener.event.register('newCall', (tx) => {
+ log(this, tx, null)
+ })
+
+ this.terminal.updateJournal({ type: 'select', value: 'unknownTransaction' })
+ this.terminal.updateJournal({ type: 'select', value: 'knownTransaction' })
+ }
+}
+
+function debug (e, data, self) {
+ e.stopPropagation()
+ if (data.tx.isCall && data.tx.envMode !== 'vm') {
+ modalDialog.alert('Cannot debug this call. Debugging calls is only possible in JavaScript VM mode.')
+ } else {
+ self.event.trigger('debuggingRequested', [data.tx.hash])
+ }
+}
+
+function log (self, tx, receipt) {
+ var resolvedTransaction = self.txListener.resolvedTransaction(tx.hash)
+ if (resolvedTransaction) {
+ var compiledContracts = null
+ if (self._deps.compilersArtefacts['__last']) {
+ compiledContracts = self._deps.compilersArtefacts['__last'].getContracts()
+ }
+ self.eventsDecoder.parseLogs(tx, resolvedTransaction.contractName, compiledContracts, (error, logs) => {
+ if (!error) {
+ self.logKnownTX({ tx: tx, receipt: receipt, resolvedData: resolvedTransaction, logs: logs })
+ }
+ })
+ } else {
+ // contract unknown - just displaying raw tx.
+ self.logUnknownTX({ tx: tx, receipt: receipt })
+ }
+}
+
+function renderKnownTransaction (self, data, blockchain) {
+ var from = data.tx.from
+ var to = data.resolvedData.contractName + '.' + data.resolvedData.fn
+ var obj = {from, to}
+ var txType = 'knownTx'
+ var tx = yo`
+
+ txDetails(e, tx, data, obj)}>
+ ${checkTxStatus(data.receipt, txType)}
+ ${context(self, {from, to, data}, blockchain)}
+
+ debug(e, data, self)}>Debug
+
+
+
+
+ `
+ return tx
+}
+
+function renderCall (self, data) {
+ var to = data.resolvedData.contractName + '.' + data.resolvedData.fn
+ var from = data.tx.from ? data.tx.from : ' - '
+ var input = data.tx.input ? helper.shortenHexData(data.tx.input) : ''
+ var obj = {from, to}
+ var txType = 'call'
+ var tx = yo`
+
+ txDetails(e, tx, data, obj)}>
+ ${checkTxStatus(data.tx, txType)}
+
+ [call]
+ from: ${from}
+ to: ${to}
+ data: ${input}
+
+
+
+
+
+ `
+ return tx
+}
+
+function renderUnknownTransaction (self, data, blockchain) {
+ var from = data.tx.from
+ var to = data.tx.to
+ var obj = {from, to}
+ var txType = 'unknown' + (data.tx.isCall ? 'Call' : 'Tx')
+ var tx = yo`
+
+ txDetails(e, tx, data, obj)}>
+ ${checkTxStatus(data.receipt || data.tx, txType)}
+ ${context(self, {from, to, data}, blockchain)}
+
+
+
+
+ `
+ return tx
+}
+
+function renderEmptyBlock (self, data) {
+ return yo`
+
+ [
block:${data.block.number} - 0 transactions]
+ `
+}
+
+function checkTxStatus (tx, type) {
+ if (tx.status === '0x1' || tx.status === true) {
+ return yo`
`
+ }
+ if (type === 'call' || type === 'unknownCall') {
+ return yo`
call `
+ } else if (tx.status === '0x0' || tx.status === false) {
+ return yo`
`
+ } else {
+ return yo`
`
+ }
+}
+
+function context (self, opts, blockchain) {
+ var data = opts.data || ''
+ var from = opts.from ? helper.shortenHexData(opts.from) : ''
+ var to = opts.to
+ if (data.tx.to) to = to + ' ' + helper.shortenHexData(data.tx.to)
+ var val = data.tx.value
+ var hash = data.tx.hash ? helper.shortenHexData(data.tx.hash) : ''
+ var input = data.tx.input ? helper.shortenHexData(data.tx.input) : ''
+ var logs = data.logs && data.logs.decoded && data.logs.decoded.length ? data.logs.decoded.length : 0
+ var block = data.receipt ? data.receipt.blockNumber : data.tx.blockNumber || ''
+ var i = data.receipt ? data.receipt.transactionIndex : data.tx.transactionIndex
+ var value = val ? typeConversion.toInt(val) : 0
+ if (blockchain.getProvider() === 'vm') {
+ return yo`
+
+
+ [vm]
+ from: ${from}
+ to: ${to}
+ value: ${value} wei
+ data: ${input}
+ logs: ${logs}
+ hash: ${hash}
+
+
`
+ } else if (blockchain.getProvider() !== 'vm' && data.resolvedData) {
+ return yo`
+
+
+ [block:${block} txIndex:${i}]
+ from: ${from}
+ to: ${to}
+ value: ${value} wei
+ data: ${input}
+ logs: ${logs}
+ hash: ${hash}
+
+
`
+ } else {
+ to = helper.shortenHexData(to)
+ hash = helper.shortenHexData(data.tx.blockHash)
+ return yo`
+
+
+ [block:${block} txIndex:${i}]
+ from: ${from}
+ to: ${to}
+ value: ${value} wei
+
+
`
+ }
+}
+
+module.exports = TxLogger
+
+// helpers
+
+function txDetails (e, tx, data, obj) {
+ const from = obj.from
+ const to = obj.to
+ const arrowUp = yo`
`
+ const arrowDown = yo`
`
+
+ let blockElement = e.target
+ while (true) { // get the parent block element
+ if (blockElement.className.startsWith('block')) break
+ else if (blockElement.parentElement) {
+ blockElement = blockElement.parentElement
+ } else break
+ }
+
+ let table = blockElement.querySelector(`#${tx.id} [class^="txTable"]`)
+ const log = blockElement.querySelector(`#${tx.id} [class^='log']`)
+ const arrow = blockElement.querySelector(`#${tx.id} [class^='arrow']`)
+
+ if (table && table.parentNode) {
+ tx.removeChild(table)
+ log.removeChild(arrow)
+ log.appendChild(arrowDown)
+ } else {
+ log.removeChild(arrow)
+ log.appendChild(arrowUp)
+ table = createTable({
+ hash: data.tx.hash,
+ status: data.receipt ? data.receipt.status : null,
+ isCall: data.tx.isCall,
+ contractAddress: data.tx.contractAddress,
+ data: data.tx,
+ from,
+ to,
+ gas: data.tx.gas,
+ input: data.tx.input,
+ 'decoded input': data.resolvedData && data.resolvedData.params ? JSON.stringify(typeConversion.stringify(data.resolvedData.params), null, '\t') : ' - ',
+ 'decoded output': data.resolvedData && data.resolvedData.decodedReturnValue ? JSON.stringify(typeConversion.stringify(data.resolvedData.decodedReturnValue), null, '\t') : ' - ',
+ logs: data.logs,
+ val: data.tx.value,
+ transactionCost: data.tx.transactionCost,
+ executionCost: data.tx.executionCost
+ })
+ tx.appendChild(table)
+ }
+}
+
+function createTable (opts) {
+ var table = yo`
`
+ if (!opts.isCall) {
+ var msg = ''
+ if (opts.status !== undefined && opts.status !== null) {
+ if (opts.status === '0x0' || opts.status === false) {
+ msg = ' Transaction mined but execution failed'
+ } else if (opts.status === '0x1' || opts.status === true) {
+ msg = ' Transaction mined and execution succeed'
+ }
+ } else {
+ msg = ' Status not available at the moment'
+ }
+ table.appendChild(yo`
+
+ status
+ ${opts.status}${msg}
+ `)
+ }
+
+ var transactionHash = yo`
+
+ transaction hash
+ ${opts.hash}
+ ${copyToClipboard(() => opts.hash)}
+
+
+ `
+ table.appendChild(transactionHash)
+
+ var contractAddress = yo`
+
+ contract address
+ ${opts.contractAddress}
+ ${copyToClipboard(() => opts.contractAddress)}
+
+
+ `
+ if (opts.contractAddress) table.appendChild(contractAddress)
+
+ var from = yo`
+
+ from
+ ${opts.from}
+ ${copyToClipboard(() => opts.from)}
+
+
+ `
+ if (opts.from) table.appendChild(from)
+
+ var toHash
+ var data = opts.data // opts.data = data.tx
+ if (data.to) {
+ toHash = opts.to + ' ' + data.to
+ } else {
+ toHash = opts.to
+ }
+ var to = yo`
+
+ to
+ ${toHash}
+ ${copyToClipboard(() => data.to ? data.to : toHash)}
+
+
+ `
+ if (opts.to) table.appendChild(to)
+
+ var gas = yo`
+
+ gas
+ ${opts.gas} gas
+ ${copyToClipboard(() => opts.gas)}
+
+
+ `
+ if (opts.gas) table.appendChild(gas)
+
+ var callWarning = ''
+ if (opts.isCall) {
+ callWarning = '(Cost only applies when called by a contract)'
+ }
+ if (opts.transactionCost) {
+ table.appendChild(yo`
+
+ transaction cost
+ ${opts.transactionCost} gas ${callWarning}
+ ${copyToClipboard(() => opts.transactionCost)}
+
+ `)
+ }
+
+ if (opts.executionCost) {
+ table.appendChild(yo`
+
+ execution cost
+ ${opts.executionCost} gas ${callWarning}
+ ${copyToClipboard(() => opts.executionCost)}
+
+ `)
+ }
+
+ var hash = yo`
+
+ hash
+ ${opts.hash}
+ ${copyToClipboard(() => opts.hash)}
+
+
+ `
+ if (opts.hash) table.appendChild(hash)
+
+ var input = yo`
+
+ input
+ ${helper.shortenHexData(opts.input)}
+ ${copyToClipboard(() => opts.input)}
+
+
+ `
+ if (opts.input) table.appendChild(input)
+
+ if (opts['decoded input']) {
+ var inputDecoded = yo`
+
+ decoded input
+ ${opts['decoded input']}
+ ${copyToClipboard(() => opts['decoded input'])}
+
+ `
+ table.appendChild(inputDecoded)
+ }
+
+ if (opts['decoded output']) {
+ var outputDecoded = yo`
+
+ decoded output
+ ${opts['decoded output']}
+ ${copyToClipboard(() => opts['decoded output'])}
+
+ `
+ table.appendChild(outputDecoded)
+ }
+
+ var stringified = ' - '
+ if (opts.logs && opts.logs.decoded) {
+ stringified = typeConversion.stringify(opts.logs.decoded)
+ }
+ var logs = yo`
+
+ logs
+
+ ${JSON.stringify(stringified, null, '\t')}
+ ${copyToClipboard(() => JSON.stringify(stringified, null, '\t'))}
+ ${copyToClipboard(() => JSON.stringify(opts.logs.raw || '0'))}
+
+
+ `
+ if (opts.logs) table.appendChild(logs)
+
+ var val = opts.val != null ? typeConversion.toInt(opts.val) : 0
+ val = yo`
+
+ value
+ ${val} wei
+ ${copyToClipboard(() => `${val} wei`)}
+
+
+ `
+ if (opts.val) table.appendChild(val)
+
+ return table
+}
diff --git a/apps/remix-ide/src/app/ui/universal-dapp-ui.js b/apps/remix-ide/src/app/ui/universal-dapp-ui.js
new file mode 100644
index 0000000000..ca4cc28482
--- /dev/null
+++ b/apps/remix-ide/src/app/ui/universal-dapp-ui.js
@@ -0,0 +1,263 @@
+/* global */
+'use strict'
+
+var $ = require('jquery')
+var yo = require('yo-yo')
+var ethJSUtil = require('ethereumjs-util')
+var BN = ethJSUtil.BN
+var helper = require('../../lib/helper')
+var copyToClipboard = require('./copy-to-clipboard')
+var css = require('../../universal-dapp-styles')
+var MultiParamManager = require('./multiParamManager')
+var remixLib = require('@remix-project/remix-lib')
+var txFormat = remixLib.execution.txFormat
+const txHelper = remixLib.execution.txHelper
+var TreeView = require('./TreeView')
+var txCallBacks = require('./sendTxCallbacks')
+
+function UniversalDAppUI (blockchain, logCallback) {
+ this.blockchain = blockchain
+ this.logCallback = logCallback
+ this.compilerData = {contractsDetails: {}}
+}
+
+function decodeResponseToTreeView (response, fnabi) {
+ var treeView = new TreeView({
+ extractData: (item, parent, key) => {
+ var ret = {}
+ if (BN.isBN(item)) {
+ ret.self = item.toString(10)
+ ret.children = []
+ } else {
+ ret = treeView.extractDataDefault(item, parent, key)
+ }
+ return ret
+ }
+ })
+ return treeView.render(txFormat.decodeResponse(response, fnabi))
+}
+
+UniversalDAppUI.prototype.renderInstance = function (contract, address, contractName) {
+ var noInstances = document.querySelector('[data-id="deployAndRunNoInstanceText"]')
+ if (noInstances) {
+ noInstances.parentNode.removeChild(noInstances)
+ }
+ const abi = txHelper.sortAbiFunction(contract.abi)
+ return this.renderInstanceFromABI(abi, address, contractName)
+}
+
+// TODO this function was named before "appendChild".
+// this will render an instance: contract name, contract address, and all the public functions
+// basically this has to be called for the "atAddress" (line 393) and when a contract creation succeed
+// this returns a DOM element
+UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address, contractName) {
+ let self = this
+ address = (address.slice(0, 2) === '0x' ? '' : '0x') + address.toString('hex')
+ address = ethJSUtil.toChecksumAddress(address)
+ var instance = yo`
`
+ const context = this.blockchain.context()
+
+ var shortAddress = helper.shortenAddress(address)
+ var title = yo`
+
+ `
+
+ var close = yo`
+
+
+ `
+ title.querySelector('.btn-group').appendChild(close)
+
+ var contractActionsWrapper = yo`
+
+
+ `
+
+ function remove () {
+ instance.remove()
+ // @TODO perhaps add a callack here to warn the caller that the instance has been removed
+ }
+
+ function toggleClass (e) {
+ $(instance).toggleClass(`${css.hidesub} bg-light`)
+ // e.currentTarget.querySelector('i')
+ e.currentTarget.querySelector('i').classList.toggle(`fa-angle-right`)
+ e.currentTarget.querySelector('i').classList.toggle(`fa-angle-down`)
+ }
+
+ instance.appendChild(title)
+ instance.appendChild(contractActionsWrapper)
+
+ $.each(contractABI, (i, funABI) => {
+ if (funABI.type !== 'function') {
+ return
+ }
+ // @todo getData cannot be used with overloaded functions
+ contractActionsWrapper.appendChild(this.getCallButton({
+ funABI: funABI,
+ address: address,
+ contractABI: contractABI,
+ contractName: contractName
+ }))
+ })
+
+ const calldataInput = yo`
+
+ `
+ const llIError = yo`
+
+ `
+ // constract LLInteractions elements
+ const lowLevelInteracions = yo`
+
+
+
+ Low level interactions
+
+
+
+
+
+
+
CALLDATA
+
+ ${calldataInput}
+ sendData()}>Transact
+
+
+
+ ${llIError}
+
+
+ `
+
+ function sendData () {
+ function setLLIError (text) {
+ llIError.innerText = text
+ }
+
+ setLLIError('')
+ const fallback = txHelper.getFallbackInterface(contractABI)
+ const receive = txHelper.getReceiveInterface(contractABI)
+ const args = {
+ funABI: fallback || receive,
+ address: address,
+ contractName: contractName,
+ contractABI: contractABI
+ }
+ const amount = document.querySelector('#value').value
+ if (amount !== '0') {
+ // check for numeric and receive/fallback
+ if (!helper.isNumeric(amount)) {
+ return setLLIError('Value to send should be a number')
+ } else if (!receive && !(fallback && fallback.stateMutability === 'payable')) {
+ return setLLIError("In order to receive Ether transfer the contract should have either 'receive' or payable 'fallback' function")
+ }
+ }
+ let calldata = calldataInput.value
+ if (calldata) {
+ if (calldata.length < 2 || calldata.length < 4 && helper.is0XPrefixed(calldata)) {
+ return setLLIError('The calldata should be a valid hexadecimal value with size of at least one byte.')
+ } else {
+ if (helper.is0XPrefixed(calldata)) {
+ calldata = calldata.substr(2, calldata.length)
+ }
+ if (!helper.isHexadecimal(calldata)) {
+ return setLLIError('The calldata should be a valid hexadecimal value.')
+ }
+ }
+ if (!fallback) {
+ return setLLIError("'Fallback' function is not defined")
+ }
+ }
+
+ if (!receive && !fallback) return setLLIError(`Both 'receive' and 'fallback' functions are not defined`)
+
+ // we have to put the right function ABI:
+ // if receive is defined and that there is no calldata => receive function is called
+ // if fallback is defined => fallback function is called
+ if (receive && !calldata) args.funABI = receive
+ else if (fallback) args.funABI = fallback
+
+ if (!args.funABI) return setLLIError(`Please define a 'Fallback' function to send calldata and a either 'Receive' or payable 'Fallback' to send ethers`)
+ self.runTransaction(false, args, null, calldataInput.value, null)
+ }
+
+ contractActionsWrapper.appendChild(lowLevelInteracions)
+ return instance
+}
+
+// TODO this is used by renderInstance when a new instance is displayed.
+// this returns a DOM element.
+UniversalDAppUI.prototype.getCallButton = function (args) {
+ let self = this
+ var outputOverride = yo`
` // show return value
+ const isConstant = args.funABI.constant !== undefined ? args.funABI.constant : false
+ const lookupOnly = args.funABI.stateMutability === 'view' || args.funABI.stateMutability === 'pure' || isConstant
+ const multiParamManager = new MultiParamManager(
+ lookupOnly,
+ args.funABI,
+ (valArray, inputsValues) => self.runTransaction(lookupOnly, args, valArray, inputsValues, outputOverride),
+ self.blockchain.getInputs(args.funABI)
+ )
+
+ const contractActionsContainer = yo`
${multiParamManager.render()}
`
+ contractActionsContainer.appendChild(outputOverride)
+
+ return contractActionsContainer
+}
+
+UniversalDAppUI.prototype.runTransaction = function (lookupOnly, args, valArr, inputsValues, outputOverride) {
+ const functionName = args.funABI.type === 'function' ? args.funABI.name : `(${args.funABI.type})`
+ const logMsg = `${lookupOnly ? 'call' : 'transact'} to ${args.contractName}.${functionName}`
+
+ const callbacksInContext = txCallBacks.getCallBacksWithContext(this, this.blockchain)
+
+ const outputCb = (returnValue) => {
+ if (outputOverride) {
+ const decoded = decodeResponseToTreeView(returnValue, args.funABI)
+ outputOverride.innerHTML = ''
+ outputOverride.appendChild(decoded)
+ }
+ }
+ const params = args.funABI.type !== 'fallback' ? inputsValues : ''
+ this.blockchain.runOrCallContractMethod(
+ args.contractName,
+ args.contractAbi,
+ args.funABI,
+ inputsValues,
+ args.address,
+ params,
+ lookupOnly,
+ logMsg,
+ this.logCallback,
+ outputCb,
+ callbacksInContext.confirmationCb.bind(callbacksInContext),
+ callbacksInContext.continueCb.bind(callbacksInContext),
+ callbacksInContext.promptCb.bind(callbacksInContext))
+}
+
+module.exports = UniversalDAppUI
diff --git a/apps/remix-ide/src/assets/css/font-awesome.min.css b/apps/remix-ide/src/assets/css/font-awesome.min.css
new file mode 100644
index 0000000000..540440ce89
--- /dev/null
+++ b/apps/remix-ide/src/assets/css/font-awesome.min.css
@@ -0,0 +1,4 @@
+/*!
+ * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
+ * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
+ */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}
diff --git a/apps/remix-ide/src/assets/css/pygment_trac.css b/apps/remix-ide/src/assets/css/pygment_trac.css
new file mode 100644
index 0000000000..c6a6452d24
--- /dev/null
+++ b/apps/remix-ide/src/assets/css/pygment_trac.css
@@ -0,0 +1,69 @@
+.highlight { background: #ffffff; }
+.highlight .c { color: #999988; font-style: italic } /* Comment */
+.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
+.highlight .k { font-weight: bold } /* Keyword */
+.highlight .o { font-weight: bold } /* Operator */
+.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
+.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
+.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #aa0000 } /* Generic.Error */
+.highlight .gh { color: #999999 } /* Generic.Heading */
+.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
+.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
+.highlight .go { color: #888888 } /* Generic.Output */
+.highlight .gp { color: #555555 } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
+.highlight .gt { color: #aa0000 } /* Generic.Traceback */
+.highlight .kc { font-weight: bold } /* Keyword.Constant */
+.highlight .kd { font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
+.highlight .kr { font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
+.highlight .m { color: #009999 } /* Literal.Number */
+.highlight .s { color: #d14 } /* Literal.String */
+.highlight .na { color: #008080 } /* Name.Attribute */
+.highlight .nb { color: #0086B3 } /* Name.Builtin */
+.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
+.highlight .no { color: #008080 } /* Name.Constant */
+.highlight .ni { color: #800080 } /* Name.Entity */
+.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
+.highlight .nn { color: #555555 } /* Name.Namespace */
+.highlight .nt { color: #000080 } /* Name.Tag */
+.highlight .nv { color: #008080 } /* Name.Variable */
+.highlight .ow { font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mf { color: #009999 } /* Literal.Number.Float */
+.highlight .mh { color: #009999 } /* Literal.Number.Hex */
+.highlight .mi { color: #009999 } /* Literal.Number.Integer */
+.highlight .mo { color: #009999 } /* Literal.Number.Oct */
+.highlight .sb { color: #d14 } /* Literal.String.Backtick */
+.highlight .sc { color: #d14 } /* Literal.String.Char */
+.highlight .sd { color: #d14 } /* Literal.String.Doc */
+.highlight .s2 { color: #d14 } /* Literal.String.Double */
+.highlight .se { color: #d14 } /* Literal.String.Escape */
+.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
+.highlight .si { color: #d14 } /* Literal.String.Interpol */
+.highlight .sx { color: #d14 } /* Literal.String.Other */
+.highlight .sr { color: #009926 } /* Literal.String.Regex */
+.highlight .s1 { color: #d14 } /* Literal.String.Single */
+.highlight .ss { color: #990073 } /* Literal.String.Symbol */
+.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #008080 } /* Name.Variable.Class */
+.highlight .vg { color: #008080 } /* Name.Variable.Global */
+.highlight .vi { color: #008080 } /* Name.Variable.Instance */
+.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
+
+.type-csharp .highlight .k { color: #0000FF }
+.type-csharp .highlight .kt { color: #0000FF }
+.type-csharp .highlight .nf { color: #000000; font-weight: normal }
+.type-csharp .highlight .nc { color: #2B91AF }
+.type-csharp .highlight .nn { color: #000000 }
+.type-csharp .highlight .s { color: #A31515 }
+.type-csharp .highlight .sc { color: #A31515 }
diff --git a/apps/remix-ide/src/assets/fonts/FontAwesome.otf b/apps/remix-ide/src/assets/fonts/FontAwesome.otf
new file mode 100644
index 0000000000..401ec0f36e
Binary files /dev/null and b/apps/remix-ide/src/assets/fonts/FontAwesome.otf differ
diff --git a/apps/remix-ide/src/assets/fonts/fontawesome-webfont.eot b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.eot
new file mode 100644
index 0000000000..e9f60ca953
Binary files /dev/null and b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.eot differ
diff --git a/apps/remix-ide/src/assets/fonts/fontawesome-webfont.svg b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.svg
new file mode 100644
index 0000000000..855c845e53
--- /dev/null
+++ b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.svg
@@ -0,0 +1,2671 @@
+
+
+
+
+Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016
+ By ,,,
+Copyright Dave Gandy 2016. All rights reserved.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/remix-ide/src/assets/fonts/fontawesome-webfont.ttf b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.ttf
new file mode 100644
index 0000000000..35acda2fa1
Binary files /dev/null and b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.ttf differ
diff --git a/apps/remix-ide/src/assets/fonts/fontawesome-webfont.woff b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.woff
new file mode 100644
index 0000000000..400014a4b0
Binary files /dev/null and b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.woff differ
diff --git a/apps/remix-ide/src/assets/fonts/fontawesome-webfont.woff2 b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.woff2
new file mode 100644
index 0000000000..4d13fc6040
Binary files /dev/null and b/apps/remix-ide/src/assets/fonts/fontawesome-webfont.woff2 differ
diff --git a/apps/remix-ide/src/assets/img/debuggerLogo.webp b/apps/remix-ide/src/assets/img/debuggerLogo.webp
new file mode 100644
index 0000000000..4773d498e9
Binary files /dev/null and b/apps/remix-ide/src/assets/img/debuggerLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/deployAndRun.webp b/apps/remix-ide/src/assets/img/deployAndRun.webp
new file mode 100644
index 0000000000..c652f89ee2
Binary files /dev/null and b/apps/remix-ide/src/assets/img/deployAndRun.webp differ
diff --git a/apps/remix-ide/src/assets/img/favicon.ico b/apps/remix-ide/src/assets/img/favicon.ico
new file mode 100644
index 0000000000..4f550708f2
Binary files /dev/null and b/apps/remix-ide/src/assets/img/favicon.ico differ
diff --git a/apps/remix-ide/src/assets/img/fileManager.webp b/apps/remix-ide/src/assets/img/fileManager.webp
new file mode 100644
index 0000000000..185d3acc1a
Binary files /dev/null and b/apps/remix-ide/src/assets/img/fileManager.webp differ
diff --git a/apps/remix-ide/src/assets/img/gasStation_50.png b/apps/remix-ide/src/assets/img/gasStation_50.png
new file mode 100644
index 0000000000..6758609385
Binary files /dev/null and b/apps/remix-ide/src/assets/img/gasStation_50.png differ
diff --git a/apps/remix-ide/src/assets/img/hexagon-remix-greengrey-texture.png b/apps/remix-ide/src/assets/img/hexagon-remix-greengrey-texture.png
new file mode 100644
index 0000000000..49717083ac
Binary files /dev/null and b/apps/remix-ide/src/assets/img/hexagon-remix-greengrey-texture.png differ
diff --git a/apps/remix-ide/src/assets/img/homeStickers.png b/apps/remix-ide/src/assets/img/homeStickers.png
new file mode 100644
index 0000000000..c481cec517
Binary files /dev/null and b/apps/remix-ide/src/assets/img/homeStickers.png differ
diff --git a/apps/remix-ide/src/assets/img/icon.png b/apps/remix-ide/src/assets/img/icon.png
new file mode 100644
index 0000000000..1d6bcd0352
Binary files /dev/null and b/apps/remix-ide/src/assets/img/icon.png differ
diff --git a/apps/remix-ide/src/assets/img/ipfs.webp b/apps/remix-ide/src/assets/img/ipfs.webp
new file mode 100644
index 0000000000..9cdfa7380c
Binary files /dev/null and b/apps/remix-ide/src/assets/img/ipfs.webp differ
diff --git a/apps/remix-ide/src/assets/img/localPlugin.webp b/apps/remix-ide/src/assets/img/localPlugin.webp
new file mode 100644
index 0000000000..c8481f4820
Binary files /dev/null and b/apps/remix-ide/src/assets/img/localPlugin.webp differ
diff --git a/apps/remix-ide/src/assets/img/moreLogo.webp b/apps/remix-ide/src/assets/img/moreLogo.webp
new file mode 100644
index 0000000000..a534e103a7
Binary files /dev/null and b/apps/remix-ide/src/assets/img/moreLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/mythxLogo.webp b/apps/remix-ide/src/assets/img/mythxLogo.webp
new file mode 100644
index 0000000000..257f72dc59
Binary files /dev/null and b/apps/remix-ide/src/assets/img/mythxLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/pipelineLogo.webp b/apps/remix-ide/src/assets/img/pipelineLogo.webp
new file mode 100644
index 0000000000..20114c22d2
Binary files /dev/null and b/apps/remix-ide/src/assets/img/pipelineLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/pluginManager.webp b/apps/remix-ide/src/assets/img/pluginManager.webp
new file mode 100644
index 0000000000..4c4b316cca
Binary files /dev/null and b/apps/remix-ide/src/assets/img/pluginManager.webp differ
diff --git a/apps/remix-ide/src/assets/img/remixLogo.webp b/apps/remix-ide/src/assets/img/remixLogo.webp
new file mode 100644
index 0000000000..90e38ad586
Binary files /dev/null and b/apps/remix-ide/src/assets/img/remixLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/settings.webp b/apps/remix-ide/src/assets/img/settings.webp
new file mode 100644
index 0000000000..207745c4b6
Binary files /dev/null and b/apps/remix-ide/src/assets/img/settings.webp differ
diff --git a/apps/remix-ide/src/assets/img/sleepingRemiCroped.webp b/apps/remix-ide/src/assets/img/sleepingRemiCroped.webp
new file mode 100644
index 0000000000..4e01719ad2
Binary files /dev/null and b/apps/remix-ide/src/assets/img/sleepingRemiCroped.webp differ
diff --git a/apps/remix-ide/src/assets/img/solidity.webp b/apps/remix-ide/src/assets/img/solidity.webp
new file mode 100644
index 0000000000..7328dd2fd2
Binary files /dev/null and b/apps/remix-ide/src/assets/img/solidity.webp differ
diff --git a/apps/remix-ide/src/assets/img/solidityLogo.webp b/apps/remix-ide/src/assets/img/solidityLogo.webp
new file mode 100644
index 0000000000..9a9821e6b5
Binary files /dev/null and b/apps/remix-ide/src/assets/img/solidityLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/sourceVerifyLogo.webp b/apps/remix-ide/src/assets/img/sourceVerifyLogo.webp
new file mode 100644
index 0000000000..0819bfd3f9
Binary files /dev/null and b/apps/remix-ide/src/assets/img/sourceVerifyLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/staticAnalysis.webp b/apps/remix-ide/src/assets/img/staticAnalysis.webp
new file mode 100644
index 0000000000..1ef7294dfd
Binary files /dev/null and b/apps/remix-ide/src/assets/img/staticAnalysis.webp differ
diff --git a/apps/remix-ide/src/assets/img/swarm.webp b/apps/remix-ide/src/assets/img/swarm.webp
new file mode 100644
index 0000000000..c11e1a6481
Binary files /dev/null and b/apps/remix-ide/src/assets/img/swarm.webp differ
diff --git a/apps/remix-ide/src/assets/img/unitTesting.webp b/apps/remix-ide/src/assets/img/unitTesting.webp
new file mode 100644
index 0000000000..29488e3f72
Binary files /dev/null and b/apps/remix-ide/src/assets/img/unitTesting.webp differ
diff --git a/apps/remix-ide/src/assets/img/vyperLogo.webp b/apps/remix-ide/src/assets/img/vyperLogo.webp
new file mode 100644
index 0000000000..3f9f4c1afd
Binary files /dev/null and b/apps/remix-ide/src/assets/img/vyperLogo.webp differ
diff --git a/apps/remix-ide/src/assets/img/workshopLogo.webp b/apps/remix-ide/src/assets/img/workshopLogo.webp
new file mode 100644
index 0000000000..6717a42740
Binary files /dev/null and b/apps/remix-ide/src/assets/img/workshopLogo.webp differ
diff --git a/apps/remix-ide/src/assets/js/0.7.7/app.js b/apps/remix-ide/src/assets/js/0.7.7/app.js
new file mode 100644
index 0000000000..e384e69029
--- /dev/null
+++ b/apps/remix-ide/src/assets/js/0.7.7/app.js
@@ -0,0 +1,271121 @@
+(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
|<<|>>|<<=|>>=|&&|\|\||[!&|+\-*\/%~^<>=]=?/
+ }, {
+ token : "punctuation.operator",
+ regex : /[?:;]/
+ }, {
+ token : "punctuation.operator", // keep "." and "," separate for easier cloning and modifying into "function_arguments"
+ regex : /[.,]/,
+ inheritingStateRuleId : "punctuation"
+ }, {
+ token : "paren.lparen",
+ regex : /[\[{]/
+ }, {
+ token : "paren.lparen", // keep "(" separate for easier cloning and modifying into "function_arguments"
+ regex : /[(]/,
+ inheritingStateRuleId : "lparen"
+ }, {
+ token : "paren.rparen",
+ regex : /[\]}]/
+ }, {
+ token : "paren.rparen", // keep ")" separate for easier cloning and modifying into "function_arguments"
+ regex : /[)]/,
+ inheritingStateRuleId : "rparen"
+ }
+ ],
+ "comment" : [
+ commentWipMarkerRule("block"),
+ {
+ token : "comment.block",
+ regex : "\\*\\/",
+ next : "pop"
+ }, {
+ defaultToken : "comment.block",
+ caseInsensitive : true
+ }
+ ],
+ "line_comment" : [
+ commentWipMarkerRule("line"),
+ {
+ token : "comment.line.double-slash",
+ regex : "$|^",
+ next : "pop"
+ }, {
+ defaultToken : "comment.line.double-slash",
+ caseInsensitive : true
+ }
+ ],
+ "doc_comment" : [
+ commentWipMarkerRule("block"),
+ natSpecRule("block"),
+ {
+ token : "comment.block.doc.documentation", // closing comment
+ regex : "\\*\\/",
+ next : "pop"
+ }, {
+ defaultToken : "comment.block.doc.documentation",
+ caseInsensitive : true
+ }
+ ],
+ "doc_line_comment" : [
+ commentWipMarkerRule("line"),
+ natSpecRule("line"),
+ {
+ token : "comment.line.triple-slash.double-slash.doc.documentation",
+ regex : "$|^",
+ next : "pop"
+ }, {
+ defaultToken : "comment.line.triple-slash.double-slash.doc.documentation",
+ caseInsensitive : true
+ }
+ ],
+ "qqstring" : [
+ {
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "string.quoted.double", // Multi-line string by ending line with back-slash, i.e. escaping \n.
+ regex : "\\\\$",
+ next : "qqstring"
+ }, {
+ token : "string.quoted.double",
+ regex : '"|$',
+ next : "pop"
+ }, {
+ defaultToken : "string.quoted.double"
+ }
+ ],
+ "qstring" : [
+ {
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "string.quoted.single", // Multi-line string by ending line with back-slash, i.e. escaping \n.
+ regex : "\\\\$",
+ next : "qstring"
+ }, {
+ token : "string.quoted.single",
+ regex : "'|$",
+ next : "pop"
+ }, {
+ defaultToken : "string.quoted.single"
+ }
+ ]
+ };
+ var functionArgumentsRules = deepCopy(this.$rules["start"]);
+ functionArgumentsRules.forEach(function(rule, ruleIndex) {
+ if (rule.inheritingStateRuleId) {
+ switch (rule.inheritingStateRuleId) {
+ case "keywordMapper":
+ rule.token = functionArgumentsKeywordMapper;
+ break;
+ case "punctuation":
+ rule.onMatch = function onFunctionArgumentsPunctuationMatch(value, currentState, stack) {
+ hasSeenFirstFunctionArgumentKeyword = false;
+ return rule.token;
+ };
+ break;
+ case "lparen":
+ rule.next = pushFunctionArgumentsState;
+ break;
+ case "rparen":
+ rule.next = "pop";
+ break;
+ case "fixedNumberType":
+ rule.onMatch = function onFunctionArgumentsFixedNumberTypeMatch(value, currentState, stack) {
+ hasSeenFirstFunctionArgumentKeyword = true;
+ return rule.token;
+ };
+ break;
+ }
+ delete rule.inheritingStateRuleId;
+ delete this.$rules["start"][ruleIndex].inheritingStateRuleId; // TODO Keep id if there will be more "child" states.
+ functionArgumentsRules[ruleIndex] = rule;
+ }
+ }, this);
+ this.$rules["function_arguments"] = functionArgumentsRules;
+
+ this.normalizeRules();
+};
+
+oop.inherits(SolidityHighlightRules, TextHighlightRules);
+
+exports.SolidityHighlightRules = SolidityHighlightRules;
+});
+
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+ this.checkOutdent = function(line, input) {
+ if (! /^\s+$/.test(line))
+ return false;
+
+ return /^\s*\}/.test(input);
+ };
+
+ this.autoOutdent = function(doc, row) {
+ var line = doc.getLine(row);
+ var match = line.match(/^(\s*\})/);
+
+ if (!match) return 0;
+
+ var column = match[1].length;
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+ if (!openBracePos || openBracePos.row == row) return 0;
+
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
+ doc.replace(new Range(row, 0, row, column-1), indent);
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});
+
+ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../../lib/oop");
+var Behaviour = acequire("../behaviour").Behaviour;
+var TokenIterator = acequire("../../token_iterator").TokenIterator;
+var lang = acequire("../../lib/lang");
+
+var SAFE_INSERT_IN_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator"];
+var SAFE_INSERT_BEFORE_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
+
+var context;
+var contextCache = {};
+var initContext = function(editor) {
+ var id = -1;
+ if (editor.multiSelect) {
+ id = editor.selection.index;
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
+ }
+ if (contextCache[id])
+ return context = contextCache[id];
+ context = contextCache[id] = {
+ autoInsertedBrackets: 0,
+ autoInsertedRow: -1,
+ autoInsertedLineEnd: "",
+ maybeInsertedBrackets: 0,
+ maybeInsertedRow: -1,
+ maybeInsertedLineStart: "",
+ maybeInsertedLineEnd: ""
+ };
+};
+
+var CstyleBehaviour = function() {
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (text == '{') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: '{' + selected + '}',
+ selection: false
+ };
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
+ return {
+ text: '{}',
+ selection: [1, 1]
+ };
+ } else {
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
+ return {
+ text: '{',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == '}') {
+ initContext(editor);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == '}') {
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == "\n" || text == "\r\n") {
+ initContext(editor);
+ var closing = "";
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar === '}') {
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
+ if (!openBracePos)
+ return null;
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
+ } else if (closing) {
+ var next_indent = this.$getIndent(line);
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ return;
+ }
+ var indent = next_indent + session.getTabString();
+
+ return {
+ text: '\n' + indent + '\n' + next_indent + closing,
+ selection: [1, indent.length, 1, indent.length]
+ };
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ });
+
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '{') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
+ if (rightChar == '}') {
+ range.end.column++;
+ return range;
+ } else {
+ context.maybeInsertedBrackets--;
+ }
+ }
+ });
+
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
+ if (text == '(') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: '(' + selected + ')',
+ selection: false
+ };
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
+ return {
+ text: '()',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ')') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ')') {
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '(') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ')') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
+ if (text == '[') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: '[' + selected + ']',
+ selection: false
+ };
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
+ return {
+ text: '[]',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ']') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ']') {
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '[') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ']') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
+ if (text == '"' || text == "'") {
+ initContext(editor);
+ var quote = text;
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: quote + selected + quote,
+ selection: false
+ };
+ } else {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var leftChar = line.substring(cursor.column-1, cursor.column);
+ if (leftChar == '\\') {
+ return null;
+ }
+ var tokens = session.getTokens(selection.start.row);
+ var col = 0, token;
+ var quotepos = -1; // Track whether we're inside an open quote.
+
+ for (var x = 0; x < tokens.length; x++) {
+ token = tokens[x];
+ if (token.type == "string") {
+ quotepos = -1;
+ } else if (quotepos < 0) {
+ quotepos = token.value.indexOf(quote);
+ }
+ if ((token.value.length + col) > selection.start.column) {
+ break;
+ }
+ col += tokens[x].value.length;
+ }
+ if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
+ return;
+ return {
+ text: quote + quote,
+ selection: [1,1]
+ };
+ } else if (token && token.type === "string") {
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == quote) {
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ }
+ });
+
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == selected) {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+};
+
+
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
+ var cursor = editor.getCursorPosition();
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
+ return false;
+ }
+ iterator.stepForward();
+ return iterator.getCurrentTokenRow() !== cursor.row ||
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
+};
+
+CstyleBehaviour.$matchTokenType = function(token, types) {
+ return types.indexOf(token.type || token) > -1;
+};
+
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
+ context.autoInsertedBrackets = 0;
+ context.autoInsertedRow = cursor.row;
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
+ context.autoInsertedBrackets++;
+};
+
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isMaybeInsertedClosing(cursor, line))
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = cursor.row;
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
+ context.maybeInsertedBrackets++;
+};
+
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
+ return context.autoInsertedBrackets > 0 &&
+ cursor.row === context.autoInsertedRow &&
+ bracket === context.autoInsertedLineEnd[0] &&
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
+};
+
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
+ return context.maybeInsertedBrackets > 0 &&
+ cursor.row === context.maybeInsertedRow &&
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
+};
+
+CstyleBehaviour.popAutoInsertedClosing = function() {
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
+ context.autoInsertedBrackets--;
+};
+
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
+ if (context) {
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = -1;
+ }
+};
+
+
+
+oop.inherits(CstyleBehaviour, Behaviour);
+
+exports.CstyleBehaviour = CstyleBehaviour;
+});
+
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../../lib/oop");
+var Range = acequire("../../range").Range;
+var BaseFoldMode = acequire("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+ace.define("ace/mode/solidity",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/solidity_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var TextMode = acequire("./text").Mode;
+var SolidityHighlightRules = acequire("./solidity_highlight_rules").SolidityHighlightRules;
+var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = acequire("../range").Range;
+var WorkerClient = acequire("../worker/worker_client").WorkerClient;
+var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = SolidityHighlightRules;
+
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "//";
+ this.blockComment = {start: "/*", end: "*/"};
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+ var endState = tokenizedLine.state;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start") {
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ } else if (state == "doc_comment") {
+ if (endState == "start") {
+ return "";
+ }
+ var match = line.match(/^\s*(\/?)\*/);
+ if (match) {
+ if (match[1]) {
+ indent += " ";
+ }
+ indent += "* ";
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.$id = "ace/mode/solidity";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+},{}],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){
+/*!
+ * ansi-gray
+ *
+ * Copyright (c) 2015, Jon Schlinkert.
+ * Licensed under the MIT License.
+ */
+
+'use strict';
+
+var wrap = require('ansi-wrap');
+
+module.exports = function gray(message) {
+ return wrap(90, 39, message);
+};
+
+},{"ansi-wrap":10}],9:[function(require,module,exports){
+'use strict';
+const colorConvert = require('color-convert');
+
+const wrapAnsi16 = (fn, offset) => function () {
+ const code = fn.apply(colorConvert, arguments);
+ return `\u001B[${code + offset}m`;
+};
+
+const wrapAnsi256 = (fn, offset) => function () {
+ const code = fn.apply(colorConvert, arguments);
+ return `\u001B[${38 + offset};5;${code}m`;
+};
+
+const wrapAnsi16m = (fn, offset) => function () {
+ const rgb = fn.apply(colorConvert, arguments);
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
+};
+
+function assembleStyles() {
+ const codes = new Map();
+ const styles = {
+ modifier: {
+ reset: [0, 0],
+ // 21 isn't widely supported and 22 does the same thing
+ bold: [1, 22],
+ dim: [2, 22],
+ italic: [3, 23],
+ underline: [4, 24],
+ inverse: [7, 27],
+ hidden: [8, 28],
+ strikethrough: [9, 29]
+ },
+ color: {
+ black: [30, 39],
+ red: [31, 39],
+ green: [32, 39],
+ yellow: [33, 39],
+ blue: [34, 39],
+ magenta: [35, 39],
+ cyan: [36, 39],
+ white: [37, 39],
+ gray: [90, 39],
+
+ // Bright color
+ redBright: [91, 39],
+ greenBright: [92, 39],
+ yellowBright: [93, 39],
+ blueBright: [94, 39],
+ magentaBright: [95, 39],
+ cyanBright: [96, 39],
+ whiteBright: [97, 39]
+ },
+ bgColor: {
+ bgBlack: [40, 49],
+ bgRed: [41, 49],
+ bgGreen: [42, 49],
+ bgYellow: [43, 49],
+ bgBlue: [44, 49],
+ bgMagenta: [45, 49],
+ bgCyan: [46, 49],
+ bgWhite: [47, 49],
+
+ // Bright color
+ bgBlackBright: [100, 49],
+ bgRedBright: [101, 49],
+ bgGreenBright: [102, 49],
+ bgYellowBright: [103, 49],
+ bgBlueBright: [104, 49],
+ bgMagentaBright: [105, 49],
+ bgCyanBright: [106, 49],
+ bgWhiteBright: [107, 49]
+ }
+ };
+
+ // Fix humans
+ styles.color.grey = styles.color.gray;
+
+ for (const groupName of Object.keys(styles)) {
+ const group = styles[groupName];
+
+ for (const styleName of Object.keys(group)) {
+ const style = group[styleName];
+
+ styles[styleName] = {
+ open: `\u001B[${style[0]}m`,
+ close: `\u001B[${style[1]}m`
+ };
+
+ group[styleName] = styles[styleName];
+
+ codes.set(style[0], style[1]);
+ }
+
+ Object.defineProperty(styles, groupName, {
+ value: group,
+ enumerable: false
+ });
+
+ Object.defineProperty(styles, 'codes', {
+ value: codes,
+ enumerable: false
+ });
+ }
+
+ const ansi2ansi = n => n;
+ const rgb2rgb = (r, g, b) => [r, g, b];
+
+ styles.color.close = '\u001B[39m';
+ styles.bgColor.close = '\u001B[49m';
+
+ styles.color.ansi = {
+ ansi: wrapAnsi16(ansi2ansi, 0)
+ };
+ styles.color.ansi256 = {
+ ansi256: wrapAnsi256(ansi2ansi, 0)
+ };
+ styles.color.ansi16m = {
+ rgb: wrapAnsi16m(rgb2rgb, 0)
+ };
+
+ styles.bgColor.ansi = {
+ ansi: wrapAnsi16(ansi2ansi, 10)
+ };
+ styles.bgColor.ansi256 = {
+ ansi256: wrapAnsi256(ansi2ansi, 10)
+ };
+ styles.bgColor.ansi16m = {
+ rgb: wrapAnsi16m(rgb2rgb, 10)
+ };
+
+ for (let key of Object.keys(colorConvert)) {
+ if (typeof colorConvert[key] !== 'object') {
+ continue;
+ }
+
+ const suite = colorConvert[key];
+
+ if (key === 'ansi16') {
+ key = 'ansi';
+ }
+
+ if ('ansi16' in suite) {
+ styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
+ styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
+ }
+
+ if ('ansi256' in suite) {
+ styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
+ styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
+ }
+
+ if ('rgb' in suite) {
+ styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
+ styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
+ }
+ }
+
+ return styles;
+}
+
+// Make the export immutable
+Object.defineProperty(module, 'exports', {
+ enumerable: true,
+ get: assembleStyles
+});
+
+},{"color-convert":123}],10:[function(require,module,exports){
+'use strict';
+
+module.exports = function(a, b, msg) {
+ return '\u001b['+ a + 'm' + msg + '\u001b[' + b + 'm';
+};
+
+},{}],11:[function(require,module,exports){
+module.exports = require('./register')().Promise
+
+},{"./register":13}],12:[function(require,module,exports){
+"use strict"
+ // global key for user preferred registration
+var REGISTRATION_KEY = '@@any-promise/REGISTRATION',
+ // Prior registration (preferred or detected)
+ registered = null
+
+/**
+ * Registers the given implementation. An implementation must
+ * be registered prior to any call to `require("any-promise")`,
+ * typically on application load.
+ *
+ * If called with no arguments, will return registration in
+ * following priority:
+ *
+ * For Node.js:
+ *
+ * 1. Previous registration
+ * 2. global.Promise if node.js version >= 0.12
+ * 3. Auto detected promise based on first sucessful require of
+ * known promise libraries. Note this is a last resort, as the
+ * loaded library is non-deterministic. node.js >= 0.12 will
+ * always use global.Promise over this priority list.
+ * 4. Throws error.
+ *
+ * For Browser:
+ *
+ * 1. Previous registration
+ * 2. window.Promise
+ * 3. Throws error.
+ *
+ * Options:
+ *
+ * Promise: Desired Promise constructor
+ * global: Boolean - Should the registration be cached in a global variable to
+ * allow cross dependency/bundle registration? (default true)
+ */
+module.exports = function(root, loadImplementation){
+ return function register(implementation, opts){
+ implementation = implementation || null
+ opts = opts || {}
+ // global registration unless explicitly {global: false} in options (default true)
+ var registerGlobal = opts.global !== false;
+
+ // load any previous global registration
+ if(registered === null && registerGlobal){
+ registered = root[REGISTRATION_KEY] || null
+ }
+
+ if(registered !== null
+ && implementation !== null
+ && registered.implementation !== implementation){
+ // Throw error if attempting to redefine implementation
+ throw new Error('any-promise already defined as "'+registered.implementation+
+ '". You can only register an implementation before the first '+
+ ' call to require("any-promise") and an implementation cannot be changed')
+ }
+
+ if(registered === null){
+ // use provided implementation
+ if(implementation !== null && typeof opts.Promise !== 'undefined'){
+ registered = {
+ Promise: opts.Promise,
+ implementation: implementation
+ }
+ } else {
+ // require implementation if implementation is specified but not provided
+ registered = loadImplementation(implementation)
+ }
+
+ if(registerGlobal){
+ // register preference globally in case multiple installations
+ root[REGISTRATION_KEY] = registered
+ }
+ }
+
+ return registered
+ }
+}
+
+},{}],13:[function(require,module,exports){
+"use strict";
+module.exports = require('./loader')(window, loadImplementation)
+
+/**
+ * Browser specific loadImplementation. Always uses `window.Promise`
+ *
+ * To register a custom implementation, must register with `Promise` option.
+ */
+function loadImplementation(){
+ if(typeof window.Promise === 'undefined'){
+ throw new Error("any-promise browser requires a polyfill or explicit registration"+
+ " e.g: require('any-promise/register/bluebird')")
+ }
+ return {
+ Promise: window.Promise,
+ implementation: 'window.Promise'
+ }
+}
+
+},{"./loader":12}],14:[function(require,module,exports){
+var asn1 = exports;
+
+asn1.bignum = require('bn.js');
+
+asn1.define = require('./asn1/api').define;
+asn1.base = require('./asn1/base');
+asn1.constants = require('./asn1/constants');
+asn1.decoders = require('./asn1/decoders');
+asn1.encoders = require('./asn1/encoders');
+
+},{"./asn1/api":15,"./asn1/base":17,"./asn1/constants":21,"./asn1/decoders":23,"./asn1/encoders":26,"bn.js":66}],15:[function(require,module,exports){
+var asn1 = require('../asn1');
+var inherits = require('inherits');
+
+var api = exports;
+
+api.define = function define(name, body) {
+ return new Entity(name, body);
+};
+
+function Entity(name, body) {
+ this.name = name;
+ this.body = body;
+
+ this.decoders = {};
+ this.encoders = {};
+};
+
+Entity.prototype._createNamed = function createNamed(base) {
+ var named;
+ try {
+ named = require('vm').runInThisContext(
+ '(function ' + this.name + '(entity) {\n' +
+ ' this._initNamed(entity);\n' +
+ '})'
+ );
+ } catch (e) {
+ named = function (entity) {
+ this._initNamed(entity);
+ };
+ }
+ inherits(named, base);
+ named.prototype._initNamed = function initnamed(entity) {
+ base.call(this, entity);
+ };
+
+ return new named(this);
+};
+
+Entity.prototype._getDecoder = function _getDecoder(enc) {
+ enc = enc || 'der';
+ // Lazily create decoder
+ if (!this.decoders.hasOwnProperty(enc))
+ this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
+ return this.decoders[enc];
+};
+
+Entity.prototype.decode = function decode(data, enc, options) {
+ return this._getDecoder(enc).decode(data, options);
+};
+
+Entity.prototype._getEncoder = function _getEncoder(enc) {
+ enc = enc || 'der';
+ // Lazily create encoder
+ if (!this.encoders.hasOwnProperty(enc))
+ this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
+ return this.encoders[enc];
+};
+
+Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
+ return this._getEncoder(enc).encode(data, reporter);
+};
+
+},{"../asn1":14,"inherits":834,"vm":111}],16:[function(require,module,exports){
+var inherits = require('inherits');
+var Reporter = require('../base').Reporter;
+var Buffer = require('buffer').Buffer;
+
+function DecoderBuffer(base, options) {
+ Reporter.call(this, options);
+ if (!Buffer.isBuffer(base)) {
+ this.error('Input not Buffer');
+ return;
+ }
+
+ this.base = base;
+ this.offset = 0;
+ this.length = base.length;
+}
+inherits(DecoderBuffer, Reporter);
+exports.DecoderBuffer = DecoderBuffer;
+
+DecoderBuffer.prototype.save = function save() {
+ return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
+};
+
+DecoderBuffer.prototype.restore = function restore(save) {
+ // Return skipped data
+ var res = new DecoderBuffer(this.base);
+ res.offset = save.offset;
+ res.length = this.offset;
+
+ this.offset = save.offset;
+ Reporter.prototype.restore.call(this, save.reporter);
+
+ return res;
+};
+
+DecoderBuffer.prototype.isEmpty = function isEmpty() {
+ return this.offset === this.length;
+};
+
+DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
+ if (this.offset + 1 <= this.length)
+ return this.base.readUInt8(this.offset++, true);
+ else
+ return this.error(fail || 'DecoderBuffer overrun');
+}
+
+DecoderBuffer.prototype.skip = function skip(bytes, fail) {
+ if (!(this.offset + bytes <= this.length))
+ return this.error(fail || 'DecoderBuffer overrun');
+
+ var res = new DecoderBuffer(this.base);
+
+ // Share reporter state
+ res._reporterState = this._reporterState;
+
+ res.offset = this.offset;
+ res.length = this.offset + bytes;
+ this.offset += bytes;
+ return res;
+}
+
+DecoderBuffer.prototype.raw = function raw(save) {
+ return this.base.slice(save ? save.offset : this.offset, this.length);
+}
+
+function EncoderBuffer(value, reporter) {
+ if (Array.isArray(value)) {
+ this.length = 0;
+ this.value = value.map(function(item) {
+ if (!(item instanceof EncoderBuffer))
+ item = new EncoderBuffer(item, reporter);
+ this.length += item.length;
+ return item;
+ }, this);
+ } else if (typeof value === 'number') {
+ if (!(0 <= value && value <= 0xff))
+ return reporter.error('non-byte EncoderBuffer value');
+ this.value = value;
+ this.length = 1;
+ } else if (typeof value === 'string') {
+ this.value = value;
+ this.length = Buffer.byteLength(value);
+ } else if (Buffer.isBuffer(value)) {
+ this.value = value;
+ this.length = value.length;
+ } else {
+ return reporter.error('Unsupported type: ' + typeof value);
+ }
+}
+exports.EncoderBuffer = EncoderBuffer;
+
+EncoderBuffer.prototype.join = function join(out, offset) {
+ if (!out)
+ out = new Buffer(this.length);
+ if (!offset)
+ offset = 0;
+
+ if (this.length === 0)
+ return out;
+
+ if (Array.isArray(this.value)) {
+ this.value.forEach(function(item) {
+ item.join(out, offset);
+ offset += item.length;
+ });
+ } else {
+ if (typeof this.value === 'number')
+ out[offset] = this.value;
+ else if (typeof this.value === 'string')
+ out.write(this.value, offset);
+ else if (Buffer.isBuffer(this.value))
+ this.value.copy(out, offset);
+ offset += this.length;
+ }
+
+ return out;
+};
+
+},{"../base":17,"buffer":113,"inherits":834}],17:[function(require,module,exports){
+var base = exports;
+
+base.Reporter = require('./reporter').Reporter;
+base.DecoderBuffer = require('./buffer').DecoderBuffer;
+base.EncoderBuffer = require('./buffer').EncoderBuffer;
+base.Node = require('./node');
+
+},{"./buffer":16,"./node":18,"./reporter":19}],18:[function(require,module,exports){
+var Reporter = require('../base').Reporter;
+var EncoderBuffer = require('../base').EncoderBuffer;
+var DecoderBuffer = require('../base').DecoderBuffer;
+var assert = require('minimalistic-assert');
+
+// Supported tags
+var tags = [
+ 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
+ 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',
+ 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
+ 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
+];
+
+// Public methods list
+var methods = [
+ 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
+ 'any', 'contains'
+].concat(tags);
+
+// Overrided methods list
+var overrided = [
+ '_peekTag', '_decodeTag', '_use',
+ '_decodeStr', '_decodeObjid', '_decodeTime',
+ '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
+
+ '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
+ '_encodeNull', '_encodeInt', '_encodeBool'
+];
+
+function Node(enc, parent) {
+ var state = {};
+ this._baseState = state;
+
+ state.enc = enc;
+
+ state.parent = parent || null;
+ state.children = null;
+
+ // State
+ state.tag = null;
+ state.args = null;
+ state.reverseArgs = null;
+ state.choice = null;
+ state.optional = false;
+ state.any = false;
+ state.obj = false;
+ state.use = null;
+ state.useDecoder = null;
+ state.key = null;
+ state['default'] = null;
+ state.explicit = null;
+ state.implicit = null;
+ state.contains = null;
+
+ // Should create new instance on each method
+ if (!state.parent) {
+ state.children = [];
+ this._wrap();
+ }
+}
+module.exports = Node;
+
+var stateProps = [
+ 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
+ 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
+ 'implicit', 'contains'
+];
+
+Node.prototype.clone = function clone() {
+ var state = this._baseState;
+ var cstate = {};
+ stateProps.forEach(function(prop) {
+ cstate[prop] = state[prop];
+ });
+ var res = new this.constructor(cstate.parent);
+ res._baseState = cstate;
+ return res;
+};
+
+Node.prototype._wrap = function wrap() {
+ var state = this._baseState;
+ methods.forEach(function(method) {
+ this[method] = function _wrappedMethod() {
+ var clone = new this.constructor(this);
+ state.children.push(clone);
+ return clone[method].apply(clone, arguments);
+ };
+ }, this);
+};
+
+Node.prototype._init = function init(body) {
+ var state = this._baseState;
+
+ assert(state.parent === null);
+ body.call(this);
+
+ // Filter children
+ state.children = state.children.filter(function(child) {
+ return child._baseState.parent === this;
+ }, this);
+ assert.equal(state.children.length, 1, 'Root node can have only one child');
+};
+
+Node.prototype._useArgs = function useArgs(args) {
+ var state = this._baseState;
+
+ // Filter children and args
+ var children = args.filter(function(arg) {
+ return arg instanceof this.constructor;
+ }, this);
+ args = args.filter(function(arg) {
+ return !(arg instanceof this.constructor);
+ }, this);
+
+ if (children.length !== 0) {
+ assert(state.children === null);
+ state.children = children;
+
+ // Replace parent to maintain backward link
+ children.forEach(function(child) {
+ child._baseState.parent = this;
+ }, this);
+ }
+ if (args.length !== 0) {
+ assert(state.args === null);
+ state.args = args;
+ state.reverseArgs = args.map(function(arg) {
+ if (typeof arg !== 'object' || arg.constructor !== Object)
+ return arg;
+
+ var res = {};
+ Object.keys(arg).forEach(function(key) {
+ if (key == (key | 0))
+ key |= 0;
+ var value = arg[key];
+ res[value] = key;
+ });
+ return res;
+ });
+ }
+};
+
+//
+// Overrided methods
+//
+
+overrided.forEach(function(method) {
+ Node.prototype[method] = function _overrided() {
+ var state = this._baseState;
+ throw new Error(method + ' not implemented for encoding: ' + state.enc);
+ };
+});
+
+//
+// Public methods
+//
+
+tags.forEach(function(tag) {
+ Node.prototype[tag] = function _tagMethod() {
+ var state = this._baseState;
+ var args = Array.prototype.slice.call(arguments);
+
+ assert(state.tag === null);
+ state.tag = tag;
+
+ this._useArgs(args);
+
+ return this;
+ };
+});
+
+Node.prototype.use = function use(item) {
+ assert(item);
+ var state = this._baseState;
+
+ assert(state.use === null);
+ state.use = item;
+
+ return this;
+};
+
+Node.prototype.optional = function optional() {
+ var state = this._baseState;
+
+ state.optional = true;
+
+ return this;
+};
+
+Node.prototype.def = function def(val) {
+ var state = this._baseState;
+
+ assert(state['default'] === null);
+ state['default'] = val;
+ state.optional = true;
+
+ return this;
+};
+
+Node.prototype.explicit = function explicit(num) {
+ var state = this._baseState;
+
+ assert(state.explicit === null && state.implicit === null);
+ state.explicit = num;
+
+ return this;
+};
+
+Node.prototype.implicit = function implicit(num) {
+ var state = this._baseState;
+
+ assert(state.explicit === null && state.implicit === null);
+ state.implicit = num;
+
+ return this;
+};
+
+Node.prototype.obj = function obj() {
+ var state = this._baseState;
+ var args = Array.prototype.slice.call(arguments);
+
+ state.obj = true;
+
+ if (args.length !== 0)
+ this._useArgs(args);
+
+ return this;
+};
+
+Node.prototype.key = function key(newKey) {
+ var state = this._baseState;
+
+ assert(state.key === null);
+ state.key = newKey;
+
+ return this;
+};
+
+Node.prototype.any = function any() {
+ var state = this._baseState;
+
+ state.any = true;
+
+ return this;
+};
+
+Node.prototype.choice = function choice(obj) {
+ var state = this._baseState;
+
+ assert(state.choice === null);
+ state.choice = obj;
+ this._useArgs(Object.keys(obj).map(function(key) {
+ return obj[key];
+ }));
+
+ return this;
+};
+
+Node.prototype.contains = function contains(item) {
+ var state = this._baseState;
+
+ assert(state.use === null);
+ state.contains = item;
+
+ return this;
+};
+
+//
+// Decoding
+//
+
+Node.prototype._decode = function decode(input, options) {
+ var state = this._baseState;
+
+ // Decode root node
+ if (state.parent === null)
+ return input.wrapResult(state.children[0]._decode(input, options));
+
+ var result = state['default'];
+ var present = true;
+
+ var prevKey = null;
+ if (state.key !== null)
+ prevKey = input.enterKey(state.key);
+
+ // Check if tag is there
+ if (state.optional) {
+ var tag = null;
+ if (state.explicit !== null)
+ tag = state.explicit;
+ else if (state.implicit !== null)
+ tag = state.implicit;
+ else if (state.tag !== null)
+ tag = state.tag;
+
+ if (tag === null && !state.any) {
+ // Trial and Error
+ var save = input.save();
+ try {
+ if (state.choice === null)
+ this._decodeGeneric(state.tag, input, options);
+ else
+ this._decodeChoice(input, options);
+ present = true;
+ } catch (e) {
+ present = false;
+ }
+ input.restore(save);
+ } else {
+ present = this._peekTag(input, tag, state.any);
+
+ if (input.isError(present))
+ return present;
+ }
+ }
+
+ // Push object on stack
+ var prevObj;
+ if (state.obj && present)
+ prevObj = input.enterObject();
+
+ if (present) {
+ // Unwrap explicit values
+ if (state.explicit !== null) {
+ var explicit = this._decodeTag(input, state.explicit);
+ if (input.isError(explicit))
+ return explicit;
+ input = explicit;
+ }
+
+ var start = input.offset;
+
+ // Unwrap implicit and normal values
+ if (state.use === null && state.choice === null) {
+ if (state.any)
+ var save = input.save();
+ var body = this._decodeTag(
+ input,
+ state.implicit !== null ? state.implicit : state.tag,
+ state.any
+ );
+ if (input.isError(body))
+ return body;
+
+ if (state.any)
+ result = input.raw(save);
+ else
+ input = body;
+ }
+
+ if (options && options.track && state.tag !== null)
+ options.track(input.path(), start, input.length, 'tagged');
+
+ if (options && options.track && state.tag !== null)
+ options.track(input.path(), input.offset, input.length, 'content');
+
+ // Select proper method for tag
+ if (state.any)
+ result = result;
+ else if (state.choice === null)
+ result = this._decodeGeneric(state.tag, input, options);
+ else
+ result = this._decodeChoice(input, options);
+
+ if (input.isError(result))
+ return result;
+
+ // Decode children
+ if (!state.any && state.choice === null && state.children !== null) {
+ state.children.forEach(function decodeChildren(child) {
+ // NOTE: We are ignoring errors here, to let parser continue with other
+ // parts of encoded data
+ child._decode(input, options);
+ });
+ }
+
+ // Decode contained/encoded by schema, only in bit or octet strings
+ if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
+ var data = new DecoderBuffer(result);
+ result = this._getUse(state.contains, input._reporterState.obj)
+ ._decode(data, options);
+ }
+ }
+
+ // Pop object
+ if (state.obj && present)
+ result = input.leaveObject(prevObj);
+
+ // Set key
+ if (state.key !== null && (result !== null || present === true))
+ input.leaveKey(prevKey, state.key, result);
+ else if (prevKey !== null)
+ input.exitKey(prevKey);
+
+ return result;
+};
+
+Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
+ var state = this._baseState;
+
+ if (tag === 'seq' || tag === 'set')
+ return null;
+ if (tag === 'seqof' || tag === 'setof')
+ return this._decodeList(input, tag, state.args[0], options);
+ else if (/str$/.test(tag))
+ return this._decodeStr(input, tag, options);
+ else if (tag === 'objid' && state.args)
+ return this._decodeObjid(input, state.args[0], state.args[1], options);
+ else if (tag === 'objid')
+ return this._decodeObjid(input, null, null, options);
+ else if (tag === 'gentime' || tag === 'utctime')
+ return this._decodeTime(input, tag, options);
+ else if (tag === 'null_')
+ return this._decodeNull(input, options);
+ else if (tag === 'bool')
+ return this._decodeBool(input, options);
+ else if (tag === 'objDesc')
+ return this._decodeStr(input, tag, options);
+ else if (tag === 'int' || tag === 'enum')
+ return this._decodeInt(input, state.args && state.args[0], options);
+
+ if (state.use !== null) {
+ return this._getUse(state.use, input._reporterState.obj)
+ ._decode(input, options);
+ } else {
+ return input.error('unknown tag: ' + tag);
+ }
+};
+
+Node.prototype._getUse = function _getUse(entity, obj) {
+
+ var state = this._baseState;
+ // Create altered use decoder if implicit is set
+ state.useDecoder = this._use(entity, obj);
+ assert(state.useDecoder._baseState.parent === null);
+ state.useDecoder = state.useDecoder._baseState.children[0];
+ if (state.implicit !== state.useDecoder._baseState.implicit) {
+ state.useDecoder = state.useDecoder.clone();
+ state.useDecoder._baseState.implicit = state.implicit;
+ }
+ return state.useDecoder;
+};
+
+Node.prototype._decodeChoice = function decodeChoice(input, options) {
+ var state = this._baseState;
+ var result = null;
+ var match = false;
+
+ Object.keys(state.choice).some(function(key) {
+ var save = input.save();
+ var node = state.choice[key];
+ try {
+ var value = node._decode(input, options);
+ if (input.isError(value))
+ return false;
+
+ result = { type: key, value: value };
+ match = true;
+ } catch (e) {
+ input.restore(save);
+ return false;
+ }
+ return true;
+ }, this);
+
+ if (!match)
+ return input.error('Choice not matched');
+
+ return result;
+};
+
+//
+// Encoding
+//
+
+Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
+ return new EncoderBuffer(data, this.reporter);
+};
+
+Node.prototype._encode = function encode(data, reporter, parent) {
+ var state = this._baseState;
+ if (state['default'] !== null && state['default'] === data)
+ return;
+
+ var result = this._encodeValue(data, reporter, parent);
+ if (result === undefined)
+ return;
+
+ if (this._skipDefault(result, reporter, parent))
+ return;
+
+ return result;
+};
+
+Node.prototype._encodeValue = function encode(data, reporter, parent) {
+ var state = this._baseState;
+
+ // Decode root node
+ if (state.parent === null)
+ return state.children[0]._encode(data, reporter || new Reporter());
+
+ var result = null;
+
+ // Set reporter to share it with a child class
+ this.reporter = reporter;
+
+ // Check if data is there
+ if (state.optional && data === undefined) {
+ if (state['default'] !== null)
+ data = state['default']
+ else
+ return;
+ }
+
+ // Encode children first
+ var content = null;
+ var primitive = false;
+ if (state.any) {
+ // Anything that was given is translated to buffer
+ result = this._createEncoderBuffer(data);
+ } else if (state.choice) {
+ result = this._encodeChoice(data, reporter);
+ } else if (state.contains) {
+ content = this._getUse(state.contains, parent)._encode(data, reporter);
+ primitive = true;
+ } else if (state.children) {
+ content = state.children.map(function(child) {
+ if (child._baseState.tag === 'null_')
+ return child._encode(null, reporter, data);
+
+ if (child._baseState.key === null)
+ return reporter.error('Child should have a key');
+ var prevKey = reporter.enterKey(child._baseState.key);
+
+ if (typeof data !== 'object')
+ return reporter.error('Child expected, but input is not object');
+
+ var res = child._encode(data[child._baseState.key], reporter, data);
+ reporter.leaveKey(prevKey);
+
+ return res;
+ }, this).filter(function(child) {
+ return child;
+ });
+ content = this._createEncoderBuffer(content);
+ } else {
+ if (state.tag === 'seqof' || state.tag === 'setof') {
+ // TODO(indutny): this should be thrown on DSL level
+ if (!(state.args && state.args.length === 1))
+ return reporter.error('Too many args for : ' + state.tag);
+
+ if (!Array.isArray(data))
+ return reporter.error('seqof/setof, but data is not Array');
+
+ var child = this.clone();
+ child._baseState.implicit = null;
+ content = this._createEncoderBuffer(data.map(function(item) {
+ var state = this._baseState;
+
+ return this._getUse(state.args[0], data)._encode(item, reporter);
+ }, child));
+ } else if (state.use !== null) {
+ result = this._getUse(state.use, parent)._encode(data, reporter);
+ } else {
+ content = this._encodePrimitive(state.tag, data);
+ primitive = true;
+ }
+ }
+
+ // Encode data itself
+ var result;
+ if (!state.any && state.choice === null) {
+ var tag = state.implicit !== null ? state.implicit : state.tag;
+ var cls = state.implicit === null ? 'universal' : 'context';
+
+ if (tag === null) {
+ if (state.use === null)
+ reporter.error('Tag could be omitted only for .use()');
+ } else {
+ if (state.use === null)
+ result = this._encodeComposite(tag, primitive, cls, content);
+ }
+ }
+
+ // Wrap in explicit
+ if (state.explicit !== null)
+ result = this._encodeComposite(state.explicit, false, 'context', result);
+
+ return result;
+};
+
+Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
+ var state = this._baseState;
+
+ var node = state.choice[data.type];
+ if (!node) {
+ assert(
+ false,
+ data.type + ' not found in ' +
+ JSON.stringify(Object.keys(state.choice)));
+ }
+ return node._encode(data.value, reporter);
+};
+
+Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
+ var state = this._baseState;
+
+ if (/str$/.test(tag))
+ return this._encodeStr(data, tag);
+ else if (tag === 'objid' && state.args)
+ return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
+ else if (tag === 'objid')
+ return this._encodeObjid(data, null, null);
+ else if (tag === 'gentime' || tag === 'utctime')
+ return this._encodeTime(data, tag);
+ else if (tag === 'null_')
+ return this._encodeNull();
+ else if (tag === 'int' || tag === 'enum')
+ return this._encodeInt(data, state.args && state.reverseArgs[0]);
+ else if (tag === 'bool')
+ return this._encodeBool(data);
+ else if (tag === 'objDesc')
+ return this._encodeStr(data, tag);
+ else
+ throw new Error('Unsupported tag: ' + tag);
+};
+
+Node.prototype._isNumstr = function isNumstr(str) {
+ return /^[0-9 ]*$/.test(str);
+};
+
+Node.prototype._isPrintstr = function isPrintstr(str) {
+ return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
+};
+
+},{"../base":17,"minimalistic-assert":960}],19:[function(require,module,exports){
+var inherits = require('inherits');
+
+function Reporter(options) {
+ this._reporterState = {
+ obj: null,
+ path: [],
+ options: options || {},
+ errors: []
+ };
+}
+exports.Reporter = Reporter;
+
+Reporter.prototype.isError = function isError(obj) {
+ return obj instanceof ReporterError;
+};
+
+Reporter.prototype.save = function save() {
+ var state = this._reporterState;
+
+ return { obj: state.obj, pathLen: state.path.length };
+};
+
+Reporter.prototype.restore = function restore(data) {
+ var state = this._reporterState;
+
+ state.obj = data.obj;
+ state.path = state.path.slice(0, data.pathLen);
+};
+
+Reporter.prototype.enterKey = function enterKey(key) {
+ return this._reporterState.path.push(key);
+};
+
+Reporter.prototype.exitKey = function exitKey(index) {
+ var state = this._reporterState;
+
+ state.path = state.path.slice(0, index - 1);
+};
+
+Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
+ var state = this._reporterState;
+
+ this.exitKey(index);
+ if (state.obj !== null)
+ state.obj[key] = value;
+};
+
+Reporter.prototype.path = function path() {
+ return this._reporterState.path.join('/');
+};
+
+Reporter.prototype.enterObject = function enterObject() {
+ var state = this._reporterState;
+
+ var prev = state.obj;
+ state.obj = {};
+ return prev;
+};
+
+Reporter.prototype.leaveObject = function leaveObject(prev) {
+ var state = this._reporterState;
+
+ var now = state.obj;
+ state.obj = prev;
+ return now;
+};
+
+Reporter.prototype.error = function error(msg) {
+ var err;
+ var state = this._reporterState;
+
+ var inherited = msg instanceof ReporterError;
+ if (inherited) {
+ err = msg;
+ } else {
+ err = new ReporterError(state.path.map(function(elem) {
+ return '[' + JSON.stringify(elem) + ']';
+ }).join(''), msg.message || msg, msg.stack);
+ }
+
+ if (!state.options.partial)
+ throw err;
+
+ if (!inherited)
+ state.errors.push(err);
+
+ return err;
+};
+
+Reporter.prototype.wrapResult = function wrapResult(result) {
+ var state = this._reporterState;
+ if (!state.options.partial)
+ return result;
+
+ return {
+ result: this.isError(result) ? null : result,
+ errors: state.errors
+ };
+};
+
+function ReporterError(path, msg) {
+ this.path = path;
+ this.rethrow(msg);
+};
+inherits(ReporterError, Error);
+
+ReporterError.prototype.rethrow = function rethrow(msg) {
+ this.message = msg + ' at: ' + (this.path || '(shallow)');
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, ReporterError);
+
+ if (!this.stack) {
+ try {
+ // IE only adds stack when thrown
+ throw new Error(this.message);
+ } catch (e) {
+ this.stack = e.stack;
+ }
+ }
+ return this;
+};
+
+},{"inherits":834}],20:[function(require,module,exports){
+var constants = require('../constants');
+
+exports.tagClass = {
+ 0: 'universal',
+ 1: 'application',
+ 2: 'context',
+ 3: 'private'
+};
+exports.tagClassByName = constants._reverse(exports.tagClass);
+
+exports.tag = {
+ 0x00: 'end',
+ 0x01: 'bool',
+ 0x02: 'int',
+ 0x03: 'bitstr',
+ 0x04: 'octstr',
+ 0x05: 'null_',
+ 0x06: 'objid',
+ 0x07: 'objDesc',
+ 0x08: 'external',
+ 0x09: 'real',
+ 0x0a: 'enum',
+ 0x0b: 'embed',
+ 0x0c: 'utf8str',
+ 0x0d: 'relativeOid',
+ 0x10: 'seq',
+ 0x11: 'set',
+ 0x12: 'numstr',
+ 0x13: 'printstr',
+ 0x14: 't61str',
+ 0x15: 'videostr',
+ 0x16: 'ia5str',
+ 0x17: 'utctime',
+ 0x18: 'gentime',
+ 0x19: 'graphstr',
+ 0x1a: 'iso646str',
+ 0x1b: 'genstr',
+ 0x1c: 'unistr',
+ 0x1d: 'charstr',
+ 0x1e: 'bmpstr'
+};
+exports.tagByName = constants._reverse(exports.tag);
+
+},{"../constants":21}],21:[function(require,module,exports){
+var constants = exports;
+
+// Helper
+constants._reverse = function reverse(map) {
+ var res = {};
+
+ Object.keys(map).forEach(function(key) {
+ // Convert key to integer if it is stringified
+ if ((key | 0) == key)
+ key = key | 0;
+
+ var value = map[key];
+ res[value] = key;
+ });
+
+ return res;
+};
+
+constants.der = require('./der');
+
+},{"./der":20}],22:[function(require,module,exports){
+var inherits = require('inherits');
+
+var asn1 = require('../../asn1');
+var base = asn1.base;
+var bignum = asn1.bignum;
+
+// Import DER constants
+var der = asn1.constants.der;
+
+function DERDecoder(entity) {
+ this.enc = 'der';
+ this.name = entity.name;
+ this.entity = entity;
+
+ // Construct base tree
+ this.tree = new DERNode();
+ this.tree._init(entity.body);
+};
+module.exports = DERDecoder;
+
+DERDecoder.prototype.decode = function decode(data, options) {
+ if (!(data instanceof base.DecoderBuffer))
+ data = new base.DecoderBuffer(data, options);
+
+ return this.tree._decode(data, options);
+};
+
+// Tree methods
+
+function DERNode(parent) {
+ base.Node.call(this, 'der', parent);
+}
+inherits(DERNode, base.Node);
+
+DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
+ if (buffer.isEmpty())
+ return false;
+
+ var state = buffer.save();
+ var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
+ if (buffer.isError(decodedTag))
+ return decodedTag;
+
+ buffer.restore(state);
+
+ return decodedTag.tag === tag || decodedTag.tagStr === tag ||
+ (decodedTag.tagStr + 'of') === tag || any;
+};
+
+DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
+ var decodedTag = derDecodeTag(buffer,
+ 'Failed to decode tag of "' + tag + '"');
+ if (buffer.isError(decodedTag))
+ return decodedTag;
+
+ var len = derDecodeLen(buffer,
+ decodedTag.primitive,
+ 'Failed to get length of "' + tag + '"');
+
+ // Failure
+ if (buffer.isError(len))
+ return len;
+
+ if (!any &&
+ decodedTag.tag !== tag &&
+ decodedTag.tagStr !== tag &&
+ decodedTag.tagStr + 'of' !== tag) {
+ return buffer.error('Failed to match tag: "' + tag + '"');
+ }
+
+ if (decodedTag.primitive || len !== null)
+ return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
+
+ // Indefinite length... find END tag
+ var state = buffer.save();
+ var res = this._skipUntilEnd(
+ buffer,
+ 'Failed to skip indefinite length body: "' + this.tag + '"');
+ if (buffer.isError(res))
+ return res;
+
+ len = buffer.offset - state.offset;
+ buffer.restore(state);
+ return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
+};
+
+DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
+ while (true) {
+ var tag = derDecodeTag(buffer, fail);
+ if (buffer.isError(tag))
+ return tag;
+ var len = derDecodeLen(buffer, tag.primitive, fail);
+ if (buffer.isError(len))
+ return len;
+
+ var res;
+ if (tag.primitive || len !== null)
+ res = buffer.skip(len)
+ else
+ res = this._skipUntilEnd(buffer, fail);
+
+ // Failure
+ if (buffer.isError(res))
+ return res;
+
+ if (tag.tagStr === 'end')
+ break;
+ }
+};
+
+DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
+ options) {
+ var result = [];
+ while (!buffer.isEmpty()) {
+ var possibleEnd = this._peekTag(buffer, 'end');
+ if (buffer.isError(possibleEnd))
+ return possibleEnd;
+
+ var res = decoder.decode(buffer, 'der', options);
+ if (buffer.isError(res) && possibleEnd)
+ break;
+ result.push(res);
+ }
+ return result;
+};
+
+DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
+ if (tag === 'bitstr') {
+ var unused = buffer.readUInt8();
+ if (buffer.isError(unused))
+ return unused;
+ return { unused: unused, data: buffer.raw() };
+ } else if (tag === 'bmpstr') {
+ var raw = buffer.raw();
+ if (raw.length % 2 === 1)
+ return buffer.error('Decoding of string type: bmpstr length mismatch');
+
+ var str = '';
+ for (var i = 0; i < raw.length / 2; i++) {
+ str += String.fromCharCode(raw.readUInt16BE(i * 2));
+ }
+ return str;
+ } else if (tag === 'numstr') {
+ var numstr = buffer.raw().toString('ascii');
+ if (!this._isNumstr(numstr)) {
+ return buffer.error('Decoding of string type: ' +
+ 'numstr unsupported characters');
+ }
+ return numstr;
+ } else if (tag === 'octstr') {
+ return buffer.raw();
+ } else if (tag === 'objDesc') {
+ return buffer.raw();
+ } else if (tag === 'printstr') {
+ var printstr = buffer.raw().toString('ascii');
+ if (!this._isPrintstr(printstr)) {
+ return buffer.error('Decoding of string type: ' +
+ 'printstr unsupported characters');
+ }
+ return printstr;
+ } else if (/str$/.test(tag)) {
+ return buffer.raw().toString();
+ } else {
+ return buffer.error('Decoding of string type: ' + tag + ' unsupported');
+ }
+};
+
+DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
+ var result;
+ var identifiers = [];
+ var ident = 0;
+ while (!buffer.isEmpty()) {
+ var subident = buffer.readUInt8();
+ ident <<= 7;
+ ident |= subident & 0x7f;
+ if ((subident & 0x80) === 0) {
+ identifiers.push(ident);
+ ident = 0;
+ }
+ }
+ if (subident & 0x80)
+ identifiers.push(ident);
+
+ var first = (identifiers[0] / 40) | 0;
+ var second = identifiers[0] % 40;
+
+ if (relative)
+ result = identifiers;
+ else
+ result = [first, second].concat(identifiers.slice(1));
+
+ if (values) {
+ var tmp = values[result.join(' ')];
+ if (tmp === undefined)
+ tmp = values[result.join('.')];
+ if (tmp !== undefined)
+ result = tmp;
+ }
+
+ return result;
+};
+
+DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
+ var str = buffer.raw().toString();
+ if (tag === 'gentime') {
+ var year = str.slice(0, 4) | 0;
+ var mon = str.slice(4, 6) | 0;
+ var day = str.slice(6, 8) | 0;
+ var hour = str.slice(8, 10) | 0;
+ var min = str.slice(10, 12) | 0;
+ var sec = str.slice(12, 14) | 0;
+ } else if (tag === 'utctime') {
+ var year = str.slice(0, 2) | 0;
+ var mon = str.slice(2, 4) | 0;
+ var day = str.slice(4, 6) | 0;
+ var hour = str.slice(6, 8) | 0;
+ var min = str.slice(8, 10) | 0;
+ var sec = str.slice(10, 12) | 0;
+ if (year < 70)
+ year = 2000 + year;
+ else
+ year = 1900 + year;
+ } else {
+ return buffer.error('Decoding ' + tag + ' time is not supported yet');
+ }
+
+ return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
+};
+
+DERNode.prototype._decodeNull = function decodeNull(buffer) {
+ return null;
+};
+
+DERNode.prototype._decodeBool = function decodeBool(buffer) {
+ var res = buffer.readUInt8();
+ if (buffer.isError(res))
+ return res;
+ else
+ return res !== 0;
+};
+
+DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
+ // Bigint, return as it is (assume big endian)
+ var raw = buffer.raw();
+ var res = new bignum(raw);
+
+ if (values)
+ res = values[res.toString(10)] || res;
+
+ return res;
+};
+
+DERNode.prototype._use = function use(entity, obj) {
+ if (typeof entity === 'function')
+ entity = entity(obj);
+ return entity._getDecoder('der').tree;
+};
+
+// Utility methods
+
+function derDecodeTag(buf, fail) {
+ var tag = buf.readUInt8(fail);
+ if (buf.isError(tag))
+ return tag;
+
+ var cls = der.tagClass[tag >> 6];
+ var primitive = (tag & 0x20) === 0;
+
+ // Multi-octet tag - load
+ if ((tag & 0x1f) === 0x1f) {
+ var oct = tag;
+ tag = 0;
+ while ((oct & 0x80) === 0x80) {
+ oct = buf.readUInt8(fail);
+ if (buf.isError(oct))
+ return oct;
+
+ tag <<= 7;
+ tag |= oct & 0x7f;
+ }
+ } else {
+ tag &= 0x1f;
+ }
+ var tagStr = der.tag[tag];
+
+ return {
+ cls: cls,
+ primitive: primitive,
+ tag: tag,
+ tagStr: tagStr
+ };
+}
+
+function derDecodeLen(buf, primitive, fail) {
+ var len = buf.readUInt8(fail);
+ if (buf.isError(len))
+ return len;
+
+ // Indefinite form
+ if (!primitive && len === 0x80)
+ return null;
+
+ // Definite form
+ if ((len & 0x80) === 0) {
+ // Short form
+ return len;
+ }
+
+ // Long form
+ var num = len & 0x7f;
+ if (num > 4)
+ return buf.error('length octect is too long');
+
+ len = 0;
+ for (var i = 0; i < num; i++) {
+ len <<= 8;
+ var j = buf.readUInt8(fail);
+ if (buf.isError(j))
+ return j;
+ len |= j;
+ }
+
+ return len;
+}
+
+},{"../../asn1":14,"inherits":834}],23:[function(require,module,exports){
+var decoders = exports;
+
+decoders.der = require('./der');
+decoders.pem = require('./pem');
+
+},{"./der":22,"./pem":24}],24:[function(require,module,exports){
+var inherits = require('inherits');
+var Buffer = require('buffer').Buffer;
+
+var DERDecoder = require('./der');
+
+function PEMDecoder(entity) {
+ DERDecoder.call(this, entity);
+ this.enc = 'pem';
+};
+inherits(PEMDecoder, DERDecoder);
+module.exports = PEMDecoder;
+
+PEMDecoder.prototype.decode = function decode(data, options) {
+ var lines = data.toString().split(/[\r\n]+/g);
+
+ var label = options.label.toUpperCase();
+
+ var re = /^-----(BEGIN|END) ([^-]+)-----$/;
+ var start = -1;
+ var end = -1;
+ for (var i = 0; i < lines.length; i++) {
+ var match = lines[i].match(re);
+ if (match === null)
+ continue;
+
+ if (match[2] !== label)
+ continue;
+
+ if (start === -1) {
+ if (match[1] !== 'BEGIN')
+ break;
+ start = i;
+ } else {
+ if (match[1] !== 'END')
+ break;
+ end = i;
+ break;
+ }
+ }
+ if (start === -1 || end === -1)
+ throw new Error('PEM section not found for: ' + label);
+
+ var base64 = lines.slice(start + 1, end).join('');
+ // Remove excessive symbols
+ base64.replace(/[^a-z0-9\+\/=]+/gi, '');
+
+ var input = new Buffer(base64, 'base64');
+ return DERDecoder.prototype.decode.call(this, input, options);
+};
+
+},{"./der":22,"buffer":113,"inherits":834}],25:[function(require,module,exports){
+var inherits = require('inherits');
+var Buffer = require('buffer').Buffer;
+
+var asn1 = require('../../asn1');
+var base = asn1.base;
+
+// Import DER constants
+var der = asn1.constants.der;
+
+function DEREncoder(entity) {
+ this.enc = 'der';
+ this.name = entity.name;
+ this.entity = entity;
+
+ // Construct base tree
+ this.tree = new DERNode();
+ this.tree._init(entity.body);
+};
+module.exports = DEREncoder;
+
+DEREncoder.prototype.encode = function encode(data, reporter) {
+ return this.tree._encode(data, reporter).join();
+};
+
+// Tree methods
+
+function DERNode(parent) {
+ base.Node.call(this, 'der', parent);
+}
+inherits(DERNode, base.Node);
+
+DERNode.prototype._encodeComposite = function encodeComposite(tag,
+ primitive,
+ cls,
+ content) {
+ var encodedTag = encodeTag(tag, primitive, cls, this.reporter);
+
+ // Short form
+ if (content.length < 0x80) {
+ var header = new Buffer(2);
+ header[0] = encodedTag;
+ header[1] = content.length;
+ return this._createEncoderBuffer([ header, content ]);
+ }
+
+ // Long form
+ // Count octets required to store length
+ var lenOctets = 1;
+ for (var i = content.length; i >= 0x100; i >>= 8)
+ lenOctets++;
+
+ var header = new Buffer(1 + 1 + lenOctets);
+ header[0] = encodedTag;
+ header[1] = 0x80 | lenOctets;
+
+ for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
+ header[i] = j & 0xff;
+
+ return this._createEncoderBuffer([ header, content ]);
+};
+
+DERNode.prototype._encodeStr = function encodeStr(str, tag) {
+ if (tag === 'bitstr') {
+ return this._createEncoderBuffer([ str.unused | 0, str.data ]);
+ } else if (tag === 'bmpstr') {
+ var buf = new Buffer(str.length * 2);
+ for (var i = 0; i < str.length; i++) {
+ buf.writeUInt16BE(str.charCodeAt(i), i * 2);
+ }
+ return this._createEncoderBuffer(buf);
+ } else if (tag === 'numstr') {
+ if (!this._isNumstr(str)) {
+ return this.reporter.error('Encoding of string type: numstr supports ' +
+ 'only digits and space');
+ }
+ return this._createEncoderBuffer(str);
+ } else if (tag === 'printstr') {
+ if (!this._isPrintstr(str)) {
+ return this.reporter.error('Encoding of string type: printstr supports ' +
+ 'only latin upper and lower case letters, ' +
+ 'digits, space, apostrophe, left and rigth ' +
+ 'parenthesis, plus sign, comma, hyphen, ' +
+ 'dot, slash, colon, equal sign, ' +
+ 'question mark');
+ }
+ return this._createEncoderBuffer(str);
+ } else if (/str$/.test(tag)) {
+ return this._createEncoderBuffer(str);
+ } else if (tag === 'objDesc') {
+ return this._createEncoderBuffer(str);
+ } else {
+ return this.reporter.error('Encoding of string type: ' + tag +
+ ' unsupported');
+ }
+};
+
+DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
+ if (typeof id === 'string') {
+ if (!values)
+ return this.reporter.error('string objid given, but no values map found');
+ if (!values.hasOwnProperty(id))
+ return this.reporter.error('objid not found in values map');
+ id = values[id].split(/[\s\.]+/g);
+ for (var i = 0; i < id.length; i++)
+ id[i] |= 0;
+ } else if (Array.isArray(id)) {
+ id = id.slice();
+ for (var i = 0; i < id.length; i++)
+ id[i] |= 0;
+ }
+
+ if (!Array.isArray(id)) {
+ return this.reporter.error('objid() should be either array or string, ' +
+ 'got: ' + JSON.stringify(id));
+ }
+
+ if (!relative) {
+ if (id[1] >= 40)
+ return this.reporter.error('Second objid identifier OOB');
+ id.splice(0, 2, id[0] * 40 + id[1]);
+ }
+
+ // Count number of octets
+ var size = 0;
+ for (var i = 0; i < id.length; i++) {
+ var ident = id[i];
+ for (size++; ident >= 0x80; ident >>= 7)
+ size++;
+ }
+
+ var objid = new Buffer(size);
+ var offset = objid.length - 1;
+ for (var i = id.length - 1; i >= 0; i--) {
+ var ident = id[i];
+ objid[offset--] = ident & 0x7f;
+ while ((ident >>= 7) > 0)
+ objid[offset--] = 0x80 | (ident & 0x7f);
+ }
+
+ return this._createEncoderBuffer(objid);
+};
+
+function two(num) {
+ if (num < 10)
+ return '0' + num;
+ else
+ return num;
+}
+
+DERNode.prototype._encodeTime = function encodeTime(time, tag) {
+ var str;
+ var date = new Date(time);
+
+ if (tag === 'gentime') {
+ str = [
+ two(date.getFullYear()),
+ two(date.getUTCMonth() + 1),
+ two(date.getUTCDate()),
+ two(date.getUTCHours()),
+ two(date.getUTCMinutes()),
+ two(date.getUTCSeconds()),
+ 'Z'
+ ].join('');
+ } else if (tag === 'utctime') {
+ str = [
+ two(date.getFullYear() % 100),
+ two(date.getUTCMonth() + 1),
+ two(date.getUTCDate()),
+ two(date.getUTCHours()),
+ two(date.getUTCMinutes()),
+ two(date.getUTCSeconds()),
+ 'Z'
+ ].join('');
+ } else {
+ this.reporter.error('Encoding ' + tag + ' time is not supported yet');
+ }
+
+ return this._encodeStr(str, 'octstr');
+};
+
+DERNode.prototype._encodeNull = function encodeNull() {
+ return this._createEncoderBuffer('');
+};
+
+DERNode.prototype._encodeInt = function encodeInt(num, values) {
+ if (typeof num === 'string') {
+ if (!values)
+ return this.reporter.error('String int or enum given, but no values map');
+ if (!values.hasOwnProperty(num)) {
+ return this.reporter.error('Values map doesn\'t contain: ' +
+ JSON.stringify(num));
+ }
+ num = values[num];
+ }
+
+ // Bignum, assume big endian
+ if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
+ var numArray = num.toArray();
+ if (!num.sign && numArray[0] & 0x80) {
+ numArray.unshift(0);
+ }
+ num = new Buffer(numArray);
+ }
+
+ if (Buffer.isBuffer(num)) {
+ var size = num.length;
+ if (num.length === 0)
+ size++;
+
+ var out = new Buffer(size);
+ num.copy(out);
+ if (num.length === 0)
+ out[0] = 0
+ return this._createEncoderBuffer(out);
+ }
+
+ if (num < 0x80)
+ return this._createEncoderBuffer(num);
+
+ if (num < 0x100)
+ return this._createEncoderBuffer([0, num]);
+
+ var size = 1;
+ for (var i = num; i >= 0x100; i >>= 8)
+ size++;
+
+ var out = new Array(size);
+ for (var i = out.length - 1; i >= 0; i--) {
+ out[i] = num & 0xff;
+ num >>= 8;
+ }
+ if(out[0] & 0x80) {
+ out.unshift(0);
+ }
+
+ return this._createEncoderBuffer(new Buffer(out));
+};
+
+DERNode.prototype._encodeBool = function encodeBool(value) {
+ return this._createEncoderBuffer(value ? 0xff : 0);
+};
+
+DERNode.prototype._use = function use(entity, obj) {
+ if (typeof entity === 'function')
+ entity = entity(obj);
+ return entity._getEncoder('der').tree;
+};
+
+DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
+ var state = this._baseState;
+ var i;
+ if (state['default'] === null)
+ return false;
+
+ var data = dataBuffer.join();
+ if (state.defaultBuffer === undefined)
+ state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
+
+ if (data.length !== state.defaultBuffer.length)
+ return false;
+
+ for (i=0; i < data.length; i++)
+ if (data[i] !== state.defaultBuffer[i])
+ return false;
+
+ return true;
+};
+
+// Utility methods
+
+function encodeTag(tag, primitive, cls, reporter) {
+ var res;
+
+ if (tag === 'seqof')
+ tag = 'seq';
+ else if (tag === 'setof')
+ tag = 'set';
+
+ if (der.tagByName.hasOwnProperty(tag))
+ res = der.tagByName[tag];
+ else if (typeof tag === 'number' && (tag | 0) === tag)
+ res = tag;
+ else
+ return reporter.error('Unknown tag: ' + tag);
+
+ if (res >= 0x1f)
+ return reporter.error('Multi-octet tag encoding unsupported');
+
+ if (!primitive)
+ res |= 0x20;
+
+ res |= (der.tagClassByName[cls || 'universal'] << 6);
+
+ return res;
+}
+
+},{"../../asn1":14,"buffer":113,"inherits":834}],26:[function(require,module,exports){
+var encoders = exports;
+
+encoders.der = require('./der');
+encoders.pem = require('./pem');
+
+},{"./der":25,"./pem":27}],27:[function(require,module,exports){
+var inherits = require('inherits');
+
+var DEREncoder = require('./der');
+
+function PEMEncoder(entity) {
+ DEREncoder.call(this, entity);
+ this.enc = 'pem';
+};
+inherits(PEMEncoder, DEREncoder);
+module.exports = PEMEncoder;
+
+PEMEncoder.prototype.encode = function encode(data, options) {
+ var buf = DEREncoder.prototype.encode.call(this, data);
+
+ var p = buf.toString('base64');
+ var out = [ '-----BEGIN ' + options.label + '-----' ];
+ for (var i = 0; i < p.length; i += 64)
+ out.push(p.slice(i, i + 64));
+ out.push('-----END ' + options.label + '-----');
+ return out.join('\n');
+};
+
+},{"./der":25,"inherits":834}],28:[function(require,module,exports){
+// Copyright 2011 Mark Cavage All rights reserved.
+
+
+module.exports = {
+
+ newInvalidAsn1Error: function (msg) {
+ var e = new Error();
+ e.name = 'InvalidAsn1Error';
+ e.message = msg || '';
+ return e;
+ }
+
+};
+
+},{}],29:[function(require,module,exports){
+// Copyright 2011 Mark Cavage All rights reserved.
+
+var errors = require('./errors');
+var types = require('./types');
+
+var Reader = require('./reader');
+var Writer = require('./writer');
+
+
+// --- Exports
+
+module.exports = {
+
+ Reader: Reader,
+
+ Writer: Writer
+
+};
+
+for (var t in types) {
+ if (types.hasOwnProperty(t))
+ module.exports[t] = types[t];
+}
+for (var e in errors) {
+ if (errors.hasOwnProperty(e))
+ module.exports[e] = errors[e];
+}
+
+},{"./errors":28,"./reader":30,"./types":31,"./writer":32}],30:[function(require,module,exports){
+// Copyright 2011 Mark Cavage All rights reserved.
+
+var assert = require('assert');
+var Buffer = require('safer-buffer').Buffer;
+
+var ASN1 = require('./types');
+var errors = require('./errors');
+
+
+// --- Globals
+
+var newInvalidAsn1Error = errors.newInvalidAsn1Error;
+
+
+
+// --- API
+
+function Reader(data) {
+ if (!data || !Buffer.isBuffer(data))
+ throw new TypeError('data must be a node Buffer');
+
+ this._buf = data;
+ this._size = data.length;
+
+ // These hold the "current" state
+ this._len = 0;
+ this._offset = 0;
+}
+
+Object.defineProperty(Reader.prototype, 'length', {
+ enumerable: true,
+ get: function () { return (this._len); }
+});
+
+Object.defineProperty(Reader.prototype, 'offset', {
+ enumerable: true,
+ get: function () { return (this._offset); }
+});
+
+Object.defineProperty(Reader.prototype, 'remain', {
+ get: function () { return (this._size - this._offset); }
+});
+
+Object.defineProperty(Reader.prototype, 'buffer', {
+ get: function () { return (this._buf.slice(this._offset)); }
+});
+
+
+/**
+ * Reads a single byte and advances offset; you can pass in `true` to make this
+ * a "peek" operation (i.e., get the byte, but don't advance the offset).
+ *
+ * @param {Boolean} peek true means don't move offset.
+ * @return {Number} the next byte, null if not enough data.
+ */
+Reader.prototype.readByte = function (peek) {
+ if (this._size - this._offset < 1)
+ return null;
+
+ var b = this._buf[this._offset] & 0xff;
+
+ if (!peek)
+ this._offset += 1;
+
+ return b;
+};
+
+
+Reader.prototype.peek = function () {
+ return this.readByte(true);
+};
+
+
+/**
+ * Reads a (potentially) variable length off the BER buffer. This call is
+ * not really meant to be called directly, as callers have to manipulate
+ * the internal buffer afterwards.
+ *
+ * As a result of this call, you can call `Reader.length`, until the
+ * next thing called that does a readLength.
+ *
+ * @return {Number} the amount of offset to advance the buffer.
+ * @throws {InvalidAsn1Error} on bad ASN.1
+ */
+Reader.prototype.readLength = function (offset) {
+ if (offset === undefined)
+ offset = this._offset;
+
+ if (offset >= this._size)
+ return null;
+
+ var lenB = this._buf[offset++] & 0xff;
+ if (lenB === null)
+ return null;
+
+ if ((lenB & 0x80) === 0x80) {
+ lenB &= 0x7f;
+
+ if (lenB === 0)
+ throw newInvalidAsn1Error('Indefinite length not supported');
+
+ if (lenB > 4)
+ throw newInvalidAsn1Error('encoding too long');
+
+ if (this._size - offset < lenB)
+ return null;
+
+ this._len = 0;
+ for (var i = 0; i < lenB; i++)
+ this._len = (this._len << 8) + (this._buf[offset++] & 0xff);
+
+ } else {
+ // Wasn't a variable length
+ this._len = lenB;
+ }
+
+ return offset;
+};
+
+
+/**
+ * Parses the next sequence in this BER buffer.
+ *
+ * To get the length of the sequence, call `Reader.length`.
+ *
+ * @return {Number} the sequence's tag.
+ */
+Reader.prototype.readSequence = function (tag) {
+ var seq = this.peek();
+ if (seq === null)
+ return null;
+ if (tag !== undefined && tag !== seq)
+ throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+ ': got 0x' + seq.toString(16));
+
+ var o = this.readLength(this._offset + 1); // stored in `length`
+ if (o === null)
+ return null;
+
+ this._offset = o;
+ return seq;
+};
+
+
+Reader.prototype.readInt = function () {
+ return this._readTag(ASN1.Integer);
+};
+
+
+Reader.prototype.readBoolean = function () {
+ return (this._readTag(ASN1.Boolean) === 0 ? false : true);
+};
+
+
+Reader.prototype.readEnumeration = function () {
+ return this._readTag(ASN1.Enumeration);
+};
+
+
+Reader.prototype.readString = function (tag, retbuf) {
+ if (!tag)
+ tag = ASN1.OctetString;
+
+ var b = this.peek();
+ if (b === null)
+ return null;
+
+ if (b !== tag)
+ throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+ ': got 0x' + b.toString(16));
+
+ var o = this.readLength(this._offset + 1); // stored in `length`
+
+ if (o === null)
+ return null;
+
+ if (this.length > this._size - o)
+ return null;
+
+ this._offset = o;
+
+ if (this.length === 0)
+ return retbuf ? Buffer.alloc(0) : '';
+
+ var str = this._buf.slice(this._offset, this._offset + this.length);
+ this._offset += this.length;
+
+ return retbuf ? str : str.toString('utf8');
+};
+
+Reader.prototype.readOID = function (tag) {
+ if (!tag)
+ tag = ASN1.OID;
+
+ var b = this.readString(tag, true);
+ if (b === null)
+ return null;
+
+ var values = [];
+ var value = 0;
+
+ for (var i = 0; i < b.length; i++) {
+ var byte = b[i] & 0xff;
+
+ value <<= 7;
+ value += byte & 0x7f;
+ if ((byte & 0x80) === 0) {
+ values.push(value);
+ value = 0;
+ }
+ }
+
+ value = values.shift();
+ values.unshift(value % 40);
+ values.unshift((value / 40) >> 0);
+
+ return values.join('.');
+};
+
+
+Reader.prototype._readTag = function (tag) {
+ assert.ok(tag !== undefined);
+
+ var b = this.peek();
+
+ if (b === null)
+ return null;
+
+ if (b !== tag)
+ throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+ ': got 0x' + b.toString(16));
+
+ var o = this.readLength(this._offset + 1); // stored in `length`
+ if (o === null)
+ return null;
+
+ if (this.length > 4)
+ throw newInvalidAsn1Error('Integer too long: ' + this.length);
+
+ if (this.length > this._size - o)
+ return null;
+ this._offset = o;
+
+ var fb = this._buf[this._offset];
+ var value = 0;
+
+ for (var i = 0; i < this.length; i++) {
+ value <<= 8;
+ value |= (this._buf[this._offset++] & 0xff);
+ }
+
+ if ((fb & 0x80) === 0x80 && i !== 4)
+ value -= (1 << (i * 8));
+
+ return value >> 0;
+};
+
+
+
+// --- Exported API
+
+module.exports = Reader;
+
+},{"./errors":28,"./types":31,"assert":35,"safer-buffer":1335}],31:[function(require,module,exports){
+// Copyright 2011 Mark Cavage All rights reserved.
+
+
+module.exports = {
+ EOC: 0,
+ Boolean: 1,
+ Integer: 2,
+ BitString: 3,
+ OctetString: 4,
+ Null: 5,
+ OID: 6,
+ ObjectDescriptor: 7,
+ External: 8,
+ Real: 9, // float
+ Enumeration: 10,
+ PDV: 11,
+ Utf8String: 12,
+ RelativeOID: 13,
+ Sequence: 16,
+ Set: 17,
+ NumericString: 18,
+ PrintableString: 19,
+ T61String: 20,
+ VideotexString: 21,
+ IA5String: 22,
+ UTCTime: 23,
+ GeneralizedTime: 24,
+ GraphicString: 25,
+ VisibleString: 26,
+ GeneralString: 28,
+ UniversalString: 29,
+ CharacterString: 30,
+ BMPString: 31,
+ Constructor: 32,
+ Context: 128
+};
+
+},{}],32:[function(require,module,exports){
+// Copyright 2011 Mark Cavage All rights reserved.
+
+var assert = require('assert');
+var Buffer = require('safer-buffer').Buffer;
+var ASN1 = require('./types');
+var errors = require('./errors');
+
+
+// --- Globals
+
+var newInvalidAsn1Error = errors.newInvalidAsn1Error;
+
+var DEFAULT_OPTS = {
+ size: 1024,
+ growthFactor: 8
+};
+
+
+// --- Helpers
+
+function merge(from, to) {
+ assert.ok(from);
+ assert.equal(typeof (from), 'object');
+ assert.ok(to);
+ assert.equal(typeof (to), 'object');
+
+ var keys = Object.getOwnPropertyNames(from);
+ keys.forEach(function (key) {
+ if (to[key])
+ return;
+
+ var value = Object.getOwnPropertyDescriptor(from, key);
+ Object.defineProperty(to, key, value);
+ });
+
+ return to;
+}
+
+
+
+// --- API
+
+function Writer(options) {
+ options = merge(DEFAULT_OPTS, options || {});
+
+ this._buf = Buffer.alloc(options.size || 1024);
+ this._size = this._buf.length;
+ this._offset = 0;
+ this._options = options;
+
+ // A list of offsets in the buffer where we need to insert
+ // sequence tag/len pairs.
+ this._seq = [];
+}
+
+Object.defineProperty(Writer.prototype, 'buffer', {
+ get: function () {
+ if (this._seq.length)
+ throw newInvalidAsn1Error(this._seq.length + ' unended sequence(s)');
+
+ return (this._buf.slice(0, this._offset));
+ }
+});
+
+Writer.prototype.writeByte = function (b) {
+ if (typeof (b) !== 'number')
+ throw new TypeError('argument must be a Number');
+
+ this._ensure(1);
+ this._buf[this._offset++] = b;
+};
+
+
+Writer.prototype.writeInt = function (i, tag) {
+ if (typeof (i) !== 'number')
+ throw new TypeError('argument must be a Number');
+ if (typeof (tag) !== 'number')
+ tag = ASN1.Integer;
+
+ var sz = 4;
+
+ while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000 >> 0)) &&
+ (sz > 1)) {
+ sz--;
+ i <<= 8;
+ }
+
+ if (sz > 4)
+ throw newInvalidAsn1Error('BER ints cannot be > 0xffffffff');
+
+ this._ensure(2 + sz);
+ this._buf[this._offset++] = tag;
+ this._buf[this._offset++] = sz;
+
+ while (sz-- > 0) {
+ this._buf[this._offset++] = ((i & 0xff000000) >>> 24);
+ i <<= 8;
+ }
+
+};
+
+
+Writer.prototype.writeNull = function () {
+ this.writeByte(ASN1.Null);
+ this.writeByte(0x00);
+};
+
+
+Writer.prototype.writeEnumeration = function (i, tag) {
+ if (typeof (i) !== 'number')
+ throw new TypeError('argument must be a Number');
+ if (typeof (tag) !== 'number')
+ tag = ASN1.Enumeration;
+
+ return this.writeInt(i, tag);
+};
+
+
+Writer.prototype.writeBoolean = function (b, tag) {
+ if (typeof (b) !== 'boolean')
+ throw new TypeError('argument must be a Boolean');
+ if (typeof (tag) !== 'number')
+ tag = ASN1.Boolean;
+
+ this._ensure(3);
+ this._buf[this._offset++] = tag;
+ this._buf[this._offset++] = 0x01;
+ this._buf[this._offset++] = b ? 0xff : 0x00;
+};
+
+
+Writer.prototype.writeString = function (s, tag) {
+ if (typeof (s) !== 'string')
+ throw new TypeError('argument must be a string (was: ' + typeof (s) + ')');
+ if (typeof (tag) !== 'number')
+ tag = ASN1.OctetString;
+
+ var len = Buffer.byteLength(s);
+ this.writeByte(tag);
+ this.writeLength(len);
+ if (len) {
+ this._ensure(len);
+ this._buf.write(s, this._offset);
+ this._offset += len;
+ }
+};
+
+
+Writer.prototype.writeBuffer = function (buf, tag) {
+ if (typeof (tag) !== 'number')
+ throw new TypeError('tag must be a number');
+ if (!Buffer.isBuffer(buf))
+ throw new TypeError('argument must be a buffer');
+
+ this.writeByte(tag);
+ this.writeLength(buf.length);
+ this._ensure(buf.length);
+ buf.copy(this._buf, this._offset, 0, buf.length);
+ this._offset += buf.length;
+};
+
+
+Writer.prototype.writeStringArray = function (strings) {
+ if ((!strings instanceof Array))
+ throw new TypeError('argument must be an Array[String]');
+
+ var self = this;
+ strings.forEach(function (s) {
+ self.writeString(s);
+ });
+};
+
+// This is really to solve DER cases, but whatever for now
+Writer.prototype.writeOID = function (s, tag) {
+ if (typeof (s) !== 'string')
+ throw new TypeError('argument must be a string');
+ if (typeof (tag) !== 'number')
+ tag = ASN1.OID;
+
+ if (!/^([0-9]+\.){3,}[0-9]+$/.test(s))
+ throw new Error('argument is not a valid OID string');
+
+ function encodeOctet(bytes, octet) {
+ if (octet < 128) {
+ bytes.push(octet);
+ } else if (octet < 16384) {
+ bytes.push((octet >>> 7) | 0x80);
+ bytes.push(octet & 0x7F);
+ } else if (octet < 2097152) {
+ bytes.push((octet >>> 14) | 0x80);
+ bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+ bytes.push(octet & 0x7F);
+ } else if (octet < 268435456) {
+ bytes.push((octet >>> 21) | 0x80);
+ bytes.push(((octet >>> 14) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+ bytes.push(octet & 0x7F);
+ } else {
+ bytes.push(((octet >>> 28) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 21) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 14) | 0x80) & 0xFF);
+ bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+ bytes.push(octet & 0x7F);
+ }
+ }
+
+ var tmp = s.split('.');
+ var bytes = [];
+ bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10));
+ tmp.slice(2).forEach(function (b) {
+ encodeOctet(bytes, parseInt(b, 10));
+ });
+
+ var self = this;
+ this._ensure(2 + bytes.length);
+ this.writeByte(tag);
+ this.writeLength(bytes.length);
+ bytes.forEach(function (b) {
+ self.writeByte(b);
+ });
+};
+
+
+Writer.prototype.writeLength = function (len) {
+ if (typeof (len) !== 'number')
+ throw new TypeError('argument must be a Number');
+
+ this._ensure(4);
+
+ if (len <= 0x7f) {
+ this._buf[this._offset++] = len;
+ } else if (len <= 0xff) {
+ this._buf[this._offset++] = 0x81;
+ this._buf[this._offset++] = len;
+ } else if (len <= 0xffff) {
+ this._buf[this._offset++] = 0x82;
+ this._buf[this._offset++] = len >> 8;
+ this._buf[this._offset++] = len;
+ } else if (len <= 0xffffff) {
+ this._buf[this._offset++] = 0x83;
+ this._buf[this._offset++] = len >> 16;
+ this._buf[this._offset++] = len >> 8;
+ this._buf[this._offset++] = len;
+ } else {
+ throw newInvalidAsn1Error('Length too long (> 4 bytes)');
+ }
+};
+
+Writer.prototype.startSequence = function (tag) {
+ if (typeof (tag) !== 'number')
+ tag = ASN1.Sequence | ASN1.Constructor;
+
+ this.writeByte(tag);
+ this._seq.push(this._offset);
+ this._ensure(3);
+ this._offset += 3;
+};
+
+
+Writer.prototype.endSequence = function () {
+ var seq = this._seq.pop();
+ var start = seq + 3;
+ var len = this._offset - start;
+
+ if (len <= 0x7f) {
+ this._shift(start, len, -2);
+ this._buf[seq] = len;
+ } else if (len <= 0xff) {
+ this._shift(start, len, -1);
+ this._buf[seq] = 0x81;
+ this._buf[seq + 1] = len;
+ } else if (len <= 0xffff) {
+ this._buf[seq] = 0x82;
+ this._buf[seq + 1] = len >> 8;
+ this._buf[seq + 2] = len;
+ } else if (len <= 0xffffff) {
+ this._shift(start, len, 1);
+ this._buf[seq] = 0x83;
+ this._buf[seq + 1] = len >> 16;
+ this._buf[seq + 2] = len >> 8;
+ this._buf[seq + 3] = len;
+ } else {
+ throw newInvalidAsn1Error('Sequence too long');
+ }
+};
+
+
+Writer.prototype._shift = function (start, len, shift) {
+ assert.ok(start !== undefined);
+ assert.ok(len !== undefined);
+ assert.ok(shift);
+
+ this._buf.copy(this._buf, start + shift, start, start + len);
+ this._offset += shift;
+};
+
+Writer.prototype._ensure = function (len) {
+ assert.ok(len);
+
+ if (this._size - this._offset < len) {
+ var sz = this._size * this._options.growthFactor;
+ if (sz - this._offset < len)
+ sz += len;
+
+ var buf = Buffer.alloc(sz);
+
+ this._buf.copy(buf, 0, 0, this._offset);
+ this._buf = buf;
+ this._size = sz;
+ }
+};
+
+
+
+// --- Exported API
+
+module.exports = Writer;
+
+},{"./errors":28,"./types":31,"assert":35,"safer-buffer":1335}],33:[function(require,module,exports){
+// Copyright 2011 Mark Cavage All rights reserved.
+
+// If you have no idea what ASN.1 or BER is, see this:
+// ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
+
+var Ber = require('./ber/index');
+
+
+
+// --- Exported API
+
+module.exports = {
+
+ Ber: Ber,
+
+ BerReader: Ber.Reader,
+
+ BerWriter: Ber.Writer
+
+};
+
+},{"./ber/index":29}],34:[function(require,module,exports){
+(function (Buffer,process){
+// Copyright (c) 2012, Mark Cavage. All rights reserved.
+// Copyright 2015 Joyent, Inc.
+
+var assert = require('assert');
+var Stream = require('stream').Stream;
+var util = require('util');
+
+
+///--- Globals
+
+/* JSSTYLED */
+var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
+
+
+///--- Internal
+
+function _capitalize(str) {
+ return (str.charAt(0).toUpperCase() + str.slice(1));
+}
+
+function _toss(name, expected, oper, arg, actual) {
+ throw new assert.AssertionError({
+ message: util.format('%s (%s) is required', name, expected),
+ actual: (actual === undefined) ? typeof (arg) : actual(arg),
+ expected: expected,
+ operator: oper || '===',
+ stackStartFunction: _toss.caller
+ });
+}
+
+function _getClass(arg) {
+ return (Object.prototype.toString.call(arg).slice(8, -1));
+}
+
+function noop() {
+ // Why even bother with asserts?
+}
+
+
+///--- Exports
+
+var types = {
+ bool: {
+ check: function (arg) { return typeof (arg) === 'boolean'; }
+ },
+ func: {
+ check: function (arg) { return typeof (arg) === 'function'; }
+ },
+ string: {
+ check: function (arg) { return typeof (arg) === 'string'; }
+ },
+ object: {
+ check: function (arg) {
+ return typeof (arg) === 'object' && arg !== null;
+ }
+ },
+ number: {
+ check: function (arg) {
+ return typeof (arg) === 'number' && !isNaN(arg);
+ }
+ },
+ finite: {
+ check: function (arg) {
+ return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg);
+ }
+ },
+ buffer: {
+ check: function (arg) { return Buffer.isBuffer(arg); },
+ operator: 'Buffer.isBuffer'
+ },
+ array: {
+ check: function (arg) { return Array.isArray(arg); },
+ operator: 'Array.isArray'
+ },
+ stream: {
+ check: function (arg) { return arg instanceof Stream; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ date: {
+ check: function (arg) { return arg instanceof Date; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ regexp: {
+ check: function (arg) { return arg instanceof RegExp; },
+ operator: 'instanceof',
+ actual: _getClass
+ },
+ uuid: {
+ check: function (arg) {
+ return typeof (arg) === 'string' && UUID_REGEXP.test(arg);
+ },
+ operator: 'isUUID'
+ }
+};
+
+function _setExports(ndebug) {
+ var keys = Object.keys(types);
+ var out;
+
+ /* re-export standard assert */
+ if (process.env.NODE_NDEBUG) {
+ out = noop;
+ } else {
+ out = function (arg, msg) {
+ if (!arg) {
+ _toss(msg, 'true', arg);
+ }
+ };
+ }
+
+ /* standard checks */
+ keys.forEach(function (k) {
+ if (ndebug) {
+ out[k] = noop;
+ return;
+ }
+ var type = types[k];
+ out[k] = function (arg, msg) {
+ if (!type.check(arg)) {
+ _toss(msg, k, type.operator, arg, type.actual);
+ }
+ };
+ });
+
+ /* optional checks */
+ keys.forEach(function (k) {
+ var name = 'optional' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ out[name] = function (arg, msg) {
+ if (arg === undefined || arg === null) {
+ return;
+ }
+ if (!type.check(arg)) {
+ _toss(msg, k, type.operator, arg, type.actual);
+ }
+ };
+ });
+
+ /* arrayOf checks */
+ keys.forEach(function (k) {
+ var name = 'arrayOf' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ var expected = '[' + k + ']';
+ out[name] = function (arg, msg) {
+ if (!Array.isArray(arg)) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ var i;
+ for (i = 0; i < arg.length; i++) {
+ if (!type.check(arg[i])) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ }
+ };
+ });
+
+ /* optionalArrayOf checks */
+ keys.forEach(function (k) {
+ var name = 'optionalArrayOf' + _capitalize(k);
+ if (ndebug) {
+ out[name] = noop;
+ return;
+ }
+ var type = types[k];
+ var expected = '[' + k + ']';
+ out[name] = function (arg, msg) {
+ if (arg === undefined || arg === null) {
+ return;
+ }
+ if (!Array.isArray(arg)) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ var i;
+ for (i = 0; i < arg.length; i++) {
+ if (!type.check(arg[i])) {
+ _toss(msg, expected, type.operator, arg, type.actual);
+ }
+ }
+ };
+ });
+
+ /* re-export built-in assertions */
+ Object.keys(assert).forEach(function (k) {
+ if (k === 'AssertionError') {
+ out[k] = assert[k];
+ return;
+ }
+ if (ndebug) {
+ out[k] = noop;
+ return;
+ }
+ out[k] = assert[k];
+ });
+
+ /* export ourselves (for unit tests _only_) */
+ out._setExports = _setExports;
+
+ return out;
+}
+
+module.exports = _setExports(process.env.NODE_NDEBUG);
+
+}).call(this,{"isBuffer":require("../is-buffer/index.js")},require('_process'))
+},{"../is-buffer/index.js":839,"_process":109,"assert":35,"stream":1394,"util":1439}],35:[function(require,module,exports){
+(function (global){
+'use strict';
+
+// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
+// original notice:
+
+/*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ */
+function compare(a, b) {
+ if (a === b) {
+ return 0;
+ }
+
+ var x = a.length;
+ var y = b.length;
+
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
+ if (a[i] !== b[i]) {
+ x = a[i];
+ y = b[i];
+ break;
+ }
+ }
+
+ if (x < y) {
+ return -1;
+ }
+ if (y < x) {
+ return 1;
+ }
+ return 0;
+}
+function isBuffer(b) {
+ if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
+ return global.Buffer.isBuffer(b);
+ }
+ return !!(b != null && b._isBuffer);
+}
+
+// based on node assert, original notice:
+
+// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
+//
+// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
+//
+// Originally from narwhal.js (http://narwhaljs.org)
+// Copyright (c) 2009 Thomas Robinson <280north.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the 'Software'), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var util = require('util/');
+var hasOwn = Object.prototype.hasOwnProperty;
+var pSlice = Array.prototype.slice;
+var functionsHaveNames = (function () {
+ return function foo() {}.name === 'foo';
+}());
+function pToString (obj) {
+ return Object.prototype.toString.call(obj);
+}
+function isView(arrbuf) {
+ if (isBuffer(arrbuf)) {
+ return false;
+ }
+ if (typeof global.ArrayBuffer !== 'function') {
+ return false;
+ }
+ if (typeof ArrayBuffer.isView === 'function') {
+ return ArrayBuffer.isView(arrbuf);
+ }
+ if (!arrbuf) {
+ return false;
+ }
+ if (arrbuf instanceof DataView) {
+ return true;
+ }
+ if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
+ return true;
+ }
+ return false;
+}
+// 1. The assert module provides functions that throw
+// AssertionError's when particular conditions are not met. The
+// assert module must conform to the following interface.
+
+var assert = module.exports = ok;
+
+// 2. The AssertionError is defined in assert.
+// new assert.AssertionError({ message: message,
+// actual: actual,
+// expected: expected })
+
+var regex = /\s*function\s+([^\(\s]*)\s*/;
+// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
+function getName(func) {
+ if (!util.isFunction(func)) {
+ return;
+ }
+ if (functionsHaveNames) {
+ return func.name;
+ }
+ var str = func.toString();
+ var match = str.match(regex);
+ return match && match[1];
+}
+assert.AssertionError = function AssertionError(options) {
+ this.name = 'AssertionError';
+ this.actual = options.actual;
+ this.expected = options.expected;
+ this.operator = options.operator;
+ if (options.message) {
+ this.message = options.message;
+ this.generatedMessage = false;
+ } else {
+ this.message = getMessage(this);
+ this.generatedMessage = true;
+ }
+ var stackStartFunction = options.stackStartFunction || fail;
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, stackStartFunction);
+ } else {
+ // non v8 browsers so we can have a stacktrace
+ var err = new Error();
+ if (err.stack) {
+ var out = err.stack;
+
+ // try to strip useless frames
+ var fn_name = getName(stackStartFunction);
+ var idx = out.indexOf('\n' + fn_name);
+ if (idx >= 0) {
+ // once we have located the function frame
+ // we need to strip out everything before it (and its line)
+ var next_line = out.indexOf('\n', idx + 1);
+ out = out.substring(next_line + 1);
+ }
+
+ this.stack = out;
+ }
+ }
+};
+
+// assert.AssertionError instanceof Error
+util.inherits(assert.AssertionError, Error);
+
+function truncate(s, n) {
+ if (typeof s === 'string') {
+ return s.length < n ? s : s.slice(0, n);
+ } else {
+ return s;
+ }
+}
+function inspect(something) {
+ if (functionsHaveNames || !util.isFunction(something)) {
+ return util.inspect(something);
+ }
+ var rawname = getName(something);
+ var name = rawname ? ': ' + rawname : '';
+ return '[Function' + name + ']';
+}
+function getMessage(self) {
+ return truncate(inspect(self.actual), 128) + ' ' +
+ self.operator + ' ' +
+ truncate(inspect(self.expected), 128);
+}
+
+// At present only the three keys mentioned above are used and
+// understood by the spec. Implementations or sub modules can pass
+// other keys to the AssertionError's constructor - they will be
+// ignored.
+
+// 3. All of the following functions must throw an AssertionError
+// when a corresponding condition is not met, with a message that
+// may be undefined if not provided. All assertion methods provide
+// both the actual and expected values to the assertion error for
+// display purposes.
+
+function fail(actual, expected, message, operator, stackStartFunction) {
+ throw new assert.AssertionError({
+ message: message,
+ actual: actual,
+ expected: expected,
+ operator: operator,
+ stackStartFunction: stackStartFunction
+ });
+}
+
+// EXTENSION! allows for well behaved errors defined elsewhere.
+assert.fail = fail;
+
+// 4. Pure assertion tests whether a value is truthy, as determined
+// by !!guard.
+// assert.ok(guard, message_opt);
+// This statement is equivalent to assert.equal(true, !!guard,
+// message_opt);. To test strictly for the value true, use
+// assert.strictEqual(true, guard, message_opt);.
+
+function ok(value, message) {
+ if (!value) fail(value, true, message, '==', assert.ok);
+}
+assert.ok = ok;
+
+// 5. The equality assertion tests shallow, coercive equality with
+// ==.
+// assert.equal(actual, expected, message_opt);
+
+assert.equal = function equal(actual, expected, message) {
+ if (actual != expected) fail(actual, expected, message, '==', assert.equal);
+};
+
+// 6. The non-equality assertion tests for whether two objects are not equal
+// with != assert.notEqual(actual, expected, message_opt);
+
+assert.notEqual = function notEqual(actual, expected, message) {
+ if (actual == expected) {
+ fail(actual, expected, message, '!=', assert.notEqual);
+ }
+};
+
+// 7. The equivalence assertion tests a deep equality relation.
+// assert.deepEqual(actual, expected, message_opt);
+
+assert.deepEqual = function deepEqual(actual, expected, message) {
+ if (!_deepEqual(actual, expected, false)) {
+ fail(actual, expected, message, 'deepEqual', assert.deepEqual);
+ }
+};
+
+assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
+ if (!_deepEqual(actual, expected, true)) {
+ fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
+ }
+};
+
+function _deepEqual(actual, expected, strict, memos) {
+ // 7.1. All identical values are equivalent, as determined by ===.
+ if (actual === expected) {
+ return true;
+ } else if (isBuffer(actual) && isBuffer(expected)) {
+ return compare(actual, expected) === 0;
+
+ // 7.2. If the expected value is a Date object, the actual value is
+ // equivalent if it is also a Date object that refers to the same time.
+ } else if (util.isDate(actual) && util.isDate(expected)) {
+ return actual.getTime() === expected.getTime();
+
+ // 7.3 If the expected value is a RegExp object, the actual value is
+ // equivalent if it is also a RegExp object with the same source and
+ // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
+ } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
+ return actual.source === expected.source &&
+ actual.global === expected.global &&
+ actual.multiline === expected.multiline &&
+ actual.lastIndex === expected.lastIndex &&
+ actual.ignoreCase === expected.ignoreCase;
+
+ // 7.4. Other pairs that do not both pass typeof value == 'object',
+ // equivalence is determined by ==.
+ } else if ((actual === null || typeof actual !== 'object') &&
+ (expected === null || typeof expected !== 'object')) {
+ return strict ? actual === expected : actual == expected;
+
+ // If both values are instances of typed arrays, wrap their underlying
+ // ArrayBuffers in a Buffer each to increase performance
+ // This optimization requires the arrays to have the same type as checked by
+ // Object.prototype.toString (aka pToString). Never perform binary
+ // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
+ // bit patterns are not identical.
+ } else if (isView(actual) && isView(expected) &&
+ pToString(actual) === pToString(expected) &&
+ !(actual instanceof Float32Array ||
+ actual instanceof Float64Array)) {
+ return compare(new Uint8Array(actual.buffer),
+ new Uint8Array(expected.buffer)) === 0;
+
+ // 7.5 For all other Object pairs, including Array objects, equivalence is
+ // determined by having the same number of owned properties (as verified
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
+ // (although not necessarily the same order), equivalent values for every
+ // corresponding key, and an identical 'prototype' property. Note: this
+ // accounts for both named and indexed properties on Arrays.
+ } else if (isBuffer(actual) !== isBuffer(expected)) {
+ return false;
+ } else {
+ memos = memos || {actual: [], expected: []};
+
+ var actualIndex = memos.actual.indexOf(actual);
+ if (actualIndex !== -1) {
+ if (actualIndex === memos.expected.indexOf(expected)) {
+ return true;
+ }
+ }
+
+ memos.actual.push(actual);
+ memos.expected.push(expected);
+
+ return objEquiv(actual, expected, strict, memos);
+ }
+}
+
+function isArguments(object) {
+ return Object.prototype.toString.call(object) == '[object Arguments]';
+}
+
+function objEquiv(a, b, strict, actualVisitedObjects) {
+ if (a === null || a === undefined || b === null || b === undefined)
+ return false;
+ // if one is a primitive, the other must be same
+ if (util.isPrimitive(a) || util.isPrimitive(b))
+ return a === b;
+ if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
+ return false;
+ var aIsArgs = isArguments(a);
+ var bIsArgs = isArguments(b);
+ if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
+ return false;
+ if (aIsArgs) {
+ a = pSlice.call(a);
+ b = pSlice.call(b);
+ return _deepEqual(a, b, strict);
+ }
+ var ka = objectKeys(a);
+ var kb = objectKeys(b);
+ var key, i;
+ // having the same number of owned properties (keys incorporates
+ // hasOwnProperty)
+ if (ka.length !== kb.length)
+ return false;
+ //the same set of keys (although not necessarily the same order),
+ ka.sort();
+ kb.sort();
+ //~~~cheap key test
+ for (i = ka.length - 1; i >= 0; i--) {
+ if (ka[i] !== kb[i])
+ return false;
+ }
+ //equivalent values for every corresponding key, and
+ //~~~possibly expensive deep test
+ for (i = ka.length - 1; i >= 0; i--) {
+ key = ka[i];
+ if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
+ return false;
+ }
+ return true;
+}
+
+// 8. The non-equivalence assertion tests for any deep inequality.
+// assert.notDeepEqual(actual, expected, message_opt);
+
+assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
+ if (_deepEqual(actual, expected, false)) {
+ fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
+ }
+};
+
+assert.notDeepStrictEqual = notDeepStrictEqual;
+function notDeepStrictEqual(actual, expected, message) {
+ if (_deepEqual(actual, expected, true)) {
+ fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
+ }
+}
+
+
+// 9. The strict equality assertion tests strict equality, as determined by ===.
+// assert.strictEqual(actual, expected, message_opt);
+
+assert.strictEqual = function strictEqual(actual, expected, message) {
+ if (actual !== expected) {
+ fail(actual, expected, message, '===', assert.strictEqual);
+ }
+};
+
+// 10. The strict non-equality assertion tests for strict inequality, as
+// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
+
+assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
+ if (actual === expected) {
+ fail(actual, expected, message, '!==', assert.notStrictEqual);
+ }
+};
+
+function expectedException(actual, expected) {
+ if (!actual || !expected) {
+ return false;
+ }
+
+ if (Object.prototype.toString.call(expected) == '[object RegExp]') {
+ return expected.test(actual);
+ }
+
+ try {
+ if (actual instanceof expected) {
+ return true;
+ }
+ } catch (e) {
+ // Ignore. The instanceof check doesn't work for arrow functions.
+ }
+
+ if (Error.isPrototypeOf(expected)) {
+ return false;
+ }
+
+ return expected.call({}, actual) === true;
+}
+
+function _tryBlock(block) {
+ var error;
+ try {
+ block();
+ } catch (e) {
+ error = e;
+ }
+ return error;
+}
+
+function _throws(shouldThrow, block, expected, message) {
+ var actual;
+
+ if (typeof block !== 'function') {
+ throw new TypeError('"block" argument must be a function');
+ }
+
+ if (typeof expected === 'string') {
+ message = expected;
+ expected = null;
+ }
+
+ actual = _tryBlock(block);
+
+ message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
+ (message ? ' ' + message : '.');
+
+ if (shouldThrow && !actual) {
+ fail(actual, expected, 'Missing expected exception' + message);
+ }
+
+ var userProvidedMessage = typeof message === 'string';
+ var isUnwantedException = !shouldThrow && util.isError(actual);
+ var isUnexpectedException = !shouldThrow && actual && !expected;
+
+ if ((isUnwantedException &&
+ userProvidedMessage &&
+ expectedException(actual, expected)) ||
+ isUnexpectedException) {
+ fail(actual, expected, 'Got unwanted exception' + message);
+ }
+
+ if ((shouldThrow && actual && expected &&
+ !expectedException(actual, expected)) || (!shouldThrow && actual)) {
+ throw actual;
+ }
+}
+
+// 11. Expected to throw an error:
+// assert.throws(block, Error_opt, message_opt);
+
+assert.throws = function(block, /*optional*/error, /*optional*/message) {
+ _throws(true, block, error, message);
+};
+
+// EXTENSION! This is annoying to write outside this module.
+assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
+ _throws(false, block, error, message);
+};
+
+assert.ifError = function(err) { if (err) throw err; };
+
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) {
+ if (hasOwn.call(obj, key)) keys.push(key);
+ }
+ return keys;
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"util/":38}],36:[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
+ }
+}
+
+},{}],37:[function(require,module,exports){
+module.exports = function isBuffer(arg) {
+ return arg && typeof arg === 'object'
+ && typeof arg.copy === 'function'
+ && typeof arg.fill === 'function'
+ && typeof arg.readUInt8 === 'function';
+}
+},{}],38:[function(require,module,exports){
+(function (process,global){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var formatRegExp = /%[sdj%]/g;
+exports.format = function(f) {
+ if (!isString(f)) {
+ var objects = [];
+ for (var i = 0; i < arguments.length; i++) {
+ objects.push(inspect(arguments[i]));
+ }
+ return objects.join(' ');
+ }
+
+ var i = 1;
+ var args = arguments;
+ var len = args.length;
+ var str = String(f).replace(formatRegExp, function(x) {
+ if (x === '%%') return '%';
+ if (i >= len) return x;
+ switch (x) {
+ case '%s': return String(args[i++]);
+ case '%d': return Number(args[i++]);
+ case '%j':
+ try {
+ return JSON.stringify(args[i++]);
+ } catch (_) {
+ return '[Circular]';
+ }
+ default:
+ return x;
+ }
+ });
+ for (var x = args[i]; i < len; x = args[++i]) {
+ if (isNull(x) || !isObject(x)) {
+ str += ' ' + x;
+ } else {
+ str += ' ' + inspect(x);
+ }
+ }
+ return str;
+};
+
+
+// Mark that a method should not be used.
+// Returns a modified function which warns once by default.
+// If --no-deprecation is set, then it is a no-op.
+exports.deprecate = function(fn, msg) {
+ // Allow for deprecating things in the process of starting up.
+ if (isUndefined(global.process)) {
+ return function() {
+ return exports.deprecate(fn, msg).apply(this, arguments);
+ };
+ }
+
+ if (process.noDeprecation === true) {
+ return fn;
+ }
+
+ var warned = false;
+ function deprecated() {
+ if (!warned) {
+ if (process.throwDeprecation) {
+ throw new Error(msg);
+ } else if (process.traceDeprecation) {
+ console.trace(msg);
+ } else {
+ console.error(msg);
+ }
+ warned = true;
+ }
+ return fn.apply(this, arguments);
+ }
+
+ return deprecated;
+};
+
+
+var debugs = {};
+var debugEnviron;
+exports.debuglog = function(set) {
+ if (isUndefined(debugEnviron))
+ debugEnviron = process.env.NODE_DEBUG || '';
+ set = set.toUpperCase();
+ if (!debugs[set]) {
+ if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
+ var pid = process.pid;
+ debugs[set] = function() {
+ var msg = exports.format.apply(exports, arguments);
+ console.error('%s %d: %s', set, pid, msg);
+ };
+ } else {
+ debugs[set] = function() {};
+ }
+ }
+ return debugs[set];
+};
+
+
+/**
+ * Echos the value of a value. Trys to print the value out
+ * in the best way possible given the different types.
+ *
+ * @param {Object} obj The object to print out.
+ * @param {Object} opts Optional options object that alters the output.
+ */
+/* legacy: obj, showHidden, depth, colors*/
+function inspect(obj, opts) {
+ // default options
+ var ctx = {
+ seen: [],
+ stylize: stylizeNoColor
+ };
+ // legacy...
+ if (arguments.length >= 3) ctx.depth = arguments[2];
+ if (arguments.length >= 4) ctx.colors = arguments[3];
+ if (isBoolean(opts)) {
+ // legacy...
+ ctx.showHidden = opts;
+ } else if (opts) {
+ // got an "options" object
+ exports._extend(ctx, opts);
+ }
+ // set default options
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
+ if (isUndefined(ctx.colors)) ctx.colors = false;
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
+ return formatValue(ctx, obj, ctx.depth);
+}
+exports.inspect = inspect;
+
+
+// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
+inspect.colors = {
+ 'bold' : [1, 22],
+ 'italic' : [3, 23],
+ 'underline' : [4, 24],
+ 'inverse' : [7, 27],
+ 'white' : [37, 39],
+ 'grey' : [90, 39],
+ 'black' : [30, 39],
+ 'blue' : [34, 39],
+ 'cyan' : [36, 39],
+ 'green' : [32, 39],
+ 'magenta' : [35, 39],
+ 'red' : [31, 39],
+ 'yellow' : [33, 39]
+};
+
+// Don't use 'blue' not visible on cmd.exe
+inspect.styles = {
+ 'special': 'cyan',
+ 'number': 'yellow',
+ 'boolean': 'yellow',
+ 'undefined': 'grey',
+ 'null': 'bold',
+ 'string': 'green',
+ 'date': 'magenta',
+ // "name": intentionally not styling
+ 'regexp': 'red'
+};
+
+
+function stylizeWithColor(str, styleType) {
+ var style = inspect.styles[styleType];
+
+ if (style) {
+ return '\u001b[' + inspect.colors[style][0] + 'm' + str +
+ '\u001b[' + inspect.colors[style][1] + 'm';
+ } else {
+ return str;
+ }
+}
+
+
+function stylizeNoColor(str, styleType) {
+ return str;
+}
+
+
+function arrayToHash(array) {
+ var hash = {};
+
+ array.forEach(function(val, idx) {
+ hash[val] = true;
+ });
+
+ return hash;
+}
+
+
+function formatValue(ctx, value, recurseTimes) {
+ // Provide a hook for user-specified inspect functions.
+ // Check that value is an object with an inspect function on it
+ if (ctx.customInspect &&
+ value &&
+ isFunction(value.inspect) &&
+ // Filter out the util module, it's inspect function is special
+ value.inspect !== exports.inspect &&
+ // Also filter out any prototype objects using the circular check.
+ !(value.constructor && value.constructor.prototype === value)) {
+ var ret = value.inspect(recurseTimes, ctx);
+ if (!isString(ret)) {
+ ret = formatValue(ctx, ret, recurseTimes);
+ }
+ return ret;
+ }
+
+ // Primitive types cannot have properties
+ var primitive = formatPrimitive(ctx, value);
+ if (primitive) {
+ return primitive;
+ }
+
+ // Look up the keys of the object.
+ var keys = Object.keys(value);
+ var visibleKeys = arrayToHash(keys);
+
+ if (ctx.showHidden) {
+ keys = Object.getOwnPropertyNames(value);
+ }
+
+ // IE doesn't make error fields non-enumerable
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
+ if (isError(value)
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
+ return formatError(value);
+ }
+
+ // Some type of object without properties can be shortcutted.
+ if (keys.length === 0) {
+ if (isFunction(value)) {
+ var name = value.name ? ': ' + value.name : '';
+ return ctx.stylize('[Function' + name + ']', 'special');
+ }
+ if (isRegExp(value)) {
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+ }
+ if (isDate(value)) {
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
+ }
+ if (isError(value)) {
+ return formatError(value);
+ }
+ }
+
+ var base = '', array = false, braces = ['{', '}'];
+
+ // Make Array say that they are Array
+ if (isArray(value)) {
+ array = true;
+ braces = ['[', ']'];
+ }
+
+ // Make functions say that they are functions
+ if (isFunction(value)) {
+ var n = value.name ? ': ' + value.name : '';
+ base = ' [Function' + n + ']';
+ }
+
+ // Make RegExps say that they are RegExps
+ if (isRegExp(value)) {
+ base = ' ' + RegExp.prototype.toString.call(value);
+ }
+
+ // Make dates with properties first say the date
+ if (isDate(value)) {
+ base = ' ' + Date.prototype.toUTCString.call(value);
+ }
+
+ // Make error with message first say the error
+ if (isError(value)) {
+ base = ' ' + formatError(value);
+ }
+
+ if (keys.length === 0 && (!array || value.length == 0)) {
+ return braces[0] + base + braces[1];
+ }
+
+ if (recurseTimes < 0) {
+ if (isRegExp(value)) {
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+ } else {
+ return ctx.stylize('[Object]', 'special');
+ }
+ }
+
+ ctx.seen.push(value);
+
+ var output;
+ if (array) {
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
+ } else {
+ output = keys.map(function(key) {
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
+ });
+ }
+
+ ctx.seen.pop();
+
+ return reduceToSingleString(output, base, braces);
+}
+
+
+function formatPrimitive(ctx, value) {
+ if (isUndefined(value))
+ return ctx.stylize('undefined', 'undefined');
+ if (isString(value)) {
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
+ .replace(/'/g, "\\'")
+ .replace(/\\"/g, '"') + '\'';
+ return ctx.stylize(simple, 'string');
+ }
+ if (isNumber(value))
+ return ctx.stylize('' + value, 'number');
+ if (isBoolean(value))
+ return ctx.stylize('' + value, 'boolean');
+ // For some reason typeof null is "object", so special case here.
+ if (isNull(value))
+ return ctx.stylize('null', 'null');
+}
+
+
+function formatError(value) {
+ return '[' + Error.prototype.toString.call(value) + ']';
+}
+
+
+function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
+ var output = [];
+ for (var i = 0, l = value.length; i < l; ++i) {
+ if (hasOwnProperty(value, String(i))) {
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+ String(i), true));
+ } else {
+ output.push('');
+ }
+ }
+ keys.forEach(function(key) {
+ if (!key.match(/^\d+$/)) {
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+ key, true));
+ }
+ });
+ return output;
+}
+
+
+function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
+ var name, str, desc;
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
+ if (desc.get) {
+ if (desc.set) {
+ str = ctx.stylize('[Getter/Setter]', 'special');
+ } else {
+ str = ctx.stylize('[Getter]', 'special');
+ }
+ } else {
+ if (desc.set) {
+ str = ctx.stylize('[Setter]', 'special');
+ }
+ }
+ if (!hasOwnProperty(visibleKeys, key)) {
+ name = '[' + key + ']';
+ }
+ if (!str) {
+ if (ctx.seen.indexOf(desc.value) < 0) {
+ if (isNull(recurseTimes)) {
+ str = formatValue(ctx, desc.value, null);
+ } else {
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
+ }
+ if (str.indexOf('\n') > -1) {
+ if (array) {
+ str = str.split('\n').map(function(line) {
+ return ' ' + line;
+ }).join('\n').substr(2);
+ } else {
+ str = '\n' + str.split('\n').map(function(line) {
+ return ' ' + line;
+ }).join('\n');
+ }
+ }
+ } else {
+ str = ctx.stylize('[Circular]', 'special');
+ }
+ }
+ if (isUndefined(name)) {
+ if (array && key.match(/^\d+$/)) {
+ return str;
+ }
+ name = JSON.stringify('' + key);
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
+ name = name.substr(1, name.length - 2);
+ name = ctx.stylize(name, 'name');
+ } else {
+ name = name.replace(/'/g, "\\'")
+ .replace(/\\"/g, '"')
+ .replace(/(^"|"$)/g, "'");
+ name = ctx.stylize(name, 'string');
+ }
+ }
+
+ return name + ': ' + str;
+}
+
+
+function reduceToSingleString(output, base, braces) {
+ var numLinesEst = 0;
+ var length = output.reduce(function(prev, cur) {
+ numLinesEst++;
+ if (cur.indexOf('\n') >= 0) numLinesEst++;
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
+ }, 0);
+
+ if (length > 60) {
+ return braces[0] +
+ (base === '' ? '' : base + '\n ') +
+ ' ' +
+ output.join(',\n ') +
+ ' ' +
+ braces[1];
+ }
+
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
+}
+
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+function isArray(ar) {
+ return Array.isArray(ar);
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return isObject(re) && objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return isObject(d) && objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return isObject(e) &&
+ (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+exports.isBuffer = require('./support/isBuffer');
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
+
+
+function pad(n) {
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
+}
+
+
+var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
+ 'Oct', 'Nov', 'Dec'];
+
+// 26 Feb 16:19:34
+function timestamp() {
+ var d = new Date();
+ var time = [pad(d.getHours()),
+ pad(d.getMinutes()),
+ pad(d.getSeconds())].join(':');
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
+}
+
+
+// log is just a thin wrapper to console.log that prepends a timestamp
+exports.log = function() {
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
+};
+
+
+/**
+ * Inherit the prototype methods from one constructor into another.
+ *
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
+ * during bootstrapping this function needs to be rewritten using some native
+ * functions as prototype setup using normal JavaScript does not work as
+ * expected during bootstrapping (see mirror.js in r114903).
+ *
+ * @param {function} ctor Constructor function which needs to inherit the
+ * prototype.
+ * @param {function} superCtor Constructor function to inherit prototype from.
+ */
+exports.inherits = require('inherits');
+
+exports._extend = function(origin, add) {
+ // Don't do anything if add isn't an object
+ if (!add || !isObject(add)) return origin;
+
+ var keys = Object.keys(add);
+ var i = keys.length;
+ while (i--) {
+ origin[keys[i]] = add[keys[i]];
+ }
+ return origin;
+};
+
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./support/isBuffer":37,"_process":109,"inherits":36}],39:[function(require,module,exports){
+'use strict';
+
+module.exports = require('./lib/AsyncEventEmitter');
+
+},{"./lib/AsyncEventEmitter":40}],40:[function(require,module,exports){
+'use strict';
+
+var EventEmitter = require('events').EventEmitter,
+ util = require('util'),
+ eachSeries = require('async/eachSeries'),
+ AsyncEventEmitter;
+
+
+module.exports = exports = AsyncEventEmitter = function AsyncEventEmitter () {
+ EventEmitter.call(this);
+};
+
+util.inherits(AsyncEventEmitter, EventEmitter);
+
+
+/* Public methods
+============================================================================= */
+
+AsyncEventEmitter.prototype.emit = function(event, data, callback) {
+ var self = this,
+ listeners = self._events[event] || [];
+
+ // Optional data argument
+ if(!callback && typeof data === 'function') {
+ callback = data;
+ data = undefined;
+ }
+
+ // Special treatment of internal newListener and removeListener events
+ if(event === 'newListener' || event === 'removeListener') {
+ data = {
+ event: data,
+ fn: callback
+ };
+
+ callback = undefined;
+ }
+
+ // A single listener is just a function not an array...
+ listeners = Array.isArray(listeners) ? listeners : [listeners];
+
+ eachSeries(listeners.slice(), function (fn, next) {
+ var err;
+
+ // Support synchronous functions
+ if(fn.length < 2) {
+ try {
+ fn.call(self, data);
+ }
+ catch (e) {
+ err = e;
+ }
+
+ return next(err);
+ }
+
+ // Async
+ fn.call(self, data, next);
+ }, callback);
+
+ return self;
+};
+
+
+AsyncEventEmitter.prototype.once = function (type, listener) {
+ var self = this,
+ g;
+
+ if (typeof listener !== 'function') {
+ throw new TypeError('listener must be a function');
+ }
+
+ // Hack to support set arity
+ if(listener.length >= 2) {
+ g = function (e, next) {
+ self.removeListener(type, g);
+ listener(e, next);
+ };
+ }
+ else {
+ g = function (e) {
+ self.removeListener(type, g);
+ listener(e);
+ };
+ }
+
+ g.listener = listener;
+ self.on(type, g);
+
+ return self;
+};
+
+
+AsyncEventEmitter.prototype.first = function(event, listener) {
+ var listeners = this._events[event] || [];
+
+ // Contract
+ if(typeof listener !== 'function') {
+ throw new TypeError('listener must be a function');
+ }
+
+ // Listeners are not always an array
+ if(!Array.isArray(listeners)) {
+ this._events[event] = listeners = [listeners];
+ }
+
+ listeners.unshift(listener);
+
+ return this;
+};
+
+
+AsyncEventEmitter.prototype.at = function(event, index, listener) {
+ var listeners = this._events[event] || [];
+
+ // Contract
+ if(typeof listener !== 'function') {
+ throw new TypeError('listener must be a function');
+ }
+ if(typeof index !== 'number' || index < 0) {
+ throw new TypeError('index must be a non-negative integer');
+ }
+
+ // Listeners are not always an array
+ if(!Array.isArray(listeners)) {
+ this._events[event] = listeners = [listeners];
+ }
+
+ listeners.splice(index, 0, listener);
+
+ return this;
+};
+
+
+AsyncEventEmitter.prototype.before = function(event, target, listener) {
+ return this._beforeOrAfter(event, target, listener);
+};
+
+
+AsyncEventEmitter.prototype.after = function(event, target, listener) {
+ return this._beforeOrAfter(event, target, listener, 'after');
+};
+
+
+/* Private methods
+============================================================================= */
+
+AsyncEventEmitter.prototype._beforeOrAfter = function(event, target, listener, beforeOrAfter) {
+ var listeners = this._events[event] || [],
+ i, index,
+ add = beforeOrAfter === 'after' ? 1 : 0;
+
+ // Contract
+ if(typeof listener !== 'function') {
+ throw new TypeError('listener must be a function');
+ }
+ if(typeof target !== 'function') {
+ throw new TypeError('target must be a function');
+ }
+
+ // Listeners are not always an array
+ if(!Array.isArray(listeners)) {
+ this._events[event] = listeners = [listeners];
+ }
+
+ index = listeners.length;
+
+ for(i = listeners.length; i--;) {
+ if(listeners[i] === target) {
+ index = i + add;
+ break;
+ }
+ }
+
+ listeners.splice(index, 0, listener);
+
+ return this;
+};
+
+},{"async/eachSeries":44,"events":708,"util":1439}],41:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = asyncify;
+
+var _isObject = require('lodash/isObject');
+
+var _isObject2 = _interopRequireDefault(_isObject);
+
+var _initialParams = require('./internal/initialParams');
+
+var _initialParams2 = _interopRequireDefault(_initialParams);
+
+var _setImmediate = require('./internal/setImmediate');
+
+var _setImmediate2 = _interopRequireDefault(_setImmediate);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Take a sync function and make it async, passing its return value to a
+ * callback. This is useful for plugging sync functions into a waterfall,
+ * series, or other async functions. Any arguments passed to the generated
+ * function will be passed to the wrapped function (except for the final
+ * callback argument). Errors thrown will be passed to the callback.
+ *
+ * If the function passed to `asyncify` returns a Promise, that promises's
+ * resolved/rejected state will be used to call the callback, rather than simply
+ * the synchronous return value.
+ *
+ * This also means you can asyncify ES2017 `async` functions.
+ *
+ * @name asyncify
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @alias wrapSync
+ * @category Util
+ * @param {Function} func - The synchronous function, or Promise-returning
+ * function to convert to an {@link AsyncFunction}.
+ * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
+ * invoked with `(args..., callback)`.
+ * @example
+ *
+ * // passing a regular synchronous function
+ * async.waterfall([
+ * async.apply(fs.readFile, filename, "utf8"),
+ * async.asyncify(JSON.parse),
+ * function (data, next) {
+ * // data is the result of parsing the text.
+ * // If there was a parsing error, it would have been caught.
+ * }
+ * ], callback);
+ *
+ * // passing a function returning a promise
+ * async.waterfall([
+ * async.apply(fs.readFile, filename, "utf8"),
+ * async.asyncify(function (contents) {
+ * return db.model.create(contents);
+ * }),
+ * function (model, next) {
+ * // `model` is the instantiated model object.
+ * // If there was an error, this function would be skipped.
+ * }
+ * ], callback);
+ *
+ * // es2017 example, though `asyncify` is not needed if your JS environment
+ * // supports async functions out of the box
+ * var q = async.queue(async.asyncify(async function(file) {
+ * var intermediateStep = await processFile(file);
+ * return await somePromise(intermediateStep)
+ * }));
+ *
+ * q.push(files);
+ */
+function asyncify(func) {
+ return (0, _initialParams2.default)(function (args, callback) {
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ // if result is Promise object
+ if ((0, _isObject2.default)(result) && typeof result.then === 'function') {
+ result.then(function (value) {
+ invokeCallback(callback, null, value);
+ }, function (err) {
+ invokeCallback(callback, err.message ? err : new Error(err));
+ });
+ } else {
+ callback(null, result);
+ }
+ });
+}
+
+function invokeCallback(callback, error, value) {
+ try {
+ callback(error, value);
+ } catch (e) {
+ (0, _setImmediate2.default)(rethrow, e);
+ }
+}
+
+function rethrow(error) {
+ throw error;
+}
+module.exports = exports['default'];
+},{"./internal/initialParams":49,"./internal/setImmediate":53,"lodash/isObject":926}],42:[function(require,module,exports){
+(function (process,global,setImmediate){
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (factory((global.async = global.async || {})));
+}(this, (function (exports) { 'use strict';
+
+function slice(arrayLike, start) {
+ start = start|0;
+ var newLen = Math.max(arrayLike.length - start, 0);
+ var newArr = Array(newLen);
+ for(var idx = 0; idx < newLen; idx++) {
+ newArr[idx] = arrayLike[start + idx];
+ }
+ return newArr;
+}
+
+/**
+ * Creates a continuation function with some arguments already applied.
+ *
+ * Useful as a shorthand when combined with other control flow functions. Any
+ * arguments passed to the returned function are added to the arguments
+ * originally passed to apply.
+ *
+ * @name apply
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @category Util
+ * @param {Function} fn - The function you want to eventually apply all
+ * arguments to. Invokes with (arguments...).
+ * @param {...*} arguments... - Any number of arguments to automatically apply
+ * when the continuation is called.
+ * @returns {Function} the partially-applied function
+ * @example
+ *
+ * // using apply
+ * async.parallel([
+ * async.apply(fs.writeFile, 'testfile1', 'test1'),
+ * async.apply(fs.writeFile, 'testfile2', 'test2')
+ * ]);
+ *
+ *
+ * // the same process without using apply
+ * async.parallel([
+ * function(callback) {
+ * fs.writeFile('testfile1', 'test1', callback);
+ * },
+ * function(callback) {
+ * fs.writeFile('testfile2', 'test2', callback);
+ * }
+ * ]);
+ *
+ * // It's possible to pass any number of additional arguments when calling the
+ * // continuation:
+ *
+ * node> var fn = async.apply(sys.puts, 'one');
+ * node> fn('two', 'three');
+ * one
+ * two
+ * three
+ */
+var apply = function(fn/*, ...args*/) {
+ var args = slice(arguments, 1);
+ return function(/*callArgs*/) {
+ var callArgs = slice(arguments);
+ return fn.apply(null, args.concat(callArgs));
+ };
+};
+
+var initialParams = function (fn) {
+ return function (/*...args, callback*/) {
+ var args = slice(arguments);
+ var callback = args.pop();
+ fn.call(this, args, callback);
+ };
+};
+
+/**
+ * Checks if `value` is the
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(_.noop);
+ * // => true
+ *
+ * _.isObject(null);
+ * // => false
+ */
+function isObject(value) {
+ var type = typeof value;
+ return value != null && (type == 'object' || type == 'function');
+}
+
+var hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
+var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
+
+function fallback(fn) {
+ setTimeout(fn, 0);
+}
+
+function wrap(defer) {
+ return function (fn/*, ...args*/) {
+ var args = slice(arguments, 1);
+ defer(function () {
+ fn.apply(null, args);
+ });
+ };
+}
+
+var _defer;
+
+if (hasSetImmediate) {
+ _defer = setImmediate;
+} else if (hasNextTick) {
+ _defer = process.nextTick;
+} else {
+ _defer = fallback;
+}
+
+var setImmediate$1 = wrap(_defer);
+
+/**
+ * Take a sync function and make it async, passing its return value to a
+ * callback. This is useful for plugging sync functions into a waterfall,
+ * series, or other async functions. Any arguments passed to the generated
+ * function will be passed to the wrapped function (except for the final
+ * callback argument). Errors thrown will be passed to the callback.
+ *
+ * If the function passed to `asyncify` returns a Promise, that promises's
+ * resolved/rejected state will be used to call the callback, rather than simply
+ * the synchronous return value.
+ *
+ * This also means you can asyncify ES2017 `async` functions.
+ *
+ * @name asyncify
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @alias wrapSync
+ * @category Util
+ * @param {Function} func - The synchronous function, or Promise-returning
+ * function to convert to an {@link AsyncFunction}.
+ * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
+ * invoked with `(args..., callback)`.
+ * @example
+ *
+ * // passing a regular synchronous function
+ * async.waterfall([
+ * async.apply(fs.readFile, filename, "utf8"),
+ * async.asyncify(JSON.parse),
+ * function (data, next) {
+ * // data is the result of parsing the text.
+ * // If there was a parsing error, it would have been caught.
+ * }
+ * ], callback);
+ *
+ * // passing a function returning a promise
+ * async.waterfall([
+ * async.apply(fs.readFile, filename, "utf8"),
+ * async.asyncify(function (contents) {
+ * return db.model.create(contents);
+ * }),
+ * function (model, next) {
+ * // `model` is the instantiated model object.
+ * // If there was an error, this function would be skipped.
+ * }
+ * ], callback);
+ *
+ * // es2017 example, though `asyncify` is not needed if your JS environment
+ * // supports async functions out of the box
+ * var q = async.queue(async.asyncify(async function(file) {
+ * var intermediateStep = await processFile(file);
+ * return await somePromise(intermediateStep)
+ * }));
+ *
+ * q.push(files);
+ */
+function asyncify(func) {
+ return initialParams(function (args, callback) {
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ // if result is Promise object
+ if (isObject(result) && typeof result.then === 'function') {
+ result.then(function(value) {
+ invokeCallback(callback, null, value);
+ }, function(err) {
+ invokeCallback(callback, err.message ? err : new Error(err));
+ });
+ } else {
+ callback(null, result);
+ }
+ });
+}
+
+function invokeCallback(callback, error, value) {
+ try {
+ callback(error, value);
+ } catch (e) {
+ setImmediate$1(rethrow, e);
+ }
+}
+
+function rethrow(error) {
+ throw error;
+}
+
+var supportsSymbol = typeof Symbol === 'function';
+
+function isAsync(fn) {
+ return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction';
+}
+
+function wrapAsync(asyncFn) {
+ return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;
+}
+
+function applyEach$1(eachfn) {
+ return function(fns/*, ...args*/) {
+ var args = slice(arguments, 1);
+ var go = initialParams(function(args, callback) {
+ var that = this;
+ return eachfn(fns, function (fn, cb) {
+ wrapAsync(fn).apply(that, args.concat(cb));
+ }, callback);
+ });
+ if (args.length) {
+ return go.apply(this, args);
+ }
+ else {
+ return go;
+ }
+ };
+}
+
+/** Detect free variable `global` from Node.js. */
+var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+/** Detect free variable `self`. */
+var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+/** Used as a reference to the global object. */
+var root = freeGlobal || freeSelf || Function('return this')();
+
+/** Built-in value references. */
+var Symbol$1 = root.Symbol;
+
+/** Used for built-in method references. */
+var objectProto = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty = objectProto.hasOwnProperty;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var nativeObjectToString = objectProto.toString;
+
+/** Built-in value references. */
+var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
+
+/**
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the raw `toStringTag`.
+ */
+function getRawTag(value) {
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1),
+ tag = value[symToStringTag$1];
+
+ try {
+ value[symToStringTag$1] = undefined;
+ var unmasked = true;
+ } catch (e) {}
+
+ var result = nativeObjectToString.call(value);
+ if (unmasked) {
+ if (isOwn) {
+ value[symToStringTag$1] = tag;
+ } else {
+ delete value[symToStringTag$1];
+ }
+ }
+ return result;
+}
+
+/** Used for built-in method references. */
+var objectProto$1 = Object.prototype;
+
+/**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+var nativeObjectToString$1 = objectProto$1.toString;
+
+/**
+ * Converts `value` to a string using `Object.prototype.toString`.
+ *
+ * @private
+ * @param {*} value The value to convert.
+ * @returns {string} Returns the converted string.
+ */
+function objectToString(value) {
+ return nativeObjectToString$1.call(value);
+}
+
+/** `Object#toString` result references. */
+var nullTag = '[object Null]';
+var undefinedTag = '[object Undefined]';
+
+/** Built-in value references. */
+var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
+
+/**
+ * The base implementation of `getTag` without fallbacks for buggy environments.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
+ */
+function baseGetTag(value) {
+ if (value == null) {
+ return value === undefined ? undefinedTag : nullTag;
+ }
+ return (symToStringTag && symToStringTag in Object(value))
+ ? getRawTag(value)
+ : objectToString(value);
+}
+
+/** `Object#toString` result references. */
+var asyncTag = '[object AsyncFunction]';
+var funcTag = '[object Function]';
+var genTag = '[object GeneratorFunction]';
+var proxyTag = '[object Proxy]';
+
+/**
+ * Checks if `value` is classified as a `Function` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+ * @example
+ *
+ * _.isFunction(_);
+ * // => true
+ *
+ * _.isFunction(/abc/);
+ * // => false
+ */
+function isFunction(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+ // The use of `Object#toString` avoids issues with the `typeof` operator
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
+ var tag = baseGetTag(value);
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
+}
+
+/** Used as references for various `Number` constants. */
+var MAX_SAFE_INTEGER = 9007199254740991;
+
+/**
+ * Checks if `value` is a valid array-like length.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ * @example
+ *
+ * _.isLength(3);
+ * // => true
+ *
+ * _.isLength(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isLength(Infinity);
+ * // => false
+ *
+ * _.isLength('3');
+ * // => false
+ */
+function isLength(value) {
+ return typeof value == 'number' &&
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+}
+
+/**
+ * Checks if `value` is array-like. A value is considered array-like if it's
+ * not a function and has a `value.length` that's an integer greater than or
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+ * @example
+ *
+ * _.isArrayLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLike(document.body.children);
+ * // => true
+ *
+ * _.isArrayLike('abc');
+ * // => true
+ *
+ * _.isArrayLike(_.noop);
+ * // => false
+ */
+function isArrayLike(value) {
+ return value != null && isLength(value.length) && !isFunction(value);
+}
+
+// A temporary value used to identify if the loop should be broken.
+// See #1064, #1293
+var breakLoop = {};
+
+/**
+ * This method returns `undefined`.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.3.0
+ * @category Util
+ * @example
+ *
+ * _.times(2, _.noop);
+ * // => [undefined, undefined]
+ */
+function noop() {
+ // No operation performed.
+}
+
+function once(fn) {
+ return function () {
+ if (fn === null) return;
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, arguments);
+ };
+}
+
+var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator;
+
+var getIterator = function (coll) {
+ return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol]();
+};
+
+/**
+ * The base implementation of `_.times` without support for iteratee shorthands
+ * or max array length checks.
+ *
+ * @private
+ * @param {number} n The number of times to invoke `iteratee`.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the array of results.
+ */
+function baseTimes(n, iteratee) {
+ var index = -1,
+ result = Array(n);
+
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+}
+
+/**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+function isObjectLike(value) {
+ return value != null && typeof value == 'object';
+}
+
+/** `Object#toString` result references. */
+var argsTag = '[object Arguments]';
+
+/**
+ * The base implementation of `_.isArguments`.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+ */
+function baseIsArguments(value) {
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
+}
+
+/** Used for built-in method references. */
+var objectProto$3 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
+
+/** Built-in value references. */
+var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
+
+/**
+ * Checks if `value` is likely an `arguments` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+ * else `false`.
+ * @example
+ *
+ * _.isArguments(function() { return arguments; }());
+ * // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
+ */
+var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
+ return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') &&
+ !propertyIsEnumerable.call(value, 'callee');
+};
+
+/**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(document.body.children);
+ * // => false
+ *
+ * _.isArray('abc');
+ * // => false
+ *
+ * _.isArray(_.noop);
+ * // => false
+ */
+var isArray = Array.isArray;
+
+/**
+ * This method returns `false`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.13.0
+ * @category Util
+ * @returns {boolean} Returns `false`.
+ * @example
+ *
+ * _.times(2, _.stubFalse);
+ * // => [false, false]
+ */
+function stubFalse() {
+ return false;
+}
+
+/** Detect free variable `exports`. */
+var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
+
+/** Detect free variable `module`. */
+var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
+
+/** Detect the popular CommonJS extension `module.exports`. */
+var moduleExports = freeModule && freeModule.exports === freeExports;
+
+/** Built-in value references. */
+var Buffer = moduleExports ? root.Buffer : undefined;
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
+
+/**
+ * Checks if `value` is a buffer.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.3.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
+ * @example
+ *
+ * _.isBuffer(new Buffer(2));
+ * // => true
+ *
+ * _.isBuffer(new Uint8Array(2));
+ * // => false
+ */
+var isBuffer = nativeIsBuffer || stubFalse;
+
+/** Used as references for various `Number` constants. */
+var MAX_SAFE_INTEGER$1 = 9007199254740991;
+
+/** Used to detect unsigned integer values. */
+var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+/**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+function isIndex(value, length) {
+ var type = typeof value;
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
+
+ return !!length &&
+ (type == 'number' ||
+ (type != 'symbol' && reIsUint.test(value))) &&
+ (value > -1 && value % 1 == 0 && value < length);
+}
+
+/** `Object#toString` result references. */
+var argsTag$1 = '[object Arguments]';
+var arrayTag = '[object Array]';
+var boolTag = '[object Boolean]';
+var dateTag = '[object Date]';
+var errorTag = '[object Error]';
+var funcTag$1 = '[object Function]';
+var mapTag = '[object Map]';
+var numberTag = '[object Number]';
+var objectTag = '[object Object]';
+var regexpTag = '[object RegExp]';
+var setTag = '[object Set]';
+var stringTag = '[object String]';
+var weakMapTag = '[object WeakMap]';
+
+var arrayBufferTag = '[object ArrayBuffer]';
+var dataViewTag = '[object DataView]';
+var float32Tag = '[object Float32Array]';
+var float64Tag = '[object Float64Array]';
+var int8Tag = '[object Int8Array]';
+var int16Tag = '[object Int16Array]';
+var int32Tag = '[object Int32Array]';
+var uint8Tag = '[object Uint8Array]';
+var uint8ClampedTag = '[object Uint8ClampedArray]';
+var uint16Tag = '[object Uint16Array]';
+var uint32Tag = '[object Uint32Array]';
+
+/** Used to identify `toStringTag` values of typed arrays. */
+var typedArrayTags = {};
+typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
+typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
+typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
+typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
+typedArrayTags[uint32Tag] = true;
+typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
+typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
+typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
+typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
+typedArrayTags[mapTag] = typedArrayTags[numberTag] =
+typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
+typedArrayTags[setTag] = typedArrayTags[stringTag] =
+typedArrayTags[weakMapTag] = false;
+
+/**
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+ */
+function baseIsTypedArray(value) {
+ return isObjectLike(value) &&
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
+}
+
+/**
+ * The base implementation of `_.unary` without support for storing metadata.
+ *
+ * @private
+ * @param {Function} func The function to cap arguments for.
+ * @returns {Function} Returns the new capped function.
+ */
+function baseUnary(func) {
+ return function(value) {
+ return func(value);
+ };
+}
+
+/** Detect free variable `exports`. */
+var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
+
+/** Detect free variable `module`. */
+var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
+
+/** Detect the popular CommonJS extension `module.exports`. */
+var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
+
+/** Detect free variable `process` from Node.js. */
+var freeProcess = moduleExports$1 && freeGlobal.process;
+
+/** Used to access faster Node.js helpers. */
+var nodeUtil = (function() {
+ try {
+ // Use `util.types` for Node.js 10+.
+ var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
+
+ if (types) {
+ return types;
+ }
+
+ // Legacy `process.binding('util')` for Node.js < 10.
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
+ } catch (e) {}
+}());
+
+/* Node.js helper references. */
+var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
+
+/**
+ * Checks if `value` is classified as a typed array.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+ * @example
+ *
+ * _.isTypedArray(new Uint8Array);
+ * // => true
+ *
+ * _.isTypedArray([]);
+ * // => false
+ */
+var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
+
+/** Used for built-in method references. */
+var objectProto$2 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
+
+/**
+ * Creates an array of the enumerable property names of the array-like `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @param {boolean} inherited Specify returning inherited property names.
+ * @returns {Array} Returns the array of property names.
+ */
+function arrayLikeKeys(value, inherited) {
+ var isArr = isArray(value),
+ isArg = !isArr && isArguments(value),
+ isBuff = !isArr && !isArg && isBuffer(value),
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
+ skipIndexes = isArr || isArg || isBuff || isType,
+ result = skipIndexes ? baseTimes(value.length, String) : [],
+ length = result.length;
+
+ for (var key in value) {
+ if ((inherited || hasOwnProperty$1.call(value, key)) &&
+ !(skipIndexes && (
+ // Safari 9 has enumerable `arguments.length` in strict mode.
+ key == 'length' ||
+ // Node.js 0.10 has enumerable non-index properties on buffers.
+ (isBuff && (key == 'offset' || key == 'parent')) ||
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
+ // Skip index properties.
+ isIndex(key, length)
+ ))) {
+ result.push(key);
+ }
+ }
+ return result;
+}
+
+/** Used for built-in method references. */
+var objectProto$5 = Object.prototype;
+
+/**
+ * Checks if `value` is likely a prototype object.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
+ */
+function isPrototype(value) {
+ var Ctor = value && value.constructor,
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
+
+ return value === proto;
+}
+
+/**
+ * Creates a unary function that invokes `func` with its argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+}
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeKeys = overArg(Object.keys, Object);
+
+/** Used for built-in method references. */
+var objectProto$4 = Object.prototype;
+
+/** Used to check objects for own properties. */
+var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
+
+/**
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+function baseKeys(object) {
+ if (!isPrototype(object)) {
+ return nativeKeys(object);
+ }
+ var result = [];
+ for (var key in Object(object)) {
+ if (hasOwnProperty$3.call(object, key) && key != 'constructor') {
+ result.push(key);
+ }
+ }
+ return result;
+}
+
+/**
+ * Creates an array of the own enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects. See the
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+ * for more details.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keys(new Foo);
+ * // => ['a', 'b'] (iteration order is not guaranteed)
+ *
+ * _.keys('hi');
+ * // => ['0', '1']
+ */
+function keys(object) {
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
+}
+
+function createArrayIterator(coll) {
+ var i = -1;
+ var len = coll.length;
+ return function next() {
+ return ++i < len ? {value: coll[i], key: i} : null;
+ }
+}
+
+function createES2015Iterator(iterator) {
+ var i = -1;
+ return function next() {
+ var item = iterator.next();
+ if (item.done)
+ return null;
+ i++;
+ return {value: item.value, key: i};
+ }
+}
+
+function createObjectIterator(obj) {
+ var okeys = keys(obj);
+ var i = -1;
+ var len = okeys.length;
+ return function next() {
+ var key = okeys[++i];
+ return i < len ? {value: obj[key], key: key} : null;
+ };
+}
+
+function iterator(coll) {
+ if (isArrayLike(coll)) {
+ return createArrayIterator(coll);
+ }
+
+ var iterator = getIterator(coll);
+ return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll);
+}
+
+function onlyOnce(fn) {
+ return function() {
+ if (fn === null) throw new Error("Callback was already called.");
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, arguments);
+ };
+}
+
+function _eachOfLimit(limit) {
+ return function (obj, iteratee, callback) {
+ callback = once(callback || noop);
+ if (limit <= 0 || !obj) {
+ return callback(null);
+ }
+ var nextElem = iterator(obj);
+ var done = false;
+ var running = 0;
+ var looping = false;
+
+ function iterateeCallback(err, value) {
+ running -= 1;
+ if (err) {
+ done = true;
+ callback(err);
+ }
+ else if (value === breakLoop || (done && running <= 0)) {
+ done = true;
+ return callback(null);
+ }
+ else if (!looping) {
+ replenish();
+ }
+ }
+
+ function replenish () {
+ looping = true;
+ while (running < limit && !done) {
+ var elem = nextElem();
+ if (elem === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
+ }
+ running += 1;
+ iteratee(elem.value, elem.key, onlyOnce(iterateeCallback));
+ }
+ looping = false;
+ }
+
+ replenish();
+ };
+}
+
+/**
+ * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name eachOfLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.eachOf]{@link module:Collections.eachOf}
+ * @alias forEachOfLimit
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async function to apply to each
+ * item in `coll`. The `key` is the item's key, or index in the case of an
+ * array.
+ * Invoked with (item, key, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ */
+function eachOfLimit(coll, limit, iteratee, callback) {
+ _eachOfLimit(limit)(coll, wrapAsync(iteratee), callback);
+}
+
+function doLimit(fn, limit) {
+ return function (iterable, iteratee, callback) {
+ return fn(iterable, limit, iteratee, callback);
+ };
+}
+
+// eachOf implementation optimized for array-likes
+function eachOfArrayLike(coll, iteratee, callback) {
+ callback = once(callback || noop);
+ var index = 0,
+ completed = 0,
+ length = coll.length;
+ if (length === 0) {
+ callback(null);
+ }
+
+ function iteratorCallback(err, value) {
+ if (err) {
+ callback(err);
+ } else if ((++completed === length) || value === breakLoop) {
+ callback(null);
+ }
+ }
+
+ for (; index < length; index++) {
+ iteratee(coll[index], index, onlyOnce(iteratorCallback));
+ }
+}
+
+// a generic version of eachOf which can handle array, object, and iterator cases.
+var eachOfGeneric = doLimit(eachOfLimit, Infinity);
+
+/**
+ * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
+ * to the iteratee.
+ *
+ * @name eachOf
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias forEachOf
+ * @category Collection
+ * @see [async.each]{@link module:Collections.each}
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - A function to apply to each
+ * item in `coll`.
+ * The `key` is the item's key, or index in the case of an array.
+ * Invoked with (item, key, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ * @example
+ *
+ * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
+ * var configs = {};
+ *
+ * async.forEachOf(obj, function (value, key, callback) {
+ * fs.readFile(__dirname + value, "utf8", function (err, data) {
+ * if (err) return callback(err);
+ * try {
+ * configs[key] = JSON.parse(data);
+ * } catch (e) {
+ * return callback(e);
+ * }
+ * callback();
+ * });
+ * }, function (err) {
+ * if (err) console.error(err.message);
+ * // configs is now a map of JSON data
+ * doSomethingWith(configs);
+ * });
+ */
+var eachOf = function(coll, iteratee, callback) {
+ var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
+ eachOfImplementation(coll, wrapAsync(iteratee), callback);
+};
+
+function doParallel(fn) {
+ return function (obj, iteratee, callback) {
+ return fn(eachOf, obj, wrapAsync(iteratee), callback);
+ };
+}
+
+function _asyncMap(eachfn, arr, iteratee, callback) {
+ callback = callback || noop;
+ arr = arr || [];
+ var results = [];
+ var counter = 0;
+ var _iteratee = wrapAsync(iteratee);
+
+ eachfn(arr, function (value, _, callback) {
+ var index = counter++;
+ _iteratee(value, function (err, v) {
+ results[index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+}
+
+/**
+ * Produces a new collection of values by mapping each value in `coll` through
+ * the `iteratee` function. The `iteratee` is called with an item from `coll`
+ * and a callback for when it has finished processing. Each of these callback
+ * takes 2 arguments: an `error`, and the transformed item from `coll`. If
+ * `iteratee` passes an error to its callback, the main `callback` (for the
+ * `map` function) is immediately called with the error.
+ *
+ * Note, that since this function applies the `iteratee` to each item in
+ * parallel, there is no guarantee that the `iteratee` functions will complete
+ * in order. However, the results array will be in the same order as the
+ * original `coll`.
+ *
+ * If `map` is passed an Object, the results will be an Array. The results
+ * will roughly be in the order of the original Objects' keys (but this can
+ * vary across JavaScript engines).
+ *
+ * @name map
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The iteratee should complete with the transformed item.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. Results is an Array of the
+ * transformed items from the `coll`. Invoked with (err, results).
+ * @example
+ *
+ * async.map(['file1','file2','file3'], fs.stat, function(err, results) {
+ * // results is now an array of stats for each file
+ * });
+ */
+var map = doParallel(_asyncMap);
+
+/**
+ * Applies the provided arguments to each function in the array, calling
+ * `callback` after all functions have completed. If you only provide the first
+ * argument, `fns`, then it will return a function which lets you pass in the
+ * arguments as if it were a single function call. If more arguments are
+ * provided, `callback` is required while `args` is still optional.
+ *
+ * @name applyEach
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s
+ * to all call with the same arguments
+ * @param {...*} [args] - any number of separate arguments to pass to the
+ * function.
+ * @param {Function} [callback] - the final argument should be the callback,
+ * called when all functions have completed processing.
+ * @returns {Function} - If only the first argument, `fns`, is provided, it will
+ * return a function which lets you pass in the arguments as if it were a single
+ * function call. The signature is `(..args, callback)`. If invoked with any
+ * arguments, `callback` is required.
+ * @example
+ *
+ * async.applyEach([enableSearch, updateSchema], 'bucket', callback);
+ *
+ * // partial application example:
+ * async.each(
+ * buckets,
+ * async.applyEach([enableSearch, updateSchema]),
+ * callback
+ * );
+ */
+var applyEach = applyEach$1(map);
+
+function doParallelLimit(fn) {
+ return function (obj, limit, iteratee, callback) {
+ return fn(_eachOfLimit(limit), obj, wrapAsync(iteratee), callback);
+ };
+}
+
+/**
+ * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time.
+ *
+ * @name mapLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.map]{@link module:Collections.map}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The iteratee should complete with the transformed item.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. Results is an array of the
+ * transformed items from the `coll`. Invoked with (err, results).
+ */
+var mapLimit = doParallelLimit(_asyncMap);
+
+/**
+ * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time.
+ *
+ * @name mapSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.map]{@link module:Collections.map}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The iteratee should complete with the transformed item.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. Results is an array of the
+ * transformed items from the `coll`. Invoked with (err, results).
+ */
+var mapSeries = doLimit(mapLimit, 1);
+
+/**
+ * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.
+ *
+ * @name applyEachSeries
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.applyEach]{@link module:ControlFlow.applyEach}
+ * @category Control Flow
+ * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all
+ * call with the same arguments
+ * @param {...*} [args] - any number of separate arguments to pass to the
+ * function.
+ * @param {Function} [callback] - the final argument should be the callback,
+ * called when all functions have completed processing.
+ * @returns {Function} - If only the first argument is provided, it will return
+ * a function which lets you pass in the arguments as if it were a single
+ * function call.
+ */
+var applyEachSeries = applyEach$1(mapSeries);
+
+/**
+ * A specialized version of `_.forEach` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+function arrayEach(array, iteratee) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (iteratee(array[index], index, array) === false) {
+ break;
+ }
+ }
+ return array;
+}
+
+/**
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+function createBaseFor(fromRight) {
+ return function(object, iteratee, keysFunc) {
+ var index = -1,
+ iterable = Object(object),
+ props = keysFunc(object),
+ length = props.length;
+
+ while (length--) {
+ var key = props[fromRight ? length : ++index];
+ if (iteratee(iterable[key], key, iterable) === false) {
+ break;
+ }
+ }
+ return object;
+ };
+}
+
+/**
+ * The base implementation of `baseForOwn` which iterates over `object`
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
+ */
+var baseFor = createBaseFor();
+
+/**
+ * The base implementation of `_.forOwn` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+function baseForOwn(object, iteratee) {
+ return object && baseFor(object, iteratee, keys);
+}
+
+/**
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
+ * support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {number} fromIndex The index to search from.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+function baseFindIndex(array, predicate, fromIndex, fromRight) {
+ var length = array.length,
+ index = fromIndex + (fromRight ? 1 : -1);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ if (predicate(array[index], index, array)) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+/**
+ * The base implementation of `_.isNaN` without support for number objects.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ */
+function baseIsNaN(value) {
+ return value !== value;
+}
+
+/**
+ * A specialized version of `_.indexOf` which performs strict equality
+ * comparisons of values, i.e. `===`.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+function strictIndexOf(array, value, fromIndex) {
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+/**
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+function baseIndexOf(array, value, fromIndex) {
+ return value === value
+ ? strictIndexOf(array, value, fromIndex)
+ : baseFindIndex(array, baseIsNaN, fromIndex);
+}
+
+/**
+ * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on
+ * their requirements. Each function can optionally depend on other functions
+ * being completed first, and each function is run as soon as its requirements
+ * are satisfied.
+ *
+ * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence
+ * will stop. Further tasks will not execute (so any other functions depending
+ * on it will not run), and the main `callback` is immediately called with the
+ * error.
+ *
+ * {@link AsyncFunction}s also receive an object containing the results of functions which
+ * have completed so far as the first argument, if they have dependencies. If a
+ * task function has no dependencies, it will only be passed a callback.
+ *
+ * @name auto
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Object} tasks - An object. Each of its properties is either a
+ * function or an array of requirements, with the {@link AsyncFunction} itself the last item
+ * in the array. The object's key of a property serves as the name of the task
+ * defined by that property, i.e. can be used when specifying requirements for
+ * other tasks. The function receives one or two arguments:
+ * * a `results` object, containing the results of the previously executed
+ * functions, only passed if the task has any dependencies,
+ * * a `callback(err, result)` function, which must be called when finished,
+ * passing an `error` (which can be `null`) and the result of the function's
+ * execution.
+ * @param {number} [concurrency=Infinity] - An optional `integer` for
+ * determining the maximum number of tasks that can be run in parallel. By
+ * default, as many as possible.
+ * @param {Function} [callback] - An optional callback which is called when all
+ * the tasks have been completed. It receives the `err` argument if any `tasks`
+ * pass an error to their callback. Results are always returned; however, if an
+ * error occurs, no further `tasks` will be performed, and the results object
+ * will only contain partial results. Invoked with (err, results).
+ * @returns undefined
+ * @example
+ *
+ * async.auto({
+ * // this function will just be passed a callback
+ * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'),
+ * showData: ['readData', function(results, cb) {
+ * // results.readData is the file's contents
+ * // ...
+ * }]
+ * }, callback);
+ *
+ * async.auto({
+ * get_data: function(callback) {
+ * console.log('in get_data');
+ * // async code to get some data
+ * callback(null, 'data', 'converted to array');
+ * },
+ * make_folder: function(callback) {
+ * console.log('in make_folder');
+ * // async code to create a directory to store a file in
+ * // this is run at the same time as getting the data
+ * callback(null, 'folder');
+ * },
+ * write_file: ['get_data', 'make_folder', function(results, callback) {
+ * console.log('in write_file', JSON.stringify(results));
+ * // once there is some data and the directory exists,
+ * // write the data to a file in the directory
+ * callback(null, 'filename');
+ * }],
+ * email_link: ['write_file', function(results, callback) {
+ * console.log('in email_link', JSON.stringify(results));
+ * // once the file is written let's email a link to it...
+ * // results.write_file contains the filename returned by write_file.
+ * callback(null, {'file':results.write_file, 'email':'user@example.com'});
+ * }]
+ * }, function(err, results) {
+ * console.log('err = ', err);
+ * console.log('results = ', results);
+ * });
+ */
+var auto = function (tasks, concurrency, callback) {
+ if (typeof concurrency === 'function') {
+ // concurrency is optional, shift the args.
+ callback = concurrency;
+ concurrency = null;
+ }
+ callback = once(callback || noop);
+ var keys$$1 = keys(tasks);
+ var numTasks = keys$$1.length;
+ if (!numTasks) {
+ return callback(null);
+ }
+ if (!concurrency) {
+ concurrency = numTasks;
+ }
+
+ var results = {};
+ var runningTasks = 0;
+ var hasError = false;
+
+ var listeners = Object.create(null);
+
+ var readyTasks = [];
+
+ // for cycle detection:
+ var readyToCheck = []; // tasks that have been identified as reachable
+ // without the possibility of returning to an ancestor task
+ var uncheckedDependencies = {};
+
+ baseForOwn(tasks, function (task, key) {
+ if (!isArray(task)) {
+ // no dependencies
+ enqueueTask(key, [task]);
+ readyToCheck.push(key);
+ return;
+ }
+
+ var dependencies = task.slice(0, task.length - 1);
+ var remainingDependencies = dependencies.length;
+ if (remainingDependencies === 0) {
+ enqueueTask(key, task);
+ readyToCheck.push(key);
+ return;
+ }
+ uncheckedDependencies[key] = remainingDependencies;
+
+ arrayEach(dependencies, function (dependencyName) {
+ if (!tasks[dependencyName]) {
+ throw new Error('async.auto task `' + key +
+ '` has a non-existent dependency `' +
+ dependencyName + '` in ' +
+ dependencies.join(', '));
+ }
+ addListener(dependencyName, function () {
+ remainingDependencies--;
+ if (remainingDependencies === 0) {
+ enqueueTask(key, task);
+ }
+ });
+ });
+ });
+
+ checkForDeadlocks();
+ processQueue();
+
+ function enqueueTask(key, task) {
+ readyTasks.push(function () {
+ runTask(key, task);
+ });
+ }
+
+ function processQueue() {
+ if (readyTasks.length === 0 && runningTasks === 0) {
+ return callback(null, results);
+ }
+ while(readyTasks.length && runningTasks < concurrency) {
+ var run = readyTasks.shift();
+ run();
+ }
+
+ }
+
+ function addListener(taskName, fn) {
+ var taskListeners = listeners[taskName];
+ if (!taskListeners) {
+ taskListeners = listeners[taskName] = [];
+ }
+
+ taskListeners.push(fn);
+ }
+
+ function taskComplete(taskName) {
+ var taskListeners = listeners[taskName] || [];
+ arrayEach(taskListeners, function (fn) {
+ fn();
+ });
+ processQueue();
+ }
+
+
+ function runTask(key, task) {
+ if (hasError) return;
+
+ var taskCallback = onlyOnce(function(err, result) {
+ runningTasks--;
+ if (arguments.length > 2) {
+ result = slice(arguments, 1);
+ }
+ if (err) {
+ var safeResults = {};
+ baseForOwn(results, function(val, rkey) {
+ safeResults[rkey] = val;
+ });
+ safeResults[key] = result;
+ hasError = true;
+ listeners = Object.create(null);
+
+ callback(err, safeResults);
+ } else {
+ results[key] = result;
+ taskComplete(key);
+ }
+ });
+
+ runningTasks++;
+ var taskFn = wrapAsync(task[task.length - 1]);
+ if (task.length > 1) {
+ taskFn(results, taskCallback);
+ } else {
+ taskFn(taskCallback);
+ }
+ }
+
+ function checkForDeadlocks() {
+ // Kahn's algorithm
+ // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm
+ // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html
+ var currentTask;
+ var counter = 0;
+ while (readyToCheck.length) {
+ currentTask = readyToCheck.pop();
+ counter++;
+ arrayEach(getDependents(currentTask), function (dependent) {
+ if (--uncheckedDependencies[dependent] === 0) {
+ readyToCheck.push(dependent);
+ }
+ });
+ }
+
+ if (counter !== numTasks) {
+ throw new Error(
+ 'async.auto cannot execute tasks due to a recursive dependency'
+ );
+ }
+ }
+
+ function getDependents(taskName) {
+ var result = [];
+ baseForOwn(tasks, function (task, key) {
+ if (isArray(task) && baseIndexOf(task, taskName, 0) >= 0) {
+ result.push(key);
+ }
+ });
+ return result;
+ }
+};
+
+/**
+ * A specialized version of `_.map` for arrays without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+function arrayMap(array, iteratee) {
+ var index = -1,
+ length = array == null ? 0 : array.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = iteratee(array[index], index, array);
+ }
+ return result;
+}
+
+/** `Object#toString` result references. */
+var symbolTag = '[object Symbol]';
+
+/**
+ * Checks if `value` is classified as a `Symbol` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+ * @example
+ *
+ * _.isSymbol(Symbol.iterator);
+ * // => true
+ *
+ * _.isSymbol('abc');
+ * // => false
+ */
+function isSymbol(value) {
+ return typeof value == 'symbol' ||
+ (isObjectLike(value) && baseGetTag(value) == symbolTag);
+}
+
+/** Used as references for various `Number` constants. */
+var INFINITY = 1 / 0;
+
+/** Used to convert symbols to primitives and strings. */
+var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined;
+var symbolToString = symbolProto ? symbolProto.toString : undefined;
+
+/**
+ * The base implementation of `_.toString` which doesn't convert nullish
+ * values to empty strings.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ */
+function baseToString(value) {
+ // Exit early for strings to avoid a performance hit in some environments.
+ if (typeof value == 'string') {
+ return value;
+ }
+ if (isArray(value)) {
+ // Recursively convert values (susceptible to call stack limits).
+ return arrayMap(value, baseToString) + '';
+ }
+ if (isSymbol(value)) {
+ return symbolToString ? symbolToString.call(value) : '';
+ }
+ var result = (value + '');
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+}
+
+/**
+ * The base implementation of `_.slice` without an iteratee call guard.
+ *
+ * @private
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
+ */
+function baseSlice(array, start, end) {
+ var index = -1,
+ length = array.length;
+
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = end > length ? length : end;
+ if (end < 0) {
+ end += length;
+ }
+ length = start > end ? 0 : ((end - start) >>> 0);
+ start >>>= 0;
+
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = array[index + start];
+ }
+ return result;
+}
+
+/**
+ * Casts `array` to a slice if it's needed.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {number} start The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the cast slice.
+ */
+function castSlice(array, start, end) {
+ var length = array.length;
+ end = end === undefined ? length : end;
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
+}
+
+/**
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
+ * that is not found in the character symbols.
+ *
+ * @private
+ * @param {Array} strSymbols The string symbols to inspect.
+ * @param {Array} chrSymbols The character symbols to find.
+ * @returns {number} Returns the index of the last unmatched string symbol.
+ */
+function charsEndIndex(strSymbols, chrSymbols) {
+ var index = strSymbols.length;
+
+ while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+ return index;
+}
+
+/**
+ * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
+ * that is not found in the character symbols.
+ *
+ * @private
+ * @param {Array} strSymbols The string symbols to inspect.
+ * @param {Array} chrSymbols The character symbols to find.
+ * @returns {number} Returns the index of the first unmatched string symbol.
+ */
+function charsStartIndex(strSymbols, chrSymbols) {
+ var index = -1,
+ length = strSymbols.length;
+
+ while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+ return index;
+}
+
+/**
+ * Converts an ASCII `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function asciiToArray(string) {
+ return string.split('');
+}
+
+/** Used to compose unicode character classes. */
+var rsAstralRange = '\\ud800-\\udfff';
+var rsComboMarksRange = '\\u0300-\\u036f';
+var reComboHalfMarksRange = '\\ufe20-\\ufe2f';
+var rsComboSymbolsRange = '\\u20d0-\\u20ff';
+var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
+var rsVarRange = '\\ufe0e\\ufe0f';
+
+/** Used to compose unicode capture groups. */
+var rsZWJ = '\\u200d';
+
+/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
+var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
+
+/**
+ * Checks if `string` contains Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
+ */
+function hasUnicode(string) {
+ return reHasUnicode.test(string);
+}
+
+/** Used to compose unicode character classes. */
+var rsAstralRange$1 = '\\ud800-\\udfff';
+var rsComboMarksRange$1 = '\\u0300-\\u036f';
+var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f';
+var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff';
+var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
+var rsVarRange$1 = '\\ufe0e\\ufe0f';
+
+/** Used to compose unicode capture groups. */
+var rsAstral = '[' + rsAstralRange$1 + ']';
+var rsCombo = '[' + rsComboRange$1 + ']';
+var rsFitz = '\\ud83c[\\udffb-\\udfff]';
+var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')';
+var rsNonAstral = '[^' + rsAstralRange$1 + ']';
+var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}';
+var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]';
+var rsZWJ$1 = '\\u200d';
+
+/** Used to compose unicode regexes. */
+var reOptMod = rsModifier + '?';
+var rsOptVar = '[' + rsVarRange$1 + ']?';
+var rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*';
+var rsSeq = rsOptVar + reOptMod + rsOptJoin;
+var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+
+/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
+var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
+
+/**
+ * Converts a Unicode `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function unicodeToArray(string) {
+ return string.match(reUnicode) || [];
+}
+
+/**
+ * Converts `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+function stringToArray(string) {
+ return hasUnicode(string)
+ ? unicodeToArray(string)
+ : asciiToArray(string);
+}
+
+/**
+ * Converts `value` to a string. An empty string is returned for `null`
+ * and `undefined` values. The sign of `-0` is preserved.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {string} Returns the converted string.
+ * @example
+ *
+ * _.toString(null);
+ * // => ''
+ *
+ * _.toString(-0);
+ * // => '-0'
+ *
+ * _.toString([1, 2, 3]);
+ * // => '1,2,3'
+ */
+function toString(value) {
+ return value == null ? '' : baseToString(value);
+}
+
+/** Used to match leading and trailing whitespace. */
+var reTrim = /^\s+|\s+$/g;
+
+/**
+ * Removes leading and trailing whitespace or specified characters from `string`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to trim.
+ * @param {string} [chars=whitespace] The characters to trim.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {string} Returns the trimmed string.
+ * @example
+ *
+ * _.trim(' abc ');
+ * // => 'abc'
+ *
+ * _.trim('-_-abc-_-', '_-');
+ * // => 'abc'
+ *
+ * _.map([' foo ', ' bar '], _.trim);
+ * // => ['foo', 'bar']
+ */
+function trim(string, chars, guard) {
+ string = toString(string);
+ if (string && (guard || chars === undefined)) {
+ return string.replace(reTrim, '');
+ }
+ if (!string || !(chars = baseToString(chars))) {
+ return string;
+ }
+ var strSymbols = stringToArray(string),
+ chrSymbols = stringToArray(chars),
+ start = charsStartIndex(strSymbols, chrSymbols),
+ end = charsEndIndex(strSymbols, chrSymbols) + 1;
+
+ return castSlice(strSymbols, start, end).join('');
+}
+
+var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m;
+var FN_ARG_SPLIT = /,/;
+var FN_ARG = /(=.+)?(\s*)$/;
+var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
+
+function parseParams(func) {
+ func = func.toString().replace(STRIP_COMMENTS, '');
+ func = func.match(FN_ARGS)[2].replace(' ', '');
+ func = func ? func.split(FN_ARG_SPLIT) : [];
+ func = func.map(function (arg){
+ return trim(arg.replace(FN_ARG, ''));
+ });
+ return func;
+}
+
+/**
+ * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent
+ * tasks are specified as parameters to the function, after the usual callback
+ * parameter, with the parameter names matching the names of the tasks it
+ * depends on. This can provide even more readable task graphs which can be
+ * easier to maintain.
+ *
+ * If a final callback is specified, the task results are similarly injected,
+ * specified as named parameters after the initial error parameter.
+ *
+ * The autoInject function is purely syntactic sugar and its semantics are
+ * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.
+ *
+ * @name autoInject
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.auto]{@link module:ControlFlow.auto}
+ * @category Control Flow
+ * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of
+ * the form 'func([dependencies...], callback). The object's key of a property
+ * serves as the name of the task defined by that property, i.e. can be used
+ * when specifying requirements for other tasks.
+ * * The `callback` parameter is a `callback(err, result)` which must be called
+ * when finished, passing an `error` (which can be `null`) and the result of
+ * the function's execution. The remaining parameters name other tasks on
+ * which the task is dependent, and the results from those tasks are the
+ * arguments of those parameters.
+ * @param {Function} [callback] - An optional callback which is called when all
+ * the tasks have been completed. It receives the `err` argument if any `tasks`
+ * pass an error to their callback, and a `results` object with any completed
+ * task results, similar to `auto`.
+ * @example
+ *
+ * // The example from `auto` can be rewritten as follows:
+ * async.autoInject({
+ * get_data: function(callback) {
+ * // async code to get some data
+ * callback(null, 'data', 'converted to array');
+ * },
+ * make_folder: function(callback) {
+ * // async code to create a directory to store a file in
+ * // this is run at the same time as getting the data
+ * callback(null, 'folder');
+ * },
+ * write_file: function(get_data, make_folder, callback) {
+ * // once there is some data and the directory exists,
+ * // write the data to a file in the directory
+ * callback(null, 'filename');
+ * },
+ * email_link: function(write_file, callback) {
+ * // once the file is written let's email a link to it...
+ * // write_file contains the filename returned by write_file.
+ * callback(null, {'file':write_file, 'email':'user@example.com'});
+ * }
+ * }, function(err, results) {
+ * console.log('err = ', err);
+ * console.log('email_link = ', results.email_link);
+ * });
+ *
+ * // If you are using a JS minifier that mangles parameter names, `autoInject`
+ * // will not work with plain functions, since the parameter names will be
+ * // collapsed to a single letter identifier. To work around this, you can
+ * // explicitly specify the names of the parameters your task function needs
+ * // in an array, similar to Angular.js dependency injection.
+ *
+ * // This still has an advantage over plain `auto`, since the results a task
+ * // depends on are still spread into arguments.
+ * async.autoInject({
+ * //...
+ * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {
+ * callback(null, 'filename');
+ * }],
+ * email_link: ['write_file', function(write_file, callback) {
+ * callback(null, {'file':write_file, 'email':'user@example.com'});
+ * }]
+ * //...
+ * }, function(err, results) {
+ * console.log('err = ', err);
+ * console.log('email_link = ', results.email_link);
+ * });
+ */
+function autoInject(tasks, callback) {
+ var newTasks = {};
+
+ baseForOwn(tasks, function (taskFn, key) {
+ var params;
+ var fnIsAsync = isAsync(taskFn);
+ var hasNoDeps =
+ (!fnIsAsync && taskFn.length === 1) ||
+ (fnIsAsync && taskFn.length === 0);
+
+ if (isArray(taskFn)) {
+ params = taskFn.slice(0, -1);
+ taskFn = taskFn[taskFn.length - 1];
+
+ newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
+ } else if (hasNoDeps) {
+ // no dependencies, use the function as-is
+ newTasks[key] = taskFn;
+ } else {
+ params = parseParams(taskFn);
+ if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {
+ throw new Error("autoInject task functions require explicit parameters.");
+ }
+
+ // remove callback param
+ if (!fnIsAsync) params.pop();
+
+ newTasks[key] = params.concat(newTask);
+ }
+
+ function newTask(results, taskCb) {
+ var newArgs = arrayMap(params, function (name) {
+ return results[name];
+ });
+ newArgs.push(taskCb);
+ wrapAsync(taskFn).apply(null, newArgs);
+ }
+ });
+
+ auto(newTasks, callback);
+}
+
+// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation
+// used for queues. This implementation assumes that the node provided by the user can be modified
+// to adjust the next and last properties. We implement only the minimal functionality
+// for queue support.
+function DLL() {
+ this.head = this.tail = null;
+ this.length = 0;
+}
+
+function setInitial(dll, node) {
+ dll.length = 1;
+ dll.head = dll.tail = node;
+}
+
+DLL.prototype.removeLink = function(node) {
+ if (node.prev) node.prev.next = node.next;
+ else this.head = node.next;
+ if (node.next) node.next.prev = node.prev;
+ else this.tail = node.prev;
+
+ node.prev = node.next = null;
+ this.length -= 1;
+ return node;
+};
+
+DLL.prototype.empty = function () {
+ while(this.head) this.shift();
+ return this;
+};
+
+DLL.prototype.insertAfter = function(node, newNode) {
+ newNode.prev = node;
+ newNode.next = node.next;
+ if (node.next) node.next.prev = newNode;
+ else this.tail = newNode;
+ node.next = newNode;
+ this.length += 1;
+};
+
+DLL.prototype.insertBefore = function(node, newNode) {
+ newNode.prev = node.prev;
+ newNode.next = node;
+ if (node.prev) node.prev.next = newNode;
+ else this.head = newNode;
+ node.prev = newNode;
+ this.length += 1;
+};
+
+DLL.prototype.unshift = function(node) {
+ if (this.head) this.insertBefore(this.head, node);
+ else setInitial(this, node);
+};
+
+DLL.prototype.push = function(node) {
+ if (this.tail) this.insertAfter(this.tail, node);
+ else setInitial(this, node);
+};
+
+DLL.prototype.shift = function() {
+ return this.head && this.removeLink(this.head);
+};
+
+DLL.prototype.pop = function() {
+ return this.tail && this.removeLink(this.tail);
+};
+
+DLL.prototype.toArray = function () {
+ var arr = Array(this.length);
+ var curr = this.head;
+ for(var idx = 0; idx < this.length; idx++) {
+ arr[idx] = curr.data;
+ curr = curr.next;
+ }
+ return arr;
+};
+
+DLL.prototype.remove = function (testFn) {
+ var curr = this.head;
+ while(!!curr) {
+ var next = curr.next;
+ if (testFn(curr)) {
+ this.removeLink(curr);
+ }
+ curr = next;
+ }
+ return this;
+};
+
+function queue(worker, concurrency, payload) {
+ if (concurrency == null) {
+ concurrency = 1;
+ }
+ else if(concurrency === 0) {
+ throw new Error('Concurrency must not be zero');
+ }
+
+ var _worker = wrapAsync(worker);
+ var numRunning = 0;
+ var workersList = [];
+
+ var processingScheduled = false;
+ function _insert(data, insertAtFront, callback) {
+ if (callback != null && typeof callback !== 'function') {
+ throw new Error('task callback must be a function');
+ }
+ q.started = true;
+ if (!isArray(data)) {
+ data = [data];
+ }
+ if (data.length === 0 && q.idle()) {
+ // call drain immediately if there are no tasks
+ return setImmediate$1(function() {
+ q.drain();
+ });
+ }
+
+ for (var i = 0, l = data.length; i < l; i++) {
+ var item = {
+ data: data[i],
+ callback: callback || noop
+ };
+
+ if (insertAtFront) {
+ q._tasks.unshift(item);
+ } else {
+ q._tasks.push(item);
+ }
+ }
+
+ if (!processingScheduled) {
+ processingScheduled = true;
+ setImmediate$1(function() {
+ processingScheduled = false;
+ q.process();
+ });
+ }
+ }
+
+ function _next(tasks) {
+ return function(err){
+ numRunning -= 1;
+
+ for (var i = 0, l = tasks.length; i < l; i++) {
+ var task = tasks[i];
+
+ var index = baseIndexOf(workersList, task, 0);
+ if (index === 0) {
+ workersList.shift();
+ } else if (index > 0) {
+ workersList.splice(index, 1);
+ }
+
+ task.callback.apply(task, arguments);
+
+ if (err != null) {
+ q.error(err, task.data);
+ }
+ }
+
+ if (numRunning <= (q.concurrency - q.buffer) ) {
+ q.unsaturated();
+ }
+
+ if (q.idle()) {
+ q.drain();
+ }
+ q.process();
+ };
+ }
+
+ var isProcessing = false;
+ var q = {
+ _tasks: new DLL(),
+ concurrency: concurrency,
+ payload: payload,
+ saturated: noop,
+ unsaturated:noop,
+ buffer: concurrency / 4,
+ empty: noop,
+ drain: noop,
+ error: noop,
+ started: false,
+ paused: false,
+ push: function (data, callback) {
+ _insert(data, false, callback);
+ },
+ kill: function () {
+ q.drain = noop;
+ q._tasks.empty();
+ },
+ unshift: function (data, callback) {
+ _insert(data, true, callback);
+ },
+ remove: function (testFn) {
+ q._tasks.remove(testFn);
+ },
+ process: function () {
+ // Avoid trying to start too many processing operations. This can occur
+ // when callbacks resolve synchronously (#1267).
+ if (isProcessing) {
+ return;
+ }
+ isProcessing = true;
+ while(!q.paused && numRunning < q.concurrency && q._tasks.length){
+ var tasks = [], data = [];
+ var l = q._tasks.length;
+ if (q.payload) l = Math.min(l, q.payload);
+ for (var i = 0; i < l; i++) {
+ var node = q._tasks.shift();
+ tasks.push(node);
+ workersList.push(node);
+ data.push(node.data);
+ }
+
+ numRunning += 1;
+
+ if (q._tasks.length === 0) {
+ q.empty();
+ }
+
+ if (numRunning === q.concurrency) {
+ q.saturated();
+ }
+
+ var cb = onlyOnce(_next(tasks));
+ _worker(data, cb);
+ }
+ isProcessing = false;
+ },
+ length: function () {
+ return q._tasks.length;
+ },
+ running: function () {
+ return numRunning;
+ },
+ workersList: function () {
+ return workersList;
+ },
+ idle: function() {
+ return q._tasks.length + numRunning === 0;
+ },
+ pause: function () {
+ q.paused = true;
+ },
+ resume: function () {
+ if (q.paused === false) { return; }
+ q.paused = false;
+ setImmediate$1(q.process);
+ }
+ };
+ return q;
+}
+
+/**
+ * A cargo of tasks for the worker function to complete. Cargo inherits all of
+ * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}.
+ * @typedef {Object} CargoObject
+ * @memberOf module:ControlFlow
+ * @property {Function} length - A function returning the number of items
+ * waiting to be processed. Invoke like `cargo.length()`.
+ * @property {number} payload - An `integer` for determining how many tasks
+ * should be process per round. This property can be changed after a `cargo` is
+ * created to alter the payload on-the-fly.
+ * @property {Function} push - Adds `task` to the `queue`. The callback is
+ * called once the `worker` has finished processing the task. Instead of a
+ * single task, an array of `tasks` can be submitted. The respective callback is
+ * used for every task in the list. Invoke like `cargo.push(task, [callback])`.
+ * @property {Function} saturated - A callback that is called when the
+ * `queue.length()` hits the concurrency and further tasks will be queued.
+ * @property {Function} empty - A callback that is called when the last item
+ * from the `queue` is given to a `worker`.
+ * @property {Function} drain - A callback that is called when the last item
+ * from the `queue` has returned from the `worker`.
+ * @property {Function} idle - a function returning false if there are items
+ * waiting or being processed, or true if not. Invoke like `cargo.idle()`.
+ * @property {Function} pause - a function that pauses the processing of tasks
+ * until `resume()` is called. Invoke like `cargo.pause()`.
+ * @property {Function} resume - a function that resumes the processing of
+ * queued tasks when the queue is paused. Invoke like `cargo.resume()`.
+ * @property {Function} kill - a function that removes the `drain` callback and
+ * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`.
+ */
+
+/**
+ * Creates a `cargo` object with the specified payload. Tasks added to the
+ * cargo will be processed altogether (up to the `payload` limit). If the
+ * `worker` is in progress, the task is queued until it becomes available. Once
+ * the `worker` has completed some tasks, each callback of those tasks is
+ * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
+ * for how `cargo` and `queue` work.
+ *
+ * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
+ * at a time, cargo passes an array of tasks to a single worker, repeating
+ * when the worker is finished.
+ *
+ * @name cargo
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.queue]{@link module:ControlFlow.queue}
+ * @category Control Flow
+ * @param {AsyncFunction} worker - An asynchronous function for processing an array
+ * of queued tasks. Invoked with `(tasks, callback)`.
+ * @param {number} [payload=Infinity] - An optional `integer` for determining
+ * how many tasks should be processed per round; if omitted, the default is
+ * unlimited.
+ * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can
+ * attached as certain properties to listen for specific events during the
+ * lifecycle of the cargo and inner queue.
+ * @example
+ *
+ * // create a cargo object with payload 2
+ * var cargo = async.cargo(function(tasks, callback) {
+ * for (var i=0; i true
+ */
+function identity(value) {
+ return value;
+}
+
+function _createTester(check, getResult) {
+ return function(eachfn, arr, iteratee, cb) {
+ cb = cb || noop;
+ var testPassed = false;
+ var testResult;
+ eachfn(arr, function(value, _, callback) {
+ iteratee(value, function(err, result) {
+ if (err) {
+ callback(err);
+ } else if (check(result) && !testResult) {
+ testPassed = true;
+ testResult = getResult(true, value);
+ callback(null, breakLoop);
+ } else {
+ callback();
+ }
+ });
+ }, function(err) {
+ if (err) {
+ cb(err);
+ } else {
+ cb(null, testPassed ? testResult : getResult(false));
+ }
+ });
+ };
+}
+
+function _findGetResult(v, x) {
+ return x;
+}
+
+/**
+ * Returns the first value in `coll` that passes an async truth test. The
+ * `iteratee` is applied in parallel, meaning the first iteratee to return
+ * `true` will fire the detect `callback` with that result. That means the
+ * result might not be the first item in the original `coll` (in terms of order)
+ * that passes the test.
+
+ * If order within the original `coll` is important, then look at
+ * [`detectSeries`]{@link module:Collections.detectSeries}.
+ *
+ * @name detect
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias find
+ * @category Collections
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
+ * The iteratee must complete with a boolean value as its result.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called as soon as any
+ * iteratee returns `true`, or after all the `iteratee` functions have finished.
+ * Result will be the first item in the array that passes the truth test
+ * (iteratee) or the value `undefined` if none passed. Invoked with
+ * (err, result).
+ * @example
+ *
+ * async.detect(['file1','file2','file3'], function(filePath, callback) {
+ * fs.access(filePath, function(err) {
+ * callback(null, !err)
+ * });
+ * }, function(err, result) {
+ * // result now equals the first file in the list that exists
+ * });
+ */
+var detect = doParallel(_createTester(identity, _findGetResult));
+
+/**
+ * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name detectLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.detect]{@link module:Collections.detect}
+ * @alias findLimit
+ * @category Collections
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
+ * The iteratee must complete with a boolean value as its result.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called as soon as any
+ * iteratee returns `true`, or after all the `iteratee` functions have finished.
+ * Result will be the first item in the array that passes the truth test
+ * (iteratee) or the value `undefined` if none passed. Invoked with
+ * (err, result).
+ */
+var detectLimit = doParallelLimit(_createTester(identity, _findGetResult));
+
+/**
+ * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
+ *
+ * @name detectSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.detect]{@link module:Collections.detect}
+ * @alias findSeries
+ * @category Collections
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
+ * The iteratee must complete with a boolean value as its result.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called as soon as any
+ * iteratee returns `true`, or after all the `iteratee` functions have finished.
+ * Result will be the first item in the array that passes the truth test
+ * (iteratee) or the value `undefined` if none passed. Invoked with
+ * (err, result).
+ */
+var detectSeries = doLimit(detectLimit, 1);
+
+function consoleFunc(name) {
+ return function (fn/*, ...args*/) {
+ var args = slice(arguments, 1);
+ args.push(function (err/*, ...args*/) {
+ var args = slice(arguments, 1);
+ if (typeof console === 'object') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ } else if (console[name]) {
+ arrayEach(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ });
+ wrapAsync(fn).apply(null, args);
+ };
+}
+
+/**
+ * Logs the result of an [`async` function]{@link AsyncFunction} to the
+ * `console` using `console.dir` to display the properties of the resulting object.
+ * Only works in Node.js or in browsers that support `console.dir` and
+ * `console.error` (such as FF and Chrome).
+ * If multiple arguments are returned from the async function,
+ * `console.dir` is called on each argument in order.
+ *
+ * @name dir
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @category Util
+ * @param {AsyncFunction} function - The function you want to eventually apply
+ * all arguments to.
+ * @param {...*} arguments... - Any number of arguments to apply to the function.
+ * @example
+ *
+ * // in a module
+ * var hello = function(name, callback) {
+ * setTimeout(function() {
+ * callback(null, {hello: name});
+ * }, 1000);
+ * };
+ *
+ * // in the node repl
+ * node> async.dir(hello, 'world');
+ * {hello: 'world'}
+ */
+var dir = consoleFunc('dir');
+
+/**
+ * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in
+ * the order of operations, the arguments `test` and `fn` are switched.
+ *
+ * Also a version of [`doWhilst`]{@link module:ControlFlow.doWhilst} with asynchronous `test` function.
+ * @name doDuring
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.during]{@link module:ControlFlow.during}
+ * @category Control Flow
+ * @param {AsyncFunction} fn - An async function which is called each time
+ * `test` passes. Invoked with (callback).
+ * @param {AsyncFunction} test - asynchronous truth test to perform before each
+ * execution of `fn`. Invoked with (...args, callback), where `...args` are the
+ * non-error args from the previous callback of `fn`.
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has failed and repeated execution of `fn` has stopped. `callback`
+ * will be passed an error if one occurred, otherwise `null`.
+ */
+function doDuring(fn, test, callback) {
+ callback = onlyOnce(callback || noop);
+ var _fn = wrapAsync(fn);
+ var _test = wrapAsync(test);
+
+ function next(err/*, ...args*/) {
+ if (err) return callback(err);
+ var args = slice(arguments, 1);
+ args.push(check);
+ _test.apply(this, args);
+ }
+
+ function check(err, truth) {
+ if (err) return callback(err);
+ if (!truth) return callback(null);
+ _fn(next);
+ }
+
+ check(null, true);
+
+}
+
+/**
+ * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
+ * the order of operations, the arguments `test` and `iteratee` are switched.
+ *
+ * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
+ *
+ * @name doWhilst
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.whilst]{@link module:ControlFlow.whilst}
+ * @category Control Flow
+ * @param {AsyncFunction} iteratee - A function which is called each time `test`
+ * passes. Invoked with (callback).
+ * @param {Function} test - synchronous truth test to perform after each
+ * execution of `iteratee`. Invoked with any non-error callback results of
+ * `iteratee`.
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has failed and repeated execution of `iteratee` has stopped.
+ * `callback` will be passed an error and any arguments passed to the final
+ * `iteratee`'s callback. Invoked with (err, [results]);
+ */
+function doWhilst(iteratee, test, callback) {
+ callback = onlyOnce(callback || noop);
+ var _iteratee = wrapAsync(iteratee);
+ var next = function(err/*, ...args*/) {
+ if (err) return callback(err);
+ var args = slice(arguments, 1);
+ if (test.apply(this, args)) return _iteratee(next);
+ callback.apply(null, [null].concat(args));
+ };
+ _iteratee(next);
+}
+
+/**
+ * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
+ * argument ordering differs from `until`.
+ *
+ * @name doUntil
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
+ * @category Control Flow
+ * @param {AsyncFunction} iteratee - An async function which is called each time
+ * `test` fails. Invoked with (callback).
+ * @param {Function} test - synchronous truth test to perform after each
+ * execution of `iteratee`. Invoked with any non-error callback results of
+ * `iteratee`.
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has passed and repeated execution of `iteratee` has stopped. `callback`
+ * will be passed an error and any arguments passed to the final `iteratee`'s
+ * callback. Invoked with (err, [results]);
+ */
+function doUntil(iteratee, test, callback) {
+ doWhilst(iteratee, function() {
+ return !test.apply(this, arguments);
+ }, callback);
+}
+
+/**
+ * Like [`whilst`]{@link module:ControlFlow.whilst}, except the `test` is an asynchronous function that
+ * is passed a callback in the form of `function (err, truth)`. If error is
+ * passed to `test` or `fn`, the main callback is immediately called with the
+ * value of the error.
+ *
+ * @name during
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.whilst]{@link module:ControlFlow.whilst}
+ * @category Control Flow
+ * @param {AsyncFunction} test - asynchronous truth test to perform before each
+ * execution of `fn`. Invoked with (callback).
+ * @param {AsyncFunction} fn - An async function which is called each time
+ * `test` passes. Invoked with (callback).
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has failed and repeated execution of `fn` has stopped. `callback`
+ * will be passed an error, if one occurred, otherwise `null`.
+ * @example
+ *
+ * var count = 0;
+ *
+ * async.during(
+ * function (callback) {
+ * return callback(null, count < 5);
+ * },
+ * function (callback) {
+ * count++;
+ * setTimeout(callback, 1000);
+ * },
+ * function (err) {
+ * // 5 seconds have passed
+ * }
+ * );
+ */
+function during(test, fn, callback) {
+ callback = onlyOnce(callback || noop);
+ var _fn = wrapAsync(fn);
+ var _test = wrapAsync(test);
+
+ function next(err) {
+ if (err) return callback(err);
+ _test(check);
+ }
+
+ function check(err, truth) {
+ if (err) return callback(err);
+ if (!truth) return callback(null);
+ _fn(next);
+ }
+
+ _test(check);
+}
+
+function _withoutIndex(iteratee) {
+ return function (value, index, callback) {
+ return iteratee(value, callback);
+ };
+}
+
+/**
+ * Applies the function `iteratee` to each item in `coll`, in parallel.
+ * The `iteratee` is called with an item from the list, and a callback for when
+ * it has finished. If the `iteratee` passes an error to its `callback`, the
+ * main `callback` (for the `each` function) is immediately called with the
+ * error.
+ *
+ * Note, that since this function applies `iteratee` to each item in parallel,
+ * there is no guarantee that the iteratee functions will complete in order.
+ *
+ * @name each
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias forEach
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to
+ * each item in `coll`. Invoked with (item, callback).
+ * The array index is not passed to the iteratee.
+ * If you need the index, use `eachOf`.
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ * @example
+ *
+ * // assuming openFiles is an array of file names and saveFile is a function
+ * // to save the modified contents of that file:
+ *
+ * async.each(openFiles, saveFile, function(err){
+ * // if any of the saves produced an error, err would equal that error
+ * });
+ *
+ * // assuming openFiles is an array of file names
+ * async.each(openFiles, function(file, callback) {
+ *
+ * // Perform operation on file here.
+ * console.log('Processing file ' + file);
+ *
+ * if( file.length > 32 ) {
+ * console.log('This file name is too long');
+ * callback('File name too long');
+ * } else {
+ * // Do work to process file here
+ * console.log('File processed');
+ * callback();
+ * }
+ * }, function(err) {
+ * // if any of the file processing produced an error, err would equal that error
+ * if( err ) {
+ * // One of the iterations produced an error.
+ * // All processing will now stop.
+ * console.log('A file failed to process');
+ * } else {
+ * console.log('All files have been processed successfully');
+ * }
+ * });
+ */
+function eachLimit(coll, iteratee, callback) {
+ eachOf(coll, _withoutIndex(wrapAsync(iteratee)), callback);
+}
+
+/**
+ * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
+ *
+ * @name eachLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.each]{@link module:Collections.each}
+ * @alias forEachLimit
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The array index is not passed to the iteratee.
+ * If you need the index, use `eachOfLimit`.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ */
+function eachLimit$1(coll, limit, iteratee, callback) {
+ _eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
+}
+
+/**
+ * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
+ *
+ * @name eachSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.each]{@link module:Collections.each}
+ * @alias forEachSeries
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to each
+ * item in `coll`.
+ * The array index is not passed to the iteratee.
+ * If you need the index, use `eachOfSeries`.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ */
+var eachSeries = doLimit(eachLimit$1, 1);
+
+/**
+ * Wrap an async function and ensure it calls its callback on a later tick of
+ * the event loop. If the function already calls its callback on a next tick,
+ * no extra deferral is added. This is useful for preventing stack overflows
+ * (`RangeError: Maximum call stack size exceeded`) and generally keeping
+ * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)
+ * contained. ES2017 `async` functions are returned as-is -- they are immune
+ * to Zalgo's corrupting influences, as they always resolve on a later tick.
+ *
+ * @name ensureAsync
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @category Util
+ * @param {AsyncFunction} fn - an async function, one that expects a node-style
+ * callback as its last argument.
+ * @returns {AsyncFunction} Returns a wrapped function with the exact same call
+ * signature as the function passed in.
+ * @example
+ *
+ * function sometimesAsync(arg, callback) {
+ * if (cache[arg]) {
+ * return callback(null, cache[arg]); // this would be synchronous!!
+ * } else {
+ * doSomeIO(arg, callback); // this IO would be asynchronous
+ * }
+ * }
+ *
+ * // this has a risk of stack overflows if many results are cached in a row
+ * async.mapSeries(args, sometimesAsync, done);
+ *
+ * // this will defer sometimesAsync's callback if necessary,
+ * // preventing stack overflows
+ * async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
+ */
+function ensureAsync(fn) {
+ if (isAsync(fn)) return fn;
+ return initialParams(function (args, callback) {
+ var sync = true;
+ args.push(function () {
+ var innerArgs = arguments;
+ if (sync) {
+ setImmediate$1(function () {
+ callback.apply(null, innerArgs);
+ });
+ } else {
+ callback.apply(null, innerArgs);
+ }
+ });
+ fn.apply(this, args);
+ sync = false;
+ });
+}
+
+function notId(v) {
+ return !v;
+}
+
+/**
+ * Returns `true` if every element in `coll` satisfies an async test. If any
+ * iteratee call returns `false`, the main `callback` is immediately called.
+ *
+ * @name every
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias all
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async truth test to apply to each item
+ * in the collection in parallel.
+ * The iteratee must complete with a boolean result value.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Result will be either `true` or `false`
+ * depending on the values of the async tests. Invoked with (err, result).
+ * @example
+ *
+ * async.every(['file1','file2','file3'], function(filePath, callback) {
+ * fs.access(filePath, function(err) {
+ * callback(null, !err)
+ * });
+ * }, function(err, result) {
+ * // if result is true then every file exists
+ * });
+ */
+var every = doParallel(_createTester(notId, notId));
+
+/**
+ * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
+ *
+ * @name everyLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.every]{@link module:Collections.every}
+ * @alias allLimit
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async truth test to apply to each item
+ * in the collection in parallel.
+ * The iteratee must complete with a boolean result value.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Result will be either `true` or `false`
+ * depending on the values of the async tests. Invoked with (err, result).
+ */
+var everyLimit = doParallelLimit(_createTester(notId, notId));
+
+/**
+ * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
+ *
+ * @name everySeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.every]{@link module:Collections.every}
+ * @alias allSeries
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async truth test to apply to each item
+ * in the collection in series.
+ * The iteratee must complete with a boolean result value.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Result will be either `true` or `false`
+ * depending on the values of the async tests. Invoked with (err, result).
+ */
+var everySeries = doLimit(everyLimit, 1);
+
+/**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new accessor function.
+ */
+function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+}
+
+function filterArray(eachfn, arr, iteratee, callback) {
+ var truthValues = new Array(arr.length);
+ eachfn(arr, function (x, index, callback) {
+ iteratee(x, function (err, v) {
+ truthValues[index] = !!v;
+ callback(err);
+ });
+ }, function (err) {
+ if (err) return callback(err);
+ var results = [];
+ for (var i = 0; i < arr.length; i++) {
+ if (truthValues[i]) results.push(arr[i]);
+ }
+ callback(null, results);
+ });
+}
+
+function filterGeneric(eachfn, coll, iteratee, callback) {
+ var results = [];
+ eachfn(coll, function (x, index, callback) {
+ iteratee(x, function (err, v) {
+ if (err) {
+ callback(err);
+ } else {
+ if (v) {
+ results.push({index: index, value: x});
+ }
+ callback();
+ }
+ });
+ }, function (err) {
+ if (err) {
+ callback(err);
+ } else {
+ callback(null, arrayMap(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), baseProperty('value')));
+ }
+ });
+}
+
+function _filter(eachfn, coll, iteratee, callback) {
+ var filter = isArrayLike(coll) ? filterArray : filterGeneric;
+ filter(eachfn, coll, wrapAsync(iteratee), callback || noop);
+}
+
+/**
+ * Returns a new array of all the values in `coll` which pass an async truth
+ * test. This operation is performed in parallel, but the results array will be
+ * in the same order as the original.
+ *
+ * @name filter
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias select
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {Function} iteratee - A truth test to apply to each item in `coll`.
+ * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
+ * with a boolean argument once it has completed. Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Invoked with (err, results).
+ * @example
+ *
+ * async.filter(['file1','file2','file3'], function(filePath, callback) {
+ * fs.access(filePath, function(err) {
+ * callback(null, !err)
+ * });
+ * }, function(err, results) {
+ * // results now equals an array of the existing files
+ * });
+ */
+var filter = doParallel(_filter);
+
+/**
+ * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name filterLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.filter]{@link module:Collections.filter}
+ * @alias selectLimit
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {Function} iteratee - A truth test to apply to each item in `coll`.
+ * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
+ * with a boolean argument once it has completed. Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Invoked with (err, results).
+ */
+var filterLimit = doParallelLimit(_filter);
+
+/**
+ * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.
+ *
+ * @name filterSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.filter]{@link module:Collections.filter}
+ * @alias selectSeries
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {Function} iteratee - A truth test to apply to each item in `coll`.
+ * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
+ * with a boolean argument once it has completed. Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Invoked with (err, results)
+ */
+var filterSeries = doLimit(filterLimit, 1);
+
+/**
+ * Calls the asynchronous function `fn` with a callback parameter that allows it
+ * to call itself again, in series, indefinitely.
+
+ * If an error is passed to the callback then `errback` is called with the
+ * error, and execution stops, otherwise it will never be called.
+ *
+ * @name forever
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {AsyncFunction} fn - an async function to call repeatedly.
+ * Invoked with (next).
+ * @param {Function} [errback] - when `fn` passes an error to it's callback,
+ * this function will be called, and execution stops. Invoked with (err).
+ * @example
+ *
+ * async.forever(
+ * function(next) {
+ * // next is suitable for passing to things that need a callback(err [, whatever]);
+ * // it will result in this function being called again.
+ * },
+ * function(err) {
+ * // if next is called with a value in its first parameter, it will appear
+ * // in here as 'err', and execution will stop.
+ * }
+ * );
+ */
+function forever(fn, errback) {
+ var done = onlyOnce(errback || noop);
+ var task = wrapAsync(ensureAsync(fn));
+
+ function next(err) {
+ if (err) return done(err);
+ task(next);
+ }
+ next();
+}
+
+/**
+ * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time.
+ *
+ * @name groupByLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.groupBy]{@link module:Collections.groupBy}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The iteratee should complete with a `key` to group the value under.
+ * Invoked with (value, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. Result is an `Object` whoses
+ * properties are arrays of values which returned the corresponding key.
+ */
+var groupByLimit = function(coll, limit, iteratee, callback) {
+ callback = callback || noop;
+ var _iteratee = wrapAsync(iteratee);
+ mapLimit(coll, limit, function(val, callback) {
+ _iteratee(val, function(err, key) {
+ if (err) return callback(err);
+ return callback(null, {key: key, val: val});
+ });
+ }, function(err, mapResults) {
+ var result = {};
+ // from MDN, handle object having an `hasOwnProperty` prop
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+ for (var i = 0; i < mapResults.length; i++) {
+ if (mapResults[i]) {
+ var key = mapResults[i].key;
+ var val = mapResults[i].val;
+
+ if (hasOwnProperty.call(result, key)) {
+ result[key].push(val);
+ } else {
+ result[key] = [val];
+ }
+ }
+ }
+
+ return callback(err, result);
+ });
+};
+
+/**
+ * Returns a new object, where each value corresponds to an array of items, from
+ * `coll`, that returned the corresponding key. That is, the keys of the object
+ * correspond to the values passed to the `iteratee` callback.
+ *
+ * Note: Since this function applies the `iteratee` to each item in parallel,
+ * there is no guarantee that the `iteratee` functions will complete in order.
+ * However, the values for each key in the `result` will be in the same order as
+ * the original `coll`. For Objects, the values will roughly be in the order of
+ * the original Objects' keys (but this can vary across JavaScript engines).
+ *
+ * @name groupBy
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The iteratee should complete with a `key` to group the value under.
+ * Invoked with (value, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. Result is an `Object` whoses
+ * properties are arrays of values which returned the corresponding key.
+ * @example
+ *
+ * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) {
+ * db.findById(userId, function(err, user) {
+ * if (err) return callback(err);
+ * return callback(null, user.age);
+ * });
+ * }, function(err, result) {
+ * // result is object containing the userIds grouped by age
+ * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']};
+ * });
+ */
+var groupBy = doLimit(groupByLimit, Infinity);
+
+/**
+ * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time.
+ *
+ * @name groupBySeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.groupBy]{@link module:Collections.groupBy}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The iteratee should complete with a `key` to group the value under.
+ * Invoked with (value, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. Result is an `Object` whoses
+ * properties are arrays of values which returned the corresponding key.
+ */
+var groupBySeries = doLimit(groupByLimit, 1);
+
+/**
+ * Logs the result of an `async` function to the `console`. Only works in
+ * Node.js or in browsers that support `console.log` and `console.error` (such
+ * as FF and Chrome). If multiple arguments are returned from the async
+ * function, `console.log` is called on each argument in order.
+ *
+ * @name log
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @category Util
+ * @param {AsyncFunction} function - The function you want to eventually apply
+ * all arguments to.
+ * @param {...*} arguments... - Any number of arguments to apply to the function.
+ * @example
+ *
+ * // in a module
+ * var hello = function(name, callback) {
+ * setTimeout(function() {
+ * callback(null, 'hello ' + name);
+ * }, 1000);
+ * };
+ *
+ * // in the node repl
+ * node> async.log(hello, 'world');
+ * 'hello world'
+ */
+var log = consoleFunc('log');
+
+/**
+ * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name mapValuesLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.mapValues]{@link module:Collections.mapValues}
+ * @category Collection
+ * @param {Object} obj - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - A function to apply to each value and key
+ * in `coll`.
+ * The iteratee should complete with the transformed value as its result.
+ * Invoked with (value, key, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. `result` is a new object consisting
+ * of each key from `obj`, with each transformed value on the right-hand side.
+ * Invoked with (err, result).
+ */
+function mapValuesLimit(obj, limit, iteratee, callback) {
+ callback = once(callback || noop);
+ var newObj = {};
+ var _iteratee = wrapAsync(iteratee);
+ eachOfLimit(obj, limit, function(val, key, next) {
+ _iteratee(val, key, function (err, result) {
+ if (err) return next(err);
+ newObj[key] = result;
+ next();
+ });
+ }, function (err) {
+ callback(err, newObj);
+ });
+}
+
+/**
+ * A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
+ *
+ * Produces a new Object by mapping each value of `obj` through the `iteratee`
+ * function. The `iteratee` is called each `value` and `key` from `obj` and a
+ * callback for when it has finished processing. Each of these callbacks takes
+ * two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
+ * passes an error to its callback, the main `callback` (for the `mapValues`
+ * function) is immediately called with the error.
+ *
+ * Note, the order of the keys in the result is not guaranteed. The keys will
+ * be roughly in the order they complete, (but this is very engine-specific)
+ *
+ * @name mapValues
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @category Collection
+ * @param {Object} obj - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - A function to apply to each value and key
+ * in `coll`.
+ * The iteratee should complete with the transformed value as its result.
+ * Invoked with (value, key, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. `result` is a new object consisting
+ * of each key from `obj`, with each transformed value on the right-hand side.
+ * Invoked with (err, result).
+ * @example
+ *
+ * async.mapValues({
+ * f1: 'file1',
+ * f2: 'file2',
+ * f3: 'file3'
+ * }, function (file, key, callback) {
+ * fs.stat(file, callback);
+ * }, function(err, result) {
+ * // result is now a map of stats for each file, e.g.
+ * // {
+ * // f1: [stats for file1],
+ * // f2: [stats for file2],
+ * // f3: [stats for file3]
+ * // }
+ * });
+ */
+
+var mapValues = doLimit(mapValuesLimit, Infinity);
+
+/**
+ * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time.
+ *
+ * @name mapValuesSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.mapValues]{@link module:Collections.mapValues}
+ * @category Collection
+ * @param {Object} obj - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - A function to apply to each value and key
+ * in `coll`.
+ * The iteratee should complete with the transformed value as its result.
+ * Invoked with (value, key, callback).
+ * @param {Function} [callback] - A callback which is called when all `iteratee`
+ * functions have finished, or an error occurs. `result` is a new object consisting
+ * of each key from `obj`, with each transformed value on the right-hand side.
+ * Invoked with (err, result).
+ */
+var mapValuesSeries = doLimit(mapValuesLimit, 1);
+
+function has(obj, key) {
+ return key in obj;
+}
+
+/**
+ * Caches the results of an async function. When creating a hash to store
+ * function results against, the callback is omitted from the hash and an
+ * optional hash function can be used.
+ *
+ * If no hash function is specified, the first argument is used as a hash key,
+ * which may work reasonably if it is a string or a data type that converts to a
+ * distinct string. Note that objects and arrays will not behave reasonably.
+ * Neither will cases where the other arguments are significant. In such cases,
+ * specify your own hash function.
+ *
+ * The cache of results is exposed as the `memo` property of the function
+ * returned by `memoize`.
+ *
+ * @name memoize
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @category Util
+ * @param {AsyncFunction} fn - The async function to proxy and cache results from.
+ * @param {Function} hasher - An optional function for generating a custom hash
+ * for storing results. It has all the arguments applied to it apart from the
+ * callback, and must be synchronous.
+ * @returns {AsyncFunction} a memoized version of `fn`
+ * @example
+ *
+ * var slow_fn = function(name, callback) {
+ * // do something
+ * callback(null, result);
+ * };
+ * var fn = async.memoize(slow_fn);
+ *
+ * // fn can now be used as if it were slow_fn
+ * fn('some name', function() {
+ * // callback
+ * });
+ */
+function memoize(fn, hasher) {
+ var memo = Object.create(null);
+ var queues = Object.create(null);
+ hasher = hasher || identity;
+ var _fn = wrapAsync(fn);
+ var memoized = initialParams(function memoized(args, callback) {
+ var key = hasher.apply(null, args);
+ if (has(memo, key)) {
+ setImmediate$1(function() {
+ callback.apply(null, memo[key]);
+ });
+ } else if (has(queues, key)) {
+ queues[key].push(callback);
+ } else {
+ queues[key] = [callback];
+ _fn.apply(null, args.concat(function(/*args*/) {
+ var args = slice(arguments);
+ memo[key] = args;
+ var q = queues[key];
+ delete queues[key];
+ for (var i = 0, l = q.length; i < l; i++) {
+ q[i].apply(null, args);
+ }
+ }));
+ }
+ });
+ memoized.memo = memo;
+ memoized.unmemoized = fn;
+ return memoized;
+}
+
+/**
+ * Calls `callback` on a later loop around the event loop. In Node.js this just
+ * calls `process.nextTick`. In the browser it will use `setImmediate` if
+ * available, otherwise `setTimeout(callback, 0)`, which means other higher
+ * priority events may precede the execution of `callback`.
+ *
+ * This is used internally for browser-compatibility purposes.
+ *
+ * @name nextTick
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @see [async.setImmediate]{@link module:Utils.setImmediate}
+ * @category Util
+ * @param {Function} callback - The function to call on a later loop around
+ * the event loop. Invoked with (args...).
+ * @param {...*} args... - any number of additional arguments to pass to the
+ * callback on the next tick.
+ * @example
+ *
+ * var call_order = [];
+ * async.nextTick(function() {
+ * call_order.push('two');
+ * // call_order now equals ['one','two']
+ * });
+ * call_order.push('one');
+ *
+ * async.setImmediate(function (a, b, c) {
+ * // a, b, and c equal 1, 2, and 3
+ * }, 1, 2, 3);
+ */
+var _defer$1;
+
+if (hasNextTick) {
+ _defer$1 = process.nextTick;
+} else if (hasSetImmediate) {
+ _defer$1 = setImmediate;
+} else {
+ _defer$1 = fallback;
+}
+
+var nextTick = wrap(_defer$1);
+
+function _parallel(eachfn, tasks, callback) {
+ callback = callback || noop;
+ var results = isArrayLike(tasks) ? [] : {};
+
+ eachfn(tasks, function (task, key, callback) {
+ wrapAsync(task)(function (err, result) {
+ if (arguments.length > 2) {
+ result = slice(arguments, 1);
+ }
+ results[key] = result;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+}
+
+/**
+ * Run the `tasks` collection of functions in parallel, without waiting until
+ * the previous function has completed. If any of the functions pass an error to
+ * its callback, the main `callback` is immediately called with the value of the
+ * error. Once the `tasks` have completed, the results are passed to the final
+ * `callback` as an array.
+ *
+ * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about
+ * parallel execution of code. If your tasks do not use any timers or perform
+ * any I/O, they will actually be executed in series. Any synchronous setup
+ * sections for each task will happen one after the other. JavaScript remains
+ * single-threaded.
+ *
+ * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the
+ * execution of other tasks when a task fails.
+ *
+ * It is also possible to use an object instead of an array. Each property will
+ * be run as a function and the results will be passed to the final `callback`
+ * as an object instead of an array. This can be a more readable way of handling
+ * results from {@link async.parallel}.
+ *
+ * @name parallel
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array|Iterable|Object} tasks - A collection of
+ * [async functions]{@link AsyncFunction} to run.
+ * Each async function can complete with any number of optional `result` values.
+ * @param {Function} [callback] - An optional callback to run once all the
+ * functions have completed successfully. This function gets a results array
+ * (or object) containing all the result arguments passed to the task callbacks.
+ * Invoked with (err, results).
+ *
+ * @example
+ * async.parallel([
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'one');
+ * }, 200);
+ * },
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'two');
+ * }, 100);
+ * }
+ * ],
+ * // optional callback
+ * function(err, results) {
+ * // the results array will equal ['one','two'] even though
+ * // the second function had a shorter timeout.
+ * });
+ *
+ * // an example using an object instead of an array
+ * async.parallel({
+ * one: function(callback) {
+ * setTimeout(function() {
+ * callback(null, 1);
+ * }, 200);
+ * },
+ * two: function(callback) {
+ * setTimeout(function() {
+ * callback(null, 2);
+ * }, 100);
+ * }
+ * }, function(err, results) {
+ * // results is now equals to: {one: 1, two: 2}
+ * });
+ */
+function parallelLimit(tasks, callback) {
+ _parallel(eachOf, tasks, callback);
+}
+
+/**
+ * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name parallelLimit
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.parallel]{@link module:ControlFlow.parallel}
+ * @category Control Flow
+ * @param {Array|Iterable|Object} tasks - A collection of
+ * [async functions]{@link AsyncFunction} to run.
+ * Each async function can complete with any number of optional `result` values.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {Function} [callback] - An optional callback to run once all the
+ * functions have completed successfully. This function gets a results array
+ * (or object) containing all the result arguments passed to the task callbacks.
+ * Invoked with (err, results).
+ */
+function parallelLimit$1(tasks, limit, callback) {
+ _parallel(_eachOfLimit(limit), tasks, callback);
+}
+
+/**
+ * A queue of tasks for the worker function to complete.
+ * @typedef {Object} QueueObject
+ * @memberOf module:ControlFlow
+ * @property {Function} length - a function returning the number of items
+ * waiting to be processed. Invoke with `queue.length()`.
+ * @property {boolean} started - a boolean indicating whether or not any
+ * items have been pushed and processed by the queue.
+ * @property {Function} running - a function returning the number of items
+ * currently being processed. Invoke with `queue.running()`.
+ * @property {Function} workersList - a function returning the array of items
+ * currently being processed. Invoke with `queue.workersList()`.
+ * @property {Function} idle - a function returning false if there are items
+ * waiting or being processed, or true if not. Invoke with `queue.idle()`.
+ * @property {number} concurrency - an integer for determining how many `worker`
+ * functions should be run in parallel. This property can be changed after a
+ * `queue` is created to alter the concurrency on-the-fly.
+ * @property {Function} push - add a new task to the `queue`. Calls `callback`
+ * once the `worker` has finished processing the task. Instead of a single task,
+ * a `tasks` array can be submitted. The respective callback is used for every
+ * task in the list. Invoke with `queue.push(task, [callback])`,
+ * @property {Function} unshift - add a new task to the front of the `queue`.
+ * Invoke with `queue.unshift(task, [callback])`.
+ * @property {Function} remove - remove items from the queue that match a test
+ * function. The test function will be passed an object with a `data` property,
+ * and a `priority` property, if this is a
+ * [priorityQueue]{@link module:ControlFlow.priorityQueue} object.
+ * Invoked with `queue.remove(testFn)`, where `testFn` is of the form
+ * `function ({data, priority}) {}` and returns a Boolean.
+ * @property {Function} saturated - a callback that is called when the number of
+ * running workers hits the `concurrency` limit, and further tasks will be
+ * queued.
+ * @property {Function} unsaturated - a callback that is called when the number
+ * of running workers is less than the `concurrency` & `buffer` limits, and
+ * further tasks will not be queued.
+ * @property {number} buffer - A minimum threshold buffer in order to say that
+ * the `queue` is `unsaturated`.
+ * @property {Function} empty - a callback that is called when the last item
+ * from the `queue` is given to a `worker`.
+ * @property {Function} drain - a callback that is called when the last item
+ * from the `queue` has returned from the `worker`.
+ * @property {Function} error - a callback that is called when a task errors.
+ * Has the signature `function(error, task)`.
+ * @property {boolean} paused - a boolean for determining whether the queue is
+ * in a paused state.
+ * @property {Function} pause - a function that pauses the processing of tasks
+ * until `resume()` is called. Invoke with `queue.pause()`.
+ * @property {Function} resume - a function that resumes the processing of
+ * queued tasks when the queue is paused. Invoke with `queue.resume()`.
+ * @property {Function} kill - a function that removes the `drain` callback and
+ * empties remaining tasks from the queue forcing it to go idle. No more tasks
+ * should be pushed to the queue after calling this function. Invoke with `queue.kill()`.
+ */
+
+/**
+ * Creates a `queue` object with the specified `concurrency`. Tasks added to the
+ * `queue` are processed in parallel (up to the `concurrency` limit). If all
+ * `worker`s are in progress, the task is queued until one becomes available.
+ * Once a `worker` completes a `task`, that `task`'s callback is called.
+ *
+ * @name queue
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {AsyncFunction} worker - An async function for processing a queued task.
+ * If you want to handle errors from an individual task, pass a callback to
+ * `q.push()`. Invoked with (task, callback).
+ * @param {number} [concurrency=1] - An `integer` for determining how many
+ * `worker` functions should be run in parallel. If omitted, the concurrency
+ * defaults to `1`. If the concurrency is `0`, an error is thrown.
+ * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can
+ * attached as certain properties to listen for specific events during the
+ * lifecycle of the queue.
+ * @example
+ *
+ * // create a queue object with concurrency 2
+ * var q = async.queue(function(task, callback) {
+ * console.log('hello ' + task.name);
+ * callback();
+ * }, 2);
+ *
+ * // assign a callback
+ * q.drain = function() {
+ * console.log('all items have been processed');
+ * };
+ *
+ * // add some items to the queue
+ * q.push({name: 'foo'}, function(err) {
+ * console.log('finished processing foo');
+ * });
+ * q.push({name: 'bar'}, function (err) {
+ * console.log('finished processing bar');
+ * });
+ *
+ * // add some items to the queue (batch-wise)
+ * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) {
+ * console.log('finished processing item');
+ * });
+ *
+ * // add some items to the front of the queue
+ * q.unshift({name: 'bar'}, function (err) {
+ * console.log('finished processing bar');
+ * });
+ */
+var queue$1 = function (worker, concurrency) {
+ var _worker = wrapAsync(worker);
+ return queue(function (items, cb) {
+ _worker(items[0], cb);
+ }, concurrency, 1);
+};
+
+/**
+ * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and
+ * completed in ascending priority order.
+ *
+ * @name priorityQueue
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.queue]{@link module:ControlFlow.queue}
+ * @category Control Flow
+ * @param {AsyncFunction} worker - An async function for processing a queued task.
+ * If you want to handle errors from an individual task, pass a callback to
+ * `q.push()`.
+ * Invoked with (task, callback).
+ * @param {number} concurrency - An `integer` for determining how many `worker`
+ * functions should be run in parallel. If omitted, the concurrency defaults to
+ * `1`. If the concurrency is `0`, an error is thrown.
+ * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two
+ * differences between `queue` and `priorityQueue` objects:
+ * * `push(task, priority, [callback])` - `priority` should be a number. If an
+ * array of `tasks` is given, all tasks will be assigned the same priority.
+ * * The `unshift` method was removed.
+ */
+var priorityQueue = function(worker, concurrency) {
+ // Start with a normal queue
+ var q = queue$1(worker, concurrency);
+
+ // Override push to accept second parameter representing priority
+ q.push = function(data, priority, callback) {
+ if (callback == null) callback = noop;
+ if (typeof callback !== 'function') {
+ throw new Error('task callback must be a function');
+ }
+ q.started = true;
+ if (!isArray(data)) {
+ data = [data];
+ }
+ if (data.length === 0) {
+ // call drain immediately if there are no tasks
+ return setImmediate$1(function() {
+ q.drain();
+ });
+ }
+
+ priority = priority || 0;
+ var nextNode = q._tasks.head;
+ while (nextNode && priority >= nextNode.priority) {
+ nextNode = nextNode.next;
+ }
+
+ for (var i = 0, l = data.length; i < l; i++) {
+ var item = {
+ data: data[i],
+ priority: priority,
+ callback: callback
+ };
+
+ if (nextNode) {
+ q._tasks.insertBefore(nextNode, item);
+ } else {
+ q._tasks.push(item);
+ }
+ }
+ setImmediate$1(q.process);
+ };
+
+ // Remove unshift function
+ delete q.unshift;
+
+ return q;
+};
+
+/**
+ * Runs the `tasks` array of functions in parallel, without waiting until the
+ * previous function has completed. Once any of the `tasks` complete or pass an
+ * error to its callback, the main `callback` is immediately called. It's
+ * equivalent to `Promise.race()`.
+ *
+ * @name race
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction}
+ * to run. Each function can complete with an optional `result` value.
+ * @param {Function} callback - A callback to run once any of the functions have
+ * completed. This function gets an error or result from the first function that
+ * completed. Invoked with (err, result).
+ * @returns undefined
+ * @example
+ *
+ * async.race([
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'one');
+ * }, 200);
+ * },
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'two');
+ * }, 100);
+ * }
+ * ],
+ * // main callback
+ * function(err, result) {
+ * // the result will be equal to 'two' as it finishes earlier
+ * });
+ */
+function race(tasks, callback) {
+ callback = once(callback || noop);
+ if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
+ if (!tasks.length) return callback();
+ for (var i = 0, l = tasks.length; i < l; i++) {
+ wrapAsync(tasks[i])(callback);
+ }
+}
+
+/**
+ * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
+ *
+ * @name reduceRight
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.reduce]{@link module:Collections.reduce}
+ * @alias foldr
+ * @category Collection
+ * @param {Array} array - A collection to iterate over.
+ * @param {*} memo - The initial state of the reduction.
+ * @param {AsyncFunction} iteratee - A function applied to each item in the
+ * array to produce the next step in the reduction.
+ * The `iteratee` should complete with the next state of the reduction.
+ * If the iteratee complete with an error, the reduction is stopped and the
+ * main `callback` is immediately called with the error.
+ * Invoked with (memo, item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Result is the reduced value. Invoked with
+ * (err, result).
+ */
+function reduceRight (array, memo, iteratee, callback) {
+ var reversed = slice(array).reverse();
+ reduce(reversed, memo, iteratee, callback);
+}
+
+/**
+ * Wraps the async function in another function that always completes with a
+ * result object, even when it errors.
+ *
+ * The result object has either the property `error` or `value`.
+ *
+ * @name reflect
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @category Util
+ * @param {AsyncFunction} fn - The async function you want to wrap
+ * @returns {Function} - A function that always passes null to it's callback as
+ * the error. The second argument to the callback will be an `object` with
+ * either an `error` or a `value` property.
+ * @example
+ *
+ * async.parallel([
+ * async.reflect(function(callback) {
+ * // do some stuff ...
+ * callback(null, 'one');
+ * }),
+ * async.reflect(function(callback) {
+ * // do some more stuff but error ...
+ * callback('bad stuff happened');
+ * }),
+ * async.reflect(function(callback) {
+ * // do some more stuff ...
+ * callback(null, 'two');
+ * })
+ * ],
+ * // optional callback
+ * function(err, results) {
+ * // values
+ * // results[0].value = 'one'
+ * // results[1].error = 'bad stuff happened'
+ * // results[2].value = 'two'
+ * });
+ */
+function reflect(fn) {
+ var _fn = wrapAsync(fn);
+ return initialParams(function reflectOn(args, reflectCallback) {
+ args.push(function callback(error, cbArg) {
+ if (error) {
+ reflectCallback(null, { error: error });
+ } else {
+ var value;
+ if (arguments.length <= 2) {
+ value = cbArg;
+ } else {
+ value = slice(arguments, 1);
+ }
+ reflectCallback(null, { value: value });
+ }
+ });
+
+ return _fn.apply(this, args);
+ });
+}
+
+/**
+ * A helper function that wraps an array or an object of functions with `reflect`.
+ *
+ * @name reflectAll
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @see [async.reflect]{@link module:Utils.reflect}
+ * @category Util
+ * @param {Array|Object|Iterable} tasks - The collection of
+ * [async functions]{@link AsyncFunction} to wrap in `async.reflect`.
+ * @returns {Array} Returns an array of async functions, each wrapped in
+ * `async.reflect`
+ * @example
+ *
+ * let tasks = [
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'one');
+ * }, 200);
+ * },
+ * function(callback) {
+ * // do some more stuff but error ...
+ * callback(new Error('bad stuff happened'));
+ * },
+ * function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'two');
+ * }, 100);
+ * }
+ * ];
+ *
+ * async.parallel(async.reflectAll(tasks),
+ * // optional callback
+ * function(err, results) {
+ * // values
+ * // results[0].value = 'one'
+ * // results[1].error = Error('bad stuff happened')
+ * // results[2].value = 'two'
+ * });
+ *
+ * // an example using an object instead of an array
+ * let tasks = {
+ * one: function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'one');
+ * }, 200);
+ * },
+ * two: function(callback) {
+ * callback('two');
+ * },
+ * three: function(callback) {
+ * setTimeout(function() {
+ * callback(null, 'three');
+ * }, 100);
+ * }
+ * };
+ *
+ * async.parallel(async.reflectAll(tasks),
+ * // optional callback
+ * function(err, results) {
+ * // values
+ * // results.one.value = 'one'
+ * // results.two.error = 'two'
+ * // results.three.value = 'three'
+ * });
+ */
+function reflectAll(tasks) {
+ var results;
+ if (isArray(tasks)) {
+ results = arrayMap(tasks, reflect);
+ } else {
+ results = {};
+ baseForOwn(tasks, function(task, key) {
+ results[key] = reflect.call(this, task);
+ });
+ }
+ return results;
+}
+
+function reject$1(eachfn, arr, iteratee, callback) {
+ _filter(eachfn, arr, function(value, cb) {
+ iteratee(value, function(err, v) {
+ cb(err, !v);
+ });
+ }, callback);
+}
+
+/**
+ * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test.
+ *
+ * @name reject
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.filter]{@link module:Collections.filter}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {Function} iteratee - An async truth test to apply to each item in
+ * `coll`.
+ * The should complete with a boolean value as its `result`.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Invoked with (err, results).
+ * @example
+ *
+ * async.reject(['file1','file2','file3'], function(filePath, callback) {
+ * fs.access(filePath, function(err) {
+ * callback(null, !err)
+ * });
+ * }, function(err, results) {
+ * // results now equals an array of missing files
+ * createFiles(results);
+ * });
+ */
+var reject = doParallel(reject$1);
+
+/**
+ * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name rejectLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.reject]{@link module:Collections.reject}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {Function} iteratee - An async truth test to apply to each item in
+ * `coll`.
+ * The should complete with a boolean value as its `result`.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Invoked with (err, results).
+ */
+var rejectLimit = doParallelLimit(reject$1);
+
+/**
+ * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time.
+ *
+ * @name rejectSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.reject]{@link module:Collections.reject}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {Function} iteratee - An async truth test to apply to each item in
+ * `coll`.
+ * The should complete with a boolean value as its `result`.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Invoked with (err, results).
+ */
+var rejectSeries = doLimit(rejectLimit, 1);
+
+/**
+ * Creates a function that returns `value`.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.4.0
+ * @category Util
+ * @param {*} value The value to return from the new function.
+ * @returns {Function} Returns the new constant function.
+ * @example
+ *
+ * var objects = _.times(2, _.constant({ 'a': 1 }));
+ *
+ * console.log(objects);
+ * // => [{ 'a': 1 }, { 'a': 1 }]
+ *
+ * console.log(objects[0] === objects[1]);
+ * // => true
+ */
+function constant$1(value) {
+ return function() {
+ return value;
+ };
+}
+
+/**
+ * Attempts to get a successful response from `task` no more than `times` times
+ * before returning an error. If the task is successful, the `callback` will be
+ * passed the result of the successful task. If all attempts fail, the callback
+ * will be passed the error and result (if any) of the final attempt.
+ *
+ * @name retry
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @see [async.retryable]{@link module:ControlFlow.retryable}
+ * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an
+ * object with `times` and `interval` or a number.
+ * * `times` - The number of attempts to make before giving up. The default
+ * is `5`.
+ * * `interval` - The time to wait between retries, in milliseconds. The
+ * default is `0`. The interval may also be specified as a function of the
+ * retry count (see example).
+ * * `errorFilter` - An optional synchronous function that is invoked on
+ * erroneous result. If it returns `true` the retry attempts will continue;
+ * if the function returns `false` the retry flow is aborted with the current
+ * attempt's error and result being returned to the final callback.
+ * Invoked with (err).
+ * * If `opts` is a number, the number specifies the number of times to retry,
+ * with the default interval of `0`.
+ * @param {AsyncFunction} task - An async function to retry.
+ * Invoked with (callback).
+ * @param {Function} [callback] - An optional callback which is called when the
+ * task has succeeded, or after the final failed attempt. It receives the `err`
+ * and `result` arguments of the last attempt at completing the `task`. Invoked
+ * with (err, results).
+ *
+ * @example
+ *
+ * // The `retry` function can be used as a stand-alone control flow by passing
+ * // a callback, as shown below:
+ *
+ * // try calling apiMethod 3 times
+ * async.retry(3, apiMethod, function(err, result) {
+ * // do something with the result
+ * });
+ *
+ * // try calling apiMethod 3 times, waiting 200 ms between each retry
+ * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
+ * // do something with the result
+ * });
+ *
+ * // try calling apiMethod 10 times with exponential backoff
+ * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds)
+ * async.retry({
+ * times: 10,
+ * interval: function(retryCount) {
+ * return 50 * Math.pow(2, retryCount);
+ * }
+ * }, apiMethod, function(err, result) {
+ * // do something with the result
+ * });
+ *
+ * // try calling apiMethod the default 5 times no delay between each retry
+ * async.retry(apiMethod, function(err, result) {
+ * // do something with the result
+ * });
+ *
+ * // try calling apiMethod only when error condition satisfies, all other
+ * // errors will abort the retry control flow and return to final callback
+ * async.retry({
+ * errorFilter: function(err) {
+ * return err.message === 'Temporary error'; // only retry on a specific error
+ * }
+ * }, apiMethod, function(err, result) {
+ * // do something with the result
+ * });
+ *
+ * // to retry individual methods that are not as reliable within other
+ * // control flow functions, use the `retryable` wrapper:
+ * async.auto({
+ * users: api.getUsers.bind(api),
+ * payments: async.retryable(3, api.getPayments.bind(api))
+ * }, function(err, results) {
+ * // do something with the results
+ * });
+ *
+ */
+function retry(opts, task, callback) {
+ var DEFAULT_TIMES = 5;
+ var DEFAULT_INTERVAL = 0;
+
+ var options = {
+ times: DEFAULT_TIMES,
+ intervalFunc: constant$1(DEFAULT_INTERVAL)
+ };
+
+ function parseTimes(acc, t) {
+ if (typeof t === 'object') {
+ acc.times = +t.times || DEFAULT_TIMES;
+
+ acc.intervalFunc = typeof t.interval === 'function' ?
+ t.interval :
+ constant$1(+t.interval || DEFAULT_INTERVAL);
+
+ acc.errorFilter = t.errorFilter;
+ } else if (typeof t === 'number' || typeof t === 'string') {
+ acc.times = +t || DEFAULT_TIMES;
+ } else {
+ throw new Error("Invalid arguments for async.retry");
+ }
+ }
+
+ if (arguments.length < 3 && typeof opts === 'function') {
+ callback = task || noop;
+ task = opts;
+ } else {
+ parseTimes(options, opts);
+ callback = callback || noop;
+ }
+
+ if (typeof task !== 'function') {
+ throw new Error("Invalid arguments for async.retry");
+ }
+
+ var _task = wrapAsync(task);
+
+ var attempt = 1;
+ function retryAttempt() {
+ _task(function(err) {
+ if (err && attempt++ < options.times &&
+ (typeof options.errorFilter != 'function' ||
+ options.errorFilter(err))) {
+ setTimeout(retryAttempt, options.intervalFunc(attempt));
+ } else {
+ callback.apply(null, arguments);
+ }
+ });
+ }
+
+ retryAttempt();
+}
+
+/**
+ * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method
+ * wraps a task and makes it retryable, rather than immediately calling it
+ * with retries.
+ *
+ * @name retryable
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.retry]{@link module:ControlFlow.retry}
+ * @category Control Flow
+ * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional
+ * options, exactly the same as from `retry`
+ * @param {AsyncFunction} task - the asynchronous function to wrap.
+ * This function will be passed any arguments passed to the returned wrapper.
+ * Invoked with (...args, callback).
+ * @returns {AsyncFunction} The wrapped function, which when invoked, will
+ * retry on an error, based on the parameters specified in `opts`.
+ * This function will accept the same parameters as `task`.
+ * @example
+ *
+ * async.auto({
+ * dep1: async.retryable(3, getFromFlakyService),
+ * process: ["dep1", async.retryable(3, function (results, cb) {
+ * maybeProcessData(results.dep1, cb);
+ * })]
+ * }, callback);
+ */
+var retryable = function (opts, task) {
+ if (!task) {
+ task = opts;
+ opts = null;
+ }
+ var _task = wrapAsync(task);
+ return initialParams(function (args, callback) {
+ function taskFn(cb) {
+ _task.apply(null, args.concat(cb));
+ }
+
+ if (opts) retry(opts, taskFn, callback);
+ else retry(taskFn, callback);
+
+ });
+};
+
+/**
+ * Run the functions in the `tasks` collection in series, each one running once
+ * the previous function has completed. If any functions in the series pass an
+ * error to its callback, no more functions are run, and `callback` is
+ * immediately called with the value of the error. Otherwise, `callback`
+ * receives an array of results when `tasks` have completed.
+ *
+ * It is also possible to use an object instead of an array. Each property will
+ * be run as a function, and the results will be passed to the final `callback`
+ * as an object instead of an array. This can be a more readable way of handling
+ * results from {@link async.series}.
+ *
+ * **Note** that while many implementations preserve the order of object
+ * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
+ * explicitly states that
+ *
+ * > The mechanics and order of enumerating the properties is not specified.
+ *
+ * So if you rely on the order in which your series of functions are executed,
+ * and want this to work on all platforms, consider using an array.
+ *
+ * @name series
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array|Iterable|Object} tasks - A collection containing
+ * [async functions]{@link AsyncFunction} to run in series.
+ * Each function can complete with any number of optional `result` values.
+ * @param {Function} [callback] - An optional callback to run once all the
+ * functions have completed. This function gets a results array (or object)
+ * containing all the result arguments passed to the `task` callbacks. Invoked
+ * with (err, result).
+ * @example
+ * async.series([
+ * function(callback) {
+ * // do some stuff ...
+ * callback(null, 'one');
+ * },
+ * function(callback) {
+ * // do some more stuff ...
+ * callback(null, 'two');
+ * }
+ * ],
+ * // optional callback
+ * function(err, results) {
+ * // results is now equal to ['one', 'two']
+ * });
+ *
+ * async.series({
+ * one: function(callback) {
+ * setTimeout(function() {
+ * callback(null, 1);
+ * }, 200);
+ * },
+ * two: function(callback){
+ * setTimeout(function() {
+ * callback(null, 2);
+ * }, 100);
+ * }
+ * }, function(err, results) {
+ * // results is now equal to: {one: 1, two: 2}
+ * });
+ */
+function series(tasks, callback) {
+ _parallel(eachOfSeries, tasks, callback);
+}
+
+/**
+ * Returns `true` if at least one element in the `coll` satisfies an async test.
+ * If any iteratee call returns `true`, the main `callback` is immediately
+ * called.
+ *
+ * @name some
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @alias any
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async truth test to apply to each item
+ * in the collections in parallel.
+ * The iteratee should complete with a boolean `result` value.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called as soon as any
+ * iteratee returns `true`, or after all the iteratee functions have finished.
+ * Result will be either `true` or `false` depending on the values of the async
+ * tests. Invoked with (err, result).
+ * @example
+ *
+ * async.some(['file1','file2','file3'], function(filePath, callback) {
+ * fs.access(filePath, function(err) {
+ * callback(null, !err)
+ * });
+ * }, function(err, result) {
+ * // if result is true then at least one of the files exists
+ * });
+ */
+var some = doParallel(_createTester(Boolean, identity));
+
+/**
+ * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
+ *
+ * @name someLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.some]{@link module:Collections.some}
+ * @alias anyLimit
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async truth test to apply to each item
+ * in the collections in parallel.
+ * The iteratee should complete with a boolean `result` value.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called as soon as any
+ * iteratee returns `true`, or after all the iteratee functions have finished.
+ * Result will be either `true` or `false` depending on the values of the async
+ * tests. Invoked with (err, result).
+ */
+var someLimit = doParallelLimit(_createTester(Boolean, identity));
+
+/**
+ * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
+ *
+ * @name someSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.some]{@link module:Collections.some}
+ * @alias anySeries
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async truth test to apply to each item
+ * in the collections in series.
+ * The iteratee should complete with a boolean `result` value.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called as soon as any
+ * iteratee returns `true`, or after all the iteratee functions have finished.
+ * Result will be either `true` or `false` depending on the values of the async
+ * tests. Invoked with (err, result).
+ */
+var someSeries = doLimit(someLimit, 1);
+
+/**
+ * Sorts a list by the results of running each `coll` value through an async
+ * `iteratee`.
+ *
+ * @name sortBy
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The iteratee should complete with a value to use as the sort criteria as
+ * its `result`.
+ * Invoked with (item, callback).
+ * @param {Function} callback - A callback which is called after all the
+ * `iteratee` functions have finished, or an error occurs. Results is the items
+ * from the original `coll` sorted by the values returned by the `iteratee`
+ * calls. Invoked with (err, results).
+ * @example
+ *
+ * async.sortBy(['file1','file2','file3'], function(file, callback) {
+ * fs.stat(file, function(err, stats) {
+ * callback(err, stats.mtime);
+ * });
+ * }, function(err, results) {
+ * // results is now the original array of files sorted by
+ * // modified date
+ * });
+ *
+ * // By modifying the callback parameter the
+ * // sorting order can be influenced:
+ *
+ * // ascending order
+ * async.sortBy([1,9,3,5], function(x, callback) {
+ * callback(null, x);
+ * }, function(err,result) {
+ * // result callback
+ * });
+ *
+ * // descending order
+ * async.sortBy([1,9,3,5], function(x, callback) {
+ * callback(null, x*-1); //<- x*-1 instead of x, turns the order around
+ * }, function(err,result) {
+ * // result callback
+ * });
+ */
+function sortBy (coll, iteratee, callback) {
+ var _iteratee = wrapAsync(iteratee);
+ map(coll, function (x, callback) {
+ _iteratee(x, function (err, criteria) {
+ if (err) return callback(err);
+ callback(null, {value: x, criteria: criteria});
+ });
+ }, function (err, results) {
+ if (err) return callback(err);
+ callback(null, arrayMap(results.sort(comparator), baseProperty('value')));
+ });
+
+ function comparator(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }
+}
+
+/**
+ * Sets a time limit on an asynchronous function. If the function does not call
+ * its callback within the specified milliseconds, it will be called with a
+ * timeout error. The code property for the error object will be `'ETIMEDOUT'`.
+ *
+ * @name timeout
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @category Util
+ * @param {AsyncFunction} asyncFn - The async function to limit in time.
+ * @param {number} milliseconds - The specified time limit.
+ * @param {*} [info] - Any variable you want attached (`string`, `object`, etc)
+ * to timeout Error for more information..
+ * @returns {AsyncFunction} Returns a wrapped function that can be used with any
+ * of the control flow functions.
+ * Invoke this function with the same parameters as you would `asyncFunc`.
+ * @example
+ *
+ * function myFunction(foo, callback) {
+ * doAsyncTask(foo, function(err, data) {
+ * // handle errors
+ * if (err) return callback(err);
+ *
+ * // do some stuff ...
+ *
+ * // return processed data
+ * return callback(null, data);
+ * });
+ * }
+ *
+ * var wrapped = async.timeout(myFunction, 1000);
+ *
+ * // call `wrapped` as you would `myFunction`
+ * wrapped({ bar: 'bar' }, function(err, data) {
+ * // if `myFunction` takes < 1000 ms to execute, `err`
+ * // and `data` will have their expected values
+ *
+ * // else `err` will be an Error with the code 'ETIMEDOUT'
+ * });
+ */
+function timeout(asyncFn, milliseconds, info) {
+ var fn = wrapAsync(asyncFn);
+
+ return initialParams(function (args, callback) {
+ var timedOut = false;
+ var timer;
+
+ function timeoutCallback() {
+ var name = asyncFn.name || 'anonymous';
+ var error = new Error('Callback function "' + name + '" timed out.');
+ error.code = 'ETIMEDOUT';
+ if (info) {
+ error.info = info;
+ }
+ timedOut = true;
+ callback(error);
+ }
+
+ args.push(function () {
+ if (!timedOut) {
+ callback.apply(null, arguments);
+ clearTimeout(timer);
+ }
+ });
+
+ // setup timer and call original function
+ timer = setTimeout(timeoutCallback, milliseconds);
+ fn.apply(null, args);
+ });
+}
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeCeil = Math.ceil;
+var nativeMax = Math.max;
+
+/**
+ * The base implementation of `_.range` and `_.rangeRight` which doesn't
+ * coerce arguments.
+ *
+ * @private
+ * @param {number} start The start of the range.
+ * @param {number} end The end of the range.
+ * @param {number} step The value to increment or decrement by.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Array} Returns the range of numbers.
+ */
+function baseRange(start, end, step, fromRight) {
+ var index = -1,
+ length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
+ result = Array(length);
+
+ while (length--) {
+ result[fromRight ? length : ++index] = start;
+ start += step;
+ }
+ return result;
+}
+
+/**
+ * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a
+ * time.
+ *
+ * @name timesLimit
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.times]{@link module:ControlFlow.times}
+ * @category Control Flow
+ * @param {number} count - The number of times to run the function.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - The async function to call `n` times.
+ * Invoked with the iteration index and a callback: (n, next).
+ * @param {Function} callback - see [async.map]{@link module:Collections.map}.
+ */
+function timeLimit(count, limit, iteratee, callback) {
+ var _iteratee = wrapAsync(iteratee);
+ mapLimit(baseRange(0, count, 1), limit, _iteratee, callback);
+}
+
+/**
+ * Calls the `iteratee` function `n` times, and accumulates results in the same
+ * manner you would use with [map]{@link module:Collections.map}.
+ *
+ * @name times
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.map]{@link module:Collections.map}
+ * @category Control Flow
+ * @param {number} n - The number of times to run the function.
+ * @param {AsyncFunction} iteratee - The async function to call `n` times.
+ * Invoked with the iteration index and a callback: (n, next).
+ * @param {Function} callback - see {@link module:Collections.map}.
+ * @example
+ *
+ * // Pretend this is some complicated async factory
+ * var createUser = function(id, callback) {
+ * callback(null, {
+ * id: 'user' + id
+ * });
+ * };
+ *
+ * // generate 5 users
+ * async.times(5, function(n, next) {
+ * createUser(n, function(err, user) {
+ * next(err, user);
+ * });
+ * }, function(err, users) {
+ * // we should now have 5 users
+ * });
+ */
+var times = doLimit(timeLimit, Infinity);
+
+/**
+ * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time.
+ *
+ * @name timesSeries
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.times]{@link module:ControlFlow.times}
+ * @category Control Flow
+ * @param {number} n - The number of times to run the function.
+ * @param {AsyncFunction} iteratee - The async function to call `n` times.
+ * Invoked with the iteration index and a callback: (n, next).
+ * @param {Function} callback - see {@link module:Collections.map}.
+ */
+var timesSeries = doLimit(timeLimit, 1);
+
+/**
+ * A relative of `reduce`. Takes an Object or Array, and iterates over each
+ * element in series, each step potentially mutating an `accumulator` value.
+ * The type of the accumulator defaults to the type of collection passed in.
+ *
+ * @name transform
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {*} [accumulator] - The initial state of the transform. If omitted,
+ * it will default to an empty Object or Array, depending on the type of `coll`
+ * @param {AsyncFunction} iteratee - A function applied to each item in the
+ * collection that potentially modifies the accumulator.
+ * Invoked with (accumulator, item, key, callback).
+ * @param {Function} [callback] - A callback which is called after all the
+ * `iteratee` functions have finished. Result is the transformed accumulator.
+ * Invoked with (err, result).
+ * @example
+ *
+ * async.transform([1,2,3], function(acc, item, index, callback) {
+ * // pointless async:
+ * process.nextTick(function() {
+ * acc.push(item * 2)
+ * callback(null)
+ * });
+ * }, function(err, result) {
+ * // result is now equal to [2, 4, 6]
+ * });
+ *
+ * @example
+ *
+ * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) {
+ * setImmediate(function () {
+ * obj[key] = val * 2;
+ * callback();
+ * })
+ * }, function (err, result) {
+ * // result is equal to {a: 2, b: 4, c: 6}
+ * })
+ */
+function transform (coll, accumulator, iteratee, callback) {
+ if (arguments.length <= 3) {
+ callback = iteratee;
+ iteratee = accumulator;
+ accumulator = isArray(coll) ? [] : {};
+ }
+ callback = once(callback || noop);
+ var _iteratee = wrapAsync(iteratee);
+
+ eachOf(coll, function(v, k, cb) {
+ _iteratee(accumulator, v, k, cb);
+ }, function(err) {
+ callback(err, accumulator);
+ });
+}
+
+/**
+ * It runs each task in series but stops whenever any of the functions were
+ * successful. If one of the tasks were successful, the `callback` will be
+ * passed the result of the successful task. If all tasks fail, the callback
+ * will be passed the error and result (if any) of the final attempt.
+ *
+ * @name tryEach
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array|Iterable|Object} tasks - A collection containing functions to
+ * run, each function is passed a `callback(err, result)` it must call on
+ * completion with an error `err` (which can be `null`) and an optional `result`
+ * value.
+ * @param {Function} [callback] - An optional callback which is called when one
+ * of the tasks has succeeded, or all have failed. It receives the `err` and
+ * `result` arguments of the last attempt at completing the `task`. Invoked with
+ * (err, results).
+ * @example
+ * async.tryEach([
+ * function getDataFromFirstWebsite(callback) {
+ * // Try getting the data from the first website
+ * callback(err, data);
+ * },
+ * function getDataFromSecondWebsite(callback) {
+ * // First website failed,
+ * // Try getting the data from the backup website
+ * callback(err, data);
+ * }
+ * ],
+ * // optional callback
+ * function(err, results) {
+ * Now do something with the data.
+ * });
+ *
+ */
+function tryEach(tasks, callback) {
+ var error = null;
+ var result;
+ callback = callback || noop;
+ eachSeries(tasks, function(task, callback) {
+ wrapAsync(task)(function (err, res/*, ...args*/) {
+ if (arguments.length > 2) {
+ result = slice(arguments, 1);
+ } else {
+ result = res;
+ }
+ error = err;
+ callback(!err);
+ });
+ }, function () {
+ callback(error, result);
+ });
+}
+
+/**
+ * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
+ * unmemoized form. Handy for testing.
+ *
+ * @name unmemoize
+ * @static
+ * @memberOf module:Utils
+ * @method
+ * @see [async.memoize]{@link module:Utils.memoize}
+ * @category Util
+ * @param {AsyncFunction} fn - the memoized function
+ * @returns {AsyncFunction} a function that calls the original unmemoized function
+ */
+function unmemoize(fn) {
+ return function () {
+ return (fn.unmemoized || fn).apply(null, arguments);
+ };
+}
+
+/**
+ * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
+ * stopped, or an error occurs.
+ *
+ * @name whilst
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Function} test - synchronous truth test to perform before each
+ * execution of `iteratee`. Invoked with ().
+ * @param {AsyncFunction} iteratee - An async function which is called each time
+ * `test` passes. Invoked with (callback).
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has failed and repeated execution of `iteratee` has stopped. `callback`
+ * will be passed an error and any arguments passed to the final `iteratee`'s
+ * callback. Invoked with (err, [results]);
+ * @returns undefined
+ * @example
+ *
+ * var count = 0;
+ * async.whilst(
+ * function() { return count < 5; },
+ * function(callback) {
+ * count++;
+ * setTimeout(function() {
+ * callback(null, count);
+ * }, 1000);
+ * },
+ * function (err, n) {
+ * // 5 seconds have passed, n = 5
+ * }
+ * );
+ */
+function whilst(test, iteratee, callback) {
+ callback = onlyOnce(callback || noop);
+ var _iteratee = wrapAsync(iteratee);
+ if (!test()) return callback(null);
+ var next = function(err/*, ...args*/) {
+ if (err) return callback(err);
+ if (test()) return _iteratee(next);
+ var args = slice(arguments, 1);
+ callback.apply(null, [null].concat(args));
+ };
+ _iteratee(next);
+}
+
+/**
+ * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when
+ * stopped, or an error occurs. `callback` will be passed an error and any
+ * arguments passed to the final `iteratee`'s callback.
+ *
+ * The inverse of [whilst]{@link module:ControlFlow.whilst}.
+ *
+ * @name until
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @see [async.whilst]{@link module:ControlFlow.whilst}
+ * @category Control Flow
+ * @param {Function} test - synchronous truth test to perform before each
+ * execution of `iteratee`. Invoked with ().
+ * @param {AsyncFunction} iteratee - An async function which is called each time
+ * `test` fails. Invoked with (callback).
+ * @param {Function} [callback] - A callback which is called after the test
+ * function has passed and repeated execution of `iteratee` has stopped. `callback`
+ * will be passed an error and any arguments passed to the final `iteratee`'s
+ * callback. Invoked with (err, [results]);
+ */
+function until(test, iteratee, callback) {
+ whilst(function() {
+ return !test.apply(this, arguments);
+ }, iteratee, callback);
+}
+
+/**
+ * Runs the `tasks` array of functions in series, each passing their results to
+ * the next in the array. However, if any of the `tasks` pass an error to their
+ * own callback, the next function is not executed, and the main `callback` is
+ * immediately called with the error.
+ *
+ * @name waterfall
+ * @static
+ * @memberOf module:ControlFlow
+ * @method
+ * @category Control Flow
+ * @param {Array} tasks - An array of [async functions]{@link AsyncFunction}
+ * to run.
+ * Each function should complete with any number of `result` values.
+ * The `result` values will be passed as arguments, in order, to the next task.
+ * @param {Function} [callback] - An optional callback to run once all the
+ * functions have completed. This will be passed the results of the last task's
+ * callback. Invoked with (err, [results]).
+ * @returns undefined
+ * @example
+ *
+ * async.waterfall([
+ * function(callback) {
+ * callback(null, 'one', 'two');
+ * },
+ * function(arg1, arg2, callback) {
+ * // arg1 now equals 'one' and arg2 now equals 'two'
+ * callback(null, 'three');
+ * },
+ * function(arg1, callback) {
+ * // arg1 now equals 'three'
+ * callback(null, 'done');
+ * }
+ * ], function (err, result) {
+ * // result now equals 'done'
+ * });
+ *
+ * // Or, with named functions:
+ * async.waterfall([
+ * myFirstFunction,
+ * mySecondFunction,
+ * myLastFunction,
+ * ], function (err, result) {
+ * // result now equals 'done'
+ * });
+ * function myFirstFunction(callback) {
+ * callback(null, 'one', 'two');
+ * }
+ * function mySecondFunction(arg1, arg2, callback) {
+ * // arg1 now equals 'one' and arg2 now equals 'two'
+ * callback(null, 'three');
+ * }
+ * function myLastFunction(arg1, callback) {
+ * // arg1 now equals 'three'
+ * callback(null, 'done');
+ * }
+ */
+var waterfall = function(tasks, callback) {
+ callback = once(callback || noop);
+ if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
+ if (!tasks.length) return callback();
+ var taskIndex = 0;
+
+ function nextTask(args) {
+ var task = wrapAsync(tasks[taskIndex++]);
+ args.push(onlyOnce(next));
+ task.apply(null, args);
+ }
+
+ function next(err/*, ...args*/) {
+ if (err || taskIndex === tasks.length) {
+ return callback.apply(null, arguments);
+ }
+ nextTask(slice(arguments, 1));
+ }
+
+ nextTask([]);
+};
+
+/**
+ * An "async function" in the context of Async is an asynchronous function with
+ * a variable number of parameters, with the final parameter being a callback.
+ * (`function (arg1, arg2, ..., callback) {}`)
+ * The final callback is of the form `callback(err, results...)`, which must be
+ * called once the function is completed. The callback should be called with a
+ * Error as its first argument to signal that an error occurred.
+ * Otherwise, if no error occurred, it should be called with `null` as the first
+ * argument, and any additional `result` arguments that may apply, to signal
+ * successful completion.
+ * The callback must be called exactly once, ideally on a later tick of the
+ * JavaScript event loop.
+ *
+ * This type of function is also referred to as a "Node-style async function",
+ * or a "continuation passing-style function" (CPS). Most of the methods of this
+ * library are themselves CPS/Node-style async functions, or functions that
+ * return CPS/Node-style async functions.
+ *
+ * Wherever we accept a Node-style async function, we also directly accept an
+ * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}.
+ * In this case, the `async` function will not be passed a final callback
+ * argument, and any thrown error will be used as the `err` argument of the
+ * implicit callback, and the return value will be used as the `result` value.
+ * (i.e. a `rejected` of the returned Promise becomes the `err` callback
+ * argument, and a `resolved` value becomes the `result`.)
+ *
+ * Note, due to JavaScript limitations, we can only detect native `async`
+ * functions and not transpilied implementations.
+ * Your environment must have `async`/`await` support for this to work.
+ * (e.g. Node > v7.6, or a recent version of a modern browser).
+ * If you are using `async` functions through a transpiler (e.g. Babel), you
+ * must still wrap the function with [asyncify]{@link module:Utils.asyncify},
+ * because the `async function` will be compiled to an ordinary function that
+ * returns a promise.
+ *
+ * @typedef {Function} AsyncFunction
+ * @static
+ */
+
+/**
+ * Async is a utility module which provides straight-forward, powerful functions
+ * for working with asynchronous JavaScript. Although originally designed for
+ * use with [Node.js](http://nodejs.org) and installable via
+ * `npm install --save async`, it can also be used directly in the browser.
+ * @module async
+ * @see AsyncFunction
+ */
+
+
+/**
+ * A collection of `async` functions for manipulating collections, such as
+ * arrays and objects.
+ * @module Collections
+ */
+
+/**
+ * A collection of `async` functions for controlling the flow through a script.
+ * @module ControlFlow
+ */
+
+/**
+ * A collection of `async` utility functions.
+ * @module Utils
+ */
+
+var index = {
+ apply: apply,
+ applyEach: applyEach,
+ applyEachSeries: applyEachSeries,
+ asyncify: asyncify,
+ auto: auto,
+ autoInject: autoInject,
+ cargo: cargo,
+ compose: compose,
+ concat: concat,
+ concatLimit: concatLimit,
+ concatSeries: concatSeries,
+ constant: constant,
+ detect: detect,
+ detectLimit: detectLimit,
+ detectSeries: detectSeries,
+ dir: dir,
+ doDuring: doDuring,
+ doUntil: doUntil,
+ doWhilst: doWhilst,
+ during: during,
+ each: eachLimit,
+ eachLimit: eachLimit$1,
+ eachOf: eachOf,
+ eachOfLimit: eachOfLimit,
+ eachOfSeries: eachOfSeries,
+ eachSeries: eachSeries,
+ ensureAsync: ensureAsync,
+ every: every,
+ everyLimit: everyLimit,
+ everySeries: everySeries,
+ filter: filter,
+ filterLimit: filterLimit,
+ filterSeries: filterSeries,
+ forever: forever,
+ groupBy: groupBy,
+ groupByLimit: groupByLimit,
+ groupBySeries: groupBySeries,
+ log: log,
+ map: map,
+ mapLimit: mapLimit,
+ mapSeries: mapSeries,
+ mapValues: mapValues,
+ mapValuesLimit: mapValuesLimit,
+ mapValuesSeries: mapValuesSeries,
+ memoize: memoize,
+ nextTick: nextTick,
+ parallel: parallelLimit,
+ parallelLimit: parallelLimit$1,
+ priorityQueue: priorityQueue,
+ queue: queue$1,
+ race: race,
+ reduce: reduce,
+ reduceRight: reduceRight,
+ reflect: reflect,
+ reflectAll: reflectAll,
+ reject: reject,
+ rejectLimit: rejectLimit,
+ rejectSeries: rejectSeries,
+ retry: retry,
+ retryable: retryable,
+ seq: seq,
+ series: series,
+ setImmediate: setImmediate$1,
+ some: some,
+ someLimit: someLimit,
+ someSeries: someSeries,
+ sortBy: sortBy,
+ timeout: timeout,
+ times: times,
+ timesLimit: timeLimit,
+ timesSeries: timesSeries,
+ transform: transform,
+ tryEach: tryEach,
+ unmemoize: unmemoize,
+ until: until,
+ waterfall: waterfall,
+ whilst: whilst,
+
+ // aliases
+ all: every,
+ allLimit: everyLimit,
+ allSeries: everySeries,
+ any: some,
+ anyLimit: someLimit,
+ anySeries: someSeries,
+ find: detect,
+ findLimit: detectLimit,
+ findSeries: detectSeries,
+ forEach: eachLimit,
+ forEachSeries: eachSeries,
+ forEachLimit: eachLimit$1,
+ forEachOf: eachOf,
+ forEachOfSeries: eachOfSeries,
+ forEachOfLimit: eachOfLimit,
+ inject: reduce,
+ foldl: reduce,
+ foldr: reduceRight,
+ select: filter,
+ selectLimit: filterLimit,
+ selectSeries: filterSeries,
+ wrapSync: asyncify
+};
+
+exports['default'] = index;
+exports.apply = apply;
+exports.applyEach = applyEach;
+exports.applyEachSeries = applyEachSeries;
+exports.asyncify = asyncify;
+exports.auto = auto;
+exports.autoInject = autoInject;
+exports.cargo = cargo;
+exports.compose = compose;
+exports.concat = concat;
+exports.concatLimit = concatLimit;
+exports.concatSeries = concatSeries;
+exports.constant = constant;
+exports.detect = detect;
+exports.detectLimit = detectLimit;
+exports.detectSeries = detectSeries;
+exports.dir = dir;
+exports.doDuring = doDuring;
+exports.doUntil = doUntil;
+exports.doWhilst = doWhilst;
+exports.during = during;
+exports.each = eachLimit;
+exports.eachLimit = eachLimit$1;
+exports.eachOf = eachOf;
+exports.eachOfLimit = eachOfLimit;
+exports.eachOfSeries = eachOfSeries;
+exports.eachSeries = eachSeries;
+exports.ensureAsync = ensureAsync;
+exports.every = every;
+exports.everyLimit = everyLimit;
+exports.everySeries = everySeries;
+exports.filter = filter;
+exports.filterLimit = filterLimit;
+exports.filterSeries = filterSeries;
+exports.forever = forever;
+exports.groupBy = groupBy;
+exports.groupByLimit = groupByLimit;
+exports.groupBySeries = groupBySeries;
+exports.log = log;
+exports.map = map;
+exports.mapLimit = mapLimit;
+exports.mapSeries = mapSeries;
+exports.mapValues = mapValues;
+exports.mapValuesLimit = mapValuesLimit;
+exports.mapValuesSeries = mapValuesSeries;
+exports.memoize = memoize;
+exports.nextTick = nextTick;
+exports.parallel = parallelLimit;
+exports.parallelLimit = parallelLimit$1;
+exports.priorityQueue = priorityQueue;
+exports.queue = queue$1;
+exports.race = race;
+exports.reduce = reduce;
+exports.reduceRight = reduceRight;
+exports.reflect = reflect;
+exports.reflectAll = reflectAll;
+exports.reject = reject;
+exports.rejectLimit = rejectLimit;
+exports.rejectSeries = rejectSeries;
+exports.retry = retry;
+exports.retryable = retryable;
+exports.seq = seq;
+exports.series = series;
+exports.setImmediate = setImmediate$1;
+exports.some = some;
+exports.someLimit = someLimit;
+exports.someSeries = someSeries;
+exports.sortBy = sortBy;
+exports.timeout = timeout;
+exports.times = times;
+exports.timesLimit = timeLimit;
+exports.timesSeries = timesSeries;
+exports.transform = transform;
+exports.tryEach = tryEach;
+exports.unmemoize = unmemoize;
+exports.until = until;
+exports.waterfall = waterfall;
+exports.whilst = whilst;
+exports.all = every;
+exports.allLimit = everyLimit;
+exports.allSeries = everySeries;
+exports.any = some;
+exports.anyLimit = someLimit;
+exports.anySeries = someSeries;
+exports.find = detect;
+exports.findLimit = detectLimit;
+exports.findSeries = detectSeries;
+exports.forEach = eachLimit;
+exports.forEachSeries = eachSeries;
+exports.forEachLimit = eachLimit$1;
+exports.forEachOf = eachOf;
+exports.forEachOfSeries = eachOfSeries;
+exports.forEachOfLimit = eachOfLimit;
+exports.inject = reduce;
+exports.foldl = reduce;
+exports.foldr = reduceRight;
+exports.select = filter;
+exports.selectLimit = filterLimit;
+exports.selectSeries = filterSeries;
+exports.wrapSync = asyncify;
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
+
+}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
+},{"_process":109,"timers":1415}],43:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = eachLimit;
+
+var _eachOfLimit = require('./internal/eachOfLimit');
+
+var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
+
+var _withoutIndex = require('./internal/withoutIndex');
+
+var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
+
+var _wrapAsync = require('./internal/wrapAsync');
+
+var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
+ *
+ * @name eachLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.each]{@link module:Collections.each}
+ * @alias forEachLimit
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - An async function to apply to each item in
+ * `coll`.
+ * The array index is not passed to the iteratee.
+ * If you need the index, use `eachOfLimit`.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ */
+function eachLimit(coll, limit, iteratee, callback) {
+ (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
+}
+module.exports = exports['default'];
+},{"./internal/eachOfLimit":47,"./internal/withoutIndex":55,"./internal/wrapAsync":56}],44:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _eachLimit = require('./eachLimit');
+
+var _eachLimit2 = _interopRequireDefault(_eachLimit);
+
+var _doLimit = require('./internal/doLimit');
+
+var _doLimit2 = _interopRequireDefault(_doLimit);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
+ *
+ * @name eachSeries
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.each]{@link module:Collections.each}
+ * @alias forEachSeries
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {AsyncFunction} iteratee - An async function to apply to each
+ * item in `coll`.
+ * The array index is not passed to the iteratee.
+ * If you need the index, use `eachOfSeries`.
+ * Invoked with (item, callback).
+ * @param {Function} [callback] - A callback which is called when all
+ * `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ */
+exports.default = (0, _doLimit2.default)(_eachLimit2.default, 1);
+module.exports = exports['default'];
+},{"./eachLimit":43,"./internal/doLimit":46}],45:[function(require,module,exports){
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+// A temporary value used to identify if the loop should be broken.
+// See #1064, #1293
+exports.default = {};
+module.exports = exports["default"];
+},{}],46:[function(require,module,exports){
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = doLimit;
+function doLimit(fn, limit) {
+ return function (iterable, iteratee, callback) {
+ return fn(iterable, limit, iteratee, callback);
+ };
+}
+module.exports = exports["default"];
+},{}],47:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = _eachOfLimit;
+
+var _noop = require('lodash/noop');
+
+var _noop2 = _interopRequireDefault(_noop);
+
+var _once = require('./once');
+
+var _once2 = _interopRequireDefault(_once);
+
+var _iterator = require('./iterator');
+
+var _iterator2 = _interopRequireDefault(_iterator);
+
+var _onlyOnce = require('./onlyOnce');
+
+var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
+
+var _breakLoop = require('./breakLoop');
+
+var _breakLoop2 = _interopRequireDefault(_breakLoop);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _eachOfLimit(limit) {
+ return function (obj, iteratee, callback) {
+ callback = (0, _once2.default)(callback || _noop2.default);
+ if (limit <= 0 || !obj) {
+ return callback(null);
+ }
+ var nextElem = (0, _iterator2.default)(obj);
+ var done = false;
+ var running = 0;
+ var looping = false;
+
+ function iterateeCallback(err, value) {
+ running -= 1;
+ if (err) {
+ done = true;
+ callback(err);
+ } else if (value === _breakLoop2.default || done && running <= 0) {
+ done = true;
+ return callback(null);
+ } else if (!looping) {
+ replenish();
+ }
+ }
+
+ function replenish() {
+ looping = true;
+ while (running < limit && !done) {
+ var elem = nextElem();
+ if (elem === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
+ }
+ running += 1;
+ iteratee(elem.value, elem.key, (0, _onlyOnce2.default)(iterateeCallback));
+ }
+ looping = false;
+ }
+
+ replenish();
+ };
+}
+module.exports = exports['default'];
+},{"./breakLoop":45,"./iterator":50,"./once":51,"./onlyOnce":52,"lodash/noop":930}],48:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+exports.default = function (coll) {
+ return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol]();
+};
+
+var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator;
+
+module.exports = exports['default'];
+},{}],49:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+exports.default = function (fn) {
+ return function () /*...args, callback*/{
+ var args = (0, _slice2.default)(arguments);
+ var callback = args.pop();
+ fn.call(this, args, callback);
+ };
+};
+
+var _slice = require('./slice');
+
+var _slice2 = _interopRequireDefault(_slice);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+module.exports = exports['default'];
+},{"./slice":54}],50:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = iterator;
+
+var _isArrayLike = require('lodash/isArrayLike');
+
+var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
+
+var _getIterator = require('./getIterator');
+
+var _getIterator2 = _interopRequireDefault(_getIterator);
+
+var _keys = require('lodash/keys');
+
+var _keys2 = _interopRequireDefault(_keys);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function createArrayIterator(coll) {
+ var i = -1;
+ var len = coll.length;
+ return function next() {
+ return ++i < len ? { value: coll[i], key: i } : null;
+ };
+}
+
+function createES2015Iterator(iterator) {
+ var i = -1;
+ return function next() {
+ var item = iterator.next();
+ if (item.done) return null;
+ i++;
+ return { value: item.value, key: i };
+ };
+}
+
+function createObjectIterator(obj) {
+ var okeys = (0, _keys2.default)(obj);
+ var i = -1;
+ var len = okeys.length;
+ return function next() {
+ var key = okeys[++i];
+ return i < len ? { value: obj[key], key: key } : null;
+ };
+}
+
+function iterator(coll) {
+ if ((0, _isArrayLike2.default)(coll)) {
+ return createArrayIterator(coll);
+ }
+
+ var iterator = (0, _getIterator2.default)(coll);
+ return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll);
+}
+module.exports = exports['default'];
+},{"./getIterator":48,"lodash/isArrayLike":922,"lodash/keys":929}],51:[function(require,module,exports){
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = once;
+function once(fn) {
+ return function () {
+ if (fn === null) return;
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, arguments);
+ };
+}
+module.exports = exports["default"];
+},{}],52:[function(require,module,exports){
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = onlyOnce;
+function onlyOnce(fn) {
+ return function () {
+ if (fn === null) throw new Error("Callback was already called.");
+ var callFn = fn;
+ fn = null;
+ callFn.apply(this, arguments);
+ };
+}
+module.exports = exports["default"];
+},{}],53:[function(require,module,exports){
+(function (process,setImmediate){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.hasNextTick = exports.hasSetImmediate = undefined;
+exports.fallback = fallback;
+exports.wrap = wrap;
+
+var _slice = require('./slice');
+
+var _slice2 = _interopRequireDefault(_slice);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
+var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
+
+function fallback(fn) {
+ setTimeout(fn, 0);
+}
+
+function wrap(defer) {
+ return function (fn /*, ...args*/) {
+ var args = (0, _slice2.default)(arguments, 1);
+ defer(function () {
+ fn.apply(null, args);
+ });
+ };
+}
+
+var _defer;
+
+if (hasSetImmediate) {
+ _defer = setImmediate;
+} else if (hasNextTick) {
+ _defer = process.nextTick;
+} else {
+ _defer = fallback;
+}
+
+exports.default = wrap(_defer);
+}).call(this,require('_process'),require("timers").setImmediate)
+},{"./slice":54,"_process":109,"timers":1415}],54:[function(require,module,exports){
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = slice;
+function slice(arrayLike, start) {
+ start = start | 0;
+ var newLen = Math.max(arrayLike.length - start, 0);
+ var newArr = Array(newLen);
+ for (var idx = 0; idx < newLen; idx++) {
+ newArr[idx] = arrayLike[start + idx];
+ }
+ return newArr;
+}
+module.exports = exports["default"];
+},{}],55:[function(require,module,exports){
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = _withoutIndex;
+function _withoutIndex(iteratee) {
+ return function (value, index, callback) {
+ return iteratee(value, callback);
+ };
+}
+module.exports = exports["default"];
+},{}],56:[function(require,module,exports){
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.isAsync = undefined;
+
+var _asyncify = require('../asyncify');
+
+var _asyncify2 = _interopRequireDefault(_asyncify);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var supportsSymbol = typeof Symbol === 'function';
+
+function isAsync(fn) {
+ return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction';
+}
+
+function wrapAsync(asyncFn) {
+ return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn;
+}
+
+exports.default = wrapAsync;
+exports.isAsync = isAsync;
+},{"../asyncify":41}],57:[function(require,module,exports){
+
+/*!
+ * Copyright 2010 LearnBoost
+ *
+ * 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.
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto')
+ , parse = require('url').parse
+ ;
+
+/**
+ * Valid keys.
+ */
+
+var keys =
+ [ 'acl'
+ , 'location'
+ , 'logging'
+ , 'notification'
+ , 'partNumber'
+ , 'policy'
+ , 'requestPayment'
+ , 'torrent'
+ , 'uploadId'
+ , 'uploads'
+ , 'versionId'
+ , 'versioning'
+ , 'versions'
+ , 'website'
+ ]
+
+/**
+ * Return an "Authorization" header value with the given `options`
+ * in the form of "AWS :"
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function authorization (options) {
+ return 'AWS ' + options.key + ':' + sign(options)
+}
+
+module.exports = authorization
+module.exports.authorization = authorization
+
+/**
+ * Simple HMAC-SHA1 Wrapper
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function hmacSha1 (options) {
+ return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64')
+}
+
+module.exports.hmacSha1 = hmacSha1
+
+/**
+ * Create a base64 sha1 HMAC for `options`.
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function sign (options) {
+ options.message = stringToSign(options)
+ return hmacSha1(options)
+}
+module.exports.sign = sign
+
+/**
+ * Create a base64 sha1 HMAC for `options`.
+ *
+ * Specifically to be used with S3 presigned URLs
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function signQuery (options) {
+ options.message = queryStringToSign(options)
+ return hmacSha1(options)
+}
+module.exports.signQuery= signQuery
+
+/**
+ * Return a string for sign() with the given `options`.
+ *
+ * Spec:
+ *
+ * \n
+ * \n
+ * \n
+ * \n
+ * [headers\n]
+ *
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function stringToSign (options) {
+ var headers = options.amazonHeaders || ''
+ if (headers) headers += '\n'
+ var r =
+ [ options.verb
+ , options.md5
+ , options.contentType
+ , options.date ? options.date.toUTCString() : ''
+ , headers + options.resource
+ ]
+ return r.join('\n')
+}
+module.exports.stringToSign = stringToSign
+
+/**
+ * Return a string for sign() with the given `options`, but is meant exclusively
+ * for S3 presigned URLs
+ *
+ * Spec:
+ *
+ * \n
+ *
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function queryStringToSign (options){
+ return 'GET\n\n\n' + options.date + '\n' + options.resource
+}
+module.exports.queryStringToSign = queryStringToSign
+
+/**
+ * Perform the following:
+ *
+ * - ignore non-amazon headers
+ * - lowercase fields
+ * - sort lexicographically
+ * - trim whitespace between ":"
+ * - join with newline
+ *
+ * @param {Object} headers
+ * @return {String}
+ * @api private
+ */
+
+function canonicalizeHeaders (headers) {
+ var buf = []
+ , fields = Object.keys(headers)
+ ;
+ for (var i = 0, len = fields.length; i < len; ++i) {
+ var field = fields[i]
+ , val = headers[field]
+ , field = field.toLowerCase()
+ ;
+ if (0 !== field.indexOf('x-amz')) continue
+ buf.push(field + ':' + val)
+ }
+ return buf.sort().join('\n')
+}
+module.exports.canonicalizeHeaders = canonicalizeHeaders
+
+/**
+ * Perform the following:
+ *
+ * - ignore non sub-resources
+ * - sort lexicographically
+ *
+ * @param {String} resource
+ * @return {String}
+ * @api private
+ */
+
+function canonicalizeResource (resource) {
+ var url = parse(resource, true)
+ , path = url.pathname
+ , buf = []
+ ;
+
+ Object.keys(url.query).forEach(function(key){
+ if (!~keys.indexOf(key)) return
+ var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key])
+ buf.push(key + val)
+ })
+
+ return path + (buf.length ? '?' + buf.sort().join('&') : '')
+}
+module.exports.canonicalizeResource = canonicalizeResource
+
+},{"crypto":470,"url":1433}],58:[function(require,module,exports){
+(function (process,Buffer){
+var aws4 = exports,
+ url = require('url'),
+ querystring = require('querystring'),
+ crypto = require('crypto'),
+ lru = require('./lru'),
+ credentialsCache = lru(1000)
+
+// http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html
+
+function hmac(key, string, encoding) {
+ return crypto.createHmac('sha256', key).update(string, 'utf8').digest(encoding)
+}
+
+function hash(string, encoding) {
+ return crypto.createHash('sha256').update(string, 'utf8').digest(encoding)
+}
+
+// This function assumes the string has already been percent encoded
+function encodeRfc3986(urlEncodedString) {
+ return urlEncodedString.replace(/[!'()*]/g, function(c) {
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
+ })
+}
+
+// request: { path | body, [host], [method], [headers], [service], [region] }
+// credentials: { accessKeyId, secretAccessKey, [sessionToken] }
+function RequestSigner(request, credentials) {
+
+ if (typeof request === 'string') request = url.parse(request)
+
+ var headers = request.headers = (request.headers || {}),
+ hostParts = this.matchHost(request.hostname || request.host || headers.Host || headers.host)
+
+ this.request = request
+ this.credentials = credentials || this.defaultCredentials()
+
+ this.service = request.service || hostParts[0] || ''
+ this.region = request.region || hostParts[1] || 'us-east-1'
+
+ // SES uses a different domain from the service name
+ if (this.service === 'email') this.service = 'ses'
+
+ if (!request.method && request.body)
+ request.method = 'POST'
+
+ if (!headers.Host && !headers.host) {
+ headers.Host = request.hostname || request.host || this.createHost()
+
+ // If a port is specified explicitly, use it as is
+ if (request.port)
+ headers.Host += ':' + request.port
+ }
+ if (!request.hostname && !request.host)
+ request.hostname = headers.Host || headers.host
+
+ this.isCodeCommitGit = this.service === 'codecommit' && request.method === 'GIT'
+}
+
+RequestSigner.prototype.matchHost = function(host) {
+ var match = (host || '').match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(\.cn)?$/)
+ var hostParts = (match || []).slice(1, 3)
+
+ // ES's hostParts are sometimes the other way round, if the value that is expected
+ // to be region equals ‘es’ switch them back
+ // e.g. search-cluster-name-aaaa00aaaa0aaa0aaaaaaa0aaa.us-east-1.es.amazonaws.com
+ if (hostParts[1] === 'es')
+ hostParts = hostParts.reverse()
+
+ return hostParts
+}
+
+// http://docs.aws.amazon.com/general/latest/gr/rande.html
+RequestSigner.prototype.isSingleRegion = function() {
+ // Special case for S3 and SimpleDB in us-east-1
+ if (['s3', 'sdb'].indexOf(this.service) >= 0 && this.region === 'us-east-1') return true
+
+ return ['cloudfront', 'ls', 'route53', 'iam', 'importexport', 'sts']
+ .indexOf(this.service) >= 0
+}
+
+RequestSigner.prototype.createHost = function() {
+ var region = this.isSingleRegion() ? '' :
+ (this.service === 's3' && this.region !== 'us-east-1' ? '-' : '.') + this.region,
+ service = this.service === 'ses' ? 'email' : this.service
+ return service + region + '.amazonaws.com'
+}
+
+RequestSigner.prototype.prepareRequest = function() {
+ this.parsePath()
+
+ var request = this.request, headers = request.headers, query
+
+ if (request.signQuery) {
+
+ this.parsedPath.query = query = this.parsedPath.query || {}
+
+ if (this.credentials.sessionToken)
+ query['X-Amz-Security-Token'] = this.credentials.sessionToken
+
+ if (this.service === 's3' && !query['X-Amz-Expires'])
+ query['X-Amz-Expires'] = 86400
+
+ if (query['X-Amz-Date'])
+ this.datetime = query['X-Amz-Date']
+ else
+ query['X-Amz-Date'] = this.getDateTime()
+
+ query['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256'
+ query['X-Amz-Credential'] = this.credentials.accessKeyId + '/' + this.credentialString()
+ query['X-Amz-SignedHeaders'] = this.signedHeaders()
+
+ } else {
+
+ if (!request.doNotModifyHeaders && !this.isCodeCommitGit) {
+ if (request.body && !headers['Content-Type'] && !headers['content-type'])
+ headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'
+
+ if (request.body && !headers['Content-Length'] && !headers['content-length'])
+ headers['Content-Length'] = Buffer.byteLength(request.body)
+
+ if (this.credentials.sessionToken && !headers['X-Amz-Security-Token'] && !headers['x-amz-security-token'])
+ headers['X-Amz-Security-Token'] = this.credentials.sessionToken
+
+ if (this.service === 's3' && !headers['X-Amz-Content-Sha256'] && !headers['x-amz-content-sha256'])
+ headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex')
+
+ if (headers['X-Amz-Date'] || headers['x-amz-date'])
+ this.datetime = headers['X-Amz-Date'] || headers['x-amz-date']
+ else
+ headers['X-Amz-Date'] = this.getDateTime()
+ }
+
+ delete headers.Authorization
+ delete headers.authorization
+ }
+}
+
+RequestSigner.prototype.sign = function() {
+ if (!this.parsedPath) this.prepareRequest()
+
+ if (this.request.signQuery) {
+ this.parsedPath.query['X-Amz-Signature'] = this.signature()
+ } else {
+ this.request.headers.Authorization = this.authHeader()
+ }
+
+ this.request.path = this.formatPath()
+
+ return this.request
+}
+
+RequestSigner.prototype.getDateTime = function() {
+ if (!this.datetime) {
+ var headers = this.request.headers,
+ date = new Date(headers.Date || headers.date || new Date)
+
+ this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, '')
+
+ // Remove the trailing 'Z' on the timestamp string for CodeCommit git access
+ if (this.isCodeCommitGit) this.datetime = this.datetime.slice(0, -1)
+ }
+ return this.datetime
+}
+
+RequestSigner.prototype.getDate = function() {
+ return this.getDateTime().substr(0, 8)
+}
+
+RequestSigner.prototype.authHeader = function() {
+ return [
+ 'AWS4-HMAC-SHA256 Credential=' + this.credentials.accessKeyId + '/' + this.credentialString(),
+ 'SignedHeaders=' + this.signedHeaders(),
+ 'Signature=' + this.signature(),
+ ].join(', ')
+}
+
+RequestSigner.prototype.signature = function() {
+ var date = this.getDate(),
+ cacheKey = [this.credentials.secretAccessKey, date, this.region, this.service].join(),
+ kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey)
+ if (!kCredentials) {
+ kDate = hmac('AWS4' + this.credentials.secretAccessKey, date)
+ kRegion = hmac(kDate, this.region)
+ kService = hmac(kRegion, this.service)
+ kCredentials = hmac(kService, 'aws4_request')
+ credentialsCache.set(cacheKey, kCredentials)
+ }
+ return hmac(kCredentials, this.stringToSign(), 'hex')
+}
+
+RequestSigner.prototype.stringToSign = function() {
+ return [
+ 'AWS4-HMAC-SHA256',
+ this.getDateTime(),
+ this.credentialString(),
+ hash(this.canonicalString(), 'hex'),
+ ].join('\n')
+}
+
+RequestSigner.prototype.canonicalString = function() {
+ if (!this.parsedPath) this.prepareRequest()
+
+ var pathStr = this.parsedPath.path,
+ query = this.parsedPath.query,
+ headers = this.request.headers,
+ queryStr = '',
+ normalizePath = this.service !== 's3',
+ decodePath = this.service === 's3' || this.request.doNotEncodePath,
+ decodeSlashesInPath = this.service === 's3',
+ firstValOnly = this.service === 's3',
+ bodyHash
+
+ if (this.service === 's3' && this.request.signQuery) {
+ bodyHash = 'UNSIGNED-PAYLOAD'
+ } else if (this.isCodeCommitGit) {
+ bodyHash = ''
+ } else {
+ bodyHash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] ||
+ hash(this.request.body || '', 'hex')
+ }
+
+ if (query) {
+ queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) {
+ if (!key) return obj
+ obj[key] = !Array.isArray(query[key]) ? query[key] :
+ (firstValOnly ? query[key][0] : query[key].slice().sort())
+ return obj
+ }, {})))
+ }
+ if (pathStr !== '/') {
+ if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, '/')
+ pathStr = pathStr.split('/').reduce(function(path, piece) {
+ if (normalizePath && piece === '..') {
+ path.pop()
+ } else if (!normalizePath || piece !== '.') {
+ if (decodePath) piece = decodeURIComponent(piece)
+ path.push(encodeRfc3986(encodeURIComponent(piece)))
+ }
+ return path
+ }, []).join('/')
+ if (pathStr[0] !== '/') pathStr = '/' + pathStr
+ if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, '/')
+ }
+
+ return [
+ this.request.method || 'GET',
+ pathStr,
+ queryStr,
+ this.canonicalHeaders() + '\n',
+ this.signedHeaders(),
+ bodyHash,
+ ].join('\n')
+}
+
+RequestSigner.prototype.canonicalHeaders = function() {
+ var headers = this.request.headers
+ function trimAll(header) {
+ return header.toString().trim().replace(/\s+/g, ' ')
+ }
+ return Object.keys(headers)
+ .sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 })
+ .map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) })
+ .join('\n')
+}
+
+RequestSigner.prototype.signedHeaders = function() {
+ return Object.keys(this.request.headers)
+ .map(function(key) { return key.toLowerCase() })
+ .sort()
+ .join(';')
+}
+
+RequestSigner.prototype.credentialString = function() {
+ return [
+ this.getDate(),
+ this.region,
+ this.service,
+ 'aws4_request',
+ ].join('/')
+}
+
+RequestSigner.prototype.defaultCredentials = function() {
+ var env = process.env
+ return {
+ accessKeyId: env.AWS_ACCESS_KEY_ID || env.AWS_ACCESS_KEY,
+ secretAccessKey: env.AWS_SECRET_ACCESS_KEY || env.AWS_SECRET_KEY,
+ sessionToken: env.AWS_SESSION_TOKEN,
+ }
+}
+
+RequestSigner.prototype.parsePath = function() {
+ var path = this.request.path || '/',
+ queryIx = path.indexOf('?'),
+ query = null
+
+ if (queryIx >= 0) {
+ query = querystring.parse(path.slice(queryIx + 1))
+ path = path.slice(0, queryIx)
+ }
+
+ // S3 doesn't always encode characters > 127 correctly and
+ // all services don't encode characters > 255 correctly
+ // So if there are non-reserved chars (and it's not already all % encoded), just encode them all
+ if (/[^0-9A-Za-z!'()*\-._~%/]/.test(path)) {
+ path = path.split('/').map(function(piece) {
+ return encodeURIComponent(decodeURIComponent(piece))
+ }).join('/')
+ }
+
+ this.parsedPath = {
+ path: path,
+ query: query,
+ }
+}
+
+RequestSigner.prototype.formatPath = function() {
+ var path = this.parsedPath.path,
+ query = this.parsedPath.query
+
+ if (!query) return path
+
+ // Services don't support empty query string keys
+ if (query[''] != null) delete query['']
+
+ return path + '?' + encodeRfc3986(querystring.stringify(query))
+}
+
+aws4.RequestSigner = RequestSigner
+
+aws4.sign = function(request, credentials) {
+ return new RequestSigner(request, credentials).sign()
+}
+
+}).call(this,require('_process'),require("buffer").Buffer)
+},{"./lru":59,"_process":109,"buffer":113,"crypto":470,"querystring":1035,"url":1433}],59:[function(require,module,exports){
+module.exports = function(size) {
+ return new LruCache(size)
+}
+
+function LruCache(size) {
+ this.capacity = size | 0
+ this.map = Object.create(null)
+ this.list = new DoublyLinkedList()
+}
+
+LruCache.prototype.get = function(key) {
+ var node = this.map[key]
+ if (node == null) return undefined
+ this.used(node)
+ return node.val
+}
+
+LruCache.prototype.set = function(key, val) {
+ var node = this.map[key]
+ if (node != null) {
+ node.val = val
+ } else {
+ if (!this.capacity) this.prune()
+ if (!this.capacity) return false
+ node = new DoublyLinkedNode(key, val)
+ this.map[key] = node
+ this.capacity--
+ }
+ this.used(node)
+ return true
+}
+
+LruCache.prototype.used = function(node) {
+ this.list.moveToFront(node)
+}
+
+LruCache.prototype.prune = function() {
+ var node = this.list.pop()
+ if (node != null) {
+ delete this.map[node.key]
+ this.capacity++
+ }
+}
+
+
+function DoublyLinkedList() {
+ this.firstNode = null
+ this.lastNode = null
+}
+
+DoublyLinkedList.prototype.moveToFront = function(node) {
+ if (this.firstNode == node) return
+
+ this.remove(node)
+
+ if (this.firstNode == null) {
+ this.firstNode = node
+ this.lastNode = node
+ node.prev = null
+ node.next = null
+ } else {
+ node.prev = null
+ node.next = this.firstNode
+ node.next.prev = node
+ this.firstNode = node
+ }
+}
+
+DoublyLinkedList.prototype.pop = function() {
+ var lastNode = this.lastNode
+ if (lastNode != null) {
+ this.remove(lastNode)
+ }
+ return lastNode
+}
+
+DoublyLinkedList.prototype.remove = function(node) {
+ if (this.firstNode == node) {
+ this.firstNode = node.next
+ } else if (node.prev != null) {
+ node.prev.next = node.next
+ }
+ if (this.lastNode == node) {
+ this.lastNode = node.prev
+ } else if (node.next != null) {
+ node.next.prev = node.prev
+ }
+}
+
+
+function DoublyLinkedNode(key, val) {
+ this.key = key
+ this.val = val
+ this.prev = null
+ this.next = null
+}
+
+},{}],60:[function(require,module,exports){
+(function (global){
+"use strict";
+
+require("core-js/shim");
+
+require("regenerator-runtime/runtime");
+
+require("core-js/fn/regexp/escape");
+
+if (global._babelPolyfill) {
+ throw new Error("only one instance of babel-polyfill is allowed");
+}
+global._babelPolyfill = true;
+
+var DEFINE_PROPERTY = "defineProperty";
+function define(O, key, value) {
+ O[key] || Object[DEFINE_PROPERTY](O, key, {
+ writable: true,
+ configurable: true,
+ value: value
+ });
+}
+
+define(String.prototype, "padLeft", "".padStart);
+define(String.prototype, "padRight", "".padEnd);
+
+"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) {
+ [][key] && define(Array, key, Function.call.bind([][key]));
+});
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"core-js/fn/regexp/escape":135,"core-js/shim":463,"regenerator-runtime/runtime":61}],61:[function(require,module,exports){
+(function (global){
+/**
+ * Copyright (c) 2014, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
+ * additional grant of patent rights can be found in the PATENTS file in
+ * the same directory.
+ */
+
+!(function(global) {
+ "use strict";
+
+ var Op = Object.prototype;
+ var hasOwn = Op.hasOwnProperty;
+ var undefined; // More compressible than void 0.
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
+
+ var inModule = typeof module === "object";
+ var runtime = global.regeneratorRuntime;
+ if (runtime) {
+ if (inModule) {
+ // If regeneratorRuntime is defined globally and we're in a module,
+ // make the exports object identical to regeneratorRuntime.
+ module.exports = runtime;
+ }
+ // Don't bother evaluating the rest of this file if the runtime was
+ // already defined globally.
+ return;
+ }
+
+ // Define the runtime globally (as expected by generated code) as either
+ // module.exports (if we're in a module) or a new, empty object.
+ runtime = global.regeneratorRuntime = inModule ? module.exports : {};
+
+ function wrap(innerFn, outerFn, self, tryLocsList) {
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
+ var generator = Object.create(protoGenerator.prototype);
+ var context = new Context(tryLocsList || []);
+
+ // The ._invoke method unifies the implementations of the .next,
+ // .throw, and .return methods.
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
+
+ return generator;
+ }
+ runtime.wrap = wrap;
+
+ // Try/catch helper to minimize deoptimizations. Returns a completion
+ // record like context.tryEntries[i].completion. This interface could
+ // have been (and was previously) designed to take a closure to be
+ // invoked without arguments, but in all the cases we care about we
+ // already have an existing method we want to call, so there's no need
+ // to create a new function object. We can even get away with assuming
+ // the method takes exactly one argument, since that happens to be true
+ // in every case, so we don't have to touch the arguments object. The
+ // only additional allocation required is the completion record, which
+ // has a stable shape and so hopefully should be cheap to allocate.
+ function tryCatch(fn, obj, arg) {
+ try {
+ return { type: "normal", arg: fn.call(obj, arg) };
+ } catch (err) {
+ return { type: "throw", arg: err };
+ }
+ }
+
+ var GenStateSuspendedStart = "suspendedStart";
+ var GenStateSuspendedYield = "suspendedYield";
+ var GenStateExecuting = "executing";
+ var GenStateCompleted = "completed";
+
+ // Returning this object from the innerFn has the same effect as
+ // breaking out of the dispatch switch statement.
+ var ContinueSentinel = {};
+
+ // Dummy constructor functions that we use as the .constructor and
+ // .constructor.prototype properties for functions that return Generator
+ // objects. For full spec compliance, you may wish to configure your
+ // minifier not to mangle the names of these two functions.
+ function Generator() {}
+ function GeneratorFunction() {}
+ function GeneratorFunctionPrototype() {}
+
+ // This is a polyfill for %IteratorPrototype% for environments that
+ // don't natively support it.
+ var IteratorPrototype = {};
+ IteratorPrototype[iteratorSymbol] = function () {
+ return this;
+ };
+
+ var getProto = Object.getPrototypeOf;
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
+ if (NativeIteratorPrototype &&
+ NativeIteratorPrototype !== Op &&
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
+ // This environment has a native %IteratorPrototype%; use it instead
+ // of the polyfill.
+ IteratorPrototype = NativeIteratorPrototype;
+ }
+
+ var Gp = GeneratorFunctionPrototype.prototype =
+ Generator.prototype = Object.create(IteratorPrototype);
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
+ GeneratorFunctionPrototype[toStringTagSymbol] =
+ GeneratorFunction.displayName = "GeneratorFunction";
+
+ // Helper for defining the .next, .throw, and .return methods of the
+ // Iterator interface in terms of a single ._invoke method.
+ function defineIteratorMethods(prototype) {
+ ["next", "throw", "return"].forEach(function(method) {
+ prototype[method] = function(arg) {
+ return this._invoke(method, arg);
+ };
+ });
+ }
+
+ runtime.isGeneratorFunction = function(genFun) {
+ var ctor = typeof genFun === "function" && genFun.constructor;
+ return ctor
+ ? ctor === GeneratorFunction ||
+ // For the native GeneratorFunction constructor, the best we can
+ // do is to check its .name property.
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
+ : false;
+ };
+
+ runtime.mark = function(genFun) {
+ if (Object.setPrototypeOf) {
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
+ } else {
+ genFun.__proto__ = GeneratorFunctionPrototype;
+ if (!(toStringTagSymbol in genFun)) {
+ genFun[toStringTagSymbol] = "GeneratorFunction";
+ }
+ }
+ genFun.prototype = Object.create(Gp);
+ return genFun;
+ };
+
+ // Within the body of any async function, `await x` is transformed to
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
+ // meant to be awaited.
+ runtime.awrap = function(arg) {
+ return { __await: arg };
+ };
+
+ function AsyncIterator(generator) {
+ function invoke(method, arg, resolve, reject) {
+ var record = tryCatch(generator[method], generator, arg);
+ if (record.type === "throw") {
+ reject(record.arg);
+ } else {
+ var result = record.arg;
+ var value = result.value;
+ if (value &&
+ typeof value === "object" &&
+ hasOwn.call(value, "__await")) {
+ return Promise.resolve(value.__await).then(function(value) {
+ invoke("next", value, resolve, reject);
+ }, function(err) {
+ invoke("throw", err, resolve, reject);
+ });
+ }
+
+ return Promise.resolve(value).then(function(unwrapped) {
+ // When a yielded Promise is resolved, its final value becomes
+ // the .value of the Promise<{value,done}> result for the
+ // current iteration. If the Promise is rejected, however, the
+ // result for this iteration will be rejected with the same
+ // reason. Note that rejections of yielded Promises are not
+ // thrown back into the generator function, as is the case
+ // when an awaited Promise is rejected. This difference in
+ // behavior between yield and await is important, because it
+ // allows the consumer to decide what to do with the yielded
+ // rejection (swallow it and continue, manually .throw it back
+ // into the generator, abandon iteration, whatever). With
+ // await, by contrast, there is no opportunity to examine the
+ // rejection reason outside the generator function, so the
+ // only option is to throw it from the await expression, and
+ // let the generator function handle the exception.
+ result.value = unwrapped;
+ resolve(result);
+ }, reject);
+ }
+ }
+
+ if (typeof global.process === "object" && global.process.domain) {
+ invoke = global.process.domain.bind(invoke);
+ }
+
+ var previousPromise;
+
+ function enqueue(method, arg) {
+ function callInvokeWithMethodAndArg() {
+ return new Promise(function(resolve, reject) {
+ invoke(method, arg, resolve, reject);
+ });
+ }
+
+ return previousPromise =
+ // If enqueue has been called before, then we want to wait until
+ // all previous Promises have been resolved before calling invoke,
+ // so that results are always delivered in the correct order. If
+ // enqueue has not been called before, then it is important to
+ // call invoke immediately, without waiting on a callback to fire,
+ // so that the async generator function has the opportunity to do
+ // any necessary setup in a predictable way. This predictability
+ // is why the Promise constructor synchronously invokes its
+ // executor callback, and why async functions synchronously
+ // execute code before the first await. Since we implement simple
+ // async functions in terms of async generators, it is especially
+ // important to get this right, even though it requires care.
+ previousPromise ? previousPromise.then(
+ callInvokeWithMethodAndArg,
+ // Avoid propagating failures to Promises returned by later
+ // invocations of the iterator.
+ callInvokeWithMethodAndArg
+ ) : callInvokeWithMethodAndArg();
+ }
+
+ // Define the unified helper method that is used to implement .next,
+ // .throw, and .return (see defineIteratorMethods).
+ this._invoke = enqueue;
+ }
+
+ defineIteratorMethods(AsyncIterator.prototype);
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
+ return this;
+ };
+ runtime.AsyncIterator = AsyncIterator;
+
+ // Note that simple async functions are implemented on top of
+ // AsyncIterator objects; they just return a Promise for the value of
+ // the final result produced by the iterator.
+ runtime.async = function(innerFn, outerFn, self, tryLocsList) {
+ var iter = new AsyncIterator(
+ wrap(innerFn, outerFn, self, tryLocsList)
+ );
+
+ return runtime.isGeneratorFunction(outerFn)
+ ? iter // If outerFn is a generator, return the full iterator.
+ : iter.next().then(function(result) {
+ return result.done ? result.value : iter.next();
+ });
+ };
+
+ function makeInvokeMethod(innerFn, self, context) {
+ var state = GenStateSuspendedStart;
+
+ return function invoke(method, arg) {
+ if (state === GenStateExecuting) {
+ throw new Error("Generator is already running");
+ }
+
+ if (state === GenStateCompleted) {
+ if (method === "throw") {
+ throw arg;
+ }
+
+ // Be forgiving, per 25.3.3.3.3 of the spec:
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
+ return doneResult();
+ }
+
+ context.method = method;
+ context.arg = arg;
+
+ while (true) {
+ var delegate = context.delegate;
+ if (delegate) {
+ var delegateResult = maybeInvokeDelegate(delegate, context);
+ if (delegateResult) {
+ if (delegateResult === ContinueSentinel) continue;
+ return delegateResult;
+ }
+ }
+
+ if (context.method === "next") {
+ // Setting context._sent for legacy support of Babel's
+ // function.sent implementation.
+ context.sent = context._sent = context.arg;
+
+ } else if (context.method === "throw") {
+ if (state === GenStateSuspendedStart) {
+ state = GenStateCompleted;
+ throw context.arg;
+ }
+
+ context.dispatchException(context.arg);
+
+ } else if (context.method === "return") {
+ context.abrupt("return", context.arg);
+ }
+
+ state = GenStateExecuting;
+
+ var record = tryCatch(innerFn, self, context);
+ if (record.type === "normal") {
+ // If an exception is thrown from innerFn, we leave state ===
+ // GenStateExecuting and loop back for another invocation.
+ state = context.done
+ ? GenStateCompleted
+ : GenStateSuspendedYield;
+
+ if (record.arg === ContinueSentinel) {
+ continue;
+ }
+
+ return {
+ value: record.arg,
+ done: context.done
+ };
+
+ } else if (record.type === "throw") {
+ state = GenStateCompleted;
+ // Dispatch the exception by looping back around to the
+ // context.dispatchException(context.arg) call above.
+ context.method = "throw";
+ context.arg = record.arg;
+ }
+ }
+ };
+ }
+
+ // Call delegate.iterator[context.method](context.arg) and handle the
+ // result, either by returning a { value, done } result from the
+ // delegate iterator, or by modifying context.method and context.arg,
+ // setting context.delegate to null, and returning the ContinueSentinel.
+ function maybeInvokeDelegate(delegate, context) {
+ var method = delegate.iterator[context.method];
+ if (method === undefined) {
+ // A .throw or .return when the delegate iterator has no .throw
+ // method always terminates the yield* loop.
+ context.delegate = null;
+
+ if (context.method === "throw") {
+ if (delegate.iterator.return) {
+ // If the delegate iterator has a return method, give it a
+ // chance to clean up.
+ context.method = "return";
+ context.arg = undefined;
+ maybeInvokeDelegate(delegate, context);
+
+ if (context.method === "throw") {
+ // If maybeInvokeDelegate(context) changed context.method from
+ // "return" to "throw", let that override the TypeError below.
+ return ContinueSentinel;
+ }
+ }
+
+ context.method = "throw";
+ context.arg = new TypeError(
+ "The iterator does not provide a 'throw' method");
+ }
+
+ return ContinueSentinel;
+ }
+
+ var record = tryCatch(method, delegate.iterator, context.arg);
+
+ if (record.type === "throw") {
+ context.method = "throw";
+ context.arg = record.arg;
+ context.delegate = null;
+ return ContinueSentinel;
+ }
+
+ var info = record.arg;
+
+ if (! info) {
+ context.method = "throw";
+ context.arg = new TypeError("iterator result is not an object");
+ context.delegate = null;
+ return ContinueSentinel;
+ }
+
+ if (info.done) {
+ // Assign the result of the finished delegate to the temporary
+ // variable specified by delegate.resultName (see delegateYield).
+ context[delegate.resultName] = info.value;
+
+ // Resume execution at the desired location (see delegateYield).
+ context.next = delegate.nextLoc;
+
+ // If context.method was "throw" but the delegate handled the
+ // exception, let the outer generator proceed normally. If
+ // context.method was "next", forget context.arg since it has been
+ // "consumed" by the delegate iterator. If context.method was
+ // "return", allow the original .return call to continue in the
+ // outer generator.
+ if (context.method !== "return") {
+ context.method = "next";
+ context.arg = undefined;
+ }
+
+ } else {
+ // Re-yield the result returned by the delegate method.
+ return info;
+ }
+
+ // The delegate iterator is finished, so forget it and continue with
+ // the outer generator.
+ context.delegate = null;
+ return ContinueSentinel;
+ }
+
+ // Define Generator.prototype.{next,throw,return} in terms of the
+ // unified ._invoke helper method.
+ defineIteratorMethods(Gp);
+
+ Gp[toStringTagSymbol] = "Generator";
+
+ // A Generator should always return itself as the iterator object when the
+ // @@iterator function is called on it. Some browsers' implementations of the
+ // iterator prototype chain incorrectly implement this, causing the Generator
+ // object to not be returned from this call. This ensures that doesn't happen.
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
+ Gp[iteratorSymbol] = function() {
+ return this;
+ };
+
+ Gp.toString = function() {
+ return "[object Generator]";
+ };
+
+ function pushTryEntry(locs) {
+ var entry = { tryLoc: locs[0] };
+
+ if (1 in locs) {
+ entry.catchLoc = locs[1];
+ }
+
+ if (2 in locs) {
+ entry.finallyLoc = locs[2];
+ entry.afterLoc = locs[3];
+ }
+
+ this.tryEntries.push(entry);
+ }
+
+ function resetTryEntry(entry) {
+ var record = entry.completion || {};
+ record.type = "normal";
+ delete record.arg;
+ entry.completion = record;
+ }
+
+ function Context(tryLocsList) {
+ // The root entry object (effectively a try statement without a catch
+ // or a finally block) gives us a place to store values thrown from
+ // locations where there is no enclosing try statement.
+ this.tryEntries = [{ tryLoc: "root" }];
+ tryLocsList.forEach(pushTryEntry, this);
+ this.reset(true);
+ }
+
+ runtime.keys = function(object) {
+ var keys = [];
+ for (var key in object) {
+ keys.push(key);
+ }
+ keys.reverse();
+
+ // Rather than returning an object with a next method, we keep
+ // things simple and return the next function itself.
+ return function next() {
+ while (keys.length) {
+ var key = keys.pop();
+ if (key in object) {
+ next.value = key;
+ next.done = false;
+ return next;
+ }
+ }
+
+ // To avoid creating an additional object, we just hang the .value
+ // and .done properties off the next function object itself. This
+ // also ensures that the minifier will not anonymize the function.
+ next.done = true;
+ return next;
+ };
+ };
+
+ function values(iterable) {
+ if (iterable) {
+ var iteratorMethod = iterable[iteratorSymbol];
+ if (iteratorMethod) {
+ return iteratorMethod.call(iterable);
+ }
+
+ if (typeof iterable.next === "function") {
+ return iterable;
+ }
+
+ if (!isNaN(iterable.length)) {
+ var i = -1, next = function next() {
+ while (++i < iterable.length) {
+ if (hasOwn.call(iterable, i)) {
+ next.value = iterable[i];
+ next.done = false;
+ return next;
+ }
+ }
+
+ next.value = undefined;
+ next.done = true;
+
+ return next;
+ };
+
+ return next.next = next;
+ }
+ }
+
+ // Return an iterator with no values.
+ return { next: doneResult };
+ }
+ runtime.values = values;
+
+ function doneResult() {
+ return { value: undefined, done: true };
+ }
+
+ Context.prototype = {
+ constructor: Context,
+
+ reset: function(skipTempReset) {
+ this.prev = 0;
+ this.next = 0;
+ // Resetting context._sent for legacy support of Babel's
+ // function.sent implementation.
+ this.sent = this._sent = undefined;
+ this.done = false;
+ this.delegate = null;
+
+ this.method = "next";
+ this.arg = undefined;
+
+ this.tryEntries.forEach(resetTryEntry);
+
+ if (!skipTempReset) {
+ for (var name in this) {
+ // Not sure about the optimal order of these conditions:
+ if (name.charAt(0) === "t" &&
+ hasOwn.call(this, name) &&
+ !isNaN(+name.slice(1))) {
+ this[name] = undefined;
+ }
+ }
+ }
+ },
+
+ stop: function() {
+ this.done = true;
+
+ var rootEntry = this.tryEntries[0];
+ var rootRecord = rootEntry.completion;
+ if (rootRecord.type === "throw") {
+ throw rootRecord.arg;
+ }
+
+ return this.rval;
+ },
+
+ dispatchException: function(exception) {
+ if (this.done) {
+ throw exception;
+ }
+
+ var context = this;
+ function handle(loc, caught) {
+ record.type = "throw";
+ record.arg = exception;
+ context.next = loc;
+
+ if (caught) {
+ // If the dispatched exception was caught by a catch block,
+ // then let that catch block handle the exception normally.
+ context.method = "next";
+ context.arg = undefined;
+ }
+
+ return !! caught;
+ }
+
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+ var record = entry.completion;
+
+ if (entry.tryLoc === "root") {
+ // Exception thrown outside of any try block that could handle
+ // it, so set the completion value of the entire function to
+ // throw the exception.
+ return handle("end");
+ }
+
+ if (entry.tryLoc <= this.prev) {
+ var hasCatch = hasOwn.call(entry, "catchLoc");
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
+
+ if (hasCatch && hasFinally) {
+ if (this.prev < entry.catchLoc) {
+ return handle(entry.catchLoc, true);
+ } else if (this.prev < entry.finallyLoc) {
+ return handle(entry.finallyLoc);
+ }
+
+ } else if (hasCatch) {
+ if (this.prev < entry.catchLoc) {
+ return handle(entry.catchLoc, true);
+ }
+
+ } else if (hasFinally) {
+ if (this.prev < entry.finallyLoc) {
+ return handle(entry.finallyLoc);
+ }
+
+ } else {
+ throw new Error("try statement without catch or finally");
+ }
+ }
+ }
+ },
+
+ abrupt: function(type, arg) {
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+ if (entry.tryLoc <= this.prev &&
+ hasOwn.call(entry, "finallyLoc") &&
+ this.prev < entry.finallyLoc) {
+ var finallyEntry = entry;
+ break;
+ }
+ }
+
+ if (finallyEntry &&
+ (type === "break" ||
+ type === "continue") &&
+ finallyEntry.tryLoc <= arg &&
+ arg <= finallyEntry.finallyLoc) {
+ // Ignore the finally entry if control is not jumping to a
+ // location outside the try/catch block.
+ finallyEntry = null;
+ }
+
+ var record = finallyEntry ? finallyEntry.completion : {};
+ record.type = type;
+ record.arg = arg;
+
+ if (finallyEntry) {
+ this.method = "next";
+ this.next = finallyEntry.finallyLoc;
+ return ContinueSentinel;
+ }
+
+ return this.complete(record);
+ },
+
+ complete: function(record, afterLoc) {
+ if (record.type === "throw") {
+ throw record.arg;
+ }
+
+ if (record.type === "break" ||
+ record.type === "continue") {
+ this.next = record.arg;
+ } else if (record.type === "return") {
+ this.rval = this.arg = record.arg;
+ this.method = "return";
+ this.next = "end";
+ } else if (record.type === "normal" && afterLoc) {
+ this.next = afterLoc;
+ }
+
+ return ContinueSentinel;
+ },
+
+ finish: function(finallyLoc) {
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+ if (entry.finallyLoc === finallyLoc) {
+ this.complete(entry.completion, entry.afterLoc);
+ resetTryEntry(entry);
+ return ContinueSentinel;
+ }
+ }
+ },
+
+ "catch": function(tryLoc) {
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
+ var entry = this.tryEntries[i];
+ if (entry.tryLoc === tryLoc) {
+ var record = entry.completion;
+ if (record.type === "throw") {
+ var thrown = record.arg;
+ resetTryEntry(entry);
+ }
+ return thrown;
+ }
+ }
+
+ // The context.catch method must only be called with a location
+ // argument that corresponds to a known catch block.
+ throw new Error("illegal catch attempt");
+ },
+
+ delegateYield: function(iterable, resultName, nextLoc) {
+ this.delegate = {
+ iterator: values(iterable),
+ resultName: resultName,
+ nextLoc: nextLoc
+ };
+
+ if (this.method === "next") {
+ // Deliberately forget the last sent value so that we don't
+ // accidentally pass it on to the delegate.
+ this.arg = undefined;
+ }
+
+ return ContinueSentinel;
+ }
+ };
+})(
+ // Among the various tricks for obtaining a reference to the global
+ // object, this seems to be the most reliable technique that does not
+ // use indirect eval (which violates Content Security Policy).
+ typeof global === "object" ? global :
+ typeof window === "object" ? window :
+ typeof self === "object" ? self : this
+);
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],62:[function(require,module,exports){
+'use strict'
+
+exports.byteLength = byteLength
+exports.toByteArray = toByteArray
+exports.fromByteArray = fromByteArray
+
+var lookup = []
+var revLookup = []
+var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
+
+var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+for (var i = 0, len = code.length; i < len; ++i) {
+ lookup[i] = code[i]
+ revLookup[code.charCodeAt(i)] = i
+}
+
+// Support decoding URL-safe base64 strings, as Node.js does.
+// See: https://en.wikipedia.org/wiki/Base64#URL_applications
+revLookup['-'.charCodeAt(0)] = 62
+revLookup['_'.charCodeAt(0)] = 63
+
+function getLens (b64) {
+ var len = b64.length
+
+ if (len % 4 > 0) {
+ throw new Error('Invalid string. Length must be a multiple of 4')
+ }
+
+ // Trim off extra bytes after placeholder bytes are found
+ // See: https://github.com/beatgammit/base64-js/issues/42
+ var validLen = b64.indexOf('=')
+ if (validLen === -1) validLen = len
+
+ var placeHoldersLen = validLen === len
+ ? 0
+ : 4 - (validLen % 4)
+
+ return [validLen, placeHoldersLen]
+}
+
+// base64 is 4/3 + up to two characters of the original data
+function byteLength (b64) {
+ var lens = getLens(b64)
+ var validLen = lens[0]
+ var placeHoldersLen = lens[1]
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
+}
+
+function _byteLength (b64, validLen, placeHoldersLen) {
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
+}
+
+function toByteArray (b64) {
+ var tmp
+ var lens = getLens(b64)
+ var validLen = lens[0]
+ var placeHoldersLen = lens[1]
+
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
+
+ var curByte = 0
+
+ // if there are placeholders, only get up to the last complete 4 chars
+ var len = placeHoldersLen > 0
+ ? validLen - 4
+ : validLen
+
+ for (var i = 0; i < len; i += 4) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 18) |
+ (revLookup[b64.charCodeAt(i + 1)] << 12) |
+ (revLookup[b64.charCodeAt(i + 2)] << 6) |
+ revLookup[b64.charCodeAt(i + 3)]
+ arr[curByte++] = (tmp >> 16) & 0xFF
+ arr[curByte++] = (tmp >> 8) & 0xFF
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ if (placeHoldersLen === 2) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 2) |
+ (revLookup[b64.charCodeAt(i + 1)] >> 4)
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ if (placeHoldersLen === 1) {
+ tmp =
+ (revLookup[b64.charCodeAt(i)] << 10) |
+ (revLookup[b64.charCodeAt(i + 1)] << 4) |
+ (revLookup[b64.charCodeAt(i + 2)] >> 2)
+ arr[curByte++] = (tmp >> 8) & 0xFF
+ arr[curByte++] = tmp & 0xFF
+ }
+
+ return arr
+}
+
+function tripletToBase64 (num) {
+ return lookup[num >> 18 & 0x3F] +
+ lookup[num >> 12 & 0x3F] +
+ lookup[num >> 6 & 0x3F] +
+ lookup[num & 0x3F]
+}
+
+function encodeChunk (uint8, start, end) {
+ var tmp
+ var output = []
+ for (var i = start; i < end; i += 3) {
+ tmp =
+ ((uint8[i] << 16) & 0xFF0000) +
+ ((uint8[i + 1] << 8) & 0xFF00) +
+ (uint8[i + 2] & 0xFF)
+ output.push(tripletToBase64(tmp))
+ }
+ return output.join('')
+}
+
+function fromByteArray (uint8) {
+ var tmp
+ var len = uint8.length
+ var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
+ var parts = []
+ var maxChunkLength = 16383 // must be multiple of 3
+
+ // go through the array every three bytes, we'll deal with trailing stuff later
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
+ parts.push(encodeChunk(
+ uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
+ ))
+ }
+
+ // pad the end with zeros, but make sure to not forget the extra bytes
+ if (extraBytes === 1) {
+ tmp = uint8[len - 1]
+ parts.push(
+ lookup[tmp >> 2] +
+ lookup[(tmp << 4) & 0x3F] +
+ '=='
+ )
+ } else if (extraBytes === 2) {
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1]
+ parts.push(
+ lookup[tmp >> 10] +
+ lookup[(tmp >> 4) & 0x3F] +
+ lookup[(tmp << 2) & 0x3F] +
+ '='
+ )
+ }
+
+ return parts.join('')
+}
+
+},{}],63:[function(require,module,exports){
+'use strict';
+
+var crypto_hash_sha512 = require('tweetnacl').lowlevel.crypto_hash;
+
+/*
+ * This file is a 1:1 port from the OpenBSD blowfish.c and bcrypt_pbkdf.c. As a
+ * result, it retains the original copyright and license. The two files are
+ * under slightly different (but compatible) licenses, and are here combined in
+ * one file.
+ *
+ * Credit for the actual porting work goes to:
+ * Devi Mandiri
+ */
+
+/*
+ * The Blowfish portions are under the following license:
+ *
+ * Blowfish block cipher for OpenBSD
+ * Copyright 1997 Niels Provos
+ * All rights reserved.
+ *
+ * Implementation advice by David Mazieres .
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * The bcrypt_pbkdf portions are under the following license:
+ *
+ * Copyright (c) 2013 Ted Unangst
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Performance improvements (Javascript-specific):
+ *
+ * Copyright 2016, Joyent Inc
+ * Author: Alex Wilson
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+// Ported from OpenBSD bcrypt_pbkdf.c v1.9
+
+var BLF_J = 0;
+
+var Blowfish = function() {
+ this.S = [
+ new Uint32Array([
+ 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
+ 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
+ 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
+ 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
+ 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
+ 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
+ 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
+ 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
+ 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
+ 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
+ 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
+ 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
+ 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
+ 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
+ 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
+ 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
+ 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
+ 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
+ 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
+ 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
+ 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
+ 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
+ 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
+ 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
+ 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
+ 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
+ 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
+ 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
+ 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
+ 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
+ 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
+ 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
+ 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
+ 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
+ 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
+ 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
+ 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
+ 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
+ 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
+ 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
+ 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
+ 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
+ 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
+ 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
+ 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
+ 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
+ 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
+ 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
+ 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
+ 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
+ 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
+ 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
+ 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
+ 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
+ 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
+ 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
+ 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
+ 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
+ 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
+ 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
+ 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
+ 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
+ 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
+ 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a]),
+ new Uint32Array([
+ 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
+ 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
+ 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
+ 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
+ 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
+ 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
+ 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
+ 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
+ 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
+ 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
+ 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
+ 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
+ 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
+ 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
+ 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
+ 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
+ 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
+ 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
+ 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
+ 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
+ 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
+ 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
+ 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
+ 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
+ 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
+ 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
+ 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
+ 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
+ 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
+ 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
+ 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
+ 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
+ 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
+ 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
+ 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
+ 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
+ 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
+ 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
+ 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
+ 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
+ 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
+ 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
+ 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
+ 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
+ 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
+ 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
+ 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
+ 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
+ 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
+ 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
+ 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
+ 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
+ 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
+ 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
+ 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
+ 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
+ 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
+ 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
+ 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
+ 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
+ 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
+ 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
+ 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
+ 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7]),
+ new Uint32Array([
+ 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
+ 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
+ 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
+ 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
+ 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
+ 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
+ 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
+ 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
+ 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
+ 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
+ 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
+ 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
+ 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
+ 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
+ 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
+ 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
+ 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
+ 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
+ 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
+ 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
+ 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
+ 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
+ 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
+ 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
+ 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
+ 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
+ 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
+ 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
+ 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
+ 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
+ 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
+ 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
+ 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
+ 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
+ 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
+ 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
+ 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
+ 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
+ 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
+ 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
+ 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
+ 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
+ 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
+ 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
+ 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
+ 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
+ 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
+ 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
+ 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
+ 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
+ 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
+ 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
+ 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
+ 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
+ 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
+ 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
+ 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
+ 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
+ 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
+ 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
+ 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
+ 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
+ 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
+ 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0]),
+ new Uint32Array([
+ 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
+ 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
+ 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
+ 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
+ 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
+ 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
+ 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
+ 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
+ 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
+ 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
+ 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
+ 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
+ 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
+ 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
+ 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
+ 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
+ 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
+ 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
+ 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
+ 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
+ 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
+ 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
+ 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
+ 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
+ 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
+ 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
+ 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
+ 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
+ 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
+ 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
+ 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
+ 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
+ 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
+ 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
+ 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
+ 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
+ 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
+ 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
+ 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
+ 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
+ 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
+ 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
+ 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
+ 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
+ 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
+ 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
+ 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
+ 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
+ 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
+ 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
+ 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
+ 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
+ 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
+ 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
+ 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
+ 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
+ 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
+ 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
+ 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
+ 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
+ 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
+ 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
+ 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
+ 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6])
+ ];
+ this.P = new Uint32Array([
+ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
+ 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
+ 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
+ 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
+ 0x9216d5d9, 0x8979fb1b]);
+};
+
+function F(S, x8, i) {
+ return (((S[0][x8[i+3]] +
+ S[1][x8[i+2]]) ^
+ S[2][x8[i+1]]) +
+ S[3][x8[i]]);
+};
+
+Blowfish.prototype.encipher = function(x, x8) {
+ if (x8 === undefined) {
+ x8 = new Uint8Array(x.buffer);
+ if (x.byteOffset !== 0)
+ x8 = x8.subarray(x.byteOffset);
+ }
+ x[0] ^= this.P[0];
+ for (var i = 1; i < 16; i += 2) {
+ x[1] ^= F(this.S, x8, 0) ^ this.P[i];
+ x[0] ^= F(this.S, x8, 4) ^ this.P[i+1];
+ }
+ var t = x[0];
+ x[0] = x[1] ^ this.P[17];
+ x[1] = t;
+};
+
+Blowfish.prototype.decipher = function(x) {
+ var x8 = new Uint8Array(x.buffer);
+ if (x.byteOffset !== 0)
+ x8 = x8.subarray(x.byteOffset);
+ x[0] ^= this.P[17];
+ for (var i = 16; i > 0; i -= 2) {
+ x[1] ^= F(this.S, x8, 0) ^ this.P[i];
+ x[0] ^= F(this.S, x8, 4) ^ this.P[i-1];
+ }
+ var t = x[0];
+ x[0] = x[1] ^ this.P[0];
+ x[1] = t;
+};
+
+function stream2word(data, databytes){
+ var i, temp = 0;
+ for (i = 0; i < 4; i++, BLF_J++) {
+ if (BLF_J >= databytes) BLF_J = 0;
+ temp = (temp << 8) | data[BLF_J];
+ }
+ return temp;
+};
+
+Blowfish.prototype.expand0state = function(key, keybytes) {
+ var d = new Uint32Array(2), i, k;
+ var d8 = new Uint8Array(d.buffer);
+
+ for (i = 0, BLF_J = 0; i < 18; i++) {
+ this.P[i] ^= stream2word(key, keybytes);
+ }
+ BLF_J = 0;
+
+ for (i = 0; i < 18; i += 2) {
+ this.encipher(d, d8);
+ this.P[i] = d[0];
+ this.P[i+1] = d[1];
+ }
+
+ for (i = 0; i < 4; i++) {
+ for (k = 0; k < 256; k += 2) {
+ this.encipher(d, d8);
+ this.S[i][k] = d[0];
+ this.S[i][k+1] = d[1];
+ }
+ }
+};
+
+Blowfish.prototype.expandstate = function(data, databytes, key, keybytes) {
+ var d = new Uint32Array(2), i, k;
+
+ for (i = 0, BLF_J = 0; i < 18; i++) {
+ this.P[i] ^= stream2word(key, keybytes);
+ }
+
+ for (i = 0, BLF_J = 0; i < 18; i += 2) {
+ d[0] ^= stream2word(data, databytes);
+ d[1] ^= stream2word(data, databytes);
+ this.encipher(d);
+ this.P[i] = d[0];
+ this.P[i+1] = d[1];
+ }
+
+ for (i = 0; i < 4; i++) {
+ for (k = 0; k < 256; k += 2) {
+ d[0] ^= stream2word(data, databytes);
+ d[1] ^= stream2word(data, databytes);
+ this.encipher(d);
+ this.S[i][k] = d[0];
+ this.S[i][k+1] = d[1];
+ }
+ }
+ BLF_J = 0;
+};
+
+Blowfish.prototype.enc = function(data, blocks) {
+ for (var i = 0; i < blocks; i++) {
+ this.encipher(data.subarray(i*2));
+ }
+};
+
+Blowfish.prototype.dec = function(data, blocks) {
+ for (var i = 0; i < blocks; i++) {
+ this.decipher(data.subarray(i*2));
+ }
+};
+
+var BCRYPT_BLOCKS = 8,
+ BCRYPT_HASHSIZE = 32;
+
+function bcrypt_hash(sha2pass, sha2salt, out) {
+ var state = new Blowfish(),
+ cdata = new Uint32Array(BCRYPT_BLOCKS), i,
+ ciphertext = new Uint8Array([79,120,121,99,104,114,111,109,97,116,105,
+ 99,66,108,111,119,102,105,115,104,83,119,97,116,68,121,110,97,109,
+ 105,116,101]); //"OxychromaticBlowfishSwatDynamite"
+
+ state.expandstate(sha2salt, 64, sha2pass, 64);
+ for (i = 0; i < 64; i++) {
+ state.expand0state(sha2salt, 64);
+ state.expand0state(sha2pass, 64);
+ }
+
+ for (i = 0; i < BCRYPT_BLOCKS; i++)
+ cdata[i] = stream2word(ciphertext, ciphertext.byteLength);
+ for (i = 0; i < 64; i++)
+ state.enc(cdata, cdata.byteLength / 8);
+
+ for (i = 0; i < BCRYPT_BLOCKS; i++) {
+ out[4*i+3] = cdata[i] >>> 24;
+ out[4*i+2] = cdata[i] >>> 16;
+ out[4*i+1] = cdata[i] >>> 8;
+ out[4*i+0] = cdata[i];
+ }
+};
+
+function bcrypt_pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds) {
+ var sha2pass = new Uint8Array(64),
+ sha2salt = new Uint8Array(64),
+ out = new Uint8Array(BCRYPT_HASHSIZE),
+ tmpout = new Uint8Array(BCRYPT_HASHSIZE),
+ countsalt = new Uint8Array(saltlen+4),
+ i, j, amt, stride, dest, count,
+ origkeylen = keylen;
+
+ if (rounds < 1)
+ return -1;
+ if (passlen === 0 || saltlen === 0 || keylen === 0 ||
+ keylen > (out.byteLength * out.byteLength) || saltlen > (1<<20))
+ return -1;
+
+ stride = Math.floor((keylen + out.byteLength - 1) / out.byteLength);
+ amt = Math.floor((keylen + stride - 1) / stride);
+
+ for (i = 0; i < saltlen; i++)
+ countsalt[i] = salt[i];
+
+ crypto_hash_sha512(sha2pass, pass, passlen);
+
+ for (count = 1; keylen > 0; count++) {
+ countsalt[saltlen+0] = count >>> 24;
+ countsalt[saltlen+1] = count >>> 16;
+ countsalt[saltlen+2] = count >>> 8;
+ countsalt[saltlen+3] = count;
+
+ crypto_hash_sha512(sha2salt, countsalt, saltlen + 4);
+ bcrypt_hash(sha2pass, sha2salt, tmpout);
+ for (i = out.byteLength; i--;)
+ out[i] = tmpout[i];
+
+ for (i = 1; i < rounds; i++) {
+ crypto_hash_sha512(sha2salt, tmpout, tmpout.byteLength);
+ bcrypt_hash(sha2pass, sha2salt, tmpout);
+ for (j = 0; j < out.byteLength; j++)
+ out[j] ^= tmpout[j];
+ }
+
+ amt = Math.min(amt, keylen);
+ for (i = 0; i < amt; i++) {
+ dest = i * stride + (count - 1);
+ if (dest >= origkeylen)
+ break;
+ key[dest] = out[i];
+ }
+ keylen -= i;
+ }
+
+ return 0;
+};
+
+module.exports = {
+ BLOCKS: BCRYPT_BLOCKS,
+ HASHSIZE: BCRYPT_HASHSIZE,
+ hash: bcrypt_hash,
+ pbkdf: bcrypt_pbkdf
+};
+
+},{"tweetnacl":1427}],64:[function(require,module,exports){
+var document = require('global/document')
+var hyperx = require('hyperx')
+var onload = require('on-load')
+
+var SVGNS = 'http://www.w3.org/2000/svg'
+var XLINKNS = 'http://www.w3.org/1999/xlink'
+
+var BOOL_PROPS = {
+ autofocus: 1,
+ checked: 1,
+ defaultchecked: 1,
+ disabled: 1,
+ formnovalidate: 1,
+ indeterminate: 1,
+ readonly: 1,
+ required: 1,
+ selected: 1,
+ willvalidate: 1
+}
+var COMMENT_TAG = '!--'
+var SVG_TAGS = [
+ 'svg',
+ 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor',
+ 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile',
+ 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix',
+ 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
+ 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB',
+ 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode',
+ 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting',
+ 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'font', 'font-face',
+ 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri',
+ 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line',
+ 'linearGradient', 'marker', 'mask', 'metadata', 'missing-glyph', 'mpath',
+ 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect',
+ 'set', 'stop', 'switch', 'symbol', 'text', 'textPath', 'title', 'tref',
+ 'tspan', 'use', 'view', 'vkern'
+]
+
+function belCreateElement (tag, props, children) {
+ var el
+
+ // If an svg tag, it needs a namespace
+ if (SVG_TAGS.indexOf(tag) !== -1) {
+ props.namespace = SVGNS
+ }
+
+ // If we are using a namespace
+ var ns = false
+ if (props.namespace) {
+ ns = props.namespace
+ delete props.namespace
+ }
+
+ // Create the element
+ if (ns) {
+ el = document.createElementNS(ns, tag)
+ } else if (tag === COMMENT_TAG) {
+ return document.createComment(props.comment)
+ } else {
+ el = document.createElement(tag)
+ }
+
+ // If adding onload events
+ if (props.onload || props.onunload) {
+ var load = props.onload || function () {}
+ var unload = props.onunload || function () {}
+ onload(el, function belOnload () {
+ load(el)
+ }, function belOnunload () {
+ unload(el)
+ },
+ // We have to use non-standard `caller` to find who invokes `belCreateElement`
+ belCreateElement.caller.caller.caller)
+ delete props.onload
+ delete props.onunload
+ }
+
+ // Create the properties
+ for (var p in props) {
+ if (props.hasOwnProperty(p)) {
+ var key = p.toLowerCase()
+ var val = props[p]
+ // Normalize className
+ if (key === 'classname') {
+ key = 'class'
+ p = 'class'
+ }
+ // The for attribute gets transformed to htmlFor, but we just set as for
+ if (p === 'htmlFor') {
+ p = 'for'
+ }
+ // If a property is boolean, set itself to the key
+ if (BOOL_PROPS[key]) {
+ if (val === 'true') val = key
+ else if (val === 'false') continue
+ }
+ // If a property prefers being set directly vs setAttribute
+ if (key.slice(0, 2) === 'on') {
+ el[p] = val
+ } else {
+ if (ns) {
+ if (p === 'xlink:href') {
+ el.setAttributeNS(XLINKNS, p, val)
+ } else if (/^xmlns($|:)/i.test(p)) {
+ // skip xmlns definitions
+ } else {
+ el.setAttributeNS(null, p, val)
+ }
+ } else {
+ el.setAttribute(p, val)
+ }
+ }
+ }
+ }
+
+ function appendChild (childs) {
+ if (!Array.isArray(childs)) return
+ for (var i = 0; i < childs.length; i++) {
+ var node = childs[i]
+ if (Array.isArray(node)) {
+ appendChild(node)
+ continue
+ }
+
+ if (typeof node === 'number' ||
+ typeof node === 'boolean' ||
+ typeof node === 'function' ||
+ node instanceof Date ||
+ node instanceof RegExp) {
+ node = node.toString()
+ }
+
+ if (typeof node === 'string') {
+ if (el.lastChild && el.lastChild.nodeName === '#text') {
+ el.lastChild.nodeValue += node
+ continue
+ }
+ node = document.createTextNode(node)
+ }
+
+ if (node && node.nodeType) {
+ el.appendChild(node)
+ }
+ }
+ }
+ appendChild(children)
+
+ return el
+}
+
+module.exports = hyperx(belCreateElement, {comments: true})
+module.exports.default = module.exports
+module.exports.createElement = belCreateElement
+
+},{"global/document":731,"hyperx":824,"on-load":984}],65:[function(require,module,exports){
+// Reference https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki
+// Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
+// NOTE: SIGHASH byte ignored AND restricted, truncate before use
+
+var Buffer = require('safe-buffer').Buffer
+
+function check (buffer) {
+ if (buffer.length < 8) return false
+ if (buffer.length > 72) return false
+ if (buffer[0] !== 0x30) return false
+ if (buffer[1] !== buffer.length - 2) return false
+ if (buffer[2] !== 0x02) return false
+
+ var lenR = buffer[3]
+ if (lenR === 0) return false
+ if (5 + lenR >= buffer.length) return false
+ if (buffer[4 + lenR] !== 0x02) return false
+
+ var lenS = buffer[5 + lenR]
+ if (lenS === 0) return false
+ if ((6 + lenR + lenS) !== buffer.length) return false
+
+ if (buffer[4] & 0x80) return false
+ if (lenR > 1 && (buffer[4] === 0x00) && !(buffer[5] & 0x80)) return false
+
+ if (buffer[lenR + 6] & 0x80) return false
+ if (lenS > 1 && (buffer[lenR + 6] === 0x00) && !(buffer[lenR + 7] & 0x80)) return false
+ return true
+}
+
+function decode (buffer) {
+ if (buffer.length < 8) throw new Error('DER sequence length is too short')
+ if (buffer.length > 72) throw new Error('DER sequence length is too long')
+ if (buffer[0] !== 0x30) throw new Error('Expected DER sequence')
+ if (buffer[1] !== buffer.length - 2) throw new Error('DER sequence length is invalid')
+ if (buffer[2] !== 0x02) throw new Error('Expected DER integer')
+
+ var lenR = buffer[3]
+ if (lenR === 0) throw new Error('R length is zero')
+ if (5 + lenR >= buffer.length) throw new Error('R length is too long')
+ if (buffer[4 + lenR] !== 0x02) throw new Error('Expected DER integer (2)')
+
+ var lenS = buffer[5 + lenR]
+ if (lenS === 0) throw new Error('S length is zero')
+ if ((6 + lenR + lenS) !== buffer.length) throw new Error('S length is invalid')
+
+ if (buffer[4] & 0x80) throw new Error('R value is negative')
+ if (lenR > 1 && (buffer[4] === 0x00) && !(buffer[5] & 0x80)) throw new Error('R value excessively padded')
+
+ if (buffer[lenR + 6] & 0x80) throw new Error('S value is negative')
+ if (lenS > 1 && (buffer[lenR + 6] === 0x00) && !(buffer[lenR + 7] & 0x80)) throw new Error('S value excessively padded')
+
+ // non-BIP66 - extract R, S values
+ return {
+ r: buffer.slice(4, 4 + lenR),
+ s: buffer.slice(6 + lenR)
+ }
+}
+
+/*
+ * Expects r and s to be positive DER integers.
+ *
+ * The DER format uses the most significant bit as a sign bit (& 0x80).
+ * If the significant bit is set AND the integer is positive, a 0x00 is prepended.
+ *
+ * Examples:
+ *
+ * 0 => 0x00
+ * 1 => 0x01
+ * -1 => 0xff
+ * 127 => 0x7f
+ * -127 => 0x81
+ * 128 => 0x0080
+ * -128 => 0x80
+ * 255 => 0x00ff
+ * -255 => 0xff01
+ * 16300 => 0x3fac
+ * -16300 => 0xc054
+ * 62300 => 0x00f35c
+ * -62300 => 0xff0ca4
+*/
+function encode (r, s) {
+ var lenR = r.length
+ var lenS = s.length
+ if (lenR === 0) throw new Error('R length is zero')
+ if (lenS === 0) throw new Error('S length is zero')
+ if (lenR > 33) throw new Error('R length is too long')
+ if (lenS > 33) throw new Error('S length is too long')
+ if (r[0] & 0x80) throw new Error('R value is negative')
+ if (s[0] & 0x80) throw new Error('S value is negative')
+ if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) throw new Error('R value excessively padded')
+ if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) throw new Error('S value excessively padded')
+
+ var signature = Buffer.allocUnsafe(6 + lenR + lenS)
+
+ // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
+ signature[0] = 0x30
+ signature[1] = signature.length - 2
+ signature[2] = 0x02
+ signature[3] = r.length
+ r.copy(signature, 4)
+ signature[4 + lenR] = 0x02
+ signature[5 + lenR] = s.length
+ s.copy(signature, 6 + lenR)
+
+ return signature
+}
+
+module.exports = {
+ check: check,
+ decode: decode,
+ encode: encode
+}
+
+},{"safe-buffer":1334}],66:[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 ? '';
+ };
+
+ /*
+
+ 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":77}],67:[function(require,module,exports){
+ace.define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/anchor","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom","ace/editor"], function(acequire, exports, module) {
+"use strict";
+var oop = acequire("./lib/oop");
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var lang = acequire("./lib/lang");
+var Range = acequire("./range").Range;
+var Anchor = acequire("./anchor").Anchor;
+var HashHandler = acequire("./keyboard/hash_handler").HashHandler;
+var Tokenizer = acequire("./tokenizer").Tokenizer;
+var comparePoints = Range.comparePoints;
+
+var SnippetManager = function() {
+ this.snippetMap = {};
+ this.snippetNameMap = {};
+};
+
+(function() {
+ oop.implement(this, EventEmitter);
+
+ this.getTokenizer = function() {
+ function TabstopToken(str, _, stack) {
+ str = str.substr(1);
+ if (/^\d+$/.test(str) && !stack.inFormatString)
+ return [{tabstopId: parseInt(str, 10)}];
+ return [{text: str}];
+ }
+ function escape(ch) {
+ return "(?:[^\\\\" + ch + "]|\\\\.)";
+ }
+ SnippetManager.$tokenizer = new Tokenizer({
+ start: [
+ {regex: /:/, onMatch: function(val, state, stack) {
+ if (stack.length && stack[0].expectIf) {
+ stack[0].expectIf = false;
+ stack[0].elseBranch = stack[0];
+ return [stack[0]];
+ }
+ return ":";
+ }},
+ {regex: /\\./, onMatch: function(val, state, stack) {
+ var ch = val[1];
+ if (ch == "}" && stack.length) {
+ val = ch;
+ }else if ("`$\\".indexOf(ch) != -1) {
+ val = ch;
+ } else if (stack.inFormatString) {
+ if (ch == "n")
+ val = "\n";
+ else if (ch == "t")
+ val = "\n";
+ else if ("ulULE".indexOf(ch) != -1) {
+ val = {changeCase: ch, local: ch > "a"};
+ }
+ }
+
+ return [val];
+ }},
+ {regex: /}/, onMatch: function(val, state, stack) {
+ return [stack.length ? stack.shift() : val];
+ }},
+ {regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken},
+ {regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
+ var t = TabstopToken(str.substr(1), state, stack);
+ stack.unshift(t[0]);
+ return t;
+ }, next: "snippetVar"},
+ {regex: /\n/, token: "newline", merge: false}
+ ],
+ snippetVar: [
+ {regex: "\\|" + escape("\\|") + "*\\|", onMatch: function(val, state, stack) {
+ stack[0].choices = val.slice(1, -1).split(",");
+ }, next: "start"},
+ {regex: "/(" + escape("/") + "+)/(?:(" + escape("/") + "*)/)(\\w*):?",
+ onMatch: function(val, state, stack) {
+ var ts = stack[0];
+ ts.fmtString = val;
+
+ val = this.splitRegex.exec(val);
+ ts.guard = val[1];
+ ts.fmt = val[2];
+ ts.flag = val[3];
+ return "";
+ }, next: "start"},
+ {regex: "`" + escape("`") + "*`", onMatch: function(val, state, stack) {
+ stack[0].code = val.splice(1, -1);
+ return "";
+ }, next: "start"},
+ {regex: "\\?", onMatch: function(val, state, stack) {
+ if (stack[0])
+ stack[0].expectIf = true;
+ }, next: "start"},
+ {regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start"}
+ ],
+ formatString: [
+ {regex: "/(" + escape("/") + "+)/", token: "regex"},
+ {regex: "", onMatch: function(val, state, stack) {
+ stack.inFormatString = true;
+ }, next: "start"}
+ ]
+ });
+ SnippetManager.prototype.getTokenizer = function() {
+ return SnippetManager.$tokenizer;
+ };
+ return SnippetManager.$tokenizer;
+ };
+
+ this.tokenizeTmSnippet = function(str, startState) {
+ return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x) {
+ return x.value || x;
+ });
+ };
+
+ this.$getDefaultValue = function(editor, name) {
+ if (/^[A-Z]\d+$/.test(name)) {
+ var i = name.substr(1);
+ return (this.variables[name[0] + "__"] || {})[i];
+ }
+ if (/^\d+$/.test(name)) {
+ return (this.variables.__ || {})[name];
+ }
+ name = name.replace(/^TM_/, "");
+
+ if (!editor)
+ return;
+ var s = editor.session;
+ switch(name) {
+ case "CURRENT_WORD":
+ var r = s.getWordRange();
+ case "SELECTION":
+ case "SELECTED_TEXT":
+ return s.getTextRange(r);
+ case "CURRENT_LINE":
+ return s.getLine(editor.getCursorPosition().row);
+ case "PREV_LINE": // not possible in textmate
+ return s.getLine(editor.getCursorPosition().row - 1);
+ case "LINE_INDEX":
+ return editor.getCursorPosition().column;
+ case "LINE_NUMBER":
+ return editor.getCursorPosition().row + 1;
+ case "SOFT_TABS":
+ return s.getUseSoftTabs() ? "YES" : "NO";
+ case "TAB_SIZE":
+ return s.getTabSize();
+ case "FILENAME":
+ case "FILEPATH":
+ return "";
+ case "FULLNAME":
+ return "Ace";
+ }
+ };
+ this.variables = {};
+ this.getVariableValue = function(editor, varName) {
+ if (this.variables.hasOwnProperty(varName))
+ return this.variables[varName](editor, varName) || "";
+ return this.$getDefaultValue(editor, varName) || "";
+ };
+ this.tmStrFormat = function(str, ch, editor) {
+ var flag = ch.flag || "";
+ var re = ch.guard;
+ re = new RegExp(re, flag.replace(/[^gi]/, ""));
+ var fmtTokens = this.tokenizeTmSnippet(ch.fmt, "formatString");
+ var _self = this;
+ var formatted = str.replace(re, function() {
+ _self.variables.__ = arguments;
+ var fmtParts = _self.resolveVariables(fmtTokens, editor);
+ var gChangeCase = "E";
+ for (var i = 0; i < fmtParts.length; i++) {
+ var ch = fmtParts[i];
+ if (typeof ch == "object") {
+ fmtParts[i] = "";
+ if (ch.changeCase && ch.local) {
+ var next = fmtParts[i + 1];
+ if (next && typeof next == "string") {
+ if (ch.changeCase == "u")
+ fmtParts[i] = next[0].toUpperCase();
+ else
+ fmtParts[i] = next[0].toLowerCase();
+ fmtParts[i + 1] = next.substr(1);
+ }
+ } else if (ch.changeCase) {
+ gChangeCase = ch.changeCase;
+ }
+ } else if (gChangeCase == "U") {
+ fmtParts[i] = ch.toUpperCase();
+ } else if (gChangeCase == "L") {
+ fmtParts[i] = ch.toLowerCase();
+ }
+ }
+ return fmtParts.join("");
+ });
+ this.variables.__ = null;
+ return formatted;
+ };
+
+ this.resolveVariables = function(snippet, editor) {
+ var result = [];
+ for (var i = 0; i < snippet.length; i++) {
+ var ch = snippet[i];
+ if (typeof ch == "string") {
+ result.push(ch);
+ } else if (typeof ch != "object") {
+ continue;
+ } else if (ch.skip) {
+ gotoNext(ch);
+ } else if (ch.processed < i) {
+ continue;
+ } else if (ch.text) {
+ var value = this.getVariableValue(editor, ch.text);
+ if (value && ch.fmtString)
+ value = this.tmStrFormat(value, ch);
+ ch.processed = i;
+ if (ch.expectIf == null) {
+ if (value) {
+ result.push(value);
+ gotoNext(ch);
+ }
+ } else {
+ if (value) {
+ ch.skip = ch.elseBranch;
+ } else
+ gotoNext(ch);
+ }
+ } else if (ch.tabstopId != null) {
+ result.push(ch);
+ } else if (ch.changeCase != null) {
+ result.push(ch);
+ }
+ }
+ function gotoNext(ch) {
+ var i1 = snippet.indexOf(ch, i + 1);
+ if (i1 != -1)
+ i = i1;
+ }
+ return result;
+ };
+
+ this.insertSnippetForSelection = function(editor, snippetText) {
+ var cursor = editor.getCursorPosition();
+ var line = editor.session.getLine(cursor.row);
+ var tabString = editor.session.getTabString();
+ var indentString = line.match(/^\s*/)[0];
+
+ if (cursor.column < indentString.length)
+ indentString = indentString.slice(0, cursor.column);
+
+ var tokens = this.tokenizeTmSnippet(snippetText);
+ tokens = this.resolveVariables(tokens, editor);
+ tokens = tokens.map(function(x) {
+ if (x == "\n")
+ return x + indentString;
+ if (typeof x == "string")
+ return x.replace(/\t/g, tabString);
+ return x;
+ });
+ var tabstops = [];
+ tokens.forEach(function(p, i) {
+ if (typeof p != "object")
+ return;
+ var id = p.tabstopId;
+ var ts = tabstops[id];
+ if (!ts) {
+ ts = tabstops[id] = [];
+ ts.index = id;
+ ts.value = "";
+ }
+ if (ts.indexOf(p) !== -1)
+ return;
+ ts.push(p);
+ var i1 = tokens.indexOf(p, i + 1);
+ if (i1 === -1)
+ return;
+
+ var value = tokens.slice(i + 1, i1);
+ var isNested = value.some(function(t) {return typeof t === "object"});
+ if (isNested && !ts.value) {
+ ts.value = value;
+ } else if (value.length && (!ts.value || typeof ts.value !== "string")) {
+ ts.value = value.join("");
+ }
+ });
+ tabstops.forEach(function(ts) {ts.length = 0});
+ var expanding = {};
+ function copyValue(val) {
+ var copy = [];
+ for (var i = 0; i < val.length; i++) {
+ var p = val[i];
+ if (typeof p == "object") {
+ if (expanding[p.tabstopId])
+ continue;
+ var j = val.lastIndexOf(p, i - 1);
+ p = copy[j] || {tabstopId: p.tabstopId};
+ }
+ copy[i] = p;
+ }
+ return copy;
+ }
+ for (var i = 0; i < tokens.length; i++) {
+ var p = tokens[i];
+ if (typeof p != "object")
+ continue;
+ var id = p.tabstopId;
+ var i1 = tokens.indexOf(p, i + 1);
+ if (expanding[id]) {
+ if (expanding[id] === p)
+ expanding[id] = null;
+ continue;
+ }
+
+ var ts = tabstops[id];
+ var arg = typeof ts.value == "string" ? [ts.value] : copyValue(ts.value);
+ arg.unshift(i + 1, Math.max(0, i1 - i));
+ arg.push(p);
+ expanding[id] = p;
+ tokens.splice.apply(tokens, arg);
+
+ if (ts.indexOf(p) === -1)
+ ts.push(p);
+ }
+ var row = 0, column = 0;
+ var text = "";
+ tokens.forEach(function(t) {
+ if (typeof t === "string") {
+ if (t[0] === "\n"){
+ column = t.length - 1;
+ row ++;
+ } else
+ column += t.length;
+ text += t;
+ } else {
+ if (!t.start)
+ t.start = {row: row, column: column};
+ else
+ t.end = {row: row, column: column};
+ }
+ });
+ var range = editor.getSelectionRange();
+ var end = editor.session.replace(range, text);
+
+ var tabstopManager = new TabstopManager(editor);
+ var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
+ tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
+ };
+
+ this.insertSnippet = function(editor, snippetText) {
+ var self = this;
+ if (editor.inVirtualSelectionMode)
+ return self.insertSnippetForSelection(editor, snippetText);
+
+ editor.forEachSelection(function() {
+ self.insertSnippetForSelection(editor, snippetText);
+ }, null, {keepOrder: true});
+
+ if (editor.tabstopManager)
+ editor.tabstopManager.tabNext();
+ };
+
+ this.$getScope = function(editor) {
+ var scope = editor.session.$mode.$id || "";
+ scope = scope.split("/").pop();
+ if (scope === "html" || scope === "php") {
+ if (scope === "php" && !editor.session.$mode.inlinePhp)
+ scope = "html";
+ var c = editor.getCursorPosition();
+ var state = editor.session.getState(c.row);
+ if (typeof state === "object") {
+ state = state[0];
+ }
+ if (state.substring) {
+ if (state.substring(0, 3) == "js-")
+ scope = "javascript";
+ else if (state.substring(0, 4) == "css-")
+ scope = "css";
+ else if (state.substring(0, 4) == "php-")
+ scope = "php";
+ }
+ }
+
+ return scope;
+ };
+
+ this.getActiveScopes = function(editor) {
+ var scope = this.$getScope(editor);
+ var scopes = [scope];
+ var snippetMap = this.snippetMap;
+ if (snippetMap[scope] && snippetMap[scope].includeScopes) {
+ scopes.push.apply(scopes, snippetMap[scope].includeScopes);
+ }
+ scopes.push("_");
+ return scopes;
+ };
+
+ this.expandWithTab = function(editor, options) {
+ var self = this;
+ var result = editor.forEachSelection(function() {
+ return self.expandSnippetForSelection(editor, options);
+ }, null, {keepOrder: true});
+ if (result && editor.tabstopManager)
+ editor.tabstopManager.tabNext();
+ return result;
+ };
+
+ this.expandSnippetForSelection = function(editor, options) {
+ var cursor = editor.getCursorPosition();
+ var line = editor.session.getLine(cursor.row);
+ var before = line.substring(0, cursor.column);
+ var after = line.substr(cursor.column);
+
+ var snippetMap = this.snippetMap;
+ var snippet;
+ this.getActiveScopes(editor).some(function(scope) {
+ var snippets = snippetMap[scope];
+ if (snippets)
+ snippet = this.findMatchingSnippet(snippets, before, after);
+ return !!snippet;
+ }, this);
+ if (!snippet)
+ return false;
+ if (options && options.dryRun)
+ return true;
+ editor.session.doc.removeInLine(cursor.row,
+ cursor.column - snippet.replaceBefore.length,
+ cursor.column + snippet.replaceAfter.length
+ );
+
+ this.variables.M__ = snippet.matchBefore;
+ this.variables.T__ = snippet.matchAfter;
+ this.insertSnippetForSelection(editor, snippet.content);
+
+ this.variables.M__ = this.variables.T__ = null;
+ return true;
+ };
+
+ this.findMatchingSnippet = function(snippetList, before, after) {
+ for (var i = snippetList.length; i--;) {
+ var s = snippetList[i];
+ if (s.startRe && !s.startRe.test(before))
+ continue;
+ if (s.endRe && !s.endRe.test(after))
+ continue;
+ if (!s.startRe && !s.endRe)
+ continue;
+
+ s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
+ s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
+ s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
+ s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
+ return s;
+ }
+ };
+
+ this.snippetMap = {};
+ this.snippetNameMap = {};
+ this.register = function(snippets, scope) {
+ var snippetMap = this.snippetMap;
+ var snippetNameMap = this.snippetNameMap;
+ var self = this;
+
+ if (!snippets)
+ snippets = [];
+
+ function wrapRegexp(src) {
+ if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
+ src = "(?:" + src + ")";
+
+ return src || "";
+ }
+ function guardedRegexp(re, guard, opening) {
+ re = wrapRegexp(re);
+ guard = wrapRegexp(guard);
+ if (opening) {
+ re = guard + re;
+ if (re && re[re.length - 1] != "$")
+ re = re + "$";
+ } else {
+ re = re + guard;
+ if (re && re[0] != "^")
+ re = "^" + re;
+ }
+ return new RegExp(re);
+ }
+
+ function addSnippet(s) {
+ if (!s.scope)
+ s.scope = scope || "_";
+ scope = s.scope;
+ if (!snippetMap[scope]) {
+ snippetMap[scope] = [];
+ snippetNameMap[scope] = {};
+ }
+
+ var map = snippetNameMap[scope];
+ if (s.name) {
+ var old = map[s.name];
+ if (old)
+ self.unregister(old);
+ map[s.name] = s;
+ }
+ snippetMap[scope].push(s);
+
+ if (s.tabTrigger && !s.trigger) {
+ if (!s.guard && /^\w/.test(s.tabTrigger))
+ s.guard = "\\b";
+ s.trigger = lang.escapeRegExp(s.tabTrigger);
+ }
+
+ if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
+ return;
+
+ s.startRe = guardedRegexp(s.trigger, s.guard, true);
+ s.triggerRe = new RegExp(s.trigger, "", true);
+
+ s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
+ s.endTriggerRe = new RegExp(s.endTrigger, "", true);
+ }
+
+ if (snippets && snippets.content)
+ addSnippet(snippets);
+ else if (Array.isArray(snippets))
+ snippets.forEach(addSnippet);
+
+ this._signal("registerSnippets", {scope: scope});
+ };
+ this.unregister = function(snippets, scope) {
+ var snippetMap = this.snippetMap;
+ var snippetNameMap = this.snippetNameMap;
+
+ function removeSnippet(s) {
+ var nameMap = snippetNameMap[s.scope||scope];
+ if (nameMap && nameMap[s.name]) {
+ delete nameMap[s.name];
+ var map = snippetMap[s.scope||scope];
+ var i = map && map.indexOf(s);
+ if (i >= 0)
+ map.splice(i, 1);
+ }
+ }
+ if (snippets.content)
+ removeSnippet(snippets);
+ else if (Array.isArray(snippets))
+ snippets.forEach(removeSnippet);
+ };
+ this.parseSnippetFile = function(str) {
+ str = str.replace(/\r/g, "");
+ var list = [], snippet = {};
+ var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
+ var m;
+ while (m = re.exec(str)) {
+ if (m[1]) {
+ try {
+ snippet = JSON.parse(m[1]);
+ list.push(snippet);
+ } catch (e) {}
+ } if (m[4]) {
+ snippet.content = m[4].replace(/^\t/gm, "");
+ list.push(snippet);
+ snippet = {};
+ } else {
+ var key = m[2], val = m[3];
+ if (key == "regex") {
+ var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
+ snippet.guard = guardRe.exec(val)[1];
+ snippet.trigger = guardRe.exec(val)[1];
+ snippet.endTrigger = guardRe.exec(val)[1];
+ snippet.endGuard = guardRe.exec(val)[1];
+ } else if (key == "snippet") {
+ snippet.tabTrigger = val.match(/^\S*/)[0];
+ if (!snippet.name)
+ snippet.name = val;
+ } else {
+ snippet[key] = val;
+ }
+ }
+ }
+ return list;
+ };
+ this.getSnippetByName = function(name, editor) {
+ var snippetMap = this.snippetNameMap;
+ var snippet;
+ this.getActiveScopes(editor).some(function(scope) {
+ var snippets = snippetMap[scope];
+ if (snippets)
+ snippet = snippets[name];
+ return !!snippet;
+ }, this);
+ return snippet;
+ };
+
+}).call(SnippetManager.prototype);
+
+
+var TabstopManager = function(editor) {
+ if (editor.tabstopManager)
+ return editor.tabstopManager;
+ editor.tabstopManager = this;
+ this.$onChange = this.onChange.bind(this);
+ this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
+ this.$onChangeSession = this.onChangeSession.bind(this);
+ this.$onAfterExec = this.onAfterExec.bind(this);
+ this.attach(editor);
+};
+(function() {
+ this.attach = function(editor) {
+ this.index = 0;
+ this.ranges = [];
+ this.tabstops = [];
+ this.$openTabstops = null;
+ this.selectedTabstop = null;
+
+ this.editor = editor;
+ this.editor.on("change", this.$onChange);
+ this.editor.on("changeSelection", this.$onChangeSelection);
+ this.editor.on("changeSession", this.$onChangeSession);
+ this.editor.commands.on("afterExec", this.$onAfterExec);
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
+ };
+ this.detach = function() {
+ this.tabstops.forEach(this.removeTabstopMarkers, this);
+ this.ranges = null;
+ this.tabstops = null;
+ this.selectedTabstop = null;
+ this.editor.removeListener("change", this.$onChange);
+ this.editor.removeListener("changeSelection", this.$onChangeSelection);
+ this.editor.removeListener("changeSession", this.$onChangeSession);
+ this.editor.commands.removeListener("afterExec", this.$onAfterExec);
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
+ this.editor.tabstopManager = null;
+ this.editor = null;
+ };
+
+ this.onChange = function(delta) {
+ var changeRange = delta;
+ var isRemove = delta.action[0] == "r";
+ var start = delta.start;
+ var end = delta.end;
+ var startRow = start.row;
+ var endRow = end.row;
+ var lineDif = endRow - startRow;
+ var colDiff = end.column - start.column;
+
+ if (isRemove) {
+ lineDif = -lineDif;
+ colDiff = -colDiff;
+ }
+ if (!this.$inChange && isRemove) {
+ var ts = this.selectedTabstop;
+ var changedOutside = ts && !ts.some(function(r) {
+ return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0;
+ });
+ if (changedOutside)
+ return this.detach();
+ }
+ var ranges = this.ranges;
+ for (var i = 0; i < ranges.length; i++) {
+ var r = ranges[i];
+ if (r.end.row < start.row)
+ continue;
+
+ if (isRemove && comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
+ this.removeRange(r);
+ i--;
+ continue;
+ }
+
+ if (r.start.row == startRow && r.start.column > start.column)
+ r.start.column += colDiff;
+ if (r.end.row == startRow && r.end.column >= start.column)
+ r.end.column += colDiff;
+ if (r.start.row >= startRow)
+ r.start.row += lineDif;
+ if (r.end.row >= startRow)
+ r.end.row += lineDif;
+
+ if (comparePoints(r.start, r.end) > 0)
+ this.removeRange(r);
+ }
+ if (!ranges.length)
+ this.detach();
+ };
+ this.updateLinkedFields = function() {
+ var ts = this.selectedTabstop;
+ if (!ts || !ts.hasLinkedRanges)
+ return;
+ this.$inChange = true;
+ var session = this.editor.session;
+ var text = session.getTextRange(ts.firstNonLinked);
+ for (var i = ts.length; i--;) {
+ var range = ts[i];
+ if (!range.linked)
+ continue;
+ var fmt = exports.snippetManager.tmStrFormat(text, range.original);
+ session.replace(range, fmt);
+ }
+ this.$inChange = false;
+ };
+ this.onAfterExec = function(e) {
+ if (e.command && !e.command.readOnly)
+ this.updateLinkedFields();
+ };
+ this.onChangeSelection = function() {
+ if (!this.editor)
+ return;
+ var lead = this.editor.selection.lead;
+ var anchor = this.editor.selection.anchor;
+ var isEmpty = this.editor.selection.isEmpty();
+ for (var i = this.ranges.length; i--;) {
+ if (this.ranges[i].linked)
+ continue;
+ var containsLead = this.ranges[i].contains(lead.row, lead.column);
+ var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
+ if (containsLead && containsAnchor)
+ return;
+ }
+ this.detach();
+ };
+ this.onChangeSession = function() {
+ this.detach();
+ };
+ this.tabNext = function(dir) {
+ var max = this.tabstops.length;
+ var index = this.index + (dir || 1);
+ index = Math.min(Math.max(index, 1), max);
+ if (index == max)
+ index = 0;
+ this.selectTabstop(index);
+ if (index === 0)
+ this.detach();
+ };
+ this.selectTabstop = function(index) {
+ this.$openTabstops = null;
+ var ts = this.tabstops[this.index];
+ if (ts)
+ this.addTabstopMarkers(ts);
+ this.index = index;
+ ts = this.tabstops[this.index];
+ if (!ts || !ts.length)
+ return;
+
+ this.selectedTabstop = ts;
+ if (!this.editor.inVirtualSelectionMode) {
+ var sel = this.editor.multiSelect;
+ sel.toSingleRange(ts.firstNonLinked.clone());
+ for (var i = ts.length; i--;) {
+ if (ts.hasLinkedRanges && ts[i].linked)
+ continue;
+ sel.addRange(ts[i].clone(), true);
+ }
+ if (sel.ranges[0])
+ sel.addRange(sel.ranges[0].clone());
+ } else {
+ this.editor.selection.setRange(ts.firstNonLinked);
+ }
+
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
+ };
+ this.addTabstops = function(tabstops, start, end) {
+ if (!this.$openTabstops)
+ this.$openTabstops = [];
+ if (!tabstops[0]) {
+ var p = Range.fromPoints(end, end);
+ moveRelative(p.start, start);
+ moveRelative(p.end, start);
+ tabstops[0] = [p];
+ tabstops[0].index = 0;
+ }
+
+ var i = this.index;
+ var arg = [i + 1, 0];
+ var ranges = this.ranges;
+ tabstops.forEach(function(ts, index) {
+ var dest = this.$openTabstops[index] || ts;
+
+ for (var i = ts.length; i--;) {
+ var p = ts[i];
+ var range = Range.fromPoints(p.start, p.end || p.start);
+ movePoint(range.start, start);
+ movePoint(range.end, start);
+ range.original = p;
+ range.tabstop = dest;
+ ranges.push(range);
+ if (dest != ts)
+ dest.unshift(range);
+ else
+ dest[i] = range;
+ if (p.fmtString) {
+ range.linked = true;
+ dest.hasLinkedRanges = true;
+ } else if (!dest.firstNonLinked)
+ dest.firstNonLinked = range;
+ }
+ if (!dest.firstNonLinked)
+ dest.hasLinkedRanges = false;
+ if (dest === ts) {
+ arg.push(dest);
+ this.$openTabstops[index] = dest;
+ }
+ this.addTabstopMarkers(dest);
+ }, this);
+
+ if (arg.length > 2) {
+ if (this.tabstops.length)
+ arg.push(arg.splice(2, 1)[0]);
+ this.tabstops.splice.apply(this.tabstops, arg);
+ }
+ };
+
+ this.addTabstopMarkers = function(ts) {
+ var session = this.editor.session;
+ ts.forEach(function(range) {
+ if (!range.markerId)
+ range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
+ });
+ };
+ this.removeTabstopMarkers = function(ts) {
+ var session = this.editor.session;
+ ts.forEach(function(range) {
+ session.removeMarker(range.markerId);
+ range.markerId = null;
+ });
+ };
+ this.removeRange = function(range) {
+ var i = range.tabstop.indexOf(range);
+ range.tabstop.splice(i, 1);
+ i = this.ranges.indexOf(range);
+ this.ranges.splice(i, 1);
+ this.editor.session.removeMarker(range.markerId);
+ if (!range.tabstop.length) {
+ i = this.tabstops.indexOf(range.tabstop);
+ if (i != -1)
+ this.tabstops.splice(i, 1);
+ if (!this.tabstops.length)
+ this.detach();
+ }
+ };
+
+ this.keyboardHandler = new HashHandler();
+ this.keyboardHandler.bindKeys({
+ "Tab": function(ed) {
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
+ return;
+ }
+
+ ed.tabstopManager.tabNext(1);
+ },
+ "Shift-Tab": function(ed) {
+ ed.tabstopManager.tabNext(-1);
+ },
+ "Esc": function(ed) {
+ ed.tabstopManager.detach();
+ },
+ "Return": function(ed) {
+ return false;
+ }
+ });
+}).call(TabstopManager.prototype);
+
+
+
+var changeTracker = {};
+changeTracker.onChange = Anchor.prototype.onChange;
+changeTracker.setPosition = function(row, column) {
+ this.pos.row = row;
+ this.pos.column = column;
+};
+changeTracker.update = function(pos, delta, $insertRight) {
+ this.$insertRight = $insertRight;
+ this.pos = pos;
+ this.onChange(delta);
+};
+
+var movePoint = function(point, diff) {
+ if (point.row == 0)
+ point.column += diff.column;
+ point.row += diff.row;
+};
+
+var moveRelative = function(point, start) {
+ if (point.row == start.row)
+ point.column -= start.column;
+ point.row -= start.row;
+};
+
+
+acequire("./lib/dom").importCssString("\
+.ace_snippet-marker {\
+ -moz-box-sizing: border-box;\
+ box-sizing: border-box;\
+ background: rgba(194, 193, 208, 0.09);\
+ border: 1px dotted rgba(211, 208, 235, 0.62);\
+ position: absolute;\
+}");
+
+exports.snippetManager = new SnippetManager();
+
+
+var Editor = acequire("./editor").Editor;
+(function() {
+ this.insertSnippet = function(content, options) {
+ return exports.snippetManager.insertSnippet(this, content, options);
+ };
+ this.expandSnippet = function(options) {
+ return exports.snippetManager.expandWithTab(this, options);
+ };
+}).call(Editor.prototype);
+
+});
+
+ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"], function(acequire, exports, module) {
+"use strict";
+
+var Renderer = acequire("../virtual_renderer").VirtualRenderer;
+var Editor = acequire("../editor").Editor;
+var Range = acequire("../range").Range;
+var event = acequire("../lib/event");
+var lang = acequire("../lib/lang");
+var dom = acequire("../lib/dom");
+
+var $singleLineEditor = function(el) {
+ var renderer = new Renderer(el);
+
+ renderer.$maxLines = 4;
+
+ var editor = new Editor(renderer);
+
+ editor.setHighlightActiveLine(false);
+ editor.setShowPrintMargin(false);
+ editor.renderer.setShowGutter(false);
+ editor.renderer.setHighlightGutterLine(false);
+
+ editor.$mouseHandler.$focusWaitTimout = 0;
+ editor.$highlightTagPending = true;
+
+ return editor;
+};
+
+var AcePopup = function(parentNode) {
+ var el = dom.createElement("div");
+ var popup = new $singleLineEditor(el);
+
+ if (parentNode)
+ parentNode.appendChild(el);
+ el.style.display = "none";
+ popup.renderer.content.style.cursor = "default";
+ popup.renderer.setStyle("ace_autocomplete");
+
+ popup.setOption("displayIndentGuides", false);
+ popup.setOption("dragDelay", 150);
+
+ var noop = function(){};
+
+ popup.focus = noop;
+ popup.$isFocused = true;
+
+ popup.renderer.$cursorLayer.restartTimer = noop;
+ popup.renderer.$cursorLayer.element.style.opacity = 0;
+
+ popup.renderer.$maxLines = 8;
+ popup.renderer.$keepTextAreaAtCursor = false;
+
+ popup.setHighlightActiveLine(false);
+ popup.session.highlight("");
+ popup.session.$searchHighlight.clazz = "ace_highlight-marker";
+
+ popup.on("mousedown", function(e) {
+ var pos = e.getDocumentPosition();
+ popup.selection.moveToPosition(pos);
+ selectionMarker.start.row = selectionMarker.end.row = pos.row;
+ e.stop();
+ });
+
+ var lastMouseEvent;
+ var hoverMarker = new Range(-1,0,-1,Infinity);
+ var selectionMarker = new Range(-1,0,-1,Infinity);
+ selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
+ popup.setSelectOnHover = function(val) {
+ if (!val) {
+ hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
+ } else if (hoverMarker.id) {
+ popup.session.removeMarker(hoverMarker.id);
+ hoverMarker.id = null;
+ }
+ };
+ popup.setSelectOnHover(false);
+ popup.on("mousemove", function(e) {
+ if (!lastMouseEvent) {
+ lastMouseEvent = e;
+ return;
+ }
+ if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
+ return;
+ }
+ lastMouseEvent = e;
+ lastMouseEvent.scrollTop = popup.renderer.scrollTop;
+ var row = lastMouseEvent.getDocumentPosition().row;
+ if (hoverMarker.start.row != row) {
+ if (!hoverMarker.id)
+ popup.setRow(row);
+ setHoverMarker(row);
+ }
+ });
+ popup.renderer.on("beforeRender", function() {
+ if (lastMouseEvent && hoverMarker.start.row != -1) {
+ lastMouseEvent.$pos = null;
+ var row = lastMouseEvent.getDocumentPosition().row;
+ if (!hoverMarker.id)
+ popup.setRow(row);
+ setHoverMarker(row, true);
+ }
+ });
+ popup.renderer.on("afterRender", function() {
+ var row = popup.getRow();
+ var t = popup.renderer.$textLayer;
+ var selected = t.element.childNodes[row - t.config.firstRow];
+ if (selected == t.selectedNode)
+ return;
+ if (t.selectedNode)
+ dom.removeCssClass(t.selectedNode, "ace_selected");
+ t.selectedNode = selected;
+ if (selected)
+ dom.addCssClass(selected, "ace_selected");
+ });
+ var hideHoverMarker = function() { setHoverMarker(-1) };
+ var setHoverMarker = function(row, suppressRedraw) {
+ if (row !== hoverMarker.start.row) {
+ hoverMarker.start.row = hoverMarker.end.row = row;
+ if (!suppressRedraw)
+ popup.session._emit("changeBackMarker");
+ popup._emit("changeHoverMarker");
+ }
+ };
+ popup.getHoveredRow = function() {
+ return hoverMarker.start.row;
+ };
+
+ event.addListener(popup.container, "mouseout", hideHoverMarker);
+ popup.on("hide", hideHoverMarker);
+ popup.on("changeSelection", hideHoverMarker);
+
+ popup.session.doc.getLength = function() {
+ return popup.data.length;
+ };
+ popup.session.doc.getLine = function(i) {
+ var data = popup.data[i];
+ if (typeof data == "string")
+ return data;
+ return (data && data.value) || "";
+ };
+
+ var bgTokenizer = popup.session.bgTokenizer;
+ bgTokenizer.$tokenizeRow = function(row) {
+ var data = popup.data[row];
+ var tokens = [];
+ if (!data)
+ return tokens;
+ if (typeof data == "string")
+ data = {value: data};
+ if (!data.caption)
+ data.caption = data.value || data.name;
+
+ var last = -1;
+ var flag, c;
+ for (var i = 0; i < data.caption.length; i++) {
+ c = data.caption[i];
+ flag = data.matchMask & (1 << i) ? 1 : 0;
+ if (last !== flag) {
+ tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c});
+ last = flag;
+ } else {
+ tokens[tokens.length - 1].value += c;
+ }
+ }
+
+ if (data.meta) {
+ var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth;
+ var metaData = data.meta;
+ if (metaData.length + data.caption.length > maxW - 2) {
+ metaData = metaData.substr(0, maxW - data.caption.length - 3) + "\u2026"
+ }
+ tokens.push({type: "rightAlignedText", value: metaData});
+ }
+ return tokens;
+ };
+ bgTokenizer.$updateOnChange = noop;
+ bgTokenizer.start = noop;
+
+ popup.session.$computeWidth = function() {
+ return this.screenWidth = 0;
+ };
+
+ popup.$blockScrolling = Infinity;
+ popup.isOpen = false;
+ popup.isTopdown = false;
+
+ popup.data = [];
+ popup.setData = function(list) {
+ popup.setValue(lang.stringRepeat("\n", list.length), -1);
+ popup.data = list || [];
+ popup.setRow(0);
+ };
+ popup.getData = function(row) {
+ return popup.data[row];
+ };
+
+ popup.getRow = function() {
+ return selectionMarker.start.row;
+ };
+ popup.setRow = function(line) {
+ line = Math.max(0, Math.min(this.data.length, line));
+ if (selectionMarker.start.row != line) {
+ popup.selection.clearSelection();
+ selectionMarker.start.row = selectionMarker.end.row = line || 0;
+ popup.session._emit("changeBackMarker");
+ popup.moveCursorTo(line || 0, 0);
+ if (popup.isOpen)
+ popup._signal("select");
+ }
+ };
+
+ popup.on("changeSelection", function() {
+ if (popup.isOpen)
+ popup.setRow(popup.selection.lead.row);
+ popup.renderer.scrollCursorIntoView();
+ });
+
+ popup.hide = function() {
+ this.container.style.display = "none";
+ this._signal("hide");
+ popup.isOpen = false;
+ };
+ popup.show = function(pos, lineHeight, topdownOnly) {
+ var el = this.container;
+ var screenHeight = window.innerHeight;
+ var screenWidth = window.innerWidth;
+ var renderer = this.renderer;
+ var maxH = renderer.$maxLines * lineHeight * 1.4;
+ var top = pos.top + this.$borderSize;
+ if (top + maxH > screenHeight - lineHeight && !topdownOnly) {
+ el.style.top = "";
+ el.style.bottom = screenHeight - top + "px";
+ popup.isTopdown = false;
+ } else {
+ top += lineHeight;
+ el.style.top = top + "px";
+ el.style.bottom = "";
+ popup.isTopdown = true;
+ }
+
+ el.style.display = "";
+ this.renderer.$textLayer.checkForSizeChanges();
+
+ var left = pos.left;
+ if (left + el.offsetWidth > screenWidth)
+ left = screenWidth - el.offsetWidth;
+
+ el.style.left = left + "px";
+
+ this._signal("show");
+ lastMouseEvent = null;
+ popup.isOpen = true;
+ };
+
+ popup.getTextLeftOffset = function() {
+ return this.$borderSize + this.renderer.$padding + this.$imageSize;
+ };
+
+ popup.$imageSize = 0;
+ popup.$borderSize = 1;
+
+ return popup;
+};
+
+dom.importCssString("\
+.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
+ background-color: #CAD6FA;\
+ z-index: 1;\
+}\
+.ace_editor.ace_autocomplete .ace_line-hover {\
+ border: 1px solid #abbffe;\
+ margin-top: -1px;\
+ background: rgba(233,233,253,0.4);\
+}\
+.ace_editor.ace_autocomplete .ace_line-hover {\
+ position: absolute;\
+ z-index: 2;\
+}\
+.ace_editor.ace_autocomplete .ace_scroller {\
+ background: none;\
+ border: none;\
+ box-shadow: none;\
+}\
+.ace_rightAlignedText {\
+ color: gray;\
+ display: inline-block;\
+ position: absolute;\
+ right: 4px;\
+ text-align: right;\
+ z-index: -1;\
+}\
+.ace_editor.ace_autocomplete .ace_completion-highlight{\
+ color: #000;\
+ text-shadow: 0 0 0.01em;\
+}\
+.ace_editor.ace_autocomplete {\
+ width: 280px;\
+ z-index: 200000;\
+ background: #fbfbfb;\
+ color: #444;\
+ border: 1px lightgray solid;\
+ position: fixed;\
+ box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
+ line-height: 1.4;\
+}");
+
+exports.AcePopup = AcePopup;
+
+});
+
+ace.define("ace/autocomplete/util",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+exports.parForEach = function(array, fn, callback) {
+ var completed = 0;
+ var arLength = array.length;
+ if (arLength === 0)
+ callback();
+ for (var i = 0; i < arLength; i++) {
+ fn(array[i], function(result, err) {
+ completed++;
+ if (completed === arLength)
+ callback(result, err);
+ });
+ }
+};
+
+var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
+
+exports.retrievePrecedingIdentifier = function(text, pos, regex) {
+ regex = regex || ID_REGEX;
+ var buf = [];
+ for (var i = pos-1; i >= 0; i--) {
+ if (regex.test(text[i]))
+ buf.push(text[i]);
+ else
+ break;
+ }
+ return buf.reverse().join("");
+};
+
+exports.retrieveFollowingIdentifier = function(text, pos, regex) {
+ regex = regex || ID_REGEX;
+ var buf = [];
+ for (var i = pos; i < text.length; i++) {
+ if (regex.test(text[i]))
+ buf.push(text[i]);
+ else
+ break;
+ }
+ return buf;
+};
+
+exports.getCompletionPrefix = function (editor) {
+ var pos = editor.getCursorPosition();
+ var line = editor.session.getLine(pos.row);
+ var prefix;
+ editor.completers.forEach(function(completer) {
+ if (completer.identifierRegexps) {
+ completer.identifierRegexps.forEach(function(identifierRegex) {
+ if (!prefix && identifierRegex)
+ prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
+ }.bind(this));
+ }
+ }.bind(this));
+ return prefix || this.retrievePrecedingIdentifier(line, pos.column);
+};
+
+});
+
+ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/snippets"], function(acequire, exports, module) {
+"use strict";
+
+var HashHandler = acequire("./keyboard/hash_handler").HashHandler;
+var AcePopup = acequire("./autocomplete/popup").AcePopup;
+var util = acequire("./autocomplete/util");
+var event = acequire("./lib/event");
+var lang = acequire("./lib/lang");
+var dom = acequire("./lib/dom");
+var snippetManager = acequire("./snippets").snippetManager;
+
+var Autocomplete = function() {
+ this.autoInsert = false;
+ this.autoSelect = true;
+ this.exactMatch = false;
+ this.gatherCompletionsId = 0;
+ this.keyboardHandler = new HashHandler();
+ this.keyboardHandler.bindKeys(this.commands);
+
+ this.blurListener = this.blurListener.bind(this);
+ this.changeListener = this.changeListener.bind(this);
+ this.mousedownListener = this.mousedownListener.bind(this);
+ this.mousewheelListener = this.mousewheelListener.bind(this);
+
+ this.changeTimer = lang.delayedCall(function() {
+ this.updateCompletions(true);
+ }.bind(this));
+
+ this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
+};
+
+(function() {
+
+ this.$init = function() {
+ this.popup = new AcePopup(document.body || document.documentElement);
+ this.popup.on("click", function(e) {
+ this.insertMatch();
+ e.stop();
+ }.bind(this));
+ this.popup.focus = this.editor.focus.bind(this.editor);
+ this.popup.on("show", this.tooltipTimer.bind(null, null));
+ this.popup.on("select", this.tooltipTimer.bind(null, null));
+ this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
+ return this.popup;
+ };
+
+ this.getPopup = function() {
+ return this.popup || this.$init();
+ };
+
+ this.openPopup = function(editor, prefix, keepPopupPosition) {
+ if (!this.popup)
+ this.$init();
+
+ this.popup.setData(this.completions.filtered);
+
+ editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
+
+ var renderer = editor.renderer;
+ this.popup.setRow(this.autoSelect ? 0 : -1);
+ if (!keepPopupPosition) {
+ this.popup.setTheme(editor.getTheme());
+ this.popup.setFontSize(editor.getFontSize());
+
+ var lineHeight = renderer.layerConfig.lineHeight;
+
+ var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
+ pos.left -= this.popup.getTextLeftOffset();
+
+ var rect = editor.container.getBoundingClientRect();
+ pos.top += rect.top - renderer.layerConfig.offset;
+ pos.left += rect.left - editor.renderer.scrollLeft;
+ pos.left += renderer.gutterWidth;
+
+ this.popup.show(pos, lineHeight);
+ } else if (keepPopupPosition && !prefix) {
+ this.detach();
+ }
+ };
+
+ this.detach = function() {
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
+ this.editor.off("changeSelection", this.changeListener);
+ this.editor.off("blur", this.blurListener);
+ this.editor.off("mousedown", this.mousedownListener);
+ this.editor.off("mousewheel", this.mousewheelListener);
+ this.changeTimer.cancel();
+ this.hideDocTooltip();
+
+ this.gatherCompletionsId += 1;
+ if (this.popup && this.popup.isOpen)
+ this.popup.hide();
+
+ if (this.base)
+ this.base.detach();
+ this.activated = false;
+ this.completions = this.base = null;
+ };
+
+ this.changeListener = function(e) {
+ var cursor = this.editor.selection.lead;
+ if (cursor.row != this.base.row || cursor.column < this.base.column) {
+ this.detach();
+ }
+ if (this.activated)
+ this.changeTimer.schedule();
+ else
+ this.detach();
+ };
+
+ this.blurListener = function(e) {
+ var el = document.activeElement;
+ var text = this.editor.textInput.getElement();
+ var fromTooltip = e.relatedTarget && e.relatedTarget == this.tooltipNode;
+ var container = this.popup && this.popup.container;
+ if (el != text && el.parentNode != container && !fromTooltip
+ && el != this.tooltipNode && e.relatedTarget != text
+ ) {
+ this.detach();
+ }
+ };
+
+ this.mousedownListener = function(e) {
+ this.detach();
+ };
+
+ this.mousewheelListener = function(e) {
+ this.detach();
+ };
+
+ this.goTo = function(where) {
+ var row = this.popup.getRow();
+ var max = this.popup.session.getLength() - 1;
+
+ switch(where) {
+ case "up": row = row <= 0 ? max : row - 1; break;
+ case "down": row = row >= max ? -1 : row + 1; break;
+ case "start": row = 0; break;
+ case "end": row = max; break;
+ }
+
+ this.popup.setRow(row);
+ };
+
+ this.insertMatch = function(data, options) {
+ if (!data)
+ data = this.popup.getData(this.popup.getRow());
+ if (!data)
+ return false;
+
+ if (data.completer && data.completer.insertMatch) {
+ data.completer.insertMatch(this.editor, data);
+ } else {
+ if (this.completions.filterText) {
+ var ranges = this.editor.selection.getAllRanges();
+ for (var i = 0, range; range = ranges[i]; i++) {
+ range.start.column -= this.completions.filterText.length;
+ this.editor.session.remove(range);
+ }
+ }
+ if (data.snippet)
+ snippetManager.insertSnippet(this.editor, data.snippet);
+ else
+ this.editor.execCommand("insertstring", data.value || data);
+ }
+ this.detach();
+ };
+
+
+ this.commands = {
+ "Up": function(editor) { editor.completer.goTo("up"); },
+ "Down": function(editor) { editor.completer.goTo("down"); },
+ "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
+ "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
+
+ "Esc": function(editor) { editor.completer.detach(); },
+ "Return": function(editor) { return editor.completer.insertMatch(); },
+ "Shift-Return": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); },
+ "Tab": function(editor) {
+ var result = editor.completer.insertMatch();
+ if (!result && !editor.tabstopManager)
+ editor.completer.goTo("down");
+ else
+ return result;
+ },
+
+ "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
+ "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
+ };
+
+ this.gatherCompletions = function(editor, callback) {
+ var session = editor.getSession();
+ var pos = editor.getCursorPosition();
+
+ var line = session.getLine(pos.row);
+ var prefix = util.getCompletionPrefix(editor);
+
+ this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
+ this.base.$insertRight = true;
+
+ var matches = [];
+ var total = editor.completers.length;
+ editor.completers.forEach(function(completer, i) {
+ completer.getCompletions(editor, session, pos, prefix, function(err, results) {
+ if (!err && results)
+ matches = matches.concat(results);
+ var pos = editor.getCursorPosition();
+ var line = session.getLine(pos.row);
+ callback(null, {
+ prefix: prefix,
+ matches: matches,
+ finished: (--total === 0)
+ });
+ });
+ });
+ return true;
+ };
+
+ this.showPopup = function(editor) {
+ if (this.editor)
+ this.detach();
+
+ this.activated = true;
+
+ this.editor = editor;
+ if (editor.completer != this) {
+ if (editor.completer)
+ editor.completer.detach();
+ editor.completer = this;
+ }
+
+ editor.on("changeSelection", this.changeListener);
+ editor.on("blur", this.blurListener);
+ editor.on("mousedown", this.mousedownListener);
+ editor.on("mousewheel", this.mousewheelListener);
+
+ this.updateCompletions();
+ };
+
+ this.updateCompletions = function(keepPopupPosition) {
+ if (keepPopupPosition && this.base && this.completions) {
+ var pos = this.editor.getCursorPosition();
+ var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
+ if (prefix == this.completions.filterText)
+ return;
+ this.completions.setFilter(prefix);
+ if (!this.completions.filtered.length)
+ return this.detach();
+ if (this.completions.filtered.length == 1
+ && this.completions.filtered[0].value == prefix
+ && !this.completions.filtered[0].snippet)
+ return this.detach();
+ this.openPopup(this.editor, prefix, keepPopupPosition);
+ return;
+ }
+ var _id = this.gatherCompletionsId;
+ this.gatherCompletions(this.editor, function(err, results) {
+ var detachIfFinished = function() {
+ if (!results.finished) return;
+ return this.detach();
+ }.bind(this);
+
+ var prefix = results.prefix;
+ var matches = results && results.matches;
+
+ if (!matches || !matches.length)
+ return detachIfFinished();
+ if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
+ return;
+
+ this.completions = new FilteredList(matches);
+
+ if (this.exactMatch)
+ this.completions.exactMatch = true;
+
+ this.completions.setFilter(prefix);
+ var filtered = this.completions.filtered;
+ if (!filtered.length)
+ return detachIfFinished();
+ if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
+ return detachIfFinished();
+ if (this.autoInsert && filtered.length == 1 && results.finished)
+ return this.insertMatch(filtered[0]);
+
+ this.openPopup(this.editor, prefix, keepPopupPosition);
+ }.bind(this));
+ };
+
+ this.cancelContextMenu = function() {
+ this.editor.$mouseHandler.cancelContextMenu();
+ };
+
+ this.updateDocTooltip = function() {
+ var popup = this.popup;
+ var all = popup.data;
+ var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
+ var doc = null;
+ if (!selected || !this.editor || !this.popup.isOpen)
+ return this.hideDocTooltip();
+ this.editor.completers.some(function(completer) {
+ if (completer.getDocTooltip)
+ doc = completer.getDocTooltip(selected);
+ return doc;
+ });
+ if (!doc)
+ doc = selected;
+
+ if (typeof doc == "string")
+ doc = {docText: doc};
+ if (!doc || !(doc.docHTML || doc.docText))
+ return this.hideDocTooltip();
+ this.showDocTooltip(doc);
+ };
+
+ this.showDocTooltip = function(item) {
+ if (!this.tooltipNode) {
+ this.tooltipNode = dom.createElement("div");
+ this.tooltipNode.className = "ace_tooltip ace_doc-tooltip";
+ this.tooltipNode.style.margin = 0;
+ this.tooltipNode.style.pointerEvents = "auto";
+ this.tooltipNode.tabIndex = -1;
+ this.tooltipNode.onblur = this.blurListener.bind(this);
+ }
+
+ var tooltipNode = this.tooltipNode;
+ if (item.docHTML) {
+ tooltipNode.innerHTML = item.docHTML;
+ } else if (item.docText) {
+ tooltipNode.textContent = item.docText;
+ }
+
+ if (!tooltipNode.parentNode)
+ document.body.appendChild(tooltipNode);
+ var popup = this.popup;
+ var rect = popup.container.getBoundingClientRect();
+ tooltipNode.style.top = popup.container.style.top;
+ tooltipNode.style.bottom = popup.container.style.bottom;
+
+ if (window.innerWidth - rect.right < 320) {
+ tooltipNode.style.right = window.innerWidth - rect.left + "px";
+ tooltipNode.style.left = "";
+ } else {
+ tooltipNode.style.left = (rect.right + 1) + "px";
+ tooltipNode.style.right = "";
+ }
+ tooltipNode.style.display = "block";
+ };
+
+ this.hideDocTooltip = function() {
+ this.tooltipTimer.cancel();
+ if (!this.tooltipNode) return;
+ var el = this.tooltipNode;
+ if (!this.editor.isFocused() && document.activeElement == el)
+ this.editor.focus();
+ this.tooltipNode = null;
+ if (el.parentNode)
+ el.parentNode.removeChild(el);
+ };
+
+}).call(Autocomplete.prototype);
+
+Autocomplete.startCommand = {
+ name: "startAutocomplete",
+ exec: function(editor) {
+ if (!editor.completer)
+ editor.completer = new Autocomplete();
+ editor.completer.autoInsert = false;
+ editor.completer.autoSelect = true;
+ editor.completer.showPopup(editor);
+ editor.completer.cancelContextMenu();
+ },
+ bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
+};
+
+var FilteredList = function(array, filterText) {
+ this.all = array;
+ this.filtered = array;
+ this.filterText = filterText || "";
+ this.exactMatch = false;
+};
+(function(){
+ this.setFilter = function(str) {
+ if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
+ var matches = this.filtered;
+ else
+ var matches = this.all;
+
+ this.filterText = str;
+ matches = this.filterCompletions(matches, this.filterText);
+ matches = matches.sort(function(a, b) {
+ return b.exactMatch - a.exactMatch || b.score - a.score;
+ });
+ var prev = null;
+ matches = matches.filter(function(item){
+ var caption = item.snippet || item.caption || item.value;
+ if (caption === prev) return false;
+ prev = caption;
+ return true;
+ });
+
+ this.filtered = matches;
+ };
+ this.filterCompletions = function(items, needle) {
+ var results = [];
+ var upper = needle.toUpperCase();
+ var lower = needle.toLowerCase();
+ loop: for (var i = 0, item; item = items[i]; i++) {
+ var caption = item.value || item.caption || item.snippet;
+ if (!caption) continue;
+ var lastIndex = -1;
+ var matchMask = 0;
+ var penalty = 0;
+ var index, distance;
+
+ if (this.exactMatch) {
+ if (needle !== caption.substr(0, needle.length))
+ continue loop;
+ }else{
+ for (var j = 0; j < needle.length; j++) {
+ var i1 = caption.indexOf(lower[j], lastIndex + 1);
+ var i2 = caption.indexOf(upper[j], lastIndex + 1);
+ index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
+ if (index < 0)
+ continue loop;
+ distance = index - lastIndex - 1;
+ if (distance > 0) {
+ if (lastIndex === -1)
+ penalty += 10;
+ penalty += distance;
+ }
+ matchMask = matchMask | (1 << index);
+ lastIndex = index;
+ }
+ }
+ item.matchMask = matchMask;
+ item.exactMatch = penalty ? 0 : 1;
+ item.score = (item.score || 0) - penalty;
+ results.push(item);
+ }
+ return results;
+ };
+}).call(FilteredList.prototype);
+
+exports.Autocomplete = Autocomplete;
+exports.FilteredList = FilteredList;
+
+});
+
+ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"], function(acequire, exports, module) {
+ var Range = acequire("../range").Range;
+
+ var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
+
+ function getWordIndex(doc, pos) {
+ var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));
+ return textBefore.split(splitRegex).length - 1;
+ }
+ function wordDistance(doc, pos) {
+ var prefixPos = getWordIndex(doc, pos);
+ var words = doc.getValue().split(splitRegex);
+ var wordScores = Object.create(null);
+
+ var currentWord = words[prefixPos];
+
+ words.forEach(function(word, idx) {
+ if (!word || word === currentWord) return;
+
+ var distance = Math.abs(prefixPos - idx);
+ var score = words.length - distance;
+ if (wordScores[word]) {
+ wordScores[word] = Math.max(score, wordScores[word]);
+ } else {
+ wordScores[word] = score;
+ }
+ });
+ return wordScores;
+ }
+
+ exports.getCompletions = function(editor, session, pos, prefix, callback) {
+ var wordScore = wordDistance(session, pos, prefix);
+ var wordList = Object.keys(wordScore);
+ callback(null, wordList.map(function(word) {
+ return {
+ caption: word,
+ value: word,
+ score: wordScore[word],
+ meta: "local"
+ };
+ }));
+ };
+});
+
+ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"], function(acequire, exports, module) {
+"use strict";
+
+var snippetManager = acequire("../snippets").snippetManager;
+var Autocomplete = acequire("../autocomplete").Autocomplete;
+var config = acequire("../config");
+var lang = acequire("../lib/lang");
+var util = acequire("../autocomplete/util");
+
+var textCompleter = acequire("../autocomplete/text_completer");
+var keyWordCompleter = {
+ getCompletions: function(editor, session, pos, prefix, callback) {
+ if (session.$mode.completer) {
+ return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback);
+ }
+ var state = editor.session.getState(pos.row);
+ var completions = session.$mode.getCompletions(state, session, pos, prefix);
+ callback(null, completions);
+ }
+};
+
+var snippetCompleter = {
+ getCompletions: function(editor, session, pos, prefix, callback) {
+ var snippetMap = snippetManager.snippetMap;
+ var completions = [];
+ snippetManager.getActiveScopes(editor).forEach(function(scope) {
+ var snippets = snippetMap[scope] || [];
+ for (var i = snippets.length; i--;) {
+ var s = snippets[i];
+ var caption = s.name || s.tabTrigger;
+ if (!caption)
+ continue;
+ completions.push({
+ caption: caption,
+ snippet: s.content,
+ meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet",
+ type: "snippet"
+ });
+ }
+ }, this);
+ callback(null, completions);
+ },
+ getDocTooltip: function(item) {
+ if (item.type == "snippet" && !item.docHTML) {
+ item.docHTML = [
+ "", lang.escapeHTML(item.caption), " ", " ",
+ lang.escapeHTML(item.snippet)
+ ].join("");
+ }
+ }
+};
+
+var completers = [snippetCompleter, textCompleter, keyWordCompleter];
+exports.setCompleters = function(val) {
+ completers.length = 0;
+ if (val) completers.push.apply(completers, val);
+};
+exports.addCompleter = function(completer) {
+ completers.push(completer);
+};
+exports.textCompleter = textCompleter;
+exports.keyWordCompleter = keyWordCompleter;
+exports.snippetCompleter = snippetCompleter;
+
+var expandSnippet = {
+ name: "expandSnippet",
+ exec: function(editor) {
+ return snippetManager.expandWithTab(editor);
+ },
+ bindKey: "Tab"
+};
+
+var onChangeMode = function(e, editor) {
+ loadSnippetsForMode(editor.session.$mode);
+};
+
+var loadSnippetsForMode = function(mode) {
+ var id = mode.$id;
+ if (!snippetManager.files)
+ snippetManager.files = {};
+ loadSnippetFile(id);
+ if (mode.modes)
+ mode.modes.forEach(loadSnippetsForMode);
+};
+
+var loadSnippetFile = function(id) {
+ if (!id || snippetManager.files[id])
+ return;
+ var snippetFilePath = id.replace("mode", "snippets");
+ snippetManager.files[id] = {};
+ config.loadModule(snippetFilePath, function(m) {
+ if (m) {
+ snippetManager.files[id] = m;
+ if (!m.snippets && m.snippetText)
+ m.snippets = snippetManager.parseSnippetFile(m.snippetText);
+ snippetManager.register(m.snippets || [], m.scope);
+ if (m.includeScopes) {
+ snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
+ m.includeScopes.forEach(function(x) {
+ loadSnippetFile("ace/mode/" + x);
+ });
+ }
+ }
+ });
+};
+
+var doLiveAutocomplete = function(e) {
+ var editor = e.editor;
+ var hasCompleter = editor.completer && editor.completer.activated;
+ if (e.command.name === "backspace") {
+ if (hasCompleter && !util.getCompletionPrefix(editor))
+ editor.completer.detach();
+ }
+ else if (e.command.name === "insertstring") {
+ var prefix = util.getCompletionPrefix(editor);
+ if (prefix && !hasCompleter) {
+ if (!editor.completer) {
+ editor.completer = new Autocomplete();
+ }
+ editor.completer.autoInsert = false;
+ editor.completer.showPopup(editor);
+ }
+ }
+};
+
+var Editor = acequire("../editor").Editor;
+acequire("../config").defineOptions(Editor.prototype, "editor", {
+ enableBasicAutocompletion: {
+ set: function(val) {
+ if (val) {
+ if (!this.completers)
+ this.completers = Array.isArray(val)? val: completers;
+ this.commands.addCommand(Autocomplete.startCommand);
+ } else {
+ this.commands.removeCommand(Autocomplete.startCommand);
+ }
+ },
+ value: false
+ },
+ enableLiveAutocompletion: {
+ set: function(val) {
+ if (val) {
+ if (!this.completers)
+ this.completers = Array.isArray(val)? val: completers;
+ this.commands.on('afterExec', doLiveAutocomplete);
+ } else {
+ this.commands.removeListener('afterExec', doLiveAutocomplete);
+ }
+ },
+ value: false
+ },
+ enableSnippets: {
+ set: function(val) {
+ if (val) {
+ this.commands.addCommand(expandSnippet);
+ this.on("changeMode", onChangeMode);
+ onChangeMode(null, this);
+ } else {
+ this.commands.removeCommand(expandSnippet);
+ this.off("changeMode", onChangeMode);
+ }
+ },
+ value: false
+ }
+});
+});
+ (function() {
+ ace.acequire(["ace/ext/language_tools"], function() {});
+ })();
+
+},{}],68:[function(require,module,exports){
+ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(acequire, exports, module) {
+"use strict";
+
+var dom = acequire("../lib/dom");
+var lang = acequire("../lib/lang");
+var event = acequire("../lib/event");
+var searchboxCss = "\
+.ace_search {\
+background-color: #ddd;\
+border: 1px solid #cbcbcb;\
+border-top: 0 none;\
+max-width: 325px;\
+overflow: hidden;\
+margin: 0;\
+padding: 4px;\
+padding-right: 6px;\
+padding-bottom: 0;\
+position: absolute;\
+top: 0px;\
+z-index: 99;\
+white-space: normal;\
+}\
+.ace_search.left {\
+border-left: 0 none;\
+border-radius: 0px 0px 5px 0px;\
+left: 0;\
+}\
+.ace_search.right {\
+border-radius: 0px 0px 0px 5px;\
+border-right: 0 none;\
+right: 0;\
+}\
+.ace_search_form, .ace_replace_form {\
+border-radius: 3px;\
+border: 1px solid #cbcbcb;\
+float: left;\
+margin-bottom: 4px;\
+overflow: hidden;\
+}\
+.ace_search_form.ace_nomatch {\
+outline: 1px solid red;\
+}\
+.ace_search_field {\
+background-color: white;\
+border-right: 1px solid #cbcbcb;\
+border: 0 none;\
+-webkit-box-sizing: border-box;\
+-moz-box-sizing: border-box;\
+box-sizing: border-box;\
+float: left;\
+height: 22px;\
+outline: 0;\
+padding: 0 7px;\
+width: 214px;\
+margin: 0;\
+}\
+.ace_searchbtn,\
+.ace_replacebtn {\
+background: #fff;\
+border: 0 none;\
+border-left: 1px solid #dcdcdc;\
+cursor: pointer;\
+float: left;\
+height: 22px;\
+margin: 0;\
+position: relative;\
+}\
+.ace_searchbtn:last-child,\
+.ace_replacebtn:last-child {\
+border-top-right-radius: 3px;\
+border-bottom-right-radius: 3px;\
+}\
+.ace_searchbtn:disabled {\
+background: none;\
+cursor: default;\
+}\
+.ace_searchbtn {\
+background-position: 50% 50%;\
+background-repeat: no-repeat;\
+width: 27px;\
+}\
+.ace_searchbtn.prev {\
+background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \
+}\
+.ace_searchbtn.next {\
+background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \
+}\
+.ace_searchbtn_close {\
+background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
+border-radius: 50%;\
+border: 0 none;\
+color: #656565;\
+cursor: pointer;\
+float: right;\
+font: 16px/16px Arial;\
+height: 14px;\
+margin: 5px 1px 9px 5px;\
+padding: 0;\
+text-align: center;\
+width: 14px;\
+}\
+.ace_searchbtn_close:hover {\
+background-color: #656565;\
+background-position: 50% 100%;\
+color: white;\
+}\
+.ace_replacebtn.prev {\
+width: 54px\
+}\
+.ace_replacebtn.next {\
+width: 27px\
+}\
+.ace_button {\
+margin-left: 2px;\
+cursor: pointer;\
+-webkit-user-select: none;\
+-moz-user-select: none;\
+-o-user-select: none;\
+-ms-user-select: none;\
+user-select: none;\
+overflow: hidden;\
+opacity: 0.7;\
+border: 1px solid rgba(100,100,100,0.23);\
+padding: 1px;\
+-moz-box-sizing: border-box;\
+box-sizing: border-box;\
+color: black;\
+}\
+.ace_button:hover {\
+background-color: #eee;\
+opacity:1;\
+}\
+.ace_button:active {\
+background-color: #ddd;\
+}\
+.ace_button.checked {\
+border-color: #3399ff;\
+opacity:1;\
+}\
+.ace_search_options{\
+margin-bottom: 3px;\
+text-align: right;\
+-webkit-user-select: none;\
+-moz-user-select: none;\
+-o-user-select: none;\
+-ms-user-select: none;\
+user-select: none;\
+}";
+var HashHandler = acequire("../keyboard/hash_handler").HashHandler;
+var keyUtil = acequire("../lib/keys");
+
+dom.importCssString(searchboxCss, "ace_searchbox");
+
+var html = '\
+
\
+
\
+ \
+ \
+ \
+ All \
+
\
+
\
+ \
+ Replace \
+ All \
+
\
+
\
+ .* \
+ Aa \
+ \\b \
+
\
+
'.replace(/>\s+/g, ">");
+
+var SearchBox = function(editor, range, showReplaceForm) {
+ var div = dom.createElement("div");
+ div.innerHTML = html;
+ this.element = div.firstChild;
+
+ this.$init();
+ this.setEditor(editor);
+};
+
+(function() {
+ this.setEditor = function(editor) {
+ editor.searchBox = this;
+ editor.container.appendChild(this.element);
+ this.editor = editor;
+ };
+
+ this.$initElements = function(sb) {
+ this.searchBox = sb.querySelector(".ace_search_form");
+ this.replaceBox = sb.querySelector(".ace_replace_form");
+ this.searchOptions = sb.querySelector(".ace_search_options");
+ this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
+ this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
+ this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
+ this.searchInput = this.searchBox.querySelector(".ace_search_field");
+ this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
+ };
+
+ this.$init = function() {
+ var sb = this.element;
+
+ this.$initElements(sb);
+
+ var _this = this;
+ event.addListener(sb, "mousedown", function(e) {
+ setTimeout(function(){
+ _this.activeInput.focus();
+ }, 0);
+ event.stopPropagation(e);
+ });
+ event.addListener(sb, "click", function(e) {
+ var t = e.target || e.srcElement;
+ var action = t.getAttribute("action");
+ if (action && _this[action])
+ _this[action]();
+ else if (_this.$searchBarKb.commands[action])
+ _this.$searchBarKb.commands[action].exec(_this);
+ event.stopPropagation(e);
+ });
+
+ event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
+ var keyString = keyUtil.keyCodeToString(keyCode);
+ var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
+ if (command && command.exec) {
+ command.exec(_this);
+ event.stopEvent(e);
+ }
+ });
+
+ this.$onChange = lang.delayedCall(function() {
+ _this.find(false, false);
+ });
+
+ event.addListener(this.searchInput, "input", function() {
+ _this.$onChange.schedule(20);
+ });
+ event.addListener(this.searchInput, "focus", function() {
+ _this.activeInput = _this.searchInput;
+ _this.searchInput.value && _this.highlight();
+ });
+ event.addListener(this.replaceInput, "focus", function() {
+ _this.activeInput = _this.replaceInput;
+ _this.searchInput.value && _this.highlight();
+ });
+ };
+ this.$closeSearchBarKb = new HashHandler([{
+ bindKey: "Esc",
+ name: "closeSearchBar",
+ exec: function(editor) {
+ editor.searchBox.hide();
+ }
+ }]);
+ this.$searchBarKb = new HashHandler();
+ this.$searchBarKb.bindKeys({
+ "Ctrl-f|Command-f": function(sb) {
+ var isReplace = sb.isReplace = !sb.isReplace;
+ sb.replaceBox.style.display = isReplace ? "" : "none";
+ sb.searchInput.focus();
+ },
+ "Ctrl-H|Command-Option-F": function(sb) {
+ sb.replaceBox.style.display = "";
+ sb.replaceInput.focus();
+ },
+ "Ctrl-G|Command-G": function(sb) {
+ sb.findNext();
+ },
+ "Ctrl-Shift-G|Command-Shift-G": function(sb) {
+ sb.findPrev();
+ },
+ "esc": function(sb) {
+ setTimeout(function() { sb.hide();});
+ },
+ "Return": function(sb) {
+ if (sb.activeInput == sb.replaceInput)
+ sb.replace();
+ sb.findNext();
+ },
+ "Shift-Return": function(sb) {
+ if (sb.activeInput == sb.replaceInput)
+ sb.replace();
+ sb.findPrev();
+ },
+ "Alt-Return": function(sb) {
+ if (sb.activeInput == sb.replaceInput)
+ sb.replaceAll();
+ sb.findAll();
+ },
+ "Tab": function(sb) {
+ (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
+ }
+ });
+
+ this.$searchBarKb.addCommands([{
+ name: "toggleRegexpMode",
+ bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
+ exec: function(sb) {
+ sb.regExpOption.checked = !sb.regExpOption.checked;
+ sb.$syncOptions();
+ }
+ }, {
+ name: "toggleCaseSensitive",
+ bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
+ exec: function(sb) {
+ sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
+ sb.$syncOptions();
+ }
+ }, {
+ name: "toggleWholeWords",
+ bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
+ exec: function(sb) {
+ sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
+ sb.$syncOptions();
+ }
+ }]);
+
+ this.$syncOptions = function() {
+ dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
+ dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
+ dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
+ this.find(false, false);
+ };
+
+ this.highlight = function(re) {
+ this.editor.session.highlight(re || this.editor.$search.$options.re);
+ this.editor.renderer.updateBackMarkers()
+ };
+ this.find = function(skipCurrent, backwards, preventScroll) {
+ var range = this.editor.find(this.searchInput.value, {
+ skipCurrent: skipCurrent,
+ backwards: backwards,
+ wrap: true,
+ regExp: this.regExpOption.checked,
+ caseSensitive: this.caseSensitiveOption.checked,
+ wholeWord: this.wholeWordOption.checked,
+ preventScroll: preventScroll
+ });
+ var noMatch = !range && this.searchInput.value;
+ dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
+ this.editor._emit("findSearchBox", { match: !noMatch });
+ this.highlight();
+ };
+ this.findNext = function() {
+ this.find(true, false);
+ };
+ this.findPrev = function() {
+ this.find(true, true);
+ };
+ this.findAll = function(){
+ var range = this.editor.findAll(this.searchInput.value, {
+ regExp: this.regExpOption.checked,
+ caseSensitive: this.caseSensitiveOption.checked,
+ wholeWord: this.wholeWordOption.checked
+ });
+ var noMatch = !range && this.searchInput.value;
+ dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
+ this.editor._emit("findSearchBox", { match: !noMatch });
+ this.highlight();
+ this.hide();
+ };
+ this.replace = function() {
+ if (!this.editor.getReadOnly())
+ this.editor.replace(this.replaceInput.value);
+ };
+ this.replaceAndFindNext = function() {
+ if (!this.editor.getReadOnly()) {
+ this.editor.replace(this.replaceInput.value);
+ this.findNext()
+ }
+ };
+ this.replaceAll = function() {
+ if (!this.editor.getReadOnly())
+ this.editor.replaceAll(this.replaceInput.value);
+ };
+
+ this.hide = function() {
+ this.element.style.display = "none";
+ this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
+ this.editor.focus();
+ };
+ this.show = function(value, isReplace) {
+ this.element.style.display = "";
+ this.replaceBox.style.display = isReplace ? "" : "none";
+
+ this.isReplace = isReplace;
+
+ if (value)
+ this.searchInput.value = value;
+
+ this.find(false, false, true);
+
+ this.searchInput.focus();
+ this.searchInput.select();
+
+ this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
+ };
+
+ this.isFocused = function() {
+ var el = document.activeElement;
+ return el == this.searchInput || el == this.replaceInput;
+ }
+}).call(SearchBox.prototype);
+
+exports.SearchBox = SearchBox;
+
+exports.Search = function(editor, isReplace) {
+ var sb = editor.searchBox || new SearchBox(editor);
+ sb.show(editor.session.getTextRange(), isReplace);
+};
+
+});
+ (function() {
+ ace.acequire(["ace/ext/searchbox"], function() {});
+ })();
+
+},{}],69:[function(require,module,exports){
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Ajax.org B.V. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**
+ * Define a module along with a payload
+ * @param module a name for the payload
+ * @param payload a function to call with (acequire, exports, module) params
+ */
+
+(function() {
+
+var ACE_NAMESPACE = "ace";
+
+var global = (function() { return this; })();
+if (!global && typeof window != "undefined") global = window; // strict mode
+
+
+if (!ACE_NAMESPACE && typeof acequirejs !== "undefined")
+ return;
+
+
+var define = function(module, deps, payload) {
+ if (typeof module !== "string") {
+ if (define.original)
+ define.original.apply(this, arguments);
+ else {
+ console.error("dropping module because define wasn\'t a string.");
+ console.trace();
+ }
+ return;
+ }
+ if (arguments.length == 2)
+ payload = deps;
+ if (!define.modules[module]) {
+ define.payloads[module] = payload;
+ define.modules[module] = null;
+ }
+};
+
+define.modules = {};
+define.payloads = {};
+
+/**
+ * Get at functionality define()ed using the function above
+ */
+var _acequire = function(parentId, module, callback) {
+ if (typeof module === "string") {
+ var payload = lookup(parentId, module);
+ if (payload != undefined) {
+ callback && callback();
+ return payload;
+ }
+ } else if (Object.prototype.toString.call(module) === "[object Array]") {
+ var params = [];
+ for (var i = 0, l = module.length; i < l; ++i) {
+ var dep = lookup(parentId, module[i]);
+ if (dep == undefined && acequire.original)
+ return;
+ params.push(dep);
+ }
+ return callback && callback.apply(null, params) || true;
+ }
+};
+
+var acequire = function(module, callback) {
+ var packagedModule = _acequire("", module, callback);
+ if (packagedModule == undefined && acequire.original)
+ return acequire.original.apply(this, arguments);
+ return packagedModule;
+};
+
+var normalizeModule = function(parentId, moduleName) {
+ // normalize plugin acequires
+ if (moduleName.indexOf("!") !== -1) {
+ var chunks = moduleName.split("!");
+ return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
+ }
+ // normalize relative acequires
+ if (moduleName.charAt(0) == ".") {
+ var base = parentId.split("/").slice(0, -1).join("/");
+ moduleName = base + "/" + moduleName;
+
+ while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
+ var previous = moduleName;
+ moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
+ }
+ }
+ return moduleName;
+};
+
+/**
+ * Internal function to lookup moduleNames and resolve them by calling the
+ * definition function if needed.
+ */
+var lookup = function(parentId, moduleName) {
+ moduleName = normalizeModule(parentId, moduleName);
+
+ var module = define.modules[moduleName];
+ if (!module) {
+ module = define.payloads[moduleName];
+ if (typeof module === 'function') {
+ var exports = {};
+ var mod = {
+ id: moduleName,
+ uri: '',
+ exports: exports,
+ packaged: true
+ };
+
+ var req = function(module, callback) {
+ return _acequire(moduleName, module, callback);
+ };
+
+ var returnValue = module(req, exports, mod);
+ exports = returnValue || mod.exports;
+ define.modules[moduleName] = exports;
+ delete define.payloads[moduleName];
+ }
+ module = define.modules[moduleName] = exports || module;
+ }
+ return module;
+};
+
+function exportAce(ns) {
+ var root = global;
+ if (ns) {
+ if (!global[ns])
+ global[ns] = {};
+ root = global[ns];
+ }
+
+ if (!root.define || !root.define.packaged) {
+ define.original = root.define;
+ root.define = define;
+ root.define.packaged = true;
+ }
+
+ if (!root.acequire || !root.acequire.packaged) {
+ acequire.original = root.acequire;
+ root.acequire = acequire;
+ root.acequire.packaged = true;
+ }
+}
+
+exportAce(ACE_NAMESPACE);
+
+})();
+
+ace.define("ace/lib/regexp",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+ var real = {
+ exec: RegExp.prototype.exec,
+ test: RegExp.prototype.test,
+ match: String.prototype.match,
+ replace: String.prototype.replace,
+ split: String.prototype.split
+ },
+ compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
+ compliantLastIndexIncrement = function () {
+ var x = /^/g;
+ real.test.call(x, "");
+ return !x.lastIndex;
+ }();
+
+ if (compliantLastIndexIncrement && compliantExecNpcg)
+ return;
+ RegExp.prototype.exec = function (str) {
+ var match = real.exec.apply(this, arguments),
+ name, r2;
+ if ( typeof(str) == 'string' && match) {
+ if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
+ r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
+ real.replace.call(str.slice(match.index), r2, function () {
+ for (var i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined)
+ match[i] = undefined;
+ }
+ });
+ }
+ if (this._xregexp && this._xregexp.captureNames) {
+ for (var i = 1; i < match.length; i++) {
+ name = this._xregexp.captureNames[i - 1];
+ if (name)
+ match[name] = match[i];
+ }
+ }
+ if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
+ this.lastIndex--;
+ }
+ return match;
+ };
+ if (!compliantLastIndexIncrement) {
+ RegExp.prototype.test = function (str) {
+ var match = real.exec.call(this, str);
+ if (match && this.global && !match[0].length && (this.lastIndex > match.index))
+ this.lastIndex--;
+ return !!match;
+ };
+ }
+
+ function getNativeFlags (regex) {
+ return (regex.global ? "g" : "") +
+ (regex.ignoreCase ? "i" : "") +
+ (regex.multiline ? "m" : "") +
+ (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
+ (regex.sticky ? "y" : "");
+ }
+
+ function indexOf (array, item, from) {
+ if (Array.prototype.indexOf) // Use the native array method if available
+ return array.indexOf(item, from);
+ for (var i = from || 0; i < array.length; i++) {
+ if (array[i] === item)
+ return i;
+ }
+ return -1;
+ }
+
+});
+
+ace.define("ace/lib/es5-shim",["require","exports","module"], function(acequire, exports, module) {
+
+function Empty() {}
+
+if (!Function.prototype.bind) {
+ Function.prototype.bind = function bind(that) { // .length is 1
+ var target = this;
+ if (typeof target != "function") {
+ throw new TypeError("Function.prototype.bind called on incompatible " + target);
+ }
+ var args = slice.call(arguments, 1); // for normal call
+ var bound = function () {
+
+ if (this instanceof bound) {
+
+ var result = target.apply(
+ this,
+ args.concat(slice.call(arguments))
+ );
+ if (Object(result) === result) {
+ return result;
+ }
+ return this;
+
+ } else {
+ return target.apply(
+ that,
+ args.concat(slice.call(arguments))
+ );
+
+ }
+
+ };
+ if(target.prototype) {
+ Empty.prototype = target.prototype;
+ bound.prototype = new Empty();
+ Empty.prototype = null;
+ }
+ return bound;
+ };
+}
+var call = Function.prototype.call;
+var prototypeOfArray = Array.prototype;
+var prototypeOfObject = Object.prototype;
+var slice = prototypeOfArray.slice;
+var _toString = call.bind(prototypeOfObject.toString);
+var owns = call.bind(prototypeOfObject.hasOwnProperty);
+var defineGetter;
+var defineSetter;
+var lookupGetter;
+var lookupSetter;
+var supportsAccessors;
+if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
+ defineGetter = call.bind(prototypeOfObject.__defineGetter__);
+ defineSetter = call.bind(prototypeOfObject.__defineSetter__);
+ lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
+ lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
+}
+if ([1,2].splice(0).length != 2) {
+ if(function() { // test IE < 9 to splice bug - see issue #138
+ function makeArray(l) {
+ var a = new Array(l+2);
+ a[0] = a[1] = 0;
+ return a;
+ }
+ var array = [], lengthBefore;
+
+ array.splice.apply(array, makeArray(20));
+ array.splice.apply(array, makeArray(26));
+
+ lengthBefore = array.length; //46
+ array.splice(5, 0, "XXX"); // add one element
+
+ lengthBefore + 1 == array.length
+
+ if (lengthBefore + 1 == array.length) {
+ return true;// has right splice implementation without bugs
+ }
+ }()) {//IE 6/7
+ var array_splice = Array.prototype.splice;
+ Array.prototype.splice = function(start, deleteCount) {
+ if (!arguments.length) {
+ return [];
+ } else {
+ return array_splice.apply(this, [
+ start === void 0 ? 0 : start,
+ deleteCount === void 0 ? (this.length - start) : deleteCount
+ ].concat(slice.call(arguments, 2)))
+ }
+ };
+ } else {//IE8
+ Array.prototype.splice = function(pos, removeCount){
+ var length = this.length;
+ if (pos > 0) {
+ if (pos > length)
+ pos = length;
+ } else if (pos == void 0) {
+ pos = 0;
+ } else if (pos < 0) {
+ pos = Math.max(length + pos, 0);
+ }
+
+ if (!(pos+removeCount < length))
+ removeCount = length - pos;
+
+ var removed = this.slice(pos, pos+removeCount);
+ var insert = slice.call(arguments, 2);
+ var add = insert.length;
+ if (pos === length) {
+ if (add) {
+ this.push.apply(this, insert);
+ }
+ } else {
+ var remove = Math.min(removeCount, length - pos);
+ var tailOldPos = pos + remove;
+ var tailNewPos = tailOldPos + add - remove;
+ var tailCount = length - tailOldPos;
+ var lengthAfterRemove = length - remove;
+
+ if (tailNewPos < tailOldPos) { // case A
+ for (var i = 0; i < tailCount; ++i) {
+ this[tailNewPos+i] = this[tailOldPos+i];
+ }
+ } else if (tailNewPos > tailOldPos) { // case B
+ for (i = tailCount; i--; ) {
+ this[tailNewPos+i] = this[tailOldPos+i];
+ }
+ } // else, add == remove (nothing to do)
+
+ if (add && pos === lengthAfterRemove) {
+ this.length = lengthAfterRemove; // truncate array
+ this.push.apply(this, insert);
+ } else {
+ this.length = lengthAfterRemove + add; // reserves space
+ for (i = 0; i < add; ++i) {
+ this[pos+i] = insert[i];
+ }
+ }
+ }
+ return removed;
+ };
+ }
+}
+if (!Array.isArray) {
+ Array.isArray = function isArray(obj) {
+ return _toString(obj) == "[object Array]";
+ };
+}
+var boxedString = Object("a"),
+ splitString = boxedString[0] != "a" || !(0 in boxedString);
+
+if (!Array.prototype.forEach) {
+ Array.prototype.forEach = function forEach(fun /*, thisp*/) {
+ var object = toObject(this),
+ self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ object,
+ thisp = arguments[1],
+ i = -1,
+ length = self.length >>> 0;
+ if (_toString(fun) != "[object Function]") {
+ throw new TypeError(); // TODO message
+ }
+
+ while (++i < length) {
+ if (i in self) {
+ fun.call(thisp, self[i], i, object);
+ }
+ }
+ };
+}
+if (!Array.prototype.map) {
+ Array.prototype.map = function map(fun /*, thisp*/) {
+ var object = toObject(this),
+ self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ object,
+ length = self.length >>> 0,
+ result = Array(length),
+ thisp = arguments[1];
+ if (_toString(fun) != "[object Function]") {
+ throw new TypeError(fun + " is not a function");
+ }
+
+ for (var i = 0; i < length; i++) {
+ if (i in self)
+ result[i] = fun.call(thisp, self[i], i, object);
+ }
+ return result;
+ };
+}
+if (!Array.prototype.filter) {
+ Array.prototype.filter = function filter(fun /*, thisp */) {
+ var object = toObject(this),
+ self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ object,
+ length = self.length >>> 0,
+ result = [],
+ value,
+ thisp = arguments[1];
+ if (_toString(fun) != "[object Function]") {
+ throw new TypeError(fun + " is not a function");
+ }
+
+ for (var i = 0; i < length; i++) {
+ if (i in self) {
+ value = self[i];
+ if (fun.call(thisp, value, i, object)) {
+ result.push(value);
+ }
+ }
+ }
+ return result;
+ };
+}
+if (!Array.prototype.every) {
+ Array.prototype.every = function every(fun /*, thisp */) {
+ var object = toObject(this),
+ self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ object,
+ length = self.length >>> 0,
+ thisp = arguments[1];
+ if (_toString(fun) != "[object Function]") {
+ throw new TypeError(fun + " is not a function");
+ }
+
+ for (var i = 0; i < length; i++) {
+ if (i in self && !fun.call(thisp, self[i], i, object)) {
+ return false;
+ }
+ }
+ return true;
+ };
+}
+if (!Array.prototype.some) {
+ Array.prototype.some = function some(fun /*, thisp */) {
+ var object = toObject(this),
+ self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ object,
+ length = self.length >>> 0,
+ thisp = arguments[1];
+ if (_toString(fun) != "[object Function]") {
+ throw new TypeError(fun + " is not a function");
+ }
+
+ for (var i = 0; i < length; i++) {
+ if (i in self && fun.call(thisp, self[i], i, object)) {
+ return true;
+ }
+ }
+ return false;
+ };
+}
+if (!Array.prototype.reduce) {
+ Array.prototype.reduce = function reduce(fun /*, initial*/) {
+ var object = toObject(this),
+ self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ object,
+ length = self.length >>> 0;
+ if (_toString(fun) != "[object Function]") {
+ throw new TypeError(fun + " is not a function");
+ }
+ if (!length && arguments.length == 1) {
+ throw new TypeError("reduce of empty array with no initial value");
+ }
+
+ var i = 0;
+ var result;
+ if (arguments.length >= 2) {
+ result = arguments[1];
+ } else {
+ do {
+ if (i in self) {
+ result = self[i++];
+ break;
+ }
+ if (++i >= length) {
+ throw new TypeError("reduce of empty array with no initial value");
+ }
+ } while (true);
+ }
+
+ for (; i < length; i++) {
+ if (i in self) {
+ result = fun.call(void 0, result, self[i], i, object);
+ }
+ }
+
+ return result;
+ };
+}
+if (!Array.prototype.reduceRight) {
+ Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
+ var object = toObject(this),
+ self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ object,
+ length = self.length >>> 0;
+ if (_toString(fun) != "[object Function]") {
+ throw new TypeError(fun + " is not a function");
+ }
+ if (!length && arguments.length == 1) {
+ throw new TypeError("reduceRight of empty array with no initial value");
+ }
+
+ var result, i = length - 1;
+ if (arguments.length >= 2) {
+ result = arguments[1];
+ } else {
+ do {
+ if (i in self) {
+ result = self[i--];
+ break;
+ }
+ if (--i < 0) {
+ throw new TypeError("reduceRight of empty array with no initial value");
+ }
+ } while (true);
+ }
+
+ do {
+ if (i in this) {
+ result = fun.call(void 0, result, self[i], i, object);
+ }
+ } while (i--);
+
+ return result;
+ };
+}
+if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
+ Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
+ var self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ toObject(this),
+ length = self.length >>> 0;
+
+ if (!length) {
+ return -1;
+ }
+
+ var i = 0;
+ if (arguments.length > 1) {
+ i = toInteger(arguments[1]);
+ }
+ i = i >= 0 ? i : Math.max(0, length + i);
+ for (; i < length; i++) {
+ if (i in self && self[i] === sought) {
+ return i;
+ }
+ }
+ return -1;
+ };
+}
+if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
+ Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
+ var self = splitString && _toString(this) == "[object String]" ?
+ this.split("") :
+ toObject(this),
+ length = self.length >>> 0;
+
+ if (!length) {
+ return -1;
+ }
+ var i = length - 1;
+ if (arguments.length > 1) {
+ i = Math.min(i, toInteger(arguments[1]));
+ }
+ i = i >= 0 ? i : length - Math.abs(i);
+ for (; i >= 0; i--) {
+ if (i in self && sought === self[i]) {
+ return i;
+ }
+ }
+ return -1;
+ };
+}
+if (!Object.getPrototypeOf) {
+ Object.getPrototypeOf = function getPrototypeOf(object) {
+ return object.__proto__ || (
+ object.constructor ?
+ object.constructor.prototype :
+ prototypeOfObject
+ );
+ };
+}
+if (!Object.getOwnPropertyDescriptor) {
+ var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
+ "non-object: ";
+ Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
+ if ((typeof object != "object" && typeof object != "function") || object === null)
+ throw new TypeError(ERR_NON_OBJECT + object);
+ if (!owns(object, property))
+ return;
+
+ var descriptor, getter, setter;
+ descriptor = { enumerable: true, configurable: true };
+ if (supportsAccessors) {
+ var prototype = object.__proto__;
+ object.__proto__ = prototypeOfObject;
+
+ var getter = lookupGetter(object, property);
+ var setter = lookupSetter(object, property);
+ object.__proto__ = prototype;
+
+ if (getter || setter) {
+ if (getter) descriptor.get = getter;
+ if (setter) descriptor.set = setter;
+ return descriptor;
+ }
+ }
+ descriptor.value = object[property];
+ return descriptor;
+ };
+}
+if (!Object.getOwnPropertyNames) {
+ Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
+ return Object.keys(object);
+ };
+}
+if (!Object.create) {
+ var createEmpty;
+ if (Object.prototype.__proto__ === null) {
+ createEmpty = function () {
+ return { "__proto__": null };
+ };
+ } else {
+ createEmpty = function () {
+ var empty = {};
+ for (var i in empty)
+ empty[i] = null;
+ empty.constructor =
+ empty.hasOwnProperty =
+ empty.propertyIsEnumerable =
+ empty.isPrototypeOf =
+ empty.toLocaleString =
+ empty.toString =
+ empty.valueOf =
+ empty.__proto__ = null;
+ return empty;
+ }
+ }
+
+ Object.create = function create(prototype, properties) {
+ var object;
+ if (prototype === null) {
+ object = createEmpty();
+ } else {
+ if (typeof prototype != "object")
+ throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
+ var Type = function () {};
+ Type.prototype = prototype;
+ object = new Type();
+ object.__proto__ = prototype;
+ }
+ if (properties !== void 0)
+ Object.defineProperties(object, properties);
+ return object;
+ };
+}
+
+function doesDefinePropertyWork(object) {
+ try {
+ Object.defineProperty(object, "sentinel", {});
+ return "sentinel" in object;
+ } catch (exception) {
+ }
+}
+if (Object.defineProperty) {
+ var definePropertyWorksOnObject = doesDefinePropertyWork({});
+ var definePropertyWorksOnDom = typeof document == "undefined" ||
+ doesDefinePropertyWork(document.createElement("div"));
+ if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
+ var definePropertyFallback = Object.defineProperty;
+ }
+}
+
+if (!Object.defineProperty || definePropertyFallback) {
+ var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
+ var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
+ var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
+ "on this javascript engine";
+
+ Object.defineProperty = function defineProperty(object, property, descriptor) {
+ if ((typeof object != "object" && typeof object != "function") || object === null)
+ throw new TypeError(ERR_NON_OBJECT_TARGET + object);
+ if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
+ throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
+ if (definePropertyFallback) {
+ try {
+ return definePropertyFallback.call(Object, object, property, descriptor);
+ } catch (exception) {
+ }
+ }
+ if (owns(descriptor, "value")) {
+
+ if (supportsAccessors && (lookupGetter(object, property) ||
+ lookupSetter(object, property)))
+ {
+ var prototype = object.__proto__;
+ object.__proto__ = prototypeOfObject;
+ delete object[property];
+ object[property] = descriptor.value;
+ object.__proto__ = prototype;
+ } else {
+ object[property] = descriptor.value;
+ }
+ } else {
+ if (!supportsAccessors)
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
+ if (owns(descriptor, "get"))
+ defineGetter(object, property, descriptor.get);
+ if (owns(descriptor, "set"))
+ defineSetter(object, property, descriptor.set);
+ }
+
+ return object;
+ };
+}
+if (!Object.defineProperties) {
+ Object.defineProperties = function defineProperties(object, properties) {
+ for (var property in properties) {
+ if (owns(properties, property))
+ Object.defineProperty(object, property, properties[property]);
+ }
+ return object;
+ };
+}
+if (!Object.seal) {
+ Object.seal = function seal(object) {
+ return object;
+ };
+}
+if (!Object.freeze) {
+ Object.freeze = function freeze(object) {
+ return object;
+ };
+}
+try {
+ Object.freeze(function () {});
+} catch (exception) {
+ Object.freeze = (function freeze(freezeObject) {
+ return function freeze(object) {
+ if (typeof object == "function") {
+ return object;
+ } else {
+ return freezeObject(object);
+ }
+ };
+ })(Object.freeze);
+}
+if (!Object.preventExtensions) {
+ Object.preventExtensions = function preventExtensions(object) {
+ return object;
+ };
+}
+if (!Object.isSealed) {
+ Object.isSealed = function isSealed(object) {
+ return false;
+ };
+}
+if (!Object.isFrozen) {
+ Object.isFrozen = function isFrozen(object) {
+ return false;
+ };
+}
+if (!Object.isExtensible) {
+ Object.isExtensible = function isExtensible(object) {
+ if (Object(object) === object) {
+ throw new TypeError(); // TODO message
+ }
+ var name = '';
+ while (owns(object, name)) {
+ name += '?';
+ }
+ object[name] = true;
+ var returnValue = owns(object, name);
+ delete object[name];
+ return returnValue;
+ };
+}
+if (!Object.keys) {
+ var hasDontEnumBug = true,
+ dontEnums = [
+ "toString",
+ "toLocaleString",
+ "valueOf",
+ "hasOwnProperty",
+ "isPrototypeOf",
+ "propertyIsEnumerable",
+ "constructor"
+ ],
+ dontEnumsLength = dontEnums.length;
+
+ for (var key in {"toString": null}) {
+ hasDontEnumBug = false;
+ }
+
+ Object.keys = function keys(object) {
+
+ if (
+ (typeof object != "object" && typeof object != "function") ||
+ object === null
+ ) {
+ throw new TypeError("Object.keys called on a non-object");
+ }
+
+ var keys = [];
+ for (var name in object) {
+ if (owns(object, name)) {
+ keys.push(name);
+ }
+ }
+
+ if (hasDontEnumBug) {
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
+ var dontEnum = dontEnums[i];
+ if (owns(object, dontEnum)) {
+ keys.push(dontEnum);
+ }
+ }
+ }
+ return keys;
+ };
+
+}
+if (!Date.now) {
+ Date.now = function now() {
+ return new Date().getTime();
+ };
+}
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+ "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
+ "\u2029\uFEFF";
+if (!String.prototype.trim || ws.trim()) {
+ ws = "[" + ws + "]";
+ var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
+ trimEndRegexp = new RegExp(ws + ws + "*$");
+ String.prototype.trim = function trim() {
+ return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
+ };
+}
+
+function toInteger(n) {
+ n = +n;
+ if (n !== n) { // isNaN
+ n = 0;
+ } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
+ }
+ return n;
+}
+
+function isPrimitive(input) {
+ var type = typeof input;
+ return (
+ input === null ||
+ type === "undefined" ||
+ type === "boolean" ||
+ type === "number" ||
+ type === "string"
+ );
+}
+
+function toPrimitive(input) {
+ var val, valueOf, toString;
+ if (isPrimitive(input)) {
+ return input;
+ }
+ valueOf = input.valueOf;
+ if (typeof valueOf === "function") {
+ val = valueOf.call(input);
+ if (isPrimitive(val)) {
+ return val;
+ }
+ }
+ toString = input.toString;
+ if (typeof toString === "function") {
+ val = toString.call(input);
+ if (isPrimitive(val)) {
+ return val;
+ }
+ }
+ throw new TypeError();
+}
+var toObject = function (o) {
+ if (o == null) { // this matches both null and undefined
+ throw new TypeError("can't convert "+o+" to object");
+ }
+ return Object(o);
+};
+
+});
+
+ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"], function(acequire, exports, module) {
+"use strict";
+
+acequire("./regexp");
+acequire("./es5-shim");
+
+});
+
+ace.define("ace/lib/dom",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+var XHTML_NS = "http://www.w3.org/1999/xhtml";
+
+exports.getDocumentHead = function(doc) {
+ if (!doc)
+ doc = document;
+ return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
+};
+
+exports.createElement = function(tag, ns) {
+ return document.createElementNS ?
+ document.createElementNS(ns || XHTML_NS, tag) :
+ document.createElement(tag);
+};
+
+exports.hasCssClass = function(el, name) {
+ var classes = (el.className || "").split(/\s+/g);
+ return classes.indexOf(name) !== -1;
+};
+exports.addCssClass = function(el, name) {
+ if (!exports.hasCssClass(el, name)) {
+ el.className += " " + name;
+ }
+};
+exports.removeCssClass = function(el, name) {
+ var classes = el.className.split(/\s+/g);
+ while (true) {
+ var index = classes.indexOf(name);
+ if (index == -1) {
+ break;
+ }
+ classes.splice(index, 1);
+ }
+ el.className = classes.join(" ");
+};
+
+exports.toggleCssClass = function(el, name) {
+ var classes = el.className.split(/\s+/g), add = true;
+ while (true) {
+ var index = classes.indexOf(name);
+ if (index == -1) {
+ break;
+ }
+ add = false;
+ classes.splice(index, 1);
+ }
+ if (add)
+ classes.push(name);
+
+ el.className = classes.join(" ");
+ return add;
+};
+exports.setCssClass = function(node, className, include) {
+ if (include) {
+ exports.addCssClass(node, className);
+ } else {
+ exports.removeCssClass(node, className);
+ }
+};
+
+exports.hasCssString = function(id, doc) {
+ var index = 0, sheets;
+ doc = doc || document;
+
+ if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
+ while (index < sheets.length)
+ if (sheets[index++].owningElement.id === id) return true;
+ } else if ((sheets = doc.getElementsByTagName("style"))) {
+ while (index < sheets.length)
+ if (sheets[index++].id === id) return true;
+ }
+
+ return false;
+};
+
+exports.importCssString = function importCssString(cssText, id, doc) {
+ doc = doc || document;
+ if (id && exports.hasCssString(id, doc))
+ return null;
+
+ var style;
+
+ if (id)
+ cssText += "\n/*# sourceURL=ace/css/" + id + " */";
+
+ if (doc.createStyleSheet) {
+ style = doc.createStyleSheet();
+ style.cssText = cssText;
+ if (id)
+ style.owningElement.id = id;
+ } else {
+ style = exports.createElement("style");
+ style.appendChild(doc.createTextNode(cssText));
+ if (id)
+ style.id = id;
+
+ exports.getDocumentHead(doc).appendChild(style);
+ }
+};
+
+exports.importCssStylsheet = function(uri, doc) {
+ if (doc.createStyleSheet) {
+ doc.createStyleSheet(uri);
+ } else {
+ var link = exports.createElement('link');
+ link.rel = 'stylesheet';
+ link.href = uri;
+
+ exports.getDocumentHead(doc).appendChild(link);
+ }
+};
+
+exports.getInnerWidth = function(element) {
+ return (
+ parseInt(exports.computedStyle(element, "paddingLeft"), 10) +
+ parseInt(exports.computedStyle(element, "paddingRight"), 10) +
+ element.clientWidth
+ );
+};
+
+exports.getInnerHeight = function(element) {
+ return (
+ parseInt(exports.computedStyle(element, "paddingTop"), 10) +
+ parseInt(exports.computedStyle(element, "paddingBottom"), 10) +
+ element.clientHeight
+ );
+};
+
+exports.scrollbarWidth = function(document) {
+ var inner = exports.createElement("ace_inner");
+ inner.style.width = "100%";
+ inner.style.minWidth = "0px";
+ inner.style.height = "200px";
+ inner.style.display = "block";
+
+ var outer = exports.createElement("ace_outer");
+ var style = outer.style;
+
+ style.position = "absolute";
+ style.left = "-10000px";
+ style.overflow = "hidden";
+ style.width = "200px";
+ style.minWidth = "0px";
+ style.height = "150px";
+ style.display = "block";
+
+ outer.appendChild(inner);
+
+ var body = document.documentElement;
+ body.appendChild(outer);
+
+ var noScrollbar = inner.offsetWidth;
+
+ style.overflow = "scroll";
+ var withScrollbar = inner.offsetWidth;
+
+ if (noScrollbar == withScrollbar) {
+ withScrollbar = outer.clientWidth;
+ }
+
+ body.removeChild(outer);
+
+ return noScrollbar-withScrollbar;
+};
+
+if (typeof document == "undefined") {
+ exports.importCssString = function() {};
+ return;
+}
+
+if (window.pageYOffset !== undefined) {
+ exports.getPageScrollTop = function() {
+ return window.pageYOffset;
+ };
+
+ exports.getPageScrollLeft = function() {
+ return window.pageXOffset;
+ };
+}
+else {
+ exports.getPageScrollTop = function() {
+ return document.body.scrollTop;
+ };
+
+ exports.getPageScrollLeft = function() {
+ return document.body.scrollLeft;
+ };
+}
+
+if (window.getComputedStyle)
+ exports.computedStyle = function(element, style) {
+ if (style)
+ return (window.getComputedStyle(element, "") || {})[style] || "";
+ return window.getComputedStyle(element, "") || {};
+ };
+else
+ exports.computedStyle = function(element, style) {
+ if (style)
+ return element.currentStyle[style];
+ return element.currentStyle;
+ };
+exports.setInnerHtml = function(el, innerHtml) {
+ var element = el.cloneNode(false);//document.createElement("div");
+ element.innerHTML = innerHtml;
+ el.parentNode.replaceChild(element, el);
+ return element;
+};
+
+if ("textContent" in document.documentElement) {
+ exports.setInnerText = function(el, innerText) {
+ el.textContent = innerText;
+ };
+
+ exports.getInnerText = function(el) {
+ return el.textContent;
+ };
+}
+else {
+ exports.setInnerText = function(el, innerText) {
+ el.innerText = innerText;
+ };
+
+ exports.getInnerText = function(el) {
+ return el.innerText;
+ };
+}
+
+exports.getParentWindow = function(document) {
+ return document.defaultView || document.parentWindow;
+};
+
+});
+
+ace.define("ace/lib/oop",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+exports.inherits = function(ctor, superCtor) {
+ ctor.super_ = superCtor;
+ ctor.prototype = Object.create(superCtor.prototype, {
+ constructor: {
+ value: ctor,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+};
+
+exports.mixin = function(obj, mixin) {
+ for (var key in mixin) {
+ obj[key] = mixin[key];
+ }
+ return obj;
+};
+
+exports.implement = function(proto, mixin) {
+ exports.mixin(proto, mixin);
+};
+
+});
+
+ace.define("ace/lib/keys",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop"], function(acequire, exports, module) {
+"use strict";
+
+acequire("./fixoldbrowsers");
+
+var oop = acequire("./oop");
+var Keys = (function() {
+ var ret = {
+ MODIFIER_KEYS: {
+ 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
+ },
+
+ KEY_MODS: {
+ "ctrl": 1, "alt": 2, "option" : 2, "shift": 4,
+ "super": 8, "meta": 8, "command": 8, "cmd": 8
+ },
+
+ FUNCTION_KEYS : {
+ 8 : "Backspace",
+ 9 : "Tab",
+ 13 : "Return",
+ 19 : "Pause",
+ 27 : "Esc",
+ 32 : "Space",
+ 33 : "PageUp",
+ 34 : "PageDown",
+ 35 : "End",
+ 36 : "Home",
+ 37 : "Left",
+ 38 : "Up",
+ 39 : "Right",
+ 40 : "Down",
+ 44 : "Print",
+ 45 : "Insert",
+ 46 : "Delete",
+ 96 : "Numpad0",
+ 97 : "Numpad1",
+ 98 : "Numpad2",
+ 99 : "Numpad3",
+ 100: "Numpad4",
+ 101: "Numpad5",
+ 102: "Numpad6",
+ 103: "Numpad7",
+ 104: "Numpad8",
+ 105: "Numpad9",
+ '-13': "NumpadEnter",
+ 112: "F1",
+ 113: "F2",
+ 114: "F3",
+ 115: "F4",
+ 116: "F5",
+ 117: "F6",
+ 118: "F7",
+ 119: "F8",
+ 120: "F9",
+ 121: "F10",
+ 122: "F11",
+ 123: "F12",
+ 144: "Numlock",
+ 145: "Scrolllock"
+ },
+
+ PRINTABLE_KEYS: {
+ 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
+ 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
+ 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
+ 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
+ 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
+ 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
+ 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',
+ 219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*'
+ }
+ };
+ var name, i;
+ for (i in ret.FUNCTION_KEYS) {
+ name = ret.FUNCTION_KEYS[i].toLowerCase();
+ ret[name] = parseInt(i, 10);
+ }
+ for (i in ret.PRINTABLE_KEYS) {
+ name = ret.PRINTABLE_KEYS[i].toLowerCase();
+ ret[name] = parseInt(i, 10);
+ }
+ oop.mixin(ret, ret.MODIFIER_KEYS);
+ oop.mixin(ret, ret.PRINTABLE_KEYS);
+ oop.mixin(ret, ret.FUNCTION_KEYS);
+ ret.enter = ret["return"];
+ ret.escape = ret.esc;
+ ret.del = ret["delete"];
+ ret[173] = '-';
+
+ (function() {
+ var mods = ["cmd", "ctrl", "alt", "shift"];
+ for (var i = Math.pow(2, mods.length); i--;) {
+ ret.KEY_MODS[i] = mods.filter(function(x) {
+ return i & ret.KEY_MODS[x];
+ }).join("-") + "-";
+ }
+ })();
+
+ ret.KEY_MODS[0] = "";
+ ret.KEY_MODS[-1] = "input-";
+
+ return ret;
+})();
+oop.mixin(exports, Keys);
+
+exports.keyCodeToString = function(keyCode) {
+ var keyString = Keys[keyCode];
+ if (typeof keyString != "string")
+ keyString = String.fromCharCode(keyCode);
+ return keyString.toLowerCase();
+};
+
+});
+
+ace.define("ace/lib/useragent",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+exports.OS = {
+ LINUX: "LINUX",
+ MAC: "MAC",
+ WINDOWS: "WINDOWS"
+};
+exports.getOS = function() {
+ if (exports.isMac) {
+ return exports.OS.MAC;
+ } else if (exports.isLinux) {
+ return exports.OS.LINUX;
+ } else {
+ return exports.OS.WINDOWS;
+ }
+};
+if (typeof navigator != "object")
+ return;
+
+var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
+var ua = navigator.userAgent;
+exports.isWin = (os == "win");
+exports.isMac = (os == "mac");
+exports.isLinux = (os == "linux");
+exports.isIE =
+ (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0)
+ ? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1])
+ : parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]); // for ie
+
+exports.isOldIE = exports.isIE && exports.isIE < 9;
+exports.isGecko = exports.isMozilla = (window.Controllers || window.controllers) && window.navigator.product === "Gecko";
+exports.isOldGecko = exports.isGecko && parseInt((ua.match(/rv\:(\d+)/)||[])[1], 10) < 4;
+exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
+exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
+
+exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
+
+exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
+
+exports.isIPad = ua.indexOf("iPad") >= 0;
+
+exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
+
+exports.isChromeOS = ua.indexOf(" CrOS ") >= 0;
+
+});
+
+ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"], function(acequire, exports, module) {
+"use strict";
+
+var keys = acequire("./keys");
+var useragent = acequire("./useragent");
+
+var pressedKeys = null;
+var ts = 0;
+
+exports.addListener = function(elem, type, callback) {
+ if (elem.addEventListener) {
+ return elem.addEventListener(type, callback, false);
+ }
+ if (elem.attachEvent) {
+ var wrapper = function() {
+ callback.call(elem, window.event);
+ };
+ callback._wrapper = wrapper;
+ elem.attachEvent("on" + type, wrapper);
+ }
+};
+
+exports.removeListener = function(elem, type, callback) {
+ if (elem.removeEventListener) {
+ return elem.removeEventListener(type, callback, false);
+ }
+ if (elem.detachEvent) {
+ elem.detachEvent("on" + type, callback._wrapper || callback);
+ }
+};
+exports.stopEvent = function(e) {
+ exports.stopPropagation(e);
+ exports.preventDefault(e);
+ return false;
+};
+
+exports.stopPropagation = function(e) {
+ if (e.stopPropagation)
+ e.stopPropagation();
+ else
+ e.cancelBubble = true;
+};
+
+exports.preventDefault = function(e) {
+ if (e.preventDefault)
+ e.preventDefault();
+ else
+ e.returnValue = false;
+};
+exports.getButton = function(e) {
+ if (e.type == "dblclick")
+ return 0;
+ if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
+ return 2;
+ if (e.preventDefault) {
+ return e.button;
+ }
+ else {
+ return {1:0, 2:2, 4:1}[e.button];
+ }
+};
+
+exports.capture = function(el, eventHandler, releaseCaptureHandler) {
+ function onMouseUp(e) {
+ eventHandler && eventHandler(e);
+ releaseCaptureHandler && releaseCaptureHandler(e);
+
+ exports.removeListener(document, "mousemove", eventHandler, true);
+ exports.removeListener(document, "mouseup", onMouseUp, true);
+ exports.removeListener(document, "dragstart", onMouseUp, true);
+ }
+
+ exports.addListener(document, "mousemove", eventHandler, true);
+ exports.addListener(document, "mouseup", onMouseUp, true);
+ exports.addListener(document, "dragstart", onMouseUp, true);
+
+ return onMouseUp;
+};
+
+exports.addTouchMoveListener = function (el, callback) {
+ if ("ontouchmove" in el) {
+ var startx, starty;
+ exports.addListener(el, "touchstart", function (e) {
+ var touchObj = e.changedTouches[0];
+ startx = touchObj.clientX;
+ starty = touchObj.clientY;
+ });
+ exports.addListener(el, "touchmove", function (e) {
+ var factor = 1,
+ touchObj = e.changedTouches[0];
+
+ e.wheelX = -(touchObj.clientX - startx) / factor;
+ e.wheelY = -(touchObj.clientY - starty) / factor;
+
+ startx = touchObj.clientX;
+ starty = touchObj.clientY;
+
+ callback(e);
+ });
+ }
+};
+
+exports.addMouseWheelListener = function(el, callback) {
+ if ("onmousewheel" in el) {
+ exports.addListener(el, "mousewheel", function(e) {
+ var factor = 8;
+ if (e.wheelDeltaX !== undefined) {
+ e.wheelX = -e.wheelDeltaX / factor;
+ e.wheelY = -e.wheelDeltaY / factor;
+ } else {
+ e.wheelX = 0;
+ e.wheelY = -e.wheelDelta / factor;
+ }
+ callback(e);
+ });
+ } else if ("onwheel" in el) {
+ exports.addListener(el, "wheel", function(e) {
+ var factor = 0.35;
+ switch (e.deltaMode) {
+ case e.DOM_DELTA_PIXEL:
+ e.wheelX = e.deltaX * factor || 0;
+ e.wheelY = e.deltaY * factor || 0;
+ break;
+ case e.DOM_DELTA_LINE:
+ case e.DOM_DELTA_PAGE:
+ e.wheelX = (e.deltaX || 0) * 5;
+ e.wheelY = (e.deltaY || 0) * 5;
+ break;
+ }
+
+ callback(e);
+ });
+ } else {
+ exports.addListener(el, "DOMMouseScroll", function(e) {
+ if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
+ e.wheelX = (e.detail || 0) * 5;
+ e.wheelY = 0;
+ } else {
+ e.wheelX = 0;
+ e.wheelY = (e.detail || 0) * 5;
+ }
+ callback(e);
+ });
+ }
+};
+
+exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName) {
+ var clicks = 0;
+ var startX, startY, timer;
+ var eventNames = {
+ 2: "dblclick",
+ 3: "tripleclick",
+ 4: "quadclick"
+ };
+
+ function onMousedown(e) {
+ if (exports.getButton(e) !== 0) {
+ clicks = 0;
+ } else if (e.detail > 1) {
+ clicks++;
+ if (clicks > 4)
+ clicks = 1;
+ } else {
+ clicks = 1;
+ }
+ if (useragent.isIE) {
+ var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
+ if (!timer || isNewClick)
+ clicks = 1;
+ if (timer)
+ clearTimeout(timer);
+ timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
+
+ if (clicks == 1) {
+ startX = e.clientX;
+ startY = e.clientY;
+ }
+ }
+
+ e._clicks = clicks;
+
+ eventHandler[callbackName]("mousedown", e);
+
+ if (clicks > 4)
+ clicks = 0;
+ else if (clicks > 1)
+ return eventHandler[callbackName](eventNames[clicks], e);
+ }
+ function onDblclick(e) {
+ clicks = 2;
+ if (timer)
+ clearTimeout(timer);
+ timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
+ eventHandler[callbackName]("mousedown", e);
+ eventHandler[callbackName](eventNames[clicks], e);
+ }
+ if (!Array.isArray(elements))
+ elements = [elements];
+ elements.forEach(function(el) {
+ exports.addListener(el, "mousedown", onMousedown);
+ if (useragent.isOldIE)
+ exports.addListener(el, "dblclick", onDblclick);
+ });
+};
+
+var getModifierHash = useragent.isMac && useragent.isOpera && !("KeyboardEvent" in window)
+ ? function(e) {
+ return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
+ }
+ : function(e) {
+ return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
+ };
+
+exports.getModifierString = function(e) {
+ return keys.KEY_MODS[getModifierHash(e)];
+};
+
+function normalizeCommandKeys(callback, e, keyCode) {
+ var hashId = getModifierHash(e);
+
+ if (!useragent.isMac && pressedKeys) {
+ if (pressedKeys.OSKey)
+ hashId |= 8;
+ if (pressedKeys.altGr) {
+ if ((3 & hashId) != 3)
+ pressedKeys.altGr = 0;
+ else
+ return;
+ }
+ if (keyCode === 18 || keyCode === 17) {
+ var location = "location" in e ? e.location : e.keyLocation;
+ if (keyCode === 17 && location === 1) {
+ if (pressedKeys[keyCode] == 1)
+ ts = e.timeStamp;
+ } else if (keyCode === 18 && hashId === 3 && location === 2) {
+ var dt = e.timeStamp - ts;
+ if (dt < 50)
+ pressedKeys.altGr = true;
+ }
+ }
+ }
+
+ if (keyCode in keys.MODIFIER_KEYS) {
+ keyCode = -1;
+ }
+ if (hashId & 8 && (keyCode >= 91 && keyCode <= 93)) {
+ keyCode = -1;
+ }
+
+ if (!hashId && keyCode === 13) {
+ var location = "location" in e ? e.location : e.keyLocation;
+ if (location === 3) {
+ callback(e, hashId, -keyCode);
+ if (e.defaultPrevented)
+ return;
+ }
+ }
+
+ if (useragent.isChromeOS && hashId & 8) {
+ callback(e, hashId, keyCode);
+ if (e.defaultPrevented)
+ return;
+ else
+ hashId &= ~8;
+ }
+ if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
+ return false;
+ }
+
+ return callback(e, hashId, keyCode);
+}
+
+
+exports.addCommandKeyListener = function(el, callback) {
+ var addListener = exports.addListener;
+ if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) {
+ var lastKeyDownKeyCode = null;
+ addListener(el, "keydown", function(e) {
+ lastKeyDownKeyCode = e.keyCode;
+ });
+ addListener(el, "keypress", function(e) {
+ return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
+ });
+ } else {
+ var lastDefaultPrevented = null;
+
+ addListener(el, "keydown", function(e) {
+ var keyCode = e.keyCode;
+ pressedKeys[keyCode] = (pressedKeys[keyCode] || 0) + 1;
+ if (keyCode == 91 || keyCode == 92) {
+ pressedKeys.OSKey = true;
+ } else if (pressedKeys.OSKey) {
+ if (e.timeStamp - pressedKeys.lastT > 200 && pressedKeys.count == 1)
+ resetPressedKeys();
+ }
+ if (pressedKeys[keyCode] == 1)
+ pressedKeys.count++;
+ pressedKeys.lastT = e.timeStamp;
+ var result = normalizeCommandKeys(callback, e, keyCode);
+ lastDefaultPrevented = e.defaultPrevented;
+ return result;
+ });
+
+ addListener(el, "keypress", function(e) {
+ if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {
+ exports.stopEvent(e);
+ lastDefaultPrevented = null;
+ }
+ });
+
+ addListener(el, "keyup", function(e) {
+ var keyCode = e.keyCode;
+ if (!pressedKeys[keyCode]) {
+ resetPressedKeys();
+ } else {
+ pressedKeys.count = Math.max(pressedKeys.count - 1, 0);
+ }
+ if (keyCode == 91 || keyCode == 92) {
+ pressedKeys.OSKey = false;
+ }
+ pressedKeys[keyCode] = null;
+ });
+
+ if (!pressedKeys) {
+ resetPressedKeys();
+ addListener(window, "focus", resetPressedKeys);
+ }
+ }
+};
+function resetPressedKeys() {
+ pressedKeys = Object.create(null);
+ pressedKeys.count = 0;
+ pressedKeys.lastT = 0;
+}
+
+if (typeof window == "object" && window.postMessage && !useragent.isOldIE) {
+ var postMessageId = 1;
+ exports.nextTick = function(callback, win) {
+ win = win || window;
+ var messageName = "zero-timeout-message-" + postMessageId;
+ exports.addListener(win, "message", function listener(e) {
+ if (e.data == messageName) {
+ exports.stopPropagation(e);
+ exports.removeListener(win, "message", listener);
+ callback();
+ }
+ });
+ win.postMessage(messageName, "*");
+ };
+}
+
+
+exports.nextFrame = typeof window == "object" && (window.requestAnimationFrame
+ || window.mozRequestAnimationFrame
+ || window.webkitRequestAnimationFrame
+ || window.msRequestAnimationFrame
+ || window.oRequestAnimationFrame);
+
+if (exports.nextFrame)
+ exports.nextFrame = exports.nextFrame.bind(window);
+else
+ exports.nextFrame = function(callback) {
+ setTimeout(callback, 17);
+ };
+});
+
+ace.define("ace/lib/lang",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+exports.last = function(a) {
+ return a[a.length - 1];
+};
+
+exports.stringReverse = function(string) {
+ return string.split("").reverse().join("");
+};
+
+exports.stringRepeat = function (string, count) {
+ var result = '';
+ while (count > 0) {
+ if (count & 1)
+ result += string;
+
+ if (count >>= 1)
+ string += string;
+ }
+ return result;
+};
+
+var trimBeginRegexp = /^\s\s*/;
+var trimEndRegexp = /\s\s*$/;
+
+exports.stringTrimLeft = function (string) {
+ return string.replace(trimBeginRegexp, '');
+};
+
+exports.stringTrimRight = function (string) {
+ return string.replace(trimEndRegexp, '');
+};
+
+exports.copyObject = function(obj) {
+ var copy = {};
+ for (var key in obj) {
+ copy[key] = obj[key];
+ }
+ return copy;
+};
+
+exports.copyArray = function(array){
+ var copy = [];
+ for (var i=0, l=array.length; i 1);
+ return ev.preventDefault();
+ };
+
+ this.startSelect = function(pos, waitForClickSelection) {
+ pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
+ var editor = this.editor;
+ editor.$blockScrolling++;
+ if (this.mousedownEvent.getShiftKey())
+ editor.selection.selectToPosition(pos);
+ else if (!waitForClickSelection)
+ editor.selection.moveToPosition(pos);
+ if (!waitForClickSelection)
+ this.select();
+ if (editor.renderer.scroller.setCapture) {
+ editor.renderer.scroller.setCapture();
+ }
+ editor.setStyle("ace_selecting");
+ this.setState("select");
+ editor.$blockScrolling--;
+ };
+
+ this.select = function() {
+ var anchor, editor = this.editor;
+ var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
+ editor.$blockScrolling++;
+ if (this.$clickSelection) {
+ var cmp = this.$clickSelection.comparePoint(cursor);
+
+ if (cmp == -1) {
+ anchor = this.$clickSelection.end;
+ } else if (cmp == 1) {
+ anchor = this.$clickSelection.start;
+ } else {
+ var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
+ cursor = orientedRange.cursor;
+ anchor = orientedRange.anchor;
+ }
+ editor.selection.setSelectionAnchor(anchor.row, anchor.column);
+ }
+ editor.selection.selectToPosition(cursor);
+ editor.$blockScrolling--;
+ editor.renderer.scrollCursorIntoView();
+ };
+
+ this.extendSelectionBy = function(unitName) {
+ var anchor, editor = this.editor;
+ var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
+ var range = editor.selection[unitName](cursor.row, cursor.column);
+ editor.$blockScrolling++;
+ if (this.$clickSelection) {
+ var cmpStart = this.$clickSelection.comparePoint(range.start);
+ var cmpEnd = this.$clickSelection.comparePoint(range.end);
+
+ if (cmpStart == -1 && cmpEnd <= 0) {
+ anchor = this.$clickSelection.end;
+ if (range.end.row != cursor.row || range.end.column != cursor.column)
+ cursor = range.start;
+ } else if (cmpEnd == 1 && cmpStart >= 0) {
+ anchor = this.$clickSelection.start;
+ if (range.start.row != cursor.row || range.start.column != cursor.column)
+ cursor = range.end;
+ } else if (cmpStart == -1 && cmpEnd == 1) {
+ cursor = range.end;
+ anchor = range.start;
+ } else {
+ var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
+ cursor = orientedRange.cursor;
+ anchor = orientedRange.anchor;
+ }
+ editor.selection.setSelectionAnchor(anchor.row, anchor.column);
+ }
+ editor.selection.selectToPosition(cursor);
+ editor.$blockScrolling--;
+ editor.renderer.scrollCursorIntoView();
+ };
+
+ this.selectEnd =
+ this.selectAllEnd =
+ this.selectByWordsEnd =
+ this.selectByLinesEnd = function() {
+ this.$clickSelection = null;
+ this.editor.unsetStyle("ace_selecting");
+ if (this.editor.renderer.scroller.releaseCapture) {
+ this.editor.renderer.scroller.releaseCapture();
+ }
+ };
+
+ this.focusWait = function() {
+ var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
+ var time = Date.now();
+
+ if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout)
+ this.startSelect(this.mousedownEvent.getDocumentPosition());
+ };
+
+ this.onDoubleClick = function(ev) {
+ var pos = ev.getDocumentPosition();
+ var editor = this.editor;
+ var session = editor.session;
+
+ var range = session.getBracketRange(pos);
+ if (range) {
+ if (range.isEmpty()) {
+ range.start.column--;
+ range.end.column++;
+ }
+ this.setState("select");
+ } else {
+ range = editor.selection.getWordRange(pos.row, pos.column);
+ this.setState("selectByWords");
+ }
+ this.$clickSelection = range;
+ this.select();
+ };
+
+ this.onTripleClick = function(ev) {
+ var pos = ev.getDocumentPosition();
+ var editor = this.editor;
+
+ this.setState("selectByLines");
+ var range = editor.getSelectionRange();
+ if (range.isMultiLine() && range.contains(pos.row, pos.column)) {
+ this.$clickSelection = editor.selection.getLineRange(range.start.row);
+ this.$clickSelection.end = editor.selection.getLineRange(range.end.row).end;
+ } else {
+ this.$clickSelection = editor.selection.getLineRange(pos.row);
+ }
+ this.select();
+ };
+
+ this.onQuadClick = function(ev) {
+ var editor = this.editor;
+
+ editor.selectAll();
+ this.$clickSelection = editor.getSelectionRange();
+ this.setState("selectAll");
+ };
+
+ this.onMouseWheel = function(ev) {
+ if (ev.getAccelKey())
+ return;
+ if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {
+ ev.wheelX = ev.wheelY;
+ ev.wheelY = 0;
+ }
+
+ var t = ev.domEvent.timeStamp;
+ var dt = t - (this.$lastScrollTime||0);
+
+ var editor = this.editor;
+ var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
+ if (isScrolable || dt < 200) {
+ this.$lastScrollTime = t;
+ editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
+ return ev.stop();
+ }
+ };
+
+ this.onTouchMove = function (ev) {
+ var t = ev.domEvent.timeStamp;
+ var dt = t - (this.$lastScrollTime || 0);
+
+ var editor = this.editor;
+ var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
+ if (isScrolable || dt < 200) {
+ this.$lastScrollTime = t;
+ editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
+ return ev.stop();
+ }
+ };
+
+}).call(DefaultHandlers.prototype);
+
+exports.DefaultHandlers = DefaultHandlers;
+
+function calcDistance(ax, ay, bx, by) {
+ return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
+}
+
+function calcRangeOrientation(range, cursor) {
+ if (range.start.row == range.end.row)
+ var cmp = 2 * cursor.column - range.start.column - range.end.column;
+ else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column)
+ var cmp = cursor.column - 4;
+ else
+ var cmp = 2 * cursor.row - range.start.row - range.end.row;
+
+ if (cmp < 0)
+ return {cursor: range.start, anchor: range.end};
+ else
+ return {cursor: range.end, anchor: range.start};
+}
+
+});
+
+ace.define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var dom = acequire("./lib/dom");
+function Tooltip (parentNode) {
+ this.isOpen = false;
+ this.$element = null;
+ this.$parentNode = parentNode;
+}
+
+(function() {
+ this.$init = function() {
+ this.$element = dom.createElement("div");
+ this.$element.className = "ace_tooltip";
+ this.$element.style.display = "none";
+ this.$parentNode.appendChild(this.$element);
+ return this.$element;
+ };
+ this.getElement = function() {
+ return this.$element || this.$init();
+ };
+ this.setText = function(text) {
+ dom.setInnerText(this.getElement(), text);
+ };
+ this.setHtml = function(html) {
+ this.getElement().innerHTML = html;
+ };
+ this.setPosition = function(x, y) {
+ this.getElement().style.left = x + "px";
+ this.getElement().style.top = y + "px";
+ };
+ this.setClassName = function(className) {
+ dom.addCssClass(this.getElement(), className);
+ };
+ this.show = function(text, x, y) {
+ if (text != null)
+ this.setText(text);
+ if (x != null && y != null)
+ this.setPosition(x, y);
+ if (!this.isOpen) {
+ this.getElement().style.display = "block";
+ this.isOpen = true;
+ }
+ };
+
+ this.hide = function() {
+ if (this.isOpen) {
+ this.getElement().style.display = "none";
+ this.isOpen = false;
+ }
+ };
+ this.getHeight = function() {
+ return this.getElement().offsetHeight;
+ };
+ this.getWidth = function() {
+ return this.getElement().offsetWidth;
+ };
+
+}).call(Tooltip.prototype);
+
+exports.Tooltip = Tooltip;
+});
+
+ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"], function(acequire, exports, module) {
+"use strict";
+var dom = acequire("../lib/dom");
+var oop = acequire("../lib/oop");
+var event = acequire("../lib/event");
+var Tooltip = acequire("../tooltip").Tooltip;
+
+function GutterHandler(mouseHandler) {
+ var editor = mouseHandler.editor;
+ var gutter = editor.renderer.$gutterLayer;
+ var tooltip = new GutterTooltip(editor.container);
+
+ mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) {
+ if (!editor.isFocused() || e.getButton() != 0)
+ return;
+ var gutterRegion = gutter.getRegion(e);
+
+ if (gutterRegion == "foldWidgets")
+ return;
+
+ var row = e.getDocumentPosition().row;
+ var selection = editor.session.selection;
+
+ if (e.getShiftKey())
+ selection.selectTo(row, 0);
+ else {
+ if (e.domEvent.detail == 2) {
+ editor.selectAll();
+ return e.preventDefault();
+ }
+ mouseHandler.$clickSelection = editor.selection.getLineRange(row);
+ }
+ mouseHandler.setState("selectByLines");
+ mouseHandler.captureMouse(e);
+ return e.preventDefault();
+ });
+
+
+ var tooltipTimeout, mouseEvent, tooltipAnnotation;
+
+ function showTooltip() {
+ var row = mouseEvent.getDocumentPosition().row;
+ var annotation = gutter.$annotations[row];
+ if (!annotation)
+ return hideTooltip();
+
+ var maxRow = editor.session.getLength();
+ if (row == maxRow) {
+ var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;
+ var pos = mouseEvent.$pos;
+ if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column))
+ return hideTooltip();
+ }
+
+ if (tooltipAnnotation == annotation)
+ return;
+ tooltipAnnotation = annotation.text.join(" ");
+
+ tooltip.setHtml(tooltipAnnotation);
+ tooltip.show();
+ editor.on("mousewheel", hideTooltip);
+
+ if (mouseHandler.$tooltipFollowsMouse) {
+ moveTooltip(mouseEvent);
+ } else {
+ var gutterElement = mouseEvent.domEvent.target;
+ var rect = gutterElement.getBoundingClientRect();
+ var style = tooltip.getElement().style;
+ style.left = rect.right + "px";
+ style.top = rect.bottom + "px";
+ }
+ }
+
+ function hideTooltip() {
+ if (tooltipTimeout)
+ tooltipTimeout = clearTimeout(tooltipTimeout);
+ if (tooltipAnnotation) {
+ tooltip.hide();
+ tooltipAnnotation = null;
+ editor.removeEventListener("mousewheel", hideTooltip);
+ }
+ }
+
+ function moveTooltip(e) {
+ tooltip.setPosition(e.x, e.y);
+ }
+
+ mouseHandler.editor.setDefaultHandler("guttermousemove", function(e) {
+ var target = e.domEvent.target || e.domEvent.srcElement;
+ if (dom.hasCssClass(target, "ace_fold-widget"))
+ return hideTooltip();
+
+ if (tooltipAnnotation && mouseHandler.$tooltipFollowsMouse)
+ moveTooltip(e);
+
+ mouseEvent = e;
+ if (tooltipTimeout)
+ return;
+ tooltipTimeout = setTimeout(function() {
+ tooltipTimeout = null;
+ if (mouseEvent && !mouseHandler.isMousePressed)
+ showTooltip();
+ else
+ hideTooltip();
+ }, 50);
+ });
+
+ event.addListener(editor.renderer.$gutter, "mouseout", function(e) {
+ mouseEvent = null;
+ if (!tooltipAnnotation || tooltipTimeout)
+ return;
+
+ tooltipTimeout = setTimeout(function() {
+ tooltipTimeout = null;
+ hideTooltip();
+ }, 50);
+ });
+
+ editor.on("changeSession", hideTooltip);
+}
+
+function GutterTooltip(parentNode) {
+ Tooltip.call(this, parentNode);
+}
+
+oop.inherits(GutterTooltip, Tooltip);
+
+(function(){
+ this.setPosition = function(x, y) {
+ var windowWidth = window.innerWidth || document.documentElement.clientWidth;
+ var windowHeight = window.innerHeight || document.documentElement.clientHeight;
+ var width = this.getWidth();
+ var height = this.getHeight();
+ x += 15;
+ y += 15;
+ if (x + width > windowWidth) {
+ x -= (x + width) - windowWidth;
+ }
+ if (y + height > windowHeight) {
+ y -= 20 + height;
+ }
+ Tooltip.prototype.setPosition.call(this, x, y);
+ };
+
+}).call(GutterTooltip.prototype);
+
+
+
+exports.GutterHandler = GutterHandler;
+
+});
+
+ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"], function(acequire, exports, module) {
+"use strict";
+
+var event = acequire("../lib/event");
+var useragent = acequire("../lib/useragent");
+var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
+ this.domEvent = domEvent;
+ this.editor = editor;
+
+ this.x = this.clientX = domEvent.clientX;
+ this.y = this.clientY = domEvent.clientY;
+
+ this.$pos = null;
+ this.$inSelection = null;
+
+ this.propagationStopped = false;
+ this.defaultPrevented = false;
+};
+
+(function() {
+
+ this.stopPropagation = function() {
+ event.stopPropagation(this.domEvent);
+ this.propagationStopped = true;
+ };
+
+ this.preventDefault = function() {
+ event.preventDefault(this.domEvent);
+ this.defaultPrevented = true;
+ };
+
+ this.stop = function() {
+ this.stopPropagation();
+ this.preventDefault();
+ };
+ this.getDocumentPosition = function() {
+ if (this.$pos)
+ return this.$pos;
+
+ this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);
+ return this.$pos;
+ };
+ this.inSelection = function() {
+ if (this.$inSelection !== null)
+ return this.$inSelection;
+
+ var editor = this.editor;
+
+
+ var selectionRange = editor.getSelectionRange();
+ if (selectionRange.isEmpty())
+ this.$inSelection = false;
+ else {
+ var pos = this.getDocumentPosition();
+ this.$inSelection = selectionRange.contains(pos.row, pos.column);
+ }
+
+ return this.$inSelection;
+ };
+ this.getButton = function() {
+ return event.getButton(this.domEvent);
+ };
+ this.getShiftKey = function() {
+ return this.domEvent.shiftKey;
+ };
+
+ this.getAccelKey = useragent.isMac
+ ? function() { return this.domEvent.metaKey; }
+ : function() { return this.domEvent.ctrlKey; };
+
+}).call(MouseEvent.prototype);
+
+});
+
+ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"], function(acequire, exports, module) {
+"use strict";
+
+var dom = acequire("../lib/dom");
+var event = acequire("../lib/event");
+var useragent = acequire("../lib/useragent");
+
+var AUTOSCROLL_DELAY = 200;
+var SCROLL_CURSOR_DELAY = 200;
+var SCROLL_CURSOR_HYSTERESIS = 5;
+
+function DragdropHandler(mouseHandler) {
+
+ var editor = mouseHandler.editor;
+
+ var blankImage = dom.createElement("img");
+ blankImage.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
+ if (useragent.isOpera)
+ blankImage.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;";
+
+ var exports = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"];
+
+ exports.forEach(function(x) {
+ mouseHandler[x] = this[x];
+ }, this);
+ editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler));
+
+
+ var mouseTarget = editor.container;
+ var dragSelectionMarker, x, y;
+ var timerId, range;
+ var dragCursor, counter = 0;
+ var dragOperation;
+ var isInternal;
+ var autoScrollStartTime;
+ var cursorMovedTime;
+ var cursorPointOnCaretMoved;
+
+ this.onDragStart = function(e) {
+ if (this.cancelDrag || !mouseTarget.draggable) {
+ var self = this;
+ setTimeout(function(){
+ self.startSelect();
+ self.captureMouse(e);
+ }, 0);
+ return e.preventDefault();
+ }
+ range = editor.getSelectionRange();
+
+ var dataTransfer = e.dataTransfer;
+ dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove";
+ if (useragent.isOpera) {
+ editor.container.appendChild(blankImage);
+ blankImage.scrollTop = 0;
+ }
+ dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0);
+ if (useragent.isOpera) {
+ editor.container.removeChild(blankImage);
+ }
+ dataTransfer.clearData();
+ dataTransfer.setData("Text", editor.session.getTextRange());
+
+ isInternal = true;
+ this.setState("drag");
+ };
+
+ this.onDragEnd = function(e) {
+ mouseTarget.draggable = false;
+ isInternal = false;
+ this.setState(null);
+ if (!editor.getReadOnly()) {
+ var dropEffect = e.dataTransfer.dropEffect;
+ if (!dragOperation && dropEffect == "move")
+ editor.session.remove(editor.getSelectionRange());
+ editor.renderer.$cursorLayer.setBlinking(true);
+ }
+ this.editor.unsetStyle("ace_dragging");
+ this.editor.renderer.setCursorStyle("");
+ };
+
+ this.onDragEnter = function(e) {
+ if (editor.getReadOnly() || !canAccept(e.dataTransfer))
+ return;
+ x = e.clientX;
+ y = e.clientY;
+ if (!dragSelectionMarker)
+ addDragMarker();
+ counter++;
+ e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);
+ return event.preventDefault(e);
+ };
+
+ this.onDragOver = function(e) {
+ if (editor.getReadOnly() || !canAccept(e.dataTransfer))
+ return;
+ x = e.clientX;
+ y = e.clientY;
+ if (!dragSelectionMarker) {
+ addDragMarker();
+ counter++;
+ }
+ if (onMouseMoveTimer !== null)
+ onMouseMoveTimer = null;
+
+ e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);
+ return event.preventDefault(e);
+ };
+
+ this.onDragLeave = function(e) {
+ counter--;
+ if (counter <= 0 && dragSelectionMarker) {
+ clearDragMarker();
+ dragOperation = null;
+ return event.preventDefault(e);
+ }
+ };
+
+ this.onDrop = function(e) {
+ if (!dragCursor)
+ return;
+ var dataTransfer = e.dataTransfer;
+ if (isInternal) {
+ switch (dragOperation) {
+ case "move":
+ if (range.contains(dragCursor.row, dragCursor.column)) {
+ range = {
+ start: dragCursor,
+ end: dragCursor
+ };
+ } else {
+ range = editor.moveText(range, dragCursor);
+ }
+ break;
+ case "copy":
+ range = editor.moveText(range, dragCursor, true);
+ break;
+ }
+ } else {
+ var dropData = dataTransfer.getData('Text');
+ range = {
+ start: dragCursor,
+ end: editor.session.insert(dragCursor, dropData)
+ };
+ editor.focus();
+ dragOperation = null;
+ }
+ clearDragMarker();
+ return event.preventDefault(e);
+ };
+
+ event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler));
+ event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler));
+ event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler));
+ event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler));
+ event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler));
+ event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler));
+
+ function scrollCursorIntoView(cursor, prevCursor) {
+ var now = Date.now();
+ var vMovement = !prevCursor || cursor.row != prevCursor.row;
+ var hMovement = !prevCursor || cursor.column != prevCursor.column;
+ if (!cursorMovedTime || vMovement || hMovement) {
+ editor.$blockScrolling += 1;
+ editor.moveCursorToPosition(cursor);
+ editor.$blockScrolling -= 1;
+ cursorMovedTime = now;
+ cursorPointOnCaretMoved = {x: x, y: y};
+ } else {
+ var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y);
+ if (distance > SCROLL_CURSOR_HYSTERESIS) {
+ cursorMovedTime = null;
+ } else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) {
+ editor.renderer.scrollCursorIntoView();
+ cursorMovedTime = null;
+ }
+ }
+ }
+
+ function autoScroll(cursor, prevCursor) {
+ var now = Date.now();
+ var lineHeight = editor.renderer.layerConfig.lineHeight;
+ var characterWidth = editor.renderer.layerConfig.characterWidth;
+ var editorRect = editor.renderer.scroller.getBoundingClientRect();
+ var offsets = {
+ x: {
+ left: x - editorRect.left,
+ right: editorRect.right - x
+ },
+ y: {
+ top: y - editorRect.top,
+ bottom: editorRect.bottom - y
+ }
+ };
+ var nearestXOffset = Math.min(offsets.x.left, offsets.x.right);
+ var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom);
+ var scrollCursor = {row: cursor.row, column: cursor.column};
+ if (nearestXOffset / characterWidth <= 2) {
+ scrollCursor.column += (offsets.x.left < offsets.x.right ? -3 : +2);
+ }
+ if (nearestYOffset / lineHeight <= 1) {
+ scrollCursor.row += (offsets.y.top < offsets.y.bottom ? -1 : +1);
+ }
+ var vScroll = cursor.row != scrollCursor.row;
+ var hScroll = cursor.column != scrollCursor.column;
+ var vMovement = !prevCursor || cursor.row != prevCursor.row;
+ if (vScroll || (hScroll && !vMovement)) {
+ if (!autoScrollStartTime)
+ autoScrollStartTime = now;
+ else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY)
+ editor.renderer.scrollCursorIntoView(scrollCursor);
+ } else {
+ autoScrollStartTime = null;
+ }
+ }
+
+ function onDragInterval() {
+ var prevCursor = dragCursor;
+ dragCursor = editor.renderer.screenToTextCoordinates(x, y);
+ scrollCursorIntoView(dragCursor, prevCursor);
+ autoScroll(dragCursor, prevCursor);
+ }
+
+ function addDragMarker() {
+ range = editor.selection.toOrientedRange();
+ dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle());
+ editor.clearSelection();
+ if (editor.isFocused())
+ editor.renderer.$cursorLayer.setBlinking(false);
+ clearInterval(timerId);
+ onDragInterval();
+ timerId = setInterval(onDragInterval, 20);
+ counter = 0;
+ event.addListener(document, "mousemove", onMouseMove);
+ }
+
+ function clearDragMarker() {
+ clearInterval(timerId);
+ editor.session.removeMarker(dragSelectionMarker);
+ dragSelectionMarker = null;
+ editor.$blockScrolling += 1;
+ editor.selection.fromOrientedRange(range);
+ editor.$blockScrolling -= 1;
+ if (editor.isFocused() && !isInternal)
+ editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());
+ range = null;
+ dragCursor = null;
+ counter = 0;
+ autoScrollStartTime = null;
+ cursorMovedTime = null;
+ event.removeListener(document, "mousemove", onMouseMove);
+ }
+ var onMouseMoveTimer = null;
+ function onMouseMove() {
+ if (onMouseMoveTimer == null) {
+ onMouseMoveTimer = setTimeout(function() {
+ if (onMouseMoveTimer != null && dragSelectionMarker)
+ clearDragMarker();
+ }, 20);
+ }
+ }
+
+ function canAccept(dataTransfer) {
+ var types = dataTransfer.types;
+ return !types || Array.prototype.some.call(types, function(type) {
+ return type == 'text/plain' || type == 'Text';
+ });
+ }
+
+ function getDropEffect(e) {
+ var copyAllowed = ['copy', 'copymove', 'all', 'uninitialized'];
+ var moveAllowed = ['move', 'copymove', 'linkmove', 'all', 'uninitialized'];
+
+ var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey;
+ var effectAllowed = "uninitialized";
+ try {
+ effectAllowed = e.dataTransfer.effectAllowed.toLowerCase();
+ } catch (e) {}
+ var dropEffect = "none";
+
+ if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0)
+ dropEffect = "copy";
+ else if (moveAllowed.indexOf(effectAllowed) >= 0)
+ dropEffect = "move";
+ else if (copyAllowed.indexOf(effectAllowed) >= 0)
+ dropEffect = "copy";
+
+ return dropEffect;
+ }
+}
+
+(function() {
+
+ this.dragWait = function() {
+ var interval = Date.now() - this.mousedownEvent.time;
+ if (interval > this.editor.getDragDelay())
+ this.startDrag();
+ };
+
+ this.dragWaitEnd = function() {
+ var target = this.editor.container;
+ target.draggable = false;
+ this.startSelect(this.mousedownEvent.getDocumentPosition());
+ this.selectEnd();
+ };
+
+ this.dragReadyEnd = function(e) {
+ this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
+ this.editor.unsetStyle("ace_dragging");
+ this.editor.renderer.setCursorStyle("");
+ this.dragWaitEnd();
+ };
+
+ this.startDrag = function(){
+ this.cancelDrag = false;
+ var editor = this.editor;
+ var target = editor.container;
+ target.draggable = true;
+ editor.renderer.$cursorLayer.setBlinking(false);
+ editor.setStyle("ace_dragging");
+ var cursorStyle = useragent.isWin ? "default" : "move";
+ editor.renderer.setCursorStyle(cursorStyle);
+ this.setState("dragReady");
+ };
+
+ this.onMouseDrag = function(e) {
+ var target = this.editor.container;
+ if (useragent.isIE && this.state == "dragReady") {
+ var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
+ if (distance > 3)
+ target.dragDrop();
+ }
+ if (this.state === "dragWait") {
+ var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
+ if (distance > 0) {
+ target.draggable = false;
+ this.startSelect(this.mousedownEvent.getDocumentPosition());
+ }
+ }
+ };
+
+ this.onMouseDown = function(e) {
+ if (!this.$dragEnabled)
+ return;
+ this.mousedownEvent = e;
+ var editor = this.editor;
+
+ var inSelection = e.inSelection();
+ var button = e.getButton();
+ var clickCount = e.domEvent.detail || 1;
+ if (clickCount === 1 && button === 0 && inSelection) {
+ if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey()))
+ return;
+ this.mousedownEvent.time = Date.now();
+ var eventTarget = e.domEvent.target || e.domEvent.srcElement;
+ if ("unselectable" in eventTarget)
+ eventTarget.unselectable = "on";
+ if (editor.getDragDelay()) {
+ if (useragent.isWebKit) {
+ this.cancelDrag = true;
+ var mouseTarget = editor.container;
+ mouseTarget.draggable = true;
+ }
+ this.setState("dragWait");
+ } else {
+ this.startDrag();
+ }
+ this.captureMouse(e, this.onMouseDrag.bind(this));
+ e.defaultPrevented = true;
+ }
+ };
+
+}).call(DragdropHandler.prototype);
+
+
+function calcDistance(ax, ay, bx, by) {
+ return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
+}
+
+exports.DragdropHandler = DragdropHandler;
+
+});
+
+ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
+"use strict";
+var dom = acequire("./dom");
+
+exports.get = function (url, callback) {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', url, true);
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === 4) {
+ callback(xhr.responseText);
+ }
+ };
+ xhr.send(null);
+};
+
+exports.loadScript = function(path, callback) {
+ var head = dom.getDocumentHead();
+ var s = document.createElement('script');
+
+ s.src = path;
+ head.appendChild(s);
+
+ s.onload = s.onreadystatechange = function(_, isAbort) {
+ if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
+ s = s.onload = s.onreadystatechange = null;
+ if (!isAbort)
+ callback();
+ }
+ };
+};
+exports.qualifyURL = function(url) {
+ var a = document.createElement('a');
+ a.href = url;
+ return a.href;
+}
+
+});
+
+ace.define("ace/lib/event_emitter",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+var EventEmitter = {};
+var stopPropagation = function() { this.propagationStopped = true; };
+var preventDefault = function() { this.defaultPrevented = true; };
+
+EventEmitter._emit =
+EventEmitter._dispatchEvent = function(eventName, e) {
+ this._eventRegistry || (this._eventRegistry = {});
+ this._defaultHandlers || (this._defaultHandlers = {});
+
+ var listeners = this._eventRegistry[eventName] || [];
+ var defaultHandler = this._defaultHandlers[eventName];
+ if (!listeners.length && !defaultHandler)
+ return;
+
+ if (typeof e != "object" || !e)
+ e = {};
+
+ if (!e.type)
+ e.type = eventName;
+ if (!e.stopPropagation)
+ e.stopPropagation = stopPropagation;
+ if (!e.preventDefault)
+ e.preventDefault = preventDefault;
+
+ listeners = listeners.slice();
+ for (var i=0; i 1)
+ base = parts[parts.length - 2];
+ var path = options[component + "Path"];
+ if (path == null) {
+ path = options.basePath;
+ } else if (sep == "/") {
+ component = sep = "";
+ }
+ if (path && path.slice(-1) != "/")
+ path += "/";
+ return path + component + sep + base + this.get("suffix");
+};
+
+exports.setModuleUrl = function(name, subst) {
+ return options.$moduleUrls[name] = subst;
+};
+
+exports.$loading = {};
+exports.loadModule = function(moduleName, onLoad) {
+ var module, moduleType;
+ if (Array.isArray(moduleName)) {
+ moduleType = moduleName[0];
+ moduleName = moduleName[1];
+ }
+
+ try {
+ module = acequire(moduleName);
+ } catch (e) {}
+ if (module && !exports.$loading[moduleName])
+ return onLoad && onLoad(module);
+
+ if (!exports.$loading[moduleName])
+ exports.$loading[moduleName] = [];
+
+ exports.$loading[moduleName].push(onLoad);
+
+ if (exports.$loading[moduleName].length > 1)
+ return;
+
+ var afterLoad = function() {
+ acequire([moduleName], function(module) {
+ exports._emit("load.module", {name: moduleName, module: module});
+ var listeners = exports.$loading[moduleName];
+ exports.$loading[moduleName] = null;
+ listeners.forEach(function(onLoad) {
+ onLoad && onLoad(module);
+ });
+ });
+ };
+
+ if (!exports.get("packaged"))
+ return afterLoad();
+ net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);
+};
+init(true);function init(packaged) {
+
+ if (!global || !global.document)
+ return;
+
+ options.packaged = packaged || acequire.packaged || module.packaged || (global.define && define.packaged);
+
+ var scriptOptions = {};
+ var scriptUrl = "";
+ var currentScript = (document.currentScript || document._currentScript ); // native or polyfill
+ var currentDocument = currentScript && currentScript.ownerDocument || document;
+
+ var scripts = currentDocument.getElementsByTagName("script");
+ for (var i=0; i [" + this.end.row + "/" + this.end.column + "]");
+ };
+
+ this.contains = function(row, column) {
+ return this.compare(row, column) == 0;
+ };
+ this.compareRange = function(range) {
+ var cmp,
+ end = range.end,
+ start = range.start;
+
+ cmp = this.compare(end.row, end.column);
+ if (cmp == 1) {
+ cmp = this.compare(start.row, start.column);
+ if (cmp == 1) {
+ return 2;
+ } else if (cmp == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+ } else if (cmp == -1) {
+ return -2;
+ } else {
+ cmp = this.compare(start.row, start.column);
+ if (cmp == -1) {
+ return -1;
+ } else if (cmp == 1) {
+ return 42;
+ } else {
+ return 0;
+ }
+ }
+ };
+ this.comparePoint = function(p) {
+ return this.compare(p.row, p.column);
+ };
+ this.containsRange = function(range) {
+ return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
+ };
+ this.intersects = function(range) {
+ var cmp = this.compareRange(range);
+ return (cmp == -1 || cmp == 0 || cmp == 1);
+ };
+ this.isEnd = function(row, column) {
+ return this.end.row == row && this.end.column == column;
+ };
+ this.isStart = function(row, column) {
+ return this.start.row == row && this.start.column == column;
+ };
+ this.setStart = function(row, column) {
+ if (typeof row == "object") {
+ this.start.column = row.column;
+ this.start.row = row.row;
+ } else {
+ this.start.row = row;
+ this.start.column = column;
+ }
+ };
+ this.setEnd = function(row, column) {
+ if (typeof row == "object") {
+ this.end.column = row.column;
+ this.end.row = row.row;
+ } else {
+ this.end.row = row;
+ this.end.column = column;
+ }
+ };
+ this.inside = function(row, column) {
+ if (this.compare(row, column) == 0) {
+ if (this.isEnd(row, column) || this.isStart(row, column)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ };
+ this.insideStart = function(row, column) {
+ if (this.compare(row, column) == 0) {
+ if (this.isEnd(row, column)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ };
+ this.insideEnd = function(row, column) {
+ if (this.compare(row, column) == 0) {
+ if (this.isStart(row, column)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ };
+ this.compare = function(row, column) {
+ if (!this.isMultiLine()) {
+ if (row === this.start.row) {
+ return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
+ }
+ }
+
+ if (row < this.start.row)
+ return -1;
+
+ if (row > this.end.row)
+ return 1;
+
+ if (this.start.row === row)
+ return column >= this.start.column ? 0 : -1;
+
+ if (this.end.row === row)
+ return column <= this.end.column ? 0 : 1;
+
+ return 0;
+ };
+ this.compareStart = function(row, column) {
+ if (this.start.row == row && this.start.column == column) {
+ return -1;
+ } else {
+ return this.compare(row, column);
+ }
+ };
+ this.compareEnd = function(row, column) {
+ if (this.end.row == row && this.end.column == column) {
+ return 1;
+ } else {
+ return this.compare(row, column);
+ }
+ };
+ this.compareInside = function(row, column) {
+ if (this.end.row == row && this.end.column == column) {
+ return 1;
+ } else if (this.start.row == row && this.start.column == column) {
+ return -1;
+ } else {
+ return this.compare(row, column);
+ }
+ };
+ this.clipRows = function(firstRow, lastRow) {
+ if (this.end.row > lastRow)
+ var end = {row: lastRow + 1, column: 0};
+ else if (this.end.row < firstRow)
+ var end = {row: firstRow, column: 0};
+
+ if (this.start.row > lastRow)
+ var start = {row: lastRow + 1, column: 0};
+ else if (this.start.row < firstRow)
+ var start = {row: firstRow, column: 0};
+
+ return Range.fromPoints(start || this.start, end || this.end);
+ };
+ this.extend = function(row, column) {
+ var cmp = this.compare(row, column);
+
+ if (cmp == 0)
+ return this;
+ else if (cmp == -1)
+ var start = {row: row, column: column};
+ else
+ var end = {row: row, column: column};
+
+ return Range.fromPoints(start || this.start, end || this.end);
+ };
+
+ this.isEmpty = function() {
+ return (this.start.row === this.end.row && this.start.column === this.end.column);
+ };
+ this.isMultiLine = function() {
+ return (this.start.row !== this.end.row);
+ };
+ this.clone = function() {
+ return Range.fromPoints(this.start, this.end);
+ };
+ this.collapseRows = function() {
+ if (this.end.column == 0)
+ return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
+ else
+ return new Range(this.start.row, 0, this.end.row, 0)
+ };
+ this.toScreenRange = function(session) {
+ var screenPosStart = session.documentToScreenPosition(this.start);
+ var screenPosEnd = session.documentToScreenPosition(this.end);
+
+ return new Range(
+ screenPosStart.row, screenPosStart.column,
+ screenPosEnd.row, screenPosEnd.column
+ );
+ };
+ this.moveBy = function(row, column) {
+ this.start.row += row;
+ this.start.column += column;
+ this.end.row += row;
+ this.end.column += column;
+ };
+
+}).call(Range.prototype);
+Range.fromPoints = function(start, end) {
+ return new Range(start.row, start.column, end.row, end.column);
+};
+Range.comparePoints = comparePoints;
+
+Range.comparePoints = function(p1, p2) {
+ return p1.row - p2.row || p1.column - p2.column;
+};
+
+
+exports.Range = Range;
+});
+
+ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var lang = acequire("./lib/lang");
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var Range = acequire("./range").Range;
+var Selection = function(session) {
+ this.session = session;
+ this.doc = session.getDocument();
+
+ this.clearSelection();
+ this.lead = this.selectionLead = this.doc.createAnchor(0, 0);
+ this.anchor = this.selectionAnchor = this.doc.createAnchor(0, 0);
+
+ var self = this;
+ this.lead.on("change", function(e) {
+ self._emit("changeCursor");
+ if (!self.$isEmpty)
+ self._emit("changeSelection");
+ if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column)
+ self.$desiredColumn = null;
+ });
+
+ this.selectionAnchor.on("change", function() {
+ if (!self.$isEmpty)
+ self._emit("changeSelection");
+ });
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+ this.isEmpty = function() {
+ return (this.$isEmpty || (
+ this.anchor.row == this.lead.row &&
+ this.anchor.column == this.lead.column
+ ));
+ };
+ this.isMultiLine = function() {
+ if (this.isEmpty()) {
+ return false;
+ }
+
+ return this.getRange().isMultiLine();
+ };
+ this.getCursor = function() {
+ return this.lead.getPosition();
+ };
+ this.setSelectionAnchor = function(row, column) {
+ this.anchor.setPosition(row, column);
+
+ if (this.$isEmpty) {
+ this.$isEmpty = false;
+ this._emit("changeSelection");
+ }
+ };
+ this.getSelectionAnchor = function() {
+ if (this.$isEmpty)
+ return this.getSelectionLead();
+ else
+ return this.anchor.getPosition();
+ };
+ this.getSelectionLead = function() {
+ return this.lead.getPosition();
+ };
+ this.shiftSelection = function(columns) {
+ if (this.$isEmpty) {
+ this.moveCursorTo(this.lead.row, this.lead.column + columns);
+ return;
+ }
+
+ var anchor = this.getSelectionAnchor();
+ var lead = this.getSelectionLead();
+
+ var isBackwards = this.isBackwards();
+
+ if (!isBackwards || anchor.column !== 0)
+ this.setSelectionAnchor(anchor.row, anchor.column + columns);
+
+ if (isBackwards || lead.column !== 0) {
+ this.$moveSelection(function() {
+ this.moveCursorTo(lead.row, lead.column + columns);
+ });
+ }
+ };
+ this.isBackwards = function() {
+ var anchor = this.anchor;
+ var lead = this.lead;
+ return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
+ };
+ this.getRange = function() {
+ var anchor = this.anchor;
+ var lead = this.lead;
+
+ if (this.isEmpty())
+ return Range.fromPoints(lead, lead);
+
+ if (this.isBackwards()) {
+ return Range.fromPoints(lead, anchor);
+ }
+ else {
+ return Range.fromPoints(anchor, lead);
+ }
+ };
+ this.clearSelection = function() {
+ if (!this.$isEmpty) {
+ this.$isEmpty = true;
+ this._emit("changeSelection");
+ }
+ };
+ this.selectAll = function() {
+ var lastRow = this.doc.getLength() - 1;
+ this.setSelectionAnchor(0, 0);
+ this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
+ };
+ this.setRange =
+ this.setSelectionRange = function(range, reverse) {
+ if (reverse) {
+ this.setSelectionAnchor(range.end.row, range.end.column);
+ this.selectTo(range.start.row, range.start.column);
+ } else {
+ this.setSelectionAnchor(range.start.row, range.start.column);
+ this.selectTo(range.end.row, range.end.column);
+ }
+ if (this.getRange().isEmpty())
+ this.$isEmpty = true;
+ this.$desiredColumn = null;
+ };
+
+ this.$moveSelection = function(mover) {
+ var lead = this.lead;
+ if (this.$isEmpty)
+ this.setSelectionAnchor(lead.row, lead.column);
+
+ mover.call(this);
+ };
+ this.selectTo = function(row, column) {
+ this.$moveSelection(function() {
+ this.moveCursorTo(row, column);
+ });
+ };
+ this.selectToPosition = function(pos) {
+ this.$moveSelection(function() {
+ this.moveCursorToPosition(pos);
+ });
+ };
+ this.moveTo = function(row, column) {
+ this.clearSelection();
+ this.moveCursorTo(row, column);
+ };
+ this.moveToPosition = function(pos) {
+ this.clearSelection();
+ this.moveCursorToPosition(pos);
+ };
+ this.selectUp = function() {
+ this.$moveSelection(this.moveCursorUp);
+ };
+ this.selectDown = function() {
+ this.$moveSelection(this.moveCursorDown);
+ };
+ this.selectRight = function() {
+ this.$moveSelection(this.moveCursorRight);
+ };
+ this.selectLeft = function() {
+ this.$moveSelection(this.moveCursorLeft);
+ };
+ this.selectLineStart = function() {
+ this.$moveSelection(this.moveCursorLineStart);
+ };
+ this.selectLineEnd = function() {
+ this.$moveSelection(this.moveCursorLineEnd);
+ };
+ this.selectFileEnd = function() {
+ this.$moveSelection(this.moveCursorFileEnd);
+ };
+ this.selectFileStart = function() {
+ this.$moveSelection(this.moveCursorFileStart);
+ };
+ this.selectWordRight = function() {
+ this.$moveSelection(this.moveCursorWordRight);
+ };
+ this.selectWordLeft = function() {
+ this.$moveSelection(this.moveCursorWordLeft);
+ };
+ this.getWordRange = function(row, column) {
+ if (typeof column == "undefined") {
+ var cursor = row || this.lead;
+ row = cursor.row;
+ column = cursor.column;
+ }
+ return this.session.getWordRange(row, column);
+ };
+ this.selectWord = function() {
+ this.setSelectionRange(this.getWordRange());
+ };
+ this.selectAWord = function() {
+ var cursor = this.getCursor();
+ var range = this.session.getAWordRange(cursor.row, cursor.column);
+ this.setSelectionRange(range);
+ };
+
+ this.getLineRange = function(row, excludeLastChar) {
+ var rowStart = typeof row == "number" ? row : this.lead.row;
+ var rowEnd;
+
+ var foldLine = this.session.getFoldLine(rowStart);
+ if (foldLine) {
+ rowStart = foldLine.start.row;
+ rowEnd = foldLine.end.row;
+ } else {
+ rowEnd = rowStart;
+ }
+ if (excludeLastChar === true)
+ return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);
+ else
+ return new Range(rowStart, 0, rowEnd + 1, 0);
+ };
+ this.selectLine = function() {
+ this.setSelectionRange(this.getLineRange());
+ };
+ this.moveCursorUp = function() {
+ this.moveCursorBy(-1, 0);
+ };
+ this.moveCursorDown = function() {
+ this.moveCursorBy(1, 0);
+ };
+ this.moveCursorLeft = function() {
+ var cursor = this.lead.getPosition(),
+ fold;
+
+ if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
+ this.moveCursorTo(fold.start.row, fold.start.column);
+ } else if (cursor.column === 0) {
+ if (cursor.row > 0) {
+ this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
+ }
+ }
+ else {
+ var tabSize = this.session.getTabSize();
+ if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
+ this.moveCursorBy(0, -tabSize);
+ else
+ this.moveCursorBy(0, -1);
+ }
+ };
+ this.moveCursorRight = function() {
+ var cursor = this.lead.getPosition(),
+ fold;
+ if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
+ this.moveCursorTo(fold.end.row, fold.end.column);
+ }
+ else if (this.lead.column == this.doc.getLine(this.lead.row).length) {
+ if (this.lead.row < this.doc.getLength() - 1) {
+ this.moveCursorTo(this.lead.row + 1, 0);
+ }
+ }
+ else {
+ var tabSize = this.session.getTabSize();
+ var cursor = this.lead;
+ if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
+ this.moveCursorBy(0, tabSize);
+ else
+ this.moveCursorBy(0, 1);
+ }
+ };
+ this.moveCursorLineStart = function() {
+ var row = this.lead.row;
+ var column = this.lead.column;
+ var screenRow = this.session.documentToScreenRow(row, column);
+ var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
+ var beforeCursor = this.session.getDisplayLine(
+ row, null, firstColumnPosition.row,
+ firstColumnPosition.column
+ );
+
+ var leadingSpace = beforeCursor.match(/^\s*/);
+ if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart)
+ firstColumnPosition.column += leadingSpace[0].length;
+ this.moveCursorToPosition(firstColumnPosition);
+ };
+ this.moveCursorLineEnd = function() {
+ var lead = this.lead;
+ var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
+ if (this.lead.column == lineEnd.column) {
+ var line = this.session.getLine(lineEnd.row);
+ if (lineEnd.column == line.length) {
+ var textEnd = line.search(/\s+$/);
+ if (textEnd > 0)
+ lineEnd.column = textEnd;
+ }
+ }
+
+ this.moveCursorTo(lineEnd.row, lineEnd.column);
+ };
+ this.moveCursorFileEnd = function() {
+ var row = this.doc.getLength() - 1;
+ var column = this.doc.getLine(row).length;
+ this.moveCursorTo(row, column);
+ };
+ this.moveCursorFileStart = function() {
+ this.moveCursorTo(0, 0);
+ };
+ this.moveCursorLongWordRight = function() {
+ var row = this.lead.row;
+ var column = this.lead.column;
+ var line = this.doc.getLine(row);
+ var rightOfCursor = line.substring(column);
+
+ var match;
+ this.session.nonTokenRe.lastIndex = 0;
+ this.session.tokenRe.lastIndex = 0;
+ var fold = this.session.getFoldAt(row, column, 1);
+ if (fold) {
+ this.moveCursorTo(fold.end.row, fold.end.column);
+ return;
+ }
+ if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
+ column += this.session.nonTokenRe.lastIndex;
+ this.session.nonTokenRe.lastIndex = 0;
+ rightOfCursor = line.substring(column);
+ }
+ if (column >= line.length) {
+ this.moveCursorTo(row, line.length);
+ this.moveCursorRight();
+ if (row < this.doc.getLength() - 1)
+ this.moveCursorWordRight();
+ return;
+ }
+ if (match = this.session.tokenRe.exec(rightOfCursor)) {
+ column += this.session.tokenRe.lastIndex;
+ this.session.tokenRe.lastIndex = 0;
+ }
+
+ this.moveCursorTo(row, column);
+ };
+ this.moveCursorLongWordLeft = function() {
+ var row = this.lead.row;
+ var column = this.lead.column;
+ var fold;
+ if (fold = this.session.getFoldAt(row, column, -1)) {
+ this.moveCursorTo(fold.start.row, fold.start.column);
+ return;
+ }
+
+ var str = this.session.getFoldStringAt(row, column, -1);
+ if (str == null) {
+ str = this.doc.getLine(row).substring(0, column);
+ }
+
+ var leftOfCursor = lang.stringReverse(str);
+ var match;
+ this.session.nonTokenRe.lastIndex = 0;
+ this.session.tokenRe.lastIndex = 0;
+ if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
+ column -= this.session.nonTokenRe.lastIndex;
+ leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
+ this.session.nonTokenRe.lastIndex = 0;
+ }
+ if (column <= 0) {
+ this.moveCursorTo(row, 0);
+ this.moveCursorLeft();
+ if (row > 0)
+ this.moveCursorWordLeft();
+ return;
+ }
+ if (match = this.session.tokenRe.exec(leftOfCursor)) {
+ column -= this.session.tokenRe.lastIndex;
+ this.session.tokenRe.lastIndex = 0;
+ }
+
+ this.moveCursorTo(row, column);
+ };
+
+ this.$shortWordEndIndex = function(rightOfCursor) {
+ var match, index = 0, ch;
+ var whitespaceRe = /\s/;
+ var tokenRe = this.session.tokenRe;
+
+ tokenRe.lastIndex = 0;
+ if (match = this.session.tokenRe.exec(rightOfCursor)) {
+ index = this.session.tokenRe.lastIndex;
+ } else {
+ while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
+ index ++;
+
+ if (index < 1) {
+ tokenRe.lastIndex = 0;
+ while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) {
+ tokenRe.lastIndex = 0;
+ index ++;
+ if (whitespaceRe.test(ch)) {
+ if (index > 2) {
+ index--;
+ break;
+ } else {
+ while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
+ index ++;
+ if (index > 2)
+ break;
+ }
+ }
+ }
+ }
+ }
+ tokenRe.lastIndex = 0;
+
+ return index;
+ };
+
+ this.moveCursorShortWordRight = function() {
+ var row = this.lead.row;
+ var column = this.lead.column;
+ var line = this.doc.getLine(row);
+ var rightOfCursor = line.substring(column);
+
+ var fold = this.session.getFoldAt(row, column, 1);
+ if (fold)
+ return this.moveCursorTo(fold.end.row, fold.end.column);
+
+ if (column == line.length) {
+ var l = this.doc.getLength();
+ do {
+ row++;
+ rightOfCursor = this.doc.getLine(row);
+ } while (row < l && /^\s*$/.test(rightOfCursor));
+
+ if (!/^\s+/.test(rightOfCursor))
+ rightOfCursor = "";
+ column = 0;
+ }
+
+ var index = this.$shortWordEndIndex(rightOfCursor);
+
+ this.moveCursorTo(row, column + index);
+ };
+
+ this.moveCursorShortWordLeft = function() {
+ var row = this.lead.row;
+ var column = this.lead.column;
+
+ var fold;
+ if (fold = this.session.getFoldAt(row, column, -1))
+ return this.moveCursorTo(fold.start.row, fold.start.column);
+
+ var line = this.session.getLine(row).substring(0, column);
+ if (column === 0) {
+ do {
+ row--;
+ line = this.doc.getLine(row);
+ } while (row > 0 && /^\s*$/.test(line));
+
+ column = line.length;
+ if (!/\s+$/.test(line))
+ line = "";
+ }
+
+ var leftOfCursor = lang.stringReverse(line);
+ var index = this.$shortWordEndIndex(leftOfCursor);
+
+ return this.moveCursorTo(row, column - index);
+ };
+
+ this.moveCursorWordRight = function() {
+ if (this.session.$selectLongWords)
+ this.moveCursorLongWordRight();
+ else
+ this.moveCursorShortWordRight();
+ };
+
+ this.moveCursorWordLeft = function() {
+ if (this.session.$selectLongWords)
+ this.moveCursorLongWordLeft();
+ else
+ this.moveCursorShortWordLeft();
+ };
+ this.moveCursorBy = function(rows, chars) {
+ var screenPos = this.session.documentToScreenPosition(
+ this.lead.row,
+ this.lead.column
+ );
+
+ if (chars === 0) {
+ if (this.$desiredColumn)
+ screenPos.column = this.$desiredColumn;
+ else
+ this.$desiredColumn = screenPos.column;
+ }
+
+ var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
+
+ if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
+ if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {
+ if (docPos.row > 0 || rows > 0)
+ docPos.row++;
+ }
+ }
+ this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
+ };
+ this.moveCursorToPosition = function(position) {
+ this.moveCursorTo(position.row, position.column);
+ };
+ this.moveCursorTo = function(row, column, keepDesiredColumn) {
+ var fold = this.session.getFoldAt(row, column, 1);
+ if (fold) {
+ row = fold.start.row;
+ column = fold.start.column;
+ }
+
+ this.$keepDesiredColumnOnChange = true;
+ this.lead.setPosition(row, column);
+ this.$keepDesiredColumnOnChange = false;
+
+ if (!keepDesiredColumn)
+ this.$desiredColumn = null;
+ };
+ this.moveCursorToScreen = function(row, column, keepDesiredColumn) {
+ var pos = this.session.screenToDocumentPosition(row, column);
+ this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);
+ };
+ this.detach = function() {
+ this.lead.detach();
+ this.anchor.detach();
+ this.session = this.doc = null;
+ };
+
+ this.fromOrientedRange = function(range) {
+ this.setSelectionRange(range, range.cursor == range.start);
+ this.$desiredColumn = range.desiredColumn || this.$desiredColumn;
+ };
+
+ this.toOrientedRange = function(range) {
+ var r = this.getRange();
+ if (range) {
+ range.start.column = r.start.column;
+ range.start.row = r.start.row;
+ range.end.column = r.end.column;
+ range.end.row = r.end.row;
+ } else {
+ range = r;
+ }
+
+ range.cursor = this.isBackwards() ? range.start : range.end;
+ range.desiredColumn = this.$desiredColumn;
+ return range;
+ };
+ this.getRangeOfMovements = function(func) {
+ var start = this.getCursor();
+ try {
+ func(this);
+ var end = this.getCursor();
+ return Range.fromPoints(start,end);
+ } catch(e) {
+ return Range.fromPoints(start,start);
+ } finally {
+ this.moveCursorToPosition(start);
+ }
+ };
+
+ this.toJSON = function() {
+ if (this.rangeCount) {
+ var data = this.ranges.map(function(r) {
+ var r1 = r.clone();
+ r1.isBackwards = r.cursor == r.start;
+ return r1;
+ });
+ } else {
+ var data = this.getRange();
+ data.isBackwards = this.isBackwards();
+ }
+ return data;
+ };
+
+ this.fromJSON = function(data) {
+ if (data.start == undefined) {
+ if (this.rangeList) {
+ this.toSingleRange(data[0]);
+ for (var i = data.length; i--; ) {
+ var r = Range.fromPoints(data[i].start, data[i].end);
+ if (data[i].isBackwards)
+ r.cursor = r.start;
+ this.addRange(r, true);
+ }
+ return;
+ } else
+ data = data[0];
+ }
+ if (this.rangeList)
+ this.toSingleRange(data);
+ this.setSelectionRange(data, data.isBackwards);
+ };
+
+ this.isEqual = function(data) {
+ if ((data.length || this.rangeCount) && data.length != this.rangeCount)
+ return false;
+ if (!data.length || !this.ranges)
+ return this.getRange().isEqual(data);
+
+ for (var i = this.ranges.length; i--; ) {
+ if (!this.ranges[i].isEqual(data[i]))
+ return false;
+ }
+ return true;
+ };
+
+}).call(Selection.prototype);
+
+exports.Selection = Selection;
+});
+
+ace.define("ace/tokenizer",["require","exports","module","ace/config"], function(acequire, exports, module) {
+"use strict";
+
+var config = acequire("./config");
+var MAX_TOKEN_COUNT = 2000;
+var Tokenizer = function(rules) {
+ this.states = rules;
+
+ this.regExps = {};
+ this.matchMappings = {};
+ for (var key in this.states) {
+ var state = this.states[key];
+ var ruleRegExps = [];
+ var matchTotal = 0;
+ var mapping = this.matchMappings[key] = {defaultToken: "text"};
+ var flag = "g";
+
+ var splitterRurles = [];
+ for (var i = 0; i < state.length; i++) {
+ var rule = state[i];
+ if (rule.defaultToken)
+ mapping.defaultToken = rule.defaultToken;
+ if (rule.caseInsensitive)
+ flag = "gi";
+ if (rule.regex == null)
+ continue;
+
+ if (rule.regex instanceof RegExp)
+ rule.regex = rule.regex.toString().slice(1, -1);
+ var adjustedregex = rule.regex;
+ var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2;
+ if (Array.isArray(rule.token)) {
+ if (rule.token.length == 1 || matchcount == 1) {
+ rule.token = rule.token[0];
+ } else if (matchcount - 1 != rule.token.length) {
+ this.reportError("number of classes and regexp groups doesn't match", {
+ rule: rule,
+ groupCount: matchcount - 1
+ });
+ rule.token = rule.token[0];
+ } else {
+ rule.tokenArray = rule.token;
+ rule.token = null;
+ rule.onMatch = this.$arrayTokens;
+ }
+ } else if (typeof rule.token == "function" && !rule.onMatch) {
+ if (matchcount > 1)
+ rule.onMatch = this.$applyToken;
+ else
+ rule.onMatch = rule.token;
+ }
+
+ if (matchcount > 1) {
+ if (/\\\d/.test(rule.regex)) {
+ adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match, digit) {
+ return "\\" + (parseInt(digit, 10) + matchTotal + 1);
+ });
+ } else {
+ matchcount = 1;
+ adjustedregex = this.removeCapturingGroups(rule.regex);
+ }
+ if (!rule.splitRegex && typeof rule.token != "string")
+ splitterRurles.push(rule); // flag will be known only at the very end
+ }
+
+ mapping[matchTotal] = i;
+ matchTotal += matchcount;
+
+ ruleRegExps.push(adjustedregex);
+ if (!rule.onMatch)
+ rule.onMatch = null;
+ }
+
+ if (!ruleRegExps.length) {
+ mapping[0] = 0;
+ ruleRegExps.push("$");
+ }
+
+ splitterRurles.forEach(function(rule) {
+ rule.splitRegex = this.createSplitterRegexp(rule.regex, flag);
+ }, this);
+
+ this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag);
+ }
+};
+
+(function() {
+ this.$setMaxTokenCount = function(m) {
+ MAX_TOKEN_COUNT = m | 0;
+ };
+
+ this.$applyToken = function(str) {
+ var values = this.splitRegex.exec(str).slice(1);
+ var types = this.token.apply(this, values);
+ if (typeof types === "string")
+ return [{type: types, value: str}];
+
+ var tokens = [];
+ for (var i = 0, l = types.length; i < l; i++) {
+ if (values[i])
+ tokens[tokens.length] = {
+ type: types[i],
+ value: values[i]
+ };
+ }
+ return tokens;
+ };
+
+ this.$arrayTokens = function(str) {
+ if (!str)
+ return [];
+ var values = this.splitRegex.exec(str);
+ if (!values)
+ return "text";
+ var tokens = [];
+ var types = this.tokenArray;
+ for (var i = 0, l = types.length; i < l; i++) {
+ if (values[i + 1])
+ tokens[tokens.length] = {
+ type: types[i],
+ value: values[i + 1]
+ };
+ }
+ return tokens;
+ };
+
+ this.removeCapturingGroups = function(src) {
+ var r = src.replace(
+ /\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,
+ function(x, y) {return y ? "(?:" : x;}
+ );
+ return r;
+ };
+
+ this.createSplitterRegexp = function(src, flag) {
+ if (src.indexOf("(?=") != -1) {
+ var stack = 0;
+ var inChClass = false;
+ var lastCapture = {};
+ src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(
+ m, esc, parenOpen, parenClose, square, index
+ ) {
+ if (inChClass) {
+ inChClass = square != "]";
+ } else if (square) {
+ inChClass = true;
+ } else if (parenClose) {
+ if (stack == lastCapture.stack) {
+ lastCapture.end = index+1;
+ lastCapture.stack = -1;
+ }
+ stack--;
+ } else if (parenOpen) {
+ stack++;
+ if (parenOpen.length != 1) {
+ lastCapture.stack = stack
+ lastCapture.start = index;
+ }
+ }
+ return m;
+ });
+
+ if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end)))
+ src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);
+ }
+ if (src.charAt(0) != "^") src = "^" + src;
+ if (src.charAt(src.length - 1) != "$") src += "$";
+
+ return new RegExp(src, (flag||"").replace("g", ""));
+ };
+ this.getLineTokens = function(line, startState) {
+ if (startState && typeof startState != "string") {
+ var stack = startState.slice(0);
+ startState = stack[0];
+ if (startState === "#tmp") {
+ stack.shift()
+ startState = stack.shift()
+ }
+ } else
+ var stack = [];
+
+ var currentState = startState || "start";
+ var state = this.states[currentState];
+ if (!state) {
+ currentState = "start";
+ state = this.states[currentState];
+ }
+ var mapping = this.matchMappings[currentState];
+ var re = this.regExps[currentState];
+ re.lastIndex = 0;
+
+ var match, tokens = [];
+ var lastIndex = 0;
+ var matchAttempts = 0;
+
+ var token = {type: null, value: ""};
+
+ while (match = re.exec(line)) {
+ var type = mapping.defaultToken;
+ var rule = null;
+ var value = match[0];
+ var index = re.lastIndex;
+
+ if (index - value.length > lastIndex) {
+ var skipped = line.substring(lastIndex, index - value.length);
+ if (token.type == type) {
+ token.value += skipped;
+ } else {
+ if (token.type)
+ tokens.push(token);
+ token = {type: type, value: skipped};
+ }
+ }
+
+ for (var i = 0; i < match.length-2; i++) {
+ if (match[i + 1] === undefined)
+ continue;
+
+ rule = state[mapping[i]];
+
+ if (rule.onMatch)
+ type = rule.onMatch(value, currentState, stack);
+ else
+ type = rule.token;
+
+ if (rule.next) {
+ if (typeof rule.next == "string") {
+ currentState = rule.next;
+ } else {
+ currentState = rule.next(currentState, stack);
+ }
+
+ state = this.states[currentState];
+ if (!state) {
+ this.reportError("state doesn't exist", currentState);
+ currentState = "start";
+ state = this.states[currentState];
+ }
+ mapping = this.matchMappings[currentState];
+ lastIndex = index;
+ re = this.regExps[currentState];
+ re.lastIndex = index;
+ }
+ break;
+ }
+
+ if (value) {
+ if (typeof type === "string") {
+ if ((!rule || rule.merge !== false) && token.type === type) {
+ token.value += value;
+ } else {
+ if (token.type)
+ tokens.push(token);
+ token = {type: type, value: value};
+ }
+ } else if (type) {
+ if (token.type)
+ tokens.push(token);
+ token = {type: null, value: ""};
+ for (var i = 0; i < type.length; i++)
+ tokens.push(type[i]);
+ }
+ }
+
+ if (lastIndex == line.length)
+ break;
+
+ lastIndex = index;
+
+ if (matchAttempts++ > MAX_TOKEN_COUNT) {
+ if (matchAttempts > 2 * line.length) {
+ this.reportError("infinite loop with in ace tokenizer", {
+ startState: startState,
+ line: line
+ });
+ }
+ while (lastIndex < line.length) {
+ if (token.type)
+ tokens.push(token);
+ token = {
+ value: line.substring(lastIndex, lastIndex += 2000),
+ type: "overflow"
+ };
+ }
+ currentState = "start";
+ stack = [];
+ break;
+ }
+ }
+
+ if (token.type)
+ tokens.push(token);
+
+ if (stack.length > 1) {
+ if (stack[0] !== currentState)
+ stack.unshift("#tmp", currentState);
+ }
+ return {
+ tokens : tokens,
+ state : stack.length ? stack : currentState
+ };
+ };
+
+ this.reportError = config.reportError;
+
+}).call(Tokenizer.prototype);
+
+exports.Tokenizer = Tokenizer;
+});
+
+ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"], function(acequire, exports, module) {
+"use strict";
+
+var lang = acequire("../lib/lang");
+
+var TextHighlightRules = function() {
+
+ this.$rules = {
+ "start" : [{
+ token : "empty_line",
+ regex : '^$'
+ }, {
+ defaultToken : "text"
+ }]
+ };
+};
+
+(function() {
+
+ this.addRules = function(rules, prefix) {
+ if (!prefix) {
+ for (var key in rules)
+ this.$rules[key] = rules[key];
+ return;
+ }
+ for (var key in rules) {
+ var state = rules[key];
+ for (var i = 0; i < state.length; i++) {
+ var rule = state[i];
+ if (rule.next || rule.onMatch) {
+ if (typeof rule.next == "string") {
+ if (rule.next.indexOf(prefix) !== 0)
+ rule.next = prefix + rule.next;
+ }
+ if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
+ rule.nextState = prefix + rule.nextState;
+ }
+ }
+ this.$rules[prefix + key] = state;
+ }
+ };
+
+ this.getRules = function() {
+ return this.$rules;
+ };
+
+ this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {
+ var embedRules = typeof HighlightRules == "function"
+ ? new HighlightRules().getRules()
+ : HighlightRules;
+ if (states) {
+ for (var i = 0; i < states.length; i++)
+ states[i] = prefix + states[i];
+ } else {
+ states = [];
+ for (var key in embedRules)
+ states.push(prefix + key);
+ }
+
+ this.addRules(embedRules, prefix);
+
+ if (escapeRules) {
+ var addRules = Array.prototype[append ? "push" : "unshift"];
+ for (var i = 0; i < states.length; i++)
+ addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
+ }
+
+ if (!this.$embeds)
+ this.$embeds = [];
+ this.$embeds.push(prefix);
+ };
+
+ this.getEmbeds = function() {
+ return this.$embeds;
+ };
+
+ var pushState = function(currentState, stack) {
+ if (currentState != "start" || stack.length)
+ stack.unshift(this.nextState, currentState);
+ return this.nextState;
+ };
+ var popState = function(currentState, stack) {
+ stack.shift();
+ return stack.shift() || "start";
+ };
+
+ this.normalizeRules = function() {
+ var id = 0;
+ var rules = this.$rules;
+ function processState(key) {
+ var state = rules[key];
+ state.processed = true;
+ for (var i = 0; i < state.length; i++) {
+ var rule = state[i];
+ if (!rule.regex && rule.start) {
+ rule.regex = rule.start;
+ if (!rule.next)
+ rule.next = [];
+ rule.next.push({
+ defaultToken: rule.token
+ }, {
+ token: rule.token + ".end",
+ regex: rule.end || rule.start,
+ next: "pop"
+ });
+ rule.token = rule.token + ".start";
+ rule.push = true;
+ }
+ var next = rule.next || rule.push;
+ if (next && Array.isArray(next)) {
+ var stateName = rule.stateName;
+ if (!stateName) {
+ stateName = rule.token;
+ if (typeof stateName != "string")
+ stateName = stateName[0] || "";
+ if (rules[stateName])
+ stateName += id++;
+ }
+ rules[stateName] = next;
+ rule.next = stateName;
+ processState(stateName);
+ } else if (next == "pop") {
+ rule.next = popState;
+ }
+
+ if (rule.push) {
+ rule.nextState = rule.next || rule.push;
+ rule.next = pushState;
+ delete rule.push;
+ }
+
+ if (rule.rules) {
+ for (var r in rule.rules) {
+ if (rules[r]) {
+ if (rules[r].push)
+ rules[r].push.apply(rules[r], rule.rules[r]);
+ } else {
+ rules[r] = rule.rules[r];
+ }
+ }
+ }
+ if (rule.include || typeof rule == "string") {
+ var includeName = rule.include || rule;
+ var toInsert = rules[includeName];
+ } else if (Array.isArray(rule))
+ toInsert = rule;
+
+ if (toInsert) {
+ var args = [i, 1].concat(toInsert);
+ if (rule.noEscape)
+ args = args.filter(function(x) {return !x.next;});
+ state.splice.apply(state, args);
+ i--;
+ toInsert = null;
+ }
+
+ if (rule.keywordMap) {
+ rule.token = this.createKeywordMapper(
+ rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive
+ );
+ delete rule.defaultToken;
+ }
+ }
+ }
+ Object.keys(rules).forEach(processState, this);
+ };
+
+ this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
+ var keywords = Object.create(null);
+ Object.keys(map).forEach(function(className) {
+ var a = map[className];
+ if (ignoreCase)
+ a = a.toLowerCase();
+ var list = a.split(splitChar || "|");
+ for (var i = list.length; i--; )
+ keywords[list[i]] = className;
+ });
+ if (Object.getPrototypeOf(keywords)) {
+ keywords.__proto__ = null;
+ }
+ this.$keywordList = Object.keys(keywords);
+ map = null;
+ return ignoreCase
+ ? function(value) {return keywords[value.toLowerCase()] || defaultToken }
+ : function(value) {return keywords[value] || defaultToken };
+ };
+
+ this.getKeywords = function() {
+ return this.$keywords;
+ };
+
+}).call(TextHighlightRules.prototype);
+
+exports.TextHighlightRules = TextHighlightRules;
+});
+
+ace.define("ace/mode/behaviour",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+var Behaviour = function() {
+ this.$behaviours = {};
+};
+
+(function () {
+
+ this.add = function (name, action, callback) {
+ switch (undefined) {
+ case this.$behaviours:
+ this.$behaviours = {};
+ case this.$behaviours[name]:
+ this.$behaviours[name] = {};
+ }
+ this.$behaviours[name][action] = callback;
+ }
+
+ this.addBehaviours = function (behaviours) {
+ for (var key in behaviours) {
+ for (var action in behaviours[key]) {
+ this.add(key, action, behaviours[key][action]);
+ }
+ }
+ }
+
+ this.remove = function (name) {
+ if (this.$behaviours && this.$behaviours[name]) {
+ delete this.$behaviours[name];
+ }
+ }
+
+ this.inherit = function (mode, filter) {
+ if (typeof mode === "function") {
+ var behaviours = new mode().getBehaviours(filter);
+ } else {
+ var behaviours = mode.getBehaviours(filter);
+ }
+ this.addBehaviours(behaviours);
+ }
+
+ this.getBehaviours = function (filter) {
+ if (!filter) {
+ return this.$behaviours;
+ } else {
+ var ret = {}
+ for (var i = 0; i < filter.length; i++) {
+ if (this.$behaviours[filter[i]]) {
+ ret[filter[i]] = this.$behaviours[filter[i]];
+ }
+ }
+ return ret;
+ }
+ }
+
+}).call(Behaviour.prototype);
+
+exports.Behaviour = Behaviour;
+});
+
+ace.define("ace/unicode",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+exports.packages = {};
+
+addUnicodePackage({
+ L: "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
+ Ll: "0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",
+ Lu: "0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",
+ Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",
+ Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",
+ Lo: "01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
+ M: "0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",
+ Mn: "0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",
+ Mc: "0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",
+ Me: "0488048906DE20DD-20E020E2-20E4A670-A672",
+ N: "0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
+ Nd: "0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
+ Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",
+ No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",
+ P: "0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",
+ Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",
+ Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",
+ Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",
+ Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",
+ Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21",
+ Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F",
+ Po: "0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",
+ S: "0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",
+ Sm: "002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",
+ Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",
+ Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",
+ So: "00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",
+ Z: "002000A01680180E2000-200A20282029202F205F3000",
+ Zs: "002000A01680180E2000-200A202F205F3000",
+ Zl: "2028",
+ Zp: "2029",
+ C: "0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",
+ Cc: "0000-001F007F-009F",
+ Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",
+ Co: "E000-F8FF",
+ Cs: "D800-DFFF",
+ Cn: "03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"
+});
+
+function addUnicodePackage (pack) {
+ var codePoint = /\w{4}/g;
+ for (var name in pack)
+ exports.packages[name] = pack[name].replace(codePoint, "\\u$&");
+}
+
+});
+
+ace.define("ace/token_iterator",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+var TokenIterator = function(session, initialRow, initialColumn) {
+ this.$session = session;
+ this.$row = initialRow;
+ this.$rowTokens = session.getTokens(initialRow);
+
+ var token = session.getTokenAt(initialRow, initialColumn);
+ this.$tokenIndex = token ? token.index : -1;
+};
+
+(function() {
+ this.stepBackward = function() {
+ this.$tokenIndex -= 1;
+
+ while (this.$tokenIndex < 0) {
+ this.$row -= 1;
+ if (this.$row < 0) {
+ this.$row = 0;
+ return null;
+ }
+
+ this.$rowTokens = this.$session.getTokens(this.$row);
+ this.$tokenIndex = this.$rowTokens.length - 1;
+ }
+
+ return this.$rowTokens[this.$tokenIndex];
+ };
+ this.stepForward = function() {
+ this.$tokenIndex += 1;
+ var rowCount;
+ while (this.$tokenIndex >= this.$rowTokens.length) {
+ this.$row += 1;
+ if (!rowCount)
+ rowCount = this.$session.getLength();
+ if (this.$row >= rowCount) {
+ this.$row = rowCount - 1;
+ return null;
+ }
+
+ this.$rowTokens = this.$session.getTokens(this.$row);
+ this.$tokenIndex = 0;
+ }
+
+ return this.$rowTokens[this.$tokenIndex];
+ };
+ this.getCurrentToken = function () {
+ return this.$rowTokens[this.$tokenIndex];
+ };
+ this.getCurrentTokenRow = function () {
+ return this.$row;
+ };
+ this.getCurrentTokenColumn = function() {
+ var rowTokens = this.$rowTokens;
+ var tokenIndex = this.$tokenIndex;
+ var column = rowTokens[tokenIndex].start;
+ if (column !== undefined)
+ return column;
+
+ column = 0;
+ while (tokenIndex > 0) {
+ tokenIndex -= 1;
+ column += rowTokens[tokenIndex].value.length;
+ }
+
+ return column;
+ };
+ this.getCurrentTokenPosition = function() {
+ return {row: this.$row, column: this.getCurrentTokenColumn()};
+ };
+
+}).call(TokenIterator.prototype);
+
+exports.TokenIterator = TokenIterator;
+});
+
+ace.define("ace/mode/text",["require","exports","module","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var Tokenizer = acequire("../tokenizer").Tokenizer;
+var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
+var Behaviour = acequire("./behaviour").Behaviour;
+var unicode = acequire("../unicode");
+var lang = acequire("../lib/lang");
+var TokenIterator = acequire("../token_iterator").TokenIterator;
+var Range = acequire("../range").Range;
+
+var Mode = function() {
+ this.HighlightRules = TextHighlightRules;
+ this.$behaviour = new Behaviour();
+};
+
+(function() {
+
+ this.tokenRe = new RegExp("^["
+ + unicode.packages.L
+ + unicode.packages.Mn + unicode.packages.Mc
+ + unicode.packages.Nd
+ + unicode.packages.Pc + "\\$_]+", "g"
+ );
+
+ this.nonTokenRe = new RegExp("^(?:[^"
+ + unicode.packages.L
+ + unicode.packages.Mn + unicode.packages.Mc
+ + unicode.packages.Nd
+ + unicode.packages.Pc + "\\$_]|\\s])+", "g"
+ );
+
+ this.getTokenizer = function() {
+ if (!this.$tokenizer) {
+ this.$highlightRules = this.$highlightRules || new this.HighlightRules();
+ this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
+ }
+ return this.$tokenizer;
+ };
+
+ this.lineCommentStart = "";
+ this.blockComment = "";
+
+ this.toggleCommentLines = function(state, session, startRow, endRow) {
+ var doc = session.doc;
+
+ var ignoreBlankLines = true;
+ var shouldRemove = true;
+ var minIndent = Infinity;
+ var tabSize = session.getTabSize();
+ var insertAtTabStop = false;
+
+ if (!this.lineCommentStart) {
+ if (!this.blockComment)
+ return false;
+ var lineCommentStart = this.blockComment.start;
+ var lineCommentEnd = this.blockComment.end;
+ var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")");
+ var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$");
+
+ var comment = function(line, i) {
+ if (testRemove(line, i))
+ return;
+ if (!ignoreBlankLines || /\S/.test(line)) {
+ doc.insertInLine({row: i, column: line.length}, lineCommentEnd);
+ doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
+ }
+ };
+
+ var uncomment = function(line, i) {
+ var m;
+ if (m = line.match(regexpEnd))
+ doc.removeInLine(i, line.length - m[0].length, line.length);
+ if (m = line.match(regexpStart))
+ doc.removeInLine(i, m[1].length, m[0].length);
+ };
+
+ var testRemove = function(line, row) {
+ if (regexpStart.test(line))
+ return true;
+ var tokens = session.getTokens(row);
+ for (var i = 0; i < tokens.length; i++) {
+ if (tokens[i].type === "comment")
+ return true;
+ }
+ };
+ } else {
+ if (Array.isArray(this.lineCommentStart)) {
+ var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|");
+ var lineCommentStart = this.lineCommentStart[0];
+ } else {
+ var regexpStart = lang.escapeRegExp(this.lineCommentStart);
+ var lineCommentStart = this.lineCommentStart;
+ }
+ regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?");
+
+ insertAtTabStop = session.getUseSoftTabs();
+
+ var uncomment = function(line, i) {
+ var m = line.match(regexpStart);
+ if (!m) return;
+ var start = m[1].length, end = m[0].length;
+ if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ")
+ end--;
+ doc.removeInLine(i, start, end);
+ };
+ var commentWithSpace = lineCommentStart + " ";
+ var comment = function(line, i) {
+ if (!ignoreBlankLines || /\S/.test(line)) {
+ if (shouldInsertSpace(line, minIndent, minIndent))
+ doc.insertInLine({row: i, column: minIndent}, commentWithSpace);
+ else
+ doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
+ }
+ };
+ var testRemove = function(line, i) {
+ return regexpStart.test(line);
+ };
+
+ var shouldInsertSpace = function(line, before, after) {
+ var spaces = 0;
+ while (before-- && line.charAt(before) == " ")
+ spaces++;
+ if (spaces % tabSize != 0)
+ return false;
+ var spaces = 0;
+ while (line.charAt(after++) == " ")
+ spaces++;
+ if (tabSize > 2)
+ return spaces % tabSize != tabSize - 1;
+ else
+ return spaces % tabSize == 0;
+ return true;
+ };
+ }
+
+ function iter(fun) {
+ for (var i = startRow; i <= endRow; i++)
+ fun(doc.getLine(i), i);
+ }
+
+
+ var minEmptyLength = Infinity;
+ iter(function(line, i) {
+ var indent = line.search(/\S/);
+ if (indent !== -1) {
+ if (indent < minIndent)
+ minIndent = indent;
+ if (shouldRemove && !testRemove(line, i))
+ shouldRemove = false;
+ } else if (minEmptyLength > line.length) {
+ minEmptyLength = line.length;
+ }
+ });
+
+ if (minIndent == Infinity) {
+ minIndent = minEmptyLength;
+ ignoreBlankLines = false;
+ shouldRemove = false;
+ }
+
+ if (insertAtTabStop && minIndent % tabSize != 0)
+ minIndent = Math.floor(minIndent / tabSize) * tabSize;
+
+ iter(shouldRemove ? uncomment : comment);
+ };
+
+ this.toggleBlockComment = function(state, session, range, cursor) {
+ var comment = this.blockComment;
+ if (!comment)
+ return;
+ if (!comment.start && comment[0])
+ comment = comment[0];
+
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ var token = iterator.getCurrentToken();
+
+ var sel = session.selection;
+ var initialRange = session.selection.toOrientedRange();
+ var startRow, colDiff;
+
+ if (token && /comment/.test(token.type)) {
+ var startRange, endRange;
+ while (token && /comment/.test(token.type)) {
+ var i = token.value.indexOf(comment.start);
+ if (i != -1) {
+ var row = iterator.getCurrentTokenRow();
+ var column = iterator.getCurrentTokenColumn() + i;
+ startRange = new Range(row, column, row, column + comment.start.length);
+ break;
+ }
+ token = iterator.stepBackward();
+ }
+
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ var token = iterator.getCurrentToken();
+ while (token && /comment/.test(token.type)) {
+ var i = token.value.indexOf(comment.end);
+ if (i != -1) {
+ var row = iterator.getCurrentTokenRow();
+ var column = iterator.getCurrentTokenColumn() + i;
+ endRange = new Range(row, column, row, column + comment.end.length);
+ break;
+ }
+ token = iterator.stepForward();
+ }
+ if (endRange)
+ session.remove(endRange);
+ if (startRange) {
+ session.remove(startRange);
+ startRow = startRange.start.row;
+ colDiff = -comment.start.length;
+ }
+ } else {
+ colDiff = comment.start.length;
+ startRow = range.start.row;
+ session.insert(range.end, comment.end);
+ session.insert(range.start, comment.start);
+ }
+ if (initialRange.start.row == startRow)
+ initialRange.start.column += colDiff;
+ if (initialRange.end.row == startRow)
+ initialRange.end.column += colDiff;
+ session.selection.fromOrientedRange(initialRange);
+ };
+
+ this.getNextLineIndent = function(state, line, tab) {
+ return this.$getIndent(line);
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return false;
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+ this.createWorker = function(session) {
+ return null;
+ };
+
+ this.createModeDelegates = function (mapping) {
+ this.$embeds = [];
+ this.$modes = {};
+ for (var i in mapping) {
+ if (mapping[i]) {
+ this.$embeds.push(i);
+ this.$modes[i] = new mapping[i]();
+ }
+ }
+
+ var delegations = ["toggleBlockComment", "toggleCommentLines", "getNextLineIndent",
+ "checkOutdent", "autoOutdent", "transformAction", "getCompletions"];
+
+ for (var i = 0; i < delegations.length; i++) {
+ (function(scope) {
+ var functionName = delegations[i];
+ var defaultHandler = scope[functionName];
+ scope[delegations[i]] = function() {
+ return this.$delegator(functionName, arguments, defaultHandler);
+ };
+ }(this));
+ }
+ };
+
+ this.$delegator = function(method, args, defaultHandler) {
+ var state = args[0];
+ if (typeof state != "string")
+ state = state[0];
+ for (var i = 0; i < this.$embeds.length; i++) {
+ if (!this.$modes[this.$embeds[i]]) continue;
+
+ var split = state.split(this.$embeds[i]);
+ if (!split[0] && split[1]) {
+ args[0] = split[1];
+ var mode = this.$modes[this.$embeds[i]];
+ return mode[method].apply(mode, args);
+ }
+ }
+ var ret = defaultHandler.apply(this, args);
+ return defaultHandler ? ret : undefined;
+ };
+
+ this.transformAction = function(state, action, editor, session, param) {
+ if (this.$behaviour) {
+ var behaviours = this.$behaviour.getBehaviours();
+ for (var key in behaviours) {
+ if (behaviours[key][action]) {
+ var ret = behaviours[key][action].apply(this, arguments);
+ if (ret) {
+ return ret;
+ }
+ }
+ }
+ }
+ };
+
+ this.getKeywords = function(append) {
+ if (!this.completionKeywords) {
+ var rules = this.$tokenizer.rules;
+ var completionKeywords = [];
+ for (var rule in rules) {
+ var ruleItr = rules[rule];
+ for (var r = 0, l = ruleItr.length; r < l; r++) {
+ if (typeof ruleItr[r].token === "string") {
+ if (/keyword|support|storage/.test(ruleItr[r].token))
+ completionKeywords.push(ruleItr[r].regex);
+ }
+ else if (typeof ruleItr[r].token === "object") {
+ for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) {
+ if (/keyword|support|storage/.test(ruleItr[r].token[a])) {
+ var rule = ruleItr[r].regex.match(/\(.+?\)/g)[a];
+ completionKeywords.push(rule.substr(1, rule.length - 2));
+ }
+ }
+ }
+ }
+ }
+ this.completionKeywords = completionKeywords;
+ }
+ if (!append)
+ return this.$keywordList;
+ return completionKeywords.concat(this.$keywordList || []);
+ };
+
+ this.$createKeywordList = function() {
+ if (!this.$highlightRules)
+ this.getTokenizer();
+ return this.$keywordList = this.$highlightRules.$keywordList || [];
+ };
+
+ this.getCompletions = function(state, session, pos, prefix) {
+ var keywords = this.$keywordList || this.$createKeywordList();
+ return keywords.map(function(word) {
+ return {
+ name: word,
+ value: word,
+ score: 0,
+ meta: "keyword"
+ };
+ });
+ };
+
+ this.$id = "ace/mode/text";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+ace.define("ace/apply_delta",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+
+function throwDeltaError(delta, errorText){
+ console.log("Invalid Delta:", delta);
+ throw "Invalid Delta: " + errorText;
+}
+
+function positionInDocument(docLines, position) {
+ return position.row >= 0 && position.row < docLines.length &&
+ position.column >= 0 && position.column <= docLines[position.row].length;
+}
+
+function validateDelta(docLines, delta) {
+ if (delta.action != "insert" && delta.action != "remove")
+ throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
+ if (!(delta.lines instanceof Array))
+ throwDeltaError(delta, "delta.lines must be an Array");
+ if (!delta.start || !delta.end)
+ throwDeltaError(delta, "delta.start/end must be an present");
+ var start = delta.start;
+ if (!positionInDocument(docLines, delta.start))
+ throwDeltaError(delta, "delta.start must be contained in document");
+ var end = delta.end;
+ if (delta.action == "remove" && !positionInDocument(docLines, end))
+ throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
+ var numRangeRows = end.row - start.row;
+ var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
+ if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
+ throwDeltaError(delta, "delta.range must match delta lines");
+}
+
+exports.applyDelta = function(docLines, delta, doNotValidate) {
+
+ var row = delta.start.row;
+ var startColumn = delta.start.column;
+ var line = docLines[row] || "";
+ switch (delta.action) {
+ case "insert":
+ var lines = delta.lines;
+ if (lines.length === 1) {
+ docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
+ } else {
+ var args = [row, 1].concat(delta.lines);
+ docLines.splice.apply(docLines, args);
+ docLines[row] = line.substring(0, startColumn) + docLines[row];
+ docLines[row + delta.lines.length - 1] += line.substring(startColumn);
+ }
+ break;
+ case "remove":
+ var endColumn = delta.end.column;
+ var endRow = delta.end.row;
+ if (row === endRow) {
+ docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
+ } else {
+ docLines.splice(
+ row, endRow - row + 1,
+ line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
+ );
+ }
+ break;
+ }
+}
+});
+
+ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+
+var Anchor = exports.Anchor = function(doc, row, column) {
+ this.$onChange = this.onChange.bind(this);
+ this.attach(doc);
+
+ if (typeof column == "undefined")
+ this.setPosition(row.row, row.column);
+ else
+ this.setPosition(row, column);
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+ this.getPosition = function() {
+ return this.$clipPositionToDocument(this.row, this.column);
+ };
+ this.getDocument = function() {
+ return this.document;
+ };
+ this.$insertRight = false;
+ this.onChange = function(delta) {
+ if (delta.start.row == delta.end.row && delta.start.row != this.row)
+ return;
+
+ if (delta.start.row > this.row)
+ return;
+
+ var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
+ this.setPosition(point.row, point.column, true);
+ };
+
+ function $pointsInOrder(point1, point2, equalPointsInOrder) {
+ var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
+ return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
+ }
+
+ function $getTransformedPoint(delta, point, moveIfEqual) {
+ var deltaIsInsert = delta.action == "insert";
+ var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
+ var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
+ var deltaStart = delta.start;
+ var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
+ if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
+ return {
+ row: point.row,
+ column: point.column
+ };
+ }
+ if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
+ return {
+ row: point.row + deltaRowShift,
+ column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
+ };
+ }
+
+ return {
+ row: deltaStart.row,
+ column: deltaStart.column
+ };
+ }
+ this.setPosition = function(row, column, noClip) {
+ var pos;
+ if (noClip) {
+ pos = {
+ row: row,
+ column: column
+ };
+ } else {
+ pos = this.$clipPositionToDocument(row, column);
+ }
+
+ if (this.row == pos.row && this.column == pos.column)
+ return;
+
+ var old = {
+ row: this.row,
+ column: this.column
+ };
+
+ this.row = pos.row;
+ this.column = pos.column;
+ this._signal("change", {
+ old: old,
+ value: pos
+ });
+ };
+ this.detach = function() {
+ this.document.removeEventListener("change", this.$onChange);
+ };
+ this.attach = function(doc) {
+ this.document = doc || this.document;
+ this.document.on("change", this.$onChange);
+ };
+ this.$clipPositionToDocument = function(row, column) {
+ var pos = {};
+
+ if (row >= this.document.getLength()) {
+ pos.row = Math.max(0, this.document.getLength() - 1);
+ pos.column = this.document.getLine(pos.row).length;
+ }
+ else if (row < 0) {
+ pos.row = 0;
+ pos.column = 0;
+ }
+ else {
+ pos.row = row;
+ pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
+ }
+
+ if (column < 0)
+ pos.column = 0;
+
+ return pos;
+ };
+
+}).call(Anchor.prototype);
+
+});
+
+ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var applyDelta = acequire("./apply_delta").applyDelta;
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var Range = acequire("./range").Range;
+var Anchor = acequire("./anchor").Anchor;
+
+var Document = function(textOrLines) {
+ this.$lines = [""];
+ if (textOrLines.length === 0) {
+ this.$lines = [""];
+ } else if (Array.isArray(textOrLines)) {
+ this.insertMergedLines({row: 0, column: 0}, textOrLines);
+ } else {
+ this.insert({row: 0, column:0}, textOrLines);
+ }
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+ this.setValue = function(text) {
+ var len = this.getLength() - 1;
+ this.remove(new Range(0, 0, len, this.getLine(len).length));
+ this.insert({row: 0, column: 0}, text);
+ };
+ this.getValue = function() {
+ return this.getAllLines().join(this.getNewLineCharacter());
+ };
+ this.createAnchor = function(row, column) {
+ return new Anchor(this, row, column);
+ };
+ if ("aaa".split(/a/).length === 0) {
+ this.$split = function(text) {
+ return text.replace(/\r\n|\r/g, "\n").split("\n");
+ };
+ } else {
+ this.$split = function(text) {
+ return text.split(/\r\n|\r|\n/);
+ };
+ }
+
+
+ this.$detectNewLine = function(text) {
+ var match = text.match(/^.*?(\r\n|\r|\n)/m);
+ this.$autoNewLine = match ? match[1] : "\n";
+ this._signal("changeNewLineMode");
+ };
+ this.getNewLineCharacter = function() {
+ switch (this.$newLineMode) {
+ case "windows":
+ return "\r\n";
+ case "unix":
+ return "\n";
+ default:
+ return this.$autoNewLine || "\n";
+ }
+ };
+
+ this.$autoNewLine = "";
+ this.$newLineMode = "auto";
+ this.setNewLineMode = function(newLineMode) {
+ if (this.$newLineMode === newLineMode)
+ return;
+
+ this.$newLineMode = newLineMode;
+ this._signal("changeNewLineMode");
+ };
+ this.getNewLineMode = function() {
+ return this.$newLineMode;
+ };
+ this.isNewLine = function(text) {
+ return (text == "\r\n" || text == "\r" || text == "\n");
+ };
+ this.getLine = function(row) {
+ return this.$lines[row] || "";
+ };
+ this.getLines = function(firstRow, lastRow) {
+ return this.$lines.slice(firstRow, lastRow + 1);
+ };
+ this.getAllLines = function() {
+ return this.getLines(0, this.getLength());
+ };
+ this.getLength = function() {
+ return this.$lines.length;
+ };
+ this.getTextRange = function(range) {
+ return this.getLinesForRange(range).join(this.getNewLineCharacter());
+ };
+ this.getLinesForRange = function(range) {
+ var lines;
+ if (range.start.row === range.end.row) {
+ lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
+ } else {
+ lines = this.getLines(range.start.row, range.end.row);
+ lines[0] = (lines[0] || "").substring(range.start.column);
+ var l = lines.length - 1;
+ if (range.end.row - range.start.row == l)
+ lines[l] = lines[l].substring(0, range.end.column);
+ }
+ return lines;
+ };
+ this.insertLines = function(row, lines) {
+ console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
+ return this.insertFullLines(row, lines);
+ };
+ this.removeLines = function(firstRow, lastRow) {
+ console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
+ return this.removeFullLines(firstRow, lastRow);
+ };
+ this.insertNewLine = function(position) {
+ console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, [\'\', \'\']) instead.");
+ return this.insertMergedLines(position, ["", ""]);
+ };
+ this.insert = function(position, text) {
+ if (this.getLength() <= 1)
+ this.$detectNewLine(text);
+
+ return this.insertMergedLines(position, this.$split(text));
+ };
+ this.insertInLine = function(position, text) {
+ var start = this.clippedPos(position.row, position.column);
+ var end = this.pos(position.row, position.column + text.length);
+
+ this.applyDelta({
+ start: start,
+ end: end,
+ action: "insert",
+ lines: [text]
+ }, true);
+
+ return this.clonePos(end);
+ };
+
+ this.clippedPos = function(row, column) {
+ var length = this.getLength();
+ if (row === undefined) {
+ row = length;
+ } else if (row < 0) {
+ row = 0;
+ } else if (row >= length) {
+ row = length - 1;
+ column = undefined;
+ }
+ var line = this.getLine(row);
+ if (column == undefined)
+ column = line.length;
+ column = Math.min(Math.max(column, 0), line.length);
+ return {row: row, column: column};
+ };
+
+ this.clonePos = function(pos) {
+ return {row: pos.row, column: pos.column};
+ };
+
+ this.pos = function(row, column) {
+ return {row: row, column: column};
+ };
+
+ this.$clipPosition = function(position) {
+ var length = this.getLength();
+ if (position.row >= length) {
+ position.row = Math.max(0, length - 1);
+ position.column = this.getLine(length - 1).length;
+ } else {
+ position.row = Math.max(0, position.row);
+ position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
+ }
+ return position;
+ };
+ this.insertFullLines = function(row, lines) {
+ row = Math.min(Math.max(row, 0), this.getLength());
+ var column = 0;
+ if (row < this.getLength()) {
+ lines = lines.concat([""]);
+ column = 0;
+ } else {
+ lines = [""].concat(lines);
+ row--;
+ column = this.$lines[row].length;
+ }
+ this.insertMergedLines({row: row, column: column}, lines);
+ };
+ this.insertMergedLines = function(position, lines) {
+ var start = this.clippedPos(position.row, position.column);
+ var end = {
+ row: start.row + lines.length - 1,
+ column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
+ };
+
+ this.applyDelta({
+ start: start,
+ end: end,
+ action: "insert",
+ lines: lines
+ });
+
+ return this.clonePos(end);
+ };
+ this.remove = function(range) {
+ var start = this.clippedPos(range.start.row, range.start.column);
+ var end = this.clippedPos(range.end.row, range.end.column);
+ this.applyDelta({
+ start: start,
+ end: end,
+ action: "remove",
+ lines: this.getLinesForRange({start: start, end: end})
+ });
+ return this.clonePos(start);
+ };
+ this.removeInLine = function(row, startColumn, endColumn) {
+ var start = this.clippedPos(row, startColumn);
+ var end = this.clippedPos(row, endColumn);
+
+ this.applyDelta({
+ start: start,
+ end: end,
+ action: "remove",
+ lines: this.getLinesForRange({start: start, end: end})
+ }, true);
+
+ return this.clonePos(start);
+ };
+ this.removeFullLines = function(firstRow, lastRow) {
+ firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
+ lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
+ var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
+ var deleteLastNewLine = lastRow < this.getLength() - 1;
+ var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
+ var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
+ var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
+ var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
+ var range = new Range(startRow, startCol, endRow, endCol);
+ var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
+
+ this.applyDelta({
+ start: range.start,
+ end: range.end,
+ action: "remove",
+ lines: this.getLinesForRange(range)
+ });
+ return deletedLines;
+ };
+ this.removeNewLine = function(row) {
+ if (row < this.getLength() - 1 && row >= 0) {
+ this.applyDelta({
+ start: this.pos(row, this.getLine(row).length),
+ end: this.pos(row + 1, 0),
+ action: "remove",
+ lines: ["", ""]
+ });
+ }
+ };
+ this.replace = function(range, text) {
+ if (!(range instanceof Range))
+ range = Range.fromPoints(range.start, range.end);
+ if (text.length === 0 && range.isEmpty())
+ return range.start;
+ if (text == this.getTextRange(range))
+ return range.end;
+
+ this.remove(range);
+ var end;
+ if (text) {
+ end = this.insert(range.start, text);
+ }
+ else {
+ end = range.start;
+ }
+
+ return end;
+ };
+ this.applyDeltas = function(deltas) {
+ for (var i=0; i=0; i--) {
+ this.revertDelta(deltas[i]);
+ }
+ };
+ this.applyDelta = function(delta, doNotValidate) {
+ var isInsert = delta.action == "insert";
+ if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
+ : !Range.comparePoints(delta.start, delta.end)) {
+ return;
+ }
+
+ if (isInsert && delta.lines.length > 20000)
+ this.$splitAndapplyLargeDelta(delta, 20000);
+ applyDelta(this.$lines, delta, doNotValidate);
+ this._signal("change", delta);
+ };
+
+ this.$splitAndapplyLargeDelta = function(delta, MAX) {
+ var lines = delta.lines;
+ var l = lines.length;
+ var row = delta.start.row;
+ var column = delta.start.column;
+ var from = 0, to = 0;
+ do {
+ from = to;
+ to += MAX - 1;
+ var chunk = lines.slice(from, to);
+ if (to > l) {
+ delta.lines = chunk;
+ delta.start.row = row + from;
+ delta.start.column = column;
+ break;
+ }
+ chunk.push("");
+ this.applyDelta({
+ start: this.pos(row + from, column),
+ end: this.pos(row + to, column = 0),
+ action: delta.action,
+ lines: chunk
+ }, true);
+ } while(true);
+ };
+ this.revertDelta = function(delta) {
+ this.applyDelta({
+ start: this.clonePos(delta.start),
+ end: this.clonePos(delta.end),
+ action: (delta.action == "insert" ? "remove" : "insert"),
+ lines: delta.lines.slice()
+ });
+ };
+ this.indexToPosition = function(index, startRow) {
+ var lines = this.$lines || this.getAllLines();
+ var newlineLength = this.getNewLineCharacter().length;
+ for (var i = startRow || 0, l = lines.length; i < l; i++) {
+ index -= lines[i].length + newlineLength;
+ if (index < 0)
+ return {row: i, column: index + lines[i].length + newlineLength};
+ }
+ return {row: l-1, column: lines[l-1].length};
+ };
+ this.positionToIndex = function(pos, startRow) {
+ var lines = this.$lines || this.getAllLines();
+ var newlineLength = this.getNewLineCharacter().length;
+ var index = 0;
+ var row = Math.min(pos.row, lines.length);
+ for (var i = startRow || 0; i < row; ++i)
+ index += lines[i].length + newlineLength;
+
+ return index + pos.column;
+ };
+
+}).call(Document.prototype);
+
+exports.Document = Document;
+});
+
+ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+
+var BackgroundTokenizer = function(tokenizer, editor) {
+ this.running = false;
+ this.lines = [];
+ this.states = [];
+ this.currentLine = 0;
+ this.tokenizer = tokenizer;
+
+ var self = this;
+
+ this.$worker = function() {
+ if (!self.running) { return; }
+
+ var workerStart = new Date();
+ var currentLine = self.currentLine;
+ var endLine = -1;
+ var doc = self.doc;
+
+ var startLine = currentLine;
+ while (self.lines[currentLine])
+ currentLine++;
+
+ var len = doc.getLength();
+ var processedLines = 0;
+ self.running = false;
+ while (currentLine < len) {
+ self.$tokenizeRow(currentLine);
+ endLine = currentLine;
+ do {
+ currentLine++;
+ } while (self.lines[currentLine]);
+ processedLines ++;
+ if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) {
+ self.running = setTimeout(self.$worker, 20);
+ break;
+ }
+ }
+ self.currentLine = currentLine;
+
+ if (startLine <= endLine)
+ self.fireUpdateEvent(startLine, endLine);
+ };
+};
+
+(function(){
+
+ oop.implement(this, EventEmitter);
+ this.setTokenizer = function(tokenizer) {
+ this.tokenizer = tokenizer;
+ this.lines = [];
+ this.states = [];
+
+ this.start(0);
+ };
+ this.setDocument = function(doc) {
+ this.doc = doc;
+ this.lines = [];
+ this.states = [];
+
+ this.stop();
+ };
+ this.fireUpdateEvent = function(firstRow, lastRow) {
+ var data = {
+ first: firstRow,
+ last: lastRow
+ };
+ this._signal("update", {data: data});
+ };
+ this.start = function(startRow) {
+ this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
+ this.lines.splice(this.currentLine, this.lines.length);
+ this.states.splice(this.currentLine, this.states.length);
+
+ this.stop();
+ this.running = setTimeout(this.$worker, 700);
+ };
+
+ this.scheduleStart = function() {
+ if (!this.running)
+ this.running = setTimeout(this.$worker, 700);
+ }
+
+ this.$updateOnChange = function(delta) {
+ var startRow = delta.start.row;
+ var len = delta.end.row - startRow;
+
+ if (len === 0) {
+ this.lines[startRow] = null;
+ } else if (delta.action == "remove") {
+ this.lines.splice(startRow, len + 1, null);
+ this.states.splice(startRow, len + 1, null);
+ } else {
+ var args = Array(len + 1);
+ args.unshift(startRow, 1);
+ this.lines.splice.apply(this.lines, args);
+ this.states.splice.apply(this.states, args);
+ }
+
+ this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
+
+ this.stop();
+ };
+ this.stop = function() {
+ if (this.running)
+ clearTimeout(this.running);
+ this.running = false;
+ };
+ this.getTokens = function(row) {
+ return this.lines[row] || this.$tokenizeRow(row);
+ };
+ this.getState = function(row) {
+ if (this.currentLine == row)
+ this.$tokenizeRow(row);
+ return this.states[row] || "start";
+ };
+
+ this.$tokenizeRow = function(row) {
+ var line = this.doc.getLine(row);
+ var state = this.states[row - 1];
+
+ var data = this.tokenizer.getLineTokens(line, state, row);
+
+ if (this.states[row] + "" !== data.state + "") {
+ this.states[row] = data.state;
+ this.lines[row + 1] = null;
+ if (this.currentLine > row + 1)
+ this.currentLine = row + 1;
+ } else if (this.currentLine == row) {
+ this.currentLine = row + 1;
+ }
+
+ return this.lines[row] = data.tokens;
+ };
+
+}).call(BackgroundTokenizer.prototype);
+
+exports.BackgroundTokenizer = BackgroundTokenizer;
+});
+
+ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var lang = acequire("./lib/lang");
+var oop = acequire("./lib/oop");
+var Range = acequire("./range").Range;
+
+var SearchHighlight = function(regExp, clazz, type) {
+ this.setRegexp(regExp);
+ this.clazz = clazz;
+ this.type = type || "text";
+};
+
+(function() {
+ this.MAX_RANGES = 500;
+
+ this.setRegexp = function(regExp) {
+ if (this.regExp+"" == regExp+"")
+ return;
+ this.regExp = regExp;
+ this.cache = [];
+ };
+
+ this.update = function(html, markerLayer, session, config) {
+ if (!this.regExp)
+ return;
+ var start = config.firstRow, end = config.lastRow;
+
+ for (var i = start; i <= end; i++) {
+ var ranges = this.cache[i];
+ if (ranges == null) {
+ ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);
+ if (ranges.length > this.MAX_RANGES)
+ ranges = ranges.slice(0, this.MAX_RANGES);
+ ranges = ranges.map(function(match) {
+ return new Range(i, match.offset, i, match.offset + match.length);
+ });
+ this.cache[i] = ranges.length ? ranges : "";
+ }
+
+ for (var j = ranges.length; j --; ) {
+ markerLayer.drawSingleLineMarker(
+ html, ranges[j].toScreenRange(session), this.clazz, config);
+ }
+ }
+ };
+
+}).call(SearchHighlight.prototype);
+
+exports.SearchHighlight = SearchHighlight;
+});
+
+ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../range").Range;
+function FoldLine(foldData, folds) {
+ this.foldData = foldData;
+ if (Array.isArray(folds)) {
+ this.folds = folds;
+ } else {
+ folds = this.folds = [ folds ];
+ }
+
+ var last = folds[folds.length - 1];
+ this.range = new Range(folds[0].start.row, folds[0].start.column,
+ last.end.row, last.end.column);
+ this.start = this.range.start;
+ this.end = this.range.end;
+
+ this.folds.forEach(function(fold) {
+ fold.setFoldLine(this);
+ }, this);
+}
+
+(function() {
+ this.shiftRow = function(shift) {
+ this.start.row += shift;
+ this.end.row += shift;
+ this.folds.forEach(function(fold) {
+ fold.start.row += shift;
+ fold.end.row += shift;
+ });
+ };
+
+ this.addFold = function(fold) {
+ if (fold.sameRow) {
+ if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
+ throw new Error("Can't add a fold to this FoldLine as it has no connection");
+ }
+ this.folds.push(fold);
+ this.folds.sort(function(a, b) {
+ return -a.range.compareEnd(b.start.row, b.start.column);
+ });
+ if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
+ this.end.row = fold.end.row;
+ this.end.column = fold.end.column;
+ } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
+ this.start.row = fold.start.row;
+ this.start.column = fold.start.column;
+ }
+ } else if (fold.start.row == this.end.row) {
+ this.folds.push(fold);
+ this.end.row = fold.end.row;
+ this.end.column = fold.end.column;
+ } else if (fold.end.row == this.start.row) {
+ this.folds.unshift(fold);
+ this.start.row = fold.start.row;
+ this.start.column = fold.start.column;
+ } else {
+ throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
+ }
+ fold.foldLine = this;
+ };
+
+ this.containsRow = function(row) {
+ return row >= this.start.row && row <= this.end.row;
+ };
+
+ this.walk = function(callback, endRow, endColumn) {
+ var lastEnd = 0,
+ folds = this.folds,
+ fold,
+ cmp, stop, isNewRow = true;
+
+ if (endRow == null) {
+ endRow = this.end.row;
+ endColumn = this.end.column;
+ }
+
+ for (var i = 0; i < folds.length; i++) {
+ fold = folds[i];
+
+ cmp = fold.range.compareStart(endRow, endColumn);
+ if (cmp == -1) {
+ callback(null, endRow, endColumn, lastEnd, isNewRow);
+ return;
+ }
+
+ stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
+ stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
+ if (stop || cmp === 0) {
+ return;
+ }
+ isNewRow = !fold.sameRow;
+ lastEnd = fold.end.column;
+ }
+ callback(null, endRow, endColumn, lastEnd, isNewRow);
+ };
+
+ this.getNextFoldTo = function(row, column) {
+ var fold, cmp;
+ for (var i = 0; i < this.folds.length; i++) {
+ fold = this.folds[i];
+ cmp = fold.range.compareEnd(row, column);
+ if (cmp == -1) {
+ return {
+ fold: fold,
+ kind: "after"
+ };
+ } else if (cmp === 0) {
+ return {
+ fold: fold,
+ kind: "inside"
+ };
+ }
+ }
+ return null;
+ };
+
+ this.addRemoveChars = function(row, column, len) {
+ var ret = this.getNextFoldTo(row, column),
+ fold, folds;
+ if (ret) {
+ fold = ret.fold;
+ if (ret.kind == "inside"
+ && fold.start.column != column
+ && fold.start.row != row)
+ {
+ window.console && window.console.log(row, column, fold);
+ } else if (fold.start.row == row) {
+ folds = this.folds;
+ var i = folds.indexOf(fold);
+ if (i === 0) {
+ this.start.column += len;
+ }
+ for (i; i < folds.length; i++) {
+ fold = folds[i];
+ fold.start.column += len;
+ if (!fold.sameRow) {
+ return;
+ }
+ fold.end.column += len;
+ }
+ this.end.column += len;
+ }
+ }
+ };
+
+ this.split = function(row, column) {
+ var pos = this.getNextFoldTo(row, column);
+
+ if (!pos || pos.kind == "inside")
+ return null;
+
+ var fold = pos.fold;
+ var folds = this.folds;
+ var foldData = this.foldData;
+
+ var i = folds.indexOf(fold);
+ var foldBefore = folds[i - 1];
+ this.end.row = foldBefore.end.row;
+ this.end.column = foldBefore.end.column;
+ folds = folds.splice(i, folds.length - i);
+
+ var newFoldLine = new FoldLine(foldData, folds);
+ foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
+ return newFoldLine;
+ };
+
+ this.merge = function(foldLineNext) {
+ var folds = foldLineNext.folds;
+ for (var i = 0; i < folds.length; i++) {
+ this.addFold(folds[i]);
+ }
+ var foldData = this.foldData;
+ foldData.splice(foldData.indexOf(foldLineNext), 1);
+ };
+
+ this.toString = function() {
+ var ret = [this.range.toString() + ": [" ];
+
+ this.folds.forEach(function(fold) {
+ ret.push(" " + fold.toString());
+ });
+ ret.push("]");
+ return ret.join("\n");
+ };
+
+ this.idxToPosition = function(idx) {
+ var lastFoldEndColumn = 0;
+
+ for (var i = 0; i < this.folds.length; i++) {
+ var fold = this.folds[i];
+
+ idx -= fold.start.column - lastFoldEndColumn;
+ if (idx < 0) {
+ return {
+ row: fold.start.row,
+ column: fold.start.column + idx
+ };
+ }
+
+ idx -= fold.placeholder.length;
+ if (idx < 0) {
+ return fold.start;
+ }
+
+ lastFoldEndColumn = fold.end.column;
+ }
+
+ return {
+ row: this.end.row,
+ column: this.end.column + idx
+ };
+ };
+}).call(FoldLine.prototype);
+
+exports.FoldLine = FoldLine;
+});
+
+ace.define("ace/range_list",["require","exports","module","ace/range"], function(acequire, exports, module) {
+"use strict";
+var Range = acequire("./range").Range;
+var comparePoints = Range.comparePoints;
+
+var RangeList = function() {
+ this.ranges = [];
+};
+
+(function() {
+ this.comparePoints = comparePoints;
+
+ this.pointIndex = function(pos, excludeEdges, startIndex) {
+ var list = this.ranges;
+
+ for (var i = startIndex || 0; i < list.length; i++) {
+ var range = list[i];
+ var cmpEnd = comparePoints(pos, range.end);
+ if (cmpEnd > 0)
+ continue;
+ var cmpStart = comparePoints(pos, range.start);
+ if (cmpEnd === 0)
+ return excludeEdges && cmpStart !== 0 ? -i-2 : i;
+ if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges))
+ return i;
+
+ return -i-1;
+ }
+ return -i - 1;
+ };
+
+ this.add = function(range) {
+ var excludeEdges = !range.isEmpty();
+ var startIndex = this.pointIndex(range.start, excludeEdges);
+ if (startIndex < 0)
+ startIndex = -startIndex - 1;
+
+ var endIndex = this.pointIndex(range.end, excludeEdges, startIndex);
+
+ if (endIndex < 0)
+ endIndex = -endIndex - 1;
+ else
+ endIndex++;
+ return this.ranges.splice(startIndex, endIndex - startIndex, range);
+ };
+
+ this.addList = function(list) {
+ var removed = [];
+ for (var i = list.length; i--; ) {
+ removed.push.apply(removed, this.add(list[i]));
+ }
+ return removed;
+ };
+
+ this.substractPoint = function(pos) {
+ var i = this.pointIndex(pos);
+
+ if (i >= 0)
+ return this.ranges.splice(i, 1);
+ };
+ this.merge = function() {
+ var removed = [];
+ var list = this.ranges;
+
+ list = list.sort(function(a, b) {
+ return comparePoints(a.start, b.start);
+ });
+
+ var next = list[0], range;
+ for (var i = 1; i < list.length; i++) {
+ range = next;
+ next = list[i];
+ var cmp = comparePoints(range.end, next.start);
+ if (cmp < 0)
+ continue;
+
+ if (cmp == 0 && !range.isEmpty() && !next.isEmpty())
+ continue;
+
+ if (comparePoints(range.end, next.end) < 0) {
+ range.end.row = next.end.row;
+ range.end.column = next.end.column;
+ }
+
+ list.splice(i, 1);
+ removed.push(next);
+ next = range;
+ i--;
+ }
+
+ this.ranges = list;
+
+ return removed;
+ };
+
+ this.contains = function(row, column) {
+ return this.pointIndex({row: row, column: column}) >= 0;
+ };
+
+ this.containsPoint = function(pos) {
+ return this.pointIndex(pos) >= 0;
+ };
+
+ this.rangeAtPoint = function(pos) {
+ var i = this.pointIndex(pos);
+ if (i >= 0)
+ return this.ranges[i];
+ };
+
+
+ this.clipRows = function(startRow, endRow) {
+ var list = this.ranges;
+ if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow)
+ return [];
+
+ var startIndex = this.pointIndex({row: startRow, column: 0});
+ if (startIndex < 0)
+ startIndex = -startIndex - 1;
+ var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex);
+ if (endIndex < 0)
+ endIndex = -endIndex - 1;
+
+ var clipped = [];
+ for (var i = startIndex; i < endIndex; i++) {
+ clipped.push(list[i]);
+ }
+ return clipped;
+ };
+
+ this.removeAll = function() {
+ return this.ranges.splice(0, this.ranges.length);
+ };
+
+ this.attach = function(session) {
+ if (this.session)
+ this.detach();
+
+ this.session = session;
+ this.onChange = this.$onChange.bind(this);
+
+ this.session.on('change', this.onChange);
+ };
+
+ this.detach = function() {
+ if (!this.session)
+ return;
+ this.session.removeListener('change', this.onChange);
+ this.session = null;
+ };
+
+ this.$onChange = function(delta) {
+ if (delta.action == "insert"){
+ var start = delta.start;
+ var end = delta.end;
+ } else {
+ var end = delta.start;
+ var start = delta.end;
+ }
+ var startRow = start.row;
+ var endRow = end.row;
+ var lineDif = endRow - startRow;
+
+ var colDiff = -start.column + end.column;
+ var ranges = this.ranges;
+
+ for (var i = 0, n = ranges.length; i < n; i++) {
+ var r = ranges[i];
+ if (r.end.row < startRow)
+ continue;
+ if (r.start.row > startRow)
+ break;
+
+ if (r.start.row == startRow && r.start.column >= start.column ) {
+ if (r.start.column == start.column && this.$insertRight) {
+ } else {
+ r.start.column += colDiff;
+ r.start.row += lineDif;
+ }
+ }
+ if (r.end.row == startRow && r.end.column >= start.column) {
+ if (r.end.column == start.column && this.$insertRight) {
+ continue;
+ }
+ if (r.end.column == start.column && colDiff > 0 && i < n - 1) {
+ if (r.end.column > r.start.column && r.end.column == ranges[i+1].start.column)
+ r.end.column -= colDiff;
+ }
+ r.end.column += colDiff;
+ r.end.row += lineDif;
+ }
+ }
+
+ if (lineDif != 0 && i < n) {
+ for (; i < n; i++) {
+ var r = ranges[i];
+ r.start.row += lineDif;
+ r.end.row += lineDif;
+ }
+ }
+ };
+
+}).call(RangeList.prototype);
+
+exports.RangeList = RangeList;
+});
+
+ace.define("ace/edit_session/fold",["require","exports","module","ace/range","ace/range_list","ace/lib/oop"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../range").Range;
+var RangeList = acequire("../range_list").RangeList;
+var oop = acequire("../lib/oop")
+var Fold = exports.Fold = function(range, placeholder) {
+ this.foldLine = null;
+ this.placeholder = placeholder;
+ this.range = range;
+ this.start = range.start;
+ this.end = range.end;
+
+ this.sameRow = range.start.row == range.end.row;
+ this.subFolds = this.ranges = [];
+};
+
+oop.inherits(Fold, RangeList);
+
+(function() {
+
+ this.toString = function() {
+ return '"' + this.placeholder + '" ' + this.range.toString();
+ };
+
+ this.setFoldLine = function(foldLine) {
+ this.foldLine = foldLine;
+ this.subFolds.forEach(function(fold) {
+ fold.setFoldLine(foldLine);
+ });
+ };
+
+ this.clone = function() {
+ var range = this.range.clone();
+ var fold = new Fold(range, this.placeholder);
+ this.subFolds.forEach(function(subFold) {
+ fold.subFolds.push(subFold.clone());
+ });
+ fold.collapseChildren = this.collapseChildren;
+ return fold;
+ };
+
+ this.addSubFold = function(fold) {
+ if (this.range.isEqual(fold))
+ return;
+
+ if (!this.range.containsRange(fold))
+ throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
+ consumeRange(fold, this.start);
+
+ var row = fold.start.row, column = fold.start.column;
+ for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
+ cmp = this.subFolds[i].range.compare(row, column);
+ if (cmp != 1)
+ break;
+ }
+ var afterStart = this.subFolds[i];
+
+ if (cmp == 0)
+ return afterStart.addSubFold(fold);
+ var row = fold.range.end.row, column = fold.range.end.column;
+ for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
+ cmp = this.subFolds[j].range.compare(row, column);
+ if (cmp != 1)
+ break;
+ }
+ var afterEnd = this.subFolds[j];
+
+ if (cmp == 0)
+ throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
+
+ var consumedFolds = this.subFolds.splice(i, j - i, fold);
+ fold.setFoldLine(this.foldLine);
+
+ return fold;
+ };
+
+ this.restoreRange = function(range) {
+ return restoreRange(range, this.start);
+ };
+
+}).call(Fold.prototype);
+
+function consumePoint(point, anchor) {
+ point.row -= anchor.row;
+ if (point.row == 0)
+ point.column -= anchor.column;
+}
+function consumeRange(range, anchor) {
+ consumePoint(range.start, anchor);
+ consumePoint(range.end, anchor);
+}
+function restorePoint(point, anchor) {
+ if (point.row == 0)
+ point.column += anchor.column;
+ point.row += anchor.row;
+}
+function restoreRange(range, anchor) {
+ restorePoint(range.start, anchor);
+ restorePoint(range.end, anchor);
+}
+
+});
+
+ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../range").Range;
+var FoldLine = acequire("./fold_line").FoldLine;
+var Fold = acequire("./fold").Fold;
+var TokenIterator = acequire("../token_iterator").TokenIterator;
+
+function Folding() {
+ this.getFoldAt = function(row, column, side) {
+ var foldLine = this.getFoldLine(row);
+ if (!foldLine)
+ return null;
+
+ var folds = foldLine.folds;
+ for (var i = 0; i < folds.length; i++) {
+ var fold = folds[i];
+ if (fold.range.contains(row, column)) {
+ if (side == 1 && fold.range.isEnd(row, column)) {
+ continue;
+ } else if (side == -1 && fold.range.isStart(row, column)) {
+ continue;
+ }
+ return fold;
+ }
+ }
+ };
+ this.getFoldsInRange = function(range) {
+ var start = range.start;
+ var end = range.end;
+ var foldLines = this.$foldData;
+ var foundFolds = [];
+
+ start.column += 1;
+ end.column -= 1;
+
+ for (var i = 0; i < foldLines.length; i++) {
+ var cmp = foldLines[i].range.compareRange(range);
+ if (cmp == 2) {
+ continue;
+ }
+ else if (cmp == -2) {
+ break;
+ }
+
+ var folds = foldLines[i].folds;
+ for (var j = 0; j < folds.length; j++) {
+ var fold = folds[j];
+ cmp = fold.range.compareRange(range);
+ if (cmp == -2) {
+ break;
+ } else if (cmp == 2) {
+ continue;
+ } else
+ if (cmp == 42) {
+ break;
+ }
+ foundFolds.push(fold);
+ }
+ }
+ start.column -= 1;
+ end.column += 1;
+
+ return foundFolds;
+ };
+
+ this.getFoldsInRangeList = function(ranges) {
+ if (Array.isArray(ranges)) {
+ var folds = [];
+ ranges.forEach(function(range) {
+ folds = folds.concat(this.getFoldsInRange(range));
+ }, this);
+ } else {
+ var folds = this.getFoldsInRange(ranges);
+ }
+ return folds;
+ };
+ this.getAllFolds = function() {
+ var folds = [];
+ var foldLines = this.$foldData;
+
+ for (var i = 0; i < foldLines.length; i++)
+ for (var j = 0; j < foldLines[i].folds.length; j++)
+ folds.push(foldLines[i].folds[j]);
+
+ return folds;
+ };
+ this.getFoldStringAt = function(row, column, trim, foldLine) {
+ foldLine = foldLine || this.getFoldLine(row);
+ if (!foldLine)
+ return null;
+
+ var lastFold = {
+ end: { column: 0 }
+ };
+ var str, fold;
+ for (var i = 0; i < foldLine.folds.length; i++) {
+ fold = foldLine.folds[i];
+ var cmp = fold.range.compareEnd(row, column);
+ if (cmp == -1) {
+ str = this
+ .getLine(fold.start.row)
+ .substring(lastFold.end.column, fold.start.column);
+ break;
+ }
+ else if (cmp === 0) {
+ return null;
+ }
+ lastFold = fold;
+ }
+ if (!str)
+ str = this.getLine(fold.start.row).substring(lastFold.end.column);
+
+ if (trim == -1)
+ return str.substring(0, column - lastFold.end.column);
+ else if (trim == 1)
+ return str.substring(column - lastFold.end.column);
+ else
+ return str;
+ };
+
+ this.getFoldLine = function(docRow, startFoldLine) {
+ var foldData = this.$foldData;
+ var i = 0;
+ if (startFoldLine)
+ i = foldData.indexOf(startFoldLine);
+ if (i == -1)
+ i = 0;
+ for (i; i < foldData.length; i++) {
+ var foldLine = foldData[i];
+ if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
+ return foldLine;
+ } else if (foldLine.end.row > docRow) {
+ return null;
+ }
+ }
+ return null;
+ };
+ this.getNextFoldLine = function(docRow, startFoldLine) {
+ var foldData = this.$foldData;
+ var i = 0;
+ if (startFoldLine)
+ i = foldData.indexOf(startFoldLine);
+ if (i == -1)
+ i = 0;
+ for (i; i < foldData.length; i++) {
+ var foldLine = foldData[i];
+ if (foldLine.end.row >= docRow) {
+ return foldLine;
+ }
+ }
+ return null;
+ };
+
+ this.getFoldedRowCount = function(first, last) {
+ var foldData = this.$foldData, rowCount = last-first+1;
+ for (var i = 0; i < foldData.length; i++) {
+ var foldLine = foldData[i],
+ end = foldLine.end.row,
+ start = foldLine.start.row;
+ if (end >= last) {
+ if (start < last) {
+ if (start >= first)
+ rowCount -= last-start;
+ else
+ rowCount = 0; // in one fold
+ }
+ break;
+ } else if (end >= first){
+ if (start >= first) // fold inside range
+ rowCount -= end-start;
+ else
+ rowCount -= end-first+1;
+ }
+ }
+ return rowCount;
+ };
+
+ this.$addFoldLine = function(foldLine) {
+ this.$foldData.push(foldLine);
+ this.$foldData.sort(function(a, b) {
+ return a.start.row - b.start.row;
+ });
+ return foldLine;
+ };
+ this.addFold = function(placeholder, range) {
+ var foldData = this.$foldData;
+ var added = false;
+ var fold;
+
+ if (placeholder instanceof Fold)
+ fold = placeholder;
+ else {
+ fold = new Fold(range, placeholder);
+ fold.collapseChildren = range.collapseChildren;
+ }
+ this.$clipRangeToDocument(fold.range);
+
+ var startRow = fold.start.row;
+ var startColumn = fold.start.column;
+ var endRow = fold.end.row;
+ var endColumn = fold.end.column;
+ if (!(startRow < endRow ||
+ startRow == endRow && startColumn <= endColumn - 2))
+ throw new Error("The range has to be at least 2 characters width");
+
+ var startFold = this.getFoldAt(startRow, startColumn, 1);
+ var endFold = this.getFoldAt(endRow, endColumn, -1);
+ if (startFold && endFold == startFold)
+ return startFold.addSubFold(fold);
+
+ if (startFold && !startFold.range.isStart(startRow, startColumn))
+ this.removeFold(startFold);
+
+ if (endFold && !endFold.range.isEnd(endRow, endColumn))
+ this.removeFold(endFold);
+ var folds = this.getFoldsInRange(fold.range);
+ if (folds.length > 0) {
+ this.removeFolds(folds);
+ folds.forEach(function(subFold) {
+ fold.addSubFold(subFold);
+ });
+ }
+
+ for (var i = 0; i < foldData.length; i++) {
+ var foldLine = foldData[i];
+ if (endRow == foldLine.start.row) {
+ foldLine.addFold(fold);
+ added = true;
+ break;
+ } else if (startRow == foldLine.end.row) {
+ foldLine.addFold(fold);
+ added = true;
+ if (!fold.sameRow) {
+ var foldLineNext = foldData[i + 1];
+ if (foldLineNext && foldLineNext.start.row == endRow) {
+ foldLine.merge(foldLineNext);
+ break;
+ }
+ }
+ break;
+ } else if (endRow <= foldLine.start.row) {
+ break;
+ }
+ }
+
+ if (!added)
+ foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
+
+ if (this.$useWrapMode)
+ this.$updateWrapData(foldLine.start.row, foldLine.start.row);
+ else
+ this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
+ this.$modified = true;
+ this._signal("changeFold", { data: fold, action: "add" });
+
+ return fold;
+ };
+
+ this.addFolds = function(folds) {
+ folds.forEach(function(fold) {
+ this.addFold(fold);
+ }, this);
+ };
+
+ this.removeFold = function(fold) {
+ var foldLine = fold.foldLine;
+ var startRow = foldLine.start.row;
+ var endRow = foldLine.end.row;
+
+ var foldLines = this.$foldData;
+ var folds = foldLine.folds;
+ if (folds.length == 1) {
+ foldLines.splice(foldLines.indexOf(foldLine), 1);
+ } else
+ if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
+ folds.pop();
+ foldLine.end.row = folds[folds.length - 1].end.row;
+ foldLine.end.column = folds[folds.length - 1].end.column;
+ } else
+ if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
+ folds.shift();
+ foldLine.start.row = folds[0].start.row;
+ foldLine.start.column = folds[0].start.column;
+ } else
+ if (fold.sameRow) {
+ folds.splice(folds.indexOf(fold), 1);
+ } else
+ {
+ var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
+ folds = newFoldLine.folds;
+ folds.shift();
+ newFoldLine.start.row = folds[0].start.row;
+ newFoldLine.start.column = folds[0].start.column;
+ }
+
+ if (!this.$updating) {
+ if (this.$useWrapMode)
+ this.$updateWrapData(startRow, endRow);
+ else
+ this.$updateRowLengthCache(startRow, endRow);
+ }
+ this.$modified = true;
+ this._signal("changeFold", { data: fold, action: "remove" });
+ };
+
+ this.removeFolds = function(folds) {
+ var cloneFolds = [];
+ for (var i = 0; i < folds.length; i++) {
+ cloneFolds.push(folds[i]);
+ }
+
+ cloneFolds.forEach(function(fold) {
+ this.removeFold(fold);
+ }, this);
+ this.$modified = true;
+ };
+
+ this.expandFold = function(fold) {
+ this.removeFold(fold);
+ fold.subFolds.forEach(function(subFold) {
+ fold.restoreRange(subFold);
+ this.addFold(subFold);
+ }, this);
+ if (fold.collapseChildren > 0) {
+ this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1);
+ }
+ fold.subFolds = [];
+ };
+
+ this.expandFolds = function(folds) {
+ folds.forEach(function(fold) {
+ this.expandFold(fold);
+ }, this);
+ };
+
+ this.unfold = function(location, expandInner) {
+ var range, folds;
+ if (location == null) {
+ range = new Range(0, 0, this.getLength(), 0);
+ expandInner = true;
+ } else if (typeof location == "number")
+ range = new Range(location, 0, location, this.getLine(location).length);
+ else if ("row" in location)
+ range = Range.fromPoints(location, location);
+ else
+ range = location;
+
+ folds = this.getFoldsInRangeList(range);
+ if (expandInner) {
+ this.removeFolds(folds);
+ } else {
+ var subFolds = folds;
+ while (subFolds.length) {
+ this.expandFolds(subFolds);
+ subFolds = this.getFoldsInRangeList(range);
+ }
+ }
+ if (folds.length)
+ return folds;
+ };
+ this.isRowFolded = function(docRow, startFoldRow) {
+ return !!this.getFoldLine(docRow, startFoldRow);
+ };
+
+ this.getRowFoldEnd = function(docRow, startFoldRow) {
+ var foldLine = this.getFoldLine(docRow, startFoldRow);
+ return foldLine ? foldLine.end.row : docRow;
+ };
+
+ this.getRowFoldStart = function(docRow, startFoldRow) {
+ var foldLine = this.getFoldLine(docRow, startFoldRow);
+ return foldLine ? foldLine.start.row : docRow;
+ };
+
+ this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
+ if (startRow == null)
+ startRow = foldLine.start.row;
+ if (startColumn == null)
+ startColumn = 0;
+ if (endRow == null)
+ endRow = foldLine.end.row;
+ if (endColumn == null)
+ endColumn = this.getLine(endRow).length;
+ var doc = this.doc;
+ var textLine = "";
+
+ foldLine.walk(function(placeholder, row, column, lastColumn) {
+ if (row < startRow)
+ return;
+ if (row == startRow) {
+ if (column < startColumn)
+ return;
+ lastColumn = Math.max(startColumn, lastColumn);
+ }
+
+ if (placeholder != null) {
+ textLine += placeholder;
+ } else {
+ textLine += doc.getLine(row).substring(lastColumn, column);
+ }
+ }, endRow, endColumn);
+ return textLine;
+ };
+
+ this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
+ var foldLine = this.getFoldLine(row);
+
+ if (!foldLine) {
+ var line;
+ line = this.doc.getLine(row);
+ return line.substring(startColumn || 0, endColumn || line.length);
+ } else {
+ return this.getFoldDisplayLine(
+ foldLine, row, endColumn, startRow, startColumn);
+ }
+ };
+
+ this.$cloneFoldData = function() {
+ var fd = [];
+ fd = this.$foldData.map(function(foldLine) {
+ var folds = foldLine.folds.map(function(fold) {
+ return fold.clone();
+ });
+ return new FoldLine(fd, folds);
+ });
+
+ return fd;
+ };
+
+ this.toggleFold = function(tryToUnfold) {
+ var selection = this.selection;
+ var range = selection.getRange();
+ var fold;
+ var bracketPos;
+
+ if (range.isEmpty()) {
+ var cursor = range.start;
+ fold = this.getFoldAt(cursor.row, cursor.column);
+
+ if (fold) {
+ this.expandFold(fold);
+ return;
+ } else if (bracketPos = this.findMatchingBracket(cursor)) {
+ if (range.comparePoint(bracketPos) == 1) {
+ range.end = bracketPos;
+ } else {
+ range.start = bracketPos;
+ range.start.column++;
+ range.end.column--;
+ }
+ } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
+ if (range.comparePoint(bracketPos) == 1)
+ range.end = bracketPos;
+ else
+ range.start = bracketPos;
+
+ range.start.column++;
+ } else {
+ range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
+ }
+ } else {
+ var folds = this.getFoldsInRange(range);
+ if (tryToUnfold && folds.length) {
+ this.expandFolds(folds);
+ return;
+ } else if (folds.length == 1 ) {
+ fold = folds[0];
+ }
+ }
+
+ if (!fold)
+ fold = this.getFoldAt(range.start.row, range.start.column);
+
+ if (fold && fold.range.toString() == range.toString()) {
+ this.expandFold(fold);
+ return;
+ }
+
+ var placeholder = "...";
+ if (!range.isMultiLine()) {
+ placeholder = this.getTextRange(range);
+ if (placeholder.length < 4)
+ return;
+ placeholder = placeholder.trim().substring(0, 2) + "..";
+ }
+
+ this.addFold(placeholder, range);
+ };
+
+ this.getCommentFoldRange = function(row, column, dir) {
+ var iterator = new TokenIterator(this, row, column);
+ var token = iterator.getCurrentToken();
+ if (token && /^comment|string/.test(token.type)) {
+ var range = new Range();
+ var re = new RegExp(token.type.replace(/\..*/, "\\."));
+ if (dir != 1) {
+ do {
+ token = iterator.stepBackward();
+ } while (token && re.test(token.type));
+ iterator.stepForward();
+ }
+
+ range.start.row = iterator.getCurrentTokenRow();
+ range.start.column = iterator.getCurrentTokenColumn() + 2;
+
+ iterator = new TokenIterator(this, row, column);
+
+ if (dir != -1) {
+ do {
+ token = iterator.stepForward();
+ } while (token && re.test(token.type));
+ token = iterator.stepBackward();
+ } else
+ token = iterator.getCurrentToken();
+
+ range.end.row = iterator.getCurrentTokenRow();
+ range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
+ return range;
+ }
+ };
+
+ this.foldAll = function(startRow, endRow, depth) {
+ if (depth == undefined)
+ depth = 100000; // JSON.stringify doesn't hanle Infinity
+ var foldWidgets = this.foldWidgets;
+ if (!foldWidgets)
+ return; // mode doesn't support folding
+ endRow = endRow || this.getLength();
+ startRow = startRow || 0;
+ for (var row = startRow; row < endRow; row++) {
+ if (foldWidgets[row] == null)
+ foldWidgets[row] = this.getFoldWidget(row);
+ if (foldWidgets[row] != "start")
+ continue;
+
+ var range = this.getFoldWidgetRange(row);
+ if (range && range.isMultiLine()
+ && range.end.row <= endRow
+ && range.start.row >= startRow
+ ) {
+ row = range.end.row;
+ try {
+ var fold = this.addFold("...", range);
+ if (fold)
+ fold.collapseChildren = depth;
+ } catch(e) {}
+ }
+ }
+ };
+ this.$foldStyles = {
+ "manual": 1,
+ "markbegin": 1,
+ "markbeginend": 1
+ };
+ this.$foldStyle = "markbegin";
+ this.setFoldStyle = function(style) {
+ if (!this.$foldStyles[style])
+ throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
+
+ if (this.$foldStyle == style)
+ return;
+
+ this.$foldStyle = style;
+
+ if (style == "manual")
+ this.unfold();
+ var mode = this.$foldMode;
+ this.$setFolding(null);
+ this.$setFolding(mode);
+ };
+
+ this.$setFolding = function(foldMode) {
+ if (this.$foldMode == foldMode)
+ return;
+
+ this.$foldMode = foldMode;
+
+ this.off('change', this.$updateFoldWidgets);
+ this.off('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
+ this._signal("changeAnnotation");
+
+ if (!foldMode || this.$foldStyle == "manual") {
+ this.foldWidgets = null;
+ return;
+ }
+
+ this.foldWidgets = [];
+ this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
+ this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
+
+ this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
+ this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);
+ this.on('change', this.$updateFoldWidgets);
+ this.on('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
+ };
+
+ this.getParentFoldRangeData = function (row, ignoreCurrent) {
+ var fw = this.foldWidgets;
+ if (!fw || (ignoreCurrent && fw[row]))
+ return {};
+
+ var i = row - 1, firstRange;
+ while (i >= 0) {
+ var c = fw[i];
+ if (c == null)
+ c = fw[i] = this.getFoldWidget(i);
+
+ if (c == "start") {
+ var range = this.getFoldWidgetRange(i);
+ if (!firstRange)
+ firstRange = range;
+ if (range && range.end.row >= row)
+ break;
+ }
+ i--;
+ }
+
+ return {
+ range: i !== -1 && range,
+ firstRange: firstRange
+ };
+ };
+
+ this.onFoldWidgetClick = function(row, e) {
+ e = e.domEvent;
+ var options = {
+ children: e.shiftKey,
+ all: e.ctrlKey || e.metaKey,
+ siblings: e.altKey
+ };
+
+ var range = this.$toggleFoldWidget(row, options);
+ if (!range) {
+ var el = (e.target || e.srcElement);
+ if (el && /ace_fold-widget/.test(el.className))
+ el.className += " ace_invalid";
+ }
+ };
+
+ this.$toggleFoldWidget = function(row, options) {
+ if (!this.getFoldWidget)
+ return;
+ var type = this.getFoldWidget(row);
+ var line = this.getLine(row);
+
+ var dir = type === "end" ? -1 : 1;
+ var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir);
+
+ if (fold) {
+ if (options.children || options.all)
+ this.removeFold(fold);
+ else
+ this.expandFold(fold);
+ return;
+ }
+
+ var range = this.getFoldWidgetRange(row, true);
+ if (range && !range.isMultiLine()) {
+ fold = this.getFoldAt(range.start.row, range.start.column, 1);
+ if (fold && range.isEqual(fold.range)) {
+ this.removeFold(fold);
+ return;
+ }
+ }
+
+ if (options.siblings) {
+ var data = this.getParentFoldRangeData(row);
+ if (data.range) {
+ var startRow = data.range.start.row + 1;
+ var endRow = data.range.end.row;
+ }
+ this.foldAll(startRow, endRow, options.all ? 10000 : 0);
+ } else if (options.children) {
+ endRow = range ? range.end.row : this.getLength();
+ this.foldAll(row + 1, endRow, options.all ? 10000 : 0);
+ } else if (range) {
+ if (options.all)
+ range.collapseChildren = 10000;
+ this.addFold("...", range);
+ }
+
+ return range;
+ };
+
+
+
+ this.toggleFoldWidget = function(toggleParent) {
+ var row = this.selection.getCursor().row;
+ row = this.getRowFoldStart(row);
+ var range = this.$toggleFoldWidget(row, {});
+
+ if (range)
+ return;
+ var data = this.getParentFoldRangeData(row, true);
+ range = data.range || data.firstRange;
+
+ if (range) {
+ row = range.start.row;
+ var fold = this.getFoldAt(row, this.getLine(row).length, 1);
+
+ if (fold) {
+ this.removeFold(fold);
+ } else {
+ this.addFold("...", range);
+ }
+ }
+ };
+
+ this.updateFoldWidgets = function(delta) {
+ var firstRow = delta.start.row;
+ var len = delta.end.row - firstRow;
+
+ if (len === 0) {
+ this.foldWidgets[firstRow] = null;
+ } else if (delta.action == 'remove') {
+ this.foldWidgets.splice(firstRow, len + 1, null);
+ } else {
+ var args = Array(len + 1);
+ args.unshift(firstRow, 1);
+ this.foldWidgets.splice.apply(this.foldWidgets, args);
+ }
+ };
+ this.tokenizerUpdateFoldWidgets = function(e) {
+ var rows = e.data;
+ if (rows.first != rows.last) {
+ if (this.foldWidgets.length > rows.first)
+ this.foldWidgets.splice(rows.first, this.foldWidgets.length);
+ }
+ };
+}
+
+exports.Folding = Folding;
+
+});
+
+ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var TokenIterator = acequire("../token_iterator").TokenIterator;
+var Range = acequire("../range").Range;
+
+
+function BracketMatch() {
+
+ this.findMatchingBracket = function(position, chr) {
+ if (position.column == 0) return null;
+
+ var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1);
+ if (charBeforeCursor == "") return null;
+
+ var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
+ if (!match)
+ return null;
+
+ if (match[1])
+ return this.$findClosingBracket(match[1], position);
+ else
+ return this.$findOpeningBracket(match[2], position);
+ };
+
+ this.getBracketRange = function(pos) {
+ var line = this.getLine(pos.row);
+ var before = true, range;
+
+ var chr = line.charAt(pos.column-1);
+ var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
+ if (!match) {
+ chr = line.charAt(pos.column);
+ pos = {row: pos.row, column: pos.column + 1};
+ match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
+ before = false;
+ }
+ if (!match)
+ return null;
+
+ if (match[1]) {
+ var bracketPos = this.$findClosingBracket(match[1], pos);
+ if (!bracketPos)
+ return null;
+ range = Range.fromPoints(pos, bracketPos);
+ if (!before) {
+ range.end.column++;
+ range.start.column--;
+ }
+ range.cursor = range.end;
+ } else {
+ var bracketPos = this.$findOpeningBracket(match[2], pos);
+ if (!bracketPos)
+ return null;
+ range = Range.fromPoints(bracketPos, pos);
+ if (!before) {
+ range.start.column++;
+ range.end.column--;
+ }
+ range.cursor = range.start;
+ }
+
+ return range;
+ };
+
+ this.$brackets = {
+ ")": "(",
+ "(": ")",
+ "]": "[",
+ "[": "]",
+ "{": "}",
+ "}": "{"
+ };
+
+ this.$findOpeningBracket = function(bracket, position, typeRe) {
+ var openBracket = this.$brackets[bracket];
+ var depth = 1;
+
+ var iterator = new TokenIterator(this, position.row, position.column);
+ var token = iterator.getCurrentToken();
+ if (!token)
+ token = iterator.stepForward();
+ if (!token)
+ return;
+
+ if (!typeRe){
+ typeRe = new RegExp(
+ "(\\.?" +
+ token.type.replace(".", "\\.").replace("rparen", ".paren")
+ .replace(/\b(?:end)\b/, "(?:start|begin|end)")
+ + ")+"
+ );
+ }
+ var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
+ var value = token.value;
+
+ while (true) {
+
+ while (valueIndex >= 0) {
+ var chr = value.charAt(valueIndex);
+ if (chr == openBracket) {
+ depth -= 1;
+ if (depth == 0) {
+ return {row: iterator.getCurrentTokenRow(),
+ column: valueIndex + iterator.getCurrentTokenColumn()};
+ }
+ }
+ else if (chr == bracket) {
+ depth += 1;
+ }
+ valueIndex -= 1;
+ }
+ do {
+ token = iterator.stepBackward();
+ } while (token && !typeRe.test(token.type));
+
+ if (token == null)
+ break;
+
+ value = token.value;
+ valueIndex = value.length - 1;
+ }
+
+ return null;
+ };
+
+ this.$findClosingBracket = function(bracket, position, typeRe) {
+ var closingBracket = this.$brackets[bracket];
+ var depth = 1;
+
+ var iterator = new TokenIterator(this, position.row, position.column);
+ var token = iterator.getCurrentToken();
+ if (!token)
+ token = iterator.stepForward();
+ if (!token)
+ return;
+
+ if (!typeRe){
+ typeRe = new RegExp(
+ "(\\.?" +
+ token.type.replace(".", "\\.").replace("lparen", ".paren")
+ .replace(/\b(?:start|begin)\b/, "(?:start|begin|end)")
+ + ")+"
+ );
+ }
+ var valueIndex = position.column - iterator.getCurrentTokenColumn();
+
+ while (true) {
+
+ var value = token.value;
+ var valueLength = value.length;
+ while (valueIndex < valueLength) {
+ var chr = value.charAt(valueIndex);
+ if (chr == closingBracket) {
+ depth -= 1;
+ if (depth == 0) {
+ return {row: iterator.getCurrentTokenRow(),
+ column: valueIndex + iterator.getCurrentTokenColumn()};
+ }
+ }
+ else if (chr == bracket) {
+ depth += 1;
+ }
+ valueIndex += 1;
+ }
+ do {
+ token = iterator.stepForward();
+ } while (token && !typeRe.test(token.type));
+
+ if (token == null)
+ break;
+
+ valueIndex = 0;
+ }
+
+ return null;
+ };
+}
+exports.BracketMatch = BracketMatch;
+
+});
+
+ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var lang = acequire("./lib/lang");
+var config = acequire("./config");
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var Selection = acequire("./selection").Selection;
+var TextMode = acequire("./mode/text").Mode;
+var Range = acequire("./range").Range;
+var Document = acequire("./document").Document;
+var BackgroundTokenizer = acequire("./background_tokenizer").BackgroundTokenizer;
+var SearchHighlight = acequire("./search_highlight").SearchHighlight;
+
+var EditSession = function(text, mode) {
+ this.$breakpoints = [];
+ this.$decorations = [];
+ this.$frontMarkers = {};
+ this.$backMarkers = {};
+ this.$markerId = 1;
+ this.$undoSelect = true;
+
+ this.$foldData = [];
+ this.$foldData.toString = function() {
+ return this.join("\n");
+ };
+ this.on("changeFold", this.onChangeFold.bind(this));
+ this.$onChange = this.onChange.bind(this);
+
+ if (typeof text != "object" || !text.getLine)
+ text = new Document(text);
+
+ this.setDocument(text);
+ this.selection = new Selection(this);
+
+ config.resetOptions(this);
+ this.setMode(mode);
+ config._signal("session", this);
+};
+
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+ this.setDocument = function(doc) {
+ if (this.doc)
+ this.doc.removeListener("change", this.$onChange);
+
+ this.doc = doc;
+ doc.on("change", this.$onChange);
+
+ if (this.bgTokenizer)
+ this.bgTokenizer.setDocument(this.getDocument());
+
+ this.resetCaches();
+ };
+ this.getDocument = function() {
+ return this.doc;
+ };
+ this.$resetRowCache = function(docRow) {
+ if (!docRow) {
+ this.$docRowCache = [];
+ this.$screenRowCache = [];
+ return;
+ }
+ var l = this.$docRowCache.length;
+ var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
+ if (l > i) {
+ this.$docRowCache.splice(i, l);
+ this.$screenRowCache.splice(i, l);
+ }
+ };
+
+ this.$getRowCacheIndex = function(cacheArray, val) {
+ var low = 0;
+ var hi = cacheArray.length - 1;
+
+ while (low <= hi) {
+ var mid = (low + hi) >> 1;
+ var c = cacheArray[mid];
+
+ if (val > c)
+ low = mid + 1;
+ else if (val < c)
+ hi = mid - 1;
+ else
+ return mid;
+ }
+
+ return low -1;
+ };
+
+ this.resetCaches = function() {
+ this.$modified = true;
+ this.$wrapData = [];
+ this.$rowLengthCache = [];
+ this.$resetRowCache(0);
+ if (this.bgTokenizer)
+ this.bgTokenizer.start(0);
+ };
+
+ this.onChangeFold = function(e) {
+ var fold = e.data;
+ this.$resetRowCache(fold.start.row);
+ };
+
+ this.onChange = function(delta) {
+ this.$modified = true;
+
+ this.$resetRowCache(delta.start.row);
+
+ var removedFolds = this.$updateInternalDataOnChange(delta);
+ if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
+ this.$deltasDoc.push(delta);
+ if (removedFolds && removedFolds.length != 0) {
+ this.$deltasFold.push({
+ action: "removeFolds",
+ folds: removedFolds
+ });
+ }
+
+ this.$informUndoManager.schedule();
+ }
+
+ this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);
+ this._signal("change", delta);
+ };
+ this.setValue = function(text) {
+ this.doc.setValue(text);
+ this.selection.moveTo(0, 0);
+
+ this.$resetRowCache(0);
+ this.$deltas = [];
+ this.$deltasDoc = [];
+ this.$deltasFold = [];
+ this.setUndoManager(this.$undoManager);
+ this.getUndoManager().reset();
+ };
+ this.getValue =
+ this.toString = function() {
+ return this.doc.getValue();
+ };
+ this.getSelection = function() {
+ return this.selection;
+ };
+ this.getState = function(row) {
+ return this.bgTokenizer.getState(row);
+ };
+ this.getTokens = function(row) {
+ return this.bgTokenizer.getTokens(row);
+ };
+ this.getTokenAt = function(row, column) {
+ var tokens = this.bgTokenizer.getTokens(row);
+ var token, c = 0;
+ if (column == null) {
+ i = tokens.length - 1;
+ c = this.getLine(row).length;
+ } else {
+ for (var i = 0; i < tokens.length; i++) {
+ c += tokens[i].value.length;
+ if (c >= column)
+ break;
+ }
+ }
+ token = tokens[i];
+ if (!token)
+ return null;
+ token.index = i;
+ token.start = c - token.value.length;
+ return token;
+ };
+ this.setUndoManager = function(undoManager) {
+ this.$undoManager = undoManager;
+ this.$deltas = [];
+ this.$deltasDoc = [];
+ this.$deltasFold = [];
+
+ if (this.$informUndoManager)
+ this.$informUndoManager.cancel();
+
+ if (undoManager) {
+ var self = this;
+
+ this.$syncInformUndoManager = function() {
+ self.$informUndoManager.cancel();
+
+ if (self.$deltasFold.length) {
+ self.$deltas.push({
+ group: "fold",
+ deltas: self.$deltasFold
+ });
+ self.$deltasFold = [];
+ }
+
+ if (self.$deltasDoc.length) {
+ self.$deltas.push({
+ group: "doc",
+ deltas: self.$deltasDoc
+ });
+ self.$deltasDoc = [];
+ }
+
+ if (self.$deltas.length > 0) {
+ undoManager.execute({
+ action: "aceupdate",
+ args: [self.$deltas, self],
+ merge: self.mergeUndoDeltas
+ });
+ }
+ self.mergeUndoDeltas = false;
+ self.$deltas = [];
+ };
+ this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);
+ }
+ };
+ this.markUndoGroup = function() {
+ if (this.$syncInformUndoManager)
+ this.$syncInformUndoManager();
+ };
+
+ this.$defaultUndoManager = {
+ undo: function() {},
+ redo: function() {},
+ reset: function() {}
+ };
+ this.getUndoManager = function() {
+ return this.$undoManager || this.$defaultUndoManager;
+ };
+ this.getTabString = function() {
+ if (this.getUseSoftTabs()) {
+ return lang.stringRepeat(" ", this.getTabSize());
+ } else {
+ return "\t";
+ }
+ };
+ this.setUseSoftTabs = function(val) {
+ this.setOption("useSoftTabs", val);
+ };
+ this.getUseSoftTabs = function() {
+ return this.$useSoftTabs && !this.$mode.$indentWithTabs;
+ };
+ this.setTabSize = function(tabSize) {
+ this.setOption("tabSize", tabSize);
+ };
+ this.getTabSize = function() {
+ return this.$tabSize;
+ };
+ this.isTabStop = function(position) {
+ return this.$useSoftTabs && (position.column % this.$tabSize === 0);
+ };
+
+ this.$overwrite = false;
+ this.setOverwrite = function(overwrite) {
+ this.setOption("overwrite", overwrite);
+ };
+ this.getOverwrite = function() {
+ return this.$overwrite;
+ };
+ this.toggleOverwrite = function() {
+ this.setOverwrite(!this.$overwrite);
+ };
+ this.addGutterDecoration = function(row, className) {
+ if (!this.$decorations[row])
+ this.$decorations[row] = "";
+ this.$decorations[row] += " " + className;
+ this._signal("changeBreakpoint", {});
+ };
+ this.removeGutterDecoration = function(row, className) {
+ this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
+ this._signal("changeBreakpoint", {});
+ };
+ this.getBreakpoints = function() {
+ return this.$breakpoints;
+ };
+ this.setBreakpoints = function(rows) {
+ this.$breakpoints = [];
+ for (var i=0; i 0)
+ inToken = !!line.charAt(column - 1).match(this.tokenRe);
+
+ if (!inToken)
+ inToken = !!line.charAt(column).match(this.tokenRe);
+
+ if (inToken)
+ var re = this.tokenRe;
+ else if (/^\s+$/.test(line.slice(column-1, column+1)))
+ var re = /\s/;
+ else
+ var re = this.nonTokenRe;
+
+ var start = column;
+ if (start > 0) {
+ do {
+ start--;
+ }
+ while (start >= 0 && line.charAt(start).match(re));
+ start++;
+ }
+
+ var end = column;
+ while (end < line.length && line.charAt(end).match(re)) {
+ end++;
+ }
+
+ return new Range(row, start, row, end);
+ };
+ this.getAWordRange = function(row, column) {
+ var wordRange = this.getWordRange(row, column);
+ var line = this.getLine(wordRange.end.row);
+
+ while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
+ wordRange.end.column += 1;
+ }
+ return wordRange;
+ };
+ this.setNewLineMode = function(newLineMode) {
+ this.doc.setNewLineMode(newLineMode);
+ };
+ this.getNewLineMode = function() {
+ return this.doc.getNewLineMode();
+ };
+ this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); };
+ this.getUseWorker = function() { return this.$useWorker; };
+ this.onReloadTokenizer = function(e) {
+ var rows = e.data;
+ this.bgTokenizer.start(rows.first);
+ this._signal("tokenizerUpdate", e);
+ };
+
+ this.$modes = {};
+ this.$mode = null;
+ this.$modeId = null;
+ this.setMode = function(mode, cb) {
+ if (mode && typeof mode === "object") {
+ if (mode.getTokenizer)
+ return this.$onChangeMode(mode);
+ var options = mode;
+ var path = options.path;
+ } else {
+ path = mode || "ace/mode/text";
+ }
+ if (!this.$modes["ace/mode/text"])
+ this.$modes["ace/mode/text"] = new TextMode();
+
+ if (this.$modes[path] && !options) {
+ this.$onChangeMode(this.$modes[path]);
+ cb && cb();
+ return;
+ }
+ this.$modeId = path;
+ config.loadModule(["mode", path], function(m) {
+ if (this.$modeId !== path)
+ return cb && cb();
+ if (this.$modes[path] && !options) {
+ this.$onChangeMode(this.$modes[path]);
+ } else if (m && m.Mode) {
+ m = new m.Mode(options);
+ if (!options) {
+ this.$modes[path] = m;
+ m.$id = path;
+ }
+ this.$onChangeMode(m);
+ }
+ cb && cb();
+ }.bind(this));
+ if (!this.$mode)
+ this.$onChangeMode(this.$modes["ace/mode/text"], true);
+ };
+
+ this.$onChangeMode = function(mode, $isPlaceholder) {
+ if (!$isPlaceholder)
+ this.$modeId = mode.$id;
+ if (this.$mode === mode)
+ return;
+
+ this.$mode = mode;
+
+ this.$stopWorker();
+
+ if (this.$useWorker)
+ this.$startWorker();
+
+ var tokenizer = mode.getTokenizer();
+
+ if(tokenizer.addEventListener !== undefined) {
+ var onReloadTokenizer = this.onReloadTokenizer.bind(this);
+ tokenizer.addEventListener("update", onReloadTokenizer);
+ }
+
+ if (!this.bgTokenizer) {
+ this.bgTokenizer = new BackgroundTokenizer(tokenizer);
+ var _self = this;
+ this.bgTokenizer.addEventListener("update", function(e) {
+ _self._signal("tokenizerUpdate", e);
+ });
+ } else {
+ this.bgTokenizer.setTokenizer(tokenizer);
+ }
+
+ this.bgTokenizer.setDocument(this.getDocument());
+
+ this.tokenRe = mode.tokenRe;
+ this.nonTokenRe = mode.nonTokenRe;
+
+
+ if (!$isPlaceholder) {
+ if (mode.attachToSession)
+ mode.attachToSession(this);
+ this.$options.wrapMethod.set.call(this, this.$wrapMethod);
+ this.$setFolding(mode.foldingRules);
+ this.bgTokenizer.start(0);
+ this._emit("changeMode");
+ }
+ };
+
+ this.$stopWorker = function() {
+ if (this.$worker) {
+ this.$worker.terminate();
+ this.$worker = null;
+ }
+ };
+
+ this.$startWorker = function() {
+ try {
+ this.$worker = this.$mode.createWorker(this);
+ } catch (e) {
+ config.warn("Could not load worker", e);
+ this.$worker = null;
+ }
+ };
+ this.getMode = function() {
+ return this.$mode;
+ };
+
+ this.$scrollTop = 0;
+ this.setScrollTop = function(scrollTop) {
+ if (this.$scrollTop === scrollTop || isNaN(scrollTop))
+ return;
+
+ this.$scrollTop = scrollTop;
+ this._signal("changeScrollTop", scrollTop);
+ };
+ this.getScrollTop = function() {
+ return this.$scrollTop;
+ };
+
+ this.$scrollLeft = 0;
+ this.setScrollLeft = function(scrollLeft) {
+ if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
+ return;
+
+ this.$scrollLeft = scrollLeft;
+ this._signal("changeScrollLeft", scrollLeft);
+ };
+ this.getScrollLeft = function() {
+ return this.$scrollLeft;
+ };
+ this.getScreenWidth = function() {
+ this.$computeWidth();
+ if (this.lineWidgets)
+ return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);
+ return this.screenWidth;
+ };
+
+ this.getLineWidgetMaxWidth = function() {
+ if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth;
+ var width = 0;
+ this.lineWidgets.forEach(function(w) {
+ if (w && w.screenWidth > width)
+ width = w.screenWidth;
+ });
+ return this.lineWidgetWidth = width;
+ };
+
+ this.$computeWidth = function(force) {
+ if (this.$modified || force) {
+ this.$modified = false;
+
+ if (this.$useWrapMode)
+ return this.screenWidth = this.$wrapLimit;
+
+ var lines = this.doc.getAllLines();
+ var cache = this.$rowLengthCache;
+ var longestScreenLine = 0;
+ var foldIndex = 0;
+ var foldLine = this.$foldData[foldIndex];
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
+ var len = lines.length;
+
+ for (var i = 0; i < len; i++) {
+ if (i > foldStart) {
+ i = foldLine.end.row + 1;
+ if (i >= len)
+ break;
+ foldLine = this.$foldData[foldIndex++];
+ foldStart = foldLine ? foldLine.start.row : Infinity;
+ }
+
+ if (cache[i] == null)
+ cache[i] = this.$getStringScreenWidth(lines[i])[0];
+
+ if (cache[i] > longestScreenLine)
+ longestScreenLine = cache[i];
+ }
+ this.screenWidth = longestScreenLine;
+ }
+ };
+ this.getLine = function(row) {
+ return this.doc.getLine(row);
+ };
+ this.getLines = function(firstRow, lastRow) {
+ return this.doc.getLines(firstRow, lastRow);
+ };
+ this.getLength = function() {
+ return this.doc.getLength();
+ };
+ this.getTextRange = function(range) {
+ return this.doc.getTextRange(range || this.selection.getRange());
+ };
+ this.insert = function(position, text) {
+ return this.doc.insert(position, text);
+ };
+ this.remove = function(range) {
+ return this.doc.remove(range);
+ };
+ this.removeFullLines = function(firstRow, lastRow){
+ return this.doc.removeFullLines(firstRow, lastRow);
+ };
+ this.undoChanges = function(deltas, dontSelect) {
+ if (!deltas.length)
+ return;
+
+ this.$fromUndo = true;
+ var lastUndoRange = null;
+ for (var i = deltas.length - 1; i != -1; i--) {
+ var delta = deltas[i];
+ if (delta.group == "doc") {
+ this.doc.revertDeltas(delta.deltas);
+ lastUndoRange =
+ this.$getUndoSelection(delta.deltas, true, lastUndoRange);
+ } else {
+ delta.deltas.forEach(function(foldDelta) {
+ this.addFolds(foldDelta.folds);
+ }, this);
+ }
+ }
+ this.$fromUndo = false;
+ lastUndoRange &&
+ this.$undoSelect &&
+ !dontSelect &&
+ this.selection.setSelectionRange(lastUndoRange);
+ return lastUndoRange;
+ };
+ this.redoChanges = function(deltas, dontSelect) {
+ if (!deltas.length)
+ return;
+
+ this.$fromUndo = true;
+ var lastUndoRange = null;
+ for (var i = 0; i < deltas.length; i++) {
+ var delta = deltas[i];
+ if (delta.group == "doc") {
+ this.doc.applyDeltas(delta.deltas);
+ lastUndoRange =
+ this.$getUndoSelection(delta.deltas, false, lastUndoRange);
+ }
+ }
+ this.$fromUndo = false;
+ lastUndoRange &&
+ this.$undoSelect &&
+ !dontSelect &&
+ this.selection.setSelectionRange(lastUndoRange);
+ return lastUndoRange;
+ };
+ this.setUndoSelect = function(enable) {
+ this.$undoSelect = enable;
+ };
+
+ this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
+ function isInsert(delta) {
+ return isUndo ? delta.action !== "insert" : delta.action === "insert";
+ }
+
+ var delta = deltas[0];
+ var range, point;
+ var lastDeltaIsInsert = false;
+ if (isInsert(delta)) {
+ range = Range.fromPoints(delta.start, delta.end);
+ lastDeltaIsInsert = true;
+ } else {
+ range = Range.fromPoints(delta.start, delta.start);
+ lastDeltaIsInsert = false;
+ }
+
+ for (var i = 1; i < deltas.length; i++) {
+ delta = deltas[i];
+ if (isInsert(delta)) {
+ point = delta.start;
+ if (range.compare(point.row, point.column) == -1) {
+ range.setStart(point);
+ }
+ point = delta.end;
+ if (range.compare(point.row, point.column) == 1) {
+ range.setEnd(point);
+ }
+ lastDeltaIsInsert = true;
+ } else {
+ point = delta.start;
+ if (range.compare(point.row, point.column) == -1) {
+ range = Range.fromPoints(delta.start, delta.start);
+ }
+ lastDeltaIsInsert = false;
+ }
+ }
+ if (lastUndoRange != null) {
+ if (Range.comparePoints(lastUndoRange.start, range.start) === 0) {
+ lastUndoRange.start.column += range.end.column - range.start.column;
+ lastUndoRange.end.column += range.end.column - range.start.column;
+ }
+
+ var cmp = lastUndoRange.compareRange(range);
+ if (cmp == 1) {
+ range.setStart(lastUndoRange.start);
+ } else if (cmp == -1) {
+ range.setEnd(lastUndoRange.end);
+ }
+ }
+
+ return range;
+ };
+ this.replace = function(range, text) {
+ return this.doc.replace(range, text);
+ };
+ this.moveText = function(fromRange, toPosition, copy) {
+ var text = this.getTextRange(fromRange);
+ var folds = this.getFoldsInRange(fromRange);
+
+ var toRange = Range.fromPoints(toPosition, toPosition);
+ if (!copy) {
+ this.remove(fromRange);
+ var rowDiff = fromRange.start.row - fromRange.end.row;
+ var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
+ if (collDiff) {
+ if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
+ toRange.start.column += collDiff;
+ if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
+ toRange.end.column += collDiff;
+ }
+ if (rowDiff && toRange.start.row >= fromRange.end.row) {
+ toRange.start.row += rowDiff;
+ toRange.end.row += rowDiff;
+ }
+ }
+
+ toRange.end = this.insert(toRange.start, text);
+ if (folds.length) {
+ var oldStart = fromRange.start;
+ var newStart = toRange.start;
+ var rowDiff = newStart.row - oldStart.row;
+ var collDiff = newStart.column - oldStart.column;
+ this.addFolds(folds.map(function(x) {
+ x = x.clone();
+ if (x.start.row == oldStart.row)
+ x.start.column += collDiff;
+ if (x.end.row == oldStart.row)
+ x.end.column += collDiff;
+ x.start.row += rowDiff;
+ x.end.row += rowDiff;
+ return x;
+ }));
+ }
+
+ return toRange;
+ };
+ this.indentRows = function(startRow, endRow, indentString) {
+ indentString = indentString.replace(/\t/g, this.getTabString());
+ for (var row=startRow; row<=endRow; row++)
+ this.doc.insertInLine({row: row, column: 0}, indentString);
+ };
+ this.outdentRows = function (range) {
+ var rowRange = range.collapseRows();
+ var deleteRange = new Range(0, 0, 0, 0);
+ var size = this.getTabSize();
+
+ for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
+ var line = this.getLine(i);
+
+ deleteRange.start.row = i;
+ deleteRange.end.row = i;
+ for (var j = 0; j < size; ++j)
+ if (line.charAt(j) != ' ')
+ break;
+ if (j < size && line.charAt(j) == '\t') {
+ deleteRange.start.column = j;
+ deleteRange.end.column = j + 1;
+ } else {
+ deleteRange.start.column = 0;
+ deleteRange.end.column = j;
+ }
+ this.remove(deleteRange);
+ }
+ };
+
+ this.$moveLines = function(firstRow, lastRow, dir) {
+ firstRow = this.getRowFoldStart(firstRow);
+ lastRow = this.getRowFoldEnd(lastRow);
+ if (dir < 0) {
+ var row = this.getRowFoldStart(firstRow + dir);
+ if (row < 0) return 0;
+ var diff = row-firstRow;
+ } else if (dir > 0) {
+ var row = this.getRowFoldEnd(lastRow + dir);
+ if (row > this.doc.getLength()-1) return 0;
+ var diff = row-lastRow;
+ } else {
+ firstRow = this.$clipRowToDocument(firstRow);
+ lastRow = this.$clipRowToDocument(lastRow);
+ var diff = lastRow - firstRow + 1;
+ }
+
+ var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);
+ var folds = this.getFoldsInRange(range).map(function(x){
+ x = x.clone();
+ x.start.row += diff;
+ x.end.row += diff;
+ return x;
+ });
+
+ var lines = dir == 0
+ ? this.doc.getLines(firstRow, lastRow)
+ : this.doc.removeFullLines(firstRow, lastRow);
+ this.doc.insertFullLines(firstRow+diff, lines);
+ folds.length && this.addFolds(folds);
+ return diff;
+ };
+ this.moveLinesUp = function(firstRow, lastRow) {
+ return this.$moveLines(firstRow, lastRow, -1);
+ };
+ this.moveLinesDown = function(firstRow, lastRow) {
+ return this.$moveLines(firstRow, lastRow, 1);
+ };
+ this.duplicateLines = function(firstRow, lastRow) {
+ return this.$moveLines(firstRow, lastRow, 0);
+ };
+
+
+ this.$clipRowToDocument = function(row) {
+ return Math.max(0, Math.min(row, this.doc.getLength()-1));
+ };
+
+ this.$clipColumnToRow = function(row, column) {
+ if (column < 0)
+ return 0;
+ return Math.min(this.doc.getLine(row).length, column);
+ };
+
+
+ this.$clipPositionToDocument = function(row, column) {
+ column = Math.max(0, column);
+
+ if (row < 0) {
+ row = 0;
+ column = 0;
+ } else {
+ var len = this.doc.getLength();
+ if (row >= len) {
+ row = len - 1;
+ column = this.doc.getLine(len-1).length;
+ } else {
+ column = Math.min(this.doc.getLine(row).length, column);
+ }
+ }
+
+ return {
+ row: row,
+ column: column
+ };
+ };
+
+ this.$clipRangeToDocument = function(range) {
+ if (range.start.row < 0) {
+ range.start.row = 0;
+ range.start.column = 0;
+ } else {
+ range.start.column = this.$clipColumnToRow(
+ range.start.row,
+ range.start.column
+ );
+ }
+
+ var len = this.doc.getLength() - 1;
+ if (range.end.row > len) {
+ range.end.row = len;
+ range.end.column = this.doc.getLine(len).length;
+ } else {
+ range.end.column = this.$clipColumnToRow(
+ range.end.row,
+ range.end.column
+ );
+ }
+ return range;
+ };
+ this.$wrapLimit = 80;
+ this.$useWrapMode = false;
+ this.$wrapLimitRange = {
+ min : null,
+ max : null
+ };
+ this.setUseWrapMode = function(useWrapMode) {
+ if (useWrapMode != this.$useWrapMode) {
+ this.$useWrapMode = useWrapMode;
+ this.$modified = true;
+ this.$resetRowCache(0);
+ if (useWrapMode) {
+ var len = this.getLength();
+ this.$wrapData = Array(len);
+ this.$updateWrapData(0, len - 1);
+ }
+
+ this._signal("changeWrapMode");
+ }
+ };
+ this.getUseWrapMode = function() {
+ return this.$useWrapMode;
+ };
+ this.setWrapLimitRange = function(min, max) {
+ if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
+ this.$wrapLimitRange = { min: min, max: max };
+ this.$modified = true;
+ if (this.$useWrapMode)
+ this._signal("changeWrapMode");
+ }
+ };
+ this.adjustWrapLimit = function(desiredLimit, $printMargin) {
+ var limits = this.$wrapLimitRange;
+ if (limits.max < 0)
+ limits = {min: $printMargin, max: $printMargin};
+ var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
+ if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
+ this.$wrapLimit = wrapLimit;
+ this.$modified = true;
+ if (this.$useWrapMode) {
+ this.$updateWrapData(0, this.getLength() - 1);
+ this.$resetRowCache(0);
+ this._signal("changeWrapLimit");
+ }
+ return true;
+ }
+ return false;
+ };
+
+ this.$constrainWrapLimit = function(wrapLimit, min, max) {
+ if (min)
+ wrapLimit = Math.max(min, wrapLimit);
+
+ if (max)
+ wrapLimit = Math.min(max, wrapLimit);
+
+ return wrapLimit;
+ };
+ this.getWrapLimit = function() {
+ return this.$wrapLimit;
+ };
+ this.setWrapLimit = function (limit) {
+ this.setWrapLimitRange(limit, limit);
+ };
+ this.getWrapLimitRange = function() {
+ return {
+ min : this.$wrapLimitRange.min,
+ max : this.$wrapLimitRange.max
+ };
+ };
+
+ this.$updateInternalDataOnChange = function(delta) {
+ var useWrapMode = this.$useWrapMode;
+ var action = delta.action;
+ var start = delta.start;
+ var end = delta.end;
+ var firstRow = start.row;
+ var lastRow = end.row;
+ var len = lastRow - firstRow;
+ var removedFolds = null;
+
+ this.$updating = true;
+ if (len != 0) {
+ if (action === "remove") {
+ this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
+
+ var foldLines = this.$foldData;
+ removedFolds = this.getFoldsInRange(delta);
+ this.removeFolds(removedFolds);
+
+ var foldLine = this.getFoldLine(end.row);
+ var idx = 0;
+ if (foldLine) {
+ foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
+ foldLine.shiftRow(-len);
+
+ var foldLineBefore = this.getFoldLine(firstRow);
+ if (foldLineBefore && foldLineBefore !== foldLine) {
+ foldLineBefore.merge(foldLine);
+ foldLine = foldLineBefore;
+ }
+ idx = foldLines.indexOf(foldLine) + 1;
+ }
+
+ for (idx; idx < foldLines.length; idx++) {
+ var foldLine = foldLines[idx];
+ if (foldLine.start.row >= end.row) {
+ foldLine.shiftRow(-len);
+ }
+ }
+
+ lastRow = firstRow;
+ } else {
+ var args = Array(len);
+ args.unshift(firstRow, 0);
+ var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache
+ arr.splice.apply(arr, args);
+ var foldLines = this.$foldData;
+ var foldLine = this.getFoldLine(firstRow);
+ var idx = 0;
+ if (foldLine) {
+ var cmp = foldLine.range.compareInside(start.row, start.column);
+ if (cmp == 0) {
+ foldLine = foldLine.split(start.row, start.column);
+ if (foldLine) {
+ foldLine.shiftRow(len);
+ foldLine.addRemoveChars(lastRow, 0, end.column - start.column);
+ }
+ } else
+ if (cmp == -1) {
+ foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
+ foldLine.shiftRow(len);
+ }
+ idx = foldLines.indexOf(foldLine) + 1;
+ }
+
+ for (idx; idx < foldLines.length; idx++) {
+ var foldLine = foldLines[idx];
+ if (foldLine.start.row >= firstRow) {
+ foldLine.shiftRow(len);
+ }
+ }
+ }
+ } else {
+ len = Math.abs(delta.start.column - delta.end.column);
+ if (action === "remove") {
+ removedFolds = this.getFoldsInRange(delta);
+ this.removeFolds(removedFolds);
+
+ len = -len;
+ }
+ var foldLine = this.getFoldLine(firstRow);
+ if (foldLine) {
+ foldLine.addRemoveChars(firstRow, start.column, len);
+ }
+ }
+
+ if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
+ console.error("doc.getLength() and $wrapData.length have to be the same!");
+ }
+ this.$updating = false;
+
+ if (useWrapMode)
+ this.$updateWrapData(firstRow, lastRow);
+ else
+ this.$updateRowLengthCache(firstRow, lastRow);
+
+ return removedFolds;
+ };
+
+ this.$updateRowLengthCache = function(firstRow, lastRow, b) {
+ this.$rowLengthCache[firstRow] = null;
+ this.$rowLengthCache[lastRow] = null;
+ };
+
+ this.$updateWrapData = function(firstRow, lastRow) {
+ var lines = this.doc.getAllLines();
+ var tabSize = this.getTabSize();
+ var wrapData = this.$wrapData;
+ var wrapLimit = this.$wrapLimit;
+ var tokens;
+ var foldLine;
+
+ var row = firstRow;
+ lastRow = Math.min(lastRow, lines.length - 1);
+ while (row <= lastRow) {
+ foldLine = this.getFoldLine(row, foldLine);
+ if (!foldLine) {
+ tokens = this.$getDisplayTokens(lines[row]);
+ wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
+ row ++;
+ } else {
+ tokens = [];
+ foldLine.walk(function(placeholder, row, column, lastColumn) {
+ var walkTokens;
+ if (placeholder != null) {
+ walkTokens = this.$getDisplayTokens(
+ placeholder, tokens.length);
+ walkTokens[0] = PLACEHOLDER_START;
+ for (var i = 1; i < walkTokens.length; i++) {
+ walkTokens[i] = PLACEHOLDER_BODY;
+ }
+ } else {
+ walkTokens = this.$getDisplayTokens(
+ lines[row].substring(lastColumn, column),
+ tokens.length);
+ }
+ tokens = tokens.concat(walkTokens);
+ }.bind(this),
+ foldLine.end.row,
+ lines[foldLine.end.row].length + 1
+ );
+
+ wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
+ row = foldLine.end.row + 1;
+ }
+ }
+ };
+ var CHAR = 1,
+ CHAR_EXT = 2,
+ PLACEHOLDER_START = 3,
+ PLACEHOLDER_BODY = 4,
+ PUNCTUATION = 9,
+ SPACE = 10,
+ TAB = 11,
+ TAB_SPACE = 12;
+
+
+ this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) {
+ if (tokens.length == 0) {
+ return [];
+ }
+
+ var splits = [];
+ var displayLength = tokens.length;
+ var lastSplit = 0, lastDocSplit = 0;
+
+ var isCode = this.$wrapAsCode;
+
+ var indentedSoftWrap = this.$indentedSoftWrap;
+ var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8)
+ || indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2);
+
+ function getWrapIndent() {
+ var indentation = 0;
+ if (maxIndent === 0)
+ return indentation;
+ if (indentedSoftWrap) {
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i];
+ if (token == SPACE)
+ indentation += 1;
+ else if (token == TAB)
+ indentation += tabSize;
+ else if (token == TAB_SPACE)
+ continue;
+ else
+ break;
+ }
+ }
+ if (isCode && indentedSoftWrap !== false)
+ indentation += tabSize;
+ return Math.min(indentation, maxIndent);
+ }
+ function addSplit(screenPos) {
+ var displayed = tokens.slice(lastSplit, screenPos);
+ var len = displayed.length;
+ displayed.join("")
+ .replace(/12/g, function() {
+ len -= 1;
+ })
+ .replace(/2/g, function() {
+ len -= 1;
+ });
+
+ if (!splits.length) {
+ indent = getWrapIndent();
+ splits.indent = indent;
+ }
+ lastDocSplit += len;
+ splits.push(lastDocSplit);
+ lastSplit = screenPos;
+ }
+ var indent = 0;
+ while (displayLength - lastSplit > wrapLimit - indent) {
+ var split = lastSplit + wrapLimit - indent;
+ if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) {
+ addSplit(split);
+ continue;
+ }
+ if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) {
+ for (split; split != lastSplit - 1; split--) {
+ if (tokens[split] == PLACEHOLDER_START) {
+ break;
+ }
+ }
+ if (split > lastSplit) {
+ addSplit(split);
+ continue;
+ }
+ split = lastSplit + wrapLimit;
+ for (split; split < tokens.length; split++) {
+ if (tokens[split] != PLACEHOLDER_BODY) {
+ break;
+ }
+ }
+ if (split == tokens.length) {
+ break; // Breaks the while-loop.
+ }
+ addSplit(split);
+ continue;
+ }
+ var minSplit = Math.max(split - (wrapLimit -(wrapLimit>>2)), lastSplit - 1);
+ while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
+ split --;
+ }
+ if (isCode) {
+ while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
+ split --;
+ }
+ while (split > minSplit && tokens[split] == PUNCTUATION) {
+ split --;
+ }
+ } else {
+ while (split > minSplit && tokens[split] < SPACE) {
+ split --;
+ }
+ }
+ if (split > minSplit) {
+ addSplit(++split);
+ continue;
+ }
+ split = lastSplit + wrapLimit;
+ if (tokens[split] == CHAR_EXT)
+ split--;
+ addSplit(split - indent);
+ }
+ return splits;
+ };
+ this.$getDisplayTokens = function(str, offset) {
+ var arr = [];
+ var tabSize;
+ offset = offset || 0;
+
+ for (var i = 0; i < str.length; i++) {
+ var c = str.charCodeAt(i);
+ if (c == 9) {
+ tabSize = this.getScreenTabSize(arr.length + offset);
+ arr.push(TAB);
+ for (var n = 1; n < tabSize; n++) {
+ arr.push(TAB_SPACE);
+ }
+ }
+ else if (c == 32) {
+ arr.push(SPACE);
+ } else if((c > 39 && c < 48) || (c > 57 && c < 64)) {
+ arr.push(PUNCTUATION);
+ }
+ else if (c >= 0x1100 && isFullWidth(c)) {
+ arr.push(CHAR, CHAR_EXT);
+ } else {
+ arr.push(CHAR);
+ }
+ }
+ return arr;
+ };
+ this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
+ if (maxScreenColumn == 0)
+ return [0, 0];
+ if (maxScreenColumn == null)
+ maxScreenColumn = Infinity;
+ screenColumn = screenColumn || 0;
+
+ var c, column;
+ for (column = 0; column < str.length; column++) {
+ c = str.charCodeAt(column);
+ if (c == 9) {
+ screenColumn += this.getScreenTabSize(screenColumn);
+ }
+ else if (c >= 0x1100 && isFullWidth(c)) {
+ screenColumn += 2;
+ } else {
+ screenColumn += 1;
+ }
+ if (screenColumn > maxScreenColumn) {
+ break;
+ }
+ }
+
+ return [screenColumn, column];
+ };
+
+ this.lineWidgets = null;
+ this.getRowLength = function(row) {
+ if (this.lineWidgets)
+ var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
+ else
+ h = 0
+ if (!this.$useWrapMode || !this.$wrapData[row]) {
+ return 1 + h;
+ } else {
+ return this.$wrapData[row].length + 1 + h;
+ }
+ };
+ this.getRowLineCount = function(row) {
+ if (!this.$useWrapMode || !this.$wrapData[row]) {
+ return 1;
+ } else {
+ return this.$wrapData[row].length + 1;
+ }
+ };
+
+ this.getRowWrapIndent = function(screenRow) {
+ if (this.$useWrapMode) {
+ var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
+ var splits = this.$wrapData[pos.row];
+ return splits.length && splits[0] < pos.column ? splits.indent : 0;
+ } else {
+ return 0;
+ }
+ }
+ this.getScreenLastRowColumn = function(screenRow) {
+ var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
+ return this.documentToScreenColumn(pos.row, pos.column);
+ };
+ this.getDocumentLastRowColumn = function(docRow, docColumn) {
+ var screenRow = this.documentToScreenRow(docRow, docColumn);
+ return this.getScreenLastRowColumn(screenRow);
+ };
+ this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
+ var screenRow = this.documentToScreenRow(docRow, docColumn);
+ return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
+ };
+ this.getRowSplitData = function(row) {
+ if (!this.$useWrapMode) {
+ return undefined;
+ } else {
+ return this.$wrapData[row];
+ }
+ };
+ this.getScreenTabSize = function(screenColumn) {
+ return this.$tabSize - screenColumn % this.$tabSize;
+ };
+
+
+ this.screenToDocumentRow = function(screenRow, screenColumn) {
+ return this.screenToDocumentPosition(screenRow, screenColumn).row;
+ };
+
+
+ this.screenToDocumentColumn = function(screenRow, screenColumn) {
+ return this.screenToDocumentPosition(screenRow, screenColumn).column;
+ };
+ this.screenToDocumentPosition = function(screenRow, screenColumn) {
+ if (screenRow < 0)
+ return {row: 0, column: 0};
+
+ var line;
+ var docRow = 0;
+ var docColumn = 0;
+ var column;
+ var row = 0;
+ var rowLength = 0;
+
+ var rowCache = this.$screenRowCache;
+ var i = this.$getRowCacheIndex(rowCache, screenRow);
+ var l = rowCache.length;
+ if (l && i >= 0) {
+ var row = rowCache[i];
+ var docRow = this.$docRowCache[i];
+ var doCache = screenRow > rowCache[l - 1];
+ } else {
+ var doCache = !l;
+ }
+
+ var maxRow = this.getLength() - 1;
+ var foldLine = this.getNextFoldLine(docRow);
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+ while (row <= screenRow) {
+ rowLength = this.getRowLength(docRow);
+ if (row + rowLength > screenRow || docRow >= maxRow) {
+ break;
+ } else {
+ row += rowLength;
+ docRow++;
+ if (docRow > foldStart) {
+ docRow = foldLine.end.row+1;
+ foldLine = this.getNextFoldLine(docRow, foldLine);
+ foldStart = foldLine ? foldLine.start.row : Infinity;
+ }
+ }
+
+ if (doCache) {
+ this.$docRowCache.push(docRow);
+ this.$screenRowCache.push(row);
+ }
+ }
+
+ if (foldLine && foldLine.start.row <= docRow) {
+ line = this.getFoldDisplayLine(foldLine);
+ docRow = foldLine.start.row;
+ } else if (row + rowLength <= screenRow || docRow > maxRow) {
+ return {
+ row: maxRow,
+ column: this.getLine(maxRow).length
+ };
+ } else {
+ line = this.getLine(docRow);
+ foldLine = null;
+ }
+ var wrapIndent = 0;
+ if (this.$useWrapMode) {
+ var splits = this.$wrapData[docRow];
+ if (splits) {
+ var splitIndex = Math.floor(screenRow - row);
+ column = splits[splitIndex];
+ if(splitIndex > 0 && splits.length) {
+ wrapIndent = splits.indent;
+ docColumn = splits[splitIndex - 1] || splits[splits.length - 1];
+ line = line.substring(docColumn);
+ }
+ }
+ }
+
+ docColumn += this.$getStringScreenWidth(line, screenColumn - wrapIndent)[1];
+ if (this.$useWrapMode && docColumn >= column)
+ docColumn = column - 1;
+
+ if (foldLine)
+ return foldLine.idxToPosition(docColumn);
+
+ return {row: docRow, column: docColumn};
+ };
+ this.documentToScreenPosition = function(docRow, docColumn) {
+ if (typeof docColumn === "undefined")
+ var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
+ else
+ pos = this.$clipPositionToDocument(docRow, docColumn);
+
+ docRow = pos.row;
+ docColumn = pos.column;
+
+ var screenRow = 0;
+ var foldStartRow = null;
+ var fold = null;
+ fold = this.getFoldAt(docRow, docColumn, 1);
+ if (fold) {
+ docRow = fold.start.row;
+ docColumn = fold.start.column;
+ }
+
+ var rowEnd, row = 0;
+
+
+ var rowCache = this.$docRowCache;
+ var i = this.$getRowCacheIndex(rowCache, docRow);
+ var l = rowCache.length;
+ if (l && i >= 0) {
+ var row = rowCache[i];
+ var screenRow = this.$screenRowCache[i];
+ var doCache = docRow > rowCache[l - 1];
+ } else {
+ var doCache = !l;
+ }
+
+ var foldLine = this.getNextFoldLine(row);
+ var foldStart = foldLine ?foldLine.start.row :Infinity;
+
+ while (row < docRow) {
+ if (row >= foldStart) {
+ rowEnd = foldLine.end.row + 1;
+ if (rowEnd > docRow)
+ break;
+ foldLine = this.getNextFoldLine(rowEnd, foldLine);
+ foldStart = foldLine ?foldLine.start.row :Infinity;
+ }
+ else {
+ rowEnd = row + 1;
+ }
+
+ screenRow += this.getRowLength(row);
+ row = rowEnd;
+
+ if (doCache) {
+ this.$docRowCache.push(row);
+ this.$screenRowCache.push(screenRow);
+ }
+ }
+ var textLine = "";
+ if (foldLine && row >= foldStart) {
+ textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
+ foldStartRow = foldLine.start.row;
+ } else {
+ textLine = this.getLine(docRow).substring(0, docColumn);
+ foldStartRow = docRow;
+ }
+ var wrapIndent = 0;
+ if (this.$useWrapMode) {
+ var wrapRow = this.$wrapData[foldStartRow];
+ if (wrapRow) {
+ var screenRowOffset = 0;
+ while (textLine.length >= wrapRow[screenRowOffset]) {
+ screenRow ++;
+ screenRowOffset++;
+ }
+ textLine = textLine.substring(
+ wrapRow[screenRowOffset - 1] || 0, textLine.length
+ );
+ wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;
+ }
+ }
+
+ return {
+ row: screenRow,
+ column: wrapIndent + this.$getStringScreenWidth(textLine)[0]
+ };
+ };
+ this.documentToScreenColumn = function(row, docColumn) {
+ return this.documentToScreenPosition(row, docColumn).column;
+ };
+ this.documentToScreenRow = function(docRow, docColumn) {
+ return this.documentToScreenPosition(docRow, docColumn).row;
+ };
+ this.getScreenLength = function() {
+ var screenRows = 0;
+ var fold = null;
+ if (!this.$useWrapMode) {
+ screenRows = this.getLength();
+ var foldData = this.$foldData;
+ for (var i = 0; i < foldData.length; i++) {
+ fold = foldData[i];
+ screenRows -= fold.end.row - fold.start.row;
+ }
+ } else {
+ var lastRow = this.$wrapData.length;
+ var row = 0, i = 0;
+ var fold = this.$foldData[i++];
+ var foldStart = fold ? fold.start.row :Infinity;
+
+ while (row < lastRow) {
+ var splits = this.$wrapData[row];
+ screenRows += splits ? splits.length + 1 : 1;
+ row ++;
+ if (row > foldStart) {
+ row = fold.end.row+1;
+ fold = this.$foldData[i++];
+ foldStart = fold ?fold.start.row :Infinity;
+ }
+ }
+ }
+ if (this.lineWidgets)
+ screenRows += this.$getWidgetScreenLength();
+
+ return screenRows;
+ };
+ this.$setFontMetrics = function(fm) {
+ if (!this.$enableVarChar) return;
+ this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
+ if (maxScreenColumn === 0)
+ return [0, 0];
+ if (!maxScreenColumn)
+ maxScreenColumn = Infinity;
+ screenColumn = screenColumn || 0;
+
+ var c, column;
+ for (column = 0; column < str.length; column++) {
+ c = str.charAt(column);
+ if (c === "\t") {
+ screenColumn += this.getScreenTabSize(screenColumn);
+ } else {
+ screenColumn += fm.getCharacterWidth(c);
+ }
+ if (screenColumn > maxScreenColumn) {
+ break;
+ }
+ }
+
+ return [screenColumn, column];
+ };
+ };
+
+ this.destroy = function() {
+ if (this.bgTokenizer) {
+ this.bgTokenizer.setDocument(null);
+ this.bgTokenizer = null;
+ }
+ this.$stopWorker();
+ };
+ function isFullWidth(c) {
+ if (c < 0x1100)
+ return false;
+ return c >= 0x1100 && c <= 0x115F ||
+ c >= 0x11A3 && c <= 0x11A7 ||
+ c >= 0x11FA && c <= 0x11FF ||
+ c >= 0x2329 && c <= 0x232A ||
+ c >= 0x2E80 && c <= 0x2E99 ||
+ c >= 0x2E9B && c <= 0x2EF3 ||
+ c >= 0x2F00 && c <= 0x2FD5 ||
+ c >= 0x2FF0 && c <= 0x2FFB ||
+ c >= 0x3000 && c <= 0x303E ||
+ c >= 0x3041 && c <= 0x3096 ||
+ c >= 0x3099 && c <= 0x30FF ||
+ c >= 0x3105 && c <= 0x312D ||
+ c >= 0x3131 && c <= 0x318E ||
+ c >= 0x3190 && c <= 0x31BA ||
+ c >= 0x31C0 && c <= 0x31E3 ||
+ c >= 0x31F0 && c <= 0x321E ||
+ c >= 0x3220 && c <= 0x3247 ||
+ c >= 0x3250 && c <= 0x32FE ||
+ c >= 0x3300 && c <= 0x4DBF ||
+ c >= 0x4E00 && c <= 0xA48C ||
+ c >= 0xA490 && c <= 0xA4C6 ||
+ c >= 0xA960 && c <= 0xA97C ||
+ c >= 0xAC00 && c <= 0xD7A3 ||
+ c >= 0xD7B0 && c <= 0xD7C6 ||
+ c >= 0xD7CB && c <= 0xD7FB ||
+ c >= 0xF900 && c <= 0xFAFF ||
+ c >= 0xFE10 && c <= 0xFE19 ||
+ c >= 0xFE30 && c <= 0xFE52 ||
+ c >= 0xFE54 && c <= 0xFE66 ||
+ c >= 0xFE68 && c <= 0xFE6B ||
+ c >= 0xFF01 && c <= 0xFF60 ||
+ c >= 0xFFE0 && c <= 0xFFE6;
+ }
+
+}).call(EditSession.prototype);
+
+acequire("./edit_session/folding").Folding.call(EditSession.prototype);
+acequire("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
+
+
+config.defineOptions(EditSession.prototype, "session", {
+ wrap: {
+ set: function(value) {
+ if (!value || value == "off")
+ value = false;
+ else if (value == "free")
+ value = true;
+ else if (value == "printMargin")
+ value = -1;
+ else if (typeof value == "string")
+ value = parseInt(value, 10) || false;
+
+ if (this.$wrap == value)
+ return;
+ this.$wrap = value;
+ if (!value) {
+ this.setUseWrapMode(false);
+ } else {
+ var col = typeof value == "number" ? value : null;
+ this.setWrapLimitRange(col, col);
+ this.setUseWrapMode(true);
+ }
+ },
+ get: function() {
+ if (this.getUseWrapMode()) {
+ if (this.$wrap == -1)
+ return "printMargin";
+ if (!this.getWrapLimitRange().min)
+ return "free";
+ return this.$wrap;
+ }
+ return "off";
+ },
+ handlesSet: true
+ },
+ wrapMethod: {
+ set: function(val) {
+ val = val == "auto"
+ ? this.$mode.type != "text"
+ : val != "text";
+ if (val != this.$wrapAsCode) {
+ this.$wrapAsCode = val;
+ if (this.$useWrapMode) {
+ this.$modified = true;
+ this.$resetRowCache(0);
+ this.$updateWrapData(0, this.getLength() - 1);
+ }
+ }
+ },
+ initialValue: "auto"
+ },
+ indentedSoftWrap: { initialValue: true },
+ firstLineNumber: {
+ set: function() {this._signal("changeBreakpoint");},
+ initialValue: 1
+ },
+ useWorker: {
+ set: function(useWorker) {
+ this.$useWorker = useWorker;
+
+ this.$stopWorker();
+ if (useWorker)
+ this.$startWorker();
+ },
+ initialValue: true
+ },
+ useSoftTabs: {initialValue: true},
+ tabSize: {
+ set: function(tabSize) {
+ if (isNaN(tabSize) || this.$tabSize === tabSize) return;
+
+ this.$modified = true;
+ this.$rowLengthCache = [];
+ this.$tabSize = tabSize;
+ this._signal("changeTabSize");
+ },
+ initialValue: 4,
+ handlesSet: true
+ },
+ overwrite: {
+ set: function(val) {this._signal("changeOverwrite");},
+ initialValue: false
+ },
+ newLineMode: {
+ set: function(val) {this.doc.setNewLineMode(val)},
+ get: function() {return this.doc.getNewLineMode()},
+ handlesSet: true
+ },
+ mode: {
+ set: function(val) { this.setMode(val) },
+ get: function() { return this.$modeId }
+ }
+});
+
+exports.EditSession = EditSession;
+});
+
+ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var lang = acequire("./lib/lang");
+var oop = acequire("./lib/oop");
+var Range = acequire("./range").Range;
+
+var Search = function() {
+ this.$options = {};
+};
+
+(function() {
+ this.set = function(options) {
+ oop.mixin(this.$options, options);
+ return this;
+ };
+ this.getOptions = function() {
+ return lang.copyObject(this.$options);
+ };
+ this.setOptions = function(options) {
+ this.$options = options;
+ };
+ this.find = function(session) {
+ var options = this.$options;
+ var iterator = this.$matchIterator(session, options);
+ if (!iterator)
+ return false;
+
+ var firstRange = null;
+ iterator.forEach(function(range, row, offset) {
+ if (!range.start) {
+ var column = range.offset + (offset || 0);
+ firstRange = new Range(row, column, row, column + range.length);
+ if (!range.length && options.start && options.start.start
+ && options.skipCurrent != false && firstRange.isEqual(options.start)
+ ) {
+ firstRange = null;
+ return false;
+ }
+ } else
+ firstRange = range;
+ return true;
+ });
+
+ return firstRange;
+ };
+ this.findAll = function(session) {
+ var options = this.$options;
+ if (!options.needle)
+ return [];
+ this.$assembleRegExp(options);
+
+ var range = options.range;
+ var lines = range
+ ? session.getLines(range.start.row, range.end.row)
+ : session.doc.getAllLines();
+
+ var ranges = [];
+ var re = options.re;
+ if (options.$isMultiLine) {
+ var len = re.length;
+ var maxRow = lines.length - len;
+ var prevRange;
+ outer: for (var row = re.offset || 0; row <= maxRow; row++) {
+ for (var j = 0; j < len; j++)
+ if (lines[row + j].search(re[j]) == -1)
+ continue outer;
+
+ var startLine = lines[row];
+ var line = lines[row + len - 1];
+ var startIndex = startLine.length - startLine.match(re[0])[0].length;
+ var endIndex = line.match(re[len - 1])[0].length;
+
+ if (prevRange && prevRange.end.row === row &&
+ prevRange.end.column > startIndex
+ ) {
+ continue;
+ }
+ ranges.push(prevRange = new Range(
+ row, startIndex, row + len - 1, endIndex
+ ));
+ if (len > 2)
+ row = row + len - 2;
+ }
+ } else {
+ for (var i = 0; i < lines.length; i++) {
+ var matches = lang.getMatchOffsets(lines[i], re);
+ for (var j = 0; j < matches.length; j++) {
+ var match = matches[j];
+ ranges.push(new Range(i, match.offset, i, match.offset + match.length));
+ }
+ }
+ }
+
+ if (range) {
+ var startColumn = range.start.column;
+ var endColumn = range.start.column;
+ var i = 0, j = ranges.length - 1;
+ while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)
+ i++;
+
+ while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)
+ j--;
+
+ ranges = ranges.slice(i, j + 1);
+ for (i = 0, j = ranges.length; i < j; i++) {
+ ranges[i].start.row += range.start.row;
+ ranges[i].end.row += range.start.row;
+ }
+ }
+
+ return ranges;
+ };
+ this.replace = function(input, replacement) {
+ var options = this.$options;
+
+ var re = this.$assembleRegExp(options);
+ if (options.$isMultiLine)
+ return replacement;
+
+ if (!re)
+ return;
+
+ var match = re.exec(input);
+ if (!match || match[0].length != input.length)
+ return null;
+
+ replacement = input.replace(re, replacement);
+ if (options.preserveCase) {
+ replacement = replacement.split("");
+ for (var i = Math.min(input.length, input.length); i--; ) {
+ var ch = input[i];
+ if (ch && ch.toLowerCase() != ch)
+ replacement[i] = replacement[i].toUpperCase();
+ else
+ replacement[i] = replacement[i].toLowerCase();
+ }
+ replacement = replacement.join("");
+ }
+
+ return replacement;
+ };
+
+ this.$matchIterator = function(session, options) {
+ var re = this.$assembleRegExp(options);
+ if (!re)
+ return false;
+
+ var callback;
+ if (options.$isMultiLine) {
+ var len = re.length;
+ var matchIterator = function(line, row, offset) {
+ var startIndex = line.search(re[0]);
+ if (startIndex == -1)
+ return;
+ for (var i = 1; i < len; i++) {
+ line = session.getLine(row + i);
+ if (line.search(re[i]) == -1)
+ return;
+ }
+
+ var endIndex = line.match(re[len - 1])[0].length;
+
+ var range = new Range(row, startIndex, row + len - 1, endIndex);
+ if (re.offset == 1) {
+ range.start.row--;
+ range.start.column = Number.MAX_VALUE;
+ } else if (offset)
+ range.start.column += offset;
+
+ if (callback(range))
+ return true;
+ };
+ } else if (options.backwards) {
+ var matchIterator = function(line, row, startIndex) {
+ var matches = lang.getMatchOffsets(line, re);
+ for (var i = matches.length-1; i >= 0; i--)
+ if (callback(matches[i], row, startIndex))
+ return true;
+ };
+ } else {
+ var matchIterator = function(line, row, startIndex) {
+ var matches = lang.getMatchOffsets(line, re);
+ for (var i = 0; i < matches.length; i++)
+ if (callback(matches[i], row, startIndex))
+ return true;
+ };
+ }
+
+ var lineIterator = this.$lineIterator(session, options);
+
+ return {
+ forEach: function(_callback) {
+ callback = _callback;
+ lineIterator.forEach(matchIterator);
+ }
+ };
+ };
+
+ this.$assembleRegExp = function(options, $disableFakeMultiline) {
+ if (options.needle instanceof RegExp)
+ return options.re = options.needle;
+
+ var needle = options.needle;
+
+ if (!options.needle)
+ return options.re = false;
+
+ if (!options.regExp)
+ needle = lang.escapeRegExp(needle);
+
+ if (options.wholeWord)
+ needle = "\\b" + needle + "\\b";
+
+ var modifier = options.caseSensitive ? "gm" : "gmi";
+
+ options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
+ if (options.$isMultiLine)
+ return options.re = this.$assembleMultilineRegExp(needle, modifier);
+
+ try {
+ var re = new RegExp(needle, modifier);
+ } catch(e) {
+ re = false;
+ }
+ return options.re = re;
+ };
+
+ this.$assembleMultilineRegExp = function(needle, modifier) {
+ var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
+ var re = [];
+ for (var i = 0; i < parts.length; i++) try {
+ re.push(new RegExp(parts[i], modifier));
+ } catch(e) {
+ return false;
+ }
+ if (parts[0] == "") {
+ re.shift();
+ re.offset = 1;
+ } else {
+ re.offset = 0;
+ }
+ return re;
+ };
+
+ this.$lineIterator = function(session, options) {
+ var backwards = options.backwards == true;
+ var skipCurrent = options.skipCurrent != false;
+
+ var range = options.range;
+ var start = options.start;
+ if (!start)
+ start = range ? range[backwards ? "end" : "start"] : session.selection.getRange();
+
+ if (start.start)
+ start = start[skipCurrent != backwards ? "end" : "start"];
+
+ var firstRow = range ? range.start.row : 0;
+ var lastRow = range ? range.end.row : session.getLength() - 1;
+
+ var forEach = backwards ? function(callback) {
+ var row = start.row;
+
+ var line = session.getLine(row).substring(0, start.column);
+ if (callback(line, row))
+ return;
+
+ for (row--; row >= firstRow; row--)
+ if (callback(session.getLine(row), row))
+ return;
+
+ if (options.wrap == false)
+ return;
+
+ for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
+ if (callback(session.getLine(row), row))
+ return;
+ } : function(callback) {
+ var row = start.row;
+
+ var line = session.getLine(row).substr(start.column);
+ if (callback(line, row, start.column))
+ return;
+
+ for (row = row+1; row <= lastRow; row++)
+ if (callback(session.getLine(row), row))
+ return;
+
+ if (options.wrap == false)
+ return;
+
+ for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
+ if (callback(session.getLine(row), row))
+ return;
+ };
+
+ return {forEach: forEach};
+ };
+
+}).call(Search.prototype);
+
+exports.Search = Search;
+});
+
+ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"], function(acequire, exports, module) {
+"use strict";
+
+var keyUtil = acequire("../lib/keys");
+var useragent = acequire("../lib/useragent");
+var KEY_MODS = keyUtil.KEY_MODS;
+
+function HashHandler(config, platform) {
+ this.platform = platform || (useragent.isMac ? "mac" : "win");
+ this.commands = {};
+ this.commandKeyBinding = {};
+ this.addCommands(config);
+ this.$singleCommand = true;
+}
+
+function MultiHashHandler(config, platform) {
+ HashHandler.call(this, config, platform);
+ this.$singleCommand = false;
+}
+
+MultiHashHandler.prototype = HashHandler.prototype;
+
+(function() {
+
+
+ this.addCommand = function(command) {
+ if (this.commands[command.name])
+ this.removeCommand(command);
+
+ this.commands[command.name] = command;
+
+ if (command.bindKey)
+ this._buildKeyHash(command);
+ };
+
+ this.removeCommand = function(command, keepCommand) {
+ var name = command && (typeof command === 'string' ? command : command.name);
+ command = this.commands[name];
+ if (!keepCommand)
+ delete this.commands[name];
+ var ckb = this.commandKeyBinding;
+ for (var keyId in ckb) {
+ var cmdGroup = ckb[keyId];
+ if (cmdGroup == command) {
+ delete ckb[keyId];
+ } else if (Array.isArray(cmdGroup)) {
+ var i = cmdGroup.indexOf(command);
+ if (i != -1) {
+ cmdGroup.splice(i, 1);
+ if (cmdGroup.length == 1)
+ ckb[keyId] = cmdGroup[0];
+ }
+ }
+ }
+ };
+
+ this.bindKey = function(key, command, position) {
+ if (typeof key == "object" && key) {
+ if (position == undefined)
+ position = key.position;
+ key = key[this.platform];
+ }
+ if (!key)
+ return;
+ if (typeof command == "function")
+ return this.addCommand({exec: command, bindKey: key, name: command.name || key});
+
+ key.split("|").forEach(function(keyPart) {
+ var chain = "";
+ if (keyPart.indexOf(" ") != -1) {
+ var parts = keyPart.split(/\s+/);
+ keyPart = parts.pop();
+ parts.forEach(function(keyPart) {
+ var binding = this.parseKeys(keyPart);
+ var id = KEY_MODS[binding.hashId] + binding.key;
+ chain += (chain ? " " : "") + id;
+ this._addCommandToBinding(chain, "chainKeys");
+ }, this);
+ chain += " ";
+ }
+ var binding = this.parseKeys(keyPart);
+ var id = KEY_MODS[binding.hashId] + binding.key;
+ this._addCommandToBinding(chain + id, command, position);
+ }, this);
+ };
+
+ function getPosition(command) {
+ return typeof command == "object" && command.bindKey
+ && command.bindKey.position || 0;
+ }
+ this._addCommandToBinding = function(keyId, command, position) {
+ var ckb = this.commandKeyBinding, i;
+ if (!command) {
+ delete ckb[keyId];
+ } else if (!ckb[keyId] || this.$singleCommand) {
+ ckb[keyId] = command;
+ } else {
+ if (!Array.isArray(ckb[keyId])) {
+ ckb[keyId] = [ckb[keyId]];
+ } else if ((i = ckb[keyId].indexOf(command)) != -1) {
+ ckb[keyId].splice(i, 1);
+ }
+
+ if (typeof position != "number") {
+ if (position || command.isDefault)
+ position = -100;
+ else
+ position = getPosition(command);
+ }
+ var commands = ckb[keyId];
+ for (i = 0; i < commands.length; i++) {
+ var other = commands[i];
+ var otherPos = getPosition(other);
+ if (otherPos > position)
+ break;
+ }
+ commands.splice(i, 0, command);
+ }
+ };
+
+ this.addCommands = function(commands) {
+ commands && Object.keys(commands).forEach(function(name) {
+ var command = commands[name];
+ if (!command)
+ return;
+
+ if (typeof command === "string")
+ return this.bindKey(command, name);
+
+ if (typeof command === "function")
+ command = { exec: command };
+
+ if (typeof command !== "object")
+ return;
+
+ if (!command.name)
+ command.name = name;
+
+ this.addCommand(command);
+ }, this);
+ };
+
+ this.removeCommands = function(commands) {
+ Object.keys(commands).forEach(function(name) {
+ this.removeCommand(commands[name]);
+ }, this);
+ };
+
+ this.bindKeys = function(keyList) {
+ Object.keys(keyList).forEach(function(key) {
+ this.bindKey(key, keyList[key]);
+ }, this);
+ };
+
+ this._buildKeyHash = function(command) {
+ this.bindKey(command.bindKey, command);
+ };
+ this.parseKeys = function(keys) {
+ var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
+ var key = parts.pop();
+
+ var keyCode = keyUtil[key];
+ if (keyUtil.FUNCTION_KEYS[keyCode])
+ key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
+ else if (!parts.length)
+ return {key: key, hashId: -1};
+ else if (parts.length == 1 && parts[0] == "shift")
+ return {key: key.toUpperCase(), hashId: -1};
+
+ var hashId = 0;
+ for (var i = parts.length; i--;) {
+ var modifier = keyUtil.KEY_MODS[parts[i]];
+ if (modifier == null) {
+ if (typeof console != "undefined")
+ console.error("invalid modifier " + parts[i] + " in " + keys);
+ return false;
+ }
+ hashId |= modifier;
+ }
+ return {key: key, hashId: hashId};
+ };
+
+ this.findKeyCommand = function findKeyCommand(hashId, keyString) {
+ var key = KEY_MODS[hashId] + keyString;
+ return this.commandKeyBinding[key];
+ };
+
+ this.handleKeyboard = function(data, hashId, keyString, keyCode) {
+ if (keyCode < 0) return;
+ var key = KEY_MODS[hashId] + keyString;
+ var command = this.commandKeyBinding[key];
+ if (data.$keyChain) {
+ data.$keyChain += " " + key;
+ command = this.commandKeyBinding[data.$keyChain] || command;
+ }
+
+ if (command) {
+ if (command == "chainKeys" || command[command.length - 1] == "chainKeys") {
+ data.$keyChain = data.$keyChain || key;
+ return {command: "null"};
+ }
+ }
+
+ if (data.$keyChain) {
+ if ((!hashId || hashId == 4) && keyString.length == 1)
+ data.$keyChain = data.$keyChain.slice(0, -key.length - 1); // wait for input
+ else if (hashId == -1 || keyCode > 0)
+ data.$keyChain = ""; // reset keyChain
+ }
+ return {command: command};
+ };
+
+ this.getStatusText = function(editor, data) {
+ return data.$keyChain || "";
+ };
+
+}).call(HashHandler.prototype);
+
+exports.HashHandler = HashHandler;
+exports.MultiHashHandler = MultiHashHandler;
+});
+
+ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var MultiHashHandler = acequire("../keyboard/hash_handler").MultiHashHandler;
+var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
+
+var CommandManager = function(platform, commands) {
+ MultiHashHandler.call(this, commands, platform);
+ this.byName = this.commands;
+ this.setDefaultHandler("exec", function(e) {
+ return e.command.exec(e.editor, e.args || {});
+ });
+};
+
+oop.inherits(CommandManager, MultiHashHandler);
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.exec = function(command, editor, args) {
+ if (Array.isArray(command)) {
+ for (var i = command.length; i--; ) {
+ if (this.exec(command[i], editor, args)) return true;
+ }
+ return false;
+ }
+
+ if (typeof command === "string")
+ command = this.commands[command];
+
+ if (!command)
+ return false;
+
+ if (editor && editor.$readOnly && !command.readOnly)
+ return false;
+
+ var e = {editor: editor, command: command, args: args};
+ e.returnValue = this._emit("exec", e);
+ this._signal("afterExec", e);
+
+ return e.returnValue === false ? false : true;
+ };
+
+ this.toggleRecording = function(editor) {
+ if (this.$inReplay)
+ return;
+
+ editor && editor._emit("changeStatus");
+ if (this.recording) {
+ this.macro.pop();
+ this.removeEventListener("exec", this.$addCommandToMacro);
+
+ if (!this.macro.length)
+ this.macro = this.oldMacro;
+
+ return this.recording = false;
+ }
+ if (!this.$addCommandToMacro) {
+ this.$addCommandToMacro = function(e) {
+ this.macro.push([e.command, e.args]);
+ }.bind(this);
+ }
+
+ this.oldMacro = this.macro;
+ this.macro = [];
+ this.on("exec", this.$addCommandToMacro);
+ return this.recording = true;
+ };
+
+ this.replay = function(editor) {
+ if (this.$inReplay || !this.macro)
+ return;
+
+ if (this.recording)
+ return this.toggleRecording(editor);
+
+ try {
+ this.$inReplay = true;
+ this.macro.forEach(function(x) {
+ if (typeof x == "string")
+ this.exec(x, editor);
+ else
+ this.exec(x[0], editor, x[1]);
+ }, this);
+ } finally {
+ this.$inReplay = false;
+ }
+ };
+
+ this.trimMacro = function(m) {
+ return m.map(function(x){
+ if (typeof x[0] != "string")
+ x[0] = x[0].name;
+ if (!x[1])
+ x = x[0];
+ return x;
+ });
+ };
+
+}).call(CommandManager.prototype);
+
+exports.CommandManager = CommandManager;
+
+});
+
+ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var lang = acequire("../lib/lang");
+var config = acequire("../config");
+var Range = acequire("../range").Range;
+
+function bindKey(win, mac) {
+ return {win: win, mac: mac};
+}
+exports.commands = [{
+ name: "showSettingsMenu",
+ bindKey: bindKey("Ctrl-,", "Command-,"),
+ exec: function(editor) {
+ config.loadModule("ace/ext/settings_menu", function(module) {
+ module.init(editor);
+ editor.showSettingsMenu();
+ });
+ },
+ readOnly: true
+}, {
+ name: "goToNextError",
+ bindKey: bindKey("Alt-E", "Ctrl-E"),
+ exec: function(editor) {
+ config.loadModule("ace/ext/error_marker", function(module) {
+ module.showErrorMarker(editor, 1);
+ });
+ },
+ scrollIntoView: "animate",
+ readOnly: true
+}, {
+ name: "goToPreviousError",
+ bindKey: bindKey("Alt-Shift-E", "Ctrl-Shift-E"),
+ exec: function(editor) {
+ config.loadModule("ace/ext/error_marker", function(module) {
+ module.showErrorMarker(editor, -1);
+ });
+ },
+ scrollIntoView: "animate",
+ readOnly: true
+}, {
+ name: "selectall",
+ bindKey: bindKey("Ctrl-A", "Command-A"),
+ exec: function(editor) { editor.selectAll(); },
+ readOnly: true
+}, {
+ name: "centerselection",
+ bindKey: bindKey(null, "Ctrl-L"),
+ exec: function(editor) { editor.centerSelection(); },
+ readOnly: true
+}, {
+ name: "gotoline",
+ bindKey: bindKey("Ctrl-L", "Command-L"),
+ exec: function(editor) {
+ var line = parseInt(prompt("Enter line number:"), 10);
+ if (!isNaN(line)) {
+ editor.gotoLine(line);
+ }
+ },
+ readOnly: true
+}, {
+ name: "fold",
+ bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
+ exec: function(editor) { editor.session.toggleFold(false); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "unfold",
+ bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
+ exec: function(editor) { editor.session.toggleFold(true); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "toggleFoldWidget",
+ bindKey: bindKey("F2", "F2"),
+ exec: function(editor) { editor.session.toggleFoldWidget(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "toggleParentFoldWidget",
+ bindKey: bindKey("Alt-F2", "Alt-F2"),
+ exec: function(editor) { editor.session.toggleFoldWidget(true); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "foldall",
+ bindKey: bindKey(null, "Ctrl-Command-Option-0"),
+ exec: function(editor) { editor.session.foldAll(); },
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "foldOther",
+ bindKey: bindKey("Alt-0", "Command-Option-0"),
+ exec: function(editor) {
+ editor.session.foldAll();
+ editor.session.unfold(editor.selection.getAllRanges());
+ },
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "unfoldall",
+ bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
+ exec: function(editor) { editor.session.unfold(); },
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "findnext",
+ bindKey: bindKey("Ctrl-K", "Command-G"),
+ exec: function(editor) { editor.findNext(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "findprevious",
+ bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
+ exec: function(editor) { editor.findPrevious(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "center",
+ readOnly: true
+}, {
+ name: "selectOrFindNext",
+ bindKey: bindKey("Alt-K", "Ctrl-G"),
+ exec: function(editor) {
+ if (editor.selection.isEmpty())
+ editor.selection.selectWord();
+ else
+ editor.findNext();
+ },
+ readOnly: true
+}, {
+ name: "selectOrFindPrevious",
+ bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
+ exec: function(editor) {
+ if (editor.selection.isEmpty())
+ editor.selection.selectWord();
+ else
+ editor.findPrevious();
+ },
+ readOnly: true
+}, {
+ name: "find",
+ bindKey: bindKey("Ctrl-F", "Command-F"),
+ exec: function(editor) {
+ config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor)});
+ },
+ readOnly: true
+}, {
+ name: "overwrite",
+ bindKey: "Insert",
+ exec: function(editor) { editor.toggleOverwrite(); },
+ readOnly: true
+}, {
+ name: "selecttostart",
+ bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
+ exec: function(editor) { editor.getSelection().selectFileStart(); },
+ multiSelectAction: "forEach",
+ readOnly: true,
+ scrollIntoView: "animate",
+ aceCommandGroup: "fileJump"
+}, {
+ name: "gotostart",
+ bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
+ exec: function(editor) { editor.navigateFileStart(); },
+ multiSelectAction: "forEach",
+ readOnly: true,
+ scrollIntoView: "animate",
+ aceCommandGroup: "fileJump"
+}, {
+ name: "selectup",
+ bindKey: bindKey("Shift-Up", "Shift-Up"),
+ exec: function(editor) { editor.getSelection().selectUp(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "golineup",
+ bindKey: bindKey("Up", "Up|Ctrl-P"),
+ exec: function(editor, args) { editor.navigateUp(args.times); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selecttoend",
+ bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
+ exec: function(editor) { editor.getSelection().selectFileEnd(); },
+ multiSelectAction: "forEach",
+ readOnly: true,
+ scrollIntoView: "animate",
+ aceCommandGroup: "fileJump"
+}, {
+ name: "gotoend",
+ bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
+ exec: function(editor) { editor.navigateFileEnd(); },
+ multiSelectAction: "forEach",
+ readOnly: true,
+ scrollIntoView: "animate",
+ aceCommandGroup: "fileJump"
+}, {
+ name: "selectdown",
+ bindKey: bindKey("Shift-Down", "Shift-Down"),
+ exec: function(editor) { editor.getSelection().selectDown(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "golinedown",
+ bindKey: bindKey("Down", "Down|Ctrl-N"),
+ exec: function(editor, args) { editor.navigateDown(args.times); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectwordleft",
+ bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
+ exec: function(editor) { editor.getSelection().selectWordLeft(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "gotowordleft",
+ bindKey: bindKey("Ctrl-Left", "Option-Left"),
+ exec: function(editor) { editor.navigateWordLeft(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selecttolinestart",
+ bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
+ exec: function(editor) { editor.getSelection().selectLineStart(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "gotolinestart",
+ bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
+ exec: function(editor) { editor.navigateLineStart(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectleft",
+ bindKey: bindKey("Shift-Left", "Shift-Left"),
+ exec: function(editor) { editor.getSelection().selectLeft(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "gotoleft",
+ bindKey: bindKey("Left", "Left|Ctrl-B"),
+ exec: function(editor, args) { editor.navigateLeft(args.times); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectwordright",
+ bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
+ exec: function(editor) { editor.getSelection().selectWordRight(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "gotowordright",
+ bindKey: bindKey("Ctrl-Right", "Option-Right"),
+ exec: function(editor) { editor.navigateWordRight(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selecttolineend",
+ bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
+ exec: function(editor) { editor.getSelection().selectLineEnd(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "gotolineend",
+ bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
+ exec: function(editor) { editor.navigateLineEnd(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectright",
+ bindKey: bindKey("Shift-Right", "Shift-Right"),
+ exec: function(editor) { editor.getSelection().selectRight(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "gotoright",
+ bindKey: bindKey("Right", "Right|Ctrl-F"),
+ exec: function(editor, args) { editor.navigateRight(args.times); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectpagedown",
+ bindKey: "Shift-PageDown",
+ exec: function(editor) { editor.selectPageDown(); },
+ readOnly: true
+}, {
+ name: "pagedown",
+ bindKey: bindKey(null, "Option-PageDown"),
+ exec: function(editor) { editor.scrollPageDown(); },
+ readOnly: true
+}, {
+ name: "gotopagedown",
+ bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
+ exec: function(editor) { editor.gotoPageDown(); },
+ readOnly: true
+}, {
+ name: "selectpageup",
+ bindKey: "Shift-PageUp",
+ exec: function(editor) { editor.selectPageUp(); },
+ readOnly: true
+}, {
+ name: "pageup",
+ bindKey: bindKey(null, "Option-PageUp"),
+ exec: function(editor) { editor.scrollPageUp(); },
+ readOnly: true
+}, {
+ name: "gotopageup",
+ bindKey: "PageUp",
+ exec: function(editor) { editor.gotoPageUp(); },
+ readOnly: true
+}, {
+ name: "scrollup",
+ bindKey: bindKey("Ctrl-Up", null),
+ exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
+ readOnly: true
+}, {
+ name: "scrolldown",
+ bindKey: bindKey("Ctrl-Down", null),
+ exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
+ readOnly: true
+}, {
+ name: "selectlinestart",
+ bindKey: "Shift-Home",
+ exec: function(editor) { editor.getSelection().selectLineStart(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectlineend",
+ bindKey: "Shift-End",
+ exec: function(editor) { editor.getSelection().selectLineEnd(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "togglerecording",
+ bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
+ exec: function(editor) { editor.commands.toggleRecording(editor); },
+ readOnly: true
+}, {
+ name: "replaymacro",
+ bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
+ exec: function(editor) { editor.commands.replay(editor); },
+ readOnly: true
+}, {
+ name: "jumptomatching",
+ bindKey: bindKey("Ctrl-P", "Ctrl-P"),
+ exec: function(editor) { editor.jumpToMatching(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "animate",
+ readOnly: true
+}, {
+ name: "selecttomatching",
+ bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
+ exec: function(editor) { editor.jumpToMatching(true); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "animate",
+ readOnly: true
+}, {
+ name: "expandToMatching",
+ bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"),
+ exec: function(editor) { editor.jumpToMatching(true, true); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "animate",
+ readOnly: true
+}, {
+ name: "passKeysToBrowser",
+ bindKey: bindKey(null, null),
+ exec: function() {},
+ passEvent: true,
+ readOnly: true
+}, {
+ name: "copy",
+ exec: function(editor) {
+ },
+ readOnly: true
+},
+{
+ name: "cut",
+ exec: function(editor) {
+ var range = editor.getSelectionRange();
+ editor._emit("cut", range);
+
+ if (!editor.selection.isEmpty()) {
+ editor.session.remove(range);
+ editor.clearSelection();
+ }
+ },
+ scrollIntoView: "cursor",
+ multiSelectAction: "forEach"
+}, {
+ name: "paste",
+ exec: function(editor, args) {
+ editor.$handlePaste(args);
+ },
+ scrollIntoView: "cursor"
+}, {
+ name: "removeline",
+ bindKey: bindKey("Ctrl-D", "Command-D"),
+ exec: function(editor) { editor.removeLines(); },
+ scrollIntoView: "cursor",
+ multiSelectAction: "forEachLine"
+}, {
+ name: "duplicateSelection",
+ bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
+ exec: function(editor) { editor.duplicateSelection(); },
+ scrollIntoView: "cursor",
+ multiSelectAction: "forEach"
+}, {
+ name: "sortlines",
+ bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
+ exec: function(editor) { editor.sortLines(); },
+ scrollIntoView: "selection",
+ multiSelectAction: "forEachLine"
+}, {
+ name: "togglecomment",
+ bindKey: bindKey("Ctrl-/", "Command-/"),
+ exec: function(editor) { editor.toggleCommentLines(); },
+ multiSelectAction: "forEachLine",
+ scrollIntoView: "selectionPart"
+}, {
+ name: "toggleBlockComment",
+ bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
+ exec: function(editor) { editor.toggleBlockComment(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "selectionPart"
+}, {
+ name: "modifyNumberUp",
+ bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
+ exec: function(editor) { editor.modifyNumber(1); },
+ scrollIntoView: "cursor",
+ multiSelectAction: "forEach"
+}, {
+ name: "modifyNumberDown",
+ bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
+ exec: function(editor) { editor.modifyNumber(-1); },
+ scrollIntoView: "cursor",
+ multiSelectAction: "forEach"
+}, {
+ name: "replace",
+ bindKey: bindKey("Ctrl-H", "Command-Option-F"),
+ exec: function(editor) {
+ config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true)});
+ }
+}, {
+ name: "undo",
+ bindKey: bindKey("Ctrl-Z", "Command-Z"),
+ exec: function(editor) { editor.undo(); }
+}, {
+ name: "redo",
+ bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
+ exec: function(editor) { editor.redo(); }
+}, {
+ name: "copylinesup",
+ bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
+ exec: function(editor) { editor.copyLinesUp(); },
+ scrollIntoView: "cursor"
+}, {
+ name: "movelinesup",
+ bindKey: bindKey("Alt-Up", "Option-Up"),
+ exec: function(editor) { editor.moveLinesUp(); },
+ scrollIntoView: "cursor"
+}, {
+ name: "copylinesdown",
+ bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
+ exec: function(editor) { editor.copyLinesDown(); },
+ scrollIntoView: "cursor"
+}, {
+ name: "movelinesdown",
+ bindKey: bindKey("Alt-Down", "Option-Down"),
+ exec: function(editor) { editor.moveLinesDown(); },
+ scrollIntoView: "cursor"
+}, {
+ name: "del",
+ bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
+ exec: function(editor) { editor.remove("right"); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "backspace",
+ bindKey: bindKey(
+ "Shift-Backspace|Backspace",
+ "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
+ ),
+ exec: function(editor) { editor.remove("left"); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "cut_or_delete",
+ bindKey: bindKey("Shift-Delete", null),
+ exec: function(editor) {
+ if (editor.selection.isEmpty()) {
+ editor.remove("left");
+ } else {
+ return false;
+ }
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "removetolinestart",
+ bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
+ exec: function(editor) { editor.removeToLineStart(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "removetolineend",
+ bindKey: bindKey("Alt-Delete", "Ctrl-K"),
+ exec: function(editor) { editor.removeToLineEnd(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "removewordleft",
+ bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
+ exec: function(editor) { editor.removeWordLeft(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "removewordright",
+ bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
+ exec: function(editor) { editor.removeWordRight(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "outdent",
+ bindKey: bindKey("Shift-Tab", "Shift-Tab"),
+ exec: function(editor) { editor.blockOutdent(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "selectionPart"
+}, {
+ name: "indent",
+ bindKey: bindKey("Tab", "Tab"),
+ exec: function(editor) { editor.indent(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "selectionPart"
+}, {
+ name: "blockoutdent",
+ bindKey: bindKey("Ctrl-[", "Ctrl-["),
+ exec: function(editor) { editor.blockOutdent(); },
+ multiSelectAction: "forEachLine",
+ scrollIntoView: "selectionPart"
+}, {
+ name: "blockindent",
+ bindKey: bindKey("Ctrl-]", "Ctrl-]"),
+ exec: function(editor) { editor.blockIndent(); },
+ multiSelectAction: "forEachLine",
+ scrollIntoView: "selectionPart"
+}, {
+ name: "insertstring",
+ exec: function(editor, str) { editor.insert(str); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "inserttext",
+ exec: function(editor, args) {
+ editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "splitline",
+ bindKey: bindKey(null, "Ctrl-O"),
+ exec: function(editor) { editor.splitLine(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "transposeletters",
+ bindKey: bindKey("Ctrl-T", "Ctrl-T"),
+ exec: function(editor) { editor.transposeLetters(); },
+ multiSelectAction: function(editor) {editor.transposeSelections(1); },
+ scrollIntoView: "cursor"
+}, {
+ name: "touppercase",
+ bindKey: bindKey("Ctrl-U", "Ctrl-U"),
+ exec: function(editor) { editor.toUpperCase(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "tolowercase",
+ bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
+ exec: function(editor) { editor.toLowerCase(); },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "expandtoline",
+ bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
+ exec: function(editor) {
+ var range = editor.selection.getRange();
+
+ range.start.column = range.end.column = 0;
+ range.end.row++;
+ editor.selection.setRange(range, false);
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "joinlines",
+ bindKey: bindKey(null, null),
+ exec: function(editor) {
+ var isBackwards = editor.selection.isBackwards();
+ var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();
+ var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();
+ var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length;
+ var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());
+ var selectedCount = selectedText.replace(/\n\s*/, " ").length;
+ var insertLine = editor.session.doc.getLine(selectionStart.row);
+
+ for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) {
+ var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i)));
+ if (curLine.length !== 0) {
+ curLine = " " + curLine;
+ }
+ insertLine += curLine;
+ }
+
+ if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {
+ insertLine += editor.session.doc.getNewLineCharacter();
+ }
+
+ editor.clearSelection();
+ editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);
+
+ if (selectedCount > 0) {
+ editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);
+ editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);
+ } else {
+ firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol;
+ editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);
+ }
+ },
+ multiSelectAction: "forEach",
+ readOnly: true
+}, {
+ name: "invertSelection",
+ bindKey: bindKey(null, null),
+ exec: function(editor) {
+ var endRow = editor.session.doc.getLength() - 1;
+ var endCol = editor.session.doc.getLine(endRow).length;
+ var ranges = editor.selection.rangeList.ranges;
+ var newRanges = [];
+ if (ranges.length < 1) {
+ ranges = [editor.selection.getRange()];
+ }
+
+ for (var i = 0; i < ranges.length; i++) {
+ if (i == (ranges.length - 1)) {
+ if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) {
+ newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol));
+ }
+ }
+
+ if (i === 0) {
+ if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) {
+ newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column));
+ }
+ } else {
+ newRanges.push(new Range(ranges[i-1].end.row, ranges[i-1].end.column, ranges[i].start.row, ranges[i].start.column));
+ }
+ }
+
+ editor.exitMultiSelectMode();
+ editor.clearSelection();
+
+ for(var i = 0; i < newRanges.length; i++) {
+ editor.selection.addRange(newRanges[i], false);
+ }
+ },
+ readOnly: true,
+ scrollIntoView: "none"
+}];
+
+});
+
+ace.define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator"], function(acequire, exports, module) {
+"use strict";
+
+acequire("./lib/fixoldbrowsers");
+
+var oop = acequire("./lib/oop");
+var dom = acequire("./lib/dom");
+var lang = acequire("./lib/lang");
+var useragent = acequire("./lib/useragent");
+var TextInput = acequire("./keyboard/textinput").TextInput;
+var MouseHandler = acequire("./mouse/mouse_handler").MouseHandler;
+var FoldHandler = acequire("./mouse/fold_handler").FoldHandler;
+var KeyBinding = acequire("./keyboard/keybinding").KeyBinding;
+var EditSession = acequire("./edit_session").EditSession;
+var Search = acequire("./search").Search;
+var Range = acequire("./range").Range;
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var CommandManager = acequire("./commands/command_manager").CommandManager;
+var defaultCommands = acequire("./commands/default_commands").commands;
+var config = acequire("./config");
+var TokenIterator = acequire("./token_iterator").TokenIterator;
+var Editor = function(renderer, session) {
+ var container = renderer.getContainerElement();
+ this.container = container;
+ this.renderer = renderer;
+
+ this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
+ this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
+ this.renderer.textarea = this.textInput.getElement();
+ this.keyBinding = new KeyBinding(this);
+ this.$mouseHandler = new MouseHandler(this);
+ new FoldHandler(this);
+
+ this.$blockScrolling = 0;
+ this.$search = new Search().set({
+ wrap: true
+ });
+
+ this.$historyTracker = this.$historyTracker.bind(this);
+ this.commands.on("exec", this.$historyTracker);
+
+ this.$initOperationListeners();
+
+ this._$emitInputEvent = lang.delayedCall(function() {
+ this._signal("input", {});
+ if (this.session && this.session.bgTokenizer)
+ this.session.bgTokenizer.scheduleStart();
+ }.bind(this));
+
+ this.on("change", function(_, _self) {
+ _self._$emitInputEvent.schedule(31);
+ });
+
+ this.setSession(session || new EditSession(""));
+ config.resetOptions(this);
+ config._signal("editor", this);
+};
+
+(function(){
+
+ oop.implement(this, EventEmitter);
+
+ this.$initOperationListeners = function() {
+ function last(a) {return a[a.length - 1]}
+
+ this.selections = [];
+ this.commands.on("exec", this.startOperation.bind(this), true);
+ this.commands.on("afterExec", this.endOperation.bind(this), true);
+
+ this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
+
+ this.on("change", function() {
+ this.curOp || this.startOperation();
+ this.curOp.docChanged = true;
+ }.bind(this), true);
+
+ this.on("changeSelection", function() {
+ this.curOp || this.startOperation();
+ this.curOp.selectionChanged = true;
+ }.bind(this), true);
+ };
+
+ this.curOp = null;
+ this.prevOp = {};
+ this.startOperation = function(commadEvent) {
+ if (this.curOp) {
+ if (!commadEvent || this.curOp.command)
+ return;
+ this.prevOp = this.curOp;
+ }
+ if (!commadEvent) {
+ this.previousCommand = null;
+ commadEvent = {};
+ }
+
+ this.$opResetTimer.schedule();
+ this.curOp = {
+ command: commadEvent.command || {},
+ args: commadEvent.args,
+ scrollTop: this.renderer.scrollTop
+ };
+ if (this.curOp.command.name && this.curOp.command.scrollIntoView !== undefined)
+ this.$blockScrolling++;
+ };
+
+ this.endOperation = function(e) {
+ if (this.curOp) {
+ if (e && e.returnValue === false)
+ return this.curOp = null;
+ this._signal("beforeEndOperation");
+ var command = this.curOp.command;
+ if (command.name && this.$blockScrolling > 0)
+ this.$blockScrolling--;
+ var scrollIntoView = command && command.scrollIntoView;
+ if (scrollIntoView) {
+ switch (scrollIntoView) {
+ case "center-animate":
+ scrollIntoView = "animate";
+ case "center":
+ this.renderer.scrollCursorIntoView(null, 0.5);
+ break;
+ case "animate":
+ case "cursor":
+ this.renderer.scrollCursorIntoView();
+ break;
+ case "selectionPart":
+ var range = this.selection.getRange();
+ var config = this.renderer.layerConfig;
+ if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) {
+ this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);
+ }
+ break;
+ default:
+ break;
+ }
+ if (scrollIntoView == "animate")
+ this.renderer.animateScrolling(this.curOp.scrollTop);
+ }
+
+ this.prevOp = this.curOp;
+ this.curOp = null;
+ }
+ };
+ this.$mergeableCommands = ["backspace", "del", "insertstring"];
+ this.$historyTracker = function(e) {
+ if (!this.$mergeUndoDeltas)
+ return;
+
+ var prev = this.prevOp;
+ var mergeableCommands = this.$mergeableCommands;
+ var shouldMerge = prev.command && (e.command.name == prev.command.name);
+ if (e.command.name == "insertstring") {
+ var text = e.args;
+ if (this.mergeNextCommand === undefined)
+ this.mergeNextCommand = true;
+
+ shouldMerge = shouldMerge
+ && this.mergeNextCommand // previous command allows to coalesce with
+ && (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type
+
+ this.mergeNextCommand = true;
+ } else {
+ shouldMerge = shouldMerge
+ && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable
+ }
+
+ if (
+ this.$mergeUndoDeltas != "always"
+ && Date.now() - this.sequenceStartTime > 2000
+ ) {
+ shouldMerge = false; // the sequence is too long
+ }
+
+ if (shouldMerge)
+ this.session.mergeUndoDeltas = true;
+ else if (mergeableCommands.indexOf(e.command.name) !== -1)
+ this.sequenceStartTime = Date.now();
+ };
+ this.setKeyboardHandler = function(keyboardHandler, cb) {
+ if (keyboardHandler && typeof keyboardHandler === "string") {
+ this.$keybindingId = keyboardHandler;
+ var _self = this;
+ config.loadModule(["keybinding", keyboardHandler], function(module) {
+ if (_self.$keybindingId == keyboardHandler)
+ _self.keyBinding.setKeyboardHandler(module && module.handler);
+ cb && cb();
+ });
+ } else {
+ this.$keybindingId = null;
+ this.keyBinding.setKeyboardHandler(keyboardHandler);
+ cb && cb();
+ }
+ };
+ this.getKeyboardHandler = function() {
+ return this.keyBinding.getKeyboardHandler();
+ };
+ this.setSession = function(session) {
+ if (this.session == session)
+ return;
+ if (this.curOp) this.endOperation();
+ this.curOp = {};
+
+ var oldSession = this.session;
+ if (oldSession) {
+ this.session.off("change", this.$onDocumentChange);
+ this.session.off("changeMode", this.$onChangeMode);
+ this.session.off("tokenizerUpdate", this.$onTokenizerUpdate);
+ this.session.off("changeTabSize", this.$onChangeTabSize);
+ this.session.off("changeWrapLimit", this.$onChangeWrapLimit);
+ this.session.off("changeWrapMode", this.$onChangeWrapMode);
+ this.session.off("changeFold", this.$onChangeFold);
+ this.session.off("changeFrontMarker", this.$onChangeFrontMarker);
+ this.session.off("changeBackMarker", this.$onChangeBackMarker);
+ this.session.off("changeBreakpoint", this.$onChangeBreakpoint);
+ this.session.off("changeAnnotation", this.$onChangeAnnotation);
+ this.session.off("changeOverwrite", this.$onCursorChange);
+ this.session.off("changeScrollTop", this.$onScrollTopChange);
+ this.session.off("changeScrollLeft", this.$onScrollLeftChange);
+
+ var selection = this.session.getSelection();
+ selection.off("changeCursor", this.$onCursorChange);
+ selection.off("changeSelection", this.$onSelectionChange);
+ }
+
+ this.session = session;
+ if (session) {
+ this.$onDocumentChange = this.onDocumentChange.bind(this);
+ session.on("change", this.$onDocumentChange);
+ this.renderer.setSession(session);
+
+ this.$onChangeMode = this.onChangeMode.bind(this);
+ session.on("changeMode", this.$onChangeMode);
+
+ this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
+ session.on("tokenizerUpdate", this.$onTokenizerUpdate);
+
+ this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
+ session.on("changeTabSize", this.$onChangeTabSize);
+
+ this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
+ session.on("changeWrapLimit", this.$onChangeWrapLimit);
+
+ this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
+ session.on("changeWrapMode", this.$onChangeWrapMode);
+
+ this.$onChangeFold = this.onChangeFold.bind(this);
+ session.on("changeFold", this.$onChangeFold);
+
+ this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
+ this.session.on("changeFrontMarker", this.$onChangeFrontMarker);
+
+ this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
+ this.session.on("changeBackMarker", this.$onChangeBackMarker);
+
+ this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
+ this.session.on("changeBreakpoint", this.$onChangeBreakpoint);
+
+ this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
+ this.session.on("changeAnnotation", this.$onChangeAnnotation);
+
+ this.$onCursorChange = this.onCursorChange.bind(this);
+ this.session.on("changeOverwrite", this.$onCursorChange);
+
+ this.$onScrollTopChange = this.onScrollTopChange.bind(this);
+ this.session.on("changeScrollTop", this.$onScrollTopChange);
+
+ this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
+ this.session.on("changeScrollLeft", this.$onScrollLeftChange);
+
+ this.selection = session.getSelection();
+ this.selection.on("changeCursor", this.$onCursorChange);
+
+ this.$onSelectionChange = this.onSelectionChange.bind(this);
+ this.selection.on("changeSelection", this.$onSelectionChange);
+
+ this.onChangeMode();
+
+ this.$blockScrolling += 1;
+ this.onCursorChange();
+ this.$blockScrolling -= 1;
+
+ this.onScrollTopChange();
+ this.onScrollLeftChange();
+ this.onSelectionChange();
+ this.onChangeFrontMarker();
+ this.onChangeBackMarker();
+ this.onChangeBreakpoint();
+ this.onChangeAnnotation();
+ this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
+ this.renderer.updateFull();
+ } else {
+ this.selection = null;
+ this.renderer.setSession(session);
+ }
+
+ this._signal("changeSession", {
+ session: session,
+ oldSession: oldSession
+ });
+
+ this.curOp = null;
+
+ oldSession && oldSession._signal("changeEditor", {oldEditor: this});
+ session && session._signal("changeEditor", {editor: this});
+ };
+ this.getSession = function() {
+ return this.session;
+ };
+ this.setValue = function(val, cursorPos) {
+ this.session.doc.setValue(val);
+
+ if (!cursorPos)
+ this.selectAll();
+ else if (cursorPos == 1)
+ this.navigateFileEnd();
+ else if (cursorPos == -1)
+ this.navigateFileStart();
+
+ return val;
+ };
+ this.getValue = function() {
+ return this.session.getValue();
+ };
+ this.getSelection = function() {
+ return this.selection;
+ };
+ this.resize = function(force) {
+ this.renderer.onResize(force);
+ };
+ this.setTheme = function(theme, cb) {
+ this.renderer.setTheme(theme, cb);
+ };
+ this.getTheme = function() {
+ return this.renderer.getTheme();
+ };
+ this.setStyle = function(style) {
+ this.renderer.setStyle(style);
+ };
+ this.unsetStyle = function(style) {
+ this.renderer.unsetStyle(style);
+ };
+ this.getFontSize = function () {
+ return this.getOption("fontSize") ||
+ dom.computedStyle(this.container, "fontSize");
+ };
+ this.setFontSize = function(size) {
+ this.setOption("fontSize", size);
+ };
+
+ this.$highlightBrackets = function() {
+ if (this.session.$bracketHighlight) {
+ this.session.removeMarker(this.session.$bracketHighlight);
+ this.session.$bracketHighlight = null;
+ }
+
+ if (this.$highlightPending) {
+ return;
+ }
+ var self = this;
+ this.$highlightPending = true;
+ setTimeout(function() {
+ self.$highlightPending = false;
+ var session = self.session;
+ if (!session || !session.bgTokenizer) return;
+ var pos = session.findMatchingBracket(self.getCursorPosition());
+ if (pos) {
+ var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
+ } else if (session.$mode.getMatching) {
+ var range = session.$mode.getMatching(self.session);
+ }
+ if (range)
+ session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
+ }, 50);
+ };
+ this.$highlightTags = function() {
+ if (this.$highlightTagPending)
+ return;
+ var self = this;
+ this.$highlightTagPending = true;
+ setTimeout(function() {
+ self.$highlightTagPending = false;
+
+ var session = self.session;
+ if (!session || !session.bgTokenizer) return;
+
+ var pos = self.getCursorPosition();
+ var iterator = new TokenIterator(self.session, pos.row, pos.column);
+ var token = iterator.getCurrentToken();
+
+ if (!token || !/\b(?:tag-open|tag-name)/.test(token.type)) {
+ session.removeMarker(session.$tagHighlight);
+ session.$tagHighlight = null;
+ return;
+ }
+
+ if (token.type.indexOf("tag-open") != -1) {
+ token = iterator.stepForward();
+ if (!token)
+ return;
+ }
+
+ var tag = token.value;
+ var depth = 0;
+ var prevToken = iterator.stepBackward();
+
+ if (prevToken.value == '<'){
+ do {
+ prevToken = token;
+ token = iterator.stepForward();
+
+ if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
+ if (prevToken.value === '<'){
+ depth++;
+ } else if (prevToken.value === ''){
+ depth--;
+ }
+ }
+
+ } while (token && depth >= 0);
+ } else {
+ do {
+ token = prevToken;
+ prevToken = iterator.stepBackward();
+
+ if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
+ if (prevToken.value === '<') {
+ depth++;
+ } else if (prevToken.value === '') {
+ depth--;
+ }
+ }
+ } while (prevToken && depth <= 0);
+ iterator.stepForward();
+ }
+
+ if (!token) {
+ session.removeMarker(session.$tagHighlight);
+ session.$tagHighlight = null;
+ return;
+ }
+
+ var row = iterator.getCurrentTokenRow();
+ var column = iterator.getCurrentTokenColumn();
+ var range = new Range(row, column, row, column+token.value.length);
+ if (session.$tagHighlight && range.compareRange(session.$backMarkers[session.$tagHighlight].range)!==0) {
+ session.removeMarker(session.$tagHighlight);
+ session.$tagHighlight = null;
+ }
+
+ if (range && !session.$tagHighlight)
+ session.$tagHighlight = session.addMarker(range, "ace_bracket", "text");
+ }, 50);
+ };
+ this.focus = function() {
+ var _self = this;
+ setTimeout(function() {
+ _self.textInput.focus();
+ });
+ this.textInput.focus();
+ };
+ this.isFocused = function() {
+ return this.textInput.isFocused();
+ };
+ this.blur = function() {
+ this.textInput.blur();
+ };
+ this.onFocus = function(e) {
+ if (this.$isFocused)
+ return;
+ this.$isFocused = true;
+ this.renderer.showCursor();
+ this.renderer.visualizeFocus();
+ this._emit("focus", e);
+ };
+ this.onBlur = function(e) {
+ if (!this.$isFocused)
+ return;
+ this.$isFocused = false;
+ this.renderer.hideCursor();
+ this.renderer.visualizeBlur();
+ this._emit("blur", e);
+ };
+
+ this.$cursorChange = function() {
+ this.renderer.updateCursor();
+ };
+ this.onDocumentChange = function(delta) {
+ var wrap = this.session.$useWrapMode;
+ var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);
+ this.renderer.updateLines(delta.start.row, lastRow, wrap);
+
+ this._signal("change", delta);
+ this.$cursorChange();
+ this.$updateHighlightActiveLine();
+ };
+
+ this.onTokenizerUpdate = function(e) {
+ var rows = e.data;
+ this.renderer.updateLines(rows.first, rows.last);
+ };
+
+
+ this.onScrollTopChange = function() {
+ this.renderer.scrollToY(this.session.getScrollTop());
+ };
+
+ this.onScrollLeftChange = function() {
+ this.renderer.scrollToX(this.session.getScrollLeft());
+ };
+ this.onCursorChange = function() {
+ this.$cursorChange();
+
+ if (!this.$blockScrolling) {
+ config.warn("Automatically scrolling cursor into view after selection change",
+ "this will be disabled in the next version",
+ "set editor.$blockScrolling = Infinity to disable this message"
+ );
+ this.renderer.scrollCursorIntoView();
+ }
+
+ this.$highlightBrackets();
+ this.$highlightTags();
+ this.$updateHighlightActiveLine();
+ this._signal("changeSelection");
+ };
+
+ this.$updateHighlightActiveLine = function() {
+ var session = this.getSession();
+
+ var highlight;
+ if (this.$highlightActiveLine) {
+ if ((this.$selectionStyle != "line" || !this.selection.isMultiLine()))
+ highlight = this.getCursorPosition();
+ if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))
+ highlight = false;
+ }
+
+ if (session.$highlightLineMarker && !highlight) {
+ session.removeMarker(session.$highlightLineMarker.id);
+ session.$highlightLineMarker = null;
+ } else if (!session.$highlightLineMarker && highlight) {
+ var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);
+ range.id = session.addMarker(range, "ace_active-line", "screenLine");
+ session.$highlightLineMarker = range;
+ } else if (highlight) {
+ session.$highlightLineMarker.start.row = highlight.row;
+ session.$highlightLineMarker.end.row = highlight.row;
+ session.$highlightLineMarker.start.column = highlight.column;
+ session._signal("changeBackMarker");
+ }
+ };
+
+ this.onSelectionChange = function(e) {
+ var session = this.session;
+
+ if (session.$selectionMarker) {
+ session.removeMarker(session.$selectionMarker);
+ }
+ session.$selectionMarker = null;
+
+ if (!this.selection.isEmpty()) {
+ var range = this.selection.getRange();
+ var style = this.getSelectionStyle();
+ session.$selectionMarker = session.addMarker(range, "ace_selection", style);
+ } else {
+ this.$updateHighlightActiveLine();
+ }
+
+ var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
+ this.session.highlight(re);
+
+ this._signal("changeSelection");
+ };
+
+ this.$getSelectionHighLightRegexp = function() {
+ var session = this.session;
+
+ var selection = this.getSelectionRange();
+ if (selection.isEmpty() || selection.isMultiLine())
+ return;
+
+ var startOuter = selection.start.column - 1;
+ var endOuter = selection.end.column + 1;
+ var line = session.getLine(selection.start.row);
+ var lineCols = line.length;
+ var needle = line.substring(Math.max(startOuter, 0),
+ Math.min(endOuter, lineCols));
+ if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
+ (endOuter <= lineCols && /[\w\d]$/.test(needle)))
+ return;
+
+ needle = line.substring(selection.start.column, selection.end.column);
+ if (!/^[\w\d]+$/.test(needle))
+ return;
+
+ var re = this.$search.$assembleRegExp({
+ wholeWord: true,
+ caseSensitive: true,
+ needle: needle
+ });
+
+ return re;
+ };
+
+
+ this.onChangeFrontMarker = function() {
+ this.renderer.updateFrontMarkers();
+ };
+
+ this.onChangeBackMarker = function() {
+ this.renderer.updateBackMarkers();
+ };
+
+
+ this.onChangeBreakpoint = function() {
+ this.renderer.updateBreakpoints();
+ };
+
+ this.onChangeAnnotation = function() {
+ this.renderer.setAnnotations(this.session.getAnnotations());
+ };
+
+
+ this.onChangeMode = function(e) {
+ this.renderer.updateText();
+ this._emit("changeMode", e);
+ };
+
+
+ this.onChangeWrapLimit = function() {
+ this.renderer.updateFull();
+ };
+
+ this.onChangeWrapMode = function() {
+ this.renderer.onResize(true);
+ };
+
+
+ this.onChangeFold = function() {
+ this.$updateHighlightActiveLine();
+ this.renderer.updateFull();
+ };
+ this.getSelectedText = function() {
+ return this.session.getTextRange(this.getSelectionRange());
+ };
+ this.getCopyText = function() {
+ var text = this.getSelectedText();
+ this._signal("copy", text);
+ return text;
+ };
+ this.onCopy = function() {
+ this.commands.exec("copy", this);
+ };
+ this.onCut = function() {
+ this.commands.exec("cut", this);
+ };
+ this.onPaste = function(text, event) {
+ var e = {text: text, event: event};
+ this.commands.exec("paste", this, e);
+ };
+
+ this.$handlePaste = function(e) {
+ if (typeof e == "string")
+ e = {text: e};
+ this._signal("paste", e);
+ var text = e.text;
+ if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {
+ this.insert(text);
+ } else {
+ var lines = text.split(/\r\n|\r|\n/);
+ var ranges = this.selection.rangeList.ranges;
+
+ if (lines.length > ranges.length || lines.length < 2 || !lines[1])
+ return this.commands.exec("insertstring", this, text);
+
+ for (var i = ranges.length; i--;) {
+ var range = ranges[i];
+ if (!range.isEmpty())
+ this.session.remove(range);
+
+ this.session.insert(range.start, lines[i]);
+ }
+ }
+ };
+
+ this.execCommand = function(command, args) {
+ return this.commands.exec(command, this, args);
+ };
+ this.insert = function(text, pasted) {
+ var session = this.session;
+ var mode = session.getMode();
+ var cursor = this.getCursorPosition();
+
+ if (this.getBehavioursEnabled() && !pasted) {
+ var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
+ if (transform) {
+ if (text !== transform.text) {
+ this.session.mergeUndoDeltas = false;
+ this.$mergeNextCommand = false;
+ }
+ text = transform.text;
+
+ }
+ }
+
+ if (text == "\t")
+ text = this.session.getTabString();
+ if (!this.selection.isEmpty()) {
+ var range = this.getSelectionRange();
+ cursor = this.session.remove(range);
+ this.clearSelection();
+ }
+ else if (this.session.getOverwrite()) {
+ var range = new Range.fromPoints(cursor, cursor);
+ range.end.column += text.length;
+ this.session.remove(range);
+ }
+
+ if (text == "\n" || text == "\r\n") {
+ var line = session.getLine(cursor.row);
+ if (cursor.column > line.search(/\S|$/)) {
+ var d = line.substr(cursor.column).search(/\S|$/);
+ session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d);
+ }
+ }
+ this.clearSelection();
+
+ var start = cursor.column;
+ var lineState = session.getState(cursor.row);
+ var line = session.getLine(cursor.row);
+ var shouldOutdent = mode.checkOutdent(lineState, line, text);
+ var end = session.insert(cursor, text);
+
+ if (transform && transform.selection) {
+ if (transform.selection.length == 2) { // Transform relative to the current column
+ this.selection.setSelectionRange(
+ new Range(cursor.row, start + transform.selection[0],
+ cursor.row, start + transform.selection[1]));
+ } else { // Transform relative to the current row.
+ this.selection.setSelectionRange(
+ new Range(cursor.row + transform.selection[0],
+ transform.selection[1],
+ cursor.row + transform.selection[2],
+ transform.selection[3]));
+ }
+ }
+
+ if (session.getDocument().isNewLine(text)) {
+ var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
+
+ session.insert({row: cursor.row+1, column: 0}, lineIndent);
+ }
+ if (shouldOutdent)
+ mode.autoOutdent(lineState, session, cursor.row);
+ };
+
+ this.onTextInput = function(text) {
+ this.keyBinding.onTextInput(text);
+ };
+
+ this.onCommandKey = function(e, hashId, keyCode) {
+ this.keyBinding.onCommandKey(e, hashId, keyCode);
+ };
+ this.setOverwrite = function(overwrite) {
+ this.session.setOverwrite(overwrite);
+ };
+ this.getOverwrite = function() {
+ return this.session.getOverwrite();
+ };
+ this.toggleOverwrite = function() {
+ this.session.toggleOverwrite();
+ };
+ this.setScrollSpeed = function(speed) {
+ this.setOption("scrollSpeed", speed);
+ };
+ this.getScrollSpeed = function() {
+ return this.getOption("scrollSpeed");
+ };
+ this.setDragDelay = function(dragDelay) {
+ this.setOption("dragDelay", dragDelay);
+ };
+ this.getDragDelay = function() {
+ return this.getOption("dragDelay");
+ };
+ this.setSelectionStyle = function(val) {
+ this.setOption("selectionStyle", val);
+ };
+ this.getSelectionStyle = function() {
+ return this.getOption("selectionStyle");
+ };
+ this.setHighlightActiveLine = function(shouldHighlight) {
+ this.setOption("highlightActiveLine", shouldHighlight);
+ };
+ this.getHighlightActiveLine = function() {
+ return this.getOption("highlightActiveLine");
+ };
+ this.setHighlightGutterLine = function(shouldHighlight) {
+ this.setOption("highlightGutterLine", shouldHighlight);
+ };
+
+ this.getHighlightGutterLine = function() {
+ return this.getOption("highlightGutterLine");
+ };
+ this.setHighlightSelectedWord = function(shouldHighlight) {
+ this.setOption("highlightSelectedWord", shouldHighlight);
+ };
+ this.getHighlightSelectedWord = function() {
+ return this.$highlightSelectedWord;
+ };
+
+ this.setAnimatedScroll = function(shouldAnimate){
+ this.renderer.setAnimatedScroll(shouldAnimate);
+ };
+
+ this.getAnimatedScroll = function(){
+ return this.renderer.getAnimatedScroll();
+ };
+ this.setShowInvisibles = function(showInvisibles) {
+ this.renderer.setShowInvisibles(showInvisibles);
+ };
+ this.getShowInvisibles = function() {
+ return this.renderer.getShowInvisibles();
+ };
+
+ this.setDisplayIndentGuides = function(display) {
+ this.renderer.setDisplayIndentGuides(display);
+ };
+
+ this.getDisplayIndentGuides = function() {
+ return this.renderer.getDisplayIndentGuides();
+ };
+ this.setShowPrintMargin = function(showPrintMargin) {
+ this.renderer.setShowPrintMargin(showPrintMargin);
+ };
+ this.getShowPrintMargin = function() {
+ return this.renderer.getShowPrintMargin();
+ };
+ this.setPrintMarginColumn = function(showPrintMargin) {
+ this.renderer.setPrintMarginColumn(showPrintMargin);
+ };
+ this.getPrintMarginColumn = function() {
+ return this.renderer.getPrintMarginColumn();
+ };
+ this.setReadOnly = function(readOnly) {
+ this.setOption("readOnly", readOnly);
+ };
+ this.getReadOnly = function() {
+ return this.getOption("readOnly");
+ };
+ this.setBehavioursEnabled = function (enabled) {
+ this.setOption("behavioursEnabled", enabled);
+ };
+ this.getBehavioursEnabled = function () {
+ return this.getOption("behavioursEnabled");
+ };
+ this.setWrapBehavioursEnabled = function (enabled) {
+ this.setOption("wrapBehavioursEnabled", enabled);
+ };
+ this.getWrapBehavioursEnabled = function () {
+ return this.getOption("wrapBehavioursEnabled");
+ };
+ this.setShowFoldWidgets = function(show) {
+ this.setOption("showFoldWidgets", show);
+
+ };
+ this.getShowFoldWidgets = function() {
+ return this.getOption("showFoldWidgets");
+ };
+
+ this.setFadeFoldWidgets = function(fade) {
+ this.setOption("fadeFoldWidgets", fade);
+ };
+
+ this.getFadeFoldWidgets = function() {
+ return this.getOption("fadeFoldWidgets");
+ };
+ this.remove = function(dir) {
+ if (this.selection.isEmpty()){
+ if (dir == "left")
+ this.selection.selectLeft();
+ else
+ this.selection.selectRight();
+ }
+
+ var range = this.getSelectionRange();
+ if (this.getBehavioursEnabled()) {
+ var session = this.session;
+ var state = session.getState(range.start.row);
+ var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
+
+ if (range.end.column === 0) {
+ var text = session.getTextRange(range);
+ if (text[text.length - 1] == "\n") {
+ var line = session.getLine(range.end.row);
+ if (/^\s+$/.test(line)) {
+ range.end.column = line.length;
+ }
+ }
+ }
+ if (new_range)
+ range = new_range;
+ }
+
+ this.session.remove(range);
+ this.clearSelection();
+ };
+ this.removeWordRight = function() {
+ if (this.selection.isEmpty())
+ this.selection.selectWordRight();
+
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ };
+ this.removeWordLeft = function() {
+ if (this.selection.isEmpty())
+ this.selection.selectWordLeft();
+
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ };
+ this.removeToLineStart = function() {
+ if (this.selection.isEmpty())
+ this.selection.selectLineStart();
+
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ };
+ this.removeToLineEnd = function() {
+ if (this.selection.isEmpty())
+ this.selection.selectLineEnd();
+
+ var range = this.getSelectionRange();
+ if (range.start.column == range.end.column && range.start.row == range.end.row) {
+ range.end.column = 0;
+ range.end.row++;
+ }
+
+ this.session.remove(range);
+ this.clearSelection();
+ };
+ this.splitLine = function() {
+ if (!this.selection.isEmpty()) {
+ this.session.remove(this.getSelectionRange());
+ this.clearSelection();
+ }
+
+ var cursor = this.getCursorPosition();
+ this.insert("\n");
+ this.moveCursorToPosition(cursor);
+ };
+ this.transposeLetters = function() {
+ if (!this.selection.isEmpty()) {
+ return;
+ }
+
+ var cursor = this.getCursorPosition();
+ var column = cursor.column;
+ if (column === 0)
+ return;
+
+ var line = this.session.getLine(cursor.row);
+ var swap, range;
+ if (column < line.length) {
+ swap = line.charAt(column) + line.charAt(column-1);
+ range = new Range(cursor.row, column-1, cursor.row, column+1);
+ }
+ else {
+ swap = line.charAt(column-1) + line.charAt(column-2);
+ range = new Range(cursor.row, column-2, cursor.row, column);
+ }
+ this.session.replace(range, swap);
+ };
+ this.toLowerCase = function() {
+ var originalRange = this.getSelectionRange();
+ if (this.selection.isEmpty()) {
+ this.selection.selectWord();
+ }
+
+ var range = this.getSelectionRange();
+ var text = this.session.getTextRange(range);
+ this.session.replace(range, text.toLowerCase());
+ this.selection.setSelectionRange(originalRange);
+ };
+ this.toUpperCase = function() {
+ var originalRange = this.getSelectionRange();
+ if (this.selection.isEmpty()) {
+ this.selection.selectWord();
+ }
+
+ var range = this.getSelectionRange();
+ var text = this.session.getTextRange(range);
+ this.session.replace(range, text.toUpperCase());
+ this.selection.setSelectionRange(originalRange);
+ };
+ this.indent = function() {
+ var session = this.session;
+ var range = this.getSelectionRange();
+
+ if (range.start.row < range.end.row) {
+ var rows = this.$getSelectedRows();
+ session.indentRows(rows.first, rows.last, "\t");
+ return;
+ } else if (range.start.column < range.end.column) {
+ var text = session.getTextRange(range);
+ if (!/^\s+$/.test(text)) {
+ var rows = this.$getSelectedRows();
+ session.indentRows(rows.first, rows.last, "\t");
+ return;
+ }
+ }
+
+ var line = session.getLine(range.start.row);
+ var position = range.start;
+ var size = session.getTabSize();
+ var column = session.documentToScreenColumn(position.row, position.column);
+
+ if (this.session.getUseSoftTabs()) {
+ var count = (size - column % size);
+ var indentString = lang.stringRepeat(" ", count);
+ } else {
+ var count = column % size;
+ while (line[range.start.column] == " " && count) {
+ range.start.column--;
+ count--;
+ }
+ this.selection.setSelectionRange(range);
+ indentString = "\t";
+ }
+ return this.insert(indentString);
+ };
+ this.blockIndent = function() {
+ var rows = this.$getSelectedRows();
+ this.session.indentRows(rows.first, rows.last, "\t");
+ };
+ this.blockOutdent = function() {
+ var selection = this.session.getSelection();
+ this.session.outdentRows(selection.getRange());
+ };
+ this.sortLines = function() {
+ var rows = this.$getSelectedRows();
+ var session = this.session;
+
+ var lines = [];
+ for (i = rows.first; i <= rows.last; i++)
+ lines.push(session.getLine(i));
+
+ lines.sort(function(a, b) {
+ if (a.toLowerCase() < b.toLowerCase()) return -1;
+ if (a.toLowerCase() > b.toLowerCase()) return 1;
+ return 0;
+ });
+
+ var deleteRange = new Range(0, 0, 0, 0);
+ for (var i = rows.first; i <= rows.last; i++) {
+ var line = session.getLine(i);
+ deleteRange.start.row = i;
+ deleteRange.end.row = i;
+ deleteRange.end.column = line.length;
+ session.replace(deleteRange, lines[i-rows.first]);
+ }
+ };
+ this.toggleCommentLines = function() {
+ var state = this.session.getState(this.getCursorPosition().row);
+ var rows = this.$getSelectedRows();
+ this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
+ };
+
+ this.toggleBlockComment = function() {
+ var cursor = this.getCursorPosition();
+ var state = this.session.getState(cursor.row);
+ var range = this.getSelectionRange();
+ this.session.getMode().toggleBlockComment(state, this.session, range, cursor);
+ };
+ this.getNumberAt = function(row, column) {
+ var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
+ _numberRx.lastIndex = 0;
+
+ var s = this.session.getLine(row);
+ while (_numberRx.lastIndex < column) {
+ var m = _numberRx.exec(s);
+ if(m.index <= column && m.index+m[0].length >= column){
+ var number = {
+ value: m[0],
+ start: m.index,
+ end: m.index+m[0].length
+ };
+ return number;
+ }
+ }
+ return null;
+ };
+ this.modifyNumber = function(amount) {
+ var row = this.selection.getCursor().row;
+ var column = this.selection.getCursor().column;
+ var charRange = new Range(row, column-1, row, column);
+
+ var c = this.session.getTextRange(charRange);
+ if (!isNaN(parseFloat(c)) && isFinite(c)) {
+ var nr = this.getNumberAt(row, column);
+ if (nr) {
+ var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end;
+ var decimals = nr.start + nr.value.length - fp;
+
+ var t = parseFloat(nr.value);
+ t *= Math.pow(10, decimals);
+
+
+ if(fp !== nr.end && column < fp){
+ amount *= Math.pow(10, nr.end - column - 1);
+ } else {
+ amount *= Math.pow(10, nr.end - column);
+ }
+
+ t += amount;
+ t /= Math.pow(10, decimals);
+ var nnr = t.toFixed(decimals);
+ var replaceRange = new Range(row, nr.start, row, nr.end);
+ this.session.replace(replaceRange, nnr);
+ this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length));
+
+ }
+ }
+ };
+ this.removeLines = function() {
+ var rows = this.$getSelectedRows();
+ this.session.removeFullLines(rows.first, rows.last);
+ this.clearSelection();
+ };
+
+ this.duplicateSelection = function() {
+ var sel = this.selection;
+ var doc = this.session;
+ var range = sel.getRange();
+ var reverse = sel.isBackwards();
+ if (range.isEmpty()) {
+ var row = range.start.row;
+ doc.duplicateLines(row, row);
+ } else {
+ var point = reverse ? range.start : range.end;
+ var endPoint = doc.insert(point, doc.getTextRange(range), false);
+ range.start = point;
+ range.end = endPoint;
+
+ sel.setSelectionRange(range, reverse);
+ }
+ };
+ this.moveLinesDown = function() {
+ this.$moveLines(1, false);
+ };
+ this.moveLinesUp = function() {
+ this.$moveLines(-1, false);
+ };
+ this.moveText = function(range, toPosition, copy) {
+ return this.session.moveText(range, toPosition, copy);
+ };
+ this.copyLinesUp = function() {
+ this.$moveLines(-1, true);
+ };
+ this.copyLinesDown = function() {
+ this.$moveLines(1, true);
+ };
+ this.$moveLines = function(dir, copy) {
+ var rows, moved;
+ var selection = this.selection;
+ if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
+ var range = selection.toOrientedRange();
+ rows = this.$getSelectedRows(range);
+ moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir);
+ if (copy && dir == -1) moved = 0;
+ range.moveBy(moved, 0);
+ selection.fromOrientedRange(range);
+ } else {
+ var ranges = selection.rangeList.ranges;
+ selection.rangeList.detach(this.session);
+ this.inVirtualSelectionMode = true;
+
+ var diff = 0;
+ var totalDiff = 0;
+ var l = ranges.length;
+ for (var i = 0; i < l; i++) {
+ var rangeIndex = i;
+ ranges[i].moveBy(diff, 0);
+ rows = this.$getSelectedRows(ranges[i]);
+ var first = rows.first;
+ var last = rows.last;
+ while (++i < l) {
+ if (totalDiff) ranges[i].moveBy(totalDiff, 0);
+ var subRows = this.$getSelectedRows(ranges[i]);
+ if (copy && subRows.first != last)
+ break;
+ else if (!copy && subRows.first > last + 1)
+ break;
+ last = subRows.last;
+ }
+ i--;
+ diff = this.session.$moveLines(first, last, copy ? 0 : dir);
+ if (copy && dir == -1) rangeIndex = i + 1;
+ while (rangeIndex <= i) {
+ ranges[rangeIndex].moveBy(diff, 0);
+ rangeIndex++;
+ }
+ if (!copy) diff = 0;
+ totalDiff += diff;
+ }
+
+ selection.fromOrientedRange(selection.ranges[0]);
+ selection.rangeList.attach(this.session);
+ this.inVirtualSelectionMode = false;
+ }
+ };
+ this.$getSelectedRows = function(range) {
+ range = (range || this.getSelectionRange()).collapseRows();
+
+ return {
+ first: this.session.getRowFoldStart(range.start.row),
+ last: this.session.getRowFoldEnd(range.end.row)
+ };
+ };
+
+ this.onCompositionStart = function(text) {
+ this.renderer.showComposition(this.getCursorPosition());
+ };
+
+ this.onCompositionUpdate = function(text) {
+ this.renderer.setCompositionText(text);
+ };
+
+ this.onCompositionEnd = function() {
+ this.renderer.hideComposition();
+ };
+ this.getFirstVisibleRow = function() {
+ return this.renderer.getFirstVisibleRow();
+ };
+ this.getLastVisibleRow = function() {
+ return this.renderer.getLastVisibleRow();
+ };
+ this.isRowVisible = function(row) {
+ return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
+ };
+ this.isRowFullyVisible = function(row) {
+ return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
+ };
+ this.$getVisibleRowCount = function() {
+ return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
+ };
+
+ this.$moveByPage = function(dir, select) {
+ var renderer = this.renderer;
+ var config = this.renderer.layerConfig;
+ var rows = dir * Math.floor(config.height / config.lineHeight);
+
+ this.$blockScrolling++;
+ if (select === true) {
+ this.selection.$moveSelection(function(){
+ this.moveCursorBy(rows, 0);
+ });
+ } else if (select === false) {
+ this.selection.moveCursorBy(rows, 0);
+ this.selection.clearSelection();
+ }
+ this.$blockScrolling--;
+
+ var scrollTop = renderer.scrollTop;
+
+ renderer.scrollBy(0, rows * config.lineHeight);
+ if (select != null)
+ renderer.scrollCursorIntoView(null, 0.5);
+
+ renderer.animateScrolling(scrollTop);
+ };
+ this.selectPageDown = function() {
+ this.$moveByPage(1, true);
+ };
+ this.selectPageUp = function() {
+ this.$moveByPage(-1, true);
+ };
+ this.gotoPageDown = function() {
+ this.$moveByPage(1, false);
+ };
+ this.gotoPageUp = function() {
+ this.$moveByPage(-1, false);
+ };
+ this.scrollPageDown = function() {
+ this.$moveByPage(1);
+ };
+ this.scrollPageUp = function() {
+ this.$moveByPage(-1);
+ };
+ this.scrollToRow = function(row) {
+ this.renderer.scrollToRow(row);
+ };
+ this.scrollToLine = function(line, center, animate, callback) {
+ this.renderer.scrollToLine(line, center, animate, callback);
+ };
+ this.centerSelection = function() {
+ var range = this.getSelectionRange();
+ var pos = {
+ row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
+ column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
+ };
+ this.renderer.alignCursor(pos, 0.5);
+ };
+ this.getCursorPosition = function() {
+ return this.selection.getCursor();
+ };
+ this.getCursorPositionScreen = function() {
+ return this.session.documentToScreenPosition(this.getCursorPosition());
+ };
+ this.getSelectionRange = function() {
+ return this.selection.getRange();
+ };
+ this.selectAll = function() {
+ this.$blockScrolling += 1;
+ this.selection.selectAll();
+ this.$blockScrolling -= 1;
+ };
+ this.clearSelection = function() {
+ this.selection.clearSelection();
+ };
+ this.moveCursorTo = function(row, column) {
+ this.selection.moveCursorTo(row, column);
+ };
+ this.moveCursorToPosition = function(pos) {
+ this.selection.moveCursorToPosition(pos);
+ };
+ this.jumpToMatching = function(select, expand) {
+ var cursor = this.getCursorPosition();
+ var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
+ var prevToken = iterator.getCurrentToken();
+ var token = prevToken || iterator.stepForward();
+
+ if (!token) return;
+ var matchType;
+ var found = false;
+ var depth = {};
+ var i = cursor.column - token.start;
+ var bracketType;
+ var brackets = {
+ ")": "(",
+ "(": "(",
+ "]": "[",
+ "[": "[",
+ "{": "{",
+ "}": "{"
+ };
+
+ do {
+ if (token.value.match(/[{}()\[\]]/g)) {
+ for (; i < token.value.length && !found; i++) {
+ if (!brackets[token.value[i]]) {
+ continue;
+ }
+
+ bracketType = brackets[token.value[i]] + '.' + token.type.replace("rparen", "lparen");
+
+ if (isNaN(depth[bracketType])) {
+ depth[bracketType] = 0;
+ }
+
+ switch (token.value[i]) {
+ case '(':
+ case '[':
+ case '{':
+ depth[bracketType]++;
+ break;
+ case ')':
+ case ']':
+ case '}':
+ depth[bracketType]--;
+
+ if (depth[bracketType] === -1) {
+ matchType = 'bracket';
+ found = true;
+ }
+ break;
+ }
+ }
+ }
+ else if (token && token.type.indexOf('tag-name') !== -1) {
+ if (isNaN(depth[token.value])) {
+ depth[token.value] = 0;
+ }
+
+ if (prevToken.value === '<') {
+ depth[token.value]++;
+ }
+ else if (prevToken.value === '') {
+ depth[token.value]--;
+ }
+
+ if (depth[token.value] === -1) {
+ matchType = 'tag';
+ found = true;
+ }
+ }
+
+ if (!found) {
+ prevToken = token;
+ token = iterator.stepForward();
+ i = 0;
+ }
+ } while (token && !found);
+ if (!matchType)
+ return;
+
+ var range, pos;
+ if (matchType === 'bracket') {
+ range = this.session.getBracketRange(cursor);
+ if (!range) {
+ range = new Range(
+ iterator.getCurrentTokenRow(),
+ iterator.getCurrentTokenColumn() + i - 1,
+ iterator.getCurrentTokenRow(),
+ iterator.getCurrentTokenColumn() + i - 1
+ );
+ pos = range.start;
+ if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
+ range = this.session.getBracketRange(pos);
+ }
+ }
+ else if (matchType === 'tag') {
+ if (token && token.type.indexOf('tag-name') !== -1)
+ var tag = token.value;
+ else
+ return;
+
+ range = new Range(
+ iterator.getCurrentTokenRow(),
+ iterator.getCurrentTokenColumn() - 2,
+ iterator.getCurrentTokenRow(),
+ iterator.getCurrentTokenColumn() - 2
+ );
+ if (range.compare(cursor.row, cursor.column) === 0) {
+ found = false;
+ do {
+ token = prevToken;
+ prevToken = iterator.stepBackward();
+
+ if (prevToken) {
+ if (prevToken.type.indexOf('tag-close') !== -1) {
+ range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1);
+ }
+
+ if (token.value === tag && token.type.indexOf('tag-name') !== -1) {
+ if (prevToken.value === '<') {
+ depth[tag]++;
+ }
+ else if (prevToken.value === '') {
+ depth[tag]--;
+ }
+
+ if (depth[tag] === 0)
+ found = true;
+ }
+ }
+ } while (prevToken && !found);
+ }
+ if (token && token.type.indexOf('tag-name')) {
+ pos = range.start;
+ if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
+ pos = range.end;
+ }
+ }
+
+ pos = range && range.cursor || pos;
+ if (pos) {
+ if (select) {
+ if (range && expand) {
+ this.selection.setRange(range);
+ } else if (range && range.isEqual(this.getSelectionRange())) {
+ this.clearSelection();
+ } else {
+ this.selection.selectTo(pos.row, pos.column);
+ }
+ } else {
+ this.selection.moveTo(pos.row, pos.column);
+ }
+ }
+ };
+ this.gotoLine = function(lineNumber, column, animate) {
+ this.selection.clearSelection();
+ this.session.unfold({row: lineNumber - 1, column: column || 0});
+
+ this.$blockScrolling += 1;
+ this.exitMultiSelectMode && this.exitMultiSelectMode();
+ this.moveCursorTo(lineNumber - 1, column || 0);
+ this.$blockScrolling -= 1;
+
+ if (!this.isRowFullyVisible(lineNumber - 1))
+ this.scrollToLine(lineNumber - 1, true, animate);
+ };
+ this.navigateTo = function(row, column) {
+ this.selection.moveTo(row, column);
+ };
+ this.navigateUp = function(times) {
+ if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
+ var selectionStart = this.selection.anchor.getPosition();
+ return this.moveCursorToPosition(selectionStart);
+ }
+ this.selection.clearSelection();
+ this.selection.moveCursorBy(-times || -1, 0);
+ };
+ this.navigateDown = function(times) {
+ if (this.selection.isMultiLine() && this.selection.isBackwards()) {
+ var selectionEnd = this.selection.anchor.getPosition();
+ return this.moveCursorToPosition(selectionEnd);
+ }
+ this.selection.clearSelection();
+ this.selection.moveCursorBy(times || 1, 0);
+ };
+ this.navigateLeft = function(times) {
+ if (!this.selection.isEmpty()) {
+ var selectionStart = this.getSelectionRange().start;
+ this.moveCursorToPosition(selectionStart);
+ }
+ else {
+ times = times || 1;
+ while (times--) {
+ this.selection.moveCursorLeft();
+ }
+ }
+ this.clearSelection();
+ };
+ this.navigateRight = function(times) {
+ if (!this.selection.isEmpty()) {
+ var selectionEnd = this.getSelectionRange().end;
+ this.moveCursorToPosition(selectionEnd);
+ }
+ else {
+ times = times || 1;
+ while (times--) {
+ this.selection.moveCursorRight();
+ }
+ }
+ this.clearSelection();
+ };
+ this.navigateLineStart = function() {
+ this.selection.moveCursorLineStart();
+ this.clearSelection();
+ };
+ this.navigateLineEnd = function() {
+ this.selection.moveCursorLineEnd();
+ this.clearSelection();
+ };
+ this.navigateFileEnd = function() {
+ this.selection.moveCursorFileEnd();
+ this.clearSelection();
+ };
+ this.navigateFileStart = function() {
+ this.selection.moveCursorFileStart();
+ this.clearSelection();
+ };
+ this.navigateWordRight = function() {
+ this.selection.moveCursorWordRight();
+ this.clearSelection();
+ };
+ this.navigateWordLeft = function() {
+ this.selection.moveCursorWordLeft();
+ this.clearSelection();
+ };
+ this.replace = function(replacement, options) {
+ if (options)
+ this.$search.set(options);
+
+ var range = this.$search.find(this.session);
+ var replaced = 0;
+ if (!range)
+ return replaced;
+
+ if (this.$tryReplace(range, replacement)) {
+ replaced = 1;
+ }
+ if (range !== null) {
+ this.selection.setSelectionRange(range);
+ this.renderer.scrollSelectionIntoView(range.start, range.end);
+ }
+
+ return replaced;
+ };
+ this.replaceAll = function(replacement, options) {
+ if (options) {
+ this.$search.set(options);
+ }
+
+ var ranges = this.$search.findAll(this.session);
+ var replaced = 0;
+ if (!ranges.length)
+ return replaced;
+
+ this.$blockScrolling += 1;
+
+ var selection = this.getSelectionRange();
+ this.selection.moveTo(0, 0);
+
+ for (var i = ranges.length - 1; i >= 0; --i) {
+ if(this.$tryReplace(ranges[i], replacement)) {
+ replaced++;
+ }
+ }
+
+ this.selection.setSelectionRange(selection);
+ this.$blockScrolling -= 1;
+
+ return replaced;
+ };
+
+ this.$tryReplace = function(range, replacement) {
+ var input = this.session.getTextRange(range);
+ replacement = this.$search.replace(input, replacement);
+ if (replacement !== null) {
+ range.end = this.session.replace(range, replacement);
+ return range;
+ } else {
+ return null;
+ }
+ };
+ this.getLastSearchOptions = function() {
+ return this.$search.getOptions();
+ };
+ this.find = function(needle, options, animate) {
+ if (!options)
+ options = {};
+
+ if (typeof needle == "string" || needle instanceof RegExp)
+ options.needle = needle;
+ else if (typeof needle == "object")
+ oop.mixin(options, needle);
+
+ var range = this.selection.getRange();
+ if (options.needle == null) {
+ needle = this.session.getTextRange(range)
+ || this.$search.$options.needle;
+ if (!needle) {
+ range = this.session.getWordRange(range.start.row, range.start.column);
+ needle = this.session.getTextRange(range);
+ }
+ this.$search.set({needle: needle});
+ }
+
+ this.$search.set(options);
+ if (!options.start)
+ this.$search.set({start: range});
+
+ var newRange = this.$search.find(this.session);
+ if (options.preventScroll)
+ return newRange;
+ if (newRange) {
+ this.revealRange(newRange, animate);
+ return newRange;
+ }
+ if (options.backwards)
+ range.start = range.end;
+ else
+ range.end = range.start;
+ this.selection.setRange(range);
+ };
+ this.findNext = function(options, animate) {
+ this.find({skipCurrent: true, backwards: false}, options, animate);
+ };
+ this.findPrevious = function(options, animate) {
+ this.find(options, {skipCurrent: true, backwards: true}, animate);
+ };
+
+ this.revealRange = function(range, animate) {
+ this.$blockScrolling += 1;
+ this.session.unfold(range);
+ this.selection.setSelectionRange(range);
+ this.$blockScrolling -= 1;
+
+ var scrollTop = this.renderer.scrollTop;
+ this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
+ if (animate !== false)
+ this.renderer.animateScrolling(scrollTop);
+ };
+ this.undo = function() {
+ this.$blockScrolling++;
+ this.session.getUndoManager().undo();
+ this.$blockScrolling--;
+ this.renderer.scrollCursorIntoView(null, 0.5);
+ };
+ this.redo = function() {
+ this.$blockScrolling++;
+ this.session.getUndoManager().redo();
+ this.$blockScrolling--;
+ this.renderer.scrollCursorIntoView(null, 0.5);
+ };
+ this.destroy = function() {
+ this.renderer.destroy();
+ this._signal("destroy", this);
+ if (this.session) {
+ this.session.destroy();
+ }
+ };
+ this.setAutoScrollEditorIntoView = function(enable) {
+ if (!enable)
+ return;
+ var rect;
+ var self = this;
+ var shouldScroll = false;
+ if (!this.$scrollAnchor)
+ this.$scrollAnchor = document.createElement("div");
+ var scrollAnchor = this.$scrollAnchor;
+ scrollAnchor.style.cssText = "position:absolute";
+ this.container.insertBefore(scrollAnchor, this.container.firstChild);
+ var onChangeSelection = this.on("changeSelection", function() {
+ shouldScroll = true;
+ });
+ var onBeforeRender = this.renderer.on("beforeRender", function() {
+ if (shouldScroll)
+ rect = self.renderer.container.getBoundingClientRect();
+ });
+ var onAfterRender = this.renderer.on("afterRender", function() {
+ if (shouldScroll && rect && (self.isFocused()
+ || self.searchBox && self.searchBox.isFocused())
+ ) {
+ var renderer = self.renderer;
+ var pos = renderer.$cursorLayer.$pixelPos;
+ var config = renderer.layerConfig;
+ var top = pos.top - config.offset;
+ if (pos.top >= 0 && top + rect.top < 0) {
+ shouldScroll = true;
+ } else if (pos.top < config.height &&
+ pos.top + rect.top + config.lineHeight > window.innerHeight) {
+ shouldScroll = false;
+ } else {
+ shouldScroll = null;
+ }
+ if (shouldScroll != null) {
+ scrollAnchor.style.top = top + "px";
+ scrollAnchor.style.left = pos.left + "px";
+ scrollAnchor.style.height = config.lineHeight + "px";
+ scrollAnchor.scrollIntoView(shouldScroll);
+ }
+ shouldScroll = rect = null;
+ }
+ });
+ this.setAutoScrollEditorIntoView = function(enable) {
+ if (enable)
+ return;
+ delete this.setAutoScrollEditorIntoView;
+ this.off("changeSelection", onChangeSelection);
+ this.renderer.off("afterRender", onAfterRender);
+ this.renderer.off("beforeRender", onBeforeRender);
+ };
+ };
+
+
+ this.$resetCursorStyle = function() {
+ var style = this.$cursorStyle || "ace";
+ var cursorLayer = this.renderer.$cursorLayer;
+ if (!cursorLayer)
+ return;
+ cursorLayer.setSmoothBlinking(/smooth/.test(style));
+ cursorLayer.isBlinking = !this.$readOnly && style != "wide";
+ dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
+ };
+
+}).call(Editor.prototype);
+
+
+
+config.defineOptions(Editor.prototype, "editor", {
+ selectionStyle: {
+ set: function(style) {
+ this.onSelectionChange();
+ this._signal("changeSelectionStyle", {data: style});
+ },
+ initialValue: "line"
+ },
+ highlightActiveLine: {
+ set: function() {this.$updateHighlightActiveLine();},
+ initialValue: true
+ },
+ highlightSelectedWord: {
+ set: function(shouldHighlight) {this.$onSelectionChange();},
+ initialValue: true
+ },
+ readOnly: {
+ set: function(readOnly) {
+ this.$resetCursorStyle();
+ },
+ initialValue: false
+ },
+ cursorStyle: {
+ set: function(val) { this.$resetCursorStyle(); },
+ values: ["ace", "slim", "smooth", "wide"],
+ initialValue: "ace"
+ },
+ mergeUndoDeltas: {
+ values: [false, true, "always"],
+ initialValue: true
+ },
+ behavioursEnabled: {initialValue: true},
+ wrapBehavioursEnabled: {initialValue: true},
+ autoScrollEditorIntoView: {
+ set: function(val) {this.setAutoScrollEditorIntoView(val)}
+ },
+ keyboardHandler: {
+ set: function(val) { this.setKeyboardHandler(val); },
+ get: function() { return this.keybindingId; },
+ handlesSet: true
+ },
+
+ hScrollBarAlwaysVisible: "renderer",
+ vScrollBarAlwaysVisible: "renderer",
+ highlightGutterLine: "renderer",
+ animatedScroll: "renderer",
+ showInvisibles: "renderer",
+ showPrintMargin: "renderer",
+ printMarginColumn: "renderer",
+ printMargin: "renderer",
+ fadeFoldWidgets: "renderer",
+ showFoldWidgets: "renderer",
+ showLineNumbers: "renderer",
+ showGutter: "renderer",
+ displayIndentGuides: "renderer",
+ fontSize: "renderer",
+ fontFamily: "renderer",
+ maxLines: "renderer",
+ minLines: "renderer",
+ scrollPastEnd: "renderer",
+ fixedWidthGutter: "renderer",
+ theme: "renderer",
+
+ scrollSpeed: "$mouseHandler",
+ dragDelay: "$mouseHandler",
+ dragEnabled: "$mouseHandler",
+ focusTimout: "$mouseHandler",
+ tooltipFollowsMouse: "$mouseHandler",
+
+ firstLineNumber: "session",
+ overwrite: "session",
+ newLineMode: "session",
+ useWorker: "session",
+ useSoftTabs: "session",
+ tabSize: "session",
+ wrap: "session",
+ indentedSoftWrap: "session",
+ foldStyle: "session",
+ mode: "session"
+});
+
+exports.Editor = Editor;
+});
+
+ace.define("ace/undomanager",["require","exports","module"], function(acequire, exports, module) {
+"use strict";
+var UndoManager = function() {
+ this.reset();
+};
+
+(function() {
+ this.execute = function(options) {
+ var deltaSets = options.args[0];
+ this.$doc = options.args[1];
+ if (options.merge && this.hasUndo()){
+ this.dirtyCounter--;
+ deltaSets = this.$undoStack.pop().concat(deltaSets);
+ }
+ this.$undoStack.push(deltaSets);
+ this.$redoStack = [];
+ if (this.dirtyCounter < 0) {
+ this.dirtyCounter = NaN;
+ }
+ this.dirtyCounter++;
+ };
+ this.undo = function(dontSelect) {
+ var deltaSets = this.$undoStack.pop();
+ var undoSelectionRange = null;
+ if (deltaSets) {
+ undoSelectionRange = this.$doc.undoChanges(deltaSets, dontSelect);
+ this.$redoStack.push(deltaSets);
+ this.dirtyCounter--;
+ }
+
+ return undoSelectionRange;
+ };
+ this.redo = function(dontSelect) {
+ var deltaSets = this.$redoStack.pop();
+ var redoSelectionRange = null;
+ if (deltaSets) {
+ redoSelectionRange =
+ this.$doc.redoChanges(this.$deserializeDeltas(deltaSets), dontSelect);
+ this.$undoStack.push(deltaSets);
+ this.dirtyCounter++;
+ }
+ return redoSelectionRange;
+ };
+ this.reset = function() {
+ this.$undoStack = [];
+ this.$redoStack = [];
+ this.dirtyCounter = 0;
+ };
+ this.hasUndo = function() {
+ return this.$undoStack.length > 0;
+ };
+ this.hasRedo = function() {
+ return this.$redoStack.length > 0;
+ };
+ this.markClean = function() {
+ this.dirtyCounter = 0;
+ };
+ this.isClean = function() {
+ return this.dirtyCounter === 0;
+ };
+ this.$serializeDeltas = function(deltaSets) {
+ return cloneDeltaSetsObj(deltaSets, $serializeDelta);
+ };
+ this.$deserializeDeltas = function(deltaSets) {
+ return cloneDeltaSetsObj(deltaSets, $deserializeDelta);
+ };
+
+ function $serializeDelta(delta){
+ return {
+ action: delta.action,
+ start: delta.start,
+ end: delta.end,
+ lines: delta.lines.length == 1 ? null : delta.lines,
+ text: delta.lines.length == 1 ? delta.lines[0] : null
+ };
+ }
+
+ function $deserializeDelta(delta) {
+ return {
+ action: delta.action,
+ start: delta.start,
+ end: delta.end,
+ lines: delta.lines || [delta.text]
+ };
+ }
+
+ function cloneDeltaSetsObj(deltaSets_old, fnGetModifiedDelta) {
+ var deltaSets_new = new Array(deltaSets_old.length);
+ for (var i = 0; i < deltaSets_old.length; i++) {
+ var deltaSet_old = deltaSets_old[i];
+ var deltaSet_new = { group: deltaSet_old.group, deltas: new Array(deltaSet_old.length)};
+
+ for (var j = 0; j < deltaSet_old.deltas.length; j++) {
+ var delta_old = deltaSet_old.deltas[j];
+ deltaSet_new.deltas[j] = fnGetModifiedDelta(delta_old);
+ }
+
+ deltaSets_new[i] = deltaSet_new;
+ }
+ return deltaSets_new;
+ }
+
+}).call(UndoManager.prototype);
+
+exports.UndoManager = UndoManager;
+});
+
+ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter"], function(acequire, exports, module) {
+"use strict";
+
+var dom = acequire("../lib/dom");
+var oop = acequire("../lib/oop");
+var lang = acequire("../lib/lang");
+var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
+
+var Gutter = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_gutter-layer";
+ parentEl.appendChild(this.element);
+ this.setShowFoldWidgets(this.$showFoldWidgets);
+
+ this.gutterWidth = 0;
+
+ this.$annotations = [];
+ this.$updateAnnotations = this.$updateAnnotations.bind(this);
+
+ this.$cells = [];
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.setSession = function(session) {
+ if (this.session)
+ this.session.removeEventListener("change", this.$updateAnnotations);
+ this.session = session;
+ if (session)
+ session.on("change", this.$updateAnnotations);
+ };
+
+ this.addGutterDecoration = function(row, className){
+ if (window.console)
+ console.warn && console.warn("deprecated use session.addGutterDecoration");
+ this.session.addGutterDecoration(row, className);
+ };
+
+ this.removeGutterDecoration = function(row, className){
+ if (window.console)
+ console.warn && console.warn("deprecated use session.removeGutterDecoration");
+ this.session.removeGutterDecoration(row, className);
+ };
+
+ this.setAnnotations = function(annotations) {
+ this.$annotations = [];
+ for (var i = 0; i < annotations.length; i++) {
+ var annotation = annotations[i];
+ var row = annotation.row;
+ var rowInfo = this.$annotations[row];
+ if (!rowInfo)
+ rowInfo = this.$annotations[row] = {text: []};
+
+ var annoText = annotation.text;
+ annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
+
+ if (rowInfo.text.indexOf(annoText) === -1)
+ rowInfo.text.push(annoText);
+
+ var type = annotation.type;
+ if (type == "error")
+ rowInfo.className = " ace_error";
+ else if (type == "warning" && rowInfo.className != " ace_error")
+ rowInfo.className = " ace_warning";
+ else if (type == "info" && (!rowInfo.className))
+ rowInfo.className = " ace_info";
+ }
+ };
+
+ this.$updateAnnotations = function (delta) {
+ if (!this.$annotations.length)
+ return;
+ var firstRow = delta.start.row;
+ var len = delta.end.row - firstRow;
+ if (len === 0) {
+ } else if (delta.action == 'remove') {
+ this.$annotations.splice(firstRow, len + 1, null);
+ } else {
+ var args = new Array(len + 1);
+ args.unshift(firstRow, 1);
+ this.$annotations.splice.apply(this.$annotations, args);
+ }
+ };
+
+ this.update = function(config) {
+ var session = this.session;
+ var firstRow = config.firstRow;
+ var lastRow = Math.min(config.lastRow + config.gutterOffset, // needed to compensate for hor scollbar
+ session.getLength() - 1);
+ var fold = session.getNextFoldLine(firstRow);
+ var foldStart = fold ? fold.start.row : Infinity;
+ var foldWidgets = this.$showFoldWidgets && session.foldWidgets;
+ var breakpoints = session.$breakpoints;
+ var decorations = session.$decorations;
+ var firstLineNumber = session.$firstLineNumber;
+ var lastLineNumber = 0;
+
+ var gutterRenderer = session.gutterRenderer || this.$renderer;
+
+ var cell = null;
+ var index = -1;
+ var row = firstRow;
+ while (true) {
+ if (row > foldStart) {
+ row = fold.end.row + 1;
+ fold = session.getNextFoldLine(row, fold);
+ foldStart = fold ? fold.start.row : Infinity;
+ }
+ if (row > lastRow) {
+ while (this.$cells.length > index + 1) {
+ cell = this.$cells.pop();
+ this.element.removeChild(cell.element);
+ }
+ break;
+ }
+
+ cell = this.$cells[++index];
+ if (!cell) {
+ cell = {element: null, textNode: null, foldWidget: null};
+ cell.element = dom.createElement("div");
+ cell.textNode = document.createTextNode('');
+ cell.element.appendChild(cell.textNode);
+ this.element.appendChild(cell.element);
+ this.$cells[index] = cell;
+ }
+
+ var className = "ace_gutter-cell ";
+ if (breakpoints[row])
+ className += breakpoints[row];
+ if (decorations[row])
+ className += decorations[row];
+ if (this.$annotations[row])
+ className += this.$annotations[row].className;
+ if (cell.element.className != className)
+ cell.element.className = className;
+
+ var height = session.getRowLength(row) * config.lineHeight + "px";
+ if (height != cell.element.style.height)
+ cell.element.style.height = height;
+
+ if (foldWidgets) {
+ var c = foldWidgets[row];
+ if (c == null)
+ c = foldWidgets[row] = session.getFoldWidget(row);
+ }
+
+ if (c) {
+ if (!cell.foldWidget) {
+ cell.foldWidget = dom.createElement("span");
+ cell.element.appendChild(cell.foldWidget);
+ }
+ var className = "ace_fold-widget ace_" + c;
+ if (c == "start" && row == foldStart && row < fold.end.row)
+ className += " ace_closed";
+ else
+ className += " ace_open";
+ if (cell.foldWidget.className != className)
+ cell.foldWidget.className = className;
+
+ var height = config.lineHeight + "px";
+ if (cell.foldWidget.style.height != height)
+ cell.foldWidget.style.height = height;
+ } else {
+ if (cell.foldWidget) {
+ cell.element.removeChild(cell.foldWidget);
+ cell.foldWidget = null;
+ }
+ }
+
+ var text = lastLineNumber = gutterRenderer
+ ? gutterRenderer.getText(session, row)
+ : row + firstLineNumber;
+ if (text != cell.textNode.data)
+ cell.textNode.data = text;
+
+ row++;
+ }
+
+ this.element.style.height = config.minHeight + "px";
+
+ if (this.$fixedWidth || session.$useWrapMode)
+ lastLineNumber = session.getLength() + firstLineNumber;
+
+ var gutterWidth = gutterRenderer
+ ? gutterRenderer.getWidth(session, lastLineNumber, config)
+ : lastLineNumber.toString().length * config.characterWidth;
+
+ var padding = this.$padding || this.$computePadding();
+ gutterWidth += padding.left + padding.right;
+ if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
+ this.gutterWidth = gutterWidth;
+ this.element.style.width = Math.ceil(this.gutterWidth) + "px";
+ this._emit("changeGutterWidth", gutterWidth);
+ }
+ };
+
+ this.$fixedWidth = false;
+
+ this.$showLineNumbers = true;
+ this.$renderer = "";
+ this.setShowLineNumbers = function(show) {
+ this.$renderer = !show && {
+ getWidth: function() {return ""},
+ getText: function() {return ""}
+ };
+ };
+
+ this.getShowLineNumbers = function() {
+ return this.$showLineNumbers;
+ };
+
+ this.$showFoldWidgets = true;
+ this.setShowFoldWidgets = function(show) {
+ if (show)
+ dom.addCssClass(this.element, "ace_folding-enabled");
+ else
+ dom.removeCssClass(this.element, "ace_folding-enabled");
+
+ this.$showFoldWidgets = show;
+ this.$padding = null;
+ };
+
+ this.getShowFoldWidgets = function() {
+ return this.$showFoldWidgets;
+ };
+
+ this.$computePadding = function() {
+ if (!this.element.firstChild)
+ return {left: 0, right: 0};
+ var style = dom.computedStyle(this.element.firstChild);
+ this.$padding = {};
+ this.$padding.left = parseInt(style.paddingLeft) + 1 || 0;
+ this.$padding.right = parseInt(style.paddingRight) || 0;
+ return this.$padding;
+ };
+
+ this.getRegion = function(point) {
+ var padding = this.$padding || this.$computePadding();
+ var rect = this.element.getBoundingClientRect();
+ if (point.x < padding.left + rect.left)
+ return "markers";
+ if (this.$showFoldWidgets && point.x > rect.right - padding.right)
+ return "foldWidgets";
+ };
+
+}).call(Gutter.prototype);
+
+exports.Gutter = Gutter;
+
+});
+
+ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../range").Range;
+var dom = acequire("../lib/dom");
+
+var Marker = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_marker-layer";
+ parentEl.appendChild(this.element);
+};
+
+(function() {
+
+ this.$padding = 0;
+
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ };
+ this.setSession = function(session) {
+ this.session = session;
+ };
+
+ this.setMarkers = function(markers) {
+ this.markers = markers;
+ };
+
+ this.update = function(config) {
+ var config = config || this.config;
+ if (!config)
+ return;
+
+ this.config = config;
+
+
+ var html = [];
+ for (var key in this.markers) {
+ var marker = this.markers[key];
+
+ if (!marker.range) {
+ marker.update(html, this, this.session, config);
+ continue;
+ }
+
+ var range = marker.range.clipRows(config.firstRow, config.lastRow);
+ if (range.isEmpty()) continue;
+
+ range = range.toScreenRange(this.session);
+ if (marker.renderer) {
+ var top = this.$getTop(range.start.row, config);
+ var left = this.$padding + range.start.column * config.characterWidth;
+ marker.renderer(html, range, left, top, config);
+ } else if (marker.type == "fullLine") {
+ this.drawFullLineMarker(html, range, marker.clazz, config);
+ } else if (marker.type == "screenLine") {
+ this.drawScreenLineMarker(html, range, marker.clazz, config);
+ } else if (range.isMultiLine()) {
+ if (marker.type == "text")
+ this.drawTextMarker(html, range, marker.clazz, config);
+ else
+ this.drawMultiLineMarker(html, range, marker.clazz, config);
+ } else {
+ this.drawSingleLineMarker(html, range, marker.clazz + " ace_start" + " ace_br15", config);
+ }
+ }
+ this.element.innerHTML = html.join("");
+ };
+
+ this.$getTop = function(row, layerConfig) {
+ return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
+ };
+
+ function getBorderClass(tl, tr, br, bl) {
+ return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0);
+ }
+ this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {
+ var session = this.session;
+ var start = range.start.row;
+ var end = range.end.row;
+ var row = start;
+ var prev = 0;
+ var curr = 0;
+ var next = session.getScreenLastRowColumn(row);
+ var lineRange = new Range(row, range.start.column, row, curr);
+ for (; row <= end; row++) {
+ lineRange.start.row = lineRange.end.row = row;
+ lineRange.start.column = row == start ? range.start.column : session.getRowWrapIndent(row);
+ lineRange.end.column = next;
+ prev = curr;
+ curr = next;
+ next = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range.end.column;
+ this.drawSingleLineMarker(stringBuilder, lineRange,
+ clazz + (row == start ? " ace_start" : "") + " ace_br"
+ + getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end),
+ layerConfig, row == end ? 0 : 1, extraStyle);
+ }
+ };
+ this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
+ var padding = this.$padding;
+ var height = config.lineHeight;
+ var top = this.$getTop(range.start.row, config);
+ var left = padding + range.start.column * config.characterWidth;
+ extraStyle = extraStyle || "";
+
+ stringBuilder.push(
+ "
"
+ );
+ top = this.$getTop(range.end.row, config);
+ var width = range.end.column * config.characterWidth;
+
+ stringBuilder.push(
+ "
"
+ );
+ height = (range.end.row - range.start.row - 1) * config.lineHeight;
+ if (height <= 0)
+ return;
+ top = this.$getTop(range.start.row + 1, config);
+
+ var radiusClass = (range.start.column ? 1 : 0) | (range.end.column ? 0 : 8);
+
+ stringBuilder.push(
+ "
"
+ );
+ };
+ this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {
+ var height = config.lineHeight;
+ var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
+
+ var top = this.$getTop(range.start.row, config);
+ var left = this.$padding + range.start.column * config.characterWidth;
+
+ stringBuilder.push(
+ "
"
+ );
+ };
+
+ this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
+ var top = this.$getTop(range.start.row, config);
+ var height = config.lineHeight;
+ if (range.start.row != range.end.row)
+ height += this.$getTop(range.end.row, config) - top;
+
+ stringBuilder.push(
+ "
"
+ );
+ };
+
+ this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
+ var top = this.$getTop(range.start.row, config);
+ var height = config.lineHeight;
+
+ stringBuilder.push(
+ "
"
+ );
+ };
+
+}).call(Marker.prototype);
+
+exports.Marker = Marker;
+
+});
+
+ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var dom = acequire("../lib/dom");
+var lang = acequire("../lib/lang");
+var useragent = acequire("../lib/useragent");
+var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
+
+var Text = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_text-layer";
+ parentEl.appendChild(this.element);
+ this.$updateEolChar = this.$updateEolChar.bind(this);
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.EOF_CHAR = "\xB6";
+ this.EOL_CHAR_LF = "\xAC";
+ this.EOL_CHAR_CRLF = "\xa4";
+ this.EOL_CHAR = this.EOL_CHAR_LF;
+ this.TAB_CHAR = "\u2014"; //"\u21E5";
+ this.SPACE_CHAR = "\xB7";
+ this.$padding = 0;
+
+ this.$updateEolChar = function() {
+ var EOL_CHAR = this.session.doc.getNewLineCharacter() == "\n"
+ ? this.EOL_CHAR_LF
+ : this.EOL_CHAR_CRLF;
+ if (this.EOL_CHAR != EOL_CHAR) {
+ this.EOL_CHAR = EOL_CHAR;
+ return true;
+ }
+ }
+
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ this.element.style.padding = "0 " + padding + "px";
+ };
+
+ this.getLineHeight = function() {
+ return this.$fontMetrics.$characterSize.height || 0;
+ };
+
+ this.getCharacterWidth = function() {
+ return this.$fontMetrics.$characterSize.width || 0;
+ };
+
+ this.$setFontMetrics = function(measure) {
+ this.$fontMetrics = measure;
+ this.$fontMetrics.on("changeCharacterSize", function(e) {
+ this._signal("changeCharacterSize", e);
+ }.bind(this));
+ this.$pollSizeChanges();
+ }
+
+ this.checkForSizeChanges = function() {
+ this.$fontMetrics.checkForSizeChanges();
+ };
+ this.$pollSizeChanges = function() {
+ return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();
+ };
+ this.setSession = function(session) {
+ this.session = session;
+ if (session)
+ this.$computeTabString();
+ };
+
+ this.showInvisibles = false;
+ this.setShowInvisibles = function(showInvisibles) {
+ if (this.showInvisibles == showInvisibles)
+ return false;
+
+ this.showInvisibles = showInvisibles;
+ this.$computeTabString();
+ return true;
+ };
+
+ this.displayIndentGuides = true;
+ this.setDisplayIndentGuides = function(display) {
+ if (this.displayIndentGuides == display)
+ return false;
+
+ this.displayIndentGuides = display;
+ this.$computeTabString();
+ return true;
+ };
+
+ this.$tabStrings = [];
+ this.onChangeTabSize =
+ this.$computeTabString = function() {
+ var tabSize = this.session.getTabSize();
+ this.tabSize = tabSize;
+ var tabStr = this.$tabStrings = [0];
+ for (var i = 1; i < tabSize + 1; i++) {
+ if (this.showInvisibles) {
+ tabStr.push(""
+ + lang.stringRepeat(this.TAB_CHAR, i)
+ + " ");
+ } else {
+ tabStr.push(lang.stringRepeat(" ", i));
+ }
+ }
+ if (this.displayIndentGuides) {
+ this.$indentGuideRe = /\s\S| \t|\t |\s$/;
+ var className = "ace_indent-guide";
+ var spaceClass = "";
+ var tabClass = "";
+ if (this.showInvisibles) {
+ className += " ace_invisible";
+ spaceClass = " ace_invisible_space";
+ tabClass = " ace_invisible_tab";
+ var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
+ var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize);
+ } else{
+ var spaceContent = lang.stringRepeat(" ", this.tabSize);
+ var tabContent = spaceContent;
+ }
+
+ this.$tabStrings[" "] = "" + spaceContent + " ";
+ this.$tabStrings["\t"] = "" + tabContent + " ";
+ }
+ };
+
+ this.updateLines = function(config, firstRow, lastRow) {
+ if (this.config.lastRow != config.lastRow ||
+ this.config.firstRow != config.firstRow) {
+ this.scrollLines(config);
+ }
+ this.config = config;
+
+ var first = Math.max(firstRow, config.firstRow);
+ var last = Math.min(lastRow, config.lastRow);
+
+ var lineElements = this.element.childNodes;
+ var lineElementsIdx = 0;
+
+ for (var row = config.firstRow; row < first; row++) {
+ var foldLine = this.session.getFoldLine(row);
+ if (foldLine) {
+ if (foldLine.containsRow(first)) {
+ first = foldLine.start.row;
+ break;
+ } else {
+ row = foldLine.end.row;
+ }
+ }
+ lineElementsIdx ++;
+ }
+
+ var row = first;
+ var foldLine = this.session.getNextFoldLine(row);
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+ while (true) {
+ if (row > foldStart) {
+ row = foldLine.end.row+1;
+ foldLine = this.session.getNextFoldLine(row, foldLine);
+ foldStart = foldLine ? foldLine.start.row :Infinity;
+ }
+ if (row > last)
+ break;
+
+ var lineElement = lineElements[lineElementsIdx++];
+ if (lineElement) {
+ var html = [];
+ this.$renderLine(
+ html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
+ );
+ lineElement.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
+ lineElement.innerHTML = html.join("");
+ }
+ row++;
+ }
+ };
+
+ this.scrollLines = function(config) {
+ var oldConfig = this.config;
+ this.config = config;
+
+ if (!oldConfig || oldConfig.lastRow < config.firstRow)
+ return this.update(config);
+
+ if (config.lastRow < oldConfig.firstRow)
+ return this.update(config);
+
+ var el = this.element;
+ if (oldConfig.firstRow < config.firstRow)
+ for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)
+ el.removeChild(el.firstChild);
+
+ if (oldConfig.lastRow > config.lastRow)
+ for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)
+ el.removeChild(el.lastChild);
+
+ if (config.firstRow < oldConfig.firstRow) {
+ var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
+ if (el.firstChild)
+ el.insertBefore(fragment, el.firstChild);
+ else
+ el.appendChild(fragment);
+ }
+
+ if (config.lastRow > oldConfig.lastRow) {
+ var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
+ el.appendChild(fragment);
+ }
+ };
+
+ this.$renderLinesFragment = function(config, firstRow, lastRow) {
+ var fragment = this.element.ownerDocument.createDocumentFragment();
+ var row = firstRow;
+ var foldLine = this.session.getNextFoldLine(row);
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+ while (true) {
+ if (row > foldStart) {
+ row = foldLine.end.row+1;
+ foldLine = this.session.getNextFoldLine(row, foldLine);
+ foldStart = foldLine ? foldLine.start.row : Infinity;
+ }
+ if (row > lastRow)
+ break;
+
+ var container = dom.createElement("div");
+
+ var html = [];
+ this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
+ container.innerHTML = html.join("");
+ if (this.$useLineGroups()) {
+ container.className = 'ace_line_group';
+ fragment.appendChild(container);
+ container.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
+
+ } else {
+ while(container.firstChild)
+ fragment.appendChild(container.firstChild);
+ }
+
+ row++;
+ }
+ return fragment;
+ };
+
+ this.update = function(config) {
+ this.config = config;
+
+ var html = [];
+ var firstRow = config.firstRow, lastRow = config.lastRow;
+
+ var row = firstRow;
+ var foldLine = this.session.getNextFoldLine(row);
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+ while (true) {
+ if (row > foldStart) {
+ row = foldLine.end.row+1;
+ foldLine = this.session.getNextFoldLine(row, foldLine);
+ foldStart = foldLine ? foldLine.start.row :Infinity;
+ }
+ if (row > lastRow)
+ break;
+
+ if (this.$useLineGroups())
+ html.push("")
+
+ this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
+
+ if (this.$useLineGroups())
+ html.push("
"); // end the line group
+
+ row++;
+ }
+ this.element.innerHTML = html.join("");
+ };
+
+ this.$textToken = {
+ "text": true,
+ "rparen": true,
+ "lparen": true
+ };
+
+ this.$renderToken = function(stringBuilder, screenColumn, token, value) {
+ var self = this;
+ var replaceReg = /\t|&|<|>|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF\uFFF9-\uFFFC])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
+ var replaceFunc = function(c, a, b, tabIdx, idx4) {
+ if (a) {
+ return self.showInvisibles
+ ? "" + lang.stringRepeat(self.SPACE_CHAR, c.length) + " "
+ : c;
+ } else if (c == "&") {
+ return "&";
+ } else if (c == "<") {
+ return "<";
+ } else if (c == ">") {
+ return ">";
+ } else if (c == "\t") {
+ var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
+ screenColumn += tabSize - 1;
+ return self.$tabStrings[tabSize];
+ } else if (c == "\u3000") {
+ var classToUse = self.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk";
+ var space = self.showInvisibles ? self.SPACE_CHAR : "";
+ screenColumn += 1;
+ return "" + space + " ";
+ } else if (b) {
+ return "" + self.SPACE_CHAR + " ";
+ } else {
+ screenColumn += 1;
+ return "" + c + " ";
+ }
+ };
+
+ var output = value.replace(replaceReg, replaceFunc);
+
+ if (!this.$textToken[token.type]) {
+ var classes = "ace_" + token.type.replace(/\./g, " ace_");
+ var style = "";
+ if (token.type == "fold")
+ style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' ";
+ stringBuilder.push("", output, " ");
+ }
+ else {
+ stringBuilder.push(output);
+ }
+ return screenColumn + value.length;
+ };
+
+ this.renderIndentGuide = function(stringBuilder, value, max) {
+ var cols = value.search(this.$indentGuideRe);
+ if (cols <= 0 || cols >= max)
+ return value;
+ if (value[0] == " ") {
+ cols -= cols % this.tabSize;
+ stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols/this.tabSize));
+ return value.substr(cols);
+ } else if (value[0] == "\t") {
+ stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols));
+ return value.substr(cols);
+ }
+ return value;
+ };
+
+ this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
+ var chars = 0;
+ var split = 0;
+ var splitChars = splits[0];
+ var screenColumn = 0;
+
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i];
+ var value = token.value;
+ if (i == 0 && this.displayIndentGuides) {
+ chars = value.length;
+ value = this.renderIndentGuide(stringBuilder, value, splitChars);
+ if (!value)
+ continue;
+ chars -= value.length;
+ }
+
+ if (chars + value.length < splitChars) {
+ screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
+ chars += value.length;
+ } else {
+ while (chars + value.length >= splitChars) {
+ screenColumn = this.$renderToken(
+ stringBuilder, screenColumn,
+ token, value.substring(0, splitChars - chars)
+ );
+ value = value.substring(splitChars - chars);
+ chars = splitChars;
+
+ if (!onlyContents) {
+ stringBuilder.push(" ",
+ ""
+ );
+ }
+
+ stringBuilder.push(lang.stringRepeat("\xa0", splits.indent));
+
+ split ++;
+ screenColumn = 0;
+ splitChars = splits[split] || Number.MAX_VALUE;
+ }
+ if (value.length != 0) {
+ chars += value.length;
+ screenColumn = this.$renderToken(
+ stringBuilder, screenColumn, token, value
+ );
+ }
+ }
+ }
+ };
+
+ this.$renderSimpleLine = function(stringBuilder, tokens) {
+ var screenColumn = 0;
+ var token = tokens[0];
+ var value = token.value;
+ if (this.displayIndentGuides)
+ value = this.renderIndentGuide(stringBuilder, value);
+ if (value)
+ screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
+ for (var i = 1; i < tokens.length; i++) {
+ token = tokens[i];
+ value = token.value;
+ screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
+ }
+ };
+ this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
+ if (!foldLine && foldLine != false)
+ foldLine = this.session.getFoldLine(row);
+
+ if (foldLine)
+ var tokens = this.$getFoldLineTokens(row, foldLine);
+ else
+ var tokens = this.session.getTokens(row);
+
+
+ if (!onlyContents) {
+ stringBuilder.push(
+ "
"
+ );
+ }
+
+ if (tokens.length) {
+ var splits = this.session.getRowSplitData(row);
+ if (splits && splits.length)
+ this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
+ else
+ this.$renderSimpleLine(stringBuilder, tokens);
+ }
+
+ if (this.showInvisibles) {
+ if (foldLine)
+ row = foldLine.end.row
+
+ stringBuilder.push(
+ "",
+ row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
+ " "
+ );
+ }
+ if (!onlyContents)
+ stringBuilder.push("
");
+ };
+
+ this.$getFoldLineTokens = function(row, foldLine) {
+ var session = this.session;
+ var renderTokens = [];
+
+ function addTokens(tokens, from, to) {
+ var idx = 0, col = 0;
+ while ((col + tokens[idx].value.length) < from) {
+ col += tokens[idx].value.length;
+ idx++;
+
+ if (idx == tokens.length)
+ return;
+ }
+ if (col != from) {
+ var value = tokens[idx].value.substring(from - col);
+ if (value.length > (to - from))
+ value = value.substring(0, to - from);
+
+ renderTokens.push({
+ type: tokens[idx].type,
+ value: value
+ });
+
+ col = from + value.length;
+ idx += 1;
+ }
+
+ while (col < to && idx < tokens.length) {
+ var value = tokens[idx].value;
+ if (value.length + col > to) {
+ renderTokens.push({
+ type: tokens[idx].type,
+ value: value.substring(0, to - col)
+ });
+ } else
+ renderTokens.push(tokens[idx]);
+ col += value.length;
+ idx += 1;
+ }
+ }
+
+ var tokens = session.getTokens(row);
+ foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
+ if (placeholder != null) {
+ renderTokens.push({
+ type: "fold",
+ value: placeholder
+ });
+ } else {
+ if (isNewRow)
+ tokens = session.getTokens(row);
+
+ if (tokens.length)
+ addTokens(tokens, lastColumn, column);
+ }
+ }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
+
+ return renderTokens;
+ };
+
+ this.$useLineGroups = function() {
+ return this.session.getUseWrapMode();
+ };
+
+ this.destroy = function() {
+ clearInterval(this.$pollSizeChangesTimer);
+ if (this.$measureNode)
+ this.$measureNode.parentNode.removeChild(this.$measureNode);
+ delete this.$measureNode;
+ };
+
+}).call(Text.prototype);
+
+exports.Text = Text;
+
+});
+
+ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
+"use strict";
+
+var dom = acequire("../lib/dom");
+var isIE8;
+
+var Cursor = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_cursor-layer";
+ parentEl.appendChild(this.element);
+
+ if (isIE8 === undefined)
+ isIE8 = !("opacity" in this.element.style);
+
+ this.isVisible = false;
+ this.isBlinking = true;
+ this.blinkInterval = 1000;
+ this.smoothBlinking = false;
+
+ this.cursors = [];
+ this.cursor = this.addCursor();
+ dom.addCssClass(this.element, "ace_hidden-cursors");
+ this.$updateCursors = (isIE8
+ ? this.$updateVisibility
+ : this.$updateOpacity).bind(this);
+};
+
+(function() {
+
+ this.$updateVisibility = function(val) {
+ var cursors = this.cursors;
+ for (var i = cursors.length; i--; )
+ cursors[i].style.visibility = val ? "" : "hidden";
+ };
+ this.$updateOpacity = function(val) {
+ var cursors = this.cursors;
+ for (var i = cursors.length; i--; )
+ cursors[i].style.opacity = val ? "" : "0";
+ };
+
+
+ this.$padding = 0;
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ };
+
+ this.setSession = function(session) {
+ this.session = session;
+ };
+
+ this.setBlinking = function(blinking) {
+ if (blinking != this.isBlinking){
+ this.isBlinking = blinking;
+ this.restartTimer();
+ }
+ };
+
+ this.setBlinkInterval = function(blinkInterval) {
+ if (blinkInterval != this.blinkInterval){
+ this.blinkInterval = blinkInterval;
+ this.restartTimer();
+ }
+ };
+
+ this.setSmoothBlinking = function(smoothBlinking) {
+ if (smoothBlinking != this.smoothBlinking && !isIE8) {
+ this.smoothBlinking = smoothBlinking;
+ dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
+ this.$updateCursors(true);
+ this.$updateCursors = (this.$updateOpacity).bind(this);
+ this.restartTimer();
+ }
+ };
+
+ this.addCursor = function() {
+ var el = dom.createElement("div");
+ el.className = "ace_cursor";
+ this.element.appendChild(el);
+ this.cursors.push(el);
+ return el;
+ };
+
+ this.removeCursor = function() {
+ if (this.cursors.length > 1) {
+ var el = this.cursors.pop();
+ el.parentNode.removeChild(el);
+ return el;
+ }
+ };
+
+ this.hideCursor = function() {
+ this.isVisible = false;
+ dom.addCssClass(this.element, "ace_hidden-cursors");
+ this.restartTimer();
+ };
+
+ this.showCursor = function() {
+ this.isVisible = true;
+ dom.removeCssClass(this.element, "ace_hidden-cursors");
+ this.restartTimer();
+ };
+
+ this.restartTimer = function() {
+ var update = this.$updateCursors;
+ clearInterval(this.intervalId);
+ clearTimeout(this.timeoutId);
+ if (this.smoothBlinking) {
+ dom.removeCssClass(this.element, "ace_smooth-blinking");
+ }
+
+ update(true);
+
+ if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
+ return;
+
+ if (this.smoothBlinking) {
+ setTimeout(function(){
+ dom.addCssClass(this.element, "ace_smooth-blinking");
+ }.bind(this));
+ }
+
+ var blink = function(){
+ this.timeoutId = setTimeout(function() {
+ update(false);
+ }, 0.6 * this.blinkInterval);
+ }.bind(this);
+
+ this.intervalId = setInterval(function() {
+ update(true);
+ blink();
+ }, this.blinkInterval);
+
+ blink();
+ };
+
+ this.getPixelPosition = function(position, onScreen) {
+ if (!this.config || !this.session)
+ return {left : 0, top : 0};
+
+ if (!position)
+ position = this.session.selection.getCursor();
+ var pos = this.session.documentToScreenPosition(position);
+ var cursorLeft = this.$padding + pos.column * this.config.characterWidth;
+ var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
+ this.config.lineHeight;
+
+ return {left : cursorLeft, top : cursorTop};
+ };
+
+ this.update = function(config) {
+ this.config = config;
+
+ var selections = this.session.$selectionMarkers;
+ var i = 0, cursorIndex = 0;
+
+ if (selections === undefined || selections.length === 0){
+ selections = [{cursor: null}];
+ }
+
+ for (var i = 0, n = selections.length; i < n; i++) {
+ var pixelPos = this.getPixelPosition(selections[i].cursor, true);
+ if ((pixelPos.top > config.height + config.offset ||
+ pixelPos.top < 0) && i > 1) {
+ continue;
+ }
+
+ var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
+
+ if (!this.drawCursor) {
+ style.left = pixelPos.left + "px";
+ style.top = pixelPos.top + "px";
+ style.width = config.characterWidth + "px";
+ style.height = config.lineHeight + "px";
+ } else {
+ this.drawCursor(style, pixelPos, config, selections[i], this.session);
+ }
+ }
+ while (this.cursors.length > cursorIndex)
+ this.removeCursor();
+
+ var overwrite = this.session.getOverwrite();
+ this.$setOverwrite(overwrite);
+ this.$pixelPos = pixelPos;
+ this.restartTimer();
+ };
+
+ this.drawCursor = null;
+
+ this.$setOverwrite = function(overwrite) {
+ if (overwrite != this.overwrite) {
+ this.overwrite = overwrite;
+ if (overwrite)
+ dom.addCssClass(this.element, "ace_overwrite-cursors");
+ else
+ dom.removeCssClass(this.element, "ace_overwrite-cursors");
+ }
+ };
+
+ this.destroy = function() {
+ clearInterval(this.intervalId);
+ clearTimeout(this.timeoutId);
+ };
+
+}).call(Cursor.prototype);
+
+exports.Cursor = Cursor;
+
+});
+
+ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var dom = acequire("./lib/dom");
+var event = acequire("./lib/event");
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var ScrollBar = function(parent) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_scrollbar ace_scrollbar" + this.classSuffix;
+
+ this.inner = dom.createElement("div");
+ this.inner.className = "ace_scrollbar-inner";
+ this.element.appendChild(this.inner);
+
+ parent.appendChild(this.element);
+
+ this.setVisible(false);
+ this.skipEvent = false;
+
+ event.addListener(this.element, "scroll", this.onScroll.bind(this));
+ event.addListener(this.element, "mousedown", event.preventDefault);
+};
+
+(function() {
+ oop.implement(this, EventEmitter);
+
+ this.setVisible = function(isVisible) {
+ this.element.style.display = isVisible ? "" : "none";
+ this.isVisible = isVisible;
+ };
+}).call(ScrollBar.prototype);
+var VScrollBar = function(parent, renderer) {
+ ScrollBar.call(this, parent);
+ this.scrollTop = 0;
+ renderer.$scrollbarWidth =
+ this.width = dom.scrollbarWidth(parent.ownerDocument);
+ this.inner.style.width =
+ this.element.style.width = (this.width || 15) + 5 + "px";
+};
+
+oop.inherits(VScrollBar, ScrollBar);
+
+(function() {
+
+ this.classSuffix = '-v';
+ this.onScroll = function() {
+ if (!this.skipEvent) {
+ this.scrollTop = this.element.scrollTop;
+ this._emit("scroll", {data: this.scrollTop});
+ }
+ this.skipEvent = false;
+ };
+ this.getWidth = function() {
+ return this.isVisible ? this.width : 0;
+ };
+ this.setHeight = function(height) {
+ this.element.style.height = height + "px";
+ };
+ this.setInnerHeight = function(height) {
+ this.inner.style.height = height + "px";
+ };
+ this.setScrollHeight = function(height) {
+ this.inner.style.height = height + "px";
+ };
+ this.setScrollTop = function(scrollTop) {
+ if (this.scrollTop != scrollTop) {
+ this.skipEvent = true;
+ this.scrollTop = this.element.scrollTop = scrollTop;
+ }
+ };
+
+}).call(VScrollBar.prototype);
+var HScrollBar = function(parent, renderer) {
+ ScrollBar.call(this, parent);
+ this.scrollLeft = 0;
+ this.height = renderer.$scrollbarWidth;
+ this.inner.style.height =
+ this.element.style.height = (this.height || 15) + 5 + "px";
+};
+
+oop.inherits(HScrollBar, ScrollBar);
+
+(function() {
+
+ this.classSuffix = '-h';
+ this.onScroll = function() {
+ if (!this.skipEvent) {
+ this.scrollLeft = this.element.scrollLeft;
+ this._emit("scroll", {data: this.scrollLeft});
+ }
+ this.skipEvent = false;
+ };
+ this.getHeight = function() {
+ return this.isVisible ? this.height : 0;
+ };
+ this.setWidth = function(width) {
+ this.element.style.width = width + "px";
+ };
+ this.setInnerWidth = function(width) {
+ this.inner.style.width = width + "px";
+ };
+ this.setScrollWidth = function(width) {
+ this.inner.style.width = width + "px";
+ };
+ this.setScrollLeft = function(scrollLeft) {
+ if (this.scrollLeft != scrollLeft) {
+ this.skipEvent = true;
+ this.scrollLeft = this.element.scrollLeft = scrollLeft;
+ }
+ };
+
+}).call(HScrollBar.prototype);
+
+
+exports.ScrollBar = VScrollBar; // backward compatibility
+exports.ScrollBarV = VScrollBar; // backward compatibility
+exports.ScrollBarH = HScrollBar; // backward compatibility
+
+exports.VScrollBar = VScrollBar;
+exports.HScrollBar = HScrollBar;
+});
+
+ace.define("ace/renderloop",["require","exports","module","ace/lib/event"], function(acequire, exports, module) {
+"use strict";
+
+var event = acequire("./lib/event");
+
+
+var RenderLoop = function(onRender, win) {
+ this.onRender = onRender;
+ this.pending = false;
+ this.changes = 0;
+ this.window = win || window;
+};
+
+(function() {
+
+
+ this.schedule = function(change) {
+ this.changes = this.changes | change;
+ if (!this.pending && this.changes) {
+ this.pending = true;
+ var _self = this;
+ event.nextFrame(function() {
+ _self.pending = false;
+ var changes;
+ while (changes = _self.changes) {
+ _self.changes = 0;
+ _self.onRender(changes);
+ }
+ }, this.window);
+ }
+ };
+
+}).call(RenderLoop.prototype);
+
+exports.RenderLoop = RenderLoop;
+});
+
+ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"], function(acequire, exports, module) {
+
+var oop = acequire("../lib/oop");
+var dom = acequire("../lib/dom");
+var lang = acequire("../lib/lang");
+var useragent = acequire("../lib/useragent");
+var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
+
+var CHAR_COUNT = 0;
+
+var FontMetrics = exports.FontMetrics = function(parentEl) {
+ this.el = dom.createElement("div");
+ this.$setMeasureNodeStyles(this.el.style, true);
+
+ this.$main = dom.createElement("div");
+ this.$setMeasureNodeStyles(this.$main.style);
+
+ this.$measureNode = dom.createElement("div");
+ this.$setMeasureNodeStyles(this.$measureNode.style);
+
+
+ this.el.appendChild(this.$main);
+ this.el.appendChild(this.$measureNode);
+ parentEl.appendChild(this.el);
+
+ if (!CHAR_COUNT)
+ this.$testFractionalRect();
+ this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT);
+
+ this.$characterSize = {width: 0, height: 0};
+ this.checkForSizeChanges();
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.$characterSize = {width: 0, height: 0};
+
+ this.$testFractionalRect = function() {
+ var el = dom.createElement("div");
+ this.$setMeasureNodeStyles(el.style);
+ el.style.width = "0.2px";
+ document.documentElement.appendChild(el);
+ var w = el.getBoundingClientRect().width;
+ if (w > 0 && w < 1)
+ CHAR_COUNT = 50;
+ else
+ CHAR_COUNT = 100;
+ el.parentNode.removeChild(el);
+ };
+
+ this.$setMeasureNodeStyles = function(style, isRoot) {
+ style.width = style.height = "auto";
+ style.left = style.top = "0px";
+ style.visibility = "hidden";
+ style.position = "absolute";
+ style.whiteSpace = "pre";
+
+ if (useragent.isIE < 8) {
+ style["font-family"] = "inherit";
+ } else {
+ style.font = "inherit";
+ }
+ style.overflow = isRoot ? "hidden" : "visible";
+ };
+
+ this.checkForSizeChanges = function() {
+ var size = this.$measureSizes();
+ if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
+ this.$measureNode.style.fontWeight = "bold";
+ var boldSize = this.$measureSizes();
+ this.$measureNode.style.fontWeight = "";
+ this.$characterSize = size;
+ this.charSizes = Object.create(null);
+ this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
+ this._emit("changeCharacterSize", {data: size});
+ }
+ };
+
+ this.$pollSizeChanges = function() {
+ if (this.$pollSizeChangesTimer)
+ return this.$pollSizeChangesTimer;
+ var self = this;
+ return this.$pollSizeChangesTimer = setInterval(function() {
+ self.checkForSizeChanges();
+ }, 500);
+ };
+
+ this.setPolling = function(val) {
+ if (val) {
+ this.$pollSizeChanges();
+ } else if (this.$pollSizeChangesTimer) {
+ clearInterval(this.$pollSizeChangesTimer);
+ this.$pollSizeChangesTimer = 0;
+ }
+ };
+
+ this.$measureSizes = function() {
+ if (CHAR_COUNT === 50) {
+ var rect = null;
+ try {
+ rect = this.$measureNode.getBoundingClientRect();
+ } catch(e) {
+ rect = {width: 0, height:0 };
+ }
+ var size = {
+ height: rect.height,
+ width: rect.width / CHAR_COUNT
+ };
+ } else {
+ var size = {
+ height: this.$measureNode.clientHeight,
+ width: this.$measureNode.clientWidth / CHAR_COUNT
+ };
+ }
+ if (size.width === 0 || size.height === 0)
+ return null;
+ return size;
+ };
+
+ this.$measureCharWidth = function(ch) {
+ this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT);
+ var rect = this.$main.getBoundingClientRect();
+ return rect.width / CHAR_COUNT;
+ };
+
+ this.getCharacterWidth = function(ch) {
+ var w = this.charSizes[ch];
+ if (w === undefined) {
+ w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;
+ }
+ return w;
+ };
+
+ this.destroy = function() {
+ clearInterval(this.$pollSizeChangesTimer);
+ if (this.el && this.el.parentNode)
+ this.el.parentNode.removeChild(this.el);
+ };
+
+}).call(FontMetrics.prototype);
+
+});
+
+ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/lib/useragent","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var dom = acequire("./lib/dom");
+var config = acequire("./config");
+var useragent = acequire("./lib/useragent");
+var GutterLayer = acequire("./layer/gutter").Gutter;
+var MarkerLayer = acequire("./layer/marker").Marker;
+var TextLayer = acequire("./layer/text").Text;
+var CursorLayer = acequire("./layer/cursor").Cursor;
+var HScrollBar = acequire("./scrollbar").HScrollBar;
+var VScrollBar = acequire("./scrollbar").VScrollBar;
+var RenderLoop = acequire("./renderloop").RenderLoop;
+var FontMetrics = acequire("./layer/font_metrics").FontMetrics;
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var editorCss = ".ace_editor {\
+position: relative;\
+overflow: hidden;\
+font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\
+direction: ltr;\
+}\
+.ace_scroller {\
+position: absolute;\
+overflow: hidden;\
+top: 0;\
+bottom: 0;\
+background-color: inherit;\
+-ms-user-select: none;\
+-moz-user-select: none;\
+-webkit-user-select: none;\
+user-select: none;\
+cursor: text;\
+}\
+.ace_content {\
+position: absolute;\
+-moz-box-sizing: border-box;\
+-webkit-box-sizing: border-box;\
+box-sizing: border-box;\
+min-width: 100%;\
+}\
+.ace_dragging .ace_scroller:before{\
+position: absolute;\
+top: 0;\
+left: 0;\
+right: 0;\
+bottom: 0;\
+content: '';\
+background: rgba(250, 250, 250, 0.01);\
+z-index: 1000;\
+}\
+.ace_dragging.ace_dark .ace_scroller:before{\
+background: rgba(0, 0, 0, 0.01);\
+}\
+.ace_selecting, .ace_selecting * {\
+cursor: text !important;\
+}\
+.ace_gutter {\
+position: absolute;\
+overflow : hidden;\
+width: auto;\
+top: 0;\
+bottom: 0;\
+left: 0;\
+cursor: default;\
+z-index: 4;\
+-ms-user-select: none;\
+-moz-user-select: none;\
+-webkit-user-select: none;\
+user-select: none;\
+}\
+.ace_gutter-active-line {\
+position: absolute;\
+left: 0;\
+right: 0;\
+}\
+.ace_scroller.ace_scroll-left {\
+box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\
+}\
+.ace_gutter-cell {\
+padding-left: 19px;\
+padding-right: 6px;\
+background-repeat: no-repeat;\
+}\
+.ace_gutter-cell.ace_error {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==\");\
+background-repeat: no-repeat;\
+background-position: 2px center;\
+}\
+.ace_gutter-cell.ace_warning {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==\");\
+background-position: 2px center;\
+}\
+.ace_gutter-cell.ace_info {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=\");\
+background-position: 2px center;\
+}\
+.ace_dark .ace_gutter-cell.ace_info {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC\");\
+}\
+.ace_scrollbar {\
+position: absolute;\
+right: 0;\
+bottom: 0;\
+z-index: 6;\
+}\
+.ace_scrollbar-inner {\
+position: absolute;\
+cursor: text;\
+left: 0;\
+top: 0;\
+}\
+.ace_scrollbar-v{\
+overflow-x: hidden;\
+overflow-y: scroll;\
+top: 0;\
+}\
+.ace_scrollbar-h {\
+overflow-x: scroll;\
+overflow-y: hidden;\
+left: 0;\
+}\
+.ace_print-margin {\
+position: absolute;\
+height: 100%;\
+}\
+.ace_text-input {\
+position: absolute;\
+z-index: 0;\
+width: 0.5em;\
+height: 1em;\
+opacity: 0;\
+background: transparent;\
+-moz-appearance: none;\
+appearance: none;\
+border: none;\
+resize: none;\
+outline: none;\
+overflow: hidden;\
+font: inherit;\
+padding: 0 1px;\
+margin: 0 -1px;\
+text-indent: -1em;\
+-ms-user-select: text;\
+-moz-user-select: text;\
+-webkit-user-select: text;\
+user-select: text;\
+white-space: pre!important;\
+}\
+.ace_text-input.ace_composition {\
+background: inherit;\
+color: inherit;\
+z-index: 1000;\
+opacity: 1;\
+text-indent: 0;\
+}\
+.ace_layer {\
+z-index: 1;\
+position: absolute;\
+overflow: hidden;\
+word-wrap: normal;\
+white-space: pre;\
+height: 100%;\
+width: 100%;\
+-moz-box-sizing: border-box;\
+-webkit-box-sizing: border-box;\
+box-sizing: border-box;\
+pointer-events: none;\
+}\
+.ace_gutter-layer {\
+position: relative;\
+width: auto;\
+text-align: right;\
+pointer-events: auto;\
+}\
+.ace_text-layer {\
+font: inherit !important;\
+}\
+.ace_cjk {\
+display: inline-block;\
+text-align: center;\
+}\
+.ace_cursor-layer {\
+z-index: 4;\
+}\
+.ace_cursor {\
+z-index: 4;\
+position: absolute;\
+-moz-box-sizing: border-box;\
+-webkit-box-sizing: border-box;\
+box-sizing: border-box;\
+border-left: 2px solid;\
+transform: translatez(0);\
+}\
+.ace_slim-cursors .ace_cursor {\
+border-left-width: 1px;\
+}\
+.ace_overwrite-cursors .ace_cursor {\
+border-left-width: 0;\
+border-bottom: 1px solid;\
+}\
+.ace_hidden-cursors .ace_cursor {\
+opacity: 0.2;\
+}\
+.ace_smooth-blinking .ace_cursor {\
+-webkit-transition: opacity 0.18s;\
+transition: opacity 0.18s;\
+}\
+.ace_editor.ace_multiselect .ace_cursor {\
+border-left-width: 1px;\
+}\
+.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\
+position: absolute;\
+z-index: 3;\
+}\
+.ace_marker-layer .ace_selection {\
+position: absolute;\
+z-index: 5;\
+}\
+.ace_marker-layer .ace_bracket {\
+position: absolute;\
+z-index: 6;\
+}\
+.ace_marker-layer .ace_active-line {\
+position: absolute;\
+z-index: 2;\
+}\
+.ace_marker-layer .ace_selected-word {\
+position: absolute;\
+z-index: 4;\
+-moz-box-sizing: border-box;\
+-webkit-box-sizing: border-box;\
+box-sizing: border-box;\
+}\
+.ace_line .ace_fold {\
+-moz-box-sizing: border-box;\
+-webkit-box-sizing: border-box;\
+box-sizing: border-box;\
+display: inline-block;\
+height: 11px;\
+margin-top: -2px;\
+vertical-align: middle;\
+background-image:\
+url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
+url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\");\
+background-repeat: no-repeat, repeat-x;\
+background-position: center center, top left;\
+color: transparent;\
+border: 1px solid black;\
+border-radius: 2px;\
+cursor: pointer;\
+pointer-events: auto;\
+}\
+.ace_dark .ace_fold {\
+}\
+.ace_fold:hover{\
+background-image:\
+url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
+url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\");\
+}\
+.ace_tooltip {\
+background-color: #FFF;\
+background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));\
+background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\
+border: 1px solid gray;\
+border-radius: 1px;\
+box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\
+color: black;\
+max-width: 100%;\
+padding: 3px 4px;\
+position: fixed;\
+z-index: 999999;\
+-moz-box-sizing: border-box;\
+-webkit-box-sizing: border-box;\
+box-sizing: border-box;\
+cursor: default;\
+white-space: pre;\
+word-wrap: break-word;\
+line-height: normal;\
+font-style: normal;\
+font-weight: normal;\
+letter-spacing: normal;\
+pointer-events: none;\
+}\
+.ace_folding-enabled > .ace_gutter-cell {\
+padding-right: 13px;\
+}\
+.ace_fold-widget {\
+-moz-box-sizing: border-box;\
+-webkit-box-sizing: border-box;\
+box-sizing: border-box;\
+margin: 0 -12px 0 1px;\
+display: none;\
+width: 11px;\
+vertical-align: top;\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\");\
+background-repeat: no-repeat;\
+background-position: center;\
+border-radius: 3px;\
+border: 1px solid transparent;\
+cursor: pointer;\
+}\
+.ace_folding-enabled .ace_fold-widget {\
+display: inline-block; \
+}\
+.ace_fold-widget.ace_end {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\");\
+}\
+.ace_fold-widget.ace_closed {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\");\
+}\
+.ace_fold-widget:hover {\
+border: 1px solid rgba(0, 0, 0, 0.3);\
+background-color: rgba(255, 255, 255, 0.2);\
+box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
+}\
+.ace_fold-widget:active {\
+border: 1px solid rgba(0, 0, 0, 0.4);\
+background-color: rgba(0, 0, 0, 0.05);\
+box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
+}\
+.ace_dark .ace_fold-widget {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\
+}\
+.ace_dark .ace_fold-widget.ace_end {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\
+}\
+.ace_dark .ace_fold-widget.ace_closed {\
+background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\
+}\
+.ace_dark .ace_fold-widget:hover {\
+box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
+background-color: rgba(255, 255, 255, 0.1);\
+}\
+.ace_dark .ace_fold-widget:active {\
+box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
+}\
+.ace_fold-widget.ace_invalid {\
+background-color: #FFB4B4;\
+border-color: #DE5555;\
+}\
+.ace_fade-fold-widgets .ace_fold-widget {\
+-webkit-transition: opacity 0.4s ease 0.05s;\
+transition: opacity 0.4s ease 0.05s;\
+opacity: 0;\
+}\
+.ace_fade-fold-widgets:hover .ace_fold-widget {\
+-webkit-transition: opacity 0.05s ease 0.05s;\
+transition: opacity 0.05s ease 0.05s;\
+opacity:1;\
+}\
+.ace_underline {\
+text-decoration: underline;\
+}\
+.ace_bold {\
+font-weight: bold;\
+}\
+.ace_nobold .ace_bold {\
+font-weight: normal;\
+}\
+.ace_italic {\
+font-style: italic;\
+}\
+.ace_error-marker {\
+background-color: rgba(255, 0, 0,0.2);\
+position: absolute;\
+z-index: 9;\
+}\
+.ace_highlight-marker {\
+background-color: rgba(255, 255, 0,0.2);\
+position: absolute;\
+z-index: 8;\
+}\
+.ace_br1 {border-top-left-radius : 3px;}\
+.ace_br2 {border-top-right-radius : 3px;}\
+.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\
+.ace_br4 {border-bottom-right-radius: 3px;}\
+.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\
+.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\
+.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\
+.ace_br8 {border-bottom-left-radius : 3px;}\
+.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\
+.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\
+.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\
+.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
+.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
+.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
+.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
+";
+
+dom.importCssString(editorCss, "ace_editor.css");
+
+var VirtualRenderer = function(container, theme) {
+ var _self = this;
+
+ this.container = container || dom.createElement("div");
+ this.$keepTextAreaAtCursor = !useragent.isOldIE;
+
+ dom.addCssClass(this.container, "ace_editor");
+
+ this.setTheme(theme);
+
+ this.$gutter = dom.createElement("div");
+ this.$gutter.className = "ace_gutter";
+ this.container.appendChild(this.$gutter);
+
+ this.scroller = dom.createElement("div");
+ this.scroller.className = "ace_scroller";
+ this.container.appendChild(this.scroller);
+
+ this.content = dom.createElement("div");
+ this.content.className = "ace_content";
+ this.scroller.appendChild(this.content);
+
+ this.$gutterLayer = new GutterLayer(this.$gutter);
+ this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
+
+ this.$markerBack = new MarkerLayer(this.content);
+
+ var textLayer = this.$textLayer = new TextLayer(this.content);
+ this.canvas = textLayer.element;
+
+ this.$markerFront = new MarkerLayer(this.content);
+
+ this.$cursorLayer = new CursorLayer(this.content);
+ this.$horizScroll = false;
+ this.$vScroll = false;
+
+ this.scrollBar =
+ this.scrollBarV = new VScrollBar(this.container, this);
+ this.scrollBarH = new HScrollBar(this.container, this);
+ this.scrollBarV.addEventListener("scroll", function(e) {
+ if (!_self.$scrollAnimation)
+ _self.session.setScrollTop(e.data - _self.scrollMargin.top);
+ });
+ this.scrollBarH.addEventListener("scroll", function(e) {
+ if (!_self.$scrollAnimation)
+ _self.session.setScrollLeft(e.data - _self.scrollMargin.left);
+ });
+
+ this.scrollTop = 0;
+ this.scrollLeft = 0;
+
+ this.cursorPos = {
+ row : 0,
+ column : 0
+ };
+
+ this.$fontMetrics = new FontMetrics(this.container);
+ this.$textLayer.$setFontMetrics(this.$fontMetrics);
+ this.$textLayer.addEventListener("changeCharacterSize", function(e) {
+ _self.updateCharacterSize();
+ _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
+ _self._signal("changeCharacterSize", e);
+ });
+
+ this.$size = {
+ width: 0,
+ height: 0,
+ scrollerHeight: 0,
+ scrollerWidth: 0,
+ $dirty: true
+ };
+
+ this.layerConfig = {
+ width : 1,
+ padding : 0,
+ firstRow : 0,
+ firstRowScreen: 0,
+ lastRow : 0,
+ lineHeight : 0,
+ characterWidth : 0,
+ minHeight : 1,
+ maxHeight : 1,
+ offset : 0,
+ height : 1,
+ gutterOffset: 1
+ };
+
+ this.scrollMargin = {
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0,
+ v: 0,
+ h: 0
+ };
+
+ this.$loop = new RenderLoop(
+ this.$renderChanges.bind(this),
+ this.container.ownerDocument.defaultView
+ );
+ this.$loop.schedule(this.CHANGE_FULL);
+
+ this.updateCharacterSize();
+ this.setPadding(4);
+ config.resetOptions(this);
+ config._emit("renderer", this);
+};
+
+(function() {
+
+ this.CHANGE_CURSOR = 1;
+ this.CHANGE_MARKER = 2;
+ this.CHANGE_GUTTER = 4;
+ this.CHANGE_SCROLL = 8;
+ this.CHANGE_LINES = 16;
+ this.CHANGE_TEXT = 32;
+ this.CHANGE_SIZE = 64;
+ this.CHANGE_MARKER_BACK = 128;
+ this.CHANGE_MARKER_FRONT = 256;
+ this.CHANGE_FULL = 512;
+ this.CHANGE_H_SCROLL = 1024;
+
+ oop.implement(this, EventEmitter);
+
+ this.updateCharacterSize = function() {
+ if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
+ this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
+ this.setStyle("ace_nobold", !this.$allowBoldFonts);
+ }
+
+ this.layerConfig.characterWidth =
+ this.characterWidth = this.$textLayer.getCharacterWidth();
+ this.layerConfig.lineHeight =
+ this.lineHeight = this.$textLayer.getLineHeight();
+ this.$updatePrintMargin();
+ };
+ this.setSession = function(session) {
+ if (this.session)
+ this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode);
+
+ this.session = session;
+ if (session && this.scrollMargin.top && session.getScrollTop() <= 0)
+ session.setScrollTop(-this.scrollMargin.top);
+
+ this.$cursorLayer.setSession(session);
+ this.$markerBack.setSession(session);
+ this.$markerFront.setSession(session);
+ this.$gutterLayer.setSession(session);
+ this.$textLayer.setSession(session);
+ if (!session)
+ return;
+
+ this.$loop.schedule(this.CHANGE_FULL);
+ this.session.$setFontMetrics(this.$fontMetrics);
+
+ this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
+ this.onChangeNewLineMode()
+ this.session.doc.on("changeNewLineMode", this.onChangeNewLineMode);
+ };
+ this.updateLines = function(firstRow, lastRow, force) {
+ if (lastRow === undefined)
+ lastRow = Infinity;
+
+ if (!this.$changedLines) {
+ this.$changedLines = {
+ firstRow: firstRow,
+ lastRow: lastRow
+ };
+ }
+ else {
+ if (this.$changedLines.firstRow > firstRow)
+ this.$changedLines.firstRow = firstRow;
+
+ if (this.$changedLines.lastRow < lastRow)
+ this.$changedLines.lastRow = lastRow;
+ }
+ if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
+ if (force)
+ this.$changedLines.lastRow = this.layerConfig.lastRow;
+ else
+ return;
+ }
+ if (this.$changedLines.firstRow > this.layerConfig.lastRow)
+ return;
+ this.$loop.schedule(this.CHANGE_LINES);
+ };
+
+ this.onChangeNewLineMode = function() {
+ this.$loop.schedule(this.CHANGE_TEXT);
+ this.$textLayer.$updateEolChar();
+ };
+
+ this.onChangeTabSize = function() {
+ this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
+ this.$textLayer.onChangeTabSize();
+ };
+ this.updateText = function() {
+ this.$loop.schedule(this.CHANGE_TEXT);
+ };
+ this.updateFull = function(force) {
+ if (force)
+ this.$renderChanges(this.CHANGE_FULL, true);
+ else
+ this.$loop.schedule(this.CHANGE_FULL);
+ };
+ this.updateFontSize = function() {
+ this.$textLayer.checkForSizeChanges();
+ };
+
+ this.$changes = 0;
+ this.$updateSizeAsync = function() {
+ if (this.$loop.pending)
+ this.$size.$dirty = true;
+ else
+ this.onResize();
+ };
+ this.onResize = function(force, gutterWidth, width, height) {
+ if (this.resizing > 2)
+ return;
+ else if (this.resizing > 0)
+ this.resizing++;
+ else
+ this.resizing = force ? 1 : 0;
+ var el = this.container;
+ if (!height)
+ height = el.clientHeight || el.scrollHeight;
+ if (!width)
+ width = el.clientWidth || el.scrollWidth;
+ var changes = this.$updateCachedSize(force, gutterWidth, width, height);
+
+
+ if (!this.$size.scrollerHeight || (!width && !height))
+ return this.resizing = 0;
+
+ if (force)
+ this.$gutterLayer.$padding = null;
+
+ if (force)
+ this.$renderChanges(changes | this.$changes, true);
+ else
+ this.$loop.schedule(changes | this.$changes);
+
+ if (this.resizing)
+ this.resizing = 0;
+ this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null;
+ };
+
+ this.$updateCachedSize = function(force, gutterWidth, width, height) {
+ height -= (this.$extraHeight || 0);
+ var changes = 0;
+ var size = this.$size;
+ var oldSize = {
+ width: size.width,
+ height: size.height,
+ scrollerHeight: size.scrollerHeight,
+ scrollerWidth: size.scrollerWidth
+ };
+ if (height && (force || size.height != height)) {
+ size.height = height;
+ changes |= this.CHANGE_SIZE;
+
+ size.scrollerHeight = size.height;
+ if (this.$horizScroll)
+ size.scrollerHeight -= this.scrollBarH.getHeight();
+ this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px";
+
+ changes = changes | this.CHANGE_SCROLL;
+ }
+
+ if (width && (force || size.width != width)) {
+ changes |= this.CHANGE_SIZE;
+ size.width = width;
+
+ if (gutterWidth == null)
+ gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
+
+ this.gutterWidth = gutterWidth;
+
+ this.scrollBarH.element.style.left =
+ this.scroller.style.left = gutterWidth + "px";
+ size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth());
+
+ this.scrollBarH.element.style.right =
+ this.scroller.style.right = this.scrollBarV.getWidth() + "px";
+ this.scroller.style.bottom = this.scrollBarH.getHeight() + "px";
+
+ if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
+ changes |= this.CHANGE_FULL;
+ }
+
+ size.$dirty = !width || !height;
+
+ if (changes)
+ this._signal("resize", oldSize);
+
+ return changes;
+ };
+
+ this.onGutterResize = function() {
+ var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
+ if (gutterWidth != this.gutterWidth)
+ this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
+
+ if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {
+ this.$loop.schedule(this.CHANGE_FULL);
+ } else if (this.$size.$dirty) {
+ this.$loop.schedule(this.CHANGE_FULL);
+ } else {
+ this.$computeLayerConfig();
+ this.$loop.schedule(this.CHANGE_MARKER);
+ }
+ };
+ this.adjustWrapLimit = function() {
+ var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
+ var limit = Math.floor(availableWidth / this.characterWidth);
+ return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);
+ };
+ this.setAnimatedScroll = function(shouldAnimate){
+ this.setOption("animatedScroll", shouldAnimate);
+ };
+ this.getAnimatedScroll = function() {
+ return this.$animatedScroll;
+ };
+ this.setShowInvisibles = function(showInvisibles) {
+ this.setOption("showInvisibles", showInvisibles);
+ };
+ this.getShowInvisibles = function() {
+ return this.getOption("showInvisibles");
+ };
+ this.getDisplayIndentGuides = function() {
+ return this.getOption("displayIndentGuides");
+ };
+
+ this.setDisplayIndentGuides = function(display) {
+ this.setOption("displayIndentGuides", display);
+ };
+ this.setShowPrintMargin = function(showPrintMargin) {
+ this.setOption("showPrintMargin", showPrintMargin);
+ };
+ this.getShowPrintMargin = function() {
+ return this.getOption("showPrintMargin");
+ };
+ this.setPrintMarginColumn = function(showPrintMargin) {
+ this.setOption("printMarginColumn", showPrintMargin);
+ };
+ this.getPrintMarginColumn = function() {
+ return this.getOption("printMarginColumn");
+ };
+ this.getShowGutter = function(){
+ return this.getOption("showGutter");
+ };
+ this.setShowGutter = function(show){
+ return this.setOption("showGutter", show);
+ };
+
+ this.getFadeFoldWidgets = function(){
+ return this.getOption("fadeFoldWidgets")
+ };
+
+ this.setFadeFoldWidgets = function(show) {
+ this.setOption("fadeFoldWidgets", show);
+ };
+
+ this.setHighlightGutterLine = function(shouldHighlight) {
+ this.setOption("highlightGutterLine", shouldHighlight);
+ };
+
+ this.getHighlightGutterLine = function() {
+ return this.getOption("highlightGutterLine");
+ };
+
+ this.$updateGutterLineHighlight = function() {
+ var pos = this.$cursorLayer.$pixelPos;
+ var height = this.layerConfig.lineHeight;
+ if (this.session.getUseWrapMode()) {
+ var cursor = this.session.selection.getCursor();
+ cursor.column = 0;
+ pos = this.$cursorLayer.getPixelPosition(cursor, true);
+ height *= this.session.getRowLength(cursor.row);
+ }
+ this.$gutterLineHighlight.style.top = pos.top - this.layerConfig.offset + "px";
+ this.$gutterLineHighlight.style.height = height + "px";
+ };
+
+ this.$updatePrintMargin = function() {
+ if (!this.$showPrintMargin && !this.$printMarginEl)
+ return;
+
+ if (!this.$printMarginEl) {
+ var containerEl = dom.createElement("div");
+ containerEl.className = "ace_layer ace_print-margin-layer";
+ this.$printMarginEl = dom.createElement("div");
+ this.$printMarginEl.className = "ace_print-margin";
+ containerEl.appendChild(this.$printMarginEl);
+ this.content.insertBefore(containerEl, this.content.firstChild);
+ }
+
+ var style = this.$printMarginEl.style;
+ style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
+ style.visibility = this.$showPrintMargin ? "visible" : "hidden";
+
+ if (this.session && this.session.$wrap == -1)
+ this.adjustWrapLimit();
+ };
+ this.getContainerElement = function() {
+ return this.container;
+ };
+ this.getMouseEventTarget = function() {
+ return this.scroller;
+ };
+ this.getTextAreaContainer = function() {
+ return this.container;
+ };
+ this.$moveTextAreaToCursor = function() {
+ if (!this.$keepTextAreaAtCursor)
+ return;
+ var config = this.layerConfig;
+ var posTop = this.$cursorLayer.$pixelPos.top;
+ var posLeft = this.$cursorLayer.$pixelPos.left;
+ posTop -= config.offset;
+
+ var style = this.textarea.style;
+ var h = this.lineHeight;
+ if (posTop < 0 || posTop > config.height - h) {
+ style.top = style.left = "0";
+ return;
+ }
+
+ var w = this.characterWidth;
+ if (this.$composition) {
+ var val = this.textarea.value.replace(/^\x01+/, "");
+ w *= (this.session.$getStringScreenWidth(val)[0]+2);
+ h += 2;
+ }
+ posLeft -= this.scrollLeft;
+ if (posLeft > this.$size.scrollerWidth - w)
+ posLeft = this.$size.scrollerWidth - w;
+
+ posLeft += this.gutterWidth;
+ style.height = h + "px";
+ style.width = w + "px";
+ style.left = Math.min(posLeft, this.$size.scrollerWidth - w) + "px";
+ style.top = Math.min(posTop, this.$size.height - h) + "px";
+ };
+ this.getFirstVisibleRow = function() {
+ return this.layerConfig.firstRow;
+ };
+ this.getFirstFullyVisibleRow = function() {
+ return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
+ };
+ this.getLastFullyVisibleRow = function() {
+ var config = this.layerConfig;
+ var lastRow = config.lastRow
+ var top = this.session.documentToScreenRow(lastRow, 0) * config.lineHeight;
+ if (top - this.session.getScrollTop() > config.height - config.lineHeight)
+ return lastRow - 1;
+ return lastRow;
+ };
+ this.getLastVisibleRow = function() {
+ return this.layerConfig.lastRow;
+ };
+
+ this.$padding = null;
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ this.$textLayer.setPadding(padding);
+ this.$cursorLayer.setPadding(padding);
+ this.$markerFront.setPadding(padding);
+ this.$markerBack.setPadding(padding);
+ this.$loop.schedule(this.CHANGE_FULL);
+ this.$updatePrintMargin();
+ };
+
+ this.setScrollMargin = function(top, bottom, left, right) {
+ var sm = this.scrollMargin;
+ sm.top = top|0;
+ sm.bottom = bottom|0;
+ sm.right = right|0;
+ sm.left = left|0;
+ sm.v = sm.top + sm.bottom;
+ sm.h = sm.left + sm.right;
+ if (sm.top && this.scrollTop <= 0 && this.session)
+ this.session.setScrollTop(-sm.top);
+ this.updateFull();
+ };
+ this.getHScrollBarAlwaysVisible = function() {
+ return this.$hScrollBarAlwaysVisible;
+ };
+ this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
+ this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
+ };
+ this.getVScrollBarAlwaysVisible = function() {
+ return this.$vScrollBarAlwaysVisible;
+ };
+ this.setVScrollBarAlwaysVisible = function(alwaysVisible) {
+ this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
+ };
+
+ this.$updateScrollBarV = function() {
+ var scrollHeight = this.layerConfig.maxHeight;
+ var scrollerHeight = this.$size.scrollerHeight;
+ if (!this.$maxLines && this.$scrollPastEnd) {
+ scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
+ if (this.scrollTop > scrollHeight - scrollerHeight) {
+ scrollHeight = this.scrollTop + scrollerHeight;
+ this.scrollBarV.scrollTop = null;
+ }
+ }
+ this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
+ this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
+ };
+ this.$updateScrollBarH = function() {
+ this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
+ this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
+ };
+
+ this.$frozen = false;
+ this.freeze = function() {
+ this.$frozen = true;
+ };
+
+ this.unfreeze = function() {
+ this.$frozen = false;
+ };
+
+ this.$renderChanges = function(changes, force) {
+ if (this.$changes) {
+ changes |= this.$changes;
+ this.$changes = 0;
+ }
+ if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {
+ this.$changes |= changes;
+ return;
+ }
+ if (this.$size.$dirty) {
+ this.$changes |= changes;
+ return this.onResize(true);
+ }
+ if (!this.lineHeight) {
+ this.$textLayer.checkForSizeChanges();
+ }
+
+ this._signal("beforeRender");
+ var config = this.layerConfig;
+ if (changes & this.CHANGE_FULL ||
+ changes & this.CHANGE_SIZE ||
+ changes & this.CHANGE_TEXT ||
+ changes & this.CHANGE_LINES ||
+ changes & this.CHANGE_SCROLL ||
+ changes & this.CHANGE_H_SCROLL
+ ) {
+ changes |= this.$computeLayerConfig();
+ if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {
+ var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;
+ if (st > 0) {
+ this.scrollTop = st;
+ changes = changes | this.CHANGE_SCROLL;
+ changes |= this.$computeLayerConfig();
+ }
+ }
+ config = this.layerConfig;
+ this.$updateScrollBarV();
+ if (changes & this.CHANGE_H_SCROLL)
+ this.$updateScrollBarH();
+ this.$gutterLayer.element.style.marginTop = (-config.offset) + "px";
+ this.content.style.marginTop = (-config.offset) + "px";
+ this.content.style.width = config.width + 2 * this.$padding + "px";
+ this.content.style.height = config.minHeight + "px";
+ }
+ if (changes & this.CHANGE_H_SCROLL) {
+ this.content.style.marginLeft = -this.scrollLeft + "px";
+ this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
+ }
+ if (changes & this.CHANGE_FULL) {
+ this.$textLayer.update(config);
+ if (this.$showGutter)
+ this.$gutterLayer.update(config);
+ this.$markerBack.update(config);
+ this.$markerFront.update(config);
+ this.$cursorLayer.update(config);
+ this.$moveTextAreaToCursor();
+ this.$highlightGutterLine && this.$updateGutterLineHighlight();
+ this._signal("afterRender");
+ return;
+ }
+ if (changes & this.CHANGE_SCROLL) {
+ if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
+ this.$textLayer.update(config);
+ else
+ this.$textLayer.scrollLines(config);
+
+ if (this.$showGutter)
+ this.$gutterLayer.update(config);
+ this.$markerBack.update(config);
+ this.$markerFront.update(config);
+ this.$cursorLayer.update(config);
+ this.$highlightGutterLine && this.$updateGutterLineHighlight();
+ this.$moveTextAreaToCursor();
+ this._signal("afterRender");
+ return;
+ }
+
+ if (changes & this.CHANGE_TEXT) {
+ this.$textLayer.update(config);
+ if (this.$showGutter)
+ this.$gutterLayer.update(config);
+ }
+ else if (changes & this.CHANGE_LINES) {
+ if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)
+ this.$gutterLayer.update(config);
+ }
+ else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
+ if (this.$showGutter)
+ this.$gutterLayer.update(config);
+ }
+
+ if (changes & this.CHANGE_CURSOR) {
+ this.$cursorLayer.update(config);
+ this.$moveTextAreaToCursor();
+ this.$highlightGutterLine && this.$updateGutterLineHighlight();
+ }
+
+ if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
+ this.$markerFront.update(config);
+ }
+
+ if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
+ this.$markerBack.update(config);
+ }
+
+ this._signal("afterRender");
+ };
+
+
+ this.$autosize = function() {
+ var height = this.session.getScreenLength() * this.lineHeight;
+ var maxHeight = this.$maxLines * this.lineHeight;
+ var desiredHeight = Math.max(
+ (this.$minLines||1) * this.lineHeight,
+ Math.min(maxHeight, height)
+ ) + this.scrollMargin.v + (this.$extraHeight || 0);
+ if (this.$horizScroll)
+ desiredHeight += this.scrollBarH.getHeight();
+ var vScroll = height > maxHeight;
+
+ if (desiredHeight != this.desiredHeight ||
+ this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {
+ if (vScroll != this.$vScroll) {
+ this.$vScroll = vScroll;
+ this.scrollBarV.setVisible(vScroll);
+ }
+
+ var w = this.container.clientWidth;
+ this.container.style.height = desiredHeight + "px";
+ this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight);
+ this.desiredHeight = desiredHeight;
+
+ this._signal("autosize");
+ }
+ };
+
+ this.$computeLayerConfig = function() {
+ var session = this.session;
+ var size = this.$size;
+
+ var hideScrollbars = size.height <= 2 * this.lineHeight;
+ var screenLines = this.session.getScreenLength();
+ var maxHeight = screenLines * this.lineHeight;
+
+ var longestLine = this.$getLongestLine();
+
+ var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||
+ size.scrollerWidth - longestLine - 2 * this.$padding < 0);
+
+ var hScrollChanged = this.$horizScroll !== horizScroll;
+ if (hScrollChanged) {
+ this.$horizScroll = horizScroll;
+ this.scrollBarH.setVisible(horizScroll);
+ }
+ var vScrollBefore = this.$vScroll; // autosize can change vscroll value in which case we need to update longestLine
+ if (this.$maxLines && this.lineHeight > 1)
+ this.$autosize();
+
+ var offset = this.scrollTop % this.lineHeight;
+ var minHeight = size.scrollerHeight + this.lineHeight;
+
+ var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd
+ ? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
+ : 0;
+ maxHeight += scrollPastEnd;
+
+ var sm = this.scrollMargin;
+ this.session.setScrollTop(Math.max(-sm.top,
+ Math.min(this.scrollTop, maxHeight - size.scrollerHeight + sm.bottom)));
+
+ this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft,
+ longestLine + 2 * this.$padding - size.scrollerWidth + sm.right)));
+
+ var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
+ size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);
+ var vScrollChanged = vScrollBefore !== vScroll;
+ if (vScrollChanged) {
+ this.$vScroll = vScroll;
+ this.scrollBarV.setVisible(vScroll);
+ }
+
+ var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
+ var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
+ var lastRow = firstRow + lineCount;
+ var firstRowScreen, firstRowHeight;
+ var lineHeight = this.lineHeight;
+ firstRow = session.screenToDocumentRow(firstRow, 0);
+ var foldLine = session.getFoldLine(firstRow);
+ if (foldLine) {
+ firstRow = foldLine.start.row;
+ }
+
+ firstRowScreen = session.documentToScreenRow(firstRow, 0);
+ firstRowHeight = session.getRowLength(firstRow) * lineHeight;
+
+ lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
+ minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
+ firstRowHeight;
+
+ offset = this.scrollTop - firstRowScreen * lineHeight;
+
+ var changes = 0;
+ if (this.layerConfig.width != longestLine)
+ changes = this.CHANGE_H_SCROLL;
+ if (hScrollChanged || vScrollChanged) {
+ changes = this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
+ this._signal("scrollbarVisibilityChanged");
+ if (vScrollChanged)
+ longestLine = this.$getLongestLine();
+ }
+
+ this.layerConfig = {
+ width : longestLine,
+ padding : this.$padding,
+ firstRow : firstRow,
+ firstRowScreen: firstRowScreen,
+ lastRow : lastRow,
+ lineHeight : lineHeight,
+ characterWidth : this.characterWidth,
+ minHeight : minHeight,
+ maxHeight : maxHeight,
+ offset : offset,
+ gutterOffset : Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)),
+ height : this.$size.scrollerHeight
+ };
+
+ return changes;
+ };
+
+ this.$updateLines = function() {
+ var firstRow = this.$changedLines.firstRow;
+ var lastRow = this.$changedLines.lastRow;
+ this.$changedLines = null;
+
+ var layerConfig = this.layerConfig;
+
+ if (firstRow > layerConfig.lastRow + 1) { return; }
+ if (lastRow < layerConfig.firstRow) { return; }
+ if (lastRow === Infinity) {
+ if (this.$showGutter)
+ this.$gutterLayer.update(layerConfig);
+ this.$textLayer.update(layerConfig);
+ return;
+ }
+ this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
+ return true;
+ };
+
+ this.$getLongestLine = function() {
+ var charCount = this.session.getScreenWidth();
+ if (this.showInvisibles && !this.session.$useWrapMode)
+ charCount += 1;
+
+ return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
+ };
+ this.updateFrontMarkers = function() {
+ this.$markerFront.setMarkers(this.session.getMarkers(true));
+ this.$loop.schedule(this.CHANGE_MARKER_FRONT);
+ };
+ this.updateBackMarkers = function() {
+ this.$markerBack.setMarkers(this.session.getMarkers());
+ this.$loop.schedule(this.CHANGE_MARKER_BACK);
+ };
+ this.addGutterDecoration = function(row, className){
+ this.$gutterLayer.addGutterDecoration(row, className);
+ };
+ this.removeGutterDecoration = function(row, className){
+ this.$gutterLayer.removeGutterDecoration(row, className);
+ };
+ this.updateBreakpoints = function(rows) {
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ };
+ this.setAnnotations = function(annotations) {
+ this.$gutterLayer.setAnnotations(annotations);
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ };
+ this.updateCursor = function() {
+ this.$loop.schedule(this.CHANGE_CURSOR);
+ };
+ this.hideCursor = function() {
+ this.$cursorLayer.hideCursor();
+ };
+ this.showCursor = function() {
+ this.$cursorLayer.showCursor();
+ };
+
+ this.scrollSelectionIntoView = function(anchor, lead, offset) {
+ this.scrollCursorIntoView(anchor, offset);
+ this.scrollCursorIntoView(lead, offset);
+ };
+ this.scrollCursorIntoView = function(cursor, offset, $viewMargin) {
+ if (this.$size.scrollerHeight === 0)
+ return;
+
+ var pos = this.$cursorLayer.getPixelPosition(cursor);
+
+ var left = pos.left;
+ var top = pos.top;
+
+ var topMargin = $viewMargin && $viewMargin.top || 0;
+ var bottomMargin = $viewMargin && $viewMargin.bottom || 0;
+
+ var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;
+
+ if (scrollTop + topMargin > top) {
+ if (offset && scrollTop + topMargin > top + this.lineHeight)
+ top -= offset * this.$size.scrollerHeight;
+ if (top === 0)
+ top = -this.scrollMargin.top;
+ this.session.setScrollTop(top);
+ } else if (scrollTop + this.$size.scrollerHeight - bottomMargin < top + this.lineHeight) {
+ if (offset && scrollTop + this.$size.scrollerHeight - bottomMargin < top - this.lineHeight)
+ top += offset * this.$size.scrollerHeight;
+ this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
+ }
+
+ var scrollLeft = this.scrollLeft;
+
+ if (scrollLeft > left) {
+ if (left < this.$padding + 2 * this.layerConfig.characterWidth)
+ left = -this.scrollMargin.left;
+ this.session.setScrollLeft(left);
+ } else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
+ this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
+ } else if (scrollLeft <= this.$padding && left - scrollLeft < this.characterWidth) {
+ this.session.setScrollLeft(0);
+ }
+ };
+ this.getScrollTop = function() {
+ return this.session.getScrollTop();
+ };
+ this.getScrollLeft = function() {
+ return this.session.getScrollLeft();
+ };
+ this.getScrollTopRow = function() {
+ return this.scrollTop / this.lineHeight;
+ };
+ this.getScrollBottomRow = function() {
+ return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
+ };
+ this.scrollToRow = function(row) {
+ this.session.setScrollTop(row * this.lineHeight);
+ };
+
+ this.alignCursor = function(cursor, alignment) {
+ if (typeof cursor == "number")
+ cursor = {row: cursor, column: 0};
+
+ var pos = this.$cursorLayer.getPixelPosition(cursor);
+ var h = this.$size.scrollerHeight - this.lineHeight;
+ var offset = pos.top - h * (alignment || 0);
+
+ this.session.setScrollTop(offset);
+ return offset;
+ };
+
+ this.STEPS = 8;
+ this.$calcSteps = function(fromValue, toValue){
+ var i = 0;
+ var l = this.STEPS;
+ var steps = [];
+
+ var func = function(t, x_min, dx) {
+ return dx * (Math.pow(t - 1, 3) + 1) + x_min;
+ };
+
+ for (i = 0; i < l; ++i)
+ steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));
+
+ return steps;
+ };
+ this.scrollToLine = function(line, center, animate, callback) {
+ var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
+ var offset = pos.top;
+ if (center)
+ offset -= this.$size.scrollerHeight / 2;
+
+ var initialScroll = this.scrollTop;
+ this.session.setScrollTop(offset);
+ if (animate !== false)
+ this.animateScrolling(initialScroll, callback);
+ };
+
+ this.animateScrolling = function(fromValue, callback) {
+ var toValue = this.scrollTop;
+ if (!this.$animatedScroll)
+ return;
+ var _self = this;
+
+ if (fromValue == toValue)
+ return;
+
+ if (this.$scrollAnimation) {
+ var oldSteps = this.$scrollAnimation.steps;
+ if (oldSteps.length) {
+ fromValue = oldSteps[0];
+ if (fromValue == toValue)
+ return;
+ }
+ }
+
+ var steps = _self.$calcSteps(fromValue, toValue);
+ this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps};
+
+ clearInterval(this.$timer);
+
+ _self.session.setScrollTop(steps.shift());
+ _self.session.$scrollTop = toValue;
+ this.$timer = setInterval(function() {
+ if (steps.length) {
+ _self.session.setScrollTop(steps.shift());
+ _self.session.$scrollTop = toValue;
+ } else if (toValue != null) {
+ _self.session.$scrollTop = -1;
+ _self.session.setScrollTop(toValue);
+ toValue = null;
+ } else {
+ _self.$timer = clearInterval(_self.$timer);
+ _self.$scrollAnimation = null;
+ callback && callback();
+ }
+ }, 10);
+ };
+ this.scrollToY = function(scrollTop) {
+ if (this.scrollTop !== scrollTop) {
+ this.$loop.schedule(this.CHANGE_SCROLL);
+ this.scrollTop = scrollTop;
+ }
+ };
+ this.scrollToX = function(scrollLeft) {
+ if (this.scrollLeft !== scrollLeft)
+ this.scrollLeft = scrollLeft;
+ this.$loop.schedule(this.CHANGE_H_SCROLL);
+ };
+ this.scrollTo = function(x, y) {
+ this.session.setScrollTop(y);
+ this.session.setScrollLeft(y);
+ };
+ this.scrollBy = function(deltaX, deltaY) {
+ deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
+ deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
+ };
+ this.isScrollableBy = function(deltaX, deltaY) {
+ if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
+ return true;
+ if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
+ - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
+ return true;
+ if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
+ return true;
+ if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth
+ - this.layerConfig.width < -1 + this.scrollMargin.right)
+ return true;
+ };
+
+ this.pixelToScreenCoordinates = function(x, y) {
+ var canvasPos = this.scroller.getBoundingClientRect();
+
+ var offset = (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth;
+ var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
+ var col = Math.round(offset);
+
+ return {row: row, column: col, side: offset - col > 0 ? 1 : -1};
+ };
+
+ this.screenToTextCoordinates = function(x, y) {
+ var canvasPos = this.scroller.getBoundingClientRect();
+
+ var col = Math.round(
+ (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
+ );
+
+ var row = (y + this.scrollTop - canvasPos.top) / this.lineHeight;
+
+ return this.session.screenToDocumentPosition(row, Math.max(col, 0));
+ };
+ this.textToScreenCoordinates = function(row, column) {
+ var canvasPos = this.scroller.getBoundingClientRect();
+ var pos = this.session.documentToScreenPosition(row, column);
+
+ var x = this.$padding + Math.round(pos.column * this.characterWidth);
+ var y = pos.row * this.lineHeight;
+
+ return {
+ pageX: canvasPos.left + x - this.scrollLeft,
+ pageY: canvasPos.top + y - this.scrollTop
+ };
+ };
+ this.visualizeFocus = function() {
+ dom.addCssClass(this.container, "ace_focus");
+ };
+ this.visualizeBlur = function() {
+ dom.removeCssClass(this.container, "ace_focus");
+ };
+ this.showComposition = function(position) {
+ if (!this.$composition)
+ this.$composition = {
+ keepTextAreaAtCursor: this.$keepTextAreaAtCursor,
+ cssText: this.textarea.style.cssText
+ };
+
+ this.$keepTextAreaAtCursor = true;
+ dom.addCssClass(this.textarea, "ace_composition");
+ this.textarea.style.cssText = "";
+ this.$moveTextAreaToCursor();
+ };
+ this.setCompositionText = function(text) {
+ this.$moveTextAreaToCursor();
+ };
+ this.hideComposition = function() {
+ if (!this.$composition)
+ return;
+
+ dom.removeCssClass(this.textarea, "ace_composition");
+ this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor;
+ this.textarea.style.cssText = this.$composition.cssText;
+ this.$composition = null;
+ };
+ this.setTheme = function(theme, cb) {
+ var _self = this;
+ this.$themeId = theme;
+ _self._dispatchEvent('themeChange',{theme:theme});
+
+ if (!theme || typeof theme == "string") {
+ var moduleName = theme || this.$options.theme.initialValue;
+ config.loadModule(["theme", moduleName], afterLoad);
+ } else {
+ afterLoad(theme);
+ }
+
+ function afterLoad(module) {
+ if (_self.$themeId != theme)
+ return cb && cb();
+ if (!module.cssClass)
+ return;
+ dom.importCssString(
+ module.cssText,
+ module.cssClass,
+ _self.container.ownerDocument
+ );
+
+ if (_self.theme)
+ dom.removeCssClass(_self.container, _self.theme.cssClass);
+
+ var padding = "padding" in module ? module.padding
+ : "padding" in (_self.theme || {}) ? 4 : _self.$padding;
+ if (_self.$padding && padding != _self.$padding)
+ _self.setPadding(padding);
+ _self.$theme = module.cssClass;
+
+ _self.theme = module;
+ dom.addCssClass(_self.container, module.cssClass);
+ dom.setCssClass(_self.container, "ace_dark", module.isDark);
+ if (_self.$size) {
+ _self.$size.width = 0;
+ _self.$updateSizeAsync();
+ }
+
+ _self._dispatchEvent('themeLoaded', {theme:module});
+ cb && cb();
+ }
+ };
+ this.getTheme = function() {
+ return this.$themeId;
+ };
+ this.setStyle = function(style, include) {
+ dom.setCssClass(this.container, style, include !== false);
+ };
+ this.unsetStyle = function(style) {
+ dom.removeCssClass(this.container, style);
+ };
+
+ this.setCursorStyle = function(style) {
+ if (this.scroller.style.cursor != style)
+ this.scroller.style.cursor = style;
+ };
+ this.setMouseCursor = function(cursorStyle) {
+ this.scroller.style.cursor = cursorStyle;
+ };
+ this.destroy = function() {
+ this.$textLayer.destroy();
+ this.$cursorLayer.destroy();
+ };
+
+}).call(VirtualRenderer.prototype);
+
+
+config.defineOptions(VirtualRenderer.prototype, "renderer", {
+ animatedScroll: {initialValue: false},
+ showInvisibles: {
+ set: function(value) {
+ if (this.$textLayer.setShowInvisibles(value))
+ this.$loop.schedule(this.CHANGE_TEXT);
+ },
+ initialValue: false
+ },
+ showPrintMargin: {
+ set: function() { this.$updatePrintMargin(); },
+ initialValue: true
+ },
+ printMarginColumn: {
+ set: function() { this.$updatePrintMargin(); },
+ initialValue: 80
+ },
+ printMargin: {
+ set: function(val) {
+ if (typeof val == "number")
+ this.$printMarginColumn = val;
+ this.$showPrintMargin = !!val;
+ this.$updatePrintMargin();
+ },
+ get: function() {
+ return this.$showPrintMargin && this.$printMarginColumn;
+ }
+ },
+ showGutter: {
+ set: function(show){
+ this.$gutter.style.display = show ? "block" : "none";
+ this.$loop.schedule(this.CHANGE_FULL);
+ this.onGutterResize();
+ },
+ initialValue: true
+ },
+ fadeFoldWidgets: {
+ set: function(show) {
+ dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
+ },
+ initialValue: false
+ },
+ showFoldWidgets: {
+ set: function(show) {this.$gutterLayer.setShowFoldWidgets(show)},
+ initialValue: true
+ },
+ showLineNumbers: {
+ set: function(show) {
+ this.$gutterLayer.setShowLineNumbers(show);
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ },
+ initialValue: true
+ },
+ displayIndentGuides: {
+ set: function(show) {
+ if (this.$textLayer.setDisplayIndentGuides(show))
+ this.$loop.schedule(this.CHANGE_TEXT);
+ },
+ initialValue: true
+ },
+ highlightGutterLine: {
+ set: function(shouldHighlight) {
+ if (!this.$gutterLineHighlight) {
+ this.$gutterLineHighlight = dom.createElement("div");
+ this.$gutterLineHighlight.className = "ace_gutter-active-line";
+ this.$gutter.appendChild(this.$gutterLineHighlight);
+ return;
+ }
+
+ this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none";
+ if (this.$cursorLayer.$pixelPos)
+ this.$updateGutterLineHighlight();
+ },
+ initialValue: false,
+ value: true
+ },
+ hScrollBarAlwaysVisible: {
+ set: function(val) {
+ if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
+ this.$loop.schedule(this.CHANGE_SCROLL);
+ },
+ initialValue: false
+ },
+ vScrollBarAlwaysVisible: {
+ set: function(val) {
+ if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)
+ this.$loop.schedule(this.CHANGE_SCROLL);
+ },
+ initialValue: false
+ },
+ fontSize: {
+ set: function(size) {
+ if (typeof size == "number")
+ size = size + "px";
+ this.container.style.fontSize = size;
+ this.updateFontSize();
+ },
+ initialValue: 12
+ },
+ fontFamily: {
+ set: function(name) {
+ this.container.style.fontFamily = name;
+ this.updateFontSize();
+ }
+ },
+ maxLines: {
+ set: function(val) {
+ this.updateFull();
+ }
+ },
+ minLines: {
+ set: function(val) {
+ this.updateFull();
+ }
+ },
+ scrollPastEnd: {
+ set: function(val) {
+ val = +val || 0;
+ if (this.$scrollPastEnd == val)
+ return;
+ this.$scrollPastEnd = val;
+ this.$loop.schedule(this.CHANGE_SCROLL);
+ },
+ initialValue: 0,
+ handlesSet: true
+ },
+ fixedWidthGutter: {
+ set: function(val) {
+ this.$gutterLayer.$fixedWidth = !!val;
+ this.$loop.schedule(this.CHANGE_GUTTER);
+ }
+ },
+ theme: {
+ set: function(val) { this.setTheme(val) },
+ get: function() { return this.$themeId || this.theme; },
+ initialValue: "./theme/textmate",
+ handlesSet: true
+ }
+});
+
+exports.VirtualRenderer = VirtualRenderer;
+});
+
+ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var net = acequire("../lib/net");
+var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
+var config = acequire("../config");
+
+var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
+ this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
+ this.changeListener = this.changeListener.bind(this);
+ this.onMessage = this.onMessage.bind(this);
+ if (acequire.nameToUrl && !acequire.toUrl)
+ acequire.toUrl = acequire.nameToUrl;
+
+ if (config.get("packaged") || !acequire.toUrl) {
+ workerUrl = workerUrl || config.moduleUrl(mod.id, "worker")
+ } else {
+ var normalizePath = this.$normalizePath;
+ workerUrl = workerUrl || normalizePath(acequire.toUrl("ace/worker/worker.js", null, "_"));
+
+ var tlns = {};
+ topLevelNamespaces.forEach(function(ns) {
+ tlns[ns] = normalizePath(acequire.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
+ });
+ }
+
+ try {
+ var workerSrc = mod.src;
+ var Blob = require('w3c-blob');
+ var blob = new Blob([ workerSrc ], { type: 'application/javascript' });
+ var blobUrl = (window.URL || window.webkitURL).createObjectURL(blob);
+
+ this.$worker = new Worker(blobUrl);
+
+ } catch(e) {
+ if (e instanceof window.DOMException) {
+ var blob = this.$workerBlob(workerUrl);
+ var URL = window.URL || window.webkitURL;
+ var blobURL = URL.createObjectURL(blob);
+
+ this.$worker = new Worker(blobURL);
+ URL.revokeObjectURL(blobURL);
+ } else {
+ throw e;
+ }
+ }
+ this.$worker.postMessage({
+ init : true,
+ tlns : tlns,
+ module : mod.id,
+ classname : classname
+ });
+
+ this.callbackId = 1;
+ this.callbacks = {};
+
+ this.$worker.onmessage = this.onMessage;
+};
+
+(function(){
+
+ oop.implement(this, EventEmitter);
+
+ this.onMessage = function(e) {
+ var msg = e.data;
+ switch(msg.type) {
+ case "event":
+ this._signal(msg.name, {data: msg.data});
+ break;
+ case "call":
+ var callback = this.callbacks[msg.id];
+ if (callback) {
+ callback(msg.data);
+ delete this.callbacks[msg.id];
+ }
+ break;
+ case "error":
+ this.reportError(msg.data);
+ break;
+ case "log":
+ window.console && console.log && console.log.apply(console, msg.data);
+ break;
+ }
+ };
+
+ this.reportError = function(err) {
+ window.console && console.error && console.error(err);
+ };
+
+ this.$normalizePath = function(path) {
+ return net.qualifyURL(path);
+ };
+
+ this.terminate = function() {
+ this._signal("terminate", {});
+ this.deltaQueue = null;
+ this.$worker.terminate();
+ this.$worker = null;
+ if (this.$doc)
+ this.$doc.off("change", this.changeListener);
+ this.$doc = null;
+ };
+
+ this.send = function(cmd, args) {
+ this.$worker.postMessage({command: cmd, args: args});
+ };
+
+ this.call = function(cmd, args, callback) {
+ if (callback) {
+ var id = this.callbackId++;
+ this.callbacks[id] = callback;
+ args.push(id);
+ }
+ this.send(cmd, args);
+ };
+
+ this.emit = function(event, data) {
+ try {
+ this.$worker.postMessage({event: event, data: {data: data.data}});
+ }
+ catch(ex) {
+ console.error(ex.stack);
+ }
+ };
+
+ this.attachToDocument = function(doc) {
+ if(this.$doc)
+ this.terminate();
+
+ this.$doc = doc;
+ this.call("setValue", [doc.getValue()]);
+ doc.on("change", this.changeListener);
+ };
+
+ this.changeListener = function(delta) {
+ if (!this.deltaQueue) {
+ this.deltaQueue = [];
+ setTimeout(this.$sendDeltaQueue, 0);
+ }
+ if (delta.action == "insert")
+ this.deltaQueue.push(delta.start, delta.lines);
+ else
+ this.deltaQueue.push(delta.start, delta.end);
+ };
+
+ this.$sendDeltaQueue = function() {
+ var q = this.deltaQueue;
+ if (!q) return;
+ this.deltaQueue = null;
+ if (q.length > 50 && q.length > this.$doc.getLength() >> 1) {
+ this.call("setValue", [this.$doc.getValue()]);
+ } else
+ this.emit("change", {data: q});
+ };
+
+ this.$workerBlob = function(workerUrl) {
+ var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
+ try {
+ return new Blob([script], {"type": "application/javascript"});
+ } catch (e) { // Backwards-compatibility
+ var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
+ var blobBuilder = new BlobBuilder();
+ blobBuilder.append(script);
+ return blobBuilder.getBlob("application/javascript");
+ }
+ };
+
+}).call(WorkerClient.prototype);
+
+
+var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
+ this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
+ this.changeListener = this.changeListener.bind(this);
+ this.callbackId = 1;
+ this.callbacks = {};
+ this.messageBuffer = [];
+
+ var main = null;
+ var emitSync = false;
+ var sender = Object.create(EventEmitter);
+ var _self = this;
+
+ this.$worker = {};
+ this.$worker.terminate = function() {};
+ this.$worker.postMessage = function(e) {
+ _self.messageBuffer.push(e);
+ if (main) {
+ if (emitSync)
+ setTimeout(processNext);
+ else
+ processNext();
+ }
+ };
+ this.setEmitSync = function(val) { emitSync = val };
+
+ var processNext = function() {
+ var msg = _self.messageBuffer.shift();
+ if (msg.command)
+ main[msg.command].apply(main, msg.args);
+ else if (msg.event)
+ sender._signal(msg.event, msg.data);
+ };
+
+ sender.postMessage = function(msg) {
+ _self.onMessage({data: msg});
+ };
+ sender.callback = function(data, callbackId) {
+ this.postMessage({type: "call", id: callbackId, data: data});
+ };
+ sender.emit = function(name, data) {
+ this.postMessage({type: "event", name: name, data: data});
+ };
+
+ config.loadModule(["worker", mod], function(Main) {
+ main = new Main[classname](sender);
+ while (_self.messageBuffer.length)
+ processNext();
+ });
+};
+
+UIWorkerClient.prototype = WorkerClient.prototype;
+
+exports.UIWorkerClient = UIWorkerClient;
+exports.WorkerClient = WorkerClient;
+
+});
+
+ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("./range").Range;
+var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
+var oop = acequire("./lib/oop");
+
+var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
+ var _self = this;
+ this.length = length;
+ this.session = session;
+ this.doc = session.getDocument();
+ this.mainClass = mainClass;
+ this.othersClass = othersClass;
+ this.$onUpdate = this.onUpdate.bind(this);
+ this.doc.on("change", this.$onUpdate);
+ this.$others = others;
+
+ this.$onCursorChange = function() {
+ setTimeout(function() {
+ _self.onCursorChange();
+ });
+ };
+
+ this.$pos = pos;
+ var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
+ this.$undoStackDepth = undoStack.length;
+ this.setup();
+
+ session.selection.on("changeCursor", this.$onCursorChange);
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+ this.setup = function() {
+ var _self = this;
+ var doc = this.doc;
+ var session = this.session;
+
+ this.selectionBefore = session.selection.toJSON();
+ if (session.selection.inMultiSelectMode)
+ session.selection.toSingleRange();
+
+ this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);
+ var pos = this.pos;
+ pos.$insertRight = true;
+ pos.detach();
+ pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
+ this.others = [];
+ this.$others.forEach(function(other) {
+ var anchor = doc.createAnchor(other.row, other.column);
+ anchor.$insertRight = true;
+ anchor.detach();
+ _self.others.push(anchor);
+ });
+ session.setUndoSelect(false);
+ };
+ this.showOtherMarkers = function() {
+ if (this.othersActive) return;
+ var session = this.session;
+ var _self = this;
+ this.othersActive = true;
+ this.others.forEach(function(anchor) {
+ anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);
+ });
+ };
+ this.hideOtherMarkers = function() {
+ if (!this.othersActive) return;
+ this.othersActive = false;
+ for (var i = 0; i < this.others.length; i++) {
+ this.session.removeMarker(this.others[i].markerId);
+ }
+ };
+ this.onUpdate = function(delta) {
+ if (this.$updating)
+ return this.updateAnchors(delta);
+
+ var range = delta;
+ if (range.start.row !== range.end.row) return;
+ if (range.start.row !== this.pos.row) return;
+ this.$updating = true;
+ var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column;
+ var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1;
+ var distanceFromStart = range.start.column - this.pos.column;
+
+ this.updateAnchors(delta);
+
+ if (inMainRange)
+ this.length += lengthDiff;
+
+ if (inMainRange && !this.session.$fromUndo) {
+ if (delta.action === 'insert') {
+ for (var i = this.others.length - 1; i >= 0; i--) {
+ var otherPos = this.others[i];
+ var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
+ this.doc.insertMergedLines(newPos, delta.lines);
+ }
+ } else if (delta.action === 'remove') {
+ for (var i = this.others.length - 1; i >= 0; i--) {
+ var otherPos = this.others[i];
+ var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
+ this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
+ }
+ }
+ }
+
+ this.$updating = false;
+ this.updateMarkers();
+ };
+
+ this.updateAnchors = function(delta) {
+ this.pos.onChange(delta);
+ for (var i = this.others.length; i--;)
+ this.others[i].onChange(delta);
+ this.updateMarkers();
+ };
+
+ this.updateMarkers = function() {
+ if (this.$updating)
+ return;
+ var _self = this;
+ var session = this.session;
+ var updateMarker = function(pos, className) {
+ session.removeMarker(pos.markerId);
+ pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column+_self.length), className, null, false);
+ };
+ updateMarker(this.pos, this.mainClass);
+ for (var i = this.others.length; i--;)
+ updateMarker(this.others[i], this.othersClass);
+ };
+
+ this.onCursorChange = function(event) {
+ if (this.$updating || !this.session) return;
+ var pos = this.session.selection.getCursor();
+ if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
+ this.showOtherMarkers();
+ this._emit("cursorEnter", event);
+ } else {
+ this.hideOtherMarkers();
+ this._emit("cursorLeave", event);
+ }
+ };
+ this.detach = function() {
+ this.session.removeMarker(this.pos && this.pos.markerId);
+ this.hideOtherMarkers();
+ this.doc.removeEventListener("change", this.$onUpdate);
+ this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
+ this.session.setUndoSelect(true);
+ this.session = null;
+ };
+ this.cancel = function() {
+ if (this.$undoStackDepth === -1)
+ return;
+ var undoManager = this.session.getUndoManager();
+ var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
+ for (var i = 0; i < undosRequired; i++) {
+ undoManager.undo(true);
+ }
+ if (this.selectionBefore)
+ this.session.selection.fromJSON(this.selectionBefore);
+ };
+}).call(PlaceHolder.prototype);
+
+
+exports.PlaceHolder = PlaceHolder;
+});
+
+ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"], function(acequire, exports, module) {
+
+var event = acequire("../lib/event");
+var useragent = acequire("../lib/useragent");
+function isSamePoint(p1, p2) {
+ return p1.row == p2.row && p1.column == p2.column;
+}
+
+function onMouseDown(e) {
+ var ev = e.domEvent;
+ var alt = ev.altKey;
+ var shift = ev.shiftKey;
+ var ctrl = ev.ctrlKey;
+ var accel = e.getAccelKey();
+ var button = e.getButton();
+
+ if (ctrl && useragent.isMac)
+ button = ev.button;
+
+ if (e.editor.inMultiSelectMode && button == 2) {
+ e.editor.textInput.onContextMenu(e.domEvent);
+ return;
+ }
+
+ if (!ctrl && !alt && !accel) {
+ if (button === 0 && e.editor.inMultiSelectMode)
+ e.editor.exitMultiSelectMode();
+ return;
+ }
+
+ if (button !== 0)
+ return;
+
+ var editor = e.editor;
+ var selection = editor.selection;
+ var isMultiSelect = editor.inMultiSelectMode;
+ var pos = e.getDocumentPosition();
+ var cursor = selection.getCursor();
+ var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));
+
+ var mouseX = e.x, mouseY = e.y;
+ var onMouseSelection = function(e) {
+ mouseX = e.clientX;
+ mouseY = e.clientY;
+ };
+
+ var session = editor.session;
+ var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
+ var screenCursor = screenAnchor;
+
+ var selectionMode;
+ if (editor.$mouseHandler.$enableJumpToDef) {
+ if (ctrl && alt || accel && alt)
+ selectionMode = shift ? "block" : "add";
+ else if (alt && editor.$blockSelectEnabled)
+ selectionMode = "block";
+ } else {
+ if (accel && !alt) {
+ selectionMode = "add";
+ if (!isMultiSelect && shift)
+ return;
+ } else if (alt && editor.$blockSelectEnabled) {
+ selectionMode = "block";
+ }
+ }
+
+ if (selectionMode && useragent.isMac && ev.ctrlKey) {
+ editor.$mouseHandler.cancelContextMenu();
+ }
+
+ if (selectionMode == "add") {
+ if (!isMultiSelect && inSelection)
+ return; // dragging
+
+ if (!isMultiSelect) {
+ var range = selection.toOrientedRange();
+ editor.addSelectionMarker(range);
+ }
+
+ var oldRange = selection.rangeList.rangeAtPoint(pos);
+
+
+ editor.$blockScrolling++;
+ editor.inVirtualSelectionMode = true;
+
+ if (shift) {
+ oldRange = null;
+ range = selection.ranges[0] || range;
+ editor.removeSelectionMarker(range);
+ }
+ editor.once("mouseup", function() {
+ var tmpSel = selection.toOrientedRange();
+
+ if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
+ selection.substractPoint(tmpSel.cursor);
+ else {
+ if (shift) {
+ selection.substractPoint(range.cursor);
+ } else if (range) {
+ editor.removeSelectionMarker(range);
+ selection.addRange(range);
+ }
+ selection.addRange(tmpSel);
+ }
+ editor.$blockScrolling--;
+ editor.inVirtualSelectionMode = false;
+ });
+
+ } else if (selectionMode == "block") {
+ e.stop();
+ editor.inVirtualSelectionMode = true;
+ var initialRange;
+ var rectSel = [];
+ var blockSelect = function() {
+ var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
+ var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column);
+
+ if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead))
+ return;
+ screenCursor = newCursor;
+
+ editor.$blockScrolling++;
+ editor.selection.moveToPosition(cursor);
+ editor.renderer.scrollCursorIntoView();
+
+ editor.removeSelectionMarkers(rectSel);
+ rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
+ if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())
+ rectSel[0] = editor.$mouseHandler.$clickSelection.clone();
+ rectSel.forEach(editor.addSelectionMarker, editor);
+ editor.updateSelectionMarkers();
+ editor.$blockScrolling--;
+ };
+ editor.$blockScrolling++;
+ if (isMultiSelect && !accel) {
+ selection.toSingleRange();
+ } else if (!isMultiSelect && accel) {
+ initialRange = selection.toOrientedRange();
+ editor.addSelectionMarker(initialRange);
+ }
+
+ if (shift)
+ screenAnchor = session.documentToScreenPosition(selection.lead);
+ else
+ selection.moveToPosition(pos);
+ editor.$blockScrolling--;
+
+ screenCursor = {row: -1, column: -1};
+
+ var onMouseSelectionEnd = function(e) {
+ clearInterval(timerId);
+ editor.removeSelectionMarkers(rectSel);
+ if (!rectSel.length)
+ rectSel = [selection.toOrientedRange()];
+ editor.$blockScrolling++;
+ if (initialRange) {
+ editor.removeSelectionMarker(initialRange);
+ selection.toSingleRange(initialRange);
+ }
+ for (var i = 0; i < rectSel.length; i++)
+ selection.addRange(rectSel[i]);
+ editor.inVirtualSelectionMode = false;
+ editor.$mouseHandler.$clickSelection = null;
+ editor.$blockScrolling--;
+ };
+
+ var onSelectionInterval = blockSelect;
+
+ event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
+ var timerId = setInterval(function() {onSelectionInterval();}, 20);
+
+ return e.preventDefault();
+ }
+}
+
+
+exports.onMouseDown = onMouseDown;
+
+});
+
+ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"], function(acequire, exports, module) {
+exports.defaultCommands = [{
+ name: "addCursorAbove",
+ exec: function(editor) { editor.selectMoreLines(-1); },
+ bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "addCursorBelow",
+ exec: function(editor) { editor.selectMoreLines(1); },
+ bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "addCursorAboveSkipCurrent",
+ exec: function(editor) { editor.selectMoreLines(-1, true); },
+ bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "addCursorBelowSkipCurrent",
+ exec: function(editor) { editor.selectMoreLines(1, true); },
+ bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectMoreBefore",
+ exec: function(editor) { editor.selectMore(-1); },
+ bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectMoreAfter",
+ exec: function(editor) { editor.selectMore(1); },
+ bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectNextBefore",
+ exec: function(editor) { editor.selectMore(-1, true); },
+ bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "selectNextAfter",
+ exec: function(editor) { editor.selectMore(1, true); },
+ bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}, {
+ name: "splitIntoLines",
+ exec: function(editor) { editor.multiSelect.splitIntoLines(); },
+ bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
+ readOnly: true
+}, {
+ name: "alignCursors",
+ exec: function(editor) { editor.alignCursors(); },
+ bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"},
+ scrollIntoView: "cursor"
+}, {
+ name: "findAll",
+ exec: function(editor) { editor.findAll(); },
+ bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
+ scrollIntoView: "cursor",
+ readOnly: true
+}];
+exports.multiSelectCommands = [{
+ name: "singleSelection",
+ bindKey: "esc",
+ exec: function(editor) { editor.exitMultiSelectMode(); },
+ scrollIntoView: "cursor",
+ readOnly: true,
+ isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
+}];
+
+var HashHandler = acequire("../keyboard/hash_handler").HashHandler;
+exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
+
+});
+
+ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"], function(acequire, exports, module) {
+
+var RangeList = acequire("./range_list").RangeList;
+var Range = acequire("./range").Range;
+var Selection = acequire("./selection").Selection;
+var onMouseDown = acequire("./mouse/multi_select_handler").onMouseDown;
+var event = acequire("./lib/event");
+var lang = acequire("./lib/lang");
+var commands = acequire("./commands/multi_select_commands");
+exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
+var Search = acequire("./search").Search;
+var search = new Search();
+
+function find(session, needle, dir) {
+ search.$options.wrap = true;
+ search.$options.needle = needle;
+ search.$options.backwards = dir == -1;
+ return search.find(session);
+}
+var EditSession = acequire("./edit_session").EditSession;
+(function() {
+ this.getSelectionMarkers = function() {
+ return this.$selectionMarkers;
+ };
+}).call(EditSession.prototype);
+(function() {
+ this.ranges = null;
+ this.rangeList = null;
+ this.addRange = function(range, $blockChangeEvents) {
+ if (!range)
+ return;
+
+ if (!this.inMultiSelectMode && this.rangeCount === 0) {
+ var oldRange = this.toOrientedRange();
+ this.rangeList.add(oldRange);
+ this.rangeList.add(range);
+ if (this.rangeList.ranges.length != 2) {
+ this.rangeList.removeAll();
+ return $blockChangeEvents || this.fromOrientedRange(range);
+ }
+ this.rangeList.removeAll();
+ this.rangeList.add(oldRange);
+ this.$onAddRange(oldRange);
+ }
+
+ if (!range.cursor)
+ range.cursor = range.end;
+
+ var removed = this.rangeList.add(range);
+
+ this.$onAddRange(range);
+
+ if (removed.length)
+ this.$onRemoveRange(removed);
+
+ if (this.rangeCount > 1 && !this.inMultiSelectMode) {
+ this._signal("multiSelect");
+ this.inMultiSelectMode = true;
+ this.session.$undoSelect = false;
+ this.rangeList.attach(this.session);
+ }
+
+ return $blockChangeEvents || this.fromOrientedRange(range);
+ };
+
+ this.toSingleRange = function(range) {
+ range = range || this.ranges[0];
+ var removed = this.rangeList.removeAll();
+ if (removed.length)
+ this.$onRemoveRange(removed);
+
+ range && this.fromOrientedRange(range);
+ };
+ this.substractPoint = function(pos) {
+ var removed = this.rangeList.substractPoint(pos);
+ if (removed) {
+ this.$onRemoveRange(removed);
+ return removed[0];
+ }
+ };
+ this.mergeOverlappingRanges = function() {
+ var removed = this.rangeList.merge();
+ if (removed.length)
+ this.$onRemoveRange(removed);
+ else if(this.ranges[0])
+ this.fromOrientedRange(this.ranges[0]);
+ };
+
+ this.$onAddRange = function(range) {
+ this.rangeCount = this.rangeList.ranges.length;
+ this.ranges.unshift(range);
+ this._signal("addRange", {range: range});
+ };
+
+ this.$onRemoveRange = function(removed) {
+ this.rangeCount = this.rangeList.ranges.length;
+ if (this.rangeCount == 1 && this.inMultiSelectMode) {
+ var lastRange = this.rangeList.ranges.pop();
+ removed.push(lastRange);
+ this.rangeCount = 0;
+ }
+
+ for (var i = removed.length; i--; ) {
+ var index = this.ranges.indexOf(removed[i]);
+ this.ranges.splice(index, 1);
+ }
+
+ this._signal("removeRange", {ranges: removed});
+
+ if (this.rangeCount === 0 && this.inMultiSelectMode) {
+ this.inMultiSelectMode = false;
+ this._signal("singleSelect");
+ this.session.$undoSelect = true;
+ this.rangeList.detach(this.session);
+ }
+
+ lastRange = lastRange || this.ranges[0];
+ if (lastRange && !lastRange.isEqual(this.getRange()))
+ this.fromOrientedRange(lastRange);
+ };
+ this.$initRangeList = function() {
+ if (this.rangeList)
+ return;
+
+ this.rangeList = new RangeList();
+ this.ranges = [];
+ this.rangeCount = 0;
+ };
+ this.getAllRanges = function() {
+ return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
+ };
+
+ this.splitIntoLines = function () {
+ if (this.rangeCount > 1) {
+ var ranges = this.rangeList.ranges;
+ var lastRange = ranges[ranges.length - 1];
+ var range = Range.fromPoints(ranges[0].start, lastRange.end);
+
+ this.toSingleRange();
+ this.setSelectionRange(range, lastRange.cursor == lastRange.start);
+ } else {
+ var range = this.getRange();
+ var isBackwards = this.isBackwards();
+ var startRow = range.start.row;
+ var endRow = range.end.row;
+ if (startRow == endRow) {
+ if (isBackwards)
+ var start = range.end, end = range.start;
+ else
+ var start = range.start, end = range.end;
+
+ this.addRange(Range.fromPoints(end, end));
+ this.addRange(Range.fromPoints(start, start));
+ return;
+ }
+
+ var rectSel = [];
+ var r = this.getLineRange(startRow, true);
+ r.start.column = range.start.column;
+ rectSel.push(r);
+
+ for (var i = startRow + 1; i < endRow; i++)
+ rectSel.push(this.getLineRange(i, true));
+
+ r = this.getLineRange(endRow, true);
+ r.end.column = range.end.column;
+ rectSel.push(r);
+
+ rectSel.forEach(this.addRange, this);
+ }
+ };
+ this.toggleBlockSelection = function () {
+ if (this.rangeCount > 1) {
+ var ranges = this.rangeList.ranges;
+ var lastRange = ranges[ranges.length - 1];
+ var range = Range.fromPoints(ranges[0].start, lastRange.end);
+
+ this.toSingleRange();
+ this.setSelectionRange(range, lastRange.cursor == lastRange.start);
+ } else {
+ var cursor = this.session.documentToScreenPosition(this.selectionLead);
+ var anchor = this.session.documentToScreenPosition(this.selectionAnchor);
+
+ var rectSel = this.rectangularRangeBlock(cursor, anchor);
+ rectSel.forEach(this.addRange, this);
+ }
+ };
+ this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
+ var rectSel = [];
+
+ var xBackwards = screenCursor.column < screenAnchor.column;
+ if (xBackwards) {
+ var startColumn = screenCursor.column;
+ var endColumn = screenAnchor.column;
+ } else {
+ var startColumn = screenAnchor.column;
+ var endColumn = screenCursor.column;
+ }
+
+ var yBackwards = screenCursor.row < screenAnchor.row;
+ if (yBackwards) {
+ var startRow = screenCursor.row;
+ var endRow = screenAnchor.row;
+ } else {
+ var startRow = screenAnchor.row;
+ var endRow = screenCursor.row;
+ }
+
+ if (startColumn < 0)
+ startColumn = 0;
+ if (startRow < 0)
+ startRow = 0;
+
+ if (startRow == endRow)
+ includeEmptyLines = true;
+
+ for (var row = startRow; row <= endRow; row++) {
+ var range = Range.fromPoints(
+ this.session.screenToDocumentPosition(row, startColumn),
+ this.session.screenToDocumentPosition(row, endColumn)
+ );
+ if (range.isEmpty()) {
+ if (docEnd && isSamePoint(range.end, docEnd))
+ break;
+ var docEnd = range.end;
+ }
+ range.cursor = xBackwards ? range.start : range.end;
+ rectSel.push(range);
+ }
+
+ if (yBackwards)
+ rectSel.reverse();
+
+ if (!includeEmptyLines) {
+ var end = rectSel.length - 1;
+ while (rectSel[end].isEmpty() && end > 0)
+ end--;
+ if (end > 0) {
+ var start = 0;
+ while (rectSel[start].isEmpty())
+ start++;
+ }
+ for (var i = end; i >= start; i--) {
+ if (rectSel[i].isEmpty())
+ rectSel.splice(i, 1);
+ }
+ }
+
+ return rectSel;
+ };
+}).call(Selection.prototype);
+var Editor = acequire("./editor").Editor;
+(function() {
+ this.updateSelectionMarkers = function() {
+ this.renderer.updateCursor();
+ this.renderer.updateBackMarkers();
+ };
+ this.addSelectionMarker = function(orientedRange) {
+ if (!orientedRange.cursor)
+ orientedRange.cursor = orientedRange.end;
+
+ var style = this.getSelectionStyle();
+ orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style);
+
+ this.session.$selectionMarkers.push(orientedRange);
+ this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
+ return orientedRange;
+ };
+ this.removeSelectionMarker = function(range) {
+ if (!range.marker)
+ return;
+ this.session.removeMarker(range.marker);
+ var index = this.session.$selectionMarkers.indexOf(range);
+ if (index != -1)
+ this.session.$selectionMarkers.splice(index, 1);
+ this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
+ };
+
+ this.removeSelectionMarkers = function(ranges) {
+ var markerList = this.session.$selectionMarkers;
+ for (var i = ranges.length; i--; ) {
+ var range = ranges[i];
+ if (!range.marker)
+ continue;
+ this.session.removeMarker(range.marker);
+ var index = markerList.indexOf(range);
+ if (index != -1)
+ markerList.splice(index, 1);
+ }
+ this.session.selectionMarkerCount = markerList.length;
+ };
+
+ this.$onAddRange = function(e) {
+ this.addSelectionMarker(e.range);
+ this.renderer.updateCursor();
+ this.renderer.updateBackMarkers();
+ };
+
+ this.$onRemoveRange = function(e) {
+ this.removeSelectionMarkers(e.ranges);
+ this.renderer.updateCursor();
+ this.renderer.updateBackMarkers();
+ };
+
+ this.$onMultiSelect = function(e) {
+ if (this.inMultiSelectMode)
+ return;
+ this.inMultiSelectMode = true;
+
+ this.setStyle("ace_multiselect");
+ this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
+ this.commands.setDefaultHandler("exec", this.$onMultiSelectExec);
+
+ this.renderer.updateCursor();
+ this.renderer.updateBackMarkers();
+ };
+
+ this.$onSingleSelect = function(e) {
+ if (this.session.multiSelect.inVirtualMode)
+ return;
+ this.inMultiSelectMode = false;
+
+ this.unsetStyle("ace_multiselect");
+ this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
+
+ this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec);
+ this.renderer.updateCursor();
+ this.renderer.updateBackMarkers();
+ this._emit("changeSelection");
+ };
+
+ this.$onMultiSelectExec = function(e) {
+ var command = e.command;
+ var editor = e.editor;
+ if (!editor.multiSelect)
+ return;
+ if (!command.multiSelectAction) {
+ var result = command.exec(editor, e.args || {});
+ editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
+ editor.multiSelect.mergeOverlappingRanges();
+ } else if (command.multiSelectAction == "forEach") {
+ result = editor.forEachSelection(command, e.args);
+ } else if (command.multiSelectAction == "forEachLine") {
+ result = editor.forEachSelection(command, e.args, true);
+ } else if (command.multiSelectAction == "single") {
+ editor.exitMultiSelectMode();
+ result = command.exec(editor, e.args || {});
+ } else {
+ result = command.multiSelectAction(editor, e.args || {});
+ }
+ return result;
+ };
+ this.forEachSelection = function(cmd, args, options) {
+ if (this.inVirtualSelectionMode)
+ return;
+ var keepOrder = options && options.keepOrder;
+ var $byLines = options == true || options && options.$byLines
+ var session = this.session;
+ var selection = this.selection;
+ var rangeList = selection.rangeList;
+ var ranges = (keepOrder ? selection : rangeList).ranges;
+ var result;
+
+ if (!ranges.length)
+ return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
+
+ var reg = selection._eventRegistry;
+ selection._eventRegistry = {};
+
+ var tmpSel = new Selection(session);
+ this.inVirtualSelectionMode = true;
+ for (var i = ranges.length; i--;) {
+ if ($byLines) {
+ while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row)
+ i--;
+ }
+ tmpSel.fromOrientedRange(ranges[i]);
+ tmpSel.index = i;
+ this.selection = session.selection = tmpSel;
+ var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
+ if (!result && cmdResult !== undefined)
+ result = cmdResult;
+ tmpSel.toOrientedRange(ranges[i]);
+ }
+ tmpSel.detach();
+
+ this.selection = session.selection = selection;
+ this.inVirtualSelectionMode = false;
+ selection._eventRegistry = reg;
+ selection.mergeOverlappingRanges();
+
+ var anim = this.renderer.$scrollAnimation;
+ this.onCursorChange();
+ this.onSelectionChange();
+ if (anim && anim.from == anim.to)
+ this.renderer.animateScrolling(anim.from);
+
+ return result;
+ };
+ this.exitMultiSelectMode = function() {
+ if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
+ return;
+ this.multiSelect.toSingleRange();
+ };
+
+ this.getSelectedText = function() {
+ var text = "";
+ if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
+ var ranges = this.multiSelect.rangeList.ranges;
+ var buf = [];
+ for (var i = 0; i < ranges.length; i++) {
+ buf.push(this.session.getTextRange(ranges[i]));
+ }
+ var nl = this.session.getDocument().getNewLineCharacter();
+ text = buf.join(nl);
+ if (text.length == (buf.length - 1) * nl.length)
+ text = "";
+ } else if (!this.selection.isEmpty()) {
+ text = this.session.getTextRange(this.getSelectionRange());
+ }
+ return text;
+ };
+
+ this.$checkMultiselectChange = function(e, anchor) {
+ if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
+ var range = this.multiSelect.ranges[0];
+ if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)
+ return;
+ var pos = anchor == this.multiSelect.anchor
+ ? range.cursor == range.start ? range.end : range.start
+ : range.cursor;
+ if (pos.row != anchor.row
+ || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)
+ this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
+ }
+ };
+ this.findAll = function(needle, options, additive) {
+ options = options || {};
+ options.needle = needle || options.needle;
+ if (options.needle == undefined) {
+ var range = this.selection.isEmpty()
+ ? this.selection.getWordRange()
+ : this.selection.getRange();
+ options.needle = this.session.getTextRange(range);
+ }
+ this.$search.set(options);
+
+ var ranges = this.$search.findAll(this.session);
+ if (!ranges.length)
+ return 0;
+
+ this.$blockScrolling += 1;
+ var selection = this.multiSelect;
+
+ if (!additive)
+ selection.toSingleRange(ranges[0]);
+
+ for (var i = ranges.length; i--; )
+ selection.addRange(ranges[i], true);
+ if (range && selection.rangeList.rangeAtPoint(range.start))
+ selection.addRange(range, true);
+
+ this.$blockScrolling -= 1;
+
+ return ranges.length;
+ };
+ this.selectMoreLines = function(dir, skip) {
+ var range = this.selection.toOrientedRange();
+ var isBackwards = range.cursor == range.end;
+
+ var screenLead = this.session.documentToScreenPosition(range.cursor);
+ if (this.selection.$desiredColumn)
+ screenLead.column = this.selection.$desiredColumn;
+
+ var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
+
+ if (!range.isEmpty()) {
+ var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);
+ var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
+ } else {
+ var anchor = lead;
+ }
+
+ if (isBackwards) {
+ var newRange = Range.fromPoints(lead, anchor);
+ newRange.cursor = newRange.start;
+ } else {
+ var newRange = Range.fromPoints(anchor, lead);
+ newRange.cursor = newRange.end;
+ }
+
+ newRange.desiredColumn = screenLead.column;
+ if (!this.selection.inMultiSelectMode) {
+ this.selection.addRange(range);
+ } else {
+ if (skip)
+ var toRemove = range.cursor;
+ }
+
+ this.selection.addRange(newRange);
+ if (toRemove)
+ this.selection.substractPoint(toRemove);
+ };
+ this.transposeSelections = function(dir) {
+ var session = this.session;
+ var sel = session.multiSelect;
+ var all = sel.ranges;
+
+ for (var i = all.length; i--; ) {
+ var range = all[i];
+ if (range.isEmpty()) {
+ var tmp = session.getWordRange(range.start.row, range.start.column);
+ range.start.row = tmp.start.row;
+ range.start.column = tmp.start.column;
+ range.end.row = tmp.end.row;
+ range.end.column = tmp.end.column;
+ }
+ }
+ sel.mergeOverlappingRanges();
+
+ var words = [];
+ for (var i = all.length; i--; ) {
+ var range = all[i];
+ words.unshift(session.getTextRange(range));
+ }
+
+ if (dir < 0)
+ words.unshift(words.pop());
+ else
+ words.push(words.shift());
+
+ for (var i = all.length; i--; ) {
+ var range = all[i];
+ var tmp = range.clone();
+ session.replace(range, words[i]);
+ range.start.row = tmp.start.row;
+ range.start.column = tmp.start.column;
+ }
+ };
+ this.selectMore = function(dir, skip, stopAtFirst) {
+ var session = this.session;
+ var sel = session.multiSelect;
+
+ var range = sel.toOrientedRange();
+ if (range.isEmpty()) {
+ range = session.getWordRange(range.start.row, range.start.column);
+ range.cursor = dir == -1 ? range.start : range.end;
+ this.multiSelect.addRange(range);
+ if (stopAtFirst)
+ return;
+ }
+ var needle = session.getTextRange(range);
+
+ var newRange = find(session, needle, dir);
+ if (newRange) {
+ newRange.cursor = dir == -1 ? newRange.start : newRange.end;
+ this.$blockScrolling += 1;
+ this.session.unfold(newRange);
+ this.multiSelect.addRange(newRange);
+ this.$blockScrolling -= 1;
+ this.renderer.scrollCursorIntoView(null, 0.5);
+ }
+ if (skip)
+ this.multiSelect.substractPoint(range.cursor);
+ };
+ this.alignCursors = function() {
+ var session = this.session;
+ var sel = session.multiSelect;
+ var ranges = sel.ranges;
+ var row = -1;
+ var sameRowRanges = ranges.filter(function(r) {
+ if (r.cursor.row == row)
+ return true;
+ row = r.cursor.row;
+ });
+
+ if (!ranges.length || sameRowRanges.length == ranges.length - 1) {
+ var range = this.selection.getRange();
+ var fr = range.start.row, lr = range.end.row;
+ var guessRange = fr == lr;
+ if (guessRange) {
+ var max = this.session.getLength();
+ var line;
+ do {
+ line = this.session.getLine(lr);
+ } while (/[=:]/.test(line) && ++lr < max);
+ do {
+ line = this.session.getLine(fr);
+ } while (/[=:]/.test(line) && --fr > 0);
+
+ if (fr < 0) fr = 0;
+ if (lr >= max) lr = max - 1;
+ }
+ var lines = this.session.removeFullLines(fr, lr);
+ lines = this.$reAlignText(lines, guessRange);
+ this.session.insert({row: fr, column: 0}, lines.join("\n") + "\n");
+ if (!guessRange) {
+ range.start.column = 0;
+ range.end.column = lines[lines.length - 1].length;
+ }
+ this.selection.setRange(range);
+ } else {
+ sameRowRanges.forEach(function(r) {
+ sel.substractPoint(r.cursor);
+ });
+
+ var maxCol = 0;
+ var minSpace = Infinity;
+ var spaceOffsets = ranges.map(function(r) {
+ var p = r.cursor;
+ var line = session.getLine(p.row);
+ var spaceOffset = line.substr(p.column).search(/\S/g);
+ if (spaceOffset == -1)
+ spaceOffset = 0;
+
+ if (p.column > maxCol)
+ maxCol = p.column;
+ if (spaceOffset < minSpace)
+ minSpace = spaceOffset;
+ return spaceOffset;
+ });
+ ranges.forEach(function(r, i) {
+ var p = r.cursor;
+ var l = maxCol - p.column;
+ var d = spaceOffsets[i] - minSpace;
+ if (l > d)
+ session.insert(p, lang.stringRepeat(" ", l - d));
+ else
+ session.remove(new Range(p.row, p.column, p.row, p.column - l + d));
+
+ r.start.column = r.end.column = maxCol;
+ r.start.row = r.end.row = p.row;
+ r.cursor = r.end;
+ });
+ sel.fromOrientedRange(ranges[0]);
+ this.renderer.updateCursor();
+ this.renderer.updateBackMarkers();
+ }
+ };
+
+ this.$reAlignText = function(lines, forceLeft) {
+ var isLeftAligned = true, isRightAligned = true;
+ var startW, textW, endW;
+
+ return lines.map(function(line) {
+ var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/);
+ if (!m)
+ return [line];
+
+ if (startW == null) {
+ startW = m[1].length;
+ textW = m[2].length;
+ endW = m[3].length;
+ return m;
+ }
+
+ if (startW + textW + endW != m[1].length + m[2].length + m[3].length)
+ isRightAligned = false;
+ if (startW != m[1].length)
+ isLeftAligned = false;
+
+ if (startW > m[1].length)
+ startW = m[1].length;
+ if (textW < m[2].length)
+ textW = m[2].length;
+ if (endW > m[3].length)
+ endW = m[3].length;
+
+ return m;
+ }).map(forceLeft ? alignLeft :
+ isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);
+
+ function spaces(n) {
+ return lang.stringRepeat(" ", n);
+ }
+
+ function alignLeft(m) {
+ return !m[2] ? m[0] : spaces(startW) + m[2]
+ + spaces(textW - m[2].length + endW)
+ + m[4].replace(/^([=:])\s+/, "$1 ");
+ }
+ function alignRight(m) {
+ return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2]
+ + spaces(endW, " ")
+ + m[4].replace(/^([=:])\s+/, "$1 ");
+ }
+ function unAlign(m) {
+ return !m[2] ? m[0] : spaces(startW) + m[2]
+ + spaces(endW)
+ + m[4].replace(/^([=:])\s+/, "$1 ");
+ }
+ };
+}).call(Editor.prototype);
+
+
+function isSamePoint(p1, p2) {
+ return p1.row == p2.row && p1.column == p2.column;
+}
+exports.onSessionChange = function(e) {
+ var session = e.session;
+ if (session && !session.multiSelect) {
+ session.$selectionMarkers = [];
+ session.selection.$initRangeList();
+ session.multiSelect = session.selection;
+ }
+ this.multiSelect = session && session.multiSelect;
+
+ var oldSession = e.oldSession;
+ if (oldSession) {
+ oldSession.multiSelect.off("addRange", this.$onAddRange);
+ oldSession.multiSelect.off("removeRange", this.$onRemoveRange);
+ oldSession.multiSelect.off("multiSelect", this.$onMultiSelect);
+ oldSession.multiSelect.off("singleSelect", this.$onSingleSelect);
+ oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange);
+ oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange);
+ }
+
+ if (session) {
+ session.multiSelect.on("addRange", this.$onAddRange);
+ session.multiSelect.on("removeRange", this.$onRemoveRange);
+ session.multiSelect.on("multiSelect", this.$onMultiSelect);
+ session.multiSelect.on("singleSelect", this.$onSingleSelect);
+ session.multiSelect.lead.on("change", this.$checkMultiselectChange);
+ session.multiSelect.anchor.on("change", this.$checkMultiselectChange);
+ }
+
+ if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {
+ if (session.selection.inMultiSelectMode)
+ this.$onMultiSelect();
+ else
+ this.$onSingleSelect();
+ }
+};
+function MultiSelect(editor) {
+ if (editor.$multiselectOnSessionChange)
+ return;
+ editor.$onAddRange = editor.$onAddRange.bind(editor);
+ editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
+ editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
+ editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
+ editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);
+ editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor);
+
+ editor.$multiselectOnSessionChange(editor);
+ editor.on("changeSession", editor.$multiselectOnSessionChange);
+
+ editor.on("mousedown", onMouseDown);
+ editor.commands.addCommands(commands.defaultCommands);
+
+ addAltCursorListeners(editor);
+}
+
+function addAltCursorListeners(editor){
+ var el = editor.textInput.getElement();
+ var altCursor = false;
+ event.addListener(el, "keydown", function(e) {
+ var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey);
+ if (editor.$blockSelectEnabled && altDown) {
+ if (!altCursor) {
+ editor.renderer.setMouseCursor("crosshair");
+ altCursor = true;
+ }
+ } else if (altCursor) {
+ reset();
+ }
+ });
+
+ event.addListener(el, "keyup", reset);
+ event.addListener(el, "blur", reset);
+ function reset(e) {
+ if (altCursor) {
+ editor.renderer.setMouseCursor("");
+ altCursor = false;
+ }
+ }
+}
+
+exports.MultiSelect = MultiSelect;
+
+
+acequire("./config").defineOptions(Editor.prototype, "editor", {
+ enableMultiselect: {
+ set: function(val) {
+ MultiSelect(this);
+ if (val) {
+ this.on("changeSession", this.$multiselectOnSessionChange);
+ this.on("mousedown", onMouseDown);
+ } else {
+ this.off("changeSession", this.$multiselectOnSessionChange);
+ this.off("mousedown", onMouseDown);
+ }
+ },
+ value: true
+ },
+ enableBlockSelect: {
+ set: function(val) {
+ this.$blockSelectEnabled = val;
+ },
+ value: true
+ }
+});
+
+
+
+});
+
+ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../../range").Range;
+
+var FoldMode = exports.FoldMode = function() {};
+
+(function() {
+
+ this.foldingStartMarker = null;
+ this.foldingStopMarker = null;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+ if (this.foldingStartMarker.test(line))
+ return "start";
+ if (foldStyle == "markbeginend"
+ && this.foldingStopMarker
+ && this.foldingStopMarker.test(line))
+ return "end";
+ return "";
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
+ return null;
+ };
+
+ this.indentationBlock = function(session, row, column) {
+ var re = /\S/;
+ var line = session.getLine(row);
+ var startLevel = line.search(re);
+ if (startLevel == -1)
+ return;
+
+ var startColumn = column || line.length;
+ var maxRow = session.getLength();
+ var startRow = row;
+ var endRow = row;
+
+ while (++row < maxRow) {
+ var level = session.getLine(row).search(re);
+
+ if (level == -1)
+ continue;
+
+ if (level <= startLevel)
+ break;
+
+ endRow = row;
+ }
+
+ if (endRow > startRow) {
+ var endColumn = session.getLine(endRow).length;
+ return new Range(startRow, startColumn, endRow, endColumn);
+ }
+ };
+
+ this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
+ var start = {row: row, column: column + 1};
+ var end = session.$findClosingBracket(bracket, start, typeRe);
+ if (!end)
+ return;
+
+ var fw = session.foldWidgets[end.row];
+ if (fw == null)
+ fw = session.getFoldWidget(end.row);
+
+ if (fw == "start" && end.row > start.row) {
+ end.row --;
+ end.column = session.getLine(end.row).length;
+ }
+ return Range.fromPoints(start, end);
+ };
+
+ this.closingBracketBlock = function(session, bracket, row, column, typeRe) {
+ var end = {row: row, column: column};
+ var start = session.$findOpeningBracket(bracket, end);
+
+ if (!start)
+ return;
+
+ start.column++;
+ end.column--;
+
+ return Range.fromPoints(start, end);
+ };
+}).call(FoldMode.prototype);
+
+});
+
+ace.define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
+"use strict";
+
+exports.isDark = false;
+exports.cssClass = "ace-tm";
+exports.cssText = ".ace-tm .ace_gutter {\
+background: #f0f0f0;\
+color: #333;\
+}\
+.ace-tm .ace_print-margin {\
+width: 1px;\
+background: #e8e8e8;\
+}\
+.ace-tm .ace_fold {\
+background-color: #6B72E6;\
+}\
+.ace-tm {\
+background-color: #FFFFFF;\
+color: black;\
+}\
+.ace-tm .ace_cursor {\
+color: black;\
+}\
+.ace-tm .ace_invisible {\
+color: rgb(191, 191, 191);\
+}\
+.ace-tm .ace_storage,\
+.ace-tm .ace_keyword {\
+color: blue;\
+}\
+.ace-tm .ace_constant {\
+color: rgb(197, 6, 11);\
+}\
+.ace-tm .ace_constant.ace_buildin {\
+color: rgb(88, 72, 246);\
+}\
+.ace-tm .ace_constant.ace_language {\
+color: rgb(88, 92, 246);\
+}\
+.ace-tm .ace_constant.ace_library {\
+color: rgb(6, 150, 14);\
+}\
+.ace-tm .ace_invalid {\
+background-color: rgba(255, 0, 0, 0.1);\
+color: red;\
+}\
+.ace-tm .ace_support.ace_function {\
+color: rgb(60, 76, 114);\
+}\
+.ace-tm .ace_support.ace_constant {\
+color: rgb(6, 150, 14);\
+}\
+.ace-tm .ace_support.ace_type,\
+.ace-tm .ace_support.ace_class {\
+color: rgb(109, 121, 222);\
+}\
+.ace-tm .ace_keyword.ace_operator {\
+color: rgb(104, 118, 135);\
+}\
+.ace-tm .ace_string {\
+color: rgb(3, 106, 7);\
+}\
+.ace-tm .ace_comment {\
+color: rgb(76, 136, 107);\
+}\
+.ace-tm .ace_comment.ace_doc {\
+color: rgb(0, 102, 255);\
+}\
+.ace-tm .ace_comment.ace_doc.ace_tag {\
+color: rgb(128, 159, 191);\
+}\
+.ace-tm .ace_constant.ace_numeric {\
+color: rgb(0, 0, 205);\
+}\
+.ace-tm .ace_variable {\
+color: rgb(49, 132, 149);\
+}\
+.ace-tm .ace_xml-pe {\
+color: rgb(104, 104, 91);\
+}\
+.ace-tm .ace_entity.ace_name.ace_function {\
+color: #0000A2;\
+}\
+.ace-tm .ace_heading {\
+color: rgb(12, 7, 255);\
+}\
+.ace-tm .ace_list {\
+color:rgb(185, 6, 144);\
+}\
+.ace-tm .ace_meta.ace_tag {\
+color:rgb(0, 22, 142);\
+}\
+.ace-tm .ace_string.ace_regex {\
+color: rgb(255, 0, 0)\
+}\
+.ace-tm .ace_marker-layer .ace_selection {\
+background: rgb(181, 213, 255);\
+}\
+.ace-tm.ace_multiselect .ace_selection.ace_start {\
+box-shadow: 0 0 3px 0px white;\
+}\
+.ace-tm .ace_marker-layer .ace_step {\
+background: rgb(252, 255, 0);\
+}\
+.ace-tm .ace_marker-layer .ace_stack {\
+background: rgb(164, 229, 101);\
+}\
+.ace-tm .ace_marker-layer .ace_bracket {\
+margin: -1px 0 0 -1px;\
+border: 1px solid rgb(192, 192, 192);\
+}\
+.ace-tm .ace_marker-layer .ace_active-line {\
+background: rgba(0, 0, 0, 0.07);\
+}\
+.ace-tm .ace_gutter-active-line {\
+background-color : #dcdcdc;\
+}\
+.ace-tm .ace_marker-layer .ace_selected-word {\
+background: rgb(250, 250, 255);\
+border: 1px solid rgb(200, 200, 250);\
+}\
+.ace-tm .ace_indent-guide {\
+background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
+}\
+";
+
+var dom = acequire("../lib/dom");
+dom.importCssString(exports.cssText, exports.cssClass);
+});
+
+ace.define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("./lib/oop");
+var dom = acequire("./lib/dom");
+var Range = acequire("./range").Range;
+
+
+function LineWidgets(session) {
+ this.session = session;
+ this.session.widgetManager = this;
+ this.session.getRowLength = this.getRowLength;
+ this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;
+ this.updateOnChange = this.updateOnChange.bind(this);
+ this.renderWidgets = this.renderWidgets.bind(this);
+ this.measureWidgets = this.measureWidgets.bind(this);
+ this.session._changedWidgets = [];
+ this.$onChangeEditor = this.$onChangeEditor.bind(this);
+
+ this.session.on("change", this.updateOnChange);
+ this.session.on("changeFold", this.updateOnFold);
+ this.session.on("changeEditor", this.$onChangeEditor);
+}
+
+(function() {
+ this.getRowLength = function(row) {
+ var h;
+ if (this.lineWidgets)
+ h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
+ else
+ h = 0;
+ if (!this.$useWrapMode || !this.$wrapData[row]) {
+ return 1 + h;
+ } else {
+ return this.$wrapData[row].length + 1 + h;
+ }
+ };
+
+ this.$getWidgetScreenLength = function() {
+ var screenRows = 0;
+ this.lineWidgets.forEach(function(w){
+ if (w && w.rowCount && !w.hidden)
+ screenRows += w.rowCount;
+ });
+ return screenRows;
+ };
+
+ this.$onChangeEditor = function(e) {
+ this.attach(e.editor);
+ };
+
+ this.attach = function(editor) {
+ if (editor && editor.widgetManager && editor.widgetManager != this)
+ editor.widgetManager.detach();
+
+ if (this.editor == editor)
+ return;
+
+ this.detach();
+ this.editor = editor;
+
+ if (editor) {
+ editor.widgetManager = this;
+ editor.renderer.on("beforeRender", this.measureWidgets);
+ editor.renderer.on("afterRender", this.renderWidgets);
+ }
+ };
+ this.detach = function(e) {
+ var editor = this.editor;
+ if (!editor)
+ return;
+
+ this.editor = null;
+ editor.widgetManager = null;
+
+ editor.renderer.off("beforeRender", this.measureWidgets);
+ editor.renderer.off("afterRender", this.renderWidgets);
+ var lineWidgets = this.session.lineWidgets;
+ lineWidgets && lineWidgets.forEach(function(w) {
+ if (w && w.el && w.el.parentNode) {
+ w._inDocument = false;
+ w.el.parentNode.removeChild(w.el);
+ }
+ });
+ };
+
+ this.updateOnFold = function(e, session) {
+ var lineWidgets = session.lineWidgets;
+ if (!lineWidgets || !e.action)
+ return;
+ var fold = e.data;
+ var start = fold.start.row;
+ var end = fold.end.row;
+ var hide = e.action == "add";
+ for (var i = start + 1; i < end; i++) {
+ if (lineWidgets[i])
+ lineWidgets[i].hidden = hide;
+ }
+ if (lineWidgets[end]) {
+ if (hide) {
+ if (!lineWidgets[start])
+ lineWidgets[start] = lineWidgets[end];
+ else
+ lineWidgets[end].hidden = hide;
+ } else {
+ if (lineWidgets[start] == lineWidgets[end])
+ lineWidgets[start] = undefined;
+ lineWidgets[end].hidden = hide;
+ }
+ }
+ };
+
+ this.updateOnChange = function(delta) {
+ var lineWidgets = this.session.lineWidgets;
+ if (!lineWidgets) return;
+
+ var startRow = delta.start.row;
+ var len = delta.end.row - startRow;
+
+ if (len === 0) {
+ } else if (delta.action == 'remove') {
+ var removed = lineWidgets.splice(startRow + 1, len);
+ removed.forEach(function(w) {
+ w && this.removeLineWidget(w);
+ }, this);
+ this.$updateRows();
+ } else {
+ var args = new Array(len);
+ args.unshift(startRow, 0);
+ lineWidgets.splice.apply(lineWidgets, args);
+ this.$updateRows();
+ }
+ };
+
+ this.$updateRows = function() {
+ var lineWidgets = this.session.lineWidgets;
+ if (!lineWidgets) return;
+ var noWidgets = true;
+ lineWidgets.forEach(function(w, i) {
+ if (w) {
+ noWidgets = false;
+ w.row = i;
+ while (w.$oldWidget) {
+ w.$oldWidget.row = i;
+ w = w.$oldWidget;
+ }
+ }
+ });
+ if (noWidgets)
+ this.session.lineWidgets = null;
+ };
+
+ this.addLineWidget = function(w) {
+ if (!this.session.lineWidgets)
+ this.session.lineWidgets = new Array(this.session.getLength());
+
+ var old = this.session.lineWidgets[w.row];
+ if (old) {
+ w.$oldWidget = old;
+ if (old.el && old.el.parentNode) {
+ old.el.parentNode.removeChild(old.el);
+ old._inDocument = false;
+ }
+ }
+
+ this.session.lineWidgets[w.row] = w;
+
+ w.session = this.session;
+
+ var renderer = this.editor.renderer;
+ if (w.html && !w.el) {
+ w.el = dom.createElement("div");
+ w.el.innerHTML = w.html;
+ }
+ if (w.el) {
+ dom.addCssClass(w.el, "ace_lineWidgetContainer");
+ w.el.style.position = "absolute";
+ w.el.style.zIndex = 5;
+ renderer.container.appendChild(w.el);
+ w._inDocument = true;
+ }
+
+ if (!w.coverGutter) {
+ w.el.style.zIndex = 3;
+ }
+ if (!w.pixelHeight) {
+ w.pixelHeight = w.el.offsetHeight;
+ }
+ if (w.rowCount == null) {
+ w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
+ }
+
+ var fold = this.session.getFoldAt(w.row, 0);
+ w.$fold = fold;
+ if (fold) {
+ var lineWidgets = this.session.lineWidgets;
+ if (w.row == fold.end.row && !lineWidgets[fold.start.row])
+ lineWidgets[fold.start.row] = w;
+ else
+ w.hidden = true;
+ }
+
+ this.session._emit("changeFold", {data:{start:{row: w.row}}});
+
+ this.$updateRows();
+ this.renderWidgets(null, renderer);
+ this.onWidgetChanged(w);
+ return w;
+ };
+
+ this.removeLineWidget = function(w) {
+ w._inDocument = false;
+ w.session = null;
+ if (w.el && w.el.parentNode)
+ w.el.parentNode.removeChild(w.el);
+ if (w.editor && w.editor.destroy) try {
+ w.editor.destroy();
+ } catch(e){}
+ if (this.session.lineWidgets) {
+ var w1 = this.session.lineWidgets[w.row]
+ if (w1 == w) {
+ this.session.lineWidgets[w.row] = w.$oldWidget;
+ if (w.$oldWidget)
+ this.onWidgetChanged(w.$oldWidget);
+ } else {
+ while (w1) {
+ if (w1.$oldWidget == w) {
+ w1.$oldWidget = w.$oldWidget;
+ break;
+ }
+ w1 = w1.$oldWidget;
+ }
+ }
+ }
+ this.session._emit("changeFold", {data:{start:{row: w.row}}});
+ this.$updateRows();
+ };
+
+ this.getWidgetsAtRow = function(row) {
+ var lineWidgets = this.session.lineWidgets;
+ var w = lineWidgets && lineWidgets[row];
+ var list = [];
+ while (w) {
+ list.push(w);
+ w = w.$oldWidget;
+ }
+ return list;
+ };
+
+ this.onWidgetChanged = function(w) {
+ this.session._changedWidgets.push(w);
+ this.editor && this.editor.renderer.updateFull();
+ };
+
+ this.measureWidgets = function(e, renderer) {
+ var changedWidgets = this.session._changedWidgets;
+ var config = renderer.layerConfig;
+
+ if (!changedWidgets || !changedWidgets.length) return;
+ var min = Infinity;
+ for (var i = 0; i < changedWidgets.length; i++) {
+ var w = changedWidgets[i];
+ if (!w || !w.el) continue;
+ if (w.session != this.session) continue;
+ if (!w._inDocument) {
+ if (this.session.lineWidgets[w.row] != w)
+ continue;
+ w._inDocument = true;
+ renderer.container.appendChild(w.el);
+ }
+
+ w.h = w.el.offsetHeight;
+
+ if (!w.fixedWidth) {
+ w.w = w.el.offsetWidth;
+ w.screenWidth = Math.ceil(w.w / config.characterWidth);
+ }
+
+ var rowCount = w.h / config.lineHeight;
+ if (w.coverLine) {
+ rowCount -= this.session.getRowLineCount(w.row);
+ if (rowCount < 0)
+ rowCount = 0;
+ }
+ if (w.rowCount != rowCount) {
+ w.rowCount = rowCount;
+ if (w.row < min)
+ min = w.row;
+ }
+ }
+ if (min != Infinity) {
+ this.session._emit("changeFold", {data:{start:{row: min}}});
+ this.session.lineWidgetWidth = null;
+ }
+ this.session._changedWidgets = [];
+ };
+
+ this.renderWidgets = function(e, renderer) {
+ var config = renderer.layerConfig;
+ var lineWidgets = this.session.lineWidgets;
+ if (!lineWidgets)
+ return;
+ var first = Math.min(this.firstRow, config.firstRow);
+ var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length);
+
+ while (first > 0 && !lineWidgets[first])
+ first--;
+
+ this.firstRow = config.firstRow;
+ this.lastRow = config.lastRow;
+
+ renderer.$cursorLayer.config = config;
+ for (var i = first; i <= last; i++) {
+ var w = lineWidgets[i];
+ if (!w || !w.el) continue;
+ if (w.hidden) {
+ w.el.style.top = -100 - (w.pixelHeight || 0) + "px";
+ continue;
+ }
+ if (!w._inDocument) {
+ w._inDocument = true;
+ renderer.container.appendChild(w.el);
+ }
+ var top = renderer.$cursorLayer.getPixelPosition({row: i, column:0}, true).top;
+ if (!w.coverLine)
+ top += config.lineHeight * this.session.getRowLineCount(w.row);
+ w.el.style.top = top - config.offset + "px";
+
+ var left = w.coverGutter ? 0 : renderer.gutterWidth;
+ if (!w.fixedWidth)
+ left -= renderer.scrollLeft;
+ w.el.style.left = left + "px";
+
+ if (w.fullWidth && w.screenWidth) {
+ w.el.style.minWidth = config.width + 2 * config.padding + "px";
+ }
+
+ if (w.fixedWidth) {
+ w.el.style.right = renderer.scrollBar.getWidth() + "px";
+ } else {
+ w.el.style.right = "";
+ }
+ }
+ };
+
+}).call(LineWidgets.prototype);
+
+
+exports.LineWidgets = LineWidgets;
+
+});
+
+ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"], function(acequire, exports, module) {
+"use strict";
+var LineWidgets = acequire("../line_widgets").LineWidgets;
+var dom = acequire("../lib/dom");
+var Range = acequire("../range").Range;
+
+function binarySearch(array, needle, comparator) {
+ var first = 0;
+ var last = array.length - 1;
+
+ while (first <= last) {
+ var mid = (first + last) >> 1;
+ var c = comparator(needle, array[mid]);
+ if (c > 0)
+ first = mid + 1;
+ else if (c < 0)
+ last = mid - 1;
+ else
+ return mid;
+ }
+ return -(first + 1);
+}
+
+function findAnnotations(session, row, dir) {
+ var annotations = session.getAnnotations().sort(Range.comparePoints);
+ if (!annotations.length)
+ return;
+
+ var i = binarySearch(annotations, {row: row, column: -1}, Range.comparePoints);
+ if (i < 0)
+ i = -i - 1;
+
+ if (i >= annotations.length)
+ i = dir > 0 ? 0 : annotations.length - 1;
+ else if (i === 0 && dir < 0)
+ i = annotations.length - 1;
+
+ var annotation = annotations[i];
+ if (!annotation || !dir)
+ return;
+
+ if (annotation.row === row) {
+ do {
+ annotation = annotations[i += dir];
+ } while (annotation && annotation.row === row);
+ if (!annotation)
+ return annotations.slice();
+ }
+
+
+ var matched = [];
+ row = annotation.row;
+ do {
+ matched[dir < 0 ? "unshift" : "push"](annotation);
+ annotation = annotations[i += dir];
+ } while (annotation && annotation.row == row);
+ return matched.length && matched;
+}
+
+exports.showErrorMarker = function(editor, dir) {
+ var session = editor.session;
+ if (!session.widgetManager) {
+ session.widgetManager = new LineWidgets(session);
+ session.widgetManager.attach(editor);
+ }
+
+ var pos = editor.getCursorPosition();
+ var row = pos.row;
+ var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w) {
+ return w.type == "errorMarker";
+ })[0];
+ if (oldWidget) {
+ oldWidget.destroy();
+ } else {
+ row -= dir;
+ }
+ var annotations = findAnnotations(session, row, dir);
+ var gutterAnno;
+ if (annotations) {
+ var annotation = annotations[0];
+ pos.column = (annotation.pos && typeof annotation.column != "number"
+ ? annotation.pos.sc
+ : annotation.column) || 0;
+ pos.row = annotation.row;
+ gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];
+ } else if (oldWidget) {
+ return;
+ } else {
+ gutterAnno = {
+ text: ["Looks good!"],
+ className: "ace_ok"
+ };
+ }
+ editor.session.unfold(pos.row);
+ editor.selection.moveToPosition(pos);
+
+ var w = {
+ row: pos.row,
+ fixedWidth: true,
+ coverGutter: true,
+ el: dom.createElement("div"),
+ type: "errorMarker"
+ };
+ var el = w.el.appendChild(dom.createElement("div"));
+ var arrow = w.el.appendChild(dom.createElement("div"));
+ arrow.className = "error_widget_arrow " + gutterAnno.className;
+
+ var left = editor.renderer.$cursorLayer
+ .getPixelPosition(pos).left;
+ arrow.style.left = left + editor.renderer.gutterWidth - 5 + "px";
+
+ w.el.className = "error_widget_wrapper";
+ el.className = "error_widget " + gutterAnno.className;
+ el.innerHTML = gutterAnno.text.join("
");
+
+ el.appendChild(dom.createElement("div"));
+
+ var kb = function(_, hashId, keyString) {
+ if (hashId === 0 && (keyString === "esc" || keyString === "return")) {
+ w.destroy();
+ return {command: "null"};
+ }
+ };
+
+ w.destroy = function() {
+ if (editor.$mouseHandler.isMousePressed)
+ return;
+ editor.keyBinding.removeKeyboardHandler(kb);
+ session.widgetManager.removeLineWidget(w);
+ editor.off("changeSelection", w.destroy);
+ editor.off("changeSession", w.destroy);
+ editor.off("mouseup", w.destroy);
+ editor.off("change", w.destroy);
+ };
+
+ editor.keyBinding.addKeyboardHandler(kb);
+ editor.on("changeSelection", w.destroy);
+ editor.on("changeSession", w.destroy);
+ editor.on("mouseup", w.destroy);
+ editor.on("change", w.destroy);
+
+ editor.session.widgetManager.addLineWidget(w);
+
+ w.el.onmousedown = editor.focus.bind(editor);
+
+ editor.renderer.scrollCursorIntoView(null, 0.5, {bottom: w.el.offsetHeight});
+};
+
+
+dom.importCssString("\
+ .error_widget_wrapper {\
+ background: inherit;\
+ color: inherit;\
+ border:none\
+ }\
+ .error_widget {\
+ border-top: solid 2px;\
+ border-bottom: solid 2px;\
+ margin: 5px 0;\
+ padding: 10px 40px;\
+ white-space: pre-wrap;\
+ }\
+ .error_widget.ace_error, .error_widget_arrow.ace_error{\
+ border-color: #ff5a5a\
+ }\
+ .error_widget.ace_warning, .error_widget_arrow.ace_warning{\
+ border-color: #F1D817\
+ }\
+ .error_widget.ace_info, .error_widget_arrow.ace_info{\
+ border-color: #5a5a5a\
+ }\
+ .error_widget.ace_ok, .error_widget_arrow.ace_ok{\
+ border-color: #5aaa5a\
+ }\
+ .error_widget_arrow {\
+ position: absolute;\
+ border: solid 5px;\
+ border-top-color: transparent!important;\
+ border-right-color: transparent!important;\
+ border-left-color: transparent!important;\
+ top: -5px;\
+ }\
+", "");
+
+});
+
+ace.define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"], function(acequire, exports, module) {
+"use strict";
+
+acequire("./lib/fixoldbrowsers");
+
+var dom = acequire("./lib/dom");
+var event = acequire("./lib/event");
+
+var Editor = acequire("./editor").Editor;
+var EditSession = acequire("./edit_session").EditSession;
+var UndoManager = acequire("./undomanager").UndoManager;
+var Renderer = acequire("./virtual_renderer").VirtualRenderer;
+acequire("./worker/worker_client");
+acequire("./keyboard/hash_handler");
+acequire("./placeholder");
+acequire("./multi_select");
+acequire("./mode/folding/fold_mode");
+acequire("./theme/textmate");
+acequire("./ext/error_marker");
+
+exports.config = acequire("./config");
+exports.acequire = acequire;
+exports.edit = function(el) {
+ if (typeof el == "string") {
+ var _id = el;
+ el = document.getElementById(_id);
+ if (!el)
+ throw new Error("ace.edit can't find div #" + _id);
+ }
+
+ if (el && el.env && el.env.editor instanceof Editor)
+ return el.env.editor;
+
+ var value = "";
+ if (el && /input|textarea/i.test(el.tagName)) {
+ var oldNode = el;
+ value = oldNode.value;
+ el = dom.createElement("pre");
+ oldNode.parentNode.replaceChild(el, oldNode);
+ } else if (el) {
+ value = dom.getInnerText(el);
+ el.innerHTML = "";
+ }
+
+ var doc = exports.createEditSession(value);
+
+ var editor = new Editor(new Renderer(el));
+ editor.setSession(doc);
+
+ var env = {
+ document: doc,
+ editor: editor,
+ onResize: editor.resize.bind(editor, null)
+ };
+ if (oldNode) env.textarea = oldNode;
+ event.addListener(window, "resize", env.onResize);
+ editor.on("destroy", function() {
+ event.removeListener(window, "resize", env.onResize);
+ env.editor.container.env = null; // prevent memory leak on old ie
+ });
+ editor.container.env = editor.env = env;
+ return editor;
+};
+exports.createEditSession = function(text, mode) {
+ var doc = new EditSession(text, mode);
+ doc.setUndoManager(new UndoManager());
+ return doc;
+}
+exports.EditSession = EditSession;
+exports.UndoManager = UndoManager;
+exports.version = "1.2.3";
+});
+ (function() {
+ ace.acequire(["ace/ace"], function(a) {
+ a && a.config.init(true);
+ if (!window.ace)
+ window.ace = a;
+ for (var key in a) if (a.hasOwnProperty(key))
+ window.ace[key] = a[key];
+ });
+ })();
+
+module.exports = window.ace.acequire("ace/ace");
+},{"w3c-blob":1442}],70:[function(require,module,exports){
+ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
+
+var DocCommentHighlightRules = function() {
+ this.$rules = {
+ "start" : [ {
+ token : "comment.doc.tag",
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
+ },
+ DocCommentHighlightRules.getTagRule(),
+ {
+ defaultToken : "comment.doc",
+ caseInsensitive: true
+ }]
+ };
+};
+
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
+
+DocCommentHighlightRules.getTagRule = function(start) {
+ return {
+ token : "comment.doc.tag.storage.type",
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
+ };
+}
+
+DocCommentHighlightRules.getStartRule = function(start) {
+ return {
+ token : "comment.doc", // doc comment
+ regex : "\\/\\*(?=\\*)",
+ next : start
+ };
+};
+
+DocCommentHighlightRules.getEndRule = function (start) {
+ return {
+ token : "comment.doc", // closing comment
+ regex : "\\*\\/",
+ next : start
+ };
+};
+
+
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
+
+});
+
+ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
+var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
+
+var JavaScriptHighlightRules = function(options) {
+ var keywordMapper = this.createKeywordMapper({
+ "variable.language":
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
+ "Namespace|QName|XML|XMLList|" + // E4X
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
+ "SyntaxError|TypeError|URIError|" +
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
+ "isNaN|parseFloat|parseInt|" +
+ "JSON|Math|" + // Other
+ "this|arguments|prototype|window|document" , // Pseudo
+ "keyword":
+ "const|yield|import|get|set|" +
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
+ "storage.type":
+ "const|let|var|function",
+ "constant.language":
+ "null|Infinity|NaN|undefined",
+ "support.function":
+ "alert",
+ "constant.language.boolean": "true|false"
+ }, "identifier");
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
+
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
+ "u[0-9a-fA-F]{4}|" + // unicode
+ "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
+ "[0-2][0-7]{0,2}|" + // oct
+ "3[0-7][0-7]?|" + // oct
+ "[4-7][0-7]?|" + //oct
+ ".)";
+
+ this.$rules = {
+ "no_regex" : [
+ DocCommentHighlightRules.getStartRule("doc-start"),
+ comments("no_regex"),
+ {
+ token : "string",
+ regex : "'(?=.)",
+ next : "qstring"
+ }, {
+ token : "string",
+ regex : '"(?=.)',
+ next : "qqstring"
+ }, {
+ token : "constant.numeric", // hex
+ regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/
+ }, {
+ token : "constant.numeric", // float
+ regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "support.function",
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
+ next: "function_arguments"
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
+ "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
+ "keyword.operator", "text",
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+ ],
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "entity.name.function", "text", "punctuation.operator",
+ "text", "storage.type", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "text", "text", "storage.type", "text", "paren.lparen"
+ ],
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : "keyword",
+ regex : "(?:" + kwBeforeRe + ")\\b",
+ next : "start"
+ }, {
+ token : ["support.constant"],
+ regex : /that\b/
+ }, {
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
+ }, {
+ token : keywordMapper,
+ regex : identifierRe
+ }, {
+ token : "punctuation.operator",
+ regex : /[.](?![.])/,
+ next : "property"
+ }, {
+ token : "keyword.operator",
+ regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
+ next : "start"
+ }, {
+ token : "punctuation.operator",
+ regex : /[?:,;.]/,
+ next : "start"
+ }, {
+ token : "paren.lparen",
+ regex : /[\[({]/,
+ next : "start"
+ }, {
+ token : "paren.rparen",
+ regex : /[\])}]/
+ }, {
+ token: "comment",
+ regex: /^#!.*$/
+ }
+ ],
+ property: [{
+ token : "text",
+ regex : "\\s+"
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
+ "keyword.operator", "text",
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : "punctuation.operator",
+ regex : /[.](?![.])/
+ }, {
+ token : "support.function",
+ regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
+ }, {
+ token : "support.function.dom",
+ regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
+ }, {
+ token : "support.constant",
+ regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
+ }, {
+ token : "identifier",
+ regex : identifierRe
+ }, {
+ regex: "",
+ token: "empty",
+ next: "no_regex"
+ }
+ ],
+ "start": [
+ DocCommentHighlightRules.getStartRule("doc-start"),
+ comments("start"),
+ {
+ token: "string.regexp",
+ regex: "\\/",
+ next: "regex"
+ }, {
+ token : "text",
+ regex : "\\s+|^$",
+ next : "start"
+ }, {
+ token: "empty",
+ regex: "",
+ next: "no_regex"
+ }
+ ],
+ "regex": [
+ {
+ token: "regexp.keyword.operator",
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
+ }, {
+ token: "string.regexp",
+ regex: "/[sxngimy]*",
+ next: "no_regex"
+ }, {
+ token : "invalid",
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
+ }, {
+ token : "constant.language.escape",
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
+ }, {
+ token : "constant.language.delimiter",
+ regex: /\|/
+ }, {
+ token: "constant.language.escape",
+ regex: /\[\^?/,
+ next: "regex_character_class"
+ }, {
+ token: "empty",
+ regex: "$",
+ next: "no_regex"
+ }, {
+ defaultToken: "string.regexp"
+ }
+ ],
+ "regex_character_class": [
+ {
+ token: "regexp.charclass.keyword.operator",
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
+ }, {
+ token: "constant.language.escape",
+ regex: "]",
+ next: "regex"
+ }, {
+ token: "constant.language.escape",
+ regex: "-"
+ }, {
+ token: "empty",
+ regex: "$",
+ next: "no_regex"
+ }, {
+ defaultToken: "string.regexp.charachterclass"
+ }
+ ],
+ "function_arguments": [
+ {
+ token: "variable.parameter",
+ regex: identifierRe
+ }, {
+ token: "punctuation.operator",
+ regex: "[, ]+"
+ }, {
+ token: "punctuation.operator",
+ regex: "$"
+ }, {
+ token: "empty",
+ regex: "",
+ next: "no_regex"
+ }
+ ],
+ "qqstring" : [
+ {
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "string",
+ regex : "\\\\$",
+ next : "qqstring"
+ }, {
+ token : "string",
+ regex : '"|$',
+ next : "no_regex"
+ }, {
+ defaultToken: "string"
+ }
+ ],
+ "qstring" : [
+ {
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "string",
+ regex : "\\\\$",
+ next : "qstring"
+ }, {
+ token : "string",
+ regex : "'|$",
+ next : "no_regex"
+ }, {
+ defaultToken: "string"
+ }
+ ]
+ };
+
+
+ if (!options || !options.noES6) {
+ this.$rules.no_regex.unshift({
+ regex: "[{}]", onMatch: function(val, state, stack) {
+ this.next = val == "{" ? this.nextState : "";
+ if (val == "{" && stack.length) {
+ stack.unshift("start", state);
+ }
+ else if (val == "}" && stack.length) {
+ stack.shift();
+ this.next = stack.shift();
+ if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
+ return "paren.quasi.end";
+ }
+ return val == "{" ? "paren.lparen" : "paren.rparen";
+ },
+ nextState: "start"
+ }, {
+ token : "string.quasi.start",
+ regex : /`/,
+ push : [{
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "paren.quasi.start",
+ regex : /\${/,
+ push : "start"
+ }, {
+ token : "string.quasi.end",
+ regex : /`/,
+ next : "pop"
+ }, {
+ defaultToken: "string.quasi"
+ }]
+ });
+
+ if (!options || !options.noJSX)
+ JSX.call(this);
+ }
+
+ this.embedRules(DocCommentHighlightRules, "doc-",
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
+
+ this.normalizeRules();
+};
+
+oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
+
+function JSX() {
+ var tagRegex = identifierRe.replace("\\d", "\\d\\-");
+ var jsxTag = {
+ onMatch : function(val, state, stack) {
+ var offset = val.charAt(1) == "/" ? 2 : 1;
+ if (offset == 1) {
+ if (state != this.nextState)
+ stack.unshift(this.next, this.nextState, 0);
+ else
+ stack.unshift(this.next);
+ stack[2]++;
+ } else if (offset == 2) {
+ if (state == this.nextState) {
+ stack[1]--;
+ if (!stack[1] || stack[1] < 0) {
+ stack.shift();
+ stack.shift();
+ }
+ }
+ }
+ return [{
+ type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
+ value: val.slice(0, offset)
+ }, {
+ type: "meta.tag.tag-name.xml",
+ value: val.substr(offset)
+ }];
+ },
+ regex : "?" + tagRegex + "",
+ next: "jsxAttributes",
+ nextState: "jsx"
+ };
+ this.$rules.start.unshift(jsxTag);
+ var jsxJsRule = {
+ regex: "{",
+ token: "paren.quasi.start",
+ push: "start"
+ };
+ this.$rules.jsx = [
+ jsxJsRule,
+ jsxTag,
+ {include : "reference"},
+ {defaultToken: "string"}
+ ];
+ this.$rules.jsxAttributes = [{
+ token : "meta.tag.punctuation.tag-close.xml",
+ regex : "/?>",
+ onMatch : function(value, currentState, stack) {
+ if (currentState == stack[0])
+ stack.shift();
+ if (value.length == 2) {
+ if (stack[0] == this.nextState)
+ stack[1]--;
+ if (!stack[1] || stack[1] < 0) {
+ stack.splice(0, 2);
+ }
+ }
+ this.next = stack[0] || "start";
+ return [{type: this.token, value: value}];
+ },
+ nextState: "jsx"
+ },
+ jsxJsRule,
+ comments("jsxAttributes"),
+ {
+ token : "entity.other.attribute-name.xml",
+ regex : tagRegex
+ }, {
+ token : "keyword.operator.attribute-equals.xml",
+ regex : "="
+ }, {
+ token : "text.tag-whitespace.xml",
+ regex : "\\s+"
+ }, {
+ token : "string.attribute-value.xml",
+ regex : "'",
+ stateName : "jsx_attr_q",
+ push : [
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
+ {include : "reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ }, {
+ token : "string.attribute-value.xml",
+ regex : '"',
+ stateName : "jsx_attr_qq",
+ push : [
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
+ {include : "reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ },
+ jsxTag
+ ];
+ this.$rules.reference = [{
+ token : "constant.language.escape.reference.xml",
+ regex : "(?:[0-9]+;)|(?:[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
+ }];
+}
+
+function comments(next) {
+ return [
+ {
+ token : "comment", // multi line comment
+ regex : /\/\*/,
+ next: [
+ DocCommentHighlightRules.getTagRule(),
+ {token : "comment", regex : "\\*\\/", next : next || "pop"},
+ {defaultToken : "comment", caseInsensitive: true}
+ ]
+ }, {
+ token : "comment",
+ regex : "\\/\\/",
+ next: [
+ DocCommentHighlightRules.getTagRule(),
+ {token : "comment", regex : "$|^", next : next || "pop"},
+ {defaultToken : "comment", caseInsensitive: true}
+ ]
+ }
+ ];
+}
+exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
+});
+
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+ this.checkOutdent = function(line, input) {
+ if (! /^\s+$/.test(line))
+ return false;
+
+ return /^\s*\}/.test(input);
+ };
+
+ this.autoOutdent = function(doc, row) {
+ var line = doc.getLine(row);
+ var match = line.match(/^(\s*\})/);
+
+ if (!match) return 0;
+
+ var column = match[1].length;
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+ if (!openBracePos || openBracePos.row == row) return 0;
+
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
+ doc.replace(new Range(row, 0, row, column-1), indent);
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});
+
+ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../../lib/oop");
+var Behaviour = acequire("../behaviour").Behaviour;
+var TokenIterator = acequire("../../token_iterator").TokenIterator;
+var lang = acequire("../../lib/lang");
+
+var SAFE_INSERT_IN_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator"];
+var SAFE_INSERT_BEFORE_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
+
+var context;
+var contextCache = {};
+var initContext = function(editor) {
+ var id = -1;
+ if (editor.multiSelect) {
+ id = editor.selection.index;
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
+ }
+ if (contextCache[id])
+ return context = contextCache[id];
+ context = contextCache[id] = {
+ autoInsertedBrackets: 0,
+ autoInsertedRow: -1,
+ autoInsertedLineEnd: "",
+ maybeInsertedBrackets: 0,
+ maybeInsertedRow: -1,
+ maybeInsertedLineStart: "",
+ maybeInsertedLineEnd: ""
+ };
+};
+
+var getWrapped = function(selection, selected, opening, closing) {
+ var rowDiff = selection.end.row - selection.start.row;
+ return {
+ text: opening + selected + closing,
+ selection: [
+ 0,
+ selection.start.column + 1,
+ rowDiff,
+ selection.end.column + (rowDiff ? 0 : 1)
+ ]
+ };
+};
+
+var CstyleBehaviour = function() {
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (text == '{') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, '{', '}');
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
+ return {
+ text: '{}',
+ selection: [1, 1]
+ };
+ } else {
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
+ return {
+ text: '{',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == '}') {
+ initContext(editor);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == '}') {
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == "\n" || text == "\r\n") {
+ initContext(editor);
+ var closing = "";
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar === '}') {
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
+ if (!openBracePos)
+ return null;
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
+ } else if (closing) {
+ var next_indent = this.$getIndent(line);
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ return;
+ }
+ var indent = next_indent + session.getTabString();
+
+ return {
+ text: '\n' + indent + '\n' + next_indent + closing,
+ selection: [1, indent.length, 1, indent.length]
+ };
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ });
+
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '{') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
+ if (rightChar == '}') {
+ range.end.column++;
+ return range;
+ } else {
+ context.maybeInsertedBrackets--;
+ }
+ }
+ });
+
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
+ if (text == '(') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, '(', ')');
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
+ return {
+ text: '()',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ')') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ')') {
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '(') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ')') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
+ if (text == '[') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, '[', ']');
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
+ return {
+ text: '[]',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ']') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ']') {
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '[') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ']') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
+ if (text == '"' || text == "'") {
+ initContext(editor);
+ var quote = text;
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, quote, quote);
+ } else if (!selected) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var leftChar = line.substring(cursor.column-1, cursor.column);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+
+ var token = session.getTokenAt(cursor.row, cursor.column);
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
+ if (leftChar == "\\" && token && /escape/.test(token.type))
+ return null;
+
+ var stringBefore = token && /string|escape/.test(token.type);
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
+
+ var pair;
+ if (rightChar == quote) {
+ pair = stringBefore !== stringAfter;
+ } else {
+ if (stringBefore && !stringAfter)
+ return null; // wrap string with different quote
+ if (stringBefore && stringAfter)
+ return null; // do not pair quotes inside strings
+ var wordRe = session.$mode.tokenRe;
+ wordRe.lastIndex = 0;
+ var isWordBefore = wordRe.test(leftChar);
+ wordRe.lastIndex = 0;
+ var isWordAfter = wordRe.test(leftChar);
+ if (isWordBefore || isWordAfter)
+ return null; // before or after alphanumeric
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
+ return null; // there is rightChar and it isn't closing
+ pair = true;
+ }
+ return {
+ text: pair ? quote + quote : "",
+ selection: [1,1]
+ };
+ }
+ }
+ });
+
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == selected) {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+};
+
+
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
+ var cursor = editor.getCursorPosition();
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
+ return false;
+ }
+ iterator.stepForward();
+ return iterator.getCurrentTokenRow() !== cursor.row ||
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
+};
+
+CstyleBehaviour.$matchTokenType = function(token, types) {
+ return types.indexOf(token.type || token) > -1;
+};
+
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
+ context.autoInsertedBrackets = 0;
+ context.autoInsertedRow = cursor.row;
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
+ context.autoInsertedBrackets++;
+};
+
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isMaybeInsertedClosing(cursor, line))
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = cursor.row;
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
+ context.maybeInsertedBrackets++;
+};
+
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
+ return context.autoInsertedBrackets > 0 &&
+ cursor.row === context.autoInsertedRow &&
+ bracket === context.autoInsertedLineEnd[0] &&
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
+};
+
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
+ return context.maybeInsertedBrackets > 0 &&
+ cursor.row === context.maybeInsertedRow &&
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
+};
+
+CstyleBehaviour.popAutoInsertedClosing = function() {
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
+ context.autoInsertedBrackets--;
+};
+
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
+ if (context) {
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = -1;
+ }
+};
+
+
+
+oop.inherits(CstyleBehaviour, Behaviour);
+
+exports.CstyleBehaviour = CstyleBehaviour;
+});
+
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../../lib/oop");
+var Range = acequire("../../range").Range;
+var BaseFoldMode = acequire("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
+ this._getFoldWidgetBase = this.getFoldWidget;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+
+ if (this.singleLineBlockCommentRe.test(line)) {
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
+ return "";
+ }
+
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
+
+ if (!fw && this.startRegionRe.test(line))
+ return "start"; // lineCommentRegionStart
+
+ return fw;
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+
+ if (this.startRegionRe.test(line))
+ return this.getCommentRegionBlock(session, line, row);
+
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+ this.getCommentRegionBlock = function(session, line, row) {
+ var startColumn = line.search(/\s*$/);
+ var maxRow = session.getLength();
+ var startRow = row;
+
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
+ var depth = 1;
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var m = re.exec(line);
+ if (!m) continue;
+ if (m[1]) depth--;
+ else depth++;
+
+ if (!depth) break;
+ }
+
+ var endRow = row;
+ if (endRow > startRow) {
+ return new Range(startRow, startColumn, endRow, line.length);
+ }
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var TextMode = acequire("./text").Mode;
+var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
+var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = acequire("../range").Range;
+var WorkerClient = acequire("../worker/worker_client").WorkerClient;
+var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = JavaScriptHighlightRules;
+
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "//";
+ this.blockComment = {start: "/*", end: "*/"};
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+ var endState = tokenizedLine.state;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start" || state == "no_regex") {
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ } else if (state == "doc-start") {
+ if (endState == "start" || endState == "no_regex") {
+ return "";
+ }
+ var match = line.match(/^\s*(\/?)\*/);
+ if (match) {
+ if (match[1]) {
+ indent += " ";
+ }
+ indent += "* ";
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.createWorker = function(session) {
+ var worker = new WorkerClient(["ace"], require("../worker/javascript"), "JavaScriptWorker");
+ worker.attachToDocument(session.getDocument());
+
+ worker.on("annotate", function(results) {
+ session.setAnnotations(results.data);
+ });
+
+ worker.on("terminate", function() {
+ session.clearAnnotations();
+ });
+
+ return worker;
+ };
+
+ this.$id = "ace/mode/javascript";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+},{"../worker/javascript":74}],71:[function(require,module,exports){
+ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
+
+var JsonHighlightRules = function() {
+ this.$rules = {
+ "start" : [
+ {
+ token : "variable", // single line
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
+ }, {
+ token : "string", // single line
+ regex : '"',
+ next : "string"
+ }, {
+ token : "constant.numeric", // hex
+ regex : "0[xX][0-9a-fA-F]+\\b"
+ }, {
+ token : "constant.numeric", // float
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+ }, {
+ token : "constant.language.boolean",
+ regex : "(?:true|false)\\b"
+ }, {
+ token : "invalid.illegal", // single quoted strings are not allowed
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+ }, {
+ token : "invalid.illegal", // comments are not allowed
+ regex : "\\/\\/.*$"
+ }, {
+ token : "paren.lparen",
+ regex : "[[({]"
+ }, {
+ token : "paren.rparen",
+ regex : "[\\])}]"
+ }, {
+ token : "text",
+ regex : "\\s+"
+ }
+ ],
+ "string" : [
+ {
+ token : "constant.language.escape",
+ regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
+ }, {
+ token : "string",
+ regex : '[^"\\\\]+'
+ }, {
+ token : "string",
+ regex : '"',
+ next : "start"
+ }, {
+ token : "string",
+ regex : "",
+ next : "start"
+ }
+ ]
+ };
+
+};
+
+oop.inherits(JsonHighlightRules, TextHighlightRules);
+
+exports.JsonHighlightRules = JsonHighlightRules;
+});
+
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var Range = acequire("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+ this.checkOutdent = function(line, input) {
+ if (! /^\s+$/.test(line))
+ return false;
+
+ return /^\s*\}/.test(input);
+ };
+
+ this.autoOutdent = function(doc, row) {
+ var line = doc.getLine(row);
+ var match = line.match(/^(\s*\})/);
+
+ if (!match) return 0;
+
+ var column = match[1].length;
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+ if (!openBracePos || openBracePos.row == row) return 0;
+
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
+ doc.replace(new Range(row, 0, row, column-1), indent);
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});
+
+ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../../lib/oop");
+var Behaviour = acequire("../behaviour").Behaviour;
+var TokenIterator = acequire("../../token_iterator").TokenIterator;
+var lang = acequire("../../lib/lang");
+
+var SAFE_INSERT_IN_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator"];
+var SAFE_INSERT_BEFORE_TOKENS =
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
+
+var context;
+var contextCache = {};
+var initContext = function(editor) {
+ var id = -1;
+ if (editor.multiSelect) {
+ id = editor.selection.index;
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
+ }
+ if (contextCache[id])
+ return context = contextCache[id];
+ context = contextCache[id] = {
+ autoInsertedBrackets: 0,
+ autoInsertedRow: -1,
+ autoInsertedLineEnd: "",
+ maybeInsertedBrackets: 0,
+ maybeInsertedRow: -1,
+ maybeInsertedLineStart: "",
+ maybeInsertedLineEnd: ""
+ };
+};
+
+var getWrapped = function(selection, selected, opening, closing) {
+ var rowDiff = selection.end.row - selection.start.row;
+ return {
+ text: opening + selected + closing,
+ selection: [
+ 0,
+ selection.start.column + 1,
+ rowDiff,
+ selection.end.column + (rowDiff ? 0 : 1)
+ ]
+ };
+};
+
+var CstyleBehaviour = function() {
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (text == '{') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, '{', '}');
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
+ return {
+ text: '{}',
+ selection: [1, 1]
+ };
+ } else {
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
+ return {
+ text: '{',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == '}') {
+ initContext(editor);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == '}') {
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ } else if (text == "\n" || text == "\r\n") {
+ initContext(editor);
+ var closing = "";
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar === '}') {
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
+ if (!openBracePos)
+ return null;
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
+ } else if (closing) {
+ var next_indent = this.$getIndent(line);
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ return;
+ }
+ var indent = next_indent + session.getTabString();
+
+ return {
+ text: '\n' + indent + '\n' + next_indent + closing,
+ selection: [1, indent.length, 1, indent.length]
+ };
+ } else {
+ CstyleBehaviour.clearMaybeInsertedClosing();
+ }
+ });
+
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '{') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
+ if (rightChar == '}') {
+ range.end.column++;
+ return range;
+ } else {
+ context.maybeInsertedBrackets--;
+ }
+ }
+ });
+
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
+ if (text == '(') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, '(', ')');
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
+ return {
+ text: '()',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ')') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ')') {
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '(') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ')') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
+ if (text == '[') {
+ initContext(editor);
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, '[', ']');
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
+ return {
+ text: '[]',
+ selection: [1, 1]
+ };
+ }
+ } else if (text == ']') {
+ initContext(editor);
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar == ']') {
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+ CstyleBehaviour.popAutoInsertedClosing();
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected == '[') {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == ']') {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
+ if (text == '"' || text == "'") {
+ initContext(editor);
+ var quote = text;
+ var selection = editor.getSelectionRange();
+ var selected = session.doc.getTextRange(selection);
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
+ return getWrapped(selection, selected, quote, quote);
+ } else if (!selected) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var leftChar = line.substring(cursor.column-1, cursor.column);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+
+ var token = session.getTokenAt(cursor.row, cursor.column);
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
+ if (leftChar == "\\" && token && /escape/.test(token.type))
+ return null;
+
+ var stringBefore = token && /string|escape/.test(token.type);
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
+
+ var pair;
+ if (rightChar == quote) {
+ pair = stringBefore !== stringAfter;
+ } else {
+ if (stringBefore && !stringAfter)
+ return null; // wrap string with different quote
+ if (stringBefore && stringAfter)
+ return null; // do not pair quotes inside strings
+ var wordRe = session.$mode.tokenRe;
+ wordRe.lastIndex = 0;
+ var isWordBefore = wordRe.test(leftChar);
+ wordRe.lastIndex = 0;
+ var isWordAfter = wordRe.test(leftChar);
+ if (isWordBefore || isWordAfter)
+ return null; // before or after alphanumeric
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
+ return null; // there is rightChar and it isn't closing
+ pair = true;
+ }
+ return {
+ text: pair ? quote + quote : "",
+ selection: [1,1]
+ };
+ }
+ }
+ });
+
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
+ initContext(editor);
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == selected) {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+};
+
+
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
+ var cursor = editor.getCursorPosition();
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
+ return false;
+ }
+ iterator.stepForward();
+ return iterator.getCurrentTokenRow() !== cursor.row ||
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
+};
+
+CstyleBehaviour.$matchTokenType = function(token, types) {
+ return types.indexOf(token.type || token) > -1;
+};
+
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
+ context.autoInsertedBrackets = 0;
+ context.autoInsertedRow = cursor.row;
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
+ context.autoInsertedBrackets++;
+};
+
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ if (!this.isMaybeInsertedClosing(cursor, line))
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = cursor.row;
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
+ context.maybeInsertedBrackets++;
+};
+
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
+ return context.autoInsertedBrackets > 0 &&
+ cursor.row === context.autoInsertedRow &&
+ bracket === context.autoInsertedLineEnd[0] &&
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
+};
+
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
+ return context.maybeInsertedBrackets > 0 &&
+ cursor.row === context.maybeInsertedRow &&
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
+};
+
+CstyleBehaviour.popAutoInsertedClosing = function() {
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
+ context.autoInsertedBrackets--;
+};
+
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
+ if (context) {
+ context.maybeInsertedBrackets = 0;
+ context.maybeInsertedRow = -1;
+ }
+};
+
+
+
+oop.inherits(CstyleBehaviour, Behaviour);
+
+exports.CstyleBehaviour = CstyleBehaviour;
+});
+
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../../lib/oop");
+var Range = acequire("../../range").Range;
+var BaseFoldMode = acequire("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
+ this._getFoldWidgetBase = this.getFoldWidget;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+
+ if (this.singleLineBlockCommentRe.test(line)) {
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
+ return "";
+ }
+
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
+
+ if (!fw && this.startRegionRe.test(line))
+ return "start"; // lineCommentRegionStart
+
+ return fw;
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+
+ if (this.startRegionRe.test(line))
+ return this.getCommentRegionBlock(session, line, row);
+
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+ this.getCommentRegionBlock = function(session, line, row) {
+ var startColumn = line.search(/\s*$/);
+ var maxRow = session.getLength();
+ var startRow = row;
+
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
+ var depth = 1;
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var m = re.exec(line);
+ if (!m) continue;
+ if (m[1]) depth--;
+ else depth++;
+
+ if (!depth) break;
+ }
+
+ var endRow = row;
+ if (endRow > startRow) {
+ return new Range(startRow, startColumn, endRow, line.length);
+ }
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var TextMode = acequire("./text").Mode;
+var HighlightRules = acequire("./json_highlight_rules").JsonHighlightRules;
+var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
+var WorkerClient = acequire("../worker/worker_client").WorkerClient;
+
+var Mode = function() {
+ this.HighlightRules = HighlightRules;
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ if (state == "start") {
+ var match = line.match(/^.*[\{\(\[]\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.createWorker = function(session) {
+ var worker = new WorkerClient(["ace"], require("../worker/json"), "JsonWorker");
+ worker.attachToDocument(session.getDocument());
+
+ worker.on("annotate", function(e) {
+ session.setAnnotations(e.data);
+ });
+
+ worker.on("terminate", function() {
+ session.clearAnnotations();
+ });
+
+ return worker;
+ };
+
+
+ this.$id = "ace/mode/json";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+},{"../worker/json":75}],72:[function(require,module,exports){
+ace.define("ace/mode/python_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
+
+var PythonHighlightRules = function() {
+
+ var keywords = (
+ "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
+ "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
+ "raise|return|try|while|with|yield"
+ );
+
+ var builtinConstants = (
+ "True|False|None|NotImplemented|Ellipsis|__debug__"
+ );
+
+ var builtinFunctions = (
+ "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
+ "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
+ "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
+ "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
+ "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
+ "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
+ "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
+ "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
+ );
+ var keywordMapper = this.createKeywordMapper({
+ "invalid.deprecated": "debugger",
+ "support.function": builtinFunctions,
+ "constant.language": builtinConstants,
+ "keyword": keywords
+ }, "identifier");
+
+ var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
+
+ var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
+ var octInteger = "(?:0[oO]?[0-7]+)";
+ var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
+ var binInteger = "(?:0[bB][01]+)";
+ var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
+
+ var exponent = "(?:[eE][+-]?\\d+)";
+ var fraction = "(?:\\.\\d+)";
+ var intPart = "(?:\\d+)";
+ var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
+ var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
+ var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
+
+ var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
+
+ this.$rules = {
+ "start" : [ {
+ token : "comment",
+ regex : "#.*$"
+ }, {
+ token : "string", // multi line """ string start
+ regex : strPre + '"{3}',
+ next : "qqstring3"
+ }, {
+ token : "string", // " string
+ regex : strPre + '"(?=.)',
+ next : "qqstring"
+ }, {
+ token : "string", // multi line ''' string start
+ regex : strPre + "'{3}",
+ next : "qstring3"
+ }, {
+ token : "string", // ' string
+ regex : strPre + "'(?=.)",
+ next : "qstring"
+ }, {
+ token : "constant.numeric", // imaginary
+ regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
+ }, {
+ token : "constant.numeric", // float
+ regex : floatNumber
+ }, {
+ token : "constant.numeric", // long integer
+ regex : integer + "[lL]\\b"
+ }, {
+ token : "constant.numeric", // integer
+ regex : integer + "\\b"
+ }, {
+ token : keywordMapper,
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+ }, {
+ token : "keyword.operator",
+ regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
+ }, {
+ token : "paren.lparen",
+ regex : "[\\[\\(\\{]"
+ }, {
+ token : "paren.rparen",
+ regex : "[\\]\\)\\}]"
+ }, {
+ token : "text",
+ regex : "\\s+"
+ } ],
+ "qqstring3" : [ {
+ token : "constant.language.escape",
+ regex : stringEscape
+ }, {
+ token : "string", // multi line """ string end
+ regex : '"{3}',
+ next : "start"
+ }, {
+ defaultToken : "string"
+ } ],
+ "qstring3" : [ {
+ token : "constant.language.escape",
+ regex : stringEscape
+ }, {
+ token : "string", // multi line ''' string end
+ regex : "'{3}",
+ next : "start"
+ }, {
+ defaultToken : "string"
+ } ],
+ "qqstring" : [{
+ token : "constant.language.escape",
+ regex : stringEscape
+ }, {
+ token : "string",
+ regex : "\\\\$",
+ next : "qqstring"
+ }, {
+ token : "string",
+ regex : '"|$',
+ next : "start"
+ }, {
+ defaultToken: "string"
+ }],
+ "qstring" : [{
+ token : "constant.language.escape",
+ regex : stringEscape
+ }, {
+ token : "string",
+ regex : "\\\\$",
+ next : "qstring"
+ }, {
+ token : "string",
+ regex : "'|$",
+ next : "start"
+ }, {
+ defaultToken: "string"
+ }]
+ };
+};
+
+oop.inherits(PythonHighlightRules, TextHighlightRules);
+
+exports.PythonHighlightRules = PythonHighlightRules;
+});
+
+ace.define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../../lib/oop");
+var BaseFoldMode = acequire("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(markers) {
+ this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, match.index);
+ if (match[2])
+ return this.indentationBlock(session, row, match.index + match[2].length);
+ return this.indentationBlock(session, row);
+ }
+ }
+
+}).call(FoldMode.prototype);
+
+});
+
+ace.define("ace/mode/python",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/python_highlight_rules","ace/mode/folding/pythonic","ace/range"], function(acequire, exports, module) {
+"use strict";
+
+var oop = acequire("../lib/oop");
+var TextMode = acequire("./text").Mode;
+var PythonHighlightRules = acequire("./python_highlight_rules").PythonHighlightRules;
+var PythonFoldMode = acequire("./folding/pythonic").FoldMode;
+var Range = acequire("../range").Range;
+
+var Mode = function() {
+ this.HighlightRules = PythonHighlightRules;
+ this.foldingRules = new PythonFoldMode("\\:");
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "#";
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start") {
+ var match = line.match(/^.*[\{\(\[\:]\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ }
+
+ return indent;
+ };
+
+ var outdents = {
+ "pass": 1,
+ "return": 1,
+ "raise": 1,
+ "break": 1,
+ "continue": 1
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ if (input !== "\r\n" && input !== "\r" && input !== "\n")
+ return false;
+
+ var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
+
+ if (!tokens)
+ return false;
+ do {
+ var last = tokens.pop();
+ } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
+
+ if (!last)
+ return false;
+
+ return (last.type == "keyword" && outdents[last.value]);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+
+ row += 1;
+ var indent = this.$getIndent(doc.getLine(row));
+ var tab = doc.getTabString();
+ if (indent.slice(-tab.length) == tab)
+ doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
+ };
+
+ this.$id = "ace/mode/python";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+},{}],73:[function(require,module,exports){
+ace.define("ace/theme/tomorrow_night_blue",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
+
+exports.isDark = true;
+exports.cssClass = "ace-tomorrow-night-blue";
+exports.cssText = ".ace-tomorrow-night-blue .ace_gutter {\
+background: #00204b;\
+color: #7388b5\
+}\
+.ace-tomorrow-night-blue .ace_print-margin {\
+width: 1px;\
+background: #00204b\
+}\
+.ace-tomorrow-night-blue {\
+background-color: #002451;\
+color: #FFFFFF\
+}\
+.ace-tomorrow-night-blue .ace_constant.ace_other,\
+.ace-tomorrow-night-blue .ace_cursor {\
+color: #FFFFFF\
+}\
+.ace-tomorrow-night-blue .ace_marker-layer .ace_selection {\
+background: #003F8E\
+}\
+.ace-tomorrow-night-blue.ace_multiselect .ace_selection.ace_start {\
+box-shadow: 0 0 3px 0px #002451;\
+}\
+.ace-tomorrow-night-blue .ace_marker-layer .ace_step {\
+background: rgb(127, 111, 19)\
+}\
+.ace-tomorrow-night-blue .ace_marker-layer .ace_bracket {\
+margin: -1px 0 0 -1px;\
+border: 1px solid #404F7D\
+}\
+.ace-tomorrow-night-blue .ace_marker-layer .ace_active-line {\
+background: #00346E\
+}\
+.ace-tomorrow-night-blue .ace_gutter-active-line {\
+background-color: #022040\
+}\
+.ace-tomorrow-night-blue .ace_marker-layer .ace_selected-word {\
+border: 1px solid #003F8E\
+}\
+.ace-tomorrow-night-blue .ace_invisible {\
+color: #404F7D\
+}\
+.ace-tomorrow-night-blue .ace_keyword,\
+.ace-tomorrow-night-blue .ace_meta,\
+.ace-tomorrow-night-blue .ace_storage,\
+.ace-tomorrow-night-blue .ace_storage.ace_type,\
+.ace-tomorrow-night-blue .ace_support.ace_type {\
+color: #EBBBFF\
+}\
+.ace-tomorrow-night-blue .ace_keyword.ace_operator {\
+color: #99FFFF\
+}\
+.ace-tomorrow-night-blue .ace_constant.ace_character,\
+.ace-tomorrow-night-blue .ace_constant.ace_language,\
+.ace-tomorrow-night-blue .ace_constant.ace_numeric,\
+.ace-tomorrow-night-blue .ace_keyword.ace_other.ace_unit,\
+.ace-tomorrow-night-blue .ace_support.ace_constant,\
+.ace-tomorrow-night-blue .ace_variable.ace_parameter {\
+color: #FFC58F\
+}\
+.ace-tomorrow-night-blue .ace_invalid {\
+color: #FFFFFF;\
+background-color: #F99DA5\
+}\
+.ace-tomorrow-night-blue .ace_invalid.ace_deprecated {\
+color: #FFFFFF;\
+background-color: #EBBBFF\
+}\
+.ace-tomorrow-night-blue .ace_fold {\
+background-color: #BBDAFF;\
+border-color: #FFFFFF\
+}\
+.ace-tomorrow-night-blue .ace_entity.ace_name.ace_function,\
+.ace-tomorrow-night-blue .ace_support.ace_function,\
+.ace-tomorrow-night-blue .ace_variable {\
+color: #BBDAFF\
+}\
+.ace-tomorrow-night-blue .ace_support.ace_class,\
+.ace-tomorrow-night-blue .ace_support.ace_type {\
+color: #FFEEAD\
+}\
+.ace-tomorrow-night-blue .ace_heading,\
+.ace-tomorrow-night-blue .ace_markup.ace_heading,\
+.ace-tomorrow-night-blue .ace_string {\
+color: #D1F1A9\
+}\
+.ace-tomorrow-night-blue .ace_entity.ace_name.ace_tag,\
+.ace-tomorrow-night-blue .ace_entity.ace_other.ace_attribute-name,\
+.ace-tomorrow-night-blue .ace_meta.ace_tag,\
+.ace-tomorrow-night-blue .ace_string.ace_regexp,\
+.ace-tomorrow-night-blue .ace_variable {\
+color: #FF9DA4\
+}\
+.ace-tomorrow-night-blue .ace_comment {\
+color: #7285B7\
+}\
+.ace-tomorrow-night-blue .ace_indent-guide {\
+background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYJDzqfwPAANXAeNsiA+ZAAAAAElFTkSuQmCC) right repeat-y\
+}";
+
+var dom = acequire("../lib/dom");
+dom.importCssString(exports.cssText, exports.cssClass);
+});
+
+},{}],74:[function(require,module,exports){
+module.exports.id = 'ace/mode/javascript_worker';
+module.exports.src = "\"no use strict\";(function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\"\";testPath;){var alias=paths[testPath];if(\"string\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,\"/\")+(tail||alias.main||alias.name);if(alias===!1)return\"\";var i=testPath.lastIndexOf(\"/\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\"error\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\"!\")){var chunks=moduleName.split(\"!\");return window.normalizeModule(parentId,chunks[0])+\"!\"+window.normalizeModule(parentId,chunks[1])}if(\".\"==moduleName.charAt(0)){var base=parentId.split(\"/\").slice(0,-1).join(\"/\");for(moduleName=(base?base+\"/\":\"\")+moduleName;-1!==moduleName.indexOf(\".\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\"worker.js acequire() accepts only (parentId, id) as arguments\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\"unable to load \"+id);var path=resolveModuleId(id,window.acequire.tlns);return\".js\"!=path.slice(-3)&&(path+=\".js\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\"string\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\"function\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\"require\",\"exports\",\"module\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\"require\":return req;case\"exports\":return module.exports;case\"module\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\"ace/lib/event_emitter\").EventEmitter,oop=window.acequire(\"ace/lib/oop\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\"call\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\"event\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\"Unknown command:\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\"ace/lib/es5-shim\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}})(this),ace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\"object\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\"object\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\"\";switch(delta.action){case\"insert\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\"remove\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\"object\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\"unshift\":\"push\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.column
this.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal(\"change\",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/apply_delta\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),applyDelta=acequire(\"./apply_delta\").applyDelta,EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Range=acequire(\"./range\").Range,Anchor=acequire(\"./anchor\").Anchor,Document=function(textOrLines){this.$lines=[\"\"],0===textOrLines.length?this.$lines=[\"\"]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0===\"aaa\".split(/a/).length?function(text){return text.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:function(text){return text.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=match?match[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal(\"changeNewLineMode\"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return\"\\r\\n\"==text||\"\\r\"==text||\"\\n\"==text},this.getLine=function(row){return this.$lines[row]||\"\"},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||\"\").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\"),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\"),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\"),this.insertMergedLines(position,[\"\",\"\"])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:\"insert\",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([\"\"]),column=0):(lines=[\"\"].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:\"insert\",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:\"remove\",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:\"remove\",lines:[\"\",\"\"]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert=\"insert\"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal(\"change\",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(\"\"),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:\"insert\"==delta.action?\"remove\":\"insert\",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split(\"\").reverse().join(\"\")},exports.stringRepeat=function(string,count){for(var result=\"\";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\s\\s*/,trimEndRegexp=/\\s\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,\"\")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,\"\")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&\"object\"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if(\"object\"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}var cons=obj.constructor;if(cons===RegExp)return obj;copy=cons();for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},exports.escapeHTML=function(str){return str.replace(/&/g,\"&\").replace(/\"/g,\""\").replace(/'/g,\"'\").replace(/i;i+=2){if(Array.isArray(data[i+1]))var d={action:\"insert\",start:data[i],lines:data[i+1]};else var d={action:\"remove\",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define(\"ace/mode/javascript/jshint\",[\"require\",\"exports\",\"module\"],function(acequire,exports,module){module.exports=function outer(modules,cache,entry){function newRequire(name,jumped){if(!cache[name]){if(!modules[name]){var currentRequire=\"function\"==typeof acequire&&acequire;if(!jumped&¤tRequire)return currentRequire(name,!0);if(previousRequire)return previousRequire(name,!0);var err=Error(\"Cannot find module '\"+name+\"'\");throw err.code=\"MODULE_NOT_FOUND\",err}var m=cache[name]={exports:{}};modules[name][0].call(m.exports,function(x){var id=modules[name][1][x];return newRequire(id?id:x)},m,m.exports,outer,modules,cache,entry)}return cache[name].exports}for(var previousRequire=\"function\"==typeof acequire&&acequire,i=0;entry.length>i;i++)newRequire(entry[i]);return newRequire(entry[0])}({\"/node_modules/browserify/node_modules/events/events.js\":[function(_dereq_,module){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return\"function\"==typeof arg}function isNumber(arg){return\"number\"==typeof arg}function isObject(arg){return\"object\"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError(\"n must be a positive number\");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),\"error\"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified \"error\" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];handler.apply(this,args)}else if(isObject(handler)){for(len=arguments.length,args=Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];for(listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args)}return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(this._events||(this._events={}),this._events.newListener&&this.emit(\"newListener\",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned){var m;m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[type].length),\"function\"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError(\"listener must be a function\");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit(\"removeListener\",type,listener);else if(isObject(list)){for(i=length;i-->0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit(\"removeListener\",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)\"removeListener\"!==key&&this.removeAllListeners(key);return this.removeAllListeners(\"removeListener\"),this._events={},this\n}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.listenerCount=function(emitter,type){var ret;return ret=emitter._events&&emitter._events[type]?isFunction(emitter._events[type])?1:emitter._events[type].length:0}},{}],\"/node_modules/jshint/data/ascii-identifier-data.js\":[function(_dereq_,module){for(var identifierStartTable=[],i=0;128>i;i++)identifierStartTable[i]=36===i||i>=65&&90>=i||95===i||i>=97&&122>=i;for(var identifierPartTable=[],i=0;128>i;i++)identifierPartTable[i]=identifierStartTable[i]||i>=48&&57>=i;module.exports={asciiIdentifierStartTable:identifierStartTable,asciiIdentifierPartTable:identifierPartTable}},{}],\"/node_modules/jshint/lodash.js\":[function(_dereq_,module,exports){(function(global){(function(){function baseFindIndex(array,predicate,fromRight){for(var length=array.length,index=fromRight?length:-1;fromRight?index--:length>++index;)if(predicate(array[index],index,array))return index;return-1}function baseIndexOf(array,value,fromIndex){if(value!==value)return indexOfNaN(array,fromIndex);for(var index=fromIndex-1,length=array.length;length>++index;)if(array[index]===value)return index;return-1}function baseIsFunction(value){return\"function\"==typeof value||!1}function baseToString(value){return\"string\"==typeof value?value:null==value?\"\":value+\"\"}function indexOfNaN(array,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?0:-1);fromRight?index--:length>++index;){var other=array[index];if(other!==other)return index}return-1}function isObjectLike(value){return!!value&&\"object\"==typeof value}function lodash(){}function arrayCopy(source,array){var index=-1,length=source.length;for(array||(array=Array(length));length>++index;)array[index]=source[index];return array}function arrayEach(array,iteratee){for(var index=-1,length=array.length;length>++index&&iteratee(array[index],index,array)!==!1;);return array}function arrayFilter(array,predicate){for(var index=-1,length=array.length,resIndex=-1,result=[];length>++index;){var value=array[index];predicate(value,index,array)&&(result[++resIndex]=value)}return result}function arrayMap(array,iteratee){for(var index=-1,length=array.length,result=Array(length);length>++index;)result[index]=iteratee(array[index],index,array);return result}function arrayMax(array){for(var index=-1,length=array.length,result=NEGATIVE_INFINITY;length>++index;){var value=array[index];value>result&&(result=value)}return result}function arraySome(array,predicate){for(var index=-1,length=array.length;length>++index;)if(predicate(array[index],index,array))return!0;return!1}function assignWith(object,source,customizer){var props=keys(source);push.apply(props,getSymbols(source));for(var index=-1,length=props.length;length>++index;){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);(result===result?result===value:value!==value)&&(value!==undefined||key in object)||(object[key]=result)}return object}function baseCopy(source,props,object){object||(object={});for(var index=-1,length=props.length;length>++index;){var key=props[index];object[key]=source[key]}return object}function baseCallback(func,thisArg,argCount){var type=typeof func;return\"function\"==type?thisArg===undefined?func:bindCallback(func,thisArg,argCount):null==func?identity:\"object\"==type?baseMatches(func):thisArg===undefined?property(func):baseMatchesProperty(func,thisArg)}function baseClone(value,isDeep,customizer,key,object,stackA,stackB){var result;if(customizer&&(result=object?customizer(value,key,object):customizer(value)),result!==undefined)return result;if(!isObject(value))return value;var isArr=isArray(value);if(isArr){if(result=initCloneArray(value),!isDeep)return arrayCopy(value,result)}else{var tag=objToString.call(value),isFunc=tag==funcTag;if(tag!=objectTag&&tag!=argsTag&&(!isFunc||object))return cloneableTags[tag]?initCloneByTag(value,tag,isDeep):object?value:{};if(result=initCloneObject(isFunc?{}:value),!isDeep)return baseAssign(result,value)}stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==value)return stackB[length];return stackA.push(value),stackB.push(result),(isArr?arrayEach:baseForOwn)(value,function(subValue,key){result[key]=baseClone(subValue,isDeep,customizer,key,value,stackA,stackB)}),result}function baseFilter(collection,predicate){var result=[];return baseEach(collection,function(value,index,collection){predicate(value,index,collection)&&result.push(value)}),result}function baseForIn(object,iteratee){return baseFor(object,iteratee,keysIn)}function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function baseGet(object,path,pathKey){if(null!=object){pathKey!==undefined&&pathKey in toObject(object)&&(path=[pathKey]);for(var index=-1,length=path.length;null!=object&&length>++index;)var result=object=object[path[index]];return result}}function baseIsEqual(value,other,customizer,isLoose,stackA,stackB){if(value===other)return 0!==value||1/value==1/other;var valType=typeof value,othType=typeof other;return\"function\"!=valType&&\"object\"!=valType&&\"function\"!=othType&&\"object\"!=othType||null==value||null==other?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,isLoose,stackA,stackB)}function baseIsEqualDeep(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=objToString.call(object),objTag==argsTag?objTag=objectTag:objTag!=objectTag&&(objIsArr=isTypedArray(object))),othIsArr||(othTag=objToString.call(other),othTag==argsTag?othTag=objectTag:othTag!=objectTag&&(othIsArr=isTypedArray(other)));var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&!objIsArr&&!objIsObj)return equalByTag(object,other,objTag);if(!isLoose){var valWrapped=objIsObj&&hasOwnProperty.call(object,\"__wrapped__\"),othWrapped=othIsObj&&hasOwnProperty.call(other,\"__wrapped__\");if(valWrapped||othWrapped)return equalFunc(valWrapped?object.value():object,othWrapped?other.value():other,customizer,isLoose,stackA,stackB)}if(!isSameTag)return!1;stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==object)return stackB[length]==other;stackA.push(object),stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isLoose,stackA,stackB);return stackA.pop(),stackB.pop(),result}function baseIsMatch(object,props,values,strictCompareFlags,customizer){for(var index=-1,length=props.length,noCustomizer=!customizer;length>++index;)if(noCustomizer&&strictCompareFlags[index]?values[index]!==object[props[index]]:!(props[index]in object))return!1;for(index=-1;length>++index;){var key=props[index],objValue=object[key],srcValue=values[index];if(noCustomizer&&strictCompareFlags[index])var result=objValue!==undefined||key in object;else result=customizer?customizer(objValue,srcValue,key):undefined,result===undefined&&(result=baseIsEqual(srcValue,objValue,customizer,!0));if(!result)return!1}return!0}function baseMatches(source){var props=keys(source),length=props.length;if(!length)return constant(!0);if(1==length){var key=props[0],value=source[key];if(isStrictComparable(value))return function(object){return null==object?!1:object[key]===value&&(value!==undefined||key in toObject(object))}}for(var values=Array(length),strictCompareFlags=Array(length);length--;)value=source[props[length]],values[length]=value,strictCompareFlags[length]=isStrictComparable(value);return function(object){return null!=object&&baseIsMatch(toObject(object),props,values,strictCompareFlags)}}function baseMatchesProperty(path,value){var isArr=isArray(path),isCommon=isKey(path)&&isStrictComparable(value),pathKey=path+\"\";return path=toPath(path),function(object){if(null==object)return!1;var key=pathKey;if(object=toObject(object),!(!isArr&&isCommon||key in object)){if(object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),null==object)return!1;key=last(path),object=toObject(object)}return object[key]===value?value!==undefined||key in object:baseIsEqual(value,object[key],null,!0)}}function baseMerge(object,source,customizer,stackA,stackB){if(!isObject(object))return object;var isSrcArr=isLength(source.length)&&(isArray(source)||isTypedArray(source));if(!isSrcArr){var props=keys(source);push.apply(props,getSymbols(source))}return arrayEach(props||source,function(srcValue,key){if(props&&(key=srcValue,srcValue=source[key]),isObjectLike(srcValue))stackA||(stackA=[]),stackB||(stackB=[]),baseMergeDeep(object,source,key,baseMerge,customizer,stackA,stackB);else{var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue),!isSrcArr&&result===undefined||!isCommon&&(result===result?result===value:value!==value)||(object[key]=result)}}),object}function baseMergeDeep(object,source,key,mergeFunc,customizer,stackA,stackB){for(var length=stackA.length,srcValue=source[key];length--;)if(stackA[length]==srcValue)return object[key]=stackB[length],undefined;var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=result===undefined;isCommon&&(result=srcValue,isLength(srcValue.length)&&(isArray(srcValue)||isTypedArray(srcValue))?result=isArray(value)?value:getLength(value)?arrayCopy(value):[]:isPlainObject(srcValue)||isArguments(srcValue)?result=isArguments(value)?toPlainObject(value):isPlainObject(value)?value:{}:isCommon=!1),stackA.push(srcValue),stackB.push(result),isCommon?object[key]=mergeFunc(result,srcValue,customizer,stackA,stackB):(result===result?result!==value:value===value)&&(object[key]=result)}function baseProperty(key){return function(object){return null==object?undefined:object[key]}}function basePropertyDeep(path){var pathKey=path+\"\";return path=toPath(path),function(object){return baseGet(object,path,pathKey)}}function baseSlice(array,start,end){var index=-1,length=array.length;start=null==start?0:+start||0,0>start&&(start=-start>length?0:length+start),end=end===undefined||end>length?length:+end||0,0>end&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);length>++index;)result[index]=array[index+start];return result}function baseSome(collection,predicate){var result;return baseEach(collection,function(value,index,collection){return result=predicate(value,index,collection),!result}),!!result}function baseValues(object,props){for(var index=-1,length=props.length,result=Array(length);length>++index;)result[index]=object[props[index]];return result}function binaryIndex(array,value,retHighest){var low=0,high=array?array.length:low;if(\"number\"==typeof value&&value===value&&HALF_MAX_ARRAY_LENGTH>=high){for(;high>low;){var mid=low+high>>>1,computed=array[mid];(retHighest?value>=computed:value>computed)?low=mid+1:high=mid}return high}return binaryIndexBy(array,value,identity,retHighest)}function binaryIndexBy(array,value,iteratee,retHighest){value=iteratee(value);for(var low=0,high=array?array.length:0,valIsNaN=value!==value,valIsUndef=value===undefined;high>low;){var mid=floor((low+high)/2),computed=iteratee(array[mid]),isReflexive=computed===computed;if(valIsNaN)var setLow=isReflexive||retHighest;else setLow=valIsUndef?isReflexive&&(retHighest||computed!==undefined):retHighest?value>=computed:value>computed;setLow?low=mid+1:high=mid}return nativeMin(high,MAX_ARRAY_INDEX)}function bindCallback(func,thisArg,argCount){if(\"function\"!=typeof func)return identity;if(thisArg===undefined)return func;switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function bufferClone(buffer){return bufferSlice.call(buffer,0)}function createAssigner(assigner){return restParam(function(object,sources){var index=-1,length=null==object?0:sources.length,customizer=length>2&&sources[length-2],guard=length>2&&sources[2],thisArg=length>1&&sources[length-1];for(\"function\"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer=\"function\"==typeof thisArg?thisArg:null,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=3>length?null:customizer,length=1);length>++index;){var source=sources[index];source&&assigner(object,source,customizer)}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){var length=collection?getLength(collection):0;if(!isLength(length))return eachFunc(collection,iteratee);for(var index=fromRight?length:-1,iterable=toObject(collection);(fromRight?index--:length>++index)&&iteratee(iterable[index],index,iterable)!==!1;);return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;fromRight?index--:length>++index;){var key=props[index];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}function createFindIndex(fromRight){return function(array,predicate,thisArg){return array&&array.length?(predicate=getCallback(predicate,thisArg,3),baseFindIndex(array,predicate,fromRight)):-1}}function createForEach(arrayFunc,eachFunc){return function(collection,iteratee,thisArg){return\"function\"==typeof iteratee&&thisArg===undefined&&isArray(collection)?arrayFunc(collection,iteratee):eachFunc(collection,bindCallback(iteratee,thisArg,3))}}function equalArrays(array,other,equalFunc,customizer,isLoose,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length,result=!0;if(arrLength!=othLength&&!(isLoose&&othLength>arrLength))return!1;for(;result&&arrLength>++index;){var arrValue=array[index],othValue=other[index];if(result=undefined,customizer&&(result=isLoose?customizer(othValue,arrValue,index):customizer(arrValue,othValue,index)),result===undefined)if(isLoose)for(var othIndex=othLength;othIndex--&&(othValue=other[othIndex],!(result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB))););else result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB)}return!!result}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:0==object?1/object==1/other:object==+other;case regexpTag:case stringTag:return object==other+\"\"}return!1}function equalObjects(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isLoose)return!1;for(var skipCtor=isLoose,index=-1;objLength>++index;){var key=objProps[index],result=isLoose?key in other:hasOwnProperty.call(other,key);if(result){var objValue=object[key],othValue=other[key];result=undefined,customizer&&(result=isLoose?customizer(othValue,objValue,key):customizer(objValue,othValue,key)),result===undefined&&(result=objValue&&objValue===othValue||equalFunc(objValue,othValue,customizer,isLoose,stackA,stackB))}if(!result)return!1;skipCtor||(skipCtor=\"constructor\"==key)}if(!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&\"constructor\"in object&&\"constructor\"in other&&!(\"function\"==typeof objCtor&&objCtor instanceof objCtor&&\"function\"==typeof othCtor&&othCtor instanceof othCtor))return!1}return!0}function getCallback(func,thisArg,argCount){var result=lodash.callback||callback;return result=result===callback?baseCallback:result,argCount?result(func,thisArg,argCount):result}function getIndexOf(collection,target,fromIndex){var result=lodash.indexOf||indexOf;return result=result===indexOf?baseIndexOf:result,collection?result(collection,target,fromIndex):result}function initCloneArray(array){var length=array.length,result=new array.constructor(length);return length&&\"string\"==typeof array[0]&&hasOwnProperty.call(array,\"index\")&&(result.index=array.index,result.input=array.input),result}function initCloneObject(object){var Ctor=object.constructor;return\"function\"==typeof Ctor&&Ctor instanceof Ctor||(Ctor=Object),new Ctor}function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return bufferClone(object);case boolTag:case dateTag:return new Ctor(+object);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:var buffer=object.buffer;return new Ctor(isDeep?bufferClone(buffer):buffer,object.byteOffset,object.length);case numberTag:case stringTag:return new Ctor(object);case regexpTag:var result=new Ctor(object.source,reFlags.exec(object));result.lastIndex=object.lastIndex}return result}function isIndex(value,length){return value=+value,length=null==length?MAX_SAFE_INTEGER:length,value>-1&&0==value%1&&length>value}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;if(\"number\"==type)var length=getLength(object),prereq=isLength(length)&&isIndex(index,length);else prereq=\"string\"==type&&index in object;if(prereq){var other=object[index];return value===value?value===other:other!==other}return!1}function isKey(value,object){var type=typeof value;if(\"string\"==type&&reIsPlainProp.test(value)||\"number\"==type)return!0;if(isArray(value))return!1;var result=!reIsDeepProp.test(value);return result||null!=object&&value in toObject(object)}function isLength(value){return\"number\"==typeof value&&value>-1&&0==value%1&&MAX_SAFE_INTEGER>=value}function isStrictComparable(value){return value===value&&(0===value?1/value>0:!isObject(value))}function shimIsPlainObject(value){var Ctor;if(lodash.support,!isObjectLike(value)||objToString.call(value)!=objectTag||!hasOwnProperty.call(value,\"constructor\")&&(Ctor=value.constructor,\"function\"==typeof Ctor&&!(Ctor instanceof Ctor)))return!1;var result;return baseForIn(value,function(subValue,key){result=key}),result===undefined||hasOwnProperty.call(value,result)}function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,support=lodash.support,allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object)),index=-1,result=[];propsLength>++index;){var key=props[index];(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key))&&result.push(key)}return result}function toObject(value){return isObject(value)?value:Object(value)}function toPath(value){if(isArray(value))return value;var result=[];return baseToString(value).replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,\"$1\"):number||match)}),result}function indexOf(array,value,fromIndex){var length=array?array.length:0;if(!length)return-1;if(\"number\"==typeof fromIndex)fromIndex=0>fromIndex?nativeMax(length+fromIndex,0):fromIndex;else if(fromIndex){var index=binaryIndex(array,value),other=array[index];return(value===value?value===other:other!==other)?index:-1}return baseIndexOf(array,value,fromIndex||0)}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function slice(array,start,end){var length=array?array.length:0;return length?(end&&\"number\"!=typeof end&&isIterateeCall(array,start,end)&&(start=0,end=length),baseSlice(array,start,end)):[]}function unzip(array){for(var index=-1,length=(array&&array.length&&arrayMax(arrayMap(array,getLength)))>>>0,result=Array(length);length>++index;)result[index]=arrayMap(array,baseProperty(index));return result}function includes(collection,target,fromIndex,guard){var length=collection?getLength(collection):0;return isLength(length)||(collection=values(collection),length=collection.length),length?(fromIndex=\"number\"!=typeof fromIndex||guard&&isIterateeCall(target,fromIndex,guard)?0:0>fromIndex?nativeMax(length+fromIndex,0):fromIndex||0,\"string\"==typeof collection||!isArray(collection)&&isString(collection)?length>fromIndex&&collection.indexOf(target,fromIndex)>-1:getIndexOf(collection,target,fromIndex)>-1):!1}function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;return predicate=getCallback(predicate,thisArg,3),func(collection,function(value,index,collection){return!predicate(value,index,collection)})}function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;return thisArg&&isIterateeCall(collection,predicate,thisArg)&&(predicate=null),(\"function\"!=typeof predicate||thisArg!==undefined)&&(predicate=getCallback(predicate,thisArg,3)),func(collection,predicate)}function restParam(func,start){if(\"function\"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(start===undefined?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);length>++index;)rest[index]=args[start+index];switch(start){case 0:return func.call(this,rest);case 1:return func.call(this,args[0],rest);case 2:return func.call(this,args[0],args[1],rest)}var otherArgs=Array(start+1);for(index=-1;start>++index;)otherArgs[index]=args[index];return otherArgs[start]=rest,func.apply(this,otherArgs)}}function clone(value,isDeep,customizer,thisArg){return isDeep&&\"boolean\"!=typeof isDeep&&isIterateeCall(value,isDeep,customizer)?isDeep=!1:\"function\"==typeof isDeep&&(thisArg=customizer,customizer=isDeep,isDeep=!1),customizer=\"function\"==typeof customizer&&bindCallback(customizer,thisArg,1),baseClone(value,isDeep,customizer)}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag}function isEmpty(value){if(null==value)return!0;var length=getLength(value);return isLength(length)&&(isArray(value)||isString(value)||isArguments(value)||isObjectLike(value)&&isFunction(value.splice))?!length:!keys(value).length}function isObject(value){var type=typeof value;return\"function\"==type||!!value&&\"object\"==type}function isNative(value){return null==value?!1:objToString.call(value)==funcTag?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value)}function isNumber(value){return\"number\"==typeof value||isObjectLike(value)&&objToString.call(value)==numberTag}function isString(value){return\"string\"==typeof value||isObjectLike(value)&&objToString.call(value)==stringTag}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objToString.call(value)]}function toPlainObject(value){return baseCopy(value,keysIn(value))}function has(object,path){if(null==object)return!1;var result=hasOwnProperty.call(object,path);return result||isKey(path)||(path=toPath(path),object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),path=last(path),result=null!=object&&hasOwnProperty.call(object,path)),result}function keysIn(object){if(null==object)return[];isObject(object)||(object=Object(object));var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;for(var Ctor=object.constructor,index=-1,isProto=\"function\"==typeof Ctor&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;length>++index;)result[index]=index+\"\";for(var key in object)skipIndexes&&isIndex(key,length)||\"constructor\"==key&&(isProto||!hasOwnProperty.call(object,key))||result.push(key);return result}function values(object){return baseValues(object,keys(object))}function escapeRegExp(string){return string=baseToString(string),string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,\"\\\\$&\"):string}function callback(func,thisArg,guard){return guard&&isIterateeCall(func,thisArg,guard)&&(thisArg=null),baseCallback(func,thisArg)}function constant(value){return function(){return value}}function identity(value){return value}function property(path){return isKey(path)?baseProperty(path):basePropertyDeep(path)}var undefined,VERSION=\"3.7.0\",FUNC_ERROR_TEXT=\"Expected a function\",argsTag=\"[object Arguments]\",arrayTag=\"[object Array]\",boolTag=\"[object Boolean]\",dateTag=\"[object Date]\",errorTag=\"[object Error]\",funcTag=\"[object Function]\",mapTag=\"[object Map]\",numberTag=\"[object Number]\",objectTag=\"[object Object]\",regexpTag=\"[object RegExp]\",setTag=\"[object Set]\",stringTag=\"[object String]\",weakMapTag=\"[object WeakMap]\",arrayBufferTag=\"[object ArrayBuffer]\",float32Tag=\"[object Float32Array]\",float64Tag=\"[object Float64Array]\",int8Tag=\"[object Int8Array]\",int16Tag=\"[object Int16Array]\",int32Tag=\"[object Int32Array]\",uint8Tag=\"[object Uint8Array]\",uint8ClampedTag=\"[object Uint8ClampedArray]\",uint16Tag=\"[object Uint16Array]\",uint32Tag=\"[object Uint32Array]\",reIsDeepProp=/\\.|\\[(?:[^[\\]]+|([\"'])(?:(?!\\1)[^\\n\\\\]|\\\\.)*?)\\1\\]/,reIsPlainProp=/^\\w*$/,rePropName=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g,reRegExpChars=/[.*+?^${}()|[\\]\\/\\\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source),reEscapeChar=/\\\\(\\\\)?/g,reFlags=/\\w*$/,reIsHostCtor=/^\\[object .+?Constructor\\]$/,typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[stringTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[mapTag]=cloneableTags[setTag]=cloneableTags[weakMapTag]=!1;var objectTypes={\"function\":!0,object:!0},freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports,freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module,freeGlobal=freeExports&&freeModule&&\"object\"==typeof global&&global&&global.Object&&global,freeSelf=objectTypes[typeof self]&&self&&self.Object&&self,freeWindow=objectTypes[typeof window]&&window&&window.Object&&window,moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports,root=freeGlobal||freeWindow!==(this&&this.window)&&freeWindow||freeSelf||this,arrayProto=Array.prototype,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp(\"^\"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,\"$1.*?\")+\"$\"),ArrayBuffer=isNative(ArrayBuffer=root.ArrayBuffer)&&ArrayBuffer,bufferSlice=isNative(bufferSlice=ArrayBuffer&&new ArrayBuffer(0).slice)&&bufferSlice,floor=Math.floor,getOwnPropertySymbols=isNative(getOwnPropertySymbols=Object.getOwnPropertySymbols)&&getOwnPropertySymbols,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,push=arrayProto.push,preventExtensions=isNative(Object.preventExtensions=Object.preventExtensions)&&preventExtensions,propertyIsEnumerable=objectProto.propertyIsEnumerable,Uint8Array=isNative(Uint8Array=root.Uint8Array)&&Uint8Array,Float64Array=function(){try{var func=isNative(func=root.Float64Array)&&func,result=new func(new ArrayBuffer(10),0,1)&&func}catch(e){}return result}(),nativeAssign=function(){var object={1:0},func=preventExtensions&&isNative(func=Object.assign)&&func;try{func(preventExtensions(object),\"xo\")}catch(e){}return!object[1]&&func}(),nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,MAX_ARRAY_LENGTH=Math.pow(2,32)-1,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1,FLOAT64_BYTES_PER_ELEMENT=Float64Array?Float64Array.BYTES_PER_ELEMENT:0,MAX_SAFE_INTEGER=Math.pow(2,53)-1,support=lodash.support={};(function(x){var Ctor=function(){this.x=x},props=[];Ctor.prototype={valueOf:x,y:x};for(var key in new Ctor)props.push(key);support.funcDecomp=/\\bthis\\b/.test(function(){return this}),support.funcNames=\"string\"==typeof Function.name;try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=!0}})(1,0);var baseAssign=nativeAssign||function(object,source){return null==source?object:baseCopy(source,getSymbols(source),baseCopy(source,keys(source),object))},baseEach=createBaseEach(baseForOwn),baseFor=createBaseFor();bufferSlice||(bufferClone=ArrayBuffer&&Uint8Array?function(buffer){var byteLength=buffer.byteLength,floatLength=Float64Array?floor(byteLength/FLOAT64_BYTES_PER_ELEMENT):0,offset=floatLength*FLOAT64_BYTES_PER_ELEMENT,result=new ArrayBuffer(byteLength);if(floatLength){var view=new Float64Array(result,0,floatLength);view.set(new Float64Array(buffer,0,floatLength))}return byteLength!=offset&&(view=new Uint8Array(result,offset),view.set(new Uint8Array(buffer,offset))),result}:constant(null));var getLength=baseProperty(\"length\"),getSymbols=getOwnPropertySymbols?function(object){return getOwnPropertySymbols(toObject(object))}:constant([]),findLastIndex=createFindIndex(!0),zip=restParam(unzip),forEach=createForEach(arrayEach,baseEach),isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag},isFunction=baseIsFunction(/x/)||Uint8Array&&!baseIsFunction(Uint8Array)?function(value){return objToString.call(value)==funcTag}:baseIsFunction,isPlainObject=getPrototypeOf?function(value){if(!value||objToString.call(value)!=objectTag)return!1;var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)}:shimIsPlainObject,assign=createAssigner(function(object,source,customizer){return customizer?assignWith(object,source,customizer):baseAssign(object,source)}),keys=nativeKeys?function(object){if(object)var Ctor=object.constructor,length=object.length;return\"function\"==typeof Ctor&&Ctor.prototype===object||\"function\"!=typeof object&&isLength(length)?shimKeys(object):isObject(object)?nativeKeys(object):[]}:shimKeys,merge=createAssigner(baseMerge);lodash.assign=assign,lodash.callback=callback,lodash.constant=constant,lodash.forEach=forEach,lodash.keys=keys,lodash.keysIn=keysIn,lodash.merge=merge,lodash.property=property,lodash.reject=reject,lodash.restParam=restParam,lodash.slice=slice,lodash.toPlainObject=toPlainObject,lodash.unzip=unzip,lodash.values=values,lodash.zip=zip,lodash.each=forEach,lodash.extend=assign,lodash.iteratee=callback,lodash.clone=clone,lodash.escapeRegExp=escapeRegExp,lodash.findLastIndex=findLastIndex,lodash.has=has,lodash.identity=identity,lodash.includes=includes,lodash.indexOf=indexOf,lodash.isArguments=isArguments,lodash.isArray=isArray,lodash.isEmpty=isEmpty,lodash.isFunction=isFunction,lodash.isNative=isNative,lodash.isNumber=isNumber,lodash.isObject=isObject,lodash.isPlainObject=isPlainObject,lodash.isString=isString,lodash.isTypedArray=isTypedArray,lodash.last=last,lodash.some=some,lodash.any=some,lodash.contains=includes,lodash.include=includes,lodash.VERSION=VERSION,freeExports&&freeModule?moduleExports?(freeModule.exports=lodash)._=lodash:freeExports._=lodash:root._=lodash\n}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],\"/node_modules/jshint/src/jshint.js\":[function(_dereq_,module,exports){var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),vars=_dereq_(\"./vars.js\"),messages=_dereq_(\"./messages.js\"),Lexer=_dereq_(\"./lex.js\").Lexer,reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,style=_dereq_(\"./style.js\"),options=_dereq_(\"./options.js\"),scopeManager=_dereq_(\"./scope-manager.js\"),JSHINT=function(){\"use strict\";function checkOption(name,t){return name=name.trim(),/^[+-]W\\d{3}$/g.test(name)?!0:-1!==options.validNames.indexOf(name)||\"jslint\"===t.type||_.has(options.removed,name)?!0:(error(\"E001\",t,name),!1)}function isString(obj){return\"[object String]\"===Object.prototype.toString.call(obj)}function isIdentifier(tkn,value){return tkn?tkn.identifier&&tkn.value===value?!0:!1:!1}function isReserved(token){if(!token.reserved)return!1;var meta=token.meta;if(meta&&meta.isFutureReservedWord&&state.inES5()){if(!meta.es5)return!1;if(meta.strictOnly&&!state.option.strict&&!state.isStrict())return!1;if(token.isProperty)return!1}return!0}function supplant(str,data){return str.replace(/\\{([^{}]*)\\}/g,function(a,b){var r=data[b];return\"string\"==typeof r||\"number\"==typeof r?r:a})}function combine(dest,src){Object.keys(src).forEach(function(name){_.has(JSHINT.blacklist,name)||(dest[name]=src[name])})}function processenforceall(){if(state.option.enforceall){for(var enforceopt in options.bool.enforcing)void 0!==state.option[enforceopt]||options.noenforceall[enforceopt]||(state.option[enforceopt]=!0);for(var relaxopt in options.bool.relaxing)void 0===state.option[relaxopt]&&(state.option[relaxopt]=!1)}}function assume(){processenforceall(),state.option.esversion||state.option.moz||(state.option.esversion=state.option.es3?3:state.option.esnext?6:5),state.inES5()&&combine(predefined,vars.ecmaIdentifiers[5]),state.inES6()&&combine(predefined,vars.ecmaIdentifiers[6]),state.option.module&&(state.option.strict===!0&&(state.option.strict=\"global\"),state.inES6()||warning(\"W134\",state.tokens.next,\"module\",6)),state.option.couch&&combine(predefined,vars.couch),state.option.qunit&&combine(predefined,vars.qunit),state.option.rhino&&combine(predefined,vars.rhino),state.option.shelljs&&(combine(predefined,vars.shelljs),combine(predefined,vars.node)),state.option.typed&&combine(predefined,vars.typed),state.option.phantom&&(combine(predefined,vars.phantom),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.prototypejs&&combine(predefined,vars.prototypejs),state.option.node&&(combine(predefined,vars.node),combine(predefined,vars.typed),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.devel&&combine(predefined,vars.devel),state.option.dojo&&combine(predefined,vars.dojo),state.option.browser&&(combine(predefined,vars.browser),combine(predefined,vars.typed)),state.option.browserify&&(combine(predefined,vars.browser),combine(predefined,vars.typed),combine(predefined,vars.browserify),state.option.strict===!0&&(state.option.strict=\"global\")),state.option.nonstandard&&combine(predefined,vars.nonstandard),state.option.jasmine&&combine(predefined,vars.jasmine),state.option.jquery&&combine(predefined,vars.jquery),state.option.mootools&&combine(predefined,vars.mootools),state.option.worker&&combine(predefined,vars.worker),state.option.wsh&&combine(predefined,vars.wsh),state.option.globalstrict&&state.option.strict!==!1&&(state.option.strict=\"global\"),state.option.yui&&combine(predefined,vars.yui),state.option.mocha&&combine(predefined,vars.mocha)}function quit(code,line,chr){var percentage=Math.floor(100*(line/state.lines.length)),message=messages.errors[code].desc;throw{name:\"JSHintError\",line:line,character:chr,message:message+\" (\"+percentage+\"% scanned).\",raw:message,code:code}}function removeIgnoredMessages(){var ignored=state.ignoredLines;_.isEmpty(ignored)||(JSHINT.errors=_.reject(JSHINT.errors,function(err){return ignored[err.line]}))}function warning(code,t,a,b,c,d){var ch,l,w,msg;if(/^W\\d{3}$/.test(code)){if(state.ignored[code])return;msg=messages.warnings[code]}else/E\\d{3}/.test(code)?msg=messages.errors[code]:/I\\d{3}/.test(code)&&(msg=messages.info[code]);return t=t||state.tokens.next||{},\"(end)\"===t.id&&(t=state.tokens.curr),l=t.line||0,ch=t.from||0,w={id:\"(error)\",raw:msg.desc,code:msg.code,evidence:state.lines[l-1]||\"\",line:l,character:ch,scope:JSHINT.scope,a:a,b:b,c:c,d:d},w.reason=supplant(msg.desc,w),JSHINT.errors.push(w),removeIgnoredMessages(),JSHINT.errors.length>=state.option.maxerr&&quit(\"E043\",l,ch),w}function warningAt(m,l,ch,a,b,c,d){return warning(m,{line:l,from:ch},a,b,c,d)}function error(m,t,a,b,c,d){warning(m,t,a,b,c,d)}function errorAt(m,l,ch,a,b,c,d){return error(m,{line:l,from:ch},a,b,c,d)}function addInternalSrc(elem,src){var i;return i={id:\"(internal)\",elem:elem,value:src},JSHINT.internals.push(i),i}function doOption(){var nt=state.tokens.next,body=nt.body.match(/(-\\s+)?[^\\s,:]+(?:\\s*:\\s*(-\\s+)?[^\\s,]+)?/g)||[],predef={};if(\"globals\"===nt.type){body.forEach(function(g,idx){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(\"-\"===key||!key.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}\"-\"===key.charAt(0)?(key=key.slice(1),val=!1,JSHINT.blacklist[key]=key,delete predefined[key]):predef[key]=\"true\"===val}),combine(predefined,predef);for(var key in predef)_.has(predef,key)&&(declared[key]=nt)}\"exported\"===nt.type&&body.forEach(function(e,idx){if(!e.length){if(idx>0&&idx===body.length-1)return;return error(\"E002\",nt),void 0}state.funct[\"(scope)\"].addExported(e)}),\"members\"===nt.type&&(membersOnly=membersOnly||{},body.forEach(function(m){var ch1=m.charAt(0),ch2=m.charAt(m.length-1);ch1!==ch2||'\"'!==ch1&&\"'\"!==ch1||(m=m.substr(1,m.length-2).replace('\\\\\"','\"')),membersOnly[m]=!1}));var numvals=[\"maxstatements\",\"maxparams\",\"maxdepth\",\"maxcomplexity\",\"maxerr\",\"maxlen\",\"indent\"];(\"jshint\"===nt.type||\"jslint\"===nt.type)&&(body.forEach(function(g){g=g.split(\":\");var key=(g[0]||\"\").trim(),val=(g[1]||\"\").trim();if(checkOption(key,nt))if(numvals.indexOf(key)>=0)if(\"false\"!==val){if(val=+val,\"number\"!=typeof val||!isFinite(val)||0>=val||Math.floor(val)!==val)return error(\"E032\",nt,g[1].trim()),void 0;state.option[key]=val}else state.option[key]=\"indent\"===key?4:!1;else{if(\"validthis\"===key)return state.funct[\"(global)\"]?void error(\"E009\"):\"true\"!==val&&\"false\"!==val?void error(\"E002\",nt):(state.option.validthis=\"true\"===val,void 0);if(\"quotmark\"!==key)if(\"shadow\"!==key)if(\"unused\"!==key)if(\"latedef\"!==key)if(\"ignore\"!==key)if(\"strict\"!==key){\"module\"===key&&(hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"module\"));var esversions={es3:3,es5:5,esnext:6};if(!_.has(esversions,key)){if(\"esversion\"===key){switch(val){case\"5\":state.inES5(!0)&&warning(\"I003\");case\"3\":case\"6\":state.option.moz=!1,state.option.esversion=+val;break;case\"2015\":state.option.moz=!1,state.option.esversion=6;break;default:error(\"E002\",nt)}return hasParsedCode(state.funct)||error(\"E055\",state.tokens.next,\"esversion\"),void 0}var match=/^([+-])(W\\d{3})$/g.exec(key);if(match)return state.ignored[match[2]]=\"-\"===match[1],void 0;var tn;return\"true\"===val||\"false\"===val?(\"jslint\"===nt.type?(tn=options.renamed[key]||key,state.option[tn]=\"true\"===val,void 0!==options.inverted[tn]&&(state.option[tn]=!state.option[tn])):state.option[key]=\"true\"===val,\"newcap\"===key&&(state.option[\"(explicitNewcap)\"]=!0),void 0):(error(\"E002\",nt),void 0)}switch(val){case\"true\":state.option.moz=!1,state.option.esversion=esversions[key];break;case\"false\":state.option.moz||(state.option.esversion=5);break;default:error(\"E002\",nt)}}else switch(val){case\"true\":state.option.strict=!0;break;case\"false\":state.option.strict=!1;break;case\"func\":case\"global\":case\"implied\":state.option.strict=val;break;default:error(\"E002\",nt)}else switch(val){case\"line\":state.ignoredLines[nt.line]=!0,removeIgnoredMessages();break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.latedef=!0;break;case\"false\":state.option.latedef=!1;break;case\"nofunc\":state.option.latedef=\"nofunc\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.unused=!0;break;case\"false\":state.option.unused=!1;break;case\"vars\":case\"strict\":state.option.unused=val;break;default:error(\"E002\",nt)}else switch(val){case\"true\":state.option.shadow=!0;break;case\"outer\":state.option.shadow=\"outer\";break;case\"false\":case\"inner\":state.option.shadow=\"inner\";break;default:error(\"E002\",nt)}else switch(val){case\"true\":case\"false\":state.option.quotmark=\"true\"===val;break;case\"double\":case\"single\":state.option.quotmark=val;break;default:error(\"E002\",nt)}}}),assume())}function peek(p){var t,i=p||0,j=lookahead.length;if(j>i)return lookahead[i];for(;i>=j;)t=lookahead[j],t||(t=lookahead[j]=lex.token()),j+=1;return t||\"(end)\"!==state.tokens.next.id?t:state.tokens.next}function peekIgnoreEOL(){var t,i=0;do t=peek(i++);while(\"(endline)\"===t.id);return t}function advance(id,t){switch(state.tokens.curr.id){case\"(number)\":\".\"===state.tokens.next.id&&warning(\"W005\",state.tokens.curr);break;case\"-\":(\"-\"===state.tokens.next.id||\"--\"===state.tokens.next.id)&&warning(\"W006\");break;case\"+\":(\"+\"===state.tokens.next.id||\"++\"===state.tokens.next.id)&&warning(\"W007\")}for(id&&state.tokens.next.id!==id&&(t?\"(end)\"===state.tokens.next.id?error(\"E019\",t,t.id):error(\"E020\",state.tokens.next,id,t.id,t.line,state.tokens.next.value):(\"(identifier)\"!==state.tokens.next.type||state.tokens.next.value!==id)&&warning(\"W116\",state.tokens.next,id,state.tokens.next.value)),state.tokens.prev=state.tokens.curr,state.tokens.curr=state.tokens.next;;){if(state.tokens.next=lookahead.shift()||lex.token(),state.tokens.next||quit(\"E041\",state.tokens.curr.line),\"(end)\"===state.tokens.next.id||\"(error)\"===state.tokens.next.id)return;if(state.tokens.next.check&&state.tokens.next.check(),state.tokens.next.isSpecial)\"falls through\"===state.tokens.next.type?state.tokens.curr.caseFallsThrough=!0:doOption();else if(\"(endline)\"!==state.tokens.next.id)break}}function isInfix(token){return token.infix||!token.identifier&&!token.template&&!!token.led}function isEndOfExpr(){var curr=state.tokens.curr,next=state.tokens.next;return\";\"===next.id||\"}\"===next.id||\":\"===next.id?!0:isInfix(next)===isInfix(curr)||\"yield\"===curr.id&&state.inMoz()?curr.line!==startLine(next):!1}function isBeginOfExpr(prev){return!prev.left&&\"unary\"!==prev.arity}function expression(rbp,initial){var left,isArray=!1,isObject=!1,isLetExpr=!1;state.nameStack.push(),initial||\"let\"!==state.tokens.next.value||\"(\"!==peek(0).value||(state.inMoz()||warning(\"W118\",state.tokens.next,\"let expressions\"),isLetExpr=!0,state.funct[\"(scope)\"].stack(),advance(\"let\"),advance(\"(\"),state.tokens.prev.fud(),advance(\")\")),\"(end)\"===state.tokens.next.id&&error(\"E006\",state.tokens.curr);var isDangerous=state.option.asi&&state.tokens.prev.line!==startLine(state.tokens.curr)&&_.contains([\"]\",\")\"],state.tokens.prev.id)&&_.contains([\"[\",\"(\"],state.tokens.curr.id);if(isDangerous&&warning(\"W014\",state.tokens.curr,state.tokens.curr.id),advance(),initial&&(state.funct[\"(verb)\"]=state.tokens.curr.value,state.tokens.curr.beginsStmt=!0),initial===!0&&state.tokens.curr.fud)left=state.tokens.curr.fud();else for(state.tokens.curr.nud?left=state.tokens.curr.nud():error(\"E030\",state.tokens.curr,state.tokens.curr.id);(state.tokens.next.lbp>rbp||\"(template)\"===state.tokens.next.type)&&!isEndOfExpr();)isArray=\"Array\"===state.tokens.curr.value,isObject=\"Object\"===state.tokens.curr.value,left&&(left.value||left.first&&left.first.value)&&(\"new\"!==left.value||left.first&&left.first.value&&\".\"===left.first.value)&&(isArray=!1,left.value!==state.tokens.curr.value&&(isObject=!1)),advance(),isArray&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W009\",state.tokens.curr),isObject&&\"(\"===state.tokens.curr.id&&\")\"===state.tokens.next.id&&warning(\"W010\",state.tokens.curr),left&&state.tokens.curr.led?left=state.tokens.curr.led(left):error(\"E033\",state.tokens.curr,state.tokens.curr.id);return isLetExpr&&state.funct[\"(scope)\"].unstack(),state.nameStack.pop(),left}function startLine(token){return token.startLine||token.line}function nobreaknonadjacent(left,right){left=left||state.tokens.curr,right=right||state.tokens.next,state.option.laxbreak||left.line===startLine(right)||warning(\"W014\",right,right.value)}function nolinebreak(t){t=t||state.tokens.curr,t.line!==startLine(state.tokens.next)&&warning(\"E022\",t,t.value)}function nobreakcomma(left,right){left.line!==startLine(right)&&(state.option.laxcomma||(comma.first&&(warning(\"I001\"),comma.first=!1),warning(\"W014\",left,right.value)))}function comma(opts){if(opts=opts||{},opts.peek?nobreakcomma(state.tokens.prev,state.tokens.curr):(nobreakcomma(state.tokens.curr,state.tokens.next),advance(\",\")),state.tokens.next.identifier&&(!opts.property||!state.inES5()))switch(state.tokens.next.value){case\"break\":case\"case\":case\"catch\":case\"continue\":case\"default\":case\"do\":case\"else\":case\"finally\":case\"for\":case\"if\":case\"in\":case\"instanceof\":case\"return\":case\"switch\":case\"throw\":case\"try\":case\"var\":case\"let\":case\"while\":case\"with\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}if(\"(punctuator)\"===state.tokens.next.type)switch(state.tokens.next.value){case\"}\":case\"]\":case\",\":if(opts.allowTrailing)return!0;case\")\":return error(\"E024\",state.tokens.next,state.tokens.next.value),!1}return!0}function symbol(s,p){var x=state.syntax[s];return x&&\"object\"==typeof x||(state.syntax[s]=x={id:s,lbp:p,value:s}),x}function delim(s){var x=symbol(s,0);return x.delim=!0,x}function stmt(s,f){var x=delim(s);return x.identifier=x.reserved=!0,x.fud=f,x}function blockstmt(s,f){var x=stmt(s,f);return x.block=!0,x}function reserveName(x){var c=x.id.charAt(0);return(c>=\"a\"&&\"z\">=c||c>=\"A\"&&\"Z\">=c)&&(x.identifier=x.reserved=!0),x}function prefix(s,f){var x=symbol(s,150);return reserveName(x),x.nud=\"function\"==typeof f?f:function(){return this.arity=\"unary\",this.right=expression(150),(\"++\"===this.id||\"--\"===this.id)&&(state.option.plusplus?warning(\"W016\",this,this.id):!this.right||this.right.identifier&&!isReserved(this.right)||\".\"===this.right.id||\"[\"===this.right.id||warning(\"W017\",this),this.right&&this.right.isMetaProperty?error(\"E031\",this):this.right&&this.right.identifier&&state.funct[\"(scope)\"].block.modify(this.right.value,this)),this},x}function type(s,f){var x=delim(s);return x.type=s,x.nud=f,x}function reserve(name,func){var x=type(name,func);return x.identifier=!0,x.reserved=!0,x}function FutureReservedWord(name,meta){var x=type(name,meta&&meta.nud||function(){return this});return meta=meta||{},meta.isFutureReservedWord=!0,x.value=name,x.identifier=!0,x.reserved=!0,x.meta=meta,x}function reservevar(s,v){return reserve(s,function(){return\"function\"==typeof v&&v(this),this})}function infix(s,f,p,w){var x=symbol(s,p);return reserveName(x),x.infix=!0,x.led=function(left){return w||nobreaknonadjacent(state.tokens.prev,state.tokens.curr),\"in\"!==s&&\"instanceof\"!==s||\"!\"!==left.id||warning(\"W018\",left,\"!\"),\"function\"==typeof f?f(left,this):(this.left=left,this.right=expression(p),this)},x}function application(s){var x=symbol(s,42);return x.led=function(left){return nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left,this.right=doFunction({type:\"arrow\",loneArg:left}),this},x}function relation(s,f){var x=symbol(s,100);return x.led=function(left){nobreaknonadjacent(state.tokens.prev,state.tokens.curr),this.left=left;var right=this.right=expression(100);return isIdentifier(left,\"NaN\")||isIdentifier(right,\"NaN\")?warning(\"W019\",this):f&&f.apply(this,[left,right]),left&&right||quit(\"E041\",state.tokens.curr.line),\"!\"===left.id&&warning(\"W018\",left,\"!\"),\"!\"===right.id&&warning(\"W018\",right,\"!\"),this},x}function isPoorRelation(node){return node&&(\"(number)\"===node.type&&0===+node.value||\"(string)\"===node.type&&\"\"===node.value||\"null\"===node.type&&!state.option.eqnull||\"true\"===node.type||\"false\"===node.type||\"undefined\"===node.type)}function isTypoTypeof(left,right,state){var values;return state.option.notypeof?!1:left&&right?(values=state.inES6()?typeofValues.es6:typeofValues.es3,\"(identifier)\"===right.type&&\"typeof\"===right.value&&\"(string)\"===left.type?!_.contains(values,left.value):!1):!1}function isGlobalEval(left,state){var isGlobal=!1;return\"this\"===left.type&&null===state.funct[\"(context)\"]?isGlobal=!0:\"(identifier)\"===left.type&&(state.option.node&&\"global\"===left.value?isGlobal=!0:!state.option.browser||\"window\"!==left.value&&\"document\"!==left.value||(isGlobal=!0)),isGlobal}function findNativePrototype(left){function walkPrototype(obj){return\"object\"==typeof obj?\"prototype\"===obj.right?obj:walkPrototype(obj.left):void 0}function walkNative(obj){for(;!obj.identifier&&\"object\"==typeof obj.left;)obj=obj.left;return obj.identifier&&natives.indexOf(obj.value)>=0?obj.value:void 0}var natives=[\"Array\",\"ArrayBuffer\",\"Boolean\",\"Collator\",\"DataView\",\"Date\",\"DateTimeFormat\",\"Error\",\"EvalError\",\"Float32Array\",\"Float64Array\",\"Function\",\"Infinity\",\"Intl\",\"Int16Array\",\"Int32Array\",\"Int8Array\",\"Iterator\",\"Number\",\"NumberFormat\",\"Object\",\"RangeError\",\"ReferenceError\",\"RegExp\",\"StopIteration\",\"String\",\"SyntaxError\",\"TypeError\",\"Uint16Array\",\"Uint32Array\",\"Uint8Array\",\"Uint8ClampedArray\",\"URIError\"],prototype=walkPrototype(left);return prototype?walkNative(prototype):void 0}function checkLeftSideAssign(left,assignToken,options){var allowDestructuring=options&&options.allowDestructuring;if(assignToken=assignToken||left,state.option.freeze){var nativeObject=findNativePrototype(left);nativeObject&&warning(\"W121\",left,nativeObject)}return left.identifier&&!left.isMetaProperty&&state.funct[\"(scope)\"].block.reassign(left.value,left),\".\"===left.id?((!left.left||\"arguments\"===left.left.value&&!state.isStrict())&&warning(\"E031\",assignToken),state.nameStack.set(state.tokens.prev),!0):\"{\"===left.id||\"[\"===left.id?(allowDestructuring&&state.tokens.curr.left.destructAssign?state.tokens.curr.left.destructAssign.forEach(function(t){t.id&&state.funct[\"(scope)\"].block.modify(t.id,t.token)}):\"{\"!==left.id&&left.left?\"arguments\"!==left.left.value||state.isStrict()||warning(\"E031\",assignToken):warning(\"E031\",assignToken),\"[\"===left.id&&state.nameStack.set(left.right),!0):left.isMetaProperty?(error(\"E031\",assignToken),!0):left.identifier&&!isReserved(left)?(\"exception\"===state.funct[\"(scope)\"].labeltype(left.value)&&warning(\"W022\",left),state.nameStack.set(left),!0):(left===state.syntax[\"function\"]&&warning(\"W023\",state.tokens.curr),!1)}function assignop(s,f,p){var x=infix(s,\"function\"==typeof f?f:function(left,that){return that.left=left,left&&checkLeftSideAssign(left,that,{allowDestructuring:!0})?(that.right=expression(10),that):(error(\"E031\",that),void 0)},p);return x.exps=!0,x.assign=!0,x}function bitwise(s,f,p){var x=symbol(s,p);return reserveName(x),x.led=\"function\"==typeof f?f:function(left){return state.option.bitwise&&warning(\"W016\",this,this.id),this.left=left,this.right=expression(p),this},x}function bitwiseassignop(s){return assignop(s,function(left,that){return state.option.bitwise&&warning(\"W016\",that,that.id),left&&checkLeftSideAssign(left,that)?(that.right=expression(10),that):(error(\"E031\",that),void 0)},20)}function suffix(s){var x=symbol(s,150);return x.led=function(left){return state.option.plusplus?warning(\"W016\",this,this.id):left.identifier&&!isReserved(left)||\".\"===left.id||\"[\"===left.id||warning(\"W017\",this),left.isMetaProperty?error(\"E031\",this):left&&left.identifier&&state.funct[\"(scope)\"].block.modify(left.value,left),this.left=left,this},x}function optionalidentifier(fnparam,prop,preserve){if(state.tokens.next.identifier){preserve||advance();var curr=state.tokens.curr,val=state.tokens.curr.value;return isReserved(curr)?prop&&state.inES5()?val:fnparam&&\"undefined\"===val?val:(warning(\"W024\",state.tokens.curr,state.tokens.curr.id),val):val}}function identifier(fnparam,prop){var i=optionalidentifier(fnparam,prop,!1);if(i)return i;if(\"...\"===state.tokens.next.value){if(state.inES6(!0)||warning(\"W119\",state.tokens.next,\"spread/rest operator\",\"6\"),advance(),checkPunctuator(state.tokens.next,\"...\"))for(warning(\"E024\",state.tokens.next,\"...\");checkPunctuator(state.tokens.next,\"...\");)advance();return state.tokens.next.identifier?identifier(fnparam,prop):(warning(\"E024\",state.tokens.curr,\"...\"),void 0)}error(\"E030\",state.tokens.next,state.tokens.next.value),\";\"!==state.tokens.next.id&&advance()}function reachable(controlToken){var t,i=0;if(\";\"===state.tokens.next.id&&!controlToken.inBracelessBlock)for(;;){do t=peek(i),i+=1;while(\"(end)\"!==t.id&&\"(comment)\"===t.id);if(t.reach)return;if(\"(endline)\"!==t.id){if(\"function\"===t.id){state.option.latedef===!0&&warning(\"W026\",t);break}warning(\"W027\",t,t.value,controlToken.value);break}}}function parseFinalSemicolon(){if(\";\"!==state.tokens.next.id){if(state.tokens.next.isUnclosed)return advance();var sameLine=startLine(state.tokens.next)===state.tokens.curr.line&&\"(end)\"!==state.tokens.next.id,blockEnd=checkPunctuator(state.tokens.next,\"}\");sameLine&&!blockEnd?errorAt(\"E058\",state.tokens.curr.line,state.tokens.curr.character):state.option.asi||(blockEnd&&!state.option.lastsemic||!sameLine)&&warningAt(\"W033\",state.tokens.curr.line,state.tokens.curr.character)}else advance(\";\")}function statement(){var r,i=indent,t=state.tokens.next,hasOwnScope=!1;if(\";\"===t.id)return advance(\";\"),void 0;var res=isReserved(t);if(res&&t.meta&&t.meta.isFutureReservedWord&&\":\"===peek().id&&(warning(\"W024\",t,t.id),res=!1),t.identifier&&!res&&\":\"===peek().id&&(advance(),advance(\":\"),hasOwnScope=!0,state.funct[\"(scope)\"].stack(),state.funct[\"(scope)\"].block.addBreakLabel(t.value,{token:state.tokens.curr}),state.tokens.next.labelled||\"{\"===state.tokens.next.value||warning(\"W028\",state.tokens.next,t.value,state.tokens.next.value),state.tokens.next.label=t.value,t=state.tokens.next),\"{\"===t.id){var iscase=\"case\"===state.funct[\"(verb)\"]&&\":\"===state.tokens.curr.value;return block(!0,!0,!1,!1,iscase),void 0}return r=expression(0,!0),!r||r.identifier&&\"function\"===r.value||\"(punctuator)\"===r.type&&r.left&&r.left.identifier&&\"function\"===r.left.value||state.isStrict()||\"global\"!==state.option.strict||warning(\"E007\"),t.block||(state.option.expr||r&&r.exps?state.option.nonew&&r&&r.left&&\"(\"===r.id&&\"new\"===r.left.id&&warning(\"W031\",t):warning(\"W030\",state.tokens.curr),parseFinalSemicolon()),indent=i,hasOwnScope&&state.funct[\"(scope)\"].unstack(),r}function statements(){for(var p,a=[];!state.tokens.next.reach&&\"(end)\"!==state.tokens.next.id;)\";\"===state.tokens.next.id?(p=peek(),(!p||\"(\"!==p.id&&\"[\"!==p.id)&&warning(\"W032\"),advance(\";\")):a.push(statement());return a}function directives(){for(var i,p,pn;\"(string)\"===state.tokens.next.id;){if(p=peek(0),\"(endline)\"===p.id){i=1;do pn=peek(i++);while(\"(endline)\"===pn.id);if(\";\"===pn.id)p=pn;else{if(\"[\"===pn.value||\".\"===pn.value)break;state.option.asi&&\"(\"!==pn.value||warning(\"W033\",state.tokens.next)}}else{if(\".\"===p.id||\"[\"===p.id)break;\";\"!==p.id&&warning(\"W033\",p)}advance();var directive=state.tokens.curr.value;(state.directive[directive]||\"use strict\"===directive&&\"implied\"===state.option.strict)&&warning(\"W034\",state.tokens.curr,directive),state.directive[directive]=!0,\";\"===p.id&&advance(\";\")}state.isStrict()&&(state.option[\"(explicitNewcap)\"]||(state.option.newcap=!0),state.option.undef=!0)}function block(ordinary,stmt,isfunc,isfatarrow,iscase){var a,m,t,line,d,b=inblock,old_indent=indent;inblock=ordinary,t=state.tokens.next;var metrics=state.funct[\"(metrics)\"];if(metrics.nestedBlockDepth+=1,metrics.verifyMaxNestedBlockDepthPerFunction(),\"{\"===state.tokens.next.id){if(advance(\"{\"),state.funct[\"(scope)\"].stack(),line=state.tokens.curr.line,\"}\"!==state.tokens.next.id){for(indent+=state.option.indent;!ordinary&&state.tokens.next.from>indent;)indent+=state.option.indent;if(isfunc){m={};for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);directives(),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\"))}a=statements(),metrics.statementCount+=a.length,indent-=state.option.indent}advance(\"}\",t),isfunc&&(state.funct[\"(scope)\"].validateParams(),m&&(state.directive=m)),state.funct[\"(scope)\"].unstack(),indent=old_indent}else if(ordinary)state.funct[\"(noblockscopedvar)\"]=\"for\"!==state.tokens.next.id,state.funct[\"(scope)\"].stack(),(!stmt||state.option.curly)&&warning(\"W116\",state.tokens.next,\"{\",state.tokens.next.value),state.tokens.next.inBracelessBlock=!0,indent+=state.option.indent,a=[statement()],indent-=state.option.indent,state.funct[\"(scope)\"].unstack(),delete state.funct[\"(noblockscopedvar)\"];else if(isfunc){if(state.funct[\"(scope)\"].stack(),m={},!stmt||isfatarrow||state.inMoz()||error(\"W118\",state.tokens.curr,\"function closure expressions\"),!stmt)for(d in state.directive)_.has(state.directive,d)&&(m[d]=state.directive[d]);expression(10),state.option.strict&&state.funct[\"(context)\"][\"(global)\"]&&(m[\"use strict\"]||state.isStrict()||warning(\"E007\")),state.funct[\"(scope)\"].unstack()}else error(\"E021\",state.tokens.next,\"{\",state.tokens.next.value);switch(state.funct[\"(verb)\"]){case\"break\":case\"continue\":case\"return\":case\"throw\":if(iscase)break;default:state.funct[\"(verb)\"]=null}return inblock=b,!ordinary||!state.option.noempty||a&&0!==a.length||warning(\"W035\",state.tokens.prev),metrics.nestedBlockDepth-=1,a}function countMember(m){membersOnly&&\"boolean\"!=typeof membersOnly[m]&&warning(\"W036\",state.tokens.curr,m),\"number\"==typeof member[m]?member[m]+=1:member[m]=1}function comprehensiveArrayExpression(){var res={};res.exps=!0,state.funct[\"(comparray)\"].stack();var reversed=!1;return\"for\"!==state.tokens.next.value&&(reversed=!0,state.inMoz()||warning(\"W116\",state.tokens.next,\"for\",state.tokens.next.value),state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"for\"),\"each\"===state.tokens.next.value&&(advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"define\"),res.left=expression(130),_.contains([\"in\",\"of\"],state.tokens.next.value)?advance():error(\"E045\",state.tokens.curr),state.funct[\"(comparray)\"].setState(\"generate\"),expression(10),advance(\")\"),\"if\"===state.tokens.next.value&&(advance(\"if\"),advance(\"(\"),state.funct[\"(comparray)\"].setState(\"filter\"),res.filter=expression(10),advance(\")\")),reversed||(state.funct[\"(comparray)\"].setState(\"use\"),res.right=expression(10)),advance(\"]\"),state.funct[\"(comparray)\"].unstack(),res}function isMethod(){return state.funct[\"(statement)\"]&&\"class\"===state.funct[\"(statement)\"].type||state.funct[\"(context)\"]&&\"class\"===state.funct[\"(context)\"][\"(verb)\"]}function isPropertyName(token){return token.identifier||\"(string)\"===token.id||\"(number)\"===token.id}function propertyName(preserveOrToken){var id,preserve=!0;return\"object\"==typeof preserveOrToken?id=preserveOrToken:(preserve=preserveOrToken,id=optionalidentifier(!1,!0,preserve)),id?\"object\"==typeof id&&(\"(string)\"===id.id||\"(identifier)\"===id.id?id=id.value:\"(number)\"===id.id&&(id=\"\"+id.value)):\"(string)\"===state.tokens.next.id?(id=state.tokens.next.value,preserve||advance()):\"(number)\"===state.tokens.next.id&&(id=\"\"+state.tokens.next.value,preserve||advance()),\"hasOwnProperty\"===id&&warning(\"W001\"),id}function functionparams(options){function addParam(addParamArgs){state.funct[\"(scope)\"].addParam.apply(state.funct[\"(scope)\"],addParamArgs)}var next,ident,t,paramsIds=[],tokens=[],pastDefault=!1,pastRest=!1,arity=0,loneArg=options&&options.loneArg;if(loneArg&&loneArg.identifier===!0)return state.funct[\"(scope)\"].addParam(loneArg.value,loneArg),{arity:1,params:[loneArg.value]};if(next=state.tokens.next,options&&options.parsedOpening||advance(\"(\"),\")\"===state.tokens.next.id)return advance(\")\"),void 0;for(;;){arity++;var currentParams=[];if(_.contains([\"{\",\"[\"],state.tokens.next.id)){tokens=destructuringPattern();for(t in tokens)t=tokens[t],t.id&&(paramsIds.push(t.id),currentParams.push([t.id,t.token]))}else if(checkPunctuator(state.tokens.next,\"...\")&&(pastRest=!0),ident=identifier(!0))paramsIds.push(ident),currentParams.push([ident,state.tokens.curr]);else for(;!checkPunctuators(state.tokens.next,[\",\",\")\"]);)advance();if(pastDefault&&\"=\"!==state.tokens.next.id&&error(\"W138\",state.tokens.current),\"=\"===state.tokens.next.id&&(state.inES6()||warning(\"W119\",state.tokens.next,\"default parameters\",\"6\"),advance(\"=\"),pastDefault=!0,expression(10)),currentParams.forEach(addParam),\",\"!==state.tokens.next.id)return advance(\")\",next),{arity:arity,params:paramsIds};pastRest&&warning(\"W131\",state.tokens.next),comma()}}function functor(name,token,overwrites){var funct={\"(name)\":name,\"(breakage)\":0,\"(loopage)\":0,\"(tokens)\":{},\"(properties)\":{},\"(catch)\":!1,\"(global)\":!1,\"(line)\":null,\"(character)\":null,\"(metrics)\":null,\"(statement)\":null,\"(context)\":null,\"(scope)\":null,\"(comparray)\":null,\"(generator)\":null,\"(arrow)\":null,\"(params)\":null};return token&&_.extend(funct,{\"(line)\":token.line,\"(character)\":token.character,\"(metrics)\":createMetrics(token)}),_.extend(funct,overwrites),funct[\"(context)\"]&&(funct[\"(scope)\"]=funct[\"(context)\"][\"(scope)\"],funct[\"(comparray)\"]=funct[\"(context)\"][\"(comparray)\"]),funct}function isFunctor(token){return\"(scope)\"in token}function hasParsedCode(funct){return funct[\"(global)\"]&&!funct[\"(verb)\"]}function doTemplateLiteral(left){function end(){if(state.tokens.curr.template&&state.tokens.curr.tail&&state.tokens.curr.context===ctx)return!0;var complete=state.tokens.next.template&&state.tokens.next.tail&&state.tokens.next.context===ctx;return complete&&advance(),complete||state.tokens.next.isUnclosed}var ctx=this.context,noSubst=this.noSubst,depth=this.depth;if(!noSubst)for(;!end();)!state.tokens.next.template||state.tokens.next.depth>depth?expression(0):advance();return{id:\"(template)\",type:\"(template)\",tag:left}}function doFunction(options){var f,token,name,statement,classExprBinding,isGenerator,isArrow,ignoreLoopFunc,oldOption=state.option,oldIgnored=state.ignored;options&&(name=options.name,statement=options.statement,classExprBinding=options.classExprBinding,isGenerator=\"generator\"===options.type,isArrow=\"arrow\"===options.type,ignoreLoopFunc=options.ignoreLoopFunc),state.option=Object.create(state.option),state.ignored=Object.create(state.ignored),state.funct=functor(name||state.nameStack.infer(),state.tokens.next,{\"(statement)\":statement,\"(context)\":state.funct,\"(arrow)\":isArrow,\"(generator)\":isGenerator}),f=state.funct,token=state.tokens.curr,token.funct=state.funct,functions.push(state.funct),state.funct[\"(scope)\"].stack(\"functionouter\");var internallyAccessibleName=name||classExprBinding;internallyAccessibleName&&state.funct[\"(scope)\"].block.add(internallyAccessibleName,classExprBinding?\"class\":\"function\",state.tokens.curr,!1),state.funct[\"(scope)\"].stack(\"functionparams\");var paramsInfo=functionparams(options);return paramsInfo?(state.funct[\"(params)\"]=paramsInfo.params,state.funct[\"(metrics)\"].arity=paramsInfo.arity,state.funct[\"(metrics)\"].verifyMaxParametersPerFunction()):state.funct[\"(metrics)\"].arity=0,isArrow&&(state.inES6(!0)||warning(\"W119\",state.tokens.curr,\"arrow function syntax (=>)\",\"6\"),options.loneArg||advance(\"=>\")),block(!1,!0,!0,isArrow),!state.option.noyield&&isGenerator&&\"yielded\"!==state.funct[\"(generator)\"]&&warning(\"W124\",state.tokens.curr),state.funct[\"(metrics)\"].verifyMaxStatementsPerFunction(),state.funct[\"(metrics)\"].verifyMaxComplexityPerFunction(),state.funct[\"(unusedOption)\"]=state.option.unused,state.option=oldOption,state.ignored=oldIgnored,state.funct[\"(last)\"]=state.tokens.curr.line,state.funct[\"(lastcharacter)\"]=state.tokens.curr.character,state.funct[\"(scope)\"].unstack(),state.funct[\"(scope)\"].unstack(),state.funct=state.funct[\"(context)\"],ignoreLoopFunc||state.option.loopfunc||!state.funct[\"(loopage)\"]||f[\"(isCapturing)\"]&&warning(\"W083\",token),f}function createMetrics(functionStartToken){return{statementCount:0,nestedBlockDepth:-1,ComplexityCount:1,arity:0,verifyMaxStatementsPerFunction:function(){state.option.maxstatements&&this.statementCount>state.option.maxstatements&&warning(\"W071\",functionStartToken,this.statementCount)\n},verifyMaxParametersPerFunction:function(){_.isNumber(state.option.maxparams)&&this.arity>state.option.maxparams&&warning(\"W072\",functionStartToken,this.arity)},verifyMaxNestedBlockDepthPerFunction:function(){state.option.maxdepth&&this.nestedBlockDepth>0&&this.nestedBlockDepth===state.option.maxdepth+1&&warning(\"W073\",null,this.nestedBlockDepth)},verifyMaxComplexityPerFunction:function(){var max=state.option.maxcomplexity,cc=this.ComplexityCount;max&&cc>max&&warning(\"W074\",functionStartToken,cc)}}}function increaseComplexityCount(){state.funct[\"(metrics)\"].ComplexityCount+=1}function checkCondAssignment(expr){var id,paren;switch(expr&&(id=expr.id,paren=expr.paren,\",\"===id&&(expr=expr.exprs[expr.exprs.length-1])&&(id=expr.id,paren=paren||expr.paren)),id){case\"=\":case\"+=\":case\"-=\":case\"*=\":case\"%=\":case\"&=\":case\"|=\":case\"^=\":case\"/=\":paren||state.option.boss||warning(\"W084\")}}function checkProperties(props){if(state.inES5())for(var name in props)props[name]&&props[name].setterToken&&!props[name].getterToken&&warning(\"W078\",props[name].setterToken)}function metaProperty(name,c){if(checkPunctuator(state.tokens.next,\".\")){var left=state.tokens.curr.id;advance(\".\");var id=identifier();return state.tokens.curr.isMetaProperty=!0,name!==id?error(\"E057\",state.tokens.prev,left,id):c(),state.tokens.curr}}function destructuringPattern(options){var isAssignment=options&&options.assignment;return state.inES6()||warning(\"W104\",state.tokens.curr,isAssignment?\"destructuring assignment\":\"destructuring binding\",\"6\"),destructuringPatternRecursive(options)}function destructuringPatternRecursive(options){var ids,identifiers=[],openingParsed=options&&options.openingParsed,isAssignment=options&&options.assignment,recursiveOptions=isAssignment?{assignment:isAssignment}:null,firstToken=openingParsed?state.tokens.curr:state.tokens.next,nextInnerDE=function(){var ident;if(checkPunctuators(state.tokens.next,[\"[\",\"{\"])){ids=destructuringPatternRecursive(recursiveOptions);for(var id in ids)id=ids[id],identifiers.push({id:id.id,token:id.token})}else if(checkPunctuator(state.tokens.next,\",\"))identifiers.push({id:null,token:state.tokens.curr});else{if(!checkPunctuator(state.tokens.next,\"(\")){var is_rest=checkPunctuator(state.tokens.next,\"...\");if(isAssignment){var identifierToken=is_rest?peek(0):state.tokens.next;identifierToken.identifier||warning(\"E030\",identifierToken,identifierToken.value);var assignTarget=expression(155);assignTarget&&(checkLeftSideAssign(assignTarget),assignTarget.identifier&&(ident=assignTarget.value))}else ident=identifier();return ident&&identifiers.push({id:ident,token:state.tokens.curr}),is_rest}advance(\"(\"),nextInnerDE(),advance(\")\")}return!1},assignmentProperty=function(){var id;checkPunctuator(state.tokens.next,\"[\")?(advance(\"[\"),expression(10),advance(\"]\"),advance(\":\"),nextInnerDE()):\"(string)\"===state.tokens.next.id||\"(number)\"===state.tokens.next.id?(advance(),advance(\":\"),nextInnerDE()):(id=identifier(),checkPunctuator(state.tokens.next,\":\")?(advance(\":\"),nextInnerDE()):id&&(isAssignment&&checkLeftSideAssign(state.tokens.curr),identifiers.push({id:id,token:state.tokens.curr})))};if(checkPunctuator(firstToken,\"[\")){openingParsed||advance(\"[\"),checkPunctuator(state.tokens.next,\"]\")&&warning(\"W137\",state.tokens.curr);for(var element_after_rest=!1;!checkPunctuator(state.tokens.next,\"]\");)nextInnerDE()&&!element_after_rest&&checkPunctuator(state.tokens.next,\",\")&&(warning(\"W130\",state.tokens.next),element_after_rest=!0),checkPunctuator(state.tokens.next,\"=\")&&(checkPunctuator(state.tokens.prev,\"...\")?advance(\"]\"):advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"]\")||advance(\",\");advance(\"]\")}else if(checkPunctuator(firstToken,\"{\")){for(openingParsed||advance(\"{\"),checkPunctuator(state.tokens.next,\"}\")&&warning(\"W137\",state.tokens.curr);!checkPunctuator(state.tokens.next,\"}\")&&(assignmentProperty(),checkPunctuator(state.tokens.next,\"=\")&&(advance(\"=\"),\"undefined\"===state.tokens.next.id&&warning(\"W080\",state.tokens.prev,state.tokens.prev.value),expression(10)),checkPunctuator(state.tokens.next,\"}\")||(advance(\",\"),!checkPunctuator(state.tokens.next,\"}\"))););advance(\"}\")}return identifiers}function destructuringPatternMatch(tokens,value){var first=value.first;first&&_.zip(tokens,Array.isArray(first)?first:[first]).forEach(function(val){var token=val[0],value=val[1];token&&value?token.first=value:token&&token.first&&!value&&warning(\"W080\",token.first,token.first.value)})}function blockVariableStatement(type,statement,context){var tokens,lone,value,letblock,prefix=context&&context.prefix,inexport=context&&context.inexport,isLet=\"let\"===type,isConst=\"const\"===type;for(state.inES6()||warning(\"W104\",state.tokens.curr,type,\"6\"),isLet&&\"(\"===state.tokens.next.value?(state.inMoz()||warning(\"W118\",state.tokens.next,\"let block\"),advance(\"(\"),state.funct[\"(scope)\"].stack(),letblock=!0):state.funct[\"(noblockscopedvar)\"]&&error(\"E048\",state.tokens.curr,isConst?\"Const\":\"Let\"),statement.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),!prefix&&isConst&&\"=\"!==state.tokens.next.id&&warning(\"E012\",state.tokens.curr,state.tokens.curr.value);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],state.funct[\"(scope)\"].block.isGlobal()&&predefined[t.id]===!1&&warning(\"W079\",t.token,t.id),t.id&&!state.funct[\"(noblockscopedvar)\"]&&(state.funct[\"(scope)\"].addlabel(t.id,{type:type,token:t.token}),names.push(t.token),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.token.value,t.token)));if(\"=\"===state.tokens.next.id&&(advance(\"=\"),prefix||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),!prefix&&\"=\"===peek(0).id&&state.tokens.next.identifier&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),statement.first=statement.first.concat(names),\",\"!==state.tokens.next.id)break;comma()}return letblock&&(advance(\")\"),block(!0,!0),statement.block=!0,state.funct[\"(scope)\"].unstack()),statement}function classdef(isStatement){return state.inES6()||warning(\"W104\",state.tokens.curr,\"class\",\"6\"),isStatement?(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"class\",token:state.tokens.curr})):state.tokens.next.identifier&&\"extends\"!==state.tokens.next.value?(this.name=identifier(),this.namedExpr=!0):this.name=state.nameStack.infer(),classtail(this),this}function classtail(c){var wasInClassBody=state.inClassBody;\"extends\"===state.tokens.next.value&&(advance(\"extends\"),c.heritage=expression(10)),state.inClassBody=!0,advance(\"{\"),c.body=classbody(c),advance(\"}\"),state.inClassBody=wasInClassBody}function classbody(c){for(var name,isStatic,isGenerator,getset,computed,props=Object.create(null),staticProps=Object.create(null),i=0;\"}\"!==state.tokens.next.id;++i)if(name=state.tokens.next,isStatic=!1,isGenerator=!1,getset=null,\";\"!==name.id){if(\"*\"===name.id&&(isGenerator=!0,advance(\"*\"),name=state.tokens.next),\"[\"===name.id)name=computedPropertyName(),computed=!0;else{if(!isPropertyName(name)){warning(\"W052\",state.tokens.next,state.tokens.next.value||state.tokens.next.type),advance();continue}advance(),computed=!1,name.identifier&&\"static\"===name.value&&(checkPunctuator(state.tokens.next,\"*\")&&(isGenerator=!0,advance(\"*\")),(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,isStatic=!0,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())),!name.identifier||\"get\"!==name.value&&\"set\"!==name.value||(isPropertyName(state.tokens.next)||\"[\"===state.tokens.next.id)&&(computed=\"[\"===state.tokens.next.id,getset=name,name=state.tokens.next,\"[\"===state.tokens.next.id?name=computedPropertyName():advance())}if(!checkPunctuator(state.tokens.next,\"(\")){for(error(\"E054\",state.tokens.next,state.tokens.next.value);\"}\"!==state.tokens.next.id&&!checkPunctuator(state.tokens.next,\"(\");)advance();\"(\"!==state.tokens.next.value&&doFunction({statement:c})}if(computed||(getset?saveAccessor(getset.value,isStatic?staticProps:props,name.value,name,!0,isStatic):(\"constructor\"===name.value?state.nameStack.set(c):state.nameStack.set(name),saveProperty(isStatic?staticProps:props,name.value,name,!0,isStatic))),getset&&\"constructor\"===name.value){var propDesc=\"get\"===getset.value?\"class getter method\":\"class setter method\";error(\"E049\",name,propDesc,\"constructor\")}else\"prototype\"===name.value&&error(\"E049\",name,\"class method\",\"prototype\");propertyName(name),doFunction({statement:c,type:isGenerator?\"generator\":null,classExprBinding:c.namedExpr?c.name:null})}else warning(\"W032\"),advance(\";\");checkProperties(props)}function saveProperty(props,name,tkn,isClass,isStatic){var msg=[\"key\",\"class method\",\"static class method\"];msg=msg[(isClass||!1)+(isStatic||!1)],tkn.identifier&&(name=tkn.value),props[name]&&\"__proto__\"!==name?warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name].basic=!0,props[name].basictkn=tkn}function saveAccessor(accessorType,props,name,tkn,isClass,isStatic){var flagName=\"get\"===accessorType?\"getterToken\":\"setterToken\",msg=\"\";isClass?(isStatic&&(msg+=\"static \"),msg+=accessorType+\"ter method\"):msg=\"key\",state.tokens.curr.accessorType=accessorType,state.nameStack.set(tkn),props[name]?(props[name].basic||props[name][flagName])&&\"__proto__\"!==name&&warning(\"W075\",state.tokens.next,msg,name):props[name]=Object.create(null),props[name][flagName]=tkn}function computedPropertyName(){advance(\"[\"),state.inES6()||warning(\"W119\",state.tokens.curr,\"computed property names\",\"6\");var value=expression(10);return advance(\"]\"),value}function checkPunctuators(token,values){return\"(punctuator)\"===token.type?_.contains(values,token.value):!1}function checkPunctuator(token,value){return\"(punctuator)\"===token.type&&token.value===value}function destructuringAssignOrJsonValue(){var block=lookupBlockType();block.notJson?(!state.inES6()&&block.isDestAssign&&warning(\"W104\",state.tokens.curr,\"destructuring assignment\",\"6\"),statements()):(state.option.laxbreak=!0,state.jsonMode=!0,jsonValue())}function jsonValue(){function jsonObject(){var o={},t=state.tokens.next;if(advance(\"{\"),\"}\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E026\",state.tokens.next,t.line);else{if(\"}\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id?error(\"E028\",state.tokens.next):\"(string)\"!==state.tokens.next.id&&warning(\"W095\",state.tokens.next,state.tokens.next.value)}if(o[state.tokens.next.value]===!0?warning(\"W075\",state.tokens.next,\"key\",state.tokens.next.value):\"__proto__\"===state.tokens.next.value&&!state.option.proto||\"__iterator__\"===state.tokens.next.value&&!state.option.iterator?warning(\"W096\",state.tokens.next,state.tokens.next.value):o[state.tokens.next.value]=!0,advance(),advance(\":\"),jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"}\")}function jsonArray(){var t=state.tokens.next;if(advance(\"[\"),\"]\"!==state.tokens.next.id)for(;;){if(\"(end)\"===state.tokens.next.id)error(\"E027\",state.tokens.next,t.line);else{if(\"]\"===state.tokens.next.id){warning(\"W094\",state.tokens.curr);break}\",\"===state.tokens.next.id&&error(\"E028\",state.tokens.next)}if(jsonValue(),\",\"!==state.tokens.next.id)break;advance(\",\")}advance(\"]\")}switch(state.tokens.next.id){case\"{\":jsonObject();break;case\"[\":jsonArray();break;case\"true\":case\"false\":case\"null\":case\"(number)\":case\"(string)\":advance();break;case\"-\":advance(\"-\"),advance(\"(number)\");break;default:error(\"E003\",state.tokens.next)}}var api,declared,functions,inblock,indent,lookahead,lex,member,membersOnly,predefined,stack,urls,bang={\"<\":!0,\"<=\":!0,\"==\":!0,\"===\":!0,\"!==\":!0,\"!=\":!0,\">\":!0,\">=\":!0,\"+\":!0,\"-\":!0,\"*\":!0,\"/\":!0,\"%\":!0},functionicity=[\"closure\",\"exception\",\"global\",\"label\",\"outer\",\"unused\",\"var\"],extraModules=[],emitter=new events.EventEmitter,typeofValues={};typeofValues.legacy=[\"xml\",\"unknown\"],typeofValues.es3=[\"undefined\",\"boolean\",\"number\",\"string\",\"function\",\"object\"],typeofValues.es3=typeofValues.es3.concat(typeofValues.legacy),typeofValues.es6=typeofValues.es3.concat(\"symbol\"),type(\"(number)\",function(){return this}),type(\"(string)\",function(){return this}),state.syntax[\"(identifier)\"]={type:\"(identifier)\",lbp:0,identifier:!0,nud:function(){var v=this.value;return\"=>\"===state.tokens.next.id?this:(state.funct[\"(comparray)\"].check(v)||state.funct[\"(scope)\"].block.use(v,state.tokens.curr),this)},led:function(){error(\"E033\",state.tokens.next,state.tokens.next.value)}};var baseTemplateSyntax={lbp:0,identifier:!1,template:!0};state.syntax[\"(template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template middle)\"]=_.extend({type:\"(template middle)\",middle:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(template tail)\"]=_.extend({type:\"(template tail)\",tail:!0,noSubst:!1},baseTemplateSyntax),state.syntax[\"(no subst template)\"]=_.extend({type:\"(template)\",nud:doTemplateLiteral,led:doTemplateLiteral,noSubst:!0,tail:!0},baseTemplateSyntax),type(\"(regexp)\",function(){return this}),delim(\"(endline)\"),delim(\"(begin)\"),delim(\"(end)\").reach=!0,delim(\"(error)\").reach=!0,delim(\"}\").reach=!0,delim(\")\"),delim(\"]\"),delim('\"').reach=!0,delim(\"'\").reach=!0,delim(\";\"),delim(\":\").reach=!0,delim(\"#\"),reserve(\"else\"),reserve(\"case\").reach=!0,reserve(\"catch\"),reserve(\"default\").reach=!0,reserve(\"finally\"),reservevar(\"arguments\",function(x){state.isStrict()&&state.funct[\"(global)\"]&&warning(\"E008\",x)}),reservevar(\"eval\"),reservevar(\"false\"),reservevar(\"Infinity\"),reservevar(\"null\"),reservevar(\"this\",function(x){state.isStrict()&&!isMethod()&&!state.option.validthis&&(state.funct[\"(statement)\"]&&state.funct[\"(name)\"].charAt(0)>\"Z\"||state.funct[\"(global)\"])&&warning(\"W040\",x)}),reservevar(\"true\"),reservevar(\"undefined\"),assignop(\"=\",\"assign\",20),assignop(\"+=\",\"assignadd\",20),assignop(\"-=\",\"assignsub\",20),assignop(\"*=\",\"assignmult\",20),assignop(\"/=\",\"assigndiv\",20).nud=function(){error(\"E014\")},assignop(\"%=\",\"assignmod\",20),bitwiseassignop(\"&=\"),bitwiseassignop(\"|=\"),bitwiseassignop(\"^=\"),bitwiseassignop(\"<<=\"),bitwiseassignop(\">>=\"),bitwiseassignop(\">>>=\"),infix(\",\",function(left,that){var expr;if(that.exprs=[left],state.option.nocomma&&warning(\"W127\"),!comma({peek:!0}))return that;for(;;){if(!(expr=expression(10)))break;if(that.exprs.push(expr),\",\"!==state.tokens.next.value||!comma())break}return that},10,!0),infix(\"?\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(10),advance(\":\"),that[\"else\"]=expression(10),that},30);var orPrecendence=40;infix(\"||\",function(left,that){return increaseComplexityCount(),that.left=left,that.right=expression(orPrecendence),that},orPrecendence),infix(\"&&\",\"and\",50),bitwise(\"|\",\"bitor\",70),bitwise(\"^\",\"bitxor\",80),bitwise(\"&\",\"bitand\",90),relation(\"==\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));switch(!0){case!eqnull&&state.option.eqeqeq:this.from=this.character,warning(\"W116\",this,\"===\",\"==\");break;case isPoorRelation(left):warning(\"W041\",this,\"===\",left.value);break;case isPoorRelation(right):warning(\"W041\",this,\"===\",right.value);break;case isTypoTypeof(right,left,state):warning(\"W122\",this,right.value);break;case isTypoTypeof(left,right,state):warning(\"W122\",this,left.value)}return this}),relation(\"===\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!=\",function(left,right){var eqnull=state.option.eqnull&&(\"null\"===(left&&left.value)||\"null\"===(right&&right.value));return!eqnull&&state.option.eqeqeq?(this.from=this.character,warning(\"W116\",this,\"!==\",\"!=\")):isPoorRelation(left)?warning(\"W041\",this,\"!==\",left.value):isPoorRelation(right)?warning(\"W041\",this,\"!==\",right.value):isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"!==\",function(left,right){return isTypoTypeof(right,left,state)?warning(\"W122\",this,right.value):isTypoTypeof(left,right,state)&&warning(\"W122\",this,left.value),this}),relation(\"<\"),relation(\">\"),relation(\"<=\"),relation(\">=\"),bitwise(\"<<\",\"shiftleft\",120),bitwise(\">>\",\"shiftright\",120),bitwise(\">>>\",\"shiftrightunsigned\",120),infix(\"in\",\"in\",120),infix(\"instanceof\",\"instanceof\",120),infix(\"+\",function(left,that){var right;return that.left=left,that.right=right=expression(130),left&&right&&\"(string)\"===left.id&&\"(string)\"===right.id?(left.value+=right.value,left.character=right.character,!state.option.scripturl&®.javascriptURL.test(left.value)&&warning(\"W050\",left),left):that},130),prefix(\"+\",\"num\"),prefix(\"+++\",function(){return warning(\"W007\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"+++\",function(left){return warning(\"W007\"),this.left=left,this.right=expression(130),this},130),infix(\"-\",\"sub\",130),prefix(\"-\",\"neg\"),prefix(\"---\",function(){return warning(\"W006\"),this.arity=\"unary\",this.right=expression(150),this}),infix(\"---\",function(left){return warning(\"W006\"),this.left=left,this.right=expression(130),this},130),infix(\"*\",\"mult\",140),infix(\"/\",\"div\",140),infix(\"%\",\"mod\",140),suffix(\"++\"),prefix(\"++\",\"preinc\"),state.syntax[\"++\"].exps=!0,suffix(\"--\"),prefix(\"--\",\"predec\"),state.syntax[\"--\"].exps=!0,prefix(\"delete\",function(){var p=expression(10);return p?(\".\"!==p.id&&\"[\"!==p.id&&warning(\"W051\"),this.first=p,p.identifier&&!state.isStrict()&&(p.forgiveUndef=!0),this):this}).exps=!0,prefix(\"~\",function(){return state.option.bitwise&&warning(\"W016\",this,\"~\"),this.arity=\"unary\",this.right=expression(150),this}),prefix(\"...\",function(){return state.inES6(!0)||warning(\"W119\",this,\"spread/rest operator\",\"6\"),state.tokens.next.identifier||\"(string)\"===state.tokens.next.type||checkPunctuators(state.tokens.next,[\"[\",\"(\"])||error(\"E030\",state.tokens.next,state.tokens.next.value),expression(150),this}),prefix(\"!\",function(){return this.arity=\"unary\",this.right=expression(150),this.right||quit(\"E041\",this.line||0),bang[this.right.id]===!0&&warning(\"W018\",this,\"!\"),this}),prefix(\"typeof\",function(){var p=expression(150);return this.first=this.right=p,p||quit(\"E041\",this.line||0,this.character||0),p.identifier&&(p.forgiveUndef=!0),this}),prefix(\"new\",function(){var mp=metaProperty(\"target\",function(){state.inES6(!0)||warning(\"W119\",state.tokens.prev,\"new.target\",\"6\");for(var inFunction,c=state.funct;c&&(inFunction=!c[\"(global)\"],c[\"(arrow)\"]);)c=c[\"(context)\"];inFunction||warning(\"W136\",state.tokens.prev,\"new.target\")});if(mp)return mp;var i,c=expression(155);if(c&&\"function\"!==c.id)if(c.identifier)switch(c[\"new\"]=!0,c.value){case\"Number\":case\"String\":case\"Boolean\":case\"Math\":case\"JSON\":warning(\"W053\",state.tokens.prev,c.value);break;case\"Symbol\":state.inES6()&&warning(\"W053\",state.tokens.prev,c.value);break;case\"Function\":state.option.evil||warning(\"W054\");break;case\"Date\":case\"RegExp\":case\"this\":break;default:\"function\"!==c.id&&(i=c.value.substr(0,1),state.option.newcap&&(\"A\">i||i>\"Z\")&&!state.funct[\"(scope)\"].isPredefined(c.value)&&warning(\"W055\",state.tokens.curr))}else\".\"!==c.id&&\"[\"!==c.id&&\"(\"!==c.id&&warning(\"W056\",state.tokens.curr);else state.option.supernew||warning(\"W057\",this);return\"(\"===state.tokens.next.id||state.option.supernew||warning(\"W058\",state.tokens.curr,state.tokens.curr.value),this.first=this.right=c,this}),state.syntax[\"new\"].exps=!0,prefix(\"void\").exps=!0,infix(\".\",function(left,that){var m=identifier(!1,!0);return\"string\"==typeof m&&countMember(m),that.left=left,that.right=m,m&&\"hasOwnProperty\"===m&&\"=\"===state.tokens.next.value&&warning(\"W001\"),!left||\"arguments\"!==left.value||\"callee\"!==m&&\"caller\"!==m?state.option.evil||!left||\"document\"!==left.value||\"write\"!==m&&\"writeln\"!==m||warning(\"W060\",left):state.option.noarg?warning(\"W059\",left,m):state.isStrict()&&error(\"E008\"),state.option.evil||\"eval\"!==m&&\"execScript\"!==m||isGlobalEval(left,state)&&warning(\"W061\"),that},160,!0),infix(\"(\",function(left,that){state.option.immed&&left&&!left.immed&&\"function\"===left.id&&warning(\"W062\");var n=0,p=[];if(left&&\"(identifier)\"===left.type&&left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&-1===\"Array Number String Boolean Date Object Error Symbol\".indexOf(left.value)&&(\"Math\"===left.value?warning(\"W063\",left):state.option.newcap&&warning(\"W064\",left)),\")\"!==state.tokens.next.id)for(;p[p.length]=expression(10),n+=1,\",\"===state.tokens.next.id;)comma();return advance(\")\"),\"object\"==typeof left&&(state.inES5()||\"parseInt\"!==left.value||1!==n||warning(\"W065\",state.tokens.curr),state.option.evil||(\"eval\"===left.value||\"Function\"===left.value||\"execScript\"===left.value?(warning(\"W061\",left),p[0]&&\"(string)\"===[0].id&&addInternalSrc(left,p[0].value)):!p[0]||\"(string)\"!==p[0].id||\"setTimeout\"!==left.value&&\"setInterval\"!==left.value?!p[0]||\"(string)\"!==p[0].id||\".\"!==left.value||\"window\"!==left.left.value||\"setTimeout\"!==left.right&&\"setInterval\"!==left.right||(warning(\"W066\",left),addInternalSrc(left,p[0].value)):(warning(\"W066\",left),addInternalSrc(left,p[0].value))),left.identifier||\".\"===left.id||\"[\"===left.id||\"=>\"===left.id||\"(\"===left.id||\"&&\"===left.id||\"||\"===left.id||\"?\"===left.id||state.inES6()&&left[\"(name)\"]||warning(\"W067\",that)),that.left=left,that},155,!0).exps=!0,prefix(\"(\",function(){var pn1,ret,triggerFnExpr,first,last,pn=state.tokens.next,i=-1,parens=1,opening=state.tokens.curr,preceeding=state.tokens.prev,isNecessary=!state.option.singleGroups;do\"(\"===pn.value?parens+=1:\")\"===pn.value&&(parens-=1),i+=1,pn1=pn,pn=peek(i);while((0!==parens||\")\"!==pn1.value)&&\";\"!==pn.value&&\"(end)\"!==pn.type);if(\"function\"===state.tokens.next.id&&(triggerFnExpr=state.tokens.next.immed=!0),\"=>\"===pn.value)return doFunction({type:\"arrow\",parsedOpening:!0});var exprs=[];if(\")\"!==state.tokens.next.id)for(;exprs.push(expression(10)),\",\"===state.tokens.next.id;)state.option.nocomma&&warning(\"W127\"),comma();return advance(\")\",this),state.option.immed&&exprs[0]&&\"function\"===exprs[0].id&&\"(\"!==state.tokens.next.id&&\".\"!==state.tokens.next.id&&\"[\"!==state.tokens.next.id&&warning(\"W068\",this),exprs.length?(exprs.length>1?(ret=Object.create(state.syntax[\",\"]),ret.exprs=exprs,first=exprs[0],last=exprs[exprs.length-1],isNecessary||(isNecessary=preceeding.assign||preceeding.delim)):(ret=first=last=exprs[0],isNecessary||(isNecessary=opening.beginsStmt&&(\"{\"===ret.id||triggerFnExpr||isFunctor(ret))||triggerFnExpr&&(!isEndOfExpr()||\"}\"!==state.tokens.prev.id)||isFunctor(ret)&&!isEndOfExpr()||\"{\"===ret.id&&\"=>\"===preceeding.id||\"(number)\"===ret.type&&checkPunctuator(pn,\".\")&&/^\\d+$/.test(ret.value))),ret&&(!isNecessary&&(first.left||first.right||ret.exprs)&&(isNecessary=!isBeginOfExpr(preceeding)&&first.lbp<=preceeding.lbp||!isEndOfExpr()&&last.lbp\"),infix(\"[\",function(left,that){var s,e=expression(10);return e&&\"(string)\"===e.type&&(state.option.evil||\"eval\"!==e.value&&\"execScript\"!==e.value||isGlobalEval(left,state)&&warning(\"W061\"),countMember(e.value),!state.option.sub&®.identifier.test(e.value)&&(s=state.syntax[e.value],s&&isReserved(s)||warning(\"W069\",state.tokens.prev,e.value))),advance(\"]\",that),e&&\"hasOwnProperty\"===e.value&&\"=\"===state.tokens.next.value&&warning(\"W001\"),that.left=left,that.right=e,that},160,!0),prefix(\"[\",function(){var blocktype=lookupBlockType();if(blocktype.isCompArray)return state.option.esnext||state.inMoz()||warning(\"W118\",state.tokens.curr,\"array comprehension\"),comprehensiveArrayExpression();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;var b=state.tokens.curr.line!==startLine(state.tokens.next);for(this.first=[],b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));\"(end)\"!==state.tokens.next.id;){for(;\",\"===state.tokens.next.id;){if(!state.option.elision){if(state.inES5()){warning(\"W128\");do advance(\",\");while(\",\"===state.tokens.next.id);continue}warning(\"W070\")}advance(\",\")}if(\"]\"===state.tokens.next.id)break;if(this.first.push(expression(10)),\",\"!==state.tokens.next.id)break;if(comma({allowTrailing:!0}),\"]\"===state.tokens.next.id&&!state.inES5()){warning(\"W070\",state.tokens.curr);break}}return b&&(indent-=state.option.indent),advance(\"]\",this),this}),function(x){x.nud=function(){var b,f,i,p,t,nextVal,isGeneratorMethod=!1,props=Object.create(null);b=state.tokens.curr.line!==startLine(state.tokens.next),b&&(indent+=state.option.indent,state.tokens.next.from===indent+state.option.indent&&(indent+=state.option.indent));var blocktype=lookupBlockType();if(blocktype.isDestAssign)return this.destructAssign=destructuringPattern({openingParsed:!0,assignment:!0}),this;for(;\"}\"!==state.tokens.next.id;){if(nextVal=state.tokens.next.value,!state.tokens.next.identifier||\",\"!==peekIgnoreEOL().id&&\"}\"!==peekIgnoreEOL().id)if(\":\"===peek().id||\"get\"!==nextVal&&\"set\"!==nextVal){if(\"*\"===state.tokens.next.value&&\"(punctuator)\"===state.tokens.next.type?(state.inES6()||warning(\"W104\",state.tokens.next,\"generator functions\",\"6\"),advance(\"*\"),isGeneratorMethod=!0):isGeneratorMethod=!1,\"[\"===state.tokens.next.id)i=computedPropertyName(),state.nameStack.set(i);else if(state.nameStack.set(state.tokens.next),i=propertyName(),saveProperty(props,i,state.tokens.next),\"string\"!=typeof i)break;\"(\"===state.tokens.next.value?(state.inES6()||warning(\"W104\",state.tokens.curr,\"concise methods\",\"6\"),doFunction({type:isGeneratorMethod?\"generator\":null})):(advance(\":\"),expression(10))}else advance(nextVal),state.inES5()||error(\"E034\"),i=propertyName(),i||state.inES6()||error(\"E035\"),i&&saveAccessor(nextVal,props,i,state.tokens.curr),t=state.tokens.next,f=doFunction(),p=f[\"(params)\"],\"get\"===nextVal&&i&&p?warning(\"W076\",t,p[0],i):\"set\"!==nextVal||!i||p&&1===p.length||warning(\"W077\",t,i);else state.inES6()||warning(\"W104\",state.tokens.next,\"object short notation\",\"6\"),i=propertyName(!0),saveProperty(props,i,state.tokens.next),expression(10);if(countMember(i),\",\"!==state.tokens.next.id)break;comma({allowTrailing:!0,property:!0}),\",\"===state.tokens.next.id?warning(\"W070\",state.tokens.curr):\"}\"!==state.tokens.next.id||state.inES5()||warning(\"W070\",state.tokens.curr)}return b&&(indent-=state.option.indent),advance(\"}\",this),checkProperties(props),this},x.fud=function(){error(\"E036\",state.tokens.curr)}}(delim(\"{\"));var conststatement=stmt(\"const\",function(context){return blockVariableStatement(\"const\",this,context)});conststatement.exps=!0;var letstatement=stmt(\"let\",function(context){return blockVariableStatement(\"let\",this,context)});letstatement.exps=!0;var varstatement=stmt(\"var\",function(context){var tokens,lone,value,prefix=context&&context.prefix,inexport=context&&context.inexport,implied=context&&context.implied,report=!(context&&context.ignore);for(this.first=[];;){var names=[];_.contains([\"{\",\"[\"],state.tokens.next.value)?(tokens=destructuringPattern(),lone=!1):(tokens=[{id:identifier(),token:state.tokens.curr}],lone=!0),prefix&&implied||!report||!state.option.varstmt||warning(\"W132\",this),this.first=this.first.concat(names);for(var t in tokens)tokens.hasOwnProperty(t)&&(t=tokens[t],!implied&&state.funct[\"(global)\"]&&(predefined[t.id]===!1?warning(\"W079\",t.token,t.id):state.option.futurehostile===!1&&(!state.inES5()&&vars.ecmaIdentifiers[5][t.id]===!1||!state.inES6()&&vars.ecmaIdentifiers[6][t.id]===!1)&&warning(\"W129\",t.token,t.id)),t.id&&(\"for\"===implied?(state.funct[\"(scope)\"].has(t.id)||report&&warning(\"W088\",t.token,t.id),state.funct[\"(scope)\"].block.use(t.id,t.token)):(state.funct[\"(scope)\"].addlabel(t.id,{type:\"var\",token:t.token}),lone&&inexport&&state.funct[\"(scope)\"].setExported(t.id,t.token)),names.push(t.token)));if(\"=\"===state.tokens.next.id&&(state.nameStack.set(state.tokens.curr),advance(\"=\"),prefix||!report||state.funct[\"(loopage)\"]||\"undefined\"!==state.tokens.next.id||warning(\"W080\",state.tokens.prev,state.tokens.prev.value),\"=\"===peek(0).id&&state.tokens.next.identifier&&(!prefix&&report&&!state.funct[\"(params)\"]||-1===state.funct[\"(params)\"].indexOf(state.tokens.next.value))&&warning(\"W120\",state.tokens.next,state.tokens.next.value),value=expression(prefix?120:10),lone?tokens[0].first=value:destructuringPatternMatch(names,value)),\",\"!==state.tokens.next.id)break;comma()}return this});varstatement.exps=!0,blockstmt(\"class\",function(){return classdef.call(this,!0)}),blockstmt(\"function\",function(context){var inexport=context&&context.inexport,generator=!1;\"*\"===state.tokens.next.value&&(advance(\"*\"),state.inES6({strict:!0})?generator=!0:warning(\"W119\",state.tokens.curr,\"function*\",\"6\")),inblock&&warning(\"W082\",state.tokens.curr);var i=optionalidentifier();return state.funct[\"(scope)\"].addlabel(i,{type:\"function\",token:state.tokens.curr}),void 0===i?warning(\"W025\"):inexport&&state.funct[\"(scope)\"].setExported(i,state.tokens.prev),doFunction({name:i,statement:this,type:generator?\"generator\":null,ignoreLoopFunc:inblock}),\"(\"===state.tokens.next.id&&state.tokens.next.line===state.tokens.curr.line&&error(\"E039\"),this}),prefix(\"function\",function(){var generator=!1;\"*\"===state.tokens.next.value&&(state.inES6()||warning(\"W119\",state.tokens.curr,\"function*\",\"6\"),advance(\"*\"),generator=!0);var i=optionalidentifier();return doFunction({name:i,type:generator?\"generator\":null}),this}),blockstmt(\"if\",function(){var t=state.tokens.next;increaseComplexityCount(),state.condition=!0,advance(\"(\");var expr=expression(0);checkCondAssignment(expr);var forinifcheck=null;state.option.forin&&state.forinifcheckneeded&&(state.forinifcheckneeded=!1,forinifcheck=state.forinifchecks[state.forinifchecks.length-1],forinifcheck.type=\"(punctuator)\"===expr.type&&\"!\"===expr.value?\"(negative)\":\"(positive)\"),advance(\")\",t),state.condition=!1;var s=block(!0,!0);return forinifcheck&&\"(negative)\"===forinifcheck.type&&s&&s[0]&&\"(identifier)\"===s[0].type&&\"continue\"===s[0].value&&(forinifcheck.type=\"(negative-with-continue)\"),\"else\"===state.tokens.next.id&&(advance(\"else\"),\"if\"===state.tokens.next.id||\"switch\"===state.tokens.next.id?statement():block(!0,!0)),this}),blockstmt(\"try\",function(){function doCatch(){if(advance(\"catch\"),advance(\"(\"),state.funct[\"(scope)\"].stack(\"catchparams\"),checkPunctuators(state.tokens.next,[\"[\",\"{\"])){var tokens=destructuringPattern();_.each(tokens,function(token){token.id&&state.funct[\"(scope)\"].addParam(token.id,token,\"exception\")})}else\"(identifier)\"!==state.tokens.next.type?warning(\"E030\",state.tokens.next,state.tokens.next.value):state.funct[\"(scope)\"].addParam(identifier(),state.tokens.curr,\"exception\");\"if\"===state.tokens.next.value&&(state.inMoz()||warning(\"W118\",state.tokens.curr,\"catch filter\"),advance(\"if\"),expression(0)),advance(\")\"),block(!1),state.funct[\"(scope)\"].unstack()}var b;for(block(!0);\"catch\"===state.tokens.next.id;)increaseComplexityCount(),b&&!state.inMoz()&&warning(\"W118\",state.tokens.next,\"multiple catch blocks\"),doCatch(),b=!0;return\"finally\"===state.tokens.next.id?(advance(\"finally\"),block(!0),void 0):(b||error(\"E021\",state.tokens.next,\"catch\",state.tokens.next.value),this)}),blockstmt(\"while\",function(){var t=state.tokens.next;return state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this}).labelled=!0,blockstmt(\"with\",function(){var t=state.tokens.next;return state.isStrict()?error(\"E010\",state.tokens.curr):state.option.withstmt||warning(\"W085\",state.tokens.curr),advance(\"(\"),expression(0),advance(\")\",t),block(!0,!0),this}),blockstmt(\"switch\",function(){var t=state.tokens.next,g=!1,noindent=!1;\nfor(state.funct[\"(breakage)\"]+=1,advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),t=state.tokens.next,advance(\"{\"),state.tokens.next.from===indent&&(noindent=!0),noindent||(indent+=state.option.indent),this.cases=[];;)switch(state.tokens.next.id){case\"case\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"case\":case\"continue\":case\"return\":case\"switch\":case\"throw\":break;default:state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"case\")}advance(\"case\"),this.cases.push(expression(0)),increaseComplexityCount(),g=!0,advance(\":\"),state.funct[\"(verb)\"]=\"case\";break;case\"default\":switch(state.funct[\"(verb)\"]){case\"yield\":case\"break\":case\"continue\":case\"return\":case\"throw\":break;default:this.cases.length&&(state.tokens.curr.caseFallsThrough||warning(\"W086\",state.tokens.curr,\"default\"))}advance(\"default\"),g=!0,advance(\":\");break;case\"}\":return noindent||(indent-=state.option.indent),advance(\"}\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(verb)\"]=void 0,void 0;case\"(end)\":return error(\"E023\",state.tokens.next,\"}\"),void 0;default:if(indent+=state.option.indent,g)switch(state.tokens.curr.id){case\",\":return error(\"E040\"),void 0;case\":\":g=!1,statements();break;default:return error(\"E025\",state.tokens.curr),void 0}else{if(\":\"!==state.tokens.curr.id)return error(\"E021\",state.tokens.next,\"case\",state.tokens.next.value),void 0;advance(\":\"),error(\"E024\",state.tokens.curr,\":\"),statements()}indent-=state.option.indent}return this}).labelled=!0,stmt(\"debugger\",function(){return state.option.debug||warning(\"W087\",this),this}).exps=!0,function(){var x=stmt(\"do\",function(){state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,increaseComplexityCount(),this.first=block(!0,!0),advance(\"while\");var t=state.tokens.next;return advance(\"(\"),checkCondAssignment(expression(0)),advance(\")\",t),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1,this});x.labelled=!0,x.exps=!0}(),blockstmt(\"for\",function(){var s,t=state.tokens.next,letscope=!1,foreachtok=null;\"each\"===t.value&&(foreachtok=t,advance(\"each\"),state.inMoz()||warning(\"W118\",state.tokens.curr,\"for each\")),increaseComplexityCount(),advance(\"(\");var nextop,comma,initializer,i=0,inof=[\"in\",\"of\"],level=0;checkPunctuators(state.tokens.next,[\"{\",\"[\"])&&++level;do{if(nextop=peek(i),++i,checkPunctuators(nextop,[\"{\",\"[\"])?++level:checkPunctuators(nextop,[\"}\",\"]\"])&&--level,0>level)break;0===level&&(!comma&&checkPunctuator(nextop,\",\")?comma=nextop:!initializer&&checkPunctuator(nextop,\"=\")&&(initializer=nextop))}while(level>0||!_.contains(inof,nextop.value)&&\";\"!==nextop.value&&\"(end)\"!==nextop.type);if(_.contains(inof,nextop.value)){state.inES6()||\"of\"!==nextop.value||warning(\"W104\",nextop,\"for of\",\"6\");var ok=!(initializer||comma);if(initializer&&error(\"W133\",comma,nextop.value,\"initializer is forbidden\"),comma&&error(\"W133\",comma,nextop.value,\"more than one ForBinding\"),\"var\"===state.tokens.next.id?(advance(\"var\"),state.tokens.curr.fud({prefix:!0})):\"let\"===state.tokens.next.id||\"const\"===state.tokens.next.id?(advance(state.tokens.next.id),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud({prefix:!0})):Object.create(varstatement).fud({prefix:!0,implied:\"for\",ignore:!ok}),advance(nextop.value),expression(20),advance(\")\",t),\"in\"===nextop.value&&state.option.forin&&(state.forinifcheckneeded=!0,void 0===state.forinifchecks&&(state.forinifchecks=[]),state.forinifchecks.push({type:\"(none)\"})),state.funct[\"(breakage)\"]+=1,state.funct[\"(loopage)\"]+=1,s=block(!0,!0),\"in\"===nextop.value&&state.option.forin){if(state.forinifchecks&&state.forinifchecks.length>0){var check=state.forinifchecks.pop();(s&&s.length>0&&(\"object\"!=typeof s[0]||\"if\"!==s[0].value)||\"(positive)\"===check.type&&s.length>1||\"(negative)\"===check.type)&&warning(\"W089\",this)}state.forinifcheckneeded=!1}state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}else{if(foreachtok&&error(\"E045\",foreachtok),\";\"!==state.tokens.next.id)if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud();else if(\"let\"===state.tokens.next.id)advance(\"let\"),letscope=!0,state.funct[\"(scope)\"].stack(),state.tokens.curr.fud();else for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();if(nolinebreak(state.tokens.curr),advance(\";\"),state.funct[\"(loopage)\"]+=1,\";\"!==state.tokens.next.id&&checkCondAssignment(expression(0)),nolinebreak(state.tokens.curr),advance(\";\"),\";\"===state.tokens.next.id&&error(\"E021\",state.tokens.next,\")\",\";\"),\")\"!==state.tokens.next.id)for(;expression(0,\"for\"),\",\"===state.tokens.next.id;)comma();advance(\")\",t),state.funct[\"(breakage)\"]+=1,block(!0,!0),state.funct[\"(breakage)\"]-=1,state.funct[\"(loopage)\"]-=1}return letscope&&state.funct[\"(scope)\"].unstack(),this}).labelled=!0,stmt(\"break\",function(){var v=state.tokens.next.value;return state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line!==startLine(state.tokens.next)?0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value):(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"continue\",function(){var v=state.tokens.next.value;return 0===state.funct[\"(breakage)\"]&&warning(\"W052\",state.tokens.next,this.value),state.funct[\"(loopage)\"]||warning(\"W052\",state.tokens.next,this.value),state.option.asi||nolinebreak(this),\";\"===state.tokens.next.id||state.tokens.next.reach||state.tokens.curr.line===startLine(state.tokens.next)&&(state.funct[\"(scope)\"].funct.hasBreakLabel(v)||warning(\"W090\",state.tokens.next,v),this.first=state.tokens.next,advance()),reachable(this),this}).exps=!0,stmt(\"return\",function(){return this.line===startLine(state.tokens.next)?\";\"===state.tokens.next.id||state.tokens.next.reach||(this.first=expression(0),!this.first||\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)):\"(punctuator)\"===state.tokens.next.type&&[\"[\",\"{\",\"+\",\"-\"].indexOf(state.tokens.next.value)>-1&&nolinebreak(this),reachable(this),this}).exps=!0,function(x){x.exps=!0,x.lbp=25}(prefix(\"yield\",function(){var prev=state.tokens.prev;state.inES6(!0)&&!state.funct[\"(generator)\"]?\"(catch)\"===state.funct[\"(name)\"]&&state.funct[\"(context)\"][\"(generator)\"]||error(\"E046\",state.tokens.curr,\"yield\"):state.inES6()||warning(\"W104\",state.tokens.curr,\"yield\",\"6\"),state.funct[\"(generator)\"]=\"yielded\";var delegatingYield=!1;return\"*\"===state.tokens.next.value&&(delegatingYield=!0,advance(\"*\")),this.line!==startLine(state.tokens.next)&&state.inMoz()?state.option.asi||nolinebreak(this):((delegatingYield||\";\"!==state.tokens.next.id&&!state.option.asi&&!state.tokens.next.reach&&state.tokens.next.nud)&&(nobreaknonadjacent(state.tokens.curr,state.tokens.next),this.first=expression(10),\"(punctuator)\"!==this.first.type||\"=\"!==this.first.value||this.first.paren||state.option.boss||warningAt(\"W093\",this.first.line,this.first.character)),state.inMoz()&&\")\"!==state.tokens.next.id&&(prev.lbp>30||!prev.assign&&!isEndOfExpr()||\"yield\"===prev.id)&&error(\"E050\",this)),this})),stmt(\"throw\",function(){return nolinebreak(this),this.first=expression(20),reachable(this),this}).exps=!0,stmt(\"import\",function(){if(state.inES6()||warning(\"W119\",state.tokens.curr,\"import\",\"6\"),\"(string)\"===state.tokens.next.type)return advance(\"(string)\"),this;if(state.tokens.next.identifier){if(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value)return advance(\"from\"),advance(\"(string)\"),this;advance(\",\")}if(\"*\"===state.tokens.next.id)advance(\"*\"),advance(\"as\"),state.tokens.next.identifier&&(this.name=identifier(),state.funct[\"(scope)\"].addlabel(this.name,{type:\"const\",token:state.tokens.curr}));else for(advance(\"{\");;){if(\"}\"===state.tokens.next.value){advance(\"}\");break}var importName;if(\"default\"===state.tokens.next.type?(importName=\"default\",advance(\"default\")):importName=identifier(),\"as\"===state.tokens.next.value&&(advance(\"as\"),importName=identifier()),state.funct[\"(scope)\"].addlabel(importName,{type:\"const\",token:state.tokens.curr}),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return advance(\"from\"),advance(\"(string)\"),this}).exps=!0,stmt(\"export\",function(){var token,identifier,ok=!0;if(state.inES6()||(warning(\"W119\",state.tokens.curr,\"export\",\"6\"),ok=!1),state.funct[\"(scope)\"].block.isGlobal()||(error(\"E053\",state.tokens.curr),ok=!1),\"*\"===state.tokens.next.value)return advance(\"*\"),advance(\"from\"),advance(\"(string)\"),this;if(\"default\"===state.tokens.next.type){state.nameStack.set(state.tokens.next),advance(\"default\");var exportType=state.tokens.next.id;return(\"function\"===exportType||\"class\"===exportType)&&(this.block=!0),token=peek(),expression(10),identifier=token.value,this.block&&(state.funct[\"(scope)\"].addlabel(identifier,{type:exportType,token:token}),state.funct[\"(scope)\"].setExported(identifier,token)),this}if(\"{\"===state.tokens.next.value){advance(\"{\");for(var exportedTokens=[];;){if(state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance(),exportedTokens.push(state.tokens.curr),\"as\"===state.tokens.next.value&&(advance(\"as\"),state.tokens.next.identifier||error(\"E030\",state.tokens.next,state.tokens.next.value),advance()),\",\"!==state.tokens.next.value){if(\"}\"===state.tokens.next.value){advance(\"}\");break}error(\"E024\",state.tokens.next,state.tokens.next.value);break}advance(\",\")}return\"from\"===state.tokens.next.value?(advance(\"from\"),advance(\"(string)\")):ok&&exportedTokens.forEach(function(token){state.funct[\"(scope)\"].setExported(token.value,token)}),this}if(\"var\"===state.tokens.next.id)advance(\"var\"),state.tokens.curr.fud({inexport:!0});else if(\"let\"===state.tokens.next.id)advance(\"let\"),state.tokens.curr.fud({inexport:!0});else if(\"const\"===state.tokens.next.id)advance(\"const\"),state.tokens.curr.fud({inexport:!0});else if(\"function\"===state.tokens.next.id)this.block=!0,advance(\"function\"),state.syntax[\"function\"].fud({inexport:!0});else if(\"class\"===state.tokens.next.id){this.block=!0,advance(\"class\");var classNameToken=state.tokens.next;state.syntax[\"class\"].fud(),state.funct[\"(scope)\"].setExported(classNameToken.value,classNameToken)}else error(\"E024\",state.tokens.next,state.tokens.next.value);return this}).exps=!0,FutureReservedWord(\"abstract\"),FutureReservedWord(\"boolean\"),FutureReservedWord(\"byte\"),FutureReservedWord(\"char\"),FutureReservedWord(\"class\",{es5:!0,nud:classdef}),FutureReservedWord(\"double\"),FutureReservedWord(\"enum\",{es5:!0}),FutureReservedWord(\"export\",{es5:!0}),FutureReservedWord(\"extends\",{es5:!0}),FutureReservedWord(\"final\"),FutureReservedWord(\"float\"),FutureReservedWord(\"goto\"),FutureReservedWord(\"implements\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"import\",{es5:!0}),FutureReservedWord(\"int\"),FutureReservedWord(\"interface\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"long\"),FutureReservedWord(\"native\"),FutureReservedWord(\"package\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"private\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"protected\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"public\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"short\"),FutureReservedWord(\"static\",{es5:!0,strictOnly:!0}),FutureReservedWord(\"super\",{es5:!0}),FutureReservedWord(\"synchronized\"),FutureReservedWord(\"transient\"),FutureReservedWord(\"volatile\");var lookupBlockType=function(){var pn,pn1,prev,i=-1,bracketStack=0,ret={};checkPunctuators(state.tokens.curr,[\"[\",\"{\"])&&(bracketStack+=1);do{if(prev=-1===i?state.tokens.curr:pn,pn=-1===i?state.tokens.next:peek(i),pn1=peek(i+1),i+=1,checkPunctuators(pn,[\"[\",\"{\"])?bracketStack+=1:checkPunctuators(pn,[\"]\",\"}\"])&&(bracketStack-=1),1===bracketStack&&pn.identifier&&\"for\"===pn.value&&!checkPunctuator(prev,\".\")){ret.isCompArray=!0,ret.notJson=!0;break}if(0===bracketStack&&checkPunctuators(pn,[\"}\",\"]\"])){if(\"=\"===pn1.value){ret.isDestAssign=!0,ret.notJson=!0;break}if(\".\"===pn1.value){ret.notJson=!0;break}}checkPunctuator(pn,\";\")&&(ret.isBlock=!0,ret.notJson=!0)}while(bracketStack>0&&\"(end)\"!==pn.id);return ret},arrayComprehension=function(){function declare(v){var l=_current.variables.filter(function(elt){return elt.value===v?(elt.undef=!1,v):void 0}).length;return 0!==l}function use(v){var l=_current.variables.filter(function(elt){return elt.value!==v||elt.undef?void 0:(elt.unused===!0&&(elt.unused=!1),v)}).length;return 0===l}var _current,CompArray=function(){this.mode=\"use\",this.variables=[]},_carrays=[];return{stack:function(){_current=new CompArray,_carrays.push(_current)},unstack:function(){_current.variables.filter(function(v){v.unused&&warning(\"W098\",v.token,v.raw_text||v.value),v.undef&&state.funct[\"(scope)\"].block.use(v.value,v.token)}),_carrays.splice(-1,1),_current=_carrays[_carrays.length-1]},setState:function(s){_.contains([\"use\",\"define\",\"generate\",\"filter\"],s)&&(_current.mode=s)},check:function(v){return _current?_current&&\"use\"===_current.mode?(use(v)&&_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!0,unused:!1}),!0):_current&&\"define\"===_current.mode?(declare(v)||_current.variables.push({funct:state.funct,token:state.tokens.curr,value:v,undef:!1,unused:!0}),!0):_current&&\"generate\"===_current.mode?(state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):_current&&\"filter\"===_current.mode?(use(v)&&state.funct[\"(scope)\"].block.use(v,state.tokens.curr),!0):!1:void 0}}},escapeRegex=function(str){return str.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\")},itself=function(s,o,g){function each(obj,cb){obj&&(Array.isArray(obj)||\"object\"!=typeof obj||(obj=Object.keys(obj)),obj.forEach(cb))}var i,k,x,reIgnoreStr,reIgnore,optionKeys,newOptionObj={},newIgnoredObj={};o=_.clone(o),state.reset(),o&&o.scope?JSHINT.scope=o.scope:(JSHINT.errors=[],JSHINT.undefs=[],JSHINT.internals=[],JSHINT.blacklist={},JSHINT.scope=\"(main)\"),predefined=Object.create(null),combine(predefined,vars.ecmaIdentifiers[3]),combine(predefined,vars.reservedVars),combine(predefined,g||{}),declared=Object.create(null);var exported=Object.create(null);if(o)for(each(o.predef||null,function(item){var slice,prop;\"-\"===item[0]?(slice=item.slice(1),JSHINT.blacklist[slice]=slice,delete predefined[slice]):(prop=Object.getOwnPropertyDescriptor(o.predef,item),predefined[item]=prop?prop.value:!1)}),each(o.exported||null,function(item){exported[item]=!0}),delete o.predef,delete o.exported,optionKeys=Object.keys(o),x=0;optionKeys.length>x;x++)if(/^-W\\d{3}$/g.test(optionKeys[x]))newIgnoredObj[optionKeys[x].slice(1)]=!0;else{var optionKey=optionKeys[x];newOptionObj[optionKey]=o[optionKey],(\"esversion\"===optionKey&&5===o[optionKey]||\"es5\"===optionKey&&o[optionKey])&&warning(\"I003\"),\"newcap\"===optionKeys[x]&&o[optionKey]===!1&&(newOptionObj[\"(explicitNewcap)\"]=!0)}state.option=newOptionObj,state.ignored=newIgnoredObj,state.option.indent=state.option.indent||4,state.option.maxerr=state.option.maxerr||50,indent=1;var scopeManagerInst=scopeManager(state,predefined,exported,declared);if(scopeManagerInst.on(\"warning\",function(ev){warning.apply(null,[ev.code,ev.token].concat(ev.data))}),scopeManagerInst.on(\"error\",function(ev){error.apply(null,[ev.code,ev.token].concat(ev.data))}),state.funct=functor(\"(global)\",null,{\"(global)\":!0,\"(scope)\":scopeManagerInst,\"(comparray)\":arrayComprehension(),\"(metrics)\":createMetrics(state.tokens.next)}),functions=[state.funct],urls=[],stack=null,member={},membersOnly=null,inblock=!1,lookahead=[],!isString(s)&&!Array.isArray(s))return errorAt(\"E004\",0),!1;api={get isJSON(){return state.jsonMode},getOption:function(name){return state.option[name]||null},getCache:function(name){return state.cache[name]},setCache:function(name,value){state.cache[name]=value},warn:function(code,data){warningAt.apply(null,[code,data.line,data.char].concat(data.data))},on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)}.bind(this))}},emitter.removeAllListeners(),(extraModules||[]).forEach(function(func){func(api)}),state.tokens.prev=state.tokens.curr=state.tokens.next=state.syntax[\"(begin)\"],o&&o.ignoreDelimiters&&(Array.isArray(o.ignoreDelimiters)||(o.ignoreDelimiters=[o.ignoreDelimiters]),o.ignoreDelimiters.forEach(function(delimiterPair){delimiterPair.start&&delimiterPair.end&&(reIgnoreStr=escapeRegex(delimiterPair.start)+\"[\\\\s\\\\S]*?\"+escapeRegex(delimiterPair.end),reIgnore=RegExp(reIgnoreStr,\"ig\"),s=s.replace(reIgnore,function(match){return match.replace(/./g,\" \")}))})),lex=new Lexer(s),lex.on(\"warning\",function(ev){warningAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"error\",function(ev){errorAt.apply(null,[ev.code,ev.line,ev.character].concat(ev.data))}),lex.on(\"fatal\",function(ev){quit(\"E041\",ev.line,ev.from)}),lex.on(\"Identifier\",function(ev){emitter.emit(\"Identifier\",ev)}),lex.on(\"String\",function(ev){emitter.emit(\"String\",ev)}),lex.on(\"Number\",function(ev){emitter.emit(\"Number\",ev)}),lex.start();for(var name in o)_.has(o,name)&&checkOption(name,state.tokens.curr);assume(),combine(predefined,g||{}),comma.first=!0;try{switch(advance(),state.tokens.next.id){case\"{\":case\"[\":destructuringAssignOrJsonValue();break;default:directives(),state.directive[\"use strict\"]&&\"global\"!==state.option.strict&&warning(\"W097\",state.tokens.prev),statements()}\"(end)\"!==state.tokens.next.id&&quit(\"E041\",state.tokens.curr.line),state.funct[\"(scope)\"].unstack()}catch(err){if(!err||\"JSHintError\"!==err.name)throw err;var nt=state.tokens.next||{};JSHINT.errors.push({scope:\"(main)\",raw:err.raw,code:err.code,reason:err.message,line:err.line||nt.line,character:err.character||nt.from},null)}if(\"(main)\"===JSHINT.scope)for(o=o||{},i=0;JSHINT.internals.length>i;i+=1)k=JSHINT.internals[i],o.scope=k.elem,itself(k.value,o,g);return 0===JSHINT.errors.length};return itself.addModule=function(func){extraModules.push(func)},itself.addModule(style.register),itself.data=function(){var fu,f,i,j,n,globals,data={functions:[],options:state.option};itself.errors.length&&(data.errors=itself.errors),state.jsonMode&&(data.json=!0);var impliedGlobals=state.funct[\"(scope)\"].getImpliedGlobals();for(impliedGlobals.length>0&&(data.implieds=impliedGlobals),urls.length>0&&(data.urls=urls),globals=state.funct[\"(scope)\"].getUsedOrDefinedGlobals(),globals.length>0&&(data.globals=globals),i=1;functions.length>i;i+=1){for(f=functions[i],fu={},j=0;functionicity.length>j;j+=1)fu[functionicity[j]]=[];for(j=0;functionicity.length>j;j+=1)0===fu[functionicity[j]].length&&delete fu[functionicity[j]];fu.name=f[\"(name)\"],fu.param=f[\"(params)\"],fu.line=f[\"(line)\"],fu.character=f[\"(character)\"],fu.last=f[\"(last)\"],fu.lastcharacter=f[\"(lastcharacter)\"],fu.metrics={complexity:f[\"(metrics)\"].ComplexityCount,parameters:f[\"(metrics)\"].arity,statements:f[\"(metrics)\"].statementCount},data.functions.push(fu)}var unuseds=state.funct[\"(scope)\"].getUnuseds();unuseds.length>0&&(data.unused=unuseds);for(n in member)if(\"number\"==typeof member[n]){data.member=member;break}return data},itself.jshint=itself,itself}();\"object\"==typeof exports&&exports&&(exports.JSHINT=JSHINT)},{\"../lodash\":\"/node_modules/jshint/lodash.js\",\"./lex.js\":\"/node_modules/jshint/src/lex.js\",\"./messages.js\":\"/node_modules/jshint/src/messages.js\",\"./options.js\":\"/node_modules/jshint/src/options.js\",\"./reg.js\":\"/node_modules/jshint/src/reg.js\",\"./scope-manager.js\":\"/node_modules/jshint/src/scope-manager.js\",\"./state.js\":\"/node_modules/jshint/src/state.js\",\"./style.js\":\"/node_modules/jshint/src/style.js\",\"./vars.js\":\"/node_modules/jshint/src/vars.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/lex.js\":[function(_dereq_,module,exports){\"use strict\";function asyncTrigger(){var _checks=[];return{push:function(fn){_checks.push(fn)},check:function(){for(var check=0;_checks.length>check;++check)_checks[check]();_checks.splice(0,_checks.length)}}}function Lexer(source){var lines=source;\"string\"==typeof lines&&(lines=lines.replace(/\\r\\n/g,\"\\n\").replace(/\\r/g,\"\\n\").split(\"\\n\")),lines[0]&&\"#!\"===lines[0].substr(0,2)&&(-1!==lines[0].indexOf(\"node\")&&(state.option.node=!0),lines[0]=\"\"),this.emitter=new events.EventEmitter,this.source=source,this.setLines(lines),this.prereg=!0,this.line=0,this.char=1,this.from=1,this.input=\"\",this.inComment=!1,this.context=[],this.templateStarts=[];for(var i=0;state.option.indent>i;i+=1)state.tab+=\" \";this.ignoreLinterErrors=!1}var _=_dereq_(\"../lodash\"),events=_dereq_(\"events\"),reg=_dereq_(\"./reg.js\"),state=_dereq_(\"./state.js\").state,unicodeData=_dereq_(\"../data/ascii-identifier-data.js\"),asciiIdentifierStartTable=unicodeData.asciiIdentifierStartTable,asciiIdentifierPartTable=unicodeData.asciiIdentifierPartTable,Token={Identifier:1,Punctuator:2,NumericLiteral:3,StringLiteral:4,Comment:5,Keyword:6,NullLiteral:7,BooleanLiteral:8,RegExp:9,TemplateHead:10,TemplateMiddle:11,TemplateTail:12,NoSubstTemplate:13},Context={Block:1,Template:2};Lexer.prototype={_lines:[],inContext:function(ctxType){return this.context.length>0&&this.context[this.context.length-1].type===ctxType},pushContext:function(ctxType){this.context.push({type:ctxType})},popContext:function(){return this.context.pop()},isContext:function(context){return this.context.length>0&&this.context[this.context.length-1]===context},currentContext:function(){return this.context.length>0&&this.context[this.context.length-1]},getLines:function(){return this._lines=state.lines,this._lines},setLines:function(val){this._lines=val,state.lines=this._lines},peek:function(i){return this.input.charAt(i||0)},skip:function(i){i=i||1,this.char+=i,this.input=this.input.slice(i)},on:function(names,listener){names.split(\" \").forEach(function(name){this.emitter.on(name,listener)}.bind(this))},trigger:function(){this.emitter.emit.apply(this.emitter,Array.prototype.slice.call(arguments))},triggerAsync:function(type,args,checks,fn){checks.push(function(){fn()&&this.trigger(type,args)}.bind(this))},scanPunctuator:function(){var ch2,ch3,ch4,ch1=this.peek();switch(ch1){case\".\":if(/^[0-9]$/.test(this.peek(1)))return null;if(\".\"===this.peek(1)&&\".\"===this.peek(2))return{type:Token.Punctuator,value:\"...\"};case\"(\":case\")\":case\";\":case\",\":case\"[\":case\"]\":case\":\":case\"~\":case\"?\":return{type:Token.Punctuator,value:ch1};case\"{\":return this.pushContext(Context.Block),{type:Token.Punctuator,value:ch1};case\"}\":return this.inContext(Context.Block)&&this.popContext(),{type:Token.Punctuator,value:ch1};case\"#\":return{type:Token.Punctuator,value:ch1};case\"\":return null}return ch2=this.peek(1),ch3=this.peek(2),ch4=this.peek(3),\">\"===ch1&&\">\"===ch2&&\">\"===ch3&&\"=\"===ch4?{type:Token.Punctuator,value:\">>>=\"}:\"=\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"===\"}:\"!\"===ch1&&\"=\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"!==\"}:\">\"===ch1&&\">\"===ch2&&\">\"===ch3?{type:Token.Punctuator,value:\">>>\"}:\"<\"===ch1&&\"<\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\"<<=\"}:\">\"===ch1&&\">\"===ch2&&\"=\"===ch3?{type:Token.Punctuator,value:\">>=\"}:\"=\"===ch1&&\">\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:ch1===ch2&&\"+-<>&|\".indexOf(ch1)>=0?{type:Token.Punctuator,value:ch1+ch2}:\"<>=!+-*%&|^\".indexOf(ch1)>=0?\"=\"===ch2?{type:Token.Punctuator,value:ch1+ch2}:{type:Token.Punctuator,value:ch1}:\"/\"===ch1?\"=\"===ch2?{type:Token.Punctuator,value:\"/=\"}:{type:Token.Punctuator,value:\"/\"}:null},scanComments:function(){function commentToken(label,body,opt){var special=[\"jshint\",\"jslint\",\"members\",\"member\",\"globals\",\"global\",\"exported\"],isSpecial=!1,value=label+body,commentType=\"plain\";return opt=opt||{},opt.isMultiline&&(value+=\"*/\"),body=body.replace(/\\n/g,\" \"),\"/*\"===label&®.fallsThrough.test(body)&&(isSpecial=!0,commentType=\"falls through\"),special.forEach(function(str){if(!isSpecial&&(\"//\"!==label||\"jshint\"===str)&&(\" \"===body.charAt(str.length)&&body.substr(0,str.length)===str&&(isSpecial=!0,label+=str,body=body.substr(str.length)),isSpecial||\" \"!==body.charAt(0)||\" \"!==body.charAt(str.length+1)||body.substr(1,str.length)!==str||(isSpecial=!0,label=label+\" \"+str,body=body.substr(str.length+1)),isSpecial))switch(str){case\"member\":commentType=\"members\";break;case\"global\":commentType=\"globals\";break;default:var options=body.split(\":\").map(function(v){return v.replace(/^\\s+/,\"\").replace(/\\s+$/,\"\")});if(2===options.length)switch(options[0]){case\"ignore\":switch(options[1]){case\"start\":self.ignoringLinterErrors=!0,isSpecial=!1;break;case\"end\":self.ignoringLinterErrors=!1,isSpecial=!1}}commentType=str}}),{type:Token.Comment,commentType:commentType,value:value,body:body,isSpecial:isSpecial,isMultiline:opt.isMultiline||!1,isMalformed:opt.isMalformed||!1}}var ch1=this.peek(),ch2=this.peek(1),rest=this.input.substr(2),startLine=this.line,startChar=this.char,self=this;if(\"*\"===ch1&&\"/\"===ch2)return this.trigger(\"error\",{code:\"E018\",line:startLine,character:startChar}),this.skip(2),null;if(\"/\"!==ch1||\"*\"!==ch2&&\"/\"!==ch2)return null;if(\"/\"===ch2)return this.skip(this.input.length),commentToken(\"//\",rest);var body=\"\";if(\"*\"===ch2){for(this.inComment=!0,this.skip(2);\"*\"!==this.peek()||\"/\"!==this.peek(1);)if(\"\"===this.peek()){if(body+=\"\\n\",!this.nextLine())return this.trigger(\"error\",{code:\"E017\",line:startLine,character:startChar}),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0,isMalformed:!0})}else body+=this.peek(),this.skip();return this.skip(2),this.inComment=!1,commentToken(\"/*\",body,{isMultiline:!0})}},scanKeyword:function(){var result=/^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input),keywords=[\"if\",\"in\",\"do\",\"var\",\"for\",\"new\",\"try\",\"let\",\"this\",\"else\",\"case\",\"void\",\"with\",\"enum\",\"while\",\"break\",\"catch\",\"throw\",\"const\",\"yield\",\"class\",\"super\",\"return\",\"typeof\",\"delete\",\"switch\",\"export\",\"import\",\"default\",\"finally\",\"extends\",\"function\",\"continue\",\"debugger\",\"instanceof\"];return result&&keywords.indexOf(result[0])>=0?{type:Token.Keyword,value:result[0]}:null},scanIdentifier:function(){function isNonAsciiIdentifierStart(code){return code>256}function isNonAsciiIdentifierPart(code){return code>256}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function removeEscapeSequences(id){return id.replace(/\\\\u([0-9a-fA-F]{4})/g,function(m0,codepoint){return String.fromCharCode(parseInt(codepoint,16))})}var type,char,id=\"\",index=0,readUnicodeEscapeSequence=function(){if(index+=1,\"u\"!==this.peek(index))return null;var code,ch1=this.peek(index+1),ch2=this.peek(index+2),ch3=this.peek(index+3),ch4=this.peek(index+4);return isHexDigit(ch1)&&isHexDigit(ch2)&&isHexDigit(ch3)&&isHexDigit(ch4)?(code=parseInt(ch1+ch2+ch3+ch4,16),asciiIdentifierPartTable[code]||isNonAsciiIdentifierPart(code)?(index+=5,\"\\\\u\"+ch1+ch2+ch3+ch4):null):null}.bind(this),getIdentifierStart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierStartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierStart(code)?(index+=1,chr):null}.bind(this),getIdentifierPart=function(){var chr=this.peek(index),code=chr.charCodeAt(0);return 92===code?readUnicodeEscapeSequence():128>code?asciiIdentifierPartTable[code]?(index+=1,chr):null:isNonAsciiIdentifierPart(code)?(index+=1,chr):null}.bind(this);if(char=getIdentifierStart(),null===char)return null;for(id=char;char=getIdentifierPart(),null!==char;)id+=char;switch(id){case\"true\":case\"false\":type=Token.BooleanLiteral;break;case\"null\":type=Token.NullLiteral;break;default:type=Token.Identifier}return{type:type,value:removeEscapeSequences(id),text:id,tokenLength:id.length}},scanNumericLiteral:function(){function isDecimalDigit(str){return/^[0-9]$/.test(str)}function isOctalDigit(str){return/^[0-7]$/.test(str)}function isBinaryDigit(str){return/^[01]$/.test(str)}function isHexDigit(str){return/^[0-9a-fA-F]$/.test(str)}function isIdentifierStart(ch){return\"$\"===ch||\"_\"===ch||\"\\\\\"===ch||ch>=\"a\"&&\"z\">=ch||ch>=\"A\"&&\"Z\">=ch}var bad,index=0,value=\"\",length=this.input.length,char=this.peek(index),isAllowedDigit=isDecimalDigit,base=10,isLegacy=!1;if(\".\"!==char&&!isDecimalDigit(char))return null;if(\".\"!==char){for(value=this.peek(index),index+=1,char=this.peek(index),\"0\"===value&&((\"x\"===char||\"X\"===char)&&(isAllowedDigit=isHexDigit,base=16,index+=1,value+=char),(\"o\"===char||\"O\"===char)&&(isAllowedDigit=isOctalDigit,base=8,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Octal integer literal\",\"6\"]}),index+=1,value+=char),(\"b\"===char||\"B\"===char)&&(isAllowedDigit=isBinaryDigit,base=2,state.inES6(!0)||this.trigger(\"warning\",{code:\"W119\",line:this.line,character:this.char,data:[\"Binary integer literal\",\"6\"]}),index+=1,value+=char),isOctalDigit(char)&&(isAllowedDigit=isOctalDigit,base=8,isLegacy=!0,bad=!1,index+=1,value+=char),!isOctalDigit(char)&&isDecimalDigit(char)&&(index+=1,value+=char));length>index;){if(char=this.peek(index),isLegacy&&isDecimalDigit(char))bad=!0;else if(!isAllowedDigit(char))break;value+=char,index+=1}if(isAllowedDigit!==isDecimalDigit)return!isLegacy&&2>=value.length?{type:Token.NumericLiteral,value:value,isMalformed:!0}:length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isLegacy:isLegacy,isMalformed:!1}}if(\".\"===char)for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1;if(\"e\"===char||\"E\"===char){if(value+=char,index+=1,char=this.peek(index),(\"+\"===char||\"-\"===char)&&(value+=this.peek(index),index+=1),char=this.peek(index),!isDecimalDigit(char))return null;for(value+=char,index+=1;length>index&&(char=this.peek(index),isDecimalDigit(char));)value+=char,index+=1}return length>index&&(char=this.peek(index),isIdentifierStart(char))?null:{type:Token.NumericLiteral,value:value,base:base,isMalformed:!isFinite(value)}},scanEscapeSequence:function(checks){var allowNewLine=!1,jump=1;this.skip();var char=this.peek();switch(char){case\"'\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\'\"]},checks,function(){return state.jsonMode});break;case\"b\":char=\"\\\\b\";break;case\"f\":char=\"\\\\f\";break;case\"n\":char=\"\\\\n\";break;case\"r\":char=\"\\\\r\";break;case\"t\":char=\"\\\\t\";break;case\"0\":char=\"\\\\0\";var n=parseInt(this.peek(1),10);this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},checks,function(){return n>=0&&7>=n&&state.isStrict()});break;case\"u\":var hexCode=this.input.substr(1,4),code=parseInt(hexCode,16);isNaN(code)&&this.trigger(\"warning\",{code:\"W052\",line:this.line,character:this.char,data:[\"u\"+hexCode]}),char=String.fromCharCode(code),jump=5;break;case\"v\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\v\"]},checks,function(){return state.jsonMode}),char=\"\u000b\";break;case\"x\":var x=parseInt(this.input.substr(1,2),16);this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\x-\"]},checks,function(){return state.jsonMode}),char=String.fromCharCode(x),jump=3;break;case\"\\\\\":char=\"\\\\\\\\\";break;case'\"':char='\\\\\"';break;case\"/\":break;case\"\":allowNewLine=!0,char=\"\"}return{\"char\":char,jump:jump,allowNewLine:allowNewLine}},scanTemplateLiteral:function(checks){var tokenType,ch,value=\"\",startLine=this.line,startChar=this.char,depth=this.templateStarts.length;if(!state.inES6(!0))return null;if(\"`\"===this.peek())tokenType=Token.TemplateHead,this.templateStarts.push({line:this.line,\"char\":this.char}),depth=this.templateStarts.length,this.skip(1),this.pushContext(Context.Template);else{if(!this.inContext(Context.Template)||\"}\"!==this.peek())return null;tokenType=Token.TemplateMiddle}for(;\"`\"!==this.peek();){for(;\"\"===(ch=this.peek());)if(value+=\"\\n\",!this.nextLine()){var startPos=this.templateStarts.pop();return this.trigger(\"error\",{code:\"E052\",line:startPos.line,character:startPos.char}),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,depth:depth,context:this.popContext()}}if(\"$\"===ch&&\"{\"===this.peek(1))return value+=\"${\",this.skip(2),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.currentContext()};\nif(\"\\\\\"===ch){var escape=this.scanEscapeSequence(checks);value+=escape.char,this.skip(escape.jump)}else\"`\"!==ch&&(value+=ch,this.skip(1))}return tokenType=tokenType===Token.TemplateHead?Token.NoSubstTemplate:Token.TemplateTail,this.skip(1),this.templateStarts.pop(),{type:tokenType,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,depth:depth,context:this.popContext()}},scanStringLiteral:function(checks){var quote=this.peek();if('\"'!==quote&&\"'\"!==quote)return null;this.triggerAsync(\"warning\",{code:\"W108\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&'\"'!==quote});var value=\"\",startLine=this.line,startChar=this.char,allowNewLine=!1;for(this.skip();this.peek()!==quote;)if(\"\"===this.peek()){if(allowNewLine?(allowNewLine=!1,this.triggerAsync(\"warning\",{code:\"W043\",line:this.line,character:this.char},checks,function(){return!state.option.multistr}),this.triggerAsync(\"warning\",{code:\"W042\",line:this.line,character:this.char},checks,function(){return state.jsonMode&&state.option.multistr})):this.trigger(\"warning\",{code:\"W112\",line:this.line,character:this.char}),!this.nextLine())return this.trigger(\"error\",{code:\"E029\",line:startLine,character:startChar}),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!0,quote:quote}}else{allowNewLine=!1;var char=this.peek(),jump=1;if(\" \">char&&this.trigger(\"warning\",{code:\"W113\",line:this.line,character:this.char,data:[\"\"]}),\"\\\\\"===char){var parsed=this.scanEscapeSequence(checks);char=parsed.char,jump=parsed.jump,allowNewLine=parsed.allowNewLine}value+=char,this.skip(jump)}return this.skip(),{type:Token.StringLiteral,value:value,startLine:startLine,startChar:startChar,isUnclosed:!1,quote:quote}},scanRegExp:function(){var terminated,index=0,length=this.input.length,char=this.peek(),value=char,body=\"\",flags=[],malformed=!1,isCharSet=!1,scanUnexpectedChars=function(){\" \">char&&(malformed=!0,this.trigger(\"warning\",{code:\"W048\",line:this.line,character:this.char})),\"<\"===char&&(malformed=!0,this.trigger(\"warning\",{code:\"W049\",line:this.line,character:this.char,data:[char]}))}.bind(this);if(!this.prereg||\"/\"!==char)return null;for(index+=1,terminated=!1;length>index;)if(char=this.peek(index),value+=char,body+=char,isCharSet)\"]\"===char&&(\"\\\\\"!==this.peek(index-1)||\"\\\\\"===this.peek(index-2))&&(isCharSet=!1),\"\\\\\"===char&&(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars()),index+=1;else{if(\"\\\\\"===char){if(index+=1,char=this.peek(index),body+=char,value+=char,scanUnexpectedChars(),\"/\"===char){index+=1;continue}if(\"[\"===char){index+=1;continue}}if(\"[\"!==char){if(\"/\"===char){body=body.substr(0,body.length-1),terminated=!0,index+=1;break}index+=1}else isCharSet=!0,index+=1}if(!terminated)return this.trigger(\"error\",{code:\"E015\",line:this.line,character:this.from}),void this.trigger(\"fatal\",{line:this.line,from:this.from});for(;length>index&&(char=this.peek(index),/[gim]/.test(char));)flags.push(char),value+=char,index+=1;try{RegExp(body,flags.join(\"\"))}catch(err){malformed=!0,this.trigger(\"error\",{code:\"E016\",line:this.line,character:this.char,data:[err.message]})}return{type:Token.RegExp,value:value,flags:flags,isMalformed:malformed}},scanNonBreakingSpaces:function(){return state.option.nonbsp?this.input.search(/(\\u00A0)/):-1},scanUnsafeChars:function(){return this.input.search(reg.unsafeChars)},next:function(checks){this.from=this.char;var start;if(/\\s/.test(this.peek()))for(start=this.char;/\\s/.test(this.peek());)this.from+=1,this.skip();var match=this.scanComments()||this.scanStringLiteral(checks)||this.scanTemplateLiteral(checks);return match?match:(match=this.scanRegExp()||this.scanPunctuator()||this.scanKeyword()||this.scanIdentifier()||this.scanNumericLiteral(),match?(this.skip(match.tokenLength||match.value.length),match):null)},nextLine:function(){var char;if(this.line>=this.getLines().length)return!1;this.input=this.getLines()[this.line],this.line+=1,this.char=1,this.from=1;var inputTrimmed=this.input.trim(),startsWith=function(){return _.some(arguments,function(prefix){return 0===inputTrimmed.indexOf(prefix)})},endsWith=function(){return _.some(arguments,function(suffix){return-1!==inputTrimmed.indexOf(suffix,inputTrimmed.length-suffix.length)})};if(this.ignoringLinterErrors===!0&&(startsWith(\"/*\",\"//\")||this.inComment&&endsWith(\"*/\")||(this.input=\"\")),char=this.scanNonBreakingSpaces(),char>=0&&this.trigger(\"warning\",{code:\"W125\",line:this.line,character:char+1}),this.input=this.input.replace(/\\t/g,state.tab),char=this.scanUnsafeChars(),char>=0&&this.trigger(\"warning\",{code:\"W100\",line:this.line,character:char}),!this.ignoringLinterErrors&&state.option.maxlen&&state.option.maxlen=0;--i){var scopeLabels=_scopeStack[i][\"(labels)\"];if(scopeLabels[labelName])return scopeLabels}}function usedSoFarInCurrentFunction(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(usages)\"][labelName])return current[\"(usages)\"][labelName];if(current===_currentFunctBody)break}return!1}function _checkOuterShadow(labelName,token){if(\"outer\"===state.option.shadow)for(var isGlobal=\"global\"===_currentFunctBody[\"(type)\"],isNewFunction=\"functionparams\"===_current[\"(type)\"],outsideCurrentFunction=!isGlobal,i=0;_scopeStack.length>i;i++){var stackItem=_scopeStack[i];isNewFunction||_scopeStack[i+1]!==_currentFunctBody||(outsideCurrentFunction=!1),outsideCurrentFunction&&stackItem[\"(labels)\"][labelName]&&warning(\"W123\",token,labelName),stackItem[\"(breakLabels)\"][labelName]&&warning(\"W123\",token,labelName)}}function _latedefWarning(type,labelName,token){state.option.latedef&&(state.option.latedef===!0&&\"function\"===type||\"function\"!==type)&&warning(\"W003\",token,labelName)}var _current,_scopeStack=[];_newScope(\"global\"),_current[\"(predefined)\"]=predefined;var _currentFunctBody=_current,usedPredefinedAndGlobals=Object.create(null),impliedGlobals=Object.create(null),unuseds=[],emitter=new events.EventEmitter,_getUnusedOption=function(unused_opt){return void 0===unused_opt&&(unused_opt=state.option.unused),unused_opt===!0&&(unused_opt=\"last-param\"),unused_opt},_warnUnused=function(name,tkn,type,unused_opt){var line=tkn.line,chr=tkn.from,raw_name=tkn.raw_text||name;unused_opt=_getUnusedOption(unused_opt);var warnable_types={vars:[\"var\"],\"last-param\":[\"var\",\"param\"],strict:[\"var\",\"param\",\"last-param\"]};unused_opt&&warnable_types[unused_opt]&&-1!==warnable_types[unused_opt].indexOf(type)&&warning(\"W098\",{line:line,from:chr},raw_name),(unused_opt||\"var\"===type)&&unuseds.push({name:name,line:line,character:chr})},scopeManagerInst={on:function(names,listener){names.split(\" \").forEach(function(name){emitter.on(name,listener)})},isPredefined:function(labelName){return!this.has(labelName)&&_.has(_scopeStack[0][\"(predefined)\"],labelName)},stack:function(type){var previousScope=_current;_newScope(type),type||\"functionparams\"!==previousScope[\"(type)\"]||(_current[\"(isFuncBody)\"]=!0,_current[\"(context)\"]=_currentFunctBody,_currentFunctBody=_current)},unstack:function(){var i,j,subScope=_scopeStack.length>1?_scopeStack[_scopeStack.length-2]:null,isUnstackingFunctionBody=_current===_currentFunctBody,isUnstackingFunctionParams=\"functionparams\"===_current[\"(type)\"],isUnstackingFunctionOuter=\"functionouter\"===_current[\"(type)\"],currentUsages=_current[\"(usages)\"],currentLabels=_current[\"(labels)\"],usedLabelNameList=Object.keys(currentUsages);for(currentUsages.__proto__&&-1===usedLabelNameList.indexOf(\"__proto__\")&&usedLabelNameList.push(\"__proto__\"),i=0;usedLabelNameList.length>i;i++){var usedLabelName=usedLabelNameList[i],usage=currentUsages[usedLabelName],usedLabel=currentLabels[usedLabelName];if(usedLabel){var usedLabelType=usedLabel[\"(type)\"];if(usedLabel[\"(useOutsideOfScope)\"]&&!state.option.funcscope){var usedTokens=usage[\"(tokens)\"];if(usedTokens)for(j=0;usedTokens.length>j;j++)usedLabel[\"(function)\"]===usedTokens[j][\"(function)\"]&&error(\"W038\",usedTokens[j],usedLabelName)}if(_current[\"(labels)\"][usedLabelName][\"(unused)\"]=!1,\"const\"===usedLabelType&&usage[\"(modified)\"])for(j=0;usage[\"(modified)\"].length>j;j++)error(\"E013\",usage[\"(modified)\"][j],usedLabelName);if((\"function\"===usedLabelType||\"class\"===usedLabelType)&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)error(\"W021\",usage[\"(reassigned)\"][j],usedLabelName,usedLabelType)}else if(isUnstackingFunctionOuter&&(state.funct[\"(isCapturing)\"]=!0),subScope)if(subScope[\"(usages)\"][usedLabelName]){var subScopeUsage=subScope[\"(usages)\"][usedLabelName];subScopeUsage[\"(modified)\"]=subScopeUsage[\"(modified)\"].concat(usage[\"(modified)\"]),subScopeUsage[\"(tokens)\"]=subScopeUsage[\"(tokens)\"].concat(usage[\"(tokens)\"]),subScopeUsage[\"(reassigned)\"]=subScopeUsage[\"(reassigned)\"].concat(usage[\"(reassigned)\"]),subScopeUsage[\"(onlyUsedSubFunction)\"]=!1}else subScope[\"(usages)\"][usedLabelName]=usage,isUnstackingFunctionBody&&(subScope[\"(usages)\"][usedLabelName][\"(onlyUsedSubFunction)\"]=!0);else if(\"boolean\"==typeof _current[\"(predefined)\"][usedLabelName]){if(delete declared[usedLabelName],usedPredefinedAndGlobals[usedLabelName]=marker,_current[\"(predefined)\"][usedLabelName]===!1&&usage[\"(reassigned)\"])for(j=0;usage[\"(reassigned)\"].length>j;j++)warning(\"W020\",usage[\"(reassigned)\"][j])}else if(usage[\"(tokens)\"])for(j=0;usage[\"(tokens)\"].length>j;j++){var undefinedToken=usage[\"(tokens)\"][j];undefinedToken.forgiveUndef||(state.option.undef&&!undefinedToken.ignoreUndef&&warning(\"W117\",undefinedToken,usedLabelName),impliedGlobals[usedLabelName]?impliedGlobals[usedLabelName].line.push(undefinedToken.line):impliedGlobals[usedLabelName]={name:usedLabelName,line:[undefinedToken.line]})}}if(subScope||Object.keys(declared).forEach(function(labelNotUsed){_warnUnused(labelNotUsed,declared[labelNotUsed],\"var\")}),subScope&&!isUnstackingFunctionBody&&!isUnstackingFunctionParams&&!isUnstackingFunctionOuter){var labelNames=Object.keys(currentLabels);for(i=0;labelNames.length>i;i++){var defLabelName=labelNames[i];currentLabels[defLabelName][\"(blockscoped)\"]||\"exception\"===currentLabels[defLabelName][\"(type)\"]||this.funct.has(defLabelName,{excludeCurrent:!0})||(subScope[\"(labels)\"][defLabelName]=currentLabels[defLabelName],\"global\"!==_currentFunctBody[\"(type)\"]&&(subScope[\"(labels)\"][defLabelName][\"(useOutsideOfScope)\"]=!0),delete currentLabels[defLabelName])}}_checkForUnused(),_scopeStack.pop(),isUnstackingFunctionBody&&(_currentFunctBody=_scopeStack[_.findLastIndex(_scopeStack,function(scope){return scope[\"(isFuncBody)\"]||\"global\"===scope[\"(type)\"]})]),_current=subScope},addParam:function(labelName,token,type){if(type=type||\"param\",\"exception\"===type){var previouslyDefinedLabelType=this.funct.labeltype(labelName);previouslyDefinedLabelType&&\"exception\"!==previouslyDefinedLabelType&&(state.option.node||warning(\"W002\",state.tokens.next,labelName))}if(_.has(_current[\"(labels)\"],labelName)?_current[\"(labels)\"][labelName].duplicated=!0:(_checkOuterShadow(labelName,token,type),_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":token,\"(unused)\":!0},_current[\"(params)\"].push(labelName)),_.has(_current[\"(usages)\"],labelName)){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}},validateParams:function(){if(\"global\"!==_currentFunctBody[\"(type)\"]){var isStrict=state.isStrict(),currentFunctParamScope=_currentFunctBody[\"(parent)\"];currentFunctParamScope[\"(params)\"]&¤tFunctParamScope[\"(params)\"].forEach(function(labelName){var label=currentFunctParamScope[\"(labels)\"][labelName];label&&label.duplicated&&(isStrict?warning(\"E011\",label[\"(token)\"],labelName):state.option.shadow!==!0&&warning(\"W004\",label[\"(token)\"],labelName))})}},getUsedOrDefinedGlobals:function(){var list=Object.keys(usedPredefinedAndGlobals);return usedPredefinedAndGlobals.__proto__===marker&&-1===list.indexOf(\"__proto__\")&&list.push(\"__proto__\"),list},getImpliedGlobals:function(){var values=_.values(impliedGlobals),hasProto=!1;return impliedGlobals.__proto__&&(hasProto=values.some(function(value){return\"__proto__\"===value.name}),hasProto||values.push(impliedGlobals.__proto__)),values},getUnuseds:function(){return unuseds},has:function(labelName){return Boolean(_getLabel(labelName))},labeltype:function(labelName){var scopeLabels=_getLabel(labelName);return scopeLabels?scopeLabels[labelName][\"(type)\"]:null},addExported:function(labelName){var globalLabels=_scopeStack[0][\"(labels)\"];if(_.has(declared,labelName))delete declared[labelName];else if(_.has(globalLabels,labelName))globalLabels[labelName][\"(unused)\"]=!1;else{for(var i=1;_scopeStack.length>i;i++){var scope=_scopeStack[i];if(scope[\"(type)\"])break;if(_.has(scope[\"(labels)\"],labelName)&&!scope[\"(labels)\"][labelName][\"(blockscoped)\"])return scope[\"(labels)\"][labelName][\"(unused)\"]=!1,void 0}exported[labelName]=!0}},setExported:function(labelName,token){this.block.use(labelName,token)\n},addlabel:function(labelName,opts){var type=opts.type,token=opts.token,isblockscoped=\"let\"===type||\"const\"===type||\"class\"===type,isexported=\"global\"===(isblockscoped?_current:_currentFunctBody)[\"(type)\"]&&_.has(exported,labelName);if(_checkOuterShadow(labelName,token,type),isblockscoped){var declaredInCurrentScope=_current[\"(labels)\"][labelName];if(declaredInCurrentScope||_current!==_currentFunctBody||\"global\"===_current[\"(type)\"]||(declaredInCurrentScope=!!_currentFunctBody[\"(parent)\"][\"(labels)\"][labelName]),!declaredInCurrentScope&&_current[\"(usages)\"][labelName]){var usage=_current[\"(usages)\"][labelName];usage[\"(onlyUsedSubFunction)\"]?_latedefWarning(type,labelName,token):warning(\"E056\",token,labelName,type)}declaredInCurrentScope?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&scopeManagerInst.funct.has(labelName)&&warning(\"W004\",token,labelName),scopeManagerInst.block.add(labelName,type,token,!isexported)}else{var declaredInCurrentFunctionScope=scopeManagerInst.funct.has(labelName);!declaredInCurrentFunctionScope&&usedSoFarInCurrentFunction(labelName)&&_latedefWarning(type,labelName,token),scopeManagerInst.funct.has(labelName,{onlyBlockscoped:!0})?warning(\"E011\",token,labelName):state.option.shadow!==!0&&declaredInCurrentFunctionScope&&\"__proto__\"!==labelName&&\"global\"!==_currentFunctBody[\"(type)\"]&&warning(\"W004\",token,labelName),scopeManagerInst.funct.add(labelName,type,token,!isexported),\"global\"===_currentFunctBody[\"(type)\"]&&(usedPredefinedAndGlobals[labelName]=marker)}},funct:{labeltype:function(labelName,options){for(var onlyBlockscoped=options&&options.onlyBlockscoped,excludeParams=options&&options.excludeParams,currentScopeIndex=_scopeStack.length-(options&&options.excludeCurrent?2:1),i=currentScopeIndex;i>=0;i--){var current=_scopeStack[i];if(current[\"(labels)\"][labelName]&&(!onlyBlockscoped||current[\"(labels)\"][labelName][\"(blockscoped)\"]))return current[\"(labels)\"][labelName][\"(type)\"];var scopeCheck=excludeParams?_scopeStack[i-1]:current;if(scopeCheck&&\"functionparams\"===scopeCheck[\"(type)\"])return null}return null},hasBreakLabel:function(labelName){for(var i=_scopeStack.length-1;i>=0;i--){var current=_scopeStack[i];if(current[\"(breakLabels)\"][labelName])return!0;if(\"functionparams\"===current[\"(type)\"])return!1}return!1},has:function(labelName,options){return Boolean(this.labeltype(labelName,options))},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!1,\"(function)\":_currentFunctBody,\"(unused)\":unused}}},block:{isGlobal:function(){return\"global\"===_current[\"(type)\"]},use:function(labelName,token){var paramScope=_currentFunctBody[\"(parent)\"];paramScope&¶mScope[\"(labels)\"][labelName]&&\"param\"===paramScope[\"(labels)\"][labelName][\"(type)\"]&&(scopeManagerInst.funct.has(labelName,{excludeParams:!0,onlyBlockscoped:!0})||(paramScope[\"(labels)\"][labelName][\"(unused)\"]=!1)),token&&(state.ignored.W117||state.option.undef===!1)&&(token.ignoreUndef=!0),_setupUsages(labelName),token&&(token[\"(function)\"]=_currentFunctBody,_current[\"(usages)\"][labelName][\"(tokens)\"].push(token))},reassign:function(labelName,token){this.modify(labelName,token),_current[\"(usages)\"][labelName][\"(reassigned)\"].push(token)},modify:function(labelName,token){_setupUsages(labelName),_current[\"(usages)\"][labelName][\"(modified)\"].push(token)},add:function(labelName,type,tok,unused){_current[\"(labels)\"][labelName]={\"(type)\":type,\"(token)\":tok,\"(blockscoped)\":!0,\"(unused)\":unused}},addBreakLabel:function(labelName,opts){var token=opts.token;scopeManagerInst.funct.hasBreakLabel(labelName)?warning(\"E011\",token,labelName):\"outer\"===state.option.shadow&&(scopeManagerInst.funct.has(labelName)?warning(\"W004\",token,labelName):_checkOuterShadow(labelName,token)),_current[\"(breakLabels)\"][labelName]=token}}};return scopeManagerInst};module.exports=scopeManager},{\"../lodash\":\"/node_modules/jshint/lodash.js\",events:\"/node_modules/browserify/node_modules/events/events.js\"}],\"/node_modules/jshint/src/state.js\":[function(_dereq_,module,exports){\"use strict\";var NameStack=_dereq_(\"./name-stack.js\"),state={syntax:{},isStrict:function(){return this.directive[\"use strict\"]||this.inClassBody||this.option.module||\"implied\"===this.option.strict},inMoz:function(){return this.option.moz},inES6:function(){return this.option.moz||this.option.esversion>=6},inES5:function(strict){return strict?!(this.option.esversion&&5!==this.option.esversion||this.option.moz):!this.option.esversion||this.option.esversion>=5||this.option.moz},reset:function(){this.tokens={prev:null,next:null,curr:null},this.option={},this.funct=null,this.ignored={},this.directive={},this.jsonMode=!1,this.jsonWarnings=[],this.lines=[],this.tab=\"\",this.cache={},this.ignoredLines={},this.forinifcheckneeded=!1,this.nameStack=new NameStack,this.inClassBody=!1}};exports.state=state},{\"./name-stack.js\":\"/node_modules/jshint/src/name-stack.js\"}],\"/node_modules/jshint/src/style.js\":[function(_dereq_,module,exports){\"use strict\";exports.register=function(linter){linter.on(\"Identifier\",function(data){linter.getOption(\"proto\")||\"__proto__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name,\"6\"]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"iterator\")||\"__iterator__\"===data.name&&linter.warn(\"W103\",{line:data.line,\"char\":data.char,data:[data.name]})}),linter.on(\"Identifier\",function(data){linter.getOption(\"camelcase\")&&data.name.replace(/^_+|_+$/g,\"\").indexOf(\"_\")>-1&&!data.name.match(/^[A-Z0-9_]*$/)&&linter.warn(\"W106\",{line:data.line,\"char\":data.from,data:[data.name]})}),linter.on(\"String\",function(data){var code,quotmark=linter.getOption(\"quotmark\");quotmark&&(\"single\"===quotmark&&\"'\"!==data.quote&&(code=\"W109\"),\"double\"===quotmark&&'\"'!==data.quote&&(code=\"W108\"),quotmark===!0&&(linter.getCache(\"quotmark\")||linter.setCache(\"quotmark\",data.quote),linter.getCache(\"quotmark\")!==data.quote&&(code=\"W110\")),code&&linter.warn(code,{line:data.line,\"char\":data.char}))}),linter.on(\"Number\",function(data){\".\"===data.value.charAt(0)&&linter.warn(\"W008\",{line:data.line,\"char\":data.char,data:[data.value]}),\".\"===data.value.substr(data.value.length-1)&&linter.warn(\"W047\",{line:data.line,\"char\":data.char,data:[data.value]}),/^00+/.test(data.value)&&linter.warn(\"W046\",{line:data.line,\"char\":data.char,data:[data.value]})}),linter.on(\"String\",function(data){var re=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\\s*:/i;linter.getOption(\"scripturl\")||re.test(data.value)&&linter.warn(\"W107\",{line:data.line,\"char\":data.char})})}},{}],\"/node_modules/jshint/src/vars.js\":[function(_dereq_,module,exports){\"use strict\";exports.reservedVars={arguments:!1,NaN:!1},exports.ecmaIdentifiers={3:{Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},5:{JSON:!1},6:{Map:!1,Promise:!1,Proxy:!1,Reflect:!1,Set:!1,Symbol:!1,WeakMap:!1,WeakSet:!1}},exports.browser={Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CSS:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,Comment:!1,CustomEvent:!1,DOMParser:!1,defaultStatus:!1,Document:!1,document:!1,DocumentFragment:!1,Element:!1,ElementTimeControl:!1,Event:!1,event:!1,fetch:!1,FileReader:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Image:!1,Intl:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,performance:!1,print:!1,Range:!1,requestAnimationFrame:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimationElement:!1,SVGCSSRule:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLineElement:!1,SVGLinearGradientElement:!1,SVGLocatable:!1,SVGMPathElement:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGSVGElement:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformList:!1,SVGTransformable:!1,SVGURIReference:!1,SVGUnitTypes:!1,SVGUseElement:!1,SVGVKernElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},exports.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},exports.worker={importScripts:!0,postMessage:!0,self:!0,FileReaderSync:!0},exports.nonstandard={escape:!1,unescape:!1},exports.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},exports.node={__filename:!1,__dirname:!1,GLOBAL:!1,global:!1,module:!1,acequire:!1,Buffer:!0,console:!0,exports:!0,process:!0,setTimeout:!0,clearTimeout:!0,setInterval:!0,clearInterval:!0,setImmediate:!0,clearImmediate:!0},exports.browserify={__filename:!1,__dirname:!1,global:!1,module:!1,acequire:!1,Buffer:!0,exports:!0,process:!0},exports.phantom={phantom:!0,acequire:!0,WebPage:!0,console:!0,exports:!0},exports.qunit={asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,\"throws\":!1},exports.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},exports.shelljs={target:!1,echo:!1,exit:!1,cd:!1,pwd:!1,ls:!1,find:!1,cp:!1,rm:!1,mv:!1,mkdir:!1,test:!1,cat:!1,sed:!1,grep:!1,which:!1,dirs:!1,pushd:!1,popd:!1,env:!1,exec:!1,chmod:!1,config:!1,error:!1,tempdir:!1},exports.typed={ArrayBuffer:!1,ArrayBufferView:!1,DataView:!1,Float32Array:!1,Float64Array:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1},exports.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},exports.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},exports.jquery={$:!1,jQuery:!1},exports.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,IFrame:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},exports.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},exports.yui={YUI:!1,Y:!1,YUI_config:!1},exports.mocha={mocha:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,context:!1,xcontext:!1,before:!1,after:!1,beforeEach:!1,afterEach:!1,suite:!1,test:!1,setup:!1,teardown:!1,suiteSetup:!1,suiteTeardown:!1},exports.jasmine={jasmine:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,beforeEach:!1,afterEach:!1,setFixtures:!1,loadFixtures:!1,spyOn:!1,expect:!1,runs:!1,waitsFor:!1,waits:!1,beforeAll:!1,afterAll:!1,fail:!1,fdescribe:!1,fit:!1,pending:!1}},{}]},{},[\"/node_modules/jshint/src/jshint.js\"])}),ace.define(\"ace/mode/javascript_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/javascript/jshint\"],function(acequire,exports,module){\"use strict\";function startRegex(arr){return RegExp(\"^(\"+arr.join(\"|\")+\")\")}var oop=acequire(\"../lib/oop\"),Mirror=acequire(\"../worker/mirror\").Mirror,lint=acequire(\"./javascript/jshint\").JSHINT,disabledWarningsRe=startRegex([\"Bad for in variable '(.+)'.\",'Missing \"use strict\"']),errorsRe=startRegex([\"Unexpected\",\"Expected \",\"Confusing (plus|minus)\",\"\\\\{a\\\\} unterminated regular expression\",\"Unclosed \",\"Unmatched \",\"Unbegun comment\",\"Bad invocation\",\"Missing space after\",\"Missing operator at\"]),infoRe=startRegex([\"Expected an assignment\",\"Bad escapement of EOL\",\"Unexpected comma\",\"Unexpected space\",\"Missing radix parameter.\",\"A leading decimal point can\",\"\\\\['{a}'\\\\] is better written in dot notation.\",\"'{a}' used out of scope\"]),JavaScriptWorker=exports.JavaScriptWorker=function(sender){Mirror.call(this,sender),this.setTimeout(500),this.setOptions()};oop.inherits(JavaScriptWorker,Mirror),function(){this.setOptions=function(options){this.options=options||{esnext:!0,moz:!0,devel:!0,browser:!0,node:!0,laxcomma:!0,laxbreak:!0,lastsemic:!0,onevar:!1,passfail:!1,maxerr:100,expr:!0,multistr:!0,globalstrict:!0},this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.changeOptions=function(newOptions){oop.mixin(this.options,newOptions),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.isValidJS=function(str){try{eval(\"throw 0;\"+str)}catch(e){if(0===e)return!0}return!1},this.onUpdate=function(){var value=this.doc.getValue();if(value=value.replace(/^#!.*\\n/,\"\\n\"),!value)return this.sender.emit(\"annotate\",[]);var errors=[],maxErrorLevel=this.isValidJS(value)?\"warning\":\"error\";lint(value,this.options);for(var results=lint.errors,errorAdded=!1,i=0;results.length>i;i++){var error=results[i];if(error){var raw=error.raw,type=\"warning\";if(\"Missing semicolon.\"==raw){var str=error.evidence.substr(error.character);str=str.charAt(str.search(/\\S/)),\"error\"==maxErrorLevel&&str&&/[\\w\\d{(['\"]/.test(str)?(error.reason='Missing \";\" before statement',type=\"error\"):type=\"info\"}else{if(disabledWarningsRe.test(raw))continue;infoRe.test(raw)?type=\"info\":errorsRe.test(raw)?(errorAdded=!0,type=maxErrorLevel):\"'{a}' is not defined.\"==raw?type=\"warning\":\"'{a}' is defined but never used.\"==raw&&(type=\"info\")}errors.push({row:error.line-1,column:error.character-1,text:error.reason,type:type,raw:raw})}}this.sender.emit(\"annotate\",errors)}}.call(JavaScriptWorker.prototype)}),ace.define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,\"sentinel\",{}),\"sentinel\"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if(\"function\"!=typeof target)throw new TypeError(\"Function.prototype.bind called on incompatible \"+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,\"__defineGetter__\"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,\"XXX\"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return\"[object Array]\"==_toString(obj)});var boxedString=Object(\"a\"),splitString=\"a\"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=[],thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduce of empty array with no initial value\");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError(\"reduce of empty array with no initial value\")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduceRight of empty array with no initial value\");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError(\"reduceRight of empty array with no initial value\")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(object,property){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if(\"object\"!=typeof prototype)throw new TypeError(\"typeof prototype[\"+typeof prototype+\"] != 'object'\");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom=\"undefined\"==typeof document||doesDefinePropertyWork(document.createElement(\"div\"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR=\"Property description must be an object: \",ERR_NON_OBJECT_TARGET=\"Object.defineProperty called on non-object: \",ERR_ACCESSORS_NOT_SUPPORTED=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(object,property,descriptor){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if(\"object\"!=typeof descriptor&&\"function\"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,\"value\"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,\"get\")&&defineGetter(object,property,descriptor.get),owns(descriptor,\"set\")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return\"function\"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name=\"\";owns(object,name);)name+=\"?\";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(\"Object.keys called on a non-object\");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws=\"\t\\n\u000b\\f\\r \\u2028\\u2029\";if(!String.prototype.trim||ws.trim()){ws=\"[\"+ws+\"]\";var trimBeginRegexp=RegExp(\"^\"+ws+ws+\"*\"),trimEndRegexp=RegExp(ws+ws+\"*$\");String.prototype.trim=function(){return(this+\"\").replace(trimBeginRegexp,\"\").replace(trimEndRegexp,\"\")}}var toObject=function(o){if(null==o)throw new TypeError(\"can't convert \"+o+\" to object\");return Object(o)}});";
+},{}],75:[function(require,module,exports){
+module.exports.id = 'ace/mode/json_worker';
+module.exports.src = "\"no use strict\";(function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\"\";testPath;){var alias=paths[testPath];if(\"string\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,\"/\")+(tail||alias.main||alias.name);if(alias===!1)return\"\";var i=testPath.lastIndexOf(\"/\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\"error\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\"!\")){var chunks=moduleName.split(\"!\");return window.normalizeModule(parentId,chunks[0])+\"!\"+window.normalizeModule(parentId,chunks[1])}if(\".\"==moduleName.charAt(0)){var base=parentId.split(\"/\").slice(0,-1).join(\"/\");for(moduleName=(base?base+\"/\":\"\")+moduleName;-1!==moduleName.indexOf(\".\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\"worker.js acequire() accepts only (parentId, id) as arguments\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\"unable to load \"+id);var path=resolveModuleId(id,window.acequire.tlns);return\".js\"!=path.slice(-3)&&(path+=\".js\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\"string\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\"function\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\"require\",\"exports\",\"module\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\"require\":return req;case\"exports\":return module.exports;case\"module\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\"ace/lib/event_emitter\").EventEmitter,oop=window.acequire(\"ace/lib/oop\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\"call\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\"event\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\"Unknown command:\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\"ace/lib/es5-shim\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}})(this),ace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\"object\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\"object\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\"\";switch(delta.action){case\"insert\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\"remove\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\"object\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\"unshift\":\"push\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.columnthis.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal(\"change\",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/apply_delta\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),applyDelta=acequire(\"./apply_delta\").applyDelta,EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Range=acequire(\"./range\").Range,Anchor=acequire(\"./anchor\").Anchor,Document=function(textOrLines){this.$lines=[\"\"],0===textOrLines.length?this.$lines=[\"\"]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0===\"aaa\".split(/a/).length?function(text){return text.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:function(text){return text.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=match?match[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal(\"changeNewLineMode\"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return\"\\r\\n\"==text||\"\\r\"==text||\"\\n\"==text},this.getLine=function(row){return this.$lines[row]||\"\"},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||\"\").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\"),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\"),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\"),this.insertMergedLines(position,[\"\",\"\"])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:\"insert\",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([\"\"]),column=0):(lines=[\"\"].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:\"insert\",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:\"remove\",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:\"remove\",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:\"remove\",lines:[\"\",\"\"]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert=\"insert\"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal(\"change\",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(\"\"),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:\"insert\"==delta.action?\"remove\":\"insert\",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split(\"\").reverse().join(\"\")},exports.stringRepeat=function(string,count){for(var result=\"\";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\s\\s*/,trimEndRegexp=/\\s\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,\"\")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,\"\")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&\"object\"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if(\"object\"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}var cons=obj.constructor;if(cons===RegExp)return obj;copy=cons();for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},exports.escapeHTML=function(str){return str.replace(/&/g,\"&\").replace(/\"/g,\""\").replace(/'/g,\"'\").replace(/i;i+=2){if(Array.isArray(data[i+1]))var d={action:\"insert\",start:data[i],lines:data[i+1]};else var d={action:\"remove\",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define(\"ace/mode/json/json_parse\",[\"require\",\"exports\",\"module\"],function(){\"use strict\";var at,ch,text,value,escapee={'\"':'\"',\"\\\\\":\"\\\\\",\"/\":\"/\",b:\"\\b\",f:\"\\f\",n:\"\\n\",r:\"\\r\",t:\"\t\"},error=function(m){throw{name:\"SyntaxError\",message:m,at:at,text:text}},next=function(c){return c&&c!==ch&&error(\"Expected '\"+c+\"' instead of '\"+ch+\"'\"),ch=text.charAt(at),at+=1,ch},number=function(){var number,string=\"\";for(\"-\"===ch&&(string=\"-\",next(\"-\"));ch>=\"0\"&&\"9\">=ch;)string+=ch,next();if(\".\"===ch)for(string+=\".\";next()&&ch>=\"0\"&&\"9\">=ch;)string+=ch;if(\"e\"===ch||\"E\"===ch)for(string+=ch,next(),(\"-\"===ch||\"+\"===ch)&&(string+=ch,next());ch>=\"0\"&&\"9\">=ch;)string+=ch,next();return number=+string,isNaN(number)?(error(\"Bad number\"),void 0):number},string=function(){var hex,i,uffff,string=\"\";if('\"'===ch)for(;next();){if('\"'===ch)return next(),string;if(\"\\\\\"===ch)if(next(),\"u\"===ch){for(uffff=0,i=0;4>i&&(hex=parseInt(next(),16),isFinite(hex));i+=1)uffff=16*uffff+hex;string+=String.fromCharCode(uffff)}else{if(\"string\"!=typeof escapee[ch])break;string+=escapee[ch]}else string+=ch}error(\"Bad string\")},white=function(){for(;ch&&\" \">=ch;)next()},word=function(){switch(ch){case\"t\":return next(\"t\"),next(\"r\"),next(\"u\"),next(\"e\"),!0;case\"f\":return next(\"f\"),next(\"a\"),next(\"l\"),next(\"s\"),next(\"e\"),!1;case\"n\":return next(\"n\"),next(\"u\"),next(\"l\"),next(\"l\"),null}error(\"Unexpected '\"+ch+\"'\")},array=function(){var array=[];if(\"[\"===ch){if(next(\"[\"),white(),\"]\"===ch)return next(\"]\"),array;for(;ch;){if(array.push(value()),white(),\"]\"===ch)return next(\"]\"),array;next(\",\"),white()}}error(\"Bad array\")},object=function(){var key,object={};if(\"{\"===ch){if(next(\"{\"),white(),\"}\"===ch)return next(\"}\"),object;for(;ch;){if(key=string(),white(),next(\":\"),Object.hasOwnProperty.call(object,key)&&error('Duplicate key \"'+key+'\"'),object[key]=value(),white(),\"}\"===ch)return next(\"}\"),object;next(\",\"),white()}}error(\"Bad object\")};return value=function(){switch(white(),ch){case\"{\":return object();case\"[\":return array();case'\"':return string();case\"-\":return number();default:return ch>=\"0\"&&\"9\">=ch?number():word()}},function(source,reviver){var result;return text=source,at=0,ch=\" \",result=value(),white(),ch&&error(\"Syntax error\"),\"function\"==typeof reviver?function walk(holder,key){var k,v,value=holder[key];if(value&&\"object\"==typeof value)for(k in value)Object.hasOwnProperty.call(value,k)&&(v=walk(value,k),void 0!==v?value[k]=v:delete value[k]);return reviver.call(holder,key,value)}({\"\":result},\"\"):result}}),ace.define(\"ace/mode/json_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/json/json_parse\"],function(acequire,exports){\"use strict\";var oop=acequire(\"../lib/oop\"),Mirror=acequire(\"../worker/mirror\").Mirror,parse=acequire(\"./json/json_parse\"),JsonWorker=exports.JsonWorker=function(sender){Mirror.call(this,sender),this.setTimeout(200)};oop.inherits(JsonWorker,Mirror),function(){this.onUpdate=function(){var value=this.doc.getValue(),errors=[];try{value&&parse(value)}catch(e){var pos=this.doc.indexToPosition(e.at-1);errors.push({row:pos.row,column:pos.column,text:e.message,type:\"error\"})}this.sender.emit(\"annotate\",errors)}}.call(JsonWorker.prototype)}),ace.define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,\"sentinel\",{}),\"sentinel\"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if(\"function\"!=typeof target)throw new TypeError(\"Function.prototype.bind called on incompatible \"+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,\"__defineGetter__\"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,\"XXX\"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0\n}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return\"[object Array]\"==_toString(obj)});var boxedString=Object(\"a\"),splitString=\"a\"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,thisp=arguments[1],i=-1,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,result=[],thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0,thisp=arguments[1];if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduce of empty array with no initial value\");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError(\"reduce of empty array with no initial value\")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):object,length=self.length>>>0;if(\"[object Function]\"!=_toString(fun))throw new TypeError(fun+\" is not a function\");if(!length&&1==arguments.length)throw new TypeError(\"reduceRight of empty array with no initial value\");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError(\"reduceRight of empty array with no initial value\")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&\"[object String]\"==_toString(this)?this.split(\"\"):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(object,property){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if(\"object\"!=typeof prototype)throw new TypeError(\"typeof prototype[\"+typeof prototype+\"] != 'object'\");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom=\"undefined\"==typeof document||doesDefinePropertyWork(document.createElement(\"div\"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR=\"Property description must be an object: \",ERR_NON_OBJECT_TARGET=\"Object.defineProperty called on non-object: \",ERR_ACCESSORS_NOT_SUPPORTED=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(object,property,descriptor){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if(\"object\"!=typeof descriptor&&\"function\"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,\"value\"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,\"get\")&&defineGetter(object,property,descriptor.get),owns(descriptor,\"set\")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return\"function\"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name=\"\";owns(object,name);)name+=\"?\";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if(\"object\"!=typeof object&&\"function\"!=typeof object||null===object)throw new TypeError(\"Object.keys called on a non-object\");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws=\"\t\\n\u000b\\f\\r \\u2028\\u2029\";if(!String.prototype.trim||ws.trim()){ws=\"[\"+ws+\"]\";var trimBeginRegexp=RegExp(\"^\"+ws+ws+\"*\"),trimEndRegexp=RegExp(ws+ws+\"*$\");String.prototype.trim=function(){return(this+\"\").replace(trimBeginRegexp,\"\").replace(trimEndRegexp,\"\")}}var toObject=function(o){if(null==o)throw new TypeError(\"can't convert \"+o+\" to object\");return Object(o)}});";
+},{}],76:[function(require,module,exports){
+var r;
+
+module.exports = function rand(len) {
+ if (!r)
+ r = new Rand(null);
+
+ return r.generate(len);
+};
+
+function Rand(rand) {
+ this.rand = rand;
+}
+module.exports.Rand = Rand;
+
+Rand.prototype.generate = function generate(len) {
+ return this._rand(len);
+};
+
+// Emulate crypto API using randy
+Rand.prototype._rand = function _rand(n) {
+ if (this.rand.getBytes)
+ return this.rand.getBytes(n);
+
+ var res = new Uint8Array(n);
+ for (var i = 0; i < res.length; i++)
+ res[i] = this.rand.getByte();
+ return res;
+};
+
+if (typeof self === 'object') {
+ if (self.crypto && self.crypto.getRandomValues) {
+ // Modern browsers
+ Rand.prototype._rand = function _rand(n) {
+ var arr = new Uint8Array(n);
+ self.crypto.getRandomValues(arr);
+ return arr;
+ };
+ } else if (self.msCrypto && self.msCrypto.getRandomValues) {
+ // IE
+ Rand.prototype._rand = function _rand(n) {
+ var arr = new Uint8Array(n);
+ self.msCrypto.getRandomValues(arr);
+ return arr;
+ };
+
+ // Safari's WebWorkers do not have `crypto`
+ } else if (typeof window === 'object') {
+ // Old junk
+ Rand.prototype._rand = function() {
+ throw new Error('Not implemented yet');
+ };
+ }
+} else {
+ // Node.js or Web worker with no crypto support
+ try {
+ var crypto = require('crypto');
+ if (typeof crypto.randomBytes !== 'function')
+ throw new Error('Not supported');
+
+ Rand.prototype._rand = function _rand(n) {
+ return crypto.randomBytes(n);
+ };
+ } catch (e) {
+ }
+}
+
+},{"crypto":77}],77:[function(require,module,exports){
+
+},{}],78:[function(require,module,exports){
+// based on the aes implimentation in triple sec
+// https://github.com/keybase/triplesec
+// which is in turn based on the one from crypto-js
+// https://code.google.com/p/crypto-js/
+
+var Buffer = require('safe-buffer').Buffer
+
+function asUInt32Array (buf) {
+ if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
+
+ var len = (buf.length / 4) | 0
+ var out = new Array(len)
+
+ for (var i = 0; i < len; i++) {
+ out[i] = buf.readUInt32BE(i * 4)
+ }
+
+ return out
+}
+
+function scrubVec (v) {
+ for (var i = 0; i < v.length; v++) {
+ v[i] = 0
+ }
+}
+
+function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {
+ var SUB_MIX0 = SUB_MIX[0]
+ var SUB_MIX1 = SUB_MIX[1]
+ var SUB_MIX2 = SUB_MIX[2]
+ var SUB_MIX3 = SUB_MIX[3]
+
+ var s0 = M[0] ^ keySchedule[0]
+ var s1 = M[1] ^ keySchedule[1]
+ var s2 = M[2] ^ keySchedule[2]
+ var s3 = M[3] ^ keySchedule[3]
+ var t0, t1, t2, t3
+ var ksRow = 4
+
+ for (var round = 1; round < nRounds; round++) {
+ t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]
+ t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]
+ t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]
+ t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]
+ s0 = t0
+ s1 = t1
+ s2 = t2
+ s3 = t3
+ }
+
+ t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
+ t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
+ t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
+ t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
+ t0 = t0 >>> 0
+ t1 = t1 >>> 0
+ t2 = t2 >>> 0
+ t3 = t3 >>> 0
+
+ return [t0, t1, t2, t3]
+}
+
+// AES constants
+var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
+var G = (function () {
+ // Compute double table
+ var d = new Array(256)
+ for (var j = 0; j < 256; j++) {
+ if (j < 128) {
+ d[j] = j << 1
+ } else {
+ d[j] = (j << 1) ^ 0x11b
+ }
+ }
+
+ var SBOX = []
+ var INV_SBOX = []
+ var SUB_MIX = [[], [], [], []]
+ var INV_SUB_MIX = [[], [], [], []]
+
+ // Walk GF(2^8)
+ var x = 0
+ var xi = 0
+ for (var i = 0; i < 256; ++i) {
+ // Compute sbox
+ var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
+ sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
+ SBOX[x] = sx
+ INV_SBOX[sx] = x
+
+ // Compute multiplication
+ var x2 = d[x]
+ var x4 = d[x2]
+ var x8 = d[x4]
+
+ // Compute sub bytes, mix columns tables
+ var t = (d[sx] * 0x101) ^ (sx * 0x1010100)
+ SUB_MIX[0][x] = (t << 24) | (t >>> 8)
+ SUB_MIX[1][x] = (t << 16) | (t >>> 16)
+ SUB_MIX[2][x] = (t << 8) | (t >>> 24)
+ SUB_MIX[3][x] = t
+
+ // Compute inv sub bytes, inv mix columns tables
+ t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
+ INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
+ INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
+ INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
+ INV_SUB_MIX[3][sx] = t
+
+ if (x === 0) {
+ x = xi = 1
+ } else {
+ x = x2 ^ d[d[d[x8 ^ x2]]]
+ xi ^= d[d[xi]]
+ }
+ }
+
+ return {
+ SBOX: SBOX,
+ INV_SBOX: INV_SBOX,
+ SUB_MIX: SUB_MIX,
+ INV_SUB_MIX: INV_SUB_MIX
+ }
+})()
+
+function AES (key) {
+ this._key = asUInt32Array(key)
+ this._reset()
+}
+
+AES.blockSize = 4 * 4
+AES.keySize = 256 / 8
+AES.prototype.blockSize = AES.blockSize
+AES.prototype.keySize = AES.keySize
+AES.prototype._reset = function () {
+ var keyWords = this._key
+ var keySize = keyWords.length
+ var nRounds = keySize + 6
+ var ksRows = (nRounds + 1) * 4
+
+ var keySchedule = []
+ for (var k = 0; k < keySize; k++) {
+ keySchedule[k] = keyWords[k]
+ }
+
+ for (k = keySize; k < ksRows; k++) {
+ var t = keySchedule[k - 1]
+
+ if (k % keySize === 0) {
+ t = (t << 8) | (t >>> 24)
+ t =
+ (G.SBOX[t >>> 24] << 24) |
+ (G.SBOX[(t >>> 16) & 0xff] << 16) |
+ (G.SBOX[(t >>> 8) & 0xff] << 8) |
+ (G.SBOX[t & 0xff])
+
+ t ^= RCON[(k / keySize) | 0] << 24
+ } else if (keySize > 6 && k % keySize === 4) {
+ t =
+ (G.SBOX[t >>> 24] << 24) |
+ (G.SBOX[(t >>> 16) & 0xff] << 16) |
+ (G.SBOX[(t >>> 8) & 0xff] << 8) |
+ (G.SBOX[t & 0xff])
+ }
+
+ keySchedule[k] = keySchedule[k - keySize] ^ t
+ }
+
+ var invKeySchedule = []
+ for (var ik = 0; ik < ksRows; ik++) {
+ var ksR = ksRows - ik
+ var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]
+
+ if (ik < 4 || ksR <= 4) {
+ invKeySchedule[ik] = tt
+ } else {
+ invKeySchedule[ik] =
+ G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^
+ G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^
+ G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^
+ G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]
+ }
+ }
+
+ this._nRounds = nRounds
+ this._keySchedule = keySchedule
+ this._invKeySchedule = invKeySchedule
+}
+
+AES.prototype.encryptBlockRaw = function (M) {
+ M = asUInt32Array(M)
+ return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
+}
+
+AES.prototype.encryptBlock = function (M) {
+ var out = this.encryptBlockRaw(M)
+ var buf = Buffer.allocUnsafe(16)
+ buf.writeUInt32BE(out[0], 0)
+ buf.writeUInt32BE(out[1], 4)
+ buf.writeUInt32BE(out[2], 8)
+ buf.writeUInt32BE(out[3], 12)
+ return buf
+}
+
+AES.prototype.decryptBlock = function (M) {
+ M = asUInt32Array(M)
+
+ // swap
+ var m1 = M[1]
+ M[1] = M[3]
+ M[3] = m1
+
+ var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)
+ var buf = Buffer.allocUnsafe(16)
+ buf.writeUInt32BE(out[0], 0)
+ buf.writeUInt32BE(out[3], 4)
+ buf.writeUInt32BE(out[2], 8)
+ buf.writeUInt32BE(out[1], 12)
+ return buf
+}
+
+AES.prototype.scrub = function () {
+ scrubVec(this._keySchedule)
+ scrubVec(this._invKeySchedule)
+ scrubVec(this._key)
+}
+
+module.exports.AES = AES
+
+},{"safe-buffer":1334}],79:[function(require,module,exports){
+var aes = require('./aes')
+var Buffer = require('safe-buffer').Buffer
+var Transform = require('cipher-base')
+var inherits = require('inherits')
+var GHASH = require('./ghash')
+var xor = require('buffer-xor')
+var incr32 = require('./incr32')
+
+function xorTest (a, b) {
+ var out = 0
+ if (a.length !== b.length) out++
+
+ var len = Math.min(a.length, b.length)
+ for (var i = 0; i < len; ++i) {
+ out += (a[i] ^ b[i])
+ }
+
+ return out
+}
+
+function calcIv (self, iv, ck) {
+ if (iv.length === 12) {
+ self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
+ return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
+ }
+ var ghash = new GHASH(ck)
+ var len = iv.length
+ var toPad = len % 16
+ ghash.update(iv)
+ if (toPad) {
+ toPad = 16 - toPad
+ ghash.update(Buffer.alloc(toPad, 0))
+ }
+ ghash.update(Buffer.alloc(8, 0))
+ var ivBits = len * 8
+ var tail = Buffer.alloc(8)
+ tail.writeUIntBE(ivBits, 0, 8)
+ ghash.update(tail)
+ self._finID = ghash.state
+ var out = Buffer.from(self._finID)
+ incr32(out)
+ return out
+}
+function StreamCipher (mode, key, iv, decrypt) {
+ Transform.call(this)
+
+ var h = Buffer.alloc(4, 0)
+
+ this._cipher = new aes.AES(key)
+ var ck = this._cipher.encryptBlock(h)
+ this._ghash = new GHASH(ck)
+ iv = calcIv(this, iv, ck)
+
+ this._prev = Buffer.from(iv)
+ this._cache = Buffer.allocUnsafe(0)
+ this._secCache = Buffer.allocUnsafe(0)
+ this._decrypt = decrypt
+ this._alen = 0
+ this._len = 0
+ this._mode = mode
+
+ this._authTag = null
+ this._called = false
+}
+
+inherits(StreamCipher, Transform)
+
+StreamCipher.prototype._update = function (chunk) {
+ if (!this._called && this._alen) {
+ var rump = 16 - (this._alen % 16)
+ if (rump < 16) {
+ rump = Buffer.alloc(rump, 0)
+ this._ghash.update(rump)
+ }
+ }
+
+ this._called = true
+ var out = this._mode.encrypt(this, chunk)
+ if (this._decrypt) {
+ this._ghash.update(chunk)
+ } else {
+ this._ghash.update(out)
+ }
+ this._len += chunk.length
+ return out
+}
+
+StreamCipher.prototype._final = function () {
+ if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')
+
+ var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
+ if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')
+
+ this._authTag = tag
+ this._cipher.scrub()
+}
+
+StreamCipher.prototype.getAuthTag = function getAuthTag () {
+ if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')
+
+ return this._authTag
+}
+
+StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
+ if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')
+
+ this._authTag = tag
+}
+
+StreamCipher.prototype.setAAD = function setAAD (buf) {
+ if (this._called) throw new Error('Attempting to set AAD in unsupported state')
+
+ this._ghash.update(buf)
+ this._alen += buf.length
+}
+
+module.exports = StreamCipher
+
+},{"./aes":78,"./ghash":83,"./incr32":84,"buffer-xor":112,"cipher-base":120,"inherits":834,"safe-buffer":1334}],80:[function(require,module,exports){
+var ciphers = require('./encrypter')
+var deciphers = require('./decrypter')
+var modes = require('./modes/list.json')
+
+function getCiphers () {
+ return Object.keys(modes)
+}
+
+exports.createCipher = exports.Cipher = ciphers.createCipher
+exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
+exports.createDecipher = exports.Decipher = deciphers.createDecipher
+exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
+exports.listCiphers = exports.getCiphers = getCiphers
+
+},{"./decrypter":81,"./encrypter":82,"./modes/list.json":92}],81:[function(require,module,exports){
+var AuthCipher = require('./authCipher')
+var Buffer = require('safe-buffer').Buffer
+var MODES = require('./modes')
+var StreamCipher = require('./streamCipher')
+var Transform = require('cipher-base')
+var aes = require('./aes')
+var ebtk = require('evp_bytestokey')
+var inherits = require('inherits')
+
+function Decipher (mode, key, iv) {
+ Transform.call(this)
+
+ this._cache = new Splitter()
+ this._last = void 0
+ this._cipher = new aes.AES(key)
+ this._prev = Buffer.from(iv)
+ this._mode = mode
+ this._autopadding = true
+}
+
+inherits(Decipher, Transform)
+
+Decipher.prototype._update = function (data) {
+ this._cache.add(data)
+ var chunk
+ var thing
+ var out = []
+ while ((chunk = this._cache.get(this._autopadding))) {
+ thing = this._mode.decrypt(this, chunk)
+ out.push(thing)
+ }
+ return Buffer.concat(out)
+}
+
+Decipher.prototype._final = function () {
+ var chunk = this._cache.flush()
+ if (this._autopadding) {
+ return unpad(this._mode.decrypt(this, chunk))
+ } else if (chunk) {
+ throw new Error('data not multiple of block length')
+ }
+}
+
+Decipher.prototype.setAutoPadding = function (setTo) {
+ this._autopadding = !!setTo
+ return this
+}
+
+function Splitter () {
+ this.cache = Buffer.allocUnsafe(0)
+}
+
+Splitter.prototype.add = function (data) {
+ this.cache = Buffer.concat([this.cache, data])
+}
+
+Splitter.prototype.get = function (autoPadding) {
+ var out
+ if (autoPadding) {
+ if (this.cache.length > 16) {
+ out = this.cache.slice(0, 16)
+ this.cache = this.cache.slice(16)
+ return out
+ }
+ } else {
+ if (this.cache.length >= 16) {
+ out = this.cache.slice(0, 16)
+ this.cache = this.cache.slice(16)
+ return out
+ }
+ }
+
+ return null
+}
+
+Splitter.prototype.flush = function () {
+ if (this.cache.length) return this.cache
+}
+
+function unpad (last) {
+ var padded = last[15]
+ if (padded < 1 || padded > 16) {
+ throw new Error('unable to decrypt data')
+ }
+ var i = -1
+ while (++i < padded) {
+ if (last[(i + (16 - padded))] !== padded) {
+ throw new Error('unable to decrypt data')
+ }
+ }
+ if (padded === 16) return
+
+ return last.slice(0, 16 - padded)
+}
+
+function createDecipheriv (suite, password, iv) {
+ var config = MODES[suite.toLowerCase()]
+ if (!config) throw new TypeError('invalid suite type')
+
+ if (typeof iv === 'string') iv = Buffer.from(iv)
+ if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
+
+ if (typeof password === 'string') password = Buffer.from(password)
+ if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
+
+ if (config.type === 'stream') {
+ return new StreamCipher(config.module, password, iv, true)
+ } else if (config.type === 'auth') {
+ return new AuthCipher(config.module, password, iv, true)
+ }
+
+ return new Decipher(config.module, password, iv)
+}
+
+function createDecipher (suite, password) {
+ var config = MODES[suite.toLowerCase()]
+ if (!config) throw new TypeError('invalid suite type')
+
+ var keys = ebtk(password, false, config.key, config.iv)
+ return createDecipheriv(suite, keys.key, keys.iv)
+}
+
+exports.createDecipher = createDecipher
+exports.createDecipheriv = createDecipheriv
+
+},{"./aes":78,"./authCipher":79,"./modes":91,"./streamCipher":94,"cipher-base":120,"evp_bytestokey":709,"inherits":834,"safe-buffer":1334}],82:[function(require,module,exports){
+var MODES = require('./modes')
+var AuthCipher = require('./authCipher')
+var Buffer = require('safe-buffer').Buffer
+var StreamCipher = require('./streamCipher')
+var Transform = require('cipher-base')
+var aes = require('./aes')
+var ebtk = require('evp_bytestokey')
+var inherits = require('inherits')
+
+function Cipher (mode, key, iv) {
+ Transform.call(this)
+
+ this._cache = new Splitter()
+ this._cipher = new aes.AES(key)
+ this._prev = Buffer.from(iv)
+ this._mode = mode
+ this._autopadding = true
+}
+
+inherits(Cipher, Transform)
+
+Cipher.prototype._update = function (data) {
+ this._cache.add(data)
+ var chunk
+ var thing
+ var out = []
+
+ while ((chunk = this._cache.get())) {
+ thing = this._mode.encrypt(this, chunk)
+ out.push(thing)
+ }
+
+ return Buffer.concat(out)
+}
+
+var PADDING = Buffer.alloc(16, 0x10)
+
+Cipher.prototype._final = function () {
+ var chunk = this._cache.flush()
+ if (this._autopadding) {
+ chunk = this._mode.encrypt(this, chunk)
+ this._cipher.scrub()
+ return chunk
+ }
+
+ if (!chunk.equals(PADDING)) {
+ this._cipher.scrub()
+ throw new Error('data not multiple of block length')
+ }
+}
+
+Cipher.prototype.setAutoPadding = function (setTo) {
+ this._autopadding = !!setTo
+ return this
+}
+
+function Splitter () {
+ this.cache = Buffer.allocUnsafe(0)
+}
+
+Splitter.prototype.add = function (data) {
+ this.cache = Buffer.concat([this.cache, data])
+}
+
+Splitter.prototype.get = function () {
+ if (this.cache.length > 15) {
+ var out = this.cache.slice(0, 16)
+ this.cache = this.cache.slice(16)
+ return out
+ }
+ return null
+}
+
+Splitter.prototype.flush = function () {
+ var len = 16 - this.cache.length
+ var padBuff = Buffer.allocUnsafe(len)
+
+ var i = -1
+ while (++i < len) {
+ padBuff.writeUInt8(len, i)
+ }
+
+ return Buffer.concat([this.cache, padBuff])
+}
+
+function createCipheriv (suite, password, iv) {
+ var config = MODES[suite.toLowerCase()]
+ if (!config) throw new TypeError('invalid suite type')
+
+ if (typeof password === 'string') password = Buffer.from(password)
+ if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
+
+ if (typeof iv === 'string') iv = Buffer.from(iv)
+ if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
+
+ if (config.type === 'stream') {
+ return new StreamCipher(config.module, password, iv)
+ } else if (config.type === 'auth') {
+ return new AuthCipher(config.module, password, iv)
+ }
+
+ return new Cipher(config.module, password, iv)
+}
+
+function createCipher (suite, password) {
+ var config = MODES[suite.toLowerCase()]
+ if (!config) throw new TypeError('invalid suite type')
+
+ var keys = ebtk(password, false, config.key, config.iv)
+ return createCipheriv(suite, keys.key, keys.iv)
+}
+
+exports.createCipheriv = createCipheriv
+exports.createCipher = createCipher
+
+},{"./aes":78,"./authCipher":79,"./modes":91,"./streamCipher":94,"cipher-base":120,"evp_bytestokey":709,"inherits":834,"safe-buffer":1334}],83:[function(require,module,exports){
+var Buffer = require('safe-buffer').Buffer
+var ZEROES = Buffer.alloc(16, 0)
+
+function toArray (buf) {
+ return [
+ buf.readUInt32BE(0),
+ buf.readUInt32BE(4),
+ buf.readUInt32BE(8),
+ buf.readUInt32BE(12)
+ ]
+}
+
+function fromArray (out) {
+ var buf = Buffer.allocUnsafe(16)
+ buf.writeUInt32BE(out[0] >>> 0, 0)
+ buf.writeUInt32BE(out[1] >>> 0, 4)
+ buf.writeUInt32BE(out[2] >>> 0, 8)
+ buf.writeUInt32BE(out[3] >>> 0, 12)
+ return buf
+}
+
+function GHASH (key) {
+ this.h = key
+ this.state = Buffer.alloc(16, 0)
+ this.cache = Buffer.allocUnsafe(0)
+}
+
+// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
+// by Juho Vähä-Herttua
+GHASH.prototype.ghash = function (block) {
+ var i = -1
+ while (++i < block.length) {
+ this.state[i] ^= block[i]
+ }
+ this._multiply()
+}
+
+GHASH.prototype._multiply = function () {
+ var Vi = toArray(this.h)
+ var Zi = [0, 0, 0, 0]
+ var j, xi, lsbVi
+ var i = -1
+ while (++i < 128) {
+ xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0
+ if (xi) {
+ // Z_i+1 = Z_i ^ V_i
+ Zi[0] ^= Vi[0]
+ Zi[1] ^= Vi[1]
+ Zi[2] ^= Vi[2]
+ Zi[3] ^= Vi[3]
+ }
+
+ // Store the value of LSB(V_i)
+ lsbVi = (Vi[3] & 1) !== 0
+
+ // V_i+1 = V_i >> 1
+ for (j = 3; j > 0; j--) {
+ Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
+ }
+ Vi[0] = Vi[0] >>> 1
+
+ // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
+ if (lsbVi) {
+ Vi[0] = Vi[0] ^ (0xe1 << 24)
+ }
+ }
+ this.state = fromArray(Zi)
+}
+
+GHASH.prototype.update = function (buf) {
+ this.cache = Buffer.concat([this.cache, buf])
+ var chunk
+ while (this.cache.length >= 16) {
+ chunk = this.cache.slice(0, 16)
+ this.cache = this.cache.slice(16)
+ this.ghash(chunk)
+ }
+}
+
+GHASH.prototype.final = function (abl, bl) {
+ if (this.cache.length) {
+ this.ghash(Buffer.concat([this.cache, ZEROES], 16))
+ }
+
+ this.ghash(fromArray([0, abl, 0, bl]))
+ return this.state
+}
+
+module.exports = GHASH
+
+},{"safe-buffer":1334}],84:[function(require,module,exports){
+function incr32 (iv) {
+ var len = iv.length
+ var item
+ while (len--) {
+ item = iv.readUInt8(len)
+ if (item === 255) {
+ iv.writeUInt8(0, len)
+ } else {
+ item++
+ iv.writeUInt8(item, len)
+ break
+ }
+ }
+}
+module.exports = incr32
+
+},{}],85:[function(require,module,exports){
+var xor = require('buffer-xor')
+
+exports.encrypt = function (self, block) {
+ var data = xor(block, self._prev)
+
+ self._prev = self._cipher.encryptBlock(data)
+ return self._prev
+}
+
+exports.decrypt = function (self, block) {
+ var pad = self._prev
+
+ self._prev = block
+ var out = self._cipher.decryptBlock(block)
+
+ return xor(out, pad)
+}
+
+},{"buffer-xor":112}],86:[function(require,module,exports){
+var Buffer = require('safe-buffer').Buffer
+var xor = require('buffer-xor')
+
+function encryptStart (self, data, decrypt) {
+ var len = data.length
+ var out = xor(data, self._cache)
+ self._cache = self._cache.slice(len)
+ self._prev = Buffer.concat([self._prev, decrypt ? data : out])
+ return out
+}
+
+exports.encrypt = function (self, data, decrypt) {
+ var out = Buffer.allocUnsafe(0)
+ var len
+
+ while (data.length) {
+ if (self._cache.length === 0) {
+ self._cache = self._cipher.encryptBlock(self._prev)
+ self._prev = Buffer.allocUnsafe(0)
+ }
+
+ if (self._cache.length <= data.length) {
+ len = self._cache.length
+ out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
+ data = data.slice(len)
+ } else {
+ out = Buffer.concat([out, encryptStart(self, data, decrypt)])
+ break
+ }
+ }
+
+ return out
+}
+
+},{"buffer-xor":112,"safe-buffer":1334}],87:[function(require,module,exports){
+var Buffer = require('safe-buffer').Buffer
+
+function encryptByte (self, byteParam, decrypt) {
+ var pad
+ var i = -1
+ var len = 8
+ var out = 0
+ var bit, value
+ while (++i < len) {
+ pad = self._cipher.encryptBlock(self._prev)
+ bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
+ value = pad[0] ^ bit
+ out += ((value & 0x80) >> (i % 8))
+ self._prev = shiftIn(self._prev, decrypt ? bit : value)
+ }
+ return out
+}
+
+function shiftIn (buffer, value) {
+ var len = buffer.length
+ var i = -1
+ var out = Buffer.allocUnsafe(buffer.length)
+ buffer = Buffer.concat([buffer, Buffer.from([value])])
+
+ while (++i < len) {
+ out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
+ }
+
+ return out
+}
+
+exports.encrypt = function (self, chunk, decrypt) {
+ var len = chunk.length
+ var out = Buffer.allocUnsafe(len)
+ var i = -1
+
+ while (++i < len) {
+ out[i] = encryptByte(self, chunk[i], decrypt)
+ }
+
+ return out
+}
+
+},{"safe-buffer":1334}],88:[function(require,module,exports){
+var Buffer = require('safe-buffer').Buffer
+
+function encryptByte (self, byteParam, decrypt) {
+ var pad = self._cipher.encryptBlock(self._prev)
+ var out = pad[0] ^ byteParam
+
+ self._prev = Buffer.concat([
+ self._prev.slice(1),
+ Buffer.from([decrypt ? byteParam : out])
+ ])
+
+ return out
+}
+
+exports.encrypt = function (self, chunk, decrypt) {
+ var len = chunk.length
+ var out = Buffer.allocUnsafe(len)
+ var i = -1
+
+ while (++i < len) {
+ out[i] = encryptByte(self, chunk[i], decrypt)
+ }
+
+ return out
+}
+
+},{"safe-buffer":1334}],89:[function(require,module,exports){
+var xor = require('buffer-xor')
+var Buffer = require('safe-buffer').Buffer
+var incr32 = require('../incr32')
+
+function getBlock (self) {
+ var out = self._cipher.encryptBlockRaw(self._prev)
+ incr32(self._prev)
+ return out
+}
+
+var blockSize = 16
+exports.encrypt = function (self, chunk) {
+ var chunkNum = Math.ceil(chunk.length / blockSize)
+ var start = self._cache.length
+ self._cache = Buffer.concat([
+ self._cache,
+ Buffer.allocUnsafe(chunkNum * blockSize)
+ ])
+ for (var i = 0; i < chunkNum; i++) {
+ var out = getBlock(self)
+ var offset = start + i * blockSize
+ self._cache.writeUInt32BE(out[0], offset + 0)
+ self._cache.writeUInt32BE(out[1], offset + 4)
+ self._cache.writeUInt32BE(out[2], offset + 8)
+ self._cache.writeUInt32BE(out[3], offset + 12)
+ }
+ var pad = self._cache.slice(0, chunk.length)
+ self._cache = self._cache.slice(chunk.length)
+ return xor(chunk, pad)
+}
+
+},{"../incr32":84,"buffer-xor":112,"safe-buffer":1334}],90:[function(require,module,exports){
+exports.encrypt = function (self, block) {
+ return self._cipher.encryptBlock(block)
+}
+
+exports.decrypt = function (self, block) {
+ return self._cipher.decryptBlock(block)
+}
+
+},{}],91:[function(require,module,exports){
+var modeModules = {
+ ECB: require('./ecb'),
+ CBC: require('./cbc'),
+ CFB: require('./cfb'),
+ CFB8: require('./cfb8'),
+ CFB1: require('./cfb1'),
+ OFB: require('./ofb'),
+ CTR: require('./ctr'),
+ GCM: require('./ctr')
+}
+
+var modes = require('./list.json')
+
+for (var key in modes) {
+ modes[key].module = modeModules[modes[key].mode]
+}
+
+module.exports = modes
+
+},{"./cbc":85,"./cfb":86,"./cfb1":87,"./cfb8":88,"./ctr":89,"./ecb":90,"./list.json":92,"./ofb":93}],92:[function(require,module,exports){
+module.exports={
+ "aes-128-ecb": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 0,
+ "mode": "ECB",
+ "type": "block"
+ },
+ "aes-192-ecb": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 0,
+ "mode": "ECB",
+ "type": "block"
+ },
+ "aes-256-ecb": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 0,
+ "mode": "ECB",
+ "type": "block"
+ },
+ "aes-128-cbc": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 16,
+ "mode": "CBC",
+ "type": "block"
+ },
+ "aes-192-cbc": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 16,
+ "mode": "CBC",
+ "type": "block"
+ },
+ "aes-256-cbc": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 16,
+ "mode": "CBC",
+ "type": "block"
+ },
+ "aes128": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 16,
+ "mode": "CBC",
+ "type": "block"
+ },
+ "aes192": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 16,
+ "mode": "CBC",
+ "type": "block"
+ },
+ "aes256": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 16,
+ "mode": "CBC",
+ "type": "block"
+ },
+ "aes-128-cfb": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 16,
+ "mode": "CFB",
+ "type": "stream"
+ },
+ "aes-192-cfb": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 16,
+ "mode": "CFB",
+ "type": "stream"
+ },
+ "aes-256-cfb": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 16,
+ "mode": "CFB",
+ "type": "stream"
+ },
+ "aes-128-cfb8": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 16,
+ "mode": "CFB8",
+ "type": "stream"
+ },
+ "aes-192-cfb8": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 16,
+ "mode": "CFB8",
+ "type": "stream"
+ },
+ "aes-256-cfb8": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 16,
+ "mode": "CFB8",
+ "type": "stream"
+ },
+ "aes-128-cfb1": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 16,
+ "mode": "CFB1",
+ "type": "stream"
+ },
+ "aes-192-cfb1": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 16,
+ "mode": "CFB1",
+ "type": "stream"
+ },
+ "aes-256-cfb1": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 16,
+ "mode": "CFB1",
+ "type": "stream"
+ },
+ "aes-128-ofb": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 16,
+ "mode": "OFB",
+ "type": "stream"
+ },
+ "aes-192-ofb": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 16,
+ "mode": "OFB",
+ "type": "stream"
+ },
+ "aes-256-ofb": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 16,
+ "mode": "OFB",
+ "type": "stream"
+ },
+ "aes-128-ctr": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 16,
+ "mode": "CTR",
+ "type": "stream"
+ },
+ "aes-192-ctr": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 16,
+ "mode": "CTR",
+ "type": "stream"
+ },
+ "aes-256-ctr": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 16,
+ "mode": "CTR",
+ "type": "stream"
+ },
+ "aes-128-gcm": {
+ "cipher": "AES",
+ "key": 128,
+ "iv": 12,
+ "mode": "GCM",
+ "type": "auth"
+ },
+ "aes-192-gcm": {
+ "cipher": "AES",
+ "key": 192,
+ "iv": 12,
+ "mode": "GCM",
+ "type": "auth"
+ },
+ "aes-256-gcm": {
+ "cipher": "AES",
+ "key": 256,
+ "iv": 12,
+ "mode": "GCM",
+ "type": "auth"
+ }
+}
+
+},{}],93:[function(require,module,exports){
+(function (Buffer){
+var xor = require('buffer-xor')
+
+function getBlock (self) {
+ self._prev = self._cipher.encryptBlock(self._prev)
+ return self._prev
+}
+
+exports.encrypt = function (self, chunk) {
+ while (self._cache.length < chunk.length) {
+ self._cache = Buffer.concat([self._cache, getBlock(self)])
+ }
+
+ var pad = self._cache.slice(0, chunk.length)
+ self._cache = self._cache.slice(chunk.length)
+ return xor(chunk, pad)
+}
+
+}).call(this,require("buffer").Buffer)
+},{"buffer":113,"buffer-xor":112}],94:[function(require,module,exports){
+var aes = require('./aes')
+var Buffer = require('safe-buffer').Buffer
+var Transform = require('cipher-base')
+var inherits = require('inherits')
+
+function StreamCipher (mode, key, iv, decrypt) {
+ Transform.call(this)
+
+ this._cipher = new aes.AES(key)
+ this._prev = Buffer.from(iv)
+ this._cache = Buffer.allocUnsafe(0)
+ this._secCache = Buffer.allocUnsafe(0)
+ this._decrypt = decrypt
+ this._mode = mode
+}
+
+inherits(StreamCipher, Transform)
+
+StreamCipher.prototype._update = function (chunk) {
+ return this._mode.encrypt(this, chunk, this._decrypt)
+}
+
+StreamCipher.prototype._final = function () {
+ this._cipher.scrub()
+}
+
+module.exports = StreamCipher
+
+},{"./aes":78,"cipher-base":120,"inherits":834,"safe-buffer":1334}],95:[function(require,module,exports){
+var DES = require('browserify-des')
+var aes = require('browserify-aes/browser')
+var aesModes = require('browserify-aes/modes')
+var desModes = require('browserify-des/modes')
+var ebtk = require('evp_bytestokey')
+
+function createCipher (suite, password) {
+ suite = suite.toLowerCase()
+
+ var keyLen, ivLen
+ if (aesModes[suite]) {
+ keyLen = aesModes[suite].key
+ ivLen = aesModes[suite].iv
+ } else if (desModes[suite]) {
+ keyLen = desModes[suite].key * 8
+ ivLen = desModes[suite].iv
+ } else {
+ throw new TypeError('invalid suite type')
+ }
+
+ var keys = ebtk(password, false, keyLen, ivLen)
+ return createCipheriv(suite, keys.key, keys.iv)
+}
+
+function createDecipher (suite, password) {
+ suite = suite.toLowerCase()
+
+ var keyLen, ivLen
+ if (aesModes[suite]) {
+ keyLen = aesModes[suite].key
+ ivLen = aesModes[suite].iv
+ } else if (desModes[suite]) {
+ keyLen = desModes[suite].key * 8
+ ivLen = desModes[suite].iv
+ } else {
+ throw new TypeError('invalid suite type')
+ }
+
+ var keys = ebtk(password, false, keyLen, ivLen)
+ return createDecipheriv(suite, keys.key, keys.iv)
+}
+
+function createCipheriv (suite, key, iv) {
+ suite = suite.toLowerCase()
+ if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)
+ if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })
+
+ throw new TypeError('invalid suite type')
+}
+
+function createDecipheriv (suite, key, iv) {
+ suite = suite.toLowerCase()
+ if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)
+ if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })
+
+ throw new TypeError('invalid suite type')
+}
+
+function getCiphers () {
+ return Object.keys(desModes).concat(aes.getCiphers())
+}
+
+exports.createCipher = exports.Cipher = createCipher
+exports.createCipheriv = exports.Cipheriv = createCipheriv
+exports.createDecipher = exports.Decipher = createDecipher
+exports.createDecipheriv = exports.Decipheriv = createDecipheriv
+exports.listCiphers = exports.getCiphers = getCiphers
+
+},{"browserify-aes/browser":80,"browserify-aes/modes":91,"browserify-des":96,"browserify-des/modes":97,"evp_bytestokey":709}],96:[function(require,module,exports){
+var CipherBase = require('cipher-base')
+var des = require('des.js')
+var inherits = require('inherits')
+var Buffer = require('safe-buffer').Buffer
+
+var modes = {
+ 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
+ 'des-ede3': des.EDE,
+ 'des-ede-cbc': des.CBC.instantiate(des.EDE),
+ 'des-ede': des.EDE,
+ 'des-cbc': des.CBC.instantiate(des.DES),
+ 'des-ecb': des.DES
+}
+modes.des = modes['des-cbc']
+modes.des3 = modes['des-ede3-cbc']
+module.exports = DES
+inherits(DES, CipherBase)
+function DES (opts) {
+ CipherBase.call(this)
+ var modeName = opts.mode.toLowerCase()
+ var mode = modes[modeName]
+ var type
+ if (opts.decrypt) {
+ type = 'decrypt'
+ } else {
+ type = 'encrypt'
+ }
+ var key = opts.key
+ if (!Buffer.isBuffer(key)) {
+ key = Buffer.from(key)
+ }
+ if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
+ key = Buffer.concat([key, key.slice(0, 8)])
+ }
+ var iv = opts.iv
+ if (!Buffer.isBuffer(iv)) {
+ iv = Buffer.from(iv)
+ }
+ this._des = mode.create({
+ key: key,
+ iv: iv,
+ type: type
+ })
+}
+DES.prototype._update = function (data) {
+ return Buffer.from(this._des.update(data))
+}
+DES.prototype._final = function () {
+ return Buffer.from(this._des.final())
+}
+
+},{"cipher-base":120,"des.js":533,"inherits":834,"safe-buffer":1334}],97:[function(require,module,exports){
+exports['des-ecb'] = {
+ key: 8,
+ iv: 0
+}
+exports['des-cbc'] = exports.des = {
+ key: 8,
+ iv: 8
+}
+exports['des-ede3-cbc'] = exports.des3 = {
+ key: 24,
+ iv: 8
+}
+exports['des-ede3'] = {
+ key: 24,
+ iv: 0
+}
+exports['des-ede-cbc'] = {
+ key: 16,
+ iv: 8
+}
+exports['des-ede'] = {
+ key: 16,
+ iv: 0
+}
+
+},{}],98:[function(require,module,exports){
+(function (Buffer){
+var bn = require('bn.js');
+var randomBytes = require('randombytes');
+module.exports = crt;
+function blind(priv) {
+ var r = getr(priv);
+ var blinder = r.toRed(bn.mont(priv.modulus))
+ .redPow(new bn(priv.publicExponent)).fromRed();
+ return {
+ blinder: blinder,
+ unblinder:r.invm(priv.modulus)
+ };
+}
+function crt(msg, priv) {
+ var blinds = blind(priv);
+ var len = priv.modulus.byteLength();
+ var mod = bn.mont(priv.modulus);
+ var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
+ var c1 = blinded.toRed(bn.mont(priv.prime1));
+ var c2 = blinded.toRed(bn.mont(priv.prime2));
+ var qinv = priv.coefficient;
+ var p = priv.prime1;
+ var q = priv.prime2;
+ var m1 = c1.redPow(priv.exponent1);
+ var m2 = c2.redPow(priv.exponent2);
+ m1 = m1.fromRed();
+ m2 = m2.fromRed();
+ var h = m1.isub(m2).imul(qinv).umod(p);
+ h.imul(q);
+ m2.iadd(h);
+ return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
+}
+crt.getr = getr;
+function getr(priv) {
+ var len = priv.modulus.byteLength();
+ var r = new bn(randomBytes(len));
+ while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
+ r = new bn(randomBytes(len));
+ }
+ return r;
+}
+
+}).call(this,require("buffer").Buffer)
+},{"bn.js":66,"buffer":113,"randombytes":1036}],99:[function(require,module,exports){
+const Sha3 = require('js-sha3')
+const Buffer = require('safe-buffer').Buffer
+
+const hashLengths = [ 224, 256, 384, 512 ]
+
+const hash = function (bitcount) {
+ if (bitcount !== undefined && hashLengths.indexOf(bitcount) === -1) {
+ throw new Error('Unsupported hash length')
+ }
+ this.content = []
+ this.bitcount = bitcount ? 'keccak_' + bitcount : 'keccak_512'
+}
+
+hash.prototype.update = function (i) {
+ if (Buffer.isBuffer(i)) {
+ this.content.push(i)
+ } else if (typeof i === 'string') {
+ this.content.push(new Buffer(i))
+ } else {
+ throw new Error('Unsupported argument to update')
+ }
+ return this
+}
+
+hash.prototype.digest = function (encoding) {
+ const result = Sha3[this.bitcount](Buffer.concat(this.content))
+ if (encoding === 'hex') {
+ return result
+ } else if (encoding === 'binary' || encoding === undefined) {
+ return new Buffer(result, 'hex').toString('binary')
+ } else {
+ throw new Error('Unsupported encoding for digest: ' + encoding)
+ }
+}
+
+module.exports = {
+ SHA3Hash: hash
+}
+
+},{"js-sha3":862,"safe-buffer":1334}],100:[function(require,module,exports){
+module.exports = require('./browser/algorithms.json')
+
+},{"./browser/algorithms.json":101}],101:[function(require,module,exports){
+module.exports={
+ "sha224WithRSAEncryption": {
+ "sign": "rsa",
+ "hash": "sha224",
+ "id": "302d300d06096086480165030402040500041c"
+ },
+ "RSA-SHA224": {
+ "sign": "ecdsa/rsa",
+ "hash": "sha224",
+ "id": "302d300d06096086480165030402040500041c"
+ },
+ "sha256WithRSAEncryption": {
+ "sign": "rsa",
+ "hash": "sha256",
+ "id": "3031300d060960864801650304020105000420"
+ },
+ "RSA-SHA256": {
+ "sign": "ecdsa/rsa",
+ "hash": "sha256",
+ "id": "3031300d060960864801650304020105000420"
+ },
+ "sha384WithRSAEncryption": {
+ "sign": "rsa",
+ "hash": "sha384",
+ "id": "3041300d060960864801650304020205000430"
+ },
+ "RSA-SHA384": {
+ "sign": "ecdsa/rsa",
+ "hash": "sha384",
+ "id": "3041300d060960864801650304020205000430"
+ },
+ "sha512WithRSAEncryption": {
+ "sign": "rsa",
+ "hash": "sha512",
+ "id": "3051300d060960864801650304020305000440"
+ },
+ "RSA-SHA512": {
+ "sign": "ecdsa/rsa",
+ "hash": "sha512",
+ "id": "3051300d060960864801650304020305000440"
+ },
+ "RSA-SHA1": {
+ "sign": "rsa",
+ "hash": "sha1",
+ "id": "3021300906052b0e03021a05000414"
+ },
+ "ecdsa-with-SHA1": {
+ "sign": "ecdsa",
+ "hash": "sha1",
+ "id": ""
+ },
+ "sha256": {
+ "sign": "ecdsa",
+ "hash": "sha256",
+ "id": ""
+ },
+ "sha224": {
+ "sign": "ecdsa",
+ "hash": "sha224",
+ "id": ""
+ },
+ "sha384": {
+ "sign": "ecdsa",
+ "hash": "sha384",
+ "id": ""
+ },
+ "sha512": {
+ "sign": "ecdsa",
+ "hash": "sha512",
+ "id": ""
+ },
+ "DSA-SHA": {
+ "sign": "dsa",
+ "hash": "sha1",
+ "id": ""
+ },
+ "DSA-SHA1": {
+ "sign": "dsa",
+ "hash": "sha1",
+ "id": ""
+ },
+ "DSA": {
+ "sign": "dsa",
+ "hash": "sha1",
+ "id": ""
+ },
+ "DSA-WITH-SHA224": {
+ "sign": "dsa",
+ "hash": "sha224",
+ "id": ""
+ },
+ "DSA-SHA224": {
+ "sign": "dsa",
+ "hash": "sha224",
+ "id": ""
+ },
+ "DSA-WITH-SHA256": {
+ "sign": "dsa",
+ "hash": "sha256",
+ "id": ""
+ },
+ "DSA-SHA256": {
+ "sign": "dsa",
+ "hash": "sha256",
+ "id": ""
+ },
+ "DSA-WITH-SHA384": {
+ "sign": "dsa",
+ "hash": "sha384",
+ "id": ""
+ },
+ "DSA-SHA384": {
+ "sign": "dsa",
+ "hash": "sha384",
+ "id": ""
+ },
+ "DSA-WITH-SHA512": {
+ "sign": "dsa",
+ "hash": "sha512",
+ "id": ""
+ },
+ "DSA-SHA512": {
+ "sign": "dsa",
+ "hash": "sha512",
+ "id": ""
+ },
+ "DSA-RIPEMD160": {
+ "sign": "dsa",
+ "hash": "rmd160",
+ "id": ""
+ },
+ "ripemd160WithRSA": {
+ "sign": "rsa",
+ "hash": "rmd160",
+ "id": "3021300906052b2403020105000414"
+ },
+ "RSA-RIPEMD160": {
+ "sign": "rsa",
+ "hash": "rmd160",
+ "id": "3021300906052b2403020105000414"
+ },
+ "md5WithRSAEncryption": {
+ "sign": "rsa",
+ "hash": "md5",
+ "id": "3020300c06082a864886f70d020505000410"
+ },
+ "RSA-MD5": {
+ "sign": "rsa",
+ "hash": "md5",
+ "id": "3020300c06082a864886f70d020505000410"
+ }
+}
+
+},{}],102:[function(require,module,exports){
+module.exports={
+ "1.3.132.0.10": "secp256k1",
+ "1.3.132.0.33": "p224",
+ "1.2.840.10045.3.1.1": "p192",
+ "1.2.840.10045.3.1.7": "p256",
+ "1.3.132.0.34": "p384",
+ "1.3.132.0.35": "p521"
+}
+
+},{}],103:[function(require,module,exports){
+(function (Buffer){
+var createHash = require('create-hash')
+var stream = require('stream')
+var inherits = require('inherits')
+var sign = require('./sign')
+var verify = require('./verify')
+
+var algorithms = require('./algorithms.json')
+Object.keys(algorithms).forEach(function (key) {
+ algorithms[key].id = new Buffer(algorithms[key].id, 'hex')
+ algorithms[key.toLowerCase()] = algorithms[key]
+})
+
+function Sign (algorithm) {
+ stream.Writable.call(this)
+
+ var data = algorithms[algorithm]
+ if (!data) throw new Error('Unknown message digest')
+
+ this._hashType = data.hash
+ this._hash = createHash(data.hash)
+ this._tag = data.id
+ this._signType = data.sign
+}
+inherits(Sign, stream.Writable)
+
+Sign.prototype._write = function _write (data, _, done) {
+ this._hash.update(data)
+ done()
+}
+
+Sign.prototype.update = function update (data, enc) {
+ if (typeof data === 'string') data = new Buffer(data, enc)
+
+ this._hash.update(data)
+ return this
+}
+
+Sign.prototype.sign = function signMethod (key, enc) {
+ this.end()
+ var hash = this._hash.digest()
+ var sig = sign(hash, key, this._hashType, this._signType, this._tag)
+
+ return enc ? sig.toString(enc) : sig
+}
+
+function Verify (algorithm) {
+ stream.Writable.call(this)
+
+ var data = algorithms[algorithm]
+ if (!data) throw new Error('Unknown message digest')
+
+ this._hash = createHash(data.hash)
+ this._tag = data.id
+ this._signType = data.sign
+}
+inherits(Verify, stream.Writable)
+
+Verify.prototype._write = function _write (data, _, done) {
+ this._hash.update(data)
+ done()
+}
+
+Verify.prototype.update = function update (data, enc) {
+ if (typeof data === 'string') data = new Buffer(data, enc)
+
+ this._hash.update(data)
+ return this
+}
+
+Verify.prototype.verify = function verifyMethod (key, sig, enc) {
+ if (typeof sig === 'string') sig = new Buffer(sig, enc)
+
+ this.end()
+ var hash = this._hash.digest()
+ return verify(sig, hash, key, this._signType, this._tag)
+}
+
+function createSign (algorithm) {
+ return new Sign(algorithm)
+}
+
+function createVerify (algorithm) {
+ return new Verify(algorithm)
+}
+
+module.exports = {
+ Sign: createSign,
+ Verify: createVerify,
+ createSign: createSign,
+ createVerify: createVerify
+}
+
+}).call(this,require("buffer").Buffer)
+},{"./algorithms.json":101,"./sign":104,"./verify":105,"buffer":113,"create-hash":466,"inherits":834,"stream":1394}],104:[function(require,module,exports){
+(function (Buffer){
+// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
+var createHmac = require('create-hmac')
+var crt = require('browserify-rsa')
+var EC = require('elliptic').ec
+var BN = require('bn.js')
+var parseKeys = require('parse-asn1')
+var curves = require('./curves.json')
+
+function sign (hash, key, hashType, signType, tag) {
+ var priv = parseKeys(key)
+ if (priv.curve) {
+ // rsa keys can be interpreted as ecdsa ones in openssl
+ if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
+ return ecSign(hash, priv)
+ } else if (priv.type === 'dsa') {
+ if (signType !== 'dsa') throw new Error('wrong private key type')
+ return dsaSign(hash, priv, hashType)
+ } else {
+ if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
+ }
+ hash = Buffer.concat([tag, hash])
+ var len = priv.modulus.byteLength()
+ var pad = [ 0, 1 ]
+ while (hash.length + pad.length + 1 < len) pad.push(0xff)
+ pad.push(0x00)
+ var i = -1
+ while (++i < hash.length) pad.push(hash[i])
+
+ var out = crt(pad, priv)
+ return out
+}
+
+function ecSign (hash, priv) {
+ var curveId = curves[priv.curve.join('.')]
+ if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
+
+ var curve = new EC(curveId)
+ var key = curve.keyFromPrivate(priv.privateKey)
+ var out = key.sign(hash)
+
+ return new Buffer(out.toDER())
+}
+
+function dsaSign (hash, priv, algo) {
+ var x = priv.params.priv_key
+ var p = priv.params.p
+ var q = priv.params.q
+ var g = priv.params.g
+ var r = new BN(0)
+ var k
+ var H = bits2int(hash, q).mod(q)
+ var s = false
+ var kv = getKey(x, q, hash, algo)
+ while (s === false) {
+ k = makeKey(q, kv, algo)
+ r = makeR(g, k, p, q)
+ s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
+ if (s.cmpn(0) === 0) {
+ s = false
+ r = new BN(0)
+ }
+ }
+ return toDER(r, s)
+}
+
+function toDER (r, s) {
+ r = r.toArray()
+ s = s.toArray()
+
+ // Pad values
+ if (r[0] & 0x80) r = [ 0 ].concat(r)
+ if (s[0] & 0x80) s = [ 0 ].concat(s)
+
+ var total = r.length + s.length + 4
+ var res = [ 0x30, total, 0x02, r.length ]
+ res = res.concat(r, [ 0x02, s.length ], s)
+ return new Buffer(res)
+}
+
+function getKey (x, q, hash, algo) {
+ x = new Buffer(x.toArray())
+ if (x.length < q.byteLength()) {
+ var zeros = new Buffer(q.byteLength() - x.length)
+ zeros.fill(0)
+ x = Buffer.concat([ zeros, x ])
+ }
+ var hlen = hash.length
+ var hbits = bits2octets(hash, q)
+ var v = new Buffer(hlen)
+ v.fill(1)
+ var k = new Buffer(hlen)
+ k.fill(0)
+ k = createHmac(algo, k).update(v).update(new Buffer([ 0 ])).update(x).update(hbits).digest()
+ v = createHmac(algo, k).update(v).digest()
+ k = createHmac(algo, k).update(v).update(new Buffer([ 1 ])).update(x).update(hbits).digest()
+ v = createHmac(algo, k).update(v).digest()
+ return { k: k, v: v }
+}
+
+function bits2int (obits, q) {
+ var bits = new BN(obits)
+ var shift = (obits.length << 3) - q.bitLength()
+ if (shift > 0) bits.ishrn(shift)
+ return bits
+}
+
+function bits2octets (bits, q) {
+ bits = bits2int(bits, q)
+ bits = bits.mod(q)
+ var out = new Buffer(bits.toArray())
+ if (out.length < q.byteLength()) {
+ var zeros = new Buffer(q.byteLength() - out.length)
+ zeros.fill(0)
+ out = Buffer.concat([ zeros, out ])
+ }
+ return out
+}
+
+function makeKey (q, kv, algo) {
+ var t
+ var k
+
+ do {
+ t = new Buffer(0)
+
+ while (t.length * 8 < q.bitLength()) {
+ kv.v = createHmac(algo, kv.k).update(kv.v).digest()
+ t = Buffer.concat([ t, kv.v ])
+ }
+
+ k = bits2int(t, q)
+ kv.k = createHmac(algo, kv.k).update(kv.v).update(new Buffer([ 0 ])).digest()
+ kv.v = createHmac(algo, kv.k).update(kv.v).digest()
+ } while (k.cmp(q) !== -1)
+
+ return k
+}
+
+function makeR (g, k, p, q) {
+ return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
+}
+
+module.exports = sign
+module.exports.getKey = getKey
+module.exports.makeKey = makeKey
+
+}).call(this,require("buffer").Buffer)
+},{"./curves.json":102,"bn.js":66,"browserify-rsa":98,"buffer":113,"create-hmac":468,"elliptic":548,"parse-asn1":1006}],105:[function(require,module,exports){
+(function (Buffer){
+// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
+var BN = require('bn.js')
+var EC = require('elliptic').ec
+var parseKeys = require('parse-asn1')
+var curves = require('./curves.json')
+
+function verify (sig, hash, key, signType, tag) {
+ var pub = parseKeys(key)
+ if (pub.type === 'ec') {
+ // rsa keys can be interpreted as ecdsa ones in openssl
+ if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
+ return ecVerify(sig, hash, pub)
+ } else if (pub.type === 'dsa') {
+ if (signType !== 'dsa') throw new Error('wrong public key type')
+ return dsaVerify(sig, hash, pub)
+ } else {
+ if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
+ }
+ hash = Buffer.concat([tag, hash])
+ var len = pub.modulus.byteLength()
+ var pad = [ 1 ]
+ var padNum = 0
+ while (hash.length + pad.length + 2 < len) {
+ pad.push(0xff)
+ padNum++
+ }
+ pad.push(0x00)
+ var i = -1
+ while (++i < hash.length) {
+ pad.push(hash[i])
+ }
+ pad = new Buffer(pad)
+ var red = BN.mont(pub.modulus)
+ sig = new BN(sig).toRed(red)
+
+ sig = sig.redPow(new BN(pub.publicExponent))
+ sig = new Buffer(sig.fromRed().toArray())
+ var out = padNum < 8 ? 1 : 0
+ len = Math.min(sig.length, pad.length)
+ if (sig.length !== pad.length) out = 1
+
+ i = -1
+ while (++i < len) out |= sig[i] ^ pad[i]
+ return out === 0
+}
+
+function ecVerify (sig, hash, pub) {
+ var curveId = curves[pub.data.algorithm.curve.join('.')]
+ if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
+
+ var curve = new EC(curveId)
+ var pubkey = pub.data.subjectPrivateKey.data
+
+ return curve.verify(hash, sig, pubkey)
+}
+
+function dsaVerify (sig, hash, pub) {
+ var p = pub.data.p
+ var q = pub.data.q
+ var g = pub.data.g
+ var y = pub.data.pub_key
+ var unpacked = parseKeys.signature.decode(sig, 'der')
+ var s = unpacked.s
+ var r = unpacked.r
+ checkValue(s, q)
+ checkValue(r, q)
+ var montp = BN.mont(p)
+ var w = s.invm(q)
+ var v = g.toRed(montp)
+ .redPow(new BN(hash).mul(w).mod(q))
+ .fromRed()
+ .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())
+ .mod(p)
+ .mod(q)
+ return v.cmp(r) === 0
+}
+
+function checkValue (b, q) {
+ if (b.cmpn(0) <= 0) throw new Error('invalid sig')
+ if (b.cmp(q) >= q) throw new Error('invalid sig')
+}
+
+module.exports = verify
+
+}).call(this,require("buffer").Buffer)
+},{"./curves.json":102,"bn.js":66,"buffer":113,"elliptic":548,"parse-asn1":1006}],106:[function(require,module,exports){
+(function (process,Buffer){
+'use strict';
+/* eslint camelcase: "off" */
+
+var assert = require('assert');
+
+var Zstream = require('pako/lib/zlib/zstream');
+var zlib_deflate = require('pako/lib/zlib/deflate.js');
+var zlib_inflate = require('pako/lib/zlib/inflate.js');
+var constants = require('pako/lib/zlib/constants');
+
+for (var key in constants) {
+ exports[key] = constants[key];
+}
+
+// zlib modes
+exports.NONE = 0;
+exports.DEFLATE = 1;
+exports.INFLATE = 2;
+exports.GZIP = 3;
+exports.GUNZIP = 4;
+exports.DEFLATERAW = 5;
+exports.INFLATERAW = 6;
+exports.UNZIP = 7;
+
+var GZIP_HEADER_ID1 = 0x1f;
+var GZIP_HEADER_ID2 = 0x8b;
+
+/**
+ * Emulate Node's zlib C++ layer for use by the JS layer in index.js
+ */
+function Zlib(mode) {
+ if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) {
+ throw new TypeError('Bad argument');
+ }
+
+ this.dictionary = null;
+ this.err = 0;
+ this.flush = 0;
+ this.init_done = false;
+ this.level = 0;
+ this.memLevel = 0;
+ this.mode = mode;
+ this.strategy = 0;
+ this.windowBits = 0;
+ this.write_in_progress = false;
+ this.pending_close = false;
+ this.gzip_id_bytes_read = 0;
+}
+
+Zlib.prototype.close = function () {
+ if (this.write_in_progress) {
+ this.pending_close = true;
+ return;
+ }
+
+ this.pending_close = false;
+
+ assert(this.init_done, 'close before init');
+ assert(this.mode <= exports.UNZIP);
+
+ if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) {
+ zlib_deflate.deflateEnd(this.strm);
+ } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) {
+ zlib_inflate.inflateEnd(this.strm);
+ }
+
+ this.mode = exports.NONE;
+
+ this.dictionary = null;
+};
+
+Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) {
+ return this._write(true, flush, input, in_off, in_len, out, out_off, out_len);
+};
+
+Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) {
+ return this._write(false, flush, input, in_off, in_len, out, out_off, out_len);
+};
+
+Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) {
+ assert.equal(arguments.length, 8);
+
+ assert(this.init_done, 'write before init');
+ assert(this.mode !== exports.NONE, 'already finalized');
+ assert.equal(false, this.write_in_progress, 'write already in progress');
+ assert.equal(false, this.pending_close, 'close is pending');
+
+ this.write_in_progress = true;
+
+ assert.equal(false, flush === undefined, 'must provide flush value');
+
+ this.write_in_progress = true;
+
+ if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) {
+ throw new Error('Invalid flush value');
+ }
+
+ if (input == null) {
+ input = Buffer.alloc(0);
+ in_len = 0;
+ in_off = 0;
+ }
+
+ this.strm.avail_in = in_len;
+ this.strm.input = input;
+ this.strm.next_in = in_off;
+ this.strm.avail_out = out_len;
+ this.strm.output = out;
+ this.strm.next_out = out_off;
+ this.flush = flush;
+
+ if (!async) {
+ // sync version
+ this._process();
+
+ if (this._checkError()) {
+ return this._afterSync();
+ }
+ return;
+ }
+
+ // async version
+ var self = this;
+ process.nextTick(function () {
+ self._process();
+ self._after();
+ });
+
+ return this;
+};
+
+Zlib.prototype._afterSync = function () {
+ var avail_out = this.strm.avail_out;
+ var avail_in = this.strm.avail_in;
+
+ this.write_in_progress = false;
+
+ return [avail_in, avail_out];
+};
+
+Zlib.prototype._process = function () {
+ var next_expected_header_byte = null;
+
+ // If the avail_out is left at 0, then it means that it ran out
+ // of room. If there was avail_out left over, then it means
+ // that all of the input was consumed.
+ switch (this.mode) {
+ case exports.DEFLATE:
+ case exports.GZIP:
+ case exports.DEFLATERAW:
+ this.err = zlib_deflate.deflate(this.strm, this.flush);
+ break;
+ case exports.UNZIP:
+ if (this.strm.avail_in > 0) {
+ next_expected_header_byte = this.strm.next_in;
+ }
+
+ switch (this.gzip_id_bytes_read) {
+ case 0:
+ if (next_expected_header_byte === null) {
+ break;
+ }
+
+ if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) {
+ this.gzip_id_bytes_read = 1;
+ next_expected_header_byte++;
+
+ if (this.strm.avail_in === 1) {
+ // The only available byte was already read.
+ break;
+ }
+ } else {
+ this.mode = exports.INFLATE;
+ break;
+ }
+
+ // fallthrough
+ case 1:
+ if (next_expected_header_byte === null) {
+ break;
+ }
+
+ if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) {
+ this.gzip_id_bytes_read = 2;
+ this.mode = exports.GUNZIP;
+ } else {
+ // There is no actual difference between INFLATE and INFLATERAW
+ // (after initialization).
+ this.mode = exports.INFLATE;
+ }
+
+ break;
+ default:
+ throw new Error('invalid number of gzip magic number bytes read');
+ }
+
+ // fallthrough
+ case exports.INFLATE:
+ case exports.GUNZIP:
+ case exports.INFLATERAW:
+ this.err = zlib_inflate.inflate(this.strm, this.flush
+
+ // If data was encoded with dictionary
+ );if (this.err === exports.Z_NEED_DICT && this.dictionary) {
+ // Load it
+ this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary);
+ if (this.err === exports.Z_OK) {
+ // And try to decode again
+ this.err = zlib_inflate.inflate(this.strm, this.flush);
+ } else if (this.err === exports.Z_DATA_ERROR) {
+ // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR.
+ // Make it possible for After() to tell a bad dictionary from bad
+ // input.
+ this.err = exports.Z_NEED_DICT;
+ }
+ }
+ while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) {
+ // Bytes remain in input buffer. Perhaps this is another compressed
+ // member in the same archive, or just trailing garbage.
+ // Trailing zero bytes are okay, though, since they are frequently
+ // used for padding.
+
+ this.reset();
+ this.err = zlib_inflate.inflate(this.strm, this.flush);
+ }
+ break;
+ default:
+ throw new Error('Unknown mode ' + this.mode);
+ }
+};
+
+Zlib.prototype._checkError = function () {
+ // Acceptable error states depend on the type of zlib stream.
+ switch (this.err) {
+ case exports.Z_OK:
+ case exports.Z_BUF_ERROR:
+ if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) {
+ this._error('unexpected end of file');
+ return false;
+ }
+ break;
+ case exports.Z_STREAM_END:
+ // normal statuses, not fatal
+ break;
+ case exports.Z_NEED_DICT:
+ if (this.dictionary == null) {
+ this._error('Missing dictionary');
+ } else {
+ this._error('Bad dictionary');
+ }
+ return false;
+ default:
+ // something else.
+ this._error('Zlib error');
+ return false;
+ }
+
+ return true;
+};
+
+Zlib.prototype._after = function () {
+ if (!this._checkError()) {
+ return;
+ }
+
+ var avail_out = this.strm.avail_out;
+ var avail_in = this.strm.avail_in;
+
+ this.write_in_progress = false;
+
+ // call the write() cb
+ this.callback(avail_in, avail_out);
+
+ if (this.pending_close) {
+ this.close();
+ }
+};
+
+Zlib.prototype._error = function (message) {
+ if (this.strm.msg) {
+ message = this.strm.msg;
+ }
+ this.onerror(message, this.err
+
+ // no hope of rescue.
+ );this.write_in_progress = false;
+ if (this.pending_close) {
+ this.close();
+ }
+};
+
+Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) {
+ assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])');
+
+ assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits');
+ assert(level >= -1 && level <= 9, 'invalid compression level');
+
+ assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel');
+
+ assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy');
+
+ this._init(level, windowBits, memLevel, strategy, dictionary);
+ this._setDictionary();
+};
+
+Zlib.prototype.params = function () {
+ throw new Error('deflateParams Not supported');
+};
+
+Zlib.prototype.reset = function () {
+ this._reset();
+ this._setDictionary();
+};
+
+Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) {
+ this.level = level;
+ this.windowBits = windowBits;
+ this.memLevel = memLevel;
+ this.strategy = strategy;
+
+ this.flush = exports.Z_NO_FLUSH;
+
+ this.err = exports.Z_OK;
+
+ if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) {
+ this.windowBits += 16;
+ }
+
+ if (this.mode === exports.UNZIP) {
+ this.windowBits += 32;
+ }
+
+ if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) {
+ this.windowBits = -1 * this.windowBits;
+ }
+
+ this.strm = new Zstream();
+
+ switch (this.mode) {
+ case exports.DEFLATE:
+ case exports.GZIP:
+ case exports.DEFLATERAW:
+ this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy);
+ break;
+ case exports.INFLATE:
+ case exports.GUNZIP:
+ case exports.INFLATERAW:
+ case exports.UNZIP:
+ this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits);
+ break;
+ default:
+ throw new Error('Unknown mode ' + this.mode);
+ }
+
+ if (this.err !== exports.Z_OK) {
+ this._error('Init error');
+ }
+
+ this.dictionary = dictionary;
+
+ this.write_in_progress = false;
+ this.init_done = true;
+};
+
+Zlib.prototype._setDictionary = function () {
+ if (this.dictionary == null) {
+ return;
+ }
+
+ this.err = exports.Z_OK;
+
+ switch (this.mode) {
+ case exports.DEFLATE:
+ case exports.DEFLATERAW:
+ this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary);
+ break;
+ default:
+ break;
+ }
+
+ if (this.err !== exports.Z_OK) {
+ this._error('Failed to set dictionary');
+ }
+};
+
+Zlib.prototype._reset = function () {
+ this.err = exports.Z_OK;
+
+ switch (this.mode) {
+ case exports.DEFLATE:
+ case exports.DEFLATERAW:
+ case exports.GZIP:
+ this.err = zlib_deflate.deflateReset(this.strm);
+ break;
+ case exports.INFLATE:
+ case exports.INFLATERAW:
+ case exports.GUNZIP:
+ this.err = zlib_inflate.inflateReset(this.strm);
+ break;
+ default:
+ break;
+ }
+
+ if (this.err !== exports.Z_OK) {
+ this._error('Failed to reset stream');
+ }
+};
+
+exports.Zlib = Zlib;
+}).call(this,require('_process'),require("buffer").Buffer)
+},{"_process":109,"assert":35,"buffer":113,"pako/lib/zlib/constants":992,"pako/lib/zlib/deflate.js":994,"pako/lib/zlib/inflate.js":996,"pako/lib/zlib/zstream":1000}],107:[function(require,module,exports){
+(function (process){
+'use strict';
+
+var Buffer = require('buffer').Buffer;
+var Transform = require('stream').Transform;
+var binding = require('./binding');
+var util = require('util');
+var assert = require('assert').ok;
+var kMaxLength = require('buffer').kMaxLength;
+var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes';
+
+// zlib doesn't provide these, so kludge them in following the same
+// const naming scheme zlib uses.
+binding.Z_MIN_WINDOWBITS = 8;
+binding.Z_MAX_WINDOWBITS = 15;
+binding.Z_DEFAULT_WINDOWBITS = 15;
+
+// fewer than 64 bytes per chunk is stupid.
+// technically it could work with as few as 8, but even 64 bytes
+// is absurdly low. Usually a MB or more is best.
+binding.Z_MIN_CHUNK = 64;
+binding.Z_MAX_CHUNK = Infinity;
+binding.Z_DEFAULT_CHUNK = 16 * 1024;
+
+binding.Z_MIN_MEMLEVEL = 1;
+binding.Z_MAX_MEMLEVEL = 9;
+binding.Z_DEFAULT_MEMLEVEL = 8;
+
+binding.Z_MIN_LEVEL = -1;
+binding.Z_MAX_LEVEL = 9;
+binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;
+
+// expose all the zlib constants
+var bkeys = Object.keys(binding);
+for (var bk = 0; bk < bkeys.length; bk++) {
+ var bkey = bkeys[bk];
+ if (bkey.match(/^Z/)) {
+ Object.defineProperty(exports, bkey, {
+ enumerable: true, value: binding[bkey], writable: false
+ });
+ }
+}
+
+// translation table for return codes.
+var codes = {
+ Z_OK: binding.Z_OK,
+ Z_STREAM_END: binding.Z_STREAM_END,
+ Z_NEED_DICT: binding.Z_NEED_DICT,
+ Z_ERRNO: binding.Z_ERRNO,
+ Z_STREAM_ERROR: binding.Z_STREAM_ERROR,
+ Z_DATA_ERROR: binding.Z_DATA_ERROR,
+ Z_MEM_ERROR: binding.Z_MEM_ERROR,
+ Z_BUF_ERROR: binding.Z_BUF_ERROR,
+ Z_VERSION_ERROR: binding.Z_VERSION_ERROR
+};
+
+var ckeys = Object.keys(codes);
+for (var ck = 0; ck < ckeys.length; ck++) {
+ var ckey = ckeys[ck];
+ codes[codes[ckey]] = ckey;
+}
+
+Object.defineProperty(exports, 'codes', {
+ enumerable: true, value: Object.freeze(codes), writable: false
+});
+
+exports.Deflate = Deflate;
+exports.Inflate = Inflate;
+exports.Gzip = Gzip;
+exports.Gunzip = Gunzip;
+exports.DeflateRaw = DeflateRaw;
+exports.InflateRaw = InflateRaw;
+exports.Unzip = Unzip;
+
+exports.createDeflate = function (o) {
+ return new Deflate(o);
+};
+
+exports.createInflate = function (o) {
+ return new Inflate(o);
+};
+
+exports.createDeflateRaw = function (o) {
+ return new DeflateRaw(o);
+};
+
+exports.createInflateRaw = function (o) {
+ return new InflateRaw(o);
+};
+
+exports.createGzip = function (o) {
+ return new Gzip(o);
+};
+
+exports.createGunzip = function (o) {
+ return new Gunzip(o);
+};
+
+exports.createUnzip = function (o) {
+ return new Unzip(o);
+};
+
+// Convenience methods.
+// compress/decompress a string or buffer in one step.
+exports.deflate = function (buffer, opts, callback) {
+ if (typeof opts === 'function') {
+ callback = opts;
+ opts = {};
+ }
+ return zlibBuffer(new Deflate(opts), buffer, callback);
+};
+
+exports.deflateSync = function (buffer, opts) {
+ return zlibBufferSync(new Deflate(opts), buffer);
+};
+
+exports.gzip = function (buffer, opts, callback) {
+ if (typeof opts === 'function') {
+ callback = opts;
+ opts = {};
+ }
+ return zlibBuffer(new Gzip(opts), buffer, callback);
+};
+
+exports.gzipSync = function (buffer, opts) {
+ return zlibBufferSync(new Gzip(opts), buffer);
+};
+
+exports.deflateRaw = function (buffer, opts, callback) {
+ if (typeof opts === 'function') {
+ callback = opts;
+ opts = {};
+ }
+ return zlibBuffer(new DeflateRaw(opts), buffer, callback);
+};
+
+exports.deflateRawSync = function (buffer, opts) {
+ return zlibBufferSync(new DeflateRaw(opts), buffer);
+};
+
+exports.unzip = function (buffer, opts, callback) {
+ if (typeof opts === 'function') {
+ callback = opts;
+ opts = {};
+ }
+ return zlibBuffer(new Unzip(opts), buffer, callback);
+};
+
+exports.unzipSync = function (buffer, opts) {
+ return zlibBufferSync(new Unzip(opts), buffer);
+};
+
+exports.inflate = function (buffer, opts, callback) {
+ if (typeof opts === 'function') {
+ callback = opts;
+ opts = {};
+ }
+ return zlibBuffer(new Inflate(opts), buffer, callback);
+};
+
+exports.inflateSync = function (buffer, opts) {
+ return zlibBufferSync(new Inflate(opts), buffer);
+};
+
+exports.gunzip = function (buffer, opts, callback) {
+ if (typeof opts === 'function') {
+ callback = opts;
+ opts = {};
+ }
+ return zlibBuffer(new Gunzip(opts), buffer, callback);
+};
+
+exports.gunzipSync = function (buffer, opts) {
+ return zlibBufferSync(new Gunzip(opts), buffer);
+};
+
+exports.inflateRaw = function (buffer, opts, callback) {
+ if (typeof opts === 'function') {
+ callback = opts;
+ opts = {};
+ }
+ return zlibBuffer(new InflateRaw(opts), buffer, callback);
+};
+
+exports.inflateRawSync = function (buffer, opts) {
+ return zlibBufferSync(new InflateRaw(opts), buffer);
+};
+
+function zlibBuffer(engine, buffer, callback) {
+ var buffers = [];
+ var nread = 0;
+
+ engine.on('error', onError);
+ engine.on('end', onEnd);
+
+ engine.end(buffer);
+ flow();
+
+ function flow() {
+ var chunk;
+ while (null !== (chunk = engine.read())) {
+ buffers.push(chunk);
+ nread += chunk.length;
+ }
+ engine.once('readable', flow);
+ }
+
+ function onError(err) {
+ engine.removeListener('end', onEnd);
+ engine.removeListener('readable', flow);
+ callback(err);
+ }
+
+ function onEnd() {
+ var buf;
+ var err = null;
+
+ if (nread >= kMaxLength) {
+ err = new RangeError(kRangeErrorMessage);
+ } else {
+ buf = Buffer.concat(buffers, nread);
+ }
+
+ buffers = [];
+ engine.close();
+ callback(err, buf);
+ }
+}
+
+function zlibBufferSync(engine, buffer) {
+ if (typeof buffer === 'string') buffer = Buffer.from(buffer);
+
+ if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer');
+
+ var flushFlag = engine._finishFlushFlag;
+
+ return engine._processChunk(buffer, flushFlag);
+}
+
+// generic zlib
+// minimal 2-byte header
+function Deflate(opts) {
+ if (!(this instanceof Deflate)) return new Deflate(opts);
+ Zlib.call(this, opts, binding.DEFLATE);
+}
+
+function Inflate(opts) {
+ if (!(this instanceof Inflate)) return new Inflate(opts);
+ Zlib.call(this, opts, binding.INFLATE);
+}
+
+// gzip - bigger header, same deflate compression
+function Gzip(opts) {
+ if (!(this instanceof Gzip)) return new Gzip(opts);
+ Zlib.call(this, opts, binding.GZIP);
+}
+
+function Gunzip(opts) {
+ if (!(this instanceof Gunzip)) return new Gunzip(opts);
+ Zlib.call(this, opts, binding.GUNZIP);
+}
+
+// raw - no header
+function DeflateRaw(opts) {
+ if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts);
+ Zlib.call(this, opts, binding.DEFLATERAW);
+}
+
+function InflateRaw(opts) {
+ if (!(this instanceof InflateRaw)) return new InflateRaw(opts);
+ Zlib.call(this, opts, binding.INFLATERAW);
+}
+
+// auto-detect header.
+function Unzip(opts) {
+ if (!(this instanceof Unzip)) return new Unzip(opts);
+ Zlib.call(this, opts, binding.UNZIP);
+}
+
+function isValidFlushFlag(flag) {
+ return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK;
+}
+
+// the Zlib class they all inherit from
+// This thing manages the queue of requests, and returns
+// true or false if there is anything in the queue when
+// you call the .write() method.
+
+function Zlib(opts, mode) {
+ var _this = this;
+
+ this._opts = opts = opts || {};
+ this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK;
+
+ Transform.call(this, opts);
+
+ if (opts.flush && !isValidFlushFlag(opts.flush)) {
+ throw new Error('Invalid flush flag: ' + opts.flush);
+ }
+ if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) {
+ throw new Error('Invalid flush flag: ' + opts.finishFlush);
+ }
+
+ this._flushFlag = opts.flush || binding.Z_NO_FLUSH;
+ this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH;
+
+ if (opts.chunkSize) {
+ if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) {
+ throw new Error('Invalid chunk size: ' + opts.chunkSize);
+ }
+ }
+
+ if (opts.windowBits) {
+ if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) {
+ throw new Error('Invalid windowBits: ' + opts.windowBits);
+ }
+ }
+
+ if (opts.level) {
+ if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) {
+ throw new Error('Invalid compression level: ' + opts.level);
+ }
+ }
+
+ if (opts.memLevel) {
+ if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) {
+ throw new Error('Invalid memLevel: ' + opts.memLevel);
+ }
+ }
+
+ if (opts.strategy) {
+ if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) {
+ throw new Error('Invalid strategy: ' + opts.strategy);
+ }
+ }
+
+ if (opts.dictionary) {
+ if (!Buffer.isBuffer(opts.dictionary)) {
+ throw new Error('Invalid dictionary: it should be a Buffer instance');
+ }
+ }
+
+ this._handle = new binding.Zlib(mode);
+
+ var self = this;
+ this._hadError = false;
+ this._handle.onerror = function (message, errno) {
+ // there is no way to cleanly recover.
+ // continuing only obscures problems.
+ _close(self);
+ self._hadError = true;
+
+ var error = new Error(message);
+ error.errno = errno;
+ error.code = exports.codes[errno];
+ self.emit('error', error);
+ };
+
+ var level = exports.Z_DEFAULT_COMPRESSION;
+ if (typeof opts.level === 'number') level = opts.level;
+
+ var strategy = exports.Z_DEFAULT_STRATEGY;
+ if (typeof opts.strategy === 'number') strategy = opts.strategy;
+
+ this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary);
+
+ this._buffer = Buffer.allocUnsafe(this._chunkSize);
+ this._offset = 0;
+ this._level = level;
+ this._strategy = strategy;
+
+ this.once('end', this.close);
+
+ Object.defineProperty(this, '_closed', {
+ get: function () {
+ return !_this._handle;
+ },
+ configurable: true,
+ enumerable: true
+ });
+}
+
+util.inherits(Zlib, Transform);
+
+Zlib.prototype.params = function (level, strategy, callback) {
+ if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) {
+ throw new RangeError('Invalid compression level: ' + level);
+ }
+ if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) {
+ throw new TypeError('Invalid strategy: ' + strategy);
+ }
+
+ if (this._level !== level || this._strategy !== strategy) {
+ var self = this;
+ this.flush(binding.Z_SYNC_FLUSH, function () {
+ assert(self._handle, 'zlib binding closed');
+ self._handle.params(level, strategy);
+ if (!self._hadError) {
+ self._level = level;
+ self._strategy = strategy;
+ if (callback) callback();
+ }
+ });
+ } else {
+ process.nextTick(callback);
+ }
+};
+
+Zlib.prototype.reset = function () {
+ assert(this._handle, 'zlib binding closed');
+ return this._handle.reset();
+};
+
+// This is the _flush function called by the transform class,
+// internally, when the last chunk has been written.
+Zlib.prototype._flush = function (callback) {
+ this._transform(Buffer.alloc(0), '', callback);
+};
+
+Zlib.prototype.flush = function (kind, callback) {
+ var _this2 = this;
+
+ var ws = this._writableState;
+
+ if (typeof kind === 'function' || kind === undefined && !callback) {
+ callback = kind;
+ kind = binding.Z_FULL_FLUSH;
+ }
+
+ if (ws.ended) {
+ if (callback) process.nextTick(callback);
+ } else if (ws.ending) {
+ if (callback) this.once('end', callback);
+ } else if (ws.needDrain) {
+ if (callback) {
+ this.once('drain', function () {
+ return _this2.flush(kind, callback);
+ });
+ }
+ } else {
+ this._flushFlag = kind;
+ this.write(Buffer.alloc(0), '', callback);
+ }
+};
+
+Zlib.prototype.close = function (callback) {
+ _close(this, callback);
+ process.nextTick(emitCloseNT, this);
+};
+
+function _close(engine, callback) {
+ if (callback) process.nextTick(callback);
+
+ // Caller may invoke .close after a zlib error (which will null _handle).
+ if (!engine._handle) return;
+
+ engine._handle.close();
+ engine._handle = null;
+}
+
+function emitCloseNT(self) {
+ self.emit('close');
+}
+
+Zlib.prototype._transform = function (chunk, encoding, cb) {
+ var flushFlag;
+ var ws = this._writableState;
+ var ending = ws.ending || ws.ended;
+ var last = ending && (!chunk || ws.length === chunk.length);
+
+ if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input'));
+
+ if (!this._handle) return cb(new Error('zlib binding closed'));
+
+ // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag
+ // (or whatever flag was provided using opts.finishFlush).
+ // If it's explicitly flushing at some other time, then we use
+ // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression
+ // goodness.
+ if (last) flushFlag = this._finishFlushFlag;else {
+ flushFlag = this._flushFlag;
+ // once we've flushed the last of the queue, stop flushing and
+ // go back to the normal behavior.
+ if (chunk.length >= ws.length) {
+ this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;
+ }
+ }
+
+ this._processChunk(chunk, flushFlag, cb);
+};
+
+Zlib.prototype._processChunk = function (chunk, flushFlag, cb) {
+ var availInBefore = chunk && chunk.length;
+ var availOutBefore = this._chunkSize - this._offset;
+ var inOff = 0;
+
+ var self = this;
+
+ var async = typeof cb === 'function';
+
+ if (!async) {
+ var buffers = [];
+ var nread = 0;
+
+ var error;
+ this.on('error', function (er) {
+ error = er;
+ });
+
+ assert(this._handle, 'zlib binding closed');
+ do {
+ var res = this._handle.writeSync(flushFlag, chunk, // in
+ inOff, // in_off
+ availInBefore, // in_len
+ this._buffer, // out
+ this._offset, //out_off
+ availOutBefore); // out_len
+ } while (!this._hadError && callback(res[0], res[1]));
+
+ if (this._hadError) {
+ throw error;
+ }
+
+ if (nread >= kMaxLength) {
+ _close(this);
+ throw new RangeError(kRangeErrorMessage);
+ }
+
+ var buf = Buffer.concat(buffers, nread);
+ _close(this);
+
+ return buf;
+ }
+
+ assert(this._handle, 'zlib binding closed');
+ var req = this._handle.write(flushFlag, chunk, // in
+ inOff, // in_off
+ availInBefore, // in_len
+ this._buffer, // out
+ this._offset, //out_off
+ availOutBefore); // out_len
+
+ req.buffer = chunk;
+ req.callback = callback;
+
+ function callback(availInAfter, availOutAfter) {
+ // When the callback is used in an async write, the callback's
+ // context is the `req` object that was created. The req object
+ // is === this._handle, and that's why it's important to null
+ // out the values after they are done being used. `this._handle`
+ // can stay in memory longer than the callback and buffer are needed.
+ if (this) {
+ this.buffer = null;
+ this.callback = null;
+ }
+
+ if (self._hadError) return;
+
+ var have = availOutBefore - availOutAfter;
+ assert(have >= 0, 'have should not go down');
+
+ if (have > 0) {
+ var out = self._buffer.slice(self._offset, self._offset + have);
+ self._offset += have;
+ // serve some output to the consumer.
+ if (async) {
+ self.push(out);
+ } else {
+ buffers.push(out);
+ nread += out.length;
+ }
+ }
+
+ // exhausted the output buffer, or used all the input create a new one.
+ if (availOutAfter === 0 || self._offset >= self._chunkSize) {
+ availOutBefore = self._chunkSize;
+ self._offset = 0;
+ self._buffer = Buffer.allocUnsafe(self._chunkSize);
+ }
+
+ if (availOutAfter === 0) {
+ // Not actually done. Need to reprocess.
+ // Also, update the availInBefore to the availInAfter value,
+ // so that if we have to hit it a third (fourth, etc.) time,
+ // it'll have the correct byte counts.
+ inOff += availInBefore - availInAfter;
+ availInBefore = availInAfter;
+
+ if (!async) return true;
+
+ var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize);
+ newReq.callback = callback; // this same function
+ newReq.buffer = chunk;
+ return;
+ }
+
+ if (!async) return false;
+
+ // finished with the chunk.
+ cb();
+ }
+};
+
+util.inherits(Deflate, Zlib);
+util.inherits(Inflate, Zlib);
+util.inherits(Gzip, Zlib);
+util.inherits(Gunzip, Zlib);
+util.inherits(DeflateRaw, Zlib);
+util.inherits(InflateRaw, Zlib);
+util.inherits(Unzip, Zlib);
+}).call(this,require('_process'))
+},{"./binding":106,"_process":109,"assert":35,"buffer":113,"stream":1394,"util":1439}],108:[function(require,module,exports){
+arguments[4][77][0].apply(exports,arguments)
+},{"dup":77}],109:[function(require,module,exports){
+// shim for using process in browser
+var process = module.exports = {};
+
+// cached from whatever global is present so that test runners that stub it
+// don't break things. But we need to wrap it in a try catch in case it is
+// wrapped in strict mode code which doesn't define any globals. It's inside a
+// function because try/catches deoptimize in certain engines.
+
+var cachedSetTimeout;
+var cachedClearTimeout;
+
+function defaultSetTimout() {
+ throw new Error('setTimeout has not been defined');
+}
+function defaultClearTimeout () {
+ throw new Error('clearTimeout has not been defined');
+}
+(function () {
+ try {
+ if (typeof setTimeout === 'function') {
+ cachedSetTimeout = setTimeout;
+ } else {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ } catch (e) {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ try {
+ if (typeof clearTimeout === 'function') {
+ cachedClearTimeout = clearTimeout;
+ } else {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+ } catch (e) {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+} ())
+function runTimeout(fun) {
+ if (cachedSetTimeout === setTimeout) {
+ //normal enviroments in sane situations
+ return setTimeout(fun, 0);
+ }
+ // if setTimeout wasn't available but was latter defined
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
+ cachedSetTimeout = setTimeout;
+ return setTimeout(fun, 0);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedSetTimeout(fun, 0);
+ } catch(e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedSetTimeout.call(null, fun, 0);
+ } catch(e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
+ return cachedSetTimeout.call(this, fun, 0);
+ }
+ }
+
+
+}
+function runClearTimeout(marker) {
+ if (cachedClearTimeout === clearTimeout) {
+ //normal enviroments in sane situations
+ return clearTimeout(marker);
+ }
+ // if clearTimeout wasn't available but was latter defined
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
+ cachedClearTimeout = clearTimeout;
+ return clearTimeout(marker);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedClearTimeout(marker);
+ } catch (e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedClearTimeout.call(null, marker);
+ } catch (e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
+ return cachedClearTimeout.call(this, marker);
+ }
+ }
+
+
+
+}
+var queue = [];
+var draining = false;
+var currentQueue;
+var queueIndex = -1;
+
+function cleanUpNextTick() {
+ if (!draining || !currentQueue) {
+ return;
+ }
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
+ }
+ if (queue.length) {
+ drainQueue();
+ }
+}
+
+function drainQueue() {
+ if (draining) {
+ return;
+ }
+ var timeout = runTimeout(cleanUpNextTick);
+ draining = true;
+
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ if (currentQueue) {
+ currentQueue[queueIndex].run();
+ }
+ }
+ queueIndex = -1;
+ len = queue.length;
+ }
+ currentQueue = null;
+ draining = false;
+ runClearTimeout(timeout);
+}
+
+process.nextTick = function (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i];
+ }
+ }
+ queue.push(new Item(fun, args));
+ if (queue.length === 1 && !draining) {
+ runTimeout(drainQueue);
+ }
+};
+
+// v8 likes predictible objects
+function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+}
+Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+};
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+process.version = ''; // empty string to avoid regexp issues
+process.versions = {};
+
+function noop() {}
+
+process.on = noop;
+process.addListener = noop;
+process.once = noop;
+process.off = noop;
+process.removeListener = noop;
+process.removeAllListeners = noop;
+process.emit = noop;
+process.prependListener = noop;
+process.prependOnceListener = noop;
+
+process.listeners = function (name) { return [] }
+
+process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+};
+
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+};
+process.umask = function() { return 0; };
+
+},{}],110:[function(require,module,exports){
+(function (global){
+/*! https://mths.be/punycode v1.4.1 by @mathias */
+;(function(root) {
+
+ /** Detect free variables */
+ var freeExports = typeof exports == 'object' && exports &&
+ !exports.nodeType && exports;
+ var freeModule = typeof module == 'object' && module &&
+ !module.nodeType && module;
+ var freeGlobal = typeof global == 'object' && global;
+ if (
+ freeGlobal.global === freeGlobal ||
+ freeGlobal.window === freeGlobal ||
+ freeGlobal.self === freeGlobal
+ ) {
+ root = freeGlobal;
+ }
+
+ /**
+ * The `punycode` object.
+ * @name punycode
+ * @type Object
+ */
+ var punycode,
+
+ /** Highest positive signed 32-bit float value */
+ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
+
+ /** Bootstring parameters */
+ base = 36,
+ tMin = 1,
+ tMax = 26,
+ skew = 38,
+ damp = 700,
+ initialBias = 72,
+ initialN = 128, // 0x80
+ delimiter = '-', // '\x2D'
+
+ /** Regular expressions */
+ regexPunycode = /^xn--/,
+ regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
+ regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
+
+ /** Error messages */
+ errors = {
+ 'overflow': 'Overflow: input needs wider integers to process',
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
+ 'invalid-input': 'Invalid input'
+ },
+
+ /** Convenience shortcuts */
+ baseMinusTMin = base - tMin,
+ floor = Math.floor,
+ stringFromCharCode = String.fromCharCode,
+
+ /** Temporary variable */
+ key;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * A generic error utility function.
+ * @private
+ * @param {String} type The error type.
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
+ */
+ function error(type) {
+ throw new RangeError(errors[type]);
+ }
+
+ /**
+ * A generic `Array#map` utility function.
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} callback The function that gets called for every array
+ * item.
+ * @returns {Array} A new array of values returned by the callback function.
+ */
+ function map(array, fn) {
+ var length = array.length;
+ var result = [];
+ while (length--) {
+ result[length] = fn(array[length]);
+ }
+ return result;
+ }
+
+ /**
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
+ * addresses.
+ * @private
+ * @param {String} domain The domain name or email address.
+ * @param {Function} callback The function that gets called for every
+ * character.
+ * @returns {Array} A new string of characters returned by the callback
+ * function.
+ */
+ function mapDomain(string, fn) {
+ var parts = string.split('@');
+ var result = '';
+ if (parts.length > 1) {
+ // In email addresses, only the domain name should be punycoded. Leave
+ // the local part (i.e. everything up to `@`) intact.
+ result = parts[0] + '@';
+ string = parts[1];
+ }
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
+ string = string.replace(regexSeparators, '\x2E');
+ var labels = string.split('.');
+ var encoded = map(labels, fn).join('.');
+ return result + encoded;
+ }
+
+ /**
+ * Creates an array containing the numeric code points of each Unicode
+ * character in the string. While JavaScript uses UCS-2 internally,
+ * this function will convert a pair of surrogate halves (each of which
+ * UCS-2 exposes as separate characters) into a single code point,
+ * matching UTF-16.
+ * @see `punycode.ucs2.encode`
+ * @see
+ * @memberOf punycode.ucs2
+ * @name decode
+ * @param {String} string The Unicode input string (UCS-2).
+ * @returns {Array} The new array of code points.
+ */
+ function ucs2decode(string) {
+ var output = [],
+ counter = 0,
+ length = string.length,
+ value,
+ extra;
+ while (counter < length) {
+ value = string.charCodeAt(counter++);
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+ // high surrogate, and there is a next character
+ extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) { // low surrogate
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ } else {
+ // unmatched surrogate; only append this code unit, in case the next
+ // code unit is the high surrogate of a surrogate pair
+ output.push(value);
+ counter--;
+ }
+ } else {
+ output.push(value);
+ }
+ }
+ return output;
+ }
+
+ /**
+ * Creates a string based on an array of numeric code points.
+ * @see `punycode.ucs2.decode`
+ * @memberOf punycode.ucs2
+ * @name encode
+ * @param {Array} codePoints The array of numeric code points.
+ * @returns {String} The new Unicode string (UCS-2).
+ */
+ function ucs2encode(array) {
+ return map(array, function(value) {
+ var output = '';
+ if (value > 0xFFFF) {
+ value -= 0x10000;
+ output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
+ value = 0xDC00 | value & 0x3FF;
+ }
+ output += stringFromCharCode(value);
+ return output;
+ }).join('');
+ }
+
+ /**
+ * Converts a basic code point into a digit/integer.
+ * @see `digitToBasic()`
+ * @private
+ * @param {Number} codePoint The basic numeric code point value.
+ * @returns {Number} The numeric value of a basic code point (for use in
+ * representing integers) in the range `0` to `base - 1`, or `base` if
+ * the code point does not represent a value.
+ */
+ function basicToDigit(codePoint) {
+ if (codePoint - 48 < 10) {
+ return codePoint - 22;
+ }
+ if (codePoint - 65 < 26) {
+ return codePoint - 65;
+ }
+ if (codePoint - 97 < 26) {
+ return codePoint - 97;
+ }
+ return base;
+ }
+
+ /**
+ * Converts a digit/integer into a basic code point.
+ * @see `basicToDigit()`
+ * @private
+ * @param {Number} digit The numeric value of a basic code point.
+ * @returns {Number} The basic code point whose value (when used for
+ * representing integers) is `digit`, which needs to be in the range
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
+ * used; else, the lowercase form is used. The behavior is undefined
+ * if `flag` is non-zero and `digit` has no uppercase form.
+ */
+ function digitToBasic(digit, flag) {
+ // 0..25 map to ASCII a..z or A..Z
+ // 26..35 map to ASCII 0..9
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
+ }
+
+ /**
+ * Bias adaptation function as per section 3.4 of RFC 3492.
+ * https://tools.ietf.org/html/rfc3492#section-3.4
+ * @private
+ */
+ function adapt(delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
+ delta += floor(delta / numPoints);
+ for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor(delta / baseMinusTMin);
+ }
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
+ }
+
+ /**
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
+ * symbols.
+ * @memberOf punycode
+ * @param {String} input The Punycode string of ASCII-only symbols.
+ * @returns {String} The resulting string of Unicode symbols.
+ */
+ function decode(input) {
+ // Don't use UCS-2
+ var output = [],
+ inputLength = input.length,
+ out,
+ i = 0,
+ n = initialN,
+ bias = initialBias,
+ basic,
+ j,
+ index,
+ oldi,
+ w,
+ k,
+ digit,
+ t,
+ /** Cached calculation results */
+ baseMinusT;
+
+ // Handle the basic code points: let `basic` be the number of input code
+ // points before the last delimiter, or `0` if there is none, then copy
+ // the first basic code points to the output.
+
+ basic = input.lastIndexOf(delimiter);
+ if (basic < 0) {
+ basic = 0;
+ }
+
+ for (j = 0; j < basic; ++j) {
+ // if it's not a basic code point
+ if (input.charCodeAt(j) >= 0x80) {
+ error('not-basic');
+ }
+ output.push(input.charCodeAt(j));
+ }
+
+ // Main decoding loop: start just after the last delimiter if any basic code
+ // points were copied; start at the beginning otherwise.
+
+ for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
+
+ // `index` is the index of the next character to be consumed.
+ // Decode a generalized variable-length integer into `delta`,
+ // which gets added to `i`. The overflow checking is easier
+ // if we increase `i` as we go, then subtract off its starting
+ // value at the end to obtain `delta`.
+ for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
+
+ if (index >= inputLength) {
+ error('invalid-input');
+ }
+
+ digit = basicToDigit(input.charCodeAt(index++));
+
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
+ error('overflow');
+ }
+
+ i += digit * w;
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+
+ if (digit < t) {
+ break;
+ }
+
+ baseMinusT = base - t;
+ if (w > floor(maxInt / baseMinusT)) {
+ error('overflow');
+ }
+
+ w *= baseMinusT;
+
+ }
+
+ out = output.length + 1;
+ bias = adapt(i - oldi, out, oldi == 0);
+
+ // `i` was supposed to wrap around from `out` to `0`,
+ // incrementing `n` each time, so we'll fix that now:
+ if (floor(i / out) > maxInt - n) {
+ error('overflow');
+ }
+
+ n += floor(i / out);
+ i %= out;
+
+ // Insert `n` at position `i` of the output
+ output.splice(i++, 0, n);
+
+ }
+
+ return ucs2encode(output);
+ }
+
+ /**
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
+ * Punycode string of ASCII-only symbols.
+ * @memberOf punycode
+ * @param {String} input The string of Unicode symbols.
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
+ */
+ function encode(input) {
+ var n,
+ delta,
+ handledCPCount,
+ basicLength,
+ bias,
+ j,
+ m,
+ q,
+ k,
+ t,
+ currentValue,
+ output = [],
+ /** `inputLength` will hold the number of code points in `input`. */
+ inputLength,
+ /** Cached calculation results */
+ handledCPCountPlusOne,
+ baseMinusT,
+ qMinusT;
+
+ // Convert the input in UCS-2 to Unicode
+ input = ucs2decode(input);
+
+ // Cache the length
+ inputLength = input.length;
+
+ // Initialize the state
+ n = initialN;
+ delta = 0;
+ bias = initialBias;
+
+ // Handle the basic code points
+ for (j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+
+ handledCPCount = basicLength = output.length;
+
+ // `handledCPCount` is the number of code points that have been handled;
+ // `basicLength` is the number of basic code points.
+
+ // Finish the basic string - if it is not empty - with a delimiter
+ if (basicLength) {
+ output.push(delimiter);
+ }
+
+ // Main encoding loop:
+ while (handledCPCount < inputLength) {
+
+ // All non-basic code points < n have been handled already. Find the next
+ // larger one:
+ for (m = maxInt, j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+
+ // Increase `delta` enough to advance the decoder's state to ,
+ // but guard against overflow
+ handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
+ error('overflow');
+ }
+
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+
+ for (j = 0; j < inputLength; ++j) {
+ currentValue = input[j];
+
+ if (currentValue < n && ++delta > maxInt) {
+ error('overflow');
+ }
+
+ if (currentValue == n) {
+ // Represent delta as a generalized variable-length integer
+ for (q = delta, k = base; /* no condition */; k += base) {
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ if (q < t) {
+ break;
+ }
+ qMinusT = q - t;
+ baseMinusT = base - t;
+ output.push(
+ stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
+ );
+ q = floor(qMinusT / baseMinusT);
+ }
+
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
+ delta = 0;
+ ++handledCPCount;
+ }
+ }
+
+ ++delta;
+ ++n;
+
+ }
+ return output.join('');
+ }
+
+ /**
+ * Converts a Punycode string representing a domain name or an email address
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
+ * it doesn't matter if you call it on a string that has already been
+ * converted to Unicode.
+ * @memberOf punycode
+ * @param {String} input The Punycoded domain name or email address to
+ * convert to Unicode.
+ * @returns {String} The Unicode representation of the given Punycode
+ * string.
+ */
+ function toUnicode(input) {
+ return mapDomain(input, function(string) {
+ return regexPunycode.test(string)
+ ? decode(string.slice(4).toLowerCase())
+ : string;
+ });
+ }
+
+ /**
+ * Converts a Unicode string representing a domain name or an email address to
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
+ * i.e. it doesn't matter if you call it with a domain that's already in
+ * ASCII.
+ * @memberOf punycode
+ * @param {String} input The domain name or email address to convert, as a
+ * Unicode string.
+ * @returns {String} The Punycode representation of the given domain name or
+ * email address.
+ */
+ function toASCII(input) {
+ return mapDomain(input, function(string) {
+ return regexNonASCII.test(string)
+ ? 'xn--' + encode(string)
+ : string;
+ });
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /** Define the public API */
+ punycode = {
+ /**
+ * A string representing the current Punycode.js version number.
+ * @memberOf punycode
+ * @type String
+ */
+ 'version': '1.4.1',
+ /**
+ * An object of methods to convert from JavaScript's internal character
+ * representation (UCS-2) to Unicode code points, and back.
+ * @see
+ * @memberOf punycode
+ * @type Object
+ */
+ 'ucs2': {
+ 'decode': ucs2decode,
+ 'encode': ucs2encode
+ },
+ 'decode': decode,
+ 'encode': encode,
+ 'toASCII': toASCII,
+ 'toUnicode': toUnicode
+ };
+
+ /** Expose `punycode` */
+ // Some AMD build optimizers, like r.js, check for specific condition patterns
+ // like the following:
+ if (
+ typeof define == 'function' &&
+ typeof define.amd == 'object' &&
+ define.amd
+ ) {
+ define('punycode', function() {
+ return punycode;
+ });
+ } else if (freeExports && freeModule) {
+ if (module.exports == freeExports) {
+ // in Node.js, io.js, or RingoJS v0.8.0+
+ freeModule.exports = punycode;
+ } else {
+ // in Narwhal or RingoJS v0.7.0-
+ for (key in punycode) {
+ punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
+ }
+ }
+ } else {
+ // in Rhino or a web browser
+ root.punycode = punycode;
+ }
+
+}(this));
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],111:[function(require,module,exports){
+var indexOf = function (xs, item) {
+ if (xs.indexOf) return xs.indexOf(item);
+ else for (var i = 0; i < xs.length; i++) {
+ if (xs[i] === item) return i;
+ }
+ return -1;
+};
+var Object_keys = function (obj) {
+ if (Object.keys) return Object.keys(obj)
+ else {
+ var res = [];
+ for (var key in obj) res.push(key)
+ return res;
+ }
+};
+
+var forEach = function (xs, fn) {
+ if (xs.forEach) return xs.forEach(fn)
+ else for (var i = 0; i < xs.length; i++) {
+ fn(xs[i], i, xs);
+ }
+};
+
+var defineProp = (function() {
+ try {
+ Object.defineProperty({}, '_', {});
+ return function(obj, name, value) {
+ Object.defineProperty(obj, name, {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ value: value
+ })
+ };
+ } catch(e) {
+ return function(obj, name, value) {
+ obj[name] = value;
+ };
+ }
+}());
+
+var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
+'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
+'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
+'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
+'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
+
+function Context() {}
+Context.prototype = {};
+
+var Script = exports.Script = function NodeScript (code) {
+ if (!(this instanceof Script)) return new Script(code);
+ this.code = code;
+};
+
+Script.prototype.runInContext = function (context) {
+ if (!(context instanceof Context)) {
+ throw new TypeError("needs a 'context' argument.");
+ }
+
+ var iframe = document.createElement('iframe');
+ if (!iframe.style) iframe.style = {};
+ iframe.style.display = 'none';
+
+ document.body.appendChild(iframe);
+
+ var win = iframe.contentWindow;
+ var wEval = win.eval, wExecScript = win.execScript;
+
+ if (!wEval && wExecScript) {
+ // win.eval() magically appears when this is called in IE:
+ wExecScript.call(win, 'null');
+ wEval = win.eval;
+ }
+
+ forEach(Object_keys(context), function (key) {
+ win[key] = context[key];
+ });
+ forEach(globals, function (key) {
+ if (context[key]) {
+ win[key] = context[key];
+ }
+ });
+
+ var winKeys = Object_keys(win);
+
+ var res = wEval.call(win, this.code);
+
+ forEach(Object_keys(win), function (key) {
+ // Avoid copying circular objects like `top` and `window` by only
+ // updating existing context properties or new properties in the `win`
+ // that was only introduced after the eval.
+ if (key in context || indexOf(winKeys, key) === -1) {
+ context[key] = win[key];
+ }
+ });
+
+ forEach(globals, function (key) {
+ if (!(key in context)) {
+ defineProp(context, key, win[key]);
+ }
+ });
+
+ document.body.removeChild(iframe);
+
+ return res;
+};
+
+Script.prototype.runInThisContext = function () {
+ return eval(this.code); // maybe...
+};
+
+Script.prototype.runInNewContext = function (context) {
+ var ctx = Script.createContext(context);
+ var res = this.runInContext(ctx);
+
+ if (context) {
+ forEach(Object_keys(ctx), function (key) {
+ context[key] = ctx[key];
+ });
+ }
+
+ return res;
+};
+
+forEach(Object_keys(Script.prototype), function (name) {
+ exports[name] = Script[name] = function (code) {
+ var s = Script(code);
+ return s[name].apply(s, [].slice.call(arguments, 1));
+ };
+});
+
+exports.isContext = function (context) {
+ return context instanceof Context;
+};
+
+exports.createScript = function (code) {
+ return exports.Script(code);
+};
+
+exports.createContext = Script.createContext = function (context) {
+ var copy = new Context();
+ if(typeof context === 'object') {
+ forEach(Object_keys(context), function (key) {
+ copy[key] = context[key];
+ });
+ }
+ return copy;
+};
+
+},{}],112:[function(require,module,exports){
+(function (Buffer){
+module.exports = function xor (a, b) {
+ var length = Math.min(a.length, b.length)
+ var buffer = new Buffer(length)
+
+ for (var i = 0; i < length; ++i) {
+ buffer[i] = a[i] ^ b[i]
+ }
+
+ return buffer
+}
+
+}).call(this,require("buffer").Buffer)
+},{"buffer":113}],113:[function(require,module,exports){
+(function (Buffer){
+/*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ */
+/* eslint-disable no-proto */
+
+'use strict'
+
+var base64 = require('base64-js')
+var ieee754 = require('ieee754')
+
+exports.Buffer = Buffer
+exports.SlowBuffer = SlowBuffer
+exports.INSPECT_MAX_BYTES = 50
+
+var K_MAX_LENGTH = 0x7fffffff
+exports.kMaxLength = K_MAX_LENGTH
+
+/**
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
+ * === true Use Uint8Array implementation (fastest)
+ * === false Print warning and recommend using `buffer` v4.x which has an Object
+ * implementation (most compatible, even IE6)
+ *
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
+ * Opera 11.6+, iOS 4.2+.
+ *
+ * We report that the browser does not support typed arrays if the are not subclassable
+ * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
+ * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
+ * for __proto__ and has a buggy typed array implementation.
+ */
+Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
+
+if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
+ typeof console.error === 'function') {
+ console.error(
+ 'This browser lacks typed array (Uint8Array) support which is required by ' +
+ '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
+ )
+}
+
+function typedArraySupport () {
+ // Can typed array instances can be augmented?
+ try {
+ var arr = new Uint8Array(1)
+ arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
+ return arr.foo() === 42
+ } catch (e) {
+ return false
+ }
+}
+
+Object.defineProperty(Buffer.prototype, 'parent', {
+ enumerable: true,
+ get: function () {
+ if (!Buffer.isBuffer(this)) return undefined
+ return this.buffer
+ }
+})
+
+Object.defineProperty(Buffer.prototype, 'offset', {
+ enumerable: true,
+ get: function () {
+ if (!Buffer.isBuffer(this)) return undefined
+ return this.byteOffset
+ }
+})
+
+function createBuffer (length) {
+ if (length > K_MAX_LENGTH) {
+ throw new RangeError('The value "' + length + '" is invalid for option "size"')
+ }
+ // Return an augmented `Uint8Array` instance
+ var buf = new Uint8Array(length)
+ buf.__proto__ = Buffer.prototype
+ return buf
+}
+
+/**
+ * The Buffer constructor returns instances of `Uint8Array` that have their
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
+ * returns a single octet.
+ *
+ * The `Uint8Array` prototype remains unmodified.
+ */
+
+function Buffer (arg, encodingOrOffset, length) {
+ // Common case.
+ if (typeof arg === 'number') {
+ if (typeof encodingOrOffset === 'string') {
+ throw new TypeError(
+ 'The "string" argument must be of type string. Received type number'
+ )
+ }
+ return allocUnsafe(arg)
+ }
+ return from(arg, encodingOrOffset, length)
+}
+
+// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
+if (typeof Symbol !== 'undefined' && Symbol.species != null &&
+ Buffer[Symbol.species] === Buffer) {
+ Object.defineProperty(Buffer, Symbol.species, {
+ value: null,
+ configurable: true,
+ enumerable: false,
+ writable: false
+ })
+}
+
+Buffer.poolSize = 8192 // not used by this implementation
+
+function from (value, encodingOrOffset, length) {
+ if (typeof value === 'string') {
+ return fromString(value, encodingOrOffset)
+ }
+
+ if (ArrayBuffer.isView(value)) {
+ return fromArrayLike(value)
+ }
+
+ if (value == null) {
+ throw TypeError(
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
+ 'or Array-like Object. Received type ' + (typeof value)
+ )
+ }
+
+ if (isInstance(value, ArrayBuffer) ||
+ (value && isInstance(value.buffer, ArrayBuffer))) {
+ return fromArrayBuffer(value, encodingOrOffset, length)
+ }
+
+ if (typeof value === 'number') {
+ throw new TypeError(
+ 'The "value" argument must not be of type number. Received type number'
+ )
+ }
+
+ var valueOf = value.valueOf && value.valueOf()
+ if (valueOf != null && valueOf !== value) {
+ return Buffer.from(valueOf, encodingOrOffset, length)
+ }
+
+ var b = fromObject(value)
+ if (b) return b
+
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
+ typeof value[Symbol.toPrimitive] === 'function') {
+ return Buffer.from(
+ value[Symbol.toPrimitive]('string'), encodingOrOffset, length
+ )
+ }
+
+ throw new TypeError(
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
+ 'or Array-like Object. Received type ' + (typeof value)
+ )
+}
+
+/**
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
+ * if value is a number.
+ * Buffer.from(str[, encoding])
+ * Buffer.from(array)
+ * Buffer.from(buffer)
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
+ **/
+Buffer.from = function (value, encodingOrOffset, length) {
+ return from(value, encodingOrOffset, length)
+}
+
+// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
+// https://github.com/feross/buffer/pull/148
+Buffer.prototype.__proto__ = Uint8Array.prototype
+Buffer.__proto__ = Uint8Array
+
+function assertSize (size) {
+ if (typeof size !== 'number') {
+ throw new TypeError('"size" argument must be of type number')
+ } else if (size < 0) {
+ throw new RangeError('The value "' + size + '" is invalid for option "size"')
+ }
+}
+
+function alloc (size, fill, encoding) {
+ assertSize(size)
+ if (size <= 0) {
+ return createBuffer(size)
+ }
+ if (fill !== undefined) {
+ // Only pay attention to encoding if it's a string. This
+ // prevents accidentally sending in a number that would
+ // be interpretted as a start offset.
+ return typeof encoding === 'string'
+ ? createBuffer(size).fill(fill, encoding)
+ : createBuffer(size).fill(fill)
+ }
+ return createBuffer(size)
+}
+
+/**
+ * Creates a new filled Buffer instance.
+ * alloc(size[, fill[, encoding]])
+ **/
+Buffer.alloc = function (size, fill, encoding) {
+ return alloc(size, fill, encoding)
+}
+
+function allocUnsafe (size) {
+ assertSize(size)
+ return createBuffer(size < 0 ? 0 : checked(size) | 0)
+}
+
+/**
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
+ * */
+Buffer.allocUnsafe = function (size) {
+ return allocUnsafe(size)
+}
+/**
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
+ */
+Buffer.allocUnsafeSlow = function (size) {
+ return allocUnsafe(size)
+}
+
+function fromString (string, encoding) {
+ if (typeof encoding !== 'string' || encoding === '') {
+ encoding = 'utf8'
+ }
+
+ if (!Buffer.isEncoding(encoding)) {
+ throw new TypeError('Unknown encoding: ' + encoding)
+ }
+
+ var length = byteLength(string, encoding) | 0
+ var buf = createBuffer(length)
+
+ var actual = buf.write(string, encoding)
+
+ if (actual !== length) {
+ // Writing a hex string, for example, that contains invalid characters will
+ // cause everything after the first invalid character to be ignored. (e.g.
+ // 'abxxcd' will be treated as 'ab')
+ buf = buf.slice(0, actual)
+ }
+
+ return buf
+}
+
+function fromArrayLike (array) {
+ var length = array.length < 0 ? 0 : checked(array.length) | 0
+ var buf = createBuffer(length)
+ for (var i = 0; i < length; i += 1) {
+ buf[i] = array[i] & 255
+ }
+ return buf
+}
+
+function fromArrayBuffer (array, byteOffset, length) {
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
+ throw new RangeError('"offset" is outside of buffer bounds')
+ }
+
+ if (array.byteLength < byteOffset + (length || 0)) {
+ throw new RangeError('"length" is outside of buffer bounds')
+ }
+
+ var buf
+ if (byteOffset === undefined && length === undefined) {
+ buf = new Uint8Array(array)
+ } else if (length === undefined) {
+ buf = new Uint8Array(array, byteOffset)
+ } else {
+ buf = new Uint8Array(array, byteOffset, length)
+ }
+
+ // Return an augmented `Uint8Array` instance
+ buf.__proto__ = Buffer.prototype
+ return buf
+}
+
+function fromObject (obj) {
+ if (Buffer.isBuffer(obj)) {
+ var len = checked(obj.length) | 0
+ var buf = createBuffer(len)
+
+ if (buf.length === 0) {
+ return buf
+ }
+
+ obj.copy(buf, 0, 0, len)
+ return buf
+ }
+
+ if (obj.length !== undefined) {
+ if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
+ return createBuffer(0)
+ }
+ return fromArrayLike(obj)
+ }
+
+ if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
+ return fromArrayLike(obj.data)
+ }
+}
+
+function checked (length) {
+ // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
+ // length is NaN (which is otherwise coerced to zero.)
+ if (length >= K_MAX_LENGTH) {
+ throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
+ 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
+ }
+ return length | 0
+}
+
+function SlowBuffer (length) {
+ if (+length != length) { // eslint-disable-line eqeqeq
+ length = 0
+ }
+ return Buffer.alloc(+length)
+}
+
+Buffer.isBuffer = function isBuffer (b) {
+ return b != null && b._isBuffer === true &&
+ b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
+}
+
+Buffer.compare = function compare (a, b) {
+ if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
+ if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
+ throw new TypeError(
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
+ )
+ }
+
+ if (a === b) return 0
+
+ var x = a.length
+ var y = b.length
+
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
+ if (a[i] !== b[i]) {
+ x = a[i]
+ y = b[i]
+ break
+ }
+ }
+
+ if (x < y) return -1
+ if (y < x) return 1
+ return 0
+}
+
+Buffer.isEncoding = function isEncoding (encoding) {
+ switch (String(encoding).toLowerCase()) {
+ case 'hex':
+ case 'utf8':
+ case 'utf-8':
+ case 'ascii':
+ case 'latin1':
+ case 'binary':
+ case 'base64':
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return true
+ default:
+ return false
+ }
+}
+
+Buffer.concat = function concat (list, length) {
+ if (!Array.isArray(list)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+
+ if (list.length === 0) {
+ return Buffer.alloc(0)
+ }
+
+ var i
+ if (length === undefined) {
+ length = 0
+ for (i = 0; i < list.length; ++i) {
+ length += list[i].length
+ }
+ }
+
+ var buffer = Buffer.allocUnsafe(length)
+ var pos = 0
+ for (i = 0; i < list.length; ++i) {
+ var buf = list[i]
+ if (isInstance(buf, Uint8Array)) {
+ buf = Buffer.from(buf)
+ }
+ if (!Buffer.isBuffer(buf)) {
+ throw new TypeError('"list" argument must be an Array of Buffers')
+ }
+ buf.copy(buffer, pos)
+ pos += buf.length
+ }
+ return buffer
+}
+
+function byteLength (string, encoding) {
+ if (Buffer.isBuffer(string)) {
+ return string.length
+ }
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
+ return string.byteLength
+ }
+ if (typeof string !== 'string') {
+ throw new TypeError(
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
+ 'Received type ' + typeof string
+ )
+ }
+
+ var len = string.length
+ var mustMatch = (arguments.length > 2 && arguments[2] === true)
+ if (!mustMatch && len === 0) return 0
+
+ // Use a for loop to avoid recursion
+ var loweredCase = false
+ for (;;) {
+ switch (encoding) {
+ case 'ascii':
+ case 'latin1':
+ case 'binary':
+ return len
+ case 'utf8':
+ case 'utf-8':
+ return utf8ToBytes(string).length
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return len * 2
+ case 'hex':
+ return len >>> 1
+ case 'base64':
+ return base64ToBytes(string).length
+ default:
+ if (loweredCase) {
+ return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
+ }
+ encoding = ('' + encoding).toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+Buffer.byteLength = byteLength
+
+function slowToString (encoding, start, end) {
+ var loweredCase = false
+
+ // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
+ // property of a typed array.
+
+ // This behaves neither like String nor Uint8Array in that we set start/end
+ // to their upper/lower bounds if the value passed is out of range.
+ // undefined is handled specially as per ECMA-262 6th Edition,
+ // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
+ if (start === undefined || start < 0) {
+ start = 0
+ }
+ // Return early if start > this.length. Done here to prevent potential uint32
+ // coercion fail below.
+ if (start > this.length) {
+ return ''
+ }
+
+ if (end === undefined || end > this.length) {
+ end = this.length
+ }
+
+ if (end <= 0) {
+ return ''
+ }
+
+ // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
+ end >>>= 0
+ start >>>= 0
+
+ if (end <= start) {
+ return ''
+ }
+
+ if (!encoding) encoding = 'utf8'
+
+ while (true) {
+ switch (encoding) {
+ case 'hex':
+ return hexSlice(this, start, end)
+
+ case 'utf8':
+ case 'utf-8':
+ return utf8Slice(this, start, end)
+
+ case 'ascii':
+ return asciiSlice(this, start, end)
+
+ case 'latin1':
+ case 'binary':
+ return latin1Slice(this, start, end)
+
+ case 'base64':
+ return base64Slice(this, start, end)
+
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return utf16leSlice(this, start, end)
+
+ default:
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
+ encoding = (encoding + '').toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+
+// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
+// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
+// reliably in a browserify context because there could be multiple different
+// copies of the 'buffer' package in use. This method works even for Buffer
+// instances that were created from another copy of the `buffer` package.
+// See: https://github.com/feross/buffer/issues/154
+Buffer.prototype._isBuffer = true
+
+function swap (b, n, m) {
+ var i = b[n]
+ b[n] = b[m]
+ b[m] = i
+}
+
+Buffer.prototype.swap16 = function swap16 () {
+ var len = this.length
+ if (len % 2 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 16-bits')
+ }
+ for (var i = 0; i < len; i += 2) {
+ swap(this, i, i + 1)
+ }
+ return this
+}
+
+Buffer.prototype.swap32 = function swap32 () {
+ var len = this.length
+ if (len % 4 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 32-bits')
+ }
+ for (var i = 0; i < len; i += 4) {
+ swap(this, i, i + 3)
+ swap(this, i + 1, i + 2)
+ }
+ return this
+}
+
+Buffer.prototype.swap64 = function swap64 () {
+ var len = this.length
+ if (len % 8 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 64-bits')
+ }
+ for (var i = 0; i < len; i += 8) {
+ swap(this, i, i + 7)
+ swap(this, i + 1, i + 6)
+ swap(this, i + 2, i + 5)
+ swap(this, i + 3, i + 4)
+ }
+ return this
+}
+
+Buffer.prototype.toString = function toString () {
+ var length = this.length
+ if (length === 0) return ''
+ if (arguments.length === 0) return utf8Slice(this, 0, length)
+ return slowToString.apply(this, arguments)
+}
+
+Buffer.prototype.toLocaleString = Buffer.prototype.toString
+
+Buffer.prototype.equals = function equals (b) {
+ if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
+ if (this === b) return true
+ return Buffer.compare(this, b) === 0
+}
+
+Buffer.prototype.inspect = function inspect () {
+ var str = ''
+ var max = exports.INSPECT_MAX_BYTES
+ str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
+ if (this.length > max) str += ' ... '
+ return ''
+}
+
+Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
+ if (isInstance(target, Uint8Array)) {
+ target = Buffer.from(target, target.offset, target.byteLength)
+ }
+ if (!Buffer.isBuffer(target)) {
+ throw new TypeError(
+ 'The "target" argument must be one of type Buffer or Uint8Array. ' +
+ 'Received type ' + (typeof target)
+ )
+ }
+
+ if (start === undefined) {
+ start = 0
+ }
+ if (end === undefined) {
+ end = target ? target.length : 0
+ }
+ if (thisStart === undefined) {
+ thisStart = 0
+ }
+ if (thisEnd === undefined) {
+ thisEnd = this.length
+ }
+
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
+ throw new RangeError('out of range index')
+ }
+
+ if (thisStart >= thisEnd && start >= end) {
+ return 0
+ }
+ if (thisStart >= thisEnd) {
+ return -1
+ }
+ if (start >= end) {
+ return 1
+ }
+
+ start >>>= 0
+ end >>>= 0
+ thisStart >>>= 0
+ thisEnd >>>= 0
+
+ if (this === target) return 0
+
+ var x = thisEnd - thisStart
+ var y = end - start
+ var len = Math.min(x, y)
+
+ var thisCopy = this.slice(thisStart, thisEnd)
+ var targetCopy = target.slice(start, end)
+
+ for (var i = 0; i < len; ++i) {
+ if (thisCopy[i] !== targetCopy[i]) {
+ x = thisCopy[i]
+ y = targetCopy[i]
+ break
+ }
+ }
+
+ if (x < y) return -1
+ if (y < x) return 1
+ return 0
+}
+
+// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
+// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
+//
+// Arguments:
+// - buffer - a Buffer to search
+// - val - a string, Buffer, or number
+// - byteOffset - an index into `buffer`; will be clamped to an int32
+// - encoding - an optional encoding, relevant is val is a string
+// - dir - true for indexOf, false for lastIndexOf
+function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
+ // Empty buffer means no match
+ if (buffer.length === 0) return -1
+
+ // Normalize byteOffset
+ if (typeof byteOffset === 'string') {
+ encoding = byteOffset
+ byteOffset = 0
+ } else if (byteOffset > 0x7fffffff) {
+ byteOffset = 0x7fffffff
+ } else if (byteOffset < -0x80000000) {
+ byteOffset = -0x80000000
+ }
+ byteOffset = +byteOffset // Coerce to Number.
+ if (numberIsNaN(byteOffset)) {
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
+ byteOffset = dir ? 0 : (buffer.length - 1)
+ }
+
+ // Normalize byteOffset: negative offsets start from the end of the buffer
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset
+ if (byteOffset >= buffer.length) {
+ if (dir) return -1
+ else byteOffset = buffer.length - 1
+ } else if (byteOffset < 0) {
+ if (dir) byteOffset = 0
+ else return -1
+ }
+
+ // Normalize val
+ if (typeof val === 'string') {
+ val = Buffer.from(val, encoding)
+ }
+
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
+ if (Buffer.isBuffer(val)) {
+ // Special case: looking for empty string/buffer always fails
+ if (val.length === 0) {
+ return -1
+ }
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
+ } else if (typeof val === 'number') {
+ val = val & 0xFF // Search for a byte value [0-255]
+ if (typeof Uint8Array.prototype.indexOf === 'function') {
+ if (dir) {
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
+ } else {
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
+ }
+ }
+ return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
+ }
+
+ throw new TypeError('val must be string, number or Buffer')
+}
+
+function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
+ var indexSize = 1
+ var arrLength = arr.length
+ var valLength = val.length
+
+ if (encoding !== undefined) {
+ encoding = String(encoding).toLowerCase()
+ if (encoding === 'ucs2' || encoding === 'ucs-2' ||
+ encoding === 'utf16le' || encoding === 'utf-16le') {
+ if (arr.length < 2 || val.length < 2) {
+ return -1
+ }
+ indexSize = 2
+ arrLength /= 2
+ valLength /= 2
+ byteOffset /= 2
+ }
+ }
+
+ function read (buf, i) {
+ if (indexSize === 1) {
+ return buf[i]
+ } else {
+ return buf.readUInt16BE(i * indexSize)
+ }
+ }
+
+ var i
+ if (dir) {
+ var foundIndex = -1
+ for (i = byteOffset; i < arrLength; i++) {
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
+ if (foundIndex === -1) foundIndex = i
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
+ } else {
+ if (foundIndex !== -1) i -= i - foundIndex
+ foundIndex = -1
+ }
+ }
+ } else {
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
+ for (i = byteOffset; i >= 0; i--) {
+ var found = true
+ for (var j = 0; j < valLength; j++) {
+ if (read(arr, i + j) !== read(val, j)) {
+ found = false
+ break
+ }
+ }
+ if (found) return i
+ }
+ }
+
+ return -1
+}
+
+Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
+ return this.indexOf(val, byteOffset, encoding) !== -1
+}
+
+Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
+}
+
+Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
+}
+
+function hexWrite (buf, string, offset, length) {
+ offset = Number(offset) || 0
+ var remaining = buf.length - offset
+ if (!length) {
+ length = remaining
+ } else {
+ length = Number(length)
+ if (length > remaining) {
+ length = remaining
+ }
+ }
+
+ var strLen = string.length
+
+ if (length > strLen / 2) {
+ length = strLen / 2
+ }
+ for (var i = 0; i < length; ++i) {
+ var parsed = parseInt(string.substr(i * 2, 2), 16)
+ if (numberIsNaN(parsed)) return i
+ buf[offset + i] = parsed
+ }
+ return i
+}
+
+function utf8Write (buf, string, offset, length) {
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
+}
+
+function asciiWrite (buf, string, offset, length) {
+ return blitBuffer(asciiToBytes(string), buf, offset, length)
+}
+
+function latin1Write (buf, string, offset, length) {
+ return asciiWrite(buf, string, offset, length)
+}
+
+function base64Write (buf, string, offset, length) {
+ return blitBuffer(base64ToBytes(string), buf, offset, length)
+}
+
+function ucs2Write (buf, string, offset, length) {
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
+}
+
+Buffer.prototype.write = function write (string, offset, length, encoding) {
+ // Buffer#write(string)
+ if (offset === undefined) {
+ encoding = 'utf8'
+ length = this.length
+ offset = 0
+ // Buffer#write(string, encoding)
+ } else if (length === undefined && typeof offset === 'string') {
+ encoding = offset
+ length = this.length
+ offset = 0
+ // Buffer#write(string, offset[, length][, encoding])
+ } else if (isFinite(offset)) {
+ offset = offset >>> 0
+ if (isFinite(length)) {
+ length = length >>> 0
+ if (encoding === undefined) encoding = 'utf8'
+ } else {
+ encoding = length
+ length = undefined
+ }
+ } else {
+ throw new Error(
+ 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
+ )
+ }
+
+ var remaining = this.length - offset
+ if (length === undefined || length > remaining) length = remaining
+
+ if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
+ throw new RangeError('Attempt to write outside buffer bounds')
+ }
+
+ if (!encoding) encoding = 'utf8'
+
+ var loweredCase = false
+ for (;;) {
+ switch (encoding) {
+ case 'hex':
+ return hexWrite(this, string, offset, length)
+
+ case 'utf8':
+ case 'utf-8':
+ return utf8Write(this, string, offset, length)
+
+ case 'ascii':
+ return asciiWrite(this, string, offset, length)
+
+ case 'latin1':
+ case 'binary':
+ return latin1Write(this, string, offset, length)
+
+ case 'base64':
+ // Warning: maxLength not taken into account in base64Write
+ return base64Write(this, string, offset, length)
+
+ case 'ucs2':
+ case 'ucs-2':
+ case 'utf16le':
+ case 'utf-16le':
+ return ucs2Write(this, string, offset, length)
+
+ default:
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
+ encoding = ('' + encoding).toLowerCase()
+ loweredCase = true
+ }
+ }
+}
+
+Buffer.prototype.toJSON = function toJSON () {
+ return {
+ type: 'Buffer',
+ data: Array.prototype.slice.call(this._arr || this, 0)
+ }
+}
+
+function base64Slice (buf, start, end) {
+ if (start === 0 && end === buf.length) {
+ return base64.fromByteArray(buf)
+ } else {
+ return base64.fromByteArray(buf.slice(start, end))
+ }
+}
+
+function utf8Slice (buf, start, end) {
+ end = Math.min(buf.length, end)
+ var res = []
+
+ var i = start
+ while (i < end) {
+ var firstByte = buf[i]
+ var codePoint = null
+ var bytesPerSequence = (firstByte > 0xEF) ? 4
+ : (firstByte > 0xDF) ? 3
+ : (firstByte > 0xBF) ? 2
+ : 1
+
+ if (i + bytesPerSequence <= end) {
+ var secondByte, thirdByte, fourthByte, tempCodePoint
+
+ switch (bytesPerSequence) {
+ case 1:
+ if (firstByte < 0x80) {
+ codePoint = firstByte
+ }
+ break
+ case 2:
+ secondByte = buf[i + 1]
+ if ((secondByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
+ if (tempCodePoint > 0x7F) {
+ codePoint = tempCodePoint
+ }
+ }
+ break
+ case 3:
+ secondByte = buf[i + 1]
+ thirdByte = buf[i + 2]
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
+ if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
+ codePoint = tempCodePoint
+ }
+ }
+ break
+ case 4:
+ secondByte = buf[i + 1]
+ thirdByte = buf[i + 2]
+ fourthByte = buf[i + 3]
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
+ tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
+ if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
+ codePoint = tempCodePoint
+ }
+ }
+ }
+ }
+
+ if (codePoint === null) {
+ // we did not generate a valid codePoint so insert a
+ // replacement char (U+FFFD) and advance only 1 byte
+ codePoint = 0xFFFD
+ bytesPerSequence = 1
+ } else if (codePoint > 0xFFFF) {
+ // encode to utf16 (surrogate pair dance)
+ codePoint -= 0x10000
+ res.push(codePoint >>> 10 & 0x3FF | 0xD800)
+ codePoint = 0xDC00 | codePoint & 0x3FF
+ }
+
+ res.push(codePoint)
+ i += bytesPerSequence
+ }
+
+ return decodeCodePointsArray(res)
+}
+
+// Based on http://stackoverflow.com/a/22747272/680742, the browser with
+// the lowest limit is Chrome, with 0x10000 args.
+// We go 1 magnitude less, for safety
+var MAX_ARGUMENTS_LENGTH = 0x1000
+
+function decodeCodePointsArray (codePoints) {
+ var len = codePoints.length
+ if (len <= MAX_ARGUMENTS_LENGTH) {
+ return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
+ }
+
+ // Decode in chunks to avoid "call stack size exceeded".
+ var res = ''
+ var i = 0
+ while (i < len) {
+ res += String.fromCharCode.apply(
+ String,
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
+ )
+ }
+ return res
+}
+
+function asciiSlice (buf, start, end) {
+ var ret = ''
+ end = Math.min(buf.length, end)
+
+ for (var i = start; i < end; ++i) {
+ ret += String.fromCharCode(buf[i] & 0x7F)
+ }
+ return ret
+}
+
+function latin1Slice (buf, start, end) {
+ var ret = ''
+ end = Math.min(buf.length, end)
+
+ for (var i = start; i < end; ++i) {
+ ret += String.fromCharCode(buf[i])
+ }
+ return ret
+}
+
+function hexSlice (buf, start, end) {
+ var len = buf.length
+
+ if (!start || start < 0) start = 0
+ if (!end || end < 0 || end > len) end = len
+
+ var out = ''
+ for (var i = start; i < end; ++i) {
+ out += toHex(buf[i])
+ }
+ return out
+}
+
+function utf16leSlice (buf, start, end) {
+ var bytes = buf.slice(start, end)
+ var res = ''
+ for (var i = 0; i < bytes.length; i += 2) {
+ res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
+ }
+ return res
+}
+
+Buffer.prototype.slice = function slice (start, end) {
+ var len = this.length
+ start = ~~start
+ end = end === undefined ? len : ~~end
+
+ if (start < 0) {
+ start += len
+ if (start < 0) start = 0
+ } else if (start > len) {
+ start = len
+ }
+
+ if (end < 0) {
+ end += len
+ if (end < 0) end = 0
+ } else if (end > len) {
+ end = len
+ }
+
+ if (end < start) end = start
+
+ var newBuf = this.subarray(start, end)
+ // Return an augmented `Uint8Array` instance
+ newBuf.__proto__ = Buffer.prototype
+ return newBuf
+}
+
+/*
+ * Need to make sure that buffer isn't trying to write out of bounds.
+ */
+function checkOffset (offset, ext, length) {
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
+}
+
+Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var val = this[offset]
+ var mul = 1
+ var i = 0
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += this[offset + i] * mul
+ }
+
+ return val
+}
+
+Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) {
+ checkOffset(offset, byteLength, this.length)
+ }
+
+ var val = this[offset + --byteLength]
+ var mul = 1
+ while (byteLength > 0 && (mul *= 0x100)) {
+ val += this[offset + --byteLength] * mul
+ }
+
+ return val
+}
+
+Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 1, this.length)
+ return this[offset]
+}
+
+Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ return this[offset] | (this[offset + 1] << 8)
+}
+
+Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ return (this[offset] << 8) | this[offset + 1]
+}
+
+Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return ((this[offset]) |
+ (this[offset + 1] << 8) |
+ (this[offset + 2] << 16)) +
+ (this[offset + 3] * 0x1000000)
+}
+
+Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset] * 0x1000000) +
+ ((this[offset + 1] << 16) |
+ (this[offset + 2] << 8) |
+ this[offset + 3])
+}
+
+Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var val = this[offset]
+ var mul = 1
+ var i = 0
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += this[offset + i] * mul
+ }
+ mul *= 0x80
+
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
+
+ return val
+}
+
+Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) checkOffset(offset, byteLength, this.length)
+
+ var i = byteLength
+ var mul = 1
+ var val = this[offset + --i]
+ while (i > 0 && (mul *= 0x100)) {
+ val += this[offset + --i] * mul
+ }
+ mul *= 0x80
+
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength)
+
+ return val
+}
+
+Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 1, this.length)
+ if (!(this[offset] & 0x80)) return (this[offset])
+ return ((0xff - this[offset] + 1) * -1)
+}
+
+Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ var val = this[offset] | (this[offset + 1] << 8)
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
+}
+
+Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 2, this.length)
+ var val = this[offset + 1] | (this[offset] << 8)
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
+}
+
+Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset]) |
+ (this[offset + 1] << 8) |
+ (this[offset + 2] << 16) |
+ (this[offset + 3] << 24)
+}
+
+Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+
+ return (this[offset] << 24) |
+ (this[offset + 1] << 16) |
+ (this[offset + 2] << 8) |
+ (this[offset + 3])
+}
+
+Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+ return ieee754.read(this, offset, true, 23, 4)
+}
+
+Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 4, this.length)
+ return ieee754.read(this, offset, false, 23, 4)
+}
+
+Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 8, this.length)
+ return ieee754.read(this, offset, true, 52, 8)
+}
+
+Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
+ offset = offset >>> 0
+ if (!noAssert) checkOffset(offset, 8, this.length)
+ return ieee754.read(this, offset, false, 52, 8)
+}
+
+function checkInt (buf, value, offset, ext, max, min) {
+ if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
+}
+
+Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) {
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1
+ checkInt(this, value, offset, byteLength, maxBytes, 0)
+ }
+
+ var mul = 1
+ var i = 0
+ this[offset] = value & 0xFF
+ while (++i < byteLength && (mul *= 0x100)) {
+ this[offset + i] = (value / mul) & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ byteLength = byteLength >>> 0
+ if (!noAssert) {
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1
+ checkInt(this, value, offset, byteLength, maxBytes, 0)
+ }
+
+ var i = byteLength - 1
+ var mul = 1
+ this[offset + i] = value & 0xFF
+ while (--i >= 0 && (mul *= 0x100)) {
+ this[offset + i] = (value / mul) & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
+ this[offset] = (value & 0xff)
+ return offset + 1
+}
+
+Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ return offset + 2
+}
+
+Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
+ this[offset] = (value >>> 8)
+ this[offset + 1] = (value & 0xff)
+ return offset + 2
+}
+
+Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
+ this[offset + 3] = (value >>> 24)
+ this[offset + 2] = (value >>> 16)
+ this[offset + 1] = (value >>> 8)
+ this[offset] = (value & 0xff)
+ return offset + 4
+}
+
+Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
+ this[offset] = (value >>> 24)
+ this[offset + 1] = (value >>> 16)
+ this[offset + 2] = (value >>> 8)
+ this[offset + 3] = (value & 0xff)
+ return offset + 4
+}
+
+Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ var limit = Math.pow(2, (8 * byteLength) - 1)
+
+ checkInt(this, value, offset, byteLength, limit - 1, -limit)
+ }
+
+ var i = 0
+ var mul = 1
+ var sub = 0
+ this[offset] = value & 0xFF
+ while (++i < byteLength && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
+ sub = 1
+ }
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ var limit = Math.pow(2, (8 * byteLength) - 1)
+
+ checkInt(this, value, offset, byteLength, limit - 1, -limit)
+ }
+
+ var i = byteLength - 1
+ var mul = 1
+ var sub = 0
+ this[offset + i] = value & 0xFF
+ while (--i >= 0 && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
+ sub = 1
+ }
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
+ }
+
+ return offset + byteLength
+}
+
+Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
+ if (value < 0) value = 0xff + value + 1
+ this[offset] = (value & 0xff)
+ return offset + 1
+}
+
+Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ return offset + 2
+}
+
+Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
+ this[offset] = (value >>> 8)
+ this[offset + 1] = (value & 0xff)
+ return offset + 2
+}
+
+Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
+ this[offset] = (value & 0xff)
+ this[offset + 1] = (value >>> 8)
+ this[offset + 2] = (value >>> 16)
+ this[offset + 3] = (value >>> 24)
+ return offset + 4
+}
+
+Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
+ if (value < 0) value = 0xffffffff + value + 1
+ this[offset] = (value >>> 24)
+ this[offset + 1] = (value >>> 16)
+ this[offset + 2] = (value >>> 8)
+ this[offset + 3] = (value & 0xff)
+ return offset + 4
+}
+
+function checkIEEE754 (buf, value, offset, ext, max, min) {
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
+ if (offset < 0) throw new RangeError('Index out of range')
+}
+
+function writeFloat (buf, value, offset, littleEndian, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
+ }
+ ieee754.write(buf, value, offset, littleEndian, 23, 4)
+ return offset + 4
+}
+
+Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
+ return writeFloat(this, value, offset, true, noAssert)
+}
+
+Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
+ return writeFloat(this, value, offset, false, noAssert)
+}
+
+function writeDouble (buf, value, offset, littleEndian, noAssert) {
+ value = +value
+ offset = offset >>> 0
+ if (!noAssert) {
+ checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
+ }
+ ieee754.write(buf, value, offset, littleEndian, 52, 8)
+ return offset + 8
+}
+
+Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
+ return writeDouble(this, value, offset, true, noAssert)
+}
+
+Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
+ return writeDouble(this, value, offset, false, noAssert)
+}
+
+// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
+Buffer.prototype.copy = function copy (target, targetStart, start, end) {
+ if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
+ if (!start) start = 0
+ if (!end && end !== 0) end = this.length
+ if (targetStart >= target.length) targetStart = target.length
+ if (!targetStart) targetStart = 0
+ if (end > 0 && end < start) end = start
+
+ // Copy 0 bytes; we're done
+ if (end === start) return 0
+ if (target.length === 0 || this.length === 0) return 0
+
+ // Fatal error conditions
+ if (targetStart < 0) {
+ throw new RangeError('targetStart out of bounds')
+ }
+ if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
+
+ // Are we oob?
+ if (end > this.length) end = this.length
+ if (target.length - targetStart < end - start) {
+ end = target.length - targetStart + start
+ }
+
+ var len = end - start
+
+ if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
+ // Use built-in when available, missing from IE11
+ this.copyWithin(targetStart, start, end)
+ } else if (this === target && start < targetStart && targetStart < end) {
+ // descending copy from end
+ for (var i = len - 1; i >= 0; --i) {
+ target[i + targetStart] = this[i + start]
+ }
+ } else {
+ Uint8Array.prototype.set.call(
+ target,
+ this.subarray(start, end),
+ targetStart
+ )
+ }
+
+ return len
+}
+
+// Usage:
+// buffer.fill(number[, offset[, end]])
+// buffer.fill(buffer[, offset[, end]])
+// buffer.fill(string[, offset[, end]][, encoding])
+Buffer.prototype.fill = function fill (val, start, end, encoding) {
+ // Handle string cases:
+ if (typeof val === 'string') {
+ if (typeof start === 'string') {
+ encoding = start
+ start = 0
+ end = this.length
+ } else if (typeof end === 'string') {
+ encoding = end
+ end = this.length
+ }
+ if (encoding !== undefined && typeof encoding !== 'string') {
+ throw new TypeError('encoding must be a string')
+ }
+ if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
+ throw new TypeError('Unknown encoding: ' + encoding)
+ }
+ if (val.length === 1) {
+ var code = val.charCodeAt(0)
+ if ((encoding === 'utf8' && code < 128) ||
+ encoding === 'latin1') {
+ // Fast path: If `val` fits into a single byte, use that numeric value.
+ val = code
+ }
+ }
+ } else if (typeof val === 'number') {
+ val = val & 255
+ }
+
+ // Invalid ranges are not set to a default, so can range check early.
+ if (start < 0 || this.length < start || this.length < end) {
+ throw new RangeError('Out of range index')
+ }
+
+ if (end <= start) {
+ return this
+ }
+
+ start = start >>> 0
+ end = end === undefined ? this.length : end >>> 0
+
+ if (!val) val = 0
+
+ var i
+ if (typeof val === 'number') {
+ for (i = start; i < end; ++i) {
+ this[i] = val
+ }
+ } else {
+ var bytes = Buffer.isBuffer(val)
+ ? val
+ : Buffer.from(val, encoding)
+ var len = bytes.length
+ if (len === 0) {
+ throw new TypeError('The value "' + val +
+ '" is invalid for argument "value"')
+ }
+ for (i = 0; i < end - start; ++i) {
+ this[i + start] = bytes[i % len]
+ }
+ }
+
+ return this
+}
+
+// HELPER FUNCTIONS
+// ================
+
+var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
+
+function base64clean (str) {
+ // Node takes equal signs as end of the Base64 encoding
+ str = str.split('=')[0]
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
+ str = str.trim().replace(INVALID_BASE64_RE, '')
+ // Node converts strings with length < 2 to ''
+ if (str.length < 2) return ''
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
+ while (str.length % 4 !== 0) {
+ str = str + '='
+ }
+ return str
+}
+
+function toHex (n) {
+ if (n < 16) return '0' + n.toString(16)
+ return n.toString(16)
+}
+
+function utf8ToBytes (string, units) {
+ units = units || Infinity
+ var codePoint
+ var length = string.length
+ var leadSurrogate = null
+ var bytes = []
+
+ for (var i = 0; i < length; ++i) {
+ codePoint = string.charCodeAt(i)
+
+ // is surrogate component
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
+ // last char was a lead
+ if (!leadSurrogate) {
+ // no lead yet
+ if (codePoint > 0xDBFF) {
+ // unexpected trail
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ } else if (i + 1 === length) {
+ // unpaired lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ continue
+ }
+
+ // valid lead
+ leadSurrogate = codePoint
+
+ continue
+ }
+
+ // 2 leads in a row
+ if (codePoint < 0xDC00) {
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ leadSurrogate = codePoint
+ continue
+ }
+
+ // valid surrogate pair
+ codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
+ } else if (leadSurrogate) {
+ // valid bmp char, but last char was a lead
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
+ }
+
+ leadSurrogate = null
+
+ // encode utf8
+ if (codePoint < 0x80) {
+ if ((units -= 1) < 0) break
+ bytes.push(codePoint)
+ } else if (codePoint < 0x800) {
+ if ((units -= 2) < 0) break
+ bytes.push(
+ codePoint >> 0x6 | 0xC0,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x10000) {
+ if ((units -= 3) < 0) break
+ bytes.push(
+ codePoint >> 0xC | 0xE0,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else if (codePoint < 0x110000) {
+ if ((units -= 4) < 0) break
+ bytes.push(
+ codePoint >> 0x12 | 0xF0,
+ codePoint >> 0xC & 0x3F | 0x80,
+ codePoint >> 0x6 & 0x3F | 0x80,
+ codePoint & 0x3F | 0x80
+ )
+ } else {
+ throw new Error('Invalid code point')
+ }
+ }
+
+ return bytes
+}
+
+function asciiToBytes (str) {
+ var byteArray = []
+ for (var i = 0; i < str.length; ++i) {
+ // Node's code seems to be doing this and not & 0x7F..
+ byteArray.push(str.charCodeAt(i) & 0xFF)
+ }
+ return byteArray
+}
+
+function utf16leToBytes (str, units) {
+ var c, hi, lo
+ var byteArray = []
+ for (var i = 0; i < str.length; ++i) {
+ if ((units -= 2) < 0) break
+
+ c = str.charCodeAt(i)
+ hi = c >> 8
+ lo = c % 256
+ byteArray.push(lo)
+ byteArray.push(hi)
+ }
+
+ return byteArray
+}
+
+function base64ToBytes (str) {
+ return base64.toByteArray(base64clean(str))
+}
+
+function blitBuffer (src, dst, offset, length) {
+ for (var i = 0; i < length; ++i) {
+ if ((i + offset >= dst.length) || (i >= src.length)) break
+ dst[i + offset] = src[i]
+ }
+ return i
+}
+
+// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
+// the `instanceof` check but they should be treated as of that type.
+// See: https://github.com/feross/buffer/issues/166
+function isInstance (obj, type) {
+ return obj instanceof type ||
+ (obj != null && obj.constructor != null && obj.constructor.name != null &&
+ obj.constructor.name === type.name)
+}
+function numberIsNaN (obj) {
+ // For IE11 support
+ return obj !== obj // eslint-disable-line no-self-compare
+}
+
+}).call(this,require("buffer").Buffer)
+},{"base64-js":62,"buffer":113,"ieee754":827}],114:[function(require,module,exports){
+module.exports = {
+ "100": "Continue",
+ "101": "Switching Protocols",
+ "102": "Processing",
+ "200": "OK",
+ "201": "Created",
+ "202": "Accepted",
+ "203": "Non-Authoritative Information",
+ "204": "No Content",
+ "205": "Reset Content",
+ "206": "Partial Content",
+ "207": "Multi-Status",
+ "208": "Already Reported",
+ "226": "IM Used",
+ "300": "Multiple Choices",
+ "301": "Moved Permanently",
+ "302": "Found",
+ "303": "See Other",
+ "304": "Not Modified",
+ "305": "Use Proxy",
+ "307": "Temporary Redirect",
+ "308": "Permanent Redirect",
+ "400": "Bad Request",
+ "401": "Unauthorized",
+ "402": "Payment Required",
+ "403": "Forbidden",
+ "404": "Not Found",
+ "405": "Method Not Allowed",
+ "406": "Not Acceptable",
+ "407": "Proxy Authentication Required",
+ "408": "Request Timeout",
+ "409": "Conflict",
+ "410": "Gone",
+ "411": "Length Required",
+ "412": "Precondition Failed",
+ "413": "Payload Too Large",
+ "414": "URI Too Long",
+ "415": "Unsupported Media Type",
+ "416": "Range Not Satisfiable",
+ "417": "Expectation Failed",
+ "418": "I'm a teapot",
+ "421": "Misdirected Request",
+ "422": "Unprocessable Entity",
+ "423": "Locked",
+ "424": "Failed Dependency",
+ "425": "Unordered Collection",
+ "426": "Upgrade Required",
+ "428": "Precondition Required",
+ "429": "Too Many Requests",
+ "431": "Request Header Fields Too Large",
+ "451": "Unavailable For Legal Reasons",
+ "500": "Internal Server Error",
+ "501": "Not Implemented",
+ "502": "Bad Gateway",
+ "503": "Service Unavailable",
+ "504": "Gateway Timeout",
+ "505": "HTTP Version Not Supported",
+ "506": "Variant Also Negotiates",
+ "507": "Insufficient Storage",
+ "508": "Loop Detected",
+ "509": "Bandwidth Limit Exceeded",
+ "510": "Not Extended",
+ "511": "Network Authentication Required"
+}
+
+},{}],115:[function(require,module,exports){
+var upperCase = require('upper-case')
+var noCase = require('no-case')
+
+/**
+ * Camel case a string.
+ *
+ * @param {string} value
+ * @param {string} [locale]
+ * @return {string}
+ */
+module.exports = function (value, locale, mergeNumbers) {
+ var result = noCase(value, locale)
+
+ // Replace periods between numeric entities with an underscore.
+ if (!mergeNumbers) {
+ result = result.replace(/ (?=\d)/g, '_')
+ }
+
+ // Replace spaces between words with an upper cased character.
+ return result.replace(/ (.)/g, function (m, $1) {
+ return upperCase($1, locale)
+ })
+}
+
+},{"no-case":967,"upper-case":1430}],116:[function(require,module,exports){
+function Caseless (dict) {
+ this.dict = dict || {}
+}
+Caseless.prototype.set = function (name, value, clobber) {
+ if (typeof name === 'object') {
+ for (var i in name) {
+ this.set(i, name[i], value)
+ }
+ } else {
+ if (typeof clobber === 'undefined') clobber = true
+ var has = this.has(name)
+
+ if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value
+ else this.dict[has || name] = value
+ return has
+ }
+}
+Caseless.prototype.has = function (name) {
+ var keys = Object.keys(this.dict)
+ , name = name.toLowerCase()
+ ;
+ for (var i=0;i 0;
+}
+
+function Chalk(options) {
+ // We check for this.template here since calling `chalk.constructor()`
+ // by itself will have a `this` of a previously constructed chalk object
+ if (!this || !(this instanceof Chalk) || this.template) {
+ const chalk = {};
+ applyOptions(chalk, options);
+
+ chalk.template = function () {
+ const args = [].slice.call(arguments);
+ return chalkTag.apply(null, [chalk.template].concat(args));
+ };
+
+ Object.setPrototypeOf(chalk, Chalk.prototype);
+ Object.setPrototypeOf(chalk.template, chalk);
+
+ chalk.template.constructor = Chalk;
+
+ return chalk.template;
+ }
+
+ applyOptions(this, options);
+}
+
+// Use bright blue on Windows as the normal blue color is illegible
+if (isSimpleWindowsTerm) {
+ ansiStyles.blue.open = '\u001B[94m';
+}
+
+for (const key of Object.keys(ansiStyles)) {
+ ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
+
+ styles[key] = {
+ get() {
+ const codes = ansiStyles[key];
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
+ }
+ };
+}
+
+styles.visible = {
+ get() {
+ return build.call(this, this._styles || [], true, 'visible');
+ }
+};
+
+ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
+for (const model of Object.keys(ansiStyles.color.ansi)) {
+ if (skipModels.has(model)) {
+ continue;
+ }
+
+ styles[model] = {
+ get() {
+ const level = this.level;
+ return function () {
+ const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
+ const codes = {
+ open,
+ close: ansiStyles.color.close,
+ closeRe: ansiStyles.color.closeRe
+ };
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ };
+ }
+ };
+}
+
+ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
+for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
+ if (skipModels.has(model)) {
+ continue;
+ }
+
+ const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
+ styles[bgModel] = {
+ get() {
+ const level = this.level;
+ return function () {
+ const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
+ const codes = {
+ open,
+ close: ansiStyles.bgColor.close,
+ closeRe: ansiStyles.bgColor.closeRe
+ };
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
+ };
+ }
+ };
+}
+
+const proto = Object.defineProperties(() => {}, styles);
+
+function build(_styles, _empty, key) {
+ const builder = function () {
+ return applyStyle.apply(builder, arguments);
+ };
+
+ builder._styles = _styles;
+ builder._empty = _empty;
+
+ const self = this;
+
+ Object.defineProperty(builder, 'level', {
+ enumerable: true,
+ get() {
+ return self.level;
+ },
+ set(level) {
+ self.level = level;
+ }
+ });
+
+ Object.defineProperty(builder, 'enabled', {
+ enumerable: true,
+ get() {
+ return self.enabled;
+ },
+ set(enabled) {
+ self.enabled = enabled;
+ }
+ });
+
+ // See below for fix regarding invisible grey/dim combination on Windows
+ builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
+
+ // `__proto__` is used because we must return a function, but there is
+ // no way to create a function with a different prototype
+ builder.__proto__ = proto; // eslint-disable-line no-proto
+
+ return builder;
+}
+
+function applyStyle() {
+ // Support varags, but simply cast to string in case there's only one arg
+ const args = arguments;
+ const argsLen = args.length;
+ let str = String(arguments[0]);
+
+ if (argsLen === 0) {
+ return '';
+ }
+
+ if (argsLen > 1) {
+ // Don't slice `arguments`, it prevents V8 optimizations
+ for (let a = 1; a < argsLen; a++) {
+ str += ' ' + args[a];
+ }
+ }
+
+ if (!this.enabled || this.level <= 0 || !str) {
+ return this._empty ? '' : str;
+ }
+
+ // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
+ // see https://github.com/chalk/chalk/issues/58
+ // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
+ const originalDim = ansiStyles.dim.open;
+ if (isSimpleWindowsTerm && this.hasGrey) {
+ ansiStyles.dim.open = '';
+ }
+
+ for (const code of this._styles.slice().reverse()) {
+ // Replace any instances already present with a re-opening code
+ // otherwise only the part of the string until said closing code
+ // will be colored, and the rest will simply be 'plain'.
+ str = code.open + str.replace(code.closeRe, code.open) + code.close;
+
+ // Close the styling before a linebreak and reopen
+ // after next line to fix a bleed issue on macOS
+ // https://github.com/chalk/chalk/pull/92
+ str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
+ }
+
+ // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
+ ansiStyles.dim.open = originalDim;
+
+ return str;
+}
+
+function chalkTag(chalk, strings) {
+ if (!Array.isArray(strings)) {
+ // If chalk() was called by itself or with a string,
+ // return the string itself as a string.
+ return [].slice.call(arguments, 1).join(' ');
+ }
+
+ const args = [].slice.call(arguments, 2);
+ const parts = [strings.raw[0]];
+
+ for (let i = 1; i < strings.length; i++) {
+ parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
+ parts.push(String(strings.raw[i]));
+ }
+
+ return template(chalk, parts.join(''));
+}
+
+Object.defineProperties(Chalk.prototype, styles);
+
+module.exports = Chalk(); // eslint-disable-line new-cap
+module.exports.supportsColor = stdoutColor;
+module.exports.default = module.exports; // For TypeScript
+
+}).call(this,require('_process'))
+},{"./templates.js":118,"_process":109,"ansi-styles":9,"escape-string-regexp":578,"supports-color":1407}],118:[function(require,module,exports){
+'use strict';
+const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
+const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
+const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
+const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
+
+const ESCAPES = new Map([
+ ['n', '\n'],
+ ['r', '\r'],
+ ['t', '\t'],
+ ['b', '\b'],
+ ['f', '\f'],
+ ['v', '\v'],
+ ['0', '\0'],
+ ['\\', '\\'],
+ ['e', '\u001B'],
+ ['a', '\u0007']
+]);
+
+function unescape(c) {
+ if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
+ return String.fromCharCode(parseInt(c.slice(1), 16));
+ }
+
+ return ESCAPES.get(c) || c;
+}
+
+function parseArguments(name, args) {
+ const results = [];
+ const chunks = args.trim().split(/\s*,\s*/g);
+ let matches;
+
+ for (const chunk of chunks) {
+ if (!isNaN(chunk)) {
+ results.push(Number(chunk));
+ } else if ((matches = chunk.match(STRING_REGEX))) {
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
+ } else {
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
+ }
+ }
+
+ return results;
+}
+
+function parseStyle(style) {
+ STYLE_REGEX.lastIndex = 0;
+
+ const results = [];
+ let matches;
+
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
+ const name = matches[1];
+
+ if (matches[2]) {
+ const args = parseArguments(name, matches[2]);
+ results.push([name].concat(args));
+ } else {
+ results.push([name]);
+ }
+ }
+
+ return results;
+}
+
+function buildStyle(chalk, styles) {
+ const enabled = {};
+
+ for (const layer of styles) {
+ for (const style of layer.styles) {
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
+ }
+ }
+
+ let current = chalk;
+ for (const styleName of Object.keys(enabled)) {
+ if (Array.isArray(enabled[styleName])) {
+ if (!(styleName in current)) {
+ throw new Error(`Unknown Chalk style: ${styleName}`);
+ }
+
+ if (enabled[styleName].length > 0) {
+ current = current[styleName].apply(current, enabled[styleName]);
+ } else {
+ current = current[styleName];
+ }
+ }
+ }
+
+ return current;
+}
+
+module.exports = (chalk, tmp) => {
+ const styles = [];
+ const chunks = [];
+ let chunk = [];
+
+ // eslint-disable-next-line max-params
+ tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
+ if (escapeChar) {
+ chunk.push(unescape(escapeChar));
+ } else if (style) {
+ const str = chunk.join('');
+ chunk = [];
+ chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
+ styles.push({inverse, styles: parseStyle(style)});
+ } else if (close) {
+ if (styles.length === 0) {
+ throw new Error('Found extraneous } in Chalk template literal');
+ }
+
+ chunks.push(buildStyle(chalk, styles)(chunk.join('')));
+ chunk = [];
+ styles.pop();
+ } else {
+ chunk.push(chr);
+ }
+ });
+
+ chunks.push(chunk.join(''));
+
+ if (styles.length > 0) {
+ const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
+ throw new Error(errMsg);
+ }
+
+ return chunks.join('');
+};
+
+},{}],119:[function(require,module,exports){
+exports.no = exports.noCase = require('no-case')
+exports.dot = exports.dotCase = require('dot-case')
+exports.swap = exports.swapCase = require('swap-case')
+exports.path = exports.pathCase = require('path-case')
+exports.upper = exports.upperCase = require('upper-case')
+exports.lower = exports.lowerCase = require('lower-case')
+exports.camel = exports.camelCase = require('camel-case')
+exports.snake = exports.snakeCase = require('snake-case')
+exports.title = exports.titleCase = require('title-case')
+exports.param = exports.paramCase = require('param-case')
+exports.kebab = exports.kebabCase = exports.paramCase
+exports.hyphen = exports.hyphenCase = exports.paramCase
+exports.header = exports.headerCase = require('header-case')
+exports.pascal = exports.pascalCase = require('pascal-case')
+exports.constant = exports.constantCase = require('constant-case')
+exports.sentence = exports.sentenceCase = require('sentence-case')
+exports.isUpper = exports.isUpperCase = require('is-upper-case')
+exports.isLower = exports.isLowerCase = require('is-lower-case')
+exports.ucFirst = exports.upperCaseFirst = require('upper-case-first')
+exports.lcFirst = exports.lowerCaseFirst = require('lower-case-first')
+
+},{"camel-case":115,"constant-case":130,"dot-case":544,"header-case":815,"is-lower-case":848,"is-upper-case":851,"lower-case":933,"lower-case-first":932,"no-case":967,"param-case":1001,"pascal-case":1010,"path-case":1012,"sentence-case":1347,"snake-case":1362,"swap-case":1408,"title-case":1417,"upper-case":1430,"upper-case-first":1429}],120:[function(require,module,exports){
+var Buffer = require('safe-buffer').Buffer
+var Transform = require('stream').Transform
+var StringDecoder = require('string_decoder').StringDecoder
+var inherits = require('inherits')
+
+function CipherBase (hashMode) {
+ Transform.call(this)
+ this.hashMode = typeof hashMode === 'string'
+ if (this.hashMode) {
+ this[hashMode] = this._finalOrDigest
+ } else {
+ this.final = this._finalOrDigest
+ }
+ if (this._final) {
+ this.__final = this._final
+ this._final = null
+ }
+ this._decoder = null
+ this._encoding = null
+}
+inherits(CipherBase, Transform)
+
+CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
+ if (typeof data === 'string') {
+ data = Buffer.from(data, inputEnc)
+ }
+
+ var outData = this._update(data)
+ if (this.hashMode) return this
+
+ if (outputEnc) {
+ outData = this._toString(outData, outputEnc)
+ }
+
+ return outData
+}
+
+CipherBase.prototype.setAutoPadding = function () {}
+CipherBase.prototype.getAuthTag = function () {
+ throw new Error('trying to get auth tag in unsupported state')
+}
+
+CipherBase.prototype.setAuthTag = function () {
+ throw new Error('trying to set auth tag in unsupported state')
+}
+
+CipherBase.prototype.setAAD = function () {
+ throw new Error('trying to set aad in unsupported state')
+}
+
+CipherBase.prototype._transform = function (data, _, next) {
+ var err
+ try {
+ if (this.hashMode) {
+ this._update(data)
+ } else {
+ this.push(this._update(data))
+ }
+ } catch (e) {
+ err = e
+ } finally {
+ next(err)
+ }
+}
+CipherBase.prototype._flush = function (done) {
+ var err
+ try {
+ this.push(this.__final())
+ } catch (e) {
+ err = e
+ }
+
+ done(err)
+}
+CipherBase.prototype._finalOrDigest = function (outputEnc) {
+ var outData = this.__final() || Buffer.alloc(0)
+ if (outputEnc) {
+ outData = this._toString(outData, outputEnc, true)
+ }
+ return outData
+}
+
+CipherBase.prototype._toString = function (value, enc, fin) {
+ if (!this._decoder) {
+ this._decoder = new StringDecoder(enc)
+ this._encoding = enc
+ }
+
+ if (this._encoding !== enc) throw new Error('can\'t switch encodings')
+
+ var out = this._decoder.write(value)
+ if (fin) {
+ out += this._decoder.end()
+ }
+
+ return out
+}
+
+module.exports = CipherBase
+
+},{"inherits":834,"safe-buffer":1334,"stream":1394,"string_decoder":1404}],121:[function(require,module,exports){
+/*!
+Copyright (C) 2013 by WebReflection
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+var
+ // should be a not so common char
+ // possibly one JSON does not encode
+ // possibly one encodeURIComponent does not encode
+ // right now this char is '~' but this might change in the future
+ specialChar = '~',
+ safeSpecialChar = '\\x' + (
+ '0' + specialChar.charCodeAt(0).toString(16)
+ ).slice(-2),
+ escapedSafeSpecialChar = '\\' + safeSpecialChar,
+ specialCharRG = new RegExp(safeSpecialChar, 'g'),
+ safeSpecialCharRG = new RegExp(escapedSafeSpecialChar, 'g'),
+
+ safeStartWithSpecialCharRG = new RegExp('(?:^|([^\\\\]))' + escapedSafeSpecialChar),
+
+ indexOf = [].indexOf || function(v){
+ for(var i=this.length;i--&&this[i]!==v;);
+ return i;
+ },
+ $String = String // there's no way to drop warnings in JSHint
+ // about new String ... well, I need that here!
+ // faked, and happy linter!
+;
+
+function generateReplacer(value, replacer, resolve) {
+ var
+ path = [],
+ all = [value],
+ seen = [value],
+ mapp = [resolve ? specialChar : '[Circular]'],
+ last = value,
+ lvl = 1,
+ i
+ ;
+ return function(key, value) {
+ // the replacer has rights to decide
+ // if a new object should be returned
+ // or if there's some key to drop
+ // let's call it here rather than "too late"
+ if (replacer) value = replacer.call(this, key, value);
+
+ // did you know ? Safari passes keys as integers for arrays
+ // which means if (key) when key === 0 won't pass the check
+ if (key !== '') {
+ if (last !== this) {
+ i = lvl - indexOf.call(all, this) - 1;
+ lvl -= i;
+ all.splice(lvl, all.length);
+ path.splice(lvl - 1, path.length);
+ last = this;
+ }
+ // console.log(lvl, key, path);
+ if (typeof value === 'object' && value) {
+ // if object isn't referring to parent object, add to the
+ // object path stack. Otherwise it is already there.
+ if (indexOf.call(all, value) < 0) {
+ all.push(last = value);
+ }
+ lvl = all.length;
+ i = indexOf.call(seen, value);
+ if (i < 0) {
+ i = seen.push(value) - 1;
+ if (resolve) {
+ // key cannot contain specialChar but could be not a string
+ path.push(('' + key).replace(specialCharRG, safeSpecialChar));
+ mapp[i] = specialChar + path.join(specialChar);
+ } else {
+ mapp[i] = mapp[0];
+ }
+ } else {
+ value = mapp[i];
+ }
+ } else {
+ if (typeof value === 'string' && resolve) {
+ // ensure no special char involved on deserialization
+ // in this case only first char is important
+ // no need to replace all value (better performance)
+ value = value .replace(safeSpecialChar, escapedSafeSpecialChar)
+ .replace(specialChar, safeSpecialChar);
+ }
+ }
+ }
+ return value;
+ };
+}
+
+function retrieveFromPath(current, keys) {
+ for(var i = 0, length = keys.length; i < length; current = current[
+ // keys should be normalized back here
+ keys[i++].replace(safeSpecialCharRG, specialChar)
+ ]);
+ return current;
+}
+
+function generateReviver(reviver) {
+ return function(key, value) {
+ var isString = typeof value === 'string';
+ if (isString && value.charAt(0) === specialChar) {
+ return new $String(value.slice(1));
+ }
+ if (key === '') value = regenerate(value, value, {});
+ // again, only one needed, do not use the RegExp for this replacement
+ // only keys need the RegExp
+ if (isString) value = value .replace(safeStartWithSpecialCharRG, '$1' + specialChar)
+ .replace(escapedSafeSpecialChar, safeSpecialChar);
+ return reviver ? reviver.call(this, key, value) : value;
+ };
+}
+
+function regenerateArray(root, current, retrieve) {
+ for (var i = 0, length = current.length; i < length; i++) {
+ current[i] = regenerate(root, current[i], retrieve);
+ }
+ return current;
+}
+
+function regenerateObject(root, current, retrieve) {
+ for (var key in current) {
+ if (current.hasOwnProperty(key)) {
+ current[key] = regenerate(root, current[key], retrieve);
+ }
+ }
+ return current;
+}
+
+function regenerate(root, current, retrieve) {
+ return current instanceof Array ?
+ // fast Array reconstruction
+ regenerateArray(root, current, retrieve) :
+ (
+ current instanceof $String ?
+ (
+ // root is an empty string
+ current.length ?
+ (
+ retrieve.hasOwnProperty(current) ?
+ retrieve[current] :
+ retrieve[current] = retrieveFromPath(
+ root, current.split(specialChar)
+ )
+ ) :
+ root
+ ) :
+ (
+ current instanceof Object ?
+ // dedicated Object parser
+ regenerateObject(root, current, retrieve) :
+ // value as it is
+ current
+ )
+ )
+ ;
+}
+
+function stringifyRecursion(value, replacer, space, doNotResolve) {
+ return JSON.stringify(value, generateReplacer(value, replacer, !doNotResolve), space);
+}
+
+function parseRecursion(text, reviver) {
+ return JSON.parse(text, generateReviver(reviver));
+}
+this.stringify = stringifyRecursion;
+this.parse = parseRecursion;
+},{}],122:[function(require,module,exports){
+/* MIT license */
+var cssKeywords = require('color-name');
+
+// NOTE: conversions should only return primitive values (i.e. arrays, or
+// values that give correct `typeof` results).
+// do not use box values types (i.e. Number(), String(), etc.)
+
+var reverseKeywords = {};
+for (var key in cssKeywords) {
+ if (cssKeywords.hasOwnProperty(key)) {
+ reverseKeywords[cssKeywords[key]] = key;
+ }
+}
+
+var convert = module.exports = {
+ rgb: {channels: 3, labels: 'rgb'},
+ hsl: {channels: 3, labels: 'hsl'},
+ hsv: {channels: 3, labels: 'hsv'},
+ hwb: {channels: 3, labels: 'hwb'},
+ cmyk: {channels: 4, labels: 'cmyk'},
+ xyz: {channels: 3, labels: 'xyz'},
+ lab: {channels: 3, labels: 'lab'},
+ lch: {channels: 3, labels: 'lch'},
+ hex: {channels: 1, labels: ['hex']},
+ keyword: {channels: 1, labels: ['keyword']},
+ ansi16: {channels: 1, labels: ['ansi16']},
+ ansi256: {channels: 1, labels: ['ansi256']},
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
+ gray: {channels: 1, labels: ['gray']}
+};
+
+// hide .channels and .labels properties
+for (var model in convert) {
+ if (convert.hasOwnProperty(model)) {
+ if (!('channels' in convert[model])) {
+ throw new Error('missing channels property: ' + model);
+ }
+
+ if (!('labels' in convert[model])) {
+ throw new Error('missing channel labels property: ' + model);
+ }
+
+ if (convert[model].labels.length !== convert[model].channels) {
+ throw new Error('channel and label counts mismatch: ' + model);
+ }
+
+ var channels = convert[model].channels;
+ var labels = convert[model].labels;
+ delete convert[model].channels;
+ delete convert[model].labels;
+ Object.defineProperty(convert[model], 'channels', {value: channels});
+ Object.defineProperty(convert[model], 'labels', {value: labels});
+ }
+}
+
+convert.rgb.hsl = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var min = Math.min(r, g, b);
+ var max = Math.max(r, g, b);
+ var delta = max - min;
+ var h;
+ var s;
+ var l;
+
+ if (max === min) {
+ h = 0;
+ } else if (r === max) {
+ h = (g - b) / delta;
+ } else if (g === max) {
+ h = 2 + (b - r) / delta;
+ } else if (b === max) {
+ h = 4 + (r - g) / delta;
+ }
+
+ h = Math.min(h * 60, 360);
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ l = (min + max) / 2;
+
+ if (max === min) {
+ s = 0;
+ } else if (l <= 0.5) {
+ s = delta / (max + min);
+ } else {
+ s = delta / (2 - max - min);
+ }
+
+ return [h, s * 100, l * 100];
+};
+
+convert.rgb.hsv = function (rgb) {
+ var rdif;
+ var gdif;
+ var bdif;
+ var h;
+ var s;
+
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var v = Math.max(r, g, b);
+ var diff = v - Math.min(r, g, b);
+ var diffc = function (c) {
+ return (v - c) / 6 / diff + 1 / 2;
+ };
+
+ if (diff === 0) {
+ h = s = 0;
+ } else {
+ s = diff / v;
+ rdif = diffc(r);
+ gdif = diffc(g);
+ bdif = diffc(b);
+
+ if (r === v) {
+ h = bdif - gdif;
+ } else if (g === v) {
+ h = (1 / 3) + rdif - bdif;
+ } else if (b === v) {
+ h = (2 / 3) + gdif - rdif;
+ }
+ if (h < 0) {
+ h += 1;
+ } else if (h > 1) {
+ h -= 1;
+ }
+ }
+
+ return [
+ h * 360,
+ s * 100,
+ v * 100
+ ];
+};
+
+convert.rgb.hwb = function (rgb) {
+ var r = rgb[0];
+ var g = rgb[1];
+ var b = rgb[2];
+ var h = convert.rgb.hsl(rgb)[0];
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
+
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
+
+ return [h, w * 100, b * 100];
+};
+
+convert.rgb.cmyk = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var c;
+ var m;
+ var y;
+ var k;
+
+ k = Math.min(1 - r, 1 - g, 1 - b);
+ c = (1 - r - k) / (1 - k) || 0;
+ m = (1 - g - k) / (1 - k) || 0;
+ y = (1 - b - k) / (1 - k) || 0;
+
+ return [c * 100, m * 100, y * 100, k * 100];
+};
+
+/**
+ * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
+ * */
+function comparativeDistance(x, y) {
+ return (
+ Math.pow(x[0] - y[0], 2) +
+ Math.pow(x[1] - y[1], 2) +
+ Math.pow(x[2] - y[2], 2)
+ );
+}
+
+convert.rgb.keyword = function (rgb) {
+ var reversed = reverseKeywords[rgb];
+ if (reversed) {
+ return reversed;
+ }
+
+ var currentClosestDistance = Infinity;
+ var currentClosestKeyword;
+
+ for (var keyword in cssKeywords) {
+ if (cssKeywords.hasOwnProperty(keyword)) {
+ var value = cssKeywords[keyword];
+
+ // Compute comparative distance
+ var distance = comparativeDistance(rgb, value);
+
+ // Check if its less, if so set as closest
+ if (distance < currentClosestDistance) {
+ currentClosestDistance = distance;
+ currentClosestKeyword = keyword;
+ }
+ }
+ }
+
+ return currentClosestKeyword;
+};
+
+convert.keyword.rgb = function (keyword) {
+ return cssKeywords[keyword];
+};
+
+convert.rgb.xyz = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+
+ // assume sRGB
+ r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
+ g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
+ b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
+
+ var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
+ var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
+ var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
+
+ return [x * 100, y * 100, z * 100];
+};
+
+convert.rgb.lab = function (rgb) {
+ var xyz = convert.rgb.xyz(rgb);
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.hsl.rgb = function (hsl) {
+ var h = hsl[0] / 360;
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var t1;
+ var t2;
+ var t3;
+ var rgb;
+ var val;
+
+ if (s === 0) {
+ val = l * 255;
+ return [val, val, val];
+ }
+
+ if (l < 0.5) {
+ t2 = l * (1 + s);
+ } else {
+ t2 = l + s - l * s;
+ }
+
+ t1 = 2 * l - t2;
+
+ rgb = [0, 0, 0];
+ for (var i = 0; i < 3; i++) {
+ t3 = h + 1 / 3 * -(i - 1);
+ if (t3 < 0) {
+ t3++;
+ }
+ if (t3 > 1) {
+ t3--;
+ }
+
+ if (6 * t3 < 1) {
+ val = t1 + (t2 - t1) * 6 * t3;
+ } else if (2 * t3 < 1) {
+ val = t2;
+ } else if (3 * t3 < 2) {
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
+ } else {
+ val = t1;
+ }
+
+ rgb[i] = val * 255;
+ }
+
+ return rgb;
+};
+
+convert.hsl.hsv = function (hsl) {
+ var h = hsl[0];
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var smin = s;
+ var lmin = Math.max(l, 0.01);
+ var sv;
+ var v;
+
+ l *= 2;
+ s *= (l <= 1) ? l : 2 - l;
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
+ v = (l + s) / 2;
+ sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
+
+ return [h, sv * 100, v * 100];
+};
+
+convert.hsv.rgb = function (hsv) {
+ var h = hsv[0] / 60;
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var hi = Math.floor(h) % 6;
+
+ var f = h - Math.floor(h);
+ var p = 255 * v * (1 - s);
+ var q = 255 * v * (1 - (s * f));
+ var t = 255 * v * (1 - (s * (1 - f)));
+ v *= 255;
+
+ switch (hi) {
+ case 0:
+ return [v, t, p];
+ case 1:
+ return [q, v, p];
+ case 2:
+ return [p, v, t];
+ case 3:
+ return [p, q, v];
+ case 4:
+ return [t, p, v];
+ case 5:
+ return [v, p, q];
+ }
+};
+
+convert.hsv.hsl = function (hsv) {
+ var h = hsv[0];
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var vmin = Math.max(v, 0.01);
+ var lmin;
+ var sl;
+ var l;
+
+ l = (2 - s) * v;
+ lmin = (2 - s) * vmin;
+ sl = s * vmin;
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
+ sl = sl || 0;
+ l /= 2;
+
+ return [h, sl * 100, l * 100];
+};
+
+// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
+convert.hwb.rgb = function (hwb) {
+ var h = hwb[0] / 360;
+ var wh = hwb[1] / 100;
+ var bl = hwb[2] / 100;
+ var ratio = wh + bl;
+ var i;
+ var v;
+ var f;
+ var n;
+
+ // wh + bl cant be > 1
+ if (ratio > 1) {
+ wh /= ratio;
+ bl /= ratio;
+ }
+
+ i = Math.floor(6 * h);
+ v = 1 - bl;
+ f = 6 * h - i;
+
+ if ((i & 0x01) !== 0) {
+ f = 1 - f;
+ }
+
+ n = wh + f * (v - wh); // linear interpolation
+
+ var r;
+ var g;
+ var b;
+ switch (i) {
+ default:
+ case 6:
+ case 0: r = v; g = n; b = wh; break;
+ case 1: r = n; g = v; b = wh; break;
+ case 2: r = wh; g = v; b = n; break;
+ case 3: r = wh; g = n; b = v; break;
+ case 4: r = n; g = wh; b = v; break;
+ case 5: r = v; g = wh; b = n; break;
+ }
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.cmyk.rgb = function (cmyk) {
+ var c = cmyk[0] / 100;
+ var m = cmyk[1] / 100;
+ var y = cmyk[2] / 100;
+ var k = cmyk[3] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = 1 - Math.min(1, c * (1 - k) + k);
+ g = 1 - Math.min(1, m * (1 - k) + k);
+ b = 1 - Math.min(1, y * (1 - k) + k);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.rgb = function (xyz) {
+ var x = xyz[0] / 100;
+ var y = xyz[1] / 100;
+ var z = xyz[2] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
+
+ // assume sRGB
+ r = r > 0.0031308
+ ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
+ : r * 12.92;
+
+ g = g > 0.0031308
+ ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
+ : g * 12.92;
+
+ b = b > 0.0031308
+ ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
+ : b * 12.92;
+
+ r = Math.min(Math.max(0, r), 1);
+ g = Math.min(Math.max(0, g), 1);
+ b = Math.min(Math.max(0, b), 1);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.lab = function (xyz) {
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.lab.xyz = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var x;
+ var y;
+ var z;
+
+ y = (l + 16) / 116;
+ x = a / 500 + y;
+ z = y - b / 200;
+
+ var y2 = Math.pow(y, 3);
+ var x2 = Math.pow(x, 3);
+ var z2 = Math.pow(z, 3);
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
+
+ x *= 95.047;
+ y *= 100;
+ z *= 108.883;
+
+ return [x, y, z];
+};
+
+convert.lab.lch = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var hr;
+ var h;
+ var c;
+
+ hr = Math.atan2(b, a);
+ h = hr * 360 / 2 / Math.PI;
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ c = Math.sqrt(a * a + b * b);
+
+ return [l, c, h];
+};
+
+convert.lch.lab = function (lch) {
+ var l = lch[0];
+ var c = lch[1];
+ var h = lch[2];
+ var a;
+ var b;
+ var hr;
+
+ hr = h / 360 * 2 * Math.PI;
+ a = c * Math.cos(hr);
+ b = c * Math.sin(hr);
+
+ return [l, a, b];
+};
+
+convert.rgb.ansi16 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+ var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
+
+ value = Math.round(value / 50);
+
+ if (value === 0) {
+ return 30;
+ }
+
+ var ansi = 30
+ + ((Math.round(b / 255) << 2)
+ | (Math.round(g / 255) << 1)
+ | Math.round(r / 255));
+
+ if (value === 2) {
+ ansi += 60;
+ }
+
+ return ansi;
+};
+
+convert.hsv.ansi16 = function (args) {
+ // optimization here; we already know the value and don't need to get
+ // it converted for us.
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
+};
+
+convert.rgb.ansi256 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+
+ // we use the extended greyscale palette here, with the exception of
+ // black and white. normal palette only has 4 greyscale shades.
+ if (r === g && g === b) {
+ if (r < 8) {
+ return 16;
+ }
+
+ if (r > 248) {
+ return 231;
+ }
+
+ return Math.round(((r - 8) / 247) * 24) + 232;
+ }
+
+ var ansi = 16
+ + (36 * Math.round(r / 255 * 5))
+ + (6 * Math.round(g / 255 * 5))
+ + Math.round(b / 255 * 5);
+
+ return ansi;
+};
+
+convert.ansi16.rgb = function (args) {
+ var color = args % 10;
+
+ // handle greyscale
+ if (color === 0 || color === 7) {
+ if (args > 50) {
+ color += 3.5;
+ }
+
+ color = color / 10.5 * 255;
+
+ return [color, color, color];
+ }
+
+ var mult = (~~(args > 50) + 1) * 0.5;
+ var r = ((color & 1) * mult) * 255;
+ var g = (((color >> 1) & 1) * mult) * 255;
+ var b = (((color >> 2) & 1) * mult) * 255;
+
+ return [r, g, b];
+};
+
+convert.ansi256.rgb = function (args) {
+ // handle greyscale
+ if (args >= 232) {
+ var c = (args - 232) * 10 + 8;
+ return [c, c, c];
+ }
+
+ args -= 16;
+
+ var rem;
+ var r = Math.floor(args / 36) / 5 * 255;
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
+ var b = (rem % 6) / 5 * 255;
+
+ return [r, g, b];
+};
+
+convert.rgb.hex = function (args) {
+ var integer = ((Math.round(args[0]) & 0xFF) << 16)
+ + ((Math.round(args[1]) & 0xFF) << 8)
+ + (Math.round(args[2]) & 0xFF);
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.hex.rgb = function (args) {
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
+ if (!match) {
+ return [0, 0, 0];
+ }
+
+ var colorString = match[0];
+
+ if (match[0].length === 3) {
+ colorString = colorString.split('').map(function (char) {
+ return char + char;
+ }).join('');
+ }
+
+ var integer = parseInt(colorString, 16);
+ var r = (integer >> 16) & 0xFF;
+ var g = (integer >> 8) & 0xFF;
+ var b = integer & 0xFF;
+
+ return [r, g, b];
+};
+
+convert.rgb.hcg = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var max = Math.max(Math.max(r, g), b);
+ var min = Math.min(Math.min(r, g), b);
+ var chroma = (max - min);
+ var grayscale;
+ var hue;
+
+ if (chroma < 1) {
+ grayscale = min / (1 - chroma);
+ } else {
+ grayscale = 0;
+ }
+
+ if (chroma <= 0) {
+ hue = 0;
+ } else
+ if (max === r) {
+ hue = ((g - b) / chroma) % 6;
+ } else
+ if (max === g) {
+ hue = 2 + (b - r) / chroma;
+ } else {
+ hue = 4 + (r - g) / chroma + 4;
+ }
+
+ hue /= 6;
+ hue %= 1;
+
+ return [hue * 360, chroma * 100, grayscale * 100];
+};
+
+convert.hsl.hcg = function (hsl) {
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var c = 1;
+ var f = 0;
+
+ if (l < 0.5) {
+ c = 2.0 * s * l;
+ } else {
+ c = 2.0 * s * (1.0 - l);
+ }
+
+ if (c < 1.0) {
+ f = (l - 0.5 * c) / (1.0 - c);
+ }
+
+ return [hsl[0], c * 100, f * 100];
+};
+
+convert.hsv.hcg = function (hsv) {
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+
+ var c = s * v;
+ var f = 0;
+
+ if (c < 1.0) {
+ f = (v - c) / (1 - c);
+ }
+
+ return [hsv[0], c * 100, f * 100];
+};
+
+convert.hcg.rgb = function (hcg) {
+ var h = hcg[0] / 360;
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ if (c === 0.0) {
+ return [g * 255, g * 255, g * 255];
+ }
+
+ var pure = [0, 0, 0];
+ var hi = (h % 1) * 6;
+ var v = hi % 1;
+ var w = 1 - v;
+ var mg = 0;
+
+ switch (Math.floor(hi)) {
+ case 0:
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
+ case 1:
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
+ case 2:
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
+ case 3:
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
+ case 4:
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
+ default:
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
+ }
+
+ mg = (1.0 - c) * g;
+
+ return [
+ (c * pure[0] + mg) * 255,
+ (c * pure[1] + mg) * 255,
+ (c * pure[2] + mg) * 255
+ ];
+};
+
+convert.hcg.hsv = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var v = c + g * (1.0 - c);
+ var f = 0;
+
+ if (v > 0.0) {
+ f = c / v;
+ }
+
+ return [hcg[0], f * 100, v * 100];
+};
+
+convert.hcg.hsl = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var l = g * (1.0 - c) + 0.5 * c;
+ var s = 0;
+
+ if (l > 0.0 && l < 0.5) {
+ s = c / (2 * l);
+ } else
+ if (l >= 0.5 && l < 1.0) {
+ s = c / (2 * (1 - l));
+ }
+
+ return [hcg[0], s * 100, l * 100];
+};
+
+convert.hcg.hwb = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+ var v = c + g * (1.0 - c);
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
+};
+
+convert.hwb.hcg = function (hwb) {
+ var w = hwb[1] / 100;
+ var b = hwb[2] / 100;
+ var v = 1 - b;
+ var c = v - w;
+ var g = 0;
+
+ if (c < 1) {
+ g = (v - c) / (1 - c);
+ }
+
+ return [hwb[0], c * 100, g * 100];
+};
+
+convert.apple.rgb = function (apple) {
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
+};
+
+convert.rgb.apple = function (rgb) {
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
+};
+
+convert.gray.rgb = function (args) {
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
+};
+
+convert.gray.hsl = convert.gray.hsv = function (args) {
+ return [0, 0, args[0]];
+};
+
+convert.gray.hwb = function (gray) {
+ return [0, 100, gray[0]];
+};
+
+convert.gray.cmyk = function (gray) {
+ return [0, 0, 0, gray[0]];
+};
+
+convert.gray.lab = function (gray) {
+ return [gray[0], 0, 0];
+};
+
+convert.gray.hex = function (gray) {
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
+ var integer = (val << 16) + (val << 8) + val;
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.rgb.gray = function (rgb) {
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
+ return [val / 255 * 100];
+};
+
+},{"color-name":125}],123:[function(require,module,exports){
+var conversions = require('./conversions');
+var route = require('./route');
+
+var convert = {};
+
+var models = Object.keys(conversions);
+
+function wrapRaw(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ return fn(args);
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+function wrapRounded(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ var result = fn(args);
+
+ // we're assuming the result is an array here.
+ // see notice in conversions.js; don't use box types
+ // in conversion functions.
+ if (typeof result === 'object') {
+ for (var len = result.length, i = 0; i < len; i++) {
+ result[i] = Math.round(result[i]);
+ }
+ }
+
+ return result;
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+models.forEach(function (fromModel) {
+ convert[fromModel] = {};
+
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
+
+ var routes = route(fromModel);
+ var routeModels = Object.keys(routes);
+
+ routeModels.forEach(function (toModel) {
+ var fn = routes[toModel];
+
+ convert[fromModel][toModel] = wrapRounded(fn);
+ convert[fromModel][toModel].raw = wrapRaw(fn);
+ });
+});
+
+module.exports = convert;
+
+},{"./conversions":122,"./route":124}],124:[function(require,module,exports){
+var conversions = require('./conversions');
+
+/*
+ this function routes a model to all other models.
+
+ all functions that are routed have a property `.conversion` attached
+ to the returned synthetic function. This property is an array
+ of strings, each with the steps in between the 'from' and 'to'
+ color models (inclusive).
+
+ conversions that are not possible simply are not included.
+*/
+
+function buildGraph() {
+ var graph = {};
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
+ var models = Object.keys(conversions);
+
+ for (var len = models.length, i = 0; i < len; i++) {
+ graph[models[i]] = {
+ // http://jsperf.com/1-vs-infinity
+ // micro-opt, but this is simple.
+ distance: -1,
+ parent: null
+ };
+ }
+
+ return graph;
+}
+
+// https://en.wikipedia.org/wiki/Breadth-first_search
+function deriveBFS(fromModel) {
+ var graph = buildGraph();
+ var queue = [fromModel]; // unshift -> queue -> pop
+
+ graph[fromModel].distance = 0;
+
+ while (queue.length) {
+ var current = queue.pop();
+ var adjacents = Object.keys(conversions[current]);
+
+ for (var len = adjacents.length, i = 0; i < len; i++) {
+ var adjacent = adjacents[i];
+ var node = graph[adjacent];
+
+ if (node.distance === -1) {
+ node.distance = graph[current].distance + 1;
+ node.parent = current;
+ queue.unshift(adjacent);
+ }
+ }
+ }
+
+ return graph;
+}
+
+function link(from, to) {
+ return function (args) {
+ return to(from(args));
+ };
+}
+
+function wrapConversion(toModel, graph) {
+ var path = [graph[toModel].parent, toModel];
+ var fn = conversions[graph[toModel].parent][toModel];
+
+ var cur = graph[toModel].parent;
+ while (graph[cur].parent) {
+ path.unshift(graph[cur].parent);
+ fn = link(conversions[graph[cur].parent][cur], fn);
+ cur = graph[cur].parent;
+ }
+
+ fn.conversion = path;
+ return fn;
+}
+
+module.exports = function (fromModel) {
+ var graph = deriveBFS(fromModel);
+ var conversion = {};
+
+ var models = Object.keys(graph);
+ for (var len = models.length, i = 0; i < len; i++) {
+ var toModel = models[i];
+ var node = graph[toModel];
+
+ if (node.parent === null) {
+ // no possible conversion, or this node is the source model.
+ continue;
+ }
+
+ conversion[toModel] = wrapConversion(toModel, graph);
+ }
+
+ return conversion;
+};
+
+
+},{"./conversions":122}],125:[function(require,module,exports){
+'use strict'
+
+module.exports = {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+};
+
+},{}],126:[function(require,module,exports){
+module.exports = colorSupport({ alwaysReturn: true }, colorSupport)
+
+function colorSupport(options, obj) {
+ obj = obj || {}
+ options = options || {}
+ obj.level = 0
+ obj.hasBasic = false
+ obj.has256 = false
+ obj.has16m = false
+ if (!options.alwaysReturn) {
+ return false
+ }
+ return obj
+}
+
+},{}],127:[function(require,module,exports){
+(function (Buffer){
+var util = require('util');
+var Stream = require('stream').Stream;
+var DelayedStream = require('delayed-stream');
+var defer = require('./defer.js');
+
+module.exports = CombinedStream;
+function CombinedStream() {
+ this.writable = false;
+ this.readable = true;
+ this.dataSize = 0;
+ this.maxDataSize = 2 * 1024 * 1024;
+ this.pauseStreams = true;
+
+ this._released = false;
+ this._streams = [];
+ this._currentStream = null;
+}
+util.inherits(CombinedStream, Stream);
+
+CombinedStream.create = function(options) {
+ var combinedStream = new this();
+
+ options = options || {};
+ for (var option in options) {
+ combinedStream[option] = options[option];
+ }
+
+ return combinedStream;
+};
+
+CombinedStream.isStreamLike = function(stream) {
+ return (typeof stream !== 'function')
+ && (typeof stream !== 'string')
+ && (typeof stream !== 'boolean')
+ && (typeof stream !== 'number')
+ && (!Buffer.isBuffer(stream));
+};
+
+CombinedStream.prototype.append = function(stream) {
+ var isStreamLike = CombinedStream.isStreamLike(stream);
+
+ if (isStreamLike) {
+ if (!(stream instanceof DelayedStream)) {
+ var newStream = DelayedStream.create(stream, {
+ maxDataSize: Infinity,
+ pauseStream: this.pauseStreams,
+ });
+ stream.on('data', this._checkDataSize.bind(this));
+ stream = newStream;
+ }
+
+ this._handleErrors(stream);
+
+ if (this.pauseStreams) {
+ stream.pause();
+ }
+ }
+
+ this._streams.push(stream);
+ return this;
+};
+
+CombinedStream.prototype.pipe = function(dest, options) {
+ Stream.prototype.pipe.call(this, dest, options);
+ this.resume();
+ return dest;
+};
+
+CombinedStream.prototype._getNext = function() {
+ this._currentStream = null;
+ var stream = this._streams.shift();
+
+
+ if (typeof stream == 'undefined') {
+ this.end();
+ return;
+ }
+
+ if (typeof stream !== 'function') {
+ this._pipeNext(stream);
+ return;
+ }
+
+ var getStream = stream;
+ getStream(function(stream) {
+ var isStreamLike = CombinedStream.isStreamLike(stream);
+ if (isStreamLike) {
+ stream.on('data', this._checkDataSize.bind(this));
+ this._handleErrors(stream);
+ }
+
+ defer(this._pipeNext.bind(this, stream));
+ }.bind(this));
+};
+
+CombinedStream.prototype._pipeNext = function(stream) {
+ this._currentStream = stream;
+
+ var isStreamLike = CombinedStream.isStreamLike(stream);
+ if (isStreamLike) {
+ stream.on('end', this._getNext.bind(this));
+ stream.pipe(this, {end: false});
+ return;
+ }
+
+ var value = stream;
+ this.write(value);
+ this._getNext();
+};
+
+CombinedStream.prototype._handleErrors = function(stream) {
+ var self = this;
+ stream.on('error', function(err) {
+ self._emitError(err);
+ });
+};
+
+CombinedStream.prototype.write = function(data) {
+ this.emit('data', data);
+};
+
+CombinedStream.prototype.pause = function() {
+ if (!this.pauseStreams) {
+ return;
+ }
+
+ if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();
+ this.emit('pause');
+};
+
+CombinedStream.prototype.resume = function() {
+ if (!this._released) {
+ this._released = true;
+ this.writable = true;
+ this._getNext();
+ }
+
+ if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();
+ this.emit('resume');
+};
+
+CombinedStream.prototype.end = function() {
+ this._reset();
+ this.emit('end');
+};
+
+CombinedStream.prototype.destroy = function() {
+ this._reset();
+ this.emit('close');
+};
+
+CombinedStream.prototype._reset = function() {
+ this.writable = false;
+ this._streams = [];
+ this._currentStream = null;
+};
+
+CombinedStream.prototype._checkDataSize = function() {
+ this._updateDataSize();
+ if (this.dataSize <= this.maxDataSize) {
+ return;
+ }
+
+ var message =
+ 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';
+ this._emitError(new Error(message));
+};
+
+CombinedStream.prototype._updateDataSize = function() {
+ this.dataSize = 0;
+
+ var self = this;
+ this._streams.forEach(function(stream) {
+ if (!stream.dataSize) {
+ return;
+ }
+
+ self.dataSize += stream.dataSize;
+ });
+
+ if (this._currentStream && this._currentStream.dataSize) {
+ this.dataSize += this._currentStream.dataSize;
+ }
+};
+
+CombinedStream.prototype._emitError = function(err) {
+ this._reset();
+ this.emit('error', err);
+};
+
+}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
+},{"../../is-buffer/index.js":839,"./defer.js":128,"delayed-stream":532,"stream":1394,"util":1439}],128:[function(require,module,exports){
+(function (process,setImmediate){
+module.exports = defer;
+
+/**
+ * Runs provided function on next iteration of the event loop
+ *
+ * @param {function} fn - function to run
+ */
+function defer(fn)
+{
+ var nextTick = typeof setImmediate == 'function'
+ ? setImmediate
+ : (
+ typeof process == 'object' && typeof process.nextTick == 'function'
+ ? process.nextTick
+ : null
+ );
+
+ if (nextTick)
+ {
+ nextTick(fn);
+ }
+ else
+ {
+ setTimeout(fn, 0);
+ }
+}
+
+}).call(this,require('_process'),require("timers").setImmediate)
+},{"_process":109,"timers":1415}],129:[function(require,module,exports){
+/**
+ * toString ref.
+ */
+
+var toString = Object.prototype.toString;
+
+/**
+ * Return the type of `val`.
+ *
+ * @param {Mixed} val
+ * @return {String}
+ * @api public
+ */
+
+module.exports = function(val){
+ switch (toString.call(val)) {
+ case '[object Date]': return 'date';
+ case '[object RegExp]': return 'regexp';
+ case '[object Arguments]': return 'arguments';
+ case '[object Array]': return 'array';
+ case '[object Error]': return 'error';
+ }
+
+ if (val === null) return 'null';
+ if (val === undefined) return 'undefined';
+ if (val !== val) return 'nan';
+ if (val && val.nodeType === 1) return 'element';
+
+ if (isBuffer(val)) return 'buffer';
+
+ val = val.valueOf
+ ? val.valueOf()
+ : Object.prototype.valueOf.apply(val);
+
+ return typeof val;
+};
+
+// code borrowed from https://github.com/feross/is-buffer/blob/master/index.js
+function isBuffer(obj) {
+ return !!(obj != null &&
+ (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)
+ (obj.constructor &&
+ typeof obj.constructor.isBuffer === 'function' &&
+ obj.constructor.isBuffer(obj))
+ ))
+}
+
+},{}],130:[function(require,module,exports){
+var upperCase = require('upper-case')
+var snakeCase = require('snake-case')
+
+/**
+ * Constant case a string.
+ *
+ * @param {string} value
+ * @param {string} [locale]
+ * @return {string}
+ */
+module.exports = function (value, locale) {
+ return upperCase(snakeCase(value, locale), locale)
+}
+
+},{"snake-case":1362,"upper-case":1430}],131:[function(require,module,exports){
+module.exports={
+ "O_RDONLY": 0,
+ "O_WRONLY": 1,
+ "O_RDWR": 2,
+ "S_IFMT": 61440,
+ "S_IFREG": 32768,
+ "S_IFDIR": 16384,
+ "S_IFCHR": 8192,
+ "S_IFBLK": 24576,
+ "S_IFIFO": 4096,
+ "S_IFLNK": 40960,
+ "S_IFSOCK": 49152,
+ "O_CREAT": 512,
+ "O_EXCL": 2048,
+ "O_NOCTTY": 131072,
+ "O_TRUNC": 1024,
+ "O_APPEND": 8,
+ "O_DIRECTORY": 1048576,
+ "O_NOFOLLOW": 256,
+ "O_SYNC": 128,
+ "O_SYMLINK": 2097152,
+ "O_NONBLOCK": 4,
+ "S_IRWXU": 448,
+ "S_IRUSR": 256,
+ "S_IWUSR": 128,
+ "S_IXUSR": 64,
+ "S_IRWXG": 56,
+ "S_IRGRP": 32,
+ "S_IWGRP": 16,
+ "S_IXGRP": 8,
+ "S_IRWXO": 7,
+ "S_IROTH": 4,
+ "S_IWOTH": 2,
+ "S_IXOTH": 1,
+ "E2BIG": 7,
+ "EACCES": 13,
+ "EADDRINUSE": 48,
+ "EADDRNOTAVAIL": 49,
+ "EAFNOSUPPORT": 47,
+ "EAGAIN": 35,
+ "EALREADY": 37,
+ "EBADF": 9,
+ "EBADMSG": 94,
+ "EBUSY": 16,
+ "ECANCELED": 89,
+ "ECHILD": 10,
+ "ECONNABORTED": 53,
+ "ECONNREFUSED": 61,
+ "ECONNRESET": 54,
+ "EDEADLK": 11,
+ "EDESTADDRREQ": 39,
+ "EDOM": 33,
+ "EDQUOT": 69,
+ "EEXIST": 17,
+ "EFAULT": 14,
+ "EFBIG": 27,
+ "EHOSTUNREACH": 65,
+ "EIDRM": 90,
+ "EILSEQ": 92,
+ "EINPROGRESS": 36,
+ "EINTR": 4,
+ "EINVAL": 22,
+ "EIO": 5,
+ "EISCONN": 56,
+ "EISDIR": 21,
+ "ELOOP": 62,
+ "EMFILE": 24,
+ "EMLINK": 31,
+ "EMSGSIZE": 40,
+ "EMULTIHOP": 95,
+ "ENAMETOOLONG": 63,
+ "ENETDOWN": 50,
+ "ENETRESET": 52,
+ "ENETUNREACH": 51,
+ "ENFILE": 23,
+ "ENOBUFS": 55,
+ "ENODATA": 96,
+ "ENODEV": 19,
+ "ENOENT": 2,
+ "ENOEXEC": 8,
+ "ENOLCK": 77,
+ "ENOLINK": 97,
+ "ENOMEM": 12,
+ "ENOMSG": 91,
+ "ENOPROTOOPT": 42,
+ "ENOSPC": 28,
+ "ENOSR": 98,
+ "ENOSTR": 99,
+ "ENOSYS": 78,
+ "ENOTCONN": 57,
+ "ENOTDIR": 20,
+ "ENOTEMPTY": 66,
+ "ENOTSOCK": 38,
+ "ENOTSUP": 45,
+ "ENOTTY": 25,
+ "ENXIO": 6,
+ "EOPNOTSUPP": 102,
+ "EOVERFLOW": 84,
+ "EPERM": 1,
+ "EPIPE": 32,
+ "EPROTO": 100,
+ "EPROTONOSUPPORT": 43,
+ "EPROTOTYPE": 41,
+ "ERANGE": 34,
+ "EROFS": 30,
+ "ESPIPE": 29,
+ "ESRCH": 3,
+ "ESTALE": 70,
+ "ETIME": 101,
+ "ETIMEDOUT": 60,
+ "ETXTBSY": 26,
+ "EWOULDBLOCK": 35,
+ "EXDEV": 18,
+ "SIGHUP": 1,
+ "SIGINT": 2,
+ "SIGQUIT": 3,
+ "SIGILL": 4,
+ "SIGTRAP": 5,
+ "SIGABRT": 6,
+ "SIGIOT": 6,
+ "SIGBUS": 10,
+ "SIGFPE": 8,
+ "SIGKILL": 9,
+ "SIGUSR1": 30,
+ "SIGSEGV": 11,
+ "SIGUSR2": 31,
+ "SIGPIPE": 13,
+ "SIGALRM": 14,
+ "SIGTERM": 15,
+ "SIGCHLD": 20,
+ "SIGCONT": 19,
+ "SIGSTOP": 17,
+ "SIGTSTP": 18,
+ "SIGTTIN": 21,
+ "SIGTTOU": 22,
+ "SIGURG": 16,
+ "SIGXCPU": 24,
+ "SIGXFSZ": 25,
+ "SIGVTALRM": 26,
+ "SIGPROF": 27,
+ "SIGWINCH": 28,
+ "SIGIO": 23,
+ "SIGSYS": 12,
+ "SSL_OP_ALL": 2147486719,
+ "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION": 262144,
+ "SSL_OP_CIPHER_SERVER_PREFERENCE": 4194304,
+ "SSL_OP_CISCO_ANYCONNECT": 32768,
+ "SSL_OP_COOKIE_EXCHANGE": 8192,
+ "SSL_OP_CRYPTOPRO_TLSEXT_BUG": 2147483648,
+ "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS": 2048,
+ "SSL_OP_EPHEMERAL_RSA": 0,
+ "SSL_OP_LEGACY_SERVER_CONNECT": 4,
+ "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER": 32,
+ "SSL_OP_MICROSOFT_SESS_ID_BUG": 1,
+ "SSL_OP_MSIE_SSLV2_RSA_PADDING": 0,
+ "SSL_OP_NETSCAPE_CA_DN_BUG": 536870912,
+ "SSL_OP_NETSCAPE_CHALLENGE_BUG": 2,
+ "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG": 1073741824,
+ "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG": 8,
+ "SSL_OP_NO_COMPRESSION": 131072,
+ "SSL_OP_NO_QUERY_MTU": 4096,
+ "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION": 65536,
+ "SSL_OP_NO_SSLv2": 16777216,
+ "SSL_OP_NO_SSLv3": 33554432,
+ "SSL_OP_NO_TICKET": 16384,
+ "SSL_OP_NO_TLSv1": 67108864,
+ "SSL_OP_NO_TLSv1_1": 268435456,
+ "SSL_OP_NO_TLSv1_2": 134217728,
+ "SSL_OP_PKCS1_CHECK_1": 0,
+ "SSL_OP_PKCS1_CHECK_2": 0,
+ "SSL_OP_SINGLE_DH_USE": 1048576,
+ "SSL_OP_SINGLE_ECDH_USE": 524288,
+ "SSL_OP_SSLEAY_080_CLIENT_DH_BUG": 128,
+ "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG": 0,
+ "SSL_OP_TLS_BLOCK_PADDING_BUG": 512,
+ "SSL_OP_TLS_D5_BUG": 256,
+ "SSL_OP_TLS_ROLLBACK_BUG": 8388608,
+ "ENGINE_METHOD_DSA": 2,
+ "ENGINE_METHOD_DH": 4,
+ "ENGINE_METHOD_RAND": 8,
+ "ENGINE_METHOD_ECDH": 16,
+ "ENGINE_METHOD_ECDSA": 32,
+ "ENGINE_METHOD_CIPHERS": 64,
+ "ENGINE_METHOD_DIGESTS": 128,
+ "ENGINE_METHOD_STORE": 256,
+ "ENGINE_METHOD_PKEY_METHS": 512,
+ "ENGINE_METHOD_PKEY_ASN1_METHS": 1024,
+ "ENGINE_METHOD_ALL": 65535,
+ "ENGINE_METHOD_NONE": 0,
+ "DH_CHECK_P_NOT_SAFE_PRIME": 2,
+ "DH_CHECK_P_NOT_PRIME": 1,
+ "DH_UNABLE_TO_CHECK_GENERATOR": 4,
+ "DH_NOT_SUITABLE_GENERATOR": 8,
+ "NPN_ENABLED": 1,
+ "RSA_PKCS1_PADDING": 1,
+ "RSA_SSLV23_PADDING": 2,
+ "RSA_NO_PADDING": 3,
+ "RSA_PKCS1_OAEP_PADDING": 4,
+ "RSA_X931_PADDING": 5,
+ "RSA_PKCS1_PSS_PADDING": 6,
+ "POINT_CONVERSION_COMPRESSED": 2,
+ "POINT_CONVERSION_UNCOMPRESSED": 4,
+ "POINT_CONVERSION_HYBRID": 6,
+ "F_OK": 0,
+ "R_OK": 4,
+ "W_OK": 2,
+ "X_OK": 1,
+ "UV_UDP_REUSEADDR": 4
+}
+
+},{}],132:[function(require,module,exports){
+/* jshint node: true */
+(function () {
+ "use strict";
+
+ function CookieAccessInfo(domain, path, secure, script) {
+ if (this instanceof CookieAccessInfo) {
+ this.domain = domain || undefined;
+ this.path = path || "/";
+ this.secure = !!secure;
+ this.script = !!script;
+ return this;
+ }
+ return new CookieAccessInfo(domain, path, secure, script);
+ }
+ CookieAccessInfo.All = Object.freeze(Object.create(null));
+ exports.CookieAccessInfo = CookieAccessInfo;
+
+ function Cookie(cookiestr, request_domain, request_path) {
+ if (cookiestr instanceof Cookie) {
+ return cookiestr;
+ }
+ if (this instanceof Cookie) {
+ this.name = null;
+ this.value = null;
+ this.expiration_date = Infinity;
+ this.path = String(request_path || "/");
+ this.explicit_path = false;
+ this.domain = request_domain || null;
+ this.explicit_domain = false;
+ this.secure = false; //how to define default?
+ this.noscript = false; //httponly
+ if (cookiestr) {
+ this.parse(cookiestr, request_domain, request_path);
+ }
+ return this;
+ }
+ return new Cookie(cookiestr, request_domain, request_path);
+ }
+ exports.Cookie = Cookie;
+
+ Cookie.prototype.toString = function toString() {
+ var str = [this.name + "=" + this.value];
+ if (this.expiration_date !== Infinity) {
+ str.push("expires=" + (new Date(this.expiration_date)).toGMTString());
+ }
+ if (this.domain) {
+ str.push("domain=" + this.domain);
+ }
+ if (this.path) {
+ str.push("path=" + this.path);
+ }
+ if (this.secure) {
+ str.push("secure");
+ }
+ if (this.noscript) {
+ str.push("httponly");
+ }
+ return str.join("; ");
+ };
+
+ Cookie.prototype.toValueString = function toValueString() {
+ return this.name + "=" + this.value;
+ };
+
+ var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;
+ Cookie.prototype.parse = function parse(str, request_domain, request_path) {
+ if (this instanceof Cookie) {
+ var parts = str.split(";").filter(function (value) {
+ return !!value;
+ });
+ var i;
+
+ var pair = parts[0].match(/([^=]+)=([\s\S]*)/);
+ if (!pair) {
+ console.warn("Invalid cookie header encountered. Header: '"+str+"'");
+ return;
+ }
+
+ var key = pair[1];
+ var value = pair[2];
+ if ( typeof key !== 'string' || key.length === 0 || typeof value !== 'string' ) {
+ console.warn("Unable to extract values from cookie header. Cookie: '"+str+"'");
+ return;
+ }
+
+ this.name = key;
+ this.value = value;
+
+ for (i = 1; i < parts.length; i += 1) {
+ pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/);
+ key = pair[1].trim().toLowerCase();
+ value = pair[2];
+ switch (key) {
+ case "httponly":
+ this.noscript = true;
+ break;
+ case "expires":
+ this.expiration_date = value ?
+ Number(Date.parse(value)) :
+ Infinity;
+ break;
+ case "path":
+ this.path = value ?
+ value.trim() :
+ "";
+ this.explicit_path = true;
+ break;
+ case "domain":
+ this.domain = value ?
+ value.trim() :
+ "";
+ this.explicit_domain = !!this.domain;
+ break;
+ case "secure":
+ this.secure = true;
+ break;
+ }
+ }
+
+ if (!this.explicit_path) {
+ this.path = request_path || "/";
+ }
+ if (!this.explicit_domain) {
+ this.domain = request_domain;
+ }
+
+ return this;
+ }
+ return new Cookie().parse(str, request_domain, request_path);
+ };
+
+ Cookie.prototype.matches = function matches(access_info) {
+ if (access_info === CookieAccessInfo.All) {
+ return true;
+ }
+ if (this.noscript && access_info.script ||
+ this.secure && !access_info.secure ||
+ !this.collidesWith(access_info)) {
+ return false;
+ }
+ return true;
+ };
+
+ Cookie.prototype.collidesWith = function collidesWith(access_info) {
+ if ((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
+ return false;
+ }
+ if (this.path && access_info.path.indexOf(this.path) !== 0) {
+ return false;
+ }
+ if (this.explicit_path && access_info.path.indexOf( this.path ) !== 0) {
+ return false;
+ }
+ var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/,'');
+ var cookie_domain = this.domain && this.domain.replace(/^[\.]/,'');
+ if (cookie_domain === access_domain) {
+ return true;
+ }
+ if (cookie_domain) {
+ if (!this.explicit_domain) {
+ return false; // we already checked if the domains were exactly the same
+ }
+ var wildcard = access_domain.indexOf(cookie_domain);
+ if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) {
+ return false;
+ }
+ return true;
+ }
+ return true;
+ };
+
+ function CookieJar() {
+ var cookies, cookies_list, collidable_cookie;
+ if (this instanceof CookieJar) {
+ cookies = Object.create(null); //name: [Cookie]
+
+ this.setCookie = function setCookie(cookie, request_domain, request_path) {
+ var remove, i;
+ cookie = new Cookie(cookie, request_domain, request_path);
+ //Delete the cookie if the set is past the current time
+ remove = cookie.expiration_date <= Date.now();
+ if (cookies[cookie.name] !== undefined) {
+ cookies_list = cookies[cookie.name];
+ for (i = 0; i < cookies_list.length; i += 1) {
+ collidable_cookie = cookies_list[i];
+ if (collidable_cookie.collidesWith(cookie)) {
+ if (remove) {
+ cookies_list.splice(i, 1);
+ if (cookies_list.length === 0) {
+ delete cookies[cookie.name];
+ }
+ return false;
+ }
+ cookies_list[i] = cookie;
+ return cookie;
+ }
+ }
+ if (remove) {
+ return false;
+ }
+ cookies_list.push(cookie);
+ return cookie;
+ }
+ if (remove) {
+ return false;
+ }
+ cookies[cookie.name] = [cookie];
+ return cookies[cookie.name];
+ };
+ //returns a cookie
+ this.getCookie = function getCookie(cookie_name, access_info) {
+ var cookie, i;
+ cookies_list = cookies[cookie_name];
+ if (!cookies_list) {
+ return;
+ }
+ for (i = 0; i < cookies_list.length; i += 1) {
+ cookie = cookies_list[i];
+ if (cookie.expiration_date <= Date.now()) {
+ if (cookies_list.length === 0) {
+ delete cookies[cookie.name];
+ }
+ continue;
+ }
+
+ if (cookie.matches(access_info)) {
+ return cookie;
+ }
+ }
+ };
+ //returns a list of cookies
+ this.getCookies = function getCookies(access_info) {
+ var matches = [], cookie_name, cookie;
+ for (cookie_name in cookies) {
+ cookie = this.getCookie(cookie_name, access_info);
+ if (cookie) {
+ matches.push(cookie);
+ }
+ }
+ matches.toString = function toString() {
+ return matches.join(":");
+ };
+ matches.toValueString = function toValueString() {
+ return matches.map(function (c) {
+ return c.toValueString();
+ }).join(';');
+ };
+ return matches;
+ };
+
+ return this;
+ }
+ return new CookieJar();
+ }
+ exports.CookieJar = CookieJar;
+
+ //returns list of cookies that were set correctly. Cookies that are expired and removed are not returned.
+ CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) {
+ cookies = Array.isArray(cookies) ?
+ cookies :
+ cookies.split(cookie_str_splitter);
+ var successful = [],
+ i,
+ cookie;
+ cookies = cookies.map(function(item){
+ return new Cookie(item, request_domain, request_path);
+ });
+ for (i = 0; i < cookies.length; i += 1) {
+ cookie = cookies[i];
+ if (this.setCookie(cookie, request_domain, request_path)) {
+ successful.push(cookie);
+ }
+ }
+ return successful;
+ };
+}());
+
+},{}],133:[function(require,module,exports){
+/*!
+ * copy-descriptor
+ *
+ * Copyright (c) 2015, Jon Schlinkert.
+ * Licensed under the MIT License.
+ */
+
+'use strict';
+
+/**
+ * Copy a descriptor from one object to another.
+ *
+ * ```js
+ * function App() {
+ * this.cache = {};
+ * }
+ * App.prototype.set = function(key, val) {
+ * this.cache[key] = val;
+ * return this;
+ * };
+ * Object.defineProperty(App.prototype, 'count', {
+ * get: function() {
+ * return Object.keys(this.cache).length;
+ * }
+ * });
+ *
+ * copy(App.prototype, 'count', 'len');
+ *
+ * // create an instance
+ * var app = new App();
+ *
+ * app.set('a', true);
+ * app.set('b', true);
+ * app.set('c', true);
+ *
+ * console.log(app.count);
+ * //=> 3
+ * console.log(app.len);
+ * //=> 3
+ * ```
+ * @name copy
+ * @param {Object} `receiver` The target object
+ * @param {Object} `provider` The provider object
+ * @param {String} `from` The key to copy on provider.
+ * @param {String} `to` Optionally specify a new key name to use.
+ * @return {Object}
+ * @api public
+ */
+
+module.exports = function copyDescriptor(receiver, provider, from, to) {
+ if (!isObject(provider) && typeof provider !== 'function') {
+ to = from;
+ from = provider;
+ provider = receiver;
+ }
+ if (!isObject(receiver) && typeof receiver !== 'function') {
+ throw new TypeError('expected the first argument to be an object');
+ }
+ if (!isObject(provider) && typeof provider !== 'function') {
+ throw new TypeError('expected provider to be an object');
+ }
+
+ if (typeof to !== 'string') {
+ to = from;
+ }
+ if (typeof from !== 'string') {
+ throw new TypeError('expected key to be a string');
+ }
+
+ if (!(from in provider)) {
+ throw new Error('property "' + from + '" does not exist');
+ }
+
+ var val = Object.getOwnPropertyDescriptor(provider, from);
+ if (val) Object.defineProperty(receiver, to, val);
+};
+
+function isObject(val) {
+ return {}.toString.call(val) === '[object Object]';
+}
+
+
+},{}],134:[function(require,module,exports){
+'use strict';
+module.exports = input => {
+ const el = document.createElement('textarea');
+
+ el.value = input;
+
+ // Prevent keyboard from showing on mobile
+ el.setAttribute('readonly', '');
+
+ el.style.contain = 'strict';
+ el.style.position = 'absolute';
+ el.style.left = '-9999px';
+ el.style.fontSize = '12pt'; // Prevent zooming on iOS
+
+ const selection = document.getSelection();
+ let originalRange = false;
+ if (selection.rangeCount > 0) {
+ originalRange = selection.getRangeAt(0);
+ }
+
+ document.body.appendChild(el);
+ el.select();
+
+ // Explicit selection workaround for iOS
+ el.selectionStart = 0;
+ el.selectionEnd = input.length;
+
+ let success = false;
+ try {
+ success = document.execCommand('copy');
+ } catch (err) {}
+
+ document.body.removeChild(el);
+
+ if (originalRange) {
+ selection.removeAllRanges();
+ selection.addRange(originalRange);
+ }
+
+ return success;
+};
+
+},{}],135:[function(require,module,exports){
+require('../../modules/core.regexp.escape');
+module.exports = require('../../modules/_core').RegExp.escape;
+
+},{"../../modules/_core":157,"../../modules/core.regexp.escape":265}],136:[function(require,module,exports){
+module.exports = function (it) {
+ if (typeof it != 'function') throw TypeError(it + ' is not a function!');
+ return it;
+};
+
+},{}],137:[function(require,module,exports){
+var cof = require('./_cof');
+module.exports = function (it, msg) {
+ if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg);
+ return +it;
+};
+
+},{"./_cof":152}],138:[function(require,module,exports){
+// 22.1.3.31 Array.prototype[@@unscopables]
+var UNSCOPABLES = require('./_wks')('unscopables');
+var ArrayProto = Array.prototype;
+if (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});
+module.exports = function (key) {
+ ArrayProto[UNSCOPABLES][key] = true;
+};
+
+},{"./_hide":177,"./_wks":263}],139:[function(require,module,exports){
+'use strict';
+var at = require('./_string-at')(true);
+
+ // `AdvanceStringIndex` abstract operation
+// https://tc39.github.io/ecma262/#sec-advancestringindex
+module.exports = function (S, index, unicode) {
+ return index + (unicode ? at(S, index).length : 1);
+};
+
+},{"./_string-at":240}],140:[function(require,module,exports){
+module.exports = function (it, Constructor, name, forbiddenField) {
+ if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
+ throw TypeError(name + ': incorrect invocation!');
+ } return it;
+};
+
+},{}],141:[function(require,module,exports){
+var isObject = require('./_is-object');
+module.exports = function (it) {
+ if (!isObject(it)) throw TypeError(it + ' is not an object!');
+ return it;
+};
+
+},{"./_is-object":186}],142:[function(require,module,exports){
+// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
+'use strict';
+var toObject = require('./_to-object');
+var toAbsoluteIndex = require('./_to-absolute-index');
+var toLength = require('./_to-length');
+
+module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
+ var O = toObject(this);
+ var len = toLength(O.length);
+ var to = toAbsoluteIndex(target, len);
+ var from = toAbsoluteIndex(start, len);
+ var end = arguments.length > 2 ? arguments[2] : undefined;
+ var count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
+ var inc = 1;
+ if (from < to && to < from + count) {
+ inc = -1;
+ from += count - 1;
+ to += count - 1;
+ }
+ while (count-- > 0) {
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ to += inc;
+ from += inc;
+ } return O;
+};
+
+},{"./_to-absolute-index":248,"./_to-length":252,"./_to-object":253}],143:[function(require,module,exports){
+// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
+'use strict';
+var toObject = require('./_to-object');
+var toAbsoluteIndex = require('./_to-absolute-index');
+var toLength = require('./_to-length');
+module.exports = function fill(value /* , start = 0, end = @length */) {
+ var O = toObject(this);
+ var length = toLength(O.length);
+ var aLen = arguments.length;
+ var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length);
+ var end = aLen > 2 ? arguments[2] : undefined;
+ var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
+ while (endPos > index) O[index++] = value;
+ return O;
+};
+
+},{"./_to-absolute-index":248,"./_to-length":252,"./_to-object":253}],144:[function(require,module,exports){
+var forOf = require('./_for-of');
+
+module.exports = function (iter, ITERATOR) {
+ var result = [];
+ forOf(iter, false, result.push, result, ITERATOR);
+ return result;
+};
+
+},{"./_for-of":173}],145:[function(require,module,exports){
+// false -> Array#indexOf
+// true -> Array#includes
+var toIObject = require('./_to-iobject');
+var toLength = require('./_to-length');
+var toAbsoluteIndex = require('./_to-absolute-index');
+module.exports = function (IS_INCLUDES) {
+ return function ($this, el, fromIndex) {
+ var O = toIObject($this);
+ var length = toLength(O.length);
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ // Array#includes uses SameValueZero equality algorithm
+ // eslint-disable-next-line no-self-compare
+ if (IS_INCLUDES && el != el) while (length > index) {
+ value = O[index++];
+ // eslint-disable-next-line no-self-compare
+ if (value != value) return true;
+ // Array#indexOf ignores holes, Array#includes - not
+ } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
+ if (O[index] === el) return IS_INCLUDES || index || 0;
+ } return !IS_INCLUDES && -1;
+ };
+};
+
+},{"./_to-absolute-index":248,"./_to-iobject":251,"./_to-length":252}],146:[function(require,module,exports){
+// 0 -> Array#forEach
+// 1 -> Array#map
+// 2 -> Array#filter
+// 3 -> Array#some
+// 4 -> Array#every
+// 5 -> Array#find
+// 6 -> Array#findIndex
+var ctx = require('./_ctx');
+var IObject = require('./_iobject');
+var toObject = require('./_to-object');
+var toLength = require('./_to-length');
+var asc = require('./_array-species-create');
+module.exports = function (TYPE, $create) {
+ var IS_MAP = TYPE == 1;
+ var IS_FILTER = TYPE == 2;
+ var IS_SOME = TYPE == 3;
+ var IS_EVERY = TYPE == 4;
+ var IS_FIND_INDEX = TYPE == 6;
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
+ var create = $create || asc;
+ return function ($this, callbackfn, that) {
+ var O = toObject($this);
+ var self = IObject(O);
+ var f = ctx(callbackfn, that, 3);
+ var length = toLength(self.length);
+ var index = 0;
+ var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
+ var val, res;
+ for (;length > index; index++) if (NO_HOLES || index in self) {
+ val = self[index];
+ res = f(val, index, O);
+ if (TYPE) {
+ if (IS_MAP) result[index] = res; // map
+ else if (res) switch (TYPE) {
+ case 3: return true; // some
+ case 5: return val; // find
+ case 6: return index; // findIndex
+ case 2: result.push(val); // filter
+ } else if (IS_EVERY) return false; // every
+ }
+ }
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
+ };
+};
+
+},{"./_array-species-create":149,"./_ctx":159,"./_iobject":182,"./_to-length":252,"./_to-object":253}],147:[function(require,module,exports){
+var aFunction = require('./_a-function');
+var toObject = require('./_to-object');
+var IObject = require('./_iobject');
+var toLength = require('./_to-length');
+
+module.exports = function (that, callbackfn, aLen, memo, isRight) {
+ aFunction(callbackfn);
+ var O = toObject(that);
+ var self = IObject(O);
+ var length = toLength(O.length);
+ var index = isRight ? length - 1 : 0;
+ var i = isRight ? -1 : 1;
+ if (aLen < 2) for (;;) {
+ if (index in self) {
+ memo = self[index];
+ index += i;
+ break;
+ }
+ index += i;
+ if (isRight ? index < 0 : length <= index) {
+ throw TypeError('Reduce of empty array with no initial value');
+ }
+ }
+ for (;isRight ? index >= 0 : length > index; index += i) if (index in self) {
+ memo = callbackfn(memo, self[index], index, O);
+ }
+ return memo;
+};
+
+},{"./_a-function":136,"./_iobject":182,"./_to-length":252,"./_to-object":253}],148:[function(require,module,exports){
+var isObject = require('./_is-object');
+var isArray = require('./_is-array');
+var SPECIES = require('./_wks')('species');
+
+module.exports = function (original) {
+ var C;
+ if (isArray(original)) {
+ C = original.constructor;
+ // cross-realm fallback
+ if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
+ if (isObject(C)) {
+ C = C[SPECIES];
+ if (C === null) C = undefined;
+ }
+ } return C === undefined ? Array : C;
+};
+
+},{"./_is-array":184,"./_is-object":186,"./_wks":263}],149:[function(require,module,exports){
+// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
+var speciesConstructor = require('./_array-species-constructor');
+
+module.exports = function (original, length) {
+ return new (speciesConstructor(original))(length);
+};
+
+},{"./_array-species-constructor":148}],150:[function(require,module,exports){
+'use strict';
+var aFunction = require('./_a-function');
+var isObject = require('./_is-object');
+var invoke = require('./_invoke');
+var arraySlice = [].slice;
+var factories = {};
+
+var construct = function (F, len, args) {
+ if (!(len in factories)) {
+ for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']';
+ // eslint-disable-next-line no-new-func
+ factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
+ } return factories[len](F, args);
+};
+
+module.exports = Function.bind || function bind(that /* , ...args */) {
+ var fn = aFunction(this);
+ var partArgs = arraySlice.call(arguments, 1);
+ var bound = function (/* args... */) {
+ var args = partArgs.concat(arraySlice.call(arguments));
+ return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
+ };
+ if (isObject(fn.prototype)) bound.prototype = fn.prototype;
+ return bound;
+};
+
+},{"./_a-function":136,"./_invoke":181,"./_is-object":186}],151:[function(require,module,exports){
+// getting tag from 19.1.3.6 Object.prototype.toString()
+var cof = require('./_cof');
+var TAG = require('./_wks')('toStringTag');
+// ES3 wrong here
+var ARG = cof(function () { return arguments; }()) == 'Arguments';
+
+// fallback for IE11 Script Access Denied error
+var tryGet = function (it, key) {
+ try {
+ return it[key];
+ } catch (e) { /* empty */ }
+};
+
+module.exports = function (it) {
+ var O, T, B;
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
+ // @@toStringTag case
+ : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
+ // builtinTag case
+ : ARG ? cof(O)
+ // ES3 arguments fallback
+ : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
+};
+
+},{"./_cof":152,"./_wks":263}],152:[function(require,module,exports){
+var toString = {}.toString;
+
+module.exports = function (it) {
+ return toString.call(it).slice(8, -1);
+};
+
+},{}],153:[function(require,module,exports){
+'use strict';
+var dP = require('./_object-dp').f;
+var create = require('./_object-create');
+var redefineAll = require('./_redefine-all');
+var ctx = require('./_ctx');
+var anInstance = require('./_an-instance');
+var forOf = require('./_for-of');
+var $iterDefine = require('./_iter-define');
+var step = require('./_iter-step');
+var setSpecies = require('./_set-species');
+var DESCRIPTORS = require('./_descriptors');
+var fastKey = require('./_meta').fastKey;
+var validate = require('./_validate-collection');
+var SIZE = DESCRIPTORS ? '_s' : 'size';
+
+var getEntry = function (that, key) {
+ // fast case
+ var index = fastKey(key);
+ var entry;
+ if (index !== 'F') return that._i[index];
+ // frozen object case
+ for (entry = that._f; entry; entry = entry.n) {
+ if (entry.k == key) return entry;
+ }
+};
+
+module.exports = {
+ getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
+ var C = wrapper(function (that, iterable) {
+ anInstance(that, C, NAME, '_i');
+ that._t = NAME; // collection type
+ that._i = create(null); // index
+ that._f = undefined; // first entry
+ that._l = undefined; // last entry
+ that[SIZE] = 0; // size
+ if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
+ });
+ redefineAll(C.prototype, {
+ // 23.1.3.1 Map.prototype.clear()
+ // 23.2.3.2 Set.prototype.clear()
+ clear: function clear() {
+ for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
+ entry.r = true;
+ if (entry.p) entry.p = entry.p.n = undefined;
+ delete data[entry.i];
+ }
+ that._f = that._l = undefined;
+ that[SIZE] = 0;
+ },
+ // 23.1.3.3 Map.prototype.delete(key)
+ // 23.2.3.4 Set.prototype.delete(value)
+ 'delete': function (key) {
+ var that = validate(this, NAME);
+ var entry = getEntry(that, key);
+ if (entry) {
+ var next = entry.n;
+ var prev = entry.p;
+ delete that._i[entry.i];
+ entry.r = true;
+ if (prev) prev.n = next;
+ if (next) next.p = prev;
+ if (that._f == entry) that._f = next;
+ if (that._l == entry) that._l = prev;
+ that[SIZE]--;
+ } return !!entry;
+ },
+ // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
+ // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
+ forEach: function forEach(callbackfn /* , that = undefined */) {
+ validate(this, NAME);
+ var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
+ var entry;
+ while (entry = entry ? entry.n : this._f) {
+ f(entry.v, entry.k, this);
+ // revert to the last existing entry
+ while (entry && entry.r) entry = entry.p;
+ }
+ },
+ // 23.1.3.7 Map.prototype.has(key)
+ // 23.2.3.7 Set.prototype.has(value)
+ has: function has(key) {
+ return !!getEntry(validate(this, NAME), key);
+ }
+ });
+ if (DESCRIPTORS) dP(C.prototype, 'size', {
+ get: function () {
+ return validate(this, NAME)[SIZE];
+ }
+ });
+ return C;
+ },
+ def: function (that, key, value) {
+ var entry = getEntry(that, key);
+ var prev, index;
+ // change existing entry
+ if (entry) {
+ entry.v = value;
+ // create new entry
+ } else {
+ that._l = entry = {
+ i: index = fastKey(key, true), // <- index
+ k: key, // <- key
+ v: value, // <- value
+ p: prev = that._l, // <- previous entry
+ n: undefined, // <- next entry
+ r: false // <- removed
+ };
+ if (!that._f) that._f = entry;
+ if (prev) prev.n = entry;
+ that[SIZE]++;
+ // add to index
+ if (index !== 'F') that._i[index] = entry;
+ } return that;
+ },
+ getEntry: getEntry,
+ setStrong: function (C, NAME, IS_MAP) {
+ // add .keys, .values, .entries, [@@iterator]
+ // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
+ $iterDefine(C, NAME, function (iterated, kind) {
+ this._t = validate(iterated, NAME); // target
+ this._k = kind; // kind
+ this._l = undefined; // previous
+ }, function () {
+ var that = this;
+ var kind = that._k;
+ var entry = that._l;
+ // revert to the last existing entry
+ while (entry && entry.r) entry = entry.p;
+ // get next entry
+ if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
+ // or finish the iteration
+ that._t = undefined;
+ return step(1);
+ }
+ // return step by kind
+ if (kind == 'keys') return step(0, entry.k);
+ if (kind == 'values') return step(0, entry.v);
+ return step(0, [entry.k, entry.v]);
+ }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
+
+ // add [@@species], 23.1.2.2, 23.2.2.2
+ setSpecies(NAME);
+ }
+};
+
+},{"./_an-instance":140,"./_ctx":159,"./_descriptors":163,"./_for-of":173,"./_iter-define":190,"./_iter-step":192,"./_meta":200,"./_object-create":205,"./_object-dp":206,"./_redefine-all":225,"./_set-species":234,"./_validate-collection":260}],154:[function(require,module,exports){
+// https://github.com/DavidBruant/Map-Set.prototype.toJSON
+var classof = require('./_classof');
+var from = require('./_array-from-iterable');
+module.exports = function (NAME) {
+ return function toJSON() {
+ if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
+ return from(this);
+ };
+};
+
+},{"./_array-from-iterable":144,"./_classof":151}],155:[function(require,module,exports){
+'use strict';
+var redefineAll = require('./_redefine-all');
+var getWeak = require('./_meta').getWeak;
+var anObject = require('./_an-object');
+var isObject = require('./_is-object');
+var anInstance = require('./_an-instance');
+var forOf = require('./_for-of');
+var createArrayMethod = require('./_array-methods');
+var $has = require('./_has');
+var validate = require('./_validate-collection');
+var arrayFind = createArrayMethod(5);
+var arrayFindIndex = createArrayMethod(6);
+var id = 0;
+
+// fallback for uncaught frozen keys
+var uncaughtFrozenStore = function (that) {
+ return that._l || (that._l = new UncaughtFrozenStore());
+};
+var UncaughtFrozenStore = function () {
+ this.a = [];
+};
+var findUncaughtFrozen = function (store, key) {
+ return arrayFind(store.a, function (it) {
+ return it[0] === key;
+ });
+};
+UncaughtFrozenStore.prototype = {
+ get: function (key) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) return entry[1];
+ },
+ has: function (key) {
+ return !!findUncaughtFrozen(this, key);
+ },
+ set: function (key, value) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) entry[1] = value;
+ else this.a.push([key, value]);
+ },
+ 'delete': function (key) {
+ var index = arrayFindIndex(this.a, function (it) {
+ return it[0] === key;
+ });
+ if (~index) this.a.splice(index, 1);
+ return !!~index;
+ }
+};
+
+module.exports = {
+ getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
+ var C = wrapper(function (that, iterable) {
+ anInstance(that, C, NAME, '_i');
+ that._t = NAME; // collection type
+ that._i = id++; // collection id
+ that._l = undefined; // leak store for uncaught frozen objects
+ if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
+ });
+ redefineAll(C.prototype, {
+ // 23.3.3.2 WeakMap.prototype.delete(key)
+ // 23.4.3.3 WeakSet.prototype.delete(value)
+ 'delete': function (key) {
+ if (!isObject(key)) return false;
+ var data = getWeak(key);
+ if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
+ return data && $has(data, this._i) && delete data[this._i];
+ },
+ // 23.3.3.4 WeakMap.prototype.has(key)
+ // 23.4.3.4 WeakSet.prototype.has(value)
+ has: function has(key) {
+ if (!isObject(key)) return false;
+ var data = getWeak(key);
+ if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
+ return data && $has(data, this._i);
+ }
+ });
+ return C;
+ },
+ def: function (that, key, value) {
+ var data = getWeak(anObject(key), true);
+ if (data === true) uncaughtFrozenStore(that).set(key, value);
+ else data[that._i] = value;
+ return that;
+ },
+ ufstore: uncaughtFrozenStore
+};
+
+},{"./_an-instance":140,"./_an-object":141,"./_array-methods":146,"./_for-of":173,"./_has":176,"./_is-object":186,"./_meta":200,"./_redefine-all":225,"./_validate-collection":260}],156:[function(require,module,exports){
+'use strict';
+var global = require('./_global');
+var $export = require('./_export');
+var redefine = require('./_redefine');
+var redefineAll = require('./_redefine-all');
+var meta = require('./_meta');
+var forOf = require('./_for-of');
+var anInstance = require('./_an-instance');
+var isObject = require('./_is-object');
+var fails = require('./_fails');
+var $iterDetect = require('./_iter-detect');
+var setToStringTag = require('./_set-to-string-tag');
+var inheritIfRequired = require('./_inherit-if-required');
+
+module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
+ var Base = global[NAME];
+ var C = Base;
+ var ADDER = IS_MAP ? 'set' : 'add';
+ var proto = C && C.prototype;
+ var O = {};
+ var fixMethod = function (KEY) {
+ var fn = proto[KEY];
+ redefine(proto, KEY,
+ KEY == 'delete' ? function (a) {
+ return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
+ } : KEY == 'has' ? function has(a) {
+ return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
+ } : KEY == 'get' ? function get(a) {
+ return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
+ } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; }
+ : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; }
+ );
+ };
+ if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
+ new C().entries().next();
+ }))) {
+ // create collection constructor
+ C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
+ redefineAll(C.prototype, methods);
+ meta.NEED = true;
+ } else {
+ var instance = new C();
+ // early implementations not supports chaining
+ var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
+ // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
+ var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
+ // most early implementations doesn't supports iterables, most modern - not close it correctly
+ var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new
+ // for early implementations -0 and +0 not the same
+ var BUGGY_ZERO = !IS_WEAK && fails(function () {
+ // V8 ~ Chromium 42- fails only with 5+ elements
+ var $instance = new C();
+ var index = 5;
+ while (index--) $instance[ADDER](index, index);
+ return !$instance.has(-0);
+ });
+ if (!ACCEPT_ITERABLES) {
+ C = wrapper(function (target, iterable) {
+ anInstance(target, C, NAME);
+ var that = inheritIfRequired(new Base(), target, C);
+ if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
+ return that;
+ });
+ C.prototype = proto;
+ proto.constructor = C;
+ }
+ if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
+ fixMethod('delete');
+ fixMethod('has');
+ IS_MAP && fixMethod('get');
+ }
+ if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
+ // weak collections should not contains .clear method
+ if (IS_WEAK && proto.clear) delete proto.clear;
+ }
+
+ setToStringTag(C, NAME);
+
+ O[NAME] = C;
+ $export($export.G + $export.W + $export.F * (C != Base), O);
+
+ if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
+
+ return C;
+};
+
+},{"./_an-instance":140,"./_export":167,"./_fails":169,"./_for-of":173,"./_global":175,"./_inherit-if-required":180,"./_is-object":186,"./_iter-detect":191,"./_meta":200,"./_redefine":226,"./_redefine-all":225,"./_set-to-string-tag":235}],157:[function(require,module,exports){
+var core = module.exports = { version: '2.6.5' };
+if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
+
+},{}],158:[function(require,module,exports){
+'use strict';
+var $defineProperty = require('./_object-dp');
+var createDesc = require('./_property-desc');
+
+module.exports = function (object, index, value) {
+ if (index in object) $defineProperty.f(object, index, createDesc(0, value));
+ else object[index] = value;
+};
+
+},{"./_object-dp":206,"./_property-desc":224}],159:[function(require,module,exports){
+// optional / simple context binding
+var aFunction = require('./_a-function');
+module.exports = function (fn, that, length) {
+ aFunction(fn);
+ if (that === undefined) return fn;
+ switch (length) {
+ case 1: return function (a) {
+ return fn.call(that, a);
+ };
+ case 2: return function (a, b) {
+ return fn.call(that, a, b);
+ };
+ case 3: return function (a, b, c) {
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function (/* ...args */) {
+ return fn.apply(that, arguments);
+ };
+};
+
+},{"./_a-function":136}],160:[function(require,module,exports){
+'use strict';
+// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
+var fails = require('./_fails');
+var getTime = Date.prototype.getTime;
+var $toISOString = Date.prototype.toISOString;
+
+var lz = function (num) {
+ return num > 9 ? num : '0' + num;
+};
+
+// PhantomJS / old WebKit has a broken implementations
+module.exports = (fails(function () {
+ return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z';
+}) || !fails(function () {
+ $toISOString.call(new Date(NaN));
+})) ? function toISOString() {
+ if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value');
+ var d = this;
+ var y = d.getUTCFullYear();
+ var m = d.getUTCMilliseconds();
+ var s = y < 0 ? '-' : y > 9999 ? '+' : '';
+ return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
+ '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
+ 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
+ ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
+} : $toISOString;
+
+},{"./_fails":169}],161:[function(require,module,exports){
+'use strict';
+var anObject = require('./_an-object');
+var toPrimitive = require('./_to-primitive');
+var NUMBER = 'number';
+
+module.exports = function (hint) {
+ if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint');
+ return toPrimitive(anObject(this), hint != NUMBER);
+};
+
+},{"./_an-object":141,"./_to-primitive":254}],162:[function(require,module,exports){
+// 7.2.1 RequireObjectCoercible(argument)
+module.exports = function (it) {
+ if (it == undefined) throw TypeError("Can't call method on " + it);
+ return it;
+};
+
+},{}],163:[function(require,module,exports){
+// Thank's IE8 for his funny defineProperty
+module.exports = !require('./_fails')(function () {
+ return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
+});
+
+},{"./_fails":169}],164:[function(require,module,exports){
+var isObject = require('./_is-object');
+var document = require('./_global').document;
+// typeof document.createElement is 'object' in old IE
+var is = isObject(document) && isObject(document.createElement);
+module.exports = function (it) {
+ return is ? document.createElement(it) : {};
+};
+
+},{"./_global":175,"./_is-object":186}],165:[function(require,module,exports){
+// IE 8- don't enum bug keys
+module.exports = (
+ 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
+).split(',');
+
+},{}],166:[function(require,module,exports){
+// all enumerable object keys, includes symbols
+var getKeys = require('./_object-keys');
+var gOPS = require('./_object-gops');
+var pIE = require('./_object-pie');
+module.exports = function (it) {
+ var result = getKeys(it);
+ var getSymbols = gOPS.f;
+ if (getSymbols) {
+ var symbols = getSymbols(it);
+ var isEnum = pIE.f;
+ var i = 0;
+ var key;
+ while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
+ } return result;
+};
+
+},{"./_object-gops":212,"./_object-keys":215,"./_object-pie":216}],167:[function(require,module,exports){
+var global = require('./_global');
+var core = require('./_core');
+var hide = require('./_hide');
+var redefine = require('./_redefine');
+var ctx = require('./_ctx');
+var PROTOTYPE = 'prototype';
+
+var $export = function (type, name, source) {
+ var IS_FORCED = type & $export.F;
+ var IS_GLOBAL = type & $export.G;
+ var IS_STATIC = type & $export.S;
+ var IS_PROTO = type & $export.P;
+ var IS_BIND = type & $export.B;
+ var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
+ var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
+ var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
+ var key, own, out, exp;
+ if (IS_GLOBAL) source = name;
+ for (key in source) {
+ // contains in native
+ own = !IS_FORCED && target && target[key] !== undefined;
+ // export native or passed
+ out = (own ? target : source)[key];
+ // bind timers to global for call from export context
+ exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
+ // extend global
+ if (target) redefine(target, key, out, type & $export.U);
+ // export
+ if (exports[key] != out) hide(exports, key, exp);
+ if (IS_PROTO && expProto[key] != out) expProto[key] = out;
+ }
+};
+global.core = core;
+// type bitmap
+$export.F = 1; // forced
+$export.G = 2; // global
+$export.S = 4; // static
+$export.P = 8; // proto
+$export.B = 16; // bind
+$export.W = 32; // wrap
+$export.U = 64; // safe
+$export.R = 128; // real proto method for `library`
+module.exports = $export;
+
+},{"./_core":157,"./_ctx":159,"./_global":175,"./_hide":177,"./_redefine":226}],168:[function(require,module,exports){
+var MATCH = require('./_wks')('match');
+module.exports = function (KEY) {
+ var re = /./;
+ try {
+ '/./'[KEY](re);
+ } catch (e) {
+ try {
+ re[MATCH] = false;
+ return !'/./'[KEY](re);
+ } catch (f) { /* empty */ }
+ } return true;
+};
+
+},{"./_wks":263}],169:[function(require,module,exports){
+module.exports = function (exec) {
+ try {
+ return !!exec();
+ } catch (e) {
+ return true;
+ }
+};
+
+},{}],170:[function(require,module,exports){
+'use strict';
+require('./es6.regexp.exec');
+var redefine = require('./_redefine');
+var hide = require('./_hide');
+var fails = require('./_fails');
+var defined = require('./_defined');
+var wks = require('./_wks');
+var regexpExec = require('./_regexp-exec');
+
+var SPECIES = wks('species');
+
+var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
+ // #replace needs built-in support for named groups.
+ // #match works fine because it just return the exec results, even if it has
+ // a "grops" property.
+ var re = /./;
+ re.exec = function () {
+ var result = [];
+ result.groups = { a: '7' };
+ return result;
+ };
+ return ''.replace(re, '$') !== '7';
+});
+
+var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () {
+ // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
+ var re = /(?:)/;
+ var originalExec = re.exec;
+ re.exec = function () { return originalExec.apply(this, arguments); };
+ var result = 'ab'.split(re);
+ return result.length === 2 && result[0] === 'a' && result[1] === 'b';
+})();
+
+module.exports = function (KEY, length, exec) {
+ var SYMBOL = wks(KEY);
+
+ var DELEGATES_TO_SYMBOL = !fails(function () {
+ // String methods call symbol-named RegEp methods
+ var O = {};
+ O[SYMBOL] = function () { return 7; };
+ return ''[KEY](O) != 7;
+ });
+
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {
+ // Symbol-named RegExp methods call .exec
+ var execCalled = false;
+ var re = /a/;
+ re.exec = function () { execCalled = true; return null; };
+ if (KEY === 'split') {
+ // RegExp[@@split] doesn't call the regex's exec method, but first creates
+ // a new one. We need to return the patched regex when creating the new one.
+ re.constructor = {};
+ re.constructor[SPECIES] = function () { return re; };
+ }
+ re[SYMBOL]('');
+ return !execCalled;
+ }) : undefined;
+
+ if (
+ !DELEGATES_TO_SYMBOL ||
+ !DELEGATES_TO_EXEC ||
+ (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
+ (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
+ ) {
+ var nativeRegExpMethod = /./[SYMBOL];
+ var fns = exec(
+ defined,
+ SYMBOL,
+ ''[KEY],
+ function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {
+ if (regexp.exec === regexpExec) {
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
+ // The native String method already delegates to @@method (this
+ // polyfilled function), leasing to infinite recursion.
+ // We avoid it by directly calling the native @@method method.
+ return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
+ }
+ return { done: true, value: nativeMethod.call(str, regexp, arg2) };
+ }
+ return { done: false };
+ }
+ );
+ var strfn = fns[0];
+ var rxfn = fns[1];
+
+ redefine(String.prototype, KEY, strfn);
+ hide(RegExp.prototype, SYMBOL, length == 2
+ // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
+ // 21.2.5.11 RegExp.prototype[@@split](string, limit)
+ ? function (string, arg) { return rxfn.call(string, this, arg); }
+ // 21.2.5.6 RegExp.prototype[@@match](string)
+ // 21.2.5.9 RegExp.prototype[@@search](string)
+ : function (string) { return rxfn.call(string, this); }
+ );
+ }
+};
+
+},{"./_defined":162,"./_fails":169,"./_hide":177,"./_redefine":226,"./_regexp-exec":228,"./_wks":263,"./es6.regexp.exec":360}],171:[function(require,module,exports){
+'use strict';
+// 21.2.5.3 get RegExp.prototype.flags
+var anObject = require('./_an-object');
+module.exports = function () {
+ var that = anObject(this);
+ var result = '';
+ if (that.global) result += 'g';
+ if (that.ignoreCase) result += 'i';
+ if (that.multiline) result += 'm';
+ if (that.unicode) result += 'u';
+ if (that.sticky) result += 'y';
+ return result;
+};
+
+},{"./_an-object":141}],172:[function(require,module,exports){
+'use strict';
+// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
+var isArray = require('./_is-array');
+var isObject = require('./_is-object');
+var toLength = require('./_to-length');
+var ctx = require('./_ctx');
+var IS_CONCAT_SPREADABLE = require('./_wks')('isConcatSpreadable');
+
+function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) {
+ var targetIndex = start;
+ var sourceIndex = 0;
+ var mapFn = mapper ? ctx(mapper, thisArg, 3) : false;
+ var element, spreadable;
+
+ while (sourceIndex < sourceLen) {
+ if (sourceIndex in source) {
+ element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
+
+ spreadable = false;
+ if (isObject(element)) {
+ spreadable = element[IS_CONCAT_SPREADABLE];
+ spreadable = spreadable !== undefined ? !!spreadable : isArray(element);
+ }
+
+ if (spreadable && depth > 0) {
+ targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
+ } else {
+ if (targetIndex >= 0x1fffffffffffff) throw TypeError();
+ target[targetIndex] = element;
+ }
+
+ targetIndex++;
+ }
+ sourceIndex++;
+ }
+ return targetIndex;
+}
+
+module.exports = flattenIntoArray;
+
+},{"./_ctx":159,"./_is-array":184,"./_is-object":186,"./_to-length":252,"./_wks":263}],173:[function(require,module,exports){
+var ctx = require('./_ctx');
+var call = require('./_iter-call');
+var isArrayIter = require('./_is-array-iter');
+var anObject = require('./_an-object');
+var toLength = require('./_to-length');
+var getIterFn = require('./core.get-iterator-method');
+var BREAK = {};
+var RETURN = {};
+var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
+ var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
+ var f = ctx(fn, that, entries ? 2 : 1);
+ var index = 0;
+ var length, step, iterator, result;
+ if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
+ // fast case for arrays with default iterator
+ if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
+ result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
+ if (result === BREAK || result === RETURN) return result;
+ } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
+ result = call(iterator, f, step.value, entries);
+ if (result === BREAK || result === RETURN) return result;
+ }
+};
+exports.BREAK = BREAK;
+exports.RETURN = RETURN;
+
+},{"./_an-object":141,"./_ctx":159,"./_is-array-iter":183,"./_iter-call":188,"./_to-length":252,"./core.get-iterator-method":264}],174:[function(require,module,exports){
+module.exports = require('./_shared')('native-function-to-string', Function.toString);
+
+},{"./_shared":237}],175:[function(require,module,exports){
+// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
+var global = module.exports = typeof window != 'undefined' && window.Math == Math
+ ? window : typeof self != 'undefined' && self.Math == Math ? self
+ // eslint-disable-next-line no-new-func
+ : Function('return this')();
+if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
+
+},{}],176:[function(require,module,exports){
+var hasOwnProperty = {}.hasOwnProperty;
+module.exports = function (it, key) {
+ return hasOwnProperty.call(it, key);
+};
+
+},{}],177:[function(require,module,exports){
+var dP = require('./_object-dp');
+var createDesc = require('./_property-desc');
+module.exports = require('./_descriptors') ? function (object, key, value) {
+ return dP.f(object, key, createDesc(1, value));
+} : function (object, key, value) {
+ object[key] = value;
+ return object;
+};
+
+},{"./_descriptors":163,"./_object-dp":206,"./_property-desc":224}],178:[function(require,module,exports){
+var document = require('./_global').document;
+module.exports = document && document.documentElement;
+
+},{"./_global":175}],179:[function(require,module,exports){
+module.exports = !require('./_descriptors') && !require('./_fails')(function () {
+ return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
+});
+
+},{"./_descriptors":163,"./_dom-create":164,"./_fails":169}],180:[function(require,module,exports){
+var isObject = require('./_is-object');
+var setPrototypeOf = require('./_set-proto').set;
+module.exports = function (that, target, C) {
+ var S = target.constructor;
+ var P;
+ if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
+ setPrototypeOf(that, P);
+ } return that;
+};
+
+},{"./_is-object":186,"./_set-proto":233}],181:[function(require,module,exports){
+// fast apply, http://jsperf.lnkit.com/fast-apply/5
+module.exports = function (fn, args, that) {
+ var un = that === undefined;
+ switch (args.length) {
+ case 0: return un ? fn()
+ : fn.call(that);
+ case 1: return un ? fn(args[0])
+ : fn.call(that, args[0]);
+ case 2: return un ? fn(args[0], args[1])
+ : fn.call(that, args[0], args[1]);
+ case 3: return un ? fn(args[0], args[1], args[2])
+ : fn.call(that, args[0], args[1], args[2]);
+ case 4: return un ? fn(args[0], args[1], args[2], args[3])
+ : fn.call(that, args[0], args[1], args[2], args[3]);
+ } return fn.apply(that, args);
+};
+
+},{}],182:[function(require,module,exports){
+// fallback for non-array-like ES3 and non-enumerable old V8 strings
+var cof = require('./_cof');
+// eslint-disable-next-line no-prototype-builtins
+module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
+ return cof(it) == 'String' ? it.split('') : Object(it);
+};
+
+},{"./_cof":152}],183:[function(require,module,exports){
+// check on default Array iterator
+var Iterators = require('./_iterators');
+var ITERATOR = require('./_wks')('iterator');
+var ArrayProto = Array.prototype;
+
+module.exports = function (it) {
+ return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
+};
+
+},{"./_iterators":193,"./_wks":263}],184:[function(require,module,exports){
+// 7.2.2 IsArray(argument)
+var cof = require('./_cof');
+module.exports = Array.isArray || function isArray(arg) {
+ return cof(arg) == 'Array';
+};
+
+},{"./_cof":152}],185:[function(require,module,exports){
+// 20.1.2.3 Number.isInteger(number)
+var isObject = require('./_is-object');
+var floor = Math.floor;
+module.exports = function isInteger(it) {
+ return !isObject(it) && isFinite(it) && floor(it) === it;
+};
+
+},{"./_is-object":186}],186:[function(require,module,exports){
+module.exports = function (it) {
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
+};
+
+},{}],187:[function(require,module,exports){
+// 7.2.8 IsRegExp(argument)
+var isObject = require('./_is-object');
+var cof = require('./_cof');
+var MATCH = require('./_wks')('match');
+module.exports = function (it) {
+ var isRegExp;
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
+};
+
+},{"./_cof":152,"./_is-object":186,"./_wks":263}],188:[function(require,module,exports){
+// call something on iterator step with safe closing on error
+var anObject = require('./_an-object');
+module.exports = function (iterator, fn, value, entries) {
+ try {
+ return entries ? fn(anObject(value)[0], value[1]) : fn(value);
+ // 7.4.6 IteratorClose(iterator, completion)
+ } catch (e) {
+ var ret = iterator['return'];
+ if (ret !== undefined) anObject(ret.call(iterator));
+ throw e;
+ }
+};
+
+},{"./_an-object":141}],189:[function(require,module,exports){
+'use strict';
+var create = require('./_object-create');
+var descriptor = require('./_property-desc');
+var setToStringTag = require('./_set-to-string-tag');
+var IteratorPrototype = {};
+
+// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
+require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
+
+module.exports = function (Constructor, NAME, next) {
+ Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
+ setToStringTag(Constructor, NAME + ' Iterator');
+};
+
+},{"./_hide":177,"./_object-create":205,"./_property-desc":224,"./_set-to-string-tag":235,"./_wks":263}],190:[function(require,module,exports){
+'use strict';
+var LIBRARY = require('./_library');
+var $export = require('./_export');
+var redefine = require('./_redefine');
+var hide = require('./_hide');
+var Iterators = require('./_iterators');
+var $iterCreate = require('./_iter-create');
+var setToStringTag = require('./_set-to-string-tag');
+var getPrototypeOf = require('./_object-gpo');
+var ITERATOR = require('./_wks')('iterator');
+var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
+var FF_ITERATOR = '@@iterator';
+var KEYS = 'keys';
+var VALUES = 'values';
+
+var returnThis = function () { return this; };
+
+module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
+ $iterCreate(Constructor, NAME, next);
+ var getMethod = function (kind) {
+ if (!BUGGY && kind in proto) return proto[kind];
+ switch (kind) {
+ case KEYS: return function keys() { return new Constructor(this, kind); };
+ case VALUES: return function values() { return new Constructor(this, kind); };
+ } return function entries() { return new Constructor(this, kind); };
+ };
+ var TAG = NAME + ' Iterator';
+ var DEF_VALUES = DEFAULT == VALUES;
+ var VALUES_BUG = false;
+ var proto = Base.prototype;
+ var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
+ var $default = $native || getMethod(DEFAULT);
+ var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
+ var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
+ var methods, key, IteratorPrototype;
+ // Fix native
+ if ($anyNative) {
+ IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
+ if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
+ // Set @@toStringTag to native iterators
+ setToStringTag(IteratorPrototype, TAG, true);
+ // fix for some old engines
+ if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
+ }
+ }
+ // fix Array#{values, @@iterator}.name in V8 / FF
+ if (DEF_VALUES && $native && $native.name !== VALUES) {
+ VALUES_BUG = true;
+ $default = function values() { return $native.call(this); };
+ }
+ // Define iterator
+ if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
+ hide(proto, ITERATOR, $default);
+ }
+ // Plug for library
+ Iterators[NAME] = $default;
+ Iterators[TAG] = returnThis;
+ if (DEFAULT) {
+ methods = {
+ values: DEF_VALUES ? $default : getMethod(VALUES),
+ keys: IS_SET ? $default : getMethod(KEYS),
+ entries: $entries
+ };
+ if (FORCED) for (key in methods) {
+ if (!(key in proto)) redefine(proto, key, methods[key]);
+ } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
+ }
+ return methods;
+};
+
+},{"./_export":167,"./_hide":177,"./_iter-create":189,"./_iterators":193,"./_library":194,"./_object-gpo":213,"./_redefine":226,"./_set-to-string-tag":235,"./_wks":263}],191:[function(require,module,exports){
+var ITERATOR = require('./_wks')('iterator');
+var SAFE_CLOSING = false;
+
+try {
+ var riter = [7][ITERATOR]();
+ riter['return'] = function () { SAFE_CLOSING = true; };
+ // eslint-disable-next-line no-throw-literal
+ Array.from(riter, function () { throw 2; });
+} catch (e) { /* empty */ }
+
+module.exports = function (exec, skipClosing) {
+ if (!skipClosing && !SAFE_CLOSING) return false;
+ var safe = false;
+ try {
+ var arr = [7];
+ var iter = arr[ITERATOR]();
+ iter.next = function () { return { done: safe = true }; };
+ arr[ITERATOR] = function () { return iter; };
+ exec(arr);
+ } catch (e) { /* empty */ }
+ return safe;
+};
+
+},{"./_wks":263}],192:[function(require,module,exports){
+module.exports = function (done, value) {
+ return { value: value, done: !!done };
+};
+
+},{}],193:[function(require,module,exports){
+module.exports = {};
+
+},{}],194:[function(require,module,exports){
+module.exports = false;
+
+},{}],195:[function(require,module,exports){
+// 20.2.2.14 Math.expm1(x)
+var $expm1 = Math.expm1;
+module.exports = (!$expm1
+ // Old FF bug
+ || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
+ // Tor Browser bug
+ || $expm1(-2e-17) != -2e-17
+) ? function expm1(x) {
+ return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
+} : $expm1;
+
+},{}],196:[function(require,module,exports){
+// 20.2.2.16 Math.fround(x)
+var sign = require('./_math-sign');
+var pow = Math.pow;
+var EPSILON = pow(2, -52);
+var EPSILON32 = pow(2, -23);
+var MAX32 = pow(2, 127) * (2 - EPSILON32);
+var MIN32 = pow(2, -126);
+
+var roundTiesToEven = function (n) {
+ return n + 1 / EPSILON - 1 / EPSILON;
+};
+
+module.exports = Math.fround || function fround(x) {
+ var $abs = Math.abs(x);
+ var $sign = sign(x);
+ var a, result;
+ if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
+ a = (1 + EPSILON32 / EPSILON) * $abs;
+ result = a - (a - $abs);
+ // eslint-disable-next-line no-self-compare
+ if (result > MAX32 || result != result) return $sign * Infinity;
+ return $sign * result;
+};
+
+},{"./_math-sign":199}],197:[function(require,module,exports){
+// 20.2.2.20 Math.log1p(x)
+module.exports = Math.log1p || function log1p(x) {
+ return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
+};
+
+},{}],198:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
+ if (
+ arguments.length === 0
+ // eslint-disable-next-line no-self-compare
+ || x != x
+ // eslint-disable-next-line no-self-compare
+ || inLow != inLow
+ // eslint-disable-next-line no-self-compare
+ || inHigh != inHigh
+ // eslint-disable-next-line no-self-compare
+ || outLow != outLow
+ // eslint-disable-next-line no-self-compare
+ || outHigh != outHigh
+ ) return NaN;
+ if (x === Infinity || x === -Infinity) return x;
+ return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;
+};
+
+},{}],199:[function(require,module,exports){
+// 20.2.2.28 Math.sign(x)
+module.exports = Math.sign || function sign(x) {
+ // eslint-disable-next-line no-self-compare
+ return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
+};
+
+},{}],200:[function(require,module,exports){
+var META = require('./_uid')('meta');
+var isObject = require('./_is-object');
+var has = require('./_has');
+var setDesc = require('./_object-dp').f;
+var id = 0;
+var isExtensible = Object.isExtensible || function () {
+ return true;
+};
+var FREEZE = !require('./_fails')(function () {
+ return isExtensible(Object.preventExtensions({}));
+});
+var setMeta = function (it) {
+ setDesc(it, META, { value: {
+ i: 'O' + ++id, // object ID
+ w: {} // weak collections IDs
+ } });
+};
+var fastKey = function (it, create) {
+ // return primitive with prefix
+ if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
+ if (!has(it, META)) {
+ // can't set metadata to uncaught frozen object
+ if (!isExtensible(it)) return 'F';
+ // not necessary to add metadata
+ if (!create) return 'E';
+ // add missing metadata
+ setMeta(it);
+ // return object ID
+ } return it[META].i;
+};
+var getWeak = function (it, create) {
+ if (!has(it, META)) {
+ // can't set metadata to uncaught frozen object
+ if (!isExtensible(it)) return true;
+ // not necessary to add metadata
+ if (!create) return false;
+ // add missing metadata
+ setMeta(it);
+ // return hash weak collections IDs
+ } return it[META].w;
+};
+// add metadata on freeze-family methods calling
+var onFreeze = function (it) {
+ if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
+ return it;
+};
+var meta = module.exports = {
+ KEY: META,
+ NEED: false,
+ fastKey: fastKey,
+ getWeak: getWeak,
+ onFreeze: onFreeze
+};
+
+},{"./_fails":169,"./_has":176,"./_is-object":186,"./_object-dp":206,"./_uid":258}],201:[function(require,module,exports){
+var Map = require('./es6.map');
+var $export = require('./_export');
+var shared = require('./_shared')('metadata');
+var store = shared.store || (shared.store = new (require('./es6.weak-map'))());
+
+var getOrCreateMetadataMap = function (target, targetKey, create) {
+ var targetMetadata = store.get(target);
+ if (!targetMetadata) {
+ if (!create) return undefined;
+ store.set(target, targetMetadata = new Map());
+ }
+ var keyMetadata = targetMetadata.get(targetKey);
+ if (!keyMetadata) {
+ if (!create) return undefined;
+ targetMetadata.set(targetKey, keyMetadata = new Map());
+ } return keyMetadata;
+};
+var ordinaryHasOwnMetadata = function (MetadataKey, O, P) {
+ var metadataMap = getOrCreateMetadataMap(O, P, false);
+ return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
+};
+var ordinaryGetOwnMetadata = function (MetadataKey, O, P) {
+ var metadataMap = getOrCreateMetadataMap(O, P, false);
+ return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
+};
+var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) {
+ getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
+};
+var ordinaryOwnMetadataKeys = function (target, targetKey) {
+ var metadataMap = getOrCreateMetadataMap(target, targetKey, false);
+ var keys = [];
+ if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); });
+ return keys;
+};
+var toMetaKey = function (it) {
+ return it === undefined || typeof it == 'symbol' ? it : String(it);
+};
+var exp = function (O) {
+ $export($export.S, 'Reflect', O);
+};
+
+module.exports = {
+ store: store,
+ map: getOrCreateMetadataMap,
+ has: ordinaryHasOwnMetadata,
+ get: ordinaryGetOwnMetadata,
+ set: ordinaryDefineOwnMetadata,
+ keys: ordinaryOwnMetadataKeys,
+ key: toMetaKey,
+ exp: exp
+};
+
+},{"./_export":167,"./_shared":237,"./es6.map":295,"./es6.weak-map":402}],202:[function(require,module,exports){
+var global = require('./_global');
+var macrotask = require('./_task').set;
+var Observer = global.MutationObserver || global.WebKitMutationObserver;
+var process = global.process;
+var Promise = global.Promise;
+var isNode = require('./_cof')(process) == 'process';
+
+module.exports = function () {
+ var head, last, notify;
+
+ var flush = function () {
+ var parent, fn;
+ if (isNode && (parent = process.domain)) parent.exit();
+ while (head) {
+ fn = head.fn;
+ head = head.next;
+ try {
+ fn();
+ } catch (e) {
+ if (head) notify();
+ else last = undefined;
+ throw e;
+ }
+ } last = undefined;
+ if (parent) parent.enter();
+ };
+
+ // Node.js
+ if (isNode) {
+ notify = function () {
+ process.nextTick(flush);
+ };
+ // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
+ } else if (Observer && !(global.navigator && global.navigator.standalone)) {
+ var toggle = true;
+ var node = document.createTextNode('');
+ new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
+ notify = function () {
+ node.data = toggle = !toggle;
+ };
+ // environments with maybe non-completely correct, but existent Promise
+ } else if (Promise && Promise.resolve) {
+ // Promise.resolve without an argument throws an error in LG WebOS 2
+ var promise = Promise.resolve(undefined);
+ notify = function () {
+ promise.then(flush);
+ };
+ // for other environments - macrotask based on:
+ // - setImmediate
+ // - MessageChannel
+ // - window.postMessag
+ // - onreadystatechange
+ // - setTimeout
+ } else {
+ notify = function () {
+ // strange IE + webpack dev server bug - use .call(global)
+ macrotask.call(global, flush);
+ };
+ }
+
+ return function (fn) {
+ var task = { fn: fn, next: undefined };
+ if (last) last.next = task;
+ if (!head) {
+ head = task;
+ notify();
+ } last = task;
+ };
+};
+
+},{"./_cof":152,"./_global":175,"./_task":247}],203:[function(require,module,exports){
+'use strict';
+// 25.4.1.5 NewPromiseCapability(C)
+var aFunction = require('./_a-function');
+
+function PromiseCapability(C) {
+ var resolve, reject;
+ this.promise = new C(function ($$resolve, $$reject) {
+ if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
+ resolve = $$resolve;
+ reject = $$reject;
+ });
+ this.resolve = aFunction(resolve);
+ this.reject = aFunction(reject);
+}
+
+module.exports.f = function (C) {
+ return new PromiseCapability(C);
+};
+
+},{"./_a-function":136}],204:[function(require,module,exports){
+'use strict';
+// 19.1.2.1 Object.assign(target, source, ...)
+var getKeys = require('./_object-keys');
+var gOPS = require('./_object-gops');
+var pIE = require('./_object-pie');
+var toObject = require('./_to-object');
+var IObject = require('./_iobject');
+var $assign = Object.assign;
+
+// should work with symbols and should have deterministic property order (V8 bug)
+module.exports = !$assign || require('./_fails')(function () {
+ var A = {};
+ var B = {};
+ // eslint-disable-next-line no-undef
+ var S = Symbol();
+ var K = 'abcdefghijklmnopqrst';
+ A[S] = 7;
+ K.split('').forEach(function (k) { B[k] = k; });
+ return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
+}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
+ var T = toObject(target);
+ var aLen = arguments.length;
+ var index = 1;
+ var getSymbols = gOPS.f;
+ var isEnum = pIE.f;
+ while (aLen > index) {
+ var S = IObject(arguments[index++]);
+ var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
+ var length = keys.length;
+ var j = 0;
+ var key;
+ while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
+ } return T;
+} : $assign;
+
+},{"./_fails":169,"./_iobject":182,"./_object-gops":212,"./_object-keys":215,"./_object-pie":216,"./_to-object":253}],205:[function(require,module,exports){
+// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
+var anObject = require('./_an-object');
+var dPs = require('./_object-dps');
+var enumBugKeys = require('./_enum-bug-keys');
+var IE_PROTO = require('./_shared-key')('IE_PROTO');
+var Empty = function () { /* empty */ };
+var PROTOTYPE = 'prototype';
+
+// Create object with fake `null` prototype: use iframe Object with cleared prototype
+var createDict = function () {
+ // Thrash, waste and sodomy: IE GC bug
+ var iframe = require('./_dom-create')('iframe');
+ var i = enumBugKeys.length;
+ var lt = '<';
+ var gt = '>';
+ var iframeDocument;
+ iframe.style.display = 'none';
+ require('./_html').appendChild(iframe);
+ iframe.src = 'javascript:'; // eslint-disable-line no-script-url
+ // createDict = iframe.contentWindow.Object;
+ // html.removeChild(iframe);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
+ iframeDocument.close();
+ createDict = iframeDocument.F;
+ while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
+ return createDict();
+};
+
+module.exports = Object.create || function create(O, Properties) {
+ var result;
+ if (O !== null) {
+ Empty[PROTOTYPE] = anObject(O);
+ result = new Empty();
+ Empty[PROTOTYPE] = null;
+ // add "__proto__" for Object.getPrototypeOf polyfill
+ result[IE_PROTO] = O;
+ } else result = createDict();
+ return Properties === undefined ? result : dPs(result, Properties);
+};
+
+},{"./_an-object":141,"./_dom-create":164,"./_enum-bug-keys":165,"./_html":178,"./_object-dps":207,"./_shared-key":236}],206:[function(require,module,exports){
+var anObject = require('./_an-object');
+var IE8_DOM_DEFINE = require('./_ie8-dom-define');
+var toPrimitive = require('./_to-primitive');
+var dP = Object.defineProperty;
+
+exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if (IE8_DOM_DEFINE) try {
+ return dP(O, P, Attributes);
+ } catch (e) { /* empty */ }
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
+ if ('value' in Attributes) O[P] = Attributes.value;
+ return O;
+};
+
+},{"./_an-object":141,"./_descriptors":163,"./_ie8-dom-define":179,"./_to-primitive":254}],207:[function(require,module,exports){
+var dP = require('./_object-dp');
+var anObject = require('./_an-object');
+var getKeys = require('./_object-keys');
+
+module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
+ anObject(O);
+ var keys = getKeys(Properties);
+ var length = keys.length;
+ var i = 0;
+ var P;
+ while (length > i) dP.f(O, P = keys[i++], Properties[P]);
+ return O;
+};
+
+},{"./_an-object":141,"./_descriptors":163,"./_object-dp":206,"./_object-keys":215}],208:[function(require,module,exports){
+'use strict';
+// Forced replacement prototype accessors methods
+module.exports = require('./_library') || !require('./_fails')(function () {
+ var K = Math.random();
+ // In FF throws only define methods
+ // eslint-disable-next-line no-undef, no-useless-call
+ __defineSetter__.call(null, K, function () { /* empty */ });
+ delete require('./_global')[K];
+});
+
+},{"./_fails":169,"./_global":175,"./_library":194}],209:[function(require,module,exports){
+var pIE = require('./_object-pie');
+var createDesc = require('./_property-desc');
+var toIObject = require('./_to-iobject');
+var toPrimitive = require('./_to-primitive');
+var has = require('./_has');
+var IE8_DOM_DEFINE = require('./_ie8-dom-define');
+var gOPD = Object.getOwnPropertyDescriptor;
+
+exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {
+ O = toIObject(O);
+ P = toPrimitive(P, true);
+ if (IE8_DOM_DEFINE) try {
+ return gOPD(O, P);
+ } catch (e) { /* empty */ }
+ if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
+};
+
+},{"./_descriptors":163,"./_has":176,"./_ie8-dom-define":179,"./_object-pie":216,"./_property-desc":224,"./_to-iobject":251,"./_to-primitive":254}],210:[function(require,module,exports){
+// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
+var toIObject = require('./_to-iobject');
+var gOPN = require('./_object-gopn').f;
+var toString = {}.toString;
+
+var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
+ ? Object.getOwnPropertyNames(window) : [];
+
+var getWindowNames = function (it) {
+ try {
+ return gOPN(it);
+ } catch (e) {
+ return windowNames.slice();
+ }
+};
+
+module.exports.f = function getOwnPropertyNames(it) {
+ return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
+};
+
+},{"./_object-gopn":211,"./_to-iobject":251}],211:[function(require,module,exports){
+// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
+var $keys = require('./_object-keys-internal');
+var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');
+
+exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
+ return $keys(O, hiddenKeys);
+};
+
+},{"./_enum-bug-keys":165,"./_object-keys-internal":214}],212:[function(require,module,exports){
+exports.f = Object.getOwnPropertySymbols;
+
+},{}],213:[function(require,module,exports){
+// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
+var has = require('./_has');
+var toObject = require('./_to-object');
+var IE_PROTO = require('./_shared-key')('IE_PROTO');
+var ObjectProto = Object.prototype;
+
+module.exports = Object.getPrototypeOf || function (O) {
+ O = toObject(O);
+ if (has(O, IE_PROTO)) return O[IE_PROTO];
+ if (typeof O.constructor == 'function' && O instanceof O.constructor) {
+ return O.constructor.prototype;
+ } return O instanceof Object ? ObjectProto : null;
+};
+
+},{"./_has":176,"./_shared-key":236,"./_to-object":253}],214:[function(require,module,exports){
+var has = require('./_has');
+var toIObject = require('./_to-iobject');
+var arrayIndexOf = require('./_array-includes')(false);
+var IE_PROTO = require('./_shared-key')('IE_PROTO');
+
+module.exports = function (object, names) {
+ var O = toIObject(object);
+ var i = 0;
+ var result = [];
+ var key;
+ for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
+ // Don't enum bug & hidden keys
+ while (names.length > i) if (has(O, key = names[i++])) {
+ ~arrayIndexOf(result, key) || result.push(key);
+ }
+ return result;
+};
+
+},{"./_array-includes":145,"./_has":176,"./_shared-key":236,"./_to-iobject":251}],215:[function(require,module,exports){
+// 19.1.2.14 / 15.2.3.14 Object.keys(O)
+var $keys = require('./_object-keys-internal');
+var enumBugKeys = require('./_enum-bug-keys');
+
+module.exports = Object.keys || function keys(O) {
+ return $keys(O, enumBugKeys);
+};
+
+},{"./_enum-bug-keys":165,"./_object-keys-internal":214}],216:[function(require,module,exports){
+exports.f = {}.propertyIsEnumerable;
+
+},{}],217:[function(require,module,exports){
+// most Object methods by ES6 should accept primitives
+var $export = require('./_export');
+var core = require('./_core');
+var fails = require('./_fails');
+module.exports = function (KEY, exec) {
+ var fn = (core.Object || {})[KEY] || Object[KEY];
+ var exp = {};
+ exp[KEY] = exec(fn);
+ $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
+};
+
+},{"./_core":157,"./_export":167,"./_fails":169}],218:[function(require,module,exports){
+var getKeys = require('./_object-keys');
+var toIObject = require('./_to-iobject');
+var isEnum = require('./_object-pie').f;
+module.exports = function (isEntries) {
+ return function (it) {
+ var O = toIObject(it);
+ var keys = getKeys(O);
+ var length = keys.length;
+ var i = 0;
+ var result = [];
+ var key;
+ while (length > i) if (isEnum.call(O, key = keys[i++])) {
+ result.push(isEntries ? [key, O[key]] : O[key]);
+ } return result;
+ };
+};
+
+},{"./_object-keys":215,"./_object-pie":216,"./_to-iobject":251}],219:[function(require,module,exports){
+// all object keys, includes non-enumerable and symbols
+var gOPN = require('./_object-gopn');
+var gOPS = require('./_object-gops');
+var anObject = require('./_an-object');
+var Reflect = require('./_global').Reflect;
+module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
+ var keys = gOPN.f(anObject(it));
+ var getSymbols = gOPS.f;
+ return getSymbols ? keys.concat(getSymbols(it)) : keys;
+};
+
+},{"./_an-object":141,"./_global":175,"./_object-gopn":211,"./_object-gops":212}],220:[function(require,module,exports){
+var $parseFloat = require('./_global').parseFloat;
+var $trim = require('./_string-trim').trim;
+
+module.exports = 1 / $parseFloat(require('./_string-ws') + '-0') !== -Infinity ? function parseFloat(str) {
+ var string = $trim(String(str), 3);
+ var result = $parseFloat(string);
+ return result === 0 && string.charAt(0) == '-' ? -0 : result;
+} : $parseFloat;
+
+},{"./_global":175,"./_string-trim":245,"./_string-ws":246}],221:[function(require,module,exports){
+var $parseInt = require('./_global').parseInt;
+var $trim = require('./_string-trim').trim;
+var ws = require('./_string-ws');
+var hex = /^[-+]?0[xX]/;
+
+module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) {
+ var string = $trim(String(str), 3);
+ return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10));
+} : $parseInt;
+
+},{"./_global":175,"./_string-trim":245,"./_string-ws":246}],222:[function(require,module,exports){
+module.exports = function (exec) {
+ try {
+ return { e: false, v: exec() };
+ } catch (e) {
+ return { e: true, v: e };
+ }
+};
+
+},{}],223:[function(require,module,exports){
+var anObject = require('./_an-object');
+var isObject = require('./_is-object');
+var newPromiseCapability = require('./_new-promise-capability');
+
+module.exports = function (C, x) {
+ anObject(C);
+ if (isObject(x) && x.constructor === C) return x;
+ var promiseCapability = newPromiseCapability.f(C);
+ var resolve = promiseCapability.resolve;
+ resolve(x);
+ return promiseCapability.promise;
+};
+
+},{"./_an-object":141,"./_is-object":186,"./_new-promise-capability":203}],224:[function(require,module,exports){
+module.exports = function (bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value: value
+ };
+};
+
+},{}],225:[function(require,module,exports){
+var redefine = require('./_redefine');
+module.exports = function (target, src, safe) {
+ for (var key in src) redefine(target, key, src[key], safe);
+ return target;
+};
+
+},{"./_redefine":226}],226:[function(require,module,exports){
+var global = require('./_global');
+var hide = require('./_hide');
+var has = require('./_has');
+var SRC = require('./_uid')('src');
+var $toString = require('./_function-to-string');
+var TO_STRING = 'toString';
+var TPL = ('' + $toString).split(TO_STRING);
+
+require('./_core').inspectSource = function (it) {
+ return $toString.call(it);
+};
+
+(module.exports = function (O, key, val, safe) {
+ var isFunction = typeof val == 'function';
+ if (isFunction) has(val, 'name') || hide(val, 'name', key);
+ if (O[key] === val) return;
+ if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
+ if (O === global) {
+ O[key] = val;
+ } else if (!safe) {
+ delete O[key];
+ hide(O, key, val);
+ } else if (O[key]) {
+ O[key] = val;
+ } else {
+ hide(O, key, val);
+ }
+// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
+})(Function.prototype, TO_STRING, function toString() {
+ return typeof this == 'function' && this[SRC] || $toString.call(this);
+});
+
+},{"./_core":157,"./_function-to-string":174,"./_global":175,"./_has":176,"./_hide":177,"./_uid":258}],227:[function(require,module,exports){
+'use strict';
+
+var classof = require('./_classof');
+var builtinExec = RegExp.prototype.exec;
+
+ // `RegExpExec` abstract operation
+// https://tc39.github.io/ecma262/#sec-regexpexec
+module.exports = function (R, S) {
+ var exec = R.exec;
+ if (typeof exec === 'function') {
+ var result = exec.call(R, S);
+ if (typeof result !== 'object') {
+ throw new TypeError('RegExp exec method returned something other than an Object or null');
+ }
+ return result;
+ }
+ if (classof(R) !== 'RegExp') {
+ throw new TypeError('RegExp#exec called on incompatible receiver');
+ }
+ return builtinExec.call(R, S);
+};
+
+},{"./_classof":151}],228:[function(require,module,exports){
+'use strict';
+
+var regexpFlags = require('./_flags');
+
+var nativeExec = RegExp.prototype.exec;
+// This always refers to the native implementation, because the
+// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
+// which loads this file before patching the method.
+var nativeReplace = String.prototype.replace;
+
+var patchedExec = nativeExec;
+
+var LAST_INDEX = 'lastIndex';
+
+var UPDATES_LAST_INDEX_WRONG = (function () {
+ var re1 = /a/,
+ re2 = /b*/g;
+ nativeExec.call(re1, 'a');
+ nativeExec.call(re2, 'a');
+ return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;
+})();
+
+// nonparticipating capturing group, copied from es5-shim's String#split patch.
+var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
+
+var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
+
+if (PATCH) {
+ patchedExec = function exec(str) {
+ var re = this;
+ var lastIndex, reCopy, match, i;
+
+ if (NPCG_INCLUDED) {
+ reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
+ }
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];
+
+ match = nativeExec.call(re, str);
+
+ if (UPDATES_LAST_INDEX_WRONG && match) {
+ re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;
+ }
+ if (NPCG_INCLUDED && match && match.length > 1) {
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
+ // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
+ // eslint-disable-next-line no-loop-func
+ nativeReplace.call(match[0], reCopy, function () {
+ for (i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined) match[i] = undefined;
+ }
+ });
+ }
+
+ return match;
+ };
+}
+
+module.exports = patchedExec;
+
+},{"./_flags":171}],229:[function(require,module,exports){
+module.exports = function (regExp, replace) {
+ var replacer = replace === Object(replace) ? function (part) {
+ return replace[part];
+ } : replace;
+ return function (it) {
+ return String(it).replace(regExp, replacer);
+ };
+};
+
+},{}],230:[function(require,module,exports){
+// 7.2.9 SameValue(x, y)
+module.exports = Object.is || function is(x, y) {
+ // eslint-disable-next-line no-self-compare
+ return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
+};
+
+},{}],231:[function(require,module,exports){
+'use strict';
+// https://tc39.github.io/proposal-setmap-offrom/
+var $export = require('./_export');
+var aFunction = require('./_a-function');
+var ctx = require('./_ctx');
+var forOf = require('./_for-of');
+
+module.exports = function (COLLECTION) {
+ $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
+ var mapFn = arguments[1];
+ var mapping, A, n, cb;
+ aFunction(this);
+ mapping = mapFn !== undefined;
+ if (mapping) aFunction(mapFn);
+ if (source == undefined) return new this();
+ A = [];
+ if (mapping) {
+ n = 0;
+ cb = ctx(mapFn, arguments[2], 2);
+ forOf(source, false, function (nextItem) {
+ A.push(cb(nextItem, n++));
+ });
+ } else {
+ forOf(source, false, A.push, A);
+ }
+ return new this(A);
+ } });
+};
+
+},{"./_a-function":136,"./_ctx":159,"./_export":167,"./_for-of":173}],232:[function(require,module,exports){
+'use strict';
+// https://tc39.github.io/proposal-setmap-offrom/
+var $export = require('./_export');
+
+module.exports = function (COLLECTION) {
+ $export($export.S, COLLECTION, { of: function of() {
+ var length = arguments.length;
+ var A = new Array(length);
+ while (length--) A[length] = arguments[length];
+ return new this(A);
+ } });
+};
+
+},{"./_export":167}],233:[function(require,module,exports){
+// Works with __proto__ only. Old v8 can't work with null proto objects.
+/* eslint-disable no-proto */
+var isObject = require('./_is-object');
+var anObject = require('./_an-object');
+var check = function (O, proto) {
+ anObject(O);
+ if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
+};
+module.exports = {
+ set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
+ function (test, buggy, set) {
+ try {
+ set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);
+ set(test, []);
+ buggy = !(test instanceof Array);
+ } catch (e) { buggy = true; }
+ return function setPrototypeOf(O, proto) {
+ check(O, proto);
+ if (buggy) O.__proto__ = proto;
+ else set(O, proto);
+ return O;
+ };
+ }({}, false) : undefined),
+ check: check
+};
+
+},{"./_an-object":141,"./_ctx":159,"./_is-object":186,"./_object-gopd":209}],234:[function(require,module,exports){
+'use strict';
+var global = require('./_global');
+var dP = require('./_object-dp');
+var DESCRIPTORS = require('./_descriptors');
+var SPECIES = require('./_wks')('species');
+
+module.exports = function (KEY) {
+ var C = global[KEY];
+ if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
+ configurable: true,
+ get: function () { return this; }
+ });
+};
+
+},{"./_descriptors":163,"./_global":175,"./_object-dp":206,"./_wks":263}],235:[function(require,module,exports){
+var def = require('./_object-dp').f;
+var has = require('./_has');
+var TAG = require('./_wks')('toStringTag');
+
+module.exports = function (it, tag, stat) {
+ if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
+};
+
+},{"./_has":176,"./_object-dp":206,"./_wks":263}],236:[function(require,module,exports){
+var shared = require('./_shared')('keys');
+var uid = require('./_uid');
+module.exports = function (key) {
+ return shared[key] || (shared[key] = uid(key));
+};
+
+},{"./_shared":237,"./_uid":258}],237:[function(require,module,exports){
+var core = require('./_core');
+var global = require('./_global');
+var SHARED = '__core-js_shared__';
+var store = global[SHARED] || (global[SHARED] = {});
+
+(module.exports = function (key, value) {
+ return store[key] || (store[key] = value !== undefined ? value : {});
+})('versions', []).push({
+ version: core.version,
+ mode: require('./_library') ? 'pure' : 'global',
+ copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
+});
+
+},{"./_core":157,"./_global":175,"./_library":194}],238:[function(require,module,exports){
+// 7.3.20 SpeciesConstructor(O, defaultConstructor)
+var anObject = require('./_an-object');
+var aFunction = require('./_a-function');
+var SPECIES = require('./_wks')('species');
+module.exports = function (O, D) {
+ var C = anObject(O).constructor;
+ var S;
+ return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
+};
+
+},{"./_a-function":136,"./_an-object":141,"./_wks":263}],239:[function(require,module,exports){
+'use strict';
+var fails = require('./_fails');
+
+module.exports = function (method, arg) {
+ return !!method && fails(function () {
+ // eslint-disable-next-line no-useless-call
+ arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);
+ });
+};
+
+},{"./_fails":169}],240:[function(require,module,exports){
+var toInteger = require('./_to-integer');
+var defined = require('./_defined');
+// true -> String#at
+// false -> String#codePointAt
+module.exports = function (TO_STRING) {
+ return function (that, pos) {
+ var s = String(defined(that));
+ var i = toInteger(pos);
+ var l = s.length;
+ var a, b;
+ if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
+ a = s.charCodeAt(i);
+ return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
+ ? TO_STRING ? s.charAt(i) : a
+ : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
+ };
+};
+
+},{"./_defined":162,"./_to-integer":250}],241:[function(require,module,exports){
+// helper for String#{startsWith, endsWith, includes}
+var isRegExp = require('./_is-regexp');
+var defined = require('./_defined');
+
+module.exports = function (that, searchString, NAME) {
+ if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
+ return String(defined(that));
+};
+
+},{"./_defined":162,"./_is-regexp":187}],242:[function(require,module,exports){
+var $export = require('./_export');
+var fails = require('./_fails');
+var defined = require('./_defined');
+var quot = /"/g;
+// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
+var createHTML = function (string, tag, attribute, value) {
+ var S = String(defined(string));
+ var p1 = '<' + tag;
+ if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"';
+ return p1 + '>' + S + '' + tag + '>';
+};
+module.exports = function (NAME, exec) {
+ var O = {};
+ O[NAME] = exec(createHTML);
+ $export($export.P + $export.F * fails(function () {
+ var test = ''[NAME]('"');
+ return test !== test.toLowerCase() || test.split('"').length > 3;
+ }), 'String', O);
+};
+
+},{"./_defined":162,"./_export":167,"./_fails":169}],243:[function(require,module,exports){
+// https://github.com/tc39/proposal-string-pad-start-end
+var toLength = require('./_to-length');
+var repeat = require('./_string-repeat');
+var defined = require('./_defined');
+
+module.exports = function (that, maxLength, fillString, left) {
+ var S = String(defined(that));
+ var stringLength = S.length;
+ var fillStr = fillString === undefined ? ' ' : String(fillString);
+ var intMaxLength = toLength(maxLength);
+ if (intMaxLength <= stringLength || fillStr == '') return S;
+ var fillLen = intMaxLength - stringLength;
+ var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
+ if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen);
+ return left ? stringFiller + S : S + stringFiller;
+};
+
+},{"./_defined":162,"./_string-repeat":244,"./_to-length":252}],244:[function(require,module,exports){
+'use strict';
+var toInteger = require('./_to-integer');
+var defined = require('./_defined');
+
+module.exports = function repeat(count) {
+ var str = String(defined(this));
+ var res = '';
+ var n = toInteger(count);
+ if (n < 0 || n == Infinity) throw RangeError("Count can't be negative");
+ for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str;
+ return res;
+};
+
+},{"./_defined":162,"./_to-integer":250}],245:[function(require,module,exports){
+var $export = require('./_export');
+var defined = require('./_defined');
+var fails = require('./_fails');
+var spaces = require('./_string-ws');
+var space = '[' + spaces + ']';
+var non = '\u200b\u0085';
+var ltrim = RegExp('^' + space + space + '*');
+var rtrim = RegExp(space + space + '*$');
+
+var exporter = function (KEY, exec, ALIAS) {
+ var exp = {};
+ var FORCE = fails(function () {
+ return !!spaces[KEY]() || non[KEY]() != non;
+ });
+ var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
+ if (ALIAS) exp[ALIAS] = fn;
+ $export($export.P + $export.F * FORCE, 'String', exp);
+};
+
+// 1 -> String#trimLeft
+// 2 -> String#trimRight
+// 3 -> String#trim
+var trim = exporter.trim = function (string, TYPE) {
+ string = String(defined(string));
+ if (TYPE & 1) string = string.replace(ltrim, '');
+ if (TYPE & 2) string = string.replace(rtrim, '');
+ return string;
+};
+
+module.exports = exporter;
+
+},{"./_defined":162,"./_export":167,"./_fails":169,"./_string-ws":246}],246:[function(require,module,exports){
+module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
+ '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
+
+},{}],247:[function(require,module,exports){
+var ctx = require('./_ctx');
+var invoke = require('./_invoke');
+var html = require('./_html');
+var cel = require('./_dom-create');
+var global = require('./_global');
+var process = global.process;
+var setTask = global.setImmediate;
+var clearTask = global.clearImmediate;
+var MessageChannel = global.MessageChannel;
+var Dispatch = global.Dispatch;
+var counter = 0;
+var queue = {};
+var ONREADYSTATECHANGE = 'onreadystatechange';
+var defer, channel, port;
+var run = function () {
+ var id = +this;
+ // eslint-disable-next-line no-prototype-builtins
+ if (queue.hasOwnProperty(id)) {
+ var fn = queue[id];
+ delete queue[id];
+ fn();
+ }
+};
+var listener = function (event) {
+ run.call(event.data);
+};
+// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
+if (!setTask || !clearTask) {
+ setTask = function setImmediate(fn) {
+ var args = [];
+ var i = 1;
+ while (arguments.length > i) args.push(arguments[i++]);
+ queue[++counter] = function () {
+ // eslint-disable-next-line no-new-func
+ invoke(typeof fn == 'function' ? fn : Function(fn), args);
+ };
+ defer(counter);
+ return counter;
+ };
+ clearTask = function clearImmediate(id) {
+ delete queue[id];
+ };
+ // Node.js 0.8-
+ if (require('./_cof')(process) == 'process') {
+ defer = function (id) {
+ process.nextTick(ctx(run, id, 1));
+ };
+ // Sphere (JS game engine) Dispatch API
+ } else if (Dispatch && Dispatch.now) {
+ defer = function (id) {
+ Dispatch.now(ctx(run, id, 1));
+ };
+ // Browsers with MessageChannel, includes WebWorkers
+ } else if (MessageChannel) {
+ channel = new MessageChannel();
+ port = channel.port2;
+ channel.port1.onmessage = listener;
+ defer = ctx(port.postMessage, port, 1);
+ // Browsers with postMessage, skip WebWorkers
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
+ } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
+ defer = function (id) {
+ global.postMessage(id + '', '*');
+ };
+ global.addEventListener('message', listener, false);
+ // IE8-
+ } else if (ONREADYSTATECHANGE in cel('script')) {
+ defer = function (id) {
+ html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
+ html.removeChild(this);
+ run.call(id);
+ };
+ };
+ // Rest old browsers
+ } else {
+ defer = function (id) {
+ setTimeout(ctx(run, id, 1), 0);
+ };
+ }
+}
+module.exports = {
+ set: setTask,
+ clear: clearTask
+};
+
+},{"./_cof":152,"./_ctx":159,"./_dom-create":164,"./_global":175,"./_html":178,"./_invoke":181}],248:[function(require,module,exports){
+var toInteger = require('./_to-integer');
+var max = Math.max;
+var min = Math.min;
+module.exports = function (index, length) {
+ index = toInteger(index);
+ return index < 0 ? max(index + length, 0) : min(index, length);
+};
+
+},{"./_to-integer":250}],249:[function(require,module,exports){
+// https://tc39.github.io/ecma262/#sec-toindex
+var toInteger = require('./_to-integer');
+var toLength = require('./_to-length');
+module.exports = function (it) {
+ if (it === undefined) return 0;
+ var number = toInteger(it);
+ var length = toLength(number);
+ if (number !== length) throw RangeError('Wrong length!');
+ return length;
+};
+
+},{"./_to-integer":250,"./_to-length":252}],250:[function(require,module,exports){
+// 7.1.4 ToInteger
+var ceil = Math.ceil;
+var floor = Math.floor;
+module.exports = function (it) {
+ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
+};
+
+},{}],251:[function(require,module,exports){
+// to indexed object, toObject with fallback for non-array-like ES3 strings
+var IObject = require('./_iobject');
+var defined = require('./_defined');
+module.exports = function (it) {
+ return IObject(defined(it));
+};
+
+},{"./_defined":162,"./_iobject":182}],252:[function(require,module,exports){
+// 7.1.15 ToLength
+var toInteger = require('./_to-integer');
+var min = Math.min;
+module.exports = function (it) {
+ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
+};
+
+},{"./_to-integer":250}],253:[function(require,module,exports){
+// 7.1.13 ToObject(argument)
+var defined = require('./_defined');
+module.exports = function (it) {
+ return Object(defined(it));
+};
+
+},{"./_defined":162}],254:[function(require,module,exports){
+// 7.1.1 ToPrimitive(input [, PreferredType])
+var isObject = require('./_is-object');
+// instead of the ES6 spec version, we didn't implement @@toPrimitive case
+// and the second argument - flag - preferred type is a string
+module.exports = function (it, S) {
+ if (!isObject(it)) return it;
+ var fn, val;
+ if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
+ if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
+ if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
+ throw TypeError("Can't convert object to primitive value");
+};
+
+},{"./_is-object":186}],255:[function(require,module,exports){
+'use strict';
+if (require('./_descriptors')) {
+ var LIBRARY = require('./_library');
+ var global = require('./_global');
+ var fails = require('./_fails');
+ var $export = require('./_export');
+ var $typed = require('./_typed');
+ var $buffer = require('./_typed-buffer');
+ var ctx = require('./_ctx');
+ var anInstance = require('./_an-instance');
+ var propertyDesc = require('./_property-desc');
+ var hide = require('./_hide');
+ var redefineAll = require('./_redefine-all');
+ var toInteger = require('./_to-integer');
+ var toLength = require('./_to-length');
+ var toIndex = require('./_to-index');
+ var toAbsoluteIndex = require('./_to-absolute-index');
+ var toPrimitive = require('./_to-primitive');
+ var has = require('./_has');
+ var classof = require('./_classof');
+ var isObject = require('./_is-object');
+ var toObject = require('./_to-object');
+ var isArrayIter = require('./_is-array-iter');
+ var create = require('./_object-create');
+ var getPrototypeOf = require('./_object-gpo');
+ var gOPN = require('./_object-gopn').f;
+ var getIterFn = require('./core.get-iterator-method');
+ var uid = require('./_uid');
+ var wks = require('./_wks');
+ var createArrayMethod = require('./_array-methods');
+ var createArrayIncludes = require('./_array-includes');
+ var speciesConstructor = require('./_species-constructor');
+ var ArrayIterators = require('./es6.array.iterator');
+ var Iterators = require('./_iterators');
+ var $iterDetect = require('./_iter-detect');
+ var setSpecies = require('./_set-species');
+ var arrayFill = require('./_array-fill');
+ var arrayCopyWithin = require('./_array-copy-within');
+ var $DP = require('./_object-dp');
+ var $GOPD = require('./_object-gopd');
+ var dP = $DP.f;
+ var gOPD = $GOPD.f;
+ var RangeError = global.RangeError;
+ var TypeError = global.TypeError;
+ var Uint8Array = global.Uint8Array;
+ var ARRAY_BUFFER = 'ArrayBuffer';
+ var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER;
+ var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
+ var PROTOTYPE = 'prototype';
+ var ArrayProto = Array[PROTOTYPE];
+ var $ArrayBuffer = $buffer.ArrayBuffer;
+ var $DataView = $buffer.DataView;
+ var arrayForEach = createArrayMethod(0);
+ var arrayFilter = createArrayMethod(2);
+ var arraySome = createArrayMethod(3);
+ var arrayEvery = createArrayMethod(4);
+ var arrayFind = createArrayMethod(5);
+ var arrayFindIndex = createArrayMethod(6);
+ var arrayIncludes = createArrayIncludes(true);
+ var arrayIndexOf = createArrayIncludes(false);
+ var arrayValues = ArrayIterators.values;
+ var arrayKeys = ArrayIterators.keys;
+ var arrayEntries = ArrayIterators.entries;
+ var arrayLastIndexOf = ArrayProto.lastIndexOf;
+ var arrayReduce = ArrayProto.reduce;
+ var arrayReduceRight = ArrayProto.reduceRight;
+ var arrayJoin = ArrayProto.join;
+ var arraySort = ArrayProto.sort;
+ var arraySlice = ArrayProto.slice;
+ var arrayToString = ArrayProto.toString;
+ var arrayToLocaleString = ArrayProto.toLocaleString;
+ var ITERATOR = wks('iterator');
+ var TAG = wks('toStringTag');
+ var TYPED_CONSTRUCTOR = uid('typed_constructor');
+ var DEF_CONSTRUCTOR = uid('def_constructor');
+ var ALL_CONSTRUCTORS = $typed.CONSTR;
+ var TYPED_ARRAY = $typed.TYPED;
+ var VIEW = $typed.VIEW;
+ var WRONG_LENGTH = 'Wrong length!';
+
+ var $map = createArrayMethod(1, function (O, length) {
+ return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
+ });
+
+ var LITTLE_ENDIAN = fails(function () {
+ // eslint-disable-next-line no-undef
+ return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
+ });
+
+ var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () {
+ new Uint8Array(1).set({});
+ });
+
+ var toOffset = function (it, BYTES) {
+ var offset = toInteger(it);
+ if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!');
+ return offset;
+ };
+
+ var validate = function (it) {
+ if (isObject(it) && TYPED_ARRAY in it) return it;
+ throw TypeError(it + ' is not a typed array!');
+ };
+
+ var allocate = function (C, length) {
+ if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) {
+ throw TypeError('It is not a typed array constructor!');
+ } return new C(length);
+ };
+
+ var speciesFromList = function (O, list) {
+ return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
+ };
+
+ var fromList = function (C, list) {
+ var index = 0;
+ var length = list.length;
+ var result = allocate(C, length);
+ while (length > index) result[index] = list[index++];
+ return result;
+ };
+
+ var addGetter = function (it, key, internal) {
+ dP(it, key, { get: function () { return this._d[internal]; } });
+ };
+
+ var $from = function from(source /* , mapfn, thisArg */) {
+ var O = toObject(source);
+ var aLen = arguments.length;
+ var mapfn = aLen > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ var iterFn = getIterFn(O);
+ var i, length, values, result, step, iterator;
+ if (iterFn != undefined && !isArrayIter(iterFn)) {
+ for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) {
+ values.push(step.value);
+ } O = values;
+ }
+ if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2);
+ for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) {
+ result[i] = mapping ? mapfn(O[i], i) : O[i];
+ }
+ return result;
+ };
+
+ var $of = function of(/* ...items */) {
+ var index = 0;
+ var length = arguments.length;
+ var result = allocate(this, length);
+ while (length > index) result[index] = arguments[index++];
+ return result;
+ };
+
+ // iOS Safari 6.x fails here
+ var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); });
+
+ var $toLocaleString = function toLocaleString() {
+ return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
+ };
+
+ var proto = {
+ copyWithin: function copyWithin(target, start /* , end */) {
+ return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
+ },
+ every: function every(callbackfn /* , thisArg */) {
+ return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars
+ return arrayFill.apply(validate(this), arguments);
+ },
+ filter: function filter(callbackfn /* , thisArg */) {
+ return speciesFromList(this, arrayFilter(validate(this), callbackfn,
+ arguments.length > 1 ? arguments[1] : undefined));
+ },
+ find: function find(predicate /* , thisArg */) {
+ return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ findIndex: function findIndex(predicate /* , thisArg */) {
+ return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ forEach: function forEach(callbackfn /* , thisArg */) {
+ arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ indexOf: function indexOf(searchElement /* , fromIndex */) {
+ return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ includes: function includes(searchElement /* , fromIndex */) {
+ return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ join: function join(separator) { // eslint-disable-line no-unused-vars
+ return arrayJoin.apply(validate(this), arguments);
+ },
+ lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars
+ return arrayLastIndexOf.apply(validate(this), arguments);
+ },
+ map: function map(mapfn /* , thisArg */) {
+ return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars
+ return arrayReduce.apply(validate(this), arguments);
+ },
+ reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars
+ return arrayReduceRight.apply(validate(this), arguments);
+ },
+ reverse: function reverse() {
+ var that = this;
+ var length = validate(that).length;
+ var middle = Math.floor(length / 2);
+ var index = 0;
+ var value;
+ while (index < middle) {
+ value = that[index];
+ that[index++] = that[--length];
+ that[length] = value;
+ } return that;
+ },
+ some: function some(callbackfn /* , thisArg */) {
+ return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ },
+ sort: function sort(comparefn) {
+ return arraySort.call(validate(this), comparefn);
+ },
+ subarray: function subarray(begin, end) {
+ var O = validate(this);
+ var length = O.length;
+ var $begin = toAbsoluteIndex(begin, length);
+ return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(
+ O.buffer,
+ O.byteOffset + $begin * O.BYTES_PER_ELEMENT,
+ toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin)
+ );
+ }
+ };
+
+ var $slice = function slice(start, end) {
+ return speciesFromList(this, arraySlice.call(validate(this), start, end));
+ };
+
+ var $set = function set(arrayLike /* , offset */) {
+ validate(this);
+ var offset = toOffset(arguments[1], 1);
+ var length = this.length;
+ var src = toObject(arrayLike);
+ var len = toLength(src.length);
+ var index = 0;
+ if (len + offset > length) throw RangeError(WRONG_LENGTH);
+ while (index < len) this[offset + index] = src[index++];
+ };
+
+ var $iterators = {
+ entries: function entries() {
+ return arrayEntries.call(validate(this));
+ },
+ keys: function keys() {
+ return arrayKeys.call(validate(this));
+ },
+ values: function values() {
+ return arrayValues.call(validate(this));
+ }
+ };
+
+ var isTAIndex = function (target, key) {
+ return isObject(target)
+ && target[TYPED_ARRAY]
+ && typeof key != 'symbol'
+ && key in target
+ && String(+key) == String(key);
+ };
+ var $getDesc = function getOwnPropertyDescriptor(target, key) {
+ return isTAIndex(target, key = toPrimitive(key, true))
+ ? propertyDesc(2, target[key])
+ : gOPD(target, key);
+ };
+ var $setDesc = function defineProperty(target, key, desc) {
+ if (isTAIndex(target, key = toPrimitive(key, true))
+ && isObject(desc)
+ && has(desc, 'value')
+ && !has(desc, 'get')
+ && !has(desc, 'set')
+ // TODO: add validation descriptor w/o calling accessors
+ && !desc.configurable
+ && (!has(desc, 'writable') || desc.writable)
+ && (!has(desc, 'enumerable') || desc.enumerable)
+ ) {
+ target[key] = desc.value;
+ return target;
+ } return dP(target, key, desc);
+ };
+
+ if (!ALL_CONSTRUCTORS) {
+ $GOPD.f = $getDesc;
+ $DP.f = $setDesc;
+ }
+
+ $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
+ getOwnPropertyDescriptor: $getDesc,
+ defineProperty: $setDesc
+ });
+
+ if (fails(function () { arrayToString.call({}); })) {
+ arrayToString = arrayToLocaleString = function toString() {
+ return arrayJoin.call(this);
+ };
+ }
+
+ var $TypedArrayPrototype$ = redefineAll({}, proto);
+ redefineAll($TypedArrayPrototype$, $iterators);
+ hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
+ redefineAll($TypedArrayPrototype$, {
+ slice: $slice,
+ set: $set,
+ constructor: function () { /* noop */ },
+ toString: arrayToString,
+ toLocaleString: $toLocaleString
+ });
+ addGetter($TypedArrayPrototype$, 'buffer', 'b');
+ addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
+ addGetter($TypedArrayPrototype$, 'byteLength', 'l');
+ addGetter($TypedArrayPrototype$, 'length', 'e');
+ dP($TypedArrayPrototype$, TAG, {
+ get: function () { return this[TYPED_ARRAY]; }
+ });
+
+ // eslint-disable-next-line max-statements
+ module.exports = function (KEY, BYTES, wrapper, CLAMPED) {
+ CLAMPED = !!CLAMPED;
+ var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array';
+ var GETTER = 'get' + KEY;
+ var SETTER = 'set' + KEY;
+ var TypedArray = global[NAME];
+ var Base = TypedArray || {};
+ var TAC = TypedArray && getPrototypeOf(TypedArray);
+ var FORCED = !TypedArray || !$typed.ABV;
+ var O = {};
+ var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
+ var getter = function (that, index) {
+ var data = that._d;
+ return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
+ };
+ var setter = function (that, index, value) {
+ var data = that._d;
+ if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
+ data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
+ };
+ var addElement = function (that, index) {
+ dP(that, index, {
+ get: function () {
+ return getter(this, index);
+ },
+ set: function (value) {
+ return setter(this, index, value);
+ },
+ enumerable: true
+ });
+ };
+ if (FORCED) {
+ TypedArray = wrapper(function (that, data, $offset, $length) {
+ anInstance(that, TypedArray, NAME, '_d');
+ var index = 0;
+ var offset = 0;
+ var buffer, byteLength, length, klass;
+ if (!isObject(data)) {
+ length = toIndex(data);
+ byteLength = length * BYTES;
+ buffer = new $ArrayBuffer(byteLength);
+ } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
+ buffer = data;
+ offset = toOffset($offset, BYTES);
+ var $len = data.byteLength;
+ if ($length === undefined) {
+ if ($len % BYTES) throw RangeError(WRONG_LENGTH);
+ byteLength = $len - offset;
+ if (byteLength < 0) throw RangeError(WRONG_LENGTH);
+ } else {
+ byteLength = toLength($length) * BYTES;
+ if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH);
+ }
+ length = byteLength / BYTES;
+ } else if (TYPED_ARRAY in data) {
+ return fromList(TypedArray, data);
+ } else {
+ return $from.call(TypedArray, data);
+ }
+ hide(that, '_d', {
+ b: buffer,
+ o: offset,
+ l: byteLength,
+ e: length,
+ v: new $DataView(buffer)
+ });
+ while (index < length) addElement(that, index++);
+ });
+ TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
+ hide(TypedArrayPrototype, 'constructor', TypedArray);
+ } else if (!fails(function () {
+ TypedArray(1);
+ }) || !fails(function () {
+ new TypedArray(-1); // eslint-disable-line no-new
+ }) || !$iterDetect(function (iter) {
+ new TypedArray(); // eslint-disable-line no-new
+ new TypedArray(null); // eslint-disable-line no-new
+ new TypedArray(1.5); // eslint-disable-line no-new
+ new TypedArray(iter); // eslint-disable-line no-new
+ }, true)) {
+ TypedArray = wrapper(function (that, data, $offset, $length) {
+ anInstance(that, TypedArray, NAME);
+ var klass;
+ // `ws` module bug, temporarily remove validation length for Uint8Array
+ // https://github.com/websockets/ws/pull/645
+ if (!isObject(data)) return new Base(toIndex(data));
+ if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
+ return $length !== undefined
+ ? new Base(data, toOffset($offset, BYTES), $length)
+ : $offset !== undefined
+ ? new Base(data, toOffset($offset, BYTES))
+ : new Base(data);
+ }
+ if (TYPED_ARRAY in data) return fromList(TypedArray, data);
+ return $from.call(TypedArray, data);
+ });
+ arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) {
+ if (!(key in TypedArray)) hide(TypedArray, key, Base[key]);
+ });
+ TypedArray[PROTOTYPE] = TypedArrayPrototype;
+ if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray;
+ }
+ var $nativeIterator = TypedArrayPrototype[ITERATOR];
+ var CORRECT_ITER_NAME = !!$nativeIterator
+ && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined);
+ var $iterator = $iterators.values;
+ hide(TypedArray, TYPED_CONSTRUCTOR, true);
+ hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
+ hide(TypedArrayPrototype, VIEW, true);
+ hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);
+
+ if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) {
+ dP(TypedArrayPrototype, TAG, {
+ get: function () { return NAME; }
+ });
+ }
+
+ O[NAME] = TypedArray;
+
+ $export($export.G + $export.W + $export.F * (TypedArray != Base), O);
+
+ $export($export.S, NAME, {
+ BYTES_PER_ELEMENT: BYTES
+ });
+
+ $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, {
+ from: $from,
+ of: $of
+ });
+
+ if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);
+
+ $export($export.P, NAME, proto);
+
+ setSpecies(NAME);
+
+ $export($export.P + $export.F * FORCED_SET, NAME, { set: $set });
+
+ $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);
+
+ if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString;
+
+ $export($export.P + $export.F * fails(function () {
+ new TypedArray(1).slice();
+ }), NAME, { slice: $slice });
+
+ $export($export.P + $export.F * (fails(function () {
+ return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString();
+ }) || !fails(function () {
+ TypedArrayPrototype.toLocaleString.call([1, 2]);
+ })), NAME, { toLocaleString: $toLocaleString });
+
+ Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
+ if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator);
+ };
+} else module.exports = function () { /* empty */ };
+
+},{"./_an-instance":140,"./_array-copy-within":142,"./_array-fill":143,"./_array-includes":145,"./_array-methods":146,"./_classof":151,"./_ctx":159,"./_descriptors":163,"./_export":167,"./_fails":169,"./_global":175,"./_has":176,"./_hide":177,"./_is-array-iter":183,"./_is-object":186,"./_iter-detect":191,"./_iterators":193,"./_library":194,"./_object-create":205,"./_object-dp":206,"./_object-gopd":209,"./_object-gopn":211,"./_object-gpo":213,"./_property-desc":224,"./_redefine-all":225,"./_set-species":234,"./_species-constructor":238,"./_to-absolute-index":248,"./_to-index":249,"./_to-integer":250,"./_to-length":252,"./_to-object":253,"./_to-primitive":254,"./_typed":257,"./_typed-buffer":256,"./_uid":258,"./_wks":263,"./core.get-iterator-method":264,"./es6.array.iterator":276}],256:[function(require,module,exports){
+'use strict';
+var global = require('./_global');
+var DESCRIPTORS = require('./_descriptors');
+var LIBRARY = require('./_library');
+var $typed = require('./_typed');
+var hide = require('./_hide');
+var redefineAll = require('./_redefine-all');
+var fails = require('./_fails');
+var anInstance = require('./_an-instance');
+var toInteger = require('./_to-integer');
+var toLength = require('./_to-length');
+var toIndex = require('./_to-index');
+var gOPN = require('./_object-gopn').f;
+var dP = require('./_object-dp').f;
+var arrayFill = require('./_array-fill');
+var setToStringTag = require('./_set-to-string-tag');
+var ARRAY_BUFFER = 'ArrayBuffer';
+var DATA_VIEW = 'DataView';
+var PROTOTYPE = 'prototype';
+var WRONG_LENGTH = 'Wrong length!';
+var WRONG_INDEX = 'Wrong index!';
+var $ArrayBuffer = global[ARRAY_BUFFER];
+var $DataView = global[DATA_VIEW];
+var Math = global.Math;
+var RangeError = global.RangeError;
+// eslint-disable-next-line no-shadow-restricted-names
+var Infinity = global.Infinity;
+var BaseBuffer = $ArrayBuffer;
+var abs = Math.abs;
+var pow = Math.pow;
+var floor = Math.floor;
+var log = Math.log;
+var LN2 = Math.LN2;
+var BUFFER = 'buffer';
+var BYTE_LENGTH = 'byteLength';
+var BYTE_OFFSET = 'byteOffset';
+var $BUFFER = DESCRIPTORS ? '_b' : BUFFER;
+var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH;
+var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
+
+// IEEE754 conversions based on https://github.com/feross/ieee754
+function packIEEE754(value, mLen, nBytes) {
+ var buffer = new Array(nBytes);
+ var eLen = nBytes * 8 - mLen - 1;
+ var eMax = (1 << eLen) - 1;
+ var eBias = eMax >> 1;
+ var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;
+ var i = 0;
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
+ var e, m, c;
+ value = abs(value);
+ // eslint-disable-next-line no-self-compare
+ if (value != value || value === Infinity) {
+ // eslint-disable-next-line no-self-compare
+ m = value != value ? 1 : 0;
+ e = eMax;
+ } else {
+ e = floor(log(value) / LN2);
+ if (value * (c = pow(2, -e)) < 1) {
+ e--;
+ c *= 2;
+ }
+ if (e + eBias >= 1) {
+ value += rt / c;
+ } else {
+ value += rt * pow(2, 1 - eBias);
+ }
+ if (value * c >= 2) {
+ e++;
+ c /= 2;
+ }
+ if (e + eBias >= eMax) {
+ m = 0;
+ e = eMax;
+ } else if (e + eBias >= 1) {
+ m = (value * c - 1) * pow(2, mLen);
+ e = e + eBias;
+ } else {
+ m = value * pow(2, eBias - 1) * pow(2, mLen);
+ e = 0;
+ }
+ }
+ for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);
+ e = e << mLen | m;
+ eLen += mLen;
+ for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);
+ buffer[--i] |= s * 128;
+ return buffer;
+}
+function unpackIEEE754(buffer, mLen, nBytes) {
+ var eLen = nBytes * 8 - mLen - 1;
+ var eMax = (1 << eLen) - 1;
+ var eBias = eMax >> 1;
+ var nBits = eLen - 7;
+ var i = nBytes - 1;
+ var s = buffer[i--];
+ var e = s & 127;
+ var m;
+ s >>= 7;
+ for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);
+ m = e & (1 << -nBits) - 1;
+ e >>= -nBits;
+ nBits += mLen;
+ for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);
+ if (e === 0) {
+ e = 1 - eBias;
+ } else if (e === eMax) {
+ return m ? NaN : s ? -Infinity : Infinity;
+ } else {
+ m = m + pow(2, mLen);
+ e = e - eBias;
+ } return (s ? -1 : 1) * m * pow(2, e - mLen);
+}
+
+function unpackI32(bytes) {
+ return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
+}
+function packI8(it) {
+ return [it & 0xff];
+}
+function packI16(it) {
+ return [it & 0xff, it >> 8 & 0xff];
+}
+function packI32(it) {
+ return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
+}
+function packF64(it) {
+ return packIEEE754(it, 52, 8);
+}
+function packF32(it) {
+ return packIEEE754(it, 23, 4);
+}
+
+function addGetter(C, key, internal) {
+ dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } });
+}
+
+function get(view, bytes, index, isLittleEndian) {
+ var numIndex = +index;
+ var intIndex = toIndex(numIndex);
+ if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
+ var store = view[$BUFFER]._b;
+ var start = intIndex + view[$OFFSET];
+ var pack = store.slice(start, start + bytes);
+ return isLittleEndian ? pack : pack.reverse();
+}
+function set(view, bytes, index, conversion, value, isLittleEndian) {
+ var numIndex = +index;
+ var intIndex = toIndex(numIndex);
+ if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
+ var store = view[$BUFFER]._b;
+ var start = intIndex + view[$OFFSET];
+ var pack = conversion(+value);
+ for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
+}
+
+if (!$typed.ABV) {
+ $ArrayBuffer = function ArrayBuffer(length) {
+ anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
+ var byteLength = toIndex(length);
+ this._b = arrayFill.call(new Array(byteLength), 0);
+ this[$LENGTH] = byteLength;
+ };
+
+ $DataView = function DataView(buffer, byteOffset, byteLength) {
+ anInstance(this, $DataView, DATA_VIEW);
+ anInstance(buffer, $ArrayBuffer, DATA_VIEW);
+ var bufferLength = buffer[$LENGTH];
+ var offset = toInteger(byteOffset);
+ if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!');
+ byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
+ if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
+ this[$BUFFER] = buffer;
+ this[$OFFSET] = offset;
+ this[$LENGTH] = byteLength;
+ };
+
+ if (DESCRIPTORS) {
+ addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
+ addGetter($DataView, BUFFER, '_b');
+ addGetter($DataView, BYTE_LENGTH, '_l');
+ addGetter($DataView, BYTE_OFFSET, '_o');
+ }
+
+ redefineAll($DataView[PROTOTYPE], {
+ getInt8: function getInt8(byteOffset) {
+ return get(this, 1, byteOffset)[0] << 24 >> 24;
+ },
+ getUint8: function getUint8(byteOffset) {
+ return get(this, 1, byteOffset)[0];
+ },
+ getInt16: function getInt16(byteOffset /* , littleEndian */) {
+ var bytes = get(this, 2, byteOffset, arguments[1]);
+ return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
+ },
+ getUint16: function getUint16(byteOffset /* , littleEndian */) {
+ var bytes = get(this, 2, byteOffset, arguments[1]);
+ return bytes[1] << 8 | bytes[0];
+ },
+ getInt32: function getInt32(byteOffset /* , littleEndian */) {
+ return unpackI32(get(this, 4, byteOffset, arguments[1]));
+ },
+ getUint32: function getUint32(byteOffset /* , littleEndian */) {
+ return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
+ },
+ getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
+ return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
+ },
+ getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
+ return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
+ },
+ setInt8: function setInt8(byteOffset, value) {
+ set(this, 1, byteOffset, packI8, value);
+ },
+ setUint8: function setUint8(byteOffset, value) {
+ set(this, 1, byteOffset, packI8, value);
+ },
+ setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
+ set(this, 2, byteOffset, packI16, value, arguments[2]);
+ },
+ setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
+ set(this, 2, byteOffset, packI16, value, arguments[2]);
+ },
+ setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
+ set(this, 4, byteOffset, packI32, value, arguments[2]);
+ },
+ setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
+ set(this, 4, byteOffset, packI32, value, arguments[2]);
+ },
+ setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
+ set(this, 4, byteOffset, packF32, value, arguments[2]);
+ },
+ setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
+ set(this, 8, byteOffset, packF64, value, arguments[2]);
+ }
+ });
+} else {
+ if (!fails(function () {
+ $ArrayBuffer(1);
+ }) || !fails(function () {
+ new $ArrayBuffer(-1); // eslint-disable-line no-new
+ }) || fails(function () {
+ new $ArrayBuffer(); // eslint-disable-line no-new
+ new $ArrayBuffer(1.5); // eslint-disable-line no-new
+ new $ArrayBuffer(NaN); // eslint-disable-line no-new
+ return $ArrayBuffer.name != ARRAY_BUFFER;
+ })) {
+ $ArrayBuffer = function ArrayBuffer(length) {
+ anInstance(this, $ArrayBuffer);
+ return new BaseBuffer(toIndex(length));
+ };
+ var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
+ for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) {
+ if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]);
+ }
+ if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer;
+ }
+ // iOS Safari 7.x bug
+ var view = new $DataView(new $ArrayBuffer(2));
+ var $setInt8 = $DataView[PROTOTYPE].setInt8;
+ view.setInt8(0, 2147483648);
+ view.setInt8(1, 2147483649);
+ if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], {
+ setInt8: function setInt8(byteOffset, value) {
+ $setInt8.call(this, byteOffset, value << 24 >> 24);
+ },
+ setUint8: function setUint8(byteOffset, value) {
+ $setInt8.call(this, byteOffset, value << 24 >> 24);
+ }
+ }, true);
+}
+setToStringTag($ArrayBuffer, ARRAY_BUFFER);
+setToStringTag($DataView, DATA_VIEW);
+hide($DataView[PROTOTYPE], $typed.VIEW, true);
+exports[ARRAY_BUFFER] = $ArrayBuffer;
+exports[DATA_VIEW] = $DataView;
+
+},{"./_an-instance":140,"./_array-fill":143,"./_descriptors":163,"./_fails":169,"./_global":175,"./_hide":177,"./_library":194,"./_object-dp":206,"./_object-gopn":211,"./_redefine-all":225,"./_set-to-string-tag":235,"./_to-index":249,"./_to-integer":250,"./_to-length":252,"./_typed":257}],257:[function(require,module,exports){
+var global = require('./_global');
+var hide = require('./_hide');
+var uid = require('./_uid');
+var TYPED = uid('typed_array');
+var VIEW = uid('view');
+var ABV = !!(global.ArrayBuffer && global.DataView);
+var CONSTR = ABV;
+var i = 0;
+var l = 9;
+var Typed;
+
+var TypedArrayConstructors = (
+ 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'
+).split(',');
+
+while (i < l) {
+ if (Typed = global[TypedArrayConstructors[i++]]) {
+ hide(Typed.prototype, TYPED, true);
+ hide(Typed.prototype, VIEW, true);
+ } else CONSTR = false;
+}
+
+module.exports = {
+ ABV: ABV,
+ CONSTR: CONSTR,
+ TYPED: TYPED,
+ VIEW: VIEW
+};
+
+},{"./_global":175,"./_hide":177,"./_uid":258}],258:[function(require,module,exports){
+var id = 0;
+var px = Math.random();
+module.exports = function (key) {
+ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
+};
+
+},{}],259:[function(require,module,exports){
+var global = require('./_global');
+var navigator = global.navigator;
+
+module.exports = navigator && navigator.userAgent || '';
+
+},{"./_global":175}],260:[function(require,module,exports){
+var isObject = require('./_is-object');
+module.exports = function (it, TYPE) {
+ if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
+ return it;
+};
+
+},{"./_is-object":186}],261:[function(require,module,exports){
+var global = require('./_global');
+var core = require('./_core');
+var LIBRARY = require('./_library');
+var wksExt = require('./_wks-ext');
+var defineProperty = require('./_object-dp').f;
+module.exports = function (name) {
+ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
+ if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
+};
+
+},{"./_core":157,"./_global":175,"./_library":194,"./_object-dp":206,"./_wks-ext":262}],262:[function(require,module,exports){
+exports.f = require('./_wks');
+
+},{"./_wks":263}],263:[function(require,module,exports){
+var store = require('./_shared')('wks');
+var uid = require('./_uid');
+var Symbol = require('./_global').Symbol;
+var USE_SYMBOL = typeof Symbol == 'function';
+
+var $exports = module.exports = function (name) {
+ return store[name] || (store[name] =
+ USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
+};
+
+$exports.store = store;
+
+},{"./_global":175,"./_shared":237,"./_uid":258}],264:[function(require,module,exports){
+var classof = require('./_classof');
+var ITERATOR = require('./_wks')('iterator');
+var Iterators = require('./_iterators');
+module.exports = require('./_core').getIteratorMethod = function (it) {
+ if (it != undefined) return it[ITERATOR]
+ || it['@@iterator']
+ || Iterators[classof(it)];
+};
+
+},{"./_classof":151,"./_core":157,"./_iterators":193,"./_wks":263}],265:[function(require,module,exports){
+// https://github.com/benjamingr/RexExp.escape
+var $export = require('./_export');
+var $re = require('./_replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&');
+
+$export($export.S, 'RegExp', { escape: function escape(it) { return $re(it); } });
+
+},{"./_export":167,"./_replacer":229}],266:[function(require,module,exports){
+// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
+var $export = require('./_export');
+
+$export($export.P, 'Array', { copyWithin: require('./_array-copy-within') });
+
+require('./_add-to-unscopables')('copyWithin');
+
+},{"./_add-to-unscopables":138,"./_array-copy-within":142,"./_export":167}],267:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $every = require('./_array-methods')(4);
+
+$export($export.P + $export.F * !require('./_strict-method')([].every, true), 'Array', {
+ // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
+ every: function every(callbackfn /* , thisArg */) {
+ return $every(this, callbackfn, arguments[1]);
+ }
+});
+
+},{"./_array-methods":146,"./_export":167,"./_strict-method":239}],268:[function(require,module,exports){
+// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
+var $export = require('./_export');
+
+$export($export.P, 'Array', { fill: require('./_array-fill') });
+
+require('./_add-to-unscopables')('fill');
+
+},{"./_add-to-unscopables":138,"./_array-fill":143,"./_export":167}],269:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $filter = require('./_array-methods')(2);
+
+$export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', {
+ // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
+ filter: function filter(callbackfn /* , thisArg */) {
+ return $filter(this, callbackfn, arguments[1]);
+ }
+});
+
+},{"./_array-methods":146,"./_export":167,"./_strict-method":239}],270:[function(require,module,exports){
+'use strict';
+// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
+var $export = require('./_export');
+var $find = require('./_array-methods')(6);
+var KEY = 'findIndex';
+var forced = true;
+// Shouldn't skip holes
+if (KEY in []) Array(1)[KEY](function () { forced = false; });
+$export($export.P + $export.F * forced, 'Array', {
+ findIndex: function findIndex(callbackfn /* , that = undefined */) {
+ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+require('./_add-to-unscopables')(KEY);
+
+},{"./_add-to-unscopables":138,"./_array-methods":146,"./_export":167}],271:[function(require,module,exports){
+'use strict';
+// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
+var $export = require('./_export');
+var $find = require('./_array-methods')(5);
+var KEY = 'find';
+var forced = true;
+// Shouldn't skip holes
+if (KEY in []) Array(1)[KEY](function () { forced = false; });
+$export($export.P + $export.F * forced, 'Array', {
+ find: function find(callbackfn /* , that = undefined */) {
+ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+require('./_add-to-unscopables')(KEY);
+
+},{"./_add-to-unscopables":138,"./_array-methods":146,"./_export":167}],272:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $forEach = require('./_array-methods')(0);
+var STRICT = require('./_strict-method')([].forEach, true);
+
+$export($export.P + $export.F * !STRICT, 'Array', {
+ // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
+ forEach: function forEach(callbackfn /* , thisArg */) {
+ return $forEach(this, callbackfn, arguments[1]);
+ }
+});
+
+},{"./_array-methods":146,"./_export":167,"./_strict-method":239}],273:[function(require,module,exports){
+'use strict';
+var ctx = require('./_ctx');
+var $export = require('./_export');
+var toObject = require('./_to-object');
+var call = require('./_iter-call');
+var isArrayIter = require('./_is-array-iter');
+var toLength = require('./_to-length');
+var createProperty = require('./_create-property');
+var getIterFn = require('./core.get-iterator-method');
+
+$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {
+ // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
+ from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
+ var O = toObject(arrayLike);
+ var C = typeof this == 'function' ? this : Array;
+ var aLen = arguments.length;
+ var mapfn = aLen > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ var index = 0;
+ var iterFn = getIterFn(O);
+ var length, result, step, iterator;
+ if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
+ // if object isn't iterable or it's array with default iterator - use simple case
+ if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
+ for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
+ createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
+ }
+ } else {
+ length = toLength(O.length);
+ for (result = new C(length); length > index; index++) {
+ createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
+ }
+ }
+ result.length = index;
+ return result;
+ }
+});
+
+},{"./_create-property":158,"./_ctx":159,"./_export":167,"./_is-array-iter":183,"./_iter-call":188,"./_iter-detect":191,"./_to-length":252,"./_to-object":253,"./core.get-iterator-method":264}],274:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $indexOf = require('./_array-includes')(false);
+var $native = [].indexOf;
+var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
+
+$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
+ // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
+ indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
+ return NEGATIVE_ZERO
+ // convert -0 to +0
+ ? $native.apply(this, arguments) || 0
+ : $indexOf(this, searchElement, arguments[1]);
+ }
+});
+
+},{"./_array-includes":145,"./_export":167,"./_strict-method":239}],275:[function(require,module,exports){
+// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
+var $export = require('./_export');
+
+$export($export.S, 'Array', { isArray: require('./_is-array') });
+
+},{"./_export":167,"./_is-array":184}],276:[function(require,module,exports){
+'use strict';
+var addToUnscopables = require('./_add-to-unscopables');
+var step = require('./_iter-step');
+var Iterators = require('./_iterators');
+var toIObject = require('./_to-iobject');
+
+// 22.1.3.4 Array.prototype.entries()
+// 22.1.3.13 Array.prototype.keys()
+// 22.1.3.29 Array.prototype.values()
+// 22.1.3.30 Array.prototype[@@iterator]()
+module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
+ this._t = toIObject(iterated); // target
+ this._i = 0; // next index
+ this._k = kind; // kind
+// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
+}, function () {
+ var O = this._t;
+ var kind = this._k;
+ var index = this._i++;
+ if (!O || index >= O.length) {
+ this._t = undefined;
+ return step(1);
+ }
+ if (kind == 'keys') return step(0, index);
+ if (kind == 'values') return step(0, O[index]);
+ return step(0, [index, O[index]]);
+}, 'values');
+
+// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
+Iterators.Arguments = Iterators.Array;
+
+addToUnscopables('keys');
+addToUnscopables('values');
+addToUnscopables('entries');
+
+},{"./_add-to-unscopables":138,"./_iter-define":190,"./_iter-step":192,"./_iterators":193,"./_to-iobject":251}],277:[function(require,module,exports){
+'use strict';
+// 22.1.3.13 Array.prototype.join(separator)
+var $export = require('./_export');
+var toIObject = require('./_to-iobject');
+var arrayJoin = [].join;
+
+// fallback for not array-like strings
+$export($export.P + $export.F * (require('./_iobject') != Object || !require('./_strict-method')(arrayJoin)), 'Array', {
+ join: function join(separator) {
+ return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
+ }
+});
+
+},{"./_export":167,"./_iobject":182,"./_strict-method":239,"./_to-iobject":251}],278:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var toIObject = require('./_to-iobject');
+var toInteger = require('./_to-integer');
+var toLength = require('./_to-length');
+var $native = [].lastIndexOf;
+var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;
+
+$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
+ // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
+ lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
+ // convert -0 to +0
+ if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0;
+ var O = toIObject(this);
+ var length = toLength(O.length);
+ var index = length - 1;
+ if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1]));
+ if (index < 0) index = length + index;
+ for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0;
+ return -1;
+ }
+});
+
+},{"./_export":167,"./_strict-method":239,"./_to-integer":250,"./_to-iobject":251,"./_to-length":252}],279:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $map = require('./_array-methods')(1);
+
+$export($export.P + $export.F * !require('./_strict-method')([].map, true), 'Array', {
+ // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
+ map: function map(callbackfn /* , thisArg */) {
+ return $map(this, callbackfn, arguments[1]);
+ }
+});
+
+},{"./_array-methods":146,"./_export":167,"./_strict-method":239}],280:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var createProperty = require('./_create-property');
+
+// WebKit Array.of isn't generic
+$export($export.S + $export.F * require('./_fails')(function () {
+ function F() { /* empty */ }
+ return !(Array.of.call(F) instanceof F);
+}), 'Array', {
+ // 22.1.2.3 Array.of( ...items)
+ of: function of(/* ...args */) {
+ var index = 0;
+ var aLen = arguments.length;
+ var result = new (typeof this == 'function' ? this : Array)(aLen);
+ while (aLen > index) createProperty(result, index, arguments[index++]);
+ result.length = aLen;
+ return result;
+ }
+});
+
+},{"./_create-property":158,"./_export":167,"./_fails":169}],281:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $reduce = require('./_array-reduce');
+
+$export($export.P + $export.F * !require('./_strict-method')([].reduceRight, true), 'Array', {
+ // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
+ reduceRight: function reduceRight(callbackfn /* , initialValue */) {
+ return $reduce(this, callbackfn, arguments.length, arguments[1], true);
+ }
+});
+
+},{"./_array-reduce":147,"./_export":167,"./_strict-method":239}],282:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $reduce = require('./_array-reduce');
+
+$export($export.P + $export.F * !require('./_strict-method')([].reduce, true), 'Array', {
+ // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
+ reduce: function reduce(callbackfn /* , initialValue */) {
+ return $reduce(this, callbackfn, arguments.length, arguments[1], false);
+ }
+});
+
+},{"./_array-reduce":147,"./_export":167,"./_strict-method":239}],283:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var html = require('./_html');
+var cof = require('./_cof');
+var toAbsoluteIndex = require('./_to-absolute-index');
+var toLength = require('./_to-length');
+var arraySlice = [].slice;
+
+// fallback for not array-like ES3 strings and DOM objects
+$export($export.P + $export.F * require('./_fails')(function () {
+ if (html) arraySlice.call(html);
+}), 'Array', {
+ slice: function slice(begin, end) {
+ var len = toLength(this.length);
+ var klass = cof(this);
+ end = end === undefined ? len : end;
+ if (klass == 'Array') return arraySlice.call(this, begin, end);
+ var start = toAbsoluteIndex(begin, len);
+ var upTo = toAbsoluteIndex(end, len);
+ var size = toLength(upTo - start);
+ var cloned = new Array(size);
+ var i = 0;
+ for (; i < size; i++) cloned[i] = klass == 'String'
+ ? this.charAt(start + i)
+ : this[start + i];
+ return cloned;
+ }
+});
+
+},{"./_cof":152,"./_export":167,"./_fails":169,"./_html":178,"./_to-absolute-index":248,"./_to-length":252}],284:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $some = require('./_array-methods')(3);
+
+$export($export.P + $export.F * !require('./_strict-method')([].some, true), 'Array', {
+ // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
+ some: function some(callbackfn /* , thisArg */) {
+ return $some(this, callbackfn, arguments[1]);
+ }
+});
+
+},{"./_array-methods":146,"./_export":167,"./_strict-method":239}],285:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var aFunction = require('./_a-function');
+var toObject = require('./_to-object');
+var fails = require('./_fails');
+var $sort = [].sort;
+var test = [1, 2, 3];
+
+$export($export.P + $export.F * (fails(function () {
+ // IE8-
+ test.sort(undefined);
+}) || !fails(function () {
+ // V8 bug
+ test.sort(null);
+ // Old WebKit
+}) || !require('./_strict-method')($sort)), 'Array', {
+ // 22.1.3.25 Array.prototype.sort(comparefn)
+ sort: function sort(comparefn) {
+ return comparefn === undefined
+ ? $sort.call(toObject(this))
+ : $sort.call(toObject(this), aFunction(comparefn));
+ }
+});
+
+},{"./_a-function":136,"./_export":167,"./_fails":169,"./_strict-method":239,"./_to-object":253}],286:[function(require,module,exports){
+require('./_set-species')('Array');
+
+},{"./_set-species":234}],287:[function(require,module,exports){
+// 20.3.3.1 / 15.9.4.4 Date.now()
+var $export = require('./_export');
+
+$export($export.S, 'Date', { now: function () { return new Date().getTime(); } });
+
+},{"./_export":167}],288:[function(require,module,exports){
+// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
+var $export = require('./_export');
+var toISOString = require('./_date-to-iso-string');
+
+// PhantomJS / old WebKit has a broken implementations
+$export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', {
+ toISOString: toISOString
+});
+
+},{"./_date-to-iso-string":160,"./_export":167}],289:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var toObject = require('./_to-object');
+var toPrimitive = require('./_to-primitive');
+
+$export($export.P + $export.F * require('./_fails')(function () {
+ return new Date(NaN).toJSON() !== null
+ || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1;
+}), 'Date', {
+ // eslint-disable-next-line no-unused-vars
+ toJSON: function toJSON(key) {
+ var O = toObject(this);
+ var pv = toPrimitive(O);
+ return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
+ }
+});
+
+},{"./_export":167,"./_fails":169,"./_to-object":253,"./_to-primitive":254}],290:[function(require,module,exports){
+var TO_PRIMITIVE = require('./_wks')('toPrimitive');
+var proto = Date.prototype;
+
+if (!(TO_PRIMITIVE in proto)) require('./_hide')(proto, TO_PRIMITIVE, require('./_date-to-primitive'));
+
+},{"./_date-to-primitive":161,"./_hide":177,"./_wks":263}],291:[function(require,module,exports){
+var DateProto = Date.prototype;
+var INVALID_DATE = 'Invalid Date';
+var TO_STRING = 'toString';
+var $toString = DateProto[TO_STRING];
+var getTime = DateProto.getTime;
+if (new Date(NaN) + '' != INVALID_DATE) {
+ require('./_redefine')(DateProto, TO_STRING, function toString() {
+ var value = getTime.call(this);
+ // eslint-disable-next-line no-self-compare
+ return value === value ? $toString.call(this) : INVALID_DATE;
+ });
+}
+
+},{"./_redefine":226}],292:[function(require,module,exports){
+// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
+var $export = require('./_export');
+
+$export($export.P, 'Function', { bind: require('./_bind') });
+
+},{"./_bind":150,"./_export":167}],293:[function(require,module,exports){
+'use strict';
+var isObject = require('./_is-object');
+var getPrototypeOf = require('./_object-gpo');
+var HAS_INSTANCE = require('./_wks')('hasInstance');
+var FunctionProto = Function.prototype;
+// 19.2.3.6 Function.prototype[@@hasInstance](V)
+if (!(HAS_INSTANCE in FunctionProto)) require('./_object-dp').f(FunctionProto, HAS_INSTANCE, { value: function (O) {
+ if (typeof this != 'function' || !isObject(O)) return false;
+ if (!isObject(this.prototype)) return O instanceof this;
+ // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
+ while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
+ return false;
+} });
+
+},{"./_is-object":186,"./_object-dp":206,"./_object-gpo":213,"./_wks":263}],294:[function(require,module,exports){
+var dP = require('./_object-dp').f;
+var FProto = Function.prototype;
+var nameRE = /^\s*function ([^ (]*)/;
+var NAME = 'name';
+
+// 19.2.4.2 name
+NAME in FProto || require('./_descriptors') && dP(FProto, NAME, {
+ configurable: true,
+ get: function () {
+ try {
+ return ('' + this).match(nameRE)[1];
+ } catch (e) {
+ return '';
+ }
+ }
+});
+
+},{"./_descriptors":163,"./_object-dp":206}],295:[function(require,module,exports){
+'use strict';
+var strong = require('./_collection-strong');
+var validate = require('./_validate-collection');
+var MAP = 'Map';
+
+// 23.1 Map Objects
+module.exports = require('./_collection')(MAP, function (get) {
+ return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
+}, {
+ // 23.1.3.6 Map.prototype.get(key)
+ get: function get(key) {
+ var entry = strong.getEntry(validate(this, MAP), key);
+ return entry && entry.v;
+ },
+ // 23.1.3.9 Map.prototype.set(key, value)
+ set: function set(key, value) {
+ return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
+ }
+}, strong, true);
+
+},{"./_collection":156,"./_collection-strong":153,"./_validate-collection":260}],296:[function(require,module,exports){
+// 20.2.2.3 Math.acosh(x)
+var $export = require('./_export');
+var log1p = require('./_math-log1p');
+var sqrt = Math.sqrt;
+var $acosh = Math.acosh;
+
+$export($export.S + $export.F * !($acosh
+ // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
+ && Math.floor($acosh(Number.MAX_VALUE)) == 710
+ // Tor Browser bug: Math.acosh(Infinity) -> NaN
+ && $acosh(Infinity) == Infinity
+), 'Math', {
+ acosh: function acosh(x) {
+ return (x = +x) < 1 ? NaN : x > 94906265.62425156
+ ? Math.log(x) + Math.LN2
+ : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
+ }
+});
+
+},{"./_export":167,"./_math-log1p":197}],297:[function(require,module,exports){
+// 20.2.2.5 Math.asinh(x)
+var $export = require('./_export');
+var $asinh = Math.asinh;
+
+function asinh(x) {
+ return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
+}
+
+// Tor Browser bug: Math.asinh(0) -> -0
+$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { asinh: asinh });
+
+},{"./_export":167}],298:[function(require,module,exports){
+// 20.2.2.7 Math.atanh(x)
+var $export = require('./_export');
+var $atanh = Math.atanh;
+
+// Tor Browser bug: Math.atanh(-0) -> 0
+$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
+ atanh: function atanh(x) {
+ return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
+ }
+});
+
+},{"./_export":167}],299:[function(require,module,exports){
+// 20.2.2.9 Math.cbrt(x)
+var $export = require('./_export');
+var sign = require('./_math-sign');
+
+$export($export.S, 'Math', {
+ cbrt: function cbrt(x) {
+ return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
+ }
+});
+
+},{"./_export":167,"./_math-sign":199}],300:[function(require,module,exports){
+// 20.2.2.11 Math.clz32(x)
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ clz32: function clz32(x) {
+ return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
+ }
+});
+
+},{"./_export":167}],301:[function(require,module,exports){
+// 20.2.2.12 Math.cosh(x)
+var $export = require('./_export');
+var exp = Math.exp;
+
+$export($export.S, 'Math', {
+ cosh: function cosh(x) {
+ return (exp(x = +x) + exp(-x)) / 2;
+ }
+});
+
+},{"./_export":167}],302:[function(require,module,exports){
+// 20.2.2.14 Math.expm1(x)
+var $export = require('./_export');
+var $expm1 = require('./_math-expm1');
+
+$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 });
+
+},{"./_export":167,"./_math-expm1":195}],303:[function(require,module,exports){
+// 20.2.2.16 Math.fround(x)
+var $export = require('./_export');
+
+$export($export.S, 'Math', { fround: require('./_math-fround') });
+
+},{"./_export":167,"./_math-fround":196}],304:[function(require,module,exports){
+// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
+var $export = require('./_export');
+var abs = Math.abs;
+
+$export($export.S, 'Math', {
+ hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars
+ var sum = 0;
+ var i = 0;
+ var aLen = arguments.length;
+ var larg = 0;
+ var arg, div;
+ while (i < aLen) {
+ arg = abs(arguments[i++]);
+ if (larg < arg) {
+ div = larg / arg;
+ sum = sum * div * div + 1;
+ larg = arg;
+ } else if (arg > 0) {
+ div = arg / larg;
+ sum += div * div;
+ } else sum += arg;
+ }
+ return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
+ }
+});
+
+},{"./_export":167}],305:[function(require,module,exports){
+// 20.2.2.18 Math.imul(x, y)
+var $export = require('./_export');
+var $imul = Math.imul;
+
+// some WebKit versions fails with big numbers, some has wrong arity
+$export($export.S + $export.F * require('./_fails')(function () {
+ return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
+}), 'Math', {
+ imul: function imul(x, y) {
+ var UINT16 = 0xffff;
+ var xn = +x;
+ var yn = +y;
+ var xl = UINT16 & xn;
+ var yl = UINT16 & yn;
+ return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
+ }
+});
+
+},{"./_export":167,"./_fails":169}],306:[function(require,module,exports){
+// 20.2.2.21 Math.log10(x)
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ log10: function log10(x) {
+ return Math.log(x) * Math.LOG10E;
+ }
+});
+
+},{"./_export":167}],307:[function(require,module,exports){
+// 20.2.2.20 Math.log1p(x)
+var $export = require('./_export');
+
+$export($export.S, 'Math', { log1p: require('./_math-log1p') });
+
+},{"./_export":167,"./_math-log1p":197}],308:[function(require,module,exports){
+// 20.2.2.22 Math.log2(x)
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ log2: function log2(x) {
+ return Math.log(x) / Math.LN2;
+ }
+});
+
+},{"./_export":167}],309:[function(require,module,exports){
+// 20.2.2.28 Math.sign(x)
+var $export = require('./_export');
+
+$export($export.S, 'Math', { sign: require('./_math-sign') });
+
+},{"./_export":167,"./_math-sign":199}],310:[function(require,module,exports){
+// 20.2.2.30 Math.sinh(x)
+var $export = require('./_export');
+var expm1 = require('./_math-expm1');
+var exp = Math.exp;
+
+// V8 near Chromium 38 has a problem with very small numbers
+$export($export.S + $export.F * require('./_fails')(function () {
+ return !Math.sinh(-2e-17) != -2e-17;
+}), 'Math', {
+ sinh: function sinh(x) {
+ return Math.abs(x = +x) < 1
+ ? (expm1(x) - expm1(-x)) / 2
+ : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
+ }
+});
+
+},{"./_export":167,"./_fails":169,"./_math-expm1":195}],311:[function(require,module,exports){
+// 20.2.2.33 Math.tanh(x)
+var $export = require('./_export');
+var expm1 = require('./_math-expm1');
+var exp = Math.exp;
+
+$export($export.S, 'Math', {
+ tanh: function tanh(x) {
+ var a = expm1(x = +x);
+ var b = expm1(-x);
+ return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
+ }
+});
+
+},{"./_export":167,"./_math-expm1":195}],312:[function(require,module,exports){
+// 20.2.2.34 Math.trunc(x)
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ trunc: function trunc(it) {
+ return (it > 0 ? Math.floor : Math.ceil)(it);
+ }
+});
+
+},{"./_export":167}],313:[function(require,module,exports){
+'use strict';
+var global = require('./_global');
+var has = require('./_has');
+var cof = require('./_cof');
+var inheritIfRequired = require('./_inherit-if-required');
+var toPrimitive = require('./_to-primitive');
+var fails = require('./_fails');
+var gOPN = require('./_object-gopn').f;
+var gOPD = require('./_object-gopd').f;
+var dP = require('./_object-dp').f;
+var $trim = require('./_string-trim').trim;
+var NUMBER = 'Number';
+var $Number = global[NUMBER];
+var Base = $Number;
+var proto = $Number.prototype;
+// Opera ~12 has broken Object#toString
+var BROKEN_COF = cof(require('./_object-create')(proto)) == NUMBER;
+var TRIM = 'trim' in String.prototype;
+
+// 7.1.3 ToNumber(argument)
+var toNumber = function (argument) {
+ var it = toPrimitive(argument, false);
+ if (typeof it == 'string' && it.length > 2) {
+ it = TRIM ? it.trim() : $trim(it, 3);
+ var first = it.charCodeAt(0);
+ var third, radix, maxCode;
+ if (first === 43 || first === 45) {
+ third = it.charCodeAt(2);
+ if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
+ } else if (first === 48) {
+ switch (it.charCodeAt(1)) {
+ case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
+ case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
+ default: return +it;
+ }
+ for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) {
+ code = digits.charCodeAt(i);
+ // parseInt parses a string to a first unavailable symbol
+ // but ToNumber should return NaN if a string contains unavailable symbols
+ if (code < 48 || code > maxCode) return NaN;
+ } return parseInt(digits, radix);
+ }
+ } return +it;
+};
+
+if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) {
+ $Number = function Number(value) {
+ var it = arguments.length < 1 ? 0 : value;
+ var that = this;
+ return that instanceof $Number
+ // check on 1..constructor(foo) case
+ && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER)
+ ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
+ };
+ for (var keys = require('./_descriptors') ? gOPN(Base) : (
+ // ES3:
+ 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
+ // ES6 (in case, if modules with ES6 Number statics required before):
+ 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
+ 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
+ ).split(','), j = 0, key; keys.length > j; j++) {
+ if (has(Base, key = keys[j]) && !has($Number, key)) {
+ dP($Number, key, gOPD(Base, key));
+ }
+ }
+ $Number.prototype = proto;
+ proto.constructor = $Number;
+ require('./_redefine')(global, NUMBER, $Number);
+}
+
+},{"./_cof":152,"./_descriptors":163,"./_fails":169,"./_global":175,"./_has":176,"./_inherit-if-required":180,"./_object-create":205,"./_object-dp":206,"./_object-gopd":209,"./_object-gopn":211,"./_redefine":226,"./_string-trim":245,"./_to-primitive":254}],314:[function(require,module,exports){
+// 20.1.2.1 Number.EPSILON
+var $export = require('./_export');
+
+$export($export.S, 'Number', { EPSILON: Math.pow(2, -52) });
+
+},{"./_export":167}],315:[function(require,module,exports){
+// 20.1.2.2 Number.isFinite(number)
+var $export = require('./_export');
+var _isFinite = require('./_global').isFinite;
+
+$export($export.S, 'Number', {
+ isFinite: function isFinite(it) {
+ return typeof it == 'number' && _isFinite(it);
+ }
+});
+
+},{"./_export":167,"./_global":175}],316:[function(require,module,exports){
+// 20.1.2.3 Number.isInteger(number)
+var $export = require('./_export');
+
+$export($export.S, 'Number', { isInteger: require('./_is-integer') });
+
+},{"./_export":167,"./_is-integer":185}],317:[function(require,module,exports){
+// 20.1.2.4 Number.isNaN(number)
+var $export = require('./_export');
+
+$export($export.S, 'Number', {
+ isNaN: function isNaN(number) {
+ // eslint-disable-next-line no-self-compare
+ return number != number;
+ }
+});
+
+},{"./_export":167}],318:[function(require,module,exports){
+// 20.1.2.5 Number.isSafeInteger(number)
+var $export = require('./_export');
+var isInteger = require('./_is-integer');
+var abs = Math.abs;
+
+$export($export.S, 'Number', {
+ isSafeInteger: function isSafeInteger(number) {
+ return isInteger(number) && abs(number) <= 0x1fffffffffffff;
+ }
+});
+
+},{"./_export":167,"./_is-integer":185}],319:[function(require,module,exports){
+// 20.1.2.6 Number.MAX_SAFE_INTEGER
+var $export = require('./_export');
+
+$export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff });
+
+},{"./_export":167}],320:[function(require,module,exports){
+// 20.1.2.10 Number.MIN_SAFE_INTEGER
+var $export = require('./_export');
+
+$export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff });
+
+},{"./_export":167}],321:[function(require,module,exports){
+var $export = require('./_export');
+var $parseFloat = require('./_parse-float');
+// 20.1.2.12 Number.parseFloat(string)
+$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat });
+
+},{"./_export":167,"./_parse-float":220}],322:[function(require,module,exports){
+var $export = require('./_export');
+var $parseInt = require('./_parse-int');
+// 20.1.2.13 Number.parseInt(string, radix)
+$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { parseInt: $parseInt });
+
+},{"./_export":167,"./_parse-int":221}],323:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var toInteger = require('./_to-integer');
+var aNumberValue = require('./_a-number-value');
+var repeat = require('./_string-repeat');
+var $toFixed = 1.0.toFixed;
+var floor = Math.floor;
+var data = [0, 0, 0, 0, 0, 0];
+var ERROR = 'Number.toFixed: incorrect invocation!';
+var ZERO = '0';
+
+var multiply = function (n, c) {
+ var i = -1;
+ var c2 = c;
+ while (++i < 6) {
+ c2 += n * data[i];
+ data[i] = c2 % 1e7;
+ c2 = floor(c2 / 1e7);
+ }
+};
+var divide = function (n) {
+ var i = 6;
+ var c = 0;
+ while (--i >= 0) {
+ c += data[i];
+ data[i] = floor(c / n);
+ c = (c % n) * 1e7;
+ }
+};
+var numToString = function () {
+ var i = 6;
+ var s = '';
+ while (--i >= 0) {
+ if (s !== '' || i === 0 || data[i] !== 0) {
+ var t = String(data[i]);
+ s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
+ }
+ } return s;
+};
+var pow = function (x, n, acc) {
+ return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
+};
+var log = function (x) {
+ var n = 0;
+ var x2 = x;
+ while (x2 >= 4096) {
+ n += 12;
+ x2 /= 4096;
+ }
+ while (x2 >= 2) {
+ n += 1;
+ x2 /= 2;
+ } return n;
+};
+
+$export($export.P + $export.F * (!!$toFixed && (
+ 0.00008.toFixed(3) !== '0.000' ||
+ 0.9.toFixed(0) !== '1' ||
+ 1.255.toFixed(2) !== '1.25' ||
+ 1000000000000000128.0.toFixed(0) !== '1000000000000000128'
+) || !require('./_fails')(function () {
+ // V8 ~ Android 4.3-
+ $toFixed.call({});
+})), 'Number', {
+ toFixed: function toFixed(fractionDigits) {
+ var x = aNumberValue(this, ERROR);
+ var f = toInteger(fractionDigits);
+ var s = '';
+ var m = ZERO;
+ var e, z, j, k;
+ if (f < 0 || f > 20) throw RangeError(ERROR);
+ // eslint-disable-next-line no-self-compare
+ if (x != x) return 'NaN';
+ if (x <= -1e21 || x >= 1e21) return String(x);
+ if (x < 0) {
+ s = '-';
+ x = -x;
+ }
+ if (x > 1e-21) {
+ e = log(x * pow(2, 69, 1)) - 69;
+ z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
+ z *= 0x10000000000000;
+ e = 52 - e;
+ if (e > 0) {
+ multiply(0, z);
+ j = f;
+ while (j >= 7) {
+ multiply(1e7, 0);
+ j -= 7;
+ }
+ multiply(pow(10, j, 1), 0);
+ j = e - 1;
+ while (j >= 23) {
+ divide(1 << 23);
+ j -= 23;
+ }
+ divide(1 << j);
+ multiply(1, 1);
+ divide(2);
+ m = numToString();
+ } else {
+ multiply(0, z);
+ multiply(1 << -e, 0);
+ m = numToString() + repeat.call(ZERO, f);
+ }
+ }
+ if (f > 0) {
+ k = m.length;
+ m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
+ } else {
+ m = s + m;
+ } return m;
+ }
+});
+
+},{"./_a-number-value":137,"./_export":167,"./_fails":169,"./_string-repeat":244,"./_to-integer":250}],324:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $fails = require('./_fails');
+var aNumberValue = require('./_a-number-value');
+var $toPrecision = 1.0.toPrecision;
+
+$export($export.P + $export.F * ($fails(function () {
+ // IE7-
+ return $toPrecision.call(1, undefined) !== '1';
+}) || !$fails(function () {
+ // V8 ~ Android 4.3-
+ $toPrecision.call({});
+})), 'Number', {
+ toPrecision: function toPrecision(precision) {
+ var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
+ return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
+ }
+});
+
+},{"./_a-number-value":137,"./_export":167,"./_fails":169}],325:[function(require,module,exports){
+// 19.1.3.1 Object.assign(target, source)
+var $export = require('./_export');
+
+$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });
+
+},{"./_export":167,"./_object-assign":204}],326:[function(require,module,exports){
+var $export = require('./_export');
+// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
+$export($export.S, 'Object', { create: require('./_object-create') });
+
+},{"./_export":167,"./_object-create":205}],327:[function(require,module,exports){
+var $export = require('./_export');
+// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
+$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperties: require('./_object-dps') });
+
+},{"./_descriptors":163,"./_export":167,"./_object-dps":207}],328:[function(require,module,exports){
+var $export = require('./_export');
+// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
+$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f });
+
+},{"./_descriptors":163,"./_export":167,"./_object-dp":206}],329:[function(require,module,exports){
+// 19.1.2.5 Object.freeze(O)
+var isObject = require('./_is-object');
+var meta = require('./_meta').onFreeze;
+
+require('./_object-sap')('freeze', function ($freeze) {
+ return function freeze(it) {
+ return $freeze && isObject(it) ? $freeze(meta(it)) : it;
+ };
+});
+
+},{"./_is-object":186,"./_meta":200,"./_object-sap":217}],330:[function(require,module,exports){
+// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
+var toIObject = require('./_to-iobject');
+var $getOwnPropertyDescriptor = require('./_object-gopd').f;
+
+require('./_object-sap')('getOwnPropertyDescriptor', function () {
+ return function getOwnPropertyDescriptor(it, key) {
+ return $getOwnPropertyDescriptor(toIObject(it), key);
+ };
+});
+
+},{"./_object-gopd":209,"./_object-sap":217,"./_to-iobject":251}],331:[function(require,module,exports){
+// 19.1.2.7 Object.getOwnPropertyNames(O)
+require('./_object-sap')('getOwnPropertyNames', function () {
+ return require('./_object-gopn-ext').f;
+});
+
+},{"./_object-gopn-ext":210,"./_object-sap":217}],332:[function(require,module,exports){
+// 19.1.2.9 Object.getPrototypeOf(O)
+var toObject = require('./_to-object');
+var $getPrototypeOf = require('./_object-gpo');
+
+require('./_object-sap')('getPrototypeOf', function () {
+ return function getPrototypeOf(it) {
+ return $getPrototypeOf(toObject(it));
+ };
+});
+
+},{"./_object-gpo":213,"./_object-sap":217,"./_to-object":253}],333:[function(require,module,exports){
+// 19.1.2.11 Object.isExtensible(O)
+var isObject = require('./_is-object');
+
+require('./_object-sap')('isExtensible', function ($isExtensible) {
+ return function isExtensible(it) {
+ return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
+ };
+});
+
+},{"./_is-object":186,"./_object-sap":217}],334:[function(require,module,exports){
+// 19.1.2.12 Object.isFrozen(O)
+var isObject = require('./_is-object');
+
+require('./_object-sap')('isFrozen', function ($isFrozen) {
+ return function isFrozen(it) {
+ return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
+ };
+});
+
+},{"./_is-object":186,"./_object-sap":217}],335:[function(require,module,exports){
+// 19.1.2.13 Object.isSealed(O)
+var isObject = require('./_is-object');
+
+require('./_object-sap')('isSealed', function ($isSealed) {
+ return function isSealed(it) {
+ return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
+ };
+});
+
+},{"./_is-object":186,"./_object-sap":217}],336:[function(require,module,exports){
+// 19.1.3.10 Object.is(value1, value2)
+var $export = require('./_export');
+$export($export.S, 'Object', { is: require('./_same-value') });
+
+},{"./_export":167,"./_same-value":230}],337:[function(require,module,exports){
+// 19.1.2.14 Object.keys(O)
+var toObject = require('./_to-object');
+var $keys = require('./_object-keys');
+
+require('./_object-sap')('keys', function () {
+ return function keys(it) {
+ return $keys(toObject(it));
+ };
+});
+
+},{"./_object-keys":215,"./_object-sap":217,"./_to-object":253}],338:[function(require,module,exports){
+// 19.1.2.15 Object.preventExtensions(O)
+var isObject = require('./_is-object');
+var meta = require('./_meta').onFreeze;
+
+require('./_object-sap')('preventExtensions', function ($preventExtensions) {
+ return function preventExtensions(it) {
+ return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it;
+ };
+});
+
+},{"./_is-object":186,"./_meta":200,"./_object-sap":217}],339:[function(require,module,exports){
+// 19.1.2.17 Object.seal(O)
+var isObject = require('./_is-object');
+var meta = require('./_meta').onFreeze;
+
+require('./_object-sap')('seal', function ($seal) {
+ return function seal(it) {
+ return $seal && isObject(it) ? $seal(meta(it)) : it;
+ };
+});
+
+},{"./_is-object":186,"./_meta":200,"./_object-sap":217}],340:[function(require,module,exports){
+// 19.1.3.19 Object.setPrototypeOf(O, proto)
+var $export = require('./_export');
+$export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set });
+
+},{"./_export":167,"./_set-proto":233}],341:[function(require,module,exports){
+'use strict';
+// 19.1.3.6 Object.prototype.toString()
+var classof = require('./_classof');
+var test = {};
+test[require('./_wks')('toStringTag')] = 'z';
+if (test + '' != '[object z]') {
+ require('./_redefine')(Object.prototype, 'toString', function toString() {
+ return '[object ' + classof(this) + ']';
+ }, true);
+}
+
+},{"./_classof":151,"./_redefine":226,"./_wks":263}],342:[function(require,module,exports){
+var $export = require('./_export');
+var $parseFloat = require('./_parse-float');
+// 18.2.4 parseFloat(string)
+$export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat });
+
+},{"./_export":167,"./_parse-float":220}],343:[function(require,module,exports){
+var $export = require('./_export');
+var $parseInt = require('./_parse-int');
+// 18.2.5 parseInt(string, radix)
+$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt });
+
+},{"./_export":167,"./_parse-int":221}],344:[function(require,module,exports){
+'use strict';
+var LIBRARY = require('./_library');
+var global = require('./_global');
+var ctx = require('./_ctx');
+var classof = require('./_classof');
+var $export = require('./_export');
+var isObject = require('./_is-object');
+var aFunction = require('./_a-function');
+var anInstance = require('./_an-instance');
+var forOf = require('./_for-of');
+var speciesConstructor = require('./_species-constructor');
+var task = require('./_task').set;
+var microtask = require('./_microtask')();
+var newPromiseCapabilityModule = require('./_new-promise-capability');
+var perform = require('./_perform');
+var userAgent = require('./_user-agent');
+var promiseResolve = require('./_promise-resolve');
+var PROMISE = 'Promise';
+var TypeError = global.TypeError;
+var process = global.process;
+var versions = process && process.versions;
+var v8 = versions && versions.v8 || '';
+var $Promise = global[PROMISE];
+var isNode = classof(process) == 'process';
+var empty = function () { /* empty */ };
+var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
+var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
+
+var USE_NATIVE = !!function () {
+ try {
+ // correct subclassing with @@species support
+ var promise = $Promise.resolve(1);
+ var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) {
+ exec(empty, empty);
+ };
+ // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
+ return (isNode || typeof PromiseRejectionEvent == 'function')
+ && promise.then(empty) instanceof FakePromise
+ // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
+ // we can't detect it synchronously, so just check versions
+ && v8.indexOf('6.6') !== 0
+ && userAgent.indexOf('Chrome/66') === -1;
+ } catch (e) { /* empty */ }
+}();
+
+// helpers
+var isThenable = function (it) {
+ var then;
+ return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
+};
+var notify = function (promise, isReject) {
+ if (promise._n) return;
+ promise._n = true;
+ var chain = promise._c;
+ microtask(function () {
+ var value = promise._v;
+ var ok = promise._s == 1;
+ var i = 0;
+ var run = function (reaction) {
+ var handler = ok ? reaction.ok : reaction.fail;
+ var resolve = reaction.resolve;
+ var reject = reaction.reject;
+ var domain = reaction.domain;
+ var result, then, exited;
+ try {
+ if (handler) {
+ if (!ok) {
+ if (promise._h == 2) onHandleUnhandled(promise);
+ promise._h = 1;
+ }
+ if (handler === true) result = value;
+ else {
+ if (domain) domain.enter();
+ result = handler(value); // may throw
+ if (domain) {
+ domain.exit();
+ exited = true;
+ }
+ }
+ if (result === reaction.promise) {
+ reject(TypeError('Promise-chain cycle'));
+ } else if (then = isThenable(result)) {
+ then.call(result, resolve, reject);
+ } else resolve(result);
+ } else reject(value);
+ } catch (e) {
+ if (domain && !exited) domain.exit();
+ reject(e);
+ }
+ };
+ while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
+ promise._c = [];
+ promise._n = false;
+ if (isReject && !promise._h) onUnhandled(promise);
+ });
+};
+var onUnhandled = function (promise) {
+ task.call(global, function () {
+ var value = promise._v;
+ var unhandled = isUnhandled(promise);
+ var result, handler, console;
+ if (unhandled) {
+ result = perform(function () {
+ if (isNode) {
+ process.emit('unhandledRejection', value, promise);
+ } else if (handler = global.onunhandledrejection) {
+ handler({ promise: promise, reason: value });
+ } else if ((console = global.console) && console.error) {
+ console.error('Unhandled promise rejection', value);
+ }
+ });
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
+ promise._h = isNode || isUnhandled(promise) ? 2 : 1;
+ } promise._a = undefined;
+ if (unhandled && result.e) throw result.v;
+ });
+};
+var isUnhandled = function (promise) {
+ return promise._h !== 1 && (promise._a || promise._c).length === 0;
+};
+var onHandleUnhandled = function (promise) {
+ task.call(global, function () {
+ var handler;
+ if (isNode) {
+ process.emit('rejectionHandled', promise);
+ } else if (handler = global.onrejectionhandled) {
+ handler({ promise: promise, reason: promise._v });
+ }
+ });
+};
+var $reject = function (value) {
+ var promise = this;
+ if (promise._d) return;
+ promise._d = true;
+ promise = promise._w || promise; // unwrap
+ promise._v = value;
+ promise._s = 2;
+ if (!promise._a) promise._a = promise._c.slice();
+ notify(promise, true);
+};
+var $resolve = function (value) {
+ var promise = this;
+ var then;
+ if (promise._d) return;
+ promise._d = true;
+ promise = promise._w || promise; // unwrap
+ try {
+ if (promise === value) throw TypeError("Promise can't be resolved itself");
+ if (then = isThenable(value)) {
+ microtask(function () {
+ var wrapper = { _w: promise, _d: false }; // wrap
+ try {
+ then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
+ } catch (e) {
+ $reject.call(wrapper, e);
+ }
+ });
+ } else {
+ promise._v = value;
+ promise._s = 1;
+ notify(promise, false);
+ }
+ } catch (e) {
+ $reject.call({ _w: promise, _d: false }, e); // wrap
+ }
+};
+
+// constructor polyfill
+if (!USE_NATIVE) {
+ // 25.4.3.1 Promise(executor)
+ $Promise = function Promise(executor) {
+ anInstance(this, $Promise, PROMISE, '_h');
+ aFunction(executor);
+ Internal.call(this);
+ try {
+ executor(ctx($resolve, this, 1), ctx($reject, this, 1));
+ } catch (err) {
+ $reject.call(this, err);
+ }
+ };
+ // eslint-disable-next-line no-unused-vars
+ Internal = function Promise(executor) {
+ this._c = []; // <- awaiting reactions
+ this._a = undefined; // <- checked in isUnhandled reactions
+ this._s = 0; // <- state
+ this._d = false; // <- done
+ this._v = undefined; // <- value
+ this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
+ this._n = false; // <- notify
+ };
+ Internal.prototype = require('./_redefine-all')($Promise.prototype, {
+ // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
+ then: function then(onFulfilled, onRejected) {
+ var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
+ reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
+ reaction.fail = typeof onRejected == 'function' && onRejected;
+ reaction.domain = isNode ? process.domain : undefined;
+ this._c.push(reaction);
+ if (this._a) this._a.push(reaction);
+ if (this._s) notify(this, false);
+ return reaction.promise;
+ },
+ // 25.4.5.1 Promise.prototype.catch(onRejected)
+ 'catch': function (onRejected) {
+ return this.then(undefined, onRejected);
+ }
+ });
+ OwnPromiseCapability = function () {
+ var promise = new Internal();
+ this.promise = promise;
+ this.resolve = ctx($resolve, promise, 1);
+ this.reject = ctx($reject, promise, 1);
+ };
+ newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
+ return C === $Promise || C === Wrapper
+ ? new OwnPromiseCapability(C)
+ : newGenericPromiseCapability(C);
+ };
+}
+
+$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
+require('./_set-to-string-tag')($Promise, PROMISE);
+require('./_set-species')(PROMISE);
+Wrapper = require('./_core')[PROMISE];
+
+// statics
+$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
+ // 25.4.4.5 Promise.reject(r)
+ reject: function reject(r) {
+ var capability = newPromiseCapability(this);
+ var $$reject = capability.reject;
+ $$reject(r);
+ return capability.promise;
+ }
+});
+$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
+ // 25.4.4.6 Promise.resolve(x)
+ resolve: function resolve(x) {
+ return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
+ }
+});
+$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {
+ $Promise.all(iter)['catch'](empty);
+})), PROMISE, {
+ // 25.4.4.1 Promise.all(iterable)
+ all: function all(iterable) {
+ var C = this;
+ var capability = newPromiseCapability(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function () {
+ var values = [];
+ var index = 0;
+ var remaining = 1;
+ forOf(iterable, false, function (promise) {
+ var $index = index++;
+ var alreadyCalled = false;
+ values.push(undefined);
+ remaining++;
+ C.resolve(promise).then(function (value) {
+ if (alreadyCalled) return;
+ alreadyCalled = true;
+ values[$index] = value;
+ --remaining || resolve(values);
+ }, reject);
+ });
+ --remaining || resolve(values);
+ });
+ if (result.e) reject(result.v);
+ return capability.promise;
+ },
+ // 25.4.4.4 Promise.race(iterable)
+ race: function race(iterable) {
+ var C = this;
+ var capability = newPromiseCapability(C);
+ var reject = capability.reject;
+ var result = perform(function () {
+ forOf(iterable, false, function (promise) {
+ C.resolve(promise).then(capability.resolve, reject);
+ });
+ });
+ if (result.e) reject(result.v);
+ return capability.promise;
+ }
+});
+
+},{"./_a-function":136,"./_an-instance":140,"./_classof":151,"./_core":157,"./_ctx":159,"./_export":167,"./_for-of":173,"./_global":175,"./_is-object":186,"./_iter-detect":191,"./_library":194,"./_microtask":202,"./_new-promise-capability":203,"./_perform":222,"./_promise-resolve":223,"./_redefine-all":225,"./_set-species":234,"./_set-to-string-tag":235,"./_species-constructor":238,"./_task":247,"./_user-agent":259,"./_wks":263}],345:[function(require,module,exports){
+// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
+var $export = require('./_export');
+var aFunction = require('./_a-function');
+var anObject = require('./_an-object');
+var rApply = (require('./_global').Reflect || {}).apply;
+var fApply = Function.apply;
+// MS Edge argumentsList argument is optional
+$export($export.S + $export.F * !require('./_fails')(function () {
+ rApply(function () { /* empty */ });
+}), 'Reflect', {
+ apply: function apply(target, thisArgument, argumentsList) {
+ var T = aFunction(target);
+ var L = anObject(argumentsList);
+ return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
+ }
+});
+
+},{"./_a-function":136,"./_an-object":141,"./_export":167,"./_fails":169,"./_global":175}],346:[function(require,module,exports){
+// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
+var $export = require('./_export');
+var create = require('./_object-create');
+var aFunction = require('./_a-function');
+var anObject = require('./_an-object');
+var isObject = require('./_is-object');
+var fails = require('./_fails');
+var bind = require('./_bind');
+var rConstruct = (require('./_global').Reflect || {}).construct;
+
+// MS Edge supports only 2 arguments and argumentsList argument is optional
+// FF Nightly sets third argument as `new.target`, but does not create `this` from it
+var NEW_TARGET_BUG = fails(function () {
+ function F() { /* empty */ }
+ return !(rConstruct(function () { /* empty */ }, [], F) instanceof F);
+});
+var ARGS_BUG = !fails(function () {
+ rConstruct(function () { /* empty */ });
+});
+
+$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
+ construct: function construct(Target, args /* , newTarget */) {
+ aFunction(Target);
+ anObject(args);
+ var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
+ if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget);
+ if (Target == newTarget) {
+ // w/o altered newTarget, optimization for 0-4 arguments
+ switch (args.length) {
+ case 0: return new Target();
+ case 1: return new Target(args[0]);
+ case 2: return new Target(args[0], args[1]);
+ case 3: return new Target(args[0], args[1], args[2]);
+ case 4: return new Target(args[0], args[1], args[2], args[3]);
+ }
+ // w/o altered newTarget, lot of arguments case
+ var $args = [null];
+ $args.push.apply($args, args);
+ return new (bind.apply(Target, $args))();
+ }
+ // with altered newTarget, not support built-in constructors
+ var proto = newTarget.prototype;
+ var instance = create(isObject(proto) ? proto : Object.prototype);
+ var result = Function.apply.call(Target, instance, args);
+ return isObject(result) ? result : instance;
+ }
+});
+
+},{"./_a-function":136,"./_an-object":141,"./_bind":150,"./_export":167,"./_fails":169,"./_global":175,"./_is-object":186,"./_object-create":205}],347:[function(require,module,exports){
+// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
+var dP = require('./_object-dp');
+var $export = require('./_export');
+var anObject = require('./_an-object');
+var toPrimitive = require('./_to-primitive');
+
+// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
+$export($export.S + $export.F * require('./_fails')(function () {
+ // eslint-disable-next-line no-undef
+ Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 });
+}), 'Reflect', {
+ defineProperty: function defineProperty(target, propertyKey, attributes) {
+ anObject(target);
+ propertyKey = toPrimitive(propertyKey, true);
+ anObject(attributes);
+ try {
+ dP.f(target, propertyKey, attributes);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+});
+
+},{"./_an-object":141,"./_export":167,"./_fails":169,"./_object-dp":206,"./_to-primitive":254}],348:[function(require,module,exports){
+// 26.1.4 Reflect.deleteProperty(target, propertyKey)
+var $export = require('./_export');
+var gOPD = require('./_object-gopd').f;
+var anObject = require('./_an-object');
+
+$export($export.S, 'Reflect', {
+ deleteProperty: function deleteProperty(target, propertyKey) {
+ var desc = gOPD(anObject(target), propertyKey);
+ return desc && !desc.configurable ? false : delete target[propertyKey];
+ }
+});
+
+},{"./_an-object":141,"./_export":167,"./_object-gopd":209}],349:[function(require,module,exports){
+'use strict';
+// 26.1.5 Reflect.enumerate(target)
+var $export = require('./_export');
+var anObject = require('./_an-object');
+var Enumerate = function (iterated) {
+ this._t = anObject(iterated); // target
+ this._i = 0; // next index
+ var keys = this._k = []; // keys
+ var key;
+ for (key in iterated) keys.push(key);
+};
+require('./_iter-create')(Enumerate, 'Object', function () {
+ var that = this;
+ var keys = that._k;
+ var key;
+ do {
+ if (that._i >= keys.length) return { value: undefined, done: true };
+ } while (!((key = keys[that._i++]) in that._t));
+ return { value: key, done: false };
+});
+
+$export($export.S, 'Reflect', {
+ enumerate: function enumerate(target) {
+ return new Enumerate(target);
+ }
+});
+
+},{"./_an-object":141,"./_export":167,"./_iter-create":189}],350:[function(require,module,exports){
+// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
+var gOPD = require('./_object-gopd');
+var $export = require('./_export');
+var anObject = require('./_an-object');
+
+$export($export.S, 'Reflect', {
+ getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) {
+ return gOPD.f(anObject(target), propertyKey);
+ }
+});
+
+},{"./_an-object":141,"./_export":167,"./_object-gopd":209}],351:[function(require,module,exports){
+// 26.1.8 Reflect.getPrototypeOf(target)
+var $export = require('./_export');
+var getProto = require('./_object-gpo');
+var anObject = require('./_an-object');
+
+$export($export.S, 'Reflect', {
+ getPrototypeOf: function getPrototypeOf(target) {
+ return getProto(anObject(target));
+ }
+});
+
+},{"./_an-object":141,"./_export":167,"./_object-gpo":213}],352:[function(require,module,exports){
+// 26.1.6 Reflect.get(target, propertyKey [, receiver])
+var gOPD = require('./_object-gopd');
+var getPrototypeOf = require('./_object-gpo');
+var has = require('./_has');
+var $export = require('./_export');
+var isObject = require('./_is-object');
+var anObject = require('./_an-object');
+
+function get(target, propertyKey /* , receiver */) {
+ var receiver = arguments.length < 3 ? target : arguments[2];
+ var desc, proto;
+ if (anObject(target) === receiver) return target[propertyKey];
+ if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value')
+ ? desc.value
+ : desc.get !== undefined
+ ? desc.get.call(receiver)
+ : undefined;
+ if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver);
+}
+
+$export($export.S, 'Reflect', { get: get });
+
+},{"./_an-object":141,"./_export":167,"./_has":176,"./_is-object":186,"./_object-gopd":209,"./_object-gpo":213}],353:[function(require,module,exports){
+// 26.1.9 Reflect.has(target, propertyKey)
+var $export = require('./_export');
+
+$export($export.S, 'Reflect', {
+ has: function has(target, propertyKey) {
+ return propertyKey in target;
+ }
+});
+
+},{"./_export":167}],354:[function(require,module,exports){
+// 26.1.10 Reflect.isExtensible(target)
+var $export = require('./_export');
+var anObject = require('./_an-object');
+var $isExtensible = Object.isExtensible;
+
+$export($export.S, 'Reflect', {
+ isExtensible: function isExtensible(target) {
+ anObject(target);
+ return $isExtensible ? $isExtensible(target) : true;
+ }
+});
+
+},{"./_an-object":141,"./_export":167}],355:[function(require,module,exports){
+// 26.1.11 Reflect.ownKeys(target)
+var $export = require('./_export');
+
+$export($export.S, 'Reflect', { ownKeys: require('./_own-keys') });
+
+},{"./_export":167,"./_own-keys":219}],356:[function(require,module,exports){
+// 26.1.12 Reflect.preventExtensions(target)
+var $export = require('./_export');
+var anObject = require('./_an-object');
+var $preventExtensions = Object.preventExtensions;
+
+$export($export.S, 'Reflect', {
+ preventExtensions: function preventExtensions(target) {
+ anObject(target);
+ try {
+ if ($preventExtensions) $preventExtensions(target);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+});
+
+},{"./_an-object":141,"./_export":167}],357:[function(require,module,exports){
+// 26.1.14 Reflect.setPrototypeOf(target, proto)
+var $export = require('./_export');
+var setProto = require('./_set-proto');
+
+if (setProto) $export($export.S, 'Reflect', {
+ setPrototypeOf: function setPrototypeOf(target, proto) {
+ setProto.check(target, proto);
+ try {
+ setProto.set(target, proto);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+});
+
+},{"./_export":167,"./_set-proto":233}],358:[function(require,module,exports){
+// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
+var dP = require('./_object-dp');
+var gOPD = require('./_object-gopd');
+var getPrototypeOf = require('./_object-gpo');
+var has = require('./_has');
+var $export = require('./_export');
+var createDesc = require('./_property-desc');
+var anObject = require('./_an-object');
+var isObject = require('./_is-object');
+
+function set(target, propertyKey, V /* , receiver */) {
+ var receiver = arguments.length < 4 ? target : arguments[3];
+ var ownDesc = gOPD.f(anObject(target), propertyKey);
+ var existingDescriptor, proto;
+ if (!ownDesc) {
+ if (isObject(proto = getPrototypeOf(target))) {
+ return set(proto, propertyKey, V, receiver);
+ }
+ ownDesc = createDesc(0);
+ }
+ if (has(ownDesc, 'value')) {
+ if (ownDesc.writable === false || !isObject(receiver)) return false;
+ if (existingDescriptor = gOPD.f(receiver, propertyKey)) {
+ if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
+ existingDescriptor.value = V;
+ dP.f(receiver, propertyKey, existingDescriptor);
+ } else dP.f(receiver, propertyKey, createDesc(0, V));
+ return true;
+ }
+ return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
+}
+
+$export($export.S, 'Reflect', { set: set });
+
+},{"./_an-object":141,"./_export":167,"./_has":176,"./_is-object":186,"./_object-dp":206,"./_object-gopd":209,"./_object-gpo":213,"./_property-desc":224}],359:[function(require,module,exports){
+var global = require('./_global');
+var inheritIfRequired = require('./_inherit-if-required');
+var dP = require('./_object-dp').f;
+var gOPN = require('./_object-gopn').f;
+var isRegExp = require('./_is-regexp');
+var $flags = require('./_flags');
+var $RegExp = global.RegExp;
+var Base = $RegExp;
+var proto = $RegExp.prototype;
+var re1 = /a/g;
+var re2 = /a/g;
+// "new" creates a new object, old webkit buggy here
+var CORRECT_NEW = new $RegExp(re1) !== re1;
+
+if (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () {
+ re2[require('./_wks')('match')] = false;
+ // RegExp constructor can alter flags and IsRegExp works correct with @@match
+ return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
+}))) {
+ $RegExp = function RegExp(p, f) {
+ var tiRE = this instanceof $RegExp;
+ var piRE = isRegExp(p);
+ var fiU = f === undefined;
+ return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
+ : inheritIfRequired(CORRECT_NEW
+ ? new Base(piRE && !fiU ? p.source : p, f)
+ : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)
+ , tiRE ? this : proto, $RegExp);
+ };
+ var proxy = function (key) {
+ key in $RegExp || dP($RegExp, key, {
+ configurable: true,
+ get: function () { return Base[key]; },
+ set: function (it) { Base[key] = it; }
+ });
+ };
+ for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]);
+ proto.constructor = $RegExp;
+ $RegExp.prototype = proto;
+ require('./_redefine')(global, 'RegExp', $RegExp);
+}
+
+require('./_set-species')('RegExp');
+
+},{"./_descriptors":163,"./_fails":169,"./_flags":171,"./_global":175,"./_inherit-if-required":180,"./_is-regexp":187,"./_object-dp":206,"./_object-gopn":211,"./_redefine":226,"./_set-species":234,"./_wks":263}],360:[function(require,module,exports){
+'use strict';
+var regexpExec = require('./_regexp-exec');
+require('./_export')({
+ target: 'RegExp',
+ proto: true,
+ forced: regexpExec !== /./.exec
+}, {
+ exec: regexpExec
+});
+
+},{"./_export":167,"./_regexp-exec":228}],361:[function(require,module,exports){
+// 21.2.5.3 get RegExp.prototype.flags()
+if (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', {
+ configurable: true,
+ get: require('./_flags')
+});
+
+},{"./_descriptors":163,"./_flags":171,"./_object-dp":206}],362:[function(require,module,exports){
+'use strict';
+
+var anObject = require('./_an-object');
+var toLength = require('./_to-length');
+var advanceStringIndex = require('./_advance-string-index');
+var regExpExec = require('./_regexp-exec-abstract');
+
+// @@match logic
+require('./_fix-re-wks')('match', 1, function (defined, MATCH, $match, maybeCallNative) {
+ return [
+ // `String.prototype.match` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.match
+ function match(regexp) {
+ var O = defined(this);
+ var fn = regexp == undefined ? undefined : regexp[MATCH];
+ return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
+ },
+ // `RegExp.prototype[@@match]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
+ function (regexp) {
+ var res = maybeCallNative($match, regexp, this);
+ if (res.done) return res.value;
+ var rx = anObject(regexp);
+ var S = String(this);
+ if (!rx.global) return regExpExec(rx, S);
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ var A = [];
+ var n = 0;
+ var result;
+ while ((result = regExpExec(rx, S)) !== null) {
+ var matchStr = String(result[0]);
+ A[n] = matchStr;
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ n++;
+ }
+ return n === 0 ? null : A;
+ }
+ ];
+});
+
+},{"./_advance-string-index":139,"./_an-object":141,"./_fix-re-wks":170,"./_regexp-exec-abstract":227,"./_to-length":252}],363:[function(require,module,exports){
+'use strict';
+
+var anObject = require('./_an-object');
+var toObject = require('./_to-object');
+var toLength = require('./_to-length');
+var toInteger = require('./_to-integer');
+var advanceStringIndex = require('./_advance-string-index');
+var regExpExec = require('./_regexp-exec-abstract');
+var max = Math.max;
+var min = Math.min;
+var floor = Math.floor;
+var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g;
+var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g;
+
+var maybeToString = function (it) {
+ return it === undefined ? it : String(it);
+};
+
+// @@replace logic
+require('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {
+ return [
+ // `String.prototype.replace` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.replace
+ function replace(searchValue, replaceValue) {
+ var O = defined(this);
+ var fn = searchValue == undefined ? undefined : searchValue[REPLACE];
+ return fn !== undefined
+ ? fn.call(searchValue, O, replaceValue)
+ : $replace.call(String(O), searchValue, replaceValue);
+ },
+ // `RegExp.prototype[@@replace]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
+ function (regexp, replaceValue) {
+ var res = maybeCallNative($replace, regexp, this, replaceValue);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+ var functionalReplace = typeof replaceValue === 'function';
+ if (!functionalReplace) replaceValue = String(replaceValue);
+ var global = rx.global;
+ if (global) {
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ }
+ var results = [];
+ while (true) {
+ var result = regExpExec(rx, S);
+ if (result === null) break;
+ results.push(result);
+ if (!global) break;
+ var matchStr = String(result[0]);
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ }
+ var accumulatedResult = '';
+ var nextSourcePosition = 0;
+ for (var i = 0; i < results.length; i++) {
+ result = results[i];
+ var matched = String(result[0]);
+ var position = max(min(toInteger(result.index), S.length), 0);
+ var captures = [];
+ // NOTE: This is equivalent to
+ // captures = result.slice(1).map(maybeToString)
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
+ for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
+ var namedCaptures = result.groups;
+ if (functionalReplace) {
+ var replacerArgs = [matched].concat(captures, position, S);
+ if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
+ var replacement = String(replaceValue.apply(undefined, replacerArgs));
+ } else {
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
+ }
+ if (position >= nextSourcePosition) {
+ accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
+ nextSourcePosition = position + matched.length;
+ }
+ }
+ return accumulatedResult + S.slice(nextSourcePosition);
+ }
+ ];
+
+ // https://tc39.github.io/ecma262/#sec-getsubstitution
+ function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
+ var tailPos = position + matched.length;
+ var m = captures.length;
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
+ if (namedCaptures !== undefined) {
+ namedCaptures = toObject(namedCaptures);
+ symbols = SUBSTITUTION_SYMBOLS;
+ }
+ return $replace.call(replacement, symbols, function (match, ch) {
+ var capture;
+ switch (ch.charAt(0)) {
+ case '$': return '$';
+ case '&': return matched;
+ case '`': return str.slice(0, position);
+ case "'": return str.slice(tailPos);
+ case '<':
+ capture = namedCaptures[ch.slice(1, -1)];
+ break;
+ default: // \d\d?
+ var n = +ch;
+ if (n === 0) return match;
+ if (n > m) {
+ var f = floor(n / 10);
+ if (f === 0) return match;
+ if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
+ return match;
+ }
+ capture = captures[n - 1];
+ }
+ return capture === undefined ? '' : capture;
+ });
+ }
+});
+
+},{"./_advance-string-index":139,"./_an-object":141,"./_fix-re-wks":170,"./_regexp-exec-abstract":227,"./_to-integer":250,"./_to-length":252,"./_to-object":253}],364:[function(require,module,exports){
+'use strict';
+
+var anObject = require('./_an-object');
+var sameValue = require('./_same-value');
+var regExpExec = require('./_regexp-exec-abstract');
+
+// @@search logic
+require('./_fix-re-wks')('search', 1, function (defined, SEARCH, $search, maybeCallNative) {
+ return [
+ // `String.prototype.search` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.search
+ function search(regexp) {
+ var O = defined(this);
+ var fn = regexp == undefined ? undefined : regexp[SEARCH];
+ return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
+ },
+ // `RegExp.prototype[@@search]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
+ function (regexp) {
+ var res = maybeCallNative($search, regexp, this);
+ if (res.done) return res.value;
+ var rx = anObject(regexp);
+ var S = String(this);
+ var previousLastIndex = rx.lastIndex;
+ if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
+ var result = regExpExec(rx, S);
+ if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
+ return result === null ? -1 : result.index;
+ }
+ ];
+});
+
+},{"./_an-object":141,"./_fix-re-wks":170,"./_regexp-exec-abstract":227,"./_same-value":230}],365:[function(require,module,exports){
+'use strict';
+
+var isRegExp = require('./_is-regexp');
+var anObject = require('./_an-object');
+var speciesConstructor = require('./_species-constructor');
+var advanceStringIndex = require('./_advance-string-index');
+var toLength = require('./_to-length');
+var callRegExpExec = require('./_regexp-exec-abstract');
+var regexpExec = require('./_regexp-exec');
+var fails = require('./_fails');
+var $min = Math.min;
+var $push = [].push;
+var $SPLIT = 'split';
+var LENGTH = 'length';
+var LAST_INDEX = 'lastIndex';
+var MAX_UINT32 = 0xffffffff;
+
+// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
+var SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); });
+
+// @@split logic
+require('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split, maybeCallNative) {
+ var internalSplit;
+ if (
+ 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||
+ 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||
+ 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||
+ '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||
+ '.'[$SPLIT](/()()/)[LENGTH] > 1 ||
+ ''[$SPLIT](/.?/)[LENGTH]
+ ) {
+ // based on es5-shim implementation, need to rework it
+ internalSplit = function (separator, limit) {
+ var string = String(this);
+ if (separator === undefined && limit === 0) return [];
+ // If `separator` is not a regex, use native split
+ if (!isRegExp(separator)) return $split.call(string, separator, limit);
+ var output = [];
+ var flags = (separator.ignoreCase ? 'i' : '') +
+ (separator.multiline ? 'm' : '') +
+ (separator.unicode ? 'u' : '') +
+ (separator.sticky ? 'y' : '');
+ var lastLastIndex = 0;
+ var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ // Make `global` and avoid `lastIndex` issues by working with a copy
+ var separatorCopy = new RegExp(separator.source, flags + 'g');
+ var match, lastIndex, lastLength;
+ while (match = regexpExec.call(separatorCopy, string)) {
+ lastIndex = separatorCopy[LAST_INDEX];
+ if (lastIndex > lastLastIndex) {
+ output.push(string.slice(lastLastIndex, match.index));
+ if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));
+ lastLength = match[0][LENGTH];
+ lastLastIndex = lastIndex;
+ if (output[LENGTH] >= splitLimit) break;
+ }
+ if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
+ }
+ if (lastLastIndex === string[LENGTH]) {
+ if (lastLength || !separatorCopy.test('')) output.push('');
+ } else output.push(string.slice(lastLastIndex));
+ return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
+ };
+ // Chakra, V8
+ } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {
+ internalSplit = function (separator, limit) {
+ return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);
+ };
+ } else {
+ internalSplit = $split;
+ }
+
+ return [
+ // `String.prototype.split` method
+ // https://tc39.github.io/ecma262/#sec-string.prototype.split
+ function split(separator, limit) {
+ var O = defined(this);
+ var splitter = separator == undefined ? undefined : separator[SPLIT];
+ return splitter !== undefined
+ ? splitter.call(separator, O, limit)
+ : internalSplit.call(String(O), separator, limit);
+ },
+ // `RegExp.prototype[@@split]` method
+ // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
+ //
+ // NOTE: This cannot be properly polyfilled in engines that don't support
+ // the 'y' flag.
+ function (regexp, limit) {
+ var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+ var C = speciesConstructor(rx, RegExp);
+
+ var unicodeMatching = rx.unicode;
+ var flags = (rx.ignoreCase ? 'i' : '') +
+ (rx.multiline ? 'm' : '') +
+ (rx.unicode ? 'u' : '') +
+ (SUPPORTS_Y ? 'y' : 'g');
+
+ // ^(? + rx + ) is needed, in combination with some S slicing, to
+ // simulate the 'y' flag.
+ var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
+ var p = 0;
+ var q = 0;
+ var A = [];
+ while (q < S.length) {
+ splitter.lastIndex = SUPPORTS_Y ? q : 0;
+ var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
+ var e;
+ if (
+ z === null ||
+ (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
+ ) {
+ q = advanceStringIndex(S, q, unicodeMatching);
+ } else {
+ A.push(S.slice(p, q));
+ if (A.length === lim) return A;
+ for (var i = 1; i <= z.length - 1; i++) {
+ A.push(z[i]);
+ if (A.length === lim) return A;
+ }
+ q = p = e;
+ }
+ }
+ A.push(S.slice(p));
+ return A;
+ }
+ ];
+});
+
+},{"./_advance-string-index":139,"./_an-object":141,"./_fails":169,"./_fix-re-wks":170,"./_is-regexp":187,"./_regexp-exec":228,"./_regexp-exec-abstract":227,"./_species-constructor":238,"./_to-length":252}],366:[function(require,module,exports){
+'use strict';
+require('./es6.regexp.flags');
+var anObject = require('./_an-object');
+var $flags = require('./_flags');
+var DESCRIPTORS = require('./_descriptors');
+var TO_STRING = 'toString';
+var $toString = /./[TO_STRING];
+
+var define = function (fn) {
+ require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);
+};
+
+// 21.2.5.14 RegExp.prototype.toString()
+if (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {
+ define(function toString() {
+ var R = anObject(this);
+ return '/'.concat(R.source, '/',
+ 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
+ });
+// FF44- RegExp#toString has a wrong name
+} else if ($toString.name != TO_STRING) {
+ define(function toString() {
+ return $toString.call(this);
+ });
+}
+
+},{"./_an-object":141,"./_descriptors":163,"./_fails":169,"./_flags":171,"./_redefine":226,"./es6.regexp.flags":361}],367:[function(require,module,exports){
+'use strict';
+var strong = require('./_collection-strong');
+var validate = require('./_validate-collection');
+var SET = 'Set';
+
+// 23.2 Set Objects
+module.exports = require('./_collection')(SET, function (get) {
+ return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
+}, {
+ // 23.2.3.1 Set.prototype.add(value)
+ add: function add(value) {
+ return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value);
+ }
+}, strong);
+
+},{"./_collection":156,"./_collection-strong":153,"./_validate-collection":260}],368:[function(require,module,exports){
+'use strict';
+// B.2.3.2 String.prototype.anchor(name)
+require('./_string-html')('anchor', function (createHTML) {
+ return function anchor(name) {
+ return createHTML(this, 'a', 'name', name);
+ };
+});
+
+},{"./_string-html":242}],369:[function(require,module,exports){
+'use strict';
+// B.2.3.3 String.prototype.big()
+require('./_string-html')('big', function (createHTML) {
+ return function big() {
+ return createHTML(this, 'big', '', '');
+ };
+});
+
+},{"./_string-html":242}],370:[function(require,module,exports){
+'use strict';
+// B.2.3.4 String.prototype.blink()
+require('./_string-html')('blink', function (createHTML) {
+ return function blink() {
+ return createHTML(this, 'blink', '', '');
+ };
+});
+
+},{"./_string-html":242}],371:[function(require,module,exports){
+'use strict';
+// B.2.3.5 String.prototype.bold()
+require('./_string-html')('bold', function (createHTML) {
+ return function bold() {
+ return createHTML(this, 'b', '', '');
+ };
+});
+
+},{"./_string-html":242}],372:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $at = require('./_string-at')(false);
+$export($export.P, 'String', {
+ // 21.1.3.3 String.prototype.codePointAt(pos)
+ codePointAt: function codePointAt(pos) {
+ return $at(this, pos);
+ }
+});
+
+},{"./_export":167,"./_string-at":240}],373:[function(require,module,exports){
+// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
+'use strict';
+var $export = require('./_export');
+var toLength = require('./_to-length');
+var context = require('./_string-context');
+var ENDS_WITH = 'endsWith';
+var $endsWith = ''[ENDS_WITH];
+
+$export($export.P + $export.F * require('./_fails-is-regexp')(ENDS_WITH), 'String', {
+ endsWith: function endsWith(searchString /* , endPosition = @length */) {
+ var that = context(this, searchString, ENDS_WITH);
+ var endPosition = arguments.length > 1 ? arguments[1] : undefined;
+ var len = toLength(that.length);
+ var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
+ var search = String(searchString);
+ return $endsWith
+ ? $endsWith.call(that, search, end)
+ : that.slice(end - search.length, end) === search;
+ }
+});
+
+},{"./_export":167,"./_fails-is-regexp":168,"./_string-context":241,"./_to-length":252}],374:[function(require,module,exports){
+'use strict';
+// B.2.3.6 String.prototype.fixed()
+require('./_string-html')('fixed', function (createHTML) {
+ return function fixed() {
+ return createHTML(this, 'tt', '', '');
+ };
+});
+
+},{"./_string-html":242}],375:[function(require,module,exports){
+'use strict';
+// B.2.3.7 String.prototype.fontcolor(color)
+require('./_string-html')('fontcolor', function (createHTML) {
+ return function fontcolor(color) {
+ return createHTML(this, 'font', 'color', color);
+ };
+});
+
+},{"./_string-html":242}],376:[function(require,module,exports){
+'use strict';
+// B.2.3.8 String.prototype.fontsize(size)
+require('./_string-html')('fontsize', function (createHTML) {
+ return function fontsize(size) {
+ return createHTML(this, 'font', 'size', size);
+ };
+});
+
+},{"./_string-html":242}],377:[function(require,module,exports){
+var $export = require('./_export');
+var toAbsoluteIndex = require('./_to-absolute-index');
+var fromCharCode = String.fromCharCode;
+var $fromCodePoint = String.fromCodePoint;
+
+// length should be 1, old FF problem
+$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
+ // 21.1.2.2 String.fromCodePoint(...codePoints)
+ fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars
+ var res = [];
+ var aLen = arguments.length;
+ var i = 0;
+ var code;
+ while (aLen > i) {
+ code = +arguments[i++];
+ if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
+ res.push(code < 0x10000
+ ? fromCharCode(code)
+ : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
+ );
+ } return res.join('');
+ }
+});
+
+},{"./_export":167,"./_to-absolute-index":248}],378:[function(require,module,exports){
+// 21.1.3.7 String.prototype.includes(searchString, position = 0)
+'use strict';
+var $export = require('./_export');
+var context = require('./_string-context');
+var INCLUDES = 'includes';
+
+$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', {
+ includes: function includes(searchString /* , position = 0 */) {
+ return !!~context(this, searchString, INCLUDES)
+ .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+},{"./_export":167,"./_fails-is-regexp":168,"./_string-context":241}],379:[function(require,module,exports){
+'use strict';
+// B.2.3.9 String.prototype.italics()
+require('./_string-html')('italics', function (createHTML) {
+ return function italics() {
+ return createHTML(this, 'i', '', '');
+ };
+});
+
+},{"./_string-html":242}],380:[function(require,module,exports){
+'use strict';
+var $at = require('./_string-at')(true);
+
+// 21.1.3.27 String.prototype[@@iterator]()
+require('./_iter-define')(String, 'String', function (iterated) {
+ this._t = String(iterated); // target
+ this._i = 0; // next index
+// 21.1.5.2.1 %StringIteratorPrototype%.next()
+}, function () {
+ var O = this._t;
+ var index = this._i;
+ var point;
+ if (index >= O.length) return { value: undefined, done: true };
+ point = $at(O, index);
+ this._i += point.length;
+ return { value: point, done: false };
+});
+
+},{"./_iter-define":190,"./_string-at":240}],381:[function(require,module,exports){
+'use strict';
+// B.2.3.10 String.prototype.link(url)
+require('./_string-html')('link', function (createHTML) {
+ return function link(url) {
+ return createHTML(this, 'a', 'href', url);
+ };
+});
+
+},{"./_string-html":242}],382:[function(require,module,exports){
+var $export = require('./_export');
+var toIObject = require('./_to-iobject');
+var toLength = require('./_to-length');
+
+$export($export.S, 'String', {
+ // 21.1.2.4 String.raw(callSite, ...substitutions)
+ raw: function raw(callSite) {
+ var tpl = toIObject(callSite.raw);
+ var len = toLength(tpl.length);
+ var aLen = arguments.length;
+ var res = [];
+ var i = 0;
+ while (len > i) {
+ res.push(String(tpl[i++]));
+ if (i < aLen) res.push(String(arguments[i]));
+ } return res.join('');
+ }
+});
+
+},{"./_export":167,"./_to-iobject":251,"./_to-length":252}],383:[function(require,module,exports){
+var $export = require('./_export');
+
+$export($export.P, 'String', {
+ // 21.1.3.13 String.prototype.repeat(count)
+ repeat: require('./_string-repeat')
+});
+
+},{"./_export":167,"./_string-repeat":244}],384:[function(require,module,exports){
+'use strict';
+// B.2.3.11 String.prototype.small()
+require('./_string-html')('small', function (createHTML) {
+ return function small() {
+ return createHTML(this, 'small', '', '');
+ };
+});
+
+},{"./_string-html":242}],385:[function(require,module,exports){
+// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
+'use strict';
+var $export = require('./_export');
+var toLength = require('./_to-length');
+var context = require('./_string-context');
+var STARTS_WITH = 'startsWith';
+var $startsWith = ''[STARTS_WITH];
+
+$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', {
+ startsWith: function startsWith(searchString /* , position = 0 */) {
+ var that = context(this, searchString, STARTS_WITH);
+ var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));
+ var search = String(searchString);
+ return $startsWith
+ ? $startsWith.call(that, search, index)
+ : that.slice(index, index + search.length) === search;
+ }
+});
+
+},{"./_export":167,"./_fails-is-regexp":168,"./_string-context":241,"./_to-length":252}],386:[function(require,module,exports){
+'use strict';
+// B.2.3.12 String.prototype.strike()
+require('./_string-html')('strike', function (createHTML) {
+ return function strike() {
+ return createHTML(this, 'strike', '', '');
+ };
+});
+
+},{"./_string-html":242}],387:[function(require,module,exports){
+'use strict';
+// B.2.3.13 String.prototype.sub()
+require('./_string-html')('sub', function (createHTML) {
+ return function sub() {
+ return createHTML(this, 'sub', '', '');
+ };
+});
+
+},{"./_string-html":242}],388:[function(require,module,exports){
+'use strict';
+// B.2.3.14 String.prototype.sup()
+require('./_string-html')('sup', function (createHTML) {
+ return function sup() {
+ return createHTML(this, 'sup', '', '');
+ };
+});
+
+},{"./_string-html":242}],389:[function(require,module,exports){
+'use strict';
+// 21.1.3.25 String.prototype.trim()
+require('./_string-trim')('trim', function ($trim) {
+ return function trim() {
+ return $trim(this, 3);
+ };
+});
+
+},{"./_string-trim":245}],390:[function(require,module,exports){
+'use strict';
+// ECMAScript 6 symbols shim
+var global = require('./_global');
+var has = require('./_has');
+var DESCRIPTORS = require('./_descriptors');
+var $export = require('./_export');
+var redefine = require('./_redefine');
+var META = require('./_meta').KEY;
+var $fails = require('./_fails');
+var shared = require('./_shared');
+var setToStringTag = require('./_set-to-string-tag');
+var uid = require('./_uid');
+var wks = require('./_wks');
+var wksExt = require('./_wks-ext');
+var wksDefine = require('./_wks-define');
+var enumKeys = require('./_enum-keys');
+var isArray = require('./_is-array');
+var anObject = require('./_an-object');
+var isObject = require('./_is-object');
+var toIObject = require('./_to-iobject');
+var toPrimitive = require('./_to-primitive');
+var createDesc = require('./_property-desc');
+var _create = require('./_object-create');
+var gOPNExt = require('./_object-gopn-ext');
+var $GOPD = require('./_object-gopd');
+var $DP = require('./_object-dp');
+var $keys = require('./_object-keys');
+var gOPD = $GOPD.f;
+var dP = $DP.f;
+var gOPN = gOPNExt.f;
+var $Symbol = global.Symbol;
+var $JSON = global.JSON;
+var _stringify = $JSON && $JSON.stringify;
+var PROTOTYPE = 'prototype';
+var HIDDEN = wks('_hidden');
+var TO_PRIMITIVE = wks('toPrimitive');
+var isEnum = {}.propertyIsEnumerable;
+var SymbolRegistry = shared('symbol-registry');
+var AllSymbols = shared('symbols');
+var OPSymbols = shared('op-symbols');
+var ObjectProto = Object[PROTOTYPE];
+var USE_NATIVE = typeof $Symbol == 'function';
+var QObject = global.QObject;
+// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
+var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
+
+// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
+var setSymbolDesc = DESCRIPTORS && $fails(function () {
+ return _create(dP({}, 'a', {
+ get: function () { return dP(this, 'a', { value: 7 }).a; }
+ })).a != 7;
+}) ? function (it, key, D) {
+ var protoDesc = gOPD(ObjectProto, key);
+ if (protoDesc) delete ObjectProto[key];
+ dP(it, key, D);
+ if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
+} : dP;
+
+var wrap = function (tag) {
+ var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
+ sym._k = tag;
+ return sym;
+};
+
+var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
+ return typeof it == 'symbol';
+} : function (it) {
+ return it instanceof $Symbol;
+};
+
+var $defineProperty = function defineProperty(it, key, D) {
+ if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
+ anObject(it);
+ key = toPrimitive(key, true);
+ anObject(D);
+ if (has(AllSymbols, key)) {
+ if (!D.enumerable) {
+ if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
+ it[HIDDEN][key] = true;
+ } else {
+ if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
+ D = _create(D, { enumerable: createDesc(0, false) });
+ } return setSymbolDesc(it, key, D);
+ } return dP(it, key, D);
+};
+var $defineProperties = function defineProperties(it, P) {
+ anObject(it);
+ var keys = enumKeys(P = toIObject(P));
+ var i = 0;
+ var l = keys.length;
+ var key;
+ while (l > i) $defineProperty(it, key = keys[i++], P[key]);
+ return it;
+};
+var $create = function create(it, P) {
+ return P === undefined ? _create(it) : $defineProperties(_create(it), P);
+};
+var $propertyIsEnumerable = function propertyIsEnumerable(key) {
+ var E = isEnum.call(this, key = toPrimitive(key, true));
+ if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
+ return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
+};
+var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
+ it = toIObject(it);
+ key = toPrimitive(key, true);
+ if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
+ var D = gOPD(it, key);
+ if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
+ return D;
+};
+var $getOwnPropertyNames = function getOwnPropertyNames(it) {
+ var names = gOPN(toIObject(it));
+ var result = [];
+ var i = 0;
+ var key;
+ while (names.length > i) {
+ if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
+ } return result;
+};
+var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
+ var IS_OP = it === ObjectProto;
+ var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
+ var result = [];
+ var i = 0;
+ var key;
+ while (names.length > i) {
+ if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
+ } return result;
+};
+
+// 19.4.1.1 Symbol([description])
+if (!USE_NATIVE) {
+ $Symbol = function Symbol() {
+ if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
+ var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
+ var $set = function (value) {
+ if (this === ObjectProto) $set.call(OPSymbols, value);
+ if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
+ setSymbolDesc(this, tag, createDesc(1, value));
+ };
+ if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
+ return wrap(tag);
+ };
+ redefine($Symbol[PROTOTYPE], 'toString', function toString() {
+ return this._k;
+ });
+
+ $GOPD.f = $getOwnPropertyDescriptor;
+ $DP.f = $defineProperty;
+ require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
+ require('./_object-pie').f = $propertyIsEnumerable;
+ require('./_object-gops').f = $getOwnPropertySymbols;
+
+ if (DESCRIPTORS && !require('./_library')) {
+ redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
+ }
+
+ wksExt.f = function (name) {
+ return wrap(wks(name));
+ };
+}
+
+$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
+
+for (var es6Symbols = (
+ // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
+ 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
+).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
+
+for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
+
+$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
+ // 19.4.2.1 Symbol.for(key)
+ 'for': function (key) {
+ return has(SymbolRegistry, key += '')
+ ? SymbolRegistry[key]
+ : SymbolRegistry[key] = $Symbol(key);
+ },
+ // 19.4.2.5 Symbol.keyFor(sym)
+ keyFor: function keyFor(sym) {
+ if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
+ for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
+ },
+ useSetter: function () { setter = true; },
+ useSimple: function () { setter = false; }
+});
+
+$export($export.S + $export.F * !USE_NATIVE, 'Object', {
+ // 19.1.2.2 Object.create(O [, Properties])
+ create: $create,
+ // 19.1.2.4 Object.defineProperty(O, P, Attributes)
+ defineProperty: $defineProperty,
+ // 19.1.2.3 Object.defineProperties(O, Properties)
+ defineProperties: $defineProperties,
+ // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
+ getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
+ // 19.1.2.7 Object.getOwnPropertyNames(O)
+ getOwnPropertyNames: $getOwnPropertyNames,
+ // 19.1.2.8 Object.getOwnPropertySymbols(O)
+ getOwnPropertySymbols: $getOwnPropertySymbols
+});
+
+// 24.3.2 JSON.stringify(value [, replacer [, space]])
+$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
+ var S = $Symbol();
+ // MS Edge converts symbol values to JSON as {}
+ // WebKit converts symbol values to JSON as null
+ // V8 throws on boxed symbols
+ return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
+})), 'JSON', {
+ stringify: function stringify(it) {
+ var args = [it];
+ var i = 1;
+ var replacer, $replacer;
+ while (arguments.length > i) args.push(arguments[i++]);
+ $replacer = replacer = args[1];
+ if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
+ if (!isArray(replacer)) replacer = function (key, value) {
+ if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
+ if (!isSymbol(value)) return value;
+ };
+ args[1] = replacer;
+ return _stringify.apply($JSON, args);
+ }
+});
+
+// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
+$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
+// 19.4.3.5 Symbol.prototype[@@toStringTag]
+setToStringTag($Symbol, 'Symbol');
+// 20.2.1.9 Math[@@toStringTag]
+setToStringTag(Math, 'Math', true);
+// 24.3.3 JSON[@@toStringTag]
+setToStringTag(global.JSON, 'JSON', true);
+
+},{"./_an-object":141,"./_descriptors":163,"./_enum-keys":166,"./_export":167,"./_fails":169,"./_global":175,"./_has":176,"./_hide":177,"./_is-array":184,"./_is-object":186,"./_library":194,"./_meta":200,"./_object-create":205,"./_object-dp":206,"./_object-gopd":209,"./_object-gopn":211,"./_object-gopn-ext":210,"./_object-gops":212,"./_object-keys":215,"./_object-pie":216,"./_property-desc":224,"./_redefine":226,"./_set-to-string-tag":235,"./_shared":237,"./_to-iobject":251,"./_to-primitive":254,"./_uid":258,"./_wks":263,"./_wks-define":261,"./_wks-ext":262}],391:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var $typed = require('./_typed');
+var buffer = require('./_typed-buffer');
+var anObject = require('./_an-object');
+var toAbsoluteIndex = require('./_to-absolute-index');
+var toLength = require('./_to-length');
+var isObject = require('./_is-object');
+var ArrayBuffer = require('./_global').ArrayBuffer;
+var speciesConstructor = require('./_species-constructor');
+var $ArrayBuffer = buffer.ArrayBuffer;
+var $DataView = buffer.DataView;
+var $isView = $typed.ABV && ArrayBuffer.isView;
+var $slice = $ArrayBuffer.prototype.slice;
+var VIEW = $typed.VIEW;
+var ARRAY_BUFFER = 'ArrayBuffer';
+
+$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { ArrayBuffer: $ArrayBuffer });
+
+$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
+ // 24.1.3.1 ArrayBuffer.isView(arg)
+ isView: function isView(it) {
+ return $isView && $isView(it) || isObject(it) && VIEW in it;
+ }
+});
+
+$export($export.P + $export.U + $export.F * require('./_fails')(function () {
+ return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
+}), ARRAY_BUFFER, {
+ // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
+ slice: function slice(start, end) {
+ if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix
+ var len = anObject(this).byteLength;
+ var first = toAbsoluteIndex(start, len);
+ var fin = toAbsoluteIndex(end === undefined ? len : end, len);
+ var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(fin - first));
+ var viewS = new $DataView(this);
+ var viewT = new $DataView(result);
+ var index = 0;
+ while (first < fin) {
+ viewT.setUint8(index++, viewS.getUint8(first++));
+ } return result;
+ }
+});
+
+require('./_set-species')(ARRAY_BUFFER);
+
+},{"./_an-object":141,"./_export":167,"./_fails":169,"./_global":175,"./_is-object":186,"./_set-species":234,"./_species-constructor":238,"./_to-absolute-index":248,"./_to-length":252,"./_typed":257,"./_typed-buffer":256}],392:[function(require,module,exports){
+var $export = require('./_export');
+$export($export.G + $export.W + $export.F * !require('./_typed').ABV, {
+ DataView: require('./_typed-buffer').DataView
+});
+
+},{"./_export":167,"./_typed":257,"./_typed-buffer":256}],393:[function(require,module,exports){
+require('./_typed-array')('Float32', 4, function (init) {
+ return function Float32Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],394:[function(require,module,exports){
+require('./_typed-array')('Float64', 8, function (init) {
+ return function Float64Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],395:[function(require,module,exports){
+require('./_typed-array')('Int16', 2, function (init) {
+ return function Int16Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],396:[function(require,module,exports){
+require('./_typed-array')('Int32', 4, function (init) {
+ return function Int32Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],397:[function(require,module,exports){
+require('./_typed-array')('Int8', 1, function (init) {
+ return function Int8Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],398:[function(require,module,exports){
+require('./_typed-array')('Uint16', 2, function (init) {
+ return function Uint16Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],399:[function(require,module,exports){
+require('./_typed-array')('Uint32', 4, function (init) {
+ return function Uint32Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],400:[function(require,module,exports){
+require('./_typed-array')('Uint8', 1, function (init) {
+ return function Uint8Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+},{"./_typed-array":255}],401:[function(require,module,exports){
+require('./_typed-array')('Uint8', 1, function (init) {
+ return function Uint8ClampedArray(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+}, true);
+
+},{"./_typed-array":255}],402:[function(require,module,exports){
+'use strict';
+var global = require('./_global');
+var each = require('./_array-methods')(0);
+var redefine = require('./_redefine');
+var meta = require('./_meta');
+var assign = require('./_object-assign');
+var weak = require('./_collection-weak');
+var isObject = require('./_is-object');
+var validate = require('./_validate-collection');
+var NATIVE_WEAK_MAP = require('./_validate-collection');
+var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
+var WEAK_MAP = 'WeakMap';
+var getWeak = meta.getWeak;
+var isExtensible = Object.isExtensible;
+var uncaughtFrozenStore = weak.ufstore;
+var InternalMap;
+
+var wrapper = function (get) {
+ return function WeakMap() {
+ return get(this, arguments.length > 0 ? arguments[0] : undefined);
+ };
+};
+
+var methods = {
+ // 23.3.3.3 WeakMap.prototype.get(key)
+ get: function get(key) {
+ if (isObject(key)) {
+ var data = getWeak(key);
+ if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
+ return data ? data[this._i] : undefined;
+ }
+ },
+ // 23.3.3.5 WeakMap.prototype.set(key, value)
+ set: function set(key, value) {
+ return weak.def(validate(this, WEAK_MAP), key, value);
+ }
+};
+
+// 23.3 WeakMap Objects
+var $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true);
+
+// IE11 WeakMap frozen keys fix
+if (NATIVE_WEAK_MAP && IS_IE11) {
+ InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
+ assign(InternalMap.prototype, methods);
+ meta.NEED = true;
+ each(['delete', 'has', 'get', 'set'], function (key) {
+ var proto = $WeakMap.prototype;
+ var method = proto[key];
+ redefine(proto, key, function (a, b) {
+ // store frozen objects on internal weakmap shim
+ if (isObject(a) && !isExtensible(a)) {
+ if (!this._f) this._f = new InternalMap();
+ var result = this._f[key](a, b);
+ return key == 'set' ? this : result;
+ // store all the rest on native weakmap
+ } return method.call(this, a, b);
+ });
+ });
+}
+
+},{"./_array-methods":146,"./_collection":156,"./_collection-weak":155,"./_global":175,"./_is-object":186,"./_meta":200,"./_object-assign":204,"./_redefine":226,"./_validate-collection":260}],403:[function(require,module,exports){
+'use strict';
+var weak = require('./_collection-weak');
+var validate = require('./_validate-collection');
+var WEAK_SET = 'WeakSet';
+
+// 23.4 WeakSet Objects
+require('./_collection')(WEAK_SET, function (get) {
+ return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
+}, {
+ // 23.4.3.1 WeakSet.prototype.add(value)
+ add: function add(value) {
+ return weak.def(validate(this, WEAK_SET), value, true);
+ }
+}, weak, false, true);
+
+},{"./_collection":156,"./_collection-weak":155,"./_validate-collection":260}],404:[function(require,module,exports){
+'use strict';
+// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap
+var $export = require('./_export');
+var flattenIntoArray = require('./_flatten-into-array');
+var toObject = require('./_to-object');
+var toLength = require('./_to-length');
+var aFunction = require('./_a-function');
+var arraySpeciesCreate = require('./_array-species-create');
+
+$export($export.P, 'Array', {
+ flatMap: function flatMap(callbackfn /* , thisArg */) {
+ var O = toObject(this);
+ var sourceLen, A;
+ aFunction(callbackfn);
+ sourceLen = toLength(O.length);
+ A = arraySpeciesCreate(O, 0);
+ flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]);
+ return A;
+ }
+});
+
+require('./_add-to-unscopables')('flatMap');
+
+},{"./_a-function":136,"./_add-to-unscopables":138,"./_array-species-create":149,"./_export":167,"./_flatten-into-array":172,"./_to-length":252,"./_to-object":253}],405:[function(require,module,exports){
+'use strict';
+// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten
+var $export = require('./_export');
+var flattenIntoArray = require('./_flatten-into-array');
+var toObject = require('./_to-object');
+var toLength = require('./_to-length');
+var toInteger = require('./_to-integer');
+var arraySpeciesCreate = require('./_array-species-create');
+
+$export($export.P, 'Array', {
+ flatten: function flatten(/* depthArg = 1 */) {
+ var depthArg = arguments[0];
+ var O = toObject(this);
+ var sourceLen = toLength(O.length);
+ var A = arraySpeciesCreate(O, 0);
+ flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
+ return A;
+ }
+});
+
+require('./_add-to-unscopables')('flatten');
+
+},{"./_add-to-unscopables":138,"./_array-species-create":149,"./_export":167,"./_flatten-into-array":172,"./_to-integer":250,"./_to-length":252,"./_to-object":253}],406:[function(require,module,exports){
+'use strict';
+// https://github.com/tc39/Array.prototype.includes
+var $export = require('./_export');
+var $includes = require('./_array-includes')(true);
+
+$export($export.P, 'Array', {
+ includes: function includes(el /* , fromIndex = 0 */) {
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+require('./_add-to-unscopables')('includes');
+
+},{"./_add-to-unscopables":138,"./_array-includes":145,"./_export":167}],407:[function(require,module,exports){
+// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
+var $export = require('./_export');
+var microtask = require('./_microtask')();
+var process = require('./_global').process;
+var isNode = require('./_cof')(process) == 'process';
+
+$export($export.G, {
+ asap: function asap(fn) {
+ var domain = isNode && process.domain;
+ microtask(domain ? domain.bind(fn) : fn);
+ }
+});
+
+},{"./_cof":152,"./_export":167,"./_global":175,"./_microtask":202}],408:[function(require,module,exports){
+// https://github.com/ljharb/proposal-is-error
+var $export = require('./_export');
+var cof = require('./_cof');
+
+$export($export.S, 'Error', {
+ isError: function isError(it) {
+ return cof(it) === 'Error';
+ }
+});
+
+},{"./_cof":152,"./_export":167}],409:[function(require,module,exports){
+// https://github.com/tc39/proposal-global
+var $export = require('./_export');
+
+$export($export.G, { global: require('./_global') });
+
+},{"./_export":167,"./_global":175}],410:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
+require('./_set-collection-from')('Map');
+
+},{"./_set-collection-from":231}],411:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
+require('./_set-collection-of')('Map');
+
+},{"./_set-collection-of":232}],412:[function(require,module,exports){
+// https://github.com/DavidBruant/Map-Set.prototype.toJSON
+var $export = require('./_export');
+
+$export($export.P + $export.R, 'Map', { toJSON: require('./_collection-to-json')('Map') });
+
+},{"./_collection-to-json":154,"./_export":167}],413:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ clamp: function clamp(x, lower, upper) {
+ return Math.min(upper, Math.max(lower, x));
+ }
+});
+
+},{"./_export":167}],414:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+var $export = require('./_export');
+
+$export($export.S, 'Math', { DEG_PER_RAD: Math.PI / 180 });
+
+},{"./_export":167}],415:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+var $export = require('./_export');
+var RAD_PER_DEG = 180 / Math.PI;
+
+$export($export.S, 'Math', {
+ degrees: function degrees(radians) {
+ return radians * RAD_PER_DEG;
+ }
+});
+
+},{"./_export":167}],416:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+var $export = require('./_export');
+var scale = require('./_math-scale');
+var fround = require('./_math-fround');
+
+$export($export.S, 'Math', {
+ fscale: function fscale(x, inLow, inHigh, outLow, outHigh) {
+ return fround(scale(x, inLow, inHigh, outLow, outHigh));
+ }
+});
+
+},{"./_export":167,"./_math-fround":196,"./_math-scale":198}],417:[function(require,module,exports){
+// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ iaddh: function iaddh(x0, x1, y0, y1) {
+ var $x0 = x0 >>> 0;
+ var $x1 = x1 >>> 0;
+ var $y0 = y0 >>> 0;
+ return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
+ }
+});
+
+},{"./_export":167}],418:[function(require,module,exports){
+// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ imulh: function imulh(u, v) {
+ var UINT16 = 0xffff;
+ var $u = +u;
+ var $v = +v;
+ var u0 = $u & UINT16;
+ var v0 = $v & UINT16;
+ var u1 = $u >> 16;
+ var v1 = $v >> 16;
+ var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
+ return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
+ }
+});
+
+},{"./_export":167}],419:[function(require,module,exports){
+// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ isubh: function isubh(x0, x1, y0, y1) {
+ var $x0 = x0 >>> 0;
+ var $x1 = x1 >>> 0;
+ var $y0 = y0 >>> 0;
+ return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
+ }
+});
+
+},{"./_export":167}],420:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+var $export = require('./_export');
+
+$export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI });
+
+},{"./_export":167}],421:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+var $export = require('./_export');
+var DEG_PER_RAD = Math.PI / 180;
+
+$export($export.S, 'Math', {
+ radians: function radians(degrees) {
+ return degrees * DEG_PER_RAD;
+ }
+});
+
+},{"./_export":167}],422:[function(require,module,exports){
+// https://rwaldron.github.io/proposal-math-extensions/
+var $export = require('./_export');
+
+$export($export.S, 'Math', { scale: require('./_math-scale') });
+
+},{"./_export":167,"./_math-scale":198}],423:[function(require,module,exports){
+// http://jfbastien.github.io/papers/Math.signbit.html
+var $export = require('./_export');
+
+$export($export.S, 'Math', { signbit: function signbit(x) {
+ // eslint-disable-next-line no-self-compare
+ return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;
+} });
+
+},{"./_export":167}],424:[function(require,module,exports){
+// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
+var $export = require('./_export');
+
+$export($export.S, 'Math', {
+ umulh: function umulh(u, v) {
+ var UINT16 = 0xffff;
+ var $u = +u;
+ var $v = +v;
+ var u0 = $u & UINT16;
+ var v0 = $v & UINT16;
+ var u1 = $u >>> 16;
+ var v1 = $v >>> 16;
+ var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
+ return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
+ }
+});
+
+},{"./_export":167}],425:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var toObject = require('./_to-object');
+var aFunction = require('./_a-function');
+var $defineProperty = require('./_object-dp');
+
+// B.2.2.2 Object.prototype.__defineGetter__(P, getter)
+require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
+ __defineGetter__: function __defineGetter__(P, getter) {
+ $defineProperty.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true });
+ }
+});
+
+},{"./_a-function":136,"./_descriptors":163,"./_export":167,"./_object-dp":206,"./_object-forced-pam":208,"./_to-object":253}],426:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var toObject = require('./_to-object');
+var aFunction = require('./_a-function');
+var $defineProperty = require('./_object-dp');
+
+// B.2.2.3 Object.prototype.__defineSetter__(P, setter)
+require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
+ __defineSetter__: function __defineSetter__(P, setter) {
+ $defineProperty.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true });
+ }
+});
+
+},{"./_a-function":136,"./_descriptors":163,"./_export":167,"./_object-dp":206,"./_object-forced-pam":208,"./_to-object":253}],427:[function(require,module,exports){
+// https://github.com/tc39/proposal-object-values-entries
+var $export = require('./_export');
+var $entries = require('./_object-to-array')(true);
+
+$export($export.S, 'Object', {
+ entries: function entries(it) {
+ return $entries(it);
+ }
+});
+
+},{"./_export":167,"./_object-to-array":218}],428:[function(require,module,exports){
+// https://github.com/tc39/proposal-object-getownpropertydescriptors
+var $export = require('./_export');
+var ownKeys = require('./_own-keys');
+var toIObject = require('./_to-iobject');
+var gOPD = require('./_object-gopd');
+var createProperty = require('./_create-property');
+
+$export($export.S, 'Object', {
+ getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
+ var O = toIObject(object);
+ var getDesc = gOPD.f;
+ var keys = ownKeys(O);
+ var result = {};
+ var i = 0;
+ var key, desc;
+ while (keys.length > i) {
+ desc = getDesc(O, key = keys[i++]);
+ if (desc !== undefined) createProperty(result, key, desc);
+ }
+ return result;
+ }
+});
+
+},{"./_create-property":158,"./_export":167,"./_object-gopd":209,"./_own-keys":219,"./_to-iobject":251}],429:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var toObject = require('./_to-object');
+var toPrimitive = require('./_to-primitive');
+var getPrototypeOf = require('./_object-gpo');
+var getOwnPropertyDescriptor = require('./_object-gopd').f;
+
+// B.2.2.4 Object.prototype.__lookupGetter__(P)
+require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
+ __lookupGetter__: function __lookupGetter__(P) {
+ var O = toObject(this);
+ var K = toPrimitive(P, true);
+ var D;
+ do {
+ if (D = getOwnPropertyDescriptor(O, K)) return D.get;
+ } while (O = getPrototypeOf(O));
+ }
+});
+
+},{"./_descriptors":163,"./_export":167,"./_object-forced-pam":208,"./_object-gopd":209,"./_object-gpo":213,"./_to-object":253,"./_to-primitive":254}],430:[function(require,module,exports){
+'use strict';
+var $export = require('./_export');
+var toObject = require('./_to-object');
+var toPrimitive = require('./_to-primitive');
+var getPrototypeOf = require('./_object-gpo');
+var getOwnPropertyDescriptor = require('./_object-gopd').f;
+
+// B.2.2.5 Object.prototype.__lookupSetter__(P)
+require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
+ __lookupSetter__: function __lookupSetter__(P) {
+ var O = toObject(this);
+ var K = toPrimitive(P, true);
+ var D;
+ do {
+ if (D = getOwnPropertyDescriptor(O, K)) return D.set;
+ } while (O = getPrototypeOf(O));
+ }
+});
+
+},{"./_descriptors":163,"./_export":167,"./_object-forced-pam":208,"./_object-gopd":209,"./_object-gpo":213,"./_to-object":253,"./_to-primitive":254}],431:[function(require,module,exports){
+// https://github.com/tc39/proposal-object-values-entries
+var $export = require('./_export');
+var $values = require('./_object-to-array')(false);
+
+$export($export.S, 'Object', {
+ values: function values(it) {
+ return $values(it);
+ }
+});
+
+},{"./_export":167,"./_object-to-array":218}],432:[function(require,module,exports){
+'use strict';
+// https://github.com/zenparsing/es-observable
+var $export = require('./_export');
+var global = require('./_global');
+var core = require('./_core');
+var microtask = require('./_microtask')();
+var OBSERVABLE = require('./_wks')('observable');
+var aFunction = require('./_a-function');
+var anObject = require('./_an-object');
+var anInstance = require('./_an-instance');
+var redefineAll = require('./_redefine-all');
+var hide = require('./_hide');
+var forOf = require('./_for-of');
+var RETURN = forOf.RETURN;
+
+var getMethod = function (fn) {
+ return fn == null ? undefined : aFunction(fn);
+};
+
+var cleanupSubscription = function (subscription) {
+ var cleanup = subscription._c;
+ if (cleanup) {
+ subscription._c = undefined;
+ cleanup();
+ }
+};
+
+var subscriptionClosed = function (subscription) {
+ return subscription._o === undefined;
+};
+
+var closeSubscription = function (subscription) {
+ if (!subscriptionClosed(subscription)) {
+ subscription._o = undefined;
+ cleanupSubscription(subscription);
+ }
+};
+
+var Subscription = function (observer, subscriber) {
+ anObject(observer);
+ this._c = undefined;
+ this._o = observer;
+ observer = new SubscriptionObserver(this);
+ try {
+ var cleanup = subscriber(observer);
+ var subscription = cleanup;
+ if (cleanup != null) {
+ if (typeof cleanup.unsubscribe === 'function') cleanup = function () { subscription.unsubscribe(); };
+ else aFunction(cleanup);
+ this._c = cleanup;
+ }
+ } catch (e) {
+ observer.error(e);
+ return;
+ } if (subscriptionClosed(this)) cleanupSubscription(this);
+};
+
+Subscription.prototype = redefineAll({}, {
+ unsubscribe: function unsubscribe() { closeSubscription(this); }
+});
+
+var SubscriptionObserver = function (subscription) {
+ this._s = subscription;
+};
+
+SubscriptionObserver.prototype = redefineAll({}, {
+ next: function next(value) {
+ var subscription = this._s;
+ if (!subscriptionClosed(subscription)) {
+ var observer = subscription._o;
+ try {
+ var m = getMethod(observer.next);
+ if (m) return m.call(observer, value);
+ } catch (e) {
+ try {
+ closeSubscription(subscription);
+ } finally {
+ throw e;
+ }
+ }
+ }
+ },
+ error: function error(value) {
+ var subscription = this._s;
+ if (subscriptionClosed(subscription)) throw value;
+ var observer = subscription._o;
+ subscription._o = undefined;
+ try {
+ var m = getMethod(observer.error);
+ if (!m) throw value;
+ value = m.call(observer, value);
+ } catch (e) {
+ try {
+ cleanupSubscription(subscription);
+ } finally {
+ throw e;
+ }
+ } cleanupSubscription(subscription);
+ return value;
+ },
+ complete: function complete(value) {
+ var subscription = this._s;
+ if (!subscriptionClosed(subscription)) {
+ var observer = subscription._o;
+ subscription._o = undefined;
+ try {
+ var m = getMethod(observer.complete);
+ value = m ? m.call(observer, value) : undefined;
+ } catch (e) {
+ try {
+ cleanupSubscription(subscription);
+ } finally {
+ throw e;
+ }
+ } cleanupSubscription(subscription);
+ return value;
+ }
+ }
+});
+
+var $Observable = function Observable(subscriber) {
+ anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
+};
+
+redefineAll($Observable.prototype, {
+ subscribe: function subscribe(observer) {
+ return new Subscription(observer, this._f);
+ },
+ forEach: function forEach(fn) {
+ var that = this;
+ return new (core.Promise || global.Promise)(function (resolve, reject) {
+ aFunction(fn);
+ var subscription = that.subscribe({
+ next: function (value) {
+ try {
+ return fn(value);
+ } catch (e) {
+ reject(e);
+ subscription.unsubscribe();
+ }
+ },
+ error: reject,
+ complete: resolve
+ });
+ });
+ }
+});
+
+redefineAll($Observable, {
+ from: function from(x) {
+ var C = typeof this === 'function' ? this : $Observable;
+ var method = getMethod(anObject(x)[OBSERVABLE]);
+ if (method) {
+ var observable = anObject(method.call(x));
+ return observable.constructor === C ? observable : new C(function (observer) {
+ return observable.subscribe(observer);
+ });
+ }
+ return new C(function (observer) {
+ var done = false;
+ microtask(function () {
+ if (!done) {
+ try {
+ if (forOf(x, false, function (it) {
+ observer.next(it);
+ if (done) return RETURN;
+ }) === RETURN) return;
+ } catch (e) {
+ if (done) throw e;
+ observer.error(e);
+ return;
+ } observer.complete();
+ }
+ });
+ return function () { done = true; };
+ });
+ },
+ of: function of() {
+ for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++];
+ return new (typeof this === 'function' ? this : $Observable)(function (observer) {
+ var done = false;
+ microtask(function () {
+ if (!done) {
+ for (var j = 0; j < items.length; ++j) {
+ observer.next(items[j]);
+ if (done) return;
+ } observer.complete();
+ }
+ });
+ return function () { done = true; };
+ });
+ }
+});
+
+hide($Observable.prototype, OBSERVABLE, function () { return this; });
+
+$export($export.G, { Observable: $Observable });
+
+require('./_set-species')('Observable');
+
+},{"./_a-function":136,"./_an-instance":140,"./_an-object":141,"./_core":157,"./_export":167,"./_for-of":173,"./_global":175,"./_hide":177,"./_microtask":202,"./_redefine-all":225,"./_set-species":234,"./_wks":263}],433:[function(require,module,exports){
+// https://github.com/tc39/proposal-promise-finally
+'use strict';
+var $export = require('./_export');
+var core = require('./_core');
+var global = require('./_global');
+var speciesConstructor = require('./_species-constructor');
+var promiseResolve = require('./_promise-resolve');
+
+$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
+ var C = speciesConstructor(this, core.Promise || global.Promise);
+ var isFunction = typeof onFinally == 'function';
+ return this.then(
+ isFunction ? function (x) {
+ return promiseResolve(C, onFinally()).then(function () { return x; });
+ } : onFinally,
+ isFunction ? function (e) {
+ return promiseResolve(C, onFinally()).then(function () { throw e; });
+ } : onFinally
+ );
+} });
+
+},{"./_core":157,"./_export":167,"./_global":175,"./_promise-resolve":223,"./_species-constructor":238}],434:[function(require,module,exports){
+'use strict';
+// https://github.com/tc39/proposal-promise-try
+var $export = require('./_export');
+var newPromiseCapability = require('./_new-promise-capability');
+var perform = require('./_perform');
+
+$export($export.S, 'Promise', { 'try': function (callbackfn) {
+ var promiseCapability = newPromiseCapability.f(this);
+ var result = perform(callbackfn);
+ (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
+ return promiseCapability.promise;
+} });
+
+},{"./_export":167,"./_new-promise-capability":203,"./_perform":222}],435:[function(require,module,exports){
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var toMetaKey = metadata.key;
+var ordinaryDefineOwnMetadata = metadata.set;
+
+metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) {
+ ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
+} });
+
+},{"./_an-object":141,"./_metadata":201}],436:[function(require,module,exports){
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var toMetaKey = metadata.key;
+var getOrCreateMetadataMap = metadata.map;
+var store = metadata.store;
+
+metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {
+ var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]);
+ var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
+ if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;
+ if (metadataMap.size) return true;
+ var targetMetadata = store.get(target);
+ targetMetadata['delete'](targetKey);
+ return !!targetMetadata.size || store['delete'](target);
+} });
+
+},{"./_an-object":141,"./_metadata":201}],437:[function(require,module,exports){
+var Set = require('./es6.set');
+var from = require('./_array-from-iterable');
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var getPrototypeOf = require('./_object-gpo');
+var ordinaryOwnMetadataKeys = metadata.keys;
+var toMetaKey = metadata.key;
+
+var ordinaryMetadataKeys = function (O, P) {
+ var oKeys = ordinaryOwnMetadataKeys(O, P);
+ var parent = getPrototypeOf(O);
+ if (parent === null) return oKeys;
+ var pKeys = ordinaryMetadataKeys(parent, P);
+ return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
+};
+
+metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
+ return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
+} });
+
+},{"./_an-object":141,"./_array-from-iterable":144,"./_metadata":201,"./_object-gpo":213,"./es6.set":367}],438:[function(require,module,exports){
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var getPrototypeOf = require('./_object-gpo');
+var ordinaryHasOwnMetadata = metadata.has;
+var ordinaryGetOwnMetadata = metadata.get;
+var toMetaKey = metadata.key;
+
+var ordinaryGetMetadata = function (MetadataKey, O, P) {
+ var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
+ if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);
+ var parent = getPrototypeOf(O);
+ return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
+};
+
+metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {
+ return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
+} });
+
+},{"./_an-object":141,"./_metadata":201,"./_object-gpo":213}],439:[function(require,module,exports){
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var ordinaryOwnMetadataKeys = metadata.keys;
+var toMetaKey = metadata.key;
+
+metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) {
+ return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
+} });
+
+},{"./_an-object":141,"./_metadata":201}],440:[function(require,module,exports){
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var ordinaryGetOwnMetadata = metadata.get;
+var toMetaKey = metadata.key;
+
+metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) {
+ return ordinaryGetOwnMetadata(metadataKey, anObject(target)
+ , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
+} });
+
+},{"./_an-object":141,"./_metadata":201}],441:[function(require,module,exports){
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var getPrototypeOf = require('./_object-gpo');
+var ordinaryHasOwnMetadata = metadata.has;
+var toMetaKey = metadata.key;
+
+var ordinaryHasMetadata = function (MetadataKey, O, P) {
+ var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
+ if (hasOwn) return true;
+ var parent = getPrototypeOf(O);
+ return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
+};
+
+metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) {
+ return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
+} });
+
+},{"./_an-object":141,"./_metadata":201,"./_object-gpo":213}],442:[function(require,module,exports){
+var metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var ordinaryHasOwnMetadata = metadata.has;
+var toMetaKey = metadata.key;
+
+metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) {
+ return ordinaryHasOwnMetadata(metadataKey, anObject(target)
+ , arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
+} });
+
+},{"./_an-object":141,"./_metadata":201}],443:[function(require,module,exports){
+var $metadata = require('./_metadata');
+var anObject = require('./_an-object');
+var aFunction = require('./_a-function');
+var toMetaKey = $metadata.key;
+var ordinaryDefineOwnMetadata = $metadata.set;
+
+$metadata.exp({ metadata: function metadata(metadataKey, metadataValue) {
+ return function decorator(target, targetKey) {
+ ordinaryDefineOwnMetadata(
+ metadataKey, metadataValue,
+ (targetKey !== undefined ? anObject : aFunction)(target),
+ toMetaKey(targetKey)
+ );
+ };
+} });
+
+},{"./_a-function":136,"./_an-object":141,"./_metadata":201}],444:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
+require('./_set-collection-from')('Set');
+
+},{"./_set-collection-from":231}],445:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
+require('./_set-collection-of')('Set');
+
+},{"./_set-collection-of":232}],446:[function(require,module,exports){
+// https://github.com/DavidBruant/Map-Set.prototype.toJSON
+var $export = require('./_export');
+
+$export($export.P + $export.R, 'Set', { toJSON: require('./_collection-to-json')('Set') });
+
+},{"./_collection-to-json":154,"./_export":167}],447:[function(require,module,exports){
+'use strict';
+// https://github.com/mathiasbynens/String.prototype.at
+var $export = require('./_export');
+var $at = require('./_string-at')(true);
+
+$export($export.P, 'String', {
+ at: function at(pos) {
+ return $at(this, pos);
+ }
+});
+
+},{"./_export":167,"./_string-at":240}],448:[function(require,module,exports){
+'use strict';
+// https://tc39.github.io/String.prototype.matchAll/
+var $export = require('./_export');
+var defined = require('./_defined');
+var toLength = require('./_to-length');
+var isRegExp = require('./_is-regexp');
+var getFlags = require('./_flags');
+var RegExpProto = RegExp.prototype;
+
+var $RegExpStringIterator = function (regexp, string) {
+ this._r = regexp;
+ this._s = string;
+};
+
+require('./_iter-create')($RegExpStringIterator, 'RegExp String', function next() {
+ var match = this._r.exec(this._s);
+ return { value: match, done: match === null };
+});
+
+$export($export.P, 'String', {
+ matchAll: function matchAll(regexp) {
+ defined(this);
+ if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!');
+ var S = String(this);
+ var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp);
+ var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
+ rx.lastIndex = toLength(regexp.lastIndex);
+ return new $RegExpStringIterator(rx, S);
+ }
+});
+
+},{"./_defined":162,"./_export":167,"./_flags":171,"./_is-regexp":187,"./_iter-create":189,"./_to-length":252}],449:[function(require,module,exports){
+'use strict';
+// https://github.com/tc39/proposal-string-pad-start-end
+var $export = require('./_export');
+var $pad = require('./_string-pad');
+var userAgent = require('./_user-agent');
+
+// https://github.com/zloirock/core-js/issues/280
+var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
+
+$export($export.P + $export.F * WEBKIT_BUG, 'String', {
+ padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
+ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
+ }
+});
+
+},{"./_export":167,"./_string-pad":243,"./_user-agent":259}],450:[function(require,module,exports){
+'use strict';
+// https://github.com/tc39/proposal-string-pad-start-end
+var $export = require('./_export');
+var $pad = require('./_string-pad');
+var userAgent = require('./_user-agent');
+
+// https://github.com/zloirock/core-js/issues/280
+var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
+
+$export($export.P + $export.F * WEBKIT_BUG, 'String', {
+ padStart: function padStart(maxLength /* , fillString = ' ' */) {
+ return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
+ }
+});
+
+},{"./_export":167,"./_string-pad":243,"./_user-agent":259}],451:[function(require,module,exports){
+'use strict';
+// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
+require('./_string-trim')('trimLeft', function ($trim) {
+ return function trimLeft() {
+ return $trim(this, 1);
+ };
+}, 'trimStart');
+
+},{"./_string-trim":245}],452:[function(require,module,exports){
+'use strict';
+// https://github.com/sebmarkbage/ecmascript-string-left-right-trim
+require('./_string-trim')('trimRight', function ($trim) {
+ return function trimRight() {
+ return $trim(this, 2);
+ };
+}, 'trimEnd');
+
+},{"./_string-trim":245}],453:[function(require,module,exports){
+require('./_wks-define')('asyncIterator');
+
+},{"./_wks-define":261}],454:[function(require,module,exports){
+require('./_wks-define')('observable');
+
+},{"./_wks-define":261}],455:[function(require,module,exports){
+// https://github.com/tc39/proposal-global
+var $export = require('./_export');
+
+$export($export.S, 'System', { global: require('./_global') });
+
+},{"./_export":167,"./_global":175}],456:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
+require('./_set-collection-from')('WeakMap');
+
+},{"./_set-collection-from":231}],457:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
+require('./_set-collection-of')('WeakMap');
+
+},{"./_set-collection-of":232}],458:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from
+require('./_set-collection-from')('WeakSet');
+
+},{"./_set-collection-from":231}],459:[function(require,module,exports){
+// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of
+require('./_set-collection-of')('WeakSet');
+
+},{"./_set-collection-of":232}],460:[function(require,module,exports){
+var $iterators = require('./es6.array.iterator');
+var getKeys = require('./_object-keys');
+var redefine = require('./_redefine');
+var global = require('./_global');
+var hide = require('./_hide');
+var Iterators = require('./_iterators');
+var wks = require('./_wks');
+var ITERATOR = wks('iterator');
+var TO_STRING_TAG = wks('toStringTag');
+var ArrayValues = Iterators.Array;
+
+var DOMIterables = {
+ CSSRuleList: true, // TODO: Not spec compliant, should be false.
+ CSSStyleDeclaration: false,
+ CSSValueList: false,
+ ClientRectList: false,
+ DOMRectList: false,
+ DOMStringList: false,
+ DOMTokenList: true,
+ DataTransferItemList: false,
+ FileList: false,
+ HTMLAllCollection: false,
+ HTMLCollection: false,
+ HTMLFormElement: false,
+ HTMLSelectElement: false,
+ MediaList: true, // TODO: Not spec compliant, should be false.
+ MimeTypeArray: false,
+ NamedNodeMap: false,
+ NodeList: true,
+ PaintRequestList: false,
+ Plugin: false,
+ PluginArray: false,
+ SVGLengthList: false,
+ SVGNumberList: false,
+ SVGPathSegList: false,
+ SVGPointList: false,
+ SVGStringList: false,
+ SVGTransformList: false,
+ SourceBufferList: false,
+ StyleSheetList: true, // TODO: Not spec compliant, should be false.
+ TextTrackCueList: false,
+ TextTrackList: false,
+ TouchList: false
+};
+
+for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
+ var NAME = collections[i];
+ var explicit = DOMIterables[NAME];
+ var Collection = global[NAME];
+ var proto = Collection && Collection.prototype;
+ var key;
+ if (proto) {
+ if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
+ if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
+ Iterators[NAME] = ArrayValues;
+ if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);
+ }
+}
+
+},{"./_global":175,"./_hide":177,"./_iterators":193,"./_object-keys":215,"./_redefine":226,"./_wks":263,"./es6.array.iterator":276}],461:[function(require,module,exports){
+var $export = require('./_export');
+var $task = require('./_task');
+$export($export.G + $export.B, {
+ setImmediate: $task.set,
+ clearImmediate: $task.clear
+});
+
+},{"./_export":167,"./_task":247}],462:[function(require,module,exports){
+// ie9- setTimeout & setInterval additional parameters fix
+var global = require('./_global');
+var $export = require('./_export');
+var userAgent = require('./_user-agent');
+var slice = [].slice;
+var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
+var wrap = function (set) {
+ return function (fn, time /* , ...args */) {
+ var boundArgs = arguments.length > 2;
+ var args = boundArgs ? slice.call(arguments, 2) : false;
+ return set(boundArgs ? function () {
+ // eslint-disable-next-line no-new-func
+ (typeof fn == 'function' ? fn : Function(fn)).apply(this, args);
+ } : fn, time);
+ };
+};
+$export($export.G + $export.B + $export.F * MSIE, {
+ setTimeout: wrap(global.setTimeout),
+ setInterval: wrap(global.setInterval)
+});
+
+},{"./_export":167,"./_global":175,"./_user-agent":259}],463:[function(require,module,exports){
+require('./modules/es6.symbol');
+require('./modules/es6.object.create');
+require('./modules/es6.object.define-property');
+require('./modules/es6.object.define-properties');
+require('./modules/es6.object.get-own-property-descriptor');
+require('./modules/es6.object.get-prototype-of');
+require('./modules/es6.object.keys');
+require('./modules/es6.object.get-own-property-names');
+require('./modules/es6.object.freeze');
+require('./modules/es6.object.seal');
+require('./modules/es6.object.prevent-extensions');
+require('./modules/es6.object.is-frozen');
+require('./modules/es6.object.is-sealed');
+require('./modules/es6.object.is-extensible');
+require('./modules/es6.object.assign');
+require('./modules/es6.object.is');
+require('./modules/es6.object.set-prototype-of');
+require('./modules/es6.object.to-string');
+require('./modules/es6.function.bind');
+require('./modules/es6.function.name');
+require('./modules/es6.function.has-instance');
+require('./modules/es6.parse-int');
+require('./modules/es6.parse-float');
+require('./modules/es6.number.constructor');
+require('./modules/es6.number.to-fixed');
+require('./modules/es6.number.to-precision');
+require('./modules/es6.number.epsilon');
+require('./modules/es6.number.is-finite');
+require('./modules/es6.number.is-integer');
+require('./modules/es6.number.is-nan');
+require('./modules/es6.number.is-safe-integer');
+require('./modules/es6.number.max-safe-integer');
+require('./modules/es6.number.min-safe-integer');
+require('./modules/es6.number.parse-float');
+require('./modules/es6.number.parse-int');
+require('./modules/es6.math.acosh');
+require('./modules/es6.math.asinh');
+require('./modules/es6.math.atanh');
+require('./modules/es6.math.cbrt');
+require('./modules/es6.math.clz32');
+require('./modules/es6.math.cosh');
+require('./modules/es6.math.expm1');
+require('./modules/es6.math.fround');
+require('./modules/es6.math.hypot');
+require('./modules/es6.math.imul');
+require('./modules/es6.math.log10');
+require('./modules/es6.math.log1p');
+require('./modules/es6.math.log2');
+require('./modules/es6.math.sign');
+require('./modules/es6.math.sinh');
+require('./modules/es6.math.tanh');
+require('./modules/es6.math.trunc');
+require('./modules/es6.string.from-code-point');
+require('./modules/es6.string.raw');
+require('./modules/es6.string.trim');
+require('./modules/es6.string.iterator');
+require('./modules/es6.string.code-point-at');
+require('./modules/es6.string.ends-with');
+require('./modules/es6.string.includes');
+require('./modules/es6.string.repeat');
+require('./modules/es6.string.starts-with');
+require('./modules/es6.string.anchor');
+require('./modules/es6.string.big');
+require('./modules/es6.string.blink');
+require('./modules/es6.string.bold');
+require('./modules/es6.string.fixed');
+require('./modules/es6.string.fontcolor');
+require('./modules/es6.string.fontsize');
+require('./modules/es6.string.italics');
+require('./modules/es6.string.link');
+require('./modules/es6.string.small');
+require('./modules/es6.string.strike');
+require('./modules/es6.string.sub');
+require('./modules/es6.string.sup');
+require('./modules/es6.date.now');
+require('./modules/es6.date.to-json');
+require('./modules/es6.date.to-iso-string');
+require('./modules/es6.date.to-string');
+require('./modules/es6.date.to-primitive');
+require('./modules/es6.array.is-array');
+require('./modules/es6.array.from');
+require('./modules/es6.array.of');
+require('./modules/es6.array.join');
+require('./modules/es6.array.slice');
+require('./modules/es6.array.sort');
+require('./modules/es6.array.for-each');
+require('./modules/es6.array.map');
+require('./modules/es6.array.filter');
+require('./modules/es6.array.some');
+require('./modules/es6.array.every');
+require('./modules/es6.array.reduce');
+require('./modules/es6.array.reduce-right');
+require('./modules/es6.array.index-of');
+require('./modules/es6.array.last-index-of');
+require('./modules/es6.array.copy-within');
+require('./modules/es6.array.fill');
+require('./modules/es6.array.find');
+require('./modules/es6.array.find-index');
+require('./modules/es6.array.species');
+require('./modules/es6.array.iterator');
+require('./modules/es6.regexp.constructor');
+require('./modules/es6.regexp.exec');
+require('./modules/es6.regexp.to-string');
+require('./modules/es6.regexp.flags');
+require('./modules/es6.regexp.match');
+require('./modules/es6.regexp.replace');
+require('./modules/es6.regexp.search');
+require('./modules/es6.regexp.split');
+require('./modules/es6.promise');
+require('./modules/es6.map');
+require('./modules/es6.set');
+require('./modules/es6.weak-map');
+require('./modules/es6.weak-set');
+require('./modules/es6.typed.array-buffer');
+require('./modules/es6.typed.data-view');
+require('./modules/es6.typed.int8-array');
+require('./modules/es6.typed.uint8-array');
+require('./modules/es6.typed.uint8-clamped-array');
+require('./modules/es6.typed.int16-array');
+require('./modules/es6.typed.uint16-array');
+require('./modules/es6.typed.int32-array');
+require('./modules/es6.typed.uint32-array');
+require('./modules/es6.typed.float32-array');
+require('./modules/es6.typed.float64-array');
+require('./modules/es6.reflect.apply');
+require('./modules/es6.reflect.construct');
+require('./modules/es6.reflect.define-property');
+require('./modules/es6.reflect.delete-property');
+require('./modules/es6.reflect.enumerate');
+require('./modules/es6.reflect.get');
+require('./modules/es6.reflect.get-own-property-descriptor');
+require('./modules/es6.reflect.get-prototype-of');
+require('./modules/es6.reflect.has');
+require('./modules/es6.reflect.is-extensible');
+require('./modules/es6.reflect.own-keys');
+require('./modules/es6.reflect.prevent-extensions');
+require('./modules/es6.reflect.set');
+require('./modules/es6.reflect.set-prototype-of');
+require('./modules/es7.array.includes');
+require('./modules/es7.array.flat-map');
+require('./modules/es7.array.flatten');
+require('./modules/es7.string.at');
+require('./modules/es7.string.pad-start');
+require('./modules/es7.string.pad-end');
+require('./modules/es7.string.trim-left');
+require('./modules/es7.string.trim-right');
+require('./modules/es7.string.match-all');
+require('./modules/es7.symbol.async-iterator');
+require('./modules/es7.symbol.observable');
+require('./modules/es7.object.get-own-property-descriptors');
+require('./modules/es7.object.values');
+require('./modules/es7.object.entries');
+require('./modules/es7.object.define-getter');
+require('./modules/es7.object.define-setter');
+require('./modules/es7.object.lookup-getter');
+require('./modules/es7.object.lookup-setter');
+require('./modules/es7.map.to-json');
+require('./modules/es7.set.to-json');
+require('./modules/es7.map.of');
+require('./modules/es7.set.of');
+require('./modules/es7.weak-map.of');
+require('./modules/es7.weak-set.of');
+require('./modules/es7.map.from');
+require('./modules/es7.set.from');
+require('./modules/es7.weak-map.from');
+require('./modules/es7.weak-set.from');
+require('./modules/es7.global');
+require('./modules/es7.system.global');
+require('./modules/es7.error.is-error');
+require('./modules/es7.math.clamp');
+require('./modules/es7.math.deg-per-rad');
+require('./modules/es7.math.degrees');
+require('./modules/es7.math.fscale');
+require('./modules/es7.math.iaddh');
+require('./modules/es7.math.isubh');
+require('./modules/es7.math.imulh');
+require('./modules/es7.math.rad-per-deg');
+require('./modules/es7.math.radians');
+require('./modules/es7.math.scale');
+require('./modules/es7.math.umulh');
+require('./modules/es7.math.signbit');
+require('./modules/es7.promise.finally');
+require('./modules/es7.promise.try');
+require('./modules/es7.reflect.define-metadata');
+require('./modules/es7.reflect.delete-metadata');
+require('./modules/es7.reflect.get-metadata');
+require('./modules/es7.reflect.get-metadata-keys');
+require('./modules/es7.reflect.get-own-metadata');
+require('./modules/es7.reflect.get-own-metadata-keys');
+require('./modules/es7.reflect.has-metadata');
+require('./modules/es7.reflect.has-own-metadata');
+require('./modules/es7.reflect.metadata');
+require('./modules/es7.asap');
+require('./modules/es7.observable');
+require('./modules/web.timers');
+require('./modules/web.immediate');
+require('./modules/web.dom.iterable');
+module.exports = require('./modules/_core');
+
+},{"./modules/_core":157,"./modules/es6.array.copy-within":266,"./modules/es6.array.every":267,"./modules/es6.array.fill":268,"./modules/es6.array.filter":269,"./modules/es6.array.find":271,"./modules/es6.array.find-index":270,"./modules/es6.array.for-each":272,"./modules/es6.array.from":273,"./modules/es6.array.index-of":274,"./modules/es6.array.is-array":275,"./modules/es6.array.iterator":276,"./modules/es6.array.join":277,"./modules/es6.array.last-index-of":278,"./modules/es6.array.map":279,"./modules/es6.array.of":280,"./modules/es6.array.reduce":282,"./modules/es6.array.reduce-right":281,"./modules/es6.array.slice":283,"./modules/es6.array.some":284,"./modules/es6.array.sort":285,"./modules/es6.array.species":286,"./modules/es6.date.now":287,"./modules/es6.date.to-iso-string":288,"./modules/es6.date.to-json":289,"./modules/es6.date.to-primitive":290,"./modules/es6.date.to-string":291,"./modules/es6.function.bind":292,"./modules/es6.function.has-instance":293,"./modules/es6.function.name":294,"./modules/es6.map":295,"./modules/es6.math.acosh":296,"./modules/es6.math.asinh":297,"./modules/es6.math.atanh":298,"./modules/es6.math.cbrt":299,"./modules/es6.math.clz32":300,"./modules/es6.math.cosh":301,"./modules/es6.math.expm1":302,"./modules/es6.math.fround":303,"./modules/es6.math.hypot":304,"./modules/es6.math.imul":305,"./modules/es6.math.log10":306,"./modules/es6.math.log1p":307,"./modules/es6.math.log2":308,"./modules/es6.math.sign":309,"./modules/es6.math.sinh":310,"./modules/es6.math.tanh":311,"./modules/es6.math.trunc":312,"./modules/es6.number.constructor":313,"./modules/es6.number.epsilon":314,"./modules/es6.number.is-finite":315,"./modules/es6.number.is-integer":316,"./modules/es6.number.is-nan":317,"./modules/es6.number.is-safe-integer":318,"./modules/es6.number.max-safe-integer":319,"./modules/es6.number.min-safe-integer":320,"./modules/es6.number.parse-float":321,"./modules/es6.number.parse-int":322,"./modules/es6.number.to-fixed":323,"./modules/es6.number.to-precision":324,"./modules/es6.object.assign":325,"./modules/es6.object.create":326,"./modules/es6.object.define-properties":327,"./modules/es6.object.define-property":328,"./modules/es6.object.freeze":329,"./modules/es6.object.get-own-property-descriptor":330,"./modules/es6.object.get-own-property-names":331,"./modules/es6.object.get-prototype-of":332,"./modules/es6.object.is":336,"./modules/es6.object.is-extensible":333,"./modules/es6.object.is-frozen":334,"./modules/es6.object.is-sealed":335,"./modules/es6.object.keys":337,"./modules/es6.object.prevent-extensions":338,"./modules/es6.object.seal":339,"./modules/es6.object.set-prototype-of":340,"./modules/es6.object.to-string":341,"./modules/es6.parse-float":342,"./modules/es6.parse-int":343,"./modules/es6.promise":344,"./modules/es6.reflect.apply":345,"./modules/es6.reflect.construct":346,"./modules/es6.reflect.define-property":347,"./modules/es6.reflect.delete-property":348,"./modules/es6.reflect.enumerate":349,"./modules/es6.reflect.get":352,"./modules/es6.reflect.get-own-property-descriptor":350,"./modules/es6.reflect.get-prototype-of":351,"./modules/es6.reflect.has":353,"./modules/es6.reflect.is-extensible":354,"./modules/es6.reflect.own-keys":355,"./modules/es6.reflect.prevent-extensions":356,"./modules/es6.reflect.set":358,"./modules/es6.reflect.set-prototype-of":357,"./modules/es6.regexp.constructor":359,"./modules/es6.regexp.exec":360,"./modules/es6.regexp.flags":361,"./modules/es6.regexp.match":362,"./modules/es6.regexp.replace":363,"./modules/es6.regexp.search":364,"./modules/es6.regexp.split":365,"./modules/es6.regexp.to-string":366,"./modules/es6.set":367,"./modules/es6.string.anchor":368,"./modules/es6.string.big":369,"./modules/es6.string.blink":370,"./modules/es6.string.bold":371,"./modules/es6.string.code-point-at":372,"./modules/es6.string.ends-with":373,"./modules/es6.string.fixed":374,"./modules/es6.string.fontcolor":375,"./modules/es6.string.fontsize":376,"./modules/es6.string.from-code-point":377,"./modules/es6.string.includes":378,"./modules/es6.string.italics":379,"./modules/es6.string.iterator":380,"./modules/es6.string.link":381,"./modules/es6.string.raw":382,"./modules/es6.string.repeat":383,"./modules/es6.string.small":384,"./modules/es6.string.starts-with":385,"./modules/es6.string.strike":386,"./modules/es6.string.sub":387,"./modules/es6.string.sup":388,"./modules/es6.string.trim":389,"./modules/es6.symbol":390,"./modules/es6.typed.array-buffer":391,"./modules/es6.typed.data-view":392,"./modules/es6.typed.float32-array":393,"./modules/es6.typed.float64-array":394,"./modules/es6.typed.int16-array":395,"./modules/es6.typed.int32-array":396,"./modules/es6.typed.int8-array":397,"./modules/es6.typed.uint16-array":398,"./modules/es6.typed.uint32-array":399,"./modules/es6.typed.uint8-array":400,"./modules/es6.typed.uint8-clamped-array":401,"./modules/es6.weak-map":402,"./modules/es6.weak-set":403,"./modules/es7.array.flat-map":404,"./modules/es7.array.flatten":405,"./modules/es7.array.includes":406,"./modules/es7.asap":407,"./modules/es7.error.is-error":408,"./modules/es7.global":409,"./modules/es7.map.from":410,"./modules/es7.map.of":411,"./modules/es7.map.to-json":412,"./modules/es7.math.clamp":413,"./modules/es7.math.deg-per-rad":414,"./modules/es7.math.degrees":415,"./modules/es7.math.fscale":416,"./modules/es7.math.iaddh":417,"./modules/es7.math.imulh":418,"./modules/es7.math.isubh":419,"./modules/es7.math.rad-per-deg":420,"./modules/es7.math.radians":421,"./modules/es7.math.scale":422,"./modules/es7.math.signbit":423,"./modules/es7.math.umulh":424,"./modules/es7.object.define-getter":425,"./modules/es7.object.define-setter":426,"./modules/es7.object.entries":427,"./modules/es7.object.get-own-property-descriptors":428,"./modules/es7.object.lookup-getter":429,"./modules/es7.object.lookup-setter":430,"./modules/es7.object.values":431,"./modules/es7.observable":432,"./modules/es7.promise.finally":433,"./modules/es7.promise.try":434,"./modules/es7.reflect.define-metadata":435,"./modules/es7.reflect.delete-metadata":436,"./modules/es7.reflect.get-metadata":438,"./modules/es7.reflect.get-metadata-keys":437,"./modules/es7.reflect.get-own-metadata":440,"./modules/es7.reflect.get-own-metadata-keys":439,"./modules/es7.reflect.has-metadata":441,"./modules/es7.reflect.has-own-metadata":442,"./modules/es7.reflect.metadata":443,"./modules/es7.set.from":444,"./modules/es7.set.of":445,"./modules/es7.set.to-json":446,"./modules/es7.string.at":447,"./modules/es7.string.match-all":448,"./modules/es7.string.pad-end":449,"./modules/es7.string.pad-start":450,"./modules/es7.string.trim-left":451,"./modules/es7.string.trim-right":452,"./modules/es7.symbol.async-iterator":453,"./modules/es7.symbol.observable":454,"./modules/es7.system.global":455,"./modules/es7.weak-map.from":456,"./modules/es7.weak-map.of":457,"./modules/es7.weak-set.from":458,"./modules/es7.weak-set.of":459,"./modules/web.dom.iterable":460,"./modules/web.immediate":461,"./modules/web.timers":462}],464:[function(require,module,exports){
+(function (Buffer){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+
+function isArray(arg) {
+ if (Array.isArray) {
+ return Array.isArray(arg);
+ }
+ return objectToString(arg) === '[object Array]';
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+exports.isBuffer = Buffer.isBuffer;
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
+
+}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
+},{"../../is-buffer/index.js":839}],465:[function(require,module,exports){
+(function (Buffer){
+var elliptic = require('elliptic')
+var BN = require('bn.js')
+
+module.exports = function createECDH (curve) {
+ return new ECDH(curve)
+}
+
+var aliases = {
+ secp256k1: {
+ name: 'secp256k1',
+ byteLength: 32
+ },
+ secp224r1: {
+ name: 'p224',
+ byteLength: 28
+ },
+ prime256v1: {
+ name: 'p256',
+ byteLength: 32
+ },
+ prime192v1: {
+ name: 'p192',
+ byteLength: 24
+ },
+ ed25519: {
+ name: 'ed25519',
+ byteLength: 32
+ },
+ secp384r1: {
+ name: 'p384',
+ byteLength: 48
+ },
+ secp521r1: {
+ name: 'p521',
+ byteLength: 66
+ }
+}
+
+aliases.p224 = aliases.secp224r1
+aliases.p256 = aliases.secp256r1 = aliases.prime256v1
+aliases.p192 = aliases.secp192r1 = aliases.prime192v1
+aliases.p384 = aliases.secp384r1
+aliases.p521 = aliases.secp521r1
+
+function ECDH (curve) {
+ this.curveType = aliases[curve]
+ if (!this.curveType) {
+ this.curveType = {
+ name: curve
+ }
+ }
+ this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
+ this.keys = void 0
+}
+
+ECDH.prototype.generateKeys = function (enc, format) {
+ this.keys = this.curve.genKeyPair()
+ return this.getPublicKey(enc, format)
+}
+
+ECDH.prototype.computeSecret = function (other, inenc, enc) {
+ inenc = inenc || 'utf8'
+ if (!Buffer.isBuffer(other)) {
+ other = new Buffer(other, inenc)
+ }
+ var otherPub = this.curve.keyFromPublic(other).getPublic()
+ var out = otherPub.mul(this.keys.getPrivate()).getX()
+ return formatReturnValue(out, enc, this.curveType.byteLength)
+}
+
+ECDH.prototype.getPublicKey = function (enc, format) {
+ var key = this.keys.getPublic(format === 'compressed', true)
+ if (format === 'hybrid') {
+ if (key[key.length - 1] % 2) {
+ key[0] = 7
+ } else {
+ key[0] = 6
+ }
+ }
+ return formatReturnValue(key, enc)
+}
+
+ECDH.prototype.getPrivateKey = function (enc) {
+ return formatReturnValue(this.keys.getPrivate(), enc)
+}
+
+ECDH.prototype.setPublicKey = function (pub, enc) {
+ enc = enc || 'utf8'
+ if (!Buffer.isBuffer(pub)) {
+ pub = new Buffer(pub, enc)
+ }
+ this.keys._importPublic(pub)
+ return this
+}
+
+ECDH.prototype.setPrivateKey = function (priv, enc) {
+ enc = enc || 'utf8'
+ if (!Buffer.isBuffer(priv)) {
+ priv = new Buffer(priv, enc)
+ }
+
+ var _priv = new BN(priv)
+ _priv = _priv.toString(16)
+ this.keys = this.curve.genKeyPair()
+ this.keys._importPrivate(_priv)
+ return this
+}
+
+function formatReturnValue (bn, enc, len) {
+ if (!Array.isArray(bn)) {
+ bn = bn.toArray()
+ }
+ var buf = new Buffer(bn)
+ if (len && buf.length < len) {
+ var zeros = new Buffer(len - buf.length)
+ zeros.fill(0)
+ buf = Buffer.concat([zeros, buf])
+ }
+ if (!enc) {
+ return buf
+ } else {
+ return buf.toString(enc)
+ }
+}
+
+}).call(this,require("buffer").Buffer)
+},{"bn.js":66,"buffer":113,"elliptic":548}],466:[function(require,module,exports){
+'use strict'
+var inherits = require('inherits')
+var MD5 = require('md5.js')
+var RIPEMD160 = require('ripemd160')
+var sha = require('sha.js')
+var Base = require('cipher-base')
+
+function Hash (hash) {
+ Base.call(this, 'digest')
+
+ this._hash = hash
+}
+
+inherits(Hash, Base)
+
+Hash.prototype._update = function (data) {
+ this._hash.update(data)
+}
+
+Hash.prototype._final = function () {
+ return this._hash.digest()
+}
+
+module.exports = function createHash (alg) {
+ alg = alg.toLowerCase()
+ if (alg === 'md5') return new MD5()
+ if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
+
+ return new Hash(sha(alg))
+}
+
+},{"cipher-base":120,"inherits":834,"md5.js":935,"ripemd160":1330,"sha.js":1349}],467:[function(require,module,exports){
+var MD5 = require('md5.js')
+
+module.exports = function (buffer) {
+ return new MD5().update(buffer).digest()
+}
+
+},{"md5.js":935}],468:[function(require,module,exports){
+'use strict'
+var inherits = require('inherits')
+var Legacy = require('./legacy')
+var Base = require('cipher-base')
+var Buffer = require('safe-buffer').Buffer
+var md5 = require('create-hash/md5')
+var RIPEMD160 = require('ripemd160')
+
+var sha = require('sha.js')
+
+var ZEROS = Buffer.alloc(128)
+
+function Hmac (alg, key) {
+ Base.call(this, 'digest')
+ if (typeof key === 'string') {
+ key = Buffer.from(key)
+ }
+
+ var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
+
+ this._alg = alg
+ this._key = key
+ if (key.length > blocksize) {
+ var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
+ key = hash.update(key).digest()
+ } else if (key.length < blocksize) {
+ key = Buffer.concat([key, ZEROS], blocksize)
+ }
+
+ var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
+ var opad = this._opad = Buffer.allocUnsafe(blocksize)
+
+ for (var i = 0; i < blocksize; i++) {
+ ipad[i] = key[i] ^ 0x36
+ opad[i] = key[i] ^ 0x5C
+ }
+ this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
+ this._hash.update(ipad)
+}
+
+inherits(Hmac, Base)
+
+Hmac.prototype._update = function (data) {
+ this._hash.update(data)
+}
+
+Hmac.prototype._final = function () {
+ var h = this._hash.digest()
+ var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
+ return hash.update(this._opad).update(h).digest()
+}
+
+module.exports = function createHmac (alg, key) {
+ alg = alg.toLowerCase()
+ if (alg === 'rmd160' || alg === 'ripemd160') {
+ return new Hmac('rmd160', key)
+ }
+ if (alg === 'md5') {
+ return new Legacy(md5, key)
+ }
+ return new Hmac(alg, key)
+}
+
+},{"./legacy":469,"cipher-base":120,"create-hash/md5":467,"inherits":834,"ripemd160":1330,"safe-buffer":1334,"sha.js":1349}],469:[function(require,module,exports){
+'use strict'
+var inherits = require('inherits')
+var Buffer = require('safe-buffer').Buffer
+
+var Base = require('cipher-base')
+
+var ZEROS = Buffer.alloc(128)
+var blocksize = 64
+
+function Hmac (alg, key) {
+ Base.call(this, 'digest')
+ if (typeof key === 'string') {
+ key = Buffer.from(key)
+ }
+
+ this._alg = alg
+ this._key = key
+
+ if (key.length > blocksize) {
+ key = alg(key)
+ } else if (key.length < blocksize) {
+ key = Buffer.concat([key, ZEROS], blocksize)
+ }
+
+ var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
+ var opad = this._opad = Buffer.allocUnsafe(blocksize)
+
+ for (var i = 0; i < blocksize; i++) {
+ ipad[i] = key[i] ^ 0x36
+ opad[i] = key[i] ^ 0x5C
+ }
+
+ this._hash = [ipad]
+}
+
+inherits(Hmac, Base)
+
+Hmac.prototype._update = function (data) {
+ this._hash.push(data)
+}
+
+Hmac.prototype._final = function () {
+ var h = this._alg(Buffer.concat(this._hash))
+ return this._alg(Buffer.concat([this._opad, h]))
+}
+module.exports = Hmac
+
+},{"cipher-base":120,"inherits":834,"safe-buffer":1334}],470:[function(require,module,exports){
+'use strict'
+
+exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')
+exports.createHash = exports.Hash = require('create-hash')
+exports.createHmac = exports.Hmac = require('create-hmac')
+
+var algos = require('browserify-sign/algos')
+var algoKeys = Object.keys(algos)
+var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)
+exports.getHashes = function () {
+ return hashes
+}
+
+var p = require('pbkdf2')
+exports.pbkdf2 = p.pbkdf2
+exports.pbkdf2Sync = p.pbkdf2Sync
+
+var aes = require('browserify-cipher')
+
+exports.Cipher = aes.Cipher
+exports.createCipher = aes.createCipher
+exports.Cipheriv = aes.Cipheriv
+exports.createCipheriv = aes.createCipheriv
+exports.Decipher = aes.Decipher
+exports.createDecipher = aes.createDecipher
+exports.Decipheriv = aes.Decipheriv
+exports.createDecipheriv = aes.createDecipheriv
+exports.getCiphers = aes.getCiphers
+exports.listCiphers = aes.listCiphers
+
+var dh = require('diffie-hellman')
+
+exports.DiffieHellmanGroup = dh.DiffieHellmanGroup
+exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup
+exports.getDiffieHellman = dh.getDiffieHellman
+exports.createDiffieHellman = dh.createDiffieHellman
+exports.DiffieHellman = dh.DiffieHellman
+
+var sign = require('browserify-sign')
+
+exports.createSign = sign.createSign
+exports.Sign = sign.Sign
+exports.createVerify = sign.createVerify
+exports.Verify = sign.Verify
+
+exports.createECDH = require('create-ecdh')
+
+var publicEncrypt = require('public-encrypt')
+
+exports.publicEncrypt = publicEncrypt.publicEncrypt
+exports.privateEncrypt = publicEncrypt.privateEncrypt
+exports.publicDecrypt = publicEncrypt.publicDecrypt
+exports.privateDecrypt = publicEncrypt.privateDecrypt
+
+// the least I can do is make error messages for the rest of the node.js/crypto api.
+// ;[
+// 'createCredentials'
+// ].forEach(function (name) {
+// exports[name] = function () {
+// throw new Error([
+// 'sorry, ' + name + ' is not implemented yet',
+// 'we accept pull requests',
+// 'https://github.com/crypto-browserify/crypto-browserify'
+// ].join('\n'))
+// }
+// })
+
+var rf = require('randomfill')
+
+exports.randomFill = rf.randomFill
+exports.randomFillSync = rf.randomFillSync
+
+exports.createCredentials = function () {
+ throw new Error([
+ 'sorry, createCredentials is not implemented yet',
+ 'we accept pull requests',
+ 'https://github.com/crypto-browserify/crypto-browserify'
+ ].join('\n'))
+}
+
+exports.constants = {
+ 'DH_CHECK_P_NOT_SAFE_PRIME': 2,
+ 'DH_CHECK_P_NOT_PRIME': 1,
+ 'DH_UNABLE_TO_CHECK_GENERATOR': 4,
+ 'DH_NOT_SUITABLE_GENERATOR': 8,
+ 'NPN_ENABLED': 1,
+ 'ALPN_ENABLED': 1,
+ 'RSA_PKCS1_PADDING': 1,
+ 'RSA_SSLV23_PADDING': 2,
+ 'RSA_NO_PADDING': 3,
+ 'RSA_PKCS1_OAEP_PADDING': 4,
+ 'RSA_X931_PADDING': 5,
+ 'RSA_PKCS1_PSS_PADDING': 6,
+ 'POINT_CONVERSION_COMPRESSED': 2,
+ 'POINT_CONVERSION_UNCOMPRESSED': 4,
+ 'POINT_CONVERSION_HYBRID': 6
+}
+
+},{"browserify-cipher":95,"browserify-sign":103,"browserify-sign/algos":100,"create-ecdh":465,"create-hash":466,"create-hmac":468,"diffie-hellman":539,"pbkdf2":1014,"public-encrypt":1026,"randombytes":1036,"randomfill":1037}],471:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var BlockCipher = C_lib.BlockCipher;
+ var C_algo = C.algo;
+
+ // Lookup tables
+ var SBOX = [];
+ var INV_SBOX = [];
+ var SUB_MIX_0 = [];
+ var SUB_MIX_1 = [];
+ var SUB_MIX_2 = [];
+ var SUB_MIX_3 = [];
+ var INV_SUB_MIX_0 = [];
+ var INV_SUB_MIX_1 = [];
+ var INV_SUB_MIX_2 = [];
+ var INV_SUB_MIX_3 = [];
+
+ // Compute lookup tables
+ (function () {
+ // Compute double table
+ var d = [];
+ for (var i = 0; i < 256; i++) {
+ if (i < 128) {
+ d[i] = i << 1;
+ } else {
+ d[i] = (i << 1) ^ 0x11b;
+ }
+ }
+
+ // Walk GF(2^8)
+ var x = 0;
+ var xi = 0;
+ for (var i = 0; i < 256; i++) {
+ // Compute sbox
+ var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
+ sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
+ SBOX[x] = sx;
+ INV_SBOX[sx] = x;
+
+ // Compute multiplication
+ var x2 = d[x];
+ var x4 = d[x2];
+ var x8 = d[x4];
+
+ // Compute sub bytes, mix columns tables
+ var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
+ SUB_MIX_0[x] = (t << 24) | (t >>> 8);
+ SUB_MIX_1[x] = (t << 16) | (t >>> 16);
+ SUB_MIX_2[x] = (t << 8) | (t >>> 24);
+ SUB_MIX_3[x] = t;
+
+ // Compute inv sub bytes, inv mix columns tables
+ var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
+ INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
+ INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
+ INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
+ INV_SUB_MIX_3[sx] = t;
+
+ // Compute next counter
+ if (!x) {
+ x = xi = 1;
+ } else {
+ x = x2 ^ d[d[d[x8 ^ x2]]];
+ xi ^= d[d[xi]];
+ }
+ }
+ }());
+
+ // Precomputed Rcon lookup
+ var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
+
+ /**
+ * AES block cipher algorithm.
+ */
+ var AES = C_algo.AES = BlockCipher.extend({
+ _doReset: function () {
+ // Skip reset of nRounds has been set before and key did not change
+ if (this._nRounds && this._keyPriorReset === this._key) {
+ return;
+ }
+
+ // Shortcuts
+ var key = this._keyPriorReset = this._key;
+ var keyWords = key.words;
+ var keySize = key.sigBytes / 4;
+
+ // Compute number of rounds
+ var nRounds = this._nRounds = keySize + 6;
+
+ // Compute number of key schedule rows
+ var ksRows = (nRounds + 1) * 4;
+
+ // Compute key schedule
+ var keySchedule = this._keySchedule = [];
+ for (var ksRow = 0; ksRow < ksRows; ksRow++) {
+ if (ksRow < keySize) {
+ keySchedule[ksRow] = keyWords[ksRow];
+ } else {
+ var t = keySchedule[ksRow - 1];
+
+ if (!(ksRow % keySize)) {
+ // Rot word
+ t = (t << 8) | (t >>> 24);
+
+ // Sub word
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
+
+ // Mix Rcon
+ t ^= RCON[(ksRow / keySize) | 0] << 24;
+ } else if (keySize > 6 && ksRow % keySize == 4) {
+ // Sub word
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
+ }
+
+ keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
+ }
+ }
+
+ // Compute inv key schedule
+ var invKeySchedule = this._invKeySchedule = [];
+ for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
+ var ksRow = ksRows - invKsRow;
+
+ if (invKsRow % 4) {
+ var t = keySchedule[ksRow];
+ } else {
+ var t = keySchedule[ksRow - 4];
+ }
+
+ if (invKsRow < 4 || ksRow <= 4) {
+ invKeySchedule[invKsRow] = t;
+ } else {
+ invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
+ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
+ }
+ }
+ },
+
+ encryptBlock: function (M, offset) {
+ this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
+ },
+
+ decryptBlock: function (M, offset) {
+ // Swap 2nd and 4th rows
+ var t = M[offset + 1];
+ M[offset + 1] = M[offset + 3];
+ M[offset + 3] = t;
+
+ this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
+
+ // Inv swap 2nd and 4th rows
+ var t = M[offset + 1];
+ M[offset + 1] = M[offset + 3];
+ M[offset + 3] = t;
+ },
+
+ _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
+ // Shortcut
+ var nRounds = this._nRounds;
+
+ // Get input, add round key
+ var s0 = M[offset] ^ keySchedule[0];
+ var s1 = M[offset + 1] ^ keySchedule[1];
+ var s2 = M[offset + 2] ^ keySchedule[2];
+ var s3 = M[offset + 3] ^ keySchedule[3];
+
+ // Key schedule row counter
+ var ksRow = 4;
+
+ // Rounds
+ for (var round = 1; round < nRounds; round++) {
+ // Shift rows, sub bytes, mix columns, add round key
+ var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
+ var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
+ var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
+ var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
+
+ // Update state
+ s0 = t0;
+ s1 = t1;
+ s2 = t2;
+ s3 = t3;
+ }
+
+ // Shift rows, sub bytes, add round key
+ var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
+ var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
+ var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
+ var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
+
+ // Set output
+ M[offset] = t0;
+ M[offset + 1] = t1;
+ M[offset + 2] = t2;
+ M[offset + 3] = t3;
+ },
+
+ keySize: 256/32
+ });
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
+ */
+ C.AES = BlockCipher._createHelper(AES);
+ }());
+
+
+ return CryptoJS.AES;
+
+}));
+},{"./cipher-core":472,"./core":473,"./enc-base64":474,"./evpkdf":476,"./md5":481}],472:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * Cipher core components.
+ */
+ CryptoJS.lib.Cipher || (function (undefined) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var WordArray = C_lib.WordArray;
+ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
+ var C_enc = C.enc;
+ var Utf8 = C_enc.Utf8;
+ var Base64 = C_enc.Base64;
+ var C_algo = C.algo;
+ var EvpKDF = C_algo.EvpKDF;
+
+ /**
+ * Abstract base cipher template.
+ *
+ * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
+ * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
+ * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
+ * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
+ */
+ var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {WordArray} iv The IV to use for this operation.
+ */
+ cfg: Base.extend(),
+
+ /**
+ * Creates this cipher in encryption mode.
+ *
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {Cipher} A cipher instance.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
+ */
+ createEncryptor: function (key, cfg) {
+ return this.create(this._ENC_XFORM_MODE, key, cfg);
+ },
+
+ /**
+ * Creates this cipher in decryption mode.
+ *
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {Cipher} A cipher instance.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
+ */
+ createDecryptor: function (key, cfg) {
+ return this.create(this._DEC_XFORM_MODE, key, cfg);
+ },
+
+ /**
+ * Initializes a newly created cipher.
+ *
+ * @param {number} xformMode Either the encryption or decryption transormation mode constant.
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @example
+ *
+ * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
+ */
+ init: function (xformMode, key, cfg) {
+ // Apply config defaults
+ this.cfg = this.cfg.extend(cfg);
+
+ // Store transform mode and key
+ this._xformMode = xformMode;
+ this._key = key;
+
+ // Set initial values
+ this.reset();
+ },
+
+ /**
+ * Resets this cipher to its initial state.
+ *
+ * @example
+ *
+ * cipher.reset();
+ */
+ reset: function () {
+ // Reset data buffer
+ BufferedBlockAlgorithm.reset.call(this);
+
+ // Perform concrete-cipher logic
+ this._doReset();
+ },
+
+ /**
+ * Adds data to be encrypted or decrypted.
+ *
+ * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
+ *
+ * @return {WordArray} The data after processing.
+ *
+ * @example
+ *
+ * var encrypted = cipher.process('data');
+ * var encrypted = cipher.process(wordArray);
+ */
+ process: function (dataUpdate) {
+ // Append
+ this._append(dataUpdate);
+
+ // Process available blocks
+ return this._process();
+ },
+
+ /**
+ * Finalizes the encryption or decryption process.
+ * Note that the finalize operation is effectively a destructive, read-once operation.
+ *
+ * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
+ *
+ * @return {WordArray} The data after final processing.
+ *
+ * @example
+ *
+ * var encrypted = cipher.finalize();
+ * var encrypted = cipher.finalize('data');
+ * var encrypted = cipher.finalize(wordArray);
+ */
+ finalize: function (dataUpdate) {
+ // Final data update
+ if (dataUpdate) {
+ this._append(dataUpdate);
+ }
+
+ // Perform concrete-cipher logic
+ var finalProcessedData = this._doFinalize();
+
+ return finalProcessedData;
+ },
+
+ keySize: 128/32,
+
+ ivSize: 128/32,
+
+ _ENC_XFORM_MODE: 1,
+
+ _DEC_XFORM_MODE: 2,
+
+ /**
+ * Creates shortcut functions to a cipher's object interface.
+ *
+ * @param {Cipher} cipher The cipher to create a helper for.
+ *
+ * @return {Object} An object with encrypt and decrypt shortcut functions.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
+ */
+ _createHelper: (function () {
+ function selectCipherStrategy(key) {
+ if (typeof key == 'string') {
+ return PasswordBasedCipher;
+ } else {
+ return SerializableCipher;
+ }
+ }
+
+ return function (cipher) {
+ return {
+ encrypt: function (message, key, cfg) {
+ return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
+ },
+
+ decrypt: function (ciphertext, key, cfg) {
+ return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
+ }
+ };
+ };
+ }())
+ });
+
+ /**
+ * Abstract base stream cipher template.
+ *
+ * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
+ */
+ var StreamCipher = C_lib.StreamCipher = Cipher.extend({
+ _doFinalize: function () {
+ // Process partial blocks
+ var finalProcessedBlocks = this._process(!!'flush');
+
+ return finalProcessedBlocks;
+ },
+
+ blockSize: 1
+ });
+
+ /**
+ * Mode namespace.
+ */
+ var C_mode = C.mode = {};
+
+ /**
+ * Abstract base block cipher mode template.
+ */
+ var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
+ /**
+ * Creates this mode for encryption.
+ *
+ * @param {Cipher} cipher A block cipher instance.
+ * @param {Array} iv The IV words.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
+ */
+ createEncryptor: function (cipher, iv) {
+ return this.Encryptor.create(cipher, iv);
+ },
+
+ /**
+ * Creates this mode for decryption.
+ *
+ * @param {Cipher} cipher A block cipher instance.
+ * @param {Array} iv The IV words.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
+ */
+ createDecryptor: function (cipher, iv) {
+ return this.Decryptor.create(cipher, iv);
+ },
+
+ /**
+ * Initializes a newly created mode.
+ *
+ * @param {Cipher} cipher A block cipher instance.
+ * @param {Array} iv The IV words.
+ *
+ * @example
+ *
+ * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
+ */
+ init: function (cipher, iv) {
+ this._cipher = cipher;
+ this._iv = iv;
+ }
+ });
+
+ /**
+ * Cipher Block Chaining mode.
+ */
+ var CBC = C_mode.CBC = (function () {
+ /**
+ * Abstract base CBC mode.
+ */
+ var CBC = BlockCipherMode.extend();
+
+ /**
+ * CBC encryptor.
+ */
+ CBC.Encryptor = CBC.extend({
+ /**
+ * Processes the data block at offset.
+ *
+ * @param {Array} words The data words to operate on.
+ * @param {number} offset The offset where the block starts.
+ *
+ * @example
+ *
+ * mode.processBlock(data.words, offset);
+ */
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ // XOR and encrypt
+ xorBlock.call(this, words, offset, blockSize);
+ cipher.encryptBlock(words, offset);
+
+ // Remember this block to use with next block
+ this._prevBlock = words.slice(offset, offset + blockSize);
+ }
+ });
+
+ /**
+ * CBC decryptor.
+ */
+ CBC.Decryptor = CBC.extend({
+ /**
+ * Processes the data block at offset.
+ *
+ * @param {Array} words The data words to operate on.
+ * @param {number} offset The offset where the block starts.
+ *
+ * @example
+ *
+ * mode.processBlock(data.words, offset);
+ */
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ // Remember this block to use with next block
+ var thisBlock = words.slice(offset, offset + blockSize);
+
+ // Decrypt and XOR
+ cipher.decryptBlock(words, offset);
+ xorBlock.call(this, words, offset, blockSize);
+
+ // This block becomes the previous block
+ this._prevBlock = thisBlock;
+ }
+ });
+
+ function xorBlock(words, offset, blockSize) {
+ // Shortcut
+ var iv = this._iv;
+
+ // Choose mixing block
+ if (iv) {
+ var block = iv;
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ } else {
+ var block = this._prevBlock;
+ }
+
+ // XOR blocks
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= block[i];
+ }
+ }
+
+ return CBC;
+ }());
+
+ /**
+ * Padding namespace.
+ */
+ var C_pad = C.pad = {};
+
+ /**
+ * PKCS #5/7 padding strategy.
+ */
+ var Pkcs7 = C_pad.Pkcs7 = {
+ /**
+ * Pads data using the algorithm defined in PKCS #5/7.
+ *
+ * @param {WordArray} data The data to pad.
+ * @param {number} blockSize The multiple that the data should be padded to.
+ *
+ * @static
+ *
+ * @example
+ *
+ * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
+ */
+ pad: function (data, blockSize) {
+ // Shortcut
+ var blockSizeBytes = blockSize * 4;
+
+ // Count padding bytes
+ var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
+
+ // Create padding word
+ var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
+
+ // Create padding
+ var paddingWords = [];
+ for (var i = 0; i < nPaddingBytes; i += 4) {
+ paddingWords.push(paddingWord);
+ }
+ var padding = WordArray.create(paddingWords, nPaddingBytes);
+
+ // Add padding
+ data.concat(padding);
+ },
+
+ /**
+ * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
+ *
+ * @param {WordArray} data The data to unpad.
+ *
+ * @static
+ *
+ * @example
+ *
+ * CryptoJS.pad.Pkcs7.unpad(wordArray);
+ */
+ unpad: function (data) {
+ // Get number of padding bytes from last byte
+ var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
+
+ // Remove padding
+ data.sigBytes -= nPaddingBytes;
+ }
+ };
+
+ /**
+ * Abstract base block cipher template.
+ *
+ * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
+ */
+ var BlockCipher = C_lib.BlockCipher = Cipher.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {Mode} mode The block mode to use. Default: CBC
+ * @property {Padding} padding The padding strategy to use. Default: Pkcs7
+ */
+ cfg: Cipher.cfg.extend({
+ mode: CBC,
+ padding: Pkcs7
+ }),
+
+ reset: function () {
+ // Reset cipher
+ Cipher.reset.call(this);
+
+ // Shortcuts
+ var cfg = this.cfg;
+ var iv = cfg.iv;
+ var mode = cfg.mode;
+
+ // Reset block mode
+ if (this._xformMode == this._ENC_XFORM_MODE) {
+ var modeCreator = mode.createEncryptor;
+ } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
+ var modeCreator = mode.createDecryptor;
+
+ // Keep at least one block in the buffer for unpadding
+ this._minBufferSize = 1;
+ }
+ this._mode = modeCreator.call(mode, this, iv && iv.words);
+ },
+
+ _doProcessBlock: function (words, offset) {
+ this._mode.processBlock(words, offset);
+ },
+
+ _doFinalize: function () {
+ // Shortcut
+ var padding = this.cfg.padding;
+
+ // Finalize
+ if (this._xformMode == this._ENC_XFORM_MODE) {
+ // Pad data
+ padding.pad(this._data, this.blockSize);
+
+ // Process final blocks
+ var finalProcessedBlocks = this._process(!!'flush');
+ } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
+ // Process final blocks
+ var finalProcessedBlocks = this._process(!!'flush');
+
+ // Unpad data
+ padding.unpad(finalProcessedBlocks);
+ }
+
+ return finalProcessedBlocks;
+ },
+
+ blockSize: 128/32
+ });
+
+ /**
+ * A collection of cipher parameters.
+ *
+ * @property {WordArray} ciphertext The raw ciphertext.
+ * @property {WordArray} key The key to this ciphertext.
+ * @property {WordArray} iv The IV used in the ciphering operation.
+ * @property {WordArray} salt The salt used with a key derivation function.
+ * @property {Cipher} algorithm The cipher algorithm.
+ * @property {Mode} mode The block mode used in the ciphering operation.
+ * @property {Padding} padding The padding scheme used in the ciphering operation.
+ * @property {number} blockSize The block size of the cipher.
+ * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
+ */
+ var CipherParams = C_lib.CipherParams = Base.extend({
+ /**
+ * Initializes a newly created cipher params object.
+ *
+ * @param {Object} cipherParams An object with any of the possible cipher parameters.
+ *
+ * @example
+ *
+ * var cipherParams = CryptoJS.lib.CipherParams.create({
+ * ciphertext: ciphertextWordArray,
+ * key: keyWordArray,
+ * iv: ivWordArray,
+ * salt: saltWordArray,
+ * algorithm: CryptoJS.algo.AES,
+ * mode: CryptoJS.mode.CBC,
+ * padding: CryptoJS.pad.PKCS7,
+ * blockSize: 4,
+ * formatter: CryptoJS.format.OpenSSL
+ * });
+ */
+ init: function (cipherParams) {
+ this.mixIn(cipherParams);
+ },
+
+ /**
+ * Converts this cipher params object to a string.
+ *
+ * @param {Format} formatter (Optional) The formatting strategy to use.
+ *
+ * @return {string} The stringified cipher params.
+ *
+ * @throws Error If neither the formatter nor the default formatter is set.
+ *
+ * @example
+ *
+ * var string = cipherParams + '';
+ * var string = cipherParams.toString();
+ * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
+ */
+ toString: function (formatter) {
+ return (formatter || this.formatter).stringify(this);
+ }
+ });
+
+ /**
+ * Format namespace.
+ */
+ var C_format = C.format = {};
+
+ /**
+ * OpenSSL formatting strategy.
+ */
+ var OpenSSLFormatter = C_format.OpenSSL = {
+ /**
+ * Converts a cipher params object to an OpenSSL-compatible string.
+ *
+ * @param {CipherParams} cipherParams The cipher params object.
+ *
+ * @return {string} The OpenSSL-compatible string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
+ */
+ stringify: function (cipherParams) {
+ // Shortcuts
+ var ciphertext = cipherParams.ciphertext;
+ var salt = cipherParams.salt;
+
+ // Format
+ if (salt) {
+ var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
+ } else {
+ var wordArray = ciphertext;
+ }
+
+ return wordArray.toString(Base64);
+ },
+
+ /**
+ * Converts an OpenSSL-compatible string to a cipher params object.
+ *
+ * @param {string} openSSLStr The OpenSSL-compatible string.
+ *
+ * @return {CipherParams} The cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
+ */
+ parse: function (openSSLStr) {
+ // Parse base64
+ var ciphertext = Base64.parse(openSSLStr);
+
+ // Shortcut
+ var ciphertextWords = ciphertext.words;
+
+ // Test for salt
+ if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
+ // Extract salt
+ var salt = WordArray.create(ciphertextWords.slice(2, 4));
+
+ // Remove salt from ciphertext
+ ciphertextWords.splice(0, 4);
+ ciphertext.sigBytes -= 16;
+ }
+
+ return CipherParams.create({ ciphertext: ciphertext, salt: salt });
+ }
+ };
+
+ /**
+ * A cipher wrapper that returns ciphertext as a serializable cipher params object.
+ */
+ var SerializableCipher = C_lib.SerializableCipher = Base.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
+ */
+ cfg: Base.extend({
+ format: OpenSSLFormatter
+ }),
+
+ /**
+ * Encrypts a message.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {WordArray|string} message The message to encrypt.
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {CipherParams} A cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
+ */
+ encrypt: function (cipher, message, key, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Encrypt
+ var encryptor = cipher.createEncryptor(key, cfg);
+ var ciphertext = encryptor.finalize(message);
+
+ // Shortcut
+ var cipherCfg = encryptor.cfg;
+
+ // Create and return serializable cipher params
+ return CipherParams.create({
+ ciphertext: ciphertext,
+ key: key,
+ iv: cipherCfg.iv,
+ algorithm: cipher,
+ mode: cipherCfg.mode,
+ padding: cipherCfg.padding,
+ blockSize: cipher.blockSize,
+ formatter: cfg.format
+ });
+ },
+
+ /**
+ * Decrypts serialized ciphertext.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {WordArray} The plaintext.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
+ * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
+ */
+ decrypt: function (cipher, ciphertext, key, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Convert string to CipherParams
+ ciphertext = this._parse(ciphertext, cfg.format);
+
+ // Decrypt
+ var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
+
+ return plaintext;
+ },
+
+ /**
+ * Converts serialized ciphertext to CipherParams,
+ * else assumed CipherParams already and returns ciphertext unchanged.
+ *
+ * @param {CipherParams|string} ciphertext The ciphertext.
+ * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
+ *
+ * @return {CipherParams} The unserialized ciphertext.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
+ */
+ _parse: function (ciphertext, format) {
+ if (typeof ciphertext == 'string') {
+ return format.parse(ciphertext, this);
+ } else {
+ return ciphertext;
+ }
+ }
+ });
+
+ /**
+ * Key derivation function namespace.
+ */
+ var C_kdf = C.kdf = {};
+
+ /**
+ * OpenSSL key derivation function.
+ */
+ var OpenSSLKdf = C_kdf.OpenSSL = {
+ /**
+ * Derives a key and IV from a password.
+ *
+ * @param {string} password The password to derive from.
+ * @param {number} keySize The size in words of the key to generate.
+ * @param {number} ivSize The size in words of the IV to generate.
+ * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
+ *
+ * @return {CipherParams} A cipher params object with the key, IV, and salt.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
+ */
+ execute: function (password, keySize, ivSize, salt) {
+ // Generate random salt
+ if (!salt) {
+ salt = WordArray.random(64/8);
+ }
+
+ // Derive key and IV
+ var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
+
+ // Separate key and IV
+ var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
+ key.sigBytes = keySize * 4;
+
+ // Return params
+ return CipherParams.create({ key: key, iv: iv, salt: salt });
+ }
+ };
+
+ /**
+ * A serializable cipher wrapper that derives the key from a password,
+ * and returns ciphertext as a serializable cipher params object.
+ */
+ var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
+ */
+ cfg: SerializableCipher.cfg.extend({
+ kdf: OpenSSLKdf
+ }),
+
+ /**
+ * Encrypts a message using a password.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {WordArray|string} message The message to encrypt.
+ * @param {string} password The password.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {CipherParams} A cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
+ */
+ encrypt: function (cipher, message, password, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Derive key and other params
+ var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
+
+ // Add IV to config
+ cfg.iv = derivedParams.iv;
+
+ // Encrypt
+ var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
+
+ // Mix in derived params
+ ciphertext.mixIn(derivedParams);
+
+ return ciphertext;
+ },
+
+ /**
+ * Decrypts serialized ciphertext using a password.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
+ * @param {string} password The password.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {WordArray} The plaintext.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
+ */
+ decrypt: function (cipher, ciphertext, password, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Convert string to CipherParams
+ ciphertext = this._parse(ciphertext, cfg.format);
+
+ // Derive key and other params
+ var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
+
+ // Add IV to config
+ cfg.iv = derivedParams.iv;
+
+ // Decrypt
+ var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
+
+ return plaintext;
+ }
+ });
+ }());
+
+
+}));
+},{"./core":473}],473:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory();
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define([], factory);
+ }
+ else {
+ // Global (browser)
+ root.CryptoJS = factory();
+ }
+}(this, function () {
+
+ /**
+ * CryptoJS core components.
+ */
+ var CryptoJS = CryptoJS || (function (Math, undefined) {
+ /*
+ * Local polyfil of Object.create
+ */
+ var create = Object.create || (function () {
+ function F() {};
+
+ return function (obj) {
+ var subtype;
+
+ F.prototype = obj;
+
+ subtype = new F();
+
+ F.prototype = null;
+
+ return subtype;
+ };
+ }())
+
+ /**
+ * CryptoJS namespace.
+ */
+ var C = {};
+
+ /**
+ * Library namespace.
+ */
+ var C_lib = C.lib = {};
+
+ /**
+ * Base object for prototypal inheritance.
+ */
+ var Base = C_lib.Base = (function () {
+
+
+ return {
+ /**
+ * Creates a new object that inherits from this object.
+ *
+ * @param {Object} overrides Properties to copy into the new object.
+ *
+ * @return {Object} The new object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var MyType = CryptoJS.lib.Base.extend({
+ * field: 'value',
+ *
+ * method: function () {
+ * }
+ * });
+ */
+ extend: function (overrides) {
+ // Spawn
+ var subtype = create(this);
+
+ // Augment
+ if (overrides) {
+ subtype.mixIn(overrides);
+ }
+
+ // Create default initializer
+ if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
+ subtype.init = function () {
+ subtype.$super.init.apply(this, arguments);
+ };
+ }
+
+ // Initializer's prototype is the subtype object
+ subtype.init.prototype = subtype;
+
+ // Reference supertype
+ subtype.$super = this;
+
+ return subtype;
+ },
+
+ /**
+ * Extends this object and runs the init method.
+ * Arguments to create() will be passed to init().
+ *
+ * @return {Object} The new object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var instance = MyType.create();
+ */
+ create: function () {
+ var instance = this.extend();
+ instance.init.apply(instance, arguments);
+
+ return instance;
+ },
+
+ /**
+ * Initializes a newly created object.
+ * Override this method to add some logic when your objects are created.
+ *
+ * @example
+ *
+ * var MyType = CryptoJS.lib.Base.extend({
+ * init: function () {
+ * // ...
+ * }
+ * });
+ */
+ init: function () {
+ },
+
+ /**
+ * Copies properties into this object.
+ *
+ * @param {Object} properties The properties to mix in.
+ *
+ * @example
+ *
+ * MyType.mixIn({
+ * field: 'value'
+ * });
+ */
+ mixIn: function (properties) {
+ for (var propertyName in properties) {
+ if (properties.hasOwnProperty(propertyName)) {
+ this[propertyName] = properties[propertyName];
+ }
+ }
+
+ // IE won't copy toString using the loop above
+ if (properties.hasOwnProperty('toString')) {
+ this.toString = properties.toString;
+ }
+ },
+
+ /**
+ * Creates a copy of this object.
+ *
+ * @return {Object} The clone.
+ *
+ * @example
+ *
+ * var clone = instance.clone();
+ */
+ clone: function () {
+ return this.init.prototype.extend(this);
+ }
+ };
+ }());
+
+ /**
+ * An array of 32-bit words.
+ *
+ * @property {Array} words The array of 32-bit words.
+ * @property {number} sigBytes The number of significant bytes in this word array.
+ */
+ var WordArray = C_lib.WordArray = Base.extend({
+ /**
+ * Initializes a newly created word array.
+ *
+ * @param {Array} words (Optional) An array of 32-bit words.
+ * @param {number} sigBytes (Optional) The number of significant bytes in the words.
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.lib.WordArray.create();
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
+ */
+ init: function (words, sigBytes) {
+ words = this.words = words || [];
+
+ if (sigBytes != undefined) {
+ this.sigBytes = sigBytes;
+ } else {
+ this.sigBytes = words.length * 4;
+ }
+ },
+
+ /**
+ * Converts this word array to a string.
+ *
+ * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
+ *
+ * @return {string} The stringified word array.
+ *
+ * @example
+ *
+ * var string = wordArray + '';
+ * var string = wordArray.toString();
+ * var string = wordArray.toString(CryptoJS.enc.Utf8);
+ */
+ toString: function (encoder) {
+ return (encoder || Hex).stringify(this);
+ },
+
+ /**
+ * Concatenates a word array to this word array.
+ *
+ * @param {WordArray} wordArray The word array to append.
+ *
+ * @return {WordArray} This word array.
+ *
+ * @example
+ *
+ * wordArray1.concat(wordArray2);
+ */
+ concat: function (wordArray) {
+ // Shortcuts
+ var thisWords = this.words;
+ var thatWords = wordArray.words;
+ var thisSigBytes = this.sigBytes;
+ var thatSigBytes = wordArray.sigBytes;
+
+ // Clamp excess bits
+ this.clamp();
+
+ // Concat
+ if (thisSigBytes % 4) {
+ // Copy one byte at a time
+ for (var i = 0; i < thatSigBytes; i++) {
+ var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
+ }
+ } else {
+ // Copy one word at a time
+ for (var i = 0; i < thatSigBytes; i += 4) {
+ thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
+ }
+ }
+ this.sigBytes += thatSigBytes;
+
+ // Chainable
+ return this;
+ },
+
+ /**
+ * Removes insignificant bits.
+ *
+ * @example
+ *
+ * wordArray.clamp();
+ */
+ clamp: function () {
+ // Shortcuts
+ var words = this.words;
+ var sigBytes = this.sigBytes;
+
+ // Clamp
+ words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
+ words.length = Math.ceil(sigBytes / 4);
+ },
+
+ /**
+ * Creates a copy of this word array.
+ *
+ * @return {WordArray} The clone.
+ *
+ * @example
+ *
+ * var clone = wordArray.clone();
+ */
+ clone: function () {
+ var clone = Base.clone.call(this);
+ clone.words = this.words.slice(0);
+
+ return clone;
+ },
+
+ /**
+ * Creates a word array filled with random bytes.
+ *
+ * @param {number} nBytes The number of random bytes to generate.
+ *
+ * @return {WordArray} The random word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.lib.WordArray.random(16);
+ */
+ random: function (nBytes) {
+ var words = [];
+
+ var r = (function (m_w) {
+ var m_w = m_w;
+ var m_z = 0x3ade68b1;
+ var mask = 0xffffffff;
+
+ return function () {
+ m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
+ m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
+ var result = ((m_z << 0x10) + m_w) & mask;
+ result /= 0x100000000;
+ result += 0.5;
+ return result * (Math.random() > .5 ? 1 : -1);
+ }
+ });
+
+ for (var i = 0, rcache; i < nBytes; i += 4) {
+ var _r = r((rcache || Math.random()) * 0x100000000);
+
+ rcache = _r() * 0x3ade67b7;
+ words.push((_r() * 0x100000000) | 0);
+ }
+
+ return new WordArray.init(words, nBytes);
+ }
+ });
+
+ /**
+ * Encoder namespace.
+ */
+ var C_enc = C.enc = {};
+
+ /**
+ * Hex encoding strategy.
+ */
+ var Hex = C_enc.Hex = {
+ /**
+ * Converts a word array to a hex string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The hex string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var hexChars = [];
+ for (var i = 0; i < sigBytes; i++) {
+ var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ hexChars.push((bite >>> 4).toString(16));
+ hexChars.push((bite & 0x0f).toString(16));
+ }
+
+ return hexChars.join('');
+ },
+
+ /**
+ * Converts a hex string to a word array.
+ *
+ * @param {string} hexStr The hex string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Hex.parse(hexString);
+ */
+ parse: function (hexStr) {
+ // Shortcut
+ var hexStrLength = hexStr.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < hexStrLength; i += 2) {
+ words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
+ }
+
+ return new WordArray.init(words, hexStrLength / 2);
+ }
+ };
+
+ /**
+ * Latin1 encoding strategy.
+ */
+ var Latin1 = C_enc.Latin1 = {
+ /**
+ * Converts a word array to a Latin1 string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The Latin1 string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var latin1Chars = [];
+ for (var i = 0; i < sigBytes; i++) {
+ var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ latin1Chars.push(String.fromCharCode(bite));
+ }
+
+ return latin1Chars.join('');
+ },
+
+ /**
+ * Converts a Latin1 string to a word array.
+ *
+ * @param {string} latin1Str The Latin1 string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
+ */
+ parse: function (latin1Str) {
+ // Shortcut
+ var latin1StrLength = latin1Str.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < latin1StrLength; i++) {
+ words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
+ }
+
+ return new WordArray.init(words, latin1StrLength);
+ }
+ };
+
+ /**
+ * UTF-8 encoding strategy.
+ */
+ var Utf8 = C_enc.Utf8 = {
+ /**
+ * Converts a word array to a UTF-8 string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The UTF-8 string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ try {
+ return decodeURIComponent(escape(Latin1.stringify(wordArray)));
+ } catch (e) {
+ throw new Error('Malformed UTF-8 data');
+ }
+ },
+
+ /**
+ * Converts a UTF-8 string to a word array.
+ *
+ * @param {string} utf8Str The UTF-8 string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
+ */
+ parse: function (utf8Str) {
+ return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
+ }
+ };
+
+ /**
+ * Abstract buffered block algorithm template.
+ *
+ * The property blockSize must be implemented in a concrete subtype.
+ *
+ * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
+ */
+ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
+ /**
+ * Resets this block algorithm's data buffer to its initial state.
+ *
+ * @example
+ *
+ * bufferedBlockAlgorithm.reset();
+ */
+ reset: function () {
+ // Initial values
+ this._data = new WordArray.init();
+ this._nDataBytes = 0;
+ },
+
+ /**
+ * Adds new data to this block algorithm's buffer.
+ *
+ * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
+ *
+ * @example
+ *
+ * bufferedBlockAlgorithm._append('data');
+ * bufferedBlockAlgorithm._append(wordArray);
+ */
+ _append: function (data) {
+ // Convert string to WordArray, else assume WordArray already
+ if (typeof data == 'string') {
+ data = Utf8.parse(data);
+ }
+
+ // Append
+ this._data.concat(data);
+ this._nDataBytes += data.sigBytes;
+ },
+
+ /**
+ * Processes available data blocks.
+ *
+ * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
+ *
+ * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
+ *
+ * @return {WordArray} The processed data.
+ *
+ * @example
+ *
+ * var processedData = bufferedBlockAlgorithm._process();
+ * var processedData = bufferedBlockAlgorithm._process(!!'flush');
+ */
+ _process: function (doFlush) {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+ var dataSigBytes = data.sigBytes;
+ var blockSize = this.blockSize;
+ var blockSizeBytes = blockSize * 4;
+
+ // Count blocks ready
+ var nBlocksReady = dataSigBytes / blockSizeBytes;
+ if (doFlush) {
+ // Round up to include partial blocks
+ nBlocksReady = Math.ceil(nBlocksReady);
+ } else {
+ // Round down to include only full blocks,
+ // less the number of blocks that must remain in the buffer
+ nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
+ }
+
+ // Count words ready
+ var nWordsReady = nBlocksReady * blockSize;
+
+ // Count bytes ready
+ var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
+
+ // Process blocks
+ if (nWordsReady) {
+ for (var offset = 0; offset < nWordsReady; offset += blockSize) {
+ // Perform concrete-algorithm logic
+ this._doProcessBlock(dataWords, offset);
+ }
+
+ // Remove processed words
+ var processedWords = dataWords.splice(0, nWordsReady);
+ data.sigBytes -= nBytesReady;
+ }
+
+ // Return processed words
+ return new WordArray.init(processedWords, nBytesReady);
+ },
+
+ /**
+ * Creates a copy of this object.
+ *
+ * @return {Object} The clone.
+ *
+ * @example
+ *
+ * var clone = bufferedBlockAlgorithm.clone();
+ */
+ clone: function () {
+ var clone = Base.clone.call(this);
+ clone._data = this._data.clone();
+
+ return clone;
+ },
+
+ _minBufferSize: 0
+ });
+
+ /**
+ * Abstract hasher template.
+ *
+ * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
+ */
+ var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
+ /**
+ * Configuration options.
+ */
+ cfg: Base.extend(),
+
+ /**
+ * Initializes a newly created hasher.
+ *
+ * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
+ *
+ * @example
+ *
+ * var hasher = CryptoJS.algo.SHA256.create();
+ */
+ init: function (cfg) {
+ // Apply config defaults
+ this.cfg = this.cfg.extend(cfg);
+
+ // Set initial values
+ this.reset();
+ },
+
+ /**
+ * Resets this hasher to its initial state.
+ *
+ * @example
+ *
+ * hasher.reset();
+ */
+ reset: function () {
+ // Reset data buffer
+ BufferedBlockAlgorithm.reset.call(this);
+
+ // Perform concrete-hasher logic
+ this._doReset();
+ },
+
+ /**
+ * Updates this hasher with a message.
+ *
+ * @param {WordArray|string} messageUpdate The message to append.
+ *
+ * @return {Hasher} This hasher.
+ *
+ * @example
+ *
+ * hasher.update('message');
+ * hasher.update(wordArray);
+ */
+ update: function (messageUpdate) {
+ // Append
+ this._append(messageUpdate);
+
+ // Update the hash
+ this._process();
+
+ // Chainable
+ return this;
+ },
+
+ /**
+ * Finalizes the hash computation.
+ * Note that the finalize operation is effectively a destructive, read-once operation.
+ *
+ * @param {WordArray|string} messageUpdate (Optional) A final message update.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @example
+ *
+ * var hash = hasher.finalize();
+ * var hash = hasher.finalize('message');
+ * var hash = hasher.finalize(wordArray);
+ */
+ finalize: function (messageUpdate) {
+ // Final message update
+ if (messageUpdate) {
+ this._append(messageUpdate);
+ }
+
+ // Perform concrete-hasher logic
+ var hash = this._doFinalize();
+
+ return hash;
+ },
+
+ blockSize: 512/32,
+
+ /**
+ * Creates a shortcut function to a hasher's object interface.
+ *
+ * @param {Hasher} hasher The hasher to create a helper for.
+ *
+ * @return {Function} The shortcut function.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
+ */
+ _createHelper: function (hasher) {
+ return function (message, cfg) {
+ return new hasher.init(cfg).finalize(message);
+ };
+ },
+
+ /**
+ * Creates a shortcut function to the HMAC's object interface.
+ *
+ * @param {Hasher} hasher The hasher to use in this HMAC helper.
+ *
+ * @return {Function} The shortcut function.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
+ */
+ _createHmacHelper: function (hasher) {
+ return function (message, key) {
+ return new C_algo.HMAC.init(hasher, key).finalize(message);
+ };
+ }
+ });
+
+ /**
+ * Algorithm namespace.
+ */
+ var C_algo = C.algo = {};
+
+ return C;
+ }(Math));
+
+
+ return CryptoJS;
+
+}));
+},{}],474:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var C_enc = C.enc;
+
+ /**
+ * Base64 encoding strategy.
+ */
+ var Base64 = C_enc.Base64 = {
+ /**
+ * Converts a word array to a Base64 string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The Base64 string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+ var map = this._map;
+
+ // Clamp excess bits
+ wordArray.clamp();
+
+ // Convert
+ var base64Chars = [];
+ for (var i = 0; i < sigBytes; i += 3) {
+ var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
+ var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
+
+ var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
+
+ for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
+ base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
+ }
+ }
+
+ // Add padding
+ var paddingChar = map.charAt(64);
+ if (paddingChar) {
+ while (base64Chars.length % 4) {
+ base64Chars.push(paddingChar);
+ }
+ }
+
+ return base64Chars.join('');
+ },
+
+ /**
+ * Converts a Base64 string to a word array.
+ *
+ * @param {string} base64Str The Base64 string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Base64.parse(base64String);
+ */
+ parse: function (base64Str) {
+ // Shortcuts
+ var base64StrLength = base64Str.length;
+ var map = this._map;
+ var reverseMap = this._reverseMap;
+
+ if (!reverseMap) {
+ reverseMap = this._reverseMap = [];
+ for (var j = 0; j < map.length; j++) {
+ reverseMap[map.charCodeAt(j)] = j;
+ }
+ }
+
+ // Ignore padding
+ var paddingChar = map.charAt(64);
+ if (paddingChar) {
+ var paddingIndex = base64Str.indexOf(paddingChar);
+ if (paddingIndex !== -1) {
+ base64StrLength = paddingIndex;
+ }
+ }
+
+ // Convert
+ return parseLoop(base64Str, base64StrLength, reverseMap);
+
+ },
+
+ _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
+ };
+
+ function parseLoop(base64Str, base64StrLength, reverseMap) {
+ var words = [];
+ var nBytes = 0;
+ for (var i = 0; i < base64StrLength; i++) {
+ if (i % 4) {
+ var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
+ var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
+ words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
+ nBytes++;
+ }
+ }
+ return WordArray.create(words, nBytes);
+ }
+ }());
+
+
+ return CryptoJS.enc.Base64;
+
+}));
+},{"./core":473}],475:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var C_enc = C.enc;
+
+ /**
+ * UTF-16 BE encoding strategy.
+ */
+ var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
+ /**
+ * Converts a word array to a UTF-16 BE string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The UTF-16 BE string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var utf16Chars = [];
+ for (var i = 0; i < sigBytes; i += 2) {
+ var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
+ utf16Chars.push(String.fromCharCode(codePoint));
+ }
+
+ return utf16Chars.join('');
+ },
+
+ /**
+ * Converts a UTF-16 BE string to a word array.
+ *
+ * @param {string} utf16Str The UTF-16 BE string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
+ */
+ parse: function (utf16Str) {
+ // Shortcut
+ var utf16StrLength = utf16Str.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < utf16StrLength; i++) {
+ words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
+ }
+
+ return WordArray.create(words, utf16StrLength * 2);
+ }
+ };
+
+ /**
+ * UTF-16 LE encoding strategy.
+ */
+ C_enc.Utf16LE = {
+ /**
+ * Converts a word array to a UTF-16 LE string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The UTF-16 LE string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var utf16Chars = [];
+ for (var i = 0; i < sigBytes; i += 2) {
+ var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
+ utf16Chars.push(String.fromCharCode(codePoint));
+ }
+
+ return utf16Chars.join('');
+ },
+
+ /**
+ * Converts a UTF-16 LE string to a word array.
+ *
+ * @param {string} utf16Str The UTF-16 LE string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
+ */
+ parse: function (utf16Str) {
+ // Shortcut
+ var utf16StrLength = utf16Str.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < utf16StrLength; i++) {
+ words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
+ }
+
+ return WordArray.create(words, utf16StrLength * 2);
+ }
+ };
+
+ function swapEndian(word) {
+ return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
+ }
+ }());
+
+
+ return CryptoJS.enc.Utf16;
+
+}));
+},{"./core":473}],476:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./sha1", "./hmac"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var WordArray = C_lib.WordArray;
+ var C_algo = C.algo;
+ var MD5 = C_algo.MD5;
+
+ /**
+ * This key derivation function is meant to conform with EVP_BytesToKey.
+ * www.openssl.org/docs/crypto/EVP_BytesToKey.html
+ */
+ var EvpKDF = C_algo.EvpKDF = Base.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
+ * @property {Hasher} hasher The hash algorithm to use. Default: MD5
+ * @property {number} iterations The number of iterations to perform. Default: 1
+ */
+ cfg: Base.extend({
+ keySize: 128/32,
+ hasher: MD5,
+ iterations: 1
+ }),
+
+ /**
+ * Initializes a newly created key derivation function.
+ *
+ * @param {Object} cfg (Optional) The configuration options to use for the derivation.
+ *
+ * @example
+ *
+ * var kdf = CryptoJS.algo.EvpKDF.create();
+ * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
+ * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
+ */
+ init: function (cfg) {
+ this.cfg = this.cfg.extend(cfg);
+ },
+
+ /**
+ * Derives a key from a password.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @example
+ *
+ * var key = kdf.compute(password, salt);
+ */
+ compute: function (password, salt) {
+ // Shortcut
+ var cfg = this.cfg;
+
+ // Init hasher
+ var hasher = cfg.hasher.create();
+
+ // Initial values
+ var derivedKey = WordArray.create();
+
+ // Shortcuts
+ var derivedKeyWords = derivedKey.words;
+ var keySize = cfg.keySize;
+ var iterations = cfg.iterations;
+
+ // Generate key
+ while (derivedKeyWords.length < keySize) {
+ if (block) {
+ hasher.update(block);
+ }
+ var block = hasher.update(password).finalize(salt);
+ hasher.reset();
+
+ // Iterations
+ for (var i = 1; i < iterations; i++) {
+ block = hasher.finalize(block);
+ hasher.reset();
+ }
+
+ derivedKey.concat(block);
+ }
+ derivedKey.sigBytes = keySize * 4;
+
+ return derivedKey;
+ }
+ });
+
+ /**
+ * Derives a key from a password.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ * @param {Object} cfg (Optional) The configuration options to use for this computation.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var key = CryptoJS.EvpKDF(password, salt);
+ * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
+ * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
+ */
+ C.EvpKDF = function (password, salt, cfg) {
+ return EvpKDF.create(cfg).compute(password, salt);
+ };
+ }());
+
+
+ return CryptoJS.EvpKDF;
+
+}));
+},{"./core":473,"./hmac":478,"./sha1":497}],477:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function (undefined) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var CipherParams = C_lib.CipherParams;
+ var C_enc = C.enc;
+ var Hex = C_enc.Hex;
+ var C_format = C.format;
+
+ var HexFormatter = C_format.Hex = {
+ /**
+ * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
+ *
+ * @param {CipherParams} cipherParams The cipher params object.
+ *
+ * @return {string} The hexadecimally encoded string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hexString = CryptoJS.format.Hex.stringify(cipherParams);
+ */
+ stringify: function (cipherParams) {
+ return cipherParams.ciphertext.toString(Hex);
+ },
+
+ /**
+ * Converts a hexadecimally encoded ciphertext string to a cipher params object.
+ *
+ * @param {string} input The hexadecimally encoded string.
+ *
+ * @return {CipherParams} The cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipherParams = CryptoJS.format.Hex.parse(hexString);
+ */
+ parse: function (input) {
+ var ciphertext = Hex.parse(input);
+ return CipherParams.create({ ciphertext: ciphertext });
+ }
+ };
+ }());
+
+
+ return CryptoJS.format.Hex;
+
+}));
+},{"./cipher-core":472,"./core":473}],478:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var C_enc = C.enc;
+ var Utf8 = C_enc.Utf8;
+ var C_algo = C.algo;
+
+ /**
+ * HMAC algorithm.
+ */
+ var HMAC = C_algo.HMAC = Base.extend({
+ /**
+ * Initializes a newly created HMAC.
+ *
+ * @param {Hasher} hasher The hash algorithm to use.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @example
+ *
+ * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
+ */
+ init: function (hasher, key) {
+ // Init hasher
+ hasher = this._hasher = new hasher.init();
+
+ // Convert string to WordArray, else assume WordArray already
+ if (typeof key == 'string') {
+ key = Utf8.parse(key);
+ }
+
+ // Shortcuts
+ var hasherBlockSize = hasher.blockSize;
+ var hasherBlockSizeBytes = hasherBlockSize * 4;
+
+ // Allow arbitrary length keys
+ if (key.sigBytes > hasherBlockSizeBytes) {
+ key = hasher.finalize(key);
+ }
+
+ // Clamp excess bits
+ key.clamp();
+
+ // Clone key for inner and outer pads
+ var oKey = this._oKey = key.clone();
+ var iKey = this._iKey = key.clone();
+
+ // Shortcuts
+ var oKeyWords = oKey.words;
+ var iKeyWords = iKey.words;
+
+ // XOR keys with pad constants
+ for (var i = 0; i < hasherBlockSize; i++) {
+ oKeyWords[i] ^= 0x5c5c5c5c;
+ iKeyWords[i] ^= 0x36363636;
+ }
+ oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
+
+ // Set initial values
+ this.reset();
+ },
+
+ /**
+ * Resets this HMAC to its initial state.
+ *
+ * @example
+ *
+ * hmacHasher.reset();
+ */
+ reset: function () {
+ // Shortcut
+ var hasher = this._hasher;
+
+ // Reset
+ hasher.reset();
+ hasher.update(this._iKey);
+ },
+
+ /**
+ * Updates this HMAC with a message.
+ *
+ * @param {WordArray|string} messageUpdate The message to append.
+ *
+ * @return {HMAC} This HMAC instance.
+ *
+ * @example
+ *
+ * hmacHasher.update('message');
+ * hmacHasher.update(wordArray);
+ */
+ update: function (messageUpdate) {
+ this._hasher.update(messageUpdate);
+
+ // Chainable
+ return this;
+ },
+
+ /**
+ * Finalizes the HMAC computation.
+ * Note that the finalize operation is effectively a destructive, read-once operation.
+ *
+ * @param {WordArray|string} messageUpdate (Optional) A final message update.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @example
+ *
+ * var hmac = hmacHasher.finalize();
+ * var hmac = hmacHasher.finalize('message');
+ * var hmac = hmacHasher.finalize(wordArray);
+ */
+ finalize: function (messageUpdate) {
+ // Shortcut
+ var hasher = this._hasher;
+
+ // Compute HMAC
+ var innerHash = hasher.finalize(messageUpdate);
+ hasher.reset();
+ var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
+
+ return hmac;
+ }
+ });
+ }());
+
+
+}));
+},{"./core":473}],479:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory);
+ }
+ else {
+ // Global (browser)
+ root.CryptoJS = factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ return CryptoJS;
+
+}));
+},{"./aes":471,"./cipher-core":472,"./core":473,"./enc-base64":474,"./enc-utf16":475,"./evpkdf":476,"./format-hex":477,"./hmac":478,"./lib-typedarrays":480,"./md5":481,"./mode-cfb":482,"./mode-ctr":484,"./mode-ctr-gladman":483,"./mode-ecb":485,"./mode-ofb":486,"./pad-ansix923":487,"./pad-iso10126":488,"./pad-iso97971":489,"./pad-nopadding":490,"./pad-zeropadding":491,"./pbkdf2":492,"./rabbit":494,"./rabbit-legacy":493,"./rc4":495,"./ripemd160":496,"./sha1":497,"./sha224":498,"./sha256":499,"./sha3":500,"./sha384":501,"./sha512":502,"./tripledes":503,"./x64-core":504}],480:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Check if typed arrays are supported
+ if (typeof ArrayBuffer != 'function') {
+ return;
+ }
+
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+
+ // Reference original init
+ var superInit = WordArray.init;
+
+ // Augment WordArray.init to handle typed arrays
+ var subInit = WordArray.init = function (typedArray) {
+ // Convert buffers to uint8
+ if (typedArray instanceof ArrayBuffer) {
+ typedArray = new Uint8Array(typedArray);
+ }
+
+ // Convert other array views to uint8
+ if (
+ typedArray instanceof Int8Array ||
+ (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
+ typedArray instanceof Int16Array ||
+ typedArray instanceof Uint16Array ||
+ typedArray instanceof Int32Array ||
+ typedArray instanceof Uint32Array ||
+ typedArray instanceof Float32Array ||
+ typedArray instanceof Float64Array
+ ) {
+ typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
+ }
+
+ // Handle Uint8Array
+ if (typedArray instanceof Uint8Array) {
+ // Shortcut
+ var typedArrayByteLength = typedArray.byteLength;
+
+ // Extract bytes
+ var words = [];
+ for (var i = 0; i < typedArrayByteLength; i++) {
+ words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
+ }
+
+ // Initialize this word array
+ superInit.call(this, words, typedArrayByteLength);
+ } else {
+ // Else call normal init
+ superInit.apply(this, arguments);
+ }
+ };
+
+ subInit.prototype = WordArray;
+ }());
+
+
+ return CryptoJS.lib.WordArray;
+
+}));
+},{"./core":473}],481:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Constants table
+ var T = [];
+
+ // Compute constants
+ (function () {
+ for (var i = 0; i < 64; i++) {
+ T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
+ }
+ }());
+
+ /**
+ * MD5 hash algorithm.
+ */
+ var MD5 = C_algo.MD5 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init([
+ 0x67452301, 0xefcdab89,
+ 0x98badcfe, 0x10325476
+ ]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Swap endian
+ for (var i = 0; i < 16; i++) {
+ // Shortcuts
+ var offset_i = offset + i;
+ var M_offset_i = M[offset_i];
+
+ M[offset_i] = (
+ (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
+ (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
+ );
+ }
+
+ // Shortcuts
+ var H = this._hash.words;
+
+ var M_offset_0 = M[offset + 0];
+ var M_offset_1 = M[offset + 1];
+ var M_offset_2 = M[offset + 2];
+ var M_offset_3 = M[offset + 3];
+ var M_offset_4 = M[offset + 4];
+ var M_offset_5 = M[offset + 5];
+ var M_offset_6 = M[offset + 6];
+ var M_offset_7 = M[offset + 7];
+ var M_offset_8 = M[offset + 8];
+ var M_offset_9 = M[offset + 9];
+ var M_offset_10 = M[offset + 10];
+ var M_offset_11 = M[offset + 11];
+ var M_offset_12 = M[offset + 12];
+ var M_offset_13 = M[offset + 13];
+ var M_offset_14 = M[offset + 14];
+ var M_offset_15 = M[offset + 15];
+
+ // Working varialbes
+ var a = H[0];
+ var b = H[1];
+ var c = H[2];
+ var d = H[3];
+
+ // Computation
+ a = FF(a, b, c, d, M_offset_0, 7, T[0]);
+ d = FF(d, a, b, c, M_offset_1, 12, T[1]);
+ c = FF(c, d, a, b, M_offset_2, 17, T[2]);
+ b = FF(b, c, d, a, M_offset_3, 22, T[3]);
+ a = FF(a, b, c, d, M_offset_4, 7, T[4]);
+ d = FF(d, a, b, c, M_offset_5, 12, T[5]);
+ c = FF(c, d, a, b, M_offset_6, 17, T[6]);
+ b = FF(b, c, d, a, M_offset_7, 22, T[7]);
+ a = FF(a, b, c, d, M_offset_8, 7, T[8]);
+ d = FF(d, a, b, c, M_offset_9, 12, T[9]);
+ c = FF(c, d, a, b, M_offset_10, 17, T[10]);
+ b = FF(b, c, d, a, M_offset_11, 22, T[11]);
+ a = FF(a, b, c, d, M_offset_12, 7, T[12]);
+ d = FF(d, a, b, c, M_offset_13, 12, T[13]);
+ c = FF(c, d, a, b, M_offset_14, 17, T[14]);
+ b = FF(b, c, d, a, M_offset_15, 22, T[15]);
+
+ a = GG(a, b, c, d, M_offset_1, 5, T[16]);
+ d = GG(d, a, b, c, M_offset_6, 9, T[17]);
+ c = GG(c, d, a, b, M_offset_11, 14, T[18]);
+ b = GG(b, c, d, a, M_offset_0, 20, T[19]);
+ a = GG(a, b, c, d, M_offset_5, 5, T[20]);
+ d = GG(d, a, b, c, M_offset_10, 9, T[21]);
+ c = GG(c, d, a, b, M_offset_15, 14, T[22]);
+ b = GG(b, c, d, a, M_offset_4, 20, T[23]);
+ a = GG(a, b, c, d, M_offset_9, 5, T[24]);
+ d = GG(d, a, b, c, M_offset_14, 9, T[25]);
+ c = GG(c, d, a, b, M_offset_3, 14, T[26]);
+ b = GG(b, c, d, a, M_offset_8, 20, T[27]);
+ a = GG(a, b, c, d, M_offset_13, 5, T[28]);
+ d = GG(d, a, b, c, M_offset_2, 9, T[29]);
+ c = GG(c, d, a, b, M_offset_7, 14, T[30]);
+ b = GG(b, c, d, a, M_offset_12, 20, T[31]);
+
+ a = HH(a, b, c, d, M_offset_5, 4, T[32]);
+ d = HH(d, a, b, c, M_offset_8, 11, T[33]);
+ c = HH(c, d, a, b, M_offset_11, 16, T[34]);
+ b = HH(b, c, d, a, M_offset_14, 23, T[35]);
+ a = HH(a, b, c, d, M_offset_1, 4, T[36]);
+ d = HH(d, a, b, c, M_offset_4, 11, T[37]);
+ c = HH(c, d, a, b, M_offset_7, 16, T[38]);
+ b = HH(b, c, d, a, M_offset_10, 23, T[39]);
+ a = HH(a, b, c, d, M_offset_13, 4, T[40]);
+ d = HH(d, a, b, c, M_offset_0, 11, T[41]);
+ c = HH(c, d, a, b, M_offset_3, 16, T[42]);
+ b = HH(b, c, d, a, M_offset_6, 23, T[43]);
+ a = HH(a, b, c, d, M_offset_9, 4, T[44]);
+ d = HH(d, a, b, c, M_offset_12, 11, T[45]);
+ c = HH(c, d, a, b, M_offset_15, 16, T[46]);
+ b = HH(b, c, d, a, M_offset_2, 23, T[47]);
+
+ a = II(a, b, c, d, M_offset_0, 6, T[48]);
+ d = II(d, a, b, c, M_offset_7, 10, T[49]);
+ c = II(c, d, a, b, M_offset_14, 15, T[50]);
+ b = II(b, c, d, a, M_offset_5, 21, T[51]);
+ a = II(a, b, c, d, M_offset_12, 6, T[52]);
+ d = II(d, a, b, c, M_offset_3, 10, T[53]);
+ c = II(c, d, a, b, M_offset_10, 15, T[54]);
+ b = II(b, c, d, a, M_offset_1, 21, T[55]);
+ a = II(a, b, c, d, M_offset_8, 6, T[56]);
+ d = II(d, a, b, c, M_offset_15, 10, T[57]);
+ c = II(c, d, a, b, M_offset_6, 15, T[58]);
+ b = II(b, c, d, a, M_offset_13, 21, T[59]);
+ a = II(a, b, c, d, M_offset_4, 6, T[60]);
+ d = II(d, a, b, c, M_offset_11, 10, T[61]);
+ c = II(c, d, a, b, M_offset_2, 15, T[62]);
+ b = II(b, c, d, a, M_offset_9, 21, T[63]);
+
+ // Intermediate hash value
+ H[0] = (H[0] + a) | 0;
+ H[1] = (H[1] + b) | 0;
+ H[2] = (H[2] + c) | 0;
+ H[3] = (H[3] + d) | 0;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+
+ var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
+ var nBitsTotalL = nBitsTotal;
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
+ (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
+ (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
+ );
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
+ (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
+ (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
+ );
+
+ data.sigBytes = (dataWords.length + 1) * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Shortcuts
+ var hash = this._hash;
+ var H = hash.words;
+
+ // Swap endian
+ for (var i = 0; i < 4; i++) {
+ // Shortcut
+ var H_i = H[i];
+
+ H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
+ (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
+ }
+
+ // Return final computed hash
+ return hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+ function FF(a, b, c, d, x, s, t) {
+ var n = a + ((b & c) | (~b & d)) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ function GG(a, b, c, d, x, s, t) {
+ var n = a + ((b & d) | (c & ~d)) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ function HH(a, b, c, d, x, s, t) {
+ var n = a + (b ^ c ^ d) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ function II(a, b, c, d, x, s, t) {
+ var n = a + (c ^ (b | ~d)) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.MD5('message');
+ * var hash = CryptoJS.MD5(wordArray);
+ */
+ C.MD5 = Hasher._createHelper(MD5);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacMD5(message, key);
+ */
+ C.HmacMD5 = Hasher._createHmacHelper(MD5);
+ }(Math));
+
+
+ return CryptoJS.MD5;
+
+}));
+},{"./core":473}],482:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * Cipher Feedback block mode.
+ */
+ CryptoJS.mode.CFB = (function () {
+ var CFB = CryptoJS.lib.BlockCipherMode.extend();
+
+ CFB.Encryptor = CFB.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
+
+ // Remember this block to use with next block
+ this._prevBlock = words.slice(offset, offset + blockSize);
+ }
+ });
+
+ CFB.Decryptor = CFB.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ // Remember this block to use with next block
+ var thisBlock = words.slice(offset, offset + blockSize);
+
+ generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
+
+ // This block becomes the previous block
+ this._prevBlock = thisBlock;
+ }
+ });
+
+ function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
+ // Shortcut
+ var iv = this._iv;
+
+ // Generate keystream
+ if (iv) {
+ var keystream = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ } else {
+ var keystream = this._prevBlock;
+ }
+ cipher.encryptBlock(keystream, 0);
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+
+ return CFB;
+ }());
+
+
+ return CryptoJS.mode.CFB;
+
+}));
+},{"./cipher-core":472,"./core":473}],483:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /** @preserve
+ * Counter block mode compatible with Dr Brian Gladman fileenc.c
+ * derived from CryptoJS.mode.CTR
+ * Jan Hruby jhruby.web@gmail.com
+ */
+ CryptoJS.mode.CTRGladman = (function () {
+ var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
+
+ function incWord(word)
+ {
+ if (((word >> 24) & 0xff) === 0xff) { //overflow
+ var b1 = (word >> 16)&0xff;
+ var b2 = (word >> 8)&0xff;
+ var b3 = word & 0xff;
+
+ if (b1 === 0xff) // overflow b1
+ {
+ b1 = 0;
+ if (b2 === 0xff)
+ {
+ b2 = 0;
+ if (b3 === 0xff)
+ {
+ b3 = 0;
+ }
+ else
+ {
+ ++b3;
+ }
+ }
+ else
+ {
+ ++b2;
+ }
+ }
+ else
+ {
+ ++b1;
+ }
+
+ word = 0;
+ word += (b1 << 16);
+ word += (b2 << 8);
+ word += b3;
+ }
+ else
+ {
+ word += (0x01 << 24);
+ }
+ return word;
+ }
+
+ function incCounter(counter)
+ {
+ if ((counter[0] = incWord(counter[0])) === 0)
+ {
+ // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
+ counter[1] = incWord(counter[1]);
+ }
+ return counter;
+ }
+
+ var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher
+ var blockSize = cipher.blockSize;
+ var iv = this._iv;
+ var counter = this._counter;
+
+ // Generate keystream
+ if (iv) {
+ counter = this._counter = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ }
+
+ incCounter(counter);
+
+ var keystream = counter.slice(0);
+ cipher.encryptBlock(keystream, 0);
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+ });
+
+ CTRGladman.Decryptor = Encryptor;
+
+ return CTRGladman;
+ }());
+
+
+
+
+ return CryptoJS.mode.CTRGladman;
+
+}));
+},{"./cipher-core":472,"./core":473}],484:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * Counter block mode.
+ */
+ CryptoJS.mode.CTR = (function () {
+ var CTR = CryptoJS.lib.BlockCipherMode.extend();
+
+ var Encryptor = CTR.Encryptor = CTR.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher
+ var blockSize = cipher.blockSize;
+ var iv = this._iv;
+ var counter = this._counter;
+
+ // Generate keystream
+ if (iv) {
+ counter = this._counter = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ }
+ var keystream = counter.slice(0);
+ cipher.encryptBlock(keystream, 0);
+
+ // Increment counter
+ counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+ });
+
+ CTR.Decryptor = Encryptor;
+
+ return CTR;
+ }());
+
+
+ return CryptoJS.mode.CTR;
+
+}));
+},{"./cipher-core":472,"./core":473}],485:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * Electronic Codebook block mode.
+ */
+ CryptoJS.mode.ECB = (function () {
+ var ECB = CryptoJS.lib.BlockCipherMode.extend();
+
+ ECB.Encryptor = ECB.extend({
+ processBlock: function (words, offset) {
+ this._cipher.encryptBlock(words, offset);
+ }
+ });
+
+ ECB.Decryptor = ECB.extend({
+ processBlock: function (words, offset) {
+ this._cipher.decryptBlock(words, offset);
+ }
+ });
+
+ return ECB;
+ }());
+
+
+ return CryptoJS.mode.ECB;
+
+}));
+},{"./cipher-core":472,"./core":473}],486:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * Output Feedback block mode.
+ */
+ CryptoJS.mode.OFB = (function () {
+ var OFB = CryptoJS.lib.BlockCipherMode.extend();
+
+ var Encryptor = OFB.Encryptor = OFB.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher
+ var blockSize = cipher.blockSize;
+ var iv = this._iv;
+ var keystream = this._keystream;
+
+ // Generate keystream
+ if (iv) {
+ keystream = this._keystream = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ }
+ cipher.encryptBlock(keystream, 0);
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+ });
+
+ OFB.Decryptor = Encryptor;
+
+ return OFB;
+ }());
+
+
+ return CryptoJS.mode.OFB;
+
+}));
+},{"./cipher-core":472,"./core":473}],487:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * ANSI X.923 padding strategy.
+ */
+ CryptoJS.pad.AnsiX923 = {
+ pad: function (data, blockSize) {
+ // Shortcuts
+ var dataSigBytes = data.sigBytes;
+ var blockSizeBytes = blockSize * 4;
+
+ // Count padding bytes
+ var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
+
+ // Compute last byte position
+ var lastBytePos = dataSigBytes + nPaddingBytes - 1;
+
+ // Pad
+ data.clamp();
+ data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
+ data.sigBytes += nPaddingBytes;
+ },
+
+ unpad: function (data) {
+ // Get number of padding bytes from last byte
+ var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
+
+ // Remove padding
+ data.sigBytes -= nPaddingBytes;
+ }
+ };
+
+
+ return CryptoJS.pad.Ansix923;
+
+}));
+},{"./cipher-core":472,"./core":473}],488:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * ISO 10126 padding strategy.
+ */
+ CryptoJS.pad.Iso10126 = {
+ pad: function (data, blockSize) {
+ // Shortcut
+ var blockSizeBytes = blockSize * 4;
+
+ // Count padding bytes
+ var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
+
+ // Pad
+ data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
+ concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
+ },
+
+ unpad: function (data) {
+ // Get number of padding bytes from last byte
+ var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
+
+ // Remove padding
+ data.sigBytes -= nPaddingBytes;
+ }
+ };
+
+
+ return CryptoJS.pad.Iso10126;
+
+}));
+},{"./cipher-core":472,"./core":473}],489:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * ISO/IEC 9797-1 Padding Method 2.
+ */
+ CryptoJS.pad.Iso97971 = {
+ pad: function (data, blockSize) {
+ // Add 0x80 byte
+ data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
+
+ // Zero pad the rest
+ CryptoJS.pad.ZeroPadding.pad(data, blockSize);
+ },
+
+ unpad: function (data) {
+ // Remove zero padding
+ CryptoJS.pad.ZeroPadding.unpad(data);
+
+ // Remove one more byte -- the 0x80 byte
+ data.sigBytes--;
+ }
+ };
+
+
+ return CryptoJS.pad.Iso97971;
+
+}));
+},{"./cipher-core":472,"./core":473}],490:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * A noop padding strategy.
+ */
+ CryptoJS.pad.NoPadding = {
+ pad: function () {
+ },
+
+ unpad: function () {
+ }
+ };
+
+
+ return CryptoJS.pad.NoPadding;
+
+}));
+},{"./cipher-core":472,"./core":473}],491:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /**
+ * Zero padding strategy.
+ */
+ CryptoJS.pad.ZeroPadding = {
+ pad: function (data, blockSize) {
+ // Shortcut
+ var blockSizeBytes = blockSize * 4;
+
+ // Pad
+ data.clamp();
+ data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
+ },
+
+ unpad: function (data) {
+ // Shortcut
+ var dataWords = data.words;
+
+ // Unpad
+ var i = data.sigBytes - 1;
+ while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
+ i--;
+ }
+ data.sigBytes = i + 1;
+ }
+ };
+
+
+ return CryptoJS.pad.ZeroPadding;
+
+}));
+},{"./cipher-core":472,"./core":473}],492:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./sha1", "./hmac"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var WordArray = C_lib.WordArray;
+ var C_algo = C.algo;
+ var SHA1 = C_algo.SHA1;
+ var HMAC = C_algo.HMAC;
+
+ /**
+ * Password-Based Key Derivation Function 2 algorithm.
+ */
+ var PBKDF2 = C_algo.PBKDF2 = Base.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
+ * @property {Hasher} hasher The hasher to use. Default: SHA1
+ * @property {number} iterations The number of iterations to perform. Default: 1
+ */
+ cfg: Base.extend({
+ keySize: 128/32,
+ hasher: SHA1,
+ iterations: 1
+ }),
+
+ /**
+ * Initializes a newly created key derivation function.
+ *
+ * @param {Object} cfg (Optional) The configuration options to use for the derivation.
+ *
+ * @example
+ *
+ * var kdf = CryptoJS.algo.PBKDF2.create();
+ * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
+ * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
+ */
+ init: function (cfg) {
+ this.cfg = this.cfg.extend(cfg);
+ },
+
+ /**
+ * Computes the Password-Based Key Derivation Function 2.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @example
+ *
+ * var key = kdf.compute(password, salt);
+ */
+ compute: function (password, salt) {
+ // Shortcut
+ var cfg = this.cfg;
+
+ // Init HMAC
+ var hmac = HMAC.create(cfg.hasher, password);
+
+ // Initial values
+ var derivedKey = WordArray.create();
+ var blockIndex = WordArray.create([0x00000001]);
+
+ // Shortcuts
+ var derivedKeyWords = derivedKey.words;
+ var blockIndexWords = blockIndex.words;
+ var keySize = cfg.keySize;
+ var iterations = cfg.iterations;
+
+ // Generate key
+ while (derivedKeyWords.length < keySize) {
+ var block = hmac.update(salt).finalize(blockIndex);
+ hmac.reset();
+
+ // Shortcuts
+ var blockWords = block.words;
+ var blockWordsLength = blockWords.length;
+
+ // Iterations
+ var intermediate = block;
+ for (var i = 1; i < iterations; i++) {
+ intermediate = hmac.finalize(intermediate);
+ hmac.reset();
+
+ // Shortcut
+ var intermediateWords = intermediate.words;
+
+ // XOR intermediate with block
+ for (var j = 0; j < blockWordsLength; j++) {
+ blockWords[j] ^= intermediateWords[j];
+ }
+ }
+
+ derivedKey.concat(block);
+ blockIndexWords[0]++;
+ }
+ derivedKey.sigBytes = keySize * 4;
+
+ return derivedKey;
+ }
+ });
+
+ /**
+ * Computes the Password-Based Key Derivation Function 2.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ * @param {Object} cfg (Optional) The configuration options to use for this computation.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var key = CryptoJS.PBKDF2(password, salt);
+ * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
+ * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
+ */
+ C.PBKDF2 = function (password, salt, cfg) {
+ return PBKDF2.create(cfg).compute(password, salt);
+ };
+ }());
+
+
+ return CryptoJS.PBKDF2;
+
+}));
+},{"./core":473,"./hmac":478,"./sha1":497}],493:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var StreamCipher = C_lib.StreamCipher;
+ var C_algo = C.algo;
+
+ // Reusable objects
+ var S = [];
+ var C_ = [];
+ var G = [];
+
+ /**
+ * Rabbit stream cipher algorithm.
+ *
+ * This is a legacy version that neglected to convert the key to little-endian.
+ * This error doesn't affect the cipher's security,
+ * but it does affect its compatibility with other implementations.
+ */
+ var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var K = this._key.words;
+ var iv = this.cfg.iv;
+
+ // Generate initial state values
+ var X = this._X = [
+ K[0], (K[3] << 16) | (K[2] >>> 16),
+ K[1], (K[0] << 16) | (K[3] >>> 16),
+ K[2], (K[1] << 16) | (K[0] >>> 16),
+ K[3], (K[2] << 16) | (K[1] >>> 16)
+ ];
+
+ // Generate initial counter values
+ var C = this._C = [
+ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
+ (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
+ (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
+ (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
+ ];
+
+ // Carry bit
+ this._b = 0;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+
+ // Modify the counters
+ for (var i = 0; i < 8; i++) {
+ C[i] ^= X[(i + 4) & 7];
+ }
+
+ // IV setup
+ if (iv) {
+ // Shortcuts
+ var IV = iv.words;
+ var IV_0 = IV[0];
+ var IV_1 = IV[1];
+
+ // Generate four subvectors
+ var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
+ var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
+ var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
+ var i3 = (i2 << 16) | (i0 & 0x0000ffff);
+
+ // Modify counter values
+ C[0] ^= i0;
+ C[1] ^= i1;
+ C[2] ^= i2;
+ C[3] ^= i3;
+ C[4] ^= i0;
+ C[5] ^= i1;
+ C[6] ^= i2;
+ C[7] ^= i3;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+ }
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var X = this._X;
+
+ // Iterate the system
+ nextState.call(this);
+
+ // Generate four keystream words
+ S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
+ S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
+ S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
+ S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
+
+ for (var i = 0; i < 4; i++) {
+ // Swap endian
+ S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
+ (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
+
+ // Encrypt
+ M[offset + i] ^= S[i];
+ }
+ },
+
+ blockSize: 128/32,
+
+ ivSize: 64/32
+ });
+
+ function nextState() {
+ // Shortcuts
+ var X = this._X;
+ var C = this._C;
+
+ // Save old counter values
+ for (var i = 0; i < 8; i++) {
+ C_[i] = C[i];
+ }
+
+ // Calculate new counter values
+ C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
+ C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
+ C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
+ C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
+ C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
+ C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
+ C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
+ C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
+ this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
+
+ // Calculate the g-values
+ for (var i = 0; i < 8; i++) {
+ var gx = X[i] + C[i];
+
+ // Construct high and low argument for squaring
+ var ga = gx & 0xffff;
+ var gb = gx >>> 16;
+
+ // Calculate high and low result of squaring
+ var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
+ var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
+
+ // High XOR low
+ G[i] = gh ^ gl;
+ }
+
+ // Calculate new state values
+ X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
+ X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
+ X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
+ X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
+ X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
+ X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
+ X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
+ X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
+ */
+ C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
+ }());
+
+
+ return CryptoJS.RabbitLegacy;
+
+}));
+},{"./cipher-core":472,"./core":473,"./enc-base64":474,"./evpkdf":476,"./md5":481}],494:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var StreamCipher = C_lib.StreamCipher;
+ var C_algo = C.algo;
+
+ // Reusable objects
+ var S = [];
+ var C_ = [];
+ var G = [];
+
+ /**
+ * Rabbit stream cipher algorithm
+ */
+ var Rabbit = C_algo.Rabbit = StreamCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var K = this._key.words;
+ var iv = this.cfg.iv;
+
+ // Swap endian
+ for (var i = 0; i < 4; i++) {
+ K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
+ (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
+ }
+
+ // Generate initial state values
+ var X = this._X = [
+ K[0], (K[3] << 16) | (K[2] >>> 16),
+ K[1], (K[0] << 16) | (K[3] >>> 16),
+ K[2], (K[1] << 16) | (K[0] >>> 16),
+ K[3], (K[2] << 16) | (K[1] >>> 16)
+ ];
+
+ // Generate initial counter values
+ var C = this._C = [
+ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
+ (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
+ (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
+ (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
+ ];
+
+ // Carry bit
+ this._b = 0;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+
+ // Modify the counters
+ for (var i = 0; i < 8; i++) {
+ C[i] ^= X[(i + 4) & 7];
+ }
+
+ // IV setup
+ if (iv) {
+ // Shortcuts
+ var IV = iv.words;
+ var IV_0 = IV[0];
+ var IV_1 = IV[1];
+
+ // Generate four subvectors
+ var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
+ var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
+ var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
+ var i3 = (i2 << 16) | (i0 & 0x0000ffff);
+
+ // Modify counter values
+ C[0] ^= i0;
+ C[1] ^= i1;
+ C[2] ^= i2;
+ C[3] ^= i3;
+ C[4] ^= i0;
+ C[5] ^= i1;
+ C[6] ^= i2;
+ C[7] ^= i3;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+ }
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var X = this._X;
+
+ // Iterate the system
+ nextState.call(this);
+
+ // Generate four keystream words
+ S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
+ S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
+ S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
+ S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
+
+ for (var i = 0; i < 4; i++) {
+ // Swap endian
+ S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
+ (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
+
+ // Encrypt
+ M[offset + i] ^= S[i];
+ }
+ },
+
+ blockSize: 128/32,
+
+ ivSize: 64/32
+ });
+
+ function nextState() {
+ // Shortcuts
+ var X = this._X;
+ var C = this._C;
+
+ // Save old counter values
+ for (var i = 0; i < 8; i++) {
+ C_[i] = C[i];
+ }
+
+ // Calculate new counter values
+ C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
+ C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
+ C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
+ C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
+ C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
+ C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
+ C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
+ C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
+ this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
+
+ // Calculate the g-values
+ for (var i = 0; i < 8; i++) {
+ var gx = X[i] + C[i];
+
+ // Construct high and low argument for squaring
+ var ga = gx & 0xffff;
+ var gb = gx >>> 16;
+
+ // Calculate high and low result of squaring
+ var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
+ var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
+
+ // High XOR low
+ G[i] = gh ^ gl;
+ }
+
+ // Calculate new state values
+ X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
+ X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
+ X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
+ X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
+ X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
+ X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
+ X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
+ X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
+ */
+ C.Rabbit = StreamCipher._createHelper(Rabbit);
+ }());
+
+
+ return CryptoJS.Rabbit;
+
+}));
+},{"./cipher-core":472,"./core":473,"./enc-base64":474,"./evpkdf":476,"./md5":481}],495:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var StreamCipher = C_lib.StreamCipher;
+ var C_algo = C.algo;
+
+ /**
+ * RC4 stream cipher algorithm.
+ */
+ var RC4 = C_algo.RC4 = StreamCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var key = this._key;
+ var keyWords = key.words;
+ var keySigBytes = key.sigBytes;
+
+ // Init sbox
+ var S = this._S = [];
+ for (var i = 0; i < 256; i++) {
+ S[i] = i;
+ }
+
+ // Key setup
+ for (var i = 0, j = 0; i < 256; i++) {
+ var keyByteIndex = i % keySigBytes;
+ var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
+
+ j = (j + S[i] + keyByte) % 256;
+
+ // Swap
+ var t = S[i];
+ S[i] = S[j];
+ S[j] = t;
+ }
+
+ // Counters
+ this._i = this._j = 0;
+ },
+
+ _doProcessBlock: function (M, offset) {
+ M[offset] ^= generateKeystreamWord.call(this);
+ },
+
+ keySize: 256/32,
+
+ ivSize: 0
+ });
+
+ function generateKeystreamWord() {
+ // Shortcuts
+ var S = this._S;
+ var i = this._i;
+ var j = this._j;
+
+ // Generate keystream word
+ var keystreamWord = 0;
+ for (var n = 0; n < 4; n++) {
+ i = (i + 1) % 256;
+ j = (j + S[i]) % 256;
+
+ // Swap
+ var t = S[i];
+ S[i] = S[j];
+ S[j] = t;
+
+ keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
+ }
+
+ // Update counters
+ this._i = i;
+ this._j = j;
+
+ return keystreamWord;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
+ */
+ C.RC4 = StreamCipher._createHelper(RC4);
+
+ /**
+ * Modified RC4 stream cipher algorithm.
+ */
+ var RC4Drop = C_algo.RC4Drop = RC4.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} drop The number of keystream words to drop. Default 192
+ */
+ cfg: RC4.cfg.extend({
+ drop: 192
+ }),
+
+ _doReset: function () {
+ RC4._doReset.call(this);
+
+ // Drop
+ for (var i = this.cfg.drop; i > 0; i--) {
+ generateKeystreamWord.call(this);
+ }
+ }
+ });
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
+ */
+ C.RC4Drop = StreamCipher._createHelper(RC4Drop);
+ }());
+
+
+ return CryptoJS.RC4;
+
+}));
+},{"./cipher-core":472,"./core":473,"./enc-base64":474,"./evpkdf":476,"./md5":481}],496:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ /** @preserve
+ (c) 2012 by Cédric Mesnil. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ (function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Constants table
+ var _zl = WordArray.create([
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
+ 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
+ 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
+ 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
+ var _zr = WordArray.create([
+ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
+ 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
+ 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
+ 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
+ 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
+ var _sl = WordArray.create([
+ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
+ 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
+ 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
+ 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
+ 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]);
+ var _sr = WordArray.create([
+ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
+ 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
+ 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
+ 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
+ 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]);
+
+ var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
+ var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
+
+ /**
+ * RIPEMD160 hash algorithm.
+ */
+ var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
+ _doReset: function () {
+ this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+
+ // Swap endian
+ for (var i = 0; i < 16; i++) {
+ // Shortcuts
+ var offset_i = offset + i;
+ var M_offset_i = M[offset_i];
+
+ // Swap
+ M[offset_i] = (
+ (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
+ (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
+ );
+ }
+ // Shortcut
+ var H = this._hash.words;
+ var hl = _hl.words;
+ var hr = _hr.words;
+ var zl = _zl.words;
+ var zr = _zr.words;
+ var sl = _sl.words;
+ var sr = _sr.words;
+
+ // Working variables
+ var al, bl, cl, dl, el;
+ var ar, br, cr, dr, er;
+
+ ar = al = H[0];
+ br = bl = H[1];
+ cr = cl = H[2];
+ dr = dl = H[3];
+ er = el = H[4];
+ // Computation
+ var t;
+ for (var i = 0; i < 80; i += 1) {
+ t = (al + M[offset+zl[i]])|0;
+ if (i<16){
+ t += f1(bl,cl,dl) + hl[0];
+ } else if (i<32) {
+ t += f2(bl,cl,dl) + hl[1];
+ } else if (i<48) {
+ t += f3(bl,cl,dl) + hl[2];
+ } else if (i<64) {
+ t += f4(bl,cl,dl) + hl[3];
+ } else {// if (i<80) {
+ t += f5(bl,cl,dl) + hl[4];
+ }
+ t = t|0;
+ t = rotl(t,sl[i]);
+ t = (t+el)|0;
+ al = el;
+ el = dl;
+ dl = rotl(cl, 10);
+ cl = bl;
+ bl = t;
+
+ t = (ar + M[offset+zr[i]])|0;
+ if (i<16){
+ t += f5(br,cr,dr) + hr[0];
+ } else if (i<32) {
+ t += f4(br,cr,dr) + hr[1];
+ } else if (i<48) {
+ t += f3(br,cr,dr) + hr[2];
+ } else if (i<64) {
+ t += f2(br,cr,dr) + hr[3];
+ } else {// if (i<80) {
+ t += f1(br,cr,dr) + hr[4];
+ }
+ t = t|0;
+ t = rotl(t,sr[i]) ;
+ t = (t+er)|0;
+ ar = er;
+ er = dr;
+ dr = rotl(cr, 10);
+ cr = br;
+ br = t;
+ }
+ // Intermediate hash value
+ t = (H[1] + cl + dr)|0;
+ H[1] = (H[2] + dl + er)|0;
+ H[2] = (H[3] + el + ar)|0;
+ H[3] = (H[4] + al + br)|0;
+ H[4] = (H[0] + bl + cr)|0;
+ H[0] = t;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
+ (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
+ (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
+ );
+ data.sigBytes = (dataWords.length + 1) * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Shortcuts
+ var hash = this._hash;
+ var H = hash.words;
+
+ // Swap endian
+ for (var i = 0; i < 5; i++) {
+ // Shortcut
+ var H_i = H[i];
+
+ // Swap
+ H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
+ (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
+ }
+
+ // Return final computed hash
+ return hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+
+ function f1(x, y, z) {
+ return ((x) ^ (y) ^ (z));
+
+ }
+
+ function f2(x, y, z) {
+ return (((x)&(y)) | ((~x)&(z)));
+ }
+
+ function f3(x, y, z) {
+ return (((x) | (~(y))) ^ (z));
+ }
+
+ function f4(x, y, z) {
+ return (((x) & (z)) | ((y)&(~(z))));
+ }
+
+ function f5(x, y, z) {
+ return ((x) ^ ((y) |(~(z))));
+
+ }
+
+ function rotl(x,n) {
+ return (x<>>(32-n));
+ }
+
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.RIPEMD160('message');
+ * var hash = CryptoJS.RIPEMD160(wordArray);
+ */
+ C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacRIPEMD160(message, key);
+ */
+ C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
+ }(Math));
+
+
+ return CryptoJS.RIPEMD160;
+
+}));
+},{"./core":473}],497:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Reusable object
+ var W = [];
+
+ /**
+ * SHA-1 hash algorithm.
+ */
+ var SHA1 = C_algo.SHA1 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init([
+ 0x67452301, 0xefcdab89,
+ 0x98badcfe, 0x10325476,
+ 0xc3d2e1f0
+ ]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var H = this._hash.words;
+
+ // Working variables
+ var a = H[0];
+ var b = H[1];
+ var c = H[2];
+ var d = H[3];
+ var e = H[4];
+
+ // Computation
+ for (var i = 0; i < 80; i++) {
+ if (i < 16) {
+ W[i] = M[offset + i] | 0;
+ } else {
+ var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
+ W[i] = (n << 1) | (n >>> 31);
+ }
+
+ var t = ((a << 5) | (a >>> 27)) + e + W[i];
+ if (i < 20) {
+ t += ((b & c) | (~b & d)) + 0x5a827999;
+ } else if (i < 40) {
+ t += (b ^ c ^ d) + 0x6ed9eba1;
+ } else if (i < 60) {
+ t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
+ } else /* if (i < 80) */ {
+ t += (b ^ c ^ d) - 0x359d3e2a;
+ }
+
+ e = d;
+ d = c;
+ c = (b << 30) | (b >>> 2);
+ b = a;
+ a = t;
+ }
+
+ // Intermediate hash value
+ H[0] = (H[0] + a) | 0;
+ H[1] = (H[1] + b) | 0;
+ H[2] = (H[2] + c) | 0;
+ H[3] = (H[3] + d) | 0;
+ H[4] = (H[4] + e) | 0;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Return final computed hash
+ return this._hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA1('message');
+ * var hash = CryptoJS.SHA1(wordArray);
+ */
+ C.SHA1 = Hasher._createHelper(SHA1);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA1(message, key);
+ */
+ C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
+ }());
+
+
+ return CryptoJS.SHA1;
+
+}));
+},{"./core":473}],498:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./sha256"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./sha256"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var C_algo = C.algo;
+ var SHA256 = C_algo.SHA256;
+
+ /**
+ * SHA-224 hash algorithm.
+ */
+ var SHA224 = C_algo.SHA224 = SHA256.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init([
+ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
+ 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
+ ]);
+ },
+
+ _doFinalize: function () {
+ var hash = SHA256._doFinalize.call(this);
+
+ hash.sigBytes -= 4;
+
+ return hash;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA224('message');
+ * var hash = CryptoJS.SHA224(wordArray);
+ */
+ C.SHA224 = SHA256._createHelper(SHA224);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA224(message, key);
+ */
+ C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
+ }());
+
+
+ return CryptoJS.SHA224;
+
+}));
+},{"./core":473,"./sha256":499}],499:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Initialization and round constants tables
+ var H = [];
+ var K = [];
+
+ // Compute constants
+ (function () {
+ function isPrime(n) {
+ var sqrtN = Math.sqrt(n);
+ for (var factor = 2; factor <= sqrtN; factor++) {
+ if (!(n % factor)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ function getFractionalBits(n) {
+ return ((n - (n | 0)) * 0x100000000) | 0;
+ }
+
+ var n = 2;
+ var nPrime = 0;
+ while (nPrime < 64) {
+ if (isPrime(n)) {
+ if (nPrime < 8) {
+ H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
+ }
+ K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
+
+ nPrime++;
+ }
+
+ n++;
+ }
+ }());
+
+ // Reusable object
+ var W = [];
+
+ /**
+ * SHA-256 hash algorithm.
+ */
+ var SHA256 = C_algo.SHA256 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init(H.slice(0));
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var H = this._hash.words;
+
+ // Working variables
+ var a = H[0];
+ var b = H[1];
+ var c = H[2];
+ var d = H[3];
+ var e = H[4];
+ var f = H[5];
+ var g = H[6];
+ var h = H[7];
+
+ // Computation
+ for (var i = 0; i < 64; i++) {
+ if (i < 16) {
+ W[i] = M[offset + i] | 0;
+ } else {
+ var gamma0x = W[i - 15];
+ var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
+ ((gamma0x << 14) | (gamma0x >>> 18)) ^
+ (gamma0x >>> 3);
+
+ var gamma1x = W[i - 2];
+ var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
+ ((gamma1x << 13) | (gamma1x >>> 19)) ^
+ (gamma1x >>> 10);
+
+ W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
+ }
+
+ var ch = (e & f) ^ (~e & g);
+ var maj = (a & b) ^ (a & c) ^ (b & c);
+
+ var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
+ var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
+
+ var t1 = h + sigma1 + ch + K[i] + W[i];
+ var t2 = sigma0 + maj;
+
+ h = g;
+ g = f;
+ f = e;
+ e = (d + t1) | 0;
+ d = c;
+ c = b;
+ b = a;
+ a = (t1 + t2) | 0;
+ }
+
+ // Intermediate hash value
+ H[0] = (H[0] + a) | 0;
+ H[1] = (H[1] + b) | 0;
+ H[2] = (H[2] + c) | 0;
+ H[3] = (H[3] + d) | 0;
+ H[4] = (H[4] + e) | 0;
+ H[5] = (H[5] + f) | 0;
+ H[6] = (H[6] + g) | 0;
+ H[7] = (H[7] + h) | 0;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Return final computed hash
+ return this._hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA256('message');
+ * var hash = CryptoJS.SHA256(wordArray);
+ */
+ C.SHA256 = Hasher._createHelper(SHA256);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA256(message, key);
+ */
+ C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
+ }(Math));
+
+
+ return CryptoJS.SHA256;
+
+}));
+},{"./core":473}],500:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./x64-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./x64-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_x64 = C.x64;
+ var X64Word = C_x64.Word;
+ var C_algo = C.algo;
+
+ // Constants tables
+ var RHO_OFFSETS = [];
+ var PI_INDEXES = [];
+ var ROUND_CONSTANTS = [];
+
+ // Compute Constants
+ (function () {
+ // Compute rho offset constants
+ var x = 1, y = 0;
+ for (var t = 0; t < 24; t++) {
+ RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
+
+ var newX = y % 5;
+ var newY = (2 * x + 3 * y) % 5;
+ x = newX;
+ y = newY;
+ }
+
+ // Compute pi index constants
+ for (var x = 0; x < 5; x++) {
+ for (var y = 0; y < 5; y++) {
+ PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
+ }
+ }
+
+ // Compute round constants
+ var LFSR = 0x01;
+ for (var i = 0; i < 24; i++) {
+ var roundConstantMsw = 0;
+ var roundConstantLsw = 0;
+
+ for (var j = 0; j < 7; j++) {
+ if (LFSR & 0x01) {
+ var bitPosition = (1 << j) - 1;
+ if (bitPosition < 32) {
+ roundConstantLsw ^= 1 << bitPosition;
+ } else /* if (bitPosition >= 32) */ {
+ roundConstantMsw ^= 1 << (bitPosition - 32);
+ }
+ }
+
+ // Compute next LFSR
+ if (LFSR & 0x80) {
+ // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
+ LFSR = (LFSR << 1) ^ 0x71;
+ } else {
+ LFSR <<= 1;
+ }
+ }
+
+ ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
+ }
+ }());
+
+ // Reusable objects for temporary values
+ var T = [];
+ (function () {
+ for (var i = 0; i < 25; i++) {
+ T[i] = X64Word.create();
+ }
+ }());
+
+ /**
+ * SHA-3 hash algorithm.
+ */
+ var SHA3 = C_algo.SHA3 = Hasher.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} outputLength
+ * The desired number of bits in the output hash.
+ * Only values permitted are: 224, 256, 384, 512.
+ * Default: 512
+ */
+ cfg: Hasher.cfg.extend({
+ outputLength: 512
+ }),
+
+ _doReset: function () {
+ var state = this._state = []
+ for (var i = 0; i < 25; i++) {
+ state[i] = new X64Word.init();
+ }
+
+ this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcuts
+ var state = this._state;
+ var nBlockSizeLanes = this.blockSize / 2;
+
+ // Absorb
+ for (var i = 0; i < nBlockSizeLanes; i++) {
+ // Shortcuts
+ var M2i = M[offset + 2 * i];
+ var M2i1 = M[offset + 2 * i + 1];
+
+ // Swap endian
+ M2i = (
+ (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
+ (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
+ );
+ M2i1 = (
+ (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
+ (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
+ );
+
+ // Absorb message into state
+ var lane = state[i];
+ lane.high ^= M2i1;
+ lane.low ^= M2i;
+ }
+
+ // Rounds
+ for (var round = 0; round < 24; round++) {
+ // Theta
+ for (var x = 0; x < 5; x++) {
+ // Mix column lanes
+ var tMsw = 0, tLsw = 0;
+ for (var y = 0; y < 5; y++) {
+ var lane = state[x + 5 * y];
+ tMsw ^= lane.high;
+ tLsw ^= lane.low;
+ }
+
+ // Temporary values
+ var Tx = T[x];
+ Tx.high = tMsw;
+ Tx.low = tLsw;
+ }
+ for (var x = 0; x < 5; x++) {
+ // Shortcuts
+ var Tx4 = T[(x + 4) % 5];
+ var Tx1 = T[(x + 1) % 5];
+ var Tx1Msw = Tx1.high;
+ var Tx1Lsw = Tx1.low;
+
+ // Mix surrounding columns
+ var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
+ var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
+ for (var y = 0; y < 5; y++) {
+ var lane = state[x + 5 * y];
+ lane.high ^= tMsw;
+ lane.low ^= tLsw;
+ }
+ }
+
+ // Rho Pi
+ for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
+ // Shortcuts
+ var lane = state[laneIndex];
+ var laneMsw = lane.high;
+ var laneLsw = lane.low;
+ var rhoOffset = RHO_OFFSETS[laneIndex];
+
+ // Rotate lanes
+ if (rhoOffset < 32) {
+ var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
+ var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
+ } else /* if (rhoOffset >= 32) */ {
+ var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
+ var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
+ }
+
+ // Transpose lanes
+ var TPiLane = T[PI_INDEXES[laneIndex]];
+ TPiLane.high = tMsw;
+ TPiLane.low = tLsw;
+ }
+
+ // Rho pi at x = y = 0
+ var T0 = T[0];
+ var state0 = state[0];
+ T0.high = state0.high;
+ T0.low = state0.low;
+
+ // Chi
+ for (var x = 0; x < 5; x++) {
+ for (var y = 0; y < 5; y++) {
+ // Shortcuts
+ var laneIndex = x + 5 * y;
+ var lane = state[laneIndex];
+ var TLane = T[laneIndex];
+ var Tx1Lane = T[((x + 1) % 5) + 5 * y];
+ var Tx2Lane = T[((x + 2) % 5) + 5 * y];
+
+ // Mix rows
+ lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
+ lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
+ }
+ }
+
+ // Iota
+ var lane = state[0];
+ var roundConstant = ROUND_CONSTANTS[round];
+ lane.high ^= roundConstant.high;
+ lane.low ^= roundConstant.low;;
+ }
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+ var blockSizeBits = this.blockSize * 32;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
+ dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Shortcuts
+ var state = this._state;
+ var outputLengthBytes = this.cfg.outputLength / 8;
+ var outputLengthLanes = outputLengthBytes / 8;
+
+ // Squeeze
+ var hashWords = [];
+ for (var i = 0; i < outputLengthLanes; i++) {
+ // Shortcuts
+ var lane = state[i];
+ var laneMsw = lane.high;
+ var laneLsw = lane.low;
+
+ // Swap endian
+ laneMsw = (
+ (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
+ (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
+ );
+ laneLsw = (
+ (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
+ (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
+ );
+
+ // Squeeze state to retrieve hash
+ hashWords.push(laneLsw);
+ hashWords.push(laneMsw);
+ }
+
+ // Return final computed hash
+ return new WordArray.init(hashWords, outputLengthBytes);
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+
+ var state = clone._state = this._state.slice(0);
+ for (var i = 0; i < 25; i++) {
+ state[i] = state[i].clone();
+ }
+
+ return clone;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA3('message');
+ * var hash = CryptoJS.SHA3(wordArray);
+ */
+ C.SHA3 = Hasher._createHelper(SHA3);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA3(message, key);
+ */
+ C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
+ }(Math));
+
+
+ return CryptoJS.SHA3;
+
+}));
+},{"./core":473,"./x64-core":504}],501:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./x64-core", "./sha512"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_x64 = C.x64;
+ var X64Word = C_x64.Word;
+ var X64WordArray = C_x64.WordArray;
+ var C_algo = C.algo;
+ var SHA512 = C_algo.SHA512;
+
+ /**
+ * SHA-384 hash algorithm.
+ */
+ var SHA384 = C_algo.SHA384 = SHA512.extend({
+ _doReset: function () {
+ this._hash = new X64WordArray.init([
+ new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
+ new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
+ new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
+ new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
+ ]);
+ },
+
+ _doFinalize: function () {
+ var hash = SHA512._doFinalize.call(this);
+
+ hash.sigBytes -= 16;
+
+ return hash;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA384('message');
+ * var hash = CryptoJS.SHA384(wordArray);
+ */
+ C.SHA384 = SHA512._createHelper(SHA384);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA384(message, key);
+ */
+ C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
+ }());
+
+
+ return CryptoJS.SHA384;
+
+}));
+},{"./core":473,"./sha512":502,"./x64-core":504}],502:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./x64-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./x64-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Hasher = C_lib.Hasher;
+ var C_x64 = C.x64;
+ var X64Word = C_x64.Word;
+ var X64WordArray = C_x64.WordArray;
+ var C_algo = C.algo;
+
+ function X64Word_create() {
+ return X64Word.create.apply(X64Word, arguments);
+ }
+
+ // Constants
+ var K = [
+ X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
+ X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
+ X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
+ X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
+ X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
+ X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
+ X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
+ X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
+ X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
+ X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
+ X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
+ X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
+ X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
+ X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
+ X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
+ X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
+ X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
+ X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
+ X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
+ X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
+ X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
+ X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
+ X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
+ X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
+ X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
+ X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
+ X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
+ X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
+ X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
+ X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
+ X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
+ X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
+ X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
+ X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
+ X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
+ X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
+ X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
+ X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
+ X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
+ X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
+ ];
+
+ // Reusable objects
+ var W = [];
+ (function () {
+ for (var i = 0; i < 80; i++) {
+ W[i] = X64Word_create();
+ }
+ }());
+
+ /**
+ * SHA-512 hash algorithm.
+ */
+ var SHA512 = C_algo.SHA512 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new X64WordArray.init([
+ new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
+ new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
+ new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
+ new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
+ ]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcuts
+ var H = this._hash.words;
+
+ var H0 = H[0];
+ var H1 = H[1];
+ var H2 = H[2];
+ var H3 = H[3];
+ var H4 = H[4];
+ var H5 = H[5];
+ var H6 = H[6];
+ var H7 = H[7];
+
+ var H0h = H0.high;
+ var H0l = H0.low;
+ var H1h = H1.high;
+ var H1l = H1.low;
+ var H2h = H2.high;
+ var H2l = H2.low;
+ var H3h = H3.high;
+ var H3l = H3.low;
+ var H4h = H4.high;
+ var H4l = H4.low;
+ var H5h = H5.high;
+ var H5l = H5.low;
+ var H6h = H6.high;
+ var H6l = H6.low;
+ var H7h = H7.high;
+ var H7l = H7.low;
+
+ // Working variables
+ var ah = H0h;
+ var al = H0l;
+ var bh = H1h;
+ var bl = H1l;
+ var ch = H2h;
+ var cl = H2l;
+ var dh = H3h;
+ var dl = H3l;
+ var eh = H4h;
+ var el = H4l;
+ var fh = H5h;
+ var fl = H5l;
+ var gh = H6h;
+ var gl = H6l;
+ var hh = H7h;
+ var hl = H7l;
+
+ // Rounds
+ for (var i = 0; i < 80; i++) {
+ // Shortcut
+ var Wi = W[i];
+
+ // Extend message
+ if (i < 16) {
+ var Wih = Wi.high = M[offset + i * 2] | 0;
+ var Wil = Wi.low = M[offset + i * 2 + 1] | 0;
+ } else {
+ // Gamma0
+ var gamma0x = W[i - 15];
+ var gamma0xh = gamma0x.high;
+ var gamma0xl = gamma0x.low;
+ var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
+ var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
+
+ // Gamma1
+ var gamma1x = W[i - 2];
+ var gamma1xh = gamma1x.high;
+ var gamma1xl = gamma1x.low;
+ var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
+ var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
+
+ // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
+ var Wi7 = W[i - 7];
+ var Wi7h = Wi7.high;
+ var Wi7l = Wi7.low;
+
+ var Wi16 = W[i - 16];
+ var Wi16h = Wi16.high;
+ var Wi16l = Wi16.low;
+
+ var Wil = gamma0l + Wi7l;
+ var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
+ var Wil = Wil + gamma1l;
+ var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
+ var Wil = Wil + Wi16l;
+ var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
+
+ Wi.high = Wih;
+ Wi.low = Wil;
+ }
+
+ var chh = (eh & fh) ^ (~eh & gh);
+ var chl = (el & fl) ^ (~el & gl);
+ var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
+ var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
+
+ var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
+ var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
+ var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
+ var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
+
+ // t1 = h + sigma1 + ch + K[i] + W[i]
+ var Ki = K[i];
+ var Kih = Ki.high;
+ var Kil = Ki.low;
+
+ var t1l = hl + sigma1l;
+ var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
+ var t1l = t1l + chl;
+ var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
+ var t1l = t1l + Kil;
+ var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
+ var t1l = t1l + Wil;
+ var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
+
+ // t2 = sigma0 + maj
+ var t2l = sigma0l + majl;
+ var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
+
+ // Update working variables
+ hh = gh;
+ hl = gl;
+ gh = fh;
+ gl = fl;
+ fh = eh;
+ fl = el;
+ el = (dl + t1l) | 0;
+ eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
+ dh = ch;
+ dl = cl;
+ ch = bh;
+ cl = bl;
+ bh = ah;
+ bl = al;
+ al = (t1l + t2l) | 0;
+ ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
+ }
+
+ // Intermediate hash value
+ H0l = H0.low = (H0l + al);
+ H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
+ H1l = H1.low = (H1l + bl);
+ H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
+ H2l = H2.low = (H2l + cl);
+ H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
+ H3l = H3.low = (H3l + dl);
+ H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
+ H4l = H4.low = (H4l + el);
+ H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
+ H5l = H5.low = (H5l + fl);
+ H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
+ H6l = H6.low = (H6l + gl);
+ H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
+ H7l = H7.low = (H7l + hl);
+ H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
+ dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Convert hash to 32-bit word array before returning
+ var hash = this._hash.toX32();
+
+ // Return final computed hash
+ return hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ },
+
+ blockSize: 1024/32
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA512('message');
+ * var hash = CryptoJS.SHA512(wordArray);
+ */
+ C.SHA512 = Hasher._createHelper(SHA512);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA512(message, key);
+ */
+ C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
+ }());
+
+
+ return CryptoJS.SHA512;
+
+}));
+},{"./core":473,"./x64-core":504}],503:[function(require,module,exports){
+;(function (root, factory, undef) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var BlockCipher = C_lib.BlockCipher;
+ var C_algo = C.algo;
+
+ // Permuted Choice 1 constants
+ var PC1 = [
+ 57, 49, 41, 33, 25, 17, 9, 1,
+ 58, 50, 42, 34, 26, 18, 10, 2,
+ 59, 51, 43, 35, 27, 19, 11, 3,
+ 60, 52, 44, 36, 63, 55, 47, 39,
+ 31, 23, 15, 7, 62, 54, 46, 38,
+ 30, 22, 14, 6, 61, 53, 45, 37,
+ 29, 21, 13, 5, 28, 20, 12, 4
+ ];
+
+ // Permuted Choice 2 constants
+ var PC2 = [
+ 14, 17, 11, 24, 1, 5,
+ 3, 28, 15, 6, 21, 10,
+ 23, 19, 12, 4, 26, 8,
+ 16, 7, 27, 20, 13, 2,
+ 41, 52, 31, 37, 47, 55,
+ 30, 40, 51, 45, 33, 48,
+ 44, 49, 39, 56, 34, 53,
+ 46, 42, 50, 36, 29, 32
+ ];
+
+ // Cumulative bit shift constants
+ var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
+
+ // SBOXes and round permutation constants
+ var SBOX_P = [
+ {
+ 0x0: 0x808200,
+ 0x10000000: 0x8000,
+ 0x20000000: 0x808002,
+ 0x30000000: 0x2,
+ 0x40000000: 0x200,
+ 0x50000000: 0x808202,
+ 0x60000000: 0x800202,
+ 0x70000000: 0x800000,
+ 0x80000000: 0x202,
+ 0x90000000: 0x800200,
+ 0xa0000000: 0x8200,
+ 0xb0000000: 0x808000,
+ 0xc0000000: 0x8002,
+ 0xd0000000: 0x800002,
+ 0xe0000000: 0x0,
+ 0xf0000000: 0x8202,
+ 0x8000000: 0x0,
+ 0x18000000: 0x808202,
+ 0x28000000: 0x8202,
+ 0x38000000: 0x8000,
+ 0x48000000: 0x808200,
+ 0x58000000: 0x200,
+ 0x68000000: 0x808002,
+ 0x78000000: 0x2,
+ 0x88000000: 0x800200,
+ 0x98000000: 0x8200,
+ 0xa8000000: 0x808000,
+ 0xb8000000: 0x800202,
+ 0xc8000000: 0x800002,
+ 0xd8000000: 0x8002,
+ 0xe8000000: 0x202,
+ 0xf8000000: 0x800000,
+ 0x1: 0x8000,
+ 0x10000001: 0x2,
+ 0x20000001: 0x808200,
+ 0x30000001: 0x800000,
+ 0x40000001: 0x808002,
+ 0x50000001: 0x8200,
+ 0x60000001: 0x200,
+ 0x70000001: 0x800202,
+ 0x80000001: 0x808202,
+ 0x90000001: 0x808000,
+ 0xa0000001: 0x800002,
+ 0xb0000001: 0x8202,
+ 0xc0000001: 0x202,
+ 0xd0000001: 0x800200,
+ 0xe0000001: 0x8002,
+ 0xf0000001: 0x0,
+ 0x8000001: 0x808202,
+ 0x18000001: 0x808000,
+ 0x28000001: 0x800000,
+ 0x38000001: 0x200,
+ 0x48000001: 0x8000,
+ 0x58000001: 0x800002,
+ 0x68000001: 0x2,
+ 0x78000001: 0x8202,
+ 0x88000001: 0x8002,
+ 0x98000001: 0x800202,
+ 0xa8000001: 0x202,
+ 0xb8000001: 0x808200,
+ 0xc8000001: 0x800200,
+ 0xd8000001: 0x0,
+ 0xe8000001: 0x8200,
+ 0xf8000001: 0x808002
+ },
+ {
+ 0x0: 0x40084010,
+ 0x1000000: 0x4000,
+ 0x2000000: 0x80000,
+ 0x3000000: 0x40080010,
+ 0x4000000: 0x40000010,
+ 0x5000000: 0x40084000,
+ 0x6000000: 0x40004000,
+ 0x7000000: 0x10,
+ 0x8000000: 0x84000,
+ 0x9000000: 0x40004010,
+ 0xa000000: 0x40000000,
+ 0xb000000: 0x84010,
+ 0xc000000: 0x80010,
+ 0xd000000: 0x0,
+ 0xe000000: 0x4010,
+ 0xf000000: 0x40080000,
+ 0x800000: 0x40004000,
+ 0x1800000: 0x84010,
+ 0x2800000: 0x10,
+ 0x3800000: 0x40004010,
+ 0x4800000: 0x40084010,
+ 0x5800000: 0x40000000,
+ 0x6800000: 0x80000,
+ 0x7800000: 0x40080010,
+ 0x8800000: 0x80010,
+ 0x9800000: 0x0,
+ 0xa800000: 0x4000,
+ 0xb800000: 0x40080000,
+ 0xc800000: 0x40000010,
+ 0xd800000: 0x84000,
+ 0xe800000: 0x40084000,
+ 0xf800000: 0x4010,
+ 0x10000000: 0x0,
+ 0x11000000: 0x40080010,
+ 0x12000000: 0x40004010,
+ 0x13000000: 0x40084000,
+ 0x14000000: 0x40080000,
+ 0x15000000: 0x10,
+ 0x16000000: 0x84010,
+ 0x17000000: 0x4000,
+ 0x18000000: 0x4010,
+ 0x19000000: 0x80000,
+ 0x1a000000: 0x80010,
+ 0x1b000000: 0x40000010,
+ 0x1c000000: 0x84000,
+ 0x1d000000: 0x40004000,
+ 0x1e000000: 0x40000000,
+ 0x1f000000: 0x40084010,
+ 0x10800000: 0x84010,
+ 0x11800000: 0x80000,
+ 0x12800000: 0x40080000,
+ 0x13800000: 0x4000,
+ 0x14800000: 0x40004000,
+ 0x15800000: 0x40084010,
+ 0x16800000: 0x10,
+ 0x17800000: 0x40000000,
+ 0x18800000: 0x40084000,
+ 0x19800000: 0x40000010,
+ 0x1a800000: 0x40004010,
+ 0x1b800000: 0x80010,
+ 0x1c800000: 0x0,
+ 0x1d800000: 0x4010,
+ 0x1e800000: 0x40080010,
+ 0x1f800000: 0x84000
+ },
+ {
+ 0x0: 0x104,
+ 0x100000: 0x0,
+ 0x200000: 0x4000100,
+ 0x300000: 0x10104,
+ 0x400000: 0x10004,
+ 0x500000: 0x4000004,
+ 0x600000: 0x4010104,
+ 0x700000: 0x4010000,
+ 0x800000: 0x4000000,
+ 0x900000: 0x4010100,
+ 0xa00000: 0x10100,
+ 0xb00000: 0x4010004,
+ 0xc00000: 0x4000104,
+ 0xd00000: 0x10000,
+ 0xe00000: 0x4,
+ 0xf00000: 0x100,
+ 0x80000: 0x4010100,
+ 0x180000: 0x4010004,
+ 0x280000: 0x0,
+ 0x380000: 0x4000100,
+ 0x480000: 0x4000004,
+ 0x580000: 0x10000,
+ 0x680000: 0x10004,
+ 0x780000: 0x104,
+ 0x880000: 0x4,
+ 0x980000: 0x100,
+ 0xa80000: 0x4010000,
+ 0xb80000: 0x10104,
+ 0xc80000: 0x10100,
+ 0xd80000: 0x4000104,
+ 0xe80000: 0x4010104,
+ 0xf80000: 0x4000000,
+ 0x1000000: 0x4010100,
+ 0x1100000: 0x10004,
+ 0x1200000: 0x10000,
+ 0x1300000: 0x4000100,
+ 0x1400000: 0x100,
+ 0x1500000: 0x4010104,
+ 0x1600000: 0x4000004,
+ 0x1700000: 0x0,
+ 0x1800000: 0x4000104,
+ 0x1900000: 0x4000000,
+ 0x1a00000: 0x4,
+ 0x1b00000: 0x10100,
+ 0x1c00000: 0x4010000,
+ 0x1d00000: 0x104,
+ 0x1e00000: 0x10104,
+ 0x1f00000: 0x4010004,
+ 0x1080000: 0x4000000,
+ 0x1180000: 0x104,
+ 0x1280000: 0x4010100,
+ 0x1380000: 0x0,
+ 0x1480000: 0x10004,
+ 0x1580000: 0x4000100,
+ 0x1680000: 0x100,
+ 0x1780000: 0x4010004,
+ 0x1880000: 0x10000,
+ 0x1980000: 0x4010104,
+ 0x1a80000: 0x10104,
+ 0x1b80000: 0x4000004,
+ 0x1c80000: 0x4000104,
+ 0x1d80000: 0x4010000,
+ 0x1e80000: 0x4,
+ 0x1f80000: 0x10100
+ },
+ {
+ 0x0: 0x80401000,
+ 0x10000: 0x80001040,
+ 0x20000: 0x401040,
+ 0x30000: 0x80400000,
+ 0x40000: 0x0,
+ 0x50000: 0x401000,
+ 0x60000: 0x80000040,
+ 0x70000: 0x400040,
+ 0x80000: 0x80000000,
+ 0x90000: 0x400000,
+ 0xa0000: 0x40,
+ 0xb0000: 0x80001000,
+ 0xc0000: 0x80400040,
+ 0xd0000: 0x1040,
+ 0xe0000: 0x1000,
+ 0xf0000: 0x80401040,
+ 0x8000: 0x80001040,
+ 0x18000: 0x40,
+ 0x28000: 0x80400040,
+ 0x38000: 0x80001000,
+ 0x48000: 0x401000,
+ 0x58000: 0x80401040,
+ 0x68000: 0x0,
+ 0x78000: 0x80400000,
+ 0x88000: 0x1000,
+ 0x98000: 0x80401000,
+ 0xa8000: 0x400000,
+ 0xb8000: 0x1040,
+ 0xc8000: 0x80000000,
+ 0xd8000: 0x400040,
+ 0xe8000: 0x401040,
+ 0xf8000: 0x80000040,
+ 0x100000: 0x400040,
+ 0x110000: 0x401000,
+ 0x120000: 0x80000040,
+ 0x130000: 0x0,
+ 0x140000: 0x1040,
+ 0x150000: 0x80400040,
+ 0x160000: 0x80401000,
+ 0x170000: 0x80001040,
+ 0x180000: 0x80401040,
+ 0x190000: 0x80000000,
+ 0x1a0000: 0x80400000,
+ 0x1b0000: 0x401040,
+ 0x1c0000: 0x80001000,
+ 0x1d0000: 0x400000,
+ 0x1e0000: 0x40,
+ 0x1f0000: 0x1000,
+ 0x108000: 0x80400000,
+ 0x118000: 0x80401040,
+ 0x128000: 0x0,
+ 0x138000: 0x401000,
+ 0x148000: 0x400040,
+ 0x158000: 0x80000000,
+ 0x168000: 0x80001040,
+ 0x178000: 0x40,
+ 0x188000: 0x80000040,
+ 0x198000: 0x1000,
+ 0x1a8000: 0x80001000,
+ 0x1b8000: 0x80400040,
+ 0x1c8000: 0x1040,
+ 0x1d8000: 0x80401000,
+ 0x1e8000: 0x400000,
+ 0x1f8000: 0x401040
+ },
+ {
+ 0x0: 0x80,
+ 0x1000: 0x1040000,
+ 0x2000: 0x40000,
+ 0x3000: 0x20000000,
+ 0x4000: 0x20040080,
+ 0x5000: 0x1000080,
+ 0x6000: 0x21000080,
+ 0x7000: 0x40080,
+ 0x8000: 0x1000000,
+ 0x9000: 0x20040000,
+ 0xa000: 0x20000080,
+ 0xb000: 0x21040080,
+ 0xc000: 0x21040000,
+ 0xd000: 0x0,
+ 0xe000: 0x1040080,
+ 0xf000: 0x21000000,
+ 0x800: 0x1040080,
+ 0x1800: 0x21000080,
+ 0x2800: 0x80,
+ 0x3800: 0x1040000,
+ 0x4800: 0x40000,
+ 0x5800: 0x20040080,
+ 0x6800: 0x21040000,
+ 0x7800: 0x20000000,
+ 0x8800: 0x20040000,
+ 0x9800: 0x0,
+ 0xa800: 0x21040080,
+ 0xb800: 0x1000080,
+ 0xc800: 0x20000080,
+ 0xd800: 0x21000000,
+ 0xe800: 0x1000000,
+ 0xf800: 0x40080,
+ 0x10000: 0x40000,
+ 0x11000: 0x80,
+ 0x12000: 0x20000000,
+ 0x13000: 0x21000080,
+ 0x14000: 0x1000080,
+ 0x15000: 0x21040000,
+ 0x16000: 0x20040080,
+ 0x17000: 0x1000000,
+ 0x18000: 0x21040080,
+ 0x19000: 0x21000000,
+ 0x1a000: 0x1040000,
+ 0x1b000: 0x20040000,
+ 0x1c000: 0x40080,
+ 0x1d000: 0x20000080,
+ 0x1e000: 0x0,
+ 0x1f000: 0x1040080,
+ 0x10800: 0x21000080,
+ 0x11800: 0x1000000,
+ 0x12800: 0x1040000,
+ 0x13800: 0x20040080,
+ 0x14800: 0x20000000,
+ 0x15800: 0x1040080,
+ 0x16800: 0x80,
+ 0x17800: 0x21040000,
+ 0x18800: 0x40080,
+ 0x19800: 0x21040080,
+ 0x1a800: 0x0,
+ 0x1b800: 0x21000000,
+ 0x1c800: 0x1000080,
+ 0x1d800: 0x40000,
+ 0x1e800: 0x20040000,
+ 0x1f800: 0x20000080
+ },
+ {
+ 0x0: 0x10000008,
+ 0x100: 0x2000,
+ 0x200: 0x10200000,
+ 0x300: 0x10202008,
+ 0x400: 0x10002000,
+ 0x500: 0x200000,
+ 0x600: 0x200008,
+ 0x700: 0x10000000,
+ 0x800: 0x0,
+ 0x900: 0x10002008,
+ 0xa00: 0x202000,
+ 0xb00: 0x8,
+ 0xc00: 0x10200008,
+ 0xd00: 0x202008,
+ 0xe00: 0x2008,
+ 0xf00: 0x10202000,
+ 0x80: 0x10200000,
+ 0x180: 0x10202008,
+ 0x280: 0x8,
+ 0x380: 0x200000,
+ 0x480: 0x202008,
+ 0x580: 0x10000008,
+ 0x680: 0x10002000,
+ 0x780: 0x2008,
+ 0x880: 0x200008,
+ 0x980: 0x2000,
+ 0xa80: 0x10002008,
+ 0xb80: 0x10200008,
+ 0xc80: 0x0,
+ 0xd80: 0x10202000,
+ 0xe80: 0x202000,
+ 0xf80: 0x10000000,
+ 0x1000: 0x10002000,
+ 0x1100: 0x10200008,
+ 0x1200: 0x10202008,
+ 0x1300: 0x2008,
+ 0x1400: 0x200000,
+ 0x1500: 0x10000000,
+ 0x1600: 0x10000008,
+ 0x1700: 0x202000,
+ 0x1800: 0x202008,
+ 0x1900: 0x0,
+ 0x1a00: 0x8,
+ 0x1b00: 0x10200000,
+ 0x1c00: 0x2000,
+ 0x1d00: 0x10002008,
+ 0x1e00: 0x10202000,
+ 0x1f00: 0x200008,
+ 0x1080: 0x8,
+ 0x1180: 0x202000,
+ 0x1280: 0x200000,
+ 0x1380: 0x10000008,
+ 0x1480: 0x10002000,
+ 0x1580: 0x2008,
+ 0x1680: 0x10202008,
+ 0x1780: 0x10200000,
+ 0x1880: 0x10202000,
+ 0x1980: 0x10200008,
+ 0x1a80: 0x2000,
+ 0x1b80: 0x202008,
+ 0x1c80: 0x200008,
+ 0x1d80: 0x0,
+ 0x1e80: 0x10000000,
+ 0x1f80: 0x10002008
+ },
+ {
+ 0x0: 0x100000,
+ 0x10: 0x2000401,
+ 0x20: 0x400,
+ 0x30: 0x100401,
+ 0x40: 0x2100401,
+ 0x50: 0x0,
+ 0x60: 0x1,
+ 0x70: 0x2100001,
+ 0x80: 0x2000400,
+ 0x90: 0x100001,
+ 0xa0: 0x2000001,
+ 0xb0: 0x2100400,
+ 0xc0: 0x2100000,
+ 0xd0: 0x401,
+ 0xe0: 0x100400,
+ 0xf0: 0x2000000,
+ 0x8: 0x2100001,
+ 0x18: 0x0,
+ 0x28: 0x2000401,
+ 0x38: 0x2100400,
+ 0x48: 0x100000,
+ 0x58: 0x2000001,
+ 0x68: 0x2000000,
+ 0x78: 0x401,
+ 0x88: 0x100401,
+ 0x98: 0x2000400,
+ 0xa8: 0x2100000,
+ 0xb8: 0x100001,
+ 0xc8: 0x400,
+ 0xd8: 0x2100401,
+ 0xe8: 0x1,
+ 0xf8: 0x100400,
+ 0x100: 0x2000000,
+ 0x110: 0x100000,
+ 0x120: 0x2000401,
+ 0x130: 0x2100001,
+ 0x140: 0x100001,
+ 0x150: 0x2000400,
+ 0x160: 0x2100400,
+ 0x170: 0x100401,
+ 0x180: 0x401,
+ 0x190: 0x2100401,
+ 0x1a0: 0x100400,
+ 0x1b0: 0x1,
+ 0x1c0: 0x0,
+ 0x1d0: 0x2100000,
+ 0x1e0: 0x2000001,
+ 0x1f0: 0x400,
+ 0x108: 0x100400,
+ 0x118: 0x2000401,
+ 0x128: 0x2100001,
+ 0x138: 0x1,
+ 0x148: 0x2000000,
+ 0x158: 0x100000,
+ 0x168: 0x401,
+ 0x178: 0x2100400,
+ 0x188: 0x2000001,
+ 0x198: 0x2100000,
+ 0x1a8: 0x0,
+ 0x1b8: 0x2100401,
+ 0x1c8: 0x100401,
+ 0x1d8: 0x400,
+ 0x1e8: 0x2000400,
+ 0x1f8: 0x100001
+ },
+ {
+ 0x0: 0x8000820,
+ 0x1: 0x20000,
+ 0x2: 0x8000000,
+ 0x3: 0x20,
+ 0x4: 0x20020,
+ 0x5: 0x8020820,
+ 0x6: 0x8020800,
+ 0x7: 0x800,
+ 0x8: 0x8020000,
+ 0x9: 0x8000800,
+ 0xa: 0x20800,
+ 0xb: 0x8020020,
+ 0xc: 0x820,
+ 0xd: 0x0,
+ 0xe: 0x8000020,
+ 0xf: 0x20820,
+ 0x80000000: 0x800,
+ 0x80000001: 0x8020820,
+ 0x80000002: 0x8000820,
+ 0x80000003: 0x8000000,
+ 0x80000004: 0x8020000,
+ 0x80000005: 0x20800,
+ 0x80000006: 0x20820,
+ 0x80000007: 0x20,
+ 0x80000008: 0x8000020,
+ 0x80000009: 0x820,
+ 0x8000000a: 0x20020,
+ 0x8000000b: 0x8020800,
+ 0x8000000c: 0x0,
+ 0x8000000d: 0x8020020,
+ 0x8000000e: 0x8000800,
+ 0x8000000f: 0x20000,
+ 0x10: 0x20820,
+ 0x11: 0x8020800,
+ 0x12: 0x20,
+ 0x13: 0x800,
+ 0x14: 0x8000800,
+ 0x15: 0x8000020,
+ 0x16: 0x8020020,
+ 0x17: 0x20000,
+ 0x18: 0x0,
+ 0x19: 0x20020,
+ 0x1a: 0x8020000,
+ 0x1b: 0x8000820,
+ 0x1c: 0x8020820,
+ 0x1d: 0x20800,
+ 0x1e: 0x820,
+ 0x1f: 0x8000000,
+ 0x80000010: 0x20000,
+ 0x80000011: 0x800,
+ 0x80000012: 0x8020020,
+ 0x80000013: 0x20820,
+ 0x80000014: 0x20,
+ 0x80000015: 0x8020000,
+ 0x80000016: 0x8000000,
+ 0x80000017: 0x8000820,
+ 0x80000018: 0x8020820,
+ 0x80000019: 0x8000020,
+ 0x8000001a: 0x8000800,
+ 0x8000001b: 0x0,
+ 0x8000001c: 0x20800,
+ 0x8000001d: 0x820,
+ 0x8000001e: 0x20020,
+ 0x8000001f: 0x8020800
+ }
+ ];
+
+ // Masks that select the SBOX input
+ var SBOX_MASK = [
+ 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
+ 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
+ ];
+
+ /**
+ * DES block cipher algorithm.
+ */
+ var DES = C_algo.DES = BlockCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var key = this._key;
+ var keyWords = key.words;
+
+ // Select 56 bits according to PC1
+ var keyBits = [];
+ for (var i = 0; i < 56; i++) {
+ var keyBitPos = PC1[i] - 1;
+ keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
+ }
+
+ // Assemble 16 subkeys
+ var subKeys = this._subKeys = [];
+ for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
+ // Create subkey
+ var subKey = subKeys[nSubKey] = [];
+
+ // Shortcut
+ var bitShift = BIT_SHIFTS[nSubKey];
+
+ // Select 48 bits according to PC2
+ for (var i = 0; i < 24; i++) {
+ // Select from the left 28 key bits
+ subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
+
+ // Select from the right 28 key bits
+ subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
+ }
+
+ // Since each subkey is applied to an expanded 32-bit input,
+ // the subkey can be broken into 8 values scaled to 32-bits,
+ // which allows the key to be used without expansion
+ subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
+ for (var i = 1; i < 7; i++) {
+ subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
+ }
+ subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
+ }
+
+ // Compute inverse subkeys
+ var invSubKeys = this._invSubKeys = [];
+ for (var i = 0; i < 16; i++) {
+ invSubKeys[i] = subKeys[15 - i];
+ }
+ },
+
+ encryptBlock: function (M, offset) {
+ this._doCryptBlock(M, offset, this._subKeys);
+ },
+
+ decryptBlock: function (M, offset) {
+ this._doCryptBlock(M, offset, this._invSubKeys);
+ },
+
+ _doCryptBlock: function (M, offset, subKeys) {
+ // Get input
+ this._lBlock = M[offset];
+ this._rBlock = M[offset + 1];
+
+ // Initial permutation
+ exchangeLR.call(this, 4, 0x0f0f0f0f);
+ exchangeLR.call(this, 16, 0x0000ffff);
+ exchangeRL.call(this, 2, 0x33333333);
+ exchangeRL.call(this, 8, 0x00ff00ff);
+ exchangeLR.call(this, 1, 0x55555555);
+
+ // Rounds
+ for (var round = 0; round < 16; round++) {
+ // Shortcuts
+ var subKey = subKeys[round];
+ var lBlock = this._lBlock;
+ var rBlock = this._rBlock;
+
+ // Feistel function
+ var f = 0;
+ for (var i = 0; i < 8; i++) {
+ f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
+ }
+ this._lBlock = rBlock;
+ this._rBlock = lBlock ^ f;
+ }
+
+ // Undo swap from last round
+ var t = this._lBlock;
+ this._lBlock = this._rBlock;
+ this._rBlock = t;
+
+ // Final permutation
+ exchangeLR.call(this, 1, 0x55555555);
+ exchangeRL.call(this, 8, 0x00ff00ff);
+ exchangeRL.call(this, 2, 0x33333333);
+ exchangeLR.call(this, 16, 0x0000ffff);
+ exchangeLR.call(this, 4, 0x0f0f0f0f);
+
+ // Set output
+ M[offset] = this._lBlock;
+ M[offset + 1] = this._rBlock;
+ },
+
+ keySize: 64/32,
+
+ ivSize: 64/32,
+
+ blockSize: 64/32
+ });
+
+ // Swap bits across the left and right words
+ function exchangeLR(offset, mask) {
+ var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
+ this._rBlock ^= t;
+ this._lBlock ^= t << offset;
+ }
+
+ function exchangeRL(offset, mask) {
+ var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
+ this._lBlock ^= t;
+ this._rBlock ^= t << offset;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
+ */
+ C.DES = BlockCipher._createHelper(DES);
+
+ /**
+ * Triple-DES block cipher algorithm.
+ */
+ var TripleDES = C_algo.TripleDES = BlockCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var key = this._key;
+ var keyWords = key.words;
+
+ // Create DES instances
+ this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2)));
+ this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4)));
+ this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6)));
+ },
+
+ encryptBlock: function (M, offset) {
+ this._des1.encryptBlock(M, offset);
+ this._des2.decryptBlock(M, offset);
+ this._des3.encryptBlock(M, offset);
+ },
+
+ decryptBlock: function (M, offset) {
+ this._des3.decryptBlock(M, offset);
+ this._des2.encryptBlock(M, offset);
+ this._des1.decryptBlock(M, offset);
+ },
+
+ keySize: 192/32,
+
+ ivSize: 64/32,
+
+ blockSize: 64/32
+ });
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
+ */
+ C.TripleDES = BlockCipher._createHelper(TripleDES);
+ }());
+
+
+ return CryptoJS.TripleDES;
+
+}));
+},{"./cipher-core":472,"./core":473,"./enc-base64":474,"./evpkdf":476,"./md5":481}],504:[function(require,module,exports){
+;(function (root, factory) {
+ if (typeof exports === "object") {
+ // CommonJS
+ module.exports = exports = factory(require("./core"));
+ }
+ else if (typeof define === "function" && define.amd) {
+ // AMD
+ define(["./core"], factory);
+ }
+ else {
+ // Global (browser)
+ factory(root.CryptoJS);
+ }
+}(this, function (CryptoJS) {
+
+ (function (undefined) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var X32WordArray = C_lib.WordArray;
+
+ /**
+ * x64 namespace.
+ */
+ var C_x64 = C.x64 = {};
+
+ /**
+ * A 64-bit word.
+ */
+ var X64Word = C_x64.Word = Base.extend({
+ /**
+ * Initializes a newly created 64-bit word.
+ *
+ * @param {number} high The high 32 bits.
+ * @param {number} low The low 32 bits.
+ *
+ * @example
+ *
+ * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
+ */
+ init: function (high, low) {
+ this.high = high;
+ this.low = low;
+ }
+
+ /**
+ * Bitwise NOTs this word.
+ *
+ * @return {X64Word} A new x64-Word object after negating.
+ *
+ * @example
+ *
+ * var negated = x64Word.not();
+ */
+ // not: function () {
+ // var high = ~this.high;
+ // var low = ~this.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Bitwise ANDs this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to AND with this word.
+ *
+ * @return {X64Word} A new x64-Word object after ANDing.
+ *
+ * @example
+ *
+ * var anded = x64Word.and(anotherX64Word);
+ */
+ // and: function (word) {
+ // var high = this.high & word.high;
+ // var low = this.low & word.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Bitwise ORs this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to OR with this word.
+ *
+ * @return {X64Word} A new x64-Word object after ORing.
+ *
+ * @example
+ *
+ * var ored = x64Word.or(anotherX64Word);
+ */
+ // or: function (word) {
+ // var high = this.high | word.high;
+ // var low = this.low | word.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Bitwise XORs this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to XOR with this word.
+ *
+ * @return {X64Word} A new x64-Word object after XORing.
+ *
+ * @example
+ *
+ * var xored = x64Word.xor(anotherX64Word);
+ */
+ // xor: function (word) {
+ // var high = this.high ^ word.high;
+ // var low = this.low ^ word.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Shifts this word n bits to the left.
+ *
+ * @param {number} n The number of bits to shift.
+ *
+ * @return {X64Word} A new x64-Word object after shifting.
+ *
+ * @example
+ *
+ * var shifted = x64Word.shiftL(25);
+ */
+ // shiftL: function (n) {
+ // if (n < 32) {
+ // var high = (this.high << n) | (this.low >>> (32 - n));
+ // var low = this.low << n;
+ // } else {
+ // var high = this.low << (n - 32);
+ // var low = 0;
+ // }
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Shifts this word n bits to the right.
+ *
+ * @param {number} n The number of bits to shift.
+ *
+ * @return {X64Word} A new x64-Word object after shifting.
+ *
+ * @example
+ *
+ * var shifted = x64Word.shiftR(7);
+ */
+ // shiftR: function (n) {
+ // if (n < 32) {
+ // var low = (this.low >>> n) | (this.high << (32 - n));
+ // var high = this.high >>> n;
+ // } else {
+ // var low = this.high >>> (n - 32);
+ // var high = 0;
+ // }
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Rotates this word n bits to the left.
+ *
+ * @param {number} n The number of bits to rotate.
+ *
+ * @return {X64Word} A new x64-Word object after rotating.
+ *
+ * @example
+ *
+ * var rotated = x64Word.rotL(25);
+ */
+ // rotL: function (n) {
+ // return this.shiftL(n).or(this.shiftR(64 - n));
+ // },
+
+ /**
+ * Rotates this word n bits to the right.
+ *
+ * @param {number} n The number of bits to rotate.
+ *
+ * @return {X64Word} A new x64-Word object after rotating.
+ *
+ * @example
+ *
+ * var rotated = x64Word.rotR(7);
+ */
+ // rotR: function (n) {
+ // return this.shiftR(n).or(this.shiftL(64 - n));
+ // },
+
+ /**
+ * Adds this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to add with this word.
+ *
+ * @return {X64Word} A new x64-Word object after adding.
+ *
+ * @example
+ *
+ * var added = x64Word.add(anotherX64Word);
+ */
+ // add: function (word) {
+ // var low = (this.low + word.low) | 0;
+ // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
+ // var high = (this.high + word.high + carry) | 0;
+
+ // return X64Word.create(high, low);
+ // }
+ });
+
+ /**
+ * An array of 64-bit words.
+ *
+ * @property {Array} words The array of CryptoJS.x64.Word objects.
+ * @property {number} sigBytes The number of significant bytes in this word array.
+ */
+ var X64WordArray = C_x64.WordArray = Base.extend({
+ /**
+ * Initializes a newly created word array.
+ *
+ * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
+ * @param {number} sigBytes (Optional) The number of significant bytes in the words.
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.x64.WordArray.create();
+ *
+ * var wordArray = CryptoJS.x64.WordArray.create([
+ * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
+ * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
+ * ]);
+ *
+ * var wordArray = CryptoJS.x64.WordArray.create([
+ * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
+ * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
+ * ], 10);
+ */
+ init: function (words, sigBytes) {
+ words = this.words = words || [];
+
+ if (sigBytes != undefined) {
+ this.sigBytes = sigBytes;
+ } else {
+ this.sigBytes = words.length * 8;
+ }
+ },
+
+ /**
+ * Converts this 64-bit word array to a 32-bit word array.
+ *
+ * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
+ *
+ * @example
+ *
+ * var x32WordArray = x64WordArray.toX32();
+ */
+ toX32: function () {
+ // Shortcuts
+ var x64Words = this.words;
+ var x64WordsLength = x64Words.length;
+
+ // Convert
+ var x32Words = [];
+ for (var i = 0; i < x64WordsLength; i++) {
+ var x64Word = x64Words[i];
+ x32Words.push(x64Word.high);
+ x32Words.push(x64Word.low);
+ }
+
+ return X32WordArray.create(x32Words, this.sigBytes);
+ },
+
+ /**
+ * Creates a copy of this word array.
+ *
+ * @return {X64WordArray} The clone.
+ *
+ * @example
+ *
+ * var clone = x64WordArray.clone();
+ */
+ clone: function () {
+ var clone = Base.clone.call(this);
+
+ // Clone "words" array
+ var words = clone.words = this.words.slice(0);
+
+ // Clone each X64Word object
+ var wordsLength = words.length;
+ for (var i = 0; i < wordsLength; i++) {
+ words[i] = words[i].clone();
+ }
+
+ return clone;
+ }
+ });
+ }());
+
+
+ return CryptoJS;
+
+}));
+},{"./core":473}],505:[function(require,module,exports){
+(function (global){
+'use strict';
+
+var csjs = require('csjs');
+var insertCss = require('insert-css');
+
+function csjsInserter() {
+ var args = Array.prototype.slice.call(arguments);
+ var result = csjs.apply(null, args);
+ if (global.document) {
+ insertCss(csjs.getCss(result));
+ }
+ return result;
+}
+
+module.exports = csjsInserter;
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"csjs":510,"insert-css":835}],506:[function(require,module,exports){
+'use strict';
+
+module.exports = require('csjs/get-css');
+
+},{"csjs/get-css":509}],507:[function(require,module,exports){
+'use strict';
+
+var csjs = require('./csjs');
+
+module.exports = csjs;
+module.exports.csjs = csjs;
+module.exports.getCss = require('./get-css');
+
+},{"./csjs":505,"./get-css":506}],508:[function(require,module,exports){
+'use strict';
+
+module.exports = require('./lib/csjs');
+
+},{"./lib/csjs":514}],509:[function(require,module,exports){
+'use strict';
+
+module.exports = require('./lib/get-css');
+
+},{"./lib/get-css":518}],510:[function(require,module,exports){
+'use strict';
+
+var csjs = require('./csjs');
+
+module.exports = csjs();
+module.exports.csjs = csjs;
+module.exports.noScope = csjs({ noscope: true });
+module.exports.getCss = require('./get-css');
+
+},{"./csjs":508,"./get-css":509}],511:[function(require,module,exports){
+'use strict';
+
+/**
+ * base62 encode implementation based on base62 module:
+ * https://github.com/andrew/base62.js
+ */
+
+var CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+
+module.exports = function encode(integer) {
+ if (integer === 0) {
+ return '0';
+ }
+ var str = '';
+ while (integer > 0) {
+ str = CHARS[integer % 62] + str;
+ integer = Math.floor(integer / 62);
+ }
+ return str;
+};
+
+},{}],512:[function(require,module,exports){
+'use strict';
+
+var makeComposition = require('./composition').makeComposition;
+
+module.exports = function createExports(classes, keyframes, compositions) {
+ var keyframesObj = Object.keys(keyframes).reduce(function(acc, key) {
+ var val = keyframes[key];
+ acc[val] = makeComposition([key], [val], true);
+ return acc;
+ }, {});
+
+ var exports = Object.keys(classes).reduce(function(acc, key) {
+ var val = classes[key];
+ var composition = compositions[key];
+ var extended = composition ? getClassChain(composition) : [];
+ var allClasses = [key].concat(extended);
+ var unscoped = allClasses.map(function(name) {
+ return classes[name] ? classes[name] : name;
+ });
+ acc[val] = makeComposition(allClasses, unscoped);
+ return acc;
+ }, keyframesObj);
+
+ return exports;
+}
+
+function getClassChain(obj) {
+ var visited = {}, acc = [];
+
+ function traverse(obj) {
+ return Object.keys(obj).forEach(function(key) {
+ if (!visited[key]) {
+ visited[key] = true;
+ acc.push(key);
+ traverse(obj[key]);
+ }
+ });
+ }
+
+ traverse(obj);
+ return acc;
+}
+
+},{"./composition":513}],513:[function(require,module,exports){
+'use strict';
+
+module.exports = {
+ makeComposition: makeComposition,
+ isComposition: isComposition,
+ ignoreComposition: ignoreComposition
+};
+
+/**
+ * Returns an immutable composition object containing the given class names
+ * @param {array} classNames - The input array of class names
+ * @return {Composition} - An immutable object that holds multiple
+ * representations of the class composition
+ */
+function makeComposition(classNames, unscoped, isAnimation) {
+ var classString = classNames.join(' ');
+ return Object.create(Composition.prototype, {
+ classNames: { // the original array of class names
+ value: Object.freeze(classNames),
+ configurable: false,
+ writable: false,
+ enumerable: true
+ },
+ unscoped: { // the original array of class names
+ value: Object.freeze(unscoped),
+ configurable: false,
+ writable: false,
+ enumerable: true
+ },
+ className: { // space-separated class string for use in HTML
+ value: classString,
+ configurable: false,
+ writable: false,
+ enumerable: true
+ },
+ selector: { // comma-separated, period-prefixed string for use in CSS
+ value: classNames.map(function(name) {
+ return isAnimation ? name : '.' + name;
+ }).join(', '),
+ configurable: false,
+ writable: false,
+ enumerable: true
+ },
+ toString: { // toString() method, returns class string for use in HTML
+ value: function() {
+ return classString;
+ },
+ configurable: false,
+ writeable: false,
+ enumerable: false
+ }
+ });
+}
+
+/**
+ * Returns whether the input value is a Composition
+ * @param value - value to check
+ * @return {boolean} - whether value is a Composition or not
+ */
+function isComposition(value) {
+ return value instanceof Composition;
+}
+
+function ignoreComposition(values) {
+ return values.reduce(function(acc, val) {
+ if (isComposition(val)) {
+ val.classNames.forEach(function(name, i) {
+ acc[name] = val.unscoped[i];
+ });
+ }
+ return acc;
+ }, {});
+}
+
+/**
+ * Private constructor for use in `instanceof` checks
+ */
+function Composition() {}
+
+},{}],514:[function(require,module,exports){
+'use strict';
+
+var extractExtends = require('./css-extract-extends');
+var composition = require('./composition');
+var isComposition = composition.isComposition;
+var ignoreComposition = composition.ignoreComposition;
+var buildExports = require('./build-exports');
+var scopify = require('./scopeify');
+var cssKey = require('./css-key');
+var extractExports = require('./extract-exports');
+
+module.exports = function csjsTemplate(opts) {
+ opts = (typeof opts === 'undefined') ? {} : opts;
+ var noscope = (typeof opts.noscope === 'undefined') ? false : opts.noscope;
+
+ return function csjsHandler(strings, values) {
+ // Fast path to prevent arguments deopt
+ var values = Array(arguments.length - 1);
+ for (var i = 1; i < arguments.length; i++) {
+ values[i - 1] = arguments[i];
+ }
+ var css = joiner(strings, values.map(selectorize));
+ var ignores = ignoreComposition(values);
+
+ var scope = noscope ? extractExports(css) : scopify(css, ignores);
+ var extracted = extractExtends(scope.css);
+ var localClasses = without(scope.classes, ignores);
+ var localKeyframes = without(scope.keyframes, ignores);
+ var compositions = extracted.compositions;
+
+ var exports = buildExports(localClasses, localKeyframes, compositions);
+
+ return Object.defineProperty(exports, cssKey, {
+ enumerable: false,
+ configurable: false,
+ writeable: false,
+ value: extracted.css
+ });
+ }
+}
+
+/**
+ * Replaces class compositions with comma seperated class selectors
+ * @param value - the potential class composition
+ * @return - the original value or the selectorized class composition
+ */
+function selectorize(value) {
+ return isComposition(value) ? value.selector : value;
+}
+
+/**
+ * Joins template string literals and values
+ * @param {array} strings - array of strings
+ * @param {array} values - array of values
+ * @return {string} - strings and values joined
+ */
+function joiner(strings, values) {
+ return strings.map(function(str, i) {
+ return (i !== values.length) ? str + values[i] : str;
+ }).join('');
+}
+
+/**
+ * Returns first object without keys of second
+ * @param {object} obj - source object
+ * @param {object} unwanted - object with unwanted keys
+ * @return {object} - first object without unwanted keys
+ */
+function without(obj, unwanted) {
+ return Object.keys(obj).reduce(function(acc, key) {
+ if (!unwanted[key]) {
+ acc[key] = obj[key];
+ }
+ return acc;
+ }, {});
+}
+
+},{"./build-exports":512,"./composition":513,"./css-extract-extends":515,"./css-key":516,"./extract-exports":517,"./scopeify":523}],515:[function(require,module,exports){
+'use strict';
+
+var makeComposition = require('./composition').makeComposition;
+
+var regex = /\.([^\s]+)(\s+)(extends\s+)(\.[^{]+)/g;
+
+module.exports = function extractExtends(css) {
+ var found, matches = [];
+ while (found = regex.exec(css)) {
+ matches.unshift(found);
+ }
+
+ function extractCompositions(acc, match) {
+ var extendee = getClassName(match[1]);
+ var keyword = match[3];
+ var extended = match[4];
+
+ // remove from output css
+ var index = match.index + match[1].length + match[2].length;
+ var len = keyword.length + extended.length;
+ acc.css = acc.css.slice(0, index) + " " + acc.css.slice(index + len + 1);
+
+ var extendedClasses = splitter(extended);
+
+ extendedClasses.forEach(function(className) {
+ if (!acc.compositions[extendee]) {
+ acc.compositions[extendee] = {};
+ }
+ if (!acc.compositions[className]) {
+ acc.compositions[className] = {};
+ }
+ acc.compositions[extendee][className] = acc.compositions[className];
+ });
+ return acc;
+ }
+
+ return matches.reduce(extractCompositions, {
+ css: css,
+ compositions: {}
+ });
+
+};
+
+function splitter(match) {
+ return match.split(',').map(getClassName);
+}
+
+function getClassName(str) {
+ var trimmed = str.trim();
+ return trimmed[0] === '.' ? trimmed.substr(1) : trimmed;
+}
+
+},{"./composition":513}],516:[function(require,module,exports){
+'use strict';
+
+/**
+ * CSS identifiers with whitespace are invalid
+ * Hence this key will not cause a collision
+ */
+
+module.exports = ' css ';
+
+},{}],517:[function(require,module,exports){
+'use strict';
+
+var regex = require('./regex');
+var classRegex = regex.classRegex;
+var keyframesRegex = regex.keyframesRegex;
+
+module.exports = extractExports;
+
+function extractExports(css) {
+ return {
+ css: css,
+ keyframes: getExport(css, keyframesRegex),
+ classes: getExport(css, classRegex)
+ };
+}
+
+function getExport(css, regex) {
+ var prop = {};
+ var match;
+ while((match = regex.exec(css)) !== null) {
+ var name = match[2];
+ prop[name] = name;
+ }
+ return prop;
+}
+
+},{"./regex":520}],518:[function(require,module,exports){
+'use strict';
+
+var cssKey = require('./css-key');
+
+module.exports = function getCss(csjs) {
+ return csjs[cssKey];
+};
+
+},{"./css-key":516}],519:[function(require,module,exports){
+'use strict';
+
+/**
+ * djb2 string hash implementation based on string-hash module:
+ * https://github.com/darkskyapp/string-hash
+ */
+
+module.exports = function hashStr(str) {
+ var hash = 5381;
+ var i = str.length;
+
+ while (i) {
+ hash = (hash * 33) ^ str.charCodeAt(--i)
+ }
+ return hash >>> 0;
+};
+
+},{}],520:[function(require,module,exports){
+'use strict';
+
+var findClasses = /(\.)(?!\d)([^\s\.,{\[>+~#:)]*)(?![^{]*})/.source;
+var findKeyframes = /(@\S*keyframes\s*)([^{\s]*)/.source;
+var ignoreComments = /(?!(?:[^*/]|\*[^/]|\/[^*])*\*+\/)/.source;
+
+var classRegex = new RegExp(findClasses + ignoreComments, 'g');
+var keyframesRegex = new RegExp(findKeyframes + ignoreComments, 'g');
+
+module.exports = {
+ classRegex: classRegex,
+ keyframesRegex: keyframesRegex,
+ ignoreComments: ignoreComments,
+};
+
+},{}],521:[function(require,module,exports){
+var ignoreComments = require('./regex').ignoreComments;
+
+module.exports = replaceAnimations;
+
+function replaceAnimations(result) {
+ var animations = Object.keys(result.keyframes).reduce(function(acc, key) {
+ acc[result.keyframes[key]] = key;
+ return acc;
+ }, {});
+ var unscoped = Object.keys(animations);
+
+ if (unscoped.length) {
+ var regexStr = '((?:animation|animation-name)\\s*:[^};]*)('
+ + unscoped.join('|') + ')([;\\s])' + ignoreComments;
+ var regex = new RegExp(regexStr, 'g');
+
+ var replaced = result.css.replace(regex, function(match, preamble, name, ending) {
+ return preamble + animations[name] + ending;
+ });
+
+ return {
+ css: replaced,
+ keyframes: result.keyframes,
+ classes: result.classes
+ }
+ }
+
+ return result;
+}
+
+},{"./regex":520}],522:[function(require,module,exports){
+'use strict';
+
+var encode = require('./base62-encode');
+var hash = require('./hash-string');
+
+module.exports = function fileScoper(fileSrc) {
+ var suffix = encode(hash(fileSrc));
+
+ return function scopedName(name) {
+ return name + '_' + suffix;
+ }
+};
+
+},{"./base62-encode":511,"./hash-string":519}],523:[function(require,module,exports){
+'use strict';
+
+var fileScoper = require('./scoped-name');
+var replaceAnimations = require('./replace-animations');
+var regex = require('./regex');
+var classRegex = regex.classRegex;
+var keyframesRegex = regex.keyframesRegex;
+
+module.exports = scopify;
+
+function scopify(css, ignores) {
+ var makeScopedName = fileScoper(css);
+ var replacers = {
+ classes: classRegex,
+ keyframes: keyframesRegex
+ };
+
+ function scopeCss(result, key) {
+ var replacer = replacers[key];
+ function replaceFn(fullMatch, prefix, name) {
+ var scopedName = ignores[name] ? name : makeScopedName(name);
+ result[key][scopedName] = name;
+ return prefix + scopedName;
+ }
+ return {
+ css: result.css.replace(replacer, replaceFn),
+ keyframes: result.keyframes,
+ classes: result.classes
+ };
+ }
+
+ var result = Object.keys(replacers).reduce(scopeCss, {
+ css: css,
+ keyframes: {},
+ classes: {}
+ });
+
+ return replaceAnimations(result);
+}
+
+},{"./regex":520,"./replace-animations":521,"./scoped-name":522}],524:[function(require,module,exports){
+(function (global){
+
+var NativeCustomEvent = global.CustomEvent;
+
+function useNative () {
+ try {
+ var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });
+ return 'cat' === p.type && 'bar' === p.detail.foo;
+ } catch (e) {
+ }
+ return false;
+}
+
+/**
+ * Cross-browser `CustomEvent` constructor.
+ *
+ * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
+ *
+ * @public
+ */
+
+module.exports = useNative() ? NativeCustomEvent :
+
+// IE >= 9
+'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) {
+ var e = document.createEvent('CustomEvent');
+ if (params) {
+ e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
+ } else {
+ e.initCustomEvent(type, false, false, void 0);
+ }
+ return e;
+} :
+
+// IE <= 8
+function CustomEvent (type, params) {
+ var e = document.createEventObject();
+ e.type = type;
+ if (params) {
+ e.bubbles = Boolean(params.bubbles);
+ e.cancelable = Boolean(params.cancelable);
+ e.detail = params.detail;
+ } else {
+ e.bubbles = false;
+ e.cancelable = false;
+ e.detail = void 0;
+ }
+ return e;
+}
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],525:[function(require,module,exports){
+'use strict';
+var token = '%[a-f0-9]{2}';
+var singleMatcher = new RegExp(token, 'gi');
+var multiMatcher = new RegExp('(' + token + ')+', 'gi');
+
+function decodeComponents(components, split) {
+ try {
+ // Try to decode the entire string first
+ return decodeURIComponent(components.join(''));
+ } catch (err) {
+ // Do nothing
+ }
+
+ if (components.length === 1) {
+ return components;
+ }
+
+ split = split || 1;
+
+ // Split the array in 2 parts
+ var left = components.slice(0, split);
+ var right = components.slice(split);
+
+ return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
+}
+
+function decode(input) {
+ try {
+ return decodeURIComponent(input);
+ } catch (err) {
+ var tokens = input.match(singleMatcher);
+
+ for (var i = 1; i < tokens.length; i++) {
+ input = decodeComponents(tokens, i).join('');
+
+ tokens = input.match(singleMatcher);
+ }
+
+ return input;
+ }
+}
+
+function customDecodeURIComponent(input) {
+ // Keep track of all the replacements and prefill the map with the `BOM`
+ var replaceMap = {
+ '%FE%FF': '\uFFFD\uFFFD',
+ '%FF%FE': '\uFFFD\uFFFD'
+ };
+
+ var match = multiMatcher.exec(input);
+ while (match) {
+ try {
+ // Decode as big chunks as possible
+ replaceMap[match[0]] = decodeURIComponent(match[0]);
+ } catch (err) {
+ var result = decode(match[0]);
+
+ if (result !== match[0]) {
+ replaceMap[match[0]] = result;
+ }
+ }
+
+ match = multiMatcher.exec(input);
+ }
+
+ // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
+ replaceMap['%C2'] = '\uFFFD';
+
+ var entries = Object.keys(replaceMap);
+
+ for (var i = 0; i < entries.length; i++) {
+ // Replace all decoded components
+ var key = entries[i];
+ input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
+ }
+
+ return input;
+}
+
+module.exports = function (encodedURI) {
+ if (typeof encodedURI !== 'string') {
+ throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
+ }
+
+ try {
+ encodedURI = encodedURI.replace(/\+/g, ' ');
+
+ // Try the built in decoder first
+ return decodeURIComponent(encodedURI);
+ } catch (err) {
+ // Fallback to a more advanced decoder
+ return customDecodeURIComponent(encodedURI);
+ }
+};
+
+},{}],526:[function(require,module,exports){
+var util = require('util')
+ , AbstractIterator = require('abstract-leveldown').AbstractIterator
+
+
+function DeferredIterator (options) {
+ AbstractIterator.call(this, options)
+
+ this._options = options
+ this._iterator = null
+ this._operations = []
+}
+
+util.inherits(DeferredIterator, AbstractIterator)
+
+DeferredIterator.prototype.setDb = function (db) {
+ var it = this._iterator = db.iterator(this._options)
+ this._operations.forEach(function (op) {
+ it[op.method].apply(it, op.args)
+ })
+}
+
+DeferredIterator.prototype._operation = function (method, args) {
+ if (this._iterator)
+ return this._iterator[method].apply(this._iterator, args)
+ this._operations.push({ method: method, args: args })
+}
+
+'next end'.split(' ').forEach(function (m) {
+ DeferredIterator.prototype['_' + m] = function () {
+ this._operation(m, arguments)
+ }
+})
+
+module.exports = DeferredIterator;
+
+},{"abstract-leveldown":4,"util":1439}],527:[function(require,module,exports){
+(function (Buffer,process){
+var util = require('util')
+ , AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN
+ , DeferredIterator = require('./deferred-iterator')
+
+function DeferredLevelDOWN (location) {
+ AbstractLevelDOWN.call(this, typeof location == 'string' ? location : '') // optional location, who cares?
+ this._db = undefined
+ this._operations = []
+ this._iterators = []
+}
+
+util.inherits(DeferredLevelDOWN, AbstractLevelDOWN)
+
+// called by LevelUP when we have a real DB to take its place
+DeferredLevelDOWN.prototype.setDb = function (db) {
+ this._db = db
+ this._operations.forEach(function (op) {
+ db[op.method].apply(db, op.args)
+ })
+ this._iterators.forEach(function (it) {
+ it.setDb(db)
+ })
+}
+
+DeferredLevelDOWN.prototype._open = function (options, callback) {
+ return process.nextTick(callback)
+}
+
+// queue a new deferred operation
+DeferredLevelDOWN.prototype._operation = function (method, args) {
+ if (this._db)
+ return this._db[method].apply(this._db, args)
+ this._operations.push({ method: method, args: args })
+}
+
+// deferrables
+'put get del batch approximateSize'.split(' ').forEach(function (m) {
+ DeferredLevelDOWN.prototype['_' + m] = function () {
+ this._operation(m, arguments)
+ }
+})
+
+DeferredLevelDOWN.prototype._isBuffer = function (obj) {
+ return Buffer.isBuffer(obj)
+}
+
+DeferredLevelDOWN.prototype._iterator = function (options) {
+ if (this._db)
+ return this._db.iterator.apply(this._db, arguments)
+ var it = new DeferredIterator(options)
+ this._iterators.push(it)
+ return it
+}
+
+module.exports = DeferredLevelDOWN
+module.exports.DeferredIterator = DeferredIterator
+
+}).call(this,{"isBuffer":require("../is-buffer/index.js")},require('_process'))
+},{"../is-buffer/index.js":839,"./deferred-iterator":526,"_process":109,"abstract-leveldown":4,"util":1439}],528:[function(require,module,exports){
+'use strict';
+
+var keys = require('object-keys');
+var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
+
+var toStr = Object.prototype.toString;
+var concat = Array.prototype.concat;
+var origDefineProperty = Object.defineProperty;
+
+var isFunction = function (fn) {
+ return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
+};
+
+var arePropertyDescriptorsSupported = function () {
+ var obj = {};
+ try {
+ origDefineProperty(obj, 'x', { enumerable: false, value: obj });
+ // eslint-disable-next-line no-unused-vars, no-restricted-syntax
+ for (var _ in obj) { // jscs:ignore disallowUnusedVariables
+ return false;
+ }
+ return obj.x === obj;
+ } catch (e) { /* this is IE 8. */
+ return false;
+ }
+};
+var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
+
+var defineProperty = function (object, name, value, predicate) {
+ if (name in object && (!isFunction(predicate) || !predicate())) {
+ return;
+ }
+ if (supportsDescriptors) {
+ origDefineProperty(object, name, {
+ configurable: true,
+ enumerable: false,
+ value: value,
+ writable: true
+ });
+ } else {
+ object[name] = value;
+ }
+};
+
+var defineProperties = function (object, map) {
+ var predicates = arguments.length > 2 ? arguments[2] : {};
+ var props = keys(map);
+ if (hasSymbols) {
+ props = concat.call(props, Object.getOwnPropertySymbols(map));
+ }
+ for (var i = 0; i < props.length; i += 1) {
+ defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
+ }
+};
+
+defineProperties.supportsDescriptors = !!supportsDescriptors;
+
+module.exports = defineProperties;
+
+},{"object-keys":530}],529:[function(require,module,exports){
+'use strict';
+
+var keysShim;
+if (!Object.keys) {
+ // modified from https://github.com/es-shims/es5-shim
+ var has = Object.prototype.hasOwnProperty;
+ var toStr = Object.prototype.toString;
+ var isArgs = require('./isArguments'); // eslint-disable-line global-require
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
+ var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
+ var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
+ var dontEnums = [
+ 'toString',
+ 'toLocaleString',
+ 'valueOf',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+ ];
+ var equalsConstructorPrototype = function (o) {
+ var ctor = o.constructor;
+ return ctor && ctor.prototype === o;
+ };
+ var excludedKeys = {
+ $applicationCache: true,
+ $console: true,
+ $external: true,
+ $frame: true,
+ $frameElement: true,
+ $frames: true,
+ $innerHeight: true,
+ $innerWidth: true,
+ $outerHeight: true,
+ $outerWidth: true,
+ $pageXOffset: true,
+ $pageYOffset: true,
+ $parent: true,
+ $scrollLeft: true,
+ $scrollTop: true,
+ $scrollX: true,
+ $scrollY: true,
+ $self: true,
+ $webkitIndexedDB: true,
+ $webkitStorageInfo: true,
+ $window: true
+ };
+ var hasAutomationEqualityBug = (function () {
+ /* global window */
+ if (typeof window === 'undefined') { return false; }
+ for (var k in window) {
+ try {
+ if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
+ try {
+ equalsConstructorPrototype(window[k]);
+ } catch (e) {
+ return true;
+ }
+ }
+ } catch (e) {
+ return true;
+ }
+ }
+ return false;
+ }());
+ var equalsConstructorPrototypeIfNotBuggy = function (o) {
+ /* global window */
+ if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
+ return equalsConstructorPrototype(o);
+ }
+ try {
+ return equalsConstructorPrototype(o);
+ } catch (e) {
+ return false;
+ }
+ };
+
+ keysShim = function keys(object) {
+ var isObject = object !== null && typeof object === 'object';
+ var isFunction = toStr.call(object) === '[object Function]';
+ var isArguments = isArgs(object);
+ var isString = isObject && toStr.call(object) === '[object String]';
+ var theKeys = [];
+
+ if (!isObject && !isFunction && !isArguments) {
+ throw new TypeError('Object.keys called on a non-object');
+ }
+
+ var skipProto = hasProtoEnumBug && isFunction;
+ if (isString && object.length > 0 && !has.call(object, 0)) {
+ for (var i = 0; i < object.length; ++i) {
+ theKeys.push(String(i));
+ }
+ }
+
+ if (isArguments && object.length > 0) {
+ for (var j = 0; j < object.length; ++j) {
+ theKeys.push(String(j));
+ }
+ } else {
+ for (var name in object) {
+ if (!(skipProto && name === 'prototype') && has.call(object, name)) {
+ theKeys.push(String(name));
+ }
+ }
+ }
+
+ if (hasDontEnumBug) {
+ var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
+
+ for (var k = 0; k < dontEnums.length; ++k) {
+ if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
+ theKeys.push(dontEnums[k]);
+ }
+ }
+ }
+ return theKeys;
+ };
+}
+module.exports = keysShim;
+
+},{"./isArguments":531}],530:[function(require,module,exports){
+'use strict';
+
+var slice = Array.prototype.slice;
+var isArgs = require('./isArguments');
+
+var origKeys = Object.keys;
+var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
+
+var originalKeys = Object.keys;
+
+keysShim.shim = function shimObjectKeys() {
+ if (Object.keys) {
+ var keysWorksWithArguments = (function () {
+ // Safari 5.0 bug
+ var args = Object.keys(arguments);
+ return args && args.length === arguments.length;
+ }(1, 2));
+ if (!keysWorksWithArguments) {
+ Object.keys = function keys(object) { // eslint-disable-line func-name-matching
+ if (isArgs(object)) {
+ return originalKeys(slice.call(object));
+ }
+ return originalKeys(object);
+ };
+ }
+ } else {
+ Object.keys = keysShim;
+ }
+ return Object.keys || keysShim;
+};
+
+module.exports = keysShim;
+
+},{"./implementation":529,"./isArguments":531}],531:[function(require,module,exports){
+'use strict';
+
+var toStr = Object.prototype.toString;
+
+module.exports = function isArguments(value) {
+ var str = toStr.call(value);
+ var isArgs = str === '[object Arguments]';
+ if (!isArgs) {
+ isArgs = str !== '[object Array]' &&
+ value !== null &&
+ typeof value === 'object' &&
+ typeof value.length === 'number' &&
+ value.length >= 0 &&
+ toStr.call(value.callee) === '[object Function]';
+ }
+ return isArgs;
+};
+
+},{}],532:[function(require,module,exports){
+var Stream = require('stream').Stream;
+var util = require('util');
+
+module.exports = DelayedStream;
+function DelayedStream() {
+ this.source = null;
+ this.dataSize = 0;
+ this.maxDataSize = 1024 * 1024;
+ this.pauseStream = true;
+
+ this._maxDataSizeExceeded = false;
+ this._released = false;
+ this._bufferedEvents = [];
+}
+util.inherits(DelayedStream, Stream);
+
+DelayedStream.create = function(source, options) {
+ var delayedStream = new this();
+
+ options = options || {};
+ for (var option in options) {
+ delayedStream[option] = options[option];
+ }
+
+ delayedStream.source = source;
+
+ var realEmit = source.emit;
+ source.emit = function() {
+ delayedStream._handleEmit(arguments);
+ return realEmit.apply(source, arguments);
+ };
+
+ source.on('error', function() {});
+ if (delayedStream.pauseStream) {
+ source.pause();
+ }
+
+ return delayedStream;
+};
+
+Object.defineProperty(DelayedStream.prototype, 'readable', {
+ configurable: true,
+ enumerable: true,
+ get: function() {
+ return this.source.readable;
+ }
+});
+
+DelayedStream.prototype.setEncoding = function() {
+ return this.source.setEncoding.apply(this.source, arguments);
+};
+
+DelayedStream.prototype.resume = function() {
+ if (!this._released) {
+ this.release();
+ }
+
+ this.source.resume();
+};
+
+DelayedStream.prototype.pause = function() {
+ this.source.pause();
+};
+
+DelayedStream.prototype.release = function() {
+ this._released = true;
+
+ this._bufferedEvents.forEach(function(args) {
+ this.emit.apply(this, args);
+ }.bind(this));
+ this._bufferedEvents = [];
+};
+
+DelayedStream.prototype.pipe = function() {
+ var r = Stream.prototype.pipe.apply(this, arguments);
+ this.resume();
+ return r;
+};
+
+DelayedStream.prototype._handleEmit = function(args) {
+ if (this._released) {
+ this.emit.apply(this, args);
+ return;
+ }
+
+ if (args[0] === 'data') {
+ this.dataSize += args[1].length;
+ this._checkIfMaxDataSizeExceeded();
+ }
+
+ this._bufferedEvents.push(args);
+};
+
+DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
+ if (this._maxDataSizeExceeded) {
+ return;
+ }
+
+ if (this.dataSize <= this.maxDataSize) {
+ return;
+ }
+
+ this._maxDataSizeExceeded = true;
+ var message =
+ 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
+ this.emit('error', new Error(message));
+};
+
+},{"stream":1394,"util":1439}],533:[function(require,module,exports){
+'use strict';
+
+exports.utils = require('./des/utils');
+exports.Cipher = require('./des/cipher');
+exports.DES = require('./des/des');
+exports.CBC = require('./des/cbc');
+exports.EDE = require('./des/ede');
+
+},{"./des/cbc":534,"./des/cipher":535,"./des/des":536,"./des/ede":537,"./des/utils":538}],534:[function(require,module,exports){
+'use strict';
+
+var assert = require('minimalistic-assert');
+var inherits = require('inherits');
+
+var proto = {};
+
+function CBCState(iv) {
+ assert.equal(iv.length, 8, 'Invalid IV length');
+
+ this.iv = new Array(8);
+ for (var i = 0; i < this.iv.length; i++)
+ this.iv[i] = iv[i];
+}
+
+function instantiate(Base) {
+ function CBC(options) {
+ Base.call(this, options);
+ this._cbcInit();
+ }
+ inherits(CBC, Base);
+
+ var keys = Object.keys(proto);
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ CBC.prototype[key] = proto[key];
+ }
+
+ CBC.create = function create(options) {
+ return new CBC(options);
+ };
+
+ return CBC;
+}
+
+exports.instantiate = instantiate;
+
+proto._cbcInit = function _cbcInit() {
+ var state = new CBCState(this.options.iv);
+ this._cbcState = state;
+};
+
+proto._update = function _update(inp, inOff, out, outOff) {
+ var state = this._cbcState;
+ var superProto = this.constructor.super_.prototype;
+
+ var iv = state.iv;
+ if (this.type === 'encrypt') {
+ for (var i = 0; i < this.blockSize; i++)
+ iv[i] ^= inp[inOff + i];
+
+ superProto._update.call(this, iv, 0, out, outOff);
+
+ for (var i = 0; i < this.blockSize; i++)
+ iv[i] = out[outOff + i];
+ } else {
+ superProto._update.call(this, inp, inOff, out, outOff);
+
+ for (var i = 0; i < this.blockSize; i++)
+ out[outOff + i] ^= iv[i];
+
+ for (var i = 0; i < this.blockSize; i++)
+ iv[i] = inp[inOff + i];
+ }
+};
+
+},{"inherits":834,"minimalistic-assert":960}],535:[function(require,module,exports){
+'use strict';
+
+var assert = require('minimalistic-assert');
+
+function Cipher(options) {
+ this.options = options;
+
+ this.type = this.options.type;
+ this.blockSize = 8;
+ this._init();
+
+ this.buffer = new Array(this.blockSize);
+ this.bufferOff = 0;
+}
+module.exports = Cipher;
+
+Cipher.prototype._init = function _init() {
+ // Might be overrided
+};
+
+Cipher.prototype.update = function update(data) {
+ if (data.length === 0)
+ return [];
+
+ if (this.type === 'decrypt')
+ return this._updateDecrypt(data);
+ else
+ return this._updateEncrypt(data);
+};
+
+Cipher.prototype._buffer = function _buffer(data, off) {
+ // Append data to buffer
+ var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
+ for (var i = 0; i < min; i++)
+ this.buffer[this.bufferOff + i] = data[off + i];
+ this.bufferOff += min;
+
+ // Shift next
+ return min;
+};
+
+Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
+ this._update(this.buffer, 0, out, off);
+ this.bufferOff = 0;
+ return this.blockSize;
+};
+
+Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
+ var inputOff = 0;
+ var outputOff = 0;
+
+ var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
+ var out = new Array(count * this.blockSize);
+
+ if (this.bufferOff !== 0) {
+ inputOff += this._buffer(data, inputOff);
+
+ if (this.bufferOff === this.buffer.length)
+ outputOff += this._flushBuffer(out, outputOff);
+ }
+
+ // Write blocks
+ var max = data.length - ((data.length - inputOff) % this.blockSize);
+ for (; inputOff < max; inputOff += this.blockSize) {
+ this._update(data, inputOff, out, outputOff);
+ outputOff += this.blockSize;
+ }
+
+ // Queue rest
+ for (; inputOff < data.length; inputOff++, this.bufferOff++)
+ this.buffer[this.bufferOff] = data[inputOff];
+
+ return out;
+};
+
+Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
+ var inputOff = 0;
+ var outputOff = 0;
+
+ var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
+ var out = new Array(count * this.blockSize);
+
+ // TODO(indutny): optimize it, this is far from optimal
+ for (; count > 0; count--) {
+ inputOff += this._buffer(data, inputOff);
+ outputOff += this._flushBuffer(out, outputOff);
+ }
+
+ // Buffer rest of the input
+ inputOff += this._buffer(data, inputOff);
+
+ return out;
+};
+
+Cipher.prototype.final = function final(buffer) {
+ var first;
+ if (buffer)
+ first = this.update(buffer);
+
+ var last;
+ if (this.type === 'encrypt')
+ last = this._finalEncrypt();
+ else
+ last = this._finalDecrypt();
+
+ if (first)
+ return first.concat(last);
+ else
+ return last;
+};
+
+Cipher.prototype._pad = function _pad(buffer, off) {
+ if (off === 0)
+ return false;
+
+ while (off < buffer.length)
+ buffer[off++] = 0;
+
+ return true;
+};
+
+Cipher.prototype._finalEncrypt = function _finalEncrypt() {
+ if (!this._pad(this.buffer, this.bufferOff))
+ return [];
+
+ var out = new Array(this.blockSize);
+ this._update(this.buffer, 0, out, 0);
+ return out;
+};
+
+Cipher.prototype._unpad = function _unpad(buffer) {
+ return buffer;
+};
+
+Cipher.prototype._finalDecrypt = function _finalDecrypt() {
+ assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
+ var out = new Array(this.blockSize);
+ this._flushBuffer(out, 0);
+
+ return this._unpad(out);
+};
+
+},{"minimalistic-assert":960}],536:[function(require,module,exports){
+'use strict';
+
+var assert = require('minimalistic-assert');
+var inherits = require('inherits');
+
+var des = require('../des');
+var utils = des.utils;
+var Cipher = des.Cipher;
+
+function DESState() {
+ this.tmp = new Array(2);
+ this.keys = null;
+}
+
+function DES(options) {
+ Cipher.call(this, options);
+
+ var state = new DESState();
+ this._desState = state;
+
+ this.deriveKeys(state, options.key);
+}
+inherits(DES, Cipher);
+module.exports = DES;
+
+DES.create = function create(options) {
+ return new DES(options);
+};
+
+var shiftTable = [
+ 1, 1, 2, 2, 2, 2, 2, 2,
+ 1, 2, 2, 2, 2, 2, 2, 1
+];
+
+DES.prototype.deriveKeys = function deriveKeys(state, key) {
+ state.keys = new Array(16 * 2);
+
+ assert.equal(key.length, this.blockSize, 'Invalid key length');
+
+ var kL = utils.readUInt32BE(key, 0);
+ var kR = utils.readUInt32BE(key, 4);
+
+ utils.pc1(kL, kR, state.tmp, 0);
+ kL = state.tmp[0];
+ kR = state.tmp[1];
+ for (var i = 0; i < state.keys.length; i += 2) {
+ var shift = shiftTable[i >>> 1];
+ kL = utils.r28shl(kL, shift);
+ kR = utils.r28shl(kR, shift);
+ utils.pc2(kL, kR, state.keys, i);
+ }
+};
+
+DES.prototype._update = function _update(inp, inOff, out, outOff) {
+ var state = this._desState;
+
+ var l = utils.readUInt32BE(inp, inOff);
+ var r = utils.readUInt32BE(inp, inOff + 4);
+
+ // Initial Permutation
+ utils.ip(l, r, state.tmp, 0);
+ l = state.tmp[0];
+ r = state.tmp[1];
+
+ if (this.type === 'encrypt')
+ this._encrypt(state, l, r, state.tmp, 0);
+ else
+ this._decrypt(state, l, r, state.tmp, 0);
+
+ l = state.tmp[0];
+ r = state.tmp[1];
+
+ utils.writeUInt32BE(out, l, outOff);
+ utils.writeUInt32BE(out, r, outOff + 4);
+};
+
+DES.prototype._pad = function _pad(buffer, off) {
+ var value = buffer.length - off;
+ for (var i = off; i < buffer.length; i++)
+ buffer[i] = value;
+
+ return true;
+};
+
+DES.prototype._unpad = function _unpad(buffer) {
+ var pad = buffer[buffer.length - 1];
+ for (var i = buffer.length - pad; i < buffer.length; i++)
+ assert.equal(buffer[i], pad);
+
+ return buffer.slice(0, buffer.length - pad);
+};
+
+DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
+ var l = lStart;
+ var r = rStart;
+
+ // Apply f() x16 times
+ for (var i = 0; i < state.keys.length; i += 2) {
+ var keyL = state.keys[i];
+ var keyR = state.keys[i + 1];
+
+ // f(r, k)
+ utils.expand(r, state.tmp, 0);
+
+ keyL ^= state.tmp[0];
+ keyR ^= state.tmp[1];
+ var s = utils.substitute(keyL, keyR);
+ var f = utils.permute(s);
+
+ var t = r;
+ r = (l ^ f) >>> 0;
+ l = t;
+ }
+
+ // Reverse Initial Permutation
+ utils.rip(r, l, out, off);
+};
+
+DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
+ var l = rStart;
+ var r = lStart;
+
+ // Apply f() x16 times
+ for (var i = state.keys.length - 2; i >= 0; i -= 2) {
+ var keyL = state.keys[i];
+ var keyR = state.keys[i + 1];
+
+ // f(r, k)
+ utils.expand(l, state.tmp, 0);
+
+ keyL ^= state.tmp[0];
+ keyR ^= state.tmp[1];
+ var s = utils.substitute(keyL, keyR);
+ var f = utils.permute(s);
+
+ var t = l;
+ l = (r ^ f) >>> 0;
+ r = t;
+ }
+
+ // Reverse Initial Permutation
+ utils.rip(l, r, out, off);
+};
+
+},{"../des":533,"inherits":834,"minimalistic-assert":960}],537:[function(require,module,exports){
+'use strict';
+
+var assert = require('minimalistic-assert');
+var inherits = require('inherits');
+
+var des = require('../des');
+var Cipher = des.Cipher;
+var DES = des.DES;
+
+function EDEState(type, key) {
+ assert.equal(key.length, 24, 'Invalid key length');
+
+ var k1 = key.slice(0, 8);
+ var k2 = key.slice(8, 16);
+ var k3 = key.slice(16, 24);
+
+ if (type === 'encrypt') {
+ this.ciphers = [
+ DES.create({ type: 'encrypt', key: k1 }),
+ DES.create({ type: 'decrypt', key: k2 }),
+ DES.create({ type: 'encrypt', key: k3 })
+ ];
+ } else {
+ this.ciphers = [
+ DES.create({ type: 'decrypt', key: k3 }),
+ DES.create({ type: 'encrypt', key: k2 }),
+ DES.create({ type: 'decrypt', key: k1 })
+ ];
+ }
+}
+
+function EDE(options) {
+ Cipher.call(this, options);
+
+ var state = new EDEState(this.type, this.options.key);
+ this._edeState = state;
+}
+inherits(EDE, Cipher);
+
+module.exports = EDE;
+
+EDE.create = function create(options) {
+ return new EDE(options);
+};
+
+EDE.prototype._update = function _update(inp, inOff, out, outOff) {
+ var state = this._edeState;
+
+ state.ciphers[0]._update(inp, inOff, out, outOff);
+ state.ciphers[1]._update(out, outOff, out, outOff);
+ state.ciphers[2]._update(out, outOff, out, outOff);
+};
+
+EDE.prototype._pad = DES.prototype._pad;
+EDE.prototype._unpad = DES.prototype._unpad;
+
+},{"../des":533,"inherits":834,"minimalistic-assert":960}],538:[function(require,module,exports){
+'use strict';
+
+exports.readUInt32BE = function readUInt32BE(bytes, off) {
+ var res = (bytes[0 + off] << 24) |
+ (bytes[1 + off] << 16) |
+ (bytes[2 + off] << 8) |
+ bytes[3 + off];
+ return res >>> 0;
+};
+
+exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
+ bytes[0 + off] = value >>> 24;
+ bytes[1 + off] = (value >>> 16) & 0xff;
+ bytes[2 + off] = (value >>> 8) & 0xff;
+ bytes[3 + off] = value & 0xff;
+};
+
+exports.ip = function ip(inL, inR, out, off) {
+ var outL = 0;
+ var outR = 0;
+
+ for (var i = 6; i >= 0; i -= 2) {
+ for (var j = 0; j <= 24; j += 8) {
+ outL <<= 1;
+ outL |= (inR >>> (j + i)) & 1;
+ }
+ for (var j = 0; j <= 24; j += 8) {
+ outL <<= 1;
+ outL |= (inL >>> (j + i)) & 1;
+ }
+ }
+
+ for (var i = 6; i >= 0; i -= 2) {
+ for (var j = 1; j <= 25; j += 8) {
+ outR <<= 1;
+ outR |= (inR >>> (j + i)) & 1;
+ }
+ for (var j = 1; j <= 25; j += 8) {
+ outR <<= 1;
+ outR |= (inL >>> (j + i)) & 1;
+ }
+ }
+
+ out[off + 0] = outL >>> 0;
+ out[off + 1] = outR >>> 0;
+};
+
+exports.rip = function rip(inL, inR, out, off) {
+ var outL = 0;
+ var outR = 0;
+
+ for (var i = 0; i < 4; i++) {
+ for (var j = 24; j >= 0; j -= 8) {
+ outL <<= 1;
+ outL |= (inR >>> (j + i)) & 1;
+ outL <<= 1;
+ outL |= (inL >>> (j + i)) & 1;
+ }
+ }
+ for (var i = 4; i < 8; i++) {
+ for (var j = 24; j >= 0; j -= 8) {
+ outR <<= 1;
+ outR |= (inR >>> (j + i)) & 1;
+ outR <<= 1;
+ outR |= (inL >>> (j + i)) & 1;
+ }
+ }
+
+ out[off + 0] = outL >>> 0;
+ out[off + 1] = outR >>> 0;
+};
+
+exports.pc1 = function pc1(inL, inR, out, off) {
+ var outL = 0;
+ var outR = 0;
+
+ // 7, 15, 23, 31, 39, 47, 55, 63
+ // 6, 14, 22, 30, 39, 47, 55, 63
+ // 5, 13, 21, 29, 39, 47, 55, 63
+ // 4, 12, 20, 28
+ for (var i = 7; i >= 5; i--) {
+ for (var j = 0; j <= 24; j += 8) {
+ outL <<= 1;
+ outL |= (inR >> (j + i)) & 1;
+ }
+ for (var j = 0; j <= 24; j += 8) {
+ outL <<= 1;
+ outL |= (inL >> (j + i)) & 1;
+ }
+ }
+ for (var j = 0; j <= 24; j += 8) {
+ outL <<= 1;
+ outL |= (inR >> (j + i)) & 1;
+ }
+
+ // 1, 9, 17, 25, 33, 41, 49, 57
+ // 2, 10, 18, 26, 34, 42, 50, 58
+ // 3, 11, 19, 27, 35, 43, 51, 59
+ // 36, 44, 52, 60
+ for (var i = 1; i <= 3; i++) {
+ for (var j = 0; j <= 24; j += 8) {
+ outR <<= 1;
+ outR |= (inR >> (j + i)) & 1;
+ }
+ for (var j = 0; j <= 24; j += 8) {
+ outR <<= 1;
+ outR |= (inL >> (j + i)) & 1;
+ }
+ }
+ for (var j = 0; j <= 24; j += 8) {
+ outR <<= 1;
+ outR |= (inL >> (j + i)) & 1;
+ }
+
+ out[off + 0] = outL >>> 0;
+ out[off + 1] = outR >>> 0;
+};
+
+exports.r28shl = function r28shl(num, shift) {
+ return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
+};
+
+var pc2table = [
+ // inL => outL
+ 14, 11, 17, 4, 27, 23, 25, 0,
+ 13, 22, 7, 18, 5, 9, 16, 24,
+ 2, 20, 12, 21, 1, 8, 15, 26,
+
+ // inR => outR
+ 15, 4, 25, 19, 9, 1, 26, 16,
+ 5, 11, 23, 8, 12, 7, 17, 0,
+ 22, 3, 10, 14, 6, 20, 27, 24
+];
+
+exports.pc2 = function pc2(inL, inR, out, off) {
+ var outL = 0;
+ var outR = 0;
+
+ var len = pc2table.length >>> 1;
+ for (var i = 0; i < len; i++) {
+ outL <<= 1;
+ outL |= (inL >>> pc2table[i]) & 0x1;
+ }
+ for (var i = len; i < pc2table.length; i++) {
+ outR <<= 1;
+ outR |= (inR >>> pc2table[i]) & 0x1;
+ }
+
+ out[off + 0] = outL >>> 0;
+ out[off + 1] = outR >>> 0;
+};
+
+exports.expand = function expand(r, out, off) {
+ var outL = 0;
+ var outR = 0;
+
+ outL = ((r & 1) << 5) | (r >>> 27);
+ for (var i = 23; i >= 15; i -= 4) {
+ outL <<= 6;
+ outL |= (r >>> i) & 0x3f;
+ }
+ for (var i = 11; i >= 3; i -= 4) {
+ outR |= (r >>> i) & 0x3f;
+ outR <<= 6;
+ }
+ outR |= ((r & 0x1f) << 1) | (r >>> 31);
+
+ out[off + 0] = outL >>> 0;
+ out[off + 1] = outR >>> 0;
+};
+
+var sTable = [
+ 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
+ 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
+ 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
+ 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
+
+ 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
+ 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
+ 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
+ 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
+
+ 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
+ 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
+ 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
+ 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
+
+ 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
+ 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
+ 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
+ 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
+
+ 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
+ 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
+ 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
+ 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
+
+ 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
+ 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
+ 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
+ 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
+
+ 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
+ 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
+ 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
+ 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
+
+ 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
+ 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
+ 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
+ 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
+];
+
+exports.substitute = function substitute(inL, inR) {
+ var out = 0;
+ for (var i = 0; i < 4; i++) {
+ var b = (inL >>> (18 - i * 6)) & 0x3f;
+ var sb = sTable[i * 0x40 + b];
+
+ out <<= 4;
+ out |= sb;
+ }
+ for (var i = 0; i < 4; i++) {
+ var b = (inR >>> (18 - i * 6)) & 0x3f;
+ var sb = sTable[4 * 0x40 + i * 0x40 + b];
+
+ out <<= 4;
+ out |= sb;
+ }
+ return out >>> 0;
+};
+
+var permuteTable = [
+ 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
+ 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
+];
+
+exports.permute = function permute(num) {
+ var out = 0;
+ for (var i = 0; i < permuteTable.length; i++) {
+ out <<= 1;
+ out |= (num >>> permuteTable[i]) & 0x1;
+ }
+ return out >>> 0;
+};
+
+exports.padSplit = function padSplit(num, size, group) {
+ var str = num.toString(2);
+ while (str.length < size)
+ str = '0' + str;
+
+ var out = [];
+ for (var i = 0; i < size; i += group)
+ out.push(str.slice(i, i + group));
+ return out.join(' ');
+};
+
+},{}],539:[function(require,module,exports){
+(function (Buffer){
+var generatePrime = require('./lib/generatePrime')
+var primes = require('./lib/primes.json')
+
+var DH = require('./lib/dh')
+
+function getDiffieHellman (mod) {
+ var prime = new Buffer(primes[mod].prime, 'hex')
+ var gen = new Buffer(primes[mod].gen, 'hex')
+
+ return new DH(prime, gen)
+}
+
+var ENCODINGS = {
+ 'binary': true, 'hex': true, 'base64': true
+}
+
+function createDiffieHellman (prime, enc, generator, genc) {
+ if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
+ return createDiffieHellman(prime, 'binary', enc, generator)
+ }
+
+ enc = enc || 'binary'
+ genc = genc || 'binary'
+ generator = generator || new Buffer([2])
+
+ if (!Buffer.isBuffer(generator)) {
+ generator = new Buffer(generator, genc)
+ }
+
+ if (typeof prime === 'number') {
+ return new DH(generatePrime(prime, generator), generator, true)
+ }
+
+ if (!Buffer.isBuffer(prime)) {
+ prime = new Buffer(prime, enc)
+ }
+
+ return new DH(prime, generator, true)
+}
+
+exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
+exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
+
+}).call(this,require("buffer").Buffer)
+},{"./lib/dh":540,"./lib/generatePrime":541,"./lib/primes.json":542,"buffer":113}],540:[function(require,module,exports){
+(function (Buffer){
+var BN = require('bn.js');
+var MillerRabin = require('miller-rabin');
+var millerRabin = new MillerRabin();
+var TWENTYFOUR = new BN(24);
+var ELEVEN = new BN(11);
+var TEN = new BN(10);
+var THREE = new BN(3);
+var SEVEN = new BN(7);
+var primes = require('./generatePrime');
+var randomBytes = require('randombytes');
+module.exports = DH;
+
+function setPublicKey(pub, enc) {
+ enc = enc || 'utf8';
+ if (!Buffer.isBuffer(pub)) {
+ pub = new Buffer(pub, enc);
+ }
+ this._pub = new BN(pub);
+ return this;
+}
+
+function setPrivateKey(priv, enc) {
+ enc = enc || 'utf8';
+ if (!Buffer.isBuffer(priv)) {
+ priv = new Buffer(priv, enc);
+ }
+ this._priv = new BN(priv);
+ return this;
+}
+
+var primeCache = {};
+function checkPrime(prime, generator) {
+ var gen = generator.toString('hex');
+ var hex = [gen, prime.toString(16)].join('_');
+ if (hex in primeCache) {
+ return primeCache[hex];
+ }
+ var error = 0;
+
+ if (prime.isEven() ||
+ !primes.simpleSieve ||
+ !primes.fermatTest(prime) ||
+ !millerRabin.test(prime)) {
+ //not a prime so +1
+ error += 1;
+
+ if (gen === '02' || gen === '05') {
+ // we'd be able to check the generator
+ // it would fail so +8
+ error += 8;
+ } else {
+ //we wouldn't be able to test the generator
+ // so +4
+ error += 4;
+ }
+ primeCache[hex] = error;
+ return error;
+ }
+ if (!millerRabin.test(prime.shrn(1))) {
+ //not a safe prime
+ error += 2;
+ }
+ var rem;
+ switch (gen) {
+ case '02':
+ if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
+ // unsuidable generator
+ error += 8;
+ }
+ break;
+ case '05':
+ rem = prime.mod(TEN);
+ if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
+ // prime mod 10 needs to equal 3 or 7
+ error += 8;
+ }
+ break;
+ default:
+ error += 4;
+ }
+ primeCache[hex] = error;
+ return error;
+}
+
+function DH(prime, generator, malleable) {
+ this.setGenerator(generator);
+ this.__prime = new BN(prime);
+ this._prime = BN.mont(this.__prime);
+ this._primeLen = prime.length;
+ this._pub = undefined;
+ this._priv = undefined;
+ this._primeCode = undefined;
+ if (malleable) {
+ this.setPublicKey = setPublicKey;
+ this.setPrivateKey = setPrivateKey;
+ } else {
+ this._primeCode = 8;
+ }
+}
+Object.defineProperty(DH.prototype, 'verifyError', {
+ enumerable: true,
+ get: function () {
+ if (typeof this._primeCode !== 'number') {
+ this._primeCode = checkPrime(this.__prime, this.__gen);
+ }
+ return this._primeCode;
+ }
+});
+DH.prototype.generateKeys = function () {
+ if (!this._priv) {
+ this._priv = new BN(randomBytes(this._primeLen));
+ }
+ this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
+ return this.getPublicKey();
+};
+
+DH.prototype.computeSecret = function (other) {
+ other = new BN(other);
+ other = other.toRed(this._prime);
+ var secret = other.redPow(this._priv).fromRed();
+ var out = new Buffer(secret.toArray());
+ var prime = this.getPrime();
+ if (out.length < prime.length) {
+ var front = new Buffer(prime.length - out.length);
+ front.fill(0);
+ out = Buffer.concat([front, out]);
+ }
+ return out;
+};
+
+DH.prototype.getPublicKey = function getPublicKey(enc) {
+ return formatReturnValue(this._pub, enc);
+};
+
+DH.prototype.getPrivateKey = function getPrivateKey(enc) {
+ return formatReturnValue(this._priv, enc);
+};
+
+DH.prototype.getPrime = function (enc) {
+ return formatReturnValue(this.__prime, enc);
+};
+
+DH.prototype.getGenerator = function (enc) {
+ return formatReturnValue(this._gen, enc);
+};
+
+DH.prototype.setGenerator = function (gen, enc) {
+ enc = enc || 'utf8';
+ if (!Buffer.isBuffer(gen)) {
+ gen = new Buffer(gen, enc);
+ }
+ this.__gen = gen;
+ this._gen = new BN(gen);
+ return this;
+};
+
+function formatReturnValue(bn, enc) {
+ var buf = new Buffer(bn.toArray());
+ if (!enc) {
+ return buf;
+ } else {
+ return buf.toString(enc);
+ }
+}
+
+}).call(this,require("buffer").Buffer)
+},{"./generatePrime":541,"bn.js":66,"buffer":113,"miller-rabin":956,"randombytes":1036}],541:[function(require,module,exports){
+var randomBytes = require('randombytes');
+module.exports = findPrime;
+findPrime.simpleSieve = simpleSieve;
+findPrime.fermatTest = fermatTest;
+var BN = require('bn.js');
+var TWENTYFOUR = new BN(24);
+var MillerRabin = require('miller-rabin');
+var millerRabin = new MillerRabin();
+var ONE = new BN(1);
+var TWO = new BN(2);
+var FIVE = new BN(5);
+var SIXTEEN = new BN(16);
+var EIGHT = new BN(8);
+var TEN = new BN(10);
+var THREE = new BN(3);
+var SEVEN = new BN(7);
+var ELEVEN = new BN(11);
+var FOUR = new BN(4);
+var TWELVE = new BN(12);
+var primes = null;
+
+function _getPrimes() {
+ if (primes !== null)
+ return primes;
+
+ var limit = 0x100000;
+ var res = [];
+ res[0] = 2;
+ for (var i = 1, k = 3; k < limit; k += 2) {
+ var sqrt = Math.ceil(Math.sqrt(k));
+ for (var j = 0; j < i && res[j] <= sqrt; j++)
+ if (k % res[j] === 0)
+ break;
+
+ if (i !== j && res[j] <= sqrt)
+ continue;
+
+ res[i++] = k;
+ }
+ primes = res;
+ return res;
+}
+
+function simpleSieve(p) {
+ var primes = _getPrimes();
+
+ for (var i = 0; i < primes.length; i++)
+ if (p.modn(primes[i]) === 0) {
+ if (p.cmpn(primes[i]) === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+function fermatTest(p) {
+ var red = BN.mont(p);
+ return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
+}
+
+function findPrime(bits, gen) {
+ if (bits < 16) {
+ // this is what openssl does
+ if (gen === 2 || gen === 5) {
+ return new BN([0x8c, 0x7b]);
+ } else {
+ return new BN([0x8c, 0x27]);
+ }
+ }
+ gen = new BN(gen);
+
+ var num, n2;
+
+ while (true) {
+ num = new BN(randomBytes(Math.ceil(bits / 8)));
+ while (num.bitLength() > bits) {
+ num.ishrn(1);
+ }
+ if (num.isEven()) {
+ num.iadd(ONE);
+ }
+ if (!num.testn(1)) {
+ num.iadd(TWO);
+ }
+ if (!gen.cmp(TWO)) {
+ while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
+ num.iadd(FOUR);
+ }
+ } else if (!gen.cmp(FIVE)) {
+ while (num.mod(TEN).cmp(THREE)) {
+ num.iadd(FOUR);
+ }
+ }
+ n2 = num.shrn(1);
+ if (simpleSieve(n2) && simpleSieve(num) &&
+ fermatTest(n2) && fermatTest(num) &&
+ millerRabin.test(n2) && millerRabin.test(num)) {
+ return num;
+ }
+ }
+
+}
+
+},{"bn.js":66,"miller-rabin":956,"randombytes":1036}],542:[function(require,module,exports){
+module.exports={
+ "modp1": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"
+ },
+ "modp2": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"
+ },
+ "modp5": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"
+ },
+ "modp14": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"
+ },
+ "modp15": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"
+ },
+ "modp16": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"
+ },
+ "modp17": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"
+ },
+ "modp18": {
+ "gen": "02",
+ "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"
+ }
+}
+},{}],543:[function(require,module,exports){
+
+/**
+ * Module dependencies.
+ */
+
+var extend = require('extend');
+var encode = require('ent/encode');
+var CustomEvent = require('custom-event');
+var voidElements = require('void-elements');
+
+/**
+ * Module exports.
+ */
+
+exports = module.exports = serialize;
+exports.serializeElement = serializeElement;
+exports.serializeAttribute = serializeAttribute;
+exports.serializeText = serializeText;
+exports.serializeComment = serializeComment;
+exports.serializeDocument = serializeDocument;
+exports.serializeDoctype = serializeDoctype;
+exports.serializeDocumentFragment = serializeDocumentFragment;
+exports.serializeNodeList = serializeNodeList;
+
+/**
+ * Serializes any DOM node. Returns a string.
+ *
+ * @param {Node} node - DOM Node to serialize
+ * @param {String} [context] - optional arbitrary "context" string to use (useful for event listeners)
+ * @param {Function} [fn] - optional callback function to use in the "serialize" event for this call
+ * @param {EventTarget} [eventTarget] - optional EventTarget instance to emit the "serialize" event on (defaults to `node`)
+ * return {String}
+ * @public
+ */
+
+function serialize (node, context, fn, eventTarget) {
+ if (!node) return '';
+ if ('function' === typeof context) {
+ fn = context;
+ context = null;
+ }
+ if (!context) context = null;
+
+ var rtn;
+ var nodeType = node.nodeType;
+
+ if (!nodeType && 'number' === typeof node.length) {
+ // assume it's a NodeList or Array of Nodes
+ rtn = exports.serializeNodeList(node, context, fn);
+ } else {
+
+ if ('function' === typeof fn) {
+ // one-time "serialize" event listener
+ node.addEventListener('serialize', fn, false);
+ }
+
+ // emit a custom "serialize" event on `node`, in case there
+ // are event listeners for custom serialization of this node
+ var e = new CustomEvent('serialize', {
+ bubbles: true,
+ cancelable: true,
+ detail: {
+ serialize: null,
+ context: context
+ }
+ });
+
+ e.serializeTarget = node;
+
+ var target = eventTarget || node;
+ var cancelled = !target.dispatchEvent(e);
+
+ // `e.detail.serialize` can be set to a:
+ // String - returned directly
+ // Node - goes through serializer logic instead of `node`
+ // Anything else - get Stringified first, and then returned directly
+ var s = e.detail.serialize;
+ if (s != null) {
+ if ('string' === typeof s) {
+ rtn = s;
+ } else if ('number' === typeof s.nodeType) {
+ // make it go through the serialization logic
+ rtn = serialize(s, context, null, target);
+ } else {
+ rtn = String(s);
+ }
+ } else if (!cancelled) {
+ // default serialization logic
+ switch (nodeType) {
+ case 1 /* element */:
+ rtn = exports.serializeElement(node, context, eventTarget);
+ break;
+ case 2 /* attribute */:
+ rtn = exports.serializeAttribute(node);
+ break;
+ case 3 /* text */:
+ rtn = exports.serializeText(node);
+ break;
+ case 8 /* comment */:
+ rtn = exports.serializeComment(node);
+ break;
+ case 9 /* document */:
+ rtn = exports.serializeDocument(node, context, eventTarget);
+ break;
+ case 10 /* doctype */:
+ rtn = exports.serializeDoctype(node);
+ break;
+ case 11 /* document fragment */:
+ rtn = exports.serializeDocumentFragment(node, context, eventTarget);
+ break;
+ }
+ }
+
+ if ('function' === typeof fn) {
+ node.removeEventListener('serialize', fn, false);
+ }
+ }
+
+ return rtn || '';
+}
+
+/**
+ * Serialize an Attribute node.
+ */
+
+function serializeAttribute (node, opts) {
+ return node.name + '="' + encode(node.value, extend({
+ named: true
+ }, opts)) + '"';
+}
+
+/**
+ * Serialize a DOM element.
+ */
+
+function serializeElement (node, context, eventTarget) {
+ var c, i, l;
+ var name = node.nodeName.toLowerCase();
+
+ // opening tag
+ var r = '<' + name;
+
+ // attributes
+ for (i = 0, c = node.attributes, l = c.length; i < l; i++) {
+ r += ' ' + exports.serializeAttribute(c[i]);
+ }
+
+ r += '>';
+
+ // child nodes
+ r += exports.serializeNodeList(node.childNodes, context, null, eventTarget);
+
+ // closing tag, only for non-void elements
+ if (!voidElements[name]) {
+ r += '' + name + '>';
+ }
+
+ return r;
+}
+
+/**
+ * Serialize a text node.
+ */
+
+function serializeText (node, opts) {
+ return encode(node.nodeValue, extend({
+ named: true,
+ special: { '<': true, '>': true, '&': true }
+ }, opts));
+}
+
+/**
+ * Serialize a comment node.
+ */
+
+function serializeComment (node) {
+ return '';
+}
+
+/**
+ * Serialize a Document node.
+ */
+
+function serializeDocument (node, context, eventTarget) {
+ return exports.serializeNodeList(node.childNodes, context, null, eventTarget);
+}
+
+/**
+ * Serialize a DOCTYPE node.
+ * See: http://stackoverflow.com/a/10162353
+ */
+
+function serializeDoctype (node) {
+ var r = '';
+ return r;
+}
+
+/**
+ * Serialize a DocumentFragment instance.
+ */
+
+function serializeDocumentFragment (node, context, eventTarget) {
+ return exports.serializeNodeList(node.childNodes, context, null, eventTarget);
+}
+
+/**
+ * Serialize a NodeList/Array of nodes.
+ */
+
+function serializeNodeList (list, context, fn, eventTarget) {
+ var r = '';
+ for (var i = 0, l = list.length; i < l; i++) {
+ r += serialize(list[i], context, fn, eventTarget);
+ }
+ return r;
+}
+
+},{"custom-event":524,"ent/encode":564,"extend":710,"void-elements":1441}],544:[function(require,module,exports){
+var noCase = require('no-case')
+
+/**
+ * Dot case a string.
+ *
+ * @param {string} value
+ * @param {string} [locale]
+ * @return {string}
+ */
+module.exports = function (value, locale) {
+ return noCase(value, locale, '.')
+}
+
+},{"no-case":967}],545:[function(require,module,exports){
+var crypto = require("crypto");
+var BigInteger = require("jsbn").BigInteger;
+var ECPointFp = require("./lib/ec.js").ECPointFp;
+var Buffer = require("safer-buffer").Buffer;
+exports.ECCurves = require("./lib/sec.js");
+
+// zero prepad
+function unstupid(hex,len)
+{
+ return (hex.length >= len) ? hex : unstupid("0"+hex,len);
+}
+
+exports.ECKey = function(curve, key, isPublic)
+{
+ var priv;
+ var c = curve();
+ var n = c.getN();
+ var bytes = Math.floor(n.bitLength()/8);
+
+ if(key)
+ {
+ if(isPublic)
+ {
+ var curve = c.getCurve();
+// var x = key.slice(1,bytes+1); // skip the 04 for uncompressed format
+// var y = key.slice(bytes+1);
+// this.P = new ECPointFp(curve,
+// curve.fromBigInteger(new BigInteger(x.toString("hex"), 16)),
+// curve.fromBigInteger(new BigInteger(y.toString("hex"), 16)));
+ this.P = curve.decodePointHex(key.toString("hex"));
+ }else{
+ if(key.length != bytes) return false;
+ priv = new BigInteger(key.toString("hex"), 16);
+ }
+ }else{
+ var n1 = n.subtract(BigInteger.ONE);
+ var r = new BigInteger(crypto.randomBytes(n.bitLength()));
+ priv = r.mod(n1).add(BigInteger.ONE);
+ this.P = c.getG().multiply(priv);
+ }
+ if(this.P)
+ {
+// var pubhex = unstupid(this.P.getX().toBigInteger().toString(16),bytes*2)+unstupid(this.P.getY().toBigInteger().toString(16),bytes*2);
+// this.PublicKey = Buffer.from("04"+pubhex,"hex");
+ this.PublicKey = Buffer.from(c.getCurve().encodeCompressedPointHex(this.P),"hex");
+ }
+ if(priv)
+ {
+ this.PrivateKey = Buffer.from(unstupid(priv.toString(16),bytes*2),"hex");
+ this.deriveSharedSecret = function(key)
+ {
+ if(!key || !key.P) return false;
+ var S = key.P.multiply(priv);
+ return Buffer.from(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex");
+ }
+ }
+}
+
+
+},{"./lib/ec.js":546,"./lib/sec.js":547,"crypto":470,"jsbn":863,"safer-buffer":1335}],546:[function(require,module,exports){
+// Basic Javascript Elliptic Curve implementation
+// Ported loosely from BouncyCastle's Java EC code
+// Only Fp curves implemented for now
+
+// Requires jsbn.js and jsbn2.js
+var BigInteger = require('jsbn').BigInteger
+var Barrett = BigInteger.prototype.Barrett
+
+// ----------------
+// ECFieldElementFp
+
+// constructor
+function ECFieldElementFp(q,x) {
+ this.x = x;
+ // TODO if(x.compareTo(q) >= 0) error
+ this.q = q;
+}
+
+function feFpEquals(other) {
+ if(other == this) return true;
+ return (this.q.equals(other.q) && this.x.equals(other.x));
+}
+
+function feFpToBigInteger() {
+ return this.x;
+}
+
+function feFpNegate() {
+ return new ECFieldElementFp(this.q, this.x.negate().mod(this.q));
+}
+
+function feFpAdd(b) {
+ return new ECFieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q));
+}
+
+function feFpSubtract(b) {
+ return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q));
+}
+
+function feFpMultiply(b) {
+ return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q));
+}
+
+function feFpSquare() {
+ return new ECFieldElementFp(this.q, this.x.square().mod(this.q));
+}
+
+function feFpDivide(b) {
+ return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q));
+}
+
+ECFieldElementFp.prototype.equals = feFpEquals;
+ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger;
+ECFieldElementFp.prototype.negate = feFpNegate;
+ECFieldElementFp.prototype.add = feFpAdd;
+ECFieldElementFp.prototype.subtract = feFpSubtract;
+ECFieldElementFp.prototype.multiply = feFpMultiply;
+ECFieldElementFp.prototype.square = feFpSquare;
+ECFieldElementFp.prototype.divide = feFpDivide;
+
+// ----------------
+// ECPointFp
+
+// constructor
+function ECPointFp(curve,x,y,z) {
+ this.curve = curve;
+ this.x = x;
+ this.y = y;
+ // Projective coordinates: either zinv == null or z * zinv == 1
+ // z and zinv are just BigIntegers, not fieldElements
+ if(z == null) {
+ this.z = BigInteger.ONE;
+ }
+ else {
+ this.z = z;
+ }
+ this.zinv = null;
+ //TODO: compression flag
+}
+
+function pointFpGetX() {
+ if(this.zinv == null) {
+ this.zinv = this.z.modInverse(this.curve.q);
+ }
+ var r = this.x.toBigInteger().multiply(this.zinv);
+ this.curve.reduce(r);
+ return this.curve.fromBigInteger(r);
+}
+
+function pointFpGetY() {
+ if(this.zinv == null) {
+ this.zinv = this.z.modInverse(this.curve.q);
+ }
+ var r = this.y.toBigInteger().multiply(this.zinv);
+ this.curve.reduce(r);
+ return this.curve.fromBigInteger(r);
+}
+
+function pointFpEquals(other) {
+ if(other == this) return true;
+ if(this.isInfinity()) return other.isInfinity();
+ if(other.isInfinity()) return this.isInfinity();
+ var u, v;
+ // u = Y2 * Z1 - Y1 * Z2
+ u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q);
+ if(!u.equals(BigInteger.ZERO)) return false;
+ // v = X2 * Z1 - X1 * Z2
+ v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q);
+ return v.equals(BigInteger.ZERO);
+}
+
+function pointFpIsInfinity() {
+ if((this.x == null) && (this.y == null)) return true;
+ return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO);
+}
+
+function pointFpNegate() {
+ return new ECPointFp(this.curve, this.x, this.y.negate(), this.z);
+}
+
+function pointFpAdd(b) {
+ if(this.isInfinity()) return b;
+ if(b.isInfinity()) return this;
+
+ // u = Y2 * Z1 - Y1 * Z2
+ var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q);
+ // v = X2 * Z1 - X1 * Z2
+ var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q);
+
+ if(BigInteger.ZERO.equals(v)) {
+ if(BigInteger.ZERO.equals(u)) {
+ return this.twice(); // this == b, so double
+ }
+ return this.curve.getInfinity(); // this = -b, so infinity
+ }
+
+ var THREE = new BigInteger("3");
+ var x1 = this.x.toBigInteger();
+ var y1 = this.y.toBigInteger();
+ var x2 = b.x.toBigInteger();
+ var y2 = b.y.toBigInteger();
+
+ var v2 = v.square();
+ var v3 = v2.multiply(v);
+ var x1v2 = x1.multiply(v2);
+ var zu2 = u.square().multiply(this.z);
+
+ // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
+ var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q);
+ // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
+ var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q);
+ // z3 = v^3 * z1 * z2
+ var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q);
+
+ return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
+}
+
+function pointFpTwice() {
+ if(this.isInfinity()) return this;
+ if(this.y.toBigInteger().signum() == 0) return this.curve.getInfinity();
+
+ // TODO: optimized handling of constants
+ var THREE = new BigInteger("3");
+ var x1 = this.x.toBigInteger();
+ var y1 = this.y.toBigInteger();
+
+ var y1z1 = y1.multiply(this.z);
+ var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q);
+ var a = this.curve.a.toBigInteger();
+
+ // w = 3 * x1^2 + a * z1^2
+ var w = x1.square().multiply(THREE);
+ if(!BigInteger.ZERO.equals(a)) {
+ w = w.add(this.z.square().multiply(a));
+ }
+ w = w.mod(this.curve.q);
+ //this.curve.reduce(w);
+ // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
+ var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q);
+ // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
+ var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q);
+ // z3 = 8 * (y1 * z1)^3
+ var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q);
+
+ return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
+}
+
+// Simple NAF (Non-Adjacent Form) multiplication algorithm
+// TODO: modularize the multiplication algorithm
+function pointFpMultiply(k) {
+ if(this.isInfinity()) return this;
+ if(k.signum() == 0) return this.curve.getInfinity();
+
+ var e = k;
+ var h = e.multiply(new BigInteger("3"));
+
+ var neg = this.negate();
+ var R = this;
+
+ var i;
+ for(i = h.bitLength() - 2; i > 0; --i) {
+ R = R.twice();
+
+ var hBit = h.testBit(i);
+ var eBit = e.testBit(i);
+
+ if (hBit != eBit) {
+ R = R.add(hBit ? this : neg);
+ }
+ }
+
+ return R;
+}
+
+// Compute this*j + x*k (simultaneous multiplication)
+function pointFpMultiplyTwo(j,x,k) {
+ var i;
+ if(j.bitLength() > k.bitLength())
+ i = j.bitLength() - 1;
+ else
+ i = k.bitLength() - 1;
+
+ var R = this.curve.getInfinity();
+ var both = this.add(x);
+ while(i >= 0) {
+ R = R.twice();
+ if(j.testBit(i)) {
+ if(k.testBit(i)) {
+ R = R.add(both);
+ }
+ else {
+ R = R.add(this);
+ }
+ }
+ else {
+ if(k.testBit(i)) {
+ R = R.add(x);
+ }
+ }
+ --i;
+ }
+
+ return R;
+}
+
+ECPointFp.prototype.getX = pointFpGetX;
+ECPointFp.prototype.getY = pointFpGetY;
+ECPointFp.prototype.equals = pointFpEquals;
+ECPointFp.prototype.isInfinity = pointFpIsInfinity;
+ECPointFp.prototype.negate = pointFpNegate;
+ECPointFp.prototype.add = pointFpAdd;
+ECPointFp.prototype.twice = pointFpTwice;
+ECPointFp.prototype.multiply = pointFpMultiply;
+ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo;
+
+// ----------------
+// ECCurveFp
+
+// constructor
+function ECCurveFp(q,a,b) {
+ this.q = q;
+ this.a = this.fromBigInteger(a);
+ this.b = this.fromBigInteger(b);
+ this.infinity = new ECPointFp(this, null, null);
+ this.reducer = new Barrett(this.q);
+}
+
+function curveFpGetQ() {
+ return this.q;
+}
+
+function curveFpGetA() {
+ return this.a;
+}
+
+function curveFpGetB() {
+ return this.b;
+}
+
+function curveFpEquals(other) {
+ if(other == this) return true;
+ return(this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b));
+}
+
+function curveFpGetInfinity() {
+ return this.infinity;
+}
+
+function curveFpFromBigInteger(x) {
+ return new ECFieldElementFp(this.q, x);
+}
+
+function curveReduce(x) {
+ this.reducer.reduce(x);
+}
+
+// for now, work with hex strings because they're easier in JS
+function curveFpDecodePointHex(s) {
+ switch(parseInt(s.substr(0,2), 16)) { // first byte
+ case 0:
+ return this.infinity;
+ case 2:
+ case 3:
+ // point compression not supported yet
+ return null;
+ case 4:
+ case 6:
+ case 7:
+ var len = (s.length - 2) / 2;
+ var xHex = s.substr(2, len);
+ var yHex = s.substr(len+2, len);
+
+ return new ECPointFp(this,
+ this.fromBigInteger(new BigInteger(xHex, 16)),
+ this.fromBigInteger(new BigInteger(yHex, 16)));
+
+ default: // unsupported
+ return null;
+ }
+}
+
+function curveFpEncodePointHex(p) {
+ if (p.isInfinity()) return "00";
+ var xHex = p.getX().toBigInteger().toString(16);
+ var yHex = p.getY().toBigInteger().toString(16);
+ var oLen = this.getQ().toString(16).length;
+ if ((oLen % 2) != 0) oLen++;
+ while (xHex.length < oLen) {
+ xHex = "0" + xHex;
+ }
+ while (yHex.length < oLen) {
+ yHex = "0" + yHex;
+ }
+ return "04" + xHex + yHex;
+}
+
+ECCurveFp.prototype.getQ = curveFpGetQ;
+ECCurveFp.prototype.getA = curveFpGetA;
+ECCurveFp.prototype.getB = curveFpGetB;
+ECCurveFp.prototype.equals = curveFpEquals;
+ECCurveFp.prototype.getInfinity = curveFpGetInfinity;
+ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger;
+ECCurveFp.prototype.reduce = curveReduce;
+//ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex;
+ECCurveFp.prototype.encodePointHex = curveFpEncodePointHex;
+
+// from: https://github.com/kaielvin/jsbn-ec-point-compression
+ECCurveFp.prototype.decodePointHex = function(s)
+{
+ var yIsEven;
+ switch(parseInt(s.substr(0,2), 16)) { // first byte
+ case 0:
+ return this.infinity;
+ case 2:
+ yIsEven = false;
+ case 3:
+ if(yIsEven == undefined) yIsEven = true;
+ var len = s.length - 2;
+ var xHex = s.substr(2, len);
+ var x = this.fromBigInteger(new BigInteger(xHex,16));
+ var alpha = x.multiply(x.square().add(this.getA())).add(this.getB());
+ var beta = alpha.sqrt();
+
+ if (beta == null) throw "Invalid point compression";
+
+ var betaValue = beta.toBigInteger();
+ if (betaValue.testBit(0) != yIsEven)
+ {
+ // Use the other root
+ beta = this.fromBigInteger(this.getQ().subtract(betaValue));
+ }
+ return new ECPointFp(this,x,beta);
+ case 4:
+ case 6:
+ case 7:
+ var len = (s.length - 2) / 2;
+ var xHex = s.substr(2, len);
+ var yHex = s.substr(len+2, len);
+
+ return new ECPointFp(this,
+ this.fromBigInteger(new BigInteger(xHex, 16)),
+ this.fromBigInteger(new BigInteger(yHex, 16)));
+
+ default: // unsupported
+ return null;
+ }
+}
+ECCurveFp.prototype.encodeCompressedPointHex = function(p)
+{
+ if (p.isInfinity()) return "00";
+ var xHex = p.getX().toBigInteger().toString(16);
+ var oLen = this.getQ().toString(16).length;
+ if ((oLen % 2) != 0) oLen++;
+ while (xHex.length < oLen)
+ xHex = "0" + xHex;
+ var yPrefix;
+ if(p.getY().toBigInteger().isEven()) yPrefix = "02";
+ else yPrefix = "03";
+
+ return yPrefix + xHex;
+}
+
+
+ECFieldElementFp.prototype.getR = function()
+{
+ if(this.r != undefined) return this.r;
+
+ this.r = null;
+ var bitLength = this.q.bitLength();
+ if (bitLength > 128)
+ {
+ var firstWord = this.q.shiftRight(bitLength - 64);
+ if (firstWord.intValue() == -1)
+ {
+ this.r = BigInteger.ONE.shiftLeft(bitLength).subtract(this.q);
+ }
+ }
+ return this.r;
+}
+ECFieldElementFp.prototype.modMult = function(x1,x2)
+{
+ return this.modReduce(x1.multiply(x2));
+}
+ECFieldElementFp.prototype.modReduce = function(x)
+{
+ if (this.getR() != null)
+ {
+ var qLen = q.bitLength();
+ while (x.bitLength() > (qLen + 1))
+ {
+ var u = x.shiftRight(qLen);
+ var v = x.subtract(u.shiftLeft(qLen));
+ if (!this.getR().equals(BigInteger.ONE))
+ {
+ u = u.multiply(this.getR());
+ }
+ x = u.add(v);
+ }
+ while (x.compareTo(q) >= 0)
+ {
+ x = x.subtract(q);
+ }
+ }
+ else
+ {
+ x = x.mod(q);
+ }
+ return x;
+}
+ECFieldElementFp.prototype.sqrt = function()
+{
+ if (!this.q.testBit(0)) throw "unsupported";
+
+ // p mod 4 == 3
+ if (this.q.testBit(1))
+ {
+ var z = new ECFieldElementFp(this.q,this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),this.q));
+ return z.square().equals(this) ? z : null;
+ }
+
+ // p mod 4 == 1
+ var qMinusOne = this.q.subtract(BigInteger.ONE);
+
+ var legendreExponent = qMinusOne.shiftRight(1);
+ if (!(this.x.modPow(legendreExponent, this.q).equals(BigInteger.ONE)))
+ {
+ return null;
+ }
+
+ var u = qMinusOne.shiftRight(2);
+ var k = u.shiftLeft(1).add(BigInteger.ONE);
+
+ var Q = this.x;
+ var fourQ = modDouble(modDouble(Q));
+
+ var U, V;
+ do
+ {
+ var P;
+ do
+ {
+ P = new BigInteger(this.q.bitLength(), new SecureRandom());
+ }
+ while (P.compareTo(this.q) >= 0
+ || !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, this.q).equals(qMinusOne)));
+
+ var result = this.lucasSequence(P, Q, k);
+ U = result[0];
+ V = result[1];
+
+ if (this.modMult(V, V).equals(fourQ))
+ {
+ // Integer division by 2, mod q
+ if (V.testBit(0))
+ {
+ V = V.add(q);
+ }
+
+ V = V.shiftRight(1);
+
+ return new ECFieldElementFp(q,V);
+ }
+ }
+ while (U.equals(BigInteger.ONE) || U.equals(qMinusOne));
+
+ return null;
+}
+ECFieldElementFp.prototype.lucasSequence = function(P,Q,k)
+{
+ var n = k.bitLength();
+ var s = k.getLowestSetBit();
+
+ var Uh = BigInteger.ONE;
+ var Vl = BigInteger.TWO;
+ var Vh = P;
+ var Ql = BigInteger.ONE;
+ var Qh = BigInteger.ONE;
+
+ for (var j = n - 1; j >= s + 1; --j)
+ {
+ Ql = this.modMult(Ql, Qh);
+
+ if (k.testBit(j))
+ {
+ Qh = this.modMult(Ql, Q);
+ Uh = this.modMult(Uh, Vh);
+ Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
+ Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1)));
+ }
+ else
+ {
+ Qh = Ql;
+ Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql));
+ Vh = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
+ Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1)));
+ }
+ }
+
+ Ql = this.modMult(Ql, Qh);
+ Qh = this.modMult(Ql, Q);
+ Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql));
+ Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql)));
+ Ql = this.modMult(Ql, Qh);
+
+ for (var j = 1; j <= s; ++j)
+ {
+ Uh = this.modMult(Uh, Vl);
+ Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1)));
+ Ql = this.modMult(Ql, Ql);
+ }
+
+ return [ Uh, Vl ];
+}
+
+var exports = {
+ ECCurveFp: ECCurveFp,
+ ECPointFp: ECPointFp,
+ ECFieldElementFp: ECFieldElementFp
+}
+
+module.exports = exports
+
+},{"jsbn":863}],547:[function(require,module,exports){
+// Named EC curves
+
+// Requires ec.js, jsbn.js, and jsbn2.js
+var BigInteger = require('jsbn').BigInteger
+var ECCurveFp = require('./ec.js').ECCurveFp
+
+
+// ----------------
+// X9ECParameters
+
+// constructor
+function X9ECParameters(curve,g,n,h) {
+ this.curve = curve;
+ this.g = g;
+ this.n = n;
+ this.h = h;
+}
+
+function x9getCurve() {
+ return this.curve;
+}
+
+function x9getG() {
+ return this.g;
+}
+
+function x9getN() {
+ return this.n;
+}
+
+function x9getH() {
+ return this.h;
+}
+
+X9ECParameters.prototype.getCurve = x9getCurve;
+X9ECParameters.prototype.getG = x9getG;
+X9ECParameters.prototype.getN = x9getN;
+X9ECParameters.prototype.getH = x9getH;
+
+// ----------------
+// SECNamedCurves
+
+function fromHex(s) { return new BigInteger(s, 16); }
+
+function secp128r1() {
+ // p = 2^128 - 2^97 - 1
+ var p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF");
+ var a = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC");
+ var b = fromHex("E87579C11079F43DD824993C2CEE5ED3");
+ //byte[] S = Hex.decode("000E0D4D696E6768756151750CC03A4473D03679");
+ var n = fromHex("FFFFFFFE0000000075A30D1B9038A115");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "161FF7528B899B2D0C28607CA52C5B86"
+ + "CF5AC8395BAFEB13C02DA292DDED7A83");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp160k1() {
+ // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73");
+ var a = BigInteger.ZERO;
+ var b = fromHex("7");
+ //byte[] S = null;
+ var n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"
+ + "938CF935318FDCED6BC28286531733C3F03C4FEE");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp160r1() {
+ // p = 2^160 - 2^31 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF");
+ var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC");
+ var b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45");
+ //byte[] S = Hex.decode("1053CDE42C14D696E67687561517533BF3F83345");
+ var n = fromHex("0100000000000000000001F4C8F927AED3CA752257");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "4A96B5688EF573284664698968C38BB913CBFC82"
+ + "23A628553168947D59DCC912042351377AC5FB32");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp192k1() {
+ // p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37");
+ var a = BigInteger.ZERO;
+ var b = fromHex("3");
+ //byte[] S = null;
+ var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D"
+ + "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp192r1() {
+ // p = 2^192 - 2^64 - 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF");
+ var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC");
+ var b = fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1");
+ //byte[] S = Hex.decode("3045AE6FC8422F64ED579528D38120EAE12196D5");
+ var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012"
+ + "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp224r1() {
+ // p = 2^224 - 2^96 + 1
+ var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001");
+ var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE");
+ var b = fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4");
+ //byte[] S = Hex.decode("BD71344799D5C7FCDC45B59FA3B9AB8F6A948BC5");
+ var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21"
+ + "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+function secp256r1() {
+ // p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1
+ var p = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF");
+ var a = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC");
+ var b = fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B");
+ //byte[] S = Hex.decode("C49D360886E704936A6678E1139D26B7819F7E90");
+ var n = fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551");
+ var h = BigInteger.ONE;
+ var curve = new ECCurveFp(p, a, b);
+ var G = curve.decodePointHex("04"
+ + "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296"
+ + "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5");
+ return new X9ECParameters(curve, G, n, h);
+}
+
+// TODO: make this into a proper hashtable
+function getSECCurveByName(name) {
+ if(name == "secp128r1") return secp128r1();
+ if(name == "secp160k1") return secp160k1();
+ if(name == "secp160r1") return secp160r1();
+ if(name == "secp192k1") return secp192k1();
+ if(name == "secp192r1") return secp192r1();
+ if(name == "secp224r1") return secp224r1();
+ if(name == "secp256r1") return secp256r1();
+ return null;
+}
+
+module.exports = {
+ "secp128r1":secp128r1,
+ "secp160k1":secp160k1,
+ "secp160r1":secp160r1,
+ "secp192k1":secp192k1,
+ "secp192r1":secp192r1,
+ "secp224r1":secp224r1,
+ "secp256r1":secp256r1
+}
+
+},{"./ec.js":546,"jsbn":863}],548:[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.curve = require('./elliptic/curve');
+elliptic.curves = require('./elliptic/curves');
+
+// Protocols
+elliptic.ec = require('./elliptic/ec');
+elliptic.eddsa = require('./elliptic/eddsa');
+
+},{"../package.json":563,"./elliptic/curve":551,"./elliptic/curves":554,"./elliptic/ec":555,"./elliptic/eddsa":558,"./elliptic/utils":562,"brorand":76}],549:[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":548,"bn.js":66}],550:[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 EdwardsCurve(conf) {
+ // NOTE: Important as we are creating point in Base.call()
+ this.twisted = (conf.a | 0) !== 1;
+ this.mOneA = this.twisted && (conf.a | 0) === -1;
+ this.extended = this.mOneA;
+
+ Base.call(this, 'edwards', conf);
+
+ this.a = new BN(conf.a, 16).umod(this.red.m);
+ this.a = this.a.toRed(this.red);
+ this.c = new BN(conf.c, 16).toRed(this.red);
+ this.c2 = this.c.redSqr();
+ this.d = new BN(conf.d, 16).toRed(this.red);
+ this.dd = this.d.redAdd(this.d);
+
+ assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
+ this.oneC = (conf.c | 0) === 1;
+}
+inherits(EdwardsCurve, Base);
+module.exports = EdwardsCurve;
+
+EdwardsCurve.prototype._mulA = function _mulA(num) {
+ if (this.mOneA)
+ return num.redNeg();
+ else
+ return this.a.redMul(num);
+};
+
+EdwardsCurve.prototype._mulC = function _mulC(num) {
+ if (this.oneC)
+ return num;
+ else
+ return this.c.redMul(num);
+};
+
+// Just for compatibility with Short curve
+EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
+ return this.point(x, y, z, t);
+};
+
+EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
+ x = new BN(x, 16);
+ if (!x.red)
+ x = x.toRed(this.red);
+
+ var x2 = x.redSqr();
+ var rhs = this.c2.redSub(this.a.redMul(x2));
+ var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
+
+ var y2 = rhs.redMul(lhs.redInvm());
+ var y = y2.redSqrt();
+ if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
+ throw new Error('invalid point');
+
+ var isOdd = y.fromRed().isOdd();
+ if (odd && !isOdd || !odd && isOdd)
+ y = y.redNeg();
+
+ return this.point(x, y);
+};
+
+EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
+ y = new BN(y, 16);
+ if (!y.red)
+ y = y.toRed(this.red);
+
+ // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
+ var y2 = y.redSqr();
+ var lhs = y2.redSub(this.c2);
+ var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
+ var x2 = lhs.redMul(rhs.redInvm());
+
+ if (x2.cmp(this.zero) === 0) {
+ if (odd)
+ throw new Error('invalid point');
+ else
+ return this.point(this.zero, y);
+ }
+
+ var x = x2.redSqrt();
+ if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
+ throw new Error('invalid point');
+
+ if (x.fromRed().isOdd() !== odd)
+ x = x.redNeg();
+
+ return this.point(x, y);
+};
+
+EdwardsCurve.prototype.validate = function validate(point) {
+ if (point.isInfinity())
+ return true;
+
+ // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
+ point.normalize();
+
+ var x2 = point.x.redSqr();
+ var y2 = point.y.redSqr();
+ var lhs = x2.redMul(this.a).redAdd(y2);
+ var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
+
+ return lhs.cmp(rhs) === 0;
+};
+
+function Point(curve, x, y, z, t) {
+ Base.BasePoint.call(this, curve, 'projective');
+ if (x === null && y === null && z === null) {
+ this.x = this.curve.zero;
+ this.y = this.curve.one;
+ this.z = this.curve.one;
+ this.t = this.curve.zero;
+ this.zOne = true;
+ } else {
+ this.x = new BN(x, 16);
+ this.y = new BN(y, 16);
+ this.z = z ? new BN(z, 16) : this.curve.one;
+ this.t = t && new BN(t, 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);
+ if (this.t && !this.t.red)
+ this.t = this.t.toRed(this.curve.red);
+ this.zOne = this.z === this.curve.one;
+
+ // Use extended coordinates
+ if (this.curve.extended && !this.t) {
+ this.t = this.x.redMul(this.y);
+ if (!this.zOne)
+ this.t = this.t.redMul(this.z.redInvm());
+ }
+ }
+}
+inherits(Point, Base.BasePoint);
+
+EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
+ return Point.fromJSON(this, obj);
+};
+
+EdwardsCurve.prototype.point = function point(x, y, z, t) {
+ return new Point(this, x, y, z, t);
+};
+
+Point.fromJSON = function fromJSON(curve, obj) {
+ return new Point(curve, obj[0], obj[1], obj[2]);
+};
+
+Point.prototype.inspect = function inspect() {
+ if (this.isInfinity())
+ return '';
+ return '';
+};
+
+Point.prototype.isInfinity = function isInfinity() {
+ // XXX This code assumes that zero is always zero in red
+ return this.x.cmpn(0) === 0 &&
+ (this.y.cmp(this.z) === 0 ||
+ (this.zOne && this.y.cmp(this.curve.c) === 0));
+};
+
+Point.prototype._extDbl = function _extDbl() {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
+ // #doubling-dbl-2008-hwcd
+ // 4M + 4S
+
+ // A = X1^2
+ var a = this.x.redSqr();
+ // B = Y1^2
+ var b = this.y.redSqr();
+ // C = 2 * Z1^2
+ var c = this.z.redSqr();
+ c = c.redIAdd(c);
+ // D = a * A
+ var d = this.curve._mulA(a);
+ // E = (X1 + Y1)^2 - A - B
+ var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
+ // G = D + B
+ var g = d.redAdd(b);
+ // F = G - C
+ var f = g.redSub(c);
+ // H = D - B
+ var h = d.redSub(b);
+ // X3 = E * F
+ var nx = e.redMul(f);
+ // Y3 = G * H
+ var ny = g.redMul(h);
+ // T3 = E * H
+ var nt = e.redMul(h);
+ // Z3 = F * G
+ var nz = f.redMul(g);
+ return this.curve.point(nx, ny, nz, nt);
+};
+
+Point.prototype._projDbl = function _projDbl() {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
+ // #doubling-dbl-2008-bbjlp
+ // #doubling-dbl-2007-bl
+ // and others
+ // Generally 3M + 4S or 2M + 4S
+
+ // B = (X1 + Y1)^2
+ var b = this.x.redAdd(this.y).redSqr();
+ // C = X1^2
+ var c = this.x.redSqr();
+ // D = Y1^2
+ var d = this.y.redSqr();
+
+ var nx;
+ var ny;
+ var nz;
+ if (this.curve.twisted) {
+ // E = a * C
+ var e = this.curve._mulA(c);
+ // F = E + D
+ var f = e.redAdd(d);
+ if (this.zOne) {
+ // X3 = (B - C - D) * (F - 2)
+ nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
+ // Y3 = F * (E - D)
+ ny = f.redMul(e.redSub(d));
+ // Z3 = F^2 - 2 * F
+ nz = f.redSqr().redSub(f).redSub(f);
+ } else {
+ // H = Z1^2
+ var h = this.z.redSqr();
+ // J = F - 2 * H
+ var j = f.redSub(h).redISub(h);
+ // X3 = (B-C-D)*J
+ nx = b.redSub(c).redISub(d).redMul(j);
+ // Y3 = F * (E - D)
+ ny = f.redMul(e.redSub(d));
+ // Z3 = F * J
+ nz = f.redMul(j);
+ }
+ } else {
+ // E = C + D
+ var e = c.redAdd(d);
+ // H = (c * Z1)^2
+ var h = this.curve._mulC(this.z).redSqr();
+ // J = E - 2 * H
+ var j = e.redSub(h).redSub(h);
+ // X3 = c * (B - E) * J
+ nx = this.curve._mulC(b.redISub(e)).redMul(j);
+ // Y3 = c * E * (C - D)
+ ny = this.curve._mulC(e).redMul(c.redISub(d));
+ // Z3 = E * J
+ nz = e.redMul(j);
+ }
+ return this.curve.point(nx, ny, nz);
+};
+
+Point.prototype.dbl = function dbl() {
+ if (this.isInfinity())
+ return this;
+
+ // Double in extended coordinates
+ if (this.curve.extended)
+ return this._extDbl();
+ else
+ return this._projDbl();
+};
+
+Point.prototype._extAdd = function _extAdd(p) {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
+ // #addition-add-2008-hwcd-3
+ // 8M
+
+ // A = (Y1 - X1) * (Y2 - X2)
+ var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
+ // B = (Y1 + X1) * (Y2 + X2)
+ var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
+ // C = T1 * k * T2
+ var c = this.t.redMul(this.curve.dd).redMul(p.t);
+ // D = Z1 * 2 * Z2
+ var d = this.z.redMul(p.z.redAdd(p.z));
+ // E = B - A
+ var e = b.redSub(a);
+ // F = D - C
+ var f = d.redSub(c);
+ // G = D + C
+ var g = d.redAdd(c);
+ // H = B + A
+ var h = b.redAdd(a);
+ // X3 = E * F
+ var nx = e.redMul(f);
+ // Y3 = G * H
+ var ny = g.redMul(h);
+ // T3 = E * H
+ var nt = e.redMul(h);
+ // Z3 = F * G
+ var nz = f.redMul(g);
+ return this.curve.point(nx, ny, nz, nt);
+};
+
+Point.prototype._projAdd = function _projAdd(p) {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
+ // #addition-add-2008-bbjlp
+ // #addition-add-2007-bl
+ // 10M + 1S
+
+ // A = Z1 * Z2
+ var a = this.z.redMul(p.z);
+ // B = A^2
+ var b = a.redSqr();
+ // C = X1 * X2
+ var c = this.x.redMul(p.x);
+ // D = Y1 * Y2
+ var d = this.y.redMul(p.y);
+ // E = d * C * D
+ var e = this.curve.d.redMul(c).redMul(d);
+ // F = B - E
+ var f = b.redSub(e);
+ // G = B + E
+ var g = b.redAdd(e);
+ // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
+ var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
+ var nx = a.redMul(f).redMul(tmp);
+ var ny;
+ var nz;
+ if (this.curve.twisted) {
+ // Y3 = A * G * (D - a * C)
+ ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
+ // Z3 = F * G
+ nz = f.redMul(g);
+ } else {
+ // Y3 = A * G * (D - C)
+ ny = a.redMul(g).redMul(d.redSub(c));
+ // Z3 = c * F * G
+ nz = this.curve._mulC(f).redMul(g);
+ }
+ return this.curve.point(nx, ny, nz);
+};
+
+Point.prototype.add = function add(p) {
+ if (this.isInfinity())
+ return p;
+ if (p.isInfinity())
+ return this;
+
+ if (this.curve.extended)
+ return this._extAdd(p);
+ else
+ return this._projAdd(p);
+};
+
+Point.prototype.mul = function mul(k) {
+ if (this._hasDoubles(k))
+ return this.curve._fixedNafMul(this, k);
+ else
+ return this.curve._wnafMul(this, k);
+};
+
+Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
+ return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
+};
+
+Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
+ return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
+};
+
+Point.prototype.normalize = function normalize() {
+ if (this.zOne)
+ return this;
+
+ // Normalize coordinates
+ var zi = this.z.redInvm();
+ this.x = this.x.redMul(zi);
+ this.y = this.y.redMul(zi);
+ if (this.t)
+ this.t = this.t.redMul(zi);
+ this.z = this.curve.one;
+ this.zOne = true;
+ return this;
+};
+
+Point.prototype.neg = function neg() {
+ return this.curve.point(this.x.redNeg(),
+ this.y,
+ this.z,
+ this.t && this.t.redNeg());
+};
+
+Point.prototype.getX = function getX() {
+ this.normalize();
+ return this.x.fromRed();
+};
+
+Point.prototype.getY = function getY() {
+ this.normalize();
+ return this.y.fromRed();
+};
+
+Point.prototype.eq = function eq(other) {
+ return this === other ||
+ this.getX().cmp(other.getX()) === 0 &&
+ this.getY().cmp(other.getY()) === 0;
+};
+
+Point.prototype.eqXToP = function eqXToP(x) {
+ var rx = x.toRed(this.curve.red).redMul(this.z);
+ if (this.x.cmp(rx) === 0)
+ return true;
+
+ var xc = x.clone();
+ var t = this.curve.redN.redMul(this.z);
+ 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;
+ }
+};
+
+// Compatibility with BaseCurve
+Point.prototype.toP = Point.prototype.normalize;
+Point.prototype.mixedAdd = Point.prototype.add;
+
+},{"../../elliptic":548,"../curve":551,"bn.js":66,"inherits":834}],551:[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":549,"./edwards":550,"./mont":552,"./short":553}],552:[function(require,module,exports){
+'use strict';
+
+var curve = require('../curve');
+var BN = require('bn.js');
+var inherits = require('inherits');
+var Base = curve.base;
+
+var elliptic = require('../../elliptic');
+var utils = elliptic.utils;
+
+function MontCurve(conf) {
+ Base.call(this, 'mont', conf);
+
+ this.a = new BN(conf.a, 16).toRed(this.red);
+ this.b = new BN(conf.b, 16).toRed(this.red);
+ this.i4 = new BN(4).toRed(this.red).redInvm();
+ this.two = new BN(2).toRed(this.red);
+ this.a24 = this.i4.redMul(this.a.redAdd(this.two));
+}
+inherits(MontCurve, Base);
+module.exports = MontCurve;
+
+MontCurve.prototype.validate = function validate(point) {
+ var x = point.normalize().x;
+ var x2 = x.redSqr();
+ var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
+ var y = rhs.redSqrt();
+
+ return y.redSqr().cmp(rhs) === 0;
+};
+
+function Point(curve, x, z) {
+ Base.BasePoint.call(this, curve, 'projective');
+ if (x === null && z === null) {
+ this.x = this.curve.one;
+ this.z = this.curve.zero;
+ } else {
+ this.x = new BN(x, 16);
+ this.z = new BN(z, 16);
+ if (!this.x.red)
+ this.x = this.x.toRed(this.curve.red);
+ if (!this.z.red)
+ this.z = this.z.toRed(this.curve.red);
+ }
+}
+inherits(Point, Base.BasePoint);
+
+MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
+ return this.point(utils.toArray(bytes, enc), 1);
+};
+
+MontCurve.prototype.point = function point(x, z) {
+ return new Point(this, x, z);
+};
+
+MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
+ return Point.fromJSON(this, obj);
+};
+
+Point.prototype.precompute = function precompute() {
+ // No-op
+};
+
+Point.prototype._encode = function _encode() {
+ return this.getX().toArray('be', this.curve.p.byteLength());
+};
+
+Point.fromJSON = function fromJSON(curve, obj) {
+ return new Point(curve, obj[0], obj[1] || curve.one);
+};
+
+Point.prototype.inspect = function inspect() {
+ if (this.isInfinity())
+ return '';
+ return '';
+};
+
+Point.prototype.isInfinity = function isInfinity() {
+ // XXX This code assumes that zero is always zero in red
+ return this.z.cmpn(0) === 0;
+};
+
+Point.prototype.dbl = function dbl() {
+ // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
+ // 2M + 2S + 4A
+
+ // A = X1 + Z1
+ var a = this.x.redAdd(this.z);
+ // AA = A^2
+ var aa = a.redSqr();
+ // B = X1 - Z1
+ var b = this.x.redSub(this.z);
+ // BB = B^2
+ var bb = b.redSqr();
+ // C = AA - BB
+ var c = aa.redSub(bb);
+ // X3 = AA * BB
+ var nx = aa.redMul(bb);
+ // Z3 = C * (BB + A24 * C)
+ var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
+ return this.curve.point(nx, nz);
+};
+
+Point.prototype.add = function add() {
+ throw new Error('Not supported on Montgomery curve');
+};
+
+Point.prototype.diffAdd = function diffAdd(p, diff) {
+ // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
+ // 4M + 2S + 6A
+
+ // A = X2 + Z2
+ var a = this.x.redAdd(this.z);
+ // B = X2 - Z2
+ var b = this.x.redSub(this.z);
+ // C = X3 + Z3
+ var c = p.x.redAdd(p.z);
+ // D = X3 - Z3
+ var d = p.x.redSub(p.z);
+ // DA = D * A
+ var da = d.redMul(a);
+ // CB = C * B
+ var cb = c.redMul(b);
+ // X5 = Z1 * (DA + CB)^2
+ var nx = diff.z.redMul(da.redAdd(cb).redSqr());
+ // Z5 = X1 * (DA - CB)^2
+ var nz = diff.x.redMul(da.redISub(cb).redSqr());
+ return this.curve.point(nx, nz);
+};
+
+Point.prototype.mul = function mul(k) {
+ var t = k.clone();
+ var a = this; // (N / 2) * Q + Q
+ var b = this.curve.point(null, null); // (N / 2) * Q
+ var c = this; // Q
+
+ for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
+ bits.push(t.andln(1));
+
+ for (var i = bits.length - 1; i >= 0; i--) {
+ if (bits[i] === 0) {
+ // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
+ a = a.diffAdd(b, c);
+ // N * Q = 2 * ((N / 2) * Q + Q))
+ b = b.dbl();
+ } else {
+ // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
+ b = a.diffAdd(b, c);
+ // N * Q + Q = 2 * ((N / 2) * Q + Q)
+ a = a.dbl();
+ }
+ }
+ return b;
+};
+
+Point.prototype.mulAdd = function mulAdd() {
+ throw new Error('Not supported on Montgomery curve');
+};
+
+Point.prototype.jumlAdd = function jumlAdd() {
+ throw new Error('Not supported on Montgomery curve');
+};
+
+Point.prototype.eq = function eq(other) {
+ return this.getX().cmp(other.getX()) === 0;
+};
+
+Point.prototype.normalize = function normalize() {
+ this.x = this.x.redMul(this.z.redInvm());
+ this.z = this.curve.one;
+ return this;
+};
+
+Point.prototype.getX = function getX() {
+ // Normalize coordinates
+ this.normalize();
+
+ return this.x.fromRed();
+};
+
+},{"../../elliptic":548,"../curve":551,"bn.js":66,"inherits":834}],553:[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 '';
+ return '';
+};
+
+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;
+ }
+};
+
+JPoint.prototype.inspect = function inspect() {
+ if (this.isInfinity())
+ return '';
+ return '';
+};
+
+JPoint.prototype.isInfinity = function isInfinity() {
+ // XXX This code assumes that zero is always zero in red
+ return this.z.cmpn(0) === 0;
+};
+
+},{"../../elliptic":548,"../curve":551,"bn.js":66,"inherits":834}],554:[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":548,"./precomputed/secp256k1":561,"hash.js":803}],555:[function(require,module,exports){
+'use strict';
+
+var BN = require('bn.js');
+var HmacDRBG = require('hmac-drbg');
+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 HmacDRBG({
+ hash: this.hash,
+ pers: options.pers,
+ persEnc: options.persEnc || 'utf8',
+ entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
+ entropyEnc: options.entropy && options.entropyEnc || 'utf8',
+ 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 HmacDRBG({
+ hash: this.hash,
+ entropy: bkey,
+ nonce: nonce,
+ pers: options.pers,
+ persEnc: options.persEnc || 'utf8'
+ });
+
+ // 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":548,"./key":556,"./signature":557,"bn.js":66,"hmac-drbg":816}],556:[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 '';
+};
+
+},{"../../elliptic":548,"bn.js":66}],557:[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":548,"bn.js":66}],558:[function(require,module,exports){
+'use strict';
+
+var hash = require('hash.js');
+var elliptic = require('../../elliptic');
+var utils = elliptic.utils;
+var assert = utils.assert;
+var parseBytes = utils.parseBytes;
+var KeyPair = require('./key');
+var Signature = require('./signature');
+
+function EDDSA(curve) {
+ assert(curve === 'ed25519', 'only tested with ed25519 so far');
+
+ if (!(this instanceof EDDSA))
+ return new EDDSA(curve);
+
+ var curve = elliptic.curves[curve].curve;
+ this.curve = curve;
+ this.g = curve.g;
+ this.g.precompute(curve.n.bitLength() + 1);
+
+ this.pointClass = curve.point().constructor;
+ this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
+ this.hash = hash.sha512;
+}
+
+module.exports = EDDSA;
+
+/**
+* @param {Array|String} message - message bytes
+* @param {Array|String|KeyPair} secret - secret bytes or a keypair
+* @returns {Signature} - signature
+*/
+EDDSA.prototype.sign = function sign(message, secret) {
+ message = parseBytes(message);
+ var key = this.keyFromSecret(secret);
+ var r = this.hashInt(key.messagePrefix(), message);
+ var R = this.g.mul(r);
+ var Rencoded = this.encodePoint(R);
+ var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
+ .mul(key.priv());
+ var S = r.add(s_).umod(this.curve.n);
+ return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
+};
+
+/**
+* @param {Array} message - message bytes
+* @param {Array|String|Signature} sig - sig bytes
+* @param {Array|String|Point|KeyPair} pub - public key
+* @returns {Boolean} - true if public key matches sig of message
+*/
+EDDSA.prototype.verify = function verify(message, sig, pub) {
+ message = parseBytes(message);
+ sig = this.makeSignature(sig);
+ var key = this.keyFromPublic(pub);
+ var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
+ var SG = this.g.mul(sig.S());
+ var RplusAh = sig.R().add(key.pub().mul(h));
+ return RplusAh.eq(SG);
+};
+
+EDDSA.prototype.hashInt = function hashInt() {
+ var hash = this.hash();
+ for (var i = 0; i < arguments.length; i++)
+ hash.update(arguments[i]);
+ return utils.intFromLE(hash.digest()).umod(this.curve.n);
+};
+
+EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
+ return KeyPair.fromPublic(this, pub);
+};
+
+EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
+ return KeyPair.fromSecret(this, secret);
+};
+
+EDDSA.prototype.makeSignature = function makeSignature(sig) {
+ if (sig instanceof Signature)
+ return sig;
+ return new Signature(this, sig);
+};
+
+/**
+* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
+*
+* EDDSA defines methods for encoding and decoding points and integers. These are
+* helper convenience methods, that pass along to utility functions implied
+* parameters.
+*
+*/
+EDDSA.prototype.encodePoint = function encodePoint(point) {
+ var enc = point.getY().toArray('le', this.encodingLength);
+ enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
+ return enc;
+};
+
+EDDSA.prototype.decodePoint = function decodePoint(bytes) {
+ bytes = utils.parseBytes(bytes);
+
+ var lastIx = bytes.length - 1;
+ var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
+ var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
+
+ var y = utils.intFromLE(normed);
+ return this.curve.pointFromY(y, xIsOdd);
+};
+
+EDDSA.prototype.encodeInt = function encodeInt(num) {
+ return num.toArray('le', this.encodingLength);
+};
+
+EDDSA.prototype.decodeInt = function decodeInt(bytes) {
+ return utils.intFromLE(bytes);
+};
+
+EDDSA.prototype.isPoint = function isPoint(val) {
+ return val instanceof this.pointClass;
+};
+
+},{"../../elliptic":548,"./key":559,"./signature":560,"hash.js":803}],559:[function(require,module,exports){
+'use strict';
+
+var elliptic = require('../../elliptic');
+var utils = elliptic.utils;
+var assert = utils.assert;
+var parseBytes = utils.parseBytes;
+var cachedProperty = utils.cachedProperty;
+
+/**
+* @param {EDDSA} eddsa - instance
+* @param {Object} params - public/private key parameters
+*
+* @param {Array} [params.secret] - secret seed bytes
+* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
+* @param {Array} [params.pub] - public key point encoded as bytes
+*
+*/
+function KeyPair(eddsa, params) {
+ this.eddsa = eddsa;
+ this._secret = parseBytes(params.secret);
+ if (eddsa.isPoint(params.pub))
+ this._pub = params.pub;
+ else
+ this._pubBytes = parseBytes(params.pub);
+}
+
+KeyPair.fromPublic = function fromPublic(eddsa, pub) {
+ if (pub instanceof KeyPair)
+ return pub;
+ return new KeyPair(eddsa, { pub: pub });
+};
+
+KeyPair.fromSecret = function fromSecret(eddsa, secret) {
+ if (secret instanceof KeyPair)
+ return secret;
+ return new KeyPair(eddsa, { secret: secret });
+};
+
+KeyPair.prototype.secret = function secret() {
+ return this._secret;
+};
+
+cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
+ return this.eddsa.encodePoint(this.pub());
+});
+
+cachedProperty(KeyPair, 'pub', function pub() {
+ if (this._pubBytes)
+ return this.eddsa.decodePoint(this._pubBytes);
+ return this.eddsa.g.mul(this.priv());
+});
+
+cachedProperty(KeyPair, 'privBytes', function privBytes() {
+ var eddsa = this.eddsa;
+ var hash = this.hash();
+ var lastIx = eddsa.encodingLength - 1;
+
+ var a = hash.slice(0, eddsa.encodingLength);
+ a[0] &= 248;
+ a[lastIx] &= 127;
+ a[lastIx] |= 64;
+
+ return a;
+});
+
+cachedProperty(KeyPair, 'priv', function priv() {
+ return this.eddsa.decodeInt(this.privBytes());
+});
+
+cachedProperty(KeyPair, 'hash', function hash() {
+ return this.eddsa.hash().update(this.secret()).digest();
+});
+
+cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
+ return this.hash().slice(this.eddsa.encodingLength);
+});
+
+KeyPair.prototype.sign = function sign(message) {
+ assert(this._secret, 'KeyPair can only verify');
+ return this.eddsa.sign(message, this);
+};
+
+KeyPair.prototype.verify = function verify(message, sig) {
+ return this.eddsa.verify(message, sig, this);
+};
+
+KeyPair.prototype.getSecret = function getSecret(enc) {
+ assert(this._secret, 'KeyPair is public only');
+ return utils.encode(this.secret(), enc);
+};
+
+KeyPair.prototype.getPublic = function getPublic(enc) {
+ return utils.encode(this.pubBytes(), enc);
+};
+
+module.exports = KeyPair;
+
+},{"../../elliptic":548}],560:[function(require,module,exports){
+'use strict';
+
+var BN = require('bn.js');
+var elliptic = require('../../elliptic');
+var utils = elliptic.utils;
+var assert = utils.assert;
+var cachedProperty = utils.cachedProperty;
+var parseBytes = utils.parseBytes;
+
+/**
+* @param {EDDSA} eddsa - eddsa instance
+* @param {Array|Object} sig -
+* @param {Array|Point} [sig.R] - R point as Point or bytes
+* @param {Array|bn} [sig.S] - S scalar as bn or bytes
+* @param {Array} [sig.Rencoded] - R point encoded
+* @param {Array} [sig.Sencoded] - S scalar encoded
+*/
+function Signature(eddsa, sig) {
+ this.eddsa = eddsa;
+
+ if (typeof sig !== 'object')
+ sig = parseBytes(sig);
+
+ if (Array.isArray(sig)) {
+ sig = {
+ R: sig.slice(0, eddsa.encodingLength),
+ S: sig.slice(eddsa.encodingLength)
+ };
+ }
+
+ assert(sig.R && sig.S, 'Signature without R or S');
+
+ if (eddsa.isPoint(sig.R))
+ this._R = sig.R;
+ if (sig.S instanceof BN)
+ this._S = sig.S;
+
+ this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
+ this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
+}
+
+cachedProperty(Signature, 'S', function S() {
+ return this.eddsa.decodeInt(this.Sencoded());
+});
+
+cachedProperty(Signature, 'R', function R() {
+ return this.eddsa.decodePoint(this.Rencoded());
+});
+
+cachedProperty(Signature, 'Rencoded', function Rencoded() {
+ return this.eddsa.encodePoint(this.R());
+});
+
+cachedProperty(Signature, 'Sencoded', function Sencoded() {
+ return this.eddsa.encodeInt(this.S());
+});
+
+Signature.prototype.toBytes = function toBytes() {
+ return this.Rencoded().concat(this.Sencoded());
+};
+
+Signature.prototype.toHex = function toHex() {
+ return utils.encode(this.toBytes(), 'hex').toUpperCase();
+};
+
+module.exports = Signature;
+
+},{"../../elliptic":548,"bn.js":66}],561:[function(require,module,exports){
+module.exports = {
+ doubles: {
+ step: 4,
+ points: [
+ [
+ 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
+ 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
+ ],
+ [
+ '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
+ '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
+ ],
+ [
+ '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
+ 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
+ ],
+ [
+ '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
+ '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
+ ],
+ [
+ '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
+ '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
+ ],
+ [
+ '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
+ '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
+ ],
+ [
+ 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
+ '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
+ ],
+ [
+ '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
+ 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
+ ],
+ [
+ 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
+ '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
+ ],
+ [
+ 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
+ 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
+ ],
+ [
+ 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
+ '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
+ ],
+ [
+ '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
+ '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
+ ],
+ [
+ '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
+ '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
+ ],
+ [
+ '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
+ '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
+ ],
+ [
+ '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
+ '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
+ ],
+ [
+ '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
+ '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
+ ],
+ [
+ '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
+ '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
+ ],
+ [
+ '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
+ '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
+ ],
+ [
+ '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
+ 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
+ ],
+ [
+ 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
+ '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
+ ],
+ [
+ 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
+ '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
+ ],
+ [
+ '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
+ '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
+ ],
+ [
+ '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
+ '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
+ ],
+ [
+ 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
+ '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
+ ],
+ [
+ '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
+ 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
+ ],
+ [
+ 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
+ '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
+ ],
+ [
+ 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
+ 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
+ ],
+ [
+ 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
+ '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
+ ],
+ [
+ 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
+ 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
+ ],
+ [
+ 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
+ '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
+ ],
+ [
+ '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
+ 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
+ ],
+ [
+ '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
+ '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
+ ],
+ [
+ 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
+ '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
+ ],
+ [
+ '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
+ 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
+ ],
+ [
+ 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
+ '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
+ ],
+ [
+ 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
+ '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
+ ],
+ [
+ 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
+ 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
+ ],
+ [
+ '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
+ '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
+ ],
+ [
+ '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
+ '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
+ ],
+ [
+ '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
+ 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
+ ],
+ [
+ '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
+ '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
+ ],
+ [
+ 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
+ '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
+ ],
+ [
+ '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
+ '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
+ ],
+ [
+ '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
+ 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
+ ],
+ [
+ '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
+ '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
+ ],
+ [
+ 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
+ '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
+ ],
+ [
+ '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
+ 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
+ ],
+ [
+ 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
+ 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
+ ],
+ [
+ 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
+ '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
+ ],
+ [
+ '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
+ 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
+ ],
+ [
+ '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
+ 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
+ ],
+ [
+ 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
+ '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
+ ],
+ [
+ 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
+ '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
+ ],
+ [
+ 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
+ '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
+ ],
+ [
+ '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
+ 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
+ ],
+ [
+ '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
+ '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
+ ],
+ [
+ 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
+ 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
+ ],
+ [
+ '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
+ 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
+ ],
+ [
+ '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
+ '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
+ ],
+ [
+ '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
+ '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
+ ],
+ [
+ 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
+ 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
+ ],
+ [
+ '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
+ '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
+ ],
+ [
+ '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
+ '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
+ ],
+ [
+ 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
+ '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
+ ],
+ [
+ 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
+ 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
+ ]
+ ]
+ },
+ naf: {
+ wnd: 7,
+ points: [
+ [
+ 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
+ '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
+ ],
+ [
+ '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
+ 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
+ ],
+ [
+ '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
+ '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
+ ],
+ [
+ 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
+ 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
+ ],
+ [
+ '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
+ 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
+ ],
+ [
+ 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
+ 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
+ ],
+ [
+ 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
+ '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
+ ],
+ [
+ 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
+ '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
+ ],
+ [
+ '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
+ '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
+ ],
+ [
+ '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
+ '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
+ ],
+ [
+ '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
+ '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
+ ],
+ [
+ '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
+ '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
+ ],
+ [
+ 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
+ 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
+ ],
+ [
+ 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
+ '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
+ ],
+ [
+ '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
+ 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
+ ],
+ [
+ '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
+ 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
+ ],
+ [
+ '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
+ '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
+ ],
+ [
+ '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
+ '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
+ ],
+ [
+ '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
+ '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
+ ],
+ [
+ '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
+ 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
+ ],
+ [
+ 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
+ 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
+ ],
+ [
+ '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
+ '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
+ ],
+ [
+ '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
+ '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
+ ],
+ [
+ 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
+ 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
+ ],
+ [
+ '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
+ '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
+ ],
+ [
+ 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
+ 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
+ ],
+ [
+ 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
+ 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
+ ],
+ [
+ '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
+ '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
+ ],
+ [
+ '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
+ '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
+ ],
+ [
+ '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
+ '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
+ ],
+ [
+ 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
+ '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
+ ],
+ [
+ '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
+ '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
+ ],
+ [
+ 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
+ '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
+ ],
+ [
+ '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
+ 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
+ ],
+ [
+ '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
+ 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
+ ],
+ [
+ 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
+ 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
+ ],
+ [
+ '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
+ '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
+ ],
+ [
+ '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
+ 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
+ ],
+ [
+ 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
+ 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
+ ],
+ [
+ '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
+ '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
+ ],
+ [
+ '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
+ 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
+ ],
+ [
+ '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
+ '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
+ ],
+ [
+ '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
+ 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
+ ],
+ [
+ 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
+ '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
+ ],
+ [
+ '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
+ '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
+ ],
+ [
+ '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
+ 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
+ ],
+ [
+ '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
+ 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
+ ],
+ [
+ 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
+ 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
+ ],
+ [
+ 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
+ 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
+ ],
+ [
+ '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
+ '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
+ ],
+ [
+ '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
+ '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
+ ],
+ [
+ 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
+ '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
+ ],
+ [
+ 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
+ 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
+ ],
+ [
+ '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
+ '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
+ ],
+ [
+ '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
+ '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
+ ],
+ [
+ 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
+ '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
+ ],
+ [
+ '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
+ '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
+ ],
+ [
+ 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
+ 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
+ ],
+ [
+ '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
+ 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
+ ],
+ [
+ '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
+ '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
+ ],
+ [
+ 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
+ '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
+ ],
+ [
+ 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
+ '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
+ ],
+ [
+ '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
+ '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
+ ],
+ [
+ '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
+ '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
+ ],
+ [
+ '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
+ 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
+ ],
+ [
+ '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
+ 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
+ ],
+ [
+ '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
+ '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
+ ],
+ [
+ '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
+ '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
+ ],
+ [
+ '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
+ '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
+ ],
+ [
+ '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
+ 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
+ ],
+ [
+ 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
+ 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
+ ],
+ [
+ '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
+ 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
+ ],
+ [
+ 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
+ '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
+ ],
+ [
+ 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
+ '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
+ ],
+ [
+ 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
+ '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
+ ],
+ [
+ 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
+ '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
+ ],
+ [
+ '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
+ 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
+ ],
+ [
+ '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
+ '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
+ ],
+ [
+ '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
+ 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
+ ],
+ [
+ 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
+ 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
+ ],
+ [
+ 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
+ '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
+ ],
+ [
+ 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
+ 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
+ ],
+ [
+ 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
+ '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
+ ],
+ [
+ '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
+ '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
+ ],
+ [
+ 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
+ '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
+ ],
+ [
+ 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
+ '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
+ ],
+ [
+ '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
+ '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
+ ],
+ [
+ '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
+ 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
+ ],
+ [
+ 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
+ '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
+ ],
+ [
+ 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
+ '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
+ ],
+ [
+ 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
+ '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
+ ],
+ [
+ '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
+ '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
+ ],
+ [
+ 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
+ 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
+ ],
+ [
+ '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
+ 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
+ ],
+ [
+ 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
+ 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
+ ],
+ [
+ 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
+ '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
+ ],
+ [
+ '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
+ 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
+ ],
+ [
+ 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
+ '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
+ ],
+ [
+ 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
+ '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
+ ],
+ [
+ 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
+ '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
+ ],
+ [
+ '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
+ 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
+ ],
+ [
+ '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
+ 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
+ ],
+ [
+ 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
+ '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
+ ],
+ [
+ '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
+ 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
+ ],
+ [
+ '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
+ '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
+ ],
+ [
+ '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
+ 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
+ ],
+ [
+ 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
+ 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
+ ],
+ [
+ '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
+ 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
+ ],
+ [
+ '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
+ '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
+ ],
+ [
+ '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
+ 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
+ ],
+ [
+ '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
+ '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
+ ],
+ [
+ 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
+ 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
+ ],
+ [
+ '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
+ '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
+ ],
+ [
+ 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
+ '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
+ ],
+ [
+ '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
+ '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
+ ],
+ [
+ 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
+ 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
+ ],
+ [
+ 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
+ '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
+ ],
+ [
+ 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
+ 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
+ ],
+ [
+ '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
+ 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
+ ],
+ [
+ '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
+ '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
+ ],
+ [
+ '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
+ 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
+ ],
+ [
+ '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
+ '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
+ ],
+ [
+ '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
+ '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
+ ],
+ [
+ '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
+ 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
+ ],
+ [
+ '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
+ '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
+ ],
+ [
+ '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
+ '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
+ ],
+ [
+ '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
+ '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
+ ]
+ ]
+ }
+};
+
+},{}],562:[function(require,module,exports){
+'use strict';
+
+var utils = exports;
+var BN = require('bn.js');
+var minAssert = require('minimalistic-assert');
+var minUtils = require('minimalistic-crypto-utils');
+
+utils.assert = minAssert;
+utils.toArray = minUtils.toArray;
+utils.zero2 = minUtils.zero2;
+utils.toHex = minUtils.toHex;
+utils.encode = minUtils.encode;
+
+// 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":66,"minimalistic-assert":960,"minimalistic-crypto-utils":961}],563:[function(require,module,exports){
+module.exports={
+ "_args": [
+ [
+ "elliptic@6.4.1",
+ "/home/yann/Remix/remix-ide"
+ ]
+ ],
+ "_development": true,
+ "_from": "elliptic@6.4.1",
+ "_id": "elliptic@6.4.1",
+ "_inBundle": false,
+ "_integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",
+ "_location": "/elliptic",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "elliptic@6.4.1",
+ "name": "elliptic",
+ "escapedName": "elliptic",
+ "rawSpec": "6.4.1",
+ "saveSpec": null,
+ "fetchSpec": "6.4.1"
+ },
+ "_requiredBy": [
+ "/browserify-sign",
+ "/create-ecdh",
+ "/eth-lib",
+ "/secp256k1",
+ "/web3-eth-accounts/eth-lib"
+ ],
+ "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",
+ "_spec": "6.4.1",
+ "_where": "/home/yann/Remix/remix-ide",
+ "author": {
+ "name": "Fedor Indutny",
+ "email": "fedor@indutny.com"
+ },
+ "bugs": {
+ "url": "https://github.com/indutny/elliptic/issues"
+ },
+ "dependencies": {
+ "bn.js": "^4.4.0",
+ "brorand": "^1.0.1",
+ "hash.js": "^1.0.0",
+ "hmac-drbg": "^1.0.0",
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.0"
+ },
+ "description": "EC cryptography",
+ "devDependencies": {
+ "brfs": "^1.4.3",
+ "coveralls": "^2.11.3",
+ "grunt": "^0.4.5",
+ "grunt-browserify": "^5.0.0",
+ "grunt-cli": "^1.2.0",
+ "grunt-contrib-connect": "^1.0.0",
+ "grunt-contrib-copy": "^1.0.0",
+ "grunt-contrib-uglify": "^1.0.1",
+ "grunt-mocha-istanbul": "^3.0.1",
+ "grunt-saucelabs": "^8.6.2",
+ "istanbul": "^0.4.2",
+ "jscs": "^2.9.0",
+ "jshint": "^2.6.0",
+ "mocha": "^2.1.0"
+ },
+ "files": [
+ "lib"
+ ],
+ "homepage": "https://github.com/indutny/elliptic",
+ "keywords": [
+ "EC",
+ "Elliptic",
+ "curve",
+ "Cryptography"
+ ],
+ "license": "MIT",
+ "main": "lib/elliptic.js",
+ "name": "elliptic",
+ "repository": {
+ "type": "git",
+ "url": "git+ssh://git@github.com/indutny/elliptic.git"
+ },
+ "scripts": {
+ "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
+ "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
+ "lint": "npm run jscs && npm run jshint",
+ "test": "npm run lint && npm run unit",
+ "unit": "istanbul test _mocha --reporter=spec test/index.js",
+ "version": "grunt dist && git add dist/"
+ },
+ "version": "6.4.1"
+}
+
+},{}],564:[function(require,module,exports){
+var punycode = require('punycode');
+var revEntities = require('./reversed.json');
+
+module.exports = encode;
+
+function encode (str, opts) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a String');
+ }
+ if (!opts) opts = {};
+
+ var numeric = true;
+ if (opts.named) numeric = false;
+ if (opts.numeric !== undefined) numeric = opts.numeric;
+
+ var special = opts.special || {
+ '"': true, "'": true,
+ '<': true, '>': true,
+ '&': true
+ };
+
+ var codePoints = punycode.ucs2.decode(str);
+ var chars = [];
+ for (var i = 0; i < codePoints.length; i++) {
+ var cc = codePoints[i];
+ var c = punycode.ucs2.encode([ cc ]);
+ var e = revEntities[cc];
+ if (e && (cc >= 127 || special[c]) && !numeric) {
+ chars.push('&' + (/;$/.test(e) ? e : e + ';'));
+ }
+ else if (cc < 32 || cc >= 127 || special[c]) {
+ chars.push('' + cc + ';');
+ }
+ else {
+ chars.push(c);
+ }
+ }
+ return chars.join('');
+}
+
+},{"./reversed.json":565,"punycode":110}],565:[function(require,module,exports){
+module.exports={
+ "9": "Tab;",
+ "10": "NewLine;",
+ "33": "excl;",
+ "34": "quot;",
+ "35": "num;",
+ "36": "dollar;",
+ "37": "percnt;",
+ "38": "amp;",
+ "39": "apos;",
+ "40": "lpar;",
+ "41": "rpar;",
+ "42": "midast;",
+ "43": "plus;",
+ "44": "comma;",
+ "46": "period;",
+ "47": "sol;",
+ "58": "colon;",
+ "59": "semi;",
+ "60": "lt;",
+ "61": "equals;",
+ "62": "gt;",
+ "63": "quest;",
+ "64": "commat;",
+ "91": "lsqb;",
+ "92": "bsol;",
+ "93": "rsqb;",
+ "94": "Hat;",
+ "95": "UnderBar;",
+ "96": "grave;",
+ "123": "lcub;",
+ "124": "VerticalLine;",
+ "125": "rcub;",
+ "160": "NonBreakingSpace;",
+ "161": "iexcl;",
+ "162": "cent;",
+ "163": "pound;",
+ "164": "curren;",
+ "165": "yen;",
+ "166": "brvbar;",
+ "167": "sect;",
+ "168": "uml;",
+ "169": "copy;",
+ "170": "ordf;",
+ "171": "laquo;",
+ "172": "not;",
+ "173": "shy;",
+ "174": "reg;",
+ "175": "strns;",
+ "176": "deg;",
+ "177": "pm;",
+ "178": "sup2;",
+ "179": "sup3;",
+ "180": "DiacriticalAcute;",
+ "181": "micro;",
+ "182": "para;",
+ "183": "middot;",
+ "184": "Cedilla;",
+ "185": "sup1;",
+ "186": "ordm;",
+ "187": "raquo;",
+ "188": "frac14;",
+ "189": "half;",
+ "190": "frac34;",
+ "191": "iquest;",
+ "192": "Agrave;",
+ "193": "Aacute;",
+ "194": "Acirc;",
+ "195": "Atilde;",
+ "196": "Auml;",
+ "197": "Aring;",
+ "198": "AElig;",
+ "199": "Ccedil;",
+ "200": "Egrave;",
+ "201": "Eacute;",
+ "202": "Ecirc;",
+ "203": "Euml;",
+ "204": "Igrave;",
+ "205": "Iacute;",
+ "206": "Icirc;",
+ "207": "Iuml;",
+ "208": "ETH;",
+ "209": "Ntilde;",
+ "210": "Ograve;",
+ "211": "Oacute;",
+ "212": "Ocirc;",
+ "213": "Otilde;",
+ "214": "Ouml;",
+ "215": "times;",
+ "216": "Oslash;",
+ "217": "Ugrave;",
+ "218": "Uacute;",
+ "219": "Ucirc;",
+ "220": "Uuml;",
+ "221": "Yacute;",
+ "222": "THORN;",
+ "223": "szlig;",
+ "224": "agrave;",
+ "225": "aacute;",
+ "226": "acirc;",
+ "227": "atilde;",
+ "228": "auml;",
+ "229": "aring;",
+ "230": "aelig;",
+ "231": "ccedil;",
+ "232": "egrave;",
+ "233": "eacute;",
+ "234": "ecirc;",
+ "235": "euml;",
+ "236": "igrave;",
+ "237": "iacute;",
+ "238": "icirc;",
+ "239": "iuml;",
+ "240": "eth;",
+ "241": "ntilde;",
+ "242": "ograve;",
+ "243": "oacute;",
+ "244": "ocirc;",
+ "245": "otilde;",
+ "246": "ouml;",
+ "247": "divide;",
+ "248": "oslash;",
+ "249": "ugrave;",
+ "250": "uacute;",
+ "251": "ucirc;",
+ "252": "uuml;",
+ "253": "yacute;",
+ "254": "thorn;",
+ "255": "yuml;",
+ "256": "Amacr;",
+ "257": "amacr;",
+ "258": "Abreve;",
+ "259": "abreve;",
+ "260": "Aogon;",
+ "261": "aogon;",
+ "262": "Cacute;",
+ "263": "cacute;",
+ "264": "Ccirc;",
+ "265": "ccirc;",
+ "266": "Cdot;",
+ "267": "cdot;",
+ "268": "Ccaron;",
+ "269": "ccaron;",
+ "270": "Dcaron;",
+ "271": "dcaron;",
+ "272": "Dstrok;",
+ "273": "dstrok;",
+ "274": "Emacr;",
+ "275": "emacr;",
+ "278": "Edot;",
+ "279": "edot;",
+ "280": "Eogon;",
+ "281": "eogon;",
+ "282": "Ecaron;",
+ "283": "ecaron;",
+ "284": "Gcirc;",
+ "285": "gcirc;",
+ "286": "Gbreve;",
+ "287": "gbreve;",
+ "288": "Gdot;",
+ "289": "gdot;",
+ "290": "Gcedil;",
+ "292": "Hcirc;",
+ "293": "hcirc;",
+ "294": "Hstrok;",
+ "295": "hstrok;",
+ "296": "Itilde;",
+ "297": "itilde;",
+ "298": "Imacr;",
+ "299": "imacr;",
+ "302": "Iogon;",
+ "303": "iogon;",
+ "304": "Idot;",
+ "305": "inodot;",
+ "306": "IJlig;",
+ "307": "ijlig;",
+ "308": "Jcirc;",
+ "309": "jcirc;",
+ "310": "Kcedil;",
+ "311": "kcedil;",
+ "312": "kgreen;",
+ "313": "Lacute;",
+ "314": "lacute;",
+ "315": "Lcedil;",
+ "316": "lcedil;",
+ "317": "Lcaron;",
+ "318": "lcaron;",
+ "319": "Lmidot;",
+ "320": "lmidot;",
+ "321": "Lstrok;",
+ "322": "lstrok;",
+ "323": "Nacute;",
+ "324": "nacute;",
+ "325": "Ncedil;",
+ "326": "ncedil;",
+ "327": "Ncaron;",
+ "328": "ncaron;",
+ "329": "napos;",
+ "330": "ENG;",
+ "331": "eng;",
+ "332": "Omacr;",
+ "333": "omacr;",
+ "336": "Odblac;",
+ "337": "odblac;",
+ "338": "OElig;",
+ "339": "oelig;",
+ "340": "Racute;",
+ "341": "racute;",
+ "342": "Rcedil;",
+ "343": "rcedil;",
+ "344": "Rcaron;",
+ "345": "rcaron;",
+ "346": "Sacute;",
+ "347": "sacute;",
+ "348": "Scirc;",
+ "349": "scirc;",
+ "350": "Scedil;",
+ "351": "scedil;",
+ "352": "Scaron;",
+ "353": "scaron;",
+ "354": "Tcedil;",
+ "355": "tcedil;",
+ "356": "Tcaron;",
+ "357": "tcaron;",
+ "358": "Tstrok;",
+ "359": "tstrok;",
+ "360": "Utilde;",
+ "361": "utilde;",
+ "362": "Umacr;",
+ "363": "umacr;",
+ "364": "Ubreve;",
+ "365": "ubreve;",
+ "366": "Uring;",
+ "367": "uring;",
+ "368": "Udblac;",
+ "369": "udblac;",
+ "370": "Uogon;",
+ "371": "uogon;",
+ "372": "Wcirc;",
+ "373": "wcirc;",
+ "374": "Ycirc;",
+ "375": "ycirc;",
+ "376": "Yuml;",
+ "377": "Zacute;",
+ "378": "zacute;",
+ "379": "Zdot;",
+ "380": "zdot;",
+ "381": "Zcaron;",
+ "382": "zcaron;",
+ "402": "fnof;",
+ "437": "imped;",
+ "501": "gacute;",
+ "567": "jmath;",
+ "710": "circ;",
+ "711": "Hacek;",
+ "728": "breve;",
+ "729": "dot;",
+ "730": "ring;",
+ "731": "ogon;",
+ "732": "tilde;",
+ "733": "DiacriticalDoubleAcute;",
+ "785": "DownBreve;",
+ "913": "Alpha;",
+ "914": "Beta;",
+ "915": "Gamma;",
+ "916": "Delta;",
+ "917": "Epsilon;",
+ "918": "Zeta;",
+ "919": "Eta;",
+ "920": "Theta;",
+ "921": "Iota;",
+ "922": "Kappa;",
+ "923": "Lambda;",
+ "924": "Mu;",
+ "925": "Nu;",
+ "926": "Xi;",
+ "927": "Omicron;",
+ "928": "Pi;",
+ "929": "Rho;",
+ "931": "Sigma;",
+ "932": "Tau;",
+ "933": "Upsilon;",
+ "934": "Phi;",
+ "935": "Chi;",
+ "936": "Psi;",
+ "937": "Omega;",
+ "945": "alpha;",
+ "946": "beta;",
+ "947": "gamma;",
+ "948": "delta;",
+ "949": "epsilon;",
+ "950": "zeta;",
+ "951": "eta;",
+ "952": "theta;",
+ "953": "iota;",
+ "954": "kappa;",
+ "955": "lambda;",
+ "956": "mu;",
+ "957": "nu;",
+ "958": "xi;",
+ "959": "omicron;",
+ "960": "pi;",
+ "961": "rho;",
+ "962": "varsigma;",
+ "963": "sigma;",
+ "964": "tau;",
+ "965": "upsilon;",
+ "966": "phi;",
+ "967": "chi;",
+ "968": "psi;",
+ "969": "omega;",
+ "977": "vartheta;",
+ "978": "upsih;",
+ "981": "varphi;",
+ "982": "varpi;",
+ "988": "Gammad;",
+ "989": "gammad;",
+ "1008": "varkappa;",
+ "1009": "varrho;",
+ "1013": "varepsilon;",
+ "1014": "bepsi;",
+ "1025": "IOcy;",
+ "1026": "DJcy;",
+ "1027": "GJcy;",
+ "1028": "Jukcy;",
+ "1029": "DScy;",
+ "1030": "Iukcy;",
+ "1031": "YIcy;",
+ "1032": "Jsercy;",
+ "1033": "LJcy;",
+ "1034": "NJcy;",
+ "1035": "TSHcy;",
+ "1036": "KJcy;",
+ "1038": "Ubrcy;",
+ "1039": "DZcy;",
+ "1040": "Acy;",
+ "1041": "Bcy;",
+ "1042": "Vcy;",
+ "1043": "Gcy;",
+ "1044": "Dcy;",
+ "1045": "IEcy;",
+ "1046": "ZHcy;",
+ "1047": "Zcy;",
+ "1048": "Icy;",
+ "1049": "Jcy;",
+ "1050": "Kcy;",
+ "1051": "Lcy;",
+ "1052": "Mcy;",
+ "1053": "Ncy;",
+ "1054": "Ocy;",
+ "1055": "Pcy;",
+ "1056": "Rcy;",
+ "1057": "Scy;",
+ "1058": "Tcy;",
+ "1059": "Ucy;",
+ "1060": "Fcy;",
+ "1061": "KHcy;",
+ "1062": "TScy;",
+ "1063": "CHcy;",
+ "1064": "SHcy;",
+ "1065": "SHCHcy;",
+ "1066": "HARDcy;",
+ "1067": "Ycy;",
+ "1068": "SOFTcy;",
+ "1069": "Ecy;",
+ "1070": "YUcy;",
+ "1071": "YAcy;",
+ "1072": "acy;",
+ "1073": "bcy;",
+ "1074": "vcy;",
+ "1075": "gcy;",
+ "1076": "dcy;",
+ "1077": "iecy;",
+ "1078": "zhcy;",
+ "1079": "zcy;",
+ "1080": "icy;",
+ "1081": "jcy;",
+ "1082": "kcy;",
+ "1083": "lcy;",
+ "1084": "mcy;",
+ "1085": "ncy;",
+ "1086": "ocy;",
+ "1087": "pcy;",
+ "1088": "rcy;",
+ "1089": "scy;",
+ "1090": "tcy;",
+ "1091": "ucy;",
+ "1092": "fcy;",
+ "1093": "khcy;",
+ "1094": "tscy;",
+ "1095": "chcy;",
+ "1096": "shcy;",
+ "1097": "shchcy;",
+ "1098": "hardcy;",
+ "1099": "ycy;",
+ "1100": "softcy;",
+ "1101": "ecy;",
+ "1102": "yucy;",
+ "1103": "yacy;",
+ "1105": "iocy;",
+ "1106": "djcy;",
+ "1107": "gjcy;",
+ "1108": "jukcy;",
+ "1109": "dscy;",
+ "1110": "iukcy;",
+ "1111": "yicy;",
+ "1112": "jsercy;",
+ "1113": "ljcy;",
+ "1114": "njcy;",
+ "1115": "tshcy;",
+ "1116": "kjcy;",
+ "1118": "ubrcy;",
+ "1119": "dzcy;",
+ "8194": "ensp;",
+ "8195": "emsp;",
+ "8196": "emsp13;",
+ "8197": "emsp14;",
+ "8199": "numsp;",
+ "8200": "puncsp;",
+ "8201": "ThinSpace;",
+ "8202": "VeryThinSpace;",
+ "8203": "ZeroWidthSpace;",
+ "8204": "zwnj;",
+ "8205": "zwj;",
+ "8206": "lrm;",
+ "8207": "rlm;",
+ "8208": "hyphen;",
+ "8211": "ndash;",
+ "8212": "mdash;",
+ "8213": "horbar;",
+ "8214": "Vert;",
+ "8216": "OpenCurlyQuote;",
+ "8217": "rsquor;",
+ "8218": "sbquo;",
+ "8220": "OpenCurlyDoubleQuote;",
+ "8221": "rdquor;",
+ "8222": "ldquor;",
+ "8224": "dagger;",
+ "8225": "ddagger;",
+ "8226": "bullet;",
+ "8229": "nldr;",
+ "8230": "mldr;",
+ "8240": "permil;",
+ "8241": "pertenk;",
+ "8242": "prime;",
+ "8243": "Prime;",
+ "8244": "tprime;",
+ "8245": "bprime;",
+ "8249": "lsaquo;",
+ "8250": "rsaquo;",
+ "8254": "OverBar;",
+ "8257": "caret;",
+ "8259": "hybull;",
+ "8260": "frasl;",
+ "8271": "bsemi;",
+ "8279": "qprime;",
+ "8287": "MediumSpace;",
+ "8288": "NoBreak;",
+ "8289": "ApplyFunction;",
+ "8290": "it;",
+ "8291": "InvisibleComma;",
+ "8364": "euro;",
+ "8411": "TripleDot;",
+ "8412": "DotDot;",
+ "8450": "Copf;",
+ "8453": "incare;",
+ "8458": "gscr;",
+ "8459": "Hscr;",
+ "8460": "Poincareplane;",
+ "8461": "quaternions;",
+ "8462": "planckh;",
+ "8463": "plankv;",
+ "8464": "Iscr;",
+ "8465": "imagpart;",
+ "8466": "Lscr;",
+ "8467": "ell;",
+ "8469": "Nopf;",
+ "8470": "numero;",
+ "8471": "copysr;",
+ "8472": "wp;",
+ "8473": "primes;",
+ "8474": "rationals;",
+ "8475": "Rscr;",
+ "8476": "Rfr;",
+ "8477": "Ropf;",
+ "8478": "rx;",
+ "8482": "trade;",
+ "8484": "Zopf;",
+ "8487": "mho;",
+ "8488": "Zfr;",
+ "8489": "iiota;",
+ "8492": "Bscr;",
+ "8493": "Cfr;",
+ "8495": "escr;",
+ "8496": "expectation;",
+ "8497": "Fscr;",
+ "8499": "phmmat;",
+ "8500": "oscr;",
+ "8501": "aleph;",
+ "8502": "beth;",
+ "8503": "gimel;",
+ "8504": "daleth;",
+ "8517": "DD;",
+ "8518": "DifferentialD;",
+ "8519": "exponentiale;",
+ "8520": "ImaginaryI;",
+ "8531": "frac13;",
+ "8532": "frac23;",
+ "8533": "frac15;",
+ "8534": "frac25;",
+ "8535": "frac35;",
+ "8536": "frac45;",
+ "8537": "frac16;",
+ "8538": "frac56;",
+ "8539": "frac18;",
+ "8540": "frac38;",
+ "8541": "frac58;",
+ "8542": "frac78;",
+ "8592": "slarr;",
+ "8593": "uparrow;",
+ "8594": "srarr;",
+ "8595": "ShortDownArrow;",
+ "8596": "leftrightarrow;",
+ "8597": "varr;",
+ "8598": "UpperLeftArrow;",
+ "8599": "UpperRightArrow;",
+ "8600": "searrow;",
+ "8601": "swarrow;",
+ "8602": "nleftarrow;",
+ "8603": "nrightarrow;",
+ "8605": "rightsquigarrow;",
+ "8606": "twoheadleftarrow;",
+ "8607": "Uarr;",
+ "8608": "twoheadrightarrow;",
+ "8609": "Darr;",
+ "8610": "leftarrowtail;",
+ "8611": "rightarrowtail;",
+ "8612": "mapstoleft;",
+ "8613": "UpTeeArrow;",
+ "8614": "RightTeeArrow;",
+ "8615": "mapstodown;",
+ "8617": "larrhk;",
+ "8618": "rarrhk;",
+ "8619": "looparrowleft;",
+ "8620": "rarrlp;",
+ "8621": "leftrightsquigarrow;",
+ "8622": "nleftrightarrow;",
+ "8624": "lsh;",
+ "8625": "rsh;",
+ "8626": "ldsh;",
+ "8627": "rdsh;",
+ "8629": "crarr;",
+ "8630": "curvearrowleft;",
+ "8631": "curvearrowright;",
+ "8634": "olarr;",
+ "8635": "orarr;",
+ "8636": "lharu;",
+ "8637": "lhard;",
+ "8638": "upharpoonright;",
+ "8639": "upharpoonleft;",
+ "8640": "RightVector;",
+ "8641": "rightharpoondown;",
+ "8642": "RightDownVector;",
+ "8643": "LeftDownVector;",
+ "8644": "rlarr;",
+ "8645": "UpArrowDownArrow;",
+ "8646": "lrarr;",
+ "8647": "llarr;",
+ "8648": "uuarr;",
+ "8649": "rrarr;",
+ "8650": "downdownarrows;",
+ "8651": "ReverseEquilibrium;",
+ "8652": "rlhar;",
+ "8653": "nLeftarrow;",
+ "8654": "nLeftrightarrow;",
+ "8655": "nRightarrow;",
+ "8656": "Leftarrow;",
+ "8657": "Uparrow;",
+ "8658": "Rightarrow;",
+ "8659": "Downarrow;",
+ "8660": "Leftrightarrow;",
+ "8661": "vArr;",
+ "8662": "nwArr;",
+ "8663": "neArr;",
+ "8664": "seArr;",
+ "8665": "swArr;",
+ "8666": "Lleftarrow;",
+ "8667": "Rrightarrow;",
+ "8669": "zigrarr;",
+ "8676": "LeftArrowBar;",
+ "8677": "RightArrowBar;",
+ "8693": "duarr;",
+ "8701": "loarr;",
+ "8702": "roarr;",
+ "8703": "hoarr;",
+ "8704": "forall;",
+ "8705": "complement;",
+ "8706": "PartialD;",
+ "8707": "Exists;",
+ "8708": "NotExists;",
+ "8709": "varnothing;",
+ "8711": "nabla;",
+ "8712": "isinv;",
+ "8713": "notinva;",
+ "8715": "SuchThat;",
+ "8716": "NotReverseElement;",
+ "8719": "Product;",
+ "8720": "Coproduct;",
+ "8721": "sum;",
+ "8722": "minus;",
+ "8723": "mp;",
+ "8724": "plusdo;",
+ "8726": "ssetmn;",
+ "8727": "lowast;",
+ "8728": "SmallCircle;",
+ "8730": "Sqrt;",
+ "8733": "vprop;",
+ "8734": "infin;",
+ "8735": "angrt;",
+ "8736": "angle;",
+ "8737": "measuredangle;",
+ "8738": "angsph;",
+ "8739": "VerticalBar;",
+ "8740": "nsmid;",
+ "8741": "spar;",
+ "8742": "nspar;",
+ "8743": "wedge;",
+ "8744": "vee;",
+ "8745": "cap;",
+ "8746": "cup;",
+ "8747": "Integral;",
+ "8748": "Int;",
+ "8749": "tint;",
+ "8750": "oint;",
+ "8751": "DoubleContourIntegral;",
+ "8752": "Cconint;",
+ "8753": "cwint;",
+ "8754": "cwconint;",
+ "8755": "CounterClockwiseContourIntegral;",
+ "8756": "therefore;",
+ "8757": "because;",
+ "8758": "ratio;",
+ "8759": "Proportion;",
+ "8760": "minusd;",
+ "8762": "mDDot;",
+ "8763": "homtht;",
+ "8764": "Tilde;",
+ "8765": "bsim;",
+ "8766": "mstpos;",
+ "8767": "acd;",
+ "8768": "wreath;",
+ "8769": "nsim;",
+ "8770": "esim;",
+ "8771": "TildeEqual;",
+ "8772": "nsimeq;",
+ "8773": "TildeFullEqual;",
+ "8774": "simne;",
+ "8775": "NotTildeFullEqual;",
+ "8776": "TildeTilde;",
+ "8777": "NotTildeTilde;",
+ "8778": "approxeq;",
+ "8779": "apid;",
+ "8780": "bcong;",
+ "8781": "CupCap;",
+ "8782": "HumpDownHump;",
+ "8783": "HumpEqual;",
+ "8784": "esdot;",
+ "8785": "eDot;",
+ "8786": "fallingdotseq;",
+ "8787": "risingdotseq;",
+ "8788": "coloneq;",
+ "8789": "eqcolon;",
+ "8790": "eqcirc;",
+ "8791": "cire;",
+ "8793": "wedgeq;",
+ "8794": "veeeq;",
+ "8796": "trie;",
+ "8799": "questeq;",
+ "8800": "NotEqual;",
+ "8801": "equiv;",
+ "8802": "NotCongruent;",
+ "8804": "leq;",
+ "8805": "GreaterEqual;",
+ "8806": "LessFullEqual;",
+ "8807": "GreaterFullEqual;",
+ "8808": "lneqq;",
+ "8809": "gneqq;",
+ "8810": "NestedLessLess;",
+ "8811": "NestedGreaterGreater;",
+ "8812": "twixt;",
+ "8813": "NotCupCap;",
+ "8814": "NotLess;",
+ "8815": "NotGreater;",
+ "8816": "NotLessEqual;",
+ "8817": "NotGreaterEqual;",
+ "8818": "lsim;",
+ "8819": "gtrsim;",
+ "8820": "NotLessTilde;",
+ "8821": "NotGreaterTilde;",
+ "8822": "lg;",
+ "8823": "gtrless;",
+ "8824": "ntlg;",
+ "8825": "ntgl;",
+ "8826": "Precedes;",
+ "8827": "Succeeds;",
+ "8828": "PrecedesSlantEqual;",
+ "8829": "SucceedsSlantEqual;",
+ "8830": "prsim;",
+ "8831": "succsim;",
+ "8832": "nprec;",
+ "8833": "nsucc;",
+ "8834": "subset;",
+ "8835": "supset;",
+ "8836": "nsub;",
+ "8837": "nsup;",
+ "8838": "SubsetEqual;",
+ "8839": "supseteq;",
+ "8840": "nsubseteq;",
+ "8841": "nsupseteq;",
+ "8842": "subsetneq;",
+ "8843": "supsetneq;",
+ "8845": "cupdot;",
+ "8846": "uplus;",
+ "8847": "SquareSubset;",
+ "8848": "SquareSuperset;",
+ "8849": "SquareSubsetEqual;",
+ "8850": "SquareSupersetEqual;",
+ "8851": "SquareIntersection;",
+ "8852": "SquareUnion;",
+ "8853": "oplus;",
+ "8854": "ominus;",
+ "8855": "otimes;",
+ "8856": "osol;",
+ "8857": "odot;",
+ "8858": "ocir;",
+ "8859": "oast;",
+ "8861": "odash;",
+ "8862": "plusb;",
+ "8863": "minusb;",
+ "8864": "timesb;",
+ "8865": "sdotb;",
+ "8866": "vdash;",
+ "8867": "LeftTee;",
+ "8868": "top;",
+ "8869": "UpTee;",
+ "8871": "models;",
+ "8872": "vDash;",
+ "8873": "Vdash;",
+ "8874": "Vvdash;",
+ "8875": "VDash;",
+ "8876": "nvdash;",
+ "8877": "nvDash;",
+ "8878": "nVdash;",
+ "8879": "nVDash;",
+ "8880": "prurel;",
+ "8882": "vltri;",
+ "8883": "vrtri;",
+ "8884": "trianglelefteq;",
+ "8885": "trianglerighteq;",
+ "8886": "origof;",
+ "8887": "imof;",
+ "8888": "mumap;",
+ "8889": "hercon;",
+ "8890": "intercal;",
+ "8891": "veebar;",
+ "8893": "barvee;",
+ "8894": "angrtvb;",
+ "8895": "lrtri;",
+ "8896": "xwedge;",
+ "8897": "xvee;",
+ "8898": "xcap;",
+ "8899": "xcup;",
+ "8900": "diamond;",
+ "8901": "sdot;",
+ "8902": "Star;",
+ "8903": "divonx;",
+ "8904": "bowtie;",
+ "8905": "ltimes;",
+ "8906": "rtimes;",
+ "8907": "lthree;",
+ "8908": "rthree;",
+ "8909": "bsime;",
+ "8910": "cuvee;",
+ "8911": "cuwed;",
+ "8912": "Subset;",
+ "8913": "Supset;",
+ "8914": "Cap;",
+ "8915": "Cup;",
+ "8916": "pitchfork;",
+ "8917": "epar;",
+ "8918": "ltdot;",
+ "8919": "gtrdot;",
+ "8920": "Ll;",
+ "8921": "ggg;",
+ "8922": "LessEqualGreater;",
+ "8923": "gtreqless;",
+ "8926": "curlyeqprec;",
+ "8927": "curlyeqsucc;",
+ "8928": "nprcue;",
+ "8929": "nsccue;",
+ "8930": "nsqsube;",
+ "8931": "nsqsupe;",
+ "8934": "lnsim;",
+ "8935": "gnsim;",
+ "8936": "prnsim;",
+ "8937": "succnsim;",
+ "8938": "ntriangleleft;",
+ "8939": "ntriangleright;",
+ "8940": "ntrianglelefteq;",
+ "8941": "ntrianglerighteq;",
+ "8942": "vellip;",
+ "8943": "ctdot;",
+ "8944": "utdot;",
+ "8945": "dtdot;",
+ "8946": "disin;",
+ "8947": "isinsv;",
+ "8948": "isins;",
+ "8949": "isindot;",
+ "8950": "notinvc;",
+ "8951": "notinvb;",
+ "8953": "isinE;",
+ "8954": "nisd;",
+ "8955": "xnis;",
+ "8956": "nis;",
+ "8957": "notnivc;",
+ "8958": "notnivb;",
+ "8965": "barwedge;",
+ "8966": "doublebarwedge;",
+ "8968": "LeftCeiling;",
+ "8969": "RightCeiling;",
+ "8970": "lfloor;",
+ "8971": "RightFloor;",
+ "8972": "drcrop;",
+ "8973": "dlcrop;",
+ "8974": "urcrop;",
+ "8975": "ulcrop;",
+ "8976": "bnot;",
+ "8978": "profline;",
+ "8979": "profsurf;",
+ "8981": "telrec;",
+ "8982": "target;",
+ "8988": "ulcorner;",
+ "8989": "urcorner;",
+ "8990": "llcorner;",
+ "8991": "lrcorner;",
+ "8994": "sfrown;",
+ "8995": "ssmile;",
+ "9005": "cylcty;",
+ "9006": "profalar;",
+ "9014": "topbot;",
+ "9021": "ovbar;",
+ "9023": "solbar;",
+ "9084": "angzarr;",
+ "9136": "lmoustache;",
+ "9137": "rmoustache;",
+ "9140": "tbrk;",
+ "9141": "UnderBracket;",
+ "9142": "bbrktbrk;",
+ "9180": "OverParenthesis;",
+ "9181": "UnderParenthesis;",
+ "9182": "OverBrace;",
+ "9183": "UnderBrace;",
+ "9186": "trpezium;",
+ "9191": "elinters;",
+ "9251": "blank;",
+ "9416": "oS;",
+ "9472": "HorizontalLine;",
+ "9474": "boxv;",
+ "9484": "boxdr;",
+ "9488": "boxdl;",
+ "9492": "boxur;",
+ "9496": "boxul;",
+ "9500": "boxvr;",
+ "9508": "boxvl;",
+ "9516": "boxhd;",
+ "9524": "boxhu;",
+ "9532": "boxvh;",
+ "9552": "boxH;",
+ "9553": "boxV;",
+ "9554": "boxdR;",
+ "9555": "boxDr;",
+ "9556": "boxDR;",
+ "9557": "boxdL;",
+ "9558": "boxDl;",
+ "9559": "boxDL;",
+ "9560": "boxuR;",
+ "9561": "boxUr;",
+ "9562": "boxUR;",
+ "9563": "boxuL;",
+ "9564": "boxUl;",
+ "9565": "boxUL;",
+ "9566": "boxvR;",
+ "9567": "boxVr;",
+ "9568": "boxVR;",
+ "9569": "boxvL;",
+ "9570": "boxVl;",
+ "9571": "boxVL;",
+ "9572": "boxHd;",
+ "9573": "boxhD;",
+ "9574": "boxHD;",
+ "9575": "boxHu;",
+ "9576": "boxhU;",
+ "9577": "boxHU;",
+ "9578": "boxvH;",
+ "9579": "boxVh;",
+ "9580": "boxVH;",
+ "9600": "uhblk;",
+ "9604": "lhblk;",
+ "9608": "block;",
+ "9617": "blk14;",
+ "9618": "blk12;",
+ "9619": "blk34;",
+ "9633": "square;",
+ "9642": "squf;",
+ "9643": "EmptyVerySmallSquare;",
+ "9645": "rect;",
+ "9646": "marker;",
+ "9649": "fltns;",
+ "9651": "xutri;",
+ "9652": "utrif;",
+ "9653": "utri;",
+ "9656": "rtrif;",
+ "9657": "triangleright;",
+ "9661": "xdtri;",
+ "9662": "dtrif;",
+ "9663": "triangledown;",
+ "9666": "ltrif;",
+ "9667": "triangleleft;",
+ "9674": "lozenge;",
+ "9675": "cir;",
+ "9708": "tridot;",
+ "9711": "xcirc;",
+ "9720": "ultri;",
+ "9721": "urtri;",
+ "9722": "lltri;",
+ "9723": "EmptySmallSquare;",
+ "9724": "FilledSmallSquare;",
+ "9733": "starf;",
+ "9734": "star;",
+ "9742": "phone;",
+ "9792": "female;",
+ "9794": "male;",
+ "9824": "spadesuit;",
+ "9827": "clubsuit;",
+ "9829": "heartsuit;",
+ "9830": "diams;",
+ "9834": "sung;",
+ "9837": "flat;",
+ "9838": "natural;",
+ "9839": "sharp;",
+ "10003": "checkmark;",
+ "10007": "cross;",
+ "10016": "maltese;",
+ "10038": "sext;",
+ "10072": "VerticalSeparator;",
+ "10098": "lbbrk;",
+ "10099": "rbbrk;",
+ "10184": "bsolhsub;",
+ "10185": "suphsol;",
+ "10214": "lobrk;",
+ "10215": "robrk;",
+ "10216": "LeftAngleBracket;",
+ "10217": "RightAngleBracket;",
+ "10218": "Lang;",
+ "10219": "Rang;",
+ "10220": "loang;",
+ "10221": "roang;",
+ "10229": "xlarr;",
+ "10230": "xrarr;",
+ "10231": "xharr;",
+ "10232": "xlArr;",
+ "10233": "xrArr;",
+ "10234": "xhArr;",
+ "10236": "xmap;",
+ "10239": "dzigrarr;",
+ "10498": "nvlArr;",
+ "10499": "nvrArr;",
+ "10500": "nvHarr;",
+ "10501": "Map;",
+ "10508": "lbarr;",
+ "10509": "rbarr;",
+ "10510": "lBarr;",
+ "10511": "rBarr;",
+ "10512": "RBarr;",
+ "10513": "DDotrahd;",
+ "10514": "UpArrowBar;",
+ "10515": "DownArrowBar;",
+ "10518": "Rarrtl;",
+ "10521": "latail;",
+ "10522": "ratail;",
+ "10523": "lAtail;",
+ "10524": "rAtail;",
+ "10525": "larrfs;",
+ "10526": "rarrfs;",
+ "10527": "larrbfs;",
+ "10528": "rarrbfs;",
+ "10531": "nwarhk;",
+ "10532": "nearhk;",
+ "10533": "searhk;",
+ "10534": "swarhk;",
+ "10535": "nwnear;",
+ "10536": "toea;",
+ "10537": "tosa;",
+ "10538": "swnwar;",
+ "10547": "rarrc;",
+ "10549": "cudarrr;",
+ "10550": "ldca;",
+ "10551": "rdca;",
+ "10552": "cudarrl;",
+ "10553": "larrpl;",
+ "10556": "curarrm;",
+ "10557": "cularrp;",
+ "10565": "rarrpl;",
+ "10568": "harrcir;",
+ "10569": "Uarrocir;",
+ "10570": "lurdshar;",
+ "10571": "ldrushar;",
+ "10574": "LeftRightVector;",
+ "10575": "RightUpDownVector;",
+ "10576": "DownLeftRightVector;",
+ "10577": "LeftUpDownVector;",
+ "10578": "LeftVectorBar;",
+ "10579": "RightVectorBar;",
+ "10580": "RightUpVectorBar;",
+ "10581": "RightDownVectorBar;",
+ "10582": "DownLeftVectorBar;",
+ "10583": "DownRightVectorBar;",
+ "10584": "LeftUpVectorBar;",
+ "10585": "LeftDownVectorBar;",
+ "10586": "LeftTeeVector;",
+ "10587": "RightTeeVector;",
+ "10588": "RightUpTeeVector;",
+ "10589": "RightDownTeeVector;",
+ "10590": "DownLeftTeeVector;",
+ "10591": "DownRightTeeVector;",
+ "10592": "LeftUpTeeVector;",
+ "10593": "LeftDownTeeVector;",
+ "10594": "lHar;",
+ "10595": "uHar;",
+ "10596": "rHar;",
+ "10597": "dHar;",
+ "10598": "luruhar;",
+ "10599": "ldrdhar;",
+ "10600": "ruluhar;",
+ "10601": "rdldhar;",
+ "10602": "lharul;",
+ "10603": "llhard;",
+ "10604": "rharul;",
+ "10605": "lrhard;",
+ "10606": "UpEquilibrium;",
+ "10607": "ReverseUpEquilibrium;",
+ "10608": "RoundImplies;",
+ "10609": "erarr;",
+ "10610": "simrarr;",
+ "10611": "larrsim;",
+ "10612": "rarrsim;",
+ "10613": "rarrap;",
+ "10614": "ltlarr;",
+ "10616": "gtrarr;",
+ "10617": "subrarr;",
+ "10619": "suplarr;",
+ "10620": "lfisht;",
+ "10621": "rfisht;",
+ "10622": "ufisht;",
+ "10623": "dfisht;",
+ "10629": "lopar;",
+ "10630": "ropar;",
+ "10635": "lbrke;",
+ "10636": "rbrke;",
+ "10637": "lbrkslu;",
+ "10638": "rbrksld;",
+ "10639": "lbrksld;",
+ "10640": "rbrkslu;",
+ "10641": "langd;",
+ "10642": "rangd;",
+ "10643": "lparlt;",
+ "10644": "rpargt;",
+ "10645": "gtlPar;",
+ "10646": "ltrPar;",
+ "10650": "vzigzag;",
+ "10652": "vangrt;",
+ "10653": "angrtvbd;",
+ "10660": "ange;",
+ "10661": "range;",
+ "10662": "dwangle;",
+ "10663": "uwangle;",
+ "10664": "angmsdaa;",
+ "10665": "angmsdab;",
+ "10666": "angmsdac;",
+ "10667": "angmsdad;",
+ "10668": "angmsdae;",
+ "10669": "angmsdaf;",
+ "10670": "angmsdag;",
+ "10671": "angmsdah;",
+ "10672": "bemptyv;",
+ "10673": "demptyv;",
+ "10674": "cemptyv;",
+ "10675": "raemptyv;",
+ "10676": "laemptyv;",
+ "10677": "ohbar;",
+ "10678": "omid;",
+ "10679": "opar;",
+ "10681": "operp;",
+ "10683": "olcross;",
+ "10684": "odsold;",
+ "10686": "olcir;",
+ "10687": "ofcir;",
+ "10688": "olt;",
+ "10689": "ogt;",
+ "10690": "cirscir;",
+ "10691": "cirE;",
+ "10692": "solb;",
+ "10693": "bsolb;",
+ "10697": "boxbox;",
+ "10701": "trisb;",
+ "10702": "rtriltri;",
+ "10703": "LeftTriangleBar;",
+ "10704": "RightTriangleBar;",
+ "10716": "iinfin;",
+ "10717": "infintie;",
+ "10718": "nvinfin;",
+ "10723": "eparsl;",
+ "10724": "smeparsl;",
+ "10725": "eqvparsl;",
+ "10731": "lozf;",
+ "10740": "RuleDelayed;",
+ "10742": "dsol;",
+ "10752": "xodot;",
+ "10753": "xoplus;",
+ "10754": "xotime;",
+ "10756": "xuplus;",
+ "10758": "xsqcup;",
+ "10764": "qint;",
+ "10765": "fpartint;",
+ "10768": "cirfnint;",
+ "10769": "awint;",
+ "10770": "rppolint;",
+ "10771": "scpolint;",
+ "10772": "npolint;",
+ "10773": "pointint;",
+ "10774": "quatint;",
+ "10775": "intlarhk;",
+ "10786": "pluscir;",
+ "10787": "plusacir;",
+ "10788": "simplus;",
+ "10789": "plusdu;",
+ "10790": "plussim;",
+ "10791": "plustwo;",
+ "10793": "mcomma;",
+ "10794": "minusdu;",
+ "10797": "loplus;",
+ "10798": "roplus;",
+ "10799": "Cross;",
+ "10800": "timesd;",
+ "10801": "timesbar;",
+ "10803": "smashp;",
+ "10804": "lotimes;",
+ "10805": "rotimes;",
+ "10806": "otimesas;",
+ "10807": "Otimes;",
+ "10808": "odiv;",
+ "10809": "triplus;",
+ "10810": "triminus;",
+ "10811": "tritime;",
+ "10812": "iprod;",
+ "10815": "amalg;",
+ "10816": "capdot;",
+ "10818": "ncup;",
+ "10819": "ncap;",
+ "10820": "capand;",
+ "10821": "cupor;",
+ "10822": "cupcap;",
+ "10823": "capcup;",
+ "10824": "cupbrcap;",
+ "10825": "capbrcup;",
+ "10826": "cupcup;",
+ "10827": "capcap;",
+ "10828": "ccups;",
+ "10829": "ccaps;",
+ "10832": "ccupssm;",
+ "10835": "And;",
+ "10836": "Or;",
+ "10837": "andand;",
+ "10838": "oror;",
+ "10839": "orslope;",
+ "10840": "andslope;",
+ "10842": "andv;",
+ "10843": "orv;",
+ "10844": "andd;",
+ "10845": "ord;",
+ "10847": "wedbar;",
+ "10854": "sdote;",
+ "10858": "simdot;",
+ "10861": "congdot;",
+ "10862": "easter;",
+ "10863": "apacir;",
+ "10864": "apE;",
+ "10865": "eplus;",
+ "10866": "pluse;",
+ "10867": "Esim;",
+ "10868": "Colone;",
+ "10869": "Equal;",
+ "10871": "eDDot;",
+ "10872": "equivDD;",
+ "10873": "ltcir;",
+ "10874": "gtcir;",
+ "10875": "ltquest;",
+ "10876": "gtquest;",
+ "10877": "LessSlantEqual;",
+ "10878": "GreaterSlantEqual;",
+ "10879": "lesdot;",
+ "10880": "gesdot;",
+ "10881": "lesdoto;",
+ "10882": "gesdoto;",
+ "10883": "lesdotor;",
+ "10884": "gesdotol;",
+ "10885": "lessapprox;",
+ "10886": "gtrapprox;",
+ "10887": "lneq;",
+ "10888": "gneq;",
+ "10889": "lnapprox;",
+ "10890": "gnapprox;",
+ "10891": "lesseqqgtr;",
+ "10892": "gtreqqless;",
+ "10893": "lsime;",
+ "10894": "gsime;",
+ "10895": "lsimg;",
+ "10896": "gsiml;",
+ "10897": "lgE;",
+ "10898": "glE;",
+ "10899": "lesges;",
+ "10900": "gesles;",
+ "10901": "eqslantless;",
+ "10902": "eqslantgtr;",
+ "10903": "elsdot;",
+ "10904": "egsdot;",
+ "10905": "el;",
+ "10906": "eg;",
+ "10909": "siml;",
+ "10910": "simg;",
+ "10911": "simlE;",
+ "10912": "simgE;",
+ "10913": "LessLess;",
+ "10914": "GreaterGreater;",
+ "10916": "glj;",
+ "10917": "gla;",
+ "10918": "ltcc;",
+ "10919": "gtcc;",
+ "10920": "lescc;",
+ "10921": "gescc;",
+ "10922": "smt;",
+ "10923": "lat;",
+ "10924": "smte;",
+ "10925": "late;",
+ "10926": "bumpE;",
+ "10927": "preceq;",
+ "10928": "succeq;",
+ "10931": "prE;",
+ "10932": "scE;",
+ "10933": "prnE;",
+ "10934": "succneqq;",
+ "10935": "precapprox;",
+ "10936": "succapprox;",
+ "10937": "prnap;",
+ "10938": "succnapprox;",
+ "10939": "Pr;",
+ "10940": "Sc;",
+ "10941": "subdot;",
+ "10942": "supdot;",
+ "10943": "subplus;",
+ "10944": "supplus;",
+ "10945": "submult;",
+ "10946": "supmult;",
+ "10947": "subedot;",
+ "10948": "supedot;",
+ "10949": "subseteqq;",
+ "10950": "supseteqq;",
+ "10951": "subsim;",
+ "10952": "supsim;",
+ "10955": "subsetneqq;",
+ "10956": "supsetneqq;",
+ "10959": "csub;",
+ "10960": "csup;",
+ "10961": "csube;",
+ "10962": "csupe;",
+ "10963": "subsup;",
+ "10964": "supsub;",
+ "10965": "subsub;",
+ "10966": "supsup;",
+ "10967": "suphsub;",
+ "10968": "supdsub;",
+ "10969": "forkv;",
+ "10970": "topfork;",
+ "10971": "mlcp;",
+ "10980": "DoubleLeftTee;",
+ "10982": "Vdashl;",
+ "10983": "Barv;",
+ "10984": "vBar;",
+ "10985": "vBarv;",
+ "10987": "Vbar;",
+ "10988": "Not;",
+ "10989": "bNot;",
+ "10990": "rnmid;",
+ "10991": "cirmid;",
+ "10992": "midcir;",
+ "10993": "topcir;",
+ "10994": "nhpar;",
+ "10995": "parsim;",
+ "11005": "parsl;",
+ "64256": "fflig;",
+ "64257": "filig;",
+ "64258": "fllig;",
+ "64259": "ffilig;",
+ "64260": "ffllig;"
+}
+},{}],566:[function(require,module,exports){
+var prr = require('prr')
+
+function init (type, message, cause) {
+ if (!!message && typeof message != 'string') {
+ message = message.message || message.name
+ }
+ prr(this, {
+ type : type
+ , name : type
+ // can be passed just a 'cause'
+ , cause : typeof message != 'string' ? message : cause
+ , message : message
+ }, 'ewr')
+}
+
+// generic prototype, not intended to be actually used - helpful for `instanceof`
+function CustomError (message, cause) {
+ Error.call(this)
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, this.constructor)
+ init.call(this, 'CustomError', message, cause)
+}
+
+CustomError.prototype = new Error()
+
+function createError (errno, type, proto) {
+ var err = function (message, cause) {
+ init.call(this, type, message, cause)
+ //TODO: the specificity here is stupid, errno should be available everywhere
+ if (type == 'FilesystemError') {
+ this.code = this.cause.code
+ this.path = this.cause.path
+ this.errno = this.cause.errno
+ this.message =
+ (errno.errno[this.cause.errno]
+ ? errno.errno[this.cause.errno].description
+ : this.cause.message)
+ + (this.cause.path ? ' [' + this.cause.path + ']' : '')
+ }
+ Error.call(this)
+ if (Error.captureStackTrace)
+ Error.captureStackTrace(this, err)
+ }
+ err.prototype = !!proto ? new proto() : new CustomError()
+ return err
+}
+
+module.exports = function (errno) {
+ var ce = function (type, proto) {
+ return createError(errno, type, proto)
+ }
+ return {
+ CustomError : CustomError
+ , FilesystemError : ce('FilesystemError')
+ , createError : ce
+ }
+}
+
+},{"prr":1023}],567:[function(require,module,exports){
+var all = module.exports.all = [
+ {
+ errno: -2,
+ code: 'ENOENT',
+ description: 'no such file or directory'
+ },
+ {
+ errno: -1,
+ code: 'UNKNOWN',
+ description: 'unknown error'
+ },
+ {
+ errno: 0,
+ code: 'OK',
+ description: 'success'
+ },
+ {
+ errno: 1,
+ code: 'EOF',
+ description: 'end of file'
+ },
+ {
+ errno: 2,
+ code: 'EADDRINFO',
+ description: 'getaddrinfo error'
+ },
+ {
+ errno: 3,
+ code: 'EACCES',
+ description: 'permission denied'
+ },
+ {
+ errno: 4,
+ code: 'EAGAIN',
+ description: 'resource temporarily unavailable'
+ },
+ {
+ errno: 5,
+ code: 'EADDRINUSE',
+ description: 'address already in use'
+ },
+ {
+ errno: 6,
+ code: 'EADDRNOTAVAIL',
+ description: 'address not available'
+ },
+ {
+ errno: 7,
+ code: 'EAFNOSUPPORT',
+ description: 'address family not supported'
+ },
+ {
+ errno: 8,
+ code: 'EALREADY',
+ description: 'connection already in progress'
+ },
+ {
+ errno: 9,
+ code: 'EBADF',
+ description: 'bad file descriptor'
+ },
+ {
+ errno: 10,
+ code: 'EBUSY',
+ description: 'resource busy or locked'
+ },
+ {
+ errno: 11,
+ code: 'ECONNABORTED',
+ description: 'software caused connection abort'
+ },
+ {
+ errno: 12,
+ code: 'ECONNREFUSED',
+ description: 'connection refused'
+ },
+ {
+ errno: 13,
+ code: 'ECONNRESET',
+ description: 'connection reset by peer'
+ },
+ {
+ errno: 14,
+ code: 'EDESTADDRREQ',
+ description: 'destination address required'
+ },
+ {
+ errno: 15,
+ code: 'EFAULT',
+ description: 'bad address in system call argument'
+ },
+ {
+ errno: 16,
+ code: 'EHOSTUNREACH',
+ description: 'host is unreachable'
+ },
+ {
+ errno: 17,
+ code: 'EINTR',
+ description: 'interrupted system call'
+ },
+ {
+ errno: 18,
+ code: 'EINVAL',
+ description: 'invalid argument'
+ },
+ {
+ errno: 19,
+ code: 'EISCONN',
+ description: 'socket is already connected'
+ },
+ {
+ errno: 20,
+ code: 'EMFILE',
+ description: 'too many open files'
+ },
+ {
+ errno: 21,
+ code: 'EMSGSIZE',
+ description: 'message too long'
+ },
+ {
+ errno: 22,
+ code: 'ENETDOWN',
+ description: 'network is down'
+ },
+ {
+ errno: 23,
+ code: 'ENETUNREACH',
+ description: 'network is unreachable'
+ },
+ {
+ errno: 24,
+ code: 'ENFILE',
+ description: 'file table overflow'
+ },
+ {
+ errno: 25,
+ code: 'ENOBUFS',
+ description: 'no buffer space available'
+ },
+ {
+ errno: 26,
+ code: 'ENOMEM',
+ description: 'not enough memory'
+ },
+ {
+ errno: 27,
+ code: 'ENOTDIR',
+ description: 'not a directory'
+ },
+ {
+ errno: 28,
+ code: 'EISDIR',
+ description: 'illegal operation on a directory'
+ },
+ {
+ errno: 29,
+ code: 'ENONET',
+ description: 'machine is not on the network'
+ },
+ {
+ errno: 31,
+ code: 'ENOTCONN',
+ description: 'socket is not connected'
+ },
+ {
+ errno: 32,
+ code: 'ENOTSOCK',
+ description: 'socket operation on non-socket'
+ },
+ {
+ errno: 33,
+ code: 'ENOTSUP',
+ description: 'operation not supported on socket'
+ },
+ {
+ errno: 34,
+ code: 'ENOENT',
+ description: 'no such file or directory'
+ },
+ {
+ errno: 35,
+ code: 'ENOSYS',
+ description: 'function not implemented'
+ },
+ {
+ errno: 36,
+ code: 'EPIPE',
+ description: 'broken pipe'
+ },
+ {
+ errno: 37,
+ code: 'EPROTO',
+ description: 'protocol error'
+ },
+ {
+ errno: 38,
+ code: 'EPROTONOSUPPORT',
+ description: 'protocol not supported'
+ },
+ {
+ errno: 39,
+ code: 'EPROTOTYPE',
+ description: 'protocol wrong type for socket'
+ },
+ {
+ errno: 40,
+ code: 'ETIMEDOUT',
+ description: 'connection timed out'
+ },
+ {
+ errno: 41,
+ code: 'ECHARSET',
+ description: 'invalid Unicode character'
+ },
+ {
+ errno: 42,
+ code: 'EAIFAMNOSUPPORT',
+ description: 'address family for hostname not supported'
+ },
+ {
+ errno: 44,
+ code: 'EAISERVICE',
+ description: 'servname not supported for ai_socktype'
+ },
+ {
+ errno: 45,
+ code: 'EAISOCKTYPE',
+ description: 'ai_socktype not supported'
+ },
+ {
+ errno: 46,
+ code: 'ESHUTDOWN',
+ description: 'cannot send after transport endpoint shutdown'
+ },
+ {
+ errno: 47,
+ code: 'EEXIST',
+ description: 'file already exists'
+ },
+ {
+ errno: 48,
+ code: 'ESRCH',
+ description: 'no such process'
+ },
+ {
+ errno: 49,
+ code: 'ENAMETOOLONG',
+ description: 'name too long'
+ },
+ {
+ errno: 50,
+ code: 'EPERM',
+ description: 'operation not permitted'
+ },
+ {
+ errno: 51,
+ code: 'ELOOP',
+ description: 'too many symbolic links encountered'
+ },
+ {
+ errno: 52,
+ code: 'EXDEV',
+ description: 'cross-device link not permitted'
+ },
+ {
+ errno: 53,
+ code: 'ENOTEMPTY',
+ description: 'directory not empty'
+ },
+ {
+ errno: 54,
+ code: 'ENOSPC',
+ description: 'no space left on device'
+ },
+ {
+ errno: 55,
+ code: 'EIO',
+ description: 'i/o error'
+ },
+ {
+ errno: 56,
+ code: 'EROFS',
+ description: 'read-only file system'
+ },
+ {
+ errno: 57,
+ code: 'ENODEV',
+ description: 'no such device'
+ },
+ {
+ errno: 58,
+ code: 'ESPIPE',
+ description: 'invalid seek'
+ },
+ {
+ errno: 59,
+ code: 'ECANCELED',
+ description: 'operation canceled'
+ }
+]
+
+module.exports.errno = {}
+module.exports.code = {}
+
+all.forEach(function (error) {
+ module.exports.errno[error.errno] = error
+ module.exports.code[error.code] = error
+})
+
+module.exports.custom = require('./custom')(module.exports)
+module.exports.create = module.exports.custom.createError
+
+},{"./custom":566}],568:[function(require,module,exports){
+'use strict';
+
+var util = require('util');
+var isArrayish = require('is-arrayish');
+
+var errorEx = function errorEx(name, properties) {
+ if (!name || name.constructor !== String) {
+ properties = name || {};
+ name = Error.name;
+ }
+
+ var errorExError = function ErrorEXError(message) {
+ if (!this) {
+ return new ErrorEXError(message);
+ }
+
+ message = message instanceof Error
+ ? message.message
+ : (message || this.message);
+
+ Error.call(this, message);
+ Error.captureStackTrace(this, errorExError);
+
+ this.name = name;
+
+ Object.defineProperty(this, 'message', {
+ configurable: true,
+ enumerable: false,
+ get: function () {
+ var newMessage = message.split(/\r?\n/g);
+
+ for (var key in properties) {
+ if (!properties.hasOwnProperty(key)) {
+ continue;
+ }
+
+ var modifier = properties[key];
+
+ if ('message' in modifier) {
+ newMessage = modifier.message(this[key], newMessage) || newMessage;
+ if (!isArrayish(newMessage)) {
+ newMessage = [newMessage];
+ }
+ }
+ }
+
+ return newMessage.join('\n');
+ },
+ set: function (v) {
+ message = v;
+ }
+ });
+
+ var overwrittenStack = null;
+
+ var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack');
+ var stackGetter = stackDescriptor.get;
+ var stackValue = stackDescriptor.value;
+ delete stackDescriptor.value;
+ delete stackDescriptor.writable;
+
+ stackDescriptor.set = function (newstack) {
+ overwrittenStack = newstack;
+ };
+
+ stackDescriptor.get = function () {
+ var stack = (overwrittenStack || ((stackGetter)
+ ? stackGetter.call(this)
+ : stackValue)).split(/\r?\n+/g);
+
+ // starting in Node 7, the stack builder caches the message.
+ // just replace it.
+ if (!overwrittenStack) {
+ stack[0] = this.name + ': ' + this.message;
+ }
+
+ var lineCount = 1;
+ for (var key in properties) {
+ if (!properties.hasOwnProperty(key)) {
+ continue;
+ }
+
+ var modifier = properties[key];
+
+ if ('line' in modifier) {
+ var line = modifier.line(this[key]);
+ if (line) {
+ stack.splice(lineCount++, 0, ' ' + line);
+ }
+ }
+
+ if ('stack' in modifier) {
+ modifier.stack(this[key], stack);
+ }
+ }
+
+ return stack.join('\n');
+ };
+
+ Object.defineProperty(this, 'stack', stackDescriptor);
+ };
+
+ if (Object.setPrototypeOf) {
+ Object.setPrototypeOf(errorExError.prototype, Error.prototype);
+ Object.setPrototypeOf(errorExError, Error);
+ } else {
+ util.inherits(errorExError, Error);
+ }
+
+ return errorExError;
+};
+
+errorEx.append = function (str, def) {
+ return {
+ message: function (v, message) {
+ v = v || def;
+
+ if (v) {
+ message[0] += ' ' + str.replace('%s', v.toString());
+ }
+
+ return message;
+ }
+ };
+};
+
+errorEx.line = function (str, def) {
+ return {
+ line: function (v) {
+ v = v || def;
+
+ if (v) {
+ return str.replace('%s', v.toString());
+ }
+
+ return null;
+ }
+ };
+};
+
+module.exports = errorEx;
+
+},{"is-arrayish":838,"util":1439}],569:[function(require,module,exports){
+'use strict';
+
+/* globals
+ Set,
+ Map,
+ WeakSet,
+ WeakMap,
+
+ Promise,
+
+ Symbol,
+ Proxy,
+
+ Atomics,
+ SharedArrayBuffer,
+
+ ArrayBuffer,
+ DataView,
+ Uint8Array,
+ Float32Array,
+ Float64Array,
+ Int8Array,
+ Int16Array,
+ Int32Array,
+ Uint8ClampedArray,
+ Uint16Array,
+ Uint32Array,
+*/
+
+var undefined; // eslint-disable-line no-shadow-restricted-names
+
+var ThrowTypeError = Object.getOwnPropertyDescriptor
+ ? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }())
+ : function () { throw new TypeError(); };
+
+var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
+
+var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
+
+var generator; // = function * () {};
+var generatorFunction = generator ? getProto(generator) : undefined;
+var asyncFn; // async function() {};
+var asyncFunction = asyncFn ? asyncFn.constructor : undefined;
+var asyncGen; // async function * () {};
+var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined;
+var asyncGenIterator = asyncGen ? asyncGen() : undefined;
+
+var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
+
+var INTRINSICS = {
+ '$ %Array%': Array,
+ '$ %ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
+ '$ %ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype,
+ '$ %ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
+ '$ %ArrayPrototype%': Array.prototype,
+ '$ %ArrayProto_entries%': Array.prototype.entries,
+ '$ %ArrayProto_forEach%': Array.prototype.forEach,
+ '$ %ArrayProto_keys%': Array.prototype.keys,
+ '$ %ArrayProto_values%': Array.prototype.values,
+ '$ %AsyncFromSyncIteratorPrototype%': undefined,
+ '$ %AsyncFunction%': asyncFunction,
+ '$ %AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined,
+ '$ %AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined,
+ '$ %AsyncGeneratorFunction%': asyncGenFunction,
+ '$ %AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined,
+ '$ %AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined,
+ '$ %Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
+ '$ %Boolean%': Boolean,
+ '$ %BooleanPrototype%': Boolean.prototype,
+ '$ %DataView%': typeof DataView === 'undefined' ? undefined : DataView,
+ '$ %DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype,
+ '$ %Date%': Date,
+ '$ %DatePrototype%': Date.prototype,
+ '$ %decodeURI%': decodeURI,
+ '$ %decodeURIComponent%': decodeURIComponent,
+ '$ %encodeURI%': encodeURI,
+ '$ %encodeURIComponent%': encodeURIComponent,
+ '$ %Error%': Error,
+ '$ %ErrorPrototype%': Error.prototype,
+ '$ %eval%': eval, // eslint-disable-line no-eval
+ '$ %EvalError%': EvalError,
+ '$ %EvalErrorPrototype%': EvalError.prototype,
+ '$ %Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
+ '$ %Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype,
+ '$ %Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
+ '$ %Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype,
+ '$ %Function%': Function,
+ '$ %FunctionPrototype%': Function.prototype,
+ '$ %Generator%': generator ? getProto(generator()) : undefined,
+ '$ %GeneratorFunction%': generatorFunction,
+ '$ %GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined,
+ '$ %Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
+ '$ %Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype,
+ '$ %Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
+ '$ %Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype,
+ '$ %Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
+ '$ %Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype,
+ '$ %isFinite%': isFinite,
+ '$ %isNaN%': isNaN,
+ '$ %IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
+ '$ %JSON%': JSON,
+ '$ %JSONParse%': JSON.parse,
+ '$ %Map%': typeof Map === 'undefined' ? undefined : Map,
+ '$ %MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
+ '$ %MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype,
+ '$ %Math%': Math,
+ '$ %Number%': Number,
+ '$ %NumberPrototype%': Number.prototype,
+ '$ %Object%': Object,
+ '$ %ObjectPrototype%': Object.prototype,
+ '$ %ObjProto_toString%': Object.prototype.toString,
+ '$ %ObjProto_valueOf%': Object.prototype.valueOf,
+ '$ %parseFloat%': parseFloat,
+ '$ %parseInt%': parseInt,
+ '$ %Promise%': typeof Promise === 'undefined' ? undefined : Promise,
+ '$ %PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype,
+ '$ %PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then,
+ '$ %Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all,
+ '$ %Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject,
+ '$ %Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve,
+ '$ %Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
+ '$ %RangeError%': RangeError,
+ '$ %RangeErrorPrototype%': RangeError.prototype,
+ '$ %ReferenceError%': ReferenceError,
+ '$ %ReferenceErrorPrototype%': ReferenceError.prototype,
+ '$ %Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
+ '$ %RegExp%': RegExp,
+ '$ %RegExpPrototype%': RegExp.prototype,
+ '$ %Set%': typeof Set === 'undefined' ? undefined : Set,
+ '$ %SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
+ '$ %SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype,
+ '$ %SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
+ '$ %SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype,
+ '$ %String%': String,
+ '$ %StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
+ '$ %StringPrototype%': String.prototype,
+ '$ %Symbol%': hasSymbols ? Symbol : undefined,
+ '$ %SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined,
+ '$ %SyntaxError%': SyntaxError,
+ '$ %SyntaxErrorPrototype%': SyntaxError.prototype,
+ '$ %ThrowTypeError%': ThrowTypeError,
+ '$ %TypedArray%': TypedArray,
+ '$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined,
+ '$ %TypeError%': TypeError,
+ '$ %TypeErrorPrototype%': TypeError.prototype,
+ '$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
+ '$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype,
+ '$ %Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
+ '$ %Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype,
+ '$ %Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
+ '$ %Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype,
+ '$ %Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
+ '$ %Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype,
+ '$ %URIError%': URIError,
+ '$ %URIErrorPrototype%': URIError.prototype,
+ '$ %WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
+ '$ %WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype,
+ '$ %WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
+ '$ %WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype
+};
+
+module.exports = function GetIntrinsic(name, allowMissing) {
+ if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
+ throw new TypeError('"allowMissing" argument must be a boolean');
+ }
+
+ var key = '$ ' + name;
+ if (!(key in INTRINSICS)) {
+ throw new SyntaxError('intrinsic ' + name + ' does not exist!');
+ }
+
+ // istanbul ignore if // hopefully this is impossible to test :-)
+ if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) {
+ throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
+ }
+ return INTRINSICS[key];
+};
+
+},{}],570:[function(require,module,exports){
+'use strict';
+
+var GetIntrinsic = require('./GetIntrinsic');
+
+var $Object = GetIntrinsic('%Object%');
+var $TypeError = GetIntrinsic('%TypeError%');
+var $String = GetIntrinsic('%String%');
+
+var assertRecord = require('./helpers/assertRecord');
+var $isNaN = require('./helpers/isNaN');
+var $isFinite = require('./helpers/isFinite');
+
+var sign = require('./helpers/sign');
+var mod = require('./helpers/mod');
+
+var IsCallable = require('is-callable');
+var toPrimitive = require('es-to-primitive/es5');
+
+var has = require('has');
+
+// https://es5.github.io/#x9
+var ES5 = {
+ ToPrimitive: toPrimitive,
+
+ ToBoolean: function ToBoolean(value) {
+ return !!value;
+ },
+ ToNumber: function ToNumber(value) {
+ return +value; // eslint-disable-line no-implicit-coercion
+ },
+ ToInteger: function ToInteger(value) {
+ var number = this.ToNumber(value);
+ if ($isNaN(number)) { return 0; }
+ if (number === 0 || !$isFinite(number)) { return number; }
+ return sign(number) * Math.floor(Math.abs(number));
+ },
+ ToInt32: function ToInt32(x) {
+ return this.ToNumber(x) >> 0;
+ },
+ ToUint32: function ToUint32(x) {
+ return this.ToNumber(x) >>> 0;
+ },
+ ToUint16: function ToUint16(value) {
+ var number = this.ToNumber(value);
+ if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
+ var posInt = sign(number) * Math.floor(Math.abs(number));
+ return mod(posInt, 0x10000);
+ },
+ ToString: function ToString(value) {
+ return $String(value);
+ },
+ ToObject: function ToObject(value) {
+ this.CheckObjectCoercible(value);
+ return $Object(value);
+ },
+ CheckObjectCoercible: function CheckObjectCoercible(value, optMessage) {
+ /* jshint eqnull:true */
+ if (value == null) {
+ throw new $TypeError(optMessage || 'Cannot call method on ' + value);
+ }
+ return value;
+ },
+ IsCallable: IsCallable,
+ SameValue: function SameValue(x, y) {
+ if (x === y) { // 0 === -0, but they are not identical.
+ if (x === 0) { return 1 / x === 1 / y; }
+ return true;
+ }
+ return $isNaN(x) && $isNaN(y);
+ },
+
+ // https://www.ecma-international.org/ecma-262/5.1/#sec-8
+ Type: function Type(x) {
+ if (x === null) {
+ return 'Null';
+ }
+ if (typeof x === 'undefined') {
+ return 'Undefined';
+ }
+ if (typeof x === 'function' || typeof x === 'object') {
+ return 'Object';
+ }
+ if (typeof x === 'number') {
+ return 'Number';
+ }
+ if (typeof x === 'boolean') {
+ return 'Boolean';
+ }
+ if (typeof x === 'string') {
+ return 'String';
+ }
+ },
+
+ // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
+ IsPropertyDescriptor: function IsPropertyDescriptor(Desc) {
+ if (this.Type(Desc) !== 'Object') {
+ return false;
+ }
+ var allowed = {
+ '[[Configurable]]': true,
+ '[[Enumerable]]': true,
+ '[[Get]]': true,
+ '[[Set]]': true,
+ '[[Value]]': true,
+ '[[Writable]]': true
+ };
+
+ for (var key in Desc) { // eslint-disable-line
+ if (has(Desc, key) && !allowed[key]) {
+ return false;
+ }
+ }
+
+ var isData = has(Desc, '[[Value]]');
+ var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
+ if (isData && IsAccessor) {
+ throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
+ }
+ return true;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-8.10.1
+ IsAccessorDescriptor: function IsAccessorDescriptor(Desc) {
+ if (typeof Desc === 'undefined') {
+ return false;
+ }
+
+ assertRecord(this, 'Property Descriptor', 'Desc', Desc);
+
+ if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
+ return false;
+ }
+
+ return true;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-8.10.2
+ IsDataDescriptor: function IsDataDescriptor(Desc) {
+ if (typeof Desc === 'undefined') {
+ return false;
+ }
+
+ assertRecord(this, 'Property Descriptor', 'Desc', Desc);
+
+ if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
+ return false;
+ }
+
+ return true;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-8.10.3
+ IsGenericDescriptor: function IsGenericDescriptor(Desc) {
+ if (typeof Desc === 'undefined') {
+ return false;
+ }
+
+ assertRecord(this, 'Property Descriptor', 'Desc', Desc);
+
+ if (!this.IsAccessorDescriptor(Desc) && !this.IsDataDescriptor(Desc)) {
+ return true;
+ }
+
+ return false;
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-8.10.4
+ FromPropertyDescriptor: function FromPropertyDescriptor(Desc) {
+ if (typeof Desc === 'undefined') {
+ return Desc;
+ }
+
+ assertRecord(this, 'Property Descriptor', 'Desc', Desc);
+
+ if (this.IsDataDescriptor(Desc)) {
+ return {
+ value: Desc['[[Value]]'],
+ writable: !!Desc['[[Writable]]'],
+ enumerable: !!Desc['[[Enumerable]]'],
+ configurable: !!Desc['[[Configurable]]']
+ };
+ } else if (this.IsAccessorDescriptor(Desc)) {
+ return {
+ get: Desc['[[Get]]'],
+ set: Desc['[[Set]]'],
+ enumerable: !!Desc['[[Enumerable]]'],
+ configurable: !!Desc['[[Configurable]]']
+ };
+ } else {
+ throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor');
+ }
+ },
+
+ // https://ecma-international.org/ecma-262/5.1/#sec-8.10.5
+ ToPropertyDescriptor: function ToPropertyDescriptor(Obj) {
+ if (this.Type(Obj) !== 'Object') {
+ throw new $TypeError('ToPropertyDescriptor requires an object');
+ }
+
+ var desc = {};
+ if (has(Obj, 'enumerable')) {
+ desc['[[Enumerable]]'] = this.ToBoolean(Obj.enumerable);
+ }
+ if (has(Obj, 'configurable')) {
+ desc['[[Configurable]]'] = this.ToBoolean(Obj.configurable);
+ }
+ if (has(Obj, 'value')) {
+ desc['[[Value]]'] = Obj.value;
+ }
+ if (has(Obj, 'writable')) {
+ desc['[[Writable]]'] = this.ToBoolean(Obj.writable);
+ }
+ if (has(Obj, 'get')) {
+ var getter = Obj.get;
+ if (typeof getter !== 'undefined' && !this.IsCallable(getter)) {
+ throw new TypeError('getter must be a function');
+ }
+ desc['[[Get]]'] = getter;
+ }
+ if (has(Obj, 'set')) {
+ var setter = Obj.set;
+ if (typeof setter !== 'undefined' && !this.IsCallable(setter)) {
+ throw new $TypeError('setter must be a function');
+ }
+ desc['[[Set]]'] = setter;
+ }
+
+ if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) {
+ throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
+ }
+ return desc;
+ }
+};
+
+module.exports = ES5;
+
+},{"./GetIntrinsic":569,"./helpers/assertRecord":571,"./helpers/isFinite":572,"./helpers/isNaN":573,"./helpers/mod":574,"./helpers/sign":575,"es-to-primitive/es5":576,"has":801,"is-callable":840}],571:[function(require,module,exports){
+'use strict';
+
+var GetIntrinsic = require('../GetIntrinsic');
+
+var $TypeError = GetIntrinsic('%TypeError%');
+var $SyntaxError = GetIntrinsic('%SyntaxError%');
+
+var has = require('has');
+
+var predicates = {
+ // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
+ 'Property Descriptor': function isPropertyDescriptor(ES, Desc) {
+ if (ES.Type(Desc) !== 'Object') {
+ return false;
+ }
+ var allowed = {
+ '[[Configurable]]': true,
+ '[[Enumerable]]': true,
+ '[[Get]]': true,
+ '[[Set]]': true,
+ '[[Value]]': true,
+ '[[Writable]]': true
+ };
+
+ for (var key in Desc) { // eslint-disable-line
+ if (has(Desc, key) && !allowed[key]) {
+ return false;
+ }
+ }
+
+ var isData = has(Desc, '[[Value]]');
+ var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
+ if (isData && IsAccessor) {
+ throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
+ }
+ return true;
+ }
+};
+
+module.exports = function assertRecord(ES, recordType, argumentName, value) {
+ var predicate = predicates[recordType];
+ if (typeof predicate !== 'function') {
+ throw new $SyntaxError('unknown record type: ' + recordType);
+ }
+ if (!predicate(ES, value)) {
+ throw new $TypeError(argumentName + ' must be a ' + recordType);
+ }
+ console.log(predicate(ES, value), value);
+};
+
+},{"../GetIntrinsic":569,"has":801}],572:[function(require,module,exports){
+var $isNaN = Number.isNaN || function (a) { return a !== a; };
+
+module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
+
+},{}],573:[function(require,module,exports){
+module.exports = Number.isNaN || function isNaN(a) {
+ return a !== a;
+};
+
+},{}],574:[function(require,module,exports){
+module.exports = function mod(number, modulo) {
+ var remain = number % modulo;
+ return Math.floor(remain >= 0 ? remain : remain + modulo);
+};
+
+},{}],575:[function(require,module,exports){
+module.exports = function sign(number) {
+ return number >= 0 ? 1 : -1;
+};
+
+},{}],576:[function(require,module,exports){
+'use strict';
+
+var toStr = Object.prototype.toString;
+
+var isPrimitive = require('./helpers/isPrimitive');
+
+var isCallable = require('is-callable');
+
+// http://ecma-international.org/ecma-262/5.1/#sec-8.12.8
+var ES5internalSlots = {
+ '[[DefaultValue]]': function (O) {
+ var actualHint;
+ if (arguments.length > 1) {
+ actualHint = arguments[1];
+ } else {
+ actualHint = toStr.call(O) === '[object Date]' ? String : Number;
+ }
+
+ if (actualHint === String || actualHint === Number) {
+ var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
+ var value, i;
+ for (i = 0; i < methods.length; ++i) {
+ if (isCallable(O[methods[i]])) {
+ value = O[methods[i]]();
+ if (isPrimitive(value)) {
+ return value;
+ }
+ }
+ }
+ throw new TypeError('No default value');
+ }
+ throw new TypeError('invalid [[DefaultValue]] hint supplied');
+ }
+};
+
+// http://ecma-international.org/ecma-262/5.1/#sec-9.1
+module.exports = function ToPrimitive(input) {
+ if (isPrimitive(input)) {
+ return input;
+ }
+ if (arguments.length > 1) {
+ return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]);
+ }
+ return ES5internalSlots['[[DefaultValue]]'](input);
+};
+
+},{"./helpers/isPrimitive":577,"is-callable":840}],577:[function(require,module,exports){
+module.exports = function isPrimitive(value) {
+ return value === null || (typeof value !== 'function' && typeof value !== 'object');
+};
+
+},{}],578:[function(require,module,exports){
+'use strict';
+
+var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
+
+module.exports = function (str) {
+ if (typeof str !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ return str.replace(matchOperatorsRe, '\\$&');
+};
+
+},{}],579:[function(require,module,exports){
+(function (Buffer){
+var sha3 = require('js-sha3').keccak_256
+var uts46 = require('idna-uts46-hx')
+
+function namehash (inputName) {
+ // Reject empty names:
+ var node = ''
+ for (var i = 0; i < 32; i++) {
+ node += '00'
+ }
+
+ name = normalize(inputName)
+
+ if (name) {
+ var labels = name.split('.')
+
+ for(var i = labels.length - 1; i >= 0; i--) {
+ var labelSha = sha3(labels[i])
+ node = sha3(new Buffer(node + labelSha, 'hex'))
+ }
+ }
+
+ return '0x' + node
+}
+
+function normalize(name) {
+ return name ? uts46.toUnicode(name, {useStd3ASCII: true, transitional: false}) : name
+}
+
+exports.hash = namehash
+exports.normalize = normalize
+
+}).call(this,require("buffer").Buffer)
+},{"buffer":113,"idna-uts46-hx":826,"js-sha3":580}],580:[function(require,module,exports){
+(function (process,global){
+/**
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
+ *
+ * @version 0.5.7
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
+ * @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":109}],581:[function(require,module,exports){
+var generate = function generate(num, fn) {
+ var a = [];
+ for (var i = 0; i < num; ++i) {
+ a.push(fn(i));
+ }return a;
+};
+
+var replicate = function replicate(num, val) {
+ return generate(num, function () {
+ return val;
+ });
+};
+
+var concat = function concat(a, b) {
+ return a.concat(b);
+};
+
+var flatten = function flatten(a) {
+ var r = [];
+ for (var j = 0, J = a.length; j < J; ++j) {
+ for (var i = 0, I = a[j].length; i < I; ++i) {
+ r.push(a[j][i]);
+ }
+ }return r;
+};
+
+var chunksOf = function chunksOf(n, a) {
+ var b = [];
+ for (var i = 0, l = a.length; i < l; i += n) {
+ b.push(a.slice(i, i + n));
+ }return b;
+};
+
+module.exports = {
+ generate: generate,
+ replicate: replicate,
+ concat: concat,
+ flatten: flatten,
+ chunksOf: chunksOf
+};
+},{}],582:[function(require,module,exports){
+var A = require("./array.js");
+
+var at = function at(bytes, index) {
+ return parseInt(bytes.slice(index * 2 + 2, index * 2 + 4), 16);
+};
+
+var random = function random(bytes) {
+ var rnd = void 0;
+ if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) rnd = window.crypto.getRandomValues(new Uint8Array(bytes));else if (typeof require !== "undefined") rnd = require("c" + "rypto").randomBytes(bytes);else throw "Safe random numbers not available.";
+ var hex = "0x";
+ for (var i = 0; i < bytes; ++i) {
+ hex += ("00" + rnd[i].toString(16)).slice(-2);
+ }return hex;
+};
+
+var length = function length(a) {
+ return (a.length - 2) / 2;
+};
+
+var flatten = function flatten(a) {
+ return "0x" + a.reduce(function (r, s) {
+ return r + s.slice(2);
+ }, "");
+};
+
+var slice = function slice(i, j, bs) {
+ return "0x" + bs.slice(i * 2 + 2, j * 2 + 2);
+};
+
+var reverse = function reverse(hex) {
+ var rev = "0x";
+ for (var i = 0, l = length(hex); i < l; ++i) {
+ rev += hex.slice((l - i) * 2, (l - i + 1) * 2);
+ }
+ return rev;
+};
+
+var pad = function pad(l, hex) {
+ return hex.length === l * 2 + 2 ? hex : pad(l, "0x" + "0" + hex.slice(2));
+};
+
+var padRight = function padRight(l, hex) {
+ return hex.length === l * 2 + 2 ? hex : padRight(l, hex + "0");
+};
+
+var toArray = function toArray(hex) {
+ var arr = [];
+ for (var i = 2, l = hex.length; i < l; i += 2) {
+ arr.push(parseInt(hex.slice(i, i + 2), 16));
+ }return arr;
+};
+
+var fromArray = function fromArray(arr) {
+ var hex = "0x";
+ for (var i = 0, l = arr.length; i < l; ++i) {
+ var b = arr[i];
+ hex += (b < 16 ? "0" : "") + b.toString(16);
+ }
+ return hex;
+};
+
+var toUint8Array = function toUint8Array(hex) {
+ return new Uint8Array(toArray(hex));
+};
+
+var fromUint8Array = function fromUint8Array(arr) {
+ return fromArray([].slice.call(arr, 0));
+};
+
+var fromNumber = function fromNumber(num) {
+ var hex = num.toString(16);
+ return hex.length % 2 === 0 ? "0x" + hex : "0x0" + hex;
+};
+
+var toNumber = function toNumber(hex) {
+ return parseInt(hex.slice(2), 16);
+};
+
+var concat = function concat(a, b) {
+ return a.concat(b.slice(2));
+};
+
+var fromNat = function fromNat(bn) {
+ return bn === "0x0" ? "0x" : bn.length % 2 === 0 ? bn : "0x0" + bn.slice(2);
+};
+
+var toNat = function toNat(bn) {
+ return bn[2] === "0" ? "0x" + bn.slice(3) : bn;
+};
+
+var fromAscii = function fromAscii(ascii) {
+ var hex = "0x";
+ for (var i = 0; i < ascii.length; ++i) {
+ hex += ("00" + ascii.charCodeAt(i).toString(16)).slice(-2);
+ }return hex;
+};
+
+var toAscii = function toAscii(hex) {
+ var ascii = "";
+ for (var i = 2; i < hex.length; i += 2) {
+ ascii += String.fromCharCode(parseInt(hex.slice(i, i + 2), 16));
+ }return ascii;
+};
+
+// From https://gist.github.com/pascaldekloe/62546103a1576803dade9269ccf76330
+var fromString = function fromString(s) {
+ var makeByte = function makeByte(uint8) {
+ var b = uint8.toString(16);
+ return b.length < 2 ? "0" + b : b;
+ };
+ var bytes = "0x";
+ for (var ci = 0; ci != s.length; ci++) {
+ var c = s.charCodeAt(ci);
+ if (c < 128) {
+ bytes += makeByte(c);
+ continue;
+ }
+ if (c < 2048) {
+ bytes += makeByte(c >> 6 | 192);
+ } else {
+ if (c > 0xd7ff && c < 0xdc00) {
+ if (++ci == s.length) return null;
+ var c2 = s.charCodeAt(ci);
+ if (c2 < 0xdc00 || c2 > 0xdfff) return null;
+ c = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);
+ bytes += makeByte(c >> 18 | 240);
+ bytes += makeByte(c >> 12 & 63 | 128);
+ } else {
+ // c <= 0xffff
+ bytes += makeByte(c >> 12 | 224);
+ }
+ bytes += makeByte(c >> 6 & 63 | 128);
+ }
+ bytes += makeByte(c & 63 | 128);
+ }
+ return bytes;
+};
+
+var toString = function toString(bytes) {
+ var s = '';
+ var i = 0;
+ var l = length(bytes);
+ while (i < l) {
+ var c = at(bytes, i++);
+ if (c > 127) {
+ if (c > 191 && c < 224) {
+ if (i >= l) return null;
+ c = (c & 31) << 6 | at(bytes, i) & 63;
+ } else if (c > 223 && c < 240) {
+ if (i + 1 >= l) return null;
+ c = (c & 15) << 12 | (at(bytes, i) & 63) << 6 | at(bytes, ++i) & 63;
+ } else if (c > 239 && c < 248) {
+ if (i + 2 >= l) return null;
+ c = (c & 7) << 18 | (at(bytes, i) & 63) << 12 | (at(bytes, ++i) & 63) << 6 | at(bytes, ++i) & 63;
+ } else return null;
+ ++i;
+ }
+ if (c <= 0xffff) s += String.fromCharCode(c);else if (c <= 0x10ffff) {
+ c -= 0x10000;
+ s += String.fromCharCode(c >> 10 | 0xd800);
+ s += String.fromCharCode(c & 0x3FF | 0xdc00);
+ } else return null;
+ }
+ return s;
+};
+
+module.exports = {
+ random: random,
+ length: length,
+ concat: concat,
+ flatten: flatten,
+ slice: slice,
+ reverse: reverse,
+ pad: pad,
+ padRight: padRight,
+ fromAscii: fromAscii,
+ toAscii: toAscii,
+ fromString: fromString,
+ toString: toString,
+ fromNumber: fromNumber,
+ toNumber: toNumber,
+ fromNat: fromNat,
+ toNat: toNat,
+ fromArray: fromArray,
+ toArray: toArray,
+ fromUint8Array: fromUint8Array,
+ toUint8Array: toUint8Array
+};
+},{"./array.js":581}],583:[function(require,module,exports){
+// This was ported from https://github.com/emn178/js-sha3, with some minor
+// modifications and pruning. It is licensed under MIT:
+//
+// Copyright 2015-2016 Chen, Yi-Cyuan
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var HEX_CHARS = '0123456789abcdef'.split('');
+var KECCAK_PADDING = [1, 256, 65536, 16777216];
+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 Keccak = function Keccak(bits) {
+ return {
+ blocks: [],
+ reset: true,
+ block: 0,
+ start: 0,
+ blockCount: 1600 - (bits << 1) >> 5,
+ outputBlocks: bits >> 5,
+ s: function (s) {
+ return [].concat(s, s, s, s, s);
+ }([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
+ };
+};
+
+var update = function update(state, message) {
+ var length = message.length,
+ blocks = state.blocks,
+ byteCount = state.blockCount << 2,
+ blockCount = state.blockCount,
+ outputBlocks = state.outputBlocks,
+ s = state.s,
+ index = 0,
+ i,
+ code;
+
+ // update
+ while (index < length) {
+ if (state.reset) {
+ state.reset = false;
+ blocks[0] = state.block;
+ for (i = 1; i < blockCount + 1; ++i) {
+ blocks[i] = 0;
+ }
+ }
+ if (typeof message !== "string") {
+ for (i = state.start; index < length && i < byteCount; ++index) {
+ blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
+ }
+ } else {
+ for (i = state.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];
+ }
+ }
+ }
+ state.lastByteIndex = i;
+ if (i >= byteCount) {
+ state.start = i - byteCount;
+ state.block = blocks[blockCount];
+ for (i = 0; i < blockCount; ++i) {
+ s[i] ^= blocks[i];
+ }
+ f(s);
+ state.reset = true;
+ } else {
+ state.start = i;
+ }
+ }
+
+ // finalize
+ i = state.lastByteIndex;
+ blocks[i >> 2] |= KECCAK_PADDING[i & 3];
+ if (state.lastByteIndex === 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);
+
+ // toString
+ var hex = '',
+ i = 0,
+ j = 0,
+ 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;
+ }
+ }
+ return "0x" + hex;
+};
+
+var f = function f(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];
+ }
+};
+
+var keccak = function keccak(bits) {
+ return function (str) {
+ var msg;
+ if (str.slice(0, 2) === "0x") {
+ msg = [];
+ for (var i = 2, l = str.length; i < l; i += 2) {
+ msg.push(parseInt(str.slice(i, i + 2), 16));
+ }
+ } else {
+ msg = str;
+ }
+ return update(Keccak(bits, bits), msg);
+ };
+};
+
+module.exports = {
+ keccak256: keccak(256),
+ keccak512: keccak(512),
+ keccak256s: keccak(256),
+ keccak512s: keccak(512)
+};
+},{}],584:[function(require,module,exports){
+module.exports={
+ "genesisGasLimit": {
+ "v": 5000,
+ "d": "Gas limit of the Genesis block."
+ },
+ "genesisDifficulty": {
+ "v": 17179869184,
+ "d": "Difficulty of the Genesis block."
+ },
+ "genesisNonce": {
+ "v": "0x0000000000000042",
+ "d": "the geneis nonce"
+ },
+ "genesisExtraData": {
+ "v": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
+ "d": "extra data "
+ },
+ "genesisHash": {
+ "v": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
+ "d": "genesis hash"
+ },
+ "genesisStateRoot": {
+ "v": "0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",
+ "d": "the genesis state root"
+ },
+ "minGasLimit": {
+ "v": 5000,
+ "d": "Minimum the gas limit may ever be."
+ },
+ "gasLimitBoundDivisor": {
+ "v": 1024,
+ "d": "The bound divisor of the gas limit, used in update calculations."
+ },
+ "minimumDifficulty": {
+ "v": 131072,
+ "d": "The minimum that the difficulty may ever be."
+ },
+ "difficultyBoundDivisor": {
+ "v": 2048,
+ "d": "The bound divisor of the difficulty, used in the update calculations."
+ },
+ "durationLimit": {
+ "v": 13,
+ "d": "The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."
+ },
+ "maximumExtraDataSize": {
+ "v": 32,
+ "d": "Maximum size extra data may be after Genesis."
+ },
+ "epochDuration": {
+ "v": 30000,
+ "d": "Duration between proof-of-work epochs."
+ },
+ "stackLimit": {
+ "v": 1024,
+ "d": "Maximum size of VM stack allowed."
+ },
+ "callCreateDepth": {
+ "v": 1024,
+ "d": "Maximum depth of call/create stack."
+ },
+
+ "tierStepGas": {
+ "v": [0, 2, 3, 5, 8, 10, 20],
+ "d": "Once per operation, for a selection of them."
+ },
+ "expGas": {
+ "v": 10,
+ "d": "Once per EXP instuction."
+ },
+ "expByteGas": {
+ "v": 50,
+ "d": "Times ceil(log256(exponent)) for the EXP instruction."
+ },
+
+ "sha3Gas": {
+ "v": 30,
+ "d": "Once per SHA3 operation."
+ },
+ "sha3WordGas": {
+ "v": 6,
+ "d": "Once per word of the SHA3 operation's data."
+ },
+ "sloadGas": {
+ "v": 50,
+ "d": "Once per SLOAD operation."
+ },
+ "sstoreSetGas": {
+ "v": 20000,
+ "d": "Once per SSTORE operation if the zeroness changes from zero."
+ },
+ "sstoreResetGas": {
+ "v": 5000,
+ "d": "Once per SSTORE operation if the zeroness does not change from zero."
+ },
+ "sstoreRefundGas": {
+ "v": 15000,
+ "d": "Once per SSTORE operation if the zeroness changes to zero."
+ },
+ "jumpdestGas": {
+ "v": 1,
+ "d": "Refunded gas, once per SSTORE operation if the zeroness changes to zero."
+ },
+
+ "logGas": {
+ "v": 375,
+ "d": "Per LOG* operation."
+ },
+ "logDataGas": {
+ "v": 8,
+ "d": "Per byte in a LOG* operation's data."
+ },
+ "logTopicGas": {
+ "v": 375,
+ "d": "Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."
+ },
+
+ "createGas": {
+ "v": 32000,
+ "d": "Once per CREATE operation & contract-creation transaction."
+ },
+
+ "callGas": {
+ "v": 40,
+ "d": "Once per CALL operation & message call transaction."
+ },
+ "callStipend": {
+ "v": 2300,
+ "d": "Free gas given at beginning of call."
+ },
+ "callValueTransferGas": {
+ "v": 9000,
+ "d": "Paid for CALL when the value transfor is non-zero."
+ },
+ "callNewAccountGas": {
+ "v": 25000,
+ "d": "Paid for CALL when the destination address didn't exist prior."
+ },
+
+ "suicideRefundGas": {
+ "v": 24000,
+ "d": "Refunded following a suicide operation."
+ },
+
+ "memoryGas": {
+ "v": 3,
+ "d": "Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."
+ },
+ "quadCoeffDiv": {
+ "v": 512,
+ "d": "Divisor for the quadratic particle of the memory cost equation."
+ },
+
+ "createDataGas": {
+ "v": 200,
+ "d": ""
+ },
+ "txGas": {
+ "v": 21000,
+ "d": "Per transaction. NOTE: Not payable on data of calls between transactions."
+ },
+ "txCreation": {
+ "v": 32000,
+ "d": "the cost of creating a contract via tx"
+ },
+ "txDataZeroGas": {
+ "v": 4,
+ "d": "Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."
+ },
+ "txDataNonZeroGas": {
+ "v": 68,
+ "d": "Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."
+ },
+
+ "copyGas": {
+ "v": 3,
+ "d": "Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."
+ },
+
+ "ecrecoverGas": {
+ "v": 3000,
+ "d": ""
+ },
+ "sha256Gas": {
+ "v": 60,
+ "d": ""
+ },
+ "sha256WordGas": {
+ "v": 12,
+ "d": ""
+ },
+ "ripemd160Gas": {
+ "v": 600,
+ "d": ""
+ },
+ "ripemd160WordGas": {
+ "v": 120,
+ "d": ""
+ },
+ "identityGas": {
+ "v": 15,
+ "d": ""
+ },
+ "identityWordGas": {
+ "v": 3,
+ "d": ""
+ },
+ "modexpGquaddivisor": {
+ "v": 20,
+ "d": "Gquaddivisor from modexp precompile for gas calculation."
+ },
+ "ecAddGas": {
+ "v": 500,
+ "d": "Gas costs for curve addition precompile."
+ },
+ "ecMulGas": {
+ "v": 40000,
+ "d": "Gas costs for curve multiplication precompile."
+ },
+ "ecPairingGas": {
+ "v": 100000,
+ "d": "Base gas costs for curve pairing precompile."
+ },
+ "ecPairingWordGas": {
+ "v": 80000,
+ "d": "Gas costs regarding curve pairing precompile input length."
+ },
+ "minerReward": {
+ "v": "3000000000000000000",
+ "d": "the amount a miner get rewarded for mining a block"
+ },
+ "homeSteadForkNumber": {
+ "v": 1150000,
+ "d": "the block that the Homestead fork started at"
+ },
+ "homesteadRepriceForkNumber": {
+ "v": 2463000,
+ "d": "the block that the Homestead Reprice (EIP150) fork started at"
+ },
+ "timebombPeriod": {
+ "v": 100000,
+ "d": "Exponential difficulty timebomb period"
+ },
+ "freeBlockPeriod": {
+ "v": 2
+ }
+}
+
+},{}],585:[function(require,module,exports){
+const ethUtil = require('ethereumjs-util')
+const rlp = require('rlp')
+const Buffer = require('safe-buffer').Buffer
+
+var Account = module.exports = function (data) {
+ // Define Properties
+ var fields = [{
+ name: 'nonce',
+ default: Buffer.alloc(0)
+ }, {
+ name: 'balance',
+ default: Buffer.alloc(0)
+ }, {
+ name: 'stateRoot',
+ length: 32,
+ default: ethUtil.SHA3_RLP
+ }, {
+ name: 'codeHash',
+ length: 32,
+ default: ethUtil.SHA3_NULL
+ }]
+
+ ethUtil.defineProperties(this, fields, data)
+}
+
+Account.prototype.serialize = function () {
+ return rlp.encode(this.raw)
+}
+
+Account.prototype.isContract = function () {
+ return this.codeHash.toString('hex') !== ethUtil.SHA3_NULL_S
+}
+
+Account.prototype.getCode = function (state, cb) {
+ if (!this.isContract()) {
+ cb(null, Buffer.alloc(0))
+ return
+ }
+
+ state.getRaw(this.codeHash, cb)
+}
+
+Account.prototype.setCode = function (trie, code, cb) {
+ var self = this
+
+ this.codeHash = ethUtil.sha3(code)
+
+ if (this.codeHash.toString('hex') === ethUtil.SHA3_NULL_S) {
+ cb(null, Buffer.alloc(0))
+ return
+ }
+
+ trie.putRaw(this.codeHash, code, function (err) {
+ cb(err, self.codeHash)
+ })
+}
+
+Account.prototype.getStorage = function (trie, key, cb) {
+ var t = trie.copy()
+ t.root = this.stateRoot
+ t.get(key, cb)
+}
+
+Account.prototype.setStorage = function (trie, key, val, cb) {
+ var self = this
+ var t = trie.copy()
+ t.root = self.stateRoot
+ t.put(key, val, function (err) {
+ if (err) return cb()
+ self.stateRoot = t.root
+ cb()
+ })
+}
+
+Account.prototype.isEmpty = function () {
+ return this.balance.toString('hex') === '' &&
+ this.nonce.toString('hex') === '' &&
+ this.stateRoot.toString('hex') === ethUtil.SHA3_RLP_S &&
+ this.codeHash.toString('hex') === ethUtil.SHA3_NULL_S
+}
+
+},{"ethereumjs-util":612,"rlp":1331,"safe-buffer":1334}],586:[function(require,module,exports){
+(function (Buffer){
+const utils = require('ethereumjs-util')
+const params = require('ethereum-common/params.json')
+const BN = utils.BN
+ /**
+ * An object that repersents the block header
+ * @constructor
+ * @param {Array} data raw data, deserialized
+ * @prop {Buffer} parentHash the blocks' parent's hash
+ * @prop {Buffer} uncleHash sha3(rlp_encode(uncle_list))
+ * @prop {Buffer} coinbase the miner address
+ * @prop {Buffer} stateRoot The root of a Merkle Patricia tree
+ * @prop {Buffer} transactionTrie the root of a Trie containing the transactions
+ * @prop {Buffer} receiptTrie the root of a Trie containing the transaction Reciept
+ * @prop {Buffer} bloom
+ * @prop {Buffer} difficulty
+ * @prop {Buffer} number the block's height
+ * @prop {Buffer} gasLimit
+ * @prop {Buffer} gasUsed
+ * @prop {Buffer} timestamp
+ * @prop {Buffer} extraData
+ * @prop {Array.} raw an array of buffers containing the raw blocks.
+ */
+var BlockHeader = module.exports = function (data) {
+ var fields = [{
+ name: 'parentHash',
+ length: 32,
+ default: utils.zeros(32)
+ }, {
+ name: 'uncleHash',
+ default: utils.SHA3_RLP_ARRAY
+ }, {
+ name: 'coinbase',
+ length: 20,
+ default: utils.zeros(20)
+ }, {
+ name: 'stateRoot',
+ length: 32,
+ default: utils.zeros(32)
+ }, {
+ name: 'transactionsTrie',
+ length: 32,
+ default: utils.SHA3_RLP
+ }, {
+ name: 'receiptTrie',
+ length: 32,
+ default: utils.SHA3_RLP
+ }, {
+ name: 'bloom',
+ default: utils.zeros(256)
+ }, {
+ name: 'difficulty',
+ default: new Buffer([])
+ }, {
+ name: 'number',
+ default: utils.intToBuffer(params.homeSteadForkNumber.v)
+ }, {
+ name: 'gasLimit',
+ default: new Buffer('ffffffffffffff', 'hex')
+ }, {
+ name: 'gasUsed',
+ empty: true,
+ default: new Buffer([])
+ }, {
+ name: 'timestamp',
+ default: new Buffer([])
+ }, {
+ name: 'extraData',
+ allowZero: true,
+ empty: true,
+ default: new Buffer([])
+ }, {
+ name: 'mixHash',
+ default: utils.zeros(32)
+ // length: 32
+ }, {
+ name: 'nonce',
+ default: new Buffer([]) // sha3(42)
+ }]
+ utils.defineProperties(this, fields, data)
+}
+
+/**
+ * Returns the canoncical difficulty of the block
+ * @method canonicalDifficulty
+ * @param {Block} parentBlock the parent `Block` of the this header
+ * @return {BN}
+ */
+BlockHeader.prototype.canonicalDifficulty = function (parentBlock) {
+ const blockTs = new BN(this.timestamp)
+ const parentTs = new BN(parentBlock.header.timestamp)
+ const parentDif = new BN(parentBlock.header.difficulty)
+ const minimumDifficulty = new BN(params.minimumDifficulty.v)
+ var offset = parentDif.div(new BN(params.difficultyBoundDivisor.v))
+ var dif
+
+ // Byzantium
+ // max((2 if len(parent.uncles) else 1) - ((timestamp - parent.timestamp) // 9), -99)
+ var uncleAddend = parentBlock.header.uncleHash.equals(utils.SHA3_RLP_ARRAY) ? 1 : 2
+ var a = blockTs.sub(parentTs).idivn(9).ineg().iaddn(uncleAddend)
+ var cutoff = new BN(-99)
+ // MAX(cutoff, a)
+ if (cutoff.cmp(a) === 1) {
+ a = cutoff
+ }
+ dif = parentDif.add(offset.mul(a))
+
+ // Byzantium difficulty bomb delay
+ var num = new BN(this.number).isubn(3000000)
+ if (num.ltn(0)) {
+ num = new BN(0)
+ }
+
+ var exp = num.idivn(100000).isubn(2)
+ if (!exp.isNeg()) {
+ dif.iadd(new BN(2).pow(exp))
+ }
+
+ if (dif.cmp(minimumDifficulty) === -1) {
+ dif = minimumDifficulty
+ }
+
+ return dif
+}
+
+/**
+ * checks that the block's `difficuly` matches the canonical difficulty
+ * @method validateDifficulty
+ * @param {Block} parentBlock this block's parent
+ * @return {Boolean}
+ */
+BlockHeader.prototype.validateDifficulty = function (parentBlock) {
+ const dif = this.canonicalDifficulty(parentBlock)
+ return dif.cmp(new BN(this.difficulty)) === 0
+}
+
+/**
+ * Validates the gasLimit
+ * @method validateGasLimit
+ * @param {Block} parentBlock this block's parent
+ * @returns {Boolean}
+ */
+BlockHeader.prototype.validateGasLimit = function (parentBlock) {
+ const pGasLimit = new BN(parentBlock.header.gasLimit)
+ const gasLimit = new BN(this.gasLimit)
+ const a = pGasLimit.div(new BN(params.gasLimitBoundDivisor.v))
+ const maxGasLimit = pGasLimit.add(a)
+ const minGasLimit = pGasLimit.sub(a)
+
+ return gasLimit.lt(maxGasLimit) && gasLimit.gt(minGasLimit) && gasLimit.gte(params.minGasLimit.v)
+}
+
+/**
+ * Validates the entire block header
+ * @method validate
+ * @param {Blockchain} blockChain the blockchain that this block is validating against
+ * @param {Bignum} [height] if this is an uncle header, this is the height of the block that is including it
+ * @param {Function} cb the callback function. The callback is given an `error` if the block is invalid
+ */
+BlockHeader.prototype.validate = function (blockchain, height, cb) {
+ var self = this
+ if (arguments.length === 2) {
+ cb = height
+ height = false
+ }
+
+ if (this.isGenesis()) {
+ return cb()
+ }
+
+ // find the blocks parent
+ blockchain.getBlock(self.parentHash, function (err, parentBlock) {
+ if (err) {
+ return cb('could not find parent block')
+ }
+
+ self.parentBlock = parentBlock
+
+ var number = new BN(self.number)
+ if (number.cmp(new BN(parentBlock.header.number).iaddn(1)) !== 0) {
+ return cb('invalid number')
+ }
+
+ if (height) {
+ var dif = height.sub(new BN(parentBlock.header.number))
+ if (!(dif.cmpn(8) === -1 && dif.cmpn(1) === 1)) {
+ return cb('uncle block has a parent that is too old or to young')
+ }
+ }
+
+ if (!self.validateDifficulty(parentBlock)) {
+ return cb('invalid Difficulty')
+ }
+
+ if (!self.validateGasLimit(parentBlock)) {
+ return cb('invalid gas limit')
+ }
+
+ if (utils.bufferToInt(parentBlock.header.number) + 1 !== utils.bufferToInt(self.number)) {
+ return cb('invalid heigth')
+ }
+
+ if (utils.bufferToInt(self.timestamp) <= utils.bufferToInt(parentBlock.header.timestamp)) {
+ return cb('invalid timestamp')
+ }
+
+ if (self.extraData.length > params.maximumExtraDataSize.v) {
+ return cb('invalid amount of extra data')
+ }
+
+ cb()
+ })
+}
+
+/**
+ * Returns the sha3 hash of the blockheader
+ * @method hash
+ * @return {Buffer}
+ */
+BlockHeader.prototype.hash = function () {
+ return utils.rlphash(this.raw)
+}
+
+/**
+ * checks if the blockheader is a genesis header
+ * @method isGenesis
+ * @return {Boolean}
+ */
+BlockHeader.prototype.isGenesis = function () {
+ return this.number.toString('hex') === ''
+}
+
+
+}).call(this,require("buffer").Buffer)
+},{"buffer":113,"ethereum-common/params.json":584,"ethereumjs-util":612}],587:[function(require,module,exports){
+(function (Buffer){
+const ethUtil = require('ethereumjs-util')
+const Tx = require('ethereumjs-tx')
+const Trie = require('merkle-patricia-tree')
+const BN = ethUtil.BN
+const rlp = ethUtil.rlp
+const async = require('async')
+const BlockHeader = require('./header')
+const params = require('ethereum-common/params.json')
+
+/**
+ * Creates a new block object
+ * @constructor the raw serialized or the deserialized block.
+ * @param {Array|Buffer|Object} data
+ * @prop {Header} header the block's header
+ * @prop {Array.} uncleList an array of uncle headers
+ * @prop {Array.} raw an array of buffers containing the raw blocks.
+ */
+var Block = module.exports = function (data) {
+ this.transactions = []
+ this.uncleHeaders = []
+ this._inBlockChain = false
+ this.txTrie = new Trie()
+
+ Object.defineProperty(this, 'raw', {
+ get: function () {
+ return this.serialize(false)
+ }
+ })
+
+ var rawTransactions, rawUncleHeaders
+
+ // defaults
+ if (!data) {
+ data = [[], [], []]
+ }
+
+ if (Buffer.isBuffer(data)) {
+ data = rlp.decode(data)
+ }
+
+ if (Array.isArray(data)) {
+ this.header = new BlockHeader(data[0])
+ rawTransactions = data[1]
+ rawUncleHeaders = data[2]
+ } else {
+ this.header = new BlockHeader(data.header)
+ rawTransactions = data.transactions || []
+ rawUncleHeaders = data.uncleHeaders || []
+ }
+
+ // parse uncle headers
+ for (var i = 0; i < rawUncleHeaders.length; i++) {
+ this.uncleHeaders.push(new BlockHeader(rawUncleHeaders[i]))
+ }
+
+ // parse transactions
+ for (i = 0; i < rawTransactions.length; i++) {
+ var tx = new Tx(rawTransactions[i])
+ tx._homestead = true
+ this.transactions.push(tx)
+ }
+}
+
+Block.Header = BlockHeader
+
+/**
+ * Produces a hash the RLP of the block
+ * @method hash
+ */
+Block.prototype.hash = function () {
+ return this.header.hash()
+}
+
+/**
+ * Determines if a given block is the genesis block
+ * @method isGenisis
+ * @return Boolean
+ */
+Block.prototype.isGenesis = function () {
+ return this.header.isGenesis()
+}
+
+/**
+ * turns the block in to the canonical genesis block
+ * @method setGenesisParams
+ */
+Block.prototype.setGenesisParams = function () {
+ this.header.gasLimit = params.genesisGasLimit.v
+ this.header.difficulty = params.genesisDifficulty.v
+ this.header.extraData = params.genesisExtraData.v
+ this.header.nonce = params.genesisNonce.v
+ this.header.stateRoot = params.genesisStateRoot.v
+ this.header.number = new Buffer([])
+}
+
+/**
+ * Produces a serialization of the block.
+ * @method serialize
+ * @param {Boolean} rlpEncode whether to rlp encode the block or not
+ */
+Block.prototype.serialize = function (rlpEncode) {
+ var raw = [this.header.raw, [],
+ []
+ ]
+
+ // rlpEnode defaults to true
+ if (typeof rlpEncode === 'undefined') {
+ rlpEncode = true
+ }
+
+ this.transactions.forEach(function (tx) {
+ raw[1].push(tx.raw)
+ })
+
+ this.uncleHeaders.forEach(function (uncle) {
+ raw[2].push(uncle.raw)
+ })
+
+ return rlpEncode ? rlp.encode(raw) : raw
+}
+
+/**
+ * Generate transaction trie. The tx trie must be generated before the transaction trie can
+ * be validated with `validateTransactionTrie`
+ * @method genTxTrie
+ * @param {Function} cb the callback
+ */
+Block.prototype.genTxTrie = function (cb) {
+ var i = 0
+ var self = this
+
+ async.eachSeries(this.transactions, function (tx, done) {
+ self.txTrie.put(rlp.encode(i), tx.serialize(), done)
+ i++
+ }, cb)
+}
+
+/**
+ * Validates the transaction trie
+ * @method validateTransactionTrie
+ * @return {Boolean}
+ */
+Block.prototype.validateTransactionsTrie = function () {
+ var txT = this.header.transactionsTrie.toString('hex')
+ if (this.transactions.length) {
+ return txT === this.txTrie.root.toString('hex')
+ } else {
+ return txT === ethUtil.SHA3_RLP.toString('hex')
+ }
+}
+
+/**
+ * Validates the transactions
+ * @method validateTransactions
+ * @param {Boolean} [stringError=false] whether to return a string with a dscription of why the validation failed or return a Bloolean
+ * @return {Boolean}
+ */
+Block.prototype.validateTransactions = function (stringError) {
+ var errors = []
+
+ this.transactions.forEach(function (tx, i) {
+ var error = tx.validate(true)
+ if (error) {
+ errors.push(error + ' at tx ' + i)
+ }
+ })
+
+ if (stringError === undefined || stringError === false) {
+ return errors.length === 0
+ } else {
+ return arrayToString(errors)
+ }
+}
+
+/**
+ * Validates the entire block. Returns a string to the callback if block is invalid
+ * @method validate
+ * @param {BlockChain} blockChain the blockchain that this block wants to be part of
+ * @param {Function} cb the callback which is given a `String` if the block is not valid
+ */
+Block.prototype.validate = function (blockChain, cb) {
+ var self = this
+ var errors = []
+
+ async.parallel([
+ // validate uncles
+ self.validateUncles.bind(self, blockChain),
+ // validate block
+ self.header.validate.bind(self.header, blockChain),
+ // generate the transaction trie
+ self.genTxTrie.bind(self)
+ ], function (err) {
+ if (err) {
+ errors.push(err)
+ }
+
+ if (!self.validateTransactionsTrie()) {
+ errors.push('invalid transaction true')
+ }
+
+ var txErrors = self.validateTransactions(true)
+ if (txErrors !== '') {
+ errors.push(txErrors)
+ }
+
+ if (!self.validateUnclesHash()) {
+ errors.push('invild uncle hash')
+ }
+
+ cb(arrayToString(errors))
+ })
+}
+
+/**
+ * Validates the uncle's hash
+ * @method validateUncleHash
+ * @return {Boolean}
+ */
+Block.prototype.validateUnclesHash = function () {
+ var raw = []
+ this.uncleHeaders.forEach(function (uncle) {
+ raw.push(uncle.raw)
+ })
+
+ raw = rlp.encode(raw)
+ return ethUtil.sha3(raw).toString('hex') === this.header.uncleHash.toString('hex')
+}
+
+/**
+ * Validates the uncles that are in the block if any. Returns a string to the callback if uncles are invalid
+ * @method validateUncles
+ * @param {Blockchain} blockChaina an instance of the Blockchain
+ * @param {Function} cb the callback
+ */
+Block.prototype.validateUncles = function (blockChain, cb) {
+ if (this.isGenesis()) {
+ return cb()
+ }
+
+ var self = this
+
+ if (self.uncleHeaders.length > 2) {
+ return cb('too many uncle headers')
+ }
+
+ var uncleHashes = self.uncleHeaders.map(function (header) {
+ return header.hash().toString('hex')
+ })
+
+ if (!((new Set(uncleHashes)).size === uncleHashes.length)) {
+ return cb('dublicate unlces')
+ }
+
+ async.each(self.uncleHeaders, function (uncle, cb2) {
+ var height = new BN(self.header.number)
+ async.parallel([
+ uncle.validate.bind(uncle, blockChain, height),
+ // check to make sure the uncle is not already in the blockchain
+ function (cb3) {
+ blockChain.getDetails(uncle.hash(), function (err, blockInfo) {
+ // TODO: remove uncles from BC
+ if (blockInfo && blockInfo.isUncle) {
+ cb3(err || 'uncle already included')
+ } else {
+ cb3()
+ }
+ })
+ }
+ ], cb2)
+ }, cb)
+}
+
+/**
+ * Converts the block toJSON
+ * @method toJSON
+ * @param {Bool} labeled whether to create an labeled object or an array
+ * @return {Object}
+ */
+Block.prototype.toJSON = function (labeled) {
+ if (labeled) {
+ var obj = {
+ header: this.header.toJSON(true),
+ transactions: [],
+ uncleHeaders: []
+ }
+
+ this.transactions.forEach(function (tx) {
+ obj.transactions.push(tx.toJSON(labeled))
+ })
+
+ this.uncleHeaders.forEach(function (uh) {
+ obj.uncleHeaders.push(uh.toJSON())
+ })
+ return obj
+ } else {
+ return ethUtil.baToJSON(this.raw)
+ }
+}
+
+function arrayToString (array) {
+ try {
+ return array.reduce(function (str, err) {
+ if (str) {
+ str += ' '
+ }
+ return str + err
+ })
+ } catch (e) {
+ return ''
+ }
+}
+
+}).call(this,require("buffer").Buffer)
+},{"./header":586,"async":42,"buffer":113,"ethereum-common/params.json":584,"ethereumjs-tx":610,"ethereumjs-util":612,"merkle-patricia-tree":947}],588:[function(require,module,exports){
+module.exports={
+ "name": "goerli",
+ "chainId": 5,
+ "networkId": 5,
+ "comment": "Cross-client PoA test network",
+ "url": "https://github.com/goerli/testnet",
+ "genesis": {
+ "hash": "0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a",
+ "timestamp": "0x5c51a607",
+ "gasLimit": 10485760,
+ "difficulty": 1,
+ "nonce": "0x0000000000000000",
+ "extraData": "0x22466c6578692069732061207468696e6722202d204166726900000000000000e0a2bd4258d2768837baa26a28fe71dc079f84c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "stateRoot": "0x5d6cded585e73c4e322c30c2f782a336316f17dd85a4863b9d838d2d4b8b3008"
+ },
+ "hardforks": [
+ {
+ "name": "chainstart",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "homestead",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "dao",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "tangerineWhistle",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "spuriousDragon",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "byzantium",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "constantinople",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "petersburg",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ }
+ ],
+ "bootstrapNodes": [
+ {
+ "ip": "51.141.78.53",
+ "port": 30303,
+ "id": "011f758e6552d105183b1761c5e2dea0111bc20fd5f6422bc7f91e0fabbec9a6595caf6239b37feb773dddd3f87240d99d859431891e4a642cf2a0a9e6cbb98a",
+ "location": "",
+ "comment": "Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"
+ },
+ {
+ "ip": "13.93.54.137",
+ "port": 30303,
+ "id": "176b9417f511d05b6b2cf3e34b756cf0a7096b3094572a8f6ef4cdcb9d1f9d00683bf0f83347eebdf3b81c3521c2332086d9592802230bf528eaf606a1d9677b",
+ "location": "",
+ "comment": "Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"
+ },
+ {
+ "ip": "94.237.54.114",
+ "port": 30313,
+ "id": "46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291",
+ "location": "",
+ "comment": "Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"
+ },
+ {
+ "ip": "52.64.155.147",
+ "port": 30303,
+ "id": "c1f8b7c2ac4453271fa07d8e9ecf9a2e8285aa0bd0c07df0131f47153306b0736fd3db8924e7a9bf0bed6b1d8d4f87362a71b033dc7c64547728d953e43e59b2",
+ "location": "",
+ "comment": "Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"
+ },
+ {
+ "ip": "213.186.16.82",
+ "port": 30303,
+ "id": "f4a9c6ee28586009fb5a96c8af13a58ed6d8315a9eee4772212c1d4d9cebe5a8b8a78ea4434f318726317d04a3f531a1ef0420cf9752605a562cfe858c46e263",
+ "location": "",
+ "comment": "Source: https://github.com/goerli/testnet/blob/master/bootnodes.txt"
+ }
+ ]
+}
+
+},{}],589:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.chains = {
+ names: {
+ '1': 'mainnet',
+ '3': 'ropsten',
+ '4': 'rinkeby',
+ '42': 'kovan',
+ '6284': 'goerli',
+ },
+ mainnet: require('./mainnet.json'),
+ ropsten: require('./ropsten.json'),
+ rinkeby: require('./rinkeby.json'),
+ kovan: require('./kovan.json'),
+ goerli: require('./goerli.json'),
+};
+
+},{"./goerli.json":588,"./kovan.json":590,"./mainnet.json":591,"./rinkeby.json":592,"./ropsten.json":593}],590:[function(require,module,exports){
+module.exports={
+ "name": "kovan",
+ "chainId": 42,
+ "networkId": 42,
+ "comment": "Parity PoA test network",
+ "url": "https://kovan-testnet.github.io/website/",
+ "genesis": {
+ "hash": "0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9",
+ "timestamp": null,
+ "gasLimit": 6000000,
+ "difficulty": 131072,
+ "nonce": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "extraData": "0x",
+ "stateRoot": "0x2480155b48a1cea17d67dbfdfaafe821c1d19cdd478c5358e8ec56dec24502b2"
+ },
+ "hardforks": [],
+ "bootstrapNodes": [
+ {
+ "ip": "40.71.221.215",
+ "port": 30303,
+ "id": "56abaf065581a5985b8c5f4f88bd202526482761ba10be9bfdcd14846dd01f652ec33fde0f8c0fd1db19b59a4c04465681fcef50e11380ca88d25996191c52de",
+ "location": "",
+ "comment": "Parity Bootnode"
+ },
+ {
+ "ip": "52.166.117.77",
+ "port": 30303,
+ "id": "d07827483dc47b368eaf88454fb04b41b7452cf454e194e2bd4c14f98a3278fed5d819dbecd0d010407fc7688d941ee1e58d4f9c6354d3da3be92f55c17d7ce3",
+ "location": "",
+ "comment": "Parity Bootnode"
+ },
+ {
+ "ip": "52.165.239.18",
+ "port": 30303,
+ "id": "8fa162563a8e5a05eef3e1cd5abc5828c71344f7277bb788a395cce4a0e30baf2b34b92fe0b2dbbba2313ee40236bae2aab3c9811941b9f5a7e8e90aaa27ecba",
+ "location": "",
+ "comment": "Parity Bootnode"
+ },
+ {
+ "ip": "52.243.47.56",
+ "port": 30303,
+ "id": "7e2e7f00784f516939f94e22bdc6cf96153603ca2b5df1c7cc0f90a38e7a2f218ffb1c05b156835e8b49086d11fdd1b3e2965be16baa55204167aa9bf536a4d9",
+ "location": "",
+ "comment": "Parity Bootnode"
+ },
+ {
+ "ip": "40.68.248.100",
+ "port": 30303,
+ "id": "0518a3d35d4a7b3e8c433e7ffd2355d84a1304ceb5ef349787b556197f0c87fad09daed760635b97d52179d645d3e6d16a37d2cc0a9945c2ddf585684beb39ac",
+ "location": "",
+ "comment": "Parity Bootnode"
+ }
+ ]
+}
+
+},{}],591:[function(require,module,exports){
+module.exports={
+ "name": "mainnet",
+ "chainId": 1,
+ "networkId": 1,
+ "comment": "The Ethereum main chain",
+ "url": "https://ethstats.net/",
+ "genesis": {
+ "hash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
+ "timestamp": null,
+ "gasLimit": 5000,
+ "difficulty": 17179869184,
+ "nonce": "0x0000000000000042",
+ "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
+ "stateRoot": "0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"
+ },
+ "hardforks": [
+ {
+ "name": "chainstart",
+ "block": 0,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "homestead",
+ "block": 1150000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "dao",
+ "block": 1920000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "tangerineWhistle",
+ "block": 2463000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "spuriousDragon",
+ "block": 2675000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "byzantium",
+ "block": 4370000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "constantinople",
+ "block": 7280000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "petersburg",
+ "block": 7280000,
+ "consensus": "pow",
+ "finality": null
+ }
+ ],
+ "bootstrapNodes": [
+ {
+ "ip": "13.93.211.84",
+ "port": 30303,
+ "id": "3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99",
+ "location": "US-WEST",
+ "comment": "Go Bootnode"
+ },
+ {
+ "ip": "191.235.84.50",
+ "port": 30303,
+ "id": "78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d",
+ "location": "BR",
+ "comment": "Go Bootnode"
+ },
+ {
+ "ip": "13.75.154.138",
+ "port": 30303,
+ "id": "158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6",
+ "location": "AU",
+ "comment": "Go Bootnode"
+ },
+ {
+ "ip": "52.74.57.123",
+ "port": 30303,
+ "id": "1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082",
+ "location": "SG",
+ "comment": "Go Bootnode"
+ }
+ ]
+}
+
+},{}],592:[function(require,module,exports){
+module.exports={
+ "name": "rinkeby",
+ "chainId": 4,
+ "networkId": 4,
+ "comment": "PoA test network",
+ "url": "https://www.rinkeby.io",
+ "genesis": {
+ "hash": "0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177",
+ "timestamp": "0x58ee40ba",
+ "gasLimit": 4700000,
+ "difficulty": 1,
+ "nonce": "0x0000000000000000",
+ "extraData": "0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "stateRoot": "0x53580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2d"
+ },
+ "hardforks": [
+ {
+ "name": "chainstart",
+ "block": 0,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "homestead",
+ "block": 1,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "dao",
+ "block": null,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "tangerineWhistle",
+ "block": 2,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "spuriousDragon",
+ "block": 3,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "byzantium",
+ "block": 1035301,
+ "consensus": "poa",
+ "finality": null
+ },
+ {
+ "name": "constantinople",
+ "block": null,
+ "consensus": "poa",
+ "finality": null
+ }
+ ],
+ "bootstrapNodes": [
+ {
+ "ip": "52.169.42.101",
+ "port": 30303,
+ "id": "a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf",
+ "location": "IE",
+ "comment": ""
+ },
+ {
+ "ip": "52.3.158.184",
+ "port": 30303,
+ "id": "343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8",
+ "location": "",
+ "comment": "INFURA"
+ }
+ ]
+}
+
+},{}],593:[function(require,module,exports){
+module.exports={
+ "name": "ropsten",
+ "chainId": 3,
+ "networkId": 3,
+ "comment": "PoW test network",
+ "url": "https://github.com/ethereum/ropsten",
+ "genesis": {
+ "hash": "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",
+ "timestamp": null,
+ "gasLimit": 16777216,
+ "difficulty": 1048576,
+ "nonce": "0x0000000000000042",
+ "extraData": "0x3535353535353535353535353535353535353535353535353535353535353535",
+ "stateRoot": "0x217b0bbcfb72e2d57e28f33cb361b9983513177755dc3f33ce3e7022ed62b77b"
+ },
+ "hardforks": [
+ {
+ "name": "chainstart",
+ "block": 0,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "homestead",
+ "block": 0,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "dao",
+ "block": null,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "tangerineWhistle",
+ "block": 0,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "spuriousDragon",
+ "block": 10,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "byzantium",
+ "block": 1700000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "constantinople",
+ "block": 4230000,
+ "consensus": "pow",
+ "finality": null
+ },
+ {
+ "name": "petersburg",
+ "block": 4939394,
+ "consensus": "pow",
+ "finality": null
+ }
+ ],
+ "bootstrapNodes": [
+ {
+ "ip": "52.176.7.10",
+ "port": "30303",
+ "id": "30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606",
+ "network": "Ropsten",
+ "chainId": 3,
+ "location": "US",
+ "comment": "US-Azure geth"
+ },
+ {
+ "ip": "52.176.100.77",
+ "port": "30303",
+ "id": "865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c",
+ "network": "Ropsten",
+ "chainId": 3,
+ "location": "US",
+ "comment": "US-Azure parity"
+ },
+ {
+ "ip": "52.232.243.152",
+ "port": "30303",
+ "id": "6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f",
+ "network": "Ropsten",
+ "chainId": 3,
+ "location": "US",
+ "comment": "Parity"
+ },
+ {
+ "ip": "192.81.208.223",
+ "port": "30303",
+ "id": "94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09",
+ "network": "Ropsten",
+ "chainId": 3,
+ "location": "US",
+ "comment": "@gpip"
+ }
+ ]
+}
+
+},{}],594:[function(require,module,exports){
+module.exports={
+ "0x0000000000000000000000000000000000000000": "0x1",
+ "0x0000000000000000000000000000000000000001": "0x1",
+ "0x0000000000000000000000000000000000000002": "0x1",
+ "0x0000000000000000000000000000000000000003": "0x1",
+ "0x0000000000000000000000000000000000000004": "0x1",
+ "0x0000000000000000000000000000000000000005": "0x1",
+ "0x0000000000000000000000000000000000000006": "0x1",
+ "0x0000000000000000000000000000000000000007": "0x1",
+ "0x0000000000000000000000000000000000000008": "0x1",
+ "0x0000000000000000000000000000000000000009": "0x1",
+ "0x000000000000000000000000000000000000000a": "0x1",
+ "0x000000000000000000000000000000000000000b": "0x1",
+ "0x000000000000000000000000000000000000000c": "0x1",
+ "0x000000000000000000000000000000000000000d": "0x1",
+ "0x000000000000000000000000000000000000000e": "0x1",
+ "0x000000000000000000000000000000000000000f": "0x1",
+ "0x0000000000000000000000000000000000000010": "0x1",
+ "0x0000000000000000000000000000000000000011": "0x1",
+ "0x0000000000000000000000000000000000000012": "0x1",
+ "0x0000000000000000000000000000000000000013": "0x1",
+ "0x0000000000000000000000000000000000000014": "0x1",
+ "0x0000000000000000000000000000000000000015": "0x1",
+ "0x0000000000000000000000000000000000000016": "0x1",
+ "0x0000000000000000000000000000000000000017": "0x1",
+ "0x0000000000000000000000000000000000000018": "0x1",
+ "0x0000000000000000000000000000000000000019": "0x1",
+ "0x000000000000000000000000000000000000001a": "0x1",
+ "0x000000000000000000000000000000000000001b": "0x1",
+ "0x000000000000000000000000000000000000001c": "0x1",
+ "0x000000000000000000000000000000000000001d": "0x1",
+ "0x000000000000000000000000000000000000001e": "0x1",
+ "0x000000000000000000000000000000000000001f": "0x1",
+ "0x0000000000000000000000000000000000000020": "0x1",
+ "0x0000000000000000000000000000000000000021": "0x1",
+ "0x0000000000000000000000000000000000000022": "0x1",
+ "0x0000000000000000000000000000000000000023": "0x1",
+ "0x0000000000000000000000000000000000000024": "0x1",
+ "0x0000000000000000000000000000000000000025": "0x1",
+ "0x0000000000000000000000000000000000000026": "0x1",
+ "0x0000000000000000000000000000000000000027": "0x1",
+ "0x0000000000000000000000000000000000000028": "0x1",
+ "0x0000000000000000000000000000000000000029": "0x1",
+ "0x000000000000000000000000000000000000002a": "0x1",
+ "0x000000000000000000000000000000000000002b": "0x1",
+ "0x000000000000000000000000000000000000002c": "0x1",
+ "0x000000000000000000000000000000000000002d": "0x1",
+ "0x000000000000000000000000000000000000002e": "0x1",
+ "0x000000000000000000000000000000000000002f": "0x1",
+ "0x0000000000000000000000000000000000000030": "0x1",
+ "0x0000000000000000000000000000000000000031": "0x1",
+ "0x0000000000000000000000000000000000000032": "0x1",
+ "0x0000000000000000000000000000000000000033": "0x1",
+ "0x0000000000000000000000000000000000000034": "0x1",
+ "0x0000000000000000000000000000000000000035": "0x1",
+ "0x0000000000000000000000000000000000000036": "0x1",
+ "0x0000000000000000000000000000000000000037": "0x1",
+ "0x0000000000000000000000000000000000000038": "0x1",
+ "0x0000000000000000000000000000000000000039": "0x1",
+ "0x000000000000000000000000000000000000003a": "0x1",
+ "0x000000000000000000000000000000000000003b": "0x1",
+ "0x000000000000000000000000000000000000003c": "0x1",
+ "0x000000000000000000000000000000000000003d": "0x1",
+ "0x000000000000000000000000000000000000003e": "0x1",
+ "0x000000000000000000000000000000000000003f": "0x1",
+ "0x0000000000000000000000000000000000000040": "0x1",
+ "0x0000000000000000000000000000000000000041": "0x1",
+ "0x0000000000000000000000000000000000000042": "0x1",
+ "0x0000000000000000000000000000000000000043": "0x1",
+ "0x0000000000000000000000000000000000000044": "0x1",
+ "0x0000000000000000000000000000000000000045": "0x1",
+ "0x0000000000000000000000000000000000000046": "0x1",
+ "0x0000000000000000000000000000000000000047": "0x1",
+ "0x0000000000000000000000000000000000000048": "0x1",
+ "0x0000000000000000000000000000000000000049": "0x1",
+ "0x000000000000000000000000000000000000004a": "0x1",
+ "0x000000000000000000000000000000000000004b": "0x1",
+ "0x000000000000000000000000000000000000004c": "0x1",
+ "0x000000000000000000000000000000000000004d": "0x1",
+ "0x000000000000000000000000000000000000004e": "0x1",
+ "0x000000000000000000000000000000000000004f": "0x1",
+ "0x0000000000000000000000000000000000000050": "0x1",
+ "0x0000000000000000000000000000000000000051": "0x1",
+ "0x0000000000000000000000000000000000000052": "0x1",
+ "0x0000000000000000000000000000000000000053": "0x1",
+ "0x0000000000000000000000000000000000000054": "0x1",
+ "0x0000000000000000000000000000000000000055": "0x1",
+ "0x0000000000000000000000000000000000000056": "0x1",
+ "0x0000000000000000000000000000000000000057": "0x1",
+ "0x0000000000000000000000000000000000000058": "0x1",
+ "0x0000000000000000000000000000000000000059": "0x1",
+ "0x000000000000000000000000000000000000005a": "0x1",
+ "0x000000000000000000000000000000000000005b": "0x1",
+ "0x000000000000000000000000000000000000005c": "0x1",
+ "0x000000000000000000000000000000000000005d": "0x1",
+ "0x000000000000000000000000000000000000005e": "0x1",
+ "0x000000000000000000000000000000000000005f": "0x1",
+ "0x0000000000000000000000000000000000000060": "0x1",
+ "0x0000000000000000000000000000000000000061": "0x1",
+ "0x0000000000000000000000000000000000000062": "0x1",
+ "0x0000000000000000000000000000000000000063": "0x1",
+ "0x0000000000000000000000000000000000000064": "0x1",
+ "0x0000000000000000000000000000000000000065": "0x1",
+ "0x0000000000000000000000000000000000000066": "0x1",
+ "0x0000000000000000000000000000000000000067": "0x1",
+ "0x0000000000000000000000000000000000000068": "0x1",
+ "0x0000000000000000000000000000000000000069": "0x1",
+ "0x000000000000000000000000000000000000006a": "0x1",
+ "0x000000000000000000000000000000000000006b": "0x1",
+ "0x000000000000000000000000000000000000006c": "0x1",
+ "0x000000000000000000000000000000000000006d": "0x1",
+ "0x000000000000000000000000000000000000006e": "0x1",
+ "0x000000000000000000000000000000000000006f": "0x1",
+ "0x0000000000000000000000000000000000000070": "0x1",
+ "0x0000000000000000000000000000000000000071": "0x1",
+ "0x0000000000000000000000000000000000000072": "0x1",
+ "0x0000000000000000000000000000000000000073": "0x1",
+ "0x0000000000000000000000000000000000000074": "0x1",
+ "0x0000000000000000000000000000000000000075": "0x1",
+ "0x0000000000000000000000000000000000000076": "0x1",
+ "0x0000000000000000000000000000000000000077": "0x1",
+ "0x0000000000000000000000000000000000000078": "0x1",
+ "0x0000000000000000000000000000000000000079": "0x1",
+ "0x000000000000000000000000000000000000007a": "0x1",
+ "0x000000000000000000000000000000000000007b": "0x1",
+ "0x000000000000000000000000000000000000007c": "0x1",
+ "0x000000000000000000000000000000000000007d": "0x1",
+ "0x000000000000000000000000000000000000007e": "0x1",
+ "0x000000000000000000000000000000000000007f": "0x1",
+ "0x0000000000000000000000000000000000000080": "0x1",
+ "0x0000000000000000000000000000000000000081": "0x1",
+ "0x0000000000000000000000000000000000000082": "0x1",
+ "0x0000000000000000000000000000000000000083": "0x1",
+ "0x0000000000000000000000000000000000000084": "0x1",
+ "0x0000000000000000000000000000000000000085": "0x1",
+ "0x0000000000000000000000000000000000000086": "0x1",
+ "0x0000000000000000000000000000000000000087": "0x1",
+ "0x0000000000000000000000000000000000000088": "0x1",
+ "0x0000000000000000000000000000000000000089": "0x1",
+ "0x000000000000000000000000000000000000008a": "0x1",
+ "0x000000000000000000000000000000000000008b": "0x1",
+ "0x000000000000000000000000000000000000008c": "0x1",
+ "0x000000000000000000000000000000000000008d": "0x1",
+ "0x000000000000000000000000000000000000008e": "0x1",
+ "0x000000000000000000000000000000000000008f": "0x1",
+ "0x0000000000000000000000000000000000000090": "0x1",
+ "0x0000000000000000000000000000000000000091": "0x1",
+ "0x0000000000000000000000000000000000000092": "0x1",
+ "0x0000000000000000000000000000000000000093": "0x1",
+ "0x0000000000000000000000000000000000000094": "0x1",
+ "0x0000000000000000000000000000000000000095": "0x1",
+ "0x0000000000000000000000000000000000000096": "0x1",
+ "0x0000000000000000000000000000000000000097": "0x1",
+ "0x0000000000000000000000000000000000000098": "0x1",
+ "0x0000000000000000000000000000000000000099": "0x1",
+ "0x000000000000000000000000000000000000009a": "0x1",
+ "0x000000000000000000000000000000000000009b": "0x1",
+ "0x000000000000000000000000000000000000009c": "0x1",
+ "0x000000000000000000000000000000000000009d": "0x1",
+ "0x000000000000000000000000000000000000009e": "0x1",
+ "0x000000000000000000000000000000000000009f": "0x1",
+ "0x00000000000000000000000000000000000000a0": "0x1",
+ "0x00000000000000000000000000000000000000a1": "0x1",
+ "0x00000000000000000000000000000000000000a2": "0x1",
+ "0x00000000000000000000000000000000000000a3": "0x1",
+ "0x00000000000000000000000000000000000000a4": "0x1",
+ "0x00000000000000000000000000000000000000a5": "0x1",
+ "0x00000000000000000000000000000000000000a6": "0x1",
+ "0x00000000000000000000000000000000000000a7": "0x1",
+ "0x00000000000000000000000000000000000000a8": "0x1",
+ "0x00000000000000000000000000000000000000a9": "0x1",
+ "0x00000000000000000000000000000000000000aa": "0x1",
+ "0x00000000000000000000000000000000000000ab": "0x1",
+ "0x00000000000000000000000000000000000000ac": "0x1",
+ "0x00000000000000000000000000000000000000ad": "0x1",
+ "0x00000000000000000000000000000000000000ae": "0x1",
+ "0x00000000000000000000000000000000000000af": "0x1",
+ "0x00000000000000000000000000000000000000b0": "0x1",
+ "0x00000000000000000000000000000000000000b1": "0x1",
+ "0x00000000000000000000000000000000000000b2": "0x1",
+ "0x00000000000000000000000000000000000000b3": "0x1",
+ "0x00000000000000000000000000000000000000b4": "0x1",
+ "0x00000000000000000000000000000000000000b5": "0x1",
+ "0x00000000000000000000000000000000000000b6": "0x1",
+ "0x00000000000000000000000000000000000000b7": "0x1",
+ "0x00000000000000000000000000000000000000b8": "0x1",
+ "0x00000000000000000000000000000000000000b9": "0x1",
+ "0x00000000000000000000000000000000000000ba": "0x1",
+ "0x00000000000000000000000000000000000000bb": "0x1",
+ "0x00000000000000000000000000000000000000bc": "0x1",
+ "0x00000000000000000000000000000000000000bd": "0x1",
+ "0x00000000000000000000000000000000000000be": "0x1",
+ "0x00000000000000000000000000000000000000bf": "0x1",
+ "0x00000000000000000000000000000000000000c0": "0x1",
+ "0x00000000000000000000000000000000000000c1": "0x1",
+ "0x00000000000000000000000000000000000000c2": "0x1",
+ "0x00000000000000000000000000000000000000c3": "0x1",
+ "0x00000000000000000000000000000000000000c4": "0x1",
+ "0x00000000000000000000000000000000000000c5": "0x1",
+ "0x00000000000000000000000000000000000000c6": "0x1",
+ "0x00000000000000000000000000000000000000c7": "0x1",
+ "0x00000000000000000000000000000000000000c8": "0x1",
+ "0x00000000000000000000000000000000000000c9": "0x1",
+ "0x00000000000000000000000000000000000000ca": "0x1",
+ "0x00000000000000000000000000000000000000cb": "0x1",
+ "0x00000000000000000000000000000000000000cc": "0x1",
+ "0x00000000000000000000000000000000000000cd": "0x1",
+ "0x00000000000000000000000000000000000000ce": "0x1",
+ "0x00000000000000000000000000000000000000cf": "0x1",
+ "0x00000000000000000000000000000000000000d0": "0x1",
+ "0x00000000000000000000000000000000000000d1": "0x1",
+ "0x00000000000000000000000000000000000000d2": "0x1",
+ "0x00000000000000000000000000000000000000d3": "0x1",
+ "0x00000000000000000000000000000000000000d4": "0x1",
+ "0x00000000000000000000000000000000000000d5": "0x1",
+ "0x00000000000000000000000000000000000000d6": "0x1",
+ "0x00000000000000000000000000000000000000d7": "0x1",
+ "0x00000000000000000000000000000000000000d8": "0x1",
+ "0x00000000000000000000000000000000000000d9": "0x1",
+ "0x00000000000000000000000000000000000000da": "0x1",
+ "0x00000000000000000000000000000000000000db": "0x1",
+ "0x00000000000000000000000000000000000000dc": "0x1",
+ "0x00000000000000000000000000000000000000dd": "0x1",
+ "0x00000000000000000000000000000000000000de": "0x1",
+ "0x00000000000000000000000000000000000000df": "0x1",
+ "0x00000000000000000000000000000000000000e0": "0x1",
+ "0x00000000000000000000000000000000000000e1": "0x1",
+ "0x00000000000000000000000000000000000000e2": "0x1",
+ "0x00000000000000000000000000000000000000e3": "0x1",
+ "0x00000000000000000000000000000000000000e4": "0x1",
+ "0x00000000000000000000000000000000000000e5": "0x1",
+ "0x00000000000000000000000000000000000000e6": "0x1",
+ "0x00000000000000000000000000000000000000e7": "0x1",
+ "0x00000000000000000000000000000000000000e8": "0x1",
+ "0x00000000000000000000000000000000000000e9": "0x1",
+ "0x00000000000000000000000000000000000000ea": "0x1",
+ "0x00000000000000000000000000000000000000eb": "0x1",
+ "0x00000000000000000000000000000000000000ec": "0x1",
+ "0x00000000000000000000000000000000000000ed": "0x1",
+ "0x00000000000000000000000000000000000000ee": "0x1",
+ "0x00000000000000000000000000000000000000ef": "0x1",
+ "0x00000000000000000000000000000000000000f0": "0x1",
+ "0x00000000000000000000000000000000000000f1": "0x1",
+ "0x00000000000000000000000000000000000000f2": "0x1",
+ "0x00000000000000000000000000000000000000f3": "0x1",
+ "0x00000000000000000000000000000000000000f4": "0x1",
+ "0x00000000000000000000000000000000000000f5": "0x1",
+ "0x00000000000000000000000000000000000000f6": "0x1",
+ "0x00000000000000000000000000000000000000f7": "0x1",
+ "0x00000000000000000000000000000000000000f8": "0x1",
+ "0x00000000000000000000000000000000000000f9": "0x1",
+ "0x00000000000000000000000000000000000000fa": "0x1",
+ "0x00000000000000000000000000000000000000fb": "0x1",
+ "0x00000000000000000000000000000000000000fc": "0x1",
+ "0x00000000000000000000000000000000000000fd": "0x1",
+ "0x00000000000000000000000000000000000000fe": "0x1",
+ "0x00000000000000000000000000000000000000ff": "0x1",
+ "0x4c2ae482593505f0163cdefc073e81c63cda4107": "0x152d02c7e14af6800000",
+ "0xa8e8f14732658e4b51e8711931053a8a69baf2b1": "0x152d02c7e14af6800000",
+ "0xd9a5179f091d85051d3c982785efd1455cec8699": "0x84595161401484a000000",
+ "0xe0a2bd4258d2768837baa26a28fe71dc079f84c7": "0x4a47e3c12448f4ad000000"
+}
+
+},{}],595:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var genesisStates = {
+ names: {
+ '1': 'mainnet',
+ '3': 'ropsten',
+ '4': 'rinkeby',
+ '42': 'kovan',
+ '6284': 'goerli',
+ },
+ mainnet: require('./mainnet.json'),
+ ropsten: require('./ropsten.json'),
+ rinkeby: require('./rinkeby.json'),
+ kovan: require('./kovan.json'),
+ goerli: require('./goerli.json'),
+};
+/**
+ * Returns the genesis state by network ID
+ * @param id ID of the network (e.g. 1)
+ * @returns Dictionary with genesis accounts
+ */
+function genesisStateById(id) {
+ return genesisStates[genesisStates['names'][id]];
+}
+exports.genesisStateById = genesisStateById;
+/**
+ * Returns the genesis state by network name
+ * @param name Name of the network (e.g. 'mainnet')
+ * @returns Dictionary with genesis accounts
+ */
+function genesisStateByName(name) {
+ return genesisStates[name];
+}
+exports.genesisStateByName = genesisStateByName;
+
+},{"./goerli.json":594,"./kovan.json":596,"./mainnet.json":597,"./rinkeby.json":598,"./ropsten.json":599}],596:[function(require,module,exports){
+module.exports={}
+
+},{}],597:[function(require,module,exports){
+module.exports={
+ "0x3282791d6fd713f1e94f4bfd565eaa78b3a0599d": "1337000000000000000000",
+ "0x17961d633bcf20a7b029a7d94b7df4da2ec5427f": "229427000000000000000",
+ "0x493a67fe23decc63b10dda75f3287695a81bd5ab": "880000000000000000000",
+ "0x01fb8ec12425a04f813e46c54c05748ca6b29aa9": "259800000000000000000",
+ "0xd2a030ac8952325f9e1db378a71485a24e1b07b2": "2000000000000000000000",
+ "0x77a34907f305a54c85db09c363fde3c47e6ae21f": "985000000000000000000",
+ "0x391a77405c09a72b5e8436237aaaf95d68da1709": "49082000000000000000",
+ "0x00aada25ea2286709abb422d41923fd380cd04c7": "650100000000000000000",
+ "0xacc46a2a555c74ded4a2bd094e821b97843b40c0": "1940000000000000000000",
+ "0xde07fb5b7a464e3ba7fbe09e9acb271af5338c58": "50000000000000000000",
+ "0x4c696be99f3a690440c3436a59a7d7e937d6ba0d": "3460000000000000000000",
+ "0xfa33553285a973719a0d5f956ff861b2d89ed304": "20000000000000000000",
+ "0x67cfda6e70bf7657d39059b59790e5145afdbe61": "646000000000000000000",
+ "0xa321091d3018064279db399d2b2a88a6f440ae24": "3200000000000000000000",
+ "0xfb3fa1ac08aba9cc3bf0fe9d483820688f65b410": "30000000000000000000000",
+ "0x6715c14035fb57bb3d667f7b707498c41074b855": "700000000000000000000",
+ "0xd4344f7d5cad65d17e5c2d0e7323943d6f62fe92": "267400000000000000000",
+ "0xa3294626ec2984c43b43da4d5d8e4669b11d4b59": "1008000000000000000000",
+ "0x656018584130db83ab0591a8128d9381666a8d0e": "63960000000000000000",
+ "0x0fa010ce0c731d3b628e36b91f571300e49dbeab": "999800000000000000000",
+ "0x3098b65db93ecacaf7353c48808390a223d57684": "449965000000000000000",
+ "0xae635bf73831119d2d29c0d04ff8f8d8d0a57a46": "1337000000000000000000",
+ "0x0f7515ff0e808f695e0c20485ff96ed2f7b79310": "1000169000000000000000",
+ "0x8b30c04098d7a7e6420c357ea7bfa49bac9a8a18": "8000200000000000000000",
+ "0x64dba2d6615b8bd7571836dc75bc79d314f5ecee": "10000000000000000000000",
+ "0xe7912d4cf4562c573ddc5b71e37310e378ef86c9": "394000000000000000000",
+ "0xa4da34450d22ec0ffcede0004b02f7872ee0b73a": "93342000000000000000",
+ "0x34437d1465640b136cb5841c3f934f9ba0b7097d": "173000000000000000000",
+ "0xc652871d192422c6bc235fa063b44a7e1d43e385": "155000000000000000000",
+ "0xa8a708e84f82db86a35502193b4c6ee9a76ebe8f": "1015200000000000000000",
+ "0x5c3f567faff7bad1b5120022e8cbcaa82b4917b3": "2000000000000000000000",
+ "0xdbc1d0ee2bab531140de137722cd36bdb4e47194": "200000000000000000000",
+ "0xf59dab1bf8df11327e61f9b7a14b563a96ec3554": "6000000000000000000000",
+ "0x456f8d746682b224679349064d1b368c7c05b176": "3700000000000000000000",
+ "0x5f13154631466dcb1353c890932a7c97e0878e90": "6000000000000000000000",
+ "0xf4b1626e24f30bcad9273c527fcc714b5d007b8f": "200000000000000000000",
+ "0xa8db0b9b201453333c757f6ad9bcb555c02da93b": "2199970000000000000000",
+ "0xa0fc7e53c5ebd27a2abdac45261f84ab3b51aefb": "3008250000000000000000",
+ "0x1b636b7a496f044d7359596e353a104616436f6b": "360354000000000000000",
+ "0x74bce9ec38362d6c94ccac26d5c0e13a8b3b1d40": "999954000000000000000",
+ "0x9834682180b982d166badb9d9d1d9bbf016d87ee": "2000000000000000000000",
+ "0x1e6e0153fc161bc05e656bbb144c7187bf4fe84d": "2000000000000000000000",
+ "0x989c0ccff654da03aeb11af701054561d6297e1d": "4000000000000000000000",
+ "0x78a1e254409fb1b55a7cb4dd8eba3b30c8bad9ef": "100000000000000000000",
+ "0x9ef1896b007c32a15114fb89d73dbd47f9122b69": "4000000000000000000000",
+ "0x33320dd90f2baa110dd334872a998f148426453c": "999972000000000000000",
+ "0xe72e1d335cc29a96b9b1c02f003a16d971e90b9d": "1580000000000000000000",
+ "0x0921605f99164e3bcc28f31caece78973182561d": "793744000000000000000",
+ "0xfc00a420a36107dfd5f495128a5fe5abb2db0f34": "5960000000000000000000",
+ "0xdfcbdf09454e1a5e4a40d3eef7c5cf1cd3de9486": "4000000000000000000000",
+ "0x646e043d0597a664948fbb0dc15475a3a4f3a6ed": "20000000000000000000",
+ "0x79aeb34566b974c35a5881dec020927da7df5d25": "2000000000000000000000",
+ "0xdbadc61ed5f0460a7f18e51b2fb2614d9264a0e0": "40000000000000000000",
+ "0x97b91efe7350c2d57e7e406bab18f3617bcde14a": "9999980000000000000000",
+ "0x8398e07ebcb4f75ff2116de77c1c2a99f303a4cf": "500000000000000000000",
+ "0xf02796295101674288c1d93467053d042219b794": "740000000000000000000",
+ "0xf4ed848ec961739c2c7e352f435ba70a7cd5db38": "1970000000000000000000",
+ "0x82485728d0e281563758c75ab27ed9e882a0002d": "147000000000000000000",
+ "0x427ec668ac9404e895cc861511d1620a4912be98": "40000000000000000000000",
+ "0x1bbc199e586790be87afedc849c04726745c5d7b": "4000000000000000000000",
+ "0x10d945334ecde47beb9ca3816c173dfbbd0b5333": "1400000000000000000000",
+ "0x1dcebcb7656df5dcaa3368a055d22f9ed6cdd940": "499800000000000000000",
+ "0x2ac1f8d7bf721f3cfe74d20fea9b87a28aaa982c": "161000000000000000000",
+ "0x0a47ad9059a249fc936b2662353da6905f75c2b9": "2000000000000000000000",
+ "0x768498934e37e905f1d0e77b44b574bcf3ec4ae8": "20000000000000000000000",
+ "0xf46b6b9c7cb552829c1d3dfd8ffb11aabae782f6": "21000000000000000000",
+ "0x7aea25d42b2612286e99c53697c6bc4100e2dbbf": "2000000000000000000000",
+ "0xaf3615c789d0b1152ad4db25fe5dcf222804cf62": "1000000000000000000000",
+ "0x92e6581e1da1f9b846e09347333dc818e2d2ac66": "3640000000000000000000",
+ "0x240305727313d01e73542c775ff59d11cd35f819": "5931229000000000000000",
+ "0xb95cfda8465ba9c2661b249fc3ab661bdfa35ff0": "318949000000000000000",
+ "0x1b0d076817e8d68ee2df4e1da1c1142d198c4435": "1550000000000000000000",
+ "0x93c2e64e5de5589ed25006e843196ee9b1cf0b3e": "1670000000000000000000",
+ "0x0e2e504a2d1122b5a9feee5cb1451bf4c2ace87b": "3940000000000000000000",
+ "0x22b96ab2cad55db100b53001f9e4db378104c807": "10000000000000000000000",
+ "0xa927d48bb6cb814bc609cbcaa9151f5d459a27e1": "271600000000000000000",
+ "0x5cbd8daf27ddf704cdd0d909a789ba36ed4f37b2": "13400000000000000000",
+ "0x9adbd3bc7b0afc05d1d2eda49ff863939c48db46": "199955000000000000000",
+ "0xac7e03702723cb16ee27e22dd0b815dc2d5cae9f": "16000000000000000000000",
+ "0x1e210e7047886daa52aaf70f4b991dac68e3025e": "200000000000000000000",
+ "0xc98048687f2bfcc9bd90ed18736c57edd352b65d": "1000000000000000000000",
+ "0x81c18c2a238ddc4cba230a072dd7dc101e620273": "1337000000000000000000",
+ "0xcb3d766c983f192bcecac70f4ee03dd9ff714d51": "100000000000000000000",
+ "0x44a63d18424587b9b307bfc3c364ae10cd04c713": "20000000000000000000",
+ "0x4ab2d34f04834fbf7479649cab923d2c4725c553": "3520000000000000000000",
+ "0xb834acf3015322c58382eeb2b79638906e88b6de": "24000000000000000000000",
+ "0x7d551397f79a2988b064afd0efebee802c7721bc": "39400000000000000000000",
+ "0xb537d36a70eeb8d3e5c80de815225c1158cb92c4": "1500000000000000000000",
+ "0x805ce51297a0793b812067f017b3e7b2df9bb1f9": "100000000000000000000",
+ "0x085ba65febe23eefc2c802666ab1262382cfc494": "400000000000000000000",
+ "0xb1c0d08b36e184f9952a4037e3e53a667d070a4e": "1000000000000000000000",
+ "0x83fe5a1b328bae440711beaf6aad6026eda6d220": "20000000000000000000000",
+ "0x7fd679e5fb0da2a5d116194dcb508318edc580f3": "6560000000000000000000",
+ "0x41ad369f758fef38a19aa3149379832c818ef2a0": "1000060000000000000000",
+ "0x6d846dc12657e91af25008519c3e857f51707dd6": "4590000000000000000000",
+ "0xc02d6eadeacf1b78b3ca85035c637bb1ce01f490": "4000000000000000000000",
+ "0x826eb7cd7319b82dd07a1f3b409071d96e39677f": "1000000000000000000000",
+ "0x4ac9905a4cb6ab1cfd62546ee5917300b87c4fde": "1015200000000000000000",
+ "0xcf6e52e6b77480b1867efec6446d9fc3cc3577e8": "222010000000000000000",
+ "0x2476b2bb751ce748e1a4c4ff7b230be0c15d2245": "4000000000000000000000",
+ "0x1a505e62a74e87e577473e4f3afa16bedd3cfa52": "500000000000000000000",
+ "0x21d02705f3f64905d80ed9147913ea8c7307d695": "1363740000000000000000",
+ "0x7b1daf14891b8a1e1bd429d8b36b9a4aa1d9afbf": "500000000000000000000",
+ "0x5338ef70eac9dd9af5a0503b5efad1039e67e725": "2674000000000000000000",
+ "0x50ca86b5eb1d01874df8e5f34945d49c6c1ab848": "1000000000000000000000",
+ "0xf3cc8bcb559465f81bfe583bd7ab0a2306453b9e": "20000000000000000000000",
+ "0x5c323457e187761a8276e359b7b7af3f3b6e3df6": "10000000000000000000000",
+ "0x4d82d7700c123bb919419bbaf046799c6b0e2c66": "20000000000000000000000",
+ "0x8a66abbc2d30ce21a833b0db8e561d5105e0a72c": "699958000000000000000",
+ "0x2ae53866fc2d14d572ab73b4a065a1188267f527": "8000000000000000000000",
+ "0x9af5c9894c33e42c2c518e3ac670ea9505d1b53e": "18200000000000000000",
+ "0xcba25c7a503cc8e0d04971ca05c762f9b762b48b": "500000000000000000000",
+ "0xfda3042819af3e662900e1b92b4358eda6e92590": "118200000000000000000000",
+ "0x9bd7c38a4210304a4d653edeff1b3ce45fce7843": "282000000000000000000",
+ "0xedc22fb92c638e1e21ff5cf039daa6e734dafb29": "298000000000000000000",
+ "0xa1f193a0592f1feb9fdfc90aa813784eb80471c9": "1400000000000000000000",
+ "0xe97fde0b67716325cf0ecce8a191a3761b2c791d": "1004700000000000000000",
+ "0x110237cf9117e767922fc4a1b78d7964da82df20": "3940000000000000000000",
+ "0xe32f95766d57b5cd4b173289d6876f9e64558194": "100000000000000000000",
+ "0xf2d59c8923759073d6f415aaf8eb065ff2f3b685": "7880000000000000000000",
+ "0xc53d79f7cb9b70952fd30fce58d54b9f0b59f647": "5089200000000000000000",
+ "0x9eb281c32719c40fdb3e216db0f37fbc73a026b7": "20000000000000000000",
+ "0x2d6511fd7a3800b26854c7ec39c0dcb5f4c4e8e8": "399910000000000000000",
+ "0x61ba87c77e9b596de7ba0e326fddfeec2163ef66": "200000000000000000000",
+ "0xde1121829c9a08284087a43fbd2fc1142a3233b4": "1000000000000000000000",
+ "0x22a25812ab56dcc423175ed1d8adacce33cd1810": "1850000000000000000000",
+ "0x518cef27b10582b6d14f69483ddaa0dd3c87bb5c": "600000000000000000000",
+ "0x59161749fedcf1c721f2202d13ade2abcf460b3d": "2000000000000000000000",
+ "0x3e36c17253c11cf38974ed0db1b759160da63783": "7000000000000000000000",
+ "0xcbfa76db04ce38fb205d37b8d377cf1380da0317": "1430000000000000000000",
+ "0xa7e83772bc200f9006aa2a260dbaa8483dc52b30": "207730000000000000000",
+ "0xe87eac6d602b4109c9671bf57b950c2cfdb99d55": "49932000000000000000",
+ "0x9b06ad841dffbe4ccf46f1039fc386f3c321446e": "2000000000000000000000",
+ "0xe0f903c1e48ac421ab48528f3d4a2648080fe043": "1015200000000000000000",
+ "0x5d872b122e994ef27c71d7deb457bf65429eca6c": "7999973000000000000000",
+ "0xf34083ecea385017aa40bdd35ef7effb4ce7762d": "400000000000000000000",
+ "0x7f3709391f3fbeba3592d175c740e87a09541d02": "480000000000000000000",
+ "0x888e94917083d152202b53163939869d271175b4": "4000000000000000000000",
+ "0xbed4c8f006a27c1e5f7ce205de75f516bfb9f764": "16000000000000000000000",
+ "0xb3a6bd41f9d9c3201e050b87198fbda399342210": "3622615000000000000000",
+ "0x550aadae1221b07afea39fba2ed62e05e5b7b5f9": "20000000000000000000",
+ "0xbcedc4267ccb89b31bb764d7211171008d94d44d": "200000000000000000000",
+ "0x6229dcc203b1edccfdf06e87910c452a1f4d7a72": "32500000000000000000000",
+ "0x94be3ae54f62d663b0d4cc9e1ea8fe9556ea9ebf": "23280000000000000000",
+ "0x0e0c9d005ea016c295cd795cc9213e87febc33eb": "198000000000000000000",
+ "0x55d057bcc04bd0f4af9642513aa5090bb3ff93fe": "1106680000000000000000",
+ "0xed9e030ca75cb1d29ea01d0d4cdfdccd3844b6e4": "30895000000000000000",
+ "0x86c4ce06d9ac185bb148d96f7b7abe73f441006d": "10000000000000000000000",
+ "0x2c04115c3e52961b0dc0b0bf31fba4546f5966fd": "200000000000000000000",
+ "0xb959dce02e91d9db02b1bd8b7d17a9c41a97af09": "8000000000000000000000",
+ "0xe01547ba42fcafaf93938becf7699f74290af74f": "2000000000000000000000",
+ "0xc593d6e37d14b566643ac4135f243caa0787c182": "12000000000000000000000",
+ "0x2c0ee134d8b36145b47beee7af8d2738dbda08e8": "201000000000000000000",
+ "0x0ef54ac7264d2254abbb5f8b41adde875157db7c": "40000000000000000000",
+ "0x0349634dc2a9e80c3f7721ee2b5046aeaaedfbb5": "4000000000000000000000",
+ "0x873e49135c3391991060290aa7f6ccb8f85a78db": "20000000000000000000",
+ "0x05236d4c90d065f9e3938358aaffd777b86aec49": "500000000000000000000",
+ "0xd2abd84a181093e5e229136f42d835e8235de109": "100007000000000000000",
+ "0xb56a780028039c81caf37b6775c620e786954764": "2000000000000000000000",
+ "0x86df73bd377f2c09de63c45d67f283eaefa0f4ab": "1000000000000000000000",
+ "0x7670b02f2c3cf8fd4f4730f3381a71ea431c33c7": "267400000000000000000",
+ "0x24aa1151bb765fa3a89ca50eb6e1b1c706417fd4": "3100000000000000000000",
+ "0x43227d65334e691cf231b4a4e1d339b95d598afb": "10000000000000000000000",
+ "0x695550656cbf90b75d92ad9122d90d23ca68ca4d": "1000000000000000000000",
+ "0x5281733473e00d87f11e9955e589b59f4ac28e7a": "660360000000000000000000",
+ "0x99a96bf2242ea1b39ece6fcc0d18aed00c0179f3": "300000000000000000000",
+ "0xb1cf94f8091505055f010ab4bac696e0ca0f67a1": "1580000000000000000000",
+ "0x54391b4d176d476cea164e5fb535c69700cb2535": "100076000000000000000",
+ "0x152f2bd229ddf3cb0fdaf455c183209c0e1e39a2": "2000000000000000000000",
+ "0xaffc99d5ebb4a84fe7788d97dce274b038240438": "5000000000000000000000",
+ "0x23df8f48ee009256ea797e1fa369beebcf6bc663": "2302671000000000000000",
+ "0x3a72d635aadeee4382349db98a1813a4cfeb3df1": "200000000000000000000000",
+ "0xce26f9a5305f8381094354dbfc92664e84f902b5": "230200000000000000000",
+ "0xd283b8edb10a25528a4404de1c65e7410dbcaa67": "12000000000000000000000",
+ "0xa7859fc07f756ea7dcebbccd42f05817582d973f": "10000000000000000000000",
+ "0xb28181a458a440f1c6bb1de8400281a3148f4c35": "376000000000000000000",
+ "0x27b1694eafa165ebd7cc7bc99e74814a951419dc": "800000000000000000000",
+ "0x66cc8ab23c00d1b82acd7d73f38c99e0d05a4fa6": "100000000000000000000",
+ "0x926082cb7eed4b1993ad245a477267e1c33cd568": "374300000000000000000",
+ "0x4a47fc3e177f567a1e3893e000e36bba23520ab8": "2000000000000000000000",
+ "0x594a76f06935388dde5e234696a0668bc20d2ddc": "2800000000000000000000",
+ "0xe91fa0badaddb9a97e88d3f4db7c55d6bb7430fe": "376000000000000000000",
+ "0x574de1b3f38d915846ae3718564a5ada20c2f3ed": "4000000000000000000000",
+ "0x5816c2687777b6d7d2a2432d59a41fa059e3a406": "133700000000000000000000",
+ "0xb50955aa6e341571986608bdc891c2139f540cdf": "1970000000000000000000",
+ "0x6d44974a31d187eda16ddd47b9c7ec5002d61fbe": "940000000000000000000",
+ "0x80abec5aa36e5c9d098f1b942881bd5acac6963d": "2000000000000000000000",
+ "0x294f494b3f2e143c2ffc9738cbfd9501850b874e": "2240000000000000000000",
+ "0xbca3ffd4683fba0ad3bbc90734b611da9cfb457e": "200000000000000000000",
+ "0x5992624c54cdec60a5ae938033af8be0c50cbb0a": "3621678000000000000000",
+ "0x6560941328ff587cbc56c38c78238a7bb5f442f6": "744900000000000000000",
+ "0x74b7e0228baed65957aebb4d916d333aae164f0e": "2000000000000000000000",
+ "0x8516fcaf77c893970fcd1a958ba9a00e49044019": "196279000000000000000",
+ "0xb992a967308c02b98af91ee760fd3b6b4824ab0e": "2000000000000000000000",
+ "0x30bb4357cd6910c86d2238bf727cbe8156680e62": "100014000000000000000",
+ "0xb8cc0f060aad92d4eb8b36b3b95ce9e90eb383d7": "150000000000000000000000",
+ "0x28d4ebf41e3d3c451e943bdd7e1f175fae932a3d": "6000000000000000000000",
+ "0x8c83d424a3cf24d51f01923dd54a18d6b6fede7b": "4000000000000000000000",
+ "0x7efc90766a00bc52372cac97fabd8a3c831f8ecd": "158000000000000000000",
+ "0x7c2b9603884a4f2e464eceb97d17938d828bc02c": "3000000000000000000000",
+ "0x9d250ae4f110d71cafc7b0adb52e8d9acb6679b8": "9840000000000000000000",
+ "0x61b3df2e9e9fd968131f1e88f0a0eb5bd765464d": "4000000000000000000000",
+ "0x9ae13bd882f2576575921a94974cbea861ba0d35": "3160000000000000000000",
+ "0x3d09688d93ad07f3abe68c722723cd680990435e": "29999948000000000000000",
+ "0x5e58e255fc19870a04305ff2a04631f2ff294bb1": "17600000000000000000",
+ "0xbcaed0acb6a76f113f7c613555a2c3b0f5bf34a5": "193600000000000000000",
+ "0x159adce27aa10b47236429a34a5ac42cad5b6416": "31867951000000000000000",
+ "0xe834c64318205ca7dd4a21abcb08266cb21ff02c": "999999000000000000000",
+ "0x7b6a84718dd86e63338429ac811d7c8a860f21f1": "1790000000000000000000",
+ "0x2118c116ab0cdf6fd11d54a4309307b477c3fc0f": "10000000000000000000000",
+ "0x34a901a69f036bcf9f7843c0ba01b426e8c3dc2b": "4000000000000000000000",
+ "0xc7d44fe32c7f8cd5f1a97427b6cd3afc9e45023e": "1580000000000000000000",
+ "0xc6045b3c350b4ce9ca0c6b754fb41a69b97e9900": "925000000000000000000",
+ "0xcf5a6f9df75579c644f794711215b30d77a0ce40": "2000000000000000000000",
+ "0xe2904b1aefa056398b6234cb35811288d736db67": "40000000000000000000",
+ "0x7101bd799e411cde14bdfac25b067ac890eab8e8": "1450054000000000000000",
+ "0xcc45fb3a555bad807b388a0357c855205f7c75e8": "865000000000000000000",
+ "0xff0c3c7798e8733dd2668152891bab80a8be955c": "80220000000000000000",
+ "0x3536453322c1466cb905af5c335ca8db74bff1e6": "447000000000000000000",
+ "0x08cac8952641d8fc526ec1ab4f2df826a5e7710f": "300000000000000000000",
+ "0x0d8aab8f74ea862cdf766805009d3f3e42d8d00b": "5820000000000000000000",
+ "0x8908760cd39b9c1e8184e6a752ee888e3f0b7045": "6000000000000000000000",
+ "0x8156360bbd370961ceca6b6691d75006ad204cf2": "40000000000000000000000",
+ "0xa304588f0d850cd8d38f76e9e83c1bf63e333ede": "39800000000000000000",
+ "0x14c63ba2dcb1dd4df33ddab11c4f0007fa96a62d": "15500000000000000000000",
+ "0xa009bf076f1ba3fa57d2a7217218bed5565a7a7a": "1000000000000000000000",
+ "0x1c89060f987c518fa079ec2c0a5ebfa30f5d20f7": "38000000000000000000000",
+ "0x8895eb726226edc3f78cc6a515077b3296fdb95e": "3940000000000000000000",
+ "0x7919e7627f9b7d54ea3b14bb4dd4649f4f39dee0": "1670000000000000000000",
+ "0xb3c65b845aba6cd816fbaae983e0e46c82aa8622": "1000000000000000000000",
+ "0xeff51d72adfae143edf3a42b1aec55a2ccdd0b90": "300000000000000000000",
+ "0x05bb64a916be66f460f5e3b64332110d209e19ae": "4200000000000000000000",
+ "0xd5b117ec116eb846418961eb7edb629cd0dd697f": "3000000000000000000000",
+ "0x05e97b09492cd68f63b12b892ed1d11d152c0eca": "1015200000000000000000",
+ "0x84cc7878da605fdb019fab9b4ccfc157709cdda5": "1336922000000000000000",
+ "0x79cac6494f11ef2798748cb53285bd8e22f97cda": "2000000000000000000000",
+ "0xbd5a8c94bd8be6470644f70c8f8a33a8a55c6341": "200000000000000000000",
+ "0xb119e79aa9b916526581cbf521ef474ae84dcff4": "1470700000000000000000",
+ "0xaff1045adf27a1aa329461b24de1bae9948a698b": "33400000000000000000",
+ "0x4398628ea6632d393e929cbd928464c568aa4a0c": "1400000000000000000000",
+ "0x99997668f7c1a4ff9e31f9977ae3224bcb887a85": "291200000000000000000",
+ "0xbc0e8745c3a549445c2be900f52300804ab56289": "33104697000000000000000",
+ "0xe5bab4f0afd8a9d1a381b45761aa18f3d3cce105": "1508010000000000000000",
+ "0xbe60037e90714a4b917e61f193d834906703b13a": "1700000000000000000000",
+ "0x8ed4284c0f47449c15b8d9b3245de8beb6ce80bf": "800000000000000000000",
+ "0x333ad1596401e05aea2d36ca47318ef4cd2cb3df": "2910000000000000000000",
+ "0x22db559f2c3c1475a2e6ffe83a5979599196a7fa": "1000000000000000000000",
+ "0xfdf449f108c6fb4f5a2b081eed7e45e6919e4d25": "2000000000000000000000",
+ "0x0be1bcb90343fae5303173f461bd914a4839056c": "6000000000000000000000",
+ "0xb981ad5e6b7793a23fc6c1e8692eb2965d18d0da": "9999924000000000000000",
+ "0xc75d2259306aec7df022768c69899a652185dbc4": "4000000000000000000000",
+ "0x6c2e9be6d4ab450fd12531f33f028c614674f197": "3580000000000000000000",
+ "0x6dcc7e64fcafcbc2dc6c0e5e662cb347bffcd702": "20000000000000000000000",
+ "0xaabdb35c1514984a039213793f3345a168e81ff1": "309760000000000000000",
+ "0xd315deea1d8c1271f9d1311263ab47c007afb6f5": "69760000000000000000",
+ "0x4faf90b76ecfb9631bf9022176032d8b2c207009": "1000032000000000000000",
+ "0x3e7a966b5dc357ffb07e9fe067c45791fd8e3049": "59100000000000000000",
+ "0x2e64a8d71111a22f4c5de1e039b336f68d398a7c": "2000000000000000000000",
+ "0x181fbba852a7f50178b1c7f03ed9e58d54162929": "666000000000000000000",
+ "0x4f7330096f79ed264ee0127f5d30d2f73c52b3d8": "499970000000000000000",
+ "0xa8a8dbdd1a85d1beee2569e91ccc4d09ae7f6ea1": "5800000000000000000000",
+ "0x1f9c3268458da301a2be5ab08257f77bb5a98aa4": "200000000000000000000",
+ "0xfc372ff6927cb396d9cf29803500110da632bc52": "2000000000000000000000",
+ "0x4fa554ab955c249217386a4d3263bbf72895434e": "19982000000000000000",
+ "0x2a59e47ea5d8f0e7c028a3e8e093a49c1b50b9a3": "2000000000000000000000",
+ "0x5e32c72191b8392c55f510d8e3326e3a60501d62": "44000000000000000000000",
+ "0x1dfaee077212f1beaf0e6f2f1840537ae154ad86": "1000000000000000000000",
+ "0x7eaba035e2af3793fd74674b102540cf190addb9": "1273000000000000000000",
+ "0xd62edb96fce2969aaf6c545e967cf1c0bc805205": "85705000000000000000",
+ "0x220dc68df019b6b0ccbffb784b5a5ab4b15d4060": "3940000000000000000000",
+ "0x45bb829652d8bfb58b8527f0ecb621c29e212ec3": "2000000000000000000000",
+ "0x79b120eb8806732321288f675a27a9225f1cd2eb": "2465000000000000000000",
+ "0x740af1eefd3365d78ba7b12cb1a673e06a077246": "19700000000000000000000",
+ "0x0f042c9c2fb18766f836bb59f735f27dc329fe3c": "10000000000000000000000",
+ "0x6dda5f788a6c688ddf921fa3852eb6d6c6c62966": "40000000000000000000",
+ "0x96ad579bbfa8db8ebec9d286a72e4661eed8e356": "1070750000000000000000",
+ "0x0c2073ba44d3ddbdb639c04e191039a71716237f": "1430000000000000000000",
+ "0x1a3520453582c718a21c42375bc50773255253e1": "790000000000000000000",
+ "0xefcaae9ff64d2cd95b5249dcffe7faa0a0c0e44d": "401100000000000000000",
+ "0x0a3de155d5ecd8e81c1ff9bbf0378301f8d4c623": "4000000000000000000000",
+ "0x80f07ac09e7b2c3c0a3d1e9413a544c73a41becb": "20000000000000000000",
+ "0xc3631c7698b6c5111989bf452727b3f9395a6dea": "10683500000000000000000",
+ "0x4cc22c9bc9ad05d875a397dbe847ed221c920c67": "2000000000000000000000",
+ "0x1a987e3f83de75a42f1bde7c997c19217b4a5f24": "2000000000000000000000",
+ "0x5b2b64e9c058e382a8b299224eecaa16e09c8d92": "161000000000000000000",
+ "0x86caafacf32aa0317c032ac36babed974791dc03": "40000000000000000000000",
+ "0x1cd1f0a314cbb200de0a0cb1ef97e920709d97c2": "2000000000000000000000",
+ "0x7d980f4b566bb045517e4c14c87750de9346744b": "1337000000000000000000",
+ "0x8b5f29cc2faa262cdef30ef554f50eb488146eac": "5818250000000000000000",
+ "0x5153a0c3c8912881bf1c3501bf64b45649e48222": "4000000000000000000000",
+ "0xd21a7341eb84fd151054e5e387bb25d36e499c09": "14000000000000000000000",
+ "0x9560e8ac6718a6a1cdcff189d603c9063e413da6": "4000000000000000000000",
+ "0xe49ba0cd96816c4607773cf8a5970bb5bc16a1e6": "1670000000000000000000",
+ "0xb8ac117d9f0dba80901445823c4c9d4fa3fedc6e": "15759015000000000000000",
+ "0xaf67fd3e127fd9dc36eb3fcd6a80c7be4f7532b2": "1670000000000000000000",
+ "0xb43c27f7a0a122084b98f483922541c8836cee2c": "715000000000000000000",
+ "0x4d9279962029a8bd45639737e98b511eff074c21": "1337000000000000000000",
+ "0xc667441e7f29799aba616451d53b3f489f9e0f48": "13920000000000000000000",
+ "0x275875ff4fbb0cf3a430213127487f7608d04cba": "500080000000000000000",
+ "0x9a953b5bcc709379fcb559d7b916afdaa50cadcc": "100000000000000000000",
+ "0x7ea791ebab0445a00efdfc4e4a8e9a7e7565136d": "18200000000000000000",
+ "0x6ffe5cf82cc9ea5e36cad7c2974ce7249f3749e6": "1940000000000000000000",
+ "0xf1b4ecc63525f7432c3d834ffe2b970fbeb87212": "3000064000000000000000",
+ "0x6b72a8f061cfe6996ad447d3c72c28c0c08ab3a7": "4271316000000000000000",
+ "0xbba3c68004248e489573abb2743677066b24c8a7": "2000000000000000000000",
+ "0xb7c0d0cc0b4d342d4062bac624ccc3c70cc6da3f": "4000000000000000000000",
+ "0xfe98c664c3e447a95e69bd582171b7176ea2a685": "4000000000000000000000",
+ "0xce71086d4c602554b82dcbfce88d20634d53cc4d": "43250000000000000000000",
+ "0x1c601993789207f965bb865cbb4cd657cce76fc0": "98294000000000000000",
+ "0x476b5599089a3fb6f29c6c72e49b2e4740ea808d": "2800000000000000000000",
+ "0x3439998b247cb4bf8bc80a6d2b3527f1dfe9a6d2": "140000000000000000000",
+ "0xc4f7d2e2e22084c44f70feaab6c32105f3da376f": "1970000000000000000000",
+ "0xc1eba5684aa1b24cba63150263b7a9131aeec28d": "20000000000000000000",
+ "0x94ad4bad824bd0eb9ea49c58cebcc0ff5e08346b": "1940000000000000000000",
+ "0xded877378407b94e781c4ef4af7cfc5bc220b516": "372500000000000000000",
+ "0x699c9ee47195511f35f862ca4c22fd35ae8ffbf4": "80000000000000000000",
+ "0xe3a89a1927cc4e2d43fbcda1e414d324a7d9e057": "205500000000000000000",
+ "0x4d93696fa24859f5d2939aebfa54b4b51ae1dccc": "19100000000000000000",
+ "0x0af65f14784e55a6f95667fd73252a1c94072d2a": "192987000000000000000",
+ "0x5b70c49cc98b3df3fbe2b1597f5c1b6347a388b7": "970000000000000000000",
+ "0x426f78f70db259ac8534145b2934f4ef1098b5d8": "360000000000000000000",
+ "0x58b8ae8f63ef35ed0762f0b6233d4ac14e64b64d": "2000000000000000000000",
+ "0x8eae29435598ba8f1c93428cdb3e2b4d31078e00": "2000000000000000000000",
+ "0x17fd9b551a98cb61c2e07fbf41d3e8c9a530cba5": "26989000000000000000",
+ "0xab3e78294ba886a0cfd5d3487fb3a3078d338d6e": "1970000000000000000000",
+ "0xbdf6e68c0cd7584080e847d72cbb23aad46aeb1d": "1970000000000000000000",
+ "0xf989346772995ec1906faffeba2a7fe7de9c6bab": "6685000000000000000000",
+ "0xdc5f5ad663a6f263327d64cac9cb133d2c960597": "2000000000000000000000",
+ "0x68fe1357218d095849cd579842c4aa02ff888d93": "2000000000000000000000",
+ "0xe09c68e61998d9c81b14e4ee802ba7adf6d74cdb": "4000000000000000000000",
+ "0x890fe11f3c24db8732d6c2e772e2297c7e65f139": "62980000000000000000000",
+ "0xa76929890a7b47fb859196016c6fdd8289ceb755": "5000000000000000000000",
+ "0x2dc79d6e7f55bce2e2d0c02ad07ceca8bb529354": "1580000000000000000000",
+ "0x19687daa39c368139b6e7be60dc1753a9f0cbea3": "8000000000000000000000",
+ "0xc69be440134d6280980144a9f64d84748a37f349": "715000000000000000000",
+ "0x3d8d0723721e73a6c0d860aa0557abd14c1ee362": "5000000000000000000000",
+ "0x2b241f037337eb4acc61849bd272ac133f7cdf4b": "378000000000000000000000",
+ "0x24b95ebef79500baa0eda72e77f877415df75c33": "910000000000000000000",
+ "0x106ed5c719b5261477890425ae7551dc59bd255c": "11979600000000000000000",
+ "0x5b2e2f1618552eab0db98add55637c2951f1fb19": "12000000000000000000000",
+ "0x403145cb4ae7489fcc90cd985c6dc782b3cc4e44": "5999800000000000000000",
+ "0xe8be24f289443ee473bc76822f55098d89b91cc5": "2000000000000000000000",
+ "0xf6bc37b1d2a3788d589b6de212dc1713b2f6e78e": "5000000000000000000000",
+ "0x67fc527dce1785f0fb8bc7e518b1c669f7ecdfb5": "240000000000000000000",
+ "0x6580b1bc94390f04b397bd73e95d96ef11eaf3a8": "20000000000000000000",
+ "0x98bf4af3810b842387db70c14d46099626003d10": "4000000000000000000000",
+ "0x17993d312aa1106957868f6a55a5e8f12f77c843": "450065000000000000000",
+ "0x0729b4b47c09eb16158464c8aa7fd9690b438839": "1999800000000000000000",
+ "0xae70e69d2c4a0af818807b1a2705f79fd0b5dbc4": "985000000000000000000",
+ "0x38b50146e71916a5448de12a4d742135dcf39833": "32200000000000000000000",
+ "0x38439aaa24e3636f3a18e020ea1da7e145160d86": "2600000000000000000000",
+ "0x54b4429b182f0377be7e626939c5db6440f75d7a": "1970000000000000000000",
+ "0x7179726f5c71ae1b6d16a68428174e6b34b23646": "7353500000000000000000",
+ "0xc2ee91d3ef58c9d1a589844ea1ae3125d6c5ba69": "970000000000000000000",
+ "0x912304118b80473d9e9fe3ee458fbe610ffda2bb": "200000000000000000000",
+ "0x3308b03466c27a17dfe1aafceb81e16d2934566f": "17000000000000000000000",
+ "0x10346414bec6d3dcc44e50e54d54c2b8c3734e3e": "4000000000000000000000",
+ "0x4fee50c5f988206b09a573469fb1d0b42ebb6dce": "2009400000000000000000",
+ "0x9ece1400800936c7c6485fcdd3626017d09afbf6": "310000000000000000000",
+ "0xddf3ad76353810be6a89d731b787f6f17188612b": "20000000000000000000000",
+ "0x72402300e81d146c2e644e2bbda1da163ca3fb56": "7000000000000000000000",
+ "0xbb4b4a4b548070ff41432c9e08a0ca6fa7bc9f76": "850000000000000000000",
+ "0xc3dd58903886303b928625257ae1a013d71ae216": "2000000000000000000000",
+ "0xca6c818befd251361e02744068be99d8aa60b84a": "6000000000000000000000",
+ "0xb8d2ddc66f308c0158ae3ccb7b869f7d199d7b32": "844800000000000000000",
+ "0x8e486a0442d171c8605be348fee57eb5085eff0d": "4000000000000000000000",
+ "0xa807104f2703d679f8deafc442befe849e42950b": "2000000000000000000000",
+ "0xbb61a04bffd57c10470d45c39103f64650347616": "1000000000000000000000",
+ "0xd1c45954a62b911ad701ff2e90131e8ceb89c95c": "1394000000000000000000",
+ "0x5e65458be964ae449f71773704979766f8898761": "528600000000000000000",
+ "0xf9b37825f03073d31e249378c30c795c33f83af2": "200152000000000000000",
+ "0xe309974ce39d60aadf2e69673251bf0e04760a10": "254030000000000000000",
+ "0xd541ac187ad7e090522de6da3213e9a7f4439673": "2000000000000000000000",
+ "0xf33efc6397aa65fb53a8f07a0f893aae30e8bcee": "2304850000000000000000",
+ "0xd2f1998e1cb1580cec4f6c047dcd3dcec54cf73c": "200000000000000000000",
+ "0x0ed76c2c3b5d50ff8fb50b3eeacd681590be1c2d": "100000000000000000000",
+ "0x637d67d87f586f0a5a479e20ee13ea310a10b647": "48300000000000000000000",
+ "0x1a5ee533acbfb3a2d76d5b685277b796c56a052b": "2000000000000000000000",
+ "0x323fca5ed77f699f9d9930f5ceeff8e56f59f03c": "1337000000000000000000",
+ "0xa5fe2ce97f0e8c3856be0de5f4dcb2ce5d389a16": "22892000000000000000",
+ "0x93258255b37c7f58f4b10673a932dd3afd90f4f2": "1000000000000000000000",
+ "0x950fe9c6cad50c18f11a9ed9c45740a6180612d0": "8000000000000000000000",
+ "0xee31167f9cc93b3c6465609d79db0cde90e8484c": "2000000000000000000000",
+ "0x6ebb5e6957aa821ef659b6018a393a504cae4450": "2000000000000000000000",
+ "0xbe305a796e33bbf7f9aeae6512959066efda1010": "10880000000000000000000",
+ "0x537f9d4d31ef70839d84b0d9cdb72b9afedbdf35": "70000000000000000000000",
+ "0xfe9e1197d7974a7648dcc7a03112a88edbc9045d": "4925000000000000000000",
+ "0x99f77f998b20e0bcdcd9fc838641526cf25918ef": "1790000000000000000000",
+ "0x76ffc157ad6bf8d56d9a1a7fddbc0fea010aabf4": "1000000000000000000000",
+ "0xdefe9141f4704599159d7b223de42bffd80496b3": "100000000000000000000",
+ "0x7b1bf53a9cbe83a7dea434579fe72aac8d2a0cd0": "199800000000000000000",
+ "0x23ccc3c6acd85c2e460c4ffdd82bc75dc849ea14": "4000000000000000000000",
+ "0x9f86a066edb61fcb5856de93b75c8c791864b97b": "2000000000000000000000",
+ "0x871b8a8b51dea1989a5921f13ec1a955a515ad47": "8000000000000000000000",
+ "0x4efcd9c79fb4334ca6247b0a33bd9cc33208e272": "1337000000000000000000",
+ "0x35ac1d3ed7464fa3db14e7729213ceaa378c095e": "1520000000000000000000",
+ "0xc69d663c8d60908391c8d236191533fdf7775613": "485000000000000000000",
+ "0xc2ed5ffdd1add855a2692fe062b5d618742360d4": "1200000000000000000000",
+ "0x454f0141d721d33cbdc41018bd01119aa4784818": "6000000000000000000000",
+ "0x6c8687e3417710bb8a93559021a1469e6a86bc77": "11126675000000000000000",
+ "0xec5b198a00cfb55a97b5d53644cffa8a04d2ab45": "2000000000000000000000",
+ "0xcd59f3dde77e09940befb6ee58031965cae7a336": "10000000000000000000000",
+ "0x8eebec1a62c08b05a7d1d59180af9ff0d18e3f36": "500000000000000000000",
+ "0x92a971a739799f8cb48ea8475d72b2d2474172e6": "3940000000000000000000",
+ "0xbed4649df646e2819229032d8868556fe1e053d3": "18200000000000000000",
+ "0xc50fe415a641b0856c4e75bf960515441afa358d": "2000000000000000000000",
+ "0x91f516146cda20281719978060c6be4149067c88": "2000000000000000000000",
+ "0x54a1370116fe22099e015d07cd2669dd291cc9d1": "20000000000000000000",
+ "0x80c04efd310f440483c73f744b5b9e64599ce3ec": "1200000000000000000000",
+ "0xa8914c95b560ec13f140577338c32bcbb77d3a7a": "180000000000000000000",
+ "0xe3c812737ac606baf7522ad817428a36050e7a34": "1940000000000000000000",
+ "0x6d1456fff0104ee844a3314737843338d24cd66c": "141840000000000000000",
+ "0x0e6ece99111cad1961c748ed3df51edd69d2a3b1": "100000000000000000000000",
+ "0x019d709579ff4bc09fdcdde431dc1447d2c260bc": "20000000000000000000",
+ "0xebff84bbef423071e604c361bba677f5593def4e": "10000000000000000000000",
+ "0xe10c540088113fa6ec00b4b2c8824f8796e96ec4": "236400000000000000000000",
+ "0xe03220c697bcd28f26ef0b74404a8beb06b2ba7b": "8000000000000000000000",
+ "0xe69a6cdb3a8a7db8e1f30c8b84cd73bae02bc0f8": "16915503000000000000000",
+ "0xe5fb31a5caee6a96de393bdbf89fbe65fe125bb3": "1000000000000000000000",
+ "0x030fb3401f72bd3418b7d1da75bf8c519dd707dc": "3000000000000000000000",
+ "0x1c751e7f24df9d94a637a5dedeffc58277b5db19": "3220000000000000000000",
+ "0xbded7e07d0711e684de65ac8b2ab57c55c1a8645": "591000000000000000000",
+ "0xdd7ff441ba6ffe3671f3c0dabbff1823a5043370": "2000000000000000000000",
+ "0xb55474ba58f0f2f40e6cbabed4ea176e011fcad6": "1970000000000000000000",
+ "0xb92427ad7578b4bfe20a9f63a7c5506d5ca12dc8": "2000000000000000000000",
+ "0x91a8baaed012ea2e63803b593d0d0c2aab4c5b0a": "1500000000000000000000",
+ "0xa97e072144499fe5ebbd354acc7e7efb58985d08": "2674000000000000000000",
+ "0x75c2ffa1bef54919d2097f7a142d2e14f9b04a58": "2673866000000000000000",
+ "0x53faf165be031ec18330d9fce5bd1281a1af08db": "140000000000000000000",
+ "0x055ab658c6f0ed4f875ed6742e4bc7292d1abbf0": "83500000000000000000",
+ "0x6f18ec767e320508195f1374500e3f2e125689ff": "1000000000000000000000",
+ "0x90fc537b210658660a83baa9ac4a8402f65746a8": "1880000000000000000000",
+ "0x34664d220fa7f37958024a3332d684bcc6d4c8bd": "10000000000000000000000",
+ "0x15acb61568ec4af7ea2819386181b116a6c5ee70": "31000000000000000000000",
+ "0x69d98f38a3ba3dbc01fa5c2c1427d862832f2f70": "100000000000000000000000",
+ "0xece1152682b7598fe2d1e21ec15533885435ac85": "4000000000000000000000",
+ "0xf618d9b104411480a863e623fc55232d1a4f48aa": "265793000000000000000",
+ "0xf9debaecb5f339beea4894e5204bfa340d067f25": "1665000000000000000000",
+ "0x5e731b55ced452bb3f3fe871ddc3ed7ee6510a8f": "3000000000000000000000",
+ "0x67df242d240dd4b8071d72f8fcf35bb3809d71e8": "4000000000000000000000",
+ "0xc4cf930e5d116ab8d13b9f9a7ec4ab5003a6abde": "320000000000000000000",
+ "0x01a25a5f5af0169b30864c3be4d7563ccd44f09e": "1430000000000000000000",
+ "0x7f6efb6f4318876d2ee624e27595f44446f68e93": "1550000000000000000000",
+ "0x82249fe70f61c6b16f19a324840fdc020231bb02": "9504014000000000000000",
+ "0x205237c4be146fba99478f3a7dad17b09138da95": "2000000000000000000000",
+ "0xfd1fb5a89a89a721b8797068fbc47f3e9d52e149": "236400000000000000000",
+ "0xe47fbaed99fc209962604ebd20e240f74f4591f1": "2000000000000000000000",
+ "0xa24c3ab62181e9a15b78c4621e4c7c588127be26": "162410000000000000000",
+ "0xb6cd7432d5161be79768ad45de3e447a07982063": "4000000000000000000000",
+ "0x32a70691255c9fc9791a4f75c8b81f388e0a2503": "985000000000000000000",
+ "0x562f16d79abfcec3943e34b20f05f97bdfcda605": "4000000000000000000000",
+ "0xdbc66965e426ff1ac87ad6eb78c1d95271158f9f": "18200000000000000000",
+ "0x7e87863ec43a481df04d017762edcb5caa629b5a": "39400000000000000000",
+ "0x587d6849b168f6c3332b7abae7eb6c42c37f48bf": "880000000000000000000",
+ "0x721158be5762b119cc9b2035e88ee4ee78f29b82": "10000000000000000000000",
+ "0x84b91e2e2902d05e2b591b41083bd7beb2d52c74": "9848621000000000000000",
+ "0x632cecb10cfcf38ec986b43b8770adece9200221": "20000000000000000000",
+ "0xc34e3ba1322ed0571183a24f94204ee49c186641": "58200000000000000000",
+ "0xae78bb849139a6ba38ae92a09a69601cc4cb62d1": "500000000000000000000",
+ "0x5ce0b6862cce9162e87e0849e387cb5df4f9118c": "1670000000000000000000",
+ "0xf52c0a7877345fe0c233bb0f04fd6ab18b6f14ba": "400440000000000000000000",
+ "0xe016dc138e25815b90be3fe9eee8ffb2e105624f": "500000000000000000000",
+ "0x5789d01db12c816ac268e9af19dc0dd6d99f15df": "200000000000000000000",
+ "0xd8b77db9b81bbe90427b62f702b201ffc29ff618": "930200000000000000000",
+ "0x5dff811dad819ece3ba602c383fb5dc64c0a3a48": "186000000000000000000",
+ "0xaf3087e62e04bf900d5a54dc3e946274da92423b": "20000000000000000000",
+ "0x8c1023fde1574db8bb54f1739670157ca47da652": "6969382000000000000000",
+ "0xbb3b010b18e6e2be1135871026b7ba15ea0fde24": "10044000000000000000000",
+ "0xcabdaf354f4720a466a764a528d60e3a482a393c": "1000000000000000000000",
+ "0x94bbc67d13f89ebca594be94bc5170920c30d9f3": "80200000000000000000",
+ "0x3275496fd4dd8931fd69fb0a0b04c4d1ff879ef5": "446000000000000000000",
+ "0x281250a29121270a4ee5d78d24feafe82c70ba3a": "1000000000000000000000",
+ "0x590ccb5911cf78f6f622f535c474375f4a12cfcf": "20000000000000000000000",
+ "0x542e8096bafb88162606002e8c8a3ed19814aeac": "2000000000000000000000",
+ "0xa65426cff378ed23253513b19f496de45fa7e18f": "7200000000000000000000",
+ "0x4aa693b122f314482a47b11cc77c68a497876162": "1970000000000000000000",
+ "0xd9b783d31d32adc50fa3eacaa15d92b568eaeb47": "34010000000000000000000",
+ "0x068e655766b944fb263619658740b850c94afa31": "35200000000000000000",
+ "0x9e23c5e4b782b00a5fadf1aead87dacf5b0367a1": "20000000000000000000",
+ "0xbf17f397f8f46f1bae45d187148c06eeb959fa4d": "1001440000000000000000",
+ "0x8578e10212ca14ff0732a8241e37467db85632a9": "6000000000000000000000",
+ "0x2cb5495a505336c2465410d1cae095b8e1ba5cdd": "20000000000000000000000",
+ "0x695b0f5242753701b264a67071a2dc880836b8db": "16400000000000000000",
+ "0xf2edde37f9a8c39ddea24d79f4015757d06bf786": "100000000000000000000000",
+ "0x480f31b989311e4124c6a7465f5a44094d36f9d0": "1025000000000000000000",
+ "0xcf157612764e0fd696c8cb5fba85df4c0ddc3cb0": "30000000000000000000000",
+ "0x27521deb3b6ef1416ea4c781a2e5d7b36ee81c61": "2000000000000000000000",
+ "0x6efd90b535e00bbd889fda7e9c3184f879a151db": "10100000000000000000000",
+ "0xb635a4bc71fb28fdd5d2c322983a56c284426e69": "170000000000000000000",
+ "0xa17c9e4323069518189d5207a0728dcb92306a3f": "1000000000000000000000",
+ "0x6af940f63ec9b8d876272aca96fef65cdacecdea": "3000000000000000000000",
+ "0x469358709332c82b887e20bcddd0220f8edba7d0": "17300000000000000000000",
+ "0xa257ad594bd88328a7d90fc0a907df95eecae316": "520510000000000000000",
+ "0x6f051666cb4f7bd2b1907221b829b555d7a3db74": "1760000000000000000000",
+ "0x46bfc5b207eb2013e2e60f775fecd71810c5990c": "1550000000000000000000",
+ "0x62b9081e7710345e38e02e16449ace1b85bcfc4e": "910000000000000000000",
+ "0xbc73f7b1ca3b773b34249ada2e2c8a9274cc17c2": "2000000000000000000000",
+ "0x1adaf4abfa867db17f99af6abebf707a3cf55df6": "6000000000000000000000",
+ "0x8d629c20608135491b5013f1002586a0383130e5": "1370000000000000000000",
+ "0x38e46de4453c38e941e7930f43304f94bb7b2be8": "2005500000000000000000",
+ "0x3485f621256433b98a4200dad857efe55937ec98": "2000000000000000000000",
+ "0x775c10c93e0db7205b2643458233c64fc33fd75b": "2000000000000000000000",
+ "0x7c4401ae98f12ef6de39ae24cf9fc51f80eba16b": "200000000000000000000",
+ "0x17b807afa3ddd647e723542e7b52fee39527f306": "400010000000000000000",
+ "0x0ab366e6e7d5abbce6b44a438d69a1cabb90d133": "320000000000000000000",
+ "0x194ffe78bbf5d20dd18a1f01da552e00b7b11db1": "7000000000000000000000",
+ "0xc45d47ab0c9aa98a5bd62d16223ea2471b121ca4": "593640000000000000000",
+ "0x2487c3c4be86a2723d917c06b458550170c3edba": "1000000000000000000000",
+ "0xec4d08aa2e47496dca87225de33f2b40a8a5b36f": "158000000000000000000",
+ "0xaaa8defe11e3613f11067fb983625a08995a8dfc": "200000000000000000000",
+ "0x50bb67c8b8d8bd0f63c4760904f2d333f400aace": "2000000000000000000000",
+ "0x1227e10a4dbf9caca31b1780239f557615fc35c1": "200000000000000000000",
+ "0x44a8989e32308121f72466978db395d1f76c3a4b": "7236900000000000000000",
+ "0x59569a21d28fba4bda37753405a081f2063da150": "4000000000000000000000",
+ "0xc3756bcdcc7eec74ed896adfc335275930266e08": "6000000000000000000000",
+ "0xce3a61f0461b00935e85fa1ead82c45e5a64d488": "500000000000000000000",
+ "0x012f396a2b5eb83559bac515e5210df2c8c362ba": "200000000000000000000",
+ "0x93bc7d9a4abd44c8bbb8fe8ba804c61ad8d6576c": "3999922000000000000000",
+ "0xe20bb9f3966419e14bbbaaaa6789e92496cfa479": "3465116000000000000000",
+ "0x9eef442d291a447d74c5d253c49ef324eac1d8f0": "3420000000000000000000",
+ "0xdb6c2a73dac7424ab0d031b66761122566c01043": "3000000000000000000000",
+ "0x704d243c2978e46c2c86adbecd246e3b295ff633": "2012000000000000000000",
+ "0xd2ff672016f63b2f85398f4a6fedbb60a50d3cce": "342500000000000000000",
+ "0xd2051cb3cb6704f0548cc890ab0a19db3415b42a": "334000000000000000000",
+ "0x1111e5dbf45e6f906d62866f1708101788ddd571": "1300200000000000000000",
+ "0x6a686bf220b593deb9b7324615fb9144ded3f39d": "1460000000000000000000",
+ "0x911feea61fe0ed50c5b9e5a0d66071399d28bdc6": "60000000000000000000",
+ "0x3881defae1c07b3ce04c78abe26b0cdc8d73f010": "200000000000000000000",
+ "0xea94f32808a2ef8a9bf0861d1d2404f7b7be258a": "20000000000000000000",
+ "0x2eef6b1417d7b10ecfc19b123a8a89e73e526c58": "600000000000000000000",
+ "0xdd8af9e7765223f4446f44d3d509819a3d3db411": "10000000000000000000000",
+ "0x2efc4c647dac6acac35577ad221758fef6616faa": "8000000000000000000000",
+ "0x1547b9bf7ad66274f3413827231ba405ee8c88c1": "17300000000000000000000",
+ "0x250a40cef3202397f240469548beb5626af4f23c": "92500000000000000000",
+ "0xc175be3194e669422d15fee81eb9f2c56c67d9c9": "200000000000000000000",
+ "0xc9e02608066828848aeb28c73672a12925181f4d": "500038000000000000000",
+ "0x8229ceb9f0d70839498d44e6abed93c5ca059f5d": "123300000000000000000000",
+ "0x39f198331e4b21c1b760a3155f4ab2fe00a74619": "2000000000000000000000",
+ "0x3ffcb870d4023d255d5167d8a507cefc366b68ba": "649400000000000000000",
+ "0x00dae27b350bae20c5652124af5d8b5cba001ec1": "40000000000000000000",
+ "0xfc5500825105cf712a318a5e9c3bfc69c89d0c12": "4000000000000000000000",
+ "0x1ed8bb3f06778b039e9961d81cb71a73e6787c8e": "2000000000000000000000",
+ "0x530ffac3bc3412e2ec0ea47b7981c770f5bb2f35": "133700000000000000000",
+ "0x5f344b01c7191a32d0762ac188f0ec2dd460911d": "1000000000000000000000",
+ "0x5cfa9877f719c79d9e494a08d1e41cf103fc87c9": "200000000000000000000",
+ "0xf6eaac7032d492ef17fd6095afc11d634f56b382": "500038000000000000000",
+ "0x962c0dec8a3d464bf39b1215eafd26480ae490cd": "2001680000000000000000",
+ "0x262a8bfd7d9dc5dd3ad78161b6bb560824373655": "1169820000000000000000",
+ "0x9b4824ff9fb2abda554dee4fb8cf549165570631": "20000000000000000000",
+ "0xbb3b9005f46fd2ca3b30162599928c77d9f6b601": "8000014000000000000000",
+ "0xf7dc251196fbcbb77c947d7c1946b0ff65021cea": "1000000000000000000000",
+ "0xaf1148ef6c8e103d7530efc91679c9ac27000993": "200000000000000000000",
+ "0x0bb2650ea01aca755bc0c017b64b1ab5a66d82e3": "1337000000000000000000",
+ "0x0cda12bf72d461bbc479eb92e6491d057e6b5ad1": "10000000000000000000000",
+ "0x4e5b77f9066159e615933f2dda7477fa4e47d648": "200000000000000000000",
+ "0x391161b0e43c302066e8a68d2ce7e199ecdb1d57": "4000000000000000000000",
+ "0xc7e330cd0c890ac99fe771fcc7e7b009b7413d8a": "4000000000000000000000",
+ "0xd4b38a5fdb63e01714e9801db47bc990bd509183": "5999000000000000000000",
+ "0xbc0f98598f88056a26339620923b8f1eb074a9fd": "200000000000000000000",
+ "0xdbc59ed88973dead310884223af49763c05030f1": "20000000000000000000",
+ "0x0f85e42b1df321a4b3e835b50c00b06173968436": "985000000000000000000",
+ "0xd7788ef28658aa06cc53e1f3f0de58e5c371be78": "6685000000000000000000",
+ "0xecd276af64c79d1bd9a92b86b5e88d9a95eb88f8": "20000000000000000000",
+ "0x81c9e1aee2d3365d53bcfdcd96c7c538b0fd7eec": "1820000000000000000000",
+ "0x5d39ef9ea6bdfff15d11fe91f561a6f9e31f5da5": "2000000000000000000000",
+ "0x99878f9d6e0a7ed9aec78297b73879a80195afe0": "3980000000000000000000",
+ "0x7294c918b1aefb4d25927ef9d799e71f93a28e85": "197000000000000000000",
+ "0xa33f70da7275ef057104dfa7db64f472e9f5d553": "80220000000000000000",
+ "0x255bdd6474cc8262f26a22c38f45940e1ceea69b": "4000000000000000000000",
+ "0x52f8b509fee1a874ab6f9d87367fbeaf15ac137f": "1000000000000000000000",
+ "0xe2728a3e8c2aaac983d05dc6877374a8f446eee9": "197600000000000000000",
+ "0xed0206cb23315128f8caff26f6a30b985467d022": "40000000000000000000000",
+ "0x87cf36ad03c9eae9053abb5242de9117bb0f2a0b": "500000000000000000000",
+ "0xa929c8bd71db0c308dac06080a1747f21b1465aa": "500000000000000000000",
+ "0x9da6e075989c7419094cc9f6d2e49393bb199688": "11100000000000000000000",
+ "0x763eece0b08ac89e32bfa4bece769514d8cb5b85": "4000000000000000000000",
+ "0x5df3277ca85936c7a0d2c0795605ad25095e7159": "2000000000000000000000",
+ "0x7163758cbb6c4c525e0414a40a049dcccce919bb": "200000000000000000000",
+ "0x14cdddbc8b09e6675a9e9e05091cb92238c39e1e": "5100000000000000000000",
+ "0xb3b7f493b44a2c8d80ec78b1cdc75a652b73b06c": "2000000000000000000000",
+ "0xc69b855539ce1b04714728eec25a37f367951de7": "2000000000000000000000",
+ "0x052eab1f61b6d45517283f41d1441824878749d0": "4000000000000000000000",
+ "0x515651d6db4faf9ecd103a921bbbbe6ae970fdd4": "20000000000000000000000",
+ "0xc7aff91929797489555a2ff1d14d5c695a108355": "1000000000000000000000",
+ "0xd7ca7fdcfebe4588eff5421d1522b61328df7bf3": "4001070000000000000000",
+ "0xeefba12dfc996742db790464ca7d273be6e81b3e": "1000000000000000000000",
+ "0xebaa216de9cc5a43031707d36fe6d5bedc05bdf0": "1969606000000000000000",
+ "0x559194304f14b1b93afe444f0624e053c23a0009": "400000000000000000000",
+ "0x4ecc19948dd9cd87b4c7201ab48e758f28e7cc76": "500200000000000000000",
+ "0xf224eb900b37b4490eee6a0b6420d85c947d8733": "970000000000000000000",
+ "0x97810bafc37e84306332aacb35e92ad911d23d24": "1000000000000000000000",
+ "0xbd67d2e2f82da8861341bc96a2c0791fddf39e40": "200014000000000000000",
+ "0x1b6495891240e64e594493c2662171db5e30ce13": "172400000000000000000",
+ "0x00bdd4013aa31c04616c2bc9785f2788f915679b": "13400000000000000000",
+ "0xc6ae287ddbe1149ba16ddcca4fe06aa2eaa988a9": "400000000000000000000",
+ "0xb7c9f12b038e73436d17e1c12ffe1aeccdb3f58c": "540000000000000000000",
+ "0xc1b500011cfba95d7cd636e95e6cbf6167464b25": "200000000000000000000",
+ "0x39e0db4d60568c800b8c5500026c2594f5768960": "1000000000000000000000",
+ "0x40e3c283f7e24de0410c121bee60a5607f3e29a6": "1000000000000000000000",
+ "0x2f7d3290851be5c6b4b43f7d4574329f61a792c3": "100000000000000000000",
+ "0xc33ece935a8f4ef938ea7e1bac87cb925d8490ca": "33122000000000000000000",
+ "0x57bddf078834009c89d88e6282759dc45335b470": "2148000000000000000000",
+ "0x50ad187ab21167c2b6e78be0153f44504a07945e": "100076000000000000000",
+ "0x5bd24aac3612b20c609eb46779bf95698407c57c": "1970000000000000000000",
+ "0x16526c9edf943efa4f6d0f0bae81e18b31c54079": "985000000000000000000",
+ "0x4c6a9dc2cab10abb2e7c137006f08fecb5b779e1": "499000000000000000000",
+ "0x02c9f7940a7b8b7a410bf83dc9c22333d4275dd3": "5000000000000000000000",
+ "0xb9fd3833e88e7cf1fa9879bdf55af4b99cd5ce3f": "1000000000000000000000",
+ "0x7e268f131ddf687cc325c412f78ba961205e9112": "16000600000000000000000",
+ "0x180478a655d78d0f3b0c4f202b61485bc4002fd5": "2000000000000000000000",
+ "0xed4014538cee664a2fbcb6dc669f7ab16d0ba57c": "200000000000000000000",
+ "0xf63a579bc3eac2a9490410128dbcebe6d9de8243": "1490000000000000000000",
+ "0x5d822d9b3ef4b502627407da272f67814a6becd4": "20000000000000000000",
+ "0xeb52ab10553492329c1c54833ae610f398a65b9d": "152000000000000000000",
+ "0x63340a57716bfa63eb6cd133721202575bf796f0": "209967000000000000000",
+ "0x933bf33f8299702b3a902642c33e0bfaea5c1ca3": "15200000000000000000",
+ "0x25bc49ef288cd165e525c661a812cf84fbec8f33": "338464000000000000000",
+ "0xc8231ba5a411a13e222b29bfc1083f763158f226": "1000090000000000000000",
+ "0x6c15ec3520bf8ebbc820bd0ff19778375494cf9d": "2005500000000000000000",
+ "0xaaced8a9563b1bc311dbdffc1ae7f57519c4440c": "2000000000000000000000",
+ "0xd90f3009db437e4e11c780bec8896f738d65ef0d": "4000000000000000000000",
+ "0x5603241eb8f08f721e348c9d9ad92f48e390aa24": "200000000000000000000",
+ "0x53cec6c88092f756efe56f7db11228a2db45b122": "4000000000000000000000",
+ "0x194cebb4929882bf3b4bf9864c2b1b0f62c283f9": "571300000000000000000",
+ "0x4be8628a8154874e048d80c142181022b180bcc1": "60000000000000000000",
+ "0x5fd973af366aa5157c54659bcfb27cbfa5ac15d6": "4000000000000000000000",
+ "0x303139bc596403d5d3931f774c66c4ba467454db": "1699830000000000000000",
+ "0x87584a3f613bd4fac74c1e780b86d6caeb890cb2": "1700000000000000000000",
+ "0x77f4e3bdf056883cc87280dbe640a18a0d02a207": "193806000000000000000",
+ "0x4de3fe34a6fbf634c051997f47cc7f48791f5824": "1999000000000000000000",
+ "0xc45a1ca1036b95004187cdac44a36e33a94ab5c3": "254800000000000000000",
+ "0x65d33eb39cda6453b19e61c1fe4db93170ef9d34": "13370000000000000000",
+ "0xf65616be9c8b797e7415227c9138faa0891742d7": "790000000000000000000",
+ "0xe17812f66c5e65941e186c46922b6e7b2f0eeb46": "1820000000000000000000",
+ "0xd47f50df89a1cff96513bef1b2ae3a2971accf2c": "840000000000000000000",
+ "0x8ed1528b447ed4297902f639c514d0944a88f8c8": "198800000000000000000",
+ "0xa4fb14409a67b45688a8593e5cc2cf596ced6f11": "1790000000000000000000",
+ "0x855d9aef2c39c6230d09c99ef6494989abe68785": "161000000000000000000",
+ "0x778c43d11afe3b586ff374192d96a7f23d2b9b7f": "2577139000000000000000",
+ "0xe3ece1f632711d13bfffa1f8f6840871ee58fb27": "4000000000000000000000",
+ "0xbeb3358c50cf9f75ffc76d443c2c7f55075a0589": "2674000000000000000000",
+ "0xf156dc0b2a981e5b55d3f2f03b8134e331dbadb7": "100000000000000000000",
+ "0xeb9cc9fe0869d2dab52cc7aae8fd57adb35f9feb": "1966000000000000000000",
+ "0x2467c6a5c696ede9a1e542bf1ad06bcc4b06aca0": "18500000000000000000",
+ "0xec75b4a47513120ba5f86039814f1998e3817ac3": "178756000000000000000",
+ "0x9c3d0692ceeef80aa4965ceed262ffc7f069f2dc": "200000000000000000000",
+ "0xe05029aceb0778675bef1741ab2cd2931ef7c84b": "5000057000000000000000",
+ "0x41d3b731a326e76858baa5f4bd89b57b36932343": "394000000000000000000",
+ "0xc346cb1fbce2ab285d8e5401f42dd7234d37e86d": "83500000000000000000",
+ "0x45f4fc60f08eaca10598f0336329801e3c92cb46": "200000000000000000000",
+ "0xf04a6a379708b9428d722aa2b06b77e88935cf89": "300000000000000000000",
+ "0x232832cd5977e00a4c30d0163f2e24f088a6cb09": "3000000000000000000000",
+ "0xd2ac0d3a58605e1d0f0eb3de25b2cad129ed6058": "4000000000000000000000",
+ "0xa356551bb77d4f45a6d7e09f0a089e79cca249cb": "340000000000000000000",
+ "0xb50c9f5789ae44e2dce017c714caf00c830084c2": "394000000000000000000",
+ "0x21fd6c5d97f9c600b76821ddd4e776350fce2be0": "1999946000000000000000",
+ "0xf0d5c31ccb6cbe30c7c9ea19f268d159851f8c9c": "16700000000000000000000",
+ "0xab7091932e4bc39dbb552380ca934fd7166d1e6e": "3340000000000000000000",
+ "0xacd8dd91f714764c45677c63d852e56eb9eece2e": "2000000000000000000000",
+ "0x57d032a43d164e71aa2ef3ffd8491b0a4ef1ea5b": "2000000000000000000000",
+ "0x5af46a25ac09cb73616b53b14fb42ff0a51cddb2": "4000000000000000000000",
+ "0x1ea6bf2f15ae9c1dbc64daa7f8ea4d0d81aad3eb": "4200000000000000000000",
+ "0x03337012ae1d7ff3ee7f697c403e7780188bf0ef": "200000000000000000000",
+ "0x32eb64be1b5dede408c6bdefbe6e405c16b7ed02": "1970000000000000000000",
+ "0x22e2488e2da26a49ae84c01bd54b21f2947891c6": "1730000000000000000000",
+ "0xbe98a77fd41097b34f59d7589baad021659ff712": "900000000000000000000",
+ "0xdda4ed2a58a8dd20a73275347b580d71b95bf99a": "399000000000000000000",
+ "0x671110d96aaff11523cc546bf9940eedffb2faf7": "4000000000000000000000",
+ "0x5d71799c8df3bccb7ee446df50b8312bc4eb71c5": "200000000000000000000",
+ "0xae179a460db66326743d24e67523a57b246daf7f": "4722920000000000000000",
+ "0x198bfcf1b07ae308fa2c02069ac9dafe7135fb47": "20000000000000000000",
+ "0x4662a1765ee921842ddc88898d1dc8627597bd7e": "10000000000000000000000",
+ "0x783eec8aa5dac77b2e6623ed5198a431abbaee07": "440000000000000000000",
+ "0xed6643c0e8884b2d3211853785a08bf8f33ed29f": "1337000000000000000000",
+ "0x5cc7d3066d45d27621f78bb4b339473e442a860f": "9999908000000000000000",
+ "0x94ef8be45077c7d4c5652740de946a62624f713f": "100085000000000000000",
+ "0x2f853817afd3b8f3b86e9f60ee77b5d97773c0e3": "1451450000000000000000",
+ "0x3e0b8ed86ed669e12723af7572fbacfe829b1e16": "1499800000000000000000",
+ "0xfa68e0cb3edf51f0a6f211c9b2cb5e073c9bffe6": "291200000000000000000",
+ "0x2c234f505ca8dcc77d9b7e01d257c318cc19396d": "100000000000000000000",
+ "0xf3f24fc29e20403fc0e8f5ebbb553426f78270a2": "100000000000000000000",
+ "0x91546b79ecf69f936b5a561508b0d7e50cc5992f": "267400000000000000000",
+ "0x435443b81dfdb9bd8c6787bc2518e2d47e57c15f": "5968500000000000000000",
+ "0x3a06e3bb1edcfd0c44c3074de0bb606b049894a2": "10000000000000000000000",
+ "0x3a3108c1e680a33b336c21131334409d97e5adec": "20000000000000000000",
+ "0x2caf6bf4ec7d5a19c5e0897a5eeb011dcece4210": "139740000000000000000",
+ "0xf44f8551ace933720712c5c491cdb6f2f951736c": "4000000000000000000000",
+ "0x5bc1f95507b1018642e45cd9c0e22733b9b1a326": "100000000000000000000",
+ "0x94ca56de777fd453177f5e0694c478e66aff8a84": "500000000000000000000",
+ "0xafdd1b786162b8317e20f0e979f4b2ce486d765d": "20000000000000000000",
+ "0x3a805fa0f7387f73055b7858ca8519edd93d634f": "1850000000000000000000",
+ "0x8b36224c7356e751f0c066c35e3b44860364bfc2": "998987000000000000000",
+ "0xcfecbea07c27002f65fe534bb8842d0925c78402": "4000000000000000000000",
+ "0x482982ac1f1c6d1721feecd9b9c96cd949805055": "10000000000000000000000",
+ "0xaf880fc7567d5595cacce15c3fc14c8742c26c9e": "133700000000000000000",
+ "0xacc1c78786ab4d2b3b277135b5ba123e0400486b": "78800000000000000000",
+ "0x41f27e744bd29de2b0598f02a0bb9f98e681eaa4": "7760000000000000000000",
+ "0x09a025316f967fa8b9a1d60700063f5a68001caa": "38200000000000000000",
+ "0x391f20176d12360d724d51470a90703675594a4d": "1600000000000000000000",
+ "0xfe4d8403216fd571572bf1bdb01d00578978d688": "9850000000000000000000",
+ "0x900f0b8e35b668f81ef252b13855aa5007d012e7": "425000000000000000000",
+ "0xc35b95a2a3737cb8f0f596b34524872bd30da234": "7540000000000000000000",
+ "0x412a68f6c645559cc977fc4964047a201d1bb0e2": "50000000000000000000000",
+ "0xd3dad1b6d08d4581ccae65a8732db6ac69f0c69e": "6000000000000000000000",
+ "0x35855ec641ab9e081ed0c2a6dcd81354d0244a87": "1201897000000000000000",
+ "0x88015d7203c5e0224aeda286ed12f1a51b789333": "4999711000000000000000",
+ "0x251c12722c6879227992a304eb3576cd18434ea5": "2000000000000000000000",
+ "0x1f6f0030349752061c96072bc3d6eb3549208d6b": "23891000000000000000",
+ "0x86153063a1ae7f02f1a88136d4d69c7c5e3e4327": "1000000000000000000000",
+ "0x78355df0a230f83d032c703154414de3eedab557": "2000000000000000000000",
+ "0xc5b56cd234267c28e89c6f6b2266b086a12f970c": "4000000000000000000000",
+ "0x3e3cd3bec06591d6346f254b621eb41c89008d31": "993800000000000000000",
+ "0x378ea1dc8edc19bae82638029ea8752ce98bcfcd": "2000000000000000000000",
+ "0x67632046dcb25a54936928a96f423f3320cbed92": "2000000000000000000000",
+ "0xddbee6f094eae63420b003fb4757142aea6cd0fd": "2000000000000000000000",
+ "0xb555d00f9190cc3677aef314acd73fdc39399259": "2000000000000000000000",
+ "0xe230fe1bff03186d0219f15d4c481b7d59be286a": "36710000000000000000",
+ "0x3e4e9265223c9738324cf20bd06006d0073edb8c": "133700000000000000000",
+ "0x7450ff7f99eaa9116275deac68e428df5bbcd8b9": "2000000000000000000000",
+ "0x021f69043de88c4917ca10f1842897eec0589c7c": "1978760000000000000000",
+ "0x351787843505f8e4eff46566cce6a59f4d1c5fe7": "9250000000000000000000",
+ "0xebd37b256563e30c6f9289a8e2702f0852880833": "1999944000000000000000",
+ "0xed41e1a28f5caa843880ef4e8b08bd6c33141edf": "790174000000000000000",
+ "0x8d238e036596987643d73173c37b0ad06055b96c": "2089724000000000000000",
+ "0x478e524ef2a381d70c82588a93ca7a5fa9d51cbf": "254908000000000000000000",
+ "0x4419ac618d5dea7cdc6077206fb07dbdd71c1702": "4000000000000000000000",
+ "0xca25ff34934c1942e22a4e7bd56f14021a1af088": "197000000000000000000",
+ "0x5552f4b3ed3e1da79a2f78bb13e8ae5a68a9df3b": "1000000000000000000000",
+ "0x4354221e62dc09e6406436163a185ef06d114a81": "2000000000000000000000",
+ "0xca0432cb157b5179f02ebba5c9d1b54fec4d88ca": "1000000000000000000000",
+ "0x8a780ab87a9145fe10ed60fa476a740af4cab1d2": "334000000000000000000",
+ "0x4ff676e27f681a982d8fd9d20e648b3dce05e945": "2800000000000000000000",
+ "0x6c63fc85029a2654d79b2bea4de349e4524577c5": "660000000000000000000",
+ "0x1ac089c3bc4d82f06a20051a9d732dc0e734cb61": "700300000000000000000",
+ "0x4bf4479799ef82eea20943374f56a1bf54001e5e": "3940000000000000000000",
+ "0x08411652c871713609af0062a8a1281bf1bbcfd9": "1400000000000000000000",
+ "0xe1bfaa5a45c504428923c4a61192a55b1400b45d": "2674000000000000000000",
+ "0x5e1fbd4e58e2312b3c78d7aaaafa10bf9c3189e3": "40000000000000000000000",
+ "0xbb27c6a7f91075475ab229619040f804c8ec7a6a": "10000000000000000000000",
+ "0x5d8d31faa864e22159cd6f5175ccecc53fa54d72": "26980000000000000000000",
+ "0x2dd8eeef87194abc2ce7585da1e35b7cea780cb7": "999999000000000000000",
+ "0x0e1801e70b6262861b1134ccbc391f568afc92f7": "4000000000000000000000",
+ "0x61042b80fd6095d1b87be2f00f109fabafd157a6": "100000000000000000000",
+ "0xfb5518714cefc36d04865de5915ef0ff47dfe743": "2000000000000000000000",
+ "0xb5add1e7809f7d03069bfe883b0a932210be8712": "1000000000000000000000",
+ "0xc2e2d498f70dcd0859e50b023a710a6d4b2133bd": "1037130000000000000000",
+ "0x4ad047fae67ef162fe68fedbc27d3b65caf10c36": "1970000000000000000000",
+ "0x69cb3e2153998d86e5ee20c1fcd1a6baeeb2863f": "4000000000000000000000",
+ "0x683633010a88686bea5a98ea53e87997cbf73e69": "99960000000000000000",
+ "0x6cb11ecb32d3ce829601310636f5a10cf7cf9b5f": "20068370000000000000000",
+ "0xa613456996408af1c2e93e177788ab55895e2b32": "6366000000000000000000",
+ "0x8308ed0af7f8a3c1751fafc877b5a42af7d35882": "1000000000000000000000",
+ "0xe5edf8123f2403ce1a0299becf7aac744d075f23": "200200000000000000000",
+ "0x05665155cc49cbf6aabdd5ae92cbfaad82b8c0c1": "400000000000000000000",
+ "0x00b277b099a8e866ca0ec65bcb87284fd142a582": "1970000000000000000000",
+ "0x4b9e068fc4680976e61504912985fd5ce94bab0d": "668500000000000000000",
+ "0x12134e7f6b017bf48e855a399ca58e2e892fa5c8": "1000000000000000000000",
+ "0xdffcea5421ec15900c6ecfc777184e140e209e24": "19980000000000000000",
+ "0x2132c0516a2e17174ac547c43b7b0020d1eb4c59": "985000000000000000000",
+ "0xd39a5da460392b940b3c69bc03757bf3f2e82489": "7019250000000000000000",
+ "0x66c8331efe7198e98b2d32b938688e3241d0e24f": "9620000000000000000000",
+ "0xbdca2a0ff34588af625fa8e28fc3015ab5a3aa00": "2339800000000000000000",
+ "0x7dfc342dffcf45dfee74f84c0995397bd1a63172": "250000000000000000000",
+ "0xa202547242806f6e70e74058d6e5292defc8c8d4": "2002000000000000000000",
+ "0x3bbc13d04accc0707aebdcaef087d0b87e0b5ee3": "3520000000000000000000",
+ "0xbe5cba8d37427986e8ca2600e858bb03c359520f": "2955000000000000000000",
+ "0x4174fa1bc12a3b7183cbabb77a0b59557ba5f1db": "2000000000000000000000",
+ "0x9eb3a7cb5e6726427a3a361cfa8d6164dbd0ba16": "804000000000000000000",
+ "0x25e661c939863acc044e6f17b5698cce379ec3cc": "1370000000000000000000",
+ "0x24bd5904059091d2f9e12d6a26a010ca22ab14e8": "1880000000000000000000",
+ "0xc96626728aaa4c4fb3d31c26df3af310081710d1": "3340000000000000000000",
+ "0x0fb5d2c673bfb1ddca141b9894fd6d3f05da6720": "100000000000000000000",
+ "0x2de31afd189a13a76ff6fe73ead9f74bb5c4a629": "6000000000000000000000",
+ "0xbd09126c891c4a83068059fe0e15796c4661a9f4": "800000000000000000000",
+ "0x496f5843f6d24cd98d255e4c23d1e1f023227545": "1754143000000000000000",
+ "0x540cf23dd95c4d558a279d778d2b3735b3164191": "10000000000000000000000",
+ "0x9b5ec18e8313887df461d2902e81e67a8f113bb1": "100000000000000000000",
+ "0xb7a7f77c348f92a9f1100c6bd829a8ac6d7fcf91": "1820000000000000000000",
+ "0x2590126870e0bde8a663ab040a72a5573d8d41c2": "5000000000000000000000",
+ "0x090fa9367bda57d0d3253a0a8ff76ce0b8e19a73": "1000000000000000000000",
+ "0x2a5ba9e34cd58da54c9a2712663a3be274c8e47b": "197000000000000000000",
+ "0x3e8641d43c42003f0a33c929f711079deb2b9e46": "500000000000000000000",
+ "0xf4d97664cc4eec9edbe7fa09f4750a663b507d79": "4000000000000000000000",
+ "0xb1540e94cff3465cc3d187e7c8e3bdaf984659e2": "2989950000000000000000",
+ "0xf96883582459908c827627e86f28e646f9c7fc7a": "8350000000000000000000",
+ "0xd4feed99e8917c5c5458635f3603ecb7e817a7d0": "300031000000000000000",
+ "0x14b1603ec62b20022033eec4d6d6655ac24a015a": "50000000000000000000",
+ "0xaf8e1dcb314c950d3687434d309858e1a8739cd4": "267400000000000000000",
+ "0x4b9206ba6b549a1a7f969e1d5dba867539d1fa67": "7880000000000000000000",
+ "0x471010da492f4018833b088d9872901e06129174": "500000000000000000000",
+ "0xd243184c801e5d79d2063f3578dbae81e7b3a9cb": "1989700000000000000000",
+ "0x3eada8c92f56067e1bb73ce378da56dc2cdfd365": "2210000000000000000000",
+ "0x33ea6b7855e05b07ab80dab1e14de9b649e99b6c": "532000000000000000000",
+ "0x700711e311bb947355f755b579250ca7fd765a3e": "1790000000000000000000",
+ "0x87fb26c31e48644d693134205cae43b21f18614b": "1370000000000000000000",
+ "0x001d14804b399c6ef80e64576f657660804fec0b": "4200000000000000000000",
+ "0xf9642086b1fbae61a6804dbe5fb15ec2d2b537f4": "2000000000000000000000",
+ "0x6919dd5e5dfb1afa404703b9faea8cee35d00d70": "5910000000000000000000",
+ "0x9ac4da51d27822d1e208c96ea64a1e5b55299723": "100040000000000000000",
+ "0x1bd8ebaa7674bb18e19198db244f570313075f43": "150000000000000000000",
+ "0xe64ef012658d54f8e8609c4e9023c09fe865c83b": "28000000000000000000",
+ "0x43b079baf0727999e66bf743d5bcbf776c3b0922": "2000000000000000000000",
+ "0x06ac26ad92cb859bd5905ddce4266aa0ec50a9c5": "775000000000000000000",
+ "0x99c1d9f40c6ab7f8a92fce2fdce47a54a586c53f": "985000000000000000000",
+ "0x4ae93082e45187c26160e66792f57fad3551c73a": "21658000000000000000000",
+ "0x7da7613445a21299aa74f0ad71431ec43fbb1be9": "68000000000000000000",
+ "0x4a9a26fd0a8ba10f977da4f77c31908dab4a8016": "1790000000000000000000",
+ "0x972c2f96aa00cf8a2f205abcf8937c0c75f5d8d9": "200000000000000000000",
+ "0xb5046cb3dc1dedbd364514a2848e44c1de4ed147": "16445100000000000000000",
+ "0x48c2ee91a50756d8ce9abeeb7589d22c6fee5dfb": "3220000000000000000000",
+ "0x46c1aa2244b9c8a957ca8fac431b0595a3b86824": "4000000000000000000000",
+ "0x21fd0bade5f4ef7474d058b7f3d854cb1300524e": "20000000000000000000",
+ "0x1864a3c7b48155448c54c88c708f166709736d31": "133700000000000000000",
+ "0x5dd53ae897526b167d39f1744ef7c3da5b37a293": "8000000000000000000000",
+ "0xece111670b563ccdbebca52384290ecd68fe5c92": "20000000000000000000",
+ "0x74d671d99cbea1ab57906375b63ff42b50451d17": "1000000000000000000000",
+ "0x5717cc9301511d4a81b9f583148beed3d3cc8309": "2600000000000000000000",
+ "0x8f92844f282a92999ee5b4a8d773d06b694dbd9f": "1940000000000000000000",
+ "0xb5a606f4ddcbb9471ec67f658caf2b00ee73025e": "4325000000000000000000",
+ "0xbdb60b823a1173d45a0792245fb496f1fd3301cf": "2000000000000000000000",
+ "0x1d2615f8b6ca5012b663bdd094b0c5137c778ddf": "10000000000000000000000",
+ "0x82ff716fdf033ec7e942c909d9831867b8b6e2ef": "1790000000000000000000",
+ "0x44c14765127cde11fab46c5d2cf4d4b2890023fd": "2000000000000000000000",
+ "0xc72cb301258e91bc08998a805dd192f25c2f9a35": "591000000000000000000",
+ "0xad732c976593eec4783b4e2ecd793979780bfedb": "2000000000000000000000",
+ "0xd8f62036f03b7635b858f1103f8a1d9019a892b6": "50000000000000000000",
+ "0x0a06fad7dcd7a492cbc053eeabde6934b39d8637": "20000000000000000000",
+ "0x67f2bb78b8d3e11f7c458a10b5c8e0a1d374467d": "1790000000000000000000",
+ "0x4b5cdb1e428c91dd7cb54a6aed4571da054bfe52": "88000000000000000000",
+ "0xb3557d39b5411b84445f5f54f38f62d2714d0087": "600000000000000000000",
+ "0x0b0e055b28cbd03dc5ff44aa64f3dce04f5e63fb": "2000000000000000000000",
+ "0x9b2be7f56754f505e3441a10f7f0e20fd3ddf849": "340000000000000000000",
+ "0x0b93fca4a4f09cac20db60e065edcccc11e0a5b6": "200000000000000000000",
+ "0x3bc85d6c735b9cda4bba5f48b24b13e70630307b": "1970000000000000000000",
+ "0x52102354a6aca95d8a2e86d5debda6de69346076": "2000000000000000000000",
+ "0xcda4530f4b9bc50905b79d17c28fc46f95349bdf": "942000000000000000000",
+ "0xff545bbb66fbd00eb5e6373ff4e326f5feb5fe12": "20000000000000000000",
+ "0x4030a925706b2c101c8c5cb9bd05fbb4f6759b18": "4000000000000000000000",
+ "0xf11e01c7a9d12499005f4dae7716095a34176277": "400000000000000000000",
+ "0xa4826b6c3882fad0ed5c8fbb25cc40cc4f33759f": "2068000000000000000000",
+ "0x28510e6eff1fc829b6576f4328bc3938ec7a6580": "10000000000000000000000",
+ "0x9ce5363b13e8238aa4dd15acd0b2e8afe0873247": "200000000000000000000",
+ "0xd97bc84abd47c05bbf457b2ef659d61ca5e5e48f": "122000000000000000000",
+ "0x4a719061f5285495b37b9d7ef8a51b07d6e6acac": "199800000000000000000",
+ "0x8b714522fa2839620470edcf0c4401b713663df1": "200000000000000000000",
+ "0xb6decf82969819ba02de29b9b593f21b64eeda0f": "740000000000000000000",
+ "0xc87d3ae3d88704d9ab0009dcc1a0067131f8ba3c": "1969606000000000000000",
+ "0xdccb370ed68aa922283043ef7cad1b9d403fc34a": "4000000000000000000000",
+ "0x2d532df4c63911d1ce91f6d1fcbff7960f78a885": "1669833000000000000000",
+ "0x1fcfd1d57f872290560cb62d600e1defbefccc1c": "1490000000000000000000",
+ "0xd9e27eb07dfc71a706060c7f079238ca93e88539": "1000000000000000000000",
+ "0xda7732f02f2e272eaf28df972ecc0ddeed9cf498": "205274000000000000000",
+ "0xbf09d77048e270b662330e9486b38b43cd781495": "436000000000000000000000",
+ "0x619f171445d42b02e2e07004ad8afe694fa53d6a": "20000000000000000000",
+ "0x2bdd03bebbee273b6ca1059b34999a5bbd61bb79": "20000000000000000000",
+ "0x8da1d359ba6cb4bcc57d7a437720d55db2f01c72": "80000000000000000000",
+ "0xbe935793f45b70d8045d2654d8dd3ad24b5b6137": "880000000000000000000",
+ "0xee71793e3acf12a7274f563961f537529d89c7de": "2000000000000000000000",
+ "0x86f05d19063e9369c6004eb3f123943a7cff4eab": "1999944000000000000000",
+ "0x87b10f9c280098179a2b76e9ce90be61fc844d0d": "1337000000000000000000",
+ "0x243c84d12420570cc4ef3baba1c959c283249520": "2345000000000000000000",
+ "0x6bc85acd5928722ef5095331ee88f484b8cf8357": "180000000000000000000",
+ "0x2561a138dcf83bd813e0e7f108642be3de3d6f05": "999940000000000000000",
+ "0x7d0350e40b338dda736661872be33f1f9752d755": "49933000000000000000",
+ "0xe5dc9349cb52e161196122cf87a38936e2c57f34": "2000000000000000000000",
+ "0x543a8c0efb8bcd15c543e2a6a4f807597631adef": "5893800000000000000000",
+ "0x0413d0cf78c001898a378b918cd6e498ea773c4d": "280000000000000000000",
+ "0x3708e59de6b4055088782902e0579c7201a8bf50": "200000000000000000000000",
+ "0x699fc6d68a4775573c1dcdaec830fefd50397c4e": "60000000000000000000",
+ "0x379a7f755a81a17edb7daaa28afc665dfa6be63a": "25000000000000000000",
+ "0x260a230e4465077e0b14ee4442a482d5b0c914bf": "1677935000000000000000",
+ "0x3daa01ceb70eaf9591fa521ba4a27ea9fb8ede4a": "1667400000000000000000",
+ "0x7f3a1e45f67e92c880e573b43379d71ee089db54": "100000000000000000000000",
+ "0x38643babea6011316cc797d9b093c897a17bdae7": "334400000000000000000",
+ "0x84675e9177726d45eaa46b3992a340ba7f710c95": "1000000000000000000000",
+ "0x0f83461ba224bb1e8fdd9dae535172b735acb4e0": "200000000000000000000",
+ "0x31aa3b1ebe8c4dbcb6a708b1d74831e60e497660": "400000000000000000000",
+ "0xa32cf7dde20c3dd5679ff5e325845c70c5962662": "20000000000000000000",
+ "0xc007f0bdb6e7009202b7af3ea90902697c721413": "2999966000000000000000",
+ "0x05c64004a9a826e94e5e4ee267fa2a7632dd4e6f": "16191931000000000000000",
+ "0xf622e584a6623eaaf99f2be49e5380c5cbcf5cd8": "200000000000000000000",
+ "0x9dc10fa38f9fb06810e11f60173ec3d2fd6a751e": "1970000000000000000000",
+ "0x423c3107f4bace414e499c64390a51f74615ca5e": "2000000000000000000000",
+ "0x92438e5203b6346ff886d7c36288aacccc78ceca": "1000000000000000000000",
+ "0xbef07d97c3481f9d6aee1c98f9d91a180a32442b": "100000000000000000000000",
+ "0x55aa5d313ebb084da0e7801091e29e92c5dec3aa": "2000000000000000000000",
+ "0x89c433d601fad714da6369308fd26c1dc9942bbf": "2000000000000000000000",
+ "0x25106ab6755df86d6b63a187703b0cfea0e594a0": "27400000000000000000",
+ "0x494256e99b0f9cd6e5ebca3899863252900165c8": "14000000000000000000000",
+ "0x5f4ace4c1cc13391e01f00b198e1f20b5f91cbf5": "5000196000000000000000",
+ "0x135cecd955e5798370769230159303d9b1839f66": "5000000000000000000000",
+ "0xced81ec3533ff1bfebf3e3843ee740ad11758d3e": "1970000000000000000000",
+ "0x688eb3853bbcc50ecfee0fa87f0ab693cabdef02": "31600000000000000000000",
+ "0x2159240813a73095a7ebf7c3b3743e8028ae5f09": "2000000000000000000000",
+ "0x99d1579cd42682b7644e1d4f7128441eeffe339d": "20000000000000000000000",
+ "0x8a243a0a9fea49b839547745ff2d11af3f4b0522": "985000000000000000000",
+ "0xc1a41a5a27199226e4c7eb198b031b59196f9842": "191000000000000000000",
+ "0x7514adbdc63f483f304d8e94b67ff3309f180b82": "622911000000000000000",
+ "0x74aeec915de01cc69b2cb5a6356feea14658c6c5": "232500000000000000000",
+ "0x76f9ad3d9bbd04ae055c1477c0c35e7592cb2a20": "40200000000000000000000",
+ "0xa8a7b68adab4e3eadff19ffa58e34a3fcec0d96a": "6000000000000000000000",
+ "0x60de22a1507432a47b01cc68c52a0bf8a2e0d098": "19100000000000000000",
+ "0xceb33d78e7547a9da2e87d51aec5f3441c87923a": "20000000000000000000",
+ "0x432809a2390f07c665921ff37d547d12f1c9966a": "30000000000000000000000",
+ "0xd5e656a1b916f9bf45afb07dd8afaf73b4c56f41": "97000000000000000000",
+ "0xe3410bb7557cf91d79fa69d0dfea0aa075402651": "2000000000000000000000",
+ "0xdee942d5caf5fac11421d86b010b458e5c392990": "4000000000000000000000",
+ "0xa98f109835f5eacd0543647c34a6b269e3802fac": "400000000000000000000",
+ "0x932b9c04d40d2ac83083d94298169dae81ab2ed0": "2000000000000000000000",
+ "0xba10f2764290f875434372f79dbf713801caac01": "955000000000000000000",
+ "0xa2c7eaffdc2c9d937345206c909a52dfb14c478f": "143000000000000000000",
+ "0x6c67e0d7b62e2a08506945a5dfe38263339f1f22": "1970000000000000000000",
+ "0x60c3714fdddb634659e4a2b1ea42c4728cc7b8ba": "13370000000000000000",
+ "0x73b4d499de3f38bf35aaf769a6e318bc6d123692": "2000000000000000000000",
+ "0x3b22dea3c25f1b59c7bd27bb91d3a3eaecef3984": "100000000000000000000",
+ "0x1e3badb1b6e1380e27039c576ae6222e963a5b53": "20000000000000000000000",
+ "0xabd4d6c1666358c0406fdf3af248f78ece830104": "2112000000000000000000",
+ "0x0c925ad5eb352c8ef76d0c222d115b0791b962a1": "3180000000000000000000",
+ "0xbe9186c34a52514abb9107860f674f97b821bd5b": "509600000000000000000",
+ "0xb7f67314cb832e32e63b15a40ce0d7ffbdb26985": "1060866000000000000000",
+ "0x3f30d3bc9f602232bc724288ca46cd0b0788f715": "4000000000000000000000",
+ "0x970abd53a54fca4a6429207c182d4d57bb39d4a0": "2000000000000000000000",
+ "0x36d85dc3683156e63bf880a9fab7788cf8143a27": "20000000000000000000000",
+ "0x2836123046b284e5ef102bfd22b1765e508116ad": "411880000000000000000",
+ "0xde06d5ea777a4eb1475e605dbcbf43444e8037ea": "50000000000000000000000",
+ "0x9af11399511c213181bfda3a8b264c05fc81b3ce": "14000000000000000000000",
+ "0xe2191215983f33fd33e22cd4a2490054da53fddc": "15800000000000000000",
+ "0x2eebf59432b52892f9380bd140aa99dcf8ad0c0f": "152000000000000000000",
+ "0xdc087f9390fb9e976ac23ab689544a0942ec2021": "1820000000000000000000",
+ "0xfd4b989558ae11be0c3b36e2d6f2a54a9343ca2e": "2000000000000000000000",
+ "0x770c2fb2c4a81753ac0182ea460ec09c90a516f8": "20000000000000000000",
+ "0xb28dbfc6499894f73a71faa00abe0f4bc9d19f2a": "100000000000000000000",
+ "0xb0cef8e8fb8984a6019f01c679f272bbe68f5c77": "152000000000000000000",
+ "0xf400f93d5f5c7e3fc303129ac8fb0c2f786407fa": "2000000000000000000000",
+ "0xf2133431d1d9a37ba2f0762bc40c5acc8aa6978e": "2000000000000000000000",
+ "0x9003d270891ba2df643da8341583193545e3e000": "4000000000000000000000",
+ "0x8938d1b4daee55a54d738cf17e4477f6794e46f7": "18200000000000000000",
+ "0x98e6f547db88e75f1f9c8ac2c5cf1627ba580b3e": "1000000000000000000000",
+ "0x009fdbf44e1f4a6362b769c39a475f95a96c2bc7": "564000000000000000000",
+ "0xd0f9597811b0b992bb7d3757aa25b4c2561d32e2": "500000000000000000000",
+ "0xdcd10c55bb854f754434f1219c2c9a98ace79f03": "4000086000000000000000",
+ "0x67048f3a12a4dd1f626c64264cb1d7971de2ca38": "180000000000000000000",
+ "0xd33cf82bf14c592640a08608914c237079d5be34": "2000000000000000000000",
+ "0xf5b068989df29c253577d0405ade6e0e7528f89e": "1610000000000000000000",
+ "0xa9a8eca11a23d64689a2aa3e417dbb3d336bb59a": "262025000000000000000",
+ "0x99413704b1a32e70f3bc0d69dd881c38566b54cb": "27382708000000000000000",
+ "0x2a085e25b64862f5e68d768e2b0f7a8529858eee": "1983618000000000000000",
+ "0x833d3fae542ad5f8b50ce19bde2bec579180c88c": "346000000000000000000",
+ "0xc3483d6e88ac1f4ae73cc4408d6c03abe0e49dca": "17000000000000000000000",
+ "0xfde395bc0b6d5cbb4c1d8fea3e0b4bff635e9db7": "2000000000000000000000",
+ "0xeddacd94ec89a2ef968fcf977a08f1fae2757869": "8000000000000000000000",
+ "0xdc29119745d2337320da51e19100c948d980b915": "160000000000000000000",
+ "0x640bf87415e0cf407301e5599a68366da09bbac8": "493207000000000000000",
+ "0xafcc7dbb8356d842d43ae7e23c8422b022a30803": "30400000000000000000000",
+ "0x9120e71173e1ba19ba8f9f4fdbdcaa34e1d6bb78": "2000000000000000000000",
+ "0x9092918707c621fdbd1d90fb80eb787fd26f7350": "2460000000000000000000",
+ "0x263e57dacbe0149f82fe65a2664898866ff5b463": "38000000000000000000000",
+ "0x315db7439fa1d5b423afa7dd7198c1cf74c918bc": "600000000000000000000",
+ "0x09b4668696f86a080f8bebb91db8e6f87015915a": "656010000000000000000",
+ "0x5c31996dcac015f9be985b611f468730ef244d90": "200000000000000000000",
+ "0xb1179589e19db9d41557bbec1cb24ccc2dec1c7f": "100000000000000000000000",
+ "0x3b1937d5e793b89b63fb8eb5f1b1c9ca6ba0fa8e": "2000000000000000000000",
+ "0xc9127b7f6629ee13fc3f60bc2f4467a20745a762": "16465639000000000000000",
+ "0x7306de0e288b56cfdf987ef0d3cc29660793f6dd": "508060000000000000000",
+ "0x2aa192777ca5b978b6b2c2ff800ac1860f753f47": "335000000000000000000",
+ "0x55da9dcdca61cbfe1f133c7bcefc867b9c8122f9": "880000000000000000000",
+ "0xcdd9efac4d6d60bd71d95585dce5d59705c13564": "100000000000000000000",
+ "0xad8e48a377695de014363a523a28b1a40c78f208": "1000000000000000000000",
+ "0x252b6555afdc80f2d96d972d17db84ea5ad521ac": "7880000000000000000000",
+ "0x60ab71cd26ea6d6e59a7a0f627ee079c885ebbf6": "26740000000000000000",
+ "0xf40b134fea22c6b29c8457f49f000f9cda789adb": "600000000000000000000",
+ "0x85a2f6ea94d05e8c1d9ae2f4910338a358e98ded": "2000000000000000000000",
+ "0xae13a08511110f32e53be4127845c843a1a57c7b": "500000000000000000000",
+ "0x40db1ba585ce34531edec5494849391381e6ccd3": "1790000000000000000000",
+ "0x0c5589a7a89b9ad15b02751930415948a875fbef": "126000000000000000000",
+ "0x89054430dcdc28ac15fa635ef87c105e602bf70c": "108000000000000000000",
+ "0x6c882c27732cef5c7c13a686f0a2ea77555ac289": "100000000000000000000000",
+ "0xde374299c1d07d79537385190f442ef9ca24061f": "133700000000000000000",
+ "0xb146a0b925553cf06fcaf54a1b4dfea621290757": "2000200000000000000000",
+ "0x09ae49e37f121df5dc158cfde806f173a06b0c7f": "3988000000000000000000",
+ "0xb758896f1baa864f17ebed16d953886fee68aae6": "1000000000000000000000",
+ "0x30730466b8eb6dc90d5496aa76a3472d7dbe0bbe": "1999800000000000000000",
+ "0xfc02734033e57f70517e0afc7ee62461f06fad8e": "394000000000000000000",
+ "0xa9b2d2e0494eab18e07d37bbb856d80e80f84cd3": "10000000000000000000000",
+ "0x95278b08dee7c0f2c8c0f722f9fcbbb9a5241fda": "2408672000000000000000",
+ "0xdab6bcdb83cf24a0ae1cb21b3b5b83c2f3824927": "50000000000000000000000",
+ "0x94439ca9cc169a79d4a09cae5e67764a6f871a21": "240000000000000000000",
+ "0xe06c29a81517e0d487b67fb0b6aabc4f57368388": "401100000000000000000",
+ "0x458e3cc99e947844a18e6a42918fef7e7f5f5eb3": "36400000000000000000000",
+ "0x0a9804137803ba6868d93a55f9985fcd540451e4": "13370000000000000000",
+ "0x40630024bd2c58d248edd8465617b2bf1647da0e": "1000000000000000000000",
+ "0x15224ad1c0face46f9f556e4774a3025ad06bd52": "13370000000000000000",
+ "0x2e2810dee44ae4dff3d86342ab126657d653c336": "200000000000000000000",
+ "0x48a30de1c919d3fd3180e97d5f2b2a9dbd964d2d": "44000000000000000000",
+ "0x46a30b8a808931217445c3f5a93e882c0345b426": "250019000000000000000",
+ "0x455396a4bbd9bae8af9fb7c4d64d471db9c24505": "161000000000000000000",
+ "0xedfda2d5db98f9380714664d54b4ee971a1cae03": "40044000000000000000",
+ "0xf5eadcd2d1b8657a121f33c458a8b13e76b65526": "249828000000000000000",
+ "0x90e7070f4d033fe6910c9efe5a278e1fc6234def": "100392000000000000000",
+ "0xd55508adbbbe9be81b80f97a6ea89add68da674f": "2000000000000000000000",
+ "0x66925de3e43f4b41bf9dadde27d5488ef569ea0d": "39400000000000000000",
+ "0xb7c077946674ba9341fb4c747a5d50f5d2da6415": "1000000000000000000000",
+ "0xc52d1a0c73c2a1be84915185f8b34faa0adf1de3": "1400001000000000000000",
+ "0x79b8aad879dd30567e8778d2d231c8f37ab8734e": "2000000000000000000000",
+ "0x3aae4872fd9093cbcad1406f1e8078bab50359e2": "39400000000000000000",
+ "0xb2e9d76bf50fc36bf7d3944b63e9ca889b699968": "2660000000000000000000",
+ "0x405f596b94b947344c033ce2dcbff12e25b79784": "2000000000000000000000",
+ "0x232cb1cd49993c144a3f88b3611e233569a86bd6": "15576000000000000000000",
+ "0x9e232c08c14dc1a6ed0b8a3b2868977ba5c17d10": "20000000000000000000",
+ "0x095270cc42141dd998ad2862dbd1fe9b44e7e650": "1200000000000000000000",
+ "0x15d99468507aa0413fb60dca2adc7f569cb36b54": "2000000000000000000000",
+ "0x04852732b4c652f6c2e58eb36587e60a62da14db": "20000000000000000000000",
+ "0xecf24cdd7c22928c441e694de4aa31b0fab59778": "600000000000000000000",
+ "0x512b91bbfaa9e581ef683fc90d9db22a8f49f48b": "310000000000000000000000",
+ "0xa88577a073fbaf33c4cd202e00ea70ef711b4006": "2000000000000000000000",
+ "0x00acc6f082a442828764d11f58d6894ae408f073": "60000000000000000000000",
+ "0x0355bcacbd21441e95adeedc30c17218c8a408ce": "400000000000000000000",
+ "0x4e73cf2379f124860f73d6d91bf59acc5cfc845b": "40110000000000000000",
+ "0x2a742b8910941e0932830a1d9692cfd28494cf40": "499986000000000000000",
+ "0x41a8c2830081b102df6e0131657c07ab635b54ce": "1999944000000000000000",
+ "0xb63064bd3355e6e07e2d377024125a33776c4afa": "38800000000000000000000",
+ "0x1a25e1c5bc7e5f50ec16f8885f210ea1b938800e": "4000000000000000000000",
+ "0x09b59b8698a7fbd3d2f8c73a008988de3e406b2b": "40000000000000000000000",
+ "0xc555b93156f09101233c6f7cf6eb3c4f196d3346": "3000000000000000000000",
+ "0x12f32c0a1f2daab676fe69abd9e018352d4ccd45": "50000000000000000000",
+ "0x5956b28ec7890b76fc061a1feb52d82ae81fb635": "2000000000000000000000",
+ "0xc739259e7f85f2659bef5f609ed86b3d596c201e": "200000000000000000000",
+ "0xfae92c1370e9e1859a5df83b56d0f586aa3b404c": "106480000000000000000",
+ "0xd5a7bec332adde18b3104b5792546aa59b879b52": "2000000000000000000000",
+ "0x4f88dfd01091a45a9e2676021e64286cd36b8d34": "1000000000000000000000",
+ "0x102c477d69aadba9a0b0f62b7459e17fbb1c1561": "2000000000000000000000",
+ "0x34272d5e7574315dcae9abbd317bac90289d4765": "1820000000000000000000",
+ "0xfe615d975c0887e0c9113ec7298420a793af8b96": "8000000000000000000000",
+ "0x487adf7d70a6740f8d51cbdd68bb3f91c4a5ce68": "66850000000000000000",
+ "0x7e5d9993104e4cb545e179a2a3f971f744f98482": "2000000000000000000000",
+ "0x5529830a61c1f13c197e550beddfd6bd195c9d02": "10000000000000000000000",
+ "0x2f282abbb6d4a3c3cd3b5ca812f7643e80305f06": "1850000000000000000000",
+ "0x7352586d021ad0cf77e0e928404a59f374ff4582": "3400000000000000000000",
+ "0x03f7b92008813ae0a676eb212814afab35221069": "2000000000000000000000",
+ "0x056686078fb6bcf9ba0a8a8dc63a906f5feac0ea": "499800000000000000000",
+ "0x8063379a7bf2cb923a84c5093e68dac7f75481c5": "322102000000000000000",
+ "0x200264a09f8c68e3e6629795280f56254f8640d0": "20000000000000000000",
+ "0x5a891155f50e42074374c739baadf7df2651153a": "4775000000000000000000",
+ "0x80022a1207e910911fc92849b069ab0cdad043d3": "13370000000000000000",
+ "0xe781ec732d401202bb9bd13860910dd6c29ac0b6": "1240000000000000000000",
+ "0x4c2f1afef7c5868c44832fc77cb03b55f89e6d6e": "20000000000000000000000",
+ "0x34ff582952ff24458f7b13d51f0b4f987022c1fe": "2804400000000000000000",
+ "0x73914b22fc2f131584247d82be4fecbf978ad4ba": "2000000000000000000000",
+ "0x562be95aba17c5371fe2ba828799b1f55d2177d6": "38200000000000000000000",
+ "0x648f5bd2a2ae8902db37847d1cb0db9390b06248": "7769965000000000000000",
+ "0x6a9758743b603eea3aa0524b42889723c4153948": "10100000000000000000000",
+ "0x5985c59a449dfc5da787d8244e746c6d70caa55f": "100000000000000000000",
+ "0x56ee197f4bbf9f1b0662e41c2bbd9aa1f799e846": "1000000000000000000000",
+ "0xd47c242edffea091bc54d57df5d1fdb93101476c": "2914000000000000000000",
+ "0xd482e7f68e41f238fe517829de15477fe0f6dd1d": "500000000000000000000",
+ "0x05bf4fcfe772e45b826443852e6c351350ce72a2": "8000000000000000000000",
+ "0xf10462e58fcc07f39584a187639451167e859201": "169830000000000000000",
+ "0x1aa27699cada8dc3a76f7933aa66c71919040e88": "400000000000000000000",
+ "0x24046b91da9b61b629cb8b8ec0c351a07e0703e4": "2000000000000000000000",
+ "0x41033c1b6d05e1ca89b0948fc64453fbe87ab25e": "1337000000000000000000",
+ "0x369822f5578b40dd1f4471706b22cd971352da6b": "346000000000000000000",
+ "0x044e853144e3364495e7a69fa1d46abea3ac0964": "49225000000000000000",
+ "0xabf728cf9312f22128024e7046c251f5dc5901ed": "29550000000000000000000",
+ "0xd781f7fc09184611568570b4986e2c72872b7ed0": "20002000000000000000",
+ "0x6bb4a661a33a71d424d49bb5df28622ed4dffcf4": "630400000000000000000",
+ "0xfef3b3dead1a6926d49aa32b12c22af54d9ff985": "1000000000000000000000",
+ "0xfa410971ad229c3036f41acf852f2ac999281950": "3997400000000000000000",
+ "0xde176b5284bcee3a838ba24f67fc7cbf67d78ef6": "37600000000000000000",
+ "0x23120046f6832102a752a76656691c863e17e59c": "329800000000000000000",
+ "0xa2f472fe4f22b77db489219ea4023d11582a9329": "40000000000000000000000",
+ "0xf0d64cf9df09741133d170485fd24b005011d520": "498680000000000000000",
+ "0x8b505e2871f7deb7a63895208e8227dcaa1bff05": "61216600000000000000000",
+ "0x481e3a91bfdc2f1c8428a0119d03a41601417e1c": "1000000000000000000000",
+ "0xbc69a0d2a31c3dbf7a9122116901b2bdfe9802a0": "3000000000000000000000",
+ "0x20a81680e465f88790f0074f60b4f35f5d1e6aa5": "1279851000000000000000",
+ "0x194a6bb302b8aba7a5b579df93e0df1574967625": "500000000000000000000",
+ "0x264cc8086a8710f91b21720905912cd7964ae868": "26740000000000000000",
+ "0x24aca08d5be85ebb9f3132dfc1b620824edfedf9": "18200000000000000000",
+ "0x1851a063ccdb30549077f1d139e72de7971197d5": "2000000000000000000000",
+ "0xf64a4ac8d540a9289c68d960d5fb7cc45a77831c": "2000000000000000000000",
+ "0xc3db5657bb72f10d58f231fddf11980aff678693": "5910000000000000000000",
+ "0xb46ace865e2c50ea4698d216ab455dff5a11cd72": "1000000000000000000000",
+ "0x9faea13c733412dc4b490402bfef27a0397a9bc3": "310000000000000000000",
+ "0xb40594c4f3664ef849cca6227b8a25aa690925ee": "4000000000000000000000",
+ "0x672fa0a019088db3166f6119438d07a99f8ba224": "13370000000000000000000",
+ "0xc1ffad07db96138c4b2a530ec1c7de29b8a0592c": "17600000000000000000",
+ "0x87af25d3f6f8eea15313d5fe4557e810c524c083": "19700000000000000000000",
+ "0xd6a22e598dabd38ea6e958bd79d48ddd9604f4df": "1000000000000000000000",
+ "0xa2a435de44a01bd0ecb29e44e47644e46a0cdffb": "500171000000000000000",
+ "0x549b47649cfad993e4064d2636a4baa0623305cc": "601650000000000000000",
+ "0x1321b605026f4ffb296a3e0edcb390c9c85608b7": "2000000000000000000000",
+ "0xb4bf24cb83686bc469869fefb044b909716993e2": "2000000000000000000000",
+ "0x12d91a92d74fc861a729646db192a125b79f5374": "18200000000000000000",
+ "0x7f0662b410298c99f311d3a1454a1eedba2fea76": "200000000000000000000",
+ "0x83908aa7478a6d1c9b9b0281148f8f9f242b9fdc": "2000000000000000000000",
+ "0xc1438c99dd51ef1ca8386af0a317e9b041457888": "223500000000000000000",
+ "0x545bb070e781172eb1608af7fc2895d6cb87197e": "2244000000000000000000",
+ "0x161d26ef6759ba5b9f20fdcd66f16132c352415e": "2000000000000000000000",
+ "0xd7f370d4bed9d57c6f49c999de729ee569d3f4e4": "200000000000000000000",
+ "0x90e35aabb2deef408bb9b5acef714457dfde6272": "100076000000000000000",
+ "0x0fcfc4065008cfd323305f6286b57a4dd7eee23b": "20000000000000000000000",
+ "0xcd725d70be97e677e3c8e85c0b26ef31e9955045": "1337000000000000000000",
+ "0xdcf6b657266e91a4dae6033ddac15332dd8d2b34": "1760000000000000000000",
+ "0x31f006f3494ed6c16eb92aaf9044fa8abb5fd5a3": "500000000000000000000",
+ "0xcdea386f9d0fd804d02818f237b7d9fa7646d35e": "3012139000000000000000",
+ "0xd45b3341e8f15c80329320c3977e3b90e7826a7e": "500000000000000000000",
+ "0x0b649da3b96a102cdc6db652a0c07d65b1e443e6": "2000000000000000000000",
+ "0x0a58fddd71898de773a74fdae45e7bd84ef43646": "20000000000000000000",
+ "0x0256149f5b5063bea14e15661ffb58f9b459a957": "704000000000000000000",
+ "0x4438e880cb2766b0c1ceaec9d2418fceb952a044": "133712000000000000000",
+ "0x9ed80eda7f55054db9fb5282451688f26bb374c1": "300000000000000000000",
+ "0x8dab948ae81da301d972e3f617a912e5a753712e": "400000000000000000000",
+ "0x5b5d8c8eed6c85ac215661de026676823faa0a0c": "20000000000000000000000",
+ "0x46722a36a01e841d03f780935e917d85d5a67abd": "14900000000000000000",
+ "0xd4b8bdf3df9a51b0b91d16abbea05bb4783c8661": "1000000000000000000000",
+ "0x98f6b8e6213dbc9a5581f4cce6655f95252bdb07": "319968000000000000000",
+ "0x3599493ce65772cf93e98af1195ec0955dc98002": "1500048000000000000000",
+ "0xecab5aba5b828de1705381f38bc744b32ba1b437": "940000000000000000000",
+ "0x9a82826d3c29481dcc2bd2950047e8b60486c338": "20000000000000000000000",
+ "0x6c474bc66a54780066aa4f512eefa773abf919c7": "94000000000000000000",
+ "0xd5903e9978ee20a38c3f498d63d57f31a39f6a06": "10380000000000000000000",
+ "0x341480cc8cb476f8d01ff30812e7c70e05afaf5d": "2000000000000000000000",
+ "0xaf771039345a343001bc0f8a5923b126b60d509c": "985000000000000000000",
+ "0xb5a4679685fa14196c2e9230c8c4e33bffbc10e2": "1400000000000000000000",
+ "0x2a400dff8594de7228b4fd15c32322b75bb87da8": "95810000000000000000",
+ "0xa1336dfb96b6bcbe4b3edf3205be5723c90fad52": "5000000000000000000000",
+ "0xe9b1f1fca3fa47269f21b061c353b7f5e96d905a": "500000000000000000000",
+ "0x0ee414940487fd24e390378285c5d7b9334d8b65": "2680000000000000000000",
+ "0x6ab5b4c41cddb829690c2fda7f20c85e629dd5d5": "1860000000000000000000",
+ "0xdd63042f25ed32884ad26e3ad959eb94ea36bf67": "21340000000000000000000",
+ "0xc0b3f244bca7b7de5b48a53edb9cbeab0b6d88c0": "5820000000000000000000",
+ "0xed1a5c43c574d4e934299b24f1472cdc9fd6f010": "200000000000000000000",
+ "0xb2d9ab9664bcf6df203c346fc692fd9cbab9205e": "438000000000000000000",
+ "0xede8c2cb876fbe8a4cca8290361a7ea01a69fdf8": "7813091000000000000000",
+ "0x6a7c252042e7468a3ff773d6450bba85efa26391": "500000000000000000000",
+ "0xa106e6923edd53ca8ed650968a9108d6ccfd9670": "9499935000000000000000",
+ "0x031e25db516b0f099faebfd94f890cf96660836b": "2000000000000000000000",
+ "0x7fdbc3a844e40d96b2f3a635322e6065f4ca0e84": "2000000000000000000000",
+ "0xdf47a61b72535193c561cccc75c3f3ce0804a20e": "398000000000000000000",
+ "0xed31305c319f9273d3936d8f5b2f71e9b1b22963": "100000000000000000000",
+ "0xa6b2d573297360102c07a18fc21df2e7499ff4eb": "4011000000000000000000",
+ "0xf68464bf64f2411356e4d3250efefe5c50a5f65b": "20000000000000000000",
+ "0x927cc2bfda0e088d02eff70b38b08aa53cc30941": "1852700000000000000000",
+ "0x41cb9896445f70a10a14215296daf614e32cf4d5": "1910000000000000000000",
+ "0x3ad70243d88bf0400f57c8c1fd57811848af162a": "860000000000000000000",
+ "0x63b9754d75d12d384039ec69063c0be210d5e0e3": "2694055000000000000000",
+ "0xad1799aad7602b4540cd832f9db5f11150f1687a": "2000000000000000000000",
+ "0xa8b65ba3171a3f77a6350b9daf1f8d55b4d201eb": "745000000000000000000",
+ "0xad0a4ae478e9636e88c604f242cf5439c6d45639": "3520000000000000000000",
+ "0x4cd0b0a6436362595ceade052ebc9b929fb6c6c0": "2000000000000000000000",
+ "0xc1d4af38e9ba799040894849b8a8219375f1ac78": "20000000000000000000000",
+ "0x49ddee902e1d0c99d1b11af3cc8a96f78e4dcf1a": "199358000000000000000",
+ "0xae842210f44d14c4a4db91fc9d3b3b50014f7bf7": "4000000000000000000000",
+ "0x10a1c42dc1ba746986b985a522a73c93eae64c63": "1000000000000000000000",
+ "0x5103bc09933e9921fd53dc536f11f05d0d47107d": "4000000000000000000000",
+ "0xc88eec54d305c928cc2848c2fee23531acb96d49": "1999946000000000000000",
+ "0x9a2ce43b5d89d6936b8e8c354791b8afff962425": "2000000000000000000000",
+ "0x562020e3ed792d2f1835fe5f55417d5111460c6a": "20000000000000000000000",
+ "0xed16ce39feef3bd7f5d162045e0f67c0f00046bb": "20000000000000000000",
+ "0xab948a4ae3795cbca13126e19253bdc21d3a8514": "200000000000000000000",
+ "0xc12b7f40df9a2f7bf983661422ab84c9c1f50858": "8000000000000000000000",
+ "0x62e6b2f5eb94fa7a43831fc87e254a3fe3bf8f89": "250000000000000000000",
+ "0x423bca47abc00c7057e3ad34fca63e375fbd8b4a": "18000000000000000000000",
+ "0x5ff326cd60fd136b245e29e9087a6ad3a6527f0d": "1880000000000000000000",
+ "0x79ffb4ac13812a0b78c4a37b8275223e176bfda5": "17300000000000000000",
+ "0xf757fc8720d3c4fa5277075e60bd5c411aebd977": "2000000000000000000000",
+ "0x0bdbc54cc8bdbbb402a08911e2232a5460ce866b": "3000000000000000000000",
+ "0x9ee9760cc273d4706aa08375c3e46fa230aff3d5": "8950000000000000000000",
+ "0xd23a24d7f9468343c143a41d73b88f7cbe63be5e": "200000000000000000000",
+ "0x46d80631284203f6288ecd4e5758bb9d41d05dbe": "2000000000000000000000",
+ "0x3f4cd1399f8a34eddb9a17a471fc922b5870aafc": "200000000000000000000",
+ "0x44c54eaa8ac940f9e80f1e74e82fc14f1676856a": "7880000000000000000000",
+ "0xaec27ff5d7f9ddda91183f46f9d52543b6cd2b2f": "450000000000000000000",
+ "0x203c6283f20df7bc86542fdfb4e763ecdbbbeef5": "25000000000000000000000",
+ "0xbcaf347918efb2d63dde03e39275bbe97d26df50": "100000000000000000000",
+ "0x974d0541ab4a47ec7f75369c0069b64a1b817710": "400000000000000000000",
+ "0x5da54785c9bd30575c89deb59d2041d20a39e17b": "1967031000000000000000",
+ "0x1fb463a0389983df7d593f7bdd6d78497fed8879": "20000000000000000000",
+ "0x6e1ea4b183e252c9bb7767a006d4b43696cb8ae9": "294245000000000000000",
+ "0xc2aa74847e86edfdd3f3db22f8a2152feee5b7f7": "2048852000000000000000",
+ "0xa13b9d82a99b3c9bba5ae72ef2199edc7d3bb36c": "1999944000000000000000",
+ "0x5135fb8757600cf474546252f74dc0746d06262c": "2000000000000000000000",
+ "0x43e7ec846358d7d0f937ad1c350ba069d7bf72bf": "118800000000000000000",
+ "0xf2ed3e77254acb83231dc0860e1a11242ba627db": "1980000000000000000000",
+ "0xc0a02ab94ebe56d045b41b629b98462e3a024a93": "100000000000000000000",
+ "0xf21549bdd1487912f900a7523db5f7626121bba3": "10000000000000000000000",
+ "0x886d0a9e17c9c095af2ea2358b89ec705212ee94": "28000000000000000000",
+ "0x211b29cefc79ae976744fdebcebd3cbb32c51303": "14000000000000000000000",
+ "0xb8c2703d8c3f2f44c584bc10e7c0a6b64c1c097e": "5550000000000000000000",
+ "0xec30addd895b82ee319e54fb04cb2bb03971f36b": "2000000000000000000000",
+ "0xb71b62f4b448c02b1201cb5e394ae627b0a560ee": "500000000000000000000",
+ "0xe1334e998379dfe983177062791b90f80ee22d8d": "500000000000000000000",
+ "0x1d633097a85225a1ff4321b12988fdd55c2b3844": "4000000000000000000000",
+ "0x8bd8d4c4e943f6c8073921dc17e3e8d7a0761627": "2933330000000000000000",
+ "0xa5d96e697d46358d119af7819dc7087f6ae47fef": "14605131000000000000000",
+ "0xd0809498c548047a1e2a2aa6a29cd61a0ee268bd": "2000000000000000000000",
+ "0x3cd6b7593cbee77830a8b19d0801958fcd4bc57a": "500000000000000000000",
+ "0xead4d2eefb76abae5533961edd11400406b298fc": "3880000000000000000000",
+ "0x6331028cbb5a21485bc51b565142993bdb2582a9": "534800000000000000000",
+ "0x163bad4a122b457d64e8150a413eae4d07023e6b": "18800000000000000000",
+ "0xc522e20fbf04ed7f6b05a37b4718d6fce0142e1a": "4000000000000000000000",
+ "0x2d9bad6f1ee02a70f1f13def5cccb27a9a274031": "1790000000000000000000",
+ "0x5ed0d6338559ef44dc7a61edeb893fa5d83fa1b5": "220000000000000000000",
+ "0xec8c1d7b6aaccd429db3a91ee4c9eb1ca4f6f73c": "4250000000000000000000",
+ "0x3896ad743579d38e2302454d1fb6e2ab69e01bfd": "1880000000000000000000",
+ "0xe73ccf436725c151e255ccf5210cfce5a43f13e3": "19982000000000000000",
+ "0x9483d98f14a33fdc118d403955c29935edfc5f70": "459600000000000000000",
+ "0x1cfcf7517f0c08459720942b647ad192aa9c8828": "800000000000000000000",
+ "0x8d378f0edc0bb0f0686d6a20be6a7692c4fa24b8": "100000000000000000000",
+ "0x06f68de3d739db41121eacf779aada3de8762107": "28000000000000000000",
+ "0x9909650dd5b1397b8b8b0eb69499b291b0ad1213": "200000000000000000000",
+ "0xb66675142e3111a1c2ea1eb2419cfa42aaf7a234": "1000000000000000000000",
+ "0x7836f7ef6bc7bd0ff3acaf449c84dd6b1e2c939f": "4142296000000000000000",
+ "0x3ddedbe48923fbf9e536bf9ffb0747c9cdd39eef": "16100000000000000000000",
+ "0xc47d610b399250f70ecf1389bab6292c91264f23": "288800000000000000000",
+ "0x51a6d627f66a8923d88d6094c4715380d3057cb6": "1152044000000000000000",
+ "0x6c0cc917cbee7d7c099763f14e64df7d34e2bf09": "250000000000000000000",
+ "0xaaaae68b321402c8ebc13468f341c63c0cf03fce": "1520000000000000000000",
+ "0x819cdaa5303678ef7cec59d48c82163acc60b952": "14523448000000000000000",
+ "0xd071192966eb69c3520fca3aa4dd04297ea04b4e": "110000000000000000000",
+ "0xe53425d8df1f11c341ff58ae5f1438abf1ca53cf": "322000000000000000000",
+ "0x8ffe322997b8e404422d19c54aadb18f5bc8e9b7": "3940000000000000000000",
+ "0x305f78d618b990b4295bac8a2dfa262884f804ea": "4000000000000000000000",
+ "0x274d69170fe7141401882b886ac4618c6ae40edb": "955000000000000000000",
+ "0x69c94e07c4a9be3384d95dfa3cb9290051873b7b": "70000000000000000000",
+ "0x859c600cf13d1d0273d5d1da3cd789e495899f27": "2674000000000000000000",
+ "0xc06cebbbf7f5149a66f7eb976b3e47d56516da2f": "2000000000000000000000",
+ "0x37bbc47212d82fcb5ee08f5225ecc2041ad2da7d": "3280000000000000000000",
+ "0x11e7997edd904503d77da6038ab0a4c834bbd563": "388000000000000000000",
+ "0xd333627445f2d787901ef33bb2a8a3675e27ffec": "400000000000000000000",
+ "0x16a58e985dccd707a594d193e7cca78b5d027849": "1360000000000000000000",
+ "0xf8ae857b67a4a2893a3fbe7c7a87ff1c01c6a6e7": "4000000000000000000000",
+ "0x491561db8b6fafb9007e62d050c282e92c4b6bc8": "30000000000000000000000",
+ "0x21df1ec24b4e4bfe79b0c095cebae198f291fbd1": "20000000000000000000000",
+ "0xe208812a684098f3da4efe6aba256256adfe3fe6": "2000000000000000000000",
+ "0xf4ec8e97a20aa5f8dd206f55207e06b813df2cc0": "200000000000000000000",
+ "0x29eb7eefdae9feb449c63ff5f279d67510eb1422": "19400000000000000000",
+ "0x0d678706d037187f3e22e6f69b99a592d11ebc59": "1580000000000000000000",
+ "0xde6d363106cc6238d2f092f0f0372136d1cd50c6": "5348000000000000000000",
+ "0xc8710d7e8b5a3bd69a42fe0fa8b87c357fddcdc8": "4000000000000000000000",
+ "0x5267f4d41292f370863c90d793296903843625c7": "1400000000000000000000",
+ "0x4cda41dd533991290794e22ae324143e309b3d3d": "2400000000000000000000",
+ "0xf8a50cee2e688ceee3aca4d4a29725d4072cc483": "2000000000000000000000",
+ "0x5ed3bbc05240e0d399eb6ddfe60f62de4d9509af": "193999806000000000000000",
+ "0x0befb54707f61b2c9fb04715ab026e1bb72042bd": "4000000000000000000000",
+ "0xcab9a301e6bd46e940355028eccd40ce4d5a1ac3": "400000000000000000000",
+ "0x64672da3ab052821a0243d1ce4b6e0a36517b8eb": "200000000000000000000",
+ "0xeac0827eff0c6e3ff28a7d4a54f65cb7689d7b99": "2856500000000000000000",
+ "0xf4b6cdcfcb24230b337d770df6034dfbd4e1503f": "19000000000000000000000",
+ "0x7be2f7680c802da6154c92c0194ae732517a7169": "18200000000000000000",
+ "0x869f1aa30e4455beb1822091de5cadec79a8f946": "8000000000000000000000",
+ "0xc4681e73bb0e32f6b726204831ff69baa4877e32": "1820000000000000000000",
+ "0x962cd22a8edf1e4f4e55b4b15ddbfb5d9d541971": "2000000000000000000000",
+ "0x131df8d330eb7cc7147d0a55576f05de8d26a8b7": "188000000000000000000",
+ "0x19f99f2c0b46ce8906875dc9f90ae104dae35594": "4507300000000000000000",
+ "0x91bb3f79022bf3c453f4ff256e269b15cf2c9cbd": "1519000000000000000000",
+ "0x7301dc4cf26d7186f2a11bf8b08bf229463f64a3": "2000000000000000000000",
+ "0x7cbca88fca6a0060b960985c9aa1b02534dc2208": "462500000000000000000",
+ "0xf3c1abd29dc57b41dc192d0e384d021df0b4f6d4": "2798000000000000000000",
+ "0x5d32f6f86e787ff78e63d78b0ef95fe6071852b8": "401100000000000000000",
+ "0x1678c5f2a522393225196361894f53cc752fe2f3": "1936000000000000000000",
+ "0x1cf04cb14380059efd3f238b65d5beb86afa14d8": "20000000000000000000",
+ "0x52e1731350f983cc2c4189842fde0613fad50ce1": "11640000000000000000000",
+ "0xd0b11d6f2bce945e0c6a5020c3b52753f803f9d1": "200000000000000000000",
+ "0x409bd75085821c1de70cdc3b11ffc3d923c74010": "4000000000000000000000",
+ "0x0bb7160aba293762f8734f3e0326ffc9a4cac190": "1000000000000000000000",
+ "0x7aad4dbcd3acf997df93586956f72b64d8ad94ee": "4000000000000000000000",
+ "0x2dec98329d1f96c3a59caa7981755452d4da49d5": "200000000000000000000",
+ "0xc18ab467feb5a0aadfff91230ff056464d78d800": "2000000000000000000000",
+ "0xc90c3765156bca8e4897ab802419153cbe5225a9": "200000000000000000000",
+ "0x85c8f3cc7a354feac99a5e7bfe7cdfa351cfe355": "400000000000000000000",
+ "0xf4fc4d39bc0c2c4068a36de50e4ab4d4db7e340a": "25380000000000000000",
+ "0xf50abbd4aa45d3eb88515465a8ba0b310fd9b521": "6685000000000000000000",
+ "0x4d200110124008d56f76981256420c946a6ff45c": "199955000000000000000",
+ "0xf4ba6a46d55140c439cbcf076cc657136262f4f8": "2000000000000000000000",
+ "0xfa7adf660b8d99ce15933d7c5f072f3cbeb99d33": "5910000000000000000000",
+ "0x84503334630d77f74147f68b2e086613c8f1ade9": "1600000000000000000000",
+ "0x31ed858788bda4d5270992221cc04206ec62610d": "1176000000000000000000",
+ "0xbfbca418d3529cb393081062032a6e1183c6b2dc": "8000000000000000000000",
+ "0x8263ece5d709e0d7ae71cca868ed37cd2fef807b": "990000000000000000000",
+ "0x23ba3864da583dab56f420873c37679690e02f00": "9800000000000000000000",
+ "0xcedcb3a1d6843fb6bef643617deaf38f8e98dd5f": "477500000000000000000",
+ "0x8fac748f784a0fed68dba43319b42a75b4649c6e": "910000000000000000000",
+ "0x18b8bcf98321da61fb4e3eacc1ec5417272dc27e": "880000000000000000000",
+ "0x776943ffb2ef5cdd35b83c28bc046bd4f4677098": "3000000000000000000000",
+ "0xfb8113f94d9173eefd5a3073f516803a10b286ae": "80000000000000000000",
+ "0x3e8349b67f5745449f659367d9ad4712db5b895a": "1820000000000000000000",
+ "0x79cfa9780ae6d87b2c31883f09276986c89a6735": "1000000000000000000000",
+ "0x5006fe4c22173980f00c74342b39cd231c653129": "2000000000000000000000",
+ "0x13848b46ea75beb7eaa85f59d866d77fd24cf21a": "50000000000000000000000",
+ "0xd64a2d50f8858537188a24e0f50df1681ab07ed7": "38800000000000000000000",
+ "0x4f9ce2af9b8c5e42c6808a3870ec576f313545d1": "10000000000000000000000",
+ "0x8764d02722000996ecd475b433298e9f540b05bf": "200000000000000000000",
+ "0x3b7c77dbe95dc2602ce3269a9545d04965fefdbd": "2000000000000000000000",
+ "0xc9dcbb056f4db7d9da39936202c5bd8230b3b477": "20000000000000000000000",
+ "0x9ecbabb0b22782b3754429e1757aaba04b81189f": "823743000000000000000",
+ "0x831c44b3084047184b2ad218680640903750c45d": "1970000000000000000000",
+ "0xff8eb07de3d49d9d52bbe8e5b26dbe1d160fa834": "3986000000000000000000",
+ "0x8ccf3aa21ab742576ad8c422f71bb188591dea8a": "1000000000000000000000",
+ "0xddac312a9655426a9c0c9efa3fd82559ef4505bf": "401100000000000000000",
+ "0x9a3e2b1bf346dd070b027357feac44a4b2c97db8": "10000000000000000000000",
+ "0x69d39d510889e552a396135bfcdb06e37e387633": "4000000000000000000000",
+ "0x83a3148833d9644984f7c475a7850716efb480ff": "3400000000000000000000",
+ "0x62b4a9226e61683c72c183254690daf511b4117a": "260000000000000000000",
+ "0x50763add868fd7361178342fc055eaa2b95f6846": "66838000000000000000",
+ "0x91898eab8c05c0222883cd4db23b7795e1a24ad7": "2000000000000000000000",
+ "0x066647cfc85d23d37605573d208ca154b244d76c": "10000000000000000000000",
+ "0xaaf9ee4b886c6d1e95496fd274235bf4ecfcb07d": "1400000000000000000000",
+ "0x06860a93525955ff624940fadcffb8e149fd599c": "1999800000000000000000",
+ "0xe81c2d346c0adf4cc56708f6394ba6c8c8a64a1e": "2000000000000000000000",
+ "0x41a8e236a30e6d63c1ff644d132aa25c89537e01": "20000000000000000000",
+ "0x6a679e378fdce6bfd97fe62f043c6f6405d79e99": "4000000000000000000000",
+ "0x933436c8472655f64c3afaaf7c4c621c83a62b38": "1000000000000000000000",
+ "0xabe07ced6ac5ddf991eff6c3da226a741bd243fe": "10000000000000000000000",
+ "0xbb56a404723cff20d0685488b05a02cdc35aacaa": "20000000000000000000",
+ "0x0d551ec1a2133c981d5fc6a8c8173f9e7c4f47af": "2000000000000000000000",
+ "0x23376ecabf746ce53321cf42c86649b92b67b2ff": "2000000000000000000000",
+ "0x644ba6c61082e989109f5c11d4b40e991660d403": "4000000000000000000000",
+ "0x680d5911ed8dd9eec45c060c223f89a7f620bbd5": "20000000000000000000000",
+ "0xcb1bb6f1da5eb10d4899f7e61d06c1b00fdfb52d": "1038000000000000000000",
+ "0x303a30ac4286ae17cf483dad7b870c6bd64d7b4a": "500000000000000000000",
+ "0x7b0b31ff6e24745ead8ed9bb85fc0bf2fe1d55d4": "800000000000000000000",
+ "0x854691ce714f325ced55ce5928ce9ba12facd1b8": "4380000000000000000000",
+ "0xa13cfe826d6d1841dcae443be8c387518136b5e8": "140000000000000000000000",
+ "0x5fcd84546896dd081db1a320bd4d8c1dd1528c4c": "20000000000000000000",
+ "0x3db5fe6a68bd3612ac15a99a61e555928eeceaf3": "1580000000000000000000",
+ "0x7a79e30ff057f70a3d0191f7f53f761537af7dff": "400000000000000000000",
+ "0x3d3fad49c9e5d2759c8e8e5a7a4d60a0dd135692": "20000000000000000000",
+ "0x05a830724302bc0f6ebdaa1ebeeeb46e6ce00b39": "98500000000000000000",
+ "0xe4b6ae22c7735f5b89f34dd77ad0975f0acc9181": "1000000000000000000000",
+ "0x3f2dd55db7eab0ebee65b33ed8202c1e992e958b": "820000000000000000000",
+ "0x395d6d255520a8db29abc47d83a5db8a1a7df087": "100000000000000000000",
+ "0x1cc90876004109cd79a3dea866cb840ac364ba1b": "2000000000000000000000",
+ "0xc83e9d6a58253beebeb793e6f28b054a58491b74": "281800000000000000000",
+ "0x901d99b699e5c6911519cb2076b4c76330c54d22": "2000000000000000000000",
+ "0x3a9132b7093d3ec42e1e4fb8cb31ecdd43ae773c": "2000000000000000000000",
+ "0xb41eaf5d51a5ba1ba39bb418dbb54fab750efb1f": "1000000000000000000000",
+ "0xaa493d3f4fb866491cf8f800efb7e2324ed7cfe5": "1700000000000000000000",
+ "0x509982f56237ee458951047e0a2230f804e2e895": "17500000000000000000000",
+ "0x316e92a91bbda68b9e2f98b3c048934e3cc0b416": "2000000000000000000000",
+ "0xa3430e1f647f321ed34739562323c7d623410b56": "999942000000000000000",
+ "0xfca43bbc23a0d321ba9e46b929735ce7d8ef0c18": "20000000000000000000",
+ "0xff45cb34c928364d9cc9d8bb00373474618f06f3": "100000000000000000000",
+ "0x8c999591fd72ef7111efca7a9e97a2356b3b000a": "4084000000000000000000",
+ "0x8579dadf1a395a3471e20b6f763d9a0ff19a3f6f": "4000000000000000000000",
+ "0xc8d4e1599d03b79809e0130a8dc38408f05e8cd3": "2945500000000000000000",
+ "0x2abce1808940cd4ef5b5e05285f82df7a9ab5e03": "9800000000000000000000",
+ "0x0bb0c12682a2f15c9b5741b2385cbe41f034068e": "1500000000000000000000",
+ "0x08b7bdcf944d5570838be70460243a8694485858": "2000000000000000000000",
+ "0xc452e0e4b3d6ae06b836f032ca09db409ddfe0fb": "800000000000000000000",
+ "0x48d4f2468f963fd79a006198bb67895d2d5aa4d3": "1400000000000000000000",
+ "0xf9e7222faaf0f4da40c1c4a40630373a09bed7b6": "2865000000000000000000",
+ "0xbf59aee281fa43fe97194351a9857e01a3b897b2": "600000000000000000000",
+ "0xda0d4b7ef91fb55ad265f251142067f10376ced6": "20000000000000000000000",
+ "0x2c6f5c124cc789f8bb398e3f889751bc4b602d9e": "24928000000000000000",
+ "0xc85ef27d820403805fc9ed259fff64acb8d6346a": "2000000000000000000000",
+ "0x9aa8308f42910e5ade09c1a5e282d6d91710bdbf": "200000000000000000000",
+ "0x9e4cec353ac3e381835e3c0991f8faa5b7d0a8e6": "9999917000000000000000",
+ "0x137cf341e8516c815814ebcd73e6569af14cf7bc": "1000000000000000000000",
+ "0x889da662eb4a0a2a069d2bc24b05b4ee2e92c41b": "1663417000000000000000",
+ "0x0998d8273115b56af43c505e087aff0676ed3659": "3999984000000000000000",
+ "0x3e4d13c55a84e46ed7e9cb90fd355e8ad991e38f": "1000000000000000000000",
+ "0xabc068b4979b0ea64a62d3b7aa897d73810dc533": "1970000000000000000000",
+ "0xd8fdf546674738c984d8fab857880b3e4280c09e": "20000000000000000000",
+ "0xaff161740a6d909fe99c59a9b77945c91cc91448": "60000000000000000000",
+ "0x92ad1b3d75fba67d54663da9fc848a8ade10fa67": "2000000000000000000000",
+ "0x819eb4990b5aba5547093da12b6b3c1093df6d46": "1000000000000000000000",
+ "0x643d9aeed4b180947ed2b9207cce4c3ddc55e1f7": "200000000000000000000",
+ "0xab3e62e77a8b225e411592b1af300752fe412463": "9850000000000000000000",
+ "0x650b425555e4e4c51718146836a2c1ee77a5b421": "20000000000000000000000",
+ "0xba8e46d69d2e2343d86c60d82cf42c2041a0c1c2": "100000000000000000000",
+ "0xf9570e924c95debb7061369792cf2efec2a82d5e": "20000000000000000000",
+ "0x4dc4bf5e7589c47b28378d7503cf96488061dbbd": "1760000000000000000000",
+ "0x3d7ea5bf03528100ed8af8aed2653e921b6e6725": "1000000000000000000000",
+ "0xa02bde6461686e19ac650c970d0672e76dcb4fc2": "8865000000000000000000",
+ "0xb0e760bb07c081777345e0578e8bc898226d4e3b": "2000000000000000000000",
+ "0x979cbf21dfec8ace3f1c196d82df962534df394f": "2832860000000000000000",
+ "0x9f8245c3ab7d173164861cd3991b94f1ba40a93a": "2860000000000000000000",
+ "0xc25cf826550c8eaf10af2234fef904ddb95213be": "1000000000000000000000",
+ "0x967bfaf76243cdb9403c67d2ceefdee90a3feb73": "970582000000000000000",
+ "0x0b2113504534642a1daf102eee10b9ebde76e261": "2733351000000000000000",
+ "0x74bc4a5e2045f4ff8db184cf3a9b0c065ad807d2": "2000000000000000000000",
+ "0xf1da40736f99d5df3b068a5d745fafc6463fc9b1": "121546000000000000000",
+ "0x0fa6c7b0973d0bae2940540e247d3627e37ca347": "1000000000000000000000",
+ "0x72b05962fb2ad589d65ad16a22559eba1458f387": "133700000000000000000",
+ "0x6ceae3733d8fa43d6cd80c1a96e8eb93109c83b7": "298000000000000000000",
+ "0x28eaea78cd4d95faecfb68836eafe83520f3bbb7": "200000000000000000000",
+ "0xf49f6f9baabc018c8f8e119e0115f491fc92a8a4": "10000000000000000000000",
+ "0x833316985d47742bfed410604a91953c05fb12b0": "2000000000000000000000",
+ "0xead75016e3a0815072b6b108bcc1b799acf0383e": "2000000000000000000000",
+ "0x0032403587947b9f15622a68d104d54d33dbd1cd": "77500000000000000000",
+ "0x8f64b9c1246d857831643107d355b5c75fef5d4f": "1999944000000000000000",
+ "0x15dcafcc2bace7b55b54c01a1c514626bf61ebd8": "9400000000000000000000",
+ "0x6886ada7bbb0617bda842191c68c922ea3a8ac82": "1160000000000000000000",
+ "0xf736dc96760012388fe88b66c06efe57e0d7cf0a": "2100000000000000000000",
+ "0x0b288a5a8b75f3dc4191eb0457e1c83dbd204d25": "4853000000000000000000",
+ "0x56b6c23dd2ec90b4728f3bb2e764c3c50c85f144": "1000000000000000000000",
+ "0x6310b020fd98044957995092090f17f04e52cdfd": "1580000000000000000000",
+ "0xb0baeb30e313776c4c6d247402ba4167afcda1cc": "1970000000000000000000",
+ "0x7641f7d26a86cddb2be13081810e01c9c83c4b20": "13370000000000000000",
+ "0x07a8dadec142571a7d53a4297051786d072cba55": "22729000000000000000",
+ "0xcc73dd356b4979b579b401d4cc7a31a268ddce5a": "500000000000000000000",
+ "0xadf1acfe99bc8c14b304c8d905ba27657b8a7bc4": "20000000000000000000000",
+ "0x72dabb5b6eed9e99be915888f6568056381608f8": "208433000000000000000",
+ "0x9de20ae76aa08263b205d5142461961e2408d266": "252000000000000000000",
+ "0x9d4ff989b7bed9ab109d10c8c7e55f02d76734ad": "1000000000000000000000",
+ "0xe58dd23238ee6ea7c2138d385df500c325f376be": "1820000000000000000000",
+ "0x4bd6dd0cff23400e1730ba7b894504577d14e74a": "206028000000000000000000",
+ "0x35147430c3106500e79fa2f502462e94703c23b1": "1999944000000000000000",
+ "0xc0ae14d724832e2fce2778de7f7b8daf7b12a93e": "20000000000000000000",
+ "0xb57413060af3f14eb479065f1e9d19b3757ae8cc": "40000000000000000000",
+ "0x7d04d2edc058a1afc761d9c99ae4fc5c85d4c8a6": "314807840000000000000000",
+ "0x1c94d636e684eb155895ce6db4a2588fba1d001b": "2000000000000000000000",
+ "0xc721b2a7aa44c21298e85039d00e2e460e670b9c": "140800000000000000000",
+ "0x2d89a8006a4f137a20dc2bec46fe2eb312ea9654": "200000000000000000000",
+ "0x646afba71d849e80c0ed59cac519b278e7f7abe4": "1000000000000000000000",
+ "0x71f2cdd1b046e2da2fbb5a26723422b8325e25a3": "99960000000000000000",
+ "0x2c9fa72c95f37d08e9a36009e7a4b07f29bad41a": "16100000000000000000",
+ "0x848fbd29d67cf4a013cb02a4b176ef244e9ee68d": "20116000000000000000",
+ "0x68190ca885da4231874c1cfb42b1580a21737f38": "3820000000000000000000",
+ "0x9adf458bff3599eee1a26398853c575bc38c6313": "280000000000000000000",
+ "0xb72220ade364d0369f2d2da783ca474d7b9b34ce": "499986000000000000000",
+ "0x38e2af73393ea98a1d993a74df5cd754b98d529a": "1790000000000000000000",
+ "0x4d38d90f83f4515c03cc78326a154d358bd882b7": "185000000000000000000",
+ "0xaa8eb0823b07b0e6d20aadda0e95cf3835be192e": "32000000000000000000",
+ "0x008639dabbe3aeac887b5dc0e43e13bcd287d76c": "310200000000000000000",
+ "0xfa3a0c4b903f6ea52ea7ab7b8863b6a616ad6650": "20000000000000000000",
+ "0xe26bf322774e18288769d67e3107deb7447707b8": "2000000000000000000000",
+ "0xe061a4f2fc77b296d19ada238e49a5cb8ecbfa70": "4000000000000000000000",
+ "0xb320834836d1dbfda9e7a3184d1ad1fd4320ccc0": "1000000000000000000000",
+ "0x0ed3bb3a4eb554cfca97947d575507cdfd6d21d8": "547863000000000000000",
+ "0x32fa0e86cd087dd68d693190f32d93310909ed53": "4000000000000000000000",
+ "0x5b759fa110a31c88469f54d44ba303d57dd3e10f": "1683760000000000000000",
+ "0x136f4907cab41e27084b9845069ff2fd0c9ade79": "4000000000000000000000",
+ "0x3d89e505cb46e211a53f32f167a877bec87f4b0a": "25019000000000000000",
+ "0x57a852fdb9b1405bf53ccf9508f83299d3206c52": "2000000000000000000000",
+ "0x747abc9649056d3926044d28c3ad09ed17b67d70": "5000057000000000000000",
+ "0x5c29f9e9a523c1f8669448b55c48cbd47c25e610": "964320000000000000000",
+ "0x30a9da72574c51e7ee0904ba1f73a6b7b83b9b9d": "20200000000000000000",
+ "0x220e2b92c0f6c902b513d9f1e6fab6a8b0def3d7": "800000000000000000000",
+ "0x5af7c072b2c5acd71c76addcce535cf7f8f93585": "20000000000000000000",
+ "0x81556db27349ab8b27004944ed50a46e941a0f5f": "3998000000000000000000",
+ "0x987618c85656207c7bac1507c0ffefa2fb64b092": "64419000000000000000",
+ "0xe0f372347c96b55f7d4306034beb83266fd90966": "400000000000000000000",
+ "0x71784c105117c1f68935797fe159abc74e43d16a": "2001600000000000000000",
+ "0x9284f96ddb47b5186ee558aa31324df5361c0f73": "16000000000000000000000",
+ "0xa60c1209754f5d87b181da4f0817a81859ef9fd8": "50000000000000000000",
+ "0x5afda9405c8e9736514574da928de67456010918": "6008500000000000000000",
+ "0x6978696d5150a9a263513f8f74c696f8b1397cab": "6640000000000000000000",
+ "0xa9ad1926bc66bdb331588ea8193788534d982c98": "30000000000000000000000",
+ "0xe3f80b40fb83fb97bb0d5230af4f6ed59b1c7cc8": "1337000000000000000000",
+ "0xe207578e1f4ddb8ff6d5867b39582d71b9812ac5": "3880000000000000000000",
+ "0x86883d54cd3915e549095530f9ab1805e8c5432d": "4000000000000000000000",
+ "0x6974c8a414ceaefd3c2e4dfdbef430568d9a960b": "334250000000000000000",
+ "0x532d32b00f305bcc24dcef56817d622f34fb2c24": "1800000000000000000000",
+ "0x761f8a3a2af0a8bdbe1da009321fb29764eb62a1": "10000000000000000000000",
+ "0x4677b04e0343a32131fd6abb39b1b6156bba3d5b": "200000000000000000000",
+ "0xef69781f32ffce33346f2c9ae3f08493f3e82f89": "18200000000000000000",
+ "0xe3b3d2c9bf570be6a2f72adca1862c310936a43c": "100100000000000000000",
+ "0xd19caf39bb377fdf2cf19bd4fb52591c2631a63c": "1000000000000000000000",
+ "0x5d68324bcb776d3ffd0bf9fea91d9f037fd6ab0f": "2000000000000000000000",
+ "0x1c99fe9bb6c6d1066d912099547fd1f4809eacd9": "2000000000000000000000",
+ "0xbbfe0a830cace87b7293993a7e9496ce64f8e394": "6000000000000000000000",
+ "0x26c0054b700d3a7c2dcbe275689d4f4cad16a335": "2000000000000000000000",
+ "0x7d7e7c61779adb7706c94d32409a2bb4e994bf60": "865992000000000000000",
+ "0xd037d215d11d1df3d54fbd321cd295c5465e273b": "1400000000000000000000",
+ "0x08166f02313feae18bb044e7877c808b55b5bf58": "1970000000000000000000",
+ "0x781b1501647a2e06c0ed43ff197fccec35e1700b": "3000000000000000000000",
+ "0x74316adf25378c10f576d5b41a6f47fa98fce33d": "336082000000000000000",
+ "0x44e2fdc679e6bee01e93ef4a3ab1bcce012abc7c": "410231000000000000000",
+ "0x178eaf6b8554c45dfde16b78ce0c157f2ee31351": "320000000000000000000",
+ "0xcf923a5d8fbc3d01aa079d1cfe4b43ce071b1611": "2000000000000000000000",
+ "0x0c28847e4f09dfce5f9b25af7c4e530f59c880fe": "1000000000000000000000",
+ "0x54ce88275956def5f9458e3b95decacd484021a0": "2000000000000000000000",
+ "0x9d4213339a01551861764c87a93ce8f85f87959a": "200000000000000000000",
+ "0xe559b5fd337b9c5572a9bf9e0f2521f7d446dbe4": "200000000000000000000",
+ "0xdcb03bfa6c1131234e56b7ea7c4f721487546b7a": "1337000000000000000000",
+ "0xdb6ff71b3db0928f839e05a7323bfb57d29c87aa": "910000000000000000000",
+ "0xeb7c202b462b7cc5855d7484755f6e26ef43a115": "2000000000000000000000",
+ "0x323486ca64b375474fb2b759a9e7a135859bd9f6": "400000000000000000000",
+ "0x2c1df8a76f48f6b54bcf9caf56f0ee1cf57ab33d": "10118000000000000000000",
+ "0x2cd87866568dd81ad47d9d3ad0846e5a65507373": "400000000000000000000",
+ "0x8566610901aace38b83244f3a9c831306a67b9dc": "3256000000000000000000",
+ "0x1c257ad4a55105ea3b58ed374b198da266c85f63": "10000000000000000000000",
+ "0xcf4f1138f1bd6bf5b6d485cce4c1017fcb85f07d": "882038000000000000000",
+ "0xc934becaf71f225f8b4a4bf7b197f4ac9630345c": "20000000000000000000000",
+ "0x1e2bf4ba8e5ef18d37de6d6ad636c4cae489d0cc": "2000000000000000000000",
+ "0x9d78a975b7db5e4d8e28845cfbe7e31401be0dd9": "1340000000000000000000",
+ "0x16aa52cb0b554723e7060f21f327b0a68315fea3": "250000000000000000000",
+ "0x97e28973b860c567402800fbb63ce39a048a3d79": "97000000000000000000",
+ "0x4ac5acad000b8877214cb1ae00eac9a37d59a0fd": "4000000000000000000000",
+ "0x01226e0ad8d62277b162621c62c928e96e0b9a8c": "2000000000000000000000",
+ "0x479abf2da4d58716fd973a0d13a75f530150260a": "20000000000000000000",
+ "0x31d81d526c195e3f10b5c6db52b5e59afbe0a995": "264000000000000000000",
+ "0x749087ac0f5a97c6fad021538bf1d6cda18e0daa": "1000000000000000000000",
+ "0x1565af837ef3b0bd4e2b23568d5023cd34b16498": "393284000000000000000",
+ "0x997d6592a31589acc31b9901fbeb3cc3d65b3215": "2000000000000000000000",
+ "0x9d207517422cc0d60de7c237097a4d4fce20940c": "500000000000000000000",
+ "0x24b8b446debd1947955dd084f2c544933346d3ad": "4324135000000000000000",
+ "0x107a03cf0842dbdeb0618fb587ca69189ec92ff5": "1970000000000000000000",
+ "0x7f603aec1759ea5f07c7f8d41a1428fbbaf9e762": "20000000000000000000",
+ "0x53a244672895480f4a2b1cdf7da5e5a242ec4dbc": "1000000000000000000000",
+ "0x7db4c7d5b797e9296e6382f203693db409449d62": "400000000000000000000",
+ "0x2ae82dab92a66389eea1abb901d1d57f5a7cca0b": "2000000000000000000000",
+ "0x16bc40215abbd9ae5d280b95b8010b4514ff1292": "200000000000000000000",
+ "0xbba4fac3c42039d828e742cde0efffe774941b39": "1999946000000000000000",
+ "0x5431ca427e6165a644bae326bd09750a178c650d": "2000000000000000000000",
+ "0xdcf33965531380163168fc11f67e89c6f1bc178a": "334885000000000000000",
+ "0x65fd02d704a12a4dace9471b0645f962a89671c8": "28615000000000000000",
+ "0x135d1719bf03e3f866312479fe338118cd387e70": "2000000000000000000000",
+ "0xf3159866c2bc86bba40f9d73bb99f1eee57bb9d7": "1000000000000000000000",
+ "0xe3a4621b66004588e31206f718cb00a319889cf0": "2000000000000000000000",
+ "0xabcdbc8f1dd13af578d4a4774a62182bedf9f9be": "36660000000000000000",
+ "0x9fbe066de57236dc830725d32a02aef9246c6c5e": "2000000000000000000000",
+ "0x81cfad760913d3c322fcc77b49c2ae3907e74f6e": "197000000000000000000",
+ "0x0ab59d390702c9c059db148eb4f3fcfa7d04c7e7": "18200000000000000000",
+ "0x2c2db28c3309375eea3c6d72cd6d0eec145afcc0": "2000000000000000000000",
+ "0x08306de51981e7aca1856859b7c778696a6b69f9": "3200000000000000000000",
+ "0xf814799f6ddf4dcb29c7ee870e75f9cc2d35326d": "1000000000000000000000",
+ "0xee867d20916bd2e9c9ece08aa04385db667c912e": "50000000000000000000000",
+ "0x97a86f01ce3f7cfd4441330e1c9b19e1b10606ef": "2000000000000000000000",
+ "0x4c759813ad1386bed27ffae9e4815e3630cca312": "2000000000000000000000",
+ "0x8f226096c184ebb40105e08dac4d22e1c2d54d30": "306552000000000000000",
+ "0x13acada8980affc7504921be84eb4944c8fbb2bd": "1601600000000000000000",
+ "0x122dcfd81addb97d1a0e4925c4b549806e9f3beb": "1514954000000000000000",
+ "0x232f525d55859b7d4e608d20487faadb00293135": "4000000000000000000000",
+ "0x6f7ac681d45e418fce8b3a1db5bc3be6f06c9849": "2000000000000000000000",
+ "0x0c8692eeff2a53d6d1688ed56a9ddbbd68dabba1": "2000000000000000000000",
+ "0x6a6337833f8f6a6bf10ca7ec21aa810ed444f4cb": "1028200000000000000000",
+ "0x209377b6ad3fe101c9685b3576545c6b1684e73c": "1820000000000000000000",
+ "0x560fc08d079f047ed8d7df75551aa53501f57013": "7600000000000000000000",
+ "0x8e78f351457d016f4ad2755ec7424e5c21ba6d51": "146000000000000000000",
+ "0x2ce11a92fad024ff2b3e87e3b542e6c60dcbd996": "4000000000000000000000",
+ "0x8ab839aeaf2ad37cb78bacbbb633bcc5c099dc46": "2000000000000000000000",
+ "0x673144f0ec142e770f4834fee0ee311832f3087b": "500038000000000000000",
+ "0xba8a63f3f40de4a88388bc50212fea8e064fbb86": "2000000000000000000000",
+ "0xee899b02cbcb3939cd61de1342d50482abb68532": "1760000000000000000000",
+ "0xc2d9eedbc9019263d9d16cc5ae072d1d3dd9db03": "20000000000000000000000",
+ "0x355c0c39f5d5700b41d375b3f17851dcd52401f9": "3979000000000000000000",
+ "0x8179c80970182cc5b7d82a4df06ea94db63a25f3": "727432000000000000000",
+ "0xb388b5dfecd2c5e4b596577c642556dbfe277855": "20000000000000000000",
+ "0xa9e28337e6357193d9e2cb236b01be44b81427df": "2200000000000000000000",
+ "0x04ba4bb87140022c214a6fac42db5a16dd954045": "1000000000000000000000",
+ "0x67c926093e9b8927933810d98222d62e2b8206bb": "1910000000000000000000",
+ "0xed7346766e1a676d0d06ec821867a276a083bf31": "4012890000000000000000",
+ "0x92558226b384626cad48e09d966bf1395ee7ea5d": "334250000000000000000",
+ "0xbdf693f833c3fe471753184788eb4bfe4adc3f96": "1970000000000000000000",
+ "0x4474299d0ee090dc90789a1486489c3d0d645e6d": "1000000000000000000000",
+ "0xb1178ad47383c31c8134a1941cbcd474d06244e2": "1000000000000000000000",
+ "0x979d681c617da16f21bcaca101ed16ed015ab696": "1880000000000000000000",
+ "0x6b20c080606a79c73bd8e75b11717a4e8db3f1c3": "299720000000000000000",
+ "0xb85218f342f8012eda9f274e63ce2152b2dcfdab": "3100000000000000000000",
+ "0x530b61e42f39426d2408d40852b9e34ab5ebebc5": "267400000000000000000",
+ "0x76afc225f4fa307de484552bbe1d9d3f15074c4a": "2998800000000000000000",
+ "0x1e783e522ab7df0acaac9eeed3593039e5ac7579": "203435800000000000000000",
+ "0x0f7bf6373f771a4601762c4dae5fbbf4fedd9cc9": "2000000000000000000000",
+ "0x7a8797690ab77b5470bf7c0c1bba612508e1ac7d": "8865000000000000000000",
+ "0x2a2ab6b74c7af1d9476bb5bcb4524797bedc3552": "1000000000000000000000",
+ "0x523e140dc811b186dee5d6c88bf68e90b8e096fd": "2000000000000000000000",
+ "0xea8168fbf225e786459ca6bb18d963d26b505309": "500000000000000000000",
+ "0x20ff3ede8cadb5c37b48cb14580fb65e23090a7b": "42000000000000000000000",
+ "0xe482d255ede56b04c3e8df151f56e9ca62aaa8c2": "500000000000000000000",
+ "0x2e0880a34596230720f05ac8f065af8681dcb6c2": "100000000000000000000000",
+ "0xc674f28c8afd073f8b799691b2f0584df942e844": "2000000000000000000000",
+ "0xb646df98b49442746b61525c81a3b04ba3106250": "1970000000000000000000",
+ "0xd55c1c8dfbe1e02cacbca60fdbdd405b09f0b75f": "2000000000000000000000",
+ "0x65ebaed27edb9dcc1957aee5f452ac2105a65c0e": "43531987000000000000000",
+ "0xf079e1b1265f50e8c8a98ec0c7815eb3aeac9eb4": "20094000000000000000",
+ "0x867eba56748a5904350d2ca2a5ce9ca00b670a9b": "20000000000000000000000",
+ "0x51ee0cca3bcb10cd3e983722ced8493d926c0866": "999972000000000000000",
+ "0x88d541c840ce43cefbaf6d19af6b9859b573c145": "170000000000000000000",
+ "0xf851b010f633c40af1a8f06a73ebbaab65077ab5": "4400000000000000000000",
+ "0xe0aa69365555b73f282333d1e30c1bbd072854e8": "7000000000000000000000",
+ "0xc7b1c83e63203f9547263ef6282e7da33b6ed659": "18200000000000000000",
+ "0xaf06f5fa6d1214ec43967d1bd4dde74ab814a938": "88000000000000000000",
+ "0x991173601947c2084a62d639527e961512579af9": "600000000000000000000",
+ "0x7a381122bada791a7ab1f6037dac80432753baad": "10000000000000000000000",
+ "0xe766f34ff16f3cfcc97321721f43ddf5a38b0cf4": "1550000000000000000000",
+ "0xd785a8f18c38b9bc4ffb9b8fa8c7727bd642ee1c": "1000000000000000000000",
+ "0xaebd4f205de799b64b3564b256d42a711d37ef99": "1177100000000000000000",
+ "0xa2fa17c0fb506ce494008b9557841c3f641b8cae": "20000000000000000000",
+ "0xa8aca748f9d312ec747f8b6578142694c7e9f399": "2000000000000000000000",
+ "0x950c68a40988154d2393fff8da7ccda99614f72c": "4597943000000000000000",
+ "0x075d15e2d33d8b4fa7dba8b9e607f04a261e340b": "1910000000000000000000",
+ "0x3616d448985f5d32aefa8b93a993e094bd854986": "205400000000000000000",
+ "0x4bb9655cfb2a36ea7c637a7b859b4a3154e26ebe": "16000000000000000000000",
+ "0x84949dba559a63bfc845ded06e9f2d9b7f11ef24": "2000000000000000000000",
+ "0x937563d8a80fd5a537b0e66d20a02525d5d88660": "2500000000000000000000",
+ "0xb183ebee4fcb42c220e47774f59d6c54d5e32ab1": "1604266000000000000000",
+ "0x21e5d77320304c201c1e53b261a123d0a1063e81": "86972000000000000000",
+ "0xfa14b566234abee73042c31d21717182cba14aa1": "328000000000000000000",
+ "0x2da617695009cc57d26ad490b32a5dfbeb934e5e": "20000000000000000000000",
+ "0x3326b88de806184454c40b27f309d9dd6dcfb978": "17900000000000000000000",
+ "0x95e6a54b2d5f67a24a4875af75107ca7ea9fd2fa": "1337000000000000000000",
+ "0x8db58e406e202df9bc703c480bd8ed248d52a032": "2000000000000000000000",
+ "0xf777361a3dd8ab62e5f1b9b047568cc0b555704c": "1000000000000000000000",
+ "0x83a93b5ba41bf88720e415790cdc0b67b4af34c4": "200000000000000000000",
+ "0x8a1cc5ac111c49bfcfd848f37dd768aa65c88802": "10000000000000000000000",
+ "0x52214378b54004056a7cc08c891327798ac6b248": "15200000000000000000000",
+ "0xad80d865b85c34d2e6494b2e7aefea6b9af184db": "4000000000000000000000",
+ "0xe7d6240620f42c5edbb2ede6aec43da4ed9b5757": "1000000000000000000000",
+ "0xd0e35e047646e759f4517093d6408642517f084d": "3939507000000000000000",
+ "0x9340345ca6a3eabdb77363f2586043f29438ce0b": "530922000000000000000",
+ "0x6640ccf053555c130ae2b656647ea6e31637b9ab": "1970000000000000000000",
+ "0x184d86f3466ae6683b19729982e7a7e1a48347b2": "10000000000000000000000",
+ "0x84ec06f24700fe42414cb9897c154c88de2f6132": "1337000000000000000000",
+ "0xd1e5e234a9f44266a4a6241a84d7a1a55ad5a7fe": "20000000000000000000000",
+ "0xe8a9a41740f44f54c3688b53e1ddd42e43c9fe94": "4000000000000000000000",
+ "0x6e3a51db743d334d2fe88224b5fe7c008e80e624": "106000000000000000000",
+ "0x3e94df5313fa520570ef232bc3311d5f622ff183": "2000000000000000000000",
+ "0x8957727e72cf629020f4e05edf799aa7458062d0": "2200000000000000000000",
+ "0xcf5e0eacd1b39d0655f2f77535ef6608eb950ba0": "2000000000000000000000",
+ "0xf4aaa3a6163e3706577b49c0767e948a681e16ee": "2000000000000000000000",
+ "0x97f1fe4c8083e596212a187728dd5cf80a31bec5": "20000000000000000000",
+ "0x57d5fd0e3d3049330ffcdcd020456917657ba2da": "1991240000000000000000",
+ "0x49bdbc7ba5abebb6389e91a3285220d3451bd253": "1000000000000000000000",
+ "0xae126b382cf257fad7f0bc7d16297e54cc7267da": "300000000000000000000",
+ "0xbbf8616d97724af3def165d0e28cda89b800009a": "114063000000000000000",
+ "0xadb948b1b6fefe207de65e9bbc2de98e605d0b57": "2000000000000000000000",
+ "0x8a217db38bc35f215fd92906be42436fe7e6ed19": "6000000000000000000000",
+ "0xe28b062259e96eeb3c8d4104943f9eb325893cf5": "1337000000000000000000",
+ "0x6a6b18a45a76467e2e5d5a2ef911c3e12929857b": "82000000000000000000000",
+ "0xcb68ae5abe02dcf8cbc5aa719c25814651af8b85": "500000000000000000000",
+ "0x4c7e2e2b77ad0cd6f44acb2861f0fb8b28750ef9": "20000000000000000000",
+ "0x58ba1569650e5bbbb21d35d3e175c0d6b0c651a9": "500000000000000000000",
+ "0x1eb4bf73156a82a0a6822080c6edf49c469af8b9": "1910000000000000000000",
+ "0x4103299671d46763978fa4aa19ee34b1fc952784": "200000000000000000000",
+ "0xe321bb4a946adafdade4571fb15c0043d39ee35f": "1575212000000000000000",
+ "0x893608751d68d046e85802926673cdf2f57f7cb8": "19700000000000000000",
+ "0x70fee08b00c6c2c04a3c625c1ff77caf1c32df01": "200000000000000000000",
+ "0x7b0fea1176d52159333a143c294943da36bbddb4": "9380000000000000000000",
+ "0xd331c823825a9e5263d052d8915d4dcde07a5c37": "564000000000000000000",
+ "0xa45432a6f2ac9d56577b938a37fabac8cc7c461c": "1000000000000000000000",
+ "0x764fc46d428b6dbc228a0f5f55c9508c772eab9f": "26000000000000000000000",
+ "0x1a95a8a8082e4652e4170df9271cb4bb4305f0b2": "50000000000000000000",
+ "0x08c9f1bfb689fdf804d769f82123360215aff93b": "1970000000000000000000",
+ "0x1572cdfab72a01ce968e78f5b5448da29853fbdd": "5061500000000000000000",
+ "0x379c7166849bc24a02d6535e2def13daeef8aa8d": "100000000000000000000",
+ "0xe0a254ac09b9725bebc8e460431dd0732ebcabbf": "6000000000000000000000",
+ "0x3225c1ca5f2a9c88156bb7d9cdc44a326653c214": "400000000000000000000",
+ "0x84686c7bad762c54b667d59f90943cd14d117a26": "20000000000000000000",
+ "0x3d5a8b2b80be8b35d8ecf789b5ed7a0775c5076c": "20000000000000000000",
+ "0x2ccf80e21898125eb4e807cd82e09b9d28592f6e": "2000000000000000000000",
+ "0xdde969aef34ea87ac299b7597e292b4a0155cc8a": "298819000000000000000",
+ "0x19e94e620050aad766b9e1bad931238312d4bf49": "2396000000000000000000",
+ "0x959f57fded6ae37913d900b81e5f48a79322c627": "255599000000000000000",
+ "0xb9b0a3219a3288d9b35b091b14650b8fe23dce2b": "14000000000000000000000",
+ "0x3575c770668a9d179f1ef768c293f80166e2aa3d": "474000000000000000000",
+ "0x58f05b262560503ca761c61890a4035f4c737280": "8000000000000000000000",
+ "0x3286d1bc657a312c8847d93cb3cb7950f2b0c6e3": "20000000000000000000000",
+ "0x1d9e6aaf8019a05f230e5def05af5d889bd4d0f2": "133700000000000000000",
+ "0xa375b4bc24a24e1f797593cc302b2f331063fa5c": "200000000000000000000",
+ "0x108ba7c2895c50e072dc6f964932d50c282d3034": "500000000000000000000",
+ "0xb6b34a263f10c3d2eceb0acc559a7b2ab85ce565": "4000000000000000000000",
+ "0xa4d2b429f1ad5349e31704969edc5f25ee8aca10": "10000000000000000000000",
+ "0x674adb21df4c98c7a347ac4c3c24266757dd7039": "2000000000000000000000",
+ "0x33565ba9da2c03e778ce12294f081dfe81064d24": "16000000000000000000000",
+ "0x4ddda7586b2237b053a7f3289cf460dc57d37a09": "10000000000000000000000",
+ "0xcc4faac00be6628f92ef6b8cb1b1e76aac81fa18": "205410000000000000000",
+ "0x5f99dc8e49e61d57daef606acdd91b4d7007326a": "3000000000000000000000",
+ "0xb8a979352759ba09e35aa5935df175bff678a108": "20000000000000000000",
+ "0x86fff220e59305c09f483860d6f94e96fbe32f57": "42900000000000000000",
+ "0x03e8b084537557e709eae2e1e1a5a6bce1ef8314": "20000000000000000000",
+ "0xdda4ff7de491c687df4574dd1b17ff8f246ba3d1": "19600000000000000000000",
+ "0x2538532936813c91e653284f017c80c3b8f8a36f": "2002000000000000000000",
+ "0x5a82f96cd4b7e2d93d10f3185dc8f43d4b75aa69": "1999400000000000000000",
+ "0x86740a46648e845a5d96461b18091ff57be8a16f": "98000000000000000000000",
+ "0x7e3f63e13129a221ba1ab06326342cd98b5126ae": "1597960000000000000000",
+ "0x1f5f3b34bd134b2781afe5a0424ac5846cdefd11": "99000000000000000000",
+ "0x39936c2719450b9420cc2522cf91db01f227c1c1": "500000000000000000000",
+ "0x967076a877b18ec15a415bb116f06ef32645dba3": "2000000000000000000000",
+ "0xa42908e7fe53980a9abf4044e957a54b70e99cbe": "2000000000000000000000",
+ "0x5eb371c407406c427b3b7de271ad3c1e04269579": "3000000000000000000000",
+ "0xa570223ae3caa851418a9843a1ac55db4824f4fd": "200000000000000000000",
+ "0x764692cccb33405dd0ab0c3379b49caf8e6221ba": "20000000000000000000",
+ "0xa365918bfe3f2627b9f3a86775d8756e0fd8a94b": "400000000000000000000",
+ "0x069ed0ab7aa77de571f16106051d92afe195f2d0": "200000000000000000000",
+ "0xbd432a3916249b4724293af9146e49b8280a7f2a": "4000000000000000000000",
+ "0x61c9dce8b2981cb40e98b0402bc3eb28348f03ac": "196910000000000000000",
+ "0x8f1fcc3c51e252b693bc5b0ec3f63529fe69281e": "6000000000000000000000",
+ "0x55fd08d18064bd202c0ec3d2cce0ce0b9d169c4d": "1970000000000000000000",
+ "0x383a7c899ee18bc214969870bc7482f6d8f3570e": "10000000000000000000000",
+ "0xb14cc8de33d6338236539a489020ce4655a32bc6": "8000000000000000000000",
+ "0x448bf410ad9bbc2fecc4508d87a7fc2e4b8561ad": "199955000000000000000",
+ "0x06f7dc8d1b9462cef6feb13368a7e3974b097f9f": "2000000000000000000000",
+ "0x9c9f89a3910f6a2ae8a91047a17ab788bddec170": "10000000000000000000000",
+ "0x5de598aba344378cab4431555b4f79992dc290c6": "1337000000000000000000",
+ "0x87e6034ecf23f8b5639d5f0ea70a22538a920423": "328000000000000000000",
+ "0x8b27392206b958cd375d7ef8af2cf8ef0598c0bc": "1000000000000000000000",
+ "0x49136fe6e28b7453fcb16b6bbbe9aaacba8337fd": "2000000000000000000000",
+ "0x6982fe8a867e93eb4a0bd051589399f2ec9a5292": "2000000000000000000000",
+ "0x9fd1052a60506bd1a9ef003afd9d033c267d8e99": "1000000000000000000000",
+ "0xd38fa2c4cc147ad06ad5a2f75579281f22a7cc1f": "20000000000000000000000",
+ "0x6f794dbdf623daa6e0d00774ad6962737c921ea4": "2000000000000000000000",
+ "0xe96b184e1f0f54924ac874f60bbf44707446b72b": "2910840000000000000000",
+ "0xb5ba29917c78a1d9e5c5c713666c1e411d7f693a": "3100000000000000000000",
+ "0x81d619ff5726f2405f12904c72eb1e24a0aaee4f": "20000000000000000000000",
+ "0xb02fa29387ec12e37f6922ac4ce98c5b09e0b00f": "2000000000000000000000",
+ "0xb7230d1d1ff2aca366963914a79df9f7c5ea2c98": "8000000000000000000000",
+ "0x7b4007c45e5a573fdbb6f8bd746bf94ad04a3c26": "15202564000000000000000",
+ "0x8d9a0c70d2262042df1017d6c303132024772712": "2000000000000000000000",
+ "0x323aad41df4b6fc8fece8c93958aa901fa680843": "970000000000000000000",
+ "0xdb04fad9c49f9e880beb8fcf1d3a3890e4b3846f": "1242482000000000000000",
+ "0x27824666d278d70423f03dfe1dc7a3f02f43e2b5": "1000070000000000000000",
+ "0xe04920dc6ecc1d6ecc084f88aa0af5db97bf893a": "182000000000000000000",
+ "0xb0c1b177a220e41f7c74d07cde8569c21c75c2f9": "5600000000000000000000",
+ "0x7864dc999fe4f8e003c0f43decc39aae1522dc0f": "94400000000000000000",
+ "0xc75c37ce2da06bbc40081159c6ba0f976e3993b1": "1078640000000000000000",
+ "0x179a825e0f1f6e985309668465cffed436f6aea9": "20000000000000000000",
+ "0x2c6b699d9ead349f067f45711a074a641db6a897": "20000000000000000000",
+ "0x068ce8bd6e902a45cb83b51541b40f39c4469712": "5240000000000000000000",
+ "0x767ac690791c2e23451089fe6c7083fe55deb62b": "820000000000000000000",
+ "0xb34f04b8db65bba9c26efc4ce6efc50481f3d65d": "20000000000000000000000",
+ "0x29aef48de8c9fbad4b9e4ca970797a5533eb722d": "10000000000000000000000",
+ "0x0a0ecda6636f7716ef1973614687fd89a820a706": "394000000000000000000",
+ "0xb32825d5f3db249ef4e85cc4f33153958976e8bc": "501375000000000000000",
+ "0x7ef16fd8d15b378a0fba306b8d03dd98fc92619f": "700000000000000000000",
+ "0xb58b52865ea55d8036f2fab26098b352ca837e18": "18200000000000000000",
+ "0x9b658fb361e046d4fcaa8aef6d02a99111223625": "2000000000000000000000",
+ "0xb2a498f03bd7178bd8a789a00f5237af79a3e3f8": "19400000000000000000000",
+ "0xcb48fe8265d9af55eb7006bc335645b0a3a183be": "3000000000000000000000",
+ "0x3cf9a1d465e78b7039e3694478e2627b36fcd141": "1372000000000000000000",
+ "0x5db84400570069a9573cab04b4e6b69535e202b8": "9700000000000000000000",
+ "0x214c89c5bd8e7d22bc574bb35e48950211c6f776": "18903000000000000000",
+ "0x53396f4a26c2b4604496306c5442e7fcba272e36": "20055000000000000000000",
+ "0x720994dbe56a3a95929774e20e1fe525cf3704e4": "8000000000000000000000",
+ "0x3571cf7ad304ecaee595792f4bbfa484418549d6": "5825500000000000000000",
+ "0x6042c644bae2b96f25f94d31f678c90dc96690db": "2000000000000000000000",
+ "0x2e24b597873bb141bdb237ea8a5ab747799af02d": "20000000000000000000000",
+ "0x08c802f87758349fa03e6bc2e2fd0791197eea9a": "2000000000000000000000",
+ "0x297a88921b5fca10e5bb9ded60025437ae221694": "200000000000000000000",
+ "0xaee49d68adedb081fd43705a5f78c778fb90de48": "20000000000000000000",
+ "0x4cee901b4ac8b156c5e2f8a6f1bef572a7dceb7e": "1000000000000000000000",
+ "0xdfaf31e622c03d9e18a0ddb8be60fbe3e661be0a": "9999800000000000000000",
+ "0x00aa5381b2138ebeffc191d5d8c391753b7098d2": "990049000000000000000",
+ "0x5b4c0c60f10ed2894bdb42d9dd1d210587810a0d": "500000000000000000000",
+ "0xc44f4ab5bc60397c737eb0683391b633f83c48fa": "1000000000000000000000",
+ "0x50bef2756248f9a7a380f91b051ba3be28a649ed": "1999884000000000000000",
+ "0x1bd909ac0d4a1102ec98dcf2cca96a0adcd7a951": "20055000000000000000",
+ "0x9ec03e02e587b7769def538413e97f7e55be71d8": "19700000000000000000000",
+ "0x9874803fe1f3a0365e7922b14270eaeb032cc1b5": "1124500000000000000000",
+ "0x4e2310191ead8d3bc6489873a5f0c2ec6b87e1be": "1000000000000000000000",
+ "0x93678a3c57151aeb68efdc43ef4d36cb59a009f3": "30060000000000000000",
+ "0xf483f607a21fcc28100a018c568ffbe140380410": "1000000000000000000000",
+ "0x2a91a9fed41b7d0e5cd2d83158d3e8a41a9a2d71": "1940000000000000000000",
+ "0x240e559e274aaef0c258998c979f671d1173b88b": "4000000000000000000000",
+ "0x108a2b7c336f784779d8b54d02a8d31d9a139c0a": "10000000000000000000000",
+ "0x9c98fdf1fdcd8ba8f4c5b04c3ae8587efdf0f6e6": "6000000000000000000000",
+ "0x194ff44aefc17bd20efd7a204c47d1620c86db5d": "2999400000000000000000",
+ "0x1f8116bd0af5570eaf0c56c49c7ab5e37a580458": "2000000000000000000000",
+ "0xd79835e404fb86bf845fba090d6ba25e0c8866a6": "2400000000000000000000",
+ "0xa8e7201ff619faffc332e6ad37ed41e301bf014a": "600000000000000000000",
+ "0x286906b6bd4972e3c71655e04baf36260c7cb153": "340000000000000000000",
+ "0xdb4bc83b0e6baadb1156c5cf06e0f721808c52c7": "880000000000000000000",
+ "0xa158148a2e0f3e92dc2ce38febc20107e3253c96": "2000000000000000000000",
+ "0x9f6a322a6d469981426ae844865d7ee0bb15c7b3": "50003000000000000000",
+ "0x32f29e8727a74c6b4301e3ffff0687c1b870dae9": "1000000000000000000000",
+ "0x19918aa09e7d494e98ffa5db50350892f7156ac6": "10000000000000000000000",
+ "0x5a5f8508da0ebebb90be9033bd4d9e274105ae00": "6685000000000000000000",
+ "0x6fc25e7e00ca4f60a9fe6f28d1fde3542e2d1079": "792000000000000000000",
+ "0x72094f3951ffc9771dced23ada080bcaf9c7cca7": "6000000000000000000000",
+ "0x43f7e86e381ec51ec4906d1476cba97a3db584e4": "1000000000000000000000",
+ "0x05696b73916bd3033e05521e3211dfec026e98e4": "2000000000000000000000",
+ "0x5e7f70378775589fc66a81d3f653e954f55560eb": "2434000000000000000000",
+ "0x895613236f3584216ad75c5d3e07e3fa6863a778": "2000000000000000000000",
+ "0x4eb1454b573805c8aca37edec7149a41f61202f4": "300000000000000000000",
+ "0xd99999a2490d9494a530cae4daf38554f4dd633e": "120000000000000000000",
+ "0x1704cefcfb1331ec7a78388b29393e85c1af7916": "400000000000000000000",
+ "0xac4acfc36ed6094a27e118ecc911cd473e8fb91f": "1799800000000000000000",
+ "0xa975b077fcb4cc8efcbf838459b6fa243a4159d6": "40000000000000000000",
+ "0x9c405cf697956138065e11c5f7559e67245bd1a5": "200000000000000000000",
+ "0xcafde855864c2598da3cafc05ad98df2898e8048": "14179272000000000000000",
+ "0x8ef711e43a13918f1303e81d0ea78c9eefd67eb2": "4000000000000000000000",
+ "0x0b14891999a65c9ef73308efe3100ca1b20e8192": "800000000000000000000",
+ "0x47cf9cdaf92fc999cc5efbb7203c61e4f1cdd4c3": "131400000000000000000",
+ "0x04ba8a3f03f08b895095994dda619edaacee3e7a": "2000000000000000000000",
+ "0x02b6d65cb00b7b36e1fb5ed3632c4cb20a894130": "20000000000000000000000",
+ "0xf99aee444b5783c093cfffd1c4632cf93c6f050c": "400000000000000000000",
+ "0x2541314a0b408e95a694444977712a50713591ab": "1634706000000000000000",
+ "0x3096dca34108085bcf04ae72b94574a13e1a3e1d": "200000000000000000000",
+ "0x56df05bad46c3f00ae476ecf017bb8c877383ff1": "197248000000000000000",
+ "0x6d59b21cd0e2748804d9abe064eac2bef0c95f27": "2000000000000000000000",
+ "0xb29f5b7c1930d9f97a115e067066f0b54db44b3b": "1000000000000000000000",
+ "0x888c16144933197cac26504dd76e06fd6600c789": "100000000000000000000",
+ "0xdfe3c52a92c30396a4e33a50170dc900fcf8c9cf": "50000000000000000000",
+ "0xf76f69cee4faa0a63b30ae1e7881f4f715657010": "200000000000000000000",
+ "0xee0007b0960d00908a94432a737557876aac7c31": "53053000000000000000",
+ "0xeffc15e487b1beda0a8d1325bdb4172240dc540a": "64940000000000000000",
+ "0x40ab0a3e83d0c8ac9366910520eab1772bac3b1a": "976600000000000000000",
+ "0x1895a0eb4a4372722fcbc5afe6936f289c88a419": "910000000000000000000",
+ "0x81efe296ae76c860d1c5fbd33d47e8ce9996d157": "1000000000000000000000",
+ "0x9ddd355e634ee9927e4b7f6c97e7bf3a2f1e687a": "50000000000000000000",
+ "0xf2b4ab2c9427a9015ef6eefff5edb60139b719d1": "716800000000000000000",
+ "0x765be2e12f629e6349b97d21b62a17b7c830edab": "6000000000000000000000",
+ "0xff61c9c1b7a3d8b53bba20b34466544b7b216644": "2000000000000000000000",
+ "0x36a08fd6fd1ac17ce15ed57eefb12a2be28188bf": "1337000000000000000000",
+ "0x17049311101d817efb1d65910f663662a699c98c": "1999800000000000000000",
+ "0x30511832918d8034a7bee72ef2bfee440ecbbcf6": "16100000000000000000000",
+ "0xd27c234ff7accace3d996708f8f9b04970f97d36": "1337000000000000000000",
+ "0xa961171f5342b173dd70e7bfe5b5ca238b13bcdd": "3397053000000000000000",
+ "0x30bf61b2d877fe10635126326fa189e4b0b1c3b0": "1027580000000000000000",
+ "0x4bb6d86b8314c22d8d37ea516d0019f156aae12d": "1000000000000000000000",
+ "0x5f363e0ab747e02d1b3b66abb69ea53c7baf523a": "11640000000000000000000",
+ "0x283e11203749b1fa4f32febb71e49d135919382a": "1000000000000000000000",
+ "0xac5999a89d2dd286d5a80c6dee7e86aad40f9e12": "3880000000000000000000",
+ "0x3f6dd3650ee428dcb7759553b017a96a94286ac9": "1337000000000000000000",
+ "0xb3fc1d6881abfcb8becc0bb021b8b73b7233dd91": "50000000000000000000",
+ "0xf0832a6bb25503eeca435be31b0bf905ca1fcf57": "6685000000000000000000",
+ "0x9d7fda7070bf3ee9bbd9a41f55cad4854ae6c22c": "11027380000000000000000",
+ "0x4b0bd8acfcbc53a6010b40d4d08ddd2d9d69622d": "668500000000000000000",
+ "0xf3b668b3f14d920ebc379092db98031b67b219b3": "199955000000000000000",
+ "0xd91d889164479ce436ece51763e22cda19b22d6b": "3365200000000000000000",
+ "0xffe28db53c9044b4ecd4053fd1b4b10d7056c688": "100000000000000000000",
+ "0xc77b01a6e911fa988d01a3ab33646beef9c138f3": "721400000000000000000",
+ "0xc0064f1d9474ab915d56906c9fb320a2c7098c9b": "358000000000000000000",
+ "0x4e3edad4864dab64cae4c5417a76774053dc6432": "590943000000000000000",
+ "0x71d2cc6d02578c65f73c575e76ce8fbcfadcf356": "72400000000000000000",
+ "0x9971df60f0ae66dce9e8c84e17149f09f9c52f64": "200000000000000000000",
+ "0x58e661d0ba73d6cf24099a5562b808f7b3673b68": "2000000000000000000000",
+ "0x84b0ee6bb837d3a4c4c5011c3a228c0edab4634a": "20000000000000000000",
+ "0x84375afbf59b3a1d61a1be32d075e0e15a4fbca5": "200000000000000000000",
+ "0x9ae9476bfecd3591964dd325cf8c2a24faed82c1": "4000000000000000000000",
+ "0x6a4c8907b600248057b1e46354b19bdc859c991a": "20000000000000000000",
+ "0x1c045649cd53dc23541f8ed4d341812808d5dd9c": "7000000000000000000000",
+ "0xc5e488cf2b5677933971f64cb8202dd05752a2c0": "1000000000000000000000",
+ "0xeb25481fcd9c221f1ac7e5fd1ecd9307a16215b8": "197000000000000000000",
+ "0xa61887818f914a20e31077290b83715a6b2d6ef9": "1880000000000000000000",
+ "0x679437eacf437878dc293d48a39c87b7421a216c": "64528000000000000000",
+ "0x331a1c26cc6994cdd3c14bece276ffff4b9df77c": "18049000000000000000",
+ "0x75b95696e8ec4510d56868a7c1a735c68b244890": "6400000000000000000000",
+ "0xa77f3ee19e9388bbbb2215c62397b96560132360": "200000000000000000000",
+ "0xbc7afc8477412274fc265df13c054473427d43c6": "130034000000000000000",
+ "0x91050a5cffadedb4bb6eaafbc9e5013428e96c80": "1700000000000000000000",
+ "0x24586ec5451735eeaaeb470dc8736aae752f82e5": "17600000000000000000",
+ "0x51039377eed0c573f986c5e8a95fb99a59e9330f": "1970000000000000000000",
+ "0xfbb161fe875f09290a4b262bc60110848f0d2226": "2000000000000000000000",
+ "0xed52a2cc0869dc9e9f842bd0957c47a8e9b0c9ff": "9550000000000000000000",
+ "0xbad235d5085dc7b068a67c412677b03e1836884c": "2000000000000000000000",
+ "0x055eac4f1ad3f58f0bd024d68ea60dbe01c6afb3": "100000000000000000000",
+ "0x4058808816fdaa3a5fc98ed47cfae6c18315422e": "199800000000000000000",
+ "0x3540c7bd7a8442d5bee21a2180a1c4edff1649e0": "1239295000000000000000",
+ "0xc5edbbd2ca0357654ad0ea4793f8c5cecd30e254": "6000000000000000000000",
+ "0xb5906b0ae9a28158e8ac550e39da086ee3157623": "200000000000000000000",
+ "0x4d801093c19ca9b8f342e33cc9c77bbd4c8312cf": "345005000000000000000",
+ "0x206482ee6f138a778fe1ad62b180ce856fbb23e6": "2000000000000000000000",
+ "0xc0ed0d4ad10de03435b153a0fc25de3b93f45204": "3160000000000000000000",
+ "0x29e67990e1b6d52e1055ffe049c53195a81542cf": "20000000000000000000000",
+ "0xe6d22209ffd0b87509ade3a8e2ef429879cb89b5": "17260000000000000000000",
+ "0xd6644d40e90bc97fe7dfe7cabd3269fd579ba4b3": "159000000000000000000",
+ "0xece1290877b583e361a2d41b009346e6274e2538": "300000000000000000000",
+ "0xab3861226ffec1289187fb84a08ec3ed043264e8": "1000000000000000000000",
+ "0x60e0bdd0a259bb9cb09d3f37e5cd8b9daceabf8a": "1370000000000000000000",
+ "0x28b77585cb3d55a199ab291d3a18c68fe89a848a": "1960000000000000000000",
+ "0x73128173489528012e76b41a5e28c68ba4e3a9d4": "1000000000000000000000",
+ "0x018492488ba1a292342247b31855a55905fef269": "140000000000000000000",
+ "0x0bb54c72fd6610bfa4363397e020384b022b0c49": "1337000000000000000000",
+ "0x520f66a0e2657ff0ac4195f2f064cf2fa4b24250": "40000000000000000000",
+ "0xa1432ed2c6b7777a88e8d46d388e70477f208ca5": "7999538000000000000000",
+ "0x149ba10f0da2725dc704733e87f5a524ca88515e": "7880000000000000000000",
+ "0xb287f7f8d8c3872c1b586bcd7d0aedbf7e732732": "20000000000000000000",
+ "0xc46bbdef76d4ca60d316c07f5d1a780e3b165f7e": "2000000000000000000000",
+ "0xb5a589dd9f4071dbb6fba89b3f5d5dae7d96c163": "2000000000000000000000",
+ "0xd218efb4db981cdd6a797f4bd48c7c26293ceb40": "2975000000000000000000",
+ "0xaf87d2371ef378957fbd05ba2f1d66931b01e2b8": "700000000000000000000",
+ "0x86ef6426211949cc37f4c75e7850369d0cf5f479": "13399196000000000000000",
+ "0xfb3a0b0d6b6a718f6fc0292a825dc9247a90a5d0": "199950000000000000000",
+ "0xda16dd5c3d1a2714358fe3752cae53dbab2be98c": "19400000000000000000000",
+ "0x9eb7834e171d41e069a77947fca87622f0ba4e48": "100000000000000000000",
+ "0xe1d91b0954cede221d6f24c7985fc59965fb98b8": "2000000000000000000000",
+ "0x85d0d88754ac84b8b21ba93dd2bfec72626faba8": "1000000000000000000000",
+ "0x695b4cce085856d9e1f9ff3e79942023359e5fbc": "5000000000000000000000",
+ "0x9156d18029350e470408f15f1aa3be9f040a67c6": "1000000000000000000000",
+ "0xa9d64b4f3bb7850722b58b478ba691375e224e42": "6000000000000000000000",
+ "0x17e4a0e52bac3ee44efe0954e753d4b85d644e05": "2000000000000000000000",
+ "0xb8a79c84945e47a9c3438683d6b5842cff7684b1": "2000000000000000000000",
+ "0xcfac2e1bf33205b05533691a02267ee19cd81836": "1000000000000000000000",
+ "0x6b992521ec852370848ad697cc2df64e63cc06ff": "1000000000000000000000",
+ "0x60af0ee118443c9b37d2fead77f5e521debe1573": "1910000000000000000000",
+ "0xc6dbdb9efd5ec1b3786e0671eb2279b253f215ed": "1000000000000000000000",
+ "0x659c0a72c767a3a65ced0e1ca885a4c51fd9b779": "2000000000000000000000",
+ "0xed1276513b6fc68628a74185c2e20cbbca7817bf": "191000000000000000000",
+ "0x5ad12c5ed4fa827e2150cfa0d68c0aa37b1769b8": "800000000000000000000",
+ "0x17c0fef6986cfb2e4041f9979d9940b69dff3de2": "4000000000000000000000",
+ "0xca98c7988efa08e925ef9c9945520326e9f43b99": "4000000000000000000000",
+ "0xfe8f1fdcab7fbec9a6a3fcc507619600505c36a3": "19700000000000000000",
+ "0x4420aa35465be617ad2498f370de0a3cc4d230af": "2000000000000000000000",
+ "0x8232d1f9742edf8dd927da353b2ae7b4cbce7592": "668500000000000000000",
+ "0xeca5f58792b8c62d2af556717ee3ee3028be4dce": "2000000000000000000000",
+ "0x6bf86f1e2f2b8032a95c4d7738a109d3d0ed8104": "1820000000000000000000",
+ "0x3ac2f0ff1612e4a1c346d53382abf6d8a25baa53": "2000000000000000000000",
+ "0xdaa1bd7a9148fb865cd612dd35f162861d0f3bdc": "3066243000000000000000",
+ "0x5169c60aee4ceed1849ab36d664cff97061e8ea8": "3000000000000000000000",
+ "0x2a5e3a40d2cd0325766de73a3d671896b362c73b": "100000000000000000000000",
+ "0xa83382b6e15267974a8550b98f7176c1a353f9be": "3541608000000000000000",
+ "0xb50c149a1906fad2786ffb135aab501737e9e56f": "388000000000000000000",
+ "0xd9775965b716476675a8d513eb14bbf7b07cd14a": "5076200000000000000000",
+ "0x66662006015c1f8e3ccfcaebc8ee6807ee196303": "500024000000000000000",
+ "0x78746a958dced4c764f876508c414a68342cecb9": "50600000000000000000",
+ "0xe982e6f28c548f5f96f45e63f7ab708724f53fa1": "396238000000000000000",
+ "0x740bfd52e01667a3419b029a1b8e45576a86a2db": "16800000000000000000000",
+ "0x2bd252e0d732ff1d7c78f0a02e6cb25423cf1b1a": "2674000000000000000000",
+ "0x2e2d7ea66b9f47d8cc52c01c52b6e191bc7d4786": "3999800000000000000000",
+ "0x3e3161f1ea2fbf126e79da1801da9512b37988c9": "49250000000000000000000",
+ "0x7e2ba86da52e785d8625334f3397ba1c4bf2e8d1": "197000000000000000000",
+ "0x7608f437b31f18bc0b64d381ae86fd978ed7b31f": "50000000000000000000",
+ "0x25a5a44d38a2f44c6a9db9cdbc6b1e2e97abb509": "17000000000000000000000",
+ "0x745ad3abc6eeeb2471689b539e789ce2b8268306": "1129977000000000000000",
+ "0x09e437d448861228a232b62ee8d37965a904ed9c": "21708305000000000000000",
+ "0xbe53322f43fbb58494d7cce19dda272b2450e827": "200018000000000000000",
+ "0x4166fc08ca85f766fde831460e9dc93c0e21aa6c": "1000000000000000000000",
+ "0x99c0174cf84e0783c220b4eb6ae18fe703854ad3": "2074800000000000000000",
+ "0x3cf484524fbdfadae26dc185e32b2b630fd2e726": "448798000000000000000",
+ "0xfdcd5d80b105897a57abc47865768b2900524295": "6400000000000000000000",
+ "0xf22f4078febbbaa8b0e78e642c8a42f35d433905": "1999944000000000000000",
+ "0xeac768bf14b8f9432e69eaa82a99fbeb94cd0c9c": "98500000000000000000000",
+ "0x2639eee9873ceec26fcc9454b548b9e7c54aa65c": "1000000000000000000000",
+ "0xc3c3c2510d678020485a63735d1307ec4ca6302b": "1000000000000000000000",
+ "0xb73d6a77559c86cf6574242903394bacf96e3570": "91200000000000000000",
+ "0x5ce2e7ceaaa18af0f8aafa7fbad74cc89e3cd436": "20000000000000000000000",
+ "0x03377c0e556b640103289a6189e1aeae63493467": "20000000000000000000000",
+ "0x6eb0a5a9ae96d22cf01d8fd6483b9f38f08c2c8b": "4000000000000000000000",
+ "0xfc8215a0a69913f62a43bf1c8590b9ddcd0d8ddb": "2000000000000000000000",
+ "0x4a835c25824c47ecbfc79439bf3f5c3481aa75cd": "1400000000000000000000",
+ "0xb5493ef173724445cf345c035d279ba759f28d51": "20000000000000000000",
+ "0xb9e90c1192b3d5d3e3ab0700f1bf655f5dd4347a": "499928000000000000000",
+ "0x419bde7316cc1ed295c885ace342c79bf7ee33ea": "6000000000000000000000",
+ "0xe4625501f52b7af52b19ed612e9d54fdd006b492": "209440000000000000000",
+ "0xe9d599456b2543e6db80ea9b210e908026e2146e": "200000000000000000000",
+ "0x2c06dd922b61514aafedd84488c0c28e6dcf0e99": "100000000000000000000000",
+ "0x06b5ede6fdf1d6e9a34721379aeaa17c713dd82a": "2000000000000000000000",
+ "0xd8930a39c77357c30ad3a060f00b06046331fd62": "820000000000000000000",
+ "0xb2a2c2111612fb8bbb8e7dd9378d67f1a384f050": "20000000000000000000",
+ "0x1f174f40a0447234e66653914d75bc003e5690dc": "160000000000000000000",
+ "0xe06cb6294704eea7437c2fc3d30773b7bf38889a": "20094000000000000000",
+ "0xcd06f8c1b5cdbd28e2d96b6346c3e85a0483ba24": "1000000000000000000000",
+ "0xf316ef1df2ff4d6c1808dba663ec8093697968e0": "1794400000000000000000",
+ "0x1e6915ebd9a19c81b692ad99b1218a592c1ac7b1": "4000000000000000000000",
+ "0x885493bda36a0432976546c1ddce71c3f4570021": "216700000000000000000",
+ "0x18b0407cdad4ce52600623bd5e1f6a81ab61f026": "319489000000000000000",
+ "0x187d9f0c07f8eb74faaad15ebc7b80447417f782": "20000000000000000000",
+ "0x5d6ccf806738091042ad97a6e095fe8c36aa79c5": "188000000000000000000",
+ "0x53437fecf34ab9d435f4deb8ca181519e2592035": "188000000000000000000",
+ "0xfd1faa347b0fcc804c2da86c36d5f1d18b7087bb": "52380000000000000000",
+ "0x650cf67db060cce17568d5f2a423687c49647609": "100000000000000000000",
+ "0xbcd95ef962462b6edfa10fda87d72242fe3edb5c": "334133000000000000000",
+ "0x3b5e8b3c77f792decb7a8985df916efb490aac23": "2000000000000000000000",
+ "0xf13b083093ba564e2dc631568cf7540d9a0ec719": "1999944000000000000000",
+ "0x373c547e0cb5ce632e1c5ad66155720c01c40995": "4691588000000000000000",
+ "0x7313461208455455465445a459b06c3773b0eb30": "2000000000000000000000",
+ "0x441f37e8a029fd02482f289c49b5d06d00e408a4": "333333000000000000000",
+ "0xd30d4c43adcf55b2cb53d68323264134498d89ce": "1000000000000000000000",
+ "0xf648ea89c27525710172944e79edff847803b775": "100000000000000000000000",
+ "0x0c7f869f8e90d53fdc03e8b2819b016b9d18eb26": "20000000000000000000000",
+ "0xc71f92a3a54a7b8c2f5ea44305fccb84eee23148": "49980000000000000000",
+ "0x7988901331e387f713faceb9005cb9b65136eb14": "1970000000000000000000",
+ "0xe9a39a8bac0f01c349c64cedb69897f633234ed2": "3980000000000000000000",
+ "0xad2a5c00f923aaf21ab9f3fb066efa0a03de2fb2": "999996000000000000000",
+ "0xf25259a5c939cd25966c9b6303d3731c53ddbc4c": "200000000000000000000",
+ "0xd1682c2159018dc3d07f08240a8c606daf65f8e1": "200000000000000000000000",
+ "0xa99991cebd98d9c838c25f7a7416d9e244ca250d": "1000000000000000000000",
+ "0x5a285755391e914e58025faa48cc685f4fd4f5b8": "26000000000000000000000",
+ "0x4d24b7ac47d2f27de90974ba3de5ead203544bcd": "100000000000000000000",
+ "0x21b182f2da2b384493cf5f35f83d9d1ee14f2a21": "2000000000000000000000",
+ "0x31ab088966ecc7229258f6098fce68cf39b38485": "1000000000000000000000",
+ "0x4977a7939d0939689455ce2639d0ee5a4cd910ed": "1820000000000000000000",
+ "0x07af938c1237a27c9030094dcf240750246e3d2c": "500000000000000000000",
+ "0x4e2bfa4a466f82671b800eee426ad00c071ba170": "4000000000000000000000",
+ "0x107379d4c467464f235bc18e55938aad3e688ad7": "50000000000000000000",
+ "0xf7b29b82195c882dab7897c2ae95e77710f57875": "2199000000000000000000",
+ "0x56586391040c57eec6f5affd8cd4abde10b50acc": "4000000000000000000000",
+ "0xac608e2bac9dd20728d2947effbbbf900a9ce94b": "6000600000000000000000",
+ "0x48548b4ba62bcb2f0d34a88dc69a680e539cf046": "100084000000000000000",
+ "0x1665ab1739d71119ee6132abbd926a279fe67948": "100000000000000000000",
+ "0xaf4493e8521ca89d95f5267c1ab63f9f45411e1b": "200000000000000000000",
+ "0xbf6925c00751008440a6739a02bf2b6cdaab5e3a": "1000000000000000000000",
+ "0x3fe40fbd919aad2818df01ee4df46c46842ac539": "6000000000000000000000",
+ "0x455b9296921a74d1fc41617f43b8303e6f3ed76c": "4200000000000000000000",
+ "0x7086b4bde3e35d4aeb24b825f1a215f99d85f745": "1999800000000000000000",
+ "0xd4ee4919fb37f2bb970c3fff54aaf1f3dda6c03f": "40000000000000000000000",
+ "0xa4489a50ead5d5445a7bee4d2d5536c2a76c41f8": "200000000000000000000",
+ "0x505e4f7c275588c533a20ebd2ac13b409bbdea3c": "17600000000000000000",
+ "0x3bb53598cc20e2055dc553b049404ac9b7dd1e83": "615020000000000000000",
+ "0x52cd20403ba7eda6bc307a3d63b5911b817c1263": "20000000000000000000",
+ "0xa211da03cc0e31ecce5309998718515528a090df": "200000000000000000000",
+ "0xbcb422dc4dd2aae94abae95ea45dd1731bb6b0ba": "447500000000000000000",
+ "0xcbde9734b8e6aa538c291d6d7facedb0f338f857": "2000000000000000000000",
+ "0x171ca02a8b6d62bf4ca47e906914079861972cb2": "200000000000000000000",
+ "0xd40d0055fd9a38488aff923fd03d35ec46d711b3": "4999711000000000000000",
+ "0x3887192c7f705006b630091276b39ac680448d6b": "60000000000000000000",
+ "0x3f3c8e61e5604cef0605d436dd22accd862217fc": "1337000000000000000000",
+ "0x4258fd662fc4ce3295f0d4ed8f7bb1449600a0a9": "6719600000000000000000",
+ "0x4571de672b9904bad8743692c21c4fdcea4c2e01": "4000000000000000000000",
+ "0x5be045512a026e3f1cebfd5a7ec0cfc36f2dc16b": "120000000000000000000",
+ "0xd6300b3215b11de762ecde4b70b7927d01291582": "2000000000000000000000",
+ "0xf9e37447406c412197b2e2aebc001d6e30c98c60": "8346700000000000000000",
+ "0xbd047ff1e69cc6b29ad26497a9a6f27a903fc4dd": "865000000000000000000",
+ "0x23fa7eb51a48229598f97e762be0869652dffc66": "1000000000000000000000",
+ "0x6679aeecd87a57a73f3356811d2cf49d0c4d96dc": "600000000000000000000",
+ "0x23c55aeb5739876f0ac8d7ebea13be729685f000": "1337000000000000000000",
+ "0x757b65876dbf29bf911d4f0692a2c9beb1139808": "4124263000000000000000",
+ "0xe8fc36b0131ec120ac9e85afc10ce70b56d8b6ba": "200000000000000000000",
+ "0x1a89899cbebdbb64bb26a195a63c08491fcd9eee": "2000000000000000000000",
+ "0x6edf7f5283725c953ee64317f66188af1184b033": "8050000000000000000000",
+ "0x297385e88634465685c231a314a0d5dcd146af01": "1550000000000000000000",
+ "0x018f20a27b27ec441af723fd9099f2cbb79d6263": "2167000000000000000000",
+ "0xa5a4227f6cf98825c0d5baff5315752ccc1a1391": "10000000000000000000000",
+ "0x69517083e303d4fbb6c2114514215d69bc46a299": "100000000000000000000",
+ "0x1dab172effa6fbee534c94b17e794edac54f55f8": "1970000000000000000000",
+ "0xc6ee35934229693529dc41d9bb71a2496658b88e": "19700000000000000000000",
+ "0xa8ee1df5d44b128469e913569ef6ac81eeda4fc8": "500000000000000000000",
+ "0x35bd246865fab490ac087ac1f1d4f2c10d0cda03": "400000000000000000000",
+ "0x4bf8bf1d35a231315764fc8001809a949294fc49": "66850000000000000000",
+ "0xc70fa45576bf9c865f983893002c414926f61029": "400400000000000000000",
+ "0xfdeaac2acf1d138e19f2fc3f9fb74592e3ed818a": "668500000000000000000",
+ "0xbfbfbcb656c2992be8fcde8219fbc54aadd59f29": "9999924000000000000000",
+ "0x1722c4cbe70a94b6559d425084caeed4d6e66e21": "4000000000000000000000",
+ "0x00e681bc2d10db62de85848324492250348e90bf": "20000000000000000000000",
+ "0x5c308bac4857d33baea074f3956d3621d9fa28e1": "4999711000000000000000",
+ "0x68c08490c89bf0d6b6f320b1aca95c8312c00608": "4000000000000000000000",
+ "0xce1884ddbbb8e10e4dba6e44feeec2a7e5f92f05": "4000000000000000000000",
+ "0x427417bd16b1b3d22dbb902d8f9657016f24a61c": "2000000000000000000000",
+ "0x5ff93de6ee054cad459b2d5eb0f6870389dfcb74": "220000000000000000000",
+ "0x71946b7117fc915ed107385f42d99ddac63249c2": "2000000000000000000000",
+ "0x11ec00f849b6319cf51aa8dd8f66b35529c0be77": "2000000000000000000000",
+ "0x610fd6ee4eebab10a8c55d0b4bd2e7d6ef817156": "20002000000000000000",
+ "0xa422e4bf0bf74147cc895bed8f16d3cef3426154": "349281000000000000000",
+ "0x745aecbaf9bb39b74a67ea1ce623de368481baa6": "10000000000000000000000",
+ "0x9f496cb2069563144d0811677ba0e4713a0a4143": "1122000000000000000000",
+ "0xc500b720734ed22938d78c5e48b2ba9367a575ba": "33400000000000000000000",
+ "0xcd072e6e1833137995196d7bb1725fef8761f655": "6000000000000000000000",
+ "0x94644ad116a41ce2ca7fbec609bdef738a2ac7c7": "5000000000000000000000",
+ "0xe8d942d82f175ecb1c16a405b10143b3f46b963a": "568600000000000000000",
+ "0xf73dd9c142b71bce11d06e30e7e7d032f2ec9c9e": "1970000000000000000000",
+ "0x1327d759d56e0ab87af37ecf63fe01f310be100a": "659200000000000000000",
+ "0x28fa2580f9ebe420f3e5eefdd371638e3b7af499": "6000000000000000000000",
+ "0x024bdd2c7bfd500ee7404f7fb3e9fb31dd20fbd1": "180000000000000000000",
+ "0xb4b14bf45455d0ab0803358b7524a72be1a2045b": "500000000000000000000",
+ "0xb1e2dd95e39ae9775c55aeb13f12c2fa233053ba": "2000000000000000000000",
+ "0x35b03ea4245736f57b85d2eb79628f036ddcd705": "4000000000000000000000",
+ "0xeb2ef3d38fe652403cd4c9d85ed7f0682cd7c2de": "42784000000000000000000",
+ "0x690594d306613cd3e2fd24bca9994ad98a3d73f8": "2000000000000000000000",
+ "0x8397a1bc47acd647418159b99cea57e1e6532d6e": "9169160000000000000000",
+ "0xb44815a0f28e569d0e921a4ade8fb2642526497a": "55500000000000000000",
+ "0xe24109be2f513d87498e926a286499754f9ed49e": "886500000000000000000",
+ "0x37ac29bda93f497bc4aeaab935452c431510341e": "985000000000000000000",
+ "0x4a81abe4984c7c6bef63d69820e55743c61f201c": "16011846000000000000000",
+ "0x66dcc5fb4ee7fee046e141819aa968799d644491": "1337000000000000000000",
+ "0x43ff38743ed0cd43308c066509cc8e7e72c862aa": "1940000000000000000000",
+ "0xb8f20005b61352ffa7699a1b52f01f5ab39167f1": "10000000000000000000000",
+ "0x1cda411bd5163baeca1e558563601ce720e24ee1": "18200000000000000000",
+ "0x86245f596691093ece3f3d3ca2263eace81941d9": "188000000000000000000",
+ "0xf52a5882e8927d944b359b26366ba2b9cacfbae8": "25000080000000000000000",
+ "0x118c18b2dce170e8f445753ba5d7513cb7636d2d": "8800000000000000000000",
+ "0x7168b3bb8c167321d9bdb023a6e9fd11afc9afd9": "1790000000000000000000",
+ "0xd9103bb6b67a55a7fece2d1af62d457c2178946d": "1000000000000000000000",
+ "0x8b9fda7d981fe9d64287f85c94d83f9074849fcc": "14000000000000000000000",
+ "0x91211712719f2b084d3b3875a85069f466363141": "1000000000000000000000",
+ "0x4863849739265a63b0a2bf236a5913e6f959ce15": "1520000000000000000000",
+ "0xc2d1778ef6ee5fe488c145f3586b6ebbe3fbb445": "1146000000000000000000",
+ "0x2b77a4d88c0d56a3dbe3bae04a05f4fcd1b757e1": "300000000000000000000",
+ "0xfe9c0fffefb803081256c0cf4d6659e6d33eb4fb": "1528000000000000000000",
+ "0x893017ff1adad499aa065401b4236ce6e92b625a": "1999944000000000000000",
+ "0x073c67e09b5c713c5221c8a0c7f3f74466c347b0": "19400000000000000000000",
+ "0x93e303411afaf6c107a44101c9ac5b36e9d6538b": "66000000000000000000000",
+ "0x0ec50aa823f465b9464b0bc0c4a57724a555f5d6": "59100000000000000000000",
+ "0xa3e3a6ea509573e21bd0239ece0523a7b7d89b2f": "1970000000000000000000",
+ "0xc069ef0eb34299abd2e32dabc47944b272334824": "120000000000000000000",
+ "0x28a3da09a8194819ae199f2e6d9d1304817e28a5": "2000000000000000000000",
+ "0xe9495ba5842728c0ed97be37d0e422b98d69202c": "2000000000000000000000",
+ "0xbba976f1a1215f7512871892d45f7048acd356c8": "2000000000000000000000",
+ "0x887cac41cd706f3345f2d34ac34e01752a6e5909": "595366000000000000000",
+ "0xe0e0b2e29dde73af75987ee4446c829a189c95bc": "149000000000000000000",
+ "0x4a5fae3b0372c230c125d6d470140337ab915656": "1600000000000000000000",
+ "0x425177eb74ad0a9d9a5752228147ee6d6356a6e6": "13370000000000000000",
+ "0x5db7bba1f9573f24115d8c8c62e9ce8895068e9f": "49984000000000000000",
+ "0xfa6a37f018e97967937fc5e8617ba1d786dd5f77": "19999800000000000000000",
+ "0x45e3a93e72144ada860cbc56ff85145ada38c6da": "1610000000000000000000",
+ "0x67da922effa472a6b124e84ea8f86b24e0f515aa": "20000000000000000000",
+ "0xaa9bd4589535db27fa2bc903ca17d679dd654806": "2000000000000000000000",
+ "0x16a9e9b73ae98b864d1728798b8766dbc6ea8d12": "957480000000000000000",
+ "0xd6580ab5ed4c7dfa506fa6fe64ad5ce129707732": "4000000000000000000000",
+ "0x984a7985e3cc7eb5c93691f6f8cc7b8f245d01b2": "6000000000000000000000",
+ "0x7746b6c6699c8f34ca2768a820f1ffa4c207fe05": "4000086000000000000000",
+ "0x2fa491fb5920a6574ebd289f39c1b2430d2d9a6a": "2000000000000000000000",
+ "0xfae76719d97eac41870428e940279d97dd57b2f6": "98500000000000000000000",
+ "0x41b2dbd79dda9b864f6a7030275419c39d3efd3b": "3200000000000000000000",
+ "0xdd8254121a6e942fc90828f2431f511dad7f32e6": "3018000000000000000000",
+ "0x37fac1e6bc122e936dfb84de0c4bef6e0d60c2d7": "2000000000000000000000",
+ "0x3a10888b7e149cae272c01302c327d0af01a0b24": "17000000000000000000",
+ "0x401354a297952fa972ad383ca07a0a2811d74a71": "14000000000000000000",
+ "0x51865db148881951f51251710e82b9be0d7eadb2": "2000000000000000000000",
+ "0xbbbd6ecbb5752891b4ceb3cce73a8f477059376f": "36000000000000000000",
+ "0x3f236108eec72289bac3a65cd283f95e041d144c": "999925000000000000000",
+ "0xdc83b6fd0d512131204707eaf72ea0c8c9bef976": "2000000000000000000000",
+ "0x036eeff5ba90a6879a14dff4c5043b18ca0460c9": "100000000000000000000",
+ "0xfac5ca94758078fbfccd19db3558da7ee8a0a768": "1017500000000000000000",
+ "0xd0d62c47ea60fb90a3639209bbfdd4d933991cc6": "194000000000000000000",
+ "0x891cb8238c88e93a1bcf61db49bd82b47a7f4f84": "2680000000000000000000",
+ "0xdf53003346d65c5e7a646bc034f2b7d32fcbe56a": "2000000000000000000000",
+ "0x6e89c51ea6de13e06cdc748b67c4410fe9bcab03": "4000000000000000000000",
+ "0xa61cdbadf04b1e54c883de6005fcdf16beb8eb2f": "2000000000000000000000",
+ "0xe3951de5aefaf0458768d774c254f7157735e505": "1600930000000000000000",
+ "0xf2732cf2c13b8bb8e7492a988f5f89e38273ddc8": "600000000000000000000",
+ "0x4752218e54de423f86c0501933917aea08c8fed5": "20000000000000000000000",
+ "0x152f4e860ef3ee806a502777a1b8dbc91a907668": "600000000000000000000",
+ "0x15b96f30c23b8664e7490651066b00c4391fbf84": "410650000000000000000",
+ "0x8693e9b8be94425eef7969bc69f9d42f7cad671e": "1000090000000000000000",
+ "0xf41557dfdfb1a1bdcefefe2eba1e21fe0a4a9942": "1970000000000000000000",
+ "0x38458e0685573cb4d28f53098829904570179266": "40000000000000000000",
+ "0x53e4d9696dcb3f4d7b3f70dcaa4eecb71782ff5c": "200000000000000000000",
+ "0x2dca0e449ab646dbdfd393a96662960bcab5ae1e": "40000000000000000000000",
+ "0x87d7ac0653ccc67aa9c3469eef4352193f7dbb86": "200000000000000000000000",
+ "0xae9f5c3fbbe0c9bcbf1af8ff74ea280b3a5d8b08": "1730000000000000000000",
+ "0x7751f363a0a7fd0533190809ddaf9340d8d11291": "20000000000000000000",
+ "0x708a2af425ceb01e87ffc1be54c0f532b20eacd6": "134159000000000000000",
+ "0xac122a03cd058c122e5fe17b872f4877f9df9572": "1969606000000000000000",
+ "0x5da4ca88935c27f55c311048840e589e04a8a049": "80000000000000000000",
+ "0xe67c2c1665c88338688187629f49e99b60b2d3ba": "200000000000000000000",
+ "0xdec82373ade8ebcf2acb6f8bc2414dd7abb70d77": "200000000000000000000",
+ "0x47c247f53b9fbeb17bba0703a00c009fdb0f6eae": "20000000000000000000000",
+ "0x9a522e52c195bfb7cf5ffaaedb91a3ba7468161d": "1000000000000000000000",
+ "0x3159e90c48a915904adfe292b22fa5fd5e72796b": "1008800000000000000000",
+ "0xdefddfd59b8d2c154eecf5c7c167bf0ba2905d3e": "93588000000000000000",
+ "0xad1d68a038fd2586067ef6d135d9628e79c2c924": "4686168000000000000000",
+ "0x038e45eadd3d88b87fe4dab066680522f0dfc8f9": "10000000000000000000000",
+ "0x2561ec0f379218fe5ed4e028a3f744aa41754c72": "13370000000000000000",
+ "0xb95396daaa490df2569324fcc6623be052f132ca": "2000000000000000000000",
+ "0x2376ada90333b1d181084c97e645e810aa5b76f1": "750000000000000000000",
+ "0x07800d2f8068e448c79a4f69b1f15ef682aae5f6": "19400000000000000000000",
+ "0xadeb204aa0c38e179e81a94ed8b3e7d53047c26b": "608000000000000000000",
+ "0x0dc100b107011c7fc0a1339612a16ccec3285208": "2000000000000000000000",
+ "0xf0b1340b996f6f0bf0d9561c849caf7f4430befa": "100000000000000000000",
+ "0xe1443dbd95cc41237f613a48456988a04f683282": "4000086000000000000000",
+ "0xd3c6f1e0f50ec3d2a67e6bcd193ec7ae38f1657f": "6618150000000000000000",
+ "0xb68899e7610d4c93a23535bcc448945ba1666f1c": "200000000000000000000",
+ "0xa7253763cf4a75df92ca1e766dc4ee8a2745147b": "10740000000000000000000",
+ "0x75d67ce14e8d29e8c2ffe381917b930b1aff1a87": "3000000000000000000000",
+ "0x493d48bda015a9bfcf1603936eab68024ce551e0": "22528000000000000000",
+ "0x7ddd57165c87a2707f025dcfc2508c09834759bc": "1400000000000000000000",
+ "0xcff7f89a4d4219a38295251331568210ffc1c134": "1760000000000000000000",
+ "0x168d30e53fa681092b52e9bae15a0dcb41a8c9bb": "100000000000000000000",
+ "0x99b743d1d9eff90d9a1934b4db21d519d89b4a38": "100000000000000000000",
+ "0xa3d0b03cffbb269f796ac29d80bfb07dc7c6ad06": "2000000000000000000000",
+ "0x816d9772cf11399116cc1e72c26c6774c9edd739": "200000000000000000000",
+ "0xa880e2a8bf88a1a82648b4013c49c4594c433cc8": "4728000000000000000000",
+ "0x2a44a7218fe44d65a1b4b7a7d9b1c2c52c8c3e34": "62221355000000000000000",
+ "0xcb86edbc8bbb1f9131022be649565ebdb09e32a1": "2000000000000000000000",
+ "0x3915eab5ab2e5977d075dec47d96b68b4b5cf515": "61520000000000000000000",
+ "0x8165cab0eafb5a328fc41ac64dae715b2eef2c65": "1000000000000000000000",
+ "0x416c86b72083d1f8907d84efd2d2d783dffa3efb": "1999944000000000000000",
+ "0xc524086d46c8112b128b2faf6f7c7d8160a8386c": "400000000000000000000",
+ "0x902d74a157f7d2b9a3378b1f56703730e03a1719": "4000000000000000000000",
+ "0x74ef2869cbe608856045d8c2041118579f2236ea": "59724000000000000000",
+ "0xaf992dd669c0883e5515d3f3112a13f617a4c367": "2000000000000000000000",
+ "0x4c6a248fc97d705def495ca20759169ef0d36471": "760000000000000000000",
+ "0x974d2f17895f2902049deaaecf09c3046507402d": "14707000000000000000",
+ "0x0239b4f21f8e05cd01512b2be7a0e18a6d974607": "1000000000000000000000",
+ "0xb97a6733cd5fe99864b3b33460d1672434d5cafd": "1999579000000000000000",
+ "0xf558a2b2dd26dd9593aae04531fd3c3cc3854b67": "198000000000000000000",
+ "0xb577b6befa054e9c040461855094b002d7f57bd7": "114000000000000000000000",
+ "0x73bfe7710f31cab949b7a2604fbf5239cee79015": "2000000000000000000000",
+ "0x5717f2d8f18ffcc0e5fe247d3a4219037c3a649c": "3998000000000000000000",
+ "0x20707e425d2a11d2c89f391b2b809f556c592421": "2000000000000000000000",
+ "0x9a6708ddb8903c289f83fe889c1edcd61f854423": "1000000000000000000000",
+ "0xfa27cc49d00b6c987336a875ae39da58fb041b2e": "10000000000000000000000",
+ "0xd688e785c98f00f84b3aa1533355c7a258e87948": "500000000000000000000",
+ "0x927cb7dc187036b5427bc7e200c5ec450c1d27d4": "216000000000000000000",
+ "0xb2bfaa58b5196c5cb7f89de15f479d1838de713d": "21000000000000000000",
+ "0xe180de9e86f57bafacd7904f9826b6b4b26337a3": "830400000000000000000",
+ "0xa1204dad5f560728a35c0d8fc79481057bf77386": "1000000000000000000000",
+ "0x6b0da25af267d7836c226bcae8d872d2ce52c941": "6000000000000000000000",
+ "0x0517448dada761cc5ba4033ee881c83037036400": "1998000000000000000000",
+ "0x7ed0a5a847bef9a9da7cba1d6411f5c316312619": "39842000000000000000",
+ "0x5b5d517029321562111b43086d0b043591109a70": "2600000000000000000000",
+ "0x56fc1a7bad4047237ce116146296238e078f93ad": "178000000000000000000",
+ "0x6c5422fb4b14e6d98b6091fdec71f1f08640419d": "400000000000000000000",
+ "0x108fe8ee2a13da487b22c6ab6d582ea71064d98c": "399800000000000000000",
+ "0x0ad3e44d3c001fa290b393617030544108ac6eb9": "1969019000000000000000",
+ "0x25aee68d09afb71d8817f3f184ec562f7897b734": "2000000000000000000000",
+ "0xc2340a4ca94c9678b7494c3c852528ede5ee529f": "48669000000000000000",
+ "0x44901e0d0e08ac3d5e95b8ec9d5e0ff5f12e0393": "417500000000000000000",
+ "0x8775a610c502b9f1e6ad4cdadb8ce29bff75f6e4": "600000000000000000000",
+ "0x682897bc4f8e89029120fcffb787c01a93e64184": "10000000000000000000000",
+ "0xf7acff934b84da0969dc37a8fcf643b7d7fbed41": "1999944000000000000000",
+ "0xf05fcd4c0d73aa167e5553c8c0d6d4f2faa39757": "13334000000000000000000",
+ "0xc981d312d287d558871edd973abb76b979e5c35e": "1970000000000000000000",
+ "0x9da61ccd62bf860656e0325d7157e2f160d93bb5": "4999980000000000000000",
+ "0xd284a50382f83a616d39b8a9c0f396e0ebbfa95d": "1000070000000000000000",
+ "0xd6cf5c1bcf9da662bcea2255905099f9d6e84dcc": "8349332000000000000000",
+ "0xc71b2a3d7135d2a85fb5a571dcbe695e13fc43cd": "1000000000000000000000",
+ "0xb22dadd7e1e05232a93237baed98e0df92b1869e": "2000000000000000000000",
+ "0xb09fe6d4349b99bc37938054022d54fca366f7af": "200000000000000000000000",
+ "0x427e4751c3babe78cff8830886febc10f9908d74": "1970000000000000000000",
+ "0x60b358cb3dbefa37f47df2d7365840da8e3bc98c": "20000000000000000000",
+ "0xdcd5bca2005395b675fde5035659b26bfefc49ee": "197000000000000000000",
+ "0x81186931184137d1192ac88cd3e1e5d0fdb86a74": "2900000000000000000000",
+ "0xde212293f8f1d231fa10e609470d512cb8ffc512": "2000000000000000000000",
+ "0x1937c5c515057553ccbd46d5866455ce66290284": "1000000000000000000000000",
+ "0x592777261e3bd852c48eca95b3a44c5b7f2d422c": "20000000000000000000000",
+ "0xbbf84292d954acd9e4072fb860b1504106e077ae": "1500000000000000000000",
+ "0x3b4100e30a73b0c734b18ffa8426d19b19312f1a": "55300000000000000000000",
+ "0xa03a3dc7c533d1744295be955d61af3f52b51af5": "40000000000000000000",
+ "0x4aa148c2c33401e66a2b586e6577c4b292d3f240": "216200000000000000000",
+ "0xff850e3be1eb6a4d726c08fa73aad358f39706da": "1940000000000000000000",
+ "0x743651b55ef8429df50cf81938c2508de5c8870f": "2000000000000000000000",
+ "0x3700e3027424d939dbde5d42fb78f6c4dbec1a8f": "40000000000000000000",
+ "0xc1cbd2e2332a524cf219b10d871ccc20af1fb0fa": "1000000000000000000000",
+ "0xe25b9f76b8ad023f057eb11ad94257a0862e4e8c": "2000000000000000000000",
+ "0x719e891fbcc0a33e19c12dc0f02039ca05b801df": "6185800000000000000000",
+ "0x39636b25811b176abfcfeeca64bc87452f1fdff4": "400000000000000000000",
+ "0x631030a5b27b07288a45696f189e1114f12a81c0": "499970000000000000000",
+ "0xbcc84597b91e73d5c5b4d69c80ecf146860f779a": "4380000000000000000000",
+ "0x095e0174829f34c3781be1a5e38d1541ea439b7f": "6000000000000000000000",
+ "0x2e7e05e29edda7e4ae25c5173543efd71f6d3d80": "6000000000000000000000",
+ "0xdbb6ac484027041642bbfd8d80f9d0c1cf33c1eb": "2000000000000000000000",
+ "0x153c08aa8b96a611ef63c0253e2a4334829e579d": "394000000000000000000",
+ "0x10f4bff0caa5027c0a6a2dcfc952824de2940909": "2000000000000000000000",
+ "0x2ef869f0350b57d53478d701e3fee529bc911c75": "50000000000000000000",
+ "0x70ab34bc17b66f9c3b63f151274f2a727c539263": "2000000000000000000000",
+ "0x3201259caf734ad7581c561051ba0bca7fd6946b": "180000000000000000000000",
+ "0x84e9cf8166c36abfa49053b7a1ad4036202681ef": "2000000000000000000000",
+ "0x4ebc5629f9a6a66b2cf3363ac4895c0348e8bf87": "1000090000000000000000",
+ "0xe50b464ac9de35a5618b7cbf254674182b81b97e": "4100000000000000000000",
+ "0x2abdf1a637ef6c42a7e2fe217773d677e804ebdd": "5000000000000000000000",
+ "0x7a0a78a9cc393f91c3d9e39a6b8c069f075e6bf5": "1337000000000000000000",
+ "0x2d9c5fecd2b44fbb6a1ec732ea059f4f1f9d2b5c": "1010694000000000000000",
+ "0x7b712c7af11676006a66d2fc5c1ab4c479ce6037": "8000000000000000000000",
+ "0x3466f67e39636c01f43b3a21a0e8529325c08624": "842864000000000000000",
+ "0xfdd502a74e813bcfa355ceda3c176f6a6871af7f": "400000000000000000000",
+ "0x26475419c06d5f147aa597248eb46cf7befa64a5": "1640000000000000000000",
+ "0x9243d7762d77287b12638688b9854e88a769b271": "1000000000000000000000",
+ "0x723d8baa2551d2addc43c21b45e8af4ca2bfb2c2": "1760000000000000000000",
+ "0xf2fbb6d887f8b8cc3a869aba847f3d1f643c53d6": "3999000000000000000000",
+ "0x2cdb3944650616e47cb182e060322fa1487978ce": "1820000000000000000000",
+ "0xf0d21663d8b0176e05fde1b90ef31f8530fda95f": "1999944000000000000000",
+ "0x77cc02f623a9cf98530997ea67d95c3b491859ae": "1354900000000000000000",
+ "0xd1b5a454ac3405bb4179208c6c84de006bcb9be9": "500000000000000000000",
+ "0xb9920fd0e2c735c256463caa240fb7ac86a93dfa": "1760000000000000000000",
+ "0xed1f1e115a0d60ce02fb25df014d289e3a0cbe7d": "500000000000000000000",
+ "0x23e2c6a8be8e0acfa5c4df5e36058bb7cbac5a81": "2000000000000000000000",
+ "0xf0be0faf4d7923fc444622d1980cf2d990aab307": "2000000000000000000000",
+ "0x0829d0f7bb7c446cfbb0deadb2394d9db7249a87": "40110000000000000000",
+ "0x2ecac504b233866eb5a4a99e7bd2901359e43b3d": "20000000000000000000000",
+ "0x06d6cb308481c336a6e1a225a912f6e6355940a1": "1760000000000000000000",
+ "0xd4879fd12b1f3a27f7e109761b23ca343c48e3d8": "666000000000000000000",
+ "0x857f100b1a5930225efc7e9020d78327b41c02cb": "2000000000000000000000",
+ "0x3aa42c21b9b31c3e27ccd17e099af679cdf56907": "8000000000000000000000",
+ "0x764d5212263aff4a2a14f031f04ec749dc883e45": "1850000000000000000000",
+ "0xd03a2da41e868ed3fef5745b96f5eca462ff6fda": "3000000000000000000000",
+ "0x4f26690c992b7a312ab12e1385d94acd58288e7b": "14000000000000000000000",
+ "0x7b122162c913e7146cad0b7ed37affc92a0bf27f": "1506799000000000000000",
+ "0xc87352dba582ee2066b9c002a962e003134f78b1": "500000000000000000000",
+ "0x9f4ac9c9e7e24cb2444a0454fa5b9ad9d92d3853": "835000000000000000000",
+ "0xccf62a663f1353ba2ef8e6521dc1ecb673ec8ef7": "152000000000000000000",
+ "0x557f5e65e0da33998219ad4e99570545b2a9d511": "11024000000000000000000",
+ "0xa5f0077b351f6c505cd515dfa6d2fa7f5c4cd287": "40000000000000000000000",
+ "0x79c6002f8452ca157f1317e80a2faf24475559b7": "20000000000000000000",
+ "0x3aa07a34a1afc8967d3d1383b96b62cf96d5fa90": "20000000000000000000000",
+ "0x7f389c12f3c6164f6446566c77669503c2792527": "98500000000000000000",
+ "0xac4cc256ae74d624ace80db078b2207f57198f6b": "2001000000000000000000",
+ "0x823ba7647238d113bce9964a43d0a098118bfe4d": "200000000000000000000",
+ "0xf5a7676ad148ae9c1ef8b6f5e5a0c2c473be850b": "200000000000000000000",
+ "0x7d34803569e00bd6b59fff081dfa5c0ab4197a62": "1712700000000000000000",
+ "0x061ea4877cd08944eb64c2966e9db8dedcfec06b": "1000000000000000000000",
+ "0xdf37c22e603aedb60a627253c47d8ba866f6d972": "24000000000000000000000",
+ "0x529aa002c6962a3a8545027fd8b05f22b5bf9564": "1670000000000000000000",
+ "0xeb89a882670909cf377e9e78286ee97ba78d46c2": "802200000000000000000",
+ "0x9ac85397792a69d78f286b86432a07aeceb60e64": "14300000000000000000",
+ "0x9610592202c282ab9bd8a884518b3e0bd4758137": "268000000000000000000",
+ "0x73932709a97f02c98e51b091312865122385ae8e": "1430000000000000000000",
+ "0x5ef8c96186b37984cbfe04c598406e3b0ac3171f": "9400000000000000000000",
+ "0xb6f78da4f4d041b3bc14bc5ba519a5ba0c32f128": "172326253000000000000000",
+ "0x6f0edd23bcd85f6015f9289c28841fe04c83efeb": "19100000000000000000",
+ "0xa8a43c009100616cb4ae4e033f1fc5d7e0b6f152": "3939015000000000000000",
+ "0x7081fa6baad6cfb7f51b2cca16fb8970991a64ba": "233953000000000000000",
+ "0x9de7386dde401ce4c67b71b6553f8aa34ea5a17d": "60000000000000000000",
+ "0x54ec7300b81ac84333ed1b033cd5d7a33972e234": "200000000000000000000",
+ "0x67a80e0190721f94390d6802729dd12c31a895ad": "1999964000000000000000",
+ "0x3a4297da3c555e46c073669d0478fce75f2f790e": "1969606000000000000000",
+ "0xc2e0584a71348cc314b73b2029b6230b92dbb116": "2000000000000000000000",
+ "0x0a2ade95b2e8c66d8ae6f0ba64ca57d783be6d44": "4000000000000000000000",
+ "0x544b5b351d1bc82e9297439948cf4861dac9ae11": "22000000000000000000000",
+ "0x3ae62bd271a760637fad79c31c94ff62b4cd12f7": "2000000000000000000000",
+ "0x0d8023929d917234ae40512b1aabb5e8a4512771": "148000000000000000000",
+ "0x2858acacaf21ea81cab7598fdbd86b452e9e8e15": "666000000000000000000",
+ "0xc033b1325a0af45472c25527853b1f1c21fa35de": "2000000000000000000000",
+ "0xbbf85aaaa683738f073baef44ac9dc34c4c779ea": "2000000000000000000000",
+ "0x6ae57f27917c562a132a4d1bf7ec0ac785832926": "6000000000000000000000",
+ "0x88e6f9b247f988f6c0fc14c56f1de53ec69d43cc": "100000000000000000000",
+ "0xb72c2a011c0df50fbb6e28b20ae1aad217886790": "4000000000000000000000",
+ "0x161caf5a972ace8379a6d0a04ae6e163fe21df2b": "100000000000000000000000",
+ "0x2a63590efe9986c3fee09b0a0a338b15bed91f21": "6458400000000000000000",
+ "0x50e1c8ec98415bef442618708799437b86e6c205": "6000000000000000000000",
+ "0x33f4a6471eb1bca6a9f85b3b4872e10755c82be1": "2000000000000000000000",
+ "0x9c49deff47085fc09704caa2dca8c287a9a137da": "8000000000000000000000",
+ "0xe1173a247d29d8238df0922f4df25a05f2af77c3": "40007051000000000000000",
+ "0x51891b2ccdd2f5a44b2a8bc49a5d9bca6477251c": "310000000000000000000",
+ "0xecaf3350b7ce144d068b186010852c84dd0ce0f0": "2000000000000000000000",
+ "0x72393d37b451effb9e1ff3b8552712e2a970d8c2": "985000000000000000000",
+ "0x1bbc60bcc80e5cdc35c5416a1f0a40a83dae867b": "2000000000000000000000",
+ "0xb8ab39805bd821184f6cbd3d2473347b12bf175c": "118200000000000000000",
+ "0xc55a6b4761fd11e8c85f15174d74767cd8bd9a68": "133700000000000000000",
+ "0x99d1b585965f406a42a49a1ca70f769e765a3f98": "16700000000000000000000",
+ "0x9ab988b505cfee1dbe9cd18e9b5473b9a2d4f536": "320000000000000000000",
+ "0x7fef8c38779fb307ec6f044bebe47f3cfae796f1": "168561000000000000000",
+ "0x322d6f9a140d213f4c80cd051afe25c620bf4c7d": "20000000000000000000",
+ "0x3bd9a06d1bd36c4edd27fc0d1f5b088ddae3c72a": "499970000000000000000",
+ "0x5dcdb6b87a503c6d8a3c65c2cf9a9aa883479a1e": "9200000000000000000000",
+ "0x6e84c2fd18d8095714a96817189ca21cca62bab1": "340935000000000000000",
+ "0xa5bad86509fbe0e0e3c0e93f6d381f1af6e9d481": "6000000000000000000000",
+ "0x3954bdfe0bf587c695a305d9244c3d5bdddac9bb": "19187461000000000000000",
+ "0x63f0e5a752f79f67124eed633ad3fd2705a397d4": "3940000000000000000000",
+ "0x33fd718f0b91b5cec88a5dc15eecf0ecefa4ef3d": "432500000000000000000",
+ "0x68027d19558ed7339a08aee8de3559be063ec2ea": "2000000000000000000000",
+ "0x96f0462ae6f8b96088f7e9c68c74b9d8ad34b347": "1790000000000000000000",
+ "0xf1f391ca92808817b755a8b8f4e2ca08d1fd1108": "6000000000000000000000",
+ "0x7fcf5ba6666f966c5448c17bf1cb0bbcd8019b06": "99999000000000000000",
+ "0xe9b9a2747510e310241d2ece98f56b3301d757e0": "2000000000000000000000",
+ "0x2100381d60a5b54adc09d19683a8f6d5bb4bfbcb": "10000000000000000000000",
+ "0x7495ae78c0d90261e2140ef2063104731a60d1ed": "34250000000000000000",
+ "0xdc911cf7dc5dd0813656670528e9338e67034786": "2000000000000000000000",
+ "0x262aed4bc0f4a4b2c6fb35793e835a49189cdfec": "10000000000000000000000",
+ "0x9ee93f339e6726ec65eea44f8a4bfe10da3d3282": "2000000000000000000000",
+ "0xa3a57b0716132804d60aac281197ff2b3d237b01": "1400000000000000000000",
+ "0xc799e34e88ff88be7de28e15e4f2a63d0b33c4cb": "200000000000000000000",
+ "0xc7506c1019121ff08a2c8c1591a65eb4bdfb4a3f": "600000000000000000000",
+ "0x795ebc2626fc39b0c86294e0e837dcf523553090": "1000000000000000000000",
+ "0x441aca82631324acbfa2468bda325bbd78477bbf": "6000000000000000000000",
+ "0x9f271d285500d73846b18f733e25dd8b4f5d4a8b": "722000000000000000000",
+ "0xd77892e2273b235d7689e430e7aeed9cbce8a1f3": "2000000000000000000000",
+ "0x4f8972838f70c903c9b6c6c46162e99d6216d451": "4610000000000000000000",
+ "0x4c85ed362f24f6b9f04cdfccd022ae535147cbb9": "1500000000000000000000",
+ "0x3807eff43aa97c76910a19752dd715ee0182d94e": "250190000000000000000",
+ "0x3a9e5441d44b243be55b75027a1ceb9eacf50df2": "1000000000000000000000",
+ "0x3deae43327913f62808faa1b6276a2bd6368ead9": "2000000000000000000000",
+ "0xc270456885342b640b4cfc1b520e1a544ee0d571": "1820000000000000000000",
+ "0x77798f201257b9c35204957057b54674aefa51df": "149000000000000000000",
+ "0x225f9eb3fb6ff3e9e3c8447e14a66e8d4f3779f6": "2000000000000000000000",
+ "0x78df2681d6d602e22142d54116dea15d454957aa": "298000000000000000000",
+ "0x283396ce3cac398bcbe7227f323e78ff96d08767": "400000000000000000000",
+ "0x747ff7943b71dc4dcdb1668078f83dd7cc4520c2": "60000000000000000000",
+ "0xa4ed11b072d89fb136759fc69b428c48aa5d4ced": "262800000000000000000",
+ "0xcc043c4388d345f884c6855e71142a9f41fd6935": "20000000000000000000",
+ "0xab14d221e33d544629198cd096ed63dfa28d9f47": "6000000000000000000000",
+ "0x251e6838f7cec5b383c1d90146341274daf8e502": "147510000000000000000",
+ "0x36a0e61e1be47fa87e30d32888ee0330901ca991": "20000000000000000000",
+ "0xbcfc98e5c82b6adb180a3fcb120b9a7690c86a3f": "1970000000000000000000",
+ "0x18a6d2fc52be73084023c91802f05bc24a4be09f": "2000000000000000000000",
+ "0x80591a42179f34e64d9df75dcd463b28686f5574": "20000000000000000000000",
+ "0x881230047c211d2d5b00d8de4c5139de5e3227c7": "10000000000000000000000",
+ "0x9eb1ff71798f28d6e989fa1ea0588e27ba86cb7d": "140800000000000000000",
+ "0xa01fd1906a908506dedae1e208128872b56ee792": "3000000000000000000000",
+ "0x1b05ea6a6ac8af7cb6a8b911a8cce8fe1a2acfc8": "2000000000000000000000",
+ "0x6add932193cd38494aa3f03aeccc4b7ab7fabca2": "89600000000000000000",
+ "0x2aaa35274d742546670b7426264521032af4f4c3": "10000000000000000000000",
+ "0x67b8a6e90fdf0a1cac441793301e8750a9fa7957": "895000000000000000000",
+ "0x5b5be0d8c67276baabd8edb30d48ea75640b8b29": "824480000000000000000",
+ "0x28d7e5866f1d85fd1ceb32bfbe1dfc36db434566": "7199000000000000000000",
+ "0x98e3e90b28fccaee828779b8d40a5568c4116e21": "40000000000000000000",
+ "0x2dd578f7407dfbd548d05e95ccc39c485429626a": "4200000000000000000000",
+ "0x8ca6989746b06e32e2487461b1ce996a273acfd7": "20000000000000000000",
+ "0xa6f93307f8bce03195fece872043e8a03f7bd11a": "2886000000000000000000",
+ "0xefbd52f97da5fd3a673a46cbf330447b7e8aad5c": "100033000000000000000",
+ "0x52bdd9af5978850bc24110718b3723759b437e59": "1730000000000000000000",
+ "0x6e073b66d1b8c66744d88096a8dd99ec7e0228da": "4000000000000000000000",
+ "0xa29d661a6376f66d0b74e2fe9d8f26c0247ec84c": "4117300000000000000000",
+ "0x7d34ff59ae840a7413c6ba4c5bb2ba2c75eab018": "3000000000000000000000",
+ "0x2eca6a3c5d9f449d0956bd43fa7b4d7be8435958": "2000020000000000000000",
+ "0xf59f9f02bbc98efe097eabb78210979021898bfd": "9999800000000000000000",
+ "0x90e300ac71451e401f887f6e7728851647a80e07": "400000000000000000000",
+ "0x05ae7fd4bbcc80ca11a90a1ec7a301f7cccc83db": "910000000000000000000",
+ "0xe54102534de8f23effb093b31242ad3b233facfd": "4000000000000000000000",
+ "0xc127aab59065a28644a56ba3f15e2eac13da2995": "600000000000000000000",
+ "0xed60c4ab6e540206317e35947a63a9ca6b03e2cb": "57275000000000000000",
+ "0xd855b03ccb029a7747b1f07303e0a664793539c8": "2000000000000000000000",
+ "0x1178501ff94add1c5881fe886136f6dfdbe61a94": "158000000000000000000",
+ "0xf447108b98df64b57e871033885c1ad71db1a3f9": "6916709000000000000000",
+ "0xdeee2689fa9006b59cf285237de53b3a7fd01438": "450034000000000000000",
+ "0x7f01dc7c3747ca608f983dfc8c9b39e755a3b914": "206980000000000000000",
+ "0x9edeac4c026b93054dc5b1d6610c6f3960f2ad73": "1200000000000000000000",
+ "0xe3cffe239c64e7e20388e622117391301b298696": "500000000000000000000",
+ "0xebbb4f2c3da8be3eb62d1ffb1f950261cf98ecda": "2000000000000000000000",
+ "0x38c10b90c859cbb7815692f99dae520ab5febf5e": "13169000000000000000000",
+ "0x23f9ecf3e5dddca38815d3e59ed34b5b90b4a353": "204608000000000000000",
+ "0xd7fa5ffb6048f96fb1aba09ef87b1c11dd7005e4": "1000000000000000000000",
+ "0x9ca42ee7a0b898f6a5cc60b5a5d7b1bfa3c33231": "2000000000000000000000",
+ "0x8b9577920053b1a00189304d888010d9ef2cb4bf": "500000000000000000000",
+ "0xfcd0b4827cd208ffbf5e759dba8c3cc61d8c2c3c": "8000000000000000000000",
+ "0x01ff1eb1dead50a7f2f9638fdee6eccf3a7b2ac8": "600000000000000000000",
+ "0xabde147b2af789eaa586547e66c4fa2664d328a4": "247545000000000000000",
+ "0x64042ba68b12d4c151651ca2813b7352bd56f08e": "600000000000000000000",
+ "0xdccca42045ec3e16508b603fd936e7fd7de5f36a": "19700000000000000000",
+ "0xe77a89bd45dc04eeb4e41d7b596b707e6e51e74c": "12000000000000000000000",
+ "0xf77c7b845149efba19e261bc7c75157908afa990": "2000000000000000000000",
+ "0xfa5201fe1342af11307b9142a041243ca92e2f09": "152150000000000000000000",
+ "0x40df495ecf3f8b4cef2a6c189957248fe884bc2b": "12000000000000000000000",
+ "0x3d79a853d71be0621b44e29759656ca075fdf409": "2000000000000000000000",
+ "0x6de02f2dd67efdb7393402fa9eaacbcf589d2e56": "1182000000000000000000",
+ "0x729aad4627744e53f5d66309aa74448b3acdf46f": "2000000000000000000000",
+ "0x4e4318f5e13e824a54edfe30a7ed4f26cd3da504": "2000000000000000000000",
+ "0xc6a286e065c85f3af74812ed8bd3a8ce5d25e21d": "18200000000000000000",
+ "0xfd686de53fa97f99639e2568549720bc588c9efc": "1969606000000000000000",
+ "0x06b0ff834073cce1cbc9ea557ea87b605963e8b4": "300000000000000000000",
+ "0x72b5633fe477fe542e742facfd690c137854f216": "1670000000000000000000",
+ "0x8bf373d076814cbc57e1c6d16a82c5be13c73d37": "200000000000000000000",
+ "0xcf264e6925130906c4d7c18591aa41b2a67f6f58": "2000000000000000000000",
+ "0x0ea2a210312b3e867ee0d1cc682ce1d666f18ed5": "10000000000000000000000",
+ "0xd02afecf8e2ec2b62ac8ad204161fd1fae771d0e": "2000000000000000000000",
+ "0xe6b20f980ad853ad04cbfc887ce6601c6be0b24c": "4000000000000000000000",
+ "0x4280a58f8bb10b9440de94f42b4f592120820191": "2000000000000000000000",
+ "0xa914cdb571bfd93d64da66a4e108ea134e50d000": "1430143000000000000000",
+ "0x60864236930d04d8402b5dcbeb807f3caf611ea2": "4000000000000000000000",
+ "0xf9dd239008182fb519fb30eedd2093fed1639be8": "500000000000000000000",
+ "0x18e53243981aabc8767da10c73449f1391560eaa": "6000000000000000000000",
+ "0xc3a9226ae275df2cab312b911040634a9c9c9ef6": "4000000000000000000000",
+ "0x4fcc19ea9f4c57dcbce893193cfb166aa914edc5": "7001380000000000000000",
+ "0xc1e1409ca52c25435134d006c2a6a8542dfb7273": "34380000000000000000",
+ "0x981ddf0404e4d22dda556a0726f00b2d98ab9569": "999972000000000000000",
+ "0xe5bcc88c3b256f6ed5fe550e4a18198b943356ad": "2000000000000000000000",
+ "0x74a17f064b344e84db6365da9591ff1628257643": "20000000000000000000",
+ "0x2720f9ca426ef2f2cbd2fecd39920c4f1a89e16d": "2000000000000000000000",
+ "0x8d04a5ebfb5db409db0617c9fa5631c192861f4a": "970000000000000000000",
+ "0xf18b14cbf6694336d0fe12ac1f25df2da0c05dbb": "3999800000000000000000",
+ "0x56ac20d63bd803595cec036da7ed1dc66e0a9e07": "63927000000000000000",
+ "0x92c94c2820dfcf7156e6f13088ece7958b3676fd": "95500000000000000000",
+ "0x968dea60df3e09ae3c8d3505e9c080454be0e819": "6000000000000000000000",
+ "0x9268d62646563611dc3b832a30aa2394c64613e3": "2000000000000000000000",
+ "0x5a192b964afd80773e5f5eda6a56f14e25e0c6f3": "500000000000000000000",
+ "0xdf8d48b1eb07b3c217790e6c2df04dc319e7e848": "500000000000000000000",
+ "0x7f61fa6cf5f898b440dac5abd8600d6d691fdef9": "280000000000000000000",
+ "0x929d368eb46a2d1fbdc8ffa0607ede4ba88f59ad": "2000000000000000000000",
+ "0x9982a5890ffb5406d3aca8d2bfc1dd70aaa80ae0": "2000000000000000000000",
+ "0xbf2aea5a1dcf6ed3b5e8323944e983fedfd1acfb": "1580000000000000000000",
+ "0x46aa501870677e7f0a504876b4e8801a0ad01c46": "800000000000000000000",
+ "0x8f473d0ab876ddaa15608621d7013e6ff714b675": "470400000000000000000",
+ "0x02290fb5f9a517f82845acdeca0fc846039be233": "2000000000000000000000",
+ "0x8a5831282ce14a657a730dc18826f7f9b99db968": "4330268000000000000000",
+ "0x0328510c09dbcd85194a98d67c33ac49f2f94d60": "11000000000000000000000",
+ "0xcf883a20329667ea226a1e3c765dbb6bab32219f": "3038972000000000000000",
+ "0x2615100ea7e25bba9bca746058afbbb4ffbe4244": "500000000000000000000",
+ "0xb115ee3ab7641e1aa6d000e41bfc1ec7210c2f32": "13000000000000000000000",
+ "0x5cfa8d568575658ca4c1a593ac4c5d0e44c60745": "291000000000000000000",
+ "0xd3c24d4b3a5e0ff8a4622d518edd73f16ab28610": "20000000000000000000",
+ "0xa639acd96b31ba53b0d08763229e1f06fd105e9d": "8000000000000000000000",
+ "0xffa4aff1a37f984b0a67272149273ae9bd41e3bc": "10000000000000000000000",
+ "0xcf684dfb8304729355b58315e8019b1aa2ad1bac": "432500000000000000000",
+ "0x5797b60fd2894ab3c2f4aede86daf2e788d745ad": "6000000000000000000000",
+ "0xa6a0de421ae54f6d17281308f5646d2f39f7775d": "2000000000000000000000",
+ "0x08504f05643fab5919f5eea55925d7a3ed7d807a": "20000000000000000000",
+ "0x7a7068e1c3375c0e599db1fbe6b2ea23b8f407d2": "2000000000000000000000",
+ "0x1078d7f61b0e56c74ee6635b2e1819ef1e3d8785": "1000000000000000000000",
+ "0x6e12b51e225b4a4372e59ad7a2a1a13ea3d3a137": "14172200000000000000000",
+ "0x6a2e86469a5bf37cee82e88b4c3863895d28fcaf": "519000000000000000000",
+ "0x197672fd39d6f246ce66a790d13aa922d70ea109": "1000000000000000000000",
+ "0x8009a7cbd192b3aed4adb983d5284552c16c7451": "4000000000000000000000",
+ "0xf6c3c48a1ac0a34799f04db86ec7a975fe7768f3": "1970000000000000000000",
+ "0x16be75e98a995a395222d00bd79ff4b6e638e191": "36000000000000000000000",
+ "0x6c05e34e5ef2f42ed09deff1026cd66bcb6960bb": "2000000000000000000000",
+ "0x5d6ae8cbd6b3393c22d16254100d0238e808147c": "719992000000000000000",
+ "0x1a376e1b2d2f590769bb858d4575320d4e149970": "4841200000000000000000",
+ "0xf6ead67dbf5b7eb13358e10f36189d53e643cfcf": "40000000000000000000000",
+ "0x467d5988249a68614716659840ed0ae6f6f457bc": "387500000000000000000",
+ "0xaa960e10c52391c54e15387cc67af827b5316dcc": "2000000000000000000000",
+ "0x483ba99034e900e3aedf61499d3b2bce39beb7aa": "985000000000000000000",
+ "0x86f23e9c0aafc78b9c404dcd60339a925bffa266": "400000000000000000000",
+ "0xd05a447c911dbb275bfb2e5a37e5a703a56f9997": "200000000000000000000",
+ "0xedb71ec41bda7dce86e766e6e8c3e9907723a69b": "20000000000000000000",
+ "0xf86a3ea8071f7095c7db8a05ae507a8929dbb876": "336000000000000000000",
+ "0x323b3cfe3ee62bbde2a261e53cb3ecc05810f2c6": "13790000000000000000000",
+ "0x936f3813f5f6a13b8e4ffec83fe7f826186a71cd": "520000000000000000000",
+ "0x6db72bfd43fef465ca5632b45aab7261404e13bf": "2000000000000000000000",
+ "0x9bb76204186af2f63be79168601687fc9bad661f": "300000000000000000000",
+ "0x28ab165ffb69eda0c549ae38e9826f5f7f92f853": "1296890000000000000000",
+ "0xc73e2112282215dc0762f32b7e807dcd1a7aae3e": "6900000000000000000000",
+ "0xf8086e42661ea929d2dda1ab6c748ce3055d111e": "1000000000000000000000",
+ "0x4db21284bcd4f787a7556500d6d7d8f36623cf35": "1939806000000000000000",
+ "0xc48651c1d9c16bff4c9554886c3f3f26431f6f68": "658000000000000000000",
+ "0x9bdbdc9b973431d13c89a3f9757e9b3b6275bfc7": "499971000000000000000",
+ "0x560da37e956d862f81a75fd580a7135c1b246352": "10000000000000000000000",
+ "0x4b60a3e253bf38c8d5662010bb93a473c965c3e5": "1490000000000000000000",
+ "0x64e02abb016cc23a2934f6bcddb681905021d563": "1000000000000000000000",
+ "0xac2c8e09d06493a63858437bd20be01962450365": "1910000000000000000000",
+ "0x9bf9b3b2f23cf461eb591f28340bc719931c8364": "1000000000000000000000",
+ "0x9b5c39f7e0ac168c8ed0ed340477117d1b682ee9": "98000000000000000000",
+ "0xf75bb39c799779ebc04a336d260da63146ed98d0": "25000000000000000000",
+ "0xa7966c489f4c748a7ae980aa27a574251767caf9": "3000000000000000000000",
+ "0xea53c954f4ed97fd4810111bdab69ef981ef25b9": "17300000000000000000000",
+ "0x03a26cfc4c18316f70d59e9e1a79ee3e8b962f4c": "2000000000000000000000",
+ "0x3e63ce3b24ca2865b4c5a687b7aea3597ef6e548": "2000000000000000000000",
+ "0x500c902958f6421594d1b6ded712490d52ed6c44": "1970000000000000000000",
+ "0x6f44ca09f0c6a8294cbd519cdc594ad42c67579f": "50000000000000000000",
+ "0x3616fb46c81578c9c8eb4d3bf880451a88379d7d": "200000000000000000000",
+ "0x57bc20e2d62b3d19663cdb4c309d5b4f2fc2db8f": "100000000000000000000",
+ "0x1cebf0985d7f680aaa915c44cc62edb49eab269e": "1000000000000000000000",
+ "0xc0cbf6032fa39e7c46ff778a94f7d445fe22cf30": "310000000000000000000",
+ "0xc58b9cc61dedbb98c33f224d271f0e228b583433": "3880000000000000000000",
+ "0xe9c6dfae97f7099fc5f4e94b784db802923a1419": "48800000000000000000",
+ "0x9bacd3d40f3b82ac91a264d9d88d908eac8664b9": "20000000000000000000000",
+ "0x63d80048877596e0c28489e650cd4ac180096a49": "280000000000000000000",
+ "0xe6a6f6dd6f70a456f4ec15ef7ad5e5dbb68bd7dc": "200000000000000000000",
+ "0xd418870bc2e4fa7b8a6121ae0872d55247b62501": "1580000000000000000000",
+ "0xe2f9383d5810ea7b43182b8704b62b27f5925d39": "400000000000000000000",
+ "0xbd5e473abce8f97a6932f77c2facaf9cc0a00514": "1117350000000000000000",
+ "0x2ff1ca55fd9cec1b1fe9f0a9abb74c513c1e2aaa": "3000000000000000000000",
+ "0x9d99b189bbd9a48fc2e16e8fcda33bb99a317bbb": "1126900000000000000000",
+ "0x6e96faeda3054302c45f58f161324c99a3eebb62": "20000000000000000000",
+ "0xef93818f684db0c3675ec81332b3183ecc28a495": "1550000000000000000000",
+ "0x2659facb1e83436553b5b42989adb8075f9953ed": "29356000000000000000",
+ "0xc4ffadaaf2823fbea7bff702021bffc4853eb5c9": "42233000000000000000",
+ "0xe9864c1afc8eaad37f3ba56fcb7477cc622009b7": "79000000000000000000",
+ "0x87ef6d8b6a7cbf9b5c8c97f67ee2adc2a73b3f77": "200400000000000000000",
+ "0xc043f2452dcb9602ef62bd360e033dd23971fe84": "2000000000000000000000",
+ "0x0fdd65402395df9bd19fee4507ef5345f745104c": "5000000000000000000000",
+ "0x939c4313d2280edf5e071bced846063f0a975d54": "120000000000000000000000",
+ "0xb28245037cb192f75785cb86cbfe7c930da258b0": "16000000000000000000000",
+ "0xa80cb1738bac08d4f9c08b4deff515545fa8584f": "500000000000000000000",
+ "0x62971bf2634cee0be3c9890f51a56099dbb9519b": "656000000000000000000",
+ "0xf2efe96560c9d97b72bd36447843885c1d90c231": "2000000000000000000000",
+ "0x0e390f44053ddfcef0d608b35e4d9c2cbe9871bb": "1970000000000000000000",
+ "0x61d101a033ee0e2ebb3100ede766df1ad0244954": "500000000000000000000",
+ "0x6785513cf732e47e87670770b5419be10cd1fc74": "2000000000000000000000",
+ "0x167699f48a78c615512515739958993312574f07": "39000000000000000000",
+ "0x68ec79d5be7155716c40941c79d78d17de9ef803": "500600000000000000000",
+ "0xa0e8ba661b48154cf843d4c2a5c0f792d528ee29": "400000000000000000000",
+ "0x1a201b4327cea7f399046246a3c87e6e03a3cda8": "1000000000000000000000",
+ "0xf60f62d73937953fef35169e11d872d2ea317eec": "5348000000000000000000",
+ "0xc0c04d0106810e3ec0e54a19f2ab8597e69a573d": "50000000000000000000",
+ "0xef47cf073e36f271d522d7fa4e7120ad5007a0bc": "2500000000000000000000",
+ "0xa44fe800d96fcad73b7170d0f610cb8c0682d6ce": "4000000000000000000000",
+ "0x010f4a98dfa1d9799bf5c796fb550efbe7ecd877": "8023366000000000000000",
+ "0x708fa11fe33d85ad1befcbae3818acb71f6a7d7e": "18200000000000000000",
+ "0xb38c4e537b5df930d65a74d043831d6b485bbde4": "400000000000000000000",
+ "0x250a69430776f6347703f9529783955a6197b682": "1940000000000000000000",
+ "0x2d35a9df62757f7ffad1049afb06ca4afc464c51": "20000000000000000000",
+ "0x6aff1466c2623675e3cb0e75e423d37a25e442eb": "1730000000000000000000",
+ "0xfc15cb99a8d1030b12770add033a79ee0d0c908c": "350056000000000000000",
+ "0xe784dcc873aa8c1513ec26ff36bc92eac6d4c968": "200000000000000000000",
+ "0xb1c328fb98f2f19ab6646f0a7c8c566fda5a8540": "2500000000000000000000",
+ "0x247a0a11c57f0383b949de540b66dee68604b0a1": "1069600000000000000000",
+ "0x1af60343360e0b2d75255210375720df21db5c7d": "1000000000000000000000",
+ "0x8794bf47d54540ece5c72237a1ffb511ddb74762": "2000000000000000000000",
+ "0xe76d945aa89df1e457aa342b31028a5e9130b2ce": "1015200000000000000000",
+ "0xa30e0acb534c9b3084e8501da090b4eb16a2c0cd": "2000000000000000000000",
+ "0x7099d12f6ec656899b049a7657065d62996892c8": "400000000000000000000",
+ "0x7be7f2456971883b9a8dbe4c91dec08ac34e8862": "3000000000000000000000",
+ "0x42746aeea14f27beff0c0da64253f1e7971890a0": "1550000000000000000000",
+ "0x736b44503dd2f6dd5469ff4c5b2db8ea4fec65d0": "313950000000000000000",
+ "0x822edff636563a6106e52e9a2598f7e6d0ef2782": "36099000000000000000",
+ "0x03c647a9f929b0781fe9ae01caa3e183e876777e": "445800000000000000000",
+ "0x63612e7862c27b587cfb6daf9912cb051f030a9f": "43458000000000000000",
+ "0xd46bae61b027e5bb422e83a3f9c93f3c8fc77d27": "2000000000000000000000",
+ "0x5f23ba1f37a96c45bc490259538a54c28ba3b0d5": "1200000000000000000000",
+ "0xd41d7fb49fe701baac257170426cc9b38ca3a9b2": "176000000000000000000",
+ "0x1ebacb7844fdc322f805904fbf1962802db1537c": "10000000000000000000000",
+ "0x9c80bc18e9f8d4968b185da8c79fa6e11ffc3e23": "240000000000000000000",
+ "0xe4ca0a5238564dfc91e8bf22bade2901619a1cd4": "1000000000000000000000",
+ "0x1ad72d20a76e7fcc6b764058f48d417d496fa6cd": "2000000000000000000000",
+ "0xd3bc730937fa75d8452616ad1ef1fe7fffe0d0e7": "83363000000000000000",
+ "0xeac1482826acb6111e19d340a45fb851576bed60": "32177000000000000000",
+ "0x01e40521122530d9ac91113c06a0190b6d63850b": "1337000000000000000000",
+ "0x9e20e5fd361eabcf63891f5b87b09268b8eb3793": "100000000000000000000",
+ "0x69ff429074cb9b6c63bc914284bce5f0c8fbf7d0": "500000000000000000000",
+ "0x0d3265d3e7bdb93d5e8e8b1ca47f210a793ecc8e": "200000000000000000000",
+ "0x5b4ea16db6809b0352d4b6e81c3913f76a51bb32": "400000000000000000000",
+ "0xd8fe088fffce948f5137ee23b01d959e84ac4223": "227942000000000000000",
+ "0x7e4e9409704121d1d77997026ff06ea9b19a8b90": "2602600000000000000000",
+ "0x96b434fe0657e42acc8212b6865139dede15979c": "4000000000000000000000",
+ "0x22f004df8de9e6ebf523ccace457accb26f97281": "10000000000000000000000",
+ "0xd8f9240c55cff035523c6d5bd300d370dc8f0c95": "285000000000000000000",
+ "0x9d9e57fde30e5068c03e49848edce343b7028358": "1730000000000000000000",
+ "0x317cf4a23cb191cdc56312c29d15e210b3b9b784": "144000000000000000000",
+ "0x79f08e01ce0988e63c7f8f2908fade43c7f9f5c9": "18200000000000000000",
+ "0x04e5f5bc7c923fd1e31735e72ef968fd67110c6e": "1611000000000000000000",
+ "0x1ec4ec4b77bf19d091a868e6f49154180541f90e": "2000000000000000000000",
+ "0x8737dae671823a8d5917e0157ace9c43468d946b": "1999944000000000000000",
+ "0xf998ca3411730a6cd10e7455b0410fb0f6d3ff80": "2000000000000000000000",
+ "0x6e2eab85dc89fe29dc0aa1853247dab43a523d56": "80000000000000000000",
+ "0x72c083beadbdc227c5fb43881597e32e83c26056": "20000000000000000000000",
+ "0x5902e44af769a87246a21e079c08bf36b06efeb3": "1000000000000000000000",
+ "0xcc2d04f0a4017189b340ca77198641dcf6456b91": "3940000000000000000000",
+ "0xbde4c73f969b89e9ceae66a2b51844480e038e9a": "1000000000000000000000",
+ "0xadff0d1d0b97471e76d789d2e49c8a74f9bd54ff": "1880000000000000000000",
+ "0x397cdb8c80c67950b18d654229610e93bfa6ee1a": "1172938000000000000000",
+ "0xa3e051fb744aa3410c3b88f899f5d57f168df12d": "2955000000000000000000",
+ "0x810db25675f45ea4c7f3177f37ce29e22d67999c": "200000000000000000000",
+ "0x1e13ec51142cebb7a26083412c3ce35144ba56a1": "5000000000000000000000",
+ "0x25bdfa3ee26f3849617b230062588a97e3cae701": "1000008000000000000000",
+ "0xae538c73c5b38d8d584d7ebdadefb15cabe48357": "999000000000000000000",
+ "0xa2ecce2c49f72a0995a0bda57aacf1e9f001e22a": "4000000000000000000000",
+ "0x7e24fbdad290175eb2df6d180a19b9a9f41370be": "1000000000000000000000",
+ "0xe8cc43bc4f8acf39bff04ebfbf42aac06a328470": "400000000000000000000",
+ "0xc2779771f0536d79a8708f6931abc44b3035e999": "20002000000000000000000",
+ "0xab27ba78c8e5e3daef31ad05aef0ff0325721e08": "468000000000000000000",
+ "0x563cb8803c1d32a25b27b64114852bd04d9c20cd": "204400000000000000000",
+ "0x08d4267feb15da9700f7ccc3c84a8918bf17cfde": "1790000000000000000000",
+ "0xd1778c13fbd968bc083cb7d1024ffe1f49d02caa": "4020000000000000000000",
+ "0x1796bcc97b8abc717f4b4a7c6b1036ea2182639f": "355242000000000000000",
+ "0xbeecd6af900c8b064afcc6073f2d85d59af11956": "2000000000000000000000",
+ "0x045ed7f6d9ee9f252e073268db022c6326adfc5b": "100000000000000000000",
+ "0xb88a37c27f78a617d5c091b7d5b73a3761e65f2a": "2000000000000000000000",
+ "0x72fb49c29d23a18950c4b2dc0ddf410f532d6f53": "2000000000000000000000",
+ "0x6ecaefa6fc3ee534626db02c6f85a0c395571e77": "600000000000000000000",
+ "0xd1811c55976980f083901d8a0db269222dfb5cfe": "1550000000000000000000",
+ "0x98855c7dfbee335344904a12c40c731795b13a54": "1069600000000000000000",
+ "0x92a898d46f19719c38126a8a3c27867ae2cee596": "2000000000000000000000",
+ "0xca428863a5ca30369892d612183ef9fb1a04bcea": "1520000000000000000000",
+ "0x797427e3dbf0feae7a2506f12df1dc40326e8505": "1000000000000000000000",
+ "0x3d574fcf00fae1d98cc8bf9ddfa1b3953b9741bc": "1970000000000000000000",
+ "0x28818e18b610001321b31df6fe7d2815cdadc9f5": "1000000000000000000000",
+ "0x5f3e1e6739b0c62200e00a003691d9efb238d89f": "3000000000000000000000",
+ "0xd9d370fec63576ab15b318bf9e58364dc2a3552a": "100000000000000000000",
+ "0xb223bf1fbf80485ca2b5567d98db7bc3534dd669": "4000000000000000000000",
+ "0x7b27d0d1f3dd3c140294d0488b783ebf4015277d": "400000000000000000000",
+ "0x7930c2d9cbfa87f510f8f98777ff8a8448ca5629": "199955000000000000000",
+ "0x820c19291196505b65059d9914b7090be1db87de": "140000000000000000000",
+ "0xe545ee84ea48e564161e9482d59bcf406a602ca2": "1850000000000000000000",
+ "0xaf4cf41785161f571d0ca69c94f8021f41294eca": "9850000000000000000000",
+ "0x7a4f9b850690c7c94600dbee0ca4b0a411e9c221": "1910000000000000000000",
+ "0xddab6b51a9030b40fb95cf0b748a059c2417bec7": "2000000000000000000000",
+ "0x315ef2da620fd330d12ee55de5f329a696e0a968": "150000000000000000000",
+ "0x4db1c43a0f834d7d0478b8960767ec1ac44c9aeb": "872870000000000000000",
+ "0x2fef81478a4b2e8098db5ff387ba2153f4e22b79": "999000000000000000000",
+ "0x6c6aa0d30b64721990b9504a863fa0bfb5e57da7": "2700000000000000000000",
+ "0x33380c6fff5acd2651309629db9a71bf3f20c5ba": "16100000000000000000000",
+ "0x4eebf1205d0cc20cee6c7f8ff3115f56d48fba26": "19400000000000000000",
+ "0x03cc9d2d21f86b84ac8ceaf971dba78a90e62570": "1610000000000000000000",
+ "0x728f9ab080157db3073156dbca1a169ef3179407": "500000000000000000000",
+ "0x30ed11b77bc17e5e6694c8bc5b6e4798f68d9ca7": "143731500000000000000000",
+ "0xf617b967b9bd485f7695d2ef51fb7792d898f500": "500000000000000000000",
+ "0xc0cbad3ccdf654da22cbcf5c786597ca1955c115": "2000000000000000000000",
+ "0x80522ddf944ec52e27d724ed4c93e1f7be6083d6": "200000000000000000000",
+ "0x4e90ccb13258acaa9f4febc0a34292f95991e230": "15800000000000000000",
+ "0xff207308ced238a6c01ad0213ca9eb4465d42590": "1999944000000000000000",
+ "0x35f2949cf78bc219bb4f01907cf3b4b3d3865482": "289800000000000000000",
+ "0x68f525921dc11c329b754fbf3e529fc723c834cd": "1610000000000000000000",
+ "0x81139bfdcca656c430203f72958c543b6580d40c": "2000000000000000000000",
+ "0x9d511543b3d9dc60d47f09d49d01b6c498d82078": "11245000000000000000000",
+ "0x084d103254759b343cb2b9c2d8ff9e1ac5f14596": "7600000000000000000000",
+ "0xb323dcbf2eddc5382ee4bbbb201ca3931be8b438": "2000000000000000000000",
+ "0x349d2c918fd09e2807318e66ce432909176bd50b": "1120000000000000000000",
+ "0xb535f8db879fc67fec58824a5cbe6e5498aba692": "1910000000000000000000",
+ "0x824074312806da4748434266ee002140e3819ac2": "1507000000000000000000",
+ "0xe8ef100d7ce0895832f2678df72d4acf8c28b8e3": "500038000000000000000",
+ "0x84af1b157342d54368260d17876230a534b54b0e": "985000000000000000000",
+ "0x419a71a36c11d105e0f2aef5a3e598078e85c80b": "5000000000000000000000",
+ "0x55af092f94ba6a79918b0cf939eab3f01b3f51c7": "149940000000000000000",
+ "0x35a549e8fd6c368d6dcca6d2e7d18e4db95f5284": "499938000000000000000",
+ "0xf0e2649c7e6a3f2c5dfe33bbfbd927ca3c350a58": "2000000000000000000000",
+ "0xf4b759cc8a1c75f80849ebbcda878dc8f0d66de4": "400000000000000000000",
+ "0x21846f2fdf5a41ed8df36e5ed8544df75988ece3": "1999944000000000000000",
+ "0x229ff80bf5708009a9f739e0f8b560914016d5a6": "333333000000000000000",
+ "0xda505537537ffb33c415fec64e69bae090c5f60f": "160000000000000000000",
+ "0xb91d9e916cd40d193db60e79202778a0087716fc": "404800000000000000000",
+ "0xbb6823a1bd819f13515538264a2de052b4442208": "25610000000000000000",
+ "0x459393d63a063ef3721e16bd9fde45ee9dbd77fb": "1968818000000000000000",
+ "0x95f62d0243ede61dad9a3165f53905270d54e242": "1610000000000000000000",
+ "0xb0bb29a861ea1d424d45acd4bfc492fb8ed809b7": "80000000000000000000",
+ "0x5e74ed80e9655788e1bb269752319667fe754e5a": "56000000000000000000",
+ "0xa276b058cb98d88beedb67e543506c9a0d9470d8": "2668652000000000000000",
+ "0x8ae9ef8c8a8adfa6ab798ab2cdc405082a1bbb70": "2000000000000000000000",
+ "0xe5102c3b711b810344197419b1cd8a7059f13e32": "299999000000000000000",
+ "0xc32038ca52aee19745be5c31fcdc54148bb2c4d0": "49984000000000000000",
+ "0x13e321728c9c57628058e93fc866a032dd0bda90": "714580000000000000000",
+ "0xc2bae4a233c2d85724f0dabebda0249d833e37d3": "5000000000000000000000",
+ "0x10d32416722ca4e648630548ead91edd79c06aff": "100000000000000000000",
+ "0xd5f07552b5c693c20067b378b809cee853b8f136": "505540000000000000000",
+ "0x8668af868a1e98885f937f2615ded6751804eb2d": "20000000000000000000",
+ "0x139d3531c9922ad56269f6309aa789fb2485f98c": "4000000000000000000000",
+ "0x1d29c7aab42b2048d2b25225d498dba67a03fbb2": "200000000000000000000",
+ "0xd35075ca61fe59d123969c36a82d1ab2d918aa38": "2674000000000000000000",
+ "0xd6fc0446c6a8d40ae3551db7e701d1fa876e4a49": "2000000000000000000000",
+ "0xfccd0d1ecee27addea95f6857aeec8c7a04b28ee": "10000000000000000000000",
+ "0xc12cfb7b3df70fceca0ede263500e27873f8ed16": "1000000000000000000000",
+ "0xd0db456178206f5c4430fe005063903c3d7a49a7": "706245000000000000000",
+ "0x73cf80ae9688e1580e68e782cd0811f7aa494d2c": "7760000000000000000000",
+ "0xd60651e393783423e5cc1bc5f889e44ef7ea243e": "398800000000000000000",
+ "0x048a8970ea4145c64d5517b8de5b46d0595aad06": "20000000000000000000000",
+ "0xdd9b485a3b1cd33a6a9c62f1e5bee92701856d25": "225073000000000000000",
+ "0x5b287c7e734299e727626f93fb1187a60d5057fe": "101230000000000000000",
+ "0x635c00fdf035bca15fa3610df3384e0fb79068b1": "9000000000000000000000",
+ "0x630a913a9031c9492abd4c41dbb15054cfec4416": "5688000000000000000000",
+ "0xaf3614dcb68a36e45a4e911e62796247222d595b": "2259800000000000000000",
+ "0x335e22025b7a77c3a074c78b8e3dfe071341946e": "10178744000000000000000",
+ "0xf0e1dfa42adeac2f17f6fdf584c94862fd563393": "500000000000000000000",
+ "0x1a9e702f385dcd105e8b9fa428eea21c57ff528a": "1400000000000000000000",
+ "0x8ce4949d8a16542d423c17984e6739fa72ceb177": "24999975000000000000000",
+ "0x5f29c9de765dde25852af07d33f2ce468fd20982": "2000000000000000000000",
+ "0xdbf5f061a0f48e5e69618739a77d2ec19768d201": "152000000000000000000",
+ "0xb247cf9c72ec482af3eaa759658f793d670a570c": "912000000000000000000",
+ "0x99f4147ccc6bcb80cc842e69f6d00e30fa4133d9": "400000000000000000000",
+ "0xba6d31b9a261d640b5dea51ef2162c3109f1eba8": "5000000000000000000000",
+ "0xf05ba8d7b68539d933300bc9289c3d9474d0419e": "126400000000000000000",
+ "0x682e96276f518d31d7e56e30dfb009c1218201bd": "20000000000000000000",
+ "0x0927220492194b2eda9fc4bbe38f25d681dfd36c": "6000000000000000000000",
+ "0xa3c33afc8cb4704e23153de2049d35ae71332472": "799600000000000000000",
+ "0x05c736d365aa37b5c0be9c12c8ad5cd903c32cf9": "6002000000000000000000",
+ "0xd8eef4cf4beb01ee20d111748b61cb4d3f641a01": "2740000000000000000000",
+ "0x16c1bf5b7dc9c83c179efacbcf2eb174e3561cb3": "1000000000000000000000",
+ "0xd79db5ab43621a7a3da795e58929f3dd25af67d9": "1999944000000000000000",
+ "0x28efae6356509edface89fc61a7fdcdb39eea8e5": "5348000000000000000000",
+ "0xc55005a6c37e8ca7e543ce259973a3cace961a4a": "2000000000000000000000",
+ "0xab3d86bc82927e0cd421d146e07f919327cdf6f9": "1910000000000000000000",
+ "0xb74ed2666001c16333cf7af59e4a3d4860363b9c": "193600000000000000000",
+ "0x1899f69f653b05a5a6e81f480711d09bbf97588c": "1955000000000000000000",
+ "0x27fc85a49cff90dbcfdadc9ddd40d6b9a2210a6c": "100000000000000000000",
+ "0xcd1ed263fbf6f6f7b48aef8f733d329d4382c7c7": "18500000000000000000",
+ "0xd97fe6f53f2a58f6d76d752adf74a8a2c18e9074": "309990000000000000000",
+ "0x80da2fdda29a9e27f9e115975e69ae9cfbf3f27e": "200000000000000000000",
+ "0x09146ea3885176f07782e1fe30dce3ce24c49e1f": "20000000000000000000",
+ "0x393ff4255e5c658f2e7f10ecbd292572671bc2d2": "2000000000000000000000",
+ "0xa390ca122b8501ee3e5e07a8ca4b419f7e4dae15": "100000000000000000000",
+ "0x6d9193996b194617211106d1635eb26cc4b66c6c": "399640000000000000000",
+ "0x999c49c174ca13bc836c1e0a92bff48b271543ca": "3280000000000000000000",
+ "0x7421ce5be381738ddc83f02621974ff0686c79b8": "1632000000000000000000",
+ "0x6be9030ee6e2fbc491aca3de4022d301772b7b7d": "26740000000000000000",
+ "0x81bd75abd865e0c3f04a0b4fdbcb74d34082fbb7": "4000000000000000000000",
+ "0x8bc1ff8714828bf286ff7e8a7709106548ed1b18": "10000000000000000000000",
+ "0xa0aadbd9509722705f6d2358a5c79f37970f00f6": "200000000000000000000",
+ "0x3d881433f04a7d0d27f84944e08a512da3555287": "1200000000000000000000",
+ "0xcc1d6ead01aada3e8dc7b95dca25df26eefa639d": "2000000000000000000000",
+ "0x35106ba94e8563d4b3cb3c5c692c10e604b7ced8": "2000000000000000000000",
+ "0x4d8697af0fbf2ca36e8768f4af22133570685a60": "20000000000000000000",
+ "0x1afcc585896cd0ede129ee2de5c19ea811540b64": "3231259000000000000000",
+ "0xe5215631b14248d45a255296bed1fbfa0330ff35": "1310000000000000000000",
+ "0xe3878f91ca86053fced5444686a330e09cc388fb": "194000000000000000000",
+ "0x555df19390c16d01298772bae8bc3a1152199cbd": "200000000000000000000",
+ "0xdc3dae59ed0fe18b58511e6fe2fb69b219689423": "100000000000000000000",
+ "0x74648caac748dd135cd91ea14c28e1bd4d7ff6ae": "3100000000000000000000",
+ "0xcf2e2ad635e9861ae95cb9bafcca036b5281f5ce": "35200000000000000000000",
+ "0x14eec09bf03e352bd6ff1b1e876be664ceffd0cf": "20094000000000000000",
+ "0x856e5ab3f64c9ab56b009393b01664fc0324050e": "1790000000000000000000",
+ "0x632b9149d70178a7333634275e82d5953f27967b": "700000000000000000000",
+ "0x2a39190a4fde83dfb3ddcb4c5fbb83ac6c49755c": "1000000000000000000000",
+ "0x369ef761195f3a373e24ece6cd22520fe0b9e86e": "534933000000000000000",
+ "0x16afa787fc9f94bdff6976b1a42f430a8bf6fb0f": "2000000000000000000000",
+ "0x1b0b31afff4b6df3653a94d7c87978ae35f34aae": "354600000000000000000",
+ "0xb4d82f2e69943f7de0f5f7743879406fac2e9cec": "40000000000000000000",
+ "0x09d6cefd75b0c4b3f8f1d687a522c96123f1f539": "6000000000000000000000",
+ "0x01577afd4e50890247c9b10d44af73229aec884f": "680000000000000000000",
+ "0xa35606d51220ee7f2146d411582ee4ee4a45596e": "3996800000000000000000",
+ "0x352e77c861696ef96ad54934f894aa8ea35151dd": "1000000000000000000000",
+ "0xb87f5376c2de0b6cc3c179c06087aa473d6b4674": "1337000000000000000000",
+ "0x5b49afcd75447838f6e7ceda8d21777d4fc1c3c0": "4000000000000000000000",
+ "0xb884add88d83dc564ab8e0e02cbdb63919aea844": "2000000000000000000000",
+ "0x5c312a56c784b122099b764d059c21ece95e84ca": "95000000000000000000",
+ "0x4697baaf9ccb603fd30430689d435445e9c98bf5": "199600000000000000000",
+ "0xc625f8c98d27a09a1bcabd5128b1c2a94856af30": "200000000000000000000",
+ "0x19f5caf4c40e6908813c0745b0aea9586d9dd931": "664000000000000000000",
+ "0x1e596a81b357c6f24970cc313df6dbdaabd0d09e": "2000000000000000000000",
+ "0xc1631228efbf2a2e3a4092ee8900c639ed34fbc8": "955000000000000000000",
+ "0x6f6cf20649a9e973177ac67dbadee4ebe5c7bdda": "5080000000000000000000",
+ "0x5fa7bfe043886127d4011d8356a47e947963aca8": "1820000000000000000000",
+ "0x6af8e55969682c715f48ad4fc0fbb67eb59795a3": "2000000000000000000000",
+ "0x122f56122549d168a5c5e267f52662e5c5cce5c8": "185000000000000000000",
+ "0x7713ab8037411c09ba687f6f9364f0d3239fac28": "10000000000000000000000",
+ "0x31ccc616b3118268e75d9ab8996c8858ebd7f3c3": "399924000000000000000",
+ "0x09c88f917e4d6ad473fa12e98ea3c4472a5ed6da": "10000000000000000000000",
+ "0xe796fd4e839b4c95d7510fb7c5c72b83c6c3e3c7": "512200000000000000000",
+ "0xa8285539869d88f8a961533755717d7eb65576ae": "200000000000000000000",
+ "0xd929c65d69d5bbaea59762662ef418bc21ad924a": "1000000000000000000000",
+ "0xf7418aa0e713d248228776b2e7434222ae75e3a5": "2000000000000000000000",
+ "0x7f0b90a1fdd48f27b268feb38382e55ddb50ef0f": "940000000000000000000",
+ "0x34a0431fff5ead927f3c69649616dc6e97945f6f": "400000000000000000000",
+ "0x1b3cb81e51011b549d78bf720b0d924ac763a7c2": "560000000000000000000000",
+ "0x155b3779bb6d56342e2fda817b5b2d81c7f41327": "50200000000000000000",
+ "0xecd486fc196791b92cf612d348614f9156488b7e": "12000000000000000000000",
+ "0x82a8cbbfdff02b2e38ae4bbfca15f1f0e83b1aea": "84999000000000000000",
+ "0x06b0c1e37f5a5ec4bbf50840548f9d3ac0288897": "4000098000000000000000",
+ "0xe6d49f86c228f47367a35e886caacb271e539429": "412656000000000000000",
+ "0x704a6eb41ba34f13addde7d2db7df04915c7a221": "1820000000000000000000",
+ "0x745ccf2d819edbbddea8117b5c49ed3c2a066e93": "4000000000000000000000",
+ "0x6d3b7836a2b9d899721a4d237b522385dce8dfcd": "1000070000000000000000",
+ "0x856aa23c82d7215bec8d57f60ad75ef14fa35f44": "20000000000000000000000",
+ "0xea79057dabef5e64e7b44f7f18648e7e533718d2": "200000000000000000000",
+ "0x9df057cd03a4e27e8e032f857985fd7f01adc8d7": "2000000000000000000000",
+ "0x5f2f07d2d697e8c567fcfdfe020f49f360be2139": "2000000000000000000000",
+ "0x5efbdfe5389999633c26605a5bfc2c1bb5959393": "69200000000000000000",
+ "0x047e87c8f7d1fce3b01353a85862a948ac049f3e": "1490000000000000000000",
+ "0x265383d68b52d034161bfab01ae1b047942fbc32": "21000600000000000000000",
+ "0x760ff3354e0fde938d0fb5b82cef5ba15c3d2916": "10000000000000000000000",
+ "0xbc46d537cf2edd403565bde733b2e34b215001bd": "20000000000000000000000",
+ "0xee58fb3db29070d0130188ce472be0a172b89055": "10021400000000000000000",
+ "0x75abe5270f3a78ce007cf37f8fbc045d489b7bb1": "1999944000000000000000",
+ "0x5fc6c11426b4a1eae7e51dd512ad1090c6f1a85b": "2730000000000000000000",
+ "0x26cfffd052152bb3f957b478d5f98b233a7c2b92": "4000000000000000000000",
+ "0x0a4a011995c681bc999fdd79754e9a324ae3b379": "41350300000000000000000",
+ "0x6fa60df818a5446418b1bbd62826e0b9825e1318": "13200000000000000000000",
+ "0x63d55ad99b9137fd1b20cc2b4f03d42cbaddf334": "400000000000000000000",
+ "0x679b9a109930517e8999099ccf2a914c4c8dd934": "60000000000000000000",
+ "0x3e83544f0082552572c782bee5d218f1ef064a9d": "100076000000000000000",
+ "0x968b14648f018333687cd213fa640aec04ce6323": "1000000000000000000000",
+ "0x427b462ab84e5091f48a46eb0cdc92ddcb26e078": "2000000000000000000000",
+ "0xdf8510793eee811c2dab1c93c6f4473f30fbef5b": "1000000000000000000000",
+ "0x362fbcb10662370a068fc2652602a2577937cce6": "200000000000000000000",
+ "0x5d83b21bd2712360436b67a597ee3378db3e7ae4": "2000000000000000000000",
+ "0x5777441c83e03f0be8dd340bde636850847c620b": "10000000000000000000000",
+ "0xc94a585203da7bbafd93e15884e660d4b1ead854": "7000000000000000000000",
+ "0x35a08081799173e001cc5bd46a02406dc95d1787": "10000000000000000000000",
+ "0x21d13f0c4024e967d9470791b50f22de3afecf1b": "4452210000000000000000",
+ "0xfdfd6134c04a8ab7eb16f00643f8fed7daaaecb2": "400000000000000000000",
+ "0xfd812bc69fb170ef57e2327e80affd14f8e4b6d2": "2000000000000000000000",
+ "0x7148aef33261d8031fac3f7182ff35928daf54d9": "4100000000000000000000",
+ "0x0b06390f2437b20ec4a3d3431b3279c6583e5ed7": "194000000000000000000",
+ "0x4909b31998ead414b8fb0e846bd5cbde393935be": "4000000000000000000000",
+ "0xb70dba9391682b4a364e77fe99256301a6c0bf1f": "200000000000000000000",
+ "0x6b83bae7b565244558555bcf4ba8da2011891c17": "2000000000000000000000",
+ "0x70a03549aa6168e97e88a508330a5a0bea74711a": "1337000000000000000000",
+ "0x0fc9a0e34145fbfdd2c9d2a499b617d7a02969b9": "180000000000000000000",
+ "0x2ddf40905769bcc426cb2c2938ffe077e1e89d98": "3000000000000000000000",
+ "0x794b51c39e53d9e762b0613b829a44b472f4fff3": "667965000000000000000",
+ "0xd062588171cf99bbeb58f126b870f9a3728d61ec": "4500000000000000000000",
+ "0x8db185fe1b70a94a6a080e7e23a8bedc4acbf34b": "1400000000000000000000",
+ "0xe73bfeada6f0fd016fbc843ebcf6e370a65be70c": "1970000000000000000000",
+ "0x79ed10cf1f6db48206b50919b9b697081fbdaaf3": "2000000000000000000000",
+ "0x276b0521b0e68b277df0bb32f3fd48326350bfb2": "50000000000000000000",
+ "0x2e439348df8a4277b22a768457d1158e97c40904": "776970000000000000000",
+ "0x6c25327f8dcbb2f45e561e86e35d8850e53ab059": "1103200000000000000000",
+ "0x04d73896cf6593a691972a13a6e4871ff2c42b13": "2000000000000000000000",
+ "0xb10fd2a647102f881f74c9fbc37da632949f2375": "40000000000000000000",
+ "0x615f82365c5101f071e7d2cb6af14f7aad2c16c6": "20000000000000000000",
+ "0x93aa8f92ebfff991fc055e906e651ac768d32bc8": "940000000000000000000",
+ "0x0cbf8770f0d1082e5c20c5aead34e5fca9ae7ae2": "1000000000000000000000",
+ "0xffc9cc3094b041ad0e076f968a0de3b167255866": "432400000000000000000",
+ "0x46531e8b1bde097fdf849d6d119885608a008df7": "200000000000000000000",
+ "0x23cd2598a20e149ead2ad69379576ecedb60e38e": "2000000000000000000000",
+ "0x85ca8bc6da2803d0725f5e1a456c89f9bc774e2f": "600000000000000000000",
+ "0xc0725ec2bdc33a1d826071dea29d62d4385a8c25": "40740000000000000000000",
+ "0x0e4765790352656bc656682c24fc5ef3e76a23c7": "46610000000000000000",
+ "0x2ef9e465716acacfb8c8252fa8e7bc7969ebf6e4": "2760000000000000000000",
+ "0x0ec5308b31282e218fc9e759d4fec5db3708cec4": "1001000000000000000000",
+ "0xbf7701fc6225d5a17815438a8941d21ebc5d059d": "1880000000000000000000",
+ "0xc489c83ffbb0252ac0dbe3521217630e0f491f14": "4000000000000000000000",
+ "0x8eb51774af206b966b8909c45aa6722748802c0c": "500000000000000000000",
+ "0x7b9226d46fe751940bc416a798b69ccf0dfab667": "4200000000000000000000",
+ "0x8f660f8b2e4c7cc2b4ac9c47ed28508d5f8f8650": "20000000000000000000000",
+ "0x9f19fac8a32437d80ac6837a0bb7841729f4972e": "650100000000000000000",
+ "0x201864a8f784c2277b0b7c9ee734f7b377eab648": "4467000000000000000000",
+ "0xa6101c961e8e1c15798ffcd0e3201d7786ec373a": "6000000000000000000000",
+ "0xd4ff46203efa23064b1caf00516e28704a82a4f8": "1337000000000000000000",
+ "0xaa136b47962bb8b4fb540db4ccf5fdd042ffb8cf": "500038000000000000000",
+ "0x704ae21d762d6e1dde28c235d13104597236db1a": "2000000000000000000000",
+ "0xf17a92e0361dbacecdc5de0d1894955af6a9b606": "2000000000000000000000",
+ "0x8b48e19d39dd35b66e6e1bb6b9c657cb2cf59d04": "17844175000000000000000",
+ "0x9ad47fdcf9cd942d28effd5b84115b31a658a13e": "3290000000000000000000",
+ "0xdf0d08617bd252a911df8bd41a39b83ddf809673": "10000000000000000000000",
+ "0x4c666b86f1c5ee8ca41285f5bde4f79052081406": "500000000000000000000",
+ "0x88dec5bd3f4eba2d18b8aacefa7b721548c319ba": "1370000000000000000000",
+ "0x9f9fe0c95f10fee87af1af207236c8f3614ef02f": "6000000000000000000000",
+ "0xf7d0d310acea18406138baaabbfe0571e80de85f": "1337000000000000000000",
+ "0x9569c63a9284a805626db3a32e9d236393476151": "1970000000000000000000",
+ "0x5d5c2c1099bbeefb267e74b58880b444d94449e0": "253574000000000000000",
+ "0x8c6ae7a05a1de57582ae2768204276c0ff47ed03": "208000000000000000000000",
+ "0x432d884bd69db1acc0d89c64ade4cb4fc3a88b7a": "2483000000000000000000",
+ "0x672cbca8440a8577097b19aff593a2ad9d28a756": "80000000000000000000",
+ "0x19df9445a81c1b3d804aeaeb6f6e204e4236663f": "37387000000000000000",
+ "0x1cb5f33b4d488936d13e3161da33a1da7df70d1b": "200000000000000000000",
+ "0xdf60f18c812a11ed4e2776e7a80ecf5e5305b3d6": "900000000000000000000",
+ "0xc99a9cd6c9c1be3534eecd92ecc22f5c38e9515b": "4821030000000000000000",
+ "0x00c40fe2095423509b9fd9b754323158af2310f3": "0",
+ "0xda4a5f557f3bab390a92f49b9b900af30c46ae80": "10000000000000000000000",
+ "0xf36df02fbd89607347afce2969b9c4236a58a506": "2000000000000000000000",
+ "0xc549df83c6f65eec0f1dc9a0934a5c5f3a50fd88": "2910000000000000000000",
+ "0x9f662e95274121f177566e636d23964cf1fd686f": "2000000000000000000000",
+ "0x5a267331facb262daaecd9dd63a9700c5f5259df": "100000000000000000000",
+ "0x117d9aa3c4d13bee12c7500f09f5dd1c66c46504": "206000000000000000000",
+ "0x1b4d07acd38183a61bb2783d2b7b178dd502ac8d": "200000000000000000000",
+ "0x3c0c3defac9cea7acc319a96c30b8e1fedab4574": "1940000000000000000000",
+ "0xe4dc22ed595bf0a337c01e03cc6be744255fc9e8": "191000000000000000000",
+ "0x8f067c7c1bbd57780b7b9eeb9ec0032f90d0dcf9": "20000000000000000000000",
+ "0x40e2440ae142c880366a12c6d4102f4b8434b62a": "1000000000000000000000",
+ "0xf9ece022bccd2c92346911e79dd50303c01e0188": "1000000000000000000000",
+ "0xf70328ef97625fe745faa49ee0f9d4aa3b0dfb69": "1000000000000000000000",
+ "0xb6aacb8cb30bab2ae4a2424626e6e12b02d04605": "8000000000000000000000",
+ "0x154459fa2f21318e3434449789d826cdc1570ce5": "2000000000000000000000",
+ "0x684a44c069339d08e19a75668bdba303be855332": "70000000000000000000000",
+ "0x9fe501aa57ead79278937cd6308c5cfa7a5629fe": "50003000000000000000",
+ "0x3e45bd55db9060eced923bb9cb733cb3573fb531": "1640000000000000000000",
+ "0x9c9f3b8a811b21f3ff3fe20fe970051ce66a824f": "1157740000000000000000",
+ "0xe99aece90541cae224b87da673965e0aeb296afd": "920000000000000000000",
+ "0x2f6dce1330c59ef921602154572d4d4bacbd048a": "1000000000000000000000",
+ "0x6a6353b971589f18f2955cba28abe8acce6a5761": "3000000000000000000000",
+ "0x98c10ebf2c4f97cba5a1ab3f2aafe1cac423f8cb": "300000000000000000000",
+ "0x8077c3e4c445586e094ce102937fa05b737b568c": "100000000000000000000",
+ "0x13371f92a56ea8381e43059a95128bdc4d43c5a6": "1000000000000000000000",
+ "0x35a6885083c899dabbf530ed6c12f4dd3a204cf5": "200000000000000000000",
+ "0x36b2c85e3aeeebb70d63c4a4730ce2e8e88a3624": "10000000000000000000000",
+ "0x5ce44068b8f4a3fe799e6a8311dbfdeda29dee0e": "2000000000000000000000",
+ "0x6fa6388d402b30afe59934c3b9e13d1186476018": "670000000000000000000",
+ "0x8251358ca4e060ddb559ca58bc0bddbeb4070203": "2000000000000000000000",
+ "0x17e86f3b5b30c0ba59f2b2e858425ba89f0a10b0": "2000000000000000000000",
+ "0x298ec76b440d8807b3f78b5f90979bee42ed43db": "30000000000000000000000",
+ "0xce4b065dbcb23047203262fb48c1188364977470": "500000000000000000000",
+ "0xc8e2adeb545e499d982c0c117363ceb489c5b11f": "985000000000000000000",
+ "0x9928ff715afc3a2b60f8eb4cc4ba4ee8dab6e59d": "440000000000000000000",
+ "0xc76130c73cb9210238025c9df95d0be54ac67fbe": "1500000000000000000000",
+ "0x72d03d4dfab3500cf89b86866f15d4528e14a195": "4488000000000000000000",
+ "0xd193e583d6070563e7b862b9614a47e99489f3e5": "999972000000000000000",
+ "0x4df140ba796585dd5489315bca4bba680adbb818": "2674000000000000000000",
+ "0x009eef0a0886056e3f69211853b9b7457f3782e4": "3000512000000000000000",
+ "0x6e255b700ae7138a4bacf22888a9e2c00a285eec": "4000000000000000000000",
+ "0xaa47a4ffc979363232c99b99fada0f2734b0aeee": "8121800000000000000000",
+ "0x9d069197d1de50045a186f5ec744ac40e8af91c6": "2000000000000000000000",
+ "0xb514882c979bb642a80dd38754d5b8c8296d9a07": "955000000000000000000",
+ "0x17c0478657e1d3d17aaa331dd429cecf91f8ae5d": "999942000000000000000",
+ "0x5f9616c47b4a67f406b95a14fe6fc268396f1721": "200000000000000000000",
+ "0xf70a998a717b338d1dd99854409b1a338deea4b0": "2000000000000000000000",
+ "0xd1ee905957fe7cc70ec8f2868b43fe47b13febff": "44000000000000000000",
+ "0xfc018a690ad6746dbe3acf9712ddca52b6250039": "10000000000000000000000",
+ "0x5118557d600d05c2fcbf3806ffbd93d02025d730": "11360000000000000000000",
+ "0x1ef5c9c73650cfbbde5c885531d427c7c3fe5544": "6000000000000000000000",
+ "0xd1a396dcdab2c7494130b3fd307820340dfd8c1f": "17952000000000000000",
+ "0x2d8e061892a5dcce21966ae1bb0788fd3e8ba059": "250066000000000000000",
+ "0x8834b2453471f324fb26be5b25166b5b5726025d": "573000000000000000000",
+ "0x14f221159518783bc4a706676fc4f3c5ee405829": "200000000000000000000",
+ "0xc056d4bd6bf3cbacac65f8f5a0e3980b852740ae": "100000000000000000000",
+ "0x560536794a9e2b0049d10233c41adc5f418a264a": "1000000000000000000000",
+ "0xbc9e0ec6788f7df4c7fc210aacd220c27e45c910": "500000000000000000000",
+ "0x54bcb8e7f73cda3d73f4d38b2d0847e600ba0df8": "1078000000000000000000",
+ "0x4361d4846fafb377b6c0ee49a596a78ddf3516a3": "3580000000000000000000",
+ "0x41c3c2367534d13ba2b33f185cdbe6ac43c2fa31": "4000000000000000000000",
+ "0x5dc6f45fef26b06e3302313f884daf48e2746fb9": "500000000000000000000",
+ "0xad414d29cb7ee973fec54e22a388491786cf5402": "14000000000000000000000",
+ "0x802dc3c4ff2d7d925ee2859f4a06d7ba60f1308c": "98040000000000000000",
+ "0x2aed2ce531c056b0097efc3c6de10c4762004ed9": "10430000000000000000000",
+ "0x39782ffe06ac78822a3c3a8afe305e50a56188ce": "10000000000000000000000",
+ "0xec73833de4b810bb027810fc8f69f544e83c12d1": "1000000000000000000000",
+ "0x8d51a4cc62011322c696fd725b9fb8f53feaaa07": "1000000000000000000000",
+ "0x29298ccbdff689f87fe41aa6e98fdfb53deaf37a": "19800000000000000000000",
+ "0x827531a6c5817ae35f82b00b9754fcf74c55e232": "3600000000000000000000",
+ "0x9c581a60b61028d934167929b22d70b313c34fd0": "50000000000000000000000",
+ "0x0a077db13ffeb09484c217709d5886b8bf9c5a8b": "4000000000000000000000",
+ "0x07b7a57033f8f11330e4665e185d234e83ec140b": "4325683000000000000000",
+ "0x17f523f117bc9fe978aa481eb4f5561711371bc8": "1999884000000000000000",
+ "0xde42fcd24ce4239383304367595f068f0c610740": "45120000000000000000",
+ "0x2a46d353777176ff8e83ffa8001f4f70f9733aa5": "106000000000000000000",
+ "0x92e4392816e5f2ef5fb65837cec2c2325cc64922": "10000000000000000000000",
+ "0x9a3da65023a13020d22145cfc18bab10bd19ce4e": "456516000000000000000",
+ "0x1a085d43ec92414ea27b914fe767b6d46b1eef44": "29550000000000000000000",
+ "0x3b2367f8494b5fe18d683c055d89999c9f3d1b34": "10000000000000000000000",
+ "0x84244fc95a6957ed7c1504e49f30b8c35eca4b79": "2000000000000000000000",
+ "0x5e031b0a724471d476f3bcd2eb078338bf67fbef": "18200000000000000000",
+ "0x97e5cc6127c4f885be02f44b42d1c8b0ac91e493": "200000000000000000000",
+ "0xeb1cea7b45d1bd4d0e2a007bd3bfb354759e2c16": "198000000000000000000",
+ "0x72feaf124579523954645b7fafff0378d1c8242e": "1000000000000000000000",
+ "0x8d07d42d831c2d7c838aa1872b3ad5d277176823": "349200000000000000000",
+ "0x9637dc12723d9c78588542eab082664f3f038d9d": "1000000000000000000000",
+ "0xe84b55b525f1039e744b918cb3332492e45eca7a": "200000000000000000000",
+ "0xb1d6b01b94d854fe8b374aa65e895cf22aa2560e": "940000000000000000000",
+ "0x8161d940c3760100b9080529f8a60325030f6edc": "300000000000000000000",
+ "0xd30ee9a12b4d68abace6baca9ad7bf5cd1faf91c": "1499936000000000000000",
+ "0x057949e1ca0570469e4ce3c690ae613a6b01c559": "200000000000000000000",
+ "0x4bf8e26f4c2790da6533a2ac9abac3c69a199433": "200000000000000000000",
+ "0x36fec62c2c425e219b18448ad757009d8c54026f": "400000000000000000000",
+ "0x77bfe93ccda750847e41a1affee6b2da96e7214e": "300000000000000000000",
+ "0xcc48414d2ac4d42a5962f29eee4497092f431352": "161000000000000000000",
+ "0xddbddd1bbd38ffade0305d30f02028d92e9f3aa8": "2000000000000000000000",
+ "0x30c01142907acb1565f70438b9980ae731818738": "2000000000000000000000",
+ "0xcffc49c1787eebb2b56cabe92404b636147d4558": "5679305000000000000000",
+ "0xf99eeece39fa7ef5076d855061384009792cf2e0": "500000000000000000000",
+ "0xe9b6a790009bc16642c8d820b7cde0e9fd16d8f5": "3640000000000000000000",
+ "0x03b41b51f41df20dd279bae18c12775f77ad771c": "1000000000000000000000",
+ "0x787d313fd36b053eeeaedbce74b9fb0678333289": "27160000000000000000000",
+ "0x35d2970f49dcc81ea9ee707e9c8a0ab2a8bb7463": "1440000000000000000000",
+ "0x4c0aca508b3caf5ee028bc707dd1e800b838f453": "18200000000000000000",
+ "0x514632efbd642c04de6ca342315d40dd90a2dba6": "2674000000000000000000",
+ "0x36810ff9d213a271eda2b8aa798be654fa4bbe06": "2000000000000000000000",
+ "0x0c088006c64b30c4ddafbc36cb5f05469eb62834": "2000000000000000000000",
+ "0x568df31856699bb5acfc1fe1d680df9960ca4359": "1379999000000000000000",
+ "0xd48e3f9357e303513841b3f84bda83fc89727587": "1000000000000000000000",
+ "0x953ef652e7b769f53d6e786a58952fa93ee6abe7": "2860000000000000000000",
+ "0x7c60a05f7a4a5f8cf2784391362e755a8341ef59": "1892300000000000000000",
+ "0x7a6b26f438d9a352449155b8876cbd17c9d99b64": "6000000000000000000000",
+ "0x68f719ae342bd7fef18a05cbb02f705ad38ed5b2": "1050000000000000000000",
+ "0x45ca8d956608f9e00a2f9974028640888465668f": "2000000000000000000000",
+ "0x3eaf316b87615d88f7adc77c58e712ed4d77966b": "100141000000000000000",
+ "0x1f0412bfedcd964e837d092c71a5fcbaf30126e2": "20000000000000000000",
+ "0x7471f72eeb300624eb282eab4d03723c649b1b58": "8000000000000000000000",
+ "0x9bf71f7fb537ac54f4e514947fa7ff6728f16d2f": "33400000000000000000",
+ "0x1098c774c20ca1daac5ddb620365316d353f109c": "100000000000000000000",
+ "0x7dd8d7a1a34fa1f8e73ccb005fc2a03a15b8229c": "200000000000000000000",
+ "0x0151fa5d17a2dce2d7f1eb39ef7fe2ad213d5d89": "4000000000000000000000",
+ "0xad6628352ed3390bafa86d923e56014cfcb360f4": "2000000000000000000000",
+ "0x02af2459a93d0b3f4d062636236cd4b29e3bcecf": "1910000000000000000000",
+ "0xace2abb63b0604409fbde3e716d2876d44e8e5dd": "152000000000000000000",
+ "0xe710dcd09b8101f9437bd97db90a73ef993d0bf4": "386100000000000000000",
+ "0xd43ee438d83de9a37562bb4e286cb1bd19f4964d": "1000000000000000000000",
+ "0xea3779d14a13f6c78566bcde403591413a6239db": "197000000000000000000000",
+ "0x6704f169e0d0b36b57bbc39f3c45437b5ee3d28d": "394000000000000000000",
+ "0x5584423050e3c2051f0bbd8f44bd6dbc27ecb62c": "3000000000000000000000",
+ "0x2f315d9016e8ee5f536681202f9084b032544d4d": "1037400000000000000000",
+ "0xe1b63201fae1f129f95c7a116bd9dde5159c6cda": "22837462000000000000000",
+ "0x2bbe62eac80ca7f4d6fdee7e7d8e28b63acf770e": "2396000000000000000000",
+ "0x38da1ba2de9e2c954b092dd9d81204fd016ba016": "10156000000000000000000",
+ "0x8a86e4a51c013b1fb4c76bcf30667c78d52eedef": "2000000000000000000000",
+ "0x8f717ec1552f4c440084fba1154a81dc003ebdc0": "10000000000000000000000",
+ "0xc760971bbc181c6a7cf77441f24247d19ce9b4cf": "2000000000000000000000",
+ "0x7f150afb1a77c2b45928c268c1e9bdb4641d47d8": "2000000000000000000000",
+ "0x1ea334b5750807ea74aac5ab8694ec5f28aa77cf": "492500000000000000000",
+ "0x2afb058c3d31032b353bf24f09ae20d54de57dbe": "1100000000000000000000",
+ "0xcaef027b1ab504c73f41f2a10979b474f97e309f": "200000000000000000000",
+ "0x5dd112f368c0e6ceff77a9df02a5481651a02fb7": "169800000000000000000",
+ "0xbd93e550403e2a06113ed4c3fba1a8913b19407e": "2000000000000000000000",
+ "0x500c16352e901d48ba8d04e2c767121772790b02": "30239000000000000000",
+ "0xd2a80327cbe55c4c7bd51ff9dde4ca648f9eb3f8": "50000000000000000000",
+ "0x355ccfe0e77d557b971be1a558bc02df9eee0594": "1759120000000000000000",
+ "0x5aed0e6cfe95f9d680c76472a81a2b680a7f93e2": "197000000000000000000",
+ "0xf56442f60e21691395d0bffaa9194dcaff12e2b7": "260000000000000000000",
+ "0x7db9eacc52e429dc83b461c5f4d86010e5383a28": "1000000000000000000000",
+ "0x4b984ef26c576e815a2eaed2f5177f07dbb1c476": "1560000000000000000000",
+ "0x9846648836a307a057184fd51f628a5f8c12427c": "19100000000000000000000",
+ "0x4af0db077bb9ba5e443e21e148e59f379105c592": "600000000000000000000",
+ "0xe96e2d3813efd1165f12f602f97f4a62909d3c66": "2300000000000000000000",
+ "0x30e789b3d2465e946e6210fa5b35de4e8c93085f": "2000000000000000000000",
+ "0x97f99b6ba31346cd98a9fe4c308f87c5a58c5151": "6000000000000000000000",
+ "0x595e23d788a2d4bb85a15df7136d264a635511b3": "3940000000000000000000",
+ "0x2f61efa5819d705f2b1e4ee754aeb8a819506a75": "1460000000000000000000",
+ "0x3554947b7b947b0040da52ca180925c6d3b88ffe": "66850000000000000000",
+ "0x8feffadb387a1547fb284da9b8147f3e7c6dc6da": "837200000000000000000",
+ "0x258939bbf00c9de9af5338f5d714abf6d0c1c671": "1550000000000000000000",
+ "0x5b333696e04cca1692e71986579c920d6b2916f9": "500000000000000000000",
+ "0x5381448503c0c702542b1de7cc5fb5f6ab1cf6a5": "8000000000000000000000",
+ "0x7e81f6449a03374191f3b7cb05d938b72e090dff": "100000000000000000000",
+ "0x4ef1c214633ad9c0703b4e2374a2e33e3e429291": "1337000000000000000000",
+ "0xfed8476d10d584b38bfa6737600ef19d35c41ed8": "1820000000000000000000",
+ "0x1a95c9b7546b5d1786c3858fb1236446bc0ca4ce": "1970000000000000000000",
+ "0x3b07db5a357f5af2484cbc9d77d73b1fd0519fc7": "500000000000000000000",
+ "0x5f68a24c7eb4117667737b33393fb3c2148a53b6": "51800000000000000000",
+ "0xd8f665fd8cd5c2bcc6ddc0a8ae521e4dc6aa6060": "1700000000000000000000",
+ "0xd66acc0d11b689cea6d9ea5ff4014c224a5dc7c4": "18200000000000000000",
+ "0x6e72b2a1186a8e2916543b1cb36a68870ea5d197": "186000000000000000000",
+ "0x5102a4a42077e11c58df4773e3ac944623a66d9f": "2000325000000000000000",
+ "0x72480bede81ad96423f2228b5c61be44fb523100": "6400000000000000000000",
+ "0xe076db30ab486f79194ebbc45d8fab9a9242f654": "4840000000000000000000",
+ "0x8ceea15eec3bdad8023f98ecf25b2b8fef27db29": "2000000000000000000000",
+ "0x40652360d6716dc55cf9aab21f3482f816cc2cbd": "10000000000000000000000",
+ "0x13e02fb448d6c84ae17db310ad286d056160da95": "2000000000000000000000",
+ "0xd6598b1386e93c5ccb9602ff4bbbecdbd3701dc4": "224096000000000000000",
+ "0xd5ea472cb9466018110af00c37495b5c2c713112": "4997800000000000000000",
+ "0xbb75cb5051a0b0944b4673ca752a97037f7c8c15": "200000000000000000000",
+ "0x8af626a5f327d7506589eeb7010ff9c9446020d2": "1400000000000000000000",
+ "0x318c76ecfd8af68d70555352e1f601e35988042d": "501600000000000000000",
+ "0x5c3d19441d196cb443662020fcad7fbb79b29e78": "14300000000000000000",
+ "0x27101a0f56d39a88c5a84f9b324cdde33e5cb68c": "2000000000000000000000",
+ "0xe229e746a83f2ce253b0b03eb1472411b57e5700": "5730000000000000000000",
+ "0x604cdf18628dbfa8329194d478dd5201eecc4be7": "23000000000000000000",
+ "0x657473774f63ac3d6279fd0743d5790c4f161503": "200000000000000000000",
+ "0x1ddefefd35ab8f658b2471e54790bc17af98dea4": "1000000000000000000000",
+ "0xac3900298dd14d7cc96d4abb428da1bae213ffed": "24730250000000000000000",
+ "0x944f07b96f90c5f0d7c0c580533149f3f585a078": "74000000000000000000",
+ "0x232c6d03b5b6e6711efff190e49c28eef36c82b0": "1337000000000000000000",
+ "0xc87c77e3c24adecdcd1038a38b56e18dead3b702": "8800000000000000000000",
+ "0xc4b6e5f09cc1b90df07803ce3d4d13766a9c46f4": "6000000000000000000000",
+ "0xd44334b4e23a169a0c16bd21e866bba52d970587": "2600000000000000000000",
+ "0x7757a4b9cc3d0247ccaaeb9909a0e56e1dd6dcc2": "20000000000000000000",
+ "0xcf694081c76d18c64ca71382be5cd63b3cb476f8": "1000000000000000000000",
+ "0x133e4f15e1e39c53435930aaedf3e0fe56fde843": "20000000000000000000",
+ "0xf067fb10dfb293e998abe564c055e3348f9fbf1e": "2000000000000000000000",
+ "0x94449c01b32a7fa55af8104f42cdd844aa8cbc40": "16548000000000000000000",
+ "0x0e2094ac1654a46ba1c4d3a40bb8c17da7f39688": "358000000000000000000",
+ "0x738ca94db7ce8be1c3056cd6988eb376359f3353": "25500000000000000000000",
+ "0x0cfb172335b16c87d519cd1475530d20577f5e0e": "100000000000000000000000",
+ "0x3cb561ce86424b359891e364ec925ffeff277df7": "200000000000000000000",
+ "0x5f981039fcf50225e2adf762752112d1cc26b6e3": "499954000000000000000",
+ "0xb43657a50eecbc3077e005d8f8d94f377876bad4": "35460000000000000000",
+ "0xd07e511864b1cf9969e3560602829e32fc4e71f5": "50000000000000000000",
+ "0x11306c7d57588637780fc9fde8e98ecb008f0164": "1999944000000000000000",
+ "0x45ca9862003b4e40a3171fb5cafa9028cac8de19": "13790000000000000000000",
+ "0x231d94155dbcfe2a93a319b6171f63b20bd2b6fa": "3819952000000000000000",
+ "0xe7533e270cc61fa164ac1553455c105d04887e14": "121550000000000000000",
+ "0x070d5d364cb7bbf822fc2ca91a35bdd441b215d5": "2000000000000000000000",
+ "0xd475477fa56390d33017518d6711027f05f28dbf": "1975032000000000000000",
+ "0xcea34a4dd93dd9aefd399002a97d997a1b4b89cd": "1500000000000000000000",
+ "0x560becdf52b71f3d8827d927610f1a980f33716f": "429413000000000000000",
+ "0xf632adff490da4b72d1236d04b510f74d2faa3cd": "1400000000000000000000",
+ "0x2fdd9b79df8df530ad63c20e62af431ae99216b8": "21000000000000000000",
+ "0x535201a0a1d73422801f55ded4dfaee4fbaa6e3b": "39641000000000000000",
+ "0x409d5a962edeeebea178018c0f38b9cdb213f289": "20000000000000000000",
+ "0x9d911f3682f32fe0792e9fb6ff3cfc47f589fca5": "4000000000000000000000",
+ "0x9f7a0392f857732e3004a375e6b1068d49d83031": "2000000000000000000000",
+ "0x6a04f5d53fc0f515be942b8f12a9cb7ab0f39778": "3129800000000000000000",
+ "0xbe478e8e3dde6bd403bb2d1c657c4310ee192723": "492500000000000000000",
+ "0x007622d84a234bb8b078230fcf84b67ae9a8acae": "698800000000000000000",
+ "0x9475c510ec9a26979247744c3d8c3b0e0b5f44d3": "10000000000000000000000",
+ "0xdf47a8ef95f2f49f8e6f58184154145d11f72797": "1910000000000000000000",
+ "0x13ce332dff65a6ab933897588aa23e000980fa82": "258400000000000000000",
+ "0x9c4bbcd5f1644a6f075824ddfe85c571d6abf69c": "1800000000000000000000",
+ "0xd42b20bd0311608b66f8a6d15b2a95e6de27c5bf": "2000000000000000000000",
+ "0xa4dd59ab5e517d398e49fa537f899fed4c15e95d": "20000000000000000000000",
+ "0x1a8a5ce414de9cd172937e37f2d59cff71ce57a0": "10000000000000000000000",
+ "0x55c564664166a1edf3913e0169f1cd451fdb5d0c": "2399800000000000000000",
+ "0x58ae2ddc5f4c8ada97e06c0086171767c423f5d7": "1610000000000000000000",
+ "0xfb79abdb925c55b9f98efeef64cfc9eb61f51bb1": "1794000000000000000000",
+ "0xe7a42f59fee074e4fb13ea9e57ecf1cc48282249": "20000000000000000000000",
+ "0x07e2b4cdeed9d087b12e556d9e770c13c099615f": "668500000000000000000",
+ "0x68473b7a7d965904bedba556dfbc17136cd5d434": "100000000000000000000",
+ "0x6c5c3a54cda7c2f118edba434ed81e6ebb11dd7a": "200000000000000000000",
+ "0x24c117d1d2b3a97ab11a4679c99a774a9eade8d1": "1000000000000000000000",
+ "0xf68c5e33fa97139df5b2e63886ce34ebf3e4979c": "3320000000000000000000",
+ "0xbd7419dc2a090a46e2873d7de6eaaad59e19c479": "6802000000000000000000",
+ "0x1a0a1ddfb031e5c8cc1d46cf05842d50fddc7130": "1000000000000000000000",
+ "0x2b3a68db6b0cae8a7c7a476bdfcfbd6205e10687": "2400000000000000000000",
+ "0x426d15f407a01135b13a6b72f8f2520b3531e302": "20000000000000000000",
+ "0x0394b90fadb8604f86f43fc1e35d3124b32a5989": "764000000000000000000",
+ "0x7412c9bc30b4df439f023100e63924066afd53af": "500000000000000000000",
+ "0x80e7b3205230a566a1f061d922819bb4d4d2a0e1": "14000000000000000000000",
+ "0xff4fc66069046c525658c337a917f2d4b832b409": "2000000000000000000000",
+ "0xf5061ee2e5ee26b815503677130e1de07a52db07": "100000000000000000000",
+ "0x49793463e1681083d6abd6e725d5bba745dccde8": "545974000000000000000",
+ "0x23551f56975fe92b31fa469c49ea66ee6662f41e": "1910000000000000000000",
+ "0xfad96ab6ac768ad5099452ac4777bd1a47edc48f": "100000000000000000000",
+ "0x2a746cd44027af3ebd37c378c85ef7f754ab5f28": "394000000000000000000",
+ "0xb8d389e624a3a7aebce4d3e5dbdf6cdc29932aed": "200000000000000000000",
+ "0x7b761feb7fcfa7ded1f0eb058f4a600bf3a708cb": "4600000000000000000000",
+ "0x5435c6c1793317d32ce13bba4c4ffeb973b78adc": "250070000000000000000",
+ "0xdd04eee74e0bf30c3f8d6c2c7f52e0519210df93": "80000000000000000000",
+ "0x4331ab3747d35720a9d8ca25165cd285acd4bda8": "2000000000000000000000",
+ "0xb84c8b9fd33ece00af9199f3cf5fe0cce28cd14a": "3820000000000000000000",
+ "0x393f783b5cdb86221bf0294fb714959c7b45899c": "5910000000000000000000",
+ "0x259ec4d265f3ab536b7c70fa97aca142692c13fc": "20400000000000000000",
+ "0x5d2f7f0b04ba4be161e19cb6f112ce7a5e7d7fe4": "35200000000000000000",
+ "0xd54ba2d85681dc130e5b9b02c4e8c851391fd9b9": "3940000000000000000000",
+ "0x5cd8af60de65f24dc3ce5730ba92653022dc5963": "1790000000000000000000",
+ "0x3b42a66d979f582834747a8b60428e9b4eeccd23": "620400000000000000000",
+ "0x4b19eb0c354bc1393960eb06063b83926f0d67b2": "29000000000000000000",
+ "0x8cf3546fd1cda33d58845fc8fcfecabca7c5642a": "574027000000000000000",
+ "0x113612bc3ba0ee4898b49dd20233905f2f458f62": "14000000000000000000000",
+ "0x1f2afc0aed11bfc71e77a907657b36ea76e3fb99": "4000000000000000000000",
+ "0x03714b41d2a6f751008ef8dd4d2b29aecab8f36e": "6000000000000000000000",
+ "0x25721c87b0dc21377c7200e524b14a22f0af69fb": "4000000000000000000000",
+ "0x335858f749f169cabcfe52b796e3c11ec47ea3c2": "200000000000000000000",
+ "0x52fb46ac5d00c3518b2c3a1c177d442f8165555f": "1500000000000000000000",
+ "0x7a8c89c014509d56d7b68130668ff6a3ecec7370": "300000000000000000000",
+ "0x7d5d2f73949dadda0856b206989df0078d51a1e5": "10560000000000000000000",
+ "0xbe538246dd4e6f0c20bf5ad1373c3b463a131e86": "200000000000000000000",
+ "0x62680a15f8ccb8bdc02f7360c25ad8cfb57b8ccd": "1000000000000000000000",
+ "0xaa0ca3737337178a0caac3099c584b056c56301c": "880000000000000000000",
+ "0x1d341fa5a3a1bd051f7db807b6db2fc7ba4f9b45": "18200000000000000000",
+ "0x6463f715d594a1a4ace4bb9c3b288a74decf294d": "1970000000000000000000",
+ "0xe00d153b10369143f97f54b8d4ca229eb3e8f324": "152000000000000000000",
+ "0x8d0b9ea53fd263415eac11391f7ce9123c447062": "2000000000000000000000",
+ "0xcacb675e0996235404efafbb2ecb8152271b55e0": "700000000000000000000",
+ "0xb615e940143eb57f875893bc98a61b3d618c1e8c": "20000000000000000000",
+ "0x606f177121f7855c21a5062330c8762264a97b31": "4000000000000000000000",
+ "0xe3925509c8d0b2a6738c5f6a72f35314491248ce": "1012961000000000000000",
+ "0x3f08d9ad894f813e8e2148c160d24b353a8e74b0": "60000000000000000000000",
+ "0x40f4f4c06c732cd35b119b893b127e7d9d0771e4": "10000000000000000000000",
+ "0x1406854d149e081ac09cb4ca560da463f3123059": "1337000000000000000000",
+ "0xecf05d07ea026e7ebf4941002335baf2fed0f002": "200000000000000000000",
+ "0x9a990b8aeb588d7ee7ec2ed8c2e64f7382a9fee2": "33518000000000000000",
+ "0xa2e0683a805de6a05edb2ffbb5e96f0570b637c3": "20000000000000000000",
+ "0xfba5486d53c6e240494241abf87e43c7600d413a": "1987592000000000000000",
+ "0xd81bd54ba2c44a6f6beb1561d68b80b5444e6dc6": "1163806000000000000000",
+ "0x5298ab182a19359ffcecafd7d1b5fa212dede6dd": "20000000000000000000",
+ "0xd1acb5adc1183973258d6b8524ffa28ffeb23de3": "4000000000000000000000",
+ "0x4e7aa67e12183ef9d7468ea28ad239c2eef71b76": "4925000000000000000000",
+ "0x509a20bc48e72be1cdaf9569c711e8648d957334": "2000000000000000000000",
+ "0x949f84f0b1d7c4a7cf49ee7f8b2c4a134de32878": "685000000000000000000",
+ "0xedbac9527b54d6df7ae2e000cca3613ba015cae3": "1970000000000000000000",
+ "0xc697b70477cab42e2b8b266681f4ae7375bb2541": "5577200000000000000000",
+ "0x86c934e38e53be3b33f274d0539cfca159a4d0d1": "970000000000000000000",
+ "0x0877eeaeab78d5c00e83c32b2d98fa79ad51482f": "439420000000000000000",
+ "0x5e11ecf69d551d7f4f84df128046b3a13240a328": "20000000000000000000",
+ "0x43ff8853e98ed8406b95000ada848362d6a0392a": "22100000000000000000000",
+ "0xf11cf5d363746fee6864d3ca336dd80679bb87ae": "40000000000000000000000",
+ "0xfb223c1e22eac1269b32ee156a5385922ed36fb8": "2000000000000000000000",
+ "0x4e6600806289454acda330a2a3556010dfacade6": "6000000000000000000000",
+ "0xcfe2caaf3cec97061d0939748739bffe684ae91f": "10000000000000000000000",
+ "0xadeb52b604e5f77faaac88275b8d6b49e9f9f97f": "2089268000000000000000",
+ "0xd53c567f0c3ff2e08b7d59e2b5c73485437fc58d": "600000000000000000000",
+ "0xfbf75933e01b75b154ef0669076be87f62dffae1": "78000000000000000000000",
+ "0x7dfd2962b575bcbeee97f49142d63c30ab009f66": "4000000000000000000000",
+ "0xdf6485c4297ac152b289b19dde32c77ec417f47d": "1000000000000000000000",
+ "0xffb974673367f5c07be5fd270dc4b7138b074d57": "2470407000000000000000",
+ "0xf7d7af204c56f31fd94398e40df1964bd8bf123c": "150011000000000000000",
+ "0x4506fe19fa4b006baa3984529d8516db2b2b50ab": "2000000000000000000000",
+ "0xf4dc7ba85480bbb3f535c09568aaa3af6f3721c6": "7214962000000000000000",
+ "0xd171c3f2258aef35e599c7da1aa07300234da9a6": "2000000000000000000000",
+ "0x33581cee233088c0860d944e0cf1ceabb8261c2e": "13370000000000000000",
+ "0x1c2e3607e127caca0fbd5c5948adad7dd830b285": "19700000000000000000000",
+ "0xfd7ede8f5240a06541eb699d782c2f9afb2170f6": "1337000000000000000000",
+ "0x368c5414b56b8455171fbf076220c1cba4b5ca31": "557940000000000000000",
+ "0x3e8745ba322f5fd6cb50124ec46688c7a69a7fae": "4925000000000000000000",
+ "0x76506eb4a780c951c74a06b03d3b8362f0999d71": "500000000000000000000",
+ "0x96d62dfd46087f62409d93dd606188e70e381257": "2000000000000000000000",
+ "0x37eada93c475ded2f7e15e7787d400470fa52062": "200000000000000000000",
+ "0x26babf42b267fdcf3861fdd4236a5e474848b358": "1000000000000000000000",
+ "0x3526eece1a6bdc3ee7b400fe935b48463f31bed7": "82400000000000000000",
+ "0x27b62816e1e3b8d19b79d1513d5dfa855b0c3a2a": "99941000000000000000",
+ "0xb3e3c439069880156600c2892e448d4136c92d9b": "850000000000000000000",
+ "0x574ad9355390e4889ef42acd138b2a27e78c00ae": "1557000000000000000000",
+ "0xf0b9d683cea12ba600baace219b0b3c97e8c00e4": "100000000000000000000",
+ "0xa437fe6ec103ca8d158f63b334224eccac5b3ea3": "8000000000000000000000",
+ "0x7a48d877b63a8f8f9383e9d01e53e80c528e955f": "8000000000000000000000",
+ "0xe965daa34039f7f0df62375a37e5ab8a72b301e7": "4796000000000000000000",
+ "0x72cd048a110574482983492dfb1bd27942a696ba": "2000000000000000000000",
+ "0x6611ce59a98b072ae959dc49ad511daaaaa19d6b": "200000000000000000000",
+ "0x0d92582fdba05eabc3e51538c56db8813785b328": "191000000000000000000",
+ "0xe87e9bbfbbb71c1a740c74c723426df55d063dd9": "7998000000000000000000",
+ "0x9c99a1da91d5920bc14e0cb914fdf62b94cb8358": "20000000000000000000000",
+ "0xfe8e6e3665570dff7a1bda697aa589c0b4e9024a": "2000000000000000000000",
+ "0x811461a2b0ca90badac06a9ea16e787b33b196cc": "164000000000000000000",
+ "0xd211b21f1b12b5096181590de07ef81a89537ead": "2000000000000000000000",
+ "0x01155057002f6b0d18acb9388d3bc8129f8f7a20": "1340000000000000000000",
+ "0x8ce22f9fa372449a420610b47ae0c8d565481232": "2000000000000000000000",
+ "0xe02b74a47628be315b1f76b315054ad44ae9716f": "4000000000000000000000",
+ "0x92a7c5a64362e9f842a23deca21035857f889800": "1999944000000000000000",
+ "0x5213f459e078ad3ab95a0920239fcf1633dc04ca": "2599989000000000000000",
+ "0xc9957ba94c1b29e5277ec36622704904c63dc023": "1923000000000000000000",
+ "0x6ac40f532dfee5118117d2ad352da77d4f6da2c8": "400000000000000000000",
+ "0xea1efb3ce789bedec3d67c3e1b3bc0e9aa227f90": "734000000000000000000",
+ "0xb01e389b28a31d8e4995bdd7d7c81beeab1e4119": "1000000000000000000000",
+ "0xee97aa8ac69edf7a987d6d70979f8ec1fbca7a94": "376000000000000000000",
+ "0x0fad05507cdc8f24b2be4cb7fa5d927ddb911b88": "3004447000000000000000",
+ "0xb6e8afd93dfa9af27f39b4df06076710bee3dfab": "25000000000000000000",
+ "0x7d0b255efb57e10f7008aa22d40e9752dfcf0378": "29944000000000000000",
+ "0xaef5b12258a18dec07d5ec2e316574919d79d6d6": "2000000000000000000000",
+ "0x63666755bd41b5986997783c13043008242b3cb5": "500000000000000000000",
+ "0x921f5261f4f612760706892625c75e7bce96b708": "2000000000000000000000",
+ "0x10e1e3377885c42d7df218522ee7766887c05e6a": "300031000000000000000",
+ "0x134163be9fbbe1c5696ee255e90b13254395c318": "200000000000000000000",
+ "0x870f15e5df8b0eabd02569537a8ef93b56785c42": "388000000000000000000",
+ "0x68eec1e288ac31b6eaba7e1fbd4f04ad579a6b5d": "2000000000000000000000",
+ "0x1a2694ec07cf5e4d68ba40f3e7a14c53f3038c6e": "1000073000000000000000",
+ "0xcd9b4cef73390c83a8fd71d7b540a7f9cf8b8c92": "90000000000000000000",
+ "0xc8de7a564c7f4012a6f6d10fd08f47890fbf07d4": "300000000000000000000",
+ "0xc0345b33f49ce27fe82cf7c84d141c68f590ce76": "1000000000000000000000",
+ "0xfe53b94989d89964da2061539526bbe979dd2ea9": "1930600000000000000000",
+ "0x14410fb310711be074a80883c635d0ef6afb2539": "2000000000000000000000",
+ "0x1d344e962567cb27e44db9f2fac7b68df1c1e6f7": "1940000000000000000000",
+ "0xfe016ec17ec5f10e3bb98ff4a1eda045157682ab": "375804000000000000000",
+ "0xe89da96e06beaf6bd880b378f0680c43fd2e9d30": "601400000000000000000",
+ "0x0fee81ac331efd8f81161c57382bb4507bb9ebec": "400030000000000000000",
+ "0x40cf90ef5b768c5da585002ccbe6617650d8e837": "999800000000000000000",
+ "0x256fa150cc87b5056a07d004efc84524739e62b5": "200000000000000000000",
+ "0x1b9b2dc2960e4cb9408f7405827c9b59071612fd": "1000000000000000000000",
+ "0x0efd1789eb1244a3dede0f5de582d8963cb1f39f": "1500000000000000000000",
+ "0x049c5d4bc6f25d4e456c697b52a07811ccd19fb1": "300048000000000000000",
+ "0x02b7b1d6b34ce053a40eb65cd4a4f7dddd0e9f30": "685000000000000000000",
+ "0xc1827686c0169485ec15b3a7c8c01517a2874de1": "40000000000000000000",
+ "0xd8e5c9675ef4deed266b86956fc4590ea7d4a27d": "1000000000000000000000",
+ "0x48f883e567b436a27bb5a3124dbc84dec775a800": "771840000000000000000",
+ "0xa34076f84bd917f20f8342c98ba79e6fb08ecd31": "4200000000000000000000",
+ "0x21ce6d5b9018cec04ad6967944bea39e8030b6b8": "20000000000000000000",
+ "0x0596a27dc3ee115fce2f94b481bc207a9e261525": "1000000000000000000000",
+ "0x717cf9beab3638308ded7e195e0c86132d163fed": "15097428000000000000000",
+ "0xd5ce55d1b62f59433c2126bcec09bafc9dfaa514": "197000000000000000000",
+ "0x7dd46da677e161825e12e80dc446f58276e1127c": "820000000000000000000",
+ "0x98c5494a03ac91a768dffc0ea1dde0acbf889019": "200000000000000000000000",
+ "0x617ff2cc803e31c9082233b825d025be3f7b1056": "1970000000000000000000",
+ "0x1091176be19b9964a8f72e0ece6bf8e3cfad6e9c": "10020000000000000000000",
+ "0x4ea56e1112641c038d0565a9c296c463afefc17e": "182000000000000000000",
+ "0xe303167f3d4960fe881b32800a2b4aeff1b088d4": "2000000000000000000000",
+ "0x773141127d8cf318aebf88365add3d5527d85b6a": "1000076000000000000000",
+ "0xb916b1a01cdc4e56e7657715ea37e2a0f087d106": "2406017000000000000000",
+ "0x46a430a2d4a894a0d8aa3feac615361415c3f81f": "2000000000000000000000",
+ "0xe6a3010f0201bc94ff67a2f699dfc206f9e76742": "879088000000000000000",
+ "0xd7ad09c6d32657685355b5c6ec8e9f57b4ebb982": "1970000000000000000000",
+ "0x95e80a82c20cbe3d2060242cb92d735810d034a2": "32511000000000000000",
+ "0x9a390162535e398877e416787d6239e0754e937c": "1000000000000000000000",
+ "0xd85fdeaf2a61f95db902f9b5a53c9b8f9266c3ac": "2010000000000000000000",
+ "0xc3e20c96df8d4e38f50b265a98a906d61bc51a71": "2000000000000000000000",
+ "0x2949fd1def5c76a286b3872424809a07db3966f3": "5236067000000000000000",
+ "0x86cdb7e51ac44772be3690f61d0e59766e8bfc18": "4000000000000000000000",
+ "0x749a4a768b5f237248938a12c623847bd4e688dc": "72000000000000000000",
+ "0x3524a000234ebaaf0789a134a2a417383ce5282a": "5635000000000000000000",
+ "0x7b43c7eea8d62355b0a8a81da081c6446b33e9e0": "4000000000000000000000",
+ "0x0eb189ef2c2d5762a963d6b7bdf9698ea8e7b48a": "1337000000000000000000",
+ "0x767fd7797d5169a05f7364321c19843a8c348e1e": "18800000000000000000",
+ "0x1b2639588b55c344b023e8de5fd4087b1f040361": "1500000000000000000000",
+ "0x1e33d1c2fb5e084f2f1d54bc5267727fec3f985d": "500000000000000000000",
+ "0x06b106649aa8c421ddcd1b8c32cd0418cf30da1f": "40000000000000000000000",
+ "0x3c5a241459c6abbf630239c98a30d20b8b3ac561": "157600000000000000000",
+ "0x0f4f94b9191bb7bb556aaad7c74ddb288417a50b": "1400000000000000000000",
+ "0xd6f4a7d04e8faf20e8c6eb859cf7f78dd23d7a15": "131784000000000000000",
+ "0x61adf5929a5e2981684ea243baa01f7d1f5e148a": "110302000000000000000",
+ "0x8f58d8348fc1dc4e0dd8343b6543c857045ee940": "13632400000000000000000",
+ "0xa6e3baa38e104a1e27a4d82869afb1c0ae6eff8d": "19690000000000000000",
+ "0x67350b5331926f5e28f3c1e986f96443809c8b8c": "352000000000000000000",
+ "0x0b5d66b13c87b392e94d91d5f76c0d450a552843": "2000000000000000000000",
+ "0x562a8dcbbeeef7b360685d27303bd69e094accf6": "10000000000000000000000",
+ "0xb5d9934d7b292bcf603b2880741eb760288383a0": "16700000000000000000",
+ "0x6fc53662371dca587b59850de78606e2359df383": "180000000000000000000",
+ "0xe069c0173352b10bf6834719db5bed01adf97bbc": "18894000000000000000",
+ "0x10a93457496f1108cd98e140a1ecdbae5e6de171": "399600000000000000000",
+ "0x69ff8901b541763f817c5f2998f02dcfc1df2997": "40000000000000000000",
+ "0x00c27d63fde24b92ee8a1e7ed5d26d8dc5c83b03": "2000000000000000000000",
+ "0x77f81b1b26fc84d6de97ef8b9fbd72a33130cc4a": "1000000000000000000000",
+ "0x6d20ef9704670a500bb269b5832e859802049f01": "130000000000000000000",
+ "0x186afdc085f2a3dce4615edffbadf71a11780f50": "200000000000000000000",
+ "0x7ff0c63f70241bece19b737e5341b12b109031d8": "346000000000000000000",
+ "0x9d4174aa6af28476e229dadb46180808c67505c1": "1219430000000000000000",
+ "0x5fec49c665e64ee89dd441ee74056e1f01e92870": "6320000000000000000000",
+ "0x6cd228dc712169307fe27ceb7477b48cfc8272e5": "77600000000000000000",
+ "0xfd918536a8efa6f6cefe1fa1153995fef5e33d3b": "500000000000000000000",
+ "0x2fbb504a5dc527d3e3eb0085e2fc3c7dd538cb7a": "1249961000000000000000",
+ "0x6ab323ae5056ed0a453072c5abe2e42fcf5d7139": "880000000000000000000",
+ "0x67d682a282ef73fb8d6e9071e2614f47ab1d0f5e": "1000000000000000000000",
+ "0x1858cf11aea79f5398ad2bb22267b5a3c952ea74": "9850000000000000000000",
+ "0x39d6caca22bccd6a72f87ee7d6b59e0bde21d719": "2002000000000000000000",
+ "0xdaa63cbda45dd487a3f1cd4a746a01bb5e060b90": "4797800000000000000000",
+ "0xa90476e2efdfee4f387b0f32a50678b0efb573b5": "10000000000000000000000",
+ "0xae5aa1e6c2b60f6fd3efe721bb4a719cbe3d6f5d": "795860000000000000000",
+ "0xac2e766dac3f648f637ac6713fddb068e4a4f04d": "197000000000000000000",
+ "0x6191ddc9b64a8e0890b4323709d7a07c48b92a64": "775000000000000000000",
+ "0xcc4f0ff2aeb67d54ce3bc8c6510b9ae83e9d328b": "400000000000000000000",
+ "0xca23f62dff0d6460036c62e840aec5577e0befd2": "140800000000000000000",
+ "0x97dc26ec670a31e0221d2a75bc5dc9f90c1f6fd4": "50000000000000000000",
+ "0x848c994a79003fe7b7c26cc63212e1fc2f9c19eb": "2000000000000000000000",
+ "0x20c284ba10a20830fc3d699ec97d2dfa27e1b95e": "2000000000000000000000",
+ "0x4fa3f32ef4086448b344d5f0a9890d1ce4d617c3": "1500000000000000000000",
+ "0x255abc8d08a096a88f3d6ab55fbc7352bddcb9ce": "82161000000000000000",
+ "0x7c60e51f0be228e4d56fdd2992c814da7740c6bc": "200000000000000000000",
+ "0x1c356cfdb95febb714633b28d5c132dd84a9b436": "25000000000000000000",
+ "0x5062e5134c612f12694dbd0e131d4ce197d1b6a4": "1000000000000000000000",
+ "0xed862616fcbfb3becb7406f73c5cbff00c940755": "1700000000000000000000",
+ "0x62c9b271ffd5b770a5eee4edc9787b5cdc709714": "2000000000000000000000",
+ "0x3c925619c9b33144463f0537d896358706c520b0": "2000000000000000000000",
+ "0xffe2e28c3fb74749d7e780dc8a5d422538e6e451": "253319000000000000000",
+ "0x37195a635dcc62f56a718049d47e8f9f96832891": "1970000000000000000000",
+ "0x90e9a9a82edaa814c284d232b6e9ba90701d4952": "100007000000000000000",
+ "0xe0c4ab9072b4e6e3654a49f8a8db026a4b3386a9": "2000000000000000000000",
+ "0x439dee3f7679ff1030733f9340c096686b49390b": "2000000000000000000000",
+ "0x548558d08cfcb101181dac1eb6094b4e1a896fa6": "1999944000000000000000",
+ "0x3090f8130ec44466afadb36ed3c926133963677b": "4000000000000000000000",
+ "0xd1648503b1ccc5b8be03fa1ec4f3ee267e6adf7b": "5828000000000000000000",
+ "0x65b42faecc1edfb14283ca979af545f63b30e60c": "18200000000000000000",
+ "0x6420f8bcc8164a6152a99d6b99693005ccf7e053": "999972000000000000000",
+ "0x84b4b74e6623ba9d1583e0cfbe49643f16384149": "20000000000000000000",
+ "0xb8310a16cc6abc465007694b930f978ece1930bd": "740000000000000000000",
+ "0x16019a4dafab43f4d9bf4163fae0847d848afca2": "25060000000000000000",
+ "0x479298a9de147e63a1c7d6d2fce089c7e64083bd": "9999999000000000000000",
+ "0x030973807b2f426914ad00181270acd27b8ff61f": "5348000000000000000000",
+ "0xb07bcf1cc5d4462e5124c965ecf0d70dc27aca75": "1600000000000000000000",
+ "0xa2f798e077b07d86124e1407df32890dbb4b6379": "200000000000000000000",
+ "0x0cbd921dbe121563b98a6871fecb14f1cc7e88d7": "200000000000000000000",
+ "0x6042276df2983fe2bc4759dc1943e18fdbc34f77": "1970000000000000000000",
+ "0xbe2b2280523768ea8ac35cd9e888d60a719300d4": "2000000000000000000000",
+ "0x2f4da753430fc09e73acbccdcde9da647f2b5d37": "200000000000000000000",
+ "0x734223d27ff23e5906caed22595701bb34830ca1": "2000000000000000000000",
+ "0x5b430d779696a3653fc60e74fbcbacf6b9c2baf1": "14000000000000000000000",
+ "0x84232107932b12e03186583525ce023a703ef8d9": "2000000000000000000000",
+ "0x4ed14d81b60b23fb25054d8925dfa573dcae6168": "340000000000000000000",
+ "0x8b338411f26ccf37658cc75521d77629099e467d": "2000000000000000000000",
+ "0xa37622ac9bbdc4d82b75015d745b9f8de65a28ec": "2910000000000000000000",
+ "0x1dd77441844afe9cc18f15d8c77bccfb655ee034": "4850000000000000000000",
+ "0x65849be1af20100eb8a3ba5a5be4d3ae8db5a70e": "400000000000000000000",
+ "0xd5586da4e59583c8d86cccf71a86197f17996749": "2000000000000000000000",
+ "0x4b53ae59c784b6b5c43616b9a0809558e684e10c": "1200000000000000000000",
+ "0x55d42eb495bf46a634997b5f2ea362814918e2b0": "106128000000000000000",
+ "0x959ff17f1d51b473b44010052755a7fa8c75bd54": "1970000000000000000000",
+ "0x5a2daab25c31a61a92a4c82c9925a1d2ef58585e": "225400000000000000000",
+ "0x24c0c88b54a3544709828ab4ab06840559f6c5e2": "2674000000000000000000",
+ "0x7e8649e690fc8c1bfda1b5e186581f649b50fe33": "98500000000000000000",
+ "0x4acfa9d94eda6625c9dfa5f9f4f5d107c4031fdf": "39400000000000000000",
+ "0x5778ffdc9b94c5a59e224eb965b6de90f222d170": "335320000000000000000",
+ "0x825a7f4e10949cb6f8964268f1fa5f57e712b4c4": "20000000000000000000",
+ "0x6f39cc37caaa2ddc9b610f6131e0619fae772a3c": "500000000000000000000",
+ "0x5b437365ae3a9a2ff97c68e6f90a7620188c7d19": "2002000000000000000000",
+ "0x6710c2c03c65992b2e774be52d3ab4a6ba217ef7": "11600000000000000000000",
+ "0x896e335ca47af57962fa0f4dbf3e45e688cba584": "1368500000000000000000",
+ "0xb57549bfbc9bdd18f736b22650e48a73601fa65c": "446000000000000000000",
+ "0x85ca1e727e9d1a87991cc2c41840ebb9edf21d1b": "13370000000000000000",
+ "0xcf4166746e1d3bc1f8d0714b01f17e8a62df1464": "1004700000000000000000",
+ "0x4a75c3d4fa6fccbd5dd5a703c15379a1e783e9b7": "1820000000000000000000",
+ "0x9e5811b40be1e2a1e1d28c3b0774acde0a09603d": "3000000000000000000000",
+ "0x763886e333c56feff85be3951ab0b889ce262e95": "2000000000000000000000",
+ "0x2b101e822cd962962a06800a2c08d3b15d82b735": "152000000000000000000",
+ "0xa01e9476df84431825c836e8803a97e22fa5a0cd": "6000000000000000000000",
+ "0xbe4e7d983f2e2a636b1102ec7039efebc842e98d": "66000000000000000000",
+ "0x9e427272516b3e67d4fcbf82f59390d04c8e28e5": "4000000000000000000000",
+ "0xe0d231e144ec9107386c7c9b02f1702ceaa4f700": "5000057000000000000000",
+ "0x6a0f056066c2d56628850273d7ecb7f8e6e9129e": "5000016000000000000000",
+ "0xd1538e9a87e59ca9ec8e5826a5b793f99f96c4c3": "1000000000000000000000",
+ "0xf85bab1cb3710fc05fa19ffac22e67521a0ba21d": "2003000000000000000000",
+ "0xf7cbdba6be6cfe68dbc23c2b0ff530ee05226f84": "20000000000000000000",
+ "0x4eb87ba8788eba0df87e5b9bd50a8e45368091c1": "20000000000000000000",
+ "0x1479a9ec7480b74b5db8fc499be352da7f84ee9c": "1000000000000000000000",
+ "0xd311bcd7aa4e9b4f383ff3d0d6b6e07e21e3705d": "200000000000000000000",
+ "0x425c1816868f7777cc2ba6c6d28c9e1e796c52b3": "10000000000000000000000",
+ "0x8510ee934f0cbc900e1007eb38a21e2a5101b8b2": "106000000000000000000",
+ "0x01e864d354741b423e6f42851724468c74f5aa9c": "20000000000000000000000",
+ "0xa543a066fb32a8668aa0736a0c9cd40d78098727": "1000000000000000000000",
+ "0xf3eb1948b951e22df1617829bf3b8d8680ec6b68": "4000000000000000000000",
+ "0xf6b782f4dcd745a6c0e2e030600e04a24b25e542": "400000000000000000000",
+ "0x229f4f1a2a4f540774505b4707a81de44410255b": "2000000000000000000000",
+ "0xcff8d06b00e3f50c191099ad56ba6ae26571cd88": "1000000000000000000000",
+ "0x910b7d577a7e39aa23acf62ad7f1ef342934b968": "10000000000000000000000",
+ "0x392433d2ce83d3fb4a7602cca3faca4ec140a4b0": "51000000000000000000",
+ "0x8ff46045687723dc33e4d099a06904f1ebb584dc": "2000000000000000000000",
+ "0x9ca0429f874f8dcee2e9c062a9020a842a587ab9": "2000000000000000000000",
+ "0x160ceb6f980e04315f53c4fc988b2bf69e284d7d": "19100000000000000000",
+ "0xc340f9b91c26728c31d121d5d6fc3bb56d3d8624": "2000000000000000000000",
+ "0xafa1d5ad38fed44759c05b8993c1aa0dace19f40": "80000000000000000000",
+ "0x3969b4f71bb8751ede43c016363a7a614f76118e": "2000000000000000000000",
+ "0x2bb6f578adfbe7b2a116b3554facf9969813c319": "7400000000000000000000",
+ "0x8334764b7b397a4e578f50364d60ce44899bff94": "92500000000000000000",
+ "0x9dd2196624a1ddf14a9d375e5f07152baf22afa2": "1211747000000000000000",
+ "0xf242da845d42d4bf779a00f295b40750fe49ea13": "1000000000000000000000",
+ "0xc6234657a807384126f8968ca1708bb07baa493c": "20000000000000000000",
+ "0x94c055e858357aaa30cf2041fa9059ce164a1f91": "19999000000000000000000",
+ "0x74c73c90528a157336f1e7ea20620ae53fd24728": "8969310000000000000000",
+ "0x19e7f3eb7bf67f3599209ebe08b62ad3327f8cde": "2000000000000000000000",
+ "0xb2b516fdd19e7f3864b6d2cf1b252a4156f1b03b": "53720000000000000000",
+ "0x8164e78314ae16b28926cc553d2ccb16f356270d": "8450000000000000000000",
+ "0x4d828894752f6f25175daf2177094487954b6f9f": "1459683000000000000000",
+ "0xab84a0f147ad265400002b85029a41fc9ce57f85": "1000000000000000000000",
+ "0xf3fe51fde34413c73318b9c85437fe7e820f561a": "1003200000000000000000",
+ "0x16c7b31e8c376282ac2271728c31c95e35d952c3": "2000000000000000000000",
+ "0x80d5c40c59c7f54ea3a55fcfd175471ea35099b3": "1000000000000000000000",
+ "0x7abb10f5bd9bc33b8ec1a82d64b55b6b18777541": "20000000000000000000000",
+ "0x095b0ea2b218d82e0aea7c2889238a39c9bf9077": "20000000000000000000000",
+ "0x5d5cdbe25b2a044b7b9be383bcaa5807b06d3c6b": "2000000000000000000000",
+ "0x323749a3b971959e46c8b4822dcafaf7aaf9bd6e": "20064000000000000000",
+ "0xe0272213e8d2fd3e96bd6217b24b4ba01b617079": "20000000000000000000",
+ "0x00acbfb2f25a5485c739ef70a44eeeeb7c65a66f": "100000000000000000000",
+ "0x52f15423323c24f19ae2ab673717229d3f747d9b": "1026115000000000000000",
+ "0xcb4abfc282aed76e5d57affda542c1f382fcacf4": "8136100000000000000000",
+ "0xf71b4534f286e43093b1e15efea749e7597b8b57": "104410000000000000000000",
+ "0x44cd77535a893fa7c4d5eb3a240e79d099a72d2d": "820000000000000000000",
+ "0xeb3ce7fc381c51db7d5fbd692f8f9e058a4c703d": "200000000000000000000",
+ "0xf1c8c4a941b4628c0d6c30fda56452d99c7e1b64": "1449000000000000000000",
+ "0x277677aba1e52c3b53bfa2071d4e859a0af7e8e1": "1000000000000000000000",
+ "0xa5f075fd401335577b6683c281e6d101432dc6e0": "2680000000000000000000",
+ "0xe28dbc8efd5e416a762ec0e018864bb9aa83287b": "24533161000000000000000",
+ "0x2b717cd432a323a4659039848d3b87de26fc9546": "500000000000000000000000",
+ "0xb358e97c70b605b1d7d729dfb640b43c5eafd1e7": "20000000000000000000000",
+ "0x293c2306df3604ae4fda0d207aba736f67de0792": "200000000000000000000",
+ "0x74d366b07b2f56477d7c7077ac6fe497e0eb6559": "5000000000000000000000",
+ "0x490145afa8b54522bb21f352f06da5a788fa8f1d": "9231182000000000000000",
+ "0x862569211e8c6327b5415e3a67e5738b15baaf6e": "140000000000000000000",
+ "0x5a74ba62e7c81a3474e27d894fed33dd24ad95fe": "18200000000000000000",
+ "0x536e4d8029b73f5579dca33e70b24eba89e11d7e": "1970000000000000000000",
+ "0x25c6e74ff1d928df98137af4df8430df24f07cd7": "390000000000000000000",
+ "0x19b36b0c87ea664ed80318dc77b688dde87d95a5": "1948386000000000000000",
+ "0xabc4caeb474d4627cb6eb456ecba0ecd08ed8ae1": "3940000000000000000000",
+ "0x8ea656e71ec651bfa17c5a5759d86031cc359977": "100000000000000000000",
+ "0x8d620bde17228f6cbba74df6be87264d985cc179": "100000000000000000000",
+ "0xb2aa2f1f8e93e79713d92cea9ffce9a40af9c82d": "2000000000000000000000",
+ "0x198ef1ec325a96cc354c7266a038be8b5c558f67": "608334724000000000000000",
+ "0x6a13d5e32c1fd26d7e91ff6e053160a89b2c8aad": "53480000000000000000",
+ "0xe056bf3ff41c26256fef51716612b9d39ade999c": "100009000000000000000",
+ "0x2c128c95d957215101f043dd8fc582456d41016d": "835000000000000000000",
+ "0x2560b09b89a4ae6849ed5a3c9958426631714466": "1700000000000000000000",
+ "0xd3d6e9fb82542fd29ed9ea3609891e151396b6f7": "54000000000000000000000",
+ "0xa7607b42573bb6f6b4d4f23c7e2a26b3a0f6b6f0": "1610000000000000000000",
+ "0x020362c3ade878ca90d6b2d889a4cc5510eed5f3": "1042883000000000000000",
+ "0x14830704e99aaad5c55e1f502b27b22c12c91933": "620000000000000000000",
+ "0x8030b111c6983f0485ddaca76224c6180634789f": "80000000000000000000",
+ "0x2c5b7d7b195a371bf9abddb42fe04f2f1d9a9910": "200000000000000000000",
+ "0x77d43fa7b481dbf3db530cfbf5fdced0e6571831": "2000000000000000000000",
+ "0x2d90b415a38e2e19cdd02ff3ad81a97af7cbf672": "109800000000000000000",
+ "0x2fc82ef076932341264f617a0c80dd571e6ae939": "7160000000000000000000",
+ "0xdfe549fe8430e552c6d07cc3b92ccd43b12fb50f": "83620000000000000000",
+ "0x1e8e689b02917cdc29245d0c9c68b094b41a9ed6": "2000000000000000000000",
+ "0x21c3a8bba267c8cca27b1a9afabad86f607af708": "8940000000000000000000",
+ "0x143c639752caeecf6a997d39709fc8f19878c7e8": "1970000000000000000000",
+ "0x02603d7a3bb297c67c877e5d34fbd5b913d4c63a": "20000000000000000000",
+ "0xa166f911c644ac3213d29e0e1ae010f794d5ad26": "2000000000000000000000",
+ "0x6eb3819617404058268f0c3cff3596bfe9148c1c": "1670000000000000000000",
+ "0x7a67dd043a504fc2f2fc7194e9becf484cecb1fb": "250000000000000000000",
+ "0xf824ee331e4ac3cc587693395b57ecf625a6c0c2": "1600930000000000000000",
+ "0x1179c60dbd068b150b074da4be23033b20c68558": "680000000000000000000",
+ "0xd2a479404347c5543aab292ae1bb4a6f158357fa": "4000000000000000000000",
+ "0xb0d32bd7e4e695b7b01aa3d0416f80557dba9903": "16300000000000000000000",
+ "0xf734ec03724ddee5bb5279aa1afcf61b0cb448a1": "4238080000000000000000",
+ "0xc04069dfb18b096c7867f8bee77a6dc7477ad062": "2674000000000000000000",
+ "0x80c53ee7e3357f94ce0d7868009c208b4a130125": "2000000000000000000000",
+ "0x0f32d9cb4d0fdaa0150656bb608dcc43ed7d9301": "753978000000000000000",
+ "0x6ddb6092779d5842ead378e21e8120fd4c6bc132": "2000000000000000000000",
+ "0x82ea01e3bf2e83836e71704e22a2719377efd9c3": "3040000000000000000000",
+ "0x44c1110b18870ec81178d93d215838c551d48e64": "199958000000000000000",
+ "0x7727af101f0aaba4d23a1cafe17c6eb5dab1c6dc": "2000000000000000000000",
+ "0xa11a03c4bb26d21eff677d5d555c80b25453ee7a": "69979000000000000000",
+ "0x19e5dea3370a2c746aae34a37c531f41da264e83": "200000000000000000000",
+ "0xc325c352801ba883b3226c5feb0df9eae2d6e653": "3940000000000000000000",
+ "0xae5055814cb8be0c117bb8b1c8d2b63b4698b728": "32035000000000000000",
+ "0xdeb1bc34d86d4a4dde2580d8beaf074eb0e1a244": "1580000000000000000000",
+ "0x558360206883dd1b6d4a59639e5629d0f0c675d0": "2000000000000000000000",
+ "0xa9d6f871ca781a759a20ac3adb972cf12829a208": "925000000000000000000",
+ "0xb0ac4eff6680ee14169cdadbffdb30804f6d25f5": "2000000000000000000000",
+ "0xf1b58faffa8794f50af8e88309c7a6265455d51a": "999800000000000000000",
+ "0xa61a54df784a44d71b771b87317509211381f200": "1000000000000000000000",
+ "0xbaa4b64c2b15b79f5f204246fd70bcbd86e4a92a": "500000000000000000000",
+ "0xa20d8ff60caae31d02e0b665fa435d76f77c9442": "489600000000000000000",
+ "0xf3e74f470c7d3a3f0033780f76a89f3ef691e6cb": "3021800000000000000000",
+ "0xd330728131fe8e3a15487a34573c93457e2afe95": "4000000000000000000000",
+ "0x9af9dbe47422d177f945bdead7e6d82930356230": "3940000000000000000000",
+ "0x0eb5b662a1c718608fd52f0c25f9378830178519": "6091400000000000000000",
+ "0xfda6810ea5ac985d6ffbf1c511f1c142edcfddf7": "4000000000000000000000",
+ "0x832c54176bdf43d2c9bcd7b808b89556b89cbf31": "200000000000000000000",
+ "0x704d5de4846d39b53cd21d1c49f096db5c19ba29": "152000000000000000000",
+ "0x344a8db086faed4efc37131b3a22b0782dad7095": "500000000000000000000",
+ "0x8c7fa5cae82fedb69ab189d3ff27ae209293fb93": "400030000000000000000",
+ "0xad660dec825522a9f62fcec3c5b731980dc286ea": "3000000000000000000000",
+ "0x13b9b10715714c09cfd610cf9c9846051cb1d513": "1970000000000000000000",
+ "0x40467d80e74c35407b7db51789234615fea66818": "388000000000000000000",
+ "0x30e9d5a0088f1ddb2fd380e2a049192266c51cbf": "196910000000000000000",
+ "0xb2d1e99af91231858e7065dd1918330dc4c747d5": "16700000000000000000000",
+ "0x9f21302ca5096bea7402b91b0fd506254f999a3d": "1246832000000000000000",
+ "0xd24b6644f439c8051dfc64d381b8c86c75c17538": "2000000000000000000000",
+ "0x8228ebc087480fd64547ca281f5eace3041453b9": "1970000000000000000000",
+ "0x29da3e35b23bb1f72f8e2258cf7f553359d24bac": "20000000000000000000000",
+ "0xc8e558a3c5697e6fb23a2594c880b7a1b68f9860": "10000000000000000000000",
+ "0x6b951a43274eeafc8a0903b0af2ec92bf1efc839": "100000000000000000000",
+ "0xd015f6fcb84df7bb410e8c8f04894a881dcac237": "1038000000000000000000",
+ "0x6ccb03acf7f53ce87aadcc21a9932de915f89804": "8000000000000000000000",
+ "0x388c85a9b9207d8146033fe38143f6d34b595c47": "200000000000000000000",
+ "0x429c06b487e8546abdfc958a25a3f0fba53f6f00": "13503000000000000000",
+ "0x771507aeee6a255dc2cd9df55154062d0897b297": "334250000000000000000",
+ "0x5a2b1c853aeb28c45539af76a00ac2d8a8242896": "25000000000000000000",
+ "0xf4d67a9044b435b66e8977ff39a28dc4bd53729a": "200000000000000000000",
+ "0x063759dd1c4e362eb19398951ff9f8fad1d31068": "10000000000000000000000",
+ "0xcb58990bcd90cfbf6d8f0986f6fa600276b94e2d": "999925000000000000000",
+ "0x6df5c84f7b909aab3e61fe0ecb1b3bf260222ad2": "4000000000000000000000",
+ "0xdeb2495d6aca7b2a6a2d138b6e1a42e2dc311fdd": "2000000000000000000000",
+ "0x59203cc37599b648312a7cc9e06dacb589a9ae6a": "148689000000000000000",
+ "0xfc9b347464b2f9929d807e039dae48d3d98de379": "14000000000000000000000",
+ "0x48d2434b7a7dbbff08223b6387b05da2e5093126": "18000000000000000000000",
+ "0xc9d76446d5aadff80b68b91b08cd9bc8f5551ac1": "714000000000000000000",
+ "0x3d31587b5fd5869845788725a663290a49d3678c": "500000000000000000000",
+ "0xd8715ef9176f850b2e30eb8e382707f777a6fbe9": "2000000000000000000000",
+ "0x2c2147947ae33fb098b489a5c16bfff9abcd4e2a": "200000000000000000000",
+ "0xd6c0d0bc93a62e257174700e10f024c8b23f1f87": "2000000000000000000000",
+ "0xd1978f2e34407fab1dc2183d95cfda6260b35982": "788000000000000000000",
+ "0x1bf974d9904f45ce81a845e11ef4cbcf27af719e": "100000000000000000000",
+ "0x6e761eaa0f345f777b5441b73a0fa5b56b85f22d": "2000000000000000000000",
+ "0xea60436912de6bf187d3a472ff8f5333a0f7ed06": "19700000000000000000",
+ "0x94f8f057db7e60e675ad940f155885d1a477348e": "401100000000000000000",
+ "0x8933491760c8f0b4df8caac78ed835caee21046d": "20000000000000000000000",
+ "0xa7775e4af6a23afa201fb78b915e51a515b7a728": "120000000000000000000",
+ "0xd8d64384249b776794063b569878d5e3b530a4b2": "177569000000000000000",
+ "0xbe633a3737f68439bac7c90a52142058ee8e8a6f": "960000000000000000000",
+ "0x90bd62a050845261fa4a9f7cf241ea630b05efb8": "500000000000000000000",
+ "0x552987f0651b915b2e1e5328c121960d4bdd6af4": "1790000000000000000000",
+ "0x0baf6ecdb91acb3606a8357c0bc4f45cfd2d7e6f": "1000000000000000000000",
+ "0x9e5a311d9f69898a7c6a9d6360680438e67a7b2f": "1490000000000000000000",
+ "0x78859c5b548b700d9284cee4b6633c2f52e529c2": "2955000000000000000000",
+ "0xd572309169b1402ec8131a17a6aac3222f89e6eb": "13800000000000000000000",
+ "0x8e6d7485cbe990acc1ad0ee9e8ccf39c0c93440e": "955000000000000000000",
+ "0x75c11d024d12ae486c1095b7a7b9c4af3e8edeb9": "20000000000000000000",
+ "0x903413878aea3bc1086309a3fe768b65559e8cab": "8000000000000000000000",
+ "0x6d0569e5558fc7df2766f2ba15dc8aeffc5beb75": "4001070000000000000000",
+ "0x3815b0743f94fc8cc8654fd9d597ed7d8b77c57e": "738578000000000000000",
+ "0x0f26480a150961b8e30750713a94ee6f2e47fc00": "1000000000000000000000",
+ "0xede5de7c7fb7eee0f36e64530a41440edfbefacf": "617200000000000000000",
+ "0x763a7cbab70d7a64d0a7e52980f681472593490c": "600000000000000000000",
+ "0x6e270ad529f1f0b8d9cb6d2427ec1b7e2dc64a74": "200000000000000000000",
+ "0xeb3bdd59dcdda5a9bb2ac1641fd02180f5f36560": "6600000000000000000000",
+ "0xf4ebf50bc7e54f82e9b9bd24baef29438e259ce6": "10000000000000000000000",
+ "0x882c8f81872c79fed521cb5f950d8b032322ea69": "40000000000000000000000",
+ "0x394132600f4155e07f4d45bc3eb8d9fb72dcd784": "2941000000000000000000",
+ "0x0be2b94ad950a2a62640c35bfccd6c67dae450f6": "1940000000000000000000",
+ "0xd4c6ac742e7c857d4a05a04c33d4d05c1467571d": "200000000000000000000",
+ "0x1fddd85fc98be9c4045961f40f93805ecc4549e5": "164000000000000000000",
+ "0x534065361cb854fac42bfb5c9fcde0604ac919da": "2000000000000000000000",
+ "0x9a6ff5f6a7af7b7ae0ed9c20ecec5023d281b786": "2547000000000000000000",
+ "0x4f3a4854911145ea01c644044bdb2e5a960a982f": "4000000000000000000000",
+ "0x00497e92cdc0e0b963d752b2296acb87da828b24": "194800000000000000000",
+ "0x4ff67fb87f6efba9279930cfbd1b7a343c79fade": "400000000000000000000",
+ "0x62f2e5ccecd52cc4b95e0597df27cc079715608c": "143000000000000000000",
+ "0x1eda084e796500ba14c5121c0d90846f66e4be62": "534800000000000000000",
+ "0x9836b4d30473641ab56aeee19242761d72725178": "2000000000000000000000",
+ "0xde55de0458f850b37e4d78a641dd2eb2dd8f38ce": "4000000000000000000000",
+ "0x140ca28ff33b9f66d7f1fc0078f8c1eef69a1bc0": "1600000000000000000000",
+ "0x2014261f01089f53795630ba9dd24f9a34c2d942": "1337000000000000000000",
+ "0x11415fab61e0dfd4b90676141a557a869ba0bde9": "2048000000000000000000",
+ "0x88344909644c7ad4930fd873ca1c0da2d434c07f": "131970000000000000000",
+ "0x88b217ccb786a254cf4dc57f5d9ac3c455a30483": "925000000000000000000",
+ "0xdfdbcec1014b96da2158ca513e9c8d3b9af1c3d0": "2000000000000000000000",
+ "0x1ba9f7997e5387b6b2aa0135ac2452fe36b4c20d": "850000000000000000000",
+ "0xd70ad2c4e9eebfa637ef56bd486ad2a1e5bce093": "200000000000000000000",
+ "0x9ce27f245e02d1c312c1d500788c9def7690453b": "200000000000000000000",
+ "0x8234f463d18485501f8f85ace4972c9b632dbccc": "2000000000000000000000",
+ "0x994152fc95d5c1ca8b88113abbad4d710e40def6": "500000000000000000000",
+ "0xe5b980d28eece2c06fca6c9473068b37d4a6d6e9": "695200000000000000000",
+ "0x2d426912d059fad9740b2e390a2eeac0546ff01b": "1400000000000000000000",
+ "0x6d9997509882027ea947231424bedede2965d0ba": "2001600000000000000000",
+ "0x167ce7de65e84708595a525497a3eb5e5a665073": "575400000000000000000",
+ "0xe430c0024fdbf73a82e21fccf8cbd09138421c21": "4000000000000000000000",
+ "0x2e52912bc10ea39d54e293f7aed6b99a0f4c73be": "400000000000000000000",
+ "0x12cf8b0e465213211a5b53dfb0dd271a282c12c9": "15200000000000000000",
+ "0x06964e2d17e9189f88a8203936b40ac96e533c06": "18200000000000000000",
+ "0x66b1a63da4dcd9f81fe54f5e3fcb4055ef7ec54f": "201412000000000000000",
+ "0x0a77e7f72b437b574f00128b21f2ac265133528c": "2000000000000000000000",
+ "0x78f5c74785c5668a838072048bf8b453594ddaab": "400000000000000000000",
+ "0x58e554af3d87629620da61d538c7f5b4b54c4afe": "1297081000000000000000",
+ "0x37a10451f36166cf643dd2de6c1cbba8a011cfa3": "380000000000000000000",
+ "0xfe9ad12ef05d6d90261f96c8340a0381974df477": "2000000000000000000000",
+ "0x057f7f81cd7a406fc45994408b5049912c566463": "1700000000000000000000",
+ "0x55a3df57b7aaec16a162fd5316f35bec082821cf": "1970000000000000000000",
+ "0xc0e0b903088e0c63f53dd069575452aff52410c3": "3000000000000000000000",
+ "0x63e88e2e539ffb450386b4e46789b223f5476c45": "6292000000000000000000",
+ "0x3727341f26c12001e378405ee38b2d8464ec7140": "2000000000000000000000",
+ "0xc96751656c0a8ef4357b7344322134b983504aca": "2000000000000000000000",
+ "0x1e060dc6c5f1cb8cc7e1452e02ee167508b56542": "12715500000000000000000",
+ "0x18136c9df167aa17b6f18e22a702c88f4bc28245": "4000000000000000000000",
+ "0x116108c12084612eeda7a93ddcf8d2602e279e5c": "2000000000000000000000",
+ "0xbbb643d2187b364afc10a6fd368d7d55f50d1a3c": "1000000000000000000000",
+ "0xec83e798c396b7a55e2a2224abcd834b27ea459c": "12000000000000000000000",
+ "0x973f4e361fe5decd989d4c8f7d7cc97990385daf": "388500000000000000000",
+ "0xc0f29ed0076611b5e55e130547e68a48e26df5e4": "3000000000000000000000",
+ "0xfd4b551f6fdbcda6c511b5bb372250a6b783e534": "20600000000000000000",
+ "0x144b19f1f66cbe318347e48d84b14039466c5909": "2000000000000000000000",
+ "0xbf183641edb886ce60b8190261e14f42d93cce01": "25019000000000000000",
+ "0x94db807873860aac3d5aea1e885e52bff2869954": "3220000000000000000000",
+ "0x7a74cee4fa0f6370a7894f116cd00c1147b83e59": "800000000000000000000",
+ "0xcd32a4a8a27f1cc63954aa634f7857057334c7a3": "1085000000000000000000",
+ "0x7cbeb99932e97e6e02058cfc62d0b26bc7cca52b": "2000000000000000000000",
+ "0x8cde8b732e6023878eb23ed16229124b5f7afbec": "133700000000000000000",
+ "0x45c4ecb4ee891ea984a7c5cefd8dfb00310b2850": "1980000000000000000000",
+ "0x8b393fb0813ee101db1e14ecc7d322c72b8c0473": "455578000000000000000",
+ "0x7b66126879844dfa34fe65c9f288117fefb449ad": "6000000000000000000000",
+ "0x162ba503276214b509f97586bd842110d103d517": "9002000000000000000000",
+ "0x7dece6998ae1900dd3770cf4b93812bad84f0322": "100000000000000000000",
+ "0xec0927bac7dc36669c28354ab1be83d7eec30934": "2000000000000000000000",
+ "0x8d7f3e61299c2db9b9c0487cf627519ed00a9123": "1742400000000000000000",
+ "0x4fc46c396e674869ad9481638f0013630c87caac": "1000000000000000000000",
+ "0xbf68d28aaf1eeefef646b65e8cc8d190f6c6da9c": "2000000000000000000000",
+ "0x00969747f7a5b30645fe00e44901435ace24cc37": "1700000000000000000000",
+ "0x494dec4d5ee88a2771a815f1ee7264942fb58b28": "2000000000000000000000",
+ "0xffeac0305ede3a915295ec8e61c7f881006f4474": "98500000000000000000",
+ "0xb39139576194a0866195151f33f2140ad1cc86cf": "100000000000000000000000",
+ "0xfead1803e5e737a68e18472d9ac715f0994cc2be": "500000000000000000000",
+ "0x698ab9a2f33381e07c0c47433d0d21d6f336b127": "20000000000000000000",
+ "0xe5edc73e626f5d3441a45539b5f7a398c593edf6": "865000000000000000000",
+ "0xdd4f5fa2111db68f6bde3589b63029395b69a92d": "158400000000000000000",
+ "0x8c93c3c6db9d37717de165c3a1b4fe51952c08de": "400000000000000000000",
+ "0xf87bb07b289df7301e54c0efda6a2cf291e89200": "1400000000000000000000",
+ "0xe7a4560c84b20e0fb54c49670c2903b0a96c42a4": "598000000000000000000",
+ "0x00a5797f52c9d58f189f36b1d45d1bf6041f2f6b": "5456900000000000000000",
+ "0x9da3302240af0511c6fd1857e6ddb7394f77ab6b": "3100000000000000000000",
+ "0x2c2d15ff39561c1b72eda1cc027ffef23743a144": "3920000000000000000000",
+ "0x9b4c2715780ca4e99e60ebf219f1590c8cad500a": "1600000000000000000000",
+ "0xff5e7ee7d5114821e159dca5e81f18f1bfffbff9": "2000000000000000000000",
+ "0x0169c1c210eae845e56840412e1f65993ea90fb4": "2000000000000000000000",
+ "0xabc45f84db7382dde54c5f7d8938c42f4f3a3bc4": "200000000000000000000",
+ "0xd9383d4b6d17b3f9cd426e10fb944015c0d44bfb": "800000000000000000000",
+ "0xc090fe23dcd86b358c32e48d2af91024259f6566": "200000000000000000000",
+ "0x9ffedcc36b7cc312ad2a9ede431a514fccb49ba3": "669800000000000000000",
+ "0x2ffe93ec1a5636e9ee34af70dff52682e6ff7079": "2000000000000000000000",
+ "0x6e01e4ad569c95d007ada30d5e2db12888492294": "4000000000000000000000",
+ "0xd4d92c62b280e00f626d8657f1b86166cb1f740f": "200028000000000000000",
+ "0x1d36683063b7e9eb99462dabd569bddce71686f2": "1000000000000000000000",
+ "0x3a48e0a7098b06a905802b87545731118e89f439": "2000000000000000000000",
+ "0xbd9e56e902f4be1fc8768d8038bac63e2acbbf8e": "999972000000000000000",
+ "0x4d67f2ab8599fef5fc413999aa01fd7fce70b43d": "10000000000000000000000",
+ "0x8e74e0d1b77ebc823aca03f119854cb12027f6d7": "107200000000000000000000",
+ "0x7e5b19ae1be94ff4dee635492a1b012d14db0213": "100000000000000000000",
+ "0x5de9e7d5d1b667d095dd34099c85b0421a0bc681": "20000000000000000000",
+ "0x316eb4e47df71b42e16d6fe46825b7327baf3124": "4000000000000000000000",
+ "0x772c297f0ad194482ee8c3f036bdeb01c201d5cc": "200000000000000000000",
+ "0xd7052519756af42590f15391b723a03fa564a951": "4615591000000000000000",
+ "0x2c6846a1aa999a2246a287056000ba4dcba8e63d": "10020000000000000000000",
+ "0xde5b005fe8daae8d1f05de3eda042066c6c4691c": "1100000000000000000000",
+ "0x254c1ecc630c2877de8095f0a8dba1e8bf1f550c": "1700000000000000000000",
+ "0xf8f226142a428434ab17a1864a2597f64aab2f06": "172473000000000000000",
+ "0xa6c910ce4d494a919ccdaaa1fc3b82aa74ba06cf": "8000000000000000000000",
+ "0xe587b16abc8a74081e3613e14342c03375bf0847": "2000000000000000000000",
+ "0x6f176065e88e3c6fe626267d18a088aaa4db80bc": "3520000000000000000000",
+ "0x50dcbc27bcad984093a212a9b4178eabe9017561": "145512000000000000000",
+ "0xe1953c6e975814c571311c34c0f6a99cdf48ab82": "50000000000000000000",
+ "0xbe0a2f385f09dbfce96732e12bb40ac349871ba8": "1610348000000000000000",
+ "0x4712540265cbeec3847022c59f1b318d43400a9e": "3500000000000000000000",
+ "0x29bdc4f28de0180f433c2694eb74f5504ce94337": "2000000000000000000000",
+ "0x2f66bfbf2262efcc8d2bd0444fc5b0696298ff1e": "9940000000000000000000",
+ "0x506411fd79003480f6f2b6aac26b7ba792f094b2": "500000000000000000000",
+ "0x23ea669e3564819a83b0c26c00a16d9e826f6c46": "1430590000000000000000",
+ "0xe3ffb02cb7d9ea5243701689afd5d417d7ed2ece": "78000000000000000000",
+ "0x38e7dba8fd4f1f850dbc2649d8e84f0952e3eb3c": "50000000000000000000",
+ "0x8644cc281be332ccced36da483fb2a0746d9ba2e": "400000000000000000000",
+ "0xe8a91da6cf1b9d65c74a02ec1f96eecb6dd241f3": "1940000000000000000000",
+ "0x0631dc40d74e5095e3729eddf49544ecd4396f67": "160000000000000000000",
+ "0x83c897a84b695eebe46679f7da19d776621c2694": "500000000000000000000",
+ "0xdb73460b59d8e85045d5e752e62559875e42502e": "999800000000000000000",
+ "0x0dd4e674bbadb1b0dc824498713dce3b5156da29": "170000000000000000000",
+ "0xe3933d61b77dcdc716407f8250bc91e4ffaeb09d": "86600000000000000000000",
+ "0x58c90754d2f20a1cb1dd330625e04b45fa619d5c": "2000000000000000000000",
+ "0x895ec5545644e0b78330fffab8ddeac9e833156c": "600000000000000000000",
+ "0x7e1e29721d6cb91057f6c4042d8a0bbc644afe73": "159800000000000000000",
+ "0x72b90a4dc097239492c5b9777dcd1e52ba2be2c2": "6000000000000000000000",
+ "0x64241a7844290e0ab855f1d4aa75b55345032224": "1600000000000000000000",
+ "0x6fd4e0f3f32bee6d3767fdbc9d353a6d3aab7899": "695240000000000000000",
+ "0x3a035594c747476d42d1ee966c36224cdd224993": "355890000000000000000",
+ "0xde97f4330700b48c496d437c91ca1de9c4b01ba4": "2910840000000000000000",
+ "0x716ad3c33a9b9a0a18967357969b94ee7d2abc10": "482000000000000000000",
+ "0xbfbe05e88c9cbbcc0e92a405fac1d85de248ee24": "100000000000000000000",
+ "0xcfc4e6f7f8b011414bfba42f23adfaa78d4ecc5e": "1850000000000000000000",
+ "0xd931ac2668ba6a84481ab139735aec14b7bfbabf": "2000000000000000000000",
+ "0xe3263ce8af6db3e467584502ed7109125eae22a5": "2000000000000000000000",
+ "0xf78258c12481bcdddbb72a8ca0c043097261c6c5": "20000000000000000000",
+ "0x4493123c021ece3b33b1a452c9268de14007f9d3": "6685000000000000000000",
+ "0x431f2c19e316b044a4b3e61a0c6ff8c104a1a12f": "1000000000000000000000",
+ "0xe63e787414b9048478a50733359ecdd7e3647aa6": "1580000000000000000000",
+ "0xe4715956f52f15306ee9506bf82bccc406b3895e": "274944000000000000000",
+ "0xf7f91e7acb5b8129a306877ce3168e6f438b66a1": "176000000000000000000",
+ "0xdcdbbd4e2604e40e1710cc6730289dccfad3892d": "4600000000000000000000",
+ "0x2b5f4b3f1e11707a227aa5e69fa49dded33fb321": "6000000000000000000000",
+ "0x01488ad3da603c4cdd6cb0b7a1e30d2a30c8fc38": "200000000000000000000",
+ "0x841145b44840c946e21dbc190264b8e0d5029369": "300000000000000000000000",
+ "0xbf05070c2c34219311c4548b2614a438810ded6d": "2000000000000000000000",
+ "0x38f387e1a4ed4a73106ef2b462e474e2e3143ad0": "6000000000000000000000",
+ "0xf116b0b4680f53ab72c968ba802e10aa1be11dc8": "20000000000000000000",
+ "0xbea0afc93aae2108a3fac059623bf86fa582a75e": "1700000000000000000000",
+ "0x4c997992036c5b433ac33d25a8ea1dc3d4e4e6d8": "29200000000000000000",
+ "0xab7e0b83ed9a424c6d1e6a6f87a4dbf06409c7d6": "2400000000000000000000",
+ "0xd71fb130f0150c565269e00efb43902b52a455a6": "200000000000000000000",
+ "0x99b018932bcad355b6792b255db6702dec8ce5dd": "4000086000000000000000",
+ "0x4b904e934bd0cc8b20705f879e905b93ea0ccc30": "2000000000000000000000",
+ "0x672ec42faa8cd69aaa71b32cc7b404881d52ff91": "10000000000000000000000",
+ "0xacbc2d19e06c3babbb5b6f052b6bf7fc37e07229": "200000000000000000000",
+ "0xcea8743341533cb2f0b9c6efb8fda80d77162825": "100000000000000000000",
+ "0x9568b7de755628af359a84543de23504e15e41e6": "40000000000000000000000",
+ "0x6ec96d13bdb24dc7a557293f029e02dd74b97a55": "4000000000000000000000",
+ "0xd95c90ffbe5484864780b867494a83c89256d6e4": "1640000000000000000000",
+ "0xade6f8163bf7c7bb4abe8e9893bd0cc112fe8872": "327600000000000000000",
+ "0x250eb7c66f869ddf49da85f3393e980c029aa434": "4000000000000000000000",
+ "0xa35c19132cac1935576abfed6c0495fb07881ba0": "2000000000000000000000",
+ "0xd5550caaf743b037c56fd2558a1c8ed235130750": "5347598000000000000000",
+ "0x03097923ba155e16d82f3ad3f6b815540884b92c": "1820000000000000000000",
+ "0xd6d9e30f0842012a7176a917d9d2048ca0738759": "4000000000000000000000",
+ "0xab9ad36e5c74ce2e96399f57839431d0e79f96ab": "164000000000000000000",
+ "0x75be8ff65e5788aec6b2a52d5fa7b1e7a03ba675": "67720000000000000000",
+ "0x4f6d4737d7a940382487264886697cf7637f8015": "1670000000000000000000",
+ "0x5f7b3bbac16dab831a4a0fc53b0c549dc36c31ca": "1940000000000000000000",
+ "0xd843ee0863ce933e22f89c802d31287b9671e81c": "13370000000000000000",
+ "0x361f3ba9ed956b770f257d3672fe1ff9f7b0240c": "600000000000000000000",
+ "0x6c0ae9f043c834d44271f13406593dfe094f389f": "1517545000000000000000",
+ "0xdb34745ede8576b499db01beb7c1ecda85cf4abe": "80000000000000000000",
+ "0x7be8ccb4f11b66ca6e1d57c0b5396221a31ba53a": "20000000000000000000",
+ "0x128b908fe743a434203de294c441c7e20a86ea67": "713304000000000000000",
+ "0xdf236bf6abf4f3293795bf0c28718f93e3b1b36b": "1337000000000000000000",
+ "0x14254ea126b52d0142da0a7e188ce255d8c47178": "775000000000000000000",
+ "0xceed47ca5b899fd1623f21e9bd4db65a10e5b09d": "133196000000000000000",
+ "0x30acd858875fa24eef0d572fc7d62aad0ebddc35": "400000000000000000000",
+ "0x47a281dff64167197855bf6e705eb9f2cef632ea": "1000072000000000000000",
+ "0x297d5dbe222f2fb52531acbd0b013dc446ac7368": "20000000000000000000000",
+ "0xadf85203c8376a5fde9815384a350c3879c4cb93": "1147300000000000000000",
+ "0xc3e0471c64ff35fa5232cc3121d1d38d1a0fb7de": "2000000000000000000000",
+ "0xfdecc82ddfc56192e26f563c3d68cb544a96bfed": "440000000000000000000",
+ "0x2614f42d5da844377578e6b448dc24305bef2b03": "2000000000000000000000",
+ "0x1d96bcd58457bbf1d3c2a46ffaf16dbf7d836859": "171313000000000000000",
+ "0xbd66ffedb530ea0b2e856dd12ac2296c31fe29e0": "200000000000000000000",
+ "0x6e84876dbb95c40b6656e42ba9aea08a993b54dc": "1101932000000000000000",
+ "0xa1c4f45a82e1c478d845082eb18875c4ea6539ab": "200000000000000000000000",
+ "0x2c964849b1f69cc7cea4442538ed87fdf16cfc8f": "2000000000000000000000",
+ "0x45b47105fe42c4712dce6e2a21c05bffd5ea47a9": "2000000000000000000000",
+ "0x31e9c00f0c206a4e4e7e0522170dc81e88f3eb70": "2685000000000000000000",
+ "0x5fe77703808f823e6c399352108bdb2c527cb87c": "1960000000000000000000",
+ "0x2272186ef27dcbe2f5fc373050fdae7f2ace2316": "16100000000000000000000",
+ "0xb7576e9d314df41ec5506494293afb1bd5d3f65d": "20000000000000000000",
+ "0xac9fff68c61b011efbecf038ed72db97bb9e7281": "9550000000000000000000",
+ "0xcd9529492b5c29e475acb941402b3d3ba50686b0": "1970000000000000000000",
+ "0xf19b39389d47b11b8a2c3f1da9124decffbefaf7": "2000000000000000000000",
+ "0x9e951f6dc5e352afb8d04299d2478a451259bf56": "72004000000000000000",
+ "0x8eb1fbe4e5d3019cd7d30dae9c0d5b4c76fb6331": "2000000000000000000000",
+ "0x29cc804d922be91f5909f348b0aaa5d21b607830": "4000000000000000000000",
+ "0x5c7b9ec7a2438d1e3c7698b545b9c3fd77b7cd55": "1000000000000000000000",
+ "0xa16160851d2b9c349b92e46f829abfb210943595": "1790000000000000000000",
+ "0xeac6b98842542ea10bb74f26d7c7488f698b6452": "20000000000000000000000",
+ "0x57825aeb09076caa477887fbc9ae37e8b27cc962": "100000000000000000000",
+ "0xb35e8a1c0dac7e0e66dbac736a592abd44012561": "14974000000000000000",
+ "0x756b84eb85fcc1f4fcdcc2b08db6a86e135fbc25": "3220000000000000000000",
+ "0xe13b3d2bbfdcbc8772a23315724c1425167c5688": "1032115000000000000000",
+ "0x0a2dcb7a671701dbb8f495728088265873356c8e": "152120000000000000000",
+ "0x03cb4c4f4516c4ff79a1b6244fbf572e1c7fea79": "2740000000000000000000",
+ "0x98ba4e9ca72fddc20c69b4396f76f8183f7a2a4e": "12800000000000000000000",
+ "0xf8087786b42da04ed6d1e0fe26f6c0eefe1e9f5a": "10000000000000000000000",
+ "0x02f7f67209b16a17550c694c72583819c80b54ad": "98400000000000000000",
+ "0x32bb2e9693e4e085344d2f0dbd46a283e3a087fd": "400000000000000000000",
+ "0x9c78963fbc263c09bd72e4f8def74a9475f7055c": "13790000000000000000000",
+ "0x27144ca9a7771a836ad50f803f64d869b2ae2b20": "4000000000000000000000",
+ "0xcc758d071d25a6320af68c5dc9c4f6955ba94520": "6000000000000000000000",
+ "0xcb42b44eb5fd60b5837e4f9eb47267523d1a229c": "865000000000000000000",
+ "0xaaf5b207b88b0de4ac40d747cee06e172df6e745": "31428000000000000000000",
+ "0x52d380511df19d5ec2807bbcb676581b67fd37a3": "13400000000000000000",
+ "0xaa1b3768c16d821f580e76c8e4c8e86d7dc78853": "400000000000000000000",
+ "0x41098a81452317c19e3eef0bd123bbe178e9e9ca": "2800000000000000000000",
+ "0x267148fd72c54f620a592fb92799319cc4532b5c": "410000000000000000000",
+ "0xd7cdbd41fff20df727c70b6255c1ba7606055468": "200000000000000000000",
+ "0x0e33fcbbc003510be35785b52a9c5d216bc005f4": "1880000000000000000000",
+ "0x6727daf5b9d68efcab489fedec96d7f7325dd423": "2000000000000000000000",
+ "0xcd0a161bc367ae0927a92aac9cf6e5086714efca": "2000000000000000000000",
+ "0x612667f172135b950b2cd1de10afdece6857b873": "1000000000000000000000",
+ "0x900194c4b1074305d19de405b0ac78280ecaf967": "1000000000000000000000",
+ "0x51f55ef47e6456a418ab32b9221ed27dba6608ee": "4200000000000000000000",
+ "0x0da532c910e3ac0dfb14db61cd739a93353fd05f": "1336866000000000000000",
+ "0x21df2dcdaf74b2bf803404dd4de6a35eabec1bbd": "6920000000000000000000",
+ "0xf0e7fb9e420a5340d536f40408344feaefc06aef": "1000000000000000000000",
+ "0x6742a2cfce8d79a2c4a51b77747498912245cd6a": "258064000000000000000",
+ "0x8663a241a0a89e70e182c845e2105c8ad7264bcf": "14825507000000000000000",
+ "0x18e113d8177c691a61be785852fa5bb47aeebdaf": "1337000000000000000000",
+ "0x1bec4d02ce85fc48feb62489841d85b170586a9b": "2400000000000000000000",
+ "0x287cf9d0902ef819a7a5f149445bf1775ee8c47c": "16000000000000000000000",
+ "0x28967280214e218a120c5dda37041b111ea36d74": "200000000000000000000",
+ "0xa0b771951ce1deee363ae2b771b73e07c4b5e800": "1400000000000000000000",
+ "0x29f8fba4c30772b057edbbe62ae7420c390572e1": "1000000000000000000000",
+ "0xee34c7e7995db9f187cff156918cfb6f13f6e003": "1960000000000000000000",
+ "0x916bf7e3c545921d3206d900c24f14127cbd5e70": "18020000000000000000000",
+ "0x93235f340d2863e18d2f4c52996516138d220267": "73800000000000000000",
+ "0x7efec0c6253caf397f71287c1c07f6c9582b5b86": "482839000000000000000",
+ "0x8d2e31b08803b2c5f13d398ecad88528209f6057": "9993000000000000000000",
+ "0x964eab4b276b4cd8983e15ca72b106900fe41fce": "500000000000000000000",
+ "0xeea1e97988de75d821cd28ad6822b22cce988b31": "520000000000000000000",
+ "0x278c0bde630ec393b1e7267fc9d7d97019e4145b": "2000000000000000000000",
+ "0x82e4461eb9d849f0041c1404219e4272c4900ab4": "2000000000000000000000",
+ "0x4a73389298031b8816cca946421c199e18b343d6": "631254000000000000000",
+ "0x9a5af31c7e06339ac8b4628d7c4db0ce0f45c8a4": "500000000000000000000",
+ "0xcb9b5103e4ce89af4f64916150bff9eecb9faa5c": "500000000000000000000",
+ "0x740f641614779dcfa88ed1d425d60db42a060ca6": "998630000000000000000",
+ "0xa4e623451e7e94e7e89ba5ed95c8a83a62ffc4ea": "20000000000000000000",
+ "0x25a500eeec7a662a841552b5168b707b0de21e9e": "10020000000000000000000",
+ "0x185a7fc4ace368d233e620b2a45935661292bdf2": "20000000000000000000000",
+ "0x9b68f67416a63bf4451a31164c92f672a68759e9": "60000000000000000000000",
+ "0xa38b5bd81a9db9d2b21d5ec7c60552cd02ed561b": "6000000000000000000000",
+ "0x61c830f1654718f075ccaba316faacb85b7d120b": "400000000000000000000",
+ "0x8392e53776713578015bff4940cf43849d7dcba1": "153190000000000000000",
+ "0xdc57477dafa42f705c7fe40eae9c81756e0225f1": "500044000000000000000",
+ "0xfebc3173bc9072136354002b7b4fb3bfc53f22f1": "370000000000000000000",
+ "0xd78f84e38944a0e0255faece48ba4950d4bd39d2": "5000000000000000000000",
+ "0xa7a3bb6139b0ada00c1f7f1f9f56d994ba4d1fa8": "2000000000000000000000",
+ "0xaa3f29601a1331745e05c42830a15e71938a6237": "1700000000000000000000",
+ "0xbec6640f4909b58cbf1e806342961d607595096c": "1999944000000000000000",
+ "0x9be3c329b62a28b8b0886cbd8b99f8bc930ce3e6": "74500000000000000000",
+ "0xe3eb2c0a132a524f72ccc0d60fee8b41685d39e2": "1970000000000000000000",
+ "0x90b1f370f9c1eb0be0fb8e2b8ad96a416371dd8a": "900000000000000000000",
+ "0xf2742e6859c569d5f2108351e0bf4dca352a48a8": "10000000000000000000000",
+ "0xb134c004391ab4992878337a51ec242f42285742": "2000000000000000000000",
+ "0xab7416ff32254951cbbc624ec7fb45fc7ecaa872": "340000000000000000000",
+ "0x9795f64319fc17dd0f8261f9d206fb66b64cd0c9": "200000000000000000000",
+ "0x64e03ef070a54703b7184e48276c5c0077ef4b34": "320000000000000000000",
+ "0x3430a16381f869f6ea5423915855e800883525a9": "17900000000000000000000",
+ "0xf4a367b166d2991a2bfda9f56463a09f252c1b1d": "1970000000000000000000",
+ "0x77c4a697e603d42b12056cbba761e7f51d0443f5": "680000000000000000000",
+ "0x153ef58a1e2e7a3eb6b459a80ab2a547c94182a2": "96000000000000000000000",
+ "0x6dbe8abfa1742806263981371bf3d35590806b6e": "20000000000000000000000",
+ "0x4c99dae96481e807c1f99f8b7fbde29b7547c5bf": "150000000000000000000",
+ "0xd5b9d277d8aad20697a51f76e20978996bffe055": "143250000000000000000",
+ "0x0f24105abbdaa03fa6309ef6c188e51f714a6e59": "200000000000000000000",
+ "0x1cb6b2d7cfc559b7f41e6f56ab95c7c958cd0e4c": "1337000000000000000000",
+ "0xf37b426547a1642d8033324814f0ede3114fc212": "401100000000000000000",
+ "0x318f1f8bd220b0558b95fb33100ffdbb640d7ca6": "4000000000000000000000",
+ "0x206d55d5792a514ec108e090599f2a065e501185": "200550000000000000000",
+ "0x11d2247a221e70c2d66d17ee138d38c55ffb8640": "10000000000000000000000",
+ "0xe8de725eca5def805ff7941d31ac1c2e342dfe95": "2462500000000000000000",
+ "0xd561cbbc05515de73ab8cf9eae1357341e7dfdf4": "6000000000000000000000",
+ "0x0455dcec8a7fc4461bfd7f37456fce3f4c3caac7": "400000000000000000000",
+ "0x5161fd49e847f67455f1c8bb7abb36e985260d03": "1200000000000000000000",
+ "0x8e073bad25e42218615f4a0e6b2ea8f8de2230c0": "2402500000000000000000",
+ "0x6c08a6dc0173c7342955d1d3f2c065d62f83aec7": "20000000000000000000",
+ "0x95cb6d8a6379f94aba8b885669562c4d448e56a7": "2000000000000000000000",
+ "0x2805415e1d7fdec6dedfb89e521d10592d743c10": "100000000000000000000",
+ "0xdaacdaf42226d15cb1cf98fa15048c7f4ceefe69": "300000000000000000000",
+ "0xe33df4ce80ccb62a76b12bcdfcecc46289973aa9": "6000000000000000000000",
+ "0x8f8cd26e82e7c6defd02dfad07979021cbf7150c": "3000000000000000000000",
+ "0x77a17122fa31b98f1711d32a99f03ec326f33d08": "1700000000000000000000",
+ "0x6f791d359bc3536a315d6382b88311af8ed6da47": "92000000000000000000",
+ "0xde30e49e5ab313214d2f01dcabce8940b81b1c76": "197000000000000000000",
+ "0xcf9be9b9ab86c66b59968e67b8d4dcff46b1814a": "660000000000000000000",
+ "0x7fdfc88d78bf1b285ac64f1adb35dc11fcb03951": "2287900000000000000000",
+ "0xc5134cfbb1df7a20b0ed7057622eeed280947dad": "3800000000000000000000",
+ "0xfa9ec8efe08686fa58c181335872ba698560ecab": "1999944000000000000000",
+ "0xf6a8635757c5e8c134d20d028cf778cf8609e46a": "1459416000000000000000",
+ "0x6265b2e7730f36b776b52d0c9d02ada55d8e3cb6": "1000000000000000000000",
+ "0x6a8cea2de84a8df997fd3f84e3083d93de57cda9": "100007000000000000000",
+ "0x1b7ed974b6e234ce81247498429a5bd4a0a2d139": "2000000000000000000000",
+ "0x9ba53dc8c95e9a472feba2c4e32c1dc4dd7bab46": "1337000000000000000000",
+ "0xd7b740dff8c457668fdf74f6a266bfc1dcb723f9": "20000000000000000000",
+ "0x07bc2cc8eedc01970700efc9c4fb36735e98cd71": "4000000000000000000000",
+ "0x3e1c962063e0d5295941f210dca3ab531eec8809": "3000000000000000000000",
+ "0xb447571dacbb3ecbb6d1cf0b0c8f3838e52324e2": "30199000000000000000",
+ "0x87764e3677eef604cbc59aed24abdc566b09fc25": "3000000000000000000000",
+ "0x03aa622881236dd0f4940c24c324ff8b7b7e2186": "3200000000000000000000",
+ "0xa4a7d306f510cd58359428c0d2f7c3609d5674d7": "3349000000000000000000",
+ "0x3c83c1701db0388b68210d00f5717cd9bd322c6a": "30000000000000000000000",
+ "0x047d5a26d7ad8f8e70600f70a398ddaa1c2db26f": "6000000000000000000000",
+ "0x43767bf7fd2af95b72e9312da9443cb1688e4343": "300000000000000000000",
+ "0x34a85d6d243fb1dfb7d1d2d44f536e947a4cee9e": "20000000000000000000000",
+ "0x65a9dad42e1632ba3e4e49623fab62a17e4d3611": "93120000000000000000",
+ "0x48e0cbd67f18acdb7a6291e1254db32e0972737f": "100007000000000000000",
+ "0xa5de5e434fdcdd688f1c31b6fb512cb196724701": "800000000000000000000",
+ "0x6d63d38ee8b90e0e6ed8f192eda051b2d6a58bfd": "30000000000000000000",
+ "0xb079bb4d9866143a6da72ae7ac0022062981315c": "760000000000000000000",
+ "0xc0413f5a7c2d9a4b8108289ef6ecd271781524f4": "50000000000000000000000",
+ "0xa91a5a7b341f99c535144e20be9c6b3bb4c28e4d": "5431790000000000000000",
+ "0x993f146178605e66d517be782ef0b3c61a4e1925": "7011998000000000000000",
+ "0x966c04781cb5e67dde3235d7f8620e1ab663a9a5": "75800000000000000000000",
+ "0xb3f82a87e59a39d0d2808f0751eb72c2329cdcc5": "5000000000000000000000",
+ "0x9b77ebced7e215f0920e8c2b870024f6ecb2ff31": "1000000000000000000000",
+ "0xfe697ff22ca547bfc95e33d960da605c6763f35b": "1325000000000000000000",
+ "0x480af52076009ca73781b70e43b95916a62203ab": "924171000000000000000",
+ "0xa9dc0424c6969d798358b393b1933a1f51bee00a": "20000000000000000000000",
+ "0x7aba56f63a48bc0817d6b97039039a7ad62fae2e": "600000000000000000000",
+ "0x59d139e2e40c7b97239d23dfaca33858f602d22b": "2000000000000000000000",
+ "0x8d6170ff66978e773bb621bf72b1ba7be3a7f87e": "200000000000000000000",
+ "0xd668523a90f0293d65c538d2dd6c57673710196e": "39500000000000000000",
+ "0xbbb5a0f4802c8648009e8a6998af352cde87544f": "95500000000000000000",
+ "0xfc43829ac787ff88aaf183ba352aadbf5a15b193": "3960000000000000000000",
+ "0xfe22a0b388668d1ae2643e771dacf38a434223cc": "4000304000000000000000",
+ "0x092acb624b08c05510189bbbe21e6524d644ccad": "18200000000000000000",
+ "0x8f0538ed71da1155e0f3bde5667ceb84318a1a87": "1940000000000000000000",
+ "0x06994cd83aa2640a97b2600b41339d1e0d3ede6c": "250000000000000000000",
+ "0x9d460c1b379ddb19a8c85b4c6747050ddf17a875": "3340000000000000000000",
+ "0x77a769fafdecf4a638762d5ba3969df63120a41d": "2000000000000000000000",
+ "0x5f375b86600c40cca8b2676b7a1a1d1644c5f52c": "78838000000000000000",
+ "0x15ee0fc63ebf1b1fc49d7bb38f8863823a2e17d2": "1910000000000000000000",
+ "0x6651736fb59b91fee9c93aa0bd6ea2f7b2506180": "500000000000000000000",
+ "0x361d9ed80b5bd27cf9f1226f26753258ee5f9b3f": "3530900000000000000000",
+ "0xc9b6b686111691ee6aa197c7231a88dc60bd295d": "500000000000000000000",
+ "0xe9b4a4853577a9dbcc2e795be0310d1bed28641a": "1000000000000000000000",
+ "0x36758e049cd98bcea12277a676f9297362890023": "4000000000000000000000",
+ "0x6bb50813146a9add42ee22038c9f1f7469d47f47": "200200000000000000000",
+ "0x6de4b581385cf7fc9fe8c77d131fe2ee7724c76a": "2308840000000000000000",
+ "0xd2a5a024230a57ccc666760b89b0e26cafd189c7": "49997115000000000000000",
+ "0x65af9087e05167715497c9a5a749189489004def": "835000000000000000000",
+ "0xead21c1deccfbf1c5cd96688a2476b69ba07ce4a": "72800000000000000000",
+ "0xe308435204793764f5fcbe65eb510f5a744a655a": "200000000000000000000",
+ "0x9376dce2af2ec8dcda741b7e7345664681d93668": "1000000000000000000000",
+ "0xa1b47c4d0ed6018842e6cfc8630ac3a3142e5e6b": "20000000000000000000",
+ "0xe2198c8ca1b399f7521561fd5384a7132fba486b": "1015200000000000000000",
+ "0x92c13fe0d6ce87fd50e03def9fa6400509bd7073": "40000000000000000000",
+ "0x7517f16c28d132bb40e3ba36c6aef131c462da17": "18200000000000000000",
+ "0x6a023af57d584d845e698736f130db9db40dfa9a": "98800000000000000000",
+ "0x1518627b88351fede796d3f3083364fbd4887b0c": "16000000000000000000000",
+ "0xf5b6e9061a4eb096160777e26762cf48bdd8b55d": "254030000000000000000",
+ "0x28073efc17d05cab3195c2db332b61984777a612": "1000000000000000000000",
+ "0xf06a854a3c5dc36d1c49f4c87d6db333b57e4add": "10000000000000000000000",
+ "0x9225983860a1cb4623c72480ac16272b0c95e5f5": "2000000000000000000000",
+ "0x5260dc51ee07bddaababb9ee744b393c7f4793a6": "34040000000000000000",
+ "0x0f127bbf8e311caea2ba502a33feced3f730ba42": "188000000000000000000",
+ "0x17d521a8d9779023f7164d233c3b6420ffd223ed": "20000000000000000000",
+ "0x8c2b7d8b608d28b77f5caa9cd645242a823e4cd9": "1820000000000000000000",
+ "0x6e866d032d405abdd65cf651411d803796c22311": "2000000000000000000000",
+ "0xdc51b2dc9d247a1d0e5bc36ca3156f7af21ff9f6": "1000000000000000000000",
+ "0xc84d9bea0a7b9f140220fd8b9097cfbfd5edf564": "123047000000000000000",
+ "0xff86e5e8e15b53909600e41308dab75f0e24e46b": "902400000000000000000",
+ "0xd7164aa261c09ad9b2b5068d453ed8eb6aa13083": "3000000000000000000000",
+ "0x76aaf8c1ac012f8752d4c09bb46607b6651d5ca8": "20000000000000000000",
+ "0x41786a10d447f484d33244ccb7facd8b427b5b8c": "1000000000000000000000",
+ "0x2e0c57b47150f95aa6a7e16ab9b1cbf54328979a": "100000000000000000000",
+ "0x3f747237806fed3f828a6852eb0867f79027af89": "1500000000000000000000",
+ "0xa568db4d57e4d67462d733c69a9e0fe26e218327": "1096140000000000000000",
+ "0x1f88f8a1338fc7c10976abcd3fb8d38554b5ec9c": "13400000000000000000",
+ "0xd1ea4d72a67b5b3e0f315559f52bd0614d713069": "2000000000000000000000",
+ "0xbfaeb91067617dcf8b44172b02af615674835dba": "160661000000000000000",
+ "0xb71a13ba8e95167b80331b52d69e37054fe7a826": "200000000000000000000",
+ "0xb67a80f170197d96cdcc4ab6cba627b4afa6e12c": "2400000000000000000000",
+ "0x35af040a0cc2337a76af288154c7561e1a233349": "1000000000000000000000",
+ "0xc86190904b8d079ec010e462cbffc90834ffaa5c": "10100000000000000000000",
+ "0x383304dd7a5720b29c1a10f60342219f48032f80": "5600000000000000000000",
+ "0x191313525238a21c767457a91374f02200c55448": "116400000000000000000",
+ "0xcc4a2f2cf86cf3e43375f360a4734691195f1490": "1348127000000000000000",
+ "0x4e020779b5ddd3df228a00cb48c2fc979da6ae38": "2000000000000000000000",
+ "0xe206fb7324e9deb79e19903496d6961b9be56603": "100000000000000000000",
+ "0x3ae160e3cd60ae31b9d6742d68e14e76bd96c517": "30000000000000000000",
+ "0x1f7d8e86d6eeb02545aad90e91327bd369d7d2f3": "20000000000000000000",
+ "0x68c7d1711b011a33f16f1f55b5c902cce970bdd7": "152000000000000000000",
+ "0x637be71b3aa815ff453d5642f73074450b64c82a": "2000000000000000000000",
+ "0x1584a2c066b7a455dbd6ae2807a7334e83c35fa5": "130000000000000000000",
+ "0x9c05e9d0f0758e795303717e31da213ca157e686": "1000000000000000000000",
+ "0x4f1a2da54a4c6da19d142412e56e815741db2325": "100000000000000000000",
+ "0x9a4ca8b82117894e43db72b9fa78f0b9b93ace09": "50000000000000000000",
+ "0x26c99f8849c9802b83c861217fd07a9e84cdb79d": "300000000000000000000",
+ "0x45c0d19f0b8e054f9e893836d5ecae7901af2812": "5000000000000000000000",
+ "0x00dc01cbf44978a42e8de8e436edf94205cfb6ec": "1458440000000000000000",
+ "0xde7dee220f0457a7187d56c1c41f2eb00ac56021": "629924000000000000000",
+ "0x1c128bd6cda5fca27575e4b43b3253c8c4172afe": "2000000000000000000000",
+ "0x666746fb93d1935c5a3c684e725010c4fad0b1d8": "20000000000000000000",
+ "0x51d78b178d707e396e8710965c4f41b1a1d9179d": "110600000000000000000",
+ "0x68f7573cd457e14c03fea43e302d30347c10705c": "5000000000000000000000",
+ "0x9d30cb237bc096f17036fc80dd21ca68992ca2d9": "30380000000000000000000",
+ "0xfbcfcc4a7b0f26cf26e9f3332132e2fc6a230766": "8000000000000000000000",
+ "0xb166e37d2e501ae73c84142b5ffb5aa655dd5a99": "1999000000000000000000",
+ "0x6df24f6685a62f791ba337bf3ff67e91f3d4bc3a": "2166000000000000000000",
+ "0x92e435340e9d253c00256389f52b067d55974e76": "268000000000000000000",
+ "0xea53d26564859d9e90bb0e53b7abf560e0162c38": "400000000000000000000",
+ "0xe26657f0ed201ea2392c9222b80a7003608ddf30": "40000000000000000000",
+ "0xf4177a0d85d48b0e264211ce2aa2efd3f1b47f08": "3593425000000000000000",
+ "0x9d47ba5b4c8505ad8da42934280b61a0e1e8b971": "100000000000000000000",
+ "0x63c2a3d235e5eeabd0d4a6afdb89d94627396495": "1241620000000000000000",
+ "0x446a8039cecf9dce4879cbcaf3493bf545a88610": "7000000000000000000000",
+ "0x7fa37ed67887751a471f0eb306be44e0dbcd6089": "1060000000000000000000",
+ "0x26d4a16891f52922789217fcd886f7fce296d400": "2000000000000000000000",
+ "0x487e108502b0b189ef9c8c6da4d0db6261eec6c0": "1910000000000000000000",
+ "0x7484d26becc1eea8c6315ec3ee0a450117dc86a0": "12000000000000000000000",
+ "0xad9e97a0482f353a05c0f792b977b6c7e811fa5f": "200000000000000000000",
+ "0x2273bad7bc4e487622d175ef7a66988b6a93c4ee": "20000000000000000000",
+ "0x3b93b16136f11eaf10996c95990d3b2739ccea5f": "10000000000000000000000",
+ "0xf3f1fa3918ca34e2cf7e84670b1f4d8eca160db3": "680000000000000000000",
+ "0x88a2154430c0e41147d3c1fee3b3b006f851edbd": "999972000000000000000",
+ "0x25185f325acf2d64500698f65c769ddf68301602": "5000000000000000000000",
+ "0xe9cafe41a5e8bbd90ba02d9e06585b4eb546c57f": "2000000000000000000000",
+ "0x95681cdae69b2049ce101e325c759892cac3f811": "2857600000000000000000",
+ "0x475066f9ad26655196d5535327bbeb9b7929cb04": "3040000000000000000000",
+ "0x6685fd2e2544702c360b8bb9ee78f130dad16da5": "2000000000000000000000",
+ "0x45e68db94c7d0ab7ac41857a71d67147870f4e71": "400000000000000000000000",
+ "0x4ad95d188d6464709add2555fb4d97fe1ebf311f": "346000000000000000000",
+ "0x73bedd6fda7ba3272185087b6351fc133d484e37": "5057200000000000000000",
+ "0x1ea4715504c6af107b0194f4f7b1cb6fcccd6f4b": "590598000000000000000",
+ "0x77306ffe2e4a8f3ca826c1a249f7212da43aeffd": "20000000000000000000000",
+ "0xeb453f5a3adddd8ab56750fadb0fe7f94d9c89e7": "20000000000000000000",
+ "0x7201d1c06920cd397ae8ad869bcda6e47ffb1b5a": "20000000000000000000",
+ "0x821cb5cd05c7ef909fe1be60733d8963d760dc41": "4000000000000000000000",
+ "0x496e319592b341eaccd778dda7c8196d54cac775": "9250000000000000000000",
+ "0x88609e0a465b6e99fce907166d57e9da0814f5c8": "20000000000000000000000",
+ "0xc7ec62b804b1f69b1e3070b5d362c62fb309b070": "13068074000000000000000",
+ "0x3eb9ef06d0c259040319947e8c7a6812aa0253d8": "167000000000000000000",
+ "0xcbf37ff854a2f1ce53934494777892d3ec655782": "10000000000000000000000",
+ "0x02b1af72339b2a2256389fd64607de24f0de600a": "2000000000000000000000",
+ "0xa8beb91c2b99c8964aa95b6b4a184b1269fc3483": "400000000000000000000",
+ "0x922a20c79a1d3a26dd3829677bf1d45c8f672bb6": "4000000000000000000000",
+ "0xc5843399d150066bf7979c34ba294620368ad7c0": "200000000000000000000",
+ "0x8cd0cd22e620eda79c0461e896c93c44837e2968": "2000000000000000000000",
+ "0x6170dd0687bd55ca88b87adef51cfdc55c4dd458": "2005160000000000000000",
+ "0xeed384ef2d41d9d203974e57c12328ea760e08ea": "1000000000000000000000",
+ "0xb129a5cb7105fe810bd895dc7206a991a4545488": "30000000000000000000",
+ "0x3872f48dc5e3f817bc6b2ad2d030fc5e0471193d": "4000000000000000000000",
+ "0x514b7512c9ae5ea63cbf11715b63f21e18d296c1": "1999944000000000000000",
+ "0x7ab256b204800af20137fabcc916a23258752501": "20000000000000000000000",
+ "0xfc66faba277f4b5de64ad45eb19c31e00ced3ed5": "5640000000000000000000",
+ "0x39824f8bced176fd3ea22ec6a493d0ccc33fc147": "4000000000000000000000",
+ "0xe338e859fe2e8c15554848b75caecda877a0e832": "1801800000000000000000",
+ "0xe53c68796212033e4e6f9cff56e19c461eb454f9": "1000000000000000000000",
+ "0x8461ecc4a6a45eb1a5b947fb86b88069b91fcd6f": "2000000000000000000000",
+ "0x6b4b99cb3fa9f7b74ce3a48317b1cd13090a1a7a": "57300000000000000000",
+ "0x97de21e421c37fe4b8025f9a51b7b390b5df7804": "80000000000000000000000",
+ "0xd25aecd7eb8bd6345b063b5dbd271c77d3514494": "1820000000000000000000",
+ "0x57b23d6a1adc06c652a779c6a7fb6b95b9fead66": "200000000000000000000",
+ "0x0d658014a199061cf6b39433140303c20ffd4e5a": "8200000000000000000000",
+ "0x30eac740e4f02cb56eef0526e5d300322600d03e": "1970000000000000000000",
+ "0x4eead40aad8c73ef08fc84bc0a92c9092f6a36bf": "26740000000000000000",
+ "0x30f7d025d16f7bee105580486f9f561c7bae3fef": "500000000000000000000",
+ "0x0977bfba038a44fb49b03970d8d8cf2cb61f8b25": "420000000000000000000",
+ "0xb14bbeff70720975dc6191b2a44ff49f2672873c": "143000000000000000000",
+ "0xd588c3a5df228185d98ee7e60748255cdea68b01": "4000000000000000000000",
+ "0x225d35faedb391c7bc2db7fa9071160405996d00": "167774000000000000000",
+ "0xc0e457bd56ec36a1246bfa3230fff38e5926ef22": "1940000000000000000000",
+ "0x2a9c57fe7b6b138a920d676f3c76b6c2a0eef699": "9400000000000000000000",
+ "0x36df8f883c1273ec8a171f7a33cfd649b1fe6075": "227290000000000000000",
+ "0x234f46bab73fe45d31bf87f0a1e0466199f2ebac": "485000000000000000000",
+ "0xa2e1b8aa900e9c139b3fa122354f6156d92a18b1": "500000000000000000000",
+ "0x517cd7608e5d0d83a26b717f3603dac2277dc3a4": "2000000000000000000000",
+ "0x75f7539d309e9039989efe2e8b2dbd865a0df088": "2460000000000000000000",
+ "0x4b792e29683eb586e394bb33526c6001b397999e": "600000000000000000000",
+ "0xa34f9d568bf7afd94c2a5b8a5ff55c66c4087999": "2444000000000000000000",
+ "0x4b31bf41abc75c9ae2cd8f7f35163b6e2b745054": "382000000000000000000",
+ "0xe35453eef2cc3c7a044d0ac134ba615908fa82ee": "147510000000000000000",
+ "0x7aa79ac04316cc8d08f20065baa6d4142897d54e": "1400000000000000000000",
+ "0xf1dc8ac81042c67a9c3c6792b230c46ac016ca10": "200000000000000000000",
+ "0x2bb366b9edcb0da680f0e10b3b6e28748190d6c3": "5799400000000000000000",
+ "0xa567770b6ae320bdde50f904d663e746a61dace6": "2000000000000000000000",
+ "0xd9d42fd13ebd4bf69cac5e9c7e82483ab46dd7e9": "5348000000000000000000",
+ "0x27830c5f6023afaaf79745676c204a0faccda0ba": "240000000000000000000",
+ "0x3cb179cb4801a99b95c3b0c324a2bdc101a65360": "26000000000000000000",
+ "0x976e3ceaf3f1af51f8c29aff5d7fa21f0386d8ee": "240000000000000000000",
+ "0x752a5ee232612cd3005fb26e5b597de19f776be6": "5460000000000000000000",
+ "0x7d5aa33fc14b51841a06906edb2bb49c2a117269": "300048000000000000000",
+ "0x55ca6abe79ea2497f46fdbb830346010fe469cbe": "5730000000000000000000",
+ "0x6bec311ad05008b4af353c958c40bd06739a3ff3": "16380000000000000000000",
+ "0x30e9698cf1e08a9d048bd8d8048f28be7ed9409f": "6685000000000000000000",
+ "0x9afa536b4c66bc38d875c4b30099d9261fdb38eb": "205981000000000000000",
+ "0x6b63a2dfb2bcd0caec0022b88be30c1451ea56aa": "809021000000000000000",
+ "0xd07be0f90997caf903c8ac1d53cde904fb190741": "1000200000000000000000",
+ "0x893cdddf5377f3c751bf2e541120045a47cba101": "100000000000000000000",
+ "0xc1cdc601f89c0428b31302d187e0dc08ad7d1c57": "6000000000000000000000",
+ "0x8f8acb107607388479f64baaabea8ff007ada97d": "27281800000000000000000",
+ "0x88bc43012edb0ea9f062ac437843250a39b78fbb": "20000000000000000000000",
+ "0xfcfc3a5004d678613f0b36a642269a7f371c3f6a": "1000000000000000000000",
+ "0xf509557e90183fbf0f0651a786487bcc428ba175": "194000000000000000000",
+ "0xe3d915eda3b825d6ee4af9328d32ac18ada35497": "500000000000000000000",
+ "0xf237ef05261c34d79cc22b860de0f17f793c3860": "200000000000000000000",
+ "0xa3a2e319e7d3a1448b5aa2468953160c2dbcba71": "2000000000000000000000",
+ "0x3a368efe4ad786e26395ec9fc6ad698cae29fe01": "632200000000000000000",
+ "0x8e3240b0810e1cf407a500804740cf8d616432a4": "40309000000000000000",
+ "0x5691dd2f6745f20e22d2e1d1b955aa2903d65656": "1969606000000000000000",
+ "0x5f93ff832774db5114c55bb4bf44ccf3b58f903f": "192026650000000000000000",
+ "0x2c1cc6e18c152488ba11c2cc1bcefa2df306abd1": "1670000000000000000000",
+ "0xbde9786a84e75b48f18e726dd78d70e4af3ed802": "5730000000000000000000",
+ "0x79551cede376f747e3716c8d79400d766d2e0195": "46250000000000000000000",
+ "0x49f028395b5a86c9e07f7778630e4c2e3d373a77": "122735000000000000000",
+ "0x6a3694424c7cc6b8bcd9bccaba540cc1f5df18d7": "2000000000000000000000",
+ "0x068e29b3f191c812a6393918f71ab933ae6847f2": "1999944000000000000000",
+ "0x6e64e6129f224e378c0e6e736a7e7a06c211e9ec": "1000000000000000000000",
+ "0xc4c15318d370c73318cc18bdd466dbaa4c6603bf": "19700000000000000000",
+ "0x8035bcffaefdeeea35830c497d14289d362023de": "300000000000000000000",
+ "0xa997dfc7986a27050848fa1c64d7a7d6e07acca2": "143000000000000000000",
+ "0x2fe13a8d0785de8758a5e41876c36e916cf75074": "4000000000000000000000",
+ "0x6f24c9af2b763480515d1b0951bb77a540f1e3f9": "1970000000000000000000",
+ "0x4c23b370fc992bb67cec06e26715b62f0b3a4ac3": "10000000000000000000000",
+ "0x4ac07673e42f64c1a25ec2fa2d86e5aa2b34e039": "2000000000000000000000",
+ "0x117db836377fe15455e02c2ebda40b1ceb551b19": "6000000000000000000000",
+ "0xef1c0477f1184d60accab374d374557a0a3e10f3": "152000000000000000000",
+ "0x99fe0d201228a753145655d428eb9fd94985d36d": "1939268000000000000000",
+ "0xb3731b046c8ac695a127fd79d0a5d5fa6ae6d12e": "1998000000000000000000",
+ "0xdce30c31f3ca66721ecb213c809aab561d9b52e4": "2000000000000000000000",
+ "0xddd69c5b9bf5eb5a39cee7c3341a120d973fdb34": "1987730000000000000000",
+ "0x216e41864ef98f060da08ecae19ad1166a17d036": "5730000000000000000000",
+ "0x6a53d41ae4a752b21abed5374649953a513de5e5": "2000000000000000000000",
+ "0x20dd8fcbb46ea46fe381a68b8ca0ea5be21fe9a5": "2000000000000000000000",
+ "0x19732bf973055dbd91a4533adaa2149a91d38380": "2000000000000000000000",
+ "0x51ea1c0934e3d04022ed9c95a087a150ef705e81": "6280000000000000000000",
+ "0xa0de5c601e696635c698b7ae9ca4539fc7b941ec": "346150000000000000000",
+ "0x94e1f5cb9b8abace03a1a6428256553b690c2355": "20000000000000000000",
+ "0xa539b4a401b584dfe0f344b1b422c65543167e2e": "200000000000000000000",
+ "0x50584d9206a46ce15c301117ee28f15c30e60e75": "13400000000000000000",
+ "0x856eb204241a87830fb229031343dc30854f581a": "1000000000000000000000",
+ "0x9dd46b1c6d3f05e29e9c6f037eed9a595af4a9aa": "500000000000000000000",
+ "0x8925da4549e15155e57a628522cea9dddf627d81": "1000070000000000000000",
+ "0xa89df34859edd7c820db887740d8ff9e15157c7b": "2000000000000000000000",
+ "0xad9f4c890a3b511cee51dfe6cfd7f1093b76412c": "506600000000000000000",
+ "0xf8c7f34a38b31801da43063477b12b27d0f203ff": "494800000000000000000",
+ "0xa642501004c90ea9c9ed1998ba140a4cd62c6f5f": "250543000000000000000",
+ "0x508cf19119db70aa86454253da764a2cb1b2be1a": "1000000000000000000000",
+ "0x2979741174a8c1ea0b7f9edf658177859417f512": "461283000000000000000",
+ "0x654f524847b3a6acc0d3d5f1f362b603edf65f96": "8000000000000000000000",
+ "0x5cf18fa7c8a7c0a2b3d5efd1990f64ddc569242c": "1000000000000000000000",
+ "0x17e82e7078dc4fd9e879fb8a50667f53a5c54591": "200000000000000000000",
+ "0x8b07d050754dc9ba230db01c310afdb5395aa1b3": "118080000000000000000",
+ "0x5f77a107ab1226b3f95f10ee83aefc6c5dff3edc": "500000000000000000000",
+ "0x475a6193572d4a4e59d7be09cb960ddd8c530e2f": "667323000000000000000",
+ "0x6470a4f92ec6b0fccd01234fa59023e9ff1f3aac": "3000000000000000000000",
+ "0x2fbcef3384d420e4bf61a0669990bc7054f1a5af": "2000000000000000000000",
+ "0xbbabf6643beb4bd01c120bd0598a0987d82967d1": "3342500000000000000000",
+ "0x41a2f2e6ecb86394ec0e338c0fc97e9c5583ded2": "2009400000000000000000",
+ "0xfb9473cf7712350a1fa0395273fc80560752e4fb": "123300000000000000000",
+ "0x38b2197106123387a0d4de368431a8bacdda30e2": "20000000000000000000",
+ "0x5ed56115bd6505a88273df5c56839470d24a2db7": "65601000000000000000",
+ "0x523f6d64690fdacd942853591bb0ff20d3656d95": "1820000000000000000000",
+ "0x55caff4bba04d220c9a5d2018672ec85e31ef83e": "2000000000000000000000",
+ "0x65af8d8b5b1d1eedfa77bcbc96c1b133f83306df": "98000000000000000000",
+ "0x7456c5b2c5436e3e571008933f1805ccfe34e9ec": "1000000000000000000000",
+ "0xa6eebbe464d39187bf80ca9c13d72027ec5ba8be": "3000000000000000000000",
+ "0xdd35cfdbcb993395537aecc9f59085a8d5ddb6f5": "1000000000000000000000",
+ "0x98e2b6d606fd2d6991c9d6d4077fdf3fdd4585da": "901520000000000000000",
+ "0x860f5ffc10de767ded807f71e861d647dfd219b1": "10000000000000000000000",
+ "0x1a644a50cbc2aee823bd2bf243e825be4d47df02": "100007000000000000000",
+ "0xa8455b411765d6901e311e726403091e42c56683": "3380000000000000000000",
+ "0x3a86ee94862b743dd34f410969d94e2c5652d4ad": "201610000000000000000",
+ "0xa57360f002e0d64d2d74457d8ca4857ee00bcddf": "335780000000000000000",
+ "0xe59b3bd300893f97233ef947c46f7217e392f7e9": "1000000000000000000000",
+ "0x9f3a74fd5e7edcc1162993171381cbb632b7cff0": "10000000000000000000000",
+ "0x675d5caa609bf70a18aca580465d8fb7310d1bbb": "20000000000000000000000",
+ "0x77f609ca8720a023262c55c46f2d26fb3930ac69": "17300000000000000000",
+ "0xf8ac4a39b53c11307820973b441365cffe596f66": "2000000000000000000000",
+ "0x112634b4ec30ff786e024159f796a57939ea144e": "1999944000000000000000",
+ "0x49d2c28ee9bc545eaaf7fd14c27c4073b4bb5f1a": "1474134000000000000000",
+ "0x91cc46aa379f856a6640dccd5a648a7902f849d9": "200000000000000000000",
+ "0xb46440c797a556e04c7d9104660491f96bb076bf": "14900000000000000000",
+ "0xe5968797468ef767101b761d431fce14abffdbb4": "8040000000000000000000",
+ "0xc0895efd056d9a3a81c3da578ada311bfb9356cf": "200000000000000000000",
+ "0x76846f0de03b5a76971ead298cdd08843a4bc6c6": "15500000000000000000",
+ "0x5f708eaf39d823946c51b3a3e9b7b3c003e26341": "1820000000000000000000",
+ "0x24f7450ddbf18b020feb1a2032d9d54b633edf37": "50000000000000000000",
+ "0xcae3a253bcb2cf4e13ba80c298ab0402da7c2aa0": "5400000000000000000000",
+ "0x91e8810652e8e6161525d63bb7751dc20f676076": "725000000000000000000",
+ "0x543629c95cdef428ad37d453ca9538a9f90900ac": "43250000000000000000000",
+ "0x6e79edd4845b076e4cd88d188b6e432dd93f35aa": "955000000000000000000",
+ "0xbd325d4029e0d8729f6d399c478224ae9e7ae41e": "3880000000000000000000",
+ "0x42cecfd2921079c2d7df3f08b07aa3beee5e219a": "1000000000000000000000",
+ "0x3690246ba3c80679e22eac4412a1aefce6d7cd82": "20000000000000000000000",
+ "0x577aeee8d4bc08fc97ab156ed57fb970925366be": "333046000000000000000",
+ "0xfe00bf439911a553982db638039245bcf032dbdc": "394000000000000000000",
+ "0x91f624b24a1fa5a056fe571229e7379db14b9a1e": "11999974000000000000000",
+ "0xf206d328e471d0117b246d2a4619827709e96df3": "3001000000000000000000",
+ "0x073f1ed1c9c3e9c52a9b0249a5c1caa0571fdf05": "70400000000000000000",
+ "0xf56048dd2181d4a36f64fcecc6215481e42abc15": "200000000000000000000",
+ "0xef76a4cd8febcbc9b818f17828f8d93473f3f3cb": "4000000000000000000000",
+ "0x1031e0ecb54985ae21af1793950dc811888fde7c": "20000000000000000000",
+ "0x8e0fee38685a94aabcd7ce857b6b1409824f75b8": "500000000000000000000",
+ "0xf0cbef84e169630098d4e301b20208ef05846ac9": "259084000000000000000",
+ "0xbbca65b3266ea2fb73a03f921635f912c7bede00": "1970000000000000000000",
+ "0x0aec2e426ed6cc0cf3c249c1897eac47a7faa9bd": "200000000000000000000",
+ "0xb8f30758faa808dbc919aa7b425ec922b93b8129": "1000076000000000000000",
+ "0x936dcf000194e3bff50ac5b4243a3ba014d661d8": "10000000000000000000000",
+ "0xb14ddb0386fb606398b8cc47565afae00ff1d66a": "2973024000000000000000",
+ "0x2ec95822eb887bc113b4712a4dfd7f13b097b5e7": "1000000000000000000000",
+ "0x0136a5af6c3299c6b5f005fdaddb148c070b299b": "20368000000000000000",
+ "0x37cb868d2c3f95b257611eb34a4188d58b749802": "2000000000000000000000",
+ "0xcd7f09d7ed66d0c38bc5ad4e32b7f2b08dc1b30d": "1148000000000000000000",
+ "0xb5fa8184e43ed3e0b8ab91216461b3528d84fd09": "2680000000000000000000",
+ "0x3dbf0dbfd77890800533f09dea8301b9f025d2a6": "1000000000000000000000",
+ "0xb553d25d6b5421e81c2ad05e0b8ba751f8f010e3": "2000000000000000000000",
+ "0xdbf8b13967f55125272de0562536c450ba5655a0": "2046830000000000000000",
+ "0x0f6e840a3f2a24647d8e43e09d45c7c335df4248": "2500000000000000000000",
+ "0xfa2fd29d03fee9a07893df3a269f56b72f2e1e64": "10000000000000000000000",
+ "0x8b57b2bc83cc8d4de331204e893f2f3b1db1079a": "40000000000000000000",
+ "0x7f541491d2ac00d2612f94aa7f0bcb014651fbd4": "376000000000000000000",
+ "0x4f4a9be10cd5d3fb5de48c17be296f895690645b": "40000000000000000000000",
+ "0x45d1c9eedf7cab41a779057b79395f5428d80528": "2000000000000000000000",
+ "0x662334814724935b7931ddca6100e00d467727cd": "637000000000000000000",
+ "0x2c52c984102ee0cd3e31821b84d408930efa1ac7": "2000000000000000000000",
+ "0x000d836201318ec6899a67540690382780743280": "200000000000000000000",
+ "0x81498ca07b0f2f17e8bbc7e61a7f4ae7be66b78b": "101600000000000000000",
+ "0x7860a3de38df382ae4a4dce18c0c07b98bce3dfa": "1000000000000000000000",
+ "0x5e8e4df18cf0af770978a8df8dac90931510a679": "2000000000000000000000",
+ "0x05d68dad61d3bbdfb3f779265c49474aff3fcd30": "39399000000000000000",
+ "0x96eafbf2fb6f4db9a436a74c45b5654452e23819": "20000000000000000000",
+ "0xd7d7f2caa462a41b3b30a34aeb3ba61010e2626f": "2000000000000000000000",
+ "0x0b71f554122469ef978e2f1fefd7cbb410982772": "3880000000000000000000",
+ "0x504666ce8931175e11a5ed11c1dcaa06e57f4e66": "11792000000000000000000",
+ "0xd00f067286c0fbd082f9f4a61083ec76deb3cee6": "1000000000000000000000",
+ "0x02e4cb22be46258a40e16d4338d802fffd00c151": "379786000000000000000",
+ "0x1c13d38637b9a47ce79d37a86f50fb409c060728": "1337000000000000000000",
+ "0xe30212b2011bb56bdbf1bc35690f3a4e0fd905ea": "8022000000000000000000",
+ "0x1df6911672679bb0ef3509038c0c27e394fdfe30": "540000000000000000000",
+ "0x2b8fe4166e23d11963c0932b8ade8e0145ea0770": "43250000000000000000000",
+ "0x6509eeb1347e842ffb413e37155e2cbc738273fd": "2000000000000000000000",
+ "0x8b7e9f6f05f7e36476a16e3e7100c9031cf404af": "1000000000000000000000",
+ "0xbec8caf7ee49468fee552eff3ac5234eb9b17d42": "2000000000000000000000",
+ "0x38898bbb4553e00bbfd0cf268b2fc464d154add5": "320000000000000000000",
+ "0xcbb3189e4bd7f45f178b1c30c76e26314d4a4b0a": "295007000000000000000",
+ "0xbe1cd7f4c472070968f3bde268366b21eeea8321": "4300000000000000000000",
+ "0x976a18536af41874426308871bcd1512a775c9f8": "10000000000000000000000",
+ "0xe9c758f8da41e3346e4350e5ac3976345c6c1082": "1930050000000000000000",
+ "0x64ec8a5b743f3479e707dae9ee20ddaa4f40f1d9": "200000000000000000000",
+ "0x9e01765aff08bc220550aca5ea2e1ce8e5b09923": "1000000000000000000000",
+ "0xba0f39023bdb29eb1862a9f9059cab5d306e662f": "2000000000000000000000",
+ "0x2baf8d6e221174124820ee492b9459ec4fadafbb": "2000000000000000000000",
+ "0x655d5cd7489629e2413c2105b5a172d933c27af8": "4040060000000000000000",
+ "0xbadc2aef9f5951a8d78a6b35c3d0b3a4e6e2e739": "6000000000000000000000",
+ "0xe64f6e1d6401b56c076b64a1b0867d0b2f310d4e": "51570000000000000000",
+ "0x7a8563867901206f3f2bf0fa3e1c8109cabccd85": "137000000000000000000",
+ "0xd17fbe22d90462ed37280670a2ea0b3086a0d6d6": "199955000000000000000",
+ "0xe96d7d4cdd15553a4e4d316d6d6480ca3cea1e38": "12200000000000000000000",
+ "0xf04d2c91efb6e9c45ffbe74b434c8c5f2b028f1f": "1000000000000000000000",
+ "0x81164deb10814ae08391f32c08667b6248c27d7a": "394000000000000000000",
+ "0x7f5ae05ae0f8cbe5dfe721f044d7a7bef4c27997": "60000000000000000000",
+ "0xc982586d63b0d74c201b1af8418372e30c7616be": "100000000000000000000",
+ "0x64cf0935bf19d2cebbecd8780d27d2e2b2c34166": "1970000000000000000000",
+ "0xcd566ad7b883f01fd3998a9a58a9dee4724ddca5": "58848000000000000000",
+ "0x9da609fa3a7e6cf2cc0e70cdabe78dc4e382e11e": "1200000000000000000000",
+ "0x0d69100c395ce6c5eaadf95d05d872837ededd21": "400000000000000000000",
+ "0xfe91eccf2bd566afa11696c5049fa84c69630a52": "1940000000000000000000",
+ "0x005d0ee8155ec0a6ff6808552ca5f16bb5be323a": "197000000000000000000",
+ "0x3e5cb8928c417825c03a3bfcc52183e5c91e42d7": "4264790000000000000000",
+ "0x9c1b771f09af882af0643083de2aa79dc097c40e": "2480000000000000000000",
+ "0xeba388b0da27c87b1cc0eac6c57b2c5a0b459c1a": "6800000000000000000000",
+ "0x7529f3797bb6a20f7ea6492419c84c867641d81c": "2000000000000000000000",
+ "0x532a7da0a5ad7407468d3be8e07e69c7dd64e861": "500000000000000000000",
+ "0xde82cc8d4a1bb1d9434392965b3e80bad3c03d4f": "1477500000000000000000",
+ "0x4a82694fa29d9e213202a1a209285df6e745c209": "4000000000000000000000",
+ "0x3e53ff2107a8debe3328493a92a586a7e1f49758": "23143470000000000000000",
+ "0xb2ddb786d3794e270187d0451ad6c8b79e0e8745": "400000000000000000000",
+ "0x6ebcf9957f5fc5e985add475223b04b8c14a7aed": "1730000000000000000000",
+ "0xc5c7590b5621ecf8358588de9b6890f2626143f1": "3000000000000000000000",
+ "0xae4f122e35c0b1d1e4069291457c83c07f965fa3": "1000000000000000000000",
+ "0x47885ababedf4d928e1c3c71d7ca40d563ed595f": "1820000000000000000000",
+ "0x78ce3e3d474a8a047b92c41542242d0a08c70f99": "10000000000000000000000",
+ "0x6134d942f037f2cc3d424a230c603d67abd3edf7": "2000000000000000000000",
+ "0x1360e87df24c69ee6d51c76e73767ffe19a2131c": "92000000000000000000",
+ "0x5fd1c3e31778276cb42ea740f5eae9c641dbc701": "194000000000000000000",
+ "0x98397342ec5f3d4cb877e54ef5d6f1d366731bd4": "5910000000000000000000",
+ "0x6d4b5c05d06a20957e1748ab6df206f343f92f01": "10020475000000000000000",
+ "0xe6115b13f9795f7e956502d5074567dab945ce6b": "100000000000000000000000",
+ "0x23730c357a91026e44b1d0e2fc2a51d071d8d77b": "4000000000000000000000",
+ "0xfae881937047895a660cf229760f27e66828d643": "182000000000000000000",
+ "0xff3ef6ba151c21b59986ae64f6e8228bc9a2c733": "2000000000000000000000",
+ "0xdfbd4232c17c407a980db87ffbcda03630e5c459": "553150000000000000000",
+ "0x4429a29fee198450672c0c1d073162250bec6474": "999200000000000000000",
+ "0x7e8f96cc29f57b0975120cb593b7dd833d606b53": "197000000000000000000",
+ "0x5ed3f1ebe2ae6756b5d8dc19cad02c419aa5778b": "0",
+ "0xdaa776a6754469d7b9267a89b86725e740da0fa0": "1970000000000000000000",
+ "0x139e479764b499d666208c4a8a047a97043163dd": "598880000000000000000",
+ "0x5ad5e420755613886f35aa56ac403eebdfe4b0d0": "80000000000000000000000",
+ "0x3fe801e61335c5140dc7eda2ef5204460a501230": "2000000000000000000000",
+ "0xce8a6b6d5033b1498b1ffeb41a41550405fa03a2": "4000000000000000000000",
+ "0x26c2ffc30efdc5273e76183a16c2698d6e531286": "776000000000000000000",
+ "0x71ec3aec3f8f9221f9149fede06903a0f9a232f2": "200000000000000000000",
+ "0xef35f6d4b1075e6aa139151c974b2f4658f70538": "1111111000000000000000",
+ "0x26a68eab905a8b3dce00e317308225dab1b9f6b8": "1980000000000000000000",
+ "0x63f5b53d79bf2e411489526530223845fac6f601": "30000000000000000000000",
+ "0x481115296ab7db52492ff7b647d63329fb5cbc6b": "16100000000000000000000",
+ "0xf19f193508393e4d2a127b20b2031f39c82581c6": "3500088000000000000000",
+ "0x500e34cde5bd9e2b71bb92d7cf55eee188d5fa0c": "5348000000000000000000",
+ "0x65ea67ad3fb56ad5fb94387dd38eb383001d7c68": "100000000000000000000",
+ "0x7f9f9b56e4289dfb58e70fd5f12a97b56d35c6a5": "1970000000000000000000",
+ "0x60be6f953f2a4d25b6256ffd2423ac1438252e4e": "150000000000000000000",
+ "0xac1dfc984b71a19929a81d81f04a7cbb14073703": "600000000000000000000",
+ "0xa3c14ace28b192cbb062145fcbbd5869c67271f6": "8000000000000000000000",
+ "0x2da76b7c39b420e388ba2c1020b0856b0270648a": "2000000000000000000000",
+ "0x622be4b45495fcd93143efc412d699d6cdc23dc5": "17300000000000000000",
+ "0xd3f873bd9956135789ab00ebc195b922e94b259d": "2000000000000000000000",
+ "0x975f3764e97bbccf767cbd3b795ba86d8ba9840e": "346000000000000000000",
+ "0xfc39be41094b1997d2169e8264c2c3baa6c99bc4": "2000000000000000000000",
+ "0x12ffc1128605cb0c13709a7290506f2690977193": "3340000000000000000000",
+ "0x9b1168de8ab64b47552f3389800a9cc08b4666cf": "1730000000000000000000",
+ "0x9f1aa8fcfc89a1a5328cbd6344b71f278a2ca4a0": "500000000000000000000",
+ "0x505a33a18634dd4800693c67f48a1d693d4833f8": "7252000000000000000000",
+ "0xd08fc09a0030fd0928cd321198580182a76aae9f": "1000000000000000000000",
+ "0x6acddca3cd2b4990e25cd65c24149d0912099e79": "3000037000000000000000",
+ "0x397a6ef8763a18f00fac217e055c0d3094101011": "2000000000000000000000",
+ "0x4e0bd32473c4c51bf25654def69f797c6b29a232": "1600930000000000000000",
+ "0x28d8c35fb7eea622582135e3ad47a227c9a663bd": "18200000000000000000",
+ "0xf96488698590dc3b2c555642b871348dfa067ad5": "500000000000000000000",
+ "0x4eebe80cb6f3ae5904f6f4b28d907f907189fcab": "1999944000000000000000",
+ "0x8d1abd897dacd4312e18080c88fb9647eab44052": "216000000000000000000",
+ "0x457029c469c4548d168cec3e65872e4428d42b67": "2000000000000000000000",
+ "0x1296acded1e063af39fe8ba0b4b63df789f70517": "100014000000000000000",
+ "0x71762c63678c18d1c6378ce068e666381315147e": "2000000000000000000000",
+ "0x6cc1c878fa6cde8a9a0b8311247e741e4642fe6d": "985000000000000000000",
+ "0x8d9ed7f4553058c26f7836a3802d3064eb1b363d": "90000000000000000000",
+ "0x5032e4bcf7932b49fdba377b6f1499636513cfc3": "100000000000000000000",
+ "0x462b678b51b584f3ed7ada070b5cd99c0bf7b87f": "100000000000000000000",
+ "0xc8aa49e3809f0899f28ab57e6743709d58419033": "880000000000000000000",
+ "0x01b1cae91a3b9559afb33cdc6d689442fdbfe037": "200000000000000000000",
+ "0xb1043004ec1941a8cf4f2b00b15700ddac6ff17e": "1000000000000000000000",
+ "0x5ba2c6c35dfaec296826591904d544464aeabd5e": "20000000000000000000",
+ "0xb32400fd13c5500917cb037b29fe22e7d5228f2d": "40000000000000000000000",
+ "0xd59d92d2c8701980cc073c375d720af064743c0c": "19000000000000000000000",
+ "0x11dd6185d9a8d73ddfdaa71e9b7774431c4dfec2": "1000000000000000000000",
+ "0xd4cb21e590c5a0e06801366aff342c7d7db16424": "494000000000000000000",
+ "0x5b6d55f6712967405c659129f4b1de09acf2cb7b": "267400000000000000000",
+ "0x6179979907fe7f037e4c38029d60bcbab832b3d6": "1610000000000000000000",
+ "0x33c407133b84b3ca4c3ded1f4658900c38101624": "2800000000000000000000",
+ "0xcd2a36d753e9e0ed012a584d716807587b41d56a": "261400000000000000000",
+ "0x8155fa6c51eb31d808412d748aa086105018122f": "1880000000000000000000",
+ "0x3ecc8e1668dde995dc570fe414f44211c534a615": "2000000000000000000000",
+ "0xd6395db5a4bb66e60f4cfbcdf0057bb4d97862e2": "910000000000000000000",
+ "0xb6fb39786250081426a342c70d47ee521e5bc563": "15000000000000000000000",
+ "0x510eda5601499a0d5e1a006bfffd833672f2e267": "2000000000000000000000",
+ "0x98c19dba810ba611e68f2f83ee16f6e7744f0c1f": "200000000000000000000",
+ "0x34ff26eb60a8d1a95a489fae136ee91d4e58084c": "600000000000000000000",
+ "0x6ad90be252d9cd464d998125fab693060ba8e429": "4000000000000000000000",
+ "0x038323b184cff7a82ae2e1bda7793fe4319ca0bf": "20000000000000000000000",
+ "0xdc5305b4020a06b49d657c7ca34c35c91c5f2c56": "7045990000000000000000",
+ "0xc9c80dc12e7bab86e949d01e4c3ed35f2b9bba5f": "2000000000000000000000",
+ "0x7beb81fb2f5e91526b2ac9795e76c69bcff04bc0": "69400000000000000000000",
+ "0xb8bc9bca7f71b4ed12e620438d620f53c114342f": "500000000000000000000",
+ "0xd288e7cb7ba9f620ab0f7452e508633d1c5aa276": "4000000000000000000000",
+ "0xa2e460a989cb15565f9ecca7d121a18e4eb405b6": "2000000000000000000000",
+ "0x7489cc8abe75cda4ef0d01cef2605e47eda67ab1": "133700000000000000000",
+ "0x38b403fb1fb7c14559a2d6f6564a5552bca39aff": "2000000000000000000000",
+ "0xe55c80520a1b0f755b9a2cd3ce214f7625653e8a": "2000000000000000000000",
+ "0x451b7070259bdba27100e36e23428a53dfe304e9": "13370000000000000000",
+ "0x8b5c914b128bf1695c088923fa467e7911f351fa": "98500000000000000000",
+ "0x17df49518d73b129f0da36b1c9b40cb66420fdc7": "10000000000000000000000",
+ "0xc1950543554d8a713003f662bb612c10ad4cdf21": "18200000000000000000",
+ "0xfa7606435b356cee257bd2fcd3d9eacb3cd1c4e1": "100000000000000000000",
+ "0xe0bad98eee9698dbf6d76085b7923de5754e906d": "167000000000000000000",
+ "0xce53c8cdd74296aca987b2bc19c2b875a48749d0": "3000000000000000000000",
+ "0xd0c55abf976fdc3db2afe9be99d499484d576c02": "1000000000000000000000",
+ "0x238a6b7635252f5244486c0af0a73a207385e039": "1370000000000000000000",
+ "0xceb389381d48a8ae4ffc483ad0bb5e204cfdb1ec": "740745000000000000000",
+ "0x3847667038f33b01c1cc795d8daf5475eff5a0d4": "728330000000000000000",
+ "0xa08d215b5b6aac4861a281ac7e400b78fef04cbf": "20000000000000000000",
+ "0x2d0dec51a6e87330a6a8fa2a0f65d88d4abcdf73": "185000000000000000000",
+ "0x9e8f64ddcde9b8b451bafaa235a9bf511a25ac91": "2674000000000000000000",
+ "0xddac6bf4bbdd7d597d9c686d0695593bedccc7fa": "865000000000000000000",
+ "0x22e15158b5ee3e86eb0332e3e6a9ac6cd9b55ecd": "160000000000000000000",
+ "0x3aea4e82d2400248f99871a41ca257060d3a221b": "1000000000000000000000",
+ "0xfb126f0ec769f49dcefca2f200286451583084b8": "5013750000000000000000",
+ "0x1b8bd6d2eca20185a78e7d98e8e185678dac4830": "16700000000000000000000",
+ "0x664cd67dccc9ac8228b45c55db8d76550b659cdc": "394000000000000000000",
+ "0x553f37d92466550e9fd775ae74362df030179132": "2000000000000000000000",
+ "0x730d8763c6a4fd824ab8b859161ef7e3a96a1200": "20000000000000000000000",
+ "0x04c2c64bb54c3eccd05585e10ec6f99a0cdb01a3": "100000000000000000000",
+ "0xf1624d980b65336feac5a6d54125005cfcf2aacb": "2000000000000000000000",
+ "0x0b7fc9ddf70576f6330669eaaa71b6a831e99528": "140000000000000000000",
+ "0xfa2bbca15d3fe39f8a328e91f90da14f7ac6253d": "200000000000000000000",
+ "0x07feef54c136850829badc4b49c3f2a73c89fb9e": "118200000000000000000",
+ "0x3703350c4d6fe337342cddc65bf1e2386bf3f9b2": "2020000000000000000000",
+ "0x6d7d1c949511f88303808c60c5ea0640fcc02683": "10000000000000000000000",
+ "0x34fa7792bad8bbd7ff64056214a33eb6600c1ea8": "50000000000000000000",
+ "0x994cc2b5227ec3cf048512467c41b7b7b748909f": "2000000000000000000000",
+ "0x08da3a7a0f452161cfbcec311bb68ebfdee17e88": "2000000000000000000000",
+ "0xbbb4ee1d82f2e156442cc93338a2fc286fa28864": "1370000000000000000000",
+ "0x7a2dfc770e24368131b7847795f203f3d50d5b56": "11400000000000000000000",
+ "0x7cef4d43aa417f9ef8b787f8b99d53f1fea1ee88": "1910000000000000000000",
+ "0xc6a30ef5bb3320f40dc5e981230d52ae3ac19322": "182000000000000000000",
+ "0x6a74844d8e9cb5581c45079a2e94462a6cee8821": "1082970000000000000000",
+ "0xc3110be01dc9734cfc6e1ce07f87d77d1345b7e1": "4999998000000000000000",
+ "0xaeb916ebf49d0f86c13f7331cef19e129937512d": "599908000000000000000",
+ "0x3e5abd09ce5af7ba8487c359e0f2a93a986b0b18": "10000000000000000000000",
+ "0xcdd60d73efaad873c9bbfb178ca1b7105a81a681": "32000000000000000000",
+ "0x31eb123c95c82bf685ace7a75a1881a289efca10": "920034000000000000000",
+ "0x86e8670e27598ea09c3899ab7711d3b9fe901c17": "200000000000000000000",
+ "0xa144f6b60f72d64a21e330dadb62d8990ade2b09": "1000000000000000000000",
+ "0x68883e152e5660fee59626e7e3b4f05110e6222f": "54683300000000000000000",
+ "0xfe4249127950e2f896ec0e7e2e3d055aab10550f": "668500000000000000000",
+ "0x403d53cf620f0922b417848dee96c190b5bc8271": "9850000000000000000000",
+ "0xbec2e6de39c07c2bae556acfbee2c4728b9982e3": "573000000000000000000",
+ "0xf3c4716d1ee5279a86d0163a14618181e16136c7": "1000000000000000000000",
+ "0xe38ef28a5ed984a7db24a1ae782dfb87f397dfc6": "143000000000000000000",
+ "0x30fbe5885f9fcce9ea5edb82ed4a1196dd259aed": "5200000000000000000000",
+ "0x48bf14d7b1fc84ebf3c96be12f7bce01aa69b03e": "120000000000000000000",
+ "0xb8d5c324a8209d7c8049d0d4aede02ba80ab578b": "16889329000000000000000",
+ "0x43d5a71ce8b8f8ae02b2eaf8eaf2ca2840b93fb6": "6000000000000000000000",
+ "0xf9a59c3cc5ffacbcb67be0fc7256f64c9b127cb4": "2000000000000000000000",
+ "0x0e21af1b8dbf27fcf63f37e047b87a825cbe7c27": "3000000000000000000000",
+ "0x1c35aab688a0cd8ef82e76541ba7ac39527f743b": "500000000000000000000",
+ "0x91ac5cfe67c54aa7ebfba448666c461a3b1fe2e1": "401880000000000000000",
+ "0x4ba53ab549e2016dfa223c9ed5a38fad91288d07": "1400000000000000000000",
+ "0x99a4de19ded79008cfdcd45d014d2e584b8914a8": "1500000000000000000000",
+ "0x4adbf4aae0e3ef44f7dd4d8985cfaf096ec48e98": "150000000000000000000",
+ "0x9a633fcd112cceeb765fe0418170732a9705e79c": "18200000000000000000",
+ "0x292f228b0a94748c8eec612d246f989363e08f08": "185000000000000000000",
+ "0x9f3497f5ef5fe63095836c004eb9ce02e9013b4b": "633424000000000000000",
+ "0x0e6dfd553b2e873d2aec15bd5fbb3f8472d8d394": "12000000000000000000000",
+ "0x74ebf4425646e6cf81b109ce7bf4a2a63d84815f": "40000000000000000000",
+ "0x8ce5e3b5f591d5eca38abf228f2e3c35134bdac0": "2319920000000000000000",
+ "0x90c41eba008e20cbe927f346603fc88698125969": "42000000000000000000",
+ "0x382ba76db41b75606dd48a48f0137e9174e031b6": "20000000000000000000",
+ "0x5d24bdbc1c47f0eb83d128cae48ac33c4817e91f": "1000000000000000000000",
+ "0xa64e5ffb704c2c9139d77ef61d8cdfa31d7a88e9": "143000000000000000000",
+ "0xa18360e985f2062e8f8efe02ad2cbc91ad9a5aad": "3000000000000000000000",
+ "0xd251f903ae18727259eee841a189a1f569a5fd76": "10000000000000000000000",
+ "0xefa6b1f0db603537826891b8b4bc163984bb40cd": "985000000000000000000",
+ "0x47fff42c678551d141eb75a6ee398117df3e4a8d": "100010000000000000000",
+ "0xf2294adbb6f0dcc76e632ebef48ab49f124dbba4": "1443690000000000000000",
+ "0x53700d53254d430f22781a4a76a463933b5d6b08": "1970000000000000000000",
+ "0xb14a7aaa8f49f2fb9a8102d6bbe4c48ae7c06fb2": "8000000000000000000000",
+ "0x9ed4e63f526542d44fddd34d59cd25388ffd6bda": "3885000000000000000000",
+ "0x4cac91fb83a147d2f76c3267984b910a79933348": "2167000000000000000000",
+ "0x9b32cf4f5115f4b34a00a64c617de06387354323": "105501000000000000000",
+ "0xb8bedd576a4b4c2027da735a5bc3f533252a1808": "2000000000000000000000",
+ "0xc5a3b98e4593fea0b38c4f455a5065f051a2f815": "20309030000000000000000",
+ "0xeaf52388546ec35aca6f6c6393d8d609de3a4bf3": "20000000000000000000",
+ "0x4c423c76930d07f93c47a5cc4f615745c45a9d72": "100000000000000000000",
+ "0x9052f2e4a3e3c12dd1c71bf78a4ec3043dc88b7e": "267400000000000000000",
+ "0x2bade91d154517620fd4b439ac97157a4102a9f7": "4000000000000000000000",
+ "0xda698d64c65c7f2b2c7253059cd3d181d899b6b7": "295500000000000000000",
+ "0xc6d8954e8f3fc533d2d230ff025cb4dce14f3426": "400000000000000000000",
+ "0x349a816b17ab3d27bbc0ae0051f6a070be1ff29d": "10000000000000000000000",
+ "0xff4d9c8484c43c42ff2c5ab759996498d323994d": "4000000000000000000000",
+ "0x22944fbca9b57963084eb84df7c85fb9bcdfb856": "4649845000000000000000",
+ "0xbfd93c90c29c07bc5fb5fc49aeea55a40e134f35": "28000000000000000000000",
+ "0x3caedb5319fe806543c56e5021d372f71be9062e": "40000000000000000000000",
+ "0x9a079c92a629ca15c8cafa2eb28d5bc17af82811": "500000000000000000000",
+ "0x7d2a52a7cf0c8436a8e007976b6c26b7229d1e15": "438040000000000000000",
+ "0xcf89f7460ba3dfe83c5a1d3a019ee1250f242f0f": "985177000000000000000",
+ "0x577bfe64e3a1e3800e94db1c6c184d8dc8aafc66": "1498000000000000000000",
+ "0x7ffd02ed370c7060b2ae53c078c8012190dfbb75": "10000000000000000000000",
+ "0x90b62f131a5f29b45571513ee7a74a8f0b232202": "158000000000000000000",
+ "0x6e8212b722afd408a7a73ed3e2395ee6454a0330": "159000000000000000000",
+ "0x515f30bc90cdf4577ee47d65d785fbe2e837c6bc": "10166128000000000000000",
+ "0xc27376f45d21e15ede3b26f2655fcee02ccc0f2a": "20000000000000000000",
+ "0x3da39ce3ef4a7a3966b32ee7ea4ebc2335a8f11f": "2000000000000000000000",
+ "0x25259d975a21d83ae30e33f800f53f37dfa01938": "20000000000000000000",
+ "0x8ed143701f2f72280fd04a7b4164281979ea87c9": "14000000000000000000",
+ "0x5ac99ad7816ae9020ff8adf79fa9869b7cea6601": "21000000000000000000000",
+ "0xf51fded80acb502890e87369741f3722514cefff": "20000042000000000000000",
+ "0xf657fcbe682eb4e8db152ecf892456000b513d15": "1940000000000000000000",
+ "0x62c37c52b97f4b040b1aa391d6dec152893c4707": "1000000000000000000000",
+ "0x89fc8e4d386b0d0bb4a707edf3bd560df1ad8f4e": "2955000000000000000000",
+ "0x53c0bb7fc88ea422d2ef7e540e2d8f28b1bb8183": "20000000000000000000",
+ "0x56f493a3d108aaa2d18d98922f8efe1662cfb73d": "2020000000000000000000",
+ "0xe9458f68bb272cb5673a04f781b403556fd3a387": "61000000000000000000",
+ "0xbe525a33ea916177f17283fca29e8b350b7f530b": "2638000000000000000000",
+ "0x4feb846be43041fd6b34202897943e3f21cb7f04": "83226000000000000000",
+ "0x15aa530dc36958b4edb38eee6dd9e3c77d4c9145": "2000000000000000000000",
+ "0x2458d6555ff98a129cce4037953d00206eff4287": "197000000000000000000",
+ "0x8035fe4e6b6af27ae492a578515e9d39fa6fa65b": "4000000000000000000000",
+ "0x296b71c0015819c242a7861e6ff7eded8a5f71e3": "1999800000000000000000",
+ "0x8f1952eed1c548d9ee9b97d0169a07933be69f63": "1000000000000000000000",
+ "0xa421dbb89b3a07419084ad10c3c15dfe9b32d0c2": "20000000000000000000000",
+ "0x554336ee4ea155f9f24f87bca9ca72e253e12cd2": "100000000000000000000",
+ "0xffc5fc4b7e8a0293ff39a3a0f7d60d2646d37a74": "2000000000000000000000",
+ "0xea2c197d26e98b0da83e1b72c787618c979d3db0": "19700000000000000000",
+ "0x96aa573fed2f233410dbae5180145b23c31a02f0": "1730000000000000000000",
+ "0xc23b2f921ce4a37a259ee4ad8b2158d15d664f59": "25403000000000000000",
+ "0xd874b9dfae456a929ba3b1a27e572c9b2cecdfb3": "170000000000000000000",
+ "0xbf8b8005d636a49664f74275ef42438acd65ac91": "200000000000000000000",
+ "0x441a52001661fac718b2d7b351b7c6fb521a7afd": "400000000000000000000",
+ "0x812a55c43caedc597218379000ce510d548836fd": "18200000000000000000",
+ "0x5e90c85877198756b0366c0e17b28e52b446505a": "374288000000000000000",
+ "0xda3017c150dd0dce7fcf881b0a48d0d1c756c4c7": "100014000000000000000",
+ "0x6baf7a2a02ae78801e8904ad7ac05108fc56cff6": "1000000000000000000000",
+ "0x177dae78bc0113d8d39c4402f2a641ae2a105ab8": "1818320000000000000000",
+ "0x01b5b5bc5a117fa08b34ed1db9440608597ac548": "200000000000000000000",
+ "0xaae732eda65988c3a00c7f472f351c463b1c968e": "2000000000000000000000",
+ "0xd95342953c8a21e8b635eefac7819bea30f17047": "94160000000000000000000",
+ "0x8d616b1eee77eef6f176e0698db3c0c141b2fc8f": "500000000000000000000",
+ "0x12d20790b7d3dbd88c81a279b812039e8a603bd0": "1604400000000000000000",
+ "0x3734cb187491ede713ae5b3b2d12284af46b8101": "3000000000000000000000",
+ "0xdd967c4c5f8ae47e266fb416aad1964ee3e7e8c3": "7750000000000000000000",
+ "0x3dcef19c868b15d34eda426ec7e04b18b6017002": "1999800000000000000000",
+ "0xce9d21c692cd3c01f2011f505f870036fa8f6cd2": "400000000000000000000",
+ "0xd44f6ac3923b5fd731a4c45944ec4f7ec52a6ae4": "10000000000000000000000",
+ "0xb424d68d9d0d00cec1938c854e15ffb880ba0170": "200000000000000000000",
+ "0x1f2186ded23e0cf9521694e4e164593e690a9685": "300000000000000000000",
+ "0x7f4b5e278578c046cceaf65730a0e068329ed5b6": "1880000000000000000000",
+ "0x8c50aa2a9212bcde56418ae261f0b35e7a9dbb82": "400000000000000000000",
+ "0x1953313e2ad746239cb2270f48af34d8bb9c4465": "2000000000000000000000",
+ "0xa15025f595acdbf3110f77c5bf24477e6548f9e8": "2000000000000000000000",
+ "0x53af32c22fef99803f178cf90b802fb571c61cb9": "3880000000000000000000",
+ "0xd0a8abd80a199b54b08b65f01d209c27fef0115b": "6525979000000000000000",
+ "0x2b68306ba7f8daaf73f4c644ef7d2743c0f26856": "864800000000000000000",
+ "0x96924191b7df655b3319dc6d6137f481a73a0ff3": "4020000000000000000000",
+ "0x6fa72015fa78696efd9a86174f7f1f21019286b1": "1337000000000000000000",
+ "0x0b119df99c6b8de58a1e2c3f297a6744bf552277": "2000000000000000000000",
+ "0x61733947fab820dbd351efd67855ea0e881373a0": "20000000000000000000",
+ "0x8ae6f80b70e1f23c91fbd5a966b0e499d95df832": "197000000000000000000",
+ "0x01a7d9fa7d0eb1185c67e54da83c2e75db69e39f": "7623900000000000000000",
+ "0x9932ef1c85b75a9b2a80057d508734c51085becc": "50170000000000000000",
+ "0xaefcfe88c826ccf131d54eb4ea9eb80e61e1ee25": "340000000000000000000",
+ "0xc21fa6643a1f14c02996ad7144b75926e87ecb4b": "20000000000000000000000",
+ "0x97d9e46a7604d7b5a4ea4ee61a42b3d2350fc3ed": "2000000000000000000000",
+ "0x3cafaf5e62505615068af8eb22a13ad8a9e55070": "1999600000000000000000",
+ "0x22f2dcff5ad78c3eb6850b5cb951127b659522e6": "13700000000000000000",
+ "0xaaad1baade5af04e2b17439e935987bf8c2bb4b9": "2000000000000000000000",
+ "0x298887bab57c5ba4f0615229d7525fa113b7ea89": "40000000000000000000",
+ "0x7539333046deb1ef3c4daf50619993f444e1de68": "1182000000000000000000",
+ "0x9752d14f5e1093f071711c1adbc4e3eb1e5c57f3": "2000000000000000000000",
+ "0xed641e06368fb0efaa1703e01fe48f4a685309eb": "200000000000000000000",
+ "0xd0ee4d02cf24382c3090d3e99560de3678735cdf": "2400000000000000000000",
+ "0x47e25df8822538a8596b28c637896b4d143c351d": "80500000000000000000000",
+ "0x559706c332d20779c45f8a6d046a699159b74921": "380123000000000000000",
+ "0x3a4da78dce05aeb87de9aead9185726da1926798": "200000000000000000000",
+ "0x3041445a33ba158741160d9c344eb88e5c306f94": "60000000000000000000",
+ "0x08d4311c9c1bbaf87fabe1a1d01463828d5d98ce": "90000000000000000000000",
+ "0x6bd3e59f239fafe4776bb9bddd6bee83ba5d9d9f": "1000000000000000000000",
+ "0x29eaae82761762f4d2db53a9c68b0f6b0b6d4e66": "2000000000000000000000",
+ "0x0b7d339371e5be6727e6e331b5821fa24bdb9d5a": "857738000000000000000",
+ "0x4714cfa4f46bd6bd70737d75878197e08f88e631": "11792000000000000000000",
+ "0xad92ca066edb7c711dfc5b166192d1edf8e77185": "36000000000000000000000",
+ "0xf97b56ebd5b77abc9fbacbabd494b9d2c221cd03": "1970000000000000000000",
+ "0x591bef3171d1c5957717a4e98d17eb142c214e56": "20000000000000000000000",
+ "0x899b3c249f0c4b81df75d212004d3d6d952fd223": "2000000000000000000000",
+ "0xa819d2ece122e028c8e8a04a064d02b9029b08b9": "1000000000000000000000",
+ "0xe341642d40d2afce2e9107c67079ac7a2660086c": "400000000000000000000",
+ "0x0329188f080657ab3a2afa522467178279832085": "216700000000000000000",
+ "0x03317826d1f70aa4bddfa09be0c4105552d2358b": "38800000000000000000",
+ "0x3ac9dc7a436ae98fd01c7a9621aa8e9d0b8b531d": "1790000000000000000000",
+ "0x93c88e2d88621e30f58a9586bed4098999eb67dd": "31200000000000000000000",
+ "0xcd1e66ed539dd92fc40bbaa1fa16de8c02c14d45": "230000000000000000000",
+ "0xe6c81ffcecb47ecdc55c0b71e4855f3e5e97fc1e": "334250000000000000000",
+ "0x50f8fa4bb9e2677c990a4ee8ce70dd1523251e4f": "26030000000000000000",
+ "0x4f64a85e8e9a40498c0c75fceb0337fb49083e5e": "1000000000000000000000",
+ "0x4b29437c97b4a844be71cca3b648d4ca0fdd9ba4": "150200000000000000000",
+ "0x1eee6cbee4fe96ad615a9cf5857a647940df8c78": "19400000000000000000",
+ "0x29f0edc60338e7112085a1d114da8c42ce8f55d6": "2958000000000000000000",
+ "0x23b1c4917fbd93ee3d48389306957384a5496cbf": "4000086000000000000000",
+ "0x1767525c5f5a22ed80e9d4d7710f0362d29efa33": "400000000000000000000",
+ "0x3064899a963c4779cbf613cd6980846af1e6ec65": "6999908000000000000000",
+ "0x68531f4dda808f5320767a03113428ca0ce2f389": "19400000000000000000",
+ "0x1db9ac9a9eaeec0a523757050c71f47278c72d50": "1337000000000000000000",
+ "0x7592c69d067b51b6cc639d1164d5578c60d2d244": "20000000000000000000",
+ "0xcf3fbfa1fd32d7a6e0e6f8ef4eab57be34025c4c": "1063120000000000000000",
+ "0x8efec058cc546157766a632775404a334aaada87": "1999000000000000000000",
+ "0xfaf5f0b7b6d558f5090d9ea1fb2d42259c586078": "6401000000000000000000",
+ "0x19ecf2abf40c9e857b252fe1dbfd3d4c5d8f816e": "2000000000000000000000",
+ "0x6e8a26689f7a2fdefd009cbaaa5310253450daba": "2049982000000000000000",
+ "0xe2f40d358f5e3fe7463ec70480bd2ed398a7063b": "20000000000000000000",
+ "0xfa19d6f7a50f4f079893d167bf14e21d0073d196": "530000000000000000000",
+ "0x3e2ca0d234baf607ad466a1b85f4a6488ef00ae7": "89505000000000000000",
+ "0xf8a49ca2390c1f6d5c0e62513b079571743f7cc6": "3000000000000000000000",
+ "0x5d3f3b1f7130b0bb21a0fd32396239179a25657f": "62474000000000000000000",
+ "0xf332c0f3e05a27d9126fd0b641a8c2d4060608fd": "5001041000000000000000",
+ "0xe304a32f05a83762744a9542976ff9b723fa31ea": "1576256000000000000000",
+ "0xf768f321fd6433d96b4f354d3cc1652c1732f57f": "10000000000000000000000",
+ "0x147af46ae9ccd18bb35ca01b353b51990e49dce1": "4000000000000000000000",
+ "0x21eae6feffa9fbf4cd874f4739ace530ccbe5937": "5000000000000000000000",
+ "0x6994fb3231d7e41d491a9d68d1fa4cae2cc15960": "4000000000000000000000",
+ "0x51126446ab3d8032557e8eba65597d75fadc815c": "322000000000000000000",
+ "0x24daaaddf7b06bbcea9b80590085a88567682b4e": "319008000000000000000",
+ "0xcd020f8edfcf524798a9b73a640334bbf72f80a5": "133700000000000000000",
+ "0x56febf9e1003af15b1bd4907ec089a4a1b91d268": "200000000000000000000",
+ "0x3c79c863c3d372b3ff0c6f452734a7f97042d706": "176000000000000000000",
+ "0xe1203eb3a723e99c2220117ca6afeb66fa424f61": "9461996000000000000000",
+ "0x18fb09188f27f1038e654031924f628a2106703d": "2000000000000000000000",
+ "0x2eba0c6ee5a1145c1c573984963a605d880a7a20": "500000000000000000000",
+ "0x4cefbe2398e47d52e78db4334c8b697675f193ae": "4011000000000000000000",
+ "0xc02471e3fc2ea0532615a7571d493289c13c36ef": "20000000000000000000",
+ "0xba469aa5c386b19295d4a1b5473b540353390c85": "2000000000000000000000",
+ "0x7b11673cc019626b290cbdce26046f7e6d141e21": "500000000000000000000",
+ "0x26784ade91c8a83a8e39658c8d8277413ccc9954": "6000000000000000000000",
+ "0x57d3df804f2beee6ef53ab94cb3ee9cf524a18d3": "393606000000000000000",
+ "0xccae0d3d852a7da3860f0636154c0a6ca31628d4": "106560000000000000000",
+ "0xbfe3a1fc6e24c8f7b3250560991f93cba2cf8047": "80000000000000000000000",
+ "0x724ce858857ec5481c86bd906e83a04882e5821d": "3000000000000000000000",
+ "0xfb37cf6b4f81a9e222fba22e9bd24b5098b733cf": "38800000000000000000",
+ "0x9b22a80d5c7b3374a05b446081f97d0a34079e7f": "3000000000000000000000",
+ "0x0a29a8a4d5fd950075ffb34d77afeb2d823bd689": "200000000000000000000",
+ "0xd01af9134faf5257174e8b79186f42ee354e642d": "1000000000000000000000",
+ "0x7f1619988f3715e94ff1d253262dc5581db3de1c": "900000000000000000000",
+ "0x6f137a71a6f197df2cbbf010dcbd3c444ef5c925": "2000000000000000000000",
+ "0x11efb8a20451161b644a8ccebbc1d343a3bbcb52": "3200000000000000000000",
+ "0x46504e6a215ac83bccf956befc82ab5a679371c8": "518898000000000000000",
+ "0xb523fff9749871b35388438837f7e6e0dea9cb6b": "2000000000000000000000",
+ "0xc5c6a4998a33feb764437a8be929a73ba34a0764": "50000000000000000000000",
+ "0x3cd7f7c7c2353780cde081eeec45822b25f2860c": "200000000000000000000",
+ "0xb3050beff9de33c80e1fa15225e28f2c413ae313": "700000000000000000000",
+ "0x59268171b833e0aa13c54b52ccc0422e4fa03aeb": "3000000000000000000000",
+ "0x7169724ee72271c534cad6420fb04ee644cb86fe": "410164000000000000000",
+ "0x6e6d5bbbb9053b89d744a27316c2a7b8c09b547d": "909831000000000000000",
+ "0x3f3f46b75cabe37bfacc8760281f4341ca7f463d": "602709000000000000000",
+ "0x7a33834e8583733e2d52aead589bd1affb1dd256": "1000000000000000000000",
+ "0xe94ded99dcb572b9bb1dcba32f6dee91e057984e": "394000000000000000000",
+ "0x19336a236ded755872411f2e0491d83e3e00159e": "940000000000000000000",
+ "0x63ac545c991243fa18aec41d4f6f598e555015dc": "600000000000000000000",
+ "0xcfee05c69d1f29e7714684c88de5a16098e91399": "1970000000000000000000",
+ "0x77be6b64d7c733a436adec5e14bf9ad7402b1b46": "1000000000000000000000",
+ "0x233bdddd5da94852f4ade8d212885682d9076bc6": "4000000000000000000000",
+ "0x952c57d2fb195107d4cd5ca300774119dfad2f78": "2000000000000000000000",
+ "0xe237baa4dbc9926e32a3d85d1264402d54db012f": "2000000000000000000000",
+ "0xaa91237e740d25a92f7fa146faa18ce56dc6e1f3": "925000000000000000000",
+ "0x2339e9492870afea2537f389ac2f838302a33c06": "2000000000000000000000",
+ "0x1d45586eb803ca2190650bf748a2b174312bb507": "1400000000000000000000",
+ "0xc61446b754c24e3b1642d9e51765b4d3e46b34b6": "2000000000000000000000",
+ "0xac28b5edea05b76f8c5f97084541277c96696a4c": "1000000000000000000000",
+ "0x1a1c9a26e0e02418a5cf687da75a275c622c9440": "5000000000000000000000",
+ "0x299368609042a858d1ecdf1fc0ada5eaceca29cf": "2000000000000000000000",
+ "0x095f5a51d06f6340d80b6d29ea2e88118ad730fe": "2000200000000000000000",
+ "0x751a2ca34e7187c163d28e3618db28b13c196d26": "500000000000000000000",
+ "0x75b0e9c942a4f0f6f86d3f95ff998022fa67963b": "1490000000000000000000",
+ "0xd1b37f03cb107424e9c4dd575ccd4f4cee57e6cd": "2000000000000000000000",
+ "0x7f993ddb7e02c282b898f6155f680ef5b9aff907": "20000000000000000000000",
+ "0xa3d583a7b65b23f60b7905f3e4aa62aac87f4227": "1046779000000000000000",
+ "0x526bb533b76e20c8ee1ebf123f1e9ff4148e40be": "197000000000000000000",
+ "0x2160b4c02cac0a81de9108de434590a8bfe68735": "1970000000000000000000",
+ "0x010007394b8b7565a1658af88ce463499135d6b7": "100000000000000000000",
+ "0x64457fa33b0832506c4f7d1180dce48f46f3e0ff": "2000000000000000000000",
+ "0xb51e558eb5512fbcfa81f8d0bd938c79ebb5242b": "715000000000000000000",
+ "0x94f13f9f0836a3ee2437a84922d2984dc0f7d53b": "2999916000000000000000",
+ "0x6bd457ade051795df3f2465c3839aed3c5dee978": "999925000000000000000",
+ "0xf3dbcf135acb9dee1a489c593c024f03c2bbaece": "2000000000000000000000",
+ "0x61b902c5a673885826820d1fe14549e4865fbdc2": "334703000000000000000",
+ "0x2acc9c1a32240b4d5b2f777a2ea052b42fc1271c": "41764000000000000000000",
+ "0x6ddfef639155daab0a5cb4953aa8c5afaa880453": "1820000000000000000000",
+ "0x96ff6f509968f36cb42cba48db32f21f5676abf8": "1970000000000000000000",
+ "0xb4c8170f7b2ab536d1d9a25bdd203ae1288dc3d5": "200000000000000000000",
+ "0x78d4f8c71c1e68a69a98f52fcb45da8af56ea1a0": "2000000000000000000000",
+ "0xdec99e972fca7177508c8e1a47ac22d768acab7c": "2000000000000000000000",
+ "0xa07aa16d74aee8a9a3288d52db1551d593883297": "600000000000000000000",
+ "0xcf1169041c1745e45b172435a2fc99b49ace2b00": "31960000000000000000",
+ "0x526cb09ce3ada3672eec1deb46205be89a4b563e": "2468000000000000000000",
+ "0xee6959de2b67967b71948c891ab00d8c8f38c7dc": "118200000000000000000",
+ "0xca7ba3ff536c7e5f0e153800bd383db8312998e0": "169600000000000000000",
+ "0x1ed06ee51662a86c634588fb62dc43c8f27e7c17": "200000000000000000000",
+ "0x730447f97ce9b25f22ba1afb36df27f9586beb9b": "820000000000000000000",
+ "0xae5c9bdad3c5c8a1220444aea5c229c1839f1d64": "477500000000000000000",
+ "0xa38306cb70baa8e49186bd68aa70a83d242f2907": "2000000000000000000000",
+ "0x71213fca313404204ecba87197741aa9dfe96338": "60000000000000000000",
+ "0x10e390ad2ba33d82b37388d09c4544c6b0225de5": "200000000000000000000",
+ "0x3b6e814f770748a7c3997806347605480a3fd509": "2000000000000000000000",
+ "0xfd452c3969ece3801c542020f1cdcaa1c71ed23d": "100000000000000000000000",
+ "0xe742b1e6069a8ffc3c4767235defb0d49cbed222": "800000000000000000000",
+ "0xd7225738dcf3578438f8e7c8b3837e42e04a262f": "445860000000000000000",
+ "0xcd0b0257e783a3d2c2e3ba9d6e79b75ef98024d4": "2945500000000000000000",
+ "0xe80e7fef18a5db15b01473f3ad6b78b2a2f8acd9": "500000000000000000000",
+ "0x261575e9cf59c8226fa7aaf91de86fb70f5ac3ae": "300022000000000000000",
+ "0x7e71171f2949fa0c3ac254254b1f0440e5e6a038": "40000000000000000000",
+ "0x96ea6ac89a2bac95347b51dba63d8bd5ebdedce1": "2000000000000000000000",
+ "0xe6ec5cf0c49b9c317e1e706315ef9eb7c0bf11a7": "17200000000000000000000",
+ "0x2b99b42e4f42619ee36baa7e4af2d65eacfcba35": "40000000000000000000000",
+ "0xc6e4cc0c7283fc1c85bc4813effaaf72b49823c0": "276926000000000000000",
+ "0xdbc1ce0e49b1a705d22e2037aec878ee0d75c703": "250000000000000000000",
+ "0x806f44bdeb688037015e84ff218049e382332a33": "1999000000000000000000",
+ "0x1a3a330e4fcb69dbef5e6901783bf50fd1c15342": "4200000000000000000000",
+ "0xd2a84f75675c62d80c88756c428eee2bcb185421": "1200000000000000000000",
+ "0xc593b546b7698710a205ad468b2c13152219a342": "1550000000000000000000",
+ "0x3f627a769e6a950eb87017a7cd9ca20871136831": "13790000000000000000000",
+ "0xf2d5763ce073127e2cedde6faba786c73ca94141": "7900000000000000000000",
+ "0x162110f29eac5f7d02b543d8dcd5bb59a5e33b73": "2000000000000000000000",
+ "0x59473cd300fffae240f5785626c65dfec792b9af": "20000000000000000000",
+ "0x4dcd11815818ae29b85d01367349a8a7fb12d06b": "7900000000000000000000",
+ "0x9329ffdc268babde8874b366406c81445b9b2d35": "422415000000000000000",
+ "0x0ab4281ebb318590abb89a81df07fa3af904258a": "500000000000000000000",
+ "0x875061ee12e820041a01942cb0e65bb427b00060": "2800000000000000000000",
+ "0xc9b698e898d20d4d4f408e4e4d061922aa856307": "40000000000000000000",
+ "0xca49a5f58adbefae23ee59eea241cf0482622eaa": "1430000000000000000000",
+ "0x196e85df7e732b4a8f0ed03623f4db9db0b8fa31": "21165000000000000000",
+ "0x4c760cd9e195ee4f2d6bce2500ff96da7c43ee91": "60000000000000000000000",
+ "0x024a098ae702bef5406c9c22b78bd4eb2cc7a293": "4000000000000000000000",
+ "0x9d81aea69aed6ad07089d61445348c17f34bfc5b": "300000000000000000000",
+ "0x76ab87dd5a05ad839a4e2fc8c85aa6ba05641730": "2000000000000000000000",
+ "0xc6e2f5af979a03fd723a1b6efa728318cf9c1800": "668500000000000000000",
+ "0x5db69fe93e6fb6fbd450966b97238b110ad8279a": "40000000000000000000000",
+ "0xa4259f8345f7e3a8b72b0fec2cf75e321fda4dc2": "1910000000000000000000",
+ "0x095030e4b82692dcf8b8d0912494b9b378ec9328": "1340000000000000000000",
+ "0x4b470f7ba030bc7cfcf338d4bf0432a91e2ea5ff": "2000000000000000000000",
+ "0x99c9f93e45fe3c1418c353e4c5ac3894eef8121e": "101870000000000000000",
+ "0xffac3db879a6c7158e8dec603b407463ba0d31cf": "1970000000000000000000",
+ "0xac8e87ddda5e78fcbcb9fa7fc3ce038f9f7d2e34": "2000000000000000000000",
+ "0x7a0589b143a8e5e107c9ac66a9f9f8597ab3e7ab": "1510990000000000000000",
+ "0xb7d581fe0af1ec383f3b3c416783f385146a7612": "20000000000000000000000",
+ "0xbb3fc0a29c034d710812dcc775c8cab9d28d6975": "1066806000000000000000",
+ "0x2c603ff0fe93616c43573ef279bfea40888d6ae7": "4740000000000000000000",
+ "0x15f2b7b16432ee50a5f55b41232f6334ed58bdc0": "400000000000000000000",
+ "0x7f3d7203c8a447f7bf36d88ae9b6062a5eee78ae": "6000000000000000000000",
+ "0xf067e1f1d683556a4cc4fd0c0313239f32c4cfd8": "1000000000000000000000",
+ "0x52738c90d860e04cb12f498d96fdb5bf36fc340e": "30000000000000000000",
+ "0x45781bbe7714a1c8f73b1c747921df4f84278b70": "2000000000000000000000",
+ "0x4a97e8fcf4635ea7fc5e96ee51752ec388716b60": "546000000000000000000",
+ "0x54939ff08921b467cf2946751d856378296c63ed": "1000000000000000000000",
+ "0x6485470e61db110aebdbafd536769e3c599cc908": "600000000000000000000",
+ "0xe20d1bcb71286dc7128a9fc7c6ed7f733892eef5": "1003400000000000000000",
+ "0xd6eea898d4ae2b718027a19ce9a5eb7300abe3ca": "27475000000000000000",
+ "0x014974a1f46bf204944a853111e52f1602617def": "2000000000000000000000",
+ "0x6aa5732f3b86fb8c81efbe6b5b47b563730b06c8": "1000000000000000000000",
+ "0x6107d71dd6d0eefb11d4c916404cb98c753e117d": "2000000000000000000000",
+ "0xdd7bcda65924aaa49b80984ae173750258b92847": "10000000000000000000000",
+ "0x4e7b54474d01fefd388dfcd53b9f662624418a05": "8000000000000000000000",
+ "0x24fc73d20793098e09ddab5798506224fa1e1850": "200000000000000000000",
+ "0x2b8488bd2d3c197a3d26151815b5a798d27168dc": "6680000000000000000000",
+ "0x949131f28943925cfc97d41e0cea0b262973a730": "2800000000000000000000",
+ "0x60b8d6b73b79534fb08bb8cbcefac7f393c57bfe": "1760000000000000000000",
+ "0xd6acc220ba2e51dfcf21d443361eea765cbd35d8": "20000000000000000000",
+ "0xc4c6cb723dd7afa7eb535615e53f3cef14f18118": "1999999000000000000000",
+ "0x4c9a862ad115d6c8274ed0b944bdd6a5500510a7": "100000000000000000000",
+ "0x85732c065cbd64119941aed430ac59670b6c51c4": "731345000000000000000",
+ "0x0126e12ebc17035f35c0e9d11dd148393c405d7a": "1999600000000000000000",
+ "0x472048cc609aeb242165eaaa8705850cf3125de0": "1000000000000000000000",
+ "0xd2edd1ddd6d86dc005baeb541d22b640d5c7cae5": "20000000000000000000",
+ "0x4549b15979255f7e65e99b0d5604db98dfcac8bf": "4000000000000000000000",
+ "0xc6c7c191379897dd9c9d9a33839c4a5f62c0890d": "4000085000000000000000",
+ "0xd367009ab658263b62c2333a1c9e4140498e1389": "2000000000000000000000",
+ "0x143f5f1658d9e578f4f3d95f80c0b1bd3933cbda": "1490000000000000000000",
+ "0x1a09fdc2c7a20e23574b97c69e93deba67d37220": "1998000000000000000000",
+ "0xac8b509aefea1dbfaf2bb33500d6570b6fd96d51": "1820000000000000000000",
+ "0x16ffac84032940f0121a09668b858a7e79ffa3bb": "3879210000000000000000",
+ "0xf338459f32a159b23db30ac335769ab2351aa63c": "30000000000000000000000",
+ "0xd82251456dc1380f8f5692f962828640ab9f2a03": "4879980000000000000000",
+ "0x47f4696bd462b20da09fb83ed2039818d77625b3": "149000000000000000000",
+ "0x3dde8b15b3ccbaa5780112c3d674f313bba68026": "1773000000000000000000",
+ "0xf70d637a845c06db6cdc91e6371ce7c4388a628e": "20000000000000000000",
+ "0x68295e8ea5afd9093fc0a465d157922b5d2ae234": "19982000000000000000",
+ "0x614e8bef3dd2c59b59a4145674401018351884ea": "20000000000000000000",
+ "0x4737d042dc6ae73ec73ae2517acea2fdd96487c5": "1000000000000000000000",
+ "0xcec6fc65853f9cce5f8e844676362e1579015f02": "2000000000000000000000",
+ "0xae47e2609cfafe369d66d415d939de05081a9872": "27060000000000000000000",
+ "0x09a928d528ec1b3e25ffc83e218c1e0afe8928c7": "18200000000000000000",
+ "0x9b444fd337e5d75293adcfff70e1ea01db023222": "100000000000000000000",
+ "0x168bdec818eafc6d2992e5ef54aa0e1601e3c561": "1000110000000000000000",
+ "0x353dbec42f92b50f975129b93c4c997375f09073": "1999000000000000000000",
+ "0x6fcc2c732bdd934af6ccd16846fb26ef89b2aa9b": "10001242000000000000000",
+ "0x6f2576da4de283bbe8e3ee69ddd66e5e711db3f5": "1260800000000000000000",
+ "0x3a3dd104cd7eb04f21932fd433ea7affd39369f5": "357500000000000000000",
+ "0xd44f4ac5fad76bdc1537a3b3af6472319b410d9d": "1600000000000000000000",
+ "0x3d9d6be57ff83e065985664f12564483f2e600b2": "2041600000000000000000",
+ "0x88f1045f19f2d3191816b1df18bb6e1435ad1b38": "240000000000000000000",
+ "0xddab75fb2ff9fecb88f89476688e2b00e367ebf9": "19400000000000000000000",
+ "0x092e815558402d67f90d6bfe6da0b2fffa91455a": "60000000000000000000",
+ "0xa7024cfd742c1ec13c01fea18d3042e65f1d5dee": "11272229000000000000000",
+ "0x7f46bb25460dd7dae4211ca7f15ad312fc7dc75c": "6685000000000000000000",
+ "0x93f18cd2526040761488c513174d1e7963768b2c": "2416500000000000000000",
+ "0x352f25babf4a690673e35195efa8f79d05848aad": "66800000000000000000000",
+ "0xf7b151cc5e571c17c76539dbe9964cbb6fe5de79": "2148000000000000000000",
+ "0xff3eee57c34d6dae970d8b311117c53586cd3502": "1700000000000000000000",
+ "0xae6f0c73fdd77c489727512174d9b50296611c4c": "6000000000000000000000",
+ "0x7819b0458e314e2b53bfe00c38495fd4b9fdf8d6": "20000000000000000000",
+ "0x7fdba031c78f9c096d62d05a369eeab0bccc55e5": "2800000000000000000000",
+ "0x735e328666ed5637142b3306b77ccc5460e72c3d": "1968682000000000000000",
+ "0x0bfbb6925dc75e52cf2684224bbe0550fea685d3": "1970000000000000000000",
+ "0x6be16313643ebc91ff9bb1a2e116b854ea933a45": "500000000000000000000",
+ "0xd6acffd0bfd99c382e7bd56ff0e6144a9e52b08e": "160000000000000000000",
+ "0x276a006e3028ecd44cdb62ba0a77ce94ebd9f10f": "1800000000000000000000",
+ "0x10711c3dda32317885f0a2fd8ae92e82069b0d0b": "4000000000000000000000",
+ "0x43cb9652818c6f4d6796b0e89409306c79db6349": "2000000000000000000000",
+ "0x7109dd011d15f3122d9d3a27588c10d77744508b": "2000000000000000000000",
+ "0x3497dd66fd118071a78c2cb36e40b6651cc82598": "109600000000000000000",
+ "0x9bf672d979b36652fc5282547a6a6bc212ae4368": "656000000000000000000",
+ "0xeaed16eaf5daab5bf0295e5e077f59fb8255900b": "4000000000000000000000",
+ "0x7ac58f6ffc4f8107ae6e30378e4e9f99c57fbb24": "40000000000000000000",
+ "0x45a570dcc2090c86a6b3ea29a60863dde41f13b5": "232500000000000000000",
+ "0x433a3b68e56b0df1862b90586bbd39c840ff1936": "2000000000000000000000",
+ "0xe8eaf12944092dc3599b3953fa7cb1c9761cc246": "1800000000000000000000",
+ "0xec11362cec810985d0ebbd7b73451444985b369f": "30000047000000000000000",
+ "0x78e83f80b3678c7a0a4e3e8c84dccde064426277": "1790000000000000000000",
+ "0x0cc67f8273e1bae0867fd42e8b8193d72679dbf8": "500000000000000000000",
+ "0xc70d856d621ec145303c0a6400cd17bbd6f5eaf7": "20000000000000000000",
+ "0xf468906e7edf664ab0d8be3d83eb7ab3f7ffdc78": "1700000000000000000000",
+ "0x3c286cfb30146e5fd790c2c8541552578de334d8": "10203000000000000000000",
+ "0xc401c427cccff10decb864202f36f5808322a0a8": "3329300000000000000000",
+ "0xafd019ff36a09155346b69974815a1c912c90aa4": "2000000000000000000000",
+ "0x96fe59c3dbb3aa7cc8cb62480c65e56e6204a7e2": "20000000000000000000000",
+ "0xa47779d8bc1c7bce0f011ccb39ef68b854f8de8f": "2000000000000000000000",
+ "0x58c650ced40bb65641b8e8a924a039def46854df": "18500000000000000000",
+ "0x86f4f40ad984fbb80933ae626e0e42f9333fdd41": "1000000000000000000000",
+ "0xb22d5055d9623135961e6abd273c90deea16a3e7": "1400000000000000000000",
+ "0xee3564f5f1ba0f94ec7bac164bddbf31c6888b55": "100000000000000000000",
+ "0xcf26b47bd034bc508e6c4bcfd6c7d30034925761": "1800000000000000000000",
+ "0xe87dbac636a37721df54b08a32ef4959b5e4ff82": "2000000000000000000000",
+ "0x3bf86ed8a3153ec933786a02ac090301855e576b": "450000000000000000000000",
+ "0xcfd2728dfb8bdbf3bf73598a6e13eaf43052ea2b": "170000000000000000000",
+ "0x85b16f0b8b34dff3804f69e2168a4f7b24d1042b": "317000000000000000000",
+ "0x84db1459bb00812ea67ecb3dc189b72187d9c501": "148851000000000000000",
+ "0x8c3a9ee71f729f236cba3867b4d79d8ceee25dbc": "100000000000000000000",
+ "0xe677c31fd9cb720075dca49f1abccd59ec33f734": "7800000000000000000000",
+ "0x8889448316ccf14ed86df8e2f478dc63c4338340": "15200000000000000000",
+ "0xb279c7d355c2880392aad1aa21ee867c3b3507df": "1261000000000000000000",
+ "0x12b5e28945bb2969f9c64c63cc05b6f1f8d6f4d5": "7722162000000000000000",
+ "0x8d2303341e1e1eb5e8189bde03f73a60a2a54861": "100000000000000000000",
+ "0x94d81074db5ae197d2bb1373ab80a87d121c4bd3": "9400000000000000000000",
+ "0x752c9febf42f66c4787bfa7eb17cf5333bba5070": "1966448000000000000000",
+ "0x16816aac0ede0d2d3cd442da79e063880f0f1d67": "2000000000000000000000",
+ "0xdaac91c1e859d5e57ed3084b50200f9766e2c52b": "400000000000000000000",
+ "0x32c2fde2b6aabb80e5aea2b949a217f3cb092283": "5614827000000000000000",
+ "0xcdab46a5902080646fbf954204204ae88404822b": "544942000000000000000",
+ "0xfdf42343019b0b0c6bf260b173afab7e45b9d621": "1999944000000000000000",
+ "0x791f6040b4e3e50dcf3553f182cd97a90630b75d": "4000000000000000000000",
+ "0x4b762166dd1118e84369f804c75f9cd657bf730c": "500000000000000000000",
+ "0xa76d3f156251b72c0ccf4b47a3393cbd6f49a9c5": "1337000000000000000000",
+ "0xc5eb42295e9cadeaf2af12dede8a8d53c579c469": "3820000000000000000000",
+ "0xdb9371b30c4c844e59e03e924be606a938d1d310": "2000000000000000000000",
+ "0x2cd39334ac7eac797257abe3736195f5b4b5ce0f": "99964000000000000000",
+ "0xad44357e017e244f476931c7b8189efee80a5d0a": "300000000000000000000",
+ "0x4ca7b717d9bc8793b04e051a8d23e1640f5ba5e3": "1248980000000000000000",
+ "0x73e4a2b60cf48e8baf2b777e175a5b1e4d0c2d8f": "100000000000000000000",
+ "0x5a1d2d2d1d520304b6208849570437eb3091bb9f": "1970000000000000000000",
+ "0x53047dc8ac9083d90672e8b3473c100ccd278323": "40000000000000000000",
+ "0x26fe174cbf526650e0cd009bd6126502ce8e684d": "11640000000000000000000",
+ "0xe2df23f6ea04becf4ab701748dc0963184555cdb": "2000000000000000000000",
+ "0xc1170dbaadb3dee6198ea544baec93251860fda5": "1200000000000000000000",
+ "0x8bbeacfc29cfe93402db3c41d99ab759662e73ec": "2000000000000000000000",
+ "0x165305b787322e25dc6ad0cefe6c6f334678d569": "2000000000000000000000",
+ "0x095457f8ef8e2bdc362196b9a9125da09c67e3ab": "200000000000000000000",
+ "0x702802f36d00250fab53adbcd696f0176f638a49": "2000000000000000000000",
+ "0x489334c2b695c8ee0794bd864217fb9fd8f8b135": "18200000000000000000",
+ "0xfa8cf4e627698c5d5788abb7880417e750231399": "4244640000000000000000",
+ "0x3329eb3baf4345d600ced40e6e9975656f113742": "4999711000000000000000",
+ "0xb4dd5499daeb2507fb2de12297731d4c72b16bb0": "20000000000000000000",
+ "0x88c2516a7cdb09a6276d7297d30f5a4db1e84b86": "4000000000000000000000",
+ "0x612ced8dc0dc9e899ee46f7962333315f3f55e44": "338830000000000000000",
+ "0xd71e43a45177ad51cbe0f72184a5cb503917285a": "200000000000000000000",
+ "0x2fb566c94bbba4e3cb67cdda7d5fad7131539102": "2000000000000000000000",
+ "0x03be5b4629aefbbcab9de26d39576cb7f691d764": "200550000000000000000",
+ "0x025367960304beee34591118e9ac2d1358d8021a": "2000000000000000000000",
+ "0xa5d5b8b62d002def92413710d13b6ff8d4fc7dd3": "400000000000000000000",
+ "0xdf3b72c5bd71d4814e88a62321a93d4011e3578b": "4000000000000000000000",
+ "0x3588895ac9fbafec012092dc05c0c302d90740fa": "3000000000000000000000",
+ "0x6021e85a8814fce1e82a41abd1d3b2dad2faefe0": "2000000000000000000000",
+ "0x17ee9f54d4ddc84d670eff11e54a659fd72f4455": "16000000000000000000000",
+ "0x873c6f70efb6b1d0f2bbc57eebcd70617c6ce662": "1013478000000000000000",
+ "0x1fcc7ce6a8485895a3199e16481f72e1f762defe": "1000000000000000000000",
+ "0xd0a7209b80cf60db62f57d0a5d7d521a69606655": "160000000000000000000",
+ "0xa514d00edd7108a6be839a638db2415418174196": "30000000000000000000000",
+ "0x046377f864b0143f282174a892a73d3ec8ec6132": "191000000000000000000",
+ "0xc126573d87b0175a5295f1dd07c575cf8cfa15f2": "10000000000000000000000",
+ "0x0e123d7da6d1e6fac2dcadd27029240bb39052fe": "1000000000000000000000",
+ "0xad5a8d3c6478b69f657db3837a2575ef8e1df931": "36990000000000000000",
+ "0xdb882eacedd0eff263511b312adbbc59c6b8b25b": "9100000000000000000000",
+ "0x0b43bd2391025581d8956ce42a072579cbbfcb14": "18800000000000000000",
+ "0xaffea0473722cb7f0e0e86b9e11883bf428d8d54": "1940000000000000000000",
+ "0xe32b1c4725a1875449e98f970eb3e54062d15800": "200000000000000000000",
+ "0x98f4af3af0aede5fafdc42a081ecc1f89e3ccf20": "9400000000000000000000",
+ "0x3b4768fd71e2db2cbe7fa050483c27b4eb931df3": "2000000000000000000000",
+ "0xd5f7c41e07729dfa6dfc64c4423160a22c609fd3": "1790000000000000000000",
+ "0xd944c8a69ff2ca1249690c1229c7192f36251062": "1970000000000000000000",
+ "0x5ae64e853ba0a51282cb8db52e41615e7c9f733f": "2000000000000000000000",
+ "0xb13f93af30e8d7667381b2b95bc1a699d5e3e129": "420000000000000000000",
+ "0x8a20e5b5cee7cd1f5515bace3bf4f77ffde5cc07": "80000000000000000000",
+ "0x2448596f91c09baa30bc96106a2d37b5705e5d28": "2000000000000000000000",
+ "0xccca24d8c56d6e2c07db086ec07e585be267ac8d": "200000000000000000000",
+ "0xf67bb8e2118bbcd59027666eedf6943ec9f880a5": "4000000000000000000000",
+ "0x7ae659eb3bc46852fa86fac4e21c768d50388945": "286000000000000000000",
+ "0x467e0ed54f3b76ae0636176e07420815a021736e": "2000000000000000000000",
+ "0xa46cd237b63eea438c8e3b6585f679e4860832ac": "1000000000000000000000",
+ "0x6b760d4877e6a627c1c967bee451a8507ddddbab": "910000000000000000000",
+ "0x593044670faeff00a55b5ae051eb7be870b11694": "133700000000000000000",
+ "0x533c06928f19d0a956cc28866bf6c8d8f4191a94": "292320000000000000000",
+ "0x262dc1364ccf6df85c43268ee182554dae692e29": "4927600000000000000000",
+ "0xe4368bc1420b35efda95fafbc73090521916aa34": "4000000000000000000000",
+ "0xfeb92d30bf01ff9a1901666c5573532bfa07eeec": "1000000000000000000000",
+ "0xee25b9a7032679b113588ed52c137d1a053a1e94": "199820000000000000000",
+ "0x20134cbff88bfadc466b52eceaa79857891d831e": "1000000000000000000000",
+ "0x07b1a306cb4312df66482c2cae72d1e061400fcd": "20000000000000000000000",
+ "0xe791d585b89936b25d298f9d35f9f9edc25a2932": "2000000000000000000000",
+ "0x2e6933543d4f2cc00b5350bd8068ba9243d6beb0": "2000000000000000000000",
+ "0xdae0d33eaa341569fa9ff5982684854a4a328a6e": "1000000000000000000000",
+ "0x125cc5e4d56b2bcc2ee1c709fb9e68fb177440bd": "2000000000000000000000",
+ "0xec99e95dece46ffffb175eb6400fbebb08ee9b95": "100000000000000000000",
+ "0xc538a0ff282aaa5f4b75cfb62c70037ee67d4fb5": "2000000000000000000000",
+ "0x60676d1fa21fca052297e24bf96389c5b12a70d7": "241500000000000000000",
+ "0x4b3dfbdb454be5279a3b8addfd0ed1cd37a9420d": "2000000000000000000000",
+ "0xcdb597299030183f6e2d238533f4642aa58754b6": "400000000000000000000",
+ "0x1ef2dcbfe0a500411d956eb8c8939c3d6cfe669d": "776000000000000000000",
+ "0xa7247c53d059eb7c9310f628d7fc6c6a0a773f08": "500000000000000000000",
+ "0x9799ca21dbcf69bfa1b3f72bac51b9e3ca587cf9": "1700000000000000000000",
+ "0xddf95c1e99ce2f9f5698057c19d5c94027ee4a6e": "6000000000000000000000",
+ "0x83563bc364ed81a0c6da3b56ff49bbf267827a9c": "17332000000000000000000",
+ "0xa192698007cc11aa603d221d5feea076bcf7c30d": "2000000000000000000000",
+ "0x0134ff38155fabae94fd35c4ffe1d79de7ef9c59": "985000000000000000000",
+ "0x80977316944e5942e79b0e3abad38da746086519": "38800000000000000000",
+ "0x193d37ed347d1c2f4e35350d9a444bc57ca4db43": "60000000000000000000",
+ "0x009a6d7db326679b77c90391a7476d238f3ba33e": "200200000000000000000",
+ "0x337b3bdf86d713dbd07b5dbfcc022b7a7b1946ae": "3980000000000000000000",
+ "0x7de7fe419cc61f91f408d234cc80d5ca3d054d99": "20000000000000000000",
+ "0xf47bb134da30a812d003af8dccb888f44bbf5724": "5190000000000000000000",
+ "0xfd920f722682afb5af451b0544d4f41b3b9d5742": "2330200000000000000000",
+ "0x0a917f3b5cb0b883047fd9b6593dbcd557f453b9": "1000000000000000000000",
+ "0xce9786d3712fa200e9f68537eeaa1a06a6f45a4b": "1790000000000000000000",
+ "0x9ab98d6dbb1eaae16d45a04568541ad3d8fe06cc": "272451000000000000000",
+ "0x0b7bb342f01bc9888e6a9af4a887cbf4c2dd2caf": "16000000000000000000000",
+ "0x4c0b1515dfced7a13e13ee12c0f523ae504f032b": "50000000000000000000000",
+ "0xac2889b5966f0c7f9edb42895cb69d1c04f923a2": "5000000000000000000000",
+ "0xd008513b27604a89ba1763b6f84ce688b346945b": "1000000000000000000000",
+ "0xa4b09de6e713dc69546e76ef0acf40b94f0241e6": "322656000000000000000",
+ "0xb153f828dd076d4a7c1c2574bb2dee1a44a318a8": "400000000000000000000",
+ "0x02ade5db22f8b758ee1443626c64ec2f32aa0a15": "20000000000000000000000",
+ "0x0a0650861f785ed8e4bf1005c450bbd06eb48fb6": "3066860000000000000000",
+ "0xb75149e185f6e3927057739073a1822ae1cf0df2": "4000086000000000000000",
+ "0x84cb7da0502df45cf561817bbd2362f451be02da": "1337000000000000000000",
+ "0xc91bb562e42bd46130e2d3ae4652b6a4eb86bc0f": "540000000000000000000",
+ "0xb234035f7544463ce1e22bc553064684c513cd51": "249750000000000000000",
+ "0xe5e33800a1b2e96bde1031630a959aa007f26e51": "1337000000000000000000",
+ "0xae5ce3355a7ba9b332760c0950c2bc45a85fa9a0": "400000000000000000000",
+ "0xe6f5eb649afb99599c414b27a9c9c855357fa878": "2674000000000000000000",
+ "0x7010be2df57bd0ab9ae8196cd50ab0c521aba9f9": "1970000000000000000000",
+ "0xca4288014eddc5632f5facb5e38517a8f8bc5d98": "340000000000000000000",
+ "0x2784903f1d7c1b5cd901f8875d14a79b3cbe2a56": "22388000000000000000000",
+ "0xf8dce867f0a39c5bef9eeba609229efa02678b6c": "2000000000000000000000",
+ "0xe020e86362b487752836a6de0bc02cd8d89a8b6a": "6000000000000000000000",
+ "0xc4088c025f3e85013f5439fb3440a17301e544fe": "2325000000000000000000",
+ "0xbefb448c0c5f683fb67ee570baf0db5686599751": "1970000000000000000000",
+ "0x2f187d5a704d5a338c5b2876a090dce964284e29": "4000000000000000000000",
+ "0xec0e18a01dc4dc5daae567c3fa4c7f8f9b590205": "315900000000000000000",
+ "0x637f5869d6e4695f0eb9e27311c4878aff333380": "1969212000000000000000",
+ "0xd1100dd00fe2ddf18163ad964d0b69f1f2e9658a": "5959598000000000000000",
+ "0x17ef4acc1bf147e326749d10e677dcffd76f9e06": "39980000000000000000000",
+ "0x200dfc0b71e359b2b465440a36a6cdc352773007": "1500000000000000000000",
+ "0xefe0675da98a5dda70cd96196b87f4e726b43348": "1164000000000000000000",
+ "0xd5bd5e8455c130169357c471e3e681b7996a7276": "841500000000000000000",
+ "0x9c7b6dc5190fe2912963fcd579683ec7395116b0": "776000000000000000000",
+ "0xb105dd3d987cffd813e9c8500a80a1ad257d56c6": "1999944000000000000000",
+ "0x145250b06e4fa7cb2749422eb817bdda8b54de5f": "219000000000000000000",
+ "0xd96db33b7b5a950c3efa2dc31b10ba10a532ef87": "2000000000000000000000",
+ "0xaf529bdb459cc185bee5a1c58bf7e8cce25c150d": "197000000000000000000",
+ "0x185546e8768d506873818ac9751c1f12116a3bef": "200000000000000000000",
+ "0x51d24bc3736f88dd63b7222026886630b6eb878d": "2000000000000000000000",
+ "0x69af28b0746cac0da17084b9398c5e36bb3a0df2": "1004700000000000000000",
+ "0x76f83ac3da30f7092628c7339f208bfc142cb1ee": "2842600000000000000000",
+ "0x00f463e137dcf625fbf3bca39eca98d2b968cf7f": "5910000000000000000000",
+ "0x2084fce505d97bebf1ad8c5ff6826fc645371fb2": "30000000000000000000",
+ "0x53a714f99fa00fef758e23a2e746326dad247ca7": "1490000000000000000000",
+ "0x0bf064428f83626722a7b5b26a9ab20421a7723e": "133700000000000000000",
+ "0xac6f68e837cf1961cb14ab47446da168a16dde89": "1337000000000000000000",
+ "0x4b3c7388cc76da3d62d40067dabccd7ef0433d23": "100076000000000000000",
+ "0xdeb9a49a43873020f0759185e20bbb4cf381bb8f": "211628000000000000000",
+ "0x5bf9f2226e5aeacf1d80ae0a59c6e38038bc8db5": "6000000000000000000000",
+ "0x9d0e7d92fb305853d798263bf15e97c72bf9d7e0": "1000000000000000000000",
+ "0x2b5c60e84535eeb4d580de127a12eb2677ccb392": "20000000000000000000000",
+ "0xd8d65420c18c2327cc5af97425f857e4a9fd51b3": "1760000000000000000000",
+ "0x30ec9392244a2108c987bc5cdde0ed9f837a817b": "1560562000000000000000",
+ "0x56a1d60d40f57f308eebf087dee3b37f1e7c2cba": "1159600000000000000000",
+ "0xa9a1cdc33bfd376f1c0d76fb6c84b6b4ac274d68": "5000000000000000000000",
+ "0xa67f38819565423aa85f3e3ab61bc763cbab89dd": "2130000000000000000000",
+ "0x62d5cc7117e18500ac2f9e3c26c86b0a94b0de15": "105000000000000000000",
+ "0x4970d3acf72b5b1f32a7003cf102c64ee0547941": "140000000000000000000000",
+ "0x76628150e2995b5b279fc83e0dd5f102a671dd1c": "40000000000000000000000",
+ "0x3d8f39881b9edfe91227c33fa4cdd91e678544b0": "86111000000000000000",
+ "0xff0b7cb71da9d4c1ea6ecc28ebda504c63f82fd1": "1043000000000000000000",
+ "0x8d795c5f4a5689ad62da961671f028065286d554": "2048000000000000000000",
+ "0xbe2346a27ff9b702044f500deff2e7ffe6824541": "20000000000000000000",
+ "0x0dbd417c372b8b0d01bcd944706bd32e60ae28d1": "340000000000000000000",
+ "0x467fbf41441600757fe15830c8cd5f4ffbbbd560": "10000000000000000000000",
+ "0x090cd67b60e81d54e7b5f6078f3e021ba65b9a1e": "1000000000000000000000",
+ "0x55a4cac0cb8b582d9fef38c5c9fff9bd53093d1f": "1970000000000000000000",
+ "0x3b7b4f53c45655f3dc5f017edc23b16f9bc536fa": "100000000000000000000",
+ "0xd508d39c70916f6abc4cc7f999f011f077105802": "100470000000000000000",
+ "0x037dd056e7fdbd641db5b6bea2a8780a83fae180": "140000000000000000000",
+ "0x660557bb43f4be3a1b8b85e7df7b3c5bcd548057": "6000000000000000000000",
+ "0x02089361a3fe7451fb1f87f01a2d866653dc0b07": "39976000000000000000",
+ "0xc4bec96308a20f90cab18399c493fd3d065abf45": "14000000000000000000000",
+ "0xcca07bb794571d4acf041dad87f0d1ef3185b319": "2000000000000000000000",
+ "0xf2d0e986d814ea13c8f466a0538c53dc922651f0": "1380000000000000000000",
+ "0x662cfa038fab37a01745a364e1b98127c503746d": "3940000000000000000000",
+ "0x3336c3ef6e8b50ee90e037b164b7a8ea5faac65d": "272712000000000000000",
+ "0x30e33358fc21c85006e40f32357dc8895940aaf0": "1910000000000000000000",
+ "0x41a9a404fc9f5bfee48ec265b12523338e29a8bf": "388000000000000000000",
+ "0x6af235d2bbe050e6291615b71ca5829658810142": "3000000000000000000000",
+ "0xfd5a63157f914fd398eab19c137dd9550bb7715c": "100000000000000000000",
+ "0x8a4314fb61cd938fc33e15e816b113f2ac89a7fb": "432800000000000000000",
+ "0xb216dc59e27c3d7279f5cd5bb2becfb2606e14d9": "400000000000000000000",
+ "0xf5a5459fcdd5e5b273830df88eea4cb77ddadfb9": "74500000000000000000",
+ "0xdf31025f5649d2c6eea41ed3bdd3471a790f759a": "20000000000000000000",
+ "0x721f9d17e5a0e74205947aeb9bc6a7938961038f": "51900000000000000000",
+ "0x08d0864dc32f9acb36bf4ea447e8dd6726906a15": "2000200000000000000000",
+ "0x54575c3114751e3c631971da6a2a02fd3ffbfcc8": "1940000000000000000000",
+ "0x8f60895fbebbb5017fcbff3cdda397292bf25ba6": "429177000000000000000",
+ "0x91fe8a4c6164df8fa606995d6ba7adcaf1c893ce": "17000000000000000000000",
+ "0x889087f66ff284f8b5efbd29493b706733ab1447": "9850000000000000000000",
+ "0x051633080d07a557adde319261b074997f14692d": "5800000000000000000000",
+ "0x59a12df2e3ef857aceff9306b309f6a500f70134": "1000000000000000000000",
+ "0x9f64a8e8dacf4ade30d10f4d59b0a3d5abfdbf74": "1000060000000000000000",
+ "0x8846928d683289a2d11df8db7a9474988ef01348": "10000000000000000000000",
+ "0xdff1b220de3d8e9ca4c1b5be34a799bcded4f61c": "385428000000000000000",
+ "0x7e7c1e9a61a08a83984835c70ec31d34d3eaa87f": "191000000000000000000",
+ "0xfe210b8f04dc6d4f76216acfcbd59ba83be9b630": "20000000000000000000",
+ "0xdc8c2912f084a6d184aa73638513ccbc326e0102": "1295000000000000000000",
+ "0xdddd7b9e6eab409b92263ac272da801b664f8a57": "500000000000000000000000",
+ "0x86a5f8259ed5b09e188ce346ee92d34aa5dd93fa": "200000000000000000000",
+ "0xdc1f1979615f082140b8bb78c67b27a1942713b1": "60000000000000000000",
+ "0xea66e7b84dcdbf36eea3e75b85382a75f1a15d96": "1729135000000000000000",
+ "0x039e7a4ebc284e2ccd42b1bdd60bd6511c0f7706": "17300000000000000000",
+ "0x36bfe1fa3b7b70c172eb042f6819a8972595413e": "1000000000000000000000",
+ "0x039ef1ce52fe7963f166d5a275c4b1069fe3a832": "400008000000000000000",
+ "0xf1df55dcc34a051012b575cb968bc9c458ea09c9": "4000000000000000000000",
+ "0x168b5019b818691644835fe69bf229e17112d52c": "28000000000000000000000",
+ "0xf60bd735543e6bfd2ea6f11bff627340bc035a23": "2000000000000000000000",
+ "0x2cbb0c73df91b91740b6693b774a7d05177e8e58": "1850000000000000000000",
+ "0x9ffcf5ef46d933a519d1d16c6ba3189b27496224": "1000000000000000000000",
+ "0x0e11d77a8977fac30d268445e531149b31541a24": "2000000000000000000000",
+ "0xdfb1626ef48a1d7d7552a5e0298f1fc23a3b482d": "1713860000000000000000",
+ "0xcc943be1222cd1400a2399dd1b459445cf6d54a9": "12530000000000000000000",
+ "0xb37c2b9f50637bece0ca959208aefee6463ba720": "400000000000000000000",
+ "0x96b906ea729f4655afe3e57d35277c967dfa1577": "1000000000000000000000",
+ "0x7995bd8ce2e0c67bf1c7a531d477bca1b2b97561": "5945100000000000000000",
+ "0x96f820500b70f4a3e3239d619cff8f222075b135": "200000000000000000000",
+ "0xad3565d52b688added08168b2d3872d17d0a26ae": "100000000000000000000",
+ "0x9e7c2050a227bbfd60937e268cea3e68fea8d1fe": "100000000000000000000",
+ "0x7e59dc60be8b2fc19abd0a5782c52c28400bce97": "1000000000000000000000",
+ "0x01ed5fba8d2eab673aec042d30e4e8a611d8c55a": "2000000000000000000000",
+ "0x59a087b9351ca42f58f36e021927a22988284f38": "18500000000000000000",
+ "0x2fe0023f5722650f3a8ac01009125e74e3f82e9b": "3000000000000000000000",
+ "0xbd1803370bddb129d239fd16ea8526a6188ae58e": "500000000000000000000",
+ "0xc70527d444c490e9fc3f5cc44e66eb4f306b380f": "4000000000000000000000",
+ "0x0f206e1a1da7207ea518b112418baa8b06260328": "600000000000000000000",
+ "0x6e1a046caf5b4a57f4fd4bc173622126b4e2fd86": "1790000000000000000000",
+ "0x84008a72f8036f3feba542e35078c057f32a8825": "100000000000000000000",
+ "0x246291165b59332df5f18ce5c98856fae95897d6": "1700000000000000000000",
+ "0x7e99dfbe989d3ba529d19751b7f4317f8953a3e2": "400000000000000000000",
+ "0x748c285ef1233fe4d31c8fb1378333721c12e27a": "2000000000000000000000",
+ "0x3dd12e556a603736feba4a6fa8bd4ac45d662a04": "167450000000000000000000",
+ "0xd0ae735d915e946866e1fea77e5ea466b5cadd16": "2000000000000000000000",
+ "0x4f767bc8794aef9a0a38fea5c81f14694ff21a13": "512200000000000000000",
+ "0x0e2f8e28a681f77c583bd0ecde16634bdd7e00cd": "95060000000000000000",
+ "0xd74a6e8d6aab34ce85976814c1327bd6ea0784d2": "100000000000000000000000",
+ "0x629be7ab126a5398edd6da9f18447e78c692a4fd": "2000000000000000000000",
+ "0x2e46fcee6a3bb145b594a243a3913fce5dad6fba": "10000000000000000000000",
+ "0xe39b11a8ab1ff5e22e5ae6517214f73c5b9b55dc": "2000000000000000000000",
+ "0x119aa64d5b7d181dae9d3cb449955c89c1f963fa": "700000000000000000000",
+ "0xce079f51887774d8021cb3b575f58f18e9acf984": "180000000000000000000",
+ "0x550c306f81ef5d9580c06cb1ab201b95c748a691": "665800000000000000000",
+ "0x06dc7f18cee7edab5b795337b1df6a9e8bd8ae59": "400000000000000000000",
+ "0xe21c778ef2a0d7f751ea8c074d1f812243863e4e": "5308559000000000000000",
+ "0x45d4b54d37a8cf599821235f062fa9d170ede8a4": "324000000000000000000",
+ "0x893a6c2eb8b40ab096b4f67e74a897b840746e86": "1730000000000000000000",
+ "0xd44d81e18f46e2cfb5c1fcf5041bc8569767d100": "36381800000000000000000",
+ "0xc5de1203d3cc2cea31c82ee2de5916880799eafd": "5000000000000000000000",
+ "0x7f0f04fcf37a53a4e24ede6e93104e78be1d3c9e": "2000000000000000000000",
+ "0x3ce1dc97fcd7b7c4d3a18a49d6f2a5c1b1a906d7": "200000000000000000000",
+ "0xac4ee9d502e7d2d2e99e59d8ca7d5f00c94b4dd6": "1000000000000000000000",
+ "0x7640a37f8052981515bce078da93afa4789b5734": "2000000000000000000000",
+ "0x76cac488111a4fd595f568ae3a858770fc915d5f": "200000000000000000000",
+ "0xff4a408f50e9e72146a28ce4fc8d90271f116e84": "1970000000000000000000",
+ "0x249db29dbc19d1235da7298a04081c315742e9ac": "1801800000000000000000",
+ "0x3a04572847d31e81f7765ca5bfc9d557159f3683": "133031000000000000000",
+ "0xb6771b0bf3427f9ae7a93e7c2e61ee63941fdb08": "18800000000000000000000",
+ "0x30c26a8e971baa1855d633ba703f028cc7873140": "10000000000000000000000",
+ "0x167e3e3ae2003348459392f7dfce44af7c21ad59": "500000000000000000000",
+ "0x43f16f1e75c3c06a9478e8c597a40a3cb0bf04cc": "2914000000000000000000",
+ "0x056b1546894f9a85e203fb336db569b16c25e04f": "169397000000000000000",
+ "0x70616e2892fa269705b2046b8fe3e72fa55816d3": "20000000000000000000000",
+ "0x8f4d1d41693e462cf982fd81d0aa701d3a5374c9": "4000000000000000000000",
+ "0xc518799a5925576213e21896e0539abb85b05ae3": "1000000000000000000000",
+ "0x0e3a28c1dfafb0505bdce19fe025f506a6d01ceb": "2000000000000000000000",
+ "0xe4a47e3933246c3fd62979a1ea19ffdf8c72ef37": "148273000000000000000",
+ "0xd231929735132102471ba59007b6644cc0c1de3e": "1000090000000000000000",
+ "0x555d8d3ce1798aca902754f164b8be2a02329c6c": "10000000000000000000000",
+ "0x5ab1a5615348001c7c775dc75748669b8be4de14": "690200000000000000000",
+ "0x2fee36a49ee50ecf716f1047915646779f8ba03f": "1056230000000000000000",
+ "0x54db5e06b4815d31cb56a8719ba33af2d73e7252": "670000000000000000000",
+ "0x7c8bb65a6fbb49bd413396a9d7e31053bbb37aa9": "6000000000000000000000",
+ "0xc1384c6e717ebe4b23014e51f31c9df7e4e25b31": "500000000000000000000",
+ "0x474158a1a9dc693c133f65e47b5c3ae2f773a86f": "200200000000000000000",
+ "0x2934c0df7bbc172b6c186b0b72547ace8bf75454": "60000000000000000000",
+ "0x6966063aa5de1db5c671f3dd699d5abe213ee902": "8000000000000000000000",
+ "0x9225d46a5a80943924a39e5b84b96da0ac450581": "40000000000000000000000",
+ "0x671bbca099ff899bab07ea1cf86965c3054c8960": "50000000000000000000",
+ "0xf1f766b0e46d73fcd4d52e7a72e1b9190cc632b3": "8000000000000000000000",
+ "0xef0dc7dd7a53d612728bcbd2b27c19dd4d7d666f": "705668000000000000000",
+ "0x38d2e9154964b41c8d50a7487d391e7ee2c3d3c2": "3500000000000000000000",
+ "0x352a785f4a921632504ce5d015f83c49aa838d6d": "4314800000000000000000",
+ "0x743de50026ca67c94df54f066260e1d14acc11ac": "2000000000000000000000",
+ "0xb188078444027e386798a8ae68698919d5cc230d": "267400000000000000000",
+ "0x53608105ce4b9e11f86bf497ffca3b78967b5f96": "20000000000000000000000",
+ "0x3b159099075207c6807663b1f0f7eda54ac8cce3": "1969543000000000000000",
+ "0x141a5e39ee2f680a600fbf6fa297de90f3225cdd": "10000000000000000000000",
+ "0x44fff37be01a3888d3b8b8e18880a7ddefeeead3": "259145000000000000000",
+ "0xc5a629a3962552cb8eded889636aafbd0c18ce65": "10000000000000000000000",
+ "0xfdba5359f7ec3bc770ac49975d844ec9716256f1": "1000000000000000000000",
+ "0x7c1df24a4f7fb2c7b472e0bb006cb27dcd164156": "1000000000000000000000",
+ "0xab7d54c7c6570efca5b4b8ce70f52a5773e5d53b": "279600000000000000000",
+ "0x3f173aa6edf469d185e59bd26ae4236b92b4d8e1": "320000000000000000000",
+ "0xa3f4ad14e0bb44e2ce2c14359c75b8e732d37054": "200000000000000000000",
+ "0xac5f627231480d0d95302e6d89fc32cb1d4fe7e3": "200000000000000000000",
+ "0xd0775dba2af4c30a3a78365939cd71c2f9de95d2": "1940000000000000000000",
+ "0xad94235fc3b3f47a2413af31e884914908ef0c45": "500008000000000000000",
+ "0xeaedcc6b8b6962d5d9288c156c579d47c0a9fcff": "85000000000000000000",
+ "0x7ac48d40c664cc9a6d89f1c5f5c80a1c70e744e6": "3008000000000000000000",
+ "0xec73114c5e406fdbbe09b4fa621bd70ed54ea1ef": "24500000000000000000000",
+ "0xa690f1a4b20ab7ba34628620de9ca040c43c1963": "4000000000000000000000",
+ "0xcad14f9ebba76680eb836b079c7f7baaf481ed6d": "238600000000000000000",
+ "0x6c714a58fff6e97d14b8a5e305eb244065688bbd": "4000000000000000000000",
+ "0x3e618350fa01657ab0ef3ebac8e37012f8fc2b6f": "2804400000000000000000",
+ "0xc946d5acc1346eba0a7279a0ac1d465c996d827e": "16385128000000000000000",
+ "0x1164caaa8cc5977afe1fad8a7d6028ce2d57299b": "400000000000000000000",
+ "0x7917e5bd82a9790fd650d043cdd930f7799633db": "3999800000000000000000",
+ "0xd52aecc6493938a28ca1c367b701c21598b6a02e": "1100000000000000000000",
+ "0x98bed3a72eccfbafb923489293e429e703c7e25b": "2000000000000000000000",
+ "0x42db0b902559e04087dd5c441bc7611934184b89": "2014420000000000000000",
+ "0x43bc2d4ddcd6583be2c7bc094b28fb72e62ba83b": "2000000000000000000000",
+ "0x85f0e7c1e3aff805a627a2aaf2cff6b4c0dbe9cb": "20000000000000000000",
+ "0x581b9fd6eae372f3501f42eb9619eec820b78a84": "19699015000000000000000",
+ "0x541db20a80cf3b17f1621f1b3ff79b882f50def3": "1000000000000000000000",
+ "0x4e8a6d63489ccc10a57f885f96eb04ecbb546024": "18500000000000000000000",
+ "0x28349f7ef974ea55fe36a1583b34cec3c45065f0": "234490000000000000000",
+ "0xa3241d890a92baf52908dc4aa049726be426ebd3": "19999560000000000000000",
+ "0xb4b11d109f608fa8edd3fea9f8c315649aeb3d11": "5000000000000000000000",
+ "0x5f321b3daaa296cadf29439f9dab062a4bffedd6": "81868000000000000000",
+ "0xc5ae86b0c6c7e3900f1368105c56537faf8d743e": "188000000000000000000",
+ "0x9a8eca4189ff4aa8ff7ed4b6b7039f0902219b15": "20000000000000000000",
+ "0xa3facc50195c0b4933c85897fecc5bbd995c34b8": "20000000000000000000",
+ "0xf07bd0e5c2ce69c7c4a724bd26bbfa9d2a17ca03": "5910000000000000000000",
+ "0x640aba6de984d94517377803705eaea7095f4a11": "10000000000000000000000",
+ "0x204ac98867a7c9c7ed711cb82f28a878caf69b48": "6000000000000000000000",
+ "0x9d34dac25bd15828faefaaf28f710753b39e89dc": "1090400000000000000000",
+ "0xfe418b421a9c6d373602790475d2303e11a75930": "1015200000000000000000",
+ "0x3f472963197883bbda5a9b7dfcb22db11440ad31": "481445000000000000000",
+ "0x1578bdbc371b4d243845330556fff2d5ef4dff67": "100000000000000000000",
+ "0xdba4796d0ceb4d3a836b84c96f910afc103f5ba0": "166666000000000000000",
+ "0x466fda6b9b58c5532750306a10a2a8c768103b07": "199955000000000000000",
+ "0x2770f14efb165ddeba79c10bb0af31c31e59334c": "3000000000000000000000",
+ "0x7c382c0296612e4e97e440e02d3871273b55f53b": "197600000000000000000",
+ "0x1fb7bd310d95f2a6d9baaf8a8a430a9a04453a8b": "3000000000000000000000",
+ "0xa9acf600081bb55bb6bfbab1815ffc4e17e85a95": "200000000000000000000",
+ "0xf93d5bcb0644b0cce5fcdda343f5168ffab2877d": "209978000000000000000",
+ "0xdb0cc78f74d9827bdc8a6473276eb84fdc976212": "2000000000000000000000",
+ "0xb66411e3a02dedb726fa79107dc90bc1cae64d48": "2000000000000000000000",
+ "0x4d6e8fe109ccd2158e4db114132fe75fecc8be5b": "25019000000000000000",
+ "0x6fd947d5a73b175008ae6ee8228163da289b167d": "30000000000000000000000",
+ "0x32d950d5e93ea1d5b48db4714f867b0320b31c0f": "1015200000000000000000",
+ "0x9c99b62606281b5cefabf36156c8fe62839ef5f3": "4000000000000000000000",
+ "0x86c8d0d982b539f48f9830f9891f9d607a942659": "13260000000000000000000",
+ "0xf2127d54188fedef0f338a5f38c7ff73ad9f6f42": "20000000000000000000000",
+ "0xe864fec07ed1214a65311e11e329de040d04f0fd": "1656353000000000000000",
+ "0x1d09ad2412691cc581c1ab36b6f9434cd4f08b54": "7000000000000000000000",
+ "0x4ea70f04313fae65c3ff224a055c3d2dab28dddf": "19999800000000000000000",
+ "0xe0668fa82c14d6e8d93a53113ef2862fa81581bc": "870400000000000000000",
+ "0xf0d858105e1b648101ac3f85a0f8222bf4f81d6a": "600000000000000000000",
+ "0x0f3a1023cac04dbf44f5a5fa6a9cf8508cd4fddf": "1820000000000000000000",
+ "0x5793abe6f1533311fd51536891783b3f9625ef1c": "827268000000000000000",
+ "0x8d667637e29eca05b6bfbef1f96d460eefbf9984": "4000000000000000000000",
+ "0xd76dbaebc30d4ef67b03e6e6ecc6d84e004d502d": "2019250000000000000000",
+ "0x42d1a6399b3016a8597f8b640927b8afbce4b215": "2980000000000000000000",
+ "0x21fd47c5256012198fa5abf131c06d6aa1965f75": "7880000000000000000000",
+ "0x2f2bba1b1796821a766fce64b84f28ec68f15aea": "20000000000000000000",
+ "0xd24bf12d2ddf457decb17874efde2052b65cbb49": "14000000000000000000000",
+ "0x88de13b09931877c910d593165c364c8a1641bd3": "3000000000000000000000",
+ "0x555ca9f05cc134ab54ae9bea1c3ff87aa85198ca": "100000000000000000000",
+ "0xae9ecd6bdd952ef497c0050ae0ab8a82a91898ce": "30000000000000000000",
+ "0xad8bfef8c68a4816b3916f35cb7bfcd7d3040976": "40000000000000000000000",
+ "0xdad136b88178b4837a6c780feba226b98569a94c": "200000000000000000000",
+ "0x800e7d631c6e573a90332f17f71f5fd19b528cb9": "152000000000000000000",
+ "0x94a9a71691317c2064271b51c9353fbded3501a8": "3340000000000000000000",
+ "0x80a0f6cc186cf6201400736e065a391f52a9df4a": "10000000000000000000000",
+ "0x712ff7370a13ed360973fedc9ff5d2c93a505e9e": "3940000000000000000000",
+ "0x42399659aca6a5a863ea2245c933fe9a35b7880e": "2044000000000000000000",
+ "0xae239acffd4ebe2e1ba5b4170572dc79cc6533ec": "12000000000000000000000",
+ "0x007b9fc31905b4994b04c9e2cfdc5e2770503f42": "1999000000000000000000",
+ "0x7480de62254f2ba82b578219c07ba5be430dc3cb": "7040000000000000000000",
+ "0x917b8f9f3a8d09e9202c52c29e724196b897d35e": "161000000000000000000",
+ "0x708ea707bae4357f1ebea959c3a250acd6aa21b3": "500000000000000000000",
+ "0x6dc7053a718616cfc78bee6382ee51add0c70330": "2000000000000000000000",
+ "0xc4dac5a8a0264fbc1055391c509cc3ee21a6e04c": "6501000000000000000000",
+ "0xc1b2a0fb9cad45cd699192cd27540b88d3384279": "500000000000000000000",
+ "0xb07cb9c12405b711807543c4934465f87f98bd2d": "2000000000000000000000",
+ "0xc7f72bb758016b374714d4899bce22b4aec70a31": "1072706000000000000000",
+ "0x0c480de9f7461002908b49f60fc61e2b62d3140b": "10000000000000000000000",
+ "0x83d532d38d6dee3f60adc68b936133c7a2a1b0dd": "500000000000000000000",
+ "0x12afbcba1427a6a39e7ba4849f7ab1c4358ac31b": "20000000000000000000000",
+ "0xf8f6645e0dee644b3dad81d571ef9baf840021ad": "2000000000000000000000",
+ "0x40cf890591eae4a18f812a2954cb295f633327e6": "48132000000000000000",
+ "0x735b97f2fc1bd24b12076efaf3d1288073d20c8c": "20000000000000000000",
+ "0x47c7e5efb48b3aed4b7c6e824b435f357df4c723": "18200000000000000000",
+ "0xd34d708d7398024533a5a2b2309b19d3c55171bb": "400000000000000000000",
+ "0x64370e87202645125a35b207af1231fb6072f9a7": "200000000000000000000",
+ "0xb055af4cadfcfdb425cf65ba6431078f07ecd5ab": "100000000000000000000",
+ "0xc7de5e8eafb5f62b1a0af2195cf793c7894c9268": "1000000000000000000000",
+ "0xc63cd7882118b8a91e074d4c8f4ba91851303b9a": "260000000000000000000",
+ "0x164d7aac3eecbaeca1ad5191b753f173fe12ec33": "744090000000000000000",
+ "0xe4fb26d1ca1eecba3d8298d9d148119ac2bbf580": "400000000000000000000",
+ "0x613ac53be565d46536b820715b9b8d3ae68a4b95": "3760000000000000000000",
+ "0x7f616c6f008adfa082f34da7d0650460368075fb": "1000000000000000000000",
+ "0x9af100cc3dae83a33402051ce4496b16615483f6": "2000000000000000000000",
+ "0xb45cca0d36826662683cf7d0b2fdac687f02d0c4": "1000000000000000000000",
+ "0x93a6b3ab423010f981a7489d4aad25e2625c5741": "20190033000000000000000",
+ "0xee049af005974dd1c7b3a9ca8d9aa77175ba53aa": "333333000000000000000",
+ "0x687927e3048bb5162ae7c15cf76bd124f9497b9e": "2000000000000000000000",
+ "0x1aa40270d21e5cde86b6316d1ac3c533494b79ed": "20000000000000000000",
+ "0x426259b0a756701a8b663528522156c0288f0f24": "9900000000000000000000",
+ "0x91c75e3cb4aa89f34619a164e2a47898f5674d9c": "2000000000000000000000",
+ "0x437983388ab59a4ffc215f8e8269461029c3f1c1": "20000000000000000000000",
+ "0x272a131a5a656a7a3aca35c8bd202222a7592258": "2674000000000000000000",
+ "0xbc0ca4f217e052753614d6b019948824d0d8688b": "400000000000000000000",
+ "0xcc6c03bd603e09de54e9c4d5ac6d41cbce715724": "98500000000000000000",
+ "0xd79aff13ba2da75d46240cac0a2467c656949823": "1730000000000000000000",
+ "0x477b24eee8839e4fd19d1250bd0b6645794a61ca": "8000000000000000000000",
+ "0x79fd6d48315066c204f9651869c1096c14fc9781": "2000000000000000000000",
+ "0x1463a873555bc0397e575c2471cf77fa9db146e0": "10000000000000000000000",
+ "0x89ab13ee266d779c35e8bb04cd8a90cc2103a95b": "60000000000000000000000",
+ "0x90acced7e48c08c6b934646dfa0adf29dc94074f": "56154000000000000000",
+ "0x31ea6eab19d00764e9a95e183f2b1b22fc7dc40f": "20000000000000000000",
+ "0x87a53ea39f59a35bada8352521645594a1a714cb": "1910000000000000000000",
+ "0x1e1aed85b86c6562cb8fa1eb6f8f3bc9dcae6e79": "4516200000000000000000",
+ "0xe36a8ea87f1e99e8a2dc1b2608d166667c9dfa01": "100000000000000000000",
+ "0xec2cb8b9378dff31aec3c22e0e6dadff314ab5dd": "2000000000000000000000",
+ "0x3cadeb3d3eed3f62311d52553e70df4afce56f23": "4000000000000000000000",
+ "0x3ceca96bb1cdc214029cbc5e181d398ab94d3d41": "80000000000000000000000",
+ "0x3283eb7f9137dd39bed55ffe6b8dc845f3e1a079": "66224000000000000000",
+ "0x0954a8cb5d321fc3351a7523a617d0f58da676a7": "2506000000000000000000",
+ "0xde33d708a3b89e909eaf653b30fdc3a5d5ccb4b3": "177300000000000000000",
+ "0x1c6702b3b05a5114bdbcaeca25531aeeb34835f4": "26071500000000000000000",
+ "0xe5b96fc9ac03d448c1613ac91d15978145dbdfd1": "200000000000000000000",
+ "0xfbf204c813f836d83962c7870c7808ca347fd33e": "20000000000000000000",
+ "0x3b13631a1b89cb566548899a1d60915cdcc4205b": "2000000000000000000000",
+ "0xa87f7abd6fa31194289678efb63cf584ee5e2a61": "4000000000000000000000",
+ "0xc0a39308a80e9e84aaaf16ac01e3b01d74bd6b2d": "136499000000000000000",
+ "0xffd6da958eecbc016bab91058440d39b41c7be83": "20000000000000000000000",
+ "0x0e3dd7d4e429fe3930a6414035f52bdc599d784d": "40110000000000000000",
+ "0xe0663e8cd66792a641f56e5003660147880f018e": "2000000000000000000000",
+ "0x5b78eca27fbdea6f26befba8972b295e7814364b": "2000000000000000000000",
+ "0xec9851bd917270610267d60518b54d3ca2b35b17": "40000000000000000000000",
+ "0xbc9c95dfab97a574cea2aa803b5caa197cef0cff": "420000000000000000000",
+ "0x100b4d0977fcbad4debd5e64a0497aeae5168fab": "314500000000000000000",
+ "0x1b6610fb68bad6ed1cfaa0bbe33a24eb2e96fafb": "152000000000000000000",
+ "0xb4524c95a7860e21840296a616244019421c4aba": "8000000000000000000000",
+ "0x88975a5f1ef2528c300b83c0c607b8e87dd69315": "83500000000000000000",
+ "0x853e6abaf44469c72f151d4e223819aced4e3728": "2000000000000000000000",
+ "0xd604abce4330842e3d396ca73ddb5519ed3ec03f": "163940000000000000000",
+ "0xd209482bb549abc4777bea6d7f650062c9c57a1c": "320880000000000000000",
+ "0x590acbda37290c0d3ec84fc2000d7697f9a4b15d": "500000000000000000000",
+ "0x571950ea2c90c1427d939d61b4f2de4cf1cfbfb0": "20000000000000000000",
+ "0xcb94e76febe208116733e76e805d48d112ec9fca": "1000000000000000000000",
+ "0xfa8e3b1f13433900737daaf1f6299c4887f85b5f": "715000000000000000000",
+ "0x162d76c2e6514a3afb6fe3d3cb93a35c5ae783f1": "2000000000000000000000",
+ "0x4bea288eea42c4955eb9faad2a9faf4783cbddac": "28790618000000000000000",
+ "0xc8ab1a3cf46cb8b064df2e222d39607394203277": "2000000000000000000000",
+ "0x318b2ea5f0aaa879c4d5e548ac9d92a0c67487b7": "200000000000000000000",
+ "0x53c5fe0119e1e848640cee30adea96940f2a5d8b": "21746000000000000000000",
+ "0x0701f9f147ec486856f5e1b71de9f117e99e2105": "173360000000000000000",
+ "0x337cfe1157a5c6912010dd561533791769c2b6a6": "1000000000000000000000",
+ "0xfd60d2b5af3d35f7aaf0c393052e79c4d823d985": "56400000000000000000",
+ "0x0f049a8bdfd761de8ec02cee2829c4005b23c06b": "252000000000000000000",
+ "0x924bce7a853c970bb5ec7bb759baeb9c7410857b": "13700000000000000000",
+ "0x16abb8b021a710bdc78ea53494b20614ff4eafe8": "158000000000000000000",
+ "0x9e7f65a90e8508867bccc914256a1ea574cf07e3": "1240000000000000000000",
+ "0x01d03815c61f416b71a2610a2daba59ff6a6de5b": "9553100000000000000000",
+ "0x3df762049eda8ac6927d904c7af42f94e5519601": "2000000000000000000000",
+ "0x5593c9d4b664730fd93ca60151c25c2eaed93c3b": "200000000000000000000",
+ "0xe023f09b2887612c7c9cf1988e3a3a602b3394c9": "2000000000000000000000",
+ "0x4c13980c32dcf3920b78a4a7903312907c1b123f": "60024000000000000000",
+ "0xa282e969cac9f7a0e1c0cd90f5d0c438ac570da3": "627760000000000000000",
+ "0x3b22da2a0271c8efe102532773636a69b1c17e09": "502000000000000000000",
+ "0x1aa1021f550af158c747668dd13b463160f95a40": "1470000000000000000000",
+ "0xf15178ffc43aa8070ece327e930f809ab1a54f9d": "197600000000000000000",
+ "0xdb1293a506e90cad2a59e1b8561f5e66961a6788": "2000000000000000000000",
+ "0x88c361640d6b69373b081ce0c433bd590287d5ec": "50000000000000000000000",
+ "0x3737216ee91f177732fb58fa4097267207e2cf55": "1520000000000000000000",
+ "0xa16d9e3d63986159a800b46837f45e8bb980ee0b": "2030400000000000000000",
+ "0xec76f12e57a65504033f2c0bce6fc03bd7fa0ac4": "3580000000000000000000",
+ "0xd9f1b26408f0ec67ad1d0d6fe22e8515e1740624": "24000000000000000000",
+ "0x716ba01ead2a91270635f95f25bfaf2dd610ca23": "44750000000000000000000",
+ "0x42a98bf16027ce589c4ed2c95831e2724205064e": "10000000000000000000000",
+ "0x0f88aac9346cb0e7347fba70905475ba8b3e5ece": "10000000000000000000000",
+ "0x2d8c52329f38d2a2fa9cbaf5c583daf1490bb11c": "20000000000000000000",
+ "0x3cea302a472a940379dd398a24eafdbadf88ad79": "3000000000000000000000",
+ "0xa29d5bda74e003474872bd5894b88533ff64c2b5": "10000000000000000000000",
+ "0x2d23766b6f6b05737dad80a419c40eda4d77103e": "3820000000000000000000",
+ "0xb07249e055044a9155359a402937bbd954fe48b6": "100000000000000000000",
+ "0xf1e980c559a1a8e5e50a47f8fffdc773b7e06a54": "30104784000000000000000",
+ "0x8275cd684c3679d5887d03664e338345dc3cdde1": "15800000000000000000",
+ "0xb27c1a24204c1e118d75149dd109311e07c073ab": "3100000000000000000000",
+ "0x451b3699475bed5d7905f8905aa3456f1ed788fc": "2560000000000000000000",
+ "0x31ad4d9946ef09d8e988d946b1227f9141901736": "22880000000000000000000",
+ "0x52b8a9592634f7300b7c5c59a3345b835f01b95c": "2000000000000000000000",
+ "0xb161725fdcedd17952d57b23ef285b7e4b1169e8": "50071000000000000000",
+ "0x74fc5a99c0c5460503a13b0509459da19ce7cd90": "200000000000000000000",
+ "0xd99df7421b9382e42c89b006c7f087702a0757c0": "480000000000000000000",
+ "0x8a4f4a7f52a355ba105fca2072d3065fc8f7944b": "500000000000000000000",
+ "0x12316fc7f178eac22eb2b25aedeadf3d75d00177": "19999999000000000000000",
+ "0xf598db2e09a8a5ee7d720d2b5c43bb126d11ecc2": "200000000000000000000",
+ "0x37b8beac7b1ca38829d61ab552c766f48a10c32f": "400000000000000000000",
+ "0x851dc38adb4593729a76f33a8616dab6f5f59a77": "100000000000000000000",
+ "0xbf4096bc547dbfc4e74809a31c039e7b389d5e17": "3940000000000000000000",
+ "0x98d3731992d1d40e1211c7f735f2189afa0702e0": "8000000000000000000000",
+ "0x0f4073c1b99df60a1549d69789c7318d9403a814": "20000000000000000000000",
+ "0xa430995ddb185b9865dbe62539ad90d22e4b73c2": "10000000000000000000000",
+ "0x898c72dd736558ef9e4be9fdc34fef54d7fc7e08": "1000000000000000000000",
+ "0xf9b617f752edecae3e909fbb911d2f8192f84209": "2674000000000000000000",
+ "0xe1ae029b17e373cde3de5a9152201a14cac4e119": "99968000000000000000",
+ "0xd8e8474292e7a051604ca164c0707783bb2885e8": "13370000000000000000000",
+ "0xf476f2cb7208a32e051fd94ea8662992638287a2": "100000000000000000000",
+ "0x3a84e950ed410e51b7e8801049ab2634b285fea1": "18690000000000000000000",
+ "0x5b7784caea01799ca30227827667ce207c5cbc76": "2000000000000000000000",
+ "0x3af65b3e28895a4a001153391d1e69c31fb9db39": "3940000000000000000000",
+ "0x95fb5afb14c1ef9ab7d179c5c300503fd66a5ee2": "34225000000000000000",
+ "0xa8446c4781a737ac4328b1e15b8a0b3fbb0fd668": "21390500000000000000000",
+ "0x4888fb25cd50dbb9e048f41ca47d78b78a27c7d9": "17300000000000000000000",
+ "0x566c10d638e8b88b47d6e6a414497afdd00600d4": "99960000000000000000",
+ "0xbd47f5f76e3b930fd9485209efa0d4763da07568": "1000000000000000000000",
+ "0x1e1c6351776ac31091397ecf16002d979a1b2d51": "1400000000000000000000",
+ "0xedf603890228d7d5de9309942b5cad4219ef9ad7": "5000000000000000000000",
+ "0x1923cfc68b13ea7e2055803645c1e320156bd88d": "1337000000000000000000",
+ "0x8f8f37d0ad8f335d2a7101b41156b688a81a9cbe": "70000000000000000000",
+ "0x63334fcf1745840e4b094a3bb40bb76f9604c04c": "3978000000000000000000",
+ "0x001762430ea9c3a26e5749afdb70da5f78ddbb8c": "200000000000000000000",
+ "0x512116817ba9aaf843d1507c65a5ea640a7b9eec": "50000000000000000000",
+ "0x2961fb391c61957cb5c9e407dda29338d3b92c80": "999942000000000000000",
+ "0xfc2952b4c49fedd0bc0528a308495e6d6a1c71d6": "2000000000000000000000",
+ "0x13ec812284026e409bc066dfebf9d5a4a2bf801e": "1610000000000000000000",
+ "0xef463c2679fb279164e20c3d2691358773a0ad95": "2000000000000000000000",
+ "0x3aadf98b61e5c896e7d100a3391d3250225d61df": "234000000000000000000",
+ "0xe8137fc1b2ec7cc7103af921899b4a39e1d959a1": "1490000000000000000000",
+ "0xb1a2b43a7433dd150bb82227ed519cd6b142d382": "2738000000000000000000",
+ "0xc1f39bd35dd9cec337b96f47c677818160df37b7": "20000000000000000000",
+ "0xb587b44a2ca79e4bc1dd8bfdd43a207150f2e7e0": "630400000000000000000",
+ "0x41485612d03446ec4c05e5244e563f1cbae0f197": "970000000000000000000",
+ "0xa12623e629df93096704b16084be2cd89d562da4": "8500000000000000000000",
+ "0x3f2f381491797cc5c0d48296c14fd0cd00cdfa2d": "804000000000000000000",
+ "0x9470cc36594586821821c5c996b6edc83b6d5a32": "24000000000000000000",
+ "0x3605372d93a9010988018f9f315d032ed1880fa1": "500066000000000000000",
+ "0x12632388b2765ee4452b50161d1fffd91ab81f4a": "740000000000000000000",
+ "0x274a3d771a3d709796fbc4d5f48fce2fe38c79d6": "20000000000000000000",
+ "0xd60a52580728520df7546bc1e283291788dbae0c": "999910000000000000000",
+ "0x1ab53a11bcc63ddfaa40a02b9e186496cdbb8aff": "1996800000000000000000",
+ "0xc282e6993fbe7a912ea047153ffd9274270e285b": "139939000000000000000",
+ "0xa291e9c7990d552dd1ae16cebc3fca342cbaf1d1": "20000000000000000000000",
+ "0x5547fdb4ae11953e01292b7807fa9223d0e4606a": "98940000000000000000",
+ "0xbded11612fb5c6da99d1e30e320bc0995466141e": "400000000000000000000",
+ "0xb73b4ff99eb88fd89b0b6d57a9bc338e886fa06a": "32000000000000000000",
+ "0xb1c751786939bba0d671a677a158c6abe7265e46": "10000000000000000000000",
+ "0xe881bbbe69722d81efecaa48d1952a10a2bfac8f": "16000000000000000000000",
+ "0xfe96c4cd381562401aa32a86e65b9d52fa8aee27": "2640000000000000000000",
+ "0x683dba36f7e94f40ea6aea0d79b8f521de55076e": "140000000000000000000",
+ "0x5ac2908b0f398c0df5bac2cb13ca7314fba8fa3d": "199800000000000000000",
+ "0x8914a680a5aec5226d4baaec2e5552b44dd7c874": "100076000000000000000",
+ "0x041170f581de80e58b2a045c8f7c1493b001b7cb": "889800000000000000000",
+ "0x4665e47396c7db97eb2a03d90863d5d4ba319a94": "600000000000000000000",
+ "0xed4be04a052d7accb3dcce90319dba4020ab2c68": "37547947000000000000000",
+ "0x4b0619d9d8aa313a9531ac7dbe04ca0d6a5ad1b6": "2000000000000000000000",
+ "0xa21442ab05340ade68c915f3c3399b9955f3f7eb": "775000000000000000000",
+ "0x655934da8e744eaa3de34dbbc0894c4eda0b61f2": "200000000000000000000",
+ "0x6038740ae28d66ba93b0be08482b3205a0f7a07b": "316000000000000000000",
+ "0x99924a9816bb7ddf3fec1844828e9ad7d06bf4e6": "1760000000000000000000",
+ "0x6847825bdee8240e28042c83cad642f286a3bddc": "1500000000000000000000",
+ "0xa718aaad59bf395cba2b23e09b02fe0c89816247": "999600000000000000000",
+ "0x2c89f5fdca3d155409b638b98a742e55eb4652b7": "98500000000000000000000",
+ "0x1a7044e2383f8708305b495bd1176b92e7ef043a": "200000000000000000000",
+ "0x282e80a554875a56799fa0a97f5510e795974c4e": "1000000000000000000000",
+ "0xffb3bcc3196a8c3cb834cec94c34fed35b3e1054": "1340000000000000000000",
+ "0xd135794b149a18e147d16e621a6931f0a40a969a": "20000000000000000000000",
+ "0x6b94615db750656ac38c7e1cf29a9d13677f4e15": "12000000000000000000000",
+ "0xecbe425e670d39094e20fb5643a9d818eed236de": "5000000000000000000000",
+ "0x511e0efb04ac4e3ff2e6550e498295bfcd56ffd5": "668500000000000000000",
+ "0xff65511cada259260c1ddc41974ecaecd32d6357": "1760000000000000000000",
+ "0x9ffc5fe06f33f5a480b75aa94eb8556d997a16c0": "20000000000000000000",
+ "0x57df23bebdc65eb75feb9cb2fad1c073692b2baf": "4000000000000000000000",
+ "0x207ef80b5d60b6fbffc51f3a64b8c72036a5abbd": "6685000000000000000000",
+ "0xc573e841fa08174a208b060ccb7b4c0d7697127f": "668500000000000000000",
+ "0x411610b178d5617dfab934d293f512a93e5c10e1": "170000000000000000000",
+ "0x9991614c5baa47dd6c96874645f97add2c3d8380": "1970000000000000000000",
+ "0x2d3480bf0865074a72c7759ee5137b4d70c51ce9": "200000000000000000000",
+ "0x9d40e012f60425a340d82d03a1c757bfabc706fb": "169799000000000000000",
+ "0x47648bed01f3cd3249084e635d14daa9e7ec3c8a": "194000000000000000000",
+ "0xa5ff62222d80c013cec1a0e8850ed4d354dac16d": "207600000000000000000",
+ "0xf80d3619702fa5838c48391859a839fb9ce7160f": "1992800000000000000000",
+ "0x7c0f5e072043c9ee740242197e78cc4b98cdf960": "200000000000000000000",
+ "0xa40aa2bbce0c72b4d0dfffcc42715b2b54b01bfa": "1000000000000000000000",
+ "0x2eeed50471a1a2bf53ee30b1232e6e9d80ef866d": "20000000000000000000",
+ "0x0c2808b951ed9e872d7b32790fcc5994ae41ffdc": "102000000000000000000000",
+ "0x7f06c89d59807fa60bc60136fcf814cbaf2543bd": "10000000000000000000000",
+ "0x8d4b603c5dd4570c34669515fdcc665890840c77": "18200000000000000000",
+ "0xd5e5c135d0c4c3303934711993d0d16ff9e7baa0": "2000000000000000000000",
+ "0x241361559feef80ef137302153bd9ed2f25db3ef": "20000000000000000000000",
+ "0xdb63122de7037da4971531fae9af85867886c692": "277000000000000000000",
+ "0x417e4e2688b1fd66d821529e46ed4f42f8b3db3d": "2000000000000000000000",
+ "0x127db1cadf1b771cbd7475e1b272690f558c8565": "14000000000000000000000",
+ "0x48659d8f8c9a2fd44f68daa55d23a608fbe500dc": "2000000000000000000000",
+ "0xb3a64b1176724f5409e1414a3523661baee74b4a": "25610000000000000000",
+ "0xaa14422d6f0ae5a758194ed15780c838d67f1ee1": "28503824000000000000000",
+ "0xa0a0e65204541fca9b2fb282cd95138fae16f809": "10000000000000000000000",
+ "0xd2107b353726c3a2b46566eaa7d9f80b5d21dbe3": "20000000000000000000",
+ "0xe4cafb727fb5c6b70bb27533b8a9ccc9ef6888e1": "300443000000000000000",
+ "0x09f3f601f605441140586ce0656fa24aa5b1d9ae": "1539400000000000000000",
+ "0x87fcbe7c4193ffcb08143779c9bec83fe7fda9fc": "100275000000000000000",
+ "0x03ebc63fda6660a465045e235fbe6e5cf195735f": "141840000000000000000",
+ "0xbdbaf6434d40d6355b1e80e40cc4ab9c68d96116": "100000000000000000000",
+ "0x4e2225a1bb59bc88a2316674d333b9b0afca6655": "155000000000000000000",
+ "0x4dc3da13b2b4afd44f5d0d3189f444d4ddf91b1b": "2000000000000000000000",
+ "0x4ba8e0117fc0b6a3e56b24a3a58fe6cef442ff98": "5640000000000000000000",
+ "0x27146913563aa745e2588430d9348e86ea7c3510": "400000000000000000000",
+ "0x4c5afe40f18ffc48d3a1aec41fc29de179f4d297": "2000000000000000000000",
+ "0x8a810114b2025db9fbb50099a6e0cb9e2efa6bdc": "1910000000000000000000",
+ "0x2dee90a28f192d676a8773232b56f18f239e2fad": "18587970000000000000000",
+ "0x60676e92d18b000509c61de540e6c5ddb676d509": "1200000000000000000000",
+ "0x9bfc659c9c601ea42a6b21b8f17084ec87d70212": "10000000000000000000000",
+ "0x5d5d6e821c6eef96810c83c491468560ef70bfb5": "2000000000000000000000",
+ "0xd5787668c2c5175b01a8ee1ac3ecc9c8b2aba95a": "1999944000000000000000",
+ "0x33b336f5ba5edb7b1ccc7eb1a0d984c1231d0edc": "2000000000000000000000",
+ "0x3abb8adfc604f48d5984811d7f1d52fef6758270": "4475000000000000000000",
+ "0x980a84b686fc31bdc83c221058546a71b11f838a": "779471000000000000000",
+ "0x0b507cf553568daaf65504ae4eaa17a8ea3cdbf5": "2000000000000000000000",
+ "0x896009526a2c7b0c09a6f63a80bdf29d9c87de9c": "3462830000000000000000",
+ "0x9696052138338c722f1140815cf7749d0d3b3a74": "500000000000000000000",
+ "0x3831757eae7557cb8a37a4b10644b63e4d3b3c75": "200000000000000000000",
+ "0x62dc72729024375fc37cbb9c7c2393d10233330f": "2000000000000000000000",
+ "0x44098866a69b68c0b6bc168229b9603587058967": "188000000000000000000",
+ "0x25adb8f96f39492c9bb47c5edc88624e46075697": "26740000000000000000000",
+ "0xfd4de8e3748a289cf7d060517d9d38388db01fb8": "250000000000000000000",
+ "0x6be7595ea0f068489a2701ec4649158ddc43e178": "2000000000000000000000",
+ "0xd402b4f6a099ebe716cb14df4f79c0cd01c6071b": "2000000000000000000000",
+ "0xa07682000b1bcf3002f85c80c0fa2949bd1e82fd": "4000000000000000000000",
+ "0xeb4f00e28336ea09942588eeac921811c522143c": "2000000000000000000000",
+ "0x8f31c7005197ec997a87e69bec48649ab94bb2a5": "4000000000000000000000",
+ "0xe7fd8fd959aed2767ea7fa960ce1db53af802573": "1000000000000000000000",
+ "0xa8ef9ad274436042903e413c3b0c62f5f52ed584": "10000000000000000000000",
+ "0xd83ad260e9a6f432fb6ea28743299b4a09ad658c": "2000000000000000000000",
+ "0xb5c816a8283ca4df68a1a73d63bd80260488df08": "200000000000000000000",
+ "0xd7d3c75920590438b82c3e9515be2eb6ed7a8b1a": "60000000000000000000000",
+ "0xaf3cb5965933e7dad883693b9c3e15beb68a4873": "2000000000000000000000",
+ "0x6e899e59a9b41ab7ea41df7517860f2acb59f4fd": "20000000000000000000000",
+ "0x527a8ca1268633a6c939c5de1b929aee92aeac8d": "900000000000000000000",
+ "0x1680cec5021ee93050f8ae127251839e74c1f1fd": "13098657000000000000000",
+ "0xff7843c7010aa7e61519b762dfe49124a76b0e4e": "933580000000000000000000",
+ "0x140fba58dbc04803d84c2130f01978f9e0c73129": "400000000000000000000",
+ "0x0261ad3a172abf1315f0ffec3270986a8409cb25": "203500000000000000000",
+ "0xab5a79016176320973e8cd38f6375530022531c0": "1000000000000000000000",
+ "0xfca73eff8771c0103ba3cc1a9c259448c72abf0b": "1000000000000000000000",
+ "0x07d41217badca5e0e60327d845a3464f0f27f84a": "4000000000000000000000",
+ "0x2c1c19114e3d6de27851484b8d2715e50f8a1065": "100000000000000000000",
+ "0xabd21eff954fc6a7de26912a7cbb303a6607804e": "1517000000000000000000",
+ "0xf303d5a816affd97e83d9e4dac2f79072bb0098f": "960000000000000000000",
+ "0x114cfefe50170dd97ae08f0a44544978c599548d": "863000000000000000000",
+ "0x647b85044df2cf0b4ed4882e88819fe22ae5f793": "1000032000000000000000",
+ "0x1b130d6fa51d5c48ec8d1d52dc8a227be8735c8a": "2000000000000000000000",
+ "0x0d9d3f9bc4a4c6efbd59679b69826bc1f63d9916": "600000000000000000000",
+ "0xc765e00476810947816af142d46d2ee7bca8cc4f": "500000000000000000000",
+ "0xb57b04fa23d1203fae061eac4542cb60f3a57637": "191000000000000000000",
+ "0xe192489b85a982c1883246d915b229cb13207f38": "5000000000000000000000",
+ "0x5f483ffb8f680aedf2a38f7833afdcde59b61e4b": "2000000000000000000000",
+ "0xb46d1182e5aacaff0d26b2fcf72f3c9ffbcdd97d": "3139000000000000000000",
+ "0x59c7f785c93160e5807ed34e5e534bc6188647a7": "640000000000000000000",
+ "0x18e4ce47483b53040adbab35172c01ef64506e0c": "9000000000000000000000",
+ "0x296d66b521571a4e4103a7f562c511e6aa732d81": "668500000000000000000",
+ "0xbcd99edc2160f210a05e3a1fa0b0434ced00439b": "2000000000000000000000",
+ "0xf14f0eb86db0eb68753f16918e5d4b807437bd3e": "200000000000000000000",
+ "0x60d5667140d12614b21c8e5e8a33082e32dfcf23": "20000000000000000000000",
+ "0x8ccabf25077f3aa41545344d53be1b2b9c339000": "1695400000000000000000",
+ "0x8cc0d7c016fa7aa950114aa1db094882eda274ea": "159800000000000000000",
+ "0xc71145e529c7a714e67903ee6206e4c3042b6727": "1430000000000000000000",
+ "0xc5e9939334f1252ed2ba26814487dfd2982b3128": "70000000000000000000",
+ "0xf09b3e87f913ddfd57ae8049c731dba9b636dfc3": "608000000000000000000",
+ "0x4349225a62f70aea480a029915a01e5379e64fa5": "2598000000000000000000",
+ "0x666b4f37d55d63b7d056b615bb74c96b3b01991a": "4000000000000000000000",
+ "0x8bd6b1c6d74d010d1008dba6ef835d4430b35c32": "50000000000000000000",
+ "0x7363cd90fbab5bb8c49ac20fc62c398fe6fb744c": "2000000000000000000000",
+ "0xb7479dab5022c4d5dbaaf8de171b4e951dd1a457": "80000000000000000000",
+ "0x5a5468fa5ca226c7532ecf06e1bc1c45225d7ec9": "1910000000000000000000",
+ "0x32a20d028e2c6218b9d95b445c771524636a22ef": "9500000000000000000000",
+ "0x1bd28cd5c78aee51357c95c1ef9235e7c18bc854": "2000000000000000000000",
+ "0x693492a5c51396a482881669ccf6d8d779f00951": "345827000000000000000",
+ "0xbd723b289a7367b6ece2455ed61edb49670ab9c4": "4999995000000000000000",
+ "0x1be3542c3613687465f15a70aeeb81662b65cca8": "2000000000000000000000",
+ "0x5803e68b34da121aef08b602badbafb4d12481ca": "18000000000000000000000",
+ "0x9ac907ee85e6f3e223459992e256a43fa08fa8b2": "10000000000000000000000",
+ "0x833b6a8ec8da408186ac8a7d2a6dd61523e7ce84": "16000000000000000000000",
+ "0x64628c6fb8ec743adbd87ce5e018d531d9210437": "26740000000000000000",
+ "0x566c28e34c3808d9766fe8421ebf4f2b1c4f7d77": "1970000000000000000000",
+ "0x171ad9a04bedc8b861e8ed4bddf5717813b1bb48": "400000000000000000000",
+ "0x4f85bc1fc5cbc9c001e8f1372e07505370d8c71f": "940000000000000000000",
+ "0x6d2f976734b9d0070d1883cf7acab8b3e4920fc1": "10000000000000000000000",
+ "0x357a02c0a9dfe287de447fb67a70ec5b62366647": "26740000000000000000",
+ "0x44a01fb04ac0db2cce5dbe281e1c46e28b39d878": "1999944000000000000000",
+ "0x3630c5e565ceaa8a0f0ffe32875eae2a6ce63c19": "170016000000000000000",
+ "0x334340ee4b9cdc81f850a75116d50ee9b69825bf": "2000000000000000000000",
+ "0xc0afb7d8b79370cfd663c68cc6b9702a37cd9eff": "1000000000000000000000",
+ "0x2016895df32c8ed5478269468423aea7b7fbce50": "20000000000000000000",
+ "0x1e2fe4e4a77d141ff49a0c7fbc95b0a2b283eeeb": "2000000000000000000000",
+ "0x260df8943a8c9a5dba7945327fd7e0837c11ad07": "200000000000000000000",
+ "0x32fbeed6f626fcdfd51acafb730b9eeff612f564": "2000000000000000000000",
+ "0x9bd88068e13075f3a8cac464a5f949d6d818c0f6": "6000000000000000000000",
+ "0xab4572fbb1d72b575d69ec6ad17333873e8552fc": "1999942000000000000000",
+ "0xe44ea51063405154aae736be2bf1ee3b9be639ae": "4000000000000000000000",
+ "0x617f20894fa70e94a86a49cd74e03238f64d3cd9": "5000057000000000000000",
+ "0x3e914e3018ac00449341c49da71d04dfeeed6221": "4000000000000000000000",
+ "0x590181d445007bd0875aaf061c8d51153900836a": "2000000000000000000000",
+ "0x27987110221a880826adb2e7ab5eca78c6e31aec": "4000000000000000000000",
+ "0x06618e9d5762df62028601a81d4487d6a0ecb80e": "1337000000000000000000",
+ "0x8cc652dd13e7fe14dabbb36d5d320db9ffee8a54": "1790000000000000000000",
+ "0x8973aefd5efaee96095d9e288f6a046c97374b43": "141000000000000000000",
+ "0xdbd51cdf2c3bfacdff106221de2e19ad6d420414": "1760000000000000000000",
+ "0x25697ef20cccaa70d32d376f8272d9c1070c3d78": "200000000000000000000",
+ "0x0726c42e00f45404836eb1e280d073e7059687f5": "1623331000000000000000",
+ "0x5e0785532c7723e4c0af9357d5274b73bdddddde": "25000088000000000000000",
+ "0x38430e931d93be01b4c3ef0dc535f1e0a9610063": "10000000000000000000000",
+ "0x143d536b8b1cb84f56a39e0bc81fd5442bcacce1": "100000000000000000000",
+ "0x5c6d041da7af4487b9dc48e8e1f60766d0a56dbc": "1457800000000000000000",
+ "0xf9bfb59d538afc4874d4f5941b08c9730e38e24b": "40000000000000000000",
+ "0x83dbfd8eda01d0de8e158b16d0935fc2380a5dc7": "600000000000000000000",
+ "0x0e6cd664ad9c1ed64bf98749f40644b626e3792c": "60000000000000000000000",
+ "0xce2e0da8934699bb1a553e55a0b85c169435bea3": "4999962000000000000000",
+ "0xa39bfee4aec9bd75bd22c6b672898ca9a1e95d32": "10000000000000000000000",
+ "0x1bc44c8761231ba1f11f5faa40fa669a013e12ce": "203586000000000000000",
+ "0x68809af5d532a11c1a4d6e32aac75c4c52b08ead": "10000000000000000000000",
+ "0x80cc21bd99f39005c58fe4a448909220218f66cb": "1000072000000000000000",
+ "0x1080c1d8358a15bc84dac8253c6883319020df2c": "2674000000000000000000",
+ "0x9eaf6a328a4076024efa6b67b48b21eedcc0f0b8": "158000000000000000000",
+ "0x1e7b5e4d1f572becf2c00fc90cb4767b4a6e33d4": "112970000000000000000",
+ "0xacbd185589f7a68a67aa4b1bd65077f8c64e4e21": "200000000000000000000",
+ "0xff78541756ab2b706e0d70b18adb700fc4f1643d": "43250000000000000000000",
+ "0x7f0ec3db804692d4d1ea3245365aab0590075bc4": "4000000000000000000000",
+ "0x4a918032439159bb315b6725b6830dc83697739f": "343800000000000000000",
+ "0xbc1b021a78fde42d9b5226d6ec26e06aa3670090": "80000000000000000000",
+ "0x2f2523cc834f0086052402626296675186a8e582": "16000000000000000000000",
+ "0x9db2e15ca681f4c66048f6f9b7941ed08b1ff506": "4000000000000000000000",
+ "0x20b9a9e6bd8880d9994ae00dd0b9282a0beab816": "500000000000000000000",
+ "0x3bddbc8134f77d55597fc97c26d26698090604eb": "13700000000000000000",
+ "0x80c3a9f695b16db1597286d1b3a8b7696c39fa27": "100000000000000000000",
+ "0x53194d8afa3e883502767edbc30586af33b114d3": "2000000000000000000000",
+ "0xe2efd0a9bc407ece03d67e8ec8e9d283f48d2a49": "12280000000000000000000",
+ "0x1cb450920078aab2317c7db3b38af7dd298b2d41": "340000000000000000000",
+ "0xca8276c477b4a07b80107b843594189607b53bec": "6000000000000000000000",
+ "0x147f4210ab5804940a0b7db8c14c28396b62a6bf": "2000000000000000000000",
+ "0xd3df3b53cb3b4755de54e180451cc44c9e8ae0aa": "659801000000000000000",
+ "0xf7c708015071d4fb0a3a2a09a45d156396e3349e": "3000000000000000000000",
+ "0xa8cafac32280d021020bf6f2a9782883d7aabe12": "100000000000000000000",
+ "0x399aa6f5d078cb0970882bc9992006f8fbdf3471": "1000000000000000000000",
+ "0x15669180dee29598869b08a721c7d24c4c0ee63f": "1000000000000000000000",
+ "0xbba8ab22d2fedbcfc63f684c08afdf1c175090b5": "99091000000000000000",
+ "0x5e5a441974a83d74c687ebdc633fb1a49e7b1ad7": "3000000000000000000000",
+ "0x98b769cc305cecfb629a00c907069d7ef9bc3a12": "26000000000000000000",
+ "0xc820c711f07705273807aaaa6de44d0e4b48be2e": "155000000000000000000",
+ "0x12aa7d86ddfbad301692feac8a08f841cb215c37": "137000000000000000000",
+ "0x6ff5d361b52ad0b68b1588607ec304ae5665fc98": "1940000000000000000000",
+ "0x2382a9d48ec83ea3652890fd0ee79c907b5b2dc1": "133700000000000000000",
+ "0xb2a144b1ea67b9510f2267f9da39d3f93de26642": "2000000000000000000000",
+ "0xb3e20eb4de18bd060221689894bee5aeb25351ee": "73535000000000000000",
+ "0x101a0a64f9afcc448a8a130d4dfcbee89537d854": "15200000000000000000000",
+ "0x1b826fb3c012b0d159e294ba5b8a499ff3c0e03c": "2000000000000000000000",
+ "0xaafb7b013aa1f8541c7e327bf650adbd194c208f": "1358000000000000000000",
+ "0x96eb523e832f500a017de13ec27f5d366c560eff": "307600000000000000000",
+ "0xc7bf17c4c11f98941f507e77084fffbd2dbd3db5": "1000000000000000000000",
+ "0x840ec83ea93621f034e7bb3762bb8e29ded4c479": "2500000000000000000000",
+ "0x0e9c511864a177f49be78202773f60489fe04e52": "6000000000000000000000",
+ "0xf6f1a44309051c6b25e47dff909b179bb9ab591c": "1940000000000000000000",
+ "0x63fe6bcc4b8a9850abbe75803730c932251f145b": "18200000000000000000",
+ "0xf88b58db37420b464c0be88b45ee2b95290f8cfa": "40000000000000000000",
+ "0x9d4d321177256ebd9afbda304135d517c3dc5693": "616000000000000000000",
+ "0x8c1fbe5f0aea359c5aa1fa08c8895412ca8e05a6": "1000000000000000000000",
+ "0xcb0dd7cf4e5d8661f6028943a4b9b75c914436a7": "120000000000000000000000",
+ "0xa3979a92760a135adf69d72f75e167755f1cb8c3": "100000000000000000000",
+ "0xca22cda3606da5cad013b8074706d7e9e721a50c": "6816200000000000000000",
+ "0x157559adc55764cc6df79323092534e3d6645a66": "6000000000000000000000",
+ "0x4f52ad6170d25b2a2e850eadbb52413ff2303e7f": "3040000000000000000000",
+ "0xeed28c3f068e094a304b853c950a6809ebcb03e0": "17300000000000000000000",
+ "0x2e47f287f498233713850d3126823cc67dcee255": "14600000000000000000",
+ "0x6c359e58a13d4578a9338e335c67e7639f5fb4d7": "218000000000000000000",
+ "0x4968a2cedb457555a139295aea28776e54003c87": "10092310000000000000000",
+ "0x4041374b0feef4792e4b33691fb86897a4ff560c": "365000000000000000000",
+ "0x83e48055327c28b5936fd9f4447e73bdb2dd3376": "2674000000000000000000",
+ "0x32b7feebc5c59bf65e861c4c0be42a7611a5541a": "2212000000000000000000",
+ "0x21a6db6527467bc6dad54bc16e9fe2953b6794ed": "14000000000000000000000",
+ "0xe8ead1bb90ccc3aea2b0dcc5b58056554655d1d5": "7760000000000000000000",
+ "0x7a94b19992ceb8ce63bc92ee4b5aded10c4d9725": "16770000000000000000000",
+ "0x90e93e4dc17121487952333614002be42356498e": "1910000000000000000000",
+ "0xaab00abf5828d7ebf26b47ceaccdb8ba03325166": "10000000000000000000000",
+ "0x0a9ab2638b1cfd654d25dab018a0aebddf85fd55": "21801000000000000000",
+ "0xb12ed07b8a38ad5506363fc07a0b6d799936bdaf": "10000000000000000000000",
+ "0xf4a9d00cefa97b7a58ef9417fc6267a5069039ee": "21800000000000000000",
+ "0x04a1cada1cc751082ff8da928e3cfa000820a9e9": "40000000000000000000",
+ "0x9018cc1f48d2308e252ab6089fb99a7c1d569410": "200000000000000000000",
+ "0x895d694e880b13ccd0848a86c5ce411f88476bbf": "199955000000000000000",
+ "0x40a7f72867a7dc86770b162b7557a434ed50cce9": "1000000000000000000000",
+ "0x467ea10445827ef1e502daf76b928a209e0d4032": "2000000000000000000000",
+ "0x7553aa23b68aa5f57e135fe39fdc235eaca8c98c": "1000000000000000000000",
+ "0x31b43b015d0081643c6cda46a7073a6dfdbca825": "50019600000000000000000",
+ "0xd82fd9fdf6996bedad2843159c06f37e0924337d": "1688800000000000000000",
+ "0x24a4eb36a7e498c36f99975c1a8d729fd6b305d7": "258000000000000000000",
+ "0x91d66ea6288faa4b3d606c2aa45c7b6b8a252739": "2000000000000000000000",
+ "0x83a402438e0519773d5448326bfb61f8b20cf52d": "1520000000000000000000",
+ "0xc2fafdd30acb6d6706e9293cb02641f9edbe07b5": "1494224000000000000000",
+ "0x79dba256472db4e058f2e4cdc3ea4e8a42773833": "1460000000000000000000",
+ "0x498abdeb14c26b7b7234d70fceaef361a76dff72": "3000000000000000000000",
+ "0x7b73242d75ca9ad558d650290df17692d54cd8b8": "2000200000000000000000",
+ "0x6ec3659571b11f889dd439bcd4d67510a25be57e": "123000000000000000000",
+ "0xab098633eeee0ccefdf632f9575456f6dd80fc86": "200000000000000000000000",
+ "0xf4a51fce4a1d5b94b0718389ba4e7814139ca738": "300000000000000000000",
+ "0x8f561b41b209f248c8a99f858788376250609cf3": "1700000000000000000000",
+ "0x05d0f4d728ebe82e84bf597515ad41b60bf28b39": "4200000000000000000000",
+ "0xdfdf43393c649caebe1bb18059decb39f09fb4e8": "400000000000000000000",
+ "0x0089508679abf8c71bf6781687120e3e6a84584d": "1800000000000000000000",
+ "0x80907f593148b57c46c177e23d25abc4aae18361": "100000000000000000000",
+ "0x94fcceadfe5c109c5eaeaf462d43873142c88e22": "4800000000000000000000",
+ "0xe89249738b7eced7cb666a663c49cbf6de8343ea": "2000000000000000000000",
+ "0x23c99ba087448e19c9701df66e0cab52368331fa": "2000000000000000000000",
+ "0xa68e0c30cba3bc5a883e540320f999c7cd558e5c": "1799869000000000000000",
+ "0x88888a57bd9687cbf950aeeacf9740dcc4d1ef59": "1820000000000000000000",
+ "0xe9b36fe9b51412ddca1a521d6e94bc901213dda8": "10000000000000000000000",
+ "0xa9145046fa3628cf5fd4c613927be531e6db1fdd": "112000000000000000000",
+ "0xe82c58c579431b673546b53a86459acaf1de9b93": "1000000000000000000000",
+ "0xbd6a474d66345bcdd707594adb63b30c7822af54": "4000000000000000000000",
+ "0x6a6159074ab573e0ee581f0f3df2d6a594629b74": "310000000000000000000",
+ "0x2e7f465520ec35cc23d68e75651bb6689544a196": "1050049000000000000000",
+ "0xac6d02e9a46b379fac4ac9b1d7b5d47bc850ce16": "1760000000000000000000",
+ "0xbd59094e074f8d79142ab1489f148e32151f2089": "20000000000000000000",
+ "0x0ba6e46af25a13f57169255a34a4dac7ce12be04": "500000000000000000000",
+ "0x35145f620397c69cb8e00962961f0f4886643989": "6000000000000000000000",
+ "0xd84b922f7841fc5774f00e14604ae0df42c8551e": "4011000000000000000000",
+ "0x44232ff66ddad1fd841266380036afd7cf7d7f42": "200000000000000000000",
+ "0x516954025fca2608f47da81c215eedfd844a09ff": "382000000000000000000",
+ "0xe5aa0b833bb916dc19a8dd683f0ede241d988eba": "3000000000000000000000",
+ "0x80ea1acc136eca4b68c842a95adf6b7fee7eb8a2": "4000000000000000000000",
+ "0x98a0e54c6d9dc8be96276cebf4fec460f6235d85": "1969803000000000000000",
+ "0x91620f3eb304e813d28b0297556d65dc4e5de5aa": "3820000000000000000000",
+ "0x7bb984c6dbb9e279966afafda59c01d02627c804": "8050000000000000000000",
+ "0x41f489a1ec747bc29c3e5f9d8db97877d4d1b4e9": "133700000000000000000",
+ "0x8dbc3e6cb433e194f40f82b40faadb1f8b856116": "1910000000000000000000",
+ "0x889da40fb1b60f9ea9bd7a453e584cf7b1b4d9f7": "40000000000000000000",
+ "0xdebbdd831e0f20ae6e378252decdf92f7cf0c658": "2000000000000000000000",
+ "0xa22ade0ddb5c6ef8d0cd8de94d82b11082cb2e91": "1020000000000000000000",
+ "0x823219a25976bb2aa4af8bad41ac3526b493361f": "2000000000000000000000",
+ "0x6d39a9e98f81f769d73aad2cead276ac1387babe": "394000000000000000000",
+ "0x751abcb6cc033059911815c96fd191360ab0442d": "8000000000000000000000",
+ "0x64d80c3b8ba68282290b75e65d8978a15a87782c": "1970000000000000000000",
+ "0x6ba8f7e25fc2d871618e24e40184199137f9f6aa": "400020000000000000000",
+ "0x25a74c2ac75dc8baa8b31a9c7cb4b7829b2456da": "2000000000000000000000",
+ "0x0f7b61c59b016322e8226cafaee9d9e76d50a1b3": "4000000000000000000000",
+ "0x7526e482529f0a14eec98871dddd0e721b0cd9a2": "20000000000000000000",
+ "0x071dd90d14d41f4ff7c413c24238d3359cd61a07": "36400000000000000000000",
+ "0xa986762f7a4f294f2e0b173279ad2c81a2223458": "20000000000000000000",
+ "0xe667f652f957c28c0e66d0b63417c80c8c9db878": "601650000000000000000",
+ "0x7b98e23cb96beee80a168069ebba8f20edd55ccf": "214500000000000000000",
+ "0x2d8e5bb8d3521695c77e7c834e0291bfacee7408": "1970000000000000000000",
+ "0xf23d01589eb12d439f7448ff54307529f191858d": "2000000000000000000000",
+ "0xabd9605b3e91acfd777830d16463478ae0fc7720": "133700000000000000000",
+ "0xeabb90d37989aab31feae547e0e6f3999ce6a35d": "2000000000000000000000",
+ "0x0abfb39b11486d79572866195ba26c630b6784db": "121500000000000000000000",
+ "0xd56a144d7af0ae8df649abae535a15983aa04d02": "5000000000000000000000",
+ "0x998c1f93bcdb6ff23c10d0dc924728b73be2ff9f": "1002750000000000000000",
+ "0xbc62b3096a91e7dc11a1592a293dd2542150d751": "1000000000000000000000",
+ "0x0c8f66c6017bce5b20347204b602b743bad78d60": "2000000000000000000000",
+ "0x4c5b3dc0e2b9360f91289b1fe13ce12c0fbda3e1": "2000000000000000000000",
+ "0xb44605552471a6eee4daab71ff3bb41326d473e0": "839200000000000000000",
+ "0xfc3d226bb36a58f526568857b0bb12d109ec9301": "2000000000000000000000",
+ "0xadc8228ef928e18b2a807d00fb3c6c79cd1d9e96": "22800000000000000000",
+ "0x9df32a501c0b781c0281022f42a1293ffd7b892a": "9000000000000000000000",
+ "0xe7da609d40cde80f00ce5b4ffb6aa9d0b03494fc": "1000000000000000000000",
+ "0x9b64d3cd8d2b73f66841b5c46bb695b88a9ab75d": "20769000000000000000",
+ "0x8e9c08f738661f9676236eff82ba6261dd3f4822": "100000000000000000000",
+ "0xdeb97254474c0d2f5a7970dcdb2f52fb1098b896": "1000000000000000000000",
+ "0xb4256273962bf631d014555cc1da0dcc31616b49": "2000000000000000000000",
+ "0x23abd9e93e7957e5b636be6579051c15e5ce0b0e": "17188400000000000000000",
+ "0x382591e7217b435e8e884cdbf415fe377a6fe29e": "8022000000000000000000",
+ "0xf17adb740f45cbbde3094e7e13716f8103f563bd": "2000000000000000000000",
+ "0x61ed5596c697207f3d55b2a51aa7d50f07fa09e8": "2000000000000000000000",
+ "0x788e809741a3b14a22a4b1d937c82cfea489eebe": "7000000000000000000000",
+ "0x992646ac1acaabf5ddaba8f9429aa6a94e7496a7": "1000110000000000000000",
+ "0x51296f5044270d17707646129c86aad1645eadc1": "1337133000000000000000",
+ "0x6ee8aad7e0a065d8852d7c3b9a6e5fdc4bf50c00": "20000000000000000000",
+ "0x30db6b9b107e62102f434a9dd0960c2021f5ce4c": "599742000000000000000",
+ "0x63fc93001305adfbc9b85d29d9291a05f8f1410b": "1000000000000000000000",
+ "0xdf6ed6006a6abe886ed33d95a4de28fc12183927": "910000000000000000000",
+ "0x4745ab181a36aa8cbf2289d0c45165bc7ebe2381": "39400000000000000000",
+ "0x7bb0fdf5a663b5fba28d9c902af0c811e252f298": "200000000000000000000",
+ "0xe0ff0bd9154439c4a5b7233e291d7d868af53f33": "396110000000000000000",
+ "0x09261f9acb451c3788844f0c1451a35bad5098e3": "8664000000000000000000",
+ "0x2813d263fc5ff2479e970595d6b6b560f8d6d6d1": "2000000000000000000000",
+ "0x2cd19694d1926a0fa9189edebafc671cf1b2caa5": "1000000000000000000000",
+ "0x05336e9a722728d963e7a1cf2759fd0274530fca": "915583000000000000000",
+ "0xe5b7af146986c0ff8f85d22e6cc334077d84e824": "2000000000000000000000",
+ "0x3e4fbd661015f6461ed6735cefef01f31445de3a": "16200000000000000000000",
+ "0x4f5df5b94357de948604c51b7893cddf6076baad": "3760000000000000000000",
+ "0x9567a0de811de6ff095b7ee64e7f1b83c2615b80": "267400000000000000000",
+ "0x955db3b74360b9a268677e73cea821668af6face": "30000000000000000000000",
+ "0x3e040d40cb80ba0125f3b15fdefcc83f3005da1b": "1038000000000000000000",
+ "0x43f470ed659e2991c375957e5ddec5bd1d382231": "100000000000000000000",
+ "0x047f9bf1529daf87d407175e6f171b5e59e9ff3e": "650000000000000000000",
+ "0x15e3b584056b62c973cf5eb096f1733e54c15c91": "936702000000000000000",
+ "0xc03de42a109b657a64e92224c08dc1275e80d9b2": "20000000000000000000",
+ "0xe4fc13cfcbac1b17ce7783acd423a845943f6b3a": "20000000000000000000",
+ "0x65ff874fafce4da318d6c93d57e2c38a0d73e820": "1000160000000000000000",
+ "0x8b997dbc078ad02961355da0a159f2927ed43d64": "197000000000000000000",
+ "0x2f5080b83f7e2dc0a1dd11b092ad042bff788f4c": "3338355000000000000000",
+ "0x1b3920d001c43e72b24e7ca46f0fd6e0c20a5ff2": "2000000000000000000000",
+ "0x5ade77fd81c25c0af713b10702768c1eb2f975e7": "20000000000000000000",
+ "0xacaaddcbf286cb0e215dda55598f7ff0f4ada5c6": "1000000000000000000000",
+ "0x64e0217a5b38aa40583625967fa9883690388b6f": "200000000000000000000",
+ "0xae648155a658370f929be384f7e001047e49dd46": "13561000000000000000000",
+ "0xf7c1b443968b117b5dd9b755572fcd39ca5ec04b": "456082000000000000000",
+ "0xde027efbb38503226ed871099cb30bdb02af1335": "1000000000000000000000",
+ "0x49cf1e54be363106b920729d2d0ba46f0867989a": "268000000000000000000",
+ "0xe7f4d7fe6f561f7fa1da3005fd365451ad89df89": "200000000000000000000",
+ "0xb036916bdacf94b69e5a8a65602975eb026104dd": "20000000000000000000",
+ "0xe923c06177b3427ea448c0a6ff019b54cc548d95": "36281000000000000000",
+ "0xad927e03d1599a78ca2bf0cad2a183dceb71eac0": "1970000000000000000000",
+ "0xef39ca9173df15531d73e6b72a684b51ba0f2bb4": "1598000000000000000000",
+ "0x6443b8ae639de91cf73c5ae763eeeed3ddbb9253": "2000000000000000000000",
+ "0x8026435aac728d497b19b3e7e57c28c563954f2b": "1730000000000000000000",
+ "0xed327a14d5cfadd98103fc0999718d7ed70528ea": "1440000000000000000000",
+ "0x38a3dccf2fcfe0c91a2624bd0cbf88ee4a076c33": "2000000000000000000000",
+ "0xf0b1f9e27832c6de6914d70afc238c749995ace4": "2000000000000000000000",
+ "0x770d98d31b4353fceee8560c4ccf803e88c0c4e0": "600000000000000000000",
+ "0xba1f0e03cb9aa021f4dcebfa94e5c889c9c7bc9e": "32200000000000000000000",
+ "0x233842b1d0692fd11140cf5acda4bf9630bae5f8": "2000000000000000000000",
+ "0xb5dd50a15da34968890a53b4f13fe1af081baaaa": "4000000000000000000000",
+ "0x72072a0ef1cff3d567cdd260e708ddc11cbc9a31": "100000000000000000000",
+ "0x81a88196fac5f23c3e12a69dec4b880eb7d97310": "2000000000000000000000",
+ "0x6c63f84556d290bfcd99e434ee9997bfd779577a": "2000000000000000000000",
+ "0x5f167aa242bc4c189adecb3ac4a7c452cf192fcf": "1999980000000000000000",
+ "0x445cb8de5e3df520b499efc980f52bff40f55c76": "2000000000000000000000",
+ "0xaec27ce2133e82d052520afb5c576d9f7eb93ed2": "65232380000000000000000",
+ "0x07dc2bf83bc6af19a842ffea661af5b41b67fda1": "1500000000000000000000",
+ "0xfebd48d0ffdbd5656cd5e686363a61145228f279": "2800000000000000000000",
+ "0xa86db07d9f812f4796622d40e03d135874a88a74": "20000000000000000000",
+ "0x5413c97ffa4a6e2a7bba8961dc9fce8530a787d7": "1000000000000000000000",
+ "0xe2ff9ee4b6ecc14141cc74ca52a9e7a2ee14d908": "1400000000000000000000",
+ "0x2e8eb30a716e5fe15c74233e039bfb1106e81d12": "100000000000000000000",
+ "0xfd88d114220f081cb3d5e15be8152ab07366576a": "300000000000000000000",
+ "0xe408fceaa1b98f3c640f48fcba39f056066d6308": "10000000000000000000000",
+ "0x057dd29f2d19aa3da42327ea50bce86ff5c911d9": "4000000000000000000000",
+ "0xed1065dbcf9d73c04ffc7908870d881468c1e132": "2000000000000000000000",
+ "0xbbc9d8112e5beb02dd29a2257b1fe69b3536a945": "2000000000000000000000",
+ "0x79c1be19711f73bee4e6316ae7549459aacea2e0": "400000000000000000000",
+ "0x1bcf3441a866bdbe963009ce33c81cbb0261b02c": "182000000000000000000",
+ "0xe2e26e4e1dcf30d048cc6ecf9d51ec1205a4e926": "4000000000000000000000",
+ "0x77701e2c493da47c1b58f421b5495dee45bea39b": "6068279000000000000000",
+ "0x37a05aceb9395c8635a39a7c5d266ae610d10bf2": "30000000000000000000000",
+ "0xc6355ec4768c70a49af69513cd83a5bca7e3b9cd": "6000000000000000000000",
+ "0xe3c0c128327a9ad80148139e269773428e638cb0": "2000000000000000000000",
+ "0xf7f4898c4c526d955f21f055cb6e47b915e51964": "2288000000000000000000",
+ "0x29824e94cc4348bc963279dcdf47391715324cd3": "1940000000000000000000",
+ "0xeaa45cea02d87d2cc8fda9434e2d985bd4031584": "1920750000000000000000",
+ "0xe08b9aba6bd9d28bc2056779d2fbf0f2855a3d9d": "2000000000000000000000",
+ "0x87c498170934b8233d1ad1e769317d5c475f2f40": "1015200000000000000000",
+ "0x352d29a26e8a41818181746467f582e6e84012e0": "6000000000000000000000",
+ "0x403220600a36f73f24e190d1edb2d61be3f41354": "304000000000000000000",
+ "0x0a48296f7631708c95d2b74975bc4ab88ac1392a": "5000000000000000000000",
+ "0xffe0e997f1977a615f5a315af413fd4869343ba0": "100076000000000000000",
+ "0xca66b2280fa282c5b67631ce552b62ee55ad8474": "1969488000000000000000",
+ "0x2b6ed29a95753c3ad948348e3e7b1a251080ffb9": "250000000000000000000000",
+ "0x492e70f04d18408cb41e25603730506b35a2876b": "39400000000000000000",
+ "0x0e6baaa3deb989f289620076668618e9ac332865": "200000000000000000000",
+ "0xb753a75f9ed10b21643a0a3dc0517ac96b1a4068": "401800000000000000000",
+ "0x3ad915d550b723415620f5a9b5b88a85f382f035": "1000000000000000000000",
+ "0xc992be59c6721caf4e028f9e8f05c25c55515bd4": "20000000000000000000",
+ "0x02b643d6fabd437a851accbe79abb7fde126dccf": "7200000000000000000000",
+ "0x88797e58675ed5cc4c19980783dbd0c956085153": "2000000000000000000000",
+ "0xac142eda1157b9a9a64390df7e6ae694fac98905": "200000000000000000000",
+ "0x656579daedd29370d9b737ee3f5cd9d84bc2b342": "1430000000000000000000",
+ "0x9bb9b02a26bfe1ccc3f0c6219e261c397fc5ca78": "1337000000000000000000",
+ "0xbee8d0b008421954f92d000d390fb8f8e658eaee": "1000000000000000000000",
+ "0x7989d09f3826c3e5af8c752a8115723a84d80970": "415554000000000000000",
+ "0x7cd5d81eab37e11e6276a3a1091251607e0d7e38": "62856000000000000000",
+ "0x6ce1b0f6adc47051e8ab38b39edb4186b03babcc": "1207800000000000000000",
+ "0xabfcf5f25091ce57875fc674dcf104e2a73dd2f2": "19700000000000000000",
+ "0x1c3ef05dae9dcbd489f3024408669de244c52a02": "20000000000000000000000",
+ "0xcfa8b37127149bdbfee25c34d878510951ea10eb": "2000000000000000000000",
+ "0x74863acec75d03d53e860e64002f2c165e538377": "1000000000000000000000",
+ "0x59b9e733cba4be00429b4bd9dfa64732053a7d55": "20000000000000000000",
+ "0xaeadfcd0978edad74a32bd01a0a51d37f246e661": "260000000000000000000",
+ "0x08090876baadfee65c3d363ba55312748cfa873d": "1700170000000000000000",
+ "0xe589fa76984db5ec4004b46ee8a59492c30744ce": "2800000000000000000000",
+ "0x3485361ee6bf06ef6508ccd23d94641f814d3e2f": "2000000000000000000000",
+ "0x5cb731160d2e8965670bde925d9de5510935347d": "40000000000000000000",
+ "0x8ef4d8a2c23c5279187b64e96f741404085385f3": "299598000000000000000",
+ "0xe246683cc99db7c4a52bcbacaab0b32f6bfc93d7": "2000000000000000000000",
+ "0x7d273e637ef1eac481119413b91c989dc5eac122": "500000000000000000000",
+ "0x6efba8fb2ac5b6730729a972ec224426a287c3ad": "283152000000000000000",
+ "0x0773eeacc050f74720b4a1bd57895b1cceeb495d": "10000000000000000000000",
+ "0x88a122a2382c523931fb51a0ccad3beb5b7259c3": "2000000000000000000000",
+ "0xb0b779b94bfa3c2e1f587bcc9c7e21789222378f": "1550000000000000000000",
+ "0x86f95c5b11a293940e35c0b898d8b75f08aab06d": "29605000000000000000000",
+ "0xcf2288ef4ebf88e86db13d8a0e0bf52a056582c3": "2533000000000000000000",
+ "0x71ea5b11ad8d29b1a4cb67bf58ca6c9f9c338c16": "1600000000000000000000",
+ "0x9917d68d4af341d651e7f0075c6de6d7144e7409": "5660000000000000000000",
+ "0x1e5800227d4dcf75e30f5595c5bed3f72e341e3b": "248300000000000000000",
+ "0x123759f333e13e3069e2034b4f05398918119d36": "20000000000000000000000",
+ "0xf798d16da4e460c460cd485fae0fa0599708eb82": "1000000000000000000000",
+ "0x864bec5069f855a4fd5892a6c4491db07c88ff7c": "1000000000000000000000",
+ "0xfa283299603d8758e8cab082125d2c8f7d445429": "6415633000000000000000",
+ "0xc811c2e9aa1ac3462eba5e88fcb5120e9f6e2ca2": "1400140000000000000000",
+ "0x61547d376e5369bcf978fc162c3c56ae453547e8": "200000000000000000000",
+ "0x0d747ee5969bf79d57381d6fe3a2406cd0d8ce27": "100000000000000000000000",
+ "0xf8962b75db5d24c7e8b7cef1068c3e67cebb30a5": "280000000000000000000",
+ "0x35bf6688522f35467a7f75302314c02ba176800e": "17400000000000000000000",
+ "0x05cb6c3b0072d3116761b532b218443b53e8f6c5": "141722000000000000000000",
+ "0x91c80caa081b38351d2a0e0e00f80a34e56474c1": "1000000000000000000000",
+ "0xd75a502a5b677287470f65c5aa51b87c10150572": "907400000000000000000",
+ "0x3e194b4ecef8bb711ea2ff24fec4e87bd032f7d1": "2575465000000000000000",
+ "0x736bf1402c83800f893e583192582a134eb532e9": "9999996000000000000000",
+ "0xc2cb1ada5da9a0423873814793f16144ef36b2f3": "1334326000000000000000",
+ "0xefcce06bd6089d0e458ef561f5a689480afe7000": "600000000000000000000",
+ "0xbfe6bcb0f0c07852643324aa5df5fd6225abc3ca": "74500000000000000000",
+ "0x9d799e943e306ba2e5b99c8a6858cbb52c0cf735": "300000000000000000000",
+ "0xf45b1dcb2e41dc27ffa024daadf619c11175c087": "19700000000000000000",
+ "0x08e38ee0ce48c9ca645c1019f73b5355581c56e6": "1600000000000000000000",
+ "0x2cb4c3c16bb1c55e7c6b7a19b127a1ac9390cc09": "3397053000000000000000",
+ "0xbdc02cd4330c93d6fbda4f6db2a85df22f43c233": "2000000000000000000000",
+ "0xacec91ef6941cf630ba9a3e787a012f4a2d91dd4": "80000000000000000000000",
+ "0x27ac073be79ce657a93aa693ee43bf0fa41fef04": "50000000000000000000000",
+ "0x22fe884d9037291b4d52e6285ae68dea0be9ffb5": "2000000000000000000000",
+ "0xc3107a9af3322d5238df0132419131629539577d": "492650000000000000000",
+ "0xb5cac5ed03477d390bb267d4ebd46101fbc2c3da": "197000000000000000000",
+ "0x58fb947364e7695765361ebb1e801ffb8b95e6d0": "200000000000000000000",
+ "0x32860997d730b2d83b73241a25d3667d51c908ef": "499938000000000000000",
+ "0xc79d5062c796dd7761f1f13e558d73a59f82f38b": "8000000000000000000000",
+ "0xfa142fe47eda97e6503b386b18a2bedd73ccb5b1": "850080000000000000000",
+ "0x6ca5de00817de0cedce5fd000128dede12648b3c": "20000000000000000000",
+ "0x214b743955a512de6e0d886a8cbd0282bee6d2a2": "2000000000000000000000",
+ "0xede79ae1ff4f1606d59270216fa46ab2ddd4ecaa": "146000000000000000000",
+ "0x528101ce46b720a2214dcdae6618a53177ffa377": "508876000000000000000",
+ "0xb5870ce342d43343333673038b4764a46e925f3e": "1000000000000000000000",
+ "0x843bd3502f45f8bc4da370b323bdac3fcf5f19a6": "1476000000000000000000",
+ "0x5067f4549afbfe884c59cbc12b96934923d45db0": "1000000000000000000000",
+ "0x6f2a42e6e033d01061131929f7a6ee1538021e52": "2000000000000000000000",
+ "0xe9e1f7cb00a110edd0ebf8b377ef8a7bb856117f": "200000000000000000000",
+ "0xa387ecde0ee4c8079499fd8e03473bd88ad7522a": "1970000000000000000000",
+ "0x6dff90e6dc359d2590882b1483edbcf887c0e423": "1000000000000000000000",
+ "0x22e512149a18d369b73c71efa43e86c9edabaf1d": "1455000000000000000000",
+ "0xa3203095edb7028e6871ce0a84f548459f83300a": "4000000000000000000000",
+ "0x93b4bf3fdff6de3f4e56ba6d7799dc4b93a6548f": "19100000000000000000",
+ "0x8c75956e8fed50f5a7dd7cfd27da200f6746aea6": "1000000000000000000000",
+ "0xafc8ebe8988bd4105acc4c018e546a1e8f9c7888": "500000000000000000000",
+ "0xbf9acd4445d9c9554689cabbbab18800ff1741c2": "1000000000000000000000",
+ "0x603f2fab7afb6e017b94766069a4b43b38964923": "1656954000000000000000",
+ "0xa1f765c44fe45f790677944844be4f2d42165fbd": "3687750000000000000000",
+ "0x4dc9d5bb4b19cecd94f19ec25d200ea72f25d7ed": "2000000000000000000000",
+ "0x48f60a35484fe7792bcc8a7b6393d0dda1f6b717": "3600000000000000000000",
+ "0x588ed990a2aff44a94105d58c305257735c868ac": "16100000000000000000000",
+ "0x710be8fd5e2918468be2aabea80d828435d79612": "17600000000000000000",
+ "0x03ea6d26d080e57aee3926b18e8ed73a4e5b2826": "200000000000000000000",
+ "0x20824ba1dbebbef9846ef3d0f6c1b017e6912ec4": "7170194000000000000000",
+ "0xf7500c166f8bea2f82347606e5024be9e4f4ce99": "20000000000000000000",
+ "0x9d369165fb70b81a3a765f188fd60cbe5e7b0968": "2000000000000000000000",
+ "0x6fddbd9bca66e28765c2162c8433548c1052ed11": "82720000000000000000000",
+ "0x8b81156e698639943c01a75272ad3d35851ab282": "344946000000000000000",
+ "0x75804aac64b4199083982902994d9c5ed8828f11": "557800000000000000000",
+ "0xd6e8e97ae9839b9ee507eedb28edfb7477031439": "2000000000000000000000",
+ "0x6c808cabb8ff5fbb6312d9c8e84af8cf12ef0875": "4000086000000000000000",
+ "0xafa539586e4719174a3b46b9b3e663a7d1b5b987": "5000000000000000000000",
+ "0xf8a065f287d91d77cd626af38ffa220d9b552a2b": "1910000000000000000000",
+ "0x30e60900cacc7203f314dc604347255167fc2a0f": "2000000000000000000000",
+ "0x796f87ba617a2930b1670be92ed1281fb0b346e1": "128400000000000000000",
+ "0xf114ff0d0f24eff896edde5471dea484824a99b3": "13700000000000000000",
+ "0x0b80fc70282cbdd5fde35bf78984db3bdb120188": "1000160000000000000000",
+ "0xda7ad025ebde25d22243cb830ea1d3f64a566323": "500000000000000000000",
+ "0x65a52141f56bef98991724c6e7053381da8b5925": "60140000000000000000",
+ "0xbbc8eaff637e94fcc58d913c7770c88f9b479277": "200000000000000000000",
+ "0x0469e8c440450b0e512626fe817e6754a8152830": "2000000000000000000000",
+ "0x0727be0a2a00212048b5520fbefb953ebc9d54a0": "10000000000000000000000",
+ "0x7d858493f07415e0912d05793c972113eae8ae88": "1818000000000000000000",
+ "0x7091303116d5f2389b23238b4d656a8596d984d3": "1094014000000000000000",
+ "0x3702e704cc21617439ad4ea27a5714f2fda1e932": "1000000000000000000000",
+ "0xb87de1bcd29269d521b8761cc39cfb4319d2ead5": "1000000000000000000000",
+ "0xf639ac31da9f67271bd10402b7654e5ce763bd47": "399996000000000000000",
+ "0xe7735ec76518fc6aa92da8715a9ee3f625788f13": "1997803000000000000000",
+ "0x51277fe7c81eebd252a03df69a6b9f326e272207": "59965000000000000000",
+ "0x3b8098533f7d9bdcd307dbb23e1777ca18418936": "2000000000000000000000",
+ "0x2cba6d5d0dc204ea8a25ada2e26f5675bd5f2fdc": "1330755000000000000000",
+ "0x5c3c1c645b917543113b3e6c1c054da1fe742b9a": "800000000000000000000",
+ "0x5ecdbaeab9106ffe5d7b519696609a05baeb85ad": "20000000000000000000",
+ "0x45a820a0672f17dc74a08112bc643fd1167736c3": "199943000000000000000",
+ "0xbeef94213879e02622142bea61290978939a60d7": "5728109000000000000000",
+ "0x6cd212aee04e013f3d2abad2a023606bfb5c6ac7": "1999944000000000000000",
+ "0x92698e345378c62d8eda184d94366a144b0c105b": "1400000000000000000000",
+ "0x2d5b42fc59ebda0dfd66ae914bc28c1b0a6ef83a": "206764195000000000000000",
+ "0xb7a6791c16eb4e2162f14b6537a02b3d63bfc602": "780700000000000000000",
+ "0xfa105f1a11b6e4b1f56012a27922e2ac2da4812f": "9550000000000000000000",
+ "0x2306df931a940d58c01665fa4d0800802c02edfe": "1000000000000000000000",
+ "0xf37bf78c5875154711cb640d37ea6d28cfcb1259": "200000000000000000000",
+ "0x66201bd227ae6dc6bdfed5fbde811fecfe5e9dd9": "594808000000000000000",
+ "0x2bafbf9e9ed2c219f7f2791374e7d05cb06777e7": "220000000000000000000",
+ "0x8e9b35ad4a0a86f758446fffde34269d940ceacd": "4000000000000000000000",
+ "0x1b43232ccd4880d6f46fa751a96cd82473315841": "80000000000000000000",
+ "0x6eefdc850e87b715c72791773c0316c3559b58a4": "4000000000000000000000",
+ "0xf2c03e2a38998c21648760f1e5ae7ea3077d8522": "2642456000000000000000",
+ "0x0625d06056968b002206ff91980140242bfaa499": "1000000000000000000000",
+ "0x6158e107c5eb54cb7604e0cd8dc1e07500d91c3c": "50000000000000000000",
+ "0x02477212ffdd75e5155651b76506b1646671a1eb": "1760000000000000000000",
+ "0xfa44a855e404c86d0ca8ef3324251dfb349c539e": "1552000000000000000000",
+ "0x49897fe932bbb3154c95d3bce6d93b6d732904dd": "4000000000000000000000",
+ "0x9b6641b13e172fc072ca4b8327a3bc28a15b66a9": "120000000000000000000",
+ "0xa46b4387fb4dcce011e76e4d73547d4481e09be5": "1337000000000000000000",
+ "0x72bb27cb99f3e2c2cf90a98f707d30e4a201a071": "1640000000000000000000",
+ "0xb6bfe1c3ef94e1846fb9e3acfe9b50c3e9069233": "1999944000000000000000",
+ "0xe6cb3f3124c9c9cc3834b1274bc3336456a38bac": "427382000000000000000",
+ "0xfcbc5c71ace79741450b012cf6b8d3f17db68a70": "9550000000000000000000",
+ "0x15dbb48c98309764f99ced3692dcca35ee306bac": "150000000000000000000000",
+ "0x2e10910ba6e0bc17e055556614cb87090f4d7e5b": "200000000000000000000",
+ "0xe5fbe34984b637196f331c679d0c0c47d83410e1": "2000050000000000000000",
+ "0x6d120f0caae44fd94bcafe55e2e279ef96ba5c7a": "4000000000000000000000",
+ "0xaa5afcfd8309c2df9d15be5e6a504e7d706624c5": "5846763000000000000000",
+ "0x37959c20b7e9931d72f5a8ae869dafddad3b6d5c": "200000000000000000000",
+ "0xb041310fe9eed6864cedd4bee58df88eb4ed3cac": "10000000000000000000000",
+ "0x986df47e76e4d7a789cdee913cc9831650936c9d": "5000000000000000000000",
+ "0x35aaa0465d1c260c420fa30e2629869fb6559207": "704976000000000000000",
+ "0x7f655c6789eddf455cb4b88099720639389eebac": "6000000000000000000000",
+ "0x9e3eb509278fe0dcd8e0bbe78a194e06b6803943": "940000000000000000000",
+ "0x3e9410d3b9a87ed5e451a6b91bb8923fe90fb2b5": "200000000000000000000",
+ "0x9e960dcd03d5ba99cb115d17ff4c09248ad4d0be": "200000000000000000000",
+ "0xf057aa66ca767ede124a1c5b9cc5fc94ef0b0137": "2077730000000000000000",
+ "0xf38a6ca80168537e974d14e1c3d13990a44c2c1b": "6000000000000000000000",
+ "0x229e430de2b74f442651ddcdb70176bc054cad54": "13545000000000000000",
+ "0x27bf9f44ba7d05c33540c3a53bb02cbbffe7c3c6": "2000000000000000000000",
+ "0x10389858b800e8c0ec32f51ed61a355946cc409b": "200000000000000000000",
+ "0xfd2929271e9d2095a264767e7b0df52ea0d1d400": "3000040000000000000000",
+ "0x44250d476e062484e9080a3967bf3a4a732ad73f": "20000000000000000000",
+ "0x0c67033dd8ee7f0c8ae534d42a51f7d9d4f7978f": "200000000000000000000",
+ "0xe083d34863e0e17f926b7928edff317e998e9c4b": "400000000000000000000",
+ "0x7f7192c0df1c7db6d9ed65d71184d8e4155a17ba": "79800000000000000000",
+ "0x51e7b55c2f9820eed73884361b5066a59b6f45c6": "2000000000000000000000",
+ "0x4fa983bb5e3073a8edb557effeb4f9fb1d60ef86": "1599800000000000000000",
+ "0x5a5ee8e9bb0e8ab2fecb4b33d29478be50bbd44b": "776000000000000000000",
+ "0x1f3959fc291110e88232c36b7667fc78a379613f": "18200000000000000000",
+ "0x2d7d5c40ddafc450b04a74a4dabc2bb5d665002e": "2000000000000000000000",
+ "0x5215183b8f80a9bc03d26ce91207832a0d39e620": "1000000000000000000000",
+ "0x5607590059a9fec1881149a44b36949aef85d560": "2000000000000000000000",
+ "0xf7c50f922ad16b61c6d1baa045ed816815bac48f": "12566370000000000000000",
+ "0xda10978a39a46ff0bb848cf65dd9c77509a6d70e": "2000000000000000000000",
+ "0xa7dcbba9b9bf6762c145416c506a71e3b497209c": "1999944000000000000000",
+ "0x54e01283cc8b384538dd646770b357c960d6cacd": "5000000000000000000000",
+ "0x78cf8336b328db3d87813a472b9e89b75e0cf3bc": "1000000000000000000000",
+ "0xba24fc436753a739db2c8d40e6d4d04c528e86fa": "13000000000000000000000",
+ "0xdfe929a61c1b38eddbe82c25c2d6753cb1e12d68": "402500000000000000000",
+ "0x2b49fba29830360fcdb6da23bbfea5c0bbac5281": "20000000000000000000",
+ "0x76becae4a31d36f3cb577f2a43594fb1abc1bb96": "24860000000000000000000",
+ "0xe0cf698a053327ebd16b7d7700092fe2e8542446": "95275000000000000000",
+ "0xa3802d8a659e89a2c47e905430b2a827978950a7": "1000000000000000000000",
+ "0x75636cdb109050e43d5d6ec47e359e218e857eca": "22886800000000000000000",
+ "0x3d813ff2b6ed57b937dabf2b381d148a411fa085": "100000000000000000000",
+ "0xa9252551a624ae513719dabe5207fbefb2fd7749": "40000000000000000000",
+ "0xc749668042e71123a648975e08ed6382f83e05e2": "14000000000000000000000",
+ "0x04eca501630abce35218b174956b891ba25efb23": "1000060000000000000000",
+ "0x790f91bd5d1c5cc4739ae91300db89e1c1303c93": "2000000000000000000000",
+ "0x009560a3de627868f91fa8bfe1c1b7afaf08186b": "524000000000000000000",
+ "0x1329dd19cd4baa9fc64310efeceab22117251f12": "200000000000000000000",
+ "0x7005a772282b1f62afda63f89b5dc6ab64c84cb9": "18000000000000000000000",
+ "0xabfe936425dcc7b74b955082bbaaf2a11d78bc05": "1400000000000000000000",
+ "0x97d0d9725e3b70e675843173938ed371b62c7fac": "170000000000000000000",
+ "0x41ed2d8e7081482c919fc23d8f0091b3c82c4685": "1295460000000000000000",
+ "0x992365d764c5ce354039ddfc912e023a75b8e168": "18200000000000000000",
+ "0xe1c607c0a8a060da8f02a8eb38a013ea8cda5b8c": "805000000000000000000",
+ "0x3b2c45990e21474451cf4f59f01955b331c7d7c9": "2000000000000000000000",
+ "0x29ac2b458454a36c7e96c73a8667222a12242c71": "4000000000000000000000",
+ "0xb8555010776e3c5cb311a5adeefe9e92bb9a64b9": "4000000000000000000000",
+ "0x30380087786965149e81423b15e313ba32c5c783": "18200000000000000000",
+ "0xa2f86bc061884e9eef05640edd51a2f7c0596c69": "2000050000000000000000",
+ "0x9f98eb34d46979b0a6de8b05aa533a89b825dcf1": "86500000000000000000",
+ "0xc81fb7d20fd2800192f0aac198d6d6a37d3fcb7d": "259500000000000000000",
+ "0xa4035ab1e5180821f0f380f1131b7387c8d981cd": "20000000000000000000",
+ "0x782f52f0a676c77716d574c81ec4684f9a020a97": "850055000000000000000",
+ "0x261e0fa64c51137465eecf5b90f197f7937fdb05": "18000000000000000000000",
+ "0x276fd7d24f8f883f5a7a28295bf17151c7a84b03": "2000000000000000000000",
+ "0xa1f5b840140d5a9acef402ac3cc3886a68cad248": "2000000000000000000000",
+ "0xd2bf67a7f3c6ce56b7be41675dbbadfe7ea93a33": "400000000000000000000",
+ "0x8ee584337ddbc80f9e3498df55f0a21eacb57fb1": "20000000000000000000",
+ "0x34393c5d91b9de597203e75bac4309b5fa3d28c3": "194000000000000000000",
+ "0x114cbbbf6fb52ac414be7ec61f7bb71495ce1dfa": "3000000000000000000000",
+ "0xab7c42c5e52d641a07ad75099c62928b7f86622f": "335940000000000000000",
+ "0x80bf995ed8ba92701d10fec49f9e7d014dbee026": "572153000000000000000",
+ "0x4a192035e2619b24b0709d56590e9183ccf2c1d9": "10000000000000000000000",
+ "0x376cd7577383e902951b60a2017ba7ea29e33576": "2000000000000000000000",
+ "0xf5437e158090b2a2d68f82b54a5864b95dd6dbea": "4010732000000000000000",
+ "0x13a5eecb38305df94971ef2d9e179ae6cebab337": "330000000000000000000",
+ "0xefc8cf1963c9a95267b228c086239889f4dfd467": "10000000000000000000000",
+ "0xdb77b88dcb712fd17ee91a5b94748d720c90a994": "2000000000000000000000",
+ "0x9aaafa0067647ed999066b7a4ca5b4b3f3feaa6f": "1000000000000000000000",
+ "0xae36f7452121913e800e0fcd1a65a5471c23846f": "164000000000000000000",
+ "0xb124bcb6ffa430fcae2e86b45f27e3f21e81ee08": "2000000000000000000000",
+ "0xf2813a64c5265d020235cb9c319b6c96f906c41e": "350000000000000000000",
+ "0xe848ca7ebff5c24f9b9c316797a43bf7c356292d": "114000000000000000000",
+ "0x21a6feb6ab11c766fdd977f8df4121155f47a1c0": "57200000000000000000",
+ "0xe95e92bbc6de07bf3a660ebf5feb1c8a3527e1c5": "18200000000000000000",
+ "0x0b369e002e1b4c7913fcf00f2d5e19c58165478f": "64520000000000000000",
+ "0x0909648c18a3ce5bae7a047ec2f868d24cdda81d": "3820000000000000000000",
+ "0xd32b45564614516c91b07fa9f72dcf787cce4e1c": "291000000000000000000",
+ "0xcf1bdb799b2ea63ce134668bdc198b54840f180b": "18200000000000000000",
+ "0xae062c448618643075de7a0030342dced63dbad7": "825982000000000000000",
+ "0x99dfd0504c06c743e46534fd7b55f1f9c7ec3329": "2000000000000000000000",
+ "0x87fc4635263944ce14a46c75fa4a821f39ce7f72": "20000000000000000000",
+ "0x27c2d7ca504daa3d9066dc09137dc42f3aaab452": "600000000000000000000",
+ "0xcc60f836acdef3548a1fefcca13ec6a937db44a0": "86500000000000000000",
+ "0xc910a970556c9716ea53af66ddef93143124913d": "1580000000000000000000",
+ "0x8173c835646a672e0152be10ffe84162dd256e4c": "492000000000000000000",
+ "0xe989733ca1d58d9e7b5029ba5d444858bec03172": "581595000000000000000",
+ "0x86806474c358047d9406e6a07f40945bc8328e67": "6884000000000000000000",
+ "0x5395a4455d95d178b4532aa4725b193ffe512961": "1000000000000000000000",
+ "0x56397638bb3cebf1f62062794b5eb942f916171d": "2000000000000000000000",
+ "0x6958f83bb2fdfb27ce0409cd03f9c5edbf4cbedd": "20000000000000000000000",
+ "0x26ff0a51e7cece8400276978dbd6236ef162c0e6": "100020000000000000000000",
+ "0x4ca783b556e5bf53aa13c8116613d65782c9b642": "25200000000000000000000",
+ "0x15a0aec37ff9ff3d5409f2a4f0c1212aaccb0296": "1000000000000000000000",
+ "0x50378af7ef54043f892ab7ce97d647793511b108": "19700000000000000000",
+ "0xe7c6b5fc05fc748e5b4381726449a1c0ad0fb0f1": "2000000000000000000000",
+ "0x5317ecb023052ca7f5652be2fa854cfe4563df4d": "499986000000000000000",
+ "0xc94f7c35c027d47df8ef4f9df85a9248a17dd23b": "29944000000000000000",
+ "0x6a63fc89abc7f36e282d80787b7b04afd6553e71": "160000000000000000000",
+ "0x5fd3d6777ec2620ae83a05528ed425072d3ca8fd": "2000000000000000000000",
+ "0x29adcf83b6b20ac6a434abb1993cbd05c60ea2e4": "10000000000000000000000",
+ "0x8c6f9f4e5b7ae276bf58497bd7bf2a7d25245f64": "2730000000000000000000",
+ "0xd94a57882a52739bbe2a0647c80c24f58a2b4f1c": "1341230000000000000000",
+ "0x7286e89cd9de8f7a8a00c86ffdb53992dd9251d1": "1940000000000000000000",
+ "0x5773b6026721a1dd04b7828cd62b591bfb34534c": "27000000000000000000000",
+ "0x11fefb5dc1a4598aa712640c517775dfa1d91f8c": "10000000000000000000000",
+ "0xc6e324beeb5b36765ecd464260f7f26006c5c62e": "2000000000000000000000",
+ "0x118fbd753b9792395aef7a4d78d263cdcaabd4f7": "999800000000000000000",
+ "0xf8298591523e50b103f0b701d623cbf0f74556f6": "200000000000000000000",
+ "0xab0ced762e1661fae1a92afb1408889413794825": "1910000000000000000000",
+ "0xfa67b67b4f37a0150915110ede073b05b853bda2": "647490000000000000000",
+ "0xca122cf0f2948896b74843f49afed0ba1618eed7": "560000000000000000000",
+ "0x186b95f8e5effddcc94f1a315bf0295d3b1ea588": "1999944000000000000000",
+ "0x2915624bcb679137b8dae9ab57d11b4905eaee4b": "20000000000000000000",
+ "0x0c6845bf41d5ee273c3ee6b5b0d69f6fd5eabbf7": "3000026000000000000000",
+ "0xcb7479109b43b26657f4465f4d18c6f974be5f42": "1820000000000000000000",
+ "0x8dd6a9bae57f518549ada677466fea8ab04fd9b4": "4000000000000000000000",
+ "0x34958a46d30e30b273ecc6e5d358a212e5307e8c": "2000000000000000000000",
+ "0x2003717907a72560f4307f1beecc5436f43d21e7": "500000000000000000000",
+ "0x55ab99b0e0e55d7bb874b7cfe834de631c97ec23": "1031400000000000000000",
+ "0x79b48d2d6137c3854d611c01ea42427a0f597bb7": "191000000000000000000",
+ "0xd609ec0be70d0ad26f6e67c9d4762b52ee51122c": "1000000000000000000000",
+ "0xe8c3f045bb7d38c9d2f395b0ba8492b253230901": "9000000000000000000000",
+ "0xaaca60d9d700e78596bbbbb1f1e2f70f4627f9d8": "999996000000000000000",
+ "0x89d75b8e0831e46f80bc174188184e006fde0eae": "1000000000000000000000",
+ "0xb3667894b7863c068ad344873fcff4b5671e0689": "20000000000000000000000",
+ "0xbc1609d685b76b48ec909aa099219022f89b2ccd": "1182000000000000000000",
+ "0x88ee7f0efc8f778c6b687ec32be9e7d6f020b674": "2000000000000000000000",
+ "0x470ac5d1f3efe28f3802af925b571e63868b397d": "2000000000000000000000",
+ "0xabf8ffe0708a99b528cc1ed4e9ce4b0d0630be8c": "2263600000000000000000",
+ "0x8cee38d6595788a56e3fb94634b3ffe1fbdb26d6": "20000000000000000000000",
+ "0x19798cbda715ea9a9b9d6aab942c55121e98bf91": "1200000000000000000000",
+ "0xe25a167b031e84616d0f013f31bda95dcc6350b9": "10560000000000000000000",
+ "0x6196c3d3c0908d254366b7bca55745222d9d4db1": "4000000000000000000000",
+ "0xe8e9850586e94f5299ab494bb821a5f40c00bd04": "3820000000000000000000",
+ "0x1059cbc63e36c43e88f30008aca7ce058eeaa096": "100000000000000000000000",
+ "0xc4f2913b265c430fa1ab8adf26c333fc1d9b66f2": "20000000000000000000",
+ "0x26e9e2ad729702626417ef25de0dc800f7a779b3": "1000000000000000000000",
+ "0x0dfbd4817050d91d9d625c02053cf61a3ee28572": "340000000000000000000",
+ "0x709fe9d2c1f1ce42207c9585044a60899f35942f": "2000000000000000000000",
+ "0x7ad82caea1a8b4ed05319b9c9870173c814e06ee": "616000000000000000000",
+ "0x2a595f16eee4cb0c17d9a2d939b3c10f6c677243": "1100000000000000000000",
+ "0xa8f89dd5cc6e64d7b1eeace00702022cd7d2f03d": "700000000000000000000",
+ "0xc0a6cbad77692a3d88d141ef769a99bb9e3c9951": "100000000000000000000",
+ "0x868c23be873466d4c74c220a19b245d1787e807f": "1366481000000000000000",
+ "0x2905b192e83ce659aa355b9d0c204e3e95f9bb9a": "2160817000000000000000",
+ "0x50b9fef0a1329b02d16506255f5a2db71ec92d1f": "1325464000000000000000",
+ "0xfc10b7a67b3268d5331bfb6a14def5ea4a162ca3": "200000000000000000000",
+ "0x85eb256b51c819d60ea61a82d12c9358d59c1cae": "460000000000000000000",
+ "0x75de7e9352e90b13a59a5878ffecc7831cac4d82": "2740000000000000000000",
+ "0xd32b2c79c36478c5431901f6d700b04dbe9b8810": "396000000000000000000",
+ "0x2d0326b23f0409c0c0e9236863a133075a94ba18": "210380000000000000000",
+ "0xd2e21ed56868fab28e0947927adaf29f23ebad6c": "1994000000000000000000",
+ "0x2ad6c9d10c261819a1a0ca2c48d8c7b2a71728df": "1000000000000000000000",
+ "0x7d445267c59ab8d2a2d9e709990e09682580c49f": "1000000000000000000000",
+ "0xb6047cdf932db3e4045f4976122341537ed5961e": "20000000000000000000",
+ "0x2b3cf97311ff30f460945a9d8099f4a88e26d456": "2000000000000000000000",
+ "0x7f4f593b618c330ba2c3d5f41eceeb92e27e426c": "2775000000000000000000",
+ "0x72a2fc8675feb972fa41b50dffdbbae7fa2adfb7": "2853840000000000000000",
+ "0x076561a856455d7ef86e63f87c73dbb628a55f45": "900000000000000000000",
+ "0x03d1724fd00e54aabcd2de2a91e8462b1049dd3a": "2640000000000000000000",
+ "0x7ea0f96ee0a573a330b56897761f3d4c0130a8e3": "1337000000000000000000",
+ "0xfe65c4188d7922576909642044fdc52395560165": "4000000000000000000000",
+ "0x57883010b4ac857fedac03eab2551723a8447ffb": "1000000000000000000000",
+ "0x0729a8a4a5ba23f579d0025b1ad0f8a0d35cdfd2": "9700000000000000000000",
+ "0xe75c1fb177089f3e58b1067935a6596ef1737fb5": "99910000000000000000",
+ "0xe0e978753d982f7f9d1d238a18bd4889aefe451b": "9700000000000000000000",
+ "0x5620f46d1451c2353d6243a5d4b427130be2d407": "60000000000000000000",
+ "0xf3d688f06bbdbf50f9932c4145cbe48ecdf68904": "20000000000000000000",
+ "0x3aa948ea02397755effb2f9dc9392df1058f7e33": "850000000000000000000",
+ "0x20d1417f99c569e3beb095856530fe12d0fceaaa": "1182175000000000000000",
+ "0xac77bdf00fd5985b5db12bbef800380abc2a0677": "1000000000000000000000",
+ "0x267a7e6e82e1b91d51deddb644f0e96dbb1f7f7e": "20000000000000000000",
+ "0x4bbcbf38b3c90163a84b1cd2a93b58b2a3348d87": "8000000000000000000000",
+ "0x4c6b93a3bec16349540cbfcae96c9621d6645010": "2000000000000000000000",
+ "0xc9308879056dfe138ef8208f79a915c6bc7e70a8": "10000000000000000000000",
+ "0xc48b693cacefdbd6cb5d7895a42e3196327e261c": "1000000000000000000000",
+ "0xa0951970dfd0832fb83bda12c23545e79041756c": "600000000000000000000",
+ "0x7cdf74213945953db39ad0e8a9781add792e4d1d": "2000000000000000000000",
+ "0x75621865b6591365606ed378308c2d1def4f222c": "3100000000000000000000",
+ "0x67d6a8aa1bf8d6eaf7384e993dfdf10f0af68a61": "198067000000000000000",
+ "0x8f0af37566d152802f1ae8f928b25af9b139b448": "200000000000000000000",
+ "0x2c6afcd4037c1ed14fa74ff6758e0945a185a8e8": "17600000000000000000",
+ "0xc1b2aa8cb2bf62cdc13a47ecc4657facaa995f98": "1000129000000000000000",
+ "0x9e8144e08e89647811fe6b72d445d6a5f80ad244": "10000000000000000000000",
+ "0xe04ff5e5a7e2af995d8857ce0290b53a2b0eda5d": "1000000000000000000000",
+ "0x03dedfcd0b3c2e17c705da248790ef98a6bd5751": "1337000000000000000000",
+ "0x698a8a6f01f9ab682f637c7969be885f6c5302bf": "19400000000000000000",
+ "0xd82c6fedbdac98af2eed10b00f32b00056ca5a6d": "200000000000000000000",
+ "0x2697b339813b0c2d964b2471eb1c606f4ecb9616": "1154000000000000000000",
+ "0x987c9bcd6e3f3990a52be3eda4710c27518f4f72": "400000000000000000000",
+ "0xc5d48ca2db2f85d8c555cb0e9cfe826936783f9e": "200000000000000000000",
+ "0xda214c023e2326ff696c00393168ce46ffac39ec": "1000000000000000000000",
+ "0x86570ab259c9b1c32c9729202f77f590c07dd612": "200000000000000000000",
+ "0xa646a95c6d6f59f104c6541d7760757ab392b08c": "4200000000000000000000",
+ "0x1933e334c40f3acbad0c0b851158206924beca3a": "7551541000000000000000",
+ "0x3552a496eba67f12be6eedab360cd13661dc7480": "300000000000000000000",
+ "0x2a9c96c19151ffcbe29a4616d0c52b3933b4659f": "69263000000000000000",
+ "0x3b7b8e27de33d3ce7961b98d19a52fe79f6c25be": "100000000000000000000000",
+ "0xa1911405cf6e999ed011f0ddcd2a4ff7c28f2526": "40000000000000000000",
+ "0x0cae108e6db99b9e637876b064c6303eda8a65c8": "3000000000000000000000",
+ "0x3883becc08b9be68ad3b0836aac3b620dc0017ef": "2000000000000000000000",
+ "0xd0abcc70c0420e0e172f97d43b87d5e80c336ea9": "10000000000000000000000",
+ "0xcbf16a0fe2745258cd52db2bf21954c975fc6a15": "300000000000000000000",
+ "0x1b23cb8663554871fbbe0d9e60397efb6faedc3e": "200000000000000000000",
+ "0xfbede32c349f3300ef4cd33b4de7dc18e443d326": "3160000000000000000000",
+ "0x5e806e845730f8073e6cc9018ee90f5c05f909a3": "9480000000000000000000",
+ "0x425c338a1325e3a1578efa299e57d986eb474f81": "2000000000000000000000",
+ "0x8bf297f8f453523ed66a1acb7676856337b93bf0": "4000000000000000000000",
+ "0x38e8a31af2d265e31a9fff2d8f46286d1245a467": "20000000000000000000",
+ "0x7edafba8984baf631a820b6b92bbc2c53655f6bd": "2000000000000000000000",
+ "0xaa0200f1d17e9c54da0647bb96395d57a78538d8": "1056000000000000000000",
+ "0x433eb94a339086ed12d9bde9cd1d458603c97dd6": "100000000000000000000000",
+ "0xcd7e47909464d871b9a6dc76a8e9195db3485e7a": "9850000000000000000000",
+ "0x5975d78d974ee5bb9e4d4ca2ae77c84b9c3b4b82": "1370000000000000000000",
+ "0xcea2896623f4910287a2bdc5be83aea3f2e6de08": "9359000000000000000000",
+ "0xcb4ad0c723da46ab56d526da0c1d25c73daff10a": "510000000000000000000",
+ "0xe2cf360aa2329eb79d2bf7ca04a27a17c532e4d8": "102000000000000000000",
+ "0xea60549ec7553f511d2149f2d4666cbd9243d93c": "2000000000000000000000",
+ "0xcbb7be17953f2ccc93e1bc99805bf45511434e4c": "50440000000000000000000",
+ "0x3549bd40bbbc2b30095cac8be2c07a0588e0aed6": "20000000000000000000",
+ "0x6510df42a599bcb0a519cca961b488759a6f6777": "2000000000000000000000",
+ "0xed12a1ba1fb8adfcb20dfa19582e525aa3b74524": "6685000000000000000000",
+ "0x135eb8c0e9e101deedec11f2ecdb66ae1aae8867": "20000000000000000000000",
+ "0xee906d7d5f1748258174be4cbc38930302ab7b42": "200000000000000000000",
+ "0x253f1e742a2cec86b0d7b306e5eacb6ccb2f8554": "20040000000000000000000",
+ "0xecd1a62802351a41568d23033004acc6c005a5d3": "50000000000000000000",
+ "0x558c54649a8a6e94722bd6d21d14714f71780534": "2000000000000000000000",
+ "0xca657ec06fe5bc09cf23e52af7f80cc3689e6ede": "900000000000000000000",
+ "0x74bf7a5ab59293149b5c60cf364263e5ebf1aa0d": "115800000000000000000",
+ "0x7a6d781c77c4ba1fcadf687341c1e31799e93d27": "274000000000000000000",
+ "0x77028e409cc43a3bd33d21a9fc53ec606e94910e": "3880000000000000000000",
+ "0x4781a10a4df5eebc82f4cfe107ba1d8a7640bd66": "1790000000000000000000",
+ "0x78e08bc533413c26e291b3143ffa7cc9afb97b78": "200000000000000000000",
+ "0x03ef6ad20ff7bd4f002bac58d47544cf879ae728": "6895000000000000000000",
+ "0x0e3696cf1f4217b163d1bc12a5ea730f1c32a14a": "4000000000000000000000",
+ "0x825135b1a7fc1605614c8aa4d0ac6dbad08f480e": "1430000000000000000000",
+ "0x286b186d61ea1fd78d9930fe12b06537b05c3d51": "1000000000000000000000",
+ "0x8d6657f59711b1f803c6ebef682f915b62f92dc9": "2000000000000000000000",
+ "0xda8bbee182e455d2098acb338a6d45b4b17ed8b6": "2000000000000000000000",
+ "0x3f2da093bb16eb064f8bfa9e30b929d15f8e1c4c": "2000000000000000000000",
+ "0xf5d9cf00d658dd45517a48a9d3f5f633541a533d": "116400000000000000000",
+ "0xc5f64babb7033142f20e46d7aa6201ed86f67103": "2000000000000000000000",
+ "0xa2e2b5941e0c01944bfe1d5fb4e8a34b922ccfb1": "200000000000000000000",
+ "0x6114b0eae5576903f80bfb98842d24ed92237f1e": "100000000000000000000",
+ "0x38df0c4abe7ded5fe068eadf154ac691774324a4": "1790000000000000000000",
+ "0x1c2010bd662df417f2a271879afb13ef4c88a3ae": "4000000000000000000000",
+ "0x918967918cd897dd0005e36dc6c883ef438fc8c7": "140000000000000000000",
+ "0xa522de7eb6ae1250522a513133a93bd42849475c": "20000000000000000000000",
+ "0x7de442c82386154d2e993cbd1280bb7ca6b12ada": "4002000000000000000000",
+ "0x66424bd8785b8cb461102a900283c35dfa07ef6a": "40221000000000000000",
+ "0x7bbbec5e70bdead8bb32b42805988e9648c0aa97": "1000076000000000000000",
+ "0xfec06fe27b44c784b2396ec92f7b923ad17e9077": "2000000000000000000000",
+ "0x95d550427b5a514c751d73a0f6d29fb65d22ed10": "300000000000000000000",
+ "0x8dde60eb08a099d7daa356daaab2470d7b025a6b": "197000000000000000000",
+ "0x81bccbff8f44347eb7fca95b27ce7c952492aaad": "152240000000000000000",
+ "0x3995e096b08a5a726800fcd17d9c64c64e088d2b": "200000000000000000000",
+ "0x4ee13c0d41200b46d19dee5c4bcec71d82bb8e38": "7893915000000000000000",
+ "0xc41461a3cfbd32c9865555a4813137c076312360": "999999000000000000000",
+ "0x3300fb149aded65bcba6c04e9cd6b7a03b893bb1": "18200000000000000000",
+ "0x29f9286c0e738d1721a691c6b95ab3d9a797ede8": "200000000000000000000000",
+ "0x34c8e5f1330fcb4b14ca75cb2580a4b93d204e36": "2000000000000000000000",
+ "0xec5df227bfa85d7ad76b426e1cee963bc7f519dd": "1000000000000000000000",
+ "0x797510e386f56393ced8f477378a444c484f7dad": "1000000000000000000000",
+ "0x0191eb547e7bf6976b9b1b577546761de65622e2": "1999980000000000000000",
+ "0x615a6f36777f40d6617eb5819896186983fd3731": "5910000000000000000000",
+ "0x17580b766f7453525ca4c6a88b01b50570ea088c": "100000000000000000000",
+ "0x945d96ea573e8df7262bbfa572229b4b16016b0f": "209300000000000000000",
+ "0x2de0964400c282bdd78a919c6bf77c6b5f796179": "200000000000000000000",
+ "0x304ec69a74545721d7316aef4dcfb41ac59ee2f0": "200000000000000000000",
+ "0xbe2b326e78ed10e550fee8efa8f8070396522f5a": "39400000000000000000000",
+ "0x1a0841b92a7f7075569dc4627e6b76cab05ade91": "1520000000000000000000",
+ "0x5fa61f152de6123516c751242979285f796ac791": "204000000000000000000",
+ "0x68c8791dc342c373769ea61fb7b510f251d32088": "1000000000000000000000",
+ "0x4167cd48e733418e8f99ffd134121c4a4ab278c4": "3640000000000000000000",
+ "0x598aaabae9ed833d7bc222e91fcaa0647b77580b": "1800000000000000000000",
+ "0x979f30158b574b999aab348107b9eed85b1ff8c1": "970000000000000000000",
+ "0x3ad06149b21c55ff867cc3fb9740d2bcc7101231": "197000000000000000000000",
+ "0x7133843a78d939c69d4486e10ebc7b602a349ff7": "329000000000000000000",
+ "0x8bdfda6c215720eda2136f91052321af4e936c1f": "1000008000000000000000",
+ "0x3e1c53300e4c168912163c7e99b95da268ad280a": "1003200000000000000000",
+ "0xe07ebbc7f4da416e42c8d4f842aba16233c12580": "2000000000000000000000",
+ "0xbac8922c4acc7d2cb6fd59a14eb45cf3e702214b": "800000000000000000000",
+ "0xbb6c284aac8a69b75cddb00f28e145583b56bece": "2000000000000000000000",
+ "0x0372ee5508bf8163ed284e5eef94ce4d7367e522": "100000000000000000000",
+ "0x17125b59ac51cee029e4bd78d7f5947d1ea49bb2": "22000000000000000000000",
+ "0xc88ca1e6e5f4d558d13780f488f10d4ad3130d34": "1550000000000000000000",
+ "0xa825fd5abb7926a67cf36ba246a24bd27be6f6ed": "17600000000000000000",
+ "0x04241b41ecbd0bfdf1295e9d4fa59ea09e6c6186": "1870000000000000000000",
+ "0x6de4d15219182faf3aa2c5d4d2595ff23091a727": "1580000000000000000000",
+ "0xb203d29e6c56b92699c4b92d1f6f84648dc4cfbc": "400000000000000000000",
+ "0x80b42de170dbd723f454e88f7716452d92985092": "300202000000000000000",
+ "0x0a5b79d8f23b6483dbe2bdaa62b1064cc76366ae": "1969803000000000000000",
+ "0x32034e8581d9484e8af42a28df190132ec29c466": "3460000000000000000000",
+ "0x7ee604c7a9dc2909ce321de6b9b24f5767577555": "5533575000000000000000",
+ "0xa387ce4e961a7847f560075c64e1596b5641d21c": "668500000000000000000",
+ "0xfcc9d4a4262e7a027ab7519110d802c495ceea39": "6370000000000000000000",
+ "0xff8a2ca5a81333f19998255f203256e1a819c0aa": "224000000000000000000",
+ "0xf9811fa19dadbf029f8bfe569adb18228c80481a": "200000000000000000000",
+ "0x0d1f2a57713ebc6e94de29846e8844d376665763": "5000000000000000000000",
+ "0xeab0bd148309186cf8cbd13b7232d8095acb833a": "10691800000000000000000",
+ "0x36928b55bc861509d51c8cf1d546bfec6e3e90af": "1970000000000000000000",
+ "0x30480164bcd84974ebc0d90c9b9afab626cd1c73": "800000000000000000000",
+ "0x36339f84a5c2b44ce53dfdb6d4f97df78212a7df": "321600000000000000000",
+ "0xcfeacaaed57285e0ac7268ce6a4e35ecfdb242d7": "1086400000000000000000",
+ "0x572dd8cd3fe399d1d0ec281231b7cefc20b9e4bb": "10400000000000000000000",
+ "0x5dded049a6e1f329dc4b971e722c9c1f2ade83f0": "1000000000000000000000",
+ "0x9756e176c9ef693ee1eec6b9f8b151d313beb099": "1200000000000000000000",
+ "0x01e6415d587b065490f1ed7f21d6e0f386ee6747": "2000000000000000000000",
+ "0xb4413576869c08f9512ad311fe925988a52d3414": "10000000000000000000000",
+ "0xda9f55460946d7bfb570ddec757ca5773b58429a": "507600000000000000000",
+ "0x7180b83ee5574317f21c8072b191d895d46153c3": "460000000000000000000",
+ "0x0aca9a5626913b08cfc9a66d40508dce52b60f87": "1910000000000000000000",
+ "0x5cd0e475b54421bdfc0c12ea8e082bd7a5af0a6a": "59000000000000000000",
+ "0x7edb02c61a227287611ad950696369cc4e647a68": "274000000000000000000",
+ "0xb2676841ee9f2d31c172e82303b0fe9bbf9f1e09": "200000000000000000000",
+ "0xa2222259dd9c3e3ded127084f808e92a1887302c": "162000000000000000000",
+ "0x4b3a7cc3a7d7b00ed5282221a60259f25bf6538a": "1000000000000000000000",
+ "0xe33ff987541dde5cdee0a8a96dcc3f33c3f24cc2": "200000000000000000000000",
+ "0x1e1a4828119be309bd88236e4d482b504dc55711": "2955000000000000000000",
+ "0x9b1811c3051f46e664ae4bc9c824d18592c4574a": "199955000000000000000",
+ "0x59fe00696dbd87b7976b29d1156c8842a2e17914": "2000000000000000000000",
+ "0x48010ef3b8e95e3f308f30a8cb7f4eb4bf60d965": "2000000000000000000000",
+ "0xc90300cb1d4077e6a6d7e169a460468cf4a492d7": "2000000000000000000000",
+ "0x6dedf62e743f4d2c2a4b87a787f5424a7aeb393c": "180000000000000000000",
+ "0xfb744b951d094b310262c8f986c860df9ab1de65": "52009000000000000000",
+ "0x193ac65183651800e23580f8f0ead3bb597eb8a4": "50020000000000000000",
+ "0xbf05ff5ecf0df2df887759fb8274d93238ac267d": "800000000000000000000",
+ "0x6c0e712f405c59725fe829e9774bf4df7f4dd965": "57413800000000000000000",
+ "0x2744ff67464121e35afc2922177164fa2fcb0267": "100000000000000000000",
+ "0xd09cb2e6082d693a13e8d2f68dd1dd8461f55840": "1000000000000000000000",
+ "0xbc171e53d17ac9b61241ae436deec7af452e7496": "5348000000000000000000",
+ "0x71fa22cc6d33206b7d701a163a0dab31ae4d31d6": "1610000000000000000000",
+ "0x4da8030769844bc34186b85cd4c7348849ff49e9": "10000000000000000000000",
+ "0xc8616b4ec09128cdff39d6e4b9ac86eec471d5f2": "19400000000000000000",
+ "0x407295ebd94b48269c2d569c9b9af9aa05e83e5e": "10000000000000000000000",
+ "0xd45d5daa138dd1d374c71b9019916811f4b20a4e": "576000000000000000000",
+ "0x42c6edc515d35557808d13cd44dcc4400b2504e4": "197876000000000000000",
+ "0x0bc95cb32dbb574c832fa8174a81356d38bc92ac": "2000000000000000000000",
+ "0x5a6071bcebfcba4ab57f4db96fc7a68bece2ba5b": "2000000000000000000000",
+ "0x54c93e03a9b2e8e4c3672835a9ee76f9615bc14e": "19400000000000000000",
+ "0x3c03bbc023e1e93fa3a3a6e428cf0cd8f95e1ec6": "1520000000000000000000",
+ "0xba1531fb9e791896bcf3a80558a359f6e7c144bd": "3940000000000000000000",
+ "0xaa56a65dc4abb72f11bae32b6fbb07444791d5c9": "748600000000000000000",
+ "0xe437acbe0f6227b0e36f36e4bcf7cf613335fb68": "200000000000000000000",
+ "0x39d4a931402c0c79c457186f24df8729cf957031": "4000000000000000000000",
+ "0xe22b20c77894463baf774cc256d5bddbbf7ddd09": "1000000000000000000000",
+ "0x70a4067d448cc25dc8e70e651cea7cf84e92109e": "176000000000000000000",
+ "0xaa3925dc220bb4ae2177b2883078b6dc346ca1b2": "8000000000000000000000",
+ "0xad57aa9d00d10c439b35efcc0becac2e3955c313": "200000000000000000000",
+ "0xe93d47a8ca885d540c4e526f25d5c6f2c108c4b8": "112640000000000000000000",
+ "0x232ce782506225fd9860a2edc14a7a3047736da2": "20000000000000000000",
+ "0x49a645e0667dfd7b32d075cc2467dd8c680907c4": "129560000000000000000",
+ "0xcf2e734042a355d05ffb2e3915b16811f45a695e": "2000000000000000000000",
+ "0x39b1c471ae94e12164452e811fbbe2b3cd7275ac": "2000000000000000000000",
+ "0xffad3dd74e2c1f796ac640de56dc99b4c792a402": "5000000000000000000000",
+ "0xa69d7cd17d4842fe03f62a90b2fbf8f6af7bb380": "100000000000000000000",
+ "0x2001bef77b66f51e1599b02fb110194a0099b78d": "2000000000000000000000",
+ "0x95e7616424cd0961a71727247437f0069272280e": "400000000000000000000",
+ "0xc04f4bd4049f044685b883b62959ae631d667e35": "5820000000000000000000",
+ "0xede0147ec032c3618310c1ff25690bf172193dac": "2000000000000000000000",
+ "0x66719c0682b2ac7f9e27abebec7edf8decf0ae0d": "20000000000000000000",
+ "0x45272b8f62e9f9fa8ce04420e1aea3eba9686eac": "4000000000000000000000",
+ "0xd1da0c8fb7c210e0f2ec618f85bdae7d3e734b1c": "1970000000000000000000",
+ "0xe9133e7d31845d5f2b66a2618792e869311acf66": "24050000000000000000000",
+ "0xebb62cf8e22c884b1b28c6fa88fbbc17938aa787": "798000000000000000000",
+ "0x6205c2d5647470848a3840f3887e9b015d34755c": "1800000000000000000000",
+ "0x76ca22bcb8799e5327c4aa2a7d0949a1fcce5f29": "1524180000000000000000",
+ "0x6b925dd5d8ed6132ab6d0860b82c44e1a51f1fee": "1480000000000000000000",
+ "0x797bb7f157d9feaa17f76da4f704b74dc1038341": "3340000000000000000000",
+ "0xae8954f8d6166de507cf61297d0fc7ca6b9e7128": "300000000000000000000",
+ "0x75c1ad23d23f24b384d0c3149177e86697610d21": "6426082000000000000000",
+ "0x805d846fb0bc02a7337226d685be9ee773b9198a": "19999800000000000000000",
+ "0xc3cb6b36af443f2c6e258b4a39553a818747811f": "1610000000000000000000",
+ "0xcea43f7075816b60bbfce68b993af0881270f6c4": "2000000000000000000000",
+ "0xe0388aeddd3fe2ad56f85748e80e710a34b7c92e": "500000000000000000000",
+ "0xe131f87efc5ef07e43f0f2f4a747b551d750d9e6": "19999000000000000000000",
+ "0xc2b2cbe65bc6c2ee7a3c75b2e47c189c062e8d8b": "20000000000000000000000",
+ "0xbd8765f41299c7f479923c4fd18f126d7229047d": "4000000000000000000000",
+ "0xc83ba6dd9549be1d3287a5a654d106c34c6b5da2": "7000000000000000000000",
+ "0xf870995fe1e522321d754337a45c0c9d7b38951c": "20000000000000000000",
+ "0x0d8ed7d0d15638330ed7e4eaccab8a458d75737e": "2000000000000000000000",
+ "0x36c510bf8d6e569bf2f37d47265dbcb502ff2bce": "30000000000000000000000",
+ "0x0eccf617844fd61fba62cb0e445b7ac68bcc1fbe": "387260000000000000000",
+ "0xae10e27a014f0d306baf266d4897c89aeee2e974": "20000000000000000000000",
+ "0x1827039f09570294088fddf047165c33e696a492": "9550000000000000000000",
+ "0x23378f42926d0184b793b0c827a6dd3e3d334fcd": "56000000000000000000",
+ "0x467124ae7f452f26b3d574f6088894fa5d1cfb3b": "2700000000000000000000",
+ "0xaae61e43cb0d0c96b30699f77e00d711d0a3979b": "1000000000000000000000",
+ "0x15c7edb8118ee27b342285eb5926b47a855bc7a5": "20000000000000000000",
+ "0x0d5d98565c647ca5f177a2adb9d3022fac287f21": "200000000000000000000",
+ "0x7222fec7711781d26eaa4e8485f7aa3fac442483": "456000000000000000000",
+ "0xdc44275b1715baea1b0345735a29ac42c9f51b4f": "1164000000000000000000",
+ "0x04d82af9e01a936d97f8f85940b970f9d4db9936": "200000000000000000000",
+ "0x45533390e340fe0de3b3cf5fb9fc8ea552e29e62": "1460000000000000000000",
+ "0x1284f0cee9d2ff2989b65574d06ffd9ab0f7b805": "400000000000000000000",
+ "0xed9ebccba42f9815e78233266dd6e835b6afc31b": "6000000000000000000000",
+ "0xe4324912d64ea3aef76b3c2ff9df82c7e13ae991": "2000000000000000000000",
+ "0x94c742fd7a8b7906b3bfe4f8904fc0be5c768033": "20000000000000000000000",
+ "0x62fb8bd1f0e66b90533e071e6cbe6111fef0bc63": "17600000000000000000000",
+ "0x2c83aeb02fcf067d65a47082fd977833ab1cec91": "150400000000000000000",
+ "0x06cbfa08cdd4fba737bac407be8224f4eef35828": "593459000000000000000",
+ "0x67ee406ea4a7ae6a3a381eb4edd2f09f174b4928": "1036000000000000000000",
+ "0x83c23d8a502124ee150f08d71dc6727410a0f901": "33999600000000000000000",
+ "0xf7c00cdb1f020310d5acab7b496aaa44b779085e": "1670000000000000000000",
+ "0xd096565b7c7407d06536580355fdd6d239144aa1": "250000000000000000000",
+ "0xf8d52dcc5f96cc28007b3ecbb409f7e22a646caa": "149200000000000000000",
+ "0x0c222c7c41c9b048efcce0a232434362e12d673b": "10007600000000000000000",
+ "0x503bdbd8bc421c32a443032deb2e3e4cd5ba8b4e": "2000000000000000000000",
+ "0x77da5e6c72fb36bce1d9798f7bcdf1d18f459c2e": "22380000000000000000",
+ "0xe62f98650712eb158753d82972b8e99ca3f61877": "2000000000000000000000",
+ "0x87a7c508ef71582dd9a54372f89cb01f252fb180": "200000000000000000000",
+ "0xf61283b4bd8504058ca360e993999b62cbc8cd67": "255000000000000000000",
+ "0x9ccddcb2cfc2b25b08729a0a98d9e6f0202ea2c1": "100000000000000000000",
+ "0xd460a4b908dd2b056759b488850b66a838fc77a8": "1970000000000000000000",
+ "0x5431b1d18751b98fc9e2888ac7759f1535a2db47": "2000000000000000000000",
+ "0xda2a14f9724015d79014ed8e5909681d596148f1": "48499000000000000000",
+ "0xc989434f825aaf9c552f685eba7c11db4a5fc73a": "501000000000000000000",
+ "0x2b701d16c0d3cc1e4cd85445e6ad02eea4ac012d": "600000000000000000000",
+ "0x78b978a9d7e91ee529ea4fc4b76feaf8762f698c": "32000000000000000000000",
+ "0xc89cf504b9f3f835181fd8424f5ccbc8e1bddf7d": "10000000000000000000000",
+ "0xe94941b6036019b4016a30c1037d5a6903babaad": "780000000000000000000",
+ "0x95d98d0c1069908f067a52acac2b8b534da37afd": "2054053000000000000000",
+ "0x8284923b62e68bbf7c2b9f3414d13ef6c812a904": "3880000000000000000000",
+ "0x3e5a39fdda70df1126ab0dc49a7378311a537a1f": "2400000000000000000000",
+ "0xa2ace4c993bb1e5383f8ac74e179066e814f0591": "100000000000000000000",
+ "0x0609d83a6ce1ffc9b690f3e9a81e983e8bdc4d9d": "70000000000000000000000",
+ "0xd119417c46732cf34d1a1afb79c3e7e2cd8eece4": "2000000000000000000000",
+ "0xfdb33944f2360615e5be239577c8a19ba52d9887": "601650000000000000000",
+ "0xdd95dbe30f1f1877c5dd7684aeef302ab6885192": "8372000000000000000000",
+ "0x413f4b02669ccff6806bc826fcb7deca3b0ea9bc": "20000000000000000000",
+ "0x5800cd8130839e94495d2d8415a8ea2c90e0c5cb": "200000000000000000000",
+ "0x65053191319e067a25e6361d47f37f6318f83419": "394000000000000000000",
+ "0x9bc573bcda23b8b26f9073d90c230e8e71e0270b": "999544000000000000000",
+ "0x97f7760657c1e202759086963eb4211c5f8139b9": "49770000000000000000000",
+ "0x126897a311a14ad43b78e0920100c4426bfd6bdd": "973581000000000000000",
+ "0xd5276f0cd5ffd5ffb63f98b5703d5594ede0838b": "400000000000000000000",
+ "0xe9c35c913ca1fceab461582fe1a5815164b4fd21": "8000000000000000000000",
+ "0xb43067fe70d9b55973ba58dc64dd7f311e554259": "200000000000000000000",
+ "0x6f8f0d15cc96fb7fe94f1065bc6940f8d12957b2": "1000000000000000000000",
+ "0xb1dba5250ba9625755246e067967f2ad2f0791de": "80000000000000000000000",
+ "0x72b7a03dda14ca9c661a1d469fd33736f673c8e8": "2000000000000000000000",
+ "0xe792349ce9f6f14f81d0674096befa1f9221cdea": "1685365000000000000000",
+ "0x1815279dff9952da3be8f77249dbe22243377be7": "4749800000000000000000",
+ "0x33481e856ebed48ea708a27426ef28e867f57cd1": "200000000000000000000",
+ "0x8eb8c71982a00fb84275293253f8044544b66b49": "400000000000000000000",
+ "0x65f5870f26bce089677dfc23b5001ee492483428": "5067230000000000000000",
+ "0x8e23facd12c765c36ab81a6dd34d8aa9e68918ae": "167310000000000000000",
+ "0x4912d902931676ff39fc34fe3c3cc8fb2182fa7a": "20000000000000000000",
+ "0xc09a66172aea370d9a63da04ff71ffbbfcff7f94": "2000000000000000000000",
+ "0xe969ea1595edc5c4a707cfde380929633251a2b0": "200000000000000000000",
+ "0x4f2b47e2775a1fa7178dad92985a5bbe493ba6d6": "200000000000000000000",
+ "0xcab9a97ada065c87816e6860a8f1426fe6b3d775": "1000000000000000000000",
+ "0xcdfd8217339725d7ebac11a63655f265eff1cc3d": "4999962000000000000000",
+ "0xab4004c0403f7eabb0ea586f212156c4203d67f1": "1999944000000000000000",
+ "0x1c7cb2fe6bf3e09cbcdc187af38fa8f5053a70b6": "9970823000000000000000",
+ "0xa951b244ff50cfae591d5e1a148df6a938ef2a1a": "1734000000000000000000",
+ "0xb158db43fa62d30e65f3d09bf781c7b67372ebaa": "1999000000000000000000",
+ "0x25e037f00a18270ba5ec3420229ddb0a2ce38fa2": "10000000000000000000000",
+ "0x2aaea1f1046f30f109faec1c63ef5c7594eb08da": "4000000000000000000000",
+ "0x73d7269ff06c9ffd33754ce588f74a966abbbbba": "6600000000000000000000",
+ "0x4c767b65fd91161f4fbdcc6a69e2f6ad711bb918": "720000000000000000000",
+ "0x92ae5b7c7eb492ff1ffa16dd42ad9cad40b7f8dc": "865000000000000000000",
+ "0xa04f2ae02add14c12faf65cb259022d0830a8e26": "100000000000000000000000",
+ "0x63ef2fbc3daf5edaf4a295629ccf31bcdf4038e5": "1460000000000000000000",
+ "0x749ad6f2b5706bbe2f689a44c4b640b58e96b992": "100000000000000000000",
+ "0x4d836d9d3b0e2cbd4de050596faa490cffb60d5d": "300000000000000000000",
+ "0x59f6247b0d582aaa25e5114765e4bf3c774f43c2": "50000000000000000000",
+ "0x1293c78c7d6a443b9d74b0ba5ee7bb47fd418588": "6685000000000000000000",
+ "0x67bc85e87dc34c4e80aafa066ba8d29dbb8e438e": "402500000000000000000",
+ "0xa09f4d5eaa65a2f4cb750a49923401dae59090af": "140000000000000000000",
+ "0xebbd4db9019952d68b1b0f6d8cf0683c00387bb5": "332330000000000000000",
+ "0xb16479ba8e7df8f63e1b95d149cd8529d735c2da": "846477000000000000000",
+ "0xe1b2aca154b8e0766c4eba30bc10c7f35036f368": "19980000000000000000",
+ "0x5c464197791c8a3da3c925436f277ab13bf2faa2": "8000000000000000000000",
+ "0x170a88a8997f92d238370f1affdee6347050b013": "3000800000000000000000",
+ "0xdadbfafd8b62b92a24efd75256dd83abdbd7bbdb": "19700000000000000000",
+ "0xbb993b96ee925ada7d99d786573d3f89180ce3aa": "2000000000000000000000",
+ "0xf2c362b0ef991bc82fb36e66ff75932ae8dd8225": "74000000000000000000",
+ "0x7f2382ffd8f83956467937f9ba72374623f11b38": "600000000000000000000",
+ "0x74d1a4d0c7524e018d4e06ed3b648092b5b6af2c": "50000000000000000000",
+ "0x24a750eae5874711116dd7d47b7186ce990d3103": "200000000000000000000",
+ "0xa8e42a4e33d7526cca19d9a36dcd6e8040d0ea73": "1080000000000000000000",
+ "0x3e1b2230afbbd310b4926a4c776d5ae7819c661d": "30000000000000000000000",
+ "0x6af9f0dfeeaebb5f64bf91ab771669bf05295553": "400000000000000000000",
+ "0x41e4a20275e39bdcefeb655c0322744b765140c2": "10000000000000000000000",
+ "0xceb089ec8a78337e8ef88de11b49e3dd910f748f": "1000000000000000000000",
+ "0xe6bcd30a8fa138c5d9e5f6c7d2da806992812dcd": "260000000000000000000000",
+ "0xe08c60313106e3f9334fe6f7e7624d211130c077": "40000000000000000000",
+ "0xf5cffbba624e7eb321bc83c60ca68199b4e36671": "2000000000000000000000",
+ "0xd7c2803ed7b0e0837351411a8e6637d168bc5b05": "29549015000000000000000",
+ "0x0f3665d48e9f1419cd984fc7fa92788710c8f2e4": "2000000000000000000000",
+ "0xb48921c9687d5510744584936e8886bdbf2df69b": "1000000000000000000000",
+ "0xa94bbb8214cf8da0c2f668a2ac73e86248528d4b": "960000000000000000000",
+ "0xbe0c2a80b9de084b172894a76cf4737a4f529e1a": "1999944000000000000000",
+ "0xfcf199f8b854222f182e4e1d099d4e323e2aae01": "1000000000000000000000",
+ "0xb52dfb45de5d74e3df208332bc571c809b8dcf32": "6000000000000000000000",
+ "0x704819d2e44d6ed1da25bfce84c49fcca25613e5": "400000000000000000000",
+ "0x6ff6cc90d649de4e96cffee1077a5b302a848dcb": "28600000000000000000",
+ "0x4d9c77d0750c5e6fbc247f2fd79274686cb353d6": "20000000000000000000",
+ "0x68e8022740f4af29eb48db32bcecddfd148d3de3": "1000000000000000000000",
+ "0x2cb615073a40dcdb99faa848572e987b3b056efb": "799600000000000000000",
+ "0x64adcceec53dd9d9dd15c8cc1a9e736de4241d2c": "56000000000000000000",
+ "0x2aec809df9325b9f483996e99f7331097f08aa0e": "4000000000000000000000",
+ "0x438c2f54ff8e629bab36b1442b760b12a88f02ae": "2000000000000000000000",
+ "0x9e35399071a4a101e9194daa3f09f04a0b5f9870": "4000000000000000000000",
+ "0xa5c336083b04f9471b8c6ed73679b74d66c363ec": "3014100000000000000000",
+ "0x7ad3f307616f19dcb143e6444dab9c3c33611f52": "50000000000000000000",
+ "0x455cb8ee39ffbc752331e5aefc588ef0ee593454": "999963000000000000000",
+ "0xc4c01afc3e0f045221da1284d7878574442fb9ac": "7419944000000000000000",
+ "0x99268327c373332e06c3f6164287d455b9d5fa4b": "2000000000000000000000",
+ "0x4367ae4b0ce964f4a54afd4b5c368496db169e9a": "2000000000000000000000",
+ "0x2cd79eb52027b12c18828e3eaab2969bfcd287e9": "20000000000000000000",
+ "0xb96841cabbc7dbd69ef0cf8f81dff3c8a5e21570": "12000000000000000000000",
+ "0xd7ebddb9f93987779b680155375438db65afcb6a": "100600000000000000000",
+ "0x0631d18bbbbd30d9e1732bf36edae2ce8901ab80": "3024800000000000000000",
+ "0x5fad960f6b2c84569c9f4d47bf1985fcb2c65da6": "999972000000000000000",
+ "0x01d599ee0d5f8c38ab2d392e2c65b74c3ce31820": "510000000000000000000",
+ "0xff0cc8dac824fa24fc3caa2169e6e057cf638ad6": "4000000000000000000000",
+ "0xc25266c7676632f13ef29be455ed948add567792": "1337000000000000000000",
+ "0x9c344098ba615a398f11d009905b177c44a7b602": "1000000000000000000000",
+ "0x3b0accaf4b607cfe61d17334c214b75cdefdbd89": "2000000000000000000000",
+ "0x6d6634b5b8a40195d949027af4828802092ceeb6": "3000000000000000000000",
+ "0x208c45732c0a378f17ac8324926d459ba8b658b4": "2955000000000000000000",
+ "0xc24399b4bf86f7338fbf645e3b22b0e0b7973912": "2000000000000000000000",
+ "0x29763dd6da9a7c161173888321eba6b63c8fb845": "328000000000000000000",
+ "0x9c2fd54089af665df5971d73b804616039647375": "1000000000000000000000",
+ "0x0e09646c99af438e99fa274cb2f9c856cb65f736": "1910000000000000000000",
+ "0xbe73274d8c5aa44a3cbefc8263c37ba121b20ad3": "500000000000000000000",
+ "0xecfd004d02f36cd4d8b4a8c1a9533b6af85cd716": "5003800000000000000000",
+ "0xf978b025b64233555cc3c19ada7f4199c9348bf7": "400000000000000000000000",
+ "0x705ddd38355482b8c7d3b515bda1500dd7d7a817": "400000000000000000000",
+ "0x2b8a0dee5cb0e1e97e15cfca6e19ad21f995efad": "504206000000000000000",
+ "0x1098cc20ef84bad5146639c4cd1ca6c3996cb99b": "18200000000000000000",
+ "0xafdac5c1cb56e245bf70330066a817eaafac4cd1": "20000000000000000000",
+ "0x910e996543344c6815fb97cda7af4b8698765a5b": "103400000000000000000",
+ "0x94612781033b57b146ee74e753c672017f5385e4": "3600000000000000000000",
+ "0xd03fc165576aaed525e5502c8e140f8b2e869639": "6850000000000000000000",
+ "0x293384c42b6f8f2905ce52b7205c2274376c612b": "1400000000000000000000",
+ "0x09ee12b1b42b05af9cf207d5fcac255b2ec411f2": "58929000000000000000",
+ "0xdbd71efa4b93c889e76593de609c3b04cbafbe08": "20000000000000000000",
+ "0xfa86ca27bf2854d98870837fb6f6dfe4bf6453fc": "322061000000000000000",
+ "0x61ff8e67b34d9ee6f78eb36ffea1b9f7c15787af": "1640000000000000000000",
+ "0x6d4cbf3d8284833ae99344303e08b4d614bfda3b": "12000000000000000000000",
+ "0x2ff160c44f72a299b5ec2d71e28ce5446d2fcbaf": "360000000000000000000",
+ "0x94a7cda8f481f9d89d42c303ae1632b3b709db1d": "300000000000000000000",
+ "0x7566496162ba584377be040a4f87777a707acaeb": "4000000000000000000000",
+ "0xbdc461462b6322b462bdb33f22799e8108e2417d": "668500000000000000000",
+ "0x7e47637e97c14622882be057bea229386f4052e5": "440000000000000000000",
+ "0x3b5c251d7fd7893ba209fe541cecd0ce253a990d": "30000000000000000000000",
+ "0x0e498800447177b8c8afc3fdfa7f69f4051bb629": "2140234000000000000000",
+ "0xb71623f35107cf7431a83fb3d204b29ee0b1a7f4": "19700000000000000000",
+ "0x1d395b30adda1cf21f091a4f4a7b753371189441": "100000000000000000000000",
+ "0x2c2428e4a66974edc822d5dbfb241b2728075158": "2000000000000000000000",
+ "0xa575f2891dcfcda83c5cf01474af11ee01b72dc2": "100076000000000000000",
+ "0xad728121873f0456d0518b80ab6580a203706595": "500000000000000000000",
+ "0x48669eb5a801d8b75fb6aa58c3451b7058c243bf": "30940000000000000000000",
+ "0xb3ae54fba09d3ee1d6bdd1e957923919024c35fa": "65513000000000000000",
+ "0x0d35408f226566116fb8acdaa9e2c9d59b76683f": "940000000000000000000",
+ "0xdf211cd21288d6c56fae66c3ff54625dd4b15427": "2500024000000000000000",
+ "0x8a746c5d67064711bfca685b95a4fe291a27028e": "40000000000000000000",
+ "0x1cf105ab23023b554c583e86d7921179ee83169f": "1970000000000000000000",
+ "0x8cfedef198db0a9143f09129b3fd64dcbb9b4956": "2000000000000000000000",
+ "0x1e381adcf801a3bf9fd7bfac9ccc2b8482ad5e66": "600200000000000000000",
+ "0xe74608f506866ada6bfbfdf20fea440be76989ef": "1999944000000000000000",
+ "0x27e63989ca1e903bc620cf1b9c3f67b9e2ae6581": "1337000000000000000000",
+ "0xbb0857f1c911b24b86c8a70681473fe6aaa1cce2": "100000000000000000000",
+ "0x4f8e8d274fb22a3fd36a47fe72980471544b3434": "200000000000000000000",
+ "0x127d3fc5003bf63c0d83e93957836515fd279045": "111890000000000000000",
+ "0x95809e8da3fbe4b7f281f0b8b1715f420f7d7d63": "2000000000000000000000",
+ "0x28904bb7c4302943b709b14d7970e42b8324e1a1": "10027500000000000000000",
+ "0xc07e3867ada096807a051a6c9c34cc3b3f4ad34a": "1788210000000000000000",
+ "0xf0b469eae89d400ce7d5d66a9695037036b88903": "20000000000000000000000",
+ "0x7445202f0c74297a004eb3726aa6a82dd7c02fa1": "2000000000000000000000",
+ "0xc58f62fee9711e6a05dc0910b618420aa127f288": "3980000000000000000000",
+ "0x801d65c518b11d0e3f4f470221417013c8e53ec5": "4000000000000000000000",
+ "0x41010fc8baf8437d17a04369809a168a17ca56fb": "100000000000000000000",
+ "0xa1998144968a5c70a6415554cefec2824690c4a5": "20000000000000000000",
+ "0xe9559185f166fc9513cc71116144ce2deb0f1d4b": "20000000000000000000000",
+ "0xed5b4c41e762d942404373caf21ed4615d25e6c1": "2013960000000000000000",
+ "0x665b000f0b772750cc3c217a5ef429a92bf1ccbb": "4000000000000000000000",
+ "0xfebd9f81cf78bd5fb6c4b9a24bd414bb9bfa4c4e": "1990019000000000000000",
+ "0xa072691c8dd7cd4237ff72a75c1a9506d0ce5b9e": "370000000000000000000",
+ "0x6765df25280e8e4f38d4b1cf446fc5d7eb659e34": "100000000000000000000",
+ "0x524fb210522c5e23bb67dfbf8c26aa616da49955": "999971000000000000000",
+ "0xe987e6139e6146a717fef96bc24934a5447fe05d": "2000000000000000000000",
+ "0xd6110276cfe31e42825a577f6b435dbcc10cf764": "1000000000000000000000",
+ "0x5e51b8a3bb09d303ea7c86051582fd600fb3dc1a": "20000000000000000000",
+ "0x5c4f24e994ed8f850ea7818f471c8fac3bcf0452": "1724800000000000000000",
+ "0x85b2998d0c73302cb2ba13f489313301e053be15": "10000000000000000000000",
+ "0x0af6c8d539c96d50259e1ba6719e9c8060f388c2": "1000000000000000000000",
+ "0x7d901b28bf7f88ef73d8f73cca97564913ea8a24": "955000000000000000000",
+ "0xe01859f242f1a0ec602fa8a3b0b57640ec89075e": "555000000000000000000",
+ "0xc66ae4cee87fb3353219f77f1d6486c580280332": "29550000000000000000",
+ "0x2d40558b06f90a3923145592123b6774e46e31f4": "1000000000000000000000",
+ "0xccf43975b76bfe735fec3cb7d4dd24f805ba0962": "60000000000000000000",
+ "0x1703b4b292b8a9deddede81bb25d89179f6446b6": "19690000000000000000000",
+ "0x0e9096d343c060db581a120112b278607ec6e52b": "20000000000000000000",
+ "0xf65819ac4cc14c137f05dd7977c7dae08d1a4ab5": "102000000000000000000",
+ "0xca373fe3c906b8c6559ee49ccd07f37cd4fb5266": "1790000000000000000000",
+ "0xd28298524df5ec4b24b0ffb9df85170a145a9eb5": "287700000000000000000",
+ "0x5fcda847aaf8d7fa8bca08029ca2849166aa15a3": "623350000000000000000",
+ "0xbdc739a699700b2e8e2c4a4c7b058a0e513ddebe": "2000000000000000000000",
+ "0x0bb05f7224bb5804856556c07eeadbed87ba8f7c": "401100000000000000000",
+ "0xab416fe30d58afe5d9454c7fce7f830bcc750356": "114515000000000000000",
+ "0x3eee6f1e96360b7689b3069adaf9af8eb60ce481": "1000000000000000000000",
+ "0x9a0d3cee3d9892ea3b3700a27ff84140d9025493": "60000000000000000000",
+ "0x5dc36de5359450a1ec09cb0c44cf2bb42b3ae435": "1117500000000000000000",
+ "0x35c8adc11125432b3b77acd64625fe58ebee9d66": "2000000000000000000000",
+ "0xa5e9cd4b74255d22b7d9b27ae8dd43ed6ed0252b": "766527000000000000000",
+ "0x31ea12d49a35a740780ddeeaece84c0835b26270": "200000000000000000000",
+ "0x7aef7b551f0b9c46e755c0f38e5b3a73fe1199f5": "1490000000000000000000",
+ "0xcc6d7b12061bc96d104d606d65ffa32b0036eb07": "10000000000000000000000",
+ "0x322021022678a0166d204b3aaa7ad4ec4b88b7d0": "400000000000000000000",
+ "0xb31196714a48dff726ea9433cd2912f1a414b3b3": "2680000000000000000000",
+ "0x0f2fb884c8aaff6f543ac6228bd08e4f60b0a5fd": "3145000000000000000000",
+ "0x7d9d221a3df89ddd7b5f61c1468c6787d6b333e6": "138000000000000000000",
+ "0x367f59cc82795329384e41e1283115e791f26a01": "2000000000000000000000",
+ "0xfd9579f119bbc819a02b61e38d8803c942f24d32": "105600000000000000000",
+ "0x3e2f26235e137a7324e4dc154b5df5af46ea1a49": "22458000000000000000",
+ "0x4c1579af3312e4f88ae93c68e9449c2e9a68d9c4": "2000000000000000000000",
+ "0xffb04726dfa41afdc819168418610472970d7bfc": "4000000000000000000000",
+ "0x403c64896a75cad816a9105e18d8aa5bf80f238e": "985000000000000000000",
+ "0x5cd588a14ec648ccf64729f9167aa7bf8be6eb3d": "1000000000000000000000",
+ "0x24b2be118b16d8b2174769d17b4cf84f07ca946d": "2000000000000000000000",
+ "0xd3bb59fa31258be62f8ed232f1a7d47b4a0b41ee": "100000000000000000000",
+ "0xcc9ac715cd6f2610c52b58676456884297018b29": "13370000000000000000",
+ "0x6f2a31900e240395b19f159c1d00dfe4d898ebdf": "1999600000000000000000",
+ "0xd60b247321a32a5affb96b1e279927cc584de943": "2265500000000000000000",
+ "0xf7a1ade2d0f529123d1055f19b17919f56214e67": "500000000000000000000",
+ "0xbea00df17067a43a82bc1daecafb6c14300e89e6": "1820000000000000000000",
+ "0xa2968fc1c64bac0b7ae0d68ba949874d6db253f4": "20000000000000000000000",
+ "0x92d8ad9a4d61683b80d4a6672e84c20d62421e80": "20000000000000000000",
+ "0x6ed2a12b02f8c688c7b5d3a6ea14d63687dab3b6": "2000000000000000000000",
+ "0x7a63869fc767a4c6b1cd0e0649f3634cb121d24b": "77500000000000000000",
+ "0x84f522f0520eba52dd18ad21fa4b829f2b89cb97": "4949566000000000000000",
+ "0xd6234aaf45c6f22e66a225ffb93add629b4ef80f": "1000000000000000000000",
+ "0xe3d8bf4efe84b1616d1b89e427ddc6c8830685ae": "2000000000000000000000",
+ "0xa3db364a332d884ba93b2617ae4d85a1489bea47": "1700000000000000000000",
+ "0x9f7986924aeb02687cd64189189fb167ded2dd5c": "985000000000000000000",
+ "0x2eaf4e2a46b789ccc288c8d1d9294e3fb0853896": "2000000000000000000000",
+ "0xa02dc6aa328b880de99eac546823fccf774047fb": "1970000000000000000000",
+ "0x873b7f786d3c99ff012c4a7cae2677270240b9c5": "1730000000000000000000",
+ "0x1d69c83d28ff0474ceebeacb3ad227a144ece7a3": "5474937000000000000000",
+ "0x7b827cae7ff4740918f2e030ab26cb98c4f46cf5": "7460000000000000000000",
+ "0x3083ef0ed4c4401196774a95cf4edc83edc1484f": "170000000000000000000000",
+ "0x40ad74bc0bce2a45e52f36c3debb1b3ada1b7619": "6790000000000000000000",
+ "0x05423a54c8d0f9707e704173d923b946edc8e700": "127543000000000000000",
+ "0x22eb7db0ba56b0f8b816ccb206e615d929185b0d": "80500000000000000000",
+ "0x66082c75a8de31a53913bbd44de3a0374f7faa41": "1460000000000000000000",
+ "0xe3d3eaa299887865569e88be219be507189be1c9": "456156000000000000000",
+ "0xae57cc129a96a89981dac60d2ffb877d5dc5e432": "1110994000000000000000",
+ "0x1a2434cc774422d48d53d59c5d562cce8407c94b": "30000000000000000000",
+ "0x21546914dfd3af2add41b0ff3e83ffda7414e1e0": "5969100000000000000000",
+ "0x4dcf62a3de3f061db91498fd61060f1f6398ff73": "1999944000000000000000",
+ "0x6fd98e563d12ce0fd60f4f1f850ae396a9823c02": "1261000000000000000000",
+ "0xedf8a3e1d40f13b79ec8e3e1ecf262fd92116263": "158000000000000000000",
+ "0xc09e3cfc19f605ff3ec9c9c70e2540d7ee974366": "500000000000000000000",
+ "0x953572f0ea6df9b197cae40e4b8ecc056c4371c5": "1000000000000000000000",
+ "0x163cc8be227646cb09719159f28ed09c5dc0dce0": "1337000000000000000000",
+ "0xa3932a31d6ff75fb3b1271ace7caa7d5e1ff1051": "20000000000000000000000",
+ "0xf9a94bd56198da245ed01d1e6430b24b2708dcc0": "749938000000000000000",
+ "0x3eb8b33b21d23cda86d8288884ab470e164691b5": "500000000000000000000",
+ "0x84bcbf22c09607ac84341d2edbc03bfb1739d744": "500000000000000000000",
+ "0x961c59adc74505d1864d1ecfcb8afa0412593c93": "40000000000000000000000",
+ "0xf068dfe95d15cd3a7f98ffa688b4346842be2690": "1255160000000000000000",
+ "0x291efe0081dce8c14799f7b2a43619c0c3b3fc1f": "1200000000000000000000",
+ "0xbe4fd073617022b67f5c13499b827f763639e4e3": "2000000000000000000000",
+ "0xe40a7c82e157540a0b00901dbb86c716e1a062da": "49800000000000000000",
+ "0x6635b46f711d2da6f0e16370cd8ee43efb2c2d52": "2000000000000000000000",
+ "0x43748928e8c3ec4436a1d092fbe43ac749be1251": "400000000000000000000",
+ "0xb557ab9439ef50d237b553f02508364a466a5c03": "200000000000000000000",
+ "0x11928378d27d55c520ceedf24ceb1e822d890df0": "8000000000000000000000",
+ "0x61518464fdd8b73c1bb6ac6db600654938dbf17a": "200000000000000000000",
+ "0x004bfbe1546bc6c65b5c7eaa55304b38bbfec6d3": "2000000000000000000000",
+ "0xa5e0fc3c3affed3db6710947d1d6fb017f3e276d": "2000000000000000000000",
+ "0x8ecbcfacbfafe9f00c3922a24e2cf0026756ca20": "5640000000000000000000",
+ "0xfb5ffaa0f7615726357891475818939d2037cf96": "20000000000000000000",
+ "0xae222865799079aaf4f0674a0cdaab02a6d570ff": "2000000000000000000000",
+ "0x9edc90f4be210865214ab5b35e5a8dd77415279d": "4000000000000000000000",
+ "0x9d7831e834c20b1baa697af1d8e0c621c5afff9a": "86500000000000000000",
+ "0x046d274b1af615fb505a764ad8dda770b1db2f3d": "2000000000000000000000",
+ "0xeaea23aa057200e7c9c15e8ff190d0e66c0c0e83": "2000000000000000000000",
+ "0x417a3cd19496530a6d4204c3b5a17ce0f207b1a5": "8000000000000000000000",
+ "0xa035a3652478f82dbd6d115faa8ca946ec9e681d": "109880000000000000000",
+ "0x4f5801b1eb30b712d8a0575a9a71ff965d4f34eb": "300000000000000000000",
+ "0x91dbb6aaad149585be47375c5d6de5ff09191518": "20000000000000000000000",
+ "0xd043a011ec4270ee7ec8b968737515e503f83028": "500000000000000000000",
+ "0xbb371c72c9f0316cea2bd9c6fbb4079e775429ef": "1760000000000000000000",
+ "0xaa1df92e51dff70b1973e0e924c66287b494a178": "534400000000000000000",
+ "0xbd5f46caab2c3d4b289396bbb07f203c4da82530": "80000000000000000000",
+ "0x4d29fc523a2c1629532121da9998e9b5ab9d1b45": "15800000000000000000",
+ "0xaddb26317227f45c87a2cb90dc4cfd02fb23caf8": "1000000000000000000000",
+ "0x52e46783329a769301b175009d346768f4c87ee4": "2000000000000000000000",
+ "0xcaad9dc20d589ce428d8fda3a9d53a607b7988b5": "4000000000000000000000",
+ "0x95034e1621865137cd4739b346dc17da3a27c34e": "1580000000000000000000",
+ "0x0c3239e2e841242db989a61518c22247e8c55208": "263656000000000000000",
+ "0x5a0d609aae2332b137ab3b2f26615a808f37e433": "160000000000000000000000",
+ "0x2334c590c7a48769103045c5b6534c8a3469f44a": "17443200000000000000000",
+ "0xddfcca13f934f0cfbe231da13039d70475e6a1d0": "1000169000000000000000",
+ "0xee7288d91086d9e2eb910014d9ab90a02d78c2a0": "2000000000000000000000",
+ "0xfb91fb1a695553f0c68e21276decf0b83909b86d": "100016000000000000000",
+ "0x38695fc7e1367ceb163ebb053751f9f68ddb07a0": "2000000000000000000000",
+ "0x65093b239bbfba23c7775ca7da5a8648a9f54cf7": "400000000000000000000",
+ "0x73d8fee3cb864dce22bb26ca9c2f086d5e95e63b": "1000000000000000000000",
+ "0xf7155213449892744bc60f2e04400788bd041fdd": "66850000000000000000",
+ "0xd1a71b2d0858e83270085d95a3b1549650035e23": "14900000000000000000000",
+ "0xeac17b81ed5191fb0802aa54337313834107aaa4": "8000000000000000000000",
+ "0xbb076aac92208069ea318a31ff8eeb14b7e996e3": "149000000000000000000",
+ "0x9f46e7c1e9078cae86305ac7060b01467d6685ee": "668500000000000000000",
+ "0x1598127982f2f8ad3b6b8fc3cf27bf617801ba2b": "173000000000000000000",
+ "0xe91dac0195b19e37b59b53f7c017c0b2395ba44c": "1880000000000000000000",
+ "0xa436c75453ccca4a1f1b62e5c4a30d86dde4be68": "2000000000000000000000",
+ "0x11001b89ed873e3aaec1155634b4681643986323": "1000000000000000000000",
+ "0xab93b26ece0a0aa21365afed1fa9aea31cd54468": "1608000000000000000000",
+ "0xe77febabdf080f0f5dca1d3f5766f2a79c0ffa7c": "1386000000000000000000",
+ "0x1c4af0e863d2656c8635bc6ffec8dd9928908cb5": "2000000000000000000000",
+ "0x0c48ae62d1539788eba013d75ea60b64eeba4e80": "2213311000000000000000",
+ "0x423cc4594cf4abb6368de59fd2b1230734612143": "2000000000000000000000",
+ "0x7f6b28c88421e4857e459281d78461692489d3fb": "2000000000000000000000",
+ "0x806854588ecce541495f81c28a290373df0274b2": "582000000000000000000",
+ "0xdc76e85ba50b9b31ec1e2620bce6e7c8058c0eaf": "20000000000000000000",
+ "0xb00996b0566ecb3e7243b8227988dcb352c21899": "12000000000000000000000",
+ "0xf5d14552b1dce0d6dc1f320da6ffc8a331cd6f0c": "1337000000000000000000",
+ "0x55a61b109480b5b2c4fcfdef92d90584160c0d35": "44700000000000000000",
+ "0xb8947822d5ace7a6ad8326e95496221e0be6b73d": "20000000000000000000",
+ "0x492de46aaf8f1d708d59d79af1d03ad2cb60902f": "2000000000000000000000",
+ "0x0e0d6633db1e0c7f234a6df163a10e0ab39c200f": "200000000000000000000",
+ "0xf8bf9c04874e5a77f38f4c38527e80c676f7b887": "2000000000000000000000",
+ "0x15528350e0d9670a2ea27f7b4a33b9c0f9621d21": "4000086000000000000000",
+ "0xeccf7a0457b566b346ca673a180f444130216ac3": "100000000000000000000",
+ "0x10cf560964ff83c1c9674c783c0f73fcd89943fc": "40000000000000000000000",
+ "0xe7f06f699be31c440b43b4db0501ec0e25261644": "500000000000000000000",
+ "0xb6ce4dc560fc73dc69fb7a62e388db7e72ea764f": "966000000000000000000",
+ "0xf456055a11ab91ff668e2ec922961f2a23e3db25": "18200000000000000000",
+ "0x8dfbafbc0e5b5c86cd1ad697feea04f43188de96": "390060000000000000000",
+ "0x085b4ab75d8362d914435cedee1daa2b1ee1a23b": "3880000000000000000000",
+ "0xe400d651bb3f2d23d5f849e6f92d9c5795c43a8a": "2674000000000000000000",
+ "0x851aa91c82f42fad5dd8e8bb5ea69c8f3a5977d1": "148607000000000000000",
+ "0x4c935bb250778b3c4c7f7e07fc251fa630314aab": "1500000000000000000000",
+ "0xebd356156a383123343d48843bffed6103e866b3": "1970000000000000000000",
+ "0xda0b48e489d302b4b7bf204f957c1c9be383b0df": "2000000000000000000000",
+ "0x7085ae7e7e4d932197b5c7858c00a3674626b7a5": "6000000000000000000000",
+ "0x5b06d1e6930c1054692b79e3dbe6ecce53966420": "205400000000000000000",
+ "0x8df53d96191471e059de51c718b983e4a51d2afd": "32000000000000000000000",
+ "0x0678654ac6761db904a2f7e8595ec1eaac734308": "878000000000000000000",
+ "0x89fee30d1728d96cecc1dab3da2e771afbcfaa41": "1999944000000000000000",
+ "0x59c5d06b170ee4d26eb0a0eb46cb7d90c1c91019": "10000000000000000000000",
+ "0x2b129c26b75dde127f8320bd0f63410c92a9f876": "2200000000000000000000",
+ "0x3d6ae053fcbc318d6fd0fbc353b8bf542e680d27": "14300000000000000000",
+ "0x755a60bf522fbd8fff9723446b7e343a7068567e": "20000000000000000000000",
+ "0x947e11e5ea290d6fc3b38048979e0cd44ec7c17f": "2000000000000000000000",
+ "0x711ecf77d71b3d0ea95ce4758afecdb9c131079d": "760000000000000000000",
+ "0xde9eff4c798811d968dccb460d9b069cf30278e0": "400000000000000000000",
+ "0x4e892e8081bf36e488fddb3b2630f3f1e8da30d2": "12003800000000000000000",
+ "0x8ede7e3dc50749c6c50e2e28168478c34db81946": "19999800000000000000000",
+ "0x0c30cacc3f72269f8b4f04cf073d2b05a83d9ad1": "2001000000000000000000",
+ "0xe51eb87e7fb7311f5228c479b48ec9878831ac4c": "2000000000000000000000",
+ "0x8b01da34d470c1d115acf4d8113c4dd8a8c338e4": "25220000000000000000000",
+ "0x4329fc0931cbeb033880fe4c9398ca45b0e2d11a": "2000400000000000000000",
+ "0x540c072802014ef0d561345aec481e8e11cb3570": "8000000000000000000000",
+ "0x21e5d2bae995ccfd08a5c16bb524e1f630448f82": "2800000000000000000000",
+ "0x5cf8c03eb3e872e50f7cfd0c2f8d3b3f2cb5183a": "200000000000000000000",
+ "0x5c0f2e51378f6b0d7bab617331580b6e39ad3ca5": "9600000000000000000000",
+ "0xd2f241255dd7c3f73c07043071ec08ddd9c5cde5": "500000000000000000000",
+ "0xcbe1b948864d8474e765145858fca4550f784b92": "10000000000000000000000",
+ "0x30742ccdf4abbcd005681f8159345c9e79054b1a": "668500000000000000000",
+ "0x6aeb9f74742ea491813dbbf0d6fcde1a131d4db3": "440800000000000000000",
+ "0x821eb90994a2fbf94bdc3233910296f76f9bf6e7": "10000000000000000000000",
+ "0x25c1a37ee5f08265a1e10d3d90d5472955f97806": "1820000000000000000000",
+ "0x7ef98b52bee953bef992f305fda027f8911c5851": "514717000000000000000",
+ "0x8adc53ef8c18ed3051785d88e996f3e4b20ecd51": "42000000000000000000000",
+ "0x007f4a23ca00cd043d25c2888c1aa5688f81a344": "773658000000000000000",
+ "0x4a735d224792376d331367c093d31c8794341582": "1900000000000000000000",
+ "0x05440c5b073b529b4829209dff88090e07c4f6f5": "1288000000000000000000",
+ "0x5e772e27f28800c50dda973bb33e10762e6eea20": "1790000000000000000000",
+ "0xa429fa88731fdd350e8ecd6ea54296b6484fe695": "1969606000000000000000",
+ "0xe0d76b7166b1f3a12b4091ee2b29de8caa7d07db": "2000000000000000000000",
+ "0x7ebd95e9c470f7283583dc6e9d2c4dce0bea8f84": "14000000000000000000000",
+ "0x883a78aeabaa50d8ddd8570bcd34265f14b19363": "3879951000000000000000",
+ "0x51f9c432a4e59ac86282d6adab4c2eb8919160eb": "530000000000000000000000",
+ "0xb86607021b62d340cf2652f3f95fd2dc67698bdf": "5000000000000000000000",
+ "0xacc0909fda2ea6b7b7a88db7a0aac868091ddbf6": "22155000000000000000",
+ "0x69b80ed90f84834afa3ff82eb964703b560977d6": "26740000000000000000",
+ "0xca4ca9e4779d530ecbacd47e6a8058cfde65d98f": "800000000000000000000",
+ "0x5d6c5c720d66a6abca8397142e63d26818eaab54": "40000000000000000000",
+ "0xc2c13e72d268e7150dc799e7c6cf03c88954ced7": "700000000000000000000",
+ "0x6bbd1e719390e6b91043f8b6b9df898ea8001b34": "2000053000000000000000",
+ "0xa9ba6f413b82fcddf3affbbdd09287dcf50415ca": "4000000000000000000000",
+ "0xced3c7be8de7585140952aeb501dc1f876ecafb0": "4000000000000000000000",
+ "0x1c63fa9e2cbbf23c49fcdef1cbabfe6e0d1e14c1": "1000000000000000000000",
+ "0x7d6e990daa7105de2526339833f77b5c0b85d84f": "20000000000000000000000",
+ "0x68addf019d6b9cab70acb13f0b3117999f062e12": "49941000000000000000",
+ "0xa77428bcb2a0db76fc8ef1e20e461a0a32c5ac15": "401100000000000000000",
+ "0x26048fe84d9b010a62e731627e49bc2eb73f408f": "4000000000000000000000",
+ "0xff26138330274df4e0a3081e6df7dd983ec6e78f": "2000000000000000000000",
+ "0xb7382d37db0398ac72410cf9813de9f8e1ec8dad": "1000070000000000000000",
+ "0x44f62f2aaabc29ad3a6b04e1ff6f9ce452d1c140": "17000000000000000000000",
+ "0x47fef58584465248a0810d60463ee93e5a6ee8d3": "283100000000000000000",
+ "0xbd2b70fecc37640f69514fc7f3404946aad86b11": "1200000000000000000000",
+ "0x649a85b93653075fa6562c409a565d087ba3e1ba": "2000000000000000000000",
+ "0x55866486ec168f79dbe0e1abb18864d98991ae2c": "16100000000000000000",
+ "0xd7e74afdbad55e96cebc5a374f2c8b768680f2b0": "99000000000000000000",
+ "0xa8c1d6aa41fe3d65f67bd01de2a866ed1ed9ae52": "30000000000000000000",
+ "0x744c0c77ba7f236920d1e434de5da33e48ebf02c": "1970000000000000000000",
+ "0x9445ba5c30e98961b8602461d0385d40fbd80311": "10000000000000000000000",
+ "0xeb835c1a911817878a33d167569ea3cdd387f328": "1000000000000000000000",
+ "0x761a6e362c97fbbd7c5977acba2da74687365f49": "183840000000000000000",
+ "0x38202c5cd7078d4f887673ab07109ad8ada89720": "1000000000000000000000",
+ "0x5abfec25f74cd88437631a7731906932776356f9": "11901484239480000000000000",
+ "0x28e4af30cd93f686a122ad7bb19f8a8785eee342": "2101000000000000000000",
+ "0x3a9b111029ce1f20c9109c7a74eeeef34f4f2eb2": "4000000000000000000000",
+ "0x7bb9571f394b0b1a8eba5664e9d8b5e840677bea": "19700000000000000000",
+ "0x50fb36c27107ee2ca9a3236e2746cca19ace6b49": "2000000000000000000000",
+ "0xa3bc979b7080092fa1f92f6e0fb347e28d995045": "2800000000000000000000",
+ "0xd04b861b3d9acc563a901689941ab1e1861161a2": "20000000000000000000",
+ "0x58c555bc293cdb16c6362ed97ae9550b92ea180e": "20000000000000000000",
+ "0x8bf02bd748690e1fd1c76d270833048b66b25fd3": "11800000000000000000000",
+ "0xfbc01db54e47cdc3c438694ab717a856c23fe6e9": "8456774000000000000000",
+ "0x9c9a07a8e57c3172a919ef64789474490f0d9f51": "10000000000000000000000",
+ "0xfc7e22a503ec5abe9b08c50bd14999f520fa4884": "6387725000000000000000",
+ "0x9b773669e87d76018c090f8255e54409b9dca8b2": "20000000000000000000",
+ "0xffe8cbc1681e5e9db74a0f93f8ed25897519120f": "1507000000000000000000",
+ "0x4d4cf5807429615e30cdface1e5aae4dad3055e6": "600000000000000000000",
+ "0xcfde0fc75d6f16c443c3038217372d99f5d907f7": "2419000000000000000000",
+ "0x818ffe271fc3973565c303f213f6d2da89897ebd": "5734655000000000000000",
+ "0xba1fcaf223937ef89e85675503bdb7ca6a928b78": "640000000000000000000",
+ "0xa30a45520e5206d9004070e6af3e7bb2e8dd5313": "400000000000000000000",
+ "0xa747439ad0d393b5a03861d77296326de8bb9db9": "1000000000000000000000",
+ "0x14d00aad39a0a7d19ca05350f7b03727f08dd82e": "500000000000000000000",
+ "0x551999ddd205563327b9b530785acff9bc73a4ba": "6000000000000000000000",
+ "0xa4670731175893bbcff4fa85ce97d94fc51c4ba8": "8000000000000000000000",
+ "0xf858171a04d357a13b4941c16e7e55ddd4941329": "41984000000000000000",
+ "0xa6484cc684c4c91db53eb68a4da45a6a6bda3067": "6000000000000000000000",
+ "0x00d75ed60c774f8b3a5a5173fb1833ad7105a2d9": "2005500000000000000000",
+ "0xbf92418a0c6c31244d220260cb3e867dd7b4ef49": "99800000000000000000",
+ "0x716d50cca01e938500e6421cc070c3507c67d387": "2000000000000000000000",
+ "0x82a8b96b6c9e13ebec1e9f18ac02a60ea88a48ff": "1999998000000000000000",
+ "0x5a565285374a49eedd504c957d510874d00455bc": "100000000000000000000",
+ "0x778c79f4de1953ebce98fe8006d53a81fb514012": "999800000000000000000",
+ "0x41b2d34fde0b1029262b4172c81c1590405b03ae": "1000000000000000000000",
+ "0x4039bd50a2bde15ffe37191f410390962a2b8886": "200000000000000000000",
+ "0xc033be10cb48613bd5ebcb33ed4902f38b583003": "3000000000000000000000",
+ "0x5d5751819b4f3d26ed0c1ac571552735271dbefa": "1000000000000000000000",
+ "0xb600429752f399c80d0734744bae0a022eca67c6": "20000000000000000000",
+ "0xf875619d8a23e45d8998d184d480c0748970822a": "4000000000000000000000",
+ "0x71c7230a1d35bdd6819ed4b9a88e94a0eb0786dd": "4365000000000000000000",
+ "0xb2f9c972c1e9737755b3ff1b3088738396395b26": "20000000000000000000000",
+ "0xa66a4963b27f1ee1932b172be5964e0d3ae54b51": "173000000000000000000",
+ "0x53ce88e66c5af2f29bbd8f592a56a3d15f206c32": "140840000000000000000",
+ "0x433e3ba1c51b810fc467d5ba4dea42f7a9885e69": "40000000000000000000000",
+ "0xc7837ad0a0bf14186937ace06c5546a36aa54f46": "4000000000000000000000",
+ "0xc3f8f67295a5cd049364d05d23502623a3e52e84": "6000000000000000000000",
+ "0x3fd0bb47798cf44cdfbe4d333de637df4a00e45c": "100040000000000000000",
+ "0xa1ae8d4540d4db6fdde7146f415b431eb55c7983": "197000000000000000000",
+ "0x5cccf1508bfd35c20530aa642500c10dee65eaed": "850000000000000000000",
+ "0xa53ead54f7850af21438cbe07af686279a315b86": "10000000000000000000000",
+ "0x8cf6da0204dbc4860b46ad973fc111008d9e0c46": "200000000000000000000",
+ "0x8e7936d592008fdc7aa04edeeb755ab513dbb89d": "20000000000000000000",
+ "0x4a53dcdb56ce4cdce9f82ec0eb13d67352e7c88b": "4200000000000000000000",
+ "0x2b4f4507bb6b9817942ce433781b708fbcd166fd": "18200000000000000000",
+ "0x026432af37dc5113f1f46d480a4de0b28052237e": "355800000000000000000",
+ "0xe780a56306ba1e6bb331952c22539b858af9f77d": "50000000000000000000000",
+ "0xd1f1694d22671b5aad6a94995c369fbe6133676f": "1000000000000000000000",
+ "0x7c45f0f8442a56dbd39dbf159995415c52ed479b": "2000000000000000000000",
+ "0xb65941d44c50d24666670d364766e991c02e11c2": "600000000000000000000",
+ "0x45e68db8dbbaba5fc2cb337c62bcd0d61b059189": "2000000000000000000000",
+ "0x05f3631f5664bdad5d0132c8388d36d7d8920918": "20000000000000000000",
+ "0x5475d7f174bdb1f789017c7c1705989646079d49": "9400000000000000000000",
+ "0xc7bf2ed1ed312940ee6aded1516e268e4a604856": "6000000000000000000000",
+ "0x39aaf0854db6eb39bc7b2e43846a76171c0445de": "1850000000000000000000",
+ "0xc817df1b91faf30fe3251571727c9711b45d8f06": "1999944000000000000000",
+ "0x7d13d6705884ab2157dd8dcc7046caf58ee94be4": "137200000000000000000000",
+ "0x478dc09a1311377c093f9cc8ae74111f65f82f39": "4000000000000000000000",
+ "0x8043ed22f997e5a2a4c16e364486ae64975692c4": "1130513000000000000000",
+ "0xb9a985501ee950829b17fae1c9cf348c3156542c": "294100000000000000000",
+ "0xd5cba5b26bea5d73fabb1abafacdef85def368cc": "200000000000000000000",
+ "0x6776e133d9dc354c12a951087b639650f539a433": "120000000000000000000",
+ "0x804ca94972634f633a51f3560b1d06c0b293b3b1": "200000000000000000000",
+ "0x0be1fdf626ee6189102d70d13b31012c95cd1cd6": "2000000000000000000000",
+ "0xf848fce9ab611c7d99206e23fac69ad488b94fe1": "48500000000000000000",
+ "0xf01195d657ef3c942e6cb83949e5a20b5cfa8b1e": "25760000000000000000000",
+ "0x78a5e89900bd3f81dd71ba869d25fec65261df15": "51900000000000000000000",
+ "0xd6f1e55b1694089ebcb4fe7d7882aa66c8976176": "19998846000000000000000",
+ "0xd5294b666242303b6df0b1c88d37429bc8c965aa": "300700000000000000000",
+ "0x3171877e9d820cc618fc0919b29efd333fda4934": "1000000000000000000000",
+ "0x2901f8077f34190bb47a8e227fa29b30ce113b31": "100000000000000000000",
+ "0x6b2284440221ce16a8382de5ff0229472269deec": "1000000000000000000000",
+ "0x1bba03ff6b4ad5bf18184acb21b188a399e9eb4a": "1790000000000000000000",
+ "0x80744618de396a543197ee4894abd06398dd7c27": "2000000000000000000000",
+ "0x1b799033ef6dc7127822f74542bb22dbfc09a308": "100000000000000000000",
+ "0xd513a45080ff2febe62cd5854abe29ee4467f996": "153200000000000000000",
+ "0xe761d27fa3502cc76bb1a608740e1403cf9dfc69": "280000000000000000000",
+ "0x53989ed330563fd57dfec9bd343c3760b0799390": "6208000000000000000000",
+ "0xccf7110d1bd9a74bfd1d7d7d2d9d55607e7b837d": "900000000000000000000",
+ "0xf373e9daac0c8675f53b797a160f6fc034ae6b23": "100000000000000000000",
+ "0xabc9a99e8a2148a55a6d82bd51b98eb5391fdbaf": "6000000000000000000000",
+ "0xffec0913c635baca2f5e57a37aa9fb7b6c9b6e26": "805000000000000000000",
+ "0x581a3af297efa4436a29af0072929abf9826f58b": "2000000000000000000000",
+ "0x924efa6db595b79313277e88319625076b580a10": "2000000000000000000000",
+ "0x65d8dd4e251cbc021f05b010f2d5dc520c3872e0": "834956000000000000000",
+ "0x6c67d6db1d03516c128b8ff234bf3d49b26d2941": "100000000000000000000000",
+ "0x496d365534530a5fc1577c0a5241cb88c4da7072": "1790000000000000000000",
+ "0xb85ff03e7b5fc422981fae5e9941dacbdaba7584": "1337000000000000000000",
+ "0xe13540ecee11b212e8b775dc8e71f374aae9b3f8": "2000000000000000000000",
+ "0xa02e3f8f5959a7aab7418612129b701ca1b80010": "20000000000000000000",
+ "0xa7a3f153cdc38821c20c5d8c8241b294a3f82b24": "500000000000000000000",
+ "0x366175403481e0ab15bb514615cbb989ebc68f82": "2000000000000000000000",
+ "0x5104ecc0e330dd1f81b58ac9dbb1a9fbf88a3c85": "100000000000000000000000",
+ "0xa466d770d898d8c9d405e4a0e551efafcde53cf9": "492500000000000000000",
+ "0x5fa8a54e68176c4fe2c01cf671c515bfbdd528a8": "330000000000000000000000",
+ "0xe2e15c60dd381e3a4be25071ab249a4c5c5264da": "2350502000000000000000",
+ "0x0628bfbe5535782fb588406bc96660a49b011af5": "1520000000000000000000",
+ "0x04d6b8d4da867407bb997749debbcdc0b358538a": "1000000000000000000000",
+ "0x0e6ec313376271dff55423ab5422cc3a8b06b22b": "4000000000000000000000",
+ "0x8787d12677a5ec291e57e31ffbfad105c3324b87": "12438777000000000000000",
+ "0x58e2f11223fc8237f69d99c6289c148c0604f742": "24000000000000000000000",
+ "0x5600730a55f6b20ebd24811faa3de96d1662abab": "1880000000000000000000",
+ "0xfce089635ce97abac06b44819be5bb0a3e2e0b37": "92491000000000000000",
+ "0xfa0c1a988c8a17ad3528eb28b3409daa58225f26": "200000000000000000000",
+ "0x7ae1c19e53c71cee4c73fae2d7fc73bf9ab5e392": "1000000000000000000000",
+ "0xbd17eed82b9a2592019a1b1b3c0fbad45c408d22": "250000000000000000000",
+ "0x884a7a39d0916e05f1c242df55607f37df8c5fda": "23400000000000000000000",
+ "0xca70f4ddbf069d2143bd6bbc7f696b52789b32e7": "3000000000000000000000",
+ "0x7b25bb9ca8e702217e9333225250e53c36804d48": "1880000000000000000000",
+ "0xea8317197959424041d9d7c67a3ece1dbb78bb55": "394000000000000000000",
+ "0x5cb953a0e42f5030812226217fffc3ce230457e4": "100000000000000000000",
+ "0xd1f4dc1ddb8abb8848a8b14e25f3b55a8591c266": "250000000000000000000",
+ "0x6a42ca971c6578d5ade295c3e7f4ad331dd3424e": "6000000000000000000000",
+ "0x07e1162ceae3cf21a3f62d105990302e307f4e3b": "1530000000000000000000",
+ "0x5d1dc3387b47b8451e55106c0cc67d6dc72b7f0b": "2000000000000000000000",
+ "0x5d2819e8d57821922ee445650ccaec7d40544a8d": "200000000000000000000",
+ "0x4c24b78baf2bafc7fcc69016426be973e20a50b2": "3000000000000000000000",
+ "0x630c5273126d517ce67101811cab16b8534cf9a8": "9422595000000000000000",
+ "0x291f929ca59b54f8443e3d4d75d95dee243cef78": "499938000000000000000",
+ "0x2dd325fdffb97b19995284afa5abdb574a1df16a": "500000000000000000000",
+ "0x4fce8429ba49caa0369d1e494db57e89eab2ad39": "200000000000000000000000",
+ "0x712b76510214dc620f6c3a1dd29aa22bf6d214fb": "6000000000000000000000",
+ "0x266f2da7f0085ef3f3fa09baee232b93c744db2e": "60000000000000000000000",
+ "0x0770c61be78772230cb5a3bb2429a72614a0b336": "6767695000000000000000",
+ "0x02dfcb17a1b87441036374b762a5d3418b1cb4d4": "1340860000000000000000",
+ "0x5e67df8969101adabd91accd6bb1991274af8df2": "500000000000000000000",
+ "0x7d9c59631e2ba2e8e82891f3979922aaa3b567a1": "8000000000000000000000",
+ "0x949f8c107bc7f0aceaa0f17052aadbd2f9732b2e": "2000000000000000000000",
+ "0xea4e809e266ae5f13cdbe38f9d0456e6386d1274": "4500000000000000000000",
+ "0xcd5510a242dfb0183de925fba866e312fabc1657": "2400000000000000000000",
+ "0xa36e0d94b95364a82671b608cb2d373245612909": "150011000000000000000",
+ "0x0ec46696ffac1f58005fa8439824f08eed1df89b": "10000000000000000000000",
+ "0xc6fb1ee37417d080a0d048923bdabab095d077c6": "200000000000000000000",
+ "0x53c9eca40973f63bb5927be0bc6a8a8be1951f74": "2000000000000000000000",
+ "0xea14bfda0a6e76668f8788321f07df37824ec5df": "200000000000000000000000",
+ "0xdfb4d4ade52fcc818acc7a2c6bb2b00224658f78": "7750000000000000000000",
+ "0x5997ffefb3c1d9d10f1ae2ac8ac3c8e2d2292783": "1000000000000000000000",
+ "0x8eceb2e124536c5b5ffc640ed14ff15ed9a8cb71": "2000000000000000000000",
+ "0x8f02bda6c36922a6be6a509be51906d393f7b99b": "1019835000000000000000",
+ "0x530077c9f7b907ff9cec0c77a41a70e9029add4a": "2000000000000000000000",
+ "0x08936a37df85b3a158cafd9de021f58137681347": "18200000000000000000",
+ "0x8e9c429266df057efa78dd1d5f77fc40742ad466": "300061000000000000000",
+ "0xacc59f3b30ceffc56461cc5b8df48902240e0e7b": "2000000000000000000000",
+ "0xf5534815dc635efa5cc84b2ac734723e21b29372": "1580000000000000000000",
+ "0xf873e57a65c93b6e18cb75f0dc077d5b8933dc5c": "197000000000000000000",
+ "0x25b78c9fad85b43343f0bfcd0fac11c9949ca5eb": "2000000000000000000000",
+ "0xaad2b7f8106695078e6c138ec81a7486aaca1eb2": "200000000000000000000",
+ "0x509c8668036d143fb8ae70b11995631f3dfcad87": "1000000000000000000000",
+ "0x3602458da86f6d6a9d9eb03daf97fe5619d442fa": "2000000000000000000000",
+ "0x9f607b3f12469f446121cebf3475356b71b4328c": "4000000000000000000000",
+ "0xfe3827d57630cf8761d512797b0b858e478bbd12": "20000000000000000000",
+ "0x9d9c4efe9f433989e23be94049215329fa55b4cb": "256215000000000000000",
+ "0x9bd905f1719fc7acd0159d4dc1f8db2f21472338": "1000000000000000000000",
+ "0x7d82e523cc2dc591da3954e8b6bb2caf6461e69c": "2316058000000000000000",
+ "0x74afe54902d615782576f8baac13ac970c050f6e": "177670000000000000000",
+ "0xaff11ccf699304d5f5862af86083451c26e79ae5": "1999000000000000000000",
+ "0x3885fee67107dc3a3c741ee290c98918c9b99397": "20000000000000000000",
+ "0x36343aeca07b6ed58a0e62fa4ecb498a124fc971": "300000000000000000000",
+ "0xc94a28fb3230a9ddfa964e770f2ce3c253a7be4f": "200000000000000000000",
+ "0x9882967cee68d2a839fad8ab4a7c3dddf6c0adc8": "1336866000000000000000",
+ "0x95df4e3445d7662624c48eba74cf9e0a53e9f732": "56000000000000000000000",
+ "0xca9faa17542fafbb388eab21bc4c94e8a7b34788": "1999999000000000000000",
+ "0xc8b1850525d946f2ae84f317b15188c536a5dc86": "2685000000000000000000",
+ "0x39bac68d947859f59e9226089c96d62e9fbe3cde": "40000000000000000000",
+ "0xa9bfc410dddb20711e45c07387eab30a054e19ac": "1154750000000000000000",
+ "0x540a1819bd7c35861e791804e5fbb3bc97c9abb1": "1454400000000000000000",
+ "0x667b61c03bb937a9f5d0fc5a09f1ea3363c77035": "4250000000000000000000",
+ "0x010df1df4bed23760d2d1c03781586ddf7918e54": "60000000000000000000",
+ "0xbd51ee2ea143d7b1d6b77e7e44bdd7da12f485ac": "1318800000000000000000",
+ "0xfb5125bf0f5eb0b6f020e56bfc2fdf3d402c097e": "5910000000000000000000",
+ "0x3f0c83aac5717962734e5ceaeaecd39b28ad06be": "2000000000000000000000",
+ "0xf10661ff94140f203e7a482572437938bec9c3f7": "20000000000000000000000",
+ "0xbd3097a79b3c0d2ebff0e6e86ab0edadbed47096": "1670000000000000000000",
+ "0xedeb4894aadd0081bbddd3e8846804b583d19f27": "2000000000000000000000",
+ "0x49c9771fca19d5b9d245c891f8158fe49f47a062": "10000000000000000000000",
+ "0x6405dd13e93abcff377e700e3c1a0086eca27d29": "18200000000000000000",
+ "0xce5e04f0184369bcfa06aca66ffa91bf59fa0fb9": "40000000000000000000",
+ "0x4364309a9fa07095600f79edc65120cdcd23dc64": "10000000000000000000000",
+ "0xb749b54e04d5b19bdcedfb84da7701ab478c27ae": "2680000000000000000000",
+ "0xf593c65285ee6bbd6637f3be8f89ad40d489f655": "3000000000000000000000",
+ "0xd224f880f9479a89d32f09e52be990b288135cef": "17300000000000000000000",
+ "0x85bb51bc3bfe9a1b2a2f6b1cda95bca8b38c8d5e": "321750000000000000000",
+ "0xcaf4481d9db78dc4f25f7b4ac8bd3b1ca0106b31": "5000000000000000000000",
+ "0x51ca8bd4dc644fac47af675563d5804a0da21eeb": "788000000000000000000",
+ "0x19f643e1a8fa04ae16006028138333a59a96de87": "20000000000000000000",
+ "0x58b808a65b51e6338969afb95ec70735e451d526": "39998000000000000000000",
+ "0x574921838cc77d6c98b17d903a3ae0ee0da95bd0": "53480000000000000000000",
+ "0x7c6924d07c3ef5891966fe0a7856c87bef9d2034": "2000000000000000000000",
+ "0xf9767e4ecb4a5980527508d7bec3d45e4c649c13": "1910000000000000000000",
+ "0xf3be99b9103ce7550aa74ff1db18e09dfe32e005": "2000000000000000000000",
+ "0x625644c95a873ef8c06cdb9e9f6d8d7680043d62": "1800000000000000000000",
+ "0x6a44af96b3f032ae641beb67f4b6c83342d37c5d": "29000000000000000000",
+ "0xd3a10ec7a5c9324999dd9e9b6bde7c911e584bda": "600000000000000000000",
+ "0xe8ddbed732ebfe754096fde9086b8ea4a4cdc616": "2000000000000000000000",
+ "0x235fa66c025ef5540070ebcf0d372d8177c467ab": "33400000000000000000000",
+ "0x4d08471d68007aff2ae279bc5e3fe4156fbbe3de": "40000000000000000000000",
+ "0xdadc00ab7927603c2fcf31cee352f80e6c4d6351": "1999664000000000000000",
+ "0x7393cbe7f9ba2165e5a7553500b6e75da3c33abf": "100000000000000000000",
+ "0x77617ebc4bebc5f5ddeb1b7a70cdeb6ae2ffa024": "1970000000000000000000",
+ "0x7fea1962e35d62059768c749bedd96cab930d378": "2000000000000000000000",
+ "0x243b3bca6a299359e886ce33a30341fafe4d573d": "20000000000000000000000",
+ "0xb94d47b3c052a5e50e4261ae06a20f45d8eee297": "2000000000000000000000",
+ "0xe727e67ef911b81f6cf9c73fcbfebc2b02b5bfc6": "2000000000000000000000",
+ "0xe510d6797fba3d6693835a844ea2ad540691971b": "17381000000000000000000",
+ "0x0cdc960b998c141998160dc179b36c15d28470ed": "500038000000000000000",
+ "0x3e76a62db187aa74f63817533b306cead0e8cebe": "31200000000000000000000",
+ "0x495b641b1cdea362c3b4cbbd0f5cc50b1e176b9c": "1000000000000000000000",
+ "0x5126460d692c71c9af6f05574d93998368a23799": "52000000000000000000",
+ "0xa008019863c1a77c1499eb39bbd7bf2dd7a31cb9": "137000000000000000000",
+ "0x65ee20b06d9ad589a7e7ce04b9f5f795f402aece": "2000000000000000000000",
+ "0xf432b9dbaf11bdbd73b6519fc0a904198771aac6": "152000000000000000000",
+ "0x85946d56a4d371a93368539690b60ec825107454": "1730000000000000000000",
+ "0x26f9f7cefd7e394b9d3924412bf2c2831faf1f85": "4000000000000000000000",
+ "0xd4ebb1929a23871cf77fe049ab9602be08be0a73": "1910000000000000000000",
+ "0x4fdac1aa517007e0089430b3316a1badd12c01c7": "500000000000000000000",
+ "0x05e671de55afec964b074de574d5158d5d21b0a3": "3940000000000000000000",
+ "0x20181c4b41f6f972b66958215f19f570c15ddff1": "1600000000000000000000",
+ "0xcc9519d1f3985f6b255eaded12d5624a972721e1": "1000000000000000000000",
+ "0x169bbefc41cfd7d7cbb8dfc63020e9fb06d49546": "2000000000000000000000",
+ "0x175a183a3a235ffbb03ba835675267229417a091": "16000000000000000000000",
+ "0x8dde3cb8118568ef4503fe998ccdf536bf19a098": "4000000000000000000000",
+ "0x6a05b21c4f17f9d73f5fb2b0cb89ff5356a6cc7e": "1500000000000000000000",
+ "0x5cc4cba621f220637742057f6055b80dffd77e13": "39997692000000000000000",
+ "0xecb94c568bfe59ade650645f4f26306c736cace4": "267400000000000000000",
+ "0xdfa6b8b8ad3184e357da282951d79161cfb089bc": "400000000000000000000",
+ "0xa3058c51737a4e96c55f2ef6bd7bb358167ec2a7": "606093000000000000000",
+ "0x051d424276b21239665186133d653bb8b1862f89": "1000000000000000000000",
+ "0xd05ffb2b74f867204fe531653b0248e21c13544e": "1000000000000000000000",
+ "0xe1f63ebbc62c7b7444040eb99623964f7667b376": "20000000000000000000",
+ "0xe5a3d7eb13b15c100177236d1beb30d17ee15420": "2000000000000000000000",
+ "0x18fa8625c9dc843c78c7ab259ff87c9599e07f10": "1000000000000000000000",
+ "0x64264aedd52dcae918a012fbcd0c030ee6f71821": "1000000000000000000000",
+ "0x6f1f4907b8f61f0c51568d692806b382f50324f5": "2000000000000000000000",
+ "0xbecef61c1c442bef7ce04b73adb249a8ba047e00": "1000400000000000000000",
+ "0x7b893286427e72db219a21fc4dcd5fbf59283c31": "10000000000000000000000",
+ "0xce5eb63a7bf4fbc2f6e4baa0c68ab1cb4cf98fb4": "2000000000000000000000",
+ "0x66ec16ee9caab411c55a6629e318de6ee216491d": "865000000000000000000",
+ "0x30b66150f1a63457023fdd45d0cc6cb54e0c0f06": "1000000000000000000000",
+ "0x87183160d172d2e084d327b86bcb7c1d8e6784ef": "4000086000000000000000",
+ "0xc420388fbee84ad656dd68cdc1fbaa9392780b34": "187767000000000000000",
+ "0x90f774c9147dde90853ddc43f08f16d455178b8c": "4000000000000000000000",
+ "0x1e1d7a5f2468b94ea826982dbf2125793c6e4a5a": "999940000000000000000",
+ "0x8043fdd0bc4c973d1663d55fc135508ec5d4f4fa": "20000000000000000000",
+ "0x7bca1da6c80a66baa5db5ac98541c4be276b447d": "679000000000000000000",
+ "0x73550beb732ba9ddafda7ae406e18f7feb0f8bb2": "2800000000000000000000",
+ "0xadc19ec835afe3e58d87dc93a8a9213c90451326": "1971200000000000000000",
+ "0x821d798af19989c3ae5b84a7a7283cd7fda1fabe": "20000000000000000000000",
+ "0x4c4e6f13fb5e3f70c3760262a03e317982691d10": "100000000000000000000",
+ "0x664e43119870af107a448db1278b044838ffcdaf": "400000000000000000000",
+ "0x8da1178f55d97772bb1d24111a404a4f8715b95d": "878149000000000000000",
+ "0x5e6e9747e162f8b45c656e0f6cae7a84bac80e4e": "2000000000000000000000",
+ "0xc7eac31abce6d5f1dea42202b6a674153db47a29": "591000000000000000000",
+ "0xd96711540e2e998343d4f590b6fc8fac3bb8b31d": "1758944000000000000000",
+ "0x9da4ec407077f4b9707b2d9d2ede5ea5282bf1df": "4000000000000000000000",
+ "0xf60c1b45f164b9580e20275a5c39e1d71e35f891": "2000000000000000000000",
+ "0xeb6394a7bfa4d28911d5a5b23e93f35e340c2294": "78000000000000000000",
+ "0xa89ac93b23370472daac337e9afdf642543f3e57": "10000000000000000000000",
+ "0xbb618e25221ad9a740b299ed1406bc3934b0b16d": "1000000000000000000000",
+ "0x817ac33bd8f847567372951f4a10d7a91ce3f430": "200015000000000000000",
+ "0xfe6a895b795cb4bf85903d3ce09c5aa43953d3bf": "3400000000000000000000",
+ "0x3673954399f6dfbe671818259bb278e2e92ee315": "200000000000000000000000",
+ "0xdf0ff1f3d27a8ec9fb8f6b0cb254a63bba8224a5": "4367636000000000000000",
+ "0xff12e49d8e06aa20f886293c0b98ed7eff788805": "4000000000000000000000",
+ "0x5aef16a226dd68071f2483e1da42598319f69b2c": "2000000000000000000000",
+ "0x0266ab1c6b0216230b9395443d5fa75e684568c6": "1000000000000000000000",
+ "0x14a7352066364404db50f0d0d78d754a22198ef4": "1880000000000000000000",
+ "0x444caf79b71338ee9aa7c733b02acaa7dc025948": "40000000000000000000",
+ "0x64e2de21200b1899c3a0c0653b5040136d0dc842": "20000000000000000000000",
+ "0x36e156610cd8ff64e780d89d0054385ca76755aa": "14000000000000000000000",
+ "0x0a6ebe723b6ed1f9a86a69ddda68dc47465c2b1b": "1185000000000000000000",
+ "0x38bf2a1f7a69de0e2546adb808b36335645da9ff": "2000320000000000000000",
+ "0x39f44663d92561091b82a70dcf593d754005973a": "199999000000000000000",
+ "0x24b9e6644f6ba4cde126270d81f6ab60f286dff4": "133700000000000000000",
+ "0x9b59eb213b1e7565e45047e04ea0374f10762d16": "2000000000000000000000",
+ "0x309544b6232c3dd737f945a03193d19b5f3f65b9": "1087440000000000000000",
+ "0xb28bb39f3466517cd46f979cf59653ee7d8f152e": "450000000000000000000",
+ "0x9da8e22ca10e67fea44e525e4751eeac36a31194": "260000000000000000000",
+ "0x4f8ae80238e60008557075ab6afe0a7f2e74d729": "100000000000000000000",
+ "0x74ed33acf43f35b98c9230b9e6642ecb5330839e": "681872000000000000000",
+ "0x22842ab830da509913f81dd1f04f10af9edd1c55": "2000000000000000000000",
+ "0xa8f37f0ab3a1d448a9e3ce40965f97a646083a34": "329800000000000000000",
+ "0x582b70669c97aab7d68148d8d4e90411e2810d56": "999972000000000000000",
+ "0xd5e55100fbd1956bbed2ca518d4b1fa376032b0b": "100000000000000000000",
+ "0xb7cc6b1acc32d8b295df68ed9d5e60b8f64cb67b": "300000000000000000000",
+ "0xe081ca1f4882db6043d5a9190703fde0ab3bf56d": "400000000000000000000",
+ "0xc02077449a134a7ad1ef7e4d927affeceeadb5ae": "18200000000000000000",
+ "0xe09fea755aee1a44c0a89f03b5deb762ba33006f": "1100070000000000000000",
+ "0xb3717731dad65132da792d876030e46ac227bb8a": "1000000000000000000000",
+ "0x157eb3d3113bd3b597714d3a954edd018982a5cb": "2000000000000000000000",
+ "0xdc57345b38e0f067c9a31d9deac5275a10949321": "200000000000000000000",
+ "0x40ea5044b204b23076b1a5803bf1d30c0f88871a": "14000000000000000000000",
+ "0x2bab0fbe28d58420b52036770a12f9952aea6911": "3820000000000000000000",
+ "0xadaa0e548c035affed64ca678a963fabe9a26bfd": "70000000000000000000",
+ "0xbb48eaf516ce2dec3e41feb4c679e4957641164f": "3820000000000000000000",
+ "0x7693bdeb6fc82b5bca721355223175d47a084b4d": "22000000000000000000000",
+ "0x03cb98d7acd817de9d886d22fab3f1b57d92a608": "1600000000000000000000",
+ "0xf88900db737955b1519b1a7d170a18864ce590eb": "18200000000000000000",
+ "0x757fa55446c460968bb74b5ebca96c4ef2c709c5": "1015200000000000000000",
+ "0xda855d53477f505ec4c8d5e8bb9180d38681119c": "5600000000000000000000",
+ "0xe41aea250b877d423a63ba2bce2f3a61c0248d56": "260000000000000000000",
+ "0x8262169b615870134eb4ac6c5f471c6bf2f789fc": "462500000000000000000",
+ "0x66b0c100c49149935d14c0dc202cce907cea1a3d": "1970000000000000000000",
+ "0x854c0c469c246b83b5d1b3eca443b39af5ee128a": "1600000000000000000000",
+ "0xeb6810691d1ae0d19e47bd22cebee0b3ba27f88a": "2499922000000000000000",
+ "0x24dcc24bd9c7210ceacfb30da98ae04a4d7b8ab9": "1000000000000000000000",
+ "0xe31b4eef184c24ab098e36c802714bd4743dd0d4": "200000000000000000000",
+ "0x99b8c824869de9ed24f3bff6854cb6dd45cc3f9f": "1880000000000000000000",
+ "0x2ae73a79aea0278533accf21070922b1613f8f32": "3097417000000000000000",
+ "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a": "10000000000000000000000",
+ "0x1b4bbcb18165211b265b280716cb3f1f212176e8": "472325000000000000000",
+ "0xe177e0c201d335ba3956929c571588b51c5223ae": "2000000000000000000000",
+ "0x1945fe377fe6d4b71e3e791f6f17db243c9b8b0f": "2185500000000000000000",
+ "0x3e9b34a57f3375ae59c0a75e19c4b641228d9700": "17900000000000000000",
+ "0xa4d6c82eddae5947fbe9cdfbd548ae33d91a7191": "8000000000000000000000",
+ "0xbad4425e171c3e72975eb46ac0a015db315a5d8f": "2000000000000000000000",
+ "0xa2d2aa626b09d6d4e4b13f7ffc5a88bd7ad36742": "4639390000000000000000",
+ "0xb61c34fcacda701a5aa8702459deb0e4ae838df8": "35000000000000000000000",
+ "0x145e0600e2a927b2dd8d379356b45a2e7d51d3ae": "2545843000000000000000",
+ "0x8df339214b6ad1b24663ce716034749d6ef838d9": "11000000000000000000000",
+ "0x8fd9a5c33a7d9edce0997bdf77ab306424a11ea9": "2000000000000000000000",
+ "0x097da12cfc1f7c1a2464def08c29bed5e2f851e9": "20000000000000000000",
+ "0xddabf13c3c8ea4e3d73d78ec717afafa430e5479": "41600000000000000000000",
+ "0x9eeb07bd2b7890195e7d46bdf2071b6617514ddb": "2000000000000000000000",
+ "0x819af9a1c27332b1c369bbda1b3de1c6e933d640": "314308000000000000000",
+ "0xd7d2c6fca8ad1f75395210b57de5dfd673933909": "340000000000000000000",
+ "0xcdd5d881a7362c9070073bdfbc75e72453ac510e": "842000000000000000000",
+ "0xe9ac36376efa06109d40726307dd1a57e213eaa9": "194000000000000000000",
+ "0x1bea4df5122fafdeb3607eddda1ea4ffdb9abf2a": "346000000000000000000",
+ "0x3e5e93fb4c9c9d1246f8f247358e22c3c5d17b6a": "150000000000000000000",
+ "0x6c1ddd33c81966dc8621776071a4129482f2c65f": "40000000000000000000000",
+ "0x2ccb66494d0af689abf9483d365d782444e7dead": "1000000000000000000000",
+ "0x19571a2b8f81c6bcf66ab3a10083295617150003": "492500000000000000000",
+ "0x38ac664ee8e0795e4275cb852bcba6a479ad9c8d": "20000000000000000000",
+ "0xc4803bb407c762f90b7596e6fde194931e769590": "4000000000000000000000",
+ "0x93507e9e8119cbceda8ab087e7ecb071383d6981": "14000000000000000000000",
+ "0xb672734afcc224e2e609fc51d4f059732744c948": "295500000000000000000",
+ "0xfbbbebcfbe235e57dd2306ad1a9ec581c7f9f48f": "40000000000000000000",
+ "0x8c81410ea8354cc5c65c41be8bd5de733c0b111d": "9550000000000000000000",
+ "0x942c6b8c955bc0d88812678a236725b32739d947": "1550000000000000000000",
+ "0xd2e817738abf1fb486583f80c350318bed860c80": "240010000000000000000",
+ "0xbff5df769934b8943ca9137d0efef2fe6ebbb34e": "100000000000000000000",
+ "0x6c4e426e8dc005dfa3516cb8a680b02eea95ae8e": "1337000000000000000000",
+ "0xf645dd7c890093e8e4c8aa92a6bb353522d3dc98": "134000000000000000000",
+ "0x4bac846af4169f1d95431b341d8800b22180af1a": "20000000000000000000",
+ "0x0514954c3c2fb657f9a06f510ea22748f027cdd3": "400000000000000000000",
+ "0x163dca73d7d6ea3f3e6062322a8734180c0b78ef": "2941400000000000000000",
+ "0xfeaca2ac74624bf348dac9985143cfd652a4be55": "26148245000000000000000",
+ "0xfe80e9232deaff19baf99869883a4bdf0004e53c": "855680000000000000000",
+ "0x17108dab2c50f99de110e1b3b3b4cd82f5df28e7": "980000000000000000000",
+ "0x837a645dc95c49549f899c4e8bcf875324b2f57c": "600400000000000000000",
+ "0x762998e1d75227fced7a70be109a4c0b4ed86414": "20000000000000000000",
+ "0xc0a7e8435dff14c25577739db55c24d5bf57a3d9": "49250000000000000000000",
+ "0xaead88d689416b1c91f2364421375b7d3c70fb2e": "2000000000000000000000",
+ "0x9279b2228cec8f7b4dda3f320e9a0466c2f585ca": "5000000000000000000000",
+ "0x36726f3b885a24f92996da81625ec8ad16d8cbe6": "1543723000000000000000",
+ "0x3951e48e3c869e6b72a143b6a45068cdb9d466d0": "20000000000000000000",
+ "0xf5d61ac4ca95475e5b7bffd5f2f690b316759615": "31040000000000000000000",
+ "0x158a0d619253bf4432b5cd02c7b862f7c2b75636": "135733000000000000000",
+ "0xe56d431324c92911a1749df292709c14b77a65cd": "8200000000000000000000",
+ "0x9976947eff5f6ae5da08dd541192f378b428ff94": "8000000000000000000000",
+ "0x83210583c16a4e1e1dac84ebd37e3d0f7c57eba4": "2000000000000000000000",
+ "0xdcb64df43758c7cf974fa660484fbb718f8c67c1": "20000000000000000000000",
+ "0xd4205592844055b3c7a1f80cefe3b8eb509bcde7": "178973000000000000000",
+ "0xd0648a581b3508e135a2935d12c9657045d871ca": "8022000000000000000000",
+ "0xe7d17524d00bad82497c0f27156a647ff51d2792": "20000000000000000000",
+ "0x21582e99e502cbf3d3c23bdffb76e901ac6d56b2": "100000000000000000000",
+ "0xe61f280915c774a31d223cf80c069266e5adf19b": "880000000000000000000",
+ "0x03c91d92943603e752203e05340e566013b90045": "802200000000000000000",
+ "0x22561c5931143536309c17e832587b625c390b9a": "4000000000000000000000",
+ "0xe399c81a1d701b44f0b66f3399e66b275aaaf8c1": "1000000000000000000000",
+ "0x7f8dbce180ed9c563635aad2d97b4cbc428906d9": "2674000000000000000000",
+ "0x9f61beb46f5e853d0a8521c7446e68e34c7d0973": "560000000000000000000",
+ "0x6d3f2ba856ccbb0237fa7661156b14b013f21240": "1000000000000000000000",
+ "0x5f742e487e3ab81af2f94afdbe1b9b8f5ccc81bc": "2172412000000000000000",
+ "0xb600feab4aa96c537504d96057223141692c193a": "400000000000000000000",
+ "0xfab487500df20fb83ebed916791d561772adbebf": "1999980000000000000000",
+ "0xf8704c16d2fd5ba3a2c01d0eb20484e6ecfa3109": "200000000000000000000",
+ "0x3f1bc420c53c002c9e90037c44fe6a8ef4ddc962": "173000000000000000000",
+ "0x82e577b515cb2b0860aafe1ce09a59e09fe7d040": "600000000000000000000",
+ "0xbc999e385c5aebcac8d6f3f0d60d5aa725336d0d": "2000000000000000000000",
+ "0xe16ce35961cd74bd590d04c4ad4a1989e05691c6": "146000000000000000000",
+ "0xeb76424c0fd597d3e341a9642ad1ee118b2b579d": "4000000000000000000000",
+ "0xc440c7ca2f964b6972ef664a2261dde892619d9c": "20000000000000000000000",
+ "0x460d5355b2ceeb6e62107d81e51270b26bf45620": "2005500000000000000000",
+ "0xfcada300283f6bcc134a91456760b0d77de410e0": "2000000000000000000000",
+ "0xbe8d7f18adfe5d6cc775394989e1930c979d007d": "1000000000000000000000",
+ "0xa7f9220c8047826bd5d5183f4e676a6d77bfed36": "153368000000000000000",
+ "0x98d204f9085f8c8e7de23e589b64c6eff692cc63": "2000000000000000000000",
+ "0x5a2916b8d2e8cc12e207ab464d433e2370d823d9": "2000000000000000000000",
+ "0xc42d6aeb710e3a50bfb44d6c31092969a11aa7f3": "150052000000000000000",
+ "0x04ce45f600db18a9d0851b29d9393ebdaafe3dc5": "20000000000000000000",
+ "0x7a1370a742ec2687e761a19ac5a794329ee67404": "2999988000000000000000",
+ "0xda2ad58e77deddede2187646c465945a8dc3f641": "660000000000000000000",
+ "0xec58bc0d0c20d8f49465664153c5c196fe59e6be": "400000000000000000000",
+ "0xf8063af4cc1dd9619ab5d8bff3fcd1faa8488221": "2000000000000000000000",
+ "0xb9231eb26e5f9e4b4d288f03906704fab96c87d6": "19700000000000000000000",
+ "0x6e5c2d9b1c546a86eefd5d0a5120c9e4e730190e": "199600000000000000000",
+ "0xe49936a92a8ccf710eaac342bc454b9b14ebecb1": "2000000000000000000000",
+ "0x21dbdb817a0d8404c6bdd61504374e9c43c9210e": "9999917000000000000000",
+ "0x5cebe30b2a95f4aefda665651dc0cf7ef5758199": "18200000000000000000",
+ "0x597038ff91a0900cbbab488af483c790e6ec00a0": "10000000000000000000000",
+ "0x0fa5d8c5b3f294efd495ab69d768f81872508548": "2000000000000000000000",
+ "0xfeef3b6eabc94affd3310c1c4d0e65375e131119": "20000000000000000000",
+ "0x1ce81d31a7923022e125bf48a3e03693b98dc9dd": "2000000000000000000000",
+ "0x5887dc6a33dfed5ac1edefe35ef91a216231ac96": "250000000000000000000",
+ "0x4e8e47ae3b1ef50c9d54a38e14208c1abd3603c2": "2235000000000000000000",
+ "0xe845e387c4cbdf982280f6aa01c40e4be958ddb2": "25000000000000000000000",
+ "0x71d9494e50c5dd59c599dba3810ba1755e6537f0": "4000000000000000000000",
+ "0x6eb5578a6bb7c32153195b0d8020a6914852c059": "660000000000000000000000",
+ "0x543f8c674e2462d8d5daa0e80195a8708e11a29e": "63940000000000000000",
+ "0xa0459ef3693aacd1647cd5d8929839204cef53be": "1000000000000000000000",
+ "0xdda371e600d30688d4710e088e02fdf2b9524d5f": "6920000000000000000000",
+ "0xdd4dd6d36033b0636fcc8d0938609f4dd64f4a86": "60000000000000000000",
+ "0x3bd624b548cb659736907ed8aa3c0c705e24b575": "2000000000000000000000",
+ "0x414599092e879ae25372a84d735af5c4e510cd6d": "400000000000000000000",
+ "0x3d66cd4bd64d5c8c1b5eea281e106d1c5aad2373": "1951100000000000000000",
+ "0x5948bc3650ed519bf891a572679fd992f8780c57": "197000000000000000000",
+ "0x8b74a7cb1bb8c58fce267466a30358adaf527f61": "13620000000000000000000",
+ "0x3f10800282d1b7ddc78fa92d8230074e1bf6aeae": "4925000000000000000000",
+ "0x32dbb6716c54e83165829a4abb36757849b6e47d": "1000000000000000000000",
+ "0xe6b3ac3f5d4da5a8857d0b3f30fc4b2b692b77d7": "1460000000000000000000",
+ "0x052a58e035f1fe9cdd169bcf20970345d12b9c51": "1490000000000000000000",
+ "0x581bdf1bb276dbdd86aedcdb397a01efc0e00c5b": "1000000000000000000000",
+ "0x604e9477ebf4727c745bcabbedcb6ccf29994022": "1000060000000000000000",
+ "0x59b96deb8784885d8d3b4a166143cc435d2555a1": "1337000000000000000000",
+ "0x37d980a12ee3bf23cc5cdb63b4ae45691f74c837": "2000000000000000000000",
+ "0x3bfbd3847c17a61cf3f17b52f8eba1b960b3f39f": "3000000000000000000000",
+ "0x49c941e0e5018726b7290fc473b471d41dae80d1": "500000000000000000000",
+ "0xf26bcedce3feadcea3bc3e96eb1040dfd8ffe1a0": "775000000000000000000",
+ "0xd0944aa185a1337061ae20dc9dd96c83b2ba4602": "200000000000000000000",
+ "0x904caa429c619d940f8e6741826a0db692b19728": "1000000000000000000000",
+ "0xb95c9b10aa981cf4a67a71cc52c504dee8cf58bd": "4000000000000000000000",
+ "0x15874686b6733d10d703c9f9bec6c52eb8628d67": "2000000000000000000000",
+ "0x1374facd7b3f8d68649d60d4550ee69ff0484133": "269700000000000000000",
+ "0xb0e469c886593815b3495638595daef0665fae62": "1940000000000000000000",
+ "0x47ff6feb43212060bb1503d7a397fc08f4e70352": "2000000000000000000000",
+ "0xc60b04654e003b4683041f1cbd6bc38fda7cdbd6": "2000000000000000000000",
+ "0x3ecdb532e397579662b2a46141e78f8235936a5f": "66850000000000000000",
+ "0xb3a8c2cb7d358e5739941d945ba9045a023a8bbb": "1000000000000000000000",
+ "0x32ef5cdc671df5562a901aee5db716b9be76dcf6": "2000000000000000000000",
+ "0xc94110e71afe578aa218e4fc286403b0330ace8d": "2000000000000000000000",
+ "0x9b43dcb95fde318075a567f1e6b57617055ef9e8": "3940000000000000000000",
+ "0xefeea010756f81da4ba25b721787f058170befbd": "32470000000000000000",
+ "0xc88255eddcf521c6f81d97f5a42181c9073d4ef1": "290793000000000000000",
+ "0xdd47189a3e64397167f0620e484565b762bfbbf4": "1850000000000000000000",
+ "0x82f39b2758ae42277b86d69f75e628d958ebcab0": "40000000000000000000000",
+ "0xe37f5fdc6ec97d2f866a1cfd0d3a4da4387b22b5": "10000000000000000000000",
+ "0x62331df2a3cbee3520e911dea9f73e905f892505": "2000000000000000000000",
+ "0x8c5d16ed65e3ed7e8b96ca972bc86173e3500b03": "2000000000000000000000",
+ "0x8b9841862e77fbbe919470935583a93cf027e450": "2000054000000000000000",
+ "0xc8dd27f16bf22450f5771b9fe4ed4ffcb30936f4": "197000000000000000000",
+ "0xdec8a1a898f1b895d8301fe64ab3ad5de941f689": "787803000000000000000",
+ "0x61c4ee7c864c4d6b5e37ea1331c203739e826b2f": "30063000000000000000",
+ "0x3250e3e858c26adeccadf36a5663c22aa84c4170": "5000000000000000000000",
+ "0x299e0bca55e069de8504e89aca6eca21d38a9a5d": "55500000000000000000",
+ "0xd50f7fa03e389876d3908b60a537a6706304fb56": "100000000000000000000",
+ "0x69073269729e6414b26ec8dc0fd935c73b579f1e": "30000000000000000000000",
+ "0x14fcd1391e7d732f41766cdacd84fa1deb9ffdd2": "2000000000000000000000",
+ "0x823768746737ce6da312d53e54534e106f967cf3": "20000000000000000000",
+ "0x882f75708386653c80171d0663bfe30b017ed0ad": "2000000000000000000000",
+ "0xa25b086437fd2192d0a0f64f6ed044f38ef3da32": "335000000000000000000",
+ "0x5a9c8b69fc614d69564999b00dcb42db67f97e90": "3429227000000000000000",
+ "0xa2b701f9f5cdd09e4ba62baebae3a88257105885": "1000000000000000000000",
+ "0x5e7b8c54dc57b0402062719dee7ef5e37ea35d62": "2877224000000000000000",
+ "0x7ffabfbc390cbe43ce89188f0868b27dcb0f0cad": "6370000000000000000000",
+ "0xb5cdbc4115406f52e5aa85d0fea170d2979cc7ba": "1337000000000000000000",
+ "0x263814309de4e635cf585e0d365477fc40e66cf7": "146000000000000000000",
+ "0x24cff0e9336a9f80f9b1cb968caf6b1d1c4932a4": "200200000000000000000",
+ "0xd3a941c961e8ca8b1070f23c6d6d0d2a758a4444": "200000000000000000000",
+ "0xa97beb3a48c45f1528284cb6a95f7de453358ec6": "31000000000000000000000",
+ "0x4dd131c74a068a37c90aded4f309c2409f6478d3": "400008000000000000000",
+ "0x653675b842d7d8b461f722b4117cb81dac8e639d": "31000000000000000000",
+ "0x561be9299b3e6b3e63b79b09169d1a948ae6db01": "500000000000000000000",
+ "0xdc067ed3e12d711ed475f5156ef7e71a80d934b9": "9550000000000000000000",
+ "0x08d97eadfcb7b064e1ccd9c8979fbee5e77a9719": "266063000000000000000",
+ "0x6e4c2ab7db026939dbd3bc68384af660a61816b2": "167000000000000000000",
+ "0xbf4c73a7ede7b164fe072114843654e4d8781dde": "2000000000000000000000",
+ "0xf504943aaf16796e0b341bbcdf21d11cc586cdd1": "9000000000000000000000",
+ "0xea81ca8638540cd9d4d73d060f2cebf2241ffc3e": "1970000000000000000000",
+ "0x9944fee9d34a4a880023c78932c00b59d5c82a82": "750022000000000000000",
+ "0x12f460ae646cd2780fd35c50a6af4b9accfa85c6": "1000000000000000000000",
+ "0x4e232d53b3e6be8f895361d31c34d4762b12c82e": "1760000000000000000000",
+ "0x6bb2aca23fa1626d18efd6777fb97db02d8e0ae4": "40000000000000000000000",
+ "0xbc4e471560c99c8a2a4b1b1ad0c36aa6502b7c4b": "12000000000000000000000",
+ "0x2e2cbd7ad82547b4f5ff8b3ab56f942a6445a3b0": "200000000000000000000",
+ "0x21ecb2dfa65779c7592d041cd2105a81f4fd4e46": "1000000000000000000000",
+ "0x34318625818ec13f11835ae97353ce377d6f590a": "1520000000000000000000",
+ "0xa7ef35ce87eda6c28df248785815053ec97a5045": "4999998000000000000000",
+ "0x6a514e6242f6b68c137e97fea1e78eb555a7e5f7": "20000000000000000000",
+ "0x9340b5f678e45ee05eb708bb7abb6ec8f08f1b6b": "6000000000000000000000",
+ "0x43cc08d0732aa58adef7619bed46558ad7774173": "4443926000000000000000",
+ "0x12e9a4ad2ad57484dd700565bddb46423bd9bd31": "19999800000000000000000",
+ "0xebbeeb259184a6e01cccfc2207bbd883785ac90a": "619966000000000000000",
+ "0x704ab1150d5e10f5e3499508f0bf70650f028d4b": "4000000000000000000000",
+ "0xfc361105dd90f9ede566499d69e9130395f12ac8": "395000000000000000000000",
+ "0xc1b9a5704d351cfe983f79abeec3dbbbae3bb629": "20000000000000000000",
+ "0x66f50406eb1b11a946cab45927cca37470e5a208": "2000000000000000000000",
+ "0x53942e7949d6788bb780a7e8a0792781b1614b84": "15899600000000000000000",
+ "0x32ba9a7d0423e03a525fe2ebeb661d2085778bd8": "20000000000000000000000",
+ "0x11c0358aa6479de21866fe21071924b65e70f8b9": "36400000000000000000000",
+ "0x76cb9c8b69f4387675c48253e234cb7e0d74a426": "7396300000000000000000",
+ "0x9f5f44026b576a4adb41e95961561d41039ca391": "250000000000000000000",
+ "0x533a73a4a2228eee05c4ffd718bbf3f9c1b129a7": "6000000000000000000000",
+ "0xdcc52d8f8d9fc742a8b82767f0555387c563efff": "500000000000000000000",
+ "0xf456a75bb99655a7412ce97da081816dfdb2b1f2": "200000000000000000000",
+ "0xd0c101fd1f01c63f6b1d19bc920d9f932314b136": "20000000000000000000000",
+ "0xdabc225042a6592cfa13ebe54efa41040878a5a2": "259550000000000000000",
+ "0x38eec6e217f4d41aa920e424b9525197041cd4c6": "4428166000000000000000",
+ "0x8a247d186510809f71cffc4559471c3910858121": "1790000000000000000000",
+ "0x4f152b2fb8659d43776ebb1e81673aa84169be96": "2000000000000000000000",
+ "0xb4496ddb27799a222457d73979116728e8a1845b": "2610331000000000000000",
+ "0x4a4053b31d0ee5dbafb1d06bd7ac7ff3222c47d6": "1400000000000000000000",
+ "0x0f7bea4ef3f73ae0233df1e100718cbe29310bb0": "2000000000000000000000",
+ "0xc836e24a6fcf29943b3608e662290a215f6529ea": "292000000000000000000",
+ "0x1765361c2ec2f83616ce8363aae21025f2566f40": "5000000000000000000000",
+ "0xb6e6c3222b6b6f9be2875d2a89f127fb64100fe2": "8008000000000000000000",
+ "0x01bbc14f67af0639aab1441e6a08d4ce7162090f": "1309500000000000000000",
+ "0xaf2058c7282cf67c8c3cf930133c89617ce75d29": "6920000000000000000000",
+ "0x464d9c89cce484df000277198ed8075fa63572d1": "20000000000000000000",
+ "0x50cd97e9378b5cf18f173963236c9951ef7438a5": "1400000000000000000000",
+ "0xcb47bd30cfa8ec5468aaa6a94642ced9c819c8d4": "4000000000000000000000",
+ "0x6b10f8f8b3e3b60de90aa12d155f9ff5ffb22c50": "2000000000000000000000",
+ "0x09b7a988d13ff89186736f03fdf46175b53d16e0": "6000000000000000000000",
+ "0x5bfafe97b1dd1d712be86d41df79895345875a87": "500000000000000000000",
+ "0xa06cd1f396396c0a64464651d7c205efaf387ca3": "1999944000000000000000",
+ "0xfc0096b21e95acb8d619d176a4a1d8d529badbef": "384601000000000000000",
+ "0xa74444f90fbb54e56f3ac9b6cfccaa4819e4614a": "20000000000000000000",
+ "0x3c15b3511df6f0342e7348cc89af39a168b7730f": "1000000000000000000000",
+ "0x3d6ff82c9377059fb30d9215723f60c775c891fe": "250066000000000000000",
+ "0xa524a8cccc49518d170a328270a2f88133fbaf5d": "294500000000000000000",
+ "0x8a7a06be199a3a58019d846ac9cbd4d95dd757de": "3000200000000000000000",
+ "0xd744ac7e5310be696a63b003c40bd039370561c6": "1670000000000000000000",
+ "0xfe362688845fa244cc807e4b1130eb3741a8051e": "1000000000000000000000",
+ "0xb2d0360515f17daba90fcbac8205d569b915d6ac": "6000000000000000000000",
+ "0xc53594c7cfb2a08f284cc9d7a63bbdfc0b319732": "49200000000000000000000",
+ "0xb3c228731d186d2ded5b5fbe004c666c8e469b86": "29000000000000000000",
+ "0x63e414603e80d4e5a0f5c18774204642258208e4": "5000000000000000000000",
+ "0x826ce5790532e0548c6102a30d3eac836bd6388f": "18000000000000000000000",
+ "0xc5e812f76f15f2e1f2f9bc4823483c8804636f67": "73000000000000000000",
+ "0x116fef5e601642c918cb89160fc2293ba71da936": "802200000000000000000",
+ "0x08b84536b74c8c01543da88b84d78bb95747d822": "200000000000000000000",
+ "0x04a80afad53ef1f84165cfd852b0fdf1b1c24ba8": "58000000000000000000",
+ "0x2b0362633614bfcb583569438ecc4ea57b1d337e": "20000000000000000000000",
+ "0xe95179527deca5916ca9a38f215c1e9ce737b4c9": "10000000000000000000000",
+ "0x2c5df866666a194b26cebb407e4a1fd73e208d5e": "1000000000000000000000",
+ "0x529e824fa072582b4032683ac7eecc1c04b4cac1": "2000000000000000000000",
+ "0x78634371e17304cbf339b1452a4ce438dc764cce": "10000000000000000000000",
+ "0xe172dfc8f80cd1f8cd8539dc26082014f5a8e3e8": "3000000000000000000000",
+ "0xb07618328a901307a1b7a0d058fcd5786e9e72fe": "30239500000000000000000",
+ "0xb0571153db1c4ed7acaefe13ecdfdb72e7e4f06a": "80520000000000000000000",
+ "0xad910a23d6850613654af786337ad2a70868ac6d": "1999800000000000000000",
+ "0x4da5edc688b0cb62e1403d1700d9dcb99ffe3fd3": "2000000000000000000000",
+ "0xbe2471a67f6047918772d0e36839255ed9d691ae": "4000000000000000000000",
+ "0x28868324337e11ba106cb481da962f3a8453808d": "2000000000000000000000",
+ "0xd8f94579496725b5cb53d7985c989749aff849c0": "17000000000000000000000",
+ "0x4981c5ff66cc4e9680251fc4cd2ff907cb327865": "750000000000000000000",
+ "0xfd2872d19e57853cfa16effe93d0b1d47b4f93fb": "4000000000000000000000",
+ "0x63c8dfde0b8e01dadc2e748c824cc0369df090b3": "3880000000000000000000",
+ "0xc4dd048bfb840e2bc85cb53fcb75abc443c7e90f": "3716000000000000000000",
+ "0xf579714a45eb8f52c3d57bbdefd2c15b2e2f11df": "1560000000000000000000",
+ "0xcc7b0481cc32e6faef2386a07022bcb6d2c3b4fc": "3160000000000000000000",
+ "0xa0aa5f0201f04d3bbeb898132f7c11679466d901": "36600000000000000000",
+ "0xf3df63a97199933330383b3ed7570b96c4812334": "2000000000000000000000",
+ "0x42732d8ef49ffda04b19780fd3c18469fb374106": "425068000000000000000",
+ "0x6f92d6e4548c78996509ee684b2ee29ba3c532b4": "1000000000000000000000",
+ "0xfff4bad596633479a2a29f9a8b3f78eefd07e6ee": "100000000000000000000",
+ "0xac4460a76e6db2b9fcd152d9c7718d9ac6ed8c6f": "200000000000000000000",
+ "0x553b6b1c57050e88cf0c31067b8d4cd1ff80cb09": "400000000000000000000",
+ "0x84b6b6adbe2f5b3e2d682c66af1bc4905340c3ed": "619333000000000000000",
+ "0x9f4a7195ac7c151ca258cafda0cab083e049c602": "1537100000000000000000",
+ "0x2955c357fd8f75d5159a3dfa69c5b87a359dea8c": "2000000000000000000000",
+ "0x11d7844a471ef89a8d877555583ceebd1439ea26": "10098000000000000000000",
+ "0x34b454416e9fb4274e6addf853428a0198d62ee1": "407000000000000000000",
+ "0x308dd21cebe755126704b48c0f0dc234c60ba9b1": "200000000000000000000",
+ "0x381db4c8465df446a4ce15bf81d47e2f17c980bf": "32000000000000000000000",
+ "0x1abc4e253b080aeb437984ab05bca0979aa43e1c": "1000000000000000000000",
+ "0x53e35b12231f19c3fd774c88fec8cbeedf1408b2": "512000000000000000000",
+ "0x69e2e2e704307ccc5b5ca3f164fece2ea7b2e512": "7000000000000000000000",
+ "0x1914f1eb95d1277e93b6e61b668b7d77f13a11a1": "970000000000000000000",
+ "0x50e13023bd9ca96ad4c53fdfd410cb6b1f420bdf": "200000000000000000000",
+ "0x46224f32f4ece5c8867090d4409d55e50b18432d": "6000000000000000000000",
+ "0xff83855051ee8ffb70b4817dba3211ed2355869d": "400000000000000000000",
+ "0xfb39189af876e762c71d6c3e741893df226cedd6": "4000000000000000000000",
+ "0x9875623495a46cdbf259530ff838a1799ec38991": "2000000000000000000000",
+ "0xe1b39b88d9900dbc4a6cdc481e1060080a8aec3c": "2000000000000000000000",
+ "0x5baf6d749620803e8348af3710e5c4fbf20fc894": "5003680000000000000000",
+ "0x9c54e4ed479a856829c6bb42da9f0b692a75f728": "7520000000000000000000",
+ "0x486a6c8583a84484e3df43a123837f8c7e2317d0": "323378000000000000000",
+ "0xd235d15cb5eceebb61299e0e827fa82748911d89": "4000000000000000000000",
+ "0x47d792a756779aedf1343e8883a6619c6c281184": "2000000000000000000000",
+ "0x70c213488a020c3cfb39014ef5ba6404724bcaa3": "1940000000000000000000",
+ "0x133c490fa5bf7f372888e607d958fab7f955bae1": "1580000000000000000000",
+ "0xa9e194661aac704ee9dea043974e9692ded84a5d": "482400000000000000000",
+ "0xbc6b58364bf7f1951c309e0cba0595201cd73f9a": "1812400000000000000000",
+ "0x2309d34091445b3232590bd70f4f10025b2c9509": "10000000000000000000000",
+ "0xd89bc271b27ba3ab6962c94a559006ae38d5f56a": "2000000000000000000000",
+ "0xff0e2fec304207467e1e3307f64cbf30af8fd9cd": "2000000000000000000000",
+ "0xc0b0b7a8a6e1acdd05e47f94c09688aa16c7ad8d": "64234000000000000000",
+ "0xb66f92124b5e63035859e390628869dbdea9485e": "9850000000000000000000",
+ "0xa9e6e25e656b762558619f147a21985b8874edfe": "2000000000000000000000",
+ "0xa43e1947a9242b355561c30a829dfeeca2815af8": "3878255000000000000000",
+ "0x8b20ad3b94656dbdc0dd21a393d8a7d9e02138cb": "3000000000000000000000",
+ "0xaca2a838330b17302da731d30db48a04f0f207c1": "1337000000000000000000",
+ "0xfa60868aafd4ff4c5c57914b8ed58b425773dfa9": "8557400000000000000000",
+ "0x1848003c25bfd4aa90e7fcb5d7b16bcd0cffc0d8": "1000000000000000000000",
+ "0xb4b185d943ee2b58631e33dff5af6854c17993ac": "1000000000000000000000",
+ "0x7719888795ad745924c75760ddb1827dffd8cda8": "1999980000000000000000",
+ "0xccd521132d986cb96869842622a7dda26c3ed057": "2000000000000000000000",
+ "0x253e32b74ea4490ab92606fda0aa257bf23dcb8b": "10000000000000000000000",
+ "0x3712367e5e55a96d5a19168f6eb2bc7e9971f869": "1000000000000000000000",
+ "0x8f29a14a845ad458f2d108b568d813166bcdf477": "10000000000000000000000",
+ "0x51a8c2163602a32ee24cf4aa97fd9ea414516941": "62904000000000000000",
+ "0x61cea71fa464d62a07063f920b0cc917539733d8": "1670000000000000000000",
+ "0x6f81f3abb1f933b1df396b8e9cc723a89b7c9806": "280000000000000000000",
+ "0x61b1b8c012cd4c78f698e470f90256e6a30f48dd": "200000000000000000000",
+ "0x4f3f2c673069ac97c2023607152981f5cd6063a0": "600000000000000000000",
+ "0xe2efa5fca79538ce6068bf31d2c516d4d53c08e5": "131200000000000000000",
+ "0x2383c222e67e969190d3219ef14da37850e26c55": "2000000000000000000000",
+ "0xeac3af5784927fe9a598fc4eec38b8102f37bc58": "1000000000000000000000",
+ "0x4fe56ab3bae1b0a44433458333c4b05a248f8241": "2180000000000000000000",
+ "0xfe9cfc3bb293ddb285e625f3582f74a6b0a5a6cd": "1970000000000000000000",
+ "0xf48e1f13f6af4d84b371d7de4b273d03a263278e": "600000000000000000000",
+ "0x1ba9228d388727f389150ea03b73c82de8eb2e09": "7258000000000000000000",
+ "0x37a7a6ff4ea3d60ec307ca516a48d3053bb79cbb": "2000000000000000000000",
+ "0xe33840d8bca7da98a6f3d096d83de78b70b71ef8": "2000000000000000000000",
+ "0x8e7fd23848f4db07906a7d10c04b21803bb08227": "1000000000000000000000",
+ "0x07d4334ec385e8aa54eedaeadb30022f0cdfa4ab": "2629946000000000000000",
+ "0xd4b085fb086f3d0d68bf12926b1cc3142cae8770": "3700000000000000000000",
+ "0x5a87f034e6f68f4e74ffe60c64819436036cf7d7": "20000000000000000000",
+ "0xc00ab080b643e1c2bae363e0d195de2efffc1c44": "500000000000000000000",
+ "0x22f3c779dd79023ea92a78b65c1a1780f62d5c4a": "1970000000000000000000",
+ "0xc7d5c7054081e918ec687b5ab36e973d18132935": "182000000000000000000",
+ "0x9662ee021926682b31c5f200ce457abea76c6ce9": "670500000000000000000",
+ "0x116a09df66cb150e97578e297fb06e13040c893c": "2000000000000000000000",
+ "0xb7240af2af90b33c08ae9764103e35dce3638428": "8464547000000000000000",
+ "0xe8b28acda971725769db8f563d28666d41ddab6c": "10000000000000000000000",
+ "0x17d4918dfac15d77c47f9ed400a850190d64f151": "2000000000000000000000",
+ "0xc42250b0fe42e6b7dcd5c890a6f0c88f5f5fb574": "149800000000000000000",
+ "0x5da2a9a4c2c0a4a924cbe0a53ab9d0c627a1cfa0": "733202000000000000000",
+ "0x5869fb867d71f1387f863b698d09fdfb87c49b5c": "3666000000000000000000",
+ "0xd49a75bb933fca1fca9aa1303a64b6cb44ea30e1": "10000000000000000000000",
+ "0x76331e30796ce664b2700e0d4153700edc869777": "2000000000000000000000",
+ "0x8a5fb75793d043f1bcd43885e037bd30a528c927": "356500000000000000000",
+ "0xfc0ee6f7c2b3714ae9916c45566605b656f32441": "1760000000000000000000",
+ "0xbf50ce2e264b9fe2b06830617aedf502b2351b45": "1000000000000000000000",
+ "0x0f6000de1578619320aba5e392706b131fb1de6f": "499986000000000000000",
+ "0xc953f934c0eb2d0f144bdab00483fd8194865ce7": "2000000000000000000000",
+ "0x24fd9a6c874c2fab3ff36e9afbf8ce0d32c7de92": "1337000000000000000000",
+ "0xc6cd68ec35362c5ad84c82ad4edc232125912d99": "27750000000000000000000",
+ "0x2a67660a1368efcd626ef36b2b1b601980941c05": "133700000000000000000",
+ "0x9deb39027af877992b89f2ec4a1f822ecdf12693": "2000000000000000000000",
+ "0xc12f881fa112b8199ecbc73ec4185790e614a20f": "2000000000000000000000",
+ "0xd58a52e078a805596b0d56ea4ae1335af01c66eb": "267400000000000000000",
+ "0x4d7cfaa84cb33106800a8c802fb8aa463896c599": "1790000000000000000000",
+ "0x0ee391f03c765b11d69026fd1ab35395dc3802a0": "200000000000000000000",
+ "0xa192f06ab052d5fd7f94eea8318e827815fe677a": "131400000000000000000",
+ "0x8f0ab894bd3f4e697dbcfb859d497a9ba195994a": "39501652000000000000000",
+ "0x387eeafd6b4009deaf8bd5b85a72983a8dcc3487": "4000000000000000000000",
+ "0x03b0f17cd4469ddccfb7da697e82a91a5f9e7774": "20000000000000000000",
+ "0x11172b278ddd44eea2fdf4cb1d16962391c453d9": "935900000000000000000000",
+ "0x33d172ab075c51db1cd40a8ca8dbff0d93b843bb": "5727139000000000000000",
+ "0x909b5e763a39dcc795223d73a1dbb7d94ca75ac8": "2000000000000000000000",
+ "0x0ca12ab0b9666cf0cec6671a15292f2653476ab2": "210000600000000000000000",
+ "0x6b5ae7bf78ec75e90cb503c778ccd3b24b4f1aaf": "800000000000000000000",
+ "0xd9e3857efd1e202a441770a777a49dcc45e2e0d3": "223500000000000000000",
+ "0xd703c6a4f11d60194579d58c2766a7ef16c30a29": "2000000000000000000000",
+ "0x838bd565f99fde48053f7917fe333cf84ad548ab": "200000000000000000000",
+ "0x8168edce7f2961cf295b9fcd5a45c06cdeda6ef5": "200000000000000000000",
+ "0xde50868eb7e3c71937ec73fa89dd8b9ee10d45aa": "1000000000000000000000",
+ "0x087498c0464668f31150f4d3c4bcdda5221ba102": "20000000000000000000",
+ "0x613fab44b16bbe554d44afd178ab1d02f37aeaa5": "2000000000000000000000",
+ "0xe2ee691f237ee6529b6557f2fcdd3dcf0c59ec63": "5450048000000000000000",
+ "0xa9ed377b7d6ec25971c1a597a3b0f3bead57c98f": "400000000000000000000",
+ "0x175feeea2aa4e0efda12e1588d2f483290ede81a": "200000000000000000000",
+ "0xb51ddcb4dd4e8ae6be336dd9654971d9fec86b41": "421133000000000000000",
+ "0x92c0f573eccf62c54810ee6ba8d1f113542b301b": "3384000000000000000000",
+ "0xa109e18bb0a39c9ef82fa19597fc5ed8e9eb6d58": "1640000000000000000000",
+ "0xf74e6e145382b4db821fe0f2d98388f45609c69f": "100000000000000000000",
+ "0x378f37243f3ff0bef5e1dc85eb4308d9340c29f9": "2000200000000000000000",
+ "0x84e9949680bece6841b9a7e5250d08acd87d16cd": "200000000000000000000",
+ "0x882bd3a2e9d74110b24961c53777f22f1f46dc5d": "13370000000000000000000",
+ "0xacce01e0a70610dc70bb91e9926fa9957f372fba": "537000000000000000000",
+ "0xc5f687717246da8a200d20e5e9bcac60b67f3861": "28650000000000000000",
+ "0xe14617f6022501e97e7b3e2d8836aa61f0ff2dba": "200000000000000000000",
+ "0x076ee99d3548623a03b5f99859d2d785a1778d48": "200000000000000000000",
+ "0x2c424ee47f583cdce07ae318b6fad462381d4d2b": "4000000000000000000000",
+ "0xf98250730c4c61c57f129835f2680894794542f3": "4000000000000000000000",
+ "0xed1b24b6912d51b334ac0de6e771c7c0454695ea": "40000000000000000000",
+ "0xffd5170fd1a8118d558e7511e364b24906c4f6b3": "60085000000000000000",
+ "0xbf49c14898316567d8b709c2e50594b366c6d38c": "733202000000000000000",
+ "0x65ea26eabbe2f64ccccfe06829c25d4637520225": "700000000000000000000",
+ "0x5c5419565c3aad4e714e0739328e3521c98f05cc": "528000000000000000000",
+ "0xc53b50fd3b2b72bc6c430baf194a515585d3986d": "20000000000000000000",
+ "0x2b74c373d04bfb0fd60a18a01a88fbe84770e58c": "40000000000000000000",
+ "0xd97f4526dea9b163f8e8e33a6bcf92fb907de6ec": "284000000000000000000",
+ "0xa4a49f0bc8688cc9e6dc04e1e08d521026e65574": "200000000000000000000",
+ "0x575c00c2818210c28555a0ff29010289d3f82309": "10000000000000000000000",
+ "0x3f1233714f204de9de4ee96d073b368d8197989f": "38606000000000000000",
+ "0xf964d98d281730ba35b2e3a314796e7b42fedf67": "1543800000000000000000",
+ "0x1deec01abe5c0d952de9106c3dc30639d85005d6": "2000000000000000000000",
+ "0x12d60d65b7d9fc48840be5f891c745ce76ee501e": "21359400000000000000000",
+ "0x5c6136e218de0a61a137b2b3962d2a6112b809d7": "294273000000000000000",
+ "0xcd43258b7392a930839a51b2ef8ad23412f75a9f": "2000000000000000000000",
+ "0xdb3f258ab2a3c2cf339c4499f75a4bd1d3472e9e": "1500000000000000000000",
+ "0x0edd4b580ff10fe06c4a03116239ef96622bae35": "197000000000000000000",
+ "0x1d157c5876c5cad553c912caf6ce2d5277e05c73": "2000000000000000000000",
+ "0xcda1b886e3a795c9ba77914e0a2fe5676f0f5ccf": "106024000000000000000",
+ "0xf50cbafd397edd556c0678988cb2af5c2617e0a2": "716000000000000000000",
+ "0x327bb49e754f6fb4f733c6e06f3989b4f65d4bee": "20000000000000000000",
+ "0xc44bdec8c36c5c68baa2ddf1d431693229726c43": "100000000000000000000000",
+ "0x34e2849bea583ab0cc37975190f322b395055582": "7780340000000000000000",
+ "0x9221c9ce01232665741096ac07235903ad1fe2fc": "126489000000000000000",
+ "0xff3ded7a40d3aff0d7a8c45fa6136aa0433db457": "1999800000000000000000",
+ "0x10b5b34d1248fcf017f8c8ffc408ce899ceef92f": "267400000000000000000",
+ "0xf1a1f320407964fd3c8f2e2cc8a4580da94f01ea": "2000040000000000000000",
+ "0x6c800d4b49ba07250460f993b8cbe00b266a2553": "492500000000000000000",
+ "0xf827d56ed2d32720d4abf103d6d0ef4d3bcd559b": "26265000000000000000",
+ "0xffb9c7217e66743031eb377af65c77db7359dcda": "40000000000000000000",
+ "0x530319db0a8f93e5bb7d4dbf4816314fbed8361b": "2000000000000000000000",
+ "0x9c28a2c4086091cb5da226a657ce3248e8ea7b6f": "280000000000000000000",
+ "0xdb23a6fef1af7b581e772cf91882deb2516fc0a7": "200000000000000000000",
+ "0x6636d7ac637a48f61d38b14cfd4865d36d142805": "500000000000000000000",
+ "0xb3c260609b9df4095e6c5dff398eeb5e2df49985": "254030000000000000000",
+ "0x58e5c9e344c806650dacfc904d33edba5107b0de": "19100000000000000000",
+ "0x4f67396d2553f998785f704e07a639197dd1948d": "300080000000000000000",
+ "0x510d8159cc945768c7450790ba073ec0d9f89e30": "2560000000000000000000",
+ "0x593c48935beaff0fde19b04d309cd530a28e52ce": "4000000000000000000000",
+ "0xc27f4e08099d8cf39ee11601838ef9fc06d7fc41": "1790000000000000000000",
+ "0x07723e3c30e8b731ee456a291ee0e798b0204a77": "2000000000000000000000",
+ "0x0a652e2a8b77bd97a790d0e91361c98890dbb04e": "1000000000000000000000",
+ "0x671015b97670b10d5e583f3d62a61c1c79c5143f": "400000000000000000000",
+ "0x7cc24a6a958c20c7d1249660f7586226950b0d9a": "1970000000000000000000",
+ "0x6ef9e8c9b6217d56769af97dbb1c8e1b8be799d2": "182000000000000000000",
+ "0x5c4368918ace6409c79eca80cdaae4391d2b624e": "4000000000000000000000",
+ "0x043707071e2ae21eed977891dc79cd5d8ee1c2da": "2000000000000000000000",
+ "0x39bfd978689bec048fc776aa15247f5e1d7c39a2": "20000000000000000000000",
+ "0x05915d4e225a668162aee7d6c25fcfc6ed18db03": "66348000000000000000",
+ "0x3f551ba93cd54693c183fb9ad60d65e1609673c9": "2000000000000000000000",
+ "0xa8c0b02faf02cb5519dda884de7bbc8c88a2da81": "16700000000000000000",
+ "0xbd0c5cd799ebc48642ef97d74e8e429064fee492": "326000000000000000000",
+ "0x0a931b449ea8f12cdbd5e2c8cc76bad2c27c0639": "23031000000000000000",
+ "0x2ea5fee63f337a376e4b918ea82148f94d48a626": "1864242000000000000000",
+ "0xcc6c2df00e86eca40f21ffda1a67a1690f477c65": "3160000000000000000000",
+ "0xe5e37e19408f2cfbec83349dd48153a4a795a08f": "4200000000000000000000",
+ "0xf555a27bb1e2fd4e2cc784caee92939fc06e2fc9": "2000000000000000000000",
+ "0xdcf9719be87c6f46756db4891db9b611d2469c50": "1000000000000000000000",
+ "0x8e2f9034c9254719c38e50c9aa64305ed696df1e": "4728000000000000000000",
+ "0xa01f12d70f44aa7b113b285c22dcdb45873454a7": "18200000000000000000",
+ "0xbce40475d345b0712dee703d87cd7657fc7f3b62": "7750000000000000000000",
+ "0xbb19bf91cbad74cceb5f811db27e411bc2ea0656": "17600000000000000000",
+ "0xacc062702c59615d3444ef6214b8862b009a02ed": "1499936000000000000000",
+ "0x449ac4fbe383e36738855e364a57f471b2bfa131": "197000000000000000000000",
+ "0xad59a78eb9a74a7fbdaefafa82eada8475f07f95": "500000000000000000000",
+ "0x6b6577f3909a4d6de0f411522d4570386400345c": "1880000000000000000000",
+ "0x79bf2f7b6e328aaf26e0bb093fa22da29ef2f471": "1790000000000000000000",
+ "0x940f715140509ffabf974546fab39022a41952d2": "1400000000000000000000",
+ "0x1d572edd2d87ca271a6714c15a3b37761dcca005": "127674000000000000000",
+ "0xd78ecd25adc86bc2051d96f65364866b42a426b7": "3877300000000000000000",
+ "0xf9729d48282c9e87166d5eef2d01eda9dbf78821": "99981000000000000000",
+ "0x17762560e82a93b3f522e0e524adb8612c3a7470": "1000000000000000000000",
+ "0xd500e4d1c9824ba9f5b635cfa3a8c2c38bbd4ced": "400000000000000000000",
+ "0xa11effab6cf0f5972cffe4d56596e98968144a8f": "1670000000000000000000",
+ "0xf64ecf2117931c6d535a311e4ffeaef9d49405b8": "2674000000000000000000",
+ "0x229cc4711b62755ea296445ac3b77fc633821cf2": "39481000000000000000",
+ "0xfc989cb487bf1a7d17e4c1b7c4b7aafdda6b0a8d": "20000000000000000000",
+ "0xea8527febfa1ade29e26419329d393b940bbb7dc": "1999944000000000000000",
+ "0xbce13e22322acfb355cd21fd0df60cf93add26c6": "200000000000000000000",
+ "0x19ff244fcfe3d4fa2f4fd99f87e55bb315b81eb6": "200000000000000000000",
+ "0xd2581a55ce23ab10d8ad8c44378f59079bd6f658": "8800000000000000000000",
+ "0x4073fa49b87117cb908cf1ab512da754a932d477": "1970000000000000000000",
+ "0xb6a82933c9eadabd981e5d6d60a6818ff806e36b": "400000000000000000000",
+ "0xc79806032bc7d828f19ac6a640c68e3d820fa442": "20000000000000000000",
+ "0x577b2d073c590c50306f5b1195a4b2ba9ecda625": "373600000000000000000",
+ "0x7f13d760498d7193ca6859bc95c901386423d76c": "5000000000000000000000",
+ "0x416784af609630b070d49a8bcd12235c6428a408": "20000000000000000000000",
+ "0xfbe71622bcbd31c1a36976e7e5f670c07ffe16de": "400000000000000000000",
+ "0xa5698035391e67a49013c0002079593114feb353": "240000000000000000000",
+ "0xab2871e507c7be3965498e8fb462025a1a1c4264": "775000000000000000000",
+ "0x9c78fbb4df769ce2c156920cfedfda033a0e254a": "1970000000000000000000",
+ "0x95e6f93dac228bc7585a25735ac2d076cc3a4017": "6000000000000000000000",
+ "0x3c1f91f301f4b565bca24751aa1f761322709ddd": "1790000000000000000000",
+ "0xf77f9587ff7a2d7295f1f571c886bd33926a527c": "1999800000000000000000",
+ "0x755f587e5efff773a220726a13d0f2130d9f896b": "1000000000000000000000",
+ "0x8c6aa882ee322ca848578c06cb0fa911d3608305": "600000000000000000000",
+ "0x492cb5f861b187f9df21cd4485bed90b50ffe22d": "499928000000000000000",
+ "0x95a577dc2eb3ae6cb9dfc77af697d7efdfe89a01": "136000000000000000000",
+ "0x4173419d5c9f6329551dc4d3d0ceac1b701b869e": "88000000000000000000",
+ "0x456ae0aca48ebcfae166060250525f63965e760f": "300000000000000000000",
+ "0x81f8de2c283d5fd4afbda85dedf9760eabbbb572": "3000000000000000000000",
+ "0xcd0af3474e22f069ec3407870dd770443d5b12b0": "2626262000000000000000",
+ "0x283c2314283c92d4b064f0aef9bb5246a7007f39": "200000000000000000000",
+ "0x29b3f561ee7a6e25941e98a5325b78adc79785f3": "100000000000000000000",
+ "0xcd4306d7f6947ac1744d4e13b8ef32cb657e1c00": "499986000000000000000",
+ "0xd9ec2efe99ff5cf00d03a8317b92a24aef441f7e": "2000000000000000000000",
+ "0x83dbf8a12853b40ac61996f8bf1dc8fdbaddd329": "970000000000000000000",
+ "0x9d93fab6e22845f8f45a07496f11de71530debc7": "1998000000000000000000",
+ "0xfd204f4f4aba2525ba728afdf78792cbdeb735ae": "2000000000000000000000",
+ "0x99fad50038d0d9d4c3fbb4bce05606ecadcd5121": "2000000000000000000000",
+ "0xd206aaddb336d45e7972e93cb075471d15897b5d": "600000000000000000000",
+ "0x428a1ee0ed331d7952ccbe1c7974b2852bd1938a": "2208370000000000000000",
+ "0x690228e4bb12a8d4b5e0a797b0c5cf2a7509131e": "1880000000000000000000",
+ "0xfa3a1aa4488b351aa7560cf5ee630a2fd45c3222": "878850000000000000000",
+ "0x0372e852582e0934344a0fed2178304df25d4628": "20000000000000000000000",
+ "0x35ea2163a38cdf9a123f82a5ec00258dae0bc767": "4000000000000000000000",
+ "0xd1fed0aee6f5dfd7e25769254c3cfad15adeccaa": "730000000000000000000",
+ "0xc05b740620f173f16e52471dc38b9c514a0b1526": "140000000000000000000",
+ "0x87e3062b2321e9dfb0875ce3849c9b2e3522d50a": "10000000000000000000000",
+ "0x303fbaebbe46b35b6e5b74946a5f99bc1585cae7": "878148000000000000000",
+ "0xe7a8e471eafb798f4554cc6e526730fd56e62c7d": "1000000000000000000000",
+ "0xad7dd053859edff1cb6f9d2acbed6dd5e332426f": "1970000000000000000000",
+ "0xdc4345d6812e870ae90c568c67d2c567cfb4f03c": "6700000000000000000000",
+ "0xa6a08252c8595177cc2e60fc27593e2379c81fb1": "20055000000000000000",
+ "0xa9af21acbe482f8131896a228036ba51b19453c3": "49999000000000000000",
+ "0x86e3fe86e93da486b14266eadf056cbfa4d91443": "2000000000000000000000",
+ "0x744b03bba8582ae5498e2dc22d19949467ab53fc": "500000000000000000000",
+ "0xd3118ea3c83505a9d893bb67e2de142d537a3ee7": "20000000000000000000",
+ "0xb32f1c2689a5ce79f1bc970b31584f1bcf2283e7": "20000000000000000000",
+ "0x4828e4cbe34e1510afb72c2beeac8a4513eaebd9": "3940000000000000000000",
+ "0xb07bcc085ab3f729f24400416837b69936ba8873": "2000140000000000000000",
+ "0xbdc74873af922b9df474853b0fa7ff0bf8c82695": "3999000000000000000000",
+ "0x15ebd1c7cad2aff19275c657c4d808d010efa0f5": "200550000000000000000",
+ "0xcbc04b4d8b82caf670996f160c362940d66fcf1a": "6000000000000000000000",
+ "0x8197948121732e63d9c148194ecad46e30b749c8": "4000000000000000000000",
+ "0x69797bfb12c9bed682b91fbc593591d5e4023728": "10000000000000000000000",
+ "0xbe9b8c34b78ee947ff81472eda7af9d204bc8466": "150000000000000000000",
+ "0xdf3f57b8ee6434d047223def74b20f63f9e4f955": "250500000000000000000",
+ "0xa3ae1879007d801cb5f352716a4dd8ba2721de3d": "200000000000000000000000",
+ "0xcb4bb1c623ba28dc42bdaaa6e74e1d2aa1256c2a": "1999944000000000000000",
+ "0xe03c00d00388ecbf4f263d0ac778bb41a57a40d9": "1000072000000000000000",
+ "0xfc2c1f88961d019c3e9ea33009152e0693fbf88a": "8000000000000000000000",
+ "0x8599cbd5a6a9dcd4b966be387d69775da5e33c6f": "58180000000000000000000",
+ "0xb7a31a7c38f3db09322eae11d2272141ea229902": "2000000000000000000000",
+ "0x231a15acc199c89fa9cb22441cc70330bdcce617": "500000000000000000000",
+ "0x3fbed6e7e0ca9c84fbe9ebcf9d4ef9bb49428165": "2000000000000000000000",
+ "0x92cfd60188efdfb2f8c2e7b1698abb9526c1511f": "2000000000000000000000",
+ "0x5c936f3b9d22c403db5e730ff177d74eef42dbbf": "75000000000000000000",
+ "0x931fe712f64207a2fd5022728843548bfb8cbb05": "2000000000000000000000",
+ "0x08d54e83ad486a934cfaeae283a33efd227c0e99": "1039000000000000000000",
+ "0xa339a3d8ca280e27d2415b26d1fc793228b66043": "1013600000000000000000",
+ "0x581f34b523e5b41c09c87c298e299cbc0e29d066": "1131607000000000000000",
+ "0xcaaa68ee6cdf0d34454a769b0da148a1faaa1865": "7216000000000000000000",
+ "0x0838a7768d9c2aca8ba279adfee4b1f491e326f1": "200000000000000000000",
+ "0xdde77a4740ba08e7f73fbe3a1674912931742eeb": "19867021000000000000000",
+ "0xcbe810fe0fecc964474a1db97728bc87e973fcbd": "10000000000000000000000",
+ "0x86c28b5678af37d727ec05e4447790f15f71f2ea": "200000000000000000000",
+ "0xdd6c062193eac23d2fdbf997d5063a346bb3b470": "20000000000000000000",
+ "0x5975b9528f23af1f0e2ec08ac8ebaa786a2cb8e0": "345827000000000000000",
+ "0xe29d8ae452dcf3b6ac645e630409385551faae0a": "80276000000000000000",
+ "0x2fbc85798a583598b522166d6e9dda121d627dbc": "200000000000000000000",
+ "0x7a36aba5c31ea0ca7e277baa32ec46ce93cf7506": "20000000000000000000000",
+ "0xdbcbcd7a57ea9db2349b878af34b1ad642a7f1d1": "200000000000000000000",
+ "0x92aae59768eddff83cfe60bb512e730a05a161d7": "1708015000000000000000",
+ "0xa5e93b49ea7c509de7c44d6cfeddef5910deaaf2": "2000000000000000000000",
+ "0xe33d980220fab259af6a1f4b38cf0ef3c6e2ea1a": "2000000000000000000000",
+ "0x8ed0af11ff2870da0681004afe18b013f7bd3882": "4000000000000000000000",
+ "0xf23e5c633221a8f7363e65870c9f287424d2a960": "1380000000000000000000",
+ "0x96334bfe04fffa590213eab36514f338b864b736": "400000000000000000000",
+ "0xfa1f1971a775c3504fef5079f640c2c4bce7ac05": "2000000000000000000000",
+ "0xdf44c47fc303ac76e74f97194cca67b5bb3c023f": "591000000000000000000",
+ "0x4b74f5e58e2edf76daf70151964a0b8f1de0663c": "324020000000000000000",
+ "0xe38b91b35190b6d9deed021c30af094b953fdcaa": "33340000000000000000",
+ "0x6b38de841fad7f53fe02da115bd86aaf662466bd": "1730000000000000000000",
+ "0x11675a25554607a3b6c92a9ee8f36f75edd3e336": "159800000000000000000",
+ "0x0ba8705bf55cf219c0956b5e3fc01c4474a6cdc1": "94963000000000000000",
+ "0x0f05f120c89e9fbc93d4ab0c5e2b4a0df092b424": "30000000000000000000000",
+ "0xfdd1195f797d4f35717d15e6f9810a9a3ff55460": "18200000000000000000",
+ "0x63a61dc30a8e3b30a763c4213c801cbf98738178": "1000000000000000000000",
+ "0xe5bdf34f4ccc483e4ca530cc7cf2bb18febe92b3": "126260000000000000000",
+ "0xd6e09e98fe1300332104c1ca34fbfac554364ed9": "2000000000000000000000",
+ "0x5bd6862d517d4de4559d4eec0a06cad05e2f946e": "200000000000000000000",
+ "0x7294ec9da310bc6b4bbdf543b0ef45abfc3e1b4d": "22000000000000000000000",
+ "0xae34861d342253194ffc6652dfde51ab44cad3fe": "466215000000000000000",
+ "0xf50ae7fab4cfb5a646ee04ceadf9bf9dd5a8e540": "3999952000000000000000",
+ "0xdd2bdfa917c1f310e6fa35aa8af16939c233cd7d": "400000000000000000000",
+ "0xe0060462c47ff9679baef07159cae08c29f274a9": "2000000000000000000000",
+ "0xb7d12e84a2e4c4a6345af1dd1da9f2504a2a996e": "200000000000000000000",
+ "0xf5500178cb998f126417831a08c2d7abfff6ab5f": "1308923000000000000000",
+ "0xfd377a385272900cb436a3bb7962cdffe93f5dad": "2000000000000000000000",
+ "0xa4a83a0738799b971bf2de708c2ebf911ca79eb2": "600000000000000000000",
+ "0x52a5e4de4393eeccf0581ac11b52c683c76ea15d": "19999800000000000000000",
+ "0xb07fdeaff91d4460fe6cd0e8a1b0bd8d22a62e87": "5260000000000000000000",
+ "0x35f5860149e4bbc04b8ac5b272be55ad1aca58e0": "200000000000000000000",
+ "0xfb135eb15a8bac72b69915342a60bbc06b7e077c": "20000000000000000000000",
+ "0x02d4a30968a39e2b3498c3a6a4ed45c1c6646822": "2000000000000000000000",
+ "0xe44b7264dd836bee8e87970340ed2b9aed8ed0a5": "5772100000000000000000",
+ "0xe90a354cec04d69e5d96ddc0c5138d3d33150aa0": "499971000000000000000",
+ "0x693d83be09459ef8390b2e30d7f7c28de4b4284e": "2000000000000000000000",
+ "0x87bf7cd5d8a929e1c785f9e5449106ac232463c9": "77800000000000000000",
+ "0xe5f8ef6d970636b0dcaa4f200ffdc9e75af1741c": "2000000000000000000000",
+ "0xfef09d70243f39ed8cd800bf9651479e8f4aca3c": "200000000000000000000",
+ "0xe98c91cadd924c92579e11b41217b282956cdaa1": "135800000000000000000",
+ "0xc2836188d9a29253e0cbda6571b058c289a0bb32": "2000000000000000000000",
+ "0xafa6946effd5ff53154f82010253df47ae280ccc": "1970000000000000000000",
+ "0x43c7ebc5b3e7af16f47dc5617ab10e0f39b4afbb": "1910000000000000000000",
+ "0x097ecda22567c2d91cb03f8c5215c22e9dcda949": "20055000000000000000",
+ "0x3e66b84769566ab67945d5fa81373556bcc3a1fa": "152000000000000000000",
+ "0x56373daab46316fd7e1576c61e6affcb6559ddd7": "215340000000000000000",
+ "0xfaaeba8fc0bbda553ca72e30ef3d732e26e82041": "1338337000000000000000",
+ "0xf54c19d9ef3873bfd1f7a622d02d86249a328f06": "44284729000000000000000",
+ "0x825309a7d45d1812f51e6e8df5a7b96f6c908887": "2365000000000000000000",
+ "0x89009e3c6488bd5e570d1da34eabe28ed024de1b": "20000000000000000000000",
+ "0x63977cad7d0dcdc52b9ac9f2ffa136e8642882b8": "75000000000000000000",
+ "0xc239abdfae3e9af5457f52ed2b91fd0ab4d9c700": "2000000000000000000000",
+ "0x1a4ec6a0ae7f5a9427d23db9724c0d0cffb2ab2f": "179000000000000000000",
+ "0xa12a6c2d985daf0e4f5f207ae851aaf729b332cd": "100000000000000000000000",
+ "0xcbe52fc533d7dd608c92a260b37c3f45deb4eb33": "1000000000000000000000",
+ "0xabb2e6a72a40ba6ed908cdbcec3c5612583132fe": "1460000000000000000000",
+ "0x6503860b191008c15583bfc88158099301762828": "1000000000000000000000",
+ "0xa0228240f99e1de9cb32d82c0f2fa9a3d44b0bf3": "1600000000000000000000",
+ "0xe154daeadb545838cbc6aa0c55751902f528682a": "4925000000000000000000",
+ "0x8e92aba38e72a098170b92959246537a2e5556c0": "267400000000000000000",
+ "0xd23d7affacdc3e9f3dae7afcb4006f58f8a44600": "3600000000000000000000",
+ "0x00d78d89b35f472716eceafebf600527d3a1f969": "27750000000000000000000",
+ "0x120f9de6e0af7ec02a07c609ca8447f157e6344c": "267400000000000000000",
+ "0xe0352fdf819ba265f14c06a6315c4ac1fe131b2e": "1000000000000000000000",
+ "0x8f47328ee03201c9d35ed2b5412b25decc859362": "2000000000000000000000",
+ "0x453e359a3397944c5a275ab1a2f70a5e5a3f6989": "240000000000000000000",
+ "0x9bf58efbea0784eb068adecfa0bb215084c73a35": "5800000000000000000000",
+ "0x21bfe1b45cacde6274fd8608d9a178bf3eeb6edc": "2009400000000000000000",
+ "0xd1d5b17ffe2d7bbb79cc7d7930bcb2e518fb1bbf": "3000000000000000000000",
+ "0x20a29c5079e26b3f18318bb2e50e8e8b346e5be8": "499986000000000000000",
+ "0x7d392852f3abd92ff4bb5bb26cb60874f2be6795": "1000070000000000000000",
+ "0x55852943492970f8d629a15366cdda06a94f4513": "2000000000000000000000",
+ "0xab5dfc1ea21adc42cf8c3f6e361e243fd0da61e5": "300000000000000000000",
+ "0x9d2bfc36106f038250c01801685785b16c86c60d": "380000000000000000000000",
+ "0x6e60aee1a78f8eda8b424c73e353354ae67c3042": "3490300000000000000000",
+ "0x7e29290038493559194e946d4e460b96fc38a156": "309072000000000000000",
+ "0x6006e36d929bf45d8f16231b126a011ae283d925": "176000000000000000000",
+ "0xd6d03572a45245dbd4368c4f82c95714bd2167e2": "1162200000000000000000",
+ "0xd1432538e35b7664956ae495a32abdf041a7a21c": "19700000000000000000000",
+ "0x2276264bec8526c0c0f270677abaf4f0e441e167": "1000000000000000000000",
+ "0xc8814e34523e38e1f927a7dce8466a447a093603": "10000000000000000000000",
+ "0x688a569e965524eb1d0ac3d3733eab909fb3d61e": "1320000000000000000000",
+ "0x90dc09f717fc2a5b69fd60ba08ebf40bf4e8246c": "4000086000000000000000",
+ "0x239a733e6b855ac592d663156186a8a174d2449e": "1637020000000000000000",
+ "0xbcdfacb9d9023c3417182e9100e8ea1d373393a3": "59100000000000000000",
+ "0xba6440aeb3737b8ef0f1af9b0c15f4c214ffc7cf": "1000000000000000000000",
+ "0x322e5c43b0f524389655a9b3ff24f2d4db3da10f": "4650000000000000000000",
+ "0xbe5a60689998639ad75bc105a371743eef0f7940": "501700000000000000000",
+ "0xb727a9fc82e1cffc5c175fa1485a9befa2cdbdd1": "999000000000000000000",
+ "0xa3883a24f7f166205f1a6a9949076c26a76e7178": "1820000000000000000000",
+ "0x5e95fe5ffcf998f9f9ac0e9a81dab83ead77003d": "539766000000000000000",
+ "0xe60955dc0bc156f6c41849f6bd776ba44b0ef0a1": "299982000000000000000",
+ "0xaf203e229d7e6d419df4378ea98715515f631485": "1970000000000000000000",
+ "0x86499a1228ff2d7ee307759364506f8e8c8307a5": "1970000000000000000000",
+ "0x1a04cec420ad432215246d77fe178d339ed0b595": "316000000000000000000",
+ "0xcc2b5f448f3528d3fe41cc7d1fa9c0dc76f1b776": "60000000000000000000",
+ "0xcb50587412822304ebcba07dab3a0f09fffee486": "1370000000000000000000",
+ "0x4ae2a04d3909ef454e544ccfd614bfefa71089ae": "442800000000000000000",
+ "0xc8a2c4e59e1c7fc54805580438aed3e44afdf00e": "44000000000000000000",
+ "0x5792814f59a33a1843faa01baa089eb02ffb5cf1": "499986000000000000000",
+ "0xa1f2854050f872658ed82e52b0ad7bbc1cb921f6": "2010918000000000000000",
+ "0x92dca5e102b3b81b60f1a504634947c374a88ccb": "2000000000000000000000",
+ "0x732fead60f7bfdd6a9dec48125e3735db1b6654f": "20000000000000000000",
+ "0x6bf7b3c065f2c1e7c6eb092ba0d15066f393d1b8": "400000000000000000000",
+ "0xcde36d81d128c59da145652193eec2bfd96586ef": "4000000000000000000000",
+ "0x40eddb448d690ed72e05c225d34fc8350fa1e4c5": "7000000000000000000000",
+ "0x454b61b344c0ef965179238155f277c3829d0b38": "2000000000000000000000",
+ "0xac3da526cfce88297302f34c49ca520dc271f9b2": "800000000000000000000",
+ "0xc989eec307e8839b9d7237cfda08822962abe487": "400000000000000000000",
+ "0xe99de258a4173ce9ac38ede26c0b3bea3c0973d5": "1656800000000000000000",
+ "0xff0cb06c42e3d88948e45bd7b0d4e291aefeea51": "1910000000000000000000",
+ "0x0990e81cd785599ea236bd1966cf526302c35b9c": "1000000000000000000000",
+ "0x6da0ed8f1d69339f059f2a0e02471cb44fb8c3bb": "935900000000000000000",
+ "0x5d958a9bd189c2985f86c58a8c69a7a78806e8da": "10200000000000000000000",
+ "0x98be696d51e390ff1c501b8a0f6331b628ddc5ad": "2000000000000000000000",
+ "0x09d0b8cd077c69d9f32d9cca43b3c208a21ed48b": "150011000000000000000",
+ "0x96e7c0c9d5bf10821bf140c558a145b7cac21397": "1056000000000000000000",
+ "0x5b736eb18353629bde9676dadd165034ce5ecc68": "1970000000000000000000",
+ "0xe5a365343cc4eb1e770368e1f1144a77b832d7e0": "20000000000000000000",
+ "0x4cf5537b85842f89cfee359eae500fc449d2118f": "1000000000000000000000",
+ "0xc71f1d75873f33dcb2dd4b3987a12d0791a5ce27": "1015200000000000000000",
+ "0x9bf703b41c3624e15f4054962390bcba3052f0fd": "6055000000000000000000",
+ "0x145e1de0147911ccd880875fbbea61f6a142d11d": "4000000000000000000000",
+ "0x68419c6dd2d3ce6fcbb3c73e2fa079f06051bde6": "1970000000000000000000",
+ "0xd8eb78503ec31a54a90136781ae109004c743257": "1000000000000000000000",
+ "0xf25e4c70bc465632c89e5625a832a7722f6bffab": "4488000000000000000000",
+ "0x7b4d2a38269069c18557770d591d24c5121f5e83": "700000000000000000000",
+ "0x27d158ac3d3e1109ab6e570e90e85d3892cd7680": "100000000000000000000",
+ "0xd3679a47df2d99a49b01c98d1c3e0c987ce1e158": "280000000000000000000",
+ "0x095b949de3333a377d5019d893754a5e4656ff97": "340000000000000000000",
+ "0x6b17598a8ef54f797ae515ccb6517d1859bf8011": "100000000000000000000",
+ "0x3eaf0879b5b6db159b589f84578b6a74f6c10357": "7253657000000000000000",
+ "0x40d45d9d7625d15156c932b771ca7b0527130958": "100000000000000000000000",
+ "0x0392549a727f81655429cb928b529f25df4d1385": "26248000000000000000",
+ "0xc5b009baeaf788a276bd35813ad65b400b849f3b": "1000000000000000000000",
+ "0x6ed884459f809dfa1016e770edaf3e9fef46fa30": "3400170000000000000000",
+ "0x439d2f2f5110a4d58b1757935015408740fec7f8": "3830421000000000000000",
+ "0xdc46c13325cd8edf0230d068896486f007bf4ef1": "1337000000000000000000",
+ "0x8c54c7f8b9896e75d7d5f5c760258699957142ad": "40000000000000000000",
+ "0x61c8f1fa43bf846999ecf47b2b324dfb6b63fe3a": "800000000000000000000",
+ "0x935069444a6a984de2084e46692ab99f671fc727": "9000000000000000000000",
+ "0xfc49c1439a41d6b3cf26bb67e0365224e5e38f5f": "1000076000000000000000",
+ "0xe1dfb5cc890ee8b2877e885d267c256187d019e6": "100000000000000000000",
+ "0xee7c3ded7c28f459c92fe13b4d95bafbab02367d": "700000000000000000000",
+ "0xa5874d754635a762b381a5c4c792483af8f23d1d": "50000000000000000000",
+ "0xcfbb32b7d024350e3321fa20c9a914035372ffc6": "401100000000000000000",
+ "0x2bc429d618a66a4cf82dbb2d824e9356effa126a": "1999944000000000000000",
+ "0xdb244f97d9c44b158a40ed9606d9f7bd38913331": "102000000000000000000",
+ "0x55e220876262c218af4f56784798c7e55da09e91": "133566000000000000000",
+ "0xca41ccac30172052d522cd2f2f957d248153409f": "1970000000000000000000",
+ "0xb11fa7fb270abcdf5a2eab95aa30c4b53636efbf": "800000000000000000000",
+ "0x0ffea06d7113fb6aec2869f4a9dfb09007facef4": "225416000000000000000",
+ "0x646628a53c2c4193da88359ce718dadd92b7a48d": "200032000000000000000",
+ "0xca8409083e01b397cf12928a05b68455ce6201df": "1600000000000000000000",
+ "0xdbbcbb79bf479a42ad71dbcab77b5adfaa872c58": "1730000000000000000000",
+ "0xdb7d4037081f6c65f9476b0687d97f1e044d0a1d": "660000000000000000000",
+ "0x4be90d412129d5a4d0424361d6649d4e47a62316": "1015200000000000000000",
+ "0xe3ab3ca9b870e3f548517306bba4de2591afafc2": "1200062000000000000000",
+ "0x5c61ab79b408dd3229f662593705d72f1e147bb8": "22729000000000000000000",
+ "0x4f177f9d56953ded71a5611f393322c30279895c": "246000000000000000000",
+ "0xe6cb260b716d4c0ab726eeeb07c8707204e276ae": "1000000000000000000000",
+ "0x44355253b27748e3f34fe9cae1fb718c8f249529": "200000000000000000000",
+ "0xa309df54cabce70c95ec3033149cd6678a6fd4cf": "223600000000000000000",
+ "0xec4867d2175ab5b9469361595546554684cda460": "3000000000000000000000",
+ "0x8d06e464245cad614939e0af0845e6d730e20374": "200359000000000000000",
+ "0x9810e34a94db6ed156d0389a0e2b80f4fd6b0a8a": "2000000000000000000000",
+ "0xdcfff3e8d23c2a34b56bd1b3bd45c79374432239": "5000000000000000000000",
+ "0x7d7dd5ee614dbb6fbfbcd26305247a058c41faa1": "2000000000000000000000",
+ "0x8a9eca9c5aba8e139f8003edf1163afb70aa3aa9": "660000000000000000000",
+ "0xd942de4784f7a48716c0fd4b9d54a6e54c5f2f3e": "20000000000000000000000",
+ "0x07dae622630d1136381933d2ad6b22b839d82102": "200000000000000000000",
+ "0xabf12fa19e82f76c718f01bdca0003674523ef30": "2000000000000000000000",
+ "0x411c831cc6f44f1965ec5757ab4e5b3ca4cffd1f": "425000000000000000000",
+ "0x99129d5b3c0cde47ea0def4dfc070d1f4a599527": "2000000000000000000000",
+ "0xc5cdcee0e85d117dabbf536a3f4069bf443f54e7": "1969606000000000000000",
+ "0xf218bd848ee7f9d38bfdd1c4eb2ed2496ae4305f": "500000000000000000000",
+ "0xfe549bbfe64740189892932538daaf46d2b61d4f": "40000000000000000000",
+ "0xdc3f0e7672f71fe7525ba30b9755183a20b9166a": "9603617000000000000000",
+ "0x0e83b850481ab44d49e0a229a2e464902c69539b": "100000000000000000000",
+ "0x07ddd0422c86ef65bf0c7fc3452862b1228b08b8": "2065302000000000000000",
+ "0xa68c313445c22d919ee46cc2d0cdff043a755825": "75189000000000000000",
+ "0xa9e9dbce7a2cb03694799897bed7c54d155fdaa8": "197559000000000000000",
+ "0x18fccf62d2c3395453b7587b9e26f5cff9eb7482": "1000000000000000000000",
+ "0xff41d9e1b4effe18d8b0d1f63fc4255fb4e06c3d": "1337000000000000000000",
+ "0x8f69eafd0233cadb4059ab779c46edf2a0506e48": "1788210000000000000000",
+ "0x9aa48c66e4fb4ad099934e32022e827427f277ba": "10000000000000000000000",
+ "0xf46980e3a4a9d29a6a6e90604537a3114bcb2897": "500000000000000000000",
+ "0x801732a481c380e57ed62d6c29de998af3fa3b13": "100000000000000000000",
+ "0x0cd6a141918d126b106d9f2ebf69e102de4d3277": "20000000000000000000",
+ "0x17589a6c006a54cad70103123aae0a82135fdeb4": "4000000000000000000000",
+ "0x8725e8c753b3acbfdca55f3c62dfe1a59454968a": "1000090000000000000000",
+ "0xd20dcb0b78682b94bc3000281448d557a20bfc83": "895000000000000000000",
+ "0xe84f8076a0f2969ecd333eef8de41042986291f2": "432000000000000000000",
+ "0xb3145b74506d1a8d047cdcdc55392a7b5350799a": "129314663000000000000000",
+ "0x0d9a825ff2bcd397cbad5b711d9dcc95f1cc112d": "12800000000000000000000",
+ "0x0ca670eb2c8b96cba379217f5929c2b892f39ef6": "2000000000000000000000",
+ "0x25cfc4e25c35c13b69f7e77dbfb08baf58756b8d": "40000000000000000000000",
+ "0x182db85293f606e88988c3704cb3f0c0bbbfca5a": "133700000000000000000",
+ "0xbd73c3cbc26a175062ea0320dd84b253bce64358": "394000000000000000000",
+ "0x2680713d40808e2a50ed013150a2a694b96a7f1d": "1790000000000000000000",
+ "0x51e32f14f4ca5e287cdac057a7795ea9e0439953": "500000000000000000000",
+ "0xb1e9c5f1d21e61757a6b2ee75913fc5a1a4101c3": "2000000000000000000000",
+ "0xd4c4d1a7c3c74984f6857b2f5f07e8face68056d": "2000000000000000000000",
+ "0x4651dc420e08c3293b27d2497890eb50223ae2f4": "20000000000000000000000",
+ "0xc74a3995f807de1db01a2eb9c62e97d0548f696f": "1000000000000000000000",
+ "0x0505a08e22a109015a22f685305354662a5531d5": "2600000000000000000000",
+ "0x39c773367c8825d3596c686f42bf0d14319e3f84": "133700000000000000000",
+ "0x0f929cf895db017af79f3ead2216b1bd69c37dc7": "2000000000000000000000",
+ "0xbdd3254e1b3a6dc6cc2c697d45711aca21d516b2": "2000000000000000000000",
+ "0xae5d221afcd3d29355f508eadfca408ce33ca903": "100000000000000000000000",
+ "0x916cf17d71412805f4afc3444a0b8dd1d9339d16": "14300000000000000000",
+ "0x4319263f75402c0b5325f263be4a5080651087f0": "983086000000000000000",
+ "0x0f1c249cd962b00fd114a9349f6a6cc778d76c4d": "2000000000000000000000",
+ "0x54febcce20fe7a9098a755bd90988602a48c089e": "640000000000000000000",
+ "0x2c1800f35fa02d3eb6ff5b25285f5e4add13b38d": "906400000000000000000",
+ "0x72b904440e90e720d6ac1c2ad79c321dcc1c1a86": "1550000000000000000000",
+ "0xb0aa00950c0e81fa3210173e729aaf163a27cd71": "40000000000000000000000",
+ "0x663604b0503046e624cd26a8b6fb4742dce02a6f": "65400000000000000000",
+ "0x3c98594bf68b57351e8814ae9e6dfd2d254aa06f": "300000000000000000000",
+ "0x9c45202a25f6ad0011f115a5a72204f2f2198866": "5014000000000000000000",
+ "0xb02d062873334545cea29218e4057760590f7423": "3186000000000000000000",
+ "0x7bddb2ee98de19ee4c91f661ee8e67a91d054b97": "1000000000000000000000",
+ "0x9cf2928beef09a40f9bfc953be06a251116182fb": "6000000000000000000000",
+ "0x51b4758e9e1450e7af4268c3c7b1e7bd6f5c7550": "1000000000000000000000",
+ "0xeb570dba975227b1c42d6e8dea2c56c9ad960670": "2000000000000000000000",
+ "0x970d8b8a0016d143054f149fb3b8e550dc0797c7": "1000000000000000000000",
+ "0xc7b39b060451000ca1049ba154bcfa00ff8af262": "100000000000000000000000",
+ "0x945e18769d7ee727c7013f92de24d117967ff317": "2000000000000000000000",
+ "0xd18eb9e1d285dabe93e5d4bae76beefe43b521e8": "668500000000000000000",
+ "0xc618521321abaf5b26513a4a9528086f220adc6f": "27000000000000000000",
+ "0xdd65f6e17163b5d203641f51cc7b24b00f02c8fb": "200000000000000000000",
+ "0x131faed12561bb7aee04e5185af802b1c3438d9b": "219000000000000000000",
+ "0x1ced6715f862b1ff86058201fcce5082b36e62b2": "6684522000000000000000",
+ "0xa0ff5b4cf016027e8323497d4428d3e5a83b8795": "6596500000000000000000",
+ "0x02e816afc1b5c0f39852131959d946eb3b07b5ad": "1000000000000000000000",
+ "0x153cf2842cb9de876c276fa64767d1a8ecf573bb": "2000000000000000000000",
+ "0x3bc6e3ee7a56ce8f14a37532590f63716b9966e8": "2000000000000000000000",
+ "0xf6d25d3f3d846d239f525fa8cac97bc43578dbac": "896000000000000000000",
+ "0x2066774d822793ff25f1760909479cf62491bf88": "55160000000000000000000",
+ "0x46779a5656ff00d73eac3ad0c38b6c853094fb40": "230752000000000000000",
+ "0x22eed327f8eb1d1338a3cb7b0f8a4baa5907cd95": "23445000000000000000",
+ "0xff88ebacc41b3687f39e4b59e159599b80cba33f": "400000000000000000000",
+ "0x2874f3e2985d5f7b406627e17baa772b01abcc9e": "6014000000000000000000",
+ "0xeb10458daca79e4a6b24b29a8a8ada711b7f2eb6": "3998000000000000000000",
+ "0x541060fc58c750c40512f83369c0a63340c122b6": "1970000000000000000000",
+ "0xfd2757cc3551a095878d97875615fe0c6a32aa8a": "598200000000000000000",
+ "0xbe659d85e7c34f8833ea7f488de1fbb5d4149bef": "9072500000000000000000",
+ "0xe149b5726caf6d5eb5bf2acc41d4e2dc328de182": "1940000000000000000000",
+ "0x2fe0cc424b53a31f0916be08ec81c50bf8eab0c1": "600000000000000000000",
+ "0xe3712701619ca7623c55db3a0ad30e867db0168b": "20000000000000000000",
+ "0xf8ca336c8e91bd20e314c20b2dd4608b9c8b9459": "846000000000000000000",
+ "0x68acdaa9fb17d3c309911a77b05f5391fa034ee9": "8950000000000000000000",
+ "0xe77d7deab296c8b4fa07ca3be184163d5a6d606c": "92538000000000000000",
+ "0xe6b9545f7ed086e552924639f9a9edbbd5540b3e": "3760000000000000000000",
+ "0x2866b81decb02ee70ae250cee5cdc77b59d7b679": "2000000000000000000000",
+ "0x60e3cc43bcdb026aad759c7066f555bbf2ac66f5": "2000000000000000000000",
+ "0xfcbd85feea6a754fcf3449449e37ff9784f7773c": "3086000000000000000000",
+ "0x38a744efa6d5c2137defef8ef9187b649eee1c78": "4000000000000000000000",
+ "0x9d7655e9f3e5ba5d6e87e412aebe9ee0d49247ee": "2620100000000000000000",
+ "0x2020b81ae53926ace9f7d7415a050c031d585f20": "341200000000000000000",
+ "0x4244f1331158b9ce26bbe0b9236b9203ca351434": "10000000000000000000000",
+ "0x99c236141daec837ece04fdaee1d90cf8bbdc104": "2184000000000000000000",
+ "0x943d37864a4a537d35c8d99723cd6406ce2562e6": "2000000000000000000000",
+ "0xd79483f6a8444f2549d611afe02c432d15e11051": "20000000000000000000",
+ "0x9fd64373f2fbcd9c0faca60547cad62e26d9851f": "1000000000000000000000",
+ "0xb89c036ed7c492879921be41e10ca1698198a74c": "1820000000000000000000",
+ "0x7462c89caa9d8d7891b2545def216f7464d5bb21": "109162000000000000000",
+ "0xbb0366a7cfbd3445a70db7fe5ae34885754fd468": "6160000000000000000000",
+ "0x6c52cf0895bb35e656161e4dc46ae0e96dd3e62c": "4000086000000000000000",
+ "0xb9cf71b226583e3a921103a5316f855a65779d1b": "24000000000000000000000",
+ "0x016b60bb6d67928c29fd0313c666da8f1698d9c5": "2000000000000000000000",
+ "0x9454b3a8bff9709fd0e190877e6cb6c89974dbd6": "2674000000000000000000",
+ "0x84aac7fa197ff85c30e03b7a5382b957f41f3afb": "157600000000000000000",
+ "0xdb6e560c9bc620d4bea3a94d47f7880bf47f2d5f": "89500000000000000000",
+ "0xeefd05b0e3c417d55b3343060486cdd5e92aa7a6": "1430000000000000000000",
+ "0x3a59a08246a8206f8d58f70bb1f0d35c5bcc71bd": "185000000000000000000",
+ "0x9bfff50db36a785555f07652a153b0c42b1b8b76": "2000000000000000000000",
+ "0xd44f5edf2bcf2433f211dadd0cc450db1b008e14": "267400000000000000000",
+ "0x2378fd4382511e968ed192106737d324f454b535": "1000000000000000000000",
+ "0xc94089553ae4c22ca09fbc98f57075cf2ec59504": "4000000000000000000000",
+ "0x08ef3fa4c43ccdc57b22a4b9b2331a82e53818f2": "4000000000000000000000",
+ "0xe48e65125421880d42bdf1018ab9778d96928f3f": "4200000000000000000000",
+ "0x67518e5d02b205180f0463a32004471f753c523e": "1984289000000000000000",
+ "0x0da7401262384e2e8b4b26dd154799b55145efa0": "300000000000000000000",
+ "0x0b6920a64b363b8d5d90802494cf564b547c430d": "1200000000000000000000",
+ "0xa5ab4bd3588f46cb272e56e93deed386ba8b753d": "1332989000000000000000",
+ "0x1788da9b57fd05edc4ff99e7fef301519c8a0a1e": "2000000000000000000000",
+ "0x17b2d6cf65c6f4a347ddc6572655354d8a412b29": "2000000000000000000000",
+ "0xd0319139fbab2e8e2accc1d924d4b11df6696c5a": "200000000000000000000",
+ "0x4c377bb03ab52c4cb79befa1dd114982924c4ae9": "1827814000000000000000",
+ "0xfb949c647fdcfd2514c7d58e31f28a532d8c5833": "20000000000000000000000",
+ "0x70e5e9da735ff077249dcb9aaf3db2a48d9498c0": "1000000000000000000000",
+ "0xfe6f5f42b6193b1ad16206e4afb5239d4d7db45e": "1730000000000000000000",
+ "0xbda4be317e7e4bed84c0495eee32d607ec38ca52": "2309457000000000000000",
+ "0x5910106debd291a1cd80b0fbbb8d8d9e93a7cc1e": "2000000000000000000000",
+ "0xba42f9aace4c184504abf5425762aca26f71fbdc": "37400000000000000000",
+ "0xbeb4fd315559436045dcb99d49dcec03f40c42dc": "2000000000000000000000",
+ "0x452b64db8ef7d6df87c788639c2290be8482d575": "8000000000000000000000",
+ "0x66e09427c1e63deed7e12b8c55a6a19320ef4b6a": "170000000000000000000",
+ "0xfaad905d847c7b23418aeecbe3addb8dd3f8924a": "1970000000000000000000",
+ "0xa29319e81069e5d60df00f3de5adee3505ecd5fb": "2000000000000000000000",
+ "0xcf348f2fe47b7e413c077a7baf3a75fbf8428692": "2000000000000000000000",
+ "0xe1e8c50b80a352b240ce7342bbfdf5690cc8cb14": "394000000000000000000",
+ "0x131c792c197d18bd045d7024937c1f84b60f4438": "4000000000000000000000",
+ "0xe49af4f34adaa2330b0e49dc74ec18ab2f92f827": "2000000000000000000000",
+ "0xf2e99f5cbb836b7ad36247571a302cbe4b481c69": "1970000000000000000000",
+ "0xc93fbde8d46d2bcc0fa9b33bd8ba7f8042125565": "1400000000000000000000",
+ "0x038779ca2dbe663e63db3fe75683ea0ec62e2383": "1670000000000000000000",
+ "0xa33cb450f95bb46e25afb50fe05feee6fb8cc8ea": "776000000000000000000",
+ "0x40ab66fe213ea56c3afb12c75be33f8e32fd085d": "4000000000000000000000",
+ "0x6403d062549690c8e8b63eae41d6c109476e2588": "2000000000000000000000",
+ "0xbfb0ea02feb61dec9e22a5070959330299c43072": "20000000000000000000000",
+ "0x99c475bf02e8b9214ada5fad02fdfd15ba365c0c": "591000000000000000000",
+ "0x904966cc2213b5b8cb5bd6089ef9cddbef7edfcc": "2000000000000000000000",
+ "0x767a03655af360841e810d83f5e61fb40f4cd113": "985000000000000000000",
+ "0xab209fdca979d0a647010af9a8b52fc7d20d8cd1": "9129000000000000000000",
+ "0x6294eae6e420a3d5600a39c4141f838ff8e7cc48": "2955000000000000000000",
+ "0x9777cc61cf756be3b3c20cd4491c69d275e7a120": "10000000000000000000000",
+ "0xbcbf6ba166e2340db052ea23d28029b0de6aa380": "3880000000000000000000",
+ "0x9f10f2a0463b65ae30b070b3df18cf46f51e89bd": "1910000000000000000000",
+ "0x8d9952d0bb4ebfa0efd01a3aa9e8e87f0525742e": "3460000000000000000000",
+ "0x4f23b6b817ffa5c664acdad79bb7b726d30af0f9": "1760000000000000000000",
+ "0xb4c20040ccd9a1a3283da4d4a2f365820843d7e2": "1000000000000000000000",
+ "0x7f49e7a4269882bd8722d4a6f566347629624079": "2000000000000000000000",
+ "0x33629bd52f0e107bc071176c64df108f64777d49": "33425000000000000000",
+ "0x6a7b2e0d88867ff15d207c222bebf94fa6ce8397": "60000000000000000000000",
+ "0xb7ce684b09abda53389a875369f71958aeac3bdd": "2000000000000000000000",
+ "0xffbc3da0381ec339c1c049eb1ed9ee34fdcea6ca": "4000000000000000000000",
+ "0x849ab80790b28ff1ffd6ba394efc7463105c36f7": "34600000000000000000",
+ "0xb0b36af9aeeedf97b6b02280f114f13984ea3260": "985000000000000000000",
+ "0x4d57e716876c0c95ef5eaebd35c8f41b069b6bfe": "2000000000000000000000",
+ "0x2d2b032359b363964fc11a518263bfd05431e867": "149600000000000000000",
+ "0x2ccc1f1cb5f4a8002e186b20885d9dbc030c0894": "2000000000000000000000",
+ "0x016c85e1613b900fa357b8283b120e65aefcdd08": "799954000000000000000",
+ "0x710b0274d712c77e08a5707d6f3e70c0ce3d92cf": "6400000000000000000000",
+ "0x3cd3a6e93579c56d494171fc533e7a90e6f59464": "2000000000000000000000",
+ "0xfe0e30e214290d743dd30eb082f1f0a5225ade61": "200000000000000000000",
+ "0xd0718520eae0a4d62d70de1be0ca431c5eea2482": "2000000000000000000000",
+ "0xaf7f79cb415a1fb8dbbd094607ee8d41fb7c5a3b": "10000000000000000000000",
+ "0xb7d252ee9402b0eef144295f0e69f0db586c0871": "660000000000000000000",
+ "0xc3b928a76fad6578f04f0555e63952cd21d1520a": "2000000000000000000000",
+ "0xa7a517d7ad35820b09d497fa7e5540cde9495853": "2000000000000000000000",
+ "0xe6e886317b6a66a5b4f81bf164c538c264351765": "2000000000000000000000",
+ "0x0770b43dbae4b1f35a927b4fa8124d3866caf97b": "1016390000000000000000",
+ "0x52b4257cf41b6e28878d50d57b99914ffa89873a": "3930150000000000000000",
+ "0xe08bc29c2b48b169ff2bdc16714c586e6cb85ccf": "20000000000000000000",
+ "0x2372c4c1c9939f7aaf6cfac04090f00474840a09": "10000000000000000000000",
+ "0xab6b65eab8dfc917ec0251b9db0ecfa0fa032849": "500000000000000000000",
+ "0x582e7cc46f1d7b4e6e9d95868bfd370573178f4c": "2000000000000000000000",
+ "0xf167f5868dcf4233a7830609682caf2df4b1b807": "2396150000000000000000",
+ "0xec82f50d06475f684df1b392e00da341aa145444": "2000000000000000000000",
+ "0x0968ee5a378f8cadb3bafdbed1d19aaacf936711": "1000000000000000000000",
+ "0xa86613e6c4a4c9c55f5c10bcda32175dcbb4af60": "10696140000000000000000",
+ "0xa5cd123992194b34c4781314303b03c54948f4b9": "2010462000000000000000",
+ "0x52f058d46147e9006d29bf2c09304ad1cddd6e15": "1500000000000000000000",
+ "0x160226efe7b53a8af462d117a0108089bdecc2d1": "200550000000000000000",
+ "0x256292a191bdda34c4da6b6bd69147bf75e2a9ab": "14051000000000000000",
+ "0x1b8aa0160cd79f005f88510a714913d70ad3be33": "201760000000000000000",
+ "0xd4b2ff3bae1993ffea4d3b180231da439f7502a2": "2000000000000000000000",
+ "0xe408aa99835307eea4a6c5eb801fe694117f707d": "500000000000000000000",
+ "0xe60a55f2df996dc3aedb696c08dde039b2641de8": "2000000000000000000000",
+ "0x73df3c3e7955f4f2d859831be38000b1076b3884": "1970000000000000000000",
+ "0x6228ade95e8bb17d1ae23bfb0518414d497e0eb8": "400000000000000000000",
+ "0x0f46c81db780c1674ac73d314f06539ee56ebc83": "9850000000000000000000",
+ "0x762d6f30dab99135e4eca51d5243d6c8621102d5": "282000000000000000000",
+ "0x4ba0d9e89601772b496847a2bb4340186787d265": "1000000000000000000000",
+ "0xca747576446a4c8f30b08340fee198de63ec92cf": "7020000000000000000000",
+ "0x99c31fe748583787cdd3e525b281b218961739e3": "1015200000000000000000",
+ "0x1210f80bdb826c175462ab0716e69e46c24ad076": "100000000000000000000",
+ "0x3f75ae61cc1d8042653b5baec4443e051c5e7abd": "95500000000000000000",
+ "0x5c4892907a0720df6fd3413e63ff767d6b398023": "13189467000000000000000",
+ "0x17f14632a7e2820be6e8f6df823558283dadab2d": "2000000000000000000000",
+ "0x1dc7f7dad85df53f1271152403f4e1e4fdb3afa0": "200000000000000000000",
+ "0x5a30feac37ac9f72d7b4af0f2bc73952c74fd5c3": "2000000000000000000000",
+ "0x136d4b662bbd1080cfe4445b0fa213864435b7f1": "4000000000000000000000",
+ "0xc1ec81dd123d4b7c2dd9b4d438a7072c11dc874c": "2000000000000000000000",
+ "0x09f9575be57d004793c7a4eb84b71587f97cbb6a": "200000000000000000000",
+ "0x2c4b470307a059854055d91ec3794d80b53d0f4a": "20000000000000000000000",
+ "0x6af6c7ee99df271ba15bf384c0b764adcb4da182": "999972000000000000000",
+ "0x0dae3ee5b915b36487f9161f19846d101433318a": "1910000000000000000000",
+ "0x0dcf9d8c9804459f647c14138ed50fad563b4154": "173000000000000000000",
+ "0xbfa8c858df102cb12421008b0a31c4c7190ad560": "200000000000000000000",
+ "0xc2fd0bf7c725ef3e047e5ae1c29fe18f12a7299c": "1337000000000000000000",
+ "0xd70a612bd6dda9eab0dddcff4aaf4122d38feae4": "540000000000000000000",
+ "0xe07137ae0d116d033533c4eab496f8a9fb09569c": "1400000000000000000000",
+ "0x7f49f20726471ac1c7a83ef106e9775ceb662566": "5910000000000000000000",
+ "0x1e706655e284dcf0bb37fe075d613a18dc12ff4a": "4376760000000000000000",
+ "0x03af7ad9d5223cf7c8c13f20df67ebe5ffc5bb41": "200000000000000000000",
+ "0x228242f8336eecd8242e1f000f41937e71dffbbf": "5000000000000000000000",
+ "0xe8ed51bbb3ace69e06024b33f86844c47348db9e": "165170600000000000000000",
+ "0x3b566a8afad19682dc2ce8679a3ce444a5b0fd4f": "2000000000000000000000",
+ "0xdc738fb217cead2f69594c08170de1af10c419e3": "100000000000000000000000",
+ "0x13032446e7d610aa00ec8c56c9b574d36ca1c016": "2000000000000000000000",
+ "0x6ca6a132ce1cd288bee30ec7cfeffb85c1f50a54": "2000000000000000000000",
+ "0xb85f26dd0e72d9c29ebaf697a8af77472c2b58b5": "11900000000000000000000",
+ "0x055bd02caf19d6202bbcdc836d187bd1c01cf261": "100000000000000000000",
+ "0x3c322e611fdb820d47c6f8fc64b6fad74ca95f5e": "242514000000000000000",
+ "0x8daddf52efbd74da95b969a5476f4fbbb563bfd2": "835000000000000000000",
+ "0xc63ac417992e9f9b60386ed953e6d7dff2b090e8": "4000086000000000000000",
+ "0x27f03cf1abc5e1b51dbc444b289e542c9ddfb0e6": "5000000000000000000000",
+ "0xd8f4bae6f84d910d6d7d5ac914b1e68372f94135": "100000000000000000000",
+ "0x9f83a293c324d4106c18faa8888f64d299054ca0": "200000000000000000000",
+ "0x39ee4fe00fbced647068d4f57c01cb22a80bccd1": "6000000000000000000000",
+ "0x404100db4c5d0eec557823b58343758bcc2c8083": "20000000000000000000",
+ "0x02751dc68cb5bd737027abf7ddb77390cd77c16b": "20000000000000000000",
+ "0xd10302faa1929a326904d376bf0b8dc93ad04c4c": "1790000000000000000000",
+ "0xcc419fd9912b85135659e77a93bc3df182d45115": "10000000000000000000000",
+ "0x10097198b4e7ee91ff82cc2f3bd95fed73c540c0": "2000000000000000000000",
+ "0x7e24d9e22ce1da3ce19f219ccee523376873f367": "5900150000000000000000",
+ "0x2e4ee1ae996aa0a1d92428d06652a6bea6d2d15d": "2000000000000000000000",
+ "0x91a4149a2c7b1b3a67ea28aff34725e0bf8d7524": "1940000000000000000000",
+ "0xead65262ed5d122df2b2751410f98c32d1238f51": "101680000000000000000",
+ "0xe20954d0f4108c82d4dcb2148d26bbd924f6dd24": "10000000000000000000000",
+ "0xebb7d2e11bc6b58f0a8d45c2f6de3010570ac891": "26740000000000000000",
+ "0xef115252b1b845cd857f002d630f1b6fa37a4e50": "1970000000000000000000",
+ "0x01a818135a414210c37c62b625aca1a54611ac36": "260000000000000000000",
+ "0xea1ea0c599afb9cd36caacbbb52b5bbb97597377": "1069600000000000000000",
+ "0x7a7a4f807357a4bbe68e1aa806393210c411ccb3": "30000000000000000000000",
+ "0x6d40ca27826d97731b3e86effcd7b92a4161fe89": "2000000000000000000000",
+ "0x8431277d7bdd10457dc017408c8dbbbd414a8df3": "39400000000000000000",
+ "0x69b81d5981141ec7a7141060dfcf8f3599ffc63e": "5000000000000000000000",
+ "0x47688410ff25d654d72eb2bc06e4ad24f833b094": "160440000000000000000",
+ "0x6c101205b323d77544d6dc52af37aca3cec6f7f1": "10000000000000000000000",
+ "0xfb685c15e439965ef626bf0d834cd1a89f2b5695": "3940000000000000000000",
+ "0x673706b1b0e4dc7a949a7a796258a5b83bb5aa83": "16100000000000000000000",
+ "0xecdaf93229b45ee672f65db506fb5eca00f7fce6": "1605009000000000000000",
+ "0xec6904bae1f69790591709b0609783733f2573e3": "500000000000000000000",
+ "0x812ea7a3b2c86eed32ff4f2c73514cc63bacfbce": "1000000000000000000000",
+ "0x196c02210a450ab0b36370655f717aa87bd1c004": "259456000000000000000",
+ "0xd96ac2507409c7a383ab2eee1822a5d738b36b56": "200000000000000000000",
+ "0xae2f9c19ac76136594432393b0471d08902164d3": "698600000000000000000",
+ "0x9d32962ea99700d93228e9dbdad2cc37bb99f07e": "3327560000000000000000",
+ "0x17e584e810e567702c61d55d434b34cdb5ee30f6": "5000000000000000000000",
+ "0xa3a93ef9dbea2636263d06d8492f6a41de907c22": "60000000000000000000",
+ "0x2b5016e2457387956562587115aa8759d8695fdf": "200000000000000000000000",
+ "0x140129eaa766b5a29f5b3af2574e4409f8f6d3f1": "6400000000000000000000",
+ "0x7025965d2b88da197d4459be3dc9386344cc1f31": "2005500000000000000000",
+ "0x388bdcdae794fc44082e667501344118ea96cd96": "1670000000000000000000",
+ "0xeee9d0526eda01e43116a395322dda8970578f39": "9999980000000000000000",
+ "0x6ec89b39f9f5276a553e8da30e6ec17aa47eefc7": "447500000000000000000",
+ "0x7e236666b2d06e63ea4e2ab84357e2dfc977e50e": "999972000000000000000",
+ "0x68df947c495bebaeb8e889b3f953d533874bf106": "546000000000000000000",
+ "0xd40ed66ab3ceff24ca05ecd471efb492c15f5ffa": "500000000000000000000",
+ "0xf0c70d0d6dab7663aa9ed9ceea567ee2c6b02765": "2089349000000000000000",
+ "0xb589676d15a04448344230d4ff27c95edf122c49": "1000000000000000000000",
+ "0xa0347f0a98776390165c166d32963bf74dcd0a2f": "1000000000000000000000",
+ "0xd47d8685faee147c520fd986709175bf2f886bef": "2000000000000000000000",
+ "0xa1dcd0e5b05a977c9623e5ae2f59b9ada2f33e31": "100000000000000000000",
+ "0x4979194ec9e97db9bee8343b7c77d9d7f3f1dc9f": "20000000000000000000",
+ "0x7cd20eccb518b60cab095b720f571570caaa447e": "500000000000000000000",
+ "0x2ff830cf55fb00d5a0e03514fecd44314bd6d9f1": "10000000000000000000000",
+ "0x0bb25ca7d188e71e4d693d7b170717d6f8f0a70a": "336870000000000000000",
+ "0xe9a2b4914e8553bf0d7c00ca532369b879f931bf": "2000000000000000000000",
+ "0x720e6b22bf430966fa32b6acb9a506eebf662c61": "152000000000000000000",
+ "0x7ade5d66b944bb860c0efdc86276d58f4653f711": "2000000000000000000000",
+ "0x2eaff9f8f8113064d3957ac6d6e11eee42c8195d": "1970000000000000000000",
+ "0x0c8fd7775e54a6d9c9a3bf890e761f6577693ff0": "9850000000000000000000",
+ "0x290a56d41f6e9efbdcea0342e0b7929a8cdfcb05": "344000000000000000000",
+ "0xd73ed2d985b5f21b55b274643bc6da031d8edd8d": "49250000000000000000000",
+ "0x80156d10efa8b230c99410630d37e269d4093cea": "2000000000000000000000",
+ "0x0989c200440b878991b69d6095dfe69e33a22e70": "1910000000000000000000",
+ "0xec8014efc7cbe5b0ce50f3562cf4e67f8593cd32": "17300000000000000000",
+ "0xde612d0724e84ea4a7feaa3d2142bd5ee82d3201": "20000000000000000000",
+ "0x0f832a93df9d7f74cd0fb8546b7198bf5377d925": "143000000000000000000",
+ "0xaa2c670096d3f939305325427eb955a8a60db3c5": "2003010000000000000000",
+ "0x25287b815f5c82380a73b0b13fbaf982be24c4d3": "40000000000000000000",
+ "0xe75c3b38a58a3f33d55690a5a59766be185e0284": "500000000000000000000",
+ "0x1940dc9364a852165f47414e27f5002445a4f143": "10850000000000000000000",
+ "0xe5b826196c0e1bc1119b021cf6d259a610c99670": "200000000000000000000",
+ "0x82a15cef1d6c8260eaf159ea3f0180d8677dce1c": "2000000000000000000000",
+ "0xda06044e293c652c467fe74146bf185b21338a1c": "1000000000000000000000",
+ "0xf815c10a032d13c34b8976fa6e3bd2c9131a8ba9": "1337000000000000000000",
+ "0xcd95fa423d6fc120274aacde19f4eeb766f10420": "200000000000000000000",
+ "0xe3a4f83c39f85af9c8b1b312bfe5fc3423afa634": "28650000000000000000",
+ "0x768ce0daa029b7ded022e5fc574d11cde3ecb517": "322000000000000000000",
+ "0xe3ec18a74ed43855409a26ade7830de8e42685ef": "19700000000000000000",
+ "0xb2bdbedf95908476d7148a370cc693743628057f": "4000000000000000000000",
+ "0xbbb8ffe43f98de8eae184623ae5264e424d0b8d7": "107600000000000000000",
+ "0x090cebef292c3eb081a05fd8aaf7d39bf07b89d4": "4000000000000000000000",
+ "0xdd2a233adede66fe1126d6c16823b62a021feddb": "2000000000000000000000",
+ "0xd8cd64e0284eec53aa4639afc4750810b97fab56": "20000000000000000000",
+ "0xe5953fea497104ef9ad2d4e5841c271f073519c2": "704000000000000000000",
+ "0x967d4142af770515dd7062af93498dbfdff29f20": "20200000000000000000",
+ "0xfd191a35157d781373fb411bf9f25290047c5eef": "1000000000000000000000",
+ "0x8967d7b9bdb7b4aed22e65a15dc803cb7a213f10": "400000000000000000000",
+ "0x51e43fe0d25c782860af81ea89dd793c13f0cbb1": "60000000000000000000",
+ "0xa38476691d34942eea6b2f76889223047db4617a": "2000000000000000000000",
+ "0x1321ccf29739b974e5a516f18f3a843671e39642": "4000000000000000000000",
+ "0x4d71a6eb3d7f327e1834278e280b039eddd31c2f": "6000000000000000000000",
+ "0xdc2d15a69f6bb33b246aef40450751c2f6756ad2": "1996000000000000000000",
+ "0xec89f2b678a1a15b9134ec5eb70c6a62071fbaf9": "200000000000000000000",
+ "0x27bf943c1633fe32f8bcccdb6302b407a5724e44": "940229000000000000000",
+ "0xd0a6c6f9e9c4b383d716b31de78d56414de8fa91": "300000000000000000000",
+ "0x7b6175ec9befc738249535ddde34688cd36edf25": "10000000000000000000000",
+ "0x41ce79950935cff55bf78e4ccec2fe631785db95": "2000000000000000000000",
+ "0x5598b3a79a48f32b1f5fc915b87b645d805d1afe": "500000000000000000000",
+ "0x5c4881165cb42bb82e97396c8ef44adbf173fb99": "110600000000000000000",
+ "0x25b0533b81d02a617b9229c7ec5d6f2f672e5b5a": "1000000000000000000000",
+ "0x015f097d9acddcddafaf2a107eb93a40fc94b04c": "20000000000000000000000",
+ "0xb84b53d0bb125656cddc52eb852ab71d7259f3d5": "16000000000000000000000",
+ "0x1a79c7f4039c67a39d7513884cdc0e2c34222490": "20000000000000000000",
+ "0x926209b7fda54e8ddb9d9e4d3d19ebdc8e88c29f": "2000000000000000000000",
+ "0xc2fe7d75731f636dcd09dbda0671393ba0c82a7d": "2200000000000000000000",
+ "0x30248d58e414b20fed3a6c482b59d9d8f5a4b7e2": "60000000000000000000",
+ "0xd0e194f34b1db609288509ccd2e73b6131a2538b": "999972000000000000000",
+ "0xe8f29969e75c65e01ce3d86154207d0a9e7c76f2": "2991807000000000000000",
+ "0xcb93199b9c90bc4915bd859e3d42866dc8c18749": "231800000000000000000",
+ "0xe6fe0afb9dcedd37b2e22c451ba6feab67348033": "10000000000000000000000",
+ "0x82f854c9c2f087dffa985ac8201e626ca5467686": "100000000000000000000000",
+ "0x63bb664f9117037628594da7e3c5089fd618b5b5": "20000000000000000000",
+ "0xf8d17424c767bea31205739a2b57a7277214eebe": "42000000000000000000",
+ "0x4ca8db4a5efefc80f4cd9bbcccb03265931332b6": "200000000000000000000",
+ "0xc56e6b62ba6e40e52aab167d21df025d0055754b": "2000000000000000000000",
+ "0x0d8c40a79e18994ff99ec251ee10d088c3912e80": "114600000000000000000",
+ "0x40a331195b977325c2aa28fa2f42cb25ec3c253c": "2000000000000000000000",
+ "0xa2c5854ff1599f98892c5725d262be1da98aadac": "314315000000000000000",
+ "0x23ab09e73f87aa0f3be0139df0c8eb6be5634f95": "8000000000000000000000",
+ "0xb8040536958d5998ce4bec0cfc9c2204989848e9": "24472420000000000000000",
+ "0x42d6b263d9e9f4116c411424fc9955783c763030": "2000000000000000000000",
+ "0xc496cbb0459a6a01600fc589a55a32b454217f9d": "274000000000000000000",
+ "0x48302c311ef8e5dc664158dd583c81194d6e0d58": "3364760000000000000000",
+ "0xd5b284040130abf7c1d163712371cc7e28ad66da": "1970000000000000000000",
+ "0xd22f0ca4cd479e661775053bcc49e390f670dd8a": "1000000000000000000000",
+ "0xe597f083a469c4591c3d2b1d2c772787befe27b2": "280000000000000000000",
+ "0x668b6ba8ab08eace39c502ef672bd5ccb6a67a20": "31135320000000000000000",
+ "0xa3bff1dfa9971668360c0d82828432e27bf54e67": "200000000000000000000",
+ "0xee655bb4ee0e8d5478526fb9f15e4064e09ff3dd": "200000000000000000000",
+ "0x121f855b70149ac83473b9706fb44d47828b983b": "1400000000000000000000",
+ "0x20a15256d50ce058bf0eac43aa533aa16ec9b380": "20000000000000000000",
+ "0x69bcfc1d43b4ba19de7b274bdffb35139412d3d7": "985000000000000000000",
+ "0xdb288f80ffe232c2ba47cc94c763cf6fc9b82b0d": "85000000000000000000",
+ "0xe1cb83ec5eb6f1eeb85e99b2fc63812fde957184": "20000000000000000000000",
+ "0xa419a984142363267575566089340eea0ea20819": "1999944000000000000000",
+ "0x8489f6ad1d9a94a297789156899db64154f1dbb5": "358849000000000000000",
+ "0xd609bf4f146eea6b0dc8e06ddcf4448a1fccc9fa": "2000000000000000000000",
+ "0xdf1fa2e20e31985ebe2c0f0c93b54c0fb67a264b": "200000000000000000000",
+ "0xefe8ff87fc260e0767638dd5d02fc4672e0ec06d": "2000000000000000000000",
+ "0xeef1bbb1e5a83fde8248f88ee3018afa2d1332eb": "200000000000000000000",
+ "0x4b3aab335ebbfaa870cc4d605e7d2e74c668369f": "60000000000000000000000",
+ "0x8f4fb1aea7cd0f570ea5e61b40a4f4510b6264e4": "4000000000000000000000",
+ "0x0b0b3862112aeec3a03492b1b05f440eca54256e": "4000000000000000000000",
+ "0xdff4007931786593b229efe5959f3a4e219e51af": "4925000000000000000000",
+ "0xfec14e5485de2b3eef5e74c46146db8e454e0335": "179000000000000000000",
+ "0xac21c1e5a3d7e0b50681679dd6c792dbca87decb": "100000000000000000000000",
+ "0x796ebbf49b3e36d67694ad79f8ff36767ac6fab0": "60800000000000000000",
+ "0xae7739124ed153052503fc101410d1ffd8cd13b7": "999942000000000000000",
+ "0x86026cad3fe4ea1ce7fca260d3d45eb09ea6a364": "200000000000000000000",
+ "0xb2fc84a3e50a50af02f94da0383ed59f71ff01d7": "30000000000000000000000",
+ "0xbbab000b0408ed015a37c04747bc461ab14e151b": "6000000000000000000000",
+ "0xc4ff6fbb1f09bd9e102ba033d636ac1c4c0f5304": "1000000000000000000000",
+ "0xcc606f511397a38fc7872bd3b0bd03c71bbd768b": "1000000000000000000000",
+ "0xf346d7de92741c08fc58a64db55b062dde012d14": "295106000000000000000",
+ "0x33f15223310d44de8b6636685f3a4c3d9c5655a5": "250500000000000000000",
+ "0x3c860e2e663f46db53427b29fe3ea5e5bf62bbcc": "98500000000000000000",
+ "0xacb94338554bc488cc88ae2d9d94080d6bdf8410": "1000000000000000000000",
+ "0x9c5cc111092c122116f1a85f4ee31408741a7d2f": "492500000000000000000",
+ "0x5f76f0a306269c78306b3d650dc3e9c37084db61": "2400000000000000000000",
+ "0x2c0cc3f951482cc8a2925815684eb9f94e060200": "6000000000000000000000",
+ "0xb74372dbfa181dc9242f39bf1d3731dffe2bdacf": "2000000000000000000000",
+ "0x3bab4b01a7c84ba13feea9b0bb191b77a3aadca3": "200000000000000000000",
+ "0x39aa05e56d7d32385421cf9336e90d3d15a9f859": "26000000000000000000",
+ "0x4a52bad20357228faa1e996bed790c93674ba7d0": "1337000000000000000000",
+ "0xff128f4b355be1dc4a6f94fa510d7f15d53c2aff": "2720000000000000000000",
+ "0x92793ac5b37268774a7130de2bbd330405661773": "40110000000000000000",
+ "0xdb19a3982230368f0177219cb10cb259cdb2257c": "2000000000000000000000",
+ "0x8d1794da509cb297053661a14aa892333231e3c1": "199600000000000000000",
+ "0x9b7c8810cc7cc89e804e6d3e38121850472877fe": "2000000000000000000000",
+ "0xed3cbc3782cebd67989b305c4133b2cde32211eb": "400000000000000000000",
+ "0x8532490897bbb4ce8b7f6b837e4cba848fbe9976": "100000000000000000000",
+ "0xc384ac6ee27c39e2f278c220bdfa5baed626d9d3": "600000000000000000000",
+ "0xb1459285863ea2db3759e546ceb3fb3761f5909c": "1122309000000000000000",
+ "0x634efc24371107b4cbf03f79a93dfd93e431d5fd": "1221341000000000000000",
+ "0xef9f59aeda418c1494682d941aab4924b5f4929a": "100000000000000000000000",
+ "0xe7311c9533f0092c7248c9739b5b2c864a34b1ce": "2803436000000000000000",
+ "0xe6e621eaab01f20ef0836b7cad47464cb5fd3c96": "316014000000000000000",
+ "0xcd102cd6db3df14ad6af0f87c72479861bfc3d24": "2000000000000000000000",
+ "0x005a9c03f69d17d66cbb8ad721008a9ebbb836fb": "2000000000000000000000",
+ "0xa072cebe62a9e9f61cc3fbf88a9efbfe3e9a8d70": "400000000000000000000",
+ "0xf2ab1161750244d0ecd048ee0d3e51abb143a2fd": "1235800000000000000000",
+ "0xf686785b89720b61145fea80978d6acc8e0bc196": "4000000000000000000000",
+ "0x0a2b4fc5d81ace67dc4bba03f7b455413d46fe3d": "197000000000000000000",
+ "0xc32ec7e42ad16ce3e2555ad4c54306eda0b26758": "2000000000000000000000",
+ "0xf3fa723552a5d0512e2b62f48dca7b2b8105305b": "137000000000000000000",
+ "0x6dc3f92baa1d21dab7382b893261a0356fa7c187": "1730000000000000000000",
+ "0x4627c606842671abde8295ee5dd94c7f549534f4": "286600000000000000000",
+ "0xe39e46e15d22ce56e0c32f1877b7d1a264cf94f3": "20000000000000000000000",
+ "0xd7d157e4c0a96437a6d285741dd23ec4361fa36b": "2000000000000000000000",
+ "0x68f8f45155e98c5029a4ebc5b527a92e9fa83120": "4436101000000000000000",
+ "0x9aba2b5e27ff78baaab5cdc988b7be855cebbdce": "9999000000000000000000",
+ "0x66b39837cb3cac8a802afe3f12a258bbca62dacd": "400000000000000000000",
+ "0xd39b7cbc94003fc948f0cde27b100db8ccd6e063": "400000000000000000000",
+ "0x3db9ed7f024c7e26372feacf2b050803445e3810": "1285600000000000000000",
+ "0x3fbc1e4518d73400c6d046359439fb68ea1a49f4": "16400000000000000000000",
+ "0xe3da4f3240844c9b6323b4996921207122454399": "11539639000000000000000",
+ "0x09afa73bc047ef46b977fd9763f87286a6be68c6": "501500000000000000000",
+ "0x1dbe8e1c2b8a009f85f1ad3ce80d2e05350ee39c": "135400000000000000000",
+ "0x2c5a2d0abda03bbe215781b4ff296c8c61bdbaf6": "30617000000000000000",
+ "0x9a9d1dc0baa77d6e20c3d849c78862dd1c054c87": "880000000000000000000",
+ "0x3ccef88679573947e94997798a1e327e08603a65": "807700000000000000000",
+ "0x850b9db18ff84bf0c7da49ea3781d92090ad7e64": "2600000000000000000000",
+ "0x361c75931696bc3d427d93e76c77fd13b241f6f4": "549212000000000000000",
+ "0xc8f2b320e6dfd70906c597bad2f9501312c78259": "1504800000000000000000",
+ "0x8dc1d5111d09af25fdfcac455c7cec283e6d6775": "2000000000000000000000",
+ "0xcd7ece086b4b619b3b369352ee38b71ddb06439a": "200000000000000000000",
+ "0xf607c2150d3e1b99f24fa1c7d540add35c4ebe1e": "3098020000000000000000",
+ "0x32485c818728c197fea487fbb6e829159eba8370": "1053893000000000000000",
+ "0x8e670815fb67aeaea57b86534edc00cdf564fee5": "3300000000000000000000",
+ "0x10df681506e34930ac7a5c67a54c3e89ce92b981": "2153800000000000000000",
+ "0x1cf2eb7a8ccac2adeaef0ee87347d535d3b94058": "2000000000000000000000",
+ "0xf0dc43f205619127507b2b1c1cfdf32d28310920": "301973000000000000000",
+ "0xf2c2904e9fa664a11ee25656d8fd2cc0d9a522a0": "13370000000000000000",
+ "0x70670fbb05d33014444b8d1e8e7700258b8caa6d": "2000000000000000000000",
+ "0x5160ed612e1b48e73f3fc15bc4321b8f23b8a24b": "562800000000000000000",
+ "0x54a62bf9233e146ffec3876e45f20ee8414adeba": "10000000000000000000000",
+ "0x26d4ec17d5ceb2c894bdc59d0a6a695dad2b43cc": "2935300000000000000000",
+ "0x205fc843e19a4913d1881eb69b69c0fa3be5c50b": "9700000000000000000000",
+ "0xe001aba77c02e172086c1950fffbcaa30b83488f": "1970000000000000000000",
+ "0x21efbca09b3580b98e73f5b2f7f4dc0bf02c529c": "2000000000000000000000",
+ "0xc4d916574e68c49f7ef9d3d82d1638b2b7ee0985": "1580000000000000000000",
+ "0xcab0d32cf3767fa6b3537c84328baa9f50458136": "8960000000000000000000",
+ "0x7ce4686446f1949ebed67215eb0d5a1dd72c11b8": "2217776000000000000000",
+ "0x7837fcb876da00d1eb3b88feb3df3fa4042fac82": "1760000000000000000000",
+ "0x71e38ff545f30fe14ca863d4f5297fd48c73a5ce": "3580000000000000000000",
+ "0xe528a0e5a267d667e9393a6584e19b34dc9be973": "5600000000000000000000",
+ "0xc5374928cdf193705443b14cc20da423473cd9cf": "138139000000000000000",
+ "0xe406f5dd72cab66d8a6ecbd6bfb494a7b6b09afe": "100000000000000000000",
+ "0xd7ef340e66b0d7afcce20a19cb7bfc81da33d94e": "3000000000000000000000",
+ "0xe012db453827a58e16c1365608d36ed658720507": "2000000000000000000000",
+ "0xd59638d3c5faa7711bf085745f9d5bdc23d498d8": "2000000000000000000000",
+ "0x008fc7cbadffbd0d7fe44f8dfd60a79d721a1c9c": "1000000000000000000000",
+ "0x8a3470282d5e2a2aefd7a75094c822c4f5aeef8a": "242743000000000000000",
+ "0x38b3965c21fa893931079beacfffaf153678b6eb": "170374000000000000000",
+ "0x57dd9471cbfa262709f5f486bcb774c5f527b8f8": "197000000000000000000",
+ "0x5a60c924162873fc7ea4da7f972e350167376031": "83583000000000000000",
+ "0xb9013c51bd078a098fae05bf2ace0849c6be17a5": "80000000000000000000",
+ "0xdc23b260fcc26e7d10f4bd044af794579460d9da": "500038000000000000000",
+ "0x45db03bccfd6a5f4d0266b82a22a368792c77d83": "8000000000000000000000",
+ "0x3e0cbe6a6dcb61f110c45ba2aa361d7fcad3da73": "8022000000000000000000",
+ "0x42d3a5a901f2f6bd9356f112a70180e5a1550b60": "925000000000000000000",
+ "0x47219229e8cd56659a65c2a943e2dd9a8f4bfd89": "1520000000000000000000",
+ "0xa20d071b1b003063497d7990e1249dabf36c35f7": "1000000000000000000000",
+ "0x6835c8e8b74a2ca2ae3f4a8d0f6b954a3e2a8392": "60140000000000000000",
+ "0x0c2d5c920538e953caaf24f0737f554cc6927742": "1000000000000000000000",
+ "0xeedf6c4280e6eb05b934ace428e11d4231b5905b": "200000000000000000000",
+ "0xffa696ecbd787e66abae4fe87b635f07ca57d848": "1337000000000000000000",
+ "0x3e81772175237eb4cbe0fe2dcafdadffeb6a1999": "8800000000000000000000",
+ "0xb44783c8e57b480793cbd69a45d90c7b4f0c48ac": "20000000000000000000",
+ "0xf84f090adf3f8db7e194b350fbb77500699f66fd": "1970000000000000000000",
+ "0x2e9824b5c132111bca24ddfba7e575a5cd7296c1": "17201900000000000000000",
+ "0x5cce72d068c7c3f55b1d2819545e77317cae8240": "1940000000000000000000",
+ "0xd815e1d9f4e2b5e57e34826b7cfd8881b8546890": "17300000000000000000",
+ "0xf901c00fc1db88b69c4bc3252b5ca70ea6ee5cf6": "400000000000000000000",
+ "0xa960b1cadd3b5c1a8e6cb3abcaf52ee7c3d9fa88": "1522704000000000000000",
+ "0xf7e45a12aa711c709acefe95f33b78612d2ad22a": "66230000000000000000000",
+ "0xc332df50b13c013490a5d7c75dbfa366da87b6d6": "4000000000000000000000",
+ "0xd467cf064c0871989b90d8b2eb14ccc63b360823": "200000000000000000000",
+ "0xb9144b677c2dc614ceefdf50985f1183208ea64c": "2000000000000000000000",
+ "0xea7c4d6dc729cd6b157c03ad237ca19a209346c3": "2000000000000000000000",
+ "0x9c9de44724a4054da0eaa605abcc802668778bea": "200020000000000000000",
+ "0xd7140c8e5a4307fab0cc27badd9295018bf87970": "109600000000000000000",
+ "0xc33acdb3ba1aab27507b86b15d67faf91ecf6293": "2000000000000000000000",
+ "0xdb2a0c9ab64df58ddfb1dbacf8ba0d89c85b31b4": "4000000000000000000000",
+ "0xbfcb9730246304700da90b4153e71141622e1c41": "1000000000000000000000",
+ "0x07dc8c8b927adbedfa8f5d639b4352351f2f36d2": "314382000000000000000",
+ "0x2d5391e938b34858cf965b840531d5efda410b09": "1400000000000000000000",
+ "0x0b5e2011ebc25a007f21362960498afb8af280fb": "2000000000000000000000",
+ "0xed9fb1f5af2fbf7ffc5029cee42b70ff5c275bf5": "280000000000000000000",
+ "0xa3232d068d50064903c9ebc563b515acc8b7b097": "2002000000000000000000",
+ "0x66274fea82cd30b6c29b23350e4f4f3d310a5899": "2070000000000000000000",
+ "0xdbfb1bb464b8a58e500d2ed8de972c45f5f1c0fb": "1600000000000000000000",
+ "0xa1f8d8bcf90e777f19b3a649759ad95027abdfc3": "200000000000000000000",
+ "0x5bd23547477f6d09d7b2a005c5ee650c510c56d7": "10000000000000000000000",
+ "0xec3b8b58a12703e581ce5ffd7e21c57d1e5c663f": "1700000000000000000000",
+ "0x54310b3aa88703a725dfa57de6e646935164802c": "1910000000000000000000",
+ "0x8f41b1fbf54298f5d0bc2d122f4eb95da4e5cd3d": "354200000000000000000",
+ "0xc80b36d1beafba5fcc644d60ac6e46ed2927e7dc": "13370000000000000000",
+ "0x1ea492bce1ad107e337f4bd4a7ac9a7babcccdab": "100000000000000000000",
+ "0xaaf023fef290a49bb78bb7abc95d669c50d528b0": "200000000000000000000",
+ "0x80b79f338390d1ba1b3737a29a0257e5d91e0731": "20000000000000000000",
+ "0xf382e4c20410b951089e19ba96a2fee3d91cce7e": "5054000000000000000000",
+ "0x0748713145ef83c3f0ef4d31d823786f7e9cc689": "4500000000000000000000",
+ "0x21e219c89ca8ac14ae4cba6130eeb77d9e6d3962": "789580000000000000000",
+ "0xca9a042a6a806ffc92179500d24429e8ab528117": "1100000000000000000000",
+ "0xbcc9593b2da6df6a34d71b1aa38dacf876f95b88": "20000000000000000000",
+ "0xd1438267231704fc7280d563adf4763844a80722": "200000000000000000000",
+ "0x4989e1ab5e7cd00746b3938ef0f0d064a2025ba5": "2000000000000000000000",
+ "0xbd4b60faec740a21e3071391f96aa534f7c1f44e": "182000000000000000000",
+ "0x8c7cb4e48b25031aa1c4f92925d631a8c3edc761": "1000000000000000000000",
+ "0x322788b5e29bf4f5f55ae1ddb32085fda91b8ebe": "200000000000000000000",
+ "0xf15e182c4fbbad79bd93342242d4dccf2be58925": "1940000000000000000000",
+ "0x1548b770a5118ede87dba2f690337f616de683ab": "527558000000000000000",
+ "0x69c2d835f13ee90580408e6a3283c8cca6a434a2": "656000000000000000000",
+ "0xa1e4380a3b1f749673e270229993ee55f35663b4": "2000000000000000000000",
+ "0xc7675e5647b9d8daf4d3dff1e552f6b07154ac38": "180000000000000000000",
+ "0xa02c1e34064f0475f7fa831ccb25014c3aa31ca2": "60000000000000000000",
+ "0x517c75430de401c341032686112790f46d4d369e": "388000000000000000000",
+ "0x29681d9912ddd07eaabb88d05d90f766e862417d": "1000000000000000000000",
+ "0x544dda421dc1eb73bb24e3e56a248013b87c0f44": "1970000000000000000000",
+ "0x2ab97e8d59eee648ab6caf8696f89937143864d6": "3820000000000000000000",
+ "0x79c130c762b8765b19d2abc9a083ab8f3aad7940": "3940000000000000000000",
+ "0xf9650d6989f199ab1cc479636ded30f241021f65": "850000000000000000000",
+ "0xd1c96e70f05ae0e6cd6021b2083750a7717cde56": "500000000000000000000",
+ "0x88106c27d20b74b4b98ca62b232bd5c97411171f": "197000000000000000000",
+ "0x37ab66083a4fa23848b886f9e66d79cdc150cc70": "88510000000000000000000",
+ "0x8e6156336be2cdbe32140df08a2ba55fd0a58463": "74480000000000000000",
+ "0x2982d76a15f847dd41f1922af368fe678d0e681e": "100000000000000000000",
+ "0x209e8e29d33beae8fb6baa783d133e1d9ec1bc0b": "835000000000000000000",
+ "0xb325674c01e3f7290d5226339fbeac67d221279f": "2800000000000000000000",
+ "0xf20c9a99b74759d782f25c1ceca802a27e0b436c": "1670000000000000000000",
+ "0x61bf84d5ab026f58c873f86ff0dfca82b55733ae": "2000000000000000000000",
+ "0x0734a0a81c9562f4d9e9e10a8503da15db46d76e": "18200000000000000000",
+ "0x0521bc3a9f8711fecb10f50797d71083e341eb9d": "20000000000000000000",
+ "0x3301d9ca2f3bfe026279cd6819f79a293d98156e": "50000000000000000000000",
+ "0x549d51af29f724c967f59423b85b2681e7b15136": "3760000000000000000000",
+ "0x2053ac97548a0c4e8b80bc72590cd6a098fe7516": "187000000000000000000",
+ "0xaa321fdbd449180db8ddd34f0fe906ec18ee0914": "685000000000000000000",
+ "0x697f55536bf85ada51841f0287623a9f0ed09a17": "10000000000000000000000",
+ "0xdf57353aaff2aadb0a04f9014e8da7884e86589c": "152800000000000000000",
+ "0x6807ddc88db489b033e6b2f9a81553571ab3c805": "29944000000000000000",
+ "0x90057af9aa66307ec9f033b29724d3b2f41eb6f9": "121930000000000000000000",
+ "0x3ff836b6f57b901b440c30e4dbd065cf37d3d48c": "200000000000000000000",
+ "0x91051764af6b808e4212c77e30a5572eaa317070": "1000000000000000000000",
+ "0x7faa30c31519b584e97250ed2a3cf3385ed5fd50": "2000000000000000000000",
+ "0xfb842ca2c5ef133917a236a0d4ac40690110b038": "306000000000000000000",
+ "0xaa167026d39ab7a85635944ed9edb2bfeba11850": "8298000000000000000000",
+ "0x57beea716cbd81700a73d67f9ff039529c2d9025": "200000000000000000000",
+ "0x654b7e808799a83d7287c67706f2abf49a496404": "1970000000000000000000",
+ "0xdde8f0c31b7415511dced1cd7d46323e4bd12232": "1610000000000000000000",
+ "0x8667fa1155fed732cfb8dca5a0d765ce0d0705ed": "81770000000000000000",
+ "0x905526568ac123afc0e84aa715124febe83dc87c": "17900000000000000000",
+ "0x8e98766524b0cf2747c50dd43b9567594d9731de": "1997200000000000000000",
+ "0xc6df2075ebd240d44869c2be6bdf82e63d4ef1f5": "20000000000000000000",
+ "0x2ff5cab12c0d957fd333f382eeb75107a64cb8e8": "10000000000000000000000",
+ "0x3055efd26029e0d11b930df4f53b162c8c3fd2ce": "499938000000000000000",
+ "0xb2c53efa33fe4a3a1a80205c73ec3b1dbcad0602": "1918595000000000000000",
+ "0x766b3759e8794e926dac473d913a8fb61ad0c2c9": "86500000000000000000",
+ "0x882aa798bf41df179f85520130f15ccdf59b5e58": "2000000000000000000000",
+ "0x80b23d380b825c46e0393899a85556462da0e18c": "2000000000000000000000",
+ "0x51f4663ab44ff79345f427a0f6f8a6c8a53ff234": "20000000000000000000000",
+ "0x8d5ef172bf77315ea64e85d0061986c794c6f519": "3940000000000000000000",
+ "0x75ac547017134c04ae1e11d60e63ec04d18db4ef": "6000000000000000000000",
+ "0xce1b0cb46aaecfd79b880cad0f2dda8a8dedd0b1": "20000000000000000000",
+ "0x21408b4d7a2c0e6eca4143f2cacdbbccba121bd8": "20000000000000000000000",
+ "0x9c526a140683edf1431cfaa128a935e2b614d88b": "111000000000000000000",
+ "0x599728a78618d1a17b9e34e0fed8e857d5c40622": "14000000000000000000000",
+ "0x6ac4d4be2db0d99da3faaaf7525af282051d6a90": "80185000000000000000",
+ "0x785c8ea774d73044a734fa790a1b1e743e77ed7c": "238750000000000000000",
+ "0xff2726294148b86c78a9372497e459898ed3fee3": "1970000000000000000000",
+ "0x68a86c402388fddc59028fec7021e98cbf830eac": "19100000000000000000",
+ "0x6121af398a5b2da69f65c6381aec88ce9cc6441f": "640000000000000000000",
+ "0x5a6686b0f17e07edfc59b759c77d5bef164d3879": "1490000000000000000000",
+ "0xa2d38de1c73906f6a7ca6efeb97cf6f69cc421be": "1000000000000000000000",
+ "0xae3f98a443efe00f3e711d525d9894dc9a61157b": "295500000000000000000",
+ "0x5f1c8a04c90d735b8a152909aeae636fb0ce1665": "6999974000000000000000",
+ "0xd687cec0059087fdc713d4d2d65e77daefedc15f": "60000000000000000000",
+ "0x845203750f7148a9aa262921e86d43bf641974fd": "100000000000000000000",
+ "0x64464a6805b462412a901d2db8174b06c22deea6": "475600000000000000000",
+ "0x053471cd9a41925b3904a5a8ffca3659e034be23": "199600000000000000000",
+ "0x911ff233e1a211c0172c92b46cf997030582c83a": "1970000000000000000000",
+ "0xd930b27a78876485d0f48b70dd5336549679ca8f": "40000000000000000000",
+ "0x6ba9b21b35106be159d1c1c2657ac56cd29ffd44": "4480000000000000000000",
+ "0xebac2b4408ef5431a13b8508e86250982114e145": "4000000000000000000000",
+ "0x931df34d1225bcd4224e63680d5c4c09bce735a6": "68000000000000000000",
+ "0x23eb6fd85671a9063ab7678ebe265a20f61a02b3": "2000000000000000000000",
+ "0xb32af3d3e8d075344926546f2e32887bf93b16bd": "200000000000000000000",
+ "0x8261fa230c901d43ff579f4780d399f31e6076bc": "2000000000000000000000",
+ "0x84a74ceecff65cb93b2f949d773ef1ad7fb4a245": "92998000000000000000",
+ "0xda982e9643ffece723075a40fe776e5ace04b29b": "160884000000000000000",
+ "0xba70e8b4759c0c3c82cc00ac4e9a94dd5bafb2b8": "890342000000000000000",
+ "0x82f2e991fd324c5f5d17768e9f61335db6319d6c": "500000000000000000000",
+ "0x3e84b35c5b2265507061d30b6f12da033fe6f8b9": "1790000000000000000000",
+ "0x2895e80999d406ad592e2b262737d35f7db4b699": "1940000000000000000000",
+ "0x65f534346d2ffb787fa9cf185d745ba42986bd6e": "500000000000000000000",
+ "0xc7368b9709a5c1b51c0adf187a65df14e12b7dba": "9489681000000000000000",
+ "0xba176dbe3249e345cd4fa967c0ed13b24c47e586": "399990000000000000000",
+ "0xcff6a6fe3e9a922a12f21faa038156918c4fcb9c": "78800000000000000000",
+ "0xbcbd31252ec288f91e298cd812c92160e738331a": "1975802000000000000000",
+ "0x5543dd6d169eec8a213bbf7a8af9ffd15d4ff759": "18200000000000000000",
+ "0xb65bd780c7434115162027565223f44e5498ff8c": "19999800000000000000000",
+ "0x4cadf573ce4ceec78b8e1b21b0ed78eb113b2c0e": "2000000000000000000000",
+ "0x04aafc8ae5ce6f4903c89d7fac9cb19512224777": "500000000000000000000",
+ "0xfdc4d4765a942f5bf96931a9e8cc7ab8b757ff4c": "87000000000000000000000",
+ "0x38c7851f5ffd4cee98df30f3b25597af8a6ca263": "2631920000000000000000",
+ "0x0e320219838e859b2f9f18b72e3d4073ca50b37d": "2000000000000000000000",
+ "0xbbbf39b1b67995a42241504f9703d2a14a515696": "1580000000000000000000",
+ "0x5b800bfd1b3ed4a57d875aed26d42f1a7708d72a": "6392000000000000000000",
+ "0x5b85e60e2af0544f2f01c64e2032900ebd38a3c7": "2000000000000000000000",
+ "0xc9ac01c3fb0929033f0ccc7e1acfeaaba7945d47": "12459235000000000000000",
+ "0xf355d3ec0cfb907d8dbb1bf3464e458128190bac": "4925600000000000000000",
+ "0x69c08d744754de709ce96e15ae0d1d395b3a2263": "1000000000000000000000",
+ "0xcef77451dfa2c643e00b156d6c6ff84e2373eb66": "188000000000000000000",
+ "0xf3034367f87d24d3077fa9a2e38a8b0ccb1104ef": "1000000000000000000000",
+ "0x73473e72115110d0c3f11708f86e77be2bb0983c": "20000000000000000000",
+ "0x761e6caec189c230a162ec006530193e67cf9d19": "2000000000000000000000",
+ "0xe9caf827be9d607915b365c83f0d3b7ea8c79b50": "3000000000000000000000",
+ "0xeda4b2fa59d684b27a810df8978a73df308a63c2": "4000000000000000000000",
+ "0x065ff575fd9c16d3cb6fd68ffc8f483fc32ec835": "200000000000000000000",
+ "0xa72ee666c4b35e82a506808b443cebd5c632c7dd": "800000000000000000000",
+ "0x5b30608c678e1ac464a8994c3b33e5cdf3497112": "400000000000000000000",
+ "0xb0c7ce4c0dc3c2bbb99cc1857b8a455f611711ce": "4000000000000000000000",
+ "0xd7274d50804d9c77da93fa480156efe57ba501de": "1940000000000000000000",
+ "0xa609c26dd350c235e44b2b9c1dddccd0a9d9f837": "1000000000000000000000",
+ "0xbddfa34d0ebf1b04af53b99b82494a9e3d8aa100": "12000000000000000000000",
+ "0xfd40242bb34a70855ef0fd90f3802dec2136b327": "1930600000000000000000",
+ "0x58aed6674affd9f64233272a578dd9386b99c263": "3400000000000000000000",
+ "0x24434a3e32e54ecf272fe3470b5f6f512f675520": "5910000000000000000000",
+ "0xa379a5070c503d2fac89b8b3afa080fd45ed4bec": "19700000000000000000000",
+ "0x37e169a93808d8035698f815c7235613c1e659f2": "1000000000000000000000",
+ "0x849b116f596301c5d8bb62e0e97a8248126e39f3": "300000000000000000000",
+ "0xfe7011b698bf3371132d7445b19eb5b094356aee": "2000000000000000000000",
+ "0xf16de1891d8196461395f9b136265b3b9546f6ef": "31313000000000000000",
+ "0x6c6564e5c9c24eaaa744c9c7c968c9e2c9f1fbae": "1357800000000000000000",
+ "0x8bb0212f3295e029cab1d961b04133a1809e7b91": "2000000000000000000000",
+ "0x408a69a40715e1b313e1354e600800a1e6dc02a5": "35144000000000000000",
+ "0xddf0cce1fe996d917635f00712f4052091dff9ea": "2000000000000000000000",
+ "0x50fef296955588caae74c62ec32a23a454e09ab8": "1201200000000000000000",
+ "0xd913f0771949753c4726acaa2bd3619c5c20ff77": "3000000000000000000000",
+ "0x9d6ecfa03af2c6e144b7c4692a86951e902e9e1f": "3000310000000000000000",
+ "0xecbe5e1c9ad2b1dccf0a305fc9522f4669dd3ae7": "5000000000000000000000",
+ "0x33e9b71823952e1f66958c278fc28b1196a6c5a4": "100000000000000000000",
+ "0x9de20bc37e7f48a80ffd7ad84ffbf1a1abe1738c": "200000000000000000000",
+ "0x16f313cf8ad000914a0a176dc6a4342b79ec2538": "2000000000000000000000",
+ "0x991ac7ca7097115f26205eee0ef7d41eb4e311ae": "20000000000000000000",
+ "0xddfafdbc7c90f1320e54b98f374617fbd01d109f": "13370000000000000000",
+ "0x26b11d066588ce74a572a85a6328739212aa8b40": "2000000000000000000000",
+ "0xef2c34bb487d3762c3cca782ccdd7a8fbb0a9931": "180000000000000000000",
+ "0xa9be88ad1e518b0bbb024ab1d8f0e73f790e0c76": "2800000000000000000000",
+ "0x4a7494cce44855cc80582842be958a0d1c0072ee": "2400000000000000000000",
+ "0x23569542c97d566018c907acfcf391d14067e87e": "2000000000000000000000",
+ "0xd252960b0bf6b2848fdead80136db5f507f8be02": "2000000000000000000000",
+ "0x2c0f5b9df43625798e7e03c1a5fd6a6d091af82b": "31200000000000000000",
+ "0xa7c9d388ebd873e66b1713448397d0f37f8bd3a8": "5000000000000000000000",
+ "0x3259bd2fddfbbc6fbad3b6e874f0bbc02cda18b5": "11886645000000000000000",
+ "0xf287ff52f461117adb3e1daa71932d1493c65f2e": "3640000000000000000000",
+ "0xc852428d2b586497acd30c56aa13fb5582f84402": "945600000000000000000",
+ "0x296f00de1dc3bb01d47a8ccd1e5d1dd9a1eb7791": "1000000000000000000000",
+ "0x817493cd9bc623702a24a56f9f82e3fd48f3cd31": "2920000000000000000000",
+ "0x7adfedb06d91f3cc7390450b85550270883c7bb7": "322312000000000000000",
+ "0x8d544c32c07fd0842c761d53a897d6c950bb7599": "200000000000000000000",
+ "0x86297d730fe0f7a9ee24e08fb1087b31adb306a7": "2000000000000000000000",
+ "0xf64fe0939a8d1eea2a0ecd9a9730fd7958e33109": "20600000000000000000",
+ "0xb06eab09a610c6a53d56a946b2c43487ac1d5b2d": "1000000000000000000000",
+ "0xbae9b82f7299631408659dd74e891cb8f3860fe5": "1970000000000000000000",
+ "0x0eda80f4ed074aea697aeddf283b63dbca3dc4da": "2000000000000000000000",
+ "0xea686c5057093c171c66db99e01b0ececb308683": "384907000000000000000",
+ "0x425725c0f08f0811f5f006eec91c5c5c126b12ae": "150000000000000000000",
+ "0xb18e67a5050a1dc9fb190919a33da838ef445014": "20000000000000000000",
+ "0x8dd484ff8a307364eb66c525a571aac701c5c318": "4000000000000000000000",
+ "0x6671b182c9f741a0cd3c356c73c23126d4f9e6f4": "200000000000000000000",
+ "0xba0249e01d945bef93ee5ec61925e03c5ca509fd": "4000000000000000000000",
+ "0xb2968f7d35f208871631c6687b3f3daeabc6616c": "156060000000000000000",
+ "0xa6f62b8a3d7f11220701ab9ffffcb327959a2785": "506000000000000000000",
+ "0xc885a18aabf4541b7b7b7ecd30f6fae6869d9569": "2000000000000000000000",
+ "0x33fb577a4d214fe010d32cca7c3eeda63f87ceef": "1000000000000000000000",
+ "0xbe86d0b0438419ceb1a038319237ba5206d72e46": "999942000000000000000",
+ "0x466292f0e80d43a78774277590a9eb45961214f4": "970000000000000000000",
+ "0xb33c0323fbf9c26c1d8ac44ef74391d0804696da": "20000000000000000000",
+ "0xf7bc4c44910d5aedd66ed2355538a6b193c361ec": "96980000000000000000",
+ "0xd0f04f52109aebec9a7b1e9332761e9fe2b97bb5": "4000000000000000000000",
+ "0xcb4a914d2bb029f32e5fef5c234c4fec2d2dd577": "1800000000000000000000",
+ "0x2e619f57abc1e987aa936ae3a2264962e7eb2d9a": "756000000000000000000",
+ "0x166bf6dab22d841b486c38e7ba6ab33a1487ed8c": "20000000000000000000000",
+ "0xc3a046e3d2b2bf681488826e32d9c061518cfe8c": "2600000000000000000000",
+ "0xd082275f745a2cac0276fbdb02d4b2a3ab1711fe": "30000000000000000000",
+ "0xa701df79f594901afe1444485e6b20c3bda2b9b3": "1000000000000000000000",
+ "0xdec3eec2640a752c466e2b7e7ee685afe9ac41f4": "1324245000000000000000",
+ "0x8134dd1c9df0d6c8a5812426bb55c761ca831f08": "122360000000000000000",
+ "0xbfc57aa666fae28e9f107a49cb5089a4e22151dd": "1000000000000000000000",
+ "0xc3c2297329a6fd99117e54fc6af379b4d556547e": "6000000000000000000000",
+ "0x40585200683a403901372912a89834aadcb55fdb": "2000000000000000000000",
+ "0xcd49bf185e70d04507999f92a4de4455312827d0": "1000000000000000000000",
+ "0x9c6bc9a46b03ae5404f043dfcf21883e4110cc33": "200000000000000000000",
+ "0x1f49b86d0d3945590698a6aaf1673c37755ca80d": "700000000000000000000",
+ "0xefeb1997aad277cc33430e6111ed0943594048b8": "2000000000000000000000",
+ "0x7c0883054c2d02bc7a852b1f86c42777d0d5c856": "500000000000000000000",
+ "0xff49a775814ec00051a795a875de24592ea400d4": "200000000000000000000000",
+ "0xf039683d7b3d225bc7d8dfadef63163441be41e2": "34380000000000000000",
+ "0xa3ba0d3a3617b1e31b4e422ce269e873828d5d69": "850000000000000000000",
+ "0xd116f3dcd5db744bd008887687aa0ec9fd7292aa": "1000000000000000000000",
+ "0x5719f49b720da68856f4b9e708f25645bdbc4b41": "640000000000000000000",
+ "0x870796abc0db84af82da52a0ed68734de7e636f5": "300000000000000000000",
+ "0x68b6854788a7c6496cdbf5f84b9ec5ef392b78bb": "19700000000000000000000",
+ "0x8c2fbeee8eacc5c5d77c16abd462ee9c8145f34b": "1940000000000000000000",
+ "0x421684baa9c0b4b5f55338e6f6e7c8e146d41cb7": "1500000000000000000000",
+ "0xdd26b429fd43d84ec179825324bad5bfb916b360": "5142000000000000000000",
+ "0x3821862493242c0aeb84b90de05d250c1e50c074": "322200000000000000000",
+ "0x68a7425fe09eb28cf86eb1793e41b211e57bd68d": "668500000000000000000",
+ "0xda875e4e2f3cabe4f37e0eaed7d1f6dcc6ffef43": "2000000000000000000000",
+ "0xc2663f8145dbfec6c646fc5c49961345de1c9f11": "690000000000000000000",
+ "0xe89c22f1a4e1d4746ecfaa59ed386fee12d51e37": "44932000000000000000",
+ "0xeff86b5123bcdc17ed4ce8e05b7e12e51393a1f7": "500000000000000000000",
+ "0x6c3d18704126aa99ee3342ce60f5d4c85f1867cd": "50000000000000000000",
+ "0xb8d531a964bcea13829620c0ced72422dadb4cca": "169990000000000000000",
+ "0x7c29d47d57a733f56b9b217063b513dc3b315923": "4000000000000000000000",
+ "0xbc1e80c181616342ebb3fb3992072f1b28b802c6": "4000000000000000000000",
+ "0x31313ffd635bf2f3324841a88c07ed146144ceeb": "1970000000000000000000",
+ "0xcc4feb72df98ff35a138e01761d1203f9b7edf0a": "7000000000000000000000",
+ "0x741693c30376508513082020cc2b63e9fa92131b": "1200000000000000000000",
+ "0xaa3135cb54f102cbefe09e96103a1a796718ff54": "57800000000000000000",
+ "0xef61155ba009dcdebef10b28d9da3d1bc6c9ced4": "59100000000000000000",
+ "0xb3c94811e7175b148b281c1a845bfc9bb6fbc115": "200000000000000000000",
+ "0x96d9cca8f55eea0040ec6eb348a1774b95d93ef4": "4000000000000000000000",
+ "0xce62125adec3370ac52110953a4e760be9451e3b": "152000000000000000000",
+ "0xaca1e6bc64cc3180f620e94dc5b1bcfd8158e45d": "2000000000000000000000",
+ "0xbc237148d30c13836ffa2cad520ee4d2e5c4eeff": "1970000000000000000000",
+ "0x0e024e7f029c6aaf3a8b910f5e080873b85795aa": "1000000000000000000000",
+ "0x7283cd4675da58c496556151dafd80c7f995d318": "760000000000000000000",
+ "0x39b299327490d72f9a9edff11b83afd0e9d3c450": "200000000000000000000",
+ "0x5f333a3b2310765a0d1832b9be4c0a03704c1c09": "1000000000000000000000",
+ "0x5aaf1c31254a6e005fba7f5ab0ec79d7fc2b630e": "5910000000000000000000",
+ "0x833db42c14163c7be4cab86ac593e06266d699d5": "174212000000000000000000",
+ "0xf32d25eb0ea2b8b3028a4c7a155dc1aae865784d": "5710684000000000000000",
+ "0x1fa2319fed8c2d462adf2e17feec6a6f30516e95": "125300000000000000000",
+ "0xc49cfaa967f3afbf55031061fc4cef88f85da584": "2000000000000000000000",
+ "0x43db7ff95a086d28ebbfb82fb8fb5f230a5ebccd": "16100000000000000000",
+ "0xcf3f9128b07203a3e10d7d5755c0c4abc6e2cac2": "5000000000000000000000",
+ "0x8f4d1e7e4561284a34fef9673c0d34e12af4aa03": "2000000000000000000000",
+ "0x934af21b7ebfa467e2ced65aa34edd3a0ec71332": "35420000000000000000000",
+ "0x5d231a70c1dfeb360abd97f616e2d10d39f3cab5": "400000000000000000000",
+ "0x2d5d7335acb0362b47dfa3a8a4d3f5949544d380": "200000000000000000000",
+ "0xd1e1f2b9c16c309874dee7fac32675aff129c398": "72800000000000000000",
+ "0xa43b6da6cb7aac571dff27f09d39f846f53769b1": "380000000000000000000",
+ "0x779274bf1803a336e4d3b00ddd93f2d4f5f4a62e": "1000000000000000000000",
+ "0xa644ed922cc237a3e5c4979a995477f36e50bc62": "583900000000000000000",
+ "0xee6c03429969ca1262cb3f0a4a54afa7d348d7f5": "256100000000000000000",
+ "0x4f06246b8d4bd29661f43e93762201d286935ab1": "4818730000000000000000",
+ "0xe04972a83ca4112bc871c72d4ae1616c2f0728db": "267606000000000000000",
+ "0xdf098f5e4e3dffa51af237bda8652c4f73ed9ca6": "502000000000000000000",
+ "0xdfded2574b27d1613a7d98b715159b0d00baab28": "20000000000000000000000",
+ "0x17d931d4c56294dcbe77c8655be4695f006d4a3c": "2000000000000000000000",
+ "0x3ccb71aa6880cb0b84012d90e60740ec06acd78f": "2000000000000000000000",
+ "0xe57d2995b0ebdf3f3ca6c015eb04260dbb98b7c6": "2000000000000000000000",
+ "0xfb3860f4121c432ebdc8ec6a0331b1b709792e90": "600400000000000000000",
+ "0xfa00c376e89c05e887817a9dd0748d96f341aa89": "300700000000000000000",
+ "0xc7a018f0968a51d1f6603c5c49dc545bcb0ff293": "4000000000000000000000",
+ "0x7d73863038ccca22f96affda10496e51e1e6cd48": "20000000000000000000",
+ "0x38ea6f5b5a7b88417551b4123dc127dfe9342da6": "400000000000000000000",
+ "0x014b7f67b14f5d983d87014f570c8b993b9872b5": "200000000000000000000",
+ "0x8ac89bd9b8301e6b0677fa25fcf0f58f0cc7b611": "20000000000000000000",
+ "0x7eb4b0185c92b6439a08e7322168cb353c8a774a": "10165988000000000000000",
+ "0xd29dc08efbb3d72e263f78ab7610d0226de76b00": "12000000000000000000000",
+ "0x72a8260826294726a75bf39cd9aa9e07a3ea14cd": "2000000000000000000000",
+ "0x4cb5c6cd713ca447b848ae2f56b761ca14d7ad57": "267400000000000000000",
+ "0x49185dd7c23632f46c759473ebae966008cd3598": "254030000000000000000",
+ "0x13d67a7e25f2b12cdb85585009f8acc49b967301": "1999944000000000000000",
+ "0x9d913b5d339c95d87745562563fea98b23c60cc4": "170718000000000000000",
+ "0xabdc9f1bcf4d19ee96591030e772c334302f7d83": "40110000000000000000000",
+ "0xe9a5ae3c9e05977dd1069e9fd9d3aefbae04b8df": "1970000000000000000000",
+ "0x1fd296be03ad737c92f9c6869e8d80a71c5714aa": "13370000000000000000",
+ "0x2f13657526b177cad547c3908c840eff647b45d9": "1170685000000000000000",
+ "0xe69fcc26ed225f7b2e379834c524d70c1735e5bc": "2000000000000000000000",
+ "0xbade43599e02f84f4c3014571c976b13a36c65ab": "4000000000000000000000",
+ "0x184a4f0beb71ffd558a6b6e8f228b78796c4cf3e": "12000000000000000000000",
+ "0xd1de5aad3a5fd803f1b1aeb6103cb8e14fe723b7": "20000000000000000000",
+ "0x0bd67dbde07a856ebd893b5edc4f3a5be4202616": "2000000000000000000000",
+ "0x6b30f1823910b86d3acb5a6afc9defb6f3a30bf8": "4200000000000000000000",
+ "0x9a63d185a79129fdab19b58bb631ea36a420544e": "42000000000000000000",
+ "0xdf660a91dab9f730f6190d50c8390561500756ca": "2000000000000000000000",
+ "0xa1a1f0fa6d20b50a794f02ef52085c9d036aa6ca": "1000000000000000000000",
+ "0x4ec768295eeabafc42958415e22be216cde77618": "59600000000000000000",
+ "0xc348fc5a461323b57be303cb89361b991913df28": "100000000000000000000000",
+ "0x3a7db224acae17de7798797d82cdf8253017dfa8": "5000000000000000000000",
+ "0x8bea40379347a5c891d59a6363315640f5a7e07a": "1999992000000000000000",
+ "0x2257fca16a6e5c2a647c3c29f36ce229ab93b17e": "4000000000000000000000",
+ "0xe492818aa684e5a676561b725d42f3cc56ae5198": "800000000000000000000",
+ "0xc841884fa4785fb773b28e9715fae99a5134305d": "2000000000000000000000",
+ "0x0d9443a79468a5bbf7c13c6e225d1de91aee07df": "70000000000000000000",
+ "0x6d4008b4a888a826f248ee6a0b0dfde9f93210b9": "5460000000000000000000",
+ "0x884980eb4565c1048317a8f47fdbb461965be481": "3999922000000000000000",
+ "0x985d70d207892bed398590024e2421b1cc119359": "20000000000000000000000",
+ "0xd9ec8fe69b7716c0865af888a11b2b12f720ed33": "4000000000000000000000",
+ "0x49b74e169265f01a89ec4c9072c5a4cd72e4e835": "16100000000000000000000",
+ "0x4c3e95cc3957d252ce0bf0c87d5b4f2234672e70": "2500000000000000000000",
+ "0xd9ff115d01266c9f73b063c1c238ef3565e63b36": "680000000000000000000",
+ "0x48c5c6970b9161bb1c7b7adfed9cdede8a1ba864": "4000000000000000000000",
+ "0xea6afe2cc928ac8391eb1e165fc40040e37421e7": "2997569000000000000000",
+ "0x08ccda50e4b26a0ffc0ef92e9205310706bec2c7": "6077440000000000000000",
+ "0xe6e9a39d750fe994394eb68286e5ea62a6997882": "600000000000000000000",
+ "0x4b58101f44f7e389e12d471d1635b71614fdd605": "160000000000000000000",
+ "0x8d93dac785f88f1a84bf927d53652b45a154ccdd": "158000000000000000000",
+ "0x415d096ab06293183f3c033d25f6cf7178ac3bc7": "40000000000000000000",
+ "0xc3e387b03ce95ccfd7fa51dd840183bc43532809": "2000000000000000000000",
+ "0xda34b2eae30bafe8daeccde819a794cd89e09549": "2000000000000000000000",
+ "0xfa279bfd8767f956bf7fa0bd5660168da75686bd": "2674000000000000000000",
+ "0xb98ca31785ef06be49a1e47e864f60d076ca472e": "4000000000000000000000",
+ "0xb768b5234eba3a9968b34d6ddb481c8419b3655d": "14974000000000000000",
+ "0x31047d703f63b93424fbbd6e2f1f9e74de13e709": "2850123000000000000000",
+ "0x9a24ce8d485cc4c86e49deb39022f92c7430e67e": "1300000000000000000000",
+ "0xe62f9d7c64e8e2635aeb883dd73ba684ee7c1079": "8000000000000000000000",
+ "0xf15d9d5a21b1929e790371a17f16d95f0c69655c": "2000000000000000000000",
+ "0x285ae51b9500c58d541365d97569f14bb2a3709b": "2000000000000000000000",
+ "0x09c177f1ae442411ddacf187d46db956148360e7": "8950000000000000000000",
+ "0x12173074980153aeaa4b0dcbc7132eadcec21b64": "240000000000000000000",
+ "0x351f16e5e0735af56751b0e225b2421171394090": "13370000000000000000000",
+ "0xac52b77e15664814f39e4f271be641308d91d6cc": "220000000000000000000",
+ "0x99c883258546cc7e4e971f522e389918da5ea63a": "4000000000000000000000",
+ "0xaa16269aac9c0d803068d82fc79151dadd334b66": "4000000000000000000000",
+ "0x7c9a110cb11f2598b2b20e2ca400325e41e9db33": "26000000000000000000000",
+ "0x583e83ba55e67e13e0e76f8392d873cd21fbf798": "20000000000000000000",
+ "0x555ebe84daa42ba256ea789105cec4b693f12f18": "100000000000000000000",
+ "0x978c430ce4359b06bc2cdf5c2985fc950e50d5c8": "480000000000000000000",
+ "0xdc1eb9b6e64351f56424509645f83e79eee76cf4": "4000000000000000000000",
+ "0x5b290c01967c812e4dc4c90b174c1b4015bae71e": "149946000000000000000",
+ "0xe7d213947fcb904ad738480b1eed2f5c329f27e8": "18718000000000000000",
+ "0xc517d0315c878813c717e18cafa1eab2654e01da": "10000000000000000000000",
+ "0x7e972a8a7c2a44c93b21436c38d21b9252c345fe": "1790000000000000000000",
+ "0x9cb28ac1a20a106f7f373692c5ce4c73f13732a1": "1000000000000000000000",
+ "0x14ab164b3b524c82d6abfbc0de831126ae8d1375": "2000000000000000000000",
+ "0xd46f8223452982a1eea019a8816efc2d6fc00768": "137000000000000000000",
+ "0x5cdc4708f14f40dcc15a795f7dc8cb0b7faa9e6e": "537000000000000000000",
+ "0x66fdc9fee351fa1538eb0d87d819fcf09e7c106a": "6016500000000000000000",
+ "0xe7be82c6593c1eeddd2ae0b15001ff201ab57b2f": "19100000000000000000",
+ "0x47d20e6ae4cad3f829eac07e5ac97b66fdd56cf5": "1000000000000000000000",
+ "0x0f2d8daf04b5414a0261f549ff6477b80f2f1d07": "200000000000000000000000",
+ "0x84bfcef0491a0ae0694b37ceac024584f2aa0467": "1999944000000000000000",
+ "0xec5feafe210c12bfc9a5d05925a123f1e73fbef8": "456000000000000000000000",
+ "0x7023c70956e04a92d70025aad297b539af355869": "2000000000000000000000",
+ "0xd66ddf1159cf22fd8c7a4bc8d5807756d433c43e": "2200000000000000000000",
+ "0xd0638ea57189a6a699024ad78c71d939c1c2ff8c": "2632000000000000000000",
+ "0x70d25ed2c8ada59c088cf70dd22bf2db93acc18a": "1056600000000000000000",
+ "0xa4875928458ec2005dbb578c5cd33580f0cf1452": "1000000000000000000000",
+ "0xb5ad5157dda921e6bafacd9086ae73ae1f611d3f": "2000000000000000000000",
+ "0xc493489e56c3bdd829007dc2f956412906f76bfa": "48968000000000000000",
+ "0xc57612de91110c482e6f505bcd23f3c5047d1d61": "3580000000000000000000",
+ "0x9b18478655a4851cc906e660feac61f7f4c8bffc": "4174120000000000000000",
+ "0xb21b7979bf7c5ca01fa82dd640b41c39e6c6bc75": "1999944000000000000000",
+ "0xa9d4a2bcbe5b9e0869d70f0fe2e1d6aacd45edc5": "198800000000000000000",
+ "0x6f29bb375be5ed34ed999bb830ee2957dde76d16": "2000000000000000000000",
+ "0xa006268446643ec5e81e7acb3f17f1c351ee2ed9": "4000000000000000000000",
+ "0x42ddd014dc52bfbcc555325a40b516f4866a1dd3": "2000000000000000000000",
+ "0xd6d6776958ee23143a81adadeb08382009e996c2": "3000000000000000000000",
+ "0xd34e03d36a2bd4d19a5fa16218d1d61e3ffa0b15": "320000000000000000000",
+ "0xdac0c177f11c5c3e3e78f2efd663d13221488574": "1000000000000000000000",
+ "0x814135da8f9811075783bf1ab67062af8d3e9f40": "20000000000000000000",
+ "0x7c3eb713c4c9e0381cd8154c7c9a7db8645cde17": "200000000000000000000",
+ "0xf49c47b3efd86b6e6a5bc9418d1f9fec814b69ef": "20000000000000000000000",
+ "0x35f1da127b83376f1b88c82a3359f67a5e67dd50": "1910000000000000000000",
+ "0x44dfba50b829becc5f4f14d1b04aab3320a295e5": "1000000000000000000000",
+ "0x0b924df007e9c0878417cfe63b976ea1a382a897": "40000000000000000000",
+ "0x82438fd2b32a9bdd674b49d8cc5fa2eff9781847": "20000000000000000000",
+ "0x794529d09d017271359730027075b87ad83dae6e": "310000000000000000000",
+ "0xf4b49100757772f33c177b9a76ba95226c8f3dd8": "6700000000000000000000",
+ "0x8563c49361b625e768771c96151dbfbd1c906976": "2000000000000000000000",
+ "0x0b9df80fbe232009dacf0aa8cac59376e2476203": "2000000000000000000000",
+ "0x149b6dbde632c19f5af47cb493114bebd9b03c1f": "12000000000000000000000",
+ "0xd7a1431ee453d1e49a0550d1256879b4f5d10201": "1670000000000000000000",
+ "0x1d37616b793f94911838ac8e19ee9449df921ec4": "1500000000000000000000",
+ "0xd6670c036df754be43dadd8f50feea289d061fd6": "5988459000000000000000",
+ "0x02778e390fa17510a3428af2870c4273547d386c": "16163700000000000000000",
+ "0xb89f4632df5909e58b2a9964f74feb9a3b01e0c5": "21406707000000000000000",
+ "0x76c27535bcb59ce1fa2d8c919cabeb4a6bba01d1": "2000000000000000000000",
+ "0x36bf43ff35df90908824336c9b31ce33067e2f50": "346837200000000000000000",
+ "0xb53bcb174c2518348b818aece020364596466ba3": "2000000000000000000000",
+ "0xb4dd460cd016725a64b22ea4f8e06e06674e033e": "5370000000000000000000",
+ "0xcda1741109c0265b3fb2bf8d5ec9c2b8a3346b63": "20000000000000000000",
+ "0xfeb8b8e2af716ae41fc7c04bcf29540156461e6b": "1555396000000000000000",
+ "0xa49f523aa51364cbc7d995163d34eb590ded2f08": "2659160000000000000000",
+ "0xa7e74f0bdb278ff0a805a648618ec52b166ff1be": "100000000000000000000",
+ "0x5ead29037a12896478b1296ab714e9cb95428c81": "71500000000000000000",
+ "0xcdecf5675433cdb0c2e55a68db5d8bbe78419dd2": "20000000000000000000",
+ "0xc24ccebc2344cce56417fb684cf81613f0f4b9bd": "1550000000000000000000",
+ "0x5a70106f20d63f875265e48e0d35f00e17d02bc9": "20000000000000000000",
+ "0x2606c3b3b4ca1b091498602cb1978bf3b95221c0": "400000000000000000000",
+ "0x1ad4563ea5786be1159935abb0f1d5879c3e7372": "6000000000000000000000",
+ "0xb782bfd1e2de70f467646f9bc09ea5b1fcf450af": "267400000000000000000",
+ "0x649a2b9879cd8fb736e6703b0c7747849796f10f": "7358102000000000000000",
+ "0x1cc1d3c14f0fb8640e36724dc43229d2ea7a1e48": "1700000000000000000000",
+ "0x824b3c3c443e19295d7ef6faa7f374a4798486a8": "20000000000000000000",
+ "0xa7758cecb60e8f614cce96137ef72b4fbd07774a": "500000000000000000000",
+ "0x981f712775c0dad97518ffedcb47b9ad1d6c2762": "6685000000000000000000",
+ "0x26e801b62c827191dd68d31a011990947fd0ebe0": "20000000000000000000",
+ "0x95447046313b2f3a5e19b948fd3b8bedc82c717c": "500000000000000000000",
+ "0x0b701101a4109f9cb360dc57b77442673d5e5983": "2000000000000000000000",
+ "0x5b25cae86dcafa2a60e7723631fc5fa49c1ad87d": "2491200000000000000000",
+ "0xf73ac46c203be1538111b151ec8220c786d84144": "294515000000000000000",
+ "0xe8c3d3b0e17f97d1e756e684f94e1470f99c95a1": "400000000000000000000",
+ "0x8c900a8236b08c2b65405d39d75f20062a7561fd": "1640000000000000000000",
+ "0x43898c49a34d509bfed4f76041ee91caf3aa6aa5": "300000000000000000000",
+ "0xc85325eab2a59b3ed863c86a5f2906a04229ffa9": "465600000000000000000",
+ "0x4a430170152de5172633dd8262d107a0afd96a0f": "3160000000000000000000",
+ "0x6e0ee70612c976287d499ddfa6c0dcc12c06deea": "129980000000000000000",
+ "0x21c07380484f6cbc8724ad32bc864c3b5ad500b7": "1000000000000000000000",
+ "0xff5162f2354dc492c75fd6e3a107268660eecb47": "1700000000000000000000",
+ "0x8845e9f90e96336bac3c616be9d88402683e004c": "2000000000000000000000",
+ "0xf23c7b0cb8cd59b82bd890644a57daf40c85e278": "50038000000000000000",
+ "0x1784948bf99848c89e445638504dd698271b5924": "6037580000000000000000",
+ "0xb39f4c00b2630cab7db7295ef43d47d501e17fd7": "4000000000000000000000",
+ "0x3fb7d197b3ba4fe045efc23d50a14585f558d9b2": "20000000000000000000",
+ "0xbd043b67c63e60f841ccca15b129cdfe6590c8e3": "200000000000000000000",
+ "0x86ca0145957e6b0dfe36875fbe7a0dec55e17a28": "10000000000000000000000",
+ "0xdae7201eab8c063302930d693929d07f95e71962": "2687370000000000000000",
+ "0xcc034985d3f28c2d39b1a34bced4d3b2b6ca234e": "182000000000000000000",
+ "0x40e0dbf3efef9084ea1cd7e503f40b3b4a8443f6": "4000000000000000000000",
+ "0xb1896a37e5d8825a2d01765ae5de629977de8352": "200000000000000000000",
+ "0xd9f547f2c1de0ed98a53d161df57635dd21a00bd": "98500000000000000000",
+ "0x2fea1b2f834f02fc54333f8a809f0438e5870aa9": "20200000000000000000",
+ "0x68b31836a30a016ada157b638ac15da73f18cfde": "26000000000000000000",
+ "0xbc967fe4418c18b99858966d870678dca2b88879": "8740000000000000000000",
+ "0x16bae5d24eff91778cd98b4d3a1cc3162f44aa77": "401100000000000000000",
+ "0xf476e1267f86247cc908816f2e7ad5388c952db0": "4000000000000000000000",
+ "0x0203ae01d4c41cae1865e04b1f5b53cdfaecae31": "1006054000000000000000",
+ "0xbd4bd5b122d8ef7b7c8f0667450320db2116142e": "600000000000000000000",
+ "0xa394ad4fd9e6530e6f5c53faecbede81cb172da1": "5600000000000000000000",
+ "0x3a9960266df6492063538a99f487c950a3a5ec9e": "24000000000000000000000",
+ "0xd8069f84b521493f4715037f3226b25f33b60586": "1910000000000000000000",
+ "0x136c834bf111326d207395295b2e583ea7f33572": "100000000000000000000",
+ "0xc5c73d61cce7c8fe4c8fce29f39092cd193e0fff": "8000000000000000000000",
+ "0x3cfbf066565970639e130df2a7d16b0e14d6091c": "1700000000000000000000",
+ "0x61b905de663fc17386523b3a28e2f7d037a655cd": "500000000000000000000",
+ "0xfda0ce15330707f10bce3201172d2018b9ddea74": "51900000000000000000",
+ "0xf7fc45abf76f5088e2e5b5a8d132f28a4d4ec1c0": "2000000000000000000000",
+ "0xc3db9fb6f46c480af34465d79753b4e2b74a67ce": "20000000000000000000000",
+ "0xebe46cc3c34c32f5add6c3195bb486c4713eb918": "1000000000000000000000",
+ "0x91d2a9ee1a6db20f5317cca7fbe2313895db8ef8": "8499600000000000000000",
+ "0xc4cc45a2b63c27c0b4429e58cd42da59be739bd6": "1000000000000000000000",
+ "0xa43b81f99356c0af141a03010d77bd042c71c1ee": "2000000000000000000000",
+ "0x4c45d4c9a725d11112bfcbca00bf31186ccaadb7": "400000000000000000000",
+ "0xbf9f271f7a7e12e36dd2fe9facebf385fe6142bd": "62760000000000000000",
+ "0xe0ce80a461b648a501fd0b824690c8868b0e4de8": "500000000000000000000",
+ "0xa1f7dde1d738d8cd679ea1ee965bee224be7d04d": "1127000000000000000000",
+ "0x7f1c81ee1697fc144b7c0be5493b5615ae7fddca": "500200000000000000000",
+ "0xb508f987b2de34ae4cf193de85bff61389621f88": "6000000000000000000000",
+ "0x5f26cf34599bc36ea67b9e7a9f9b4330c9d542a3": "1000000000000000000000",
+ "0xd02108d2ae3cab10cbcf1657af223e027c8210f6": "2000140000000000000000",
+ "0x952183cfd38e352e579d36decec5b18450f7fba0": "2000000000000000000000",
+ "0xeb90c793b3539761e1c814a29671148692193eb4": "12000000000000000000000",
+ "0x1076212d4f758c8ec7121c1c7d74254926459284": "35000056000000000000000",
+ "0xf05ceeab65410564709951773c8445ad9f4ec797": "299982000000000000000",
+ "0x05361d8eb6941d4e90fb7e1418a95a32d5257732": "20000000000000000000",
+ "0xa5783bf33432ff82ac498985d7d460ae67ec3673": "1820000000000000000000",
+ "0xb1cd4bdfd104489a026ec99d597307a04279f173": "20000000000000000000000",
+ "0x876c3f218b4776df3ca9dbfb270de152d94ed252": "100000000000000000000",
+ "0x8a36869ad478997cbf6d8924d20a3c8018e9855b": "20000000000000000000",
+ "0xfb3fe09bb836861529d7518da27635f538505615": "1399904000000000000000",
+ "0xd093e829819fd2e25b973800bb3d5841dd152d05": "4000000000000000000000",
+ "0x126d91f7ad86debb0557c612ca276eb7f96d00a1": "100000000000000000000",
+ "0x2a81d27cb6d4770ff4f3c4a3ba18e5e57f07517c": "2000000000000000000000",
+ "0xc4f7b13ac6d4eb4db3d4e6a252af8a07bd5957da": "200000000000000000000",
+ "0x305d26c10bdc103f6b9c21272eb7cb2d9108c47e": "500000000000000000000",
+ "0xd0d0a2ad45f59a9dccc695d85f25ca46ed31a5a3": "840000000000000000000",
+ "0x522323aad71dbc96d85af90f084b99c3f09decb7": "6000000000000000000000",
+ "0xf43da3a4e3f5fab104ca9bc1a0f7f3bb4a56f351": "1999944000000000000000",
+ "0xa2dc65ee256b59a5bd7929774f904b358df3ada1": "21319600000000000000000",
+ "0xf382df583155d8548f3f93440cd5f68cb79d6026": "266619800000000000000000",
+ "0x0c967e3061b87a753e84507eb60986782c8f3013": "100000000000000000000",
+ "0xa3a262afd2936819230892fde84f2d5a594ab283": "1880000000000000000000",
+ "0x93868ddb2a794d02ebda2fa4807c76e3609858dc": "2027851000000000000000",
+ "0xcd35ff010ec501a721a1b2f07a9ca5877dfcf95a": "4011000000000000000000",
+ "0x5824a7e22838277134308c5f4b50dab65e43bb31": "6000000000000000000000",
+ "0x7f7a3a21b3f5a65d81e0fcb7d52dd00a1aa36dba": "100000000000000000000",
+ "0x30513fca9f36fd788cfea7a340e86df98294a244": "447000000000000000000",
+ "0x283e6252b4efcf4654391acb75f903c59b78c5fb": "12000000000000000000000",
+ "0xeddbaafbc21be8f25562f1ed6d05d6afb58f02c2": "2000000000000000000000",
+ "0x0dcfe837ea1cf28c65fccec3bef1f84e59d150c0": "200000000000000000000",
+ "0x828ba651cb930ed9787156299a3de44cd08b7212": "1337000000000000000000",
+ "0xcfd47493c9f89fe680bda5754dd7c9cfe7cb5bbe": "54508000000000000000",
+ "0x0e89eddd3fa0d71d8ab0ff8da5580686e3d4f74f": "2000000000000000000000",
+ "0x205f5166f12440d85762c967d3ae86184f8f4d98": "432500000000000000000",
+ "0x25dad495a11a86b9eeece1eeec805e57f157faff": "16000000000000000000000",
+ "0x6c84cba77c6db4f7f90ef13d5ee21e8cfc7f8314": "2000000000000000000000",
+ "0x91a787bc5196f34857fe0c372f4df376aaa76613": "2000000000000000000000",
+ "0xb0d3c9872b85056ea0c0e6d1ecf7a77e3ce6ab85": "4999711000000000000000",
+ "0x6e4d2e39c8836629e5b487b1918a669aebdd9536": "1000000000000000000000",
+ "0xdc703a5f3794c84d6cb3544918cae14a35c3bd4f": "1850000000000000000000",
+ "0x47beb20f759100542aa93d41118b3211d664920e": "2000000000000000000000",
+ "0x5a7735007d70b06844da9901cdfadb11a2582c2f": "6000000000000000000000",
+ "0xaff107960b7ec34ed690b665024d60838c190f70": "500000000000000000000",
+ "0x563a03ab9c56b600f6d25b660c21e16335517a75": "1000000000000000000000",
+ "0xa106465bbd19e1b6bce50d1b1157dc59095a3630": "2000000000000000000000",
+ "0xca9dec02841adf5cc920576a5187edd2bd434a18": "500000000000000000000",
+ "0x572ac1aba0de23ae41a7cae1dc0842d8abfc103b": "1910000000000000000000",
+ "0x5f74ed0e24ff80d9b2c4a44baa9975428cd6b935": "2980000000000000000000",
+ "0xf2049532fd458a83ca1bff2eebacb6d5ca63f4a4": "3625693000000000000000",
+ "0xcee699c0707a7836252b292f047ce8ad289b2f55": "324700000000000000000",
+ "0x8b3696f3c60de32432a2e4c395ef0303b7e81e75": "30000000000000000000000",
+ "0x13dee03e3799952d0738843d4be8fc0a803fb20e": "2000000000000000000000",
+ "0xc853215b9b9f2d2cd0741e585e987b5fb80c212e": "1550000000000000000000",
+ "0x851c0d62be4635d4777e8035e37e4ba8517c6132": "500000000000000000000",
+ "0xa76b743f981b693072a131b22ba510965c2fefd7": "18200000000000000000",
+ "0x69bd25ade1a3346c59c4e930db2a9d715ef0a27a": "4000000000000000000000",
+ "0x0fec4ee0d7ca180290b6bd20f9992342f60ff68d": "334383000000000000000",
+ "0xccfd725760a68823ff1e062f4cc97e1360e8d997": "399800000000000000000",
+ "0x9f017706b830fb9c30efb0a09f506b9157457534": "2000000000000000000000",
+ "0x420fb86e7d2b51401fc5e8c72015decb4ef8fc2e": "1000000000000000000000",
+ "0xcb7d2b8089e9312cc9aeaa2773f35308ec6c2a7b": "10000000000000000000000",
+ "0x6c822029218ac8e98a260c1e064029348839875b": "5010000000000000000000",
+ "0x1c68a66138783a63c98cc675a9ec77af4598d35e": "50100000000000000000",
+ "0xf270792576f05d514493ffd1f5e84bec4b2df810": "1000000000000000000000",
+ "0x9191f94698210516cf6321a142070e20597674ed": "17194000000000000000",
+ "0xc0ca3277942e7445874be31ceb902972714f1823": "250000000000000000000",
+ "0x35e096120deaa5c1ecb1645e2ccb8b4edbd9299a": "500000000000000000000",
+ "0xe2bbf84641e3541f6c33e6ed683a635a70bde2ec": "502763000000000000000",
+ "0xd12d77ae01a92d35117bac705aacd982d02e74c1": "1000000000000000000000",
+ "0xdabb0889fc042926b05ef57b2520910abc4b4149": "2000000000000000000000",
+ "0x5a1a336962d6e0c63031cc83c6a5c6a6f4478ecb": "1000000000000000000000",
+ "0xabd154903513b8da4f019f68284b0656a1d0169b": "1000000000000000000000",
+ "0xad377cd25eb53e83ae091a0a1d2b4516f484afde": "1940000000000000000000",
+ "0x08c2f236ac4adcd3fda9fbc6e4532253f9da3bec": "20000000000000000000",
+ "0x71135d8f05963c905a4a07922909235a896a52ea": "3000000000000000000000",
+ "0x080546508a3d2682c8b9884f13637b8847b44db3": "2000000000000000000000",
+ "0x2d61bfc56873923c2b00095dc3eaa0f590d8ae0f": "20760000000000000000000",
+ "0xcbfa6af6c283b046e2772c6063b0b21553c40106": "2000000000000000000000",
+ "0xccabc6048a53464424fcf76eeb9e6e1801fa23d4": "49250000000000000000",
+ "0x60cc3d445ebdf76a7d7ae571c6971dff68cc8585": "1000000000000000000000",
+ "0xfff33a3bd36abdbd412707b8e310d6011454a7ae": "8000000000000000000000",
+ "0xd2dbebe89b0357aea98bbe8e496338debb28e805": "4000000000000000000000",
+ "0x5f521282e9b278dc8c034c72af53ee29e5443d78": "6520000000000000000000",
+ "0xc5a48a8500f9b4e22f0eb16c6f4649687674267d": "812721000000000000000",
+ "0x8cb3aa3fcd212854d7578fcc30fdede6742a312a": "300000000000000000000",
+ "0x90d2809ae1d1ffd8f63eda01de49dd552df3d1bc": "3998000000000000000000",
+ "0x96a55f00dff405dc4de5e58c57f6f6f0cac55d2f": "1962711000000000000000",
+ "0xae842e81858ecfedf6506c686dc204ac15bf8b24": "40000000000000000000",
+ "0x0be6a09e4307fe48d412b8d1a1a8284dce486261": "19180000000000000000000",
+ "0xc9c7ac0bdd9342b5ead4360923f68c72a6ba633a": "500000000000000000000",
+ "0xea8f30b6e4c5e65290fb9864259bc5990fa8ee8a": "20000000000000000000",
+ "0x74d37a51747bf8b771bfbf43943933d100d21483": "1000000000000000000000",
+ "0x1a04d5389eb006f9ce880c30d15353f8d11c4b31": "17072800000000000000000",
+ "0x726a14c90e3f84144c765cffacba3e0df11b48be": "10000000000000000000000",
+ "0x86b7bd563ceab686f96244f9ddc02ad7b0b14bc2": "10000000000000000000000",
+ "0x2bbe672a1857508f630f2a5edb563d9e9de92815": "2000000000000000000000",
+ "0xa17070c2e9c5a940a4ec0e4954c4d7d643be8f49": "1999965000000000000000",
+ "0xf2d1b7357724ec4c03185b879b63f57e26589153": "6000000000000000000000",
+ "0xd6a7ac4de7b510f0e8de519d973fa4c01ba83400": "1880000000000000000000",
+ "0x593b45a1864ac5c7e8f0caaeba0d873cd5d113b2": "6000000000000000000000",
+ "0x0837539b5f6a522a482cdcd3a9bb7043af39bdd2": "6000000000000000000000",
+ "0xb927abd2d28aaaa24db31778d27419df8e1b04bb": "27531000000000000000",
+ "0xb2e085fddd1468ba07415b274e734e11237fb2a9": "100000000000000000000",
+ "0x970938522afb5e8f994873c9fbdc26e3b37e314c": "1000000000000000000000",
+ "0xf3de5f26ef6aded6f06d3b911346ee70401da4a0": "354718000000000000000",
+ "0xbffb6929241f788693273e7022e60e3eab1fe84f": "2000000000000000000000",
+ "0xb56ad2aec6c8c3f19e1515bbb7dd91285256b639": "1000000000000000000000",
+ "0x47730f5f8ebf89ac72ef80e46c12195038ecdc49": "3160000000000000000000",
+ "0xf39a9d7aa3581df07ee4279ae6c312ef21033658": "4000000000000000000000",
+ "0x36227cdfa0fd3b9d7e6a744685f5be9aa366a7f0": "198479000000000000000",
+ "0x89e3b59a15864737d493c1d23cc53dbf8dcb1362": "4000000000000000000000",
+ "0xbd08e0cddec097db7901ea819a3d1fd9de8951a2": "20000000000000000000",
+ "0x533444584082eba654e1ad30e149735c6f7ba922": "1730000000000000000000",
+ "0x6a8a4317c45faa0554ccdb482548183e295a24b9": "1000000000000000000000",
+ "0x22ce349159eeb144ef06ff2636588aef79f62832": "188000000000000000000",
+ "0x3cd1d9731bd548c1dd6fcea61beb75d91754f7d3": "5130285000000000000000",
+ "0x8b7056f6abf3b118d026e944d5c073433ca451d7": "999999000000000000000",
+ "0x15f1b352110d68901d8f67aac46a6cfafe031477": "200000000000000000000",
+ "0x0f789e30397c53bf256fc364e6ef39f853504114": "3640000000000000000000",
+ "0x750bbb8c06bbbf240843cc75782ee02f08a97453": "835000000000000000000",
+ "0xfff7ac99c8e4feb60c9750054bdc14ce1857f181": "1000000000000000000000",
+ "0x5c6f36af90ab1a656c6ec8c7d521512762bba3e1": "1999800000000000000000",
+ "0x6811b54cd19663b11b94da1de2448285cd9f68d9": "1100000000000000000000",
+ "0x6f50929777824c291a49c46dc854f379a6bea080": "360000000000000000000",
+ "0xe83604e4ff6be7f96f6018d3ec3072ec525dff6b": "182000000000000000000",
+ "0xd731bb6b5f3c37395e09ceaccd14a918a6060789": "3940000000000000000000",
+ "0x372e453a6b629f27678cc8aeb5e57ce85ec0aef9": "200000000000000000000",
+ "0x86924fb211aad23cf5ce600e0aae806396444087": "10000000000000000000000",
+ "0x18c6723a6753299cb914477d04a3bd218df8c775": "1000000000000000000000",
+ "0xe00484788db50fc6a48e379d123e508b0f6e5ab1": "1000000000000000000000",
+ "0x150e3dbcbcfc84ccf89b73427763a565c23e60d0": "40000000000000000000",
+ "0x8ffa062122ac307418821adb9311075a3703bfa3": "1000000000000000000000",
+ "0x21206ce22ea480e85940d31314e0d64f4e4d3a04": "1000000000000000000000",
+ "0xac024f594f9558f04943618eb0e6b2ee501dc272": "2000000000000000000000",
+ "0xb2b7cdb4ff4b61d5b7ce0b2270bbb5269743ec04": "2000000000000000000000",
+ "0xabc74706964960dfe0dca3dca79e9216056f1cf4": "40000000000000000000000",
+ "0xd7eb903162271c1afa35fe69e37322c8a4d29b11": "10000000000000000000000",
+ "0xd7c6265dea11876c903b718e4cd8ab24fe265bde": "2000000000000000000000",
+ "0xcba288cd3c1eb4d59ddb06a6421c14c345a47b24": "4000000000000000000000",
+ "0x8c22426055b76f11f0a2de1a7f819a619685fe60": "1980000000000000000000",
+ "0xf463a90cb3f13e1f0643423636beab84c123b06d": "40000000000000000000",
+ "0x2b5ced9987c0765f900e49cf9da2d9f9c1138855": "400000000000000000000",
+ "0x9bb760d5c289a3e1db18db095345ca413b9a43c2": "197000000000000000000",
+ "0xd66ab79294074c8b627d842dab41e17dd70c5de5": "1000000000000000000000",
+ "0x0bdd58b96e7c916dd2fb30356f2aebfaaf1d8630": "2000000000000000000000",
+ "0xd612597bc31743c78633f633f239b1e9426bd925": "76000000000000000000000",
+ "0x140518a3194bad1350b8949e650565debe6db315": "2000000000000000000000",
+ "0xdaedd4ad107b271e89486cbf80ebd621dd974578": "2000000000000000000000",
+ "0xc36c0b63bfd75c2f8efb060883d868cccd6cbdb4": "3000000000000000000000",
+ "0xe646665872e40b0d7aa2ff82729caaba5bc3e89e": "400000000000000000000",
+ "0xb5fb7ea2ddc1598b667a9d57dd39e85a38f35d56": "500000000000000000000",
+ "0xe51421f8ee2210c71ed870fe618276c8954afbe9": "1337000000000000000000",
+ "0x08a9a44e1f41de3dbba7a363a3ab412c124cd15e": "200000000000000000000",
+ "0x562bced38ab2ab6c080f3b0541b8456e70824b3f": "641760000000000000000",
+ "0x1e484d0621f0f5331b35d5408d9aae4eb1acf21e": "20000000000000000000",
+ "0x3a476bd2c9e664c63ab266aa4c6e4a4825f516c3": "200000000000000000000",
+ "0x8d6df209484d7b94702b03a53e56b9fb0660f6f0": "2000000000000000000000",
+ "0x5970fb1b144dd751e4ce2eca7caa20e363dc4da3": "10000000000000000000000",
+ "0xd1dd79fb158160e5b4e8e23f312e6a907fbc4d4e": "500000000000000000000",
+ "0x7ee5ca805dce23af89c2d444e7e40766c54c7404": "240660000000000000000",
+ "0x93e0f37ecdfb0086e3e862a97034447b1e4dec1a": "30000000000000000000",
+ "0xe10ac19c546fc2547c61c139f5d1f45a6666d5b0": "4775000000000000000000",
+ "0x1c73d00b6e25d8eb9c1ff4ad827b6b9e9cf6d20c": "200000000000000000000",
+ "0xd771d9e0ca8a08a113775731434eb3270599c40d": "20000000000000000000",
+ "0xe69d1c378b771e0feff051db69d966ac6779f4ed": "553000000000000000000",
+ "0x0ef85b49d08a75198692914eddb4b22cf5fa4450": "2004800000000000000000",
+ "0xed70a37cdd1cbda9746d939658ae2a6181288578": "9600000000000000000000",
+ "0xeee761847e33fd61d99387ee14628694d1bfd525": "2000000000000000000000",
+ "0x271d3d481cb88e7671ad216949b6365e06303de0": "4000000000000000000000",
+ "0x5255dc69155a45b970c604d30047e2f530690e7f": "20000000000000000000",
+ "0xcabab6274ed15089737e287be878b757934864e2": "20000000000000000000000",
+ "0x9defe56a0ff1a1947dba0923f7dd258d8f12fa45": "26880000000000000000000",
+ "0xb7a2c103728b7305b5ae6e961c94ee99c9fe8e2b": "50000000000000000000000",
+ "0xb498bb0f520005b6216a4425b75aa9adc52d622b": "4000000000000000000000",
+ "0xc1132878235c5ddba5d9f3228b5236e47020dc6f": "1000000000000000000000",
+ "0xf81622e55757daea6675975dd93538da7d16991e": "2000000000000000000000",
+ "0xce2deab51c0a9ae09cd212c4fa4cc52b53cc0dec": "2000000000000000000000",
+ "0x86a1eadeeb30461345d9ef6bd05216fa247c0d0c": "2000000000000000000000",
+ "0x7b1fe1ab4dfd0088cdd7f60163ef59ec2aee06f5": "2000000000000000000000",
+ "0x6bbc3f358a668dd1a11f0380f3f73108426abd4a": "4000000000000000000000",
+ "0xb1e6e810c24ab0488de9e01e574837829f7c77d0": "400000000000000000000",
+ "0x03eb3cb860f6028da554d344a2bb5a500ae8b86f": "2000000000000000000000",
+ "0xe5481a7fed42b901bbed20789bd4ade50d5f83b9": "2000000000000000000000",
+ "0x1f3da68fe87eaf43a829ab6d7ec5a6e009b204fb": "554988000000000000000",
+ "0x30037988702671acbe892c03fe5788aa98af287a": "2800000000000000000000",
+ "0xedb473353979a206879de144c10a3c51d7d7081a": "6000000000000000000000",
+ "0x22bdffc240a88ff7431af3bff50e14da37d5183e": "1000000000000000000000",
+ "0x9374869d4a9911ee1eaf558bc4c2b63ec63acfdd": "1000000000000000000000",
+ "0xb756ad52f3bf74a7d24c67471e0887436936504c": "20000000000000000000000",
+ "0x8bd0b65a50ef5cef84fec420be7b89ed1470ceb9": "11999000000000000000000",
+ "0xaf26f7c6bf453e2078f08953e4b28004a2c1e209": "100000000000000000000",
+ "0x7c532db9e0c06c26fd40acc56ac55c1ee92d3c3a": "300000000000000000000000",
+ "0xdde670d01639667576a22dd05d3246d61f06e083": "26740000000000000000",
+ "0x5cf44e10540d65716423b1bcb542d21ff83a94cd": "10000000000000000000000",
+ "0xf96b4c00766f53736a8574f822e6474c2f21da2d": "400000000000000000000",
+ "0x8d89170b92b2be2c08d57c48a7b190a2f146720f": "19700000000000000000000",
+ "0x142b87c5043ffb5a91df18c2e109ced6fe4a71db": "200000000000000000000",
+ "0x42d34940edd2e7005d46e2188e4cfece8311d74d": "158000000000000000000",
+ "0x562105e82b099735de49f62692cc87cd38a8edcd": "6000000000000000000000",
+ "0x457bcef37dd3d60b2dd019e3fe61d46b3f1e7252": "20000000000000000000",
+ "0xcf8882359c0fb23387f5674074d8b17ade512f98": "6000000000000000000000",
+ "0xf0c081da52a9ae36642adf5e08205f05c54168a6": "111000000000000000000",
+ "0x551e7784778ef8e048e495df49f2614f84a4f1dc": "600000000000000000000",
+ "0x3c869c09696523ced824a070414605bb76231ff2": "1000000000000000000000",
+ "0x7e7f18a02eccaa5d61ab8fbf030343c434a25ef7": "66850000000000000000",
+ "0x9328d55ccb3fce531f199382339f0e576ee840a3": "4000000000000000000000",
+ "0x9d0f347e826b7dceaad279060a35c0061ecf334b": "4000000000000000000000",
+ "0x680640838bd07a447b168d6d923b90cf6c43cdca": "1730000000000000000000",
+ "0xc951900c341abbb3bafbf7ee2029377071dbc36a": "327600000000000000000",
+ "0xddf5810a0eb2fb2e32323bb2c99509ab320f24ac": "17900000000000000000000",
+ "0x2489ac126934d4d6a94df08743da7b7691e9798e": "1000000000000000000000",
+ "0xf42f905231c770f0a406f2b768877fb49eee0f21": "197000000000000000000",
+ "0x756f45e3fa69347a9a973a725e3c98bc4db0b5a0": "200000000000000000000"
+}
+
+},{}],598:[function(require,module,exports){
+module.exports={
+ "0x0000000000000000000000000000000000000000": "0x1",
+ "0x0000000000000000000000000000000000000001": "0x1",
+ "0x0000000000000000000000000000000000000002": "0x1",
+ "0x0000000000000000000000000000000000000003": "0x1",
+ "0x0000000000000000000000000000000000000004": "0x1",
+ "0x0000000000000000000000000000000000000005": "0x1",
+ "0x0000000000000000000000000000000000000006": "0x1",
+ "0x0000000000000000000000000000000000000007": "0x1",
+ "0x0000000000000000000000000000000000000008": "0x1",
+ "0x0000000000000000000000000000000000000009": "0x1",
+ "0x000000000000000000000000000000000000000a": "0x1",
+ "0x000000000000000000000000000000000000000b": "0x1",
+ "0x000000000000000000000000000000000000000c": "0x1",
+ "0x000000000000000000000000000000000000000d": "0x1",
+ "0x000000000000000000000000000000000000000e": "0x1",
+ "0x000000000000000000000000000000000000000f": "0x1",
+ "0x0000000000000000000000000000000000000010": "0x1",
+ "0x0000000000000000000000000000000000000011": "0x1",
+ "0x0000000000000000000000000000000000000012": "0x1",
+ "0x0000000000000000000000000000000000000013": "0x1",
+ "0x0000000000000000000000000000000000000014": "0x1",
+ "0x0000000000000000000000000000000000000015": "0x1",
+ "0x0000000000000000000000000000000000000016": "0x1",
+ "0x0000000000000000000000000000000000000017": "0x1",
+ "0x0000000000000000000000000000000000000018": "0x1",
+ "0x0000000000000000000000000000000000000019": "0x1",
+ "0x000000000000000000000000000000000000001a": "0x1",
+ "0x000000000000000000000000000000000000001b": "0x1",
+ "0x000000000000000000000000000000000000001c": "0x1",
+ "0x000000000000000000000000000000000000001d": "0x1",
+ "0x000000000000000000000000000000000000001e": "0x1",
+ "0x000000000000000000000000000000000000001f": "0x1",
+ "0x0000000000000000000000000000000000000020": "0x1",
+ "0x0000000000000000000000000000000000000021": "0x1",
+ "0x0000000000000000000000000000000000000022": "0x1",
+ "0x0000000000000000000000000000000000000023": "0x1",
+ "0x0000000000000000000000000000000000000024": "0x1",
+ "0x0000000000000000000000000000000000000025": "0x1",
+ "0x0000000000000000000000000000000000000026": "0x1",
+ "0x0000000000000000000000000000000000000027": "0x1",
+ "0x0000000000000000000000000000000000000028": "0x1",
+ "0x0000000000000000000000000000000000000029": "0x1",
+ "0x000000000000000000000000000000000000002a": "0x1",
+ "0x000000000000000000000000000000000000002b": "0x1",
+ "0x000000000000000000000000000000000000002c": "0x1",
+ "0x000000000000000000000000000000000000002d": "0x1",
+ "0x000000000000000000000000000000000000002e": "0x1",
+ "0x000000000000000000000000000000000000002f": "0x1",
+ "0x0000000000000000000000000000000000000030": "0x1",
+ "0x0000000000000000000000000000000000000031": "0x1",
+ "0x0000000000000000000000000000000000000032": "0x1",
+ "0x0000000000000000000000000000000000000033": "0x1",
+ "0x0000000000000000000000000000000000000034": "0x1",
+ "0x0000000000000000000000000000000000000035": "0x1",
+ "0x0000000000000000000000000000000000000036": "0x1",
+ "0x0000000000000000000000000000000000000037": "0x1",
+ "0x0000000000000000000000000000000000000038": "0x1",
+ "0x0000000000000000000000000000000000000039": "0x1",
+ "0x000000000000000000000000000000000000003a": "0x1",
+ "0x000000000000000000000000000000000000003b": "0x1",
+ "0x000000000000000000000000000000000000003c": "0x1",
+ "0x000000000000000000000000000000000000003d": "0x1",
+ "0x000000000000000000000000000000000000003e": "0x1",
+ "0x000000000000000000000000000000000000003f": "0x1",
+ "0x0000000000000000000000000000000000000040": "0x1",
+ "0x0000000000000000000000000000000000000041": "0x1",
+ "0x0000000000000000000000000000000000000042": "0x1",
+ "0x0000000000000000000000000000000000000043": "0x1",
+ "0x0000000000000000000000000000000000000044": "0x1",
+ "0x0000000000000000000000000000000000000045": "0x1",
+ "0x0000000000000000000000000000000000000046": "0x1",
+ "0x0000000000000000000000000000000000000047": "0x1",
+ "0x0000000000000000000000000000000000000048": "0x1",
+ "0x0000000000000000000000000000000000000049": "0x1",
+ "0x000000000000000000000000000000000000004a": "0x1",
+ "0x000000000000000000000000000000000000004b": "0x1",
+ "0x000000000000000000000000000000000000004c": "0x1",
+ "0x000000000000000000000000000000000000004d": "0x1",
+ "0x000000000000000000000000000000000000004e": "0x1",
+ "0x000000000000000000000000000000000000004f": "0x1",
+ "0x0000000000000000000000000000000000000050": "0x1",
+ "0x0000000000000000000000000000000000000051": "0x1",
+ "0x0000000000000000000000000000000000000052": "0x1",
+ "0x0000000000000000000000000000000000000053": "0x1",
+ "0x0000000000000000000000000000000000000054": "0x1",
+ "0x0000000000000000000000000000000000000055": "0x1",
+ "0x0000000000000000000000000000000000000056": "0x1",
+ "0x0000000000000000000000000000000000000057": "0x1",
+ "0x0000000000000000000000000000000000000058": "0x1",
+ "0x0000000000000000000000000000000000000059": "0x1",
+ "0x000000000000000000000000000000000000005a": "0x1",
+ "0x000000000000000000000000000000000000005b": "0x1",
+ "0x000000000000000000000000000000000000005c": "0x1",
+ "0x000000000000000000000000000000000000005d": "0x1",
+ "0x000000000000000000000000000000000000005e": "0x1",
+ "0x000000000000000000000000000000000000005f": "0x1",
+ "0x0000000000000000000000000000000000000060": "0x1",
+ "0x0000000000000000000000000000000000000061": "0x1",
+ "0x0000000000000000000000000000000000000062": "0x1",
+ "0x0000000000000000000000000000000000000063": "0x1",
+ "0x0000000000000000000000000000000000000064": "0x1",
+ "0x0000000000000000000000000000000000000065": "0x1",
+ "0x0000000000000000000000000000000000000066": "0x1",
+ "0x0000000000000000000000000000000000000067": "0x1",
+ "0x0000000000000000000000000000000000000068": "0x1",
+ "0x0000000000000000000000000000000000000069": "0x1",
+ "0x000000000000000000000000000000000000006a": "0x1",
+ "0x000000000000000000000000000000000000006b": "0x1",
+ "0x000000000000000000000000000000000000006c": "0x1",
+ "0x000000000000000000000000000000000000006d": "0x1",
+ "0x000000000000000000000000000000000000006e": "0x1",
+ "0x000000000000000000000000000000000000006f": "0x1",
+ "0x0000000000000000000000000000000000000070": "0x1",
+ "0x0000000000000000000000000000000000000071": "0x1",
+ "0x0000000000000000000000000000000000000072": "0x1",
+ "0x0000000000000000000000000000000000000073": "0x1",
+ "0x0000000000000000000000000000000000000074": "0x1",
+ "0x0000000000000000000000000000000000000075": "0x1",
+ "0x0000000000000000000000000000000000000076": "0x1",
+ "0x0000000000000000000000000000000000000077": "0x1",
+ "0x0000000000000000000000000000000000000078": "0x1",
+ "0x0000000000000000000000000000000000000079": "0x1",
+ "0x000000000000000000000000000000000000007a": "0x1",
+ "0x000000000000000000000000000000000000007b": "0x1",
+ "0x000000000000000000000000000000000000007c": "0x1",
+ "0x000000000000000000000000000000000000007d": "0x1",
+ "0x000000000000000000000000000000000000007e": "0x1",
+ "0x000000000000000000000000000000000000007f": "0x1",
+ "0x0000000000000000000000000000000000000080": "0x1",
+ "0x0000000000000000000000000000000000000081": "0x1",
+ "0x0000000000000000000000000000000000000082": "0x1",
+ "0x0000000000000000000000000000000000000083": "0x1",
+ "0x0000000000000000000000000000000000000084": "0x1",
+ "0x0000000000000000000000000000000000000085": "0x1",
+ "0x0000000000000000000000000000000000000086": "0x1",
+ "0x0000000000000000000000000000000000000087": "0x1",
+ "0x0000000000000000000000000000000000000088": "0x1",
+ "0x0000000000000000000000000000000000000089": "0x1",
+ "0x000000000000000000000000000000000000008a": "0x1",
+ "0x000000000000000000000000000000000000008b": "0x1",
+ "0x000000000000000000000000000000000000008c": "0x1",
+ "0x000000000000000000000000000000000000008d": "0x1",
+ "0x000000000000000000000000000000000000008e": "0x1",
+ "0x000000000000000000000000000000000000008f": "0x1",
+ "0x0000000000000000000000000000000000000090": "0x1",
+ "0x0000000000000000000000000000000000000091": "0x1",
+ "0x0000000000000000000000000000000000000092": "0x1",
+ "0x0000000000000000000000000000000000000093": "0x1",
+ "0x0000000000000000000000000000000000000094": "0x1",
+ "0x0000000000000000000000000000000000000095": "0x1",
+ "0x0000000000000000000000000000000000000096": "0x1",
+ "0x0000000000000000000000000000000000000097": "0x1",
+ "0x0000000000000000000000000000000000000098": "0x1",
+ "0x0000000000000000000000000000000000000099": "0x1",
+ "0x000000000000000000000000000000000000009a": "0x1",
+ "0x000000000000000000000000000000000000009b": "0x1",
+ "0x000000000000000000000000000000000000009c": "0x1",
+ "0x000000000000000000000000000000000000009d": "0x1",
+ "0x000000000000000000000000000000000000009e": "0x1",
+ "0x000000000000000000000000000000000000009f": "0x1",
+ "0x00000000000000000000000000000000000000a0": "0x1",
+ "0x00000000000000000000000000000000000000a1": "0x1",
+ "0x00000000000000000000000000000000000000a2": "0x1",
+ "0x00000000000000000000000000000000000000a3": "0x1",
+ "0x00000000000000000000000000000000000000a4": "0x1",
+ "0x00000000000000000000000000000000000000a5": "0x1",
+ "0x00000000000000000000000000000000000000a6": "0x1",
+ "0x00000000000000000000000000000000000000a7": "0x1",
+ "0x00000000000000000000000000000000000000a8": "0x1",
+ "0x00000000000000000000000000000000000000a9": "0x1",
+ "0x00000000000000000000000000000000000000aa": "0x1",
+ "0x00000000000000000000000000000000000000ab": "0x1",
+ "0x00000000000000000000000000000000000000ac": "0x1",
+ "0x00000000000000000000000000000000000000ad": "0x1",
+ "0x00000000000000000000000000000000000000ae": "0x1",
+ "0x00000000000000000000000000000000000000af": "0x1",
+ "0x00000000000000000000000000000000000000b0": "0x1",
+ "0x00000000000000000000000000000000000000b1": "0x1",
+ "0x00000000000000000000000000000000000000b2": "0x1",
+ "0x00000000000000000000000000000000000000b3": "0x1",
+ "0x00000000000000000000000000000000000000b4": "0x1",
+ "0x00000000000000000000000000000000000000b5": "0x1",
+ "0x00000000000000000000000000000000000000b6": "0x1",
+ "0x00000000000000000000000000000000000000b7": "0x1",
+ "0x00000000000000000000000000000000000000b8": "0x1",
+ "0x00000000000000000000000000000000000000b9": "0x1",
+ "0x00000000000000000000000000000000000000ba": "0x1",
+ "0x00000000000000000000000000000000000000bb": "0x1",
+ "0x00000000000000000000000000000000000000bc": "0x1",
+ "0x00000000000000000000000000000000000000bd": "0x1",
+ "0x00000000000000000000000000000000000000be": "0x1",
+ "0x00000000000000000000000000000000000000bf": "0x1",
+ "0x00000000000000000000000000000000000000c0": "0x1",
+ "0x00000000000000000000000000000000000000c1": "0x1",
+ "0x00000000000000000000000000000000000000c2": "0x1",
+ "0x00000000000000000000000000000000000000c3": "0x1",
+ "0x00000000000000000000000000000000000000c4": "0x1",
+ "0x00000000000000000000000000000000000000c5": "0x1",
+ "0x00000000000000000000000000000000000000c6": "0x1",
+ "0x00000000000000000000000000000000000000c7": "0x1",
+ "0x00000000000000000000000000000000000000c8": "0x1",
+ "0x00000000000000000000000000000000000000c9": "0x1",
+ "0x00000000000000000000000000000000000000ca": "0x1",
+ "0x00000000000000000000000000000000000000cb": "0x1",
+ "0x00000000000000000000000000000000000000cc": "0x1",
+ "0x00000000000000000000000000000000000000cd": "0x1",
+ "0x00000000000000000000000000000000000000ce": "0x1",
+ "0x00000000000000000000000000000000000000cf": "0x1",
+ "0x00000000000000000000000000000000000000d0": "0x1",
+ "0x00000000000000000000000000000000000000d1": "0x1",
+ "0x00000000000000000000000000000000000000d2": "0x1",
+ "0x00000000000000000000000000000000000000d3": "0x1",
+ "0x00000000000000000000000000000000000000d4": "0x1",
+ "0x00000000000000000000000000000000000000d5": "0x1",
+ "0x00000000000000000000000000000000000000d6": "0x1",
+ "0x00000000000000000000000000000000000000d7": "0x1",
+ "0x00000000000000000000000000000000000000d8": "0x1",
+ "0x00000000000000000000000000000000000000d9": "0x1",
+ "0x00000000000000000000000000000000000000da": "0x1",
+ "0x00000000000000000000000000000000000000db": "0x1",
+ "0x00000000000000000000000000000000000000dc": "0x1",
+ "0x00000000000000000000000000000000000000dd": "0x1",
+ "0x00000000000000000000000000000000000000de": "0x1",
+ "0x00000000000000000000000000000000000000df": "0x1",
+ "0x00000000000000000000000000000000000000e0": "0x1",
+ "0x00000000000000000000000000000000000000e1": "0x1",
+ "0x00000000000000000000000000000000000000e2": "0x1",
+ "0x00000000000000000000000000000000000000e3": "0x1",
+ "0x00000000000000000000000000000000000000e4": "0x1",
+ "0x00000000000000000000000000000000000000e5": "0x1",
+ "0x00000000000000000000000000000000000000e6": "0x1",
+ "0x00000000000000000000000000000000000000e7": "0x1",
+ "0x00000000000000000000000000000000000000e8": "0x1",
+ "0x00000000000000000000000000000000000000e9": "0x1",
+ "0x00000000000000000000000000000000000000ea": "0x1",
+ "0x00000000000000000000000000000000000000eb": "0x1",
+ "0x00000000000000000000000000000000000000ec": "0x1",
+ "0x00000000000000000000000000000000000000ed": "0x1",
+ "0x00000000000000000000000000000000000000ee": "0x1",
+ "0x00000000000000000000000000000000000000ef": "0x1",
+ "0x00000000000000000000000000000000000000f0": "0x1",
+ "0x00000000000000000000000000000000000000f1": "0x1",
+ "0x00000000000000000000000000000000000000f2": "0x1",
+ "0x00000000000000000000000000000000000000f3": "0x1",
+ "0x00000000000000000000000000000000000000f4": "0x1",
+ "0x00000000000000000000000000000000000000f5": "0x1",
+ "0x00000000000000000000000000000000000000f6": "0x1",
+ "0x00000000000000000000000000000000000000f7": "0x1",
+ "0x00000000000000000000000000000000000000f8": "0x1",
+ "0x00000000000000000000000000000000000000f9": "0x1",
+ "0x00000000000000000000000000000000000000fa": "0x1",
+ "0x00000000000000000000000000000000000000fb": "0x1",
+ "0x00000000000000000000000000000000000000fc": "0x1",
+ "0x00000000000000000000000000000000000000fd": "0x1",
+ "0x00000000000000000000000000000000000000fe": "0x1",
+ "0x00000000000000000000000000000000000000ff": "0x1",
+ "0x31b98d14007bdee637298086988a0bbd31184523": "0x200000000000000000000000000000000000000000000000000000000000000"
+}
+
+},{}],599:[function(require,module,exports){
+module.exports={
+ "0x0000000000000000000000000000000000000011": "0",
+ "0x0000000000000000000000000000000000000010": "0",
+ "0x0000000000000000000000000000000000000013": "0",
+ "0x0000000000000000000000000000000000000012": "0",
+ "0x0000000000000000000000000000000000000015": "0",
+ "0x0000000000000000000000000000000000000014": "0",
+ "0x0000000000000000000000000000000000000017": "0",
+ "0x0000000000000000000000000000000000000016": "0",
+ "0x0000000000000000000000000000000000000019": "0",
+ "0x0000000000000000000000000000000000000018": "0",
+ "0x00000000000000000000000000000000000000c1": "0",
+ "0x00000000000000000000000000000000000000c0": "0",
+ "0x00000000000000000000000000000000000000c7": "0",
+ "0x00000000000000000000000000000000000000c6": "0",
+ "0x00000000000000000000000000000000000000c5": "0",
+ "0x00000000000000000000000000000000000000c4": "0",
+ "0x000000000000000000000000000000000000002d": "0",
+ "0x000000000000000000000000000000000000002e": "0",
+ "0x000000000000000000000000000000000000002f": "0",
+ "0x00000000000000000000000000000000000000c8": "0",
+ "0x000000000000000000000000000000000000002a": "0",
+ "0x000000000000000000000000000000000000002b": "0",
+ "0x000000000000000000000000000000000000002c": "0",
+ "0x0000000000000000000000000000000000000091": "0",
+ "0x0000000000000000000000000000000000000090": "0",
+ "0x0000000000000000000000000000000000000093": "0",
+ "0x0000000000000000000000000000000000000092": "0",
+ "0x0000000000000000000000000000000000000095": "0",
+ "0x0000000000000000000000000000000000000094": "0",
+ "0x0000000000000000000000000000000000000097": "0",
+ "0x0000000000000000000000000000000000000096": "0",
+ "0x0000000000000000000000000000000000000076": "0",
+ "0x000000000000000000000000000000000000000c": "0",
+ "0x00000000000000000000000000000000000000c3": "0",
+ "0x00000000000000000000000000000000000000c2": "0",
+ "0x0000000000000000000000000000000000000081": "0",
+ "0x000000000000000000000000000000000000000a": "0",
+ "0x0000000000000000000000000000000000000024": "0",
+ "0x0000000000000000000000000000000000000025": "0",
+ "0x0000000000000000000000000000000000000026": "0",
+ "0x0000000000000000000000000000000000000027": "0",
+ "0x0000000000000000000000000000000000000020": "0",
+ "0x0000000000000000000000000000000000000021": "0",
+ "0x0000000000000000000000000000000000000022": "0",
+ "0x0000000000000000000000000000000000000023": "0",
+ "0x000000000000000000000000000000000000009a": "0",
+ "0x00000000000000000000000000000000000000d7": "0",
+ "0x000000000000000000000000000000000000009c": "0",
+ "0x000000000000000000000000000000000000009b": "0",
+ "0x0000000000000000000000000000000000000028": "0",
+ "0x0000000000000000000000000000000000000029": "0",
+ "0x00000000000000000000000000000000000000d0": "0",
+ "0x000000000000000000000000000000000000009f": "0",
+ "0x000000000000000000000000000000000000001a": "0",
+ "0x000000000000000000000000000000000000001c": "0",
+ "0x000000000000000000000000000000000000001b": "0",
+ "0x000000000000000000000000000000000000001e": "0",
+ "0x000000000000000000000000000000000000001d": "0",
+ "0x000000000000000000000000000000000000001f": "0",
+ "0x00000000000000000000000000000000000000cc": "0",
+ "0x00000000000000000000000000000000000000cb": "0",
+ "0x00000000000000000000000000000000000000ca": "0",
+ "0x00000000000000000000000000000000000000cf": "0",
+ "0x00000000000000000000000000000000000000ce": "0",
+ "0x00000000000000000000000000000000000000cd": "0",
+ "0x0000000000000000000000000000000000000099": "0",
+ "0x0000000000000000000000000000000000000098": "0",
+ "0x00000000000000000000000000000000000000ac": "0",
+ "0x00000000000000000000000000000000000000aa": "0",
+ "0x00000000000000000000000000000000000000e9": "0",
+ "0x00000000000000000000000000000000000000e8": "0",
+ "0x00000000000000000000000000000000000000e5": "0",
+ "0x00000000000000000000000000000000000000e4": "0",
+ "0x00000000000000000000000000000000000000e7": "0",
+ "0x00000000000000000000000000000000000000e6": "0",
+ "0x00000000000000000000000000000000000000e1": "0",
+ "0x00000000000000000000000000000000000000e0": "0",
+ "0x00000000000000000000000000000000000000e3": "0",
+ "0x00000000000000000000000000000000000000e2": "0",
+ "0x00000000000000000000000000000000000000df": "0",
+ "0x00000000000000000000000000000000000000fb": "0",
+ "0x00000000000000000000000000000000000000fc": "0",
+ "0x00000000000000000000000000000000000000fd": "0",
+ "0x00000000000000000000000000000000000000fe": "0",
+ "0x00000000000000000000000000000000000000ff": "0",
+ "0x00000000000000000000000000000000000000ae": "0",
+ "0x00000000000000000000000000000000000000dd": "0",
+ "0x00000000000000000000000000000000000000ad": "0",
+ "0x00000000000000000000000000000000000000de": "0",
+ "0x000000000000000000000000000000000000009e": "0",
+ "0x000000000000000000000000000000000000004f": "0",
+ "0x00000000000000000000000000000000000000db": "0",
+ "0x000000000000000000000000000000000000004d": "0",
+ "0x000000000000000000000000000000000000004e": "0",
+ "0x000000000000000000000000000000000000004b": "0",
+ "0x000000000000000000000000000000000000004c": "0",
+ "0x000000000000000000000000000000000000004a": "0",
+ "0x0000000000000000000000000000000000000039": "0",
+ "0x0000000000000000000000000000000000000038": "0",
+ "0x000000000000000000000000000000000000000e": "0",
+ "0x0000000000000000000000000000000000000033": "0",
+ "0x0000000000000000000000000000000000000032": "0",
+ "0x0000000000000000000000000000000000000031": "0",
+ "0x0000000000000000000000000000000000000030": "0",
+ "0x0000000000000000000000000000000000000037": "0",
+ "0x0000000000000000000000000000000000000036": "0",
+ "0x0000000000000000000000000000000000000035": "0",
+ "0x0000000000000000000000000000000000000034": "0",
+ "0x00000000000000000000000000000000000000f0": "0",
+ "0x00000000000000000000000000000000000000f1": "0",
+ "0x00000000000000000000000000000000000000f2": "0",
+ "0x00000000000000000000000000000000000000f3": "0",
+ "0x00000000000000000000000000000000000000f4": "0",
+ "0x00000000000000000000000000000000000000f5": "0",
+ "0x00000000000000000000000000000000000000f6": "0",
+ "0x00000000000000000000000000000000000000f7": "0",
+ "0x00000000000000000000000000000000000000f8": "0",
+ "0x00000000000000000000000000000000000000f9": "0",
+ "0x00000000000000000000000000000000000000ee": "0",
+ "0x00000000000000000000000000000000000000c9": "0",
+ "0x00000000000000000000000000000000000000ef": "0",
+ "0x00000000000000000000000000000000000000ea": "0",
+ "0x00000000000000000000000000000000000000ec": "0",
+ "0x00000000000000000000000000000000000000eb": "0",
+ "0x000000000000000000000000000000000000003c": "0",
+ "0x000000000000000000000000000000000000003b": "0",
+ "0x000000000000000000000000000000000000003a": "0",
+ "0x000000000000000000000000000000000000003f": "0",
+ "0x000000000000000000000000000000000000003e": "0",
+ "0x000000000000000000000000000000000000003d": "0",
+ "0x0000000000000000000000000000000000000089": "0",
+ "0x0000000000000000000000000000000000000048": "0",
+ "0x0000000000000000000000000000000000000049": "0",
+ "0x0000000000000000000000000000000000000046": "0",
+ "0x0000000000000000000000000000000000000047": "0",
+ "0x0000000000000000000000000000000000000044": "0",
+ "0x0000000000000000000000000000000000000045": "0",
+ "0x0000000000000000000000000000000000000042": "0",
+ "0x0000000000000000000000000000000000000043": "0",
+ "0x0000000000000000000000000000000000000040": "0",
+ "0x0000000000000000000000000000000000000041": "0",
+ "0x874b54a8bd152966d63f706bae1ffeb0411921e5": "1000000000000000000000000000000",
+ "0x00000000000000000000000000000000000000af": "0",
+ "0x0000000000000000000000000000000000000088": "0",
+ "0x000000000000000000000000000000000000000d": "0",
+ "0x00000000000000000000000000000000000000ed": "0",
+ "0x000000000000000000000000000000000000006a": "0",
+ "0x000000000000000000000000000000000000006b": "0",
+ "0x000000000000000000000000000000000000006c": "0",
+ "0x000000000000000000000000000000000000006d": "0",
+ "0x000000000000000000000000000000000000006e": "0",
+ "0x000000000000000000000000000000000000006f": "0",
+ "0x0000000000000000000000000000000000000086": "0",
+ "0x0000000000000000000000000000000000000087": "0",
+ "0x0000000000000000000000000000000000000059": "0",
+ "0x0000000000000000000000000000000000000058": "0",
+ "0x0000000000000000000000000000000000000055": "0",
+ "0x0000000000000000000000000000000000000054": "0",
+ "0x0000000000000000000000000000000000000057": "0",
+ "0x0000000000000000000000000000000000000056": "0",
+ "0x0000000000000000000000000000000000000051": "0",
+ "0x0000000000000000000000000000000000000050": "0",
+ "0x0000000000000000000000000000000000000053": "0",
+ "0x0000000000000000000000000000000000000052": "0",
+ "0x000000000000000000000000000000000000009d": "0",
+ "0x00000000000000000000000000000000000000dc": "0",
+ "0x000000000000000000000000000000000000000b": "0",
+ "0x00000000000000000000000000000000000000fa": "0",
+ "0x000000000000000000000000000000000000005e": "0",
+ "0x000000000000000000000000000000000000005d": "0",
+ "0x000000000000000000000000000000000000005f": "0",
+ "0x000000000000000000000000000000000000005a": "0",
+ "0x000000000000000000000000000000000000005c": "0",
+ "0x000000000000000000000000000000000000005b": "0",
+ "0x0000000000000000000000000000000000000060": "0",
+ "0x0000000000000000000000000000000000000061": "0",
+ "0x0000000000000000000000000000000000000062": "0",
+ "0x0000000000000000000000000000000000000063": "0",
+ "0x0000000000000000000000000000000000000064": "0",
+ "0x0000000000000000000000000000000000000065": "0",
+ "0x0000000000000000000000000000000000000066": "0",
+ "0x0000000000000000000000000000000000000067": "0",
+ "0x0000000000000000000000000000000000000068": "0",
+ "0x0000000000000000000000000000000000000069": "0",
+ "0x00000000000000000000000000000000000000bd": "0",
+ "0x00000000000000000000000000000000000000be": "0",
+ "0x00000000000000000000000000000000000000bf": "0",
+ "0x00000000000000000000000000000000000000ba": "0",
+ "0x00000000000000000000000000000000000000bb": "0",
+ "0x00000000000000000000000000000000000000bc": "0",
+ "0x000000000000000000000000000000000000008b": "0",
+ "0x000000000000000000000000000000000000008c": "0",
+ "0x000000000000000000000000000000000000008a": "0",
+ "0x000000000000000000000000000000000000008f": "0",
+ "0x000000000000000000000000000000000000008d": "0",
+ "0x000000000000000000000000000000000000008e": "0",
+ "0x00000000000000000000000000000000000000a1": "0",
+ "0x00000000000000000000000000000000000000a0": "0",
+ "0x00000000000000000000000000000000000000a3": "0",
+ "0x00000000000000000000000000000000000000a2": "0",
+ "0x00000000000000000000000000000000000000a5": "0",
+ "0x00000000000000000000000000000000000000a4": "0",
+ "0x00000000000000000000000000000000000000a7": "0",
+ "0x00000000000000000000000000000000000000a6": "0",
+ "0x00000000000000000000000000000000000000a9": "0",
+ "0x00000000000000000000000000000000000000a8": "0",
+ "0x00000000000000000000000000000000000000ab": "0",
+ "0x00000000000000000000000000000000000000d8": "0",
+ "0x00000000000000000000000000000000000000d9": "0",
+ "0x0000000000000000000000000000000000000077": "0",
+ "0x00000000000000000000000000000000000000d6": "0",
+ "0x0000000000000000000000000000000000000075": "0",
+ "0x0000000000000000000000000000000000000074": "0",
+ "0x0000000000000000000000000000000000000073": "0",
+ "0x0000000000000000000000000000000000000072": "0",
+ "0x0000000000000000000000000000000000000071": "0",
+ "0x0000000000000000000000000000000000000070": "0",
+ "0x00000000000000000000000000000000000000d4": "0",
+ "0x0000000000000000000000000000000000000079": "0",
+ "0x0000000000000000000000000000000000000078": "0",
+ "0x0000000000000000000000000000000000000002": "1",
+ "0x0000000000000000000000000000000000000003": "1",
+ "0x0000000000000000000000000000000000000000": "1",
+ "0x0000000000000000000000000000000000000001": "1",
+ "0x0000000000000000000000000000000000000006": "1",
+ "0x0000000000000000000000000000000000000007": "1",
+ "0x0000000000000000000000000000000000000004": "1",
+ "0x0000000000000000000000000000000000000005": "1",
+ "0x00000000000000000000000000000000000000d2": "0",
+ "0x0000000000000000000000000000000000000008": "1",
+ "0x0000000000000000000000000000000000000009": "1",
+ "0x00000000000000000000000000000000000000d3": "0",
+ "0x00000000000000000000000000000000000000b4": "0",
+ "0x00000000000000000000000000000000000000b5": "0",
+ "0x00000000000000000000000000000000000000b6": "0",
+ "0x00000000000000000000000000000000000000b7": "0",
+ "0x00000000000000000000000000000000000000b0": "0",
+ "0x00000000000000000000000000000000000000b1": "0",
+ "0x00000000000000000000000000000000000000b2": "0",
+ "0x00000000000000000000000000000000000000b3": "0",
+ "0x0000000000000000000000000000000000000082": "0",
+ "0x0000000000000000000000000000000000000083": "0",
+ "0x0000000000000000000000000000000000000080": "0",
+ "0x00000000000000000000000000000000000000d1": "0",
+ "0x00000000000000000000000000000000000000b8": "0",
+ "0x00000000000000000000000000000000000000b9": "0",
+ "0x0000000000000000000000000000000000000084": "0",
+ "0x0000000000000000000000000000000000000085": "0",
+ "0x000000000000000000000000000000000000007f": "0",
+ "0x000000000000000000000000000000000000007e": "0",
+ "0x000000000000000000000000000000000000007d": "0",
+ "0x000000000000000000000000000000000000007c": "0",
+ "0x000000000000000000000000000000000000007b": "0",
+ "0x000000000000000000000000000000000000007a": "0",
+ "0x000000000000000000000000000000000000000f": "0",
+ "0x00000000000000000000000000000000000000d5": "0",
+ "0x00000000000000000000000000000000000000da": "0"
+}
+
+},{}],600:[function(require,module,exports){
+module.exports={
+ "name": "byzantium",
+ "comment": "Hardfork with new precompiles, instructions and other protocol changes",
+ "eip": {
+ "url": "https://eips.ethereum.org/EIPS/eip-609",
+ "status": "Final"
+ },
+ "gasConfig": {},
+ "gasPrices": {
+ "modexpGquaddivisor": {
+ "v": 20,
+ "d": "Gquaddivisor from modexp precompile for gas calculation"
+ },
+ "ecAdd": {
+ "v": 500,
+ "d": "Gas costs for curve addition precompile"
+ },
+ "ecMul": {
+ "v": 40000,
+ "d": "Gas costs for curve multiplication precompile"
+ },
+ "ecPairing": {
+ "v": 100000,
+ "d": "Base gas costs for curve pairing precompile"
+ },
+ "ecPairingWord": {
+ "v": 80000,
+ "d": "Gas costs regarding curve pairing precompile input length"
+ }
+ },
+ "vm": {},
+ "pow": {
+ "minerReward": {
+ "v": "3000000000000000000",
+ "d": "the amount a miner get rewarded for mining a block"
+ }
+ },
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],601:[function(require,module,exports){
+module.exports={
+ "name": "chainstart",
+ "comment": "Start of the Ethereum main chain",
+ "eip": {
+ "url": "",
+ "status": ""
+ },
+ "status": "",
+ "gasConfig": {
+ "minGasLimit": {
+ "v": 5000,
+ "d": "Minimum the gas limit may ever be"
+ },
+ "gasLimitBoundDivisor": {
+ "v": 1024,
+ "d": "The bound divisor of the gas limit, used in update calculations"
+ }
+ },
+ "gasPrices": {
+ "tierStep": {
+ "v": [0, 2, 3, 5, 8, 10, 20],
+ "d": "Once per operation, for a selection of them"
+ },
+ "exp": {
+ "v": 10,
+ "d": "Once per EXP instuction"
+ },
+ "expByte": {
+ "v": 10,
+ "d": "Times ceil(log256(exponent)) for the EXP instruction"
+ },
+ "sha3": {
+ "v": 30,
+ "d": "Once per SHA3 operation"
+ },
+ "sha3Word": {
+ "v": 6,
+ "d": "Once per word of the SHA3 operation's data"
+ },
+ "sload": {
+ "v": 50,
+ "d": "Once per SLOAD operation"
+ },
+ "sstoreSet": {
+ "v": 20000,
+ "d": "Once per SSTORE operation if the zeroness changes from zero"
+ },
+ "sstoreReset": {
+ "v": 5000,
+ "d": "Once per SSTORE operation if the zeroness does not change from zero"
+ },
+ "sstoreRefund": {
+ "v": 15000,
+ "d": "Once per SSTORE operation if the zeroness changes to zero"
+ },
+ "jumpdest": {
+ "v": 1,
+ "d": "Refunded gas, once per SSTORE operation if the zeroness changes to zero"
+ },
+ "log": {
+ "v": 375,
+ "d": "Per LOG* operation"
+ },
+ "logData": {
+ "v": 8,
+ "d": "Per byte in a LOG* operation's data"
+ },
+ "logTopic": {
+ "v": 375,
+ "d": "Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"
+ },
+ "create": {
+ "v": 32000,
+ "d": "Once per CREATE operation & contract-creation transaction"
+ },
+ "call": {
+ "v": 40,
+ "d": "Once per CALL operation & message call transaction"
+ },
+ "callStipend": {
+ "v": 2300,
+ "d": "Free gas given at beginning of call"
+ },
+ "callValueTransfer": {
+ "v": 9000,
+ "d": "Paid for CALL when the value transfor is non-zero"
+ },
+ "callNewAccount": {
+ "v": 25000,
+ "d": "Paid for CALL when the destination address didn't exist prior"
+ },
+ "selfdestructRefund": {
+ "v": 24000,
+ "d": "Refunded following a selfdestruct operation"
+ },
+ "memory": {
+ "v": 3,
+ "d": "Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"
+ },
+ "quadCoeffDiv": {
+ "v": 512,
+ "d": "Divisor for the quadratic particle of the memory cost equation"
+ },
+ "createData": {
+ "v": 200,
+ "d": ""
+ },
+ "tx": {
+ "v": 21000,
+ "d": "Per transaction. NOTE: Not payable on data of calls between transactions"
+ },
+ "txCreation": {
+ "v": 32000,
+ "d": "The cost of creating a contract via tx"
+ },
+ "txDataZero": {
+ "v": 4,
+ "d": "Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"
+ },
+ "txDataNonZero": {
+ "v": 68,
+ "d": "Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"
+ },
+ "copy": {
+ "v": 3,
+ "d": "Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"
+ },
+ "ecRecover": {
+ "v": 3000,
+ "d": ""
+ },
+ "sha256": {
+ "v": 60,
+ "d": ""
+ },
+ "sha256Word": {
+ "v": 12,
+ "d": ""
+ },
+ "ripemd160": {
+ "v": 600,
+ "d": ""
+ },
+ "ripemd160Word": {
+ "v": 120,
+ "d": ""
+ },
+ "identity": {
+ "v": 15,
+ "d": ""
+ },
+ "identityWord": {
+ "v": 3,
+ "d": ""
+ }
+ },
+ "vm": {
+ "stackLimit": {
+ "v": 1024,
+ "d": "Maximum size of VM stack allowed"
+ },
+ "callCreateDepth": {
+ "v": 1024,
+ "d": "Maximum depth of call/create stack"
+ },
+ "maxExtraDataSize": {
+ "v": 32,
+ "d": "Maximum size extra data may be after Genesis"
+ }
+ },
+ "pow": {
+ "minimumDifficulty": {
+ "v": 131072,
+ "d": "The minimum that the difficulty may ever be"
+ },
+ "difficultyBoundDivisor": {
+ "v": 2048,
+ "d": "The bound divisor of the difficulty, used in the update calculations"
+ },
+ "durationLimit": {
+ "v": 13,
+ "d": "The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"
+ },
+ "epochDuration": {
+ "v": 30000,
+ "d": "Duration between proof-of-work epochs"
+ },
+ "timebombPeriod": {
+ "v": 100000,
+ "d": "Exponential difficulty timebomb period"
+ },
+ "minerReward": {
+ "v": "5000000000000000000",
+ "d": "the amount a miner get rewarded for mining a block"
+ }
+ },
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],602:[function(require,module,exports){
+module.exports={
+ "name": "constantinople",
+ "comment": "Postponed hardfork including EIP-1283 (SSTORE gas metering changes)",
+ "eip": {
+ "url": "https://eips.ethereum.org/EIPS/eip-1013",
+ "status": "Final"
+ },
+ "gasConfig": {},
+ "gasPrices": {
+ "netSstoreNoopGas": {
+ "v": 200,
+ "d": "Once per SSTORE operation if the value doesn't change"
+ },
+ "netSstoreInitGas": {
+ "v": 20000,
+ "d": "Once per SSTORE operation from clean zero"
+ },
+ "netSstoreCleanGas": {
+ "v": 5000,
+ "d": "Once per SSTORE operation from clean non-zero"
+ },
+ "netSstoreDirtyGas": {
+ "v": 200,
+ "d": "Once per SSTORE operation from dirty"
+ },
+ "netSstoreClearRefund": {
+ "v": 15000,
+ "d": "Once per SSTORE operation for clearing an originally existing storage slot"
+ },
+ "netSstoreResetRefund": {
+ "v": 4800,
+ "d": "Once per SSTORE operation for resetting to the original non-zero value"
+ },
+ "netSstoreResetClearRefund": {
+ "v": 19800,
+ "d": "Once per SSTORE operation for resetting to the original zero value"
+ }
+ },
+ "vm": {},
+ "pow": {
+ "minerReward": {
+ "v": "2000000000000000000",
+ "d": "The amount a miner gets rewarded for mining a block"
+ }
+ },
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],603:[function(require,module,exports){
+module.exports={
+ "name": "dao",
+ "comment": "DAO rescue hardfork",
+ "eip": {
+ "url": "https://eips.ethereum.org/EIPS/eip-779",
+ "status": "Final"
+ },
+ "gasConfig": {},
+ "gasPrices": {},
+ "vm": {},
+ "pow": {},
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],604:[function(require,module,exports){
+module.exports={
+ "name": "homestead",
+ "comment": "Homestead hardfork with protocol and network changes",
+ "eip": {
+ "url": "https://eips.ethereum.org/EIPS/eip-606",
+ "status": "Final"
+ },
+ "gasConfig": {},
+ "gasPrices": {},
+ "vm": {},
+ "pow": {},
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],605:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.hardforks = [
+ ['chainstart', require('./chainstart.json')],
+ ['homestead', require('./homestead.json')],
+ ['dao', require('./dao.json')],
+ ['tangerineWhistle', require('./tangerineWhistle.json')],
+ ['spuriousDragon', require('./spuriousDragon.json')],
+ ['byzantium', require('./byzantium.json')],
+ ['constantinople', require('./constantinople.json')],
+ ['petersburg', require('./petersburg.json')],
+];
+
+},{"./byzantium.json":600,"./chainstart.json":601,"./constantinople.json":602,"./dao.json":603,"./homestead.json":604,"./petersburg.json":606,"./spuriousDragon.json":607,"./tangerineWhistle.json":608}],606:[function(require,module,exports){
+module.exports={
+ "name": "petersburg",
+ "comment": "Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople",
+ "eip": {
+ "url": "https://github.com/ethereum/EIPs/pull/1716",
+ "status": "Draft"
+ },
+ "gasConfig": {},
+ "gasPrices": {
+ "netSstoreNoopGas": {
+ "v": null,
+ "d": "Removed along EIP-1283"
+ },
+ "netSstoreInitGas": {
+ "v": null,
+ "d": "Removed along EIP-1283"
+ },
+ "netSstoreCleanGas": {
+ "v": null,
+ "d": "Removed along EIP-1283"
+ },
+ "netSstoreDirtyGas": {
+ "v": null,
+ "d": "Removed along EIP-1283"
+ },
+ "netSstoreClearRefund": {
+ "v": null,
+ "d": "Removed along EIP-1283"
+ },
+ "netSstoreResetRefund": {
+ "v": null,
+ "d": "Removed along EIP-1283"
+ },
+ "netSstoreResetClearRefund": {
+ "v": null,
+ "d": "Removed along EIP-1283"
+ }
+ },
+ "vm": {},
+ "pow": {},
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],607:[function(require,module,exports){
+module.exports={
+ "name": "spuriousDragon",
+ "comment": "HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit",
+ "eip": {
+ "url": "https://eips.ethereum.org/EIPS/eip-607",
+ "status": "Final"
+ },
+ "gasConfig": {},
+ "gasPrices": {
+ "expByte": {
+ "v": 50,
+ "d": "Times ceil(log256(exponent)) for the EXP instruction"
+ }
+ },
+ "vm": {
+ "maxCodeSize": {
+ "v": 24576,
+ "d": "Maximum length of contract code"
+ }
+ },
+ "pow": {},
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],608:[function(require,module,exports){
+module.exports={
+ "name": "tangerineWhistle",
+ "comment": "Hardfork with gas cost changes for IO-heavy operations",
+ "eip": {
+ "url": "https://eips.ethereum.org/EIPS/eip-608",
+ "status": "Final"
+ },
+ "gasConfig": {},
+ "gasPrices": {
+ "sload": {
+ "v": 200,
+ "d": "Once per SLOAD operation"
+ },
+ "call": {
+ "v": 700,
+ "d": "Once per CALL operation & message call transaction"
+ }
+ },
+ "vm": {},
+ "pow": {},
+ "casper": {},
+ "sharding": {}
+}
+
+},{}],609:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var chains_1 = require("./chains");
+var hardforks_1 = require("./hardforks");
+/**
+ * Common class to access chain and hardfork parameters
+ */
+var Common = /** @class */ (function () {
+ /**
+ * @constructor
+ * @param chain String ('mainnet') or Number (1) chain
+ * @param hardfork String identifier ('byzantium') for hardfork (optional)
+ * @param supportedHardforks Limit parameter returns to the given hardforks (optional)
+ */
+ function Common(chain, hardfork, supportedHardforks) {
+ this._chainParams = this.setChain(chain);
+ this._hardfork = null;
+ this._supportedHardforks = supportedHardforks === undefined ? [] : supportedHardforks;
+ if (hardfork) {
+ this.setHardfork(hardfork);
+ }
+ }
+ /**
+ * Sets the chain
+ * @param chain String ('mainnet') or Number (1) chain
+ * representation. Or, a Dictionary of chain parameters for a private network.
+ * @returns The dictionary with parameters set as chain
+ */
+ Common.prototype.setChain = function (chain) {
+ if (typeof chain === 'number') {
+ if (chains_1.chains['names'][chain]) {
+ this._chainParams = chains_1.chains[chains_1.chains['names'][chain]];
+ }
+ else {
+ throw new Error("Chain with ID " + chain + " not supported");
+ }
+ }
+ else if (typeof chain === 'string') {
+ if (chains_1.chains[chain]) {
+ this._chainParams = chains_1.chains[chain];
+ }
+ else {
+ throw new Error("Chain with name " + chain + " not supported");
+ }
+ }
+ else if (typeof chain === 'object') {
+ var required = ['networkId', 'genesis', 'hardforks', 'bootstrapNodes'];
+ for (var _i = 0, required_1 = required; _i < required_1.length; _i++) {
+ var param = required_1[_i];
+ if (chain[param] === undefined) {
+ throw new Error("Missing required chain parameter: " + param);
+ }
+ }
+ this._chainParams = chain;
+ }
+ else {
+ throw new Error('Wrong input format');
+ }
+ return this._chainParams;
+ };
+ /**
+ * Sets the hardfork to get params for
+ * @param hardfork String identifier ('byzantium')
+ */
+ Common.prototype.setHardfork = function (hardfork) {
+ if (!this._isSupportedHardfork(hardfork)) {
+ throw new Error("Hardfork " + hardfork + " not set as supported in supportedHardforks");
+ }
+ var changed = false;
+ for (var _i = 0, hardforkChanges_1 = hardforks_1.hardforks; _i < hardforkChanges_1.length; _i++) {
+ var hfChanges = hardforkChanges_1[_i];
+ if (hfChanges[0] === hardfork) {
+ this._hardfork = hardfork;
+ changed = true;
+ }
+ }
+ if (!changed) {
+ throw new Error("Hardfork with name " + hardfork + " not supported");
+ }
+ };
+ /**
+ * Internal helper function to choose between hardfork set and hardfork provided as param
+ * @param hardfork Hardfork given to function as a parameter
+ * @returns Hardfork chosen to be used
+ */
+ Common.prototype._chooseHardfork = function (hardfork, onlySupported) {
+ onlySupported = onlySupported === undefined ? true : onlySupported;
+ if (!hardfork) {
+ if (!this._hardfork) {
+ throw new Error('Method called with neither a hardfork set nor provided by param');
+ }
+ else {
+ hardfork = this._hardfork;
+ }
+ }
+ else if (onlySupported && !this._isSupportedHardfork(hardfork)) {
+ throw new Error("Hardfork " + hardfork + " not set as supported in supportedHardforks");
+ }
+ return hardfork;
+ };
+ /**
+ * Internal helper function, returns the params for the given hardfork for the chain set
+ * @param hardfork Hardfork name
+ * @returns Dictionary with hardfork params
+ */
+ Common.prototype._getHardfork = function (hardfork) {
+ var hfs = this.hardforks();
+ for (var _i = 0, hfs_1 = hfs; _i < hfs_1.length; _i++) {
+ var hf = hfs_1[_i];
+ if (hf['name'] === hardfork)
+ return hf;
+ }
+ throw new Error("Hardfork " + hardfork + " not defined for chain " + this.chainName());
+ };
+ /**
+ * Internal helper function to check if a hardfork is set to be supported by the library
+ * @param hardfork Hardfork name
+ * @returns True if hardfork is supported
+ */
+ Common.prototype._isSupportedHardfork = function (hardfork) {
+ if (this._supportedHardforks.length > 0) {
+ for (var _i = 0, _a = this._supportedHardforks; _i < _a.length; _i++) {
+ var supportedHf = _a[_i];
+ if (hardfork === supportedHf)
+ return true;
+ }
+ }
+ else {
+ return true;
+ }
+ return false;
+ };
+ /**
+ * Returns the parameter corresponding to a hardfork
+ * @param topic Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow', 'casper', 'sharding')
+ * @param name Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic)
+ * @param hardfork Hardfork name, optional if hardfork set
+ */
+ Common.prototype.param = function (topic, name, hardfork) {
+ hardfork = this._chooseHardfork(hardfork);
+ var value;
+ for (var _i = 0, hardforkChanges_2 = hardforks_1.hardforks; _i < hardforkChanges_2.length; _i++) {
+ var hfChanges = hardforkChanges_2[_i];
+ if (!hfChanges[1][topic]) {
+ throw new Error("Topic " + topic + " not defined");
+ }
+ if (hfChanges[1][topic][name] !== undefined) {
+ value = hfChanges[1][topic][name].v;
+ }
+ if (hfChanges[0] === hardfork)
+ break;
+ }
+ if (value === undefined) {
+ throw new Error(topic + " value for " + name + " not found");
+ }
+ return value;
+ };
+ /**
+ * Returns a parameter for the hardfork active on block number
+ * @param topic Parameter topic
+ * @param name Parameter name
+ * @param blockNumber Block number
+ */
+ Common.prototype.paramByBlock = function (topic, name, blockNumber) {
+ var activeHfs = this.activeHardforks(blockNumber);
+ var hardfork = activeHfs[activeHfs.length - 1]['name'];
+ return this.param(topic, name, hardfork);
+ };
+ /**
+ * Checks if set or provided hardfork is active on block number
+ * @param hardfork Hardfork name or null (for HF set)
+ * @param blockNumber
+ * @param opts Hardfork options (onlyActive unused)
+ * @returns True if HF is active on block number
+ */
+ Common.prototype.hardforkIsActiveOnBlock = function (hardfork, blockNumber, opts) {
+ opts = opts !== undefined ? opts : {};
+ var onlySupported = opts.onlySupported === undefined ? false : opts.onlySupported;
+ hardfork = this._chooseHardfork(hardfork, onlySupported);
+ var hfBlock = this.hardforkBlock(hardfork);
+ if (hfBlock !== null && blockNumber >= hfBlock)
+ return true;
+ return false;
+ };
+ /**
+ * Alias to hardforkIsActiveOnBlock when hardfork is set
+ * @param blockNumber
+ * @param opts Hardfork options (onlyActive unused)
+ * @returns True if HF is active on block number
+ */
+ Common.prototype.activeOnBlock = function (blockNumber, opts) {
+ return this.hardforkIsActiveOnBlock(null, blockNumber, opts);
+ };
+ /**
+ * Sequence based check if given or set HF1 is greater than or equal HF2
+ * @param hardfork1 Hardfork name or null (if set)
+ * @param hardfork2 Hardfork name
+ * @param opts Hardfork options
+ * @returns True if HF1 gte HF2
+ */
+ Common.prototype.hardforkGteHardfork = function (hardfork1, hardfork2, opts) {
+ opts = opts !== undefined ? opts : {};
+ var onlyActive = opts.onlyActive === undefined ? false : opts.onlyActive;
+ hardfork1 = this._chooseHardfork(hardfork1, opts.onlySupported);
+ var hardforks;
+ if (onlyActive) {
+ hardforks = this.activeHardforks(null, opts);
+ }
+ else {
+ hardforks = this.hardforks();
+ }
+ var posHf1 = -1, posHf2 = -1;
+ var index = 0;
+ for (var _i = 0, hardforks_2 = hardforks; _i < hardforks_2.length; _i++) {
+ var hf = hardforks_2[_i];
+ if (hf['name'] === hardfork1)
+ posHf1 = index;
+ if (hf['name'] === hardfork2)
+ posHf2 = index;
+ index += 1;
+ }
+ return posHf1 >= posHf2;
+ };
+ /**
+ * Alias to hardforkGteHardfork when hardfork is set
+ * @param hardfork Hardfork name
+ * @param opts Hardfork options
+ * @returns True if hardfork set is greater than hardfork provided
+ */
+ Common.prototype.gteHardfork = function (hardfork, opts) {
+ return this.hardforkGteHardfork(null, hardfork, opts);
+ };
+ /**
+ * Checks if given or set hardfork is active on the chain
+ * @param hardfork Hardfork name, optional if HF set
+ * @param opts Hardfork options (onlyActive unused)
+ * @returns True if hardfork is active on the chain
+ */
+ Common.prototype.hardforkIsActiveOnChain = function (hardfork, opts) {
+ opts = opts !== undefined ? opts : {};
+ var onlySupported = opts.onlySupported === undefined ? false : opts.onlySupported;
+ hardfork = this._chooseHardfork(hardfork, onlySupported);
+ for (var _i = 0, _a = this.hardforks(); _i < _a.length; _i++) {
+ var hf = _a[_i];
+ if (hf['name'] === hardfork && hf['block'] !== null)
+ return true;
+ }
+ return false;
+ };
+ /**
+ * Returns the active hardfork switches for the current chain
+ * @param blockNumber up to block if provided, otherwise for the whole chain
+ * @param opts Hardfork options (onlyActive unused)
+ * @return Array with hardfork arrays
+ */
+ Common.prototype.activeHardforks = function (blockNumber, opts) {
+ opts = opts !== undefined ? opts : {};
+ var activeHardforks = [];
+ var hfs = this.hardforks();
+ for (var _i = 0, hfs_2 = hfs; _i < hfs_2.length; _i++) {
+ var hf = hfs_2[_i];
+ if (hf['block'] === null)
+ continue;
+ if (blockNumber !== undefined && blockNumber !== null && blockNumber < hf['block'])
+ break;
+ if (opts.onlySupported && !this._isSupportedHardfork(hf['name']))
+ continue;
+ activeHardforks.push(hf);
+ }
+ return activeHardforks;
+ };
+ /**
+ * Returns the latest active hardfork name for chain or block or throws if unavailable
+ * @param blockNumber up to block if provided, otherwise for the whole chain
+ * @param opts Hardfork options (onlyActive unused)
+ * @return Hardfork name
+ */
+ Common.prototype.activeHardfork = function (blockNumber, opts) {
+ opts = opts !== undefined ? opts : {};
+ var activeHardforks = this.activeHardforks(blockNumber, opts);
+ if (activeHardforks.length > 0) {
+ return activeHardforks[activeHardforks.length - 1]['name'];
+ }
+ else {
+ throw new Error("No (supported) active hardfork found");
+ }
+ };
+ /**
+ * Returns the hardfork change block for hardfork provided or set
+ * @param hardfork Hardfork name, optional if HF set
+ * @returns Block number
+ */
+ Common.prototype.hardforkBlock = function (hardfork) {
+ hardfork = this._chooseHardfork(hardfork, false);
+ return this._getHardfork(hardfork)['block'];
+ };
+ /**
+ * True if block number provided is the hardfork (given or set) change block of the current chain
+ * @param blockNumber Number of the block to check
+ * @param hardfork Hardfork name, optional if HF set
+ * @returns True if blockNumber is HF block
+ */
+ Common.prototype.isHardforkBlock = function (blockNumber, hardfork) {
+ hardfork = this._chooseHardfork(hardfork, false);
+ if (this.hardforkBlock(hardfork) === blockNumber) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ };
+ /**
+ * Provide the consensus type for the hardfork set or provided as param
+ * @param hardfork Hardfork name, optional if hardfork set
+ * @returns Consensus type (e.g. 'pow', 'poa')
+ */
+ Common.prototype.consensus = function (hardfork) {
+ hardfork = this._chooseHardfork(hardfork);
+ return this._getHardfork(hardfork)['consensus'];
+ };
+ /**
+ * Provide the finality type for the hardfork set or provided as param
+ * @param {String} hardfork Hardfork name, optional if hardfork set
+ * @returns {String} Finality type (e.g. 'pos', null of no finality)
+ */
+ Common.prototype.finality = function (hardfork) {
+ hardfork = this._chooseHardfork(hardfork);
+ return this._getHardfork(hardfork)['finality'];
+ };
+ /**
+ * Returns the Genesis parameters of current chain
+ * @returns Genesis dictionary
+ */
+ Common.prototype.genesis = function () {
+ return this._chainParams['genesis'];
+ };
+ /**
+ * Returns the hardforks for current chain
+ * @returns {Array} Array with arrays of hardforks
+ */
+ Common.prototype.hardforks = function () {
+ return this._chainParams['hardforks'];
+ };
+ /**
+ * Returns bootstrap nodes for the current chain
+ * @returns {Dictionary} Dict with bootstrap nodes
+ */
+ Common.prototype.bootstrapNodes = function () {
+ return this._chainParams['bootstrapNodes'];
+ };
+ /**
+ * Returns the hardfork set
+ * @returns Hardfork name
+ */
+ Common.prototype.hardfork = function () {
+ return this._hardfork;
+ };
+ /**
+ * Returns the Id of current chain
+ * @returns chain Id
+ */
+ Common.prototype.chainId = function () {
+ return this._chainParams['chainId'];
+ };
+ /**
+ * Returns the name of current chain
+ * @returns chain name (lower case)
+ */
+ Common.prototype.chainName = function () {
+ return chains_1.chains['names'][this.chainId()] || this._chainParams['name'];
+ };
+ /**
+ * Returns the Id of current network
+ * @returns network Id
+ */
+ Common.prototype.networkId = function () {
+ return this._chainParams['networkId'];
+ };
+ return Common;
+}());
+exports.default = Common;
+
+},{"./chains":589,"./hardforks":605}],610:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var ethUtil = require('ethereumjs-util');
+var fees = require('ethereum-common/params.json');
+var BN = ethUtil.BN;
+
+// secp256k1n/2
+var N_DIV_2 = new BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16);
+
+/**
+ * Creates a new transaction object.
+ *
+ * @example
+ * var rawTx = {
+ * nonce: '00',
+ * gasPrice: '09184e72a000',
+ * gasLimit: '2710',
+ * to: '0000000000000000000000000000000000000000',
+ * value: '00',
+ * data: '7f7465737432000000000000000000000000000000000000000000000000000000600057',
+ * v: '1c',
+ * r: '5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab',
+ * s: '5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13'
+ * };
+ * var tx = new Transaction(rawTx);
+ *
+ * @class
+ * @param {Buffer | Array | Object} data a transaction can be initiailized with either a buffer containing the RLP serialized transaction or an array of buffers relating to each of the tx Properties, listed in order below in the exmple.
+ *
+ * Or lastly an Object containing the Properties of the transaction like in the Usage example.
+ *
+ * For Object and Arrays each of the elements can either be a Buffer, a hex-prefixed (0x) String , Number, or an object with a toBuffer method such as Bignum
+ *
+ * @property {Buffer} raw The raw rlp encoded transaction
+ * @param {Buffer} data.nonce nonce number
+ * @param {Buffer} data.gasLimit transaction gas limit
+ * @param {Buffer} data.gasPrice transaction gas price
+ * @param {Buffer} data.to to the to address
+ * @param {Buffer} data.value the amount of ether sent
+ * @param {Buffer} data.data this will contain the data of the message or the init of a contract
+ * @param {Buffer} data.v EC signature parameter
+ * @param {Buffer} data.r EC signature parameter
+ * @param {Buffer} data.s EC recovery ID
+ * @param {Number} data.chainId EIP 155 chainId - mainnet: 1, ropsten: 3
+ * */
+
+var Transaction = function () {
+ function Transaction(data) {
+ _classCallCheck(this, Transaction);
+
+ data = data || {};
+ // Define Properties
+ var fields = [{
+ name: 'nonce',
+ length: 32,
+ allowLess: true,
+ default: new Buffer([])
+ }, {
+ name: 'gasPrice',
+ length: 32,
+ allowLess: true,
+ default: new Buffer([])
+ }, {
+ name: 'gasLimit',
+ alias: 'gas',
+ length: 32,
+ allowLess: true,
+ default: new Buffer([])
+ }, {
+ name: 'to',
+ allowZero: true,
+ length: 20,
+ default: new Buffer([])
+ }, {
+ name: 'value',
+ length: 32,
+ allowLess: true,
+ default: new Buffer([])
+ }, {
+ name: 'data',
+ alias: 'input',
+ allowZero: true,
+ default: new Buffer([])
+ }, {
+ name: 'v',
+ allowZero: true,
+ default: new Buffer([0x1c])
+ }, {
+ name: 'r',
+ length: 32,
+ allowZero: true,
+ allowLess: true,
+ default: new Buffer([])
+ }, {
+ name: 's',
+ length: 32,
+ allowZero: true,
+ allowLess: true,
+ default: new Buffer([])
+ }];
+
+ /**
+ * Returns the rlp encoding of the transaction
+ * @method serialize
+ * @return {Buffer}
+ * @memberof Transaction
+ * @name serialize
+ */
+ // attached serialize
+ ethUtil.defineProperties(this, fields, data);
+
+ /**
+ * @property {Buffer} from (read only) sender address of this transaction, mathematically derived from other parameters.
+ * @name from
+ * @memberof Transaction
+ */
+ Object.defineProperty(this, 'from', {
+ enumerable: true,
+ configurable: true,
+ get: this.getSenderAddress.bind(this)
+ });
+
+ // calculate chainId from signature
+ var sigV = ethUtil.bufferToInt(this.v);
+ var chainId = Math.floor((sigV - 35) / 2);
+ if (chainId < 0) chainId = 0;
+
+ // set chainId
+ this._chainId = chainId || data.chainId || 0;
+ this._homestead = true;
+ }
+
+ /**
+ * If the tx's `to` is to the creation address
+ * @return {Boolean}
+ */
+
+
+ Transaction.prototype.toCreationAddress = function toCreationAddress() {
+ return this.to.toString('hex') === '';
+ };
+
+ /**
+ * Computes a sha3-256 hash of the serialized tx
+ * @param {Boolean} [includeSignature=true] whether or not to inculde the signature
+ * @return {Buffer}
+ */
+
+
+ Transaction.prototype.hash = function hash(includeSignature) {
+ if (includeSignature === undefined) includeSignature = true;
+
+ // EIP155 spec:
+ // when computing the hash of a transaction for purposes of signing or recovering,
+ // instead of hashing only the first six elements (ie. nonce, gasprice, startgas, to, value, data),
+ // hash nine elements, with v replaced by CHAIN_ID, r = 0 and s = 0
+
+ var items = void 0;
+ if (includeSignature) {
+ items = this.raw;
+ } else {
+ if (this._chainId > 0) {
+ var raw = this.raw.slice();
+ this.v = this._chainId;
+ this.r = 0;
+ this.s = 0;
+ items = this.raw;
+ this.raw = raw;
+ } else {
+ items = this.raw.slice(0, 6);
+ }
+ }
+
+ // create hash
+ return ethUtil.rlphash(items);
+ };
+
+ /**
+ * returns the public key of the sender
+ * @return {Buffer}
+ */
+
+
+ Transaction.prototype.getChainId = function getChainId() {
+ return this._chainId;
+ };
+
+ /**
+ * returns the sender's address
+ * @return {Buffer}
+ */
+
+
+ Transaction.prototype.getSenderAddress = function getSenderAddress() {
+ if (this._from) {
+ return this._from;
+ }
+ var pubkey = this.getSenderPublicKey();
+ this._from = ethUtil.publicToAddress(pubkey);
+ return this._from;
+ };
+
+ /**
+ * returns the public key of the sender
+ * @return {Buffer}
+ */
+
+
+ Transaction.prototype.getSenderPublicKey = function getSenderPublicKey() {
+ if (!this._senderPubKey || !this._senderPubKey.length) {
+ if (!this.verifySignature()) throw new Error('Invalid Signature');
+ }
+ return this._senderPubKey;
+ };
+
+ /**
+ * Determines if the signature is valid
+ * @return {Boolean}
+ */
+
+
+ Transaction.prototype.verifySignature = function verifySignature() {
+ var msgHash = this.hash(false);
+ // All transaction signatures whose s-value is greater than secp256k1n/2 are considered invalid.
+ if (this._homestead && new BN(this.s).cmp(N_DIV_2) === 1) {
+ return false;
+ }
+
+ try {
+ var v = ethUtil.bufferToInt(this.v);
+ if (this._chainId > 0) {
+ v -= this._chainId * 2 + 8;
+ }
+ this._senderPubKey = ethUtil.ecrecover(msgHash, v, this.r, this.s);
+ } catch (e) {
+ return false;
+ }
+
+ return !!this._senderPubKey;
+ };
+
+ /**
+ * sign a transaction with a given a private key
+ * @param {Buffer} privateKey
+ */
+
+
+ Transaction.prototype.sign = function sign(privateKey) {
+ var msgHash = this.hash(false);
+ var sig = ethUtil.ecsign(msgHash, privateKey);
+ if (this._chainId > 0) {
+ sig.v += this._chainId * 2 + 8;
+ }
+ Object.assign(this, sig);
+ };
+
+ /**
+ * The amount of gas paid for the data in this tx
+ * @return {BN}
+ */
+
+
+ Transaction.prototype.getDataFee = function getDataFee() {
+ var data = this.raw[5];
+ var cost = new BN(0);
+ for (var i = 0; i < data.length; i++) {
+ data[i] === 0 ? cost.iaddn(fees.txDataZeroGas.v) : cost.iaddn(fees.txDataNonZeroGas.v);
+ }
+ return cost;
+ };
+
+ /**
+ * the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)
+ * @return {BN}
+ */
+
+
+ Transaction.prototype.getBaseFee = function getBaseFee() {
+ var fee = this.getDataFee().iaddn(fees.txGas.v);
+ if (this._homestead && this.toCreationAddress()) {
+ fee.iaddn(fees.txCreation.v);
+ }
+ return fee;
+ };
+
+ /**
+ * the up front amount that an account must have for this transaction to be valid
+ * @return {BN}
+ */
+
+
+ Transaction.prototype.getUpfrontCost = function getUpfrontCost() {
+ return new BN(this.gasLimit).imul(new BN(this.gasPrice)).iadd(new BN(this.value));
+ };
+
+ /**
+ * validates the signature and checks to see if it has enough gas
+ * @param {Boolean} [stringError=false] whether to return a string with a dscription of why the validation failed or return a Bloolean
+ * @return {Boolean|String}
+ */
+
+
+ Transaction.prototype.validate = function validate(stringError) {
+ var errors = [];
+ if (!this.verifySignature()) {
+ errors.push('Invalid Signature');
+ }
+
+ if (this.getBaseFee().cmp(new BN(this.gasLimit)) > 0) {
+ errors.push(['gas limit is too low. Need at least ' + this.getBaseFee()]);
+ }
+
+ if (stringError === undefined || stringError === false) {
+ return errors.length === 0;
+ } else {
+ return errors.join(' ');
+ }
+ };
+
+ return Transaction;
+}();
+
+module.exports = Transaction;
+}).call(this,require("buffer").Buffer)
+},{"buffer":113,"ethereum-common/params.json":611,"ethereumjs-util":612}],611:[function(require,module,exports){
+module.exports={
+ "genesisGasLimit": {
+ "v": 5000,
+ "d": "Gas limit of the Genesis block."
+ },
+ "genesisDifficulty": {
+ "v": 17179869184,
+ "d": "Difficulty of the Genesis block."
+ },
+ "genesisNonce": {
+ "v": "0x0000000000000042",
+ "d": "the geneis nonce"
+ },
+ "genesisExtraData": {
+ "v": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
+ "d": "extra data "
+ },
+ "genesisHash": {
+ "v": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
+ "d": "genesis hash"
+ },
+ "genesisStateRoot": {
+ "v": "0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",
+ "d": "the genesis state root"
+ },
+ "minGasLimit": {
+ "v": 5000,
+ "d": "Minimum the gas limit may ever be."
+ },
+ "gasLimitBoundDivisor": {
+ "v": 1024,
+ "d": "The bound divisor of the gas limit, used in update calculations."
+ },
+ "minimumDifficulty": {
+ "v": 131072,
+ "d": "The minimum that the difficulty may ever be."
+ },
+ "difficultyBoundDivisor": {
+ "v": 2048,
+ "d": "The bound divisor of the difficulty, used in the update calculations."
+ },
+ "durationLimit": {
+ "v": 13,
+ "d": "The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."
+ },
+ "maximumExtraDataSize": {
+ "v": 32,
+ "d": "Maximum size extra data may be after Genesis."
+ },
+ "epochDuration": {
+ "v": 30000,
+ "d": "Duration between proof-of-work epochs."
+ },
+ "stackLimit": {
+ "v": 1024,
+ "d": "Maximum size of VM stack allowed."
+ },
+ "callCreateDepth": {
+ "v": 1024,
+ "d": "Maximum depth of call/create stack."
+ },
+
+ "tierStepGas": {
+ "v": [0, 2, 3, 5, 8, 10, 20],
+ "d": "Once per operation, for a selection of them."
+ },
+ "expGas": {
+ "v": 10,
+ "d": "Once per EXP instuction."
+ },
+ "expByteGas": {
+ "v": 10,
+ "d": "Times ceil(log256(exponent)) for the EXP instruction."
+ },
+
+ "sha3Gas": {
+ "v": 30,
+ "d": "Once per SHA3 operation."
+ },
+ "sha3WordGas": {
+ "v": 6,
+ "d": "Once per word of the SHA3 operation's data."
+ },
+ "sloadGas": {
+ "v": 50,
+ "d": "Once per SLOAD operation."
+ },
+ "sstoreSetGas": {
+ "v": 20000,
+ "d": "Once per SSTORE operation if the zeroness changes from zero."
+ },
+ "sstoreResetGas": {
+ "v": 5000,
+ "d": "Once per SSTORE operation if the zeroness does not change from zero."
+ },
+ "sstoreRefundGas": {
+ "v": 15000,
+ "d": "Once per SSTORE operation if the zeroness changes to zero."
+ },
+ "jumpdestGas": {
+ "v": 1,
+ "d": "Refunded gas, once per SSTORE operation if the zeroness changes to zero."
+ },
+
+ "logGas": {
+ "v": 375,
+ "d": "Per LOG* operation."
+ },
+ "logDataGas": {
+ "v": 8,
+ "d": "Per byte in a LOG* operation's data."
+ },
+ "logTopicGas": {
+ "v": 375,
+ "d": "Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."
+ },
+
+ "createGas": {
+ "v": 32000,
+ "d": "Once per CREATE operation & contract-creation transaction."
+ },
+
+ "callGas": {
+ "v": 40,
+ "d": "Once per CALL operation & message call transaction."
+ },
+ "callStipend": {
+ "v": 2300,
+ "d": "Free gas given at beginning of call."
+ },
+ "callValueTransferGas": {
+ "v": 9000,
+ "d": "Paid for CALL when the value transfor is non-zero."
+ },
+ "callNewAccountGas": {
+ "v": 25000,
+ "d": "Paid for CALL when the destination address didn't exist prior."
+ },
+
+ "suicideRefundGas": {
+ "v": 24000,
+ "d": "Refunded following a suicide operation."
+ },
+
+ "memoryGas": {
+ "v": 3,
+ "d": "Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."
+ },
+ "quadCoeffDiv": {
+ "v": 512,
+ "d": "Divisor for the quadratic particle of the memory cost equation."
+ },
+
+ "createDataGas": {
+ "v": 200,
+ "d": ""
+ },
+ "txGas": {
+ "v": 21000,
+ "d": "Per transaction. NOTE: Not payable on data of calls between transactions."
+ },
+ "txCreation": {
+ "v": 32000,
+ "d": "the cost of creating a contract via tx"
+ },
+ "txDataZeroGas": {
+ "v": 4,
+ "d": "Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."
+ },
+ "txDataNonZeroGas": {
+ "v": 68,
+ "d": "Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."
+ },
+
+ "copyGas": {
+ "v": 3,
+ "d": "Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."
+ },
+
+ "ecrecoverGas": {
+ "v": 3000,
+ "d": ""
+ },
+ "sha256Gas": {
+ "v": 60,
+ "d": ""
+ },
+ "sha256WordGas": {
+ "v": 12,
+ "d": ""
+ },
+ "ripemd160Gas": {
+ "v": 600,
+ "d": ""
+ },
+ "ripemd160WordGas": {
+ "v": 120,
+ "d": ""
+ },
+ "identityGas": {
+ "v": 15,
+ "d": ""
+ },
+ "identityWordGas": {
+ "v": 3,
+ "d": ""
+ },
+ "minerReward": {
+ "v": "5000000000000000000",
+ "d": "the amount a miner get rewarded for mining a block"
+ },
+ "ommerReward": {
+ "v": "625000000000000000",
+ "d": "The amount of wei a miner of an uncle block gets for being inculded in the blockchain"
+ },
+ "niblingReward": {
+ "v": "156250000000000000",
+ "d": "the amount a miner gets for inculding a uncle"
+ },
+ "homeSteadForkNumber": {
+ "v": 1150000,
+ "d": "the block that the Homestead fork started at"
+ },
+ "homesteadRepriceForkNumber": {
+ "v": 2463000,
+ "d": "the block that the Homestead Reprice (EIP150) fork started at"
+ },
+ "timebombPeriod": {
+ "v": 100000,
+ "d": "Exponential difficulty timebomb period"
+ },
+ "freeBlockPeriod": {
+ "v": 2
+ }
+}
+
+},{}],612:[function(require,module,exports){
+'use strict';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
+
+var createKeccakHash = require('keccak');
+var secp256k1 = require('secp256k1');
+var assert = require('assert');
+var rlp = require('rlp');
+var BN = require('bn.js');
+var createHash = require('create-hash');
+var Buffer = require('safe-buffer').Buffer;
+Object.assign(exports, require('ethjs-util'));
+
+/**
+ * the max integer that this VM can handle (a ```BN```)
+ * @var {BN} MAX_INTEGER
+ */
+exports.MAX_INTEGER = new BN('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
+
+/**
+ * 2^256 (a ```BN```)
+ * @var {BN} TWO_POW256
+ */
+exports.TWO_POW256 = new BN('10000000000000000000000000000000000000000000000000000000000000000', 16);
+
+/**
+ * Keccak-256 hash of null (a ```String```)
+ * @var {String} KECCAK256_NULL_S
+ */
+exports.KECCAK256_NULL_S = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470';
+exports.SHA3_NULL_S = exports.KECCAK256_NULL_S;
+
+/**
+ * Keccak-256 hash of null (a ```Buffer```)
+ * @var {Buffer} KECCAK256_NULL
+ */
+exports.KECCAK256_NULL = Buffer.from(exports.KECCAK256_NULL_S, 'hex');
+exports.SHA3_NULL = exports.KECCAK256_NULL;
+
+/**
+ * Keccak-256 of an RLP of an empty array (a ```String```)
+ * @var {String} KECCAK256_RLP_ARRAY_S
+ */
+exports.KECCAK256_RLP_ARRAY_S = '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347';
+exports.SHA3_RLP_ARRAY_S = exports.KECCAK256_RLP_ARRAY_S;
+
+/**
+ * Keccak-256 of an RLP of an empty array (a ```Buffer```)
+ * @var {Buffer} KECCAK256_RLP_ARRAY
+ */
+exports.KECCAK256_RLP_ARRAY = Buffer.from(exports.KECCAK256_RLP_ARRAY_S, 'hex');
+exports.SHA3_RLP_ARRAY = exports.KECCAK256_RLP_ARRAY;
+
+/**
+ * Keccak-256 hash of the RLP of null (a ```String```)
+ * @var {String} KECCAK256_RLP_S
+ */
+exports.KECCAK256_RLP_S = '56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421';
+exports.SHA3_RLP_S = exports.KECCAK256_RLP_S;
+
+/**
+ * Keccak-256 hash of the RLP of null (a ```Buffer```)
+ * @var {Buffer} KECCAK256_RLP
+ */
+exports.KECCAK256_RLP = Buffer.from(exports.KECCAK256_RLP_S, 'hex');
+exports.SHA3_RLP = exports.KECCAK256_RLP;
+
+/**
+ * [`BN`](https://github.com/indutny/bn.js)
+ * @var {Function}
+ */
+exports.BN = BN;
+
+/**
+ * [`rlp`](https://github.com/ethereumjs/rlp)
+ * @var {Function}
+ */
+exports.rlp = rlp;
+
+/**
+ * [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
+ * @var {Object}
+ */
+exports.secp256k1 = secp256k1;
+
+/**
+ * Returns a buffer filled with 0s
+ * @method zeros
+ * @param {Number} bytes the number of bytes the buffer should be
+ * @return {Buffer}
+ */
+exports.zeros = function (bytes) {
+ return Buffer.allocUnsafe(bytes).fill(0);
+};
+
+/**
+ * Returns a zero address
+ * @method zeroAddress
+ * @return {String}
+ */
+exports.zeroAddress = function () {
+ var addressLength = 20;
+ var zeroAddress = exports.zeros(addressLength);
+ return exports.bufferToHex(zeroAddress);
+};
+
+/**
+ * Left Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
+ * Or it truncates the beginning if it exceeds.
+ * @method lsetLength
+ * @param {Buffer|Array} msg the value to pad
+ * @param {Number} length the number of bytes the output should be
+ * @param {Boolean} [right=false] whether to start padding form the left or right
+ * @return {Buffer|Array}
+ */
+exports.setLengthLeft = exports.setLength = function (msg, length, right) {
+ var buf = exports.zeros(length);
+ msg = exports.toBuffer(msg);
+ if (right) {
+ if (msg.length < length) {
+ msg.copy(buf);
+ return buf;
+ }
+ return msg.slice(0, length);
+ } else {
+ if (msg.length < length) {
+ msg.copy(buf, length - msg.length);
+ return buf;
+ }
+ return msg.slice(-length);
+ }
+};
+
+/**
+ * Right Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
+ * Or it truncates the beginning if it exceeds.
+ * @param {Buffer|Array} msg the value to pad
+ * @param {Number} length the number of bytes the output should be
+ * @return {Buffer|Array}
+ */
+exports.setLengthRight = function (msg, length) {
+ return exports.setLength(msg, length, true);
+};
+
+/**
+ * Trims leading zeros from a `Buffer` or an `Array`
+ * @param {Buffer|Array|String} a
+ * @return {Buffer|Array|String}
+ */
+exports.unpad = exports.stripZeros = function (a) {
+ a = exports.stripHexPrefix(a);
+ var first = a[0];
+ while (a.length > 0 && first.toString() === '0') {
+ a = a.slice(1);
+ first = a[0];
+ }
+ return a;
+};
+/**
+ * Attempts to turn a value into a `Buffer`. As input it supports `Buffer`, `String`, `Number`, null/undefined, `BN` and other objects with a `toArray()` method.
+ * @param {*} v the value
+ */
+exports.toBuffer = function (v) {
+ if (!Buffer.isBuffer(v)) {
+ if (Array.isArray(v)) {
+ v = Buffer.from(v);
+ } else if (typeof v === 'string') {
+ if (exports.isHexString(v)) {
+ v = Buffer.from(exports.padToEven(exports.stripHexPrefix(v)), 'hex');
+ } else {
+ v = Buffer.from(v);
+ }
+ } else if (typeof v === 'number') {
+ v = exports.intToBuffer(v);
+ } else if (v === null || v === undefined) {
+ v = Buffer.allocUnsafe(0);
+ } else if (BN.isBN(v)) {
+ v = v.toArrayLike(Buffer);
+ } else if (v.toArray) {
+ // converts a BN to a Buffer
+ v = Buffer.from(v.toArray());
+ } else {
+ throw new Error('invalid type');
+ }
+ }
+ return v;
+};
+
+/**
+ * Converts a `Buffer` to a `Number`
+ * @param {Buffer} buf
+ * @return {Number}
+ * @throws If the input number exceeds 53 bits.
+ */
+exports.bufferToInt = function (buf) {
+ return new BN(exports.toBuffer(buf)).toNumber();
+};
+
+/**
+ * Converts a `Buffer` into a hex `String`
+ * @param {Buffer} buf
+ * @return {String}
+ */
+exports.bufferToHex = function (buf) {
+ buf = exports.toBuffer(buf);
+ return '0x' + buf.toString('hex');
+};
+
+/**
+ * Interprets a `Buffer` as a signed integer and returns a `BN`. Assumes 256-bit numbers.
+ * @param {Buffer} num
+ * @return {BN}
+ */
+exports.fromSigned = function (num) {
+ return new BN(num).fromTwos(256);
+};
+
+/**
+ * Converts a `BN` to an unsigned integer and returns it as a `Buffer`. Assumes 256-bit numbers.
+ * @param {BN} num
+ * @return {Buffer}
+ */
+exports.toUnsigned = function (num) {
+ return Buffer.from(num.toTwos(256).toArray());
+};
+
+/**
+ * Creates Keccak hash of the input
+ * @param {Buffer|Array|String|Number} a the input data
+ * @param {Number} [bits=256] the Keccak width
+ * @return {Buffer}
+ */
+exports.keccak = function (a, bits) {
+ a = exports.toBuffer(a);
+ if (!bits) bits = 256;
+
+ return createKeccakHash('keccak' + bits).update(a).digest();
+};
+
+/**
+ * Creates Keccak-256 hash of the input, alias for keccak(a, 256)
+ * @param {Buffer|Array|String|Number} a the input data
+ * @return {Buffer}
+ */
+exports.keccak256 = function (a) {
+ return exports.keccak(a);
+};
+
+/**
+ * Creates SHA-3 (Keccak) hash of the input [OBSOLETE]
+ * @param {Buffer|Array|String|Number} a the input data
+ * @param {Number} [bits=256] the SHA-3 width
+ * @return {Buffer}
+ */
+exports.sha3 = exports.keccak;
+
+/**
+ * Creates SHA256 hash of the input
+ * @param {Buffer|Array|String|Number} a the input data
+ * @return {Buffer}
+ */
+exports.sha256 = function (a) {
+ a = exports.toBuffer(a);
+ return createHash('sha256').update(a).digest();
+};
+
+/**
+ * Creates RIPEMD160 hash of the input
+ * @param {Buffer|Array|String|Number} a the input data
+ * @param {Boolean} padded whether it should be padded to 256 bits or not
+ * @return {Buffer}
+ */
+exports.ripemd160 = function (a, padded) {
+ a = exports.toBuffer(a);
+ var hash = createHash('rmd160').update(a).digest();
+ if (padded === true) {
+ return exports.setLength(hash, 32);
+ } else {
+ return hash;
+ }
+};
+
+/**
+ * Creates SHA-3 hash of the RLP encoded version of the input
+ * @param {Buffer|Array|String|Number} a the input data
+ * @return {Buffer}
+ */
+exports.rlphash = function (a) {
+ return exports.keccak(rlp.encode(a));
+};
+
+/**
+ * Checks if the private key satisfies the rules of the curve secp256k1.
+ * @param {Buffer} privateKey
+ * @return {Boolean}
+ */
+exports.isValidPrivate = function (privateKey) {
+ return secp256k1.privateKeyVerify(privateKey);
+};
+
+/**
+ * Checks if the public key satisfies the rules of the curve secp256k1
+ * and the requirements of Ethereum.
+ * @param {Buffer} publicKey The two points of an uncompressed key, unless sanitize is enabled
+ * @param {Boolean} [sanitize=false] Accept public keys in other formats
+ * @return {Boolean}
+ */
+exports.isValidPublic = function (publicKey, sanitize) {
+ if (publicKey.length === 64) {
+ // Convert to SEC1 for secp256k1
+ return secp256k1.publicKeyVerify(Buffer.concat([Buffer.from([4]), publicKey]));
+ }
+
+ if (!sanitize) {
+ return false;
+ }
+
+ return secp256k1.publicKeyVerify(publicKey);
+};
+
+/**
+ * Returns the ethereum address of a given public key.
+ * Accepts "Ethereum public keys" and SEC1 encoded keys.
+ * @param {Buffer} pubKey The two points of an uncompressed key, unless sanitize is enabled
+ * @param {Boolean} [sanitize=false] Accept public keys in other formats
+ * @return {Buffer}
+ */
+exports.pubToAddress = exports.publicToAddress = function (pubKey, sanitize) {
+ pubKey = exports.toBuffer(pubKey);
+ if (sanitize && pubKey.length !== 64) {
+ pubKey = secp256k1.publicKeyConvert(pubKey, false).slice(1);
+ }
+ assert(pubKey.length === 64);
+ // Only take the lower 160bits of the hash
+ return exports.keccak(pubKey).slice(-20);
+};
+
+/**
+ * Returns the ethereum public key of a given private key
+ * @param {Buffer} privateKey A private key must be 256 bits wide
+ * @return {Buffer}
+ */
+var privateToPublic = exports.privateToPublic = function (privateKey) {
+ privateKey = exports.toBuffer(privateKey);
+ // skip the type flag and use the X, Y points
+ return secp256k1.publicKeyCreate(privateKey, false).slice(1);
+};
+
+/**
+ * Converts a public key to the Ethereum format.
+ * @param {Buffer} publicKey
+ * @return {Buffer}
+ */
+exports.importPublic = function (publicKey) {
+ publicKey = exports.toBuffer(publicKey);
+ if (publicKey.length !== 64) {
+ publicKey = secp256k1.publicKeyConvert(publicKey, false).slice(1);
+ }
+ return publicKey;
+};
+
+/**
+ * ECDSA sign
+ * @param {Buffer} msgHash
+ * @param {Buffer} privateKey
+ * @return {Object}
+ */
+exports.ecsign = function (msgHash, privateKey) {
+ var sig = secp256k1.sign(msgHash, privateKey);
+
+ var ret = {};
+ ret.r = sig.signature.slice(0, 32);
+ ret.s = sig.signature.slice(32, 64);
+ ret.v = sig.recovery + 27;
+ return ret;
+};
+
+/**
+ * Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call.
+ * The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign`
+ * call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key
+ * used to produce the signature.
+ * @param message
+ * @returns {Buffer} hash
+ */
+exports.hashPersonalMessage = function (message) {
+ var prefix = exports.toBuffer('\x19Ethereum Signed Message:\n' + message.length.toString());
+ return exports.keccak(Buffer.concat([prefix, message]));
+};
+
+/**
+ * ECDSA public key recovery from signature
+ * @param {Buffer} msgHash
+ * @param {Number} v
+ * @param {Buffer} r
+ * @param {Buffer} s
+ * @return {Buffer} publicKey
+ */
+exports.ecrecover = function (msgHash, v, r, s) {
+ var signature = Buffer.concat([exports.setLength(r, 32), exports.setLength(s, 32)], 64);
+ var recovery = v - 27;
+ if (recovery !== 0 && recovery !== 1) {
+ throw new Error('Invalid signature v value');
+ }
+ var senderPubKey = secp256k1.recover(msgHash, signature, recovery);
+ return secp256k1.publicKeyConvert(senderPubKey, false).slice(1);
+};
+
+/**
+ * Convert signature parameters into the format of `eth_sign` RPC method
+ * @param {Number} v
+ * @param {Buffer} r
+ * @param {Buffer} s
+ * @return {String} sig
+ */
+exports.toRpcSig = function (v, r, s) {
+ // NOTE: with potential introduction of chainId this might need to be updated
+ if (v !== 27 && v !== 28) {
+ throw new Error('Invalid recovery id');
+ }
+
+ // geth (and the RPC eth_sign method) uses the 65 byte format used by Bitcoin
+ // FIXME: this might change in the future - https://github.com/ethereum/go-ethereum/issues/2053
+ return exports.bufferToHex(Buffer.concat([exports.setLengthLeft(r, 32), exports.setLengthLeft(s, 32), exports.toBuffer(v - 27)]));
+};
+
+/**
+ * Convert signature format of the `eth_sign` RPC method to signature parameters
+ * NOTE: all because of a bug in geth: https://github.com/ethereum/go-ethereum/issues/2053
+ * @param {String} sig
+ * @return {Object}
+ */
+exports.fromRpcSig = function (sig) {
+ sig = exports.toBuffer(sig);
+
+ // NOTE: with potential introduction of chainId this might need to be updated
+ if (sig.length !== 65) {
+ throw new Error('Invalid signature length');
+ }
+
+ var v = sig[64];
+ // support both versions of `eth_sign` responses
+ if (v < 27) {
+ v += 27;
+ }
+
+ return {
+ v: v,
+ r: sig.slice(0, 32),
+ s: sig.slice(32, 64)
+ };
+};
+
+/**
+ * Returns the ethereum address of a given private key
+ * @param {Buffer} privateKey A private key must be 256 bits wide
+ * @return {Buffer}
+ */
+exports.privateToAddress = function (privateKey) {
+ return exports.publicToAddress(privateToPublic(privateKey));
+};
+
+/**
+ * Checks if the address is a valid. Accepts checksummed addresses too
+ * @param {String} address
+ * @return {Boolean}
+ */
+exports.isValidAddress = function (address) {
+ return (/^0x[0-9a-fA-F]{40}$/.test(address)
+ );
+};
+
+/**
+ * Checks if a given address is a zero address
+ * @method isZeroAddress
+ * @param {String} address
+ * @return {Boolean}
+ */
+exports.isZeroAddress = function (address) {
+ var zeroAddress = exports.zeroAddress();
+ return zeroAddress === exports.addHexPrefix(address);
+};
+
+/**
+ * Returns a checksummed address
+ * @param {String} address
+ * @return {String}
+ */
+exports.toChecksumAddress = function (address) {
+ address = exports.stripHexPrefix(address).toLowerCase();
+ var hash = exports.keccak(address).toString('hex');
+ var ret = '0x';
+
+ for (var i = 0; i < address.length; i++) {
+ if (parseInt(hash[i], 16) >= 8) {
+ ret += address[i].toUpperCase();
+ } else {
+ ret += address[i];
+ }
+ }
+
+ return ret;
+};
+
+/**
+ * Checks if the address is a valid checksummed address
+ * @param {Buffer} address
+ * @return {Boolean}
+ */
+exports.isValidChecksumAddress = function (address) {
+ return exports.isValidAddress(address) && exports.toChecksumAddress(address) === address;
+};
+
+/**
+ * Generates an address of a newly created contract
+ * @param {Buffer} from the address which is creating this new address
+ * @param {Buffer} nonce the nonce of the from account
+ * @return {Buffer}
+ */
+exports.generateAddress = function (from, nonce) {
+ from = exports.toBuffer(from);
+ nonce = new BN(nonce);
+
+ if (nonce.isZero()) {
+ // in RLP we want to encode null in the case of zero nonce
+ // read the RLP documentation for an answer if you dare
+ nonce = null;
+ } else {
+ nonce = Buffer.from(nonce.toArray());
+ }
+
+ // Only take the lower 160bits of the hash
+ return exports.rlphash([from, nonce]).slice(-20);
+};
+
+/**
+ * Returns true if the supplied address belongs to a precompiled account (Byzantium)
+ * @param {Buffer|String} address
+ * @return {Boolean}
+ */
+exports.isPrecompiled = function (address) {
+ var a = exports.unpad(address);
+ return a.length === 1 && a[0] >= 1 && a[0] <= 8;
+};
+
+/**
+ * Adds "0x" to a given `String` if it does not already start with "0x"
+ * @param {String} str
+ * @return {String}
+ */
+exports.addHexPrefix = function (str) {
+ if (typeof str !== 'string') {
+ return str;
+ }
+
+ return exports.isHexPrefixed(str) ? str : '0x' + str;
+};
+
+/**
+ * Validate ECDSA signature
+ * @method isValidSignature
+ * @param {Buffer} v
+ * @param {Buffer} r
+ * @param {Buffer} s
+ * @param {Boolean} [homestead=true]
+ * @return {Boolean}
+ */
+
+exports.isValidSignature = function (v, r, s, homestead) {
+ var SECP256K1_N_DIV_2 = new BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16);
+ var SECP256K1_N = new BN('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', 16);
+
+ if (r.length !== 32 || s.length !== 32) {
+ return false;
+ }
+
+ if (v !== 27 && v !== 28) {
+ return false;
+ }
+
+ r = new BN(r);
+ s = new BN(s);
+
+ if (r.isZero() || r.gt(SECP256K1_N) || s.isZero() || s.gt(SECP256K1_N)) {
+ return false;
+ }
+
+ if (homestead === false && new BN(s).cmp(SECP256K1_N_DIV_2) === 1) {
+ return false;
+ }
+
+ return true;
+};
+
+/**
+ * Converts a `Buffer` or `Array` to JSON
+ * @param {Buffer|Array} ba
+ * @return {Array|String|null}
+ */
+exports.baToJSON = function (ba) {
+ if (Buffer.isBuffer(ba)) {
+ return '0x' + ba.toString('hex');
+ } else if (ba instanceof Array) {
+ var array = [];
+ for (var i = 0; i < ba.length; i++) {
+ array.push(exports.baToJSON(ba[i]));
+ }
+ return array;
+ }
+};
+
+/**
+ * Defines properties on a `Object`. It make the assumption that underlying data is binary.
+ * @param {Object} self the `Object` to define properties on
+ * @param {Array} fields an array fields to define. Fields can contain:
+ * * `name` - the name of the properties
+ * * `length` - the number of bytes the field can have
+ * * `allowLess` - if the field can be less than the length
+ * * `allowEmpty`
+ * @param {*} data data to be validated against the definitions
+ */
+exports.defineProperties = function (self, fields, data) {
+ self.raw = [];
+ self._fields = [];
+
+ // attach the `toJSON`
+ self.toJSON = function (label) {
+ if (label) {
+ var obj = {};
+ self._fields.forEach(function (field) {
+ obj[field] = '0x' + self[field].toString('hex');
+ });
+ return obj;
+ }
+ return exports.baToJSON(this.raw);
+ };
+
+ self.serialize = function serialize() {
+ return rlp.encode(self.raw);
+ };
+
+ fields.forEach(function (field, i) {
+ self._fields.push(field.name);
+ function getter() {
+ return self.raw[i];
+ }
+ function setter(v) {
+ v = exports.toBuffer(v);
+
+ if (v.toString('hex') === '00' && !field.allowZero) {
+ v = Buffer.allocUnsafe(0);
+ }
+
+ if (field.allowLess && field.length) {
+ v = exports.stripZeros(v);
+ assert(field.length >= v.length, 'The field ' + field.name + ' must not have more ' + field.length + ' bytes');
+ } else if (!(field.allowZero && v.length === 0) && field.length) {
+ assert(field.length === v.length, 'The field ' + field.name + ' must have byte length of ' + field.length);
+ }
+
+ self.raw[i] = v;
+ }
+
+ Object.defineProperty(self, field.name, {
+ enumerable: true,
+ configurable: true,
+ get: getter,
+ set: setter
+ });
+
+ if (field.default) {
+ self[field.name] = field.default;
+ }
+
+ // attach alias
+ if (field.alias) {
+ Object.defineProperty(self, field.alias, {
+ enumerable: false,
+ configurable: true,
+ set: setter,
+ get: getter
+ });
+ }
+ });
+
+ // if the constuctor is passed data
+ if (data) {
+ if (typeof data === 'string') {
+ data = Buffer.from(exports.stripHexPrefix(data), 'hex');
+ }
+
+ if (Buffer.isBuffer(data)) {
+ data = rlp.decode(data);
+ }
+
+ if (Array.isArray(data)) {
+ if (data.length > self._fields.length) {
+ throw new Error('wrong number of fields in data');
+ }
+
+ // make sure all the items are buffers
+ data.forEach(function (d, i) {
+ self[self._fields[i]] = exports.toBuffer(d);
+ });
+ } else if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object') {
+ var keys = Object.keys(data);
+ fields.forEach(function (field) {
+ if (keys.indexOf(field.name) !== -1) self[field.name] = data[field.name];
+ if (keys.indexOf(field.alias) !== -1) self[field.alias] = data[field.alias];
+ });
+ } else {
+ throw new Error('invalid data');
+ }
+ }
+};
+},{"assert":35,"bn.js":66,"create-hash":466,"ethjs-util":707,"keccak":868,"rlp":1331,"safe-buffer":1334,"secp256k1":1339}],613:[function(require,module,exports){
+'use strict';
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var assert = require('assert');
+var utils = require('ethereumjs-util');
+
+var BYTE_SIZE = 256;
+
+module.exports = function () {
+ /**
+ * Represents a Bloom
+ * @constructor
+ * @param {Buffer} bitvector
+ */
+ function Bloom(bitvector) {
+ _classCallCheck(this, Bloom);
+
+ if (!bitvector) {
+ this.bitvector = utils.zeros(BYTE_SIZE);
+ } else {
+ assert(bitvector.length === BYTE_SIZE, 'bitvectors must be 2048 bits long');
+ this.bitvector = bitvector;
+ }
+ }
+
+ /**
+ * adds an element to a bit vector of a 64 byte bloom filter
+ * @method add
+ * @param {Buffer} e the element to add
+ */
+
+
+ _createClass(Bloom, [{
+ key: 'add',
+ value: function add(e) {
+ e = utils.keccak256(e);
+ var mask = 2047; // binary 11111111111
+
+ for (var i = 0; i < 3; i++) {
+ var first2bytes = e.readUInt16BE(i * 2);
+ var loc = mask & first2bytes;
+ var byteLoc = loc >> 3;
+ var bitLoc = 1 << loc % 8;
+ this.bitvector[BYTE_SIZE - byteLoc - 1] |= bitLoc;
+ }
+ }
+
+ /**
+ * checks if an element is in the bloom
+ * @method check
+ * @param {Buffer} e the element to check
+ * @returns {boolean} Returns {@code true} if the element is in the bloom
+ */
+
+ }, {
+ key: 'check',
+ value: function check(e) {
+ e = utils.keccak256(e);
+ var mask = 2047; // binary 11111111111
+ var match = true;
+
+ for (var i = 0; i < 3 && match; i++) {
+ var first2bytes = e.readUInt16BE(i * 2);
+ var loc = mask & first2bytes;
+ var byteLoc = loc >> 3;
+ var bitLoc = 1 << loc % 8;
+ match = this.bitvector[BYTE_SIZE - byteLoc - 1] & bitLoc;
+ }
+
+ return Boolean(match);
+ }
+
+ /**
+ * checks if multiple topics are in a bloom
+ * @method multiCheck
+ * @param {Buffer} topics
+ * @returns {boolean} Returns {@code true} if every topic is in the bloom
+ */
+
+ }, {
+ key: 'multiCheck',
+ value: function multiCheck(topics) {
+ var _this = this;
+
+ return topics.every(function (t) {
+ return _this.check(t);
+ });
+ }
+
+ /**
+ * bitwise or blooms together
+ * @method or
+ * @param {Bloom} bloom
+ */
+
+ }, {
+ key: 'or',
+ value: function or(bloom) {
+ if (bloom) {
+ for (var i = 0; i <= BYTE_SIZE; i++) {
+ this.bitvector[i] = this.bitvector[i] | bloom.bitvector[i];
+ }
+ }
+ }
+ }]);
+
+ return Bloom;
+}();
+},{"assert":35,"ethereumjs-util":640}],614:[function(require,module,exports){
+'use strict';
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var Buffer = require('safe-buffer').Buffer;
+var Tree = require('functional-red-black-tree');
+var Account = require('ethereumjs-account');
+var async = require('async');
+
+module.exports = function () {
+ function Cache(trie) {
+ _classCallCheck(this, Cache);
+
+ this._cache = Tree();
+ this._checkpoints = [];
+ this._trie = trie;
+ }
+
+ /**
+ * Puts account to cache under its address.
+ * @param {Buffer} key - Address of account
+ * @param {Account} val - Account
+ * @param {bool} [fromTrie]
+ */
+
+
+ _createClass(Cache, [{
+ key: 'put',
+ value: function put(key, val) {
+ var fromTrie = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+
+ var modified = !fromTrie;
+ this._update(key, val, modified, false);
+ }
+
+ /**
+ * Returns the queried account or an empty account.
+ * @param {Buffer} key - Address of account
+ */
+
+ }, {
+ key: 'get',
+ value: function get(key) {
+ var account = this.lookup(key);
+ if (!account) {
+ account = new Account();
+ }
+ return account;
+ }
+
+ /**
+ * Returns the queried account or undefined.
+ * @param {buffer} key - Address of account
+ */
+
+ }, {
+ key: 'lookup',
+ value: function lookup(key) {
+ key = key.toString('hex');
+
+ var it = this._cache.find(key);
+ if (it.node) {
+ var account = new Account(it.value.val);
+ return account;
+ }
+ }
+
+ /**
+ * Looks up address in underlying trie.
+ * @param {Buffer} address - Address of account
+ * @param {Function} cb - Callback with params (err, account)
+ */
+
+ }, {
+ key: '_lookupAccount',
+ value: function _lookupAccount(address, cb) {
+ this._trie.get(address, function (err, raw) {
+ if (err) return cb(err);
+ var account = new Account(raw);
+ cb(null, account);
+ });
+ }
+
+ /**
+ * Looks up address in cache, if not found, looks it up
+ * in the underlying trie.
+ * @param {Buffer} key - Address of account
+ * @param {Function} cb - Callback with params (err, account)
+ */
+
+ }, {
+ key: 'getOrLoad',
+ value: function getOrLoad(key, cb) {
+ var _this = this;
+
+ var account = this.lookup(key);
+ if (account) {
+ async.nextTick(cb, null, account);
+ } else {
+ this._lookupAccount(key, function (err, account) {
+ if (err) return cb(err);
+ _this._update(key, account, false, false);
+ cb(null, account);
+ });
+ }
+ }
+
+ /**
+ * Warms cache by loading their respective account from trie
+ * and putting them in cache.
+ * @param {Array} addresses - Array of addresses
+ * @param {Function} cb - Callback
+ */
+
+ }, {
+ key: 'warm',
+ value: function warm(addresses, cb) {
+ var _this2 = this;
+
+ // shim till async supports iterators
+ var accountArr = [];
+ addresses.forEach(function (val) {
+ if (val) accountArr.push(val);
+ });
+
+ async.eachSeries(accountArr, function (addressHex, done) {
+ var address = Buffer.from(addressHex, 'hex');
+ _this2._lookupAccount(address, function (err, account) {
+ if (err) return done(err);
+ _this2._update(address, account, false, false);
+ done();
+ });
+ }, cb);
+ }
+
+ /**
+ * Flushes cache by updating accounts that have been modified
+ * and removing accounts that have been deleted.
+ * @param {function} cb - Callback
+ */
+
+ }, {
+ key: 'flush',
+ value: function flush(cb) {
+ var _this3 = this;
+
+ var it = this._cache.begin;
+ var next = true;
+ async.whilst(function () {
+ return next;
+ }, function (done) {
+ if (it.value && it.value.modified) {
+ it.value.modified = false;
+ it.value.val = it.value.val.serialize();
+ _this3._trie.put(Buffer.from(it.key, 'hex'), it.value.val, function () {
+ next = it.hasNext;
+ it.next();
+ done();
+ });
+ } else if (it.value && it.value.deleted) {
+ it.value.modified = false;
+ it.value.deleted = false;
+ it.value.val = new Account().serialize();
+ _this3._trie.del(Buffer.from(it.key, 'hex'), function () {
+ next = it.hasNext;
+ it.next();
+ done();
+ });
+ } else {
+ next = it.hasNext;
+ it.next();
+ async.nextTick(done);
+ }
+ }, cb);
+ }
+
+ /**
+ * Marks current state of cache as checkpoint, which can
+ * later on be reverted or commited.
+ */
+
+ }, {
+ key: 'checkpoint',
+ value: function checkpoint() {
+ this._checkpoints.push(this._cache);
+ }
+
+ /**
+ * Revert changes to cache last checkpoint (no effect on trie).
+ */
+
+ }, {
+ key: 'revert',
+ value: function revert() {
+ this._cache = this._checkpoints.pop();
+ }
+
+ /**
+ * Commits to current state of cache (no effect on trie).
+ */
+
+ }, {
+ key: 'commit',
+ value: function commit() {
+ this._checkpoints.pop();
+ }
+
+ /**
+ * Clears cache.
+ */
+
+ }, {
+ key: 'clear',
+ value: function clear() {
+ this._cache = Tree();
+ }
+
+ /**
+ * Marks address as deleted in cache.
+ * @params {Buffer} key - Address
+ */
+
+ }, {
+ key: 'del',
+ value: function del(key) {
+ this._update(key, new Account(), false, true);
+ }
+ }, {
+ key: '_update',
+ value: function _update(key, val, modified, deleted) {
+ key = key.toString('hex');
+ var it = this._cache.find(key);
+ if (it.node) {
+ this._cache = it.update({
+ val: val,
+ modified: modified,
+ deleted: deleted
+ });
+ } else {
+ this._cache = this._cache.insert(key, {
+ val: val,
+ modified: modified,
+ deleted: deleted
+ });
+ }
+ }
+ }]);
+
+ return Cache;
+}();
+},{"async":42,"ethereumjs-account":585,"functional-red-black-tree":725,"safe-buffer":1334}],615:[function(require,module,exports){
+'use strict';
+
+var ERROR = {
+ OUT_OF_GAS: 'out of gas',
+ STACK_UNDERFLOW: 'stack underflow',
+ STACK_OVERFLOW: 'stack overflow',
+ INVALID_JUMP: 'invalid JUMP',
+ INVALID_OPCODE: 'invalid opcode',
+ REVERT: 'revert',
+ STATIC_STATE_CHANGE: 'static state change',
+ INTERNAL_ERROR: 'internal error'
+};
+
+function VmError(error) {
+ this.error = error;
+ this.errorType = 'VmError';
+}
+
+module.exports = {
+ ERROR: ERROR,
+ VmError: VmError
+};
+},{}],616:[function(require,module,exports){
+'use strict';
+
+var Buffer = require('safe-buffer').Buffer;
+var utils = require('ethereumjs-util');
+
+module.exports = {
+ fake: true,
+ getBlock: function getBlock(blockTag, cb) {
+ var _hash;
+
+ if (Buffer.isBuffer(blockTag)) {
+ _hash = utils.keccak256(blockTag);
+ } else if (Number.isInteger(blockTag)) {
+ _hash = utils.keccak256('0x' + utils.toBuffer(blockTag).toString('hex'));
+ } else {
+ return cb(new Error('Unknown blockTag type'));
+ }
+
+ var block = {
+ hash: function hash() {
+ return _hash;
+ }
+ };
+
+ cb(null, block);
+ },
+
+ delBlock: function delBlock(hash, cb) {
+ cb(null);
+ },
+
+ iterator: function iterator(name, onBlock, cb) {
+ cb(null);
+ }
+};
+},{"ethereumjs-util":640,"safe-buffer":1334}],617:[function(require,module,exports){
+'use strict';
+
+var Buffer = require('safe-buffer').Buffer;
+var util = require('util');
+var ethUtil = require('ethereumjs-util');
+var StateManager = require('./stateManager.js');
+var Common = require('ethereumjs-common').default;
+var Account = require('ethereumjs-account');
+var AsyncEventEmitter = require('async-eventemitter');
+var Trie = require('merkle-patricia-tree/secure.js');
+var fakeBlockchain = require('./fakeBlockChain.js');
+var BN = ethUtil.BN;
+
+// require the precompiled contracts
+var num01 = require('./precompiled/01-ecrecover.js');
+var num02 = require('./precompiled/02-sha256.js');
+var num03 = require('./precompiled/03-ripemd160.js');
+var num04 = require('./precompiled/04-identity.js');
+var num05 = require('./precompiled/05-modexp.js');
+var num06 = require('./precompiled/06-ecadd.js');
+var num07 = require('./precompiled/07-ecmul.js');
+var num08 = require('./precompiled/08-ecpairing.js');
+
+module.exports = VM;
+
+VM.deps = {
+ ethUtil: ethUtil,
+ Account: require('ethereumjs-account'),
+ Trie: require('merkle-patricia-tree'),
+ rlp: require('ethereumjs-util').rlp
+
+ /**
+ * VM Class, `new VM(opts)` creates a new VM object
+ * @method VM
+ * @param {Object} opts
+ * @param {StateManager} opts.stateManager a [`StateManager`](stateManager.md) instance to use as the state store (Beta API)
+ * @param {Trie} opts.state a merkle-patricia-tree instance for the state tree (ignored if stateManager is passed)
+ * @param {Blockchain} opts.blockchain a blockchain object for storing/retrieving blocks (ignored if stateManager is passed)
+ * @param {String|Number} opts.chain the chain the VM operates on [default: 'mainnet']
+ * @param {String} opts.hardfork hardfork rules to be used [default: 'byzantium', supported: 'byzantium', 'constantinople', 'petersburg' (will throw on unsupported)]
+ * @param {Boolean} opts.activatePrecompiles create entries in the state tree for the precompiled contracts
+ * @param {Boolean} opts.allowUnlimitedContractSize allows unlimited contract sizes while debugging. By setting this to `true`, the check for contract size limit of 24KB (see [EIP-170](https://git.io/vxZkK)) is bypassed. (default: `false`; ONLY set to `true` during debugging)
+ * @param {Boolean} opts.emitFreeLogs Changes the behavior of the LOG opcode, the gas cost of the opcode becomes zero and calling it using STATICCALL won't throw. (default: `false`; ONLY set to `true` during debugging)
+ */
+};function VM() {
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ this.opts = opts;
+
+ var chain = opts.chain ? opts.chain : 'mainnet';
+ var hardfork = opts.hardfork ? opts.hardfork : 'byzantium';
+ var supportedHardforks = ['byzantium', 'constantinople', 'petersburg'];
+ this._common = new Common(chain, hardfork, supportedHardforks);
+
+ if (opts.stateManager) {
+ this.stateManager = opts.stateManager;
+ } else {
+ var trie = opts.state || new Trie();
+ if (opts.activatePrecompiles) {
+ for (var i = 1; i <= 8; i++) {
+ trie.put(new BN(i).toArrayLike(Buffer, 'be', 20), new Account().serialize());
+ }
+ }
+ this.stateManager = new StateManager({ trie: trie, common: this._common });
+ }
+
+ this.blockchain = opts.blockchain || fakeBlockchain;
+
+ this.allowUnlimitedContractSize = opts.allowUnlimitedContractSize === undefined ? false : opts.allowUnlimitedContractSize;
+ this.emitFreeLogs = opts.emitFreeLogs === undefined ? false : opts.emitFreeLogs;
+
+ // precompiled contracts
+ this._precompiled = {};
+ this._precompiled['0000000000000000000000000000000000000001'] = num01;
+ this._precompiled['0000000000000000000000000000000000000002'] = num02;
+ this._precompiled['0000000000000000000000000000000000000003'] = num03;
+ this._precompiled['0000000000000000000000000000000000000004'] = num04;
+ this._precompiled['0000000000000000000000000000000000000005'] = num05;
+ this._precompiled['0000000000000000000000000000000000000006'] = num06;
+ this._precompiled['0000000000000000000000000000000000000007'] = num07;
+ this._precompiled['0000000000000000000000000000000000000008'] = num08;
+
+ AsyncEventEmitter.call(this);
+}
+
+util.inherits(VM, AsyncEventEmitter);
+
+VM.prototype.runCode = require('./runCode.js');
+VM.prototype.runJIT = require('./runJit.js');
+VM.prototype.runBlock = require('./runBlock.js');
+VM.prototype.runTx = require('./runTx.js');
+VM.prototype.runCall = require('./runCall.js');
+VM.prototype.runBlockchain = require('./runBlockchain.js');
+
+VM.prototype.copy = function () {
+ return new VM({ stateManager: this.stateManager.copy(), blockchain: this.blockchain });
+};
+},{"./fakeBlockChain.js":616,"./precompiled/01-ecrecover.js":618,"./precompiled/02-sha256.js":619,"./precompiled/03-ripemd160.js":620,"./precompiled/04-identity.js":621,"./precompiled/05-modexp.js":622,"./precompiled/06-ecadd.js":623,"./precompiled/07-ecmul.js":624,"./precompiled/08-ecpairing.js":625,"./runBlock.js":626,"./runBlockchain.js":627,"./runCall.js":628,"./runCode.js":629,"./runJit.js":630,"./runTx.js":631,"./stateManager.js":632,"async-eventemitter":39,"ethereumjs-account":585,"ethereumjs-common":609,"ethereumjs-util":640,"merkle-patricia-tree":947,"merkle-patricia-tree/secure.js":953,"safe-buffer":1334,"util":1439}],618:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var error = require('../exceptions.js').ERROR;
+var assert = require('assert');
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+
+ results.gasUsed = new BN(opts._common.param('gasPrices', 'ecRecover'));
+
+ if (opts.gasLimit.lt(results.gasUsed)) {
+ results.return = Buffer.alloc(0);
+ results.gasUsed = opts.gasLimit;
+ results.exception = 0; // 0 means VM fail (in this case because of OOG)
+ results.exceptionError = error.OUT_OF_GAS;
+ return results;
+ }
+
+ var data = utils.setLengthRight(opts.data, 128);
+
+ var msgHash = data.slice(0, 32);
+ var v = data.slice(32, 64);
+ var r = data.slice(64, 96);
+ var s = data.slice(96, 128);
+
+ var publicKey;
+ try {
+ publicKey = utils.ecrecover(msgHash, new BN(v).toNumber(), r, s);
+ } catch (e) {
+ results.return = Buffer.alloc(0);
+ results.exception = 1;
+ return results;
+ }
+
+ results.return = utils.setLengthLeft(utils.publicToAddress(publicKey), 32);
+ results.exception = 1;
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640}],619:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var error = require('../exceptions.js').ERROR;
+var assert = require('assert');
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+ var data = opts.data;
+
+ results.gasUsed = new BN(opts._common.param('gasPrices', 'sha256'));
+ results.gasUsed.iadd(new BN(opts._common.param('gasPrices', 'sha256Word')).imuln(Math.ceil(data.length / 32)));
+
+ if (opts.gasLimit.lt(results.gasUsed)) {
+ results.return = Buffer.alloc(0);
+ results.gasUsed = opts.gasLimit;
+ results.exceptionError = error.OUT_OF_GAS;
+ results.exception = 0; // 0 means VM fail (in this case because of OOG)
+ return results;
+ }
+
+ results.return = utils.sha256(data);
+ results.exception = 1;
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640}],620:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var error = require('../exceptions.js').ERROR;
+var assert = require('assert');
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+ var data = opts.data;
+
+ results.gasUsed = new BN(opts._common.param('gasPrices', 'ripemd160'));
+ results.gasUsed.iadd(new BN(opts._common.param('gasPrices', 'ripemd160Word')).imuln(Math.ceil(data.length / 32)));
+
+ if (opts.gasLimit.lt(results.gasUsed)) {
+ results.return = Buffer.alloc(0);
+ results.gasUsed = opts.gasLimit;
+ results.exceptionError = error.OUT_OF_GAS;
+ results.exception = 0; // 0 means VM fail (in this case because of OOG)
+ return results;
+ }
+
+ results.return = utils.ripemd160(data, true);
+ results.exception = 1;
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640}],621:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var error = require('../exceptions.js').ERROR;
+var assert = require('assert');
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+ var data = opts.data;
+
+ results.gasUsed = new BN(opts._common.param('gasPrices', 'identity'));
+ results.gasUsed.iadd(new BN(opts._common.param('gasPrices', 'identityWord')).imuln(Math.ceil(data.length / 32)));
+
+ if (opts.gasLimit.lt(results.gasUsed)) {
+ results.return = Buffer.alloc(0);
+ results.gasUsed = opts.gasLimit;
+ results.exceptionError = error.OUT_OF_GAS;
+ results.exception = 0; // 0 means VM fail (in this case because of OOG)
+ return results;
+ }
+
+ results.return = data;
+ results.exception = 1;
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640}],622:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var error = require('../exceptions.js').ERROR;
+var assert = require('assert');
+
+function multComplexity(x) {
+ var fac1;
+ var fac2;
+ if (x.lten(64)) {
+ return x.sqr();
+ } else if (x.lten(1024)) {
+ // return Math.floor(Math.pow(x, 2) / 4) + 96 * x - 3072
+ fac1 = x.sqr().divn(4);
+ fac2 = x.muln(96);
+ return fac1.add(fac2).subn(3072);
+ } else {
+ // return Math.floor(Math.pow(x, 2) / 16) + 480 * x - 199680
+ fac1 = x.sqr().divn(16);
+ fac2 = x.muln(480);
+ return fac1.add(fac2).subn(199680);
+ }
+}
+
+function getAdjustedExponentLength(data) {
+ var expBytesStart;
+ try {
+ var baseLen = new BN(data.slice(0, 32)).toNumber();
+ expBytesStart = 96 + baseLen; // 96 for base length, then exponent length, and modulus length, then baseLen for the base data, then exponent bytes start
+ } catch (e) {
+ expBytesStart = Number.MAX_SAFE_INTEGER - 32;
+ }
+ var expLen = new BN(data.slice(32, 64));
+ var firstExpBytes = Buffer.from(data.slice(expBytesStart, expBytesStart + 32)); // first word of the exponent data
+ firstExpBytes = utils.setLengthRight(firstExpBytes, 32); // reading past the data reads virtual zeros
+ firstExpBytes = new BN(firstExpBytes);
+ var max32expLen = 0;
+ if (expLen.ltn(32)) {
+ max32expLen = 32 - expLen.toNumber();
+ }
+ firstExpBytes = firstExpBytes.shrn(8 * Math.max(max32expLen, 0));
+
+ var bitLen = -1;
+ while (firstExpBytes.gtn(0)) {
+ bitLen = bitLen + 1;
+ firstExpBytes = firstExpBytes.ushrn(1);
+ }
+ var expLenMinus32OrZero = expLen.subn(32);
+ if (expLenMinus32OrZero.ltn(0)) {
+ expLenMinus32OrZero = new BN(0);
+ }
+ var eightTimesExpLenMinus32OrZero = expLenMinus32OrZero.muln(8);
+ var adjustedExpLen = eightTimesExpLenMinus32OrZero;
+ if (bitLen > 0) {
+ adjustedExpLen.iaddn(bitLen);
+ }
+ return adjustedExpLen;
+}
+
+// Taken from https://stackoverflow.com/a/1503019
+function expmod(B, E, M) {
+ if (E.isZero()) return new BN(1).mod(M);
+ var BM = B.mod(M);
+ var R = expmod(BM, E.divn(2), M);
+ R = R.mul(R).mod(M);
+ if (E.mod(new BN(2)).isZero()) return R;
+ return R.mul(BM).mod(M);
+}
+
+function getOOGResults(opts, results) {
+ results.return = Buffer.alloc(0);
+ results.gasUsed = opts.gasLimit;
+ results.exception = 0; // 0 means VM fail (in this case because of OOG)
+ results.exceptionError = error.OUT_OF_GAS;
+ return results;
+}
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+ var data = opts.data;
+
+ var adjustedELen = getAdjustedExponentLength(data);
+ if (adjustedELen.ltn(1)) {
+ adjustedELen = new BN(1);
+ }
+
+ var bLen = new BN(data.slice(0, 32));
+ var eLen = new BN(data.slice(32, 64));
+ var mLen = new BN(data.slice(64, 96));
+
+ var maxLen = bLen;
+ if (maxLen.lt(mLen)) {
+ maxLen = mLen;
+ }
+ var Gquaddivisor = opts._common.param('gasPrices', 'modexpGquaddivisor');
+ var gasUsed = adjustedELen.mul(multComplexity(maxLen)).divn(Gquaddivisor);
+
+ if (opts.gasLimit.lt(gasUsed)) {
+ return getOOGResults(opts, results);
+ }
+
+ results.gasUsed = gasUsed;
+
+ if (bLen.isZero()) {
+ results.return = new BN(0).toArrayLike(Buffer, 'be', 1);
+ results.exception = 1;
+ return results;
+ }
+
+ if (mLen.isZero()) {
+ results.return = Buffer.alloc(0);
+ results.exception = 1;
+ return results;
+ }
+
+ var maxInt = new BN(Number.MAX_SAFE_INTEGER);
+ var maxSize = new BN(2147483647); // ethereumjs-util setLengthRight limitation
+
+ if (bLen.gt(maxSize) || eLen.gt(maxSize) || mLen.gt(maxSize)) {
+ return getOOGResults(opts, results);
+ }
+
+ var bStart = new BN(96);
+ var bEnd = bStart.add(bLen);
+ var eStart = bEnd;
+ var eEnd = eStart.add(eLen);
+ var mStart = eEnd;
+ var mEnd = mStart.add(mLen);
+
+ if (mEnd.gt(maxInt)) {
+ return getOOGResults(opts, results);
+ }
+
+ bLen = bLen.toNumber();
+ eLen = eLen.toNumber();
+ mLen = mLen.toNumber();
+
+ var B = new BN(utils.setLengthRight(data.slice(bStart.toNumber(), bEnd.toNumber()), bLen));
+ var E = new BN(utils.setLengthRight(data.slice(eStart.toNumber(), eEnd.toNumber()), eLen));
+ var M = new BN(utils.setLengthRight(data.slice(mStart.toNumber(), mEnd.toNumber()), mLen));
+
+ // console.log('MODEXP input')
+ // console.log('B:', bLen, B)
+ // console.log('E:', eLen, E)
+ // console.log('M:', mLen, M)
+
+ var R;
+ if (M.isZero()) {
+ R = new BN(0);
+ } else {
+ R = expmod(B, E, M);
+ }
+ var result = R.toArrayLike(Buffer, 'be', mLen);
+
+ results.return = result;
+ results.exception = 1;
+
+ // console.log('MODEXP output', result)
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640}],623:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var error = require('../exceptions.js').ERROR;
+var assert = require('assert');
+
+var bn128 = require('rustbn.js');
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+ var inputData = opts.data;
+
+ results.gasUsed = new BN(opts._common.param('gasPrices', 'ecAdd'));
+ if (opts.gasLimit.lt(results.gasUsed)) {
+ results.return = Buffer.alloc(0);
+ results.exception = 0;
+ results.gasUsed = new BN(opts.gasLimit);
+ results.exceptionError = error.OUT_OF_GAS;
+ return results;
+ }
+
+ var returnData = bn128.add(inputData);
+
+ // check ecadd success or failure by comparing the output length
+ if (returnData.length !== 64) {
+ results.return = Buffer.alloc(0);
+ results.exception = 0;
+ results.gasUsed = new BN(opts.gasLimit);
+ results.exceptionError = error.OUT_OF_GAS;
+ } else {
+ results.return = returnData;
+ results.exception = 1;
+ }
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640,"rustbn.js":1332}],624:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var ERROR = require('../exceptions.js').ERROR;
+var BN = utils.BN;
+var assert = require('assert');
+
+var bn128 = require('rustbn.js');
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+ var inputData = opts.data;
+
+ results.gasUsed = new BN(opts._common.param('gasPrices', 'ecMul'));
+
+ if (opts.gasLimit.lt(results.gasUsed)) {
+ results.return = Buffer.alloc(0);
+ results.exception = 0;
+ results.gasUsed = new BN(opts.gasLimit);
+ results.exceptionError = ERROR.OUT_OF_GAS;
+ return results;
+ }
+
+ var returnData = bn128.mul(inputData);
+
+ // check ecmul success or failure by comparing the output length
+ if (returnData.length !== 64) {
+ results.return = Buffer.alloc(0);
+ results.exception = 0;
+ results.gasUsed = new BN(opts.gasLimit);
+ results.exceptionError = ERROR.OUT_OF_GAS;
+ } else {
+ results.return = returnData;
+ results.exception = 1;
+ }
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640,"rustbn.js":1332}],625:[function(require,module,exports){
+(function (Buffer){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var error = require('../exceptions.js').ERROR;
+var assert = require('assert');
+
+var bn128 = require('rustbn.js');
+
+module.exports = function (opts) {
+ assert(opts.data);
+
+ var results = {};
+ var inputData = opts.data;
+
+ // no need to care about non-divisible-by-192, because bn128.pairing will properly fail in that case
+ var inputDataSize = Math.floor(inputData.length / 192);
+
+ var gascost = opts._common.param('gasPrices', 'ecPairing') + inputDataSize * opts._common.param('gasPrices', 'ecPairingWord');
+ results.gasUsed = new BN(gascost);
+
+ if (opts.gasLimit.ltn(gascost)) {
+ results.return = Buffer.alloc(0);
+ results.gasUsed = opts.gasLimit;
+ results.exceptionError = error.OUT_OF_GAS;
+ results.exception = 0; // 0 means VM fail (in this case because of OOG)
+ return results;
+ }
+
+ var returnData = bn128.pairing(inputData);
+
+ // check ecpairing success or failure by comparing the output length
+ if (returnData.length !== 32) {
+ results.return = Buffer.alloc(0);
+ results.gasUsed = opts.gasLimit;
+ results.exceptionError = error.OUT_OF_GAS;
+ results.exception = 0;
+ } else {
+ results.return = returnData;
+ results.exception = 1;
+ }
+
+ return results;
+};
+}).call(this,require("buffer").Buffer)
+},{"../exceptions.js":615,"assert":35,"buffer":113,"ethereumjs-util":640,"rustbn.js":1332}],626:[function(require,module,exports){
+'use strict';
+
+var Buffer = require('safe-buffer').Buffer;
+var async = require('async');
+var ethUtil = require('ethereumjs-util');
+var Bloom = require('./bloom');
+var rlp = ethUtil.rlp;
+var Trie = require('merkle-patricia-tree');
+var BN = ethUtil.BN;
+
+/**
+ * Processes the `block` running all of the transactions it contains and updating the miner's account
+ * @method vm.runBlock
+ * @param opts
+ * @param {Block} opts.block the [`Block`](https://github.com/ethereumjs/ethereumjs-block) to process
+ * @param {Boolean} opts.generate [gen=false] whether to generate the stateRoot, if false `runBlock` will check the stateRoot of the block against the Trie
+ * @param {runBlock~callback} cb callback
+ */
+
+/**
+ * Callback for `runBlock` method
+ * @callback runBlock~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Object} results
+ * @param {Array} results.receipts the receipts from the transactions in the block
+ * @param {Array} results.results
+*/
+module.exports = function (opts, cb) {
+ if (typeof opts === 'function' && cb === undefined) {
+ cb = opts;
+ return cb(new Error('invalid input, opts must be provided'));
+ }
+ if (!opts.block) {
+ return cb(new Error('invalid input, block must be provided'));
+ }
+
+ var self = this;
+
+ // parse options
+ var block = opts.block;
+ var skipBlockValidation = opts.skipBlockValidation || false;
+ var generateStateRoot = !!opts.generate;
+ var validateStateRoot = !generateStateRoot;
+ var bloom = new Bloom();
+ var receiptTrie = new Trie();
+ // the total amount of gas used processing this block
+ var gasUsed = new BN(0);
+ var checkpointedState = false;
+ var receipts = [];
+ var txResults = [];
+ var result;
+
+ // run everything
+ async.series([beforeBlock, validateBlock, setStateRoot, checkpointState, processTransactions, payOmmersAndMiner], parseBlockResults);
+
+ function beforeBlock(cb) {
+ /**
+ * The `beforeBlock` event
+ *
+ * @event Event: beforeBlock
+ * @type {Object}
+ * @property {Block} block emits the block that is about to be processed
+ */
+ self.emit('beforeBlock', opts.block, cb);
+ }
+
+ function afterBlock(cb) {
+ /**
+ * The `afterBlock` event
+ *
+ * @event Event: afterBlock
+ * @type {Object}
+ * @property {Object} result emits the results of processing a block
+ */
+ self.emit('afterBlock', result, cb);
+ }
+
+ function validateBlock(cb) {
+ if (skipBlockValidation) {
+ cb();
+ } else {
+ if (new BN(block.header.gasLimit).gte(new BN('8000000000000000', 16))) {
+ cb(new Error('Invalid block with gas limit greater than (2^63 - 1)'));
+ } else {
+ block.validate(self.blockchain, cb);
+ }
+ }
+ }
+
+ function setStateRoot(cb) {
+ if (opts.root) {
+ self.stateManager.setStateRoot(opts.root, cb);
+ } else {
+ cb(null);
+ }
+ }
+
+ function checkpointState(cb) {
+ checkpointedState = true;
+ self.stateManager.checkpoint(cb);
+ }
+
+ /**
+ * Processes all of the transaction in the block
+ * @method processTransaction
+ * @private
+ * @param {Function} cb the callback is given error if there are any
+ */
+ function processTransactions(cb) {
+ var validReceiptCount = 0;
+
+ async.eachSeries(block.transactions, processTx, cb);
+
+ function processTx(tx, cb) {
+ var gasLimitIsHigherThanBlock = new BN(block.header.gasLimit).lt(new BN(tx.gasLimit).add(gasUsed));
+ if (gasLimitIsHigherThanBlock) {
+ cb(new Error('tx has a higher gas limit than the block'));
+ return;
+ }
+
+ // run the tx through the VM
+ self.runTx({
+ tx: tx,
+ block: block
+ }, parseTxResult);
+
+ function parseTxResult(err, result) {
+ txResults.push(result);
+ // var receiptResult = new BN(1)
+
+ // abort if error
+ if (err) {
+ receipts.push(null);
+ cb(err);
+ return;
+ }
+
+ gasUsed = gasUsed.add(result.gasUsed);
+ // combine blooms via bitwise OR
+ bloom.or(result.bloom);
+
+ if (generateStateRoot) {
+ block.header.bloom = bloom.bitvector;
+ }
+
+ var txLogs = result.vm.logs || [];
+
+ var rawTxReceipt = [result.vm.exception ? 1 : 0, // result.vm.exception is 0 when an exception occurs, and 1 when it doesn't. TODO make this the opposite
+ gasUsed.toArrayLike(Buffer), result.bloom.bitvector, txLogs];
+ var txReceipt = {
+ status: rawTxReceipt[0],
+ gasUsed: rawTxReceipt[1],
+ bitvector: rawTxReceipt[2],
+ logs: rawTxReceipt[3]
+ };
+
+ receipts.push(txReceipt);
+ receiptTrie.put(rlp.encode(validReceiptCount), rlp.encode(rawTxReceipt), function () {
+ validReceiptCount++;
+ cb();
+ });
+ }
+ }
+ }
+
+ // credit all block rewards
+ function payOmmersAndMiner(cb) {
+ var ommers = block.uncleHeaders;
+
+ // pay each ommer
+ async.series([rewardOmmers, rewardMiner], cb);
+
+ function rewardOmmers(done) {
+ async.each(block.uncleHeaders, function (ommer, next) {
+ // calculate reward
+ var minerReward = new BN(self._common.param('pow', 'minerReward'));
+ var heightDiff = new BN(block.header.number).sub(new BN(ommer.number));
+ var reward = new BN(8).sub(heightDiff).mul(minerReward.divn(8));
+
+ if (reward.ltn(0)) {
+ reward = new BN(0);
+ }
+
+ rewardAccount(ommer.coinbase, reward, next);
+ }, done);
+ }
+
+ function rewardMiner(done) {
+ // calculate nibling reward
+ var minerReward = new BN(self._common.param('pow', 'minerReward'));
+ var niblingReward = minerReward.divn(32);
+ var totalNiblingReward = niblingReward.muln(ommers.length);
+ var reward = minerReward.add(totalNiblingReward);
+ rewardAccount(block.header.coinbase, reward, done);
+ }
+
+ function rewardAccount(address, reward, done) {
+ self.stateManager.getAccount(address, function (err, account) {
+ if (err) return done(err);
+ // give miner the block reward
+ account.balance = new BN(account.balance).add(reward);
+ self.stateManager.putAccount(address, account, done);
+ });
+ }
+ }
+
+ // handle results or error from block run
+ function parseBlockResults(err) {
+ if (err) {
+ if (checkpointedState) {
+ self.stateManager.revert(function () {
+ cb(err);
+ });
+ } else {
+ cb(err);
+ }
+ return;
+ }
+
+ self.stateManager.commit(function (err) {
+ if (err) return cb(err);
+
+ self.stateManager.getStateRoot(function (err, stateRoot) {
+ if (err) return cb(err);
+
+ // credit all block rewards
+ if (generateStateRoot) {
+ block.header.stateRoot = stateRoot;
+ }
+
+ if (validateStateRoot) {
+ if (receiptTrie.root && receiptTrie.root.toString('hex') !== block.header.receiptTrie.toString('hex')) {
+ err = new Error((err || '') + 'invalid receiptTrie ');
+ }
+ if (bloom.bitvector.toString('hex') !== block.header.bloom.toString('hex')) {
+ err = new Error((err || '') + 'invalid bloom ');
+ }
+ if (ethUtil.bufferToInt(block.header.gasUsed) !== Number(gasUsed)) {
+ err = new Error((err || '') + 'invalid gasUsed ');
+ }
+ if (stateRoot.toString('hex') !== block.header.stateRoot.toString('hex')) {
+ err = new Error((err || '') + 'invalid block stateRoot ');
+ }
+ }
+
+ result = {
+ receipts: receipts,
+ results: txResults,
+ error: err
+ };
+
+ afterBlock(cb.bind(this, err, result));
+ });
+ });
+ }
+};
+},{"./bloom":613,"async":42,"ethereumjs-util":640,"merkle-patricia-tree":947,"safe-buffer":1334}],627:[function(require,module,exports){
+'use strict';
+
+var async = require('async');
+
+/**
+ * Processes blocks and adds them to the blockchain
+ * @method vm.runBlockchain
+ * @param {Blockchain} blockchain A [blockchain](https://github.com/ethereum/ethereumjs-blockchain) that to process
+ * @param {Function} cb the callback function
+ */
+module.exports = function (blockchain, cb) {
+ var self = this;
+ var headBlock, parentState;
+
+ // parse arguments
+ if (typeof blockchain === 'function') {
+ cb = blockchain;
+ blockchain = undefined;
+ }
+
+ blockchain = blockchain || self.blockchain;
+
+ // setup blockchain iterator
+ blockchain.iterator('vm', processBlock, cb);
+ function processBlock(block, reorg, cb) {
+ async.series([getStartingState, runBlock], cb);
+
+ // determine starting state for block run
+ function getStartingState(cb) {
+ // if we are just starting or if a chain re-org has happened
+ if (!headBlock || reorg) {
+ blockchain.getBlock(block.header.parentHash, function (err, parentBlock) {
+ parentState = parentBlock.header.stateRoot;
+ // generate genesis state if we are at the genesis block
+ // we don't have the genesis state
+ if (!headBlock) {
+ return self.stateManager.generateCanonicalGenesis(cb);
+ } else {
+ cb(err);
+ }
+ });
+ } else {
+ parentState = headBlock.header.stateRoot;
+ cb();
+ }
+ }
+
+ // run block, update head if valid
+ function runBlock(cb) {
+ self.runBlock({
+ block: block,
+ root: parentState
+ }, function (err, results) {
+ if (err) {
+ // remove invalid block
+ blockchain.delBlock(block.header.hash(), function () {
+ cb(err);
+ });
+ } else {
+ // set as new head block
+ headBlock = block;
+ cb();
+ }
+ });
+ }
+ }
+};
+},{"async":42}],628:[function(require,module,exports){
+'use strict';
+
+var Buffer = require('safe-buffer').Buffer;
+var async = require('async');
+var ethUtil = require('ethereumjs-util');
+var BN = ethUtil.BN;
+var exceptions = require('./exceptions.js');
+var StorageReader = require('./storageReader');
+
+var ERROR = exceptions.ERROR;
+
+/**
+ * runs a CALL operation
+ * @method vm.runCall
+ * @private
+ * @param opts
+ * @param opts.block {Block}
+ * @param opts.caller {Buffer}
+ * @param opts.code {Buffer} this is for CALLCODE where the code to load is different than the code from the to account.
+ * @param opts.data {Buffer}
+ * @param opts.gasLimit {Buffer | BN.js }
+ * @param opts.gasPrice {Buffer}
+ * @param opts.origin {Buffer} []
+ * @param opts.to {Buffer}
+ * @param opts.value {Buffer}
+ * @param {Function} cb the callback
+ */
+module.exports = function (opts, cb) {
+ var self = this;
+ var stateManager = self.stateManager;
+
+ var vmResults = {};
+ var toAccount;
+ var toAddress = opts.to;
+ var createdAddress;
+ var txValue = opts.value || Buffer.from([0]);
+ var caller = opts.caller;
+ var account;
+ var block = opts.block;
+ var code = opts.code;
+ var txData = opts.data;
+ var gasLimit = opts.gasLimit || new BN(0xffffff);
+ gasLimit = new BN(opts.gasLimit); // make sure is a BN
+ var gasPrice = opts.gasPrice;
+ var gasUsed = new BN(0);
+ var origin = opts.origin;
+ var isCompiled = opts.compiled;
+ var depth = opts.depth;
+ // opts.suicides is kept for backward compatiblity with pre-EIP6 syntax
+ var selfdestruct = opts.selfdestruct || opts.suicides;
+ var delegatecall = opts.delegatecall || false;
+ var isStatic = opts.static || false;
+ var salt = opts.salt || null;
+ var storageReader = opts.storageReader || new StorageReader(stateManager);
+
+ txValue = new BN(txValue);
+
+ // run and parse
+ async.series([checkpointState, loadFromAccount, subTxValue, loadToAccount, addTxValue, loadCode, runCode, saveCode], parseCallResult);
+
+ function checkpointState(cb) {
+ stateManager.checkpoint(cb);
+ }
+
+ function loadFromAccount(done) {
+ stateManager.getAccount(caller, function (err, fromAccount) {
+ account = fromAccount;
+ done(err);
+ });
+ }
+
+ function loadToAccount(done) {
+ // get receiver's account
+ if (!toAddress) {
+ // generate a new contract if no `to`
+ code = txData;
+ txData = undefined;
+ var newNonce = new BN(account.nonce).subn(1);
+
+ if (salt) {
+ createdAddress = toAddress = ethUtil.generateAddress2(caller, salt, code);
+ } else {
+ createdAddress = toAddress = ethUtil.generateAddress(caller, newNonce.toArray());
+ }
+
+ checkAccountState(createdAddress, setupNewContract, done);
+ } else {
+ // else load the `to` account
+ stateManager.getAccount(toAddress, function (err, account) {
+ toAccount = account;
+ done(err);
+ });
+ }
+ }
+
+ function checkAccountState(address, next, done) {
+ stateManager.getAccount(address, function (err, account) {
+ if (err) {
+ done(err);
+ return;
+ }
+
+ if (account.nonce && new BN(account.nonce) > 0 || account.codeHash.compare(ethUtil.KECCAK256_NULL) !== 0) {
+ toAccount = account;
+ code = new Buffer('fe', 'hex'); // Invalid init code
+ done();
+ return;
+ }
+
+ next(address, done);
+ });
+ }
+
+ function setupNewContract(address, done) {
+ stateManager.clearContractStorage(address, function (err) {
+ if (err) {
+ done(err);
+ return;
+ }
+
+ async.series([newContractEvent, getAccount], done);
+
+ function newContractEvent(callback) {
+ self.emit('newContract', {
+ address: address,
+ code: code
+ }, callback);
+ }
+
+ function getAccount(callback) {
+ stateManager.getAccount(address, function (err, account) {
+ toAccount = account;
+ toAccount.nonce = new BN(toAccount.nonce).addn(1).toArrayLike(Buffer);
+ callback(err);
+ });
+ }
+ });
+ }
+
+ function subTxValue(cb) {
+ if (delegatecall) {
+ cb();
+ return;
+ }
+ var newBalance = new BN(account.balance).sub(txValue);
+ account.balance = newBalance;
+ stateManager.putAccount(ethUtil.toBuffer(caller), account, cb);
+ }
+
+ function addTxValue(cb) {
+ if (delegatecall) {
+ cb();
+ return;
+ }
+ // add the amount sent to the `to` account
+ var newBalance = new BN(toAccount.balance).add(txValue);
+ toAccount.balance = newBalance;
+ // putAccount as the nonce may have changed for contract creation
+ stateManager.putAccount(ethUtil.toBuffer(toAddress), toAccount, cb);
+ }
+
+ function loadCode(cb) {
+ // loads the contract's code if the account is a contract
+ if (code || !(toAccount.isContract() || self._precompiled[toAddress.toString('hex')])) {
+ cb();
+ return;
+ }
+
+ if (self._precompiled[toAddress.toString('hex')]) {
+ isCompiled = true;
+ code = self._precompiled[toAddress.toString('hex')];
+ cb();
+ return;
+ }
+
+ stateManager.getContractCode(toAddress, function (err, c, comp) {
+ if (err) return cb(err);
+ isCompiled = comp;
+ code = c;
+ cb();
+ });
+ }
+
+ function runCode(cb) {
+ if (!code) {
+ vmResults.exception = 1;
+ stateManager.commit(cb);
+ return;
+ }
+
+ var runCodeOpts = {
+ code: code,
+ data: txData,
+ gasLimit: gasLimit,
+ gasPrice: gasPrice,
+ address: toAddress,
+ origin: origin,
+ caller: caller,
+ value: txValue.toArrayLike(Buffer),
+ block: block,
+ depth: depth,
+ selfdestruct: selfdestruct,
+ static: isStatic,
+ storageReader: storageReader
+
+ // run Code through vm
+ };var codeRunner = isCompiled ? self.runJIT : self.runCode;
+ codeRunner.call(self, runCodeOpts, parseRunResult);
+
+ function parseRunResult(err, results) {
+ vmResults = results;
+
+ if (createdAddress) {
+ // fee for size of the return value
+ var totalGas = results.gasUsed;
+ if (!results.runState.vmError) {
+ var returnFee = new BN(results.return.length * self._common.param('gasPrices', 'createData'));
+ totalGas = totalGas.add(returnFee);
+ }
+ // if not enough gas
+ if (totalGas.lte(gasLimit) && (self.allowUnlimitedContractSize || results.return.length <= 24576)) {
+ results.gasUsed = totalGas;
+ } else {
+ results.return = Buffer.alloc(0);
+ // since Homestead
+ results.exception = 0;
+ err = results.exceptionError = ERROR.OUT_OF_GAS;
+ results.gasUsed = gasLimit;
+ }
+ }
+
+ gasUsed = results.gasUsed;
+ if (err) {
+ results.logs = [];
+ stateManager.revert(function (revertErr) {
+ if (revertErr || !isCompiled) cb(revertErr);else {
+ // Empty precompiled contracts need to be deleted even in case of OOG
+ // because the bug in both Geth and Parity led to deleting RIPEMD precompiled in this case
+ // see https://github.com/ethereum/go-ethereum/pull/3341/files#diff-2433aa143ee4772026454b8abd76b9dd
+ // We mark the account as touched here, so that is can be removed among other touched empty accounts (after tx finalization)
+ if (err === ERROR.OUT_OF_GAS || err.error === ERROR.OUT_OF_GAS) {
+ stateManager.getAccount(toAddress, function (getErr, acc) {
+ if (getErr) cb(getErr);else stateManager.putAccount(toAddress, acc, cb);
+ });
+ } else {
+ cb();
+ }
+ }
+ });
+ } else {
+ stateManager.commit(cb);
+ }
+ }
+ }
+
+ function saveCode(cb) {
+ // store code for a new contract
+ if (createdAddress && !vmResults.runState.vmError && vmResults.return && vmResults.return.toString() !== '') {
+ stateManager.putContractCode(createdAddress, vmResults.return, cb);
+ } else {
+ cb();
+ }
+ }
+
+ function parseCallResult(err) {
+ if (err) return cb(err);
+ var results = {
+ gasUsed: gasUsed,
+ createdAddress: createdAddress,
+ vm: vmResults
+ };
+
+ cb(null, results);
+ }
+};
+},{"./exceptions.js":615,"./storageReader":633,"async":42,"ethereumjs-util":640,"safe-buffer":1334}],629:[function(require,module,exports){
+'use strict';
+
+/*
+
+This is the core of the Ethereum Virtual Machine (EVM or just VM).
+
+NOTES:
+
+stack items are lazily duplicated.
+So you must never directly change a buffer from the stack,
+instead you should `copy` it first
+
+not all stack items are 32 bytes, so if the operation realies on the stack
+item length then you must use utils.pad(- , 32) first.
+*/
+var Buffer = require('safe-buffer').Buffer;
+var async = require('async');
+var utils = require('ethereumjs-util');
+var Block = require('ethereumjs-block');
+var lookupOpInfo = require('./vm/opcodes.js');
+var opFns = require('./vm/opFns.js');
+var exceptions = require('./exceptions.js');
+var StorageReader = require('./storageReader');
+var setImmediate = require('timers').setImmediate;
+var BN = utils.BN;
+
+var ERROR = exceptions.ERROR;
+var VmError = exceptions.VmError;
+
+/**
+ * Runs EVM code
+ * @method vm.runCode
+ * @param {Object} opts
+ * @param {Account} opts.account the [`Account`](https://github.com/ethereumjs/ethereumjs-account) that the executing code belongs to. If omitted an empty account will be used
+ * @param {Buffer} opts.address the address of the account that is executing this code. The address should be a `Buffer` of bytes. Defaults to `0`
+ * @param {Block} opts.block the [`Block`](https://github.com/ethereumjs/ethereumjs-block) the `tx` belongs to. If omitted a blank block will be used
+ * @param {Buffer} opts.caller the address that ran this code. The address should be a `Buffer` of 20bits. Defaults to `0`
+ * @param {Buffer} opts.code the EVM code to run given as a `Buffer`
+ * @param {Buffer} opts.data the input data
+ * @param {Buffer} opts.gasLimit the gas limit for the code
+ * @param {Buffer} opts.origin the address where the call originated from. The address should be a `Buffer` of 20bits. Defaults to `0`
+ * @param {Buffer} opts.value the value in ether that is being sent to `opt.address`. Defaults to `0`
+ * @param {runCode~callback} cb callback
+ */
+
+/**
+ * Callback for `runCode` method
+ * @callback runCode~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Object} results
+ * @param {BN} results.gas the amount of gas left
+ * @param {BN} results.gasUsed the amount of gas as a `bignum` the code used to run
+ * @param {BN} results.gasRefund a `bignum` containing the amount of gas to refund from deleting storage values
+ * @param {Object} results.selfdestruct an `Object` with keys for accounts that have selfdestructed and values for balance transfer recipient accounts
+ * @param {Array} results.logs an `Array` of logs that the contract emitted
+ * @param {Number} results.exception `0` if the contract encountered an exception, `1` otherwise
+ * @param {String} results.exceptionError a `String` describing the exception if there was one
+ * @param {Buffer} results.return a `Buffer` containing the value that was returned by the contract
+*/
+module.exports = function (opts, cb) {
+ var self = this;
+ var stateManager = self.stateManager;
+
+ var block = opts.block || new Block();
+
+ // VM internal state
+ var runState = {
+ blockchain: self.blockchain,
+ stateManager: stateManager,
+ storageReader: opts.storageReader || new StorageReader(stateManager),
+ returnValue: false,
+ stopped: false,
+ vmError: false,
+ programCounter: 0,
+ opCode: undefined,
+ opName: undefined,
+ gasLeft: new BN(opts.gasLimit),
+ gasLimit: new BN(opts.gasLimit),
+ gasPrice: opts.gasPrice,
+ memory: [],
+ memoryWordCount: new BN(0),
+ stack: [],
+ lastReturned: [],
+ logs: [],
+ validJumps: [],
+ gasRefund: new BN(0),
+ highestMemCost: new BN(0),
+ depth: opts.depth || 0,
+ // opts.suicides is kept for backward compatiblity with pre-EIP6 syntax
+ selfdestruct: opts.selfdestruct || opts.suicides || {},
+ block: block,
+ callValue: opts.value || new BN(0),
+ address: opts.address || utils.zeros(32),
+ caller: opts.caller || utils.zeros(32),
+ origin: opts.origin || opts.caller || utils.zeros(32),
+ callData: opts.data || Buffer.from([0]),
+ code: opts.code,
+ static: opts.static || false
+
+ // temporary - to be factored out
+ };runState._common = self._common;
+ runState._precompiled = self._precompiled;
+ runState._vm = self;
+
+ // prepare to run vm
+ preprocessValidJumps(runState);
+ // load contract then start vm run
+ loadContract(runVm);
+
+ // iterate through the given ops until something breaks or we hit STOP
+ function runVm(err) {
+ if (err) {
+ return parseVmResults(err);
+ }
+ async.whilst(vmIsActive, iterateVm, parseVmResults);
+ }
+
+ // ensure contract is loaded; only used if runCode is called directly
+ function loadContract(cb) {
+ stateManager.getAccount(runState.address, function (err, account) {
+ if (err) return cb(err);
+ runState.contract = account;
+ cb();
+ });
+ }
+
+ function vmIsActive() {
+ var notAtEnd = runState.programCounter < runState.code.length;
+
+ return !runState.stopped && notAtEnd && !runState.vmError && !runState.returnValue;
+ }
+
+ function iterateVm(done) {
+ var opCode = runState.code[runState.programCounter];
+ var opInfo = lookupOpInfo(opCode, false, self.emitFreeLogs);
+ var opName = opInfo.name;
+ var opFn = opFns[opName];
+
+ runState.opName = opName;
+ runState.opCode = opCode;
+
+ async.series([runStepHook, runOp], function (err) {
+ setImmediate(done.bind(null, err));
+ });
+
+ function runStepHook(cb) {
+ var eventObj = {
+ pc: runState.programCounter,
+ gasLeft: runState.gasLeft,
+ opcode: lookupOpInfo(opCode, true, self.emitFreeLogs),
+ stack: runState.stack,
+ depth: runState.depth,
+ address: runState.address,
+ account: runState.contract,
+ stateManager: runState.stateManager,
+ memory: runState.memory,
+ memoryWordCount: runState.memoryWordCount
+ /**
+ * The `step` event for trace output
+ *
+ * @event Event: step
+ * @type {Object}
+ * @property {Number} pc representing the program counter
+ * @property {String} opcode the next opcode to be ran
+ * @property {BN} gasLeft amount of gasLeft
+ * @property {Array} stack an `Array` of `Buffers` containing the stack
+ * @property {Account} account the [`Account`](https://github.com/ethereum/ethereumjs-account) which owns the code running
+ * @property {Buffer} address the address of the `account`
+ * @property {Number} depth the current number of calls deep the contract is
+ * @property {Buffer} memory the memory of the VM as a `buffer`
+ * @property {BN} memoryWordCount current size of memory in words
+ * @property {StateManager} stateManager a [`StateManager`](stateManager.md) instance (Beta API)
+ */
+ };self.emit('step', eventObj, cb);
+ }
+
+ function runOp(cb) {
+ // check for invalid opcode
+ if (opName === 'INVALID') {
+ return cb(new VmError(ERROR.INVALID_OPCODE));
+ }
+
+ // check for stack underflows
+ if (runState.stack.length < opInfo.in) {
+ return cb(new VmError(ERROR.STACK_UNDERFLOW));
+ }
+
+ if (runState.stack.length - opInfo.in + opInfo.out > 1024) {
+ return cb(new VmError(ERROR.STACK_OVERFLOW));
+ }
+
+ // calculate gas
+ var fee = new BN(opInfo.fee);
+ // TODO: move to a shared funtion; subGas in opFuns
+ runState.gasLeft = runState.gasLeft.sub(fee);
+ if (runState.gasLeft.ltn(0)) {
+ runState.gasLeft = new BN(0);
+ cb(new VmError(ERROR.OUT_OF_GAS));
+ return;
+ }
+
+ // advance program counter
+ runState.programCounter++;
+ var argsNum = opInfo.in;
+ var retNum = opInfo.out;
+ // pop the stack
+ var args = argsNum ? runState.stack.splice(-argsNum) : [];
+
+ args.reverse();
+ args.push(runState);
+ // create a callback for async opFunc
+ if (opInfo.async) {
+ args.push(function (err, result) {
+ if (err) return cb(err);
+
+ // save result to the stack
+ if (result !== undefined) {
+ if (retNum !== 1) {
+ // opcode post-stack mismatch
+ return cb(new VmError(ERROR.INTERNAL_ERROR));
+ }
+
+ runState.stack.push(result);
+ } else {
+ if (retNum !== 0) {
+ // opcode post-stack mismatch
+ return cb(new VmError(ERROR.INTERNAL_ERROR));
+ }
+ }
+
+ cb();
+ });
+ }
+
+ // if opcode is log and emitFreeLogs is enabled, remove static context
+ var prevStatic = runState.static;
+ if (self.emitFreeLogs && opName === 'LOG') {
+ runState.static = false;
+ }
+
+ try {
+ // run the opcode
+ var result = opFn.apply(null, args);
+ } catch (e) {
+ if (e.errorType && e.errorType === 'VmError') {
+ cb(e);
+ return;
+ } else {
+ throw e;
+ }
+ }
+
+ // restore previous static context
+ runState.static = prevStatic;
+
+ // save result to the stack
+ if (result !== undefined) {
+ if (retNum !== 1) {
+ // opcode post-stack mismatch
+ return cb(new VmError(ERROR.INTERNAL_ERROR));
+ }
+
+ runState.stack.push(result);
+ } else {
+ if (!opInfo.async && retNum !== 0) {
+ // opcode post-stack mismatch
+ return cb(new VmError(ERROR.INTERNAL_ERROR));
+ }
+ }
+
+ // call the callback if opFn was sync
+ if (!opInfo.async) {
+ cb();
+ }
+ }
+ }
+
+ function parseVmResults(err) {
+ // remove any logs on error
+ if (err) {
+ runState.logs = [];
+ runState.vmError = true;
+ }
+
+ var results = {
+ runState: runState,
+ selfdestruct: runState.selfdestruct,
+ gasRefund: runState.gasRefund,
+ exception: err ? 0 : 1,
+ exceptionError: err,
+ logs: runState.logs,
+ gas: runState.gasLeft,
+ 'return': runState.returnValue ? runState.returnValue : Buffer.alloc(0)
+ };
+
+ if (results.exceptionError) {
+ delete results.gasRefund;
+ delete results.selfdestruct;
+ }
+
+ if (err && err.error !== ERROR.REVERT) {
+ results.gasUsed = runState.gasLimit;
+ } else {
+ results.gasUsed = runState.gasLimit.sub(runState.gasLeft);
+ }
+
+ cb(err, results);
+ }
+};
+
+// find all the valid jumps and puts them in the `validJumps` array
+function preprocessValidJumps(runState) {
+ for (var i = 0; i < runState.code.length; i++) {
+ var curOpCode = lookupOpInfo(runState.code[i]).name;
+
+ // no destinations into the middle of PUSH
+ if (curOpCode === 'PUSH') {
+ i += runState.code[i] - 0x5f;
+ }
+
+ if (curOpCode === 'JUMPDEST') {
+ runState.validJumps.push(i);
+ }
+ }
+}
+},{"./exceptions.js":615,"./storageReader":633,"./vm/opFns.js":635,"./vm/opcodes.js":636,"async":42,"ethereumjs-block":638,"ethereumjs-util":640,"safe-buffer":1334,"timers":1415}],630:[function(require,module,exports){
+'use strict';
+
+module.exports = function (opts, cb) {
+ // for precompiled
+ var results;
+ if (typeof opts.code === 'function') {
+ opts._common = this._common;
+ results = opts.code(opts);
+ results.account = opts.account;
+ cb(results.exceptionError, results);
+ } else {
+ var f = new Function('require', 'opts', opts.code.toString()); // eslint-disable-line
+ results = f(require, opts);
+ results.account = opts.account;
+ cb(results.exceptionError, results);
+ }
+};
+},{}],631:[function(require,module,exports){
+'use strict';
+
+var Buffer = require('safe-buffer').Buffer;
+var async = require('async');
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var Bloom = require('./bloom');
+var Block = require('ethereumjs-block');
+var Account = require('ethereumjs-account');
+var StorageReader = require('./storageReader');
+
+/**
+ * Process a transaction. Run the vm. Transfers eth. Checks balances.
+ * @method vm.runTx
+ * @param opts
+ * @param {Transaction} opts.tx a [`Transaction`](https://github.com/ethereum/ethereumjs-tx) to run
+ * @param {Boolean} opts.skipNonce skips the nonce check
+ * @param {Boolean} opts.skipBalance skips the balance check
+ * @param {Block} opts.block the block to which the `tx` belongs, if no block is given a default one is created
+ * @param {runTx~callback} cb the callback
+ */
+
+/**
+ * Callback for `runTx` method
+ * @callback runTx~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Object} results
+ * @param {BN} results.amountSpent the amount of ether used by this transaction as a `bignum`
+ * @param {BN} results.gasUsed the amount of gas as a `bignum` used by the transaction
+ * @param {BN} results.gasRefund the amount of gas as a `bignum` that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`)
+ * @param {VM} vm contains the results from running the code, if any, as described in `vm.runCode(params, cb)`
+*/
+module.exports = function (opts, cb) {
+ if (typeof opts === 'function' && cb === undefined) {
+ cb = opts;
+ return cb(new Error('invalid input, opts must be provided'));
+ }
+
+ var self = this;
+ var block = opts.block;
+ var tx = opts.tx;
+ var gasLimit;
+ var results;
+ var basefee;
+ var storageReader = new StorageReader(self.stateManager);
+
+ // tx is required
+ if (!tx) {
+ return cb(new Error('invalid input, tx is required'));
+ }
+
+ // create a reasonable default if no block is given
+ if (!block) {
+ block = new Block();
+ }
+
+ if (new BN(block.header.gasLimit).lt(new BN(tx.gasLimit))) {
+ cb(new Error('tx has a higher gas limit than the block'));
+ return;
+ }
+
+ // run everything
+ async.series([checkpointState, runTxHook, updateFromAccount, runCall, runAfterTxHook], function (err) {
+ if (err) {
+ self.stateManager.revert(function () {
+ cb(err, results);
+ });
+ } else {
+ self.stateManager.commit(function (err) {
+ cb(err, results);
+ });
+ }
+ });
+
+ function checkpointState(cb) {
+ self.stateManager.checkpoint(cb);
+ }
+
+ // run the transaction hook
+ function runTxHook(cb) {
+ /**
+ * The `beforeTx` event
+ *
+ * @event Event: beforeTx
+ * @type {Object}
+ * @property {Transaction} tx emits the Transaction that is about to be processed
+ */
+ self.emit('beforeTx', tx, cb);
+ }
+
+ // run the transaction hook
+ function runAfterTxHook(cb) {
+ /**
+ * The `afterTx` event
+ *
+ * @event Event: afterTx
+ * @type {Object}
+ * @property {Object} result result of the transaction
+ */
+ self.emit('afterTx', results, cb);
+ }
+
+ function updateFromAccount(cb) {
+ self.stateManager.getAccount(tx.from, function (err, fromAccount) {
+ if (err) {
+ cb(err);
+ return;
+ }
+
+ var message;
+ if (!opts.skipBalance && new BN(fromAccount.balance).lt(tx.getUpfrontCost())) {
+ message = "sender doesn't have enough funds to send tx. The upfront cost is: " + tx.getUpfrontCost().toString() + ' and the sender\'s account only has: ' + new BN(fromAccount.balance).toString();
+ cb(new Error(message));
+ return;
+ } else if (!opts.skipNonce && !new BN(fromAccount.nonce).eq(new BN(tx.nonce))) {
+ message = "the tx doesn't have the correct nonce. account has nonce of: " + new BN(fromAccount.nonce).toString() + ' tx has nonce of: ' + new BN(tx.nonce).toString();
+ cb(new Error(message));
+ return;
+ }
+
+ // increment the nonce
+ fromAccount.nonce = new BN(fromAccount.nonce).addn(1);
+
+ basefee = tx.getBaseFee();
+ gasLimit = new BN(tx.gasLimit);
+ if (gasLimit.lt(basefee)) {
+ return cb(new Error('base fee exceeds gas limit'));
+ }
+ gasLimit.isub(basefee);
+
+ fromAccount.balance = new BN(fromAccount.balance).sub(new BN(tx.gasLimit).mul(new BN(tx.gasPrice)));
+ self.stateManager.putAccount(tx.from, fromAccount, cb);
+ });
+ }
+
+ // sets up the environment and runs a `call`
+ function runCall(cb) {
+ var options = {
+ caller: tx.from,
+ gasLimit: gasLimit,
+ gasPrice: tx.gasPrice,
+ to: tx.to,
+ value: tx.value,
+ data: tx.data,
+ block: block,
+ storageReader: storageReader
+ };
+
+ if (tx.to.toString('hex') === '') {
+ delete options.to;
+ }
+
+ // run call
+ self.runCall(options, parseResults);
+
+ function parseResults(err, _results) {
+ if (err) return cb(err);
+ results = _results;
+
+ // generate the bloom for the tx
+ results.bloom = txLogsBloom(results.vm.logs);
+
+ // caculate the total gas used
+ results.gasUsed = results.gasUsed.add(basefee);
+
+ // process any gas refund
+ results.gasRefund = results.vm.gasRefund;
+ if (results.gasRefund) {
+ if (results.gasRefund.lt(results.gasUsed.divn(2))) {
+ results.gasUsed.isub(results.gasRefund);
+ } else {
+ results.gasUsed.isub(results.gasUsed.divn(2));
+ }
+ }
+
+ results.amountSpent = results.gasUsed.mul(new BN(tx.gasPrice));
+
+ async.series([loadFromAccount, updateFromAccount, loadMinerAccount, updateMinerAccount, cleanupAccounts], cb);
+
+ var fromAccount;
+ function loadFromAccount(next) {
+ self.stateManager.getAccount(tx.from, function (err, account) {
+ fromAccount = account;
+ next(err);
+ });
+ }
+
+ function updateFromAccount(next) {
+ // refund the leftover gas amount
+ var finalFromBalance = new BN(tx.gasLimit).sub(results.gasUsed).mul(new BN(tx.gasPrice)).add(new BN(fromAccount.balance));
+ fromAccount.balance = finalFromBalance;
+
+ self.stateManager.putAccount(utils.toBuffer(tx.from), fromAccount, next);
+ }
+
+ var minerAccount;
+ function loadMinerAccount(next) {
+ self.stateManager.getAccount(block.header.coinbase, function (err, account) {
+ minerAccount = account;
+ next(err);
+ });
+ }
+
+ function updateMinerAccount(next) {
+ // add the amount spent on gas to the miner's account
+ minerAccount.balance = new BN(minerAccount.balance).add(results.amountSpent);
+
+ // save the miner's account
+ if (!new BN(minerAccount.balance).isZero()) {
+ self.stateManager.putAccount(block.header.coinbase, minerAccount, next);
+ } else {
+ next();
+ }
+ }
+
+ function cleanupAccounts(next) {
+ if (!results.vm.selfdestruct) {
+ results.vm.selfdestruct = {};
+ }
+
+ var keys = Object.keys(results.vm.selfdestruct);
+
+ async.series([deleteSelfDestructs, cleanTouched], next);
+
+ function deleteSelfDestructs(done) {
+ async.each(keys, function (s, cb) {
+ self.stateManager.putAccount(Buffer.from(s, 'hex'), new Account(), cb);
+ }, done);
+ }
+
+ function cleanTouched(done) {
+ self.stateManager.cleanupTouchedAccounts(done);
+ }
+ }
+ }
+ }
+};
+
+/**
+ * @method txLogsBloom
+ * @private
+ */
+function txLogsBloom(logs) {
+ var bloom = new Bloom();
+ if (logs) {
+ for (var i = 0; i < logs.length; i++) {
+ var log = logs[i];
+ // add the address
+ bloom.add(log[0]);
+ // add the topics
+ var topics = log[1];
+ for (var q = 0; q < topics.length; q++) {
+ bloom.add(topics[q]);
+ }
+ }
+ }
+ return bloom;
+}
+},{"./bloom":613,"./storageReader":633,"async":42,"ethereumjs-account":585,"ethereumjs-block":638,"ethereumjs-util":640,"safe-buffer":1334}],632:[function(require,module,exports){
+'use strict';
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+var Buffer = require('safe-buffer').Buffer;
+var Trie = require('merkle-patricia-tree/secure.js');
+var Common = require('ethereumjs-common').default;
+
+var _require = require('ethereumjs-common/dist/genesisStates'),
+ genesisStateByName = _require.genesisStateByName;
+
+var async = require('async');
+var Account = require('ethereumjs-account');
+var Cache = require('./cache.js');
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var rlp = utils.rlp;
+
+/**
+ * Interface for getting and setting data from an underlying
+ * state trie
+ * @interface StateManager
+ */
+
+module.exports = StateManager;
+
+/**
+ * Default implementation of the `StateManager` interface
+ * @class DefaultStateManager
+ * @implements StateManager
+ * @param {Object} [opts={}]
+ * @param {Common} [opts.common] - [`Common`](https://github.com/ethereumjs/ethereumjs-common) parameters of the chain
+ * @param {Trie} [opts.trie] - a [`merkle-patricia-tree`](https://github.com/ethereumjs/merkle-patricia-tree) instance
+ */
+function StateManager() {
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ var self = this;
+
+ var common = opts.common;
+ if (!common) {
+ common = new Common('mainnet', 'byzantium');
+ }
+ self._common = common;
+
+ self._trie = opts.trie || new Trie();
+ self._storageTries = {}; // the storage trie cache
+ self._cache = new Cache(self._trie);
+ self._touched = new Set();
+ self._touchedStack = [];
+ self._checkpointCount = 0;
+}
+
+var proto = StateManager.prototype;
+
+/**
+ * Copies the current instance of the `DefaultStateManager`
+ * at the last fully committed point, i.e. as if all current
+ * checkpoints were reverted
+ * @memberof DefaultStateManager
+ * @method copy
+ */
+proto.copy = function () {
+ return new StateManager({ trie: this._trie.copy() });
+};
+
+/**
+ * Callback for `getAccount` method
+ * @callback getAccount~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Account} account An [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account)
+ * instance corresponding to the provided `address`
+ */
+
+/**
+ * Gets the [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account)
+ * associated with `address`. Returns an empty account if the account does not exist.
+ * @memberof StateManager
+ * @method getAccount
+ * @param {Buffer} address Address of the `account` to get
+ * @param {getAccount~callback} cb
+ */
+proto.getAccount = function (address, cb) {
+ this._cache.getOrLoad(address, cb);
+};
+
+/**
+ * Saves an [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account)
+ * into state under the provided `address`
+ * @memberof StateManager
+ * @method putAccount
+ * @param {Buffer} address Address under which to store `account`
+ * @param {Account} account The [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account) to store
+ * @param {Function} cb Callback function
+ */
+proto.putAccount = function (address, account, cb) {
+ var self = this;
+ // TODO: dont save newly created accounts that have no balance
+ // if (toAccount.balance.toString('hex') === '00') {
+ // if they have money or a non-zero nonce or code, then write to tree
+ self._cache.put(address, account);
+ self._touched.add(address.toString('hex'));
+ // self._trie.put(addressHex, account.serialize(), cb)
+ cb();
+};
+
+/**
+ * Adds `value` to the state trie as code, and sets `codeHash` on the account
+ * corresponding to `address` to reference this.
+ * @memberof StateManager
+ * @method putContractCode
+ * @param {Buffer} address - Address of the `account` to add the `code` for
+ * @param {Buffer} value - The value of the `code`
+ * @param {Function} cb Callback function
+ */
+proto.putContractCode = function (address, value, cb) {
+ var self = this;
+ self.getAccount(address, function (err, account) {
+ if (err) {
+ return cb(err);
+ }
+ // TODO: setCode use trie.setRaw which creates a storage leak
+ account.setCode(self._trie, value, function (err) {
+ if (err) {
+ return cb(err);
+ }
+ self.putAccount(address, account, cb);
+ });
+ });
+};
+
+/**
+ * Callback for `getContractCode` method
+ * @callback getContractCode~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Buffer} code The code corresponding to the provided address.
+ * Returns an empty `Buffer` if the account has no associated code.
+ */
+
+/**
+ * Gets the code corresponding to the provided `address`
+ * @memberof StateManager
+ * @method getContractCode
+ * @param {Buffer} address Address to get the `code` for
+ * @param {getContractCode~callback} cb
+ */
+proto.getContractCode = function (address, cb) {
+ var self = this;
+ self.getAccount(address, function (err, account) {
+ if (err) {
+ return cb(err);
+ }
+ account.getCode(self._trie, cb);
+ });
+};
+
+/**
+ * Creates a storage trie from the primary storage trie
+ * for an account and saves this in the storage cache.
+ * @private
+ * @memberof DefaultStateManager
+ * @method _lookupStorageTrie
+ * @param {Buffer} address
+ * @param {Function} cb Callback function
+ */
+proto._lookupStorageTrie = function (address, cb) {
+ var self = this;
+ // from state trie
+ self.getAccount(address, function (err, account) {
+ if (err) {
+ return cb(err);
+ }
+ var storageTrie = self._trie.copy();
+ storageTrie.root = account.stateRoot;
+ storageTrie._checkpoints = [];
+ cb(null, storageTrie);
+ });
+};
+
+/**
+ * Gets the storage trie for an account from the storage
+ * cache or does a lookup
+ * @private
+ * @memberof DefaultStateManager
+ * @method _getStorageTrie
+ * @param {Buffer} address
+ * @param {Function} cb Callback function
+ */
+proto._getStorageTrie = function (address, cb) {
+ var self = this;
+ var storageTrie = self._storageTries[address.toString('hex')];
+ // from storage cache
+ if (storageTrie) {
+ return cb(null, storageTrie);
+ }
+ // lookup from state
+ self._lookupStorageTrie(address, cb);
+};
+
+/**
+ * Callback for `getContractStorage` method
+ * @callback getContractStorage~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Buffer} storageValue The storage value for the account
+ * corresponding to the provided address at the provided key.
+ * If this does not exists an empty `Buffer` is returned
+ */
+
+/**
+ * Gets the storage value associated with the provided `address` and `key`
+ * @memberof StateManager
+ * @method getContractStorage
+ * @param {Buffer} address Address of the account to get the storage for
+ * @param {Buffer} key Key in the account's storage to get the value for
+ * @param {getContractCode~callback} cb
+ */
+proto.getContractStorage = function (address, key, cb) {
+ var self = this;
+ self._getStorageTrie(address, function (err, trie) {
+ if (err) {
+ return cb(err);
+ }
+ trie.get(key, function (err, value) {
+ if (err) {
+ return cb(err);
+ }
+ var decoded = rlp.decode(value);
+ cb(null, decoded);
+ });
+ });
+};
+
+/**
+ * Modifies the storage trie of an account
+ * @private
+ * @memberof DefaultStateManager
+ * @method _modifyContractStorage
+ * @param {Buffer} address Address of the account whose storage is to be modified
+ * @param {Function} modifyTrie function to modify the storage trie of the account
+ */
+proto._modifyContractStorage = function (address, modifyTrie, cb) {
+ var self = this;
+ self._getStorageTrie(address, function (err, storageTrie) {
+ if (err) {
+ return cb(err);
+ }
+
+ modifyTrie(storageTrie, finalize);
+
+ function finalize(err) {
+ if (err) return cb(err);
+ // update storage cache
+ self._storageTries[address.toString('hex')] = storageTrie;
+ // update contract stateRoot
+ var contract = self._cache.get(address);
+ contract.stateRoot = storageTrie.root;
+ self.putAccount(address, contract, cb);
+ self._touched.add(address.toString('hex'));
+ }
+ });
+};
+
+/**
+ * Adds value to the state trie for the `account`
+ * corresponding to `address` at the provided `key`
+ * @memberof StateManager
+ * @method putContractStorage
+ * @param {Buffer} address Address to set a storage value for
+ * @param {Buffer} key Key to set the value at
+ * @param {Buffer} value Value to set at `key` for account corresponding to `address`
+ * @param {Function} cb Callback function
+ */
+proto.putContractStorage = function (address, key, value, cb) {
+ var self = this;
+ self._modifyContractStorage(address, function (storageTrie, done) {
+ if (value && value.length) {
+ // format input
+ var encodedValue = rlp.encode(value);
+ storageTrie.put(key, encodedValue, done);
+ } else {
+ // deleting a value
+ storageTrie.del(key, done);
+ }
+ }, cb);
+};
+
+/**
+ * Clears all storage entries for the account corresponding to `address`
+ * @memberof StateManager
+ * @method clearContractStorage
+ * @param {Buffer} address Address to clear the storage of
+ * @param {Function} cb Callback function
+ */
+proto.clearContractStorage = function (address, cb) {
+ var self = this;
+ self._modifyContractStorage(address, function (storageTrie, done) {
+ storageTrie.root = storageTrie.EMPTY_TRIE_ROOT;
+ done();
+ }, cb);
+};
+
+/**
+ * Checkpoints the current state of the StateManager instance.
+ * State changes that follow can then be committed by calling
+ * `commit` or `reverted` by calling rollback.
+ * @memberof StateManager
+ * @method checkpoint
+ * @param {Function} cb Callback function
+ */
+proto.checkpoint = function (cb) {
+ var self = this;
+ self._trie.checkpoint();
+ self._cache.checkpoint();
+ self._touchedStack.push(new Set([].concat(_toConsumableArray(self._touched))));
+ self._checkpointCount++;
+ cb();
+};
+
+/**
+ * Commits the current change-set to the instance since the
+ * last call to checkpoint.
+ * @memberof StateManager
+ * @method commit
+ * @param {Function} cb Callback function
+ */
+proto.commit = function (cb) {
+ var self = this;
+ // setup trie checkpointing
+ self._trie.commit(function () {
+ // setup cache checkpointing
+ self._cache.commit();
+ self._touchedStack.pop();
+ self._checkpointCount--;
+
+ if (self._checkpointCount === 0) self._cache.flush(cb);else cb();
+ });
+};
+
+/**
+ * Reverts the current change-set to the instance since the
+ * last call to checkpoint.
+ * @memberof StateManager
+ * @method revert
+ * @param {Function} cb Callback function
+ */
+proto.revert = function (cb) {
+ var self = this;
+ // setup trie checkpointing
+ self._trie.revert();
+ // setup cache checkpointing
+ self._cache.revert();
+ self._storageTries = {};
+ self._touched = self._touchedStack.pop();
+ self._checkpointCount--;
+
+ if (self._checkpointCount === 0) self._cache.flush(cb);else cb();
+};
+
+/**
+ * Callback for `getStateRoot` method
+ * @callback getStateRoot~callback
+ * @param {Error} error an error that may have happened or `null`.
+ * Will be an error if the un-committed checkpoints on the instance.
+ * @param {Buffer} stateRoot The state-root of the `StateManager`
+ */
+
+/**
+ * Gets the state-root of the Merkle-Patricia trie representation
+ * of the state of this StateManager. Will error if there are uncommitted
+ * checkpoints on the instance.
+ * @memberof StateManager
+ * @method getStateRoot
+ * @param {getStateRoot~callback} cb
+ */
+proto.getStateRoot = function (cb) {
+ var self = this;
+
+ if (self._checkpointCount !== 0) {
+ return cb(new Error('Cannot get state root with uncommitted checkpoints'));
+ }
+
+ self._cache.flush(function (err) {
+ if (err) {
+ return cb(err);
+ }
+ var stateRoot = self._trie.root;
+ cb(null, stateRoot);
+ });
+};
+
+/**
+ * Sets the state of the instance to that represented
+ * by the provided `stateRoot`. Will error if there are uncommitted
+ * checkpoints on the instance or if the state root does not exist in
+ * the state trie.
+ * @memberof StateManager
+ * @method setStateRoot
+ * @param {Buffer} stateRoot The state-root to reset the instance to
+ * @param {Function} cb Callback function
+ */
+proto.setStateRoot = function (stateRoot, cb) {
+ var self = this;
+
+ if (self._checkpointCount !== 0) {
+ return cb(new Error('Cannot set state root with uncommitted checkpoints'));
+ }
+
+ self._cache.flush(function (err) {
+ if (err) {
+ return cb(err);
+ }
+ if (stateRoot === self._trie.EMPTY_TRIE_ROOT) {
+ self._trie.root = stateRoot;
+ self._cache.clear();
+ return cb();
+ }
+ self._trie.checkRoot(stateRoot, function (err, hasRoot) {
+ if (err || !hasRoot) {
+ cb(err || new Error('State trie does not contain state root'));
+ } else {
+ self._trie.root = stateRoot;
+ self._cache.clear();
+ cb();
+ }
+ });
+ });
+};
+
+/**
+ * Callback for `dumpStorage` method
+ * @callback dumpStorage~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Object} accountState The state of the account as an `Object` map.
+ * Keys are are the storage keys, values are the storage values as strings.
+ * Both are represented as hex strings without the `0x` prefix.
+ */
+
+/**
+ * Dumps the the storage values for an `account` specified by `address`
+ * @memberof DefaultStateManager
+ * @method dumpStorage
+ * @param {Buffer} address The address of the `account` to return storage for
+ * @param {dumpStorage~callback} cb
+ */
+proto.dumpStorage = function (address, cb) {
+ var self = this;
+ self._getStorageTrie(address, function (err, trie) {
+ if (err) {
+ return cb(err);
+ }
+ var storage = {};
+ var stream = trie.createReadStream();
+ stream.on('data', function (val) {
+ storage[val.key.toString('hex')] = val.value.toString('hex');
+ });
+ stream.on('end', function () {
+ cb(storage);
+ });
+ });
+};
+
+/**
+ * Callback for `hasGenesisState` method
+ * @callback hasGenesisState~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Boolean} hasGenesisState Whether the storage trie contains the
+ * canonical genesis state for the configured chain parameters.
+ */
+
+/**
+ * Checks whether the current instance has the canonical genesis state
+ * for the configured chain parameters.
+ * @memberof DefaultStateManager
+ * @method hasGenesisState
+ * @param {hasGenesisState~callback} cb
+ */
+proto.hasGenesisState = function (cb) {
+ var root = this._common.genesis().stateRoot;
+ this._trie.checkRoot(root, cb);
+};
+
+/**
+ * Generates a canonical genesis state on the instance based on the
+ * configured chain parameters. Will error if there are uncommitted
+ * checkpoints on the instance.
+ * @memberof StateManager
+ * @method generateCanonicalGenesis
+ * @param {Function} cb Callback function
+ */
+proto.generateCanonicalGenesis = function (cb) {
+ var self = this;
+
+ if (self._checkpointCount !== 0) {
+ return cb(new Error('Cannot create genesis state with uncommitted checkpoints'));
+ }
+
+ this.hasGenesisState(function (err, genesis) {
+ if (!genesis && !err) {
+ self.generateGenesis(genesisStateByName(self._common.chainName()), cb);
+ } else {
+ cb(err);
+ }
+ });
+};
+
+/**
+ * Initializes the provided genesis state into the state trie
+ * @memberof DefaultStateManager
+ * @method generateGenesis
+ * @param {Object} initState
+ * @param {Function} cb Callback function
+ */
+proto.generateGenesis = function (initState, cb) {
+ var self = this;
+
+ if (self._checkpointCount !== 0) {
+ return cb(new Error('Cannot create genesis state with uncommitted checkpoints'));
+ }
+
+ var addresses = Object.keys(initState);
+ async.eachSeries(addresses, function (address, done) {
+ var account = new Account();
+ account.balance = new BN(initState[address]).toArrayLike(Buffer);
+ address = utils.toBuffer(address);
+ self._trie.put(address, account.serialize(), done);
+ }, cb);
+};
+
+/**
+ * Callback for `accountIsEmpty` method
+ * @callback accountIsEmpty~callback
+ * @param {Error} error an error that may have happened or `null`
+ * @param {Boolean} empty True if the account is empty false otherwise
+ */
+
+/**
+ * Checks if the `account` corresponding to `address` is empty as defined in
+ * EIP-161 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)
+ * @memberof StateManager
+ * @method accountIsEmpty
+ * @param {Buffer} address Address to check
+ * @param {accountIsEmpty~callback} cb
+ */
+proto.accountIsEmpty = function (address, cb) {
+ var self = this;
+ self.getAccount.bind(this)(address, function (err, account) {
+ if (err) {
+ return cb(err);
+ }
+
+ // should be replaced by account.isEmpty() once updated
+ cb(null, account.nonce.toString('hex') === '' && account.balance.toString('hex') === '' && account.codeHash.toString('hex') === utils.KECCAK256_NULL_S);
+ });
+};
+
+/**
+ * Removes accounts form the state trie that have been touched,
+ * as defined in EIP-161 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md).
+ * @memberof StateManager
+ * @method cleanupTouchedAccounts
+ * @param {Function} cb Callback function
+ */
+proto.cleanupTouchedAccounts = function (cb) {
+ var self = this;
+ var touchedArray = Array.from(self._touched);
+ async.forEach(touchedArray, function (addressHex, next) {
+ var address = Buffer.from(addressHex, 'hex');
+ self.accountIsEmpty(address, function (err, empty) {
+ if (err) {
+ next(err);
+ return;
+ }
+
+ if (empty) {
+ self._cache.del(address);
+ }
+ next(null);
+ });
+ }, function () {
+ self._touched.clear();
+ cb();
+ });
+};
+},{"./cache.js":614,"async":42,"ethereumjs-account":585,"ethereumjs-common":609,"ethereumjs-common/dist/genesisStates":595,"ethereumjs-util":640,"merkle-patricia-tree/secure.js":953,"safe-buffer":1334}],633:[function(require,module,exports){
+'use strict';
+
+module.exports = StorageReader;
+
+function StorageReader(stateManager) {
+ this._stateManager = stateManager;
+ this._storageCache = new Map();
+}
+
+var proto = StorageReader.prototype;
+
+proto.getContractStorage = function getContractStorage(address, key, cb) {
+ var self = this;
+ var addressHex = address.toString('hex');
+ var keyHex = key.toString('hex');
+
+ self._stateManager.getContractStorage(address, key, function (err, current) {
+ if (err) return cb(err);
+
+ var map = null;
+ if (!self._storageCache.has(addressHex)) {
+ map = new Map();
+ self._storageCache.set(addressHex, map);
+ } else {
+ map = self._storageCache.get(addressHex);
+ }
+
+ var original = null;
+
+ if (map.has(keyHex)) {
+ original = map.get(keyHex);
+ } else {
+ map.set(keyHex, current);
+ original = current;
+ }
+
+ cb(null, {
+ original: original,
+ current: current
+ });
+ });
+};
+},{}],634:[function(require,module,exports){
+'use strict';
+
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var pow32 = new BN('010000000000000000000000000000000000000000000000000000000000000000', 16);
+var pow31 = new BN('0100000000000000000000000000000000000000000000000000000000000000', 16);
+var pow30 = new BN('01000000000000000000000000000000000000000000000000000000000000', 16);
+var pow29 = new BN('010000000000000000000000000000000000000000000000000000000000', 16);
+var pow28 = new BN('0100000000000000000000000000000000000000000000000000000000', 16);
+var pow27 = new BN('01000000000000000000000000000000000000000000000000000000', 16);
+var pow26 = new BN('010000000000000000000000000000000000000000000000000000', 16);
+var pow25 = new BN('0100000000000000000000000000000000000000000000000000', 16);
+var pow24 = new BN('01000000000000000000000000000000000000000000000000', 16);
+var pow23 = new BN('010000000000000000000000000000000000000000000000', 16);
+var pow22 = new BN('0100000000000000000000000000000000000000000000', 16);
+var pow21 = new BN('01000000000000000000000000000000000000000000', 16);
+var pow20 = new BN('010000000000000000000000000000000000000000', 16);
+var pow19 = new BN('0100000000000000000000000000000000000000', 16);
+var pow18 = new BN('01000000000000000000000000000000000000', 16);
+var pow17 = new BN('010000000000000000000000000000000000', 16);
+var pow16 = new BN('0100000000000000000000000000000000', 16);
+var pow15 = new BN('01000000000000000000000000000000', 16);
+var pow14 = new BN('010000000000000000000000000000', 16);
+var pow13 = new BN('0100000000000000000000000000', 16);
+var pow12 = new BN('01000000000000000000000000', 16);
+var pow11 = new BN('010000000000000000000000', 16);
+var pow10 = new BN('0100000000000000000000', 16);
+var pow9 = new BN('01000000000000000000', 16);
+var pow8 = new BN('010000000000000000', 16);
+var pow7 = new BN('0100000000000000', 16);
+var pow6 = new BN('01000000000000', 16);
+var pow5 = new BN('010000000000', 16);
+var pow4 = new BN('0100000000', 16);
+var pow3 = new BN('01000000', 16);
+var pow2 = new BN('010000', 16);
+var pow1 = new BN('0100', 16);
+
+module.exports = function (a) {
+ if (a.cmp(pow1) === -1) {
+ return 0;
+ } else if (a.cmp(pow2) === -1) {
+ return 1;
+ } else if (a.cmp(pow3) === -1) {
+ return 2;
+ } else if (a.cmp(pow4) === -1) {
+ return 3;
+ } else if (a.cmp(pow5) === -1) {
+ return 4;
+ } else if (a.cmp(pow6) === -1) {
+ return 5;
+ } else if (a.cmp(pow7) === -1) {
+ return 6;
+ } else if (a.cmp(pow8) === -1) {
+ return 7;
+ } else if (a.cmp(pow9) === -1) {
+ return 8;
+ } else if (a.cmp(pow10) === -1) {
+ return 9;
+ } else if (a.cmp(pow11) === -1) {
+ return 10;
+ } else if (a.cmp(pow12) === -1) {
+ return 11;
+ } else if (a.cmp(pow13) === -1) {
+ return 12;
+ } else if (a.cmp(pow14) === -1) {
+ return 13;
+ } else if (a.cmp(pow15) === -1) {
+ return 14;
+ } else if (a.cmp(pow16) === -1) {
+ return 15;
+ } else if (a.cmp(pow17) === -1) {
+ return 16;
+ } else if (a.cmp(pow18) === -1) {
+ return 17;
+ } else if (a.cmp(pow19) === -1) {
+ return 18;
+ } else if (a.cmp(pow20) === -1) {
+ return 19;
+ } else if (a.cmp(pow21) === -1) {
+ return 20;
+ } else if (a.cmp(pow22) === -1) {
+ return 21;
+ } else if (a.cmp(pow23) === -1) {
+ return 22;
+ } else if (a.cmp(pow24) === -1) {
+ return 23;
+ } else if (a.cmp(pow25) === -1) {
+ return 24;
+ } else if (a.cmp(pow26) === -1) {
+ return 25;
+ } else if (a.cmp(pow27) === -1) {
+ return 26;
+ } else if (a.cmp(pow28) === -1) {
+ return 27;
+ } else if (a.cmp(pow29) === -1) {
+ return 28;
+ } else if (a.cmp(pow30) === -1) {
+ return 29;
+ } else if (a.cmp(pow31) === -1) {
+ return 30;
+ } else if (a.cmp(pow32) === -1) {
+ return 31;
+ } else {
+ return 32;
+ }
+};
+},{"ethereumjs-util":640}],635:[function(require,module,exports){
+'use strict';
+
+var Buffer = require('safe-buffer').Buffer;
+var async = require('async');
+var utils = require('ethereumjs-util');
+var BN = utils.BN;
+var exceptions = require('../exceptions.js');
+var logTable = require('./logTable.js');
+var ERROR = exceptions.ERROR;
+var VmError = exceptions.VmError;
+var MASK_160 = new BN(1).shln(160).subn(1);
+
+// Find Ceil(`this` / `num`)
+BN.prototype.divCeil = function divCeil(num) {
+ var dm = this.divmod(num);
+
+ // Fast case - exact division
+ if (dm.mod.isZero()) return dm.div;
+
+ // Round up
+ return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
+};
+
+function addressToBuffer(address) {
+ return address.and(MASK_160).toArrayLike(Buffer, 'be', 20);
+}
+
+// the opcode functions
+module.exports = {
+ STOP: function STOP(runState) {
+ runState.stopped = true;
+ },
+ ADD: function ADD(a, b, runState) {
+ return a.add(b).mod(utils.TWO_POW256);
+ },
+ MUL: function MUL(a, b, runState) {
+ return a.mul(b).mod(utils.TWO_POW256);
+ },
+ SUB: function SUB(a, b, runState) {
+ return a.sub(b).toTwos(256);
+ },
+ DIV: function DIV(a, b, runState) {
+ if (b.isZero()) {
+ return new BN(b);
+ } else {
+ return a.div(b);
+ }
+ },
+ SDIV: function SDIV(a, b, runState) {
+ if (b.isZero()) {
+ return new BN(b);
+ } else {
+ a = a.fromTwos(256);
+ b = b.fromTwos(256);
+ return a.div(b).toTwos(256);
+ }
+ },
+ MOD: function MOD(a, b, runState) {
+ if (b.isZero()) {
+ return new BN(b);
+ } else {
+ return a.mod(b);
+ }
+ },
+ SMOD: function SMOD(a, b, runState) {
+ if (b.isZero()) {
+ return new BN(b);
+ } else {
+ a = a.fromTwos(256);
+ b = b.fromTwos(256);
+ var r = a.abs().mod(b.abs());
+ if (a.isNeg()) {
+ r = r.ineg();
+ }
+ return r.toTwos(256);
+ }
+ },
+ ADDMOD: function ADDMOD(a, b, c, runState) {
+ if (c.isZero()) {
+ return new BN(c);
+ } else {
+ return a.add(b).mod(c);
+ }
+ },
+ MULMOD: function MULMOD(a, b, c, runState) {
+ if (c.isZero()) {
+ return new BN(c);
+ } else {
+ return a.mul(b).mod(c);
+ }
+ },
+ EXP: function EXP(base, exponent, runState) {
+ if (exponent.isZero()) {
+ return new BN(1);
+ } else {
+ var bytes = 1 + logTable(exponent);
+ subGas(runState, new BN(bytes).muln(runState._common.param('gasPrices', 'expByte')));
+
+ var m = BN.red(utils.TWO_POW256);
+ base = base.toRed(m);
+ return base.redPow(exponent);
+ }
+ },
+ SIGNEXTEND: function SIGNEXTEND(k, val, runState) {
+ val = val.toArrayLike(Buffer, 'be', 32);
+ var extendOnes = false;
+
+ if (k.lten(31)) {
+ k = k.toNumber();
+
+ if (val[31 - k] & 0x80) {
+ extendOnes = true;
+ }
+
+ // 31-k-1 since k-th byte shouldn't be modified
+ for (var i = 30 - k; i >= 0; i--) {
+ val[i] = extendOnes ? 0xff : 0;
+ }
+ }
+
+ return new BN(val);
+ },
+ // 0x10 range - bit ops
+ LT: function LT(a, b, runState) {
+ return new BN(a.lt(b) ? 1 : 0);
+ },
+ GT: function GT(a, b, runState) {
+ return new BN(a.gt(b) ? 1 : 0);
+ },
+ SLT: function SLT(a, b, runState) {
+ return new BN(a.fromTwos(256).lt(b.fromTwos(256)) ? 1 : 0);
+ },
+ SGT: function SGT(a, b, runState) {
+ return new BN(a.fromTwos(256).gt(b.fromTwos(256)) ? 1 : 0);
+ },
+ EQ: function EQ(a, b, runState) {
+ return new BN(a.eq(b) ? 1 : 0);
+ },
+ ISZERO: function ISZERO(a, runState) {
+ return new BN(a.isZero() ? 1 : 0);
+ },
+ AND: function AND(a, b, runState) {
+ return a.and(b);
+ },
+ OR: function OR(a, b, runState) {
+ return a.or(b);
+ },
+ XOR: function XOR(a, b, runState) {
+ return a.xor(b);
+ },
+ NOT: function NOT(a, runState) {
+ return a.notn(256);
+ },
+ BYTE: function BYTE(pos, word, runState) {
+ if (pos.gten(32)) {
+ return new BN(0);
+ }
+
+ return new BN(word.shrn((31 - pos.toNumber()) * 8).andln(0xff));
+ },
+ SHL: function SHL(a, b, runState) {
+ if (!runState._common.gteHardfork('constantinople')) {
+ trap(ERROR.INVALID_OPCODE);
+ }
+ if (a.gten(256)) {
+ return new BN(0);
+ }
+ return b.shln(a.toNumber()).iand(utils.MAX_INTEGER);
+ },
+ SHR: function SHR(a, b, runState) {
+ if (!runState._common.gteHardfork('constantinople')) {
+ trap(ERROR.INVALID_OPCODE);
+ }
+ if (a.gten(256)) {
+ return new BN(0);
+ }
+ return b.shrn(a.toNumber());
+ },
+ SAR: function SAR(a, b, runState) {
+ if (!runState._common.gteHardfork('constantinople')) {
+ trap(ERROR.INVALID_OPCODE);
+ }
+ var isSigned = b.testn(255);
+ if (a.gten(256)) {
+ if (isSigned) {
+ return new BN(utils.MAX_INTEGER);
+ } else {
+ return new BN(0);
+ }
+ }
+ var c = b.shrn(a.toNumber());
+ if (isSigned) {
+ var shiftedOutWidth = 255 - a.toNumber();
+ var mask = utils.MAX_INTEGER.shrn(shiftedOutWidth).shln(shiftedOutWidth);
+ return c.ior(mask);
+ } else {
+ return c;
+ }
+ },
+ // 0x20 range - crypto
+ SHA3: function SHA3(offset, length, runState) {
+ var data = memLoad(runState, offset, length);
+ // copy fee
+ subGas(runState, new BN(runState._common.param('gasPrices', 'sha3Word')).imul(length.divCeil(new BN(32))));
+ return new BN(utils.keccak256(data));
+ },
+ // 0x30 range - closure state
+ ADDRESS: function ADDRESS(runState) {
+ return new BN(runState.address);
+ },
+ BALANCE: function BALANCE(address, runState, cb) {
+ var stateManager = runState.stateManager;
+ // stack to address
+ address = addressToBuffer(address);
+
+ // shortcut if current account
+ if (address.toString('hex') === runState.address.toString('hex')) {
+ cb(null, new BN(runState.contract.balance));
+ return;
+ }
+
+ // otherwise load account then return balance
+ stateManager.getAccount(address, function (err, account) {
+ if (err) {
+ return cb(err);
+ }
+ cb(null, new BN(account.balance));
+ });
+ },
+ ORIGIN: function ORIGIN(runState) {
+ return new BN(runState.origin);
+ },
+ CALLER: function CALLER(runState) {
+ return new BN(runState.caller);
+ },
+ CALLVALUE: function CALLVALUE(runState) {
+ return new BN(runState.callValue);
+ },
+ CALLDATALOAD: function CALLDATALOAD(pos, runState) {
+ if (pos.gtn(runState.callData.length)) {
+ return new BN(0);
+ } else {
+ pos = pos.toNumber();
+ var loaded = runState.callData.slice(pos, pos + 32);
+ loaded = loaded.length ? loaded : Buffer.from([0]);
+ return new BN(utils.setLengthRight(loaded, 32));
+ }
+ },
+ CALLDATASIZE: function CALLDATASIZE(runState) {
+ if (runState.callData.length === 1 && runState.callData[0] === 0) {
+ return new BN(0);
+ } else {
+ return new BN(runState.callData.length);
+ }
+ },
+ CALLDATACOPY: function CALLDATACOPY(memOffset, dataOffset, dataLength, runState) {
+ memStore(runState, memOffset, runState.callData, dataOffset, dataLength);
+ // sub the COPY fee
+ subGas(runState, new BN(runState._common.param('gasPrices', 'copy')).imul(dataLength.divCeil(new BN(32))));
+ },
+ CODESIZE: function CODESIZE(runState) {
+ return new BN(runState.code.length);
+ },
+ CODECOPY: function CODECOPY(memOffset, codeOffset, length, runState) {
+ memStore(runState, memOffset, runState.code, codeOffset, length);
+ // sub the COPY fee
+ subGas(runState, new BN(runState._common.param('gasPrices', 'copy')).imul(length.divCeil(new BN(32))));
+ },
+ EXTCODESIZE: function EXTCODESIZE(address, runState, cb) {
+ var stateManager = runState.stateManager;
+ address = addressToBuffer(address);
+ stateManager.getContractCode(address, function (err, code) {
+ if (err) return cb(err);
+ cb(null, new BN(code.length));
+ });
+ },
+ EXTCODECOPY: function EXTCODECOPY(address, memOffset, codeOffset, length, runState, cb) {
+ var stateManager = runState.stateManager;
+ address = addressToBuffer(address);
+
+ // FIXME: for some reason this must come before subGas
+ subMemUsage(runState, memOffset, length);
+ // copy fee
+ subGas(runState, new BN(runState._common.param('gasPrices', 'copy')).imul(length.divCeil(new BN(32))));
+
+ stateManager.getContractCode(address, function (err, code) {
+ if (err) return cb(err);
+ memStore(runState, memOffset, code, codeOffset, length, false);
+ cb(null);
+ });
+ },
+ EXTCODEHASH: function EXTCODEHASH(address, runState, cb) {
+ if (!runState._common.gteHardfork('constantinople')) {
+ trap(ERROR.INVALID_OPCODE);
+ }
+ var stateManager = runState.stateManager;
+ address = addressToBuffer(address);
+
+ stateManager.getAccount(address, function (err, account) {
+ if (err) return cb(err);
+
+ if (account.isEmpty()) {
+ return cb(null, new BN(0));
+ }
+
+ stateManager.getContractCode(address, function (err, code) {
+ if (err) return cb(err);
+ if (code.length === 0) {
+ return cb(null, new BN(utils.KECCAK256_NULL));
+ }
+
+ return cb(null, new BN(utils.keccak256(code)));
+ });
+ });
+ },
+ RETURNDATASIZE: function RETURNDATASIZE(runState) {
+ return new BN(runState.lastReturned.length);
+ },
+ RETURNDATACOPY: function RETURNDATACOPY(memOffset, returnDataOffset, length, runState) {
+ if (returnDataOffset.add(length).gtn(runState.lastReturned.length)) {
+ trap(ERROR.OUT_OF_GAS);
+ }
+
+ memStore(runState, memOffset, utils.toBuffer(runState.lastReturned), returnDataOffset, length, false);
+ // sub the COPY fee
+ subGas(runState, new BN(runState._common.param('gasPrices', 'copy')).mul(length.divCeil(new BN(32))));
+ },
+ GASPRICE: function GASPRICE(runState) {
+ return new BN(runState.gasPrice);
+ },
+ // '0x40' range - block operations
+ BLOCKHASH: function BLOCKHASH(number, runState, cb) {
+ var blockchain = runState.blockchain;
+ var diff = new BN(runState.block.header.number).sub(number);
+
+ // block lookups must be within the past 256 blocks
+ if (diff.gtn(256) || diff.lten(0)) {
+ cb(null, new BN(0));
+ return;
+ }
+
+ blockchain.getBlock(number, function (err, block) {
+ if (err) return cb(err);
+ var blockHash = block.hash();
+ cb(null, new BN(blockHash));
+ });
+ },
+ COINBASE: function COINBASE(runState) {
+ return new BN(runState.block.header.coinbase);
+ },
+ TIMESTAMP: function TIMESTAMP(runState) {
+ return new BN(runState.block.header.timestamp);
+ },
+ NUMBER: function NUMBER(runState) {
+ return new BN(runState.block.header.number);
+ },
+ DIFFICULTY: function DIFFICULTY(runState) {
+ return new BN(runState.block.header.difficulty);
+ },
+ GASLIMIT: function GASLIMIT(runState) {
+ return new BN(runState.block.header.gasLimit);
+ },
+ // 0x50 range - 'storage' and execution
+ POP: function POP() {},
+ MLOAD: function MLOAD(pos, runState) {
+ return new BN(memLoad(runState, pos, new BN(32)));
+ },
+ MSTORE: function MSTORE(offset, word, runState) {
+ word = word.toArrayLike(Buffer, 'be', 32);
+ memStore(runState, offset, word, new BN(0), new BN(32));
+ },
+ MSTORE8: function MSTORE8(offset, byte, runState) {
+ // NOTE: we're using a 'trick' here to get the least significant byte
+ byte = Buffer.from([byte.andln(0xff)]);
+ memStore(runState, offset, byte, new BN(0), new BN(1));
+ },
+ SLOAD: function SLOAD(key, runState, cb) {
+ var stateManager = runState.stateManager;
+ key = key.toArrayLike(Buffer, 'be', 32);
+
+ stateManager.getContractStorage(runState.address, key, function (err, value) {
+ if (err) return cb(err);
+ value = value.length ? new BN(value) : new BN(0);
+ cb(null, value);
+ });
+ },
+ SSTORE: function SSTORE(key, val, runState, cb) {
+ if (runState.static) {
+ trap(ERROR.STATIC_STATE_CHANGE);
+ }
+ var stateManager = runState.stateManager;
+ var address = runState.address;
+ key = key.toArrayLike(Buffer, 'be', 32);
+ // NOTE: this should be the shortest representation
+ var value;
+ if (val.isZero()) {
+ value = Buffer.from([]);
+ } else {
+ value = val.toArrayLike(Buffer, 'be');
+ }
+
+ getContractStorage(runState, address, key, function (err, found) {
+ if (err) return cb(err);
+ try {
+ updateSstoreGas(runState, found, value);
+ } catch (e) {
+ cb(e.error);
+ return;
+ }
+
+ stateManager.putContractStorage(address, key, value, function (err) {
+ if (err) return cb(err);
+ stateManager.getAccount(address, function (err, account) {
+ if (err) return cb(err);
+ runState.contract = account;
+ cb(null);
+ });
+ });
+ });
+ },
+ JUMP: function JUMP(dest, runState) {
+ if (dest.gtn(runState.code.length)) {
+ trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState));
+ }
+
+ dest = dest.toNumber();
+
+ if (!jumpIsValid(runState, dest)) {
+ trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState));
+ }
+
+ runState.programCounter = dest;
+ },
+ JUMPI: function JUMPI(dest, cond, runState) {
+ if (!cond.isZero()) {
+ if (dest.gtn(runState.code.length)) {
+ trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState));
+ }
+
+ dest = dest.toNumber();
+
+ if (!jumpIsValid(runState, dest)) {
+ trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState));
+ }
+
+ runState.programCounter = dest;
+ }
+ },
+ PC: function PC(runState) {
+ return new BN(runState.programCounter - 1);
+ },
+ MSIZE: function MSIZE(runState) {
+ return runState.memoryWordCount.muln(32);
+ },
+ GAS: function GAS(runState) {
+ return new BN(runState.gasLeft);
+ },
+ JUMPDEST: function JUMPDEST(runState) {},
+ PUSH: function PUSH(runState) {
+ var numToPush = runState.opCode - 0x5f;
+ var loaded = new BN(runState.code.slice(runState.programCounter, runState.programCounter + numToPush).toString('hex'), 16);
+ runState.programCounter += numToPush;
+ return loaded;
+ },
+ DUP: function DUP(runState) {
+ // NOTE: this function manipulates the stack directly!
+
+ var stackPos = runState.opCode - 0x7f;
+ if (stackPos > runState.stack.length) {
+ trap(ERROR.STACK_UNDERFLOW);
+ }
+ // create a new copy
+ return new BN(runState.stack[runState.stack.length - stackPos]);
+ },
+ SWAP: function SWAP(runState) {
+ // NOTE: this function manipulates the stack directly!
+
+ var stackPos = runState.opCode - 0x8f;
+
+ // check the stack to make sure we have enough items on teh stack
+ var swapIndex = runState.stack.length - stackPos - 1;
+ if (swapIndex < 0) {
+ trap(ERROR.STACK_UNDERFLOW);
+ }
+
+ // preform the swap
+ var topIndex = runState.stack.length - 1;
+ var tmp = runState.stack[topIndex];
+ runState.stack[topIndex] = runState.stack[swapIndex];
+ runState.stack[swapIndex] = tmp;
+ },
+ LOG: function LOG(memOffset, memLength) {
+ var args = Array.prototype.slice.call(arguments, 0);
+ var runState = args.pop();
+ if (runState.static) {
+ trap(ERROR.STATIC_STATE_CHANGE);
+ }
+
+ var topics = args.slice(2);
+ topics = topics.map(function (a) {
+ return a.toArrayLike(Buffer, 'be', 32);
+ });
+
+ var numOfTopics = runState.opCode - 0xa0;
+ var mem = memLoad(runState, memOffset, memLength);
+ subGas(runState, new BN(runState._common.param('gasPrices', 'logTopic')).imuln(numOfTopics).iadd(memLength.muln(runState._common.param('gasPrices', 'logData'))));
+
+ // add address
+ var log = [runState.address];
+ log.push(topics);
+
+ // add data
+ log.push(mem);
+ runState.logs.push(log);
+ },
+
+ // '0xf0' range - closures
+ CREATE: function CREATE(value, offset, length, runState, done) {
+ if (runState.static) {
+ trap(ERROR.STATIC_STATE_CHANGE);
+ }
+
+ var data = memLoad(runState, offset, length);
+
+ // set up config
+ var options = {
+ value: value,
+ data: data
+ };
+
+ var localOpts = {
+ inOffset: offset,
+ inLength: length,
+ outOffset: new BN(0),
+ outLength: new BN(0)
+ };
+
+ checkCallMemCost(runState, options, localOpts);
+ checkOutOfGas(runState, options);
+ makeCall(runState, options, localOpts, done);
+ },
+ CREATE2: function CREATE2(value, offset, length, salt, runState, done) {
+ if (!runState._common.gteHardfork('constantinople')) {
+ trap(ERROR.INVALID_OPCODE);
+ }
+
+ if (runState.static) {
+ trap(ERROR.STATIC_STATE_CHANGE);
+ }
+
+ var data = memLoad(runState, offset, length);
+
+ // set up config
+ var options = {
+ value: value,
+ data: data,
+ salt: salt.toArrayLike(Buffer, 'be', 32)
+ };
+
+ var localOpts = {
+ inOffset: offset,
+ inLength: length,
+ outOffset: new BN(0),
+ outLength: new BN(0)
+
+ // Deduct gas costs for hashing
+ };subGas(runState, new BN(runState._common.param('gasPrices', 'sha3Word')).imul(length.divCeil(new BN(32))));
+ checkCallMemCost(runState, options, localOpts);
+ checkOutOfGas(runState, options);
+ makeCall(runState, options, localOpts, done);
+ },
+ CALL: function CALL(gasLimit, toAddress, value, inOffset, inLength, outOffset, outLength, runState, done) {
+ var stateManager = runState.stateManager;
+ toAddress = addressToBuffer(toAddress);
+
+ if (runState.static && !value.isZero()) {
+ trap(ERROR.STATIC_STATE_CHANGE);
+ }
+
+ var data = memLoad(runState, inOffset, inLength);
+
+ var options = {
+ gasLimit: gasLimit,
+ value: value,
+ to: toAddress,
+ data: data,
+ static: runState.static
+ };
+
+ var localOpts = {
+ inOffset: inOffset,
+ inLength: inLength,
+ outOffset: outOffset,
+ outLength: outLength
+ };
+
+ if (!value.isZero()) {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'callValueTransfer')));
+ }
+
+ stateManager.accountIsEmpty(toAddress, function (err, empty) {
+ if (err) {
+ done(err);
+ return;
+ }
+
+ if (empty) {
+ if (!value.isZero()) {
+ try {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'callNewAccount')));
+ } catch (e) {
+ done(e.error);
+ return;
+ }
+ }
+ }
+
+ try {
+ checkCallMemCost(runState, options, localOpts);
+ checkOutOfGas(runState, options);
+ } catch (e) {
+ done(e.error);
+ return;
+ }
+
+ if (!value.isZero()) {
+ runState.gasLeft.iaddn(runState._common.param('gasPrices', 'callStipend'));
+ options.gasLimit.iaddn(runState._common.param('gasPrices', 'callStipend'));
+ }
+
+ makeCall(runState, options, localOpts, done);
+ });
+ },
+ CALLCODE: function CALLCODE(gas, toAddress, value, inOffset, inLength, outOffset, outLength, runState, done) {
+ var stateManager = runState.stateManager;
+ toAddress = addressToBuffer(toAddress);
+
+ var data = memLoad(runState, inOffset, inLength);
+
+ var options = {
+ gasLimit: gas,
+ value: value,
+ data: data,
+ to: runState.address,
+ static: runState.static
+ };
+
+ var localOpts = {
+ inOffset: inOffset,
+ inLength: inLength,
+ outOffset: outOffset,
+ outLength: outLength
+ };
+
+ if (!value.isZero()) {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'callValueTransfer')));
+ }
+
+ checkCallMemCost(runState, options, localOpts);
+ checkOutOfGas(runState, options);
+
+ if (!value.isZero()) {
+ runState.gasLeft.iaddn(runState._common.param('gasPrices', 'callStipend'));
+ options.gasLimit.iaddn(runState._common.param('gasPrices', 'callStipend'));
+ }
+
+ // load the code
+ stateManager.getAccount(toAddress, function (err, account) {
+ if (err) return done(err);
+ if (runState._precompiled[toAddress.toString('hex')]) {
+ options.compiled = true;
+ options.code = runState._precompiled[toAddress.toString('hex')];
+ makeCall(runState, options, localOpts, done);
+ } else {
+ stateManager.getContractCode(toAddress, function (err, code, compiled) {
+ if (err) return done(err);
+ options.compiled = compiled || false;
+ options.code = code;
+ makeCall(runState, options, localOpts, done);
+ });
+ }
+ });
+ },
+ DELEGATECALL: function DELEGATECALL(gas, toAddress, inOffset, inLength, outOffset, outLength, runState, done) {
+ var stateManager = runState.stateManager;
+ var value = runState.callValue;
+ toAddress = addressToBuffer(toAddress);
+
+ var data = memLoad(runState, inOffset, inLength);
+
+ var options = {
+ gasLimit: gas,
+ value: value,
+ data: data,
+ to: runState.address,
+ caller: runState.caller,
+ delegatecall: true,
+ static: runState.static
+ };
+
+ var localOpts = {
+ inOffset: inOffset,
+ inLength: inLength,
+ outOffset: outOffset,
+ outLength: outLength
+ };
+
+ checkCallMemCost(runState, options, localOpts);
+ checkOutOfGas(runState, options);
+
+ // load the code
+ stateManager.getAccount(toAddress, function (err, account) {
+ if (err) return done(err);
+ if (runState._precompiled[toAddress.toString('hex')]) {
+ options.compiled = true;
+ options.code = runState._precompiled[toAddress.toString('hex')];
+ makeCall(runState, options, localOpts, done);
+ } else {
+ stateManager.getContractCode(toAddress, function (err, code, compiled) {
+ if (err) return done(err);
+ options.compiled = compiled || false;
+ options.code = code;
+ makeCall(runState, options, localOpts, done);
+ });
+ }
+ });
+ },
+ STATICCALL: function STATICCALL(gasLimit, toAddress, inOffset, inLength, outOffset, outLength, runState, done) {
+ var value = new BN(0);
+ toAddress = addressToBuffer(toAddress);
+
+ var data = memLoad(runState, inOffset, inLength);
+
+ var options = {
+ gasLimit: gasLimit,
+ value: value,
+ to: toAddress,
+ data: data,
+ static: true
+ };
+
+ var localOpts = {
+ inOffset: inOffset,
+ inLength: inLength,
+ outOffset: outOffset,
+ outLength: outLength
+ };
+
+ try {
+ checkCallMemCost(runState, options, localOpts);
+ checkOutOfGas(runState, options);
+ } catch (e) {
+ done(e.error);
+ return;
+ }
+
+ makeCall(runState, options, localOpts, done);
+ },
+ RETURN: function RETURN(offset, length, runState) {
+ runState.returnValue = memLoad(runState, offset, length);
+ },
+ REVERT: function REVERT(offset, length, runState) {
+ runState.stopped = true;
+ runState.returnValue = memLoad(runState, offset, length);
+ trap(ERROR.REVERT);
+ },
+ // '0x70', range - other
+ SELFDESTRUCT: function SELFDESTRUCT(selfdestructToAddress, runState, cb) {
+ if (runState.static) {
+ trap(ERROR.STATIC_STATE_CHANGE);
+ }
+ var stateManager = runState.stateManager;
+ var contract = runState.contract;
+ var contractAddress = runState.address;
+ selfdestructToAddress = addressToBuffer(selfdestructToAddress);
+
+ stateManager.getAccount(selfdestructToAddress, function (err, toAccount) {
+ // update balances
+ if (err) {
+ cb(err);
+ return;
+ }
+
+ stateManager.accountIsEmpty(selfdestructToAddress, function (error, empty) {
+ if (error) {
+ cb(error);
+ return;
+ }
+
+ if (new BN(contract.balance).gtn(0)) {
+ if (empty) {
+ try {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'callNewAccount')));
+ } catch (e) {
+ cb(e.error);
+ return;
+ }
+ }
+ }
+
+ // only add to refund if this is the first selfdestruct for the address
+ if (!runState.selfdestruct[contractAddress.toString('hex')]) {
+ runState.gasRefund = runState.gasRefund.addn(runState._common.param('gasPrices', 'selfdestructRefund'));
+ }
+ runState.selfdestruct[contractAddress.toString('hex')] = selfdestructToAddress;
+ runState.stopped = true;
+
+ var newBalance = new BN(contract.balance).add(new BN(toAccount.balance));
+ async.waterfall([stateManager.getAccount.bind(stateManager, selfdestructToAddress), function (account, cb) {
+ account.balance = newBalance;
+ stateManager.putAccount(selfdestructToAddress, account, cb);
+ }, stateManager.getAccount.bind(stateManager, contractAddress), function (account, cb) {
+ account.balance = new BN(0);
+ stateManager.putAccount(contractAddress, account, cb);
+ }], function (err) {
+ // The reason for this is to avoid sending an array of results
+ cb(err);
+ });
+ });
+ });
+ }
+};
+
+function describeLocation(runState) {
+ var hash = utils.keccak256(runState.code).toString('hex');
+ var address = runState.address.toString('hex');
+ var pc = runState.programCounter - 1;
+ return hash + '/' + address + ':' + pc;
+}
+
+function subGas(runState, amount) {
+ runState.gasLeft.isub(amount);
+ if (runState.gasLeft.ltn(0)) {
+ runState.gasLeft = new BN(0);
+ trap(ERROR.OUT_OF_GAS);
+ }
+}
+
+function trap(err) {
+ throw new VmError(err);
+}
+
+/**
+ * Subtracts the amount needed for memory usage from `runState.gasLeft`
+ * @method subMemUsage
+ * @param {Object} runState
+ * @param {BN} offset
+ * @param {BN} length
+ * @returns {String}
+ */
+function subMemUsage(runState, offset, length) {
+ // YP (225): access with zero length will not extend the memory
+ if (length.isZero()) return;
+
+ var newMemoryWordCount = offset.add(length).divCeil(new BN(32));
+ if (newMemoryWordCount.lte(runState.memoryWordCount)) return;
+
+ var words = newMemoryWordCount;
+ var fee = new BN(runState._common.param('gasPrices', 'memory'));
+ var quadCoeff = new BN(runState._common.param('gasPrices', 'quadCoeffDiv'));
+ // words * 3 + words ^2 / 512
+ var cost = words.mul(fee).add(words.mul(words).div(quadCoeff));
+
+ if (cost.gt(runState.highestMemCost)) {
+ subGas(runState, cost.sub(runState.highestMemCost));
+ runState.highestMemCost = cost;
+ }
+
+ runState.memoryWordCount = newMemoryWordCount;
+}
+
+/**
+ * Loads bytes from memory and returns them as a buffer. If an error occurs
+ * a string is instead returned. The function also subtracts the amount of
+ * gas need for memory expansion.
+ * @method memLoad
+ * @param {Object} runState
+ * @param {BN} offset where to start reading from
+ * @param {BN} length how far to read
+ * @returns {Buffer|String}
+ */
+function memLoad(runState, offset, length) {
+ // check to see if we have enougth gas for the mem read
+ subMemUsage(runState, offset, length);
+
+ // shortcut
+ if (length.isZero()) {
+ return Buffer.alloc(0);
+ }
+
+ // NOTE: in theory this could overflow, but unlikely due to OOG above
+ offset = offset.toNumber();
+ length = length.toNumber();
+
+ var loaded = runState.memory.slice(offset, offset + length);
+ // fill the remaining lenth with zeros
+ for (var i = loaded.length; i < length; i++) {
+ loaded[i] = 0;
+ }
+ return Buffer.from(loaded);
+}
+
+/**
+ * Stores bytes to memory. If an error occurs a string is instead returned.
+ * The function also subtracts the amount of gas need for memory expansion.
+ * @method memStore
+ * @param {Object} runState
+ * @param {BN} offset where to start reading from
+ * @param {Buffer} val
+ * @param {BN} valOffset
+ * @param {BN} length how far to read
+ * @param {Boolean} skipSubMem
+ * @returns {Buffer|String}
+ */
+function memStore(runState, offset, val, valOffset, length, skipSubMem) {
+ if (skipSubMem !== false) {
+ subMemUsage(runState, offset, length);
+ }
+
+ // shortcut
+ if (length.isZero()) {
+ return;
+ }
+
+ // NOTE: in theory this could overflow, but unlikely due to OOG above
+ offset = offset.toNumber();
+ length = length.toNumber();
+
+ var safeLen = 0;
+ if (valOffset.addn(length).gtn(val.length)) {
+ if (valOffset.gten(val.length)) {
+ safeLen = 0;
+ } else {
+ valOffset = valOffset.toNumber();
+ safeLen = val.length - valOffset;
+ }
+ } else {
+ valOffset = valOffset.toNumber();
+ safeLen = val.length;
+ }
+
+ var i = 0;
+ if (safeLen > 0) {
+ safeLen = safeLen > length ? length : safeLen;
+ for (; i < safeLen; i++) {
+ runState.memory[offset + i] = val[valOffset + i];
+ }
+ }
+
+ /*
+ pad the remaining length with zeros IF AND ONLY IF a value was stored
+ (even if value offset > value length, strange spec...)
+ */
+ if (val.length > 0 && i < length) {
+ for (; i < length; i++) {
+ runState.memory[offset + i] = 0;
+ }
+ }
+}
+
+// checks if a jump is valid given a destination
+function jumpIsValid(runState, dest) {
+ return runState.validJumps.indexOf(dest) !== -1;
+}
+
+// checks to see if we have enough gas left for the memory reads and writes
+// required by the CALLs
+function checkCallMemCost(runState, callOptions, localOpts) {
+ // calculates the gas need for saving the output in memory
+ subMemUsage(runState, localOpts.outOffset, localOpts.outLength);
+
+ if (!callOptions.gasLimit) {
+ callOptions.gasLimit = new BN(runState.gasLeft);
+ }
+}
+
+function checkOutOfGas(runState, callOptions) {
+ var gasAllowed = runState.gasLeft.sub(runState.gasLeft.divn(64));
+ if (callOptions.gasLimit.gt(gasAllowed)) {
+ callOptions.gasLimit = gasAllowed;
+ }
+}
+
+// sets up and calls runCall
+function makeCall(runState, callOptions, localOpts, cb) {
+ var selfdestruct = Object.assign({}, runState.selfdestruct);
+ callOptions.caller = callOptions.caller || runState.address;
+ callOptions.origin = runState.origin;
+ callOptions.gasPrice = runState.gasPrice;
+ callOptions.block = runState.block;
+ callOptions.static = callOptions.static || false;
+ callOptions.selfdestruct = selfdestruct;
+ callOptions.storageReader = runState.storageReader;
+
+ // increment the runState.depth
+ callOptions.depth = runState.depth + 1;
+
+ // empty the return data buffer
+ runState.lastReturned = Buffer.alloc(0);
+
+ // check if account has enough ether
+ // Note: in the case of delegatecall, the value is persisted and doesn't need to be deducted again
+ if (runState.depth >= runState._common.param('vm', 'stackLimit') || callOptions.delegatecall !== true && new BN(runState.contract.balance).lt(callOptions.value)) {
+ cb(null, new BN(0));
+ } else {
+ // if creating a new contract then increament the nonce
+ if (!callOptions.to) {
+ runState.contract.nonce = new BN(runState.contract.nonce).addn(1);
+ }
+
+ runState.stateManager.putAccount(runState.address, runState.contract, function (err) {
+ if (err) return cb(err);
+ runState._vm.runCall(callOptions, parseCallResults);
+ });
+ }
+
+ function parseCallResults(err, results) {
+ if (err) return cb(err);
+
+ // concat the runState.logs
+ if (results.vm.logs) {
+ runState.logs = runState.logs.concat(results.vm.logs);
+ }
+
+ // add gasRefund
+ if (results.vm.gasRefund) {
+ runState.gasRefund = runState.gasRefund.add(results.vm.gasRefund);
+ }
+
+ // this should always be safe
+ runState.gasLeft.isub(results.gasUsed);
+
+ // save results to memory
+ if (results.vm.return && (!results.vm.exceptionError || results.vm.exceptionError.error === ERROR.REVERT)) {
+ memStore(runState, localOpts.outOffset, results.vm.return, new BN(0), localOpts.outLength, false);
+
+ if (results.vm.exceptionError && results.vm.exceptionError.error === ERROR.REVERT && isCreateOpCode(runState.opName)) {
+ runState.lastReturned = results.vm.return;
+ }
+
+ switch (runState.opName) {
+ case 'CALL':
+ case 'CALLCODE':
+ case 'DELEGATECALL':
+ case 'STATICCALL':
+ runState.lastReturned = results.vm.return;
+ break;
+ }
+ }
+
+ if (!results.vm.exceptionError) {
+ Object.assign(runState.selfdestruct, selfdestruct);
+ // update stateRoot on current contract
+ runState.stateManager.getAccount(runState.address, function (err, account) {
+ if (err) return cb(err);
+
+ runState.contract = account;
+ // push the created address to the stack
+ if (results.createdAddress) {
+ cb(null, new BN(results.createdAddress));
+ } else {
+ cb(null, new BN(results.vm.exception));
+ }
+ });
+ } else {
+ // creation failed so don't increment the nonce
+ if (results.vm.createdAddress) {
+ runState.contract.nonce = new BN(runState.contract.nonce).subn(1);
+ }
+
+ cb(null, new BN(results.vm.exception));
+ }
+ }
+}
+
+function isCreateOpCode(opName) {
+ return opName === 'CREATE' || opName === 'CREATE2';
+}
+
+function getContractStorage(runState, address, key, cb) {
+ if (runState._common.hardfork() === 'constantinople') {
+ runState.storageReader.getContractStorage(address, key, cb);
+ } else {
+ runState.stateManager.getContractStorage(address, key, cb);
+ }
+}
+
+function updateSstoreGas(runState, found, value) {
+ if (runState._common.hardfork() === 'constantinople') {
+ var original = found.original;
+ var current = found.current;
+ if (current.equals(value)) {
+ // If current value equals new value (this is a no-op), 200 gas is deducted.
+ subGas(runState, new BN(runState._common.param('gasPrices', 'netSstoreNoopGas')));
+ return;
+ }
+ // If current value does not equal new value
+ if (original.equals(current)) {
+ // If original value equals current value (this storage slot has not been changed by the current execution context)
+ if (original.length === 0) {
+ // If original value is 0, 20000 gas is deducted.
+ return subGas(runState, new BN(runState._common.param('gasPrices', 'netSstoreInitGas')));
+ }
+ if (value.length === 0) {
+ // If new value is 0, add 15000 gas to refund counter.
+ runState.gasRefund = runState.gasRefund.addn(runState._common.param('gasPrices', 'netSstoreClearRefund'));
+ }
+ // Otherwise, 5000 gas is deducted.
+ return subGas(runState, new BN(runState._common.param('gasPrices', 'netSstoreCleanGas')));
+ }
+ // If original value does not equal current value (this storage slot is dirty), 200 gas is deducted. Apply both of the following clauses.
+ if (original.length !== 0) {
+ // If original value is not 0
+ if (current.length === 0) {
+ // If current value is 0 (also means that new value is not 0), remove 15000 gas from refund counter. We can prove that refund counter will never go below 0.
+ runState.gasRefund = runState.gasRefund.subn(runState._common.param('gasPrices', 'netSstoreClearRefund'));
+ } else if (value.length === 0) {
+ // If new value is 0 (also means that current value is not 0), add 15000 gas to refund counter.
+ runState.gasRefund = runState.gasRefund.addn(runState._common.param('gasPrices', 'netSstoreClearRefund'));
+ }
+ }
+ if (original.equals(value)) {
+ // If original value equals new value (this storage slot is reset)
+ if (original.length === 0) {
+ // If original value is 0, add 19800 gas to refund counter.
+ runState.gasRefund = runState.gasRefund.addn(runState._common.param('gasPrices', 'netSstoreResetClearRefund'));
+ } else {
+ // Otherwise, add 4800 gas to refund counter.
+ runState.gasRefund = runState.gasRefund.addn(runState._common.param('gasPrices', 'netSstoreResetRefund'));
+ }
+ }
+ return subGas(runState, new BN(runState._common.param('gasPrices', 'netSstoreDirtyGas')));
+ } else {
+ if (value.length === 0 && !found.length) {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'sstoreReset')));
+ } else if (value.length === 0 && found.length) {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'sstoreReset')));
+ runState.gasRefund.iaddn(runState._common.param('gasPrices', 'sstoreRefund'));
+ } else if (value.length !== 0 && !found.length) {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'sstoreSet')));
+ } else if (value.length !== 0 && found.length) {
+ subGas(runState, new BN(runState._common.param('gasPrices', 'sstoreReset')));
+ }
+ }
+}
+},{"../exceptions.js":615,"./logTable.js":634,"async":42,"ethereumjs-util":640,"safe-buffer":1334}],636:[function(require,module,exports){
+'use strict';
+
+var codes = {
+ // 0x0 range - arithmetic ops
+ // name, baseCost, off stack, on stack, dynamic, async
+ 0x00: ['STOP', 0, 0, 0, false],
+ 0x01: ['ADD', 3, 2, 1, false],
+ 0x02: ['MUL', 5, 2, 1, false],
+ 0x03: ['SUB', 3, 2, 1, false],
+ 0x04: ['DIV', 5, 2, 1, false],
+ 0x05: ['SDIV', 5, 2, 1, false],
+ 0x06: ['MOD', 5, 2, 1, false],
+ 0x07: ['SMOD', 5, 2, 1, false],
+ 0x08: ['ADDMOD', 8, 3, 1, false],
+ 0x09: ['MULMOD', 8, 3, 1, false],
+ 0x0a: ['EXP', 10, 2, 1, false],
+ 0x0b: ['SIGNEXTEND', 5, 2, 1, false],
+
+ // 0x10 range - bit ops
+ 0x10: ['LT', 3, 2, 1, false],
+ 0x11: ['GT', 3, 2, 1, false],
+ 0x12: ['SLT', 3, 2, 1, false],
+ 0x13: ['SGT', 3, 2, 1, false],
+ 0x14: ['EQ', 3, 2, 1, false],
+ 0x15: ['ISZERO', 3, 1, 1, false],
+ 0x16: ['AND', 3, 2, 1, false],
+ 0x17: ['OR', 3, 2, 1, false],
+ 0x18: ['XOR', 3, 2, 1, false],
+ 0x19: ['NOT', 3, 1, 1, false],
+ 0x1a: ['BYTE', 3, 2, 1, false],
+ 0x1b: ['SHL', 3, 2, 1, false],
+ 0x1c: ['SHR', 3, 2, 1, false],
+ 0x1d: ['SAR', 3, 2, 1, false],
+
+ // 0x20 range - crypto
+ 0x20: ['SHA3', 30, 2, 1, false],
+
+ // 0x30 range - closure state
+ 0x30: ['ADDRESS', 2, 0, 1, true],
+ 0x31: ['BALANCE', 400, 1, 1, true, true],
+ 0x32: ['ORIGIN', 2, 0, 1, true],
+ 0x33: ['CALLER', 2, 0, 1, true],
+ 0x34: ['CALLVALUE', 2, 0, 1, true],
+ 0x35: ['CALLDATALOAD', 3, 1, 1, true],
+ 0x36: ['CALLDATASIZE', 2, 0, 1, true],
+ 0x37: ['CALLDATACOPY', 3, 3, 0, true],
+ 0x38: ['CODESIZE', 2, 0, 1, false],
+ 0x39: ['CODECOPY', 3, 3, 0, false],
+ 0x3a: ['GASPRICE', 2, 0, 1, false],
+ 0x3b: ['EXTCODESIZE', 700, 1, 1, true, true],
+ 0x3c: ['EXTCODECOPY', 700, 4, 0, true, true],
+ 0x3d: ['RETURNDATASIZE', 2, 0, 1, true],
+ 0x3e: ['RETURNDATACOPY', 3, 3, 0, true],
+ 0x3f: ['EXTCODEHASH', 400, 1, 1, true, true],
+
+ // '0x40' range - block operations
+ 0x40: ['BLOCKHASH', 20, 1, 1, true, true],
+ 0x41: ['COINBASE', 2, 0, 1, true],
+ 0x42: ['TIMESTAMP', 2, 0, 1, true],
+ 0x43: ['NUMBER', 2, 0, 1, true],
+ 0x44: ['DIFFICULTY', 2, 0, 1, true],
+ 0x45: ['GASLIMIT', 2, 0, 1, true],
+
+ // 0x50 range - 'storage' and execution
+ 0x50: ['POP', 2, 1, 0, false],
+ 0x51: ['MLOAD', 3, 1, 1, false],
+ 0x52: ['MSTORE', 3, 2, 0, false],
+ 0x53: ['MSTORE8', 3, 2, 0, false],
+ 0x54: ['SLOAD', 200, 1, 1, true, true],
+ 0x55: ['SSTORE', 0, 2, 0, true, true],
+ 0x56: ['JUMP', 8, 1, 0, false],
+ 0x57: ['JUMPI', 10, 2, 0, false],
+ 0x58: ['PC', 2, 0, 1, false],
+ 0x59: ['MSIZE', 2, 0, 1, false],
+ 0x5a: ['GAS', 2, 0, 1, false],
+ 0x5b: ['JUMPDEST', 1, 0, 0, false],
+
+ // 0x60, range
+ 0x60: ['PUSH', 3, 0, 1, false],
+ 0x61: ['PUSH', 3, 0, 1, false],
+ 0x62: ['PUSH', 3, 0, 1, false],
+ 0x63: ['PUSH', 3, 0, 1, false],
+ 0x64: ['PUSH', 3, 0, 1, false],
+ 0x65: ['PUSH', 3, 0, 1, false],
+ 0x66: ['PUSH', 3, 0, 1, false],
+ 0x67: ['PUSH', 3, 0, 1, false],
+ 0x68: ['PUSH', 3, 0, 1, false],
+ 0x69: ['PUSH', 3, 0, 1, false],
+ 0x6a: ['PUSH', 3, 0, 1, false],
+ 0x6b: ['PUSH', 3, 0, 1, false],
+ 0x6c: ['PUSH', 3, 0, 1, false],
+ 0x6d: ['PUSH', 3, 0, 1, false],
+ 0x6e: ['PUSH', 3, 0, 1, false],
+ 0x6f: ['PUSH', 3, 0, 1, false],
+ 0x70: ['PUSH', 3, 0, 1, false],
+ 0x71: ['PUSH', 3, 0, 1, false],
+ 0x72: ['PUSH', 3, 0, 1, false],
+ 0x73: ['PUSH', 3, 0, 1, false],
+ 0x74: ['PUSH', 3, 0, 1, false],
+ 0x75: ['PUSH', 3, 0, 1, false],
+ 0x76: ['PUSH', 3, 0, 1, false],
+ 0x77: ['PUSH', 3, 0, 1, false],
+ 0x78: ['PUSH', 3, 0, 1, false],
+ 0x79: ['PUSH', 3, 0, 1, false],
+ 0x7a: ['PUSH', 3, 0, 1, false],
+ 0x7b: ['PUSH', 3, 0, 1, false],
+ 0x7c: ['PUSH', 3, 0, 1, false],
+ 0x7d: ['PUSH', 3, 0, 1, false],
+ 0x7e: ['PUSH', 3, 0, 1, false],
+ 0x7f: ['PUSH', 3, 0, 1, false],
+
+ 0x80: ['DUP', 3, 0, 1, false],
+ 0x81: ['DUP', 3, 0, 1, false],
+ 0x82: ['DUP', 3, 0, 1, false],
+ 0x83: ['DUP', 3, 0, 1, false],
+ 0x84: ['DUP', 3, 0, 1, false],
+ 0x85: ['DUP', 3, 0, 1, false],
+ 0x86: ['DUP', 3, 0, 1, false],
+ 0x87: ['DUP', 3, 0, 1, false],
+ 0x88: ['DUP', 3, 0, 1, false],
+ 0x89: ['DUP', 3, 0, 1, false],
+ 0x8a: ['DUP', 3, 0, 1, false],
+ 0x8b: ['DUP', 3, 0, 1, false],
+ 0x8c: ['DUP', 3, 0, 1, false],
+ 0x8d: ['DUP', 3, 0, 1, false],
+ 0x8e: ['DUP', 3, 0, 1, false],
+ 0x8f: ['DUP', 3, 0, 1, false],
+
+ 0x90: ['SWAP', 3, 0, 0, false],
+ 0x91: ['SWAP', 3, 0, 0, false],
+ 0x92: ['SWAP', 3, 0, 0, false],
+ 0x93: ['SWAP', 3, 0, 0, false],
+ 0x94: ['SWAP', 3, 0, 0, false],
+ 0x95: ['SWAP', 3, 0, 0, false],
+ 0x96: ['SWAP', 3, 0, 0, false],
+ 0x97: ['SWAP', 3, 0, 0, false],
+ 0x98: ['SWAP', 3, 0, 0, false],
+ 0x99: ['SWAP', 3, 0, 0, false],
+ 0x9a: ['SWAP', 3, 0, 0, false],
+ 0x9b: ['SWAP', 3, 0, 0, false],
+ 0x9c: ['SWAP', 3, 0, 0, false],
+ 0x9d: ['SWAP', 3, 0, 0, false],
+ 0x9e: ['SWAP', 3, 0, 0, false],
+ 0x9f: ['SWAP', 3, 0, 0, false],
+
+ 0xa0: ['LOG', 375, 2, 0, false],
+ 0xa1: ['LOG', 375, 3, 0, false],
+ 0xa2: ['LOG', 375, 4, 0, false],
+ 0xa3: ['LOG', 375, 5, 0, false],
+ 0xa4: ['LOG', 375, 6, 0, false],
+
+ // '0xf0' range - closures
+ 0xf0: ['CREATE', 32000, 3, 1, true, true],
+ 0xf1: ['CALL', 700, 7, 1, true, true],
+ 0xf2: ['CALLCODE', 700, 7, 1, true, true],
+ 0xf3: ['RETURN', 0, 2, 0, false],
+ 0xf4: ['DELEGATECALL', 700, 6, 1, true, true],
+ 0xf5: ['CREATE2', 32000, 4, 1, true, true],
+ 0xfa: ['STATICCALL', 700, 6, 1, true, true],
+ 0xfd: ['REVERT', 0, 2, 0, false],
+
+ // '0x70', range - other
+ 0xfe: ['INVALID', 0, 0, 0, false],
+ 0xff: ['SELFDESTRUCT', 5000, 1, 0, false, true]
+};
+
+module.exports = function (op, full, freeLogs) {
+ var code = codes[op] ? codes[op] : ['INVALID', 0, 0, 0, false, false];
+ var opcode = code[0];
+
+ if (full) {
+ if (opcode === 'LOG') {
+ opcode += op - 0xa0;
+ }
+
+ if (opcode === 'PUSH') {
+ opcode += op - 0x5f;
+ }
+
+ if (opcode === 'DUP') {
+ opcode += op - 0x7f;
+ }
+
+ if (opcode === 'SWAP') {
+ opcode += op - 0x8f;
+ }
+ }
+
+ var fee = code[1];
+
+ if (freeLogs) {
+ if (opcode === 'LOG') {
+ fee = 0;
+ }
+ }
+
+ return { name: opcode, opcode: op, fee: fee, in: code[2], out: code[3], dynamic: code[4], async: code[5] };
+};
+},{}],637:[function(require,module,exports){
+(function (Buffer){
+const Common = require('ethereumjs-common').default
+const utils = require('ethereumjs-util')
+const BN = utils.BN
+ /**
+ * An object that repersents the block header
+ * @constructor
+ * @param {Array} data raw data, deserialized
+ * @param {Array} opts Options
+ * @param {String|Number} opts.chain The chain for the block header [default: 'mainnet']
+ * @param {String} opts.hardfork Hardfork for the block header [default: null, block number-based behaviour]
+ * @param {Object} opts.common Alternatively pass a Common instance instead of setting chain/hardfork directly
+ * @prop {Buffer} parentHash the blocks' parent's hash
+ * @prop {Buffer} uncleHash sha3(rlp_encode(uncle_list))
+ * @prop {Buffer} coinbase the miner address
+ * @prop {Buffer} stateRoot The root of a Merkle Patricia tree
+ * @prop {Buffer} transactionTrie the root of a Trie containing the transactions
+ * @prop {Buffer} receiptTrie the root of a Trie containing the transaction Reciept
+ * @prop {Buffer} bloom
+ * @prop {Buffer} difficulty
+ * @prop {Buffer} number the block's height
+ * @prop {Buffer} gasLimit
+ * @prop {Buffer} gasUsed
+ * @prop {Buffer} timestamp
+ * @prop {Buffer} extraData
+ * @prop {Array.
} raw an array of buffers containing the raw blocks.
+ */
+var BlockHeader = module.exports = function (data, opts) {
+ opts = opts || {}
+
+ if (opts.common) {
+ if (opts.chain) {
+ throw new Error('Instantiation with both opts.common and opts.chain parameter not allowed!')
+ }
+ this._common = opts.common
+ } else {
+ let chain = opts.chain ? opts.chain : 'mainnet'
+ let hardfork = opts.hardfork ? opts.hardfork : null
+ this._common = new Common(chain, hardfork)
+ }
+
+ var fields = [{
+ name: 'parentHash',
+ length: 32,
+ default: utils.zeros(32)
+ }, {
+ name: 'uncleHash',
+ default: utils.SHA3_RLP_ARRAY
+ }, {
+ name: 'coinbase',
+ length: 20,
+ default: utils.zeros(20)
+ }, {
+ name: 'stateRoot',
+ length: 32,
+ default: utils.zeros(32)
+ }, {
+ name: 'transactionsTrie',
+ length: 32,
+ default: utils.SHA3_RLP
+ }, {
+ name: 'receiptTrie',
+ length: 32,
+ default: utils.SHA3_RLP
+ }, {
+ name: 'bloom',
+ default: utils.zeros(256)
+ }, {
+ name: 'difficulty',
+ default: Buffer.from([])
+ }, {
+ name: 'number',
+ // TODO: params.homeSteadForkNumber.v left for legacy reasons, replace on future release
+ default: utils.intToBuffer(1150000)
+ }, {
+ name: 'gasLimit',
+ default: Buffer.from('ffffffffffffff', 'hex')
+ }, {
+ name: 'gasUsed',
+ empty: true,
+ default: Buffer.from([])
+ }, {
+ name: 'timestamp',
+ default: Buffer.from([])
+ }, {
+ name: 'extraData',
+ allowZero: true,
+ empty: true,
+ default: Buffer.from([])
+ }, {
+ name: 'mixHash',
+ default: utils.zeros(32)
+ // length: 32
+ }, {
+ name: 'nonce',
+ default: utils.zeros(8) // sha3(42)
+ }]
+ utils.defineProperties(this, fields, data)
+}
+
+/**
+ * Returns the canoncical difficulty of the block
+ * @method canonicalDifficulty
+ * @param {Block} parentBlock the parent `Block` of the this header
+ * @return {BN}
+ */
+BlockHeader.prototype.canonicalDifficulty = function (parentBlock) {
+ const hardfork = this._common.hardfork() || this._common.activeHardfork(utils.bufferToInt(this.number))
+ const blockTs = new BN(this.timestamp)
+ const parentTs = new BN(parentBlock.header.timestamp)
+ const parentDif = new BN(parentBlock.header.difficulty)
+ const minimumDifficulty = new BN(this._common.param('pow', 'minimumDifficulty', hardfork))
+ var offset = parentDif.div(new BN(this._common.param('pow', 'difficultyBoundDivisor', hardfork)))
+ var num = new BN(this.number)
+ var a
+ var cutoff
+ var dif
+
+ if (this._common.hardforkGteHardfork(hardfork, 'byzantium')) {
+ // max((2 if len(parent.uncles) else 1) - ((timestamp - parent.timestamp) // 9), -99) (EIP100)
+ var uncleAddend = parentBlock.header.uncleHash.equals(utils.SHA3_RLP_ARRAY) ? 1 : 2
+ a = blockTs.sub(parentTs).idivn(9).ineg().iaddn(uncleAddend)
+ cutoff = new BN(-99)
+ // MAX(cutoff, a)
+ if (cutoff.cmp(a) === 1) {
+ a = cutoff
+ }
+ dif = parentDif.add(offset.mul(a))
+ }
+
+ if (this._common.hardforkGteHardfork(hardfork, 'constantinople')) {
+ // Constantinople difficulty bomb delay (EIP1234)
+ num.isubn(5000000)
+ if (num.ltn(0)) {
+ num = new BN(0)
+ }
+ } else if (this._common.hardforkGteHardfork(hardfork, 'byzantium')) {
+ // Byzantium difficulty bomb delay (EIP649)
+ num.isubn(3000000)
+ if (num.ltn(0)) {
+ num = new BN(0)
+ }
+ } else if (this._common.hardforkGteHardfork(hardfork, 'homestead')) {
+ // 1 - (block_timestamp - parent_timestamp) // 10
+ a = blockTs.sub(parentTs).idivn(10).ineg().iaddn(1)
+ cutoff = new BN(-99)
+ // MAX(cutoff, a)
+ if (cutoff.cmp(a) === 1) {
+ a = cutoff
+ }
+ dif = parentDif.add(offset.mul(a))
+ } else {
+ // pre-homestead
+ if (parentTs.addn(this._common.param('pow', 'durationLimit', hardfork)).cmp(blockTs) === 1) {
+ dif = offset.add(parentDif)
+ } else {
+ dif = parentDif.sub(offset)
+ }
+ }
+
+ var exp = num.idivn(100000).isubn(2)
+ if (!exp.isNeg()) {
+ dif.iadd(new BN(2).pow(exp))
+ }
+
+ if (dif.cmp(minimumDifficulty) === -1) {
+ dif = minimumDifficulty
+ }
+
+ return dif
+}
+
+/**
+ * checks that the block's `difficuly` matches the canonical difficulty
+ * @method validateDifficulty
+ * @param {Block} parentBlock this block's parent
+ * @return {Boolean}
+ */
+BlockHeader.prototype.validateDifficulty = function (parentBlock) {
+ const dif = this.canonicalDifficulty(parentBlock)
+ return dif.cmp(new BN(this.difficulty)) === 0
+}
+
+/**
+ * Validates the gasLimit
+ * @method validateGasLimit
+ * @param {Block} parentBlock this block's parent
+ * @returns {Boolean}
+ */
+BlockHeader.prototype.validateGasLimit = function (parentBlock) {
+ const pGasLimit = new BN(parentBlock.header.gasLimit)
+ const gasLimit = new BN(this.gasLimit)
+ const hardfork = this._common.hardfork() ? this._common.hardfork() : this._common.activeHardfork(this.number)
+ const a = pGasLimit.div(new BN(this._common.param('gasConfig', 'gasLimitBoundDivisor', hardfork)))
+ const maxGasLimit = pGasLimit.add(a)
+ const minGasLimit = pGasLimit.sub(a)
+
+ return gasLimit.lt(maxGasLimit) && gasLimit.gt(minGasLimit) && gasLimit.gte(this._common.param('gasConfig', 'minGasLimit', hardfork))
+}
+
+/**
+ * Validates the entire block header
+ * @method validate
+ * @param {Blockchain} blockChain the blockchain that this block is validating against
+ * @param {Bignum} [height] if this is an uncle header, this is the height of the block that is including it
+ * @param {Function} cb the callback function. The callback is given an `error` if the block is invalid
+ */
+BlockHeader.prototype.validate = function (blockchain, height, cb) {
+ var self = this
+ if (arguments.length === 2) {
+ cb = height
+ height = false
+ }
+
+ if (this.isGenesis()) {
+ return cb()
+ }
+
+ // find the blocks parent
+ blockchain.getBlock(self.parentHash, function (err, parentBlock) {
+ if (err) {
+ return cb('could not find parent block')
+ }
+
+ self.parentBlock = parentBlock
+
+ var number = new BN(self.number)
+ if (number.cmp(new BN(parentBlock.header.number).iaddn(1)) !== 0) {
+ return cb('invalid number')
+ }
+
+ if (height) {
+ var dif = height.sub(new BN(parentBlock.header.number))
+ if (!(dif.cmpn(8) === -1 && dif.cmpn(1) === 1)) {
+ return cb('uncle block has a parent that is too old or to young')
+ }
+ }
+
+ if (!self.validateDifficulty(parentBlock)) {
+ return cb('invalid Difficulty')
+ }
+
+ if (!self.validateGasLimit(parentBlock)) {
+ return cb('invalid gas limit')
+ }
+
+ if (utils.bufferToInt(parentBlock.header.number) + 1 !== utils.bufferToInt(self.number)) {
+ return cb('invalid heigth')
+ }
+
+ if (utils.bufferToInt(self.timestamp) <= utils.bufferToInt(parentBlock.header.timestamp)) {
+ return cb('invalid timestamp')
+ }
+
+ const hardfork = self._common.hardfork() ? self._common.hardfork() : self._common.activeHardfork(height)
+ if (self.extraData.length > self._common.param('vm', 'maxExtraDataSize', hardfork)) {
+ return cb('invalid amount of extra data')
+ }
+
+ cb()
+ })
+}
+
+/**
+ * Returns the sha3 hash of the blockheader
+ * @method hash
+ * @return {Buffer}
+ */
+BlockHeader.prototype.hash = function () {
+ return utils.rlphash(this.raw)
+}
+
+/**
+ * checks if the blockheader is a genesis header
+ * @method isGenesis
+ * @return {Boolean}
+ */
+BlockHeader.prototype.isGenesis = function () {
+ return this.number.toString('hex') === ''
+}
+
+/**
+ * turns the header into the canonical genesis block header
+ * @method setGenesisParams
+ */
+BlockHeader.prototype.setGenesisParams = function () {
+ this.timestamp = this._common.genesis().timestamp
+ this.gasLimit = this._common.genesis().gasLimit
+ this.difficulty = this._common.genesis().difficulty
+ this.extraData = this._common.genesis().extraData
+ this.nonce = this._common.genesis().nonce
+ this.stateRoot = this._common.genesis().stateRoot
+ this.number = Buffer.from([])
+}
+
+}).call(this,require("buffer").Buffer)
+},{"buffer":113,"ethereumjs-common":609,"ethereumjs-util":639}],638:[function(require,module,exports){
+(function (Buffer){
+const Common = require('ethereumjs-common').default
+const ethUtil = require('ethereumjs-util')
+const Tx = require('ethereumjs-tx')
+const Trie = require('merkle-patricia-tree')
+const BN = ethUtil.BN
+const rlp = ethUtil.rlp
+const async = require('async')
+const BlockHeader = require('./header')
+
+/**
+ * Creates a new block object
+ * @constructor the raw serialized or the deserialized block.
+ * @param {Array|Buffer|Object} data
+ * @param {Array} opts Options
+ * @param {String|Number} opts.chain The chain for the block [default: 'mainnet']
+ * @param {String} opts.hardfork Hardfork for the block [default: null, block number-based behaviour]
+ * @param {Object} opts.common Alternatively pass a Common instance (ethereumjs-common) instead of setting chain/hardfork directly
+ * @prop {Header} header the block's header
+ * @prop {Array.} uncleList an array of uncle headers
+ * @prop {Array.} raw an array of buffers containing the raw blocks.
+ */
+var Block = module.exports = function (data, opts) {
+ opts = opts || {}
+
+ if (opts.common) {
+ if (opts.chain) {
+ throw new Error('Instantiation with both opts.common and opts.chain parameter not allowed!')
+ }
+ this._common = opts.common
+ } else {
+ let chain = opts.chain ? opts.chain : 'mainnet'
+ let hardfork = opts.hardfork ? opts.hardfork : null
+ this._common = new Common(chain, hardfork)
+ }
+
+ this.transactions = []
+ this.uncleHeaders = []
+ this._inBlockChain = false
+ this.txTrie = new Trie()
+
+ Object.defineProperty(this, 'raw', {
+ get: function () {
+ return this.serialize(false)
+ }
+ })
+
+ var rawTransactions, rawUncleHeaders
+
+ // defaults
+ if (!data) {
+ data = [[], [], []]
+ }
+
+ if (Buffer.isBuffer(data)) {
+ data = rlp.decode(data)
+ }
+
+ if (Array.isArray(data)) {
+ this.header = new BlockHeader(data[0], opts)
+ rawTransactions = data[1]
+ rawUncleHeaders = data[2]
+ } else {
+ this.header = new BlockHeader(data.header, opts)
+ rawTransactions = data.transactions || []
+ rawUncleHeaders = data.uncleHeaders || []
+ }
+
+ // parse uncle headers
+ for (var i = 0; i < rawUncleHeaders.length; i++) {
+ this.uncleHeaders.push(new BlockHeader(rawUncleHeaders[i], opts))
+ }
+
+ // parse transactions
+ for (i = 0; i < rawTransactions.length; i++) {
+ var tx = new Tx(rawTransactions[i])
+ tx._homestead = true
+ this.transactions.push(tx)
+ }
+}
+
+Block.Header = BlockHeader
+
+/**
+ * Produces a hash the RLP of the block
+ * @method hash
+ */
+Block.prototype.hash = function () {
+ return this.header.hash()
+}
+
+/**
+ * Determines if a given block is the genesis block
+ * @method isGenisis
+ * @return Boolean
+ */
+Block.prototype.isGenesis = function () {
+ return this.header.isGenesis()
+}
+
+/**
+ * turns the block into the canonical genesis block
+ * @method setGenesisParams
+ */
+Block.prototype.setGenesisParams = function () {
+ this.header.setGenesisParams()
+}
+
+/**
+ * Produces a serialization of the block.
+ * @method serialize
+ * @param {Boolean} rlpEncode whether to rlp encode the block or not
+ */
+Block.prototype.serialize = function (rlpEncode) {
+ var raw = [this.header.raw, [],
+ []
+ ]
+
+ // rlpEnode defaults to true
+ if (typeof rlpEncode === 'undefined') {
+ rlpEncode = true
+ }
+
+ this.transactions.forEach(function (tx) {
+ raw[1].push(tx.raw)
+ })
+
+ this.uncleHeaders.forEach(function (uncle) {
+ raw[2].push(uncle.raw)
+ })
+
+ return rlpEncode ? rlp.encode(raw) : raw
+}
+
+/**
+ * Generate transaction trie. The tx trie must be generated before the transaction trie can
+ * be validated with `validateTransactionTrie`
+ * @method genTxTrie
+ * @param {Function} cb the callback
+ */
+Block.prototype.genTxTrie = function (cb) {
+ var i = 0
+ var self = this
+
+ async.eachSeries(this.transactions, function (tx, done) {
+ self.txTrie.put(rlp.encode(i), tx.serialize(), done)
+ i++
+ }, cb)
+}
+
+/**
+ * Validates the transaction trie
+ * @method validateTransactionTrie
+ * @return {Boolean}
+ */
+Block.prototype.validateTransactionsTrie = function () {
+ var txT = this.header.transactionsTrie.toString('hex')
+ if (this.transactions.length) {
+ return txT === this.txTrie.root.toString('hex')
+ } else {
+ return txT === ethUtil.SHA3_RLP.toString('hex')
+ }
+}
+
+/**
+ * Validates the transactions
+ * @method validateTransactions
+ * @param {Boolean} [stringError=false] whether to return a string with a dscription of why the validation failed or return a Bloolean
+ * @return {Boolean}
+ */
+Block.prototype.validateTransactions = function (stringError) {
+ var errors = []
+
+ this.transactions.forEach(function (tx, i) {
+ var error = tx.validate(true)
+ if (error) {
+ errors.push(error + ' at tx ' + i)
+ }
+ })
+
+ if (stringError === undefined || stringError === false) {
+ return errors.length === 0
+ } else {
+ return arrayToString(errors)
+ }
+}
+
+/**
+ * Validates the entire block. Returns a string to the callback if block is invalid
+ * @method validate
+ * @param {BlockChain} blockChain the blockchain that this block wants to be part of
+ * @param {Function} cb the callback which is given a `String` if the block is not valid
+ */
+Block.prototype.validate = function (blockChain, cb) {
+ var self = this
+ var errors = []
+
+ async.parallel([
+ // validate uncles
+ self.validateUncles.bind(self, blockChain),
+ // validate block
+ self.header.validate.bind(self.header, blockChain),
+ // generate the transaction trie
+ self.genTxTrie.bind(self)
+ ], function (err) {
+ if (err) {
+ errors.push(err)
+ }
+
+ if (!self.validateTransactionsTrie()) {
+ errors.push('invalid transaction trie')
+ }
+
+ var txErrors = self.validateTransactions(true)
+ if (txErrors !== '') {
+ errors.push(txErrors)
+ }
+
+ if (!self.validateUnclesHash()) {
+ errors.push('invalid uncle hash')
+ }
+
+ cb(arrayToString(errors))
+ })
+}
+
+/**
+ * Validates the uncle's hash
+ * @method validateUncleHash
+ * @return {Boolean}
+ */
+Block.prototype.validateUnclesHash = function () {
+ var raw = []
+ this.uncleHeaders.forEach(function (uncle) {
+ raw.push(uncle.raw)
+ })
+
+ raw = rlp.encode(raw)
+ return ethUtil.sha3(raw).toString('hex') === this.header.uncleHash.toString('hex')
+}
+
+/**
+ * Validates the uncles that are in the block if any. Returns a string to the callback if uncles are invalid
+ * @method validateUncles
+ * @param {Blockchain} blockChaina an instance of the Blockchain
+ * @param {Function} cb the callback
+ */
+Block.prototype.validateUncles = function (blockChain, cb) {
+ if (this.isGenesis()) {
+ return cb()
+ }
+
+ var self = this
+
+ if (self.uncleHeaders.length > 2) {
+ return cb('too many uncle headers')
+ }
+
+ var uncleHashes = self.uncleHeaders.map(function (header) {
+ return header.hash().toString('hex')
+ })
+
+ if (!((new Set(uncleHashes)).size === uncleHashes.length)) {
+ return cb('duplicate uncles')
+ }
+
+ async.each(self.uncleHeaders, function (uncle, cb2) {
+ var height = new BN(self.header.number)
+ async.parallel([
+ uncle.validate.bind(uncle, blockChain, height),
+ // check to make sure the uncle is not already in the blockchain
+ function (cb3) {
+ blockChain.getDetails(uncle.hash(), function (err, blockInfo) {
+ // TODO: remove uncles from BC
+ if (blockInfo && blockInfo.isUncle) {
+ cb3(err || 'uncle already included')
+ } else {
+ cb3()
+ }
+ })
+ }
+ ], cb2)
+ }, cb)
+}
+
+/**
+ * Converts the block toJSON
+ * @method toJSON
+ * @param {Bool} labeled whether to create an labeled object or an array
+ * @return {Object}
+ */
+Block.prototype.toJSON = function (labeled) {
+ if (labeled) {
+ var obj = {
+ header: this.header.toJSON(true),
+ transactions: [],
+ uncleHeaders: []
+ }
+
+ this.transactions.forEach(function (tx) {
+ obj.transactions.push(tx.toJSON(labeled))
+ })
+
+ this.uncleHeaders.forEach(function (uh) {
+ obj.uncleHeaders.push(uh.toJSON())
+ })
+ return obj
+ } else {
+ return ethUtil.baToJSON(this.raw)
+ }
+}
+
+function arrayToString (array) {
+ try {
+ return array.reduce(function (str, err) {
+ if (str) {
+ str += ' '
+ }
+ return str + err
+ })
+ } catch (e) {
+ return ''
+ }
+}
+
+}).call(this,{"isBuffer":require("../../../is-buffer/index.js")})
+},{"../../../is-buffer/index.js":839,"./header":637,"async":42,"ethereumjs-common":609,"ethereumjs-tx":610,"ethereumjs-util":639,"merkle-patricia-tree":947}],639:[function(require,module,exports){
+arguments[4][612][0].apply(exports,arguments)
+},{"assert":35,"bn.js":66,"create-hash":466,"dup":612,"ethjs-util":707,"keccak":868,"rlp":1331,"safe-buffer":1334,"secp256k1":1339}],640:[function(require,module,exports){
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var BN = require("bn.js");
+exports.BN = BN;
+var rlp = require("rlp");
+exports.rlp = rlp;
+var createKeccakHash = require('keccak');
+var secp256k1 = require('secp256k1');
+exports.secp256k1 = secp256k1;
+var assert = require('assert');
+var createHash = require('create-hash');
+var Buffer = require('safe-buffer').Buffer;
+var ethjsUtil = require('ethjs-util');
+Object.assign(exports, ethjsUtil);
+/**
+ * The max integer that this VM can handle
+ */
+exports.MAX_INTEGER = new BN('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
+/**
+ * 2^256
+ */
+exports.TWO_POW256 = new BN('10000000000000000000000000000000000000000000000000000000000000000', 16);
+/**
+ * Keccak-256 hash of null
+ */
+exports.KECCAK256_NULL_S = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470';
+/**
+ * Keccak-256 hash of null
+ */
+exports.KECCAK256_NULL = Buffer.from(exports.KECCAK256_NULL_S, 'hex');
+/**
+ * Keccak-256 of an RLP of an empty array
+ */
+exports.KECCAK256_RLP_ARRAY_S = '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347';
+/**
+ * Keccak-256 of an RLP of an empty array
+ */
+exports.KECCAK256_RLP_ARRAY = Buffer.from(exports.KECCAK256_RLP_ARRAY_S, 'hex');
+/**
+ * Keccak-256 hash of the RLP of null
+ */
+exports.KECCAK256_RLP_S = '56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421';
+/**
+ * Keccak-256 hash of the RLP of null
+ */
+exports.KECCAK256_RLP = Buffer.from(exports.KECCAK256_RLP_S, 'hex');
+/**
+ * Returns a buffer filled with 0s.
+ * @param bytes the number of bytes the buffer should be
+ */
+exports.zeros = function (bytes) {
+ return Buffer.allocUnsafe(bytes).fill(0);
+};
+/**
+ * Returns a zero address.
+ */
+exports.zeroAddress = function () {
+ var addressLength = 20;
+ var addr = exports.zeros(addressLength);
+ return exports.bufferToHex(addr);
+};
+/**
+ * Left Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
+ * Or it truncates the beginning if it exceeds.
+ * @param msg the value to pad (Buffer|Array)
+ * @param length the number of bytes the output should be
+ * @param right whether to start padding form the left or right
+ * @return (Buffer|Array)
+ */
+exports.setLengthLeft = function (msg, length, right) {
+ if (right === void 0) { right = false; }
+ var buf = exports.zeros(length);
+ msg = exports.toBuffer(msg);
+ if (right) {
+ if (msg.length < length) {
+ msg.copy(buf);
+ return buf;
+ }
+ return msg.slice(0, length);
+ }
+ else {
+ if (msg.length < length) {
+ msg.copy(buf, length - msg.length);
+ return buf;
+ }
+ return msg.slice(-length);
+ }
+};
+exports.setLength = exports.setLengthLeft;
+/**
+ * Right Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
+ * Or it truncates the beginning if it exceeds.
+ * @param msg the value to pad (Buffer|Array)
+ * @param length the number of bytes the output should be
+ * @return (Buffer|Array)
+ */
+exports.setLengthRight = function (msg, length) {
+ return exports.setLength(msg, length, true);
+};
+/**
+ * Trims leading zeros from a `Buffer` or an `Array`.
+ * @param a (Buffer|Array|String)
+ * @return (Buffer|Array|String)
+ */
+exports.unpad = function (a) {
+ a = ethjsUtil.stripHexPrefix(a);
+ var first = a[0];
+ while (a.length > 0 && first.toString() === '0') {
+ a = a.slice(1);
+ first = a[0];
+ }
+ return a;
+};
+exports.stripZeros = exports.unpad;
+/**
+ * Attempts to turn a value into a `Buffer`. As input it supports `Buffer`, `String`, `Number`, null/undefined, `BN` and other objects with a `toArray()` method.
+ * @param v the value
+ */
+exports.toBuffer = function (v) {
+ if (!Buffer.isBuffer(v)) {
+ if (Array.isArray(v)) {
+ v = Buffer.from(v);
+ }
+ else if (typeof v === 'string') {
+ if (exports.isHexString(v)) {
+ v = Buffer.from(exports.padToEven(exports.stripHexPrefix(v)), 'hex');
+ }
+ else {
+ v = Buffer.from(v);
+ }
+ }
+ else if (typeof v === 'number') {
+ v = exports.intToBuffer(v);
+ }
+ else if (v === null || v === undefined) {
+ v = Buffer.allocUnsafe(0);
+ }
+ else if (BN.isBN(v)) {
+ v = v.toArrayLike(Buffer);
+ }
+ else if (v.toArray) {
+ // converts a BN to a Buffer
+ v = Buffer.from(v.toArray());
+ }
+ else {
+ throw new Error('invalid type');
+ }
+ }
+ return v;
+};
+/**
+ * Converts a `Buffer` to a `Number`.
+ * @param buf `Buffer` object to convert
+ * @throws If the input number exceeds 53 bits.
+ */
+exports.bufferToInt = function (buf) {
+ return new BN(exports.toBuffer(buf)).toNumber();
+};
+/**
+ * Converts a `Buffer` into a hex `String`.
+ * @param buf `Buffer` object to convert
+ */
+exports.bufferToHex = function (buf) {
+ buf = exports.toBuffer(buf);
+ return '0x' + buf.toString('hex');
+};
+/**
+ * Interprets a `Buffer` as a signed integer and returns a `BN`. Assumes 256-bit numbers.
+ * @param num Signed integer value
+ */
+exports.fromSigned = function (num) {
+ return new BN(num).fromTwos(256);
+};
+/**
+ * Converts a `BN` to an unsigned integer and returns it as a `Buffer`. Assumes 256-bit numbers.
+ * @param num
+ */
+exports.toUnsigned = function (num) {
+ return Buffer.from(num.toTwos(256).toArray());
+};
+/**
+ * Creates Keccak hash of the input
+ * @param a The input data (Buffer|Array|String|Number)
+ * @param bits The Keccak width
+ */
+exports.keccak = function (a, bits) {
+ if (bits === void 0) { bits = 256; }
+ a = exports.toBuffer(a);
+ if (!bits)
+ bits = 256;
+ return createKeccakHash("keccak" + bits)
+ .update(a)
+ .digest();
+};
+/**
+ * Creates Keccak-256 hash of the input, alias for keccak(a, 256).
+ * @param a The input data (Buffer|Array|String|Number)
+ */
+exports.keccak256 = function (a) {
+ return exports.keccak(a);
+};
+/**
+ * Creates SHA256 hash of the input.
+ * @param a The input data (Buffer|Array|String|Number)
+ */
+exports.sha256 = function (a) {
+ a = exports.toBuffer(a);
+ return createHash('sha256')
+ .update(a)
+ .digest();
+};
+/**
+ * Creates RIPEMD160 hash of the input.
+ * @param a The input data (Buffer|Array|String|Number)
+ * @param padded Whether it should be padded to 256 bits or not
+ */
+exports.ripemd160 = function (a, padded) {
+ a = exports.toBuffer(a);
+ var hash = createHash('rmd160')
+ .update(a)
+ .digest();
+ if (padded === true) {
+ return exports.setLength(hash, 32);
+ }
+ else {
+ return hash;
+ }
+};
+/**
+ * Creates SHA-3 hash of the RLP encoded version of the input.
+ * @param a The input data
+ */
+exports.rlphash = function (a) {
+ return exports.keccak(rlp.encode(a));
+};
+/**
+ * Checks if the private key satisfies the rules of the curve secp256k1.
+ */
+exports.isValidPrivate = function (privateKey) {
+ return secp256k1.privateKeyVerify(privateKey);
+};
+/**
+ * Checks if the public key satisfies the rules of the curve secp256k1
+ * and the requirements of Ethereum.
+ * @param publicKey The two points of an uncompressed key, unless sanitize is enabled
+ * @param sanitize Accept public keys in other formats
+ */
+exports.isValidPublic = function (publicKey, sanitize) {
+ if (sanitize === void 0) { sanitize = false; }
+ if (publicKey.length === 64) {
+ // Convert to SEC1 for secp256k1
+ return secp256k1.publicKeyVerify(Buffer.concat([Buffer.from([4]), publicKey]));
+ }
+ if (!sanitize) {
+ return false;
+ }
+ return secp256k1.publicKeyVerify(publicKey);
+};
+/**
+ * Returns the ethereum address of a given public key.
+ * Accepts "Ethereum public keys" and SEC1 encoded keys.
+ * @param pubKey The two points of an uncompressed key, unless sanitize is enabled
+ * @param sanitize Accept public keys in other formats
+ */
+exports.pubToAddress = function (pubKey, sanitize) {
+ if (sanitize === void 0) { sanitize = false; }
+ pubKey = exports.toBuffer(pubKey);
+ if (sanitize && pubKey.length !== 64) {
+ pubKey = secp256k1.publicKeyConvert(pubKey, false).slice(1);
+ }
+ assert(pubKey.length === 64);
+ // Only take the lower 160bits of the hash
+ return exports.keccak(pubKey).slice(-20);
+};
+exports.publicToAddress = exports.pubToAddress;
+/**
+ * Returns the ethereum public key of a given private key.
+ * @param privateKey A private key must be 256 bits wide
+ */
+exports.privateToPublic = function (privateKey) {
+ privateKey = exports.toBuffer(privateKey);
+ // skip the type flag and use the X, Y points
+ return secp256k1.publicKeyCreate(privateKey, false).slice(1);
+};
+/**
+ * Converts a public key to the Ethereum format.
+ */
+exports.importPublic = function (publicKey) {
+ publicKey = exports.toBuffer(publicKey);
+ if (publicKey.length !== 64) {
+ publicKey = secp256k1.publicKeyConvert(publicKey, false).slice(1);
+ }
+ return publicKey;
+};
+/**
+ * Returns the ECDSA signature of a message hash.
+ */
+exports.ecsign = function (msgHash, privateKey, chainId) {
+ var sig = secp256k1.sign(msgHash, privateKey);
+ var recovery = sig.recovery;
+ var ret = {
+ r: sig.signature.slice(0, 32),
+ s: sig.signature.slice(32, 64),
+ v: chainId ? recovery + (chainId * 2 + 35) : recovery + 27,
+ };
+ return ret;
+};
+/**
+ * Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call.
+ * The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign`
+ * call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key
+ * used to produce the signature.
+ */
+exports.hashPersonalMessage = function (message) {
+ var prefix = exports.toBuffer("\u0019Ethereum Signed Message:\n" + message.length.toString());
+ return exports.keccak(Buffer.concat([prefix, message]));
+};
+/**
+ * ECDSA public key recovery from signature.
+ * @returns Recovered public key
+ */
+exports.ecrecover = function (msgHash, v, r, s, chainId) {
+ var signature = Buffer.concat([exports.setLength(r, 32), exports.setLength(s, 32)], 64);
+ var recovery = calculateSigRecovery(v, chainId);
+ if (!isValidSigRecovery(recovery)) {
+ throw new Error('Invalid signature v value');
+ }
+ var senderPubKey = secp256k1.recover(msgHash, signature, recovery);
+ return secp256k1.publicKeyConvert(senderPubKey, false).slice(1);
+};
+/**
+ * Convert signature parameters into the format of `eth_sign` RPC method.
+ * @returns Signature
+ */
+exports.toRpcSig = function (v, r, s, chainId) {
+ var recovery = calculateSigRecovery(v, chainId);
+ if (!isValidSigRecovery(recovery)) {
+ throw new Error('Invalid signature v value');
+ }
+ // geth (and the RPC eth_sign method) uses the 65 byte format used by Bitcoin
+ return exports.bufferToHex(Buffer.concat([exports.setLengthLeft(r, 32), exports.setLengthLeft(s, 32), exports.toBuffer(v)]));
+};
+/**
+ * Convert signature format of the `eth_sign` RPC method to signature parameters
+ * NOTE: all because of a bug in geth: https://github.com/ethereum/go-ethereum/issues/2053
+ */
+exports.fromRpcSig = function (sig) {
+ var buf = exports.toBuffer(sig);
+ // NOTE: with potential introduction of chainId this might need to be updated
+ if (buf.length !== 65) {
+ throw new Error('Invalid signature length');
+ }
+ var v = buf[64];
+ // support both versions of `eth_sign` responses
+ if (v < 27) {
+ v += 27;
+ }
+ return {
+ v: v,
+ r: buf.slice(0, 32),
+ s: buf.slice(32, 64),
+ };
+};
+/**
+ * Returns the ethereum address of a given private key.
+ * @param privateKey A private key must be 256 bits wide
+ */
+exports.privateToAddress = function (privateKey) {
+ return exports.publicToAddress(exports.privateToPublic(privateKey));
+};
+/**
+ * Checks if the address is a valid. Accepts checksummed addresses too.
+ */
+exports.isValidAddress = function (address) {
+ return /^0x[0-9a-fA-F]{40}$/.test(address);
+};
+/**
+ * Checks if a given address is a zero address.
+ */
+exports.isZeroAddress = function (address) {
+ var zeroAddr = exports.zeroAddress();
+ return zeroAddr === exports.addHexPrefix(address);
+};
+/**
+ * Returns a checksummed address.
+ */
+exports.toChecksumAddress = function (address) {
+ address = ethjsUtil.stripHexPrefix(address).toLowerCase();
+ var hash = exports.keccak(address).toString('hex');
+ var ret = '0x';
+ for (var i = 0; i < address.length; i++) {
+ if (parseInt(hash[i], 16) >= 8) {
+ ret += address[i].toUpperCase();
+ }
+ else {
+ ret += address[i];
+ }
+ }
+ return ret;
+};
+/**
+ * Checks if the address is a valid checksummed address.
+ */
+exports.isValidChecksumAddress = function (address) {
+ return exports.isValidAddress(address) && exports.toChecksumAddress(address) === address;
+};
+/**
+ * Generates an address of a newly created contract.
+ * @param from The address which is creating this new address
+ * @param nonce The nonce of the from account
+ */
+exports.generateAddress = function (from, nonce) {
+ from = exports.toBuffer(from);
+ var nonceBN = new BN(nonce);
+ if (nonceBN.isZero()) {
+ // in RLP we want to encode null in the case of zero nonce
+ // read the RLP documentation for an answer if you dare
+ return exports.rlphash([from, null]).slice(-20);
+ }
+ // Only take the lower 160bits of the hash
+ return exports.rlphash([from, Buffer.from(nonceBN.toArray())]).slice(-20);
+};
+/**
+ * Generates an address for a contract created using CREATE2.
+ * @param from The address which is creating this new address
+ * @param salt A salt
+ * @param initCode The init code of the contract being created
+ */
+exports.generateAddress2 = function (from, salt, initCode) {
+ var fromBuf = exports.toBuffer(from);
+ var saltBuf = exports.toBuffer(salt);
+ var initCodeBuf = exports.toBuffer(initCode);
+ assert(fromBuf.length === 20);
+ assert(saltBuf.length === 32);
+ var address = exports.keccak256(Buffer.concat([Buffer.from('ff', 'hex'), fromBuf, saltBuf, exports.keccak256(initCodeBuf)]));
+ return address.slice(-20);
+};
+/**
+ * Returns true if the supplied address belongs to a precompiled account (Byzantium).
+ */
+exports.isPrecompiled = function (address) {
+ var a = exports.unpad(address);
+ return a.length === 1 && a[0] >= 1 && a[0] <= 8;
+};
+/**
+ * Adds "0x" to a given `String` if it does not already start with "0x".
+ */
+exports.addHexPrefix = function (str) {
+ if (typeof str !== 'string') {
+ return str;
+ }
+ return ethjsUtil.isHexPrefixed(str) ? str : '0x' + str;
+};
+/**
+ * Validate a ECDSA signature.
+ * @param homesteadOrLater Indicates whether this is being used on either the homestead hardfork or a later one
+ */
+exports.isValidSignature = function (v, r, s, homesteadOrLater, chainId) {
+ if (homesteadOrLater === void 0) { homesteadOrLater = true; }
+ var SECP256K1_N_DIV_2 = new BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16);
+ var SECP256K1_N = new BN('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', 16);
+ if (r.length !== 32 || s.length !== 32) {
+ return false;
+ }
+ if (!isValidSigRecovery(calculateSigRecovery(v, chainId))) {
+ return false;
+ }
+ var rBN = new BN(r);
+ var sBN = new BN(s);
+ if (rBN.isZero() || rBN.gt(SECP256K1_N) || sBN.isZero() || sBN.gt(SECP256K1_N)) {
+ return false;
+ }
+ if (homesteadOrLater && sBN.cmp(SECP256K1_N_DIV_2) === 1) {
+ return false;
+ }
+ return true;
+};
+/**
+ * Converts a `Buffer` or `Array` to JSON.
+ * @param ba (Buffer|Array)
+ * @return (Array|String|null)
+ */
+exports.baToJSON = function (ba) {
+ if (Buffer.isBuffer(ba)) {
+ return "0x" + ba.toString('hex');
+ }
+ else if (ba instanceof Array) {
+ var array = [];
+ for (var i = 0; i < ba.length; i++) {
+ array.push(exports.baToJSON(ba[i]));
+ }
+ return array;
+ }
+};
+/**
+ * Defines properties on a `Object`. It make the assumption that underlying data is binary.
+ * @param self the `Object` to define properties on
+ * @param fields an array fields to define. Fields can contain:
+ * * `name` - the name of the properties
+ * * `length` - the number of bytes the field can have
+ * * `allowLess` - if the field can be less than the length
+ * * `allowEmpty`
+ * @param data data to be validated against the definitions
+ */
+exports.defineProperties = function (self, fields, data) {
+ self.raw = [];
+ self._fields = [];
+ // attach the `toJSON`
+ self.toJSON = function (label) {
+ if (label === void 0) { label = false; }
+ if (label) {
+ var obj_1 = {};
+ self._fields.forEach(function (field) {
+ obj_1[field] = "0x" + self[field].toString('hex');
+ });
+ return obj_1;
+ }
+ return exports.baToJSON(self.raw);
+ };
+ self.serialize = function serialize() {
+ return rlp.encode(self.raw);
+ };
+ fields.forEach(function (field, i) {
+ self._fields.push(field.name);
+ function getter() {
+ return self.raw[i];
+ }
+ function setter(v) {
+ v = exports.toBuffer(v);
+ if (v.toString('hex') === '00' && !field.allowZero) {
+ v = Buffer.allocUnsafe(0);
+ }
+ if (field.allowLess && field.length) {
+ v = exports.stripZeros(v);
+ assert(field.length >= v.length, "The field " + field.name + " must not have more " + field.length + " bytes");
+ }
+ else if (!(field.allowZero && v.length === 0) && field.length) {
+ assert(field.length === v.length, "The field " + field.name + " must have byte length of " + field.length);
+ }
+ self.raw[i] = v;
+ }
+ Object.defineProperty(self, field.name, {
+ enumerable: true,
+ configurable: true,
+ get: getter,
+ set: setter,
+ });
+ if (field.default) {
+ self[field.name] = field.default;
+ }
+ // attach alias
+ if (field.alias) {
+ Object.defineProperty(self, field.alias, {
+ enumerable: false,
+ configurable: true,
+ set: setter,
+ get: getter,
+ });
+ }
+ });
+ // if the constuctor is passed data
+ if (data) {
+ if (typeof data === 'string') {
+ data = Buffer.from(ethjsUtil.stripHexPrefix(data), 'hex');
+ }
+ if (Buffer.isBuffer(data)) {
+ data = rlp.decode(data);
+ }
+ if (Array.isArray(data)) {
+ if (data.length > self._fields.length) {
+ throw new Error('wrong number of fields in data');
+ }
+ // make sure all the items are buffers
+ data.forEach(function (d, i) {
+ self[self._fields[i]] = exports.toBuffer(d);
+ });
+ }
+ else if (typeof data === 'object') {
+ var keys_1 = Object.keys(data);
+ fields.forEach(function (field) {
+ if (keys_1.indexOf(field.name) !== -1)
+ self[field.name] = data[field.name];
+ if (keys_1.indexOf(field.alias) !== -1)
+ self[field.alias] = data[field.alias];
+ });
+ }
+ else {
+ throw new Error('invalid data');
+ }
+ }
+};
+function calculateSigRecovery(v, chainId) {
+ return chainId ? v - (2 * chainId + 35) : v - 27;
+}
+function isValidSigRecovery(recovery) {
+ return recovery === 0 || recovery === 1;
+}
+
+},{"assert":35,"bn.js":66,"create-hash":466,"ethjs-util":707,"keccak":868,"rlp":1331,"safe-buffer":1334,"secp256k1":1339}],641:[function(require,module,exports){
+'use strict';
+
+var Interface = require('./interface.js');
+
+var utils = (function() {
+ var convert = require('../utils/convert.js');
+ return {
+ defineProperty: require('../utils/properties.js').defineProperty,
+
+ getAddress: require('../utils/address.js').getAddress,
+
+ bigNumberify: require('../utils/bignumber.js').bigNumberify,
+
+ arrayify: convert.arrayify,
+ hexlify: convert.hexlify,
+ };
+})();
+
+var errors = require('../utils/errors');
+
+var allowedTransactionKeys = {
+ data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true
+}
+
+function copyObject(object) {
+ var result = {};
+ for (var key in object) {
+ result[key] = object[key];
+ }
+ return result;
+}
+
+
+function Contract(addressOrName, contractInterface, signerOrProvider) {
+ if (!(this instanceof Contract)) { throw new Error('missing new'); }
+
+ // @TODO: Maybe still check the addressOrName looks like a valid address or name?
+ //address = utils.getAddress(address);
+
+ if (!(contractInterface instanceof Interface)) {
+ contractInterface = new Interface(contractInterface);
+ }
+
+ if (!signerOrProvider) { throw new Error('missing signer or provider'); }
+
+ var signer = signerOrProvider;
+ var provider = null;
+
+ if (signerOrProvider.provider) {
+ provider = signerOrProvider.provider;
+ } else {
+ provider = signerOrProvider;
+ signer = null;
+ }
+
+ utils.defineProperty(this, 'address', addressOrName);
+ utils.defineProperty(this, 'interface', contractInterface);
+ utils.defineProperty(this, 'signer', signer);
+ utils.defineProperty(this, 'provider', provider);
+
+ var addressPromise = provider.resolveName(addressOrName);
+
+ function runMethod(method, estimateOnly) {
+ return function() {
+ var transaction = {}
+
+ var params = Array.prototype.slice.call(arguments);
+
+ // If 1 extra parameter was passed in, it contains overrides
+ if (params.length === method.inputs.types.length + 1 && typeof(params[params.length - 1]) === 'object') {
+ transaction = copyObject(params.pop());
+
+ // Check for unexpected keys (e.g. using "gas" instead of "gasLimit")
+ for (var key in transaction) {
+ if (!allowedTransactionKeys[key]) {
+ throw new Error('unknown transaction override ' + key);
+ }
+ }
+ }
+
+ // Check overrides make sense
+ ['data', 'to'].forEach(function(key) {
+ if (transaction[key] != null) {
+ throw new Error('cannot override ' + key) ;
+ }
+ });
+
+ var call = method.apply(contractInterface, params);
+
+ // Send to the contract address
+ transaction.to = addressOrName;
+
+ // Set the transaction data
+ transaction.data = call.data;
+
+ switch (call.type) {
+ case 'call':
+
+ // Call (constant functions) always cost 0 ether
+ if (estimateOnly) {
+ return Promise.resolve(new utils.bigNumberify(0));
+ }
+
+ // Check overrides make sense
+ ['gasLimit', 'gasPrice', 'value'].forEach(function(key) {
+ if (transaction[key] != null) {
+ throw new Error('call cannot override ' + key) ;
+ }
+ });
+
+ var fromPromise = null;
+ if (transaction.from == null && signer && signer.getAddress) {
+ fromPromise = signer.getAddress();
+ if (!(fromPromise instanceof Promise)) {
+ fromPromise = Promise.resolve(fromPromise);
+ }
+ } else {
+ fromPromise = Promise.resolve(null);
+ }
+
+ return fromPromise.then(function(address) {
+ if (address) {
+ transaction.from = utils.getAddress(address);
+ }
+ return provider.call(transaction);
+
+ }).then(function(value) {
+ try {
+ if ((utils.arrayify(value).length % 32) !== 0) {
+ throw new Error('call exception');
+ }
+ var result = call.parse(value);
+ } catch (error) {
+ if ((value === '0x' && method.outputs.types.length > 0) || error.message === 'call exception') {
+ errors.throwError('call exception', errors.CALL_EXCEPTION, {
+ address: addressOrName,
+ method: call.signature,
+ value: params
+ });
+ }
+ throw error;
+ }
+ if (method.outputs.types.length === 1) {
+ result = result[0];
+ }
+ return result;
+ });
+
+ case 'transaction':
+ if (!signer) { return Promise.reject(new Error('missing signer')); }
+
+ // Make sure they aren't overriding something they shouldn't
+ if (transaction.from != null) {
+ throw new Error('transaction cannot override from') ;
+ }
+
+ // Only computing the transaction estimate
+ if (estimateOnly) {
+ if (signer && signer.estimateGas) {
+ return signer.estimateGas(transaction);
+ }
+
+ return provider.estimateGas(transaction)
+ }
+
+ // If the signer supports sendTrasaction, use it
+ if (signer.sendTransaction) {
+ return signer.sendTransaction(transaction);
+ }
+
+ if (!signer.sign) {
+ return Promise.reject(new Error('custom signer does not support signing'));
+ }
+
+ if (transaction.gasLimit == null) {
+ transaction.gasLimit = signer.defaultGasLimit || 2000000;
+ }
+
+ var noncePromise = null;
+ if (transaction.nonce != null) {
+ noncePromise = Promise.resolve(transaction.nonce)
+ } else if (signer.getTransactionCount) {
+ noncePromise = signer.getTransactionCount();
+ if (!(noncePromise instanceof Promise)) {
+ noncePromise = Promise.resolve(noncePromise);
+ }
+ } else {
+ var addressPromise = signer.getAddress();
+ if (!(addressPromise instanceof Promise)) {
+ addressPromise = Promise.resolve(addressPromise);
+ }
+ noncePromise = addressPromise.then(function(address) {
+ return provider.getTransactionCount(address, 'pending');
+ });
+ }
+
+ var gasPricePromise = null;
+ if (transaction.gasPrice) {
+ gasPricePromise = Promise.resolve(transaction.gasPrice);
+ } else {
+ gasPricePromise = provider.getGasPrice();
+ }
+
+ return Promise.all([
+ noncePromise,
+ gasPricePromise
+
+ ]).then(function(results) {
+ transaction.nonce = results[0];
+ transaction.gasPrice = results[1];
+ return signer.sign(transaction);
+
+ }).then(function(signedTransaction) {
+ return provider.sendTransaction(signedTransaction);
+ });
+ }
+ };
+ }
+
+ var estimate = {};
+ utils.defineProperty(this, 'estimate', estimate);
+
+ var functions = {};
+ utils.defineProperty(this, 'functions', functions);
+
+ var events = {};
+ utils.defineProperty(this, 'events', events);
+
+ Object.keys(contractInterface.functions).forEach(function(methodName) {
+ var method = contractInterface.functions[methodName];
+
+ var run = runMethod(method, false);
+
+ if (this[methodName] == null) {
+ utils.defineProperty(this, methodName, run);
+ } else {
+ console.log('WARNING: Multiple definitions for ' + method);
+ }
+
+ if (functions[method] == null) {
+ utils.defineProperty(functions, methodName, run);
+ utils.defineProperty(estimate, methodName, runMethod(method, true));
+ }
+ }, this);
+
+ Object.keys(contractInterface.events).forEach(function(eventName) {
+ var eventInfo = contractInterface.events[eventName];
+
+ var eventCallback = null;
+
+ function handleEvent(log) {
+ addressPromise.then(function(address) {
+
+ // Not meant for us (the topics just has the same name)
+ if (address != log.address) { return; }
+
+ try {
+ var result = eventInfo.parse(log.topics, log.data);
+
+ // Some useful things to have with the log
+ log.args = result;
+ log.event = eventName;
+ log.parse = eventInfo.parse;
+ log.removeListener = function() {
+ provider.removeListener(eventInfo.topics, handleEvent);
+ }
+
+ log.getBlock = function() { return provider.getBlock(log.blockHash);; }
+ log.getTransaction = function() { return provider.getTransaction(log.transactionHash); }
+ log.getTransactionReceipt = function() { return provider.getTransactionReceipt(log.transactionHash); }
+ log.eventSignature = eventInfo.signature;
+
+ eventCallback.apply(log, Array.prototype.slice.call(result));
+ } catch (error) {
+ console.log(error);
+ }
+
+ return null;
+ }).catch(function(error) {
+ //console.log(error);
+ });
+ }
+
+ var property = {
+ enumerable: true,
+ get: function() {
+ return eventCallback;
+ },
+ set: function(value) {
+ if (!value) { value = null; }
+
+ if (!value && eventCallback) {
+ provider.removeListener(eventInfo.topics, handleEvent);
+
+ } else if (value && !eventCallback) {
+ provider.on(eventInfo.topics, handleEvent);
+ }
+
+ eventCallback = value;
+ }
+ };
+
+ var propertyName = 'on' + eventName.toLowerCase();
+ if (this[propertyName] == null) {
+ Object.defineProperty(this, propertyName, property);
+ }
+
+ Object.defineProperty(events, eventName, property);
+
+ }, this);
+}
+
+utils.defineProperty(Contract.prototype, 'connect', function(signerOrProvider) {
+ return new Contract(this.address, this.interface, signerOrProvider);
+});
+
+utils.defineProperty(Contract, 'getDeployTransaction', function(bytecode, contractInterface) {
+
+ if (!(contractInterface instanceof Interface)) {
+ contractInterface = new Interface(contractInterface);
+ }
+
+ var args = Array.prototype.slice.call(arguments);
+ args.splice(1, 1);
+
+ return {
+ data: contractInterface.deployFunction.apply(contractInterface, args).bytecode
+ }
+});
+
+module.exports = Contract;
+
+},{"../utils/address.js":678,"../utils/bignumber.js":679,"../utils/convert.js":683,"../utils/errors":685,"../utils/properties.js":692,"./interface.js":643}],642:[function(require,module,exports){
+'use strict';
+
+var Contract = require('./contract.js');
+var Interface = require('./interface.js');
+
+module.exports = {
+ Contract: Contract,
+ Interface: Interface,
+}
+
+
+},{"./contract.js":641,"./interface.js":643}],643:[function(require,module,exports){
+'use strict';
+
+// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
+
+var utils = (function() {
+ var AbiCoder = require('../utils/abi-coder');
+ var convert = require('../utils/convert');
+ var properties = require('../utils/properties');
+ var utf8 = require('../utils/utf8');
+
+ return {
+ defineFrozen: properties.defineFrozen,
+ defineProperty: properties.defineProperty,
+
+ coder: AbiCoder.defaultCoder,
+ parseSignature: AbiCoder.parseSignature,
+
+ arrayify: convert.arrayify,
+ concat: convert.concat,
+ isHexString: convert.isHexString,
+
+ toUtf8Bytes: utf8.toUtf8Bytes,
+
+ keccak256: require('../utils/keccak256'),
+ };
+})();
+
+var errors = require('../utils/errors');
+
+function parseParams(params) {
+ var names = [];
+ var types = [];
+
+ params.forEach(function(param) {
+ if (param.components != null) {
+ if (param.type.substring(0, 5) !== 'tuple') {
+ throw new Error('internal error; report on GitHub');
+ }
+ var suffix = '';
+ var arrayBracket = param.type.indexOf('[');
+ if (arrayBracket >= 0) { suffix = param.type.substring(arrayBracket); }
+
+ var result = parseParams(param.components);
+ names.push({ name: (param.name || null), names: result.names });
+ types.push('tuple(' + result.types.join(',') + ')' + suffix)
+ } else {
+ names.push(param.name || null);
+ types.push(param.type);
+ }
+ });
+
+ return {
+ names: names,
+ types: types
+ }
+}
+
+function populateDescription(object, items) {
+ for (var key in items) {
+ utils.defineProperty(object, key, items[key]);
+ }
+ return object;
+}
+
+/**
+ * - bytecode (optional; only for deploy)
+ * - type ("deploy")
+ */
+function DeployDescription() { }
+
+/**
+ * - name
+ * - signature
+ * - sighash
+ * -
+ * -
+ * -
+ * -
+ * - type: ("call" | "transaction")
+ */
+function FunctionDescription() { }
+
+/**
+ * - anonymous
+ * - name
+ * - signature
+ * - parse
+ * - topics
+ * - inputs
+ * - type ("event")
+ */
+function EventDescription() { }
+
+function Indexed(value) {
+ utils.defineProperty(this, 'indexed', true);
+ utils.defineProperty(this, 'hash', value);
+}
+
+function Result() {}
+
+function Interface(abi) {
+ if (!(this instanceof Interface)) { throw new Error('missing new'); }
+
+ 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
+ });
+ }
+ }
+
+ var _abi = [];
+ abi.forEach(function(fragment) {
+ if (typeof(fragment) === 'string') {
+ fragment = utils.parseSignature(fragment);
+ }
+ _abi.push(fragment);
+ });
+
+ utils.defineFrozen(this, 'abi', _abi);
+
+ var methods = {}, events = {}, deploy = null;
+
+ utils.defineProperty(this, 'functions', methods);
+ utils.defineProperty(this, 'events', events);
+
+ function addMethod(method) {
+ switch (method.type) {
+ case 'constructor':
+ var func = (function() {
+ var inputParams = parseParams(method.inputs);
+
+ var func = function(bytecode) {
+ if (!utils.isHexString(bytecode)) {
+ errors.throwError('invalid contract bytecode', errors.INVALID_ARGUMENT, {
+ arg: 'bytecode',
+ type: typeof(bytecode),
+ value: bytecode
+ });
+ }
+
+ var params = Array.prototype.slice.call(arguments, 1);
+ if (params.length < inputParams.types.length) {
+ errors.throwError('missing constructor argument', errors.MISSING_ARGUMENT, {
+ arg: (inputParams.names[params.length] || 'unknown'),
+ count: params.length,
+ expectedCount: inputParams.types.length
+ });
+ } else if (params.length > inputParams.types.length) {
+ errors.throwError('too many constructor arguments', errors.UNEXPECTED_ARGUMENT, {
+ count: params.length,
+ expectedCount: inputParams.types.length
+ });
+ }
+
+ try {
+ var encodedParams = utils.coder.encode(method.inputs, params)
+ } catch (error) {
+ errors.throwError('invalid constructor argument', errors.INVALID_ARGUMENT, {
+ arg: error.arg,
+ reason: error.reason,
+ value: error.value
+ });
+ }
+
+ var result = {
+ bytecode: bytecode + encodedParams.substring(2),
+ type: 'deploy'
+ }
+
+ return populateDescription(new DeployDescription(), result);
+ }
+
+ utils.defineFrozen(func, 'inputs', inputParams);
+ utils.defineProperty(func, 'payable', (method.payable == null || !!method.payable))
+
+ return func;
+ })();
+
+ if (!deploy) { deploy = func; }
+
+ break;
+
+ case 'function':
+ var func = (function() {
+ var inputParams = parseParams(method.inputs);
+ var outputParams = parseParams(method.outputs);
+
+ var signature = '(' + inputParams.types.join(',') + ')';
+ signature = signature.replace(/tuple/g, '');
+ signature = method.name + signature;
+
+ var parse = function(data) {
+ try {
+ return utils.coder.decode(method.outputs, utils.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
+ });
+ }
+ };
+
+ var sighash = utils.keccak256(utils.toUtf8Bytes(signature)).substring(0, 10);
+ var func = function() {
+ var result = {
+ name: method.name,
+ signature: signature,
+ sighash: sighash,
+ type: ((method.constant) ? 'call': 'transaction')
+ };
+
+ var params = Array.prototype.slice.call(arguments, 0);
+
+ if (params.length < inputParams.types.length) {
+ errors.throwError('missing input argument', errors.MISSING_ARGUMENT, {
+ arg: (inputParams.names[params.length] || 'unknown'),
+ count: params.length,
+ expectedCount: inputParams.types.length,
+ name: method.name
+ });
+ } else if (params.length > inputParams.types.length) {
+ errors.throwError('too many input arguments', errors.UNEXPECTED_ARGUMENT, {
+ count: params.length,
+ expectedCount: inputParams.types.length
+ });
+ }
+
+ try {
+ var encodedParams = utils.coder.encode(method.inputs, params);
+ } catch (error) {
+ errors.throwError('invalid input argument', errors.INVALID_ARGUMENT, {
+ arg: error.arg,
+ reason: error.reason,
+ value: error.value
+ });
+ }
+
+ result.data = sighash + encodedParams.substring(2);
+ result.parse = parse;
+
+ return populateDescription(new FunctionDescription(), result);
+ }
+
+ utils.defineFrozen(func, 'inputs', inputParams);
+ utils.defineFrozen(func, 'outputs', outputParams);
+
+ utils.defineProperty(func, 'payable', (method.payable == null || !!method.payable))
+
+ utils.defineProperty(func, 'parseResult', parse);
+
+ utils.defineProperty(func, 'signature', signature);
+ utils.defineProperty(func, 'sighash', sighash);
+
+ return func;
+ })();
+
+ // Expose the first (and hopefully unique named function
+ if (method.name && methods[method.name] == null) {
+ utils.defineProperty(methods, method.name, func);
+ }
+
+ // Expose all methods by their signature, for overloaded functions
+ if (methods[func.signature] == null) {
+ utils.defineProperty(methods, func.signature, func);
+ }
+
+ break;
+
+ case 'event':
+ var func = (function() {
+ var inputParams = parseParams(method.inputs);
+
+ var signature = '(' + inputParams.types.join(',') + ')';
+ signature = signature.replace(/tuple/g, '');
+ signature = method.name + signature;
+
+ var result = {
+ anonymous: (!!method.anonymous),
+ name: method.name,
+ signature: signature,
+ type: 'event'
+ };
+
+ result.parse = function(topics, data) {
+ if (data == null) {
+ data = topics;
+ topics = null;
+ }
+
+ // Strip the signature off of non-anonymous topics
+ if (topics != null && !method.anonymous) { topics = topics.slice(1); }
+
+ var inputIndexed = [], inputNonIndexed = [];
+ var inputDynamic = [];
+ method.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 = utils.coder.decode(
+ inputIndexed,
+ utils.concat(topics)
+ );
+ }
+
+ var resultNonIndexed = utils.coder.decode(
+ inputNonIndexed,
+ utils.arrayify(data)
+ );
+
+ var result = new Result();
+ var nonIndexedIndex = 0, indexedIndex = 0;
+ method.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 = method.inputs.length;
+
+ return result;
+ };
+
+ var func = populateDescription(new EventDescription(), result)
+ utils.defineFrozen(func, 'topics', [ utils.keccak256(utils.toUtf8Bytes(signature)) ]);
+ utils.defineFrozen(func, 'inputs', inputParams);
+ return func;
+ })();
+
+ // Expose the first (and hopefully unique) event name
+ if (method.name && events[method.name] == null) {
+ utils.defineProperty(events, method.name, func);
+ }
+
+ // Expose all events by their signature, for overloaded functions
+ if (methods[func.signature] == null) {
+ utils.defineProperty(methods, func.signature, func);
+ }
+
+ break;
+
+ case 'fallback':
+ // Nothing to do for fallback
+ break;
+
+ default:
+ console.log('WARNING: unsupported ABI type - ' + method.type);
+ break;
+ }
+ };
+
+ _abi.forEach(addMethod, this);
+
+ // If there wasn't a constructor, create the default constructor
+ if (!deploy) {
+ addMethod({type: 'constructor', inputs: []});
+ }
+
+ utils.defineProperty(this, 'deployFunction', deploy);
+}
+
+utils.defineProperty(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 = utils.coder.decode(func.inputs.types, '0x' + tx.data.substring(10));
+ return {
+ args: result,
+ signature: func.signature,
+ sighash: func.sighash,
+ parse: func.parseResult,
+ value: tx.value,
+ };
+ }
+ }
+ return null;
+});
+
+module.exports = Interface;
+
+},{"../utils/abi-coder":677,"../utils/convert":683,"../utils/errors":685,"../utils/keccak256":689,"../utils/properties":692,"../utils/utf8":698}],644:[function(require,module,exports){
+'use strict';
+
+var version = require('./package.json').version;
+
+var contracts = require('./contracts');
+var providers = require('./providers');
+var errors = require('./utils/errors');
+var utils = require('./utils');
+var wallet = require('./wallet');
+
+module.exports = {
+ Wallet: wallet.Wallet,
+
+ HDNode: wallet.HDNode,
+ SigningKey: wallet.SigningKey,
+
+ Contract: contracts.Contract,
+ Interface: contracts.Interface,
+
+ networks: providers.networks,
+ providers: providers,
+
+ errors: errors,
+ utils: utils,
+
+ version: version,
+};
+
+},{"./contracts":642,"./package.json":667,"./providers":671,"./utils":688,"./utils/errors":685,"./wallet":700}],645:[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":661,"./elliptic/curve":648,"./elliptic/curves":651,"./elliptic/ec":652,"./elliptic/eddsa":655,"./elliptic/hmac-drbg":658,"./elliptic/utils":660,"brorand":76}],646:[function(require,module,exports){
+arguments[4][549][0].apply(exports,arguments)
+},{"../../elliptic":645,"bn.js":66,"dup":549}],647:[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 EdwardsCurve(conf) {
+ // NOTE: Important as we are creating point in Base.call()
+ this.twisted = (conf.a | 0) !== 1;
+ this.mOneA = this.twisted && (conf.a | 0) === -1;
+ this.extended = this.mOneA;
+
+ Base.call(this, 'edwards', conf);
+
+ this.a = new BN(conf.a, 16).umod(this.red.m);
+ this.a = this.a.toRed(this.red);
+ this.c = new BN(conf.c, 16).toRed(this.red);
+ this.c2 = this.c.redSqr();
+ this.d = new BN(conf.d, 16).toRed(this.red);
+ this.dd = this.d.redAdd(this.d);
+
+ assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
+ this.oneC = (conf.c | 0) === 1;
+}
+inherits(EdwardsCurve, Base);
+module.exports = EdwardsCurve;
+
+EdwardsCurve.prototype._mulA = function _mulA(num) {
+ if (this.mOneA)
+ return num.redNeg();
+ else
+ return this.a.redMul(num);
+};
+
+EdwardsCurve.prototype._mulC = function _mulC(num) {
+ if (this.oneC)
+ return num;
+ else
+ return this.c.redMul(num);
+};
+
+// Just for compatibility with Short curve
+EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
+ return this.point(x, y, z, t);
+};
+
+EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
+ x = new BN(x, 16);
+ if (!x.red)
+ x = x.toRed(this.red);
+
+ var x2 = x.redSqr();
+ var rhs = this.c2.redSub(this.a.redMul(x2));
+ var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
+
+ var y2 = rhs.redMul(lhs.redInvm());
+ var y = y2.redSqrt();
+ if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
+ throw new Error('invalid point');
+
+ var isOdd = y.fromRed().isOdd();
+ if (odd && !isOdd || !odd && isOdd)
+ y = y.redNeg();
+
+ return this.point(x, y);
+};
+
+EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
+ y = new BN(y, 16);
+ if (!y.red)
+ y = y.toRed(this.red);
+
+ // x^2 = (y^2 - 1) / (d y^2 + 1)
+ var y2 = y.redSqr();
+ var lhs = y2.redSub(this.one);
+ var rhs = y2.redMul(this.d).redAdd(this.one);
+ var x2 = lhs.redMul(rhs.redInvm());
+
+ if (x2.cmp(this.zero) === 0) {
+ if (odd)
+ throw new Error('invalid point');
+ else
+ return this.point(this.zero, y);
+ }
+
+ var x = x2.redSqrt();
+ if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
+ throw new Error('invalid point');
+
+ if (x.isOdd() !== odd)
+ x = x.redNeg();
+
+ return this.point(x, y);
+};
+
+EdwardsCurve.prototype.validate = function validate(point) {
+ if (point.isInfinity())
+ return true;
+
+ // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
+ point.normalize();
+
+ var x2 = point.x.redSqr();
+ var y2 = point.y.redSqr();
+ var lhs = x2.redMul(this.a).redAdd(y2);
+ var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
+
+ return lhs.cmp(rhs) === 0;
+};
+
+function Point(curve, x, y, z, t) {
+ Base.BasePoint.call(this, curve, 'projective');
+ if (x === null && y === null && z === null) {
+ this.x = this.curve.zero;
+ this.y = this.curve.one;
+ this.z = this.curve.one;
+ this.t = this.curve.zero;
+ this.zOne = true;
+ } else {
+ this.x = new BN(x, 16);
+ this.y = new BN(y, 16);
+ this.z = z ? new BN(z, 16) : this.curve.one;
+ this.t = t && new BN(t, 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);
+ if (this.t && !this.t.red)
+ this.t = this.t.toRed(this.curve.red);
+ this.zOne = this.z === this.curve.one;
+
+ // Use extended coordinates
+ if (this.curve.extended && !this.t) {
+ this.t = this.x.redMul(this.y);
+ if (!this.zOne)
+ this.t = this.t.redMul(this.z.redInvm());
+ }
+ }
+}
+inherits(Point, Base.BasePoint);
+
+EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
+ return Point.fromJSON(this, obj);
+};
+
+EdwardsCurve.prototype.point = function point(x, y, z, t) {
+ return new Point(this, x, y, z, t);
+};
+
+Point.fromJSON = function fromJSON(curve, obj) {
+ return new Point(curve, obj[0], obj[1], obj[2]);
+};
+
+Point.prototype.inspect = function inspect() {
+ if (this.isInfinity())
+ return '';
+ return '';
+};
+
+Point.prototype.isInfinity = function isInfinity() {
+ // XXX This code assumes that zero is always zero in red
+ return this.x.cmpn(0) === 0 &&
+ this.y.cmp(this.z) === 0;
+};
+
+Point.prototype._extDbl = function _extDbl() {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
+ // #doubling-dbl-2008-hwcd
+ // 4M + 4S
+
+ // A = X1^2
+ var a = this.x.redSqr();
+ // B = Y1^2
+ var b = this.y.redSqr();
+ // C = 2 * Z1^2
+ var c = this.z.redSqr();
+ c = c.redIAdd(c);
+ // D = a * A
+ var d = this.curve._mulA(a);
+ // E = (X1 + Y1)^2 - A - B
+ var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
+ // G = D + B
+ var g = d.redAdd(b);
+ // F = G - C
+ var f = g.redSub(c);
+ // H = D - B
+ var h = d.redSub(b);
+ // X3 = E * F
+ var nx = e.redMul(f);
+ // Y3 = G * H
+ var ny = g.redMul(h);
+ // T3 = E * H
+ var nt = e.redMul(h);
+ // Z3 = F * G
+ var nz = f.redMul(g);
+ return this.curve.point(nx, ny, nz, nt);
+};
+
+Point.prototype._projDbl = function _projDbl() {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
+ // #doubling-dbl-2008-bbjlp
+ // #doubling-dbl-2007-bl
+ // and others
+ // Generally 3M + 4S or 2M + 4S
+
+ // B = (X1 + Y1)^2
+ var b = this.x.redAdd(this.y).redSqr();
+ // C = X1^2
+ var c = this.x.redSqr();
+ // D = Y1^2
+ var d = this.y.redSqr();
+
+ var nx;
+ var ny;
+ var nz;
+ if (this.curve.twisted) {
+ // E = a * C
+ var e = this.curve._mulA(c);
+ // F = E + D
+ var f = e.redAdd(d);
+ if (this.zOne) {
+ // X3 = (B - C - D) * (F - 2)
+ nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
+ // Y3 = F * (E - D)
+ ny = f.redMul(e.redSub(d));
+ // Z3 = F^2 - 2 * F
+ nz = f.redSqr().redSub(f).redSub(f);
+ } else {
+ // H = Z1^2
+ var h = this.z.redSqr();
+ // J = F - 2 * H
+ var j = f.redSub(h).redISub(h);
+ // X3 = (B-C-D)*J
+ nx = b.redSub(c).redISub(d).redMul(j);
+ // Y3 = F * (E - D)
+ ny = f.redMul(e.redSub(d));
+ // Z3 = F * J
+ nz = f.redMul(j);
+ }
+ } else {
+ // E = C + D
+ var e = c.redAdd(d);
+ // H = (c * Z1)^2
+ var h = this.curve._mulC(this.c.redMul(this.z)).redSqr();
+ // J = E - 2 * H
+ var j = e.redSub(h).redSub(h);
+ // X3 = c * (B - E) * J
+ nx = this.curve._mulC(b.redISub(e)).redMul(j);
+ // Y3 = c * E * (C - D)
+ ny = this.curve._mulC(e).redMul(c.redISub(d));
+ // Z3 = E * J
+ nz = e.redMul(j);
+ }
+ return this.curve.point(nx, ny, nz);
+};
+
+Point.prototype.dbl = function dbl() {
+ if (this.isInfinity())
+ return this;
+
+ // Double in extended coordinates
+ if (this.curve.extended)
+ return this._extDbl();
+ else
+ return this._projDbl();
+};
+
+Point.prototype._extAdd = function _extAdd(p) {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
+ // #addition-add-2008-hwcd-3
+ // 8M
+
+ // A = (Y1 - X1) * (Y2 - X2)
+ var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
+ // B = (Y1 + X1) * (Y2 + X2)
+ var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
+ // C = T1 * k * T2
+ var c = this.t.redMul(this.curve.dd).redMul(p.t);
+ // D = Z1 * 2 * Z2
+ var d = this.z.redMul(p.z.redAdd(p.z));
+ // E = B - A
+ var e = b.redSub(a);
+ // F = D - C
+ var f = d.redSub(c);
+ // G = D + C
+ var g = d.redAdd(c);
+ // H = B + A
+ var h = b.redAdd(a);
+ // X3 = E * F
+ var nx = e.redMul(f);
+ // Y3 = G * H
+ var ny = g.redMul(h);
+ // T3 = E * H
+ var nt = e.redMul(h);
+ // Z3 = F * G
+ var nz = f.redMul(g);
+ return this.curve.point(nx, ny, nz, nt);
+};
+
+Point.prototype._projAdd = function _projAdd(p) {
+ // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
+ // #addition-add-2008-bbjlp
+ // #addition-add-2007-bl
+ // 10M + 1S
+
+ // A = Z1 * Z2
+ var a = this.z.redMul(p.z);
+ // B = A^2
+ var b = a.redSqr();
+ // C = X1 * X2
+ var c = this.x.redMul(p.x);
+ // D = Y1 * Y2
+ var d = this.y.redMul(p.y);
+ // E = d * C * D
+ var e = this.curve.d.redMul(c).redMul(d);
+ // F = B - E
+ var f = b.redSub(e);
+ // G = B + E
+ var g = b.redAdd(e);
+ // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
+ var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
+ var nx = a.redMul(f).redMul(tmp);
+ var ny;
+ var nz;
+ if (this.curve.twisted) {
+ // Y3 = A * G * (D - a * C)
+ ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
+ // Z3 = F * G
+ nz = f.redMul(g);
+ } else {
+ // Y3 = A * G * (D - C)
+ ny = a.redMul(g).redMul(d.redSub(c));
+ // Z3 = c * F * G
+ nz = this.curve._mulC(f).redMul(g);
+ }
+ return this.curve.point(nx, ny, nz);
+};
+
+Point.prototype.add = function add(p) {
+ if (this.isInfinity())
+ return p;
+ if (p.isInfinity())
+ return this;
+
+ if (this.curve.extended)
+ return this._extAdd(p);
+ else
+ return this._projAdd(p);
+};
+
+Point.prototype.mul = function mul(k) {
+ if (this._hasDoubles(k))
+ return this.curve._fixedNafMul(this, k);
+ else
+ return this.curve._wnafMul(this, k);
+};
+
+Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
+ return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
+};
+
+Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
+ return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
+};
+
+Point.prototype.normalize = function normalize() {
+ if (this.zOne)
+ return this;
+
+ // Normalize coordinates
+ var zi = this.z.redInvm();
+ this.x = this.x.redMul(zi);
+ this.y = this.y.redMul(zi);
+ if (this.t)
+ this.t = this.t.redMul(zi);
+ this.z = this.curve.one;
+ this.zOne = true;
+ return this;
+};
+
+Point.prototype.neg = function neg() {
+ return this.curve.point(this.x.redNeg(),
+ this.y,
+ this.z,
+ this.t && this.t.redNeg());
+};
+
+Point.prototype.getX = function getX() {
+ this.normalize();
+ return this.x.fromRed();
+};
+
+Point.prototype.getY = function getY() {
+ this.normalize();
+ return this.y.fromRed();
+};
+
+Point.prototype.eq = function eq(other) {
+ return this === other ||
+ this.getX().cmp(other.getX()) === 0 &&
+ this.getY().cmp(other.getY()) === 0;
+};
+
+Point.prototype.eqXToP = function eqXToP(x) {
+ var rx = x.toRed(this.curve.red).redMul(this.z);
+ if (this.x.cmp(rx) === 0)
+ return true;
+
+ var xc = x.clone();
+ var t = this.curve.redN.redMul(this.z);
+ 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;
+};
+
+// Compatibility with BaseCurve
+Point.prototype.toP = Point.prototype.normalize;
+Point.prototype.mixedAdd = Point.prototype.add;
+
+},{"../../elliptic":645,"../curve":648,"bn.js":66,"inherits":662}],648:[function(require,module,exports){
+arguments[4][551][0].apply(exports,arguments)
+},{"./base":646,"./edwards":647,"./mont":649,"./short":650,"dup":551}],649:[function(require,module,exports){
+arguments[4][552][0].apply(exports,arguments)
+},{"../../elliptic":645,"../curve":648,"bn.js":66,"dup":552,"inherits":662}],650:[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 '';
+ return '';
+};
+
+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 '';
+ return '';
+};
+
+JPoint.prototype.isInfinity = function isInfinity() {
+ // XXX This code assumes that zero is always zero in red
+ return this.z.cmpn(0) === 0;
+};
+
+},{"../../elliptic":645,"../curve":648,"bn.js":66,"inherits":662}],651:[function(require,module,exports){
+arguments[4][554][0].apply(exports,arguments)
+},{"../elliptic":645,"./precomputed/secp256k1":659,"dup":554,"hash.js":803}],652:[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":645,"./key":653,"./signature":654,"bn.js":66}],653:[function(require,module,exports){
+arguments[4][556][0].apply(exports,arguments)
+},{"../../elliptic":645,"bn.js":66,"dup":556}],654:[function(require,module,exports){
+arguments[4][557][0].apply(exports,arguments)
+},{"../../elliptic":645,"bn.js":66,"dup":557}],655:[function(require,module,exports){
+arguments[4][558][0].apply(exports,arguments)
+},{"../../elliptic":645,"./key":656,"./signature":657,"dup":558,"hash.js":803}],656:[function(require,module,exports){
+arguments[4][559][0].apply(exports,arguments)
+},{"../../elliptic":645,"dup":559}],657:[function(require,module,exports){
+arguments[4][560][0].apply(exports,arguments)
+},{"../../elliptic":645,"bn.js":66,"dup":560}],658:[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":645,"hash.js":803}],659:[function(require,module,exports){
+arguments[4][561][0].apply(exports,arguments)
+},{"dup":561}],660:[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":66}],661:[function(require,module,exports){
+module.exports={
+ "_args": [
+ [
+ "elliptic@6.3.3",
+ "/home/yann/Remix/remix-ide"
+ ]
+ ],
+ "_development": true,
+ "_from": "elliptic@6.3.3",
+ "_id": "elliptic@6.3.3",
+ "_inBundle": false,
+ "_integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=",
+ "_location": "/ethers/elliptic",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "elliptic@6.3.3",
+ "name": "elliptic",
+ "escapedName": "elliptic",
+ "rawSpec": "6.3.3",
+ "saveSpec": null,
+ "fetchSpec": "6.3.3"
+ },
+ "_requiredBy": [
+ "/ethers"
+ ],
+ "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz",
+ "_spec": "6.3.3",
+ "_where": "/home/yann/Remix/remix-ide",
+ "author": {
+ "name": "Fedor Indutny",
+ "email": "fedor@indutny.com"
+ },
+ "bugs": {
+ "url": "https://github.com/indutny/elliptic/issues"
+ },
+ "dependencies": {
+ "bn.js": "^4.4.0",
+ "brorand": "^1.0.1",
+ "hash.js": "^1.0.0",
+ "inherits": "^2.0.1"
+ },
+ "description": "EC cryptography",
+ "devDependencies": {
+ "brfs": "^1.4.3",
+ "coveralls": "^2.11.3",
+ "grunt": "^0.4.5",
+ "grunt-browserify": "^5.0.0",
+ "grunt-cli": "^1.2.0",
+ "grunt-contrib-connect": "^1.0.0",
+ "grunt-contrib-copy": "^1.0.0",
+ "grunt-contrib-uglify": "^1.0.1",
+ "grunt-mocha-istanbul": "^3.0.1",
+ "grunt-saucelabs": "^8.6.2",
+ "istanbul": "^0.4.2",
+ "jscs": "^2.9.0",
+ "jshint": "^2.6.0",
+ "mocha": "^2.1.0"
+ },
+ "files": [
+ "lib"
+ ],
+ "homepage": "https://github.com/indutny/elliptic",
+ "keywords": [
+ "EC",
+ "Elliptic",
+ "curve",
+ "Cryptography"
+ ],
+ "license": "MIT",
+ "main": "lib/elliptic.js",
+ "name": "elliptic",
+ "repository": {
+ "type": "git",
+ "url": "git+ssh://git@github.com/indutny/elliptic.git"
+ },
+ "scripts": {
+ "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
+ "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
+ "lint": "npm run jscs && npm run jshint",
+ "test": "npm run lint && npm run unit",
+ "unit": "istanbul test _mocha --reporter=spec test/index.js",
+ "version": "grunt dist && git add dist/"
+ },
+ "version": "6.3.3"
+}
+
+},{}],662:[function(require,module,exports){
+arguments[4][36][0].apply(exports,arguments)
+},{"dup":36}],663:[function(require,module,exports){
+arguments[4][580][0].apply(exports,arguments)
+},{"_process":109,"dup":580}],664:[function(require,module,exports){
+(function (process,global,clearImmediate){
+(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
+
+
+
+
+
+
+