From 1b9ebcc9b59f08f41639a05009f07bd66d83e09d Mon Sep 17 00:00:00 2001 From: Zach Plata Date: Mon, 13 Mar 2017 12:14:11 -0500 Subject: [PATCH] Initialize project for first release of SMART ASCVD Risk Calculator --- .babelrc | 3 + .eslintrc | 17 + .gitignore | 2 + .nvmrc | 1 + .travis.yml | 15 + CHANGELOG.md | 6 + CONTRIBUTING.md | 37 + CONTRIBUTORS.md | 3 + LICENSE.txt | 201 ++++ NOTICE.txt | 13 + README.md | 173 +++ app/__mocks__/load_fhir_data.js | 31 + app/load_fhir_data.js | 726 ++++++++++++ app/polyfill.js | 72 ++ build/css/styles.css | 1 + build/js/bundle.js | 35 + components/App/app.jsx | 165 +++ components/DetailBox/detail_box.css | 64 + components/DetailBox/detail_box.jsx | 51 + components/Form/ButtonForm/button_form.css | 53 + components/Form/ButtonForm/button_form.jsx | 110 ++ .../Form/InputTextForm/input_text_form.css | 54 + .../Form/InputTextForm/input_text_form.jsx | 173 +++ .../RadioButtonForm/radio_button_form.css | 53 + .../RadioButtonForm/radio_button_form.jsx | 114 ++ components/Form/SendForm/send_form.css | 63 + components/Form/SendForm/send_form.jsx | 70 ++ components/Header/header.css | 15 + components/Header/header.jsx | 24 + components/Navbar/navbar.css | 72 ++ components/Navbar/navbar.jsx | 94 ++ components/PatientBanner/banner.css | 43 + components/PatientBanner/banner.jsx | 44 + components/Results/Graph/graph.css | 199 ++++ components/Results/Graph/graph.jsx | 149 +++ components/Results/GraphBar/graph_bar.css | 49 + components/Results/GraphBar/graph_bar.jsx | 90 ++ components/Results/RiskAction/risk_action.css | 55 + components/Results/RiskAction/risk_action.jsx | 100 ++ .../Results/SimulatedRisk/simulated_risk.css | 108 ++ .../Results/SimulatedRisk/simulated_risk.jsx | 503 ++++++++ index.html | 29 + index.jsx | 11 + launch.html | 18 + lib/canadarm.min.js | 2 + lib/fhir-client.min.js | 6 + lib/jquery.min.js | 4 + lib/react-dom.min.js | 15 + lib/react.min.js | 12 + package.json | 86 ++ screenshots/Recommendations.png | Bin 0 -> 301648 bytes screenshots/Results.png | Bin 0 -> 192053 bytes screenshots/RiskFactors_Graph.png | Bin 0 -> 159563 bytes screenshots/RiskFactors_SimulatedRisk.png | Bin 0 -> 165119 bytes tests/app/load_fhir_data_test.js | 1043 +++++++++++++++++ tests/components/App/App.spec.js | 93 ++ tests/components/DetailBox/DetailBox.spec.js | 35 + tests/components/Form/ButtonForm.spec.js | 97 ++ tests/components/Form/InputTextForm.spec.js | 132 +++ tests/components/Form/RadioButtonForm.spec.js | 59 + tests/components/Form/SendForm.spec.js | 63 + tests/components/Header/Header.spec.js | 22 + tests/components/Navbar/Navbar.spec.js | 79 ++ .../PatientBanner/PatientBanner.spec.js | 46 + tests/components/Results/Graph/Graph.spec.js | 81 ++ .../Results/GraphBar/GraphBar.spec.js | 48 + .../Results/RiskAction/RiskAction.spec.js | 114 ++ .../SimulatedRisk/SimulatedRisk.spec.js | 233 ++++ tests/features/config.js | 69 ++ .../fixtures/Recommendations/index.jsx | 13 + tests/features/fixtures/Results/index.jsx | 54 + tests/features/fixtures/RiskFactors/index.jsx | 61 + tests/features/fixtures/index.html | 17 + tests/features/fixtures/sampledata.js | 630 ++++++++++ tests/helpers/browser.js | 20 + tests/index.html | 28 + tests/nightwatch.conf.js | 9 + tests/nightwatch/ascvd-risk.spec.js | 266 +++++ .../Recommendations/Recommendations.spec.js | 32 + tests/views/Results/Results.spec.js | 67 ++ tests/views/RiskFactors/RiskFactors.spec.js | 97 ++ views/Recommendations/index.css | 13 + views/Recommendations/index.jsx | 76 ++ views/Results/index.css | 65 + views/Results/index.jsx | 144 +++ views/RiskFactors/index.css | 19 + views/RiskFactors/index.jsx | 99 ++ webpack.config.js | 44 + 88 files changed, 8002 insertions(+) create mode 100644 .babelrc create mode 100644 .eslintrc create mode 100644 .gitignore create mode 100644 .nvmrc create mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 CONTRIBUTORS.md create mode 100644 LICENSE.txt create mode 100644 NOTICE.txt create mode 100644 app/__mocks__/load_fhir_data.js create mode 100644 app/load_fhir_data.js create mode 100644 app/polyfill.js create mode 100644 build/css/styles.css create mode 100644 build/js/bundle.js create mode 100644 components/App/app.jsx create mode 100644 components/DetailBox/detail_box.css create mode 100644 components/DetailBox/detail_box.jsx create mode 100644 components/Form/ButtonForm/button_form.css create mode 100644 components/Form/ButtonForm/button_form.jsx create mode 100644 components/Form/InputTextForm/input_text_form.css create mode 100644 components/Form/InputTextForm/input_text_form.jsx create mode 100644 components/Form/RadioButtonForm/radio_button_form.css create mode 100644 components/Form/RadioButtonForm/radio_button_form.jsx create mode 100644 components/Form/SendForm/send_form.css create mode 100644 components/Form/SendForm/send_form.jsx create mode 100644 components/Header/header.css create mode 100644 components/Header/header.jsx create mode 100644 components/Navbar/navbar.css create mode 100644 components/Navbar/navbar.jsx create mode 100644 components/PatientBanner/banner.css create mode 100644 components/PatientBanner/banner.jsx create mode 100644 components/Results/Graph/graph.css create mode 100644 components/Results/Graph/graph.jsx create mode 100644 components/Results/GraphBar/graph_bar.css create mode 100644 components/Results/GraphBar/graph_bar.jsx create mode 100644 components/Results/RiskAction/risk_action.css create mode 100644 components/Results/RiskAction/risk_action.jsx create mode 100644 components/Results/SimulatedRisk/simulated_risk.css create mode 100644 components/Results/SimulatedRisk/simulated_risk.jsx create mode 100644 index.html create mode 100644 index.jsx create mode 100644 launch.html create mode 100644 lib/canadarm.min.js create mode 100644 lib/fhir-client.min.js create mode 100644 lib/jquery.min.js create mode 100644 lib/react-dom.min.js create mode 100644 lib/react.min.js create mode 100644 package.json create mode 100644 screenshots/Recommendations.png create mode 100644 screenshots/Results.png create mode 100644 screenshots/RiskFactors_Graph.png create mode 100644 screenshots/RiskFactors_SimulatedRisk.png create mode 100644 tests/app/load_fhir_data_test.js create mode 100644 tests/components/App/App.spec.js create mode 100644 tests/components/DetailBox/DetailBox.spec.js create mode 100644 tests/components/Form/ButtonForm.spec.js create mode 100644 tests/components/Form/InputTextForm.spec.js create mode 100644 tests/components/Form/RadioButtonForm.spec.js create mode 100644 tests/components/Form/SendForm.spec.js create mode 100644 tests/components/Header/Header.spec.js create mode 100644 tests/components/Navbar/Navbar.spec.js create mode 100644 tests/components/PatientBanner/PatientBanner.spec.js create mode 100644 tests/components/Results/Graph/Graph.spec.js create mode 100644 tests/components/Results/GraphBar/GraphBar.spec.js create mode 100644 tests/components/Results/RiskAction/RiskAction.spec.js create mode 100644 tests/components/Results/SimulatedRisk/SimulatedRisk.spec.js create mode 100644 tests/features/config.js create mode 100644 tests/features/fixtures/Recommendations/index.jsx create mode 100644 tests/features/fixtures/Results/index.jsx create mode 100644 tests/features/fixtures/RiskFactors/index.jsx create mode 100644 tests/features/fixtures/index.html create mode 100644 tests/features/fixtures/sampledata.js create mode 100644 tests/helpers/browser.js create mode 100644 tests/index.html create mode 100644 tests/nightwatch.conf.js create mode 100644 tests/nightwatch/ascvd-risk.spec.js create mode 100644 tests/views/Recommendations/Recommendations.spec.js create mode 100644 tests/views/Results/Results.spec.js create mode 100644 tests/views/RiskFactors/RiskFactors.spec.js create mode 100644 views/Recommendations/index.css create mode 100644 views/Recommendations/index.jsx create mode 100644 views/Results/index.css create mode 100644 views/Results/index.jsx create mode 100644 views/RiskFactors/index.css create mode 100644 views/RiskFactors/index.jsx create mode 100644 webpack.config.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..4687bc4 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015", "react", "stage-0"] +} diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..ef0673c --- /dev/null +++ b/.eslintrc @@ -0,0 +1,17 @@ +{ + "extends": "airbnb", + "installedESLint": true, + "globals": { + "window": true, + "$": true, + "FHIR": true, + "document": true, + "Canadarm": true, + "canadarmConfig": true + }, + "rules": { + "class-methods-use-this": ["error", {"exceptMethods": ["handleSubmit", "handleKeyPress", "shouldComponentUpdate", "render"]}], + "no-console": 0, + "jsx-a11y/no-static-element-interactions": 0 + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e087fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +node_modules diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..dc3829f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +6.9.1 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c082e80 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: node_js +sudo: required +jdk: oraclejdk8 +before_script: + - sudo apt-get update && sudo apt-get install oracle-java8-installer +node_js: + - '6' + - '6.9' +cache: + directories: + - node_modules +script: + - npm run lint + - npm test + - npm run test:nightwatch diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..46d9726 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# CHANGELOG + +* 1.0.0 + - Implemented UI design with React + - Implemented ASCVD Risk Score algorithm + - Implemented testing using Jest, Mocha, and Nightwatch diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..cc59893 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# Contributing # + +Help us make this project better by contributing, whether that be implementation of set features, bug fixes, adding to the test suite, or even enhancing our documentation. +Please start with logging an issue to the [issue tracker][1] or submit a pull request. + +Before you contribute, please review these guidelines to help ensure a smooth process for everyone. + +Thank you! + +## Issue reporting + +* Please browse our [existing issues][1] before logging new issues. +* Open an issue with a descriptive title and a summary. +* Please be as clear and explicit as you can in your description of the problem. +* Please state the version of Operating System, Browser, and ASCVD Risk app you are using in the description. +* Include any relevant code in the issue summary. + +## Pull requests + +* Read [how to properly contribute to open source projects on Github][2] +* Fork the project +* Use a feature branch. +* Write [good commit messages][3]. +* Use the same coding conventions as the rest of the project. +* Commit and push until you are happy with your contribution. +* Make sure to add tests and verify all the tests are passing when merging up. +* Add an entry to the [Changelog](CHANGELOG.md) accordingly. +* Please add your name to the CONTRIBUTORS.md file. Adding your name to the CONTRIBUTORS.md file signifies agreement to all rights and reservations by the License. +* [Squash related commits together][4]. +* Open a [pull request][5]. +* The pull request will be reviewed by the community and merged by the project committers. + +[1]: https://github.com/cerner/ascvd-risk-calculator/issues +[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request +[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[4]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html +[5]: https://help.github.com/articles/using-pull-requests diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..4080f70 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +* [Zach Plata](https://github.com/zplata) +* [Kevin Shekleton](https://github.com/kpshek) +* [Shriniket Sarkar](https://github.com/shriniketsarkar) diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..48f0bab --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [2017] [Cerner Corporation] + + 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. diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 0000000..7ad4b08 --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,13 @@ +Copyright 2017 Cerner Innovation, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this software 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. diff --git a/README.md b/README.md index fb0b97a..f452822 100644 --- a/README.md +++ b/README.md @@ -1 +1,174 @@ # ASCVD Risk App # + +ASCVD Risk App is a web application built using React, ES6, SMART, and FHIR technologies. + +The ASCVD Risk Calculator is a tool intended to help users find an estimate for their cardiovascular risk according to +the [2013 ACC/AHA Guideline on the Assessment of Cardiovascular Risk][1] and the [2013 ACC/AHA Guideline on the Treatment +of Blood Cholesterol to Reduce Atherosclerotic Cardiovascular Risk in Adults][2]. Specifically, this tool allows users +to estimate a 10-year and/or lifetime risk for atherosclerotic cardiovascular disease (ASCVD). These scores are estimated +based on the Pooled Cohort Equations and lifetime risk prediction tools. + +The tool also has the ability to simulate a potential reduction in risk based on the risk factors taken into account +to calculate the score. This allows a user to see how one or several actions could help to reduce their risk of ASCVD. +Along with this, the tool calculates a lowest possible risk score determined by lowest possible values for the labs +taken into account to calculate risk, and considering the user is not currently a diabetic, is not smoking, and is not +taking treatment for hypertension. + +This tool is intended for those with an assumed LDL - Cholesterol < 190 mg/dL, and +the following are a number of factors required to calculate an estimated ASCVD risk: +- Sex +- Age +- Race +- Total Cholesterol +- HDL - Cholesterol +- Systolic Blood Pressure +- Diabetes status +- Current Smoking status +- Treatment for Hypertension status + +The risk scores calculated by this tool and +any recommendations provided are intended to inform, and should not supersede any findings or opinions by a care provider. + +## 10-Year ASCVD Risk ## + +The 10-year risk estimate provided by this application is primarily applicable towards African-American and +non-Hispanic white men and women between the ages of 40 and 79 years. Other ethnic groups will have their score +calculated with the same equation for non-Hispanic white men and women, though the score estimated +may underestimate or overestimate the risk for these persons. + +## Lifetime ASCVD Risk ## + +The lifetime risk estimate provided by this application is primarily applicable towards non-Hispanic white men and +women between the ages of 20 and 59 years. The score calculated will be under the impression of a 50-year old +without ASCVD with the relevant factors entered in this calculator by the user. Similar to the 10-year risk estimate, +other ethnic groups will have their score calculated with the same equation for non-Hispanic white men and women, +though the score estimated may underestimate or overestimate the risk for these persons. + +## App Design ## + +![Results](screenshots/Results.png) +![Risk Factors Graph](screenshots/RiskFactors_Graph.png) +![Risk Factors Simulated Risk](screenshots/RiskFactors_SimulatedRisk.png) +![Recommendations](screenshots/Recommendations.png) + +# Running Locally # + +This project uses the [webpack-dev-server][3] to run the application locally. +In order to test reflected changes from editing any code locally off the ```app```, ```components```, +or ```views``` folders, there are a few steps to configure the project: + +1. Install [NPM][4] and install/update [Node][5] +2. Run ```npm install``` to install all dependencies onto the project +3. In ```webpack.config.js```, under the ```output``` property, replace + the ```path``` value with a ```__dirname```. Under the ```plugins``` + property, replace the ExtractTextPlugin parameter with ```'styles.css'```. +4. In ```index.html```: + - Uncomment the commented css file and comment/remove the line below it + + ``` + + + ``` + + - Uncomment the commented js file and comment/remove the line below it + + ``` + + + ``` + +5. Run ```npm start``` to start the server on port 8080 of localhost +6. Using a patient from the smarthealthit open FHIR DSTU2 endpoint, +launch with this link: ```localhost:8080/launch.html?fhirServiceUrl=https%3A%2F%2Ffhir-open-api-dstu2.smarthealthit.org&patientId=1768562``` + +# Build # + +This project uses webpack to build the application and will generate a ```bundle.js``` and ```styles.css``` file +inside the ```build/``` directory that includes the necessary dependencies and core application code. + +To create the build files, run the command: ```npm run build``` in the +root directory of this project. These files are referenced in the HTML file ```index.html```. The ```build/``` folder in the +project acts as the final version of these files to be used in production. + +# App Development and Project Structure # + +The following tree closely aligns with Hierarchy of the React Components. +``` +App +|--Header +|--Navbar +|--PatientBanner +|--Recommendations +| `--DetailBox +|--Results +| |--ButtonForm +| |--InputTextForm +| |--RadioButtonForm +| `--SendForm +`--RiskFactors + |--Graph + | `--GraphBar + `--SimulatedRisk + `--RiskAction +``` +When making changes locally, first make changes at the component level located in ```components/``` and ```views/``` +or the ASCVDRisk model located at ```app/load_fhir_data.js```. The three main views of this project are: +- Results: Form page (initial view) +- Risk Factors: Graph and Simulated Risk sections +- Recommendations: Detailed recommendation boxes + +The central state of the React application is in the ```/components/App/app.jsx``` file. This +also includes handling navigation throughout the application. + +When changes are verified locally, run the build (see Build section above) to bundle all changes +made. + +# Testing and Linting # + +This project uses the [Jest][6] testing framework for unit testing React components, and the +[Mocha][7] testing framework for unit testing the ASCVDRisk object model. Tests are available +under the ```tests/``` folder in the root of the project directory. + +Run the following command to run all unit tests: ```npm test``` + +This project uses the [ESLint][8] tool to lint all application-facing ES6 Javascript and JSX files using +the Airbnb [JavaScript Style Guide][9]. The configuration for this tool is found in the root of +the project directory in the ```.eslintrc``` file. + +Run the following command to lint the project: ```npm run lint``` + +# Issues # + +Please browse our [existing issues][10] before logging new issues + +# Contributing # + +See [CONTRIBUTING.md][11] + +# License # + +Copyright 2017 Cerner Innovation, Inc. + +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. + + +[1]: http://circ.ahajournals.org/content/circulationaha/129/25_suppl_2/S49.full.pdf +[2]: http://circ.ahajournals.org/content/circulationaha/129/25_suppl_2/S1.full.pdf +[3]: https://webpack.github.io/docs/webpack-dev-server.html +[4]: https://github.com/npm/npm#super-easy-install +[5]: https://nodejs.org/en/download/ +[6]: https://facebook.github.io/jest/ +[7]: https://mochajs.org/ +[8]: http://eslint.org/ +[9]: https://github.com/airbnb/javascript +[10]: https://github.com/cerner/ascvd-risk-calculator/issues +[11]: CONTRIBUTING.md diff --git a/app/__mocks__/load_fhir_data.js b/app/__mocks__/load_fhir_data.js new file mode 100644 index 0000000..8741001 --- /dev/null +++ b/app/__mocks__/load_fhir_data.js @@ -0,0 +1,31 @@ +const ASCVDRisk = jest.genMockFromModule('./load_fhir_data'); + +const dob = new Date(1939, 7, 30); + +ASCVDRisk.patientInfo = { + 'age': 77, + 'dateOfBirth': dob, + 'gender': 'male', + 'relatedFactors': { + 'diabetic': false, + 'race': 'white', + 'smoker': true + }, + 'systolicBloodPressure': 150, +}; + +ASCVDRisk.hideDemoBanner = false; +ASCVDRisk.computeTenYearScore = jest.fn(() => 33); +ASCVDRisk.computeLowestTenYear = jest.fn(() => 10); +ASCVDRisk.computeLifetimeRisk = jest.fn(() => 35); +ASCVDRisk.computeLowestLifetime = jest.fn(() => 5); +ASCVDRisk.computePotentialRisk = jest.fn(() => 20); +ASCVDRisk.canCalculateScore = jest.fn(() => true); +ASCVDRisk.missingFields = jest.fn(); +ASCVDRisk.isValidAge = jest.fn(() => true); +ASCVDRisk.isValidTotalCholesterol = jest.fn(() => false); +ASCVDRisk.isValidSysBP = jest.fn(() => true); +ASCVDRisk.isValidHDL = jest.fn(() => true); +ASCVDRisk.computeBirthDateFromAge = jest.fn(); + +module.exports = ASCVDRisk; diff --git a/app/load_fhir_data.js b/app/load_fhir_data.js new file mode 100644 index 0000000..a68e8ca --- /dev/null +++ b/app/load_fhir_data.js @@ -0,0 +1,726 @@ +import Canadarm from 'canadarm'; +import $ from '../lib/jquery.min'; + +window.ASCVDRisk = window.ASCVDRisk || {}; + +((() => { + const ASCVDRisk = {}; + const PatientInfo = {}; + ASCVDRisk.ret = $.Deferred(); + + /** + * Creates a default Patient model for the application with all undefined fields and + * resolves the promise used when retrieving patient information. Also sets to hide the + * demo banner for the application. + */ + const setDefaultPatient = () => { + PatientInfo.firstName = undefined; + PatientInfo.lastName = undefined; + PatientInfo.gender = undefined; + PatientInfo.dateOfBirth = undefined; + PatientInfo.age = undefined; + + const relatedFactors = {}; + relatedFactors.smoker = undefined; + relatedFactors.race = undefined; + relatedFactors.hypertensive = undefined; + relatedFactors.diabetic = undefined; + PatientInfo.relatedFactors = relatedFactors; + + PatientInfo.totalCholesterol = undefined; + PatientInfo.hdl = undefined; + PatientInfo.systolicBloodPressure = undefined; + ASCVDRisk.hideDemoBanner = true; + ASCVDRisk.ret.resolve(PatientInfo); + }; + ASCVDRisk.setDefaultPatient = setDefaultPatient; + + /** + * Initiate Canadarm logging for the application to output on the console and log specified + * Initiates the Canadarm logging tool to output logs to the console and + * the URL specified in the config.js file (root directory). + */ + const initializeLogger = () => { + Canadarm.init({ + onError: false, + wrapEvents: false, + logLevel: Canadarm.level.INFO, + appenders: [ + Canadarm.Appender.standardLogAppender, + ], + handlers: [ + Canadarm.Handler.consoleLogHandler, + ], + }); + }; + ASCVDRisk.initializeLogger = initializeLogger; + + /** + * Makes a call to create a default Patient model if authorization is not successful in the + * application. + */ + const onError = () => { + Canadarm.error('Authorization error while loading the application.'); + ASCVDRisk.setDefaultPatient(); + }; + ASCVDRisk.onError = onError; + + /** + * Loads patient's FHIR data and updates the ASCVDRisk data model. + * Fetches patient context to get basic patient info and observations to get lab results + * based on the supplied LOINC and SNOMED codes. Creates a patient model with undefined fields + * for any failure in retrieving FHIR data. + * + * LOINC Codes used : 'http://loinc.org|14647-2', 'http://loinc.org|2093-3', + * 'http://loinc.org|2085-9', 'http://loinc.org|8480-6', 'http://loinc.org|55284-4', + * 'http://loinc.org|72166-2' + * + * SNOMED Codes used: 'http://snomed.info/sct|229819007' + * + * @method onReady + * @param smart - Context received by the application + */ + + const onReady = (smart) => { + ASCVDRisk.hideDemoBanner = (smart.tokenResponse.need_patient_banner === false); + + // Fetch labs within the last 12 months + const currentDate = new Date(); + const dateInPast = new Date(); + dateInPast.setFullYear(currentDate.getFullYear() - 1); + + if ({}.hasOwnProperty.call(smart, 'patient')) { + const patientQuery = smart.patient.read(); + const labsQuery = smart.patient.api.fetchAll({ + type: 'Observation', + query: { + code: { + $or: ['http://loinc.org|14647-2', 'http://loinc.org|2093-3', + 'http://loinc.org|2085-9', 'http://loinc.org|8480-6', + 'http://loinc.org|55284-4', 'http://loinc.org|72166-2', + 'http://snomed.info/sct|229819007', + ], + }, + date: `gt${dateInPast.toJSON()}`, + }, + }); + $.when(patientQuery, labsQuery) + .done((patientData, labResults) => { + PatientInfo.firstName = patientData.name[0].given.join(' '); + PatientInfo.lastName = patientData.name[0].family.join(' '); + PatientInfo.gender = patientData.gender; + PatientInfo.dateOfBirth = new Date((patientData.birthDate).replace(/-/g, '/')); + PatientInfo.age = ASCVDRisk + .computeAgeFromBirthDate(new Date(PatientInfo.dateOfBirth.valueOf())); + + const relatedFactors = {}; + relatedFactors.smoker = undefined; + relatedFactors.race = undefined; + relatedFactors.hypertensive = undefined; + relatedFactors.diabetic = undefined; + PatientInfo.relatedFactors = relatedFactors; + + const labsByLoincs = smart.byCodes(labResults, 'code'); + ASCVDRisk.processLabsData(labsByLoincs); + if (ASCVDRisk.areRequiredLabsNotAvailable()) { + let codeText = ''; + + if (ASCVDRisk.hasObservationWithUnsupportedUnits) { + if ({}.hasOwnProperty.call(ASCVDRisk.unsupportedUnitDataPoint, 'code')) { + codeText = ASCVDRisk.unsupportedUnitDataPoint.code.text; + } + + Canadarm.error('Unsupported unit of measure, Observation :', undefined, { + status: ASCVDRisk.unsupportedUnitDataPoint.status, + value: ASCVDRisk.unsupportedUnitDataPoint.valueQuantity.value, + unit: ASCVDRisk.unsupportedUnitDataPoint.valueQuantity.unit, + valueString: ASCVDRisk.unsupportedUnitDataPoint.valueString, + codeText, + }); + } else if (ASCVDRisk.unsupportedObservationStructureDataPoint) { + let logValue = ''; + let logUnits = ''; + if ({}.hasOwnProperty.call(ASCVDRisk.unsupportedObservationStructureDataPoint, 'code')) { + codeText = ASCVDRisk.unsupportedObservationStructureDataPoint.code.text; + } + if ({}.hasOwnProperty.call(ASCVDRisk.unsupportedObservationStructureDataPoint, 'valueQuantity')) { + logValue = ASCVDRisk.unsupportedObservationStructureDataPoint.valueQuantity.value; + logUnits = ASCVDRisk.unsupportedObservationStructureDataPoint.valueQuantity.unit; + } + Canadarm.error('Unsupported Observation structure, Observation :', undefined, { + status: ASCVDRisk.unsupportedObservationStructureDataPoint.status, + value: logValue, + unit: logUnits, + valueString: ASCVDRisk.unsupportedObservationStructureDataPoint.valueString, + codeText, + }); + } + } + ASCVDRisk.ret.resolve(PatientInfo); + }) + .fail((jqXHR) => { + Canadarm.error('Patient or Observations resource failed: ', undefined, { + status: jqXHR.status, + error: jqXHR.statusText, + }); + ASCVDRisk.setDefaultPatient(); + }); + } else { + Canadarm.error('Patient resource failure while loading the application.'); + ASCVDRisk.setDefaultPatient(); + } + }; + ASCVDRisk.onReady = onReady; + + /** + * Handles the FHIR oauth2 sequence and accordingly returns whatever information was stored + * in the patient model. + * @returns {*} - A jQuery Deferred promise for the PatientInfo model + */ + const fetchPatientData = () => { + ASCVDRisk.initializeLogger(); + FHIR.oauth2.ready(ASCVDRisk.onReady, ASCVDRisk.onError); + return ASCVDRisk.ret.promise(); + }; + ASCVDRisk.fetchPatientData = fetchPatientData; + + /** + * Method to calculate age from the provided date of birth considering leapYear. + * @param birthDate - Date of birth in Date Object format + * @returns {number} - Age calculated + */ + const computeAgeFromBirthDate = (birthDate) => { + function isLeapYear(year) { + return new Date(year, 1, 29).getMonth() === 1; + } + + const now = new Date(); + let years = now.getFullYear() - birthDate.getFullYear(); + birthDate.setFullYear(birthDate.getFullYear() + years); + if (birthDate > now) { + years -= 1; + birthDate.setFullYear(birthDate.getFullYear() - 1); + } + const days = (now.getTime() - birthDate.getTime()) / (3600 * 24 * 1000); + return Math.floor(years + (days / (isLeapYear(now.getFullYear()) ? 366 : 365))); + }; + ASCVDRisk.computeAgeFromBirthDate = computeAgeFromBirthDate; + + /** + * Method to calculate birth date from the provided age considering leapYear. + * @param age - Age to calculate a birth date from + * @returns {Date} - Date calculated + */ + const computeBirthDateFromAge = (age) => { + const now = new Date(); + const estBirthYear = now.getFullYear() - age; + const birthMonth = ASCVDRisk.patientInfo.dateOfBirth.getMonth(); + const birthDate = ASCVDRisk.patientInfo.dateOfBirth.getDate(); + const newBirthDate = new Date(estBirthYear, birthMonth, birthDate); + const computedAge = ASCVDRisk.computeAgeFromBirthDate(new Date(newBirthDate.valueOf())); + if (computedAge === age) { + return newBirthDate; + } else if (computedAge < age) { + return new Date(estBirthYear - 1, birthMonth, birthDate); + } + return new Date(estBirthYear + 1, birthMonth, birthDate); + }; + ASCVDRisk.computeBirthDateFromAge = computeBirthDateFromAge; + + /** + * Processes labs fetched. Fetches subsequent available pages until we have + * values for all the labs. + * @param labsByLoinc : function to fetch array of observations given loinc codes. + */ + const processLabsData = (labsByLoincs) => { + ASCVDRisk.hasObservationWithUnsupportedUnits = false; + + PatientInfo.totalCholesterol = ASCVDRisk.getCholesterolValue(labsByLoincs('14647-2', '2093-3')); + PatientInfo.hdl = ASCVDRisk.getCholesterolValue(labsByLoincs('2085-9')); + PatientInfo.systolicBloodPressure = ASCVDRisk.getSystolicBloodPressureValue(labsByLoincs('55284-4')); + PatientInfo.relatedFactors.smoker = ASCVDRisk.getSmokerStatus(labsByLoincs('72166-2', '229819007')); + }; + ASCVDRisk.processLabsData = processLabsData; + + /** + * Fetches smoker status from patient + * @param smokingObservations - Observation results returned for smoking status + * @returns {*} - A default for the patient's smoking status if retrieved + * successfully or left undefined + */ + const getSmokerStatus = (smokingObservations) => { + const data = smokingObservations.sort((a, b) => Date.parse(b.issued) - Date.parse(a.issued)); + const currentSmokerSnomeds = ['449868002', '428041000124106', '428071000124103', + '428061000124105', '77176002']; + const notSmokerSnomeds = ['8517006', '266919005']; + for (let i = 0; i < data.length; i += 1) { + if ((data[i].status.toLowerCase() === 'final' || data[i].status.toLowerCase() === 'amended') && + data[i].valueCodeableConcept && data[i].valueCodeableConcept.coding + && data[i].valueCodeableConcept.coding[0].code) { + if (currentSmokerSnomeds.indexOf(data[i].valueCodeableConcept.coding[0].code) > -1) { + return true; + } else if (notSmokerSnomeds.indexOf(data[i].valueCodeableConcept.coding[0].code) > -1) { + return false; + } + } + } + return undefined; + }; + ASCVDRisk.getSmokerStatus = getSmokerStatus; + + /** + * Fetches current cholesterol into units of mg/dL + * @method getCholesterolValue + * @param {object} cholesterolObservations - Cholesterol array object with + * valueQuantity elements having units and value. + */ + const getCholesterolValue = cholesterolObservations => ( + ASCVDRisk.getFirstValidDataValue(cholesterolObservations, (dataPoint) => { + if (dataPoint.valueQuantity.unit === 'mg/dL') { + return parseFloat(dataPoint.valueQuantity.value); + } else if (dataPoint.valueQuantity.unit === 'mmol/L') { + return parseFloat(dataPoint.valueQuantity.value) / 0.026; + } + return undefined; + })); + ASCVDRisk.getCholesterolValue = getCholesterolValue; + + /** + * Fetches current Systolic Blood Pressure + * @method getSystolicBloodPressureValue + * @param {object} sysBPObservations - sysBloodPressure array object with + * valueQuantity elements having units and value + */ + const getSystolicBloodPressureValue = (sysBPObservations) => { + const formattedObservations = []; + sysBPObservations.forEach((observation) => { + const sysBP = observation.component.find(component => component.code.coding.find(coding => coding.code === '8480-6')); + if (sysBP) { + const newObservation = Object.assign({}, observation); + newObservation.valueQuantity = sysBP.valueQuantity; + formattedObservations.push(newObservation); + } + }); + return ASCVDRisk.getFirstValidDataValue(Object.assign([], formattedObservations), (data) => { + if (data.valueQuantity.unit === 'mm[Hg]' || data.valueQuantity.unit === 'mmHg') { + return parseFloat(data.valueQuantity.value); + } + return undefined; + }); + }; + ASCVDRisk.getSystolicBloodPressureValue = getSystolicBloodPressureValue; + + /** + * Fetches the most recent valid dataPointValue from the observations . + * Validity criteria : + * 1. status : 'final' or 'amended' + * 2. availability of the valueQuantity field having value and units + * 3. units are supported. + * @param observations : Array of observations to be used to find the valid dataPoint + * @param supportedUnitsCriteria : Criteria function supplied to be used for + * every dataPoint. + * @returns dataPointValue : Single observation value which meets the criteria. If + * no dataPointValue is valid then undefined is returned + * to fetch further more results. + */ + const getFirstValidDataValue = (observations, supportedUnitsCriteria) => { + const dataPoints = ASCVDRisk.sortObservationsByTime(observations); + for (let i = 0; i < dataPoints.length; i += 1) { + if ((dataPoints[i].status.toLowerCase() === 'final' || dataPoints[i].status.toLowerCase() === 'amended') && + {}.hasOwnProperty.call(dataPoints[i], 'valueQuantity') && dataPoints[i].valueQuantity.value && + dataPoints[i].valueQuantity.unit) { + const dataPointValue = supportedUnitsCriteria(dataPoints[i]); + if (dataPointValue !== undefined) { + return dataPointValue; + } + + // We set this flag here to process later (once all pages have been scanned + // for a valid dataPoint) to convey to the user about unsupported units + ASCVDRisk.hasObservationWithUnsupportedUnits = true; + ASCVDRisk.unsupportedUnitDataPoint = dataPoints[i]; + } else { + // We collect this information to log in case if the user + // does not have a required unit + ASCVDRisk.unsupportedObservationStructureDataPoint = dataPoints[i]; + } + } + return undefined; + }; + ASCVDRisk.getFirstValidDataValue = getFirstValidDataValue; + + /** + * Sorting function to sort observations based on the time stamp returned. + * Sorting is done to get most recent date first. + * @param labsToSort : Array of observations to sort + * @returns labsToSort : Returns the sorted array. + */ + const sortObservationsByTime = (labs) => { + labs.sort((a, b) => Date.parse(b.effectiveDateTime) - Date.parse(a.effectiveDateTime)); + return labs; + }; + ASCVDRisk.sortObservationsByTime = sortObservationsByTime; + + /** + * Checks if the ASCVDRisk data model has the required labs available. + * @returns {boolean} : Indicating if required labs are available. + */ + const areRequiredLabsNotAvailable = () => { + if (PatientInfo.totalCholesterol === undefined || PatientInfo.hdl === undefined + || PatientInfo.systolicBloodPressure === undefined) { + return true; + } + return false; + }; + ASCVDRisk.areRequiredLabsNotAvailable = areRequiredLabsNotAvailable; + + /** + * Computes the ASCVD Risk Estimate for an individual over the next 10 years. + * @param patientInfo - patientInfo object from ASCVDRisk data model + * @returns {*} Returns the risk score or null if not in the appropriate age range + */ + const computeTenYearScore = (patientInfo) => { + if (patientInfo.age < 40 || patientInfo.age > 79) { return null; } + const lnAge = Math.log(patientInfo.age); + const lnTotalChol = Math.log(patientInfo.totalCholesterol); + const lnHdl = Math.log(patientInfo.hdl); + const trlnsbp = patientInfo.relatedFactors.hypertensive ? + Math.log(parseFloat(patientInfo.systolicBloodPressure)) : 0; + const ntlnsbp = patientInfo.relatedFactors.hypertensive ? + 0 : Math.log(parseFloat(patientInfo.systolicBloodPressure)); + const ageTotalChol = lnAge * lnTotalChol; + const ageHdl = lnAge * lnHdl; + const agetSbp = lnAge * trlnsbp; + const agentSbp = lnAge * ntlnsbp; + const ageSmoke = patientInfo.relatedFactors.smoker ? lnAge : 0; + + const isAA = patientInfo.relatedFactors.race === 'aa'; + const isMale = patientInfo.gender === 'male'; + let s010Ret = 0; + let mnxbRet = 0; + let predictRet = 0; + + const calculateScore = () => { + if (isAA && !isMale) { + s010Ret = 0.95334; + mnxbRet = 86.6081; + predictRet = (17.1141 * lnAge) + (0.9396 * lnTotalChol) + (-18.9196 * lnHdl) + + (4.4748 * ageHdl) + (29.2907 * trlnsbp) + (-6.4321 * agetSbp) + (27.8197 * ntlnsbp) + + (-6.0873 * agentSbp) + (0.6908 * Number(patientInfo.relatedFactors.smoker)) + + (0.8738 * Number(patientInfo.relatedFactors.diabetic)); + } else if (!isAA && !isMale) { + s010Ret = 0.96652; + mnxbRet = -29.1817; + predictRet = (-29.799 * lnAge) + (4.884 * (lnAge ** 2)) + (13.54 * lnTotalChol) + + (-3.114 * ageTotalChol) + (-13.578 * lnHdl) + (3.149 * ageHdl) + (2.019 * trlnsbp) + + (1.957 * ntlnsbp) + (7.574 * Number(patientInfo.relatedFactors.smoker)) + + (-1.665 * ageSmoke) + (0.661 * Number(patientInfo.relatedFactors.diabetic)); + } else if (isAA && isMale) { + s010Ret = 0.89536; + mnxbRet = 19.5425; + predictRet = (2.469 * lnAge) + (0.302 * lnTotalChol) + (-0.307 * lnHdl) + + (1.916 * trlnsbp) + (1.809 * ntlnsbp) + (0.549 * + Number(patientInfo.relatedFactors.smoker)) + + (0.645 * Number(patientInfo.relatedFactors.diabetic)); + } else { + s010Ret = 0.91436; + mnxbRet = 61.1816; + predictRet = (12.344 * lnAge) + (11.853 * lnTotalChol) + (-2.664 * ageTotalChol) + + (-7.99 * lnHdl) + (1.769 * ageHdl) + (1.797 * trlnsbp) + (1.764 * ntlnsbp) + + (7.837 * Number(patientInfo.relatedFactors.smoker)) + (-1.795 * ageSmoke) + + (0.658 * Number(patientInfo.relatedFactors.diabetic)); + } + + const pct = (1 - (s010Ret ** Math.exp(predictRet - mnxbRet))); + return Math.round((pct * 100) * 10) / 10; + }; + return calculateScore(); + }; + ASCVDRisk.computeTenYearScore = computeTenYearScore; + + /** + * Computes the lifetime ASCVD Risk Estimate for an individual. If the individual + * is younger than 20 or older than 59, the lifetime risk cannot be estimated. + * @param patientInfo - patientInfo object from ASCVDRisk data model + * @returns {*} Returns the risk score or null if not in the appropriate age range + */ + const computeLifetimeRisk = (patientInfo) => { + if (patientInfo.age < 20 || patientInfo.age > 59) { return null; } + let ascvdRisk = 0; + const params = { + male: { + major2: 69, + major1: 50, + elevated: 46, + notOptimal: 36, + allOptimal: 5, + }, + female: { + major2: 50, + major1: 39, + elevated: 39, + notOptimal: 27, + allOptimal: 8, + }, + }; + + const major = (patientInfo.totalCholesterol >= 240 ? 1 : 0) + + ((patientInfo.systolicBloodPressure >= 160 ? 1 : 0) + + (patientInfo.relatedFactors.hypertensive ? 1 : 0)) + + (patientInfo.relatedFactors.smoker ? 1 : 0) + + (patientInfo.relatedFactors.diabetic ? 1 : 0); + const elevated = ((((patientInfo.totalCholesterol >= 200 && + patientInfo.totalCholesterol < 240) ? 1 : 0) + + ((patientInfo.systolicBloodPressure >= 140 && + patientInfo.systolicBloodPressure < 160 && + patientInfo.relatedFactors.hypertensive === false) ? 1 : 0)) >= 1 ? 1 : 0) * + (major === 0 ? 1 : 0); + const allOptimal = (((patientInfo.totalCholesterol < 180 ? 1 : 0) + + ((patientInfo.systolicBloodPressure < 120 ? 1 : 0) * + (patientInfo.relatedFactors.hypertensive ? 0 : 1))) === 2 ? 1 : 0) * + (major === 0 ? 1 : 0); + const notOptimal = ((((patientInfo.totalCholesterol >= 180 && + patientInfo.totalCholesterol < 200) ? 1 : 0) + + ((patientInfo.systolicBloodPressure >= 120 && + patientInfo.systolicBloodPressure < 140 && + patientInfo.relatedFactors.hypertensive === false) ? 1 : 0)) * + (elevated === 0 ? 1 : 0) * (major === 0 ? 1 : 0)) >= 1 ? 1 : 0; + + if (major > 1) { ascvdRisk = params[patientInfo.gender].major2; } + if (major === 1) { ascvdRisk = params[patientInfo.gender].major1; } + if (elevated === 1) { ascvdRisk = params[patientInfo.gender].elevated; } + if (notOptimal === 1) { ascvdRisk = params[patientInfo.gender].notOptimal; } + if (allOptimal === 1) { ascvdRisk = params[patientInfo.gender].allOptimal; } + + return ascvdRisk; + }; + ASCVDRisk.computeLifetimeRisk = computeLifetimeRisk; + + /** + * Computes the lowest ASCVD Risk Estimate for an individual over the next + * 10 years, under best possible conditions + * @param patientInfo - patientInfo object from ASCVDRisk data model + * @returns {*} Returns the risk score or null if not in the appropriate age range + */ + const computeLowestTenYear = () => { + const patientInfoCopy = Object.assign({}, ASCVDRisk.patientInfo); + patientInfoCopy.systolicBloodPressure = 90; + patientInfoCopy.totalCholesterol = 130; + patientInfoCopy.hdl = 100; + const relatedFactorsCopy = Object.assign({}, ASCVDRisk.patientInfo.relatedFactors); + relatedFactorsCopy.diabetic = false; + relatedFactorsCopy.smoker = false; + relatedFactorsCopy.hypertensive = false; + patientInfoCopy.relatedFactors = relatedFactorsCopy; + return ASCVDRisk.computeTenYearScore(patientInfoCopy); + }; + ASCVDRisk.computeLowestTenYear = computeLowestTenYear; + + /** + * Computes the lowest ASCVD Risk Estimate for an individual over a lifetime, under best possible + * conditions + * @param patientInfo - patientInfo object from ASCVDRisk data model + * @returns {*} Returns the risk score or null if not in the appropriate age range + */ + const computeLowestLifetime = () => { + const patientInfoCopy = Object.assign({}, ASCVDRisk.patientInfo); + patientInfoCopy.systolicBloodPressure = 90; + patientInfoCopy.totalCholesterol = 130; + patientInfoCopy.hdl = 100; + const relatedFactorsCopy = Object.assign({}, ASCVDRisk.patientInfo.relatedFactors); + relatedFactorsCopy.diabetic = false; + relatedFactorsCopy.smoker = false; + relatedFactorsCopy.hypertensive = false; + patientInfoCopy.relatedFactors = relatedFactorsCopy; + return ASCVDRisk.computeLifetimeRisk(patientInfoCopy); + }; + ASCVDRisk.computeLowestLifetime = computeLowestLifetime; + + /** + * Computes an amount to reduce current risk score by + * certain reductions potentially impacting the score: + * statin - 25% reduction + * sysBP - 30% reduction for every 10 mmHg in Systolic Blood Pressure down to 140 mmHg + * aspirin - 10% reduction + * smoker - 15% reduction + * + * If the current score reduced by the total amount of reductions surpasses the lowest + * possible risk score, the method will only return an amount to reduce to the lowest + * possible risk score. + * + * @param reductions - Array of reductions to indicate which reductions to consider + * @param score - String to indicate which type of risk score to impact + * @returns {*} Returns the amount to reduce the current risk score by + * or null if not in the appropriate age range + */ + const computePotentialRisk = (reductions, score) => { + let computedScore; + let lowestScore; + let reducedTotalScore = 0; + if (score === 'ten') { + computedScore = ASCVDRisk.computeTenYearScore(ASCVDRisk.patientInfo); + lowestScore = ASCVDRisk.computeLowestTenYear(); + } else { + computedScore = ASCVDRisk.computeLifetimeRisk(ASCVDRisk.patientInfo); + lowestScore = ASCVDRisk.computeLowestLifetime(); + } + for (let i = 0; i < reductions.length; i += 1) { + if (reductions[i] === 'statin') { + reducedTotalScore += (computedScore * 0.25); + } else if (reductions[i] === 'sysBP') { + const sysBPCalculation = computedScore - (computedScore * + (0.7 ** ((ASCVDRisk.patientInfo.systolicBloodPressure - 140) / 10))); + reducedTotalScore += sysBPCalculation; + } else if (reductions[i] === 'aspirin') { + reducedTotalScore += (computedScore * 0.1); + } else if (reductions[i] === 'smoker') { + reducedTotalScore += (computedScore * 0.15); + } + } + if (Math.round((computedScore - reducedTotalScore) * 10) / 10 <= lowestScore) { + return Math.round((computedScore - lowestScore) * 10) / 10; + } + return Math.round(reducedTotalScore * 10) / 10; + }; + ASCVDRisk.computePotentialRisk = computePotentialRisk; + + /** + * Validates the provided age value for bounds and availability. + * @param currentVal : Value for age + * @returns {boolean} Indicates if the age value is valid. + */ + const isValidAge = (currentVal) => { + if (!isNaN(currentVal) && currentVal !== undefined && currentVal >= 20 && currentVal <= 79) { + return true; + } + return false; + }; + ASCVDRisk.isValidAge = isValidAge; + + /** + * Validates the provided systolic blood pressure value for bounds and availability. + * @param currentVal : Value for systolic blood pressure + * @returns {boolean} Indicates if the systolic blood pressure value is valid. + */ + const isValidSysBP = (currentVal) => { + if (!isNaN(currentVal) && currentVal !== undefined && currentVal >= 90 && currentVal <= 200) { + return true; + } + return false; + }; + ASCVDRisk.isValidSysBP = isValidSysBP; + + /** + * Validates the provided HDL value for bounds and availability. + * @param currentVal : Value for HDL + * @returns {boolean} Indicates if the HDL value is valid. + */ + const isValidHDL = (currentVal) => { + if (!isNaN(currentVal) && currentVal !== undefined && currentVal >= 20 && currentVal <= 100) { + return true; + } + return false; + }; + ASCVDRisk.isValidHDL = isValidHDL; + + /** + * Validates the provided total cholesterol value for bounds and availability. + * @param currentVal : Value for total cholesterol + * @returns {boolean} Indicates if the total cholesterol value is valid. + */ + const isValidTotalCholesterol = (currentVal) => { + if (!isNaN(currentVal) && currentVal !== undefined && currentVal >= 130 && currentVal <= 320) { + return true; + } + return false; + }; + ASCVDRisk.isValidTotalCholesterol = isValidTotalCholesterol; + + /** + * Checks if the ASCVD data model has sufficient data to compute ASCVD score. + * Checks for : + * 1. Systolic Blood Pressure + * 2. Age + * 3. Total Cholesterol + * 4. HDL + * 5. Hypertensive status + * 6. Race + * 7. Diabetic status + * 8. Smoker status + * 9. Gender + * @returns {boolean} Indicating if ASCVD Estimate can be calculated. + */ + const canCalculateScore = () => { + if (ASCVDRisk.isValidSysBP(ASCVDRisk.patientInfo.systolicBloodPressure) && + ASCVDRisk.isValidAge(ASCVDRisk.patientInfo.age) && + ASCVDRisk.isValidTotalCholesterol(ASCVDRisk.patientInfo.totalCholesterol) && + ASCVDRisk.isValidHDL(ASCVDRisk.patientInfo.hdl) && + ASCVDRisk.patientInfo.relatedFactors.hypertensive !== undefined && + ASCVDRisk.patientInfo.relatedFactors.race !== undefined && + ASCVDRisk.patientInfo.relatedFactors.diabetic !== undefined && + ASCVDRisk.patientInfo.relatedFactors.smoker !== undefined && + ASCVDRisk.patientInfo.gender !== undefined) { + return true; + } + return false; + }; + ASCVDRisk.canCalculateScore = canCalculateScore; + + /** + * Checks for missing user information to calculate a risk score and displays + * an appropriate message containing missing fields + * @returns {*} Message containing missing information to calculate a valid risk score + */ + const missingFields = () => { + const needInput = []; + if (!ASCVDRisk.isValidTotalCholesterol(ASCVDRisk.patientInfo.totalCholesterol)) { + needInput.push('Total cholesterol'); + } + if (ASCVDRisk.patientInfo.relatedFactors.diabetic === undefined) { + needInput.push('Diabetes status'); + } + if (!ASCVDRisk.isValidAge(ASCVDRisk.patientInfo.age)) { + needInput.push('Age'); + } + if (!ASCVDRisk.isValidHDL(ASCVDRisk.patientInfo.hdl)) { + needInput.push('HDL - cholesterol'); + } + if (ASCVDRisk.patientInfo.relatedFactors.smoker === undefined) { + needInput.push('Current smoking status'); + } + if (ASCVDRisk.patientInfo.relatedFactors.race === undefined) { + needInput.push('Race'); + } + if (!ASCVDRisk.isValidSysBP(ASCVDRisk.patientInfo.systolicBloodPressure)) { + needInput.push('Systolic blood pressure'); + } + if (ASCVDRisk.patientInfo.relatedFactors.hypertensive === undefined) { + needInput.push('Hypertension status'); + } + if (ASCVDRisk.patientInfo.gender === undefined) { + needInput.push('Gender'); + } + if (needInput.length === 9) { + return 'All fields required to compute ASCVD risk'; + } else if (needInput.length > 2) { + let retStatement = ''; + for (let i = 0; i < needInput.length; i += 1) { + if (i === needInput.length - 1) { + retStatement += `and ${needInput[i]} are all required to compute ASCVD risk`; + } else { + retStatement += `${needInput[i]}, `; + } + } + return retStatement; + } else if (needInput.length === 2) { + return `${needInput[0]} and ${needInput[1]} are both required to compute ASCVD risk`; + } else if (needInput.length === 1) { + return `${needInput[0]} is required to compute ASCVD risk`; + } else if (needInput.length === 0) { return ''; } + return ''; + }; + ASCVDRisk.missingFields = missingFields; + ASCVDRisk.patientInfo = PatientInfo; + window.ASCVDRisk = ASCVDRisk; +}))(this); + +export default window.ASCVDRisk; diff --git a/app/polyfill.js b/app/polyfill.js new file mode 100644 index 0000000..73a892d --- /dev/null +++ b/app/polyfill.js @@ -0,0 +1,72 @@ +/* eslint-disable */ +// https://tc39.github.io/ecma262/#sec-array.prototype.find +if (!Array.prototype.find) { + Object.defineProperty(Array.prototype, 'find', { + value(predicate) { + // 1. Let O be ? ToObject(this value). + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + + const o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + const len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + const thisArg = arguments[1]; + + // 5. Let k be 0. + let k = 0; + + // 6. Repeat, while k < len + while (k < len) { + // a. Let Pk be ! ToString(k). + // b. Let kValue be ? Get(O, Pk). + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + // d. If testResult is true, return kValue. + const kValue = o[k]; + if (predicate.call(thisArg, kValue, k, o)) { + return kValue; + } + // e. Increase k by 1. + k++; + } + + // 7. Return undefined. + return undefined; + }, + }); +} + +if (typeof Object.assign !== 'function') { + Object.assign = function (target, varArgs) { + // .length of function is 2 + + + if (target == null) { // TypeError if undefined or null + throw new TypeError('Cannot convert undefined or null to object'); + } + + const to = Object(target); + + for (let index = 1; index < arguments.length; index++) { + const nextSource = arguments[index]; + + if (nextSource != null) { // Skip over if undefined or null + for (const nextKey in nextSource) { + // Avoid bugs when hasOwnProperty is shadowed + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + to[nextKey] = nextSource[nextKey]; + } + } + } + } + return to; + }; +} diff --git a/build/css/styles.css b/build/css/styles.css new file mode 100644 index 0000000..204279b --- /dev/null +++ b/build/css/styles.css @@ -0,0 +1 @@ +.banner__container___ZHs7S{width:100%;background-color:#0065a3;height:30px;display:table}.banner__name___SWuPP{font-size:18px}.banner__details___g41gj,.banner__name___SWuPP{display:table-row;font-family:Helvetica;font-weight:700;color:#fff}.banner__details___g41gj{text-align:left;font-size:16px}.banner__age___oqLBl{padding-right:10px}.banner__dob___1mkpV{padding-left:10px;vertical-align:text-bottom;font-size:16px;color:#fff;font-weight:400}.banner__hidden___CjTDQ{display:none}.banner__patient-container___1sDx6{padding:5px 10px}.header__header___CGBNf{height:55px;width:100%;background-color:#f4f4f4;color:#000;font-size:18px;font-family:Helvetica;text-align:center;vertical-align:middle;line-height:55px;-moz-box-shadow:inset 0 -1px #dedfe0;-webkit-box-shadow:inset 0 -1px #dedfe0;box-shadow:inset 0 -1px #dedfe0}.navbar__hidden___ec8v_{display:none}.navbar__container___gDEoQ{width:100%;height:43px;border-bottom:1px solid #dedfe0}.navbar__tab___3MI4X{height:41px;font-family:Helvetica;font-size:14px;text-align:center;line-height:41px}.navbar__tab___3MI4X.navbar__active___iyQq0{color:#0065a3;border-bottom:2px solid #007cc3;cursor:pointer}.navbar__tab___3MI4X.navbar__default___1ASZy{color:#000;cursor:pointer}.navbar__tab___3MI4X.navbar__disabled___fkjPP{cursor:default;opacity:.6}.navbar__tab___3MI4X.navbar__one___1_gWr{width:67px;display:inline-block;margin-left:7px}.navbar__tab___3MI4X.navbar__two___1eUQm{width:98px;display:inline-block}.navbar__tab___3MI4X.navbar__three___13cuC{width:137px;display:inline-block}input[name=nav_tabs]{background:none;border:none;outline:0;cursor:pointer;text-decoration:none}input[name=nav_tabs]:hover{text-decoration:none}@media only screen and (max-width:860px){.navbar__container___gDEoQ{display:block;margin:auto;text-align:center}}.button_form__container___38I26{width:180px;height:100%;display:inline-block;padding-top:40px;text-align:left;vertical-align:top}.button_form__btn___2G-Ff{border-radius:3px;height:30px;width:66px;font-family:Helvetica;font-size:14px}.button_form__left___21IWC{float:left;display:inline-block;padding-right:7px}.button_form__right___SzO8A{display:inline-block}.button_form__btn___2G-Ff.button_form__active___37LzP{background-color:#007cc3;border:1px solid #0065a3;color:#fff}.button_form__btn___2G-Ff.button_form__default___3xSmY{background-color:#dedfe0;border:1px solid #c8cacb;color:#1c1f21}.button_form__prompt___2jCpS{font-size:14px;font-family:Helvetica;font-weight:700;color:#000;padding-bottom:5px;width:110%}.button_form__required___3-DTN:before{color:red;content:"*";padding-right:3px}.input_text_form__container___1CeRx{width:180px;height:100%;display:inline-block;padding-right:110px;padding-top:36px;text-align:left;vertical-align:top}.input_text_form__prompt___14drD{font-size:14px;font-family:Helvetica;font-weight:700;color:#000;padding-bottom:5px;width:190px}.input_text_form__text-entry___3txA5{width:180px;line-height:30px;font-size:18px;height:30px;float:left;border-radius:3px;border:1px solid #dedfe0;padding-left:4px}.input_text_form__required___2xQFR:before{color:red;content:"*";padding-right:3px}.input_text_form__form-error___3t4qF{padding-top:5px;width:100%;outline:0;color:#e50000;font-family:Helvetica;display:inline-block}.input_text_form__hidden___1bMhH{display:none}@media only screen and (max-width:860px){.input_text_form__container___1CeRx{padding-right:0}}.radio_button_form__container___3vUW_{width:180px;height:100%;display:inline-block;padding-right:110px;padding-top:40px;text-align:left;vertical-align:top}.radio_button_form__prompt___1xpMt{font-size:14px;font-family:Helvetica;font-weight:700;color:#000;padding-bottom:5px;width:110%}.radio_button_form__label___2-oKW{font-size:14px;font-family:Helvetica;color:#000;display:block}.radio_button_form__label___2-oKW.radio_button_form__middle___W-SXK{padding-top:8px;padding-bottom:8px}input[type=radio]{width:14px;height:14px;margin-right:8px}input[type=radio]::-ms-check{color:#3b99fc;background-color:none}.radio_button_form__required___1woVI:before{color:red;content:"*";padding-right:3px}@media only screen and (max-width:860px){.radio_button_form__container___3vUW_{padding-right:0}}.send_form__container___2zxLJ{display:inline-block;text-align:left;vertical-align:top;padding-top:40px;padding-bottom:40px}.send_form__btn___1sdL2{border-radius:3px;height:50px;width:210px;font-family:Helvetica;font-size:14px}.send_form__btn___1sdL2.send_form__disabled___3hjOb{background-color:#e9f5e0;border:1px solid #bce1a3;color:#9b9fa1}.send_form__btn___1sdL2.send_form__active___2igXD{background-color:#8ccc63;border:1px solid #78c346;cursor:pointer}.send_form__left___CUl49{float:left;display:inline-block;padding-right:13px;padding-bottom:13px}.send_form__right___2qrw3{float:left;width:calc(100% - 11px);width:-webkit-calc(100% - 11px);height:-moz-calc(100% - 11px);font-size:16px;font-family:Helvetica;line-height:18px;color:#868a8c;display:inline-block}.send_form__required___NcjQq:before{color:red;content:"*";padding-right:3px}.send_form__right-container___3pJc5{float:left;display:inline-block;max-width:537px}.send_form__left-asterisk___2j0L0{float:left;display:inline-block}.index__container___RgiEz{display:block;margin:auto;width:100%;text-align:center}.index__inner___2Ot8j{margin:0 auto;display:inline-block;margin-left:5%;margin-right:5%}.index__column___1zkdU{width:180px;display:inline-block;position:relative;padding-right:110px;text-align:left;vertical-align:top}.index__grouped-column___3QMSz{display:inline-block}.index__no-right-padding___8cAb1{padding-right:0}.index__row___3kz49{-ms-box-orient:horizontal;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-moz-flex;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;margin-right:0}.index__row___3kz49.index__padding___2GxAy{padding-top:40px}@media screen and (max-width:860px){.index__grouped-column___3QMSz{width:180px;display:block;margin:0 auto}.index__column___1zkdU{padding-right:0}.index__row___3kz49{display:block;margin:0 auto;width:230px}}.graph_bar__container___3CbYj{width:100px;display:inline-block;height:100px}.graph_bar__percent___tpyHM{color:#2d3539;font-size:16px;font-family:Helvetica;text-align:center;padding-bottom:6px;height:16px;width:100px;position:absolute}.graph_bar__bar___1nL8o{width:100px;position:absolute;bottom:0;border:none}@media only screen and (max-width:860px){.graph_bar__bar___1nL8o,.graph_bar__container___3CbYj,.graph_bar__percent___tpyHM{width:80px}}@media only screen and (max-width:700px){.graph_bar__container___3CbYj{width:20px}.graph_bar__percent___tpyHM{width:30px}.graph_bar__bar___1nL8o{width:20px}}.graph__container___25mSN{padding-top:45px;width:100%}.graph__graph-border___1O4eV{height:250px;width:600px;border-left:1px solid #c1c1c1;border-bottom:1px solid #c1c1c1;display:inline-block;position:relative;float:left}.graph__ten-year-group___WV2zA{padding-left:64px;width:200px;display:inline-block}.graph__lifetime-group___123AL{padding-left:68px;width:200px;display:inline-block}.graph__bar-container___1T6_3{position:absolute;bottom:0;width:100%}.graph__zero-increment___2nGaa{height:12px}.graph__last-increment___LVSkr{height:12px;padding-bottom:35px}.graph__middle-increments___3Xljq{height:12px;padding-bottom:38px}.graph__first-increment___2ZdED{height:12px;padding-bottom:32px}.graph__yaxis___2TCv5{padding-right:10px;color:#868a8c;height:250px;position:relative;text-align:right}.graph__label___3DY0f,.graph__yaxis___2TCv5{font-size:12px;font-family:Helvetica;float:left}.graph__label___3DY0f{color:#2d3539;height:12px;padding-bottom:160px;padding-right:70px;text-align:left;white-space:nowrap;position:absolute;margin:0;transform:rotate(270deg);transform-origin:right,top;-ms-transform:rotate(-90deg);-ms-transform-origin:right,top;-webkit-transform:rotate(-90deg);-webkit-transform-origin:right,top}.graph__inner___lv3m-{margin:0 auto;display:inline-block;margin-right:10%}.graph__bar-label___3nQ1w{width:200px;position:absolute;padding-top:12px}.graph__bar-label___3nQ1w,.graph__graph-title___1fbCT{color:#2d3539;font-size:16px;font-family:Helvetica;text-align:center}.graph__graph-title___1fbCT{width:100%;font-weight:700;margin-left:10%;padding-bottom:44px}.graph__legend-container___3eNUv{display:inline-block;padding-left:30px;padding-top:75px;position:absolute;text-align:left}.graph__legend-bar___CIvxn{width:80px;height:10px}.graph__legend-label___am4lX{width:90px;height:16px;padding-top:5px;padding-bottom:20px;font-size:12px;font-family:Helvetica}.graph__hidden___3YcmT{display:none;height:0}@media only screen and (max-width:860px){.graph__graph-border___1O4eV{height:250px;width:520px}.graph__ten-year-group___WV2zA{width:160px;padding-left:44px}.graph__lifetime-group___123AL{width:160px;padding-left:70px}.graph__graph-title___1fbCT{width:580px}.graph__bar-label___3nQ1w{width:160px}.graph__legend-bar___CIvxn,.graph__legend-label___am4lX{width:50px}.graph__bar-container___1T6_3{width:100%}}@media only screen and (max-width:700px){.graph__graph-border___1O4eV{height:250px;width:155px}.graph__graph-title___1fbCT{width:165px;margin-left:35px}.graph__bar-label___3nQ1w{width:60px;margin-left:-10px}.graph__ten-year-group___WV2zA{width:40px;padding-left:15px}.graph__lifetime-group___123AL{width:40px;padding-left:40px}.graph__legend-bar___CIvxn{width:30px}.graph__legend-label___am4lX{width:45px}.graph__bar-container___1T6_3{width:100%}}.risk_action__container___10q5l{width:350px;text-align:left}.risk_action__prompt___1enqF{color:#2d3539;font-size:16px;font-family:Helvetica;line-height:19px}.risk_action__hidden___1ViLA{display:none}.risk_action__option___34gA9{padding-top:15px;display:block;color:#2d3539;font-size:14px;font-family:Helvetica}input[type=checkbox]{margin-right:7px}input[type=checkbox]::-ms-check{color:#3b99fc}.risk_action__input-area___1hijg{padding-left:10px}@media only screen and (max-width:860px){.risk_action__container___10q5l{width:292px}.risk_action__input-area___1hijg{padding-left:0}}@media only screen and (max-width:700px){.risk_action__container___10q5l{width:160px}.risk_action__input-area___1hijg{padding-left:5px}}.simulated_risk__container___hwplB{padding-top:101px;padding-bottom:45px}.simulated_risk__title___32AvW{width:100%;color:#2d3539;font-size:16px;font-family:Helvetica;font-weight:700;text-align:center;padding-bottom:38px}.simulated_risk__left___3rEEE{display:inline-block;width:50%;float:left}.simulated_risk__right___-nez9{display:inline-block;width:50%;float:right;padding-top:12px}.simulated_risk__bar-total___1DZyO{width:100px;height:472px;margin-top:12px;margin-right:40px;margin-bottom:45px;display:inline-block}.simulated_risk__partial-border___3wy36{border:2px solid #ffb166;border-bottom:none}.simulated_risk__full-border___1-j0y{border:2px solid #ffb166}.simulated_risk__bar-lowest-risk___2_LQ6{background-color:#ff9733;width:100%}.simulated_risk__bar-potential-risk___3Bj9D{background-color:#fff;width:100%}.simulated_risk__bar-current-risk___1yLw-{background:repeating-linear-gradient(135deg,#ffb166,#fff 1px,#fff 0,#ffb166 2px,#ffb166 13px);width:100%}.simulated_risk__bar-labels___eNdPU{width:115px;height:472px;margin-right:11px;margin-bottom:45px;float:left;text-align:right;font-size:12px;font-family:Helvetica}.simulated_risk__float-right___2zGhN{float:right}.simulated_risk__last-increment___1U16r{padding-top:6px}.simulated_risk__hidden___1gYNx{font-size:0}.simulated_risk__show___cE3Xl{font-size:12px}.simulated_risk__remove___1oeUq{display:none}@media only screen and (max-width:860px){.simulated_risk__bar-total___1DZyO{width:80px}}@media only screen and (max-width:700px){.simulated_risk__bar-total___1DZyO{width:40px}.simulated_risk__bar-labels___eNdPU{width:50px}}.index__container___2dddc{width:100%;display:block;margin:auto;text-align:center}.index__divide___1QgKu{width:80%;height:1px;padding-top:50px;padding-bottom:50px;background-color:#c1c1c1;position:absolute;left:0;right:0;margin:auto;background-clip:content-box}.detail_box__container___3zdQ5{width:100%;background-color:#fff;padding-top:45px}.detail_box__header___B66Dm{width:100%;height:40px;border:1px solid #e2e3e3}.detail_box__title___2Il7t{padding:11px 0 12px;color:#007cc3;font-size:14px;font-family:Helvetica;display:inline-block}.detail_box__body___iNiUd{width:100%;border:1px solid #e2e3e3;border-top:none}.detail_box__description___3K4yj{color:#505456;font-size:14px;font-family:Helvetica;padding:16px 10px 20px 11px}.detail_box__arrow-right___12yAh{width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:11px solid #007cc3;display:inline-block;padding-right:8px;margin-left:11px}.detail_box__arrow-down___1y-tV{width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-top:11px solid #007cc3;display:inline-block;margin-left:11px;margin-right:8px}.detail_box__collapsed___3hosd{display:none}input[name=dropdown]{cursor:pointer}.index__container___3yKbS{width:90%;display:block;margin:auto}.index__hidden___3yUCu{display:none}.index__show___2EZc5{display:block} \ No newline at end of file diff --git a/build/js/bundle.js b/build/js/bundle.js new file mode 100644 index 0000000..09d9c56 --- /dev/null +++ b/build/js/bundle.js @@ -0,0 +1,35 @@ +!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),o=e[t[0]];return function(e,t,r){o.apply(this,[e,t,r].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var r=n(1),i=o(r),a=n(32),s=o(a),u=n(178),l=o(u),c=n(179),p=o(c);n(232),p.default.fetchPatientData().then(function(){s.default.render(i.default.createElement(l.default,null),document.getElementById("container"))})},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){(function(t){"use strict";var o=n(4),r=n(5),i=n(18),a=n(21),s=n(22),u=n(24),l=n(9),c=n(29),p=n(30),d=n(31),f=n(11),h=l.createElement,m=l.createFactory,v=l.cloneElement;if("production"!==t.env.NODE_ENV){var g=n(25);h=g.createElement,m=g.createFactory,v=g.cloneElement}var y=o;if("production"!==t.env.NODE_ENV){var b=!1;y=function(){return"production"!==t.env.NODE_ENV?f(b,"React.__spread is deprecated and should not be used. Use Object.assign directly or another helper function with similar semantics. You may be seeing this warning due to your compiler. See https://fb.me/react-spread-deprecation for more details."):void 0,b=!0,o.apply(null,arguments)}}var _={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:d},Component:i,PureComponent:a,createElement:h,cloneElement:v,isValidElement:l.isValidElement,PropTypes:c,createClass:s.createClass,createFactory:m,createMixin:function(e){return e},DOM:u,version:p,__spread:y};e.exports=_}).call(t,n(3))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function r(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(p===clearTimeout)return clearTimeout(e);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){m&&f&&(m=!1,f.length?h=f.concat(h):v=-1,h.length&&s())}function s(){if(!m){var e=r(a);m=!0;for(var t=h.length;t;){for(f=h,h=[];++v1)for(var n=1;n1){for(var _=Array(b),E=0;E1){for(var b=Array(y),_=0;_1?t-1:0),o=1;o2?o-2:0),i=2;i1?s-1:0),l=1;l.")}return t}function i(e,n){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var o=m.uniqueKey||(m.uniqueKey={}),i=r(n);if(!o[i]){o[i]=!0;var a="";e&&e._owner&&e._owner!==u.current&&(a=" It was passed a child from "+e._owner.getName()+"."),"production"!==t.env.NODE_ENV?h(!1,'Each child in an array or iterator should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',i,a,l.getCurrentStackAddendum(e)):void 0}}}function a(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n>",T={array:a("array"),bool:a("boolean"),func:a("function"),number:a("number"),object:a("object"),string:a("string"),symbol:a("symbol"),any:s(),arrayOf:u,element:l(),instanceOf:c,node:h(),objectOf:d,oneOf:p,oneOfType:f,shape:m};r.prototype=Error.prototype,e.exports=T}).call(t,n(3))},function(e,t){"use strict";e.exports="15.4.2"},function(e,t,n){(function(t){"use strict";function o(e){return i.isValidElement(e)?void 0:"production"!==t.env.NODE_ENV?a(!1,"React.Children.only expected to receive a single React element child."):r("143"),e}var r=n(7),i=n(9),a=n(8);e.exports=o}).call(t,n(3))},function(e,t,n){"use strict";e.exports=n(33)},function(e,t,n){(function(t){"use strict";var o=n(34),r=n(38),i=n(166),a=n(59),s=n(56),u=n(171),l=n(172),c=n(173),p=n(174),d=n(11);r.inject();var f={findDOMNode:l,render:i.render,unmountComponentAtNode:i.unmountComponentAtNode,version:u,unstable_batchedUpdates:s.batchedUpdates,unstable_renderSubtreeIntoContainer:p};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ComponentTree:{getClosestInstanceFromNode:o.getClosestInstanceFromNode,getNodeFromInstance:function(e){return e._renderedComponent&&(e=c(e)),e?o.getNodeFromInstance(e):null}},Mount:i,Reconciler:a}),"production"!==t.env.NODE_ENV){var h=n(48);if(h.canUseDOM&&window.top===window.self){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)){var m=window.location.protocol.indexOf("http")===-1&&navigator.userAgent.indexOf("Firefox")===-1;console.debug("Download the React DevTools "+(m?"and use an HTTP server (instead of a file: URL) ":"")+"for a better development experience: https://fb.me/react-devtools")}var v=function(){};"production"!==t.env.NODE_ENV?d((v.name||v.toString()).indexOf("testFn")!==-1,"It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster. See https://fb.me/react-minification for more details."):void 0;var g=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?d(!g,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var y=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.trim],b=0;b8&&E<=11),w=32,x=String.fromCharCode(w),O={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:["topBlur","topCompositionEnd","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:["topBlur","topCompositionStart","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:["topBlur","topCompositionUpdate","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]}},D=!1,T=null,k={eventTypes:O,extractEvents:function(e,t,n,o){return[l(e,t,n,o),d(e,t,n,o)]}};e.exports=k},function(e,t,n){(function(t){"use strict";function o(e,t,n){var o=t.dispatchConfig.phasedRegistrationNames[n];return y(e,o)}function r(e,n,r){"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?g(e,"Dispatching inst must not be null"):void 0);var i=o(e,r,n);i&&(r._dispatchListeners=m(r._dispatchListeners,i),r._dispatchInstances=m(r._dispatchInstances,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.traverseTwoPhase(e._targetInst,r,e)}function a(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst,n=t?h.getParentInstance(t):null;h.traverseTwoPhase(n,r,e)}}function s(e,t,n){if(n&&n.dispatchConfig.registrationName){var o=n.dispatchConfig.registrationName,r=y(e,o);r&&(n._dispatchListeners=m(n._dispatchListeners,r),n._dispatchInstances=m(n._dispatchInstances,e))}}function u(e){e&&e.dispatchConfig.registrationName&&s(e._targetInst,null,e)}function l(e){v(e,i)}function c(e){v(e,a)}function p(e,t,n,o){h.traverseEnterLeave(n,o,s,e,t)}function d(e){v(e,u)}var f=n(42),h=n(44),m=n(46),v=n(47),g=n(11),y=f.getListener,b={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:c,accumulateDirectDispatches:d,accumulateEnterLeaveDispatches:p};e.exports=b}).call(t,n(3))},function(e,t,n){(function(t){"use strict";function o(e){return"button"===e||"input"===e||"select"===e||"textarea"===e}function r(e,t,n){switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":return!(!n.disabled||!o(t));default:return!1}}var i=n(35),a=n(43),s=n(44),u=n(45),l=n(46),c=n(47),p=n(8),d={},f=null,h=function(e,t){e&&(s.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},m=function(e){return h(e,!0)},v=function(e){return h(e,!1)},g=function(e){return"."+e._rootNodeID},y={injection:{injectEventPluginOrder:a.injectEventPluginOrder,injectEventPluginsByName:a.injectEventPluginsByName},putListener:function(e,n,o){"function"!=typeof o?"production"!==t.env.NODE_ENV?p(!1,"Expected %s listener to be a function, instead got type %s",n,typeof o):i("94",n,typeof o):void 0;var r=g(e),s=d[n]||(d[n]={});s[r]=o;var u=a.registrationNameModules[n];u&&u.didPutListener&&u.didPutListener(e,n,o)},getListener:function(e,t){var n=d[t];if(r(t,e._currentElement.type,e._currentElement.props))return null;var o=g(e);return n&&n[o]},deleteListener:function(e,t){var n=a.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var o=d[t];if(o){var r=g(e);delete o[r]}},deleteAllListeners:function(e){var t=g(e);for(var n in d)if(d.hasOwnProperty(n)&&d[n][t]){var o=a.registrationNameModules[n];o&&o.willDeleteListener&&o.willDeleteListener(e,n),delete d[n][t]}},extractEvents:function(e,t,n,o){for(var r,i=a.plugins,s=0;s-1?void 0:"production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a("96",e),!c.plugins[o]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a("97",e),c.plugins[o]=n;var i=n.eventTypes;for(var p in i)r(i[p],n,p)?void 0:"production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",p,e):a("98",p,e)}}}function r(e,n,o){c.eventNameDispatchConfigs.hasOwnProperty(o)?"production"!==t.env.NODE_ENV?s(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",o):a("99",o):void 0,c.eventNameDispatchConfigs[o]=e;var r=e.phasedRegistrationNames;if(r){for(var u in r)if(r.hasOwnProperty(u)){var l=r[u];i(l,n,o)}return!0}return!!e.registrationName&&(i(e.registrationName,n,o),!0)}function i(e,n,o){if(c.registrationNameModules[e]?"production"!==t.env.NODE_ENV?s(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a("100",e):void 0,c.registrationNameModules[e]=n,c.registrationNameDependencies[e]=n.eventTypes[o].dependencies,"production"!==t.env.NODE_ENV){var r=e.toLowerCase();c.possibleRegistrationNames[r]=e,"onDoubleClick"===e&&(c.possibleRegistrationNames.ondblclick=e)}}var a=n(35),s=n(8),u=null,l={},c={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:"production"!==t.env.NODE_ENV?{}:null,injectEventPluginOrder:function(e){u?"production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a("101"):void 0,u=Array.prototype.slice.call(e),o()},injectEventPluginsByName:function(e){var n=!1;for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];l.hasOwnProperty(r)&&l[r]===i||(l[r]?"production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",r):a("102",r):void 0,l[r]=i,n=!0)}n&&o()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return c.registrationNameModules[t.registrationName]||null;if(void 0!==t.phasedRegistrationNames){var n=t.phasedRegistrationNames;for(var o in n)if(n.hasOwnProperty(o)){var r=c.registrationNameModules[n[o]];if(r)return r}}return null},_resetEventPlugins:function(){u=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];c.plugins.length=0;var n=c.eventNameDispatchConfigs;for(var o in n)n.hasOwnProperty(o)&&delete n[o];var r=c.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i];if("production"!==t.env.NODE_ENV){var a=c.possibleRegistrationNames;for(var s in a)a.hasOwnProperty(s)&&delete a[s]}}};e.exports=c}).call(t,n(3))},function(e,t,n){(function(t){"use strict";function o(e){return"topMouseUp"===e||"topTouchEnd"===e||"topTouchCancel"===e}function r(e){return"topMouseMove"===e||"topTouchMove"===e}function i(e){return"topMouseDown"===e||"topTouchStart"===e}function a(e,t,n,o){var r=e.type||"unknown-event";e.currentTarget=_.getNodeFromInstance(o),t?v.invokeGuardedCallbackWithCatch(r,n,e):v.invokeGuardedCallback(r,n,e),e.currentTarget=null}function s(e,n){var o=e._dispatchListeners,r=e._dispatchInstances;if("production"!==t.env.NODE_ENV&&h(e),Array.isArray(o))for(var i=0;i1?1-t:void 0;return this._fallbackText=r.slice(e,s),this._fallbackText}}),i.addPoolingTo(o),e.exports=o},[233,35],function(e,t,n){"use strict";function o(){return!i&&r.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var r=n(48),i=null;e.exports=o},function(e,t,n){"use strict";function o(e,t,n,o){return r.call(this,e,t,n,o)}var r=n(53),i={data:null};r.augmentClass(o,i),e.exports=o},function(e,t,n){(function(t){"use strict";function o(e,n,o,r){"production"!==t.env.NODE_ENV&&(delete this.nativeEvent,delete this.preventDefault,delete this.stopPropagation),this.dispatchConfig=e,this._targetInst=n,this.nativeEvent=o;var i=this.constructor.Interface;for(var a in i)if(i.hasOwnProperty(a)){"production"!==t.env.NODE_ENV&&delete this[a];var u=i[a];u?this[a]=u(o):"target"===a?this.target=r:this[a]=o[a]}var l=null!=o.defaultPrevented?o.defaultPrevented:o.returnValue===!1;return l?this.isDefaultPrevented=s.thatReturnsTrue:this.isDefaultPrevented=s.thatReturnsFalse,this.isPropagationStopped=s.thatReturnsFalse,this}function r(e,n){function o(e){var t=a?"setting the method":"setting the property";return i(t,"This is effectively a no-op"),e}function r(){var e=a?"accessing the method":"accessing the property",t=a?"This is a no-op function":"This is set to null";return i(e,t),n}function i(n,o){var r=!1;"production"!==t.env.NODE_ENV?u(r,"This synthetic event is reused for performance reasons. If you're seeing this, you're %s `%s` on a released/nullified synthetic event. %s. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.",n,e,o):void 0}var a="function"==typeof n;return{configurable:!0,set:o,get:r}}var i=n(4),a=n(50),s=n(12),u=n(11),l=!1,c="function"==typeof Proxy,p=["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"],d={type:null,target:null,currentTarget:s.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=s.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=s.thatReturnsTrue)},persist:function(){this.isPersistent=s.thatReturnsTrue},isPersistent:s.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var n in e)"production"!==t.env.NODE_ENV?Object.defineProperty(this,n,r(n,e[n])):this[n]=null;for(var o=0;o8));var R=!1;_.canUseDOM&&(R=x("input")&&(!document.documentMode||document.documentMode>11));var A={get:function(){return S.get.call(this)},set:function(e){P=""+e,S.set.call(this,e)}},M={eventTypes:D,extractEvents:function(e,t,n,r){var i,a,s=t?E.getNodeFromInstance(t):window;if(o(s)?I?i=u:a=l:O(s)?R?i=f:(i=m,a=h):v(s)&&(i=g),i){var c=i(e,t);if(c){var p=C.getPooled(D.change,c,n,r);return p.type="change",b.accumulateTwoPhaseDispatches(p),p}}a&&a(e,s,t)}};e.exports=M},function(e,t,n){(function(t){"use strict";function o(){T.ReactReconcileTransaction&&N?void 0:"production"!==t.env.NODE_ENV?g(!1,"ReactUpdates: must inject a reconcile transaction class and batching strategy"):c("123")}function r(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=d.getPooled(),this.reconcileTransaction=T.ReactReconcileTransaction.getPooled(!0)}function i(e,t,n,r,i,a){return o(),N.batchedUpdates(e,t,n,r,i,a)}function a(e,t){return e._mountOrder-t._mountOrder}function s(e){var n=e.dirtyComponentsLength;n!==y.length?"production"!==t.env.NODE_ENV?g(!1,"Expected flush transaction's stored dirty-components length (%s) to match dirty-components array length (%s).",n,y.length):c("124",n,y.length):void 0,y.sort(a),b++;for(var o=0;o1&&void 0!==arguments[1]&&arguments[1];n&&0===e||e||("production"!==t.env.NODE_ENV?E(!1,"ReactDebugTool: debugID may not be empty."):void 0)}function l(e,n){0!==D&&(R&&!A&&("production"!==t.env.NODE_ENV?E(!1,"There is an internal error in the React performance measurement code. Did not expect %s timer to start while %s timer is still in progress for %s instance.",n,R||"no",e===P?"the same":"another"):void 0,A=!0),S=_(),I=0,P=e,R=n)}function c(e,n){0!==D&&(R===n||A||("production"!==t.env.NODE_ENV?E(!1,"There is an internal error in the React performance measurement code. We did not expect %s timer to stop while %s timer is still in progress for %s instance. Please report this as a bug in React.",n,R||"no",e===P?"the same":"another"):void 0,A=!0),w&&T.push({timerType:n,instanceID:e,duration:_()-S-I}),S=0,I=0,P=null,R=null)}function p(){var e={startTime:S,nestedFlushStartTime:_(),debugID:P,timerType:R};O.push(e),S=0,I=0,P=null,R=null}function d(){var e=O.pop(),t=e.startTime,n=e.nestedFlushStartTime,o=e.debugID,r=e.timerType,i=_()-n;S=t,I+=i,P=o,R=r}function f(e){if(!w||!V)return!1;var t=y.getElement(e);if(null==t||"object"!=typeof t)return!1;var n="string"==typeof t.type;return!n}function h(e,t){if(f(e)){var n=e+"::"+t;M=_(),performance.mark(n)}}function m(e,t){if(f(e)){var n=e+"::"+t,o=y.getDisplayName(e)||"Unknown",r=_();if(r-M>.1){var i=o+" ["+t+"]";performance.measure(i,n)}performance.clearMarks(n),performance.clearMeasures(i)}}var v=n(64),g=n(65),y=n(26),b=n(48),_=n(66),E=n(11),N=[],C={},w=!1,x=[],O=[],D=0,T=[],k=0,P=null,S=0,I=0,R=null,A=!1,M=0,V="undefined"!=typeof performance&&"function"==typeof performance.mark&&"function"==typeof performance.clearMarks&&"function"==typeof performance.measure&&"function"==typeof performance.clearMeasures,j={addHook:function(e){N.push(e)},removeHook:function(e){for(var t=0;t]/,u=n(84),l=u(function(e,t){if(e.namespaceURI!==i.svg||"innerHTML"in e)e.innerHTML=t;else{o=o||document.createElement("div"),o.innerHTML=""+t+"";for(var n=o.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(r.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),c=null}e.exports=l},function(e,t){"use strict";var n=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,o,r){MSApp.execUnsafeLocalFunction(function(){return e(t,n,o,r)})}:e};e.exports=n},function(e,t,n){"use strict";var o=n(48),r=n(86),i=n(83),a=function(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t};o.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){return 3===e.nodeType?void(e.nodeValue=t):void i(e,r(t))})),e.exports=a},function(e,t){"use strict";function n(e){var t=""+e,n=r.exec(t);if(!n)return t;var o,i="",a=0,s=0;for(a=n.index;a]/;e.exports=o},function(e,t,n){(function(t){"use strict";var o=n(35),r=n(81),i=n(48),a=n(88),s=n(12),u=n(8),l={dangerouslyReplaceNodeWithMarkup:function(e,n){if(i.canUseDOM?void 0:"production"!==t.env.NODE_ENV?u(!1,"dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering."):o("56"),n?void 0:"production"!==t.env.NODE_ENV?u(!1,"dangerouslyReplaceNodeWithMarkup(...): Missing markup."):o("57"),"HTML"===e.nodeName?"production"!==t.env.NODE_ENV?u(!1,"dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):o("58"):void 0,"string"==typeof n){var l=a(n,s)[0];e.parentNode.replaceChild(l,e)}else r.replaceChildWithTree(e,n)}};e.exports=l}).call(t,n(3))},function(e,t,n){(function(t){"use strict";function o(e){var t=e.match(c);return t&&t[1].toLowerCase()}function r(e,n){var r=l;l?void 0:"production"!==t.env.NODE_ENV?u(!1,"createNodesFromMarkup dummy not initialized"):u(!1);var i=o(e),c=i&&s(i);if(c){r.innerHTML=c[1]+e+c[2];for(var p=c[0];p--;)r=r.lastChild}else r.innerHTML=e;var d=r.getElementsByTagName("script");d.length&&(n?void 0:"production"!==t.env.NODE_ENV?u(!1,"createNodesFromMarkup(...): Unexpected + + + + + + + diff --git a/index.jsx b/index.jsx new file mode 100644 index 0000000..21e7b08 --- /dev/null +++ b/index.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './components/App/app'; +import ASCVDRisk from './app/load_fhir_data'; +import './app/polyfill'; + +ASCVDRisk.fetchPatientData().then( + () => { + ReactDOM.render(, document.getElementById('container')); + }, +); diff --git a/launch.html b/launch.html new file mode 100644 index 0000000..83a5b63 --- /dev/null +++ b/launch.html @@ -0,0 +1,18 @@ + + + + + + + SMART ASCVD Risk App + + + + + + diff --git a/lib/canadarm.min.js b/lib/canadarm.min.js new file mode 100644 index 0000000..a1f0fcb --- /dev/null +++ b/lib/canadarm.min.js @@ -0,0 +1,2 @@ +!function(a,b){function c(a){return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function d(a){var b,c=a||{};if(c.onError!==!1&&q.setUpOnErrorHandler(),c.wrapEvents!==!1&&q.setUpEventListening(),c.appenders)for(b=0;b=1?e[1]:q.constant.UNKNOWN_LOG,lineNumber:e.length>=1?e[2]:q.constant.UNKNOWN_LOG,columnNumber:e.length>=1?e[3]:q.constant.UNKNOWN_LOG}}function h(a){return 10>a?"0"+a:a}var i,j,k,l,m=d?d.stack:(new Error).stack||null,n=q.constant.UNKNOWN_LOG,o=e||d.message||q.constant.UNKNOWN_LOG,p=new Date,r=a.location.href,s=q.constant.UNKNOWN_LOG,t=q.constant.UNKNOWN_LOG,u=a.navigator.language||q.constant.UNKNOWN_LOG,v=a.document.characterSet||a.document.charset||a.document.defaultCharset||q.constant.UNKNOWN_LOG,w=/(http\:\/\/.*\/.*\.js)\:(\d+)\:(\d+)(.*)$/;if(l=p.toISOString?p.toISOString():function(){return p.getUTCFullYear()+"-"+h(p.getUTCMonth()+1)+"-"+h(p.getUTCDate())+"T"+h(p.getUTCHours())+":"+h(p.getUTCMinutes())+":"+h(p.getUTCSeconds())+"."+(p.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}(),d===b||null===d||null===d.stack)if("function"==typeof a.document.getElementsByTagName){var x=a.document.getElementsByTagName("script");n=(a.document.currentScript||x[x.length-1]).src}else n=q.constant.UNKNOWN_LOG;else k=g(m),n=k.url,s=k.lineNumber,t=k.columnNumber;i={characterSet:v,columnNumber:t,language:u,lineNumber:s,logDate:l,msg:"["+c+"]: "+o,pageURL:r,stack:m||q.constant.UNKNOWN_LOG,type:"jserror",scriptURL:n};for(j in f)f.hasOwnProperty(j)&&null!==f[j]&&f[j]!==b&&(i[j]=f[j]);return i}function k(a){return function(b){var c,d=[],e=new Image;for(c in b)b.hasOwnProperty(c)&&d.push(c+"="+q.utils.fixedEncodeURIComponent(b[c]+"\n"));e.src=a+"?"+d.join("&")}}function l(b){var c,d="";if(console)if(a.attachEvent){for(c in b)b.hasOwnProperty(c)&&(d+=c+"="+b[c]+"\n");console.error(d)}else"undefined"!=typeof b.msg?console.error(b.msg,b):console.error(b)}function m(a,c,d){if(a&&a._wrapper)return a._wrapper;var e=function(){try{return a.apply(c||this,arguments)}catch(e){q.error(e.message,e,b,d)}};return a._wrapper=e,e}function n(a,b,c,d,e){var f;return u&&"function"==typeof u&&(f=u.apply(this,arguments)),q.fatal(a,e,{url:b,lineNumber:c,columnNumber:d}),f}function o(){a.onerror=n}function p(){var c,d,e=[];a.EventTarget?(c=a.EventTarget.prototype.addEventListener,d=a.EventTarget.prototype.removeEventListener,a.EventTarget.prototype.addEventListener=function(a,b,d){return c.call(this,a,q.watch(b),d)},a.EventTarget.prototype.removeEventListener=function(a,b,c){return d.call(this,a,q.watch(b),c)}):a.Element&&a.Element.prototype&&a.Element.prototype.attachEvent&&a.Element.prototype.addEventListener===b&&(Event.prototype.preventDefault||(Event.prototype.preventDefault=function(){this.returnValue=!1}),Event.prototype.stopPropagation||(Event.prototype.stopPropagation=function(){this.cancelBubble=!0}),Element.prototype.addEventListener||(c=function(a,b){var c=this,d=function(a){a.target=a.srcElement,a.currentTarget=c,b.handleEvent?b.handleEvent(a):b.call(c,a)};"DOMContentLoaded"!==a&&(this.attachEvent("on"+a,q.watch(d)),e.push({object:this,type:a,listener:b,wrapper:d}))},d=function(a,b){for(var c,d=0;d>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);e>c;){if(c in d&&d[c]===a)return c;c++}return-1}),q.utils.fixedEncodeURIComponent=c;var s=[],t=[];q.debug=i(q.level.DEBUG),q.info=i(q.level.INFO),q.warn=i(q.level.WARN),q.error=i(q.level.ERROR),q.fatal=i(q.level.FATAL),q.addHandler=f,q.addAppender=e,q.init=d,q.loggingLevel=q.level.DEBUG,q.Appender.standardLogAppender=j,q.Handler.beaconLogHandler=k,q.Handler.consoleLogHandler=l,q.watch=function(a,b){return m(a,b)},q.attempt=function(a,b){var c=Array.prototype.slice.call(arguments,2);return m(a,b)(c)},q.localWatch=function(a,b,c){return m(a,c,b)},q.localAttempt=function(a,b,c){var d=Array.prototype.slice.call(arguments,3);return m(a,c,b)(d)};var u=a.onerror;q.setUpOnErrorHandler=o,q.setUpEventListening=p,a.navigator||(a.navigator={}),a.location||(a.location={}),a.document||(a.document={}),a.navigator||(a.navigator={}),q._window=a,"function"==typeof define&&define.amd?(a.Canadarm=q,define("canadarm",[],function(){return q})):"object"==typeof module?module.exports=q:"object"==typeof exports?exports=q:a.Canadarm=q}("undefined"!=typeof window?window:this); +//# sourceMappingURL=canadarm.min.js.map \ No newline at end of file diff --git a/lib/fhir-client.min.js b/lib/fhir-client.min.js new file mode 100644 index 0000000..2d8898c --- /dev/null +++ b/lib/fhir-client.min.js @@ -0,0 +1,6 @@ +!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gb;++b)if("object"===e(a=f[b]))for(c in a)g[c]=h?d(a[c]):a[c];return g}function d(a){var b,c,f=a,g=e(a);if("array"===g)for(f=[],c=a.length,b=0;c>b;++b)f[b]=d(a[b]);else if("object"===g){f={};for(b in a)f[b]=d(a[b])}return f}function e(a){return{}.toString.call(a).match(/\s([\w]+)/)[1].toLowerCase()}b?a.exports=c:window.merge=c}("object"==typeof a&&a&&"object"==typeof a.exports&&a.exports)}).call(b,c(4)(a))},function(a,b){a.exports=function(a){return a.webpackPolyfill||(a.deprecate=function(){},a.paths=[],a.children=[],a.webpackPolyfill=1),a}},function(a,b,c){(function(){var a=c(2),d=function(a){return function(){return a}},e=function(a,b){return function(c){return a(b(c))}},f=function(a){return a.and=function(b){return f(e(a,b))},a.end=function(b){return a(b)},a};b.$$Simple=function(a){return function(b){return function(c){return b(a(c))}}};var g=function(a,b,c){for(var d=b.split("."),e=a,f=0;fb;b++)switch(g=a[b],d(g)){case"array":f.push({param:"_sort",value:g[0],modifier:":"+g[1]});break;case"string":f.push({param:"_sort",value:g});break;default:f.push(void 0)}return f},m=function(a){return f(a,function(a,b){var c,e;return c=b[0],e=b[1],a.concat(function(){switch(d(e)){case"array":return e.map(function(a){return{param:"_include",value:c+"."+a}});case"string":return[{param:"_include",value:c+"."+e}]}}())})},n=function(a,b){if("$sort"===a)return l(b);if("$include"===a)return m(b);switch(d(b)){case"object":return k(a,b);case"string":return[{param:a,value:[b]}];case"number":return[{param:a,value:[b]}];case"array":return[{param:a,value:[b.join("|")]}];default:throw"could not linearizeParams "+d(b)}},o=function(a){return f(a,function(a,b){var c,d;return c=b[0],d=b[1],a.concat(n(c,d))})},p=function(a){var b,c;return c=function(){var c,d,e,f;for(e=o(a),f=[],c=0,d=e.length;d>c;c++)b=e[c],f.push([b.param,b.modifier,"=",b.operator,encodeURIComponent(b.value)].filter(g).join(""));return f}(),c.join("&")};b._query=o,b.query=p;var q=c(5);b.$SearchParams=q.$$Attr("url",function(a){var b=a.url;if(a.query){var c=p(a.query);return b+"?"+c}return b}),b.$Paging=function(a){return function(b){var c=b.params||{};return b.since&&(c._since=b.since),b.count&&(c._count=b.count),b.params=c,a(b)}}}).call(this)},function(a,b,c){(function(){var a=c(5),d=c(8).btoa;b.$Basic=a.$$Attr("headers.Authorization",function(a){return a.auth&&a.auth.user&&a.auth.pass?"Basic "+d(a.auth.user+":"+a.auth.pass):void 0}),b.$Bearer=a.$$Attr("headers.Authorization",function(a){return a.auth&&a.auth.bearer?"Bearer "+a.auth.bearer:void 0});var e;b.$Credentials=a.Middleware(a.$$Attr("credentials",function(a){return e=a.credentials,""})).and(a.$$Attr("credentials",function(a){return["same-origin","include"].indexOf(e)>-1?e:void 0}))}).call(this)},function(a,b,c){!function(){function a(a){this.message=a}var c=b,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.prototype=new Error,a.prototype.name="InvalidCharacterError",c.btoa||(c.btoa=function(b){for(var c,e,f=String(b),g=0,h=d,i="";f.charAt(0|g)||(h="=",g%1);i+=h.charAt(63&c>>8-g%1*8)){if(e=f.charCodeAt(g+=.75),e>255)throw new a("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");c=c<<8|e}return i}),c.atob||(c.atob=function(b){var c=String(b).replace(/=+$/,"");if(c.length%4==1)throw new a("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,f,g=0,h=0,i="";f=c.charAt(h++);~f&&(e=g%4?64*e+f:f,g++%4)?i+=String.fromCharCode(255&e>>(-2*g&6)):0)f=d.indexOf(f);return i})}()},function(a,b,c){(function(){var a=c(2);b.Http=function(a,b){return function(c){c.debug&&console.log("\nDEBUG (request):",c.method,c.url,c);var d=(c.http||b.http||a.http)(c);return c.debug&&d&&d.then&&d.then(function(a){console.log("\nDEBUG: (responce)",a)}),d}};var d=function(b){return"object"==a.type(b)?JSON.stringify(b):b};b.$JsonData=function(a){return function(b){var c=b.bundle||b.data||b.resource;return c&&(b.data=d(c)),a(b)}}}).call(this)},function(a,b){a.exports=function(a){return function(b){try{return a(b)}catch(c){if(b.debug&&(console.log("\nDEBUG: (ERROR in middleware)"),console.log(c.message),console.log(c.stack)),!b.defer)throw console.log("\nDEBUG: (ERROR in middleware)"),console.log(c.message),console.log(c.stack),new Error("I need adapter.defer");var d=b.defer();return d.reject(c),d.promise}}}},function(a,b){(function(){var b=function(a,b,c){var d=a[c];return d&&!b[c]&&(b[c]=d),a};a.exports=function(a,c){return function(d){return function(e){return b(a,e,"baseUrl"),b(a,e,"cache"),b(a,e,"auth"),b(a,e,"patient"),b(a,e,"debug"),b(c,e,"defer"),b(c,e,"http"),d(e)}}}}).call(this)},function(a,b){b.$$BundleLinkUrl=function(a){return function(b){return function(c){var d=function(b){return b.relation&&b.relation===a},e=c.bundle&&(c.bundle.link||[]).filter(d)[0];if(e&&e.url)return c.url=e.url,c.data=null,b(c);throw new Error("No "+a+" link found in bundle")}}}},function(a,b,c){(function(){var a=c(5),d=["Account","AllergyIntolerance","BodySite","CarePlan","Claim","ClinicalImpression","Communication","CommunicationRequest","Composition","Condition","Contract","DetectedIssue","Device","DeviceUseRequest","DeviceUseStatement","DiagnosticOrder","DiagnosticReport","DocumentManifest","DocumentReference","Encounter","EnrollmentRequest","EpisodeOfCare","FamilyMemberHistory","Flag","Goal","ImagingObjectSelection","ImagingStudy","Immunization","ImmunizationRecommendation","List","Media","MedicationAdministration","MedicationDispense","MedicationOrder","MedicationStatement","NutritionOrder","Observation","Order","Procedure","ProcedureRequest","QuestionnaireResponse","ReferralRequest","RelatedPerson","RiskAssessment","Specimen","SupplyDelivery","SupplyRequest","VisionPrescription"];b.$WithPatient=a.$$Simple(function(a){var b=a.type;return a.patient&&("Patient"===b?(a.query=a.query||{},a.query._id=a.patient,a.id=a.patient):d.indexOf(b)>=0&&(a.query=a.query||{},a.query.patient=a.patient)),a})}).call(this)},function(a,b,c){(function(){var b=c(2),d=/^#(.*)/,e=function(a,b){var c=a.match(d)[1],e=(b.contained||[]).filter(function(a){return(a.id||a._id)==c})[0];return e&&{content:e}||null},f=function(a){var c=a.cache,f=a.reference,g=a.bundle,h=f;if(!h.reference)return null;if(h.reference.match(d))return e(h.reference,a.resource);var i=b.absoluteUrl(a.baseUrl,h.reference),j=(g&&g.entry||[]).filter(function(a){return a.id===i})[0];return j||(null!=c?c[i]:void 0)||null},g=function(a){return function(c){var e=f(c),g=c.reference,h=c.defer();if(e){if(!c.defer)throw new Error("I need promise constructor 'adapter.defer' in adapter");return h.resolve(e),h.promise}if(!g)throw new Error("No reference found");if(g&&g.reference.match(d))throw new Error("Contained resource not found");return c.url=b.absoluteUrl(c.baseUrl,g.reference),c.data=null,a(c)}};a.exports.sync=f,a.exports.resolve=g}).call(this)},function(a,b,c){(function(){var a=(c(2),c(5)),d=function(a,b){return b.split(".").reduce(function(a,b){return null==a||void 0==a?null:a[b]},a)},e=function(a,b){for(var c=a.split("||").map(function(a){return a.trim().substring(1)}),e=0;e0?a>>>0:0;else if("string"===f)"base64"===b&&(a=C(a)),e=d.byteLength(a,b);else{if("object"!==f||null===a)throw new Error("First argument needs to be a number, array or string.");"Buffer"===a.type&&E(a.data)&&(a=a.data),e=+a.length>0?Math.floor(+a.length):0}var g;T?g=d._augment(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(T&&"number"==typeof a.byteLength)g._set(a);else if(F(a))if(d.isBuffer(a))for(h=0;e>h;h++)g[h]=a.readUInt8(h);else for(h=0;e>h;h++)g[h]=(a[h]%256+256)%256;else if("string"===f)g.write(a,0,b);else if("number"===f&&!T&&!c)for(h=0;e>h;h++)g[h]=0;return g}function e(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;Q(f%2===0,"Invalid hex string"),d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);Q(!isNaN(h),"Invalid hex string"),a[c+g]=h}return g}function f(a,b,c,d){var e=L(H(b),a,c,d);return e}function g(a,b,c,d){var e=L(I(b),a,c,d);return e}function h(a,b,c,d){return g(a,b,c,d)}function i(a,b,c,d){var e=L(K(b),a,c,d);return e}function j(a,b,c,d){var e=L(J(b),a,c,d);return e}function k(a,b,c){return 0===b&&c===a.length?R.fromByteArray(a):R.fromByteArray(a.slice(b,c))}function l(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=M(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+M(e)}function m(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function n(a,b,c){return m(a,b,c)}function o(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=G(a[f]);return e}function p(a,b,c){for(var d=a.slice(b,c),e="",f=0;f=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+1=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(void 0!==b&&null!==b,"missing offset"),Q(b+3=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(Q("boolean"==typeof c,"missing or invalid endian"),Q(b+3=f)){for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g);return c+2}}function x(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3=f)){for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=b>>>8*(d?g:3-g)&255;return c+4}}function y(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+1=f))return b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e),c+2}function z(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3=f))return b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e),c+4}function A(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+3=f))return S.write(a,b,c,d,23,4),c+4}function B(a,b,c,d,e){e||(Q(void 0!==b&&null!==b,"missing value"),Q("boolean"==typeof d,"missing or invalid endian"),Q(void 0!==c&&null!==c,"missing offset"),Q(c+7=f))return S.write(a,b,c,d,52,8),c+8}function C(a){for(a=D(a).replace(V,"");a.length%4!==0;)a+="=";return a}function D(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function F(a){return E(a)||d.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function G(a){return 16>a?"0"+a.toString(16):a.toString(16)}function H(a){for(var b=[],c=0;c=d)b.push(d);else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g>8,d=b%256,e.push(d),e.push(c);return e}function K(a){return R.toByteArray(a)}function L(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}function M(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function N(a,b){Q("number"==typeof a,"cannot write a non-number as a number"),Q(a>=0,"specified a negative value for writing an unsigned value"),Q(b>=a,"value is larger than maximum value for type"),Q(Math.floor(a)===a,"value has a fractional component")}function O(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value"),Q(Math.floor(a)===a,"value has a fractional component")}function P(a,b,c){Q("number"==typeof a,"cannot write a non-number as a number"),Q(b>=a,"value larger than maximum allowed value"),Q(a>=c,"value smaller than minimum allowed value")}function Q(a,b){if(!a)throw new Error(b||"Failed assertion")}var R=a("base64-js"),S=a("ieee754");c.Buffer=d,c.SlowBuffer=d,c.INSPECT_MAX_BYTES=50,d.poolSize=8192;var T=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);return b.foo=function(){return 42},42===b.foo()&&"function"==typeof b.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(c){return!1}}();d.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.isBuffer=function(a){return!(null==a||!a._isBuffer)},d.byteLength=function(a,b){var c;switch(a=a.toString(),b||"utf8"){case"hex":c=a.length/2;break;case"utf8":case"utf-8":c=H(a).length;break;case"ascii":case"binary":case"raw":c=a.length;break;case"base64":c=K(a).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":c=2*a.length;break;default:throw new Error("Unknown encoding")}return c},d.concat=function(a,b){if(Q(E(a),"Usage: Buffer.concat(list[, length])"),0===a.length)return new d(0);if(1===a.length)return a[0];var c;if(void 0===b)for(b=0,c=0;cf&&a[f]===b[f];f++);return f!==g&&(c=a[f],e=b[f]),e>c?-1:c>e?1:0},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var k=d;d=b,b=c,c=k}b=Number(b)||0;var l=this.length-b;c?(c=Number(c),c>l&&(c=l)):c=l,d=String(d||"utf8").toLowerCase();var m;switch(d){case"hex":m=e(this,a,b,c);break;case"utf8":case"utf-8":m=f(this,a,b,c);break;case"ascii":m=g(this,a,b,c);break;case"binary":m=h(this,a,b,c);break;case"base64":m=i(this,a,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=j(this,a,b,c);break;default:throw new Error("Unknown encoding")}return m},d.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0===c?d.length:Number(c),c===b)return"";var e;switch(a){case"hex":e=o(d,b,c);break;case"utf8":case"utf-8":e=l(d,b,c);break;case"ascii":e=m(d,b,c);break;case"binary":e=n(d,b,c);break;case"base64":e=k(d,b,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":e=p(d,b,c);break;default:throw new Error("Unknown encoding")}return e},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.equals=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),0===d.compare(this,a)},d.prototype.compare=function(a){return Q(d.isBuffer(a),"Argument must be a Buffer"),d.compare(this,a)},d.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){Q(d>=c,"sourceEnd < sourceStart"),Q(b>=0&&b=0&&c=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-bf||!T)for(var g=0;f>g;g++)a[g+b]=this[g+c];else a._set(this.subarray(c,c+f),b)}},d.prototype.slice=function(a,b){var c=this.length;if(a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a),T)return d._augment(this.subarray(a,b));for(var e=b-a,f=new d(e,void 0,!0),g=0;e>g;g++)f[g]=this[g+a];return f},d.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},d.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},d.prototype.readUInt8=function(a,b){return b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a=this.length?void 0:this[a]},d.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},d.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},d.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},d.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},d.prototype.readInt8=function(a,b){if(b||(Q(void 0!==a&&null!==a,"missing offset"),Q(a=this.length)){var c=128&this[a];return c?-1*(255-this[a]+1):this[a]}},d.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},d.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},d.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},d.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},d.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},d.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},d.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},d.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},d.prototype.writeUInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b=this.length?void 0:(this[b]=a,b+1)},d.prototype.writeUInt16LE=function(a,b,c){return w(this,a,b,!0,c)},d.prototype.writeUInt16BE=function(a,b,c){return w(this,a,b,!1,c)},d.prototype.writeUInt32LE=function(a,b,c){return x(this,a,b,!0,c)},d.prototype.writeUInt32BE=function(a,b,c){return x(this,a,b,!1,c)},d.prototype.writeInt8=function(a,b,c){return c||(Q(void 0!==a&&null!==a,"missing value"),Q(void 0!==b&&null!==b,"missing offset"),Q(b=this.length?void 0:(a>=0?this.writeUInt8(a,b,c):this.writeUInt8(255+a+1,b,c),b+1)},d.prototype.writeInt16LE=function(a,b,c){return y(this,a,b,!0,c)},d.prototype.writeInt16BE=function(a,b,c){return y(this,a,b,!1,c)},d.prototype.writeInt32LE=function(a,b,c){return z(this,a,b,!0,c)},d.prototype.writeInt32BE=function(a,b,c){return z(this,a,b,!1,c)},d.prototype.writeFloatLE=function(a,b,c){return A(this,a,b,!0,c)},d.prototype.writeFloatBE=function(a,b,c){return A(this,a,b,!1,c)},d.prototype.writeDoubleLE=function(a,b,c){return B(this,a,b,!0,c)},d.prototype.writeDoubleBE=function(a,b,c){return B(this,a,b,!1,c)},d.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),Q(c>=b,"end < start"),c!==b&&0!==this.length){Q(b>=0&&b=0&&c<=this.length,"end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=H(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=G(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return""},d.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(T)return new d(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var U=d.prototype;d._augment=function(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=U.get,a.set=U.set,a.write=U.write,a.toString=U.toString,a.toLocaleString=U.toString,a.toJSON=U.toJSON,a.equals=U.equals,a.compare=U.compare,a.copy=U.copy,a.slice=U.slice,a.readUInt8=U.readUInt8,a.readUInt16LE=U.readUInt16LE,a.readUInt16BE=U.readUInt16BE,a.readUInt32LE=U.readUInt32LE,a.readUInt32BE=U.readUInt32BE,a.readInt8=U.readInt8,a.readInt16LE=U.readInt16LE,a.readInt16BE=U.readInt16BE,a.readInt32LE=U.readInt32LE,a.readInt32BE=U.readInt32BE,a.readFloatLE=U.readFloatLE,a.readFloatBE=U.readFloatBE,a.readDoubleLE=U.readDoubleLE,a.readDoubleBE=U.readDoubleBE,a.writeUInt8=U.writeUInt8,a.writeUInt16LE=U.writeUInt16LE,a.writeUInt16BE=U.writeUInt16BE,a.writeUInt32LE=U.writeUInt32LE,a.writeUInt32BE=U.writeUInt32BE,a.writeInt8=U.writeInt8,a.writeInt16LE=U.writeInt16LE,a.writeInt16BE=U.writeInt16BE,a.writeInt32LE=U.writeInt32LE,a.writeInt32BE=U.writeInt32BE,a.writeFloatLE=U.writeFloatLE,a.writeFloatBE=U.writeFloatBE,a.writeDoubleLE=U.writeDoubleLE,a.writeDoubleBE=U.writeDoubleBE,a.fill=U.fill,a.inspect=U.inspect,a.toArrayBuffer=U.toArrayBuffer,a};var V=/[^+\/0-9A-z]/g},{"base64-js":4,ieee754:5}],4:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g?62:b===h?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],5:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0; +for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],6:[function(a,b,c){(function(c){function d(a){return function(){var b=[],d={update:function(a,d){return c.isBuffer(a)||(a=new c(a,d)),b.push(a),this},digest:function(d){var e=c.concat(b),f=a(e);return b=null,d?f.toString(d):f}};return d}}var e=a("sha.js"),f=d(a("./md5")),g=d(a("ripemd160"));b.exports=function(a){return"md5"===a?new f:"rmd160"===a?new g:e(a)}}).call(this,a("buffer").Buffer)},{"./md5":10,buffer:3,ripemd160:11,"sha.js":13}],7:[function(a,b,c){(function(c){function d(a,b){if(!(this instanceof d))return new d(a,b);this._opad=i,this._alg=a,b=this._key=c.isBuffer(b)?b:new c(b),b.length>f?b=e(a).update(b).digest():b.lengthj;j++)h[j]=54^b[j],i[j]=92^b[j];this._hash=e(a).update(h)}var e=a("./create-hash"),f=64,g=new c(f);g.fill(0),b.exports=d,d.prototype.update=function(a,b){return this._hash.update(a,b),this},d.prototype.digest=function(a){var b=this._hash.digest();return e(this._alg).update(this._opad).update(b).digest(a)}}).call(this,a("buffer").Buffer)},{"./create-hash":6,buffer:3}],8:[function(a,b,c){(function(a){function c(b,c){if(b.length%f!==0){var d=b.length+(f-b.length%f);b=a.concat([b,g],d)}for(var e=[],h=c?b.readInt32BE:b.readInt32LE,i=0;i>5]|=128<>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,k=271733878,l=0;l>16)+(b>>16)+(c>>16);return d<<16|65535&c}function k(a,b){return a<>>32-b}var l=a("./helpers");b.exports=function(a){return l.hash(a,d,16)}},{"./helpers":8}],11:[function(a,b,c){(function(a){function c(a,b,c){return a^b^c}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return(a|~b)^c}function f(a,b,c){return a&c|b&~c}function g(a,b,c){return a^(b|~c)}function h(a,b){return a<>>32-b}function i(b){var c=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof b&&(b=new a(b,"utf8"));var d=p(b),e=8*b.length,f=8*b.length;d[e>>>5]|=128<<24-e%32,d[(e+64>>>9<<4)+14]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8);for(var g=0;gg;g++){var h=c[g];c[g]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}var i=q(c);return new a(i)}b.exports=i;var j=[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],k=[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],l=[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],m=[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],n=[0,1518500249,1859775393,2400959708,2840853838],o=[1352829926,1548603684,1836072691,2053994217,0],p=function(a){for(var b=[],c=0,d=0;c>>5]|=a[c]<<24-d%32;return b},q=function(a){for(var b=[],c=0;c<32*a.length;c+=8)b.push(a[c>>>5]>>>24-c%32&255);return b},r=function(a,b,i){for(var p=0;16>p;p++){var q=i+p,r=b[q];b[q]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var s,t,u,v,w,x,y,z,A,B;x=s=a[0],y=t=a[1],z=u=a[2],A=v=a[3],B=w=a[4];for(var C,p=0;80>p;p+=1)C=s+b[i+j[p]]|0,C+=16>p?c(t,u,v)+n[0]:32>p?d(t,u,v)+n[1]:48>p?e(t,u,v)+n[2]:64>p?f(t,u,v)+n[3]:g(t,u,v)+n[4],C=0|C,C=h(C,l[p]),C=C+w|0,s=w,w=v,v=h(u,10),u=t,t=C,C=x+b[i+k[p]]|0,C+=16>p?g(y,z,A)+o[0]:32>p?f(y,z,A)+o[1]:48>p?e(y,z,A)+o[2]:64>p?d(y,z,A)+o[3]:c(y,z,A)+o[4],C=0|C,C=h(C,m[p]),C=C+B|0,x=B,B=A,A=h(z,10),z=y,y=C;C=a[1]+u+A|0,a[1]=a[2]+v+B|0,a[2]=a[3]+w+x|0,a[3]=a[4]+s+y|0,a[4]=a[0]+t+z|0,a[0]=C}}).call(this,a("buffer").Buffer)},{buffer:3}],12:[function(a,b,c){var d=a("./util"),e=d.write,f=d.zeroFill;b.exports=function(a){function b(b,c){this._block=new a(b),this._finalSize=c,this._blockSize=b,this._len=0,this._s=0}function c(a,b){return null==b?a.byteLength||a.length:"ascii"==b||"binary"==b?a.length:"hex"==b?a.length/2:"base64"==b?a.length/3:void 0}return b.prototype.init=function(){this._s=0,this._len=0},b.prototype.update=function(b,d){var f,g=this._blockSize;d||"string"!=typeof b||(d="utf8"),d?("utf-8"===d&&(d="utf8"),("base64"===d||"utf8"===d)&&(b=new a(b,d),d=null),f=c(b,d)):f=b.byteLength||b.length;for(var h=this._len+=f,i=this._s=this._s||0,j=0,k=this._block;h>i;){var l=Math.min(f,j+g-i%g);e(k,b,d,i%g,j,l);var m=l-j;i+=m,j+=m,i%g||this._update(k)}return this._s=i,this},b.prototype.digest=function(a){var b=this._blockSize,c=this._finalSize,e=8*this._len,g=this._block,h=e%(8*b);g[this._len%b]=128,f(this._block,this._len%b+1),h>=8*c&&(this._update(this._block),d.zeroFill(this._block,0)),g.writeInt32BE(e,c+4);var i=this._update(this._block)||this._hash();return null==a?i:i.toString(a)},b.prototype._update=function(){throw new Error("_update must be implemented by subclass")},b}},{"./util":16}],13:[function(a,b,c){var c=b.exports=function(a){var b=c[a];if(!b)throw new Error(a+" is not supported (we accept pull requests)");return new b},d=a("buffer").Buffer,e=a("./hash")(d);c.sha=c.sha1=a("./sha1")(d,e),c.sha256=a("./sha256")(d,e)},{"./hash":12,"./sha1":14,"./sha256":15,buffer:3}],14:[function(a,b,c){b.exports=function(b,c){function d(){return p.length?p.pop().init():this instanceof d?(this._w=o,c.call(this,64,56),this._h=null,void this.init()):new d}function e(a,b,c,d){return 20>a?b&c|~b&d:40>a?b^c^d:60>a?b&c|b&d|c&d:b^c^d}function f(a){return 20>a?1518500249:40>a?1859775393:60>a?-1894007588:-899497514}function g(a,b){return a+b|0}function h(a,b){return a<>>32-b}var i=a("util").inherits;i(d,c);var j=0,k=4,l=8,m=12,n=16,o=new Int32Array(80),p=[];d.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,c.prototype.init.call(this),this},d.prototype._POOL=p;new b(1)instanceof DataView;return d.prototype._update=function(a){var b,c,d,i,j,k,l,m,n,o,p=this._block;this._h;b=k=this._a,c=l=this._b,d=m=this._c,i=n=this._d,j=o=this._e;for(var q=this._w,r=0;80>r;r++){var s=q[r]=16>r?p.readInt32BE(4*r):h(q[r-3]^q[r-8]^q[r-14]^q[r-16],1),t=g(g(h(b,5),e(r,c,d,i)),g(g(j,s),f(r)));j=i,i=d,d=h(c,30),c=b,b=t}this._a=g(b,k),this._b=g(c,l),this._c=g(d,m),this._d=g(i,n),this._e=g(j,o)},d.prototype._hash=function(){p.length<100&&p.push(this);var a=new b(20);return a.writeInt32BE(0|this._a,j),a.writeInt32BE(0|this._b,k),a.writeInt32BE(0|this._c,l),a.writeInt32BE(0|this._d,m),a.writeInt32BE(0|this._e,n),a},d}},{util:37}],15:[function(a,b,c){var d=a("util").inherits;a("./util");b.exports=function(a,b){function c(){o.length,this.init(),this._w=n,b.call(this,64,56)}function e(a,b){return a>>>b|a<<32-b}function f(a,b){return a>>>b}function g(a,b,c){return a&b^~a&c}function h(a,b,c){return a&b^a&c^b&c}function i(a){return e(a,2)^e(a,13)^e(a,22)}function j(a){return e(a,6)^e(a,11)^e(a,25)}function k(a){return e(a,7)^e(a,18)^f(a,3)}function l(a){return e(a,17)^e(a,19)^f(a,10)}var m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];d(c,b);var n=new Array(64),o=[];c.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this._len=this._s=0,this};return c.prototype._update=function(a){var b,c,d,e,f,n,o,p,q,r,s=this._block,t=this._w;b=0|this._a,c=0|this._b,d=0|this._c,e=0|this._d,f=0|this._e,n=0|this._f,o=0|this._g,p=0|this._h;for(var u=0;64>u;u++){var v=t[u]=16>u?s.readInt32BE(4*u):l(t[u-2])+t[u-7]+k(t[u-15])+t[u-16];q=p+j(f)+g(f,n,o)+m[u]+v,r=i(b)+h(b,c,d),p=o,o=n,n=f,f=e+q,e=d,d=c,c=b,b=q+r}this._a=b+this._a|0,this._b=c+this._b|0,this._c=d+this._c|0,this._d=e+this._d|0,this._e=f+this._e|0,this._f=n+this._f|0,this._g=o+this._g|0,this._h=p+this._h|0},c.prototype._hash=function(){o.length<10&&o.push(this);var b=new a(32);return b.writeInt32BE(this._a,0),b.writeInt32BE(this._b,4),b.writeInt32BE(this._c,8),b.writeInt32BE(this._d,12),b.writeInt32BE(this._e,16),b.writeInt32BE(this._f,20),b.writeInt32BE(this._g,24),b.writeInt32BE(this._h,28),b},c}},{"./util":16,util:37}],16:[function(a,b,c){function d(a,b,c,d,e,f,g){var h=f-e;if("ascii"===c||"binary"===c)for(var i=0;h>i;i++)a[d+i]=b.charCodeAt(i+e);else if(null==c)for(var i=0;h>i;i++)a[d+i]=b[i+e];else{if("hex"!==c)throw"base64"===c?new Error("base64 encoding not yet supported"):new Error(c+" encoding not yet supported");for(var i=0;h>i;i++){var j=e+i;a[d+i]=parseInt(b[2*j]+b[2*j+1],16)}}}function e(a,b){for(var c=b;cg)throw new TypeError("Bad iterations");if("number"!=typeof h)throw new TypeError("Key length not a number");if(0>h)throw new TypeError("Bad key length");var e=a.isBuffer(e)?e:new a(e);e.length>c?e=createHash(alg).update(e).digest():e.length20?20:h,n[0]=m>>24&255,n[1]=m>>16&255,n[2]=m>>8&255,n[3]=255&m,i=b("sha1",e),i.update(f),i.update(n),k=i.digest(),k.copy(o,l,0,j);for(var p=1;g>p;p++){i=b("sha1",e),i.update(k),k=i.digest();for(var q=0;j>q;q++)o[q]^=k[q]}h-=j,m++,l+=j}return o},e}}).call(this,a("buffer").Buffer)},{buffer:3}],18:[function(a,b,c){(function(a){!function(){b.exports=function(b){var c=new a(b);return crypto.getRandomValues(c),c}}()}).call(this,a("buffer").Buffer)},{buffer:3}],19:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length))throw b=arguments[1],b instanceof Error?b:TypeError('Uncaught, unspecified "error" event.');if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;d>i;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(0>d)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],20:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],21:[function(a,b,c){b.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],22:[function(a,b,c){function d(){}var e=b.exports={};e.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=d,e.addListener=d,e.once=d,e.off=d,e.removeListener=d,e.removeAllListeners=d,e.emit=d,e.binding=function(a){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(a){throw new Error("process.chdir is not supported")}},{}],23:[function(a,b,c){b.exports=a("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":24}],24:[function(a,b,c){(function(c){function d(a){return this instanceof d?(i.call(this,a),j.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",e)):new d(a)}function e(){this.allowHalfOpen||this._writableState.ended||c.nextTick(this.end.bind(this))}function f(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}b.exports=d;var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},h=a("core-util-is");h.inherits=a("inherits");var i=a("./_stream_readable"),j=a("./_stream_writable");h.inherits(d,i),f(g(j.prototype),function(a){d.prototype[a]||(d.prototype[a]=j.prototype[a])})}).call(this,a("_process"))},{"./_stream_readable":26,"./_stream_writable":28,_process:22,"core-util-is":29,inherits:20}],25:[function(a,b,c){function d(a){return this instanceof d?void e.call(this,a):new d(a)}b.exports=d;var e=a("./_stream_transform"),f=a("core-util-is");f.inherits=a("inherits"),f.inherits(d,e),d.prototype._transform=function(a,b,c){c(null,a)}},{"./_stream_transform":27,"core-util-is":29,inherits:20}],26:[function(a,b,c){(function(c){function d(b,c){b=b||{};var d=b.highWaterMark;this.highWaterMark=d||0===d?d:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!b.objectMode,this.defaultEncoding=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(C||(C=a("string_decoder/").StringDecoder),this.decoder=new C(b.encoding),this.encoding=b.encoding)}function e(a){return this instanceof e?(this._readableState=new d(a,this),this.readable=!0,void A.call(this)):new e(a)}function f(a,b,c,d,e){var f=j(b,c);if(f)a.emit("error",f);else if(null===c||void 0===c)b.reading=!1,b.ended||k(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event");a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):(b.reading=!1,b.buffer.push(c)),b.needReadable&&l(a),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length=D)a=D;else{a--;for(var b=1;32>b;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:null===a||isNaN(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:0>=a?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return y.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(b.decoder&&!b.ended){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,b.length>0?l(a):u(a)}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(b.emittedReadable=!0,b.sync?c.nextTick(function(){m(a)}):m(a))}function m(a){a.emit("readable")}function n(a,b){b.readingMore||(b.readingMore=!0,c.nextTick(function(){o(a,b)}))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length0)return;return 0===d.pipesCount?(d.flowing=!1,void(z.listenerCount(a,"data")>0&&s(a))):void(d.ranOut=!0)}function r(){this._readableState.ranOut&&(this._readableState.ranOut=!1,q(this))}function s(a,b){var d=a._readableState;if(d.flowing)throw new Error("Cannot switch to old mode now.");var e=b||!1,f=!1;a.readable=!0,a.pipe=A.prototype.pipe,a.on=a.addListener=A.prototype.on,a.on("readable",function(){f=!0;for(var b;!e&&null!==(b=a.read());)a.emit("data",b);null===b&&(f=!1,a._readableState.needReadable=!0)}),a.pause=function(){e=!0,this.emit("pause")},a.resume=function(){e=!1,f?c.nextTick(function(){a.emit("readable")}):this.read(0),this.emit("resume")},a.emit("readable")}function t(a,b){var c,d=b.buffer,e=b.length,f=!!b.decoder,g=!!b.objectMode;if(0===d.length)return null;if(0===e)c=null;else if(g)c=d.shift();else if(!a||a>=e)c=f?d.join(""):y.concat(d,e),d.length=0;else if(aj&&a>i;j++){var h=d[0],l=Math.min(a-i,h.length);f?c+=h.slice(0,l):h.copy(c,i,0,l),l0)throw new Error("endReadable called on non-empty stream");!b.endEmitted&&b.calledRead&&(b.ended=!0,c.nextTick(function(){b.endEmitted||0!==b.length||(b.endEmitted=!0,a.readable=!1,a.emit("end"))}))}function v(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}function w(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}b.exports=e;var x=a("isarray"),y=a("buffer").Buffer;e.ReadableState=d;var z=a("events").EventEmitter;z.listenerCount||(z.listenerCount=function(a,b){return a.listeners(b).length});var A=a("stream"),B=a("core-util-is");B.inherits=a("inherits");var C;B.inherits(e,A),e.prototype.push=function(a,b){var c=this._readableState;return"string"!=typeof a||c.objectMode||(b=b||c.defaultEncoding,b!==c.encoding&&(a=new y(a,b),b="")),f(this,c,a,b,!1)},e.prototype.unshift=function(a){var b=this._readableState;return f(this,b,a,"",!0)},e.prototype.setEncoding=function(b){C||(C=a("string_decoder/").StringDecoder),this._readableState.decoder=new C(b),this._readableState.encoding=b};var D=8388608;e.prototype.read=function(a){var b=this._readableState;b.calledRead=!0;var c,d=a;if(("number"!=typeof a||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return l(this),null;if(a=i(a,b),0===a&&b.ended)return c=null,b.length>0&&b.decoder&&(c=t(a,b),b.length-=c.length),0===b.length&&u(this),c;var e=b.needReadable;return b.length-a<=b.highWaterMark&&(e=!0),(b.ended||b.reading)&&(e=!1),e&&(b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),e&&!b.reading&&(a=i(d,b)),c=a>0?t(a,b):null,null===c&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),b.ended&&!b.endEmitted&&0===b.length&&u(this),c},e.prototype._read=function(a){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){a===k&&f()}function e(){a.end()}function f(){a.removeListener("close",h),a.removeListener("finish",i),a.removeListener("drain",o),a.removeListener("error",g),a.removeListener("unpipe",d),k.removeListener("end",e),k.removeListener("end",f),(!a._writableState||a._writableState.needDrain)&&o()}function g(b){j(),a.removeListener("error",g),0===z.listenerCount(a,"error")&&a.emit("error",b)}function h(){a.removeListener("finish",i),j()}function i(){a.removeListener("close",h),j()}function j(){k.unpipe(a)}var k=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=a;break;case 1:l.pipes=[l.pipes,a];break;default:l.pipes.push(a)}l.pipesCount+=1;var m=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,n=m?e:f;l.endEmitted?c.nextTick(n):k.once("end",n),a.on("unpipe",d);var o=p(k);return a.on("drain",o),a._events&&a._events.error?x(a._events.error)?a._events.error.unshift(g):a._events.error=[g,a._events.error]:a.on("error",g),a.once("close",h),a.once("finish",i),a.emit("pipe",k),l.flowing||(this.on("readable",r),l.flowing=!0,c.nextTick(function(){q(k)})),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,this.removeListener("readable",r),b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,this.removeListener("readable",r),b.flowing=!1;for(var e=0;d>e;e++)c[e].emit("unpipe",this);return this}var e=w(b.pipes,a);return-1===e?this:(b.pipes.splice(e,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this),this)},e.prototype.on=function(a,b){var c=A.prototype.on.call(this,a,b);if("data"!==a||this._readableState.flowing||s(this),"readable"===a&&this.readable){var d=this._readableState;d.readableListening||(d.readableListening=!0,d.emittedReadable=!1,d.needReadable=!0,d.reading?d.length&&l(this,d):this.read(0))}return c},e.prototype.addListener=e.prototype.on,e.prototype.resume=function(){s(this),this.read(0),this.emit("resume")},e.prototype.pause=function(){s(this,!0),this.emit("pause")},e.prototype.wrap=function(a){var b=this._readableState,c=!1,d=this;a.on("end",function(){if(b.decoder&&!b.ended){var a=b.decoder.end();a&&a.length&&d.push(a)}d.push(null)}),a.on("data",function(e){if(b.decoder&&(e=b.decoder.write(e)),(!b.objectMode||null!==e&&void 0!==e)&&(b.objectMode||e&&e.length)){var f=d.push(e);f||(c=!0,a.pause())}});for(var e in a)"function"==typeof a[e]&&"undefined"==typeof this[e]&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));var f=["error","close","destroy","pause","resume"];return v(f,function(b){a.on(b,d.emit.bind(d,b))}),d._read=function(b){c&&(c=!1,a.resume())},d},e._fromList=t}).call(this,a("_process"))},{_process:22,buffer:3,"core-util-is":29,events:19,inherits:20,isarray:21,stream:35,"string_decoder/":30}],27:[function(a,b,c){function d(a,b){this.afterTransform=function(a,c){return e(b,a,c)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function e(a,b,c){var d=a._transformState;d.transforming=!1;var e=d.writecb;if(!e)return a.emit("error",new Error("no writecb in Transform class"));d.writechunk=null,d.writecb=null,null!==c&&void 0!==c&&a.push(c),e&&e(b);var f=a._readableState;f.reading=!1,(f.needReadable||f.length=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived=55296&&56319>=d)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&56319>=d){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(2>=b&&c>>4==14){this.charLength=3;break}if(3>=b&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:3}],31:[function(a,b,c){b.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":25}],32:[function(a,b,c){c=b.exports=a("./lib/_stream_readable.js"),c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":24,"./lib/_stream_passthrough.js":25,"./lib/_stream_readable.js":26,"./lib/_stream_transform.js":27,"./lib/_stream_writable.js":28}],33:[function(a,b,c){b.exports=a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":27}],34:[function(a,b,c){b.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":28}],35:[function(a,b,c){function d(){e.call(this)}b.exports=d;var e=a("events").EventEmitter,f=a("inherits");f(d,e),d.Readable=a("readable-stream/readable.js"),d.Writable=a("readable-stream/writable.js"),d.Duplex=a("readable-stream/duplex.js"),d.Transform=a("readable-stream/transform.js"),d.PassThrough=a("readable-stream/passthrough.js"),d.Stream=d,d.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function d(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===e.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",d),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",d),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{events:19,inherits:20,"readable-stream/duplex.js":23,"readable-stream/passthrough.js":31,"readable-stream/readable.js":32,"readable-stream/transform.js":33,"readable-stream/writable.js":34}],36:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],37:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)F(b,String(g))?f.push(m(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.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]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":36,_process:22,inherits:20}],38:[function(a,b,c){(function(a){!function(){"use strict";function c(b){var c;return c=b instanceof a?b:new a(b.toString(),"binary"),c.toString("base64")}b.exports=c}()}).call(this,a("buffer").Buffer)},{buffer:3}],39:[function(a,b,c){!function(a,c){"object"==typeof b&&"object"==typeof b.exports?b.exports=a.document?c(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return c(a)}:c(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=a.length,c=_.type(a);return"function"===c||_.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+Math.random()}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c}catch(e){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("