diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..f94e2d8a1 --- /dev/null +++ b/.babelrc @@ -0,0 +1,19 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "ie": "11" + } + } + ], + "@babel/preset-react" + ], + "plugins": [ + "@babel/plugin-proposal-class-properties", + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-transform-regenerator", + "@babel/plugin-transform-runtime" + ] +} diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..b6021b3a5 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,98 @@ +version: 2 + +### ABOUT +# +# This configuration powers our Circleci.io integration +# +# Note: +# Netlify works independently from this configuration to +# create pull request previews and to update `https://docs.ohif.org` +### + +defaults: &defaults + working_directory: ~/repo + docker: + - image: circleci/node:10.15.1 + +jobs: + build_and_test: + <<: *defaults + steps: + # Download and cache dependencies + - checkout + - restore_cache: + name: Restore Yarn Package Cache + keys: + # when lock file changes, use increasingly general patterns to restore cache + - yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-packages-v1-{{ .Branch }}- + - yarn-packages-v1- + - run: + name: Install Dependencies + command: yarn install --frozen-lockfile + - save_cache: + name: Save Yarn Package Cache + paths: + - ~/.cache/yarn + key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} + + # Build & Test + - run: yarn build:package:ci + # https://www.viget.com/articles/using-junit-on-circleci-2-0-with-jest-and-eslint/ + - run: + name: 'JavaScript Test Suite' + command: yarn test:ci + environment: + JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml' + + # Store result + - store_test_results: + path: reports/junit + - store_artifacts: + path: reports/junit + + # Persist :+1: + - persist_to_workspace: + root: ~/repo + paths: . + + npm_publish: + <<: *defaults + steps: + - attach_workspace: + at: ~/repo + - run: + name: Avoid hosts unknown for github + command: + mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking + no\n" > ~/.ssh/config + # --no-ci argument is not ideal; however, semantic-rlease thinks we're + # attempting to run it from a `pr`, which is not the case + - run: + name: Publish using Semantic Release + command: npx semantic-release --debug --dry-run + +workflows: + version: 2 + + # PULL REQUESTS + pull_requests: + jobs: + - build_and_test: + filters: + branches: + ignore: + - master + - feature/* + - hotfix/* + + # MERGE TO MASTER + cut_release: + jobs: + - build_and_test: + filters: + branches: + only: master + - npm_publish: + requires: + - build_and_test diff --git a/.dockerignore b/.dockerignore index 430c241b7..67f1b2e98 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,17 +1,16 @@ -.idea/ -.meteor/local -.meteor/meteorite -.meteor/dev_bundle -*/.meteor/dev_bundle -node_modules -.npm -npm-debug.log -Packages/active-entry/helloworld/ -LesionTracker/tests/nightwatch/reports/ -package-lock.json -docs/_book -docs/ -img/ -test/ -LesionTracker/ -StandaloneViewer/ \ No newline at end of file +# Output +dist/ + +# Dependencies +node_modules/ + +# Root +README.md +Dockerfile + +# Misc. Config +.git +.DS_Store +.gitignore +.vscode +.circleci diff --git a/.env b/.env new file mode 100644 index 000000000..6f5a2f3bd --- /dev/null +++ b/.env @@ -0,0 +1,14 @@ +## +# Environment: Default +# +# We're using this to set variables for development. +# Please feel free to delete or modify this file for your own setup. +# Be careful not to commit anything sensitive to source control. +# + +PUBLIC_URL=/ + +# +# Most vars require REACT_APP_* naming +# +REACT_APP_CONFIG=config/default.js diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..d179308f1 --- /dev/null +++ b/.env.example @@ -0,0 +1,13 @@ +## +# EXAMPLE +# +# Read more about .env files when using create-react-app here: +# https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env +# + +PUBLIC_URL=/demo + +# +# Most vars require REACT_APP_* naming +# +REACT_APP_CONFIG=config/netlify.js diff --git a/.eslintignore b/.eslintignore index ae680f423..3f1cb5da3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,3 @@ config/** docs/** img/** -StandaloneViewer/** diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..e165d62e3 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,16 @@ +{ + "extends": [ + "react-app", + "eslint:recommended", + "plugin:react/recommended" + ], + "parser": "babel-eslint", + "env": { + "jest": true + }, + "settings": { + "react": { + "version": "detect", + }, + }, +} diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index ac63643c5..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - 'env': { - 'browser': true, - 'es6': true, - 'jquery': true, - 'node': true, - 'mocha': true - }, - 'extends': 'eslint:recommended', - 'parserOptions': { - 'sourceType': 'module' - }, - 'rules': { - 'no-undef': 'error', - } -}; diff --git a/.gitignore b/.gitignore index 0448892b7..85cfb5b26 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,27 @@ -.idea/ -.vscode/ -.meteor/local -.meteor/meteorite -.meteor/dev_bundle -*/.meteor/dev_bundle +# Packages node_modules + +# Output +build +dist +docs/_book +src/version.js +junit.xml +coverage/ + +# YALC (for Erik) +.yalc +yalc.lock + +# Logging, System files, misc. +.idea/ .npm npm-debug.log -Packages/active-entry/helloworld/ -LesionTracker/tests/nightwatch/reports/ -docs/_book \ No newline at end of file +package-lock.json +yarn-error.log +.DS_Store + +# Common Example Data Directories +sampledata/ +example/deps/ +docker/dcm4che/dcm4che-arc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..b4d67366a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,9 @@ +{ + "trailingComma": "es5", + "printWidth": 80, + "proseWrap": "always", + "tabWidth": 2, + "semi": false, + "singleQuote": true, + "endOfLine": "lf" +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 45c1fc978..000000000 --- a/.travis.yml +++ /dev/null @@ -1,127 +0,0 @@ -language: node_js - -node_js: - - "lts/*" - -services: - - docker - -before_script: - - export PATH=$HOME/.meteor:$PATH - -cache: - directories: - - ~/.meteor - - node_modules - - OHIFViewer/node_modules - -env: - global: - - METEOR_PACKAGE_DIRS=../Packages - - secure: "ZhIMR4geQP/BXdXrQkcARPCSPnyry2aTgszo+Jg+lZfRHWil2FmAweCiWyOC/5rRxrYYSik/ZyEMAX54v9N9sNjYsPlA9UFqovMirEQhXCYmIG+DNBsU58zgnrDWQoolF1xD4f/IFtLjUGG9WQNR7SavHeL/2VmWK9Nis8TChnyTdmlL8IaWEeKjznseLqyVKZSMb490bG34I4ztdumaYHWWt01uhNFZ/XA048NVd/E8LhO7yLIqwtmCt7Cr1Z61TfSzgyajJaCiuTLvrNDU8W/f/j4wlhybGJruvvOH9qDPRRp2aw3surgAB33irZftYFgG1h/6NjjKeRrBvqocW9sZdAeXWcqw4xiNyi4AbbSGk5aPrFuYMswJWP0/i9MkSF5N0eRcFoWl/DvTeaG4bkzTQquT29pdYE/Ef3KXDgKevwUKH0OBU79v8VSLjIT9Tr0ps/FOvNXjeGHjI6FoqCkLt2XYgDMteltRC7rjtmxTGBRpQQFoRksa/11jwr6t5YNxYootzM11g8EFA/uX56aJHkTjZBpSzMsImDPsWjpqu/MTttVmdtq6iFEkA9NBwZYIZEJBmiy/wfNXhNgCe2lDuaSdK6MMF8PHXWIjvcW2/+h6u355ktr+LRXeolVuYDIAaN3SDSJBsDkJg4duYWuCeq8ptJ4bzeRjZtPchew=" # DOCKER_USER - - secure: "PrUMwM360a1KMLhfIPmx7qp9+Ry2cMDJpW4WspE28UQTrqcSZdhUYFCs5Q2DISZXrZWGI1/utHK+JYeqCAt3xOf3qRsLqupzJIPqzMPyb2AKtyR1JbJZGyBv7y4s6HMrXZ9pNfRBoR7hHFtiZfmTBo8avpMne8gBN1JGGXM0GTqbZwY6JGAG+vQ0Nt+DculhEraDAzFdNF5vBO+lg8wTmvh2qp+espa+4i9JzjTeRk8O09+33jkqRFugZtJOcgIi9iBvZjKUPedmFA1w/hU3lHLUuofi7tTmpAOyqaQyB8Grfj1JsgaCfbOZQs7kPHtsQ1Ai0zw2MbJtTKoA8kHcU9XWDU4Kxa1K1qXyp+ZdofTXYYnHkN4pgS+EU2it/OlKnpJV4I73JK28aF7A+fe8zheWkpJV8rFBiI04xXdILr+jxQKfdM4TOWos/XShp4bJru4VJuIfnveKuR+1EPIpuOhJ2jj4HB7g6AbIAbGsjICbFq98jSiXENeGaYmx1qIBSIlFn+lLJxp40fx/OsGKC0y5orfDgyUcPUkseckEk/H7zc90DGdCLCFmJVVgrKGWnfq8ifFI8GPVTomUVy41PLGv1LTCIYyrjM02mxLIEMIKrKboy4MSbaOidasaobjYFtwjABR3GLnUK5ETLANhO0LLC4Z4w6KFvARFfZ6JPec=" # DOCKER_PASS - - secure: "G5qjTBS6CuCCtueEqCRAEUhznycGz2kRXB7nChUK/ftKbAMW6F487sj8uujDEO0CXTv9aWnKyrPoXPnhlB5APQ5PtmC8F8DJEqWGW29J/oBv1giJq2K2Elcz6a0a7ys8pTgGKJyDT+mEvFF9boxVKI/eZQ+4ACI0EkGHBakpzey7Y1YSMsymtG6eM3ic1Fgrxna8FynzazKS0YdoE5Aj6yPDVpfj/7vSucz3wR3r2JxMtq95hiWKWYPdc/iir0dcDnedU+MF9aaAUv+ReHpM6FPScnan4mqOhrYKK5sBx27p0C/IxJhtaB4RVzU2F0kYLynK1vgUOBFc+9H/G2P+wl6TfO5dGjMmGU6kF2eWtTzRqT7JELRdqu9v/QGOlKpKmhmA3diGfkY0E2keEUyIRchHZAZKYQfLUhUObYcve2/4skmg9qhcxSMuh2qjkfTyFj/M4mcfkTZZWB9izgkHO2O3MxQm1d5DJDtoSfNQZOZiLjckyxmghWF3TEKNp3OhDOt+JikrDboZBts3F9+ocAVjLyg3upmWnlE6rFfkmVtWCXmI6Rto+laHtV/ng83Z3M4wL3VcvoOlPXLb0moqCGN4HGvpfolBqryFksGbUybaIqbQ7hQHhQuThzQ9UHq0AQN44rwzxEuKbxY7bTuyb4vSEAkrvjeLFbz4MSHQgno=" # AWS_ACCESS_KEY_ID - - secure: "ngqtUAXc8sR84CZTzOtRmg+Di/UFXCASV5bLHBmbgmXrvidIisHGW8O7TTx54ZU4UXlbY+Rg/8K6iIyy+uuCLhRcVRDW4sxacdQTNnoDPDNczqwrbBrOCLU7aW0imNBcIDqEvza+1fXsBrFV/iejtOFYVPn4l/yAb/j9MVo65hTGaKwQ4371lNMbRQp9p9DTEGGmkABo/EOtvbNR2H4qVgTuzeR8XdHC8GJUN0bujwQoK3EPTgkaMO6M7XevSNieO35opmy/Ip0GKYNTt4smKPQrUIokokwApCrjn2URdcGLoHENTTHtjLWMM0QMOV47qRBD+FeVaTUe0I4MB1toEZEIck+Vdy7PTCQ/f1HZtlI+bbDLlDPFwB/EMr7J1EKbudu7NnRopN6/zWupmDnL9VWxZy9boCDXCF47OxL1Kba9qqPYigiaS4vQEXygrceQgr+22axowtgTYYyhcsIbXQPq8COlLS/Ls/OgJMKIcQjMhTlKw01B/a08yZ0WxfVD9HJJbDA4EJiztOT7IZCyJvSv1mxJ8uI5hHC4TUBMWIKM6hVVZb0bjvtJjq7kFP9T4gCe/+OKxLIsSqWwY8AZoot6bY5lreZvb0epmyeM4fmf6qQxjIUviaGgj2o4eU7awDQzevwS8hNTsXPdFGItVUrjtKyLFHPkCMiZcTskSZo=" # AWS_SECRET_ACCESS_KEY - - secure: "TfbqhcBGGRbvmJ5KevU60dyCczRbiX7Pt1N36Bgy8Ozj6Cv79jC1K+AaB98j+Q1e0A7PaL7sbuOy7hIV/OqePhGEk0D2mowYj8/ORp14UXQ89FpIL7exUCXSwSPhCIwUaGdY4S5yT0DL1rkb5qeSS8L9KEEEVPvVY1F2vGE/lzzgS1MCLCdk7ajs+3c9HP9N4J2PjYRg3WFkgWmfGNitEjGApSJ91NIJW4Sw9pqLhweWqKO8sAbpsADlE+NhfoDd0kzDTkecxWzSf3siO6yfGKAeh3bf8WE4qZReuLXYDWL3XjJ3LTfK018P1J8Cx9PlMb3M+nHU0B3T6mC1t+XtLrUE/fr1LF89diyDCSRB+ZW2H/l8SNQNVIqgTrXzoBcwqGNeZOPJwd2qcq1vLDAkxgC5QFsoRfyxJmzNff70ESClSmBQy/mNd/pXQZ9JZRMoa097j4pXGZlLGarotiCYUdtlPSZmN/eMsIhLtvxNQ8ryk1ASij5sN7WOdg0r+gZcDAY8AwuuDpmktEu9pHd7iEVFw78DIJmD1N5OgKYdVT6o0WTJnVySBf/+luYK9J/rd6vwvlB4C2LLzhEkWlAGp6n7rl/1V18akM+HPVUPWuDRH69ZYWRPq4TIZwfEPTEG4jYizlTjkn55R+CNi3AWoxL2kr1Qv+zUJSruIvixWvc=" # GITHUB_TOKEN - -jobs: - include: - - stage: build production docker image - before_script: - - set -e - - if [ -z "${DOCKER_PASS}" ]; then echo "Build triggered by external PR. Skipping build production docker image stage" && exit 0; fi - - export REPO=ohif/viewer - - export COMMIT=${TRAVIS_COMMIT::8} - - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) - - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH" - - export TAG=`if [ "$BRANCH" == "master" ]; then echo "latest"; else echo $BRANCH ; fi` - - echo "TAG=$TAG, COMMIT=$COMMIT" - - docker pull $REPO:latest - - docker --version - script: - - docker build -t $REPO:$COMMIT . --cache-from $REPO:latest - after_success: - - docker tag $REPO:$COMMIT $REPO:$TAG - - docker tag $REPO:$COMMIT $REPO:travis-$TRAVIS_BUILD_NUMBER - - docker images - - docker login -u $DOCKER_USER -p $DOCKER_PASS - - docker push $REPO:$TAG - - docker push $REPO:travis-$TRAVIS_BUILD_NUMBER - - docker push $REPO:$COMMIT - - - stage: build development docker image - before_script: - - set -e - - if [ -z "${DOCKER_PASS}" ]; then echo "Build triggered by external PR. Skipping build production docker image stage" && exit 0; fi - - export REPO=ohif/viewer-dev - - export COMMIT=${TRAVIS_COMMIT::8} - - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) - - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH" - - export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi` - - echo "TAG=$TAG, COMMIT=$COMMIT" - - docker pull $REPO:latest - - docker --version - script: - - docker build -f development.Dockerfile -t $REPO:$COMMIT . --cache-from $REPO:latest - after_success: - - docker tag $REPO:$COMMIT $REPO:$TAG - - docker tag $REPO:$COMMIT $REPO:travis-$TRAVIS_BUILD_NUMBER - - docker images - - docker login -u $DOCKER_USER -p $DOCKER_PASS - - docker push $REPO:$TAG - - docker push $REPO:travis-$TRAVIS_BUILD_NUMBER - - docker push $REPO:$COMMIT - - - stage: build standalone viewer - if: branch = master - before_script: - - export ROOT_URL=http://ohif-viewer.s3-website.eu-central-1.amazonaws.com - - export METEOR_PACKAGE_DIRS="../../Packages" - - cd StandaloneViewer - - mkdir buildDirectory - - cd StandaloneViewer - - npm install -g meteor-build-client-fixed2@0.4.3-b - - meteor-build-client-fixed2 --version - - curl https://install.meteor.com | /bin/sh - - meteor npm install - script: - - meteor-build-client-fixed2 ~/standaloneViewerBuild -u $ROOT_URL --legacy - after_success: - - ls ~/standaloneViewerBuild - - ls /home/travis - - ls /home/travis/build - - ls /home/travis/build/Viewers/StandaloneViewer - deploy: - provider: s3 - access_key_id: $AWS_ACCESS_KEY_ID - secret_access_key: $AWS_SECRET_ACCESS_KEY - bucket: ohif-viewer - region: eu-central-1 - skip_cleanup: true - local_dir: /home/travis/standaloneViewerBuild - acl: public_read - on: - branch: master - - - stage: build documentation - if: branch = master - before_script: - - cd docs - - rm -rf _book - - npm install - - npm install -g gitbook-cli - - gitbook install - script: - - gitbook build - after_success: - - cp assets/CNAME _book/CNAME - deploy: - provider: pages - skip-cleanup: true - local-dir: docs/_book - github-token: $GITHUB_TOKEN - keep-history: true - fqdn: docs.ohif.org - verbose: true - on: - branch: master diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..1f1409c5d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "esbenp.prettier-vscode", + "sysoev.language-stylus", + "dbaeumer.vscode-eslint", + "mikestead.dotenv" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..1b8e6b90e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + "editor.rulers": [80, 120], + + // === + // Spacing + // === + + "editor.insertSpaces": true, + "editor.tabSize": 2, + "editor.trimAutoWhitespace": true, + "files.trimTrailingWhitespace": true, + "files.eol": "\n", + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + + // === + // Event Triggers + // === + + "editor.formatOnSave": true, + "eslint.autoFixOnSave": true, + "eslint.run": "onSave", + "eslint.validate": [ + { "language": "javascript", "autoFix": true }, + { "language": "javascriptreact", "autoFix": true } + ], + "prettier.disableLanguages": [], + "prettier.endOfLine": "lf" + } + \ No newline at end of file diff --git a/LICENSE b/LICENSE index 649b20306..8b0905575 100644 --- a/LICENSE +++ b/LICENSE @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/LesionTracker/.eslintrc.json b/LesionTracker/.eslintrc.json deleted file mode 100644 index f7b48d513..000000000 --- a/LesionTracker/.eslintrc.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "parser": "babel-eslint", - "parserOptions": { - "allowImportExportEverywhere": true - }, - "plugins": [ - "meteor" - ], - "env": { - /* Allows global vars from the Meteor environment to pass and enables certain rules */ - "meteor": true, - "node": true, - "browser": true - }, - "extends": [ - "airbnb", - "plugin:meteor/recommended" - ], - "settings": { - "import/resolver": "meteor" - }, - "rules": { - "meteor/no-session": 0, // We are actually using Session for now... - "meteor/eventmap-params": [2, {"eventParamName": "event"}], - "meteor/eventmap-params": [2, {"templateInstanceParamName": "instance"}], - "import/no-extraneous-dependencies": 0, - "import/no-unresolved": 0, // There are a bunch of ESLint problems with Meteor's resolver - "import/no-duplicates": 0, // So we are disabling these for now - "import/extensions": 0, - "import/no-absolute-path": 0, - "no-console": 0, // For development - "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }], - "indent": ["error", 4], - "new-cap": 0, // Until Match has an exception - "func-names": 0, // This is a bit of an annoying rule - "no-underscore-dangle": 0, // Doesn't seem to mesh with _id for MongoDB Ids (or SimpleSchema) - "max-len": 0, // TODO: re-enable the rules below and fix all of the errors - "consistent-return": 0, - "no-param-reassign": 0, - "no-mixed-operators": 0, - "arrow-body-style": 0, - "valid-typeof": 0, - "import/prefer-default-export": 0 - "no-undef": 0 - }, - "globals": {} -} \ No newline at end of file diff --git a/LesionTracker/.meteor/.finished-upgraders b/LesionTracker/.meteor/.finished-upgraders deleted file mode 100644 index 8f397c7da..000000000 --- a/LesionTracker/.meteor/.finished-upgraders +++ /dev/null @@ -1,19 +0,0 @@ -# This file contains information which helps Meteor properly upgrade your -# app when you run 'meteor update'. You should check it into version control -# with your project. - -notices-for-0.9.0 -notices-for-0.9.1 -0.9.4-platform-file -notices-for-facebook-graph-api-2 -1.2.0-standard-minifiers-package -1.2.0-meteor-platform-split -1.2.0-cordova-changes -1.2.0-breaking-changes -1.3.0-split-minifiers-package -1.3.5-remove-old-dev-bundle-link -1.4.0-remove-old-dev-bundle-link -1.4.1-add-shell-server-package -1.4.3-split-account-service-packages -1.5-add-dynamic-import-package -1.7-split-underscore-from-meteor-base diff --git a/LesionTracker/.meteor/.gitignore b/LesionTracker/.meteor/.gitignore deleted file mode 100644 index 501f92e4b..000000000 --- a/LesionTracker/.meteor/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -dev_bundle -local diff --git a/LesionTracker/.meteor/.id b/LesionTracker/.meteor/.id deleted file mode 100644 index f2d5540e8..000000000 --- a/LesionTracker/.meteor/.id +++ /dev/null @@ -1,7 +0,0 @@ -# This file contains a token that is unique to your project. -# Check it into your repository along with the rest of this directory. -# It can be used for purposes such as: -# - ensuring you don't accidentally deploy one app on top of another -# - providing package authors with aggregated statistics - -1q3vtk41m2yk4k1rqj08l diff --git a/LesionTracker/.meteor/nightwatch.json b/LesionTracker/.meteor/nightwatch.json deleted file mode 100644 index 3ddebe60d..000000000 --- a/LesionTracker/.meteor/nightwatch.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "starrynight": { - "version": "3.7.0" - }, - "nightwatch": { - "version": "0.8.6" - }, - "src_folders": [ - "./tests/nightwatch/walkthroughs" - ], - "output_folder": "./tests/nightwatch/reports", - "custom_commands_path": [ - "./tests/nightwatch/commands", - "./tests/nightwatch/commands/api/meteor", - "./tests/nightwatch/commands/actions", - "./tests/nightwatch/commands/components", - "./tests/nightwatch/commands/methods" - ], - "custom_assertions_path": [ - "./tests/nightwatch/assertions" - ], - "globals_path": "./tests/nightwatch/globals.json", - "selenium": { - "start_process": true, - "server_path": "${npm_config_prefix}/lib/node_modules/starrynight/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.45.0.jar", - "log_path": "tests/nightwatch/logs", - "host": "127.0.0.1", - "port": 4444, - "cli_args": { - "webdriver.chrome.driver": "${npm_config_prefix}/lib/node_modules/starrynight/node_modules/chromedriver/bin/chromedriver" - } - }, - "test_settings": { - "default": { - "launch_url": "http://localhost:5000", - "selenium_host": "127.0.0.1", - "selenium_port": 4444, - "pathname": "/wd/hub", - "silent": true, - "disable_colors": false, - "firefox_profile": false, - "ie_driver": "", - "screenshots": { - "enabled": false, - "path": "./tests/nightwatch/screenshots" - }, - "desiredCapabilities": { - "browserName": "chrome", - "javascriptEnabled": true, - "acceptSslCerts": true, - "loggingPrefs": { - "browser": "ALL" - } - }, - "exclude": "./tests/nightwatch/unittests/*" - }, - "phantomjs": { - "desiredCapabilities": { - "browserName": "phantomjs", - "javascriptEnabled": true, - "databaseEnabled": false, - "locationContextEnabled": false, - "applicationCacheEnabled": false, - "browserConnectionEnabled": false, - "webStorageEnabled": false, - "acceptSslCerts": true, - "rotatable": false, - "nativeEvents": false, - "phantomjs.binary.path": "${npm_config_prefix}/lib/node_modules/starrynight/node_modules/phantomjs/bin/phantomjs" - } - }, - "travis": { - "launch_url": "http://localhost:3000", - "selenium_host": "127.0.0.1", - "selenium_port": 4444, - "pathname": "/wd/hub", - "silent": true, - "disable_colors": false, - "firefox_profile": false, - "screenshots": { - "enabled": false, - "path": "./tests/nightwatch/screenshots" - }, - "desiredCapabilities": { - "browserName": "firefox", - "javascriptEnabled": true, - "databaseEnabled": true, - "locationContextEnabled": true, - "applicationCacheEnabled": true, - "browserConnectionEnabled": true, - "webStorageEnabled": true, - "acceptSslCerts": true, - "rotatable": true, - "nativeEvents": true - } - }, - "travischrome": { - "launch_url": "http://localhost:3000", - "selenium_host": "127.0.0.1", - "selenium_port": 4444, - "pathname": "/wd/hub", - "silent": true, - "disable_colors": false, - "firefox_profile": false, - "screenshots": { - "enabled": false, - "path": "./tests/nightwatch/screenshots" - }, - "desiredCapabilities": { - "browserName": "chrome", - "javascriptEnabled": true, - "databaseEnabled": true, - "locationContextEnabled": true, - "applicationCacheEnabled": true, - "browserConnectionEnabled": true, - "webStorageEnabled": true, - "acceptSslCerts": true, - "rotatable": true, - "nativeEvents": true, - "chromeOptions": { - "args": [ - "--no-sandbox" - ] - } - } - }, - "unittests": { - "selenium": { - "start_process": false, - "start_session": false - }, - "filter": "./tests/nightwatch/unittests/*", - "exclude": "" - } - } -} diff --git a/LesionTracker/.meteor/packages b/LesionTracker/.meteor/packages deleted file mode 100644 index 4786bac69..000000000 --- a/LesionTracker/.meteor/packages +++ /dev/null @@ -1,65 +0,0 @@ -# Meteor packages used by this project, one per line. -# Check this file (and the other files in this directory) into your repository. -# -# 'meteor add' and 'meteor remove' will edit this file for you, -# but you can also edit it by hand. - -npm-bcrypt@0.9.3 - -meteor-base@1.4.0 # Packages every Meteor app needs to have -mobile-experience@1.0.5 # Packages for a great mobile UX -mongo@1.5.0 # The database Meteor supports right now -blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views -session@1.1.7 # Client-side reactive dictionary for your app -jquery@1.11.10 # Helpful client-side library -tracker@1.2.0 # Meteor's client-side reactive programming library -standard-minifier-css@1.4.1 -standard-minifier-js@2.3.4 -http@1.4.1 -promise@0.11.1 -stylus@2.513.13 -random@1.1.0 -reactive-var@1.0.11 -reactive-dict@1.2.0 -check@1.3.1 -email@1.2.3 -ecmascript@0.11.1 # Enable ECMAScript2015+ syntax in app code - -clinical:active-entry -clinical:theming -clinical:fonts -clinical:hipaa-audit-log -clinical:hipaa-logger - -# OHIF Packages -ohif:polyfill -ohif:design -ohif:core -ohif:header -ohif:cornerstone -ohif:cornerstone-settings -ohif:viewerbase -ohif:studies -ohif:study-list -ohif:hanging-protocols -ohif:metadata - -# Necessary for Lesion Trakcer -ohif:lesiontracker -ohif:user-management -ohif:user-meteor-accounts -ohif:select-tree - -accounts-base@1.4.2 -accounts-password@1.5.1 - -fortawesome:fontawesome -momentjs:moment@2.15.1 -aldeed:simple-schema # Third party package to deal with schemas -aldeed:template-extension@4.0.0 -aldeed:collection2 -zuuk:stale-session -johdirr:meteor-git-rev -cultofcoders:persistent-session@0.4.4 -shell-server@0.3.1 -underscore diff --git a/LesionTracker/.meteor/platforms b/LesionTracker/.meteor/platforms deleted file mode 100644 index efeba1b50..000000000 --- a/LesionTracker/.meteor/platforms +++ /dev/null @@ -1,2 +0,0 @@ -server -browser diff --git a/LesionTracker/.meteor/release b/LesionTracker/.meteor/release deleted file mode 100644 index 04fe8b4f6..000000000 --- a/LesionTracker/.meteor/release +++ /dev/null @@ -1 +0,0 @@ -METEOR@1.7.0.3 diff --git a/LesionTracker/.meteor/versions b/LesionTracker/.meteor/versions deleted file mode 100644 index 9539121c6..000000000 --- a/LesionTracker/.meteor/versions +++ /dev/null @@ -1,146 +0,0 @@ -accounts-base@1.4.2 -accounts-password@1.5.1 -aldeed:collection2@2.10.0 -aldeed:collection2-core@1.2.0 -aldeed:schema-deny@1.1.0 -aldeed:schema-index@1.1.1 -aldeed:simple-schema@1.5.4 -aldeed:template-extension@4.1.0 -allow-deny@1.1.0 -amplify@1.0.0 -autoupdate@1.4.1 -babel-compiler@7.1.1 -babel-runtime@1.2.2 -base64@1.0.11 -binary-heap@1.0.10 -blaze@2.3.2 -blaze-html-templates@1.1.2 -blaze-tools@1.0.10 -boilerplate-generator@1.5.0 -caching-compiler@1.1.12 -caching-html-compiler@1.1.3 -callback-hook@1.1.0 -check@1.3.1 -clinical:active-entry@1.5.16 -clinical:auto-resizing@0.2.0 -clinical:fonts@1.1.6 -clinical:hipaa-audit-log@2.4.2 -clinical:hipaa-logger@1.3.0 -clinical:router@2.0.19 -clinical:router-location@2.1.0 -clinical:router-middleware-stack@2.1.2 -clinical:router-url@2.1.0 -clinical:theming@0.4.10 -cultofcoders:persistent-session@0.4.5 -ddp@1.4.0 -ddp-client@2.3.3 -ddp-common@1.4.0 -ddp-rate-limiter@1.0.7 -ddp-server@2.2.0 -deps@1.0.12 -diff-sequence@1.1.0 -dynamic-import@0.4.1 -ecmascript@0.11.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.7.1 -ecmascript-runtime-server@0.7.0 -ejson@1.1.0 -email@1.2.3 -es5-shim@4.8.0 -fastclick@1.0.13 -fortawesome:fontawesome@4.7.0 -geojson-utils@1.0.10 -grove:less@0.2.0 -hot-code-push@1.0.4 -html-tools@1.0.11 -htmljs@1.0.11 -http@1.4.1 -id-map@1.1.0 -iron:controller@1.0.12 -iron:core@1.0.11 -iron:dynamic-template@1.0.12 -iron:layout@1.0.12 -johdirr:meteor-git-rev@0.0.4 -jquery@1.11.11 -launch-screen@1.1.1 -livedata@1.0.18 -localstorage@1.2.0 -logging@1.1.20 -mdg:validation-error@0.5.1 -meteor@1.9.2 -meteor-base@1.4.0 -meteor-platform@1.2.6 -minifier-css@1.3.1 -minifier-js@2.3.5 -minimongo@1.4.4 -mobile-experience@1.0.5 -mobile-status-bar@1.0.14 -modern-browsers@0.1.2 -modules@0.12.2 -modules-runtime@0.10.2 -momentjs:moment@2.22.2 -mongo@1.5.1 -mongo-dev-server@1.1.0 -mongo-id@1.0.7 -mrt:moment@2.8.1 -natestrauser:select2@4.0.3 -npm-bcrypt@0.9.3 -npm-mongo@3.0.7 -observe-sequence@1.0.16 -ohif:commands@0.0.1 -ohif:core@0.0.1 -ohif:cornerstone@0.0.1 -ohif:cornerstone-settings@0.0.1 -ohif:design@0.0.1 -ohif:hanging-protocols@0.0.1 -ohif:header@0.0.1 -ohif:hotkeys@0.0.1 -ohif:lesiontracker@0.0.1 -ohif:log@0.0.1 -ohif:measurements@0.0.1 -ohif:metadata@0.0.1 -ohif:polyfill@0.0.1 -ohif:select-tree@0.0.1 -ohif:servers@0.0.1 -ohif:studies@0.0.1 -ohif:study-list@0.0.1 -ohif:themes@0.0.1 -ohif:themes-common@0.0.1 -ohif:user-management@0.0.1 -ohif:user-meteor-accounts@0.0.1 -ohif:viewerbase@0.0.1 -ohif:wadoproxy@0.0.1 -ordered-dict@1.1.0 -promise@0.11.1 -raix:eventemitter@0.1.3 -random@1.1.0 -rate-limit@1.0.9 -reactive-dict@1.2.0 -reactive-var@1.0.11 -reload@1.2.0 -retry@1.1.0 -routepolicy@1.0.13 -service-configuration@1.0.11 -session@1.1.7 -sha@1.0.9 -shell-server@0.3.1 -silentcicero:jszip@0.0.4 -socket-stream-client@0.2.2 -spacebars@1.0.15 -spacebars-compiler@1.1.3 -srp@1.0.10 -standard-app-packages@1.0.9 -standard-minifier-css@1.4.1 -standard-minifier-js@2.3.4 -stylus@2.513.14 -templating@1.3.2 -templating-compiler@1.3.3 -templating-runtime@1.3.2 -templating-tools@1.1.2 -tracker@1.2.0 -ui@1.0.13 -underscore@1.0.10 -url@1.2.0 -webapp@1.6.2 -webapp-hashing@1.0.9 -zuuk:stale-session@1.0.8 diff --git a/LesionTracker/README.md b/LesionTracker/README.md deleted file mode 100644 index 7f710da1e..000000000 --- a/LesionTracker/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# LesionTracker -LesionTracker is an open source, zero-footprint image viewer focused on oncology clinical trial workflows. It is built using Meteor platform which enables modularity with a set of packages of the OHIF framework. - - -### Why LesionTracker? -LesionTracker brings an user experience for the basic tumor metrics through web browser. It provides a DICOM server for storing and streaming images to the viewer, tools for measuring and following lesions over time, and a database for measurements of overlay data. A web-based system for image assessments rather than a workstation-based installed application will improve workflow efficiency, enhance accessibility, and promote collaborative image review for the radiologists at cooperating cancer centers. - -To get started, checkout [LesionTracker Documentation](https://github.com/OHIF/Viewers/wiki/LesionTracker) \ No newline at end of file diff --git a/LesionTracker/activeEntry.js b/LesionTracker/activeEntry.js deleted file mode 100644 index b9cb914e0..000000000 --- a/LesionTracker/activeEntry.js +++ /dev/null @@ -1,58 +0,0 @@ -import { Session } from 'meteor/session'; - -if (Meteor.isClient){ - ActiveEntry.configure({ - logo: { - url: '/mini-circles.png', - displayed: true - }, - signIn: { - displayFullName: true, - destination: '/studylist' - }, - signUp: { - destination: '/studylist' - }, - themeColors: { - primary: "" - }, - passwordOptions: { - showPasswordStrengthIndicator: false, - requireRegexValidation: true, - //requireStrongPasswords: false - passwordHistoryCount: 6, - failedAttemptsLimit: 5 - } - - }); - - Session.set('ThemeConfig', { - palette: { - colorA: "", - colorB: "", - colorC: "", - colorD: "", - colorE: "" - } - }); -} - -/* -if (Meteor.isServer){ - Accounts.emailTemplates.siteName = 'AwesomeSite'; - Accounts.emailTemplates.from = 'AwesomeSite Admin '; - Accounts.emailTemplates.enrollAccount.subject = function(user) { - return 'Welcome to Awesome Town, ' + user.profile.name; - }; - - Accounts.emailTemplates.enrollAccount.text = function(user, url) { - return 'You have been selected to participate in building a better future!' - + ' To activate your account, simply click the link below:\n\n' - + url; - }; - - Meteor.startup(function() { - //process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587'; - }); -} -*/ diff --git a/LesionTracker/bin/medkenOrthanc.bat b/LesionTracker/bin/medkenOrthanc.bat deleted file mode 100644 index b581129a8..000000000 --- a/LesionTracker/bin/medkenOrthanc.bat +++ /dev/null @@ -1,2 +0,0 @@ -set METEOR_PACKAGE_DIRS=..\Packages -meteor --settings ../config/medkenOrthanc.json diff --git a/LesionTracker/bin/medkenOrthanc.sh b/LesionTracker/bin/medkenOrthanc.sh deleted file mode 100755 index c7f2471bc..000000000 --- a/LesionTracker/bin/medkenOrthanc.sh +++ /dev/null @@ -1 +0,0 @@ -METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/medkenOrthanc.json diff --git a/LesionTracker/bin/orthanc.sh b/LesionTracker/bin/orthanc.sh deleted file mode 100755 index 47bea2d95..000000000 --- a/LesionTracker/bin/orthanc.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -declare config='../config/orthancDICOMWeb.json' - -if [ $# -gt 0 ]; then - if [ "$1" = '--dimse' ]; then - config="${config%/*}/orthancDIMSE.json" - [ -f "$config" ] && echo "DIMSE config file selected: $config" - fi -fi - -echo 'Starting Meteor server...' -METEOR_PACKAGE_DIRS="../Packages" meteor --settings "$config" diff --git a/LesionTracker/bin/orthancDICOMWeb.bat b/LesionTracker/bin/orthancDICOMWeb.bat deleted file mode 100644 index 378fe033f..000000000 --- a/LesionTracker/bin/orthancDICOMWeb.bat +++ /dev/null @@ -1,2 +0,0 @@ -set METEOR_PACKAGE_DIRS=..\Packages -meteor --settings ../config/orthancDICOMWeb.json \ No newline at end of file diff --git a/LesionTracker/bin/orthancDICOMWeb.sh b/LesionTracker/bin/orthancDICOMWeb.sh deleted file mode 100755 index 91f4af5bf..000000000 --- a/LesionTracker/bin/orthancDICOMWeb.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo "Starting Meteor server..." -METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/orthancDICOMWeb.json \ No newline at end of file diff --git a/LesionTracker/client/body.html b/LesionTracker/client/body.html deleted file mode 100644 index 7ea7fcea5..000000000 --- a/LesionTracker/client/body.html +++ /dev/null @@ -1,3 +0,0 @@ - -
- diff --git a/LesionTracker/client/body.styl b/LesionTracker/client/body.styl deleted file mode 100644 index aaa17e8fb..000000000 --- a/LesionTracker/client/body.styl +++ /dev/null @@ -1,2 +0,0 @@ -body - background-color: black \ No newline at end of file diff --git a/LesionTracker/client/components/app/app.html b/LesionTracker/client/components/app/app.html deleted file mode 100644 index 8b020bafc..000000000 --- a/LesionTracker/client/components/app/app.html +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/LesionTracker/client/components/app/app.js b/LesionTracker/client/components/app/app.js deleted file mode 100644 index 918aa3f10..000000000 --- a/LesionTracker/client/components/app/app.js +++ /dev/null @@ -1,125 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { Router } from 'meteor/clinical:router'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; - -Template.app.onCreated(() => { - const instance = Template.instance(); - instance.headerClasses = new ReactiveVar(''); - - OHIF.header.dropdown.setItems([{ - action: OHIF.user.audit, - text: 'View Audit Log', - iconClasses: 'log', - iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#log', - separatorAfter: true - }, { - action: () => OHIF.ui.showDialog('themeSelectorModal'), - text: 'Themes', - iconClasses: 'theme', - iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#theme', - separatorAfter: true - }, { - action: () => OHIF.ui.showDialog('serverInformationModal'), - text: 'Server Information', - iconClasses: 'server', - iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#server', - separatorAfter: true - }, { - action: () => OHIF.ui.showDialog('userPreferencesDialog'), - text: 'Preferences', - icon: 'fa fa-user', - separatorAfter: true - }, { - action: OHIF.user.changePassword, - text: 'Change Password', - iconClasses: 'password', - iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#password' - }, { - action: OHIF.user.logout, - text: 'Logout', - iconClasses: 'logout', - iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#logout' - }]); - - instance.autorun(() => { - const currentRoute = Router.current(); - if (!currentRoute) return; - const routeName = currentRoute.route.getName(); - const isViewer = routeName.indexOf('viewer') === 0; - - // Add or remove the strech class from body - $(document.body)[isViewer ? 'addClass' : 'removeClass']('stretch'); - - // Set the header on its bigger version if the viewer is not opened - instance.headerClasses.set(isViewer ? '' : 'header-big'); - - // Set the viewer open state on session - Session.set('ViewerOpened', isViewer); - }); -}); - -Template.app.events({ - 'click .js-toggle-studyList'(event, instance) { - event.preventDefault(); - event.stopPropagation(); - const isViewer = Session.get('ViewerOpened'); - - if (!isViewer) { - const timepointId = OHIF.viewer.data.currentTimepointId; - if (timepointId) { - Router.go('viewerTimepoint', { timepointId }); - } else { - const { studyInstanceUids } = OHIF.viewer.data; - Router.go('viewerStudies', { studyInstanceUids }); - } - - return; - } - - OHIF.ui.unsavedChanges.presentProactiveDialog('viewer.*', (hasChanges, userChoice) => { - if (!hasChanges) { - return Router.go('studylist'); - } - - switch (userChoice) { - case 'abort-action': - return; - case 'save-changes': - OHIF.ui.unsavedChanges.trigger('viewer', 'save', false); - OHIF.ui.unsavedChanges.clear('viewer.*'); - break; - case 'abandon-changes': - OHIF.ui.unsavedChanges.clear('viewer.*'); - break; - } - - Router.go('studylist'); - }, { - position: { - x: event.clientX + 15, - y: event.clientY + 15 - } - }); - } -}); - -Template.app.helpers({ - userName: OHIF.user.getName, - - studyListToggleText() { - const isViewer = Session.get('ViewerOpened'); - - // Return empty if viewer was not opened yet - if (!OHIF.utils.ObjectPath.get(OHIF, 'viewer.data.studyInstanceUids')) return; - - return isViewer ? 'Study list' : 'Back to viewer'; - }, - - dasherize(text) { - return text.replace(/ /g, '-').toLowerCase(); - } -}); - -Session.set('defaultSignInMessage', 'Tumor tracking in your browser.'); diff --git a/LesionTracker/client/components/app/app.styl b/LesionTracker/client/components/app/app.styl deleted file mode 100644 index 6207fc3c4..000000000 --- a/LesionTracker/client/components/app/app.styl +++ /dev/null @@ -1,88 +0,0 @@ -@require "{ohif:design}/app" - -body>.header - - .brand - height: 30px - display: inline-block - text-decoration: none - - .logo-image - display: inline-block - fill: transparent - float: left - height: 100% - margin: 0 8px 0 0 - width: 30px - - .logo-text - display: inline-block - font-family: $logoFontFamily - font-size: 14px - font-weight: $logoFontWeight - theme('color', '$textPrimaryColor') - line-height: 30px - - .header-menu - .user-name - font-size: 13px - - .menu-toggle - theme('border-left', 'solid 1px $defaultColor') - display: inline-block - height: 18px - padding: 0 8px - - .fa - theme('color', '$defaultColor') - font-size: 17px - line-height: 18px - - .caret-down - theme('color', '$uiGrayLight') - margin: 0 4px 4px 2px - - .btn - theme('color', '$textSecondaryColor') - cursor: pointer - font-size: 13px - font-weight: 500 - line-height: 26px - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') - - .studyListLinkSection - theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) - margin: 3px 0 0 10px - padding: 0 0 0 10px - - &#back-to-viewer-btn - border-left: 0 - - &.header-big - padding-left: $studyListPadding - padding-right: $studyListPadding - - .brand - height: 100% - width: 80% - line-height: $topBarExpandedHeight - 10px - - .logo-image - margin: 0 20px 0 0 - width: 50px - - .logo-text - font-size: 30px - - .studyListLinkSection - border: none - left: 0 - margin: 0 - padding: 0 - position: absolute - top: 0 diff --git a/LesionTracker/client/components/toolbarSection/toolbarSection.html b/LesionTracker/client/components/toolbarSection/toolbarSection.html deleted file mode 100644 index 4f4e28e48..000000000 --- a/LesionTracker/client/components/toolbarSection/toolbarSection.html +++ /dev/null @@ -1,37 +0,0 @@ - diff --git a/LesionTracker/client/components/toolbarSection/toolbarSection.js b/LesionTracker/client/components/toolbarSection/toolbarSection.js deleted file mode 100644 index db0845e43..000000000 --- a/LesionTracker/client/components/toolbarSection/toolbarSection.js +++ /dev/null @@ -1,319 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { Tracker } from 'meteor/tracker'; -import { OHIF } from 'meteor/ohif:core'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -Template.toolbarSection.helpers({ - isFinishDisabled() { - const instance = Template.instance(); - - // Run this computation on save or every time any measurement / timepoint suffer changes - OHIF.ui.unsavedChanges.depend(); - instance.saveObserver.depend(); - Session.get('LayoutManagerUpdated'); - - return OHIF.ui.unsavedChanges.probe('viewer.*') === 0; - }, - - leftSidebarToggleButtonData() { - const instance = Template.instance(); - return { - toggleable: true, - key: 'leftSidebar', - value: instance.data.state, - options: [{ - value: 'studies', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-studies', - svgWidth: 15, - svgHeight: 13, - bottomLabel: 'Studies' - }] - }; - }, - - rightSidebarToggleButtonData() { - const instance = Template.instance(); - return { - toggleable: true, - key: 'rightSidebar', - value: instance.data.state, - options: [{ - value: 'measurements', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-measurements-lesions', - svgWidth: 18, - svgHeight: 10, - bottomLabel: 'Measurements' - }] - }; - }, - - toolbarButtons() { - // Check if the measure tools shall be disabled - const isToolDisabled = false; //!Template.instance().data.timepointApi; - - const targetSubTools = []; - - targetSubTools.push({ - id: 'bidirectional', - title: 'Bidirectional', - classes: 'imageViewerTool rm-l-3', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target', - disabled: isToolDisabled - }); - - targetSubTools.push({ - id: 'targetCR', - title: 'CR Target', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target-cr', - disabled: isToolDisabled - }); - - targetSubTools.push({ - id: 'targetUN', - title: 'UN Target', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target-un', - disabled: isToolDisabled - }); - - const extraTools = []; - - extraTools.push({ - id: 'stackScroll', - title: 'Stack Scroll', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-stack-scroll' - }); - - extraTools.push({ - id: 'resetViewport', - title: 'Reset', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-reset' - }); - - extraTools.push({ - id: 'rotateR', - title: 'Rotate Right', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-rotate-right' - }); - - extraTools.push({ - id: 'flipH', - title: 'Flip H', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-horizontal' - }); - - extraTools.push({ - id: 'flipV', - title: 'Flip V', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-vertical' - }); - - extraTools.push({ - id: 'invert', - title: 'Invert', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-invert' - }); - - extraTools.push({ - id: 'magnify', - title: 'Magnify', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-magnify' - }); - - extraTools.push({ - id: 'ellipticalRoi', - title: 'Ellipse', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-elliptical-roi' - }); - - extraTools.push({ - id: 'toggleDownloadDialog', - title: 'Download', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-camera', - active: () => $('#imageDownloadDialog').is(':visible') - }); - - extraTools.push({ - id: 'toggleCineDialog', - title: 'CINE', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-youtube-play', - active: () => $('#cineDialog').is(':visible') - }); - - const buttonData = []; - - buttonData.push({ - id: 'zoom', - title: 'Zoom', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-zoom' - }); - - buttonData.push({ - id: 'wwwc', - title: 'Levels', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-levels' - }); - - buttonData.push({ - id: 'pan', - title: 'Pan', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-pan' - }); - - buttonData.push({ - id: 'linkStackScroll', - title: 'Link', - classes: 'imageViewerCommand toolbarSectionButton nonAutoDisableState', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-link', - disableFunction: Viewerbase.viewportUtils.isStackScrollLinkingDisabled - }); - - buttonData.push({ - id: 'toggleTarget', - title: 'Target', - classes: 'rm-l-3', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target', - disabled: isToolDisabled, - subTools: targetSubTools - }); - - buttonData.push({ - id: 'nonTarget', - title: 'Non-Target', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-non-target', - disabled: isToolDisabled - }); - - buttonData.push({ - id: 'length', - title: 'Temp', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp' - }); - - buttonData.push({ - id: 'toggleMore', - title: 'More', - classes: 'rp-x-1 rm-l-3', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-more', - disabled: isToolDisabled, - subTools: extraTools - }); - - return buttonData; - } -}); - -Template.toolbarSection.events({ - 'click #toggleTarget'(event, instance) { - const $target = $(event.currentTarget); - if (!$target.hasClass('active') && $target.hasClass('expanded')) { - Viewerbase.toolManager.setActiveTool('bidirectional'); - } - }, - - 'click #toggleHUD'(event) { - const $this = $(event.currentTarget); - - // Stop here if the tool is disabled - if ($this.hasClass('disabled')) { - return; - } - - const state = Session.get('measurementTableHudOpen'); - Session.set('measurementTableHudOpen', !state); - }, - - 'click #toggleTrial'(event) { - if (!$(event.currentTarget).hasClass('disabled')) { - OHIF.ui.showDialog('trialOptionsModal'); - } - } -}); - -Template.toolbarSection.onCreated( function() { - const instance = Template.instance(); - - instance.path = 'viewer.studyViewer.measurements'; - instance.saveObserver = new Tracker.Dependency(); - instance.api = { - save() { - // Clear signaled unsaved changes... - const successHandler = () => { - OHIF.ui.unsavedChanges.clear(`${instance.path}.*`); - instance.saveObserver.changed(); - }; - - // Display the error messages - const errorHandler = data => { - OHIF.ui.showDialog('dialogInfo', Object.assign({ class: 'themed' }, data)); - }; - - const promise = instance.data.measurementApi.storeMeasurements(); - promise.then(successHandler).catch(errorHandler); - OHIF.ui.showDialog('dialogLoading', { - promise, - text: 'Saving measurement data' - }); - - return promise; - } - }; - - instance.unsavedChangesHandler = () => { - const isNotDisabled = !instance.$('.js-finish-case').hasClass('disabled'); - if (isNotDisabled && instance.progressPercent.get() === 100) { - instance.api.save(); - } - }; - - // Attach handler for unsaved changes dialog... - OHIF.ui.unsavedChanges.attachHandler(instance.path, 'save', instance.unsavedChangesHandler); -}); - -Template.toolbarSection.onRendered(function() { - // Set disabled/enabled tool buttons that are set in toolManager - const states = Viewerbase.toolManager.getToolDefaultStates(); - const disabledToolButtons = states.disabledToolButtons; - const allToolbarButtons = $('.toolbarSection').find('.toolbarSectionButton:not(.nonAutoDisableState)'); - - // Additional toolbar buttons whose classes are not toolbarSectionButton - allToolbarButtons.push($('#toolbarSectionEntry')[0]); - allToolbarButtons.push($('#toggleMeasurements')[0]); - - if (disabledToolButtons && disabledToolButtons.length > 0) { - for (let i = 0; i < allToolbarButtons.length; i++) { - const toolbarButton = allToolbarButtons[i]; - const index = disabledToolButtons.indexOf($(toolbarButton).attr('id')); - if (index !== -1) { - $(toolbarButton).addClass('disabled'); - $(toolbarButton).find('*').addClass('disabled'); - } else { - $(toolbarButton).removeClass('disabled'); - $(toolbarButton).find('*').removeClass('disabled'); - } - } - } -}); - -Template.caseProgress.onDestroyed(() => { - const instance = Template.instance(); - // Remove unsaved changes handler after this view has been destroyed... - OHIF.ui.unsavedChanges.removeHandler(instance.path, 'save', instance.unsavedChangesHandler); -}); diff --git a/LesionTracker/client/components/toolbarSection/toolbarSection.styl b/LesionTracker/client/components/toolbarSection/toolbarSection.styl deleted file mode 100644 index 885e1e7c1..000000000 --- a/LesionTracker/client/components/toolbarSection/toolbarSection.styl +++ /dev/null @@ -1,27 +0,0 @@ -@import "{ohif:design}/app" - -.toolbarSection - theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) - flex: 0 0 auto - height: $toolbarHeight - padding-top: 6px - position: relative - transition(height 300ms ease) - width: 100% - - &.expanded - height: $toolbarHeight + $toolbarDrawerHeight - - .toolbarSectionEntry - theme('color', '$defaultColor') - cursor: pointer - display: inline-block - theme('fill', '$defaultColor') - margin-top: 3px - min-width: 30px - theme('stroke', '$defaultColor') - text-align: center - - .saveMeasurements - display: inline-block - margin-left: 22px diff --git a/LesionTracker/client/components/viewer/viewer.html b/LesionTracker/client/components/viewer/viewer.html deleted file mode 100644 index 6c66556ef..000000000 --- a/LesionTracker/client/components/viewer/viewer.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/LesionTracker/client/components/viewer/viewer.js b/LesionTracker/client/components/viewer/viewer.js deleted file mode 100644 index f9975bfc4..000000000 --- a/LesionTracker/client/components/viewer/viewer.js +++ /dev/null @@ -1,388 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Tracker } from 'meteor/tracker'; -import { Session } from 'meteor/session'; -import { ReactiveDict } from 'meteor/reactive-dict'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -import 'meteor/ohif:cornerstone'; -import 'meteor/ohif:viewerbase'; -import 'meteor/ohif:metadata'; - -Meteor.startup(() => { - Session.set('TimepointsReady', false); - Session.set('MeasurementsReady', false); - - OHIF.viewer.displaySeriesQuickSwitch = true; - OHIF.viewer.stackImagePositionOffsetSynchronizer = new OHIF.viewerbase.StackImagePositionOffsetSynchronizer(); - - // Create the synchronizer used to update reference lines - OHIF.viewer.updateImageSynchronizer = new cornerstoneTools.Synchronizer('cornerstonenewimage', cornerstoneTools.updateImageSynchronizer); - - OHIF.viewer.metadataProvider = new OHIF.cornerstone.MetadataProvider(); - - // Metadata configuration - const metadataProvider = OHIF.viewer.metadataProvider; - cornerstone.metaData.addProvider(metadataProvider.getProvider()); - - // Target tools configuration - OHIF.lesiontracker.configureTargetToolsHandles(); -}); - -Template.viewer.onCreated(() => { - Session.set('ViewerReady', false); - - const instance = Template.instance(); - - // Define the OHIF.viewer.data global object - OHIF.viewer.data = OHIF.viewer.data || Session.get('ViewerData') || {}; - - const { TimepointApi, MeasurementApi, ConformanceCriteria } = OHIF.measurements; - - const currentTimepointId = OHIF.viewer.data.currentTimepointId; - const timepointApi = new TimepointApi(currentTimepointId); - const measurementApi = new MeasurementApi(timepointApi); - const conformanceCriteria = new ConformanceCriteria(measurementApi, timepointApi); - const apis = { - timepointApi, - measurementApi, - conformanceCriteria - }; - - Object.assign(OHIF.viewer, apis); - Object.assign(instance.data, apis); - - instance.state = new ReactiveDict(); - instance.state.set('leftSidebar', Session.get('leftSidebar')); - instance.state.set('rightSidebar', Session.get('rightSidebar')); - - const viewportUtils = OHIF.viewerbase.viewportUtils; - - OHIF.viewer.functionList = $.extend(OHIF.viewer.functionList, { - toggleLesionTrackerTools: OHIF.lesiontracker.toggleLesionTrackerTools, - bidirectional: () => { - // Used for hotkeys - OHIF.viewerbase.toolManager.setActiveTool('bidirectional'); - }, - nonTarget: () => { - // Used for hotkeys - OHIF.viewerbase.toolManager.setActiveTool('nonTarget'); - }, - // Viewport functions - toggleCineDialog: viewportUtils.toggleCineDialog, - clearTools: viewportUtils.clearTools, - resetViewport: viewportUtils.resetViewport, - invert: viewportUtils.invert, - flipV: viewportUtils.flipV, - flipH: viewportUtils.flipH, - rotateL: viewportUtils.rotateL, - rotateR: viewportUtils.rotateR, - linkStackScroll: viewportUtils.linkStackScroll - }); - - if (OHIF.viewer.data.loadedSeriesData) { - OHIF.log.info('Reloading previous loadedSeriesData'); - OHIF.viewer.loadedSeriesData = OHIF.viewer.data.loadedSeriesData; - } else { - OHIF.log.info('Setting default viewer data'); - OHIF.viewer.loadedSeriesData = {}; - OHIF.viewer.data.loadedSeriesData = {}; - } - - // Store the viewer data in session for further user - Session.setPersistent('ViewerData', OHIF.viewer.data); - - Session.set('activeViewport', OHIF.viewer.data.activeViewport || false); - - // Set lesion tool buttons as disabled if pixel spacing is not available for active element - instance.autorun(OHIF.lesiontracker.pixelSpacingAutorunCheck); - - // @TypeSafeStudies - // Clears OHIF.viewer.Studies collection - OHIF.viewer.Studies.removeAll(); - - // @TypeSafeStudies - // Clears OHIF.viewer.StudyMetadataList collection - OHIF.viewer.StudyMetadataList.removeAll(); - - instance.data.studies.forEach(study => { - const studyMetadata = new OHIF.metadata.StudyMetadata(study, study.studyInstanceUid); - let displaySets = study.displaySets; - - if (!study.displaySets) { - displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata); - study.displaySets = displaySets; - } - - studyMetadata.setDisplaySets(displaySets); - - study.selected = true; - OHIF.viewer.Studies.insert(study); - OHIF.viewer.StudyMetadataList.insert(studyMetadata); - }); - - const patientId = instance.data.studies[0].patientId; - - // LT-382: Preventing HP to keep identifying studies in timepoints that might be removed - instance.data.studies.forEach(study => (delete study.timepointType)); - - // TODO: Consider combining the retrieval calls into one? - const timepointsPromise = timepointApi.retrieveTimepoints({ patientId }); - timepointsPromise.then(() => { - const timepoints = timepointApi.all(); - - // Set timepointType in studies to be used in hanging protocol engine - timepoints.forEach(timepoint => { - timepoint.studyInstanceUids.forEach(studyInstanceUid => { - const study = _.find(instance.data.studies, element => { - return element.studyInstanceUid === studyInstanceUid; - }); - if (!study) { - return; - } - - // @TODO: Maybe this should be a setCustomAttribute? - study.timepointType = timepoint.timepointType; - }); - }); - - Session.set('TimepointsReady', true); - - const timepointIds = timepoints.map(t => t.timepointId); - - const measurementsPromise = measurementApi.retrieveMeasurements(patientId, timepointIds); - measurementsPromise.then(() => { - Session.set('MeasurementsReady', true); - - measurementApi.syncMeasurementsAndToolData(); - }); - }); - - // Provide the necessary data to the Measurement API and Timepoint API - const prior = timepointApi.prior(); - if (prior) { - measurementApi.priorTimepointId = prior.timepointId; - } - - // Enable/Disable Lesion Tracker Tools if the opened study is associated or not - OHIF.lesiontracker.toggleLesionTrackerToolsButtons(!!currentTimepointId); - - let firstMeasurementActivated = false; - instance.autorun(() => { - if (!Session.get('TimepointsReady') || - !Session.get('MeasurementsReady') || - !Session.get('ViewerReady') || - firstMeasurementActivated) { - return; - } - - // Find and activate the first measurement by Lesion Number - // NOTE: This is inefficient, we should be using a hanging protocol - // to hang the first measurement's imageId immediately, rather - // than changing images after initial loading... - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - const tools = config.measurementTools[0].childTools; - const firstTool = tools[Object.keys(tools)[0]]; - const measurementTypeId = firstTool.id; - - const collection = measurementApi.tools[measurementTypeId]; - const sorting = { - sort: { - measurementNumber: -1 - } - }; - - const data = collection.find({}, sorting).fetch(); - - const current = timepointApi.current(); - if (!current) { - return; - } - - let timepoints = [current]; - const prior = timepointApi.prior(); - if (prior) { - timepoints.push(prior); - } - - // TODO: Clean this up, it's probably an inefficient way to get what we need - const groupObject = _.groupBy(data, m => m.measurementNumber); - - // Reformat the data - const rows = Object.keys(groupObject).map(key => ({ - measurementTypeId: measurementTypeId, - measurementNumber: key, - entries: groupObject[key] - })); - - const rowItem = rows[0]; - - // Activate the first lesion - if (rowItem) { - OHIF.measurements.jumpToRowItem(rowItem, timepoints); - } - - firstMeasurementActivated = true; - }); - - instance.measurementModifiedHandler = _.throttle((event, instance) => { - OHIF.measurements.MeasurementHandlers.onModified(event, instance); - }, 300); -}); - -/** - * Sets sidebar configuration and active tool based on viewer template instance - * @param {Object} instance Template instance for viewer template - */ -const setActiveToolAndSidebar = () => { - const instance = Template.instance(); - const { studies, currentTimepointId, measurementApi, timepointIds } = instance.data; - - // Default actions for Associated Studies - if (currentTimepointId) { - // Follow-up studies: same as the first measurement in the table - // Baseline studies: target-tool - if (studies[0]) { - let activeTool; - // In follow-ups, get the baseline timepointId - const timepointId = timepointIds.find(id => id !== currentTimepointId); - - // Follow-up studies - if (studies[0].timepointType === 'followup' && timepointId) { - const measurementTools = OHIF.measurements.MeasurementApi.getConfiguration().measurementTools; - - // Create list of measurement tools - const measurementTypes = measurementTools.map( - tool => { - const { id, cornerstoneToolType } = tool; - return { - id, - cornerstoneToolType - }; - } - ); - - // Iterate over each measurement tool to find the first baseline - // measurement. If so, stops the loop and prevent fetching from all - // collections - measurementTypes.every(({ id, cornerstoneToolType }) => { - // Get measurement - if (measurementApi[id]) { - const measurement = measurementApi[id].findOne({ timepointId }); - - // Found a measurement, save tool and stop loop - if (measurement) { - const isArray = Array.isArray(cornerstoneToolType); - activeTool = isArray ? cornerstoneToolType[0] : cornerstoneToolType; - - return false; - } - } - - return true; - }); - } - - // If not set, for associated studies default is target-tool - OHIF.viewerbase.toolManager.setActiveTool(activeTool || 'bidirectional'); - } - - // Toggle Measurement Table - if (instance.state) { - instance.state.set('rightSidebar', 'measurements'); - } - } - // Hide as default for single study - else { - if (instance.state) { - instance.state.set('rightSidebar', null); - } - } -}; - -/** - * Inits OHIF Hanging Protocol's onReady. - * It waits for OHIF Hanging Protocol to be ready to instantiate the ProtocolEngine - * Hanging Protocol will use OHIF LayoutManager to render viewports properly - */ - -const initHangingProtocol = () => { - // When Hanging Protocol is ready - HP.ProtocolStore.onReady(() => { - - setActiveToolAndSidebar(); - - // Gets all StudyMetadata objects: necessary for Hanging Protocol to access study metadata - const studyMetadataList = OHIF.viewer.StudyMetadataList.all(); - - // Caches Layout Manager: Hanging Protocol uses it for layout management according to current protocol - const layoutManager = OHIF.viewerbase.layoutManager; - - // Instantiate StudyMetadataSource: necessary for Hanging Protocol to get study metadata - const studyMetadataSource = new OHIF.studies.classes.OHIFStudyMetadataSource(); - - // Creates Protocol Engine object with required arguments - const ProtocolEngine = new HP.ProtocolEngine(layoutManager, studyMetadataList, [], studyMetadataSource); - - // Sets up Hanging Protocol engine - HP.setEngine(ProtocolEngine); - - Session.set('ViewerReady', true); - - Session.set('activeViewport', 0); - }); -}; - -Template.viewer.onRendered(function() { - this.autorun(() => { - // To make sure ohif viewerMain is rendered before initializing Hanging Protocols - const isOHIFViewerMainRendered = Session.get('OHIFViewerMainRendered'); - - // To avoid first run - if (isOHIFViewerMainRendered) { - // To run only when ViewerMainRendered dependency has changed. - // because initHangingProtocol can have other reactive components - Tracker.nonreactive(initHangingProtocol); - } - }); -}); - -Template.viewer.helpers({ - dataSourcesReady() { - // TODO: Find a better way to do this - const ready = Session.get('TimepointsReady') && Session.get('MeasurementsReady'); - OHIF.log.info('dataSourcesReady? : ' + ready); - return ready; - }, - - state() { - return Template.instance().state; - } -}); - -Template.viewer.events({ - 'cornerstonetoolsmeasurementadded .imageViewerViewport'(event, instance) { - const originalEvent = event.originalEvent; - OHIF.measurements.MeasurementHandlers.onAdded(originalEvent, instance); - }, - - 'cornerstonetoolsmeasurementmodified .imageViewerViewport'(event, instance) { - const originalEvent = event.originalEvent; - instance.measurementModifiedHandler(originalEvent, instance); - }, - - 'cornerstonemeasurementremoved .imageViewerViewport'(event, instance) { - const originalEvent = event.originalEvent; - OHIF.measurements.MeasurementHandlers.onRemoved(originalEvent, instance); - } -}); - -Template.viewer.onDestroyed(() => { - Session.set('ViewerMainReady', false); - Session.set('TimepointsReady', false); - Session.set('MeasurementsReady', false); - - OHIF.viewer.stackImagePositionOffsetSynchronizer.deactivate(); -}); diff --git a/LesionTracker/client/components/viewer/viewer.styl b/LesionTracker/client/components/viewer/viewer.styl deleted file mode 100644 index 13037282e..000000000 --- a/LesionTracker/client/components/viewer/viewer.styl +++ /dev/null @@ -1,55 +0,0 @@ -@import "{ohif:design}/app" - -#viewer - background-color: black - height: 100% - width: 100% - -#imageViewerViewports - .viewportContainer - border: none !important - outline: 0 !important // Prevent blue outline in Chrome - position: relative - - &:hover - &.active - &:hover.active - border: none !important - outline: 0 !important // Prevent blue outline in Chrome - - .removable - .imageViewerViewport - theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) - - canvas - border-color: transparent - border-style: solid - border-width: 1px - - &:not(:last-child) - .removable - .imageViewerViewport - theme('border-right', '%s solid $uiBorderColor' % $uiBorderThickness) - - &:first-child - .removable - .imageViewerViewport - theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) - - &.active - .removable - .imageViewerViewport - border-right: none !important - - canvas - theme('border-color', '$uiBorderColorActive') - - -.sidebar-left-open - #layoutManagerTarget - #imageViewerViewports - .viewportContainer - &:first-child - .removable - .imageViewerViewport - border-left: none diff --git a/LesionTracker/client/components/viewerSection/viewerSection.html b/LesionTracker/client/components/viewerSection/viewerSection.html deleted file mode 100644 index 83a8a916c..000000000 --- a/LesionTracker/client/components/viewerSection/viewerSection.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/LesionTracker/client/components/viewerSection/viewerSection.js b/LesionTracker/client/components/viewerSection/viewerSection.js deleted file mode 100644 index 5cfe8fb42..000000000 --- a/LesionTracker/client/components/viewerSection/viewerSection.js +++ /dev/null @@ -1,72 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -Template.viewerSection.onCreated(() => { - const instance = Template.instance(); - - instance.isTimepointBrowser = () => !!OHIF.viewer.data.currentTimepointId; - - OHIF.viewer.quickSwitchStudyBrowserTemplate = 'timepointBrowserQuickSwitch'; - if (!instance.isTimepointBrowser()) { - OHIF.viewer.quickSwitchStudyBrowserTemplate = 'studyBrowserQuickSwitch'; - instance.loading = new ReactiveVar(true); - instance.studiesInformation = new ReactiveVar([]); - const filter = { studyInstanceUid: OHIF.viewer.data.studyInstanceUids }; - OHIF.studies.searchStudies(filter).then(studiesData => { - instance.loading.set(false); - instance.studiesInformation.set(studiesData); - }).catch(error => { - instance.loading.set(false); - const text = 'An error has occurred while retrieving studies information'; - OHIF.ui.notifications.danger({ text }); - OHIF.log.error(error); - }); - } -}); - -Template.viewerSection.events({ - 'transitionend .sidebarMenu'(event) { - if (!event.target.classList.contains('sidebarMenu')) return; - window.ResizeViewportManager.handleResize(); - }, - - 'ohif.measurements.timepoint.changeViewType .timepoint-browser-list'(event, instance, viewType) { - const $browserList = $(event.currentTarget); - const $allBrowserItems = $browserList.find('.timepoint-browser-item'); - - // Removes all active classes to collapse the timepoints and studies - $allBrowserItems.removeClass('active'); - - if (viewType === 'key') { - const { timepointIds, currentTimepointId } = OHIF.viewer.data; - timepointIds.forEach(timepointId => { - const $browserItem = $allBrowserItems.filter(`[data-id=${timepointId}]`); - $browserItem.find('.timepoint-item').trigger('ohif.measurements.timepoint.load'); - }); - - // Show only current timepoint expanded on key timepoints tab - const $browserItem = $allBrowserItems.filter(`[data-id=${currentTimepointId}]`); - $browserItem.find('.timepoint-item').trigger('click'); - } - } -}); - -Template.viewerSection.helpers({ - leftSidebarOpen() { - return Template.instance().data.state.get('leftSidebar'); - }, - - rightSidebarOpen() { - return Template.instance().data.state.get('rightSidebar'); - }, - - isTimepointBrowser() { - return Template.instance().isTimepointBrowser(); - }, - - studiesInformation() { - return Template.instance().studiesInformation.get(); - } -}); diff --git a/LesionTracker/client/components/viewerSection/viewerSection.styl b/LesionTracker/client/components/viewerSection/viewerSection.styl deleted file mode 100644 index 62802d25d..000000000 --- a/LesionTracker/client/components/viewerSection/viewerSection.styl +++ /dev/null @@ -1,81 +0,0 @@ -@require '{ohif:design}/app' - -.viewerSection - display: flex - flex: 1 - flex-flow: row nowrap - align-items: stretch - height: 'calc(100% - %s)' % ($toolbarHeight + $topBarHeight) - width: 100% - - .sidebarMenu - height: 100% - // required transformation to make inner fixed elements relative to this one - transform(scale(1)) - transition($sidebarTransition) - - .sidebar-option - height: 100% - max-width: inherit - position: absolute - transform(translateX(100%)) - transition($sidebarTransition) - width: 100% - - &.active - transform(translateX(0%)) - - .sidebar-left - theme('border-right', '%s solid $uiBorderColor' % $uiBorderThickness) - flex: 1 - margin-left: - $studiesSidebarMenuWidth - max-width: $studiesSidebarMenuWidth - order: 1 - visibility: hidden - - &.sidebar-open - margin-left: 0 - visibility: visible - - .loadingTextDiv - theme('color', '$textSecondaryColor') - font-size: 32px - - .mainContent - flex: 1 - height: 100% - order: 2 - overflow: visible - position: relative - transition($sidebarTransition) - width: 100% - - .viewerMain - left: 0 - position: absolute - top: 0 - - .sidebar-right - flex: 1 - margin-right: - $rightSidebarMenuWidth - max-width: $rightSidebarMenuWidth - order: 3 - position: relative - visibility: hidden - - &[data-timepoints="3"] - margin-right: - ($rightSidebarMenuWidth + 135.5px) - max-width: $rightSidebarMenuWidth + 135.5px - - &[data-timepoints="4"] - margin-right: - ($rightSidebarMenuWidth + 270px) - max-width: $rightSidebarMenuWidth + 270px - - &.sidebar-open - margin-right: 0 - visibility: visible - - .studiesListedChanger - theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) - padding: 20px 10px - text-align: center diff --git a/LesionTracker/client/config.js b/LesionTracker/client/config.js deleted file mode 100644 index 44336c104..000000000 --- a/LesionTracker/client/config.js +++ /dev/null @@ -1,34 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Accounts } from 'meteor/accounts-base'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone'; - -Meteor.startup(function() { - const maxWebWorkers = Math.max(navigator.hardwareConcurrency - 1, 1); - const config = { - maxWebWorkers: maxWebWorkers, - startWebWorkersOnDemand: true, - webWorkerPath : OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'), - taskConfiguration: { - 'decodeTask' : { - loadCodecsOnStartup : true, - initializeCodecsOnStartup: false, - codecsPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'), - usePDFJS: false - } - } - }; - - cornerstoneWADOImageLoader.webWorkerManager.initialize(config); - - cornerstoneWADOImageLoader.configure({ - beforeSend: function(xhr) { - const userId = Meteor.userId(); - const loginToken = Accounts._storedLoginToken(); - if (userId && loginToken) { - xhr.setRequestHeader("x-user-id", userId); - xhr.setRequestHeader("x-auth-token", loginToken); - } - } - }); -}); \ No newline at end of file diff --git a/LesionTracker/client/head.html b/LesionTracker/client/head.html deleted file mode 100644 index 9310faa02..000000000 --- a/LesionTracker/client/head.html +++ /dev/null @@ -1,17 +0,0 @@ - - - Lesion Tracker - - - - - - - - - - - - - - diff --git a/LesionTracker/client/lesionTrackerHangingProtocol.js b/LesionTracker/client/lesionTrackerHangingProtocol.js deleted file mode 100644 index 10b11af95..000000000 --- a/LesionTracker/client/lesionTrackerHangingProtocol.js +++ /dev/null @@ -1,111 +0,0 @@ -import { Meteor } from 'meteor/meteor'; - -Meteor.startup(() => { - console.log('Adding Lesion Tracker Hanging Protocols'); - - //------------------------------------------------------------------------------ - // Define Baseline protocol - const proto = new HP.Protocol('LT_Baseline'); - proto.locked = true; - - const isBaseline = new HP.ProtocolMatchingRule(); - isBaseline.required = true; - isBaseline.weight = 1; - isBaseline.attribute = 'timepointType'; - isBaseline.constraint = { - equals: { - value: 'baseline' - } - }; - - proto.addProtocolMatchingRule(isBaseline); - - const oneByOne = new HP.ViewportStructure('grid', { - rows: 1, - columns: 1 - }); - - // Stage 1 - const single = new HP.Viewport(); - - const baseline = new HP.StudyMatchingRule(true); - baseline.required = true; - baseline.attribute = 'timepointType'; - baseline.constraint = { - equals: { - value: 'baseline' - } - }; - - single.studyMatchingRules.push(baseline); - - const first = new HP.Stage(oneByOne, 'oneByOne'); - first.viewports.push(single); - - proto.addStage(first); - - HP.lesionTrackerBaselineProtocol = proto; - HP.lesionTrackerBaselineProtocol.id = 'lesionTrackerBaselineProtocol'; - - //------------------------------------------------------------------------------ - // Define Followup Protocol - const protoFollowup = new HP.Protocol('LT_BaselineFollowup'); - protoFollowup.locked = true; - - const isFollowup = new HP.ProtocolMatchingRule(); - isFollowup.required = true; - isFollowup.weight = 2; - isFollowup.attribute = 'timepointType'; - isFollowup.constraint = { - equals: { - value: 'followup' - } - }; - - protoFollowup.addProtocolMatchingRule(isFollowup); - - const oneByTwo = new HP.ViewportStructure('grid', { - rows: 1, - columns: 2 - }); - - // Stage 1 - const left = new HP.Viewport(); - const right = new HP.Viewport(); - - const baseline2 = new HP.StudyMatchingRule(true); - baseline2.required = true; - baseline2.attribute = 'timepointType'; - baseline2.constraint = { - equals: { - value: 'baseline' - } - }; - - const followup = new HP.StudyMatchingRule(); - followup.required = true; - followup.attribute = 'timepointType'; - followup.constraint = { - equals: { - value: 'followup' - } - }; - - left.studyMatchingRules.push(followup); - right.studyMatchingRules.push(baseline2); - - const first2 = new HP.Stage(oneByTwo, 'oneByTwo'); - first2.viewports.push(left); - first2.viewports.push(right); - - protoFollowup.addStage(first2); - - HP.lesionTrackerFollowupProtocol = protoFollowup; - HP.lesionTrackerFollowupProtocol.id = 'lesionTrackerFollowupProtocol'; - - HP.ProtocolStore.onReady(() => { - console.log('Inserting lesion tracker protocols'); - HP.ProtocolStore.addProtocol(HP.lesionTrackerBaselineProtocol); - HP.ProtocolStore.addProtocol(HP.lesionTrackerFollowupProtocol); - }); -}); \ No newline at end of file diff --git a/LesionTracker/client/lib/customCommands.js b/LesionTracker/client/lib/customCommands.js deleted file mode 100644 index 1c4f3e674..000000000 --- a/LesionTracker/client/lib/customCommands.js +++ /dev/null @@ -1,53 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Meteor.startup(() => { - const { toolManager } = OHIF.viewerbase; - const contextName = 'viewer'; - - // Enable the custom tools - const customTools = [{ - id: 'bidirectional', - name: 'Target' - }, { - id: 'nonTarget', - name: 'Non-Target' - }, { - id: 'targetCR', - name: 'CR Target' - }, { - id: 'targetUN', - name: 'UN Target' - }]; - customTools.forEach(tool => { - _.defaults(OHIF.hotkeys.defaults[contextName], { [tool.id]: '' }); - OHIF.commands.register(contextName, tool.id, { - name: tool.name, - action: tool.action || (() => toolManager.setActiveTool(tool.id)) - }); - }); - - // Enable the custom commands - const customCommands = [{ - id: 'linkStackScroll', - name: 'Link', - action: OHIF.viewerbase.viewportUtils.linkStackScroll - }, { - id: 'saveMeasurements', - name: 'Save measurements', - hotkey: 'CTRL+S', - action() { - const activeTimepoint = OHIF.measurements.getActiveTimepoint(); - if (!activeTimepoint) return; - OHIF.measurements.saveMeasurements(OHIF.viewer.measurementApi, activeTimepoint.timepointId); - } - }]; - customCommands.forEach(command => { - _.defaults(OHIF.hotkeys.defaults[contextName], { [command.id]: command.hotkey || '' }); - OHIF.commands.register(contextName, command.id, { - name: command.name, - action: command.action || (() => toolManager.setActiveTool(command.id)) - }); - }); -}); diff --git a/LesionTracker/client/log.js b/LesionTracker/client/log.js deleted file mode 100644 index 11681dffc..000000000 --- a/LesionTracker/client/log.js +++ /dev/null @@ -1,3 +0,0 @@ -import loglevel from 'loglevel'; -log = loglevel.getLogger('OHIFViewer'); -log.setLevel('info'); \ No newline at end of file diff --git a/LesionTracker/client/routes.js b/LesionTracker/client/routes.js deleted file mode 100644 index 9e35913e9..000000000 --- a/LesionTracker/client/routes.js +++ /dev/null @@ -1,78 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Router } from 'meteor/clinical:router'; -import { OHIF } from 'meteor/ohif:core'; - -Router.configure({ - loadingTemplate: 'loading' -}); - -// If we are running a disconnected client similar to the StandaloneViewer -// (see https://docs.ohif.org/standalone-viewer/usage.html) we don't want -// our routes to get stuck while waiting for Pub / Sub. -// -// In this case, the developer is required to add Servers and specify -// a CurrentServer with some other approach (e.g. a separate script). -if (Meteor.settings && - Meteor.settings.public && - Meteor.settings.public.clientOnly !== true) { - Router.waitOn(function() { - return [ - Meteor.subscribe('servers'), - Meteor.subscribe('currentServer') - ]; - }); -} - -Router.onBeforeAction('loading'); - -Router.onBeforeAction(function() { - // verifyEmail controls whether emailVerification template will be rendered or not - const publicSettings = Meteor.settings && Meteor.settings.public; - const verifyEmail = publicSettings && publicSettings.verifyEmail || false; - - // Check if user is signed in or needs an email verification - if (!Meteor.userId() && !Meteor.loggingIn()) { - this.render('entrySignIn'); - } else if (verifyEmail && Meteor.user().emails && !Meteor.user().emails[0].verified) { - this.render('emailVerification'); - } else { - this.next(); - } -}, { - except: ['entrySignIn', 'entrySignUp', 'forgotPassword', 'resetPassword', 'emailVerification'] -}); - -Router.route('/', function() { - Router.go('studylist', {}, { replaceState: true }); -}, { name: 'home' }); - -Router.route('/studylist', { - name: 'studylist', - onBeforeAction: function() { - const next = this.next; - - // Retrieve the timepoints data to display in studylist - const promise = OHIF.studylist.timepointApi.retrieveTimepoints({}); - promise.then(() => next()); - }, - action: function() { - this.render('app', { data: { template: 'studylist' } }); - } -}); - -Router.route('/viewer/timepoints/:timepointId', function() { - const timepointId = this.params.timepointId; - OHIF.viewerbase.renderViewer(this, { timepointId }); -}, { name: 'viewerTimepoint' }); - -Router.route('/viewer/studies/:studyInstanceUids', function() { - const studyInstanceUids = this.params.studyInstanceUids.split(';'); - OHIF.viewerbase.renderViewer(this, { studyInstanceUids }); -}, { name: 'viewerStudies' }); - -// OHIF #98 Show specific series of study -Router.route('/study/:studyInstanceUid/series/:seriesInstanceUids', function () { - const studyInstanceUid = this.params.studyInstanceUid; - const seriesInstanceUids = this.params.seriesInstanceUids.split(';'); - OHIF.viewerbase.renderViewer(this, { studyInstanceUids: [studyInstanceUid], seriesInstanceUids }); -}, { name: 'viewerSeries' }); diff --git a/LesionTracker/package-lock.json b/LesionTracker/package-lock.json deleted file mode 100644 index cf85f9f01..000000000 --- a/LesionTracker/package-lock.json +++ /dev/null @@ -1,2284 +0,0 @@ -{ - "name": "LesionTracker", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/code-frame": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", - "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", - "dev": true, - "requires": { - "@babel/highlight": "^7.0.0" - } - }, - "@babel/generator": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0.tgz", - "integrity": "sha512-/BM2vupkpbZXq22l1ALO7MqXJZH2k8bKVv8Y+pABFnzWdztDB/ZLveP5At21vLz5c2YtSE6p7j2FZEsqafMz5Q==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0", - "jsesc": "^2.5.1", - "lodash": "^4.17.10", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" - } - }, - "@babel/helper-function-name": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", - "integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", - "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz", - "integrity": "sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@babel/highlight": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", - "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", - "dev": true, - "requires": { - "chalk": "^2.0.0", - "esutils": "^2.0.2", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.1.0.tgz", - "integrity": "sha512-SmjnXCuPAlai75AFtzv+KCBcJ3sDDWbIn+WytKw1k+wAtEy6phqI2RqKh/zAnw53i1NR8su3Ep/UoqaKcimuLg==", - "dev": true - }, - "@babel/runtime": { - "version": "7.0.0-beta.51", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.51.tgz", - "integrity": "sha1-SLjtGDBwNMZiD2Q1FGUMoszAFlo=", - "requires": { - "core-js": "^2.5.7", - "regenerator-runtime": "^0.11.1" - } - }, - "@babel/template": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.0.tgz", - "integrity": "sha512-yZ948B/pJrwWGY6VxG6XRFsVTee3IQ7bihq9zFpM00Vydu6z5Xwg0C3J644kxI9WOTzd+62xcIsQ+AT1MGhqhA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@babel/traverse": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.1.0.tgz", - "integrity": "sha512-bwgln0FsMoxm3pLOgrrnGaXk18sSM9JNf1/nHC/FksmNGFbYnPWY4GYCfLxyP1KRmfsxqkRpfoa6xr6VuuSxdw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.0.0", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.0.0", - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "debug": "^3.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.10" - } - }, - "@babel/types": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0.tgz", - "integrity": "sha512-5tPDap4bGKTLPtci2SUl/B7Gv8RnuJFuQoWx26RJobS0fFrz4reUA3JnwIM+HVHEmWE0C1mzKhDtTp8NsWY02Q==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "lodash": "^4.17.10", - "to-fast-properties": "^2.0.0" - } - }, - "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", - "dev": true - }, - "acorn-jsx": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-4.1.1.tgz", - "integrity": "sha512-JY+iV6r+cO21KtntVvFkD+iqjtdpRUpGqKWgfkCdZq1R+kbreEl8EcdcJR4SmiIgsIQT33s6QzheQ9a275Q8xw==", - "dev": true, - "requires": { - "acorn": "^5.0.3" - } - }, - "ajv": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", - "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", - "dev": true - }, - "ansi-escapes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", - "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "aria-query": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz", - "integrity": "sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=", - "dev": true, - "requires": { - "ast-types-flow": "0.0.7", - "commander": "^2.11.0" - } - }, - "array-includes": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", - "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.7.0" - } - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "ast-types-flow": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", - "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=", - "dev": true - }, - "axobject-query": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.1.tgz", - "integrity": "sha1-Bd+nBa2orZ25k/polvItOVsLCgc=", - "dev": true, - "requires": { - "ast-types-flow": "0.0.7" - } - }, - "babel-eslint": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.1.tgz", - "integrity": "sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.0.0", - "@babel/traverse": "^7.0.0", - "@babel/types": "^7.0.0", - "eslint-scope": "3.7.1", - "eslint-visitor-keys": "^1.0.0" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "bcrypt": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-3.0.1.tgz", - "integrity": "sha512-DSTLQZdvzJ7znQ1WOqkN3X0Hutt6BTVaZNWyX8/B4P+s9SIxkYgtGKfgHokli1syPcWJUE63/kGVyV1ECA4d1A==", - "requires": { - "nan": "2.11.0", - "node-pre-gyp": "0.11.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.1", - "bundled": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true - }, - "ini": { - "version": "1.3.5", - "bundled": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true - }, - "minipass": { - "version": "2.3.4", - "bundled": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "bundled": true - }, - "yallist": { - "version": "3.0.2", - "bundled": true - } - } - }, - "minizlib": { - "version": "1.1.0", - "bundled": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - }, - "needle": { - "version": "2.2.3", - "bundled": true, - "requires": { - "debug": "^2.1.2", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.11.0", - "bundled": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.5", - "bundled": true - }, - "npm-packlist": { - "version": "1.1.11", - "bundled": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true - } - } - }, - "readable-stream": { - "version": "2.3.5", - "bundled": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.1", - "bundled": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true - }, - "sax": { - "version": "1.2.4", - "bundled": true - }, - "semver": { - "version": "5.5.1", - "bundled": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.0.3", - "bundled": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true - }, - "tar": { - "version": "4.4.6", - "bundled": true, - "requires": { - "chownr": "^1.0.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.3", - "minizlib": "^1.1.0", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "bundled": true - }, - "yallist": { - "version": "3.0.2", - "bundled": true - } - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true - } - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "caller-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", - "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", - "dev": true, - "requires": { - "callsites": "^0.2.0" - } - }, - "callsites": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", - "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", - "dev": true - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, - "circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "dev": true - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "commander": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", - "integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true - }, - "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "damerau-levenshtein": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz", - "integrity": "sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ=", - "dev": true - }, - "debug": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", - "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "del": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", - "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", - "dev": true, - "requires": { - "globby": "^5.0.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "rimraf": "^2.2.8" - } - }, - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "emoji-regex": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.5.1.tgz", - "integrity": "sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ==", - "dev": true - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.6.0.tgz", - "integrity": "sha512-/eVYs9VVVboX286mBK7bbKnO1yamUy2UCRjiY6MryhQL2PaaXCExsCQ2aO83OeYRhU2eCU/FMFP+tVMoOrzNrA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.5.3", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^3.1.0", - "doctrine": "^2.1.0", - "eslint-scope": "^4.0.0", - "eslint-utils": "^1.3.1", - "eslint-visitor-keys": "^1.0.0", - "espree": "^4.0.0", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", - "functional-red-black-tree": "^1.0.1", - "glob": "^7.1.2", - "globals": "^11.7.0", - "ignore": "^4.0.6", - "imurmurhash": "^0.1.4", - "inquirer": "^6.1.0", - "is-resolvable": "^1.1.0", - "js-yaml": "^3.12.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.5", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.2", - "path-is-inside": "^1.0.2", - "pluralize": "^7.0.0", - "progress": "^2.0.0", - "regexpp": "^2.0.0", - "require-uncached": "^1.0.3", - "semver": "^5.5.1", - "strip-ansi": "^4.0.0", - "strip-json-comments": "^2.0.1", - "table": "^4.0.3", - "text-table": "^0.2.0" - }, - "dependencies": { - "eslint-scope": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", - "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - } - } - }, - "eslint-config-airbnb": { - "version": "17.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-17.1.0.tgz", - "integrity": "sha512-R9jw28hFfEQnpPau01NO5K/JWMGLi6aymiF6RsnMURjTk+MqZKllCqGK/0tOvHkPi/NWSSOU2Ced/GX++YxLnw==", - "dev": true, - "requires": { - "eslint-config-airbnb-base": "^13.1.0", - "object.assign": "^4.1.0", - "object.entries": "^1.0.4" - } - }, - "eslint-config-airbnb-base": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.1.0.tgz", - "integrity": "sha512-XWwQtf3U3zIoKO1BbHh6aUhJZQweOwSt4c2JrPDg9FP3Ltv3+YfEv7jIDB8275tVnO/qOHbfuYg3kzw6Je7uWw==", - "dev": true, - "requires": { - "eslint-restricted-globals": "^0.1.1", - "object.assign": "^4.1.0", - "object.entries": "^1.0.4" - } - }, - "eslint-import-resolver-meteor": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-meteor/-/eslint-import-resolver-meteor-0.4.0.tgz", - "integrity": "sha1-yGhjhAghIIz4EzxczlGQnCamFWk=", - "dev": true, - "requires": { - "object-assign": "^4.0.1", - "resolve": "^1.1.6" - } - }, - "eslint-import-resolver-node": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", - "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", - "dev": true, - "requires": { - "debug": "^2.6.9", - "resolve": "^1.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-module-utils": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", - "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", - "dev": true, - "requires": { - "debug": "^2.6.8", - "pkg-dir": "^1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-import": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", - "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", - "dev": true, - "requires": { - "contains-path": "^0.1.0", - "debug": "^2.6.8", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.1", - "eslint-module-utils": "^2.2.0", - "has": "^1.0.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.3", - "read-pkg-up": "^2.0.0", - "resolve": "^1.6.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-jsx-a11y": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.1.1.tgz", - "integrity": "sha512-JsxNKqa3TwmPypeXNnI75FntkUktGzI1wSa1LgNZdSOMI+B4sxnr1lSF8m8lPiz4mKiC+14ysZQM4scewUrP7A==", - "dev": true, - "requires": { - "aria-query": "^3.0.0", - "array-includes": "^3.0.3", - "ast-types-flow": "^0.0.7", - "axobject-query": "^2.0.1", - "damerau-levenshtein": "^1.0.4", - "emoji-regex": "^6.5.1", - "has": "^1.0.3", - "jsx-ast-utils": "^2.0.1" - } - }, - "eslint-plugin-meteor": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-meteor/-/eslint-plugin-meteor-5.1.0.tgz", - "integrity": "sha512-0/mQ0vOhmJQSDbhU84CsLGFEq967ye6sqyJKG/H8Nwv3+Ti1ayfsKqI0iEK85NcI8v6jJ7o/0EHkHg14bcLbaw==", - "dev": true, - "requires": { - "invariant": "2.2.4" - } - }, - "eslint-plugin-react": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz", - "integrity": "sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw==", - "dev": true, - "requires": { - "array-includes": "^3.0.3", - "doctrine": "^2.1.0", - "has": "^1.0.3", - "jsx-ast-utils": "^2.0.1", - "prop-types": "^15.6.2" - } - }, - "eslint-restricted-globals": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", - "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=", - "dev": true - }, - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", - "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", - "dev": true - }, - "eslint-visitor-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", - "dev": true - }, - "espree": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-4.0.0.tgz", - "integrity": "sha512-kapdTCt1bjmspxStVKX6huolXVV5ZfyZguY1lcfhVVZstce3bqxH9mcLzNn3/mlgW6wQ732+0fuG9v7h0ZQoKg==", - "dev": true, - "requires": { - "acorn": "^5.6.0", - "acorn-jsx": "^4.1.1" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", - "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", - "dev": true, - "requires": { - "estraverse": "^4.0.0" - } - }, - "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", - "dev": true, - "requires": { - "estraverse": "^4.1.0" - } - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "external-editor": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", - "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", - "dev": true, - "requires": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "flat-cache": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", - "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", - "dev": true, - "requires": { - "circular-json": "^0.3.1", - "del": "^2.0.2", - "graceful-fs": "^4.1.2", - "write": "^0.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "globals": { - "version": "11.7.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", - "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", - "dev": true - }, - "globby": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", - "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true - }, - "hosted-git-info": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", - "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "inquirer": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", - "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.0", - "figures": "^2.0.0", - "lodash": "^4.17.10", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.1.0", - "string-width": "^2.1.0", - "strip-ansi": "^4.0.0", - "through": "^2.3.6" - } - }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "^1.0.0" - } - }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", - "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", - "dev": true, - "requires": { - "is-path-inside": "^1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", - "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", - "dev": true, - "requires": { - "path-is-inside": "^1.0.1" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, - "requires": { - "has": "^1.0.1" - } - }, - "is-resolvable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", - "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", - "dev": true - }, - "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "dev": true, - "requires": { - "has-symbols": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsesc": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", - "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "jsx-ast-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz", - "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", - "dev": true, - "requires": { - "array-includes": "^3.0.3" - } - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } - } - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", - "dev": true - }, - "loglevel": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", - "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=" - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "nan": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", - "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==" - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true - }, - "object.assign": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", - "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.0", - "object-keys": "^1.0.11" - } - }, - "object.entries": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.0.4.tgz", - "integrity": "sha1-G/mk3SKI9bM/Opk9JXZh8F0WGl8=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.6.1", - "function-bind": "^1.1.0", - "has": "^1.0.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pkg-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", - "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", - "dev": true, - "requires": { - "find-up": "^1.0.0" - } - }, - "pluralize": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "prop-types": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", - "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", - "dev": true, - "requires": { - "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" - } - }, - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - }, - "dependencies": { - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - } - } - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" - }, - "regexpp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.0.tgz", - "integrity": "sha512-g2FAVtR8Uh8GO1Nv5wpxW7VFVwHcCEr4wyA8/MHiRkO8uHoR5ntAA8Uq3P1vvMTX/BeQiRVSpDGLd+Wn5HNOTA==", - "dev": true - }, - "require-uncached": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", - "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", - "dev": true, - "requires": { - "caller-path": "^0.1.0", - "resolve-from": "^1.0.0" - } - }, - "resolve": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", - "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - }, - "resolve-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", - "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "^2.1.0" - } - }, - "rxjs": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", - "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", - "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slice-ansi": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", - "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "spdx-correct": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.1.tgz", - "integrity": "sha512-hxSPZbRZvSDuOvADntOElzJpenIR7wXJkuoUcUtS0erbgt2fgeaoPIYretfKpslMhfFDY4k0MZ2F5CUzhBsSvQ==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", - "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", - "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "table": { - "version": "4.0.3", - "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", - "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", - "dev": true, - "requires": { - "ajv": "^6.0.1", - "ajv-keywords": "^3.0.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", - "slice-ansi": "1.0.0", - "string-width": "^2.1.1" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, - "tslib": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - } - } - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } - } - } -} diff --git a/LesionTracker/package.json b/LesionTracker/package.json deleted file mode 100644 index ee6d71f27..000000000 --- a/LesionTracker/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "LesionTracker", - "private": true, - "scripts": { - "lint": "eslint .", - "fix": "eslint --fix .", - "pretest": "npm run lint --silent" - }, - "version": "1.0.0", - "description": "", - "dependencies": { - "@babel/runtime": "7.0.0-beta.51", - "bcrypt": "^3.0.1", - "loglevel": "^1.6.1", - "url": "^0.11.0" - }, - "devDependencies": { - "babel-eslint": "^10.0.1", - "eslint": "^5.6.0", - "eslint-config-airbnb": "^17.1.0", - "eslint-import-resolver-meteor": "^0.4.0", - "eslint-plugin-import": "^2.14.0", - "eslint-plugin-jsx-a11y": "^6.1.1", - "eslint-plugin-meteor": "^5.1.0", - "eslint-plugin-react": "^7.11.1" - }, - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/OHIF/Viewers.git" - }, - "author": "OHIF", - "license": "MIT", - "bugs": { - "url": "https://github.com/OHIF/Viewers/issues" - }, - "homepage": "https://github.com/OHIF/Viewers" -} diff --git a/LesionTracker/public/images/logo.png b/LesionTracker/public/images/logo.png deleted file mode 100644 index fc83b1354..000000000 Binary files a/LesionTracker/public/images/logo.png and /dev/null differ diff --git a/LesionTracker/server/email.js b/LesionTracker/server/email.js deleted file mode 100644 index cf4a20848..000000000 --- a/LesionTracker/server/email.js +++ /dev/null @@ -1,52 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -Meteor.startup(function () { - - // Mail server settings - var username = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.username || null; - var password = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.password || null; - var server = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.server || null; - var port = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.port || null; - var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false; - var siteName = Meteor.settings && Meteor.settings.public && Meteor.settings.public.siteName || "Lesion Tracker"; - - if (username && password && server && port) { - Accounts.emailTemplates.siteName = siteName; - Accounts.emailTemplates.from = siteName+' Admin <'+username+'>'; - - process.env.MAIL_URL = 'smtp://' + - encodeURIComponent(username) + ':' + - encodeURIComponent(password) + '@' + - encodeURIComponent(server) + ':' + port; - - // Subject line of the email. - Accounts.emailTemplates.verifyEmail.subject = function(user) { - return 'Confirm Your Email Address for '+siteName; - }; - - // Email text - Accounts.emailTemplates.verifyEmail.text = function(user, url) { - return 'Thank you for registering. Please click on the following link to verify your email address: \r\n' + url; - }; - - // Reset password mail - Accounts.emailTemplates.resetPassword.subject = function() { - return 'Reset your '+siteName+' password' - }; - - Accounts.urls.resetPassword = function(token) { - return OHIF.utils.absoluteUrl('resetPassword/' + token); - }; - - Accounts.emailTemplates.resetPassword.text = function(user, url) { - return "Hello " + user.profile.fullName + ",\n\n" + - "Click the following link to set your new password:\n" + - url + "\n\n"; - }; - - // Send email when account is created - Accounts.config({ - sendVerificationEmail: verifyEmail - }); - } -}); \ No newline at end of file diff --git a/OHIFViewer/.gitignore b/OHIFViewer/.gitignore deleted file mode 100644 index 0d0d24eac..000000000 --- a/OHIFViewer/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.idea -.meteor/local -.meteor/meteorite -node_modules \ No newline at end of file diff --git a/OHIFViewer/.meteor/.finished-upgraders b/OHIFViewer/.meteor/.finished-upgraders deleted file mode 100644 index 8f397c7da..000000000 --- a/OHIFViewer/.meteor/.finished-upgraders +++ /dev/null @@ -1,19 +0,0 @@ -# This file contains information which helps Meteor properly upgrade your -# app when you run 'meteor update'. You should check it into version control -# with your project. - -notices-for-0.9.0 -notices-for-0.9.1 -0.9.4-platform-file -notices-for-facebook-graph-api-2 -1.2.0-standard-minifiers-package -1.2.0-meteor-platform-split -1.2.0-cordova-changes -1.2.0-breaking-changes -1.3.0-split-minifiers-package -1.3.5-remove-old-dev-bundle-link -1.4.0-remove-old-dev-bundle-link -1.4.1-add-shell-server-package -1.4.3-split-account-service-packages -1.5-add-dynamic-import-package -1.7-split-underscore-from-meteor-base diff --git a/OHIFViewer/.meteor/.gitignore b/OHIFViewer/.meteor/.gitignore deleted file mode 100644 index 501f92e4b..000000000 --- a/OHIFViewer/.meteor/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -dev_bundle -local diff --git a/OHIFViewer/.meteor/.id b/OHIFViewer/.meteor/.id deleted file mode 100644 index c1706e8d0..000000000 --- a/OHIFViewer/.meteor/.id +++ /dev/null @@ -1,7 +0,0 @@ -# This file contains a token that is unique to your project. -# Check it into your repository along with the rest of this directory. -# It can be used for purposes such as: -# - ensuring you don't accidentally deploy one app on top of another -# - providing package authors with aggregated statistics - -1jfkhvr1ljfqodmpn32m diff --git a/OHIFViewer/.meteor/packages b/OHIFViewer/.meteor/packages deleted file mode 100644 index 6b44cb394..000000000 --- a/OHIFViewer/.meteor/packages +++ /dev/null @@ -1,55 +0,0 @@ -# Meteor packages used by this project, one per line. -# Check this file (and the other files in this directory) into your repository. -# -# 'meteor add' and 'meteor remove' will edit this file for you, -# but you can also edit it by hand. - -http@1.4.1 -promise@0.11.1 -stylus@2.513.13 -meteor-base@1.4.0 -mobile-experience@1.0.5 -mongo@1.5.0 -blaze-html-templates@1.0.4 -session@1.1.7 -jquery@1.11.10 -tracker@1.2.0 -logging@1.1.20 -reload@1.2.0 -random@1.1.0 -ejson@1.1.0 -spacebars@1.0.12 -check@1.3.1 -ecmascript@0.11.1 -reactive-var@1.0.11 -reactive-dict@1.2.0 -standard-minifier-css@1.4.1 -standard-minifier-js@2.3.4 - -# OHIF Packages -ohif:polyfill -ohif:design -ohif:core -ohif:commands -ohif:hotkeys -ohif:header -ohif:cornerstone -ohif:cornerstone-settings -ohif:viewerbase -ohif:study-list -ohif:hanging-protocols -ohif:metadata -ohif:google-cloud -ohif:demo-mode -ohif:user-oidc -ohif:measurement-table - -fortawesome:fontawesome -momentjs:moment@2.15.1 -aldeed:simple-schema # Third party package to deal with schemas -aldeed:template-extension -johdirr:meteor-git-rev -cultofcoders:persistent-session -shell-server@0.3.1 -underscore -meteortesting:mocha \ No newline at end of file diff --git a/OHIFViewer/.meteor/platforms b/OHIFViewer/.meteor/platforms deleted file mode 100644 index efeba1b50..000000000 --- a/OHIFViewer/.meteor/platforms +++ /dev/null @@ -1,2 +0,0 @@ -server -browser diff --git a/OHIFViewer/.meteor/release b/OHIFViewer/.meteor/release deleted file mode 100644 index 04fe8b4f6..000000000 --- a/OHIFViewer/.meteor/release +++ /dev/null @@ -1 +0,0 @@ -METEOR@1.7.0.3 diff --git a/OHIFViewer/.meteor/versions b/OHIFViewer/.meteor/versions deleted file mode 100644 index a0c2399a3..000000000 --- a/OHIFViewer/.meteor/versions +++ /dev/null @@ -1,133 +0,0 @@ -aldeed:collection2@2.10.0 -aldeed:collection2-core@1.2.0 -aldeed:schema-deny@1.1.0 -aldeed:schema-index@1.1.1 -aldeed:simple-schema@1.5.4 -aldeed:template-extension@4.1.0 -allow-deny@1.1.0 -amplify@1.0.0 -autoupdate@1.4.1 -babel-compiler@7.1.1 -babel-runtime@1.2.2 -base64@1.0.11 -binary-heap@1.0.10 -blaze@2.3.2 -blaze-html-templates@1.1.2 -blaze-tools@1.0.10 -boilerplate-generator@1.5.0 -caching-compiler@1.1.12 -caching-html-compiler@1.1.3 -callback-hook@1.1.0 -check@1.3.1 -clinical:router@2.0.19 -clinical:router-location@2.1.0 -clinical:router-middleware-stack@2.1.2 -clinical:router-url@2.1.0 -cultofcoders:persistent-session@0.4.5 -ddp@1.4.0 -ddp-client@2.3.3 -ddp-common@1.4.0 -ddp-server@2.2.0 -deps@1.0.12 -diff-sequence@1.1.0 -dynamic-import@0.4.1 -ecmascript@0.11.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.7.1 -ecmascript-runtime-server@0.7.0 -ejson@1.1.0 -es5-shim@4.8.0 -fastclick@1.0.13 -fortawesome:fontawesome@4.7.0 -geojson-utils@1.0.10 -hot-code-push@1.0.4 -html-tools@1.0.11 -htmljs@1.0.11 -http@1.4.1 -id-map@1.1.0 -iron:controller@1.0.12 -iron:core@1.0.11 -iron:dynamic-template@1.0.12 -iron:layout@1.0.12 -johdirr:meteor-git-rev@0.0.4 -jquery@1.11.11 -launch-screen@1.1.1 -livedata@1.0.18 -lmieulet:meteor-coverage@1.1.4 -logging@1.1.20 -mdg:validation-error@0.5.1 -meteor@1.9.2 -meteor-base@1.4.0 -meteor-platform@1.2.6 -meteorhacks:picker@1.0.3 -meteortesting:browser-tests@1.0.0 -meteortesting:mocha@1.0.0 -minifier-css@1.3.1 -minifier-js@2.3.5 -minimongo@1.4.4 -mobile-experience@1.0.5 -mobile-status-bar@1.0.14 -modern-browsers@0.1.2 -modules@0.12.2 -modules-runtime@0.10.2 -momentjs:moment@2.22.2 -mongo@1.5.1 -mongo-dev-server@1.1.0 -mongo-id@1.0.7 -natestrauser:select2@4.0.3 -npm-mongo@3.0.7 -observe-sequence@1.0.16 -ohif:commands@0.0.1 -ohif:core@0.0.1 -ohif:cornerstone@0.0.1 -ohif:cornerstone-settings@0.0.1 -ohif:demo-mode@0.0.1 -ohif:design@0.0.1 -ohif:google-cloud@0.0.1 -ohif:hanging-protocols@0.0.1 -ohif:header@0.0.1 -ohif:hotkeys@0.0.1 -ohif:log@0.0.1 -ohif:measurement-table@0.0.1 -ohif:measurements@0.0.1 -ohif:metadata@0.0.1 -ohif:polyfill@0.0.1 -ohif:select-tree@0.0.1 -ohif:servers@0.0.1 -ohif:studies@0.0.1 -ohif:study-list@0.0.1 -ohif:themes@0.0.1 -ohif:themes-common@0.0.1 -ohif:user-oidc@0.0.1 -ohif:viewerbase@0.0.1 -ohif:wadoproxy@0.0.1 -ordered-dict@1.1.0 -practicalmeteor:mocha-core@1.0.1 -promise@0.11.1 -raix:eventemitter@0.1.3 -random@1.1.0 -reactive-dict@1.2.0 -reactive-var@1.0.11 -reload@1.2.0 -retry@1.1.0 -routepolicy@1.0.13 -session@1.1.7 -shell-server@0.3.1 -silentcicero:jszip@0.0.4 -socket-stream-client@0.2.2 -spacebars@1.0.15 -spacebars-compiler@1.1.3 -standard-app-packages@1.0.9 -standard-minifier-css@1.4.1 -standard-minifier-js@2.3.4 -stylus@2.513.14 -templating@1.3.2 -templating-compiler@1.3.3 -templating-runtime@1.3.2 -templating-tools@1.1.2 -tracker@1.2.0 -ui@1.0.13 -underscore@1.0.10 -url@1.2.0 -webapp@1.6.2 -webapp-hashing@1.0.9 \ No newline at end of file diff --git a/OHIFViewer/bin/medkenOrthanc.bat b/OHIFViewer/bin/medkenOrthanc.bat deleted file mode 100644 index b581129a8..000000000 --- a/OHIFViewer/bin/medkenOrthanc.bat +++ /dev/null @@ -1,2 +0,0 @@ -set METEOR_PACKAGE_DIRS=..\Packages -meteor --settings ../config/medkenOrthanc.json diff --git a/OHIFViewer/bin/medkenOrthanc.sh b/OHIFViewer/bin/medkenOrthanc.sh deleted file mode 100755 index c7f2471bc..000000000 --- a/OHIFViewer/bin/medkenOrthanc.sh +++ /dev/null @@ -1 +0,0 @@ -METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/medkenOrthanc.json diff --git a/OHIFViewer/bin/orthanc.sh b/OHIFViewer/bin/orthanc.sh deleted file mode 100755 index 47bea2d95..000000000 --- a/OHIFViewer/bin/orthanc.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -declare config='../config/orthancDICOMWeb.json' - -if [ $# -gt 0 ]; then - if [ "$1" = '--dimse' ]; then - config="${config%/*}/orthancDIMSE.json" - [ -f "$config" ] && echo "DIMSE config file selected: $config" - fi -fi - -echo 'Starting Meteor server...' -METEOR_PACKAGE_DIRS="../Packages" meteor --settings "$config" diff --git a/OHIFViewer/bin/orthancDICOMWeb.bat b/OHIFViewer/bin/orthancDICOMWeb.bat deleted file mode 100644 index c8bc65d11..000000000 --- a/OHIFViewer/bin/orthancDICOMWeb.bat +++ /dev/null @@ -1,2 +0,0 @@ -set METEOR_PACKAGE_DIRS=..\Packages -meteor --settings ../config/orthancDICOMWeb.json diff --git a/OHIFViewer/bin/orthancDICOMWeb.sh b/OHIFViewer/bin/orthancDICOMWeb.sh deleted file mode 100755 index 91f4af5bf..000000000 --- a/OHIFViewer/bin/orthancDICOMWeb.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo "Starting Meteor server..." -METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/orthancDICOMWeb.json \ No newline at end of file diff --git a/OHIFViewer/bin/orthancDIMSE.sh b/OHIFViewer/bin/orthancDIMSE.sh deleted file mode 100755 index b1341c93f..000000000 --- a/OHIFViewer/bin/orthancDIMSE.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo "Starting Meteor server..." -METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/orthancDIMSE.json \ No newline at end of file diff --git a/OHIFViewer/bin/publicOrthancDICOMWeb.sh b/OHIFViewer/bin/publicOrthancDICOMWeb.sh deleted file mode 100755 index 06fe05602..000000000 --- a/OHIFViewer/bin/publicOrthancDICOMWeb.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo "Starting Meteor server..." -METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/publicOrthancDICOMWeb.json diff --git a/OHIFViewer/bin/testPackages.sh b/OHIFViewer/bin/testPackages.sh deleted file mode 100644 index b75ff6309..000000000 --- a/OHIFViewer/bin/testPackages.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -################################################## -# Runs the packages tests -################################################## - -# check execution arguments -while [ "$1" != "" ]; do - PARAM=`echo $1 | awk -F= '{print $1}'` - case $PARAM in - -c | --coverage) - export RUN_COVERAGE=1 - ;; - -v | --verbose) - export COVERAGE_VERBOSE=1 - ;; - -s | --spacejam) - export RUN_SPACEJAM=1 - ;; - *) - esac - shift -done - -if [ "$RUN_COVERAGE" == 1 ]; -then - # Setting coverage variables - app_folder=$(pwd) - app_folder+="/packages/ohif-viewerbase/" - export COVERAGE_APP_FOLDER=$app_folder - export COVERAGE=1 - echo 'Running meteor-coverage' -fi - -if [ "$RUN_SPACEJAM" == 1 ]; -then - spacejam-mocha ./packages/ohif-viewerbase/ -else - meteor test-packages --driver-package='cultofcoders:mocha' ./packages/ohif-viewerbase/ -fi diff --git a/OHIFViewer/client/body.html b/OHIFViewer/client/body.html deleted file mode 100644 index 7ea7fcea5..000000000 --- a/OHIFViewer/client/body.html +++ /dev/null @@ -1,3 +0,0 @@ - -
- diff --git a/OHIFViewer/client/body.styl b/OHIFViewer/client/body.styl deleted file mode 100644 index aaa17e8fb..000000000 --- a/OHIFViewer/client/body.styl +++ /dev/null @@ -1,2 +0,0 @@ -body - background-color: black \ No newline at end of file diff --git a/OHIFViewer/client/components/flexboxLayout/flexboxLayout.html b/OHIFViewer/client/components/flexboxLayout/flexboxLayout.html deleted file mode 100644 index 140da30a1..000000000 --- a/OHIFViewer/client/components/flexboxLayout/flexboxLayout.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/OHIFViewer/client/components/flexboxLayout/flexboxLayout.js b/OHIFViewer/client/components/flexboxLayout/flexboxLayout.js deleted file mode 100644 index 264bd7d89..000000000 --- a/OHIFViewer/client/components/flexboxLayout/flexboxLayout.js +++ /dev/null @@ -1,19 +0,0 @@ -Template.flexboxLayout.events({ - 'transitionend .sidebarMenu'(event) { - if (!event.target.classList.contains('sidebarMenu')) { - return; - } - - window.ResizeViewportManager.handleResize(); - } -}); - -Template.flexboxLayout.helpers({ - leftSidebarOpen() { - return Template.instance().data.state.get('leftSidebar'); - }, - - rightSidebarOpen() { - return Template.instance().data.state.get('rightSidebar'); - } -}); diff --git a/OHIFViewer/client/components/flexboxLayout/flexboxLayout.styl b/OHIFViewer/client/components/flexboxLayout/flexboxLayout.styl deleted file mode 100644 index 5e960717a..000000000 --- a/OHIFViewer/client/components/flexboxLayout/flexboxLayout.styl +++ /dev/null @@ -1,67 +0,0 @@ -@require '{ohif:design}/app' - -.viewerSection - display: flex - flex: 1 - flex-flow: row nowrap - align-items: stretch - height: 'calc(100% - %s)' % ($toolbarHeight + $topBarHeight) - width: 100% - - .sidebarMenu - height: 100% - // required transformation to make inner fixed elements relative to this one - transform(scale(1)) - transition($sidebarTransition) - - .sidebar-option - height: 100% - max-width: inherit - position: absolute - transform(translateX(100%)) - transition($sidebarTransition) - width: 100% - - &.active - transform(translateX(0%)) - - .sidebar-left - theme('border-right', '%s solid $uiBorderColor' % $uiBorderThickness) - flex: 1 - margin-left: - $studiesSidebarMenuWidth - max-width: $studiesSidebarMenuWidth - order: 1 - - &.sidebar-open - margin-left: 0 - - .mainContent - flex: 1 - height: 100% - order: 2 - overflow: hidden - transition($sidebarTransition) - width: 100% - - .sidebar-right - flex: 1 - margin-right: - $rightSidebarMenuWidth - max-width: $rightSidebarMenuWidth - order: 3 - position: relative - - &[data-timepoints="3"] - margin-right: - ($rightSidebarMenuWidth + 135.5px) - max-width: $rightSidebarMenuWidth + 135.5px - - &[data-timepoints="4"] - margin-right: - ($rightSidebarMenuWidth + 270px) - max-width: $rightSidebarMenuWidth + 270px - - &.sidebar-open - margin-right: 0 - - .studiesListedChanger - theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) - padding: 20px 10px - text-align: center diff --git a/OHIFViewer/client/components/ohifViewer/ohifViewer.html b/OHIFViewer/client/components/ohifViewer/ohifViewer.html deleted file mode 100644 index 8bce9d23d..000000000 --- a/OHIFViewer/client/components/ohifViewer/ohifViewer.html +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/OHIFViewer/client/components/ohifViewer/ohifViewer.js b/OHIFViewer/client/components/ohifViewer/ohifViewer.js deleted file mode 100644 index 4e8d7e961..000000000 --- a/OHIFViewer/client/components/ohifViewer/ohifViewer.js +++ /dev/null @@ -1,116 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { Router } from 'meteor/clinical:router'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; - -Template.ohifViewer.onCreated(() => { - const instance = Template.instance(); - instance.headerClasses = new ReactiveVar(''); - Session.set("IsStudyListReady", true);; - - const headerItems = [{ - action: () => OHIF.ui.showDialog('serverInformationModal'), - text: 'Server Information', - icon: 'fa fa-server fa-lg', - separatorAfter: true - }, { - action: () => OHIF.ui.showDialog('themeSelectorModal'), - text: 'Themes', - iconClasses: 'theme', - iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#theme', - separatorAfter: false - }, { - action: () => OHIF.ui.showDialog('userPreferencesDialog'), - text: 'Preferences', - icon: 'fa fa-user', - separatorAfter: true - }, { - action: () => OHIF.ui.showDialog('aboutModal'), - text: 'About', - icon: 'fa fa-info' - }]; - - const isUserLoggedIn = OHIF.user.userLoggedIn(); - const isDemoUserLoggedIn = OHIF.demoMode && OHIF.demoMode.userLoggedIn(); - if (isUserLoggedIn || isDemoUserLoggedIn) { - headerItems.push({ - action: isDemoUserLoggedIn ? OHIF.demoMode.logout : OHIF.user.logout, - text: 'Logout', - iconClasses: 'logout', - iconSvgUse: 'packages/ohif_viewerbase/assets/user-menu-icons.svg#logout' - }); - } - - OHIF.header.dropdown.setItems(headerItems); - - instance.autorun(() => { - const currentRoute = Router.current(); - if (!currentRoute) return; - const routeName = currentRoute.route.getName(); - const isViewer = routeName.indexOf('viewer') === 0; - - // Add or remove the strech class from body - $(document.body)[isViewer ? 'addClass' : 'removeClass']('stretch'); - - // Set the header on its bigger version if the viewer is not opened - instance.headerClasses.set(isViewer ? '' : 'header-big'); - - // Set the viewer open state on session - Session.set('ViewerOpened', isViewer); - }); - - if (OHIF.demoMode && OHIF.demoMode.userLoggedIn()) { - OHIF.demoMode.setDemoServerConfig(); - } else if (OHIF.gcloud && OHIF.gcloud.isEnabled()) { - const server = OHIF.servers.getCurrentServer(); - - if (!server || !server.isCloud) { - Session.set("IsStudyListReady", false); - OHIF.gcloud.showDicomStorePicker({canClose: OHIF.demoMode}).then(config => { - if (!config) { - if (OHIF.demoMode) - Router.go('/demo-signin'); - return; - } - OHIF.servers.applyCloudServerConfig(config); - Session.set("IsStudyListReady", true); - }); - } - } -}); - -Template.ohifViewer.events({ - 'click .js-toggle-studyList'(event, instance) { - event.preventDefault(); - const isViewer = Session.get('ViewerOpened'); - - if (isViewer) { - Router.go('studylist'); - } else { - const { studyInstanceUids } = OHIF.viewer.data; - if (studyInstanceUids) { - Router.go('viewerStudies', { studyInstanceUids }); - } - } - }, - -}); - -Template.ohifViewer.helpers({ - studyListToggleText() { - const instance = Template.instance(); - const isViewer = Session.get('ViewerOpened'); - - if (isViewer) { - instance.hasViewerData = true; - return 'Study list'; - } - - return instance.hasViewerData ? 'Back to viewer' : ''; - }, - isStudyListReady() { - return !!Session.get('IsStudyListReady'); - } -}); diff --git a/OHIFViewer/client/components/ohifViewer/ohifViewer.styl b/OHIFViewer/client/components/ohifViewer/ohifViewer.styl deleted file mode 100644 index f81f57e1d..000000000 --- a/OHIFViewer/client/components/ohifViewer/ohifViewer.styl +++ /dev/null @@ -1,80 +0,0 @@ -@import "{ohif:design}/app" - -body>.header - - .brand - height: 30px - display: inline-block - text-decoration: none - - .logo-image - display: inline-block - fill: transparent - float: left - height: 100% - margin: 0 8px 0 0 - width: 30px - - .logo-text - display: inline-block - font-family: $logoFontFamily - font-size: 14px - font-weight: $logoFontWeight - theme('color', '$textPrimaryColor') - line-height: 30px - - a.header-menu - theme('color', '$textPrimaryColor') - - .header-options - font-size: 13px - - .menu-toggle - display: inline-block - height: 18px - - .research-use - font-size: 13px - theme('color', '$textSecondaryColor') - font-weight: bold - - .btn - theme('color', '$textSecondaryColor') - cursor: pointer - font-size: 13px - font-weight: 500 - line-height: 26px - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') - - .studyListLinkSection - theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) - margin: 3px 0 0 10px - padding: 0 0 0 10px - - &.header-big - padding-left: $studyListPadding - padding-right: $studyListPadding - - .brand - height: 100% - line-height: $topBarExpandedHeight - 10px - - .logo-image - margin: 0 20px 0 0 - width: 50px - - .logo-text - font-size: 30px - - .studyListLinkSection - border: none - left: 0 - margin: 0 - padding: 0 - position: absolute - top: 0 diff --git a/OHIFViewer/client/components/ohifViewer/structuredReportModal/structureReportModal.html b/OHIFViewer/client/components/ohifViewer/structuredReportModal/structureReportModal.html deleted file mode 100644 index 5c52d5a15..000000000 --- a/OHIFViewer/client/components/ohifViewer/structuredReportModal/structureReportModal.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/OHIFViewer/client/components/ohifViewer/structuredReportModal/structuredReportModal.js b/OHIFViewer/client/components/ohifViewer/structuredReportModal/structuredReportModal.js deleted file mode 100644 index 90c948007..000000000 --- a/OHIFViewer/client/components/ohifViewer/structuredReportModal/structuredReportModal.js +++ /dev/null @@ -1,91 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -Template.structuredReportModal.onRendered(() => { - const structuredReport = getStructureReport(); - - render(structuredReport); -}); - -// FIXME: we use just 1st SR for current study for now -function getStructureReport() { - let structuredReport; - - OHIF.viewer.StudyMetadataList.find(studyMetadata => { - - structuredReport = studyMetadata.findInstance(instance => instance.getData().modality === 'SR'); - - // If SR is found stop the search - return !!structuredReport; - }); - - return structuredReport; -} - -function render(structureReport) { - const root = $('#root'); - - if (structureReport) { - renderStructuredReport(root, structureReport.getData()); - } else { - renderNoData(root); - } - -} - -function renderStructuredReport(root, data) { - root.append(getMainDataHtml(data)); - root.append(getContentSequenceHtml(data.contentSequence)); -} - -function renderNoData(root) { - root.append('
No structured report found
'); -} - -function getMainDataHtml(data) { - const root = $('
'); - - const { completionFlag, verificationFlag, manufacturer, contentDateTime } = data; - - if (completionFlag) { - root.append(getMainDataItemHtml('Completion flag', completionFlag)); - } - - if (verificationFlag) { - root.append(getMainDataItemHtml('Verification flag', verificationFlag)); - } - - if (manufacturer) { - root.append(getMainDataItemHtml('Manufacturer', manufacturer)); - } - - if (contentDateTime) { - root.append(getMainDataItemHtml('Content Date/Time', contentDateTime)); - } - - return root; -} - -const getContentSequenceHtml = (data, level = 1) => { - const root = $('
'); - const header = data.header; - const items = data.items || []; - - if (header) { - root.append(`${header}`); - } - - items.forEach(item => { - root.append( - item instanceof Object - ? getContentSequenceHtml(item, level + 1) - : `
${item}
` - ); - }); - - return root; -} - -function getMainDataItemHtml(key, value) { - return $(`
${key}: ${value}
`); -} \ No newline at end of file diff --git a/OHIFViewer/client/components/toolbarSection/toolbarSection.html b/OHIFViewer/client/components/toolbarSection/toolbarSection.html deleted file mode 100644 index 067a9f914..000000000 --- a/OHIFViewer/client/components/toolbarSection/toolbarSection.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/OHIFViewer/client/components/toolbarSection/toolbarSection.js b/OHIFViewer/client/components/toolbarSection/toolbarSection.js deleted file mode 100644 index 455eb4156..000000000 --- a/OHIFViewer/client/components/toolbarSection/toolbarSection.js +++ /dev/null @@ -1,328 +0,0 @@ -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; - -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; - -function isThereSeries(studies) { - if (studies.length === 1) { - const study = studies[0]; - - if (study.seriesList && study.seriesList.length > 1) { - return true; - } - - if (study.displaySets && study.displaySets.length > 1) { - return true; - } - } - - return false; -} - -Template.toolbarSection.onCreated(() => { - const instance = Template.instance(); - - if (OHIF.uiSettings.leftSidebarOpen && isThereSeries(instance.data.studies)) { - instance.data.state.set('leftSidebar', 'studies'); - } -}); - -Template.toolbarSection.helpers({ - leftSidebarToggleButtonData() { - const instance = Template.instance(); - return { - toggleable: true, - key: 'leftSidebar', - value: instance.data.state, - options: [{ - value: 'studies', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-studies', - svgWidth: 15, - svgHeight: 13, - bottomLabel: 'Series' - }] - }; - }, - - rightSidebarToggleButtonData() { - const instance = Template.instance(); - - // TODO: Figured out a way to handle both right panel contents - // return { - // toggleable: true, - // key: 'rightSidebar', - // value: instance.data.state, - // options: [{ - // value: 'hangingprotocols', - // iconClasses: 'fa fa-cog', - // bottomLabel: 'Hanging' - // }] - // }; - - return { - toggleable: true, - key: 'rightSidebar', - value: instance.data.state, - options: [{ - value: 'measurements', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-measurements-lesions', - svgWidth: 18, - svgHeight: 10, - bottomLabel: 'Measurements' - }] - }; - }, - - toolbarButtons() { - const extraTools = []; - - extraTools.push({ - id: 'crosshairs', - title: 'Crosshairs', - classes: 'imageViewerTool', - iconClasses: 'fa fa-crosshairs' - }); - - extraTools.push({ - id: 'magnify', - title: 'Magnify', - classes: 'imageViewerTool toolbarSectionButton', - iconClasses: 'fa fa-circle' - }); - - extraTools.push({ - id: 'wwwcRegion', - title: 'ROI Window', - classes: 'imageViewerTool', - iconClasses: 'fa fa-square' - }); - - extraTools.push({ - id: 'dragProbe', - title: 'Probe', - classes: 'imageViewerTool', - iconClasses: 'fa fa-dot-circle-o' - }); - - extraTools.push({ - id: 'ellipticalRoi', - title: 'Ellipse', - classes: 'imageViewerTool', - iconClasses: 'fa fa-circle-o' - }); - - extraTools.push({ - id: 'rectangleRoi', - title: 'Rectangle', - classes: 'imageViewerTool', - iconClasses: 'fa fa-square-o' - }); - - extraTools.push({ - id: 'toggleDownloadDialog', - title: 'Download', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-camera', - active: () => $('#downloadDialog').is(':visible') - }); - - extraTools.push({ - id: 'invert', - title: 'Invert', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-adjust' - }); - - extraTools.push({ - id: 'rotateR', - title: 'Rotate Right', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-rotate-right' - }); - - extraTools.push({ - id: 'flipH', - title: 'Flip H', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-horizontal' - }); - - extraTools.push({ - id: 'flipV', - title: 'Flip V', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-vertical' - }); - - extraTools.push({ - id: 'clearTools', - title: 'Clear', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-trash' - }); - - const buttonData = []; - - buttonData.push({ - id: 'stackScroll', - title: 'Stack Scroll', - classes: 'imageViewerTool', - iconClasses: 'fa fa-bars' - }); - - buttonData.push({ - id: 'zoom', - title: 'Zoom', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-zoom' - }); - - buttonData.push({ - id: 'wwwc', - title: 'Levels', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-levels' - }); - - buttonData.push({ - id: 'pan', - title: 'Pan', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-pan' - }); - - buttonData.push({ - id: 'length', - title: 'Length', - classes: 'imageViewerTool toolbarSectionButton', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp' - }); - - buttonData.push({ - id: 'annotate', - title: 'Annotate', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-non-target' - }); - - buttonData.push({ - id: 'angle', - title: 'Angle', - classes: 'imageViewerTool', - iconClasses: 'fa fa-angle-left' - }); - - buttonData.push({ - id: 'resetViewport', - title: 'Reset', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-undo' - }); - - if (!OHIF.uiSettings.displayEchoUltrasoundWorkflow) { - - buttonData.push({ - id: 'previousDisplaySet', - title: 'Previous', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-toggle-up fa-fw' - }); - - buttonData.push({ - id: 'nextDisplaySet', - title: 'Next', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-toggle-down fa-fw' - }); - - const { isPlaying } = OHIF.viewerbase.viewportUtils; - buttonData.push({ - id: 'toggleCinePlay', - title: () => isPlaying() ? 'Stop' : 'Play', - classes: 'imageViewerCommand', - iconClasses: () => ('fa fa-fw ' + (isPlaying() ? 'fa-stop' : 'fa-play')), - active: isPlaying - }); - - buttonData.push({ - id: 'toggleCineDialog', - title: 'CINE', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-youtube-play', - active: () => $('#cineDialog').is(':visible') - }); - } - - buttonData.push({ - id: 'layout', - title: 'Layout', - iconClasses: 'fa fa-th-large', - buttonTemplateName: 'layoutButton' - }); - - buttonData.push({ - id: 'sr', - title: 'SR', - classes: 'imageViewerTool', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-sr' - }); - - buttonData.push({ - id: 'toggleMore', - title: 'More', - classes: 'rp-x-1 rm-l-3', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-more', - subTools: extraTools - }); - - return buttonData; - }, - - hangingProtocolButtons() { - let buttonData = []; - - buttonData.push({ - id: 'previousPresentationGroup', - title: 'Prev. Stage', - iconClasses: 'fa fa-step-backward', - buttonTemplateName: 'previousPresentationGroupButton' - }); - - buttonData.push({ - id: 'nextPresentationGroup', - title: 'Next Stage', - iconClasses: 'fa fa-step-forward', - buttonTemplateName: 'nextPresentationGroupButton' - }); - - return buttonData; - } - -}); - -Template.toolbarSection.onRendered(function() { - const instance = Template.instance(); - - instance.$('#layout').dropdown(); - - if (OHIF.uiSettings.displayEchoUltrasoundWorkflow) { - OHIF.viewerbase.viewportUtils.toggleCineDialog(); - } - - // Set disabled/enabled tool buttons that are set in toolManager - const states = OHIF.viewerbase.toolManager.getToolDefaultStates(); - const disabledToolButtons = states.disabledToolButtons; - const allToolbarButtons = $('#toolbar').find('button'); - if (disabledToolButtons && disabledToolButtons.length > 0) { - for (let i = 0; i < allToolbarButtons.length; i++) { - const toolbarButton = allToolbarButtons[i]; - $(toolbarButton).prop('disabled', false); - - const index = disabledToolButtons.indexOf($(toolbarButton).attr('id')); - if (index !== -1) { - $(toolbarButton).prop('disabled', true); - } - } - } -}); diff --git a/OHIFViewer/client/components/toolbarSection/toolbarSection.styl b/OHIFViewer/client/components/toolbarSection/toolbarSection.styl deleted file mode 100644 index 46043423b..000000000 --- a/OHIFViewer/client/components/toolbarSection/toolbarSection.styl +++ /dev/null @@ -1,13 +0,0 @@ -@require '{ohif:design}/app' - -.toolbarSection - theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) - flex: 0 0 auto - height: $toolbarHeight - padding-top: 6px - position: relative - transition(height 300ms ease) - width: 100% - - &.expanded - height: $toolbarHeight + $toolbarDrawerHeight diff --git a/OHIFViewer/client/components/viewer/viewer.html b/OHIFViewer/client/components/viewer/viewer.html deleted file mode 100644 index 38c84ba1b..000000000 --- a/OHIFViewer/client/components/viewer/viewer.html +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/OHIFViewer/client/components/viewer/viewer.js b/OHIFViewer/client/components/viewer/viewer.js deleted file mode 100644 index 6b33390af..000000000 --- a/OHIFViewer/client/components/viewer/viewer.js +++ /dev/null @@ -1,184 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Session } from 'meteor/session'; -import { Template } from 'meteor/templating'; -import { ReactiveDict } from 'meteor/reactive-dict'; -import { Tracker } from 'meteor/tracker'; -import { OHIF } from 'meteor/ohif:core'; -import { MeasurementTable } from 'meteor/ohif:measurement-table'; - -import 'meteor/ohif:cornerstone'; -import 'meteor/ohif:viewerbase'; -import 'meteor/ohif:metadata'; - -/** - * Inits OHIF Hanging Protocol's onReady. - * It waits for OHIF Hanging Protocol to be ready to instantiate the ProtocolEngine - * Hanging Protocol will use OHIF LayoutManager to render viewports properly - */ -const initHangingProtocol = () => { - // When Hanging Protocol is ready - HP.ProtocolStore.onReady(() => { - - // Gets all StudyMetadata objects: necessary for Hanging Protocol to access study metadata - const studyMetadataList = OHIF.viewer.StudyMetadataList.all(); - - // Caches Layout Manager: Hanging Protocol uses it for layout management according to current protocol - const layoutManager = OHIF.viewerbase.layoutManager; - - // Instantiate StudyMetadataSource: necessary for Hanging Protocol to get study metadata - const studyMetadataSource = new OHIF.studies.classes.OHIFStudyMetadataSource(); - - // Get prior studies map - const studyPriorsMap = OHIF.studylist.functions.getStudyPriorsMap(studyMetadataList); - - // Creates Protocol Engine object with required arguments - const ProtocolEngine = new HP.ProtocolEngine(layoutManager, studyMetadataList, studyPriorsMap, studyMetadataSource); - - // Sets up Hanging Protocol engine - HP.setEngine(ProtocolEngine); - - Session.set('ViewerReady', true); - - Session.set('activeViewport', 0); - }); -}; - -Meteor.startup(() => { - Session.setDefault('activeViewport', false); - Session.setDefault('leftSidebar', false); - Session.setDefault('rightSidebar', false); - - OHIF.viewer.defaultTool = 'wwwc'; - OHIF.viewer.refLinesEnabled = true; - OHIF.viewer.cine = { - framesPerSecond: 24, - loop: true - }; - - const viewportUtils = OHIF.viewerbase.viewportUtils; - - OHIF.viewer.functionList = { - toggleCineDialog: viewportUtils.toggleCineDialog, - toggleCinePlay: viewportUtils.toggleCinePlay, - clearTools: viewportUtils.clearTools, - resetViewport: viewportUtils.resetViewport, - invert: viewportUtils.invert - }; - - // Create the synchronizer used to update reference lines - OHIF.viewer.updateImageSynchronizer = new cornerstoneTools.Synchronizer('cornerstonenewimage', cornerstoneTools.updateImageSynchronizer); - - OHIF.viewer.metadataProvider = new OHIF.cornerstone.MetadataProvider(); - - // Metadata configuration - const metadataProvider = OHIF.viewer.metadataProvider; - cornerstone.metaData.addProvider(metadataProvider.provider.bind(metadataProvider)); - - // Instanciate viewer plugins - OHIF.viewer.measurementTable = new MeasurementTable(); -}); - -Template.viewer.onCreated(() => { - Session.set('ViewerReady', false); - - const instance = Template.instance(); - - // Define the OHIF.viewer.data global object - OHIF.viewer.data = OHIF.viewer.data || Session.get('ViewerData') || {}; - - instance.state = new ReactiveDict(); - instance.state.set('leftSidebar', Session.get('leftSidebar')); - instance.state.set('rightSidebar', Session.get('rightSidebar')); - - if (OHIF.viewer.data && OHIF.viewer.data.loadedSeriesData) { - OHIF.log.info('Reloading previous loadedSeriesData'); - OHIF.viewer.loadedSeriesData = OHIF.viewer.data.loadedSeriesData; - } else { - OHIF.log.info('Setting default viewer data'); - OHIF.viewer.loadedSeriesData = {}; - OHIF.viewer.data.loadedSeriesData = OHIF.viewer.loadedSeriesData; - - // Update the viewer data object - OHIF.viewer.data.viewportColumns = 1; - OHIF.viewer.data.viewportRows = 1; - OHIF.viewer.data.activeViewport = 0; - } - - // Store the viewer data in session for further user - Session.setPersistent('ViewerData', OHIF.viewer.data); - - Session.set('activeViewport', OHIF.viewer.data.activeViewport || 0); - - // @TypeSafeStudies - // Clears OHIF.viewer.Studies collection - OHIF.viewer.Studies.removeAll(); - - // @TypeSafeStudies - // Clears OHIF.viewer.StudyMetadataList collection - OHIF.viewer.StudyMetadataList.removeAll(); - - OHIF.viewer.data.studyInstanceUids = []; - instance.data.studies.forEach(study => { - const studyMetadata = new OHIF.metadata.StudyMetadata(study, study.studyInstanceUid); - let displaySets = study.displaySets; - - if (!study.displaySets) { - displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata); - study.displaySets = displaySets; - } - - studyMetadata.setDisplaySets(displaySets); - - study.selected = true; - OHIF.viewer.Studies.insert(study); - OHIF.viewer.StudyMetadataList.insert(studyMetadata); - OHIF.viewer.data.studyInstanceUids.push(study.studyInstanceUid); - - // Updates WADO-RS metaDataManager - OHIF.viewerbase.updateMetaDataManager(study); - }); - - // Call Viewer plugins onCreated functions - if(typeof OHIF.viewer.measurementTable.onCreated === 'function') { - OHIF.viewer.measurementTable.onCreated(instance); - } -}); - -Template.viewer.onRendered(function() { - const instance = Template.instance(); - this.autorun(function() { - // To make sure ohif viewerMain is rendered before initializing Hanging Protocols - const isOHIFViewerMainRendered = Session.get('OHIFViewerMainRendered'); - - // To avoid first run - if (isOHIFViewerMainRendered) { - // To run only when OHIFViewerMainRendered dependency has changed. - // because initHangingProtocol can have other reactive components - Tracker.nonreactive(initHangingProtocol); - } - }); - - // Call Viewer plugins onRendered functions - if(typeof OHIF.viewer.measurementTable.onRendered === 'function') { - OHIF.viewer.measurementTable.onRendered(instance); - } - -}); - -Template.viewer.events( Object.assign({ - // Viewer Events - }, - MeasurementTable.measurementEvents -)); - -Template.viewer.onDestroyed(function() { - if(typeof OHIF.viewer.measurementTable.onDestroyed === 'function') { - OHIF.viewer.measurementTable.onDestroyed(); - } -}); - -Template.viewer.helpers({ - state() { - return Template.instance().state; - } -}); diff --git a/OHIFViewer/client/components/viewer/viewer.styl b/OHIFViewer/client/components/viewer/viewer.styl deleted file mode 100644 index 7d3c9946f..000000000 --- a/OHIFViewer/client/components/viewer/viewer.styl +++ /dev/null @@ -1,13 +0,0 @@ -@import "{ohif:design}/app" - -body - background-color: black - -#viewer - background-color: black - height: 100% - width: 100% - -.loadingTextDiv - theme('color', '$textSecondaryColor') - font-size: 30px diff --git a/OHIFViewer/client/config.js b/OHIFViewer/client/config.js deleted file mode 100644 index bee9e5103..000000000 --- a/OHIFViewer/client/config.js +++ /dev/null @@ -1,38 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone'; - -Meteor.startup(function() { - const maxWebWorkers = Math.max(navigator.hardwareConcurrency - 1, 1); - const config = { - maxWebWorkers: maxWebWorkers, - startWebWorkersOnDemand: true, - webWorkerPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'), - taskConfiguration: { - decodeTask: { - loadCodecsOnStartup: true, - initializeCodecsOnStartup: false, - codecsPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'), - usePDFJS: false - } - } - }; - - cornerstoneWADOImageLoader.webWorkerManager.initialize(config); - - cornerstoneWADOImageLoader.configure({ - beforeSend: function(xhr) { - const headers = OHIF.DICOMWeb.getAuthorizationHeader(); - - if (headers.Authorization) { - xhr.setRequestHeader("Authorization", headers.Authorization); - } - } - }); -}); - -if (Meteor.settings && - Meteor.settings.public && - Meteor.settings.public.clientOnly === true) { - Meteor.disconnect(); -} diff --git a/OHIFViewer/client/log.js b/OHIFViewer/client/log.js deleted file mode 100644 index 5f3ef93a3..000000000 --- a/OHIFViewer/client/log.js +++ /dev/null @@ -1,3 +0,0 @@ -import loglevel from 'loglevel'; -log = loglevel.getLogger('OHIFViewer'); -log.setLevel('info'); diff --git a/OHIFViewer/client/routes.js b/OHIFViewer/client/routes.js deleted file mode 100644 index 7b0935ae0..000000000 --- a/OHIFViewer/client/routes.js +++ /dev/null @@ -1,69 +0,0 @@ -import { Meteor } from "meteor/meteor"; -import { Router } from 'meteor/clinical:router'; -import { OHIF } from 'meteor/ohif:core'; - -Router.configure({ - layoutTemplate: 'layout', -}); - - -// If we are running a disconnected client similar to the StandaloneViewer -// (see https://docs.ohif.org/standalone-viewer/usage.html) we don't want -// our routes to get stuck while waiting for Pub / Sub. -// -// In this case, the developer is required to add Servers and specify -// a CurrentServer with some other approach (e.g. a separate script). -if (Meteor.settings && - Meteor.settings.public && - Meteor.settings.public.clientOnly !== true) { - Router.waitOn(function() { - return [ - Meteor.subscribe('servers'), - Meteor.subscribe('currentServer') - ]; - }); -} - -Router.onBeforeAction('loading'); - -Router.route('/', function() { - Router.go('studylist', {}, { replaceState: true }); -}, { name: 'home' }); - -Router.route('/studylist', function() { - this.render('ohifViewer', { data: { template: 'studylist' } }); -}, { name: 'studylist' }); - -Router.route('/viewer/:studyInstanceUids', function() { - const studyInstanceUids = this.params.studyInstanceUids.split(';'); - OHIF.viewerbase.renderViewer(this, { studyInstanceUids }, 'ohifViewer'); -}, { name: 'viewerStudies' }); - -// OHIF #98 Show specific series of study -Router.route('/study/:studyInstanceUid/series/:seriesInstanceUids', function () { - const studyInstanceUid = this.params.studyInstanceUid; - const seriesInstanceUids = this.params.seriesInstanceUids.split(';'); - OHIF.viewerbase.renderViewer(this, { studyInstanceUids: [studyInstanceUid], seriesInstanceUids }, 'ohifViewer'); -}, { name: 'viewerSeries' }); - -Router.route('/IHEInvokeImageDisplay', function() { - const requestType = this.params.query.requestType; - - if (requestType === "STUDY") { - const studyInstanceUids = this.params.query.studyUID.split(';'); - - OHIF.viewerbase.renderViewer(this, {studyInstanceUids}, 'ohifViewer'); - } else if (requestType === "STUDYBASE64") { - const uids = this.params.query.studyUID; - const decodedData = window.atob(uids); - const studyInstanceUids = decodedData.split(';'); - - OHIF.viewerbase.renderViewer(this, {studyInstanceUids}, 'ohifViewer'); - } else if (requestType === "PATIENT") { - const patientUids = this.params.query.patientID.split(';'); - - Router.go('studylist', {}, {replaceState: true}); - } else { - Router.go('studylist', {}, {replaceState: true}); - } -}); diff --git a/OHIFViewer/package-lock.json b/OHIFViewer/package-lock.json deleted file mode 100644 index b7ed35c44..000000000 --- a/OHIFViewer/package-lock.json +++ /dev/null @@ -1,367 +0,0 @@ -{ - "name": "ohifviewer", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/runtime": { - "version": "7.0.0-beta.51", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.51.tgz", - "integrity": "sha1-SLjtGDBwNMZiD2Q1FGUMoszAFlo=", - "requires": { - "core-js": "^2.5.7", - "regenerator-runtime": "^0.11.1" - } - }, - "agent-base": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", - "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "buffer-from": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", - "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "es6-promise": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", - "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", - "dev": true - }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, - "extract-zip": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", - "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", - "dev": true, - "requires": { - "concat-stream": "1.6.2", - "debug": "2.6.9", - "mkdirp": "0.5.1", - "yauzl": "2.4.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "https-proxy-agent": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", - "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", - "dev": true, - "requires": { - "agent-base": "^4.1.0", - "debug": "^3.1.0" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "loglevel": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", - "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=" - }, - "mime": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", - "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "proxy-from-env": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", - "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=", - "dev": true - }, - "puppeteer": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0.tgz", - "integrity": "sha512-eELwFtFxL+uhmg4jPZOZXzSrPEYy4CaYQNbcchBbfxY+KjMpnv6XGf/aYWaQG49OTpfi2/DMziXtDM8XuJgoUA==", - "dev": true, - "requires": { - "debug": "^3.1.0", - "extract-zip": "^1.6.6", - "https-proxy-agent": "^2.2.1", - "mime": "^2.0.3", - "progress": "^2.0.0", - "proxy-from-env": "^1.0.0", - "rimraf": "^2.6.1", - "ws": "^5.1.1" - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "ws": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } - }, - "yauzl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", - "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", - "dev": true, - "requires": { - "fd-slicer": "~1.0.1" - } - } - } -} diff --git a/OHIFViewer/package.json b/OHIFViewer/package.json deleted file mode 100644 index a357cad00..000000000 --- a/OHIFViewer/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "ohifviewer", - "version": "1.0.0", - "description": "", - "main": "index.js", - "dependencies": { - "@babel/runtime": "7.0.0-beta.51", - "loglevel": "^1.6.1" - }, - "devDependencies": { - "puppeteer": "^1.5.0" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "MIT" -} diff --git a/OHIFViewer/public/images/logo.png b/OHIFViewer/public/images/logo.png deleted file mode 100644 index fc83b1354..000000000 Binary files a/OHIFViewer/public/images/logo.png and /dev/null differ diff --git a/Packages/.eslintignore b/Packages/.eslintignore deleted file mode 100644 index 2265c0e41..000000000 --- a/Packages/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -active-entry -hipaa-audit-log -meteor-stale-session -orthanc-remote -ohif-cornerstone -ohif-viewerbase/client/compatibility -ohif-core/client/lib/third-party/ diff --git a/Packages/.eslintrc.json b/Packages/.eslintrc.json deleted file mode 100644 index e09c61411..000000000 --- a/Packages/.eslintrc.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "parser": "babel-eslint", - "parserOptions": { - "allowImportExportEverywhere": true - }, - "plugins": [ - "meteor" - ], - "env": { - /* Allows global vars from the Meteor environment to pass and enables certain rules */ - "meteor": true, - "node": true, - "browser": true - }, - "extends": [ - "airbnb", - "plugin:meteor/recommended" - ], - "settings": { - "import/resolver": "meteor" - }, - "rules": { - "meteor/no-session": 0, // We are actually using Session for now... - "meteor/eventmap-params": [2, {"eventParamName": "event"}], - "meteor/eventmap-params": [2, {"templateInstanceParamName": "instance"}], - "import/no-extraneous-dependencies": 0, - "import/no-unresolved": 0, // There are a bunch of ESLint problems with Meteor's resolver - "import/no-duplicates": 0, // So we are disabling these for now - "import/extensions": 0, - "import/no-absolute-path": 0, - "no-console": 0, // For development - "no-plusplus": ["error", { "allowForLoopAfterthoughts": true }], - "indent": ["error", 4], - "new-cap": 0, // Until Match has an exception - "func-names": 0, // This is a bit of an annoying rule - "no-underscore-dangle": 0, // Doesn't seem to mesh with _id for MongoDB Ids (or SimpleSchema) - "max-len": 0, // TODO: re-enable the rules below and fix all of the errors - "consistent-return": 0, - "no-param-reassign": 0, - "no-mixed-operators": 0, - "arrow-body-style": 0, - "valid-typeof": 0, - "import/prefer-default-export": 0 - //"no-undef": 0 - }, - "globals": {} -} \ No newline at end of file diff --git a/Packages/active-entry/.travis.yml b/Packages/active-entry/.travis.yml deleted file mode 100755 index 27cbbc9d8..000000000 --- a/Packages/active-entry/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: node_js -node_js: - - "0.10" -#sudo: required - -sudo: required - -env: - global: - - METEOR_ENV=development - -before_install: - - "curl -L http://git.io/ejPSng | /bin/sh" diff --git a/Packages/active-entry/Contributing.md b/Packages/active-entry/Contributing.md deleted file mode 100644 index aa34713b2..000000000 --- a/Packages/active-entry/Contributing.md +++ /dev/null @@ -1,34 +0,0 @@ -## Contributing - -**Submit your Pull Request on a Feature Branch** - -- To ensure your pull-request has the greatest chance of getting merged in, please submit it on a feature branch rather than directly to master. -- Please see [A successful Git branching model](http://nvie.com/posts/a-successful-git-branching-model/) for more details. - -**Quality Assurance** -- Pull Requests will be generally accepted as long as the QA tests pass on [Circle CI](https://circleci.com/gh/clinical-meteor/clinical-active-entry). -- Begin a Pull Request by logging an Issue for discussion. -- Next, clone the package into a project for local development. -- Use ``git checkout -b newfeature`` to create a new branch. -- Run the package verification tests to ensure that the test runner works. -- Add an it() clause at the bottom of the [activeEntryTests.js](https://github.com/clinical-meteor/clinical-active-entry/blob/master/tests/gagarin/activeEntryTests.js) file for each new feature you wish to implement. -- Sketch out a test script for a feature. -- Run the verification tests, and confirm that the new test fails. -- Update the package with the new feature until the new test passes. -- Push the package to the repo on GitHub. -- Submit a pull-request. -- If the PR passes tests on Circle CI, we'll merge it in! - -**Reference Implementation** -- Please see the [ChecklistManifest](http://checklist-manifesto.meteor.com/) and it's [source code](https://github.com/clinical-meteor/checklist-manifesto) for a reference implementation of the ActiveEntry package. It's being built as a workqueue, and is being designed to be FDA, HIPAA, and HL7 FHIR compliant. - -**Feature Toggling** -- In general, it's a best practice to implement features that can be enabled/disabled. Some people will want a feature; others will not. The best way to toggle features is adding them to a config file, which is what the [ActiveEntry](https://github.com/clinical-meteor/clinical-active-entry/blob/master/lib/ActiveEntry.js) object is for. -- It's recommended that fields be added to the ActiveEntryConfig object that can be used to enabled/disable the feature you are implementing. -- The ActiveEntryConfig object can be roughly considered as analogous to the ``props`` field that is passed into React templates. - -**Theming and Styling** -- Different apps require different presentation/style layers, so Clinical Meteor has implemented a [Theme](https://github.com/clinical-meteor/clinical-theming/blob/master/objects/Theme.js) object which manages theming. Generally speaking, we're trying to avoid the inclusion of third-party component libraries, UI widgets, and CSS frameworks, and keeping the Clinical Meteor packages as close to the default HTML that Blaze produces as possible (while using line styles for animation effects). -- Generally speaking, Bootstrap HTML structure in acceptable in designing pages, but avoid including global CSS files, and keep any CSS locally scoped using LESS nested classes. This approach allows people to add the Bootstrap library if they want it, prevents cascading leaks, and allows more fine-grained control over CSS to implement animation effects. -- Pull requests that include visual integration with other projects are acceptable, but please submit an issue for discussion before submitting PRs with wholesale changes that include Jade, Material UI, React, etc. -- The ActiveEntry pages are designed to be used in an IronRouter Layout template. As such, no height/width constraints are provided. It's assumed that the layout template will take care of such things. But basic padding/margin is provided. diff --git a/Packages/active-entry/README.md b/Packages/active-entry/README.md deleted file mode 100755 index 5fe15f346..000000000 --- a/Packages/active-entry/README.md +++ /dev/null @@ -1,130 +0,0 @@ -## clinical:active-entry - -This package provides the SignIn, SignUp, and ForgotPassword pages. - -[![Circle CI](https://circleci.com/gh/clinical-meteor/active-entry/tree/master.svg?style=svg)](https://circleci.com/gh/clinical-meteor/active-entry/tree/master) - -=============================== -#### Installation - -```` -meteor add clinical:active-entry -```` - -=============================== -#### Entry Flowchart - -The following diagram represents the entry workflow that is being implemented in this package. This package is under active development, and is about half completed. Pull requests which help implement the following workflow will be fast-tracked and accepted into the package. - -![entry-workflow](https://raw.githubusercontent.com/clinical-meteor/active-entry/master/docs/Entry%20Workflow.png) - - - -=============================== -#### Routing API - -```` -/entrySignIn -/entrySignUp -/forgotPassword -```` - -=============================== -#### Component API - -```` -{{> entrySignIn }} -{{> entrySignUp }} -{{> forgotPassword }} -```` - - -=============================== -#### ActiveEntry Configuration - -````js - -if(Meteor.isClient){ - ActiveEntry.configure({ - logo: { - url: "/mini-circles.png", - displayed: true - }, - signIn: { - displayFullName: true, - destination: "/table/users" - }, - signUp: { - destination: "/table/users" - }, - themeColors: { - primary: "" - } - }); -} - -if(Meteor.isServer){ - Accounts.emailTemplates.siteName = "AwesomeSite"; - Accounts.emailTemplates.from = "AwesomeSite Admin "; - Accounts.emailTemplates.enrollAccount.subject = function (user) { - return "Welcome to Awesome Town, " + user.profile.name; - }; - Accounts.emailTemplates.enrollAccount.text = function (user, url) { - return "You have been selected to participate in building a better future!" - + " To activate your account, simply click the link below:\n\n" - + url; - }; - - Meteor.startup(function(){ - process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587'; - }) -} -```` -Alternatively, you may want to set the ``MAIL_URL`` via an external environment variable, particularly if you're using a SaaS hosting provider. - -````sh -MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587' meteor -```` - -=============================== -#### Local Development - -Simply clone the repository into your ``/packages`` directory. You can also specify the packages you want to develop locally in your ``.git-packages.json`` file, and use starrynight to fetch them. - -````bash -# clone a single package into your application -git clone http://github.com/clinical-meteor/clinical-active-entry packages/active-entry - -# fetch all the packages listed in git-packages.json -starrynight fetch -```` - -=============================== -#### Quality Assurance Testing - -There are two types of quality assurance tests you can run: verification and validation tests. Verification tests are similar to unit or integration tests; and can run either at the application or package level. Validation tests are application-wide, but often require commands exposed in packages. So you'll need to run the ``autoconfig`` command to scan the filesystem for validation commands. See [http://starrynight.meteor.com/](http://starrynight.meteor.com/) for more details. - -````bash -# install the testing utility -npm install -g starrynight - -# verification testing (a.k.a. package-level unit/integration testing) -starrynight run-tests --type package-verification - -#to run validation tests, you'll need an ``.initializeUsers()`` function -meteor add clinical:accounts-housemd - -#validation testing (a.k.a. application acceptance/end-to-end testing) -starrynight autoscan -starrynight run-tests --type validation -```` - -=============================== -#### Contributing - -See our [notes on contributing](https://github.com/clinical-meteor/clinical-active-entry/blob/master/Contributing.md). - -=============================== -#### Licensing - -![MIT License](https://img.shields.io/badge/license-MIT-blue.svg) diff --git a/Packages/active-entry/circle.yml b/Packages/active-entry/circle.yml deleted file mode 100644 index f4a45a711..000000000 --- a/Packages/active-entry/circle.yml +++ /dev/null @@ -1,84 +0,0 @@ -## Customize the test machine -machine: - node: - version: 0.10.33 - - # Timezone - timezone: - America/Los_Angeles # Set the timezone - - # Add some environment variables - environment: - CIRCLE_ENV: test - CXX: g++-4.8 - DISPLAY: :99.0 - NPM_PREFIX: /home/ubuntu/nvm/v0.10.33 - - -## Customize checkout -checkout: - post: - #- git submodule sync - #- git submodule update --init --recursive # use submodules - -#general: -# build_dir: helloworld - -## Customize dependencies -dependencies: - cache_directories: - - ~/.meteor # relative to the user's home directory - - ~/nvm/v0.10.33/lib/node_modules/starrynight - - ~/nvm/v0.10.33/bin/starrynight - - pre: - # Install Starrynight unless it is cached - - if [ ! -e ~/nvm/v0.10.33/bin/starrynight ]; then npm install -g starrynight; else echo "Starrynight seems to be cached"; fi; - # Install Meteor - - mkdir -p ${HOME}/.meteor - # If Meteor is already cached, do not need to build it again. - - if [ ! -e ${HOME}/.meteor/meteor ]; then curl https://install.meteor.com | /bin/sh; else echo "Meteor seems to be cached"; fi; - # Link the meteor executable into /usr/bin - - sudo ln -s $HOME/.meteor/meteor /usr/bin/meteor - # Check if the helloworld directory already exists, if it doesn't, create the helloworld app - # The following doesn't work, because it should be checking ${HOME}/active-entry/helloworld - # - if [ ! -e ${HOME}/helloworld ]; then meteor create --release METEOR@1.1.0.3 helloworld; else echo "helloworld app seems to be cached"; fi; - - override: - - cd ${HOME} && meteor create --release METEOR@1.1.0.3 helloworld - - cd ${HOME}/helloworld - - cd ${HOME}/helloworld && ls -la - - cd ${HOME}/helloworld && rm helloworld.* - - cd ${HOME}/helloworld && mkdir packages && mkdir packages/active-entry - - cp -R * ${HOME}/helloworld/packages/active-entry - - cd ${HOME}/helloworld && meteor add anti:gagarin@0.4.11 accounts-base accounts-password session meteor-platform clinical:user-model clinical:active-entry - - cd ${HOME}/helloworld && starrynight autoconfig - - cd ${HOME}/helloworld && meteor list - - cat tests/gagarin/activeEntryTests.js - - ls -la - - cd ~ && ls -la - - cd ${HOME} && pwd - - cd ${HOME} && ls -la - - cd ${HOME}/helloworld && ls -la - -## Customize test commands -test: - pre: - - cd helloworld && meteor: - background: true - - sleep 30 - override: - - cd ${HOME}/helloworld && starrynight run-tests --type package-verification - -## Customize deployment commands -#deployment: -# production: -# branch: master -# commands: -# - printf "\n\n" | meteor deploy circlecivelocity.meteor.com - -## Custom notifications -#notify: - #webhooks: - # A list of hashes representing hooks. Only the url field is supported. - #- url: https://someurl.com/hooks/circle diff --git a/Packages/active-entry/components/changePassword/changePassword.html b/Packages/active-entry/components/changePassword/changePassword.html deleted file mode 100755 index c7ef947f6..000000000 --- a/Packages/active-entry/components/changePassword/changePassword.html +++ /dev/null @@ -1,48 +0,0 @@ - diff --git a/Packages/active-entry/components/changePassword/changePassword.js b/Packages/active-entry/components/changePassword/changePassword.js deleted file mode 100755 index 9289111b9..000000000 --- a/Packages/active-entry/components/changePassword/changePassword.js +++ /dev/null @@ -1,100 +0,0 @@ -//========================================== - -Router.route('/changePassword', { - name: "changePassword", - template: "changePassword" -}); - - -Template.changePassword.helpers({ - getChangePasswordMessageColor: function (){ - if (ActiveEntry.errorMessages.get('changePasswordError')) { - return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;" - } else { - return "color: black;" - } - }, - getChangePasswordMessage: function (){ - if (ActiveEntry.errorMessages.get('changePasswordError')) { - return ActiveEntry.errorMessages.get('changePasswordError'); - } else { - return Session.get('defaultSignInMessage'); - } - }, - getPasswordStyling: function () { - if (ActiveEntry.errorMessages.equals('password', "Password is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('password', "Password is weak")) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.errorMessages.equals('password', "Password present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - getConfirmPasswordStyling: function () { - if (ActiveEntry.errorMessages.equals('confirm', "Password is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('confirm', "Passwords do not match")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('confirm', "Password is weak")) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.errorMessages.equals('confirm', "Passwords match")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - - changePasswordErrorMessages: function() { - var allErrorMessages = Object.keys(ActiveEntry.errorMessages.all()).filter(function(key) { - return (key === "password" || key === "confirm") && ActiveEntry.errorMessages.get(key); - }); - - if (allErrorMessages.length > 0) { - var errorMessage = ActiveEntry.errorMessages.get(allErrorMessages[0]); - if (errorMessage) { - return [errorMessage]; - } - } - - return; - } -}); - - -Template.changePassword.events({ - 'change, keyup #changePasswordPagePasswordInput': function (event, template) { - var password = $('[name="password"]').val(); - var confirmPassword = $('[name="confirm"]').val(); - - ActiveEntry.verifyPassword(password); - ActiveEntry.errorMessages.set('changePasswordError', null); - }, - 'change, keyup #changePasswordPagePasswordConfirmInput': function (event, template) { - var password = $('[name="password"]').val(); - var confirmPassword = $('[name="confirm"]').val(); - - ActiveEntry.verifyConfirmPassword(password, confirmPassword); - ActiveEntry.errorMessages.set('changePasswordError', null); - }, - "submit": function (event, template) { - event.preventDefault(); - - var oldPassword = $('[name="oldPassword"]').val(); - - var password = $('[name="password"]').val(); - var confirmPassword = $('[name="confirm"]').val(); - - ActiveEntry.verifyConfirmPassword(password, confirmPassword); - ActiveEntry.errorMessages.set('changePasswordError', null); - - - if (ActiveEntry.errorMessages.get('password') || ActiveEntry.errorMessages.get('confirm') || !oldPassword) { - return; - } - - ActiveEntry.changePassword(oldPassword, password); - - } -}); diff --git a/Packages/active-entry/components/changePassword/changePassword.less b/Packages/active-entry/components/changePassword/changePassword.less deleted file mode 100755 index b68dbb62c..000000000 --- a/Packages/active-entry/components/changePassword/changePassword.less +++ /dev/null @@ -1,5 +0,0 @@ -#changePassword{ - input{ - padding-left: 40px; - } -} diff --git a/Packages/active-entry/components/entryPages.js b/Packages/active-entry/components/entryPages.js deleted file mode 100755 index 144f04f18..000000000 --- a/Packages/active-entry/components/entryPages.js +++ /dev/null @@ -1,52 +0,0 @@ - -/** - * @summary Determines if a block of code should be displayed based on whether the logo is set to be displayed. - * @locus Client - * @memberOf Entry - * @name {{logoIsDisplayed}} - * @version 1.2.3 - * @returns {Boolean} - * @example - * ```html - * {{#if logoIsDisplayed}} -* - * {{/if}} - * ``` - */ -Template.registerHelper("logoIsDisplayed", function (argument){ - var config = Session.get('Photonic.ActiveEntry'); - if(config && config.logo && config.logo.displayed){ - return config.logo.displayed; - }else{ - return false; - } -}); - - -/** - * @summary Retruns the Url of the logo asset. - * @locus Client - * @memberOf Entry - * @name {{logoUrl}} - * @version 1.2.3 - * @returns {String} - * @example - * ```html - * {{#if logoIsDisplayed}} -* - * {{/if}} - * ``` - */ -Template.registerHelper("logoUrl", function (argument){ - var config = Session.get('Photonic.ActiveEntry'); - if(config && config.logo && config.logo.url){ - return config.logo.url; - }else{ - return ""; - } -}); - - -Template.registerHelper("getButtonColor", function (argument){ - return "background-color: " + Theme.getPaletteColor("colorB") + "; "; -}); diff --git a/Packages/active-entry/components/entryPages.less b/Packages/active-entry/components/entryPages.less deleted file mode 100755 index 2536871c4..000000000 --- a/Packages/active-entry/components/entryPages.less +++ /dev/null @@ -1,169 +0,0 @@ -// @import 'client/app/stylesheets/util/reset.lessimport'; -// @import 'client/app/stylesheets/util/lesshat.lessimport'; -// @import 'client/app/stylesheets/util/typography.lessimport'; - - -// this probably wants to be moved into clinical:glass-ui -.entryPage { - input, button, select{ - font-size: 14px; - line-height: 20px; - font-family: 'Open Sans', "Helvetica Neue", Helvetica, Arial, sans-serif; - font-style: 400; - padding: .75rem 0; - line-height: 1.5rem !important; - border: none; - border-radius: 0; - box-sizing: border-box; - //color: #333333; - outline: none; - padding-left: 3em; - } -} - -.entryLogo{ - //background-color: lightgray; - height: 200px; - width: 200px; - background-size: contain; - background-repeat: no-repeat; - margin-left: auto; - margin-right: auto; -} - -.btn-primary{ - background-color: forestgreen; - color: #ffffff; -} -.btn-gray{ - background-color: #aaaaaa; - color: white; -} -.btn-main{ - font-weight: 300; - letter-spacing: 3px; - text-transform: uppercase; -} -.input-symbol { - display: inline-block; - position: relative; -} - -.entryPage { - text-align: center; - - input, button{ - width: 100%; - } - - .fa{ - position: absolute; - left: 0px; - top: 0px; - padding-left: 15px; - padding-top: 14px; - } - - .checkmarkIcon{ - position: absolute; - color: #831d2c; - } - .btn-gray{ - width: 100%; - } - .checkmarkTitle{ - padding-bottom: 100px; - } - .fa{ - position: absolute; - left: 0px; - top: 0px; - padding-left: 15px; - padding-top: 16px; - // color: #555555; - } - - .wrapper-auth { - //padding-top: 4em; - - @media screen and (min-width: 40em) { - margin: 0 auto; - max-width: 480px; - width: 80%; - } - @media screen and (max-width: 480px) { - margin: 0 auto; - padding-left: 20px; - padding-right: 20px; - } - // .input-symbol{ - // border: 1px solid gray; - // } - - .title-auth { - color: black; - margin-bottom: .75rem; - } - - .subtitle-auth { - color: black; - //margin: 0 15% 3rem; - margin-bottom: 2rem; - padding: 15px; - } - - form { - input{ - color: #333333; - height: 48px; - border-left: solid 1px !important; - } - .input-symbol { - margin-bottom: 1px; - width: 100%; - } - - .btn-primary { - //margin: 1em 5% 0; - //width: 90%; - margin-top: 1em; - - @media screen and (min-width: 40em) { - // margin-left: 0; - // margin-right: 0; - width: 100%; - } - } - } - .list-errors { - margin-top: -2rem; - .taskItems { - //.title-caps; - background: white; - color: red; - font-size: .625em; // 10px - margin-bottom: 1px; - padding: .7rem 0; - } - } - } - - .link-auth-alt { - //.font-s1; - //.position(absolute, auto, 0, 1em, 0); - color: black; - display: inline-block; - - @media screen and (min-width: 40em) { - bottom: 0; - margin-top: 1rem; - position: relative; - } - } - - // @media only screen and (max-width: 704px) { - // .fa{ - // left: 5%; - // } - // } -} diff --git a/Packages/active-entry/components/entrySignIn/.tests/actions/meteorLogout.js b/Packages/active-entry/components/entrySignIn/.tests/actions/meteorLogout.js deleted file mode 100755 index 636737ab9..000000000 --- a/Packages/active-entry/components/entrySignIn/.tests/actions/meteorLogout.js +++ /dev/null @@ -1,10 +0,0 @@ - - -exports.command = function () { - this - .execute(function () { - return Meteor.logout(); - }).pause(1000); - - return this; -}; diff --git a/Packages/active-entry/components/entrySignIn/.tests/actions/signIn.js b/Packages/active-entry/components/entrySignIn/.tests/actions/signIn.js deleted file mode 100755 index 2da9ff589..000000000 --- a/Packages/active-entry/components/entrySignIn/.tests/actions/signIn.js +++ /dev/null @@ -1,23 +0,0 @@ -exports.command = function (email, password) { - - this.verify.elementPresent("#entrySignIn"); - - if (email) { - this - .verify.elementPresent("#signInPageEmailInput") - .clearValue("#signInPageEmailInput") - .setValue("#signInPageEmailInput", email); - } - - - if (password) { - this - .verify.elementPresent("#signInPagePasswordInput") - .clearValue("#signInPagePasswordInput") - .setValue("#signInPagePasswordInput", password); - } - - this.click("#signInToAppButton").pause(1000); - - return this; -}; diff --git a/Packages/active-entry/components/entrySignIn/.tests/actions/signOut.js b/Packages/active-entry/components/entrySignIn/.tests/actions/signOut.js deleted file mode 100755 index ab6742b39..000000000 --- a/Packages/active-entry/components/entrySignIn/.tests/actions/signOut.js +++ /dev/null @@ -1,22 +0,0 @@ -exports.command = function (fullname) { - this - .sectionBreak(".signOut()"); - - if (fullname) { - this - .verify.elementPresent("#usernameLink") - .verify.containsText("#usernameLink", fullname); - } - - this - .verify.elementPresent("#logoutLink") - .click("#logoutLink").pause(1000); - - if (fullname) { - this - .verify.elementPresent("#usernameLink") - .verify.containsText("#usernameLink", "Sign In"); - } - - return this; -}; diff --git a/Packages/active-entry/components/entrySignIn/.tests/reviewSignIn.js b/Packages/active-entry/components/entrySignIn/.tests/reviewSignIn.js deleted file mode 100755 index 3c23fe4a0..000000000 --- a/Packages/active-entry/components/entrySignIn/.tests/reviewSignIn.js +++ /dev/null @@ -1,35 +0,0 @@ -exports.command = function (email, password, title, message) { - this - // .verify.element("#entrySignIn").to.be.visible - // .verify.element("#signInPageTitle").to.be.visible - // .verify.element("#signInPageMessage").to.be.visible - // .verify.element("#signInPageEmailInput").to.be.visible - // .verify.element("#signInPagePasswordInput").to.be.visible - // .verify.element("#signInToAppButton").to.be.visible - // .verify.element("#needAnAccountButton").to.be.visible - // - - .verify.elementPresent("#entrySignIn") - .verify.elementPresent("#signInPageTitle") - .verify.elementPresent("#signInPageMessage") - .verify.elementPresent("#signInPageEmailInput") - .verify.elementPresent("#signInPagePasswordInput") - .verify.elementPresent("#signInToAppButton") - .verify.elementPresent("#needAnAccountButton"); - - if (email) { - this.verify.containsText("#signInPageEmailInput", email); - } - if (password) { - this.verify.containsText("#signInPageEmailInput", password); - } - - if (title) { - this.verify.containsText("#signInPageTitle", title); - } - if (message) { - this.verify.containsText("#signInPageMessage", message); - } - - return this; -}; diff --git a/Packages/active-entry/components/entrySignIn/entrySignIn.html b/Packages/active-entry/components/entrySignIn/entrySignIn.html deleted file mode 100755 index 6428d807a..000000000 --- a/Packages/active-entry/components/entrySignIn/entrySignIn.html +++ /dev/null @@ -1,73 +0,0 @@ - diff --git a/Packages/active-entry/components/entrySignIn/entrySignIn.js b/Packages/active-entry/components/entrySignIn/entrySignIn.js deleted file mode 100755 index 2bf3adc08..000000000 --- a/Packages/active-entry/components/entrySignIn/entrySignIn.js +++ /dev/null @@ -1,205 +0,0 @@ - -// REFACTOR: Move to ActiveRecord object -//Session.set("defaultSignInMessage", "Improve your clinical practice with checklists."); - -//================================================================================================== -// ROUTER - -Router.route('/entrySignIn', { - template: 'entrySignIn', - name: 'entrySignIn' -}); -Router.route('/sign-in', { - template: 'entrySignIn', - name: 'signInRoute' -}); - -//================================================================================================== -// COMPONENT OUTPUTS - - - - -Template.entrySignIn.helpers({ - getSignInMessageColor: function (){ - if (ActiveEntry.errorMessages.get('signInError')) { - return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;" - } else { - return "color: black;" - } - }, - getSignInMessage: function (){ - if (ActiveEntry.errorMessages.get('signInError')) { - return ActiveEntry.errorMessages.get('signInError'); - } else { - return Session.get('defaultSignInMessage'); - } - }, - getButtonText: function () { - return "Sign In"; - // if (ActiveEntry.errorMessages.get('signInError')){ - // return ActiveEntry.errorMessages.get('signInError'); - // } else { - // return "Sign In"; - // } - }, - getEmailValidationStyling: function () { - if (ActiveEntry.errorMessages.equals('email', "Email is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('email', "Email is poorly formatted")) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.successMessages.equals('email', "Email present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - getPasswordValidationStyling: function () { - if (ActiveEntry.errorMessages.equals('password', "Password is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('password', Session.get('passwordWarning'))) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.successMessages.equals('password', "Password present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - - getLDAPUsernameValidationStyling: function() { - if (ActiveEntry.errorMessages.equals('ldapUsername', "Username is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.successMessages.equals('ldapUsername', "Username present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - getLDAPPasswordValidationStyling: function() { - if (ActiveEntry.errorMessages.equals('ldapPassword', "Password is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.successMessages.equals('ldapPassword', "Password present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - isLDAPSet: function() { - return Session.get('isLDAPSet'); - }, - ldapErrorMessages: function () { - if (ActiveEntry.errorMessages.get("ldapUsername")) { - return [ActiveEntry.errorMessages.get("ldapUsername")]; - } else if(ActiveEntry.errorMessages.get("ldapPassword")) { - return [ActiveEntry.errorMessages.get("ldapPassword")]; - } - - return; - } - -}); - -//================================================================================================== -// COMPONENT OUTPUTS - -Template.entrySignIn.events({ - 'click #logoutButton': function () { - Meteor.logout(); - }, - 'click #forgotPasswordButton': function (event) { - event.preventDefault(); - ActiveEntry.reset(); - Router.go('/forgotPassword'); - }, - "click #needAnAccountButton": function (event) { - event.preventDefault(); - ActiveEntry.reset(); - Router.go('/entrySignUp'); - }, - 'keyup input[name="email"]': function (event, template) { - var email = $('input[name="email"]').val(); - - ActiveEntry.verifyEmail(email); - ActiveEntry.errorMessages.set('signInError', null); - setSignInButtonStyling(); - }, - 'change input[name="email"]': function (event, template) { - var email = $('input[name="email"]').val(); - - ActiveEntry.verifyEmail(email); - ActiveEntry.errorMessages.set('signInError', null); - setSignInButtonStyling(); - }, - 'keyup #signInPagePasswordInput': function (event, template) { - var password = $('input[name="password"]').val(); - - ActiveEntry.verifyPassword(password); - ActiveEntry.errorMessages.set('signInError', null); - setSignInButtonStyling(); - }, - 'change #signInPagePasswordInput': function (event, template) { - var password = $('input[name="password"]').val(); - - ActiveEntry.verifyPassword(password); - ActiveEntry.errorMessages.set('signInError', null); - setSignInButtonStyling(); - }, - 'keyup, change #signInLDAPUsernameInput': function (event, template) { - var username = $('#signInLDAPUsernameInput').val(); - ActiveEntry.verifyLDAPUsername(username); - ActiveEntry.errorMessages.set('signInError', null); - }, - 'keyup, change #signInLDAPPasswordInput': function (event, template) { - var password = $('#signInLDAPPasswordInput').val(); - ActiveEntry.verifyLDAPPassword(password); - ActiveEntry.errorMessages.set('signInError', null); - }, - // 'submit': function (event, template) { - // event.preventDefault(); - // var emailValue = template.$('[name=email]').val(); - // var passwordValue = template.$('[name=password]').val(); - // - // ActiveEntry.signIn(emailValue, passwordValue); - // }, - 'click #signInToAppButton': function (event, template){ - ActiveEntry.reset(); - // var emailValue = template.$('[name=email]').val(); - // var passwordValue = template.$('[name=password]').val(); - var emailValue = template.$('#signInPageEmailInput').val(); - var passwordValue = template.$('#signInPagePasswordInput').val(); - - ActiveEntry.signIn(emailValue, passwordValue); - event.preventDefault(); - }, - 'keyup #entrySignIn': function(event, template) { - if(event.keyCode == 13) { - $("#signInToAppButton").click(); - $("#signInLDAPToAppButton").click(); - - } - }, - 'click #signInLDAPToAppButton': function(e, template) { - var username = template.$("#signInLDAPUsernameInput").val(); - var password = template.$("#signInLDAPPasswordInput").val(); - ActiveEntry.loginWithLDAP(username, password); - } -}); - - - -//================================================================================================== - -// Sets SignInButton Styling according to email and password fields -function setSignInButtonStyling() { - var signInToAppButton = $("#signInToAppButton"); - if ($("#signInPagePasswordInput").val() && ActiveEntry.successMessages.get('email')) { - // Set button as enable - signInToAppButton.removeClass("disabledButton"); - signInToAppButton.attr("disabled", false); - } else { - signInToAppButton.addClass("disabledButton"); - signInToAppButton.attr("disabled", true); - - - } -} \ No newline at end of file diff --git a/Packages/active-entry/components/entrySignIn/entrySignIn.less b/Packages/active-entry/components/entrySignIn/entrySignIn.less deleted file mode 100755 index 4cc2f5fc3..000000000 --- a/Packages/active-entry/components/entrySignIn/entrySignIn.less +++ /dev/null @@ -1,31 +0,0 @@ -#entrySignIn{ - padding: 40px; - input{ - padding-left: 40px; - color: #333333 !important; - } - #errorMessages{ - padding-top: .5rem; - padding-bottom: .5rem; - font-size: 14px; - box-sizing: border-box; - width: 100.5%; - margin-bottom: 15px; - color: red; - font-weight: bold; - } - - .disabledButton { - border: none; - background-image: none; - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); - filter: alpha(opacity=40); - -khtml-opacity: 0.40; - -moz-opacity: 0.40; - opacity: 0.40; - cursor: not-allowed; - box-shadow: none; - } - - -} \ No newline at end of file diff --git a/Packages/active-entry/components/entrySignUp/.tests/actions/dropEntryUsers.js b/Packages/active-entry/components/entrySignUp/.tests/actions/dropEntryUsers.js deleted file mode 100644 index 3e19972ec..000000000 --- a/Packages/active-entry/components/entrySignUp/.tests/actions/dropEntryUsers.js +++ /dev/null @@ -1,22 +0,0 @@ -// async version calls method on the server -exports.command = function () { - var client = this; - - this - .timeoutsAsyncScript(5000) - .executeAsync(function (data, meteorCallback) { - //return HipaaLogger.logEventObject(data); - Meteor.call("dropEntryUsers", data, function (meteorError, meteorResult) { - var response = (meteorError ? { - error: meteorError - } : { - result: meteorResult - }); - meteorCallback(response); - }); - }, [], function (result) { - //console.log("result.value", result.value); - //client.assert.ok(result.value); - }).pause(1000); - return this; -}; diff --git a/Packages/active-entry/components/entrySignUp/.tests/actions/resetEntry.js b/Packages/active-entry/components/entrySignUp/.tests/actions/resetEntry.js deleted file mode 100644 index d9cd8bc0a..000000000 --- a/Packages/active-entry/components/entrySignUp/.tests/actions/resetEntry.js +++ /dev/null @@ -1,11 +0,0 @@ - -// resetEntry.js -exports.command = function () { - - this - .timeoutsAsyncScript(5000) - .executeAsync(function (data, meteorCallback) { - ActiveEntry.reset(); - }, []).pause(1000); - return this; -}; diff --git a/Packages/active-entry/components/entrySignUp/.tests/actions/signUp.js b/Packages/active-entry/components/entrySignUp/.tests/actions/signUp.js deleted file mode 100755 index fecd06ce3..000000000 --- a/Packages/active-entry/components/entrySignUp/.tests/actions/signUp.js +++ /dev/null @@ -1,37 +0,0 @@ -exports.command = function (email, password, fullName) { - - this.verify.elementPresent("#entrySignUp"); - - if (email) { - this - .verify.elementPresent("#signUpPageEmailInput") - .clearValue("#signUpPageEmailInput") - .setValue("#signUpPageEmailInput", email); - } - - - if (password) { - this - .verify.elementPresent("#signUpPagePasswordInput") - .clearValue("#signUpPagePasswordInput") - .setValue("#signUpPagePasswordInput", password) - - .verify.elementPresent("#signUpPagePasswordConfirmInput") - .clearValue("#signUpPagePasswordConfirmInput") - .setValue("#signUpPagePasswordConfirmInput", password); - } - - - if (fullName) { - this - .verify.elementPresent("#signUpPageFullNameInput") - .clearValue("#signUpPageFullNameInput") - .setValue("#signUpPageFullNameInput", fullName); - } - - - this.click("#signUpPageJoinNowButton").pause(300); - - - return this; -}; diff --git a/Packages/active-entry/components/entrySignUp/.tests/reviewSignUp.js b/Packages/active-entry/components/entrySignUp/.tests/reviewSignUp.js deleted file mode 100755 index 926f22599..000000000 --- a/Packages/active-entry/components/entrySignUp/.tests/reviewSignUp.js +++ /dev/null @@ -1,31 +0,0 @@ -exports.command = function (email, password, fullName, message) { - this - .verify.elementPresent("#entrySignUp") - .verify.elementPresent("#signUpPageTitle") - .verify.elementPresent("#signUpPageMessage") - .verify.elementPresent("#signUpPageFullNameInput") - .verify.elementPresent("#signUpPageEmailInput") - .verify.elementPresent("#signUpPagePasswordInput") - .verify.elementPresent("#signUpPagePasswordConfirmInput") - - .verify.elementPresent("#signUpPageJoinNowButton") - .verify.elementPresent("#signUpPageSignInButton"); - - if (email) { - this.verify.containsText("#signUpPageEmailInput", email); - } - if (password) { - this.verify.containsText("#signUpPagePasswordInput", password) - .verify.containsText("#signUpPagePasswordConfirmInput", password); - } - if (fullName) { - this.verify.containsText("#signUpPageFullNameInput", fullName); - } - if (message) { - this.verify.elementPresent("#errorMessages") - .verify.containsText("#errorMessages", message); - } - - - return this; -}; diff --git a/Packages/active-entry/components/entrySignUp/entrySignUp.html b/Packages/active-entry/components/entrySignUp/entrySignUp.html deleted file mode 100755 index 05a15a177..000000000 --- a/Packages/active-entry/components/entrySignUp/entrySignUp.html +++ /dev/null @@ -1,64 +0,0 @@ - diff --git a/Packages/active-entry/components/entrySignUp/entrySignUp.js b/Packages/active-entry/components/entrySignUp/entrySignUp.js deleted file mode 100755 index 69866adfb..000000000 --- a/Packages/active-entry/components/entrySignUp/entrySignUp.js +++ /dev/null @@ -1,171 +0,0 @@ -//================================================================================================== -// ROUTER - -Router.route('/entrySignUp', { - template: 'entrySignUp', - name: 'entrySignUp' -}); -Router.route('/sign-up', { - template: 'entrySignUp', - name: 'signUpRoute' -}); - -//================================================================================================== - - - -Template.entrySignUp.helpers({ - getSignUpMessageColor: function (){ - if (ActiveEntry.errorMessages.get('signInError')) { - return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;"; - } else { - return "color: black;"; - } - }, - getSignUpMessage: function (){ - if (ActiveEntry.errorMessages.get('signInError')) { - return ActiveEntry.errorMessages.get('signInError'); - } else { - return Session.get('defaultSignInMessage'); - } - }, - entryErrorMessages: function () { - var allErrorMessages = Object.keys(ActiveEntry.errorMessages.all()).filter(function(key) { - return key !== "signInError" && ActiveEntry.errorMessages.get(key); - }); - - if (allErrorMessages.length > 0) { - var errorMessage = ActiveEntry.errorMessages.get(allErrorMessages[0]); - if (errorMessage) { - return [errorMessage]; - } - } - - return; - }, - getButtonText: function () { - if (ActiveEntry.errorMessages.get('signInError')) { - return ActiveEntry.errorMessages.get('signInError').message; - } else { - return "Sign In"; - } - }, - getEmailStyling: function () { - if (ActiveEntry.errorMessages.equals('email', "Email is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('email', "Email is poorly formatted")) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.successMessages.equals('email', "Email present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - getPasswordStyling: function () { - if (ActiveEntry.errorMessages.equals('password', "Password is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('password', Session.get('passwordWarning'))) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.successMessages.equals('password', "Password present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - getConfirmPasswordStyling: function () { - if (ActiveEntry.errorMessages.equals('confirm', "Password is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('confirm', "Passwords do not match")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('confirm', "Password is weak")) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.successMessages.equals('confirm', "Passwords match")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - }, - getFullNameStyling: function () { - if (ActiveEntry.errorMessages.equals('fullName', "Name is required")) { - return "border: 1px solid #a94442"; - } else if (ActiveEntry.errorMessages.equals('fullName', "Name is probably not complete")) { - return "border: 1px solid #f2dede"; - } else if (ActiveEntry.successMessages.equals('fullName', "Name present")) { - return "border: 1px solid green"; - } else { - return "border: 1px solid gray"; - } - } -}); - -Template.entrySignUp.events({ - "click #signUpPageSignInButton": function (event) { - event.preventDefault(); - ActiveEntry.reset(); - Router.go('/entrySignIn'); - }, - 'change, keyup #signUpPageEmailInput': function (event, template) { - var email = $('[name="email"]').val(); - - ActiveEntry.verifyEmail(email); - ActiveEntry.errorMessages.set('signInError', null); - }, - 'change, keyup #signUpPagePasswordInput': function (event, template) { - var password = $('[name="password"]').val(); - - ActiveEntry.verifyPassword(password); - ActiveEntry.errorMessages.set('signInError', null); - }, - 'change, keyup #signUpPagePasswordConfirmInput': function (event, template) { - - var password = $('[name="password"]').val(); - var confirmPassword = $('[name="confirm"]').val(); - // var password = $('#signUpPagePasswordInput').val(); - // var confirmPassword = $('#signUpPagePasswordConfirmInput').val(); - - ActiveEntry.verifyConfirmPassword(password, confirmPassword); - ActiveEntry.errorMessages.set('signInError', null); - }, - 'change, keyup #signUpPageFullNameInput': function (event, template) { - var fullName = template.$('[name="fullName"]').val(); - - ActiveEntry.verifyFullName(fullName); - ActiveEntry.errorMessages.set('signInError', null); - }, - 'click #signUpPageJoinNowButton': function (event, template) { - ActiveEntry.signUp( - $('#signUpPageEmailInput').val(), - $('#signUpPagePasswordInput').val(), - $('#signUpPagePasswordConfirmInput').val(), - $('#signUpPageFullNameInput').val() - ); - }, - 'keyup #entrySignUp': function(event, template) { - if(event.keyCode == 13) { - ActiveEntry.verifyFullName($("#signUpPageFullNameInput").val()); - ActiveEntry.verifyEmail($("#signUpPageEmailInput").val()); - ActiveEntry.verifyPassword($("#signUpPagePasswordInput").val()); - ActiveEntry.verifyConfirmPassword($("#signUpPagePasswordInput").val(), $("#signUpPagePasswordConfirmInput").val()); - - if (!ActiveEntry.errorMessages.get('signInError') && - ActiveEntry.successMessages.get('fullName') && - ActiveEntry.successMessages.get('email') && - ActiveEntry.successMessages.get('password') && - ActiveEntry.successMessages.get('confirm')) { - $("#signUpPageJoinNowButton").click(); - } - } - } -}); - -Template.entrySignUp.onRendered(function() { - // Password strength meter for password inputs - if (passwordValidationSettings.showPasswordStrengthIndicator) { - this.$('#signUpPagePasswordInput').pwstrength(passwordValidationSettings.pwstrengthOptions); - } - - // Update password warning message if zxcvbn is active and zxcvbn function is defined - if(passwordValidationSettings.requireStrongPasswords) { - Session.set('passwordWarning', 'Password is weak'); - } -}); diff --git a/Packages/active-entry/components/entrySignUp/entrySignUp.less b/Packages/active-entry/components/entrySignUp/entrySignUp.less deleted file mode 100755 index 3da62e87a..000000000 --- a/Packages/active-entry/components/entrySignUp/entrySignUp.less +++ /dev/null @@ -1,12 +0,0 @@ -#entrySignUp{ - padding: 40px; - input{ - padding-left: 40px !important; - color: black; - } -} - -#entrySignUp .progress{ - height: 5px; - margin-bottom: 1px -} \ No newline at end of file diff --git a/Packages/active-entry/components/forgotPassword/.tests/reviewForgotPassword.js b/Packages/active-entry/components/forgotPassword/.tests/reviewForgotPassword.js deleted file mode 100755 index d6f00b72c..000000000 --- a/Packages/active-entry/components/forgotPassword/.tests/reviewForgotPassword.js +++ /dev/null @@ -1,4 +0,0 @@ -exports.command = function () { - this - .verify.elementPresent("#forgotPassword"); return this; -}; diff --git a/Packages/active-entry/components/forgotPassword/forgotPassword.html b/Packages/active-entry/components/forgotPassword/forgotPassword.html deleted file mode 100755 index 478058839..000000000 --- a/Packages/active-entry/components/forgotPassword/forgotPassword.html +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/Packages/active-entry/components/forgotPassword/forgotPassword.js b/Packages/active-entry/components/forgotPassword/forgotPassword.js deleted file mode 100755 index 36fbf7a08..000000000 --- a/Packages/active-entry/components/forgotPassword/forgotPassword.js +++ /dev/null @@ -1,36 +0,0 @@ -//========================================== - -Router.route('/forgotPassword', { - name: "forgotPassword", - template: "forgotPassword" -}); - -Template.forgotPassword.helpers({ - getForgotPasswordMessageColor: function (){ - if (ActiveEntry.errorMessages.get('forgotPassword')) { - return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;" - } else { - return "color: black;" - } - }, - getForgotPasswordMessage: function (){ - return ActiveEntry.errorMessages.get('forgotPassword'); - }, - getForgotPasswordStyle: function (){ - return "border: 1px solid gray"; - }, - forgotPasswordNotification: function() { - return ActiveEntry.successMessages.get("forgotPassword"); - } -}); - -Template.forgotPassword.events({ - "submit": function (event, template) { - event.preventDefault(); - console.log('send reminder!'); - ActiveEntry.successMessages.set("forgotPassword", "Your password reset email is sending..."); - var emailAddress = $('#signInPageEmailInput').val(); - ActiveEntry.forgotPassword(emailAddress); - } -}); - diff --git a/Packages/active-entry/components/forgotPassword/forgotPassword.less b/Packages/active-entry/components/forgotPassword/forgotPassword.less deleted file mode 100755 index 17db0dc7e..000000000 --- a/Packages/active-entry/components/forgotPassword/forgotPassword.less +++ /dev/null @@ -1,5 +0,0 @@ -#forgotPassword{ - input{ - padding-left: 40px; - } -} diff --git a/Packages/active-entry/components/resetPassword/resetPassword.html b/Packages/active-entry/components/resetPassword/resetPassword.html deleted file mode 100644 index 5aea5d08c..000000000 --- a/Packages/active-entry/components/resetPassword/resetPassword.html +++ /dev/null @@ -1,42 +0,0 @@ - - \ No newline at end of file diff --git a/Packages/active-entry/components/resetPassword/resetPassword.js b/Packages/active-entry/components/resetPassword/resetPassword.js deleted file mode 100644 index ab5986c72..000000000 --- a/Packages/active-entry/components/resetPassword/resetPassword.js +++ /dev/null @@ -1,67 +0,0 @@ - -Router.route('/resetPassword/:token', { - template: 'resetPassword', - name: 'resetPassword', - onBeforeAction: function() { - var token = this.params.token; - Session.set('_resetPasswordToken', token); - this.next(); - } -}); - -// Reset password template -Template.resetPassword.helpers({ - getResetPasswordInMessageColor: function (){ - if (ActiveEntry.errorMessages.get('resetPasswordError')) { - return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;" - } else { - return "color: black;" - } - }, - getResetPasswordMessage: function (){ - if (ActiveEntry.errorMessages.get('resetPasswordError')) { - return ActiveEntry.errorMessages.get('resetPasswordError'); - } else { - return Session.get('defaultSignInMessage'); - } - }, - resetPassword: function(){ - return Session.get('_resetPasswordToken'); - }, - resetPasswordErrorMessages: function() { - if (ActiveEntry.errorMessages.get("password")) { - return [ActiveEntry.errorMessages.get("password")]; - } - if (ActiveEntry.errorMessages.get("confirm")) { - return [ActiveEntry.errorMessages.get("confirm")]; - } - - return; - } -}); - -Template.resetPassword.events({ - 'keyup #resetPasswordInput': function (event, template) { - var password = $('#resetPasswordInput').val(); - ActiveEntry.verifyPassword(password); - ActiveEntry.errorMessages.set('resetPasswordError', null); - }, - 'keyup #resetPasswordConfirmInput': function (event, template) { - - var password = $('#resetPasswordInput').val(); - var confirmPassword = $('#resetPasswordConfirmInput').val(); - - ActiveEntry.verifyConfirmPassword(password, confirmPassword); - ActiveEntry.errorMessages.set('resetPasswordError', null); - }, - 'click #resetPasswordButton': function(e, template) { - e.preventDefault(); - var password = $('#resetPasswordInput').val(); - var passwordConfirm = $('#resetPasswordConfirmInput').val(); - - if (ActiveEntry.errorMessages.get('password') || ActiveEntry.errorMessages.get('confirm')) { - return; - } - ActiveEntry.resetPassword(password, passwordConfirm); - } -}); \ No newline at end of file diff --git a/Packages/active-entry/lib/Accounts.js b/Packages/active-entry/lib/Accounts.js deleted file mode 100755 index fbc3de2d1..000000000 --- a/Packages/active-entry/lib/Accounts.js +++ /dev/null @@ -1,48 +0,0 @@ - - -if (Meteor.isClient) { - - - Accounts.onResetPasswordLink(function (token, done){ - console.log('Accounts.onResearchPasswordLink'); - console.log('Sending reset password email...'); - console.log('NOT IMPLEMENTED YET. PLEASE LOG AN ISSUE'); - console.log('token: ' + token); - done(); - }); - - - Accounts.onEnrollmentLink(function (token, done){ - console.log('Accounts.onResearchPasswordLink'); - console.log('Sending enrollment email...'); - console.log('NOT IMPLEMENTED YET. PLEASE LOG AN ISSUE'); - console.log('token: ' + token); - done(); - }); - - Accounts.onEmailVerificationLink(function (token, done){ - console.log('Accounts.onEmailVerificationLink'); - console.log('Sending verification email...'); - console.log('NOT IMPLEMENTED YET. PLEASE LOG AN ISSUE'); - console.log('token: ' + token); - done(); - }); -} - - -if (Meteor.isServer){ - // Support for playing D&D: Roll 3d6 for dexterity - Accounts.onCreateUser(function(options, user) { - - var d6 = function () { return Math.floor(Random.fraction() * 6) + 1; }; - user.dexterity = d6() + d6() + d6(); - user.role = "user"; - - // We still want the default hook's 'profile' behavior. - if (options.profile){ - user.profile = options.profile; - } - - return user; - }); -} diff --git a/Packages/active-entry/lib/ActiveEntry.js b/Packages/active-entry/lib/ActiveEntry.js deleted file mode 100755 index fadfb20ce..000000000 --- a/Packages/active-entry/lib/ActiveEntry.js +++ /dev/null @@ -1,545 +0,0 @@ - - -ActiveEntry = {}; -ActiveEntry.isAbc = function () { - return "abc"; -}; - - - -if (Meteor.isClient) { - Session.setDefault('Photonic.ActiveEntry', { - logo: { - url: "https://upload.wikimedia.org/wikipedia/commons/1/1a/Photon-photon_scattering.png", - displayed: true - }, - signIn: { - displayFullName: true, - destination: "/" - }, - signUp: { - destination: "/" - }, - themeColors: { - primary: "" - }, - passwordOptions: { - showPasswordStrengthIndicator: true, - requireRegexValidation: true, - //requireStrongPasswords: false - passwordHistoryCount: 6, - failedAttemptsLimit: 5, - passwordExpirationDays: 90, - inactivityPeriodDays: 180, - expireTimeInMinute: 30 - } - }); - - ActiveEntry.errorMessages = new ReactiveDict('errorMessages'); - ActiveEntry.errorMessages.set('signInError', false); - - // Success messages - ActiveEntry.successMessages = new ReactiveDict('successMessages'); - - // Change password warning message according to whether zxcvbn is turned on - Session.set('passwordWarning', 'Password must have at least 8 characters. It must contain at least 1 uppercase, 1 lowercase, 1 number and 1 special character.'); - - // Activate LDAP if ldap url and port is set in settings.json - Meteor.call('isLDAPSet', function(error, isSet) { - Session.set('isLDAPSet', isSet); - }); -} - -if (Meteor.isServer) { - LDAP_DEFAULTS = {}; - LDAP_DEFAULTS.url = Meteor.settings.ldap && Meteor.settings.ldap.url; - LDAP_DEFAULTS.port = Meteor.settings.ldap && Meteor.settings.ldap.port; -} - -ActiveEntry.configure = function (configObject) { - if (Meteor.isClient) { - - // Set passwordOptions if they are not defined - if (!configObject.passwordOptions) { - configObject.passwordOptions = { - showPasswordStrengthIndicator: true, - requireRegexValidation: false, - //requireStrongPasswords: false - passwordHistoryCount: 6, - failedAttemptsLimit: 5, - passwordExpirationDays: 90, - inactivityPeriodDays: 180, - expireTimeInMinute: 30 - } - } - Session.set('Photonic.ActiveEntry', configObject); - } -}; - -ActiveEntry.verifyPassword = function (password) { - if (password.length === 0) { - ActiveEntry.errorMessages.set('password', 'Password is required'); - ActiveEntry.successMessages.set('password', null); - } else if (!checkPasswordStrength(password)) { - ActiveEntry.errorMessages.set('password', Session.get('passwordWarning')); - ActiveEntry.successMessages.set('password', null); - } else { - ActiveEntry.errorMessages.set('password', null); - ActiveEntry.successMessages.set('password', 'Password present'); - } -}; - -ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) { - // we have two different logic checks happening in this function - // would be reasonable to separate them out into separate functions - if (confirmPassword === "") { - ActiveEntry.errorMessages.set('confirm', 'Password is required'); - ActiveEntry.successMessages.set('confirm', null); - } else if (confirmPassword === password) { - ActiveEntry.errorMessages.set('confirm', null); - ActiveEntry.successMessages.set('confirm', 'Passwords match'); - } else { - ActiveEntry.errorMessages.set('confirm', 'Passwords do not match'); - ActiveEntry.successMessages.set('confirm', null); - } -}; - -ActiveEntry.verifyEmail = function (email) { - if (email.length === 0) { - ActiveEntry.errorMessages.set('email', 'Email is required'); - ActiveEntry.successMessages.set('email', null); - } else if (email.indexOf("@") === -1){ - ActiveEntry.errorMessages.set('email', 'Email is poorly formatted'); - ActiveEntry.successMessages.set('email', null); - } else if (email.indexOf("@") >= 0){ - ActiveEntry.errorMessages.set('email', null); - ActiveEntry.successMessages.set('email', 'Email present'); - } -}; - -ActiveEntry.verifyFullName = function (fullName) { - if (fullName.length === 0) { - ActiveEntry.errorMessages.set('fullName', 'Name is required'); - ActiveEntry.successMessages.set('fullName', null); - } else if (fullName.indexOf(" ") === -1){ - ActiveEntry.errorMessages.set('fullName', 'Name is probably not complete'); - ActiveEntry.successMessages.set('fullName', null); - } else if (fullName.indexOf(" ") >= 0){ - //ActiveEntry.errorMessages.set('fullName', 'Name present'); - ActiveEntry.errorMessages.set('fullName', null); - ActiveEntry.successMessages.set('fullName', 'Name present'); - } -}; - -ActiveEntry.verifyLDAPUsername = function(username) { - if (username === "") { - ActiveEntry.errorMessages.set("ldapUsername", "Username is required"); - ActiveEntry.successMessages.set("ldapUsername", null); - } else { - ActiveEntry.errorMessages.set("ldapUsername", null); - ActiveEntry.successMessages.set("ldapUsername", "Username present"); - } -}; - -ActiveEntry.verifyLDAPPassword = function(password) { - if (password === "") { - ActiveEntry.errorMessages.set("ldapPassword", "Password is required"); - ActiveEntry.successMessages.set("ldapPassword", null); - } else { - ActiveEntry.errorMessages.set("ldapPassword", null); - ActiveEntry.successMessages.set("ldapPassword", "Password present"); - } -}; - -ActiveEntry.signIn = function (emailValue, passwordValue){ - - ActiveEntry.verifyPassword(passwordValue); - ActiveEntry.verifyEmail(emailValue); - - var signInArgs = {email: emailValue, password: passwordValue}; - - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - var passwordOptions = ActiveEntryConfig && ActiveEntryConfig.passwordOptions; - - Meteor.call("isAccountInactive",emailValue, passwordOptions.inactivityPeriodDays, function(error, isAccountInactive) { - if (error) { - console.warn(error.message); - return; - } - - if (isAccountInactive) { - // Lock account - ActiveEntry.lockAccount(signInArgs); - } else { - // Check account is locked - ActiveEntry.isAccountLocked(signInArgs, passwordOptions); - } - }); - -}; - -ActiveEntry.lockAccount = function(signInArgs) { - var emailValue = signInArgs && signInArgs.email; - if (!emailValue) { - return; - } - Meteor.call("lockAccount", emailValue); - ActiveEntry.errorMessages.set('signInError', "Your account has been locked due to inactivity."); -}; - -ActiveEntry.isAccountLocked = function(signInArgs, passwordOptions) { - var emailValue = signInArgs && signInArgs.email; - if (!emailValue) { - return; - } - - Meteor.call("isAccountLocked", emailValue, function (error, isAccountLocked) { - if (error) { - console.warn(error.message); - return; - } - - if (isAccountLocked) { - ActiveEntry.errorMessages.set('signInError', "Your account has been locked."); - return; - } - - // Get failed attempts count - ActiveEntry.getFailedAttemptsCount(signInArgs, passwordOptions); - }); - -}; - -ActiveEntry.getFailedAttemptsCount = function(signInArgs, passwordOptions) { - var emailValue = signInArgs && signInArgs.email; - if (!emailValue) { - return; - } - Meteor.call("getFailedAttemptsCount", emailValue, function(error, failedAttemptsCount) { - if (error) { - console.warn(error.message); - return; - } - - if (failedAttemptsCount != passwordOptions.failedAttemptsLimit) { - // Login with password - ActiveEntry.loginWithPassword(signInArgs, passwordOptions); - } else { - ActiveEntry.errorMessages.set('signInError', "Your account has been locked."); - } - - }); -}; - -ActiveEntry.loginWithPassword = function(signInArgs, passwordOptions) { - var emailValue = signInArgs && signInArgs.email; - var password = signInArgs && signInArgs.password; - - if (!emailValue || !password) { - return; - } - - Meteor.loginWithPassword(emailValue, password, function (loginError, result) { - if (loginError) { - // Login failed - if (loginError.error == 403) { - ActiveEntry.updateFailedAttempts(signInArgs, passwordOptions, loginError); - } - return; - } - - // Reset failed attempts - Meteor.call("resetFailedAttempts", emailValue); - - // Check password expiration - ActiveEntry.isPasswordExpired(passwordOptions); - - }); -}; - -ActiveEntry.isPasswordExpired = function(passwordOptions) { - // if password expired, route to changePassword page - Meteor.call("isPasswordExpired", passwordOptions.passwordExpirationDays, function(error, isPasswordExpired) { - if (error) { - console.warn(error.message); - return; - } - - // Update last login time - Meteor.call("updateLastLoginDate"); - - if (isPasswordExpired) { - ActiveEntry.errorMessages.set('changePasswordError', 'Your password expired. Please change your password.'); - Router.go('/changePassword'); - } else { - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - Router.go(ActiveEntryConfig.signIn.destination); - } - }); -}; - -ActiveEntry.updateFailedAttempts = function(signInArgs, passwordOptions, loginError) { - var emailValue = signInArgs && signInArgs.email; - - if (!emailValue) { - return; - } - Meteor.call("updateFailedAttempts", emailValue, passwordOptions.failedAttemptsLimit, function(error, failedAttemptCount) { - if (error) { - console.warn(error.message); - return; - } - - if (failedAttemptCount == passwordOptions.failedAttemptsLimit) { - ActiveEntry.errorMessages.set('signInError', "Too many failed login attempts. Your account has been locked."); - } else if (failedAttemptCount < passwordOptions.failedAttemptsLimit) { - ActiveEntry.errorMessages.set('signInError', loginError.message + "
" +(passwordOptions.failedAttemptsLimit - failedAttemptCount) + " attempts remaining."); - } else { - ActiveEntry.errorMessages.set('signInError', loginError.message); - } - }); -}; - - -ActiveEntry.loginWithLDAP = function(username, password) { - ActiveEntry.verifyLDAPUsername(username); - ActiveEntry.verifyLDAPPassword(password); - ActiveEntry.errorMessages.set('signInError', null); - - if (ActiveEntry.errorMessages.get("ldapUsername") || ActiveEntry.errorMessages.get("ldapPassword")) { - return; - } - - Meteor.loginWithLDAP(username, password, { - // The dn value depends on what you want to search/auth against - // The structure will depend on how your ldap server - // is configured or structured. - dn: "uid=" + username + ",ou=users,ou=system", - // The search value is optional. Set it if your search does not - // work with the bind dn. - searchResultsProfileMap: [ - { - resultKey: 'cn', - profileProperty: 'fullName' - }, - { - resultKey: 'mail', - profileProperty: 'email' - } - ] - }, function(error) { - if (error) { - ActiveEntry.errorMessages.set('signInError', error.errorType+" ["+error.error+"]"); - return; - } - ActiveEntry.errorMessages.set('signInError', null); - - // Update last login time - Meteor.call("updateLastLoginDate"); - - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - Router.go(ActiveEntryConfig.signIn.destination); - - }); -}; - -ActiveEntry.signUp = function (emailValue, passwordValue, confirmPassword, fullName){ - ActiveEntry.verifyEmail(emailValue); - ActiveEntry.verifyPassword(passwordValue); - ActiveEntry.verifyConfirmPassword(passwordValue, confirmPassword); - ActiveEntry.verifyFullName(fullName); - ActiveEntry.errorMessages.set('signInError', null); - - var errorIsFound = false; - Object.keys(ActiveEntry.errorMessages.keys).forEach(function(key) { - if (ActiveEntry.errorMessages.get(key) !== "null" && ActiveEntry.errorMessages.get(key) !== null) { - errorIsFound = true; - } - }); - - if(errorIsFound) { - return; - } - - // Capitalize first letter of every word in fullName - var capitalizedFullName = fullName.replace(/[^\s]+/g, function(str){ - return str.substr(0,1).toUpperCase()+str.substr(1).toLowerCase(); - }); - - Accounts.createUser({ - email: emailValue, - password: passwordValue, - profile: { - fullName: capitalizedFullName - } - }, function (error, result) { - if (error) { - ActiveEntry.errorMessages.set('signInError', error.message); - return; - } - // Add password in previousPasswords field - ActiveEntry.insertHashedPassword(passwordValue); - - // Update password set date - ActiveEntry.updatePasswordSetDate(); - - // Update last login time - Meteor.call("updateLastLoginDate"); - - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - Router.go(ActiveEntryConfig.signUp.destination); - - }); -}; -ActiveEntry.changePassword = function(oldPassword, password) { - Meteor.call("checkPasswordExistence", new String(password).hashCode(), function(error, isPasswordExisted) { - if (error) { - console.warn(error.message); - ActiveEntry.errorMessages.set('changePasswordError', error.message); - return; - } - - if (isPasswordExisted) { - ActiveEntry.errorMessages.set('changePasswordError', 'Password is used before. Please change your new password.'); - } else { - ActiveEntry.errorMessages.set('changePasswordError', null); - - // If password is not found in password history, change the password - Accounts.changePassword(oldPassword, password, function(error) { - if (error) { - console.warn(error); - ActiveEntry.errorMessages.set('changePasswordError', error.message); - return; - } - - // Save the new password - ActiveEntry.insertHashedPassword(password); - - // Update password expiration date - ActiveEntry.updatePasswordSetDate(); - - // Logout - ActiveEntry.signOut(); - // Go to signIn page for new entry - Router.go('/entrySignIn'); - }); - } - - }); -}; - -ActiveEntry.forgotPassword = function(emailAddress) { - ActiveEntry.verifyEmail(emailAddress); - ActiveEntry.errorMessages.set("forgotPassword", null); - ActiveEntry.successMessages.set("forgotPassword", null); - - if (ActiveEntry.errorMessages.get("email")) { - return; - } - - Accounts.forgotPassword({email:emailAddress }, function(error){ - if (error) { - console.warn(error.message); - ActiveEntry.errorMessages.set("forgotPassword", error.message); - ActiveEntry.successMessages.set("forgotPassword", null); - return; - } - - // Show email sent notification - ActiveEntry.successMessages.set("forgotPassword", "Your password reset email is sent to "+emailAddress+""); - }); -}; - -ActiveEntry.resetPassword = function(passwordValue, confirmPassword) { - ActiveEntry.verifyPassword(passwordValue); - ActiveEntry.verifyConfirmPassword(passwordValue, confirmPassword); - ActiveEntry.errorMessages.set("resetPassword", null); - - // Check error messages - if (ActiveEntry.errorMessages.get("password") || ActiveEntry.errorMessages.get("confirm")) { - return; - } - - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - var passwordOptions = ActiveEntryConfig && ActiveEntryConfig.passwordOptions; - - // Check token is expired - Meteor.call('checkResetTokenIsExpired', Session.get('_resetPasswordToken'), passwordOptions.expireTimeInMinute, function(error, isTokenExpired) { - if (error) { - console.log(error.message); - return; - } - - if (isTokenExpired) { - console.log("Your link is expired"); - // Go to forgotPassword to create a new reset link - ActiveEntry.errorMessages.set("forgotPassword", 'Your link is expired. Please create a new reset link.'); - Router.go('/forgotPassword'); - return; - } - - // Check password history - Meteor.call("checkResetPasswordExistence", new String(passwordValue).hashCode(), Session.get('_resetPasswordToken'), function(error, isPasswordExisted) { - if (error) { - console.warn(error.message); - ActiveEntry.errorMessages.set('resetPasswordError', error.message); - return; - } - - if (isPasswordExisted) { - - ActiveEntry.errorMessages.set('resetPasswordError', 'Password is used before. Please change your new password.'); - } else { - - ActiveEntry.errorMessages.set('resetPasswordError', null); - Accounts.resetPassword(Session.get('_resetPasswordToken'), passwordValue, function(error) { - if (error) { - ActiveEntry.errorMessages.set("resetPassword", error.message); - return; - } - Session.set('_resetPasswordToken', null); - // Save the new password - ActiveEntry.insertHashedPassword(passwordValue); - - // Update password expiration date - ActiveEntry.updatePasswordSetDate(); - - // Update last login time - Meteor.call("updateLastLoginDate"); - - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - Router.go(ActiveEntryConfig.signIn.destination); - }); - } - }); - - }); -}; - -// Insert hashed password in previousPasswords fields -ActiveEntry.insertHashedPassword = function(passwordValue) { - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - var passwordHistoryCount = ActiveEntryConfig && ActiveEntryConfig.passwordOptions && ActiveEntryConfig.passwordOptions.passwordHistoryCount || 6; - Meteor.call("insertHashedPassword", [new String(passwordValue).hashCode(),passwordHistoryCount]); -}; - -ActiveEntry.updatePasswordSetDate = function() { - Meteor.call("updatePasswordSetDate"); -}; - -ActiveEntry.signOut = function (){ - Meteor.logout(); -}; - -ActiveEntry.reset = function (){ - ActiveEntry.errorMessages.set('signInError', false); - ActiveEntry.errorMessages.set('fullName', false); - ActiveEntry.errorMessages.set('email', false); - ActiveEntry.errorMessages.set('confirm', false); - ActiveEntry.errorMessages.set('password', false); -}; - -ActiveEntry.logoIsDisplayed = function (){ - var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); - return ActiveEntryConfig.logo.displayed; -}; diff --git a/Packages/active-entry/lib/checkPasswordStrength.js b/Packages/active-entry/lib/checkPasswordStrength.js deleted file mode 100644 index a36b45887..000000000 --- a/Packages/active-entry/lib/checkPasswordStrength.js +++ /dev/null @@ -1,59 +0,0 @@ -passwordValidationSettings = {}; - -function getPasswordValidationSettings () { - var ActiveEntryConfiguration = Session.get('Photonic.ActiveEntry'); - var validationSettings = {}; - - validationSettings.showPasswordStrengthIndicator = ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.showPasswordStrengthIndicator || false; - validationSettings.requireRegexValidation = ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.requireRegexValidation || false; - - if (validationSettings.showPasswordStrengthIndicator) { - // Set password strength meter options - validationSettings.pwstrengthOptions = { - common: { - minChar: 8 - }, - ui: { - showVerdictsInsideProgressBar: true, - showStatus: true - } - }; - } - - // Check if codetheweb:zxcvbn is defined - if (typeof(zxcvbn) === typeof(Function)) { - validationSettings.requireStrongPasswords = ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.requireStrongPasswords || false; - // Set zxcvbn in pw strength meter - if (validationSettings.showPasswordStrengthIndicator) { - validationSettings.pwstrengthOptions.common.zxcvbn = passwordValidationSettings.requireStrongPasswords; - } - } - - return validationSettings; -} - -Meteor.startup(function() { - passwordValidationSettings = getPasswordValidationSettings(); -}); - -checkPasswordStrength = function(password) { - if (passwordValidationSettings.requireStrongPasswords) { - // Check zxcvbn - var zxcvbnResult = zxcvbn(password); - if (zxcvbnResult && zxcvbnResult.score > 2) { - return true; - } - - return false; - } else if (passwordValidationSettings.requireRegexValidation) { - // Apply validation rule - var result = password.search(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*])[0-9a-zA-Z!@#$%^&*]{8,}$/i); - if (result > -1) { - return true; - } - - return false; - } - - return true; -}; \ No newline at end of file diff --git a/Packages/active-entry/lib/hashCodeGenerator.js b/Packages/active-entry/lib/hashCodeGenerator.js deleted file mode 100644 index 764f46e58..000000000 --- a/Packages/active-entry/lib/hashCodeGenerator.js +++ /dev/null @@ -1,10 +0,0 @@ -String.prototype.hashCode = function() { - var hash = 0, i, chr, len; - if (this.length === 0) return hash; - for (i = 0, len = this.length; i < len; i++) { - chr = this.charCodeAt(i); - hash = ((hash << 5) - hash) + chr; - hash |= 0; // Convert to 32bit integer - } - return hash; -}; \ No newline at end of file diff --git a/Packages/active-entry/lib/jquery.pwstrength.bootstrap.js b/Packages/active-entry/lib/jquery.pwstrength.bootstrap.js deleted file mode 100644 index ddaaf1568..000000000 --- a/Packages/active-entry/lib/jquery.pwstrength.bootstrap.js +++ /dev/null @@ -1,737 +0,0 @@ -/*! - * jQuery Password Strength plugin for Twitter Bootstrap - * - * Copyright (c) 2008-2013 Tane Piper - * Copyright (c) 2013 Alejandro Blanco - * Dual licensed under the MIT and GPL licenses. - */ - -(function (jQuery) { - // Source: src/rules.js - - - - var rulesEngine = {}; - - try { - if (!jQuery && module && module.exports) { - var jQuery = require("jquery"), - jsdom = require("jsdom").jsdom; - jQuery = jQuery(jsdom().parentWindow); - } - } catch (ignore) {} - - (function ($, rulesEngine) { - "use strict"; - var validation = {}; - - rulesEngine.forbiddenSequences = [ - "0123456789", "abcdefghijklmnopqrstuvwxyz", "qwertyuiop", "asdfghjkl", - "zxcvbnm", "!@#$%^&*()_+" - ]; - - validation.wordNotEmail = function (options, word, score) { - if (word.match( - /^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i - )) { - return score; - } - return 0; - }; - - validation.wordLength = function (options, word, score) { - var wordlen = word.length, - lenScore = Math.pow(wordlen, options.rules.raisePower); - if (wordlen < options.common.minChar) { - lenScore = (lenScore + score); - } - return lenScore; - }; - - validation.wordSimilarToUsername = function (options, word, score) { - var username = $(options.common.usernameField).val(); - if (username && word.toLowerCase().match(username.replace( - /[\-\[\]\/\{\}\(\)\*\+\=\?\:\.\\\^\$\|\!\,]/g, "\\$&").toLowerCase())) { - return score; - } - return 0; - }; - - validation.wordTwoCharacterClasses = function (options, word, score) { - if (word.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) || - (word.match(/([a-zA-Z])/) && word.match(/([0-9])/)) || - (word.match(/(.[!,@,#,$,%,\^,&,*,?,_,~])/) && word.match(/[a-zA-Z0-9_]/))) { - return score; - } - return 0; - }; - - validation.wordRepetitions = function (options, word, score) { - if (word.match(/(.)\1\1/)) { - return score; - } - return 0; - }; - - validation.wordSequences = function (options, word, score) { - var found = false, - j; - if (word.length > 2) { - $.each(rulesEngine.forbiddenSequences, function (idx, seq) { - if (found) { - return; - } - var sequences = [seq, seq.split('').reverse().join('')]; - $.each(sequences, function (idx, sequence) { - for (j = 0; j < (word.length - 2); j += 1) { // iterate the word trough a sliding window of size 3: - if (sequence.indexOf(word.toLowerCase().substring(j, j + 3)) > -1) { - found = true; - } - } - }); - }); - if (found) { - return score; - } - } - return 0; - }; - - validation.wordLowercase = function (options, word, score) { - return word.match(/[a-z]/) && score; - }; - - validation.wordUppercase = function (options, word, score) { - return word.match(/[A-Z]/) && score; - }; - - validation.wordOneNumber = function (options, word, score) { - return word.match(/\d+/) && score; - }; - - validation.wordThreeNumbers = function (options, word, score) { - return word.match(/(.*[0-9].*[0-9].*[0-9])/) && score; - }; - - validation.wordOneSpecialChar = function (options, word, score) { - return word.match(/[!,@,#,$,%,\^,&,*,?,_,~]/) && score; - }; - - validation.wordTwoSpecialChar = function (options, word, score) { - return word.match(/(.*[!,@,#,$,%,\^,&,*,?,_,~].*[!,@,#,$,%,\^,&,*,?,_,~])/) && score; - }; - - validation.wordUpperLowerCombo = function (options, word, score) { - return word.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) && score; - }; - - validation.wordLetterNumberCombo = function (options, word, score) { - return word.match(/([a-zA-Z])/) && word.match(/([0-9])/) && score; - }; - - validation.wordLetterNumberCharCombo = function (options, word, score) { - return word.match( - /([a-zA-Z0-9].*[!,@,#,$,%,\^,&,*,?,_,~])|([!,@,#,$,%,\^,&,*,?,_,~].*[a-zA-Z0-9])/) && - score; - }; - - rulesEngine.validation = validation; - - rulesEngine.executeRules = function (options, word) { - var totalScore = 0; - - $.each(options.rules.activated, function (rule, active) { - if (active) { - var score = options.rules.scores[rule], - funct = rulesEngine.validation[rule], - result, - errorMessage; - - if (!$.isFunction(funct)) { - funct = options.rules.extra[rule]; - } - - if ($.isFunction(funct)) { - result = funct(options, word, score); - if (result) { - totalScore += result; - } - if (result < 0 || (!$.isNumeric(result) && !result)) { - errorMessage = options.ui.spanError(options, rule); - if (errorMessage.length > 0) { - options.instances.errors.push(errorMessage); - } - } - } - } - }); - - return totalScore; - }; - }(jQuery, rulesEngine)); - - try { - if (module && module.exports) { - module.exports = rulesEngine; - } - } catch (ignore) {} - - // Source: src/options.js - - - - var defaultOptions = {}; - - defaultOptions.common = {}; - defaultOptions.common.minChar = 6; - defaultOptions.common.usernameField = "#username"; - defaultOptions.common.userInputs = [ - // Selectors for input fields with user input - ]; - defaultOptions.common.onLoad = undefined; - defaultOptions.common.onKeyUp = undefined; - defaultOptions.common.zxcvbn = false; - defaultOptions.common.zxcvbnTerms = [ - // List of disrecommended words - ]; - defaultOptions.common.debug = false; - - defaultOptions.rules = {}; - defaultOptions.rules.extra = {}; - defaultOptions.rules.scores = { - wordNotEmail: -100, - wordLength: -50, - wordSimilarToUsername: -100, - wordSequences: -20, - wordTwoCharacterClasses: 2, - wordRepetitions: -25, - wordLowercase: 1, - wordUppercase: 3, - wordOneNumber: 3, - wordThreeNumbers: 5, - wordOneSpecialChar: 3, - wordTwoSpecialChar: 5, - wordUpperLowerCombo: 2, - wordLetterNumberCombo: 2, - wordLetterNumberCharCombo: 2 - }; - defaultOptions.rules.activated = { - wordNotEmail: true, - wordLength: true, - wordSimilarToUsername: true, - wordSequences: true, - wordTwoCharacterClasses: false, - wordRepetitions: false, - wordLowercase: true, - wordUppercase: true, - wordOneNumber: true, - wordThreeNumbers: true, - wordOneSpecialChar: true, - wordTwoSpecialChar: true, - wordUpperLowerCombo: true, - wordLetterNumberCombo: true, - wordLetterNumberCharCombo: true - }; - defaultOptions.rules.raisePower = 1.4; - - defaultOptions.ui = {}; - defaultOptions.ui.bootstrap2 = false; - defaultOptions.ui.bootstrap4 = false; - defaultOptions.ui.colorClasses = ["danger", "warning", "success"]; - defaultOptions.ui.showProgressBar = true; - defaultOptions.ui.showPopover = false; - defaultOptions.ui.popoverPlacement = "bottom"; - defaultOptions.ui.showStatus = false; - defaultOptions.ui.spanError = function (options, key) { - "use strict"; - var text = options.ui.errorMessages[key]; - if (!text) { - return ''; - } - return '' + text + ''; - }; - defaultOptions.ui.popoverError = function (errors) { - "use strict"; - var message = "
Errors:
    "; - - jQuery.each(errors, function (idx, err) { - message += "
  • " + err + "
  • "; - }); - message += "
"; - return message; - }; - defaultOptions.ui.errorMessages = { - wordLength: "Your password is too short", - wordNotEmail: "Do not use your email as your password", - wordSimilarToUsername: "Your password cannot contain your username", - wordTwoCharacterClasses: "Use different character classes", - wordRepetitions: "Too many repetitions", - wordSequences: "Your password contains sequences" - }; - defaultOptions.ui.verdicts = ["Weak", "Normal", "Medium", "Strong", "Very Strong"]; - defaultOptions.ui.showVerdicts = true; - defaultOptions.ui.showVerdictsInsideProgressBar = false; - defaultOptions.ui.useVerdictCssClass = false; - defaultOptions.ui.showErrors = false; - defaultOptions.ui.container = undefined; - defaultOptions.ui.viewports = { - progress: undefined, - verdict: undefined, - errors: undefined - }; - defaultOptions.ui.scores = [14, 26, 38, 50]; - - // Source: src/ui.js - - - - var ui = {}; - - (function ($, ui) { - "use strict"; - - var statusClasses = ["error", "warning", "success"]; - - ui.getContainer = function (options, $el) { - var $container; - - $container = $(options.ui.container); - if (!($container && $container.length === 1)) { - $container = $el.parent(); - } - return $container; - }; - - ui.findElement = function ($container, viewport, cssSelector) { - if (viewport) { - return $container.find(viewport).find(cssSelector); - } - return $container.find(cssSelector); - }; - - ui.getUIElements = function (options, $el) { - var $container, selector, result; - - if (options.instances.viewports) { - return options.instances.viewports; - } - - $container = ui.getContainer(options, $el); - - result = {}; - if (options.ui.bootstrap4) { - selector = "progress.progress"; - } else { - selector = "div.progress"; - } - result.$progressbar = ui.findElement($container, options.ui.viewports.progress, - selector); - if (options.ui.showVerdictsInsideProgressBar) { - result.$verdict = result.$progressbar.find("span.password-verdict"); - } - - if (!options.ui.showPopover) { - if (!options.ui.showVerdictsInsideProgressBar) { - result.$verdict = ui.findElement($container, options.ui.viewports.verdict, - "span.password-verdict"); - } - result.$errors = ui.findElement($container, options.ui.viewports.errors, - "ul.error-list"); - } - - options.instances.viewports = result; - return result; - }; - - ui.initProgressBar = function (options, $el) { - var $container = ui.getContainer(options, $el), - progressbar = "
"; - if (options.ui.bootstrap4) { - // Boostrap 4 - progressbar = ""; - } - if (options.ui.showVerdictsInsideProgressBar) { - progressbar += ""; - } - if (options.ui.bootstrap4) { - progressbar += ""; - } else { - progressbar += "
"; - } - - if (options.ui.viewports.progress) { - $container.find(options.ui.viewports.progress).append(progressbar); - } else { - $(progressbar).insertAfter($el); - } - }; - - ui.initHelper = function (options, $el, html, viewport) { - var $container = ui.getContainer(options, $el); - if (viewport) { - $container.find(viewport).append(html); - } else { - $(html).insertAfter($el); - } - }; - - ui.initVerdict = function (options, $el) { - ui.initHelper(options, $el, "", - options.ui.viewports.verdict); - }; - - ui.initErrorList = function (options, $el) { - ui.initHelper(options, $el, "
    ", - options.ui.viewports.errors); - }; - - ui.initPopover = function (options, $el) { - $el.popover("destroy"); - $el.popover({ - html: true, - placement: options.ui.popoverPlacement, - trigger: "manual", - content: " " - }); - }; - - ui.initUI = function (options, $el) { - if (options.ui.showPopover) { - ui.initPopover(options, $el); - } else { - if (options.ui.showErrors) { - ui.initErrorList(options, $el); - } - if (options.ui.showVerdicts && !options.ui.showVerdictsInsideProgressBar) { - ui.initVerdict(options, $el); - } - } - if (options.ui.showProgressBar) { - ui.initProgressBar(options, $el); - } - }; - - ui.updateProgressBar = function (options, $el, cssClass, percentage) { - var $progressbar = ui.getUIElements(options, $el).$progressbar, - $bar = $progressbar.find(".progress-bar"), - cssPrefix = "progress-"; - - if (options.ui.bootstrap2) { - $bar = $progressbar.find(".bar"); - cssPrefix = ""; - } - - $.each(options.ui.colorClasses, function (idx, value) { - if (options.ui.bootstrap4) { - $progressbar.removeClass(cssPrefix + value); - } else { - $bar.removeClass(cssPrefix + "bar-" + value); - } - }); - if (options.ui.bootstrap4) { - $progressbar.addClass(cssPrefix + options.ui.colorClasses[cssClass]); - $progressbar.val(percentage); - } else { - $bar.addClass(cssPrefix + "bar-" + options.ui.colorClasses[cssClass]); - $bar.css("width", percentage + '%'); - } - }; - - ui.updateVerdict = function (options, $el, cssClass, text) { - var $verdict = ui.getUIElements(options, $el).$verdict; - $verdict.removeClass(options.ui.colorClasses.join(' ')); - if (cssClass > -1) { - $verdict.addClass(options.ui.colorClasses[cssClass]); - } - $verdict.html(text); - }; - - ui.updateErrors = function (options, $el) { - var $errors = ui.getUIElements(options, $el).$errors, - html = ""; - $.each(options.instances.errors, function (idx, err) { - html += "
  • " + err + "
  • "; - }); - $errors.html(html); - }; - - ui.updatePopover = function (options, $el, verdictText) { - var popover = $el.data("bs.popover"), - html = "", - hide = true; - - if (options.ui.showVerdicts && - !options.ui.showVerdictsInsideProgressBar && - verdictText.length > 0) { - html = "
    " + verdictText + - "
    "; - hide = false; - } - if (options.ui.showErrors) { - if (options.instances.errors.length > 0) { - hide = false; - } - html += options.ui.popoverError(options.instances.errors); - } - - if (hide) { - $el.popover("hide"); - return; - } - - if (options.ui.bootstrap2) { - popover = $el.data("popover"); - } - - if (popover.$arrow && popover.$arrow.parents("body").length > 0) { - $el.find("+ .popover .popover-content").html(html); - } else { - // It's hidden - popover.options.content = html; - $el.popover("show"); - } - }; - - ui.updateFieldStatus = function (options, $el, cssClass) { - var targetClass = options.ui.bootstrap2 ? ".control-group" : ".form-group", - $container = $el.parents(targetClass).first(); - - $.each(statusClasses, function (idx, css) { - if (!options.ui.bootstrap2) { - css = "has-" + css; - } - $container.removeClass(css); - }); - - cssClass = statusClasses[cssClass]; - if (!options.ui.bootstrap2) { - cssClass = "has-" + cssClass; - } - $container.addClass(cssClass); - }; - - ui.percentage = function (score, maximun) { - var result = Math.floor(100 * score / maximun); - result = result <= 0 ? 1 : result; // Don't show the progress bar empty - result = result > 100 ? 100 : result; - return result; - }; - - ui.getVerdictAndCssClass = function (options, score) { - var cssClass, verdictText, level; - - if (score <= 0) { - cssClass = 0; - level = -1; - verdictText = options.ui.verdicts[0]; - } else if (score < options.ui.scores[0]) { - cssClass = 0; - level = 0; - verdictText = options.ui.verdicts[0]; - } else if (score < options.ui.scores[1]) { - cssClass = 0; - level = 1; - verdictText = options.ui.verdicts[1]; - } else if (score < options.ui.scores[2]) { - cssClass = 1; - level = 2; - verdictText = options.ui.verdicts[2]; - } else if (score < options.ui.scores[3]) { - cssClass = 1; - level = 3; - verdictText = options.ui.verdicts[3]; - } else { - cssClass = 2; - level = 4; - verdictText = options.ui.verdicts[4]; - } - - return [verdictText, cssClass, level]; - }; - - ui.updateUI = function (options, $el, score) { - var cssClass, barPercentage, verdictText, verdictCssClass; - - cssClass = ui.getVerdictAndCssClass(options, score); - verdictText = score === 0 ? '' : cssClass[0]; - cssClass = cssClass[1]; - verdictCssClass = options.ui.useVerdictCssClass ? cssClass : -1; - - if (options.ui.showProgressBar) { - barPercentage = ui.percentage(score, options.ui.scores[3]); - ui.updateProgressBar(options, $el, cssClass, barPercentage); - if (options.ui.showVerdictsInsideProgressBar) { - ui.updateVerdict(options, $el, verdictCssClass, verdictText); - } - } - - if (options.ui.showStatus) { - ui.updateFieldStatus(options, $el, cssClass); - } - - if (options.ui.showPopover) { - ui.updatePopover(options, $el, verdictText); - } else { - if (options.ui.showVerdicts && !options.ui.showVerdictsInsideProgressBar) { - ui.updateVerdict(options, $el, verdictCssClass, verdictText); - } - if (options.ui.showErrors) { - ui.updateErrors(options, $el); - } - } - }; - }(jQuery, ui)); - - // Source: src/methods.js - - - - var methods = {}; - - (function ($, methods) { - "use strict"; - var onKeyUp, applyToAll; - - onKeyUp = function (event) { - var $el = $(event.target), - options = $el.data("pwstrength-bootstrap"), - word = $el.val(), - userInputs, - verdictText, - verdictLevel, - score; - - if (options === undefined) { - return; - } - - options.instances.errors = []; - if (word.length === 0) { - score = 0; - } else { - if (options.common.zxcvbn) { - userInputs = []; - $.each(options.common.userInputs.concat([options.common.usernameField]), function ( - idx, selector) { - var value = $(selector).val(); - if (value) { - userInputs.push(value); - } - }); - userInputs = userInputs.concat(options.common.zxcvbnTerms); - score = Math.log2(zxcvbn(word, userInputs).guesses); - } else { - score = rulesEngine.executeRules(options, word); - } - } - ui.updateUI(options, $el, score); - verdictText = ui.getVerdictAndCssClass(options, score); - verdictLevel = verdictText[2]; - verdictText = verdictText[0]; - - if (options.common.debug) { - console.log(score + ' - ' + verdictText); - } - - if ($.isFunction(options.common.onKeyUp)) { - options.common.onKeyUp(event, { - score: score, - verdictText: verdictText, - verdictLevel: verdictLevel - }); - } - }; - - methods.init = function (settings) { - this.each(function (idx, el) { - // Make it deep extend (first param) so it extends too the - // rules and other inside objects - var clonedDefaults = $.extend(true, {}, defaultOptions), - localOptions = $.extend(true, clonedDefaults, settings), - $el = $(el); - - localOptions.instances = {}; - $el.data("pwstrength-bootstrap", localOptions); - $el.on("keyup", onKeyUp); - $el.on("change", onKeyUp); - $el.on("paste", onKeyUp); - - ui.initUI(localOptions, $el); - if ($.trim($el.val())) { // Not empty, calculate the strength - $el.trigger("keyup"); - } - - if ($.isFunction(localOptions.common.onLoad)) { - localOptions.common.onLoad(); - } - }); - - return this; - }; - - methods.destroy = function () { - this.each(function (idx, el) { - var $el = $(el), - options = $el.data("pwstrength-bootstrap"), - elements = ui.getUIElements(options, $el); - elements.$progressbar.remove(); - elements.$verdict.remove(); - elements.$errors.remove(); - $el.removeData("pwstrength-bootstrap"); - }); - }; - - methods.forceUpdate = function () { - this.each(function (idx, el) { - var event = { - target: el - }; - onKeyUp(event); - }); - }; - - methods.addRule = function (name, method, score, active) { - this.each(function (idx, el) { - var options = $(el).data("pwstrength-bootstrap"); - - options.rules.activated[name] = active; - options.rules.scores[name] = score; - options.rules.extra[name] = method; - }); - }; - - applyToAll = function (rule, prop, value) { - this.each(function (idx, el) { - $(el).data("pwstrength-bootstrap").rules[prop][rule] = value; - }); - }; - - methods.changeScore = function (rule, score) { - applyToAll.call(this, rule, "scores", score); - }; - - methods.ruleActive = function (rule, active) { - applyToAll.call(this, rule, "activated", active); - }; - - $.fn.pwstrength = function (method) { - var result; - - if (methods[method]) { - result = methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else if (typeof method === "object" || !method) { - result = methods.init.apply(this, arguments); - } else { - $.error("Method " + method + " does not exist on jQuery.pwstrength-bootstrap"); - } - - return result; - }; - }(jQuery, methods)); -}(jQuery)); diff --git a/Packages/active-entry/package.js b/Packages/active-entry/package.js deleted file mode 100755 index 79f02d03f..000000000 --- a/Packages/active-entry/package.js +++ /dev/null @@ -1,89 +0,0 @@ -Package.describe({ - name: 'clinical:active-entry', - version: '1.5.16', - summary: 'SignIn, SignUp, and ForgotPassword pages for Clinical Framework.', - git: 'https://github.com/clinical-meteor/clinical-active-entry', - documentation: 'README.md' -}); - -Package.onUse(function (api) { - api.versionsFrom('1.1.0.3'); - - api.use([ - 'meteor-platform', - 'templating', - 'clinical:router@2.0.19', - 'grove:less@0.1.1', - 'session', - 'reactive-dict' - //'codetheweb:zxcvbn' - ], ['client']); - - api.use([ - 'accounts-base', - 'accounts-password' - ]); - - api.use([ - 'zuuk:stale-session@1.0.8', - 'random' - ], ['client', 'server']); - - api.addFiles([ - 'lib/ActiveEntry.js', - 'lib/Accounts.js' - ]); - - api.addFiles([ - 'lib/jquery.pwstrength.bootstrap.js', - 'lib/checkPasswordStrength.js', - 'lib/hashCodeGenerator.js' - ], ['client']); - - api.imply('accounts-base'); - api.imply('accounts-password'); - - api.addFiles([ - 'components/entryPages.js', - 'components/entryPages.less', - - 'components/entrySignIn/entrySignIn.html', - 'components/entrySignIn/entrySignIn.js', - 'components/entrySignIn/entrySignIn.less', - - 'components/entrySignUp/entrySignUp.html', - 'components/entrySignUp/entrySignUp.js', - 'components/entrySignUp/entrySignUp.less', - - 'components/forgotPassword/forgotPassword.html', - 'components/forgotPassword/forgotPassword.js', - 'components/forgotPassword/forgotPassword.less', - - 'components/changePassword/changePassword.html', - 'components/changePassword/changePassword.js', - 'components/changePassword/changePassword.less', - - 'components/resetPassword/resetPassword.html', - 'components/resetPassword/resetPassword.js' - ], ['client']); - - - api.addFiles('server/methods.js', "server", {testOnly: true}); - - api.export("ActiveEntry"); -}); - - -Package.onTest(function (api) { - api.use([ - 'templating', - 'clinical:router@2.0.19', - 'grove:less@0.1.1', - 'standard-app-packages' - ], ['client']); - - api.use('tinytest'); - api.use('clinical:active-entry'); - api.use('clinical:verification'); - api.addFiles('tests/gagarin/activeEntryTests.js'); -}); diff --git a/Packages/active-entry/server/methods.js b/Packages/active-entry/server/methods.js deleted file mode 100644 index 65d8dfc9a..000000000 --- a/Packages/active-entry/server/methods.js +++ /dev/null @@ -1,202 +0,0 @@ -Meteor.methods({ - initializeEntryUsers: function (){ - console.log('Initializing Users', Meteor.users.find().fetch()); - - }, - - dropEntryUsers: function (){ - console.log('Drop Users', Meteor.users.find().fetch()); - Meteor.users.find().forEach(function(user){ - Meteor.users.remove({_id: user._id}); - }); - }, - - insertHashedPassword: function(passwordParameters) { - var hashedPassword = passwordParameters[0]; - var passwordHistoryCount = passwordParameters[1]; - - var userId = Meteor.userId(); - var previousPasswords = Meteor.users.findOne({_id: userId}).previousPasswords; - if (previousPasswords) { - if (previousPasswords.length == passwordHistoryCount) { - // Remove oldest password - var ascSortedPasswords = _.sortBy(previousPasswords, function(previousPassword){ return previousPassword.createdAt; }); - ascSortedPasswords.splice(0, 1); - previousPasswords = ascSortedPasswords; - } - - previousPasswords.push({hashedPassword: hashedPassword, createdAt: new Date()}); - Meteor.users.update({_id: userId}, {$set: {previousPasswords: previousPasswords}}); - } else { - Meteor.users.update({_id: userId}, {$set: {previousPasswords: [{hashedPassword: hashedPassword, createdAt: new Date(), select: false}]}}); - } - }, - - checkPasswordExistence: function(hashedPassword) { - var previousPasswords = Meteor.users.find({_id: Meteor.userId()}).fetch()[0].previousPasswords; - for(var i=0; i< previousPasswords.length; i++) { - var recordedHashedPassword = previousPasswords[i].hashedPassword; - if (recordedHashedPassword == hashedPassword) { - return true; - } - } - return false; - }, - - getFailedAttemptsCount: function(emailAddress) { - // Check if the user actually exists, and if not, stop here - var currentUser = Meteor.users.findOne({"emails.address": emailAddress}); - if (!currentUser) { - return; - } - - return currentUser.failedPasswordAttempts || 0; - }, - - updateFailedAttempts: function(emailAddress, failedAttemptsLimit) { - - // Check if the user actually exists, and if not, stop here - var currentUser = Meteor.users.findOne({"emails.address": emailAddress}); - if (!currentUser) { - return; - } - - var failedAttemptCount = currentUser.failedPasswordAttempts || 0; - if (failedAttemptCount == failedAttemptsLimit) { - return failedAttemptCount; - } else { - if (failedAttemptCount == (failedAttemptsLimit - 1)) { - // Locked user account - Meteor.users.update({"emails.address": emailAddress}, {$set: {"profile.isLocked": true, failedPasswordAttempts: failedAttemptCount + 1}}); - } else if (failedAttemptCount < (failedAttemptsLimit - 1)) { - Meteor.users.update({"emails.address": emailAddress}, {$set: {failedPasswordAttempts: failedAttemptCount + 1}}); - } - } - - return failedAttemptCount + 1; - }, - - lockAccount: function(emailAddress) { - // Check if the user actually exists, and if not, stop here - var currentUser = Meteor.users.findOne({"emails.address": emailAddress}); - if (!currentUser) { - return; - } - - Meteor.users.update({"emails.address": emailAddress}, {$set: {"profile.isLocked": true}}); - }, - - resetFailedAttempts: function(emailAddress) { - Meteor.users.update({"emails.address": emailAddress}, {$set: {failedPasswordAttempts: 0}}); - }, - - updatePasswordSetDate: function() { - Meteor.users.update({_id: Meteor.userId()}, {$set: {"services.password.setDate": new Date()}}); - }, - - isPasswordExpired: function(passwordExpirationDays) { - var passwordSetDate = Meteor.users.find({_id: Meteor.userId()}).fetch()[0].services.password.setDate; - if (!passwordSetDate) { - return false; - } - - passwordSetDate.setDate(passwordSetDate.getDate() + passwordExpirationDays); - - if (passwordSetDate <= new Date()) { - return true; - } - - return false; - }, - - isAccountLocked: function(emailAddress) { - // Check if the user actually exists, and if not, stop here - var currentUser = Meteor.users.findOne({"emails.address": emailAddress}); - if (!currentUser) { - return; - } - - return currentUser.profile.isLocked || false; - }, - - updateLastLoginDate: function () { - var user = Meteor.users.findOne(Meteor.userId()); - if (!user) { - return; - } - var priorLoginDate = user.lastLoginDate; - if (!priorLoginDate) { - priorLoginDate = new Date(); - } - // Update priorLoginDate and lastLoginDate - Meteor.users.update({_id: Meteor.userId()}, {$set: {priorLoginDate: priorLoginDate, lastLoginDate: new Date()}}); - }, - - isAccountInactive: function (emailAddress, inactivityPeriodDays) { - // Check if the user actually exists, and if not, stop here - var currentUser = Meteor.users.findOne({"emails.address": emailAddress}); - if (!currentUser) { - return; - } - - var lastLoginDate = currentUser.lastLoginDate; - if (!lastLoginDate) { - return false; - } - - lastLoginDate.setDate(lastLoginDate.getDate() + inactivityPeriodDays); - - if (lastLoginDate <= new Date()) { - return true; - } - - return false; - }, - - isLDAPSet: function() { - if (LDAP_DEFAULTS && LDAP_DEFAULTS.url && LDAP_DEFAULTS.port) { - return true; - } - - return false; - }, - - checkResetTokenIsExpired: function(token, expireTimeInMinute) { - var user = Meteor.users.findOne({"services.password.reset.token": token}); - if (!user) { - return; - } - var tokenCreatedTime = user.services.password.reset.when; - if (!tokenCreatedTime) { - return; - } - // Token will be expired if created time is over 30 min as default - tokenCreatedTime.setTime(tokenCreatedTime.getTime() + expireTimeInMinute*60000); - if (tokenCreatedTime < new Date()) { - // Remove reset token - Meteor.users.update({_id: user._id}, {$unset: {'services.password.reset': 1}}); - return true; - } - - return false; - }, - - checkResetPasswordExistence: function(hashedPassword, token) { - var user = Meteor.users.findOne({"services.password.reset.token": token}); - if (!user) { - return; - } - var previousPasswords = user.previousPasswords; - if (!previousPasswords) { - return; - } - for(var i=0; i< previousPasswords.length; i++) { - var recordedHashedPassword = previousPasswords[i].hashedPassword; - if (recordedHashedPassword == hashedPassword) { - return true; - } - } - return false; - }, - -}); diff --git a/Packages/active-entry/tests/gagarin/activeEntryTests.js b/Packages/active-entry/tests/gagarin/activeEntryTests.js deleted file mode 100644 index 5ba3a3f13..000000000 --- a/Packages/active-entry/tests/gagarin/activeEntryTests.js +++ /dev/null @@ -1,215 +0,0 @@ -// var nightwatch = require('nightwatch'); - -describe('clinical:active-entry', function () { - var server = meteor(); - var client = browser(server); - - // before(function () { - // return server.promise(function (resolve){ - // Meteor.users.find().forEach(function(user){ - // Meteor.users.remove({_id: user._id}); - // }, function(){ - // resolve(); - // }); - // }); - // }); - - // afterEach(function (){ - // return client.promise(function (resolve){ - // Meteor.logout(function(error, result){ - // resolve(); - // }); - // }); - // }); - - - it("ActiveEntry object should be loaded on client and server", function () { - return server.execute(function () { - expect(ActiveEntry.isAbc()).to.equal('abc'); - }).then(function (data){ - return client.execute(function (a) { - expect(ActiveEntry.isAbc()).to.equal('abc'); - }); - }); - }); - - it("Error messages should be empty by default", function () { - return client.execute(function () { - expect(ActiveEntry.errorMessages.get('signInError')).to.equal(false); - }); - }); - - // ActiveEntry.verifyEmail - it('Email validation confirms it is a properly formatted email.', function () { - return client.execute(function (a) { - ActiveEntry.verifyEmail('janedoe@somewhere.com'); - expect(ActiveEntry.successMessages.get('email')).to.equal("Email present"); - - ActiveEntry.verifyEmail(''); - expect(ActiveEntry.errorMessages.get('email')).to.equal("Email is required"); - - ActiveEntry.verifyEmail('janedoe.somewhere.com'); - expect(ActiveEntry.errorMessages.get('email')).to.equal("Email is poorly formatted"); - }); - }); - - - // ActiveEntry.verifyPassword - it('Password validation confirms it is a properly formatted password.', function () { - return client.execute(function (a) { - ActiveEntry.verifyPassword(''); - expect(ActiveEntry.errorMessages.get('password')).to.equal("Password is required"); - - ActiveEntry.verifyPassword('kittens'); - expect(ActiveEntry.errorMessages.get('password')).to.equal(Session.get('passwordWarning')); - - ActiveEntry.verifyPassword('K1tt#ns123'); - expect(ActiveEntry.successMessages.get('password')).to.equal("Password present"); - }); - }); - - // ActiveEntry.verifyConfirmPassword - it('Password match confirms that two passwords are the same.', function () { - return client.execute(function (a) { - ActiveEntry.verifyConfirmPassword('K1tt#kittens', 'kittens'); - expect(ActiveEntry.errorMessages.get('confirm')).to.equal("Passwords do not match"); - - ActiveEntry.verifyConfirmPassword('kittens123', 'kittens'); - expect(ActiveEntry.errorMessages.get('confirm')).to.equal("Passwords do not match"); - - ActiveEntry.verifyConfirmPassword('kittens123', 'kittens123'); - expect(ActiveEntry.errorMessages.get('confirm')).to.equal("Passwords match"); - - ActiveEntry.verifyConfirmPassword('K1tt#ns123', 'K1tt#ns123'); - expect(ActiveEntry.successMessages.get('confirm')).to.equal("Passwords match"); - - }); - }); - - // ActiveEntry.verifyFullName - it('Fullname validation confirms that at least a first and last name are entered.', function () { - return client.execute(function (a) { - ActiveEntry.verifyFullName(''); - expect(ActiveEntry.errorMessages.get('fullName')).to.equal("Name is required"); - - ActiveEntry.verifyFullName('Jane'); - expect(ActiveEntry.errorMessages.get('fullName')).to.equal("Name is probably not complete"); - - ActiveEntry.verifyFullName('Jane Doe'); - expect(ActiveEntry.successMessages.get('fullName')).to.equal("Name present"); - }); - }); - - - // // ActiveEntry.signIn - // it('Newly created user record should have role, profile, and name set.', function () { - // return client.execute(function () { - // ActiveEntry.signUp('janedoe@test.org', 'Janed*e123', 'Janed*e123', 'Jane Doe'); - // expect(ActiveEntry.successMessages.get('fullName')).to.equal("Name present"); - // }).then(function (){ - // return server.wait(500, 'until account is created on the server', function () { - // return Meteor.users.findOne({'emails.address': 'janedoe@test.org'}); - // }).then(function (user){ - // expect(user.role).to.equal('user'); - // expect(user.profile.fullName).to.equal('Jane Doe'); - // }); - // }); - // }); - // ActiveEntry.signIn - it('Newly created user record should have role, profile, and name set.', function () { - return client.execute(function () { - // ActiveEntry.signUp('janedoe@test.org', 'Janed*e123', 'Janed*e123', 'Jane Doe'); - ActiveEntry.signUp('janedoe@test.org', 'Janedoe123', 'Janedoe123', 'Jane Doe'); - expect(ActiveEntry.successMessages.get('fullName')).to.equal("Name present"); - }).then(function (){ - return server.wait(500, 'until account is created on the server', function () { - return Meteor.users.findOne({'emails.address': 'janedoe@test.org'}); - }).then(function (user){ - expect(user.role).to.equal('user'); - expect(user.profile.fullName).to.equal('Jane Doe'); - }); - }); - }); - - - it("Newly created user should have fullName(), preferredName(), and familyName() methods.", function () { - return server.execute(function () { - var user = Meteor.users.findOne({'emails.address': 'janedoe@test.org'}); - expect(user).to.be.ok; - expect(user.fullName()).to.equal('Jane Doe'); - expect(user.givenName()).to.equal('Jane'); - expect(user.familyName()).to.equal('Doe'); - }).then(function (){ - // client.wait(500, "until user is logged out", function(){ - // Meteor.logout(); - // }); - return client.promise(function (resolve){ - Meteor.logout(function (error, result){ - resolve(); - }); - }); - - }); - }); - it("Newly created user can sign in to the application.", function () { - return client.execute(function () { - expect(Meteor.userId()).to.not.exist; - ActiveEntry.signIn('janedoe@test.org', 'Janed*e123'); - }).then(function (){ - client.wait(3000, "for user to sign in", function (){ - expect(Meteor.userId()).to.exist; - }); - }); - }); - it("Newly created user can sign out of the application.", function () { - return client.execute(function () { - expect(Meteor.userId()).to.not.exist; - ActiveEntry.signIn('janedoe@test.org', 'Janed*e123'); - }).then(function (){ - client.wait(3000, "for user to sign in", function (){ - expect(Meteor.userId()).to.exist; - ActiveEntry.signOut('janedoe@test.org'); - }).then(function (){ - expect(Meteor.userId()).to.not.exist; - }); - }); - }); - - - - // it("config should be able to change company logo", function () { - // - // }); - // it("config should be able to change entry message text", function () { - // - // }); - - // it("new user should be able to register on desktop", function () { - // client.location = "/sign-in"; - // - // client.execute(function () { - // expect($('#entrySignIn')).to.exist(); - // expect($('#signInPageEmailInput')).to.exist(); - // expect($('#signInPagePasswordInput')).to.exist(); - // expect($('#signInToAppButton')).to.exist(); - // }).setValue('#signInPageEmailInput', 'house@test.org') - // .setValue('#signInPagePasswordInput', 'house@test.org') - // .click('#signInToAppButton').execute(function(){ - // expect($('#entrySignIn')).to.exist(); - // expect($('#signInPageEmailInput')).to.exist(); - // expect($('#signInPagePasswordInput')).to.exist(); - // expect($('#signInToAppButton')).to.exist(); - // // expect($('#entrySignIn')).to.not.exist(); - // // expect($('#signInPageEmailInput')).to.not.exist(); - // // expect($('#signInPagePasswordInput')).to.not.exist(); - // // expect($('#signInToAppButton')).to.not.exist(); - // }); - // // .then(function(data){ - // // return server.execute(3000, 'until the account is created', function () { - // // expect(Meteor.users.find().count()).to.be.above(20); - // // }); - // // }); - // }); - - -}); diff --git a/Packages/active-entry/tests/nightwatch/commands/dropCollaborations.js b/Packages/active-entry/tests/nightwatch/commands/dropCollaborations.js deleted file mode 100755 index c6c1652f4..000000000 --- a/Packages/active-entry/tests/nightwatch/commands/dropCollaborations.js +++ /dev/null @@ -1,22 +0,0 @@ -// async version calls method on the server -exports.command = function () { - var client = this; - - this - .timeoutsAsyncScript(5000) - .executeAsync(function (data, meteorCallback) { - //return HipaaLogger.logEventObject(data); - Meteor.call("dropCollaborations", data, function (meteorError, meteorResult) { - var response = (meteorError ? { - error: meteorError - } : { - result: meteorResult - }); - meteorCallback(response); - }); - }, [], function (result) { - console.log("result.value", result.value); - client.assert.ok(result.value); - }).pause(1000); - return this; -}; diff --git a/Packages/active-entry/tests/nightwatch/walkthroughs/activeEntryWalkthrough.js b/Packages/active-entry/tests/nightwatch/walkthroughs/activeEntryWalkthrough.js deleted file mode 100755 index 63ae8204c..000000000 --- a/Packages/active-entry/tests/nightwatch/walkthroughs/activeEntryWalkthrough.js +++ /dev/null @@ -1,222 +0,0 @@ -// when new user fills out form and registers, new user should get created -// when user signs in with username and password, should redirect to home page -// newly created user record should have role -// newly created user record should have profile -// newly created user record should have full, preferred, and family name -// user object should return first name -// user object should return last name -// user should be able to request reset password email -// user should be able to request be able to create new account -// guest should be notified if username already exists -// guest should be notified if passwords do not match -// guest should be notified if email is not correctly formatted -// new user should be able to register on desktop -// new user should be able to register on tablet -// existing user should be able to sign in on desktop -// existing user should be able to sign in on tablet -// existing user should be able to sign in on phone -// existing user should be able to change their password -// company logo should display on sign//in page - - - -module.exports = { - tags: ['users', 'entry'], - before: function (client) { - client - .url("http://localhost:3000/entrySignUp") - .initializeUsers() - .resizeWindow(1600, 1200); - }, - "new user should be able to register on desktop": function (client) { - client - .verify.elementPresent("#entrySignUp") - .verify.elementPresent("#signUpPageTitle") - .verify.elementPresent("#signUpPageMessage") - .verify.elementPresent("#signUpPageEmailInput") - .verify.elementPresent("#signUpPagePasswordInput") - .verify.elementPresent("#signUpPageJoinNowButton") - .verify.elementPresent("#signUpPageSignInButton"); - }, - "company logo should display on sign-in page": function (client) { - client - .verify.elementPresent("#entrySignUp") - .verify.elementPresent("#entryAppLogo"); - }, - "user should be able to request be able to create new account": function (client) { - client.verify.elementPresent("#signUpPageEmailInput") - .verify.elementPresent("#signUpPagePasswordInput") - .verify.elementPresent("#signUpPagePasswordInput") - .verify.elementPresent("#signUpPageJoinNowButton"); - }, - "guest should be notified if password is insecure": function (client) { - client - .clearValue("input") - .verify.elementPresent("#signUpPagePasswordInput") - .verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid gray') - .setValue("#signUpPagePasswordInput", "jan") - .verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid rgb(242, 222, 222)') - .setValue("#signUpPagePasswordInput", "iceD*e123") - .verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid green') - - .verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid gray') - .setValue("#signUpPagePasswordConfirmInput", "ja") - .verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', - '1px solid rgb(242, 222, 222)') - .clearValue("#signUpPagePasswordConfirmInput") - .setValue("#signUpPagePasswordConfirmInput", "Janiced*e123") - .verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid green'); - }, - "guest should be notified if passwords do not match": function (client) { - client - .clearValue("#signUpPagePasswordConfirmInput") - .clearValue("#signUpPagePasswordInput") - .resetEntry() - .pause(500) - .verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid gray') - .verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid gray') - .setValue("#signUpPagePasswordInput", "Janiced*e123") - .verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid green') - .verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid gray') - .setValue("#signUpPagePasswordConfirmInput", "Janiced*e123") - .verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid green') - .verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid green'); - }, - "guest should be notified if email is not correctly formatted": function (client) { - client - .clearValue("#signUpPageEmailInput") - .resetEntry() - .verify.elementPresent("#signUpPageEmailInput") - .verify.cssProperty('#signUpPageEmailInput', 'border', '1px solid gray') - .setValue("#signUpPageEmailInput", "janicedoe") - .verify.cssProperty('#signUpPageEmailInput', 'border', '1px solid rgb(242, 222, 222)') - .setValue("#signUpPageEmailInput", "@symptomatic.io") - .verify.cssProperty('#signUpPageEmailInput', 'border', '1px solid green'); - }, - "when new user fills out form and registers, new user should get created": function (client) { - client - .verify.elementPresent("#entrySignUp") - - .clearValue("#signUpPagePasswordConfirmInput") - .clearValue("#signUpPagePasswordInput") - .clearValue("#signUpPageFullNameInput") - .clearValue("#signUpPageEmailInput") - .resetEntry() - - .setValue("#signUpPageFullNameInput", "Janice Doe") - .setValue("#signUpPageEmailInput", "janicedoe@symptomatic.io") - .setValue("#signUpPagePasswordInput", "Janiced*e123") - .setValue("#signUpPagePasswordConfirmInput", "Janiced*e123") - - .click("#signUpPageJoinNowButton").pause(1000) - - .verify.containsText("#usernameLink", "janicedoe@symptomatic.io"); - }, - "user should be able to signout": function (client) { - client - .verify.elementPresent("#logoutButton") - .click("#logoutButton").pause(300) - .verify.containsText("#usernameLink", "Sign In"); - }, - "user should be able to request reset password email": function (client) { - client - .url("http://localhost:3000/entrySignIn") - .verify.elementPresent("#forgotPasswordButton") - .click("#forgotPasswordButton") - .verify.elementPresent("#forgotPassword") - .verify.elementPresent("#signInPageEmailInput") - .verify.elementPresent("#sendReminderButton"); - }, - "existing user should be able to sign in on desktop": function (client) { - client - .url("http://localhost:3000/entrySignIn") - .resizeWindow(1600, 1200) - .verify.containsText("#usernameLink", "Sign In") - .signIn("janicedoe@symptomatic.io", "Janiced*e123").pause(500) - .verify.containsText("#usernameLink", "janicedoe@symptomatic.io") - .click("#logoutButton").pause(200) - .verify.containsText("#usernameLink", "Sign In"); - }, - "existing user should be able to sign in on tablet": function (client) { - client - .url("http://localhost:3000/entrySignIn") - .resizeWindow(1024, 768) - .verify.containsText("#usernameLink", "Sign In") - .signIn("janicedoe@symptomatic.io", "Janiced*e123").pause(500) - .verify.containsText("#usernameLink", "janicedoe@symptomatic.io") - .click("#logoutButton").pause(200) - .verify.containsText("#usernameLink", "Sign In"); - }, - "existing user should be able to sign in on phone": function (client) { - client - .url("http://localhost:3000/entrySignIn") - .resizeWindow(320, 960) - // .verify.containsText("#usernameLink", "Sign In") - .signIn("janicedoe@symptomatic.io", "Janiced*e123").pause(500) - .click("#navbarHeader").pause(300) - .verify.containsText("#usernameLink", "janicedoe@symptomatic.io") - .click("#logoutButton").pause(200) - .verify.containsText("#usernameLink", "Sign In"); - }, - "existing user should be able to change their password" : function (client) { - client - .url("http://localhost:3000/entrySignIn") - .resizeWindow(1600, 1200) - .verify.containsText("#usernameLink", "Sign In") - .signIn("janicedoe@symptomatic.io", "janicedoe123").pause(500) - .verify.containsText("#usernameLink", "janicedoe@symptomatic.io") - .url("http://localhost:3000/changePassword") - .verify.elementPresent("#changePasswordPageOldPasswordInput") - .verify.elementPresent("#changePasswordPagePasswordInput") - .verify.elementPresent("#changePasswordPagePasswordConfirmInput") - .verify.elementPresent("#changePasswordButton") - }, - "existing user should be notified if desired new password is insecure" : function (client) { - client - .url("http://localhost:3000/entrySignIn") - .resizeWindow(1600, 1200) - .verify.containsText("#usernameLink", "Sign In") - .signIn("janicedoe@symptomatic.io", "janicedoe123").pause(500) - .verify.containsText("#usernameLink", "janicedoe@symptomatic.io") - .url("http://localhost:3000/changePassword") - .verify.elementPresent("#changePasswordPageOldPasswordInput") - .verify.elementPresent("#changePasswordPagePasswordInput") - .verify.elementPresent("#changePasswordPagePasswordConfirmInput") - .verify.elementPresent("#changePasswordButton") - .verify.cssProperty('#changePasswordPagePasswordInput', 'border', '1px solid gray') - .setValue("#changePasswordPagePasswordInput", "jan") - .verify.cssProperty('#changePasswordPagePasswordInput', 'border', '1px solid rgb(242, 222, 222)') - .setValue("#changePasswordPagePasswordInput", "icedoe123") - .verify.cssProperty('#changePasswordPagePasswordInput', 'border', '1px solid green') - .verify.cssProperty('#changePasswordPagePasswordConfirmInput', 'border', '1px solid gray') - .setValue("#changePasswordPagePasswordConfirmInput", "ja") - .verify.cssProperty('#changePasswordPagePasswordConfirmInput', 'border', '1px solid rgb(242, 222, 222)') - .clearValue("#changePasswordPagePasswordConfirmInput") - .setValue("#changePasswordPagePasswordConfirmInput", "janicedoe123") - .verify.cssProperty('#changePasswordPagePasswordConfirmInput', 'border', '1px solid green') - }, - "if anonymous user tries to log in with non-existing account, a message is shown" : function (client) { - client - .url("http://localhost:3000/entrySignIn") - .resizeWindow(1024, 768) - .signIn("alice@symptomatic.io", "alice123").pause(500) - .verify.containsText("#signInPageMessage", "User not found [403]") - .verify.cssProperty("#signInPageMessage", "color", "rgba(169, 68, 66, 1)") - .verify.cssProperty("#signInPageMessage", "background-color", "rgba(242, 222, 222, 1)") - .verify.cssProperty("#signInPageMessage", "border-color", "rgb(235, 204, 209)"); - }, - "anonymous guest should be notified if email already exists": function (client) { - client - .url("http://localhost:3000/entrySignUp") - .resizeWindow(1024, 768) - .signUp("janicedoe@symptomatic.io", "Janiced*e123").pause(500) - .click("#signUpPageJoinNowButton").pause(1000) - .verify.elementPresent("#signUpPageMessage") - .verify.containsText("#signUpPageMessage", "Email already exists. [403]"); - }, - after: function (client) { - client - .dropEntryUsers() - .end(); - } -}; diff --git a/Packages/hipaa-audit-log/.gitignore b/Packages/hipaa-audit-log/.gitignore deleted file mode 100644 index 677a6fc26..000000000 --- a/Packages/hipaa-audit-log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.build* diff --git a/Packages/hipaa-audit-log/.travis.yml b/Packages/hipaa-audit-log/.travis.yml deleted file mode 100644 index 27cbbc9d8..000000000 --- a/Packages/hipaa-audit-log/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: node_js -node_js: - - "0.10" -#sudo: required - -sudo: required - -env: - global: - - METEOR_ENV=development - -before_install: - - "curl -L http://git.io/ejPSng | /bin/sh" diff --git a/Packages/hipaa-audit-log/History.md b/Packages/hipaa-audit-log/History.md deleted file mode 100644 index f4f3d1ba3..000000000 --- a/Packages/hipaa-audit-log/History.md +++ /dev/null @@ -1,9 +0,0 @@ - -#### v2.3.7 - -* Updated to use clinical:router - -#### v2.4.0 - -* clinical:hipaa-loger extracted from package -* HipaaLogger and HipaaLog removed diff --git a/Packages/hipaa-audit-log/README.md b/Packages/hipaa-audit-log/README.md deleted file mode 100644 index 19dfad1c7..000000000 --- a/Packages/hipaa-audit-log/README.md +++ /dev/null @@ -1,71 +0,0 @@ -clinical:hipaa-audit-log -==================================================== - -HIPAA logging and audit features for Meteor Apps built with Clinical UI. - -![HipaaAuditLogScreenshot](https://raw.githubusercontent.com/awatson1978/clinical-hipaa-audit-log/master/screenshots/auditlog.png) - -==================================================== -#### Installation - -The HIPAA audit log is now split into two packages: one for the logging, and one for the UI. Please see [``clinical:hipaa-logger``](https://github.com/clinical-meteor/hipaa-logger) for the logging portion. - -```` -meteor add clinical:hipaa-audit-log -meteor add clinical:hipaa-logger -```` - -==================================================== -#### URL Routes - -Navigate to the audit log via the default route: - -````js -Router.go('/audit'); -```` - -==================================================== -#### Provided Templates - -Three templates are provided by this package: - -````html -{{>hipaaAuditLog}} -{{>hipaaRibbon}} -{{>hipaaLogPage}} -```` - -==================================================== -#### Styling and Classes - -You can adjust the styling of the audit log through the configuration object. The following example shows how to style the audit log with Bootstrap controls. - -````js - HipaaAuditLog.configure({ - classes: { - input: "form-control squee", - select: "form-control", - ribbon: "" - }, - highlightColor: "#006289" - }); -```` - - -==================================================== -#### StarryNight/Nightwatch API - Provides - -````js -// component API calls -reviewHipaaAuditLogPage() -hipaaLogEntryContains(rowIndex, hipaaEvent) - -// actions -logHipaaEvent(hipaaEvent, timeout) -```` - - ------------------------- -### License - -![MIT License](https://img.shields.io/badge/license-MIT-blue.svg) diff --git a/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.html b/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.html deleted file mode 100644 index b0c69a356..000000000 --- a/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.html +++ /dev/null @@ -1,188 +0,0 @@ - - - diff --git a/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.js b/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.js deleted file mode 100644 index ffe8fc177..000000000 --- a/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.js +++ /dev/null @@ -1,160 +0,0 @@ -//Hipaa = new Meteor.Collection("hipaa"); - -Session.setDefault("hipaaSearchFilter", ''); -Session.setDefault("hipaaTypeFilter", ''); - -// search window defaults to seven days in the past and one day in the future -Session.setDefault("beginDateFilter", new Date(moment().subtract(7, "days")).toISOString()); -Session.setDefault("endDateFilter", new Date(moment().add(1, "days")).toISOString()); - - - - -Template.hipaaAuditLog.onRendered(function () { - Session.set("ribbonWidth", $('#hipaaRibbon').width()); -}); - -Template.hipaaAuditLog.helpers({ - getHipaaSearchFilter: function () { - return Session.get('hipaaSearchFilter'); - }, - hipaaAudit: function () { - // return HipaaLog.find(); - return HipaaLog.find({ - $or: [ - { - userName: { - $regex: Session.get('hipaaSearchFilter'), - $options: 'i' - } - }, - { - patientName: { - $regex: Session.get('hipaaSearchFilter'), - $options: 'i' - } - }, - { - recordId: { - $regex: Session.get('hipaaSearchFilter'), - $options: 'i' - } - }, - { - collectionName: { - $regex: Session.get('hipaaSearchFilter'), - $options: 'i' - } - } - ], - eventType: { - $regex: Session.get("hipaaTypeFilter"), - $options: 'i' - }, - timestamp: { - $lte: new Date(Session.get('endDateFilter')), - $gte: new Date(Session.get('beginDateFilter')) - } - }, { - sort: { - timestamp: -1 - } - }); - } -}); - -Template.hipaaAuditLog.events({ - "keyup #hipaaSearchFilter": function (event, template) { - Session.set("hipaaSearchFilter", $('#hipaaSearchFilter').val()); - }, - "click .userName": function(event, template) { - var userName = $(event.currentTarget).text(); - Session.set('hipaaSearchFilter', userName); - }, - "click .patientName": function(event, template) { - var patientName = $(event.currentTarget).text(); - var patientNameRegex = patientName.replace(/[!@#$%^&*()+=\-[\]\\';,./{}|":<>?~_]/g, "\\$&"); - Session.set('hipaaSearchFilter', patientNameRegex); - }, - "click .mongoRecordId": function(event, template) { - var mongoRecordId = $(event.currentTarget).text(); - Session.set('hipaaSearchFilter', mongoRecordId); - }, - "click .collectionName": function(event, template) { - var collectionName = $(event.currentTarget).text(); - Session.set('hipaaSearchFilter', collectionName); - } -}); - - -//================================================================================================== -// HIPAA EVENT RECORD - -Template.hipaaEntry.helpers({ - getHighlightColor: function () { - var hipaaAuditLog = Session.get('HipaaAuditLogConfig'); - if (hipaaAuditLog) { - return "color:" + hipaaAuditLog.highlightColor; - } else { - return null; - } - }, - getUserName: function () { - if (this.userName) { - return this.userName; - } else { - return "---"; - } - }, - getPatientName: function () { - if (this.patientName) { - return this.patientName; - } else { - return "---"; - } - }, - hasPatientInfo: function () { - if (this.patientName) { - return true; - } else { - return false; - } - }, - getErrorMessage: function () { - if (this.message) { - return this.message; - } else { - return "---"; - } - }, - getCollectionName: function () { - if (this.collectionName) { - return this.collectionName; - } else { - return "---"; - } - }, - getRecordId: function () { - if (this.recordId) { - return this.recordId; - } else { - return "---"; - } - }, - entryTimestamp: function () { - return moment(this.timestamp).format("YYYY, MMM DD, hh:mm A"); - }, - entryTime: function () { - return moment(this.timestamp).format("HH:MM A"); - }, - entryDate: function () { - return moment(this.timestamp).format("YYYY, MMM DD"); - }, - logMessageType: function (eventType) { - if (this.eventType === eventType) { - return true; - } else { - return false; - } - } -}); diff --git a/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.less b/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.less deleted file mode 100644 index 29505a708..000000000 --- a/Packages/hipaa-audit-log/components/hipaaAuditLog/hipaaAuditLog.less +++ /dev/null @@ -1,54 +0,0 @@ -#hipaaAuditLog{ - color: #fff; - width: 100%; - - .hipaaAuditItem { - border: none; - background-color: black; - list-style: none; - padding: 10px; - line-height: 25px; - - // There's a CSS rule on ohif-user-management that's changing the .hipaaAuditItem border style (w/ !important) - &:first-child { - border-top: none !important; - } - - &:not(:first-child) { - border-top: 1px solid #436270; - } - - border-bottom: 1px solid #436270; - - &:nth-child(even) { - background-color: #151a1f; - } - - &:hover, &:active, &.active { - background-color: #2c363f; - color: white; - } - - .item-icon { - top: 12px; - position: relative; - } - - .media-icon { - float: left; - top: 12px; - width: 40px; - text-align: center; - position: relative; - margin-right: 10px; - } - } - - .gray{ - color: gray; - } - - .userName, .patientName, .mongoRecordId, .collectionName{ - cursor: pointer; - } -} diff --git a/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.html b/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.html deleted file mode 100644 index 77d2bc419..000000000 --- a/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.html +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.js b/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.js deleted file mode 100644 index 96e87225a..000000000 --- a/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.js +++ /dev/null @@ -1,12 +0,0 @@ -Template.hipaaCloseButton.events({ - 'click button': function() { - var history = window.history; - - if(history.length > 0) { - history.go(-1); - } - else { - window.location = '/' - } - } -}); \ No newline at end of file diff --git a/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.less b/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.less deleted file mode 100644 index 01970b793..000000000 --- a/Packages/hipaa-audit-log/components/hipaaCloseButton/hipaaCloseButton.less +++ /dev/null @@ -1,44 +0,0 @@ -@tableTextSecondaryColor: #91b9cd; - -.close-btn { - text-align: right; - padding: 5px 5px 0; - - &:before, - &:after { - display: table; - content: " "; - clear: both; - } - - .close { - color: @tableTextSecondaryColor; - opacity: 1; - - &.close:hover, &.close:focus { - color: #fff; - opacity: 1; - } - } - - .btn-default { - margin-bottom: 5px; - margin-right: 5%; - } -} - -@media only screen and (max-width: 1161px) { - .close-btn { - .btn-default { - margin-right: 3%; - } - } -} - -@media only screen and (max-width: 991px) { - .close-btn { - .btn-default { - margin-right: 1%; - } - } -} diff --git a/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.html b/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.html deleted file mode 100644 index 8d839c21d..000000000 --- a/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.html +++ /dev/null @@ -1,26 +0,0 @@ - diff --git a/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.js b/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.js deleted file mode 100644 index 07482beb1..000000000 --- a/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.js +++ /dev/null @@ -1,17 +0,0 @@ -Router.route("/audit", { - name:"hipaaAuditLogRoute", - template:"hipaaLogPage" -}); - - -Template.hipaaLogPage.helpers({ - hasCloseButtons: function() { - var hipaaAuditLog = Session.get('HipaaAuditLogConfig'); - return hipaaAuditLog && hipaaAuditLog.closeButton; - } -}); - -// We probably don't need this, but the subscription in subscriptions.js doesn't seem to be working? -Template.hipaaLogPage.onCreated(function() { - this.subscribe('HipaaLog'); -}) \ No newline at end of file diff --git a/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.less b/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.less deleted file mode 100644 index d7c7e5a49..000000000 --- a/Packages/hipaa-audit-log/components/hipaaLogPage/hipaaLogPage.less +++ /dev/null @@ -1,52 +0,0 @@ -@tableTextSecondaryColor: #91b9cd; - -@hipaaHeaderHeight: 75px; -@hipaaHeaderBgColor: #151a1f; - -#hipaaLogPage { - background-color: #000; - - .hipaaHeader { - background-color: @hipaaHeaderBgColor; - height: @hipaaHeaderHeight; - margin-bottom: 2px; - padding: 0 20px; - - & > div { - display: inline-block; - } - - .header { - font-size: 22px; - font-weight: 300; - color: @tableTextSecondaryColor; - line-height: @hipaaHeaderHeight; - } - } - - .container { - margin: 0; - padding: 0 5%; - width: 100%; - - & > div.row { - margin: 0; - } - } -} - -@media only screen and (max-width: 1161px) { - #hipaaLogPage { - .container { - padding: 0 3%; - } - } -} - -@media only screen and (max-width: 991px) { - #hipaaLogPage { - .container { - padding: 0 1%; - } - } -} diff --git a/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.html b/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.html deleted file mode 100644 index a5ab5ed7e..000000000 --- a/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.html +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.js b/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.js deleted file mode 100644 index 54c14ed99..000000000 --- a/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.js +++ /dev/null @@ -1,75 +0,0 @@ -Template.hipaaRibbon.events({ - 'keyup #hipaaSearchFilter': function () { - Session.set("hipaaSearchFilter", $('#hipaaSearchFilter').val()); - }, - "change #beginDateInput": function (event, template) { - Session.set("beginDateFilter", $('#beginDateInput').val() + "T00:00:00.000Z"); - }, - "change #endDateInput": function (event, template) { - Session.set("endDateFilter", $('#endDateInput').val() + "T00:00:00.000Z"); - }, - 'change #actionFilter': function(e) { - var actionType = e.currentTarget.value; - Session.set("hipaaTypeFilter", actionType); - }, - 'click #filterCreatedButton': function () { - Session.set("hipaaTypeFilter", 'create'); - }, - 'click #filterModifiedButton': function () { - Session.set("hipaaTypeFilter", 'modify'); - }, - 'click #filterViewedButton': function () { - Session.set("hipaaTypeFilter", 'viewed'); - }, - 'click #filterAllButton': function () { - Session.set("hipaaTypeFilter", ''); - }, - 'click #searchClear': function() { - Session.set("hipaaSearchFilter", ''); - } -}); - -var ribbonBreakPoint = 760; - - -Meteor.startup(function(){ - $(window).resize(function(evt) { - Session.set("ribbonWidth", $('#hipaaRibbon').width()); - }); -}); - -Template.hipaaRibbon.helpers({ - getRibbonClass: function () { - var hipaaAuditLog = Session.get('HipaaAuditLogConfig'); - if (hipaaAuditLog && hipaaAuditLog.classes) { - return hipaaAuditLog.classes.ribbon; - } else { - return null; - } - }, - getSelectClass: function () { - var hipaaAuditLog = Session.get('HipaaAuditLogConfig'); - if (hipaaAuditLog && hipaaAuditLog.classes) { - return hipaaAuditLog.classes.select; - } else { - return null; - } - }, - getInputClass: function () { - var hipaaAuditLog = Session.get('HipaaAuditLogConfig'); - if (hipaaAuditLog && hipaaAuditLog.classes) { - return hipaaAuditLog.classes.input; - } else { - return null; - } - }, - getHipaaSearchFilter: function () { - return Session.get('hipaaSearchFilter'); - }, - getBeginDate: function () { - return moment(Session.get("beginDateFilter")).format("YYYY-MM-DD"); - }, - getEndDate: function () { - return moment(Session.get("endDateFilter")).format("YYYY-MM-DD"); - } -}); \ No newline at end of file diff --git a/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.less b/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.less deleted file mode 100644 index da4ef246b..000000000 --- a/Packages/hipaa-audit-log/components/hipaaRibbon/hipaaRibbon.less +++ /dev/null @@ -1,113 +0,0 @@ -@tableTextPrimaryColor: white; -@tableTextSecondaryColor: #91b9cd; - -@inputBackgroundColor: #2c363f; -@inputPlaceholderColor: lightgray; - -@hipaaRibbonBgColor: #151a1f; - -#hipaaRibbon { - background-color: @hipaaRibbonBgColor; - border-bottom: solid 1px #6fbde2; - color: @tableTextPrimaryColor; - margin: 0 0 2px; - padding: 20px 5%; - - .filter { - > span { - font-size: 15px; - display: block; - padding: 5px; - } - - min-height: 70px; - - &:first-child { - padding-left: 0; - } - - &:last-child { - padding-right: 0; - } - - &:not(:last-child) { - padding-right: 0; - } - } - - input[type="date"] { - padding-left: 10px; - } - - select { - display: inline-block; - } - - input, select { - height: 40px; - padding: 20px; - cursor: pointer; - border: none; - background-color: @inputBackgroundColor; - color: @inputPlaceholderColor; - font-size: 10pt; - font-weight: normal; - width: 100%; - border-radius: 4px; - box-sizing: border-box; - - transition: all 0.15s ease; - -webkit-transition: all 0.15s ease; - - &:active, &:hover { - background-color: @inputBackgroundColor; - } - } - - .btn-group { - width: 100%; - - #hipaaSearchFilter{ - padding-right: 35px; - } - - #searchClear { - position: absolute; - right: 14px; - top: 0; - bottom: 0; - height: 14px; - margin: auto; - font-size: 14px; - cursor: pointer; - color: #ccc; - } - } -} - - -@media only screen and (max-width: 1161px) { - #hipaaRibbon { - padding: 20px 3%; - } -} - -@media only screen and (max-width: 991px) { - #hipaaRibbon { - padding: 20px 1%; - } -} - -@media only screen and (max-width: 767px) { - #hipaaRibbon { - .filter { - &:first-child { - padding-bottom: 15px; - } - - &:nth-child(2) { - padding-left: 0; - } - } - } -} diff --git a/Packages/hipaa-audit-log/components/subscriptions.js b/Packages/hipaa-audit-log/components/subscriptions.js deleted file mode 100644 index af01a3b04..000000000 --- a/Packages/hipaa-audit-log/components/subscriptions.js +++ /dev/null @@ -1 +0,0 @@ -Meteor.subscribe('HipaaLog'); diff --git a/Packages/hipaa-audit-log/lib/HipaaAuditLog.js b/Packages/hipaa-audit-log/lib/HipaaAuditLog.js deleted file mode 100644 index e28aed9ea..000000000 --- a/Packages/hipaa-audit-log/lib/HipaaAuditLog.js +++ /dev/null @@ -1,20 +0,0 @@ -HipaaAuditLog = { - configure: function (configObject) { - if (Meteor.isClient) { - Session.set('HipaaAuditLogConfig', configObject); - } - //console.log("HipaaAuditLogConfig.configObject", configObject); - } -} - -if (Meteor.isClient) { - Session.setDefault('HipaaAuditLogConfig', { - classes: { - input: "", - select: "", - ribbon: "" - }, - highlightColor: "", - closeButton: false - }); -} diff --git a/Packages/hipaa-audit-log/package.js b/Packages/hipaa-audit-log/package.js deleted file mode 100644 index fa3d43ea1..000000000 --- a/Packages/hipaa-audit-log/package.js +++ /dev/null @@ -1,63 +0,0 @@ -Package.describe({ - summary: "HIPAA audit log for ClinicalFramework.", - version: "2.4.2", - git: "http://github.com/clinical-meteor/clinical-hipaa-audit-log.git", - name: "clinical:hipaa-audit-log" -}); - -Package.on_use(function (api) { - api.versionsFrom('1.1.0.3'); - - api.use('meteor-platform'); - - api.use('mrt:moment@2.8.1', 'client'); - api.use('grove:less@0.1.1', 'client'); - - api.use('clinical:router@2.0.19'); - api.use('clinical:fonts@1.0.0', 'client'); - api.use('clinical:auto-resizing@0.1.2', 'client'); - api.use('clinical:hipaa-logger@1.0.0'); - - api.imply('clinical:hipaa-logger'); - - api.addFiles('lib/HipaaAuditLog.js'); - - api.addFiles('server/initialize.js', "server"); - api.addFiles('server/publication.js', "server"); - - api.addFiles('components/hipaaRibbon/hipaaRibbon.html', "client"); - api.addFiles('components/hipaaRibbon/hipaaRibbon.js', "client"); - api.addFiles('components/hipaaRibbon/hipaaRibbon.less', "client"); - - api.addFiles('components/hipaaAuditLog/hipaaAuditLog.html', "client"); - api.addFiles('components/hipaaAuditLog/hipaaAuditLog.js', "client"); - api.addFiles('components/hipaaAuditLog/hipaaAuditLog.less', "client"); - - api.addFiles('components/hipaaLogPage/hipaaLogPage.html', "client"); - api.addFiles('components/hipaaLogPage/hipaaLogPage.js', "client"); - api.addFiles('components/hipaaLogPage/hipaaLogPage.less', "client"); - - api.addFiles('components/hipaaCloseButton/hipaaCloseButton.html', "client"); - api.addFiles('components/hipaaCloseButton/hipaaCloseButton.js', "client"); - api.addFiles('components/hipaaCloseButton/hipaaCloseButton.less', "client"); - - api.export('HipaaAuditLog'); -}); - - - -Package.onTest(function (api) { - api.use('tinytest'); - - api.use('meteor-platform'); - api.use('clinical:router@2.0.19', 'client'); - api.use('mrt:moment@2.8.1', 'client'); - api.use('grove:less@0.1.1', 'client'); - - api.use('clinical:verification'); - api.use('clinical:fonts@1.0.0'); - api.use('clinical:hipaa-audit-log'); - api.use('clinical:hipaa-logger@1.0.0'); - - api.addFiles('tests/tinytest/audit-log-tests.js'); -}); diff --git a/Packages/hipaa-audit-log/screenshots/auditlog.png b/Packages/hipaa-audit-log/screenshots/auditlog.png deleted file mode 100644 index bcaf96b90..000000000 Binary files a/Packages/hipaa-audit-log/screenshots/auditlog.png and /dev/null differ diff --git a/Packages/hipaa-audit-log/server/initialize.js b/Packages/hipaa-audit-log/server/initialize.js deleted file mode 100644 index 79efc1691..000000000 --- a/Packages/hipaa-audit-log/server/initialize.js +++ /dev/null @@ -1,26 +0,0 @@ -Meteor.methods({ - initializeDemoLog:function (){ - console.log('initializeDemoLog'); - - // hipaaEvent, userId, userName, collectionName, recordId, patientId, patientName, message - HipaaLogger.logEvent("init", Meteor.userId(), "Ada Lovelace"); - - HipaaLogger.logEvent("create", Meteor.userId(), "Ada Lovelace", "Users", Random.id(), Random.id(), "John Doe"); - - HipaaLogger.logEvent("viewed", Meteor.userId(), "Mary Shelley", "Users", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("viewed", Meteor.userId(), "Florence Nightingale", "Medications", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Medications", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("denied", Meteor.userId(), "Kurt Vonnegut", "MedicationPlans", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("viewed", Meteor.userId(), "Florence Nightingale", "MedicationPlans", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("modify", Meteor.userId(), "Florence Nightingale", "MedicationPlans", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("viewed", Meteor.userId(), "Edward Doisy", "Users", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("clone", Meteor.userId(), "Edward Doisy", "MedicationPlans", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("publish", Meteor.userId(), "Edward Doisy", "MedicationPlans", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("unpublish", Meteor.userId(), "Edward Doisy", "MedicationPlans", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("delete", Meteor.userId(), "Ada Lovelace", "MedicationPlans", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("viewed", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe"); - HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe"); - } -}); diff --git a/Packages/hipaa-audit-log/server/publication.js b/Packages/hipaa-audit-log/server/publication.js deleted file mode 100644 index 0209a75aa..000000000 --- a/Packages/hipaa-audit-log/server/publication.js +++ /dev/null @@ -1,4 +0,0 @@ - -Meteor.publish('HipaaLog', function () { - return HipaaLog.find(); -}); diff --git a/Packages/hipaa-audit-log/tests/gagarin/HipaaAuditLogTests.js b/Packages/hipaa-audit-log/tests/gagarin/HipaaAuditLogTests.js deleted file mode 100644 index 46aa26b79..000000000 --- a/Packages/hipaa-audit-log/tests/gagarin/HipaaAuditLogTests.js +++ /dev/null @@ -1,72 +0,0 @@ - -describe('clinical:hipaa-audit-log', function () { - var server = meteor(); - var client = browser(server); - - // beforeEach(function () { - // server.execute(function () { - // - // }).then(function (value){ - // - // }); - // }); - // afterEach(function () { - // server.execute(function () { - // - // }); - // }); - - it('HipaaLogger should exist on the client', function () { - return client.execute(function () { - expect(HipaaLogger).to.exist; - }); - }); - - it('HipaaLogger should exist on the server', function () { - return server.execute(function () { - expect(HipaaLogger).to.exist; - }); - }); - - - it("HipaaLogger can log events on the client", function () { - return client.execute(function () { - HipaaLogger.logEvent({ - eventType: "modified", - userId: "janedoe", - userName: "Jane Doe", - collectionName: "Medications", - recordId: "123", - patientId: "123", - patientName: "abc" - }); - return HipaaLog.findOne(); - }).then(function (eventRecord){ - server.wait(500, "", function (){ - expect(eventRecord).to.exist; - expect(eventRecord.userId).to.equal("janedoe"); - expect(eventRecord.userName).to.equal("Jane Doe"); - }); - }); - }); - it("HipaaLogger can log events on the server", function () { - return server.execute(function () { - HipaaLogger.logEvent({ - eventType: "modified", - userId: "janedoe", - userName: "Jane Doe", - collectionName: "Medications", - recordId: "123", - patientId: "123", - patientName: "abc" - }); - - var eventRecord = HipaaLog.findOne(); - - expect(eventRecord).to.exist; - expect(eventRecord.userId).to.equal("janedoe"); - expect(eventRecord.userName).to.equal("Jane Doe"); - }); - }); - -}); diff --git a/Packages/hipaa-audit-log/tests/nightwatch/commands/components/hipaaLogEntryContains.js b/Packages/hipaa-audit-log/tests/nightwatch/commands/components/hipaaLogEntryContains.js deleted file mode 100644 index 5e09b2916..000000000 --- a/Packages/hipaa-audit-log/tests/nightwatch/commands/components/hipaaLogEntryContains.js +++ /dev/null @@ -1,20 +0,0 @@ - - - -exports.command = function(rowIndex, hipaaEvent) { - this - .verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ")") - - if(hipaaEvent.type === "create"){ - this - .verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .userName", hipaaEvent.userName) - .verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .recordId", hipaaEvent.recordId) - .verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .collectionName", hipaaEvent.collectionName) - - if(hipaaEvent.patientName){ - this.verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .patientName", hipaaEvent.patientName) - } - } - - return this; -}; diff --git a/Packages/hipaa-audit-log/tests/nightwatch/commands/components/reviewHipaaAuditLogPage.js b/Packages/hipaa-audit-log/tests/nightwatch/commands/components/reviewHipaaAuditLogPage.js deleted file mode 100644 index 3dabb092a..000000000 --- a/Packages/hipaa-audit-log/tests/nightwatch/commands/components/reviewHipaaAuditLogPage.js +++ /dev/null @@ -1,9 +0,0 @@ - - -exports.command = function() { - this - .verify.elementPresent("#hipaaLogPage") - .verify.elementPresent("#hipaaAuditLog") - - return this; -}; diff --git a/Packages/hipaa-audit-log/tests/nightwatch/commands/methods/logHipaaEvent.js b/Packages/hipaa-audit-log/tests/nightwatch/commands/methods/logHipaaEvent.js deleted file mode 100644 index 8e4b44e1b..000000000 --- a/Packages/hipaa-audit-log/tests/nightwatch/commands/methods/logHipaaEvent.js +++ /dev/null @@ -1,41 +0,0 @@ - - - - -// syncrhonous version; doesn't work well -/*exports.command = function(hipaaEvent, timeout) { - var client = this; - this - .execute(function(data){ - return HipaaLogger.logEventObject(data); - }, [hipaaEvent], function(result){ - console.log("result.value", result.value); - client.assert.ok(result.value); - }).pause(1000) - return this; -};*/ - - - - -// async version calls method on the server -exports.command = function(hipaaEvent, timeout) { - var client = this; - if (!timeout) { - timeout = 5000; - } - - this - .timeoutsAsyncScript(timeout) - .executeAsync(function(data, meteorCallback){ - //return HipaaLogger.logEventObject(data); - Meteor.call('logHipaaEvent', data, function(meteorError, meteorResult){ - var response = (meteorError ? { error: meteorError } : { result: meteorResult }); - meteorCallback(response); - }) - }, [hipaaEvent], function(result){ - console.log("result.value", result.value); - client.assert.ok(result.value); - }).pause(1000) - return this; -}; diff --git a/Packages/hipaa-audit-log/tests/tinytest/audit-log-tests.js b/Packages/hipaa-audit-log/tests/tinytest/audit-log-tests.js deleted file mode 100644 index 459385929..000000000 --- a/Packages/hipaa-audit-log/tests/tinytest/audit-log-tests.js +++ /dev/null @@ -1,25 +0,0 @@ -describe('clinical:hipaa-audit-log', function () { - - describe('user interface', function () { - it.client('displays an audit log', function () { - - }); - it.client('has a search button', function () { - - }); - it.client('has filter buttons', function () { - - }); - }); - - describe('server functionality', function () { - it.client('logs hipaa events to a HIPAA collection', function () { - - }); - - it.client('doesnt allow users to delete or modify events', function () { - - }); - - }); -}); diff --git a/Packages/meteor-stale-session/LICENSE b/Packages/meteor-stale-session/LICENSE deleted file mode 100644 index b9554eafd..000000000 --- a/Packages/meteor-stale-session/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Chris Lindley - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Packages/meteor-stale-session/README.md b/Packages/meteor-stale-session/README.md deleted file mode 100644 index 5b98d235d..000000000 --- a/Packages/meteor-stale-session/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# zuuk:stale-session - -Stale session and session timeout handling for [meteorjs](http://www.meteor.com/). - -## Quick Start - -```sh -$ meteor add zuuk:stale-session -``` - -## Key Concepts - -When a user logs in to a meteor application, they may gain access to privileged information and functionality. If they neglect to log off, another user of the same computer can effectively impersonate that user and gains the same rights. As it currently stands, (meteor 0.6.6.3), login tokens remain valid for eternity so this creates a large window of opportunity for impersonators. - -This package is designed to detect a user's inactivity and automatically log them off after a configurable amount of time thereby reducing the size of this window to just the inactivity delay. - -It is possible to configure both the timeout and the events that consitute activity. - -The user will be logged off whether the browser window remains open or not. - -The user is logged off by the server and disabling javascript in the browser (kind of pointless in meteor!) would not prevent automatic log off. - -The user can be logged on multiple times on multiple devices and activity in any one of those devices will keep the sessions alive. - -The plugin uses a heartbeat that is configurable but defaulted to ensure that the server is not inundated with heartbeats from clients in systems with many concurrent users. - -## Configuration - -Configuration is via `Meteor.settings.public`. - -- `staleSessionInactivityTimeout` - the amount of time (in ms) after which, if no activity is noticed, a session will be considered stale - default 30 minutes. -- `staleSessionPurgeInterval` - interval (in ms) at which stale sessions are purged i.e. found and forcibly logged out - default 1 minute. -- `staleSessionHeartbeatInterval` - interval (in ms) at which activity heartbeats are sent up to the server - default every 3 minutes. -- `staleSessionActivityEvents` - the jquery events which are considered indicator of activity e.g. in an on() call - default `mousemove click keydown` - -You can set these variables in `config/settings.json` and then launch Meteor with `meteor --settings config/settings.json`. - -Example `config/settings.json` file: - -```json -{ - "public": { - "staleSessionInactivityTimeout": 1800000, - "staleSessionHeartbeatInterval": 180000, - "staleSessionPurgeInterval": 60000, - "staleSessionActivityEvents": "mousemove click keydown" - } -} -``` - - -## Background - -A meteor project I was working on at [ZUUK](http://www.zuuk.com/), required user sessions to timeout after a period of inactivity. Meteor itself doesn't currently (0.6.6.3) support this out of the box and, though there were several plugins already available on [Atmosphere](https://atmosphere.meteor.com/), none of them worked reliably for me so I was forced to create my own for the project. I owe those other packages a great deal of gratitude as this package is effectively just taking ideas from them and making them work in a simpler more reliable fashion for my project. I'm putting this back into the community in the hope it will help in the same situation. - -## License - -MIT diff --git a/Packages/meteor-stale-session/client.js b/Packages/meteor-stale-session/client.js deleted file mode 100644 index bb16b7f00..000000000 --- a/Packages/meteor-stale-session/client.js +++ /dev/null @@ -1,86 +0,0 @@ -// -// Client side activity detection for the session timeout -// - depends on jquery -// -// Meteor settings: -// - staleSessionHeartbeatInterval: interval (in ms) at which activity heartbeats are sent up to the server -// - staleSessionActivityEvents: the jquery events which are considered indicator of activity e.g. in an on() call. -// -var heartbeatInterval = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionHeartbeatInterval || (3*60*1000); // 3mins -var activityEvents = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionActivityEvents || 'mousemove click keydown'; -var inactivityTimeout = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionInactivityTimeout || (30*60*1000); // 30mins - -var dialogTimeout = Meteor.settings && Meteor.settings.public && Meteor.settings.public.dialogTimeout || (30*1000); // 30secs -var showCountdownDialog = Meteor.settings && Meteor.settings.public && Meteor.settings.public.showCountdownDialog || false; -var countdownHeartbeatInterval = (heartbeatInterval < dialogTimeout)? heartbeatInterval : dialogTimeout; - -var activityDetected = false; -var lastActivityDetectedTime = new Date(); -var dialogIsOpen = false; - -Meteor.startup(function() { - - // - // periodically send a heartbeat if activity has been detected within the interval - // - if (showCountdownDialog) { - Meteor.setInterval(function() { - if (Meteor.userId()) { - if (activityDetected) { - Meteor.call('heartbeat', function(error, heartbeatTime) { - lastActivityDetectedTime = heartbeatTime; - activityDetected = false; - // Event to close dialog - $.event.trigger('TriggerCloseTimeoutCountdownDialog'); - dialogIsOpen = false; - }); - - } else { - var overdueTimestamp = new Date().getTime() - lastActivityDetectedTime; - // Ignore min differences - overdueTimestamp = overdueTimestamp - (overdueTimestamp % 1000); - console.log(overdueTimestamp); - var startTime = inactivityTimeout - dialogTimeout; - var nextIntervalTime = overdueTimestamp + countdownHeartbeatInterval; - if (overdueTimestamp <= inactivityTimeout && nextIntervalTime <= inactivityTimeout && nextIntervalTime >= startTime) { - if (Math.abs(startTime - overdueTimestamp) <= Math.abs(nextIntervalTime - startTime) && !dialogIsOpen) { - // Open dialog - var leftTime = Math.round((inactivityTimeout - overdueTimestamp) / 1000); - $.event.trigger('TriggerOpenTimeoutCountdownDialog', leftTime); - dialogIsOpen = true; - } - - } else { - // Event to close dialog - $.event.trigger('TriggerCloseTimeoutCountdownDialog'); - dialogIsOpen = false; - } - } - - } else { - // Event to close dialog - $.event.trigger('TriggerCloseTimeoutCountdownDialog'); - dialogIsOpen = false; - } - }, countdownHeartbeatInterval); - - } else{ - - Meteor.setInterval(function() { - if (Meteor.userId() && activityDetected) { - Meteor.call('heartbeat'); - activityDetected = false; - } - }, heartbeatInterval); - } - - // - // detect activity and mark it as detected on any of the following events - // - $(document).on(activityEvents, function() { - activityDetected = true; - // Event to close dialog - $.event.trigger('TriggerCloseTimeoutCountdownDialog'); - dialogIsOpen = false; - }); -}); diff --git a/Packages/meteor-stale-session/package.js b/Packages/meteor-stale-session/package.js deleted file mode 100644 index 9138f7db4..000000000 --- a/Packages/meteor-stale-session/package.js +++ /dev/null @@ -1,13 +0,0 @@ -Package.describe({ - name: 'zuuk:stale-session', - summary: 'Stale session and session timeout handling for meteorjs', - git: "https://github.com/lindleycb/meteor-stale-session.git", - version: "1.0.8" -}); - -Package.onUse(function(api) { - api.use('accounts-base@1.0.0', ['client','server']); - api.use('jquery@1.0.0', 'client'); - api.addFiles('client.js', 'client'); - api.addFiles('server.js', 'server'); -}); \ No newline at end of file diff --git a/Packages/meteor-stale-session/server.js b/Packages/meteor-stale-session/server.js deleted file mode 100644 index 5b406f167..000000000 --- a/Packages/meteor-stale-session/server.js +++ /dev/null @@ -1,37 +0,0 @@ -// -// Server side activity detection for the session timeout -// -// Meteor settings: -// - staleSessionInactivityTimeout: the amount of time (in ms) after which, if no activity is noticed, a session will be considered stale -// - staleSessionPurgeInterval: interval (in ms) at which stale sessions are purged i.e. found and forcibly logged out -// -var staleSessionPurgeInterval = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionPurgeInterval || (1*60*1000); // 1min -var inactivityTimeout = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionInactivityTimeout || (30*60*1000); // 30mins - -// -// provide a user activity heartbeat method which stamps the user record with a timestamp of the last -// received activity heartbeat. -// -Meteor.methods({ - heartbeat: function(options) { - if (!this.userId) { return; } - var user = Meteor.users.findOne(this.userId); - if (user) { - var heartbeatTime = new Date(); - Meteor.users.update(user._id, {$set: {heartbeat: heartbeatTime}}); - return heartbeatTime; - } - } -}); - - -// -// periodically purge any stale sessions, removing their login tokens and clearing out the stale heartbeat. -// -Meteor.setInterval(function() { - var now = new Date(), overdueTimestamp = new Date(now-inactivityTimeout); - Meteor.users.update({heartbeat: {$lt: overdueTimestamp}}, - {$set: {'services.resume.loginTokens': []}, - $unset: {heartbeat:1}}, - {multi: true}); -}, staleSessionPurgeInterval); diff --git a/Packages/ohif-commands/client/classes/CommandsManager.js b/Packages/ohif-commands/client/classes/CommandsManager.js deleted file mode 100644 index 884e1e3bc..000000000 --- a/Packages/ohif-commands/client/classes/CommandsManager.js +++ /dev/null @@ -1,113 +0,0 @@ -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -export class CommandsManager { - constructor() { - this.contexts = {}; - - // Enable reactivity by storing the last executed command - this.last = new ReactiveVar(''); - } - - getContext(contextName) { - const context = this.contexts[contextName]; - if (!context) { - return OHIF.log.warn(`No context found with name "${contextName}"`); - } - - return context; - } - - getCurrentContext() { - const contextName = OHIF.context.get(); - if (!contextName) { - return OHIF.log.warn('There is no selected context'); - } - - return this.getContext(contextName); - } - - createContext(contextName) { - if (!contextName) return; - if (this.contexts[contextName]) { - return this.clear(contextName); - } - - this.contexts[contextName] = {}; - } - - set(contextName, definitions, extend=false) { - if (typeof definitions !== 'object') return; - const context = this.getContext(contextName); - if (!context) return; - - if (!extend) { - this.clear(contextName); - } - - Object.keys(definitions).forEach(command => (context[command] = definitions[command])); - } - - register(contextName, command, definition) { - if (typeof definition !== 'object') return; - const context = this.getContext(contextName); - if (!context) return; - - context[command] = definition; - } - - setDisabledFunction(contextName, command, func) { - if (!command || typeof func !== 'function') return; - const context = this.getContext(contextName); - if (!context) return; - const definition = context[command]; - if (!definition) { - return OHIF.log.warn(`Trying to set a disabled function to a command "${command}" that was not yet defined`); - } - - definition.disabled = func; - } - - clear(contextName) { - if (!contextName) return; - this.contexts[contextName] = {}; - } - - getDefinition(command) { - const context = this.getCurrentContext(); - if (!context) return; - return context[command]; - } - - isDisabled(command) { - const definition = this.getDefinition(command); - if (!definition) return false; - const { disabled } = definition; - if (_.isFunction(disabled) && disabled()) return true; - if (!_.isFunction(disabled) && disabled) return true; - return false; - } - - run(command) { - const definition = this.getDefinition(command); - if (!definition) { - return OHIF.log.warn(`Command "${command}" not found in current context`); - } - - const { action, params } = definition; - if (this.isDisabled(command)) return; - if (typeof action !== 'function') { - return OHIF.log.warn(`No action was defined for command "${command}"`); - } else { - const result = action(params); - if (this.last.get() === command) { - this.last.dep.changed(); - } else { - this.last.set(command); - } - - return result; - } - } -} diff --git a/Packages/ohif-commands/main.js b/Packages/ohif-commands/main.js deleted file mode 100644 index e78b61acf..000000000 --- a/Packages/ohif-commands/main.js +++ /dev/null @@ -1,18 +0,0 @@ -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; -import { CommandsManager } from 'meteor/ohif:commands/client/classes/CommandsManager'; - -// Create context namespace using a ReactiveVar -const context = new ReactiveVar(null); - -// Append context namespace to OHIF namespace -OHIF.context = context; - -// Create commands namespace using a CommandsManager class instance -const commands = new CommandsManager(context); - -// Append commands namespace to OHIF namespace -OHIF.commands = commands; - -// Export relevant objects -export { context, commands }; diff --git a/Packages/ohif-commands/package.js b/Packages/ohif-commands/package.js deleted file mode 100644 index 9733a1514..000000000 --- a/Packages/ohif-commands/package.js +++ /dev/null @@ -1,22 +0,0 @@ -Package.describe({ - name: 'ohif:commands', - summary: 'OHIF commands management', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - // Meteor packages - api.use([ - 'ecmascript', - 'reactive-var' - ]); - - // OHIF dependencies - api.use('ohif:core'); - api.use('ohif:log'); - - // Main module definition - api.mainModule('main.js', 'client'); -}); diff --git a/Packages/ohif-core/both/index.js b/Packages/ohif-core/both/index.js deleted file mode 100644 index 416aa3427..000000000 --- a/Packages/ohif-core/both/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import './lib'; -import './utils'; - -import './schema.js'; diff --git a/Packages/ohif-core/both/lib/DICOMWeb/getAttribute.js b/Packages/ohif-core/both/lib/DICOMWeb/getAttribute.js deleted file mode 100644 index 2b04c302e..000000000 --- a/Packages/ohif-core/both/lib/DICOMWeb/getAttribute.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Returns the specified element as a dicom attribute group/element. - * - * @param element - The group/element of the element (e.g. '00280009') - * @param [defaultValue] - The value to return if the element is not present - * @returns {*} - */ -export default function getAttribute(element, defaultValue) { - if (!element) { - return defaultValue; - } - // Value is not present if the attribute has a zero length value - if (!element.Value) { - return defaultValue; - } - // Sanity check to make sure we have at least one entry in the array. - if (!element.Value.length) { - return defaultValue; - } - - return convertToInt(element.Value); -}; - -function convertToInt(input) { - function padFour(input) { - var l = input.length; - - if (l == 0) return '0000'; - if (l == 1) return '000' + input; - if (l == 2) return '00' + input; - if (l == 3) return '0' + input; - - return input; - } - - var output = ''; - for (var i = 0; i < input.length; i++) { - for (var j = 0; j < input[i].length; j++) { - output += padFour(input[i].charCodeAt(j).toString(16)); - } - } - - return parseInt(output, 16); -} diff --git a/Packages/ohif-core/both/lib/DICOMWeb/getAuthorizationHeader.js b/Packages/ohif-core/both/lib/DICOMWeb/getAuthorizationHeader.js deleted file mode 100644 index f9d80d93f..000000000 --- a/Packages/ohif-core/both/lib/DICOMWeb/getAuthorizationHeader.js +++ /dev/null @@ -1,26 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { btoa } from 'isomorphic-base64'; - -/** - * Returns the Authorization header as part of an Object. - * - * @returns {Object} - */ -export default function getAuthorizationHeader() { - const headers = {}; - - // Check for OHIF.user since this can also be run on the server - const accessToken = OHIF.user && OHIF.user.getAccessToken && OHIF.user.getAccessToken(); - const server = OHIF.servers.getCurrentServer(); - - if (server && - server.requestOptions && - server.requestOptions.auth) { - // HTTP Basic Auth (user:password) - headers.Authorization = `Basic ${btoa(server.requestOptions.auth)}`; - } else if (accessToken) { - headers.Authorization = `Bearer ${accessToken}`; - } - - return headers; -} diff --git a/Packages/ohif-core/both/lib/DICOMWeb/getModalities.js b/Packages/ohif-core/both/lib/DICOMWeb/getModalities.js deleted file mode 100644 index 4c00d9378..000000000 --- a/Packages/ohif-core/both/lib/DICOMWeb/getModalities.js +++ /dev/null @@ -1,21 +0,0 @@ -export default function getModalities(modality, modalitiesInStudy) { - var modalities = {}; - if (modality) { - modalities = modality; - } - - if (modalitiesInStudy) { - // Find vr in modalities - if (modalities.vr && modalities.vr === modalitiesInStudy.vr) { - for (var i = 0; i < modalitiesInStudy.Value.length; i++) { - var value = modalitiesInStudy.Value[i]; - if (modalities.Value.indexOf(value) === -1) { - modalities.Value.push(value); - } - } - } else { - modalities = modalitiesInStudy; - } - } - return modalities; -}; diff --git a/Packages/ohif-core/both/lib/DICOMWeb/getName.js b/Packages/ohif-core/both/lib/DICOMWeb/getName.js deleted file mode 100644 index 3256633a6..000000000 --- a/Packages/ohif-core/both/lib/DICOMWeb/getName.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Returns the Alphabetic version of a PN - * - * @param element - The group/element of the element (e.g. '00200013') - * @param [defaultValue] - The default value to return if the element is not found - * @returns {*} - */ -export default function getName(element, defaultValue) { - if (!element) { - return defaultValue; - } - // Value is not present if the attribute has a zero length value - if (!element.Value) { - return defaultValue; - } - // Sanity check to make sure we have at least one entry in the array. - if (!element.Value.length) { - return defaultValue; - } - // Return the Alphabetic component group - if (element.Value[0].Alphabetic) { - return element.Value[0].Alphabetic; - } - // Orthanc does not return PN properly so this is a temporary workaround - return element.Value[0]; -}; diff --git a/Packages/ohif-core/both/lib/DICOMWeb/getNumber.js b/Packages/ohif-core/both/lib/DICOMWeb/getNumber.js deleted file mode 100644 index a8c7ce5d6..000000000 --- a/Packages/ohif-core/both/lib/DICOMWeb/getNumber.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Returns the first string value as a Javascript Number - * @param element - The group/element of the element (e.g. '00200013') - * @param [defaultValue] - The default value to return if the element does not exist - * @returns {*} - */ -export default function getNumber(element, defaultValue) { - if (!element) { - return defaultValue; - } - // Value is not present if the attribute has a zero length value - if (!element.Value) { - return defaultValue; - } - // Sanity check to make sure we have at least one entry in the array. - if (!element.Value.length) { - return defaultValue; - } - - return parseFloat(element.Value[0]); -}; diff --git a/Packages/ohif-core/both/lib/DICOMWeb/getString.js b/Packages/ohif-core/both/lib/DICOMWeb/getString.js deleted file mode 100644 index 07c1823ae..000000000 --- a/Packages/ohif-core/both/lib/DICOMWeb/getString.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Returns the specified element as a string. Multi-valued elements will be separated by a backslash - * - * @param element - The group/element of the element (e.g. '00200013') - * @param [defaultValue] - The value to return if the element is not present - * @returns {*} - */ -export default function getString(element, defaultValue) { - if (!element) { - return defaultValue; - } - // Value is not present if the attribute has a zero length value - if (!element.Value) { - return defaultValue; - } - // Sanity check to make sure we have at least one entry in the array. - if (!element.Value.length) { - return defaultValue; - } - // Join the array together separated by backslash - // NOTE: Orthanc does not correctly split values into an array so the join is a no-op - return element.Value.join('\\'); -}; diff --git a/Packages/ohif-core/both/lib/DICOMWeb/index.js b/Packages/ohif-core/both/lib/DICOMWeb/index.js deleted file mode 100644 index d983a13b3..000000000 --- a/Packages/ohif-core/both/lib/DICOMWeb/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -import getAttribute from './getAttribute.js'; -import getAuthorizationHeader from './getAuthorizationHeader.js'; -import getModalities from './getModalities.js'; -import getName from './getName.js'; -import getNumber from './getNumber.js'; -import getString from './getString.js'; - -const DICOMWeb = { - getAttribute, - getAuthorizationHeader, - getModalities, - getName, - getNumber, - getString, -}; - -OHIF.DICOMWeb = DICOMWeb; diff --git a/Packages/ohif-core/both/lib/index.js b/Packages/ohif-core/both/lib/index.js deleted file mode 100644 index a18eb8996..000000000 --- a/Packages/ohif-core/both/lib/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './object.js'; -import './DICOMWeb/'; diff --git a/Packages/ohif-core/both/lib/object.js b/Packages/ohif-core/both/lib/object.js deleted file mode 100644 index 6ff06f9d7..000000000 --- a/Packages/ohif-core/both/lib/object.js +++ /dev/null @@ -1,52 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.object = {}; - -// Transforms a shallow object with keys separated by "." into a nested object -OHIF.object.getNestedObject = shallowObject => { - const nestedObject = {}; - for (let key in shallowObject) { - if (!shallowObject.hasOwnProperty(key)) continue; - const value = shallowObject[key]; - const propertyArray = key.split('.'); - let currentObject = nestedObject; - while (propertyArray.length) { - const currentProperty = propertyArray.shift(); - if (!propertyArray.length) { - currentObject[currentProperty] = value; - } else { - if (!currentObject[currentProperty]) { - currentObject[currentProperty] = {}; - } - - currentObject = currentObject[currentProperty]; - } - } - } - - return nestedObject; -}; - -// Transforms a nested object into a shallowObject merging its keys with "." character -OHIF.object.getShallowObject = nestedObject => { - const shallowObject = {}; - const putValues = (baseKey, nestedObject, resultObject) => { - for (let key in nestedObject) { - if (!nestedObject.hasOwnProperty(key)) continue; - let currentKey = baseKey ? `${baseKey}.${key}` : key; - const currentValue = nestedObject[key]; - if (typeof currentValue === 'object') { - if (currentValue instanceof Array) { - currentKey += '[]'; - } - - putValues(currentKey, currentValue, resultObject); - } else { - resultObject[currentKey] = currentValue; - } - } - }; - - putValues('', nestedObject, shallowObject); - return shallowObject; -}; diff --git a/Packages/ohif-core/both/schema.js b/Packages/ohif-core/both/schema.js deleted file mode 100644 index ea60afe58..000000000 --- a/Packages/ohif-core/both/schema.js +++ /dev/null @@ -1,34 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -/* - Extend the available options on schema definitions: - - * valuesLabels: Used in conjunction with allowedValues to define the text - label for each value (used on forms) - - * textOptional: Used to allow empty strings - - */ -SimpleSchema.extendOptions({ - valuesLabels: Match.Optional([String]), - textOptional: Match.Optional(Boolean) -}); - -// Add default required validation for empty strings which can be bypassed -// using textOptional=true definition -SimpleSchema.addValidator(function() { - if ( - this.definition.optional !== true && - this.definition.textOptional !== true && - this.value === '' - ) { - return 'required'; - } -}); - -// Including [label] for some messages -SimpleSchema.messages({ - maxCount: '[label] can not have more than [maxCount] values', - minCount: '[label] must have at least [minCount] values', - notAllowed: '[label] has an invalid value: "[value]"' -}); diff --git a/Packages/ohif-core/both/utils/absoluteUrl.js b/Packages/ohif-core/both/utils/absoluteUrl.js deleted file mode 100644 index e2239f7ea..000000000 --- a/Packages/ohif-core/both/utils/absoluteUrl.js +++ /dev/null @@ -1,19 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -// Return an absolute URL with the page domain using sub path of ROOT_URL -// to let multiple domains directed to the same server work -OHIF.utils.absoluteUrl = function(path) { - let absolutePath = '/'; - - const absoluteUrl = Meteor.absoluteUrl(); - const absoluteUrlParts = absoluteUrl.split('/'); - - if (absoluteUrlParts.length > 4) { - const rootUrlPrefixIndex = absoluteUrl.indexOf(absoluteUrlParts[3]); - absolutePath += absoluteUrl.substring(rootUrlPrefixIndex) + path; - } else { - absolutePath += path; - } - - return absolutePath.replace(/\/\/+/g, '/'); -}; diff --git a/Packages/ohif-core/both/utils/index.js b/Packages/ohif-core/both/utils/index.js deleted file mode 100644 index 444f24e49..000000000 --- a/Packages/ohif-core/both/utils/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './absoluteUrl'; -import './objectPath'; diff --git a/Packages/ohif-core/both/utils/objectPath.js b/Packages/ohif-core/both/utils/objectPath.js deleted file mode 100644 index bde1b3994..000000000 --- a/Packages/ohif-core/both/utils/objectPath.js +++ /dev/null @@ -1,116 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -class ObjectPath { - - /** - * Set an object property based on "path" (namespace) supplied creating - * ... intermediary objects if they do not exist. - * @param object {Object} An object where the properties specified on path should be set. - * @param path {String} A string representing the property to be set, e.g. "user.study.series.timepoint". - * @param value {Any} The value of the property that will be set. - * @return {Boolean} Returns "true" on success, "false" if any intermediate component of the supplied path - * ... is not a valid Object, in which case the property cannot be set. No excpetions are thrown. - */ - static set(object, path, value) { - - let components = ObjectPath.getPathComponents(path), - length = components !== null ? components.length : 0, - result = false; - - if (length > 0 && ObjectPath.isValidObject(object)) { - - let i = 0, - last = length - 1, - currentObject = object; - - while (i < last) { - - let field = components[i]; - - if (field in currentObject) { - if (!ObjectPath.isValidObject(currentObject[field])) { - break; - } - } else { - currentObject[field] = {}; - } - - currentObject = currentObject[field]; - i++; - - } - - if (i === last) { - currentObject[components[last]] = value; - result = true; - } - - } - - return result; - - } - - /** - * Get an object property based on "path" (namespace) supplied traversing the object - * ... tree as necessary. - * @param object {Object} An object where the properties specified might exist. - * @param path {String} A string representing the property to be searched for, e.g. "user.study.series.timepoint". - * @return {Any} The value of the property if found. By default, returns the special type "undefined". - */ - static get(object, path) { - - let found, // undefined by default - components = ObjectPath.getPathComponents(path), - length = components !== null ? components.length : 0; - - if (length > 0 && ObjectPath.isValidObject(object)) { - - let i = 0, - last = length - 1, - currentObject = object; - - while (i < last) { - - let field = components[i]; - - const isValid = ObjectPath.isValidObject(currentObject[field]); - if (field in currentObject && isValid) { - currentObject = currentObject[field]; - i++; - } else { - break; - } - - } - - if (i === last && components[last] in currentObject) { - found = currentObject[components[last]]; - } - - } - - return found; - - } - - /** - * Check if the supplied argument is a real JavaScript Object instance. - * @param object {Any} The subject to be tested. - * @return {Boolean} Returns "true" if the object is a real Object instance and "false" otherwise. - */ - static isValidObject(object) { - return ( - typeof object === 'object' && - object !== null && - object instanceof Object - ); - } - - static getPathComponents(path) { - return (typeof path === 'string' ? path.split('.') : null); - } - -} - -OHIF.utils.ObjectPath = ObjectPath; diff --git a/Packages/ohif-core/client/components/base/component.js b/Packages/ohif-core/client/components/base/component.js deleted file mode 100644 index 7a81769d9..000000000 --- a/Packages/ohif-core/client/components/base/component.js +++ /dev/null @@ -1,49 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/* - * Base component to template instances of all dynamic components - */ -class Component { - - // Set up the component - constructor(templateInstance) { - // Store the component in the current view - templateInstance.view._component = this; - - // Create an object to register section's content - templateInstance.sections = {}; - - // Store the template instance in the component - this.templateInstance = templateInstance; - - // Store the component's registered sub-components - this.registeredItems = new Set(); - } - - // Self register the component in its first parent component - registerSelf() { - const parent = OHIF.blaze.getParentComponent(this.templateInstance.view); - if (parent) { - // Store this component's parent in a property - this.parent = parent; - - // Add this component in its parent's registered items list - parent.registeredItems.add(this); - } - } - - // Self unregister the component in its first parent component - unregisterSelf() { - const parent = OHIF.blaze.getParentComponent(this.templateInstance.view); - if (parent) { - // Remove the parent property from this component - delete this.parent; - - // Remove this component from its parent's registered items list - parent.registeredItems.delete(this); - } - } - -} - -OHIF.Component = Component; diff --git a/Packages/ohif-core/client/components/base/index.js b/Packages/ohif-core/client/components/base/index.js deleted file mode 100644 index c494cd8e8..000000000 --- a/Packages/ohif-core/client/components/base/index.js +++ /dev/null @@ -1,39 +0,0 @@ -// Core files -import './component.js'; -import './mixin.js'; -import './template.js'; - -// Section -import './section/section.html'; -import './section/section.js'; - -// Mixins -import './mixins/action.js'; -import './mixins/button.js'; -import './mixins/checkbox.js'; -import './mixins/component.js'; -import './mixins/dropdown.js'; -import './mixins/form.js'; -import './mixins/formItem.js'; -import './mixins/group.js'; -import './mixins/groupRadio.js'; -import './mixins/input.js'; -import './mixins/link.js'; -import './mixins/popover.js'; -import './mixins/schemaData.js'; -import './mixins/select.js'; -import './mixins/select2.js'; - -// Templates -import './templates/button.html'; -import './templates/custom.html'; -import './templates/div.html'; -import './templates/form.html'; -import './templates/input.html'; -import './templates/link.html'; -import './templates/select.html'; -import './templates/tr.html'; - -// wrappers -import './wrappers/label.html'; -import './wrappers/labelContent.html'; diff --git a/Packages/ohif-core/client/components/base/mixin.js b/Packages/ohif-core/client/components/base/mixin.js deleted file mode 100644 index fa4979404..000000000 --- a/Packages/ohif-core/client/components/base/mixin.js +++ /dev/null @@ -1,138 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; - -// Create an object to store all the application mixins -OHIF.mixins = {}; - -// Class to manage new mixins and its dependencies -class Mixin { - - // Create the mixin instance - constructor({ dependencies, composition }) { - // Store the mixin dependencies - this.dependencies = dependencies || ''; - - // Store the mixin composition - this.composition = composition; - } - - // Initialize the mixin applying all its composition functions - init(template, data, applied, behaviors) { - const dependenciesArray = this.dependencies.split(' '); - _.each(dependenciesArray, dependency => { - // Go to next dependency if the current dependency string is blank - if (!dependency) { - return; - } - - // Get the dependent mixin to be initizalized - const mixin = Mixin.getMixin(dependency); - - // Throw an error if a cyclic dependency was found on this mixin - if (mixin === this) { - throw new Error(`Mixin ${dependency} has a cyclic dependency.`); - } - - // Initizalize the mixin dependencies recursively - mixin.init(template, data, applied, behaviors); - }); - - // Apply the mixin's composition behaviors to the template - this.apply(template, data, applied, behaviors); - } - - // Add the mixin's composition behaviors to the template - apply(template, data, applied, behaviors) { - // Ignore if the mixin was already applied to the template - if (_.contains(applied, this)) { - return; - } - - // Store the mixin's composition - const composition = this.composition; - - // Iterate over each behavior - _.each(behaviors, behavior => { - // Execute something only after all the mixins are done - let functionName = behavior; - if (functionName === 'onMixins') { - functionName = 'onRendered'; - } - - if (behavior === 'onData' && composition[behavior]) { - // If it's just data manipulation, call it immediately - composition[behavior](data); - } else if (composition[behavior]) { - // Register the behavior in the template - template[functionName](composition[behavior]); - } - }); - - // Set the current mixin's state as applied - applied.push(this); - } - - // Initialize all data manipulation mixins - static initData(data) { - // Split the mixins by space - const mixinsArray = data.mixins.split(' '); - - // Control and ignore the mixins that have already been applied - const appliedOnData = []; - _.each(mixinsArray, mixinName => { - // Ignore blank strings - if (!mixinName) { - return; - } - - // Get the current mixin - const mixin = Mixin.getMixin(mixinName); - - // Initialize the data manipulation composition - mixin.init(null, data, appliedOnData, ['onData']); - }); - } - - // Initialize all the template's mixins - static initAll(template, data) { - // Split the mixins by space - const mixinsArray = data.mixins.split(' '); - - // Control and ignore the mixins that have already been applied - const appliedCommon = []; - const appliedOnMixins = []; - _.each(mixinsArray, mixinName => { - // Ignore blank strings - if (!mixinName) { - return; - } - - // Get the current mixin - const mixin = Mixin.getMixin(mixinName); - - // Initialize blaze default compositions - mixin.init(template, data, appliedCommon, ['onCreated', 'onRendered', 'onDestroyed', 'events', 'helpers']); - - // Execute some behaviors after all mixins are applied - mixin.init(template, data, appliedOnMixins, ['onMixins']); - }); - } - - // Get a mixin by name - static getMixin(mixinName) { - // Get the mixin from mixins object - const mixin = OHIF.mixins[mixinName]; - - // Throw an error if the mixin does not exists - if (!mixin) { - throw new Error(`Mixin ${mixinName} not found.`); - } - - // Return the found mixin - return mixin; - } - -} - -// Store the Mixin class inside the shared OHIF object -OHIF.Mixin = Mixin; diff --git a/Packages/ohif-core/client/components/base/mixins/action.js b/Packages/ohif-core/client/components/base/mixins/action.js deleted file mode 100644 index b9fc763e4..000000000 --- a/Packages/ohif-core/client/components/base/mixins/action.js +++ /dev/null @@ -1,72 +0,0 @@ -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -/* - * action: controls an element that will trigger some form API's method - */ -OHIF.mixins.action = new OHIF.Mixin({ - dependencies: 'formItem', - composition: { - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Add the form-action identification class - component.$element.addClass('form-action'); - }, - - events: { - 'click .form-action'(event, instance) { - event.preventDefault(); - const component = instance.component; - - // Extract action, disabled state and params - const { action } = instance.data; - const params = instance.data.params ? instance.data.params : event; - - // Set the focus back to the input that triggered the click with Enter key - const $focused = $(':focus'); - const applyFocus = () => { - if ($focused[0] && event.currentTarget !== $focused[0]) { - setTimeout(() => $focused.focus()); - } - }; - - // Stop here if the component is disabled - if (component.$element.hasClass('disabled')) return; - - // Get the current component's API - const api = component.getApi(); - - if (typeof action === 'function') { - // Call the action if it's a function - component.actionResult = action.call(event.currentTarget, params, event); - } else if (!api || !action || typeof api[action] !== 'function') { - // Stop here if no API or action was defined - return true; - } else { - // Call the defined action function - component.actionResult = api[action].call(event.currentTarget, params, event); - } - - // Prepend a spinner into the action element content if it's a promise - if (component.actionResult instanceof Promise) { - const form = component.getForm(); - form.disable(true); - const $spinner = $(''); - component.$element.prepend($spinner); - const finishAction = () => { - $spinner.remove(); - form.disable(false); - applyFocus(); - }; - - component.actionResult.then(finishAction).catch(finishAction); - } else { - applyFocus(); - } - } - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/button.js b/Packages/ohif-core/client/components/base/mixins/button.js deleted file mode 100644 index 690c4ca65..000000000 --- a/Packages/ohif-core/client/components/base/mixins/button.js +++ /dev/null @@ -1,18 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; - -/* - * button: controls a button - */ -OHIF.mixins.button = new OHIF.Mixin({ - dependencies: 'formItem', - composition: { - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Set the element to be controlled - component.$element = instance.$('button').first(); - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/checkbox.js b/Packages/ohif-core/client/components/base/mixins/checkbox.js deleted file mode 100644 index 5c4016b97..000000000 --- a/Packages/ohif-core/client/components/base/mixins/checkbox.js +++ /dev/null @@ -1,26 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; - -/* - * inputCheckbox: controls a checkbox input - */ -OHIF.mixins.checkbox = new OHIF.Mixin({ - dependencies: 'input', - composition: { - onCreated() { - const instance = Template.instance(); - const component = instance.component; - - // Get or set the checked state using jQuery's prop method - component.value = value => { - const isGet = _.isUndefined(value); - if (isGet) { - return component.parseData(component.$element.is(':checked')); - } - - component.$element.prop('checked', value).trigger('change'); - }; - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/component.js b/Packages/ohif-core/client/components/base/mixins/component.js deleted file mode 100644 index 0b9860b70..000000000 --- a/Packages/ohif-core/client/components/base/mixins/component.js +++ /dev/null @@ -1,10 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; - -/* - * component: base component structure - */ -OHIF.mixins.component = new OHIF.Mixin({ - composition: { - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/dropdown.js b/Packages/ohif-core/client/components/base/mixins/dropdown.js deleted file mode 100644 index 2af982551..000000000 --- a/Packages/ohif-core/client/components/base/mixins/dropdown.js +++ /dev/null @@ -1,322 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -/* - * dropdown: controls a dropdown - */ -OHIF.mixins.dropdown = new OHIF.Mixin({ - dependencies: 'form', - composition: { - onRendered() { - const instance = Template.instance(); - const { event, centered, marginTop, $parentLi, reactiveClose } = instance.data.options; - // Get the dropdown element to enable position manipulation - const $dropdown = instance.$('.dropdown'); - const dropdown = $dropdown[0]; - const $dropdownMenu = $dropdown.children('.dropdown-menu'); - - // Get the timeout to dismiss the dropdown form - let { dismissTimeout } = instance.data.options; - if (_.isUndefined(dismissTimeout)) { - dismissTimeout = 500; - } - - // Set a opening state to the component - instance.opening = true; - - // Destroy the Blaze created view (either created with template calls or with renderWithData) - instance.destroyView = () => { - const destroyHandle = () => { - if (typeof instance.data.destroyView === 'function') { - instance.data.destroyView(); - } else { - Blaze.remove(instance.view); - } - }; - - const timeout = setTimeout(destroyHandle, dismissTimeout); - $dropdownMenu.one('transitionend', () => { - destroyHandle(); - clearTimeout(timeout); - }); - $dropdown.removeClass('open'); - }; - - // Destroy the view when the promise is fullfilled - instance.data.promise.then(instance.destroyView, instance.destroyView); - - // Close submenu if exists - instance.closeSubmenu = focusSelf => { - if (instance.reactiveClose) { - if (focusSelf) { - $(instance.lastSubmenu).focus(); - } - - instance.reactiveClose.set(true); - delete instance.reactiveClose; - delete instance.lastSubmenu; - } - }; - - // Close the dropdown resolving or rejecting the promise - instance.close = (isResolve, result) => { - const method = instance.data[isResolve ? 'promiseResolve' : 'promiseReject']; - const param = result instanceof Promise ? null : result; - method(param); - instance.closeSubmenu(false); - instance.closed = true; - }; - - // Close the dropdown if the reactiveClose suffered changes - if (reactiveClose) { - instance.autorun(() => { - const isClosed = reactiveClose.get(); - if (!isClosed) return; - instance.close(false); - }); - } - - // Stop here and destroy the view if no items was given - if (!instance.data.items.length) { - return instance.close(false); - } - - dropdown.oncontextmenu = () => false; - - const cssBefore = {}; - if (event) { - cssBefore.position = 'fixed'; - $dropdownMenu.bounded(); - } - - if (marginTop) { - cssBefore['margin-top'] = marginTop; - } - - $dropdownMenu.css(cssBefore); - - // Postpone visibility change to allow CSS transitions - Meteor.defer(() => { - // Show the dropdown and focus the first option - $dropdown.addClass('open').find('a:first').focus(); - - // Add a handler to change the opening state - $dropdownMenu.one('transitionend', event => { - instance.opening = false; - }); - - // Change the dropdown position if mouse event was given - if (event) { - const originalEventTouches = event.originalEvent && event.originalEvent.touches; - const position = { - left: 0, - top: 0 - }; - - if (originalEventTouches && originalEventTouches.length > 0) { - position.left = originalEventTouches[0].pageX; - position.top = originalEventTouches[0].pageY; - } else { - position.left = event.clientX; - position.top = event.clientY; - } - - if (centered) { - // Center the dropdown menu based on the event mouse position - position.left -= $dropdownMenu.outerWidth() / 2; - position.top -= $dropdownMenu.outerHeight() / 2; - } else if ($parentLi) { - // Change the dropdown menu position based on the parent menu item - const $parentDm = $parentLi.closest('.dropdown-menu'); - const dmWidth = $dropdownMenu.outerWidth(); - const pdmWidth = $parentDm.outerWidth(); - const pdmOffset = $parentDm.offset(); - const pliOffset = OHIF.ui.getOffset($parentLi[0]); - Object.assign(position, { - left: pdmWidth + pdmOffset.left, - top: pliOffset.top - }); - - // Check if the element position is going beyond the window right boundary - let rightToLeft = false; - if (position.left < pdmOffset.left + pdmWidth || position.left > document.body.clientWidth - dmWidth) { - position.left -= pdmWidth + $dropdownMenu.outerWidth(); - rightToLeft = true; - } - - const menuClass = rightToLeft ? 'origin-top-right' : 'origin-top-left'; - $dropdownMenu.addClass(menuClass); - } - - // Fix dropdown position if it is going outside the window boundaries - $dropdownMenu.css(position).trigger('spatialChanged'); - - // Check if scrolling will be needed - const isFixed = $dropdownMenu.css('position') === 'fixed'; - if (isFixed && $dropdownMenu.outerHeight() > window.innerHeight) { - $dropdownMenu.css({ - 'overflow-y': 'scroll', - 'max-height': window.innerHeight - }); - } - } - }); - }, - - events: { - 'click .form-action'(event, instance) { - const $target = $(event.currentTarget); - const isDisabled = $target.hasClass('disabled'); - - if (isDisabled) { - instance.close(false); - } else { - const component = $target.data('component'); - instance.close(true, component.actionResult); - } - }, - - 'mouseenter .form-action, openSubmenu .form-action'(event, instance) { - // Postpone the submenu opening if it's still being animated - if (instance.opening) { - instance.$('.dropdown-menu').one('transitionend', event => { - $(event.currentTarget).trigger('openSubmenu'); - }); - - return; - } - - // Stop here if dropdown is already closed or event was triggered in child elements - if (instance.closed || event.target !== event.currentTarget) return; - - // Close the submenu if a sibling element was hovered - if (instance.lastSubmenu && instance.lastSubmenu !== event.currentTarget) { - instance.closeSubmenu(!this.items); - } - - // Stop here if submenu is already opened for the current menu item - if (!this.items || instance.lastSubmenu === event.currentTarget) return; - - // Close the current opened submenu (if exists) in order to open another one - instance.closeSubmenu(!this.items); - - // Set the reactive closing elementcontroller and the last submenu element trigger - const reactiveClose = new ReactiveVar(false); - instance.reactiveClose = reactiveClose; - instance.lastSubmenu = event.currentTarget; - - // Get the triggering li element and render the submenu - const $parentLi = $(event.currentTarget).closest('li'); - OHIF.ui.showDropdown(this.items, { - event, - reactiveClose: instance.reactiveClose, - $parentLi, - parentInstance: instance, - dismissTimeout: instance.data.options && instance.data.options.dismissTimeout - }).then(instance.data.promiseResolve).catch(() => {}); - }, - - 'keydown .form-action'(event, instance) { - event.stopPropagation(); - const key = event.which; - const $target = $(event.currentTarget); - - // Allow navigation using DOWN and UP arrow keys - if (key === 38 || key === 40) { - const $parentLi = $target.closest('li'); - const $liList = $parentLi.parent().children(); - const index = $parentLi.index(); - - let $newLi; - if (key === 38) { - // Control the UP key - if (index === 0) { - $newLi = $liList.eq($liList.length - 1); - } else { - $newLi = $parentLi.prev(); - } - } else { - // Control the DOWN key - if (index === $liList.length - 1) { - $newLi = $liList.eq(0); - } else { - $newLi = $parentLi.next(); - } - } - - // Focus the link inside the new li element - event.preventDefault(); - $newLi.find('a:first').focus(); - return; - } - - // Close the submenu if LEFT, BACKSPACE or ESC key was pressed - const { parentInstance } = instance.data.options; - if (parentInstance && (key === 37 || key === 8 || key === 27)) { - event.preventDefault(); - return parentInstance.closeSubmenu(true); - } - - // Close the dropdown if there's no submenu open and ESC key was pressed - if (!parentInstance && key === 27) { - return instance.close(false); - } - - // Stop here if it's not a submenu trigger - if (!this.items) return; - - // Open the submenu if RIGHT, ENTER or SPACE key was pressed - if (key === 39 || key === 13 || key === 32) { - $target.trigger('openSubmenu'); - event.preventDefault(); - } - }, - - 'mousedown .dropdown'(event) { - // This is required to stop blur event which is fired before click event - // when a dropdown item is clicked, otherwise click event is not fired - event.stopPropagation(); - }, - - 'blur .dropdown'(event, instance) { - // Stop here if it's closed or if it's a submenu not being closed - if (instance.closed) return; - if (instance.reactiveClose && !instance.reactiveClose.get()) return; - - // Postpone the execution to enable getting the focused element - Meteor.defer(() => { - const $focus = $(':focus'); - - // Iterate over all parent dropdowns and check if one of them has the focus - let hasFocus = false; - let currentInstance = instance; - do { - if ($.contains(currentInstance.$('.dropdown')[0], $focus[0])) { - hasFocus = true; - break; - } - - if (!currentInstance.data.options.parentInstance) { - break; - } else { - currentInstance = currentInstance.data.options.parentInstance; - - // Close the current instance's submenu as it has no focus - currentInstance.closeSubmenu(false); - } - } while (currentInstance); - - // Close all dropdown levels if it lost the focus - if (!hasFocus) { - currentInstance.close(false); - } - }); - } - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/form.js b/Packages/ohif-core/client/components/base/mixins/form.js deleted file mode 100644 index c0e541f42..000000000 --- a/Packages/ohif-core/client/components/base/mixins/form.js +++ /dev/null @@ -1,108 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; -import { Tracker } from 'meteor/tracker'; -import { Spacebars } from 'meteor/spacebars'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; - -/* - * form: controls a form and its registered inputs - */ -OHIF.mixins.form = new OHIF.Mixin({ - dependencies: 'group', - composition: { - onCreated() { - const instance = Template.instance(); - const component = instance.component; - - // Set the form identifier flag - component.isForm = true; - - // Set the form validated flag - component.isValidatedAlready = false; - - component.validationObserver = new Tracker.Dependency(); - - // Reset the pathKey - instance.data.pathKey = ''; - - // Debound the observer call to prevent tons of re-rendering - component.validationRan = _.throttle(() => { - // Enable reactivity by changing a Tracker.Dependency observer - component.validationObserver.changed(); - }, 200); - - // Change the validation function to focus the fields with error - const validateSelf = component.validate; - component.validate = () => { - // Call the original validation function - const validationResult = validateSelf(); - - // Change the form validated flag to true - component.isValidatedAlready = true; - - // Focus the first error field if some validation failed - if (component.schema && component.schema._invalidKeys.length) { - Tracker.afterFlush(() => instance.$('.state-error :input:first').focus()); - } - - return validationResult; - }; - }, - - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Set the component main and style elements - component.$style = component.$element = instance.$('form').first(); - - // Block page redirecting on submit - component.$element[0].onsubmit = () => false; - }, - - events: { - 'click .validation-error-container a'(event, instance) { - // Get the target key - const targetKey = $(event.currentTarget).attr('data-target'); - - // Focus the first input inside the element with error state - instance.$(`.state-error[data-key="${targetKey}"]`).find(':input:first').focus(); - } - }, - - helpers: { - validationErrors() { - const instance = Template.instance(); - const component = instance.component; - - // Create a dependency on child components validation - component.validationObserver.depend(); - - // Stop here if no schema was defined for the form - if (!component.schema) { - return; - } - - // Check if there were some validation errors - if (component.schema._invalidKeys.length) { - const result = []; - - // Iterate over each validation error and add to result - component.schema._invalidKeys.forEach(item => { - const label = component.schema._schema[item.name].label; - let message = component.schema.keyErrorMessage(item.name); - message = message.replace(label, `${label}`); - result.push({ - key: item.name, - message: Spacebars.SafeString(message) - }); - }); - - // Return the resulting validation errors - return result; - } - } - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/formItem.js b/Packages/ohif-core/client/components/base/mixins/formItem.js deleted file mode 100644 index 1b54b3079..000000000 --- a/Packages/ohif-core/client/components/base/mixins/formItem.js +++ /dev/null @@ -1,337 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; -import { Tracker } from 'meteor/tracker'; -import { Meteor } from 'meteor/meteor'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; - -/* - * formItem: create a generic controller for form items - * It may be used to manage all components that belong to forms - */ -OHIF.mixins.formItem = new OHIF.Mixin({ - dependencies: 'schemaData', - composition: { - - onCreated() { - const instance = Template.instance(); - const component = instance.component; - - // Create a observer to monitor changed values - component.changeObserver = new Tracker.Dependency(); - - // Register the component in the parent component - component.registerSelf(); - - // Declare the component elements that will be manipulated - component.$element = $(); - component.$style = $(); - component.$wrapper = $(); - - // Get or set the component's value using jQuery's val method - component.value = value => { - const isGet = _.isUndefined(value); - if (isGet) { - return component.parseData(component.$element.val()); - } - - // Deferring the `change` event because it was being triggered before - // formItem.onMixins execution when a defaultValue was specified. In - // this case $elem.data('component') code from the event handler was - // returning `undefined` and breaking the app - Meteor.defer(() => { - component.$element.val(value).trigger('change'); - }); - }; - - // Disable or enable the component - component.disable = isDisable => { - component.$element.prop('disabled', !!isDisable); - }; - - // Set or unset component's readonly property - component.readonly = isReadonly => { - component.$element.prop('readonly', !!isReadonly); - }; - - // Show or hide the component - component.show = isShow => { - const method = isShow ? 'show' : 'hide'; - component.$wrapper[method](); - }; - - // Check if the focus is inside this element - component.hasFocus = () => { - // Get the focused element - const focused = $(':focus')[0]; - - // Check if the focused element is inside the component - const contains = $.contains(component.$wrapper[0], focused); - const isEqual = component.$wrapper[0] === focused; - - // Return true if he component has the focus - return contains || isEqual; - }; - - // Add or remove a state from the component - component.state = (state, flag) => { - component.$wrapper.toggleClass(`state-${state}`, !!flag); - }; - - // Set the component in error state and display the error message - component.error = errorMessage => { - // Set the component error state - component.state('error', !!errorMessage); - - // Set or remove the error message - if (errorMessage) { - component.$wrapper.attr('data-error', errorMessage); - } else { - component.$wrapper.removeAttr('data-error', errorMessage); - } - }; - - // Toggle the tooltip over the component - component.toggleTooltip = (isShow, message) => { - if (isShow && message) { - const tooltipId = component.$wrapper.attr('aria-describedby'); - const $tooltip = $(document.getElementById(tooltipId)); - if ($tooltip.length) { - // Change the message if the tooltip is already created - $tooltip.find('.tooltip-inner').text(message); - } else { - // Destroy the tooltip if already created, creating it again - component.$wrapper.tooltip('destroy').tooltip({ - trigger: 'manual', - title: message - }).tooltip('show'); - } - } else { - // Destroy the tooltip - component.$wrapper.tooltip('destroy'); - } - }; - - // Toggle a state message as a tooltip over the component - component.toggleMessage = isShow => { - // Check if the action is to hide - if (!isShow) { - Meteor.setTimeout(() => { - // Check if the component has the focus - if (component.hasFocus()) { - // Prevent the tooltip from being hidden - return; - } - - // Hide the tooltip - component.toggleTooltip(false); - }, 100); - return; - } - - // Check for error state and message - const errorMessage = component.$wrapper.attr('data-error'); - if (errorMessage) { - // Show the tooltip with the error message - component.toggleTooltip(true, errorMessage); - } - }; - - // Search for the parent form component - component.getForm = () => { - let currentComponent = component; - while (currentComponent) { - currentComponent = currentComponent.parent; - if (currentComponent && currentComponent.isForm) { - return currentComponent; - } - } - }; - - // Get the current component API - component.getApi = () => { - const api = instance.data.api; - - // Check if the API was not given - if (!api) { - // Stop here if the component is form and API was not given - if (component.isForm) { - return; - } - - // Get the current component's form - const form = component.getForm(); - - // Stop here if the component has no form - if (!form) { - return; - } - - return form.getApi(); - } - - // Return the given API - return api; - }; - - // Check if the component value is valid in its form's schema - component.validate = () => { - // Get the component's form - const form = component.getForm(); - - // Get the form's data schema - const schema = form && form.schema; - - // Get the current component's key - const key = instance.data.pathKey; - - // Return true if validation is not needed - if (!key || !schema || !component.$wrapper.is(':visible')) { - return true; - } - - // Create the data document for validation - const document = OHIF.object.getNestedObject({ - [key]: component.value() - }); - - // Get the validation result - const validationResult = schema.validateOne(document, key); - - // Notify the form that the validation ran - form.validationRan(); - - // Check if the document validation failed - if (!validationResult) { - // Set the component in error state and display the message - component.error(schema.keyErrorMessage(key)); - - // Return false for validation - return false; - } - - // Remove the component error state and message - component.error(false); - - // Return true for validation - return true; - }; - - component.depend = () => { - return component.changeObserver.depend(); - }; - - // Click the first submit (or first button if submit not found) button on closest form - component.triggerFormMainButton = () => { - const $form = component.$element.closest('form'); - let $formButton = $form.find('button[type=submit]:first'); - if (!$formButton.length) { - $formButton = $form.find('button:first'); - } - - $formButton.click(); - }; - - }, - - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Set the element to be controlled - component.$element = instance.$(':input').first(); - - // Set the most outer wrapper element - component.$wrapper = instance.wrapper.$('*').first(); - - // Add the pathKey to the wrapper element - component.$wrapper.attr('data-key', instance.data.pathKey); - - // Get the component's form - const form = component.getForm(); - - // Observer for changes and revalidate the component - instance.autorun(computation => { - component.changeObserver.depend(); - - // Stop here if it is the first run - if (computation.firstRun) return; - - // Revalidate the component if form is already validated - if (form && form.isValidatedAlready) { - component.validate(); - } - }); - }, - - onDestroyed() { - const instance = Template.instance(); - const component = instance.component; - - // Get the component's form for further use - const form = component.getForm(); - - // Unregister the component in the parent component - component.unregisterSelf(); - - // Remove the component tooltip, error state and message - component.error(false); - component.toggleTooltip(false); - - // Revalidate the form to remove this component from validation results - if (form && form.isValidatedAlready) { - form.validate(); - } - }, - - onMixins() { - const instance = Template.instance(); - const component = instance.component; - - // If no style element was defined, set it as the element itself - if (!component.$style.length) { - component.$style = component.$element; - } - - // Set the component in element and wrapper jQuery data - component.$element.data('component', component); - component.$wrapper.data('component', component); - }, - - events: { - - // Handle the change event for the component - change(event, instance) { - const component = instance.component; - - // Prevent execution on upper components - if (event.currentTarget === component.$element[0]) { - // Enable reactivity by changing a Tracker.Dependency observer - component.changeObserver.changed(); - } - }, - - focus(event, instance) { - const component = instance.component; - const isGroupOrCustomFocus = component.isGroup || component.isCustomFocus; - const isSameTarget = event.target === event.currentTarget; - if (!isGroupOrCustomFocus && isSameTarget) { - // Check for state messages and show it - component.toggleMessage(true); - } - }, - - blur(event, instance) { - const component = instance.component; - const isGroupOrCustomFocus = component.isGroup || component.isCustomFocus; - const isSameTarget = event.target === event.currentTarget; - if (!isGroupOrCustomFocus && isSameTarget) { - // Check for state messages and show it - component.toggleMessage(false); - } - } - - } - - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/group.js b/Packages/ohif-core/client/components/base/mixins/group.js deleted file mode 100644 index e9b725c96..000000000 --- a/Packages/ohif-core/client/components/base/mixins/group.js +++ /dev/null @@ -1,169 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; - -/* - * group: controls a group and its registered items - */ -OHIF.mixins.group = new OHIF.Mixin({ - dependencies: 'formItem', - composition: { - onCreated() { - const instance = Template.instance(); - const component = instance.component; - - // Set the group identifier flag - component.isGroup = true; - - // Run this computation every time the schema property is changed - instance.autorun(() => { - let schema = instance.data.schema; - - // Check if the schema is reactive - if (schema instanceof ReactiveVar) { - // Register a dependency on schema property - schema = schema.get(); - } - - // Set the form's data schema - component.schema = schema && schema.newContext(); - }); - - // Get or set the child components values - component.value = value => { - const isGet = _.isUndefined(value); - const isArray = instance.data.arrayValues; - - // Create the result data as array or object - const result = isArray ? [] : {}; - - // Get the group current value and return it - if (isGet) { - // Iterate over each registered item and extract its value - component.registeredItems.forEach(child => { - // Check if it is an array or an object group - if (isArray) { - // Get the mixins array - const mixins = child.templateInstance.data.mixins.split(' '); - - // Prevent reading action components - if (mixins.indexOf('action') > -1) return; - - // Push the item value to the result array - result.push(child.value()); - } else { - // Get the item key - const key = child.templateInstance.data.key; - - //Check if a key is set for the item - if (key) { - // Add the item value to the result object - result[key] = child.value(); - } - } - }); - - // Return the resulting data as array or object - return result; - } - - // Get the group current value - const groupValue = typeof value === 'object' ? value : result; - - // Stop here if there is no value defined for this group - if (!groupValue) { - return; - } - - // Iterate over each registered item and set its value - let i = 0; - component.registeredItems.forEach(child => { - const mixins = child.templateInstance.data.mixins.split(' '); - - // Prevent reading action components - if (isArray && mixins.indexOf('action') > -1) return; - - const key = isArray ? i : child.templateInstance.data.key; - const childValue = _.isUndefined(groupValue[key]) ? null : groupValue[key]; - child.value(childValue); - i++; - }); - - // Trigger the change event after setting the new value - component.$element.trigger('change'); - }; - - // Get a registered item in form by its key - component.item = itemKey => { - let found; - - // Iterate over each registered form item - component.registeredItems.forEach(child => { - const key = child.templateInstance.data.key; - - // Change the found item if current key is the same as given - if (key === itemKey) { - found = child; - } - }); - - // Return the found item or undefined if it was not found - return found; - }; - - // Check if the form data is valid in its schema - const validateSelf = component.validate; - component.validate = () => { - // Assume validation result as true - let result = true; - - // Return true if there's no data schema defined - if (component.isForm && !component.schema) { - return result; - } - - // Reset the validation - const schema = component.isForm ? component.schema : component.getForm().schema; - schema.resetValidation(); - - // Validate the component itself if it has a key - if (instance.data.pathKey && !validateSelf()) { - result = false; - } - - // Iterate over each registered form item and validate it - component.registeredItems.forEach(child => { - const key = child.templateInstance.data.key; - - // Change result to false if any form item is invalid - if ((key || instance.data.arrayValues) && !child.validate()) { - result = false; - } - }); - - // Return the validation result - return result; - }; - - // Disable or enable the component - component.disable = isDisable => { - component.registeredItems.forEach(child => child.disable(isDisable)); - }; - - // Set or unset component's readonly property - component.readonly = isReadonly => { - component.registeredItems.forEach(child => child.readonly(isReadonly)); - }; - - }, - - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Set the element to be controlled - component.$element = instance.$('.component-group').first(); - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/groupRadio.js b/Packages/ohif-core/client/components/base/mixins/groupRadio.js deleted file mode 100644 index c366d75ce..000000000 --- a/Packages/ohif-core/client/components/base/mixins/groupRadio.js +++ /dev/null @@ -1,32 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; - -/* - * groupRadio: controls all the radio inputs inside the group - */ -OHIF.mixins.groupRadio = new OHIF.Mixin({ - dependencies: 'group', - composition: { - - onCreated() { - const instance = Template.instance(); - const component = instance.component; - - // Get the selected radio's value or select a radio based on value - component.value = value => { - const isGet = _.isUndefined(value); - const elements = []; - component.registeredItems.forEach(child => elements.push(child.$element[0])); - const $elements = $(elements); - if (isGet) { - return component.parseData($elements.filter(':checked').val()); - } - - $elements.filter(`[value='${value}']`).prop('checked', true).trigger('change'); - }; - } - - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/input.js b/Packages/ohif-core/client/components/base/mixins/input.js deleted file mode 100644 index cc4d41aba..000000000 --- a/Packages/ohif-core/client/components/base/mixins/input.js +++ /dev/null @@ -1,18 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; - -/* - * input: controls a basic input - */ -OHIF.mixins.input = new OHIF.Mixin({ - dependencies: 'formItem', - composition: { - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Set the element to be controlled - component.$element = instance.$('input').first(); - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/link.js b/Packages/ohif-core/client/components/base/mixins/link.js deleted file mode 100644 index f9e34c69e..000000000 --- a/Packages/ohif-core/client/components/base/mixins/link.js +++ /dev/null @@ -1,26 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -/* - * link: controls a link - */ -OHIF.mixins.link = new OHIF.Mixin({ - dependencies: 'formItem', - composition: { - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Set the element to be controlled - component.$element = instance.$('a').first(); - }, - - events: { - 'click a'(event, instance) { - if (instance.data.action) { - event.preventDefault(); - } - } - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/popover.js b/Packages/ohif-core/client/components/base/mixins/popover.js deleted file mode 100644 index 7c9f729d1..000000000 --- a/Packages/ohif-core/client/components/base/mixins/popover.js +++ /dev/null @@ -1,40 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -/* - * popover: controls a popover - */ -OHIF.mixins.popover = new OHIF.Mixin({ - dependencies: 'form', - composition: { - onRendered() { - const instance = Template.instance(); - instance.$form = instance.$('form').first(); - instance.$form.find(':input:first').focus(); - }, - - events: { - 'blur form'(event, instance) { - Meteor.defer(() => { - const $focus = $(':focus'); - if (!$.contains(instance.$form[0], $focus[0])) { - instance.data.promiseReject(); - } - }); - }, - - 'click .btn-cancel'(event, instance) { - event.stopPropagation(); - instance.data.promiseReject(); - }, - - 'click .btn-confirm'(event, instance) { - event.stopPropagation(); - const form = instance.$('form').data('component'); - instance.data.promiseResolve(form.value()); - } - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/schemaData.js b/Packages/ohif-core/client/components/base/mixins/schemaData.js deleted file mode 100644 index 005e0f66f..000000000 --- a/Packages/ohif-core/client/components/base/mixins/schemaData.js +++ /dev/null @@ -1,189 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Blaze } from 'meteor/blaze'; -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; - -// Helper function to get the component's current schema -const getCurrentSchemaDefs = (parentComponent, key) => { - // Get the parent component schema - let schema = parentComponent && parentComponent.schema; - let schemaComponentHolder = parentComponent; - - // Try to get the form schema if it was not found - if (parentComponent && !schema) { - const form = parentComponent.getForm(); - schema = form && form.schema; - schemaComponentHolder = form; - } - - // Stop here if there's no key or schema defined - if (!key || !schema) { - return { schemaComponentHolder }; - } - - // Get the current schema data using component's key - const currentSchema = _.clone(schema._schema[key]); - - // Stop here if no schema was found for the given key - if (!currentSchema) { - return { schemaComponentHolder }; - } - - // Merge the sub-schema properties if it's an array - if (Array.isArray(currentSchema.type())) { - _.extend(currentSchema, schema._schema[key + '.$']); - } - - // Return the component's schema definitions - return { - currentSchema, - schemaComponentHolder - }; -}; - -/* - * schemaData: change the component data based on its form's schema data - */ -OHIF.mixins.schemaData = new OHIF.Mixin({ - dependencies: 'component', - composition: { - - onData() { - // Get the current template data - const data = Template.currentData(); - - // Get the parent component - const parent = OHIF.blaze.getParentComponent(Blaze.currentView); - - // Get he parent component key - const parentKey = parent && parent.templateInstance.data.pathKey; - - // Check if the parent is an array group - const isParentArray = parent && parent.templateInstance.data.arrayValues; - - // Set the path key for this component - data.pathKey = data.key || (isParentArray ? '$' : ''); - if (data.pathKey && typeof parentKey === 'string') { - const prefix = parentKey ? `${parentKey}.` : ''; - data.pathKey = `${prefix}${data.pathKey}`; - } - - // Get the current schema data using component's key - const { currentSchema } = getCurrentSchemaDefs(parent, data.pathKey); - - // Stop here if there's no schema data for current key - if (!currentSchema) { - return; - } - - // Use schema's label if it was not defined - if (!data.label) { - data.label = new ReactiveVar(currentSchema.label); - } - - // Set the min value - if (_.isUndefined(data.min) && currentSchema.min) { - data.min = currentSchema.min; - } - - // Set the max value - if (_.isUndefined(data.max) && currentSchema.max) { - data.max = currentSchema.max; - } - - // Set the emptyOption data attribute if given on schema - if (currentSchema.emptyOption) { - data.emptyOption = currentSchema.emptyOption; - } - - // Fill the items if it's an array schema - if (!data.items && Array.isArray(currentSchema.allowedValues)) { - data.items = data.items instanceof ReactiveVar ? data.items : new ReactiveVar(); - - Tracker.autorun(() => { - const schemaDefs = getCurrentSchemaDefs(parent, data.pathKey); - - // Check if schema is reactive and add reactivity to this function if so - const componentHolder = schemaDefs.schemaComponentHolder; - if (componentHolder.templateInstance.data.schema instanceof ReactiveVar) { - componentHolder.templateInstance.data.schema.dep.depend(); - } - - // Get the values and labels arrays from schema - const values = schemaDefs.currentSchema.allowedValues; - const labels = schemaDefs.currentSchema.valuesLabels || []; - - // Initialize the items array - const items = []; - - // Iterate the allowed values array - for (let i = 0; i < values.length; i++) { - // Push the current item to the items array - items.push({ - value: values[i], - label: labels[i] || values[i] - }); - } - - // Add the items to a reactive instance - data.items.set(items); - }); - } - }, - - onCreated() { - const instance = Template.instance(); - const component = instance.component; - - // Create a data parser according to current schema key - component.parseData = value => { - // Get the current schema data using component's key - const { currentSchema } = getCurrentSchemaDefs(component.parent, instance.data.pathKey); - const { dataType } = instance.data; - - // Stop here if there's no schema data for current key or no dataType defined - if (!currentSchema && !dataType) { - return value; - } - - // Get the schema type - const schemaType = currentSchema && currentSchema.type; - - // Check if the type is Number - if (schemaType === Number || dataType === 'Number') { - return parseFloat(value); - } - - // Check if the type is Boolean - if (schemaType === Boolean || dataType === 'Boolean') { - return !!value; - } - - // Return the original value if none of the checks matched - return value; - }; - }, - - onMixins() { - const instance = Template.instance(); - const component = instance.component; - - // Get the current schema data using component's key - const { currentSchema } = getCurrentSchemaDefs(component.parent, instance.data.pathKey); - - // Stop here if there's no schema data for current key - if (!currentSchema) { - return; - } - - // Fill the component with its default value after rendering - if (!_.isUndefined(currentSchema.defaultValue)) { - component.defaultValue = currentSchema.defaultValue; - component.value(currentSchema.defaultValue); - } - } - - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/select.js b/Packages/ohif-core/client/components/base/mixins/select.js deleted file mode 100644 index ea5383faf..000000000 --- a/Packages/ohif-core/client/components/base/mixins/select.js +++ /dev/null @@ -1,18 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; - -/* - * input: controls a basic select - */ -OHIF.mixins.select = new OHIF.Mixin({ - dependencies: 'formItem', - composition: { - onRendered() { - const instance = Template.instance(); - const component = instance.component; - - // Set the element to be controlled - component.$element = instance.$('select').first(); - } - } -}); diff --git a/Packages/ohif-core/client/components/base/mixins/select2.js b/Packages/ohif-core/client/components/base/mixins/select2.js deleted file mode 100644 index 465a71842..000000000 --- a/Packages/ohif-core/client/components/base/mixins/select2.js +++ /dev/null @@ -1,229 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -/* - * input: controls a select2 component - */ -OHIF.mixins.select2 = new OHIF.Mixin({ - dependencies: 'select', - composition: { - onCreated() { - const instance = Template.instance(); - const { component, data } = instance; - - // Controls select2 initialization - instance.isInitialized = false; - - // Set the custom focus flag - component.isCustomFocus = true; - - const valueMethod = component.value; - component.value = value => { - if (_.isUndefined(value) && !instance.isInitialized) { - if (!_.isUndefined(instance.data.value)) return instance.data.value; - if (!_.isUndefined(component.defaultValue)) return component.defaultValue; - return; - } - - return valueMethod(value); - }; - - // Utility function to get the dropdown jQuery element - instance.getDropdownContainerElement = () => { - const $select2 = component.$element.nextAll('.select2:first'); - const containerId = $select2.find('.select2-selection').attr('aria-owns'); - return $(`#${containerId}`).closest('.select2-container'); - }; - - // Check if this select will include a placeholder - const placeholder = data.options && data.options.placeholder; - if (placeholder) { - instance.autorun(() => { - // Get the option items - let items = data.items; - - // Check if the items are reactive and get them if true - const isReactive = items instanceof ReactiveVar; - if (isReactive) { - items = items.get(); - } - - // Check if there is already an empty option on items list - // Note: If this is a multi-select input. Do not add a placeholder - const isMultiple = instance.data.options && instance.data.options.multiple; - if (!_.findWhere(items, { value: '' }) && isMultiple === false) { - // Clone the current items - const newItems = _.clone(items) || []; - newItems.unshift({ - label: placeholder, - value: '' - }); - - // Set the new items list including the empty option - if (isReactive) { - data.items.set(newItems); - } else { - data.items = newItems; - } - } - }); - } - }, - - onRendered() { - const instance = Template.instance(); - const { component, data } = instance; - - // Destroy and re-create the select2 instance - instance.rebuildSelect2 = () => { - // Destroy the select2 instance if exists and re-create it - if (component.select2Instance) { - component.select2Instance.destroy(); - } - - // Clone the options and check if the select2 should be initialized inside a modal - const options = _.clone(data.options); - const $closestModal = component.$element.closest('.modal'); - if ($closestModal.length) { - options.dropdownParent = $closestModal; - } - - // Apply the select2 to the component - component.$element.select2(options); - - // Store the select2 instance to allow its further destruction - component.select2Instance = component.$element.data('select2'); - - // Get the focusable elements - const elements = []; - const $select2 = component.$element.nextAll('.select2:first'); - const $select2Selection = $select2.find('.select2-selection'); - elements.push(component.$element[0]); - elements.push($select2Selection[0]); - - // Attach focus and blur handlers to focusable elements - $(elements).on('focus', event => { - instance.isFocused = true; - if (event.target === event.currentTarget) { - // Show the state message on elements focus - component.toggleMessage(true); - } - }).on('blur', event => { - instance.isFocused = false; - if (event.target === event.currentTarget) { - // Hide the state message on elements blur - component.toggleMessage(false); - } - }); - - // Redirect keydown events from input to the select2 selection handler - component.$element.on('keydown ', event => { - event.preventDefault(); - $select2.find('.select2-selection').trigger(event); - }); - - // Keep focus on element if ESC was pressed - $select2.on('keydown ', event => { - if (event.which === 27) { - instance.component.$element.focus(); - } - }); - - // Handle dropdown opening when focusing the selection element - $select2Selection.on('keydown ', event => { - const skipKeys = new Set([8, 9, 12, 16, 17, 18, 20, 27, 46, 91, 93]); - const functionKeysRegex = /F[0-9]([0-9])?$/; - const isFunctionKey = functionKeysRegex.test(event.key); - if (skipKeys.has(event.which) || isFunctionKey) { - return; - } - - event.preventDefault(); - event.stopPropagation(); - - // Open the select2 dropdown - instance.component.$element.select2('open'); - - // Check if the pressed key will produce a character - const searchSelector = '.select2-search__field'; - const $search = component.select2Instance.$dropdown.find(searchSelector); - const isChar = OHIF.ui.isCharacterKeyPress(event); - const char = event.key; - if ($search.length && isChar && char.length === 1) { - // Event needs to be triggered twice to work properly with this plugin - $search.val(char).trigger('input').trigger('input'); - } - }); - - // Set select2 as initialized - instance.isInitialized = true; - }; - - instance.autorun(() => { - // Run this computation every time the reactive items suffer any changes - const isReactive = data.items instanceof ReactiveVar; - if (isReactive) { - data.items.dep.depend(); - } - - if (isReactive) { - // Keep the current value of the component - const currentValue = component.value(); - const wasFocused = instance.isFocused; - - Tracker.afterFlush(() => { - component.$element.val(currentValue); - instance.rebuildSelect2(); - - if (wasFocused) { - component.$element.focus(); - } - }); - } else { - instance.rebuildSelect2(); - } - }); - }, - - events: { - // Focus element when selecting a value - 'select2:select'(event, instance) { - instance.component.$element.focus(); - }, - - // Focus the element when closing the dropdown container using ESC key - 'select2:open'(event, instance) { - const { minimumResultsForSearch } = instance.data.options; - if (minimumResultsForSearch === Infinity || minimumResultsForSearch === -1) return; - const $container = instance.getDropdownContainerElement(); - - if (!instance.data.wrapText) { - $container.addClass('select2-container-nowrap'); - } - - const $searchInput = $container.find('.select2-search__field'); - $searchInput.on('keydown.focusOnFinish', event => { - const keys = new Set([9, 13, 27]); - if (keys.has(event.which)) { - $searchInput.off('keydown.focusOnFinish'); - instance.component.$element.focus(); - } - }); - } - }, - - onDestroyed() { - const instance = Template.instance(); - const { component } = instance; - - // Destroy the select2 instance to remove unwanted DOM elements - if (component.select2Instance) { - component.select2Instance.destroy(); - } - } - } -}); diff --git a/Packages/ohif-core/client/components/base/section/section.html b/Packages/ohif-core/client/components/base/section/section.html deleted file mode 100644 index 51fc98269..000000000 --- a/Packages/ohif-core/client/components/base/section/section.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/section/section.js b/Packages/ohif-core/client/components/base/section/section.js deleted file mode 100644 index b8f86af0f..000000000 --- a/Packages/ohif-core/client/components/base/section/section.js +++ /dev/null @@ -1,61 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Tracker } from 'meteor/tracker'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; - -Template.section.onCreated(() => { - const instance = Template.instance(); - - // Create the render function and section data as reactive objects - instance.renderFunction = new ReactiveVar(null); - instance.sectionData = new ReactiveVar(null); - - // Get the section name - const sectionName = instance.data; - - // Stop here if no section name was defined - if (!sectionName) { - return; - } - - // Get the content block - const templateContentBlock = instance.view.templateContentBlock; - - // Get the parent template view of this section block - let currentView = OHIF.blaze.getParentTemplateView(instance.view); - - // Check if it is defining or printing the section content - if (templateContentBlock) { - // Define a section map for template's view if none was yet set - if (!currentView._sectionMap) { - currentView._sectionMap = new Map(); - } - - // Define the content - currentView._sectionMap.set(sectionName, { - data: Object.assign({}, currentView._templateInstance.data), - renderFunction: templateContentBlock.renderFunction - }); - } else { - // Wait for re-rendering and print the section content - Tracker.afterFlush(() => { - // Get the defined section's content - const section = OHIF.blaze.getSectionContent(currentView, sectionName); - - // Stop here if the section content is not defined - if (!section) { - return; - } - - // Set the section data on its respective reactive object - instance.sectionData.set(section.data); - - // Set the render function on its respective reactive object - instance.renderFunction.set(new Template(section.renderFunction)); - }); - } -}); - -Template.registerHelper('hasSection', sectionName => { - return !!OHIF.blaze.getSectionContent(Template.instance().view, sectionName); -}); diff --git a/Packages/ohif-core/client/components/base/template.js b/Packages/ohif-core/client/components/base/template.js deleted file mode 100644 index 20dad4c18..000000000 --- a/Packages/ohif-core/client/components/base/template.js +++ /dev/null @@ -1,112 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -// Create a new custom template for the base component -Template.baseComponent = new Template('baseComponent', () => {}); - -// Inject some custom behaviors in the view's construction function -Template.baseComponent.constructView = function(contentFunc, elseFunc) { - // Get the data passed to the template - const data = Template.currentData(); - - if (!data) { - return; - } - - // Check the base template. If it's not informed set as the custom base - data.base || (data.base = 'baseCustom'); - - // Get the base template object - const baseTemplate = Template[data.base]; - - // Throw an error if the base template does not exists - if (!baseTemplate) { - throw new Error(`Template ${data.base} not found.`); - } - - // Declare the template object and name it as base name + 'Component' - const template = OHIF.blaze.cloneTemplate(baseTemplate, data.base + 'Component'); - - // Extract the render function from the base template - template.renderFunction = baseTemplate.renderFunction; - - // Init the data manipulation mixins - OHIF.Mixin.initData(data); - - // Create and fill a list of wrappers that will enclose the component - const wrappers = []; - if (data.wrappers) { - const wrappersList = data.wrappers.split(' '); - _.each(wrappersList, wrapper => wrapper && wrappers.push(wrapper)); - } - - // Declare a variable to store the wrapper instances that will be rendered - const wrapperInstances = []; - - // Declare the content function to render the component - let contentFunction = () => { - // Create the most inner content function - const innerContentFunction = () => { - // Return the view instance - return template.constructView(contentFunc, elseFunc); - }; - - // Assign properties to all wrappers after template's creation - template.onCreated(() => { - const instance = Template.instance(); - - // create the base structure to aplly specific component mixins - instance.component = new OHIF.Component(instance); - - // Assign the template most outer wrapper - instance.wrapper = wrapperInstances[0] || instance; - - // Iterate over all wrappers and assign the component to them - wrapperInstances.forEach(wrapperInstance => { - wrapperInstance.component = instance.component; - }); - }); - - // Apply the mixins to the component - OHIF.Mixin.initAll(template, data); - - // Return the recursive function for wrappers - return Blaze.With(data, innerContentFunction); - }; - - let wrapper; - while (wrapper = wrappers.shift()) { - // Get the wrapper template - const wrapperTemplate = Template[wrapper]; - - // Throw an error if the wrapper template does not exists - if (!wrapperTemplate) { - throw new Error(`Template ${wrapper} not found.`); - } - - // Clone the wrapper template to avoid assigning duplicated handlers - const currentTemplate = OHIF.blaze.cloneTemplate(wrapperTemplate); - - // Store the child content function to render it inside the wrapper - const childContentFunction = contentFunction; - - // Create a function that will enable the recursion for wrappers - const enclosingContentFunction = () => { - // Add the current wrapper's instance to the wrapper instances list - currentTemplate.onCreated(() => wrapperInstances.push(Template.instance())); - - // Return the wrapper view instance with its child as content - return currentTemplate.constructView(childContentFunction, elseFunc); - }; - - // Replace the content function enclosing it recursively - contentFunction = () => { - return Blaze.With(data, enclosingContentFunction); - }; - - } - - return contentFunction(contentFunc, elseFunc); -}; diff --git a/Packages/ohif-core/client/components/base/templates/button.html b/Packages/ohif-core/client/components/base/templates/button.html deleted file mode 100644 index 592881fb6..000000000 --- a/Packages/ohif-core/client/components/base/templates/button.html +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/templates/custom.html b/Packages/ohif-core/client/components/base/templates/custom.html deleted file mode 100644 index 302917fd3..000000000 --- a/Packages/ohif-core/client/components/base/templates/custom.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/templates/div.html b/Packages/ohif-core/client/components/base/templates/div.html deleted file mode 100644 index a39733ce3..000000000 --- a/Packages/ohif-core/client/components/base/templates/div.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/templates/form.html b/Packages/ohif-core/client/components/base/templates/form.html deleted file mode 100644 index ca7c66c00..000000000 --- a/Packages/ohif-core/client/components/base/templates/form.html +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/templates/input.html b/Packages/ohif-core/client/components/base/templates/input.html deleted file mode 100644 index a707d3b41..000000000 --- a/Packages/ohif-core/client/components/base/templates/input.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/templates/link.html b/Packages/ohif-core/client/components/base/templates/link.html deleted file mode 100644 index e08fac065..000000000 --- a/Packages/ohif-core/client/components/base/templates/link.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/templates/select.html b/Packages/ohif-core/client/components/base/templates/select.html deleted file mode 100644 index 139965e38..000000000 --- a/Packages/ohif-core/client/components/base/templates/select.html +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/Packages/ohif-core/client/components/base/templates/tr.html b/Packages/ohif-core/client/components/base/templates/tr.html deleted file mode 100644 index 003ae583a..000000000 --- a/Packages/ohif-core/client/components/base/templates/tr.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/wrappers/label.html b/Packages/ohif-core/client/components/base/wrappers/label.html deleted file mode 100644 index 10f5f9e4d..000000000 --- a/Packages/ohif-core/client/components/base/wrappers/label.html +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/base/wrappers/labelContent.html b/Packages/ohif-core/client/components/base/wrappers/labelContent.html deleted file mode 100644 index f4feb0f86..000000000 --- a/Packages/ohif-core/client/components/base/wrappers/labelContent.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/bootstrap.styl b/Packages/ohif-core/client/components/bootstrap/dialog/bootstrap.styl deleted file mode 100644 index 695ad3731..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/bootstrap.styl +++ /dev/null @@ -1,14 +0,0 @@ -.modal - .modal-header:empty, .modal-footer:empty - display: none - - .modal-blank - - .modal-content - border: 0 - - .modal-header, .modal-footer - display: none - - .modal-body - padding: 0 diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/confirm.html b/Packages/ohif-core/client/components/bootstrap/dialog/confirm.html deleted file mode 100644 index 57baa6518..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/confirm.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/form.html b/Packages/ohif-core/client/components/bootstrap/dialog/form.html deleted file mode 100644 index 5ece500d6..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/form.html +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/form.js b/Packages/ohif-core/client/components/bootstrap/dialog/form.js deleted file mode 100644 index 88fbf5276..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/form.js +++ /dev/null @@ -1,114 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.dialogForm.onCreated(() => { - const instance = Template.instance(); - - const dismissModal = (promiseFunction, param) => { - // Hide the modal, removing the backdrop - instance.$('.modal').one('hidden.bs.modal', event => { - // Resolve or reject the promise with the given parameter - promiseFunction(param); - }).modal('hide'); - }; - - instance.api = { - - confirm() { - // Check if the form has valid data - const form = instance.$('form').data('component'); - if (!form.validate()) { - return; - } - - const formData = form.value(); - const dismiss = param => dismissModal(instance.data.promiseResolve, param); - - if (_.isFunction(instance.data.confirmCallback)) { - const result = instance.data.confirmCallback(formData); - if (result instanceof Promise) { - return result.then(dismiss); - } else { - return dismiss(result); - } - } - - dismiss(formData); - }, - - cancel() { - const dismiss = param => dismissModal(instance.data.promiseReject, param); - - if (_.isFunction(instance.data.cancelCallback)) { - const result = instance.data.cancelCallback(); - if (result instanceof Promise) { - return result.then(dismiss); - } else { - return dismiss(result); - } - } - - dismiss(); - } - - }; -}); - -Template.dialogForm.onRendered(() => { - const instance = Template.instance(); - - // Allow options ovewrite - const modalOptions = _.extend({ - backdrop: 'static', - keyboard: false - }, instance.data.modalOptions); - - const $modal = instance.$('.modal'); - - // Create the bootstrap modal - $modal.modal(modalOptions); - - // Check if dialog will be repositioned - let position = instance.data.position; - const event = instance.data.event; - if (!position && event && event.clientX) { - position = { - x: event.clientX, - y: event.clientY - }; - } - - // Reposition dialog if position object was filled - if (position) { - OHIF.ui.repositionDialog($modal, position.x, position.y); - } -}); - -Template.dialogForm.events({ - keydown(event) { - const instance = Template.instance(), - keyCode = event.keyCode || event.which; - - let handled = false; - - if (keyCode === 27) { - instance.$('.btn.btn-cancel').click(); - handled = true; - } else if (keyCode === 13) { - instance.$('.btn.btn-confirm').click(); - handled = true; - } - - if (handled) { - event.stopPropagation(); - } - } -}); - -Template.dialogForm.helpers({ - isError() { - const data = Template.instance().data; - return data instanceof Error || (data && data.error instanceof Error); - } -}); diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/header.html b/Packages/ohif-core/client/components/bootstrap/dialog/header.html deleted file mode 100644 index e21e97b3f..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/header.html +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/info.html b/Packages/ohif-core/client/components/bootstrap/dialog/info.html deleted file mode 100644 index de3a50b70..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/info.html +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/info.js b/Packages/ohif-core/client/components/bootstrap/dialog/info.js deleted file mode 100644 index 47d6ad678..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/info.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Template } from 'meteor/templating'; - -Template.dialogInfo.onRendered(() => { - const instance = Template.instance(); - - const $modal = instance.$('.modal'); - - $modal.one('hidden.bs.modal', () => instance.data.promiseResolve()); -}); - -Template.dialogInfo.helpers({ - isError() { - const data = Template.instance().data; - return data instanceof Error || (data && data.error instanceof Error); - } -}); diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/loading.html b/Packages/ohif-core/client/components/bootstrap/dialog/loading.html deleted file mode 100644 index c122eecec..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/loading.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/loading.js b/Packages/ohif-core/client/components/bootstrap/dialog/loading.js deleted file mode 100644 index 60f1bfc83..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/loading.js +++ /dev/null @@ -1,14 +0,0 @@ -import { Template } from 'meteor/templating'; - -Template.dialogLoading.onRendered(() => { - const instance = Template.instance(); - - const $modal = instance.$('.modal'); - - // Create the bootstrap modal - $modal.modal({ - backdrop: 'static', - keyboard: false, - show: true - }); -}); diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/loading.styl b/Packages/ohif-core/client/components/bootstrap/dialog/loading.styl deleted file mode 100644 index 5b8af1858..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/loading.styl +++ /dev/null @@ -1,9 +0,0 @@ -@import "{ohif:design}/app" - -.modal .loading-text - theme('color', '$textSecondaryColor') - font-size: 30px - height: 100vh - line-height: 100vh - text-align: center - text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 1px 0 0 #000, 0 1px 0 #000 diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/login.html b/Packages/ohif-core/client/components/bootstrap/dialog/login.html deleted file mode 100644 index bc719273d..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/login.html +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/login.js b/Packages/ohif-core/client/components/bootstrap/dialog/login.js deleted file mode 100644 index 8ad40f073..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/login.js +++ /dev/null @@ -1,17 +0,0 @@ -import { Template } from 'meteor/templating'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -Template.dialogLogin.onCreated(() => { - const instance = Template.instance(); - - instance.schema = new SimpleSchema({ - username: { - type: String, - label: 'Username' - }, - password: { - type: String, - label: 'Password' - } - }); -}); diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/progress.html b/Packages/ohif-core/client/components/bootstrap/dialog/progress.html deleted file mode 100644 index 9adb00e37..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/progress.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/progress.js b/Packages/ohif-core/client/components/bootstrap/dialog/progress.js deleted file mode 100644 index 3c39297fa..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/progress.js +++ /dev/null @@ -1,87 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; - -Template.dialogProgress.onCreated(() => { - const instance = Template.instance(); - - instance.state = new ReactiveVar({ - processed: 0, - total: instance.data.total, - message: instance.data.message - }); -}); - -Template.dialogProgress.onRendered(() => { - const instance = Template.instance(); - const task = instance.data.task; - - const progressDialog = { - promise: instance.data.promise, - - done: value => { - // Hide the modal, removing the backdrop - instance.$('.modal').on('hidden.bs.modal', event => { - instance.data.promiseResolve(value); - }).modal('hide'); - }, - - cancel: () => { - // Hide the modal, removing the backdrop - instance.$('.modal').on('hidden.bs.modal', event => { - instance.data.promiseReject(); - }).modal('hide'); - }, - - update: _.throttle(processed => { - const state = instance.state.get(); - state.processed = Math.max(0, processed); - - instance.state.set(state); - }, 100), - - setTotal: _.throttle(total => { - const state = instance.state.get(); - state.total = total; - - instance.state.set(state); - }, 100), - - setMessage: _.throttle(message => { - const state = instance.state.get(); - state.message = message; - - instance.state.set(state); - }, 100) - }; - - task.run(progressDialog); -}); - -Template.dialogProgress.helpers({ - progress() { - const instance = Template.instance(); - const state = instance.state.get(); - - if (!state || !state.total) { - return 0; - } - - return Math.min(1, state.processed / state.total) * 100; - }, - - message() { - const instance = Template.instance(); - const state = instance.state.get(); - - if (!state) { - return; - } - - if (typeof state.message === 'function') { - return state.message(state); - } - - return state.message; - } -}); diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/progress.styl b/Packages/ohif-core/client/components/bootstrap/dialog/progress.styl deleted file mode 100644 index ef1c24a0b..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/progress.styl +++ /dev/null @@ -1,14 +0,0 @@ -.modal-progress - .status - .progress-bar-container - border: solid 1px #28405E - overflow: auto; - margin: 0 0 10px - border-radius: 3px - - .percentage - margin: 0 5px - - .btn-confirm - display: none - \ No newline at end of file diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/simple.html b/Packages/ohif-core/client/components/bootstrap/dialog/simple.html deleted file mode 100644 index c59b5f120..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/simple.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/simple.js b/Packages/ohif-core/client/components/bootstrap/dialog/simple.js deleted file mode 100644 index 2ca4c4e61..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/simple.js +++ /dev/null @@ -1,61 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.dialogSimple.onCreated(() => { - const instance = Template.instance(); - - instance.close = () => { - instance.$('.modal').modal('hide'); - }; - - // Automatically close the modal if a timeout value was given - if (instance.data.timeout) { - Meteor.setTimeout(instance.close, instance.data.timeout); - } -}); - -Template.dialogSimple.onRendered(() => { - const instance = Template.instance(); - - // Allow options ovewrite - const modalOptions = _.extend({ - backdrop: 'static', - keyboard: false - }, instance.data.modalOptions); - - const $modal = instance.$('.modal'); - - // Create the bootstrap modal - $modal.modal(modalOptions); - - // Resolve the promise as soon as the modal is closed - $modal.one('hidden.bs.modal', () => instance.data.promiseResolve()); - - let position = instance.data.position; - - const { event } = instance.data; - if (!position && event && !_.isUndefined(event.clientX)) { - position = { - x: event.clientX, - y: event.clientY - }; - } - - if (position) { - OHIF.ui.repositionDialog($modal, position.x, position.y); - } -}); - -Template.dialogSimple.events({ - keydown(event) { - const instance = Template.instance(); - const keyCode = event.keyCode || event.which; - - if (keyCode === 27) { - instance.close(); - event.stopPropagation(); - } - } -}); diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.html b/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.html deleted file mode 100644 index e12e33fd3..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.html +++ /dev/null @@ -1,35 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.js b/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.js deleted file mode 100644 index 0ae2f4e1b..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.js +++ /dev/null @@ -1,132 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; - -const MARGIN_RIGHT = 15; -const MARGIN_BOTTOM = 15; - -Template.unsavedChangesDialog.onRendered(function() { - - const instance = Template.instance(); - const $modal = instance.$('.modal.unsavedChangesDialog'); - - // Routine which effectively displays the BS modal... - instance.displayModal = () => { - - // Make modal options extensible... - const modalOptions = _.extend({ - backdrop: 'static', - keyboard: false - }, instance.data.modalOptions); - - // Set handler for "hidden" event... Simply remove the view! - $modal.one('hidden.bs.modal', () => { - Blaze.remove(instance.view); - }); - - // Create the bootstrap modal - $modal.modal(modalOptions); - - }; - - // Routine which repositions the modal before display... - instance.displayModalWithPosition = (position) => { - - // Preserve original CSS rules... - const origCSS = { - display: $modal.css('display'), - visibility: $modal.css('visibility') - }; - - // Make sure modal is propperly rendered before proceeding with math... - if (origCSS.display === 'none') { - $modal.css({ - visibility: 'hidden', - display: 'block' - }); - } - - // Run presentation code on next tick... - setTimeout(() => { - - let dimension; - const $dialog = $modal.find('.modal-dialog'); - - const dialogRect = { - position: { - x: parseInt(position.x) || 0, - y: parseInt(position.y) || 0 - }, - size: { - width: $dialog.outerWidth(), - height: $dialog.outerHeight() - } - }; - - const modalSize = { - width: $modal.width(), - height: $modal.height() - }; - - dimension = dialogRect.position.x + dialogRect.size.width + MARGIN_RIGHT; - if (dimension > modalSize.width) { - dialogRect.position.x -= dimension - modalSize.width; - } - - if (dialogRect.position.x < 0) { - dialogRect.position.x = 0; - } - - dimension = dialogRect.position.y + dialogRect.size.height + MARGIN_BOTTOM; - if (dimension > modalSize.height) { - dialogRect.position.y -= dimension - modalSize.height; - } - - if (dialogRect.position.y < 0) { - dialogRect.position.y = 0; - } - - // Restore original CSS... - $modal.css(origCSS); - - // Set new position... - $dialog.css({ - position: 'fixed', - margin: 0, - left: dialogRect.position.x, - top: dialogRect.position.y - }); - - instance.displayModal(); - - }, 0); - - }; - - // Check if modal will be presented with custom positioning... - let position = instance.data.position; - if (position && 'x' in position && 'y' in position) { - instance.displayModalWithPosition(position); - } else { - instance.displayModal(); - } - -}); - -Template.unsavedChangesDialog.events({ - - 'click button[data-choice]'(event) { - - const instance = Template.instance(); - const callback = instance.data.callback; - const choice = $(event.currentTarget).attr('data-choice') || ''; - - // if callback is a function, call it passing user choice... - if (typeof callback === 'function') { - callback.call(instance, choice); - } - - } - -}); diff --git a/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.styl b/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.styl deleted file mode 100644 index d1e3f0226..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dialog/unsavedChangesDialog.styl +++ /dev/null @@ -1,7 +0,0 @@ -.modal.unsavedChangesDialog - - .modal-dialog - width: 400px - - .modal-footer - border-top: 0 none diff --git a/Packages/ohif-core/client/components/bootstrap/dropdown/dropdown.styl b/Packages/ohif-core/client/components/bootstrap/dropdown/dropdown.styl deleted file mode 100644 index 4d90fdc6b..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dropdown/dropdown.styl +++ /dev/null @@ -1,61 +0,0 @@ -@require '{ohif:design}/app' - -.dropdown - cursor: default - outline: none - - &>ul.dropdown-menu - display: block - z-index: 1000 - transform(scale(0)) - transition(transform 0.3s ease) - - &.dropdown-menu-left, &.origin-top-left - transform-origin(0% 0%) - - &.dropdown-menu-right, &.origin-top-right - transform-origin(100% 0%) - - li.divider - margin: 4px 0 - - li a - outline: none - padding: 8px 20px - - i - font-size: 14px - margin-right: 4px - - svg - display: inline-block - max-width: 18px - max-height: 18px - vertical-align: middle - - &.open>ul.dropdown-menu - transform(scale(1)) - - -.dropdown-submenu - - &:hover - - &>.dropdown-menu - display: block - - &>a:after - border-left-color: #000000 - - &>a:after - display: block - float: right - content: ' ' - width: 0 - height: 0 - border-color: transparent - border-style: solid - border-width: 5px 0 5px 5px - border-left-color: #666666 - margin-top: 5px - margin-right: -10px diff --git a/Packages/ohif-core/client/components/bootstrap/dropdown/form.html b/Packages/ohif-core/client/components/bootstrap/dropdown/form.html deleted file mode 100644 index 99a6bb545..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dropdown/form.html +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/Packages/ohif-core/client/components/bootstrap/dropdown/form.js b/Packages/ohif-core/client/components/bootstrap/dropdown/form.js deleted file mode 100644 index 382295aa3..000000000 --- a/Packages/ohif-core/client/components/bootstrap/dropdown/form.js +++ /dev/null @@ -1,22 +0,0 @@ -import { Template } from 'meteor/templating'; - -Template.dropdownFormMenu.helpers({ - isVisible(item) { - let isVisible = true; - if (typeof item.visible === 'function') { - isVisible = item.visible(); - } else if (typeof item.visible !== 'undefined') { - isVisible = !!item.visible; - } - - return isVisible; - }, - - getText(item) { - if (typeof item.text === 'function') { - return item.text(item.params || {}); - } - - return item.text || ''; - } -}); diff --git a/Packages/ohif-core/client/components/bootstrap/form/button.html b/Packages/ohif-core/client/components/bootstrap/form/button.html deleted file mode 100644 index 6f8ce2581..000000000 --- a/Packages/ohif-core/client/components/bootstrap/form/button.html +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/form/form.html b/Packages/ohif-core/client/components/bootstrap/form/form.html deleted file mode 100644 index ca90b0101..000000000 --- a/Packages/ohif-core/client/components/bootstrap/form/form.html +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/form/group.html b/Packages/ohif-core/client/components/bootstrap/form/group.html deleted file mode 100644 index 402f38fc2..000000000 --- a/Packages/ohif-core/client/components/bootstrap/form/group.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/form/link.html b/Packages/ohif-core/client/components/bootstrap/form/link.html deleted file mode 100644 index a96e1fe88..000000000 --- a/Packages/ohif-core/client/components/bootstrap/form/link.html +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/index.js b/Packages/ohif-core/client/components/bootstrap/index.js deleted file mode 100644 index 64cdfc92b..000000000 --- a/Packages/ohif-core/client/components/bootstrap/index.js +++ /dev/null @@ -1,39 +0,0 @@ -import './dialog/confirm.html'; -import './dialog/form.html'; -import './dialog/form.js'; -import './dialog/header.html'; -import './dialog/info.html'; -import './dialog/info.js'; -import './dialog/loading.html'; -import './dialog/loading.js'; -import './dialog/login.html'; -import './dialog/login.js'; -import './dialog/progress.html'; -import './dialog/progress.js'; -import './dialog/simple.html'; -import './dialog/simple.js'; -import './dialog/unsavedChangesDialog.html'; -import './dialog/unsavedChangesDialog.js'; - -import './dropdown/form.html'; -import './dropdown/form.js'; - -import './form/button.html'; -import './form/form.html'; -import './form/group.html'; -import './form/link.html'; - -import './input/checkbox.html'; -import './input/hidden.html'; -import './input/groupRadio.html'; -import './input/number.html'; -import './input/password.html'; -import './input/radio.html'; -import './input/range.html'; -import './input/select.html'; -import './input/text.html'; - -import './notification'; - -import './popover/form.html'; -import './popover/popoverSimple.html'; diff --git a/Packages/ohif-core/client/components/bootstrap/input/checkbox.html b/Packages/ohif-core/client/components/bootstrap/input/checkbox.html deleted file mode 100644 index 038312206..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/checkbox.html +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/groupRadio.html b/Packages/ohif-core/client/components/bootstrap/input/groupRadio.html deleted file mode 100644 index afc11e7bd..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/groupRadio.html +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/hidden.html b/Packages/ohif-core/client/components/bootstrap/input/hidden.html deleted file mode 100644 index 01ec712ea..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/hidden.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/number.html b/Packages/ohif-core/client/components/bootstrap/input/number.html deleted file mode 100644 index 2d31b0a2c..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/number.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/password.html b/Packages/ohif-core/client/components/bootstrap/input/password.html deleted file mode 100644 index caf51a343..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/password.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/radio.html b/Packages/ohif-core/client/components/bootstrap/input/radio.html deleted file mode 100644 index d2377667e..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/radio.html +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/range.html b/Packages/ohif-core/client/components/bootstrap/input/range.html deleted file mode 100644 index aeb04c9aa..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/range.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/select.html b/Packages/ohif-core/client/components/bootstrap/input/select.html deleted file mode 100644 index fae5bd98b..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/select.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/input/text.html b/Packages/ohif-core/client/components/bootstrap/input/text.html deleted file mode 100644 index 7baded756..000000000 --- a/Packages/ohif-core/client/components/bootstrap/input/text.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/notification/index.js b/Packages/ohif-core/client/components/bootstrap/notification/index.js deleted file mode 100644 index 9f2cb2c1f..000000000 --- a/Packages/ohif-core/client/components/bootstrap/notification/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './notification.styl'; -import './notificationNote.html'; -import './notificationNote.js'; diff --git a/Packages/ohif-core/client/components/bootstrap/notification/notification.styl b/Packages/ohif-core/client/components/bootstrap/notification/notification.styl deleted file mode 100644 index aba58936e..000000000 --- a/Packages/ohif-core/client/components/bootstrap/notification/notification.styl +++ /dev/null @@ -1,70 +0,0 @@ -@require '{ohif:design}/app' - -.notification-area - position: fixed - right: 0 - top: 50px - max-width: 320px - z-index: 10000 - -.notification-note - opacity: 0 - position: relative - transition(opacity 0.5s linear\, max-height 0.5s linear) - width: 300px - z-index: 2 - - .note-container - padding: 10px - transform(translateY(0)) - transition(transform 0.5s linear) - - .note-body - margin: 0 - padding: 10px - position: relative - - &:not(.hide-dismiss) - padding-right: 50px - - .note-dismiss - display: block - - .alert-success - background-color: #D9F2E9 - color: #000000 - - .note-dismiss - bottom: 0 - cursor: pointer - display: none - position: absolute - right: 0 - top: 0 - transition(background-color 0.3s ease) - width: 40px - - i - display: block - font-size: 20px - left: 0 - position: absolute - text-align: center - top: 50% - transform(translateY(-50%)) - width: 100% - - &:hover - background-color: rgba(0, 0, 0, 0.1) - - &.in - max-height: auto - opacity: 1 - - &.out - max-height: 0 !important - opacity: 0 - z-index: 1 - - .note-container - transform(translateY(-100%)) diff --git a/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.html b/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.html deleted file mode 100644 index a11f42c43..000000000 --- a/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.html +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.js b/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.js deleted file mode 100644 index c0581c38b..000000000 --- a/Packages/ohif-core/client/components/bootstrap/notification/notificationNote.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -Template.notificationNote.onRendered(() => { - const instance = Template.instance(); - Meteor.setTimeout(() => { - const $note = instance.$('.notification-note'); - $note.css('max-height', $note.outerHeight()).addClass('in'); - }, 100); -}); - -Template.notificationNote.events({ - 'click .note-dismiss'(event, instance) { - if (instance.data.promiseResolve) { - instance.data.promiseResolve(); - } else { - OHIF.ui.notifications.dismiss(instance.data.id); - } - } -}); diff --git a/Packages/ohif-core/client/components/bootstrap/popover/form.html b/Packages/ohif-core/client/components/bootstrap/popover/form.html deleted file mode 100644 index ace107a75..000000000 --- a/Packages/ohif-core/client/components/bootstrap/popover/form.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/bootstrap/popover/popoverSimple.html b/Packages/ohif-core/client/components/bootstrap/popover/popoverSimple.html deleted file mode 100644 index c9790d379..000000000 --- a/Packages/ohif-core/client/components/bootstrap/popover/popoverSimple.html +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-core/client/components/index.js b/Packages/ohif-core/client/components/index.js deleted file mode 100644 index fdcfd036b..000000000 --- a/Packages/ohif-core/client/components/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import './base'; -import './bootstrap'; -import './pages'; -import './paginationArea'; -import './playground/playground.html'; -import './playground/playground.styl'; -import './playground/playground.js'; -import './scrollArea'; diff --git a/Packages/ohif-core/client/components/pages/error/error.html b/Packages/ohif-core/client/components/pages/error/error.html deleted file mode 100644 index e9d2b7771..000000000 --- a/Packages/ohif-core/client/components/pages/error/error.html +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/pages/error/error.js b/Packages/ohif-core/client/components/pages/error/error.js deleted file mode 100644 index 78766f36e..000000000 --- a/Packages/ohif-core/client/components/pages/error/error.js +++ /dev/null @@ -1,13 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; - -Template.pageError.helpers({ - shallDisplayErrorStack() { - return Meteor.isDevelopment; - }, - - getDefaultErrorMessage() { - const instance = Template.instance(); - return instance.view.templateContentBlock ? '' : 'An error has ocurred.'; - } -}); diff --git a/Packages/ohif-core/client/components/pages/error/error.styl b/Packages/ohif-core/client/components/pages/error/error.styl deleted file mode 100644 index d174e908b..000000000 --- a/Packages/ohif-core/client/components/pages/error/error.styl +++ /dev/null @@ -1,19 +0,0 @@ -@require '{ohif:design}/app' - -.page-error .error-stack - display: table - margin-top: 10px - table-layout: fixed - width: 100% - - p - theme('background-color', '$uiGrayDarkest') - theme('border', '1px solid $uiGray') - border-radius(4px) - display: inline-block - font-family: monospace - margin: 0 - padding: 10px 20px - overflow-x: auto - white-space: pre - width: 100% diff --git a/Packages/ohif-core/client/components/pages/error/index.js b/Packages/ohif-core/client/components/pages/error/index.js deleted file mode 100644 index c8ab38d0e..000000000 --- a/Packages/ohif-core/client/components/pages/error/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './error.html'; -import './error.js'; -import './error.styl'; diff --git a/Packages/ohif-core/client/components/pages/index.js b/Packages/ohif-core/client/components/pages/index.js deleted file mode 100644 index b3d517bff..000000000 --- a/Packages/ohif-core/client/components/pages/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './error'; -import './message'; diff --git a/Packages/ohif-core/client/components/pages/message/index.js b/Packages/ohif-core/client/components/pages/message/index.js deleted file mode 100644 index d6c7a9b72..000000000 --- a/Packages/ohif-core/client/components/pages/message/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './message.html'; -import './message.styl'; diff --git a/Packages/ohif-core/client/components/pages/message/message.html b/Packages/ohif-core/client/components/pages/message/message.html deleted file mode 100644 index 1ba3c9d0c..000000000 --- a/Packages/ohif-core/client/components/pages/message/message.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/pages/message/message.styl b/Packages/ohif-core/client/components/pages/message/message.styl deleted file mode 100644 index 7242c2a33..000000000 --- a/Packages/ohif-core/client/components/pages/message/message.styl +++ /dev/null @@ -1,31 +0,0 @@ -@require '{ohif:design}/app' - -.page-message - theme('color', '$textPrimaryColor') - font-weight: 300 - padding: 10px 0 20px - - .message-container - display: table - margin: 0 auto - padding: 0 32px - - .message-title - theme('color', '$textSecondaryColor') - font-size: 30px - font-weight: 300 - - .message-content - font-size: 18px - - a - &, &:hover, &:active, &:focus - theme('color', '$activeColor') - -.modal .page-message - - .page-message, .message-container - padding: 0 - - .message-title - display: none diff --git a/Packages/ohif-core/client/components/paginationArea/index.js b/Packages/ohif-core/client/components/paginationArea/index.js deleted file mode 100644 index e48878db0..000000000 --- a/Packages/ohif-core/client/components/paginationArea/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './paginationArea.html'; -import './paginationArea.js'; -import './paginationArea.styl'; diff --git a/Packages/ohif-core/client/components/paginationArea/paginationArea.html b/Packages/ohif-core/client/components/paginationArea/paginationArea.html deleted file mode 100644 index 884a35316..000000000 --- a/Packages/ohif-core/client/components/paginationArea/paginationArea.html +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/paginationArea/paginationArea.js b/Packages/ohif-core/client/components/paginationArea/paginationArea.js deleted file mode 100644 index c3d482f29..000000000 --- a/Packages/ohif-core/client/components/paginationArea/paginationArea.js +++ /dev/null @@ -1,82 +0,0 @@ -import { Template } from 'meteor/templating'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { $ } from 'meteor/jquery'; - -Template.paginationArea.onCreated(function() { - const instance = Template.instance(); - - // Create the rowsPerPage schema - instance.schema = new SimpleSchema({ - rowsPerPage: { - type: Number, - allowedValues: [25, 50, 100], - defaultValue: 25 - } - }); -}); - -Template.paginationArea.onRendered(() => { - const instance = Template.instance(); - - // Track changes on recordCount and rowsPerPage - instance.autorun(() => { - const recordCount = instance.data.recordCount.get(); - const rowsPerPage = instance.data.rowsPerPage.get(); - const currentPage = instance.data.currentPage.get(); - - Meteor.defer(() => { - const prevButton = instance.$('.prev')[0]; - const nextButton = instance.$('.next')[0]; - if (!prevButton || !nextButton) { - return; - } - - // Enable if there are potentially more records, otherwise disable it - if (recordCount >= rowsPerPage) { - nextButton.classList.remove('disabled'); - } else { - nextButton.classList.add('disabled'); - } - - // Enable the previous button if it is not the first page, otherwise disable it - if (currentPage > 0) { - prevButton.classList.remove('disabled'); - } else { - prevButton.classList.add('disabled'); - } - }); - }); -}); - -Template.paginationArea.helpers({ - paginationButtonsEnabled() { - const instance = Template.instance(); - - const recordCount = instance.data.recordCount.get(); - const rowsPerPage = instance.data.rowsPerPage.get(); - const currentPage = instance.data.currentPage.get(); - - // Show pagination if it is not first page or there are potentially more records - return currentPage > 0 || recordCount >= rowsPerPage; - } -}); - -Template.paginationArea.events({ - 'click .prev > a'(event, instance) { - const currentPage = instance.data.currentPage.get(); - instance.data.currentPage.set(currentPage - 1); - }, - - 'click .next > a'(event, instance) { - const currentPage = instance.data.currentPage.get(); - instance.data.currentPage.set(currentPage + 1); - }, - - 'change [data-key=rowsPerPage]'(event, instance) { - const rowsPerPage = $(event.currentTarget).data('component').value(); - - // Update rowsPerPage - instance.data.rowsPerPage.set(parseInt(rowsPerPage, 10)); - instance.data.currentPage.set(0); - } -}); diff --git a/Packages/ohif-core/client/components/paginationArea/paginationArea.styl b/Packages/ohif-core/client/components/paginationArea/paginationArea.styl deleted file mode 100644 index ba174e885..000000000 --- a/Packages/ohif-core/client/components/paginationArea/paginationArea.styl +++ /dev/null @@ -1,67 +0,0 @@ -@require '{ohif:design}/app' - -.pagination-area - font-size: 13px - font-weight: normal !important - - label - font-weight: normal - - select - theme('background-color', '$primaryBackgroundColor') - color: white - - .rows-per-page label.wrapperLabel - display: inline-table !important - margin: 0 4px - - select - width: 42px - - .page-buttons - margin: 0 - text-align: right - - label - font-weight: normal - - ul.pagination-control - margin: 0 - - li - display: table-cell - padding: 5px 2px - - a - padding: 4px 8px - theme('background-color', '$primaryBackgroundColor') - theme('border-color', '$uiGray') - theme('background-color', '$uiGrayDarkest') - color: white - text-decoration: none - - &:hover - theme('color', '$activeColor') - - .active - a - theme('background-color', '$uiGray') - border-color: #ddd - color: white - - .disabled - cursor: not-allowed - - a, a:hover, a:focus, a:active - theme('background-color', '$uiGrayDarkest') - theme('border-color', '$uiGray') - theme('color', '$uiGrayLight') - pointer-events: none - - &:not(.disabled):hover a - theme('background-color', '$uiGrayDark') - theme('color', '$activeColor') - - &.active a - theme('background-color', '$uiGrayDark') - theme('color', '$activeColor') diff --git a/Packages/ohif-core/client/components/playground/playground.html b/Packages/ohif-core/client/components/playground/playground.html deleted file mode 100644 index 59749e0ba..000000000 --- a/Packages/ohif-core/client/components/playground/playground.html +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/playground/playground.js b/Packages/ohif-core/client/components/playground/playground.js deleted file mode 100644 index 44dc4ef25..000000000 --- a/Packages/ohif-core/client/components/playground/playground.js +++ /dev/null @@ -1,46 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.ui.layoutState = { - leftSidebar: new ReactiveVar(false), - rightSidebar: new ReactiveVar(false), - toolsDrawer: new ReactiveVar(false) -}; - -Template.componentPlayground.onRendered(() => { - const instance = Template.instance(); - - instance.$('.toolbar-drawer').adjustMax('height'); - instance.autorun(() => { - const state = OHIF.ui.layoutState.toolsDrawer.get(); - instance.$('.toolbar-drawer').toggleClass('open', state); - }); - - instance.$('.layout-sidebar-left').adjustMax('width'); - instance.autorun(() => { - const state = OHIF.ui.layoutState.leftSidebar.get(); - instance.$('.layout-sidebar-left').toggleClass('open', state); - }); - - instance.$('.layout-sidebar-right').adjustMax('width'); - instance.autorun(() => { - const state = OHIF.ui.layoutState.rightSidebar.get(); - instance.$('.layout-sidebar-right').toggleClass('open', state); - }); -}); - -Template.componentPlayground.events({ - 'click .js-tool-more'(event, instance) { - const currentState = OHIF.ui.layoutState.toolsDrawer.get(); - OHIF.ui.layoutState.toolsDrawer.set(!currentState); - }, - 'click .js-toggle-left'(event, instance) { - const currentState = OHIF.ui.layoutState.leftSidebar.get(); - OHIF.ui.layoutState.leftSidebar.set(!currentState); - }, - 'click .js-toggle-right'(event, instance) { - const currentState = OHIF.ui.layoutState.rightSidebar.get(); - OHIF.ui.layoutState.rightSidebar.set(!currentState); - } -}); diff --git a/Packages/ohif-core/client/components/playground/playground.styl b/Packages/ohif-core/client/components/playground/playground.styl deleted file mode 100644 index 9510ba4bc..000000000 --- a/Packages/ohif-core/client/components/playground/playground.styl +++ /dev/null @@ -1,37 +0,0 @@ -.layout-container - align-items: stretch - display: flex - flex-flow: column nowrap - height: 100vh - - .layout-header - background-color: cyan - flex-grow: 0 - - .layout-body - align-items: stretch - display: flex - flex-grow: 1 - -.layout-sidebar - background-color: lime - flex-grow: 0 - -.layout-main - background-color: white - flex-grow: 1 - -.toolbar-drawer - overflow: hidden - transition: max-height 0.3s ease - - &:not(.open) - max-height: 0 !important - -.layout-sidebar-left -.layout-sidebar-right - overflow: hidden - transition: max-width 0.3s ease - - &:not(.open) - max-width: 0 !important diff --git a/Packages/ohif-core/client/components/scrollArea/index.js b/Packages/ohif-core/client/components/scrollArea/index.js deleted file mode 100644 index b0e46a47c..000000000 --- a/Packages/ohif-core/client/components/scrollArea/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './scrollArea.html'; -import './scrollArea.js'; -import './scrollArea.styl'; diff --git a/Packages/ohif-core/client/components/scrollArea/scrollArea.html b/Packages/ohif-core/client/components/scrollArea/scrollArea.html deleted file mode 100644 index fbf60fb95..000000000 --- a/Packages/ohif-core/client/components/scrollArea/scrollArea.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Packages/ohif-core/client/components/scrollArea/scrollArea.js b/Packages/ohif-core/client/components/scrollArea/scrollArea.js deleted file mode 100644 index 1657d0ca8..000000000 --- a/Packages/ohif-core/client/components/scrollArea/scrollArea.js +++ /dev/null @@ -1,93 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.scrollArea.onCreated(() => { - const instance = Template.instance(); - const { data } = instance; - const defaultConfig = { - hideScrollbar: true, - scrollY: true, - scrollX: false, - scrollStep: 100 - }; - - instance.config = _.defaults(data || {}, defaultConfig); -}); - -Template.scrollArea.onRendered(() => { - const instance = Template.instance(); - - instance.adjustMargins = _.throttle(() => { - const { config } = instance; - if (config.hideScrollbar) { - const $scrollable = instance.$('.scrollable').first(); - const x = config.scrollX ? 1 : 0; - const y = config.scrollY ? 1 : 0; - const scrollbarSize = OHIF.ui.getScrollbarSize(); - $scrollable.css({ - 'margin-right': 0 - (scrollbarSize[0]) * y, - 'margin-bottom': 0 - (scrollbarSize[1]) * x - }); - } - }, 150); - - instance.$scrollable = instance.$('.scrollable').first(); - instance.scrollHandler = _.throttle(event => { - const $scrollable = event ? $(event.currentTarget) : instance.$scrollable; - const $scrollArea = $scrollable.closest('.scroll-area'); - if ($scrollable[0] !== instance.$('.scrollable')[0]) return; - $scrollArea.removeClass('can-scroll-up can-scroll-down'); - const height = $scrollable.outerHeight(); - const scrollTop = $scrollable.scrollTop(); - const { scrollHeight } = $scrollable[0]; - - // Stop here if unable to scroll - if (scrollHeight <= height) return; - - // Check if can scroll up - if (scrollTop) { - $scrollArea.addClass('can-scroll-up'); - } - - // Check if can scroll down - if (scrollTop + height < scrollHeight) { - $scrollArea.addClass('can-scroll-down'); - } - }, 150); - - instance.scrollHandler(); - - instance.adjustMargins(); - $(window).on('resize', instance.adjustMargins); -}); - -Template.scrollArea.onDestroyed(() => { - const instance = Template.instance(); - $(window).off('resize', instance.adjustMargins); -}); - -Template.scrollArea.events({ - 'scroll .scrollable, mouseenter .scrollable, transitionend .scrollable'(event, instance) { - instance.scrollHandler(event); - }, - - 'click .scroll-nav-down'(event, instance) { - const $scrollable = $(event.currentTarget).siblings('.scrollable'); - const height = $scrollable.outerHeight(); - const currentTop = $scrollable.scrollTop(); - const { scrollHeight } = $scrollable[0]; - const limit = scrollHeight - height; - let scrollTop = currentTop + instance.data.scrollStep; - scrollTop = scrollTop > limit ? limit : scrollTop; - $scrollable.stop().animate({ scrollTop }, 150, 'swing'); - }, - - 'click .scroll-nav-up'(event, instance) { - const $scrollable = $(event.currentTarget).siblings('.scrollable'); - const currentTop = $scrollable.scrollTop(); - let scrollTop = currentTop - instance.data.scrollStep; - scrollTop = scrollTop < 0 ? 0 : scrollTop; - $scrollable.stop().animate({ scrollTop }, 150, 'swing'); - }, -}); diff --git a/Packages/ohif-core/client/components/scrollArea/scrollArea.styl b/Packages/ohif-core/client/components/scrollArea/scrollArea.styl deleted file mode 100644 index 86cfe6749..000000000 --- a/Packages/ohif-core/client/components/scrollArea/scrollArea.styl +++ /dev/null @@ -1,79 +0,0 @@ -@require '{ohif:design}/app' - -$scrollNavSize = 24px - -.scroll-area - overflow: hidden - position: relative - - .scrollable - max-height: inherit - overflow: hidden - zoom: 1 - - &.scroll-x - overflow-x: scroll - - &.scroll-y - overflow-y: scroll - - &.fit - height: 100% - width: 100% - - .scrollable - bottom: 0 - left: 0 - max-height: none - position: absolute - right: 0 - top: 0 - - .scroll-nav - background-color: rgba(0, 0, 0, 0.75) - box-shadow(0 0 10px 10px rgba(0, 0, 0, 0.75)) - cursor: pointer - height: $scrollNavSize - left: 10px - opacity: 0 - position: absolute - right: 10px - transition(transform 0.3s ease\, opacity 0.3s ease\, background-color 0.3s ease\, box-shadow 0.3s ease) - - &:after - theme('color', '$activeColor') - display: block - font-family: FontAwesome - font-size: 20px - text-align: center - transition(color 0.3s ease) - - &:hover - background-color: rgba(0, 0, 0, 0.9) - box-shadow(0 0 10px 10px rgba(0, 0, 0, 0.9)) - - &:after - theme('color', '$hoverColor') - - .scroll-nav-up - border-bottom-left-radius($scrollNavSize / 2) - border-bottom-right-radius($scrollNavSize / 2) - top: 0 - transform(translateY(- $scrollNavSize)) - - &:after - content: '\f102' - - .scroll-nav-down - border-top-left-radius($scrollNavSize / 2) - border-top-right-radius($scrollNavSize / 2) - bottom: 0 - transform(translateY($scrollNavSize)) - - &:after - content: '\f103' - - &.can-scroll-up .scroll-nav-up, - &.can-scroll-down .scroll-nav-down - opacity: 1 - transform(translateY(0)) diff --git a/Packages/ohif-core/client/helpers/blaze.js b/Packages/ohif-core/client/helpers/blaze.js deleted file mode 100644 index fd71b5943..000000000 --- a/Packages/ohif-core/client/helpers/blaze.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; - -/** - * Global Blaze UI helpers to work with Blaze - */ - -// Return the absolute url -Template.registerHelper('absoluteUrl', path => { - return OHIF.utils.absoluteUrl(path); -}); - -// Return the current template instance -Template.registerHelper('instance', () => { - return Template.instance(); -}); - -// Return the session value for the given key -Template.registerHelper('session', key => { - return Session.get(key); -}); - -// Return the value for given parameter regardless if it's reactive or not -Template.registerHelper('reactive', parameter => { - if (parameter instanceof ReactiveVar) { - return parameter.get(); - } - - return parameter; -}); diff --git a/Packages/ohif-core/client/helpers/data.js b/Packages/ohif-core/client/helpers/data.js deleted file mode 100644 index b0b2bbd1b..000000000 --- a/Packages/ohif-core/client/helpers/data.js +++ /dev/null @@ -1,61 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { Template } from 'meteor/templating'; - -/** - * Global Blaze UI helpers to manipulate data - */ - -// Base extend function to be used by extend and clone helpers -const extend = (...argsArray) => { - // Create the resulting object - const result = argsArray[0] || {}; - - // Extract the Spacebars kw hash - const lastArg = _.last(argsArray); - const kwHash = lastArg ? lastArg.hash : null; - - // Extract the given objects - const objects = _.initial(argsArray); - - // Iterate over the given objects - _.each(objects, current => { - // Stop here if the current argument is not an object - if (typeof current !== 'object') { - return; - } - - // Extend the resulting object with the current argument object - _.extend(result, current); - }); - - // Extend the resulting object with the Spacebars kw hash - _.extend(result, kwHash); - - // Return the resulting object - return result; -}; - -// Extend the first argument object it with the other argument objects -Template.registerHelper('extend', (...argsArray) => { - return extend(...argsArray); -}); - -// Create a new object and extends it with the argument objects -Template.registerHelper('clone', (...argsArray) => { - const newArgs = argsArray.slice(); - newArgs.unshift({}); - return extend(...newArgs); -}); - -// Choose the first truthy value in the given values -Template.registerHelper('choose', (...values) => { - let result; - _.each(_.initial(values, 1), value => { - if (result) { - return; - } - - result = value; - }); - return result; -}); diff --git a/Packages/ohif-core/client/helpers/debug.js b/Packages/ohif-core/client/helpers/debug.js deleted file mode 100644 index 044a0b17e..000000000 --- a/Packages/ohif-core/client/helpers/debug.js +++ /dev/null @@ -1,17 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; - -/** - * Global Blaze UI helpers to development debugging - */ - -// Stop here if it's not development environment -if (!Meteor.isDevelopment) { - return; -} - -// Debug some value on console -Template.registerHelper('debug', (...values) => { - console.debug(...values); -}); diff --git a/Packages/ohif-core/client/helpers/index.js b/Packages/ohif-core/client/helpers/index.js deleted file mode 100644 index d0167cc05..000000000 --- a/Packages/ohif-core/client/helpers/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import './blaze.js'; -import './data.js'; -import './debug.js'; -import './logical.js'; -import './number.js'; -import './string.js'; -import './typing.js'; -import './ui.js'; diff --git a/Packages/ohif-core/client/helpers/logical.js b/Packages/ohif-core/client/helpers/logical.js deleted file mode 100644 index 32e63271b..000000000 --- a/Packages/ohif-core/client/helpers/logical.js +++ /dev/null @@ -1,73 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { Template } from 'meteor/templating'; - -/** - * Global Blaze UI helpers to work with logical operations - */ - -// Convert any value into a boolean value -Template.registerHelper('bool', value => { - return !!value; -}); - -// Check if two values are identical -Template.registerHelper('eq', (a, b) => { - return a === b; -}); - -// Check if two values are different -Template.registerHelper('ne', (a, b) => { - return a !== b; -}); - -// Check if the first value is greater than the second one -Template.registerHelper('gt', (a, b) => { - return a > b; -}); - -// Check if the first value is lesser than the second one -Template.registerHelper('lt', (a, b) => { - return a < b; -}); - -// Check if the first value is greater than or equals the second one -Template.registerHelper('gte', (a, b) => { - return a >= b; -}); - -// Check if the first value is lesser than or equals the second one -Template.registerHelper('lte', (a, b) => { - return a <= b; -}); - -// Get the boolean negation for the given value -Template.registerHelper('not', value => { - return !value; -}); - -// Check if all the given values are true -Template.registerHelper('and', (...values) => { - let result = true; - _.each(_.initial(values, 1), value => { - return !value && (result = false); - }); - return result; -}); - -// Check if one of the given values is true -Template.registerHelper('or', (...values) => { - let result = false; - _.each(_.initial(values, 1), value => { - return value && (result = true); - }); - return result; -}); - -// Return the second parameter if the first is true or the third if it's false -Template.registerHelper('valueIf', (condition, valueIfTrue, valueIfFalse) => { - if (condition) { - return valueIfTrue; - } - - return valueIfFalse; -}); diff --git a/Packages/ohif-core/client/helpers/number.js b/Packages/ohif-core/client/helpers/number.js deleted file mode 100644 index b88d28199..000000000 --- a/Packages/ohif-core/client/helpers/number.js +++ /dev/null @@ -1,21 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { Template } from 'meteor/templating'; - -/** - * Global Blaze UI helpers to work with numeric operations - */ - -// Sum all the given numbers -Template.registerHelper('sum', (...values) => { - let result = 0; - _.each(_.initial(values, 1), value => (result += (value | 0))); - return result; -}); - -Template.registerHelper('isValidNumber', value => { - return typeof value === 'number' && !isNaN(value); -}); - -Template.registerHelper('filterNaN', value => { - return isNaN(value) ? '' : value; -}); diff --git a/Packages/ohif-core/client/helpers/string.js b/Packages/ohif-core/client/helpers/string.js deleted file mode 100644 index 91e6af94a..000000000 --- a/Packages/ohif-core/client/helpers/string.js +++ /dev/null @@ -1,20 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; -import { Template } from 'meteor/templating'; - -/** - * Global Blaze UI helpers to work with Strings - */ - -// Concatenate the give strings -Template.registerHelper('concat', (...args) => { - const values = _.initial(args, 1); - let result = ''; - _.each(values, value => { - result += typeof value !== 'undefined' ? value : ''; - }); - return result; -}); - -// Encode any string into a safe format for HTML id attribute -Template.registerHelper('encodeId', OHIF.string.encodeId); diff --git a/Packages/ohif-core/client/helpers/typing.js b/Packages/ohif-core/client/helpers/typing.js deleted file mode 100644 index ca8ba21bf..000000000 --- a/Packages/ohif-core/client/helpers/typing.js +++ /dev/null @@ -1,21 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { Template } from 'meteor/templating'; - -/** - * Global Blaze UI helpers to work with Strings - */ - -// Check if the value's type is undefined -Template.registerHelper('isUndefined', value => { - return _.isUndefined(value); -}); - -// Check if the value's type is object -Template.registerHelper('isObject', value => { - return _.isObject(value); -}); - -// Check if the value is an array instance -Template.registerHelper('isArray', value => { - return _.isArray(value); -}); diff --git a/Packages/ohif-core/client/helpers/ui.js b/Packages/ohif-core/client/helpers/ui.js deleted file mode 100644 index ad8bfffbc..000000000 --- a/Packages/ohif-core/client/helpers/ui.js +++ /dev/null @@ -1,11 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; - -/** - * Global Blaze UI helpers - */ - -// Access OHIF.uiSettings object -Template.registerHelper('uiSettings', () => { - return OHIF.uiSettings; -}); diff --git a/Packages/ohif-core/client/index.js b/Packages/ohif-core/client/index.js deleted file mode 100644 index 2a7930717..000000000 --- a/Packages/ohif-core/client/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import './lib'; -import './helpers'; -import './components'; -import './ui'; - -import './routes.js'; diff --git a/Packages/ohif-core/client/lib/blaze.js b/Packages/ohif-core/client/lib/blaze.js deleted file mode 100644 index 9a8861acd..000000000 --- a/Packages/ohif-core/client/lib/blaze.js +++ /dev/null @@ -1,66 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.blaze = {}; - -// Clone a template and return the clone -OHIF.blaze.cloneTemplate = (template, newName) => { - if (!template){ - return; - } - - const name = newName || template.viewName; - const clone = new Template(name, template.renderFunction); - clone.inheritsEventsFrom(template); - clone.inheritsHelpersFrom(template); - clone.inheritsHooksFrom(template); - return clone; -}; - -// Navigate upwards the component and get the parent with the given view name -OHIF.blaze.getParentView = (view, parentViewName) => { - let currentView = view; - while (currentView) { - if (currentView.name === parentViewName) { - break; - } - - currentView = currentView.originalParentView || currentView.parentView; - } - - return currentView; -}; - -// Search for the parent component of the given view -OHIF.blaze.getParentComponent = (view, property='_component') => { - let currentView = view; - while (currentView) { - currentView = currentView.originalParentView || currentView.parentView; - if (currentView && currentView[property]) { - return currentView[property]; - } - } -}; - -// Search for the parent template of the given view -OHIF.blaze.getParentTemplateView = view => { - let currentView = view; - while (currentView) { - currentView = currentView.originalParentView || currentView.parentView; - if (!currentView || !currentView.name) return; - if (currentView.name.indexOf('Template.') > -1 && currentView.name.indexOf('Template.__dynamic') === -1) { - return currentView; - } - } -}; - -// Get the view that contains the desired section's content and return it -OHIF.blaze.getSectionContent = (view, sectionName) => { - let currentView = view; - while (!currentView._sectionMap || !currentView._sectionMap.get(sectionName)) { - currentView = OHIF.blaze.getParentTemplateView(currentView); - if (!currentView) return; - } - - return currentView._sectionMap.get(sectionName); -}; diff --git a/Packages/ohif-core/client/lib/cornerstone.js b/Packages/ohif-core/client/lib/cornerstone.js deleted file mode 100644 index 06c0ef924..000000000 --- a/Packages/ohif-core/client/lib/cornerstone.js +++ /dev/null @@ -1,312 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; - -OHIF.cornerstone = {}; - -OHIF.cornerstone.getBoundingBox = (context, textLines, x, y, options) => { - if (Object.prototype.toString.call(textLines) !== '[object Array]') { - textLines = [textLines]; - } - - const padding = 5; - const font = cornerstoneTools.textStyle.getFont(); - const fontSize = cornerstoneTools.textStyle.getFontSize(); - - context.save(); - context.font = font; - context.textBaseline = 'top'; - - // Find the longest text width in the array of text data - let maxWidth = 0; - - textLines.forEach(text => { - // Get the text width in the current font - const width = context.measureText(text).width; - - // Find the maximum with for all the text rows; - maxWidth = Math.max(maxWidth, width); - }); - - // Calculate the bounding box for this text box - const boundingBox = { - width: maxWidth + (padding * 2), - height: padding + textLines.length * (fontSize + padding) - }; - - if (options && options.centering && options.centering.x === true) { - x -= boundingBox.width / 2; - } - - if (options && options.centering && options.centering.y === true) { - y -= boundingBox.height / 2; - } - - boundingBox.left = x; - boundingBox.top = y; - - context.restore(); - - // Return the bounding box so it can be used for pointNearHandle - return boundingBox; -}; - -OHIF.cornerstone.pixelToPage = (element, position) => { - const enabledElement = cornerstone.getEnabledElement(element); - const result = { - x: 0, - y: 0 - }; - - // Stop here if the cornerstone element is not enabled or position is not an object - if (!enabledElement || typeof position !== 'object') { - return result; - } - - const canvas = enabledElement.canvas; - - const canvasOffset = $(canvas).offset(); - result.x += canvasOffset.left; - result.y += canvasOffset.top; - - const canvasPosition = cornerstone.pixelToCanvas(element, position); - result.x += canvasPosition.x; - result.y += canvasPosition.y; - - return result; -}; - -OHIF.cornerstone.repositionTextBox = (eventData, measurementData, config) => { - // Stop here if it's not a measurement creating - if (!measurementData.isCreating) { - return; - } - - const element = eventData.element; - const enabledElement = cornerstone.getEnabledElement(element); - const image = enabledElement.image; - - const allowedBorders = OHIF.uiSettings.autoPositionMeasurementsTextCallOuts; - const allow = { - T: !allowedBorders || _.contains(allowedBorders, 'T'), - R: !allowedBorders || _.contains(allowedBorders, 'R'), - B: !allowedBorders || _.contains(allowedBorders, 'B'), - L: !allowedBorders || _.contains(allowedBorders, 'L') - }; - - const getAvailableBlankAreas = (enabledElement, labelWidth, labelHeight) => { - const { element, canvas, image } = enabledElement; - - const topLeft = cornerstone.pixelToCanvas(element, { - x: 0, - y: 0 - }); - - const bottomRight = cornerstone.pixelToCanvas(element, { - x: image.width, - y: image.height - }); - - const $canvas = $(canvas); - const canvasWidth = $canvas.outerWidth(); - const canvasHeight = $canvas.outerHeight(); - - const result = {}; - result['x-1'] = allow.L && (topLeft.x > labelWidth); - result['y-1'] = allow.T && (topLeft.y > labelHeight); - result.x1 = allow.R && (canvasWidth - bottomRight.x > labelWidth); - result.y1 = allow.B && (canvasHeight - bottomRight.y > labelHeight); - - return result; - }; - - const getRenderingInformation = (limits, tool) => { - const mid = {}; - mid.x = limits.x / 2; - mid.y = limits.y / 2; - - const directions = {}; - directions.x = tool.x < mid.x ? -1 : 1; - directions.y = tool.y < mid.y ? -1 : 1; - - const diffX = directions.x < 0 ? tool.x : limits.x - tool.x; - const diffY = directions.y < 0 ? tool.y : limits.y - tool.y; - let cornerAxis = diffY < diffX ? 'y' : 'x'; - - const map = { - 'x-1': 'L', - 'y-1': 'T', - x1: 'R', - y1: 'B' - }; - - let current = 0; - while (current < 4 && !allow[map[cornerAxis + directions[cornerAxis]]]) { - // Invert the direction for the next iteration - directions[cornerAxis] *= -1; - - // Invert the tempCornerAxis - cornerAxis = cornerAxis === 'x' ? 'y' : 'x'; - - current++; - } - - return { - directions, - cornerAxis - }; - }; - - const calculateAxisCenter = (axis, start, end) => { - const a = start[axis]; - const b = end[axis]; - const lowest = Math.min(a, b); - const highest = Math.max(a, b); - return lowest + ((highest - lowest) / 2); - }; - - const getTextBoxSizeInPixels = (element, bounds) => { - const topLeft = cornerstone.pageToPixel(element, 0, 0); - const bottomRight = cornerstone.pageToPixel(element, bounds.x, bounds.y); - return { - x: bottomRight.x - topLeft.x, - y: bottomRight.y - topLeft.y - }; - }; - - function getTextBoxOffset(config, cornerAxis, toolAxis, boxSize) { - config = config || {}; - const centering = config.centering || {}; - const centerX = !!centering.x; - const centerY = !!centering.y; - const halfBoxSizeX = boxSize.x / 2; - const halfBoxSizeY = boxSize.y / 2; - const offset = { - x: [], - y: [] - }; - - if (cornerAxis === 'x') { - const offsetY = centerY ? 0 : halfBoxSizeY; - - offset.x[-1] = centerX ? halfBoxSizeX : 0; - offset.x[1] = centerX ? -halfBoxSizeX : -boxSize.x; - offset.y[-1] = offsetY; - offset.y[1] = offsetY; - } else { - const offsetX = centerX ? 0 : halfBoxSizeX; - - offset.x[-1] = offsetX; - offset.x[1] = offsetX; - offset.y[-1] = centerY ? halfBoxSizeY : 0; - offset.y[1] = centerY ? -halfBoxSizeY : -boxSize.y; - } - - return offset; - } - - const handles = measurementData.handles; - const textBox = handles.textBox; - - const $canvas = $(enabledElement.canvas); - const canvasWidth = $canvas.outerWidth(); - const canvasHeight = $canvas.outerHeight(); - const offset = $canvas.offset(); - const canvasDimensions = { - x: canvasWidth, - y: canvasHeight - }; - - const bounds = {}; - bounds.x = textBox.boundingBox.width; - bounds.y = textBox.boundingBox.height; - - const getHandlePosition = key => _.pick(handles[key], ['x', 'y']); - const start = getHandlePosition('start'); - const end = getHandlePosition('end'); - - const tool = {}; - tool.x = calculateAxisCenter('x', start, end); - tool.y = calculateAxisCenter('y', start, end); - - let limits = {}; - limits.x = image.width; - limits.y = image.height; - - let { directions, cornerAxis } = getRenderingInformation(limits, tool); - - const availableAreas = getAvailableBlankAreas(enabledElement, bounds.x, bounds.y); - const tempDirections = _.clone(directions); - let tempCornerAxis = cornerAxis; - let foundPlace = false; - let current = 0; - while (current < 4) { - if (availableAreas[tempCornerAxis + tempDirections[tempCornerAxis]]) { - foundPlace = true; - break; - } - - // Invert the direction for the next iteration - tempDirections[tempCornerAxis] *= -1; - - // Invert the tempCornerAxis - tempCornerAxis = tempCornerAxis === 'x' ? 'y' : 'x'; - - current++; - } - - let cornerAxisPosition; - if (foundPlace) { - _.extend(directions, tempDirections); - cornerAxis = tempCornerAxis; - cornerAxisPosition = directions[cornerAxis] < 0 ? 0 : limits[cornerAxis]; - } else { - _.extend(limits, canvasDimensions); - - const toolPositionOnCanvas = cornerstone.pixelToCanvas(element, tool); - const renderingInformation = getRenderingInformation(limits, toolPositionOnCanvas); - directions = renderingInformation.directions; - cornerAxis = renderingInformation.cornerAxis; - - const position = { - x: directions.x < 0 ? offset.left : offset.left + canvasWidth, - y: directions.y < 0 ? offset.top : offset.top + canvasHeight - }; - - const pixelPosition = cornerstone.pageToPixel(element, position.x, position.y); - cornerAxisPosition = pixelPosition[cornerAxis]; - } - - const toolAxis = cornerAxis === 'x' ? 'y' : 'x'; - const boxSize = getTextBoxSizeInPixels(element, bounds); - - textBox[cornerAxis] = cornerAxisPosition; - textBox[toolAxis] = tool[toolAxis]; - - // Adjust the text box position reducing its size from the corner axis - const textBoxOffset = getTextBoxOffset(config, cornerAxis, toolAxis, boxSize); - textBox[cornerAxis] += textBoxOffset[cornerAxis][directions[cornerAxis]]; - - // Preventing the text box from partially going outside the canvas area - const topLeft = cornerstone.pixelToCanvas(element, textBox); - const bottomRight = { - x: topLeft.x + bounds.x, - y: topLeft.y + bounds.y - }; - const canvasBorders = { - x0: offset.left, - y0: offset.top, - x1: offset.left + canvasWidth, - y1: offset.top + canvasHeight - }; - if (topLeft[toolAxis] < 0) { - const x = canvasBorders.x0; - const y = canvasBorders.y0; - const pixelPosition = cornerstone.pageToPixel(element, x, y); - textBox[toolAxis] = pixelPosition[toolAxis]; - } else if (bottomRight[toolAxis] > canvasDimensions[toolAxis]) { - const x = canvasBorders.x1 - bounds.x; - const y = canvasBorders.y1 - bounds.y; - const pixelPosition = cornerstone.pageToPixel(element, x, y); - textBox[toolAxis] = pixelPosition[toolAxis]; - } -}; diff --git a/Packages/ohif-core/client/lib/index.js b/Packages/ohif-core/client/lib/index.js deleted file mode 100644 index 92b4570d4..000000000 --- a/Packages/ohif-core/client/lib/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import './blaze.js'; -import './cornerstone.js'; -import './string.js'; -import './ui.js'; -import './utils.js'; -import './viewer.js'; -import './user.js'; diff --git a/Packages/ohif-core/client/lib/string.js b/Packages/ohif-core/client/lib/string.js deleted file mode 100644 index 438e6c1f7..000000000 --- a/Packages/ohif-core/client/lib/string.js +++ /dev/null @@ -1,51 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; - -OHIF.string = {}; - -// Search for some string inside any object or array -OHIF.string.search = (object, query, property=null, result=[]) => { - // Create the search pattern - const pattern = new RegExp($.trim(query), 'i'); - - _.each(object, item => { - // Stop here if item is empty - if (!item) { - return; - } - - // Get the value to be compared - const value = _.isString(property) ? item[property] : item; - - // Check if the value match the pattern - if (_.isString(value) && pattern.test(value)) { - // Add the current item to the result - result.push(item); - } - - if (_.isObject(item)) { - // Search recursively the item if the current item is an object - OHIF.string.search(item, query, property, result); - } - }); - - // Return the found items - return result; -}; - -// Encode any string into a safe format for HTML id attribute -OHIF.string.encodeId = input => { - const string = input && input.toString ? input.toString() : input; - - // Return an underscore if the given string is empty or if it's not a string - if (string === '' || typeof string !== 'string') { - return '_'; - } - - // Create a converter to replace non accepted chars - const converter = match => '_' + match[0].charCodeAt(0).toString(16) + '_'; - - // Encode the given string and return it - return string.replace(/[^a-zA-Z0-9-]/g, converter); -}; diff --git a/Packages/ohif-core/client/lib/third-party/transition-to-from-auto.js b/Packages/ohif-core/client/lib/third-party/transition-to-from-auto.js deleted file mode 100644 index a32fd8603..000000000 --- a/Packages/ohif-core/client/lib/third-party/transition-to-from-auto.js +++ /dev/null @@ -1,151 +0,0 @@ -/*! - * transition-to-from-auto 0.5.2 - * https://github.com/75lb/transition-to-from-auto - * Copyright 2015 Lloyd Brookes <75pound@gmail.com> - */ - -/** -@module -@alias transition -*/ -(function(window, document){ - "use strict"; - - var getComputedStyle = window.getComputedStyle; - var isTransition = "data-ttfaInTransition"; - - var elements = []; - var data = []; - - // Transition detecting - var transitionProp = false; - var transitionEnd = false; - var testStyle = document.createElement("a").style; - var testProp; - - if(testStyle[testProp = "webkitTransition"] !== undefined) { - transitionProp = testProp; - transitionEnd = testProp + "End"; - } - - if(testStyle[testProp = "transition"] !== undefined) { - transitionProp = testProp; - transitionEnd = testProp + "end"; - } - - function process(options, data) { - var el = options.element; - var val = options.val; - var prop = options.prop; - var style = el.style; - var startVal; - var autoVal; - - if(!transitionProp) { - return style[prop] = val; - } - - if(el.hasAttribute(isTransition)) { - el.removeEventListener(transitionEnd, data.l); - } else { - style[transitionProp] = "none"; - - startVal = getComputedStyle(el)[prop]; - style[prop] = "auto"; - autoVal = getComputedStyle(el)[prop]; - - // Interrupt - if(startVal === val || val === "auto" && startVal === autoVal) { - return; - } - - data.auto = autoVal; - el.setAttribute(isTransition, 1); - - // Transition - style[prop] = startVal; - el.offsetWidth; - style[transitionProp] = options.style; - } - - style[prop] = val === "auto" ? data.auto : val; - - data.l = function (e) { - if(e.propertyName === prop) { - el.removeAttribute(isTransition); - el.removeEventListener(transitionEnd, data.l); - if(val === "auto") { - /* avoid transition flashes in Safari */ - style[transitionProp] = "none"; - style[prop] = val; - } - } - }; - - el.addEventListener(transitionEnd, data.l); - } - - /** - @param options {Object} - @param options.element {string | element} - The DOM element or selector to transition - @param options.val {string} - The value you want to transition to - @param [options.prop] {string} - The CSS property to transition, defaults to `"height"` - @param [options.style] {string} - The desired value for the `transition` CSS property (e.g. `"height 1s"`). If specified, this value is added inline and will override your CSS. Leave this value blank if you already have it defined in your stylesheet. - @alias module:transition-to-from-auto - */ - function transition(options){ - var element = options.element; - var datum; - var index; - - if(typeof element === "string") { - element = document.querySelector(element); - } - - element = options.element = element instanceof Node ? element : false; - options.prop = options.prop || "height"; - options.style = options.style || ""; - - if(element) { - index = elements.indexOf(element); - if(~index) { - datum = data[index]; - } else { - datum = {}; - elements.push(element); - data.push(datum); - } - - process(options, datum); - } - } - - /** - The name of the vendor-specific transition CSS property - @type {string} - @example - el.style[transition.prop + 'Duration'] = '1s'; - */ - transition.prop = transitionProp; - - /** - * The name of the [transition end event](https://developer.mozilla.org/en-US/docs/Web/Events/transitionend) in the current browser (typically `"transitionend"` or `"webkitTransitionEnd"`) - * @type {string} - * @example - * el.addEventListener(transition.end, function(){ - * // the transition ended.. - * }); - */ - transition.end = transitionEnd; - - - if (typeof module === "object" && module.exports){ - module.exports = transition; - } else if (typeof define === "function" && define.amd){ - define(function(){ - return transition; - }); - } else { - window.transition = transition; - } -})(window, document); diff --git a/Packages/ohif-core/client/lib/ui.js b/Packages/ohif-core/client/lib/ui.js deleted file mode 100644 index 3e5aac43d..000000000 --- a/Packages/ohif-core/client/lib/ui.js +++ /dev/null @@ -1,90 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Meteor } from 'meteor/meteor'; - -// Get the UI settings -const ui = Meteor.settings && Meteor.settings.public && Meteor.settings.public.ui; -OHIF.uiSettings = ui || {}; - -/** - * Get the offset for the given element - * - * @param {Object} element DOM element which will have the offser calculated - * @returns {Object} Object containing the top and left offset - */ -OHIF.ui.getOffset = element => { - let top = 0; - let left = 0; - if (element.offsetParent) { - do { - left += element.offsetLeft; - top += element.offsetTop; - } while (element = element.offsetParent); - } - - return { - left, - top - }; -}; - -/** - * Get the vertical and horizontal scrollbar sizes - * Got from https://stackoverflow.com/questions/986937/how-can-i-get-the-browsers-scrollbar-sizes - * - * @returns {Array} Array containing the scrollbar horizontal and vertical sizes - */ -OHIF.ui.getScrollbarSize = () => { - const inner = document.createElement('p'); - inner.style.width = '100%'; - inner.style.height = '100%'; - - const outer = document.createElement('div'); - outer.style.position = 'absolute'; - outer.style.top = '0px'; - outer.style.left = '0px'; - outer.style.visibility = 'hidden'; - outer.style.width = '100px'; - outer.style.height = '100px'; - outer.style.overflow = 'hidden'; - outer.appendChild(inner); - - document.body.appendChild(outer); - - const w1 = inner.offsetWidth; - const h1 = inner.offsetHeight; - outer.style.overflow = 'scroll'; - let w2 = inner.offsetWidth; - let h2 = inner.offsetHeight; - - if (w1 === w2) { - w2 = outer.clientWidth; - } - - if (h1 === h2) { - h2 = outer.clientHeight; - } - - document.body.removeChild(outer); - - return [(w1 - w2), (h1 - h2)]; -}; - -/** - * Check if the pressed key combination will result in a character input - * Got from https://stackoverflow.com/questions/4179708/how-to-detect-if-the-pressed-key-will-produce-a-character-inside-an-input-text - * - * @returns {Boolean} Wheter the pressed key combination will input a character or not - */ -OHIF.ui.isCharacterKeyPress = event => { - if (typeof event.which === 'undefined') { - // This is IE, which only fires keypress events for printable keys - return true; - } else if (typeof event.which === 'number' && event.which > 0) { - // In other browsers except old versions of WebKit, event.which is - // only greater than zero if the keypress is a printable key. - // We need to filter out backspace and ctrl/alt/meta key combinations - return !event.ctrlKey && !event.metaKey && !event.altKey && event.which !== 8; - } - - return false; -}; diff --git a/Packages/ohif-core/client/lib/user.js b/Packages/ohif-core/client/lib/user.js deleted file mode 100644 index eacfb8dbf..000000000 --- a/Packages/ohif-core/client/lib/user.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.user = OHIF.user || {}; - -// These should be overridden by the implementation -OHIF.user.schema = null; -OHIF.user.userLoggedIn = () => false; -OHIF.user.getUserId = () => null; -OHIF.user.getName = () => null; -OHIF.user.getAccessToken = () => null; -OHIF.user.login = () => new Promise((resolve, reject) => reject()); -OHIF.user.logout = () => new Promise((resolve, reject) => reject()); -OHIF.user.getData = (key) => null; -OHIF.user.setData = (key, value) => null; -OHIF.user.validate = () => null; diff --git a/Packages/ohif-core/client/lib/utils.js b/Packages/ohif-core/client/lib/utils.js deleted file mode 100644 index 7bd90c660..000000000 --- a/Packages/ohif-core/client/lib/utils.js +++ /dev/null @@ -1,42 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -// Return the array sorting function for its object's properties -OHIF.utils.sortBy = function() { - var fields = [].slice.call(arguments), - n_fields = fields.length; - - return function(A, B) { - var a, b, field, key, primer, reverse, result, i; - - for (i = 0; i < n_fields; i++) { - result = 0; - field = fields[i]; - - key = typeof field === 'string' ? field : field.name; - - a = A[key]; - b = B[key]; - - if (typeof field.primer !== 'undefined') { - a = field.primer(a); - b = field.primer(b); - } - - reverse = (field.reverse) ? -1 : 1; - - if (a < b) { - result = reverse * -1; - } - - if (a > b) { - result = reverse * 1; - } - - if (result !== 0) { - break; - } - } - - return result; - }; -}; diff --git a/Packages/ohif-core/client/lib/viewer.js b/Packages/ohif-core/client/lib/viewer.js deleted file mode 100644 index a1674ee63..000000000 --- a/Packages/ohif-core/client/lib/viewer.js +++ /dev/null @@ -1,3 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.viewer = {}; \ No newline at end of file diff --git a/Packages/ohif-core/client/routes.js b/Packages/ohif-core/client/routes.js deleted file mode 100644 index c63bd984a..000000000 --- a/Packages/ohif-core/client/routes.js +++ /dev/null @@ -1,14 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { $ } from 'meteor/jquery'; -import { Router } from 'meteor/clinical:router'; - -Router.onRun(function() { - $(document.body).trigger('ohif.navigated'); - this.next(); -}); - -if (Meteor.isDevelopment) { - Router.route('/playground', function() { - this.render('componentPlayground'); - }); -} diff --git a/Packages/ohif-core/client/ui/bounded/bounded.js b/Packages/ohif-core/client/ui/bounded/bounded.js deleted file mode 100644 index 1a69b030d..000000000 --- a/Packages/ohif-core/client/ui/bounded/bounded.js +++ /dev/null @@ -1,240 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -// Allow attaching to jQuery selectors -$.fn.bounded = function(options) { - _.each(this, element => { - const boundedInstance = $(element).data('boundedInstance'); - if (options === 'destroy' && boundedInstance) { - $(element).removeData('boundedInstance'); - boundedInstance.destroy(); - } else { - if (boundedInstance) { - boundedInstance.options(options); - } else { - $(element).data('boundedInstance', new Bounded(element, options)); - } - } - }); - - return this; -}; - -/** - * This class makes an element bounded to other element's borders. - */ -class Bounded { - - // Initialize the instance with the given element and options - constructor(element, options={}) { - this.element = element; - this.$element = $(element); - this.options(options); - this.setBoundedFlag(false); - - // Force to hardware acceleration to move element if browser supports translate property - this.useTransform = OHIF.ui.styleProperty.check('transform', 'translate(1px, 1px)'); - } - - // Set or change the instance options - options(options={}) { - // Process the given options and store it in the instance - const { boundingElement, positionElement, dimensionElement, allowResizing } = options; - this.positionElement = positionElement || this.element; - this.$positionElement = $(this.positionElement); - this.dimensionElement = dimensionElement || this.element; - this.$dimensionElement = $(this.dimensionElement); - this.boundingElement = boundingElement; - this.$boundingElement = $(this.boundingElement); - this.allowResizing = allowResizing; - - // Check for fixed positioning - if (this.$positionElement.css('position') === 'fixed') { - this.boundingElement = window; - } - - // Destroy and initialize again the instance - this.destroy(); - this.init(); - } - - // Initialize the bounding behaviour - init() { - // Create the event handlers - this.defineEventHandlers(); - - // Attach the created event handlers to the component - this.attachEventHandlers(); - - // Add the bounded class to the element - this.$element.addClass('bounded'); - - // Handle the positioning on window resize - const $window = $(window); - const windowResizeHandler = () => { - // Check if the element is still in DOM and remove the handler if it is not - if (!this.$element.closest(document.documentElement).length) { - $window.off('resize', windowResizeHandler); - } - - this.$element.trigger('spatialChanged'); - }; - - $window.on('resize', windowResizeHandler); - - // Trigger the bounding check for the first timepoint - setTimeout(() => this.$element.trigger('spatialChanged')); - } - - // Destroy this instance, returning the element to its previous state - destroy() { - // Detach the event handlers - this.detachEventHandlers(); - - // Remove the bounded class from the element - this.$element.removeClass('bounded'); - } - - static spatialInfo(positionElement, dimensionElement) { - // Create the result object - const result = {}; - - // Check if the element is the window - if (!dimensionElement || dimensionElement === window) { - const $window = $(window); - const width = $window.outerWidth(); - const height = $window.outerHeight(); - return { - width, - height, - x0: 0, - y0: 0, - x1: width, - y1: height - }; - } - - // Get the jQuery object for the elements - const $dimensionElement = $(dimensionElement); - const $positionElement = $(positionElement); - - // Get the integer numbers for element's width - result.width = $dimensionElement.outerWidth(); - - // Get the integer numbers for element's height - result.height = $dimensionElement.outerHeight(); - - // Get the position property based on the element position CSS attribute - const elementPosition = $positionElement.css('position'); - const positionProperty = elementPosition === 'fixed' ? 'position' : 'offset'; - - // Get the element's start position - const position = $positionElement[positionProperty](); - result.x0 = position.left; - result.y0 = position.top; - - // Get the element's end position - result.x1 = result.x0 + result.width; - result.y1 = result.y0 + result.height; - - // Return the result object - return result; - } - - // Define the event handlers for this class - defineEventHandlers() { - this.cssPositionHandler = (elementInfo, boundingInfo) => { - // Fix element's x positioning and width - if (this.allowResizing && elementInfo.width > boundingInfo.width) { - this.$dimensionElement.width(boundingInfo.width); - this.$positionElement.css('left', boundingInfo.x0); - this.setBoundedFlag(true); - } else if (elementInfo.x0 < boundingInfo.x0) { - this.$positionElement.css('left', boundingInfo.x0); - this.setBoundedFlag(true); - } else if (elementInfo.x1 > boundingInfo.x1) { - this.$positionElement.css('left', boundingInfo.x1 - elementInfo.width); - this.setBoundedFlag(true); - } - - // Fix element's y positioning and height - if (this.allowResizing && elementInfo.height > boundingInfo.height) { - this.$dimensionElement.height(boundingInfo.height); - this.$positionElement.css('top', boundingInfo.y0); - this.setBoundedFlag(true); - } else if (elementInfo.y0 < boundingInfo.y0) { - this.$positionElement.css('top', boundingInfo.y0); - this.setBoundedFlag(true); - } else if (elementInfo.y1 > boundingInfo.y1) { - this.$positionElement.css('top', boundingInfo.y1 - elementInfo.height); - this.setBoundedFlag(true); - } - }; - - this.getCSSTranslate = () => { - const matrixToArray = str => str.match(/(-?[0-9\.]+)/g); - const transformMatrix = matrixToArray(this.$positionElement.css('transform')) || []; - return { - x: parseFloat(transformMatrix[4]) || 0, - y: parseFloat(transformMatrix[5]) || 0 - }; - }; - - this.cssTransformHandler = (elementInfo, boundingInfo, translate) => { - if (elementInfo.x1 > boundingInfo.x1) { - translate.x -= elementInfo.x1 - boundingInfo.x1; - } - - if (elementInfo.y1 > boundingInfo.y1) { - translate.y -= elementInfo.y1 - boundingInfo.y1; - } - - if (elementInfo.x0 < boundingInfo.x0) { - translate.x += boundingInfo.x0 - elementInfo.x0; - } - - if (elementInfo.y0 < boundingInfo.y0) { - translate.y += boundingInfo.y0 - elementInfo.y0; - } - - const translation = `translate(${translate.x}px, ${translate.y}px)`; - OHIF.ui.styleProperty.set(this.positionElement, 'transform', translation); - }; - - this.spatialChangedHandler = event => { - // Get the spatial information for element and its bounding element - const { positionElement, dimensionElement, boundingElement, useTransform } = this; - const elementInfo = Bounded.spatialInfo(positionElement, dimensionElement); - const boundingInfo = Bounded.spatialInfo(boundingElement, boundingElement); - - // Check if CSS positioning or transform will be used - const translate = this.getCSSTranslate(); - if (useTransform && (translate.x || translate.y)) { - this.cssTransformHandler(elementInfo, boundingInfo, translate); - } else { - this.cssPositionHandler(elementInfo, boundingInfo); - } - }; - } - - // Attach the event handlers to the element in order to bound it - attachEventHandlers() { - this.$element.on('spatialChanged', this.spatialChangedHandler); - this.$boundingElement.on('resize', this.spatialChangedHandler); - } - - // Detach the event handlers from the element - detachEventHandlers() { - this.$element.off('spatialChanged', this.spatialChangedHandler); - this.$boundingElement.off('resize', this.spatialChangedHandler); - } - - // This is a means to let outside world know that the element in question has been moved - setBoundedFlag(value) { - this.$element.data('wasBounded', value); - } - -} - -OHIF.ui.Bounded = Bounded; diff --git a/Packages/ohif-core/client/ui/dialog/display.js b/Packages/ohif-core/client/ui/dialog/display.js deleted file mode 100644 index 810e77d6e..000000000 --- a/Packages/ohif-core/client/ui/dialog/display.js +++ /dev/null @@ -1,94 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -let zIndexBackdrop = 1060; -let zIndexModal = 1061; - -OHIF.ui.showDialog = (templateName, dialogData={}) => { - // Check if the given template exists - const template = Template[templateName]; - if (!template) { - throw { - name: 'TEMPLATE_NOT_FOUND', - message: `Template ${templateName} not found.` - }; - } - - let promise; - let templateData; - if (dialogData && dialogData.promise instanceof Promise) { - // Use the given promise to control the modal - promise = dialogData.promise; - templateData = dialogData; - } else { - // Create a new promise to control the modal and store its resolve and reject callbacks - let promiseResolve; - let promiseReject; - promise = new Promise((resolve, reject) => { - promiseResolve = resolve; - promiseReject = reject; - }); - - // Render the dialog with the given template passing the promise object and callbacks - templateData = _.extend({}, dialogData, { - promise, - promiseResolve, - promiseReject - }); - } - - const view = Blaze.renderWithData(template, templateData, document.body); - - const node = view.firstNode(); - const $node = node && $(node); - - let $modal; - if ($node && $node.hasClass('modal')) { - $modal = $node; - } else if ($node && $node.has('.modal')) { - $modal = $node.find('.modal:first'); - } - - $modal.one('show.bs.modal', function() { - setTimeout(() => { - const $modal = $(this); - const modal = $modal.data('bs.modal'); - if (!modal) return; - const { $backdrop } = modal; - if (!$backdrop) return; - $backdrop.css('z-index', zIndexBackdrop); - $modal.css('z-index', zIndexModal); - zIndexBackdrop += 2; - zIndexModal += 2; - }); - }); - - // Destroy the created dialog view when the promise is either resolved or rejected - const dismissModal = (hideFirst=false) => { - if (hideFirst || (dialogData && dialogData.promise && $modal)) { - $modal.one('hidden.bs.modal', () => Blaze.remove(view)).modal('hide'); - } else { - Blaze.remove(view); - } - }; - - // Create a handler to dismiss the modal on navigation - const $body = $(document.body); - const navigationHandler = () => { - dismissModal(true); - $body.off('ohif.navigated', navigationHandler); - }; - - promise.then(() => dismissModal(false)).catch(() => dismissModal(false)); - - // Dismiss the modal if navigation occurs and it should not be kept opened - if (!dialogData.keepOpenOnNavigation) { - $body.on('ohif.navigated', navigationHandler); - } - - // Return the promise to allow callbacks stacking from outside - return promise; -}; diff --git a/Packages/ohif-core/client/ui/dialog/spatial.js b/Packages/ohif-core/client/ui/dialog/spatial.js deleted file mode 100644 index 94919bec4..000000000 --- a/Packages/ohif-core/client/ui/dialog/spatial.js +++ /dev/null @@ -1,30 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.ui.repositionDialog = ($modal, x, y) => { - const $dialog = $modal.find('.modal-dialog'); - - // Remove the margins and set its position as fixed - $dialog.css({ - margin: 0, - position: 'fixed' - }).bounded(); - - // Temporarily show the modal - const isVisible = $modal.is(':visible'); - $modal.show(); - - // Calculate the center position on screen - const height = $dialog.outerHeight(); - const width = $dialog.outerWidth(); - const left = parseInt(x - (width / 2)); - const top = parseInt(y - (height / 2)); - - // Reposition the modal and readjust it to the window boundaries if needed - $dialog.css({ - left, - top - }).trigger('spatialChanged').one('transitionend', () => $dialog.trigger('spatialChanged')); - - // Switch the modal to its previous visibility state - $modal.toggle(isVisible); -}; diff --git a/Packages/ohif-core/client/ui/dialog/unsavedChangesDialog.js b/Packages/ohif-core/client/ui/dialog/unsavedChangesDialog.js deleted file mode 100644 index 8d341e365..000000000 --- a/Packages/ohif-core/client/ui/dialog/unsavedChangesDialog.js +++ /dev/null @@ -1,14 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.ui.unsavedChangesDialog = function(callback, options) { - - // Render the dialog with the given template passing the promise object and callbacks - const templateData = _.extend({}, options, { - callback: callback - }); - Blaze.renderWithData(Template.unsavedChangesDialog, templateData, document.body); - -}; diff --git a/Packages/ohif-core/client/ui/dimensional/dimensional.js b/Packages/ohif-core/client/ui/dimensional/dimensional.js deleted file mode 100644 index 7f143cf9e..000000000 --- a/Packages/ohif-core/client/ui/dimensional/dimensional.js +++ /dev/null @@ -1,50 +0,0 @@ -import { $ } from 'meteor/jquery'; - -// Temporarily show and hide the element to enable dimension calculations -$.fn.tempShow = function(callback) { - const elementsToHide = []; - let current = this; - - // Temporarily show all parent invisible elements until body - while (this.is(':hidden')) { - const $element = $(current); - if (!$element.length || $element.is(':visible')) { - break; - } - - $element.addClass('visible'); - elementsToHide.push(current); - current = $element[0].parentElement; - } - - if (typeof callback === 'function') { - callback(this); - } - - $(elementsToHide).removeClass('visible'); - - return this; -}; - -// Adjust the max width/height to enable CSS3 transitions -$.fn.adjustMax = function(dimension, modifierFn) { - const $element = $(this); - - // Temporarily make the element visible to allow getting its dimensions - $element.tempShow(() => { - const maxProperty = `max-${dimension}`; - - // Remove the current max restriction - $element.each((i, e) => e.style.setProperty(maxProperty, 'none', 'important')); - - // Get the dimension function to obtain the outer dimension - const dimensionFn = 'outer' + dimension.charAt(0).toUpperCase() + dimension.slice(1); - const value = $element[dimensionFn](); - - // Remove the property (needed for IE) - $element.each((i, e) => e.style.removeProperty(maxProperty)); - - // Set the new max restriction - $element.css(maxProperty, value); - }); -}; diff --git a/Packages/ohif-core/client/ui/dimensional/dimensional.styl b/Packages/ohif-core/client/ui/dimensional/dimensional.styl deleted file mode 100644 index 13ff4c84a..000000000 --- a/Packages/ohif-core/client/ui/dimensional/dimensional.styl +++ /dev/null @@ -1,2 +0,0 @@ -body *.visible - display: block !important diff --git a/Packages/ohif-core/client/ui/draggable/draggable.js b/Packages/ohif-core/client/ui/draggable/draggable.js deleted file mode 100644 index a896dd9be..000000000 --- a/Packages/ohif-core/client/ui/draggable/draggable.js +++ /dev/null @@ -1,229 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -// Allow attaching to jQuery selectors -$.fn.draggable = function(options) { - makeDraggable(this, options); - return this; -}; - -/** - * This function makes an element movable around the page. - * It supports mouse and touch input and allows whichever element - * is specified to be moved to any arbitrary position. - * - * @param element - */ -function makeDraggable(element, options={}) { - const $element = element; - const $document = $(document); - const $body = $(document.body); - - // Force to hardware acceleration to move element if browser supports translate property - const { styleProperty } = OHIF.ui; - const useTransform = styleProperty.check('transform', 'translate(1px, 1px)'); - - const $container = $(options.container || window); - let diffX; - let diffY; - let wasNotDragged = true; - let dragging = false; - - let lastCursor, lastOffset; - let lastTranslateX = 0; - let lastTranslateY = 0; - - let initialCursor; - - // initialize dragged flag - $element.data('wasDragged', false); - - function matrixToArray(str) { - return str.match(/(-?[0-9\.]+)/g); - } - - function getCursorCoords(e) { - const cursor = { - x: e.clientX, - y: e.clientY - }; - - // Handle touchMove cases - if (cursor.x === undefined) { - cursor.x = e.originalEvent.touches[0].pageX; - } - - if (cursor.y === undefined) { - cursor.y = e.originalEvent.touches[0].pageY; - } - - return cursor; - } - - function reposition(elementLeft, elementTop) { - if (useTransform) { - const translation = `translate(${elementLeft}px, ${elementTop}px)`; - styleProperty.set($element[0], 'transform', translation); - } else { - $element.css({ - left: elementLeft + 'px', - top: elementTop + 'px', - bottom: 'auto', // Setting these to empty doesn't seem to work in Firefox or Safari - right: 'auto' - }); - } - } - - function startMoving(e) { - // Prevent dragging dialog by clicking on slider - // (could be extended for buttons, not sure it's necessary - if (e.target.type && e.target.type === 'range') { - return; - } - - // Stop the dragging if it's not the primary button - if (e.button !== 0) return; - - // Stop the dragging if the element is being resized - if ($element.hasClass('resizing')) { - return; - } - - let elementLeft = parseFloat($element.offset().left); - let elementTop = parseFloat($element.offset().top); - - const cursor = getCursorCoords(e); - if (useTransform) { - lastCursor = cursor; - lastOffset = $element.offset(); - const transformMatrix = matrixToArray($element.css('transform')) || []; - lastTranslateX = parseFloat(transformMatrix[4]) || 0; - lastTranslateY = parseFloat(transformMatrix[5]) || 0; - elementLeft = lastTranslateX; - elementTop = lastTranslateY; - } else { - diffX = cursor.x - elementLeft; - diffY = cursor.y - elementTop; - } - - reposition(elementLeft, elementTop); - - $document.on('mousemove', moveHandler); - $document.on('mouseup', stopMoving); - - $document.on('touchmove', moveHandler); - $document.on('touchend', stopMoving); - } - - function stopMoving() { - $body.css('cursor', ''); - $container.css('cursor', ''); - $element.css('cursor', ''); - - if (dragging) { - setTimeout(() => $element.removeClass('dragging')); - dragging = false; - } - - $document.off('mousemove', moveHandler); - $document.off('touchmove', moveHandler); - } - - function moveHandler(e) { - if (!dragging) { - $body.css('cursor', 'move'); - $container.css('cursor', 'move'); - $element.css('cursor', 'move'); - $element.addClass('dragging'); - dragging = true; - } - - // let outside world know that the element in question has been dragged - if (wasNotDragged) { - $element.data('wasDragged', true); - wasNotDragged = false; - } - - // Prevent dialog box dragging whole page in iOS - e.preventDefault(); - - const elementWidth = parseFloat($element.outerWidth()); - const elementHeight = parseFloat($element.outerHeight()); - const containerWidth = parseFloat($container.width()); - const containerHeight = parseFloat($container.height()); - - const cursor = getCursorCoords(e); - - let elementLeft, elementTop; - if (useTransform) { - elementLeft = lastTranslateX - (lastCursor.x - cursor.x); - elementTop = lastTranslateY - (lastCursor.y - cursor.y); - - const limitX = containerWidth - elementWidth; - const limitY = containerHeight - elementHeight; - const sumX = lastOffset.left + (elementLeft - lastTranslateX); - const sumY = lastOffset.top + (elementTop - lastTranslateY); - - if (sumX > limitX) { - elementLeft -= sumX - limitX; - } - - if (sumY > limitY) { - elementTop -= sumY - limitY; - } - - if (sumX < 0) { - elementLeft += 0 - sumX; - } - - if (sumY < 0) { - elementTop += 0 - sumY; - } - } else { - elementLeft = cursor.x - diffX; - elementTop = cursor.y - diffY; - - elementLeft = Math.max(elementLeft, 0); - elementTop = Math.max(elementTop, 0); - - if (elementLeft + elementWidth > containerWidth) { - elementLeft = containerWidth - elementWidth; - } - - if (elementTop + elementHeight > containerHeight) { - elementTop = containerHeight - elementHeight; - } - } - - reposition(elementLeft, elementTop); - } - - function mouseDownHandler(e) { - initialCursor = getCursorCoords(e); - $document.on('mousemove', moveDetectHandler); - $document.on('touchmove', moveDetectHandler); - } - - function mouseUpHandler() { - $document.off('mousemove', moveDetectHandler); - $document.off('touchmove', moveDetectHandler); - } - - function moveDetectHandler(e) { - const currentCursor = getCursorCoords(e); - - const c1 = initialCursor; - const c2 = currentCursor; - const distance = Math.hypot(c2.x - c1.x, c2.y - c1.y); - - if (distance > 5) { - mouseUpHandler(); - startMoving(e); - } - } - - $element.on('mousedown', mouseDownHandler); - $element.on('touchstart', mouseDownHandler); - - $element.on('mouseup', mouseUpHandler); - $element.on('touchend', mouseUpHandler); -} diff --git a/Packages/ohif-core/client/ui/dropdown/class.js b/Packages/ohif-core/client/ui/dropdown/class.js deleted file mode 100644 index d7b1a5979..000000000 --- a/Packages/ohif-core/client/ui/dropdown/class.js +++ /dev/null @@ -1,38 +0,0 @@ -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -class Dropdown { - constructor() { - this.observer = new Tracker.Dependency(); - this._items = []; - this.observer.changed(); - } - - clearItems() { - this._items = []; - this.observer.changed(); - } - - setItems(items) { - this._items = items; - this.observer.changed(); - } - - addItem(item) { - this._items.push(item); - this.observer.changed(); - } - - removeItem(item) { - this._items = _.without(this._items, item); - this.observer.changed(); - } - - getItems() { - this.observer.depend(); - return this._items; - } -} - -OHIF.ui.Dropdown = Dropdown; diff --git a/Packages/ohif-core/client/ui/dropdown/display.js b/Packages/ohif-core/client/ui/dropdown/display.js deleted file mode 100644 index 277f24447..000000000 --- a/Packages/ohif-core/client/ui/dropdown/display.js +++ /dev/null @@ -1,43 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.ui.showDropdown = (items=[], options={}) => { - let promiseResolve; - let promiseReject; - const promise = new Promise((resolve, reject) => { - promiseResolve = resolve; - promiseReject = reject; - }); - - // Prepare the method to destroy the view - let view; - const destroyView = () => Blaze.remove(view); - - // Create the data object that the dropdown will receive - const templateData = { - items, - options, - destroyView, - promise, - promiseResolve, - promiseReject - }; - - // Render the dialog with the given template and data - const parentElement = options.parentElement || document.body; - view = Blaze.renderWithData(Template.dropdownForm, templateData, parentElement); - - // Create a handler to dismiss the dropdown on navigation - const $body = $(document.body); - const navigationHandler = () => { - promiseReject(); - $body.off('ohif.navigated', navigationHandler); - }; - - // Dismiss the dropdown if navigation occurs - $body.on('ohif.navigated', navigationHandler); - - // Return the promise to allow callbacks stacking from outside - return promise; -}; diff --git a/Packages/ohif-core/client/ui/handleError.js b/Packages/ohif-core/client/ui/handleError.js deleted file mode 100644 index 7d09d2a91..000000000 --- a/Packages/ohif-core/client/ui/handleError.js +++ /dev/null @@ -1,35 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.ui.handleError = error => { - let { title, message } = error; - - if (!title) { - if (error instanceof Meteor.Error) { - title = error.error; - } else if (error instanceof Error) { - title = error.name; - } - } - - if (!message) { - if (error instanceof Meteor.Error) { - message = error.reason; - } else if (error instanceof Error) { - message = error.message; - } - } - - const data = Object.assign({ - title, - message, - class: 'themed', - hideConfirm: true, - cancelLabel: 'Dismiss', - cancelClass: 'btn-secondary' - }, error || {}); - - OHIF.log.error(error); - // TODO: Find a better way to handle errors instead of displaying a dialog for all of them. - // OHIF.ui.showDialog('dialogForm', data); -}; diff --git a/Packages/ohif-core/client/ui/index.js b/Packages/ohif-core/client/ui/index.js deleted file mode 100644 index 88b79fd10..000000000 --- a/Packages/ohif-core/client/ui/index.js +++ /dev/null @@ -1,14 +0,0 @@ -import './bounded/bounded.js'; -import './dimensional/dimensional.js'; -import './dialog/display.js'; -import './dialog/spatial.js'; -import './dialog/unsavedChangesDialog.js'; -import './draggable/draggable.js'; -import './dropdown/class.js'; -import './dropdown/display.js'; -import './notifications/notifications.js'; -import './popover/display.js'; -import './resizable/resizable.js'; -import './unsavedChanges/unsavedChanges.js'; -import './handleError.js'; -import './styleProperty.js'; diff --git a/Packages/ohif-core/client/ui/notifications/notifications.js b/Packages/ohif-core/client/ui/notifications/notifications.js deleted file mode 100644 index 23c550c70..000000000 --- a/Packages/ohif-core/client/ui/notifications/notifications.js +++ /dev/null @@ -1,112 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -const Notifications = { - currentId: 0, - views: new Map() -}; - -// Remove the view object from DOM and from views Map -const removeView = (id, view) => { - Notifications.views.delete(id); - Blaze.remove(view); -}; - -// Dismiss a single notification note by its id -Notifications.dismiss = id => { - const view = Notifications.views.get(id); - if (!view || view.isDestroyed) { - return Notifications.views.delete(id); - } - - const node = view.firstNode(); - const $note = node && $(node); - - if ($note.length) { - $note.addClass('out').one('transitionend', () => removeView(id, view)); - } else { - removeView(id, view); - } -}; - -// Dismiss all notification notes -Notifications.clear = () => Array.from(Notifications.views.keys()).forEach(Notifications.dismiss); - -// Display a notification note -Notifications.show = ({ template, data, text, style, timeout=5000, promise }) => { - // Check if the given template exists - const templateObject = Template[template]; - if (template && !templateObject) { - throw new Meteor.Error('TEMPLATE_NOT_FOUND', `Template ${template} not found.`); - } - - // Check if there is a notification area container - const $area = $('#notificationArea'); - if (!$area.length) { - throw new Meteor.Error('NOTIFICATION_AREA_NOT_FOUND', `Notification area not found.`); - } - - let notificationPromise; - let templateData = { - template, - data, - text, - style, - timeout, - id: Notifications.currentId++ - }; - - if (promise instanceof Promise) { - // Use the given promise to control the notification - notificationPromise = templateData.promise = promise; - } else { - // Create a new promise to control the modal and store its resolve and reject callbacks - let promiseResolve; - let promiseReject; - notificationPromise = new Promise((resolve, reject) => { - promiseResolve = resolve; - promiseReject = reject; - }); - - // Render the notification passing the promise object and callbacks - _.extend({}, templateData, { - promise: notificationPromise, - promiseResolve, - promiseReject - }); - } - - const view = Blaze.renderWithData(Template.notificationNote, templateData, $area[0]); - const dismissNotification = () => Notifications.dismiss(templateData.id); - - // Add the current view to the list of views to allow clearing all notifications - Notifications.views.set(templateData.id, view); - - // Destroy the created notification view when the promise is either resolved or rejected - notificationPromise.then(dismissNotification).catch(dismissNotification); - - // Destroy the created notification view if the given timeout time has passed - if (timeout > 0) { - Meteor.setTimeout(() => { - if (templateData.promiseResolve) { - templateData.promiseResolve(); - } else { - dismissNotification(); - } - }, timeout); - } - - // Return the promise to allow callbacks stacking from outside - return notificationPromise; -}; - -Notifications.info = o => Notifications.show(Object.assign({}, o, { style: 'info' })); -Notifications.success = o => Notifications.show(Object.assign({}, o, { style: 'success' })); -Notifications.warning = o => Notifications.show(Object.assign({}, o, { style: 'warning' })); -Notifications.danger = o => Notifications.show(Object.assign({}, o, { style: 'danger' })); - -OHIF.ui.notifications = Notifications; diff --git a/Packages/ohif-core/client/ui/popover/display.js b/Packages/ohif-core/client/ui/popover/display.js deleted file mode 100644 index 2bd5bd9c4..000000000 --- a/Packages/ohif-core/client/ui/popover/display.js +++ /dev/null @@ -1,88 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.ui.showPopover = (templateName, popoverData, options={}) => { - // Check if the given template exists - const template = Template[templateName]; - if (!template) { - throw { - name: 'TEMPLATE_NOT_FOUND', - message: `Template ${templateName} not found.` - }; - } - - let promise; - let templateData; - if (popoverData && popoverData.promise instanceof Promise) { - // Use the given promise to control the modal - promise = popoverData.promise; - templateData = popoverData; - } else { - // Create a new promise to control the modal and store its resolve and reject callbacks - let promiseResolve; - let promiseReject; - promise = new Promise((resolve, reject) => { - promiseResolve = resolve; - promiseReject = reject; - }); - - // Render the dialog with the given template passing the promise object and callbacks - templateData = Object.assign({}, popoverData, { - promise, - promiseResolve, - promiseReject - }); - } - - const { element, event } = options; - const $element = $(element || event.currentTarget); - - const defaults = { - content: '', - html: true, - trigger: 'manual', - placement: 'auto', - delay: { - show: 300, - hide: 300 - } - }; - - const popoverOptions = Object.assign({} , defaults, options); - popoverOptions.content = Blaze.toHTMLWithData(template, popoverData); - - if (popoverOptions.hideOnClick) { - $element.click(function() { - $(this).popover('hide'); - }); - } - - $element.popover(popoverOptions); - - if (popoverOptions.trigger !== 'hover') { - $element.one('shown.bs.popover', function(event) { - const popoverId = $element.attr('aria-describedby'); - const popover = document.getElementById(popoverId); - const $popover = $(popover); - const $popoverContent = $popover.find('.popover-content'); - const dismissPopover = () => $element.popover('hide'); - - $popoverContent.html(''); - - const view = Blaze.renderWithData(template, templateData, $popoverContent[0]); - $element.one('hidden.bs.popover', () => { - Blaze.remove(view); - $element.popover('destroy'); - }); - - promise.then(dismissPopover).catch(dismissPopover); - }); - } - - if (popoverOptions.trigger === 'manual') { - $element.popover('show'); - } - - return promise; -}; diff --git a/Packages/ohif-core/client/ui/resizable/resizable.js b/Packages/ohif-core/client/ui/resizable/resizable.js deleted file mode 100644 index d06cc2f7a..000000000 --- a/Packages/ohif-core/client/ui/resizable/resizable.js +++ /dev/null @@ -1,182 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -// Allow attaching to jQuery selectors -$.fn.resizable = function(options) { - _.each(this, element => { - const resizableInstance = $(element).data('resizableInstance'); - if (options === 'destroy' && resizableInstance) { - $(element).removeData('resizableInstance'); - resizableInstance.destroy(); - } else { - if (resizableInstance) { - resizableInstance.options(options); - } else { - $(element).data('resizableInstance', new Resizable(element, options)); - } - } - }); - - return this; -}; - -/** - * This class makes an element resizable. - */ -class Resizable { - - constructor(element, options={}) { - this.element = element; - this.$element = $(element); - this.options(options); - } - - options(options={}) { - const { boundSize, minWidth, minHeight } = options; - this.minWidth = minWidth || this.$element.width() || 16; - this.minHeight = minHeight || this.$element.height() || 16; - this.boundSize = boundSize || 8; - - this.destroy(); - this.init(); - } - - init() { - this.defineEventHandlers(); - - for (let x = -1; x <= 1; x++) { - for (let y = -1; y <= 1; y++) { - this.createBound(x, y); - } - } - - this.$element.addClass('resizable'); - } - - destroy() { - // Remove the instance added classes - this.$element.removeClass('resizable resizing'); - - // Get the bound borders - const $bound = this.$element.find('resize-bound'); - - // Remove the bound borders - $bound.remove(); - - // Detach the event handlers - this.detachEventHandlers($bound); - } - - defineEventHandlers() { - this.initResizeHandler = event => { - const $window = $(window); - - this.width = this.initialWidth = this.$element.width(); - this.height = this.initialHeight = this.$element.height(); - this.startWidth = this.width; - this.startHeight = this.height; - - this.posX = parseInt(this.$element.css('left')); - this.posY = parseInt(this.$element.css('top')); - this.startPosX = this.posX; - this.startPosY = this.posY; - - this.startX = event.clientX; - this.startY = event.clientY; - - this.$element.addClass('resizing'); - - $window.on('mousemove', event.data, this.resizeHandler); - $window.on('mouseup', event.data, this.endResizeHandler); - }; - - this.resizeHandler = event => { - const { xDirection, yDirection } = event.data; - let x, y; - x = event.clientX < 0 ? 0 : event.clientX; - x = x > window.innerWidth ? window.innerWidth : x; - y = event.clientY < 0 ? 0 : event.clientY; - y = y > window.innerHeight ? window.innerHeight : y; - - const xDistance = (x - this.startX) * xDirection; - const yDistance = (y - this.startY) * yDirection; - - const width = xDistance + this.startWidth; - const height = yDistance + this.startHeight; - this.width = width < this.minWidth ? this.minWidth : width; - this.height = height < this.minHeight ? this.minHeight : height; - this.$element.width(this.width); - this.$element.height(this.height); - - if (xDirection < 0) { - this.posX = this.startPosX - xDistance; - if (width < this.minWidth) { - this.posX = this.startPosX + (this.startWidth - this.minWidth); - } - - this.$element.css('left', `${this.posX}px`); - } - - if (yDirection < 0) { - this.posY = this.startPosY - yDistance; - if (height < this.minHeight) { - this.posY = this.startPosY + (this.startHeight - this.minHeight); - } - - this.$element.css('top', `${this.posY}px`); - } - }; - - this.endResizeHandler = event => { - const $window = $(window); - - $window.off('mousemove', this.resizeHandler); - $window.off('mouseup', this.endResizeHandler); - - this.$element.removeClass('resizing'); - - // Let the listeners know that this element was resized - this.$element.trigger('resize'); - }; - } - - attachEventHandlers($bound, xDirection, yDirection) { - const eventData = { - xDirection, - yDirection - }; - $bound.on('mousedown', eventData, this.initResizeHandler); - } - - detachEventHandlers($bound) { - const $window = $(window); - - $bound.off('mousedown', this.initResizeHandler); - $window.off('mousemove', this.resizeHandler); - $window.off('mouseup', this.endResizeHandler); - } - - createBound(xDirection, yDirection) { - if (xDirection === 0 && xDirection === yDirection) { - return; - } - - const $bound = $('
    '); - - $bound[0].onselectstart = () => false; - - $bound.css('font-size', `${this.boundSize}px`); - - const mapX = ['left', 'center', 'right']; - const mapY = ['top', 'middle', 'bottom']; - $bound.addClass('bound-' + mapX[xDirection + 1]); - $bound.addClass('bound-' + mapY[yDirection + 1]); - - $bound.appendTo(this.$element); - - this.attachEventHandlers($bound, xDirection, yDirection); - } - -} - -OHIF.ui.Resizable = Resizable; diff --git a/Packages/ohif-core/client/ui/resizable/resizable.styl b/Packages/ohif-core/client/ui/resizable/resizable.styl deleted file mode 100644 index 71ba94946..000000000 --- a/Packages/ohif-core/client/ui/resizable/resizable.styl +++ /dev/null @@ -1,58 +0,0 @@ -@import "{ohif:design}/app" - -.resizable - transform(scale(1)) - - &.resizing, .resize-bound - user-select: none - -webkit-touch-callout: none - -webkit-user-select: none - -khtml-user-select: none - -moz-user-select: none - -ms-user-select: none - - &.resizing iframe - pointer-events: none - - .resize-bound - content: '' - line-height: 1em - position: fixed - - .bound-left - left: 0 - width: 1em - - .bound-center - left: 1em - height: 1em - right: 1em - - .bound-right - right: 0 - width: 1em - - .bound-top - top: 0 - height: 1em - - .bound-middle - top: 1em - width: 1em - bottom: 1em - - .bound-bottom - bottom: 0 - height: 1em - - .bound-left.bound-top, .bound-right.bound-bottom - cursor: nwse-resize - - .bound-left.bound-bottom, .bound-right.bound-top - cursor: nesw-resize - - .bound-left.bound-middle, .bound-right.bound-middle - cursor: ew-resize - - .bound-center.bound-top, .bound-center.bound-bottom - cursor: ns-resize diff --git a/Packages/ohif-core/client/ui/styleProperty.js b/Packages/ohif-core/client/ui/styleProperty.js deleted file mode 100644 index 5dcca1d64..000000000 --- a/Packages/ohif-core/client/ui/styleProperty.js +++ /dev/null @@ -1,68 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/* - * https://github.com/swederik/dragula/blob/ccc15d75186f5168e7abadbe3077cf12dab09f8b/styleProperty.js - */ -(function() { - 'use strict'; - - const browserProps = {}; - - function eachVendor(prop, fn) { - const prefixes = ['Webkit', 'Moz', 'ms', 'O']; - fn(prop); - for (let i = 0; i < prefixes.length; i++) { - fn(prefixes[i] + prop.charAt(0).toUpperCase() + prop.slice(1)); - } - } - - function check(property, testValue) { - const sandbox = document.createElement('iframe'); - const element = document.createElement('p'); - - document.body.appendChild(sandbox); - sandbox.contentDocument.body.appendChild(element); - const support = set(element, property, testValue); - - // We have to do this because remove() is not supported by IE11 and below - sandbox.parentElement.removeChild(sandbox); - return support; - } - - function checkComputed(el, prop) { - const computed = window.getComputedStyle(el).getPropertyValue(prop); - return ((computed !== void 0) && computed.length > 0 && computed !== 'none'); - } - - function set(el, prop, value) { - let match = false; - - if (browserProps[prop] === void 0) { - eachVendor(prop, function(vendorProp) { - if (el.style[vendorProp] !== void 0 && match === false) { - el.style[vendorProp] = value; - if (checkComputed(el, vendorProp)) { - match = true; - browserProps[prop] = vendorProp; - } - } - }); - } else { - el.style[browserProps[prop]] = value; - return true; - } - - return match; - } - - const styleProperty = { - check, - set - }; - - OHIF.ui.styleProperty = styleProperty; -}()); - -const { styleProperty } = OHIF.ui; - -export { styleProperty }; diff --git a/Packages/ohif-core/client/ui/unsavedChanges/unsavedChanges.js b/Packages/ohif-core/client/ui/unsavedChanges/unsavedChanges.js deleted file mode 100644 index 237e7babe..000000000 --- a/Packages/ohif-core/client/ui/unsavedChanges/unsavedChanges.js +++ /dev/null @@ -1,555 +0,0 @@ -import { Tracker } from 'meteor/tracker'; -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; - -const FUNCTION = 'function'; -const STRING = 'string'; -const UNDEFINED = 'undefined'; -const WILDCARD = '*'; // "*" is a special name which means "all children". -const SEPARATOR = '.'; - -/** - * Main Namespace Component Class - */ - -class Node { - - constructor() { - this.value = 0; - this.children = {}; - this.handlers = {}; - } - - getPathComponents(path) { - return typeof path === STRING ? path.split(SEPARATOR) : null; - } - - getNodeUpToIndex(path, index) { - - let node = this; - - for (let i = 0; i < index; ++i) { - let item = path[i]; - if (node.children.hasOwnProperty(item)) { - node = node.children[item]; - } else { - node = null; - break; - } - } - - return node; - - } - - append(name, value) { - - const children = this.children; - let node = null; - - if (children.hasOwnProperty(name)) { - node = children[name]; - } else if (typeof name === STRING && name !== WILDCARD) { - node = new Node(); - children[name] = node; - } - - if (node !== null) { - node.value += value > 0 ? parseInt(value) : 0; - } - - return node; - - } - - probe(recursively) { - - let value = this.value; - - // Calculate entire tree value recursively? - if (recursively === true) { - const children = this.children; - for (let item in children) { - if (children.hasOwnProperty(item)) { - value += children[item].probe(recursively); - } - } - } - - return value; - - } - - clear(recursively) { - - this.value = 0; - - // Clear entire tree recursively? - if (recursively === true) { - const children = this.children; - for (let item in children) { - if (children.hasOwnProperty(item)) { - children[item].clear(recursively); - } - } - } - - } - - appendPath(path, value) { - - path = this.getPathComponents(path); - - if (path !== null) { - const last = path.length - 1; - let node = this; - for (let i = 0; i < last; ++i) { - node = node.append(path[i], 0); - if (node === null) { - return false; - } - } - - return (node.append(path[last], value) !== null); - } - - return false; - - } - - clearPath(path, recursively) { - - path = this.getPathComponents(path); - - if (path !== null) { - const last = path.length - 1; - let node = this.getNodeUpToIndex(path, last); - if (node !== null) { - let item = path[last]; - if (item !== WILDCARD) { - if (node.children.hasOwnProperty(item)) { - node.children[item].clear(recursively); - return true; - } - } else { - const children = node.children; - for (item in children) { - if (children.hasOwnProperty(item)) { - children[item].clear(recursively); - } - } - - return true; - } - } - } - - return false; - - } - - probePath(path, recursively) { - - path = this.getPathComponents(path); - - if (path !== null) { - const last = path.length - 1; - let node = this.getNodeUpToIndex(path, last); - if (node !== null) { - let item = path[last]; - if (item !== WILDCARD) { - if (node.children.hasOwnProperty(item)) { - return node.children[item].probe(recursively); - } - } else { - const children = node.children; - let value = 0; - for (item in children) { - if (children.hasOwnProperty(item)) { - value += children[item].probe(recursively); - } - } - - return value; - } - } - } - - return 0; - - } - - attachHandler(type, handler) { - - let result = false; - - if (typeof type === STRING && typeof handler === FUNCTION) { - - const handlers = this.handlers; - const list = handlers.hasOwnProperty(type) ? handlers[type] : (handlers[type] = []); - const length = list.length; - - let notFound = true; - - for (let i = 0; i < length; ++i) { - if (handler === list[i]) { - notFound = false; - break; - } - } - - if (notFound) { - list[length] = handler; - result = true; - } - - } - - return result; - - } - - removeHandler(type, handler) { - - let result = false; - - if (typeof type === STRING && typeof handler === FUNCTION) { - - const handlers = this.handlers; - if (handlers.hasOwnProperty(type)) { - const list = handlers[type]; - const length = list.length; - for (let i = 0; i < length; ++i) { - if (handler === list[i]) { - list.splice(i, 1); - result = true; - break; - } - } - } - - } - - return result; - - } - - trigger(type, nonRecursively) { - - if (typeof type === STRING) { - - const handlers = this.handlers; - - if (handlers.hasOwnProperty(type)) { - const list = handlers[type]; - const length = list.length; - for (let i = 0; i < length; ++i) { - list[i].call(null); - } - } - - if (nonRecursively !== true) { - const children = this.children; - for (let item in children) { - if (children.hasOwnProperty(item)) { - children[item].trigger(type); - } - } - } - - } - - } - - attachHandlerForPath(path, type, handler) { - - path = this.getPathComponents(path); - - if (path !== null) { - let node = this.getNodeUpToIndex(path, path.length); - if (node !== null) { - return node.attachHandler(type, handler); - } - } - - return false; - - } - - removeHandlerForPath(path, type, handler) { - - path = this.getPathComponents(path); - - if (path !== null) { - let node = this.getNodeUpToIndex(path, path.length); - if (node !== null) { - return node.removeHandler(type, handler); - } - } - - return false; - - } - - triggerHandlersForPath(path, type, nonRecursively) { - - path = this.getPathComponents(path); - - if (path !== null) { - let node = this.getNodeUpToIndex(path, path.length); - if (node !== null) { - node.trigger(type, nonRecursively); - } - } - - } - -} - -/** - * Root Namespace Node and API - */ - -const rootNode = new Node(); - -export const unsavedChanges = { - - rootNode: rootNode, - - observer: new Tracker.Dependency(), - - hooks: new Map(), - - /** - * Register a reactive dependency on every change any path suffers - */ - depend: function() { - return this.observer.depend(); - }, - - /** - * Signal an unsaved change for a given namespace. - * @param {String} path A string (e.g., "viewer.studyViewer.measurements.targets") that identifies the namespace of the signaled changes. - * @return {Boolean} Returns false if the signal could not be saved or the supplied namespace is invalid. Otherwise, true is returned. - */ - set: function(path) { - const result = rootNode.appendPath(path, 1); - this.observer.changed(); - return result; - }, - - /** - * Clear all signaled unsaved changes for a given namespace. If the supplied namespace is a wildcard, all signals below that namespace - * are cleared. - * @param {String} path A string that identifies the namespace of the signaled changes (e.g., "viewer.studyViewer.measurements.targets" - * for clearing the "targets" item of the "viewer.studyViewer.measurements" namespace or "viewer.studyViewer.*" to specify all signaled - * changes for the "viewer.studyViewer" namespace). - * @param {Boolean} recursively Clear node and all its children recursively. If not specified defaults to true. - * @return {Boolean} Returns false if the signal could not be removed or the supplied namespace is invalid. Otherwise, true is returned. - */ - clear: function(path, recursively) { - const result = rootNode.clearPath(path, typeof recursively === UNDEFINED ? true : recursively); - this.observer.changed(); - return result; - }, - - /** - * Count the amount of signaled unsaved changes for a given namespace. If the supplied namespace is a wildcard, all signals below that - * namespace will also be accounted. - * @param {String} path A string that identifies the namespace of the signaled changes (e.g., "viewer.studyViewer.measurements.targets" - * for counting the amount of signals for the "targets" item of the "viewer.studyViewer.measurements" namespace or "viewer.studyViewer.*" - * to count all signaled changes for the "viewer.studyViewer" namespace). - * @param {Boolean} recursively Probe node and all its children recursively. If not specified defaults to true. - * @return {Number} Returns the amount of signaled changes for a given namespace. If the supplied namespace is a wildcard, the sum of all - * changes for that namespace are returned. - */ - probe: function(path, recursively) { - return rootNode.probePath(path, typeof recursively === UNDEFINED ? true : recursively); - }, - - /** - * Attach an event handler to the specified namespace. - * @param {String} name A string that identifies the namespace to which the event handler will be attached (e.g., - * "viewer.studyViewer.measurements" to attach an event handler for that namespace). - * @param {String} type A string that identifies the event type to which the event handler will be attached. - * @param {Function} handler The handler that will be executed when the specifed event is triggered. - * @return {Boolean} Returns true on success and false on failure. - */ - attachHandler: function(path, type, handler) { - return (rootNode.appendPath(path, 0) && rootNode.attachHandlerForPath(path, type, handler)); - }, - - /** - * Detach an event handler from the specified namespace. - * @param {String} name A string that identifies the namespace from which the event handler will be detached (e.g., - * "viewer.studyViewer.measurements" to remove an event handler from that namespace). - * @param {String} type A string that identifies the event type to which the event handler was attached. - * @param {Function} handler The handler that will be removed from execution list. - * @return {Boolean} Returns true on success and false on failure. - */ - removeHandler: function(path, type, handler) { - return rootNode.removeHandlerForPath(path, type, handler); - }, - - /** - * Trigger all event handlers for the specified namespace and type. - * @param {String} name A string that identifies the namespace from which the event handler will be detached (e.g., - * "viewer.studyViewer.measurements" to remove an event handler from that namespace). - * @param {String} type A string that identifies the event type which will be triggered. - * @param {Boolean} nonRecursively If set to true, prevents triggering event handlers from descending tree. - * @return {Void} No value is returned. - */ - trigger: function(path, type, nonRecursively) { - rootNode.triggerHandlersForPath(path, type, nonRecursively); - }, - - /** - * UI utility that presents a confirmation dialog to the user if any unsaved changes where signaled for the given namespace. - * @param {String} path A string that identifies the namespace of the signaled changes (e.g., "viewer.studyViewer.measurements.targets" - * for considering only the signals for the "targets" item of the "viewer.studyViewer.measurements" namespace or "viewer.studyViewer.*" - * to consider all signaled changes for the "viewer.studyViewer" namespace). - * @param {Function} callback A callback function (e.g, function(shouldProceed, hasChanges) { ... }) that will be executed after assessment. - * Upon execution, the callback will receive two boolean arguments (shouldProceed and hasChanges) indicating if the action can be performed - * or not and if changes that need to be cleared exist. - * @param {Object} options (Optional) An object with UI presentation options. - * @param {String} options.title The string that will be used as a title for confirmation dialog. - * @param {String} options.message The string that will be used as a message for confirmation dialog. - * @return {void} No value is returned. - */ - checkBeforeAction: function(path, callback, options) { - - let probe, hasChanges, shouldProceed; - - if (typeof callback !== 'function') { - // nothing to do if no callback function is supplied... - return; - } - - probe = this.probe(path); - if (probe > 0) { - // Unsaved changes exist... - hasChanges = true; - let dialogOptions = _.extend({ - title: 'You have unsaved changes!', - message: "Your changes will be lost if you don't save them before leaving the current page... Are you sure you want to proceed?" - }, options); - OHIF.ui.showDialog('dialogConfirm', dialogOptions).then(function() { - // Unsaved changes exist but user confirms action... - shouldProceed = true; - callback.call(null, shouldProceed, hasChanges); - }, function() { - // Unsaved changes exist and user does NOT confirm action... - shouldProceed = false; - callback.call(null, shouldProceed, hasChanges); - }); - } else { - // No unsaved changes, action can be performed... - hasChanges = false; - shouldProceed = true; - callback.call(null, shouldProceed, hasChanges); - } - - }, - - /** - * UI utility that presents a "proactive" dialog (with three options: stay, abandon-changes, save-changes) to the user if any unsaved changes where signaled for the given namespace. - * @param {String} path A string that identifies the namespace of the signaled changes (e.g., "viewer.studyViewer.measurements.targets" - * for considering only the signals for the "targets" item of the "viewer.studyViewer.measurements" namespace or "viewer.studyViewer.*" - * to consider all signaled changes for the "viewer.studyViewer" namespace). - * @param {Function} callback A callback function (e.g, function(hasChanges, userChoice) { ... }) that will be executed after assessment. - * Upon execution, the callback will receive two arguments: one boolean (hasChanges) indicating that unsaved changes exist and one string with the ID of the - * option picked by the user on the dialog ('abort-action', 'abandon-changes' and 'save-changes'). If no unsaved changes exist, the second argument is null. - * @param {Object} options (Optional) An object with UI presentation options. - * @param {Object} options.position An object with optimal position (e.g., { x: ..., y: ... }) for the dialog. - * @return {void} No value is returned. - */ - presentProactiveDialog: function(path, callback, options) { - - let probe, hasChanges; - - if (typeof callback !== 'function') { - // nothing to do if no callback function is supplied... - return; - } - - probe = this.probe(path, true); - if (probe > 0) { - // Unsaved changes exist... - hasChanges = true; - OHIF.ui.unsavedChangesDialog(function(choice) { - callback.call(null, hasChanges, choice); - }, options); - } else { - // No unsaved changes, action can be performed... - hasChanges = false; - callback.call(null, hasChanges, null); - } - - }, - - addHook(saveCallback, options={}) { - _.defaults(options, { - path: '*', - message: 'There are unsaved changes' - }); - - this.hooks.set(saveCallback, options); - }, - - removeHook(saveCallback) { - this.hooks.delete(saveCallback); - }, - - confirmNavigation(navigateCallback, event) { - let dialogPresented = false; - Array.from(this.hooks.keys()).every(saveCallback => { - const options = this.hooks.get(saveCallback); - const probe = this.probe(options.path, true); - if (!probe) return true; - - const dialogOptions = Object.assign({ class: 'themed' }, options); - if (event) { - dialogOptions.position = { - x: event.clientX + 15, - y: event.clientY + 15 - }; - } - - OHIF.ui.unsavedChanges.presentProactiveDialog(options.path, (hasChanges, userChoice) => { - if (!hasChanges) return; - - const clear = () => this.clear(options.path, true); - switch (userChoice) { - case 'abort-action': - return; - case 'save-changes': - const result = saveCallback(); - if (result instanceof Promise) { - return result.then(() => { - clear(); - this.confirmNavigation(navigateCallback, event); - }); - } - - clear(); - return this.confirmNavigation(navigateCallback, event); - case 'abandon-changes': - clear(); - break; - } - - navigateCallback(); - }, dialogOptions); - - dialogPresented = true; - return false; - }); - - if (!dialogPresented) { - navigateCallback(); - } - } - -}; - -OHIF.ui.unsavedChanges = unsavedChanges; diff --git a/Packages/ohif-core/main.js b/Packages/ohif-core/main.js deleted file mode 100644 index f79be869c..000000000 --- a/Packages/ohif-core/main.js +++ /dev/null @@ -1,23 +0,0 @@ -import { Meteor } from 'meteor/meteor'; - -/* - * Defines the base OHIF object - */ - -const OHIF = { - log: {}, - ui: {}, - utils: {}, - viewer: {}, - cornerstone: {}, - user: {}, - DICOMWeb: {}, // Temporarily added -}; - -// Expose the OHIF object to the client if it is on development mode -// @TODO: remove this after applying namespace to this package -if (Meteor.isClient) { - window.OHIF = OHIF; -} - -export { OHIF }; diff --git a/Packages/ohif-core/package.js b/Packages/ohif-core/package.js deleted file mode 100644 index 7bbe87316..000000000 --- a/Packages/ohif-core/package.js +++ /dev/null @@ -1,47 +0,0 @@ -Npm.depends({ - 'isomorphic-base64': '1.0.2', -}); - -Package.describe({ - name: 'ohif:core', - summary: 'OHIF core components, helpers and UI functions', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('standard-app-packages'); - api.use('jquery'); - api.use('stylus'); - api.use('underscore'); - api.use('templating'); - api.use('reactive-var'); - - // Router dependencies - api.use('clinical:router@2.0.19', 'client'); - - // Component's library dependencies - api.use('natestrauser:select2@4.0.1', 'client'); - api.use('aldeed:simple-schema'); - - // UI Styles - api.addFiles([ - 'client/ui/dimensional/dimensional.styl', - 'client/ui/resizable/resizable.styl', - 'client/components/bootstrap/dialog/bootstrap.styl', - 'client/components/bootstrap/dialog/loading.styl', - 'client/components/bootstrap/dialog/progress.styl', - 'client/components/bootstrap/dialog/unsavedChangesDialog.styl', - 'client/components/bootstrap/dropdown/dropdown.styl' - ], 'client'); - - api.mainModule('main.js', ['client', 'server']); - - // Client imports and routes - api.addFiles('client/index.js', 'client'); - - // Client and server imports - api.addFiles('both/index.js', ['client', 'server']); -}); diff --git a/Packages/ohif-cornerstone-settings/client/main.js b/Packages/ohif-cornerstone-settings/client/main.js deleted file mode 100644 index 729ab48f3..000000000 --- a/Packages/ohif-cornerstone-settings/client/main.js +++ /dev/null @@ -1,2 +0,0 @@ -// Include cornerstone's settings imports -require('../imports/client'); diff --git a/Packages/ohif-cornerstone-settings/imports/client/index.js b/Packages/ohif-cornerstone-settings/imports/client/index.js deleted file mode 100644 index 477127899..000000000 --- a/Packages/ohif-cornerstone-settings/imports/client/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -import './renderer.js'; - -import { MetadataProvider } from './lib/classes/MetadataProvider'; -OHIF.cornerstone.MetadataProvider = MetadataProvider; - -// TODO: Remove this after all viewers are updated to create an instance of OHIF.cornerstone.MetadataProvider -OHIF.cornerstone.metadataProvider = new MetadataProvider(); diff --git a/Packages/ohif-cornerstone-settings/imports/client/lib/classes/MetadataProvider.js b/Packages/ohif-cornerstone-settings/imports/client/lib/classes/MetadataProvider.js deleted file mode 100644 index 1ad16af11..000000000 --- a/Packages/ohif-cornerstone-settings/imports/client/lib/classes/MetadataProvider.js +++ /dev/null @@ -1,354 +0,0 @@ -import { cornerstoneMath } from 'meteor/ohif:cornerstone'; -import { parsingUtils } from '../parsingUtils'; - -const FUNCTION = 'function'; - -export class MetadataProvider { - - constructor() { - - // Define the main "metadataLookup" private property as an immutable property. - Object.defineProperty(this, 'metadataLookup', { - configurable: false, - enumerable: false, - writable: false, - value: new Map() - }); - - // Local reference to provider function bound to current instance. - Object.defineProperty(this, '_provider', { - configurable: false, - enumerable: false, - writable: true, - value: null - }); - - } - - /** - * Cornerstone Metadata provider to store image meta data - * Data from instances, series, and studies are associated with - * imageIds to facilitate usage of this information by Cornerstone's Tools - * - * e.g. the imagePlane metadata object contains instance information about - * row/column pixel spacing, patient position, and patient orientation. It - * is used in CornerstoneTools to position reference lines and orientation markers. - * - * @param {String} imageId The Cornerstone ImageId - * @param {Object} data An object containing instance, series, and study metadata - */ - addMetadata(imageId, data) { - const instanceMetadata = data.instance; - const seriesMetadata = data.series; - const studyMetadata = data.study; - const numImages = data.numImages; - const metadata = {}; - - metadata.frameNumber = data.frameNumber; - - metadata.study = { - accessionNumber: studyMetadata.accessionNumber, - patientId: studyMetadata.patientId, - studyInstanceUid: studyMetadata.studyInstanceUid, - studyDate: studyMetadata.studyDate, - studyTime: studyMetadata.studyTime, - studyDescription: studyMetadata.studyDescription, - institutionName: studyMetadata.institutionName, - patientHistory: studyMetadata.patientHistory - }; - - metadata.series = { - seriesDescription: seriesMetadata.seriesDescription, - seriesNumber: seriesMetadata.seriesNumber, - seriesDate: seriesMetadata.seriesDate, - seriesTime: seriesMetadata.seriesTime, - modality: seriesMetadata.modality, - seriesInstanceUid: seriesMetadata.seriesInstanceUid, - numImages: numImages - }; - - metadata.instance = instanceMetadata; - - metadata.patient = { - name: studyMetadata.patientName, - id: studyMetadata.patientId, - birthDate: studyMetadata.patientBirthDate, - sex: studyMetadata.patientSex, - age: studyMetadata.patientAge - }; - - // If there is sufficient information, populate - // the imagePlane object for easier use in the Viewer - metadata.imagePlane = this.getImagePlane(instanceMetadata); - - // Add the metadata to the imageId lookup object - this.metadataLookup.set(imageId, metadata); - } - - /** - * Return the metadata for the given imageId - * @param {String} imageId The Cornerstone ImageId - * @returns image metadata - */ - getMetadata(imageId) { - return this.metadataLookup.get(imageId); - } - - /** - * Adds a set of metadata to the Cornerstone metadata provider given a specific - * imageId, type, and dataset - * - * @param imageId - * @param type (e.g. series, instance, tagDisplay) - * @param data - */ - addSpecificMetadata(imageId, type, data) { - const metadata = {}; - metadata[type] = data; - - const oldMetadata = this.metadataLookup.get(imageId); - this.metadataLookup.set(imageId, Object.assign(oldMetadata, metadata)); - } - - getFromImage(image, type, tag, attrName, defaultValue) { - let value; - - if (image.data) { - value = this.getFromDataSet(image.data, type, tag); - } else { - value = image.instance[attrName]; - } - - return value === null ? defaultValue : value; - } - - getFromDataSet(dataSet, type, tag) { - if (!dataSet) { - return; - } - - const fn = dataSet[type]; - if (!fn) { - return; - } - - return fn.call(dataSet, tag); - } - - getFrameIncrementPointer(image) { - const dataSet = image.data; - let frameInstancePointer = ''; - - if (parsingUtils.isValidDataSet(dataSet)) { - const frameInstancePointerNames = { - x00181063: 'frameTime', - x00181065: 'frameTimeVector' - }; - - // (0028,0009) = Frame Increment Pointer - const frameInstancePointerTag = parsingUtils.attributeTag(dataSet, 'x00280009'); - frameInstancePointer = frameInstancePointerNames[frameInstancePointerTag]; - } else { - frameInstancePointer = image.instance.frameIncrementPointer; - } - - return frameInstancePointer || ''; - } - - getFrameTimeVector(image) { - const dataSet = image.data; - - if (parsingUtils.isValidDataSet(dataSet)) { - // Frame Increment Pointer points to Frame Time Vector (0018,1065) field - return parsingUtils.floatArray(dataSet, 'x00181065'); - } - - return image.instance.frameTimeVector; - } - - getFrameTime(image) { - const dataSet = image.data; - - if (parsingUtils.isValidDataSet(dataSet)) { - // Frame Increment Pointer points to Frame Time (0018,1063) field or is not defined (for addtional flexibility). - // Yet another value is possible for this field (5200,9230 for Multi-frame Functional Groups) - // but that case is currently not supported. - return dataSet.floatString('x00181063', -1); - } - - return image.instance.frameTime; - } - - /** - * Updates the related metadata for missing fields given a specified image - * - * @param image - */ - updateMetadata(image) { - const imageMetadata = this.metadataLookup.get(image.imageId); - if (!imageMetadata) { - return; - } - - imageMetadata.patient.age = imageMetadata.patient.age || this.getFromDataSet(image.data, 'string', 'x00101010'); - - imageMetadata.instance.rows = imageMetadata.instance.rows || image.rows; - imageMetadata.instance.columns = imageMetadata.instance.columns || image.columns; - - imageMetadata.instance.sopClassUid = imageMetadata.instance.sopClassUid || this.getFromDataSet(image.data, 'string', 'x00080016'); - imageMetadata.instance.sopInstanceUid = imageMetadata.instance.sopInstanceUid || this.getFromDataSet(image.data, 'string', 'x00080018'); - - imageMetadata.instance.pixelSpacing = imageMetadata.instance.pixelSpacing || this.getFromDataSet(image.data, 'string', 'x00280030'); - imageMetadata.instance.frameOfReferenceUID = imageMetadata.instance.frameOfReferenceUID || this.getFromDataSet(image.data, 'string', 'x00200052'); - imageMetadata.instance.imageOrientationPatient = imageMetadata.instance.imageOrientationPatient || this.getFromDataSet(image.data, 'string', 'x00200037'); - imageMetadata.instance.imagePositionPatient = imageMetadata.instance.imagePositionPatient || this.getFromDataSet(image.data, 'string', 'x00200032'); - - imageMetadata.instance.sliceThickness = imageMetadata.instance.sliceThickness || this.getFromDataSet(image.data, 'string', 'x00180050'); - imageMetadata.instance.sliceLocation = imageMetadata.instance.sliceLocation || this.getFromDataSet(image.data, 'string', 'x00201041'); - imageMetadata.instance.tablePosition = imageMetadata.instance.tablePosition || this.getFromDataSet(image.data, 'string', 'x00189327'); - imageMetadata.instance.spacingBetweenSlices = imageMetadata.instance.spacingBetweenSlices || this.getFromDataSet(image.data, 'string', 'x00180088'); - - imageMetadata.instance.lossyImageCompression = imageMetadata.instance.lossyImageCompression || this.getFromDataSet(image.data, 'string', 'x00282110'); - imageMetadata.instance.lossyImageCompressionRatio = imageMetadata.instance.lossyImageCompressionRatio || this.getFromDataSet(image.data, 'string', 'x00282112'); - - imageMetadata.instance.frameIncrementPointer = imageMetadata.instance.frameIncrementPointer || this.getFromDataSet(image.data, 'string', 'x00280009'); - imageMetadata.instance.frameTime = imageMetadata.instance.frameTime || this.getFromDataSet(image.data, 'string', 'x00181063'); - imageMetadata.instance.frameTimeVector = imageMetadata.instance.frameTimeVector || this.getFromDataSet(image.data, 'string', 'x00181065'); - - if ((image.data || image.instance) && !imageMetadata.instance.multiframeMetadata) { - imageMetadata.instance.multiframeMetadata = this.getMultiframeModuleMetadata(image); - } - - imageMetadata.imagePlane = imageMetadata.imagePlane || this.getImagePlane(imageMetadata.instance); - } - - /** - * Constructs and returns the imagePlane given the metadata instance - * - * @param metadataInstance The metadata instance (InstanceMetadata class) containing information to construct imagePlane - * @returns imagePlane The constructed imagePlane to be used in viewer easily - */ - getImagePlane(instance) { - if (!instance.rows || !instance.columns || !instance.pixelSpacing || - !instance.frameOfReferenceUID || !instance.imageOrientationPatient || - !instance.imagePositionPatient) { - return; - } - - const imageOrientation = instance.imageOrientationPatient.split('\\'); - const imagePosition = instance.imagePositionPatient.split('\\'); - - let columnPixelSpacing = 1.0; - let rowPixelSpacing = 1.0; - if (instance.pixelSpacing) { - const split = instance.pixelSpacing.split('\\'); - rowPixelSpacing = parseFloat(split[0]); - columnPixelSpacing = parseFloat(split[1]); - } - - return { - frameOfReferenceUID: instance.frameOfReferenceUID, - rows: instance.rows, - columns: instance.columns, - rowCosines: - new cornerstoneMath.Vector3(parseFloat(imageOrientation[0]), parseFloat(imageOrientation[1]), parseFloat(imageOrientation[2])), - columnCosines: - new cornerstoneMath.Vector3(parseFloat(imageOrientation[3]), parseFloat(imageOrientation[4]), parseFloat(imageOrientation[5])), - imagePositionPatient: - new cornerstoneMath.Vector3(parseFloat(imagePosition[0]), parseFloat(imagePosition[1]), parseFloat(imagePosition[2])), - rowPixelSpacing, - columnPixelSpacing, - }; - } - - /** - * This function extracts miltiframe information from a dicomParser.DataSet object. - * - * @param dataSet {Object} An instance of dicomParser.DataSet object where multiframe information can be found. - * @return {Object} An object containing multiframe image metadata (frameIncrementPointer, frameTime, frameTimeVector, etc). - */ - getMultiframeModuleMetadata(image) { - const imageInfo = { - isMultiframeImage: false, - frameIncrementPointer: null, - numberOfFrames: 0, - frameTime: 0, - frameTimeVector: null, - averageFrameRate: 0 // backwards compatibility only... it might be useless in the future - }; - - let frameTime; - - const numberOfFrames = this.getFromImage(image, 'intString', 'x00280008', 'numberOfFrames', -1); - - if (numberOfFrames > 0) { - // set multi-frame image indicator - imageInfo.isMultiframeImage = true; - imageInfo.numberOfFrames = numberOfFrames; - - // (0028,0009) = Frame Increment Pointer - const frameIncrementPointer = this.getFrameIncrementPointer(image); - - if (frameIncrementPointer === 'frameTimeVector') { - // Frame Increment Pointer points to Frame Time Vector (0018,1065) field - const frameTimeVector = this.getFrameTimeVector(image); - - if (frameTimeVector instanceof Array && frameTimeVector.length > 0) { - imageInfo.frameIncrementPointer = frameIncrementPointer; - imageInfo.frameTimeVector = frameTimeVector; - frameTime = frameTimeVector.reduce((a, b) => a + b) / frameTimeVector.length; - imageInfo.averageFrameRate = 1000 / frameTime; - } - } else if (frameIncrementPointer === 'frameTime' || frameIncrementPointer === '') { - frameTime = this.getFrameTime(image); - - if (frameTime > 0) { - imageInfo.frameIncrementPointer = frameIncrementPointer; - imageInfo.frameTime = frameTime; - imageInfo.averageFrameRate = 1000 / frameTime; - } - } - - } - - return imageInfo; - } - - /** - * Get a bound reference to the provider function. - */ - getProvider() { - let provider = this._provider; - if (typeof this._provider !== FUNCTION) { - provider = this.provider.bind(this); - this._provider = provider; - } - - return provider; - } - - /** - * Looks up metadata for Cornerstone Tools given a specified type and imageId - * A type may be, e.g. 'study', or 'patient', or 'imagePlane'. These types - * are keys in the stored metadata objects. - * - * @param type - * @param imageId - * @returns {Object} Relevant metadata of the specified type - */ - provider(type, imageId) { - // TODO: Cornerstone Tools use 'imagePlaneModule', but OHIF use 'imagePlane'. It must be consistent. - if (type === 'imagePlaneModule') { - type = 'imagePlane'; - } - - const imageMetadata = this.metadataLookup.get(imageId); - if (!imageMetadata) { - return; - } - - if (imageMetadata.hasOwnProperty(type)) { - return imageMetadata[type]; - } - } -} diff --git a/Packages/ohif-cornerstone-settings/imports/client/lib/parsingUtils.js b/Packages/ohif-cornerstone-settings/imports/client/lib/parsingUtils.js deleted file mode 100644 index 5c244d8fe..000000000 --- a/Packages/ohif-cornerstone-settings/imports/client/lib/parsingUtils.js +++ /dev/null @@ -1,79 +0,0 @@ -import { dicomParser } from 'meteor/ohif:cornerstone'; - -/** - * A small set of utilities to help parsing DICOM element values. - * In the future the functionality provided by this library might - * be incorporated into dicomParser library. - */ - -export const parsingUtils = { - - /** - * Check if supplied argument is a valid instance of the dicomParser.DataSet class. - * @param data {Object} An instance of the dicomParser.DataSet class. - * @returns {Boolean} Returns true if data is a valid instance of the dicomParser.DataSet class. - */ - isValidDataSet: function(data) { - return (data instanceof dicomParser.DataSet); - }, - - /** - * Parses an element tag according to the 'AT' VR definition. - * @param data {Object} An instance of the dicomParser.DataSet class. - * @param tag {String} A DICOM tag with in the format xGGGGEEEE. - * @returns {String} A string representation of a data element tag or null if the field is not present or data is not long enough. - */ - attributeTag: function(data, tag) { - if (this.isValidDataSet(data) && tag in data.elements) { - let element = data.elements[tag]; - if (element && element.length === 4) { - let parser = data.byteArrayParser.readUint16, - bytes = data.byteArray, - offset = element.dataOffset; - return 'x' + ('00000000' + (parser(bytes, offset) * 256 * 256 + parser(bytes, offset + 2)).toString(16)).substr(-8); - } - } - - return null; - }, - - /** - * Parses the string representation of a multi-valued element into an array of strings. If the parser - * parameter is passed and is a function, it will be applied to each element of the resulting array. - * @param data {Object} An instance of the dicomParser.DataSet class. - * @param tag {String} A DICOM tag with in the format xGGGGEEEE. - * @param parser {Function} An optional parser function that can be applied to each element of the array. - * @returns {Array} An array of floating point numbers or null if the field is not present or data is not long enough. - */ - multiValue: function(data, tag, parser) { - if (this.isValidDataSet(data) && tag in data.elements) { - let element = data.elements[tag]; - if (element && element.length > 0) { - let string = dicomParser.readFixedString(data.byteArray, element.dataOffset, element.length); - if (typeof string === 'string' && string.length > 0) { - if (typeof parser !== 'function') { - parser = null; - } - - return string.split('\\').map(function(value) { - value = value.trim(); - return parser !== null ? parser(value) : value; - }); - } - } - } - - return null; - }, - - /** - * Parses a string to an array of floats for a multi-valued element. - * @param data {Object} An instance of the dicomParser.DataSet class. - * @param tag {String} A DICOM tag with in the format xGGGGEEEE. - * @returns {Array} An array of floating point numbers or null if the field is not present or data is not long enough. - */ - floatArray: function(data, tag) { - return this.multiValue(data, tag, parseFloat); - } - -}; diff --git a/Packages/ohif-cornerstone-settings/imports/client/renderer.js b/Packages/ohif-cornerstone-settings/imports/client/renderer.js deleted file mode 100644 index 50d88f187..000000000 --- a/Packages/ohif-cornerstone-settings/imports/client/renderer.js +++ /dev/null @@ -1,5 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; - -const rendererPath = 'settings.public.ui.cornerstoneRenderer'; -OHIF.cornerstone.renderer = OHIF.utils.ObjectPath.get(Meteor, rendererPath) || ''; diff --git a/Packages/ohif-cornerstone-settings/package.js b/Packages/ohif-cornerstone-settings/package.js deleted file mode 100644 index df937dbb1..000000000 --- a/Packages/ohif-cornerstone-settings/package.js +++ /dev/null @@ -1,15 +0,0 @@ -Package.describe({ - name: 'ohif:cornerstone-settings', - summary: 'Cornerstone Settings package', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('ohif:cornerstone'); - api.use('ohif:core'); - - api.mainModule('client/main.js', 'client'); -}); diff --git a/Packages/ohif-cornerstone/main.js b/Packages/ohif-cornerstone/main.js deleted file mode 100644 index b87effb58..000000000 --- a/Packages/ohif-cornerstone/main.js +++ /dev/null @@ -1,24 +0,0 @@ -import Hammer from 'hammerjs'; -import * as cornerstone from 'cornerstone-core/dist/cornerstone.js'; -import * as cornerstoneMath from 'cornerstone-math/dist/cornerstoneMath.js'; -import * as cornerstoneTools from 'cornerstone-tools/dist/cornerstoneTools.js'; -import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader/dist/cornerstoneWADOImageLoader.js'; -import * as dicomParser from 'dicom-parser'; // Importing from dist breaks instance reference of dicomParser.DataSet class -import * as dcmjs from 'dcmjs/build/dcmjs'; - -cornerstoneTools.external.Hammer = Hammer; -cornerstoneTools.external.cornerstone = cornerstone; -cornerstoneTools.external.cornerstoneMath = cornerstoneMath; -cornerstoneWADOImageLoader.external.cornerstone = cornerstone; -cornerstoneWADOImageLoader.external.dicomParser = dicomParser; - -// Export scripts that will populate the Cornerstone namespace as a side effect only import. -// This is effectively the public API... -export { - cornerstone, - cornerstoneTools, - cornerstoneMath, - cornerstoneWADOImageLoader, - dicomParser, - dcmjs -}; diff --git a/Packages/ohif-cornerstone/package.js b/Packages/ohif-cornerstone/package.js deleted file mode 100644 index d2a8c0057..000000000 --- a/Packages/ohif-cornerstone/package.js +++ /dev/null @@ -1,34 +0,0 @@ -Package.describe({ - name: 'ohif:cornerstone', - summary: 'Cornerstone Web-based Medical Imaging libraries', - version: '0.0.1' -}); - -Npm.depends({ - hammerjs: '2.0.8', - 'cornerstone-core': '2.2.8', - 'cornerstone-tools': '2.4.0', - 'cornerstone-math': '0.1.7', - 'dicom-parser': '1.8.3', - 'cornerstone-wado-image-loader': '2.2.3', - 'dcmjs': '0.2.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - - api.addAssets('public/js/cornerstoneWADOImageLoaderCodecs.es5.js', 'client'); - api.addAssets('public/js/cornerstoneWADOImageLoaderWebWorker.es5.js', 'client'); - api.addAssets('public/js/cornerstoneWADOImageLoaderWebWorker.min.js.map', 'client'); - - api.mainModule('main.js', 'client'); - - api.export('cornerstone', 'client'); - api.export('cornerstoneMath', 'client'); - api.export('cornerstoneTools', 'client'); - api.export('cornerstoneWADOImageLoader', 'client'); - api.export('dicomParser', 'client'); - api.export('dcmjs', 'client'); -}); diff --git a/Packages/ohif-cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js b/Packages/ohif-cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js deleted file mode 100644 index 408bfff09..000000000 --- a/Packages/ohif-cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! cornerstone-wado-image-loader - 2.1.2 - 2018-06-05 | (c) 2016 Chris Hafey | https://github.com/cornerstonejs/cornerstoneWADOImageLoader */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cornerstoneWADOImageLoaderWebWorker",[],t):"object"==typeof exports?exports.cornerstoneWADOImageLoaderWebWorker=t():e.cornerstoneWADOImageLoaderWebWorker=t()}(this,function(){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=48)}([,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){for(var t=e[0],r=e[0],a=void 0,n=e.length,i=1;i1&&(e.photometricInterpretation="RGB"),e}function i(e){if(!e.usePDFJS&&"undefined"==typeof OpenJPEG)throw new Error("OpenJPEG decoder not loaded");if(!(a||(a=OpenJPEG())&&a._jp2_decode))throw new Error("OpenJPEG failed to initialize")}t.default=function(e,t,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return i(r),a.usePDFJS||r.usePDFJS?function(e,t){var r=new JpxImage;r.parse(t);var a=r.tiles.length;if(1!==a)throw new Error("JPEG2000 decoder returned a tileCount of "+a+", when 1 is expected");return e.columns=r.width,e.rows=r.height,e.pixelData=r.tiles[0].items,e}(e,t):n(e,t)},t.initializeJPEG2000=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=void 0;function n(){if("undefined"==typeof CharLS)throw new Error("No JPEG-LS decoder loaded");if(!(a||(a=CharLS())&&a._jpegls_decode))throw new Error("JPEG-LS failed to initialize")}t.default=function(e,t){n();var r=function(e,t){var r=a._malloc(e.length);a.writeArrayToMemory(e,r);var n=a._malloc(4),i=a._malloc(4),o=a._malloc(4),l=a._malloc(4),f=a._malloc(4),s=a._malloc(4),u=a._malloc(4),d=a._malloc(4),c=a._malloc(4),p={result:a.ccall("jpegls_decode","number",["number","number","number","number","number","number","number","number","number","number","number"],[r,e.length,n,i,o,l,f,s,d,u,c]),width:a.getValue(o,"i32"),height:a.getValue(l,"i32"),bitsPerSample:a.getValue(f,"i32"),stride:a.getValue(s,"i32"),components:a.getValue(d,"i32"),allowedLossyError:a.getValue(u,"i32"),interleaveMode:a.getValue(c,"i32"),pixelData:void 0},m=a.getValue(n,"*");return p.bitsPerSample<=8?(p.pixelData=new Uint8Array(p.width*p.height*p.components),p.pixelData.set(new Uint8Array(a.HEAP8.buffer,m,p.pixelData.length))):t?(p.pixelData=new Int16Array(p.width*p.height*p.components),p.pixelData.set(new Int16Array(a.HEAP16.buffer,m,p.pixelData.length))):(p.pixelData=new Uint16Array(p.width*p.height*p.components),p.pixelData.set(new Uint16Array(a.HEAP16.buffer,m,p.pixelData.length))),a._free(r),a._free(m),a._free(n),a._free(i),a._free(o),a._free(l),a._free(f),a._free(s),a._free(d),a._free(c),p}(t,1===e.pixelRepresentation);if(0!==r.result&&6!==r.result)throw new Error("JPEG-LS decoder failed to decode frame (error code "+r.result+")");return e.columns=r.width,e.rows=r.height,e.pixelData=r.pixelData,e},t.initializeJPEGLS=n},,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default="2.1.2"},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,i.default)(e.pixelData),a=!(o(e.smallestPixelValue)&&o(e.largestPixelValue));!0!==t||a?(e.smallestPixelValue=r.min,e.largestPixelValue=r.max):(e.smallestPixelValue!==r.min&&console.warn("Image smallestPixelValue tag is incorrect. Rendering performance will suffer considerably."),e.largestPixelValue!==r.max&&console.warn("Image largestPixelValue tag is incorrect. Rendering performance will suffer considerably."))};var a,n=r(1),i=(a=n)&&a.__esModule?a:{default:a};function o(e){return"number"==typeof e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("undefined"==typeof jpeg||void 0===jpeg.lossless||void 0===jpeg.lossless.Decoder)throw new Error("No JPEG Lossless decoder loaded");var r=e.bitsAllocated<=8?1:2,a=t.buffer,n=(new jpeg.lossless.Decoder).decode(a,t.byteOffset,t.length,r);return 0===e.pixelRepresentation?16===e.bitsAllocated?(e.pixelData=new Uint16Array(n.buffer),e):(e.pixelData=new Uint8Array(n.buffer),e):(e.pixelData=new Int16Array(n.buffer),e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("undefined"==typeof JpegImage)throw new Error("No JPEG Baseline decoder loaded");var r=new JpegImage;return r.parse(t),r.colorTransform=!1,8===e.bitsAllocated?(e.pixelData=r.getData(e.columns,e.rows),e):16===e.bitsAllocated?(e.pixelData=r.getData16(e.columns,e.rows),e):void 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(8===e.bitsAllocated)return e.planarConfiguration?function(e,t){for(var r=t,a=e.rows*e.columns,n=new ArrayBuffer(a*e.samplesPerPixel),i=new DataView(r.buffer,r.byteOffset),o=new Int8Array(r.buffer,r.byteOffset),l=new Int8Array(n),f=0,s=i.getInt32(0,!0),u=0;u=0&&m<=127)for(var g=0;g=-127)for(var y=o[d++],b=0;b<1-m&&f=0&&m<=127)for(var g=0;g=-127)for(var y=o[d++],b=0;b<1-m&&f=0&&m<=127)for(var g=0;g=-127)for(var y=o[c++],b=0;b<1-m&&u>8&255}else 8===e.bitsAllocated&&(e.pixelData=t);var o;return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=t.buffer,a=t.byteOffset,n=t.length;return 16===e.bitsAllocated?(a%2&&(r=r.slice(a),a=0),0===e.pixelRepresentation?e.pixelData=new Uint16Array(r,a,n/2):e.pixelData=new Int16Array(r,a,n/2)):8===e.bitsAllocated||1===e.bitsAllocated?e.pixelData=t:32===e.bitsAllocated&&(a%2&&(r=r.slice(a),a=0),e.pixelData=new Float32Array(r,a,n/4)),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=u(r(15)),n=u(r(14)),i=u(r(13)),o=u(r(12)),l=u(r(11)),f=u(r(3)),s=u(r(2));function u(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r,u,d){var c=(new Date).getTime();if("1.2.840.10008.1.2"===t)e=(0,a.default)(e,r);else if("1.2.840.10008.1.2.1"===t)e=(0,a.default)(e,r);else if("1.2.840.10008.1.2.2"===t)e=(0,n.default)(e,r);else if("1.2.840.10008.1.2.1.99"===t)e=(0,a.default)(e,r);else if("1.2.840.10008.1.2.5"===t)e=(0,i.default)(e,r);else if("1.2.840.10008.1.2.4.50"===t)e=(0,o.default)(e,r);else if("1.2.840.10008.1.2.4.51"===t)e=(0,o.default)(e,r);else if("1.2.840.10008.1.2.4.57"===t)e=(0,l.default)(e,r);else if("1.2.840.10008.1.2.4.70"===t)e=(0,l.default)(e,r);else if("1.2.840.10008.1.2.4.80"===t)e=(0,f.default)(e,r);else if("1.2.840.10008.1.2.4.81"===t)e=(0,f.default)(e,r);else if("1.2.840.10008.1.2.4.90"===t)e=(0,s.default)(e,r,u,d);else{if("1.2.840.10008.1.2.4.91"!==t)throw new Error("no decoder for transfer syntax "+t);e=(0,s.default)(e,r,u,d)}var p=void 0!==e.pixelRepresentation&&1===e.pixelRepresentation,m=p&&void 0!==e.bitsStored?32-e.bitsStored:void 0;if(p&&void 0!==m)for(var g=0;g>m;var y=(new Date).getTime();return e.decodeTimeInMS=y-c,e}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),n=r(3),i=l(r(10)),o=l(r(16));function l(e){return e&&e.__esModule?e:{default:e}}var f=!1,s=void 0;function u(e){f||(self.importScripts(e.decodeTask.codecsPath),f=!0,e.decodeTask.initializeCodecsOnStartup&&((0,a.initializeJPEG2000)(e.decodeTask),(0,n.initializeJPEGLS)(e.decodeTask)))}t.default={taskType:"decodeTask",handler:function(e,t){u(s);var r=s&&s.decodeTask&&s.decodeTask.strict,a=e.data.imageFrame,n=new Uint8Array(e.data.pixelData);if((0,o.default)(a,e.data.transferSyntax,n,s.decodeTask,e.data.options),!a.pixelData)throw new Error("decodeTask: imageFrame.pixelData is undefined after decoding");(0,i.default)(a,r),a.pixelData=a.pixelData.buffer,t(a,[a.pixelData])},initialize:function(e){s=e,e.decodeTask.loadCodecsOnStartup&&u(e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerTaskHandler=function(e){if(a[e.taskType])return console.log('attempt to register duplicate task handler "',e.taskType,'"'),!1;a[e.taskType]=e,n&&e.initialize(i.taskConfiguration)};var a={},n=!1,i=void 0;self.onmessage=function(e){var t;{if("initialize"!==e.data.taskType)return"loadWebWorkerTask"===e.data.taskType?(t=e.data,i=t.config,void self.importScripts(t.sourcePath)):void(a[e.data.taskType]?a[e.data.taskType].handler(e.data,function(t,r){self.postMessage({taskType:e.data.taskType,status:"success",result:t,workerIndex:e.data.workerIndex},r)}):(console.log("no task handler for ",e.data.taskType),console.log(a),self.postMessage({taskType:e.data.taskType,status:"failed - no task handler registered",workerIndex:e.data.workerIndex})));!function(e){if(!n){if(i=e.config,e.config.webWorkerTaskPaths)for(var t=0;t 1) {\r\n imageFrame.photometricInterpretation = 'RGB';\r\n }\r\n\r\n return imageFrame;\r\n}\r\n\r\nfunction initializeJPEG2000 (decodeConfig) {\r\n // check to make sure codec is loaded\r\n if (!decodeConfig.usePDFJS) {\r\n if (typeof OpenJPEG === 'undefined') {\r\n throw new Error('OpenJPEG decoder not loaded');\r\n }\r\n }\r\n\r\n if (!openJPEG) {\r\n openJPEG = OpenJPEG();\r\n if (!openJPEG || !openJPEG._jp2_decode) {\r\n throw new Error('OpenJPEG failed to initialize');\r\n }\r\n }\r\n}\r\n\r\nfunction decodeJPEG2000 (imageFrame, pixelData, decodeConfig, options = {}) {\r\n initializeJPEG2000(decodeConfig);\r\n\r\n if (options.usePDFJS || decodeConfig.usePDFJS) {\r\n // OHIF image-JPEG2000 https://github.com/OHIF/image-JPEG2000\r\n // console.log('PDFJS')\r\n return decodeJpx(imageFrame, pixelData);\r\n }\r\n\r\n // OpenJPEG2000 https://github.com/jpambrun/openjpeg\r\n // console.log('OpenJPEG')\r\n return decodeOpenJpeg2000(imageFrame, pixelData);\r\n}\r\n\r\nexport default decodeJPEG2000;\r\nexport { initializeJPEG2000 };\r\n","let charLS;\r\n\r\nfunction jpegLSDecode (data, isSigned) {\r\n // prepare input parameters\r\n const dataPtr = charLS._malloc(data.length);\r\n\r\n charLS.writeArrayToMemory(data, dataPtr);\r\n\r\n // prepare output parameters\r\n const imagePtrPtr = charLS._malloc(4);\r\n const imageSizePtr = charLS._malloc(4);\r\n const widthPtr = charLS._malloc(4);\r\n const heightPtr = charLS._malloc(4);\r\n const bitsPerSamplePtr = charLS._malloc(4);\r\n const stridePtr = charLS._malloc(4);\r\n const allowedLossyErrorPtr = charLS._malloc(4);\r\n const componentsPtr = charLS._malloc(4);\r\n const interleaveModePtr = charLS._malloc(4);\r\n\r\n // Decode the image\r\n const result = charLS.ccall(\r\n 'jpegls_decode',\r\n 'number',\r\n ['number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number'],\r\n [dataPtr, data.length, imagePtrPtr, imageSizePtr, widthPtr, heightPtr, bitsPerSamplePtr, stridePtr, componentsPtr, allowedLossyErrorPtr, interleaveModePtr]\r\n );\r\n\r\n // Extract result values into object\r\n const image = {\r\n result,\r\n width: charLS.getValue(widthPtr, 'i32'),\r\n height: charLS.getValue(heightPtr, 'i32'),\r\n bitsPerSample: charLS.getValue(bitsPerSamplePtr, 'i32'),\r\n stride: charLS.getValue(stridePtr, 'i32'),\r\n components: charLS.getValue(componentsPtr, 'i32'),\r\n allowedLossyError: charLS.getValue(allowedLossyErrorPtr, 'i32'),\r\n interleaveMode: charLS.getValue(interleaveModePtr, 'i32'),\r\n pixelData: undefined\r\n };\r\n\r\n // Copy image from emscripten heap into appropriate array buffer type\r\n const imagePtr = charLS.getValue(imagePtrPtr, '*');\r\n\r\n if (image.bitsPerSample <= 8) {\r\n image.pixelData = new Uint8Array(image.width * image.height * image.components);\r\n image.pixelData.set(new Uint8Array(charLS.HEAP8.buffer, imagePtr, image.pixelData.length));\r\n } else if (isSigned) {\r\n image.pixelData = new Int16Array(image.width * image.height * image.components);\r\n image.pixelData.set(new Int16Array(charLS.HEAP16.buffer, imagePtr, image.pixelData.length));\r\n } else {\r\n image.pixelData = new Uint16Array(image.width * image.height * image.components);\r\n image.pixelData.set(new Uint16Array(charLS.HEAP16.buffer, imagePtr, image.pixelData.length));\r\n }\r\n\r\n // free memory and return image object\r\n charLS._free(dataPtr);\r\n charLS._free(imagePtr);\r\n charLS._free(imagePtrPtr);\r\n charLS._free(imageSizePtr);\r\n charLS._free(widthPtr);\r\n charLS._free(heightPtr);\r\n charLS._free(bitsPerSamplePtr);\r\n charLS._free(stridePtr);\r\n charLS._free(componentsPtr);\r\n charLS._free(interleaveModePtr);\r\n\r\n return image;\r\n}\r\n\r\nfunction initializeJPEGLS () {\r\n // check to make sure codec is loaded\r\n if (typeof CharLS === 'undefined') {\r\n throw new Error('No JPEG-LS decoder loaded');\r\n }\r\n\r\n // Try to initialize CharLS\r\n // CharLS https://github.com/cornerstonejs/charls\r\n if (!charLS) {\r\n charLS = CharLS();\r\n if (!charLS || !charLS._jpegls_decode) {\r\n throw new Error('JPEG-LS failed to initialize');\r\n }\r\n }\r\n\r\n}\r\n\r\nfunction decodeJPEGLS (imageFrame, pixelData) {\r\n initializeJPEGLS();\r\n\r\n const image = jpegLSDecode(pixelData, imageFrame.pixelRepresentation === 1);\r\n\r\n // throw error if not success or too much data\r\n if (image.result !== 0 && image.result !== 6) {\r\n throw new Error(`JPEG-LS decoder failed to decode frame (error code ${image.result})`);\r\n }\r\n\r\n imageFrame.columns = image.width;\r\n imageFrame.rows = image.height;\r\n imageFrame.pixelData = image.pixelData;\r\n\r\n return imageFrame;\r\n}\r\n\r\nexport default decodeJPEGLS;\r\nexport { initializeJPEGLS };\r\n","export default '2.1.2';\n","import getMinMax from './getMinMax.js';\r\n\r\n/**\r\n * Check the minimum and maximum values in the imageFrame pixel data\r\n * match with the provided smallestPixelValue and largestPixelValue metaData.\r\n *\r\n * If 'strict' is true, log to the console a warning if these values do not match.\r\n * Otherwise, correct them automatically.\r\n *\r\n * @param {Object} imageFrame\r\n * @param {Boolean} strict If 'strict' is true, log to the console a warning if these values do not match.\r\n * Otherwise, correct them automatically.Default is true.\r\n */\r\nexport default function calculateMinMax (imageFrame, strict = true) {\r\n const minMax = getMinMax(imageFrame.pixelData);\r\n const mustAssign = !(isNumber(imageFrame.smallestPixelValue) && isNumber(imageFrame.largestPixelValue));\r\n\r\n\r\n if (strict === true && !mustAssign) {\r\n if (imageFrame.smallestPixelValue !== minMax.min) {\r\n console.warn('Image smallestPixelValue tag is incorrect. Rendering performance will suffer considerably.');\r\n }\r\n\r\n if (imageFrame.largestPixelValue !== minMax.max) {\r\n console.warn('Image largestPixelValue tag is incorrect. Rendering performance will suffer considerably.');\r\n }\r\n } else {\r\n imageFrame.smallestPixelValue = minMax.min;\r\n imageFrame.largestPixelValue = minMax.max;\r\n }\r\n}\r\n\r\nfunction isNumber(numValue) {\r\n return typeof numValue === \"number\";\r\n}\r\n","\r\n\r\nfunction decodeJPEGLossless (imageFrame, pixelData) {\r\n // check to make sure codec is loaded\r\n if (typeof jpeg === 'undefined' ||\r\n typeof jpeg.lossless === 'undefined' ||\r\n typeof jpeg.lossless.Decoder === 'undefined') {\r\n throw new Error('No JPEG Lossless decoder loaded');\r\n }\r\n\r\n const byteOutput = imageFrame.bitsAllocated <= 8 ? 1 : 2;\r\n // console.time('jpeglossless');\r\n const buffer = pixelData.buffer;\r\n const decoder = new jpeg.lossless.Decoder();\r\n const decompressedData = decoder.decode(buffer, pixelData.byteOffset, pixelData.length, byteOutput);\r\n // console.timeEnd('jpeglossless');\r\n\r\n if (imageFrame.pixelRepresentation === 0) {\r\n if (imageFrame.bitsAllocated === 16) {\r\n imageFrame.pixelData = new Uint16Array(decompressedData.buffer);\r\n\r\n return imageFrame;\r\n }\r\n // untested!\r\n imageFrame.pixelData = new Uint8Array(decompressedData.buffer);\r\n\r\n return imageFrame;\r\n\r\n }\r\n imageFrame.pixelData = new Int16Array(decompressedData.buffer);\r\n\r\n return imageFrame;\r\n\r\n}\r\n\r\nexport default decodeJPEGLossless;\r\n","\r\n\r\nfunction decodeJPEGBaseline (imageFrame, pixelData) {\r\n // check to make sure codec is loaded\r\n if (typeof JpegImage === 'undefined') {\r\n throw new Error('No JPEG Baseline decoder loaded');\r\n }\r\n const jpeg = new JpegImage();\r\n\r\n jpeg.parse(pixelData);\r\n\r\n // Do not use the internal jpeg.js color transformation,\r\n // since we will handle this afterwards\r\n jpeg.colorTransform = false;\r\n\r\n if (imageFrame.bitsAllocated === 8) {\r\n imageFrame.pixelData = jpeg.getData(imageFrame.columns, imageFrame.rows);\r\n\r\n return imageFrame;\r\n } else if (imageFrame.bitsAllocated === 16) {\r\n imageFrame.pixelData = jpeg.getData16(imageFrame.columns, imageFrame.rows);\r\n\r\n return imageFrame;\r\n }\r\n}\r\n\r\nexport default decodeJPEGBaseline;\r\n","function decodeRLE (imageFrame, pixelData) {\r\n if (imageFrame.bitsAllocated === 8) {\r\n if (imageFrame.planarConfiguration) {\r\n return decode8Planar(imageFrame, pixelData);\r\n }\r\n\r\n return decode8(imageFrame, pixelData);\r\n } else if (imageFrame.bitsAllocated === 16) {\r\n return decode16(imageFrame, pixelData);\r\n }\r\n\r\n throw new Error('unsupported pixel format for RLE');\r\n}\r\n\r\nfunction decode8 (imageFrame, pixelData) {\r\n const frameData = pixelData;\r\n const frameSize = imageFrame.rows * imageFrame.columns;\r\n const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);\r\n const header = new DataView(frameData.buffer, frameData.byteOffset);\r\n const data = new Int8Array(frameData.buffer, frameData.byteOffset);\r\n const out = new Int8Array(outFrame);\r\n\r\n let outIndex = 0;\r\n const numSegments = header.getInt32(0, true);\r\n\r\n for (let s = 0; s < numSegments; ++s) {\r\n outIndex = s;\r\n\r\n let inIndex = header.getInt32((s + 1) * 4, true);\r\n let maxIndex = header.getInt32((s + 2) * 4, true);\r\n\r\n if (maxIndex === 0) {\r\n maxIndex = frameData.length;\r\n }\r\n\r\n const endOfSegment = frameSize * numSegments;\r\n\r\n while (inIndex < maxIndex) {\r\n const n = data[inIndex++];\r\n\r\n if (n >= 0 && n <= 127) {\r\n // copy n bytes\r\n for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {\r\n out[outIndex] = data[inIndex++];\r\n outIndex += imageFrame.samplesPerPixel;\r\n }\r\n } else if (n <= -1 && n >= -127) {\r\n const value = data[inIndex++];\r\n // run of n bytes\r\n\r\n for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {\r\n out[outIndex] = value;\r\n outIndex += imageFrame.samplesPerPixel;\r\n }\r\n }/* else if (n === -128) {\r\n\r\n } // do nothing */\r\n }\r\n }\r\n imageFrame.pixelData = new Uint8Array(outFrame);\r\n\r\n return imageFrame;\r\n}\r\n\r\nfunction decode8Planar (imageFrame, pixelData) {\r\n const frameData = pixelData;\r\n const frameSize = imageFrame.rows * imageFrame.columns;\r\n const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);\r\n const header = new DataView(frameData.buffer, frameData.byteOffset);\r\n const data = new Int8Array(frameData.buffer, frameData.byteOffset);\r\n const out = new Int8Array(outFrame);\r\n\r\n let outIndex = 0;\r\n const numSegments = header.getInt32(0, true);\r\n\r\n for (let s = 0; s < numSegments; ++s) {\r\n outIndex = s * frameSize;\r\n\r\n let inIndex = header.getInt32((s + 1) * 4, true);\r\n let maxIndex = header.getInt32((s + 2) * 4, true);\r\n\r\n if (maxIndex === 0) {\r\n maxIndex = frameData.length;\r\n }\r\n\r\n const endOfSegment = frameSize * numSegments;\r\n\r\n while (inIndex < maxIndex) {\r\n const n = data[inIndex++];\r\n\r\n if (n >= 0 && n <= 127) {\r\n // copy n bytes\r\n for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {\r\n out[outIndex] = data[inIndex++];\r\n outIndex++;\r\n }\r\n } else if (n <= -1 && n >= -127) {\r\n const value = data[inIndex++];\r\n // run of n bytes\r\n\r\n for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {\r\n out[outIndex] = value;\r\n outIndex++;\r\n }\r\n }/* else if (n === -128) {\r\n\r\n } // do nothing */\r\n }\r\n }\r\n imageFrame.pixelData = new Uint8Array(outFrame);\r\n\r\n return imageFrame;\r\n}\r\n\r\nfunction decode16 (imageFrame, pixelData) {\r\n const frameData = pixelData;\r\n const frameSize = imageFrame.rows * imageFrame.columns;\r\n const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel * 2);\r\n\r\n const header = new DataView(frameData.buffer, frameData.byteOffset);\r\n const data = new Int8Array(frameData.buffer, frameData.byteOffset);\r\n const out = new Int8Array(outFrame);\r\n\r\n const numSegments = header.getInt32(0, true);\r\n\r\n for (let s = 0; s < numSegments; ++s) {\r\n let outIndex = 0;\r\n const highByte = (s === 0 ? 1 : 0);\r\n\r\n let inIndex = header.getInt32((s + 1) * 4, true);\r\n let maxIndex = header.getInt32((s + 2) * 4, true);\r\n\r\n if (maxIndex === 0) {\r\n maxIndex = frameData.length;\r\n }\r\n\r\n while (inIndex < maxIndex) {\r\n const n = data[inIndex++];\r\n\r\n if (n >= 0 && n <= 127) {\r\n for (let i = 0; i < n + 1 && outIndex < frameSize; ++i) {\r\n out[(outIndex * 2) + highByte] = data[inIndex++];\r\n outIndex++;\r\n }\r\n } else if (n <= -1 && n >= -127) {\r\n const value = data[inIndex++];\r\n\r\n for (let j = 0; j < -n + 1 && outIndex < frameSize; ++j) {\r\n out[(outIndex * 2) + highByte] = value;\r\n outIndex++;\r\n }\r\n }/* else if (n === -128) {\r\n\r\n } // do nothing */\r\n }\r\n }\r\n if (imageFrame.pixelRepresentation === 0) {\r\n imageFrame.pixelData = new Uint16Array(outFrame);\r\n } else {\r\n imageFrame.pixelData = new Int16Array(outFrame);\r\n }\r\n\r\n return imageFrame;\r\n}\r\n\r\nexport default decodeRLE;\r\n","/* eslint no-bitwise: 0 */\r\nfunction swap16 (val) {\r\n return ((val & 0xFF) << 8) |\r\n ((val >> 8) & 0xFF);\r\n}\r\n\r\n\r\nfunction decodeBigEndian (imageFrame, pixelData) {\r\n if (imageFrame.bitsAllocated === 16) {\r\n let arrayBuffer = pixelData.buffer;\r\n let offset = pixelData.byteOffset;\r\n const length = pixelData.length;\r\n // if pixel data is not aligned on even boundary, shift it so we can create the 16 bit array\r\n // buffers on it\r\n\r\n if (offset % 2) {\r\n arrayBuffer = arrayBuffer.slice(offset);\r\n offset = 0;\r\n }\r\n\r\n if (imageFrame.pixelRepresentation === 0) {\r\n imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);\r\n } else {\r\n imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);\r\n }\r\n // Do the byte swap\r\n for (let i = 0; i < imageFrame.pixelData.length; i++) {\r\n imageFrame.pixelData[i] = swap16(imageFrame.pixelData[i]);\r\n }\r\n\r\n } else if (imageFrame.bitsAllocated === 8) {\r\n imageFrame.pixelData = pixelData;\r\n }\r\n\r\n return imageFrame;\r\n}\r\n\r\nexport default decodeBigEndian;\r\n","function decodeLittleEndian (imageFrame, pixelData) {\r\n let arrayBuffer = pixelData.buffer;\r\n let offset = pixelData.byteOffset;\r\n const length = pixelData.length;\r\n\r\n if (imageFrame.bitsAllocated === 16) {\r\n // if pixel data is not aligned on even boundary, shift it so we can create the 16 bit array\r\n // buffers on it\r\n if (offset % 2) {\r\n arrayBuffer = arrayBuffer.slice(offset);\r\n offset = 0;\r\n }\r\n\r\n if (imageFrame.pixelRepresentation === 0) {\r\n imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);\r\n } else {\r\n imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);\r\n }\r\n } else if (imageFrame.bitsAllocated === 8 || imageFrame.bitsAllocated === 1) {\r\n imageFrame.pixelData = pixelData;\r\n } else if (imageFrame.bitsAllocated === 32) {\r\n // if pixel data is not aligned on even boundary, shift it\r\n if (offset % 2) {\r\n arrayBuffer = arrayBuffer.slice(offset);\r\n offset = 0;\r\n }\r\n\r\n imageFrame.pixelData = new Float32Array(arrayBuffer, offset, length / 4);\r\n }\r\n\r\n return imageFrame;\r\n}\r\n\r\nexport default decodeLittleEndian;\r\n","import decodeLittleEndian from './decoders/decodeLittleEndian.js';\r\nimport decodeBigEndian from './decoders/decodeBigEndian.js';\r\nimport decodeRLE from './decoders/decodeRLE.js';\r\nimport decodeJPEGBaseline from './decoders/decodeJPEGBaseline.js';\r\nimport decodeJPEGLossless from './decoders/decodeJPEGLossless.js';\r\nimport decodeJPEGLS from './decoders/decodeJPEGLS.js';\r\nimport decodeJPEG2000 from './decoders/decodeJPEG2000.js';\r\n\r\nfunction decodeImageFrame (imageFrame, transferSyntax, pixelData, decodeConfig, options) {\r\n const start = new Date().getTime();\r\n\r\n if (transferSyntax === '1.2.840.10008.1.2') {\r\n // Implicit VR Little Endian\r\n imageFrame = decodeLittleEndian(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.1') {\r\n // Explicit VR Little Endian\r\n imageFrame = decodeLittleEndian(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.2') {\r\n // Explicit VR Big Endian (retired)\r\n imageFrame = decodeBigEndian(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.1.99') {\r\n // Deflate transfer syntax (deflated by dicomParser)\r\n imageFrame = decodeLittleEndian(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.5') {\r\n // RLE Lossless\r\n imageFrame = decodeRLE(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.50') {\r\n // JPEG Baseline lossy process 1 (8 bit)\r\n imageFrame = decodeJPEGBaseline(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.51') {\r\n // JPEG Baseline lossy process 2 & 4 (12 bit)\r\n imageFrame = decodeJPEGBaseline(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.57') {\r\n // JPEG Lossless, Nonhierarchical (Processes 14)\r\n imageFrame = decodeJPEGLossless(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.70') {\r\n // JPEG Lossless, Nonhierarchical (Processes 14 [Selection 1])\r\n imageFrame = decodeJPEGLossless(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.80') {\r\n // JPEG-LS Lossless Image Compression\r\n imageFrame = decodeJPEGLS(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.81') {\r\n // JPEG-LS Lossy (Near-Lossless) Image Compression\r\n imageFrame = decodeJPEGLS(imageFrame, pixelData);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.90') {\r\n // JPEG 2000 Lossless\r\n imageFrame = decodeJPEG2000(imageFrame, pixelData, decodeConfig, options);\r\n } else if (transferSyntax === '1.2.840.10008.1.2.4.91') {\r\n // JPEG 2000 Lossy\r\n imageFrame = decodeJPEG2000(imageFrame, pixelData, decodeConfig, options);\r\n } else {\r\n throw new Error(`no decoder for transfer syntax ${transferSyntax}`);\r\n }\r\n\r\n /* Don't know if these work...\r\n // JPEG 2000 Part 2 Multicomponent Image Compression (Lossless Only)\r\n else if(transferSyntax === \"1.2.840.10008.1.2.4.92\")\r\n {\r\n return decodeJPEG2000(dataSet, frame);\r\n }\r\n // JPEG 2000 Part 2 Multicomponent Image Compression\r\n else if(transferSyntax === \"1.2.840.10008.1.2.4.93\")\r\n {\r\n return decodeJPEG2000(dataSet, frame);\r\n }\r\n */\r\n\r\n const shouldShift = imageFrame.pixelRepresentation !== undefined && imageFrame.pixelRepresentation === 1;\r\n const shift = (shouldShift && imageFrame.bitsStored !== undefined) ? (32 - imageFrame.bitsStored) : undefined;\r\n\r\n if (shouldShift && shift !== undefined) {\r\n for (let i = 0; i < imageFrame.pixelData.length; i++) {\r\n // eslint-disable-next-line no-bitwise\r\n imageFrame.pixelData[i] = (imageFrame.pixelData[i] << shift >> shift);\r\n }\r\n }\r\n\r\n const end = new Date().getTime();\r\n\r\n imageFrame.decodeTimeInMS = end - start;\r\n\r\n return imageFrame;\r\n}\r\n\r\nexport default decodeImageFrame;\r\n","import { initializeJPEG2000 } from '../../shared/decoders/decodeJPEG2000.js';\r\nimport { initializeJPEGLS } from '../../shared/decoders/decodeJPEGLS.js';\r\nimport calculateMinMax from '../../shared/calculateMinMax.js';\r\nimport decodeImageFrame from '../../shared/decodeImageFrame.js';\r\n\r\n// flag to ensure codecs are loaded only once\r\nlet codecsLoaded = false;\r\n\r\n// the configuration object for the decodeTask\r\nlet decodeConfig;\r\n\r\n/**\r\n * Function to control loading and initializing the codecs\r\n * @param config\r\n */\r\nfunction loadCodecs (config) {\r\n // prevent loading codecs more than once\r\n if (codecsLoaded) {\r\n return;\r\n }\r\n\r\n // Load the codecs\r\n // console.time('loadCodecs');\r\n self.importScripts(config.decodeTask.codecsPath);\r\n codecsLoaded = true;\r\n // console.timeEnd('loadCodecs');\r\n\r\n // Initialize the codecs\r\n if (config.decodeTask.initializeCodecsOnStartup) {\r\n // console.time('initializeCodecs');\r\n initializeJPEG2000(config.decodeTask);\r\n initializeJPEGLS(config.decodeTask);\r\n // console.timeEnd('initializeCodecs');\r\n }\r\n}\r\n\r\n/**\r\n * Task initialization function\r\n */\r\nfunction initialize (config) {\r\n decodeConfig = config;\r\n if (config.decodeTask.loadCodecsOnStartup) {\r\n loadCodecs(config);\r\n }\r\n}\r\n\r\n/**\r\n * Task handler function\r\n */\r\nfunction handler (data, doneCallback) {\r\n // Load the codecs if they aren't already loaded\r\n loadCodecs(decodeConfig);\r\n\r\n const strict = decodeConfig && decodeConfig.decodeTask && decodeConfig.decodeTask.strict;\r\n const imageFrame = data.data.imageFrame;\r\n\r\n // convert pixel data from ArrayBuffer to Uint8Array since web workers support passing ArrayBuffers but\r\n // not typed arrays\r\n const pixelData = new Uint8Array(data.data.pixelData);\r\n\r\n decodeImageFrame(\r\n imageFrame,\r\n data.data.transferSyntax,\r\n pixelData,\r\n decodeConfig.decodeTask,\r\n data.data.options);\r\n\r\n if (!imageFrame.pixelData) {\r\n throw new Error('decodeTask: imageFrame.pixelData is undefined after decoding');\r\n }\r\n\r\n calculateMinMax(imageFrame, strict);\r\n\r\n // convert from TypedArray to ArrayBuffer since web workers support passing ArrayBuffers but not\r\n // typed arrays\r\n imageFrame.pixelData = imageFrame.pixelData.buffer;\r\n\r\n // invoke the callback with our result and pass the pixelData in the transferList to move it to\r\n // UI thread without making a copy\r\n doneCallback(imageFrame, [imageFrame.pixelData]);\r\n}\r\n\r\nexport default {\r\n taskType: 'decodeTask',\r\n handler,\r\n initialize\r\n};\r\n","// an object of task handlers\r\nconst taskHandlers = {};\r\n\r\n// Flag to ensure web worker is only initialized once\r\nlet initialized = false;\r\n\r\n// the configuration object passed in when the web worker manager is initialized\r\nlet config;\r\n\r\n/**\r\n * Initialization function that loads additional web workers and initializes them\r\n * @param data\r\n */\r\nfunction initialize (data) {\r\n // console.log('web worker initialize ', data.workerIndex);\r\n // prevent initialization from happening more than once\r\n if (initialized) {\r\n return;\r\n }\r\n\r\n // save the config data\r\n config = data.config;\r\n\r\n // load any additional web worker tasks\r\n if (data.config.webWorkerTaskPaths) {\r\n for (let i = 0; i < data.config.webWorkerTaskPaths.length; i++) {\r\n self.importScripts(data.config.webWorkerTaskPaths[i]);\r\n }\r\n }\r\n\r\n // initialize each task handler\r\n Object.keys(taskHandlers).forEach(function (key) {\r\n taskHandlers[key].initialize(config.taskConfiguration);\r\n });\r\n\r\n // tell main ui thread that we have completed initialization\r\n self.postMessage({\r\n taskType: 'initialize',\r\n status: 'success',\r\n result: {\r\n },\r\n workerIndex: data.workerIndex\r\n });\r\n\r\n initialized = true;\r\n}\r\n\r\n/**\r\n * Function exposed to web worker tasks to register themselves\r\n * @param taskHandler\r\n */\r\nexport function registerTaskHandler (taskHandler) {\r\n if (taskHandlers[taskHandler.taskType]) {\r\n console.log('attempt to register duplicate task handler \"', taskHandler.taskType, '\"');\r\n\r\n return false;\r\n }\r\n taskHandlers[taskHandler.taskType] = taskHandler;\r\n if (initialized) {\r\n taskHandler.initialize(config.taskConfiguration);\r\n }\r\n}\r\n\r\n/**\r\n * Function to load a new web worker task with updated configuration\r\n * @param data\r\n */\r\nfunction loadWebWorkerTask (data) {\r\n config = data.config;\r\n self.importScripts(data.sourcePath);\r\n}\r\n\r\n/**\r\n * Web worker message handler - dispatches messages to the registered task handlers\r\n * @param msg\r\n */\r\nself.onmessage = function (msg) {\r\n // console.log('web worker onmessage', msg.data);\r\n\r\n // handle initialize message\r\n if (msg.data.taskType === 'initialize') {\r\n initialize(msg.data);\r\n\r\n return;\r\n }\r\n\r\n // handle loadWebWorkerTask message\r\n if (msg.data.taskType === 'loadWebWorkerTask') {\r\n loadWebWorkerTask(msg.data);\r\n\r\n return;\r\n }\r\n\r\n // dispatch the message if there is a handler registered for it\r\n if (taskHandlers[msg.data.taskType]) {\r\n taskHandlers[msg.data.taskType].handler(msg.data, function (result, transferList) {\r\n self.postMessage({\r\n taskType: msg.data.taskType,\r\n status: 'success',\r\n result,\r\n workerIndex: msg.data.workerIndex\r\n }, transferList);\r\n });\r\n\r\n return;\r\n }\r\n\r\n // not task handler registered - send a failure message back to ui thread\r\n console.log('no task handler for ', msg.data.taskType);\r\n console.log(taskHandlers);\r\n self.postMessage({\r\n taskType: msg.data.taskType,\r\n status: 'failed - no task handler registered',\r\n workerIndex: msg.data.workerIndex\r\n });\r\n};\r\n","import { registerTaskHandler } from './webWorker.js';\r\nimport decodeTask from './decodeTask/decodeTask.js';\r\n\r\n// register our task\r\nregisterTaskHandler(decodeTask);\r\n\r\nexport { registerTaskHandler };\r\nexport { default as version } from '../version.js';\r\n"],"sourceRoot":""} diff --git a/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.html b/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.html deleted file mode 100644 index b5934b22e..000000000 --- a/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.html +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.js b/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.js deleted file mode 100644 index dfa2cfb39..000000000 --- a/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.js +++ /dev/null @@ -1,15 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Router } from 'meteor/clinical:router'; - -Template.demoSignin.events({ - 'click #google-login-button'() { - OHIF.gcloud.setEnabled(true); - OHIF.user.login(); - }, - 'click #anonymous-login-button'() { - OHIF.gcloud.setEnabled(false); - OHIF.demoMode.login(); - Router.go('/studylist', {}, { replaceState: true }); - } -}); - diff --git a/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.styl b/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.styl deleted file mode 100644 index 75cf61132..000000000 --- a/Packages/ohif-demo-mode/imports/client/components/demoSignin/demoSignin.styl +++ /dev/null @@ -1,93 +0,0 @@ -@require '{ohif:design}/app' - -.demoSignin - display flex - flex 1 - flex-flow row nowrap - align-items stretch - height 100vh - min-height 600px - width 100% - background-color rgba(21, 25, 30, 0.7) - -.demo-content - margin auto - width 500px - position relative - top -150px - -.demoSigninButtons - margin auto - width 270px - font-weight 500 - -#google-login-button - display flex - justify-content center - height 40px - width 100% - color #fff - border-color #4285F4 - background #4285F4 - border-radius 3px - box-shadow 0 0 1px 0 rgba(0, 0, 0, 0.12), 0 1px 1px 0 rgba(0, 0, 0, 0.24) - cursor pointer - position relative - align-items center - -#anonymous-login-button - display flex - justify-content center - height 40px - width 100% - color #757575 - border-color white - background white - border-radius 3px - box-shadow 0 0 1px 0 rgba(0, 0, 0, 0.12), 0 1px 1px 0 rgba(0, 0, 0, 0.24) - cursor pointer - position relative - align-items center - -#google-login-button .sign-in-with-google-icon-tile - position absolute - top 1px - left 1px - background #fff - border-radius 2px - height 32px - width 32px - display flex - align-items center - justify-content center - font-weight 500 - -svg.google-icon - width 24px - height 24px - -hr.tint - border-color hsla(0, 0%, 100%, 0.3) - -.demo-brand - height 60px - display inline-block - text-decoration none - margin-bottom 30px - - .logo-image - display inline-block - fill transparent - float left - height 100% - margin 0 8px 0 0 - width 60px - margin-right 20px - - .logo-text - display inline-block - font-family Roboto, Arial, Helvetica, sans-serif - font-size 26px - font-weight 400 - theme('color', '$textPrimaryColor') - line-height 60px \ No newline at end of file diff --git a/Packages/ohif-demo-mode/imports/client/components/index.js b/Packages/ohif-demo-mode/imports/client/components/index.js deleted file mode 100644 index 16ec46a8d..000000000 --- a/Packages/ohif-demo-mode/imports/client/components/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './demoSignin/demoSignin.html'; -import './demoSignin/demoSignin.js'; -import './demoSignin/demoSignin.styl'; diff --git a/Packages/ohif-demo-mode/imports/client/demoModeMediator.js b/Packages/ohif-demo-mode/imports/client/demoModeMediator.js deleted file mode 100644 index d4338c5df..000000000 --- a/Packages/ohif-demo-mode/imports/client/demoModeMediator.js +++ /dev/null @@ -1,29 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Router } from 'meteor/clinical:router'; -import { Servers, CurrentServer } from 'meteor/ohif:servers/both/collections'; - -const devModeMediator = {}; -export default devModeMediator; - -const DEMO_SERVER_NAME = "demo-dcm4chee"; - -devModeMediator.login = () => sessionStorage.setItem('isDemoUserSignedIn', true); - -devModeMediator.logout = () => { - if (OHIF.user.userLoggedIn()) - OHIF.user.logout(); - sessionStorage.removeItem('isDemoUserSignedIn'); - Router.go('/'); -} - -devModeMediator.userLoggedIn = () => sessionStorage.getItem('isDemoUserSignedIn'); - -devModeMediator.setDemoServerConfig = () => { - CurrentServer.remove({}); - const demoServer = Servers.findOne({ name: DEMO_SERVER_NAME }); - if (!demoServer) - throw new Error("demoServer is not found"); - CurrentServer.insert({ - serverId: demoServer._id - }); -}; \ No newline at end of file diff --git a/Packages/ohif-demo-mode/imports/client/index.js b/Packages/ohif-demo-mode/imports/client/index.js deleted file mode 100644 index 0dc08b954..000000000 --- a/Packages/ohif-demo-mode/imports/client/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import devModeMediator from './demoModeMediator.js'; -import './components'; -import './routes.js'; - -OHIF.demoMode = devModeMediator; - diff --git a/Packages/ohif-demo-mode/imports/client/routes.js b/Packages/ohif-demo-mode/imports/client/routes.js deleted file mode 100644 index b449f14bc..000000000 --- a/Packages/ohif-demo-mode/imports/client/routes.js +++ /dev/null @@ -1,26 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Router } from 'meteor/clinical:router'; -import { OHIF } from 'meteor/ohif:core'; - -const DEMO_SIGN_IN_PAGE = '/demo-signin'; - -Router.onRun(function() { - if (!OHIF.demoMode) - this.next(); - else if (this.url === DEMO_SIGN_IN_PAGE) - this.next(); - else if (OHIF.demoMode.userLoggedIn() || OHIF.user.userLoggedIn()) { - // user is logged in whether in demo or in oidc mode - this.next(); - } else if (this.url === OHIF.user.getOidcRedirectUri()) { - // allow oidc to sign in - this.next(); - } else { - // redirect to demo login page - Router.go(DEMO_SIGN_IN_PAGE, {}, { replaceState: true }); - } -}); - -Router.route(DEMO_SIGN_IN_PAGE, function() { - this.render('demoSignin'); -}, { name: 'demo' }); \ No newline at end of file diff --git a/Packages/ohif-demo-mode/main.js b/Packages/ohif-demo-mode/main.js deleted file mode 100644 index 6e8e8f5a6..000000000 --- a/Packages/ohif-demo-mode/main.js +++ /dev/null @@ -1,3 +0,0 @@ -if (Meteor.settings.public.demoMode) { - import './imports/client/index.js'; -} diff --git a/Packages/ohif-demo-mode/package.js b/Packages/ohif-demo-mode/package.js deleted file mode 100644 index 2626bf1da..000000000 --- a/Packages/ohif-demo-mode/package.js +++ /dev/null @@ -1,19 +0,0 @@ -Package.describe({ - name: 'ohif:demo-mode', - summary: 'demo mode', - version: '0.0.1', -}); - -Package.onUse(function(api) { - api.versionsFrom('1.4'); - - api.use('http'); - api.use('ecmascript'); - api.use(['templating', 'stylus'], 'client'); - - // OHIF dependencies - api.use('ohif:core', 'client'); - - // Main module - api.mainModule('main.js', 'client'); -}); diff --git a/Packages/ohif-design/app.styl b/Packages/ohif-design/app.styl deleted file mode 100644 index 2b26bb009..000000000 --- a/Packages/ohif-design/app.styl +++ /dev/null @@ -1,6 +0,0 @@ -@import "{ohif:design}/styles/imports/animations" -@import "{ohif:design}/styles/imports/mixins" -@import "{ohif:design}/styles/imports/spacings" -@import "{ohif:design}/styles/imports/variables" -@import "{ohif:design}/styles/imports/theme-icons" -@import "{ohif:design}/styles/imports/theming" diff --git a/Packages/ohif-design/assets/theme-icons.png b/Packages/ohif-design/assets/theme-icons.png deleted file mode 100644 index 098f7ed52..000000000 Binary files a/Packages/ohif-design/assets/theme-icons.png and /dev/null differ diff --git a/Packages/ohif-design/bootstrap/css/bootstrap.css b/Packages/ohif-design/bootstrap/css/bootstrap.css deleted file mode 100644 index 2ec4e00aa..000000000 --- a/Packages/ohif-design/bootstrap/css/bootstrap.css +++ /dev/null @@ -1,6755 +0,0 @@ -/*! - * Bootstrap v3.4.0 (http://getbootstrap.com) - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ -/* stylelint-disable value-keyword-case */ -/* stylelint-disable font-family-name-quotes, font-family-no-missing-generic-family-keyword */ -/* stylelint-disable media-feature-name-no-vendor-prefix, media-feature-parentheses-space-inside, media-feature-name-no-unknown, indentation, at-rule-name-space-after */ -/* stylelint-disable declaration-no-important */ -/* stylelint-disable indentation, property-no-vendor-prefix, selector-no-vendor-prefix */ -/* stylelint-disable value-no-vendor-prefix, selector-max-id */ -/* stylelint-disable */ -/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ -html { - font-family: sans-serif; - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; -} -body { - margin: 0; -} -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; -} -audio, -canvas, -progress, -video { - display: inline-block; - vertical-align: baseline; -} -audio:not([controls]) { - display: none; - height: 0; -} -[hidden], -template { - display: none; -} -a { - background-color: transparent; -} -a:active, -a:hover { - outline: 0; -} -abbr[title] { - border-bottom: 1px dotted; -} -b, -strong { - font-weight: bold; -} -dfn { - font-style: italic; -} -h1 { - font-size: 2em; - margin: 0.67em 0; -} -mark { - background: #ff0; - color: #000; -} -small { - font-size: 80%; -} -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} -sup { - top: -0.5em; -} -sub { - bottom: -0.25em; -} -img { - border: 0; -} -svg:not(:root) { - overflow: hidden; -} -figure { - margin: 1em 40px; -} -hr { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} -pre { - overflow: auto; -} -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} -button, -input, -optgroup, -select, -textarea { - color: inherit; - font: inherit; - margin: 0; -} -button { - overflow: visible; -} -button, -select { - text-transform: none; -} -button, -html input[type="button"], -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; - cursor: pointer; -} -button[disabled], -html input[disabled] { - cursor: default; -} -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} -input { - line-height: normal; -} -input[type="checkbox"], -input[type="radio"] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: 0; -} -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} -input[type="search"] { - -webkit-appearance: textfield; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} -legend { - border: 0; - padding: 0; -} -textarea { - overflow: auto; -} -optgroup { - font-weight: bold; -} -table { - border-collapse: collapse; - border-spacing: 0; -} -td, -th { - padding: 0; -} -/* stylelint-disable declaration-no-important, selector-no-qualifying-type */ -/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ -@media print { - *, - *::before, - *::after { - color: #000 !important; - text-shadow: none !important; - background: transparent !important; - -webkit-box-shadow: none !important; - box-shadow: none !important; - } - a, - a:visited { - text-decoration: underline; - } - a[href]::after { - content: " (" attr(href) ")"; - } - abbr[title]::after { - content: " (" attr(title) ")"; - } - a[href^="#"]::after, - a[href^="javascript:"]::after { - content: ""; - } - pre, - blockquote { - border: 1px solid #999; - page-break-inside: avoid; - } - thead { - display: table-header-group; - } - tr, - img { - page-break-inside: avoid; - } - img { - max-width: 100% !important; - } - p, - h2, - h3 { - orphans: 3; - widows: 3; - } - h2, - h3 { - page-break-after: avoid; - } - .navbar { - display: none; - } - .btn > .caret, - .dropup > .btn > .caret { - border-top-color: #000 !important; - } - .label { - border: 1px solid #000; - } - .table { - border-collapse: collapse !important; - } - .table td, - .table th { - background-color: #fff !important; - } - .table-bordered th, - .table-bordered td { - border: 1px solid #ddd !important; - } -} -/* stylelint-disable value-list-comma-newline-after, value-list-comma-space-after, indentation, declaration-colon-newline-after, font-family-no-missing-generic-family-keyword */ -@font-face { - font-family: "Glyphicons Halflings"; - src: url("../fonts/glyphicons-halflings-regular.eot"); - src: url("../fonts/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("../fonts/glyphicons-halflings-regular.woff2") format("woff2"), url("../fonts/glyphicons-halflings-regular.woff") format("woff"), url("../fonts/glyphicons-halflings-regular.ttf") format("truetype"), url("../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg"); -} -.glyphicon { - position: relative; - top: 1px; - display: inline-block; - font-family: "Glyphicons Halflings"; - font-style: normal; - font-weight: 400; - line-height: 1; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -.glyphicon-asterisk::before { - content: "\002a"; -} -.glyphicon-plus::before { - content: "\002b"; -} -.glyphicon-euro::before, -.glyphicon-eur::before { - content: "\20ac"; -} -.glyphicon-minus::before { - content: "\2212"; -} -.glyphicon-cloud::before { - content: "\2601"; -} -.glyphicon-envelope::before { - content: "\2709"; -} -.glyphicon-pencil::before { - content: "\270f"; -} -.glyphicon-glass::before { - content: "\e001"; -} -.glyphicon-music::before { - content: "\e002"; -} -.glyphicon-search::before { - content: "\e003"; -} -.glyphicon-heart::before { - content: "\e005"; -} -.glyphicon-star::before { - content: "\e006"; -} -.glyphicon-star-empty::before { - content: "\e007"; -} -.glyphicon-user::before { - content: "\e008"; -} -.glyphicon-film::before { - content: "\e009"; -} -.glyphicon-th-large::before { - content: "\e010"; -} -.glyphicon-th::before { - content: "\e011"; -} -.glyphicon-th-list::before { - content: "\e012"; -} -.glyphicon-ok::before { - content: "\e013"; -} -.glyphicon-remove::before { - content: "\e014"; -} -.glyphicon-zoom-in::before { - content: "\e015"; -} -.glyphicon-zoom-out::before { - content: "\e016"; -} -.glyphicon-off::before { - content: "\e017"; -} -.glyphicon-signal::before { - content: "\e018"; -} -.glyphicon-cog::before { - content: "\e019"; -} -.glyphicon-trash::before { - content: "\e020"; -} -.glyphicon-home::before { - content: "\e021"; -} -.glyphicon-file::before { - content: "\e022"; -} -.glyphicon-time::before { - content: "\e023"; -} -.glyphicon-road::before { - content: "\e024"; -} -.glyphicon-download-alt::before { - content: "\e025"; -} -.glyphicon-download::before { - content: "\e026"; -} -.glyphicon-upload::before { - content: "\e027"; -} -.glyphicon-inbox::before { - content: "\e028"; -} -.glyphicon-play-circle::before { - content: "\e029"; -} -.glyphicon-repeat::before { - content: "\e030"; -} -.glyphicon-refresh::before { - content: "\e031"; -} -.glyphicon-list-alt::before { - content: "\e032"; -} -.glyphicon-lock::before { - content: "\e033"; -} -.glyphicon-flag::before { - content: "\e034"; -} -.glyphicon-headphones::before { - content: "\e035"; -} -.glyphicon-volume-off::before { - content: "\e036"; -} -.glyphicon-volume-down::before { - content: "\e037"; -} -.glyphicon-volume-up::before { - content: "\e038"; -} -.glyphicon-qrcode::before { - content: "\e039"; -} -.glyphicon-barcode::before { - content: "\e040"; -} -.glyphicon-tag::before { - content: "\e041"; -} -.glyphicon-tags::before { - content: "\e042"; -} -.glyphicon-book::before { - content: "\e043"; -} -.glyphicon-bookmark::before { - content: "\e044"; -} -.glyphicon-print::before { - content: "\e045"; -} -.glyphicon-camera::before { - content: "\e046"; -} -.glyphicon-font::before { - content: "\e047"; -} -.glyphicon-bold::before { - content: "\e048"; -} -.glyphicon-italic::before { - content: "\e049"; -} -.glyphicon-text-height::before { - content: "\e050"; -} -.glyphicon-text-width::before { - content: "\e051"; -} -.glyphicon-align-left::before { - content: "\e052"; -} -.glyphicon-align-center::before { - content: "\e053"; -} -.glyphicon-align-right::before { - content: "\e054"; -} -.glyphicon-align-justify::before { - content: "\e055"; -} -.glyphicon-list::before { - content: "\e056"; -} -.glyphicon-indent-left::before { - content: "\e057"; -} -.glyphicon-indent-right::before { - content: "\e058"; -} -.glyphicon-facetime-video::before { - content: "\e059"; -} -.glyphicon-picture::before { - content: "\e060"; -} -.glyphicon-map-marker::before { - content: "\e062"; -} -.glyphicon-adjust::before { - content: "\e063"; -} -.glyphicon-tint::before { - content: "\e064"; -} -.glyphicon-edit::before { - content: "\e065"; -} -.glyphicon-share::before { - content: "\e066"; -} -.glyphicon-check::before { - content: "\e067"; -} -.glyphicon-move::before { - content: "\e068"; -} -.glyphicon-step-backward::before { - content: "\e069"; -} -.glyphicon-fast-backward::before { - content: "\e070"; -} -.glyphicon-backward::before { - content: "\e071"; -} -.glyphicon-play::before { - content: "\e072"; -} -.glyphicon-pause::before { - content: "\e073"; -} -.glyphicon-stop::before { - content: "\e074"; -} -.glyphicon-forward::before { - content: "\e075"; -} -.glyphicon-fast-forward::before { - content: "\e076"; -} -.glyphicon-step-forward::before { - content: "\e077"; -} -.glyphicon-eject::before { - content: "\e078"; -} -.glyphicon-chevron-left::before { - content: "\e079"; -} -.glyphicon-chevron-right::before { - content: "\e080"; -} -.glyphicon-plus-sign::before { - content: "\e081"; -} -.glyphicon-minus-sign::before { - content: "\e082"; -} -.glyphicon-remove-sign::before { - content: "\e083"; -} -.glyphicon-ok-sign::before { - content: "\e084"; -} -.glyphicon-question-sign::before { - content: "\e085"; -} -.glyphicon-info-sign::before { - content: "\e086"; -} -.glyphicon-screenshot::before { - content: "\e087"; -} -.glyphicon-remove-circle::before { - content: "\e088"; -} -.glyphicon-ok-circle::before { - content: "\e089"; -} -.glyphicon-ban-circle::before { - content: "\e090"; -} -.glyphicon-arrow-left::before { - content: "\e091"; -} -.glyphicon-arrow-right::before { - content: "\e092"; -} -.glyphicon-arrow-up::before { - content: "\e093"; -} -.glyphicon-arrow-down::before { - content: "\e094"; -} -.glyphicon-share-alt::before { - content: "\e095"; -} -.glyphicon-resize-full::before { - content: "\e096"; -} -.glyphicon-resize-small::before { - content: "\e097"; -} -.glyphicon-exclamation-sign::before { - content: "\e101"; -} -.glyphicon-gift::before { - content: "\e102"; -} -.glyphicon-leaf::before { - content: "\e103"; -} -.glyphicon-fire::before { - content: "\e104"; -} -.glyphicon-eye-open::before { - content: "\e105"; -} -.glyphicon-eye-close::before { - content: "\e106"; -} -.glyphicon-warning-sign::before { - content: "\e107"; -} -.glyphicon-plane::before { - content: "\e108"; -} -.glyphicon-calendar::before { - content: "\e109"; -} -.glyphicon-random::before { - content: "\e110"; -} -.glyphicon-comment::before { - content: "\e111"; -} -.glyphicon-magnet::before { - content: "\e112"; -} -.glyphicon-chevron-up::before { - content: "\e113"; -} -.glyphicon-chevron-down::before { - content: "\e114"; -} -.glyphicon-retweet::before { - content: "\e115"; -} -.glyphicon-shopping-cart::before { - content: "\e116"; -} -.glyphicon-folder-close::before { - content: "\e117"; -} -.glyphicon-folder-open::before { - content: "\e118"; -} -.glyphicon-resize-vertical::before { - content: "\e119"; -} -.glyphicon-resize-horizontal::before { - content: "\e120"; -} -.glyphicon-hdd::before { - content: "\e121"; -} -.glyphicon-bullhorn::before { - content: "\e122"; -} -.glyphicon-bell::before { - content: "\e123"; -} -.glyphicon-certificate::before { - content: "\e124"; -} -.glyphicon-thumbs-up::before { - content: "\e125"; -} -.glyphicon-thumbs-down::before { - content: "\e126"; -} -.glyphicon-hand-right::before { - content: "\e127"; -} -.glyphicon-hand-left::before { - content: "\e128"; -} -.glyphicon-hand-up::before { - content: "\e129"; -} -.glyphicon-hand-down::before { - content: "\e130"; -} -.glyphicon-circle-arrow-right::before { - content: "\e131"; -} -.glyphicon-circle-arrow-left::before { - content: "\e132"; -} -.glyphicon-circle-arrow-up::before { - content: "\e133"; -} -.glyphicon-circle-arrow-down::before { - content: "\e134"; -} -.glyphicon-globe::before { - content: "\e135"; -} -.glyphicon-wrench::before { - content: "\e136"; -} -.glyphicon-tasks::before { - content: "\e137"; -} -.glyphicon-filter::before { - content: "\e138"; -} -.glyphicon-briefcase::before { - content: "\e139"; -} -.glyphicon-fullscreen::before { - content: "\e140"; -} -.glyphicon-dashboard::before { - content: "\e141"; -} -.glyphicon-paperclip::before { - content: "\e142"; -} -.glyphicon-heart-empty::before { - content: "\e143"; -} -.glyphicon-link::before { - content: "\e144"; -} -.glyphicon-phone::before { - content: "\e145"; -} -.glyphicon-pushpin::before { - content: "\e146"; -} -.glyphicon-usd::before { - content: "\e148"; -} -.glyphicon-gbp::before { - content: "\e149"; -} -.glyphicon-sort::before { - content: "\e150"; -} -.glyphicon-sort-by-alphabet::before { - content: "\e151"; -} -.glyphicon-sort-by-alphabet-alt::before { - content: "\e152"; -} -.glyphicon-sort-by-order::before { - content: "\e153"; -} -.glyphicon-sort-by-order-alt::before { - content: "\e154"; -} -.glyphicon-sort-by-attributes::before { - content: "\e155"; -} -.glyphicon-sort-by-attributes-alt::before { - content: "\e156"; -} -.glyphicon-unchecked::before { - content: "\e157"; -} -.glyphicon-expand::before { - content: "\e158"; -} -.glyphicon-collapse-down::before { - content: "\e159"; -} -.glyphicon-collapse-up::before { - content: "\e160"; -} -.glyphicon-log-in::before { - content: "\e161"; -} -.glyphicon-flash::before { - content: "\e162"; -} -.glyphicon-log-out::before { - content: "\e163"; -} -.glyphicon-new-window::before { - content: "\e164"; -} -.glyphicon-record::before { - content: "\e165"; -} -.glyphicon-save::before { - content: "\e166"; -} -.glyphicon-open::before { - content: "\e167"; -} -.glyphicon-saved::before { - content: "\e168"; -} -.glyphicon-import::before { - content: "\e169"; -} -.glyphicon-export::before { - content: "\e170"; -} -.glyphicon-send::before { - content: "\e171"; -} -.glyphicon-floppy-disk::before { - content: "\e172"; -} -.glyphicon-floppy-saved::before { - content: "\e173"; -} -.glyphicon-floppy-remove::before { - content: "\e174"; -} -.glyphicon-floppy-save::before { - content: "\e175"; -} -.glyphicon-floppy-open::before { - content: "\e176"; -} -.glyphicon-credit-card::before { - content: "\e177"; -} -.glyphicon-transfer::before { - content: "\e178"; -} -.glyphicon-cutlery::before { - content: "\e179"; -} -.glyphicon-header::before { - content: "\e180"; -} -.glyphicon-compressed::before { - content: "\e181"; -} -.glyphicon-earphone::before { - content: "\e182"; -} -.glyphicon-phone-alt::before { - content: "\e183"; -} -.glyphicon-tower::before { - content: "\e184"; -} -.glyphicon-stats::before { - content: "\e185"; -} -.glyphicon-sd-video::before { - content: "\e186"; -} -.glyphicon-hd-video::before { - content: "\e187"; -} -.glyphicon-subtitles::before { - content: "\e188"; -} -.glyphicon-sound-stereo::before { - content: "\e189"; -} -.glyphicon-sound-dolby::before { - content: "\e190"; -} -.glyphicon-sound-5-1::before { - content: "\e191"; -} -.glyphicon-sound-6-1::before { - content: "\e192"; -} -.glyphicon-sound-7-1::before { - content: "\e193"; -} -.glyphicon-copyright-mark::before { - content: "\e194"; -} -.glyphicon-registration-mark::before { - content: "\e195"; -} -.glyphicon-cloud-download::before { - content: "\e197"; -} -.glyphicon-cloud-upload::before { - content: "\e198"; -} -.glyphicon-tree-conifer::before { - content: "\e199"; -} -.glyphicon-tree-deciduous::before { - content: "\e200"; -} -.glyphicon-cd::before { - content: "\e201"; -} -.glyphicon-save-file::before { - content: "\e202"; -} -.glyphicon-open-file::before { - content: "\e203"; -} -.glyphicon-level-up::before { - content: "\e204"; -} -.glyphicon-copy::before { - content: "\e205"; -} -.glyphicon-paste::before { - content: "\e206"; -} -.glyphicon-alert::before { - content: "\e209"; -} -.glyphicon-equalizer::before { - content: "\e210"; -} -.glyphicon-king::before { - content: "\e211"; -} -.glyphicon-queen::before { - content: "\e212"; -} -.glyphicon-pawn::before { - content: "\e213"; -} -.glyphicon-bishop::before { - content: "\e214"; -} -.glyphicon-knight::before { - content: "\e215"; -} -.glyphicon-baby-formula::before { - content: "\e216"; -} -.glyphicon-tent::before { - content: "\26fa"; -} -.glyphicon-blackboard::before { - content: "\e218"; -} -.glyphicon-bed::before { - content: "\e219"; -} -.glyphicon-apple::before { - content: "\f8ff"; -} -.glyphicon-erase::before { - content: "\e221"; -} -.glyphicon-hourglass::before { - content: "\231b"; -} -.glyphicon-lamp::before { - content: "\e223"; -} -.glyphicon-duplicate::before { - content: "\e224"; -} -.glyphicon-piggy-bank::before { - content: "\e225"; -} -.glyphicon-scissors::before { - content: "\e226"; -} -.glyphicon-bitcoin::before { - content: "\e227"; -} -.glyphicon-btc::before { - content: "\e227"; -} -.glyphicon-xbt::before { - content: "\e227"; -} -.glyphicon-yen::before { - content: "\00a5"; -} -.glyphicon-jpy::before { - content: "\00a5"; -} -.glyphicon-ruble::before { - content: "\20bd"; -} -.glyphicon-rub::before { - content: "\20bd"; -} -.glyphicon-scale::before { - content: "\e230"; -} -.glyphicon-ice-lolly::before { - content: "\e231"; -} -.glyphicon-ice-lolly-tasted::before { - content: "\e232"; -} -.glyphicon-education::before { - content: "\e233"; -} -.glyphicon-option-horizontal::before { - content: "\e234"; -} -.glyphicon-option-vertical::before { - content: "\e235"; -} -.glyphicon-menu-hamburger::before { - content: "\e236"; -} -.glyphicon-modal-window::before { - content: "\e237"; -} -.glyphicon-oil::before { - content: "\e238"; -} -.glyphicon-grain::before { - content: "\e239"; -} -.glyphicon-sunglasses::before { - content: "\e240"; -} -.glyphicon-text-size::before { - content: "\e241"; -} -.glyphicon-text-color::before { - content: "\e242"; -} -.glyphicon-text-background::before { - content: "\e243"; -} -.glyphicon-object-align-top::before { - content: "\e244"; -} -.glyphicon-object-align-bottom::before { - content: "\e245"; -} -.glyphicon-object-align-horizontal::before { - content: "\e246"; -} -.glyphicon-object-align-left::before { - content: "\e247"; -} -.glyphicon-object-align-vertical::before { - content: "\e248"; -} -.glyphicon-object-align-right::before { - content: "\e249"; -} -.glyphicon-triangle-right::before { - content: "\e250"; -} -.glyphicon-triangle-left::before { - content: "\e251"; -} -.glyphicon-triangle-bottom::before { - content: "\e252"; -} -.glyphicon-triangle-top::before { - content: "\e253"; -} -.glyphicon-console::before { - content: "\e254"; -} -.glyphicon-superscript::before { - content: "\e255"; -} -.glyphicon-subscript::before { - content: "\e256"; -} -.glyphicon-menu-left::before { - content: "\e257"; -} -.glyphicon-menu-right::before { - content: "\e258"; -} -.glyphicon-menu-down::before { - content: "\e259"; -} -.glyphicon-menu-up::before { - content: "\e260"; -} -* { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -*::before, -*::after { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -html { - font-size: 10px; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} -body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; - font-size: 14px; - line-height: 1.42857143; - color: #333333; - background-color: #fff; -} -input, -button, -select, -textarea { - font-family: inherit; - font-size: inherit; - line-height: inherit; -} -a { - color: #337ab7; - text-decoration: none; -} -a:hover, -a:focus { - color: #23527c; - text-decoration: underline; -} -a:focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -figure { - margin: 0; -} -img { - vertical-align: middle; -} -.img-responsive, -.thumbnail > img, -.thumbnail a > img, -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - display: block; - max-width: 100%; - height: auto; -} -.img-rounded { - border-radius: 6px; -} -.img-thumbnail { - padding: 4px; - line-height: 1.42857143; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 4px; - -webkit-transition: all 0.2s ease-in-out; - -o-transition: all 0.2s ease-in-out; - transition: all 0.2s ease-in-out; - display: inline-block; - max-width: 100%; - height: auto; -} -.img-circle { - border-radius: 50%; -} -hr { - margin-top: 20px; - margin-bottom: 20px; - border: 0; - border-top: 1px solid #eeeeee; -} -.sr-only { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0; -} -.sr-only-focusable:active, -.sr-only-focusable:focus { - position: static; - width: auto; - height: auto; - margin: 0; - overflow: visible; - clip: auto; -} -[role="button"] { - cursor: pointer; -} -/* stylelint-disable selector-list-comma-newline-after, selector-no-qualifying-type */ -h1, -h2, -h3, -h4, -h5, -h6, -.h1, -.h2, -.h3, -.h4, -.h5, -.h6 { - font-family: inherit; - font-weight: 500; - line-height: 1.1; - color: inherit; -} -h1 small, -h2 small, -h3 small, -h4 small, -h5 small, -h6 small, -.h1 small, -.h2 small, -.h3 small, -.h4 small, -.h5 small, -.h6 small, -h1 .small, -h2 .small, -h3 .small, -h4 .small, -h5 .small, -h6 .small, -.h1 .small, -.h2 .small, -.h3 .small, -.h4 .small, -.h5 .small, -.h6 .small { - font-weight: 400; - line-height: 1; - color: #777777; -} -h1, -.h1, -h2, -.h2, -h3, -.h3 { - margin-top: 20px; - margin-bottom: 10px; -} -h1 small, -.h1 small, -h2 small, -.h2 small, -h3 small, -.h3 small, -h1 .small, -.h1 .small, -h2 .small, -.h2 .small, -h3 .small, -.h3 .small { - font-size: 65%; -} -h4, -.h4, -h5, -.h5, -h6, -.h6 { - margin-top: 10px; - margin-bottom: 10px; -} -h4 small, -.h4 small, -h5 small, -.h5 small, -h6 small, -.h6 small, -h4 .small, -.h4 .small, -h5 .small, -.h5 .small, -h6 .small, -.h6 .small { - font-size: 75%; -} -h1, -.h1 { - font-size: 36px; -} -h2, -.h2 { - font-size: 30px; -} -h3, -.h3 { - font-size: 24px; -} -h4, -.h4 { - font-size: 18px; -} -h5, -.h5 { - font-size: 14px; -} -h6, -.h6 { - font-size: 12px; -} -p { - margin: 0 0 10px; -} -.lead { - margin-bottom: 20px; - font-size: 16px; - font-weight: 300; - line-height: 1.4; -} -@media (min-width: 768px) { - .lead { - font-size: 21px; - } -} -small, -.small { - font-size: 85%; -} -mark, -.mark { - padding: .2em; - background-color: #fcf8e3; -} -.text-left { - text-align: left; -} -.text-right { - text-align: right; -} -.text-center { - text-align: center; -} -.text-justify { - text-align: justify; -} -.text-nowrap { - white-space: nowrap; -} -.text-lowercase { - text-transform: lowercase; -} -.text-uppercase { - text-transform: uppercase; -} -.text-capitalize { - text-transform: capitalize; -} -.text-muted { - color: #777777; -} -.text-primary { - color: #337ab7; -} -a.text-primary:hover, -a.text-primary:focus { - color: #286090; -} -.text-success { - color: #3c763d; -} -a.text-success:hover, -a.text-success:focus { - color: #2b542c; -} -.text-info { - color: #31708f; -} -a.text-info:hover, -a.text-info:focus { - color: #245269; -} -.text-warning { - color: #8a6d3b; -} -a.text-warning:hover, -a.text-warning:focus { - color: #66512c; -} -.text-danger { - color: #a94442; -} -a.text-danger:hover, -a.text-danger:focus { - color: #843534; -} -.bg-primary { - color: #fff; - background-color: #337ab7; -} -a.bg-primary:hover, -a.bg-primary:focus { - background-color: #286090; -} -.bg-success { - background-color: #dff0d8; -} -a.bg-success:hover, -a.bg-success:focus { - background-color: #c1e2b3; -} -.bg-info { - background-color: #d9edf7; -} -a.bg-info:hover, -a.bg-info:focus { - background-color: #afd9ee; -} -.bg-warning { - background-color: #fcf8e3; -} -a.bg-warning:hover, -a.bg-warning:focus { - background-color: #f7ecb5; -} -.bg-danger { - background-color: #f2dede; -} -a.bg-danger:hover, -a.bg-danger:focus { - background-color: #e4b9b9; -} -.page-header { - padding-bottom: 9px; - margin: 40px 0 20px; - border-bottom: 1px solid #eeeeee; -} -ul, -ol { - margin-top: 0; - margin-bottom: 10px; -} -ul ul, -ol ul, -ul ol, -ol ol { - margin-bottom: 0; -} -.list-unstyled { - padding-left: 0; - list-style: none; -} -.list-inline { - padding-left: 0; - list-style: none; - margin-left: -5px; -} -.list-inline > li { - display: inline-block; - padding-right: 5px; - padding-left: 5px; -} -dl { - margin-top: 0; - margin-bottom: 20px; -} -dt, -dd { - line-height: 1.42857143; -} -dt { - font-weight: 700; -} -dd { - margin-left: 0; -} -@media (min-width: 768px) { - .dl-horizontal dt { - float: left; - width: 160px; - clear: left; - text-align: right; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .dl-horizontal dd { - margin-left: 180px; - } -} -.initialism { - font-size: 90%; - text-transform: uppercase; -} -blockquote { - padding: 10px 20px; - margin: 0 0 20px; - font-size: 17.5px; - border-left: 5px solid #eeeeee; -} -blockquote p:last-child, -blockquote ul:last-child, -blockquote ol:last-child { - margin-bottom: 0; -} -blockquote footer, -blockquote small, -blockquote .small { - display: block; - font-size: 80%; - line-height: 1.42857143; - color: #777777; -} -blockquote footer::before, -blockquote small::before, -blockquote .small::before { - content: "\2014 \00A0"; -} -.blockquote-reverse, -blockquote.pull-right { - padding-right: 15px; - padding-left: 0; - text-align: right; - border-right: 5px solid #eeeeee; - border-left: 0; -} -.blockquote-reverse footer::before, -blockquote.pull-right footer::before, -.blockquote-reverse small::before, -blockquote.pull-right small::before, -.blockquote-reverse .small::before, -blockquote.pull-right .small::before { - content: ""; -} -.blockquote-reverse footer::after, -blockquote.pull-right footer::after, -.blockquote-reverse small::after, -blockquote.pull-right small::after, -.blockquote-reverse .small::after, -blockquote.pull-right .small::after { - content: "\00A0 \2014"; -} -address { - margin-bottom: 20px; - font-style: normal; - line-height: 1.42857143; -} -code, -kbd, -pre, -samp { - font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Courier New", monospace; -} -code { - padding: 2px 4px; - font-size: 90%; - color: #c7254e; - background-color: #f9f2f4; - border-radius: 4px; -} -kbd { - padding: 2px 4px; - font-size: 90%; - color: #fff; - background-color: #333; - border-radius: 3px; - -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); -} -kbd kbd { - padding: 0; - font-size: 100%; - font-weight: 700; - -webkit-box-shadow: none; - box-shadow: none; -} -pre { - display: block; - padding: 9.5px; - margin: 0 0 10px; - font-size: 13px; - line-height: 1.42857143; - color: #333333; - word-break: break-all; - word-wrap: break-word; - background-color: #f5f5f5; - border: 1px solid #ccc; - border-radius: 4px; -} -pre code { - padding: 0; - font-size: inherit; - color: inherit; - white-space: pre-wrap; - background-color: transparent; - border-radius: 0; -} -.pre-scrollable { - max-height: 340px; - overflow-y: scroll; -} -.container { - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; -} -@media (min-width: 768px) { - .container { - width: 750px; - } -} -@media (min-width: 992px) { - .container { - width: 970px; - } -} -@media (min-width: 1200px) { - .container { - width: 1170px; - } -} -.container-fluid { - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; -} -.row { - margin-right: -15px; - margin-left: -15px; -} -.row-no-gutters { - margin-right: 0; - margin-left: 0; -} -.row-no-gutters [class*="col-"] { - padding-right: 0; - padding-left: 0; -} -.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { - position: relative; - min-height: 1px; - padding-right: 15px; - padding-left: 15px; -} -.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { - float: left; -} -.col-xs-12 { - width: 100%; -} -.col-xs-11 { - width: 91.66666667%; -} -.col-xs-10 { - width: 83.33333333%; -} -.col-xs-9 { - width: 75%; -} -.col-xs-8 { - width: 66.66666667%; -} -.col-xs-7 { - width: 58.33333333%; -} -.col-xs-6 { - width: 50%; -} -.col-xs-5 { - width: 41.66666667%; -} -.col-xs-4 { - width: 33.33333333%; -} -.col-xs-3 { - width: 25%; -} -.col-xs-2 { - width: 16.66666667%; -} -.col-xs-1 { - width: 8.33333333%; -} -.col-xs-pull-12 { - right: 100%; -} -.col-xs-pull-11 { - right: 91.66666667%; -} -.col-xs-pull-10 { - right: 83.33333333%; -} -.col-xs-pull-9 { - right: 75%; -} -.col-xs-pull-8 { - right: 66.66666667%; -} -.col-xs-pull-7 { - right: 58.33333333%; -} -.col-xs-pull-6 { - right: 50%; -} -.col-xs-pull-5 { - right: 41.66666667%; -} -.col-xs-pull-4 { - right: 33.33333333%; -} -.col-xs-pull-3 { - right: 25%; -} -.col-xs-pull-2 { - right: 16.66666667%; -} -.col-xs-pull-1 { - right: 8.33333333%; -} -.col-xs-pull-0 { - right: auto; -} -.col-xs-push-12 { - left: 100%; -} -.col-xs-push-11 { - left: 91.66666667%; -} -.col-xs-push-10 { - left: 83.33333333%; -} -.col-xs-push-9 { - left: 75%; -} -.col-xs-push-8 { - left: 66.66666667%; -} -.col-xs-push-7 { - left: 58.33333333%; -} -.col-xs-push-6 { - left: 50%; -} -.col-xs-push-5 { - left: 41.66666667%; -} -.col-xs-push-4 { - left: 33.33333333%; -} -.col-xs-push-3 { - left: 25%; -} -.col-xs-push-2 { - left: 16.66666667%; -} -.col-xs-push-1 { - left: 8.33333333%; -} -.col-xs-push-0 { - left: auto; -} -.col-xs-offset-12 { - margin-left: 100%; -} -.col-xs-offset-11 { - margin-left: 91.66666667%; -} -.col-xs-offset-10 { - margin-left: 83.33333333%; -} -.col-xs-offset-9 { - margin-left: 75%; -} -.col-xs-offset-8 { - margin-left: 66.66666667%; -} -.col-xs-offset-7 { - margin-left: 58.33333333%; -} -.col-xs-offset-6 { - margin-left: 50%; -} -.col-xs-offset-5 { - margin-left: 41.66666667%; -} -.col-xs-offset-4 { - margin-left: 33.33333333%; -} -.col-xs-offset-3 { - margin-left: 25%; -} -.col-xs-offset-2 { - margin-left: 16.66666667%; -} -.col-xs-offset-1 { - margin-left: 8.33333333%; -} -.col-xs-offset-0 { - margin-left: 0%; -} -@media (min-width: 768px) { - .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { - float: left; - } - .col-sm-12 { - width: 100%; - } - .col-sm-11 { - width: 91.66666667%; - } - .col-sm-10 { - width: 83.33333333%; - } - .col-sm-9 { - width: 75%; - } - .col-sm-8 { - width: 66.66666667%; - } - .col-sm-7 { - width: 58.33333333%; - } - .col-sm-6 { - width: 50%; - } - .col-sm-5 { - width: 41.66666667%; - } - .col-sm-4 { - width: 33.33333333%; - } - .col-sm-3 { - width: 25%; - } - .col-sm-2 { - width: 16.66666667%; - } - .col-sm-1 { - width: 8.33333333%; - } - .col-sm-pull-12 { - right: 100%; - } - .col-sm-pull-11 { - right: 91.66666667%; - } - .col-sm-pull-10 { - right: 83.33333333%; - } - .col-sm-pull-9 { - right: 75%; - } - .col-sm-pull-8 { - right: 66.66666667%; - } - .col-sm-pull-7 { - right: 58.33333333%; - } - .col-sm-pull-6 { - right: 50%; - } - .col-sm-pull-5 { - right: 41.66666667%; - } - .col-sm-pull-4 { - right: 33.33333333%; - } - .col-sm-pull-3 { - right: 25%; - } - .col-sm-pull-2 { - right: 16.66666667%; - } - .col-sm-pull-1 { - right: 8.33333333%; - } - .col-sm-pull-0 { - right: auto; - } - .col-sm-push-12 { - left: 100%; - } - .col-sm-push-11 { - left: 91.66666667%; - } - .col-sm-push-10 { - left: 83.33333333%; - } - .col-sm-push-9 { - left: 75%; - } - .col-sm-push-8 { - left: 66.66666667%; - } - .col-sm-push-7 { - left: 58.33333333%; - } - .col-sm-push-6 { - left: 50%; - } - .col-sm-push-5 { - left: 41.66666667%; - } - .col-sm-push-4 { - left: 33.33333333%; - } - .col-sm-push-3 { - left: 25%; - } - .col-sm-push-2 { - left: 16.66666667%; - } - .col-sm-push-1 { - left: 8.33333333%; - } - .col-sm-push-0 { - left: auto; - } - .col-sm-offset-12 { - margin-left: 100%; - } - .col-sm-offset-11 { - margin-left: 91.66666667%; - } - .col-sm-offset-10 { - margin-left: 83.33333333%; - } - .col-sm-offset-9 { - margin-left: 75%; - } - .col-sm-offset-8 { - margin-left: 66.66666667%; - } - .col-sm-offset-7 { - margin-left: 58.33333333%; - } - .col-sm-offset-6 { - margin-left: 50%; - } - .col-sm-offset-5 { - margin-left: 41.66666667%; - } - .col-sm-offset-4 { - margin-left: 33.33333333%; - } - .col-sm-offset-3 { - margin-left: 25%; - } - .col-sm-offset-2 { - margin-left: 16.66666667%; - } - .col-sm-offset-1 { - margin-left: 8.33333333%; - } - .col-sm-offset-0 { - margin-left: 0%; - } -} -@media (min-width: 992px) { - .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { - float: left; - } - .col-md-12 { - width: 100%; - } - .col-md-11 { - width: 91.66666667%; - } - .col-md-10 { - width: 83.33333333%; - } - .col-md-9 { - width: 75%; - } - .col-md-8 { - width: 66.66666667%; - } - .col-md-7 { - width: 58.33333333%; - } - .col-md-6 { - width: 50%; - } - .col-md-5 { - width: 41.66666667%; - } - .col-md-4 { - width: 33.33333333%; - } - .col-md-3 { - width: 25%; - } - .col-md-2 { - width: 16.66666667%; - } - .col-md-1 { - width: 8.33333333%; - } - .col-md-pull-12 { - right: 100%; - } - .col-md-pull-11 { - right: 91.66666667%; - } - .col-md-pull-10 { - right: 83.33333333%; - } - .col-md-pull-9 { - right: 75%; - } - .col-md-pull-8 { - right: 66.66666667%; - } - .col-md-pull-7 { - right: 58.33333333%; - } - .col-md-pull-6 { - right: 50%; - } - .col-md-pull-5 { - right: 41.66666667%; - } - .col-md-pull-4 { - right: 33.33333333%; - } - .col-md-pull-3 { - right: 25%; - } - .col-md-pull-2 { - right: 16.66666667%; - } - .col-md-pull-1 { - right: 8.33333333%; - } - .col-md-pull-0 { - right: auto; - } - .col-md-push-12 { - left: 100%; - } - .col-md-push-11 { - left: 91.66666667%; - } - .col-md-push-10 { - left: 83.33333333%; - } - .col-md-push-9 { - left: 75%; - } - .col-md-push-8 { - left: 66.66666667%; - } - .col-md-push-7 { - left: 58.33333333%; - } - .col-md-push-6 { - left: 50%; - } - .col-md-push-5 { - left: 41.66666667%; - } - .col-md-push-4 { - left: 33.33333333%; - } - .col-md-push-3 { - left: 25%; - } - .col-md-push-2 { - left: 16.66666667%; - } - .col-md-push-1 { - left: 8.33333333%; - } - .col-md-push-0 { - left: auto; - } - .col-md-offset-12 { - margin-left: 100%; - } - .col-md-offset-11 { - margin-left: 91.66666667%; - } - .col-md-offset-10 { - margin-left: 83.33333333%; - } - .col-md-offset-9 { - margin-left: 75%; - } - .col-md-offset-8 { - margin-left: 66.66666667%; - } - .col-md-offset-7 { - margin-left: 58.33333333%; - } - .col-md-offset-6 { - margin-left: 50%; - } - .col-md-offset-5 { - margin-left: 41.66666667%; - } - .col-md-offset-4 { - margin-left: 33.33333333%; - } - .col-md-offset-3 { - margin-left: 25%; - } - .col-md-offset-2 { - margin-left: 16.66666667%; - } - .col-md-offset-1 { - margin-left: 8.33333333%; - } - .col-md-offset-0 { - margin-left: 0%; - } -} -@media (min-width: 1200px) { - .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { - float: left; - } - .col-lg-12 { - width: 100%; - } - .col-lg-11 { - width: 91.66666667%; - } - .col-lg-10 { - width: 83.33333333%; - } - .col-lg-9 { - width: 75%; - } - .col-lg-8 { - width: 66.66666667%; - } - .col-lg-7 { - width: 58.33333333%; - } - .col-lg-6 { - width: 50%; - } - .col-lg-5 { - width: 41.66666667%; - } - .col-lg-4 { - width: 33.33333333%; - } - .col-lg-3 { - width: 25%; - } - .col-lg-2 { - width: 16.66666667%; - } - .col-lg-1 { - width: 8.33333333%; - } - .col-lg-pull-12 { - right: 100%; - } - .col-lg-pull-11 { - right: 91.66666667%; - } - .col-lg-pull-10 { - right: 83.33333333%; - } - .col-lg-pull-9 { - right: 75%; - } - .col-lg-pull-8 { - right: 66.66666667%; - } - .col-lg-pull-7 { - right: 58.33333333%; - } - .col-lg-pull-6 { - right: 50%; - } - .col-lg-pull-5 { - right: 41.66666667%; - } - .col-lg-pull-4 { - right: 33.33333333%; - } - .col-lg-pull-3 { - right: 25%; - } - .col-lg-pull-2 { - right: 16.66666667%; - } - .col-lg-pull-1 { - right: 8.33333333%; - } - .col-lg-pull-0 { - right: auto; - } - .col-lg-push-12 { - left: 100%; - } - .col-lg-push-11 { - left: 91.66666667%; - } - .col-lg-push-10 { - left: 83.33333333%; - } - .col-lg-push-9 { - left: 75%; - } - .col-lg-push-8 { - left: 66.66666667%; - } - .col-lg-push-7 { - left: 58.33333333%; - } - .col-lg-push-6 { - left: 50%; - } - .col-lg-push-5 { - left: 41.66666667%; - } - .col-lg-push-4 { - left: 33.33333333%; - } - .col-lg-push-3 { - left: 25%; - } - .col-lg-push-2 { - left: 16.66666667%; - } - .col-lg-push-1 { - left: 8.33333333%; - } - .col-lg-push-0 { - left: auto; - } - .col-lg-offset-12 { - margin-left: 100%; - } - .col-lg-offset-11 { - margin-left: 91.66666667%; - } - .col-lg-offset-10 { - margin-left: 83.33333333%; - } - .col-lg-offset-9 { - margin-left: 75%; - } - .col-lg-offset-8 { - margin-left: 66.66666667%; - } - .col-lg-offset-7 { - margin-left: 58.33333333%; - } - .col-lg-offset-6 { - margin-left: 50%; - } - .col-lg-offset-5 { - margin-left: 41.66666667%; - } - .col-lg-offset-4 { - margin-left: 33.33333333%; - } - .col-lg-offset-3 { - margin-left: 25%; - } - .col-lg-offset-2 { - margin-left: 16.66666667%; - } - .col-lg-offset-1 { - margin-left: 8.33333333%; - } - .col-lg-offset-0 { - margin-left: 0%; - } -} -/* stylelint-disable selector-max-type, selector-max-compound-selectors, selector-no-qualifying-type */ -table { - background-color: transparent; -} -table col[class*="col-"] { - position: static; - display: table-column; - float: none; -} -table td[class*="col-"], -table th[class*="col-"] { - position: static; - display: table-cell; - float: none; -} -caption { - padding-top: 8px; - padding-bottom: 8px; - color: #777777; - text-align: left; -} -th { - text-align: left; -} -.table { - width: 100%; - max-width: 100%; - margin-bottom: 20px; -} -.table > thead > tr > th, -.table > tbody > tr > th, -.table > tfoot > tr > th, -.table > thead > tr > td, -.table > tbody > tr > td, -.table > tfoot > tr > td { - padding: 8px; - line-height: 1.42857143; - vertical-align: top; - border-top: 1px solid #ddd; -} -.table > thead > tr > th { - vertical-align: bottom; - border-bottom: 2px solid #ddd; -} -.table > caption + thead > tr:first-child > th, -.table > colgroup + thead > tr:first-child > th, -.table > thead:first-child > tr:first-child > th, -.table > caption + thead > tr:first-child > td, -.table > colgroup + thead > tr:first-child > td, -.table > thead:first-child > tr:first-child > td { - border-top: 0; -} -.table > tbody + tbody { - border-top: 2px solid #ddd; -} -.table .table { - background-color: #fff; -} -.table-condensed > thead > tr > th, -.table-condensed > tbody > tr > th, -.table-condensed > tfoot > tr > th, -.table-condensed > thead > tr > td, -.table-condensed > tbody > tr > td, -.table-condensed > tfoot > tr > td { - padding: 5px; -} -.table-bordered { - border: 1px solid #ddd; -} -.table-bordered > thead > tr > th, -.table-bordered > tbody > tr > th, -.table-bordered > tfoot > tr > th, -.table-bordered > thead > tr > td, -.table-bordered > tbody > tr > td, -.table-bordered > tfoot > tr > td { - border: 1px solid #ddd; -} -.table-bordered > thead > tr > th, -.table-bordered > thead > tr > td { - border-bottom-width: 2px; -} -.table-striped > tbody > tr:nth-of-type(odd) { - background-color: #f9f9f9; -} -.table-hover > tbody > tr:hover { - background-color: #f5f5f5; -} -.table > thead > tr > td.active, -.table > tbody > tr > td.active, -.table > tfoot > tr > td.active, -.table > thead > tr > th.active, -.table > tbody > tr > th.active, -.table > tfoot > tr > th.active, -.table > thead > tr.active > td, -.table > tbody > tr.active > td, -.table > tfoot > tr.active > td, -.table > thead > tr.active > th, -.table > tbody > tr.active > th, -.table > tfoot > tr.active > th { - background-color: #f5f5f5; -} -.table-hover > tbody > tr > td.active:hover, -.table-hover > tbody > tr > th.active:hover, -.table-hover > tbody > tr.active:hover > td, -.table-hover > tbody > tr:hover > .active, -.table-hover > tbody > tr.active:hover > th { - background-color: #e8e8e8; -} -.table > thead > tr > td.success, -.table > tbody > tr > td.success, -.table > tfoot > tr > td.success, -.table > thead > tr > th.success, -.table > tbody > tr > th.success, -.table > tfoot > tr > th.success, -.table > thead > tr.success > td, -.table > tbody > tr.success > td, -.table > tfoot > tr.success > td, -.table > thead > tr.success > th, -.table > tbody > tr.success > th, -.table > tfoot > tr.success > th { - background-color: #dff0d8; -} -.table-hover > tbody > tr > td.success:hover, -.table-hover > tbody > tr > th.success:hover, -.table-hover > tbody > tr.success:hover > td, -.table-hover > tbody > tr:hover > .success, -.table-hover > tbody > tr.success:hover > th { - background-color: #d0e9c6; -} -.table > thead > tr > td.info, -.table > tbody > tr > td.info, -.table > tfoot > tr > td.info, -.table > thead > tr > th.info, -.table > tbody > tr > th.info, -.table > tfoot > tr > th.info, -.table > thead > tr.info > td, -.table > tbody > tr.info > td, -.table > tfoot > tr.info > td, -.table > thead > tr.info > th, -.table > tbody > tr.info > th, -.table > tfoot > tr.info > th { - background-color: #d9edf7; -} -.table-hover > tbody > tr > td.info:hover, -.table-hover > tbody > tr > th.info:hover, -.table-hover > tbody > tr.info:hover > td, -.table-hover > tbody > tr:hover > .info, -.table-hover > tbody > tr.info:hover > th { - background-color: #c4e3f3; -} -.table > thead > tr > td.warning, -.table > tbody > tr > td.warning, -.table > tfoot > tr > td.warning, -.table > thead > tr > th.warning, -.table > tbody > tr > th.warning, -.table > tfoot > tr > th.warning, -.table > thead > tr.warning > td, -.table > tbody > tr.warning > td, -.table > tfoot > tr.warning > td, -.table > thead > tr.warning > th, -.table > tbody > tr.warning > th, -.table > tfoot > tr.warning > th { - background-color: #fcf8e3; -} -.table-hover > tbody > tr > td.warning:hover, -.table-hover > tbody > tr > th.warning:hover, -.table-hover > tbody > tr.warning:hover > td, -.table-hover > tbody > tr:hover > .warning, -.table-hover > tbody > tr.warning:hover > th { - background-color: #faf2cc; -} -.table > thead > tr > td.danger, -.table > tbody > tr > td.danger, -.table > tfoot > tr > td.danger, -.table > thead > tr > th.danger, -.table > tbody > tr > th.danger, -.table > tfoot > tr > th.danger, -.table > thead > tr.danger > td, -.table > tbody > tr.danger > td, -.table > tfoot > tr.danger > td, -.table > thead > tr.danger > th, -.table > tbody > tr.danger > th, -.table > tfoot > tr.danger > th { - background-color: #f2dede; -} -.table-hover > tbody > tr > td.danger:hover, -.table-hover > tbody > tr > th.danger:hover, -.table-hover > tbody > tr.danger:hover > td, -.table-hover > tbody > tr:hover > .danger, -.table-hover > tbody > tr.danger:hover > th { - background-color: #ebcccc; -} -.table-responsive { - min-height: .01%; - overflow-x: auto; -} -@media screen and (max-width: 767px) { - .table-responsive { - width: 100%; - margin-bottom: 15px; - overflow-y: hidden; - -ms-overflow-style: -ms-autohiding-scrollbar; - border: 1px solid #ddd; - } - .table-responsive > .table { - margin-bottom: 0; - } - .table-responsive > .table > thead > tr > th, - .table-responsive > .table > tbody > tr > th, - .table-responsive > .table > tfoot > tr > th, - .table-responsive > .table > thead > tr > td, - .table-responsive > .table > tbody > tr > td, - .table-responsive > .table > tfoot > tr > td { - white-space: nowrap; - } - .table-responsive > .table-bordered { - border: 0; - } - .table-responsive > .table-bordered > thead > tr > th:first-child, - .table-responsive > .table-bordered > tbody > tr > th:first-child, - .table-responsive > .table-bordered > tfoot > tr > th:first-child, - .table-responsive > .table-bordered > thead > tr > td:first-child, - .table-responsive > .table-bordered > tbody > tr > td:first-child, - .table-responsive > .table-bordered > tfoot > tr > td:first-child { - border-left: 0; - } - .table-responsive > .table-bordered > thead > tr > th:last-child, - .table-responsive > .table-bordered > tbody > tr > th:last-child, - .table-responsive > .table-bordered > tfoot > tr > th:last-child, - .table-responsive > .table-bordered > thead > tr > td:last-child, - .table-responsive > .table-bordered > tbody > tr > td:last-child, - .table-responsive > .table-bordered > tfoot > tr > td:last-child { - border-right: 0; - } - .table-responsive > .table-bordered > tbody > tr:last-child > th, - .table-responsive > .table-bordered > tfoot > tr:last-child > th, - .table-responsive > .table-bordered > tbody > tr:last-child > td, - .table-responsive > .table-bordered > tfoot > tr:last-child > td { - border-bottom: 0; - } -} -/* stylelint-disable selector-no-qualifying-type, property-no-vendor-prefix, media-feature-name-no-vendor-prefix, indentation */ -fieldset { - min-width: 0; - padding: 0; - margin: 0; - border: 0; -} -legend { - display: block; - width: 100%; - padding: 0; - margin-bottom: 20px; - font-size: 21px; - line-height: inherit; - color: #333333; - border: 0; - border-bottom: 1px solid #e5e5e5; -} -label { - display: inline-block; - max-width: 100%; - margin-bottom: 5px; - font-weight: 700; -} -input[type="search"] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - -webkit-appearance: none; -} -input[type="radio"], -input[type="checkbox"] { - margin: 4px 0 0; - margin-top: 1px \9; - line-height: normal; -} -input[type="radio"][disabled], -input[type="checkbox"][disabled], -input[type="radio"].disabled, -input[type="checkbox"].disabled, -fieldset[disabled] input[type="radio"], -fieldset[disabled] input[type="checkbox"] { - cursor: not-allowed; -} -input[type="file"] { - display: block; -} -input[type="range"] { - display: block; - width: 100%; -} -select[multiple], -select[size] { - height: auto; -} -input[type="file"]:focus, -input[type="radio"]:focus, -input[type="checkbox"]:focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -output { - display: block; - padding-top: 7px; - font-size: 14px; - line-height: 1.42857143; - color: #555555; -} -.form-control { - display: block; - width: 100%; - height: 34px; - padding: 6px 12px; - font-size: 14px; - line-height: 1.42857143; - color: #555555; - background-color: #fff; - background-image: none; - border: 1px solid #ccc; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; -} -.form-control:focus { - border-color: #66afe9; - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6); -} -.form-control::-moz-placeholder { - color: #999; - opacity: 1; -} -.form-control:-ms-input-placeholder { - color: #999; -} -.form-control::-webkit-input-placeholder { - color: #999; -} -.form-control::-ms-expand { - background-color: transparent; - border: 0; -} -.form-control[disabled], -.form-control[readonly], -fieldset[disabled] .form-control { - background-color: #eeeeee; - opacity: 1; -} -.form-control[disabled], -fieldset[disabled] .form-control { - cursor: not-allowed; -} -textarea.form-control { - height: auto; -} -@media screen and (-webkit-min-device-pixel-ratio: 0) { - input[type="date"].form-control, - input[type="time"].form-control, - input[type="datetime-local"].form-control, - input[type="month"].form-control { - line-height: 34px; - } - input[type="date"].input-sm, - input[type="time"].input-sm, - input[type="datetime-local"].input-sm, - input[type="month"].input-sm, - .input-group-sm input[type="date"], - .input-group-sm input[type="time"], - .input-group-sm input[type="datetime-local"], - .input-group-sm input[type="month"] { - line-height: 30px; - } - input[type="date"].input-lg, - input[type="time"].input-lg, - input[type="datetime-local"].input-lg, - input[type="month"].input-lg, - .input-group-lg input[type="date"], - .input-group-lg input[type="time"], - .input-group-lg input[type="datetime-local"], - .input-group-lg input[type="month"] { - line-height: 46px; - } -} -.form-group { - margin-bottom: 15px; -} -.radio, -.checkbox { - position: relative; - display: block; - margin-top: 10px; - margin-bottom: 10px; -} -.radio.disabled label, -.checkbox.disabled label, -fieldset[disabled] .radio label, -fieldset[disabled] .checkbox label { - cursor: not-allowed; -} -.radio label, -.checkbox label { - min-height: 20px; - padding-left: 20px; - margin-bottom: 0; - font-weight: 400; - cursor: pointer; -} -.radio input[type="radio"], -.radio-inline input[type="radio"], -.checkbox input[type="checkbox"], -.checkbox-inline input[type="checkbox"] { - position: absolute; - margin-top: 4px \9; - margin-left: -20px; -} -.radio + .radio, -.checkbox + .checkbox { - margin-top: -5px; -} -.radio-inline, -.checkbox-inline { - position: relative; - display: inline-block; - padding-left: 20px; - margin-bottom: 0; - font-weight: 400; - vertical-align: middle; - cursor: pointer; -} -.radio-inline.disabled, -.checkbox-inline.disabled, -fieldset[disabled] .radio-inline, -fieldset[disabled] .checkbox-inline { - cursor: not-allowed; -} -.radio-inline + .radio-inline, -.checkbox-inline + .checkbox-inline { - margin-top: 0; - margin-left: 10px; -} -.form-control-static { - min-height: 34px; - padding-top: 7px; - padding-bottom: 7px; - margin-bottom: 0; -} -.form-control-static.input-lg, -.form-control-static.input-sm { - padding-right: 0; - padding-left: 0; -} -.input-sm { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -select.input-sm { - height: 30px; - line-height: 30px; -} -textarea.input-sm, -select[multiple].input-sm { - height: auto; -} -.form-group-sm .form-control { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.form-group-sm select.form-control { - height: 30px; - line-height: 30px; -} -.form-group-sm textarea.form-control, -.form-group-sm select[multiple].form-control { - height: auto; -} -.form-group-sm .form-control-static { - height: 30px; - min-height: 32px; - padding: 6px 10px; - font-size: 12px; - line-height: 1.5; -} -.input-lg { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -select.input-lg { - height: 46px; - line-height: 46px; -} -textarea.input-lg, -select[multiple].input-lg { - height: auto; -} -.form-group-lg .form-control { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -.form-group-lg select.form-control { - height: 46px; - line-height: 46px; -} -.form-group-lg textarea.form-control, -.form-group-lg select[multiple].form-control { - height: auto; -} -.form-group-lg .form-control-static { - height: 46px; - min-height: 38px; - padding: 11px 16px; - font-size: 18px; - line-height: 1.3333333; -} -.has-feedback { - position: relative; -} -.has-feedback .form-control { - padding-right: 42.5px; -} -.form-control-feedback { - position: absolute; - top: 0; - right: 0; - z-index: 2; - display: block; - width: 34px; - height: 34px; - line-height: 34px; - text-align: center; - pointer-events: none; -} -.input-lg + .form-control-feedback, -.input-group-lg + .form-control-feedback, -.form-group-lg .form-control + .form-control-feedback { - width: 46px; - height: 46px; - line-height: 46px; -} -.input-sm + .form-control-feedback, -.input-group-sm + .form-control-feedback, -.form-group-sm .form-control + .form-control-feedback { - width: 30px; - height: 30px; - line-height: 30px; -} -.has-success .help-block, -.has-success .control-label, -.has-success .radio, -.has-success .checkbox, -.has-success .radio-inline, -.has-success .checkbox-inline, -.has-success.radio label, -.has-success.checkbox label, -.has-success.radio-inline label, -.has-success.checkbox-inline label { - color: #3c763d; -} -.has-success .form-control { - border-color: #3c763d; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.has-success .form-control:focus { - border-color: #2b542c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; -} -.has-success .input-group-addon { - color: #3c763d; - background-color: #dff0d8; - border-color: #3c763d; -} -.has-success .form-control-feedback { - color: #3c763d; -} -.has-warning .help-block, -.has-warning .control-label, -.has-warning .radio, -.has-warning .checkbox, -.has-warning .radio-inline, -.has-warning .checkbox-inline, -.has-warning.radio label, -.has-warning.checkbox label, -.has-warning.radio-inline label, -.has-warning.checkbox-inline label { - color: #8a6d3b; -} -.has-warning .form-control { - border-color: #8a6d3b; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.has-warning .form-control:focus { - border-color: #66512c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; -} -.has-warning .input-group-addon { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #8a6d3b; -} -.has-warning .form-control-feedback { - color: #8a6d3b; -} -.has-error .help-block, -.has-error .control-label, -.has-error .radio, -.has-error .checkbox, -.has-error .radio-inline, -.has-error .checkbox-inline, -.has-error.radio label, -.has-error.checkbox label, -.has-error.radio-inline label, -.has-error.checkbox-inline label { - color: #a94442; -} -.has-error .form-control { - border-color: #a94442; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.has-error .form-control:focus { - border-color: #843534; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; -} -.has-error .input-group-addon { - color: #a94442; - background-color: #f2dede; - border-color: #a94442; -} -.has-error .form-control-feedback { - color: #a94442; -} -.has-feedback label ~ .form-control-feedback { - top: 25px; -} -.has-feedback label.sr-only ~ .form-control-feedback { - top: 0; -} -.help-block { - display: block; - margin-top: 5px; - margin-bottom: 10px; - color: #737373; -} -@media (min-width: 768px) { - .form-inline .form-group { - display: inline-block; - margin-bottom: 0; - vertical-align: middle; - } - .form-inline .form-control { - display: inline-block; - width: auto; - vertical-align: middle; - } - .form-inline .form-control-static { - display: inline-block; - } - .form-inline .input-group { - display: inline-table; - vertical-align: middle; - } - .form-inline .input-group .input-group-addon, - .form-inline .input-group .input-group-btn, - .form-inline .input-group .form-control { - width: auto; - } - .form-inline .input-group > .form-control { - width: 100%; - } - .form-inline .control-label { - margin-bottom: 0; - vertical-align: middle; - } - .form-inline .radio, - .form-inline .checkbox { - display: inline-block; - margin-top: 0; - margin-bottom: 0; - vertical-align: middle; - } - .form-inline .radio label, - .form-inline .checkbox label { - padding-left: 0; - } - .form-inline .radio input[type="radio"], - .form-inline .checkbox input[type="checkbox"] { - position: relative; - margin-left: 0; - } - .form-inline .has-feedback .form-control-feedback { - top: 0; - } -} -.form-horizontal .radio, -.form-horizontal .checkbox, -.form-horizontal .radio-inline, -.form-horizontal .checkbox-inline { - padding-top: 7px; - margin-top: 0; - margin-bottom: 0; -} -.form-horizontal .radio, -.form-horizontal .checkbox { - min-height: 27px; -} -.form-horizontal .form-group { - margin-right: -15px; - margin-left: -15px; -} -@media (min-width: 768px) { - .form-horizontal .control-label { - padding-top: 7px; - margin-bottom: 0; - text-align: right; - } -} -.form-horizontal .has-feedback .form-control-feedback { - right: 15px; -} -@media (min-width: 768px) { - .form-horizontal .form-group-lg .control-label { - padding-top: 11px; - font-size: 18px; - } -} -@media (min-width: 768px) { - .form-horizontal .form-group-sm .control-label { - padding-top: 6px; - font-size: 12px; - } -} -/* stylelint-disable selector-no-qualifying-type */ -.btn { - display: inline-block; - margin-bottom: 0; - font-weight: normal; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -ms-touch-action: manipulation; - touch-action: manipulation; - cursor: pointer; - background-image: none; - border: 1px solid transparent; - padding: 6px 12px; - font-size: 14px; - line-height: 1.42857143; - border-radius: 4px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.btn:focus, -.btn:active:focus, -.btn.active:focus, -.btn.focus, -.btn:active.focus, -.btn.active.focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -.btn:hover, -.btn:focus, -.btn.focus { - color: #333; - text-decoration: none; -} -.btn:active, -.btn.active { - background-image: none; - outline: 0; - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); -} -.btn.disabled, -.btn[disabled], -fieldset[disabled] .btn { - cursor: not-allowed; - filter: alpha(opacity=65); - opacity: 0.65; - -webkit-box-shadow: none; - box-shadow: none; -} -a.btn.disabled, -fieldset[disabled] a.btn { - pointer-events: none; -} -.btn-default { - color: #333; - background-color: #fff; - border-color: #ccc; -} -.btn-default:focus, -.btn-default.focus { - color: #333; - background-color: #e6e6e6; - border-color: #8c8c8c; -} -.btn-default:hover { - color: #333; - background-color: #e6e6e6; - border-color: #adadad; -} -.btn-default:active, -.btn-default.active, -.open > .dropdown-toggle.btn-default { - color: #333; - background-color: #e6e6e6; - background-image: none; - border-color: #adadad; -} -.btn-default:active:hover, -.btn-default.active:hover, -.open > .dropdown-toggle.btn-default:hover, -.btn-default:active:focus, -.btn-default.active:focus, -.open > .dropdown-toggle.btn-default:focus, -.btn-default:active.focus, -.btn-default.active.focus, -.open > .dropdown-toggle.btn-default.focus { - color: #333; - background-color: #d4d4d4; - border-color: #8c8c8c; -} -.btn-default.disabled:hover, -.btn-default[disabled]:hover, -fieldset[disabled] .btn-default:hover, -.btn-default.disabled:focus, -.btn-default[disabled]:focus, -fieldset[disabled] .btn-default:focus, -.btn-default.disabled.focus, -.btn-default[disabled].focus, -fieldset[disabled] .btn-default.focus { - background-color: #fff; - border-color: #ccc; -} -.btn-default .badge { - color: #fff; - background-color: #333; -} -.btn-primary { - color: #fff; - background-color: #337ab7; - border-color: #2e6da4; -} -.btn-primary:focus, -.btn-primary.focus { - color: #fff; - background-color: #286090; - border-color: #122b40; -} -.btn-primary:hover { - color: #fff; - background-color: #286090; - border-color: #204d74; -} -.btn-primary:active, -.btn-primary.active, -.open > .dropdown-toggle.btn-primary { - color: #fff; - background-color: #286090; - background-image: none; - border-color: #204d74; -} -.btn-primary:active:hover, -.btn-primary.active:hover, -.open > .dropdown-toggle.btn-primary:hover, -.btn-primary:active:focus, -.btn-primary.active:focus, -.open > .dropdown-toggle.btn-primary:focus, -.btn-primary:active.focus, -.btn-primary.active.focus, -.open > .dropdown-toggle.btn-primary.focus { - color: #fff; - background-color: #204d74; - border-color: #122b40; -} -.btn-primary.disabled:hover, -.btn-primary[disabled]:hover, -fieldset[disabled] .btn-primary:hover, -.btn-primary.disabled:focus, -.btn-primary[disabled]:focus, -fieldset[disabled] .btn-primary:focus, -.btn-primary.disabled.focus, -.btn-primary[disabled].focus, -fieldset[disabled] .btn-primary.focus { - background-color: #337ab7; - border-color: #2e6da4; -} -.btn-primary .badge { - color: #337ab7; - background-color: #fff; -} -.btn-success { - color: #fff; - background-color: #5cb85c; - border-color: #4cae4c; -} -.btn-success:focus, -.btn-success.focus { - color: #fff; - background-color: #449d44; - border-color: #255625; -} -.btn-success:hover { - color: #fff; - background-color: #449d44; - border-color: #398439; -} -.btn-success:active, -.btn-success.active, -.open > .dropdown-toggle.btn-success { - color: #fff; - background-color: #449d44; - background-image: none; - border-color: #398439; -} -.btn-success:active:hover, -.btn-success.active:hover, -.open > .dropdown-toggle.btn-success:hover, -.btn-success:active:focus, -.btn-success.active:focus, -.open > .dropdown-toggle.btn-success:focus, -.btn-success:active.focus, -.btn-success.active.focus, -.open > .dropdown-toggle.btn-success.focus { - color: #fff; - background-color: #398439; - border-color: #255625; -} -.btn-success.disabled:hover, -.btn-success[disabled]:hover, -fieldset[disabled] .btn-success:hover, -.btn-success.disabled:focus, -.btn-success[disabled]:focus, -fieldset[disabled] .btn-success:focus, -.btn-success.disabled.focus, -.btn-success[disabled].focus, -fieldset[disabled] .btn-success.focus { - background-color: #5cb85c; - border-color: #4cae4c; -} -.btn-success .badge { - color: #5cb85c; - background-color: #fff; -} -.btn-info { - color: #fff; - background-color: #5bc0de; - border-color: #46b8da; -} -.btn-info:focus, -.btn-info.focus { - color: #fff; - background-color: #31b0d5; - border-color: #1b6d85; -} -.btn-info:hover { - color: #fff; - background-color: #31b0d5; - border-color: #269abc; -} -.btn-info:active, -.btn-info.active, -.open > .dropdown-toggle.btn-info { - color: #fff; - background-color: #31b0d5; - background-image: none; - border-color: #269abc; -} -.btn-info:active:hover, -.btn-info.active:hover, -.open > .dropdown-toggle.btn-info:hover, -.btn-info:active:focus, -.btn-info.active:focus, -.open > .dropdown-toggle.btn-info:focus, -.btn-info:active.focus, -.btn-info.active.focus, -.open > .dropdown-toggle.btn-info.focus { - color: #fff; - background-color: #269abc; - border-color: #1b6d85; -} -.btn-info.disabled:hover, -.btn-info[disabled]:hover, -fieldset[disabled] .btn-info:hover, -.btn-info.disabled:focus, -.btn-info[disabled]:focus, -fieldset[disabled] .btn-info:focus, -.btn-info.disabled.focus, -.btn-info[disabled].focus, -fieldset[disabled] .btn-info.focus { - background-color: #5bc0de; - border-color: #46b8da; -} -.btn-info .badge { - color: #5bc0de; - background-color: #fff; -} -.btn-warning { - color: #fff; - background-color: #f0ad4e; - border-color: #eea236; -} -.btn-warning:focus, -.btn-warning.focus { - color: #fff; - background-color: #ec971f; - border-color: #985f0d; -} -.btn-warning:hover { - color: #fff; - background-color: #ec971f; - border-color: #d58512; -} -.btn-warning:active, -.btn-warning.active, -.open > .dropdown-toggle.btn-warning { - color: #fff; - background-color: #ec971f; - background-image: none; - border-color: #d58512; -} -.btn-warning:active:hover, -.btn-warning.active:hover, -.open > .dropdown-toggle.btn-warning:hover, -.btn-warning:active:focus, -.btn-warning.active:focus, -.open > .dropdown-toggle.btn-warning:focus, -.btn-warning:active.focus, -.btn-warning.active.focus, -.open > .dropdown-toggle.btn-warning.focus { - color: #fff; - background-color: #d58512; - border-color: #985f0d; -} -.btn-warning.disabled:hover, -.btn-warning[disabled]:hover, -fieldset[disabled] .btn-warning:hover, -.btn-warning.disabled:focus, -.btn-warning[disabled]:focus, -fieldset[disabled] .btn-warning:focus, -.btn-warning.disabled.focus, -.btn-warning[disabled].focus, -fieldset[disabled] .btn-warning.focus { - background-color: #f0ad4e; - border-color: #eea236; -} -.btn-warning .badge { - color: #f0ad4e; - background-color: #fff; -} -.btn-danger { - color: #fff; - background-color: #d9534f; - border-color: #d43f3a; -} -.btn-danger:focus, -.btn-danger.focus { - color: #fff; - background-color: #c9302c; - border-color: #761c19; -} -.btn-danger:hover { - color: #fff; - background-color: #c9302c; - border-color: #ac2925; -} -.btn-danger:active, -.btn-danger.active, -.open > .dropdown-toggle.btn-danger { - color: #fff; - background-color: #c9302c; - background-image: none; - border-color: #ac2925; -} -.btn-danger:active:hover, -.btn-danger.active:hover, -.open > .dropdown-toggle.btn-danger:hover, -.btn-danger:active:focus, -.btn-danger.active:focus, -.open > .dropdown-toggle.btn-danger:focus, -.btn-danger:active.focus, -.btn-danger.active.focus, -.open > .dropdown-toggle.btn-danger.focus { - color: #fff; - background-color: #ac2925; - border-color: #761c19; -} -.btn-danger.disabled:hover, -.btn-danger[disabled]:hover, -fieldset[disabled] .btn-danger:hover, -.btn-danger.disabled:focus, -.btn-danger[disabled]:focus, -fieldset[disabled] .btn-danger:focus, -.btn-danger.disabled.focus, -.btn-danger[disabled].focus, -fieldset[disabled] .btn-danger.focus { - background-color: #d9534f; - border-color: #d43f3a; -} -.btn-danger .badge { - color: #d9534f; - background-color: #fff; -} -.btn-link { - font-weight: 400; - color: #337ab7; - border-radius: 0; -} -.btn-link, -.btn-link:active, -.btn-link.active, -.btn-link[disabled], -fieldset[disabled] .btn-link { - background-color: transparent; - -webkit-box-shadow: none; - box-shadow: none; -} -.btn-link, -.btn-link:hover, -.btn-link:focus, -.btn-link:active { - border-color: transparent; -} -.btn-link:hover, -.btn-link:focus { - color: #23527c; - text-decoration: underline; - background-color: transparent; -} -.btn-link[disabled]:hover, -fieldset[disabled] .btn-link:hover, -.btn-link[disabled]:focus, -fieldset[disabled] .btn-link:focus { - color: #777777; - text-decoration: none; -} -.btn-lg, -.btn-group-lg > .btn { - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -.btn-sm, -.btn-group-sm > .btn { - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-xs, -.btn-group-xs > .btn { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -.btn-block { - display: block; - width: 100%; -} -.btn-block + .btn-block { - margin-top: 5px; -} -input[type="submit"].btn-block, -input[type="reset"].btn-block, -input[type="button"].btn-block { - width: 100%; -} -/* stylelint-disable selector-no-qualifying-type */ -.fade { - opacity: 0; - -webkit-transition: opacity 0.15s linear; - -o-transition: opacity 0.15s linear; - transition: opacity 0.15s linear; -} -.fade.in { - opacity: 1; -} -.collapse { - display: none; -} -.collapse.in { - display: block; -} -tr.collapse.in { - display: table-row; -} -tbody.collapse.in { - display: table-row-group; -} -.collapsing { - position: relative; - height: 0; - overflow: hidden; - -webkit-transition-property: height, visibility; - -o-transition-property: height, visibility; - transition-property: height, visibility; - -webkit-transition-duration: 0.35s; - -o-transition-duration: 0.35s; - transition-duration: 0.35s; - -webkit-transition-timing-function: ease; - -o-transition-timing-function: ease; - transition-timing-function: ease; -} -.caret { - display: inline-block; - width: 0; - height: 0; - margin-left: 2px; - vertical-align: middle; - border-top: 4px dashed; - border-top: 4px solid \9; - border-right: 4px solid transparent; - border-left: 4px solid transparent; -} -.dropup, -.dropdown { - position: relative; -} -.dropdown-toggle:focus { - outline: 0; -} -.dropdown-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - font-size: 14px; - text-align: left; - list-style: none; - background-color: #fff; - -webkit-background-clip: padding-box; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 4px; - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); -} -.dropdown-menu.pull-right { - right: 0; - left: auto; -} -.dropdown-menu .divider { - height: 1px; - margin: 9px 0; - overflow: hidden; - background-color: #e5e5e5; -} -.dropdown-menu > li > a { - display: block; - padding: 3px 20px; - clear: both; - font-weight: 400; - line-height: 1.42857143; - color: #333333; - white-space: nowrap; -} -.dropdown-menu > li > a:hover, -.dropdown-menu > li > a:focus { - color: #262626; - text-decoration: none; - background-color: #f5f5f5; -} -.dropdown-menu > .active > a, -.dropdown-menu > .active > a:hover, -.dropdown-menu > .active > a:focus { - color: #fff; - text-decoration: none; - background-color: #337ab7; - outline: 0; -} -.dropdown-menu > .disabled > a, -.dropdown-menu > .disabled > a:hover, -.dropdown-menu > .disabled > a:focus { - color: #777777; -} -.dropdown-menu > .disabled > a:hover, -.dropdown-menu > .disabled > a:focus { - text-decoration: none; - cursor: not-allowed; - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -} -.open > .dropdown-menu { - display: block; -} -.open > a { - outline: 0; -} -.dropdown-menu-right { - right: 0; - left: auto; -} -.dropdown-menu-left { - right: auto; - left: 0; -} -.dropdown-header { - display: block; - padding: 3px 20px; - font-size: 12px; - line-height: 1.42857143; - color: #777777; - white-space: nowrap; -} -.dropdown-backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 990; -} -.pull-right > .dropdown-menu { - right: 0; - left: auto; -} -.dropup .caret, -.navbar-fixed-bottom .dropdown .caret { - content: ""; - border-top: 0; - border-bottom: 4px dashed; - border-bottom: 4px solid \9; -} -.dropup .dropdown-menu, -.navbar-fixed-bottom .dropdown .dropdown-menu { - top: auto; - bottom: 100%; - margin-bottom: 2px; -} -@media (min-width: 768px) { - .navbar-right .dropdown-menu { - right: 0; - left: auto; - } - .navbar-right .dropdown-menu-left { - right: auto; - left: 0; - } -} -/* stylelint-disable selector-no-qualifying-type */ -.btn-group, -.btn-group-vertical { - position: relative; - display: inline-block; - vertical-align: middle; -} -.btn-group > .btn, -.btn-group-vertical > .btn { - position: relative; - float: left; -} -.btn-group > .btn:hover, -.btn-group-vertical > .btn:hover, -.btn-group > .btn:focus, -.btn-group-vertical > .btn:focus, -.btn-group > .btn:active, -.btn-group-vertical > .btn:active, -.btn-group > .btn.active, -.btn-group-vertical > .btn.active { - z-index: 2; -} -.btn-group .btn + .btn, -.btn-group .btn + .btn-group, -.btn-group .btn-group + .btn, -.btn-group .btn-group + .btn-group { - margin-left: -1px; -} -.btn-toolbar { - margin-left: -5px; -} -.btn-toolbar .btn, -.btn-toolbar .btn-group, -.btn-toolbar .input-group { - float: left; -} -.btn-toolbar > .btn, -.btn-toolbar > .btn-group, -.btn-toolbar > .input-group { - margin-left: 5px; -} -.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { - border-radius: 0; -} -.btn-group > .btn:first-child { - margin-left: 0; -} -.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} -.btn-group > .btn:last-child:not(:first-child), -.btn-group > .dropdown-toggle:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group > .btn-group { - float: left; -} -.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { - border-radius: 0; -} -.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, -.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} -.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group .dropdown-toggle:active, -.btn-group.open .dropdown-toggle { - outline: 0; -} -.btn-group > .btn + .dropdown-toggle { - padding-right: 8px; - padding-left: 8px; -} -.btn-group > .btn-lg + .dropdown-toggle { - padding-right: 12px; - padding-left: 12px; -} -.btn-group.open .dropdown-toggle { - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); -} -.btn-group.open .dropdown-toggle.btn-link { - -webkit-box-shadow: none; - box-shadow: none; -} -.btn .caret { - margin-left: 0; -} -.btn-lg .caret { - border-width: 5px 5px 0; - border-bottom-width: 0; -} -.dropup .btn-lg .caret { - border-width: 0 5px 5px; -} -.btn-group-vertical > .btn, -.btn-group-vertical > .btn-group, -.btn-group-vertical > .btn-group > .btn { - display: block; - float: none; - width: 100%; - max-width: 100%; -} -.btn-group-vertical > .btn-group > .btn { - float: none; -} -.btn-group-vertical > .btn + .btn, -.btn-group-vertical > .btn + .btn-group, -.btn-group-vertical > .btn-group + .btn, -.btn-group-vertical > .btn-group + .btn-group { - margin-top: -1px; - margin-left: 0; -} -.btn-group-vertical > .btn:not(:first-child):not(:last-child) { - border-radius: 0; -} -.btn-group-vertical > .btn:first-child:not(:last-child) { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group-vertical > .btn:last-child:not(:first-child) { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; -} -.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { - border-radius: 0; -} -.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, -.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} -.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.btn-group-justified { - display: table; - width: 100%; - table-layout: fixed; - border-collapse: separate; -} -.btn-group-justified > .btn, -.btn-group-justified > .btn-group { - display: table-cell; - float: none; - width: 1%; -} -.btn-group-justified > .btn-group .btn { - width: 100%; -} -.btn-group-justified > .btn-group .dropdown-menu { - left: auto; -} -[data-toggle="buttons"] > .btn input[type="radio"], -[data-toggle="buttons"] > .btn-group > .btn input[type="radio"], -[data-toggle="buttons"] > .btn input[type="checkbox"], -[data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] { - position: absolute; - clip: rect(0, 0, 0, 0); - pointer-events: none; -} -/* stylelint-disable selector-no-qualifying-type */ -.input-group { - position: relative; - display: table; - border-collapse: separate; -} -.input-group[class*="col-"] { - float: none; - padding-right: 0; - padding-left: 0; -} -.input-group .form-control { - position: relative; - z-index: 2; - float: left; - width: 100%; - margin-bottom: 0; -} -.input-group .form-control:focus { - z-index: 3; -} -.input-group-lg > .form-control, -.input-group-lg > .input-group-addon, -.input-group-lg > .input-group-btn > .btn { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px; -} -select.input-group-lg > .form-control, -select.input-group-lg > .input-group-addon, -select.input-group-lg > .input-group-btn > .btn { - height: 46px; - line-height: 46px; -} -textarea.input-group-lg > .form-control, -textarea.input-group-lg > .input-group-addon, -textarea.input-group-lg > .input-group-btn > .btn, -select[multiple].input-group-lg > .form-control, -select[multiple].input-group-lg > .input-group-addon, -select[multiple].input-group-lg > .input-group-btn > .btn { - height: auto; -} -.input-group-sm > .form-control, -.input-group-sm > .input-group-addon, -.input-group-sm > .input-group-btn > .btn { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} -select.input-group-sm > .form-control, -select.input-group-sm > .input-group-addon, -select.input-group-sm > .input-group-btn > .btn { - height: 30px; - line-height: 30px; -} -textarea.input-group-sm > .form-control, -textarea.input-group-sm > .input-group-addon, -textarea.input-group-sm > .input-group-btn > .btn, -select[multiple].input-group-sm > .form-control, -select[multiple].input-group-sm > .input-group-addon, -select[multiple].input-group-sm > .input-group-btn > .btn { - height: auto; -} -.input-group-addon, -.input-group-btn, -.input-group .form-control { - display: table-cell; -} -.input-group-addon:not(:first-child):not(:last-child), -.input-group-btn:not(:first-child):not(:last-child), -.input-group .form-control:not(:first-child):not(:last-child) { - border-radius: 0; -} -.input-group-addon, -.input-group-btn { - width: 1%; - white-space: nowrap; - vertical-align: middle; -} -.input-group-addon { - padding: 6px 12px; - font-size: 14px; - font-weight: 400; - line-height: 1; - color: #555555; - text-align: center; - background-color: #eeeeee; - border: 1px solid #ccc; - border-radius: 4px; -} -.input-group-addon.input-sm { - padding: 5px 10px; - font-size: 12px; - border-radius: 3px; -} -.input-group-addon.input-lg { - padding: 10px 16px; - font-size: 18px; - border-radius: 6px; -} -.input-group-addon input[type="radio"], -.input-group-addon input[type="checkbox"] { - margin-top: 0; -} -.input-group .form-control:first-child, -.input-group-addon:first-child, -.input-group-btn:first-child > .btn, -.input-group-btn:first-child > .btn-group > .btn, -.input-group-btn:first-child > .dropdown-toggle, -.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), -.input-group-btn:last-child > .btn-group:not(:last-child) > .btn { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} -.input-group-addon:first-child { - border-right: 0; -} -.input-group .form-control:last-child, -.input-group-addon:last-child, -.input-group-btn:last-child > .btn, -.input-group-btn:last-child > .btn-group > .btn, -.input-group-btn:last-child > .dropdown-toggle, -.input-group-btn:first-child > .btn:not(:first-child), -.input-group-btn:first-child > .btn-group:not(:first-child) > .btn { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} -.input-group-addon:last-child { - border-left: 0; -} -.input-group-btn { - position: relative; - font-size: 0; - white-space: nowrap; -} -.input-group-btn > .btn { - position: relative; -} -.input-group-btn > .btn + .btn { - margin-left: -1px; -} -.input-group-btn > .btn:hover, -.input-group-btn > .btn:focus, -.input-group-btn > .btn:active { - z-index: 2; -} -.input-group-btn:first-child > .btn, -.input-group-btn:first-child > .btn-group { - margin-right: -1px; -} -.input-group-btn:last-child > .btn, -.input-group-btn:last-child > .btn-group { - z-index: 2; - margin-left: -1px; -} -/* stylelint-disable selector-no-qualifying-type, selector-max-type */ -.nav { - padding-left: 0; - margin-bottom: 0; - list-style: none; -} -.nav > li { - position: relative; - display: block; -} -.nav > li > a { - position: relative; - display: block; - padding: 10px 15px; -} -.nav > li > a:hover, -.nav > li > a:focus { - text-decoration: none; - background-color: #eeeeee; -} -.nav > li.disabled > a { - color: #777777; -} -.nav > li.disabled > a:hover, -.nav > li.disabled > a:focus { - color: #777777; - text-decoration: none; - cursor: not-allowed; - background-color: transparent; -} -.nav .open > a, -.nav .open > a:hover, -.nav .open > a:focus { - background-color: #eeeeee; - border-color: #337ab7; -} -.nav .nav-divider { - height: 1px; - margin: 9px 0; - overflow: hidden; - background-color: #e5e5e5; -} -.nav > li > a > img { - max-width: none; -} -.nav-tabs { - border-bottom: 1px solid #ddd; -} -.nav-tabs > li { - float: left; - margin-bottom: -1px; -} -.nav-tabs > li > a { - margin-right: 2px; - line-height: 1.42857143; - border: 1px solid transparent; - border-radius: 4px 4px 0 0; -} -.nav-tabs > li > a:hover { - border-color: #eeeeee #eeeeee #ddd; -} -.nav-tabs > li.active > a, -.nav-tabs > li.active > a:hover, -.nav-tabs > li.active > a:focus { - color: #555555; - cursor: default; - background-color: #fff; - border: 1px solid #ddd; - border-bottom-color: transparent; -} -.nav-tabs.nav-justified { - width: 100%; - border-bottom: 0; -} -.nav-tabs.nav-justified > li { - float: none; -} -.nav-tabs.nav-justified > li > a { - margin-bottom: 5px; - text-align: center; -} -.nav-tabs.nav-justified > .dropdown .dropdown-menu { - top: auto; - left: auto; -} -@media (min-width: 768px) { - .nav-tabs.nav-justified > li { - display: table-cell; - width: 1%; - } - .nav-tabs.nav-justified > li > a { - margin-bottom: 0; - } -} -.nav-tabs.nav-justified > li > a { - margin-right: 0; - border-radius: 4px; -} -.nav-tabs.nav-justified > .active > a, -.nav-tabs.nav-justified > .active > a:hover, -.nav-tabs.nav-justified > .active > a:focus { - border: 1px solid #ddd; -} -@media (min-width: 768px) { - .nav-tabs.nav-justified > li > a { - border-bottom: 1px solid #ddd; - border-radius: 4px 4px 0 0; - } - .nav-tabs.nav-justified > .active > a, - .nav-tabs.nav-justified > .active > a:hover, - .nav-tabs.nav-justified > .active > a:focus { - border-bottom-color: #fff; - } -} -.nav-pills > li { - float: left; -} -.nav-pills > li > a { - border-radius: 4px; -} -.nav-pills > li + li { - margin-left: 2px; -} -.nav-pills > li.active > a, -.nav-pills > li.active > a:hover, -.nav-pills > li.active > a:focus { - color: #fff; - background-color: #337ab7; -} -.nav-stacked > li { - float: none; -} -.nav-stacked > li + li { - margin-top: 2px; - margin-left: 0; -} -.nav-justified { - width: 100%; -} -.nav-justified > li { - float: none; -} -.nav-justified > li > a { - margin-bottom: 5px; - text-align: center; -} -.nav-justified > .dropdown .dropdown-menu { - top: auto; - left: auto; -} -@media (min-width: 768px) { - .nav-justified > li { - display: table-cell; - width: 1%; - } - .nav-justified > li > a { - margin-bottom: 0; - } -} -.nav-tabs-justified { - border-bottom: 0; -} -.nav-tabs-justified > li > a { - margin-right: 0; - border-radius: 4px; -} -.nav-tabs-justified > .active > a, -.nav-tabs-justified > .active > a:hover, -.nav-tabs-justified > .active > a:focus { - border: 1px solid #ddd; -} -@media (min-width: 768px) { - .nav-tabs-justified > li > a { - border-bottom: 1px solid #ddd; - border-radius: 4px 4px 0 0; - } - .nav-tabs-justified > .active > a, - .nav-tabs-justified > .active > a:hover, - .nav-tabs-justified > .active > a:focus { - border-bottom-color: #fff; - } -} -.tab-content > .tab-pane { - display: none; -} -.tab-content > .active { - display: block; -} -.nav-tabs .dropdown-menu { - margin-top: -1px; - border-top-left-radius: 0; - border-top-right-radius: 0; -} -/* stylelint-disable selector-max-type, selector-max-compound-selectors, selector-max-combinators, selector-max-class, declaration-no-important, selector-no-qualifying-type, no-duplicate-selectors */ -.navbar { - position: relative; - min-height: 50px; - margin-bottom: 20px; - border: 1px solid transparent; -} -@media (min-width: 768px) { - .navbar { - border-radius: 4px; - } -} -@media (min-width: 768px) { - .navbar-header { - float: left; - } -} -.navbar-collapse { - padding-right: 15px; - padding-left: 15px; - overflow-x: visible; - border-top: 1px solid transparent; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); - -webkit-overflow-scrolling: touch; -} -.navbar-collapse.in { - overflow-y: auto; -} -@media (min-width: 768px) { - .navbar-collapse { - width: auto; - border-top: 0; - -webkit-box-shadow: none; - box-shadow: none; - } - .navbar-collapse.collapse { - display: block !important; - height: auto !important; - padding-bottom: 0; - overflow: visible !important; - } - .navbar-collapse.in { - overflow-y: visible; - } - .navbar-fixed-top .navbar-collapse, - .navbar-static-top .navbar-collapse, - .navbar-fixed-bottom .navbar-collapse { - padding-right: 0; - padding-left: 0; - } -} -.navbar-fixed-top .navbar-collapse, -.navbar-fixed-bottom .navbar-collapse { - max-height: 340px; -} -@media (max-device-width: 480px) and (orientation: landscape) { - .navbar-fixed-top .navbar-collapse, - .navbar-fixed-bottom .navbar-collapse { - max-height: 200px; - } -} -.container > .navbar-header, -.container-fluid > .navbar-header, -.container > .navbar-collapse, -.container-fluid > .navbar-collapse { - margin-right: -15px; - margin-left: -15px; -} -@media (min-width: 768px) { - .container > .navbar-header, - .container-fluid > .navbar-header, - .container > .navbar-collapse, - .container-fluid > .navbar-collapse { - margin-right: 0; - margin-left: 0; - } -} -.navbar-static-top { - z-index: 1000; - border-width: 0 0 1px; -} -@media (min-width: 768px) { - .navbar-static-top { - border-radius: 0; - } -} -.navbar-fixed-top, -.navbar-fixed-bottom { - position: fixed; - right: 0; - left: 0; - z-index: 1030; -} -@media (min-width: 768px) { - .navbar-fixed-top, - .navbar-fixed-bottom { - border-radius: 0; - } -} -.navbar-fixed-top { - top: 0; - border-width: 0 0 1px; -} -.navbar-fixed-bottom { - bottom: 0; - margin-bottom: 0; - border-width: 1px 0 0; -} -.navbar-brand { - float: left; - height: 50px; - padding: 15px 15px; - font-size: 18px; - line-height: 20px; -} -.navbar-brand:hover, -.navbar-brand:focus { - text-decoration: none; -} -.navbar-brand > img { - display: block; -} -@media (min-width: 768px) { - .navbar > .container .navbar-brand, - .navbar > .container-fluid .navbar-brand { - margin-left: -15px; - } -} -.navbar-toggle { - position: relative; - float: right; - padding: 9px 10px; - margin-right: 15px; - margin-top: 8px; - margin-bottom: 8px; - background-color: transparent; - background-image: none; - border: 1px solid transparent; - border-radius: 4px; -} -.navbar-toggle:focus { - outline: 0; -} -.navbar-toggle .icon-bar { - display: block; - width: 22px; - height: 2px; - border-radius: 1px; -} -.navbar-toggle .icon-bar + .icon-bar { - margin-top: 4px; -} -@media (min-width: 768px) { - .navbar-toggle { - display: none; - } -} -.navbar-nav { - margin: 7.5px -15px; -} -.navbar-nav > li > a { - padding-top: 10px; - padding-bottom: 10px; - line-height: 20px; -} -@media (max-width: 767px) { - .navbar-nav .open .dropdown-menu { - position: static; - float: none; - width: auto; - margin-top: 0; - background-color: transparent; - border: 0; - -webkit-box-shadow: none; - box-shadow: none; - } - .navbar-nav .open .dropdown-menu > li > a, - .navbar-nav .open .dropdown-menu .dropdown-header { - padding: 5px 15px 5px 25px; - } - .navbar-nav .open .dropdown-menu > li > a { - line-height: 20px; - } - .navbar-nav .open .dropdown-menu > li > a:hover, - .navbar-nav .open .dropdown-menu > li > a:focus { - background-image: none; - } -} -@media (min-width: 768px) { - .navbar-nav { - float: left; - margin: 0; - } - .navbar-nav > li { - float: left; - } - .navbar-nav > li > a { - padding-top: 15px; - padding-bottom: 15px; - } -} -.navbar-form { - padding: 10px 15px; - margin-right: -15px; - margin-left: -15px; - border-top: 1px solid transparent; - border-bottom: 1px solid transparent; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); - margin-top: 8px; - margin-bottom: 8px; -} -@media (min-width: 768px) { - .navbar-form .form-group { - display: inline-block; - margin-bottom: 0; - vertical-align: middle; - } - .navbar-form .form-control { - display: inline-block; - width: auto; - vertical-align: middle; - } - .navbar-form .form-control-static { - display: inline-block; - } - .navbar-form .input-group { - display: inline-table; - vertical-align: middle; - } - .navbar-form .input-group .input-group-addon, - .navbar-form .input-group .input-group-btn, - .navbar-form .input-group .form-control { - width: auto; - } - .navbar-form .input-group > .form-control { - width: 100%; - } - .navbar-form .control-label { - margin-bottom: 0; - vertical-align: middle; - } - .navbar-form .radio, - .navbar-form .checkbox { - display: inline-block; - margin-top: 0; - margin-bottom: 0; - vertical-align: middle; - } - .navbar-form .radio label, - .navbar-form .checkbox label { - padding-left: 0; - } - .navbar-form .radio input[type="radio"], - .navbar-form .checkbox input[type="checkbox"] { - position: relative; - margin-left: 0; - } - .navbar-form .has-feedback .form-control-feedback { - top: 0; - } -} -@media (max-width: 767px) { - .navbar-form .form-group { - margin-bottom: 5px; - } - .navbar-form .form-group:last-child { - margin-bottom: 0; - } -} -@media (min-width: 768px) { - .navbar-form { - width: auto; - padding-top: 0; - padding-bottom: 0; - margin-right: 0; - margin-left: 0; - border: 0; - -webkit-box-shadow: none; - box-shadow: none; - } -} -.navbar-nav > li > .dropdown-menu { - margin-top: 0; - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { - margin-bottom: 0; - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} -.navbar-btn { - margin-top: 8px; - margin-bottom: 8px; -} -.navbar-btn.btn-sm { - margin-top: 10px; - margin-bottom: 10px; -} -.navbar-btn.btn-xs { - margin-top: 14px; - margin-bottom: 14px; -} -.navbar-text { - margin-top: 15px; - margin-bottom: 15px; -} -@media (min-width: 768px) { - .navbar-text { - float: left; - margin-right: 15px; - margin-left: 15px; - } -} -@media (min-width: 768px) { - .navbar-left { - float: left !important; - } - .navbar-right { - float: right !important; - margin-right: -15px; - } - .navbar-right ~ .navbar-right { - margin-right: 0; - } -} -.navbar-default { - background-color: #f8f8f8; - border-color: #e7e7e7; -} -.navbar-default .navbar-brand { - color: #777; -} -.navbar-default .navbar-brand:hover, -.navbar-default .navbar-brand:focus { - color: #5e5e5e; - background-color: transparent; -} -.navbar-default .navbar-text { - color: #777; -} -.navbar-default .navbar-nav > li > a { - color: #777; -} -.navbar-default .navbar-nav > li > a:hover, -.navbar-default .navbar-nav > li > a:focus { - color: #333; - background-color: transparent; -} -.navbar-default .navbar-nav > .active > a, -.navbar-default .navbar-nav > .active > a:hover, -.navbar-default .navbar-nav > .active > a:focus { - color: #555; - background-color: #e7e7e7; -} -.navbar-default .navbar-nav > .disabled > a, -.navbar-default .navbar-nav > .disabled > a:hover, -.navbar-default .navbar-nav > .disabled > a:focus { - color: #ccc; - background-color: transparent; -} -.navbar-default .navbar-toggle { - border-color: #ddd; -} -.navbar-default .navbar-toggle:hover, -.navbar-default .navbar-toggle:focus { - background-color: #ddd; -} -.navbar-default .navbar-toggle .icon-bar { - background-color: #888; -} -.navbar-default .navbar-collapse, -.navbar-default .navbar-form { - border-color: #e7e7e7; -} -.navbar-default .navbar-nav > .open > a, -.navbar-default .navbar-nav > .open > a:hover, -.navbar-default .navbar-nav > .open > a:focus { - color: #555; - background-color: #e7e7e7; -} -@media (max-width: 767px) { - .navbar-default .navbar-nav .open .dropdown-menu > li > a { - color: #777; - } - .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, - .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { - color: #333; - background-color: transparent; - } - .navbar-default .navbar-nav .open .dropdown-menu > .active > a, - .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, - .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { - color: #555; - background-color: #e7e7e7; - } - .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, - .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, - .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { - color: #ccc; - background-color: transparent; - } -} -.navbar-default .navbar-link { - color: #777; -} -.navbar-default .navbar-link:hover { - color: #333; -} -.navbar-default .btn-link { - color: #777; -} -.navbar-default .btn-link:hover, -.navbar-default .btn-link:focus { - color: #333; -} -.navbar-default .btn-link[disabled]:hover, -fieldset[disabled] .navbar-default .btn-link:hover, -.navbar-default .btn-link[disabled]:focus, -fieldset[disabled] .navbar-default .btn-link:focus { - color: #ccc; -} -.navbar-inverse { - background-color: #222; - border-color: #080808; -} -.navbar-inverse .navbar-brand { - color: #9d9d9d; -} -.navbar-inverse .navbar-brand:hover, -.navbar-inverse .navbar-brand:focus { - color: #fff; - background-color: transparent; -} -.navbar-inverse .navbar-text { - color: #9d9d9d; -} -.navbar-inverse .navbar-nav > li > a { - color: #9d9d9d; -} -.navbar-inverse .navbar-nav > li > a:hover, -.navbar-inverse .navbar-nav > li > a:focus { - color: #fff; - background-color: transparent; -} -.navbar-inverse .navbar-nav > .active > a, -.navbar-inverse .navbar-nav > .active > a:hover, -.navbar-inverse .navbar-nav > .active > a:focus { - color: #fff; - background-color: #080808; -} -.navbar-inverse .navbar-nav > .disabled > a, -.navbar-inverse .navbar-nav > .disabled > a:hover, -.navbar-inverse .navbar-nav > .disabled > a:focus { - color: #444; - background-color: transparent; -} -.navbar-inverse .navbar-toggle { - border-color: #333; -} -.navbar-inverse .navbar-toggle:hover, -.navbar-inverse .navbar-toggle:focus { - background-color: #333; -} -.navbar-inverse .navbar-toggle .icon-bar { - background-color: #fff; -} -.navbar-inverse .navbar-collapse, -.navbar-inverse .navbar-form { - border-color: #101010; -} -.navbar-inverse .navbar-nav > .open > a, -.navbar-inverse .navbar-nav > .open > a:hover, -.navbar-inverse .navbar-nav > .open > a:focus { - color: #fff; - background-color: #080808; -} -@media (max-width: 767px) { - .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { - border-color: #080808; - } - .navbar-inverse .navbar-nav .open .dropdown-menu .divider { - background-color: #080808; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { - color: #9d9d9d; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, - .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { - color: #fff; - background-color: transparent; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, - .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, - .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { - color: #fff; - background-color: #080808; - } - .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, - .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, - .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { - color: #444; - background-color: transparent; - } -} -.navbar-inverse .navbar-link { - color: #9d9d9d; -} -.navbar-inverse .navbar-link:hover { - color: #fff; -} -.navbar-inverse .btn-link { - color: #9d9d9d; -} -.navbar-inverse .btn-link:hover, -.navbar-inverse .btn-link:focus { - color: #fff; -} -.navbar-inverse .btn-link[disabled]:hover, -fieldset[disabled] .navbar-inverse .btn-link:hover, -.navbar-inverse .btn-link[disabled]:focus, -fieldset[disabled] .navbar-inverse .btn-link:focus { - color: #444; -} -.breadcrumb { - padding: 8px 15px; - margin-bottom: 20px; - list-style: none; - background-color: #f5f5f5; - border-radius: 4px; -} -.breadcrumb > li { - display: inline-block; -} -.breadcrumb > li + li::before { - padding: 0 5px; - color: #ccc; - content: "/\00a0"; -} -.breadcrumb > .active { - color: #777777; -} -.pagination { - display: inline-block; - padding-left: 0; - margin: 20px 0; - border-radius: 4px; -} -.pagination > li { - display: inline; -} -.pagination > li > a, -.pagination > li > span { - position: relative; - float: left; - padding: 6px 12px; - margin-left: -1px; - line-height: 1.42857143; - color: #337ab7; - text-decoration: none; - background-color: #fff; - border: 1px solid #ddd; -} -.pagination > li > a:hover, -.pagination > li > span:hover, -.pagination > li > a:focus, -.pagination > li > span:focus { - z-index: 2; - color: #23527c; - background-color: #eeeeee; - border-color: #ddd; -} -.pagination > li:first-child > a, -.pagination > li:first-child > span { - margin-left: 0; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; -} -.pagination > li:last-child > a, -.pagination > li:last-child > span { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} -.pagination > .active > a, -.pagination > .active > span, -.pagination > .active > a:hover, -.pagination > .active > span:hover, -.pagination > .active > a:focus, -.pagination > .active > span:focus { - z-index: 3; - color: #fff; - cursor: default; - background-color: #337ab7; - border-color: #337ab7; -} -.pagination > .disabled > span, -.pagination > .disabled > span:hover, -.pagination > .disabled > span:focus, -.pagination > .disabled > a, -.pagination > .disabled > a:hover, -.pagination > .disabled > a:focus { - color: #777777; - cursor: not-allowed; - background-color: #fff; - border-color: #ddd; -} -.pagination-lg > li > a, -.pagination-lg > li > span { - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; -} -.pagination-lg > li:first-child > a, -.pagination-lg > li:first-child > span { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px; -} -.pagination-lg > li:last-child > a, -.pagination-lg > li:last-child > span { - border-top-right-radius: 6px; - border-bottom-right-radius: 6px; -} -.pagination-sm > li > a, -.pagination-sm > li > span { - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; -} -.pagination-sm > li:first-child > a, -.pagination-sm > li:first-child > span { - border-top-left-radius: 3px; - border-bottom-left-radius: 3px; -} -.pagination-sm > li:last-child > a, -.pagination-sm > li:last-child > span { - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; -} -.pager { - padding-left: 0; - margin: 20px 0; - text-align: center; - list-style: none; -} -.pager li { - display: inline; -} -.pager li > a, -.pager li > span { - display: inline-block; - padding: 5px 14px; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 15px; -} -.pager li > a:hover, -.pager li > a:focus { - text-decoration: none; - background-color: #eeeeee; -} -.pager .next > a, -.pager .next > span { - float: right; -} -.pager .previous > a, -.pager .previous > span { - float: left; -} -.pager .disabled > a, -.pager .disabled > a:hover, -.pager .disabled > a:focus, -.pager .disabled > span { - color: #777777; - cursor: not-allowed; - background-color: #fff; -} -.label { - display: inline; - padding: .2em .6em .3em; - font-size: 75%; - font-weight: 700; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: .25em; -} -a.label:hover, -a.label:focus { - color: #fff; - text-decoration: none; - cursor: pointer; -} -.label:empty { - display: none; -} -.btn .label { - position: relative; - top: -1px; -} -.label-default { - background-color: #777777; -} -.label-default[href]:hover, -.label-default[href]:focus { - background-color: #5e5e5e; -} -.label-primary { - background-color: #337ab7; -} -.label-primary[href]:hover, -.label-primary[href]:focus { - background-color: #286090; -} -.label-success { - background-color: #5cb85c; -} -.label-success[href]:hover, -.label-success[href]:focus { - background-color: #449d44; -} -.label-info { - background-color: #5bc0de; -} -.label-info[href]:hover, -.label-info[href]:focus { - background-color: #31b0d5; -} -.label-warning { - background-color: #f0ad4e; -} -.label-warning[href]:hover, -.label-warning[href]:focus { - background-color: #ec971f; -} -.label-danger { - background-color: #d9534f; -} -.label-danger[href]:hover, -.label-danger[href]:focus { - background-color: #c9302c; -} -.badge { - display: inline-block; - min-width: 10px; - padding: 3px 7px; - font-size: 12px; - font-weight: bold; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: middle; - background-color: #777777; - border-radius: 10px; -} -.badge:empty { - display: none; -} -.btn .badge { - position: relative; - top: -1px; -} -.btn-xs .badge, -.btn-group-xs > .btn .badge { - top: 0; - padding: 1px 5px; -} -a.badge:hover, -a.badge:focus { - color: #fff; - text-decoration: none; - cursor: pointer; -} -.list-group-item.active > .badge, -.nav-pills > .active > a > .badge { - color: #337ab7; - background-color: #fff; -} -.list-group-item > .badge { - float: right; -} -.list-group-item > .badge + .badge { - margin-right: 5px; -} -.nav-pills > li > a > .badge { - margin-left: 3px; -} -.jumbotron { - padding-top: 30px; - padding-bottom: 30px; - margin-bottom: 30px; - color: inherit; - background-color: #eeeeee; -} -.jumbotron h1, -.jumbotron .h1 { - color: inherit; -} -.jumbotron p { - margin-bottom: 15px; - font-size: 21px; - font-weight: 200; -} -.jumbotron > hr { - border-top-color: #d5d5d5; -} -.container .jumbotron, -.container-fluid .jumbotron { - padding-right: 15px; - padding-left: 15px; - border-radius: 6px; -} -.jumbotron .container { - max-width: 100%; -} -@media screen and (min-width: 768px) { - .jumbotron { - padding-top: 48px; - padding-bottom: 48px; - } - .container .jumbotron, - .container-fluid .jumbotron { - padding-right: 60px; - padding-left: 60px; - } - .jumbotron h1, - .jumbotron .h1 { - font-size: 63px; - } -} -/* stylelint-disable selector-no-qualifying-type */ -.thumbnail { - display: block; - padding: 4px; - margin-bottom: 20px; - line-height: 1.42857143; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 4px; - -webkit-transition: border 0.2s ease-in-out; - -o-transition: border 0.2s ease-in-out; - transition: border 0.2s ease-in-out; -} -.thumbnail > img, -.thumbnail a > img { - margin-right: auto; - margin-left: auto; -} -a.thumbnail:hover, -a.thumbnail:focus, -a.thumbnail.active { - border-color: #337ab7; -} -.thumbnail .caption { - padding: 9px; - color: #333333; -} -.alert { - padding: 15px; - margin-bottom: 20px; - border: 1px solid transparent; - border-radius: 4px; -} -.alert h4 { - margin-top: 0; - color: inherit; -} -.alert .alert-link { - font-weight: bold; -} -.alert > p, -.alert > ul { - margin-bottom: 0; -} -.alert > p + p { - margin-top: 5px; -} -.alert-dismissable, -.alert-dismissible { - padding-right: 35px; -} -.alert-dismissable .close, -.alert-dismissible .close { - position: relative; - top: -2px; - right: -21px; - color: inherit; -} -.alert-success { - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6; -} -.alert-success hr { - border-top-color: #c9e2b3; -} -.alert-success .alert-link { - color: #2b542c; -} -.alert-info { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1; -} -.alert-info hr { - border-top-color: #a6e1ec; -} -.alert-info .alert-link { - color: #245269; -} -.alert-warning { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc; -} -.alert-warning hr { - border-top-color: #f7e1b5; -} -.alert-warning .alert-link { - color: #66512c; -} -.alert-danger { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1; -} -.alert-danger hr { - border-top-color: #e4b9c0; -} -.alert-danger .alert-link { - color: #843534; -} -/* stylelint-disable at-rule-no-vendor-prefix */ -@-webkit-keyframes progress-bar-stripes { - from { - background-position: 40px 0; - } - to { - background-position: 0 0; - } -} -@-o-keyframes progress-bar-stripes { - from { - background-position: 40px 0; - } - to { - background-position: 0 0; - } -} -@keyframes progress-bar-stripes { - from { - background-position: 40px 0; - } - to { - background-position: 0 0; - } -} -.progress { - height: 20px; - margin-bottom: 20px; - overflow: hidden; - background-color: #f5f5f5; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -} -.progress-bar { - float: left; - width: 0%; - height: 100%; - font-size: 12px; - line-height: 20px; - color: #fff; - text-align: center; - background-color: #337ab7; - -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - -webkit-transition: width 0.6s ease; - -o-transition: width 0.6s ease; - transition: width 0.6s ease; -} -.progress-striped .progress-bar, -.progress-bar-striped { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - -webkit-background-size: 40px 40px; - background-size: 40px 40px; -} -.progress.active .progress-bar, -.progress-bar.active { - -webkit-animation: progress-bar-stripes 2s linear infinite; - -o-animation: progress-bar-stripes 2s linear infinite; - animation: progress-bar-stripes 2s linear infinite; -} -.progress-bar-success { - background-color: #5cb85c; -} -.progress-striped .progress-bar-success { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.progress-bar-info { - background-color: #5bc0de; -} -.progress-striped .progress-bar-info { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.progress-bar-warning { - background-color: #f0ad4e; -} -.progress-striped .progress-bar-warning { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.progress-bar-danger { - background-color: #d9534f; -} -.progress-striped .progress-bar-danger { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} -.media { - margin-top: 15px; -} -.media:first-child { - margin-top: 0; -} -.media, -.media-body { - overflow: hidden; - zoom: 1; -} -.media-body { - width: 10000px; -} -.media-object { - display: block; -} -.media-object.img-thumbnail { - max-width: none; -} -.media-right, -.media > .pull-right { - padding-left: 10px; -} -.media-left, -.media > .pull-left { - padding-right: 10px; -} -.media-left, -.media-right, -.media-body { - display: table-cell; - vertical-align: top; -} -.media-middle { - vertical-align: middle; -} -.media-bottom { - vertical-align: bottom; -} -.media-heading { - margin-top: 0; - margin-bottom: 5px; -} -.media-list { - padding-left: 0; - list-style: none; -} -/* stylelint-disable selector-no-qualifying-type */ -.list-group { - padding-left: 0; - margin-bottom: 20px; -} -.list-group-item { - position: relative; - display: block; - padding: 10px 15px; - margin-bottom: -1px; - background-color: #fff; - border: 1px solid #ddd; -} -.list-group-item:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} -.list-group-item:last-child { - margin-bottom: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; -} -.list-group-item.disabled, -.list-group-item.disabled:hover, -.list-group-item.disabled:focus { - color: #777777; - cursor: not-allowed; - background-color: #eeeeee; -} -.list-group-item.disabled .list-group-item-heading, -.list-group-item.disabled:hover .list-group-item-heading, -.list-group-item.disabled:focus .list-group-item-heading { - color: inherit; -} -.list-group-item.disabled .list-group-item-text, -.list-group-item.disabled:hover .list-group-item-text, -.list-group-item.disabled:focus .list-group-item-text { - color: #777777; -} -.list-group-item.active, -.list-group-item.active:hover, -.list-group-item.active:focus { - z-index: 2; - color: #fff; - background-color: #337ab7; - border-color: #337ab7; -} -.list-group-item.active .list-group-item-heading, -.list-group-item.active:hover .list-group-item-heading, -.list-group-item.active:focus .list-group-item-heading, -.list-group-item.active .list-group-item-heading > small, -.list-group-item.active:hover .list-group-item-heading > small, -.list-group-item.active:focus .list-group-item-heading > small, -.list-group-item.active .list-group-item-heading > .small, -.list-group-item.active:hover .list-group-item-heading > .small, -.list-group-item.active:focus .list-group-item-heading > .small { - color: inherit; -} -.list-group-item.active .list-group-item-text, -.list-group-item.active:hover .list-group-item-text, -.list-group-item.active:focus .list-group-item-text { - color: #c7ddef; -} -a.list-group-item, -button.list-group-item { - color: #555; -} -a.list-group-item .list-group-item-heading, -button.list-group-item .list-group-item-heading { - color: #333; -} -a.list-group-item:hover, -button.list-group-item:hover, -a.list-group-item:focus, -button.list-group-item:focus { - color: #555; - text-decoration: none; - background-color: #f5f5f5; -} -button.list-group-item { - width: 100%; - text-align: left; -} -.list-group-item-success { - color: #3c763d; - background-color: #dff0d8; -} -a.list-group-item-success, -button.list-group-item-success { - color: #3c763d; -} -a.list-group-item-success .list-group-item-heading, -button.list-group-item-success .list-group-item-heading { - color: inherit; -} -a.list-group-item-success:hover, -button.list-group-item-success:hover, -a.list-group-item-success:focus, -button.list-group-item-success:focus { - color: #3c763d; - background-color: #d0e9c6; -} -a.list-group-item-success.active, -button.list-group-item-success.active, -a.list-group-item-success.active:hover, -button.list-group-item-success.active:hover, -a.list-group-item-success.active:focus, -button.list-group-item-success.active:focus { - color: #fff; - background-color: #3c763d; - border-color: #3c763d; -} -.list-group-item-info { - color: #31708f; - background-color: #d9edf7; -} -a.list-group-item-info, -button.list-group-item-info { - color: #31708f; -} -a.list-group-item-info .list-group-item-heading, -button.list-group-item-info .list-group-item-heading { - color: inherit; -} -a.list-group-item-info:hover, -button.list-group-item-info:hover, -a.list-group-item-info:focus, -button.list-group-item-info:focus { - color: #31708f; - background-color: #c4e3f3; -} -a.list-group-item-info.active, -button.list-group-item-info.active, -a.list-group-item-info.active:hover, -button.list-group-item-info.active:hover, -a.list-group-item-info.active:focus, -button.list-group-item-info.active:focus { - color: #fff; - background-color: #31708f; - border-color: #31708f; -} -.list-group-item-warning { - color: #8a6d3b; - background-color: #fcf8e3; -} -a.list-group-item-warning, -button.list-group-item-warning { - color: #8a6d3b; -} -a.list-group-item-warning .list-group-item-heading, -button.list-group-item-warning .list-group-item-heading { - color: inherit; -} -a.list-group-item-warning:hover, -button.list-group-item-warning:hover, -a.list-group-item-warning:focus, -button.list-group-item-warning:focus { - color: #8a6d3b; - background-color: #faf2cc; -} -a.list-group-item-warning.active, -button.list-group-item-warning.active, -a.list-group-item-warning.active:hover, -button.list-group-item-warning.active:hover, -a.list-group-item-warning.active:focus, -button.list-group-item-warning.active:focus { - color: #fff; - background-color: #8a6d3b; - border-color: #8a6d3b; -} -.list-group-item-danger { - color: #a94442; - background-color: #f2dede; -} -a.list-group-item-danger, -button.list-group-item-danger { - color: #a94442; -} -a.list-group-item-danger .list-group-item-heading, -button.list-group-item-danger .list-group-item-heading { - color: inherit; -} -a.list-group-item-danger:hover, -button.list-group-item-danger:hover, -a.list-group-item-danger:focus, -button.list-group-item-danger:focus { - color: #a94442; - background-color: #ebcccc; -} -a.list-group-item-danger.active, -button.list-group-item-danger.active, -a.list-group-item-danger.active:hover, -button.list-group-item-danger.active:hover, -a.list-group-item-danger.active:focus, -button.list-group-item-danger.active:focus { - color: #fff; - background-color: #a94442; - border-color: #a94442; -} -.list-group-item-heading { - margin-top: 0; - margin-bottom: 5px; -} -.list-group-item-text { - margin-bottom: 0; - line-height: 1.3; -} -/* stylelint-disable selector-max-type, selector-max-compound-selectors, selector-max-combinators, no-duplicate-selectors */ -.panel { - margin-bottom: 20px; - background-color: #fff; - border: 1px solid transparent; - border-radius: 4px; - -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); -} -.panel-body { - padding: 15px; -} -.panel-heading { - padding: 10px 15px; - border-bottom: 1px solid transparent; - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel-heading > .dropdown .dropdown-toggle { - color: inherit; -} -.panel-title { - margin-top: 0; - margin-bottom: 0; - font-size: 16px; - color: inherit; -} -.panel-title > a, -.panel-title > small, -.panel-title > .small, -.panel-title > small > a, -.panel-title > .small > a { - color: inherit; -} -.panel-footer { - padding: 10px 15px; - background-color: #f5f5f5; - border-top: 1px solid #ddd; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .list-group, -.panel > .panel-collapse > .list-group { - margin-bottom: 0; -} -.panel > .list-group .list-group-item, -.panel > .panel-collapse > .list-group .list-group-item { - border-width: 1px 0; - border-radius: 0; -} -.panel > .list-group:first-child .list-group-item:first-child, -.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child { - border-top: 0; - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel > .list-group:last-child .list-group-item:last-child, -.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child { - border-bottom: 0; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.panel-heading + .list-group .list-group-item:first-child { - border-top-width: 0; -} -.list-group + .panel-footer { - border-top-width: 0; -} -.panel > .table, -.panel > .table-responsive > .table, -.panel > .panel-collapse > .table { - margin-bottom: 0; -} -.panel > .table caption, -.panel > .table-responsive > .table caption, -.panel > .panel-collapse > .table caption { - padding-right: 15px; - padding-left: 15px; -} -.panel > .table:first-child, -.panel > .table-responsive:first-child > .table:first-child { - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel > .table:first-child > thead:first-child > tr:first-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child, -.panel > .table:first-child > tbody:first-child > tr:first-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child { - border-top-left-radius: 3px; - border-top-right-radius: 3px; -} -.panel > .table:first-child > thead:first-child > tr:first-child td:first-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, -.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, -.panel > .table:first-child > thead:first-child > tr:first-child th:first-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, -.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { - border-top-left-radius: 3px; -} -.panel > .table:first-child > thead:first-child > tr:first-child td:last-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, -.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, -.panel > .table:first-child > thead:first-child > tr:first-child th:last-child, -.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, -.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, -.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { - border-top-right-radius: 3px; -} -.panel > .table:last-child, -.panel > .table-responsive:last-child > .table:last-child { - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .table:last-child > tbody:last-child > tr:last-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child { - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; -} -.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, -.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { - border-bottom-left-radius: 3px; -} -.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, -.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, -.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, -.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, -.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { - border-bottom-right-radius: 3px; -} -.panel > .panel-body + .table, -.panel > .panel-body + .table-responsive, -.panel > .table + .panel-body, -.panel > .table-responsive + .panel-body { - border-top: 1px solid #ddd; -} -.panel > .table > tbody:first-child > tr:first-child th, -.panel > .table > tbody:first-child > tr:first-child td { - border-top: 0; -} -.panel > .table-bordered, -.panel > .table-responsive > .table-bordered { - border: 0; -} -.panel > .table-bordered > thead > tr > th:first-child, -.panel > .table-responsive > .table-bordered > thead > tr > th:first-child, -.panel > .table-bordered > tbody > tr > th:first-child, -.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, -.panel > .table-bordered > tfoot > tr > th:first-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, -.panel > .table-bordered > thead > tr > td:first-child, -.panel > .table-responsive > .table-bordered > thead > tr > td:first-child, -.panel > .table-bordered > tbody > tr > td:first-child, -.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, -.panel > .table-bordered > tfoot > tr > td:first-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { - border-left: 0; -} -.panel > .table-bordered > thead > tr > th:last-child, -.panel > .table-responsive > .table-bordered > thead > tr > th:last-child, -.panel > .table-bordered > tbody > tr > th:last-child, -.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, -.panel > .table-bordered > tfoot > tr > th:last-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, -.panel > .table-bordered > thead > tr > td:last-child, -.panel > .table-responsive > .table-bordered > thead > tr > td:last-child, -.panel > .table-bordered > tbody > tr > td:last-child, -.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, -.panel > .table-bordered > tfoot > tr > td:last-child, -.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { - border-right: 0; -} -.panel > .table-bordered > thead > tr:first-child > td, -.panel > .table-responsive > .table-bordered > thead > tr:first-child > td, -.panel > .table-bordered > tbody > tr:first-child > td, -.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, -.panel > .table-bordered > thead > tr:first-child > th, -.panel > .table-responsive > .table-bordered > thead > tr:first-child > th, -.panel > .table-bordered > tbody > tr:first-child > th, -.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { - border-bottom: 0; -} -.panel > .table-bordered > tbody > tr:last-child > td, -.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, -.panel > .table-bordered > tfoot > tr:last-child > td, -.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, -.panel > .table-bordered > tbody > tr:last-child > th, -.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, -.panel > .table-bordered > tfoot > tr:last-child > th, -.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { - border-bottom: 0; -} -.panel > .table-responsive { - margin-bottom: 0; - border: 0; -} -.panel-group { - margin-bottom: 20px; -} -.panel-group .panel { - margin-bottom: 0; - border-radius: 4px; -} -.panel-group .panel + .panel { - margin-top: 5px; -} -.panel-group .panel-heading { - border-bottom: 0; -} -.panel-group .panel-heading + .panel-collapse > .panel-body, -.panel-group .panel-heading + .panel-collapse > .list-group { - border-top: 1px solid #ddd; -} -.panel-group .panel-footer { - border-top: 0; -} -.panel-group .panel-footer + .panel-collapse .panel-body { - border-bottom: 1px solid #ddd; -} -.panel-default { - border-color: #ddd; -} -.panel-default > .panel-heading { - color: #333333; - background-color: #f5f5f5; - border-color: #ddd; -} -.panel-default > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #ddd; -} -.panel-default > .panel-heading .badge { - color: #f5f5f5; - background-color: #333333; -} -.panel-default > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #ddd; -} -.panel-primary { - border-color: #337ab7; -} -.panel-primary > .panel-heading { - color: #fff; - background-color: #337ab7; - border-color: #337ab7; -} -.panel-primary > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #337ab7; -} -.panel-primary > .panel-heading .badge { - color: #337ab7; - background-color: #fff; -} -.panel-primary > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #337ab7; -} -.panel-success { - border-color: #d6e9c6; -} -.panel-success > .panel-heading { - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6; -} -.panel-success > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #d6e9c6; -} -.panel-success > .panel-heading .badge { - color: #dff0d8; - background-color: #3c763d; -} -.panel-success > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #d6e9c6; -} -.panel-info { - border-color: #bce8f1; -} -.panel-info > .panel-heading { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1; -} -.panel-info > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #bce8f1; -} -.panel-info > .panel-heading .badge { - color: #d9edf7; - background-color: #31708f; -} -.panel-info > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #bce8f1; -} -.panel-warning { - border-color: #faebcc; -} -.panel-warning > .panel-heading { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc; -} -.panel-warning > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #faebcc; -} -.panel-warning > .panel-heading .badge { - color: #fcf8e3; - background-color: #8a6d3b; -} -.panel-warning > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #faebcc; -} -.panel-danger { - border-color: #ebccd1; -} -.panel-danger > .panel-heading { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1; -} -.panel-danger > .panel-heading + .panel-collapse > .panel-body { - border-top-color: #ebccd1; -} -.panel-danger > .panel-heading .badge { - color: #f2dede; - background-color: #a94442; -} -.panel-danger > .panel-footer + .panel-collapse > .panel-body { - border-bottom-color: #ebccd1; -} -.embed-responsive { - position: relative; - display: block; - height: 0; - padding: 0; - overflow: hidden; -} -.embed-responsive .embed-responsive-item, -.embed-responsive iframe, -.embed-responsive embed, -.embed-responsive object, -.embed-responsive video { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - border: 0; -} -.embed-responsive-16by9 { - padding-bottom: 56.25%; -} -.embed-responsive-4by3 { - padding-bottom: 75%; -} -.well { - min-height: 20px; - padding: 19px; - margin-bottom: 20px; - background-color: #f5f5f5; - border: 1px solid #e3e3e3; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); -} -.well blockquote { - border-color: #ddd; - border-color: rgba(0, 0, 0, 0.15); -} -.well-lg { - padding: 24px; - border-radius: 6px; -} -.well-sm { - padding: 9px; - border-radius: 3px; -} -/* stylelint-disable property-no-vendor-prefix */ -.close { - float: right; - font-size: 21px; - font-weight: bold; - line-height: 1; - color: #000; - text-shadow: 0 1px 0 #fff; - filter: alpha(opacity=20); - opacity: 0.2; -} -.close:hover, -.close:focus { - color: #000; - text-decoration: none; - cursor: pointer; - filter: alpha(opacity=50); - opacity: 0.5; -} -button.close { - padding: 0; - cursor: pointer; - background: transparent; - border: 0; - -webkit-appearance: none; -} -.modal-open { - overflow: hidden; -} -.modal { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1050; - display: none; - overflow: hidden; - -webkit-overflow-scrolling: touch; - outline: 0; -} -.modal.fade .modal-dialog { - -webkit-transform: translate(0, -25%); - -ms-transform: translate(0, -25%); - -o-transform: translate(0, -25%); - transform: translate(0, -25%); - -webkit-transition: -webkit-transform 0.3s ease-out; - -o-transition: -o-transform 0.3s ease-out; - transition: transform 0.3s ease-out; -} -.modal.in .modal-dialog { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0); -} -.modal-open .modal { - overflow-x: hidden; - overflow-y: auto; -} -.modal-dialog { - position: relative; - width: auto; - margin: 10px; -} -.modal-content { - position: relative; - background-color: #fff; - -webkit-background-clip: padding-box; - background-clip: padding-box; - border: 1px solid #999; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 6px; - -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); - outline: 0; -} -.modal-backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1040; - background-color: #000; -} -.modal-backdrop.fade { - filter: alpha(opacity=0); - opacity: 0; -} -.modal-backdrop.in { - filter: alpha(opacity=50); - opacity: 0.5; -} -.modal-header { - padding: 15px; - border-bottom: 1px solid #e5e5e5; -} -.modal-header .close { - margin-top: -2px; -} -.modal-title { - margin: 0; - line-height: 1.42857143; -} -.modal-body { - position: relative; - padding: 15px; -} -.modal-footer { - padding: 15px; - text-align: right; - border-top: 1px solid #e5e5e5; -} -.modal-footer .btn + .btn { - margin-bottom: 0; - margin-left: 5px; -} -.modal-footer .btn-group .btn + .btn { - margin-left: -1px; -} -.modal-footer .btn-block + .btn-block { - margin-left: 0; -} -.modal-scrollbar-measure { - position: absolute; - top: -9999px; - width: 50px; - height: 50px; - overflow: scroll; -} -@media (min-width: 768px) { - .modal-dialog { - width: 600px; - margin: 30px auto; - } - .modal-content { - -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); - } - .modal-sm { - width: 300px; - } -} -@media (min-width: 992px) { - .modal-lg { - width: 900px; - } -} -/* stylelint-disable no-duplicate-selectors */ -.tooltip { - position: absolute; - z-index: 1070; - display: block; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; - font-style: normal; - font-weight: 400; - line-height: 1.42857143; - line-break: auto; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - word-wrap: normal; - white-space: normal; - font-size: 12px; - filter: alpha(opacity=0); - opacity: 0; -} -.tooltip.in { - filter: alpha(opacity=90); - opacity: 0.9; -} -.tooltip.top { - padding: 5px 0; - margin-top: -3px; -} -.tooltip.right { - padding: 0 5px; - margin-left: 3px; -} -.tooltip.bottom { - padding: 5px 0; - margin-top: 3px; -} -.tooltip.left { - padding: 0 5px; - margin-left: -3px; -} -.tooltip-inner { - max-width: 200px; - padding: 3px 8px; - color: #fff; - text-align: center; - background-color: #000; - border-radius: 4px; -} -.tooltip-arrow { - position: absolute; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; -} -.tooltip.top .tooltip-arrow { - bottom: 0; - left: 50%; - margin-left: -5px; - border-width: 5px 5px 0; - border-top-color: #000; -} -.tooltip.top-left .tooltip-arrow { - right: 5px; - bottom: 0; - margin-bottom: -5px; - border-width: 5px 5px 0; - border-top-color: #000; -} -.tooltip.top-right .tooltip-arrow { - bottom: 0; - left: 5px; - margin-bottom: -5px; - border-width: 5px 5px 0; - border-top-color: #000; -} -.tooltip.right .tooltip-arrow { - top: 50%; - left: 0; - margin-top: -5px; - border-width: 5px 5px 5px 0; - border-right-color: #000; -} -.tooltip.left .tooltip-arrow { - top: 50%; - right: 0; - margin-top: -5px; - border-width: 5px 0 5px 5px; - border-left-color: #000; -} -.tooltip.bottom .tooltip-arrow { - top: 0; - left: 50%; - margin-left: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000; -} -.tooltip.bottom-left .tooltip-arrow { - top: 0; - right: 5px; - margin-top: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000; -} -.tooltip.bottom-right .tooltip-arrow { - top: 0; - left: 5px; - margin-top: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000; -} -/* stylelint-disable no-duplicate-selectors */ -.popover { - position: absolute; - top: 0; - left: 0; - z-index: 1060; - display: none; - max-width: 276px; - padding: 1px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; - font-style: normal; - font-weight: 400; - line-height: 1.42857143; - line-break: auto; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - word-wrap: normal; - white-space: normal; - font-size: 14px; - background-color: #fff; - -webkit-background-clip: padding-box; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 6px; - -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -} -.popover.top { - margin-top: -10px; -} -.popover.right { - margin-left: 10px; -} -.popover.bottom { - margin-top: 10px; -} -.popover.left { - margin-left: -10px; -} -.popover > .arrow { - border-width: 11px; -} -.popover > .arrow, -.popover > .arrow::after { - position: absolute; - display: block; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; -} -.popover > .arrow::after { - content: ""; - border-width: 10px; -} -.popover-title { - padding: 8px 14px; - margin: 0; - font-size: 14px; - background-color: #f7f7f7; - border-bottom: 1px solid #ebebeb; - border-radius: 5px 5px 0 0; -} -.popover-content { - padding: 9px 14px; -} -.popover.top > .arrow { - bottom: -11px; - left: 50%; - margin-left: -11px; - border-top-color: #999999; - border-top-color: rgba(0, 0, 0, 0.25); - border-bottom-width: 0; -} -.popover.top > .arrow::after { - bottom: 1px; - margin-left: -10px; - content: " "; - border-top-color: #fff; - border-bottom-width: 0; -} -.popover.right > .arrow { - top: 50%; - left: -11px; - margin-top: -11px; - border-right-color: #999999; - border-right-color: rgba(0, 0, 0, 0.25); - border-left-width: 0; -} -.popover.right > .arrow::after { - bottom: -10px; - left: 1px; - content: " "; - border-right-color: #fff; - border-left-width: 0; -} -.popover.bottom > .arrow { - top: -11px; - left: 50%; - margin-left: -11px; - border-top-width: 0; - border-bottom-color: #999999; - border-bottom-color: rgba(0, 0, 0, 0.25); -} -.popover.bottom > .arrow::after { - top: 1px; - margin-left: -10px; - content: " "; - border-top-width: 0; - border-bottom-color: #fff; -} -.popover.left > .arrow { - top: 50%; - right: -11px; - margin-top: -11px; - border-right-width: 0; - border-left-color: #999999; - border-left-color: rgba(0, 0, 0, 0.25); -} -.popover.left > .arrow::after { - right: 1px; - bottom: -10px; - content: " "; - border-right-width: 0; - border-left-color: #fff; -} -/* stylelint-disable media-feature-name-no-unknown */ -.carousel { - position: relative; -} -.carousel-inner { - position: relative; - width: 100%; - overflow: hidden; -} -.carousel-inner > .item { - position: relative; - display: none; - -webkit-transition: 0.6s ease-in-out left; - -o-transition: 0.6s ease-in-out left; - transition: 0.6s ease-in-out left; -} -.carousel-inner > .item > img, -.carousel-inner > .item > a > img { - line-height: 1; -} -@media all and (transform-3d), (-webkit-transform-3d) { - .carousel-inner > .item { - -webkit-transition: -webkit-transform 0.6s ease-in-out; - -o-transition: -o-transform 0.6s ease-in-out; - transition: transform 0.6s ease-in-out; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - -webkit-perspective: 1000px; - perspective: 1000px; - } - .carousel-inner > .item.next, - .carousel-inner > .item.active.right { - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - left: 0; - } - .carousel-inner > .item.prev, - .carousel-inner > .item.active.left { - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - left: 0; - } - .carousel-inner > .item.next.left, - .carousel-inner > .item.prev.right, - .carousel-inner > .item.active { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - left: 0; - } -} -.carousel-inner > .active, -.carousel-inner > .next, -.carousel-inner > .prev { - display: block; -} -.carousel-inner > .active { - left: 0; -} -.carousel-inner > .next, -.carousel-inner > .prev { - position: absolute; - top: 0; - width: 100%; -} -.carousel-inner > .next { - left: 100%; -} -.carousel-inner > .prev { - left: -100%; -} -.carousel-inner > .next.left, -.carousel-inner > .prev.right { - left: 0; -} -.carousel-inner > .active.left { - left: -100%; -} -.carousel-inner > .active.right { - left: 100%; -} -.carousel-control { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 15%; - font-size: 20px; - color: #fff; - text-align: center; - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); - background-color: rgba(0, 0, 0, 0); - filter: alpha(opacity=50); - opacity: 0.5; -} -.carousel-control.left { - background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); - background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); - background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0.0001))); - background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); - background-repeat: repeat-x; -} -.carousel-control.right { - right: 0; - left: auto; - background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); - background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); - background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.0001)), to(rgba(0, 0, 0, 0.5))); - background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); - background-repeat: repeat-x; -} -.carousel-control:hover, -.carousel-control:focus { - color: #fff; - text-decoration: none; - outline: 0; - filter: alpha(opacity=90); - opacity: 0.9; -} -.carousel-control .icon-prev, -.carousel-control .icon-next, -.carousel-control .glyphicon-chevron-left, -.carousel-control .glyphicon-chevron-right { - position: absolute; - top: 50%; - z-index: 5; - display: inline-block; - margin-top: -10px; -} -.carousel-control .icon-prev, -.carousel-control .glyphicon-chevron-left { - left: 50%; - margin-left: -10px; -} -.carousel-control .icon-next, -.carousel-control .glyphicon-chevron-right { - right: 50%; - margin-right: -10px; -} -.carousel-control .icon-prev, -.carousel-control .icon-next { - width: 20px; - height: 20px; - font-family: serif; - line-height: 1; -} -.carousel-control .icon-prev::before { - content: "\2039"; -} -.carousel-control .icon-next::before { - content: "\203a"; -} -.carousel-indicators { - position: absolute; - bottom: 10px; - left: 50%; - z-index: 15; - width: 60%; - padding-left: 0; - margin-left: -30%; - text-align: center; - list-style: none; -} -.carousel-indicators li { - display: inline-block; - width: 10px; - height: 10px; - margin: 1px; - text-indent: -999px; - cursor: pointer; - background-color: #000 \9; - background-color: rgba(0, 0, 0, 0); - border: 1px solid #fff; - border-radius: 10px; -} -.carousel-indicators .active { - width: 12px; - height: 12px; - margin: 0; - background-color: #fff; -} -.carousel-caption { - position: absolute; - right: 15%; - bottom: 20px; - left: 15%; - z-index: 10; - padding-top: 20px; - padding-bottom: 20px; - color: #fff; - text-align: center; - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); -} -.carousel-caption .btn { - text-shadow: none; -} -@media screen and (min-width: 768px) { - .carousel-control .glyphicon-chevron-left, - .carousel-control .glyphicon-chevron-right, - .carousel-control .icon-prev, - .carousel-control .icon-next { - width: 30px; - height: 30px; - margin-top: -10px; - font-size: 30px; - } - .carousel-control .glyphicon-chevron-left, - .carousel-control .icon-prev { - margin-left: -10px; - } - .carousel-control .glyphicon-chevron-right, - .carousel-control .icon-next { - margin-right: -10px; - } - .carousel-caption { - right: 20%; - left: 20%; - padding-bottom: 30px; - } - .carousel-indicators { - bottom: 20px; - } -} -/* stylelint-disable declaration-no-important */ -.clearfix::before, -.clearfix::after, -.dl-horizontal dd::before, -.dl-horizontal dd::after, -.container::before, -.container::after, -.container-fluid::before, -.container-fluid::after, -.row::before, -.row::after, -.form-horizontal .form-group::before, -.form-horizontal .form-group::after, -.btn-toolbar::before, -.btn-toolbar::after, -.btn-group-vertical > .btn-group::before, -.btn-group-vertical > .btn-group::after, -.nav::before, -.nav::after, -.navbar::before, -.navbar::after, -.navbar-header::before, -.navbar-header::after, -.navbar-collapse::before, -.navbar-collapse::after, -.pager::before, -.pager::after, -.panel-body::before, -.panel-body::after, -.modal-header::before, -.modal-header::after, -.modal-footer::before, -.modal-footer::after { - display: table; - content: " "; -} -.clearfix::after, -.dl-horizontal dd::after, -.container::after, -.container-fluid::after, -.row::after, -.form-horizontal .form-group::after, -.btn-toolbar::after, -.btn-group-vertical > .btn-group::after, -.nav::after, -.navbar::after, -.navbar-header::after, -.navbar-collapse::after, -.pager::after, -.panel-body::after, -.modal-header::after, -.modal-footer::after { - clear: both; -} -.center-block { - display: block; - margin-right: auto; - margin-left: auto; -} -.pull-right { - float: right !important; -} -.pull-left { - float: left !important; -} -.hide { - display: none !important; -} -.show { - display: block !important; -} -.invisible { - visibility: hidden; -} -.text-hide { - font: 0/0 a; - color: transparent; - text-shadow: none; - background-color: transparent; - border: 0; -} -.hidden { - display: none !important; -} -.affix { - position: fixed; -} -/* stylelint-disable declaration-no-important, at-rule-no-vendor-prefix */ -@-ms-viewport { - width: device-width; -} -.visible-xs, -.visible-sm, -.visible-md, -.visible-lg { - display: none !important; -} -.visible-xs-block, -.visible-xs-inline, -.visible-xs-inline-block, -.visible-sm-block, -.visible-sm-inline, -.visible-sm-inline-block, -.visible-md-block, -.visible-md-inline, -.visible-md-inline-block, -.visible-lg-block, -.visible-lg-inline, -.visible-lg-inline-block { - display: none !important; -} -@media (max-width: 767px) { - .visible-xs { - display: block !important; - } - table.visible-xs { - display: table !important; - } - tr.visible-xs { - display: table-row !important; - } - th.visible-xs, - td.visible-xs { - display: table-cell !important; - } -} -@media (max-width: 767px) { - .visible-xs-block { - display: block !important; - } -} -@media (max-width: 767px) { - .visible-xs-inline { - display: inline !important; - } -} -@media (max-width: 767px) { - .visible-xs-inline-block { - display: inline-block !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm { - display: block !important; - } - table.visible-sm { - display: table !important; - } - tr.visible-sm { - display: table-row !important; - } - th.visible-sm, - td.visible-sm { - display: table-cell !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm-block { - display: block !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm-inline { - display: inline !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .visible-sm-inline-block { - display: inline-block !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md { - display: block !important; - } - table.visible-md { - display: table !important; - } - tr.visible-md { - display: table-row !important; - } - th.visible-md, - td.visible-md { - display: table-cell !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md-block { - display: block !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md-inline { - display: inline !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .visible-md-inline-block { - display: inline-block !important; - } -} -@media (min-width: 1200px) { - .visible-lg { - display: block !important; - } - table.visible-lg { - display: table !important; - } - tr.visible-lg { - display: table-row !important; - } - th.visible-lg, - td.visible-lg { - display: table-cell !important; - } -} -@media (min-width: 1200px) { - .visible-lg-block { - display: block !important; - } -} -@media (min-width: 1200px) { - .visible-lg-inline { - display: inline !important; - } -} -@media (min-width: 1200px) { - .visible-lg-inline-block { - display: inline-block !important; - } -} -@media (max-width: 767px) { - .hidden-xs { - display: none !important; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .hidden-sm { - display: none !important; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .hidden-md { - display: none !important; - } -} -@media (min-width: 1200px) { - .hidden-lg { - display: none !important; - } -} -.visible-print { - display: none !important; -} -@media print { - .visible-print { - display: block !important; - } - table.visible-print { - display: table !important; - } - tr.visible-print { - display: table-row !important; - } - th.visible-print, - td.visible-print { - display: table-cell !important; - } -} -.visible-print-block { - display: none !important; -} -@media print { - .visible-print-block { - display: block !important; - } -} -.visible-print-inline { - display: none !important; -} -@media print { - .visible-print-inline { - display: inline !important; - } -} -.visible-print-inline-block { - display: none !important; -} -@media print { - .visible-print-inline-block { - display: inline-block !important; - } -} -@media print { - .hidden-print { - display: none !important; - } -} -/*# sourceMappingURL=bootstrap.css.map */ \ No newline at end of file diff --git a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.eot b/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a4953f..000000000 Binary files a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.svg b/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index 94fb5490a..000000000 --- a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.ttf b/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc609..000000000 Binary files a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.woff b/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e612858f..000000000 Binary files a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.woff2 b/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b54c..000000000 Binary files a/Packages/ohif-design/bootstrap/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ diff --git a/Packages/ohif-design/bootstrap/js/bootstrap.js b/Packages/ohif-design/bootstrap/js/bootstrap.js deleted file mode 100644 index 427ee41bd..000000000 --- a/Packages/ohif-design/bootstrap/js/bootstrap.js +++ /dev/null @@ -1,2390 +0,0 @@ -/*! - * Bootstrap v3.4.0 (http://getbootstrap.com) - * Copyright 2011-2018 Twitter, Inc. - * Licensed under the MIT license - */ - -if (typeof jQuery === 'undefined') { - throw new Error('Bootstrap\'s JavaScript requires jQuery') -} - -+function ($) { - 'use strict'; - var version = $.fn.jquery.split(' ')[0].split('.') - if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) { - throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4') - } -}(jQuery); - -/* ======================================================================== - * Bootstrap: transition.js v3.4.0 - * http://getbootstrap.com/javascript/#transitions - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) - // ============================================================ - - function transitionEnd() { - var el = document.createElement('bootstrap') - - var transEndEventNames = { - WebkitTransition : 'webkitTransitionEnd', - MozTransition : 'transitionend', - OTransition : 'oTransitionEnd otransitionend', - transition : 'transitionend' - } - - for (var name in transEndEventNames) { - if (el.style[name] !== undefined) { - return { end: transEndEventNames[name] } - } - } - - return false // explicit for ie8 ( ._.) - } - - // http://blog.alexmaccaw.com/css-transitions - $.fn.emulateTransitionEnd = function (duration) { - var called = false - var $el = this - $(this).one('bsTransitionEnd', function () { called = true }) - var callback = function () { if (!called) $($el).trigger($.support.transition.end) } - setTimeout(callback, duration) - return this - } - - $(function () { - $.support.transition = transitionEnd() - - if (!$.support.transition) return - - $.event.special.bsTransitionEnd = { - bindType: $.support.transition.end, - delegateType: $.support.transition.end, - handle: function (e) { - if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) - } - } - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: alert.js v3.4.0 - * http://getbootstrap.com/javascript/#alerts - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // ALERT CLASS DEFINITION - // ====================== - - var dismiss = '[data-dismiss="alert"]' - var Alert = function (el) { - $(el).on('click', dismiss, this.close) - } - - Alert.VERSION = '3.4.0' - - Alert.TRANSITION_DURATION = 150 - - Alert.prototype.close = function (e) { - var $this = $(this) - var selector = $this.attr('data-target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - selector = selector === '#' ? [] : selector - var $parent = $(document).find(selector) - - if (e) e.preventDefault() - - if (!$parent.length) { - $parent = $this.closest('.alert') - } - - $parent.trigger(e = $.Event('close.bs.alert')) - - if (e.isDefaultPrevented()) return - - $parent.removeClass('in') - - function removeElement() { - // detach from parent, fire event then clean up data - $parent.detach().trigger('closed.bs.alert').remove() - } - - $.support.transition && $parent.hasClass('fade') ? - $parent - .one('bsTransitionEnd', removeElement) - .emulateTransitionEnd(Alert.TRANSITION_DURATION) : - removeElement() - } - - - // ALERT PLUGIN DEFINITION - // ======================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.alert') - - if (!data) $this.data('bs.alert', (data = new Alert(this))) - if (typeof option == 'string') data[option].call($this) - }) - } - - var old = $.fn.alert - - $.fn.alert = Plugin - $.fn.alert.Constructor = Alert - - - // ALERT NO CONFLICT - // ================= - - $.fn.alert.noConflict = function () { - $.fn.alert = old - return this - } - - - // ALERT DATA-API - // ============== - - $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: button.js v3.4.0 - * http://getbootstrap.com/javascript/#buttons - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // BUTTON PUBLIC CLASS DEFINITION - // ============================== - - var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Button.DEFAULTS, options) - this.isLoading = false - } - - Button.VERSION = '3.4.0' - - Button.DEFAULTS = { - loadingText: 'loading...' - } - - Button.prototype.setState = function (state) { - var d = 'disabled' - var $el = this.$element - var val = $el.is('input') ? 'val' : 'html' - var data = $el.data() - - state += 'Text' - - if (data.resetText == null) $el.data('resetText', $el[val]()) - - // push to event loop to allow forms to submit - setTimeout($.proxy(function () { - $el[val](data[state] == null ? this.options[state] : data[state]) - - if (state == 'loadingText') { - this.isLoading = true - $el.addClass(d).attr(d, d).prop(d, true) - } else if (this.isLoading) { - this.isLoading = false - $el.removeClass(d).removeAttr(d).prop(d, false) - } - }, this), 0) - } - - Button.prototype.toggle = function () { - var changed = true - var $parent = this.$element.closest('[data-toggle="buttons"]') - - if ($parent.length) { - var $input = this.$element.find('input') - if ($input.prop('type') == 'radio') { - if ($input.prop('checked')) changed = false - $parent.find('.active').removeClass('active') - this.$element.addClass('active') - } else if ($input.prop('type') == 'checkbox') { - if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false - this.$element.toggleClass('active') - } - $input.prop('checked', this.$element.hasClass('active')) - if (changed) $input.trigger('change') - } else { - this.$element.attr('aria-pressed', !this.$element.hasClass('active')) - this.$element.toggleClass('active') - } - } - - - // BUTTON PLUGIN DEFINITION - // ======================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.button') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.button', (data = new Button(this, options))) - - if (option == 'toggle') data.toggle() - else if (option) data.setState(option) - }) - } - - var old = $.fn.button - - $.fn.button = Plugin - $.fn.button.Constructor = Button - - - // BUTTON NO CONFLICT - // ================== - - $.fn.button.noConflict = function () { - $.fn.button = old - return this - } - - - // BUTTON DATA-API - // =============== - - $(document) - .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { - var $btn = $(e.target).closest('.btn') - Plugin.call($btn, 'toggle') - if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { - // Prevent double click on radios, and the double selections (so cancellation) on checkboxes - e.preventDefault() - // The target component still receive the focus - if ($btn.is('input,button')) $btn.trigger('focus') - else $btn.find('input:visible,button:visible').first().trigger('focus') - } - }) - .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { - $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: carousel.js v3.4.0 - * http://getbootstrap.com/javascript/#carousel - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // CAROUSEL CLASS DEFINITION - // ========================= - - var Carousel = function (element, options) { - this.$element = $(element) - this.$indicators = this.$element.find('.carousel-indicators') - this.options = options - this.paused = null - this.sliding = null - this.interval = null - this.$active = null - this.$items = null - - this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) - - this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element - .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) - .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) - } - - Carousel.VERSION = '3.4.0' - - Carousel.TRANSITION_DURATION = 600 - - Carousel.DEFAULTS = { - interval: 5000, - pause: 'hover', - wrap: true, - keyboard: true - } - - Carousel.prototype.keydown = function (e) { - if (/input|textarea/i.test(e.target.tagName)) return - switch (e.which) { - case 37: this.prev(); break - case 39: this.next(); break - default: return - } - - e.preventDefault() - } - - Carousel.prototype.cycle = function (e) { - e || (this.paused = false) - - this.interval && clearInterval(this.interval) - - this.options.interval - && !this.paused - && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) - - return this - } - - Carousel.prototype.getItemIndex = function (item) { - this.$items = item.parent().children('.item') - return this.$items.index(item || this.$active) - } - - Carousel.prototype.getItemForDirection = function (direction, active) { - var activeIndex = this.getItemIndex(active) - var willWrap = (direction == 'prev' && activeIndex === 0) - || (direction == 'next' && activeIndex == (this.$items.length - 1)) - if (willWrap && !this.options.wrap) return active - var delta = direction == 'prev' ? -1 : 1 - var itemIndex = (activeIndex + delta) % this.$items.length - return this.$items.eq(itemIndex) - } - - Carousel.prototype.to = function (pos) { - var that = this - var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) - - if (pos > (this.$items.length - 1) || pos < 0) return - - if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" - if (activeIndex == pos) return this.pause().cycle() - - return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) - } - - Carousel.prototype.pause = function (e) { - e || (this.paused = true) - - if (this.$element.find('.next, .prev').length && $.support.transition) { - this.$element.trigger($.support.transition.end) - this.cycle(true) - } - - this.interval = clearInterval(this.interval) - - return this - } - - Carousel.prototype.next = function () { - if (this.sliding) return - return this.slide('next') - } - - Carousel.prototype.prev = function () { - if (this.sliding) return - return this.slide('prev') - } - - Carousel.prototype.slide = function (type, next) { - var $active = this.$element.find('.item.active') - var $next = next || this.getItemForDirection(type, $active) - var isCycling = this.interval - var direction = type == 'next' ? 'left' : 'right' - var that = this - - if ($next.hasClass('active')) return (this.sliding = false) - - var relatedTarget = $next[0] - var slideEvent = $.Event('slide.bs.carousel', { - relatedTarget: relatedTarget, - direction: direction - }) - this.$element.trigger(slideEvent) - if (slideEvent.isDefaultPrevented()) return - - this.sliding = true - - isCycling && this.pause() - - if (this.$indicators.length) { - this.$indicators.find('.active').removeClass('active') - var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) - $nextIndicator && $nextIndicator.addClass('active') - } - - var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" - if ($.support.transition && this.$element.hasClass('slide')) { - $next.addClass(type) - if (typeof $next === 'object' && $next.length) { - $next[0].offsetWidth // force reflow - } - $active.addClass(direction) - $next.addClass(direction) - $active - .one('bsTransitionEnd', function () { - $next.removeClass([type, direction].join(' ')).addClass('active') - $active.removeClass(['active', direction].join(' ')) - that.sliding = false - setTimeout(function () { - that.$element.trigger(slidEvent) - }, 0) - }) - .emulateTransitionEnd(Carousel.TRANSITION_DURATION) - } else { - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger(slidEvent) - } - - isCycling && this.cycle() - - return this - } - - - // CAROUSEL PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.carousel') - var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) - var action = typeof option == 'string' ? option : options.slide - - if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) - if (typeof option == 'number') data.to(option) - else if (action) data[action]() - else if (options.interval) data.pause().cycle() - }) - } - - var old = $.fn.carousel - - $.fn.carousel = Plugin - $.fn.carousel.Constructor = Carousel - - - // CAROUSEL NO CONFLICT - // ==================== - - $.fn.carousel.noConflict = function () { - $.fn.carousel = old - return this - } - - - // CAROUSEL DATA-API - // ================= - - var clickHandler = function (e) { - var $this = $(this) - var href = $this.attr('href') - if (href) { - href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 - } - - var target = $this.attr('data-target') || href - var $target = $(document).find(target) - - if (!$target.hasClass('carousel')) return - - var options = $.extend({}, $target.data(), $this.data()) - var slideIndex = $this.attr('data-slide-to') - if (slideIndex) options.interval = false - - Plugin.call($target, options) - - if (slideIndex) { - $target.data('bs.carousel').to(slideIndex) - } - - e.preventDefault() - } - - $(document) - .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) - .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) - - $(window).on('load', function () { - $('[data-ride="carousel"]').each(function () { - var $carousel = $(this) - Plugin.call($carousel, $carousel.data()) - }) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: collapse.js v3.4.0 - * http://getbootstrap.com/javascript/#collapse - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - -/* jshint latedef: false */ - -+function ($) { - 'use strict'; - - // COLLAPSE PUBLIC CLASS DEFINITION - // ================================ - - var Collapse = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Collapse.DEFAULTS, options) - this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + - '[data-toggle="collapse"][data-target="#' + element.id + '"]') - this.transitioning = null - - if (this.options.parent) { - this.$parent = this.getParent() - } else { - this.addAriaAndCollapsedClass(this.$element, this.$trigger) - } - - if (this.options.toggle) this.toggle() - } - - Collapse.VERSION = '3.4.0' - - Collapse.TRANSITION_DURATION = 350 - - Collapse.DEFAULTS = { - toggle: true - } - - Collapse.prototype.dimension = function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } - - Collapse.prototype.show = function () { - if (this.transitioning || this.$element.hasClass('in')) return - - var activesData - var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') - - if (actives && actives.length) { - activesData = actives.data('bs.collapse') - if (activesData && activesData.transitioning) return - } - - var startEvent = $.Event('show.bs.collapse') - this.$element.trigger(startEvent) - if (startEvent.isDefaultPrevented()) return - - if (actives && actives.length) { - Plugin.call(actives, 'hide') - activesData || actives.data('bs.collapse', null) - } - - var dimension = this.dimension() - - this.$element - .removeClass('collapse') - .addClass('collapsing')[dimension](0) - .attr('aria-expanded', true) - - this.$trigger - .removeClass('collapsed') - .attr('aria-expanded', true) - - this.transitioning = 1 - - var complete = function () { - this.$element - .removeClass('collapsing') - .addClass('collapse in')[dimension]('') - this.transitioning = 0 - this.$element - .trigger('shown.bs.collapse') - } - - if (!$.support.transition) return complete.call(this) - - var scrollSize = $.camelCase(['scroll', dimension].join('-')) - - this.$element - .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) - } - - Collapse.prototype.hide = function () { - if (this.transitioning || !this.$element.hasClass('in')) return - - var startEvent = $.Event('hide.bs.collapse') - this.$element.trigger(startEvent) - if (startEvent.isDefaultPrevented()) return - - var dimension = this.dimension() - - this.$element[dimension](this.$element[dimension]())[0].offsetHeight - - this.$element - .addClass('collapsing') - .removeClass('collapse in') - .attr('aria-expanded', false) - - this.$trigger - .addClass('collapsed') - .attr('aria-expanded', false) - - this.transitioning = 1 - - var complete = function () { - this.transitioning = 0 - this.$element - .removeClass('collapsing') - .addClass('collapse') - .trigger('hidden.bs.collapse') - } - - if (!$.support.transition) return complete.call(this) - - this.$element - [dimension](0) - .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(Collapse.TRANSITION_DURATION) - } - - Collapse.prototype.toggle = function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } - - Collapse.prototype.getParent = function () { - return $(this.options.parent) - .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') - .each($.proxy(function (i, element) { - var $element = $(element) - this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) - }, this)) - .end() - } - - Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { - var isOpen = $element.hasClass('in') - - $element.attr('aria-expanded', isOpen) - $trigger - .toggleClass('collapsed', !isOpen) - .attr('aria-expanded', isOpen) - } - - function getTargetFromTrigger($trigger) { - var href - var target = $trigger.attr('data-target') - || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 - - return $(document).find(target) - } - - - // COLLAPSE PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.collapse') - var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) - - if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false - if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.collapse - - $.fn.collapse = Plugin - $.fn.collapse.Constructor = Collapse - - - // COLLAPSE NO CONFLICT - // ==================== - - $.fn.collapse.noConflict = function () { - $.fn.collapse = old - return this - } - - - // COLLAPSE DATA-API - // ================= - - $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { - var $this = $(this) - - if (!$this.attr('data-target')) e.preventDefault() - - var $target = getTargetFromTrigger($this) - var data = $target.data('bs.collapse') - var option = data ? 'toggle' : $this.data() - - Plugin.call($target, option) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: dropdown.js v3.4.0 - * http://getbootstrap.com/javascript/#dropdowns - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // DROPDOWN CLASS DEFINITION - // ========================= - - var backdrop = '.dropdown-backdrop' - var toggle = '[data-toggle="dropdown"]' - var Dropdown = function (element) { - $(element).on('click.bs.dropdown', this.toggle) - } - - Dropdown.VERSION = '3.4.0' - - function getParent($this) { - var selector = $this.attr('data-target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - var $parent = selector && $(document).find(selector) - - return $parent && $parent.length ? $parent : $this.parent() - } - - function clearMenus(e) { - if (e && e.which === 3) return - $(backdrop).remove() - $(toggle).each(function () { - var $this = $(this) - var $parent = getParent($this) - var relatedTarget = { relatedTarget: this } - - if (!$parent.hasClass('open')) return - - if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return - - $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) - - if (e.isDefaultPrevented()) return - - $this.attr('aria-expanded', 'false') - $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget)) - }) - } - - Dropdown.prototype.toggle = function (e) { - var $this = $(this) - - if ($this.is('.disabled, :disabled')) return - - var $parent = getParent($this) - var isActive = $parent.hasClass('open') - - clearMenus() - - if (!isActive) { - if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { - // if mobile we use a backdrop because click events don't delegate - $(document.createElement('div')) - .addClass('dropdown-backdrop') - .insertAfter($(this)) - .on('click', clearMenus) - } - - var relatedTarget = { relatedTarget: this } - $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) - - if (e.isDefaultPrevented()) return - - $this - .trigger('focus') - .attr('aria-expanded', 'true') - - $parent - .toggleClass('open') - .trigger($.Event('shown.bs.dropdown', relatedTarget)) - } - - return false - } - - Dropdown.prototype.keydown = function (e) { - if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return - - var $this = $(this) - - e.preventDefault() - e.stopPropagation() - - if ($this.is('.disabled, :disabled')) return - - var $parent = getParent($this) - var isActive = $parent.hasClass('open') - - if (!isActive && e.which != 27 || isActive && e.which == 27) { - if (e.which == 27) $parent.find(toggle).trigger('focus') - return $this.trigger('click') - } - - var desc = ' li:not(.disabled):visible a' - var $items = $parent.find('.dropdown-menu' + desc) - - if (!$items.length) return - - var index = $items.index(e.target) - - if (e.which == 38 && index > 0) index-- // up - if (e.which == 40 && index < $items.length - 1) index++ // down - if (!~index) index = 0 - - $items.eq(index).trigger('focus') - } - - - // DROPDOWN PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.dropdown') - - if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) - if (typeof option == 'string') data[option].call($this) - }) - } - - var old = $.fn.dropdown - - $.fn.dropdown = Plugin - $.fn.dropdown.Constructor = Dropdown - - - // DROPDOWN NO CONFLICT - // ==================== - - $.fn.dropdown.noConflict = function () { - $.fn.dropdown = old - return this - } - - - // APPLY TO STANDARD DROPDOWN ELEMENTS - // =================================== - - $(document) - .on('click.bs.dropdown.data-api', clearMenus) - .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) - .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) - .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) - .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: modal.js v3.4.0 - * http://getbootstrap.com/javascript/#modals - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // MODAL CLASS DEFINITION - // ====================== - - var Modal = function (element, options) { - this.options = options - this.$body = $(document.body) - this.$element = $(element) - this.$dialog = this.$element.find('.modal-dialog') - this.$backdrop = null - this.isShown = null - this.originalBodyPad = null - this.scrollbarWidth = 0 - this.ignoreBackdropClick = false - - if (this.options.remote) { - this.$element - .find('.modal-content') - .load(this.options.remote, $.proxy(function () { - this.$element.trigger('loaded.bs.modal') - }, this)) - } - } - - Modal.VERSION = '3.4.0' - - Modal.TRANSITION_DURATION = 300 - Modal.BACKDROP_TRANSITION_DURATION = 150 - - Modal.DEFAULTS = { - backdrop: true, - keyboard: true, - show: true - } - - Modal.prototype.toggle = function (_relatedTarget) { - return this.isShown ? this.hide() : this.show(_relatedTarget) - } - - Modal.prototype.show = function (_relatedTarget) { - var that = this - var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) - - this.$element.trigger(e) - - if (this.isShown || e.isDefaultPrevented()) return - - this.isShown = true - - this.checkScrollbar() - this.setScrollbar() - this.$body.addClass('modal-open') - - this.escape() - this.resize() - - this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) - - this.$dialog.on('mousedown.dismiss.bs.modal', function () { - that.$element.one('mouseup.dismiss.bs.modal', function (e) { - if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true - }) - }) - - this.backdrop(function () { - var transition = $.support.transition && that.$element.hasClass('fade') - - if (!that.$element.parent().length) { - that.$element.appendTo(that.$body) // don't move modals dom position - } - - that.$element - .show() - .scrollTop(0) - - that.adjustDialog() - - if (transition) { - that.$element[0].offsetWidth // force reflow - } - - that.$element.addClass('in') - - that.enforceFocus() - - var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) - - transition ? - that.$dialog // wait for modal to slide in - .one('bsTransitionEnd', function () { - that.$element.trigger('focus').trigger(e) - }) - .emulateTransitionEnd(Modal.TRANSITION_DURATION) : - that.$element.trigger('focus').trigger(e) - }) - } - - Modal.prototype.hide = function (e) { - if (e) e.preventDefault() - - e = $.Event('hide.bs.modal') - - this.$element.trigger(e) - - if (!this.isShown || e.isDefaultPrevented()) return - - this.isShown = false - - this.escape() - this.resize() - - $(document).off('focusin.bs.modal') - - this.$element - .removeClass('in') - .off('click.dismiss.bs.modal') - .off('mouseup.dismiss.bs.modal') - - this.$dialog.off('mousedown.dismiss.bs.modal') - - $.support.transition && this.$element.hasClass('fade') ? - this.$element - .one('bsTransitionEnd', $.proxy(this.hideModal, this)) - .emulateTransitionEnd(Modal.TRANSITION_DURATION) : - this.hideModal() - } - - Modal.prototype.enforceFocus = function () { - $(document) - .off('focusin.bs.modal') // guard against infinite focus loop - .on('focusin.bs.modal', $.proxy(function (e) { - if (document !== e.target && - this.$element[0] !== e.target && - !this.$element.has(e.target).length) { - this.$element.trigger('focus') - } - }, this)) - } - - Modal.prototype.escape = function () { - if (this.isShown && this.options.keyboard) { - this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { - e.which == 27 && this.hide() - }, this)) - } else if (!this.isShown) { - this.$element.off('keydown.dismiss.bs.modal') - } - } - - Modal.prototype.resize = function () { - if (this.isShown) { - $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) - } else { - $(window).off('resize.bs.modal') - } - } - - Modal.prototype.hideModal = function () { - var that = this - this.$element.hide() - this.backdrop(function () { - that.$body.removeClass('modal-open') - that.resetAdjustments() - that.resetScrollbar() - that.$element.trigger('hidden.bs.modal') - }) - } - - Modal.prototype.removeBackdrop = function () { - this.$backdrop && this.$backdrop.remove() - this.$backdrop = null - } - - Modal.prototype.backdrop = function (callback) { - var that = this - var animate = this.$element.hasClass('fade') ? 'fade' : '' - - if (this.isShown && this.options.backdrop) { - var doAnimate = $.support.transition && animate - - this.$backdrop = $(document.createElement('div')) - .addClass('modal-backdrop ' + animate) - .appendTo(this.$body) - - this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { - if (this.ignoreBackdropClick) { - this.ignoreBackdropClick = false - return - } - if (e.target !== e.currentTarget) return - this.options.backdrop == 'static' - ? this.$element[0].focus() - : this.hide() - }, this)) - - if (doAnimate) this.$backdrop[0].offsetWidth // force reflow - - this.$backdrop.addClass('in') - - if (!callback) return - - doAnimate ? - this.$backdrop - .one('bsTransitionEnd', callback) - .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : - callback() - - } else if (!this.isShown && this.$backdrop) { - this.$backdrop.removeClass('in') - - var callbackRemove = function () { - that.removeBackdrop() - callback && callback() - } - $.support.transition && this.$element.hasClass('fade') ? - this.$backdrop - .one('bsTransitionEnd', callbackRemove) - .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : - callbackRemove() - - } else if (callback) { - callback() - } - } - - // these following methods are used to handle overflowing modals - - Modal.prototype.handleUpdate = function () { - this.adjustDialog() - } - - Modal.prototype.adjustDialog = function () { - var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight - - this.$element.css({ - paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', - paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' - }) - } - - Modal.prototype.resetAdjustments = function () { - this.$element.css({ - paddingLeft: '', - paddingRight: '' - }) - } - - Modal.prototype.checkScrollbar = function () { - var fullWindowWidth = window.innerWidth - if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 - var documentElementRect = document.documentElement.getBoundingClientRect() - fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) - } - this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth - this.scrollbarWidth = this.measureScrollbar() - } - - Modal.prototype.setScrollbar = function () { - var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) - this.originalBodyPad = document.body.style.paddingRight || '' - if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) - } - - Modal.prototype.resetScrollbar = function () { - this.$body.css('padding-right', this.originalBodyPad) - } - - Modal.prototype.measureScrollbar = function () { // thx walsh - var scrollDiv = document.createElement('div') - scrollDiv.className = 'modal-scrollbar-measure' - this.$body.append(scrollDiv) - var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth - this.$body[0].removeChild(scrollDiv) - return scrollbarWidth - } - - - // MODAL PLUGIN DEFINITION - // ======================= - - function Plugin(option, _relatedTarget) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.modal') - var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) - - if (!data) $this.data('bs.modal', (data = new Modal(this, options))) - if (typeof option == 'string') data[option](_relatedTarget) - else if (options.show) data.show(_relatedTarget) - }) - } - - var old = $.fn.modal - - $.fn.modal = Plugin - $.fn.modal.Constructor = Modal - - - // MODAL NO CONFLICT - // ================= - - $.fn.modal.noConflict = function () { - $.fn.modal = old - return this - } - - - // MODAL DATA-API - // ============== - - $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { - var $this = $(this) - var href = $this.attr('href') - var target = $this.attr('data-target') || - (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 - - var $target = $(document).find(target) - var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) - - if ($this.is('a')) e.preventDefault() - - $target.one('show.bs.modal', function (showEvent) { - if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown - $target.one('hidden.bs.modal', function () { - $this.is(':visible') && $this.trigger('focus') - }) - }) - Plugin.call($target, option, this) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: tooltip.js v3.4.0 - * http://getbootstrap.com/javascript/#tooltip - * Inspired by the original jQuery.tipsy by Jason Frame - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // TOOLTIP PUBLIC CLASS DEFINITION - // =============================== - - var Tooltip = function (element, options) { - this.type = null - this.options = null - this.enabled = null - this.timeout = null - this.hoverState = null - this.$element = null - this.inState = null - - this.init('tooltip', element, options) - } - - Tooltip.VERSION = '3.4.0' - - Tooltip.TRANSITION_DURATION = 150 - - Tooltip.DEFAULTS = { - animation: true, - placement: 'top', - selector: false, - template: '', - trigger: 'hover focus', - title: '', - delay: 0, - html: false, - container: false, - viewport: { - selector: 'body', - padding: 0 - } - } - - Tooltip.prototype.init = function (type, element, options) { - this.enabled = true - this.type = type - this.$element = $(element) - this.options = this.getOptions(options) - this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) - this.inState = { click: false, hover: false, focus: false } - - if (this.$element[0] instanceof document.constructor && !this.options.selector) { - throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') - } - - var triggers = this.options.trigger.split(' ') - - for (var i = triggers.length; i--;) { - var trigger = triggers[i] - - if (trigger == 'click') { - this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) - } else if (trigger != 'manual') { - var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' - var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' - - this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) - } - } - - this.options.selector ? - (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : - this.fixTitle() - } - - Tooltip.prototype.getDefaults = function () { - return Tooltip.DEFAULTS - } - - Tooltip.prototype.getOptions = function (options) { - options = $.extend({}, this.getDefaults(), this.$element.data(), options) - - if (options.delay && typeof options.delay == 'number') { - options.delay = { - show: options.delay, - hide: options.delay - } - } - - return options - } - - Tooltip.prototype.getDelegateOptions = function () { - var options = {} - var defaults = this.getDefaults() - - this._options && $.each(this._options, function (key, value) { - if (defaults[key] != value) options[key] = value - }) - - return options - } - - Tooltip.prototype.enter = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget).data('bs.' + this.type) - - if (!self) { - self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) - $(obj.currentTarget).data('bs.' + this.type, self) - } - - if (obj instanceof $.Event) { - self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true - } - - if (self.tip().hasClass('in') || self.hoverState == 'in') { - self.hoverState = 'in' - return - } - - clearTimeout(self.timeout) - - self.hoverState = 'in' - - if (!self.options.delay || !self.options.delay.show) return self.show() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'in') self.show() - }, self.options.delay.show) - } - - Tooltip.prototype.isInStateTrue = function () { - for (var key in this.inState) { - if (this.inState[key]) return true - } - - return false - } - - Tooltip.prototype.leave = function (obj) { - var self = obj instanceof this.constructor ? - obj : $(obj.currentTarget).data('bs.' + this.type) - - if (!self) { - self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) - $(obj.currentTarget).data('bs.' + this.type, self) - } - - if (obj instanceof $.Event) { - self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false - } - - if (self.isInStateTrue()) return - - clearTimeout(self.timeout) - - self.hoverState = 'out' - - if (!self.options.delay || !self.options.delay.hide) return self.hide() - - self.timeout = setTimeout(function () { - if (self.hoverState == 'out') self.hide() - }, self.options.delay.hide) - } - - Tooltip.prototype.show = function () { - var e = $.Event('show.bs.' + this.type) - - if (this.hasContent() && this.enabled) { - this.$element.trigger(e) - - var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) - if (e.isDefaultPrevented() || !inDom) return - var that = this - - var $tip = this.tip() - - var tipId = this.getUID(this.type) - - this.setContent() - $tip.attr('id', tipId) - this.$element.attr('aria-describedby', tipId) - - if (this.options.animation) $tip.addClass('fade') - - var placement = typeof this.options.placement == 'function' ? - this.options.placement.call(this, $tip[0], this.$element[0]) : - this.options.placement - - var autoToken = /\s?auto?\s?/i - var autoPlace = autoToken.test(placement) - if (autoPlace) placement = placement.replace(autoToken, '') || 'top' - - $tip - .detach() - .css({ top: 0, left: 0, display: 'block' }) - .addClass(placement) - .data('bs.' + this.type, this) - - this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) - this.$element.trigger('inserted.bs.' + this.type) - - var pos = this.getPosition() - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - - if (autoPlace) { - var orgPlacement = placement - var viewportDim = this.getPosition(this.$viewport) - - placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : - placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : - placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : - placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : - placement - - $tip - .removeClass(orgPlacement) - .addClass(placement) - } - - var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) - - this.applyPlacement(calculatedOffset, placement) - - var complete = function () { - var prevHoverState = that.hoverState - that.$element.trigger('shown.bs.' + that.type) - that.hoverState = null - - if (prevHoverState == 'out') that.leave(that) - } - - $.support.transition && this.$tip.hasClass('fade') ? - $tip - .one('bsTransitionEnd', complete) - .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : - complete() - } - } - - Tooltip.prototype.applyPlacement = function (offset, placement) { - var $tip = this.tip() - var width = $tip[0].offsetWidth - var height = $tip[0].offsetHeight - - // manually read margins because getBoundingClientRect includes difference - var marginTop = parseInt($tip.css('margin-top'), 10) - var marginLeft = parseInt($tip.css('margin-left'), 10) - - // we must check for NaN for ie 8/9 - if (isNaN(marginTop)) marginTop = 0 - if (isNaN(marginLeft)) marginLeft = 0 - - offset.top += marginTop - offset.left += marginLeft - - // $.fn.offset doesn't round pixel values - // so we use setOffset directly with our own function B-0 - $.offset.setOffset($tip[0], $.extend({ - using: function (props) { - $tip.css({ - top: Math.round(props.top), - left: Math.round(props.left) - }) - } - }, offset), 0) - - $tip.addClass('in') - - // check to see if placing tip in new offset caused the tip to resize itself - var actualWidth = $tip[0].offsetWidth - var actualHeight = $tip[0].offsetHeight - - if (placement == 'top' && actualHeight != height) { - offset.top = offset.top + height - actualHeight - } - - var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) - - if (delta.left) offset.left += delta.left - else offset.top += delta.top - - var isVertical = /top|bottom/.test(placement) - var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight - var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' - - $tip.offset(offset) - this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) - } - - Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { - this.arrow() - .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') - .css(isVertical ? 'top' : 'left', '') - } - - Tooltip.prototype.setContent = function () { - var $tip = this.tip() - var title = this.getTitle() - - $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) - $tip.removeClass('fade in top bottom left right') - } - - Tooltip.prototype.hide = function (callback) { - var that = this - var $tip = $(this.$tip) - var e = $.Event('hide.bs.' + this.type) - - function complete() { - if (that.hoverState != 'in') $tip.detach() - if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary. - that.$element - .removeAttr('aria-describedby') - .trigger('hidden.bs.' + that.type) - } - callback && callback() - } - - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - $tip.removeClass('in') - - $.support.transition && $tip.hasClass('fade') ? - $tip - .one('bsTransitionEnd', complete) - .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : - complete() - - this.hoverState = null - - return this - } - - Tooltip.prototype.fixTitle = function () { - var $e = this.$element - if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { - $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') - } - } - - Tooltip.prototype.hasContent = function () { - return this.getTitle() - } - - Tooltip.prototype.getPosition = function ($element) { - $element = $element || this.$element - - var el = $element[0] - var isBody = el.tagName == 'BODY' - - var elRect = el.getBoundingClientRect() - if (elRect.width == null) { - // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 - elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) - } - var isSvg = window.SVGElement && el instanceof window.SVGElement - // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3. - // See https://github.com/twbs/bootstrap/issues/20280 - var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset()) - var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } - var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null - - return $.extend({}, elRect, scroll, outerDims, elOffset) - } - - Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { - return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : - /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } - - } - - Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { - var delta = { top: 0, left: 0 } - if (!this.$viewport) return delta - - var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 - var viewportDimensions = this.getPosition(this.$viewport) - - if (/right|left/.test(placement)) { - var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll - var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight - if (topEdgeOffset < viewportDimensions.top) { // top overflow - delta.top = viewportDimensions.top - topEdgeOffset - } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow - delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset - } - } else { - var leftEdgeOffset = pos.left - viewportPadding - var rightEdgeOffset = pos.left + viewportPadding + actualWidth - if (leftEdgeOffset < viewportDimensions.left) { // left overflow - delta.left = viewportDimensions.left - leftEdgeOffset - } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow - delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset - } - } - - return delta - } - - Tooltip.prototype.getTitle = function () { - var title - var $e = this.$element - var o = this.options - - title = $e.attr('data-original-title') - || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) - - return title - } - - Tooltip.prototype.getUID = function (prefix) { - do prefix += ~~(Math.random() * 1000000) - while (document.getElementById(prefix)) - return prefix - } - - Tooltip.prototype.tip = function () { - if (!this.$tip) { - this.$tip = $(this.options.template) - if (this.$tip.length != 1) { - throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') - } - } - return this.$tip - } - - Tooltip.prototype.arrow = function () { - return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) - } - - Tooltip.prototype.enable = function () { - this.enabled = true - } - - Tooltip.prototype.disable = function () { - this.enabled = false - } - - Tooltip.prototype.toggleEnabled = function () { - this.enabled = !this.enabled - } - - Tooltip.prototype.toggle = function (e) { - var self = this - if (e) { - self = $(e.currentTarget).data('bs.' + this.type) - if (!self) { - self = new this.constructor(e.currentTarget, this.getDelegateOptions()) - $(e.currentTarget).data('bs.' + this.type, self) - } - } - - if (e) { - self.inState.click = !self.inState.click - if (self.isInStateTrue()) self.enter(self) - else self.leave(self) - } else { - self.tip().hasClass('in') ? self.leave(self) : self.enter(self) - } - } - - Tooltip.prototype.destroy = function () { - var that = this - clearTimeout(this.timeout) - this.hide(function () { - that.$element.off('.' + that.type).removeData('bs.' + that.type) - if (that.$tip) { - that.$tip.detach() - } - that.$tip = null - that.$arrow = null - that.$viewport = null - that.$element = null - }) - } - - - // TOOLTIP PLUGIN DEFINITION - // ========================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tooltip') - var options = typeof option == 'object' && option - - if (!data && /destroy|hide/.test(option)) return - if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.tooltip - - $.fn.tooltip = Plugin - $.fn.tooltip.Constructor = Tooltip - - - // TOOLTIP NO CONFLICT - // =================== - - $.fn.tooltip.noConflict = function () { - $.fn.tooltip = old - return this - } - -}(jQuery); - -/* ======================================================================== - * Bootstrap: popover.js v3.4.0 - * http://getbootstrap.com/javascript/#popovers - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // POPOVER PUBLIC CLASS DEFINITION - // =============================== - - var Popover = function (element, options) { - this.init('popover', element, options) - } - - if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') - - Popover.VERSION = '3.4.0' - - Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { - placement: 'right', - trigger: 'click', - content: '', - template: '' - }) - - - // NOTE: POPOVER EXTENDS tooltip.js - // ================================ - - Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) - - Popover.prototype.constructor = Popover - - Popover.prototype.getDefaults = function () { - return Popover.DEFAULTS - } - - Popover.prototype.setContent = function () { - var $tip = this.tip() - var title = this.getTitle() - var content = this.getContent() - - $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) - $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events - this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' - ](content) - - $tip.removeClass('fade top bottom left right in') - - // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do - // this manually by checking the contents. - if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() - } - - Popover.prototype.hasContent = function () { - return this.getTitle() || this.getContent() - } - - Popover.prototype.getContent = function () { - var $e = this.$element - var o = this.options - - return $e.attr('data-content') - || (typeof o.content == 'function' ? - o.content.call($e[0]) : - o.content) - } - - Popover.prototype.arrow = function () { - return (this.$arrow = this.$arrow || this.tip().find('.arrow')) - } - - - // POPOVER PLUGIN DEFINITION - // ========================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.popover') - var options = typeof option == 'object' && option - - if (!data && /destroy|hide/.test(option)) return - if (!data) $this.data('bs.popover', (data = new Popover(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.popover - - $.fn.popover = Plugin - $.fn.popover.Constructor = Popover - - - // POPOVER NO CONFLICT - // =================== - - $.fn.popover.noConflict = function () { - $.fn.popover = old - return this - } - -}(jQuery); - -/* ======================================================================== - * Bootstrap: scrollspy.js v3.4.0 - * http://getbootstrap.com/javascript/#scrollspy - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // SCROLLSPY CLASS DEFINITION - // ========================== - - function ScrollSpy(element, options) { - this.$body = $(document.body) - this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) - this.options = $.extend({}, ScrollSpy.DEFAULTS, options) - this.selector = (this.options.target || '') + ' .nav li > a' - this.offsets = [] - this.targets = [] - this.activeTarget = null - this.scrollHeight = 0 - - this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) - this.refresh() - this.process() - } - - ScrollSpy.VERSION = '3.4.0' - - ScrollSpy.DEFAULTS = { - offset: 10 - } - - ScrollSpy.prototype.getScrollHeight = function () { - return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) - } - - ScrollSpy.prototype.refresh = function () { - var that = this - var offsetMethod = 'offset' - var offsetBase = 0 - - this.offsets = [] - this.targets = [] - this.scrollHeight = this.getScrollHeight() - - if (!$.isWindow(this.$scrollElement[0])) { - offsetMethod = 'position' - offsetBase = this.$scrollElement.scrollTop() - } - - this.$body - .find(this.selector) - .map(function () { - var $el = $(this) - var href = $el.data('target') || $el.attr('href') - var $href = /^#./.test(href) && $(href) - - return ($href - && $href.length - && $href.is(':visible') - && [[$href[offsetMethod]().top + offsetBase, href]]) || null - }) - .sort(function (a, b) { return a[0] - b[0] }) - .each(function () { - that.offsets.push(this[0]) - that.targets.push(this[1]) - }) - } - - ScrollSpy.prototype.process = function () { - var scrollTop = this.$scrollElement.scrollTop() + this.options.offset - var scrollHeight = this.getScrollHeight() - var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() - var offsets = this.offsets - var targets = this.targets - var activeTarget = this.activeTarget - var i - - if (this.scrollHeight != scrollHeight) { - this.refresh() - } - - if (scrollTop >= maxScroll) { - return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) - } - - if (activeTarget && scrollTop < offsets[0]) { - this.activeTarget = null - return this.clear() - } - - for (i = offsets.length; i--;) { - activeTarget != targets[i] - && scrollTop >= offsets[i] - && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) - && this.activate(targets[i]) - } - } - - ScrollSpy.prototype.activate = function (target) { - this.activeTarget = target - - this.clear() - - var selector = this.selector + - '[data-target="' + target + '"],' + - this.selector + '[href="' + target + '"]' - - var active = $(selector) - .parents('li') - .addClass('active') - - if (active.parent('.dropdown-menu').length) { - active = active - .closest('li.dropdown') - .addClass('active') - } - - active.trigger('activate.bs.scrollspy') - } - - ScrollSpy.prototype.clear = function () { - $(this.selector) - .parentsUntil(this.options.target, '.active') - .removeClass('active') - } - - - // SCROLLSPY PLUGIN DEFINITION - // =========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.scrollspy') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.scrollspy - - $.fn.scrollspy = Plugin - $.fn.scrollspy.Constructor = ScrollSpy - - - // SCROLLSPY NO CONFLICT - // ===================== - - $.fn.scrollspy.noConflict = function () { - $.fn.scrollspy = old - return this - } - - - // SCROLLSPY DATA-API - // ================== - - $(window).on('load.bs.scrollspy.data-api', function () { - $('[data-spy="scroll"]').each(function () { - var $spy = $(this) - Plugin.call($spy, $spy.data()) - }) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: tab.js v3.4.0 - * http://getbootstrap.com/javascript/#tabs - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // TAB CLASS DEFINITION - // ==================== - - var Tab = function (element) { - // jscs:disable requireDollarBeforejQueryAssignment - this.element = $(element) - // jscs:enable requireDollarBeforejQueryAssignment - } - - Tab.VERSION = '3.4.0' - - Tab.TRANSITION_DURATION = 150 - - Tab.prototype.show = function () { - var $this = this.element - var $ul = $this.closest('ul:not(.dropdown-menu)') - var selector = $this.data('target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - if ($this.parent('li').hasClass('active')) return - - var $previous = $ul.find('.active:last a') - var hideEvent = $.Event('hide.bs.tab', { - relatedTarget: $this[0] - }) - var showEvent = $.Event('show.bs.tab', { - relatedTarget: $previous[0] - }) - - $previous.trigger(hideEvent) - $this.trigger(showEvent) - - if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return - - var $target = $(document).find(selector) - - this.activate($this.closest('li'), $ul) - this.activate($target, $target.parent(), function () { - $previous.trigger({ - type: 'hidden.bs.tab', - relatedTarget: $this[0] - }) - $this.trigger({ - type: 'shown.bs.tab', - relatedTarget: $previous[0] - }) - }) - } - - Tab.prototype.activate = function (element, container, callback) { - var $active = container.find('> .active') - var transition = callback - && $.support.transition - && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) - - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', false) - - element - .addClass('active') - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) - - if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') - } - - if (element.parent('.dropdown-menu').length) { - element - .closest('li.dropdown') - .addClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) - } - - callback && callback() - } - - $active.length && transition ? - $active - .one('bsTransitionEnd', next) - .emulateTransitionEnd(Tab.TRANSITION_DURATION) : - next() - - $active.removeClass('in') - } - - - // TAB PLUGIN DEFINITION - // ===================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tab') - - if (!data) $this.data('bs.tab', (data = new Tab(this))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.tab - - $.fn.tab = Plugin - $.fn.tab.Constructor = Tab - - - // TAB NO CONFLICT - // =============== - - $.fn.tab.noConflict = function () { - $.fn.tab = old - return this - } - - - // TAB DATA-API - // ============ - - var clickHandler = function (e) { - e.preventDefault() - Plugin.call($(this), 'show') - } - - $(document) - .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) - .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: affix.js v3.4.0 - * http://getbootstrap.com/javascript/#affix - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // AFFIX CLASS DEFINITION - // ====================== - - var Affix = function (element, options) { - this.options = $.extend({}, Affix.DEFAULTS, options) - - this.$target = $(this.options.target) - .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) - .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) - - this.$element = $(element) - this.affixed = null - this.unpin = null - this.pinnedOffset = null - - this.checkPosition() - } - - Affix.VERSION = '3.4.0' - - Affix.RESET = 'affix affix-top affix-bottom' - - Affix.DEFAULTS = { - offset: 0, - target: window - } - - Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - var targetHeight = this.$target.height() - - if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false - - if (this.affixed == 'bottom') { - if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' - return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' - } - - var initializing = this.affixed == null - var colliderTop = initializing ? scrollTop : position.top - var colliderHeight = initializing ? targetHeight : height - - if (offsetTop != null && scrollTop <= offsetTop) return 'top' - if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' - - return false - } - - Affix.prototype.getPinnedOffset = function () { - if (this.pinnedOffset) return this.pinnedOffset - this.$element.removeClass(Affix.RESET).addClass('affix') - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - return (this.pinnedOffset = position.top - scrollTop) - } - - Affix.prototype.checkPositionWithEventLoop = function () { - setTimeout($.proxy(this.checkPosition, this), 1) - } - - Affix.prototype.checkPosition = function () { - if (!this.$element.is(':visible')) return - - var height = this.$element.height() - var offset = this.options.offset - var offsetTop = offset.top - var offsetBottom = offset.bottom - var scrollHeight = Math.max($(document).height(), $(document.body).height()) - - if (typeof offset != 'object') offsetBottom = offsetTop = offset - if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) - if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) - - var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) - - if (this.affixed != affix) { - if (this.unpin != null) this.$element.css('top', '') - - var affixType = 'affix' + (affix ? '-' + affix : '') - var e = $.Event(affixType + '.bs.affix') - - this.$element.trigger(e) - - if (e.isDefaultPrevented()) return - - this.affixed = affix - this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null - - this.$element - .removeClass(Affix.RESET) - .addClass(affixType) - .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') - } - - if (affix == 'bottom') { - this.$element.offset({ - top: scrollHeight - height - offsetBottom - }) - } - } - - - // AFFIX PLUGIN DEFINITION - // ======================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.affix') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.affix', (data = new Affix(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.affix - - $.fn.affix = Plugin - $.fn.affix.Constructor = Affix - - - // AFFIX NO CONFLICT - // ================= - - $.fn.affix.noConflict = function () { - $.fn.affix = old - return this - } - - - // AFFIX DATA-API - // ============== - - $(window).on('load', function () { - $('[data-spy="affix"]').each(function () { - var $spy = $(this) - var data = $spy.data() - - data.offset = data.offset || {} - - if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom - if (data.offsetTop != null) data.offset.top = data.offsetTop - - Plugin.call($spy, data) - }) - }) - -}(jQuery); diff --git a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.html b/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.html deleted file mode 100644 index e75572d7d..000000000 --- a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.html +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.js b/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.js deleted file mode 100644 index 721d329af..000000000 --- a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.js +++ /dev/null @@ -1,46 +0,0 @@ -Template.roundedButtonGroup.onCreated(() => { - const instance = Template.instance(); - const reactiveValue = instance.data.value; - - // Get the value for ReactiveVar or ReactiveDict objects - instance.getValue = () => { - return reactiveValue.get(instance.data.key); - }; - - // Set the value for ReactiveVar or ReactiveDict objects - instance.setValue = value => { - const args = [value]; - if (reactiveValue instanceof ReactiveDict) { - args.unshift(instance.data.key); - } - - reactiveValue.set(...args); - }; - - // Initialize the value with the first option if there's no value set and options are not toggleable - if (!instance.getValue() && !instance.data.toggleable) { - instance.setValue(instance.data.options[0].value); - } -}); - -Template.roundedButtonGroup.events({ - 'click [data-value]'(event, instance) { - event.preventDefault(); - const $target = $(event.currentTarget); - - // Stop here if the tool is disabled - if ($target.hasClass('disabled')) { - return; - } - - const nullValue = $target.hasClass('active') && instance.data.toggleable; - const value = nullValue ? null : $target.attr('data-value'); - instance.setValue(value); - } -}); - -Template.roundedButtonGroup.helpers({ - getValue() { - return Template.instance().getValue(); - } -}); diff --git a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.styl b/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.styl deleted file mode 100644 index 250b166ea..000000000 --- a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.styl +++ /dev/null @@ -1,81 +0,0 @@ -@import "{ohif:design}/app" - -$height = 25px - -.roundedButtonGroup - position: relative - z-index: 0 - - .roundedButtonWrapper - cursor: pointer - display: inline-block - float: left - margin-left: -2px - text-decoration: none - text-align: center - - &.disabled - opacity: 0.5 - cursor: not-allowed - - .roundedButton - align-items: center - theme('background-color', '$uiGrayDark') - theme('border', '2px solid $uiBorderColorDark') - theme('color', '$textSecondaryColor') - display: flex - font-size: 11px - font-weight: 500 - justify-content: center - height: $height - line-height: $height - padding: 0 22px - position: relative - text-transform: uppercase - transition($sidebarTransition) - z-index: 1 - - svg - theme('fill', '$defaultColor') - theme('stroke', '$defaultColor') - - svg - span - margin: 0 2px - - i - line-height: 15px - font-size: 15px - - .bottomLabel - theme('color', '$textSecondaryColor') - font-size: 12px - font-weight: 500 - line-height: 12px - margin-top: 8px - - &:first-child - margin-left: 0 - .roundedButton - border-bottom-left-radius: $height - border-top-left-radius: $height - - &:last-child .roundedButton - border-bottom-right-radius: $height - border-top-right-radius: $height - - &:hover .roundedButton - theme('color', '$uiGrayDark') - theme('background-color', '$boxBackgroundColor') - - &.active .roundedButton - theme('background-color', '$activeColor') - theme('border-color', '$uiBorderColorActive') - theme('color', '$uiGrayDark') - z-index: 2 - - &:hover .roundedButton - &.active .roundedButton - svg - theme('fill', '$uiGrayDark') - theme('stroke', '$uiGrayDark') diff --git a/Packages/ohif-design/package.js b/Packages/ohif-design/package.js deleted file mode 100644 index 88fd0e93a..000000000 --- a/Packages/ohif-design/package.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Manually including bootstrap to avoid XSS attacks on data-target attributes - * Issue reference: https://github.com/twbs/bootstrap/issues/20184 - * - * As Bootstrap 3 is no longer being officially developed or supported, they created a branch on - * the official repository that contains the fix for the XSS attacks - * Branch: https://github.com/twbs/bootstrap/tree/v3.4.0-dev - * - * We stopped using the Meteor's twbs:bootstrap package and started adding the files manually - */ - -Package.describe({ - name: 'ohif:design', - summary: 'OHIF Design styles and components', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('standard-app-packages'); - api.use('jquery'); - api.use('stylus'); - - api.use('ohif:themes'); - - // Bootstrap fonts - api.addAssets([ - 'bootstrap/fonts/glyphicons-halflings-regular.eot', - 'bootstrap/fonts/glyphicons-halflings-regular.svg', - 'bootstrap/fonts/glyphicons-halflings-regular.ttf', - 'bootstrap/fonts/glyphicons-halflings-regular.woff', - 'bootstrap/fonts/glyphicons-halflings-regular.woff2' - ], 'client'); - - api.addAssets('assets/theme-icons.png', 'client'); - - // Bootstrap files - api.addFiles([ - 'bootstrap/css/bootstrap.css', - 'bootstrap/js/bootstrap.js' - ], 'client'); - - // Importable colors / typography settings - api.addFiles([ - 'app.styl', - 'styles/imports/mixins.styl', - 'styles/imports/spacings.styl', - 'styles/imports/variables.styl', - 'styles/imports/theming.styl', - 'styles/imports/theme-icons.styl' - ], 'client', { - isImport: true - }); - - // Common styles - api.addFiles([ - 'styles/common/webfonts.styl', - 'styles/common/keyframes.styl', - 'styles/common/global.styl', - 'styles/common/form.styl', - 'styles/common/spacings.styl' - ], 'client'); - - // Component styles - api.addFiles([ - 'styles/components/dialog.styl', - 'styles/components/popover.styl', - 'styles/components/radio.styl', - 'styles/components/select2.styl', - 'styles/components/states.styl' - ], 'client'); - - // Rounded Button Group - api.addFiles([ - 'components/roundedButtonGroup/roundedButtonGroup.html', - 'components/roundedButtonGroup/roundedButtonGroup.styl', - 'components/roundedButtonGroup/roundedButtonGroup.js' - ], 'client'); -}); diff --git a/Packages/ohif-design/styles/common/form.styl b/Packages/ohif-design/styles/common/form.styl deleted file mode 100644 index 2a74c83a3..000000000 --- a/Packages/ohif-design/styles/common/form.styl +++ /dev/null @@ -1,94 +0,0 @@ -@import "{ohif:design}/app" - -label.wrapperLabel - cursor: pointer - -label.wrapperLabel:not(.checkboxLabel) - cursor: pointer - display: flex - flex-direction: column - - .wrapperText - display: block - order: -1 - transition(color 0.3s ease) - -.form-themed - - .btn, input[type=text], input[type=password], input[type=number] - - &[disabled], &.disabled - - &, &:hover, &:active - theme('background-color', '$uiGrayDarker') - theme('border-color', '$uiGrayLight') - theme('color', '$textPrimaryColor') - - & + .wrapperText - theme('color', '$textPrimaryColor') - cursor: auto - - input[type=text], input[type=password], input[type=number] - theme('background-color', '$uiGray') - theme('border-color', '$uiBorderColor') - theme('color', '$textPrimaryColor') - font-weight: normal - transition(background-color 0.3s ease\, border-color 0.3s ease) - - &:active, &:focus - theme('background-color', '$uiGrayDark') - theme('border-color', '$activeColor') - box-shadow: none - - & + .wrapperText - theme('color', '$activeColor') - - .btn-primary - theme('background-color', '$activeColor') - theme('border-color', '$uiBorderColorActive') - theme('color', '$textColorActive') - transition(background-color 0.3s ease\, border-color 0.3s ease) - - &:hover, &:active, &:focus, &:focus:active - theme('background-color', '$activeColor', 0.8) - theme('border-color', '$uiBorderColorActive', 0.8) - theme('color', '$textColorActive') - - span.select2.select2-container - width: 100% !important - - span.select2-selection - color: rgba(255, 255, 255, 0.52) - background-color: #2c353f - - span.select2-selection__arrow - theme('background-color', '$uiGray') - - &:hover, &:focus - span.select2-selection__arrow - theme('background-color', '$uiGray') - theme('color', '$textPrimaryColor') - - span.select2-selection__rendered - theme('color', '$textPrimaryColor') - font-size: 14px - - &.select2-container--open span.select2-selection span.select2-selection__arrow - theme('background-color', '$uiGrayDark') - theme('color', '$textPrimaryColor') - - .form-control - background-color: #FFFFFF - border: 0 - border-radius(2px) - font-size: 14px - height: 30px - line-height: 16px - padding: 8px 9px 6px - - &:focus - theme('box-shadow', '0 0 0 2px $activeColor !important') - - .form-themed .form-control - theme('box-shadow', '0 0 0 1px $uiBorderColor') - diff --git a/Packages/ohif-design/styles/common/global.styl b/Packages/ohif-design/styles/common/global.styl deleted file mode 100644 index daa42ad36..000000000 --- a/Packages/ohif-design/styles/common/global.styl +++ /dev/null @@ -1,356 +0,0 @@ -@import '{ohif:design}/app' - -html body - theme('background-color', '$primaryBackgroundColor') - font-family: 'Roboto', 'OpenSans', 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif - -webkit-backface-visibility: hidden // Prevent Chrome from shifting parent elements on transform - font-family: Roboto - -html body.stretch - height: 100% - min-width: 0 - overflow: hidden - position: fixed - width: 100% - -html hr - theme('border-top', '1px solid $uiBorderColor') - -body .table > thead > tr > th - theme('border-color', '$uiBorderColor') - -body ol - margin: 0 - padding-left: 1em - -// This is needed for IE11 because svgxuse doesn't allow the browser to capture mouse events on SVG -svg, use - pointer-events: none - -input::-ms-clear - display: none - -label.form-group - width: 100% - - &>span.select2 - display: block - width: 100% !important - - span.select2-selection - min-height: 34px - - span.select2-selection__rendered - height: 34px - line-height: 34px - - span.select2-selection__arrow - height: 34px - -.select-small+span.select2.select2-container span.select2-selection - height: 20px - - span.select2-selection__rendered - height: 20px - line-height: 20px - padding-left: 5px - padding-right: 17px - - span.select2-selection__arrow - height: 20px - width: 12px - - &:after - font-size: 12px - height: 20px - line-height: 20px - width: 12px - -.select2-container-nowrap - - .select2-dropdown - display: table - - .select2-results__options li - white-space: nowrap - -body .select2-container--default .select2-results>.select2-results__options - max-height: 320px - -.center-table - display: table - margin-left: auto - margin-right: auto - -.height-auto - height: auto !important - -.caret-down - display: inline-block - width: 0 - height: 0 - margin-top: .5rem - border-top: 5px solid - border-right: 5px solid transparent - border-left: 5px solid transparent - -.noselect - -webkit-touch-callout: none - -webkit-user-select: none - -khtml-user-select: none - -moz-user-select: none - -ms-user-select: none - user-select: none - -.btn - transition(background-color 0.3s ease) - -.modal-dialog - .modal-content - theme('background-color', '$uiGrayDarker') - theme('border-color', '$uiBorderColor') - theme('color', '$textSecondaryColor') - border-radius(6px) - border: 0 - - .modal-header, .modal-footer - theme('border-color', '$uiBorderColor') - - .dialog-separator, - .dialog-separator-before, - .dialog-separator-after - position: relative - - .dialog-separator:before, - .dialog-separator:after, - .dialog-separator-before:before, - .dialog-separator-after:after - background-color: #000000 - box-shadow(-50px 0 0 #000000\, 50px 0 0 #000000) - content: ' ' - display: block - height: 3px - left: 0 - position: absolute - width: 100% - - .dialog-separator:before, - .dialog-separator-before:before - top: -3px - - .dialog-separator:after, - .dialog-separator-after:after - bottom: -3px - - .modal-body - theme('color', '$textPrimaryColor') - padding: 16px 22px 25px - position: relative - - .modal-header - border-bottom-width: 3px - border-bottom-style: solid - border-bottom-color: #000000 - padding: 19px 22px 17px - position: relative - - h4 - theme('color', '$textSecondaryColor') - font-size: 20px - font-weight: 500 - line-height: 24px - padding-right: 24px - - .modal-footer - border-top: 0 - - .card-round - theme('background-color', '$uiGrayDark') - border-radius(5px) - padding: 10px - - .modal-header - position: relative - - button.close - position: absolute - right: 21px - top: 50% - transform(translateY(-50%)) - transition(color 0.3s ease) - -.button-close, .modal-dialog button.close - theme('color', '$textSecondaryColor') - height: 20px - opacity: 1 - overflow: hidden - padding: 2px - text-align: center - text-shadow: none - width: 20px - - &:hover span - &:before, &:after - theme('background-color', '$textPrimaryColor') - - &:active span - &:before, &:after - theme('background-color', '$activeColor') - - span - color: transparent - display: block - font-size: 0 - height: 100% - line-height: 0 - overflow: hidden - position: relative - width: 100% - - &:before, &:after - theme('background-color', '$textSecondaryColor') - content: ' ' - display: block - height: 2px - transition(background-color 0.3s ease) - width: 19px - - &:before - left: 1px - position: absolute - top: 1px - transform(rotate(45deg)) - transform-origin(1px 50%) - - &:after - right: 1px - position: absolute - top: 1px - transform(rotate(-45deg)) - transform-origin(calc(100% - 1px) 50%) - -.full-width - width: 100% - -.full-height - height: 100% - -.flex-h - display: flex - flex-direction: row - -.flex-v - display: flex - flex-direction: column - -.flex-grow - flex-grow: 1 - -.nowrap - white-space: nowrap - -.themed - table - theme('color', '$textPrimaryColor') - - th, td - font-size: 15px - font-weight: normal - - th - line-height: 60px - - td - line-height: 18px - - .btn - border: 0 - border-radius(4px) - font-size: 15px - font-weight: normal - height: 37px - line-height: 37px - padding: 0 12px - - &.btn-primary, &.btn-secondary - color: #000000 - - &:hover, &:active, &:focus, &:focus:active - color: #000000 - - &.btn-primary, &.btn-secondary, &.btn-danger - transition(background-color 0.3s ease) - - &.btn-primary - theme('background-color', '$activeColor') - - &:hover, &:active, &:focus, &:focus:active - theme('background-color', '$activeColor', 0.8) - - &.btn-secondary - theme('background-color', '$textSecondaryColor') - - &:hover, &:active, &:focus, &:focus:active - theme('background-color', '$textSecondaryColor', 0.8) - - &.btn-danger - theme('background-color', '$destructiveColor') - theme('color', '$textPrimaryColor') - - &:hover, &:active, &:focus, &:focus:active - theme('color', '$textPrimaryColor') - theme('background-color', '$destructiveColor', 0.8) - - &.active - box-shadow(inset 1px 1px 2px rgba(0, 0, 0, 0.5)) - - .wrapperLabel .wrapperText - theme('color', '$textPrimaryColor') - font-size: 14px - font-weight: bold - line-height: 16px - - &:not(:empty) - margin-bottom: 13px - - .nav-tabs - border-bottom: 0 - margin-bottom: 3px - position: relative - z-index: 1 - - &>li - font-size: 14px - font-weight: normal - height: 40px - line-height: 40px - margin-bottom: 0 - - &>a - display: block - width: 100% - line-height: inherit - margin: 0 - height: inherit - padding: 0 10px 0 10px - - &:after - background-color: transparent - bottom: -3px - content: ' ' - display: block - height: 3px - transition(background-color 0.3s ease) - width: 100% - - &>a, &.active>a - &, &:hover, &:active, &:focus - theme('color', '$activeColor') - background-color: transparent - border: 0 - - &.active>a - font-weight: bold - - &:after - theme('background-color', '$activeColor') diff --git a/Packages/ohif-design/styles/common/keyframes.styl b/Packages/ohif-design/styles/common/keyframes.styl deleted file mode 100644 index e25297f85..000000000 --- a/Packages/ohif-design/styles/common/keyframes.styl +++ /dev/null @@ -1,45 +0,0 @@ -@import "{ohif:design}/app" - -@keyframes zoomIn - 0% - transform(scale(0)) - 100% - transform(scale(1)) - -@keyframes zoomOut - 0% - transform(scale(1)) - 100% - transform(scale(0)) - -@keyframes slideInDown - 0% - opacity: 0 - transform(translateY(-100%) scale(0)) - 100% - opacity: 1 - transform(translateY(0) scale(1)) - -@keyframes slideOutUp - 0% - opacity: 1 - transform(translateY(0) scale(1)) - 100% - opacity: 0 - transform(translateY(-100%) scale(0)) - -@keyframes fadeIn - from - opacity: 0 - visibility: hidden - to - opacity: 1 - visibility: visible - -@keyframes fadeOut - from - opacity: 1 - visibility: visible - to - opacity: 0 - visibility: hidden diff --git a/Packages/ohif-design/styles/common/spacings.styl b/Packages/ohif-design/styles/common/spacings.styl deleted file mode 100644 index a6044f86a..000000000 --- a/Packages/ohif-design/styles/common/spacings.styl +++ /dev/null @@ -1,31 +0,0 @@ -@import "{ohif:design}/app" - -generateSpacings('', $spacer-x, $spacer-y) - -.m-x-auto - margin-left: auto !important - margin-right: auto !important - -// MIN WIDTH 1920 -generateSpacings('r', $spacer-x, $spacer-y) - -@media screen and (min-width: 1600px) and (max-width: 1919px) - generateSpacings('r', ($spacer-x * 0.9), ($spacer-y * 0.9)) - -@media screen and (min-width: 1440px) and (max-width: 1599px) - generateSpacings('r', ($spacer-x * 0.8), ($spacer-y * 0.8)) - -@media screen and (min-width: 1360px) and (max-width: 1439px) - generateSpacings('r', ($spacer-x * 0.7), ($spacer-y * 0.7)) - -@media screen and (min-width: 1280px) and (max-width: 1359px) - generateSpacings('r', ($spacer-x * 0.6), ($spacer-y * 0.6)) - -@media screen and (min-width: 1152px) and (max-width: 1279px) - generateSpacings('r', ($spacer-x * 0.5), ($spacer-y * 0.5)) - -@media screen and (min-width: 1024px) and (max-width: 1151px) - generateSpacings('r', ($spacer-x * 0.4), ($spacer-y * 0.4)) - -@media screen and (max-width: 1023px) - generateSpacings('r', ($spacer-x * 0.3), ($spacer-y * 0.3)) diff --git a/Packages/ohif-design/styles/common/webfonts.styl b/Packages/ohif-design/styles/common/webfonts.styl deleted file mode 100644 index 9a9753741..000000000 --- a/Packages/ohif-design/styles/common/webfonts.styl +++ /dev/null @@ -1,4 +0,0 @@ -// TODO: Find out why Meteor is complaining about these? -// Replaced them with 's in the HEAD.html of each application, for now. -//@import url(http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic&subset=latin,latin-ext) -//@import url(http://fonts.googleapis.com/css?family=Sanchez:400,700&subset=latin,latin-ext) diff --git a/Packages/ohif-design/styles/components/dialog.styl b/Packages/ohif-design/styles/components/dialog.styl deleted file mode 100644 index a753c6712..000000000 --- a/Packages/ohif-design/styles/components/dialog.styl +++ /dev/null @@ -1,11 +0,0 @@ -@import "{ohif:design}/app" - -.viewerDialogs>.dialog-animated - &:not(.dialog-closed):not(.dialog-open) - display: none - - &.dialog-closed - animateFadeOut() - - &.dialog-open - animateFadeIn() diff --git a/Packages/ohif-design/styles/components/popover.styl b/Packages/ohif-design/styles/components/popover.styl deleted file mode 100644 index 65600cbc7..000000000 --- a/Packages/ohif-design/styles/components/popover.styl +++ /dev/null @@ -1,21 +0,0 @@ -@require '{ohif:design}/app' - -div.popover - theme('background-color', '$uiGray') - theme('color', '$textPrimaryColor') - - .popover-title - theme('background-color', '$uiGrayDark') - theme('border-bottom-color', '$uiGrayDarkest') - - &.top .arrow:after - theme('border-top-color', '$uiGray') - - &.right .arrow:after - theme('border-right-color', '$uiGray') - - &.bottom .arrow:after - theme('border-bottom-color', '$uiGray') - - &.left .arrow:after - theme('border-left-color', '$uiGray') diff --git a/Packages/ohif-design/styles/components/radio.styl b/Packages/ohif-design/styles/components/radio.styl deleted file mode 100644 index c776eb1bd..000000000 --- a/Packages/ohif-design/styles/components/radio.styl +++ /dev/null @@ -1,39 +0,0 @@ -@import "{ohif:design}/app" - -.group-radio - label - cursor: pointer - - input - display: none - - span - padding-left: 23px - position: relative - &:before - background: white - border-radius: 8px - content: '' - display: block - height: 16px - left: 0 - position: absolute - top: 50% - transform(translateY(-50%)) - width: 16px - - input:focus + span:before - // TODO: [design] define a outline for the design - theme('box-shadow', '0 0 2px 2px $textSecondaryColor') - outline: none - - input:checked + span:after - theme('background', '$uiBorderColorDark') - border-radius: 5px - content: '' - height: 10px - left: 3px - position: absolute - top: 50% - transform(translateY(-50%)) - width: 10px diff --git a/Packages/ohif-design/styles/components/select2.styl b/Packages/ohif-design/styles/components/select2.styl deleted file mode 100644 index 67f2d474a..000000000 --- a/Packages/ohif-design/styles/components/select2.styl +++ /dev/null @@ -1,70 +0,0 @@ -@import "{ohif:design}/app" - -// TODO: [design] can't we use colors that are already in common pallete? -$gray1 = #C3C3C3 -$gray2 = #B6B6B6 -$gray3 = #A6A6A6 -$gray4 = #676767 -$gray5 = #3E3E3E -$borderRadius = 2px - -span.select2.select2-container - font-weight: normal - - span.select2-selection - &:hover, &:focus - span.select2-selection__arrow - background-color: $gray3 - - span.select2-selection - border: 0 - border-radius: $borderRadius - - &, span.select2-selection__rendered, span.select2-selection__arrow - height: 30px - - span.select2-selection__rendered - line-height: 34px - padding-left: 11px - - span.select2-selection__arrow - theme('border-left', '1px solid $primaryBackgroundColor') - background-color: $gray1 - border-top-right-radius: $borderRadius - border-bottom-right-radius: $borderRadius - right: 0 - top: 0 - transition(background-color 0.3s ease) - width: 20px - - b - display: none - - span.select2-selection--multiple - background-color: $gray2 - min-height: 30px - - input.select2-search__field - color: $gray5 - placeholder-color($gray5) - - li.select2-selection__choice - theme('border-color', '$uiGray') - background-color: #FFF - border-radius: $borderRadius - color: $gray5 - font-size: 12px - line-height: 22px - margin-top: 3px - - span.select2-selection__choice__remove - color: $gray4 - float: right - font-size: 20px - font-weight: 300 - line-height: 20px - margin-left: 6px - margin-right: 0 - - span.select2-selection__clear - display: none diff --git a/Packages/ohif-design/styles/components/states.styl b/Packages/ohif-design/styles/components/states.styl deleted file mode 100644 index c2a39dd8f..000000000 --- a/Packages/ohif-design/styles/components/states.styl +++ /dev/null @@ -1,31 +0,0 @@ -@import "{ohif:design}/app" - -.form-themed .state-error, .state-error - - &.wrapperLabel input + .wrapperText - theme('color', '$uiStateErrorText') - - &+.tooltip - - .tooltip-inner - color: white - theme('background-color', '$uiStateErrorBorder') - - &.top .tooltip-arrow - theme('border-top-color', '$uiStateErrorBorder') - &.right .tooltip-arrow - theme('border-right-color', '$uiStateErrorBorder') - &.bottom .tooltip-arrow - theme('border-bottom-color', '$uiStateErrorBorder') - &.left .tooltip-arrow - theme('border-left-color', '$uiStateErrorBorder') - - - &:not(.component-group) - &.form-control, .form-control - theme('background-color', '$uiStateError') - theme('border-color', '$uiStateErrorBorder') - - .select2-selection - theme('background-color', '$uiStateError') - theme('border-color', '$uiStateErrorBorder') diff --git a/Packages/ohif-design/styles/imports/animations.styl b/Packages/ohif-design/styles/imports/animations.styl deleted file mode 100644 index d1c195735..000000000 --- a/Packages/ohif-design/styles/imports/animations.styl +++ /dev/null @@ -1,29 +0,0 @@ -animationDefaults() - animation-duration: 0.3s - animation-direction: alternate - animation-timing-function: ease-out - animation-fill-mode: forwards - -animateZoomIn() - animationDefaults() - animation-name: zoomIn - -animateZoomOut() - animationDefaults() - animation-name: zoomOut - -animateSlideInDown() - animationDefaults() - animation-name: slideInDown - -animateSlideOutUp() - animationDefaults() - animation-name: slideOutUp - -animateFadeIn() - animationDefaults() - animation-name: fadeIn - -animateFadeOut() - animationDefaults() - animation-name: fadeOut diff --git a/Packages/ohif-design/styles/imports/mixins.styl b/Packages/ohif-design/styles/imports/mixins.styl deleted file mode 100644 index c85aa29ea..000000000 --- a/Packages/ohif-design/styles/imports/mixins.styl +++ /dev/null @@ -1,57 +0,0 @@ -/* - Basic mixin which vendorizes a propery. Usage: - - vendorize(box-sizing, border-box) -*/ -vendorize(property, value) - -webkit-{property} value - -moz-{property} value - -ms-{property} value - -o-{property} value - {property} value - -animation(a) - vendorize(animation, a) - -border-radius(r) - vendorize(border-radius, r) - -border-top-left-radius(r) - vendorize(border-top-left-radius, r) - -border-top-right-radius(r) - vendorize(border-top-right-radius, r) - -border-bottom-left-radius(r) - vendorize(border-bottom-left-radius, r) - -border-bottom-right-radius(r) - vendorize(border-bottom-right-radius, r) - -box-shadow(s) - vendorize(box-shadow, s) - -text-shadow(s) - vendorize(text-shadow, s) - -transform(t) - vendorize(transform, t) - -transform-origin(o) - vendorize(transform-origin, o) - -transition(t) - vendorize(transition, t) - -transition-delay(d) - vendorize(transition-delay, d) - -placeholder-color(c) - &::-webkit-input-placeholder - color: c - &:-moz-placeholder - color: c - &::-moz-placeholder - color: c - &:-ms-input-placeholder - color: c diff --git a/Packages/ohif-design/styles/imports/spacings.styl b/Packages/ohif-design/styles/imports/spacings.styl deleted file mode 100644 index a0d4e3c83..000000000 --- a/Packages/ohif-design/styles/imports/spacings.styl +++ /dev/null @@ -1,39 +0,0 @@ -$spacer = 1rem - -$spacer-x = $spacer -$spacer-y = $spacer - -generateSpacings($prefix, $spacerX, $spacerY) - $spacerAxis = $spacerX, - $spacerY - - $spacings = 0 0, - 1 1, - 2 1.5, - 3 3g - - $properties = m margin, - p padding - - $sides = t top 1, - r right 0, - b bottom 1, - l left 0 - - $axes = x left right 0, - y top bottom 1 - - .r-font - font-size: $spacerX - - for $property in $properties - for $spacing in $spacings - .{$prefix}{$property[0]}-a-{$spacing[0]} - {$property[1]} $spacing[1]*$spacer !important - for $side in $sides - .{$prefix}{$property[0]}-{$side[0]}-{$spacing[0]} - {$property[1]}-{$side[1]} $spacing[1]*$spacerAxis[$side[2]] !important - for $axis in $axes - .{$prefix}{$property[0]}-{$axis[0]}-{$spacing[0]} - {$property[1]}-{$axis[1]} $spacing[1]*$spacerAxis[$axis[3]] !important - {$property[1]}-{$axis[2]} $spacing[1]*$spacerAxis[$axis[3]] !important diff --git a/Packages/ohif-design/styles/imports/theme-icons.styl b/Packages/ohif-design/styles/imports/theme-icons.styl deleted file mode 100644 index b04418982..000000000 --- a/Packages/ohif-design/styles/imports/theme-icons.styl +++ /dev/null @@ -1,47 +0,0 @@ -.theme-icon-crickets -.theme-icon-tide -.theme-icon-tigerlily -.theme-icon-quartz -.theme-icon-overcast -.theme-icon-mint -.theme-icon-honeycomb - display: inline-block - background: url('/packages/ohif_design/assets/theme-icons.png') no-repeat - overflow: hidden - text-indent: -9999px - text-align: left - -.theme-icon-crickets - background-position: -0px -0px - width: 64px - height: 56px - -.theme-icon-tide - background-position: -0px -56px - width: 64px - height: 54px - -.theme-icon-tigerlily - background-position: -0px -110px - width: 62px - height: 61px - -.theme-icon-quartz - background-position: -0px -171px - width: 59px - height: 64px - -.theme-icon-overcast - background-position: -0px -235px - width: 58px - height: 37px - -.theme-icon-mint - background-position: -0px -272px - width: 57px - height: 61px - -.theme-icon-honeycomb - background-position: -0px -333px - width: 50px - height: 58px diff --git a/Packages/ohif-design/styles/imports/theming.styl b/Packages/ohif-design/styles/imports/theming.styl deleted file mode 100644 index b8f8c5d14..000000000 --- a/Packages/ohif-design/styles/imports/theming.styl +++ /dev/null @@ -1,64 +0,0 @@ -@require "{ohif:themes}/themes" - -/* - * Process each theme variable in the given value, splitting it by space - */ -parseSpaceVars($theme, $value, $alpha) - // Split values by space - $valueSplit = split(' ', $value) - - // Create an empty list - $list = '' - pop($list) - - // Iterate over split values - for $property in $valueSplit - // Try to get the theme with current property key - $val = $theme[$property] - if ($val) - if($val is a 'color') - // Apply given alpha if it's a color - $val = alpha($val, $alpha) - // Push the processed theme variable to the list - push($list, $val) - else - // Push the property itself if not found in theme variables - push($list, $property) - - // Merge the resulting processed list by joining values back with space - join(' ', $list) - -/* - * Process each theme variable in the given value, splitting it by comma - */ -parseCommaVars($theme, $value, $alpha) - // Split values by comma - $valueSplit = split(',', $value) - - // Create an empty list - $list = '' - pop($list) - - // Iterate over split values - for $sentence in $valueSplit - // Procces the values splitting by space - push($list, parseSpaceVars($theme, $sentence, $alpha)) - - // Merge the resulting processed list by joining values back with comma - unquote(join(',', $list)) - -/* - * Return a processed theme variable or color with alpha - */ -theme($property, $value, $alpha=1) - - // Crete the selector for default theme - / {selector()} - {$property}: parseCommaVars($themes[$defaultTheme], $value, $alpha) - - // Create the selector for each registered theme - for $themeName, $theme in $themes - for $selectorPiece in split(',', selector()) - // prefix the selector with the body.theme-{themeName} selector - / body.theme-{$themeName} {$selectorPiece} - {$property}: parseCommaVars($theme, $value, $alpha) diff --git a/Packages/ohif-design/styles/imports/variables.styl b/Packages/ohif-design/styles/imports/variables.styl deleted file mode 100644 index 4e0bace73..000000000 --- a/Packages/ohif-design/styles/imports/variables.styl +++ /dev/null @@ -1,25 +0,0 @@ -@import "./theming.styl" - -// Sizes -$topBarHeight = 40px -$topBarExpandedHeight = 160px -$toolbarHeight = 78px -$toolbarDrawerHeight = 62px -$studiesSidebarMenuWidth = 307px -$rightSidebarMenuWidth = 323px -$studyListPadding = 8% -$studyListPaddingMediumScreen = 10px - -// Fonts -$logoFontFamily = "Sanchez" -$logoFontWeight = 300 - -// Transitions -$transitionDuration = 0.3s -$transitionEffect = ease -$sidebarTransition = all $transitionDuration $transitionEffect - - -// Thicknesses -$viewportBorderThickness = 1px -$uiBorderThickness = 1px diff --git a/Packages/ohif-google-cloud/.meteorignore b/Packages/ohif-google-cloud/.meteorignore deleted file mode 100644 index 8cd000bc2..000000000 --- a/Packages/ohif-google-cloud/.meteorignore +++ /dev/null @@ -1,3 +0,0 @@ -healthcare-api-adapter/node_modules/ -healthcare-api-adapter/public/ -healthcare-api-adapter/src/ \ No newline at end of file diff --git a/Packages/ohif-google-cloud/client/main.js b/Packages/ohif-google-cloud/client/main.js deleted file mode 100644 index 9b559f487..000000000 --- a/Packages/ohif-google-cloud/client/main.js +++ /dev/null @@ -1,6 +0,0 @@ -import { Meteor } from 'meteor/meteor'; - -if (Meteor.settings.public.googleCloud) { - import '../imports/index.js'; - import '../imports/client/index.js'; -} diff --git a/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.html b/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.html deleted file mode 100644 index 98bd592c2..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.html +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.js b/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.js deleted file mode 100644 index 180160a6c..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.js +++ /dev/null @@ -1,22 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -Template.gcloudDialog.onRendered(() => { - const instance = Template.instance(); - - // Allow options ovewrite - const modalOptions = _.extend( - { - backdrop: 'static', - keyboard: false, - width: 650, - }, - instance.data.modalOptions - ); - - const $modal = instance.$('.modal'); - - // Create the bootstrap modal - $modal.modal(modalOptions); -}); diff --git a/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.styl b/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.styl deleted file mode 100644 index ae7de0a87..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/dialogs/gcloudDialog.styl +++ /dev/null @@ -1,6 +0,0 @@ -@import '{ohif:design}/app' - -.gcloud-dialog - display flex - .modal-dialog - margin auto \ No newline at end of file diff --git a/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.html b/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.html deleted file mode 100644 index ba23a4016..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.html +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.js b/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.js deleted file mode 100644 index 57f12070c..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.js +++ /dev/null @@ -1,28 +0,0 @@ -import { Meteor } from 'meteor/meteor'; - -const DATASET_PICKER_ID = 'gcp-dataset-picker'; -const EVENT_NAME = 'onSelect'; - -Template.dicomStorePicker.onRendered(() => { - const instance = Template.instance(); - instance.$('#' + DATASET_PICKER_ID).on(EVENT_NAME, (event, data) => { - instance - .$('.modal') - .one('hidden.bs.modal', event => { - instance.data.promiseResolve(data); - }) - .modal('hide'); - }); -}); - -Template.dicomStorePicker.helpers({ - datasetPickerId() { - return DATASET_PICKER_ID; - }, - eventName() { - return EVENT_NAME; - }, - oidcStorageKey() { - return OHIF.user.getOidcStorageKey(); - }, -}); diff --git a/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.styl b/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.styl deleted file mode 100644 index f669618c4..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/dicomStorePicker/dicomStorePicker.styl +++ /dev/null @@ -1,5 +0,0 @@ -@import '{ohif:design}/app' - -#dicomStorePicker - .modal-dialog - width 694px \ No newline at end of file diff --git a/Packages/ohif-google-cloud/imports/client/components/index.js b/Packages/ohif-google-cloud/imports/client/components/index.js deleted file mode 100644 index 25d25ebe4..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import './dialogs/gcloudDialog.html'; -import './dialogs/gcloudDialog.js'; -import './dialogs/gcloudDialog.styl'; - - -import './dicomStorePicker/dicomStorePicker.html'; -import './dicomStorePicker/dicomStorePicker.js'; -import './dicomStorePicker/dicomStorePicker.styl'; - -import './uploadStudiesDialog/uploadStudiesDialog.html'; -import './uploadStudiesDialog/uploadStudiesDialog.js'; -import './uploadStudiesDialog/uploadStudiesDialog.styl'; \ No newline at end of file diff --git a/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.html b/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.html deleted file mode 100644 index 7373c1c7f..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.html +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.js b/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.js deleted file mode 100644 index 110f428cc..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.js +++ /dev/null @@ -1,31 +0,0 @@ -import { Meteor } from 'meteor/meteor'; - -const DICOM_FILE_UPLOADER_ID = 'gcp-dicom-uploader'; -const EVENT_NAME = 'onClose'; - -Template.uploadStudiesDialog.onRendered(() => { - const instance = Template.instance(); - instance.$('#' + DICOM_FILE_UPLOADER_ID).on(EVENT_NAME, (event, data) => { - instance - .$('.modal') - .one('hidden.bs.modal', event => { - instance.data.promiseResolve(data); - }) - .modal('hide'); - }); -}); - -Template.uploadStudiesDialog.helpers({ - dicomFilesUploaderId() { - return DICOM_FILE_UPLOADER_ID; - }, - eventName() { - return EVENT_NAME; - }, - oidcStorageKey() { - return OHIF.user.getOidcStorageKey(); - }, - url() { - return OHIF.gcloud.getConfig().qidoRoot; // FIXME: not QIDO - } -}); diff --git a/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.styl b/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.styl deleted file mode 100644 index ea3005d96..000000000 --- a/Packages/ohif-google-cloud/imports/client/components/uploadStudiesDialog/uploadStudiesDialog.styl +++ /dev/null @@ -1,8 +0,0 @@ -@import '{ohif:design}/app' - -#dicomFilesUploader - .modal-dialog - .modal-body - padding 0 - width 536px - max-height 563px \ No newline at end of file diff --git a/Packages/ohif-google-cloud/imports/client/index.js b/Packages/ohif-google-cloud/imports/client/index.js deleted file mode 100644 index 095e70eb8..000000000 --- a/Packages/ohif-google-cloud/imports/client/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import { loadScript } from "../lib/utils" - -loadScript("/packages/ohif_google-cloud/.npm/package/node_modules/healthcare-api-adapter/dist/vue.js", () => { - loadScript("/packages/ohif_google-cloud/.npm/package/node_modules/healthcare-api-adapter/dist/gcp.min.js"); -}); - - -import './components'; diff --git a/Packages/ohif-google-cloud/imports/index.js b/Packages/ohif-google-cloud/imports/index.js deleted file mode 100644 index 9949a65aa..000000000 --- a/Packages/ohif-google-cloud/imports/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import GCloudAdapter from './lib/GCloudAdapter'; - -const gcloud = GCloudAdapter; - -OHIF.gcloud = gcloud; - - diff --git a/Packages/ohif-google-cloud/imports/lib/GCloudAdapter.js b/Packages/ohif-google-cloud/imports/lib/GCloudAdapter.js deleted file mode 100644 index c7373621b..000000000 --- a/Packages/ohif-google-cloud/imports/lib/GCloudAdapter.js +++ /dev/null @@ -1,45 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -const GCloudAdapter = {}; - -const GCP_HEALTHCARE_CONFIG = 'GCP_HEALTHCARE_CONFIG'; -let isEnabled = true; - -GCloudAdapter.getConfig = function() { - const configStr = sessionStorage.getItem(GCP_HEALTHCARE_CONFIG); - if (configStr) return JSON.parse(configStr); - return null; -}; - -GCloudAdapter.setConfig = function(config) { - if (config) sessionStorage.setItem(GCP_HEALTHCARE_CONFIG, JSON.stringify(config)); - else sessionStorage.removeItem(GCP_HEALTHCARE_CONFIG); -}; - -GCloudAdapter.showDicomStorePicker = function(options) { - return OHIF.ui.showDialog('dicomStorePicker', options).then(config => { - if (config) { - OHIF.gcloud.setConfig(config); - } - return config; - }); -}; - -GCloudAdapter.showUploadStudiesDialog = function() { - return OHIF.ui.showDialog('uploadStudiesDialog') -}; - -const gcpConfig = GCloudAdapter.getConfig(); -if (gcpConfig) { - OHIF.servers.applyCloudServerConfig(gcpConfig); -} - -GCloudAdapter.setEnabled = function(value) { - isEnabled = value; -} - -GCloudAdapter.isEnabled = function() { - return isEnabled; -}; - -export default GCloudAdapter; diff --git a/Packages/ohif-google-cloud/imports/lib/utils.js b/Packages/ohif-google-cloud/imports/lib/utils.js deleted file mode 100644 index b75523691..000000000 --- a/Packages/ohif-google-cloud/imports/lib/utils.js +++ /dev/null @@ -1,9 +0,0 @@ -export function loadScript(url, callback) { - var head = document.getElementsByTagName('head')[0]; - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = url; - script.onreadystatechange = callback; - script.onload = callback; - head.appendChild(script); -} diff --git a/Packages/ohif-google-cloud/package.js b/Packages/ohif-google-cloud/package.js deleted file mode 100644 index dfacc7491..000000000 --- a/Packages/ohif-google-cloud/package.js +++ /dev/null @@ -1,41 +0,0 @@ -Package.describe({ - name: 'ohif:google-cloud', - summary: 'DICOM Services: Google Cloud Healthcare API integration', - version: '0.0.1', - documentation: 'README.md', -}); - -Npm.depends({ - 'healthcare-api-adapter': "git+https://github.com/quantumsoftgroup/healthcare-api-adapter#v0.2.2" -}); - - -Package.onUse(function(api) { - api.versionsFrom('1.4'); - - api.use('http'); - api.use('ecmascript'); - - api.use(['templating', 'stylus'], 'client'); - - // Main module - api.mainModule('client/main.js', ['client']); - - const assets = [ - '.npm/package/node_modules/healthcare-api-adapter/dist/gcp.min.js', - '.npm/package/node_modules/healthcare-api-adapter/dist/gcp.0.min.js', - '.npm/package/node_modules/healthcare-api-adapter/dist/gcp.2.min.js', - '.npm/package/node_modules/healthcare-api-adapter/dist/gcp.3.min.js', - '.npm/package/node_modules/healthcare-api-adapter/dist/gcp.4.min.js', - '.npm/package/node_modules/healthcare-api-adapter/dist/vue.js', - '.npm/package/node_modules/healthcare-api-adapter/dist/img/Button_File.473e74a7.svg', - '.npm/package/node_modules/healthcare-api-adapter/dist/img/Button_Folder.271da60b.svg', - '.npm/package/node_modules/healthcare-api-adapter/dist/img/Icon-24px-Close.d1a4d6d2.svg', - '.npm/package/node_modules/healthcare-api-adapter/dist/img/Icon-Arrow.e493b444.svg', - '.npm/package/node_modules/healthcare-api-adapter/dist/img/Icon-Warn.f3b4b640.svg', - '.npm/package/node_modules/healthcare-api-adapter/dist/img/arrow_right.d8a5b209.svg', - ]; - - api.addAssets(assets, 'client'); -}); - diff --git a/Packages/ohif-hanging-protocols/assets/dots.svg b/Packages/ohif-hanging-protocols/assets/dots.svg deleted file mode 100644 index daf0dada2..000000000 --- a/Packages/ohif-hanging-protocols/assets/dots.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/classes/Protocol.js b/Packages/ohif-hanging-protocols/both/classes/Protocol.js deleted file mode 100644 index 232db7ef1..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/Protocol.js +++ /dev/null @@ -1,244 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Random } from 'meteor/random'; -import { OHIF } from 'meteor/ohif:core'; - -// Local imports -import { removeFromArray } from '../lib/removeFromArray'; - -/** - * This class represents a Hanging Protocol at the highest level - * - * @type {Protocol} - */ -HP.Protocol = class Protocol { - /** - * The Constructor for the Class to create a Protocol with the bare - * minimum information - * - * @param name The desired name for the Protocol - */ - constructor(name) { - // Create a new UUID for this Protocol - this.id = Random.id(); - - // Store a value which determines whether or not a Protocol is locked - // This is probably temporary, since we will eventually have role / user - // checks for editing. For now we just need it to prevent changes to the - // default protocols. - this.locked = false; - - // Boolean value to indicate if the protocol has updated priors information - // it's set in "updateNumberOfPriorsReferenced" function - this.hasUpdatedPriorsInformation = false; - - // Apply the desired name - this.name = name; - - // Set the created and modified dates to Now - this.createdDate = new Date(); - this.modifiedDate = new Date(); - - // If we are logged in while creating this Protocol, - // store this information as well - if (OHIF.user && OHIF.user.userLoggedIn && OHIF.user.userLoggedIn()) { - this.createdBy = OHIF.user.getUserId(); - this.modifiedBy = OHIF.user.getUserId(); - } - - // Create two empty Sets specifying which roles - // have read and write access to this Protocol - this.availableTo = new Set(); - this.editableBy = new Set(); - - // Define empty arrays for the Protocol matching rules - // and Stages - this.protocolMatchingRules = []; - this.stages = []; - - // Define auxiliary values for priors - this.numberOfPriorsReferenced = -1; - } - - getNumberOfPriorsReferenced(skipCache = false) { - let numberOfPriorsReferenced = skipCache !== true ? this.numberOfPriorsReferenced : -1; - - // Check if information is cached already - if (numberOfPriorsReferenced > -1) { - return numberOfPriorsReferenced; - } - - numberOfPriorsReferenced = 0; - - // Search each study matching rule for prior rules - // Each stage can have many viewports that can have - // multiple study matching rules. - this.stages.forEach(stage => { - if (!stage.viewports) { - return; - } - - stage.viewports.forEach(viewport => { - if (!viewport.studyMatchingRules) { - return; - } - - viewport.studyMatchingRules.forEach(rule => { - // If the current rule is not a priors rule, it will return -1 then numberOfPriorsReferenced will continue to be 0 - const priorsReferenced = rule.getNumberOfPriorsReferenced(); - if (priorsReferenced > numberOfPriorsReferenced) { - numberOfPriorsReferenced = priorsReferenced; - } - }); - }); - }); - - this.numberOfPriorsReferenced = numberOfPriorsReferenced; - - return numberOfPriorsReferenced - } - - updateNumberOfPriorsReferenced() { - this.getNumberOfPriorsReferenced(true); - } - - /** - * Method to update the modifiedDate when the Protocol - * has been changed - */ - protocolWasModified() { - // If we are logged in while modifying this Protocol, - // store this information as well - if (OHIF.user && OHIF.user.userLoggedIn && OHIF.user.userLoggedIn()) { - this.modifiedBy = OHIF.user.getUserId(); - } - - // Protocol has been modified, so mark priors information - // as "outdated" - this.hasUpdatedPriorsInformation = false; - - // Update number of priors referenced info - this.updateNumberOfPriorsReferenced(); - - // Update the modifiedDate with the current Date/Time - this.modifiedDate = new Date(); - } - - /** - * Occasionally the Protocol class needs to be instantiated from a JavaScript Object - * containing the Protocol data. This function fills in a Protocol with the Object - * data. - * - * @param input A Protocol as a JavaScript Object, e.g. retrieved from MongoDB or JSON - */ - fromObject(input) { - // Check if the input already has an ID - // If so, keep it. It not, create a new UUID - this.id = input.id || Random.id(); - - // Assign the input name to the Protocol - this.name = input.name; - - // Retrieve locked status, use !! to make it truthy - // so that undefined values will be set to false - this.locked = !!input.locked; - - // TODO: Check how to regenerate Set from Object - //this.availableTo = new Set(input.availableTo); - //this.editableBy = new Set(input.editableBy); - - // If the input contains Protocol matching rules - if (input.protocolMatchingRules) { - input.protocolMatchingRules.forEach(ruleObject => { - // Create new Rules from the stored data - var rule = new HP.ProtocolMatchingRule(); - rule.fromObject(ruleObject); - - // Add them to the Protocol - this.protocolMatchingRules.push(rule); - }); - } - - // If the input contains data for various Stages in the - // display set sequence - if (input.stages) { - input.stages.forEach(stageObject => { - // Create Stages from the stored data - var stage = new HP.Stage(); - stage.fromObject(stageObject); - - // Add them to the Protocol - this.stages.push(stage); - }); - } - } - - /** - * Creates a clone of the current Protocol with a new name - * - * @param name - * @returns {Protocol|*} - */ - createClone(name) { - // Create a new JavaScript independent of the current Protocol - var currentProtocol = Object.assign({}, this); - - // Create a new Protocol to return - var clonedProtocol = new HP.Protocol(); - - // Apply the desired properties - currentProtocol.id = clonedProtocol.id; - clonedProtocol.fromObject(currentProtocol); - - // If we have specified a name, assign it - if (name) { - clonedProtocol.name = name; - } - - // Unlock the clone - clonedProtocol.locked = false; - - // Return the cloned Protocol - return clonedProtocol; - } - - /** - * Adds a Stage to this Protocol's display set sequence - * - * @param stage - */ - addStage(stage) { - this.stages.push(stage); - - // Update the modifiedDate and User that last - // modified this Protocol - this.protocolWasModified(); - } - - /** - * Adds a Rule to this Protocol's array of matching rules - * - * @param rule - */ - addProtocolMatchingRule(rule) { - this.protocolMatchingRules.push(rule); - - // Update the modifiedDate and User that last - // modified this Protocol - this.protocolWasModified(); - } - - /** - * Removes a Rule from this Protocol's array of matching rules - * - * @param rule - */ - removeProtocolMatchingRule(rule) { - var wasRemoved = removeFromArray(this.protocolMatchingRules, rule); - - // Update the modifiedDate and User that last - // modified this Protocol - if (wasRemoved) { - this.protocolWasModified(); - } - } -}; diff --git a/Packages/ohif-hanging-protocols/both/classes/Rule.js b/Packages/ohif-hanging-protocols/both/classes/Rule.js deleted file mode 100644 index 236242785..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/Rule.js +++ /dev/null @@ -1,173 +0,0 @@ -import { Random } from 'meteor/random'; - -import { comparators } from '../lib/comparators'; - -const EQUALS_REGEXP = /^equals$/; - -/** - * This Class represents a Rule to be evaluated given a set of attributes - * Rules have: - * - An attribute (e.g. 'seriesDescription') - * - A constraint Object, in the form required by Validate.js: - * - * rule.constraint = { - * contains: { - * value: 'T-1' - * } - * }; - * - * Note: In this example we use the 'contains' Validator, which is a custom Validator defined in Viewerbase - * - * - A value for whether or not they are Required to be matched (default: False) - * - A value for their relative weighting during Protocol or Image matching (default: 1) - */ -export class Rule { - /** - * The Constructor for the Class to create a Rule with the bare - * minimum information - * - * @param name The desired name for the Rule - */ - constructor(attribute, constraint, required, weight) { - // Create a new UUID for this Rule - this.id = Random.id(); - - // Set the Rule's weight (defaults to 1) - this.weight = weight || 1; - - // If an attribute is specified, assign it - if (attribute) { - this.attribute = attribute; - } - - // If a constraint is specified, assign it - if (constraint) { - this.constraint = constraint; - } - - // If a value for 'required' is specified, assign it - if (required === undefined) { - // If no value was specified, default to False - this.required = false; - } else { - this.required = required; - } - - // Cache for constraint info object - this._constraintInfo = void 0; - - // Cache for validator and value object - this._validatorAndValue = void 0; - } - - /** - * Occasionally the Rule class needs to be instantiated from a JavaScript Object. - * This function fills in a Protocol with the Object data. - * - * @param input A Rule as a JavaScript Object, e.g. retrieved from MongoDB or JSON - */ - fromObject(input) { - // Check if the input already has an ID - // If so, keep it. It not, create a new UUID - this.id = input.id || Random.id(); - - // Assign the specified input data to the Rule - this.required = input.required; - this.weight = input.weight; - this.attribute = input.attribute; - this.constraint = input.constraint; - } - - /** - * Get the constraint info object for the current constraint - * @return {Object\undefined} Constraint object or undefined if current constraint - * is not valid or not found in comparators list - */ - getConstraintInfo() { - let constraintInfo = this._constraintInfo; - // Check if info is cached already - if (constraintInfo !== void 0) { - return constraintInfo; - } - - const ruleConstraint = Object.keys(this.constraint)[0]; - - if (ruleConstraint !== void 0) { - constraintInfo = comparators.find(comparator => ruleConstraint === comparator.id) - } - - // Cache this information for later use - this._constraintInfo = constraintInfo; - - return constraintInfo; - } - - /** - * Check if current rule is related to priors - * @return {Boolean} True if a rule is related to priors or false otherwise - */ - isRuleForPrior() { - // @TODO: Should we check this too? this.attribute === 'relativeTime' - return this.attribute === 'abstractPriorValue'; - } - - /** - * If the current rule is a rule for priors, returns the number of referenced priors. Otherwise, returns -1. - * @return {Number} The number of referenced priors or -1 if not applicable. Returns zero if the actual value could not be determined. - */ - getNumberOfPriorsReferenced() { - if (!this.isRuleForPrior()) { - return -1; - } - - // Get rule's validator and value - const ruleValidatorAndValue = this.getConstraintValidatorAndValue(); - const { value, validator } = ruleValidatorAndValue; - const intValue = parseInt(value, 10) || 0; // avoid possible NaN - - // "Equal to" validators - if (EQUALS_REGEXP.test(validator)) { - // In this case, -1 (the oldest prior) indicates that at least one study is used - return intValue < 0 ? 1 : intValue; - } - - // Default cases return value - return 0; - } - - /** - * Get the constraint validator and value - * @return {Object|undefined} Returns an object containing the validator and it's value or undefined - */ - getConstraintValidatorAndValue() { - let validatorAndValue = this._validatorAndValue; - - // Check if validator and value are cached already - if (validatorAndValue !== void 0) { - return validatorAndValue; - } - - // Get the constraint info object - const constraintInfo = this.getConstraintInfo(); - - // Constraint info object exists and is valid - if (constraintInfo !== void 0) { - const validator = constraintInfo.validator; - const currentValidator = this.constraint[validator]; - - if (currentValidator) { - const constraintValidator = constraintInfo.validatorOption; - const constraintValue = currentValidator[constraintValidator]; - - validatorAndValue = { - value: constraintValue, - validator: constraintInfo.id - }; - - this._validatorAndValue = validatorAndValue; - } - } - - return validatorAndValue; - } -} diff --git a/Packages/ohif-hanging-protocols/both/classes/Stage.js b/Packages/ohif-hanging-protocols/both/classes/Stage.js deleted file mode 100644 index 8c0952095..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/Stage.js +++ /dev/null @@ -1,87 +0,0 @@ -import { Random } from 'meteor/random'; - -/** - * A Stage is one step in the Display Set Sequence for a Hanging Protocol - * - * Stages are defined as a ViewportStructure and an array of Viewports - * - * @type {Stage} - */ -HP.Stage = class Stage { - constructor(ViewportStructure, name) { - // Create a new UUID for this Stage - this.id = Random.id(); - - // Assign the name and ViewportStructure provided - this.name = name; - this.viewportStructure = ViewportStructure; - - // Create an empty array for the Viewports - this.viewports = []; - - // Set the created date to Now - this.createdDate = new Date(); - } - - /** - * Creates a clone of the current Stage with a new name - * - * Note! This method absolutely cannot be renamed 'clone', because - * Minimongo's insert method uses 'clone' internally and this - * somehow causes very bizarre behaviour - * - * @param name - * @returns {Stage|*} - */ - createClone(name) { - // Create a new JavaScript independent of the current Protocol - var currentStage = Object.assign({}, this); - - // Create a new Stage to return - var clonedStage = new HP.Stage(); - - // Assign the desired properties - currentStage.id = clonedStage.id; - clonedStage.fromObject(currentStage); - - // If we have specified a name, assign it - if (name) { - clonedStage.name = name; - } - - // Return the cloned Stage - return clonedStage; - } - - /** - * Occasionally the Stage class needs to be instantiated from a JavaScript Object. - * This function fills in a Protocol with the Object data. - * - * @param input A Stage as a JavaScript Object, e.g. retrieved from MongoDB or JSON - */ - fromObject(input) { - // Check if the input already has an ID - // If so, keep it. It not, create a new UUID - this.id = input.id || Random.id(); - - // Assign the input name to the Stage - this.name = input.name; - - // If a ViewportStructure is present in the input, add it from the - // input data - this.viewportStructure = new HP.ViewportStructure(); - this.viewportStructure.fromObject(input.viewportStructure); - - // If any viewports are present in the input object - if (input.viewports) { - input.viewports.forEach(viewportObject => { - // Create a new Viewport with their data - var viewport = new HP.Viewport(); - viewport.fromObject(viewportObject); - - // Add it to the viewports array - this.viewports.push(viewport); - }); - } - } -}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/classes/Viewport.js b/Packages/ohif-hanging-protocols/both/classes/Viewport.js deleted file mode 100644 index 38fbaeff1..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/Viewport.js +++ /dev/null @@ -1,81 +0,0 @@ -// Local imports -import { removeFromArray } from '../lib/removeFromArray'; - -/** - * This Class defines a Viewport in the Hanging Protocol Stage. A Viewport contains - * arrays of Rules that are matched in the ProtocolEngine in order to determine which - * images should be hung. - * - * @type {Viewport} - */ -HP.Viewport = class Viewport { - constructor() { - this.viewportSettings = {}; - this.imageMatchingRules = []; - this.seriesMatchingRules = []; - this.studyMatchingRules = []; - } - - /** - * Occasionally the Viewport class needs to be instantiated from a JavaScript Object. - * This function fills in a Viewport with the Object data. - * - * @param input The Viewport as a JavaScript Object, e.g. retrieved from MongoDB or JSON - */ - fromObject(input) { - // If ImageMatchingRules exist, create them from the Object data - // and add them to the Viewport's imageMatchingRules array - if (input.imageMatchingRules) { - input.imageMatchingRules.forEach(ruleObject => { - var rule = new HP.ImageMatchingRule(); - rule.fromObject(ruleObject); - this.imageMatchingRules.push(rule); - }); - } - - // If SeriesMatchingRules exist, create them from the Object data - // and add them to the Viewport's seriesMatchingRules array - if (input.seriesMatchingRules) { - input.seriesMatchingRules.forEach(ruleObject => { - var rule = new HP.SeriesMatchingRule(); - rule.fromObject(ruleObject); - this.seriesMatchingRules.push(rule); - }); - } - - // If StudyMatchingRules exist, create them from the Object data - // and add them to the Viewport's studyMatchingRules array - if (input.studyMatchingRules) { - input.studyMatchingRules.forEach(ruleObject => { - var rule = new HP.StudyMatchingRule(); - rule.fromObject(ruleObject); - this.studyMatchingRules.push(rule); - }); - } - - // If ViewportSettings exist, add them to the current protocol - if (input.viewportSettings) { - this.viewportSettings = input.viewportSettings; - } - } - - /** - * Finds and removes a rule from whichever array it exists in. - * It is not required to specify if it exists in studyMatchingRules, - * seriesMatchingRules, or imageMatchingRules - * - * @param rule - */ - removeRule(rule) { - var array; - if (rule instanceof HP.StudyMatchingRule) { - array = this.studyMatchingRules; - } else if (rule instanceof HP.SeriesMatchingRule) { - array = this.seriesMatchingRules; - } else if (rule instanceof HP.ImageMatchingRule) { - array = this.imageMatchingRules; - } - - removeFromArray(array, rule); - } -}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/classes/ViewportStructure.js b/Packages/ohif-hanging-protocols/both/classes/ViewportStructure.js deleted file mode 100644 index df4416c90..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/ViewportStructure.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * The ViewportStructure class represents the layout and layout properties that - * Viewports are displayed in. ViewportStructure has a type, which corresponds to - * a layout template, and a set of properties, which depend on the type. - * - * @type {ViewportStructure} - */ -HP.ViewportStructure = class ViewportStructure { - constructor(type, properties) { - this.type = type; - this.properties = properties; - } - - /** - * Occasionally the ViewportStructure class needs to be instantiated from a JavaScript Object. - * This function fills in a ViewportStructure with the Object data. - * - * @param input The ViewportStructure as a JavaScript Object, e.g. retrieved from MongoDB or JSON - */ - fromObject(input) { - this.type = input.type; - this.properties = input.properties; - } - - /** - * Retrieve the layout template name based on the layout type - * - * @returns {string} - */ - getLayoutTemplateName() { - // Viewport structure can be updated later when we build more complex display layouts - switch (this.type) { - case 'grid': - return 'gridLayout'; - } - } - - /** - * Retrieve the number of Viewports required for this layout - * given the layout type and properties - * - * @returns {string} - */ - getNumViewports() { - // Viewport structure can be updated later when we build more complex display layouts - switch (this.type) { - case 'grid': - // For the typical grid layout, we only need to multiply rows by columns to - // obtain the number of viewports - return this.properties.rows * this.properties.columns; - } - } -}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/classes/rules/ImageMatchingRule.js b/Packages/ohif-hanging-protocols/both/classes/rules/ImageMatchingRule.js deleted file mode 100644 index 492b939cf..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/rules/ImageMatchingRule.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Rule } from '../Rule'; - -/** - * The ImageMatchingRule class extends the Rule Class. - * - * At present it does not add any new methods or attributes - * @type {ImageMatchingRule} - */ -HP.ImageMatchingRule = class ImageMatchingRule extends Rule {}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/classes/rules/ProtocolMatchingRule.js b/Packages/ohif-hanging-protocols/both/classes/rules/ProtocolMatchingRule.js deleted file mode 100644 index 7ee5174fc..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/rules/ProtocolMatchingRule.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Rule } from '../Rule'; - -/** - * The ProtocolMatchingRule Class extends the Rule Class. - * - * At present it does not add any new methods or attributes - * @type {ProtocolMatchingRule} - */ -HP.ProtocolMatchingRule = class ProtocolMatchingRule extends Rule {}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/classes/rules/SeriesMatchingRule.js b/Packages/ohif-hanging-protocols/both/classes/rules/SeriesMatchingRule.js deleted file mode 100644 index 8dd3f4488..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/rules/SeriesMatchingRule.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Rule } from '../Rule'; - -/** - * The SeriesMatchingRule Class extends the Rule Class. - * - * At present it does not add any new methods or attributes - * @type {SeriesMatchingRule} - */ -HP.SeriesMatchingRule = class SeriesMatchingRule extends Rule {}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/classes/rules/StudyMatchingRule.js b/Packages/ohif-hanging-protocols/both/classes/rules/StudyMatchingRule.js deleted file mode 100644 index 7ff7f7b53..000000000 --- a/Packages/ohif-hanging-protocols/both/classes/rules/StudyMatchingRule.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Rule } from '../Rule'; - -/** - * The StudyMatchingRule Class extends the Rule Class. - * - * At present it does not add any new methods or attributes - * @type {StudyMatchingRule} - */ -HP.StudyMatchingRule = class StudyMatchingRule extends Rule {}; diff --git a/Packages/ohif-hanging-protocols/both/collections.js b/Packages/ohif-hanging-protocols/both/collections.js deleted file mode 100644 index 2262e29f8..000000000 --- a/Packages/ohif-hanging-protocols/both/collections.js +++ /dev/null @@ -1,21 +0,0 @@ -HangingProtocols = new Meteor.Collection('hangingprotocols'); -HangingProtocols._debugName = 'HangingProtocols'; - -HangingProtocols.allow({ - insert: function() { - return true; - }, - update: function() { - return true; - }, - remove: function() { - return true; - } -}); - -// @TODO: Remove this after stabilizing ProtocolEngine -if (Meteor.isDevelopment && Meteor.isServer) { - Meteor.startup(() => { - HangingProtocols.remove({}); - }); -} diff --git a/Packages/ohif-hanging-protocols/both/hardcodedData.js b/Packages/ohif-hanging-protocols/both/hardcodedData.js deleted file mode 100644 index 00d4408bb..000000000 --- a/Packages/ohif-hanging-protocols/both/hardcodedData.js +++ /dev/null @@ -1,102 +0,0 @@ -HP.attributeDefaults = { - abstractPriorValue: 0 -}; - -HP.displaySettings = { - invert: { - id: 'invert', - text: 'Show Grayscale Inverted', - defaultValue: 'NO', - options: ['YES', 'NO'] - } -}; - -// @TODO Fix abstractPriorValue comparison -HP.studyAttributes = [{ - id: 'x00100020', - text: '(x00100020) Patient ID' -}, { - id: 'x0020000d', - text: '(x0020000d) Study Instance UID' -}, { - id: 'x00080020', - text: '(x00080020) Study Date' -}, { - id: 'x00080030', - text: '(x00080030) Study Time' -}, { - id: 'x00081030', - text: '(x00081030) Study Description' -}, { - id: 'abstractPriorValue', - text: 'Abstract Prior Value' -}]; - -HP.protocolAttributes = [{ - id: 'x00100020', - text: '(x00100020) Patient ID' -}, { - id: 'x0020000d', - text: '(x0020000d) Study Instance UID' -}, { - id: 'x00080020', - text: '(x00080020) Study Date' -}, { - id: 'x00080030', - text: '(x00080030) Study Time' -}, { - id: 'x00081030', - text: '(x00081030) Study Description' -}, { - id: 'anatomicRegion', - text: 'Anatomic Region' -}]; - -HP.seriesAttributes = [{ - id: 'x0020000e', - text: '(x0020000e) Series Instance UID' -}, { - id: 'x00080060', - text: '(x00080060) Modality' -}, { - id: 'x00200011', - text: '(x00200011) Series Number' -}, { - id: 'x0008103e', - text: '(x0008103e) Series Description' -}, { - id: 'numImages', - text: 'Number of Images' -}]; - -HP.instanceAttributes = [{ - id: 'x00080016', - text: '(x00080016) SOP Class UID' -}, { - id: 'x00080018', - text: '(x00080018) SOP Instance UID' -}, { - id: 'x00185101', - text: '(x00185101) View Position' -}, { - id: 'x00200013', - text: '(x00200013) Instance Number' -}, { - id: 'x00080008', - text: '(x00080008) Image Type' -}, { - id: 'x00181063', - text: '(x00181063) Frame Time' -}, { - id: 'x00200060', - text: '(x00200060) Laterality' -}, { - id: 'x00541330', - text: '(x00541330) Image Index' -}, { - id: 'x00280004', - text: '(x00280004) Photometric Interpretation' -}, { - id: 'x00180050', - text: '(x00180050) Slice Thickness' -}]; diff --git a/Packages/ohif-hanging-protocols/both/lib/comparators.js b/Packages/ohif-hanging-protocols/both/lib/comparators.js deleted file mode 100644 index 82c2ba1fe..000000000 --- a/Packages/ohif-hanging-protocols/both/lib/comparators.js +++ /dev/null @@ -1,84 +0,0 @@ -const comparators = [{ - id: 'equals', - name: '= (Equals)', - validator: 'equals', - validatorOption: 'value', - description: 'The attribute must equal this value.' -}, { - id: 'doesNotEqual', - name: '!= (Does not equal)', - validator: 'doesNotEqual', - validatorOption: 'value', - description: 'The attribute must not equal this value.' -}, { - id: 'contains', - name: 'Contains', - validator: 'contains', - validatorOption: 'value', - description: 'The attribute must contain this value.' -}, { - id: 'doesNotContain', - name: 'Does not contain', - validator: 'doesNotContain', - validatorOption: 'value', - description: 'The attribute must not contain this value.' -}, { - id: 'startsWith', - name: 'Starts with', - validator: 'startsWith', - validatorOption: 'value', - description: 'The attribute must start with this value.' -}, { - id: 'endsWith', - name: 'Ends with', - validator: 'endsWith', - validatorOption: 'value', - description: 'The attribute must end with this value.' -}, { - id: 'onlyInteger', - name: 'Only Integers', - validator: 'numericality', - validatorOption: 'onlyInteger', - description: "Real numbers won't be allowed." -}, { - id: 'greaterThan', - name: '> (Greater than)', - validator: 'numericality', - validatorOption: 'greaterThan', - description: 'The attribute has to be greater than this value.' -}, { - id: 'greaterThanOrEqualTo', - name: '>= (Greater than or equal to)', - validator: 'numericality', - validatorOption: 'greaterThanOrEqualTo', - description: 'The attribute has to be at least this value.' -}, { - id: 'lessThanOrEqualTo', - name: '<= (Less than or equal to)', - validator: 'numericality', - validatorOption: 'lessThanOrEqualTo', - description: 'The attribute can be this value at the most.' -}, { - id: 'lessThan', - name: '< (Less than)', - validator: 'numericality', - validatorOption: 'lessThan', - description: 'The attribute has to be less than this value.' -}, { - id: 'odd', - name: 'Odd', - validator: 'numericality', - validatorOption: 'odd', - description: 'The attribute has to be odd.' -}, { - id: 'even', - name: 'Even', - validator: 'numericality', - validatorOption: 'even', - description: 'The attribute has to be even.' -}]; - -// Immutable object -Object.freeze(comparators); - -export { comparators } \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/lib/removeFromArray.js b/Packages/ohif-hanging-protocols/both/lib/removeFromArray.js deleted file mode 100644 index 4bcfdda05..000000000 --- a/Packages/ohif-hanging-protocols/both/lib/removeFromArray.js +++ /dev/null @@ -1,33 +0,0 @@ -import { _ } from 'meteor/underscore'; - -/** - * Removes the first instance of an element from an array, if an equal value exists - * - * @param array - * @param input - * - * @returns {boolean} Whether or not the element was found and removed - */ -const removeFromArray = (array, input) => { - // If the array is empty, stop here - if (!array || - !array.length) { - return false; - } - - array.forEach((value, index) => { - if (_.isEqual(value, input)) { - indexToRemove = index; - return false; - } - }); - - if (indexToRemove === void 0) { - return false; - } - - array.splice(indexToRemove, 1); - return true; -}; - -export { removeFromArray }; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/both/namespace.js b/Packages/ohif-hanging-protocols/both/namespace.js deleted file mode 100644 index e6599cd5d..000000000 --- a/Packages/ohif-hanging-protocols/both/namespace.js +++ /dev/null @@ -1 +0,0 @@ -HP = {}; diff --git a/Packages/ohif-hanging-protocols/both/schema.js b/Packages/ohif-hanging-protocols/both/schema.js deleted file mode 100644 index 5da30557f..000000000 --- a/Packages/ohif-hanging-protocols/both/schema.js +++ /dev/null @@ -1,13 +0,0 @@ -// @TODO start using namespace instead - -// Base classes -import './classes/Protocol'; -import './classes/Stage'; -import './classes/Viewport'; -import './classes/ViewportStructure'; - -// Specialized Rule classes -import './classes/rules/ProtocolMatchingRule'; -import './classes/rules/StudyMatchingRule'; -import './classes/rules/SeriesMatchingRule'; -import './classes/rules/ImageMatchingRule'; diff --git a/Packages/ohif-hanging-protocols/both/testData.js b/Packages/ohif-hanging-protocols/both/testData.js deleted file mode 100644 index da0dc7890..000000000 --- a/Packages/ohif-hanging-protocols/both/testData.js +++ /dev/null @@ -1,1353 +0,0 @@ -function getDefaultProtocol() { - var protocol = new HP.Protocol('Default'); - protocol.id = 'defaultProtocol'; - protocol.locked = true; - - var oneByOne = new HP.ViewportStructure('grid', { - rows: 1, - columns: 1 - }); - - var viewport = new HP.Viewport(); - var first = new HP.Stage(oneByOne, 'oneByOne'); - first.viewports.push(viewport); - - protocol.stages.push(first); - - HP.defaultProtocol = protocol; - return HP.defaultProtocol; -} - -function getMRTwoByTwoTest() { - var proto = new HP.Protocol('MR_TwoByTwo'); - proto.id = 'MR_TwoByTwo'; - proto.locked = true; - // Use http://localhost:3000/viewer/1.2.840.113619.2.5.1762583153.215519.978957063.78 - - var studyInstanceUid = new HP.ProtocolMatchingRule('studyInstanceUid', { - equals: { - value: '1.2.840.113619.2.5.1762583153.215519.978957063.78' - } - }, true); - - proto.addProtocolMatchingRule(studyInstanceUid); - - var oneByTwo = new HP.ViewportStructure('grid', { - rows: 1, - columns: 2 - }); - - // Stage 1 - var left = new HP.Viewport(); - var right = new HP.Viewport(); - - var firstSeries = new HP.SeriesMatchingRule('seriesNumber', { - equals: { - value: 1 - } - }); - - var secondSeries = new HP.SeriesMatchingRule('seriesNumber', { - equals: { - value: 2 - } - }); - - var thirdImage = new HP.ImageMatchingRule('instanceNumber', { - equals: { - value: 3 - } - }); - - left.seriesMatchingRules.push(firstSeries); - left.imageMatchingRules.push(thirdImage); - - right.seriesMatchingRules.push(secondSeries); - right.imageMatchingRules.push(thirdImage); - - var first = new HP.Stage(oneByTwo, 'oneByTwo'); - first.viewports.push(left); - first.viewports.push(right); - - proto.stages.push(first); - - // Stage 2 - var twoByOne = new HP.ViewportStructure('grid', { - rows: 2, - columns: 1 - }); - var left2 = new HP.Viewport(); - var right2 = new HP.Viewport(); - - var fourthSeries = new HP.SeriesMatchingRule('seriesNumber', { - equals: { - value: 4 - } - }); - - var fifthSeries = new HP.SeriesMatchingRule('seriesNumber', { - equals: { - value: 5 - } - }); - - left2.seriesMatchingRules.push(fourthSeries); - left2.imageMatchingRules.push(thirdImage); - right2.seriesMatchingRules.push(fifthSeries); - right2.imageMatchingRules.push(thirdImage); - - var second = new HP.Stage(twoByOne, 'twoByOne'); - second.viewports.push(left2); - second.viewports.push(right2); - - proto.stages.push(second); - - HP.testProtocol = proto; - return HP.testProtocol; -} - -function getDemoProtocols() { - - HP.demoProtocols = []; - - /** - * Demo #1 - */ - HP.demoProtocols.push({ - "id": "demoProtocol1", - "locked": false, - "name": "DFCI-CT-CHEST-COMPARE", - "createdDate": "2017-02-14T16:07:09.033Z", - "modifiedDate": "2017-02-14T16:18:43.930Z", - "availableTo": {}, - "editableBy": {}, - "protocolMatchingRules": [ - { - "id": "7tmuq7KzDMCWFeapc", - "weight": 2, - "required": false, - "attribute": "x00081030", - "constraint": { - "contains": { - "value": "DFCI CT CHEST" - } - } - } - ], - "stages": [ - { - "id": "v5PfGt9F6mffZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [ - { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "mXnsCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "2.0" - } - } - } - ], - "studyMatchingRules": [] - }, - { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "ygz4nb28iJZcJhnYa", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "2.0" - } - } - } - ], - "studyMatchingRules": [ - { - "id": "uDoEgLTvnXTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - } - ] - } - ], - "createdDate": "2017-02-14T16:07:09.033Z" - }, - { - "id": "XTzu8HB3feep3HYKs", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [ - { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "mXnsCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "3.0" - } - } - } - ], - "studyMatchingRules": [] - }, - { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "ygz4nb28iJZcJhnYa", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "3.0" - } - } - } - ], - "studyMatchingRules": [ - { - "id": "uDoEgLTvnXTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - } - ] - } - ], - "createdDate": "2017-02-14T16:07:12.085Z" - }, - { - "id": "3yPYNaeFtr76Qz3jq", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 2, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [ - { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "mXnsCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 3.0" - } - } - } - ], - "studyMatchingRules": [] - }, - { - "viewportSettings": { - "wlPreset": "Lung" - }, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "ygz4nb28iJZcJhnYa", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 3.0" - } - } - } - ], - "studyMatchingRules": [] - }, - { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "6vdBRZYnqmmosipph", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 3.0" - } - } - } - ], - "studyMatchingRules": [ - { - "id": "SxfTyhGcMhr56PtPM", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - } - ] - }, - { - "viewportSettings": { - "wlPreset": "Lung" - }, - "imageMatchingRules": [], - "seriesMatchingRules": [ - { - "id": "FTAyChZCPW68yJjXD", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 3.0" - } - } - } - ], - "studyMatchingRules": [ - { - "id": "gMJjfrbsqYNbErPx5", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - } - ] - } - ], - "createdDate": "2017-02-14T16:11:40.489Z" - } - ], - "numberOfPriorsReferenced": 4 - }); - - /** - * Demo #2 - */ - - HP.demoProtocols.push({ - "id": "demoProtocol2", - "locked": false, - "name": "DFCI-CT-CHEST-COMPARE-2", - "createdDate": "2017-02-14T16:07:09.033Z", - "modifiedDate": "2017-02-14T16:18:43.930Z", - "availableTo": {}, - "editableBy": {}, - "protocolMatchingRules": [{ - "id": "7tmuq7KzDMCWFeapc", - "weight": 2, - "required": false, - "attribute": "x00081030", - "constraint": { - "contains": { - "value": "DFCI CT CHEST" - } - } - }], - "stages": [{ - "id": "v5PfGt9F6mffZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL56z7mac", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "2.0" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "ygz4nb28iJZcJhnYc", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "2.0" - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgLTvnXTByWnPt", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }, { - "id": "XTzu8HB3feep3HYKs", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 3.0" - } - } - }, { - "id": "mYnsCcNwZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 5.0" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "ygz4nb28iJZcJhnYa", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 3.0" - } - } - }, { - "id": "ygz4nb29iJZcJhnYa", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 5.0" - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgLTvnXTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }], - "createdDate": "2017-02-14T16:07:12.085Z" - }, { - "id": "3yPYNaeFtr76Qz3jq", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 2, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL56z7mtr", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 3.0" - } - } - }, { - "id": "jXnsCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 5.0" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": { - "wlPreset": "Lung" - }, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "ygz4nb28iJZcJhnYb", - "weight": 2, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 3.0" - } - } - }, { - "id": "ycz4nb28iJZcJhnYa", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 5.0" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "6vdBRZYnqmmosipph", - "weight": 2, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 3.0" - } - } - }, { - "id": "6vdBRFYnqmmosipph", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 5.0" - } - } - }], - "studyMatchingRules": [{ - "id": "SxfTyhGcMhr56PtPM", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }, { - "viewportSettings": { - "wlPreset": "Lung" - }, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "FTAyChZCPW68yJjXD", - "weight": 2, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 3.0" - } - } - }, { - "id": "DTAyChZCPW68yJjXD", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 5.0" - } - } - }], - "studyMatchingRules": [{ - "id": "gMJjfrbsqYNbErPx5", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }], - "createdDate": "2017-02-14T16:11:40.489Z" - }], - "numberOfPriorsReferenced": 1 - }); - - /** - * Demo: screenCT - */ - - HP.demoProtocols.push({ - "id": "screenCT", - "locked": false, - "name": "DFCI-CT-CHEST-SCREEN", - "createdDate": "2017-02-14T16:07:09.033Z", - "modifiedDate": "2017-02-14T16:18:43.930Z", - "availableTo": {}, - "editableBy": {}, - "protocolMatchingRules": [{ - "id": "7tmuq7KzDMCWFeapc", - "weight": 2, - "required": false, - "attribute": "x00081030", - "constraint": { - "contains": { - "value": "DFCI CT CHEST" - } - } - }], - "stages": [{ - "id": "v5PfGt9F6mffZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 1 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL55z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "2.0" - } - } - }], - "studyMatchingRules": [] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }, - { - "id": "v5PfGt9F4mffZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 2, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL56z7nTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 5.0" - } - } - }, { - "id": "mXnsCcNzZL56z7rTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 3.0" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL56r7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 5.0" - } - } - }, { - "id": "mXnsCcNzZL56a7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Lung 3.0" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcRzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 4.0" - } - } - }, { - "id": "mXnsCcNzTL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Coronal" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcMzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Body 4.0" - } - } - }, { - "id": "mXnsCcAzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Sagittal" - } - } - }], - "studyMatchingRules": [] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }], - "numberOfPriorsReferenced": 0 - }); - - /** - * Demo: PETCTSCREEN - */ - - HP.demoProtocols.push({ - "id": "PETCTSCREEN", - "locked": false, - "name": "PETCT-SCREEN", - "createdDate": "2017-02-14T16:07:09.033Z", - "modifiedDate": "2017-02-14T16:18:43.930Z", - "availableTo": {}, - "editableBy": {}, - "protocolMatchingRules": [{ - "id": "7tmuqgKzDMCWFeapc", - "weight": 5, - "required": false, - "attribute": "x00081030", - "constraint": { - "contains": { - "value": "PETCT" - } - } - }], - "stages": [{ - "id": "v5PfGt9F6mFgZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcAzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Topogram" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZR56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Topogram" - } - } - }, { - "id": "mRnsCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x00200011", - "constraint": { - "numericality": { - "greaterThanOrEqualTo": 2 - } - } - }], - "studyMatchingRules": [] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }, { - "id": "v5PfGt9F6mFgZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsGcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "PET WB Corrected" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsHcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "CT WB" - } - } - }], - "studyMatchingRules": [] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }, { - "id": "v5PfGt9F6mFgZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": { - "invert": "YES" - }, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXneCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "PET WB Uncorrected" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCuNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "CT Nk" - } - } - }], - "studyMatchingRules": [] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }], - "numberOfPriorsReferenced": 0 - }); - - /** - * Demo: PETCTCOMPARE - */ - - HP.demoProtocols.push({ - "id": "PETCTCOMPARE", - "locked": false, - "name": "PETCT-COMPARE", - "createdDate": "2017-02-14T16:07:09.033Z", - "modifiedDate": "2017-02-14T16:18:43.930Z", - "availableTo": {}, - "editableBy": {}, - "protocolMatchingRules": [{ - "id": "7tmuqgKzDMCWFeapc", - "weight": 5, - "required": false, - "attribute": "x00081030", - "constraint": { - "contains": { - "value": "PETCT" - } - } - }], - "stages": [{ - "id": "v5PfGt9F6mFgZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL59z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Topogram" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL56z7lTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Topogram" - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgLTbnXTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }, { - "id": "v5PfGt9F6mFgZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 1, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNjZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Topogram" - } - } - }, { - "id": "mXnsCcNzZL56z7gTZ", - "weight": 1, - "required": false, - "attribute": "x00200011", - "constraint": { - "numericality": { - "greaterThanOrEqualTo": 2 - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcCzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "Topogram" - } - } - }, { - "id": "mXnsCcNzZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x00200011", - "constraint": { - "numericality": { - "greaterThanOrEqualTo": 2 - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgLTvn1TByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }, { - "id": "v5PfGt9F6mFgZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 2, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL26z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "PET WB Corrected" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL46z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "CT WB" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL57z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "PET WB Corrected" - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgLTvnYTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZQ56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "CT WB" - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgLTvnKTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }, { - "id": "v5PfGt9F6mFgZPif5", - "name": "oneByOne", - "viewportStructure": { - "type": "grid", - "properties": { - "rows": 2, - "columns": 2 - }, - "layoutTemplateName": "gridLayout" - }, - "viewports": [{ - "viewportSettings": { - "invert": "YES" - }, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZL56z7nTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "PET WB Uncorrected" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNxZL56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "CT Nk" - } - } - }], - "studyMatchingRules": [] - }, { - "viewportSettings": { - "invert": "YES" - }, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZA56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "PET WB Uncorrected" - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgHTvnXTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }, { - "viewportSettings": {}, - "imageMatchingRules": [], - "seriesMatchingRules": [{ - "id": "mXnsCcNzZP56z7mTZ", - "weight": 1, - "required": false, - "attribute": "x0008103e", - "constraint": { - "contains": { - "value": "CT Nk" - } - } - }], - "studyMatchingRules": [{ - "id": "uDoEgITvnXTByWnPz", - "weight": 1, - "required": false, - "attribute": "abstractPriorValue", - "constraint": { - "equals": { - "value": 1 - } - } - }] - }], - "createdDate": "2017-02-14T16:07:09.033Z" - }], - "numberOfPriorsReferenced": 1 - }); - -} - -getDefaultProtocol(); -//getMRTwoByTwoTest(); -//getDemoProtocols(); diff --git a/Packages/ohif-hanging-protocols/client/collections.js b/Packages/ohif-hanging-protocols/client/collections.js deleted file mode 100644 index 132256fe3..000000000 --- a/Packages/ohif-hanging-protocols/client/collections.js +++ /dev/null @@ -1,12 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { comparators } from '../both/lib/comparators'; - -MatchedProtocols = new Meteor.Collection(null); -MatchedProtocols._debugName = 'MatchedProtocols'; - -Comparators = new Meteor.Collection(null); -Comparators._debugName = 'Comparators'; - -comparators.forEach(item => { - Comparators.insert(item); -}); diff --git a/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.html b/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.html deleted file mode 100644 index fe0e65d52..000000000 --- a/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.html +++ /dev/null @@ -1,26 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.js b/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.js deleted file mode 100644 index 7a66e6c82..000000000 --- a/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.js +++ /dev/null @@ -1,20 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -Template.matchedProtocols.helpers({ - /** - * Reactively re-render the MatchedProtocols Collection contents - */ - matchedProtocols() { - return MatchedProtocols.find(); - } -}); - -Template.matchedProtocols.events({ - /** - * Instruct the ProtocolEngine to apply the specified Hanging Protocol - */ - 'click .matchedProtocol': function() { - var protocol = this; - ProtocolEngine.setHangingProtocol(protocol); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.styl b/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.styl deleted file mode 100644 index 17b54d85f..000000000 --- a/Packages/ohif-hanging-protocols/client/components/matchedProtocols/matchedProtocols.styl +++ /dev/null @@ -1,14 +0,0 @@ -#matchedProtocols - ul.dropdown-menu - li - a - cursor: pointer - - &:selected - color: #4fbfff - - h5 - display: block; - padding: 3px 20px; - clear: both; - line-height: 1.42857143; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.html b/Packages/ohif-hanging-protocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.html deleted file mode 100644 index 0e9ca24c2..000000000 --- a/Packages/ohif-hanging-protocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.html +++ /dev/null @@ -1,19 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js b/Packages/ohif-hanging-protocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js deleted file mode 100644 index a4c5f51f6..000000000 --- a/Packages/ohif-hanging-protocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js +++ /dev/null @@ -1,44 +0,0 @@ -Template.nextPresentationGroupButton.helpers({ - /** - * Check if a later stage exists for the user to switch to - * - * @returns {boolean} Whether or not a later stage exists - */ - nextNotAvailable() { - // Run this helper whenever the ProtocolEngine / LayoutManager has changed - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine has been defined yet, stop here - if (!ProtocolEngine) { - return; - } - - // Return whether or not the current stage is the last stage - return ProtocolEngine.stage === ProtocolEngine.getNumProtocolStages() - 1; - } -}); - -Template.nextPresentationGroupButton.events({ - /** - * Switch to the next Presentation group - * - * @param event The click event on the button - */ - 'click #nextPresentationGroup'(event) { - // If no ProtocolEngine has been defined yet, do nothing - if (!ProtocolEngine) { - return; - } - - // Stop here if the tool is disabled - if ($(event.currentTarget).hasClass('disabled')) { - return; - } - - // Hide the button's Bootstrap tooltip in case it was shown - $(event.currentTarget).tooltip('hide'); - - // Instruct the ProtocolEngine to switch to the next stage - ProtocolEngine.nextProtocolStage(); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.html b/Packages/ohif-hanging-protocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.html deleted file mode 100644 index eb1973b14..000000000 --- a/Packages/ohif-hanging-protocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.html +++ /dev/null @@ -1,19 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.js b/Packages/ohif-hanging-protocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.js deleted file mode 100644 index c59a663f3..000000000 --- a/Packages/ohif-hanging-protocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.js +++ /dev/null @@ -1,44 +0,0 @@ -Template.previousPresentationGroupButton.helpers({ - /** - * Check if an earlier stage exists for the user to switch to - * - * @returns {boolean} Whether or not an earlier stage exists - */ - previousNotAvailable() { - // Run this helper whenever the ProtocolEngine / LayoutManager has changed - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine has been defined yet, stop here - if (!ProtocolEngine) { - return; - } - - // Return whether or not the current stage is the first stage - return ProtocolEngine.stage === 0; - } -}); - -Template.previousPresentationGroupButton.events({ - /** - * Switch to the previous Presentation group - * - * @param event The click event on the button - */ - 'click #previousPresentationGroup'(event) { - // If no ProtocolEngine has been defined yet, do nothing - if (!ProtocolEngine) { - return; - } - - // Stop here if the tool is disabled - if ($(event.currentTarget).hasClass('disabled')) { - return; - } - - // Hide the button's Bootstrap tooltip in case it was shown - $(event.currentTarget).tooltip('hide'); - - // Instruct the ProtocolEngine to switch to the next stage - ProtocolEngine.previousProtocolStage(); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.html b/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.html deleted file mode 100644 index e2e33bed3..000000000 --- a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.html +++ /dev/null @@ -1,126 +0,0 @@ - diff --git a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.js b/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.js deleted file mode 100644 index 1ae522a5a..000000000 --- a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.js +++ /dev/null @@ -1,386 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { Random } from 'meteor/random'; -import { $ } from 'meteor/jquery'; - -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; - -/** - * Updates the Hanging Protocol Select2 Input - */ -function updateProtocolSelect() { - if (!ProtocolEngine) { - return; - } - - // Loop through the available hanging protocols - // to create an array with the protocols that includes - // a property labelled 'text', so that Select2 has something - // to display - var protocolsSelect2Data = HP.ProtocolStore.getProtocol().map(function(protocol) { - return { - id: protocol.id, - text: protocol.name - }; - }); - - // Select the Protocol select DOM element - var protocolSelect = $('#protocolSelect'); - - // Empty the element using Select2 for rerendering - protocolSelect.select2().empty(); - - // Initialize the select element with Select2 using the - // array of protocols - protocolSelect.select2({ - data: protocolsSelect2Data - }); - - // Update the ProtocolSelector to display the current active Protocol - protocolSelect.select2().val(ProtocolEngine.protocol.id).trigger('change'); -} - -Template.protocolEditor.onRendered(() => { - const instance = Template.instance(); - - instance.timeAgoInterval = Meteor.setInterval(() => { - // Run this every minute - Session.set('timeAgoVariable', new Date()); - }, 60000); - - // Update the Protocol select box when the hanging protocol store is ready - HP.ProtocolStore.onReady(() => { - updateProtocolSelect(); - }); -}); - -Template.protocolEditor.onDestroyed(() => { - const instance = Template.instance(); - - Meteor.clearInterval(instance.timeAgoInterval); -}); - -Template.protocolEditor.helpers({ - /** - * Reactively updates the active Protocol - * - * @returns {*} The currently active Protocol Model - */ - activeProtocol() { - // Whenever the Layout Manager is updated, trigger this helper - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine, protocol, or stage is defined, stop here - if (!ProtocolEngine || - !ProtocolEngine.protocol || - !ProtocolEngine.LayoutManager || - ProtocolEngine.stage === undefined) { - return; - } - - // Update the Protocol Select box - updateProtocolSelect(); - - // Make sure that the number of referenced priors is correct - ProtocolEngine.protocol.updateNumberOfPriorsReferenced(); - - // Otherwise, return the active Hanging Protocol - return ProtocolEngine.protocol; - }, - /** - * Reactively updates the active Protocol Stage - * - * @returns {*} The current Protocol's active Stage model - */ - activeStage() { - // Whenever the Layout Manager is updated, trigger this helper - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine, protocol, or stage is defined, stop here - if (!ProtocolEngine || - !ProtocolEngine.protocol || - !ProtocolEngine.LayoutManager || - ProtocolEngine.stage === undefined) { - return; - } - - // Retrieve the Stage Model for the current Protocol's active Stage - var stage = ProtocolEngine.getCurrentStageModel(); - if (!stage) { - return; - } - - // Update active Stage's layout template and properties based on the displayed - // layout properties. This is used to update the Stage Model when the user modifies - // the layout in the viewer - stage.viewportStructure.layoutTemplateName = ProtocolEngine.LayoutManager.layoutTemplateName; - stage.viewportStructure.properties = ProtocolEngine.LayoutManager.layoutProps; - - // If there is a discrepancy between the Stage's number of viewports and the - // the number of required viewports given the properties above, rectify it - // by removing or adding Viewports to the stage - // - // First, calculate the difference, if any exists - var difference = stage.viewportStructure.getNumViewports() - stage.viewports.length; - - if (difference < 0) { - // Make the viewport difference into a positive value - var absDifference = Math.abs(difference); - - // If there are more Viewports defined than necessary, remove the extraneous Viewports - var position = stage.viewports.length - absDifference; - - // Splice extra viewports from the Stage's viewports array - stage.viewports.splice(position, absDifference); - } else if (difference > 0) { - // If there are less Viewports defined than necessary, add viewports until we reach the - // required amount - - // Count up until the difference in number of Viewports - for (var i = 0; i < difference; i++) { - // Instantiate a new Viewport Model - var viewport = new HP.Viewport(); - - // Add new Viewports to the Stage's viewports array - stage.viewports.push(viewport); - } - } - - // Return the current Stage model for the active Protocol - return ProtocolEngine.getCurrentStageModel(); - }, - activeViewportUndefined() { - const viewportIndex = Session.get('activeViewport'); - return (viewportIndex === undefined); - } -}); - -Template.protocolEditor.events({ - /** - * Creates a new Hanging Protocol and displays it in the Viewer - */ - 'click #newProtocol'() { - // Clone the default Protocol - var protocol = HP.defaultProtocol.createClone(); - - // Change the Protocol name to state that it is New, and give it a timestamp - protocol.name = 'New (created ' + moment().format('h:mm:ss a') + ')'; - - // Change the Protocol ID from the default value - protocol.id = Random.id(); - - // Insert the protocol - HP.ProtocolStore.addProtocol(protocol); - - // Activate the new Protocol using the ProtocolEngine - ProtocolEngine.setHangingProtocol(protocol); - - // Update the protocol selector to display the new Protocols - updateProtocolSelect(); - }, - /** - * Rename the current Protocol - */ - 'click #renameProtocol'() { - var selectedProtocol = this; - if (selectedProtocol.locked) { - return; - } - - // Define some details for the text entry dialog - var title = 'Rename Protocol'; - var instructions = 'Enter a new name'; - var currentValue = selectedProtocol.name; - - // Open the text entry dialog with the details above - // and fire the callback function when finished. - openTextEntryDialog(title, instructions, currentValue, function(value) { - // Update the name with the entered text - selectedProtocol.name = value; - - // Update the protocol - HP.ProtocolStore.updateProtocol(selectedProtocol.id, selectedProtocol); - - // Update the protocol selector - updateProtocolSelect(); - }); - }, - /** - * Import a Protocol - */ - 'click #importProtocol'() { - // Hide the protocol dropdown manually, because it is not hidden automatically - // when it has input as a child - $("#protocolDropdown").dropdown('toggle'); - }, - /** - * Triggers a custom event when for the HTML5 File input when files are selected - * - * @param event The Change event for the input - */ - 'change .btn-file :file': function(event) { - // http://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3/ - - // Find the Input in the DOM - var input = $(event.currentTarget); - - // Get the number of selected files - var numFiles = input.get(0).files ? input.get(0).files.length : 1; - - // Get the label of the file - var label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); - - // Trigger our custom event with the number of files and label - input.trigger('fileselect', [numFiles, label]); - }, - /** - * Imports files selected by the user into the Hanging Protocols Collection - * - * @param event The custom fileselect event - */ - 'fileselect .btn-file :file': function(event) { - // Retreieve the FileList - var files = event.target.files; - - // Create an HTML5 File Reader - var reader = new FileReader(); - - reader.onload = () => { - var protocolToImport = JSON.parse(reader.result); - - // Insert the protocol - HP.ProtocolStore.addProtocol(protocolToImport); - - // Update the protocol selector to display the imported Protocol - updateProtocolSelect(); - }; - - // Instruct the FileReader to read the (first) selected file - // TODO: Update to allow batch uploads? - reader.readAsText(files[0], 'utf-8'); - }, - /** - * Set the Hanging Protocol when the select box is changed - * - * @param event The select2:select event - */ - 'select2:select #protocolSelect': function(event) { - // Retrieve the protocolId - var protocolId = event.params.data.id; - - // Retrieve the protocol from the protocol store - var selectedProtocol = HP.ProtocolStore.getProtocol(protocolId); - - // If it doesn't exist, stop here - if (!selectedProtocol) { - return; - } - - // Set the current Hanging Protocol to the user-specified Protocol - ProtocolEngine.setHangingProtocol(selectedProtocol); - }, - /** - * Allow the Protocols / Stage navigation tabs to toggle the - * 'active' class when clicked - */ - 'click .navigationButtons a'() { - $(this).addClass('active').siblings().removeClass('active'); - }, - /** - * Update the protocol with the latest changes to the current Protocol - */ - 'click #saveProtocol'() { - var selectedProtocol = this; - if (selectedProtocol.locked) { - return; - } - - // Update the Protocol's modifiedDate and modifiedBy User details - selectedProtocol.protocolWasModified(); - - // Update the current Protocol in the database with the latest changes - HP.ProtocolStore.updateProtocol(selectedProtocol.id, selectedProtocol); - }, - /** - * Save the current Protocol as a new document - */ - 'click #saveAsProtocol'() { - var selectedProtocol = this; - - // Clone the selected Protocol - var protocol = selectedProtocol.createClone(); - - // Define some details for the text entry dialog - var title = 'Save Protocol As'; - var instructions = 'Enter a new name'; - var currentValue = protocol.name; - - // Open the text entry dialog with the details above - // and fire the callback function when finished. - openTextEntryDialog(title, instructions, currentValue, function(value) { - // Create a new ID for the protocol - protocol.id = Random.id(); - - // Update the name with the entered text - protocol.name = value; - - // Unlock the protocol - protocol.locked = false; - - // Update the Protocol's modifiedDate and modifiedBy User details - protocol.protocolWasModified(); - - // Insert the new Protocol - HP.ProtocolStore.addProtocol(protocol); - - // Activate the new Protocol using the ProtocolEngine - ProtocolEngine.setHangingProtocol(protocol); - - // Update the protocol selector to display the new Protocols - updateProtocolSelect(); - }); - }, - /** - * Export the currently selected Protocol as a JSON file - */ - 'click #exportJSON'() { - var selectedProtocol = this; - - var protocolJSON = JSON.stringify(selectedProtocol, null, 2), - currentDate = new Date(), - filename = selectedProtocol.name + '-' + (currentDate.getTime().toString()) + '.json', - protocolBlob = new Blob([protocolJSON], { type: 'application/json' }); - - var downloadElement = document.getElementById('downloadElement'); - downloadElement.href = URL.createObjectURL(protocolBlob); - downloadElement.download = filename; - downloadElement.click(); - }, - /** - * Delete the currently selected Protocol - */ - 'click #deleteProtocol'() { - var selectedProtocol = this; - if (selectedProtocol.locked) { - return; - } - - var options = { - title: 'Delete Protocol', - text: 'Are you sure you would like to remove this Protocol? This cannot be reversed.' - }; - - OHIF.viewerbase.dialogUtils.showConfirmDialog(() => { - // Remove the Protocol - HP.ProtocolStore.removeProtocol(selectedProtocol.id); - - // Reset the ProtocolEngine to the next best match - ProtocolEngine.reset(); - - // Update the protocol selector - updateProtocolSelect(); - }, options); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.styl b/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.styl deleted file mode 100644 index e339d7538..000000000 --- a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.styl +++ /dev/null @@ -1,152 +0,0 @@ -@import "{ohif:design}/app" - -$height = 20px - -#protocolEditor - theme('background', '$primaryBackgroundColor') - height: 100% - width: 450px - padding: 10px 0 - position: absolute - top: 0 - - .navigationButtonsContainer - margin-left: 0 - margin-right: 0 - - .navigationButtons - ul - margin: 0 auto - width: 300px - - li - text-align: center - width: 150px - margin: 0 - - &:first-child:not(:last-child) - a - border-top-right-radius: 0 - border-bottom-right-radius: 0 - - &:last-child:not(:first-child) - a - border-top-left-radius: 0 - border-bottom-left-radius: 0 - - a - padding: 3px 9px - cursor: pointer - text-decoration: none - outline: none - theme('background-color', '$uiGrayDark') - theme('border', '2px solid $uiBorderColorDark') - theme('color', '$textSecondaryColor') - transition($sidebarTransition) - border-radius: $height - - &.active a - theme('background-color', '$activeColor') - theme('border-color', '$uiBorderColorActive') - theme('color', '$textColorActive') - transition($sidebarTransition) - - p - h2 - h3 - h4 - theme('color', '$defaultColor') - - label - ul - theme('color', '$defaultColor') - font-weight: 400 - - label - margin-right: 10px - width: 25% - - input[type='number'] - input[type='text'] - min-width: 50px - width: 40% - border: none - background: #212121 - theme('color', '$defaultColor') - text-align: center - - button.btn - background: #ffffff - color: #3e3e3e - - .tab-content - height: calc(100% - 60px) - overflow: auto; - - .protocolEditorSection - padding: 10px - margin: 10px 0 - - #protocolOptions - text-align: center - position: absolute - bottom: 0 - width: 100% - margin-bottom: 0 - theme('background', '$uiGrayDarker') - - p - font-size: 8pt - theme('color', '$defaultColor') - margin: 0 10px - display: inline-block - - #editProtocol - overflow-y: auto - overflow-x: hidden - padding-right: 16px - padding-left: 20px - margin-right: -16px - width: 100% - height: calc(100% - 50px) - &::-webkit-scrollbar - display: none - - #selectProtocol - text-align: center - - .btn-file - position: relative - overflow: hidden - - .btn-file input[type=file] - position: absolute - top: 0 - right: 0 - min-width: 100% - min-height: 100% - font-size: 100px - text-align: right - filter: 'alpha(opacity=0)' - opacity: 0 - outline: none - background: white - cursor: inherit - display: block - - .protocolDropdown - display: inline-block - - ul - li - a - cursor: pointer - - #activeViewportEditor - padding: 10px - - .noActiveViewport - padding: 40px - - h3 - theme('color', '$defaultColor') diff --git a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.html b/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.html deleted file mode 100644 index 40d428830..000000000 --- a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.html +++ /dev/null @@ -1,47 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.js b/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.js deleted file mode 100644 index 4a29bcc25..000000000 --- a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.js +++ /dev/null @@ -1,420 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { Session } from 'meteor/session'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; - -import { OHIF } from 'meteor/ohif:core'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -const keys = { - ESC: 27 -}; - -/** - * Close the specified dialog element and return browser - * focus to the active viewport. - * - * @param dialog The DOM element of the dialog to close - */ -function closeHandler(dialog) { - // Hide the lesion dialog - $(dialog).css('display', 'none'); - - // Remove the backdrop - $('.removableBackdrop').remove(); - - // Restore the focus to the active viewport - Viewerbase.setFocusToActiveViewport(); -} - -/** - * Displays and updates the UI of the Rule Entry Dialog given a new set of - * attributes, the rule level (protocol, study, series, or instance), and an - * optional rule to edit. - * - * @param attributes List of attributes the user can set - * @param level Level of the Rule to create / edit - * @param rule Optional Rule - */ -openRuleEntryDialog = function(attributes, level, rule) { - // Get the lesion location dialog - var dialog = $('.ruleEntryDialog'); - - // Clear any input that is still on the page - var currentValueInput = dialog.find('input.currentValue'); - currentValueInput.val(''); - - // Store the Dialog DOM data, rule level and rule in the template data - Template.ruleEntryDialog.dialog = dialog; - Template.ruleEntryDialog.level = level; - Template.ruleEntryDialog.rule = rule; - - // Initialize the Select2 search box for the attribute list - var attributeSelect = dialog.find('.attributes'); - attributeSelect.html('').select2({ - data: attributes, - placeholder: 'Select an attribute', - allowClear: true - }); - - // If a rule has been provided, set the value of the attribute Select2 input - // to the attribute set in the rule. - if (rule && rule.attribute) { - attributeSelect.val(rule.attribute); - } - - // Event data to be passed to the event handler - let eventData; - - // If a rule has been provided, use its constraint to find the relevant Comparator - if (rule && rule.constraint) { - var validator = Object.keys(rule.constraint)[0]; - var validatorOption = Object.keys(rule.constraint[validator])[0]; - var comparator = Comparators.findOne({ - validator: validator, - validatorOption: validatorOption - }); - - // Set the current value input based on the rule constraint - var currentValue = rule.constraint[validator][validatorOption]; - currentValueInput.val(currentValue); - - eventData = currentValue; - - // If a Comparator was found, set the default value of the Comparators select2 box - // to the comparatorId in the input rule - if (comparator) { - // Trigger('change') is used to update the Select2 choice in the UI - dialog.find('.comparators').val(comparator.id).trigger('change'); - } - } - - // Trigger('change') is used to update the Select2 choice in the UI and so - // that the currentValue is updated based on the current attribute - attributeSelect.trigger('change', eventData); - - // Update the dialog's CSS so that it is visible on the page - dialog.css('display', 'block'); - - // Show the backdrop - Blaze.render(Template.removableBackdrop, document.body); - - // Make sure the context menu is closed when the user clicks away - $('.removableBackdrop').one('mousedown touchstart', function() { - closeHandler(dialog); - }); -}; - -/** - * Retrieves the current active element's imageId using Cornerstone - */ -function getActiveViewportImageId() { - const enabledElement = Viewerbase.viewportUtils.getEnabledElementForActiveElement(); - - if (!enabledElement) { - return; - } - - // Return the enabled element's imageId - return enabledElement.image.imageId; -} - -function getAbstractPriorValue(imageId) { - // @TypeSafeStudies - // Retrieves the first study of the collection using the given sort order. - // Since we're only interrested in the first record, "null" will be used - // as search criteria (thus no actual search will be made). - const currentStudy = OHIF.viewer.Studies.findBy(null, { - sort: [ ['studyDate', 'desc'] ] - }); - - if (!currentStudy) { - return; - } - - const priorStudy = cornerstone.metaData.get('study', imageId); - if (!priorStudy) { - return; - } - - const studies = OHIF.studylist.collections.Studies.find({ - patientId: currentStudy.patientId, - studyDate: { - $lt: currentStudy.studyDate - } - }, { - sort: { - studyDate: -1 - } - }); - - let priorIndex = 0; - - // TODO: Check what the abstract prior value should equal for an unrelated study? - studies.forEach(function(study, index) { - if (study.studyInstanceUid === priorStudy.studyInstanceUid) { - // Abstract prior index starts from 1 in the DICOM standard - // so we add 1 here - priorIndex = index + 1; - return false; - } - }); - - return priorIndex; -} - -/** - * Retrieve the current value of a metadata tag or property. It searches the value in different levels (study, series or instance) - * @param {String} tagOrProperty DICOM Tag or Property name (Ex: 'x00100020', 'patientId') - * @return {Any} The value of the DICOM tag or property name - */ -const getCurrentTagOrPropertyValue = tagOrProperty => { - // Retrieve the active viewport's imageId. If none exists, stop here - const imageId = getActiveViewportImageId(); - if (!imageId) { - return; - } - - if (tagOrProperty === 'abstractPriorValue') { - return getAbstractPriorValue(imageId); - } - - // Create the object for the instance metadata - let instance; - - OHIF.viewer.StudyMetadataList.find(studyMetadata => { - // Search for the instance that has the current imageId - instance = studyMetadata.findInstance(instance => { - return instance.getImageId() === imageId; - }); - - // If instance if found stop the search - return !!instance; - }); - - // No instance found - if (!instance) { - return; - } - - // Get the value for the given tag - // It searches the value in different levels (study, series or instance) - const tagOrPropertyValue = instance.getTagValue(tagOrProperty); - - // If not found, is a custom Hanging Protocol attribute - if (tagOrPropertyValue === void 0) { - return HP.attributeDefaults[tagOrProperty]; - } - - return tagOrPropertyValue; -}; - -Template.ruleEntryDialog.onCreated(function() { - // Define the ReactiveVars that will be used to link aspects of the UI - var template = this; - // Note: currentValue's initial value must be a string so the template renders properly - template.currentValue = new ReactiveVar(''); - template.attribute = new ReactiveVar(); - template.comparatorId = new ReactiveVar(); -}); - -Template.ruleEntryDialog.onRendered(function() { - // Initialize the Comparators Select2 box - var template = Template.instance(); - template.$('.comparators').select2(); - - // Get the default Comparator from the Select2 box and use it to - // initialize the comparatorId ReactiveVar - var comparatorId = template.$('.comparators').val(); - template.comparatorId.set(comparatorId); - - const dialog = template.$('.ruleEntryDialog'); - dialog.draggable(); -}); - -Template.ruleEntryDialog.helpers({ - /** - * Returns the Comparators Collection to the Template with reactive rerendering - */ - comparators: function() { - return Comparators.find(); - }, - /** - * Reactively updates the current value of the selected attribute for the selected image - * - * @returns {*} Attribute value for the active image - */ - currentValue: function() { - return Template.instance().currentValue.get(); - } -}); - -Template.ruleEntryDialog.events({ - /** - * Save a rule that is being edited - * - * @param event the Click event - * @param template The template context - */ - 'click #save': function(event, template) { - // Retrieve the input properties to the template - var dialog = Template.ruleEntryDialog.dialog; - var level = Template.ruleEntryDialog.level; - - // Retrieve the current values for the attribute value and comparatorId - var attribute = template.attribute.get(); - var comparatorId = template.comparatorId.get(); - var currentValue = template.currentValue.get(); - - // If currentValue input is undefined, prevent saving this rule - if (currentValue === undefined) { - return; - } - - // Check if we are editing a rule or creating a new one - var rule; - if (Template.ruleEntryDialog.rule) { - // If we are editing a rule, change the rule data - rule = Template.ruleEntryDialog.rule; - } else { - // If we are creating a rule, obtain the active Viewport model - // from the Protocol and Stage - var viewport = getActiveViewportModel(); - - // Create a rule depending on the level property of this dialog - switch (level) { - case 'protocol': - rule = new HP.ProtocolMatchingRule(); - ProtocolEngine.protocol.addProtocolMatchingRule(rule); - break; - case 'study': - rule = new HP.StudyMatchingRule(); - viewport.studyMatchingRules.push(rule); - break; - case 'series': - rule = new HP.SeriesMatchingRule(); - viewport.seriesMatchingRules.push(rule); - break; - case 'instance': - rule = new HP.ImageMatchingRule(); - viewport.imageMatchingRules.push(rule); - break; - } - } - - // Find the Comparator from the Comparators Collection given its ID - var comparator = Comparators.findOne({ - id: comparatorId - }); - - // Create a new constraint to add to the rule - var constraint = {}; - constraint[comparator.validator] = {}; - constraint[comparator.validator][comparator.validatorOption] = currentValue; - - // Set the attribute and constraint of the rule - rule.attribute = attribute; - rule.constraint = constraint; - - // Instruct the Protocol Engine to update the Layout Manager with new data - var viewportIndex = Session.get('activeViewport'); - ProtocolEngine.updateViewports(viewportIndex); - - // Close the dialog - closeHandler(dialog); - }, - /** - * Allow the user to click the Cancel button to close the dialog - */ - 'click #cancel': function() { - var dialog = Template.ruleEntryDialog.dialog; - closeHandler(dialog); - }, - /** - * Allow Esc keydown events to close the dialog - * - * @param event The Keydown event details - * @returns {boolean} Return false to prevent bubbling of the event - */ - 'keydown .ruleEntryDialog': function(event) { - var dialog = Template.ruleEntryDialog.dialog; - - // If Esc key is pressed, close the dialog - if (event.which === keys.ESC) { - closeHandler(dialog); - return false; - } - }, - /** - * Update the currentValue ReactiveVar if the user changes the attribute - * - * @param event The Change event for the select box - * @param template The current template context - */ - 'change select.attributes'(event, template, currentValue) { - // Obtain the user-specified attribute to test against - const attribute = $(event.currentTarget).val(); - - // Store it in the ReactiveVar - template.attribute.set(attribute); - - // Store this attribute in the template data context - Template.ruleEntryDialog.selectedAttribute = attribute; - - // // Get the level of this dialog - // var level = Template.ruleEntryDialog.level; - - let value; - - // Preset currentValue, use it - if (currentValue) { - value = currentValue; - } - else { - // Retrieve the current value of the attribute for the active viewport model - value = getCurrentTagOrPropertyValue(attribute); - } - - // Update the ReactiveVar with the user-specified value - template.currentValue.set(value); - - // Enforce to update the input value (Otherwise, ReactiveVar does not update input value with the same values) - const currentValueInput = $('.ruleEntryDialog').find('input.currentValue'); - currentValueInput.val(value); - }, - /** - * Update the currentValue ReactiveVar if the user changes the attribute value - * - * @param event The Change event for the input - * @param template The current template context - */ - 'change input.currentValue': function(event, template) { - // Get the DOM element representing the input box - var input = $(event.currentTarget); - - // Get the current value of the input - var value = input.val(); - - // If the input is of type 'number', parse it as a Float - if (input.attr('type') === 'number') { - value = parseFloat(value); - } - - // Update the ReactiveVar with the user-specified value - template.currentValue.set(value); - }, - /** - * Update the comparatorId ReactiveVar whenever the Comparators select box is changed - * - * @param event The Change event for the select box - * @param template The current template context - */ - 'change select.comparators': function(event, template) { - // Get the current value of the select box - var comparatorId = $(event.currentTarget).val(); - - // Update the ReactiveVar with the value of the Comparators select box - template.comparatorId.set(comparatorId); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.styl b/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.styl deleted file mode 100644 index 4c34f59c7..000000000 --- a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.styl +++ /dev/null @@ -1,44 +0,0 @@ -@import "{ohif:design}/app" - -.ruleEntryDialog - theme('background', '$uiGrayDarkest', 0.95) - theme('border', '1px solid $uiBorderColor', 0.95) - theme('color', '$textSecondaryColor') - position: absolute - top: 0 - bottom: 0 - left: 0 - right: 0 - z-index: 100 - width: 350px - height: 230px - margin: auto - padding: 10px - background-color: rgba(255,255,255,1) - outline: none - border-radius: 8px - - .dialogContent - text-align: center - margin-bottom: 10px - - .row - margin: 15px 0 - - .btn - text-decoration: none - - #cancel - float: left - - #save - float: right - - input.currentValue - width: 95% - text-align: center - padding: 4px - color: black - height: 30px - border-radius: 2px - border: 0 diff --git a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.html b/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.html deleted file mode 100644 index 3af9e7e65..000000000 --- a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.html +++ /dev/null @@ -1,32 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.js b/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.js deleted file mode 100644 index 2a76b00b7..000000000 --- a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.js +++ /dev/null @@ -1,130 +0,0 @@ -Template.ruleTable.helpers({ - /** - * Retrieve validation data on each rule for the active viewport - * - * @returns {boolean} Whether or not the current rule passed for the active viewport - */ - rulePassed: function() { - // Retrieve the latest match details given the active viewport index - var viewportIndex = Session.get('activeViewport'); - var details = ProtocolEngine.matchDetails[viewportIndex]; - - // If no match was found, stop here - if (!details || !details.bestMatch) { - return; - } - - // Retrieve the list of failed rules for this Viewport - var failed = details.bestMatch.matchDetails.failed; - - // Check if the current rule failed or not - var rule = this; - var hasPassed = true; - failed.forEach(function(failedRuleData) { - var failedRule = failedRuleData.rule; - if (failedRule.id === rule.id) { - hasPassed = false; - return false; - } - }); - - // Return a boolean representing whether or not the rule passed - return hasPassed; - } -}); - -Template.ruleTable.events({ - /** - * Opens the Rule Entry dialog to allow the user to create a new rule - * Specifies attributes and rule level for the Rule Entry dialog - * based on the data given to this template. - */ - 'click .addRule': function() { - // Get the current template data - var data = Template.currentData(); - - // Retrieve the rule attributes and level (e.g. study / series / instance) - var attributes = data.attributes; - var level = data.level; - - // Open the Rule Entry Dialog with the attributes, level, and rule - openRuleEntryDialog(attributes, level); - }, - /** - * Opens the Rule Entry dialog to allow the user to edit an existing - * rule. Passes rule details to the dialog so its current properties - * can be displayed. - * - * Specifies attributes and rule level for the Rule Entry dialog - * based on the data given to this template. - */ - 'click .editRule': function() { - // Get the current template data - var data = Template.currentData(); - - // Retrieve the rule attribtes and level (e.g. study / series / instance) - var attributes = data.attributes; - var level = data.level; - - // Get the properties of the current rule - var rule = this; - - // Open the Rule Entry Dialog with the attributes, level, and rule - openRuleEntryDialog(attributes, level, rule); - }, - /** - * Removes a rule from the current Viewport or Protocol depending on - * the type of rule - */ - 'click .deleteRule': function() { - // Get the properties of the current rule - var rule = this; - - if (rule instanceof HP.ProtocolMatchingRule) { - // If this Rule is evaluated at the protocol level, - // remove it from the current Protocol - ProtocolEngine.protocol.removeProtocolMatchingRule(rule); - } else { - // If this Rule is evaluated at the Viewport level, - // remove it from the active viewport model - var viewport = getActiveViewportModel(); - viewport.removeRule(rule); - } - - // Instruct the Protocol Engine to update the Layout Manager with new data - var viewportIndex = Session.get('activeViewport'); - ProtocolEngine.updateViewports(viewportIndex); - }, - /** - * Updates a Rule's weight in response to user input - * - * @param event The input change event - */ - 'change .ruleWeight': function(event) { - // Get the properties of the current rule - var rule = this; - - // Update the value of the rule weight - rule.weight = $(event.currentTarget).val(); - - // Instruct the Protocol Engine to update the Layout Manager with new data - var viewportIndex = Session.get('activeViewport'); - ProtocolEngine.updateViewports(viewportIndex); - }, - /** - * Updates a Rule's 'required' property in response to user input - * - * @param event The input change event - */ - 'change .ruleRequired': function(event) { - // Get the properties of the current rule - var rule = this; - - // Update the value of the 'required' property - rule.required = $(event.currentTarget).prop('checked'); - - // Instruct the Protocol Engine to update the Layout Manager with new data - var viewportIndex = Session.get('activeViewport'); - ProtocolEngine.updateViewports(viewportIndex); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.styl b/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.styl deleted file mode 100644 index 4b1381e67..000000000 --- a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.styl +++ /dev/null @@ -1,58 +0,0 @@ -@import "{ohif:design}/app" - -table.ruleTable - thead - tr - th - theme('color', '$defaultColor') - text-align: center - - th:first-child - text-align: left - - tbody - tr - td - theme('color', '$defaultColor') - text-align: center - - .failWarning - color: red - - .editRule - .deleteRule - &:hover, &:active - cursor: pointer - transition(all 0.1s ease) - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') - - td:first-child - text-align: left - overflow-wrap: break-word - word-wrap: break-word - -ms-word-break: break-word - word-break: break-word - -ms-hyphens: auto - -moz-hyphens: auto - -webkit-hyphens: auto - hyphens: auto - -.addRuleContainer - margin: 10px 0 - text-align: center - theme('color', '$defaultColor') - - .addRule - cursor: pointer - transition(all 0.1s ease) - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.html b/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.html deleted file mode 100644 index 3825d8c43..000000000 --- a/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.html +++ /dev/null @@ -1,25 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.js b/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.js deleted file mode 100644 index fb91b4e8b..000000000 --- a/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.js +++ /dev/null @@ -1,246 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Blaze } from 'meteor/blaze'; -import { $ } from 'meteor/jquery'; - -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -const keys = { - ESC: 27 -}; - -/** - * Close the specified dialog element and return browser - * focus to the active viewport. - * - * @param dialog The DOM element of the dialog to close - */ -function closeHandler(dialog) { - // Hide the lesion dialog - $(dialog).css('display', 'none'); - - // Remove the backdrop - $('.removableBackdrop').remove(); - - // Restore the focus to the active viewport - Viewerbase.setFocusToActiveViewport(); -} - -/** - * Displays and updates the UI of the Setting Entry Dialog given an - * optional setting to edit. - * - * @param settingObject - */ -openSettingEntryDialog = function(settingObject) { - // Get the lesion location dialog - var dialog = $('.settingEntryDialog'); - - // Store the Dialog DOM data, setting level and setting in the template data - Template.settingEntryDialog.dialog = dialog; - Template.settingEntryDialog.settingObject = settingObject; - - // Initialize the Select2 search box for the attribute list - var settings = Object.keys(HP.displaySettings); - settings.concat(Object.keys(HP.CustomViewportSettings)); - - var displaySettingsOptions = Object.keys(HP.displaySettings).map(key => { - return { - id: key, - text: HP.displaySettings[key].text - }; - }); - - var customSettingsOptions = Object.keys(HP.CustomViewportSettings).map(key => { - return { - id: key, - text: HP.CustomViewportSettings[key].text - }; - }); - - var settingsOptions = displaySettingsOptions.concat(customSettingsOptions); - - var settingSelect = dialog.find('.settings'); - settingSelect.html('').select2({ - data: settingsOptions, - placeholder: 'Select a setting', - allowClear: true - }); - - var settingDetails = { - options: [] - }; - - if (settingObject && HP.displaySettings[settingObject.id]) { - settingDetails = HP.displaySettings[settingObject.id]; - } else if (settingObject && HP.CustomViewportSettings[settingObject.id]) { - settingDetails = HP.CustomViewportSettings[settingObject.id]; - } - - var valueSelect = dialog.find('.currentValue'); - valueSelect.html('').select2({ - data: settingDetails.options, - placeholder: 'Select a value', - allowClear: true - }); - - // If a setting has been provided, set the value of the attribute Select2 input - // to the attribute set in the setting. - if (settingObject && settingObject.id) { - settingSelect.val(settingObject.id); - } - - // Trigger('change') is used to update the Select2 choice in the UI - // This is done after setting the value in case no setting was provided - settingSelect.trigger('change'); - - // If a setting has been provided, display its current value - if (settingObject && settingObject.value !== undefined) { - valueSelect.val(settingObject.value).trigger('change'); - } - - // Update the dialog's CSS so that it is visible on the page - dialog.css('display', 'block'); - - // Show the backdrop - Blaze.render(Template.removableBackdrop, document.body); - - // Make sure the context menu is closed when the user clicks away - $('.removableBackdrop').one('mousedown touchstart', function() { - closeHandler(dialog); - }); -}; - -Template.settingEntryDialog.onCreated(function() { - // Define the ReactiveVars that will be used to link aspects of the UI - var template = this; - - // Note: currentValue's initial value must be a string so the template renders properly - template.currentValue = new ReactiveVar(''); - template.setting = new ReactiveVar(); -}); - -Template.settingEntryDialog.onRendered(function() { - const template = this; - const dialog = template.$('.settingEntryDialog'); - dialog.draggable(); -}); - -Template.settingEntryDialog.events({ - /** - * Save a setting that is being edited - * - * @param event the Click event - * @param template The template context - */ - 'click #save': function(event, template) { - // Retrieve the input properties to the template - var dialog = Template.settingEntryDialog.dialog; - - // Retrieve the current values for the id and current value - var setting = template.setting.get(); - var currentValue = template.currentValue.get(); - - // If currentValue input is undefined, prevent saving this setting - if (currentValue === undefined) { - return; - } - - var viewportSetting = { - id: setting, - value: currentValue - }; - - // Obtain the active Viewport model from the Protocol and Stage - var viewport = getActiveViewportModel(); - - // Remove any old rules if the ID has been changes - var originalSettingObject = Template.settingEntryDialog.settingObject; - if (originalSettingObject && originalSettingObject.id) { - delete viewport.viewportSettings[originalSettingObject.id]; - } - - // Update the active Viewport model' viewportSettings dictionary - viewport.viewportSettings[viewportSetting.id] = viewportSetting.value; - - // Instruct the Protocol Engine to update the Layout Manager with new data - var viewportIndex = Session.get('activeViewport'); - ProtocolEngine.updateViewports(viewportIndex); - - // Close the dialog - closeHandler(dialog); - }, - /** - * Allow the user to click the Cancel button to close the dialog - */ - 'click #cancel': function() { - var dialog = Template.settingEntryDialog.dialog; - closeHandler(dialog); - }, - /** - * Allow Esc keydown events to close the dialog - * - * @param event The Keydown event details - * @returns {boolean} Return false to prevent bubbling of the event - */ - 'keydown .settingEntryDialog': function(event) { - var dialog = Template.settingEntryDialog.dialog; - - // If Esc key is pressed, close the dialog - if (event.which === keys.ESC) { - closeHandler(dialog); - return false; - } - }, - /** - * Update the currentValue ReactiveVar if the user changes the attribute - * - * @param event The Change event for the select box - * @param template The current template context - */ - 'change select.settings': function(event, template) { - // Obtain the user-specified attribute to test against - var settingId = $(event.currentTarget).val(); - - // Store it in the ReactiveVar - template.setting.set(settingId); - - // Retrieve the current value from the attribute - var settingDetails = { - options: [] - }; - if (settingId && HP.displaySettings[settingId]) { - settingDetails = HP.displaySettings[settingId]; - } else if (settingId && HP.CustomViewportSettings[settingId]) { - settingDetails = HP.CustomViewportSettings[settingId]; - } - - var dialog = Template.settingEntryDialog.dialog; - var valueSelect = dialog.find('.currentValue'); - valueSelect.html('').select2({ - data: settingDetails.options, - placeholder: 'Select a value', - allowClear: true - }); - - // Update the ReactiveVar with the user-specified value - if (settingDetails && settingDetails.defaultValue) { - template.currentValue.set(settingDetails.defaultValue); - valueSelect.val(settingDetails.defaultValue).trigger('change'); - } - }, - /** - * Update the currentValue ReactiveVar if the user changes the current value - * - * @param event The Change event for the input - * @param template The current template context - */ - 'change select.currentValue': function(event, template) { - // Get the current value of the select box - var value = $(event.currentTarget).val(); - - // Update the ReactiveVar with the user-specified value - template.currentValue.set(value); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.styl b/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.styl deleted file mode 100644 index 3c3481258..000000000 --- a/Packages/ohif-hanging-protocols/client/components/settingEntryDialog/settingEntryDialog.styl +++ /dev/null @@ -1,43 +0,0 @@ -@import "{ohif:design}/app" - -.settingEntryDialog - theme('border', '1px solid $uiBorderColor', 0.95) - theme('background', '$uiGrayDarkest', 0.95) - theme('color', '$textSecondaryColor') - position: absolute - top: 0 - bottom: 0 - left: 0 - right: 0 - z-index: 100 - width: 300px - height: 200px - margin: auto - padding: 10px - outline: none - border-radius: 8px - - .dialogContent - text-align: center - margin-bottom: 10px - - .row - margin: 15px 0 - - .btn - text-decoration: none - - #cancel - float: left - - #save - float: right - - input.currentValue - width: 95% - text-align: center - padding: 4px - color: black - height: 30px - border-radius: 2px - border: 0 diff --git a/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.html b/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.html deleted file mode 100644 index b89caf25d..000000000 --- a/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.html +++ /dev/null @@ -1,31 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.js b/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.js deleted file mode 100644 index 160a94ad6..000000000 --- a/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.js +++ /dev/null @@ -1,57 +0,0 @@ -Template.settingsTable.events({ - /** - * Opens the Setting Entry dialog to allow the user to create a new setting - * Specifies attributes and setting level for the Setting Entry dialog - * based on the data given to this template. - */ - 'click .addSetting': function() { - // Open the Setting Entry Dialog - openSettingEntryDialog(); - }, - /** - * Opens the Setting Entry dialog to allow the user to edit an existing - * setting. Passes setting details to the dialog so its current properties - * can be displayed. - * - * Specifies attributes for the Setting Entry dialog - * based on the data given to this template. - */ - 'click .editSetting': function() { - // Get the properties of the current setting - var setting = this; - - // Open the Setting Entry Dialog with the setting - openSettingEntryDialog(setting); - }, - /** - * Removes a setting from the current Viewport - */ - 'click .deleteSetting': function() { - // Get the properties of the current setting - var setting = this; - - // Retrieve the current viewport model - var viewport = getActiveViewportModel(); - - // Remove the specified setting - delete viewport.viewportSettings[setting.key]; - - // Instruct the Protocol Engine to update the Layout Manager with new data - var viewportIndex = Session.get('activeViewport'); - ProtocolEngine.updateViewports(viewportIndex); - } -}); - -Template.settingsTable.helpers({ - getSettingText: function() { - var setting = this; - if (HP.CustomViewportSettings[setting.key]) { - return HP.CustomViewportSettings[setting.key].text; - } else if (HP.displaySettings[setting.key]) { - return HP.displaySettings[setting.key].text; - } else { - return Blaze._globalHelpers['prettyPrintStringify'](setting.key); - } - - } -}); \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.styl b/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.styl deleted file mode 100644 index 6e48b7f2f..000000000 --- a/Packages/ohif-hanging-protocols/client/components/settingsTable/settingsTable.styl +++ /dev/null @@ -1,48 +0,0 @@ -@import "{ohif:design}/app" - -table.settingsTable - thead - tr - th - theme('color', '$defaultColor') - text-align: center - - th:first-child - text-align: left - - tbody - background: #3e3e3e - - tr - td - theme('color', '$defaultColor') - text-align: center - - .editSetting - .deleteSetting - cursor: pointer - transition(all 0.1s ease) - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') - - td:first-child - text-align: left - -.addSettingContainer - margin: 10px 0 - text-align: center - theme('color', '$defaultColor') - - .addSetting - cursor: pointer - transition(all 0.1s ease) - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.html b/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.html deleted file mode 100644 index 6d00dd4a0..000000000 --- a/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.html +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.js b/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.js deleted file mode 100644 index f81742f91..000000000 --- a/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.js +++ /dev/null @@ -1,40 +0,0 @@ -getActiveViewportModel = function() { - // If no ProtocolEngine has been defined yet, or there is - // no currently displayed Protocol or Stage, stop here - if (!ProtocolEngine || - !ProtocolEngine.protocol || - ProtocolEngine.stage === undefined) { - return; - } - - // Retrieve the model of the currently displayed stage - var stage = ProtocolEngine.getCurrentStageModel(); - - // Retrieve the index of the active viewport - var activeViewport = Session.get('activeViewport'); - - // If the active viewport index is outside the bounds of the - // number of Viewports defined for this Stage, stop here - if (activeViewport >= stage.viewports.length) { - return; - } - - // Return the Viewport model for this viewport index in the - // current stage - return stage.viewports[activeViewport]; -}; - -Template.stageDetails.helpers({ - /** - * Retrieves the ViewportModel for the active viewport from the - * currently displayed Protocol and display sequence Stage - * - * @returns {*} The Viewport model for the active viewport - */ - activeViewport: function() { - // Run this function anytime the layout manager has changed - Session.get('LayoutManagerUpdated'); - - return getActiveViewportModel(); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.styl b/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.styl deleted file mode 100644 index 7f8558ae8..000000000 --- a/Packages/ohif-hanging-protocols/client/components/stageDetails/stageDetails.styl +++ /dev/null @@ -1,32 +0,0 @@ -@import "{ohif:design}/app" - -#stageDetails - overflow-y: auto - overflow-x: hidden - padding-right: 16px - padding-left: 20px - margin-right: -16px - width: 100% - height: 100% - - &::-webkit-scrollbar - display: none - - h3 - label - theme('color', '$defaultColor') - - label - margin-right: 10px - width: 25% - - input - theme('background-color', '$boxBackgroundColor') - min-width: 50px - width: 40% - border: none - theme('color', '$defaultColor') - text-align: center - - .stageEditorSection - margin: 30px 0 diff --git a/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.html b/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.html deleted file mode 100644 index 5ec7b7000..000000000 --- a/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.html +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.js b/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.js deleted file mode 100644 index 1e4c8776d..000000000 --- a/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.js +++ /dev/null @@ -1,258 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { Random } from 'meteor/random'; - -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; - -/** - * Add an array index swapping function so we can swap stages more easily - */ -move = function(array, oldIndex, newIndex) { - var value = array[oldIndex]; - - newIndex = Math.max(0, newIndex); - newIndex = Math.min(array.length, newIndex); - - array.splice(oldIndex, 1); - array.splice(newIndex, 0, value); - return array; -}; - -/** - * Helper function to obtain the current index of a stage in the - * current protocol - * - * @param protocol The Hanging Protocol to search within - * @param id The id of the current stage to search for - * @returns {number} The index of the specified stage within the Protocol, - * or undefined if it is not present. - */ -function getStageIndex(protocol, id) { - var stageIndex; - if (!protocol || !protocol.stages) { - return; - } - - protocol.stages.forEach(function(stage, index) { - if (stage.id === id) { - stageIndex = index; - return false; - } - }); - - return stageIndex; -} - -Template.stageSortable.helpers({ - /** - * Checks a specified stage to see if it is currently being displayed - * - * @returns {boolean} Whether or not the stage is currently being displayed - */ - isActiveStage: function() { - // Rerun this function every time the layout manager has been updated - Session.get('LayoutManagerUpdated'); - - // If no Protocol Engine has been defined yet, stop here to prevent errors - if (!ProtocolEngine) { - return; - } - - var currentStage = ProtocolEngine.getCurrentStageModel(); - if (!currentStage) { - return false; - } - - // Return a boolean representing if the active stage and the specified stage index are equal - return (this.id === currentStage.id); - }, - /** - * Retrieves the index of the stage at the point it was last saved - * - * @returns {number|*} - */ - stageLabel: function() { - var stage = this; - - // If no Protocol Engine has been defined yet, stop here to prevent errors - if (!ProtocolEngine) { - return; - } - - // Retrieve the last saved copy of the current protocol - var lastSavedCopy = HP.ProtocolStore.getProtocol(ProtocolEngine.protocol.id); - - // Try to find the index of this stage in the previously saved copy - var stageIndex = getStageIndex(lastSavedCopy, stage.id); - - // If the stage is new, and therefore wasn't present in the last save, - // retrieve it's index in the array of new stage ids and use that for - // the label. Also include the time since it was created. - if (stageIndex === undefined) { - // Reactively update this helper every minute - Session.get('timeAgoVariable'); - - // Find the index of the stage in the array of newly created stage IDs - var newStageNumber = ProtocolEngine.newStageIds.indexOf(stage.id) + 1; - - // Use Moment.js to format the createdDate of this stage relative to the - // current time - var dateCreatedFromNow = moment(stage.createdDate).fromNow(); - - // Return the label for the new stage, - // e.g. "New Stage 1 (created a few seconds ago)" - return 'New Stage ' + newStageNumber + ' (created ' + dateCreatedFromNow + ')'; - } - - // If the stage is not new, label it by the index it held in the stages array - // at the previous saved point - return 'Stage ' + ++stageIndex; - }, - /** - * Check if a later stage exists for the user to switch to - * - * @returns {boolean} Whether or not a later stage exists - */ - isNextAvailable: function() { - // Run this helper whenever the ProtocolEngine / LayoutManager has changed - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine has been defined yet, stop here - if (!ProtocolEngine) { - return; - } - - // Return whether or not the current stage is the last stage - return ProtocolEngine.stage < ProtocolEngine.getNumProtocolStages() - 1; - }, - /** - * Check if an earlier stage exists for the user to switch to - * - * @returns {boolean} Whether or not an earlier stage exists - */ - isPreviousAvailable: function() { - // Run this helper whenever the ProtocolEngine / LayoutManager has changed - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine has been defined yet, stop here - if (!ProtocolEngine) { - return; - } - - // Return whether or not the current stage is the first stage - return ProtocolEngine.stage > 0; - } -}); - -Template.stageSortable.events({ - /** - * Displays a stage when its title is clicked - */ - 'click .sortable-item span': function() { - // Retrieve the index of this stage in the display set sequences - var stageIndex = getStageIndex(ProtocolEngine.protocol, this.id); - - // Display the selected stage - ProtocolEngine.setCurrentProtocolStage(stageIndex - ProtocolEngine.stage); - }, - /** - * Creates a new stage and adds it to the currently loaded Protocol at - * the end of the display set sequence - */ - 'click #addStage': function() { - // Retrieve the model describing the current stage - var stage = ProtocolEngine.getCurrentStageModel(); - - // Clone this stage to create a new stage - var newStage = stage.createClone(); - - // Remove the stage's name if it has one - delete newStage.name; - - // Append this new stage to the end of the display set sequence - ProtocolEngine.protocol.stages.push(newStage); - - // Append the new stage the list of new stage IDs, so we can label it properly - ProtocolEngine.newStageIds.push(newStage.id); - - // Switch to the next stage in the display set sequence - ProtocolEngine.setCurrentProtocolStage(1); - }, - /** - * Deletes a stage from the currently loaded Protocol by removing it from - * the stages array. If it is the currently active stage, the current stage is - * set to one stage earlier in the display set sequence. - */ - 'click .deleteStage': function() { - // If this is the only stage in the Protocol, stop here - if (ProtocolEngine.protocol.stages.length === 1) { - return; - } - - var stageId = this.id; - - var options = { - title: 'Remove Protocol Stage', - text: 'Are you sure you would like to remove this Protocol Stage? This cannot be reversed.' - }; - - OHIF.viewerbase.dialogUtils.showConfirmDialog(function() { - // Retrieve the index of this stage in the display set sequences - var stageIndex = getStageIndex(ProtocolEngine.protocol, stageId); - - // Remove it from the display set sequence - ProtocolEngine.protocol.stages.splice(stageIndex, 1); - - // If we have removed the currently active stage, switch to the one before it - if (ProtocolEngine.stage === stageIndex) { - // Display the previous stage - ProtocolEngine.setCurrentProtocolStage(-1); - } - - // Update the Session variable to the UI re-renders - Session.set('LayoutManagerUpdated', Math.random()); - }, options); - }, - - 'click .moveStageUp': function() { - // Get the old and new indices following a 'sort' event - var oldIndex = ProtocolEngine.stage; - var newIndex = Math.max(ProtocolEngine.stage - 1, 0); - - if (oldIndex === newIndex) { - return; - } - - // Swap the stages in the current Protocol's display set sequence - // using our addition to the Array prototype - ProtocolEngine.protocol.stages = move(ProtocolEngine.protocol.stages, oldIndex, newIndex); - - // If the currently displayed stage was reordered into a new position, - // update the value for the stage index in the displayed Protocol - ProtocolEngine.stage = newIndex; - - // Update the Session variable to the UI re-renders - Session.set('LayoutManagerUpdated', Math.random()); - }, - 'click .moveStageDown': function() { - // Get the old and new indices following a 'sort' event - var oldIndex = ProtocolEngine.stage; - var newIndex = Math.min(ProtocolEngine.stage + 1, ProtocolEngine.protocol.stages.length - 1); - - if (oldIndex === newIndex) { - return; - } - - // Swap the stages in the current Protocol's display set sequence - // using our addition to the Array prototype - ProtocolEngine.protocol.stages = move(ProtocolEngine.protocol.stages.move, oldIndex, newIndex); - - // If the currently displayed stage was reordered into a new position, - // update the value for the stage index in the displayed Protocol - ProtocolEngine.stage = newIndex; - - // Update the Session variable to the UI re-renders - Session.set('LayoutManagerUpdated', Math.random()); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.styl b/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.styl deleted file mode 100644 index e4cec1b68..000000000 --- a/Packages/ohif-hanging-protocols/client/components/stageSortable/stageSortable.styl +++ /dev/null @@ -1,81 +0,0 @@ -@import "{ohif:design}/app" - -#stageSortingContainer - padding: 0 20px - - #stageSortable - .sortable-item - padding: 3px - - span - theme('color', '$defaultColor') - cursor: pointer - - &:hover - theme('color', '$hoverColor') - - &.active - theme('color', '$activeColor') - - .sortable-handle - cursor: move - cursor: -webkit-grabbing - width: 15px - height: 15px - margin: 0 5px - filter: invert(100%) - -webkit-filter: invert(100%) - background-image: unquote("url(/packages/hangingprotocols/assets/dots.svg)") - - .sortable.target - flex: 1 1 auto - margin-left: 1em - - .sortable-ghost - opacity: 0.6 - - .deleteStage - cursor: pointer - theme('color', '$defaultColor') - transition(all 0.1s ease) - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') - - .addStage - margin: 10px 0 - text-align: center - theme('color', '$defaultColor') - - #addStage - transition(all 0.1s ease) - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') - - .moveStageButtons - margin: 10px 0 - text-align: center - - a - theme('color', '$defaultColor') - cursor: pointer - text-decoration: none - transition(all 0.1s ease) - - &:hover - theme('color', '$hoverColor') - - &:active - theme('color', '$activeColor') - - &[disabled="true"] - opacity: 0.7 - cursor: disabled - pointer-events: none diff --git a/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.html b/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.html deleted file mode 100644 index 7e4aa6f88..000000000 --- a/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.html +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.js b/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.js deleted file mode 100644 index 6a0e2909b..000000000 --- a/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.js +++ /dev/null @@ -1,144 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { $ } from 'meteor/jquery'; -import { Template } from 'meteor/templating'; - -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -const keys = { - ESC: 27, - ENTER: 13 -}; - -/** - * Close the specified dialog element and returns the browser - * focus to the active viewport. - * - * @param dialog The DOM element of the dialog to close - */ -function closeHandler(dialog) { - // Hide the lesion dialog - $(dialog).css('display', 'none'); - - // Remove the backdrop - $('.removableBackdrop').remove(); - - // Restore the focus to the active viewport - Viewerbase.setFocusToActiveViewport(); -} - -/** - * Displays and updates the UI of the Text Entry Dialog given a new title, - * instructions, and doneCallback - * - * @param title Title of the dialog box - * @param instructions Instructions to display to the user - * @param doneCallback Function to execute when the dialog has been closed - */ -openTextEntryDialog = function(title, instructions, currentValue, doneCallback) { - // Get the lesion location dialog - var dialog = $('.textEntryDialog'); - - // Clear any input that is still on the page - var currentValueInput = dialog.find('input.currentValue'); - currentValueInput.val(currentValue); - - // Store the Dialog DOM data, rule level and rule in the template data - Template.textEntryDialog.dialog = dialog; - Template.textEntryDialog.title = title; - Template.textEntryDialog.instructions = instructions; - Template.textEntryDialog.doneCallback = doneCallback; - - dialog.find('.title').html(title); - dialog.find('.instructions').html(instructions); - - // Update the dialog's CSS so that it is visible on the page - dialog.css('display', 'block'); - - // Show the backdrop - UI.render(Template.removableBackdrop, document.body); - - // Make sure the context menu is closed when the user clicks away - $('.removableBackdrop').one('mousedown touchstart', function() { - closeHandler(dialog); - }); -}; - -Template.textEntryDialog.onRendered(() => { - const instance = Template.instance(); - const dialog = instance.$('.settingEntryDialog'); - dialog.draggable(); -}); - -Template.textEntryDialog.events({ - /** - * Save the user-specified text - * - */ - 'click .save': function() { - // Retrieve the input properties to the template - var dialog = Template.textEntryDialog.dialog; - var currentValue = dialog.find('input.currentValue').val(); - - // If currentValue input is undefined, prevent saving this rule - if (currentValue === undefined) { - return; - } - - var doneCallback = Template.textEntryDialog.doneCallback; - if (doneCallback) { - doneCallback(currentValue); - } - - // Close the dialog - closeHandler(Template.textEntryDialog.dialog); - }, - /** - * Allow the user to click the Cancel button to close the dialog - */ - 'click .cancel': function() { - closeHandler(Template.textEntryDialog.dialog); - }, - /** - * Allow Esc keydown events to close the dialog - * - * @param event The Keydown event details - * @returns {boolean} Return false to prevent bubbling of the event - */ - 'keydown .textEntryDialog': function(event) { - var dialog = Template.textEntryDialog.dialog; - - // If Esc key is pressed, close the dialog - if (event.which === keys.ESC) { - closeHandler(dialog); - return false; - } else if (event.which === keys.ENTER) { - var currentValue = dialog.find('input.currentValue').val(); - - // If currentValue input is undefined, prevent saving this rule - if (currentValue === undefined) { - return; - } - - var doneCallback = Template.textEntryDialog.doneCallback; - if (doneCallback) { - doneCallback(currentValue); - } - - closeHandler(dialog); - return false; - } - }, - /** - * Update the currentValue ReactiveVar if the user changes the attribute value - * - * @param event The Change event for the input - * @param template The current template context - */ - 'change input.currentValue': function(event, template) { - // Get the DOM element representing the input box - var input = $(event.currentTarget); - - // Update the template data with the current value - Template.textEntryDialog.currentValue = input.val(); - } -}); diff --git a/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.styl b/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.styl deleted file mode 100644 index d1c388a43..000000000 --- a/Packages/ohif-hanging-protocols/client/components/textEntryDialog/textEntryDialog.styl +++ /dev/null @@ -1,36 +0,0 @@ -@import "{ohif:design}/app" - -.textEntryDialog - theme('border', '1px solid $uiBorderColor', 0.95) - theme('background', '$uiGrayDarkest', 0.95) - theme('color', '$textSecondaryColor') - position: absolute - top: 0 - bottom: 0 - left: 0 - right: 0 - z-index: 100 - width: 300px - height: 170px - margin: auto - padding: 10px - outline: none - border-radius: 8px - - .dialogContent - margin-bottom: 10px - - .cancel - float: left - - .save - float: right - - input.currentValue - width: 95% - text-align: left - padding: 4px - color: black - height: 30px - border-radius: 2px - border: 0 diff --git a/Packages/ohif-hanging-protocols/client/customAttributes/index.js b/Packages/ohif-hanging-protocols/client/customAttributes/index.js deleted file mode 100644 index b8fb90893..000000000 --- a/Packages/ohif-hanging-protocols/client/customAttributes/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// Define an empty object to store callbacks that are used to retrieve custom attributes -// The simplest example for a custom attribute is the Timepoint type (i.e. baseline or follow-up) -// used in the LesionTracker application. -// -// Timepoint type can be obtained given a studyId, and this is done through a custom callback. -// Developers can define attributes (i.e. attributeId = timepointType) with a name ('Timepoint Type') -// and a callback function that is used to calculate them. -// -// The input to the callback, which is called during viewport-image matching rule evaluation -// is the set of attributes that contains the specified attribute. In our example, timepointType is -// linked to the study attributes, and so the inputs to the callback is an object containing -// the study attributes. -HP.CustomAttributeRetrievalCallbacks = {}; - -/** - * Adds a custom attribute to be used in the HangingProtocol UI and matching rules, including a - * callback that will be used to calculate the attribute value. - * - * @param attributeId The ID used to refer to the attribute (e.g. 'timepointType') - * @param attributeName The name of the attribute to be displayed (e.g. 'Timepoint Type') - * @param callback The function used to calculate the attribute value from the other attributes at its level (e.g. study/series/image) - */ -HP.addCustomAttribute = (attributeId, attributeName, callback) => { - HP.CustomAttributeRetrievalCallbacks[attributeId] = { - name: attributeName, - callback: callback - }; -}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/customViewportSettings/index.js b/Packages/ohif-hanging-protocols/client/customViewportSettings/index.js deleted file mode 100644 index 929ca1069..000000000 --- a/Packages/ohif-hanging-protocols/client/customViewportSettings/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// Define an empty object to store callbacks that are used to apply custom viewport settings -// after a viewport is rendered. -HP.CustomViewportSettings = {}; - -/** - * Adds a custom setting that can be chosen in the HangingProtocol UI and applied to a Viewport - * - * @param settingId The ID used to refer to the setting (e.g. 'displayCADMarkers') - * @param settingName The name of the setting to be displayed (e.g. 'Display CAD Markers') - * @param options - * @param callback A function to be run after a viewport is rendered with a series - */ -HP.addCustomViewportSetting = (settingId, settingName, options, callback) => { - HP.CustomViewportSettings[settingId] = { - id: settingId, - text: settingName, - options: options, - callback: callback - }; -}; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/helpers/attributes.js b/Packages/ohif-hanging-protocols/client/helpers/attributes.js deleted file mode 100644 index c1815874b..000000000 --- a/Packages/ohif-hanging-protocols/client/helpers/attributes.js +++ /dev/null @@ -1,22 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - - -Blaze.registerHelper('viewportSettingsTypes', function() { - return HP.viewportSettingsTypes; -}); - -Blaze.registerHelper('toolSettingsTypes', function() { - return HP.toolSettingsTypes; -}); - -Blaze.registerHelper('studyAttributes', function() { - return HP.studyAttributes; -}); - -Blaze.registerHelper('seriesAttributes', function() { - return HP.seriesAttributes; -}); - -Blaze.registerHelper('instanceAttributes', function() { - return HP.instanceAttributes; -}); diff --git a/Packages/ohif-hanging-protocols/client/helpers/displayConstraint.js b/Packages/ohif-hanging-protocols/client/helpers/displayConstraint.js deleted file mode 100644 index 09e9a0509..000000000 --- a/Packages/ohif-hanging-protocols/client/helpers/displayConstraint.js +++ /dev/null @@ -1,71 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -const attributeCache = Object.create(null); -const REGEXP = /^\([x0-9a-f]+\)/; - -const humanize = text => { - let humanized = text.replace(/([A-Z])/g, ' $1'); // insert a space before all caps - - humanized = humanized.replace(/^./, str => { // uppercase the first character - return str.toUpperCase(); - }); - - return humanized; -}; - -/** - * Get the text of an attribute for a given attribute - * @param {String} attributeId The attribute ID - * @param {Array} attributes Array of attributes objects with id and text properties - * @return {String} If found return the attribute text or an empty string otherwise - */ -const getAttributeText = (attributeId, attributes) => { - // If the attribute is already in the cache, return it - if (attributeId in attributeCache) { - return attributeCache[attributeId]; - } - - // Find the attribute with given attributeId - const attribute = attributes.find(attribute => attribute.id === attributeId); - - let attributeText; - - // If attribute was found get its text and save it on the cache - if (attribute) { - attributeText = attribute.text.replace(REGEXP, ''); - attributeCache[attributeId] = attributeText; - } - - return attributeText || ''; -}; - -Blaze.registerHelper('displayConstraint', (attributeId, constraint, attributes) => { - if (!constraint || !attributeId) { - return; - } - - const validatorType = Object.keys(constraint)[0]; - if (!validatorType) { - return; - } - - const validator = Object.keys(constraint[validatorType])[0]; - if (!validator) { - return; - } - - const value = constraint[validatorType][validator]; - if (value === void 0) { - return; - } - - let comparator = validator; - if (validator === 'value') { - comparator = validatorType; - } - - const attributeText = getAttributeText(attributeId, attributes); - const constraintText = attributeText + ' ' + humanize(comparator).toLowerCase() + ' ' + value; - - return constraintText; -}); \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/lib/sortByScore.js b/Packages/ohif-hanging-protocols/client/lib/sortByScore.js deleted file mode 100644 index 21975bf41..000000000 --- a/Packages/ohif-hanging-protocols/client/lib/sortByScore.js +++ /dev/null @@ -1,8 +0,0 @@ -// Sorts an array by score -const sortByScore = arr => { - arr.sort((a, b) => { - return b.score - a.score; - }); -}; - -export { sortByScore }; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/lib/validate.js b/Packages/ohif-hanging-protocols/client/lib/validate.js deleted file mode 100644 index b92607f4b..000000000 --- a/Packages/ohif-hanging-protocols/client/lib/validate.js +++ /dev/null @@ -1,39 +0,0 @@ -import { validate } from 'validate.js'; - -validate.validators.equals = function(value, options, key, attributes) { - if (options && value !== options.value) { - return key + 'must equal ' + options.value; - } -}; - -validate.validators.doesNotEqual = function(value, options, key) { - if (options && value === options.value) { - return key + 'cannot equal ' + options.value; - } -}; - -validate.validators.contains = function(value, options, key) { - if (options && value.indexOf && value.indexOf(options.value) === -1) { - return key + 'must contain ' + options.value; - } -}; - -validate.validators.doesNotContain = function(value, options, key) { - if (options && value.indexOf && value.indexOf(options.value) !== -1) { - return key + 'cannot contain ' + options.value; - } -}; - -validate.validators.startsWith = function(value, options, key) { - if (options && value.startsWith && !value.startsWith(options.value)) { - return key + 'must start with ' + options.value; - } -}; - -validate.validators.endsWith = function(value, options, key) { - if (options && value.endsWith && !value.endsWith(options.value)) { - return key + 'must end with ' + options.value; - } -}; - -export { validate }; diff --git a/Packages/ohif-hanging-protocols/client/matcher/HPMatcher.js b/Packages/ohif-hanging-protocols/client/matcher/HPMatcher.js deleted file mode 100644 index 4ce67bde7..000000000 --- a/Packages/ohif-hanging-protocols/client/matcher/HPMatcher.js +++ /dev/null @@ -1,115 +0,0 @@ -// OHIF Modules -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -// Local imports -import { validate } from '../lib/validate.js'; -import '../customAttributes'; - -/** - * Import Constants - */ -const { OHIFError, metadata: { StudySummary, InstanceMetadata } } = Viewerbase; - -/** - * Match a Metadata instance against rules using Validate.js for validation. - * @param {StudySummary|InstanceMetadata} metadataInstance Metadata instance object - * @param {Array} rules Array of MatchingRules instances (StudyMatchingRule|SeriesMatchingRule|ImageMatchingRule) for the match - * @return {Object} Matching Object with score and details (which rule passed or failed) - */ -const match = (metadataInstance, rules) => { - - // Make sure the supplied data is valid. - if (!(metadataInstance instanceof StudySummary || metadataInstance instanceof InstanceMetadata)) { - throw new OHIFError('HPMatcher::match metadataInstance must be an instance of StudySummary or InstanceMetadata'); - } - - const options = { - format: 'grouped' - }; - - const details = { - passed: [], - failed: [] - }; - - let requiredFailed = false; - let score = 0; - - rules.forEach(rule => { - const attribute = rule.attribute; - let customAttributeExists = metadataInstance.customAttributeExists(attribute); - - // If the metadataInstance we are testing (e.g. study, series, or instance MetadataInstance) do - // not contain the attribute specified in the rule, check whether or not they have been - // defined in the CustomAttributeRetrievalCallbacks Object. - if (!customAttributeExists && HP.CustomAttributeRetrievalCallbacks.hasOwnProperty(attribute)) { - const customAttribute = HP.CustomAttributeRetrievalCallbacks[attribute]; - metadataInstance.setCustomAttribute(attribute, customAttribute.callback(metadataInstance)); - customAttributeExists = true; - } - - // Format the constraint as required by Validate.js - const testConstraint = { - [attribute]: rule.constraint - }; - - // Create a single attribute object to be validated, since metadataInstance is an - // instance of Metadata (StudyMetadata, SeriesMetadata or InstanceMetadata) - const attributeValue = customAttributeExists ? metadataInstance.getCustomAttribute(attribute) : metadataInstance.getTagValue(attribute); - const attributeMap = { - [attribute]: attributeValue - }; - - // Use Validate.js to evaluate the constraints on the specified metadataInstance - let errorMessages; - try { - errorMessages = validate(attributeMap, testConstraint, [options]); - } catch (e) { - errorMessages = [ 'Something went wrong during validation.', e ]; - } - - if (!errorMessages) { - // If no errorMessages were returned, then validation passed. - - // Add the rule's weight to the total score - score += parseInt(rule.weight, 10); - - // Log that this rule passed in the matching details object - details.passed.push({ - rule - }); - } else { - // If errorMessages were present, then validation failed - - // If the rule that failed validation was Required, then - // mark that a required Rule has failed - if (rule.required) { - requiredFailed = true; - } - - // Log that this rule failed in the matching details object - // and include any error messages - details.failed.push({ - rule, - errorMessages - }); - } - }); - - // If a required Rule has failed Validation, set the matching score to zero - if (requiredFailed) { - score = 0; - } - - return { - score, - details, - requiredFailed - }; -}; - -const HPMatcher = { - match -}; - -export { HPMatcher }; \ No newline at end of file diff --git a/Packages/ohif-hanging-protocols/client/protocolEngine.js b/Packages/ohif-hanging-protocols/client/protocolEngine.js deleted file mode 100644 index a6f962ede..000000000 --- a/Packages/ohif-hanging-protocols/client/protocolEngine.js +++ /dev/null @@ -1,731 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { _ } from 'meteor/underscore'; -import { Session } from 'meteor/session'; - -// OHIF Modules -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; - -// Hanging Protocol local imports -import { HPMatcher } from './matcher/HPMatcher'; -import { sortByScore } from './lib/sortByScore'; -import './customViewportSettings'; - -/** - * Import Constants - */ - -const { OHIFError, metadata: { StudyMetadata, SeriesMetadata, InstanceMetadata, StudySummary } } = OHIF.viewerbase; - -// Useful constants -const ABSTRACT_PRIOR_VALUE = 'abstractPriorValue'; - -// Define a global variable that will be used to refer to the Protocol Engine -// It must be populated by HP.setEngine when the Viewer is initialized and a ProtocolEngine -// is instantiated on top of the LayoutManager. If the global ProtocolEngine variable remains -// undefined, none of the HangingProtocol functions will operate. -ProtocolEngine = undefined; - -/** - * Sets the ProtocolEngine global given an instantiated ProtocolEngine. This is done so that - * The functions in the package can depend on a ProtocolEngine variable, but this variable does - * not have to be exported from the application level. - * - * (There may be a better way to do this, but for now this works with no real downside) - * - * @param protocolEngine An instantiated ProtocolEngine linked to a LayoutManager from the - * Viewerbase package - */ -HP.setEngine = protocolEngine => { - ProtocolEngine = protocolEngine; -}; - -/** - * Gets the instantiated ProtocolEngine global object - * - * @returns protocolEngine An instantiated ProtocolEngine linked to a LayoutManager from the - * Viewerbase package - */ -HP.getEngine = () => { - return ProtocolEngine; -}; - -Meteor.startup(() => { - HP.addCustomViewportSetting('wlPreset', 'Window/Level Preset', Object.create(null), (element, optionValue) => { - if (_.findWhere(OHIF.viewer.wlPresets, { id: optionValue })) { - OHIF.viewerbase.wlPresets.applyWLPreset(optionValue, element); - } - }); -}); - -HP.ProtocolEngine = class ProtocolEngine { - /** - * Constructor - * @param {Object} layoutManager Layout Manager Object - * @param {Array} studies Array of study metadata - * @param {Map} priorStudies Map of prior studies - * @param {Object} studyMedadataSource Instance of StudyMetadataSource (ohif-viewerbase) Object to get study metadata - */ - constructor(layoutManager, studies, priorStudies, studyMetadataSource) { - - const { LayoutManager, StudyMetadataSource } = OHIF.viewerbase; - // ----------- - // Type Validations - - if (!(layoutManager instanceof LayoutManager)) { - throw new OHIFError('ProtocolEngine::constructor layoutManager is not an instance of LayoutManager'); - } - - if (!(studyMetadataSource instanceof StudyMetadataSource)) { - throw new OHIFError('ProtocolEngine::constructor studyMetadataSource is not an instance of StudyMetadataSource'); - } - - if (!(studies instanceof Array) && !studies.every(study => study instanceof StudyMetadata)) { - throw new OHIFError('ProtocolEngine::constructor studies is not an array or it\'s items are not instances of StudyMetadata'); - } - - // -------------- - // Initialization - - this.LayoutManager = layoutManager; - this.studies = studies; - this.priorStudies = priorStudies instanceof Map ? priorStudies : new Map(); - this.studyMetadataSource = studyMetadataSource; - - // Put protocol engine in a known states - this.reset(); - - // Create an array for new stage ids to be stored - // while editing a stage - this.newStageIds = []; - } - - /** - * Resets the ProtocolEngine to the best match - */ - reset() { - const protocol = this.getBestProtocolMatch(); - - this.setHangingProtocol(protocol); - } - - /** - * Retrieves the current Stage from the current Protocol and stage index - * - * @returns {*} The Stage model for the currently displayed Stage - */ - getCurrentStageModel() { - return this.protocol.stages[this.stage]; - } - - /** - * Finds the best protocols from Protocol Store, matching each protocol matching rules - * with the given study. The best protocol are orded by score and returned in an array - * @param {Object} study StudyMetadata instance object - * @return {Array} Array of match objects or an empty array if no match was found - * Each match object has the score of the matching and the matched - * protocol - */ - findMatchByStudy(study) { - OHIF.log.info('ProtocolEngine::findMatchByStudy'); - - const matched = []; - const studyInstance = study.getFirstInstance(); - - // Set custom attribute for study metadata - const numberOfAvailablePriors = this.getNumberOfAvailablePriors(study.getObjectID()); - - HP.ProtocolStore.getProtocol().forEach(protocol => { - // Clone the protocol's protocolMatchingRules array - // We clone it so that we don't accidentally add the - // numberOfPriorsReferenced rule to the Protocol itself. - let rules = protocol.protocolMatchingRules.slice(); - if (!rules) { - return; - } - - // Check if the study has the minimun number of priors used by the protocol. - const numberOfPriorsReferenced = protocol.getNumberOfPriorsReferenced(); - if (numberOfPriorsReferenced > numberOfAvailablePriors) { - return; - } - - // Run the matcher and get matching details - const matchedDetails = HPMatcher.match(studyInstance, rules); - const score = matchedDetails.score; - - // The protocol matched some rule, add it to the matched list - if (score > 0) { - matched.push({ - score, - protocol - }); - } - }); - - // If no matches were found, select the default protocol - if (!matched.length) { - const defaultProtocol = HP.ProtocolStore.getProtocol('defaultProtocol'); - - return [{ - score: 1, - protocol: defaultProtocol - }]; - } - - // Sort the matched list by score - sortByScore(matched); - - OHIF.log.info('ProtocolEngine::findMatchByStudy matched', matched); - - return matched; - } - - /** - * Populates the MatchedProtocols Collection by running the matching procedure - */ - updateProtocolMatches() { - OHIF.log.info('ProtocolEngine::updateProtocolMatches'); - - // Clear all data from the MatchedProtocols Collection - MatchedProtocols.remove({}); - - // For each study, find the matching protocols - this.studies.forEach(study => { - const matched = this.findMatchByStudy(study); - - // For each matched protocol, check if it is already in MatchedProtocols - matched.forEach(matchedDetail => { - const protocol = matchedDetail.protocol; - if (!protocol) { - return; - } - - const protocolInCollection = MatchedProtocols.findOne({ - id: protocol.id - }); - - // If it is not already in the MatchedProtocols Collection, insert it with its score - if (!protocolInCollection) { - OHIF.log.info('ProtocolEngine::updateProtocolMatches inserting protocol match', matchedDetail); - MatchedProtocols.insert(matchedDetail); - } - }); - }); - } - - /** - * Return the best matched Protocol to the current study or set of studies - * @returns {*} - */ - getBestProtocolMatch() { - // Run the matching to populate the MatchedProtocols Collection - this.updateProtocolMatches(); - - // Retrieve the highest scoring Protocol - const sorted = MatchedProtocols.find({}, { - sort: { - score: -1 - }, - limit: 1 - }).fetch(); - - // Highest scoring Protocol - const bestMatch = sorted[0].protocol; - - OHIF.log.info('ProtocolEngine::getBestProtocolMatch bestMatch', bestMatch); - - return bestMatch; - } - - /** - * Get the number of prior studies supplied in the priorStudies map property. - * - * @param {String} studyObjectID The study object ID of the study whose priors are needed - * @returns {number} The number of available prior studies with the same PatientID - */ - getNumberOfAvailablePriors(studyObjectID) { - const priors = this.getAvailableStudyPriors(studyObjectID); - - return priors.length; - } - - /** - * Get the array of prior studies from a specific study. - * - * @param {String} studyObjectID The study object ID of the study whose priors are needed - * @returns {Array} The array of available priors or an empty array - */ - getAvailableStudyPriors(studyObjectID) { - const priors = this.priorStudies.get(studyObjectID); - - return priors instanceof Array ? priors : []; - } - - // Match images given a list of Studies and a Viewport's image matching reqs - matchImages(viewport, viewportIndex) { - OHIF.log.info('ProtocolEngine::matchImages'); - - const { studyMatchingRules, seriesMatchingRules, imageMatchingRules: instanceMatchingRules } = viewport; - - const matchingScores = []; - const currentStudy = this.studies[0]; // @TODO: Should this be: this.studies[this.currentStudy] ??? - const firstInstance = currentStudy.getFirstInstance(); - - let highestStudyMatchingScore = 0; - let highestSeriesMatchingScore = 0; - - // Set custom attribute for study metadata and it's first instance - currentStudy.setCustomAttribute(ABSTRACT_PRIOR_VALUE, 0); - if (firstInstance instanceof InstanceMetadata) { - firstInstance.setCustomAttribute(ABSTRACT_PRIOR_VALUE, 0); - } - - // Only used if study matching rules has abstract prior values defined... - let priorStudies; - - studyMatchingRules.forEach(rule => { - if (rule.attribute === ABSTRACT_PRIOR_VALUE) { - const validatorType = Object.keys(rule.constraint)[0]; - const validator = Object.keys(rule.constraint[validatorType])[0]; - - let abstractPriorValue = rule.constraint[validatorType][validator]; - abstractPriorValue = parseInt(abstractPriorValue, 10); - // TODO: Restrict or clarify validators for abstractPriorValue? - - // No need to call it more than once... - if (!priorStudies) { - priorStudies = this.getAvailableStudyPriors(currentStudy.getObjectID()); - } - - // TODO: Revisit this later: What about two studies with the same - // study date? - - let priorStudy; - if (abstractPriorValue === -1) { - priorStudy = priorStudies[priorStudies.length - 1]; - } else { - const studyIndex = Math.max(abstractPriorValue - 1, 0); - priorStudy = priorStudies[studyIndex]; - } - - // Invalid data - if (!(priorStudy instanceof StudyMetadata) && !(priorStudy instanceof StudySummary)) { - return; - } - - const priorStudyObjectID = priorStudy.getObjectID(); - - // Check if study metadata is already in studies list - if (this.studies.find(study => study.getObjectID() === priorStudyObjectID)) { - return; - } - - // Get study metadata if necessary and load study in the viewer (each viewer should provide it's own load study method) - this.studyMetadataSource.loadStudy(priorStudy).then(studyMetadata => { - // Set the custom attribute abstractPriorValue for the study metadata - studyMetadata.setCustomAttribute(ABSTRACT_PRIOR_VALUE, abstractPriorValue); - - // Also add custom attribute - const firstInstance = studyMetadata.getFirstInstance(); - if (firstInstance instanceof InstanceMetadata) { - firstInstance.setCustomAttribute(ABSTRACT_PRIOR_VALUE, abstractPriorValue); - } - - // Insert the new study metadata - this.studies.push(studyMetadata); - - // Update the viewport to refresh layout manager with new study - this.updateViewports(viewportIndex); - }, error => { - OHIF.log.warn(error); - throw new OHIFError(`ProtocolEngine::matchImages could not get study metadata for the Study with the following ObjectID: ${priorStudyObjectID}`); - }); - } - // TODO: Add relative Date / time - }); - - this.studies.forEach(study => { - const studyMatchDetails = HPMatcher.match(study.getFirstInstance(), studyMatchingRules); - - // Prevent bestMatch from being updated if the matchDetails' required attribute check has failed - if (studyMatchDetails.requiredFailed === true || studyMatchDetails.score < highestStudyMatchingScore) { - return; - } - - highestStudyMatchingScore = studyMatchDetails.score; - - study.forEachSeries(series => { - const seriesMatchDetails = HPMatcher.match(series.getFirstInstance(), seriesMatchingRules); - - // Prevent bestMatch from being updated if the matchDetails' required attribute check has failed - if (seriesMatchDetails.requiredFailed === true || seriesMatchDetails.score < highestSeriesMatchingScore) { - return; - } - - highestSeriesMatchingScore = seriesMatchDetails.score; - - series.forEachInstance((instance, index) => { - // This tests to make sure there is actually image data in this instance - // TODO: Change this when we add PDF and MPEG support - // See https://ohiforg.atlassian.net/browse/LT-227 - // sopClassUid = x00080016 - // rows = x00280010 - if (!OHIF.viewerbase.isImage(instance.getTagValue('x00080016')) && !instance.getTagValue('x00280010')) { - return; - } - - const instanceMatchDetails = HPMatcher.match(instance, instanceMatchingRules); - - // Prevent bestMatch from being updated if the matchDetails' required attribute check has failed - if (instanceMatchDetails.requiredFailed === true) { - return; - } - - const matchDetails = { - passed: [], - failed: [] - }; - - matchDetails.passed = matchDetails.passed.concat(instanceMatchDetails.details.passed); - matchDetails.passed = matchDetails.passed.concat(seriesMatchDetails.details.passed); - matchDetails.passed = matchDetails.passed.concat(studyMatchDetails.details.passed); - - matchDetails.failed = matchDetails.failed.concat(instanceMatchDetails.details.failed); - matchDetails.failed = matchDetails.failed.concat(seriesMatchDetails.details.failed); - matchDetails.failed = matchDetails.failed.concat(studyMatchDetails.details.failed); - - const totalMatchScore = instanceMatchDetails.score + seriesMatchDetails.score + studyMatchDetails.score; - const currentSOPInstanceUID = instance.getSOPInstanceUID(); - - const imageDetails = { - studyInstanceUid: study.getStudyInstanceUID(), - seriesInstanceUid: series.getSeriesInstanceUID(), - sopInstanceUid: currentSOPInstanceUID, - currentImageIdIndex: index, - matchingScore: totalMatchScore, - matchDetails: matchDetails, - sortingInfo: { - score: totalMatchScore, - study: instance.getTagValue('x00080020') + instance.getTagValue('x00080030'), // StudyDate = x00080020 StudyTime = x00080030 - series: parseInt(instance.getTagValue('x00200011')), // TODO: change for seriesDateTime SeriesNumber = x00200011 - instance: parseInt(instance.getTagValue('x00200013')) // TODO: change for acquisitionTime InstanceNumber = x00200013 - } - }; - - // Find the displaySet - const displaySet = study.findDisplaySet(displaySet => displaySet.images.find(image => image.getSOPInstanceUID() === currentSOPInstanceUID)); - - // If the instance was found, set the displaySet ID - if (displaySet) { - imageDetails.displaySetInstanceUid = displaySet.getUID(); - imageDetails.imageId = instance.getImageId(); - } - - matchingScores.push(imageDetails); - }); - }); - }); - - // Sort the matchingScores - const sortingFunction = OHIF.utils.sortBy({ - name: 'score', - reverse: true - }, { - name: 'study', - reverse: true - }, { - name: 'instance' - }, { - name: 'series' - }); - matchingScores.sort((a, b) => sortingFunction(a.sortingInfo, b.sortingInfo)); - - const bestMatch = matchingScores[0]; - - OHIF.log.info('ProtocolEngine::matchImages bestMatch', bestMatch); - - return { - bestMatch, - matchingScores - }; - } - - /** - * Rerenders viewports that are part of the current ProtocolEngine's LayoutManager - * using the matching rules internal to each viewport. - * - * If this function is provided the index of a viewport, only the specified viewport - * is rerendered. - * - * @param viewportIndex - */ - updateViewports(viewportIndex) { - OHIF.log.info(`ProtocolEngine::updateViewports viewportIndex: ${viewportIndex}`); - - // Make sure we have an active protocol with a non-empty array of display sets - if (!this.getNumProtocolStages()) { - return; - } - - // Retrieve the current display set in the display set sequence - const stageModel = this.getCurrentStageModel(); - - // If the current display set does not fulfill the requirements to be displayed, - // stop here. - if (!stageModel || - !stageModel.viewportStructure || - !stageModel.viewports || - !stageModel.viewports.length) { - return; - } - - // Retrieve the layoutTemplate associated with the current display set's viewport structure - // If no such template name exists, stop here. - const layoutTemplateName = stageModel.viewportStructure.getLayoutTemplateName(); - if (!layoutTemplateName) { - return; - } - - // Retrieve the properties associated with the current display set's viewport structure template - // If no such layout properties exist, stop here. - const layoutProps = stageModel.viewportStructure.properties; - if (!layoutProps) { - return; - } - - // Create an empty array to store the output viewportData - const viewportData = []; - - // Empty the matchDetails associated with the ProtocolEngine. - // This will be used to store the pass/fail details and score - // for each of the viewport matching procedures - this.matchDetails = []; - - // Loop through each viewport - stageModel.viewports.forEach((viewport, viewportIndex) => { - const details = this.matchImages(viewport, viewportIndex); - - this.matchDetails[viewportIndex] = details; - - // Convert any YES/NO values into true/false for Cornerstone - const cornerstoneViewportParams = {}; - - // Cache viewportSettings keys - const viewportSettingsKeys = Object.keys(viewport.viewportSettings); - - viewportSettingsKeys.forEach(key => { - let value = viewport.viewportSettings[key]; - if (value === 'YES') { - value = true; - } else if (value === 'NO') { - value = false; - } - - cornerstoneViewportParams[key] = value; - }); - - // imageViewerViewports occasionally needs relevant layout data in order to set - // the element style of the viewport in question - const currentViewportData = { - viewportIndex, - viewport: cornerstoneViewportParams, - ...layoutProps - }; - - const customSettings = []; - viewportSettingsKeys.forEach(id => { - const setting = HP.CustomViewportSettings[id]; - if (!setting) { - return; - } - - customSettings.push({ - id: id, - value: viewport.viewportSettings[id] - }); - }); - - currentViewportData.renderedCallback = element => { - //console.log('renderedCallback for ' + element.id); - customSettings.forEach(customSetting => { - OHIF.log.info(`ProtocolEngine::currentViewportData.renderedCallback Applying custom setting: ${customSetting.id}`); - OHIF.log.info(`ProtocolEngine::currentViewportData.renderedCallback with value: ${customSetting.value}`); - - const setting = HP.CustomViewportSettings[customSetting.id]; - setting.callback(element, customSetting.value); - }); - }; - - let currentMatch = details.bestMatch; - let currentPosition = 1; - const scoresLength = details.matchingScores.length; - while (currentPosition < scoresLength && _.findWhere(viewportData, { - imageId: currentMatch.imageId - })) { - currentMatch = details.matchingScores[currentPosition]; - currentPosition++; - } - - if (currentMatch && currentMatch.imageId) { - currentViewportData.studyInstanceUid = currentMatch.studyInstanceUid; - currentViewportData.seriesInstanceUid = currentMatch.seriesInstanceUid; - currentViewportData.sopInstanceUid = currentMatch.sopInstanceUid; - currentViewportData.currentImageIdIndex = currentMatch.currentImageIdIndex; - currentViewportData.displaySetInstanceUid = currentMatch.displaySetInstanceUid; - currentViewportData.imageId = currentMatch.imageId; - } - - // @TODO Why should we throw an exception when a best match is not found? This was aborting the whole process. - // if (!currentViewportData.displaySetInstanceUid) { - // throw new OHIFError('ProtocolEngine::updateViewports No matching display set found?'); - // } - - viewportData.push(currentViewportData); - }); - - this.LayoutManager.layoutTemplateName = layoutTemplateName; - this.LayoutManager.layoutProps = layoutProps; - this.LayoutManager.viewportData = viewportData; - - if (viewportIndex !== undefined && viewportData[viewportIndex]) { - this.LayoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, viewportData[viewportIndex]); - } else { - this.LayoutManager.updateViewports(); - } - } - - /** - * Sets the current Hanging Protocol to the specified Protocol - * An optional argument can also be used to prevent the updating of the Viewports - * - * @param newProtocol - * @param updateViewports - */ - setHangingProtocol(newProtocol, updateViewports = true) { - OHIF.log.info('ProtocolEngine::setHangingProtocol newProtocol', newProtocol); - OHIF.log.info(`ProtocolEngine::setHangingProtocol updateViewports = ${updateViewports}`); - - // Reset the array of newStageIds - this.newStageIds = []; - - if (HP.Protocol.prototype.isPrototypeOf(newProtocol)) { - this.protocol = newProtocol; - } else { - this.protocol = new HP.Protocol(); - this.protocol.fromObject(newProtocol); - } - - this.stage = 0; - - // Update viewports by default - if (updateViewports) { - this.updateViewports(); - } - - MatchedProtocols.update({}, { - $set: { - selected: false - } - }, { - multi: true - }); - - MatchedProtocols.update({ - id: this.protocol.id - }, { - $set: { - selected: true - } - }); - - Session.set('HangingProtocolName', this.protocol.name); - Session.set('HangingProtocolStage', this.stage); - } - - /** - * Check if the next stage is available - * @return {Boolean} True if next stage is available or false otherwise - */ - isNextStageAvailable() { - const numberOfStages = this.getNumProtocolStages(); - - return this.stage + 1 < numberOfStages; - } - - /** - * Check if the previous stage is available - * @return {Boolean} True if previous stage is available or false otherwise - */ - isPreviousStageAvailable() { - return this.stage - 1 >= 0; - } - - /** - * Changes the current stage to a new stage index in the display set sequence. - * It checks if the next stage exists. - * - * @param {Integer} stageAction An integer value specifying wheater next (1) or previous (-1) stage - * @return {Boolean} True if new stage has set or false, otherwise - */ - setCurrentProtocolStage(stageAction) { - // Check if previous or next stage is available - if (stageAction === -1 && !this.isPreviousStageAvailable()) { - return false; - } else if (stageAction === 1 && !this.isNextStageAvailable()) { - return false; - } - - // Sets the new stage - this.stage += stageAction; - - // Log the new stage - OHIF.log.info(`ProtocolEngine::setCurrentProtocolStage stage = ${this.stage}`); - - // Set stage Session variable for reactivity - Session.set('HangingProtocolStage', this.stage); - - // Since stage has changed, we need to update the viewports - // and redo matchings - this.updateViewports(); - - // Everything went well - return true; - } - - /** - * Retrieves the number of Stages in the current Protocol or - * undefined if no protocol or stages are set - */ - getNumProtocolStages() { - if (!this.protocol || !this.protocol.stages || !this.protocol.stages.length) { - return; - } - - return this.protocol.stages.length; - } - - /** - * Switches to the next protocol stage in the display set sequence - */ - nextProtocolStage() { - OHIF.log.info('ProtocolEngine::nextProtocolStage'); - - if (!this.setCurrentProtocolStage(1)) { - // Just for logging purpose - OHIF.log.info('ProtocolEngine::nextProtocolStage failed'); - } - } - - /** - * Switches to the previous protocol stage in the display set sequence - */ - previousProtocolStage() { - OHIF.log.info('ProtocolEngine::previousProtocolStage'); - - if (!this.setCurrentProtocolStage(-1)) { - // Just for logging purpose - OHIF.log.info('ProtocolEngine::previousProtocolStage failed'); - } - } -}; diff --git a/Packages/ohif-hanging-protocols/client/protocolStore/defaultStrategy.js b/Packages/ohif-hanging-protocols/client/protocolStore/defaultStrategy.js deleted file mode 100644 index bd78131ba..000000000 --- a/Packages/ohif-hanging-protocols/client/protocolStore/defaultStrategy.js +++ /dev/null @@ -1,309 +0,0 @@ -import { Meteor } from "meteor/meteor"; -// The ProtocolStore default strategy is used to persist hanging protocols in -// the MongoDB collection 'HangingProtocols' in the application server. - -var defaultStrategy = (function () { - - var hangingProtocolSubs; - - function addDefaultProtocols() { - console.log('Inserting default protocols'); - - addProtocol(HP.defaultProtocol); - } - - function getDatabaseIdByProtocolId(protocolId) { - const filteredProtocol = HangingProtocols.findOne({ - id: protocolId - }, { - fields: { - _id: true - } - }); - - if (!filteredProtocol) { - return; - } - - return filteredProtocol._id; - } - - /** - * Registers a function to be called when the hangingprotocols collection is subscribed - * The callback is called only one time when the subscription is ready - * - * @param callback The function to be called as a callback - */ - function onReady(callback) { - if (hangingProtocolSubs && hangingProtocolSubs.ready()) { - // It is already ready - callback(); - } else { - // Subscribe the hangingprotocols collection - hangingProtocolSubs = Meteor.subscribe('hangingprotocols'); - - // Wait for the subscription to be ready - Tracker.autorun((computation) => { - if (hangingProtocolSubs.ready()) { - computation.stop(); - addDefaultProtocols(); - callback(); - } - }); - } - } - - /** - * Gets the hanging protocol by protocolId if defined, otherwise all stored hanging protocols - * - * @param protocolId The protocol ID used to find the hanging protocol - * @returns {object|array} The hanging protocol by protocolId or array of the stored hanging protocols - */ - function getProtocol(protocolId) { - // Return the hanging protocol by protocolId if defined - if (protocolId) { - return HangingProtocols.findOne({ - id: protocolId - }); - } - - // Otherwise, return all protocols - return HangingProtocols.find().fetch(); - } - - /** - * Stores the hanging protocol - * - * @param protocol The hanging protocol to be stored - */ - function addProtocol(protocol) { - // Collections can only be updated by database ID (_id) on client, so - // get the database ID (_id) by the hanging protocol ID firstly - const databaseId = getDatabaseIdByProtocolId(protocol.id); - - // Remove any MongoDB ID the protocol may have had - delete protocol._id; - - // Update the protocol with the same id if exists instead of inserting this protocol - if (databaseId) { - // Update the hanging protocol by the database ID - HangingProtocols.update(databaseId, { - $set: protocol - }); - - return; - } - - // Insert the protocol - HangingProtocols.insert(protocol); - } - - /** - * Updates the hanging protocol by protocolId - * - * @param protocolId The protocol ID used to find the hanging protocol to update - * @param protocol The updated hanging protocol - */ - function updateProtocol(protocolId, protocol) { - // Collections can only be updated by database ID (_id) on client, so - // get the database ID (_id) by the hanging protocol ID firstly - const databaseId = getDatabaseIdByProtocolId(protocolId); - - // Skip if it does not exist in database - if (!databaseId) { - return; - } - - // Remove any MongoDB ID the protocol may have had - delete protocol._id; - - // Update the hanging protocol by the database ID - HangingProtocols.update(databaseId, { - $set: protocol - }); - } - - /** - * Removes the hanging protocol - * - * @param protocolId The protocol ID used to remove the hanging protocol - */ - function removeProtocol(protocolId) { - // Collections can only be removed by database ID (_id) on client, so - // get the database ID (_id) by the hanging protocol ID firstly - const databaseId = getDatabaseIdByProtocolId(protocolId); - - // Skip if it does not exist in database - if (!databaseId) { - return; - } - - // Remove the hanging protocol by the database ID - HangingProtocols.remove(databaseId); - } - - // Module Exports - return { - onReady: onReady, - getProtocol: getProtocol, - addProtocol: addProtocol, - updateProtocol: updateProtocol, - removeProtocol: removeProtocol - }; - -})(); - -var clientOnlyStrategy = (function () { - const HangingProtocols = new Mongo.Collection(null); - - let defaultsAdded = false; - - function addDefaultProtocols() { - console.log('Inserting default protocols'); - - addProtocol(HP.defaultProtocol); - - defaultsAdded = true; - } - - function getDatabaseIdByProtocolId(protocolId) { - const filteredProtocol = HangingProtocols.findOne({ - id: protocolId - }, { - fields: { - _id: true - } - }); - - if (!filteredProtocol) { - return; - } - - return filteredProtocol._id; - } - - /** - * Registers a function to be called when the hangingprotocols collection is subscribed - * The callback is called only one time when the subscription is ready - * - * @param callback The function to be called as a callback - */ - function onReady(callback) { - if (!defaultsAdded) { - addDefaultProtocols(); - } - - callback(); - } - - /** - * Gets the hanging protocol by protocolId if defined, otherwise all stored hanging protocols - * - * @param protocolId The protocol ID used to find the hanging protocol - * @returns {object|array} The hanging protocol by protocolId or array of the stored hanging protocols - */ - function getProtocol(protocolId) { - // Return the hanging protocol by protocolId if defined - if (protocolId) { - return HangingProtocols.findOne({ - id: protocolId - }); - } - - // Otherwise, return all protocols - return HangingProtocols.find().fetch(); - } - - /** - * Stores the hanging protocol - * - * @param protocol The hanging protocol to be stored - */ - function addProtocol(protocol) { - // Collections can only be updated by database ID (_id) on client, so - // get the database ID (_id) by the hanging protocol ID firstly - const databaseId = getDatabaseIdByProtocolId(protocol.id); - - // Remove any MongoDB ID the protocol may have had - delete protocol._id; - - // Update the protocol with the same id if exists instead of inserting this protocol - if (databaseId) { - // Update the hanging protocol by the database ID - HangingProtocols.update(databaseId, { - $set: protocol - }); - - return; - } - - // Insert the protocol - HangingProtocols.insert(protocol); - } - - /** - * Updates the hanging protocol by protocolId - * - * @param protocolId The protocol ID used to find the hanging protocol to update - * @param protocol The updated hanging protocol - */ - function updateProtocol(protocolId, protocol) { - // Collections can only be updated by database ID (_id) on client, so - // get the database ID (_id) by the hanging protocol ID firstly - const databaseId = getDatabaseIdByProtocolId(protocolId); - - // Skip if it does not exist in database - if (!databaseId) { - return; - } - - // Remove any MongoDB ID the protocol may have had - delete protocol._id; - - // Update the hanging protocol by the database ID - HangingProtocols.update(databaseId, { - $set: protocol - }); - } - - /** - * Removes the hanging protocol - * - * @param protocolId The protocol ID used to remove the hanging protocol - */ - function removeProtocol(protocolId) { - // Collections can only be removed by database ID (_id) on client, so - // get the database ID (_id) by the hanging protocol ID firstly - const databaseId = getDatabaseIdByProtocolId(protocolId); - - // Skip if it does not exist in database - if (!databaseId) { - return; - } - - // Remove the hanging protocol by the database ID - HangingProtocols.remove(databaseId); - } - - // Module Exports - return { - onReady: onReady, - getProtocol: getProtocol, - addProtocol: addProtocol, - updateProtocol: updateProtocol, - removeProtocol: removeProtocol - }; - -})(); - -// If we are running a disconnect client similar to the StandaloneViewer -// (see https://docs.ohif.org/standalone-viewer/usage.html) we don't want -// our HangingProtocol strategy to try to use Meteor methods or Pub / Sub -if (Meteor.settings && - Meteor.settings.public && - Meteor.settings.public.clientOnly === true) { - HP.ProtocolStore.setStrategy(clientOnlyStrategy); -} else { - HP.ProtocolStore.setStrategy(defaultStrategy); -} - diff --git a/Packages/ohif-hanging-protocols/client/protocolStore/protocolStore.js b/Packages/ohif-hanging-protocols/client/protocolStore/protocolStore.js deleted file mode 100644 index dc79a3ece..000000000 --- a/Packages/ohif-hanging-protocols/client/protocolStore/protocolStore.js +++ /dev/null @@ -1,113 +0,0 @@ -// The ProtocolStore module allows persisting hanging protocols using different strategies. -// For example, one strategy stores hanging protocols in the application server while -// another strategy stores them in a remote machine, but only one strategy can be used at a time. - -HP.ProtocolStore = (function () { - - var strategy; - - /** - * Sets the strategy used to persist hanging protocols - * - * @param preferredStrategy A preferred strategy will be using to persist hanging protocols - */ - function setStrategy(preferredStrategy) { - strategy = preferredStrategy; - } - - /** - * Registers a function to be called when the protocol store is ready to persist hanging protocols - * - * NOTE: Strategies should implement this function - * - * @param callback The function to be called as a callback - */ - function onReady(callback) { - strategy.onReady(callback); - } - - /** - * Get a HP.Protocol instance for the given protocol object - * @param {Object} protocolObject Protocol plain object - * @return {HP.Protocol} HP.Protocol instance for the given protocol object - */ - function getProtocolInstance(protocolObject) { - const protocolInstance = new HP.Protocol(); - protocolInstance.fromObject(protocolObject); - - return protocolInstance; - } - - /** - * Gets the hanging protocol by protocolId if defined, otherwise all stored hanging protocols - * - * NOTE: Strategies should implement this function - * - * @param protocolId The protocol ID used to find the hanging protocol - * @returns {object|array} The hanging protocol by protocolId or array of the stored hanging protocols - */ - function getProtocol(protocolId) { - let result = strategy.getProtocol(protocolId); - - // If result is an array of protocols objects - if (result instanceof Array) { - result.forEach( (protocol, index) => { - // Check if protocol is an instance of HP.Protocol - if (!(protocol instanceof HP.Protocol)) { - result[index] = getProtocolInstance(protocol); - } - }); - } else if (result !== void 0 && !(result instanceof HP.Protocol)) { - // Check if result exists and is not an instance of HP.Protocol - result = getProtocolInstance(result); - } - - - return result; - } - - /** - * Stores the hanging protocol - * - * NOTE: Strategies should implement this function - * - * @param protocol The hanging protocol to be stored - */ - function addProtocol(protocol) { - strategy.addProtocol(protocol); - } - - /** - * Updates the hanging protocol by protocolId - * - * NOTE: Strategies should implement this function - * - * @param protocolId The protocol ID used to find the hanging protocol to update - * @param protocol The updated hanging protocol - */ - function updateProtocol(protocolId, protocol) { - strategy.updateProtocol(protocolId, protocol); - } - - /** - * Removes the hanging protocol - * - * NOTE: Strategies should implement this function - * - * @param protocolId The protocol ID used to remove the hanging protocol - */ - function removeProtocol(protocolId) { - strategy.removeProtocol(protocolId); - } - - // Module Exports - return { - setStrategy: setStrategy, - onReady: onReady, - getProtocol: getProtocol, - addProtocol: addProtocol, - updateProtocol: updateProtocol, - removeProtocol: removeProtocol - }; - -})(); diff --git a/Packages/ohif-hanging-protocols/package.js b/Packages/ohif-hanging-protocols/package.js deleted file mode 100755 index 887e01e9b..000000000 --- a/Packages/ohif-hanging-protocols/package.js +++ /dev/null @@ -1,93 +0,0 @@ -Package.describe({ - name: 'ohif:hanging-protocols', - summary: 'Support functions for using DICOM Hanging Protocols', - version: '0.0.1' -}); - -Npm.depends({ - 'validate.js': '0.9.0' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('standard-app-packages'); - api.use('jquery'); - api.use('stylus'); - api.use('random'); - api.use('templating'); - api.use('natestrauser:select2@4.0.1', 'client'); - api.use('clinical:router@2.0.19'); - api.use('momentjs:moment'); - - // Our custom packages - api.use('ohif:core'); - api.use('ohif:viewerbase'); - - api.addAssets('assets/dots.svg', 'client'); - - // Both client & server - api.addFiles('both/namespace.js'); - api.addFiles('both/collections.js'); - api.addFiles('both/schema.js'); - api.addFiles('both/hardcodedData.js'); - api.addFiles('both/testData.js'); - - // Client-only - api.addFiles('client/collections.js', 'client'); - api.addFiles('client/protocolEngine.js', 'client'); - api.addFiles('client/helpers/displayConstraint.js', 'client'); - api.addFiles('client/helpers/attributes.js', 'client'); - api.addFiles('client/protocolStore/protocolStore.js', 'client'); - api.addFiles('client/protocolStore/defaultStrategy.js', 'client'); - - // UI Components - api.addFiles('client/components/previousPresentationGroupButton/previousPresentationGroupButton.html', 'client'); - api.addFiles('client/components/previousPresentationGroupButton/previousPresentationGroupButton.js', 'client'); - - api.addFiles('client/components/nextPresentationGroupButton/nextPresentationGroupButton.html', 'client'); - api.addFiles('client/components/nextPresentationGroupButton/nextPresentationGroupButton.js', 'client'); - - api.addFiles('client/components/matchedProtocols/matchedProtocols.html', 'client'); - api.addFiles('client/components/matchedProtocols/matchedProtocols.styl', 'client'); - api.addFiles('client/components/matchedProtocols/matchedProtocols.js', 'client'); - - api.addFiles('client/components/protocolEditor/protocolEditor.html', 'client'); - api.addFiles('client/components/protocolEditor/protocolEditor.styl', 'client'); - api.addFiles('client/components/protocolEditor/protocolEditor.js', 'client'); - - api.addFiles('client/components/ruleTable/ruleTable.html', 'client'); - api.addFiles('client/components/ruleTable/ruleTable.styl', 'client'); - api.addFiles('client/components/ruleTable/ruleTable.js', 'client'); - - api.addFiles('client/components/ruleEntryDialog/ruleEntryDialog.html', 'client'); - api.addFiles('client/components/ruleEntryDialog/ruleEntryDialog.styl', 'client'); - api.addFiles('client/components/ruleEntryDialog/ruleEntryDialog.js', 'client'); - - api.addFiles('client/components/settingEntryDialog/settingEntryDialog.html', 'client'); - api.addFiles('client/components/settingEntryDialog/settingEntryDialog.styl', 'client'); - api.addFiles('client/components/settingEntryDialog/settingEntryDialog.js', 'client'); - - api.addFiles('client/components/textEntryDialog/textEntryDialog.html', 'client'); - api.addFiles('client/components/textEntryDialog/textEntryDialog.styl', 'client'); - api.addFiles('client/components/textEntryDialog/textEntryDialog.js', 'client'); - - api.addFiles('client/components/settingsTable/settingsTable.html', 'client'); - api.addFiles('client/components/settingsTable/settingsTable.styl', 'client'); - api.addFiles('client/components/settingsTable/settingsTable.js', 'client'); - - api.addFiles('client/components/stageDetails/stageDetails.html', 'client'); - api.addFiles('client/components/stageDetails/stageDetails.styl', 'client'); - api.addFiles('client/components/stageDetails/stageDetails.js', 'client'); - - api.addFiles('client/components/stageSortable/stageSortable.html', 'client'); - api.addFiles('client/components/stageSortable/stageSortable.styl', 'client'); - api.addFiles('client/components/stageSortable/stageSortable.js', 'client'); - - // Server-only - api.addFiles('server/collections.js', 'server'); - - // Global exports - api.export('HP'); -}); diff --git a/Packages/ohif-hanging-protocols/server/collections.js b/Packages/ohif-hanging-protocols/server/collections.js deleted file mode 100644 index a39a3621d..000000000 --- a/Packages/ohif-hanging-protocols/server/collections.js +++ /dev/null @@ -1,4 +0,0 @@ -Meteor.publish('hangingprotocols', function() { - // TODO: filter by availableTo user - return HangingProtocols.find(); -}); diff --git a/Packages/ohif-header/client/components/header/header.html b/Packages/ohif-header/client/components/header/header.html deleted file mode 100644 index 14c21f73b..000000000 --- a/Packages/ohif-header/client/components/header/header.html +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/Packages/ohif-header/client/components/header/header.js b/Packages/ohif-header/client/components/header/header.js deleted file mode 100644 index e02a9a327..000000000 --- a/Packages/ohif-header/client/components/header/header.js +++ /dev/null @@ -1,29 +0,0 @@ -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -Template.header.onCreated(() => { - const instance = Template.instance(); - - instance.dropdownItems = []; - instance.autorun(() => { - OHIF.header.dropdown.observer.depend(); - instance.dropdownItems = OHIF.header.dropdown.getItems(); - }); -}); - -Template.header.events({ - 'click .header-menu'(event, instance) { - event.preventDefault(); - - // Prevent dropdown from being opened if there's one already opened - if ($(event.currentTarget).find('.dropdown').length) return; - - // Show the dropdown - OHIF.ui.showDropdown(instance.dropdownItems, { - parentElement: event.currentTarget, - menuClasses: 'dropdown-menu-right', - marginTop: '25px' - }); - } -}); diff --git a/Packages/ohif-header/client/components/header/header.styl b/Packages/ohif-header/client/components/header/header.styl deleted file mode 100644 index 551e89ffd..000000000 --- a/Packages/ohif-header/client/components/header/header.styl +++ /dev/null @@ -1,26 +0,0 @@ -@import "{ohif:design}/app" - -body>.header - height: $topBarHeight - padding: 10px 10px 0 - theme('color', '$textPrimaryColor') - theme('background-color', '$primaryBackgroundColor') - transition(all 0.5s ease) - - &>.clearfix - position: relative - - .header-menu - padding: 4px 0 - font-size: 13px - font-weight: 400 - line-height: 18px - text-decoration: none - theme('color', '$defaultColor') - - &:empty - display: none - - &.header-big - height: $topBarExpandedHeight - background-color: rgba(21, 25, 30, 0.7) diff --git a/Packages/ohif-header/client/components/index.js b/Packages/ohif-header/client/components/index.js deleted file mode 100644 index 2ed540fd4..000000000 --- a/Packages/ohif-header/client/components/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './header/header.html'; -import './header/header.js'; -import './header/header.styl'; diff --git a/Packages/ohif-header/client/index.js b/Packages/ohif-header/client/index.js deleted file mode 100644 index 758f32245..000000000 --- a/Packages/ohif-header/client/index.js +++ /dev/null @@ -1 +0,0 @@ -import './components'; diff --git a/Packages/ohif-header/main.js b/Packages/ohif-header/main.js deleted file mode 100644 index 7ec438718..000000000 --- a/Packages/ohif-header/main.js +++ /dev/null @@ -1,11 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/* - * Defines the base OHIF header object - */ -const dropdown = new OHIF.ui.Dropdown(); -const header = { dropdown }; - -OHIF.header = header; - -export { header }; diff --git a/Packages/ohif-header/package.js b/Packages/ohif-header/package.js deleted file mode 100644 index bc67eae33..000000000 --- a/Packages/ohif-header/package.js +++ /dev/null @@ -1,24 +0,0 @@ -Package.describe({ - name: 'ohif:header', - summary: 'OHIF Header Templates', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - // Meteor packages - api.use('ecmascript'); - api.use('templating'); - api.use('underscore'); - api.use('stylus'); - - // OHIF dependencies - api.use('ohif:core', 'client'); - - // Main module - api.mainModule('main.js', 'client'); - - // Client imports - api.addFiles('client/index.js', 'client'); -}); diff --git a/Packages/ohif-hotkeys/client/classes/HotkeysContext.js b/Packages/ohif-hotkeys/client/classes/HotkeysContext.js deleted file mode 100644 index 56cc60be3..000000000 --- a/Packages/ohif-hotkeys/client/classes/HotkeysContext.js +++ /dev/null @@ -1,65 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -export class HotkeysContext { - constructor(name, definitions, enabled) { - this.name = name; - this.definitions = Object.assign({}, definitions); - this.enabled = enabled; - } - - extend(definitions={}) { - if (typeof definitions !== 'object') return; - this.definitions = Object.assign({}, definitions); - Object.keys(definitions).forEach(command => { - const hotkey = definitions[command]; - this.unregister(command); - if (hotkey) { - this.register(command, hotkey); - } - - this.definitions[command] = hotkey; - }); - } - - register(command, hotkey) { - if (!hotkey) { - return; - } - - if (!command) { - return OHIF.log.warn(`No command was defined for hotkey "${hotkey}"`); - } - - const bindingKey = `keydown.hotkey.${this.name}.${command}`; - const bind = hotkey => $(document).bind(bindingKey, hotkey, event => { - if (!this.enabled.get()) return; - OHIF.commands.run(command); - event.preventDefault(); - }); - - if (hotkey instanceof Array) { - hotkey.forEach(hotkey => bind(hotkey)); - } else { - bind(hotkey); - } - } - - unregister(command) { - const bindingKey = `keydown.hotkey.${this.name}.${command}`; - if (this.definitions[command]) { - $(document).unbind(bindingKey); - delete this.definitions[command]; - } - } - - initialize() { - Object.keys(this.definitions).forEach(command => { - const hotkey = this.definitions[command]; - this.register(command, hotkey); - }); - } - - destroy() { - $(document).unbind(`keydown.hotkey.${this.name}`); - } -} diff --git a/Packages/ohif-hotkeys/client/classes/HotkeysManager.js b/Packages/ohif-hotkeys/client/classes/HotkeysManager.js deleted file mode 100644 index 078060bed..000000000 --- a/Packages/ohif-hotkeys/client/classes/HotkeysManager.js +++ /dev/null @@ -1,156 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { Session } from 'meteor/session'; -import { OHIF } from 'meteor/ohif:core'; -import { HotkeysContext } from 'meteor/ohif:hotkeys/client/classes/HotkeysContext'; - -export class HotkeysManager { - constructor() { - this.contexts = {}; - this.defaults = {}; - this.currentContextName = null; - this.enabled = new ReactiveVar(true); - this.retrieveFunction = null; - this.storeFunction = null; - this.changeObserver = new Tracker.Dependency(); - - Tracker.autorun(() => { - const contextName = OHIF.context.get(); - - // Avoind falling in MongoDB collections reactivity - Tracker.nonreactive(() => this.switchToContext(contextName)); - }); - } - - setRetrieveFunction(retrieveFunction) { - this.retrieveFunction = retrieveFunction; - } - - setStoreFunction(storeFunction) { - this.storeFunction = storeFunction; - } - - store(contextName, definitions) { - const storageKey = `hotkeysDefinitions.${contextName}`; - return new Promise((resolve, reject) => { - if (this.storeFunction) { - this.storeFunction.call(this, storageKey, definitions).then(resolve).catch(reject); - } else if (OHIF.user.userLoggedIn()) { - OHIF.user.setData(storageKey, definitions).then(resolve).catch(reject); - } else { - Session.setPersistent(storageKey, definitions); - resolve(); - } - }); - } - - retrieve(contextName) { - const storageKey = `hotkeysDefinitions.${contextName}`; - return new Promise((resolve, reject) => { - if (this.retrieveFunction) { - this.retrieveFunction(contextName).then(resolve).catch(reject); - } else if (OHIF.user.userLoggedIn()) { - try { - resolve(OHIF.user.getData(storageKey)); - } catch(error) { - reject(error); - } - } else { - resolve(Session.get(storageKey)); - } - }); - } - - disable() { - this.enabled.set(false); - } - - enable() { - this.enabled.set(true); - } - - getContext(contextName) { - return this.contexts[contextName]; - } - - getCurrentContext() { - return this.getContext(this.currentContextName); - } - - load(contextName) { - return new Promise((resolve, reject) => { - const context = this.getContext(contextName); - if (!context) return reject(); - this.retrieve(contextName).then(defs => { - const definitions = defs || this.defaults[contextName]; - if (!definitions) { - this.changeObserver.changed(); - return reject(); - } - - context.destroy(); - context.definitions = definitions; - context.initialize(); - this.changeObserver.changed(); - resolve(definitions); - }).catch(reject); - }); - } - - set(contextName, contextDefinitions, isDefaultDefinitions=false) { - const enabled = this.enabled; - const context = new HotkeysContext(contextName, contextDefinitions, enabled); - const currentContext = this.getCurrentContext(); - if (currentContext && currentContext.name === contextName) { - currentContext.destroy(); - context.initialize(); - } - - this.contexts[contextName] = context; - if (isDefaultDefinitions) { - this.defaults[contextName] = contextDefinitions; - } - } - - register(contextName, command, hotkey) { - if (!command || !hotkey) return; - const context = this.getContext(contextName); - if (!context) { - this.set(contextName, {}); - } - - context.register(command, hotkey); - } - - unsetContext(contextName) { - if (contextName === this.currentContextName) { - this.getCurrentContext().destroy(); - } - - delete this.contexts[contextName]; - delete this.defaults[contextName]; - } - - resetDefaults(contextName) { - const context = this.getContext(contextName); - const definitions = this.defaults[contextName]; - if (!context || !definitions) return; - context.extend(definitions); - return this.store(contextName, definitions); - } - - switchToContext(contextName) { - const currentContext = this.getCurrentContext(); - if (currentContext) { - currentContext.destroy(); - } - - const newContext = this.contexts[contextName]; - if (!newContext) return; - - this.currentContextName = contextName; - newContext.initialize(); - this.load(contextName).catch(() => {}); - } -} diff --git a/Packages/ohif-hotkeys/client/components/confirmReplacementPopover.html b/Packages/ohif-hotkeys/client/components/confirmReplacementPopover.html deleted file mode 100644 index 2f47094bf..000000000 --- a/Packages/ohif-hotkeys/client/components/confirmReplacementPopover.html +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/Packages/ohif-hotkeys/client/components/form.html b/Packages/ohif-hotkeys/client/components/form.html deleted file mode 100644 index 8487288d5..000000000 --- a/Packages/ohif-hotkeys/client/components/form.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/Packages/ohif-hotkeys/client/components/form.js b/Packages/ohif-hotkeys/client/components/form.js deleted file mode 100644 index 7d815eae6..000000000 --- a/Packages/ohif-hotkeys/client/components/form.js +++ /dev/null @@ -1,237 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.hotkeysForm.onCreated(() => { - const instance = Template.instance(); - const { contextName } = instance.data; - - instance.api = { - save() { - const form = instance.$('form').first().data('component'); - const definitions = form.value(); - const promise = OHIF.hotkeys.store(contextName, definitions); - promise.then(() => { - const successMessage = 'The keyboard shortcut preferences were successfully saved.'; - OHIF.ui.notifications.success({ text: successMessage }); - OHIF.hotkeys.load(contextName).then(defs => instance.hotkeysDefinitions.set(defs)); - }); - return promise; - }, - - resetDefaults() { - const dialogOptions = { - class: 'themed', - title: 'Reset Keyboard Shortcuts', - message: 'Are you sure you want to reset all the shortcuts to their defaults?' - }; - - return OHIF.ui.showDialog('dialogConfirm', dialogOptions).then(() => { - const resetDefaults = OHIF.hotkeys.resetDefaults(contextName); - resetDefaults.then(() => { - OHIF.hotkeys.load(contextName).then(defs => instance.hotkeysDefinitions.set(defs)); - }); - }); - } - }; - - const rg = (start, end) => _.range(start, end + 1); - instance.allowedKeys = _.union( - [8, 13, 27, 32, 46], // BACKSPACE, ENTER, ESCAPE, SPACE, DELETE - [12, 106, 107, 109, 110, 111], // Numpad keys - rg(219, 221), // [\] - rg(186, 191), // ;=,-./ - rg(112, 130), // F1-F19 - rg(33, 40), // arrow keys, home/end, pg dn/up - rg(48, 57), // 0-9 - rg(65, 90) // A-Z - ); - - instance.updateInputText = (event, displayPressedKey=false) => { - const $target = $(event.currentTarget); - const keysPressedArray = instance.getKeysPressedArray(event); - - if (displayPressedKey) { - const specialKeyName = jQuery.hotkeys.specialKeys[event.which]; - const keyName = specialKeyName || String.fromCharCode(event.keyCode) || event.key; - keysPressedArray.push(keyName.toUpperCase()); - } - - $target.val(keysPressedArray.join('+')); - }; - - instance.getKeysPressedArray = event => { - const keysPressedArray = []; - - if (event.ctrlKey && !event.altKey) { - keysPressedArray.push('CTRL'); - } - - if (event.shiftKey && !event.altKey) { - keysPressedArray.push('SHIFT'); - } - - if (event.altKey && !event.ctrlKey) { - keysPressedArray.push('ALT'); - } - - return keysPressedArray; - }; - - instance.getConflictingCommand = (currentCommand, currentCombination) => { - const form = instance.$('form').first().data('component'); - const hotkeys = form.value(); - - let conflict = ''; - _.each(hotkeys, (combination, command) => { - if (combination && combination === currentCombination && command !== currentCommand) { - conflict = command; - } - }); - - return conflict; - }; - - instance.disallowedCombinations = { - '': [], - ALT: ['SPACE'], - SHIFT: [], - CTRL: ['F4', 'F5', 'F11', 'W', 'R', 'T', 'O', 'P', 'A', 'D', 'F', 'G', 'H', 'J', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'PAGEDOWN', 'PAGEUP'], - 'CTRL+SHIFT': ['Q', 'W', 'R', 'T', 'P', 'A', 'H', 'V', 'B', 'N'] - }; - - const hotkeysContext = OHIF.hotkeys.getContext(contextName) || {}; - instance.hotkeysDefinitions = new ReactiveVar(hotkeysContext.definitions); - OHIF.hotkeys.load(contextName).then(defs => instance.hotkeysDefinitions.set(defs)); -}); - -Template.hotkeysForm.events({ - 'keydown .hotkey'(event, instance) { - // Prevent ESC key from propagating and closing the modal - if (event.keyCode === 27) { - event.stopPropagation(); - } - - if (instance.allowedKeys.indexOf(event.keyCode) > -1) { - instance.updateInputText(event, true); - $(event.currentTarget).trigger('hotkeyChange'); - } else { - instance.updateInputText(event); - } - - event.preventDefault(); - }, - - 'hotkeyChange .hotkey'(event, instance, data={}) { - const $target = $(event.currentTarget); - const combination = $target.val(); - const keys = combination.split('+'); - const lastKey = keys.pop(); - const modifierCombination = keys.join('+'); - const isModifier = ['CTRL', 'ALT', 'SHIFT'].indexOf(lastKey) > -1; - - const formItem = $target.data('component'); - const conflictedCommand = instance.getConflictingCommand(this.key, combination); - if (isModifier) { - // Clean the input if left with only a modifier key or browser specific command - formItem.error(`It's not possible to define only modifier keys (CTRL, ALT and SHIFT) as a shortcut`); - $target.val('').focus(); - } else if (instance.disallowedCombinations[modifierCombination].indexOf(lastKey) > -1) { - // Clean the input and show error if combination is not allowed - formItem.error(`The "${combination}" shortcut combination is not allowed`); - $target.val('').focus(); - } else if (conflictedCommand) { - if (data.blurTrigger) return; - - // Remove the error message - formItem.error(false); - formItem.toggleTooltip(false); - - const placement = $target.closest('.hotkeys-left').length ? 'right' : 'left'; - const commandsContext = OHIF.commands.getContext(instance.data.contextName); - const popoverData = { - conflictedFunctionName: commandsContext[conflictedCommand].name, - newFunctionName: commandsContext[this.key].name, - hotkeyCombination: combination, - }; - - const popoverOptions = { - event, - placement - }; - - const conflictedFormItem = instance.$('form').first().data('component').item(conflictedCommand); - formItem.state('error', true); - conflictedFormItem.state('error', true); - - const cleanup = () => { - instance.popoverVisible = false; - formItem.state('error', false); - conflictedFormItem.state('error', false); - }; - - const popoverTemplate = 'hotkeysConfirmReplacementPopover'; - instance.popoverVisible = true; - OHIF.ui.showPopover(popoverTemplate, popoverData, popoverOptions).then(() => { - cleanup(); - formItem.value(combination); - conflictedFormItem.value(''); - $target.blur(); - }).catch(() => { - cleanup(); - $target.val('').focus(); - }); - } else { - // Remove the error message and blur the component if everything is fine - formItem.error(false); - if (!data.blurTrigger) { - $target.blur(); - } - } - }, - - 'blur .hotkey'(event, instance, data={}) { - $(event.currentTarget).trigger('hotkeyChange', { blurTrigger: true }); - }, - - 'keyup .hotkey'(event, instance) { - if (!instance.popoverVisible) { - instance.updateInputText(event); - } - } -}); - -Template.hotkeysForm.helpers({ - getHotkeyInputInformationLists() { - OHIF.hotkeys.changeObserver.depend(); - - const instance = Template.instance(); - const { contextName } = instance.data; - - const hotkeyDefinitions = instance.hotkeysDefinitions.get(); - const commandsContext = OHIF.commands.getContext(contextName); - if (!hotkeyDefinitions || !commandsContext) return {}; - - const commands = Object.keys(OHIF.hotkeys.defaults[contextName] || {}); - const list = []; - commands.forEach(commandName => { - const commandDefinitions = commandsContext[commandName]; - if (!commandDefinitions) return; - list.push({ - key: commandName, - label: commandDefinitions.name, - value: hotkeyDefinitions[commandName] || '' - }); - }); - - const left = list.splice(0, Math.ceil(list.length / 2)); - const right = list; - - return { - left, - right - }; - } -}); diff --git a/Packages/ohif-hotkeys/client/components/formTable.html b/Packages/ohif-hotkeys/client/components/formTable.html deleted file mode 100644 index e0039c7d5..000000000 --- a/Packages/ohif-hotkeys/client/components/formTable.html +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/Packages/ohif-hotkeys/client/components/formTable.js b/Packages/ohif-hotkeys/client/components/formTable.js deleted file mode 100644 index 4d2fb9f49..000000000 --- a/Packages/ohif-hotkeys/client/components/formTable.js +++ /dev/null @@ -1,17 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -Template.hotkeysFormTable.helpers({ - getLabel(input) { - let result = input.label; - if (input.key.indexOf('WLPreset') === 0) { - const presetIndex = parseInt(input.key.replace('WLPreset', '')); - const preset = OHIF.viewer.wlPresets[presetIndex]; - if (preset.id) { - result += ` (${preset.id})`; - } - } - - return result; - } -}); diff --git a/Packages/ohif-hotkeys/client/components/index.js b/Packages/ohif-hotkeys/client/components/index.js deleted file mode 100644 index 143029491..000000000 --- a/Packages/ohif-hotkeys/client/components/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import './confirmReplacementPopover.html'; - -import './form.html'; -import './form.js'; - -import './formTable.html'; -import './formTable.js'; diff --git a/Packages/ohif-hotkeys/client/index.js b/Packages/ohif-hotkeys/client/index.js deleted file mode 100644 index 758f32245..000000000 --- a/Packages/ohif-hotkeys/client/index.js +++ /dev/null @@ -1 +0,0 @@ -import './components'; diff --git a/Packages/ohif-hotkeys/main.js b/Packages/ohif-hotkeys/main.js deleted file mode 100644 index 9c359fe6e..000000000 --- a/Packages/ohif-hotkeys/main.js +++ /dev/null @@ -1,12 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { HotkeysManager } from 'meteor/ohif:hotkeys/client/classes/HotkeysManager'; -import 'jquery.hotkeys'; - -// Create hotkeys namespace using a HotkeysManager class instance -const hotkeys = new HotkeysManager(); - -// Append hotkeys namespace to OHIF namespace -OHIF.hotkeys = hotkeys; - -// Export relevant objects -export { hotkeys }; diff --git a/Packages/ohif-hotkeys/package.js b/Packages/ohif-hotkeys/package.js deleted file mode 100644 index 3d3949651..000000000 --- a/Packages/ohif-hotkeys/package.js +++ /dev/null @@ -1,33 +0,0 @@ -Package.describe({ - name: 'ohif:hotkeys', - summary: 'OHIF hotkeys management', - version: '0.0.1' -}); - -Npm.depends({ - 'jquery.hotkeys': '0.1.0' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - // Meteor packages - api.use([ - 'ecmascript', - 'templating', - 'stylus', - 'reactive-var', - 'session', - 'clinical:router', - 'cultofcoders:persistent-session' - ]); - - // OHIF dependencies - api.use('ohif:commands'); - - // Main module definition - api.mainModule('main.js', 'client'); - - // Client imports - api.addFiles('client/index.js', 'client'); -}); diff --git a/Packages/ohif-lesiontracker/both/base.js b/Packages/ohif-lesiontracker/both/base.js deleted file mode 100644 index fa6fc276d..000000000 --- a/Packages/ohif-lesiontracker/both/base.js +++ /dev/null @@ -1,3 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.lesiontracker = {}; diff --git a/Packages/ohif-lesiontracker/both/configuration/configuration.js b/Packages/ohif-lesiontracker/both/configuration/configuration.js deleted file mode 100644 index 5a69a3bd5..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/configuration.js +++ /dev/null @@ -1,40 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -import { measurementTools } from './measurementTools'; -import { retrieveMeasurements, storeMeasurements, retrieveTimepoints, storeTimepoints, removeTimepoint, updateTimepoint, disassociateStudy } from './dataExchange'; -import { validateMeasurements } from './dataValidation'; -import { FieldLesionLocation, FieldLesionLocationResponse } from 'meteor/ohif:lesiontracker/both/schema/fields'; - -OHIF.measurements.MeasurementApi.setConfiguration({ - measurementTools, - newLesions: [{ - id: 'newTargets', - name: 'New Targets', - toolGroupId: 'targets' - }, { - id: 'newNonTargets', - name: 'New Non-Targets', - toolGroupId: 'nonTargets' - }], - dataExchange: { - retrieve: retrieveMeasurements, - store: storeMeasurements - }, - dataValidation: { - validation: validateMeasurements - }, - schema: { - nonTargetLocation: FieldLesionLocation, - nonTargetResponse: FieldLesionLocationResponse - } -}); - -OHIF.measurements.TimepointApi.setConfiguration({ - dataExchange: { - retrieve: retrieveTimepoints, - store: storeTimepoints, - remove: removeTimepoint, - update: updateTimepoint, - disassociate: disassociateStudy - } -}); diff --git a/Packages/ohif-lesiontracker/both/configuration/dataExchange.js b/Packages/ohif-lesiontracker/both/configuration/dataExchange.js deleted file mode 100644 index f8fea4ea1..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/dataExchange.js +++ /dev/null @@ -1,113 +0,0 @@ -import { measurementTools } from './measurementTools'; - -export const retrieveMeasurements = (patientId, timepointIds) => { - console.log('retrieveMeasurements'); - - return new Promise((resolve, reject) => { - Meteor.call('retrieveMeasurements', patientId, timepointIds, (error, response) => { - if (error) { - reject(error); - } else { - console.log(response); - - /*measurementTools.forEach(tool => { - console.log('Retrieving tool: ' + tool.id); - });*/ - - resolve(response); - } - }); - }); -}; - -export const storeMeasurements = (measurementData, timepointIds) => { - console.log('storeMeasurements'); - - // Here is where we should do any required data transformation and API calls - - return new Promise((resolve, reject) => { - Meteor.call('storeMeasurements', measurementData, timepointIds, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response); - } - }); - }); -}; - -export const retrieveTimepoints = filter => { - console.log('retrieveTimepoints'); - - return new Promise((resolve, reject) => { - Meteor.call('retrieveTimepoints', filter, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response); - } - }); - }); -}; - -export const storeTimepoints = (timepointData) => { - console.log('storeTimepoints'); - console.log(timepointData); - - return new Promise((resolve, reject) => { - Meteor.call('storeTimepoints', timepointData, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response); - } - }); - }); -}; - -export const updateTimepoint = (timepointData, query) => { - console.log('updateTimepoint'); - console.log(timepointData); - console.log(query); - - return new Promise((resolve, reject) => { - Meteor.call('updateTimepoint', timepointData, query, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response); - } - }); - }); -}; - -export const removeTimepoint = timepointId => { - console.log('removeTimepoint'); - console.log(timepointId); - - return new Promise((resolve, reject) => { - Meteor.call('removeTimepoint', timepointId, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response); - } - }); - }); -}; - -export const disassociateStudy = (timepointIds, studyInstanceUid) => { - console.log('disassociateStudy'); - console.log(timepointIds); - console.log(studyInstanceUid); - - return new Promise((resolve, reject) => { - Meteor.call('disassociateStudy', timepointIds, studyInstanceUid, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response); - } - }); - }); -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/dataValidation.js b/Packages/ohif-lesiontracker/both/configuration/dataValidation.js deleted file mode 100644 index fe2b15252..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/dataValidation.js +++ /dev/null @@ -1,3 +0,0 @@ -export const validateMeasurements = () => { - console.log('validateMeasurements'); -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/index.js b/Packages/ohif-lesiontracker/both/configuration/index.js deleted file mode 100644 index 4fc2eee5a..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import './measurementTools.js'; -import './dataExchange.js'; -import './dataValidation.js'; -import './configuration.js'; diff --git a/Packages/ohif-lesiontracker/both/configuration/measurementTools.js b/Packages/ohif-lesiontracker/both/configuration/measurementTools.js deleted file mode 100644 index b9d26d10c..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/measurementTools.js +++ /dev/null @@ -1,9 +0,0 @@ -import { targets } from './toolGroups/targets'; -import { nonTargets } from './toolGroups/nonTargets'; -import { temp } from './toolGroups/temp'; - -export const measurementTools = [ - targets, - nonTargets, - temp -]; diff --git a/Packages/ohif-lesiontracker/both/configuration/toolGroups/baseSchema.js b/Packages/ohif-lesiontracker/both/configuration/toolGroups/baseSchema.js deleted file mode 100644 index 22576a52c..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/toolGroups/baseSchema.js +++ /dev/null @@ -1,29 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -export const ToolGroupBaseSchema = new SimpleSchema({ - toolId: { - type: String, - label: 'Tool ID', - optional: true - }, - toolItemId: { - type: String, - label: 'Tool Item ID', - optional: true - }, - createdAt: { - type: Date - }, - studyInstanceUid: { - type: String, - label: 'Study Instance UID' - }, - timepointId: { - type: String, - label: 'Timepoint ID' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - } -}); diff --git a/Packages/ohif-lesiontracker/both/configuration/toolGroups/nonTargets.js b/Packages/ohif-lesiontracker/both/configuration/toolGroups/nonTargets.js deleted file mode 100644 index 1eb0eaf2b..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/toolGroups/nonTargets.js +++ /dev/null @@ -1,9 +0,0 @@ -import { ToolGroupBaseSchema } from './baseSchema'; -import { nonTarget } from '../tools/nonTarget'; - -export const nonTargets = { - id: 'nonTargets', - name: 'Non-Targets', - childTools: [nonTarget], - schema: ToolGroupBaseSchema -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/toolGroups/targets.js b/Packages/ohif-lesiontracker/both/configuration/toolGroups/targets.js deleted file mode 100644 index b0a6b3b0c..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/toolGroups/targets.js +++ /dev/null @@ -1,11 +0,0 @@ -import { ToolGroupBaseSchema } from './baseSchema'; -import { bidirectional } from '../tools/bidirectional'; -import { targetCR } from '../tools/targetCR'; -import { targetUN } from '../tools/targetUN'; - -export const targets = { - id: 'targets', - name: 'Targets', - childTools: [bidirectional, targetCR, targetUN], - schema: ToolGroupBaseSchema -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/toolGroups/temp.js b/Packages/ohif-lesiontracker/both/configuration/toolGroups/temp.js deleted file mode 100644 index ced350989..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/toolGroups/temp.js +++ /dev/null @@ -1,10 +0,0 @@ -import { ToolGroupBaseSchema } from './baseSchema'; -import { length } from '../tools/length'; -import { ellipse } from '../tools/ellipse'; - -export const temp = { - id: 'temp', - name: 'Temporary', - childTools: [length, ellipse], - schema: ToolGroupBaseSchema -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/tools/bidirectional.js b/Packages/ohif-lesiontracker/both/configuration/tools/bidirectional.js deleted file mode 100644 index 9ffa7eff4..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/tools/bidirectional.js +++ /dev/null @@ -1,98 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const { CornerstoneHandleSchema } = MeasurementSchemaTypes; - -const BidirectionalHandleSchema = new SimpleSchema([CornerstoneHandleSchema, { - selected: { - type: Boolean, - label: 'Selected', - optional: true, - defaultValue: false - } -}]); - -const BidirectionalHandlesSchema = new SimpleSchema({ - start: { - type: BidirectionalHandleSchema, - label: 'Start' - }, - end: { - type: BidirectionalHandleSchema, - label: 'End' - }, - perpendicularStart: { - type: BidirectionalHandleSchema, - label: 'Perpendicular Start' - }, - perpendicularEnd: { - type: BidirectionalHandleSchema, - label: 'Perpendicular End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - }, -}); - -const BidirectionalSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: BidirectionalHandlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - description: { - type: String, - label: 'Description', - optional: true - }, - longestDiameter: { - type: Number, - label: 'Longest Diameter', - decimal: true - }, - shortestDiameter: { - type: Number, - label: 'Shortest Diameter', - decimal: true - }, - isSplitLesion: { - type: Boolean, - label: 'Is Split Lesion', - optional: true, - defaultValue: false - } -}]); - -const displayFunction = data => { - if (data.shortestDiameter) { - // TODO: Make this check criteria again to see if we should display shortest x longest - return data.longestDiameter + ' x ' + data.shortestDiameter; - } - - return data.longestDiameter; -}; - -export const bidirectional = { - id: 'bidirectional', - name: 'Target', - toolGroup: 'targets', - cornerstoneToolType: 'bidirectional', - schema: BidirectionalSchema, - options: { - measurementTable: { - displayFunction - }, - caseProgress: { - include: true - } - } -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/tools/ellipse.js b/Packages/ohif-lesiontracker/both/configuration/tools/ellipse.js deleted file mode 100644 index d65e2ad02..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/tools/ellipse.js +++ /dev/null @@ -1,34 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const EllipseHandlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - }, -}); - -const EllipseSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: EllipseHandlesSchema, - label: 'Handles' - } -}]); - -export const ellipse = { - id: 'ellipticalRoi', - name: 'Ellipse', - toolGroup: 'temp', - cornerstoneToolType: 'ellipticalRoi', - schema: EllipseSchema -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/tools/length.js b/Packages/ohif-lesiontracker/both/configuration/tools/length.js deleted file mode 100644 index 718b35ea9..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/tools/length.js +++ /dev/null @@ -1,34 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const LengthHandlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - } -}); - -const LengthSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: LengthHandlesSchema, - label: 'Handles' - } -}]); - -export const length = { - id: 'length', - name: 'Length', - toolGroup: 'temp', - cornerstoneToolType: 'length', - schema: LengthSchema -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/tools/nonTarget.js b/Packages/ohif-lesiontracker/both/configuration/tools/nonTarget.js deleted file mode 100644 index f5d163bb1..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/tools/nonTarget.js +++ /dev/null @@ -1,61 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const NonTargetHandlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - } -}); - -const NonTargetSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: NonTargetHandlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - response: { - type: String, - label: 'Response', - optional: true // Optional because it is added after initial drawing, via a callback - }, - location: { - type: String, - label: 'Location', - optional: true - }, - description: { - type: String, - label: 'Description', - optional: true - } -}]); - -export const nonTarget = { - id: 'nonTarget', - name: 'Non-Target', - toolGroup: 'nonTargets', - cornerstoneToolType: 'nonTarget', - schema: NonTargetSchema, - options: { - measurementTable: { - displayFunction: data => data.response - }, - caseProgress: { - include: true - } - } -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/tools/targetCR.js b/Packages/ohif-lesiontracker/both/configuration/tools/targetCR.js deleted file mode 100644 index 3417dece8..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/tools/targetCR.js +++ /dev/null @@ -1,61 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const TargetCRHandlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - } -}); - -const TargetCRSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: TargetCRHandlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - response: { - type: String, - label: 'Response', - optional: true // Optional because it is added after initial drawing, via a callback - }, - description: { - type: String, - label: 'Description', - optional: true - } -}]); - -export const targetCR = { - id: 'targetCR', - name: 'CR Target', - toolGroup: 'targets', - cornerstoneToolType: 'targetCR', - schema: TargetCRSchema, - options: { - measurementTable: { - displayFunction: data => data.response - }, - caseProgress: { - include: true - } - } -}; diff --git a/Packages/ohif-lesiontracker/both/configuration/tools/targetUN.js b/Packages/ohif-lesiontracker/both/configuration/tools/targetUN.js deleted file mode 100644 index 053ad6e5b..000000000 --- a/Packages/ohif-lesiontracker/both/configuration/tools/targetUN.js +++ /dev/null @@ -1,61 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const TargetUNHandlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - } -}); - -const TargetUNSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: TargetUNHandlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - response: { - type: String, - label: 'Response', - optional: true // Optional because it is added after initial drawing, via a callback - }, - description: { - type: String, - label: 'Description', - optional: true - } -}]); - -export const targetUN = { - id: 'targetUN', - name: 'UN Target', - toolGroup: 'targets', - cornerstoneToolType: 'targetUN', - schema: TargetUNSchema, - options: { - measurementTable: { - displayFunction: data => data.response - }, - caseProgress: { - include: true - } - } -}; diff --git a/Packages/ohif-lesiontracker/both/index.js b/Packages/ohif-lesiontracker/both/index.js deleted file mode 100644 index 8d5e3b1f1..000000000 --- a/Packages/ohif-lesiontracker/both/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './base.js'; -import './configuration'; diff --git a/Packages/ohif-lesiontracker/both/schema/fields.js b/Packages/ohif-lesiontracker/both/schema/fields.js deleted file mode 100644 index fc453df73..000000000 --- a/Packages/ohif-lesiontracker/both/schema/fields.js +++ /dev/null @@ -1,60 +0,0 @@ -export const FieldLesionLocation = { - type: String, - label: 'Lesion Location', - allowedValues: [ - '', - 'Abdominal/Chest Wall', - 'Adrenal', - 'Bladder', - 'Bone', - 'Brain', - 'Breast', - 'Colon', - 'Esophagus', - 'Extremities', - 'Gallbladder', - 'Kidney', - 'Liver', - 'Lung', - 'Lymph Node', - 'Mediastinum/Hilum', - 'Muscle', - 'Neck', - 'Other: Soft Tissue', - 'Ovary', - 'Pancreas', - 'Pelvis', - 'Peritoneum/Omentum', - 'Prostate', - 'Retroperitoneum', - 'Small Bowel', - 'Spleen', - 'Stomach', - 'Subcutaneous' - ] -}; - -export const FieldLesionLocationResponse = { - type: String, - label: 'Lesion Location Response', - allowedValues: [ - '', - 'CR', - 'PD', - 'SD', - 'Present', - 'NE', - 'NN', - 'EX' - ], - valuesLabels: [ - '', - 'CR - Complete response', - 'PD - Progressive disease', - 'SD - Stable disease', - 'Present - Present', - 'NE - Not Evaluable', - 'NN - Non-CR/Non-PD', - 'EX - Excluded from Assessment' - ] -}; diff --git a/Packages/ohif-lesiontracker/both/schema/index.js b/Packages/ohif-lesiontracker/both/schema/index.js deleted file mode 100644 index fe2407f77..000000000 --- a/Packages/ohif-lesiontracker/both/schema/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from './fields.js'; diff --git a/Packages/ohif-lesiontracker/client/collections/LesionLocations.js b/Packages/ohif-lesiontracker/client/collections/LesionLocations.js deleted file mode 100644 index 1db71b4ad..000000000 --- a/Packages/ohif-lesiontracker/client/collections/LesionLocations.js +++ /dev/null @@ -1,87 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -const LocationSchema = new SimpleSchema({ - id: { - type: String, - label: 'Location ID' - }, - location: { - type: String, - label: 'Location Name' - }, - selected: { - type: Boolean, - label: 'Selected', - defaultValue: false - }, - isNodal: { - type: Boolean, - label: 'Nodal Location', - defaultValue: false - } -}); - -LesionLocations = new Meteor.Collection(null); -LesionLocations.attachSchema(LocationSchema); -LesionLocations._debugName = 'LesionLocations'; - -var organGroups = [ - 'Abdominal/Chest Wall', - 'Adrenal', - 'Bladder', - 'Bone', - 'Brain', - 'Breast', - 'Colon', - 'Esophagus', - 'Extremities', - 'Gallbladder', - 'Kidney', - 'Liver', - 'Lung', - 'Lymph Node', - 'Mediastinum/Hilum', - 'Muscle', - 'Neck', - 'Other: Soft Tissue', - 'Ovary', - 'Pancreas', - 'Pelvis', - 'Peritoneum/Omentum', - 'Prostate', - 'Retroperitoneum', - 'Small Bowel', - 'Spleen', - 'Stomach', - 'Subcutaneous']; - -function nameToID(name) { - // http://stackoverflow.com/questions/29258016/remove-special-symbols-and-extra-spaces-and-make-it-camel-case-javascript - return name - .trim() //might need polyfill if you need to support older browsers - .toLowerCase() //lower case everything - .replace(/([^A-Z0-9]+)(.)/ig, //match multiple non-letter/numbers followed by any character - function(match) { - return arguments[2].toUpperCase(); //3rd index is the character we need to transform uppercase - } - ); -} - -organGroups.forEach(function(organGroup) { - const id = nameToID(organGroup); - - // Check if the name has 'node' in it, if so, it is nodal - let isNodal = false; - if (id.toLowerCase().indexOf('node') > -1) { - isNodal = true; - } - - LesionLocations.insert({ - id: id, - location: organGroup, - selected: false, - isNodal: isNodal - }); -}); - -export { LesionLocations }; diff --git a/Packages/ohif-lesiontracker/client/collections/LocationResponses.js b/Packages/ohif-lesiontracker/client/collections/LocationResponses.js deleted file mode 100644 index 2d262d310..000000000 --- a/Packages/ohif-lesiontracker/client/collections/LocationResponses.js +++ /dev/null @@ -1,56 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -const ResponseSchema = new SimpleSchema({ - text: { - type: String, - label: 'Text' - }, - code: { - type: String, - label: 'Code' - }, - selected: { - type: Boolean, - label: 'Selected', - defaultValue: false - } -}); - -LocationResponses = new Meteor.Collection(null); -LocationResponses.attachSchema(ResponseSchema); -LocationResponses._debugName = 'LocationResponses'; - -LocationResponses.insert({ - text: 'Complete response', - code: 'CR' -}); - -LocationResponses.insert({ - text: 'Progressive disease', - code: 'PD' -}); - -LocationResponses.insert({ - text: 'Stable disease', - code: 'SD' -}); - -LocationResponses.insert({ - text: 'Present', - code: 'Present' -}); - -LocationResponses.insert({ - text: 'Not Evaluable', - code: 'NE' -}); - -LocationResponses.insert({ - text: 'Non-CR/Non-PD', - code: 'NN' -}); - -LocationResponses.insert({ - text: 'Excluded from Assessment', - code: 'EX' -}); diff --git a/Packages/ohif-lesiontracker/client/collections/index.js b/Packages/ohif-lesiontracker/client/collections/index.js deleted file mode 100644 index a1de5335d..000000000 --- a/Packages/ohif-lesiontracker/client/collections/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './LesionLocations.js'; -import './LocationResponses.js'; diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/addNewMeasurement.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/addNewMeasurement.js deleted file mode 100644 index cab7761c4..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/addNewMeasurement.js +++ /dev/null @@ -1,163 +0,0 @@ -import { cornerstone, cornerstoneTools, cornerstoneMath } from 'meteor/ohif:cornerstone'; -import { toolType } from './definitions'; -import createNewMeasurement from './createNewMeasurement'; -import mouseMoveCallback from './mouseMoveCallback'; -import mouseDownCallback from './mouseDownCallback'; -import doubleClickCallback from './doubleClickCallback'; -import updatePerpendicularLineHandles from './updatePerpendicularLineHandles'; - -export default function(mouseEventData) { - const { element } = mouseEventData; - const $element = $(element); - - const imagePlane = cornerstone.metaData.get('imagePlaneModule', mouseEventData.image.imageId); - let rowPixelSpacing; - let colPixelSpacing; - - if (imagePlane) { - rowPixelSpacing = imagePlane.rowPixelSpacing || imagePlane.rowImagePixelSpacing; - colPixelSpacing = imagePlane.columnPixelSpacing || imagePlane.colImagePixelSpacing; - } else { - rowPixelSpacing = mouseEventData.image.rowPixelSpacing; - colPixelSpacing = mouseEventData.image.columnPixelSpacing; - } - - // LT-29 Disable Target Measurements when pixel spacing is not available - if (!rowPixelSpacing || !colPixelSpacing) { - return; - } - - function doneCallback() { - measurementData.active = false; - cornerstone.updateImage(element); - } - - const measurementData = createNewMeasurement(mouseEventData); - measurementData.viewport = cornerstone.getViewport(element); - - const tool = cornerstoneTools[toolType]; - const config = tool.getConfiguration(); - const { mouseDownActivateCallback } = tool; - - // associate this data with this imageId so we can render it and manipulate it - cornerstoneTools.addToolState(element, toolType, measurementData); - - const disableDefaultHandlers = () => { - // since we are dragging to another place to drop the end point, we can just activate - // the end point and let the moveHandle move it for us. - element.removeEventListener('cornerstonetoolsmousemove', mouseMoveCallback); - element.removeEventListener('cornerstonetoolsmousedown', mouseDownCallback); - element.removeEventListener('cornerstonetoolsmousedownactivate', mouseDownActivateCallback); - element.removeEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback); - }; - - disableDefaultHandlers(); - - // Update the perpendicular line handles position - const updateHandler = event => updatePerpendicularLineHandles(event.detail, measurementData); - element.addEventListener('cornerstonetoolsmousedrag', updateHandler); - element.addEventListener('cornerstonetoolsmouseup', updateHandler); - - let cancelled = false; - const cancelAction = () => { - cancelled = true; - cornerstoneTools.removeToolState(element, toolType, measurementData); - }; - - // Add a flag for using Esc to cancel tool placement - const keyDownHandler = event => { - // If the Esc key was pressed, set the flag to true - if (event.which === 27) { - cancelAction(); - } - - // Don't propagate this keydown event so it can't interfere - // with anything outside of this tool - return false; - }; - - // Bind a one-time event listener for the Esc key - $element.one('keydown', keyDownHandler); - - // Bind a mousedown handler to cancel the measurement if it's zero-sized - const mousedownHandler = () => { - const { start, end } = measurementData.handles; - if (!cornerstoneMath.point.distance(start, end)) { - cancelAction(); - } - }; - - // Bind a one-time event listener for mouse down - $element.one('mousedown', mousedownHandler); - - // Keep the current image and create a handler for new rendered images - const currentImage = cornerstone.getImage(element); - const currentViewport = cornerstone.getViewport(element); - const imageRenderedHandler = () => { - const newImage = cornerstone.getImage(element); - - // Check if the rendered image changed during measurement creation and delete it if so - if (newImage.imageId !== currentImage.imageId) { - cornerstone.displayImage(element, currentImage, currentViewport); - cancelAction(); - cornerstone.displayImage(element, newImage, currentViewport); - } - }; - - // Bind the event listener for image rendering - element.addEventListener('cornerstoneimagerendered', imageRenderedHandler); - - // Bind the tool deactivation and enlargement handlers - element.addEventListener('cornerstonetoolstooldeactivated', cancelAction); - $element.one('ohif.viewer.viewport.toggleEnlargement', cancelAction); - - cornerstone.updateImage(element); - - const timestamp = new Date().getTime(); - const { end, perpendicularStart } = measurementData.handles; - cornerstoneTools.moveNewHandle(mouseEventData, toolType, measurementData, end, () => { - const { handles, longestDiameter, shortestDiameter } = measurementData; - const hasHandlesOutside = cornerstoneTools.anyHandlesOutsideImage(mouseEventData, handles); - const longestDiameterSize = parseFloat(longestDiameter) || 0; - const shortestDiameterSize = parseFloat(shortestDiameter) || 0; - const isTooSmal = (longestDiameterSize < 1) || (shortestDiameterSize < 1); - const isTooFast = (new Date().getTime() - timestamp) < 150; - if (cancelled || hasHandlesOutside || isTooSmal || isTooFast) { - // delete the measurement - measurementData.cancelled = true; - cornerstoneTools.removeToolState(element, toolType, measurementData); - } else { - // Set lesionMeasurementData Session - config.getMeasurementLocationCallback(measurementData, mouseEventData, doneCallback); - } - - // Unbind the Esc keydown hook - $element.off('keydown', keyDownHandler); - - // Unbind the mouse down hook - $element.off('mousedown', mousedownHandler); - - // Unbind the event listener for image rendering - element.removeEventListener('cornerstoneimagerendered', imageRenderedHandler); - - // Unbind the tool deactivation and enlargement handlers - element.removeEventListener('cornerstonetoolstooldeactivated', cancelAction); - $element.off('ohif.viewer.viewport.toggleEnlargement', cancelAction); - - // perpendicular line is not connected to long-line - perpendicularStart.locked = false; - - // Unbind the handlers to update perpendicular line - element.removeEventListener('cornerstonetoolsmousedrag', updateHandler); - element.removeEventListener('cornerstonetoolsmouseup', updateHandler); - - // Disable the default handlers and re-enable again - disableDefaultHandlers(); - element.addEventListener('cornerstonetoolsmousemove', mouseMoveCallback); - element.addEventListener('cornerstonetoolsmousedown', mouseDownCallback); - element.addEventListener('cornerstonetoolsmousedownactivate', mouseDownActivateCallback); - element.addEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback); - - cornerstone.updateImage(element); - }); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/addNewMeasurementTouch.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/addNewMeasurementTouch.js deleted file mode 100644 index 6d174e6a8..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/addNewMeasurementTouch.js +++ /dev/null @@ -1,59 +0,0 @@ -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { toolType } from './definitions'; -import createNewMeasurement from './createNewMeasurement'; -import updatePerpendicularLineHandles from './updatePerpendicularLineHandles'; - -export default function(touchEventData) { - const element = { touchEventData }; - - // LT-29 Disable Target Measurements when pixel spacing is not available - if (!touchEventData.image.rowPixelSpacing || !touchEventData.image.columnPixelSpacing) return; - - const doneCallback = () => { - measurementData.active = false; - cornerstone.updateImage(element); - }; - - const measurementData = createNewMeasurement(touchEventData); - const { cancelled, handles } = measurementData; - const config = cornerstoneTools[toolType].getConfiguration(); - - // associate this data with this imageId so we can render it and manipulate it - cornerstoneTools.addToolState(element, toolType, measurementData); - - // since we are dragging to another place to drop the end point, we can just activate - // the end point and let the moveHandle move it for us. - const { touchMoveHandle, tapCallback, touchDownActivateCallback } = cornerstoneTools[toolType]; - element.removeEventListener('cornerstonetoolstouchdrag', touchMoveHandle); - element.removeEventListener('cornerstonetoolstap', tapCallback); - element.removeEventListener('cornerstonetoolsdragstartactive', touchDownActivateCallback); - - // Update the perpendicular line handles position - const updateHandler = event => updatePerpendicularLineHandles(event.detail, measurementData); - element.addEventListener('cornerstonetoolstouchdrag', updateHandler); - element.addEventListener('cornerstonetoolstouchend', updateHandler); - - cornerstone.updateImage(element); - const { end, perpendicularStart } = handles; - cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, end, () => { - if (cancelled || cornerstoneTools.anyHandlesOutsideImage(touchEventData, handles)) { - // delete the measurement - cornerstoneTools.removeToolState(element, toolType, measurementData); - } else { - // Set lesionMeasurementData Session - config.getMeasurementLocationCallback(measurementData, touchEventData, doneCallback); - } - - // perpendicular line is not connected to long-line - perpendicularStart.locked = false; - - // Unbind the handlers to update perpendicular line - element.removeEventListener('cornerstonetoolstouchdrag', updateHandler); - element.removeEventListener('cornerstonetoolstouchend', updateHandler); - - element.addEventListener('cornerstonetoolstouchdrag', touchMoveHandle); - element.addEventListener('cornerstonetoolstap', tapCallback); - element.addEventListener('cornerstonetoolsdragstartactive', touchDownActivateCallback); - cornerstone.updateImage(element); - }); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/calculateLongestAndShortestDiameters.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/calculateLongestAndShortestDiameters.js deleted file mode 100644 index db7ca9b6d..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/calculateLongestAndShortestDiameters.js +++ /dev/null @@ -1,32 +0,0 @@ -// Calculate the longest and shortest diameters for the given measurementData -export default function(eventData, measurementData) { - const { rowPixelSpacing, columnPixelSpacing } = eventData.image; - const { start, end, perpendicularStart, perpendicularEnd } = measurementData.handles; - - // updatePerpendicularLineHandles(eventData, measurementData); - - // Calculate the long axis length - const dx = (start.x - end.x) * (columnPixelSpacing || 1); - const dy = (start.y - end.y) * (rowPixelSpacing || 1); - let length = Math.sqrt(dx * dx + dy * dy); - - // Calculate the short axis length - const wx = (perpendicularStart.x - perpendicularEnd.x) * (columnPixelSpacing || 1); - const wy = (perpendicularStart.y - perpendicularEnd.y) * (rowPixelSpacing || 1); - let width = Math.sqrt(wx * wx + wy * wy); - if (!width) { - width = 0; - } - - // Length is always longer than width - if (width > length) { - const tempW = width; - const tempL = length; - length = tempW; - width = tempL; - } - - // Set measurement text to show lesion table - measurementData.longestDiameter = length.toFixed(1); - measurementData.shortestDiameter = width.toFixed(1); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/createNewMeasurement.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/createNewMeasurement.js deleted file mode 100644 index b2f29f3b2..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/createNewMeasurement.js +++ /dev/null @@ -1,41 +0,0 @@ -import { toolType } from './definitions'; - -const getHandle = (x, y, index, extraAttributes={}) => { - return Object.assign({ - x, - y, - index, - drawnIndependently: false, - allowedOutsideImage: false, - highlight: true, - active: false - }, extraAttributes); -}; - -export default function(mouseEventData) { - const { x, y } = mouseEventData.currentPoints.image; - // Create the measurement data for this tool with the end handle activated - const measurementData = { - toolType, - isCreating: true, - visible: true, - active: true, - handles: { - start: getHandle(x, y, 0), - end: getHandle(x, y, 1, { active: true }), - perpendicularStart: getHandle(x, y, 2, { locked: true }), - perpendicularEnd: getHandle(x, y, 3), - textBox: getHandle(x - 50, y - 70, null, { - highlight: false, - movesIndependently: false, - drawnIndependently: true, - allowedOutsideImage: true, - hasBoundingBox: true - }) - }, - longestDiameter: 0, - shortestDiameter: 0 - }; - - return measurementData; -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/definitions.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/definitions.js deleted file mode 100644 index 7d49efbdd..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/definitions.js +++ /dev/null @@ -1,7 +0,0 @@ -const toolType = 'bidirectional'; -const distanceThreshold = 6; - -export { - toolType, - distanceThreshold -}; diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/doubleClickCallback.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/doubleClickCallback.js deleted file mode 100644 index 845b10e26..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/doubleClickCallback.js +++ /dev/null @@ -1,49 +0,0 @@ -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { toolType } from './definitions'; -import pointNearTool from './pointNearTool'; - -export default function (event) { - const eventData = event.detail; - const { element } = eventData.element; - - function doneCallback(data, deleteTool) { - if (deleteTool === true) { - cornerstoneTools.removeToolState(element, toolType, data); - cornerstone.updateImage(element); - } - } - - const buttonMask = event.data && event.data.mouseButtonMask; - if (buttonMask && !cornerstoneTools.isMouseButtonEnabled(eventData.which, buttonMask)) { - return false; - } - - // Check if the element is enabled and stop here if not - try { - cornerstone.getEnabledElement(element); - } catch (error) { - return; - } - - const config = cornerstoneTools.bidirectional.getConfiguration(); - - const coords = eventData.currentPoints.canvas; - const toolData = cornerstoneTools.getToolState(element, toolType); - - // now check to see if there is a handle we can move - if (!toolData) return; - - let data; - for (let i = 0; i < toolData.data.length; i++) { - data = toolData.data[i]; - if (pointNearTool(element, data, coords)) { - data.active = true; - cornerstone.updateImage(element); - // Allow relabelling via a callback - config.changeMeasurementLocationCallback(data, eventData, doneCallback); - - event.stopImmediatePropagation(); - return false; - } - } -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/index.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/index.js deleted file mode 100644 index 1d10a74ed..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/index.js +++ /dev/null @@ -1 +0,0 @@ -import './tool.js'; diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/invertHandles.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/invertHandles.js deleted file mode 100644 index 8405a9c09..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/invertHandles.js +++ /dev/null @@ -1,42 +0,0 @@ -const swapAttribute = (a, b, attribute) => { - const originalA = a[attribute]; - const originalB = b[attribute]; - a[attribute] = originalB; - b[attribute] = originalA; -}; - -const swapHandles = (a, b) => { - swapAttribute(a, b, 'x'); - swapAttribute(a, b, 'y'); - swapAttribute(a, b, 'moving'); - swapAttribute(a, b, 'hover'); - swapAttribute(a, b, 'active'); - swapAttribute(a, b, 'selected'); -}; - -function invertHandles(eventData, measurementData, handle) { - const { rowPixelSpacing, columnPixelSpacing } = eventData.image; - const { handles } = measurementData; - const { start, end, perpendicularStart, perpendicularEnd } = handles; - - // Calculate the long axis length - const dx = (start.x - end.x) * (columnPixelSpacing || 1); - const dy = (start.y - end.y) * (rowPixelSpacing || 1); - const length = Math.sqrt(dx * dx + dy * dy); - - // Calculate the short axis length - const wx = (perpendicularStart.x - perpendicularEnd.x) * (columnPixelSpacing || 1); - const wy = (perpendicularStart.y - perpendicularEnd.y) * (rowPixelSpacing || 1); - const width = Math.sqrt(wx * wx + wy * wy) || 0; - - if (width > length) { - swapHandles(start, end); - swapHandles(start, perpendicularStart); - swapHandles(end, perpendicularEnd); - return Object.values(handles).find(h => h.moving === true); - } - - return handle; -} - -export default invertHandles; diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/mouseDownCallback.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/mouseDownCallback.js deleted file mode 100644 index f762cb54c..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/mouseDownCallback.js +++ /dev/null @@ -1,151 +0,0 @@ -/* jshint -W083 */ - -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { toolType, distanceThreshold } from './definitions'; -import mouseMoveCallback from './mouseMoveCallback'; -import pointNearTool from './pointNearTool'; -import moveHandle from './moveHandle'; -import invertHandles from './invertHandles'; - -// Clear the selected state for the given handles object -const unselectAllHandles = handles => { - let imageNeedsUpdate = false; - Object.keys(handles).forEach(handleKey => { - if (handleKey === 'textBox') return; - handles[handleKey].selected = false; - imageNeedsUpdate = handles[handleKey].active || imageNeedsUpdate; - handles[handleKey].active = false; - }); - return imageNeedsUpdate; -}; - -// Clear the bidirectional tool's selection for all tool handles -const clearBidirectionalSelection = event => { - let imageNeedsUpdate = false; - const toolData = cornerstoneTools.getToolState(event.target, 'bidirectional'); - if (!toolData) return; - toolData.data.forEach(data => { - const unselectResult = unselectAllHandles(data.handles); - imageNeedsUpdate = imageNeedsUpdate || unselectResult; - }); - return imageNeedsUpdate; -}; - -const setHandlesMovingState = (handles, state) => { - Object.keys(handles).forEach(handleKey => { - if (handleKey === 'textBox') return; - handles[handleKey].moving = state; - }); -}; - -// mouseDownCallback is used to restrict behaviour of perpendicular-line -export default function(event) { - const eventData = event.detail; - let data; - const element = eventData.element; - const $element = $(element); - const options = cornerstoneTools.getToolOptions(toolType, element); - - if (!cornerstoneTools.isMouseButtonEnabled(eventData.which, options.mouseButtonMask)) return; - - // Add an event listener to clear the selected state when a measurement is activated - const activateEventKey = 'ViewerMeasurementsActivated'; - $element.off(activateEventKey).on(activateEventKey, () => clearBidirectionalSelection(event)); - - // Clear selection on left mouse button click - if (eventData.which === 1) { - const imageNeedsUpdate = clearBidirectionalSelection(event); - if (imageNeedsUpdate) { - cornerstone.updateImage(element); - } - } - - function handleDoneMove(handle) { - // Set the cursor back to its default - $element.css('cursor', ''); - - data.invalidated = true; - if (cornerstoneTools.anyHandlesOutsideImage(eventData, data.handles)) { - // delete the measurement - cornerstoneTools.removeToolState(element, toolType, data); - } - - // Update the handles to keep selected state - if (handle) { - handle.moving = false; - handle.selected = true; - } - - cornerstone.updateImage(element); - element.addEventListener('cornerstonetoolsmousemove', mouseMoveCallback); - } - - const coords = eventData.startPoints.canvas; - const toolData = cornerstoneTools.getToolState(event.currentTarget, toolType); - - if (!toolData) return; - - // now check to see if there is a handle we can move - for (let i = 0; i < toolData.data.length; i++) { - data = toolData.data[i]; - const handleParams = [element, data.handles, coords, distanceThreshold]; - let handle = cornerstoneTools.getHandleNearImagePoint(...handleParams); - - if (handle) { - handle.moving = true; - - // Invert handles if needed - handle = invertHandles(eventData, data, handle); - - // Hide the cursor to improve precision while resizing the line or set to move - // if dragging text box - $element.css('cursor', handle.hasBoundingBox ? 'move' : 'none'); - - element.removeEventListener('cornerstonetoolsmousemove', mouseMoveCallback); - data.active = true; - - unselectAllHandles(data.handles); - moveHandle(eventData, toolType, data, handle, () => handleDoneMove(handle)); - event.stopImmediatePropagation(); - event.stopPropagation(); - event.preventDefault(); - - return; - } - } - - // Now check to see if there is a line we can move - // Now check to see if we have a tool that we can move - const opt = { - deleteIfHandleOutsideImage: true, - preventHandleOutsideImage: false - }; - - const getDoneMovingCallback = handles => () => { - setHandlesMovingState(handles, false); - handleDoneMove(); - }; - - for (let i = 0; i < toolData.data.length; i++) { - data = toolData.data[i]; - if (pointNearTool(element, data, coords)) { - // Set the cursor to move - $element.css('cursor', 'move'); - - element.removeEventListener('cornerstonetoolsmousemove', mouseMoveCallback); - data.active = true; - - unselectAllHandles(data.handles); - setHandlesMovingState(data.handles, true); - - const doneMovingCallback = getDoneMovingCallback(data.handles); - const allHandlesParams = [event, data, toolData, toolType, opt, doneMovingCallback]; - cornerstoneTools.moveAllHandles(...allHandlesParams); - event.stopImmediatePropagation(); - event.stopPropagation(); - event.preventDefault(); - - return; - } - } -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/mouseMoveCallback.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/mouseMoveCallback.js deleted file mode 100644 index 3734b1111..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/mouseMoveCallback.js +++ /dev/null @@ -1,67 +0,0 @@ -/* jshint -W083 */ - -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { toolType } from './definitions'; -import pointNearTool from './pointNearTool'; - -// Replaces the cornerstoneTools.handleActivator function by skiping the active handle comparison -const handleActivator = (element, handles, canvasPoint, distanceThreshold=6) => { - const getHandle = cornerstoneTools.getHandleNearImagePoint; - const nearbyHandle = getHandle(element, handles, canvasPoint, distanceThreshold); - - let handleActivatorChanged = false; - Object.keys(handles).forEach(handleKey => { - if (handleKey === 'textBox') return; - const handle = handles[handleKey]; - const newActiveState = handle === nearbyHandle; - if (handle.active !== newActiveState) { - handleActivatorChanged = true; - } - - handle.active = newActiveState; - }); - - return handleActivatorChanged; -}; - -// mouseMoveCallback is used to hide handles when mouse is away -export default function (event) { - const eventData = event.detail; - const { element } = eventData; - cornerstoneTools.toolCoordinates.setCoords(eventData); - - // if we have no tool data for this element, do nothing - const toolData = cornerstoneTools.getToolState(element, toolType); - if (!toolData) return; - - // We have tool data, search through all data and see if we can activate a handle - let imageNeedsUpdate = false; - for (let i = 0; i < toolData.data.length; i++) { - // get the cursor position in canvas coordinates - const coords = eventData.currentPoints.canvas; - - const data = toolData.data[i]; - const handleActivatorChanged = handleActivator(element, data.handles, coords); - Object.keys(data.handles).forEach(handleKey => { - if (handleKey === 'textBox') return; - const handle = data.handles[handleKey]; - handle.hover = handle.active; - }); - - if (handleActivatorChanged) { - imageNeedsUpdate = true; - } - - const nearToolAndInactive = pointNearTool(element, data, coords) && !data.active; - const notNearToolAndActive = !pointNearTool(element, data, coords) && data.active; - if (nearToolAndInactive || notNearToolAndActive) { - data.active = !data.active; - imageNeedsUpdate = true; - } - } - - // Handle activation status changed, redraw the image - if (imageNeedsUpdate === true) { - cornerstone.updateImage(element); - } -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/index.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/index.js deleted file mode 100644 index 2f3b8f0ba..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import moveHandle from './moveHandle'; -export default moveHandle; diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/moveHandle.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/moveHandle.js deleted file mode 100644 index f53a1aade..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/moveHandle.js +++ /dev/null @@ -1,81 +0,0 @@ -import { cornerstone } from 'meteor/ohif:cornerstone'; -import setHandlesPosition from './setHandlesPosition'; -import calculateLongestAndShortestDiameters from '../calculateLongestAndShortestDiameters'; - -export default function (mouseEventData, toolType, data, handle, doneMovingCallback, preventHandleOutsideImage) { - const element = mouseEventData.element; - const distanceFromTool = { - x: handle.x - mouseEventData.currentPoints.image.x, - y: handle.y - mouseEventData.currentPoints.image.y - }; - - const mouseDragCallback = event => { - const eventData = event.detail; - handle.active = true; - - if (handle.index === undefined || handle.index === null) { - handle.x = eventData.currentPoints.image.x + distanceFromTool.x; - handle.y = eventData.currentPoints.image.y + distanceFromTool.y; - } else { - setHandlesPosition(handle, eventData, data); - } - - if (preventHandleOutsideImage) { - handle.x = Math.max(handle.x, 0); - handle.x = Math.min(handle.x, eventData.image.width); - - handle.y = Math.max(handle.y, 0); - handle.y = Math.min(handle.y, eventData.image.height); - } - - cornerstone.updateImage(element); - - const measurementModifiedHandler = () => { - const eventType = 'cornerstonetoolsmeasurementmodified'; - const modifiedEventData = { - toolType, - element, - measurementData: data - }; - - calculateLongestAndShortestDiameters(mouseEventData, data); - - cornerstone.triggerEvent(element, eventType, modifiedEventData); - - element.removeEventListener('cornerstoneimagerendered', measurementModifiedHandler); - }; - - // Wait on image render before triggering the modified event - element.addEventListener('cornerstoneimagerendered', measurementModifiedHandler); - }; - - element.addEventListener('cornerstonetoolsmousedrag', mouseDragCallback); - - const currentImage = cornerstone.getImage(element); - const imageRenderedHandler = () => { - const newImage = cornerstone.getImage(element); - - // Check if the rendered image changed during measurement modifying and stop it if so - if (newImage.imageId !== currentImage.imageId) { - mouseUpCallback(); - } - }; - - // Bind the event listener for image rendering - element.addEventListener('cornerstoneimagerendered', imageRenderedHandler); - - const mouseUpCallback = () => { - element.removeEventListener('cornerstonetoolsmousedrag', mouseDragCallback); - element.removeEventListener('cornerstonetoolsmouseup', mouseUpCallback); - element.removeEventListener('cornerstonetoolsmouseclick', mouseUpCallback); - element.removeEventListener('cornerstoneimagerendered', imageRenderedHandler); - cornerstone.updateImage(element); - - if (typeof doneMovingCallback === 'function') { - doneMovingCallback(); - } - }; - - element.addEventListener('cornerstonetoolsmouseup', mouseUpCallback); - element.addEventListener('cornerstonetoolsmouseclick', mouseUpCallback); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularBothFixedLeft.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularBothFixedLeft.js deleted file mode 100644 index c25500199..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularBothFixedLeft.js +++ /dev/null @@ -1,60 +0,0 @@ -import { cornerstoneMath } from 'meteor/ohif:cornerstone'; - -// Move long-axis start point -export default function(eventData, data) { - const { distance } = cornerstoneMath.point; - const { start, end, perpendicularStart, perpendicularEnd } = data.handles; - const { image } = eventData.currentPoints; - - const longLine = { - start: { - x: start.x, - y: start.y - }, - end: { - x: end.x, - y: end.y - } - }; - - const perpendicularLine = { - start: { - x: perpendicularStart.x, - y: perpendicularStart.y - }, - end: { - x: perpendicularEnd.x, - y: perpendicularEnd.y - } - }; - - const intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - - const distanceFromPerpendicularP1 = distance(perpendicularStart, intersection); - const distanceFromPerpendicularP2 = distance(perpendicularEnd, intersection); - - const distanceToLineP2 = distance(end, intersection); - const newLineLength = distance(end, image); - - if (newLineLength <= distanceToLineP2) { - return false; - } - - const dx = (end.x - image.x) / newLineLength; - const dy = (end.y - image.y) / newLineLength; - - const k = distanceToLineP2 / newLineLength; - - const newIntersection = { - x: end.x + ((image.x - end.x) * k), - y: end.y + ((image.y - end.y) * k) - }; - - perpendicularStart.x = newIntersection.x - distanceFromPerpendicularP1 * dy; - perpendicularStart.y = newIntersection.y + distanceFromPerpendicularP1 * dx; - - perpendicularEnd.x = newIntersection.x + distanceFromPerpendicularP2 * dy; - perpendicularEnd.y = newIntersection.y - distanceFromPerpendicularP2 * dx; - - return true; -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularBothFixedRight.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularBothFixedRight.js deleted file mode 100644 index 36fe8d561..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularBothFixedRight.js +++ /dev/null @@ -1,60 +0,0 @@ -import { cornerstoneMath } from 'meteor/ohif:cornerstone'; - -// Move long-axis end point -export default function(eventData, data) { - const { distance } = cornerstoneMath.point; - const { start, end, perpendicularStart, perpendicularEnd } = data.handles; - const { image } = eventData.currentPoints; - - const longLine = { - start: { - x: start.x, - y: start.y - }, - end: { - x: end.x, - y: end.y - } - }; - - const perpendicularLine = { - start: { - x: perpendicularStart.x, - y: perpendicularStart.y - }, - end: { - x: perpendicularEnd.x, - y: perpendicularEnd.y - } - }; - - const intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - - const distanceFromPerpendicularP1 = distance(perpendicularStart, intersection); - const distanceFromPerpendicularP2 = distance(perpendicularEnd, intersection); - - const distanceToLineP2 = distance(start, intersection); - const newLineLength = distance(start, image); - - if (newLineLength <= distanceToLineP2) { - return false; - } - - const dx = (start.x - image.x) / newLineLength; - const dy = (start.y - image.y) / newLineLength; - - const k = distanceToLineP2 / newLineLength; - - const newIntersection = { - x: start.x + ((image.x - start.x) * k), - y: start.y + ((image.y - start.y) * k) - }; - - perpendicularStart.x = newIntersection.x + distanceFromPerpendicularP1 * dy; - perpendicularStart.y = newIntersection.y - distanceFromPerpendicularP1 * dx; - - perpendicularEnd.x = newIntersection.x - distanceFromPerpendicularP2 * dy; - perpendicularEnd.y = newIntersection.y + distanceFromPerpendicularP2 * dx; - - return true; -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularLeftFixedPoint.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularLeftFixedPoint.js deleted file mode 100644 index 1e6603eaa..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularLeftFixedPoint.js +++ /dev/null @@ -1,84 +0,0 @@ -import { cornerstoneMath } from 'meteor/ohif:cornerstone'; - -// Move perpendicular line start point -export default function(eventData, data) { - const { distance } = cornerstoneMath.point; - const { start, end, perpendicularStart, perpendicularEnd } = data.handles; - - const fudgeFactor = 1; - - const fixedPoint = perpendicularEnd; - const movedPoint = eventData.currentPoints.image; - - const distanceFromFixed = cornerstoneMath.lineSegment.distanceToPoint(data.handles, fixedPoint); - const distanceFromMoved = cornerstoneMath.lineSegment.distanceToPoint(data.handles, movedPoint); - - const distanceBetweenPoints = distance(fixedPoint, movedPoint); - - const total = distanceFromFixed + distanceFromMoved; - - if (distanceBetweenPoints <= distanceFromFixed) { - return false; - } - - const length = distance(start, end); - if (length === 0) { - return false; - } - - const dx = (start.x - end.x) / length; - const dy = (start.y - end.y) / length; - - const adjustedLineP1 = { - x: start.x - fudgeFactor * dx, - y: start.y - fudgeFactor * dy - }; - const adjustedLineP2 = { - x: end.x + fudgeFactor * dx, - y: end.y + fudgeFactor * dy - }; - - perpendicularStart.x = movedPoint.x; - perpendicularStart.y = movedPoint.y; - perpendicularEnd.x = movedPoint.x - total * dy; - perpendicularEnd.y = movedPoint.y + total * dx; - - const longLine = { - start: { - x: start.x, - y: start.y - }, - end: { - x: end.x, - y: end.y - } - }; - - const perpendicularLine = { - start: { - x: perpendicularStart.x, - y: perpendicularStart.y - }, - end: { - x: perpendicularEnd.x, - y: perpendicularEnd.y - } - }; - - const intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - if (!intersection) { - if (distance(movedPoint, start) > distance(movedPoint, end)) { - perpendicularStart.x = adjustedLineP2.x + distanceFromMoved * dy; - perpendicularStart.y = adjustedLineP2.y - distanceFromMoved * dx; - perpendicularEnd.x = perpendicularStart.x - total * dy; - perpendicularEnd.y = perpendicularStart.y + total * dx; - } else { - perpendicularStart.x = adjustedLineP1.x + distanceFromMoved * dy; - perpendicularStart.y = adjustedLineP1.y - distanceFromMoved * dx; - perpendicularEnd.x = perpendicularStart.x - total * dy; - perpendicularEnd.y = perpendicularStart.y + total * dx; - } - } - - return true; -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularRightFixedPoint.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularRightFixedPoint.js deleted file mode 100644 index ced494fc9..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/perpendicularRightFixedPoint.js +++ /dev/null @@ -1,82 +0,0 @@ -import { cornerstoneMath } from 'meteor/ohif:cornerstone'; - -// Move perpendicular line end point -export default function(eventData, data) { - const { distance } = cornerstoneMath.point; - const { start, end, perpendicularStart, perpendicularEnd } = data.handles; - - const fudgeFactor = 1; - - const fixedPoint = perpendicularStart; - const movedPoint = eventData.currentPoints.image; - - const distanceFromFixed = cornerstoneMath.lineSegment.distanceToPoint(data.handles, fixedPoint); - const distanceFromMoved = cornerstoneMath.lineSegment.distanceToPoint(data.handles, movedPoint); - - const distanceBetweenPoints = distance(fixedPoint, movedPoint); - - const total = distanceFromFixed + distanceFromMoved; - - if (distanceBetweenPoints <= distanceFromFixed) { - return false; - } - - const length = distance(start, end); - const dx = (start.x - end.x) / length; - const dy = (start.y - end.y) / length; - - const adjustedLineP1 = { - x: start.x - fudgeFactor * dx, - y: start.y - fudgeFactor * dy - }; - const adjustedLineP2 = { - x: end.x + fudgeFactor * dx, - y: end.y + fudgeFactor * dy - }; - - perpendicularStart.x = movedPoint.x + total * dy; - perpendicularStart.y = movedPoint.y - total * dx; - perpendicularEnd.x = movedPoint.x; - perpendicularEnd.y = movedPoint.y; - perpendicularEnd.locked = false; - perpendicularStart.locked = false; - - const longLine = { - start: { - x: start.x, - y: start.y - }, - end: { - x: end.x, - y: end.y - } - }; - - const perpendicularLine = { - start: { - x: perpendicularStart.x, - y: perpendicularStart.y - }, - end: { - x: perpendicularEnd.x, - y: perpendicularEnd.y - } - }; - - const intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - if (!intersection) { - if (distance(movedPoint, start) > distance(movedPoint, end)) { - perpendicularEnd.x = adjustedLineP2.x - distanceFromMoved * dy; - perpendicularEnd.y = adjustedLineP2.y + distanceFromMoved * dx; - perpendicularStart.x = perpendicularEnd.x + total * dy; - perpendicularStart.y = perpendicularEnd.y - total * dx; - } else { - perpendicularEnd.x = adjustedLineP1.x - distanceFromMoved * dy; - perpendicularEnd.y = adjustedLineP1.y + distanceFromMoved * dx; - perpendicularStart.x = perpendicularEnd.x + total * dy; - perpendicularStart.y = perpendicularEnd.y - total * dx; - } - } - - return true; -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/setHandlesPosition.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/setHandlesPosition.js deleted file mode 100644 index 622d594be..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/moveHandle/setHandlesPosition.js +++ /dev/null @@ -1,140 +0,0 @@ -import { cornerstoneMath } from 'meteor/ohif:cornerstone'; -import perpendicularBothFixedLeft from './perpendicularBothFixedLeft'; -import perpendicularBothFixedRight from './perpendicularBothFixedRight'; -import perpendicularLeftFixedPoint from './perpendicularLeftFixedPoint'; -import perpendicularRightFixedPoint from './perpendicularRightFixedPoint'; - -// Sets position of handles(start, end, perpendicularStart, perpendicularEnd) -export default function(handle, eventData, data) { - let movedPoint, - outOfBounds, - result, - intersection, - d1, - d2; - - let longLine = {}, - perpendicularLine = {}; - - if (handle.index === 0) { - // if long-axis start point is moved - result = perpendicularBothFixedLeft(eventData, data); - if (result) { - handle.x = eventData.currentPoints.image.x; - handle.y = eventData.currentPoints.image.y; - } else { - eventData.currentPoints.image.x = handle.x; - eventData.currentPoints.image.y = handle.y; - } - - } else if (handle.index === 1) { - // if long-axis end point is moved - result = perpendicularBothFixedRight(eventData, data); - if (result) { - handle.x = eventData.currentPoints.image.x; - handle.y = eventData.currentPoints.image.y; - } else { - eventData.currentPoints.image.x = handle.x; - eventData.currentPoints.image.y = handle.y; - } - - } else if (handle.index === 2) { - outOfBounds = false; - // if perpendicular start point is moved - longLine.start = { - x: data.handles.start.x, - y: data.handles.start.y - }; - longLine.end = { - x: data.handles.end.x, - y: data.handles.end.y - }; - - perpendicularLine.start = { - x: data.handles.perpendicularEnd.x, - y: data.handles.perpendicularEnd.y - }; - perpendicularLine.end = { - x: eventData.currentPoints.image.x, - y: eventData.currentPoints.image.y - }; - - intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - if (!intersection) { - perpendicularLine.end = { - x: data.handles.perpendicularStart.x, - y: data.handles.perpendicularStart.y - }; - - intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - - d1 = cornerstoneMath.point.distance(intersection, data.handles.start); - d2 = cornerstoneMath.point.distance(intersection, data.handles.end); - - if (!intersection || d1 < 3 || d2 < 3) { - outOfBounds = true; - } - } - - movedPoint = false; - - if (!outOfBounds) { - movedPoint = perpendicularLeftFixedPoint(eventData, data); - - if (!movedPoint) { - eventData.currentPoints.image.x = data.handles.perpendicularStart.x; - eventData.currentPoints.image.y = data.handles.perpendicularStart.y; - } - } - - } else if (handle.index === 3) { - outOfBounds = false; - - // if perpendicular end point is moved - longLine.start = { - x: data.handles.start.x, - y: data.handles.start.y - }; - longLine.end = { - x: data.handles.end.x, - y: data.handles.end.y - }; - - perpendicularLine.start = { - x: data.handles.perpendicularStart.x, - y: data.handles.perpendicularStart.y - }; - perpendicularLine.end = { - x: eventData.currentPoints.image.x, - y: eventData.currentPoints.image.y - }; - - intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - if (!intersection) { - perpendicularLine.end = { - x: data.handles.perpendicularEnd.x, - y: data.handles.perpendicularEnd.y - }; - - intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine); - - d1 = cornerstoneMath.point.distance(intersection, data.handles.start); - d2 = cornerstoneMath.point.distance(intersection, data.handles.end); - - if (!intersection || d1 < 3 || d2 < 3) { - outOfBounds = true; - } - } - - movedPoint = false; - - if (!outOfBounds) { - movedPoint = perpendicularRightFixedPoint(eventData, data); - - if (!movedPoint) { - eventData.currentPoints.image.x = data.handles.perpendicularEnd.x; - eventData.currentPoints.image.y = data.handles.perpendicularEnd.y; - } - } - } -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawHandles.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawHandles.js deleted file mode 100644 index 35333b279..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawHandles.js +++ /dev/null @@ -1,22 +0,0 @@ -import { cornerstoneTools } from 'meteor/ohif:cornerstone'; - -// Add a proxy to cornerstoneTools.drawHandles function to change the handles' active state base on -// the hover, moving and selected states -export default function(context, eventData, handles, color, options) { - Object.keys(handles).forEach(handleKey => { - if (handleKey === 'textBox') return; - const handle = handles[handleKey]; - handle.drawnIndependently = handle.moving; - if (handle.selected) { - handle.active = handle.hover; - } else { - if (handle.hover) { - handle.active = true; - } else { - handle.active = false; - } - } - }); - - cornerstoneTools.drawHandles(context, eventData, handles, color, options); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawPerpendicularLine.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawPerpendicularLine.js deleted file mode 100644 index f3ce123e1..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawPerpendicularLine.js +++ /dev/null @@ -1,16 +0,0 @@ -import { cornerstone } from 'meteor/ohif:cornerstone'; - -// draw perpendicular line -export default function(context, element, data, color, lineWidth) { - // Draw perpendicular line - const { perpendicularStart, perpendicularEnd } = data.handles; - const perpendicularStartCanvas = cornerstone.pixelToCanvas(element, perpendicularStart); - const perpendicularEndCanvas = cornerstone.pixelToCanvas(element, perpendicularEnd); - - context.beginPath(); - context.strokeStyle = color; - context.lineWidth = lineWidth; - context.moveTo(perpendicularStartCanvas.x, perpendicularStartCanvas.y); - context.lineTo(perpendicularEndCanvas.x, perpendicularEndCanvas.y); - context.stroke(); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawSelectedMarker.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawSelectedMarker.js deleted file mode 100644 index 753a3120a..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/drawSelectedMarker.js +++ /dev/null @@ -1,39 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; - -// Draw a line marker over the selected arm -export default function(eventData, handles, color) { - const lib = OHIF.lesiontracker.bidirectional; - const { canvasContext, element } = eventData; - - const handleKey = lib.getSelectedHandleKey(handles); - if (!handleKey) return; - const handle = handles[handleKey]; - - // Used a big distance (1km) to fill the entire line - const mmStep = -1000000; - - // Get the line's start and end points - const fakeImage = { - columnPixelSpacing: eventData.viewport.scale, - rowPixelSpacing: eventData.viewport.scale - }; - const pointA = lib.repositionBidirectionalArmHandle(fakeImage, handles, handleKey, mmStep, 0); - const pointB = _.pick(handle, ['x', 'y']); - - // Stop here if pointA is not present - if (!pointA) return; - - // Get the canvas coordinates for the line var perpendicularStartCanvas = cornerstone.pixelToCanvas(element, data.handles.perpendicularStart); - const canvasPointA = cornerstone.pixelToCanvas(element, pointA); - const canvasPointB = cornerstone.pixelToCanvas(element, pointB); - - // Draw the line marker - canvasContext.beginPath(); - canvasContext.strokeStyle = color; - canvasContext.lineWidth = cornerstoneTools.toolStyle.getToolWidth(); - canvasContext.moveTo(canvasPointA.x, canvasPointA.y); - canvasContext.lineTo(canvasPointB.x, canvasPointB.y); - canvasContext.stroke(); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/index.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/index.js deleted file mode 100644 index 5fee5bd66..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import onImageRendered from './onImageRendered'; -export default onImageRendered; diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/onImageRendered.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/onImageRendered.js deleted file mode 100644 index 2101eefd2..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/onImageRendered/onImageRendered.js +++ /dev/null @@ -1,204 +0,0 @@ -import { cornerstone, cornerstoneMath, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { OHIF } from 'meteor/ohif:core'; -import { toolType } from '../definitions'; -import drawHandles from './drawHandles'; -import calculateLongestAndShortestDiameters from '../calculateLongestAndShortestDiameters'; -import updatePerpendicularLineHandles from '../updatePerpendicularLineHandles'; -import drawPerpendicularLine from './drawPerpendicularLine'; -import drawSelectedMarker from './drawSelectedMarker'; - -export default function onImageRendered(event) { - const eventData = event.detail; - const { element, canvasContext } = eventData; - - // if we have no toolData for this element, return immediately as there is nothing to do - const toolData = cornerstoneTools.getToolState(element, toolType); - if (!toolData) return; - - const imagePlane = cornerstone.metaData.get('imagePlaneModule', eventData.image.imageId); - let rowPixelSpacing; - let colPixelSpacing; - - if (imagePlane) { - rowPixelSpacing = imagePlane.rowPixelSpacing || imagePlane.rowImagePixelSpacing; - colPixelSpacing = imagePlane.columnPixelSpacing || imagePlane.colImagePixelSpacing; - } else { - rowPixelSpacing = eventData.image.rowPixelSpacing; - colPixelSpacing = eventData.image.columnPixelSpacing; - } - - // LT-29 Disable Target Measurements when pixel spacing is not available - if (!rowPixelSpacing || !colPixelSpacing) { - return; - } - - // we have tool data for this element - iterate over each one and draw it - const context = canvasContext.canvas.getContext('2d'); - context.setTransform(1, 0, 0, 1, 0, 0); - - let color; - const lineWidth = cornerstoneTools.toolStyle.getToolWidth(); - const config = cornerstoneTools[toolType].getConfiguration(); - - for (let i = 0; i < toolData.data.length; i++) { - const data = toolData.data[i]; - if (data.visible === false) continue; - - const { start, end, perpendicularStart, perpendicularEnd, textBox } = data.handles; - const strokeWidth = lineWidth; - - context.save(); - - // configurable shadow from CornerstoneTools - const { shadow } = config; - if (shadow && shadow.shadow) { - context.shadowColor = shadow.shadowColor || '#000000'; - context.shadowOffsetX = shadow.shadowOffsetX || 1; - context.shadowOffsetY = shadow.shadowOffsetY || 1; - } - - const activeColor = cornerstoneTools.toolColors.getActiveColor(); - if (data.active) { - color = activeColor; - } else { - color = cornerstoneTools.toolColors.getToolColor(); - } - - // Update the perpendicular handles to draw it correctly - updatePerpendicularLineHandles(eventData, data); - - // Draw the line - const { pixelToCanvas } = cornerstone; - const handleStartCanvas = pixelToCanvas(element, start); - const handleEndCanvas = pixelToCanvas(element, end); - const handlePerpendicularStartCanvas = pixelToCanvas(element, perpendicularStart); - const handlePerpendicularEndCanvas = pixelToCanvas(element, perpendicularEnd); - const canvasTextLocation = pixelToCanvas(element, textBox); - - context.beginPath(); - context.strokeStyle = color; - context.lineWidth = strokeWidth; - context.moveTo(handleStartCanvas.x, handleStartCanvas.y); - context.lineTo(handleEndCanvas.x, handleEndCanvas.y); - context.stroke(); - - // Draw perpendicular line - drawPerpendicularLine(context, element, data, color, strokeWidth); - - // Draw the handles - const handlesColor = color; - drawHandles(context, eventData, data.handles, handlesColor, { drawHandlesIfActive: true }); - - // Draw the selected marker - drawSelectedMarker(eventData, data.handles, '#FF9999'); - - // Calculate the longest and shortest diameters, storing it in the respective attributes - calculateLongestAndShortestDiameters(eventData, data); - - if (data.measurementNumber) { - // Draw the textbox - let suffix = ' mm'; - if (!rowPixelSpacing || !colPixelSpacing) { - suffix = ' pixels'; - } - - const lengthText = ' L ' + data.longestDiameter + suffix; - const widthText = ' W ' + data.shortestDiameter + suffix; - let textLines = [`Target ${data.measurementNumber}`, lengthText, widthText]; - - // Append extra text lines when applies - if (data.additionalData && Array.isArray(data.additionalData.extraTextLines)) { - textLines = textLines.concat(data.additionalData.extraTextLines); - } - - const boundingBox = cornerstoneTools.drawTextBox( - context, - textLines, - canvasTextLocation.x, - canvasTextLocation.y, - color, - config.textBox - ); - - textBox.boundingBox = boundingBox; - - OHIF.cornerstone.repositionTextBox(eventData, data, config.textBox); - - // Draw linked line as dashed - const link = { - start: {}, - end: {} - }; - - const longLine = { - start: handleStartCanvas, - end: handleEndCanvas - }; - - const perpendicularLine = { - start: handlePerpendicularStartCanvas, - end: handlePerpendicularEndCanvas - }; - - // Check if the perpendicular line has some length (start and end are not equal) - // Note: this check is needed to prevent NaN value on the intersection result - const { distance } = cornerstoneMath.point; - const lineHasLength = distance(perpendicularLine.start, perpendicularLine.end) > 0; - - // Define the lines intersection point - let linesIntersection; - if (lineHasLength) { - // As the line has length, define it as the intersection between the lines - const { intersectLine } = cornerstoneMath.lineSegment; - linesIntersection = intersectLine(longLine, perpendicularLine); - } else { - // As the line has no length, the tool is in its start position - linesIntersection = longLine.start; - } - - const points = [ - handleStartCanvas, - handleEndCanvas, - handlePerpendicularStartCanvas, - handlePerpendicularEndCanvas, - linesIntersection - ]; - - link.end.x = canvasTextLocation.x; - link.end.y = canvasTextLocation.y; - - link.start = cornerstoneMath.point.findClosestPoint(points, link.end); - - const boundingBoxPoints = [ { - // Top middle point of bounding box - x: boundingBox.left + boundingBox.width / 2, - y: boundingBox.top - }, { - // Left middle point of bounding box - x: boundingBox.left, - y: boundingBox.top + boundingBox.height / 2 - }, { - // Bottom middle point of bounding box - x: boundingBox.left + boundingBox.width / 2, - y: boundingBox.top + boundingBox.height - }, { - // Right middle point of bounding box - x: boundingBox.left + boundingBox.width, - y: boundingBox.top + boundingBox.height / 2 - }, - ]; - - link.end = cornerstoneMath.point.findClosestPoint(boundingBoxPoints, link.start); - context.beginPath(); - context.strokeStyle = color; - context.lineWidth = lineWidth; - context.setLineDash([ 2, 3 ]); - - context.moveTo(link.start.x, link.start.y); - context.lineTo(link.end.x, link.end.y); - context.stroke(); - } - - context.restore(); - } -} \ No newline at end of file diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/pointNearTool.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/pointNearTool.js deleted file mode 100644 index 10e91a597..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/pointNearTool.js +++ /dev/null @@ -1,33 +0,0 @@ -import { cornerstone, cornerstoneMath, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { distanceThreshold } from './definitions'; - -const pointNearPerpendicular = (element, handles, coords) => { - const lineSegment = { - start: cornerstone.pixelToCanvas(element, handles.perpendicularStart), - end: cornerstone.pixelToCanvas(element, handles.perpendicularEnd) - }; - - const distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords); - - return (distanceToPoint < distanceThreshold); -}; - -export default function(element, data, coords) { - const { handles } = data; - const lineSegment = { - start: cornerstone.pixelToCanvas(element, handles.start), - end: cornerstone.pixelToCanvas(element, handles.end) - }; - - const distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords); - - if (cornerstoneTools.pointInsideBoundingBox(handles.textBox, coords)) { - return true; - } - - if (pointNearPerpendicular(element, handles, coords)) { - return true; - } - - return (distanceToPoint < distanceThreshold); -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/tool.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/tool.js deleted file mode 100644 index 55b6789b5..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/tool.js +++ /dev/null @@ -1,47 +0,0 @@ -import { Viewerbase } from 'meteor/ohif:viewerbase'; -import { cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { toolType } from './definitions'; -import createNewMeasurement from './createNewMeasurement'; -import addNewMeasurement from './addNewMeasurement'; -import addNewMeasurementTouch from './addNewMeasurementTouch'; -import onImageRendered from './onImageRendered'; -import pointNearTool from './pointNearTool'; -import mouseDownCallback from './mouseDownCallback'; -import mouseMoveCallback from './mouseMoveCallback'; - -function createToolInterface() { - const toolInterface = { toolType }; - - const baseInterface = { - createNewMeasurement, - onImageRendered, - pointNearTool, - toolType - }; - - toolInterface.mouse = cornerstoneTools.mouseButtonTool(Object.assign({ - addNewMeasurement, - mouseDownCallback, - mouseMoveCallback - }, baseInterface)); - - toolInterface.touch = cornerstoneTools.touchTool(Object.assign({ - addNewMeasurement: addNewMeasurementTouch - }, baseInterface)); - - return toolInterface; -} - -const toolInterface = createToolInterface(); -cornerstoneTools[toolType] = toolInterface.mouse; -cornerstoneTools[toolType + 'Touch'] = toolInterface.touch; - -// Define an empty location callback -const emptyLocationCallback = (measurementData, eventData, doneCallback) => doneCallback(); -const { shadowConfig, textBoxConfig } = Viewerbase.toolManager.getToolDefaultStates(); -cornerstoneTools[toolType].setConfiguration({ - getMeasurementLocationCallback: emptyLocationCallback, - changeMeasurementLocationCallback: emptyLocationCallback, - textBox: textBoxConfig, - shadow: shadowConfig -}); diff --git a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/updatePerpendicularLineHandles.js b/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/updatePerpendicularLineHandles.js deleted file mode 100644 index 9ba5093f2..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/bidirectionalTool/updatePerpendicularLineHandles.js +++ /dev/null @@ -1,40 +0,0 @@ -// Update the perpendicular line handles -export default function(eventData, data) { - if (!data.handles.perpendicularStart.locked) return; - - let startX, startY, endX, endY; - - const { start, end } = data.handles; - if (start.x === end.x && start.y === end.y) { - startX = start.x; - startY = start.y; - endX = end.x; - endY = end.y; - } else { - // mid point of long-axis line - const mid = { - x: (start.x + end.x) / 2, - y: (start.y + end.y) / 2 - }; - - // Length of long-axis - const dx = (start.x - end.x) * (eventData.image.columnPixelSpacing || 1); - const dy = (start.y - end.y) * (eventData.image.rowPixelSpacing || 1); - const length = Math.sqrt(dx * dx + dy * dy); - - const vectorX = (start.x - end.x) / length; - const vectorY = (start.y - end.y) / length; - - const perpendicularLineLength = length / 2; - - startX = mid.x + (perpendicularLineLength / 2) * vectorY; - startY = mid.y - (perpendicularLineLength / 2) * vectorX; - endX = mid.x - (perpendicularLineLength / 2) * vectorY; - endY = mid.y + (perpendicularLineLength / 2) * vectorX; - } - - data.handles.perpendicularStart.x = startX; - data.handles.perpendicularStart.y = startY; - data.handles.perpendicularEnd.x = endX; - data.handles.perpendicularEnd.y = endY; -} diff --git a/Packages/ohif-lesiontracker/client/compatibility/deleteLesionKeyboardTool.js b/Packages/ohif-lesiontracker/client/compatibility/deleteLesionKeyboardTool.js deleted file mode 100644 index c0fe12f60..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/deleteLesionKeyboardTool.js +++ /dev/null @@ -1,124 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; - -// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected -const keys = { - D: 68, - DELETE: 46 -}; - -// Defined the toolTypes for which the delete dialog will be displayed when the keys are pressed -const toolTypes = [ - 'bidirectional', - 'targetCR', - 'targetUN', - 'nonTarget', - 'length', - 'ellipticalRoi', - 'rectangleRoi' -]; - -// Flag to prevent dialog from being displayed twice -let locked = false; - -// Handler to unlock the keydown handling -const unlock = () => { - locked = false; -}; - -function removeMeasurementTimepoint(data, index, toolType, element) { - let { imageId } = data; - if (!imageId) { - const enabledElement = cornerstone.getEnabledElement(element); - imageId = enabledElement.image.imageId; - } - - cornerstoneTools.removeToolState(element, toolType, data); - cornerstone.updateImage(element); -} - -// TODO = Check if we have the same function already in Cornerstone Tools -function getNearbyToolData(element, coords) { - const Viewerbase = OHIF.viewerbase; - const allTools = Viewerbase.toolManager.getTools(); - let pointNearTool = false; - const isTouchDevice = Viewerbase.helpers.isTouchDevice(); - const nearbyTool = {}; - - toolTypes.forEach(toolType => { - const toolData = cornerstoneTools.getToolState(element, toolType); - if (!toolData) { - return; - } - - for (let i = 0; i < toolData.data.length; i++) { - const data = toolData.data[i]; - - let toolInterface; - if (isTouchDevice) { - toolInterface = allTools[toolType].touch; - } else { - toolInterface = allTools[toolType].mouse; - } - - if (toolInterface.pointNearTool(element, data, coords)) { - pointNearTool = true; - nearbyTool.tool = data; - nearbyTool.index = i; - nearbyTool.toolType = toolType; - break; - } - } - - if (pointNearTool === true) { - return false; - } - }); - - return pointNearTool ? nearbyTool : undefined; -} - -function keyDownCallback(event) { - const eventData = event.detail; - const keyCode = eventData.which; - - // Stop here if the locked flag is set to true - if (locked) return; - - if (keyCode === keys.DELETE || - (keyCode === keys.D && eventData.event.ctrlKey === true)) { - - const nearbyToolData = getNearbyToolData(eventData.element, eventData.currentPoints.canvas); - - if (!nearbyToolData || nearbyToolData.tool.isCreating) return; - - const dialogSettings = { - class: 'themed', - title: 'Delete measurements', - message: 'Are you sure you want to delete this measurement?', - position: eventData.currentPoints.page - }; - - // Set the locked flag to true - locked = true; - - // TODO= Refactor this so the confirmation dialog is an - // optional settable callback in the tool's configuration - OHIF.ui.showDialog('dialogConfirm', dialogSettings).then(() => { - unlock(); - removeMeasurementTimepoint(nearbyToolData.tool, - nearbyToolData.index, - nearbyToolData.toolType, - eventData.element - ); - - // Notify that viewer suffered changes - OHIF.measurements.triggerTimepointUnsavedChanges('deleted'); - }).catch(unlock); - } -} - -// module/private exports -const tool = cornerstoneTools.keyboardTool(keyDownCallback); -tool.toolTypes = toolTypes; -cornerstoneTools.deleteLesionKeyboardTool = tool; diff --git a/Packages/ohif-lesiontracker/client/compatibility/imageDownload.js b/Packages/ohif-lesiontracker/client/compatibility/imageDownload.js deleted file mode 100644 index a8529671f..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/imageDownload.js +++ /dev/null @@ -1,15 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.viewerbase.getImageDownloadDialogAnnotationTools = () => { - const { measurementTools } = OHIF.measurements.MeasurementApi.getConfiguration(); - - const resultSet = new Set(); - Object.values(measurementTools).forEach(toolGroup => { - toolGroup.childTools.forEach(tool => { - if (tool.childTools) return; - resultSet.add(tool.cornerstoneToolType); - }); - }); - - return Array.from(resultSet); -}; diff --git a/Packages/ohif-lesiontracker/client/compatibility/index.js b/Packages/ohif-lesiontracker/client/compatibility/index.js deleted file mode 100644 index 596f85b2d..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import './bidirectionalTool'; -import './imageDownload.js'; -import './nonTargetTool.js'; -import './deleteLesionKeyboardTool.js'; -import './qualitativeTargetTools.js'; diff --git a/Packages/ohif-lesiontracker/client/compatibility/nonTargetTool.js b/Packages/ohif-lesiontracker/client/compatibility/nonTargetTool.js deleted file mode 100644 index 1f04e2a77..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/nonTargetTool.js +++ /dev/null @@ -1,474 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -import { cornerstone, cornerstoneMath, cornerstoneTools } from 'meteor/ohif:cornerstone'; - -const toolType = 'nonTarget'; - -const toolDefaultStates = Viewerbase.toolManager.getToolDefaultStates(); -const shadowConfig = toolDefaultStates.shadowConfig; -const textBoxConfig = toolDefaultStates.textBoxConfig; - -const configuration = Object.assign({}, shadowConfig, { - getMeasurementLocationCallback, - changeMeasurementLocationCallback, - drawHandles: false, - drawHandlesOnHover: true, - arrowFirst: true, - textBox: textBoxConfig -}); - -// Used to cancel tool placement -const keys = { - ESC: 27 -}; - -const getPosition = eventData => { - const event = eventData.event; - return { - x: event.clientX, - y: event.clientY - }; -}; - -// Define a callback to get your text annotation -// This could be used, e.g. to open a modal -function getMeasurementLocationCallback(measurementData, eventData) { - if (OHIF.lesiontracker.removeMeasurementIfInvalid(measurementData, eventData)) { - return; - } - - delete measurementData.isCreating; - - OHIF.ui.showDialog('dialogNonTargetMeasurement', { - position: getPosition(eventData), - title: 'Select Lesion Location', - element: eventData.element, - measurementData - }); -} - -function changeMeasurementLocationCallback(measurementData, eventData) { - if (OHIF.lesiontracker.removeMeasurementIfInvalid(measurementData, eventData)) { - return; - } - - OHIF.ui.showDialog('dialogNonTargetMeasurement', { - position: getPosition(eventData), - title: 'Change Lesion Location', - element: eventData.element, - measurementData, - edit: true - }); -} - -/// --- Mouse Tool --- /// -///////// BEGIN ACTIVE TOOL /////// -function addNewMeasurement(mouseEventData) { - const { element } = mouseEventData; - const $element = $(element); - - function doneCallback() { - measurementData.active = true; - cornerstone.updateImage(element); - } - - const measurementData = createNewMeasurement(mouseEventData); - measurementData.viewport = cornerstone.getViewport(element); - - const tool = cornerstoneTools[toolType]; - const config = tool.getConfiguration(); - - // associate this data with this imageId so we can render it and manipulate it - cornerstoneTools.addToolState(element, toolType, measurementData); - - const disableDefaultHandlers = () => { - // since we are dragging to another place to drop the end point, we can just activate - // the end point and let the moveHandle move it for us. - - element.removeEventListener('cornerstonetoolsmousemove', tool.mouseMoveCallback); - element.removeEventListener('cornerstonetoolsmousedown', tool.mouseDownCallback); - element.removeEventListener('cornerstonetoolsmousedownactivate', tool.mouseDownActivateCallback); - element.removeEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback); - }; - - disableDefaultHandlers(); - - // Add a flag for using Esc to cancel tool placement - let cancelled = false; - const cancelAction = () => { - cancelled = true; - cornerstoneTools.removeToolState(element, toolType, measurementData); - }; - - // Add a flag for using Esc to cancel tool placement - const keyDownHandler = event => { - // If the Esc key was pressed, set the flag to true - if (event.which === keys.ESC) { - cancelAction(); - } - - // Don't propagate this keydown event so it can't interfere - // with anything outside of this tool - return false; - }; - - // Bind a one-time event listener for the Esc key - $(element).one('keydown', keyDownHandler); - - // Bind a mousedown handler to cancel the measurement if it's zero-sized - const mousedownHandler = () => { - const { start, end } = measurementData.handles; - if (!cornerstoneMath.point.distance(start, end)) { - cancelAction(); - } - }; - - // Bind a one-time event listener for mouse down - $element.one('mousedown', mousedownHandler); - - // Keep the current image and create a handler for new rendered images - const currentImage = cornerstone.getImage(element); - const currentViewport = cornerstone.getViewport(element); - const imageRenderedHandler = () => { - const newImage = cornerstone.getImage(element); - - // Check if the rendered image changed during measurement creation and delete it if so - if (newImage.imageId !== currentImage.imageId) { - cornerstone.displayImage(element, currentImage, currentViewport); - cancelAction(); - cornerstone.displayImage(element, newImage, currentViewport); - } - }; - - // Bind the event listener for image rendering - element.addEventListener('cornerstoneimagerendered', imageRenderedHandler); - - // Bind the tool deactivation and enlargement handlers - element.addEventListener('cornerstonetoolstooldeactivated', cancelAction); - $element.one('ohif.viewer.viewport.toggleEnlargement', cancelAction); - - cornerstone.updateImage(element); - - cornerstoneTools.moveNewHandle(mouseEventData, toolType, measurementData, measurementData.handles.end, function() { - if (cancelled || cornerstoneTools.anyHandlesOutsideImage(mouseEventData, measurementData.handles)) { - // delete the measurement - cornerstoneTools.removeToolState(mouseEventData.element, toolType, measurementData); - } else { - config.getMeasurementLocationCallback(measurementData, mouseEventData, doneCallback); - } - - // Unbind the Esc keydown hook - $element.off('keydown', keyDownHandler); - - // Unbind the mouse down hook - $element.off('mousedown', mousedownHandler); - - // Unbind the event listener for image rendering - element.removeEventListener('cornerstoneimagerendered', imageRenderedHandler); - - // Unbind the tool deactivation and enlargement handlers - element.removeEventListener('cornerstonetoolstooldeactivated', cancelAction); - $element.off('ohif.viewer.viewport.toggleEnlargement', cancelAction); - - // Disable the default handlers and re-enable again - disableDefaultHandlers(); - element.addEventListener('cornerstonetoolsmousemove', tool.mouseMoveCallback); - element.addEventListener('cornerstonetoolsmousedown', tool.mouseDownCallback); - element.addEventListener('cornerstonetoolsmousedownactivate', tool.mouseDownActivateCallback); - element.addEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback); - - cornerstone.updateImage(element); - }); -} - -function createNewMeasurement(mouseEventData) { - const imageId = mouseEventData.image.imageId; - - // Get studyInstanceUid - const study = cornerstone.metaData.get('study', imageId); - const studyInstanceUid = study.studyInstanceUid; - const patientId = study.patientId; - - // Get seriesInstanceUid - const series = cornerstone.metaData.get('series', imageId); - const seriesInstanceUid = series.seriesInstanceUid; - - // create the measurement data for this tool with the end handle activated - const measurementData = { - isCreating: true, - visible: true, - active: true, - handles: { - start: { - x: mouseEventData.currentPoints.image.x, - y: mouseEventData.currentPoints.image.y, - allowedOutsideImage: true, - highlight: true, - active: false - }, - end: { - x: mouseEventData.currentPoints.image.x, - y: mouseEventData.currentPoints.image.y, - allowedOutsideImage: true, - highlight: true, - active: false - }, - textBox: { - x: mouseEventData.currentPoints.image.x - 50, - y: mouseEventData.currentPoints.image.y - 50, - active: false, - movesIndependently: false, - drawnIndependently: true, - allowedOutsideImage: true, - hasBoundingBox: true - } - }, - imageId: imageId, - seriesInstanceUid: seriesInstanceUid, - studyInstanceUid: studyInstanceUid, - patientId: patientId, - response: '', - isTarget: false, - toolType: 'nonTarget' - }; - - return measurementData; -} -///////// END ACTIVE TOOL /////// - -function pointNearTool(element, data, coords) { - const lineSegment = { - start: cornerstone.pixelToCanvas(element, data.handles.start), - end: cornerstone.pixelToCanvas(element, data.handles.end) - }; - const distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords); - - if (cornerstoneTools.pointInsideBoundingBox(data.handles.textBox, coords)) { - return true; - } - - return distanceToPoint < 25; -} - -///////// BEGIN IMAGE RENDERING /////// -function onImageRendered(e) { - const eventData = e.detail; - const { element } = eventData; - - // if we have no toolData for this element, return immediately as there is nothing to do - const toolData = cornerstoneTools.getToolState(element, toolType); - if (!toolData) { - return; - } - - // we have tool data for this element - iterate over each one and draw it - const context = eventData.canvasContext.canvas.getContext('2d'); - context.setTransform(1, 0, 0, 1, 0, 0); - - let color; - const lineWidth = cornerstoneTools.toolStyle.getToolWidth(); - const config = cornerstoneTools.nonTarget.getConfiguration(); - - for (let i = 0; i < toolData.data.length; i++) { - const data = toolData.data[i]; - if (data.visible === false) { - continue; - } - - context.save(); - - // configurable shadow from CornerstoneTools - if (config && config.shadow) { - context.shadowColor = config.shadowColor || '#000000'; - context.shadowOffsetX = config.shadowOffsetX || 1; - context.shadowOffsetY = config.shadowOffsetY || 1; - } - - if (data.active) { - color = cornerstoneTools.toolColors.getActiveColor(); - } else { - color = cornerstoneTools.toolColors.getToolColor(); - } - - // Draw the arrow - const handleStartCanvas = cornerstone.pixelToCanvas(element, data.handles.start); - const handleEndCanvas = cornerstone.pixelToCanvas(element, data.handles.end); - const canvasTextLocation = cornerstone.pixelToCanvas(element, data.handles.textBox); - - cornerstoneTools.drawArrow(context, handleEndCanvas, handleStartCanvas, color, lineWidth); - - if (config.drawHandles) { - cornerstoneTools.drawHandles(context, eventData, data.handles, color); - } else if (config.drawHandlesOnHover && data.handles.start.active) { - cornerstoneTools.drawHandles(context, eventData, [ data.handles.start ], color); - } else if (config.drawHandlesOnHover && data.handles.end.active) { - cornerstoneTools.drawHandles(context, eventData, [ data.handles.end ], color); - } - - // Draw the text - if (data.measurementNumber) { - const textLine = `Non-Target ${data.measurementNumber}`; - const boundingBox = cornerstoneTools.drawTextBox(context, textLine, canvasTextLocation.x, canvasTextLocation.y, color, config.textBox); - data.handles.textBox.boundingBox = boundingBox; - - OHIF.cornerstone.repositionTextBox(eventData, data, config.textBox); - - // Draw linked line as dashed - const link = { - start: {}, - end: {} - }; - - const midpointCanvas = { - x: (handleStartCanvas.x + handleEndCanvas.x) / 2, - y: (handleStartCanvas.y + handleEndCanvas.y) / 2, - }; - - const points = [ handleStartCanvas, handleEndCanvas, midpointCanvas ]; - - link.end.x = canvasTextLocation.x; - link.end.y = canvasTextLocation.y; - - link.start = cornerstoneMath.point.findClosestPoint(points, link.end); - - const boundingBoxPoints = [ { - // Top middle point of bounding box - x: boundingBox.left + boundingBox.width / 2, - y: boundingBox.top - }, { - // Left middle point of bounding box - x: boundingBox.left, - y: boundingBox.top + boundingBox.height / 2 - }, { - // Bottom middle point of bounding box - x: boundingBox.left + boundingBox.width / 2, - y: boundingBox.top + boundingBox.height - }, { - // Right middle point of bounding box - x: boundingBox.left + boundingBox.width, - y: boundingBox.top + boundingBox.height / 2 - }, - ]; - - link.end = cornerstoneMath.point.findClosestPoint(boundingBoxPoints, link.start); - context.beginPath(); - context.strokeStyle = color; - context.lineWidth = lineWidth; - context.setLineDash([ 2, 3 ]); - - context.moveTo(link.start.x, link.start.y); - context.lineTo(link.end.x, link.end.y); - context.stroke(); - } - - context.restore(); - } -} - -// ---- Touch tool ---- - -///////// BEGIN ACTIVE TOOL /////// -function addNewMeasurementTouch(touchEventData) { - const element = touchEventData.element; - - function doneCallback() { - measurementData.active = true; - cornerstone.updateImage(element); - } - - const measurementData = createNewMeasurement(touchEventData); - cornerstoneTools.addToolState(element, toolType, measurementData); - element.removeEventListener('cornerstonetoolstouchdrag', cornerstoneTools.nonTargetTouch.touchMoveHandle); - element.removeEventListener('cornerstonetoolsdragstartactive', cornerstoneTools.nonTargetTouch.touchDownActivateCallback); - element.removeEventListener('cornerstonetoolstap', cornerstoneTools.nonTargetTouch.tapCallback); - const config = cornerstoneTools.nonTarget.getConfiguration(); - - cornerstone.updateImage(element); - - cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, measurementData.handles.end, function() { - cornerstone.updateImage(element); - - if (cornerstoneTools.anyHandlesOutsideImage(touchEventData, measurementData.handles)) { - // delete the measurement - cornerstoneTools.removeToolState(element, toolType, measurementData); - } - - config.getMeasurementLocationCallback(measurementData, touchEventData, doneCallback); - - element.addEventListener('cornerstonetoolstouchdrag', cornerstoneTools.nonTargetTouch.touchMoveHandle); - element.addEventListener('cornerstonetoolsdragstartactive', cornerstoneTools.nonTargetTouch.touchDownActivateCallback); - element.addEventListener('cornerstonetoolstap', cornerstoneTools.nonTargetTouch.tapCallback); - }); -} - -function doubleClickCallback(e) { - const eventData = e.detail; - const { element } = eventData; - let data; - - function doneCallback(data, deleteTool) { - if (deleteTool === true) { - cornerstoneTools.removeToolState(element, toolType, data); - cornerstone.updateImage(element); - return; - } - - data.active = false; - cornerstone.updateImage(element); - } - - if (e.data && e.data.mouseButtonMask && !cornerstoneTools.isMouseButtonEnabled(eventData.which, e.data.mouseButtonMask)) { - return false; - } - - // Check if the element is enabled and stop here if not - try { - cornerstone.getEnabledElement(element); - } catch (error) { - return; - } - - const config = cornerstoneTools.nonTarget.getConfiguration(); - - const coords = eventData.currentPoints.canvas; - const toolData = cornerstoneTools.getToolState(element, toolType); - - // now check to see if there is a handle we can move - if (!toolData) { - return; - } - - for (let i = 0; i < toolData.data.length; i++) { - data = toolData.data[i]; - if (pointNearTool(element, data, coords)) { - data.active = true; - cornerstone.updateImage(element); - // Allow relabelling via a callback - config.changeMeasurementLocationCallback(data, eventData, doneCallback); - - e.stopImmediatePropagation(); - return false; - } - } -} - -cornerstoneTools.nonTarget = cornerstoneTools.mouseButtonTool({ - addNewMeasurement, - createNewMeasurement, - onImageRendered, - pointNearTool, - toolType, - mouseDoubleClickCallback: doubleClickCallback -}); - -cornerstoneTools.nonTarget.setConfiguration(configuration); - -cornerstoneTools.nonTargetTouch = cornerstoneTools.touchTool({ - addNewMeasurement: addNewMeasurementTouch, - createNewMeasurement, - onImageRendered, - pointNearTool, - toolType - // pressCallback: doubleClickCallback -}); diff --git a/Packages/ohif-lesiontracker/client/compatibility/qualitativeTargetTools.js b/Packages/ohif-lesiontracker/client/compatibility/qualitativeTargetTools.js deleted file mode 100644 index 33b290766..000000000 --- a/Packages/ohif-lesiontracker/client/compatibility/qualitativeTargetTools.js +++ /dev/null @@ -1,498 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; -import { cornerstone, cornerstoneMath, cornerstoneTools } from 'meteor/ohif:cornerstone'; - -const toolDefaultStates = Viewerbase.toolManager.getToolDefaultStates(); -const textBoxConfig = toolDefaultStates.textBoxConfig; - -const configuration = { - getMeasurementLocationCallback, - changeMeasurementLocationCallback, - drawHandles: false, - drawHandlesOnHover: true, - arrowFirst: true, - textBox: textBoxConfig -}; - -// Used to cancel tool placement -const keys = { ESC: 27 }; - -// Define a callback to get your text annotation -// This could be used, e.g. to open a modal -function getMeasurementLocationCallback(measurementData, eventData, doneCallback) { - doneCallback(window.prompt('Enter your lesion location:')); -} - -function changeMeasurementLocationCallback(measurementData, eventData, doneCallback) { - doneCallback(window.prompt('Change your lesion location:')); -} - -function createQualitativeTargetTool(toolType, responseText='') { - const toolInterface = { toolType }; - const response = responseText; - - /// --- Mouse Tool --- /// - ///////// BEGIN ACTIVE TOOL /////// - function addNewMeasurement(mouseEventData) { - const { element } = mouseEventData; - const $element = $(element); - - function doneCallback() { - measurementData.active = true; - cornerstone.updateImage(element); - } - - const measurementData = createNewMeasurement(mouseEventData); - measurementData.viewport = cornerstone.getViewport(element); - - const tool = cornerstoneTools[toolType]; - const config = tool.getConfiguration(); - - // associate this data with this imageId so we can render it and manipulate it - cornerstoneTools.addToolState(element, toolType, measurementData); - - const disableDefaultHandlers = () => { - // since we are dragging to another place to drop the end point, we can just activate - // the end point and let the moveHandle move it for us. - element.removeEventListener('cornerstonetoolsmousemove', tool.mouseMoveCallback); - element.removeEventListener('cornerstonetoolsmousedown', tool.mouseDownCallback); - element.removeEventListener('cornerstonetoolsmousedownactivate', tool.mouseDownActivateCallback); - element.removeEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback); - }; - - disableDefaultHandlers(); - - // Add a flag for using Esc to cancel tool placement - let cancelled = false; - const cancelAction = () => { - cancelled = true; - cornerstoneTools.removeToolState(element, toolType, measurementData); - }; - - // Add a flag for using Esc to cancel tool placement - const keyDownHandler = event => { - // If the Esc key was pressed, set the flag to true - if (event.which === keys.ESC) { - cancelAction(); - } - - // Don't propagate this keydown event so it can't interfere - // with anything outside of this tool - return false; - }; - - // Bind a one-time event listener for the Esc key - $(element).one('keydown', keyDownHandler); - - // Bind a mousedown handler to cancel the measurement if it's zero-sized - const mousedownHandler = () => { - const { start, end } = measurementData.handles; - if (!cornerstoneMath.point.distance(start, end)) { - cancelAction(); - } - }; - - // Bind a one-time event listener for mouse down - $element.one('mousedown', mousedownHandler); - - // Keep the current image and create a handler for new rendered images - const currentImage = cornerstone.getImage(element); - const currentViewport = cornerstone.getViewport(element); - const imageRenderedHandler = () => { - const newImage = cornerstone.getImage(element); - - // Check if the rendered image changed during measurement creation and delete it if so - if (newImage.imageId !== currentImage.imageId) { - cornerstone.displayImage(element, currentImage, currentViewport); - cancelAction(); - cornerstone.displayImage(element, newImage, currentViewport); - } - }; - - // Bind the event listener for image rendering - element.addEventListener('cornerstoneimagerendered', imageRenderedHandler); - - // Bind the tool deactivation and enlargement handlers - element.addEventListener('cornerstonetoolstooldeactivated', cancelAction); - $element.one('ohif.viewer.viewport.toggleEnlargement', cancelAction); - - cornerstone.updateImage(element); - - cornerstoneTools.moveNewHandle(mouseEventData, toolType, measurementData, measurementData.handles.end, function() { - if (cancelled || cornerstoneTools.anyHandlesOutsideImage(mouseEventData, measurementData.handles)) { - // delete the measurement - cornerstoneTools.removeToolState(mouseEventData.element, toolType, measurementData); - } else { - config.getMeasurementLocationCallback(measurementData, mouseEventData, doneCallback); - } - - // Unbind the Esc keydown hook - $element.off('keydown', keyDownHandler); - - // Unbind the mouse down hook - $element.off('mousedown', mousedownHandler); - - // Unbind the event listener for image rendering - element.removeEventListener('cornerstoneimagerendered', imageRenderedHandler); - - // Unbind the tool deactivation and enlargement handlers - element.removeEventListener('cornerstonetoolstooldeactivated', cancelAction); - $element.off('ohif.viewer.viewport.toggleEnlargement', cancelAction); - - // Disable the default handlers and re-enable again - disableDefaultHandlers(); - element.addEventListener('cornerstonetoolsmousemove', tool.mouseMoveCallback); - element.addEventListener('cornerstonetoolsmousedown', tool.mouseDownCallback); - element.addEventListener('cornerstonetoolsmousedownactivate', tool.mouseDownActivateCallback); - element.addEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback); - - cornerstone.updateImage(element); - }); - } - - function createNewMeasurement(mouseEventData) { - const imageId = mouseEventData.image.imageId; - - // Get studyInstanceUid - const study = cornerstone.metaData.get('study', imageId); - const studyInstanceUid = study.studyInstanceUid; - const patientId = study.patientId; - - // Get seriesInstanceUid - const series = cornerstone.metaData.get('series', imageId); - const seriesInstanceUid = series.seriesInstanceUid; - - // create the measurement data for this tool with the end handle activated - const measurementData = { - isCreating: true, - visible: true, - active: true, - handles: { - start: { - x: mouseEventData.currentPoints.image.x, - y: mouseEventData.currentPoints.image.y, - allowedOutsideImage: true, - highlight: true, - active: false - }, - end: { - x: mouseEventData.currentPoints.image.x, - y: mouseEventData.currentPoints.image.y, - allowedOutsideImage: true, - highlight: true, - active: false - }, - textBox: { - x: mouseEventData.currentPoints.image.x - 50, - y: mouseEventData.currentPoints.image.y - 50, - active: false, - movesIndependently: false, - drawnIndependently: true, - allowedOutsideImage: true, - hasBoundingBox: true - } - }, - imageId: imageId, - seriesInstanceUid: seriesInstanceUid, - studyInstanceUid: studyInstanceUid, - patientId: patientId, - response: response, - isTarget: true, - toolType: toolType - }; - - return measurementData; - } - ///////// END ACTIVE TOOL /////// - - function pointNearTool(element, data, coords) { - const lineSegment = { - start: cornerstone.pixelToCanvas(element, data.handles.start), - end: cornerstone.pixelToCanvas(element, data.handles.end) - }; - const distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords); - - if (cornerstoneTools.pointInsideBoundingBox(data.handles.textBox, coords)) { - return true; - } - - return distanceToPoint < 25; - } - - function drawDottedArrow(context, start, end, color, lineWidth) { - //variables to be used when creating the arrow - const headLength = 10; - - const angle = Math.atan2(end.y - start.y, end.x - start.x); - - //starting path of the arrow from the start square to the end square and drawing the stroke - context.beginPath(); - context.moveTo(start.x, start.y); - context.lineTo(end.x, end.y); - context.strokeStyle = color; - context.lineWidth = lineWidth; - //context.setLineDash([ 2, 3 ]); - context.stroke(); - - //starting a new path from the head of the arrow to one of the sides of the point - context.beginPath(); - context.moveTo(end.x, end.y); - context.lineTo(end.x - headLength * Math.cos(angle - Math.PI / 7), end.y - headLength * Math.sin(angle - Math.PI / 7)); - - //path from the side point of the arrow, to the other side point - context.lineTo(end.x - headLength * Math.cos(angle + Math.PI / 7), end.y - headLength * Math.sin(angle + Math.PI / 7)); - - //path from the side point back to the tip of the arrow, and then again to the opposite side point - context.lineTo(end.x, end.y); - context.lineTo(end.x - headLength * Math.cos(angle - Math.PI / 7), end.y - headLength * Math.sin(angle - Math.PI / 7)); - - //draws the paths created above - context.strokeStyle = color; - context.lineWidth = lineWidth; - context.stroke(); - context.fillStyle = color; - context.fill(); - } - - ///////// BEGIN IMAGE RENDERING /////// - function onImageRendered(e) { - const eventData = e.detail; - const { element } = eventData; - - // if we have no toolData for this element, return immediately as there is nothing to do - const toolData = cornerstoneTools.getToolState(element, toolType); - if (!toolData) return; - - // we have tool data for this element - iterate over each one and draw it - const context = eventData.canvasContext.canvas.getContext('2d'); - context.setTransform(1, 0, 0, 1, 0, 0); - - let color; - const lineWidth = cornerstoneTools.toolStyle.getToolWidth(); - const config = cornerstoneTools[toolType].getConfiguration(); - - for (let i = 0; i < toolData.data.length; i++) { - const data = toolData.data[i]; - if (data.visible === false) { - continue; - } - - context.save(); - - // configurable shadow from CornerstoneTools - if (config && config.shadow) { - context.shadowColor = config.shadowColor || '#000000'; - context.shadowOffsetX = config.shadowOffsetX || 1; - context.shadowOffsetY = config.shadowOffsetY || 1; - } - - if (data.active) { - color = cornerstoneTools.toolColors.getActiveColor(); - } else { - color = cornerstoneTools.toolColors.getToolColor(); - } - - // Draw the arrow - const handleStartCanvas = cornerstone.pixelToCanvas(element, data.handles.start); - const handleEndCanvas = cornerstone.pixelToCanvas(element, data.handles.end); - const canvasTextLocation = cornerstone.pixelToCanvas(element, data.handles.textBox); - - drawDottedArrow(context, handleEndCanvas, handleStartCanvas, color, lineWidth); - - if (config.drawHandles) { - cornerstoneTools.drawHandles(context, eventData, data.handles, color); - } else if (config.drawHandlesOnHover && data.handles.start.active) { - cornerstoneTools.drawHandles(context, eventData, [data.handles.start], color); - } else if (config.drawHandlesOnHover && data.handles.end.active) { - cornerstoneTools.drawHandles(context, eventData, [data.handles.end], color); - } - - // Draw the text - if (data.measurementNumber) { - const textLines = [`Target ${data.measurementNumber}`, response]; - - const boundingBox = cornerstoneTools.drawTextBox( - context, - textLines, - canvasTextLocation.x, - canvasTextLocation.y, - color, - config.textBox - ); - - data.handles.textBox.boundingBox = boundingBox; - - OHIF.cornerstone.repositionTextBox(eventData, data, config.textBox); - - // Draw linked line as dashed - const link = { - start: {}, - end: {} - }; - - const midpointCanvas = { - x: (handleStartCanvas.x + handleEndCanvas.x) / 2, - y: (handleStartCanvas.y + handleEndCanvas.y) / 2, - }; - - const points = [ handleStartCanvas, handleEndCanvas, midpointCanvas ]; - - link.end.x = canvasTextLocation.x; - link.end.y = canvasTextLocation.y; - - link.start = cornerstoneMath.point.findClosestPoint(points, link.end); - - const boundingBoxPoints = [ { - // Top middle point of bounding box - x: boundingBox.left + boundingBox.width / 2, - y: boundingBox.top - }, { - // Left middle point of bounding box - x: boundingBox.left, - y: boundingBox.top + boundingBox.height / 2 - }, { - // Bottom middle point of bounding box - x: boundingBox.left + boundingBox.width / 2, - y: boundingBox.top + boundingBox.height - }, { - // Right middle point of bounding box - x: boundingBox.left + boundingBox.width, - y: boundingBox.top + boundingBox.height / 2 - }, - ]; - - link.end = cornerstoneMath.point.findClosestPoint(boundingBoxPoints, link.start); - context.beginPath(); - context.strokeStyle = color; - context.lineWidth = lineWidth; - context.setLineDash([ 2, 3 ]); - - context.moveTo(link.start.x, link.start.y); - context.lineTo(link.end.x, link.end.y); - context.stroke(); - } - - context.restore(); - } - } - - // ---- Touch tool ---- - - ///////// BEGIN ACTIVE TOOL /////// - function addNewMeasurementTouch(touchEventData) { - const { element } = touchEventData; - - function doneCallback() { - measurementData.active = true; - cornerstone.updateImage(element); - } - - const measurementData = createNewMeasurement(touchEventData); - cornerstoneTools.addToolState(element, toolType, measurementData); - const touchTool = cornerstoneTools[toolType + 'Touch']; - element.removeEventListener('cornerstonetoolstouchdrag', touchTool.touchMoveHandle); - element.removeEventListener('cornerstonetoolsdragstartactive', touchTool.touchDownActivateCallback); - element.removeEventListener('cornerstonetoolstap', touchTool.tapCallback); - const config = cornerstoneTools[toolType].getConfiguration(); - - cornerstone.updateImage(element); - - cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, measurementData.handles.end, function() { - cornerstone.updateImage(element); - - if (cornerstoneTools.anyHandlesOutsideImage(touchEventData, measurementData.handles)) { - // delete the measurement - cornerstoneTools.removeToolState(element, toolType, measurementData); - } - - config.getMeasurementLocationCallback(measurementData, touchEventData, doneCallback); - - element.addEventListener('cornerstonetoolstouchdrag', touchTool.touchMoveHandle); - element.addEventListener('cornerstonetoolsdragstartactive', touchTool.touchDownActivateCallback); - element.addEventListener('cornerstonetoolstap', touchTool.tapCallback); - }); - } - - function doubleClickCallback(e) { - const eventData = e.detail; - const { element } = eventData; - let data; - - function doneCallback(data, deleteTool) { - if (deleteTool === true) { - cornerstoneTools.removeToolState(element, toolType, data); - cornerstone.updateImage(element); - return; - } - - data.active = false; - cornerstone.updateImage(element); - } - - if (e.data && e.data.mouseButtonMask && !cornerstoneTools.isMouseButtonEnabled(eventData.which, e.data.mouseButtonMask)) { - return false; - } - - // Check if the element is enabled and stop here if not - try { - cornerstone.getEnabledElement(element); - } catch (error) { - return; - } - - const config = cornerstoneTools[toolType].getConfiguration(); - - const coords = eventData.currentPoints.canvas; - const toolData = cornerstoneTools.getToolState(element, toolType); - - // now check to see if there is a handle we can move - if (!toolData) { - return; - } - - for (let i = 0; i < toolData.data.length; i++) { - data = toolData.data[i]; - if (pointNearTool(element, data, coords)) { - data.active = true; - cornerstone.updateImage(element); - // Allow relabelling via a callback - config.changeMeasurementLocationCallback(data, eventData, doneCallback); - - e.stopImmediatePropagation(); - return false; - } - } - } - - toolInterface.mouse = cornerstoneTools.mouseButtonTool({ - addNewMeasurement: addNewMeasurement, - createNewMeasurement: createNewMeasurement, - onImageRendered: onImageRendered, - pointNearTool: pointNearTool, - toolType: toolType, - mouseDoubleClickCallback: doubleClickCallback - }); - - toolInterface.touch = cornerstoneTools.touchTool({ - addNewMeasurement: addNewMeasurementTouch, - createNewMeasurement: createNewMeasurement, - onImageRendered: onImageRendered, - pointNearTool: pointNearTool, - toolType: toolType - // pressCallback: doubleClickCallback - }); - - return toolInterface; -} - -const targetCRInterface = createQualitativeTargetTool('targetCR', 'CR'); -cornerstoneTools.targetCR = targetCRInterface.mouse; -cornerstoneTools.targetCR.setConfiguration(configuration); -cornerstoneTools.targetCRTouch = targetCRInterface.touch; - -const targetUNInterface = createQualitativeTargetTool('targetUN', 'UN'); -cornerstoneTools.targetUN = targetUNInterface.mouse; -cornerstoneTools.targetUN.setConfiguration(configuration); -cornerstoneTools.targetUNTouch = targetUNInterface.touch; - -OHIF.lesiontracker.createQualitativeTargetTool = createQualitativeTargetTool; diff --git a/Packages/ohif-lesiontracker/client/components/dialog/nonTargetMeasurement.html b/Packages/ohif-lesiontracker/client/components/dialog/nonTargetMeasurement.html deleted file mode 100644 index 906265a5c..000000000 --- a/Packages/ohif-lesiontracker/client/components/dialog/nonTargetMeasurement.html +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/dialog/nonTargetMeasurement.js b/Packages/ohif-lesiontracker/client/components/dialog/nonTargetMeasurement.js deleted file mode 100644 index 54f341c89..000000000 --- a/Packages/ohif-lesiontracker/client/components/dialog/nonTargetMeasurement.js +++ /dev/null @@ -1,132 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -Template.dialogNonTargetMeasurement.onCreated(() => { - const instance = Template.instance(); - - instance.measurementTypeId = 'nonTarget'; - - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - instance.schema = new SimpleSchema({ - location: config.schema.nonTargetLocation, - response: config.schema.nonTargetResponse - }); - - // Remove the measurement from the collection - instance.removeMeasurement = () => { - const measurementApi = instance.viewerData.measurementApi; - measurementApi.deleteMeasurements('nonTargets', { - toolItemId: instance.data.measurementData._id - }); - - // Sync the new measurement data with cornerstone tools - - // Commenting this out for now, we need the timepointApi - //const baseline = timepointApi.baseline(); - //measurementApi.sortMeasurements(baseline.timepointId); - - // Refresh the image with the measurement removed - cornerstone.updateImage(instance.data.element); - }; - - // Close the current dialog - instance.closeDialog = () => instance.$('.form-action.close').trigger('click'); - - instance.api = { - // Confirm the deletion of the current non-target measurement - remove() { - const dialogSettings = { - position: instance.data.position, - title: 'Remove Measurement', - message: 'Are you sure you want to remove this Non-Target measurement?' - }; - - OHIF.ui.showDialog('dialogConfirm', dialogSettings) - .then(instance.removeMeasurement); - - instance.closeDialog(); - } - }; -}); - -Template.dialogNonTargetMeasurement.onRendered(() => { - const instance = Template.instance(); - - const form = instance.$('form').data('component'); - - const viewerMain = $(instance.data.element).closest('.viewerMain')[0]; - instance.viewerData = Blaze.getData(viewerMain); - - const measurementApi = instance.viewerData.measurementApi; - const timepointApi = instance.viewerData.timepointApi; - - const collection = measurementApi.tools[instance.measurementTypeId]; - - const measurementData = instance.data.measurementData; - - // Get the current inserted measurement from the collection - const currentMeasurement = collection.findOne({ _id: measurementData._id }); - - // Check if it's a edition or creation - if (instance.data.edit) { - // Set the data that is already defined for current measurement - form.value(currentMeasurement); - } else { - // LT-112 Non-target response shall default to non-measurable on baseline, present on follow-up - const timepoint = timepointApi.study(measurementData.studyInstanceUid)[0]; - const response = timepoint && timepoint.timepointType === 'baseline' ? 'Present' : ''; - - // Get a previously inserted Non-target - const previousMeasurement = collection.findOne({ - _id: { $not: measurementData._id }, - measurementNumber: currentMeasurement.measurementNumber - }); - - // Change the location for current measurement if it's not the first one - const location = previousMeasurement && previousMeasurement.location; - - // Set the default location and response - form.value({ - location, - response - }); - - // Synchronize the measurement number with the one inserted in the collection - measurementData.measurementNumber = currentMeasurement.measurementNumber; - - // Refresh the image with the measurement number - cornerstone.updateImage(instance.data.element); - } - - // Delete the measurement from collection when dialog is closed and not on edit mode - instance.data.promise.catch(() => { - if (instance.data.edit) { - return; - } - - instance.removeMeasurement(); - }); - - // Update the location and response after confirming the dialog data - instance.data.promise.then(formData => { - measurementData.response = formData.response; - measurementData.location = formData.location; - - // Update the response for current measurement - collection.update({ - _id: measurementData._id, - }, { - $set: { response: formData.response } - }); - - // Change the location for all Non-Target measurements with the same measurementNumber - collection.update({ - measurementNumber: currentMeasurement.measurementNumber - }, { - $set: { location: formData.location } - }); - }); -}); diff --git a/Packages/ohif-lesiontracker/client/components/index.js b/Packages/ohif-lesiontracker/client/components/index.js deleted file mode 100644 index d0a486677..000000000 --- a/Packages/ohif-lesiontracker/client/components/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import './dialog/nonTargetMeasurement.html'; -import './dialog/nonTargetMeasurement.js'; - -import './timepointBrowser'; - -import './trialOptionsModal/irRCDescription.html'; -import './trialOptionsModal/recistDescription.html'; - -import './trialOptionsModal/trialOptionsModal.html'; -import './trialOptionsModal/trialOptionsModal.js'; - -import './longitudinal'; diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/dropdown.js b/Packages/ohif-lesiontracker/client/components/longitudinal/dropdown.js deleted file mode 100644 index f6dc38e1c..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/dropdown.js +++ /dev/null @@ -1,110 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; - -/** - * Loads multiple unassociated studies in the Viewer - */ -const getAssociationAssessment = () => { - // default result value - const assessment = { - selected: 0, - associated: 0 - }; - - // check if timepointApi is available - const timepointApi = OHIF.studylist.timepointApi; - if (timepointApi) { - // Get a Cursor pointing to the selected Studies from the StudyList - const selectedStudies = OHIF.studylist.getSelectedStudies(); - if (selectedStudies.length > 0) { - assessment.selected = selectedStudies.length; - // Loop through the selected Studies and return true if at least one study has no association. - for (let i = selectedStudies.length - 1; i >= 0; --i) { - let study = selectedStudies[i], - timepoints = timepointApi.study(study.studyInstanceUid); - if (timepoints && timepoints.length > 0) { - assessment.associated++; - } - } - } - } - - return assessment; -}; - -/** - * Removes all present study / timepoint associations from the Clinical Trial - */ -const removeTimepointAssociations = event => { - const dialogSettings = { - title: 'Remove Association', - message: 'Measurements related to this Study and Timepoint will be erased. Do you really want to delete this association?', - confirmClass: 'btn-danger', - position: { - x: event.clientX, - y: event.clientY - } - }; - - OHIF.ui.showDialog('dialogConfirm', dialogSettings).then(() => { - // Get a Cursor pointing to the selected Studies from the StudyList - const selectedStudies = OHIF.studylist.getSelectedStudies(); - - // Find the Timepoint that was previously referenced - const timepointApi = OHIF.studylist.timepointApi; - if (!timepointApi) { - OHIF.log.error('Remove Study/Timepoint Association: No Timepoint API found.'); - return; - } - - // Loop through the Cursor of Selected Studies - selectedStudies.forEach(study => { - const studyInstanceUid = study.studyInstanceUid; - const timepoints = timepointApi.study(studyInstanceUid); - const timepointIds = timepoints.map(t => t.timepointId); - timepointApi.disassociateStudy(timepointIds, studyInstanceUid); - }); - }); -}; - -Meteor.startup(() => { - if (!OHIF.studylist) return; - - OHIF.studylist.dropdown.setItems([{ - action: OHIF.studylist.viewStudies, - text: 'View', - separatorAfter: true - }, { - action: () => OHIF.ui.showDialog('dialogStudyAssociation'), - text: 'Associate', - disabled: () => { - const assessment = getAssociationAssessment(); - return assessment.selected < 1; - } - }, { - action: removeTimepointAssociations, - text: 'Remove Association', - separatorAfter: true, - disabled: () => { - const assessment = getAssociationAssessment(); - return assessment.selected < 1 || assessment.selected !== assessment.associated; - } - }, { - action: OHIF.studylist.viewSeriesDetails, - text: 'View Series Details' - }, { - text: 'Anonymize', - disabled: true - }, { - text: 'Send', - disabled: true, - separatorAfter: true - }, { - action: OHIF.studylist.exportSelectedStudies, - text: 'Export', - title: 'Export Selected Studies' - }, { - text: 'Delete', - disabled: true - }]); -}); diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/index.js b/Packages/ohif-lesiontracker/client/components/longitudinal/index.js deleted file mode 100644 index ebaf3b217..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/index.js +++ /dev/null @@ -1,11 +0,0 @@ -// Longitudinal Components imports -import './longitudinalStudyListStudy/longitudinalStudyListStudy.html'; -import './longitudinalStudyListStudy/longitudinalStudyListStudy.styl'; -import './longitudinalStudyListStudy/longitudinalStudyListStudy.js'; - -import './longitudinalViewportOverlay/imageViewportIcons.html'; -import './longitudinalViewportOverlay/longitudinalViewportOverlay.html'; -import './longitudinalViewportOverlay/longitudinalViewportOverlay.js'; -import './longitudinalViewportOverlay/longitudinalViewportOverlay.styl'; - -import './dropdown.js'; diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.html b/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.html deleted file mode 100644 index e8a4d7505..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.html +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.js b/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.js deleted file mode 100644 index a8f11fd7a..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.js +++ /dev/null @@ -1,31 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -// Use Aldeed's meteor-template-extension package to replace the -// default StudyListStudy template. -// See https://github.com/aldeed/meteor-template-extension -const defaultTemplate = 'studylistStudy'; - -if (OHIF.studylist) { - Template.longitudinalStudyListStudy.replaces(defaultTemplate); - - // Add the TimepointName helper to the default template. The - // HTML of this template is replaced with that of longitudinalStudyListStudy - Template[defaultTemplate].helpers({ - timepointName() { - const instance = Template.instance(); - const timepointApi = OHIF.studylist.timepointApi; - if (!timepointApi) { - return; - } - - const timepoint = timepointApi.study(instance.data.studyInstanceUid)[0]; - if (!timepoint) { - return; - } - - return timepointApi.name(timepoint); - } - }); -} diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.styl b/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.styl deleted file mode 100644 index f51b5e34c..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalStudyListStudy/longitudinalStudyListStudy.styl +++ /dev/null @@ -1,2 +0,0 @@ -.studylistStudy - cursor: pointer diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/imageViewportIcons.html b/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/imageViewportIcons.html deleted file mode 100644 index 7b6bf52f8..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/imageViewportIcons.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.html b/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.html deleted file mode 100644 index 18ffde22b..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.html +++ /dev/null @@ -1,86 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.js b/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.js deleted file mode 100644 index fb093038b..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.js +++ /dev/null @@ -1,185 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { Tracker } from 'meteor/tracker'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; -import { moment } from 'meteor/momentjs:moment'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -// Use Aldeed's meteor-template-extension package to replace the -// default viewportOverlay template. -// See https://github.com/aldeed/meteor-template-extension -const defaultTemplate = 'viewportOverlay'; -Template.longitudinalViewportOverlay.replaces(defaultTemplate); - -Template[defaultTemplate].onCreated(() => { - const instance = Template.instance(); - instance.instanceMetadata = new ReactiveVar(); - - const { DICOMTagDescriptions } = OHIF.viewerbase; - instance.getValueByTagKeyword = tagKeyword => { - const instanceMetadata = instance.instanceMetadata.get(); - const tagObject = DICOMTagDescriptions.find(tagKeyword); - if (!instanceMetadata || !tagObject) return; - return instanceMetadata.getRawValue(tagObject.tag); - }; -}); - -Template[defaultTemplate].onRendered(() => { - const instance = Template.instance(); - const { studyInstanceUid, seriesInstanceUid } = instance.data; - - instance.autorun(computation => { - Session.get('CornerstoneNewImage' + instance.data.viewportIndex); - if (computation.firstRun) return; - computation.stop(); - const imageIndex = instance.getImageIndex(); - - if (!studyInstanceUid || !seriesInstanceUid) { - return; - } - - OHIF.studies.loadStudy(studyInstanceUid).then(study => { - const studyMetadata = OHIF.viewerbase.getStudyMetadata(study); - const seriesMetadata = studyMetadata.getSeriesByUID(seriesInstanceUid); - const instanceMetadata = seriesMetadata.getInstanceByIndex(imageIndex); - if (!instanceMetadata) return; - instance.instanceMetadata.set(instanceMetadata); - }); - }); -}); - -// Add the TimepointName helper to the default template. The -// HTML of this template is replaced with that of longitudinalViewportOverlay -Template[defaultTemplate].helpers({ - studyInfo(tagKeyword) { - const instance = Template.instance(); - instance.instanceMetadata.dep.depend(); - return instance.getValueByTagKeyword(tagKeyword); - }, - - getGenderAndAge() { - const instance = Template.instance(); - const values = []; - values.push(instance.getValueByTagKeyword('PatientSex')); - - const patientAge = instance.getValueByTagKeyword('PatientAge'); - const patientBirthDate = instance.getValueByTagKeyword('PatientBirthDate'); - if (patientAge) { - values.push(patientAge); - } else if (patientBirthDate) { - const date = moment(patientBirthDate, 'YYYYMMDD'); - const yearDiff = moment().diff(date, 'years'); - if (yearDiff) { - values.push((yearDiff + 'Y').padStart(4, '0')); - } else { - const monthDiff = moment().diff(date, 'months'); - if (monthDiff) { - values.push((monthDiff + 'M').padStart(4, '0')); - } else { - const dayDiff = moment().diff(date, 'days') || 0; - values.push((dayDiff + 'D').padStart(4, '0')); - } - } - } - - return values.filter(value => !!value).join(', '); - }, - - thickness() { - const instance = Template.instance(); - Session.get('CornerstoneNewImage' + instance.data.viewportIndex); - - return instance.getValueByTagKeyword('SliceThickness'); - }, - - location() { - const instance = Template.instance(); - Session.get('CornerstoneNewImage' + instance.data.viewportIndex); - - const sliceLocation = instance.getValueByTagKeyword('SliceLocation'); - const tablePosition = instance.getValueByTagKeyword('TablePosition'); - const imagePositionPatient = instance.getValueByTagKeyword('ImagePositionPatient'); - return sliceLocation || tablePosition || imagePositionPatient; - }, - - spacingBetweenSlices() { - const instance = Template.instance(); - Session.get('CornerstoneNewImage' + instance.data.viewportIndex); - - // TODO: Otherwise, displays a value derived from successive values - // of Image Position (Patient) (0020,0032) perpendicular to - // the Image Orientation (Patient) (0020,0037) - - return instance.getValueByTagKeyword('SpacingBetweenSlices'); - }, - - zoom() { - const instance = Template.instance(); - const { viewportIndex } = instance.data; - const { getElementIfNotEmpty } = OHIF.viewerbase; - Session.get('CornerstoneImageRendered' + viewportIndex); - - const element = getElementIfNotEmpty(viewportIndex); - if (!element) return; - - const viewport = cornerstone.getViewport(element); - if (!viewport) return; - - return viewport.scale; - }, - - wwwc() { - const instance = Template.instance(); - const { viewportIndex } = instance.data; - const { getElementIfNotEmpty, wlPresets } = OHIF.viewerbase; - Session.get('CornerstoneImageRendered' + viewportIndex); - wlPresets.changeObserver.depend(); - - const element = getElementIfNotEmpty(viewportIndex); - if (!element) return; - - const viewport = cornerstone.getViewport(element); - if (!viewport) return; - - const ww = viewport.voi.windowWidth.toFixed(0); - const wc = viewport.voi.windowCenter.toFixed(0); - const result = [`W: ${ww}, L: ${wc}`]; - - // Check if there's a preset with this W/L - const preset = _.findWhere(OHIF.viewer.wlPresets, { - ww: parseInt(ww), - wc: parseInt(wc) - }); - - // Append the preset name to the result if found - if (preset) { - result .push(`(${preset.id})`); - } - - return result.join(' '); - }, - - timepointName() { - const instance = Template.instance(); - const studyInstanceUid = instance.data.studyInstanceUid; - - const timepointApi = OHIF.viewer.timepointApi; - if (!timepointApi) return; - - const timepoints = timepointApi.study(studyInstanceUid); - if (!timepoints || !timepoints.length) { - return; - } - - const timepoint = timepoints[0]; - - return timepointApi.name(timepoint); - }, - - linked() { - const linkedViewports = Session.get('StackImagePositionOffsetSynchronizerLinkedViewports') || []; - return (linkedViewports.indexOf(this.viewportIndex) !== -1); - } -}); diff --git a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.styl b/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.styl deleted file mode 100644 index fc31d9ac4..000000000 --- a/Packages/ohif-lesiontracker/client/components/longitudinal/longitudinalViewportOverlay/longitudinalViewportOverlay.styl +++ /dev/null @@ -1,4 +0,0 @@ -@require '{ohif:design}/app' - -.imageViewerViewportOverlay .icons-section .icon-link - transform(translateY(3px)) diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/index.js b/Packages/ohif-lesiontracker/client/components/timepointBrowser/index.js deleted file mode 100644 index 2ef72e316..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import './item.html'; -import './item.js'; -import './list.html'; -import './list.styl'; -import './quickSwitch.html'; -import './quickSwitch.js'; -import './sidebar.html'; -import './sidebar.js'; -import './studies.html'; -import './studies.js'; diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/item.html b/Packages/ohif-lesiontracker/client/components/timepointBrowser/item.html deleted file mode 100644 index 9b1a4d81a..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/item.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/item.js b/Packages/ohif-lesiontracker/client/components/timepointBrowser/item.js deleted file mode 100644 index 4ed7a2c8c..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/item.js +++ /dev/null @@ -1,84 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.timepointBrowserItem.onCreated(() => { - const instance = Template.instance(); - const { timepoint, timepointApi } = instance.data; - const { timepointId } = timepoint; - - const hasStudiesData = !!(timepoint.studiesData && timepoint.studiesData.length); - instance.summary = new ReactiveVar(''); - instance.studiesData = new ReactiveVar(hasStudiesData ? timepoint.studiesData : null); - - const updateStudiesData = newDocument => { - const newTimepoint = newDocument || timepointApi.timepoints.findOne({ timepointId }); - if (newTimepoint && newTimepoint.studiesData && newTimepoint.studiesData.length) { - instance.studiesData.set(newTimepoint.studiesData); - } - }; - - timepointApi.timepoints.find({ timepointId }).observe({ changed: updateStudiesData }); - - // Build the modalities summary of all timepoint's studies - instance.setModalitiesSummary = () => { - const studiesData = instance.studiesData.get(); - if (!studiesData) return; - - const modalities = {}; - studiesData.forEach(study => { - const modality = study.modalities || 'UN'; - modalities[modality] = modalities[modality] + 1 || 1; - }); - - const summary = []; - _.each(modalities, (count, modality) => summary.push(`${count} ${modality}`)); - - instance.summary.set(summary.join(', ')); - }; - - const filter = { studyInstanceUid: timepoint.studyInstanceUids }; - instance.loadStudies = () => OHIF.studies.searchStudies(filter).then(studiesData => { - instance.studiesData.set(studiesData); - timepointApi.timepoints.update(timepoint._id, { $set: { studiesData } }); - instance.setModalitiesSummary(); - }).catch(error => { - const text = 'An error has occurred while retrieving studies information'; - OHIF.ui.notifications.danger({ text }); - OHIF.log.error(error); - instance.summary.set('Failed'); - }); - - updateStudiesData(); - instance.autorun(() => { - const studiesData = instance.studiesData.get(); - if (studiesData) { - instance.setModalitiesSummary(); - } - }); -}); - -Template.timepointBrowserItem.events({ - 'ohif.measurements.timepoint.load .timepoint-item'(event, instance) { - instance.loadStudies(); - }, - - 'click .timepoint-item'(event, instance) { - const element = event.currentTarget.parentElement; - const $element = $(element); - - const triggerClick = () => { - $element.trigger('ohif.measurements.timepoint.click', instance.data.timepoint); - }; - - if (!instance.studiesData.get()) { - instance.summary.set('Loading...'); - instance.loadStudies().then(() => Tracker.afterFlush(triggerClick)); - } else { - triggerClick(); - } - } -}); diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/list.html b/Packages/ohif-lesiontracker/client/components/timepointBrowser/list.html deleted file mode 100644 index 10092f288..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/list.html +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/list.styl b/Packages/ohif-lesiontracker/client/components/timepointBrowser/list.styl deleted file mode 100644 index 653575aa3..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/list.styl +++ /dev/null @@ -1,85 +0,0 @@ -@require '{ohif:design}/app' - -.timepoint-switch - theme('border-bottom', '1px solid $uiBorderColor') - -.timepoint-browser-item - - .timepoint-item - cursor: pointer - font-size: 13px - - &:not(.active) .timepoint-browser-studies - max-height: 0 !important - - .timepoint-studies-container - opacity: 0 - transform(translateY(-100%)) - - .timepoint-browser-studies - overflow: hidden - transition(max-height 0.3s ease) - - .timepoint-studies-container - opacity: 1 - transition(opacity 0.3s ease\, transform 0.3s ease) - transform(translateY(0)) - transform-origin(50% 0%) - - .timepoint-date - opacity: 1 - - &.active - .timepoint-summary - max-height: 0 - opacity: 0 - - .timepoint-date - opacity: 0 - - .timepoint-expand-icon i - transform: rotateX(180deg) - - .timepoint-title - font-size: 14px - theme('color', '$textSecondaryColor') - text-transform: uppercase - - & - .timepoint-expand-icon i, - .timepoint-title, - .timepoint-date, - .timepoint-summary - theme('color', '$textSecondaryColor') - transition($sidebarTransition) - - &:hover - &, - .timepoint-title, - .timepoint-expand-icon i, - .timepoint-date, - .timepoint-summary - theme('color', '$textPrimaryColor') !important - - .timepoint-details - .timepoint-summary - line-height: 25px - - .timepoint-summary - height: 25px - max-height: 25px - opacity: 1 - overflow: hidden - - .timepoint-expand-icon i - theme('color', '$defaultColor') - - .timepoint-title - theme('color', '$textPrimaryColor') - padding-top: 2px - -.series-quick-switch .timepoint-browser-list - padding: 0 10px - - div.timepoint-title - text-transform: none diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/quickSwitch.html b/Packages/ohif-lesiontracker/client/components/timepointBrowser/quickSwitch.html deleted file mode 100644 index 9d1525ccd..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/quickSwitch.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/quickSwitch.js b/Packages/ohif-lesiontracker/client/components/timepointBrowser/quickSwitch.js deleted file mode 100644 index 905845dad..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/quickSwitch.js +++ /dev/null @@ -1,119 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.timepointBrowserQuickSwitch.onCreated(() => { - const instance = Template.instance(); - const { timepointApi } = OHIF.viewer; - - instance.selectedTimepoint = new ReactiveVar(); - instance.timepoints = new ReactiveVar([]); - - instance.updateSelectedTimepoint = studyInstanceUid => { - const selectedTimepoint = timepointApi.study(studyInstanceUid)[0]; - instance.selectedTimepoint.set(selectedTimepoint); - }; - - const currentTimepoint = timepointApi.current(); - const filter = { latestDate: { $lte: currentTimepoint.latestDate } }; - instance.keyTimepoints = timepointApi.key(filter); - - const { viewportIndex } = instance.data; - instance.autorun(() => { - OHIF.viewerbase.layoutManager.observer.depend(); - const viewportData = OHIF.viewerbase.layoutManager.viewportData[viewportIndex]; - let { studyInstanceUid } = viewportData; - if (!studyInstanceUid) { - Tracker.nonreactive(() => { - const currentStudy = instance.data.currentStudy.get(); - if (currentStudy) { - studyInstanceUid = currentStudy.studyInstanceUid; - } - }); - } - - instance.updateSelectedTimepoint(studyInstanceUid); - }); - - instance.autorun(() => { - const selectedTimepoint = instance.selectedTimepoint.get(); - const timepoints = [selectedTimepoint]; - instance.timepoints.set(timepoints); - }); -}); - -Template.timepointBrowserQuickSwitch.onRendered(() => { - const instance = Template.instance(); - - instance.updateActiveStudy = () => { - const currentStudy = instance.data.currentStudy.get(); - const studyInstanceUid = (currentStudy && currentStudy.studyInstanceUid) || ''; - Tracker.afterFlush(() => { - const $studyBrowserItems = instance.$('.study-browser-item'); - $studyBrowserItems.removeClass('active'); - $studyBrowserItems.filter(`[data-uid="${studyInstanceUid}"]`).addClass('active'); - }); - }; - - instance.autorun(() => { - const selectedTimepoint = instance.selectedTimepoint.get(); - const selectedTimepointId = (selectedTimepoint && selectedTimepoint.timepointId) || ''; - const $allBrowserItems = instance.$('.timepoint-browser-item'); - const $browserItem = $allBrowserItems.filter(`[data-id=${selectedTimepointId}]`); - if (!$browserItem.hasClass('active')) { - $browserItem.find('.timepoint-item').trigger('click'); - } - }); - - instance.autorun(instance.updateActiveStudy); -}); - -Template.timepointBrowserQuickSwitch.events({ - 'ohif.measurements.timepoint.click'(event, instance) { - const $element = $(event.currentTarget); - $element.toggleClass('active'); - instance.updateActiveStudy(); - }, - - 'ohif.studies.study.click'(event, instance, studyInformation) { - const { studyInstanceUid } = studyInformation; - const study = OHIF.viewer.Studies.findBy({ studyInstanceUid }); - instance.data.currentStudy.set(study); - const $studySwitch = $(event.currentTarget).closest('.study-switch'); - $studySwitch.siblings('.series-switch').trigger('rescale'); - instance.updateSelectedTimepoint(studyInformation.studyInstanceUid); - - // Create a hover bridge to prevent quick switch from closing due to scroll height - Meteor.defer(() => { - const $scrollable = $studySwitch.find('.study-browser>.scrollable'); - const offsetY = $scrollable.offset().top + $scrollable.outerHeight(); - if (event.clientY > offsetY) { - const hoverHandler = _.throttle(event => { - if (event.clientY <= offsetY) { - $scrollable.css('padding-bottom', ''); - $scrollable.off('mousemove', hoverHandler); - $scrollable.off('mouseleave', hoverHandler); - } - }, 100); - $scrollable.css('padding-bottom', event.clientY - offsetY + 20); - $scrollable.on('mousemove', hoverHandler); - $scrollable.one('mouseleave', () => $scrollable.off('mousemove', hoverHandler)); - } - }); - } -}); - -Template.timepointBrowserQuickSwitch.helpers({ - timepointBrowserData() { - const instance = Template.instance(); - const { timepointApi } = OHIF.viewer; - return { - timepointApi, - timepoints: instance.timepoints.get(), - timepointChildTemplate: 'timepointBrowserStudies' - }; - } -}); diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/sidebar.html b/Packages/ohif-lesiontracker/client/components/timepointBrowser/sidebar.html deleted file mode 100644 index c6de588a6..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/sidebar.html +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/sidebar.js b/Packages/ohif-lesiontracker/client/components/timepointBrowser/sidebar.js deleted file mode 100644 index dac2222bc..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/sidebar.js +++ /dev/null @@ -1,95 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; - -Template.timepointBrowserSidebar.onCreated(() => { - const instance = Template.instance(); - - // Reactive variable to control the view type for all or key timepoints - instance.timepointViewType = new ReactiveVar(instance.data.timepointViewType); -}); - -Template.timepointBrowserSidebar.onRendered(() => { - const instance = Template.instance(); - instance.lastType = ''; - - // Collapse all timepoints but first when timepoint view type changes - instance.$browserList = instance.$('.timepoint-browser-list').first(); - instance.autorun(() => { - // Runs this computation every time the timepointViewType is changed - const type = instance.timepointViewType.get(); - if (type !== instance.lastType) { - const eventKey = 'ohif.measurements.timepoint.changeViewType'; - instance.$browserList.trigger(eventKey, type); - } - - instance.lastType = type; - }); -}); - -Template.timepointBrowserSidebar.events({ - 'ohif.studies.study.click'(event, instance) { - const $element = $(event.currentTarget); - - // Defer the active class toggling to wait for child template rendering - Meteor.defer(() => { - // Remove max height restriction from studies browser - const $studiesBrowser = $element.closest('.timepoint-browser-studies'); - $studiesBrowser.css('max-height', ''); - - // Remove active class from sibling studies - $element.siblings().removeClass('active'); - - // Toggle the active class on clicked study - $element.toggleClass('active'); - - // Adjust the max height for studiesBrowser when series transition is finished - const $seriesBrowser = $element.find('.study-browser-series'); - $seriesBrowser.one('transitionend', () => $studiesBrowser.adjustMax('height')); - }); - }, - - 'ohif.measurements.timepoint.click'(event, instance) { - const $element = $(event.currentTarget); - - // Defer the active class toggling to wait for child template rendering - Meteor.defer(() => $element.toggleClass('active')); - } -}); - -Template.timepointBrowserSidebar.helpers({ - viewTypeButtonGroupData() { - return { - value: Template.instance().timepointViewType, - options: [{ - value: 'key', - text: 'Key Timepoints' - }, { - value: 'all', - text: 'All Timepoints' - }] - }; - }, - - timepointBrowserData() { - const instance = Template.instance(); - const { timepointApi } = instance.data; - - const currentTimepoint = timepointApi.current(); - const { patientId } = currentTimepoint; - let timepoints = []; - if (instance.timepointViewType.get() === 'key') { - const filter = { latestDate: { $lte: currentTimepoint.latestDate } }; - timepoints = timepointApi.key(filter); - } else { - timepoints = timepointApi.all({ patientId }); - } - - return { - timepointApi, - timepoints, - timepointChildTemplate: 'timepointBrowserStudies', - studyChildTemplate: 'studyBrowserSeries' - }; - } -}); diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/studies.html b/Packages/ohif-lesiontracker/client/components/timepointBrowser/studies.html deleted file mode 100644 index dd07f9d8f..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/studies.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/timepointBrowser/studies.js b/Packages/ohif-lesiontracker/client/components/timepointBrowser/studies.js deleted file mode 100644 index 82b69ba56..000000000 --- a/Packages/ohif-lesiontracker/client/components/timepointBrowser/studies.js +++ /dev/null @@ -1,5 +0,0 @@ -import { Template } from 'meteor/templating'; - -Template.timepointBrowserStudies.onRendered(() => { - Template.instance().$('.timepoint-browser-studies').adjustMax('height'); -}); diff --git a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/irRCDescription.html b/Packages/ohif-lesiontracker/client/components/trialOptionsModal/irRCDescription.html deleted file mode 100644 index 6b6054cc2..000000000 --- a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/irRCDescription.html +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/recistDescription.html b/Packages/ohif-lesiontracker/client/components/trialOptionsModal/recistDescription.html deleted file mode 100644 index 51f001ae0..000000000 --- a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/recistDescription.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/trialOptionsModal.html b/Packages/ohif-lesiontracker/client/components/trialOptionsModal/trialOptionsModal.html deleted file mode 100644 index 285a3d9a6..000000000 --- a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/trialOptionsModal.html +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/trialOptionsModal.js b/Packages/ohif-lesiontracker/client/components/trialOptionsModal/trialOptionsModal.js deleted file mode 100644 index c39e736fd..000000000 --- a/Packages/ohif-lesiontracker/client/components/trialOptionsModal/trialOptionsModal.js +++ /dev/null @@ -1,73 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -Meteor.startup(() => { - const TrialCriteriaTypes = new Meteor.Collection(null); - TrialCriteriaTypes._debugName = 'TrialCriteriaTypes'; - - TrialCriteriaTypes.insert({ - id: 'RECIST', - name: 'RECIST 1.1', - descriptionTemplate: 'recistDescription', - selected: true - }); - - TrialCriteriaTypes.insert({ - id: 'irRC', - name: 'irRC', - descriptionTemplate: 'irRCDescription', - selected: false - }); - - OHIF.lesiontracker.TrialCriteriaTypes = TrialCriteriaTypes; -}); - -Template.trialOptionsModal.onCreated(() => { - const instance = Template.instance(); - const { TrialCriteriaTypes } = OHIF.lesiontracker; - const types = TrialCriteriaTypes.find().fetch(); - const defaultValue = _.findWhere(types, { selected: true })._id; - instance.selectedTrial = new ReactiveVar(defaultValue); - - instance.schema = new SimpleSchema({ - trialCriteria: { - type: String, - allowedValues: _.pluck(types, '_id'), - valuesLabels: _.pluck(types, 'name'), - defaultValue - } - }); - - instance.data.promise.then(formData => { - // Set "selected" to false for the entire collection - TrialCriteriaTypes.update({}, { - $set: { selected: false } - }, { - multi: true - }); - - // TODO: Use filter with "_id: $in" when allowing multiple criteria - // Set "selected" to true for the current criteria - TrialCriteriaTypes.update(formData.trialCriteria, { - $set: { selected: true } - }); - }); -}); - -Template.trialOptionsModal.helpers({ - getDescriptionTemplate(_id) { - return OHIF.lesiontracker.TrialCriteriaTypes.findOne(_id).descriptionTemplate; - } -}); - -Template.trialOptionsModal.events({ - 'change .js-trial'(event, instance) { - const form = instance.$('form').first().data('component'); - if (!form) return; - instance.selectedTrial.set(form.value().trialCriteria); - } -}); diff --git a/Packages/ohif-lesiontracker/client/index.js b/Packages/ohif-lesiontracker/client/index.js deleted file mode 100644 index 35d04e191..000000000 --- a/Packages/ohif-lesiontracker/client/index.js +++ /dev/null @@ -1,12 +0,0 @@ -// Client-side collections -import './collections'; - -// Additional Custom Cornerstone Tools for Lesion Tracker -import './compatibility'; - -import './tools.js'; - -// UI Components -import './components'; - -import './lib'; diff --git a/Packages/ohif-lesiontracker/client/lib/bidirectional/getLongestAndShortestDiameters.js b/Packages/ohif-lesiontracker/client/lib/bidirectional/getLongestAndShortestDiameters.js deleted file mode 100644 index 04cfc5c7e..000000000 --- a/Packages/ohif-lesiontracker/client/lib/bidirectional/getLongestAndShortestDiameters.js +++ /dev/null @@ -1,16 +0,0 @@ -export default function(handles, image={}) { - // Calculate the long axis length - const dx = (handles.start.x - handles.end.x) * (image.columnPixelSpacing || 1); - const dy = (handles.start.y - handles.end.y) * (image.rowPixelSpacing || 1); - const length = Math.sqrt(dx * dx + dy * dy) || 0; - - // Calculate the short axis length - const wx = (handles.perpendicularStart.x - handles.perpendicularEnd.x) * (image.columnPixelSpacing || 1); - const wy = (handles.perpendicularStart.y - handles.perpendicularEnd.y) * (image.rowPixelSpacing || 1); - const width = Math.sqrt(wx * wx + wy * wy) || 0; - - return { - longestDiameter: length.toFixed(1), - shortestDiameter: width.toFixed(1) - }; -} diff --git a/Packages/ohif-lesiontracker/client/lib/bidirectional/getSelectedHandleKey.js b/Packages/ohif-lesiontracker/client/lib/bidirectional/getSelectedHandleKey.js deleted file mode 100644 index d8fa18f09..000000000 --- a/Packages/ohif-lesiontracker/client/lib/bidirectional/getSelectedHandleKey.js +++ /dev/null @@ -1,14 +0,0 @@ -// Get the key for the handle which is selected -export default function(handles) { - let selectedHandleKey; - Object.keys(handles).every(handleKey => { - const handle = handles[handleKey]; - if (handle.selected) { - selectedHandleKey = handleKey; - return false; - } - - return true; - }); - return selectedHandleKey; -} diff --git a/Packages/ohif-lesiontracker/client/lib/bidirectional/index.js b/Packages/ohif-lesiontracker/client/lib/bidirectional/index.js deleted file mode 100644 index 796c5003b..000000000 --- a/Packages/ohif-lesiontracker/client/lib/bidirectional/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import getSelectedHandleKey from './getSelectedHandleKey'; -import repositionBidirectionalArmHandle from './repositionBidirectionalArmHandle'; -import getLongestAndShortestDiameters from './getLongestAndShortestDiameters'; - -OHIF.lesiontracker.bidirectional = { - toolType: 'bidirectional', - inverseKeyMap: { - start: 'end', - end: 'start', - perpendicularStart: 'perpendicularEnd', - perpendicularEnd: 'perpendicularStart' - }, - perpendicularKeyMap: { - start: 'perpendicularStart', - end: 'perpendicularEnd', - perpendicularStart: 'start', - perpendicularEnd: 'end' - }, - getSelectedHandleKey, - repositionBidirectionalArmHandle, - getLongestAndShortestDiameters -}; diff --git a/Packages/ohif-lesiontracker/client/lib/bidirectional/repositionBidirectionalArmHandle.js b/Packages/ohif-lesiontracker/client/lib/bidirectional/repositionBidirectionalArmHandle.js deleted file mode 100644 index 68a105ba4..000000000 --- a/Packages/ohif-lesiontracker/client/lib/bidirectional/repositionBidirectionalArmHandle.js +++ /dev/null @@ -1,65 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -// Return the newPosition for the handle based on the mmStep and handles -export default function(image, handles, handleKey, mmStep, mmLimit=1) { - if (handleKey === 'textBox') return; - - const lib = OHIF.lesiontracker.bidirectional; - - // Defines how much the arm will increase/decrease - const columnPixelSpacing = (image && image.columnPixelSpacing) || 1; - const rowPixelSpacing = (image && image.rowPixelSpacing) || 1; - const stepX = mmStep * (1 / columnPixelSpacing); - const stepY = mmStep * (1 / rowPixelSpacing); - - // Get the line angle and its handles - const keyA = handleKey; - const keyB = lib.inverseKeyMap[handleKey]; - const handleA = handles[keyA]; - const handleB = handles[keyB]; - const angle = Math.atan2(handleA.y - handleB.y, handleA.x - handleB.x); - - // Calculate the new position of the handle - const newPosition = { - x: handleA.x + Math.cos(angle) * stepX, - y: handleA.y + Math.sin(angle) * stepY - }; - - if (mmStep < 0) { - // Get the perpendicular handles - const keyC = lib.perpendicularKeyMap[keyA]; - const keyD = lib.perpendicularKeyMap[keyB]; - const handleC = handles[keyC]; - const handleD = handles[keyD]; - - // Create the line segment for the arm being resized - const lineAB = { - start: _.pick(handleA, ['x', 'y']), - end: _.pick(handleB, ['x', 'y']) - }; - - // Create the line segment for the perpendicular arm - const lineCD = { - start: _.pick(handleC, ['x', 'y']), - end: _.pick(handleD, ['x', 'y']) - }; - - // Get the intersection point between the arms - const intersection = cornerstoneMath.lineSegment.intersectLine(lineAB, lineCD); - - // Keep the minimum distance of 0.1 mm to the intersection point - const dx = (intersection.x - newPosition.x) * columnPixelSpacing; - const dy = (intersection.y - newPosition.y) * rowPixelSpacing; - const distance = Math.sqrt((dx * dx) + (dy * dy)); - const newAngle = Math.atan2(newPosition.y - intersection.y, newPosition.x - intersection.x); - if (angle.toFixed(8) !== newAngle.toFixed(8) || distance < Math.abs(mmLimit)) { - Object.assign(newPosition, { - x: intersection.x - Math.cos(angle) * mmLimit * Math.sign(stepX), - y: intersection.y - Math.sin(angle) * mmLimit * Math.sign(stepY) - }); - } - } - - return newPosition; -} diff --git a/Packages/ohif-lesiontracker/client/lib/clearMeasurementTimepointData.js b/Packages/ohif-lesiontracker/client/lib/clearMeasurementTimepointData.js deleted file mode 100644 index 537a79dba..000000000 --- a/Packages/ohif-lesiontracker/client/lib/clearMeasurementTimepointData.js +++ /dev/null @@ -1,50 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -const removeToolDataWithMeasurementId = (imageId, toolType, measurementId) => { - OHIF.log.info('removeToolDataWithMeasurementId'); - const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.saveToolState(); - - // Find any related toolData - if (!toolState[imageId] || !toolState[imageId][toolType]) { - return; - } - - const toolData = toolState[imageId][toolType].data; - if (!toolData.length) { - return; - } - - // Search toolData for entries linked to the specified Measurement - const toRemove = []; - toolData.forEach(function(measurement, index) { - if (measurement.id === measurementId || - measurement._id === measurementId) { - toRemove.push(index); - return false; - } - }); - - OHIF.log.info('Removing Indices: '); - OHIF.log.info(toRemove); - - // If any toolData entries need to be removed, splice them from - // the toolData array - toRemove.forEach(function(index) { - toolData.splice(index, 1); - }); - - cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(toolState); -}; - -OHIF.lesiontracker.clearMeasurementTimepointData = (measurementId, timepointId) => { - const data = Measurements.findOne(measurementId); - - // Clear the Measurement data for this timepoint - const imageId = data.timepoints[timepointId].imageId; - const toolType = data.toolType; - removeToolDataWithMeasurementId(imageId, toolType, measurementId); - - // Update any viewports that are currently displaying this imageId - const enabledElements = cornerstone.getEnabledElementsByImageId(imageId); - enabledElements.forEach(enabledElement => cornerstone.updateImage(enabledElement.element)); -}; diff --git a/Packages/ohif-lesiontracker/client/lib/configureTargetToolsHandles.js b/Packages/ohif-lesiontracker/client/lib/configureTargetToolsHandles.js deleted file mode 100644 index d04174b06..000000000 --- a/Packages/ohif-lesiontracker/client/lib/configureTargetToolsHandles.js +++ /dev/null @@ -1,52 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.lesiontracker.configureTargetToolsHandles = () => { - const toggleLabel = (measurementData, eventData, doneCallback) => { - delete measurementData.isCreating; - - if (OHIF.lesiontracker.removeMeasurementIfInvalid(measurementData, eventData)) { - return; - } - - const getHandlePosition = key => _.pick(measurementData.handles[key], ['x', 'y']); - const start = getHandlePosition('start'); - const end = getHandlePosition('end'); - const getDirection = axis => start[axis] < end[axis] ? 1 : -1; - const position = OHIF.cornerstone.pixelToPage(eventData.element, end); - - OHIF.measurements.toggleLabelButton({ - measurement: measurementData, - element: eventData.element, - measurementApi: OHIF.viewer.measurementApi, - position: position, - direction: { - x: getDirection('x'), - y: getDirection('y') - } - }); - }; - - const callbackConfig = { - // TODO: Check the position for these, the Add Label button position seems very awkward - getMeasurementLocationCallback: toggleLabel, - changeMeasurementLocationCallback: toggleLabel, - }; - - // TODO: Reconcile this with the configuration in toolManager it would be better to have this - // all in one place. - const appendConfig = toolType => { - const tool = cornerstoneTools[toolType]; - const toolConfig = tool.getConfiguration(); - const config = Object.assign({}, toolConfig, callbackConfig); - - tool.setConfiguration(config); - }; - - // Append the callback configuration to bidirectional tool - appendConfig('bidirectional'); - - // Append the callback configuration to CR and UN tools - appendConfig('targetCR'); - appendConfig('targetUN'); -}; diff --git a/Packages/ohif-lesiontracker/client/lib/index.js b/Packages/ohif-lesiontracker/client/lib/index.js deleted file mode 100644 index 3b3f7f3ce..000000000 --- a/Packages/ohif-lesiontracker/client/lib/index.js +++ /dev/null @@ -1,12 +0,0 @@ -// StudyList-related functions -import './studylist/studylistModification.js'; - -// Bidirectional tool utility functions -import './bidirectional'; - -// Library functions -import './pixelSpacingAutorunCheck.js'; -import './removeMeasurementIfInvalid.js'; -import './toggleLesionTrackerTools.js'; -import './clearMeasurementTimepointData.js'; -import './configureTargetToolsHandles.js'; diff --git a/Packages/ohif-lesiontracker/client/lib/pixelSpacingAutorunCheck.js b/Packages/ohif-lesiontracker/client/lib/pixelSpacingAutorunCheck.js deleted file mode 100644 index 552bc90fd..000000000 --- a/Packages/ohif-lesiontracker/client/lib/pixelSpacingAutorunCheck.js +++ /dev/null @@ -1,40 +0,0 @@ -import { Session } from 'meteor/session'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.lesiontracker.pixelSpacingAutorunCheck = () => { - OHIF.log.info('lesionTool button change autorun'); - - // Get oncology tools - const $oncologyTools = $('button#lesion, button#nonTarget'); - - // TODO: Set activeViewport for empty viewport element - const activeViewportIndex = Session.get('activeViewport'); - if (activeViewportIndex === undefined) { - return; - } - - const element = $('.imageViewerViewport').get(activeViewportIndex); - if (!element) { - return; - } - - let enabledElement; - try { - enabledElement = cornerstone.getEnabledElement(element); - } catch(error) { - return; - } - - // Check value of rowPixelSpacing & columnPixelSpacing to define as unavailable - if (!enabledElement || - !enabledElement.image || - !enabledElement.image.rowPixelSpacing || - !enabledElement.image.columnPixelSpacing) { - // Disable Lesion Buttons - $oncologyTools.prop('disabled', true); - } else { - // Enable Lesion Buttons - $oncologyTools.prop('disabled', false); - } - -}; diff --git a/Packages/ohif-lesiontracker/client/lib/removeMeasurementIfInvalid.js b/Packages/ohif-lesiontracker/client/lib/removeMeasurementIfInvalid.js deleted file mode 100644 index 32aa46db5..000000000 --- a/Packages/ohif-lesiontracker/client/lib/removeMeasurementIfInvalid.js +++ /dev/null @@ -1,16 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; - -OHIF.lesiontracker.removeMeasurementIfInvalid = (measurementData, eventData) => { - const handles = measurementData.handles; - const start = _.pick(handles.start, ['x', 'y']); - const end = _.pick(handles.end, ['x', 'y']); - const element = eventData.element; - const toolType = measurementData.toolType; - if (_.isEqual(start, end)) { - cornerstoneTools.removeToolState(element, toolType, measurementData); - return true; - } - - return false; -}; diff --git a/Packages/ohif-lesiontracker/client/lib/studylist/studylistModification.js b/Packages/ohif-lesiontracker/client/lib/studylist/studylistModification.js deleted file mode 100644 index 03d81b1c4..000000000 --- a/Packages/ohif-lesiontracker/client/lib/studylist/studylistModification.js +++ /dev/null @@ -1,31 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Router } from 'meteor/clinical:router'; -import { OHIF } from 'meteor/ohif:core'; - -Meteor.startup(function() { - if (!OHIF.studylist) return; - - OHIF.studylist.callbacks.dblClickOnStudy = dblClickOnStudy; - OHIF.studylist.callbacks.middleClickOnStudy = dblClickOnStudy; - - OHIF.studylist.timepointApi = new OHIF.measurements.TimepointApi(); -}); - -/** - * Lesion Tracker method including Timepoints / other studies - */ -const dblClickOnStudy = data => { - // Find the relevant timepoint given the clicked-on study - const timepointApi = OHIF.studylist.timepointApi; - if (!timepointApi) { - OHIF.log.warn('No timepoint api on dbl-clicked study?'); - return; - } - - const timepoint = timepointApi.study(data.studyInstanceUid)[0]; - if (timepoint) { - Router.go('viewerTimepoint', { timepointId: timepoint.timepointId }); - } else { - Router.go('viewerStudies', { studyInstanceUids: data.studyInstanceUid }); - } -}; diff --git a/Packages/ohif-lesiontracker/client/lib/toggleLesionTrackerTools.js b/Packages/ohif-lesiontracker/client/lib/toggleLesionTrackerTools.js deleted file mode 100644 index 050f00003..000000000 --- a/Packages/ohif-lesiontracker/client/lib/toggleLesionTrackerTools.js +++ /dev/null @@ -1,83 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -/** - * Show / hide lesion tracker tools - */ - -let previousStates; -let previousActiveTool; - -let toolsShown = true; - -OHIF.lesiontracker.toggleLesionTrackerTools = () => { - const toolManager = Viewerbase.toolManager; - - if (toolsShown === true) { - // Save the current settings for later - previousStates = toolManager.getToolDefaultStates(); - previousActiveTool = toolManager.getActiveTool(); - - // Hide the tools (set them all to disabled) - const toolDefaultStates = { - activate: ['deleteLesionKeyboardTool'], - deactivate: [], - enable: [], - disable: ['bidirectional', 'nonTarget', 'length', 'targetCR', 'targetUN'] - }; - - toolManager.setToolDefaultStates(toolDefaultStates); - - // Using setActiveTool with no arguments activates the - // default tool on all available viewports - toolManager.setActiveTool(); - - toolsShown = false; - } else { - // Show the tools (reload previous states) - toolManager.setToolDefaultStates(previousStates); - - // Using setActiveTool with no elements specified activates - // the specified tool on all available viewports - toolManager.setActiveTool(previousActiveTool); - - toolsShown = true; - } -}; - -OHIF.lesiontracker.toggleLesionTrackerToolsButtons = (isEnabled) => { - const toolManager = Viewerbase.toolManager; - const toolStates = previousStates || toolManager.getToolDefaultStates(); - - if (isEnabled) { - toolStates.disabledToolButtons = []; - OHIF.lesiontracker.toggleLesionTrackerToolsHotKeys(true); - } else { - toolStates.disabledToolButtons = ['bidirectional', 'nonTarget', 'targetCR', 'targetUN', - 'toggleHUD', 'toggleTrial', 'toolbarSectionEntry', 'toggleMeasurements']; - OHIF.lesiontracker.toggleLesionTrackerToolsHotKeys(false); - } - - // Reload the updated previous or default states - toolManager.setToolDefaultStates(toolStates); - - // Reset the active tool if disabled - if (!isEnabled) { - toolManager.setActiveTool(); - } -}; - -OHIF.lesiontracker.toggleLesionTrackerToolsHotKeys = (isEnabled) => { - // The hotkey can also be an array (e.g. ["NUMPAD0", "0"]) - OHIF.viewer.defaultHotkeys = OHIF.viewer.defaultHotkeys || {}; - - if (isEnabled) { - OHIF.viewer.defaultHotkeys.toggleLesionTrackerTools = 'O'; - OHIF.viewer.defaultHotkeys.bidirectional = 'T'; // Target - OHIF.viewer.defaultHotkeys.nonTarget = 'N'; // Non-target - } else { - OHIF.viewer.defaultHotkeys.toggleLesionTrackerTools = null; - OHIF.viewer.defaultHotkeys.bidirectional = null; // Target - OHIF.viewer.defaultHotkeys.nonTarget = null; // Non-target - } -}; diff --git a/Packages/ohif-lesiontracker/client/tools.js b/Packages/ohif-lesiontracker/client/tools.js deleted file mode 100644 index 110fe91d8..000000000 --- a/Packages/ohif-lesiontracker/client/tools.js +++ /dev/null @@ -1,51 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -Meteor.startup(function() { - const toolManager = Viewerbase.toolManager; - - toolManager.addTool('bidirectional', { - mouse: cornerstoneTools.bidirectional, - touch: cornerstoneTools.bidirectionalTouch - }); - - toolManager.addTool('nonTarget', { - mouse: cornerstoneTools.nonTarget, - touch: cornerstoneTools.nonTargetTouch - }); - - toolManager.addTool('deleteLesionKeyboardTool', { - mouse: cornerstoneTools.deleteLesionKeyboardTool, - touch: cornerstoneTools.deleteLesionKeyboardTool - }); - - toolManager.addTool('targetCR', { - mouse: cornerstoneTools.targetCR, - touch: cornerstoneTools.targetCRTouch - }); - - toolManager.addTool('targetUN', { - mouse: cornerstoneTools.targetUN, - touch: cornerstoneTools.targetUNTouch - }); - - // Update default state for tools making sure each tool is only inserted once - let currentDefaultStates = toolManager.getToolDefaultStates(); - let newDefaultStates = { - enable: [], - deactivate: ['bidirectional', 'nonTarget', 'length', 'targetCR', 'targetUN'], - activate: ['deleteLesionKeyboardTool'] - }; - - Object.keys(newDefaultStates).forEach(state => { - newDefaultStates[state].forEach(tool => { - let tools = currentDefaultStates[state]; - // make sure each tool is only inserted once - if (tools && tools.indexOf(tool) < 0) { - tools.push(tool); - } - }); - }); - - toolManager.setToolDefaultStates(currentDefaultStates); -}); diff --git a/Packages/ohif-lesiontracker/package.js b/Packages/ohif-lesiontracker/package.js deleted file mode 100644 index 8e63f1572..000000000 --- a/Packages/ohif-lesiontracker/package.js +++ /dev/null @@ -1,36 +0,0 @@ -Package.describe({ - name: 'ohif:lesiontracker', - summary: 'OHIF Lesion Tracker Tools', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('standard-app-packages'); - api.use('jquery'); - api.use('stylus'); - api.use('random'); - - // Template overriding - api.use('aldeed:template-extension@4.0.0'); - - // Our custom packages - api.use('ohif:design'); - api.use('ohif:cornerstone'); - api.use('ohif:core'); - api.use('ohif:cornerstone-settings'); - api.use('ohif:studies'); - api.use('ohif:measurements'); - - api.addFiles('both/index.js', [ 'client', 'server' ]); - - api.addFiles('server/index.js', 'server'); - - api.addFiles('client/index.js', 'client'); - - // Export client-side collections - api.export('LesionLocations', 'client'); - api.export('LocationResponses', 'client'); -}); diff --git a/Packages/ohif-lesiontracker/server/index.js b/Packages/ohif-lesiontracker/server/index.js deleted file mode 100644 index 29f8469d2..000000000 --- a/Packages/ohif-lesiontracker/server/index.js +++ /dev/null @@ -1 +0,0 @@ -import './methods.js'; diff --git a/Packages/ohif-lesiontracker/server/methods.js b/Packages/ohif-lesiontracker/server/methods.js deleted file mode 100644 index 92c9819ba..000000000 --- a/Packages/ohif-lesiontracker/server/methods.js +++ /dev/null @@ -1,128 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Mongo } from 'meteor/mongo'; -import { OHIF } from 'meteor/ohif:core'; -import { measurementTools } from 'meteor/ohif:lesiontracker/both/configuration/measurementTools'; - -let MeasurementCollections = {}; -measurementTools.forEach(tool => { - MeasurementCollections[tool.id] = new Mongo.Collection(tool.id); - MeasurementCollections[tool.id]._debugName = tool.id; -}); - -const Timepoints = new Mongo.Collection('timepoints'); -Timepoints._debugName = 'Timepoints'; - -Meteor.publish('timepoints', function() { - return Timepoints.find(); -}); - -// TODO: Make storage use update instead of clearing the entire collection and -// re-inserting everything. -Meteor.methods({ - storeTimepoints(timepoints) { - OHIF.log.info('Storing Timepoints on the Server'); - OHIF.log.info(JSON.stringify(timepoints, null, 2)); - Timepoints.remove({}); - timepoints.forEach(timepoint => { - delete timepoint._id; - Timepoints.insert(timepoint); - }); - }, - - disassociateStudy(timepointIds, studyInstanceUid) { - OHIF.log.info('Disassociating Study from Timepoints'); - timepointIds.forEach(timepointId => { - const timepoint = Timepoints.findOne({ timepointId }); - if (!timepoint) { - return; - } - - // Find the index of the current studyInstanceUid in the array - // of reference studyInstanceUids - const index = timepoint.studyInstanceUids.indexOf(studyInstanceUid); - if (index < 0) { - return; - } - - // Remove the specified studyInstanceUid from the array of associated studyInstanceUids - timepoint.studyInstanceUids.splice(index, 1); - - if (timepoint.studyInstanceUids.length) { - Timepoints.update(timepoint._id, { - $set: { - studyInstanceUids: timepoint.studyInstanceUids - } - }); - } else { - Timepoints.remove(timepoint._id); - } - - // Remove all Measurement Data for this timepoint and study - measurementTools.forEach(tool => { - const filter = { - studyInstanceUid: studyInstanceUid, - timepointId: timepointId - }; - - MeasurementCollections[tool.id].remove(filter); - }); - }); - }, - - removeTimepoint(timepointId) { - OHIF.log.info('Removing Timepoint from the Server'); - Timepoints.remove({ timepointId }); - }, - - updateTimepoint(timepointData, query) { - OHIF.log.info('Updating Timepoint on the Server'); - OHIF.log.info(JSON.stringify(timepointData, null, 2)); - OHIF.log.info(JSON.stringify(query, null, 2)); - Timepoints.update(timepointData, query); - }, - - retrieveTimepoints(filter={}) { - OHIF.log.info('Retrieving Timepoints from the Server'); - return Timepoints.find(filter).fetch(); - }, - - storeMeasurements(measurementData, filter = {}) { - OHIF.log.info('Storing Measurements on the Server'); - OHIF.log.info(JSON.stringify(measurementData, null, 2)); - - Object.keys(measurementData).forEach(toolId => { - if (!MeasurementCollections[toolId]) { - return; - } - - MeasurementCollections[toolId].remove(filter); - - const measurements = measurementData[toolId]; - measurements.forEach(measurement => { - MeasurementCollections[toolId].insert(measurement); - }); - }); - }, - - retrieveMeasurements(patientId, timepointIds) { - OHIF.log.info('Retrieving Measurements from the Server'); - let measurementData = {}; - - const filter = {}; - if (patientId) { - filter.patientId = patientId; - } - - if (timepointIds) { - filter.timepointId = { - $in: timepointIds - }; - } - - measurementTools.forEach(tool => { - measurementData[tool.id] = MeasurementCollections[tool.id].find(filter).fetch(); - }); - - return measurementData; - } -}); diff --git a/Packages/ohif-log/main.js b/Packages/ohif-log/main.js deleted file mode 100644 index 214a6b5b0..000000000 --- a/Packages/ohif-log/main.js +++ /dev/null @@ -1,28 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; -import loglevel from 'loglevel'; - -const defaultLevel = Meteor.isProduction ? 'ERROR' : 'TRACE'; - -// Create package logger using loglevel -OHIF.log = loglevel.getLogger('OHIF'); -OHIF.log.setLevel(defaultLevel); - -// Add time and timeEnd to OHIF.log namespace -const times = new Map(); - -// Register the time method -OHIF.log.time = givenKey => { - const key = typeof givenKey === 'undefined' ? 'default' : givenKey; - times.set(key, new Date().getTime()); -}; - -// Register the timeEnd method -OHIF.log.timeEnd = givenKey => { - const key = typeof givenKey === 'undefined' ? 'default' : givenKey; - const now = new Date().getTime(); - const last = times.get(key) || now; - times.delete(key); - const duration = now - last; - OHIF.log.info(`${key}: ${duration}ms`); -}; diff --git a/Packages/ohif-log/package.js b/Packages/ohif-log/package.js deleted file mode 100644 index 4ba86b763..000000000 --- a/Packages/ohif-log/package.js +++ /dev/null @@ -1,21 +0,0 @@ -Package.describe({ - name: 'ohif:log', - summary: 'OHIF Logging', - version: '0.0.1' -}); - -Npm.depends({ - loglevel: '1.4.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('standard-app-packages'); - - // Our custom packages - api.use('ohif:core'); - - api.addFiles('main.js', [ 'client', 'server' ]); -}); diff --git a/Packages/ohif-measurement-table/client/configuration/configuration.js b/Packages/ohif-measurement-table/client/configuration/configuration.js deleted file mode 100644 index 20c6ac54b..000000000 --- a/Packages/ohif-measurement-table/client/configuration/configuration.js +++ /dev/null @@ -1,27 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -import { measurementTools } from './measurementTools'; -import { retrieveMeasurements, storeMeasurements, retrieveTimepoints, storeTimepoints, removeTimepoint, updateTimepoint, disassociateStudy } from './dataExchange'; - -export const configureApis = () => { - OHIF.measurements.MeasurementApi.setConfiguration({ - measurementTools, - dataExchange: { - retrieve: retrieveMeasurements, - store: storeMeasurements - }, - dataValidation: { - validation: () => {} - } - }); - - OHIF.measurements.TimepointApi.setConfiguration({ - dataExchange: { - retrieve: retrieveTimepoints, - store: storeTimepoints, - remove: removeTimepoint, - update: updateTimepoint, - disassociate: disassociateStudy - } - }); -}; diff --git a/Packages/ohif-measurement-table/client/configuration/dataExchange.js b/Packages/ohif-measurement-table/client/configuration/dataExchange.js deleted file mode 100644 index 9bcc1b880..000000000 --- a/Packages/ohif-measurement-table/client/configuration/dataExchange.js +++ /dev/null @@ -1,64 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { retrieveMeasurementFromSR, stowSRFromMeasurements } from '../utils/handleSR'; -import { getLatestSRSeries } from '../utils/srUtils'; - -export const retrieveMeasurements = (patientId, timepointIds) => { - OHIF.log.info('retrieveMeasurements'); - - const latestSeries = getLatestSRSeries(); - - if(!latestSeries) return Promise.resolve({}); - - return retrieveMeasurementFromSR(latestSeries); -}; - -export const storeMeasurements = (measurementData, timepointIds) => { - OHIF.log.info('storeMeasurements'); - - const server = OHIF.servers.getCurrentServer(); - if (!server || server.type !== 'dicomWeb') { - return Promise.resolve({}); - } - - const studyInstanceUid = measurementData[Object.keys(measurementData)[0]][0].studyInstanceUid - - return stowSRFromMeasurements(measurementData).then( () => { - OHIF.studies.deleteStudyMetadataPromise(studyInstanceUid); - }, error => { - throw new Error(error); - }); -}; - -export const retrieveTimepoints = filter => { - const studyInstanceUids = OHIF.viewer.StudyMetadataList.all().map(study => study.getStudyInstanceUID()); - OHIF.log.info('retrieveTimepoints'); - - return Promise.resolve([{ - timepointType: 'baseline', - timepointId: 'TimepointId', - studyInstanceUids, - patientId: filter.patientId, - earliestDate: new Date(), - latestDate: new Date(), - isLocked: false - }]); -}; - -export const storeTimepoints = (timepointData) => { - OHIF.log.info('storeTimepoints'); - return Promise.resolve(); -}; - -export const updateTimepoint = (timepointData, query) => { - OHIF.log.info('updateTimepoint'); - return Promise.resolve(); -}; - -export const removeTimepoint = timepointId => { - OHIF.log.info('removeTimepoint'); - return Promise.resolve(); -}; - -export const disassociateStudy = (timepointIds, studyInstanceUid) => { - return Promise.resolve(); -}; diff --git a/Packages/ohif-measurement-table/client/configuration/measurementTools.js b/Packages/ohif-measurement-table/client/configuration/measurementTools.js deleted file mode 100644 index b1adf7fc5..000000000 --- a/Packages/ohif-measurement-table/client/configuration/measurementTools.js +++ /dev/null @@ -1,21 +0,0 @@ -import { ToolGroupBaseSchema } from '../schema/toolGroupSchema'; -import length from '../schema/length'; -import ellipticalRoi from '../schema/ellipticalRoi'; -import rectangleRoi from '../schema/rectangleRoi'; -import simpleAngle from '../schema/simpleAngle'; -import arrowAnnotate from '../schema/arrowAnnotate'; - -const trackedTools = [ - length, - ellipticalRoi, - rectangleRoi, - simpleAngle, - arrowAnnotate -]; - -export const measurementTools = [{ - id: 'allTools', - name: 'Measurements', - childTools: trackedTools, - schema: ToolGroupBaseSchema -}]; diff --git a/Packages/ohif-measurement-table/client/index.js b/Packages/ohif-measurement-table/client/index.js deleted file mode 100644 index 6e8095097..000000000 --- a/Packages/ohif-measurement-table/client/index.js +++ /dev/null @@ -1,131 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Session } from 'meteor/session'; -import { configureApis } from './configuration/configuration' - -class MeasurementTable { - constructor() { - configureApis(); - - Session.set('TimepointsReady', false); - Session.set('MeasurementsReady', false); - } - - async onCreated(instance) { - const { TimepointApi, MeasurementApi } = OHIF.measurements; - - OHIF.viewer.data.currentTimepointId = 'TimepointId'; - - const timepointApi = new TimepointApi(OHIF.viewer.data.currentTimepointId); - const measurementApi = new MeasurementApi(timepointApi); - const apis = { - timepointApi, - measurementApi - }; - - Object.assign(OHIF.viewer, apis); - Object.assign(instance.data, apis); - - const patientId = instance.data.studies[0].patientId; - - await timepointApi.retrieveTimepoints({ patientId }); - Session.set('TimepointsReady', true); - - await measurementApi.retrieveMeasurements(patientId, [OHIF.viewer.data.currentTimepointId]); - Session.set('MeasurementsReady', false); - - measurementApi.syncMeasurementsAndToolData(); - this.jumpToFirstMeasurement(); - - const viewportUtils = OHIF.viewerbase.viewportUtils; - this.firstMeasurementActivated = false; - this.dataIsavalible = false; - instance.autorun(() => { - if (!Session.get('TimepointsReady') || - !Session.get('MeasurementsReady') || - !Session.get('ViewerReady') || - this.firstMeasurementActivated) { - if (this.dataIsavalible) { - viewportUtils.hideTools(); - this.dataIsavalible = false; - } - return; - } - if(!this.dataIsavalible){ - viewportUtils.unhideTools(); - this.dataIsavalible = true; - } - - }); - - instance.measurementModifiedHandler = _.throttle((event, instance) => { - OHIF.measurements.MeasurementHandlers.onModified(event, instance); - }, 300); - } - - onDestroyed() { - Session.set('TimepointsReady', false); - Session.set('MeasurementsReady', false); - } - - jumpToFirstMeasurement() { - // Find and activate the first measurement by Lesion Number - // NOTE: This is inefficient, we should be using a hanging protocol - // to hang the first measurement's imageId immediately, rather - // than changing images after initial loading... - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - const tools = config.measurementTools[0].childTools; - const firstTool = tools[Object.keys(tools)[0]]; - const measurementTypeId = firstTool.id; - - const collection = OHIF.viewer.measurementApi.tools[measurementTypeId]; - const sorting = { - sort: { - measurementNumber: -1 - } - }; - - const data = collection.find({}, sorting).fetch(); - - // TODO: Clean this up, it's probably an inefficient way to get what we need - const groupObject = _.groupBy(data, m => m.measurementNumber); - - // Reformat the data - const rows = Object.keys(groupObject).map(key => ({ - measurementTypeId: measurementTypeId, - measurementNumber: key, - entries: groupObject[key] - })); - - const rowItem = rows[0]; - const timepoints = [ - OHIF.viewer.timepointApi.current() - ]; - - if (rowItem) { - OHIF.measurements.jumpToRowItem(rowItem, timepoints); - } - - this.firstMeasurementActivated = true; - } - - static measurementEvents = { - 'cornerstonetoolsmeasurementadded .imageViewerViewport'(event, instance) { - const originalEvent = event.originalEvent; - OHIF.measurements.MeasurementHandlers.onAdded(originalEvent, instance); - }, - - 'cornerstonetoolsmeasurementmodified .imageViewerViewport'(event, instance) { - const originalEvent = event.originalEvent; - instance.measurementModifiedHandler(originalEvent, instance); - }, - - 'cornerstonemeasurementremoved .imageViewerViewport'(event, instance) { - const originalEvent = event.originalEvent; - OHIF.measurements.MeasurementHandlers.onRemoved(originalEvent, instance); - } - }; -}; - -export { - MeasurementTable -} diff --git a/Packages/ohif-measurement-table/client/schema/arrowAnnotate.js b/Packages/ohif-measurement-table/client/schema/arrowAnnotate.js deleted file mode 100644 index 9fa71fce4..000000000 --- a/Packages/ohif-measurement-table/client/schema/arrowAnnotate.js +++ /dev/null @@ -1,67 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const handlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - } -}); - -const toolSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: handlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - description: { - type: String, - label: 'Description', - optional: true - }, - toolType: { - type: String, - label: 'Measurement Tool Type', - defaultValue: 'arrowAnnotate' - }, - text: { - type: String, - label: 'text', - optional: true - } -}]); - -const displayFunction = data => { - return data.text || ''; -}; - -export default { - id: 'arrowAnnotate', - name: 'ArrowAnnotate', - toolGroup: 'allTools', - cornerstoneToolType: 'arrowAnnotate', - schema: toolSchema, - options: { - measurementTable: { - displayFunction - } - } -}; diff --git a/Packages/ohif-measurement-table/client/schema/ellipticalRoi.js b/Packages/ohif-measurement-table/client/schema/ellipticalRoi.js deleted file mode 100644 index 6a0326b14..000000000 --- a/Packages/ohif-measurement-table/client/schema/ellipticalRoi.js +++ /dev/null @@ -1,104 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const handlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - }, -}); - -const MeanStdDevSchema = new SimpleSchema({ - count: { - type: Number, - label: 'count', - decimal: true - }, - mean: { - type: Number, - label: 'mean', - decimal: true - }, - stdDev: { - type: Number, - label: 'stdDev', - decimal: true - }, - variance: { - type: Number, - label: 'variance', - decimal: true - } - -}); - -const toolSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: handlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - toolType: { - type: String, - label: 'Measurement Tool Type', - defaultValue: 'ellipticalRoi' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - description: { - type: String, - label: 'Description', - optional: true - }, - area: { - type: Number, - label: 'Ellipse Area value', - decimal: true, - optional: true - }, - meanStdDev: { - type: MeanStdDevSchema, - label: 'MeanStd Values', - optional: true - } -}]); - -const displayFunction = data => { - let meanValue = ''; - if (data.meanStdDev && data.meanStdDev.mean) { - meanValue = data.meanStdDev.mean.toFixed(2) + ' HU'; - } - return meanValue; - // let meanValue = data.meanStdDev && data.meanStdDev.mean || 0; - // return numberWithCommas(meanValue).toFixed(2) + ' HU'; - //return data.meanStdDev.mean.toFixed(2); -}; - -export default { - id: 'ellipticalRoi', - name: 'Ellipse', - toolGroup: 'allTools', - cornerstoneToolType: 'ellipticalRoi', - schema: toolSchema, - options: { - measurementTable: { - displayFunction - } - } -}; diff --git a/Packages/ohif-measurement-table/client/schema/length.js b/Packages/ohif-measurement-table/client/schema/length.js deleted file mode 100644 index 46ffa90ea..000000000 --- a/Packages/ohif-measurement-table/client/schema/length.js +++ /dev/null @@ -1,77 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const handlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - } -}); - -const toolSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: handlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - description: { - type: String, - label: 'Description', - optional: true - }, - toolType: { - type: String, - label: 'Measurement Tool Type', - defaultValue: 'length' - }, - length: { - type: Number, - label: 'Length', - optional: true, - decimal: true - }, - dashed: { - type: String, - label: 'dashed', - optional: true - } -}]); - -const displayFunction = data => { - let lengthValue = ''; - if (data.length) { - lengthValue = data.length.toFixed(2) + ' mm'; - } - return lengthValue; -}; - -export default { - id: 'length', - name: 'Length', - toolGroup: 'allTools', - cornerstoneToolType: 'length', - schema: toolSchema, - options: { - measurementTable: { - displayFunction - } - } -}; diff --git a/Packages/ohif-measurement-table/client/schema/rectangleRoi.js b/Packages/ohif-measurement-table/client/schema/rectangleRoi.js deleted file mode 100644 index 51ddbc0d8..000000000 --- a/Packages/ohif-measurement-table/client/schema/rectangleRoi.js +++ /dev/null @@ -1,101 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const handlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - }, -}); - -const MeanStdDevSchema = new SimpleSchema({ - count: { - type: Number, - label: 'count', - decimal: true - }, - mean: { - type: Number, - label: 'mean', - decimal: true - }, - stdDev: { - type: Number, - label: 'stdDev', - decimal: true - }, - variance: { - type: Number, - label: 'variance', - decimal: true - } - -}); - -const toolSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: handlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - toolType: { - type: String, - label: 'Measurement Tool Type', - defaultValue: 'rectangleRoi' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - description: { - type: String, - label: 'Description', - optional: true - }, - area: { - type: Number, - label: 'Rectangle Area value', - decimal: true, - optional: true - }, - meanStdDev: { - type: MeanStdDevSchema, - label: 'MeanStd Values', - optional: true - } -}]); - -const displayFunction = data => { - let meanValue = ''; - if (data.meanStdDev && data.meanStdDev.mean) { - meanValue = data.meanStdDev.mean.toFixed(2) + ' HU'; - } - return meanValue; -}; - -export default { - id: 'rectangleRoi', - name: 'Rectangle', - toolGroup: 'allTools', - cornerstoneToolType: 'rectangleRoi', - schema: toolSchema, - options: { - measurementTable: { - displayFunction - } - } -}; diff --git a/Packages/ohif-measurement-table/client/schema/simpleAngle.js b/Packages/ohif-measurement-table/client/schema/simpleAngle.js deleted file mode 100644 index f8928aa1f..000000000 --- a/Packages/ohif-measurement-table/client/schema/simpleAngle.js +++ /dev/null @@ -1,76 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; - -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; - -const handlesSchema = new SimpleSchema({ - start: { - type: CornerstoneHandleSchema, - label: 'Start' - }, - middle: { - type: CornerstoneHandleSchema, - label: 'Middle' - }, - end: { - type: CornerstoneHandleSchema, - label: 'End' - }, - textBox: { - type: CornerstoneHandleSchema, - label: 'Text Box' - } -}); - -const toolSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, { - handles: { - type: handlesSchema, - label: 'Handles' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - }, - location: { - type: String, - label: 'Location', - optional: true - }, - description: { - type: String, - label: 'Description', - optional: true - }, - toolType: { - type: String, - label: 'Measurement Tool Type', - defaultValue: 'simpleAngle' - }, - rAngle: { - type: Number, - label: 'Angle', - optional: true, - decimal: true - } -}]); - -const displayFunction = data => { - let text = ''; - if (data.rAngle) { - text = data.rAngle.toFixed(2) + String.fromCharCode(parseInt('00B0', 16)); - } - return text; -}; - -export default { - id: 'simpleAngle', - name: 'SimpleAngle', - toolGroup: 'allTools', - cornerstoneToolType: 'simpleAngle', - schema: toolSchema, - options: { - measurementTable: { - displayFunction - } - } -}; diff --git a/Packages/ohif-measurement-table/client/schema/toolGroupSchema.js b/Packages/ohif-measurement-table/client/schema/toolGroupSchema.js deleted file mode 100644 index 22576a52c..000000000 --- a/Packages/ohif-measurement-table/client/schema/toolGroupSchema.js +++ /dev/null @@ -1,29 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -export const ToolGroupBaseSchema = new SimpleSchema({ - toolId: { - type: String, - label: 'Tool ID', - optional: true - }, - toolItemId: { - type: String, - label: 'Tool Item ID', - optional: true - }, - createdAt: { - type: Date - }, - studyInstanceUid: { - type: String, - label: 'Study Instance UID' - }, - timepointId: { - type: String, - label: 'Timepoint ID' - }, - measurementNumber: { - type: Number, - label: 'Measurement Number' - } -}); diff --git a/Packages/ohif-measurement-table/client/utils/handleSR.js b/Packages/ohif-measurement-table/client/utils/handleSR.js deleted file mode 100644 index 9f9c7e2d9..000000000 --- a/Packages/ohif-measurement-table/client/utils/handleSR.js +++ /dev/null @@ -1,66 +0,0 @@ -import { dcmjs } from 'meteor/ohif:cornerstone'; -import retrieveDataFromSR from './retrieveDataFromSR'; -import retrieveDataFromMeasurements from './retrieveDataFromMeasurements'; - -import DICOMwebClient from 'dicomweb-client'; - -const retrieveMeasurementFromSR = async (series) => { - const server = OHIF.servers.getCurrentServer(); - const url = WADOProxy.convertURL(server.wadoRoot, server); - - const config = { - url, - headers: OHIF.DICOMWeb.getAuthorizationHeader() - }; - - const dicomWeb = new DICOMwebClient.api.DICOMwebClient(config); - - const instance = series.getFirstInstance(); - const options = { - studyInstanceUID: instance.getStudyInstanceUID(), - seriesInstanceUID: instance.getSeriesInstanceUID(), - sopInstanceUID: instance.getSOPInstanceUID(), - }; - - return dicomWeb.retrieveInstance(options).then(retrieveDataFromSR); -}; - -const stowSRFromMeasurements = async (measurements) => { - const server = OHIF.servers.getCurrentServer(); - const url = WADOProxy.convertURL(server.wadoRoot, server); - const dataset = retrieveDataFromMeasurements(measurements); - const { DicomMetaDictionary, DicomDict } = dcmjs.data; - - const meta = { - FileMetaInformationVersion: dataset._meta.FileMetaInformationVersion.Value, - MediaStorageSOPClassUID: dataset.SOPClassUID, - MediaStorageSOPInstanceUID: dataset.SOPInstanceUID, - TransferSyntaxUID: "1.2.840.10008.1.2.1", - ImplementationClassUID: DicomMetaDictionary.uid(), - ImplementationVersionName: "dcmjs-0.0", - }; - - const denaturalized = DicomMetaDictionary.denaturalizeDataset(meta); - const dicomDict = new DicomDict(denaturalized); - - dicomDict.dict = DicomMetaDictionary.denaturalizeDataset(dataset); - - const part10Buffer = dicomDict.write(); - - const config = { - url, - headers: OHIF.DICOMWeb.getAuthorizationHeader() - }; - - const dicomWeb = new DICOMwebClient.api.DICOMwebClient(config); - const options = { - datasets: [part10Buffer] - }; - - return dicomWeb.storeInstances(options); -}; - -export { - retrieveMeasurementFromSR, - stowSRFromMeasurements -} diff --git a/Packages/ohif-measurement-table/client/utils/retrieveDataFromMeasurements.js b/Packages/ohif-measurement-table/client/utils/retrieveDataFromMeasurements.js deleted file mode 100644 index 8ec3061ee..000000000 --- a/Packages/ohif-measurement-table/client/utils/retrieveDataFromMeasurements.js +++ /dev/null @@ -1,27 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { dcmjs } from 'meteor/ohif:cornerstone'; - -export default retrieveDataFromMeasurements = (measurements) => { - const { MeasurementReport } = dcmjs.adapters.Cornerstone; - const { getImageIdForImagePath } = OHIF.viewerbase; - - const toolState = {}; - - Object.keys(measurements).forEach(measurementType => { - const annotations = measurements[measurementType]; - - annotations.forEach(annotation => { - const imageId = getImageIdForImagePath(annotation.imagePath); - toolState[imageId] = toolState[imageId] || {}; - toolState[imageId][annotation.toolType] = toolState[imageId][annotation.toolType] || { - data: [] - }; - - toolState[imageId][annotation.toolType].data.push(annotation); - }); - }) - - const report = MeasurementReport.generateReport(toolState, cornerstone.metaData); - - return report.dataset; -} diff --git a/Packages/ohif-measurement-table/client/utils/retrieveDataFromSR.js b/Packages/ohif-measurement-table/client/utils/retrieveDataFromSR.js deleted file mode 100644 index d5f8e18c4..000000000 --- a/Packages/ohif-measurement-table/client/utils/retrieveDataFromSR.js +++ /dev/null @@ -1,59 +0,0 @@ -import { dcmjs } from 'meteor/ohif:cornerstone'; -import {getAllDisplaySets, getInstanceMetadata} from './srUtils' - -const imagingMeasurementsToMeasurementData = (dataset, displaySets) => { - const { MeasurementReport } = dcmjs.adapters.Cornerstone; - const storedMeasurementByToolType = MeasurementReport.generateToolState(dataset); - const measurementData = {}; - let measurementNumber = 0; - - Object.keys(storedMeasurementByToolType).forEach(toolType => { - const measurements = storedMeasurementByToolType[toolType]; - measurementData[toolType] = []; - - measurements.forEach(measurement => { - const instanceMetadata = getInstanceMetadata(displaySets, measurement.sopInstanceUid); - const imageId = OHIF.viewerbase.getImageId(instanceMetadata); - if (!imageId) { - return; - } - - // TODO: Update the OHIF metadata provider, then switch these to use 'generalSeriesModule' - const study = cornerstone.metaData.get('study', imageId); - const series = cornerstone.metaData.get('series', imageId); - const imagePath = [ - study.studyInstanceUid, - series.seriesInstanceUid, - measurement.sopInstanceUid, - measurement.frameIndex - ].join('_'); - - const toolData = Object.assign({}, measurement, { - imageId, - imagePath, - seriesInstanceUid: series.seriesInstanceUid, - studyInstanceUid: study.studyInstanceUid, - patientId: study.patientId, - measurementNumber: ++measurementNumber, - timepointId: OHIF.viewer.data.currentTimepointId, - toolType, - _id: imageId + measurementNumber, - }); - - measurementData[toolType].push(toolData); - }); - }) - - return measurementData; -}; - -export default retrieveDataFromSR = (Part10SRArrayBuffer) => { - const allDisplaySets = getAllDisplaySets(); - - // Get the dicom data as an Object - const dicomData = dcmjs.data.DicomMessage.readFile(Part10SRArrayBuffer); - const dataset = dcmjs.data.DicomMetaDictionary.naturalizeDataset(dicomData.dict); - - // Convert the SR into the kind of object the Measurements package is expecting - return imagingMeasurementsToMeasurementData(dataset, allDisplaySets); -}; diff --git a/Packages/ohif-measurement-table/client/utils/srUtils.js b/Packages/ohif-measurement-table/client/utils/srUtils.js deleted file mode 100644 index 2d2462059..000000000 --- a/Packages/ohif-measurement-table/client/utils/srUtils.js +++ /dev/null @@ -1,73 +0,0 @@ -import { dcmjs } from 'meteor/ohif:cornerstone'; - -const supportedSopClassUIDs = ['1.2.840.10008.5.1.4.1.1.88.22', '1.2.840.10008.5.1.4.1.1.11.1']; - -const toArray = function(x) { - return (x.constructor.name === "Array" ? x : [x]); -}; - -const codeMeaningEquals = (codeMeaningName) => { - return (contentItem) => { - return contentItem.ConceptNameCodeSequence.CodeMeaning === codeMeaningName; - }; -}; - -const getAllDisplaySets = () => { - const allStudies = OHIF.viewer.Studies.all(); - let allDisplaySets = []; - - allStudies.forEach(study => { - allDisplaySets = allDisplaySets.concat(study.displaySets); - }); - - return allDisplaySets; -}; - - -const getInstanceMetadata = (displaySets, sopInstanceUid) => { - let instance; - - // Use Array.some so that this loop stops when the internal loop - // has found the correct instance - displaySets.some(displaySet => { - // Search the display set to find the instance metadata for - return displaySet.images.find(instanceMetadata => { - if (instanceMetadata._sopInstanceUID === sopInstanceUid) { - instance = instanceMetadata; - - return true; - } - }); - }); - - return instance; -}; - -const getLatestSRSeries = () => { - const allStudies = OHIF.viewer.StudyMetadataList.all(); - let latestSeries; - - allStudies.forEach(study => { - study.getSeries().forEach(series => { - const firstInstance = series.getFirstInstance(); - const sopClassUid = firstInstance._instance.sopClassUid; - - if (supportedSopClassUIDs.includes(sopClassUid)) { - if(!latestSeries) { - latestSeries = series; - } else if (series._data.seriesDate > latestSeries._data.seriesDate || - (series._data.seriesDate === latestSeries._data.seriesDate && series._data.seriesTime > latestSeries._data.seriesTime)) { - latestSeries = series; - } - } - }); - }); - - return latestSeries; -}; - -export { - getAllDisplaySets, - getInstanceMetadata, - getLatestSRSeries -} \ No newline at end of file diff --git a/Packages/ohif-measurement-table/package.js b/Packages/ohif-measurement-table/package.js deleted file mode 100644 index 56ccc93c6..000000000 --- a/Packages/ohif-measurement-table/package.js +++ /dev/null @@ -1,26 +0,0 @@ -Package.describe({ - name: 'ohif:measurement-table', - summary: 'OHIF Measurement table', - version: '0.0.1' -}); - -Npm.depends({ - 'dicomweb-client': '0.4.2', - 'xhr2': '0.1.4' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - - // Our custom packages - api.use('ohif:cornerstone'); - api.use('ohif:core'); - api.use('ohif:cornerstone-settings'); - api.use('ohif:viewerbase'); - api.use('ohif:measurements'); - api.use('ohif:wadoproxy'); - - api.mainModule('client/index.js', 'client'); -}); diff --git a/Packages/ohif-measurements/both/base.js b/Packages/ohif-measurements/both/base.js deleted file mode 100644 index 41b388766..000000000 --- a/Packages/ohif-measurements/both/base.js +++ /dev/null @@ -1,3 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.measurements = {}; diff --git a/Packages/ohif-measurements/both/configuration/index.js b/Packages/ohif-measurements/both/configuration/index.js deleted file mode 100644 index 9f5d9c258..000000000 --- a/Packages/ohif-measurements/both/configuration/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './measurements.js'; -import './timepoints.js'; diff --git a/Packages/ohif-measurements/both/configuration/measurements.js b/Packages/ohif-measurements/both/configuration/measurements.js deleted file mode 100644 index 58d12bace..000000000 --- a/Packages/ohif-measurements/both/configuration/measurements.js +++ /dev/null @@ -1,432 +0,0 @@ -import { Mongo } from 'meteor/mongo'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstoneTools } from 'meteor/ohif:cornerstone'; - -let configuration = {}; - -class MeasurementApi { - static setConfiguration(config) { - _.extend(configuration, config); - } - - static getConfiguration() { - return configuration; - } - - static getToolsGroupsMap() { - const toolsGroupsMap = {}; - configuration.measurementTools.forEach(toolGroup => { - toolGroup.childTools.forEach(tool => (toolsGroupsMap[tool.id] = toolGroup.id)); - }); - return toolsGroupsMap; - } - - constructor(timepointApi) { - if (timepointApi) { - this.timepointApi = timepointApi; - } - - this.toolGroups = {}; - this.tools = {}; - this.toolsGroupsMap = MeasurementApi.getToolsGroupsMap(); - this.changeObserver = new Tracker.Dependency(); - - configuration.measurementTools.forEach(toolGroup => { - const groupCollection = new Mongo.Collection(null); - groupCollection._debugName = toolGroup.name; - groupCollection.attachSchema(toolGroup.schema); - this.toolGroups[toolGroup.id] = groupCollection; - - toolGroup.childTools.forEach(tool => { - const collection = new Mongo.Collection(null); - collection._debugName = tool.name; - collection.attachSchema(tool.schema); - this.tools[tool.id] = collection; - - const addedHandler = measurement => { - let measurementNumber; - - // Get the measurement number - const timepoint = this.timepointApi.timepoints.findOne({ - studyInstanceUids: measurement.studyInstanceUid - }); - - // Preventing errors thrown when non-associated (standalone) study is opened... - // @TODO: Make sure this logic is correct. - if (!timepoint) return; - - const emptyItem = groupCollection.findOne({ - toolId: { $eq: null }, - timepointId: timepoint.timepointId - }); - - if (emptyItem) { - measurementNumber = emptyItem.measurementNumber; - - groupCollection.update({ - timepointId: timepoint.timepointId, - measurementNumber - }, { - $set: { - toolId: tool.id, - toolItemId: measurement._id, - createdAt: measurement.createdAt - } - }); - } else { - measurementNumber = groupCollection.find({ - studyInstanceUid: { $in: timepoint.studyInstanceUids } - }).count() + 1; - } - - measurement.measurementNumber = measurementNumber; - - // Get the current location/description (if already defined) - const updateObject = { - timepointId: timepoint.timepointId, - measurementNumber - }; - const baselineTimepoint = timepointApi.baseline(); - const baselineGroupEntry = groupCollection.findOne({ - timepointId: baselineTimepoint.timepointId - }); - if (baselineGroupEntry) { - const tool = this.tools[baselineGroupEntry.toolId]; - const found = tool.findOne({ measurementNumber }); - if (found) { - updateObject.location = found.location; - if (found.description) { - updateObject.description = found.description; - } - } - } - - // Set the timepoint ID, measurement number, location and description - collection.update(measurement._id, { $set: updateObject }); - - if (!emptyItem) { - // Reflect the entry in the tool group collection - groupCollection.insert({ - toolId: tool.id, - toolItemId: measurement._id, - timepointId: timepoint.timepointId, - studyInstanceUid: measurement.studyInstanceUid, - createdAt: measurement.createdAt, - measurementNumber - }); - } - - // Enable reactivity - this.changeObserver.changed(); - }; - - const changedHandler = measurement => { - this.changeObserver.changed(); - }; - - const removedHandler = measurement => { - const measurementNumber = measurement.measurementNumber; - - groupCollection.update({ - toolItemId: measurement._id - }, { - $set: { - toolId: null, - toolItemId: null - } - }); - - const nonEmptyItem = groupCollection.findOne({ - measurementNumber, - toolId: { $not: null } - }); - - if (nonEmptyItem) { - return; - } - - const groupItems = groupCollection.find({ measurementNumber }).fetch(); - - groupItems.forEach(groupItem => { - // Remove the record from the tools group collection too - groupCollection.remove({ _id: groupItem._id }); - - // Update the measurement numbers only if it is last item - const timepoint = this.timepointApi.timepoints.findOne({ - timepointId: groupItem.timepointId - }); - - const filter = { - studyInstanceUid: { $in: timepoint.studyInstanceUids }, - measurementNumber - }; - - const remainingItems = groupCollection.find(filter).count(); - if (!remainingItems) { - filter.measurementNumber = { $gte: measurementNumber }; - const operator = { - $inc: { measurementNumber: -1 } - }; - const options = { multi: true }; - groupCollection.update(filter, operator, options); - toolGroup.childTools.forEach(childTool => { - const collection = this.tools[childTool.id]; - collection.update(filter, operator, options); - }); - } - }); - - // Synchronize the new tool data - this.syncMeasurementsAndToolData(); - - // Enable reactivity - this.changeObserver.changed(); - }; - - collection.find().observe({ - added: addedHandler, - changed: changedHandler, - removed: removedHandler - }); - }); - }); - } - - retrieveMeasurements(patientId, timepointIds) { - const retrievalFn = configuration.dataExchange.retrieve; - if (!_.isFunction(retrievalFn)) { - return; - } - - return new Promise((resolve, reject) => { - retrievalFn(patientId, timepointIds).then(measurementData => { - - OHIF.log.info('Measurement data retrieval'); - OHIF.log.info(measurementData); - - const toolsGroupsMap = MeasurementApi.getToolsGroupsMap(); - const measurementsGroups = {}; - - Object.keys(measurementData).forEach(measurementTypeId => { - const measurements = measurementData[measurementTypeId]; - - measurements.forEach(measurement => { - const { toolType } = measurement; - if (toolType && this.tools[toolType]) { - delete measurement._id; - const toolGroup = toolsGroupsMap[toolType]; - if (!measurementsGroups[toolGroup]) { - measurementsGroups[toolGroup] = []; - } - - measurementsGroups[toolGroup].push(measurement); - } - }); - }); - - Object.keys(measurementsGroups).forEach(groupKey => { - const group = measurementsGroups[groupKey]; - group.sort((a, b) => { - if (a.measurementNumber > b.measurementNumber) { - return 1; - } else if (a.measurementNumber < b.measurementNumber) { - return -1; - } - - return 0; - }); - - group.forEach(m => this.tools[m.toolType].insert(m)); - }); - - resolve(); - }); - }); - } - - storeMeasurements(timepointId) { - const storeFn = configuration.dataExchange.store; - if (!_.isFunction(storeFn)) { - return; - } - - let measurementData = {}; - configuration.measurementTools.forEach(toolGroup => { - toolGroup.childTools.forEach(tool => { - if (!measurementData[toolGroup.id]) { - measurementData[toolGroup.id] = []; - } - - measurementData[toolGroup.id] = measurementData[toolGroup.id].concat(this.tools[tool.id].find().fetch()); - }); - }); - - const timepointFilter = timepointId ? { timepointId } : {}; - const timepoints = this.timepointApi.all(timepointFilter); - const timepointIds = timepoints.map(t => t.timepointId); - const patientId = timepoints[0].patientId; - const filter = { - patientId, - timepointId: { - $in: timepointIds - } - }; - - OHIF.log.info('Saving Measurements for timepoints:', timepoints); - return storeFn(measurementData, filter).then(() => { - OHIF.log.info('Measurement storage completed'); - }); - } - - validateMeasurements() { - const validateFn = configuration.dataValidation.validateMeasurements; - if (validateFn && validateFn instanceof Function) { - validateFn(); - } - } - - syncMeasurementsAndToolData() { - configuration.measurementTools.forEach(toolGroup => { - toolGroup.childTools.forEach(tool => { - const measurements = this.tools[tool.id].find().fetch(); - measurements.forEach(measurement => { - OHIF.measurements.syncMeasurementAndToolData(measurement); - }); - }); - }); - } - - sortMeasurements(baselineTimepointId) { - const tools = configuration.measurementTools; - - const includedTools = tools.filter(tool => { - return (tool.options && tool.options.caseProgress && tool.options.caseProgress.include); - }); - - // Update Measurement the displayed Measurements - includedTools.forEach(tool => { - const collection = this.tools[tool.id]; - const measurements = collection.find().fetch(); - measurements.forEach(measurement => { - OHIF.measurements.syncMeasurementAndToolData(measurement); - }); - }); - } - - deleteMeasurements(measurementTypeId, filter) { - const groupCollection = this.toolGroups[measurementTypeId]; - - // Stop here if it is a temporary toolGroups - if (!groupCollection) return; - - // Get the entries information before removing them - const groupItems = groupCollection.find(filter).fetch(); - const entries = []; - groupItems.forEach(groupItem => { - if (!groupItem.toolId) { - return; - } - - const collection = this.tools[groupItem.toolId]; - entries.push(collection.findOne(groupItem.toolItemId)); - collection.remove(groupItem.toolItemId); - }); - - // Stop here if no entries were found - if (!entries.length) { - return; - } - - // If the filter doesn't have the measurement number, get it from the first entry - const measurementNumber = filter.measurementNumber || entries[0].measurementNumber; - - // Synchronize the new data with cornerstone tools - const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.saveToolState(); - - _.each(entries, entry => { - const measurementsData = []; - const { tool } = OHIF.measurements.getToolConfiguration(entry.toolType); - if (Array.isArray(tool.childTools)) { - tool.childTools.forEach(key => { - const childMeasurement = entry[key]; - if (!childMeasurement) return; - measurementsData.push(childMeasurement); - }); - } else { - measurementsData.push(entry); - } - - measurementsData.forEach(measurementData => { - const { imagePath, toolType } = measurementData; - const imageId = OHIF.viewerbase.getImageIdForImagePath(imagePath); - if (toolState[imageId]) { - const toolData = toolState[imageId][toolType]; - const measurementEntries = toolData && toolData.data; - const measurementEntry = _.findWhere(measurementEntries, { _id: entry._id }); - if (measurementEntry) { - const index = measurementEntries.indexOf(measurementEntry); - measurementEntries.splice(index, 1); - } - } - }); - }); - - cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(toolState); - - // Synchronize the updated measurements with Cornerstone Tools - // toolData to make sure the displayed measurements show 'Target X' correctly - const syncFilter = _.clone(filter); - delete syncFilter.timepointId; - - syncFilter.measurementNumber = { - $gt: measurementNumber - 1 - }; - - const toolTypes = _.uniq(entries.map(entry => entry.toolType)); - toolTypes.forEach(toolType => { - const collection = this.tools[toolType]; - collection.find(syncFilter).forEach(measurement => { - OHIF.measurements.syncMeasurementAndToolData(measurement); - }); - }); - } - - getMeasurementById(measurementId) { - let foundGroup; - _.find(this.toolGroups, toolGroup => { - foundGroup = toolGroup.findOne({ toolItemId: measurementId }); - return !!foundGroup; - }); - - // Stop here if no group was found or if the record is a placeholder - if (!foundGroup || !foundGroup.toolId) { - return; - } - - return this.tools[foundGroup.toolId].findOne(measurementId); - } - - fetch(toolGroupId, selector, options) { - if (!this.toolGroups[toolGroupId]) { - throw 'MeasurementApi: No Collection with the id: ' + toolGroupId; - } - - selector = selector || {}; - options = options || {}; - const result = []; - const items = this.toolGroups[toolGroupId].find(selector, options).fetch(); - items.forEach(item => { - if (item.toolId) { - result.push(this.tools[item.toolId].findOne(item.toolItemId)); - } else { - result.push({ measurementNumber: item.measurementNumber }); - } - - }); - return result; - } -} - -OHIF.measurements.MeasurementApi = MeasurementApi; diff --git a/Packages/ohif-measurements/both/configuration/timepoints.js b/Packages/ohif-measurements/both/configuration/timepoints.js deleted file mode 100644 index 2849d2383..000000000 --- a/Packages/ohif-measurements/both/configuration/timepoints.js +++ /dev/null @@ -1,306 +0,0 @@ -import { Mongo } from 'meteor/mongo'; -import { _ } from 'meteor/underscore'; - -import { OHIF } from 'meteor/ohif:core'; - -import { schema as TimepointSchema } from 'meteor/ohif:measurements/both/schema/timepoints'; - -const configuration = {}; - -class TimepointApi { - static setConfiguration(config) { - _.extend(configuration, config); - } - - static getConfiguration() { - return configuration; - } - - constructor(currentTimepointId, options={}) { - if (currentTimepointId) { - this.currentTimepointId = currentTimepointId; - } - - this.options = options; - this.timepoints = new Mongo.Collection(null); - this.timepoints.attachSchema(TimepointSchema); - this.timepoints._debugName = 'Timepoints'; - } - - retrieveTimepoints(filter) { - const retrievalFn = configuration.dataExchange.retrieve; - if (!_.isFunction(retrievalFn)) { - OHIF.log.error('Timepoint retrieval function has not been configured.'); - return; - } - - return new Promise((resolve, reject) => { - retrievalFn(filter).then(timepointData => { - OHIF.log.info('Timepoint data retrieval'); - - _.each(timepointData, timepoint => { - delete timepoint._id; - const query = { - timepointId: timepoint.timepointId - }; - - this.timepoints.update(query, { - $set: timepoint - }, { - upsert: true - }); - }); - - resolve(); - }).catch(reason => { - OHIF.log.error(`Timepoint retrieval function failed: ${reason}`); - reject(reason); - }); - }); - } - - storeTimepoints() { - const storeFn = configuration.dataExchange.store; - if (!_.isFunction(storeFn)) { - return; - } - - const timepointData = this.timepoints.find().fetch(); - OHIF.log.info('Preparing to store timepoints'); - OHIF.log.info(JSON.stringify(timepointData, null, 2)); - - storeFn(timepointData).then(() => OHIF.log.info('Timepoint storage completed')); - } - - disassociateStudy(timepointIds, studyInstanceUid) { - const disassociateFn = configuration.dataExchange.disassociate; - disassociateFn(timepointIds, studyInstanceUid).then(() => { - OHIF.log.info('Disassociation completed'); - - this.timepoints.remove({}); - this.retrieveTimepoints({}); - }); - } - - removeTimepoint(timepointId) { - const removeFn = configuration.dataExchange.remove; - if (!_.isFunction(removeFn)) { - return; - } - - const timepointData = { - timepointId - }; - - OHIF.log.info('Preparing to remove timepoint'); - OHIF.log.info(JSON.stringify(timepointData, null, 2)); - - removeFn(timepointData).then(() => { - OHIF.log.info('Timepoint removal completed'); - this.timepoints.remove(timepointData); - }); - } - - updateTimepoint(timepointId, query) { - const updateFn = configuration.dataExchange.update; - if (!_.isFunction(updateFn)) { - return; - } - - const timepointData = { - timepointId - }; - - OHIF.log.info('Preparing to update timepoint'); - OHIF.log.info(JSON.stringify(timepointData, null, 2)); - OHIF.log.info(JSON.stringify(query, null, 2)); - - updateFn(timepointData, query).then(() => { - OHIF.log.info('Timepoint updated completed'); - this.timepoints.update(timepointData, query); - }); - } - - // Return all timepoints - all(filter={}) { - return this.timepoints.find(filter, { - sort: { - latestDate: -1 - }, - }).fetch(); - } - - // Return only the current timepoint - current() { - return this.timepoints.findOne({ timepointId: this.currentTimepointId }); - } - - lock() { - const current = this.current(); - if (!current) { - return; - } - - this.timepoints.update(current._id, { - $set: { - locked: true - } - }); - } - - // Return the prior timepoint - prior() { - const current = this.current(); - if (!current) { - return; - } - - const latestDate = current.latestDate; - return this.timepoints.findOne({ - latestDate: { $lt: latestDate } - }, { - sort: { latestDate: -1 } - }); - } - - // Return only the current and prior timepoints - currentAndPrior() { - const timepoints = []; - - const current = this.current(); - if (current) { - timepoints.push(current); - } - - const prior = this.prior(); - if (current && prior && prior._id !== current._id) { - timepoints.push(prior); - } - - return timepoints; - } - - // Return only the comparison timepoints - comparison() { - return this.currentAndPrior(); - } - - // Return only the baseline timepoint - baseline() { - return this.timepoints.findOne({ timepointType: 'baseline' }); - } - - // Return only the nadir timepoint - nadir() { - const timepoint = this.timepoints.findOne({ timepointKey: 'nadir' }); - return timepoint || this.baseline(); - } - - // Return only the key timepoints (current, prior, nadir and baseline) - key(filter={}) { - const result = []; - - // Get all the timepoints - const all = this.all(filter); - - // Iterate over each timepoint and insert the key ones in the result - _.each(all, (timepoint, index) => { - if (index < 2 || index === (all.length - 1)) { - result.push(timepoint); - } - }); - - // Return the resulting timepoints - return result; - } - - // Return only the timepoints for the given study - study(studyInstanceUid) { - const result = []; - - // Iterate over each timepoint and insert the key ones in the result - _.each(this.all(), (timepoint, index) => { - if (_.contains(timepoint.studyInstanceUids, studyInstanceUid)) { - result.push(timepoint); - } - }); - - // Return the resulting timepoints - return result; - } - - // Return the timepoint's name - name(timepoint) { - // Check if this is a Baseline timepoint, if it is, return 'Baseline' - if (timepoint.timepointType === 'baseline') { - return 'Baseline'; - } else if (timepoint.visitNumber) { - return 'Follow-up ' + timepoint.visitNumber; - } - - // Retrieve all of the relevant follow-up timepoints for this patient - const followupTimepoints = this.timepoints.find({ - patientId: timepoint.patientId, - timepointType: timepoint.timepointType - }, { - sort: { - latestDate: 1 - } - }); - - // Create an array of just timepointIds, so we can use indexOf - // on it to find the current timepoint's relative position - const followupTimepointIds = followupTimepoints.map(timepoint => timepoint.timepointId); - - // Calculate the index of the current timepoint in the array of all - // relevant follow-up timepoints - const index = followupTimepointIds.indexOf(timepoint.timepointId) + 1; - - // If index is 0, it means that the current timepoint was not in the list - // Log a warning and return here - if (!index) { - OHIF.log.warn('Current follow-up was not in the list of relevant follow-ups?'); - return; - } - - // Return the timepoint name as 'Follow-up N' - return 'Follow-up ' + index; - } - - // Build the timepoint title based on its date - title(timepoint) { - const timepointName = this.name(timepoint); - - const all = _.clone(this.all()); - let index = -1; - let currentIndex = null; - for (let i = 0; i < all.length; i++) { - const currentTimepoint = all[i]; - - // Skip the iterations until we can't find the selected timepoint on study list - if (this.currentTimepointId === currentTimepoint.timepointId) { - currentIndex = 0; - } - - if (_.isNumber(currentIndex)) { - index = currentIndex++; - } - - // Break the loop if reached the timepoint to get the title - if (currentTimepoint.timepointId === timepoint.timepointId) { - break; - } - } - - const states = { - 0: '(Current)', - 1: '(Prior)' - }; - // TODO: [design] find out how to define the nadir timepoint - const parenthesis = states[index] || ''; - return `${timepointName} ${parenthesis}`; - } - -} - -OHIF.measurements.TimepointApi = TimepointApi; diff --git a/Packages/ohif-measurements/both/index.js b/Packages/ohif-measurements/both/index.js deleted file mode 100644 index d0a9ec97f..000000000 --- a/Packages/ohif-measurements/both/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './base.js'; -import './configuration'; -import './schema'; diff --git a/Packages/ohif-measurements/both/schema/index.js b/Packages/ohif-measurements/both/schema/index.js deleted file mode 100644 index 9f5d9c258..000000000 --- a/Packages/ohif-measurements/both/schema/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './measurements.js'; -import './timepoints.js'; diff --git a/Packages/ohif-measurements/both/schema/measurements.js b/Packages/ohif-measurements/both/schema/measurements.js deleted file mode 100644 index 001b539d1..000000000 --- a/Packages/ohif-measurements/both/schema/measurements.js +++ /dev/null @@ -1,318 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -const Measurement = new SimpleSchema({ - additionalData: { - type: Object, - label: 'Additional Data', - defaultValue: {}, - optional: true, - blackbox: true - }, - userId: { - type: String, - label: 'User ID', - optional: true - }, - patientId: { - type: String, - label: 'Patient ID', - optional: true - }, - measurementNumber: { - type: Number, - label: 'Measurement Number', - optional: true - }, - timepointId: { - type: String, - label: 'Timepoint ID', - optional: true - }, - // Force value to be current date (on server) upon insert - // and prevent updates thereafter. - createdAt: { - type: Date, - autoValue: function() { - if (this.isInsert) { - return new Date(); - } else if (this.isUpsert) { - return { $setOnInsert: new Date() }; - } else { - // [PWV-184] Preventing unset due to child tools updating - // this.unset(); // Prevent user from supplying their own value - } - } - }, - // Force value to be current date (on server) upon update - updatedAt: { - type: Date, - autoValue: function() { - if (this.isUpdate) { - // return new Date(); - } - }, - optional: true - } -}); - -const StudyLevelMeasurement = new SimpleSchema([ - Measurement, - { - studyInstanceUid: { - type: String, - label: 'Study Instance UID' - } - } -]); - -const SeriesLevelMeasurement = new SimpleSchema([ - StudyLevelMeasurement, - { - seriesInstanceUid: { - type: String, - label: 'Series Instance UID' - } - } -]); - -const CornerstoneVOI = new SimpleSchema({ - windowWidth: { - type: Number, - label: 'Window Width', - decimal: true, - optional: true - }, - windowCenter: { - type: Number, - label: 'Window Center', - decimal: true, - optional: true - }, -}); - -const CornerstoneViewportTranslation = new SimpleSchema({ - x: { - type: Number, - label: 'X', - decimal: true, - optional: true - }, - y: { - type: Number, - label: 'Y', - decimal: true, - optional: true - }, -}); - -const CornerstoneViewport = new SimpleSchema({ - scale: { - type: Number, - label: 'Scale', - decimal: true, - optional: true - }, - translation: { - type: CornerstoneViewportTranslation, - label: 'Translation', - optional: true - }, - voi: { - type: CornerstoneVOI, - label: 'VOI', - optional: true - }, - invert: { - type: Boolean, - label: 'Invert', - optional: true - }, - pixelReplication: { - type: Boolean, - label: 'Pixel Replication', - optional: true - }, - hFlip: { - type: Boolean, - label: 'Horizontal Flip', - optional: true - }, - vFlip: { - type: Boolean, - label: 'Vertical Flip', - optional: true - }, - rotation: { - type: Number, - label: 'Rotation (degrees)', - decimal: true, - optional: true - } -}); - -const InstanceLevelMeasurement = new SimpleSchema([ - StudyLevelMeasurement, - SeriesLevelMeasurement, - { - sopInstanceUid: { - type: String, - label: 'SOP Instance UID' - }, - viewport: { - type: CornerstoneViewport, - label: 'Viewport Parameters', - optional: true - } - } -]); - -const FrameLevelMeasurement = new SimpleSchema([ - StudyLevelMeasurement, - SeriesLevelMeasurement, - InstanceLevelMeasurement, - { - frameIndex: { - type: Number, - min: 0, - label: 'Frame index in Instance' - }, - imagePath: { - type: String, - label: 'Identifier for the measurement\'s image' // studyInstanceUid_seriesInstanceUid_sopInstanceUid_frameIndex - } - } -]); - -const CornerstoneToolMeasurement = new SimpleSchema([ - StudyLevelMeasurement, - SeriesLevelMeasurement, - InstanceLevelMeasurement, - FrameLevelMeasurement, - { - toolType: { - type: String, - label: 'Cornerstone Tool Type', - optional: true - }, - visible: { - type: Boolean, - label: 'Visible', - defaultValue: true - }, - active: { - type: Boolean, - label: 'Active', - defaultValue: false - }, - invalidated: { - type: Boolean, - label: 'Invalidated', - defaultValue: false, - optional: true - } - } -]); - -const CornerstoneHandleBoundingBoxSchema = new SimpleSchema({ - width: { - type: Number, - label: 'Width', - decimal: true - }, - height: { - type: Number, - label: 'Height', - decimal: true - }, - left: { - type: Number, - label: 'Left', - decimal: true - }, - top: { - type: Number, - label: 'Top', - decimal: true - } -}); - -const CornerstoneHandleSchema = new SimpleSchema({ - x: { - type: Number, - label: 'X', - decimal: true, - optional: true // Not actually optional, but sometimes values like x/y position are missing - }, - y: { - type: Number, - label: 'Y', - decimal: true, - optional: true // Not actually optional, but sometimes values like x/y position are missing - }, - highlight: { - type: Boolean, - label: 'Highlight', - defaultValue: false - }, - active: { - type: Boolean, - label: 'Active', - defaultValue: false, - optional: true - }, - drawnIndependently: { - type: Boolean, - label: 'Drawn Independently', - defaultValue: false, - optional: true - }, - movesIndependently: { - type: Boolean, - label: 'Moves Independently', - defaultValue: false, - optional: true - }, - allowedOutsideImage: { - type: Boolean, - label: 'Allowed Outside Image', - defaultValue: false, - optional: true - }, - hasMoved: { - type: Boolean, - label: 'Has Already Moved', - defaultValue: false, - optional: true - }, - hasBoundingBox: { - type: Boolean, - label: 'Has Bounding Box', - defaultValue: false, - optional: true - }, - boundingBox: { - type: CornerstoneHandleBoundingBoxSchema, - label: 'Bounding Box', - optional: true - }, - index: { // TODO: Remove 'index' from bidirectionalTool since it's useless - type: Number, - optional: true - }, - locked: { - type: Boolean, - label: 'Locked', - optional: true, - defaultValue: false - } -}); - -export const MeasurementSchemaTypes = { - Measurement: Measurement, - StudyLevelMeasurement: StudyLevelMeasurement, - SeriesLevelMeasurement: SeriesLevelMeasurement, - InstanceLevelMeasurement: InstanceLevelMeasurement, - FrameLevelMeasurement: FrameLevelMeasurement, - CornerstoneToolMeasurement: CornerstoneToolMeasurement, - CornerstoneHandleSchema: CornerstoneHandleSchema -}; diff --git a/Packages/ohif-measurements/both/schema/timepoints.js b/Packages/ohif-measurements/both/schema/timepoints.js deleted file mode 100644 index c1828b64c..000000000 --- a/Packages/ohif-measurements/both/schema/timepoints.js +++ /dev/null @@ -1,47 +0,0 @@ -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; - -export const schema = new SimpleSchema({ - patientId: { - type: String, - label: 'Patient ID', - optional: true - }, - timepointId: { - type: String, - label: 'Timepoint ID' - }, - timepointType: { - type: String, - label: 'Timepoint Type', - allowedValues: ['baseline', 'followup'], - defaultValue: 'baseline', - }, - isLocked: { - type: Boolean, - label: 'Timepoint Locked' - }, - studyInstanceUids: { - type: [String], - label: 'Study Instance Uids', - defaultValue: [] - }, - earliestDate: { - type: Date, - label: 'Earliest Study Date from associated studies', - }, - latestDate: { - type: Date, - label: 'Most recent Study Date from associated studies', - }, - visitNumber: { - type: Number, - label: 'Number of patient\'s visit', - optional: true - }, - studiesData: { - type: [Object], - label: 'Studies data to allow lazy loading', - optional: true, - blackbox: true - } -}); diff --git a/Packages/ohif-measurements/client/components/association/associationModal/associationModal.html b/Packages/ohif-measurements/client/components/association/associationModal/associationModal.html deleted file mode 100644 index 89158e583..000000000 --- a/Packages/ohif-measurements/client/components/association/associationModal/associationModal.html +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/association/associationModal/associationModal.js b/Packages/ohif-measurements/client/components/association/associationModal/associationModal.js deleted file mode 100644 index e1c8e22fc..000000000 --- a/Packages/ohif-measurements/client/components/association/associationModal/associationModal.js +++ /dev/null @@ -1,146 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { Random } from 'meteor/random'; -import { moment } from 'meteor/momentjs:moment'; -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; - -Template.dialogStudyAssociation.onCreated(() => { - const instance = Template.instance(); - - instance.data.confirmCallback = formData => { - OHIF.log.info('Saving associations'); - const Timepoints = OHIF.studylist.timepointApi.timepoints; - - // Find the rows of the study association table - const $tableRows = instance.$('#studyAssociationTable table tbody tr'); - - // Create an empty object to group studies into - const studies = {}; - - // Loop through each row to parse the data - $tableRows.each(function() { - // Get a selector for this row - const $row = $(this); - - // Check the includeStudy checkbox to see if we should parse this row - const includeStudy = $row.find('input.includeStudy[type="checkbox"]').eq(0).prop('checked'); - if (!includeStudy) { - return; - } - - // Find the selected timepoint option for this study - const $timepointInput = $row.find('input.timepointOption[type="radio"]:checked'); - - // Find the related label and trim it down to actual label (TODO: do this another way) - const timepointType = $timepointInput.val(); - - // Get the study metaData by checking the row with the template engine Blaze - const data = Blaze.getData(this); - - // Concatenate the study data to an array, depending on whether is was marked as baseline - // or follow-up - if (!studies.hasOwnProperty(timepointType)) { - studies[timepointType] = []; - } - - studies[timepointType].push(data); - }); - - const studiesKeys = Object.keys(studies); - - // TODO: REMOVE - Temporary for RSNA - const hasBaseline = _.contains(studiesKeys, 'baseline'); - if (hasBaseline) { - const patientId = studies[studiesKeys[0]][0].patientId; - Timepoints.remove({ patientId }); - } - - studiesKeys.forEach(timepointType => { - // Get the studies associated with this timepoint - const relatedStudies = studies[timepointType]; - - // Create an array of all the studyInstanceUids for storage in the Timepoint - const studyInstanceUids = relatedStudies.map(function(study) { - return study.studyInstanceUid; - }); - - // Create an array of all the studyDates for storage in the Timepoint - let studyDates = relatedStudies.map(study => moment(study.studyDate).toDate()); - - // Sort the study dates, so we can get a range for these values - studyDates = studyDates.sort(); - - // HipaaEventType to log changes in collections - let hipaaEventType; - let hipaaEvent; - - // Check if these studies are already associated with an existing Timepoint - let existingTimepoint; - if (timepointType === 'baseline') { - // If we're trying to associate them to the Baseline, we don't need to - // check if the studyInstanceUids are already associated with anything else - existingTimepoint = Timepoints.findOne({ - patientId: relatedStudies[0].patientId, - timepointType: 'baseline' - }); - } else { - // If we're trying to associate them to a Follow-up, we should check if any - // of them are already part of a Follow-up (e.g. Follow-up 1), so that - // the rest will also be associated with Follow-up 1. - existingTimepoint = Timepoints.findOne({ - patientId: relatedStudies[0].patientId, - studyInstanceUids: { - $in: studyInstanceUids - } - }); - } - - let timepointId; - if (existingTimepoint) { - // If these studies are already associated with an existing Timepoint, - // and the desired timepoint type is the same (e.g. Follow-up), update - // this Timepoint instead of creating a new one - Timepoints.update(existingTimepoint._id, { - $set: { - studyInstanceUids - } - }); - timepointId = existingTimepoint.timepointId; - hipaaEventType = 'modify'; - } else { - // Create a new timepoint to represent the (baseline or follow-up) studies - let timepoint = { - timepointType: timepointType, - timepointId: Random.id(), - studyInstanceUids: studyInstanceUids, - patientId: relatedStudies[0].patientId, - earliestDate: studyDates[0], - latestDate: studyDates[studyDates.length - 1], - isLocked: false - }; - - // Insert this timepoint into the Timepoints Collection - Timepoints.insert(timepoint); - timepointId = timepoint.timepointId; - hipaaEventType = 'create'; - } - - // Log - hipaaEvent = { - eventType: hipaaEventType, - userId: OHIF.user.getUserId(), - userName: OHIF.user.getName(), - collectionName: 'Timepoints', - recordId: timepointId, - patientId: relatedStudies[0].patientId, - patientName: relatedStudies[0].patientName - }; - }); - - OHIF.studylist.timepointApi.storeTimepoints(); - - return formData; - }; -}); diff --git a/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.html b/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.html deleted file mode 100644 index 40bc7e05e..000000000 --- a/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.html +++ /dev/null @@ -1,67 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.js b/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.js deleted file mode 100644 index a3d4f97d3..000000000 --- a/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.js +++ /dev/null @@ -1,142 +0,0 @@ -import { Template } from 'meteor/templating'; -import { moment } from 'meteor/momentjs:moment'; -import { OHIF } from 'meteor/ohif:core'; - -/** - * Finds related studies within defined time window of =/- 14 days of selected studies - * @param selectedStudies - * @param range Object - */ -function getDateRange(selectedStudies, range) { - if (range === undefined) { - range = { - days: 14 - }; - } - - if (!selectedStudies.length) { - return; - } - - const earliestStudy = selectedStudies[0]; - const latestStudy = selectedStudies[selectedStudies.length - 1]; - - const earliestDate = moment(earliestStudy.studyDate, 'YYYYMMDD'); - earliestDate.subtract(range); - - const latestDate = moment(latestStudy.studyDate, 'YYYYMMDD'); - latestDate.add(range); - - return { - earliestDate: earliestDate, - latestDate: latestDate - }; -} - -/** - * Selects all studies related to the currently input studies, - * based on various criteria. Returns the entire array of related studies. - * - * (at the moment, this is only the date range +/- 14 days, with a matching patientId) - * - * @param selectedStudies A user-selected list of studies - * @returns {*} The entire array of related studies - */ -function autoSelectStudies(selectedStudies) { - if (!selectedStudies.length) { - return; - } - - const range = getDateRange(selectedStudies); - - // Fetch autoselected studies based on the date range - // Note that we used MongoDB's fetch here so we have a mutable array, - // rather than a Cursor - const autoselected = OHIF.studylist.collections.Studies.find({ - studyDate: { - $gte: range.earliestDate.format('YYYYMMDD'), - $lte: range.latestDate.format('YYYYMMDD') - } - }, { - sort: { - studyDate: 1 - } - }).fetch(); - - // Make an array of studyInstanceUids in selectedStudies - const studyInstanceUids = selectedStudies.map(selectedStudy => selectedStudy.studyInstanceUid); - - autoselected.forEach(study => { - const exists = studyInstanceUids.indexOf(study.studyInstanceUid); - if (exists > -1) { - study.autoselected = false; - return; - } - - study.autoselected = true; - }); - - return autoselected; -} - -Template.studyAssociationTable.helpers({ - /** - * This helpers includes the user-selected and autoselected studies - * to be associated. - * - * @returns {Array.} - */ - relevantStudies() { - const selectedStudies = OHIF.studylist.getSelectedStudies(); - - return autoSelectStudies(selectedStudies); - }, - /** - * This helper returns the list of Timepoint types the user can set for this study - * - * @returns {Array.} - */ - timepointOptions() { - return [{ - value: 'baseline', - name: 'Baseline', - checked: true - }, { - value: 'followup', - name: 'Follow-up', - checked: false - }]; - }, - earliestDate() { - const selectedStudies = OHIF.studylist.getSelectedStudies(); - - const range = getDateRange(selectedStudies); - if (range) { - return range.earliestDate; - } - }, - latestDate() { - const selectedStudies = OHIF.studylist.getSelectedStudies(); - - const range = getDateRange(selectedStudies); - if (range) { - return range.latestDate; - } - } -}); - -Template.studyAssociationTable.events({ - 'change input.includeStudy'(event, instance) { - const checkbox = event.currentTarget; - const studyRow = $(checkbox).closest('tr'); - const studyDataCells = studyRow.find('td.studyDataCell'); - - if (checkbox.checked === true) { - studyRow.removeClass('disabled'); - studyDataCells.find('input').attr('disabled', false); - } else { - studyRow.addClass('disabled'); - studyDataCells.find('input').attr('disabled', true); - } - } -}); diff --git a/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.styl b/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.styl deleted file mode 100644 index 84bdebafa..000000000 --- a/Packages/ohif-measurements/client/components/association/associationModal/studyAssociationTable/studyAssociationTable.styl +++ /dev/null @@ -1,188 +0,0 @@ -@import "{ohif:design}/app" - -$tableHoverColor = #2c363f -$tableTextPrimaryColor = white -$tableHeaderHeight = 50px -$bodyCellHeight = 30px - -#studyAssociationTable - color: #fff - - .header - text-align: center - - .center - text-align: center - - #associationInstructions - theme('background', '$uiGrayDarker') - margin-bottom: 2px - padding: 0 15px - - .tableHeaderBackground - theme('background-color', '$uiGrayDarker') - position: absolute - height: $tableHeaderHeight + 1px - left: 0 - width: 100% - z-index: 1 - border-bottom: solid 1px - theme('border-bottom-color', '$largeNumbersColor') - - table - z-index: 2 - position: relative - - thead - tr - th - padding-bottom: 5px - border-bottom: solid 1px #6fbde2 - height: $tableHeaderHeight - font-weight: normal - - tbody - tr - padding: 5px - background-color: black - - &:nth-child(even) - theme('background-color', '$uiGrayDarker') - - td - position: relative - height: $bodyCellHeight - line-height: $bodyCellHeight - color: $tableTextPrimaryColor - border-top: 1px solid #436270 - border-bottom: 1px solid #436270 - vertical-align: middle - transition(all 0.1s ease) - - p - margin: 0 - - &.timepointOptions - label - font-weight: 200 - cursor: pointer - - input - margin: 0 3px - - &[type="radio"] - border: 0 - clip: rect(0 0 0 0) - height: 1px - margin: -1px - overflow: hidden - padding: 0 - position: absolute - width: 1px - - & + span - display: block - position: absolute - border: 2px solid #c8c8c8 - border-radius: 100% - height: 15px - width: 15px - top: 2px - left: 0 - padding: 3px - z-index: 5 - transition: border .25s linear - -webkit-transition: border .25s linear - - & + span:before - display: block - content: '' - border-radius: 100% - height: 100% - width: 100% - transition: background 0.25s linear - -webkit-transition: background 0.25s linear - - &:checked + span - theme('border-color', '$activeColor') - - &:before - theme('background-color', '$activeColor') - - &:disabled - & + span - border-color: #535960 !important - - &:checked + span - border-color: #0D4256 !important - - &:before - background-color: #0D4256 !important - - label - padding: 0 5px - padding-left: 20px - display: inline-block - position: relative - line-height: initial - - &.checkboxWrapper - label - display: block - margin: 0 - - input - margin: 0 3px - - &[type="checkbox"] - border: 0 - clip: rect(0 0 0 0) - height: 1px - margin: -1px - overflow: hidden - padding: 0 - position: absolute - width: 1px - - & + span - display: block - border: 1px solid #b6b6b6 - background-color: white - border-radius: 2px - height: 16px - width: 16px - margin: 0 auto - z-index: 5 - transition: border .25s linear - -webkit-transition: border .25s linear - - & + span:before - display: block - position: relative - content: '' - font-size: 9px - top: -7px - color: white - background-color: transparent - transition: background 0.25s linear - -webkit-transition: background 0.25s linear - - &:checked + span - theme('background-color', '$activeColor') - - &:before - content: '\2713' - - &.disabled - td - color: #535960 - - &:hover, &:active, &.active - background-color: $tableHoverColor - color: white - - td - // This selector is necessary to override bootstrap's 'table' class - border-top: 1px solid #436270 - border-bottom: 1px solid #436270 - background-color: $tableHoverColor diff --git a/Packages/ohif-measurements/client/components/association/index.js b/Packages/ohif-measurements/client/components/association/index.js deleted file mode 100644 index a19ccd0b9..000000000 --- a/Packages/ohif-measurements/client/components/association/index.js +++ /dev/null @@ -1,7 +0,0 @@ -// Study-Timepoint Association imports -import './associationModal/associationModal.html'; -import './associationModal/associationModal.js'; - -import './associationModal/studyAssociationTable/studyAssociationTable.html'; -import './associationModal/studyAssociationTable/studyAssociationTable.styl'; -import './associationModal/studyAssociationTable/studyAssociationTable.js'; diff --git a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.html b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.html deleted file mode 100644 index a5fef7dfc..000000000 --- a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.html +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js deleted file mode 100644 index e0d9f25dd..000000000 --- a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js +++ /dev/null @@ -1,143 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; - -Template.caseProgress.onCreated(() => { - const instance = Template.instance(); - - instance.progressPercent = new ReactiveVar(); - instance.progressText = new ReactiveVar(); - instance.isLocked = new ReactiveVar(false); - instance.isFollowUp = new ReactiveVar(false); -}); - -Template.caseProgress.onRendered(() => { - const instance = Template.instance(); - const { timepointApi, measurementApi, timepointId } = instance.data; - - // Stop here if we have no current timepoint ID (and therefore no defined timepointAPI) - if (!timepointApi) { - instance.progressPercent.set(100); - return; - } - - // Get the current and prior timepoints - const current = timepointApi.timepoints.findOne({ timepointId }); - const priorFilter = { - latestDate: { $lt: current.latestDate }, - patientId: current.patientId - }; - const priorSorting = { sort: { latestDate: -1 } }; - const prior = timepointApi.timepoints.findOne(priorFilter, priorSorting); - - // Stop here if timepoint is locked - if (current && current.isLocked) { - return instance.isLocked.set(true); - } else { - instance.isLocked.set(false); - } - - // Stop here if no current or prior timepoint was found - if (!current || !prior || !current.timepointId) { - return instance.progressPercent.set(100); - } - - // Retrieve the initial number of targets left to measure at this - // follow-up. Note that this is done outside of the reactive function - // below so that new lesions don't change the initial target count. - - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - const toolGroups = config.measurementTools; - - const toolIds = []; - toolGroups.forEach(toolGroup => toolGroup.childTools.forEach(tool => { - const option = 'options.caseProgress.include'; - if (OHIF.utils.ObjectPath.get(tool, option)) { - toolIds.push(tool.id); - } - })); - - const getTimepointFilter = timepointId => ({ - timepointId, - toolId: { $in: toolIds } - }); - - const getNumMeasurementsAtTimepoint = timepointId => { - OHIF.log.info('getNumMeasurementsAtTimepoint'); - const filter = getTimepointFilter(timepointId); - - let count = 0; - toolGroups.forEach(toolGroup => { - count += measurementApi.fetch(toolGroup.id, filter).length; - }); - - return count; - }; - - const getNumRemainingBetweenTimepoints = (currentTimepointId, priorTimepointId) => { - const currentFilter = getTimepointFilter(currentTimepointId); - const priorFilter = getTimepointFilter(priorTimepointId); - - let totalRemaining = 0; - toolGroups.forEach(toolGroup => { - const toolGroupId = toolGroup.id; - const numCurrent = measurementApi.fetch(toolGroupId, currentFilter).length; - const numPrior = measurementApi.fetch(toolGroupId, priorFilter).length; - const remaining = Math.max(numPrior - numCurrent, 0); - totalRemaining += remaining; - }); - - return totalRemaining; - }; - - // If we're currently reviewing a Baseline timepoint, don't do any - // progress measurement. - if (current.timepointType === 'baseline') { - instance.progressPercent.set(100); - instance.isFollowUp.set(false); - } else { - instance.isFollowUp.set(true); - // Setup a reactive function to update the progress whenever - // a measurement is made - instance.autorun(() => { - measurementApi.changeObserver.depend(); - // Obtain the number of Measurements for which the current Timepoint has - // no Measurement data - const totalMeasurements = getNumMeasurementsAtTimepoint(prior.timepointId); - const numRemainingMeasurements = getNumRemainingBetweenTimepoints(current.timepointId, prior.timepointId); - const numMeasurementsMade = totalMeasurements - numRemainingMeasurements; - - // Update the Case Progress text with the remaining measurement count - instance.progressText.set(numRemainingMeasurements); - - // Calculate the Case Progress as a percentage in order to update the - // radial progress bar - const progressPercent = Math.min(100, Math.round(100 * numMeasurementsMade / totalMeasurements)); - instance.progressPercent.set(progressPercent); - }); - } -}); - -Template.caseProgress.helpers({ - progressPercent() { - return Template.instance().progressPercent.get(); - }, - - progressText() { - return Template.instance().progressText.get(); - }, - - isLocked() { - return Template.instance().isLocked.get(); - }, - - progressComplete() { - const instance = Template.instance(); - if (!instance.data.timepointApi) { - return true; - } - - const progressPercent = instance.progressPercent.get(); - return progressPercent === 100; - } -}); diff --git a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.styl b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.styl deleted file mode 100644 index 1b4659059..000000000 --- a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.styl +++ /dev/null @@ -1,20 +0,0 @@ -@require '{ohif:design}/app' - -.caseProgress - transition(all 0.3 ease) - - .radialProgress - display: inline-block - float:left - - .caseProgressStatus - display: inline-block - float: left - margin-left: 22px - - h5 - theme('color', '$textPrimaryColor') - line-height: 40px - margin: 0 - font-size: 15px - font-weight: bold diff --git a/Packages/ohif-measurements/client/components/caseProgress/index.js b/Packages/ohif-measurements/client/components/caseProgress/index.js deleted file mode 100644 index 04cde6b34..000000000 --- a/Packages/ohif-measurements/client/components/caseProgress/index.js +++ /dev/null @@ -1,8 +0,0 @@ -// Case Progress imports -import './caseProgress.html'; -import './caseProgress.styl'; -import './caseProgress.js'; - -import './radialProgressBar/radialProgressBar.html'; -import './radialProgressBar/radialProgressBar.styl'; -import './radialProgressBar/radialProgressBar.js'; diff --git a/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.html b/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.html deleted file mode 100644 index 7db13095f..000000000 --- a/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.html +++ /dev/null @@ -1,45 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.js b/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.js deleted file mode 100644 index 5572c6a9a..000000000 --- a/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.js +++ /dev/null @@ -1,15 +0,0 @@ -import { Template } from 'meteor/templating'; - -Template.radialProgressBar.helpers({ - progressComplete() { - const instance = Template.instance(); - return instance.data.progressPercent === 100; - }, - - progressRadius() { - const instance = Template.instance(); - const radius = 11 * 2 * Math.PI; - const percentLeft = (100 - instance.data.progressPercent) / 100; - return percentLeft * radius; - } -}); diff --git a/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.styl b/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.styl deleted file mode 100644 index 90b923db8..000000000 --- a/Packages/ohif-measurements/client/components/caseProgress/radialProgressBar/radialProgressBar.styl +++ /dev/null @@ -1,55 +0,0 @@ -@require '{ohif:design}/app' - -$circleSize = 26px - -.radialProgress - border-radius: 100% - height: $circleSize - margin-top: 3px - margin-right: 4px - position: relative - vendorize(box-shadow, 0 0 1em black) - width: $circleSize - - #svg circle - stroke-dashoffset: 0 - theme('stroke', '$uiBorderColorDark') - stroke-width: 3px - vendorize(transition, stroke-dashoffset 1s linear) - - #svg #bar - theme('stroke', '$textSecondaryColor') - vendorize(transform, rotate(270deg)) - vendorize(transform-origin, center center) - - .progressArea - theme('color', '$textSecondaryColor') - display: table - font-weight: 700 - font-size: 12px - height: $circleSize - line-height: $circleSize - left: 50% - position: absolute - text-align: center - top: 50% - transform(translate(-50%, -50%)) - width: $circleSize - - &.locked - line-height: 0 - - &, & svg - height: 12px - width: 10px - - &.complete - line-height: 0 - - &, & svg - height: 16px - width: 16px - - svg - theme('fill', '$textSecondaryColor') - theme('stroke', '$textSecondaryColor') diff --git a/Packages/ohif-measurements/client/components/index.js b/Packages/ohif-measurements/client/components/index.js deleted file mode 100644 index 098dc567d..000000000 --- a/Packages/ohif-measurements/client/components/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import './association'; -import './caseProgress'; -import './measurementTable'; -import './measurementLightTable'; -import './measureFlow'; diff --git a/Packages/ohif-measurements/client/components/measureFlow/index.js b/Packages/ohif-measurements/client/components/measureFlow/index.js deleted file mode 100644 index 0785b32e0..000000000 --- a/Packages/ohif-measurements/client/components/measureFlow/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './measureFlow.html'; -import './measureFlow.styl'; -import './measureFlow.js'; diff --git a/Packages/ohif-measurements/client/components/measureFlow/measureFlow.html b/Packages/ohif-measurements/client/components/measureFlow/measureFlow.html deleted file mode 100644 index 91b35a05a..000000000 --- a/Packages/ohif-measurements/client/components/measureFlow/measureFlow.html +++ /dev/null @@ -1,32 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measureFlow/measureFlow.js b/Packages/ohif-measurements/client/components/measureFlow/measureFlow.js deleted file mode 100644 index 0b237c022..000000000 --- a/Packages/ohif-measurements/client/components/measureFlow/measureFlow.js +++ /dev/null @@ -1,326 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; - -Template.measureFlow.onCreated(() => { - const instance = Template.instance(); - - instance.value = instance.data.currentValue || ''; - - instance.state = new ReactiveVar('closed'); - instance.description = new ReactiveVar(instance.data.currentDescription || ''); - instance.descriptionEdit = new ReactiveVar(false); - - const items = [ - 'Abdomen/Chest Wall', - 'Adrenal', - 'Bladder', - 'Bone', - 'Brain', - 'Breast', - 'Colon', - 'Esophagus', - 'Extremities', - 'Gallbladder', - 'Kidney', - 'Liver', - 'Lung', - 'Lymph Node', - 'Mediastinum/Hilum', - 'Muscle', - 'Neck', - 'Other Soft Tissue', - 'Ovary', - 'Pancreas', - 'Pelvis', - 'Peritoneum/Omentum', - 'Prostate', - 'Retroperitoneum', - 'Small Bowel', - 'Spleen', - 'Stomach', - 'Subcutaneous' - ]; - - instance.items = []; - _.each(items, item => { - instance.items.push({ - label: item, - value: item - }); - }); - - const commonItems = [ - 'Abdomen/Chest Wall', - 'Lung', - 'Lymph Node', - 'Liver', - 'Mediastinum/Hilum', - 'Pelvis', - 'Peritoneum/Omentum', - 'Retroperitoneum' - ]; - - instance.commonItems = []; - _.each(commonItems, item => { - instance.commonItems.push({ - label: item, - value: item - }); - }); -}); - -Template.measureFlow.onRendered(() => { - const instance = Template.instance(); - const $measureFlow = instance.$('.measure-flow'); - const $btnAdd = instance.$('.btn-add'); - - // Make the measure flow bounded by the window borders - $measureFlow.bounded(); - - $btnAdd.focus(); - - if (instance.data.autoClick) { - $btnAdd.trigger('click', { - clientX: instance.data.position.x, - clientY: instance.data.position.Y - }); - } else { - if (instance.data.direction) { - const direction = instance.data.direction; - let { left, top } = $measureFlow.offset(); - - left = direction.x === -1 ? left -= $btnAdd.outerWidth() : left; - top = direction.y === -1 ? top -= $btnAdd.outerHeight() : top; - - const distance = 5; - left += direction.x * distance; - top += direction.y * distance; - - $measureFlow.css({ - left, - top - }); - } - - // Display the button after reposition it - $btnAdd.css('opacity', 1); - } -}); - -Template.measureFlow.events({ - 'click, mousedown, mouseup'(event, instance) { - event.stopPropagation(); - }, - - 'click .measure-flow .btn-add, click .measure-flow .btn-rename'(event, instance) { - const $measureFlow = instance.$('.measure-flow'); - - // Set the open state for the component - instance.state.set('open'); - - // Wait template rerender before rendering the selectTree - Tracker.afterFlush(() => { - // Get the click or rendering position - let position; - if (_.isUndefined(event.clientX)) { - position = { - left: instance.data.position.x, - top: instance.data.position.y, - }; - } else { - position = { - left: event.clientX, - top: event.clientY, - }; - } - - // Define the data for selectTreeComponent - const data = { - key: 'label', - items: instance.items, - commonItems: instance.commonItems, - hideCommon: instance.data.hideCommon, - label: 'Assign label', - searchPlaceholder: 'Search labels', - // storageKey: 'measureLabelCommon', - threeColumns: instance.data.threeColumns, - position - }; - - // Define in which element the selectTree will be rendered in - const parentElement = $measureFlow[0]; - - // Render the selectTree element - instance.selectTreeView = Blaze.renderWithData(Template.selectTree, data, parentElement); - - // Focus the measure flow to handle closing - $measureFlow.focus(); - }); - }, - - 'click .measure-flow .btn-description'(event, instance) { - // Fade out the action buttons - instance.$('.measure-flow .actions').addClass('fadeOut'); - - // Set the description edit mode - instance.descriptionEdit.set(true); - - // Wait for DOM re-rendering, resize and focus the description textarea - Tracker.afterFlush(() => { - const $textarea = instance.$('textarea'); - $textarea.trigger('input').focus().select(); - }); - }, - - 'input textarea, change textarea'(event, instance) { - const element = event.currentTarget; - const $element = $(element); - - // Resize the textarea based on its content length - $element.css('max-height', 0); - $element.height(element.scrollHeight); - $element.css('max-height', ''); - - // Reposition the measure flow if needed - const $measureFlow = instance.$('.measure-flow'); - $element.one('transitionend', () => $measureFlow.trigger('spatialChanged')); - }, - - 'keydown textarea'(event, instance) { - // Unset the description edit mode if ENTER or ESC was pressed - if (event.which === 13 || event.which === 27) { - instance.$('.measure-flow .actions').removeClass('fadeOut'); - instance.descriptionEdit.set(false); - instance.$('.measure-flow').focus(); - } - - // Keep the current description if ENTER was pressed - if (event.which === 13) { - event.preventDefault(); - instance.description.set($(event.currentTarget).val()); - } - }, - - 'blur textarea'(event, instance) { - instance.$('.measure-flow .actions').removeClass('fadeOut'); - instance.descriptionEdit.set(false); - instance.description.set($(event.currentTarget).val()); - }, - - 'click .select-tree-common label'(event, instance) { - // Set the common section clicked flag - instance.commonClicked = event.currentTarget; - }, - - 'change .select-tree-root'(event, instance) { - // Stop here if it's an inner input event - if (event.target !== event.currentTarget) { - return; - } - - // Store the selectTree component value before it's removed from DOM - const $treeRoot = $(event.currentTarget); - instance.value = $treeRoot.data('component').value(); - }, - - 'click .tree-leaf input'(event, instance) { - const $target = $(event.currentTarget); - let $label = $target.closest('label'); - const $treeRoot = $label.closest('.select-tree-root'); - const $container = $treeRoot.find('.tree-options:first'); - let labelOffset; - - // Check if the clicked target was a label inside common section - if (instance.commonClicked) { - $label = $(instance.commonClicked); - labelOffset = $label.data('offset'); - } else { - labelOffset = $label.offset(); - } - - // Change the measure flow state to selected - instance.state.set('selected'); - - // Wait for the DOM re-rendering - Tracker.afterFlush(() => { - // Get the measure flow div - const $measureFlow = instance.$('.measure-flow'); - - // Adjust the label position - if (instance.commonClicked) { - labelOffset.top -= 10; - labelOffset.left -= 12; - } else { - labelOffset.top -= 10; - } - - // Reposition the measure flow based on the clicked label position - $measureFlow.css(labelOffset); - - // Resize the copied label with same width of the clicked one - // $measureFlow.children('.tree-leaf').width($label.outerWidth()); - $measureFlow.children('.tree-leaf').width(212); - - // Reset the flag to avoid wrong positioning when clicking normal labels again - instance.commonClicked = false; - - instance.data.updateCallback(instance.value.value, instance.description.get()); - - Meteor.defer(() => !$measureFlow.is(':hover') && $measureFlow.trigger('close')); - }); - - // Wait the fade-out transition and remove the selectTree component - $container.one('transitionend', event => Blaze.remove(instance.selectTreeView)); - }, - - 'blur .measure-flow'(event, instance) { - const $measureFlow = $(event.currentTarget); - const element = $measureFlow[0]; - Meteor.defer(() => { - const focused = $(':focus')[0]; - if (element !== focused && !$.contains(element, focused)) { - $measureFlow.trigger('close'); - } - }); - }, - - 'mouseleave .measure-flow'(event, instance) { - const $measureFlow = $(event.currentTarget); - const canClose = instance.state.get() === 'selected' && !instance.descriptionEdit.get(); - if (canClose && !$.contains($measureFlow[0], event.toElement)) { - $measureFlow.trigger('close'); - } - }, - - 'mouseenter .measure-flow'(event, instance) { - // Prevent from closing if user go out and in too fast - clearTimeout(instance.closingTimeout); - $(event.currentTarget).off('animationend').removeClass('fadeOut'); - }, - - 'close .measure-flow'(event, instance) { - const $measureFlow = $(event.currentTarget); - - // Clear the timeout to prevent executing the close process twice - clearTimeout(instance.closingTimeout); - - instance.closingTimeout = setTimeout(() => { - const animationEndHandler = event => { - // Prevent closing if the animation is coming from actions panel - if (event.target !== $measureFlow[0]) { - $measureFlow.one('animationend', animationEndHandler); - return; - } - - instance.data.doneCallback(); - }; - - $measureFlow.one('animationend', animationEndHandler).addClass('fadeOut'); - }, 300); - } -}); diff --git a/Packages/ohif-measurements/client/components/measureFlow/measureFlow.styl b/Packages/ohif-measurements/client/components/measureFlow/measureFlow.styl deleted file mode 100644 index c4920fe5c..000000000 --- a/Packages/ohif-measurements/client/components/measureFlow/measureFlow.styl +++ /dev/null @@ -1,196 +0,0 @@ -@import "{ohif:design}/app" - -.measure-flow - outline: none - position: fixed - z-index: 1 - - &.fadeOut - animateFadeOut() - - &.open, - &.selected - - .btn-add - opacity: 0 !important - outline: none !important - pointer-events: none !important - - .btn-add - outline: none - theme('color', '$textColorActive') - theme('background-color', '$activeColor') - theme('border', '2px solid $uiBorderColor') - border-radius: 14px - cursor: pointer - font-weight: bold - height: 24px - left: 0 - line-height: 24px - opacity: 1 - position: absolute - padding: 0 14px - top: 0 - transition(opacity 0.3s ease) - white-space: nowrap - - // / {selector()} - // color: $themes['tide']['uiYellow'] !important - - .select-tree-root>.tree-content - width: 140px - - &>.tree-options - position: relative - z-index: 2 - - .tree-inputs - position: relative - - &>.tree-leaf - position: relative - - .icon-check - theme('background-color', '$activeColor') - animateZoomIn() - left: -46px - position: absolute - top: 3px - - span - background: white - font-weight: normal - height: 46px - line-height: 46px - padding: 0 12px - - input, span - display: none - - .actions - padding-top: 16px - opacity: 0 - - &:not(.fadeOut) - animateFadeIn() - animation-delay: 0.3s - - &.fadeOut - animateFadeOut() - - button - theme('border', '1px solid $uiBorderColor') - theme('color', '$textPrimaryColor') - theme('background-color', '$primaryBackgroundColor') - border-radius: 16px - font-weight: normal - height: 31px - line-height: 31px - padding: 0 12px - text-align: center - - .description - margin-top: -10px - margin-bottom: 10px - - textarea - background-color: white - box-shadow: 0 10px white - border: 0 - line-height: 20px - outline: none - overflow: hidden - padding: 0 12px 5px - resize: none - transition(height 0.3s ease) - width: 100% - - .descriptionText - background-color: white - box-shadow: 0 10px white - line-height: 20px - margin-bottom: 10px - margin-top: -10px - padding: 0 12px - - &.selected>.tree-leaf - - span - display: block - - &.tree-columns - - .select-tree-root - - &.navigated .select-tree-common .content - animation-name: none - - &.selected .select-tree-common .content - animation-name: selectTreeCommonCloseLeft - - .tree-search - input, i - display: none - - .select-tree-common - padding-left: 0 - padding-right: 6px - right: auto - left: 0 - width: 180px - - &>.tree-content - transform-origin(0% 50%) - width: 280px - - .select-tree-common .content - right: -180px - - &.started .select-tree-common .content - right: 46px - - &.navigated .select-tree-common .content - animation-name: selectTreeCommonCloseRight - - .tree-inputs>label - float: left - width: 50% - -@keyframes selectTreeCommonCloseRight { - from { - height: 37px - display: table - right: 6px - opacity: 1 - visibility: visible - } - to { - height: 100% - right: -100% - opacity: 0 - visibility: hidden - width: calc(100% - 6px) - } -} - -.icon-check - background-color: white - border-radius: 20px - display: block - height: 40px - overflow: hidden - position: relative - width: 40px - - &:before - border: 2px solid black - border-left-width: 0 - border-top-width: 0 - content: '' - display: block - height: 18px - left: 15px - position: absolute - top: 9px - transform(rotate(45deg)) - width: 9px diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/index.js b/Packages/ohif-measurements/client/components/measurementLightTable/index.js deleted file mode 100644 index cc373668e..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/index.js +++ /dev/null @@ -1,22 +0,0 @@ -// Measurement Table Components imports - -import './measurementEditDescription/measurementEditDescription.html'; -import './measurementEditDescription/measurementEditDescription.js'; - -import './measurementLightTable.html'; -import './measurementLightTable.styl'; - -import './measurementLightTableHeaderRow/measurementLightTableHeaderRow.html'; -import './measurementLightTableHeaderRow/measurementLightTableHeaderRow.styl'; - -import './measurementLightTableRow/measurementLightTableRow.html'; -import './measurementLightTableRow/measurementLightTableRow.styl'; -import './measurementLightTableRow/measurementLightTableRow.js'; - -import './measurementLightTableView/measurementLightTableView.html'; -import './measurementLightTableView/measurementLightTableView.styl'; -import './measurementLightTableView/measurementLightTableView.js'; - -import './measurementRelabel/measurementRelabel.html'; -import './measurementRelabel/measurementRelabel.styl'; -import './measurementRelabel/measurementRelabel.js'; diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementEditDescription/measurementEditDescription.html b/Packages/ohif-measurements/client/components/measurementLightTable/measurementEditDescription/measurementEditDescription.html deleted file mode 100644 index e9f128fad..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementEditDescription/measurementEditDescription.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementEditDescription/measurementEditDescription.js b/Packages/ohif-measurements/client/components/measurementLightTable/measurementEditDescription/measurementEditDescription.js deleted file mode 100644 index 5b7fb3183..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementEditDescription/measurementEditDescription.js +++ /dev/null @@ -1,26 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - - -Template.measurementEditDescription.onRendered(() => { - const instance = Template.instance(); - const form = instance.$('form').data('component'); - const measurementData = instance.data.measurementData; - const collection = OHIF.viewer.measurementApi.tools[measurementData.toolType]; - const currentMeasurement = collection.findOne({ _id: measurementData._id }); - - if (currentMeasurement.description) { - form.value({ - description: currentMeasurement.description - }); - } - - // Update the description after confirming the dialog data - instance.data.promise.then(formData => { - collection.update({ - _id: measurementData._id, - }, { - $set: { description: formData.description } - }); - }); -}); diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTable.html b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTable.html deleted file mode 100644 index cb8af2a3f..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTable.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTable.styl b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTable.styl deleted file mode 100644 index d8e64e59b..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTable.styl +++ /dev/null @@ -1,40 +0,0 @@ -@require '{ohif:design}/app' - -#measurementLightTableContainer - theme('background-color', '$primaryBackgroundColor') - height: 100% - width: 100% - -.measurementLightTableHeaderContainer - display: flex - padding: 0 2px 0 44px - position: relative - - .measurementLightTableHeader - flex: 1 - justify-content: space-around - padding-top: 2px - position: relative - margin: 0.4em 0 - - .studyDateLabel, .studyDate - theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) - font-weight: 400 - padding-left: 12px - text-align: left - - .studyDateLabel - theme('color', '$textSecondaryColor') - font-size: 12px - line-height: 12px - - .studyDate - theme('color', '$textPrimaryColor') - font-size: 14px - line-height: 20px - padding-bottom: 6px - -.measurementLightTableLayoutChanger - margin: 0 auto - padding: 20px - text-align: center diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableHeaderRow/measurementLightTableHeaderRow.html b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableHeaderRow/measurementLightTableHeaderRow.html deleted file mode 100644 index 3a56bdeb7..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableHeaderRow/measurementLightTableHeaderRow.html +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableHeaderRow/measurementLightTableHeaderRow.styl b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableHeaderRow/measurementLightTableHeaderRow.styl deleted file mode 100644 index d11f9d255..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableHeaderRow/measurementLightTableHeaderRow.styl +++ /dev/null @@ -1,36 +0,0 @@ -@import "{ohif:design}/app" - -$headerRowHeight = 63px - -.measurementLightTableHeaderRow - theme('background-color', '$uiGrayDarker') - theme('color', '$textSecondaryColor') - display: flex - theme('fill', '$textSecondaryColor') - height: $headerRowHeight - line-height: $headerRowHeight - margin-top: 2px - width: 100% - - div - align-items: stretch - flex: 1 - justify-content: space-around - text-align: center - - .type - theme('color', '$textSecondaryColor') - font-size: 22px - font-weight: 300 - line-height: $headerRowHeight - padding: 0 10px - text-align: left - - .numberOfMeasurements - theme('color', '$uiSkyBlue') - float: right - font-weight: 300 - font-size: 40px - max-width: 54px - height: $headerRowHeight - line-height: 66px diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.html b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.html deleted file mode 100644 index 0cb324b0f..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.html +++ /dev/null @@ -1,55 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.js b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.js deleted file mode 100644 index 83f687fd5..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.js +++ /dev/null @@ -1,103 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -const getPosition = event => { - return { - x: event.clientX, - y: event.clientY - }; -}; - -Template.measurementLightTableRow.helpers({ - displayData() { - const instance = Template.instance(); - const { rowItem } = instance.data; - - const data = rowItem.entries[0]; - - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - const measurementTools = config.measurementTools; - - const toolGroup = measurementTools.find( toolGroup => toolGroup.id === rowItem.measurementTypeId); - const tool = toolGroup.childTools.find( childTool => childTool.id === data.toolType ); - if (!tool) { - return 'No measurement value'; - } - - const { displayFunction } = tool.options.measurementTable; - return displayFunction(data); - } -}); - -Template.measurementLightTableRow.events({ - 'click .measurementLightTableRow'(event, instance) { - const $row = instance.$('.measurementLightTableRow'); - const rowItem = instance.data.rowItem; - const timepoints = instance.data.timepointApi.all(); - - $row.closest('.measurementLightTableView').find('.measurementLightTableRow').not($row).removeClass('active'); - $row.toggleClass('active'); - - const childToolKey = $(event.target).attr('data-child'); - OHIF.measurements.jumpToRowItem(rowItem, timepoints, childToolKey); - }, - - 'click .js-edit-label'(event, instance) { - event.stopPropagation(); - const rowItem = instance.data.rowItem; - const entry = rowItem.entries[0]; - - // Show the measure flow for measurements - OHIF.measurements.openLocationModal({ - measurement: entry, - element: document.body, - measurementApi: instance.data.measurementApi, - position: getPosition(event), - autoClick: true - }); - }, - - 'click .js-edit-description'(event, instance) { - const rowItem = instance.data.rowItem; - const entry = rowItem.entries[0]; - OHIF.ui.showDialog('measurementEditDescription', { - event, - title: 'Edit Description', - element: event.element, - measurementData: entry - }); - }, - - 'click .js-delete'(event, instance) { - event.stopPropagation(); - const dialogSettings = { - class: 'themed', - title: 'Delete measurements', - message: 'Are you sure you want to delete the measurement?', - position: getPosition(event) - }; - - OHIF.ui.showDialog('dialogConfirm', dialogSettings).then(formData => { - const measurementTypeId = instance.data.rowItem.measurementTypeId; - const measurement = instance.data.rowItem.entries[0]; - const measurementNumber = measurement.measurementNumber; - const { timepointApi, measurementApi } = instance.data; - - // Remove all the measurements with the given type and number - measurementApi.deleteMeasurements(measurementTypeId, { measurementNumber }); - - // Sync the new measurement data with cornerstone tools - const baseline = timepointApi.baseline(); - measurementApi.sortMeasurements(baseline.timepointId); - - // Repaint the images on all viewports without the removed measurements - _.each($('.imageViewerViewport'), element => cornerstone.updateImage(element)); - - // Notify that viewer suffered changes - OHIF.measurements.triggerTimepointUnsavedChanges('deleted'); - }); - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.styl b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.styl deleted file mode 100644 index 4e1fdf413..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableRow/measurementLightTableRow.styl +++ /dev/null @@ -1,87 +0,0 @@ -@import "{ohif:design}/app" - -.measurementLightTableRow - display: flex - margin-left: -6px - margin-top: 2px - padding-left: 6px - opacity: 0.7 - transform(scale(1)) - width: calc(100% + 6px) - - &:hover - opacity 1 - - &.active - opacity 1 - .measurementRowSidebar - theme('color', '$activeColor') - - .rowOptions - height: 35px - visibility: visible - - .rowOptions - theme('background-color', '$uiGrayDarker') - height: 0 - overflow: hidden - transition(all 0.3s ease) - visibility: hidden - padding-left: 14px - - .rowAction - theme('color', '$defaultColor') - cursor: pointer - line-height: 35px - transition(all 0.3s ease) - - &:hover, &:active - theme('color', '$textPrimaryColor') - - svg - theme('fill', '$textPrimaryColor') - theme('stroke', '$textPrimaryColor') - - svg - theme('fill', '$defaultColor') - theme('stroke', '$defaultColor') - transition(all 0.3s ease) - - &.edit-icon - width: 14px - height: 13px - - &.close-icon - width: 11px - height: 11px - - .measurementRowSidebar - theme('background', '$uiGray') - theme('color', '$textSecondaryColor') - cursor: pointer - flex: 1 - max-width: 30px - transition(all 0.3s ease) - - .measurementNumber - font-size: 14px - font-weight: 400 - margin-right: 5px - padding-top: 10px - text-align: center - - .measurementRowContent - flex: 1 - - .measurementDetails - padding: 5px 2px 0 14px - line-height: 30px - font-size: 14px - - .location - theme('color', '$textSecondaryColor') - font-weight: 400 - margin-left: -2px - - .value - theme('color', '$textPrimaryColor') diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.html b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.html deleted file mode 100644 index 3147342ef..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.html +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.js b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.js deleted file mode 100644 index 8c7d91ceb..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.js +++ /dev/null @@ -1,75 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { OHIF } from 'meteor/ohif:core'; - -Template.measurementLightTableView.onCreated(() => { - const instance = Template.instance(); - const { measurementApi, timepointApi } = instance.data; - - instance.data.measurementGroups = new ReactiveVar(); - - instance.path = 'viewer.studyViewer.measurements'; - instance.saveObserver = new Tracker.Dependency(); - - instance.api = { - save() { - - const successHandler = () => { - OHIF.ui.unsavedChanges.clear(`${instance.path}.*`); - instance.saveObserver.changed(); - }; - - // Display the error messages - const errorHandler = data => { - OHIF.ui.showDialog('dialogInfo', Object.assign({ class: 'themed' }, data)); - }; - - const promise = instance.data.measurementApi.storeMeasurements(); - promise.then(successHandler).catch(errorHandler); - OHIF.ui.showDialog('dialogLoading', { - promise, - text: 'Measurements saved.' - }); - - return promise; - }, - exportCSV() { - const { measurementApi, timepointApi } = instance.data; - OHIF.measurements.exportCSV(measurementApi, timepointApi); - } - }; - - instance.autorun(() => { - measurementApi.changeObserver.depend(); - const data = OHIF.measurements.getMeasurementsGroupedByNumber(measurementApi, timepointApi); - instance.data.measurementGroups.set(data); - }); -}); - -Template.measurementLightTableView.helpers({ - hasUnsavedChanges() { - const instance = Template.instance(); - // Run this computation on save or every time any measurement / timepoint suffer changes - OHIF.ui.unsavedChanges.depend(); - instance.saveObserver.depend(); - - return OHIF.ui.unsavedChanges.probe('viewer.*') !== 0; - }, - - hasAnyMeasurement() { - const instance = Template.instance(); - const groups = instance.data.measurementGroups.get(); - - if (!groups) { - return false; - } - - const group = groups.find(item => item.measurementRows.length > 0); - return group; - }, - - saveEnabled() { - const server = OHIF.servers.getCurrentServer(); - return (server && server.type === 'dicomWeb'); - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.styl b/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.styl deleted file mode 100644 index 87f83e307..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementLightTableView/measurementLightTableView.styl +++ /dev/null @@ -1,19 +0,0 @@ -@import "{ohif:design}/app" - -.measurementLightTableView - .report-area - theme('background-color', '$uiGrayDarker') - margin-top: 2px - padding: 10px 0 - text-align: center - - .btn - theme('background-color', '$activeColor') - theme('border', '1px solid $uiBorderColorActive') - color: #000 - - .unsaved-changes-alert - padding-bottom: 10px; - font-size: 11px; - color: #FF0; - font-weight: 100; diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.html b/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.html deleted file mode 100644 index 44ea10954..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.html +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.js b/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.js deleted file mode 100644 index 5511b2a31..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.js +++ /dev/null @@ -1,107 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { $ } from 'meteor/jquery'; -import { - segmentedTerminologyList, - segmentedTerminologyCommonList } from '../../../lib/getLabelTerminologyList'; - -Template.measurementRelabel.onCreated(() => { - const instance = Template.instance(); - - instance.value = instance.data.currentValue || ''; - - instance.state = new ReactiveVar('closed'); - - instance.items = segmentedTerminologyList; - instance.commonItems = segmentedTerminologyCommonList; -}); - -Template.measurementRelabel.onRendered(() => { - const instance = Template.instance(); - const $measurementRelabel = instance.$('.measurement-relabel'); - - // Make the measure flow bounded by the window borders - $measurementRelabel.bounded(); - - // Wait template rerender before rendering the selectTree - Tracker.afterFlush(() => { - // Get the click or rendering position - const position = { - left: event.clientX || instance.data.position.x, - top: event.clientY || instance.data.position.y, - }; - - // Define the data for selectTreeComponent - const data = { - key: 'label', - items: instance.items, - commonItems: instance.commonItems, - hideCommon: instance.data.hideCommon, - label: 'Assign label', - search: true, - searchPlaceholder: 'Search labels', - threeColumns: instance.data.threeColumns, - position - }; - - // Define in which element the selectTree will be rendered in - const parentElement = $measurementRelabel[0]; - - // Render the selectTree element - instance.selectTreeView = Blaze.renderWithData(Template.selectTree, data, parentElement); - - // Focus the measure flow to handle closing - $measurementRelabel.focus(); - }); -}); - -Template.measurementRelabel.events({ - 'click, mousedown, mouseup'(event, instance) { - event.stopPropagation(); - }, - - 'click .tree-leaf input'(event, instance) { - const $target = $(event.currentTarget); - const $measureFlow = instance.$('.measurement-relabel'); - instance.state.set('selected'); - - instance.value = $target.data('component').value(); - instance.data.updateCallback(instance.value); - - $measureFlow.trigger('close') - }, - - 'blur .measurement-relabel'(event, instance) { - const $measurementRelabel = $(event.currentTarget); - const element = $measurementRelabel[0]; - Meteor.defer(() => { - const focused = $(':focus')[0]; - if (element !== focused && !$.contains(element, focused)) { - $measurementRelabel.trigger('close'); - } - }); - }, - - 'mouseleave .measurement-relabel'(event, instance) { - const $measurementRelabel = $(event.currentTarget); - const canClose = instance.state.get() === 'selected'; - if (canClose && !$.contains($measurementRelabel[0], event.toElement)) { - $measurementRelabel.trigger('close'); - } - }, - - 'mouseenter .measurement-relabel'(event, instance) { - // Prevent from closing if user go out and in too fast - clearTimeout(instance.closingTimeout); - $(event.currentTarget).off('animationend').removeClass('fadeOut'); - }, - - 'close .measurement-relabel'(event, instance) { - // Clear the timeout to prevent executing the close process twice - clearTimeout(instance.closingTimeout); - instance.data.doneCallback(); - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.styl b/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.styl deleted file mode 100644 index f715594af..000000000 --- a/Packages/ohif-measurements/client/components/measurementLightTable/measurementRelabel/measurementRelabel.styl +++ /dev/null @@ -1,106 +0,0 @@ -@import "{ohif:design}/app" - -.measurement-relabel - outline: none - position: fixed - z-index: 1 - - &.fadeOut - animateFadeOut() - - .select-tree-root>.tree-content - width: 140px - - &>.tree-options - position: relative - z-index: 2 - - .tree-inputs - position: relative - - &>.tree-leaf - position: relative - - .icon-check - theme('background-color', '$activeColor') - animateZoomIn() - left: -46px - position: absolute - top: 3px - - span - background: white - font-weight: normal - height: 46px - line-height: 46px - padding: 0 12px - - input, span - display: none - - .actions - padding-top: 16px - opacity: 0 - - &:not(.fadeOut) - animateFadeIn() - animation-delay: 0.3s - - &.fadeOut - animateFadeOut() - - &.selected>.tree-leaf - - span - display: block - - &.tree-columns - - .select-tree-root - - &.navigated .select-tree-common .content - animation-name: none - - &.selected .select-tree-common .content - animation-name: selectTreeCommonCloseLeft - - .select-tree-common - padding-left: 0 - padding-right: 6px - right: auto - left: 0 - width: 180px - - &>.tree-content - transform-origin(0% 50%) - width: 280px - - .select-tree-common .content - right: -180px - - &.started .select-tree-common .content - right: 46px - - &.navigated .select-tree-common .content - animation-name: selectTreeCommonCloseRight - - .tree-inputs>label - float: left - width: 50% - -@keyframes selectTreeCommonCloseRight { - from { - height: 37px - display: table - right: 6px - opacity: 1 - visibility: visible - } - to { - height: 100% - right: -100% - opacity: 0 - visibility: hidden - width: calc(100% - 6px) - } -} \ No newline at end of file diff --git a/Packages/ohif-measurements/client/components/measurementTable/index.js b/Packages/ohif-measurements/client/components/measurementTable/index.js deleted file mode 100644 index 0b85914e2..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/index.js +++ /dev/null @@ -1,30 +0,0 @@ -// Measurement Table Components imports -import './measurementTable.html'; -import './measurementTable.styl'; -import './measurementTable.js'; - -import './measurementTableView/measurementTableView.html'; -import './measurementTableView/measurementTableView.styl'; -import './measurementTableView/measurementTableView.js'; - -import './measurementTableHUD/measurementTableHUD.html'; -import './measurementTableHUD/measurementTableHUD.styl'; -import './measurementTableHUD/measurementTableHUD.js'; - -import './measurementTableRow/measurementTableRow.html'; -import './measurementTableRow/measurementTableRow.styl'; -import './measurementTableRow/measurementTableRow.js'; - -import './measurementTableHeaderRow/measurementTableHeaderRow.html'; -import './measurementTableHeaderRow/measurementTableHeaderRow.styl'; -import './measurementTableHeaderRow/measurementTableHeaderRow.js'; - -import './measurementTableTimepointCell/measurementTableTimepointCell.html'; -import './measurementTableTimepointCell/measurementTableTimepointCell.styl'; -import './measurementTableTimepointCell/measurementTableTimepointCell.js'; - -import './measurementTableTimepointHeader/measurementTableTimepointHeader.html'; -import './measurementTableTimepointHeader/measurementTableTimepointHeader.styl'; -import './measurementTableTimepointHeader/measurementTableTimepointHeader.js'; - -import './measurementTableWarnings/measurementTableWarningsDialog.html'; diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTable.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTable.html deleted file mode 100644 index 71ed7d0b6..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTable.html +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTable.js b/Packages/ohif-measurements/client/components/measurementTable/measurementTable.js deleted file mode 100644 index 0f0144709..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTable.js +++ /dev/null @@ -1,87 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.measurementTable.onCreated(() => { - const instance = Template.instance(); - - instance.data.measurementTableLayout = new ReactiveVar('comparison'); - instance.data.timepoints = new ReactiveVar([]); - - // Run this computation every time table layout changes - instance.autorun(() => { - // Get the current table layout - const tableLayout = instance.data.measurementTableLayout.get(); - - const timepointApi = instance.data.timepointApi; - let timepoints; - if (!timepointApi) { - timepoints = []; - } else if (tableLayout === 'key') { - timepoints = timepointApi.key(); - } else { - timepoints = timepointApi.comparison(); - } - - // Return key timepoints - instance.data.timepoints.set(timepoints); - }); -}); - -Template.measurementTable.onRendered(() => { - const instance = Template.instance(); - - instance.autorun(() => { - // Run this computation every time the lesion table layout is changed - instance.data.measurementTableLayout.dep.depend(); - - if (instance.data.state.get('rightSidebar') !== 'measurements') { - // Remove the amount attribute from sidebar element tag - instance.$('#measurementTableContainer').closest('.sidebarMenu').removeAttr('data-timepoints'); - return; - } - - // Get the amount of timepoints being shown - const timepointAmount = instance.data.timepoints.get().length; - - // Set the amount in an attribute on sidebar element tag - instance.$('#measurementTableContainer').closest('.sidebarMenu').attr('data-timepoints', timepointAmount); - }); -}); - -Template.measurementTable.helpers({ - hasWarnings() { - return Template.instance().data.conformanceCriteria.nonconformities.get(); - }, - - buttonGroupData() { - const instance = Template.instance(); - return { - value: instance.data.measurementTableLayout, - options: [{ - value: 'comparison', - text: 'Comparison' - }, { - value: 'key', - text: 'Key Timepoints' - }] - }; - } -}); - -Template.measurementTable.events({ - 'click .warning-status'(event, instance) { - const nonconformities = instance.data.conformanceCriteria.nonconformities.get(); - const messages = []; - _.each(nonconformities, nonconformity => messages.push(nonconformity.message)); - - OHIF.ui.showDialog('measurementTableWarningsDialog', { - messages, - position: { - x: event.clientX, - y: event.clientY - } - }); - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTable.styl b/Packages/ohif-measurements/client/components/measurementTable/measurementTable.styl deleted file mode 100644 index ce702acd6..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTable.styl +++ /dev/null @@ -1,43 +0,0 @@ -@require '{ohif:design}/app' - -#measurementTableContainer - theme('background-color', '$primaryBackgroundColor') - height: 100% - width: 100% - -.measurementTableTimepointHeaderRow - display: flex - padding: 0 2px 0 44px - position: relative - - .warning-status - theme('border', '2px solid $uiYellow') - border-radius: 16px - cursor: pointer - height: 32px - left: 0 - margin: 4px 6px - padding-top: 1px - position: absolute - text-align: center - top: 0 - transition(border-color 0.3s ease) - width: 32px - - &:hover - theme('border-color', '$hoverColor') - - svg - theme('fill', '$hoverColor') - - svg - theme('fill', '$uiYellow') - display: inline - height: 20px - transition(all 0.3s ease) - width: 22px - -.measurementTableLayoutChanger - margin: 0 auto - padding: 20px - text-align: center diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.html deleted file mode 100644 index fb2a9e7f3..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.html +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.js b/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.js deleted file mode 100644 index e2a517e0a..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.js +++ /dev/null @@ -1,72 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { ReactiveVar } from 'meteor/reactive-var'; - -Template.measurementTableHUD.onCreated(() => { - const instance = Template.instance(); - const timepointApi = instance.data.timepointApi; - - instance.isRemoved = true; - if (timepointApi) { - instance.data.timepoints = new ReactiveVar(timepointApi.currentAndPrior()); - } -}); - -Template.measurementTableHUD.onDestroyed(() => { - const instance = Template.instance(); - - instance.isRemoved = true; - Session.set('measurementTableHudOpen', false); -}); - -Template.measurementTableHUD.onRendered(() => { - const instance = Template.instance(); - instance.$('#measurementTableHUD').resizable().draggable().bounded(); -}); - -Template.measurementTableHUD.events({ - 'click .buttonClose'(event, instance) { - Session.set('measurementTableHudOpen', false); - } -}); - -Template.measurementTableHUD.helpers({ - hudHidden() { - let instance = Template.instance(), - isOpen = Session.get('measurementTableHudOpen'); - - if (isOpen) { - instance.isRemoved = false; - return 'dialog-animated dialog-open'; - } - - return instance.isRemoved !== true ? 'dialog-animated dialog-closed' : 'hidden'; - }, - - toolbarButtons() { - let buttonData = []; - - buttonData.push({ - id: 'bidirectional', - title: 'Target', - classes: 'imageViewerTool toolbarSectionButton', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target' - }); - - buttonData.push({ - id: 'nonTarget', - title: 'Non-Target', - classes: 'imageViewerTool toolbarSectionButton', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-non-target' - }); - - buttonData.push({ - id: 'length', - title: 'Temp', - classes: 'imageViewerTool toolbarSectionButton', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp' - }); - - return buttonData; - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.styl b/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.styl deleted file mode 100644 index 0bd9c0716..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHUD/measurementTableHUD.styl +++ /dev/null @@ -1,95 +0,0 @@ -@require '{ohif:design}/app' - -$borderColor = rgba(77, 99, 110, 0.81) - -#measurementTableHUD - background: rgba(0, 0, 0, 0.95) - border-radius: 8px - border: solid 1px $borderColor; - bottom: 3px - height: 326px - left: auto - overflow: hidden - position: absolute - right: 3px - top: auto - width: 318px - z-index: 1 - - .measurementTableView .scrollable - margin-left: 0 - padding-left: 0 - - .header - theme('background', '$uiGrayDarkest') - theme('color', '$textSecondaryColor') - border-bottom: $uiBorderThickness solid $borderColor - font-weight: 300 - font-size: 20px - height: 55px - line-height: 55px - position: relative - text-align: center - width: 100% - - svg.buttonClose - theme('color', '$defaultColor') - cursor: pointer - height: 14px - position: absolute - right: 14px - theme('stroke', '$defaultColor') - top: 20px - width: 14px - - .measurementTableView - height: calc(100% - 55px - 70px) - padding-bottom: 20px - - .footer - theme('background', '$uiGrayDarkest') - border-top: $uiBorderThickness solid $borderColor - height: 70px - padding: 10px - - .toolbarSectionButton - display: inline-block - theme('color', '$defaultColor') - theme('fill', '$defaultColor') - theme('stroke', '$defaultColor') - padding: 0 10px - height: $toolbarHeight - min-width: 30px - cursor: pointer - text-align: center - - &.disabled - opacity: 0.5 - cursor: not-allowed - - .buttonLabel - font-size: 12px - - .svgContainer - margin: 0 auto - text-align: center - - svg - background-color: transparent - margin: 2px - width: 21px - height: 21px - - &:active, &.active - theme('color', '$activeColor') - - svg - theme('fill', '$activeColor') - theme('stroke', '$activeColor') - - &:hover - theme('color', '$hoverColor') - - svg - theme('fill', '$hoverColor') - theme('stroke', '$hoverColor') diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.html deleted file mode 100644 index 2989a2ef3..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.js b/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.js deleted file mode 100644 index 5021418a2..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.js +++ /dev/null @@ -1,33 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -Template.measurementTableHeaderRow.helpers({ - numberOfMeasurements(toolGroupId) { - const { toolGroup, measurementRows } = Template.instance().data; - if (toolGroup.id === 'newTargets') { - let result = 0; - - measurementRows.forEach(measurementRow => { - const measurementData = measurementRow.entries[0]; - if (measurementData.isSplitLesion) return; - result++; - }); - - return result; - } - - return measurementRows.length ? measurementRows.length : null; - }, - - getMax(toolGroupId) { - const { conformanceCriteria } = Template.instance().data; - if (!conformanceCriteria) return; - - if (toolGroupId === 'targets') { - return conformanceCriteria.maxTargets.get(); - } else if (toolGroupId === 'newTargets') { - return conformanceCriteria.maxNewTargets.get(); - } - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.styl b/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.styl deleted file mode 100644 index 41dd69c01..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableHeaderRow/measurementTableHeaderRow.styl +++ /dev/null @@ -1,83 +0,0 @@ -@import "{ohif:design}/app" - -$headerRowHeight = 63px - -.measurementTableHeaderRow - theme('background-color', '$uiGrayDarker') - theme('color', '$textSecondaryColor') - display: flex - theme('fill', '$textSecondaryColor') - height: $headerRowHeight - line-height: $headerRowHeight - margin-top: 2px - width: 100% - - &.inactive .add - cursor: not-allowed - - svg - fill: #5A666D - - div - align-items: stretch - flex: 1 - justify-content: space-around - text-align: center - - .add - cursor: pointer - max-width: 30px - padding-left: 2px - - svg - fill: #C1D8E3 - height: $headerRowHeight - max-width: 11px - - &:hover svg - theme('fill', '$hoverColor') - - &:active svg - theme('fill', '$activeColor') - - .type - theme('color', '$textSecondaryColor') - font-size: 22px - font-weight: 300 - line-height: $headerRowHeight - padding: 0 10px 0 20px - text-align: left - - .numberOfMeasurements - theme('color', '$uiSkyBlue') - float: right - font-weight: 300 - font-size: 40px - max-width: 54px - height: $headerRowHeight - line-height: 66px - - .max - height: $headerRowHeight - max-width: 64px - text-align: right - - .maxNumMeasurements - theme('background-color', '$textSecondaryColor') - border-radius: 3px - color: black - display: table - font-size: 12px - font-weight: 500 - height: 19px - line-height: 17px - margin-left: auto - margin-top: 22px - padding: 2px 6px 0 - text-transform: uppercase - transition($sidebarTransition) - - &.warning - .maxNumMeasurements - theme('background-color', '$uiYellow') - theme('color', '$textPrimaryColor') diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.html deleted file mode 100644 index c33f71c95..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.html +++ /dev/null @@ -1,52 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.js b/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.js deleted file mode 100644 index 0367e1b04..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.js +++ /dev/null @@ -1,100 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -Template.measurementTableRow.onCreated(() => { - const instance = Template.instance(); - - instance.getWarningMessages = () => { - const measurementTypeId = instance.data.rowItem.measurementTypeId; - const measurementNumber = instance.data.rowItem.measurementNumber; - const groupedNonConformities = instance.data.conformanceCriteria.groupedNonConformities.get() || {}; - const nonconformitiesByMeasurementTypeId = groupedNonConformities[measurementTypeId] || {}; - const nonconformitiesByMeasurementNumbers = nonconformitiesByMeasurementTypeId.measurementNumbers || {}; - const nonconformitiesByMeasurementNumber = nonconformitiesByMeasurementNumbers[measurementNumber] || {}; - - return _.uniq(nonconformitiesByMeasurementNumber.messages || []); - }; -}); - -Template.measurementTableRow.helpers({ - hasWarnings() { - return !!Template.instance().getWarningMessages().length; - } -}); - -Template.measurementTableRow.events({ - 'click .measurementRowSidebar .warning-icon'(event, instance) { - event.stopPropagation(); - OHIF.ui.showDialog('measurementTableWarningsDialog', { - messages: instance.getWarningMessages(), - position: { - x: event.clientX, - y: event.clientY - } - }); - }, - - 'click .measurementRowSidebar'(event, instance) { - const $row = instance.$('.measurementTableRow'); - const rowItem = instance.data.rowItem; - const timepoints = instance.data.timepoints.get(); - - $row.closest('.measurementTableView').find('.measurementTableRow').not($row).removeClass('active'); - $row.toggleClass('active'); - - const childToolKey = $(event.target).attr('data-child'); - OHIF.measurements.jumpToRowItem(rowItem, timepoints, childToolKey); - }, - - 'click .js-rename'(event, instance) { - const rowItem = instance.data.rowItem; - const entry = rowItem.entries[0]; - - // Show the measure flow for targets - OHIF.measurements.toggleLabelButton({ - measurement: entry, - element: document.body, - measurementApi: instance.data.measurementApi, - position: { - x: event.clientX, - y: event.clientY - }, - autoClick: true - }); - }, - - 'click .js-delete'(event, instance) { - const dialogSettings = { - class: 'themed', - title: 'Delete measurements', - message: 'Are you sure you want to delete the measurement across all timepoints?', - position: { - x: event.clientX, - y: event.clientY - } - }; - - OHIF.ui.showDialog('dialogConfirm', dialogSettings).then(formData => { - const measurementTypeId = instance.data.rowItem.measurementTypeId; - const measurement = instance.data.rowItem.entries[0]; - const measurementNumber = measurement.measurementNumber; - const { timepointApi, measurementApi } = instance.data; - - // Remove all the measurements with the given type and number - measurementApi.deleteMeasurements(measurementTypeId, { measurementNumber }); - - // Sync the new measurement data with cornerstone tools - const baseline = timepointApi.baseline(); - measurementApi.sortMeasurements(baseline.timepointId); - - // Repaint the images on all viewports without the removed measurements - _.each($('.imageViewerViewport'), element => cornerstone.updateImage(element)); - - // Notify that viewer suffered changes - OHIF.measurements.triggerTimepointUnsavedChanges('deleted'); - }); - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.styl b/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.styl deleted file mode 100644 index 352a39d92..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableRow/measurementTableRow.styl +++ /dev/null @@ -1,123 +0,0 @@ -@import "{ohif:design}/app" - -.measurementTableRow - display: flex - margin-left: -6px - margin-top: 2px - padding-left: 6px - // required transformation to make inner fixed elements relative to this one - transform(scale(1)) - width: calc(100% + 6px) - - &.active - - .measurementRowSidebar - theme('color', '$activeColor') - - .rowOptions - height: 35px - visibility: visible - - &.response-status .measurementRowSidebar .response-status-icon - theme('background-color', '$defaultColor') - theme('color', '$uiGray') - border-radius: 11px - font-size: 12px - font-weight: 700 - height: 21px - line-height: 22px - margin: 5px auto 0 - text-align: center - width: 21px - - &.warning .measurementRowSidebar - theme('background-color', '$uiYellow') - theme('color', '$textPrimaryColor') - - .warning-icon, svg - width: 22px - height: 20px - pointer-events: inherit - - .warning-icon - margin: 7px auto 0 - - svg - theme('fill', '$textPrimaryColor') - - .rowOptions - theme('background-color', '$uiGrayDarker') - height: 0 - overflow: hidden - transition(all 0.3s ease) - visibility: hidden - - .rowAction - theme('color', '$defaultColor') - cursor: pointer - line-height: 35px - transition(all 0.3s ease) - - &:hover, &:active - theme('color', '$textPrimaryColor') - - svg - theme('fill', '$textPrimaryColor') - theme('stroke', '$textPrimaryColor') - - svg - theme('fill', '$defaultColor') - theme('stroke', '$defaultColor') - transition(all 0.3s ease) - - &.edit-icon - width: 14px - height: 13px - - &.close-icon - width: 11px - height: 11px - - .measurementRowSidebar - theme('background', '$uiGray') - theme('color', '$textSecondaryColor') - cursor: pointer - flex: 1 - max-width: 30px - transition(all 0.3s ease) - - .measurementNumber - font-size: 14px - font-weight: 400 - margin-right: 5px - padding-top: 10px - text-align: center - - .measurementDetails - flex: 1 - padding: 5px 2px 0 0 - - &>* - padding-left: 14px - - .location - font-weight: 400 - font-size: 14px - theme('color', '$textSecondaryColor') - height: 30px - line-height: 30px - margin-left: -2px - width: 100% - - .timepointData - display: flex - min-height: 27px - margin-top: 1px - - div - flex: 1 - font-size: 14px - font-weight: 400 - justify-content: space-around - line-height: 18px - padding-bottom: 4px diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.html deleted file mode 100644 index b7ebd029b..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.html +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.js b/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.js deleted file mode 100644 index 371700aa4..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.js +++ /dev/null @@ -1,127 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -Template.measurementTableTimepointCell.helpers({ - hasDataAtThisTimepoint() { - // This simple function just checks whether or not timepoint data - // exists for this Measurement at this Timepoint - const instance = Template.instance(); - const { rowItem, timepointId } = instance.data; - - if (timepointId) { - const dataAtThisTimepoint = _.where(rowItem.entries, { timepointId }); - return dataAtThisTimepoint.length > 0; - } else { - return rowItem.entries.length > 0; - } - }, - - displayData() { - const instance = Template.instance(); - const { rowItem, timepointId } = instance.data; - - let data; - if (timepointId) { - const dataAtThisTimepoint = _.where(rowItem.entries, { timepointId }); - if (dataAtThisTimepoint.length > 1) { - throw 'More than one measurement was found at the same timepoint with the same measurement number?'; - } - - data = dataAtThisTimepoint[0]; - } else { - data = rowItem.entries[0]; - } - - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - const measurementTools = config.measurementTools; - - const toolGroup = _.findWhere(measurementTools, { id: rowItem.measurementTypeId }); - const tool = _.findWhere(toolGroup.childTools, { id: data.toolType }); - if (!tool) { - // TODO: Figure out what is going on here? - OHIF.log.warn('Something went wrong?'); - } - - const { displayFunction } = tool.options.measurementTable; - return displayFunction(data); - }, - - isLoading() { - const instance = Template.instance(); - const { rowItem, timepointId } = instance.data; - const { entries } = rowItem; - const measurementData = timepointId ? _.findWhere(entries, { timepointId }) : entries[0]; - const { studyInstanceUid } = measurementData; - return OHIF.studies.loadingDict.get(studyInstanceUid) === 'loading'; - } -}); - -Template.measurementTableTimepointCell.events({ - 'dblclick .measurementTableTimepointCell'(event, instance) { - const { rowItem, timepointId } = instance.data; - if (!timepointId) return; - - const measurementData = _.findWhere(rowItem.entries, { timepointId }); - if (!measurementData || measurementData.toolType !== 'nonTarget') return; - - const viewportIndex = rowItem.entries.indexOf(measurementData); - const $viewports = $('#viewer .imageViewerViewport'); - let $element = $viewports.eq(viewportIndex); - $element = $element.length ? $element : $viewports.eq(0); - - OHIF.ui.showDialog('dialogNonTargetMeasurement', { - event, - title: 'Change Lesion Location', - element: $element[0], - measurementData, - edit: true - }); - }, - - 'keydown .measurementTableTimepointCell'(event, instance) { - // Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected - const keys = { - D: 68, - DELETE: 46 - }; - const keyCode = event.which; - - if (keyCode === keys.DELETE || keyCode === keys.BACKSPACE || (keyCode === keys.D && event.ctrlKey === true)) { - const timepointId = instance.data.timepointId; - - const offset = $(event.currentTarget).offset(); - const dialogSettings = { - class: 'themed', - title: 'Delete measurements', - message: 'Are you sure you want to delete this measurement?', - position: { - x: offset.left, - y: offset.top - } - }; - - OHIF.ui.showDialog('dialogConfirm', dialogSettings).then(() => { - const measurementTypeId = instance.data.rowItem.measurementTypeId; - const measurement = instance.data.rowItem.entries[0]; - const measurementNumber = measurement.measurementNumber; - const { timepointApi, measurementApi } = instance.data; - - // Remove all the measurements with the given type and number - measurementApi.deleteMeasurements(measurementTypeId, { - measurementNumber, - timepointId - }); - - // Sync the new measurement data with cornerstone tools - const baseline = timepointApi.baseline(); - measurementApi.sortMeasurements(baseline.timepointId); - - // Repaint the images on all viewports without the removed measurements - _.each($('.imageViewerViewport'), element => cornerstone.updateImage(element)); - }); - } - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.styl b/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.styl deleted file mode 100644 index e0467a5f5..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointCell/measurementTableTimepointCell.styl +++ /dev/null @@ -1,26 +0,0 @@ -@require '{ohif:design}/app' - -.measurementTableTimepointCell - theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) - cursor: pointer - padding: 0 10px - position: relative - - .loading-spinner - display: none - font-size: 16px - position: absolute - right: 5px - top: 3px - - span - display: block - - &.loading .loading-spinner - display: block - - &, span - theme('color', '$textPrimaryColor') - - &:hover, span:hover - theme('color', '$activeColor') diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.html deleted file mode 100644 index cace4891c..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.js b/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.js deleted file mode 100644 index cb5c660bd..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.js +++ /dev/null @@ -1,7 +0,0 @@ -import { Template } from 'meteor/templating'; - -Template.measurementTableTimepointHeader.helpers({ - timepointName(timepoint) { - return Template.instance().data.timepointApi.name(timepoint); - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.styl b/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.styl deleted file mode 100644 index 881d3b83a..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableTimepointHeader/measurementTableTimepointHeader.styl +++ /dev/null @@ -1,29 +0,0 @@ -@require '{ohif:design}/app' - -.measurementTableTimepointHeader - flex: 1 - justify-content: space-around - padding-top: 2px - position: relative - - .timepointName, .timepointDate - theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness) - font-weight: 400 - padding-left: 12px - text-align: left - - .timepointName - theme('color', '$textSecondaryColor') - font-size: 12px - line-height: 12px - - .timepointDate - theme('color', '$textPrimaryColor') - font-size: 14px - line-height: 20px - padding-bottom: 6px - - .case-progress-container - position: absolute - right: 4px - top: 0 diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.html deleted file mode 100644 index 7757212fb..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.html +++ /dev/null @@ -1,39 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.js b/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.js deleted file mode 100644 index 04fd2e87d..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.js +++ /dev/null @@ -1,94 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Tracker } from 'meteor/tracker'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.measurementTableView.onCreated(() => { - const instance = Template.instance(); - const { measurementApi, timepointApi } = instance.data; - - instance.data.measurementGroups = new ReactiveVar(); - - Tracker.autorun(() => { - measurementApi.changeObserver.depend(); - const data = OHIF.measurements.getMeasurementsGroupedByNumber(measurementApi, timepointApi); - instance.data.measurementGroups.set(data); - }); -}); - -Template.measurementTableView.events({ - 'click .js-pdf'(event, instance) { - const { measurementApi, timepointApi } = instance.data; - OHIF.measurements.exportPdf(measurementApi, timepointApi); - } -}); - -Template.measurementTableView.helpers({ - hasMeasurements(toolGroupId) { - const instance = Template.instance(); - const groups = instance.data.measurementGroups.get(); - - if (!groups) { - return false; - } - - const group = _.find(groups, item => item.toolGroup.id === toolGroupId); - return group && !!group.measurementRows.length; - }, - - getNewLesionsToolGroup(newLesionGroup) { - const configuration = OHIF.measurements.MeasurementApi.getConfiguration(); - const toolGroup = _.findWhere(configuration.measurementTools, { id: newLesionGroup.toolGroupId }); - - return { - id: newLesionGroup.id, - name: newLesionGroup.name, - childTools: toolGroup.childTools, - measurementTypeId: toolGroup.id - }; - }, - - newLesionsMeasurements(toolGroup) { - const { measurementApi, timepointApi } = Template.instance().data; - const current = timepointApi.current(); - const baseline = timepointApi.baseline(); - - if (!measurementApi || !timepointApi || !current || !baseline) return; - - // If this is a baseline, stop here since there are no new measurements to display - if (!current || current.timepointType === 'baseline') { - OHIF.log.info('Skipping New Measurements section'); - return; - } - - // Retrieve all the data for this Measurement type (e.g. 'targets') - // which was recorded at baseline. - const measurementTypeId = toolGroup.measurementTypeId; - const atBaseline = measurementApi.fetch(measurementTypeId, { - timepointId: baseline.timepointId - }); - - // Obtain a list of the Measurement Numbers from the - // measurements which have baseline data - const numbers = atBaseline.map(m => m.measurementNumber); - - // Retrieve all the data for this Measurement type which - // do NOT match the Measurement Numbers obtained above - const data = measurementApi.fetch(measurementTypeId, { - measurementNumber: { $nin: numbers } - }); - - // Group the Measurements by Measurement Number - const groupObject = _.groupBy(data, entry => entry.measurementNumber); - - // Reformat the data for display in the table - return Object.keys(groupObject).map(key => ({ - measurementTypeId: measurementTypeId, - measurementNumber: key, - location: OHIF.measurements.getLocation(groupObject[key]), - responseStatus: false, // TODO: Get the latest timepoint and determine the response status - entries: groupObject[key] - })); - } -}); diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.styl b/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.styl deleted file mode 100644 index 67c1417a2..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableView/measurementTableView.styl +++ /dev/null @@ -1,15 +0,0 @@ -@import "{ohif:design}/app" - -.measurementTableView - - .report-area - theme('background-color', '$uiGrayDarker') - margin-top: 2px - padding: 10px 0 - - .btn.js-pdf - theme('background-color', '$activeColor') - theme('border', '1px solid $uiBorderColorActive') - color: #000 - display: table - margin: 0 auto diff --git a/Packages/ohif-measurements/client/components/measurementTable/measurementTableWarnings/measurementTableWarningsDialog.html b/Packages/ohif-measurements/client/components/measurementTable/measurementTableWarnings/measurementTableWarningsDialog.html deleted file mode 100644 index 62f37518e..000000000 --- a/Packages/ohif-measurements/client/components/measurementTable/measurementTableWarnings/measurementTableWarningsDialog.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Packages/ohif-measurements/client/conformance/ConformanceCriteria.js b/Packages/ohif-measurements/client/conformance/ConformanceCriteria.js deleted file mode 100644 index 12d72dbb8..000000000 --- a/Packages/ohif-measurements/client/conformance/ConformanceCriteria.js +++ /dev/null @@ -1,188 +0,0 @@ -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; -import { CriteriaEvaluator } from './CriteriaEvaluator'; -import * as evaluations from './evaluations'; - -class ConformanceCriteria { - - constructor(measurementApi, timepointApi) { - this.measurementApi = measurementApi; - this.timepointApi = timepointApi; - this.nonconformities = new ReactiveVar(); - this.groupedNonConformities = new ReactiveVar(); - this.maxTargets = new ReactiveVar(null); - this.maxNewTargets = new ReactiveVar(null); - - const validate = _.debounce(trialCriteriaType => this.validate(trialCriteriaType), 300); - Tracker.autorun(() => { - const selectedType = OHIF.lesiontracker.TrialCriteriaTypes.findOne({ selected: true }); - this.measurementApi.changeObserver.depend(); - validate(selectedType); - }); - } - - validate(trialCriteriaType) { - return new Promise((resolve, reject) => { - const baselinePromise = this.getData('baseline'); - const followupPromise = this.getData('followup'); - Promise.all([baselinePromise, followupPromise]).then(values => { - const [baselineData, followupData] = values; - const mergedData = { - targets: [], - nonTargets: [] - }; - - mergedData.targets = mergedData.targets.concat(baselineData.targets); - mergedData.targets = mergedData.targets.concat(followupData.targets); - mergedData.nonTargets = mergedData.nonTargets.concat(baselineData.nonTargets); - mergedData.nonTargets = mergedData.nonTargets.concat(followupData.nonTargets); - - this.maxTargets.set(null); - this.maxNewTargets.set(null); - const resultBoth = this.validateTimepoint('both', trialCriteriaType, mergedData); - const resultBaseline = this.validateTimepoint('baseline', trialCriteriaType, baselineData); - const resultFollowup = this.validateTimepoint('followup', trialCriteriaType, followupData); - const nonconformities = resultBaseline.concat(resultFollowup).concat(resultBoth); - const groupedNonConformities = this.groupNonConformities(nonconformities); - - // Keep both? Group the data only on viewer/measurementTable views? - // Work with not grouped data (worse lookup performance on measurementTableRow)? - this.nonconformities.set(nonconformities); - this.groupedNonConformities.set(groupedNonConformities); - - resolve(nonconformities); - }); - }); - } - - groupNonConformities(nonconformities) { - const groups = {}; - const toolsGroupsMap = this.measurementApi.toolsGroupsMap; - - nonconformities.forEach(nonConformity => { - if (nonConformity.isGlobal) { - groups.globals = groups.globals || { messages: [] }; - groups.globals.messages.push(nonConformity.message); - - return; - } - - nonConformity.measurements.forEach(measurement => { - const groupName = toolsGroupsMap[measurement.toolType]; - groups[groupName] = groups[groupName] || { measurementNumbers: {} }; - - const group = groups[groupName]; - const measureNumber = measurement.measurementNumber; - let measurementNumbers = group.measurementNumbers[measureNumber]; - - if (!measurementNumbers) { - measurementNumbers = group.measurementNumbers[measureNumber] = { - messages: [], - measurements: [] - }; - } - - measurementNumbers.messages.push(nonConformity.message); - measurementNumbers.measurements.push(measurement); - }); - }); - - return groups; - } - - validateTimepoint(timepointId, trialCriteriaType, data) { - const evaluators = this.getEvaluators(timepointId, trialCriteriaType); - let nonconformities = []; - - evaluators.forEach(evaluator => { - const maxTargets = evaluator.getMaxTargets(false); - const maxNewTargets = evaluator.getMaxTargets(true); - if (maxTargets) { - this.maxTargets.set(maxTargets); - } - - if (maxNewTargets) { - this.maxNewTargets.set(maxNewTargets); - } - - const result = evaluator.evaluate(data); - nonconformities = nonconformities.concat(result); - }); - - return nonconformities; - } - - getEvaluators(timepointId, trialCriteriaType) { - const evaluators = []; - const trialCriteriaTypeId = trialCriteriaType.id.toLowerCase(); - const evaluation = evaluations[trialCriteriaTypeId]; - - if (evaluation) { - const evaluationTimepoint = evaluation[timepointId]; - - if (evaluationTimepoint) { - evaluators.push(new CriteriaEvaluator(evaluationTimepoint)); - } - } - - return evaluators; - } - - /* - * Build the data that will be used to do the conformance criteria checks - */ - getData(timepointType) { - return new Promise((resolve, reject) => { - const data = { - targets: [], - nonTargets: [] - }; - - const studyPromises = []; - - const fillData = measurementType => { - const measurements = this.measurementApi.fetch(measurementType); - - measurements.forEach(measurement => { - const { studyInstanceUid } = measurement; - - const timepointId = measurement.timepointId; - const timepoint = timepointId && this.timepointApi.timepoints.findOne({ timepointId }); - - if (!timepoint || ((timepointType !== 'both') && (timepoint.timepointType !== timepointType))) { - return; - } - - const promise = OHIF.studies.loadStudy(studyInstanceUid); - promise.then(study => { - const studyMetadata = OHIF.viewerbase.getStudyMetadata(study); - - data[measurementType].push({ - measurement, - metadata: studyMetadata.getFirstInstance(), - timepoint - }); - }); - studyPromises.push(promise); - }); - }; - - fillData('targets'); - fillData('nonTargets'); - - Promise.all(studyPromises).then(() => { - resolve(data); - }).catch(reject); - }); - } - - static setEvaluationDefinitions(evaluationKey, evaluationDefinitions) { - evaluations[evaluationKey] = evaluationDefinitions; - } - -} - -OHIF.measurements.ConformanceCriteria = ConformanceCriteria; diff --git a/Packages/ohif-measurements/client/conformance/CriteriaEvaluator.js b/Packages/ohif-measurements/client/conformance/CriteriaEvaluator.js deleted file mode 100644 index 343e28cd0..000000000 --- a/Packages/ohif-measurements/client/conformance/CriteriaEvaluator.js +++ /dev/null @@ -1,90 +0,0 @@ -import { BaseCriterion } from './criteria/BaseCriterion'; -import * as Criteria from './criteria'; -import { _ } from 'meteor/underscore'; -import Ajv from 'ajv'; - -export class CriteriaEvaluator { - - constructor(criteriaObject) { - const criteriaValidator = this.getCriteriaValidator(); - this.criteria = []; - - if (!criteriaValidator(criteriaObject)) { - let message = ''; - _.each(criteriaValidator.errors, error => { - message += `\noptions${error.dataPath} ${error.message}`; - }); - throw new Error(message); - } - - _.each(criteriaObject, (optionsObject, criterionkey) => { - const Criterion = Criteria[`${criterionkey}Criterion`]; - const optionsArray = optionsObject instanceof Array ? optionsObject : [optionsObject]; - _.each(optionsArray, options => this.criteria.push(new Criterion(options))); - }); - } - - getMaxTargets(newTarget=false) { - let result = 0; - _.each(this.criteria, criterion => { - const newTargetMatch = newTarget === !!criterion.options.newTarget; - if (criterion instanceof Criteria.MaxTargetsCriterion && newTargetMatch) { - const { limit } = criterion.options; - if (limit > result) { - result = limit; - } - } - }); - return result; - } - - getCriteriaValidator() { - if (CriteriaEvaluator.criteriaValidator) { - return CriteriaEvaluator.criteriaValidator; - } - - const schema = { - properties: {}, - definitions: {} - }; - - _.each(Criteria, (Criterion, key) => { - if (Criterion.prototype instanceof BaseCriterion) { - const criterionkey = key.replace(/Criterion$/, ''); - const criterionDefinition = `#/definitions/${criterionkey}`; - - schema.definitions[criterionkey] = Criteria[`${criterionkey}Schema`]; - schema.properties[criterionkey] = { - oneOf: [ - { $ref: criterionDefinition }, - { - type: 'array', - items: { - $ref: criterionDefinition - } - } - ] - }; - } - }); - - CriteriaEvaluator.criteriaValidator = new Ajv().compile(schema); - return CriteriaEvaluator.criteriaValidator; - } - - evaluate(data) { - const nonconformities = []; - this.criteria.forEach(criterion => { - const criterionResult = criterion.evaluate(data); - if (!criterionResult.passed) { - nonconformities.push(criterionResult); - } - }); - return nonconformities; - } - - static setCriterion(criterionKey, criterionDefinitions) { - Criteria[criterionKey] = criterionDefinitions; - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/BaseCriterion.js b/Packages/ohif-measurements/client/conformance/criteria/BaseCriterion.js deleted file mode 100644 index f88d92170..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/BaseCriterion.js +++ /dev/null @@ -1,46 +0,0 @@ -import { _ } from 'meteor/underscore'; - -export class BaseCriterion { - - constructor(options) { - this.options = options; - } - - generateResponse(message, measurements) { - const passed = !message; - const isGlobal = !measurements || !measurements.length; - - return { - passed, - isGlobal, - message, - measurements - }; - } - - getNewTargetNumbers(data) { - const { options } = this; - const baselineMeasurementNumbers = []; - const newTargetNumbers = new Set(); - - if (options.newTarget) { - _.each(data.targets, target => { - const { measurementNumber } = target.measurement; - if (target.timepoint.timepointType === 'baseline') { - baselineMeasurementNumbers.push(measurementNumber); - } - }); - _.each(data.targets, target => { - const { measurementNumber } = target.measurement; - if (target.timepoint.timepointType === 'followup') { - if (!_.contains(baselineMeasurementNumbers, measurementNumber)) { - newTargetNumbers.add(measurementNumber); - } - } - }); - } - - return newTargetNumbers; - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/Location.js b/Packages/ohif-measurements/client/conformance/criteria/Location.js deleted file mode 100644 index 469392cf0..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/Location.js +++ /dev/null @@ -1,36 +0,0 @@ -import { BaseCriterion } from './BaseCriterion'; - -export const LocationSchema = { - type: 'object' -}; - -/* LocationCriterion - * Check if the there are non-target measurements with response different than "present" on baseline - */ -export class LocationCriterion extends BaseCriterion { - - constructor(options) { - super(options); - } - - evaluate(data) { - const items = data.targets.concat(data.nonTargets); - const measurements = []; - let message; - - items.forEach(item => { - const measurement = item.measurement; - - if (!measurement.location) { - measurements.push(measurement); - } - }); - - if (measurements.length) { - message = 'All measurements should have a location'; - } - - return this.generateResponse(message, measurements); - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/MaxTargets.js b/Packages/ohif-measurements/client/conformance/criteria/MaxTargets.js deleted file mode 100644 index f49213f0d..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/MaxTargets.js +++ /dev/null @@ -1,78 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { BaseCriterion } from './BaseCriterion'; - -export const MaxTargetsSchema = { - type: 'object', - properties: { - limit: { - label: 'Max targets allowed in study', - type: 'integer', - minimum: 0 - }, - newTarget: { - label: 'Flag to evaluate only new targets', - type: 'boolean' - }, - locationIn: { - label: 'Filter to evaluate only measurements with the specified locations', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - }, - locationNotIn: { - label: 'Filter to evaluate only measurements without the specified locations', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - } - }, - required: ['limit'] -}; - -/* MaxTargetsCriterion - * Check if the number of target measurements exceeded the limit allowed - * Options: - * limit: Max targets allowed in study - * newTarget: Flag to evaluate only new targets (must be evaluated on both) - * locationIn: Filter to evaluate only measurements with the specified locations - * locationNotIn: Filter to evaluate only measurements without the specified locations - * message: Message to be displayed in case of nonconformity - */ -export class MaxTargetsCriterion extends BaseCriterion { - - constructor(options) { - super(options); - } - - evaluate(data) { - const { options } = this; - - const newTargetNumbers = this.getNewTargetNumbers(data); - const measurementNumbers = []; - _.each(data.targets, target => { - const { location, measurementNumber, isSplitLesion } = target.measurement; - if (isSplitLesion) return; - if (options.newTarget && !newTargetNumbers.has(measurementNumber)) return; - if (options.locationIn && options.locationIn.indexOf(location) === -1) return; - if (options.locationNotIn && options.locationNotIn.indexOf(location) > -1) return; - measurementNumbers.push(measurementNumber); - }); - - let message; - if (measurementNumbers.length > options.limit) { - const increment = options.newTarget ? 'new ' : ''; - const plural = options.limit === 1 ? '' : 's'; - const amount = options.limit === 0 ? '' : `more than ${options.limit}`; - message = options.message || `The study should not have ${amount} ${increment}target${plural}.`; - } - - return this.generateResponse(message); - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/MaxTargetsPerOrgan.js b/Packages/ohif-measurements/client/conformance/criteria/MaxTargetsPerOrgan.js deleted file mode 100644 index 76298070a..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/MaxTargetsPerOrgan.js +++ /dev/null @@ -1,67 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { BaseCriterion } from './BaseCriterion'; - -export const MaxTargetsPerOrganSchema = { - type: 'object', - properties: { - limit: { - label: 'Max targets allowed per organ', - type: 'integer', - minimum: 1 - }, - newTarget: { - label: 'Flag to evaluate only new targets', - type: 'boolean' - } - }, - required: ['limit'] -}; - -/* - * MaxTargetsPerOrganCriterion - * Check if the number of target measurements per organ exceeded the limit allowed - * Options: - * limit: Max targets allowed in study - * newTarget: Flag to evaluate only new targets (must be evaluated on both) - */ -export class MaxTargetsPerOrganCriterion extends BaseCriterion { - - constructor(options) { - super(options); - } - - evaluate(data) { - const { options } = this; - const targetsPerOrgan = {}; - let measurements = []; - - const newTargetNumbers = this.getNewTargetNumbers(data); - _.each(data.targets, target => { - const { measurement } = target; - const { location, measurementNumber, isSplitLesion } = measurement; - - if (isSplitLesion) return; - - if (!targetsPerOrgan[location]) { - targetsPerOrgan[location] = new Set(); - } - - if (!options.newTarget || newTargetNumbers.has(measurementNumber)) { - targetsPerOrgan[location].add(measurementNumber); - } - - if (targetsPerOrgan[location].size > options.limit) { - measurements.push(measurement); - } - }); - - let message; - if (measurements.length) { - const increment = options.newTarget ? 'new ' : ''; - message = options.message || `Each organ should not have more than ${options.limit} ${increment}targets.`; - } - - return this.generateResponse(message, measurements); - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/MeasurementsLength.js b/Packages/ohif-measurements/client/conformance/criteria/MeasurementsLength.js deleted file mode 100644 index 33d73dfdb..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/MeasurementsLength.js +++ /dev/null @@ -1,149 +0,0 @@ -import { BaseCriterion } from './BaseCriterion'; - -export const MeasurementsLengthSchema = { - type: 'object', - properties: { - longAxis: { - label: 'Minimum length of long axis', - type: 'number', - minimum: 0 - }, - shortAxis: { - label: 'Minimum length of short axis', - type: 'number', - minimum: 0 - }, - longAxisSliceThicknessMultiplier: { - label: 'Length of long axis multiplier', - type: 'number', - minimum: 0 - }, - shortAxisSliceThicknessMultiplier: { - label: 'Length of short axis multiplier', - type: 'number', - minimum: 0 - }, - modalityIn: { - label: 'Filter to evaluate only measurements with the specified modalities', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - }, - modalityNotIn: { - label: 'Filter to evaluate only measurements without the specified modalities', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - }, - locationIn: { - label: 'Filter to evaluate only measurements with the specified locations', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - }, - locationNotIn: { - label: 'Filter to evaluate only measurements without the specified locations', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - }, - message: { - label: 'Message to be displayed in case of nonconformity', - type: 'string' - } - }, - anyOf: [ - { required: ['message', 'longAxis'] }, - { required: ['message', 'shortAxis'] }, - { required: ['message', 'longAxisSliceThicknessMultiplier'] }, - { required: ['message', 'shortAxisSliceThicknessMultiplier'] } - ] -}; - -/* - * MeasurementsLengthCriterion - * Check the measurements of all bidirectional tools based on - * short axis, long axis, modalities, location and slice thickness - * Options: - * longAxis: Minimum length of long axis - * shortAxis: Minimum length of short axis - * longAxisSliceThicknessMultiplier: Length of long axis multiplier - * shortAxisSliceThicknessMultiplier: Length of short axis multiplier - * modalityIn: Filter to evaluate only measurements with the specified modalities - * modalityNotIn: Filter to evaluate only measurements without the specified modalities - * locationIn: Filter to evaluate only measurements with the specified locations - * locationNotIn: Filter to evaluate only measurements without the specified locations - * message: Message to be displayed in case of nonconformity - */ -export class MeasurementsLengthCriterion extends BaseCriterion { - - constructor(options) { - super(options); - } - - evaluate(data) { - let message; - let measurements = []; - const { options } = this; - const longMultiplier = options.longAxisSliceThicknessMultiplier; - const shortMultiplier = options.shortAxisSliceThicknessMultiplier; - - data.targets.forEach(item => { - const { metadata, measurement } = item; - const { location } = measurement; - - let { longestDiameter, shortestDiameter } = measurement; - if (measurement.childToolsCount) { - const child = measurement.bidirectional; - longestDiameter = (child && child.longestDiameter) || 0; - shortestDiameter = (child && child.shortestDiameter) || 0; - } - - const { sliceThickness } = metadata; - const modality = (metadata.getRawValue('x00080060') || '').toUpperCase(); - - // Stop here if the measurement does not match the modality and location filters - if (options.locationIn && options.locationIn.indexOf(location) === -1) return; - if (options.modalityIn && options.modalityIn.indexOf(modality) === -1) return; - if (options.locationNotIn && options.locationNotIn.indexOf(location) > -1) return; - if (options.modalityNotIn && options.modalityNotIn.indexOf(modality) > -1) return; - - // Check the measurement length - const failed = ( - (options.longAxis && longestDiameter < options.longAxis) || - (options.shortAxis && shortestDiameter < options.shortAxis) || ( - longMultiplier && !isNaN(sliceThickness) && - longestDiameter < (longMultiplier * sliceThickness) - ) || ( - shortMultiplier && !isNaN(sliceThickness) && - shortestDiameter < (shortMultiplier * sliceThickness) - ) - ); - - // Mark this measurement as invalid if some of the checks have failed - if (failed) { - measurements.push(measurement); - } - }); - - // Use the options' message if some measurement is invalid - if (measurements.length) { - message = options.message; - } - - return this.generateResponse(message, measurements); - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/Modality.js b/Packages/ohif-measurements/client/conformance/criteria/Modality.js deleted file mode 100644 index a18451f8b..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/Modality.js +++ /dev/null @@ -1,82 +0,0 @@ -import { BaseCriterion } from './BaseCriterion'; -import { _ } from 'meteor/underscore'; - -export const ModalitySchema = { - type: 'object', - properties: { - method: { - label: 'Specify if it\'s goinig to "allow" or "deny" the modalities', - type: 'string', - enum: ['allow', 'deny'] - }, - measurementTypes: { - label: 'List of measurement types that will be evaluated', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - }, - modalities: { - label: 'List of allowed/denied modalities', - type: 'array', - items: { - type: 'string' - }, - minItems: 1, - uniqueItems: true - } - }, - required: ['method', 'modalities'] -}; - -/* - * ModalityCriteria - * Check if a modality is allowed or denied - * Options: - * method (string): Specify if it\'s goinig to "allow" or "deny" the modalities - * measurementTypes (string[]): List of measurement types that will be evaluated - * modalities (string[]): List of allowed/denied modalities - */ -export class ModalityCriterion extends BaseCriterion { - - constructor(options) { - super(options); - } - - evaluate(data) { - const measurementTypes = this.options.measurementTypes || ['targets']; - const modalitiesSet = new Set(this.options.modalities); - const validationMethod = this.options.method; - const measurements = []; - const invalidModalities = []; - let message; - - measurementTypes.forEach(measurementType => { - const items = data[measurementType]; - - items.forEach(item => { - const { measurement, metadata } = item; - const modality = (metadata.getRawValue('x00080060') || '').toUpperCase(); - - if (((validationMethod === 'allow') && !modalitiesSet.has(modality)) || - ((validationMethod === 'deny') && modalitiesSet.has(modality))) { - measurements.push(measurement); - invalidModalities.push(modality); - } - }); - }); - - if (measurements.length) { - const uniqueModalities = _.uniq(invalidModalities); - const uniqueModalitiesText = uniqueModalities.join(', '); - const modalityText = uniqueModalities.length > 1 ? 'modalities' : 'modality'; - - message = `The ${modalityText} ${uniqueModalitiesText} should not be used as a method of measurement`; - } - - return this.generateResponse(message, measurements); - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/NonTargetResponse.js b/Packages/ohif-measurements/client/conformance/criteria/NonTargetResponse.js deleted file mode 100644 index 41d3662ae..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/NonTargetResponse.js +++ /dev/null @@ -1,37 +0,0 @@ -import { BaseCriterion } from './BaseCriterion'; - -export const NonTargetResponseSchema = { - type: 'object' -}; - -/* NonTargetResponseCriterion - * Check if the there are non-target measurements with response different than "present" on baseline - */ -export class NonTargetResponseCriterion extends BaseCriterion { - - constructor(options) { - super(options); - } - - evaluate(data) { - const items = data.nonTargets; - const measurements = []; - let message; - - items.forEach(item => { - const measurement = item.measurement; - const response = (measurement.response || '').toLowerCase(); - - if (response !== 'present') { - measurements.push(measurement); - } - }); - - if (measurements.length) { - message = 'Non-targets can only be assessed as "present"'; - } - - return this.generateResponse(message, measurements); - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/TargetType.js b/Packages/ohif-measurements/client/conformance/criteria/TargetType.js deleted file mode 100644 index 90009d4a3..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/TargetType.js +++ /dev/null @@ -1,36 +0,0 @@ -import { BaseCriterion } from './BaseCriterion'; - -export const TargetTypeSchema = { - type: 'object' -}; - -/* TargetTypeCriterion - * Check if the there are non-bidirectional target measurements on baseline - */ -export class TargetTypeCriterion extends BaseCriterion { - - constructor(options) { - super(options); - } - - evaluate(data) { - const items = data.targets; - const measurements = []; - let message; - - items.forEach(item => { - const measurement = item.measurement; - - if (measurement.toolType !== 'bidirectional' && !measurement.bidirectional) { - measurements.push(measurement); - } - }); - - if (measurements.length) { - message = 'Target lesions must have measurements (cannot be assessed as CR, UN/NE, EX)'; - } - - return this.generateResponse(message, measurements); - } - -} diff --git a/Packages/ohif-measurements/client/conformance/criteria/index.js b/Packages/ohif-measurements/client/conformance/criteria/index.js deleted file mode 100644 index 5501e2c7a..000000000 --- a/Packages/ohif-measurements/client/conformance/criteria/index.js +++ /dev/null @@ -1,7 +0,0 @@ -export * from './Location'; -export * from './MaxTargetsPerOrgan'; -export * from './MaxTargets'; -export * from './MeasurementsLength'; -export * from './Modality'; -export * from './NonTargetResponse'; -export * from './TargetType'; diff --git a/Packages/ohif-measurements/client/conformance/evaluations/index.js b/Packages/ohif-measurements/client/conformance/evaluations/index.js deleted file mode 100644 index 502ef29dd..000000000 --- a/Packages/ohif-measurements/client/conformance/evaluations/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import * as recistEvaluation from './recist.json'; - -export const recist = recistEvaluation; diff --git a/Packages/ohif-measurements/client/conformance/evaluations/recist.json b/Packages/ohif-measurements/client/conformance/evaluations/recist.json deleted file mode 100644 index 2dd5b988f..000000000 --- a/Packages/ohif-measurements/client/conformance/evaluations/recist.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "both": { - "Location": {} - }, - "baseline": { - "TargetType": {}, - "MaxTargetsPerOrgan": { - "limit": 2 - }, - "MaxTargets": { - "limit": 5 - }, - "MeasurementsLength": [{ - "longAxis": 10, - "longAxisSliceThicknessMultiplier": 2, - "modalityIn": ["CT", "MR"], - "locationNotIn": ["Lymph Node"], - "message": "Extranodal lesions must be >= 10mm long axis AND >= double the acquisition slice thickness by CT and MR" - }, { - "shortAxis": 20, - "longAxis": 20, - "modalityIn": ["PX", "XA"], - "locationNotIn": ["Lymph Node"], - "message": "Extranodal lesions must be >= 20mm on chest x-ray (although x-rays rarely used for clinical trial assessment)" - }, { - "shortAxis": 15, - "shortAxisSliceThicknessMultiplier": 2, - "modalityIn": ["CT", "MR"], - "locationIn": ["Lymph Node"], - "message": "Nodal lesions must be >= 15mm short axis AND >= double the acquisition slice thickness by CT and MR" - }] - }, - "followup": {} -} diff --git a/Packages/ohif-measurements/client/conformance/index.js b/Packages/ohif-measurements/client/conformance/index.js deleted file mode 100644 index 4f89dd19e..000000000 --- a/Packages/ohif-measurements/client/conformance/index.js +++ /dev/null @@ -1 +0,0 @@ -import './ConformanceCriteria'; diff --git a/Packages/ohif-measurements/client/helpers/index.js b/Packages/ohif-measurements/client/helpers/index.js deleted file mode 100644 index fc444bbe9..000000000 --- a/Packages/ohif-measurements/client/helpers/index.js +++ /dev/null @@ -1 +0,0 @@ -import './measurements.js'; diff --git a/Packages/ohif-measurements/client/helpers/measurements.js b/Packages/ohif-measurements/client/helpers/measurements.js deleted file mode 100644 index 1e1f1724b..000000000 --- a/Packages/ohif-measurements/client/helpers/measurements.js +++ /dev/null @@ -1,14 +0,0 @@ -import { Template } from 'meteor/templating'; - -import { OHIF } from 'meteor/ohif:core'; - -// Get the current measurement API configuration with information about tools, data exchange -// and data validation. -Template.registerHelper('measurementConfiguration', () => { - return OHIF.measurements.MeasurementApi.getConfiguration(); -}); - -// Translates the location and return a string containing its label -Template.registerHelper('getLocationLabel', label => { - return OHIF.measurements.getLocationLabel(label); -}); diff --git a/Packages/ohif-measurements/client/index.js b/Packages/ohif-measurements/client/index.js deleted file mode 100644 index 976b7fc4a..000000000 --- a/Packages/ohif-measurements/client/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import './conformance'; -import './lib'; -import './helpers'; -import './components'; diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/MeasurementHandlers.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/MeasurementHandlers.js deleted file mode 100644 index c0c954f53..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/MeasurementHandlers.js +++ /dev/null @@ -1,81 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import handleSingleMeasurementAdded from './handleSingleMeasurementAdded'; -import handleChildMeasurementAdded from './handleChildMeasurementAdded'; -import handleSingleMeasurementModified from './handleSingleMeasurementModified'; -import handleChildMeasurementModified from './handleChildMeasurementModified'; -import handleSingleMeasurementRemoved from './handleSingleMeasurementRemoved'; -import handleChildMeasurementRemoved from './handleChildMeasurementRemoved'; - -const MeasurementHandlers = { - handleSingleMeasurementAdded, - handleChildMeasurementAdded, - handleSingleMeasurementModified, - handleChildMeasurementModified, - handleSingleMeasurementRemoved, - handleChildMeasurementRemoved, - - onAdded(event, instance) { - const eventData = event.detail; - const { toolType } = eventData; - const { toolGroupId, toolGroup, tool } = OHIF.measurements.getToolConfiguration(toolType); - const params = { - instance, - eventData, - tool, - toolGroupId, - toolGroup - }; - - if (!tool) return; - - if (tool.parentTool) { - this.handleChildMeasurementAdded(params); - } else { - this.handleSingleMeasurementAdded(params); - } - }, - - onModified(event, instance) { - const eventData = event.detail; - const { toolType } = eventData; - const { toolGroupId, toolGroup, tool } = OHIF.measurements.getToolConfiguration(toolType); - const params = { - instance, - eventData, - tool, - toolGroupId, - toolGroup - }; - - if (!tool) return; - - if (tool.parentTool) { - this.handleChildMeasurementModified(params); - } else { - this.handleSingleMeasurementModified(params); - } - }, - - onRemoved(event, instance) { - const eventData = event.detail; - const { toolType } = eventData; - const { toolGroupId, toolGroup, tool } = OHIF.measurements.getToolConfiguration(toolType); - const params = { - instance, - eventData, - tool, - toolGroupId, - toolGroup - }; - - if (!tool) return; - - if (tool.parentTool) { - MeasurementHandlers.handleChildMeasurementRemoved(params); - } else { - MeasurementHandlers.handleSingleMeasurementRemoved(params); - } - } -}; - -OHIF.measurements.MeasurementHandlers = MeasurementHandlers; diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/getImageAttributes.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/getImageAttributes.js deleted file mode 100644 index 42a0e2fa1..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/getImageAttributes.js +++ /dev/null @@ -1,32 +0,0 @@ -import { cornerstone } from 'meteor/ohif:cornerstone'; - -export default function (element) { - // Get the Cornerstone imageId - const enabledElement = cornerstone.getEnabledElement(element); - const imageId = enabledElement.image.imageId; - - // Get studyInstanceUid & patientId - const study = cornerstone.metaData.get('study', imageId); - const studyInstanceUid = study.studyInstanceUid; - const patientId = study.patientId; - - // Get seriesInstanceUid - const series = cornerstone.metaData.get('series', imageId); - const seriesInstanceUid = series.seriesInstanceUid; - - // Get sopInstanceUid - const sopInstance = cornerstone.metaData.get('instance', imageId); - const sopInstanceUid = sopInstance.sopInstanceUid; - const frameIndex = sopInstance.frame || 0; - - const imagePath = [studyInstanceUid, seriesInstanceUid, sopInstanceUid, frameIndex].join('_'); - - return { - patientId, - studyInstanceUid, - seriesInstanceUid, - sopInstanceUid, - frameIndex, - imagePath - }; -} diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementAdded.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementAdded.js deleted file mode 100644 index d01503c1b..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementAdded.js +++ /dev/null @@ -1,101 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; -import getImageAttributes from './getImageAttributes'; - -export default function ({ instance, eventData, tool, toolGroupId, toolGroup }) { - const { measurementApi } = instance.data; - const { measurementData } = eventData; - - const Collection = measurementApi.tools[tool.parentTool]; - - // Stop here if the tool data shall not be persisted (e.g. temp tools) - if (!Collection) return; - - // Stop here if there's no measurement data or if it was cancelled - if (!measurementData || measurementData.cancelled) return; - - OHIF.log.info('CornerstoneToolsMeasurementAdded'); - - const imageAttributes = getImageAttributes(eventData.element); - const measurement = { - toolType: tool.parentTool, - measurementNumber: measurementData.measurementNumber, - userId: OHIF.user.getUserId(), - patientId: imageAttributes.patientId, - studyInstanceUid: imageAttributes.studyInstanceUid - }; - - const additionalProperties = _.extend(imageAttributes, { - userId: OHIF.user.getUserId() - }); - - const childMeasurement = _.extend({}, measurementData, additionalProperties); - - const parentMeasurement = Collection.findOne({ - toolType: tool.parentTool, - patientId: imageAttributes.patientId, - [tool.attribute]: null - }); - - // Check if a measurement to fit this child tool already exists - if (parentMeasurement) { - const key = tool.attribute; - - // Add the createdAt attribute - childMeasurement.createdAt = new Date(); - - // Add the child measurement - measurement[key] = childMeasurement; - - // Clean the measurement according to the Schema - Collection._c2._simpleSchema.clean(measurement); - - // Update the measurement in the collection - Collection.update(parentMeasurement._id, { - $set: { [key]: measurement[key] }, - $inc: { childToolsCount: 1 } - }); - - // Update the measurementData ID and measurementNumber - measurementData._id = parentMeasurement._id; - measurementData.measurementNumber = parentMeasurement.measurementNumber; - } else { - measurement[tool.attribute] = _.extend({}, measurementData, additionalProperties); - - // Get the related timepoint by the measurement number and use its location if defined - const relatedTimepoint = Collection.findOne({ - measurementNumber: measurement.measurementNumber, - toolType: tool.parentTool, - patientId: imageAttributes.patientId - }); - - // Use the related timepoint location if found and defined - if (relatedTimepoint && relatedTimepoint.location) { - measurement.location = relatedTimepoint.location; - } - - // Use the related timepoint description if found and defined - if (relatedTimepoint && relatedTimepoint.description) { - measurement.description = relatedTimepoint.description; - } - - // Clean the measurement according to the Schema - Collection._c2._simpleSchema.clean(measurement); - - // Insert the new measurement into the collection - measurementData._id = Collection.insert(measurement); - - // Get the updated measurement number after inserting - Meteor.defer(() => { - measurementData.measurementNumber = Collection.findOne(measurementData._id).measurementNumber; - cornerstone.updateImage(OHIF.viewerbase.viewportUtils.getActiveViewportElement()); - }); - } - - // Notify that viewer suffered changes - if (tool.toolGroup !== 'temp') { - OHIF.measurements.triggerTimepointUnsavedChanges(eventData.toolType); - } -} diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementModified.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementModified.js deleted file mode 100644 index 835ca94c1..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementModified.js +++ /dev/null @@ -1,42 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -export default function ({ instance, eventData, tool, toolGroupId, toolGroup }) { - const { measurementApi } = instance.data; - const { measurementData } = eventData; - - const Collection = measurementApi.tools[tool.parentTool]; - - // Stop here if the tool data shall not be persisted (e.g. temp tools) - if (!Collection) return; - - OHIF.log.info('CornerstoneToolsMeasurementModified'); - - const measurement = Collection.findOne(measurementData._id); - const childMeasurement = measurement && measurement[tool.attribute]; - - // Stop here if the measurement is already deleted - if (!childMeasurement) return; - - // Update the collection data with the cornerstone measurement data - const ignoredKeys = ['location', 'description', 'response']; - Object.keys(measurementData).forEach(key => { - if (_.contains(ignoredKeys, key)) return; - childMeasurement[key] = measurementData[key]; - }); - - // If the measurement configuration includes a value for Viewport, - // we will populate this with the Cornerstone Viewport - if (Collection._c2._simpleSchema.schema(`${tool.attribute}.viewport`)) { - childMeasurement.viewport = cornerstone.getViewport(eventData.element); - } - - // Update the measurement in the collection - Collection.update(measurement._id, { $set: { [tool.attribute]: childMeasurement } }); - - // Notify that viewer suffered changes - if (tool.toolGroup !== 'temp') { - OHIF.measurements.triggerTimepointUnsavedChanges(eventData.toolType); - } -} diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementRemoved.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementRemoved.js deleted file mode 100644 index d7f77cb74..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleChildMeasurementRemoved.js +++ /dev/null @@ -1,42 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -export default function ({ instance, eventData, tool, toolGroupId, toolGroup }) { - OHIF.log.info('CornerstoneToolsMeasurementRemoved'); - const measurementData = eventData.measurementData; - const { measurementApi, timepointApi } = instance.data; - const Collection = measurementApi.tools[tool.parentTool]; - - // Stop here if the tool data shall not be persisted (e.g. temp tools) - if (!Collection) return; - - const measurement = Collection.findOne(measurementData._id); - - // Stop here if the measurement is already gone or never existed - if (!measurement) return; - - if (measurement.childToolsCount === 1) { - // Remove the measurement - Collection.remove(measurement._id); - - // Sync the new measurement data with cornerstone tools - const baseline = timepointApi.baseline(); - measurementApi.sortMeasurements(baseline.timepointId); - } else { - // Update the measurement in the collection - Collection.update(measurement._id, { - $set: { [tool.attribute]: null }, - $inc: { childToolsCount: -1 } - }); - } - - // Repaint the images on all viewports without the removed measurements - _.each($('.imageViewerViewport'), element => cornerstone.updateImage(element)); - - // Notify that viewer suffered changes - if (tool.toolGroup !== 'temp') { - OHIF.measurements.triggerTimepointUnsavedChanges(eventData.toolType); - } -} diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementAdded.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementAdded.js deleted file mode 100644 index 226ba89a7..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementAdded.js +++ /dev/null @@ -1,61 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; -import getImageAttributes from './getImageAttributes'; - -export default function ({ instance, eventData, tool }) { - const { measurementApi } = instance.data; - const { measurementData, toolType } = eventData; - - const Collection = measurementApi.tools[toolType]; - - // Stop here if the tool data shall not be persisted (e.g. temp tools) - if (!Collection) return; - - // Stop here if there's no measurement data or if it was cancelled - if (!measurementData || measurementData.cancelled) return; - - OHIF.log.info('CornerstoneToolsMeasurementAdded'); - - const imageAttributes = getImageAttributes(eventData.element); - const measurement = _.extend({}, measurementData, imageAttributes, { - measurementNumber: measurementData.measurementNumber, - userId: OHIF.user.getUserId(), - toolType - }); - - // Get the related timepoint by the measurement number and use its location if defined - const relatedTimepoint = Collection.findOne({ - measurementNumber: measurement.measurementNumber, - toolType: measurementData.toolType, - patientId: imageAttributes.patientId, - }); - - // Use the related timepoint location if found and defined - if (relatedTimepoint && relatedTimepoint.location) { - measurement.location = relatedTimepoint.location; - } - - // Use the related timepoint description if found and defined - if (relatedTimepoint && relatedTimepoint.description) { - measurement.description = relatedTimepoint.description; - } - - // Clean the measurement according to the Schema - Collection._c2._simpleSchema.clean(measurement); - - // Insert the new measurement into the collection - measurementData._id = Collection.insert(measurement); - - // Get the updated measurement number after inserting - Meteor.defer(() => { - measurementData.measurementNumber = Collection.findOne(measurementData._id).measurementNumber; - cornerstone.updateImage(OHIF.viewerbase.viewportUtils.getActiveViewportElement()); - }); - - // Notify that viewer suffered changes - if (tool.toolGroup !== 'temp') { - OHIF.measurements.triggerTimepointUnsavedChanges(eventData.toolType); - } -} diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementModified.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementModified.js deleted file mode 100644 index 88e8988f6..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementModified.js +++ /dev/null @@ -1,44 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -export default function ({ instance, eventData, tool, toolGroupId, toolGroup }) { - const { measurementApi } = instance.data; - const { measurementData, toolType } = eventData; - - const Collection = measurementApi.tools[toolType]; - - // Stop here if the tool data shall not be persisted (e.g. temp tools) - if (!Collection) return; - - OHIF.log.info('CornerstoneToolsMeasurementModified'); - - const measurement = Collection.findOne(measurementData._id); - - // Stop here if the measurement is already deleted - if (!measurement) return; - - // Update the collection data with the cornerstone measurement data - const ignoredKeys = ['location', 'description', 'response']; - Object.keys(measurementData).forEach(key => { - if (_.contains(ignoredKeys, key)) return; - measurement[key] = measurementData[key]; - }); - - const measurementId = measurement._id; - delete measurement._id; - - // If the measurement configuration includes a value for Viewport, - // we will populate this with the Cornerstone Viewport - if (Collection._c2._simpleSchema.schema('viewport')) { - measurement.viewport = cornerstone.getViewport(eventData.element); - } - - // Update the measurement in the collection - Collection.update(measurementId, { $set: measurement }); - - // Notify that viewer suffered changes - if (tool.toolGroup !== 'temp') { - OHIF.measurements.triggerTimepointUnsavedChanges(eventData.toolType); - } -} diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementRemoved.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementRemoved.js deleted file mode 100644 index 5310fc28e..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/handleSingleMeasurementRemoved.js +++ /dev/null @@ -1,39 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -export default function({ instance, eventData, tool, toolGroupId, toolGroup }) { - OHIF.log.info('CornerstoneToolsMeasurementRemoved'); - const measurementData = eventData.measurementData; - const { measurementApi, timepointApi } = instance.data; - const Collection = measurementApi.tools[eventData.toolType]; - - // Stop here if the tool data shall not be persisted (e.g. temp tools) - if (!Collection) return; - - const measurementTypeId = measurementApi.toolsGroupsMap[eventData.toolType]; - const measurement = Collection.findOne(measurementData._id); - - // Stop here if the measurement is already gone or never existed - if (!measurement) return; - - // Remove all the measurements with the given type and number - const { measurementNumber, timepointId } = measurement; - measurementApi.deleteMeasurements(measurementTypeId, { - measurementNumber, - timepointId - }); - - // Sync the new measurement data with cornerstone tools - const baseline = timepointApi.baseline(); - measurementApi.sortMeasurements(baseline.timepointId); - - // Repaint the images on all viewports without the removed measurements - _.each($('.imageViewerViewport:not(.empty)'), element => cornerstone.updateImage(element)); - - // Notify that viewer suffered changes - if (tool.toolGroup !== 'temp') { - OHIF.measurements.triggerTimepointUnsavedChanges(eventData.toolType); - } -} diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers/index.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers/index.js deleted file mode 100644 index 3d74e2933..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers/index.js +++ /dev/null @@ -1 +0,0 @@ -import './MeasurementHandlers'; diff --git a/Packages/ohif-measurements/client/lib/MeasurementManager.js b/Packages/ohif-measurements/client/lib/MeasurementManager.js deleted file mode 100644 index 738b95b92..000000000 --- a/Packages/ohif-measurements/client/lib/MeasurementManager.js +++ /dev/null @@ -1,25 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -class MeasurementManager { - - /** - * If the current Measurements Number already exists - * for any other timepoint, returns lesion locationUID - * @param measurementData - * @returns {number} - Measurement location ID - */ - static getLocationIdIfMeasurementExists(measurementData, collection) { - const measurement = collection.findOne({ - measurementNumber: measurementData.measurementNumber - }); - - if (!measurement) { - return; - } - - return measurement.locationId; - } - -} - -OHIF.measurements.MeasurementManager = MeasurementManager; diff --git a/Packages/ohif-measurements/client/lib/activateMeasurements.js b/Packages/ohif-measurements/client/lib/activateMeasurements.js deleted file mode 100644 index 3b480f18e..000000000 --- a/Packages/ohif-measurements/client/lib/activateMeasurements.js +++ /dev/null @@ -1,87 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { OHIF } from 'meteor/ohif:core'; - -/** - * Activates a specific tool data instance and deactivates all other - * target and non-target measurement data - * - * @param element - * @param measurementData - */ -function activateTool(measurementData) { - const toolType = measurementData.toolType; - const imageId = OHIF.viewerbase.getImageIdForImagePath(measurementData.imagePath); - const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.saveToolState(); - - const imageToolState = toolState[imageId]; - const toolData = imageToolState && imageToolState[toolType]; - if (!toolData || !toolData.data || !toolData.data.length) { - return; - } - - // When a measurement is selected, it will be activated in Cornerstone's - // tool data - const tool = toolData.data.find(data => data._id === measurementData._id); - if (tool) { - tool.active = true; - } - - cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(toolState); -} - -/** - * Switch to the image of the correct image index - * Activate the selected measurement on the switched image (color to be green) - * Deactivate all other measurements on the switched image (color to be white) - */ -OHIF.measurements.activateMeasurements = (element, measurementData) => { - OHIF.log.info('activateMeasurements'); - - // If Cornerstone Viewport information was stored while the measurement was created, - // we should re-apply this data when activating the measurement. - const viewport = cornerstone.getViewport(element); - - // TODO: Make this an option somewhere? For now we only want to apply windowWidth and - // windowCenter - const viewportPropertiesToUpdate = ['voi']; - - // Check to make sure we actually stored viewport data before trying to apply it - if (measurementData.viewport) { - - // For each property which is not undefined, update it's value from the stored - // measurement data - viewportPropertiesToUpdate.forEach(prop => { - const storedPropertyValue = measurementData.viewport[prop]; - if (storedPropertyValue === undefined) { - return; - } - - viewport[prop] = storedPropertyValue; - }); - - // Apply the updated viewport parameters to the element - cornerstone.setViewport(element, viewport); - } - - // Activate the tool in the tool data - activateTool(measurementData); - - const enabledElement = cornerstone.getEnabledElement(element); - const currentImageId = enabledElement.image.imageId; - const toolData = cornerstoneTools.getToolState(element, 'stack'); - const imageId = OHIF.viewerbase.getImageIdForImagePath(measurementData.imagePath); - const imageIdIndex = toolData.data[0].imageIds.indexOf(imageId); - - // If we aren't currently displaying the image that this tool is on, - // scroll to it now. - if (currentImageId !== imageId) { - cornerstoneTools.scrollToIndex(element, imageIdIndex); - } - - const $element = $(element); - if (!$element.find('canvas').length) return; - - $element.trigger('ViewerMeasurementsActivated'); - cornerstone.updateImage(element); -}; diff --git a/Packages/ohif-measurements/client/lib/clearCornerstoneToolState.js b/Packages/ohif-measurements/client/lib/clearCornerstoneToolState.js deleted file mode 100644 index 3ba308818..000000000 --- a/Packages/ohif-measurements/client/lib/clearCornerstoneToolState.js +++ /dev/null @@ -1,6 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { cornerstoneTools } from 'meteor/ohif:cornerstone'; - -OHIF.measurements.clearCornerstoneToolState = () => { - cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState({}); -}; diff --git a/Packages/ohif-measurements/client/lib/deactivateAllToolData.js b/Packages/ohif-measurements/client/lib/deactivateAllToolData.js deleted file mode 100644 index 9a85e5275..000000000 --- a/Packages/ohif-measurements/client/lib/deactivateAllToolData.js +++ /dev/null @@ -1,26 +0,0 @@ -import { OHIF } from 'meteor/ohif:core' - -/** - * Sets all tool data entries value for 'active' to false - * This is used to remove the active color on entire sets of tools - */ -OHIF.measurements.deactivateAllToolData = () => { - const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.saveToolState() - - Object.keys(toolState).forEach(imageId => { - const toolData = toolState[imageId]; - - Object.keys(toolData).forEach(toolType => { - const specificToolData = toolData[toolType] - if (!specificToolData || !specificToolData.data || !specificToolData.data.length) { - return - } - - specificToolData.data.forEach(data => { - data.active = false - }); - }); - }); - - cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(toolState) -} diff --git a/Packages/ohif-measurements/client/lib/exportPdf.js b/Packages/ohif-measurements/client/lib/exportPdf.js deleted file mode 100644 index 7c1063eb0..000000000 --- a/Packages/ohif-measurements/client/lib/exportPdf.js +++ /dev/null @@ -1,69 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { MeasurementReport } from 'meteor/ohif:measurements/client/reports/measurement'; - -OHIF.measurements.exportPdf = (measurementApi, timepointApi) => { - const currentTimepoint = timepointApi.current(); - const { timepointId } = currentTimepoint; - const study = OHIF.viewer.Studies.findBy({ - studyInstanceUid: currentTimepoint.studyInstanceUids[0] - }); - const report = new MeasurementReport({ - header: { - trial: 'RECIST 1.1', - patientName: OHIF.viewerbase.helpers.formatPN(study.patientName), - mrn: study.patientId, - timepoint: timepointApi.name(currentTimepoint) - } - }); - - const printMeasurement = (measurement, callback) => { - OHIF.measurements.getImageDataUrl({ measurement }).then(imageDataUrl => { - const imageId = OHIF.viewerbase.getImageIdForImagePath(measurement.imagePath); - const series = cornerstone.metaData.get('series', imageId); - const instance = cornerstone.metaData.get('instance', imageId); - - let info = measurement.response; - if (!info) { - info = measurement.longestDiameter; - if (measurement.shortestDiameter) { - info += ` × ${measurement.shortestDiameter}`; - } - - info += ' mm'; - } - - info += ` (S:${series.seriesNumber}, I:${instance.instanceNumber})`; - - let type = measurementApi.toolsGroupsMap[measurement.toolType]; - type = type === 'targets' ? 'Target' : 'Non-target'; - - report.printMeasurement({ - type, - number: measurement.measurementNumber, - location: OHIF.measurements.getLocationLabel(measurement.location) || '', - info, - image: imageDataUrl - }); - - processMeasurements(callback); - }); - }; - - const processMeasurements = callback => { - const current = iterator.next(); - if (current.done) { - callback(); - return; - } - - const measurement = current.value; - printMeasurement(measurement, callback); - }; - - const targets = measurementApi.fetch('targets', { timepointId }); - const nonTargets = measurementApi.fetch('nonTargets', { timepointId }); - const measurements = targets.concat(nonTargets); - const iterator = measurements[Symbol.iterator](); - - processMeasurements(() => report.save('measurements.pdf')); -}; diff --git a/Packages/ohif-measurements/client/lib/exportToCsv.js b/Packages/ohif-measurements/client/lib/exportToCsv.js deleted file mode 100644 index 0a6c5799c..000000000 --- a/Packages/ohif-measurements/client/lib/exportToCsv.js +++ /dev/null @@ -1,25 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { getCSVMeasurementData } from '../reports/reportMeasurementDataToCSV'; - -const downloadCSV = (csvData, args = {}) => { - let data, link; - - const filename = args.filename || 'export.csv'; - - if (csvData == null) return; - - if (!csvData.match(/^data:text\/csv/i)) { - csvData = 'data:text/csv;charset=utf-8,' + csvData; - } - - data = encodeURI(csvData); - link = document.createElement('a'); - link.setAttribute('href', data); - link.setAttribute('download', filename); - link.click(); -}; - -OHIF.measurements.exportCSV = async (measurementApi, timepointApi) => { - const csvData = await getCSVMeasurementData(measurementApi, timepointApi); - downloadCSV(csvData); -}; diff --git a/Packages/ohif-measurements/client/lib/findAndRenderDisplaySet.js b/Packages/ohif-measurements/client/lib/findAndRenderDisplaySet.js deleted file mode 100644 index 8ec80a6c3..000000000 --- a/Packages/ohif-measurements/client/lib/findAndRenderDisplaySet.js +++ /dev/null @@ -1,27 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.measurements.findAndRenderDisplaySet = (displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) => { - // Find the proper stack to display - const stacksFromSeries = displaySets.filter(stack => stack.seriesInstanceUid === seriesInstanceUid); - const stack = stacksFromSeries.find(stack => { - const imageIndex = stack.images.findIndex(image => image.getSOPInstanceUID() === sopInstanceUid); - return imageIndex > -1; - }); - - // TODO: make this work for multi-frame instances - const specificImageIndex = stack.images.findIndex(image => image.getSOPInstanceUID() === sopInstanceUid); - - const displaySetData = { - studyInstanceUid: studyInstanceUid, - seriesInstanceUid: seriesInstanceUid, - displaySetInstanceUid: stack.displaySetInstanceUid, - currentImageIdIndex: specificImageIndex - }; - - // Add a renderedCallback to activate the measurements once it's - if (renderedCallback) { - displaySetData.renderedCallback = renderedCallback; - } - - OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, displaySetData); -}; diff --git a/Packages/ohif-measurements/client/lib/getActiveTimepoint.js b/Packages/ohif-measurements/client/lib/getActiveTimepoint.js deleted file mode 100644 index 8d37f4363..000000000 --- a/Packages/ohif-measurements/client/lib/getActiveTimepoint.js +++ /dev/null @@ -1,13 +0,0 @@ -import { Session } from 'meteor/session'; -import { OHIF } from 'meteor/ohif:core'; - -/** - * Extensible method to get the timepoint of the active viewport - * - * @returns {Object} - Timepoint data for the active viewport - */ -OHIF.measurements.getActiveTimepoint = () => { - const activeViewportIndex = Session.get('activeViewport'); - const { studyInstanceUid } = OHIF.viewerbase.layoutManager.viewportData[activeViewportIndex]; - return OHIF.viewer.timepointApi.study(studyInstanceUid)[0]; -}; diff --git a/Packages/ohif-measurements/client/lib/getImageDataUrl.js b/Packages/ohif-measurements/client/lib/getImageDataUrl.js deleted file mode 100644 index 04b7f012b..000000000 --- a/Packages/ohif-measurements/client/lib/getImageDataUrl.js +++ /dev/null @@ -1,181 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { $ } from 'meteor/jquery'; -import { cornerstone, cornerstoneMath, cornerstoneTools } from 'meteor/ohif:cornerstone'; - -OHIF.measurements.getImageDataUrl = ({ - imageType='image/jpeg', - quality=1, - width=512, - height=512, - cacheImage=true, - imagePath, - measurement, - alwaysVisibleText=true, - viewport -}) => { - imagePath = imagePath || measurement.imagePath; - const imageId = OHIF.viewerbase.getImageIdForImagePath(imagePath); - - // Create a deep copy of the measurement to prevent changing its original properties - if (measurement) { - measurement = $.extend(true, {}, measurement); - } - - return new Promise((resolve, reject) => { - const loadMethod = cacheImage ? 'loadAndCacheImage' : 'loadImage'; - cornerstone[loadMethod](imageId).then(image => { - // Create a cornerstone enabled element to handle the image - const enabledElement = createEnabledElement(width, height); - const element = enabledElement.element; - - // Display the image on cornerstone's canvas - cornerstone.displayImage(element, image); - - // Add the measurement state and enable the tool if a measurement was given - if (measurement) { - const state = Object.assign({}, measurement, { active: true }); - Object.keys(measurement.handles).forEach(handleKey => { - const handle = Object.assign({}, state.handles[handleKey]); - handle.selected = false; - handle.active = false; - handle.moving = false; - state.handles[handleKey] = handle; - }); - - cornerstoneTools.addToolState(element, measurement.toolType, state); - cornerstoneTools[measurement.toolType].enable(element); - } - - // Set the viewport voi if present - if (viewport && viewport.voi) { - const csViewport = cornerstone.getViewport(element); - Object.assign(csViewport, { voi: viewport.voi }); - cornerstone.setViewport(element, csViewport); - } - - // Resolve the current promise giving the dataUrl as parameter - const renderedCallback = () => { - const dataUrl = enabledElement.canvas.toDataURL(imageType, quality); - - // Disable the tool and clear the measurement state if a measurement was given - if (measurement) { - cornerstoneTools[measurement.toolType].disable(element); - cornerstoneTools.clearToolState(element, measurement.toolType); - } - - // Destroy the cornerstone enabled element, removing it from the DOM - destroyEnabledElement(enabledElement); - - // Resolve the promise with the image's data URL - resolve(dataUrl); - }; - - // Wait for image rendering to get its data URL - $(element).one('cornerstoneimagerendered', () => { - if (measurement && alwaysVisibleText) { - rearrangeTextBox(image, measurement, element).then(() => renderedCallback()); - } else { - renderedCallback(); - } - }); - }); - }); -}; - -const getPoint = (x, y) => { - return { - x, - y - }; -}; - -const lineRectangleIntersection = (line, rect) => { - let intersection; - - Object.keys(rect).forEach(side => { - if (intersection) return; - const rectSegment = rect[side]; - intersection = cornerstoneMath.lineSegment.intersectLine(line, rectSegment); - }); - - return intersection; -}; - -const rearrangeTextBox = (image, measurement, element) => new Promise((resolve, reject) => { - const handles = measurement && measurement.handles; - if (!handles) return resolve(); - const { textBox, start, end } = handles; - if (!textBox || !textBox.boundingBox || !start || !end) return resolve(); - - // Build the dashed line segment - let dashedLine = new cornerstoneMath.Line3(); - const maxX = Math.max(start.x, end.x); - const minX = Math.min(start.x, end.x); - const maxY = Math.max(start.y, end.y); - const minY = Math.min(start.y, end.y); - dashedLine.start = getPoint(minX + ((maxX - minX) / 2), minY + ((maxY - minY) / 2)); - dashedLine.end = getPoint(textBox.x, textBox.y); - - // Build the bounding rectangle - const x0 = (textBox.boundingBox.width / 2); - const x1 = image.width - x0; - const y0 = (textBox.boundingBox.height / 2); - const y1 = image.height - y0; - const topLeft = getPoint(x0, y0); - const topRight = getPoint(x1, y0); - const bottomLeft = getPoint(x0, y1); - const bottomRight = getPoint(x1, y1); - const boundingRect = { - top: new cornerstoneMath.Line3(topLeft, topRight), - left: new cornerstoneMath.Line3(topLeft, bottomLeft), - right: new cornerstoneMath.Line3(topRight, bottomRight), - bottom: new cornerstoneMath.Line3(bottomLeft, bottomRight) - }; - - // Check if the measurement center is outside the bounding rectangle - const imageCenter = getPoint(image.width / 2, image.height / 2); - const imageCenterToMeasurement = new cornerstoneMath.Line3(); - imageCenterToMeasurement.start = imageCenter; - imageCenterToMeasurement.end = dashedLine.start; - if (lineRectangleIntersection(imageCenterToMeasurement, boundingRect)) { - dashedLine = new cornerstoneMath.Line3(imageCenter, dashedLine.end); - } - - // Check if the text box is outside the image area - const intersection = lineRectangleIntersection(dashedLine, boundingRect); - if (intersection) { - textBox.boundingBox.left = intersection.x - x0; - textBox.boundingBox.top = intersection.y - y0; - Object.assign(textBox, intersection); - cornerstone.updateImage(element); - $(element).one('cornerstoneimagerendered', () => resolve()); - } else { - resolve(); - } -}); - -const createEnabledElement = (width, height) => { - const $element = $('
    ').css({ - height, - left: 0, - position: 'fixed', - top: 0, - visibility: 'hidden', - width, - 'z-index': -1 - }); - - const element = $element[0]; - $element.appendTo(document.body); - cornerstone.enable(element, { renderer: OHIF.cornerstone.renderer }); - - const enabledElement = cornerstone.getEnabledElement(element); - enabledElement.toolStateManager = cornerstoneTools.newImageIdSpecificToolStateManager(); - - return enabledElement; -}; - -const destroyEnabledElement = enabledElement => { - cornerstone.disable(enabledElement.element); - $(enabledElement.element).remove(); -}; diff --git a/Packages/ohif-measurements/client/lib/getLabelTerminologyList.js b/Packages/ohif-measurements/client/lib/getLabelTerminologyList.js deleted file mode 100644 index 9fce4a88f..000000000 --- a/Packages/ohif-measurements/client/lib/getLabelTerminologyList.js +++ /dev/null @@ -1,154 +0,0 @@ -const segmentedTerminologyList = [{ - label:'Abdomen/Chest Wall', - value:'Abdomen/Chest Wall', - segmentedPropCategory: 'T-D0080' - },{ - label:'Adrenal', - value:'Adrenal', - segmentedPropCategory: 'T-D0080' - },{ - label:'Bladder', - value:'Bladder', - segmentedPropCategory: 'T-D0080' - },{ - label:'Bone', - value:'Bone', - segmentedPropCategory: 'T-D0080' - },{ - label:'Brain', - value:'Brain', - segmentedPropCategory: 'T-D0080' - },{ - label:'Breast', - value:'Breast', - segmentedPropCategory: 'T-D0080' - },{ - label:'Colon', - value:'Colon', - segmentedPropCategory: 'T-D0080' - },{ - label:'Esophagus', - value:'Esophagus', - segmentedPropCategory: 'T-D0080' - },{ - label:'Extremities', - value:'Extremities', - segmentedPropCategory: 'T-D0080' - },{ - label:'Gallbladder', - value:'Gallbladder', - segmentedPropCategory: 'T-D0080' - },{ - label:'Kidney', - value:'Kidney', - segmentedPropCategory: 'T-D0080' - },{ - label:'Liver', - value:'Liver', - segmentedPropCategory: 'T-D0080' - },{ - label:'Lung', - value:'Lung', - segmentedPropCategory: 'T-D0080' - },{ - label:'Lymph Node', - value:'Lymph Node', - segmentedPropCategory: 'T-D0080' - },{ - label:'Mediastinum/Hilum', - value:'Mediastinum/Hilum', - segmentedPropCategory: 'T-D0080' - },{ - label:'Muscle', - value:'Muscle', - segmentedPropCategory: 'T-D0080' - },{ - label:'Neck', - value:'Neck', - segmentedPropCategory: 'T-D0080' - },{ - label:'Other Soft Tissue', - value:'Other Soft Tissue', - segmentedPropCategory: 'T-D0080' - },{ - label:'Ovary', - value:'Ovary', - segmentedPropCategory: 'T-D0080' - },{ - label:'Pancreas', - value:'Pancreas', - segmentedPropCategory: 'T-D0080' - },{ - label:'Pelvis', - value:'Pelvis', - segmentedPropCategory: 'T-D0080' - },{ - label:'Peritoneum/Omentum', - value:'Peritoneum/Omentum', - segmentedPropCategory: 'T-D0080' - },{ - label:'Prostate', - value:'Prostate', - segmentedPropCategory: 'T-D0080' - },{ - label:'Retroperitoneum', - value:'Retroperitoneum', - segmentedPropCategory: 'T-D0080' - },{ - label:'Small Bowel', - value:'Small Bowel', - segmentedPropCategory: 'T-D0080' - },{ - label:'Spleen', - value:'Spleen', - segmentedPropCategory: 'T-D0080' - },{ - label:'Stomach', - value:'Stomach', - segmentedPropCategory: 'T-D0080' - },{ - label:'Subcutaneous', - value:'Subcutaneous', - segmentedPropCategory: 'T-D0080' - } -]; - -const segmentedTerminologyCommonList = [{ - label:'Abdomen/Chest Wall', - value:'Abdomen/Chest Wall', - segmentedPropCategory: 'T-D0080' - },{ - label:'Liver', - value:'Liver', - segmentedPropCategory: 'T-D0080' - },{ - label:'Lung', - value:'Lung', - segmentedPropCategory: 'T-D0080' - },{ - label:'Lymph Node', - value:'Lymph Node', - segmentedPropCategory: 'T-D0080' - },{ - label:'Mediastinum/Hilum', - value:'Mediastinum/Hilum', - segmentedPropCategory: 'T-D0080' - },{ - label:'Pelvis', - value:'Pelvis', - segmentedPropCategory: 'T-D0080' - },{ - label:'Peritoneum/Omentum', - value:'Peritoneum/Omentum', - segmentedPropCategory: 'T-D0080' - },{ - label:'Retroperitoneum', - value:'Retroperitoneum', - segmentedPropCategory: 'T-D0080' - } -]; - -export { - segmentedTerminologyList, - segmentedTerminologyCommonList -} \ No newline at end of file diff --git a/Packages/ohif-measurements/client/lib/getLocationLabel.js b/Packages/ohif-measurements/client/lib/getLocationLabel.js deleted file mode 100644 index 65b175cd9..000000000 --- a/Packages/ohif-measurements/client/lib/getLocationLabel.js +++ /dev/null @@ -1,11 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Extensible method to translate the location and return a string containing its label - * - * @param location - * @returns string - label for the given location - */ -OHIF.measurements.getLocationLabel = location => { - return location; -}; diff --git a/Packages/ohif-measurements/client/lib/getMeasurementsGroupedByNumber.js b/Packages/ohif-measurements/client/lib/getMeasurementsGroupedByNumber.js deleted file mode 100644 index f8e7a630a..000000000 --- a/Packages/ohif-measurements/client/lib/getMeasurementsGroupedByNumber.js +++ /dev/null @@ -1,101 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; - -// TODO: change this to a const after refactoring newMeasurements code on measurementTableView.js -OHIF.measurements.getLocation = collection => { - for (let i = 0; i < collection.length; i++) { - if (collection[i].location) { - return collection[i].location; - } - } -}; - -// TODO: change this to a const after refactoring newMeasurements code on measurementTableView.js -OHIF.measurements.getDescription = collection => { - for (let i = 0; i < collection.length; i++) { - if (collection[i].description) { - return collection[i].description; - } - } -}; - -/** - * Group all measurements by its tool group and measurement number. - * - * @param measurementApi - * @param timepointApi - * @returns {*} A list containing each toolGroup and an array containing the measurement rows - */ -OHIF.measurements.getMeasurementsGroupedByNumber = (measurementApi, timepointApi) => { - const getPath = OHIF.utils.ObjectPath.get; - const configuration = OHIF.measurements.MeasurementApi.getConfiguration(); - - if (!measurementApi || !timepointApi || !configuration) return; - - // Check which tools are going to be displayed - const displayToolGroupMap = {}; - const displayToolList = []; - configuration.measurementTools.forEach(toolGroup => { - displayToolGroupMap[toolGroup.id] = false; - toolGroup.childTools.forEach(tool => { - const willDisplay = !!getPath(tool, 'options.measurementTable.displayFunction'); - if (willDisplay) { - displayToolList.push(tool.id); - displayToolGroupMap[toolGroup.id] = true; - } - }); - }); - - // Create the result object - const groupedMeasurements = []; - - const baseline = timepointApi.baseline(); - if (!baseline) return; - - configuration.measurementTools.forEach(toolGroup => { - // Skip this tool group if it should not be displayed - if (!displayToolGroupMap[toolGroup.id]) return; - - // Retrieve all the data for this Measurement type (e.g. 'targets') - // which was recorded at baseline. - const atBaseline = measurementApi.fetch(toolGroup.id, { - timepointId: baseline.timepointId - }); - - // Obtain a list of the Measurement Numbers from the - // measurements which have baseline data - const numbers = atBaseline.map(m => m.measurementNumber); - - // Retrieve all the data for this Measurement type which - // match the Measurement Numbers obtained above - const data = measurementApi.fetch(toolGroup.id, { - toolId: { - $in: displayToolList - }, - measurementNumber: { - $in: numbers - } - }); - - // Group the Measurements by Measurement Number - const groupObject = _.groupBy(data, entry => entry.measurementNumber); - - // Reformat the data for display in the table - const measurementRows = Object.keys(groupObject).map(key => ({ - measurementTypeId: toolGroup.id, - measurementNumber: key, - location: OHIF.measurements.getLocation(groupObject[key]), - description: OHIF.measurements.getDescription(groupObject[key]), - responseStatus: false, // TODO: Get the latest timepoint and determine the response status - entries: groupObject[key] - })); - - // Add the group to the result - groupedMeasurements.push({ - toolGroup, - measurementRows - }); - }); - - return groupedMeasurements; -}; diff --git a/Packages/ohif-measurements/client/lib/getParentToolData.js b/Packages/ohif-measurements/client/lib/getParentToolData.js deleted file mode 100644 index 5059d37cb..000000000 --- a/Packages/ohif-measurements/client/lib/getParentToolData.js +++ /dev/null @@ -1,15 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Return the parent tool data if it's a child tool or the tool data itself if not - * - * @param measurementData measurement data that must contain the toolType and measurement's _id - * @returns {Object} Parent measurement data - */ -OHIF.measurements.getParentToolData = measurementData => { - const { toolType, _id } = measurementData; - const { tool } = OHIF.measurements.getToolConfiguration(toolType); - const parentToolType = tool.parentTool || toolType; - const parentToolData = OHIF.viewer.measurementApi.tools[parentToolType].findOne(_id); - return parentToolData; -}; diff --git a/Packages/ohif-measurements/client/lib/getTimepointName.js b/Packages/ohif-measurements/client/lib/getTimepointName.js deleted file mode 100644 index 9a61651d9..000000000 --- a/Packages/ohif-measurements/client/lib/getTimepointName.js +++ /dev/null @@ -1,46 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Calculates a Timepoint's name based on how many timepoints exist between it - * and the latest Baseline. Names returned are in the form of 'Baseline', or - * 'Follow-up 1', 'Follow-up 2', and so on. - * - * @param timepoint - * @returns {*} The timepoint name - */ -OHIF.measurements.getTimepointName = timepoint => { - // Check if this is a Baseline timepoint, if it is, return 'Baseline' - if (timepoint.timepointType === 'baseline') { - return 'Baseline'; - } else if (timepoint.visitNumber) { - return 'Follow-up ' + timepoint.visitNumber; - } - - // Retrieve all of the relevant follow-up timepoints for this patient - const followupTimepoints = Timepoints.find({ - patientId: timepoint.patientId, - timepointType: timepoint.timepointType - }, { - sort: { - latestDate: 1 - } - }); - - // Create an array of just timepointIds, so we can use indexOf - // on it to find the current timepoint's relative position - const followupTimepointIds = followupTimepoints.map(timepoint => timepoint.timepointId); - - // Calculate the index of the current timepoint in the array of all - // relevant follow-up timepoints - const index = followupTimepointIds.indexOf(timepoint.timepointId) + 1; - - // If index is 0, it means that the current timepoint was not in the list - // Log a warning and return here - if (!index) { - OHIF.log.warn('Current follow-up was not in the list of relevant follow-ups?'); - return; - } - - // Return the timepoint name as 'Follow-up N' - return 'Follow-up ' + index; -}; diff --git a/Packages/ohif-measurements/client/lib/getToolConfiguration.js b/Packages/ohif-measurements/client/lib/getToolConfiguration.js deleted file mode 100644 index 67e4810d4..000000000 --- a/Packages/ohif-measurements/client/lib/getToolConfiguration.js +++ /dev/null @@ -1,27 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -/** - * Return the tool configuration of a given tool type - * - * @param {String} toolType The tool type of the desired configuration - */ -OHIF.measurements.getToolConfiguration = toolType => { - const { MeasurementApi } = OHIF.measurements; - const configuration = MeasurementApi.getConfiguration(); - const toolsGroupsMap = MeasurementApi.getToolsGroupsMap(); - - const toolGroupId = toolsGroupsMap[toolType]; - const toolGroup = _.findWhere(configuration.measurementTools, { id: toolGroupId }); - - let tool; - if (toolGroup) { - tool = _.findWhere(toolGroup.childTools, { id: toolType }); - } - - return { - toolGroupId, - toolGroup, - tool - }; -}; diff --git a/Packages/ohif-measurements/client/lib/hangingProtocolCustomizations.js b/Packages/ohif-measurements/client/lib/hangingProtocolCustomizations.js deleted file mode 100644 index 7216a0511..000000000 --- a/Packages/ohif-measurements/client/lib/hangingProtocolCustomizations.js +++ /dev/null @@ -1,62 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Viewerbase } from 'meteor/ohif:viewerbase'; -import { OHIF } from 'meteor/ohif:core'; - -const { InstanceMetadata, StudySummary } = Viewerbase.metadata; - -// TODO: [LT-refactor] move this to ohif:hanging-protocols package -/** - * Get a timepoint type for a given study metadata - * @param {StudyMetadata} study StudyMetadata instance - * @return {String|undefined} Timepoint type if found or undefined if not found or any error/missing information - */ -const getTimepointType = study => { - const { timepointApi } = OHIF.viewer; - - if (!timepointApi || !(study instanceof InstanceMetadata || study instanceof StudySummary)) { - return; - } - - const timepoint = timepointApi.study(study.getStudyInstanceUID()); - if (!timepoint || !(timepoint instanceof Array) || timepoint.length < 1) { - return; - } - - return timepoint[0].timepointType; -}; - -/** - * Get the timpoint key (prior/current/baseline) for a given study metadata - * @param {StudyMetadata} study StudyMetadata instance - * @return {String|undefined} Timepoint key if found or undefined if not found or any error/missing information - */ -const getTimepointKey = study => { - const { timepointApi } = OHIF.viewer; - - if (!timepointApi || !(study instanceof InstanceMetadata || study instanceof StudySummary)) { - return; - } - - const timepoint = timepointApi.study(study.getStudyInstanceUID()); - if (!timepoint || !(timepoint instanceof Array) || timepoint.length < 1) { - return; - } - - const timepointId = timepoint[0]._id; - if (timepointApi.current()._id === timepointId) { - return 'current'; - } else if (timepointApi.prior()._id === timepointId) { - return 'prior'; - } else if (timepointApi.baseline()._id === timepointId) { - return 'baseline'; - } -}; - -Meteor.startup(() => { - HP = HP || false; - - if (HP) { - HP.addCustomAttribute('timepointType', 'Timepoint Type', getTimepointType); - HP.addCustomAttribute('timepointKey', 'Timepoint Key', getTimepointKey); - } -}); diff --git a/Packages/ohif-measurements/client/lib/index.js b/Packages/ohif-measurements/client/lib/index.js deleted file mode 100644 index 6768b3b80..000000000 --- a/Packages/ohif-measurements/client/lib/index.js +++ /dev/null @@ -1,26 +0,0 @@ -import './jumpToRowItem'; -import './activateMeasurements'; -import './clearCornerstoneToolState'; -import './deactivateAllToolData'; -import './exportPdf'; -import './exportToCsv'; -import './findAndRenderDisplaySet'; -import './getActiveTimepoint'; -import './getImageDataUrl'; -import './getMeasurementsGroupedByNumber'; -import './getLocationLabel'; -import './getParentToolData'; -import './getTimepointName'; -import './getToolConfiguration'; -import './hangingProtocolCustomizations'; -import './isNewLesionsMeasurement'; -import './isSaveDisabled'; -import './MeasurementHandlers'; -import './MeasurementManager'; -import './navigateOverLesions'; -import './saveMeasurements'; -import './syncMeasurementAndToolData'; -import './toggleLabelButton'; -import './openLocationModal'; -import './triggerTimepointUnsavedChanges'; -import './updateMeasurementsDescription'; diff --git a/Packages/ohif-measurements/client/lib/isNewLesionsMeasurement.js b/Packages/ohif-measurements/client/lib/isNewLesionsMeasurement.js deleted file mode 100644 index bce443a4c..000000000 --- a/Packages/ohif-measurements/client/lib/isNewLesionsMeasurement.js +++ /dev/null @@ -1,37 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { _ } from 'meteor/underscore'; - -/** - * Check if the given measurement is a new lesion - * - * @param measurementData Measurement that will be checked - * @returns {Boolean} Boolean value telling if the given measurement is a new lesion or not - */ -OHIF.measurements.isNewLesionsMeasurement = measurementData => { - if (!measurementData) return; - - const toolConfig = OHIF.measurements.getToolConfiguration(measurementData.toolType); - const toolType = toolConfig.tool.parentTool || measurementData.toolType; - const { timepointApi, measurementApi } = OHIF.viewer; - const currentMeasurement = measurementApi.tools[toolType].findOne(measurementData._id); - const { timepointId, measurementNumber } = currentMeasurement; - - // Stop here if the needed information is not set - if (!measurementApi || !timepointApi || !timepointId || !toolConfig) return; - - const { toolGroupId } = toolConfig; - const current = timepointApi.timepoints.findOne({ timepointId }); - const baseline = timepointApi.baseline(); - - // Stop here if there's no current or baseline timepoints, or if the current is the baseline - if (!current || !baseline || current.timepointType === 'baseline') return false; - - // Retrieve all the data for the given tool group (e.g. 'targets') - const atBaseline = measurementApi.fetch(toolGroupId, { timepointId: baseline.timepointId }); - - // Obtain a list of the Measurement Numbers from the measurements which have baseline data - const numbers = atBaseline.map(m => m.measurementNumber); - - // Return true if the measurement number from follow-up is not present at baseline - return !_.contains(numbers, measurementNumber); -}; diff --git a/Packages/ohif-measurements/client/lib/isSaveDisabled.js b/Packages/ohif-measurements/client/lib/isSaveDisabled.js deleted file mode 100644 index 687425074..000000000 --- a/Packages/ohif-measurements/client/lib/isSaveDisabled.js +++ /dev/null @@ -1,24 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.measurements.isSaveDisabled = timepointId => { - const basePath = `viewer.studyViewer.measurements.${timepointId}`; - - // Get the timepoint object - const timepoint = OHIF.viewer.timepointApi.timepoints.findOne({ timepointId }); - - // Check if the timepoint is locked - let isLocked = (timepoint && timepoint.isLocked); - if (typeof isLocked === 'undefined') { - isLocked = true; - } - - // Check if the given timepoint suffered changes - const hasChanges = OHIF.ui.unsavedChanges.probe(basePath) !== 0; - - // Check if the given timepoint has nonconformities - const nonconformities = OHIF.viewer.conformanceCriteria.nonconformities.get(); - const hasNonconformities = nonconformities && !!nonconformities.length; - - // Prevent saving if timepoint is locked, has no changes or has nonconformities - return isLocked || !hasChanges || hasNonconformities; -}; diff --git a/Packages/ohif-measurements/client/lib/jumpToRowItem.js b/Packages/ohif-measurements/client/lib/jumpToRowItem.js deleted file mode 100644 index 1782d3624..000000000 --- a/Packages/ohif-measurements/client/lib/jumpToRowItem.js +++ /dev/null @@ -1,185 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -// Flag that can be changed to disable automatic stack scroll linking when jumping over lesions -OHIF.measurements.automaticStackScrollLinkingEnabled = true; - -function renderIntoViewport(measurementData, enabledElement, viewportIndex) { - const { activateMeasurements, findAndRenderDisplaySet } = OHIF.measurements; - const { element } = enabledElement; - const { studyInstanceUid, seriesInstanceUid, sopInstanceUid } = measurementData; - - return new Promise((resolve, reject) => { - const renderedCallback = element => { - activateMeasurements(element, measurementData); - $(element).one('cornerstoneimagerendered', () => resolve()); - }; - - // Find the study by studyInstanceUid and render the display set - const findAndRender = () => { - // @TypeSafeStudies - const study = OHIF.viewer.Studies.findBy({ studyInstanceUid }); - - // TODO: Support frames? e.g. for measurements on multi-frame instances - findAndRenderDisplaySet( - study.displaySets, - viewportIndex, - studyInstanceUid, - seriesInstanceUid, - sopInstanceUid, - renderedCallback - ); - }; - - // Check if the study / series we need is already the one in the viewport. - // Otherwise, re-render the viewport with the required study/series, then add a rendered - // callback to activate the measurements - if (enabledElement && enabledElement.image) { - const imageId = enabledElement.image.imageId; - const series = cornerstone.metaData.get('series', imageId); - const study = cornerstone.metaData.get('study', imageId); - - const isSameStudy = study.studyInstanceUid === measurementData.studyInstanceUid; - const isSameSeries = series.seriesInstanceUid === measurementData.seriesInstanceUid; - if (isSameStudy && isSameSeries) { - // If it is, activate the measurements in this viewport and stop here - OHIF.viewerbase.viewportUtils.resetViewport(viewportIndex); - renderedCallback(element); - } else { - findAndRender(); - } - } else { - findAndRender(); - } - }); -} - -function syncViewports(viewportsIndexes) { - // Prevent stack scrolling from being linked if it's disabled - if (!OHIF.measurements.automaticStackScrollLinkingEnabled) { - return; - } - - const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer; - - if(!synchronizer) { return; } - - const linkableViewports = synchronizer.getLinkableViewports(); - if (linkableViewports.length) { - const linkableViewportsIndexes = _.pluck(linkableViewports, 'index'); - const indexes = _.intersection(linkableViewportsIndexes, viewportsIndexes); - if (indexes.length) { - OHIF.viewer.stackImagePositionOffsetSynchronizer.activateByViewportIndexes(indexes); - } - } -} - -// Store the lastActivatedRowItem to cancel jumping if another rowItem was triggered during loading -let lastActivatedRowItem; - -/** - * Activates a set of lesions when lesion table row is clicked - * - * @param measurementId The unique key for a specific Measurement - */ -OHIF.measurements.jumpToRowItem = (rowItem, timepoints, childToolKey) => { - const { isZoomed, zoomedViewportIndex } = OHIF.viewerbase.layoutManager; - - lastActivatedRowItem = rowItem; - - // Retrieve the list of available viewports - const $viewports = $('.imageViewerViewport'); - const numViewports = Math.max($viewports.length, 0); - - // Clone the timepoint list to prevent modifying the original object - let timepointList; - if (isZoomed) { - timepointList = [timepoints[zoomedViewportIndex]]; - } else { - timepointList = _.clone(timepoints); - } - - // Reverse the timepointList array if the flag is set - if (OHIF.viewer.invertViewportTimepointsOrder) { - timepointList.reverse(); - } - - // Retrieve the timepoints that are currently being displayed in the Measurement Table - const numTimepoints = Math.max(timepointList.length, 1); - - const numViewportsToUpdate = Math.min(numTimepoints, numViewports); - - // Retrieve the measurements data - const measurementsData = []; - const promises = new Set(); - for (let i = 0; i < numViewportsToUpdate; i++) { - const { timepointId } = timepointList[i]; - - const dataAtThisTimepoint = _.where(rowItem.entries, { timepointId }); - if (!dataAtThisTimepoint || !dataAtThisTimepoint.length) { - measurementsData.push(null); - continue; - } - - const measurement = dataAtThisTimepoint[0]; - let measurementData = measurement; - const { toolType } = measurementData; - const { tool } = OHIF.measurements.getToolConfiguration(toolType); - if (childToolKey) { - measurementData = measurementData[childToolKey]; - } else if (Array.isArray(tool.childTools)) { - tool.childTools.every(key => { - measurementData = measurementData[key]; - return !measurementData; - }); - } - - measurementsData.push(measurementData); - const promise = OHIF.studies.loadStudy(measurementData.studyInstanceUid); - promise.then(() => OHIF.measurements.syncMeasurementAndToolData(measurement)); - promises.add(promise); - } - - // Wait for studies metadata to be retrieved before jumpint to the given row item - Promise.all(promises).then(() => { - // Stop here if another rowItem was activated during loading process - if (rowItem !== lastActivatedRowItem) return; - - OHIF.measurements.deactivateAllToolData(); - - const activatedViewportIndexes = []; - - // Deactivate stack synchronizer because it will be re-activated later - const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer; - if(synchronizer) { - synchronizer.deactivate(); - } - - const renderPromises = []; - for (let viewportIndex = 0; viewportIndex < numViewportsToUpdate; viewportIndex++) { - const measurementData = measurementsData[viewportIndex]; - if (!measurementData) continue; - - activatedViewportIndexes.push(viewportIndex); - - const element = $viewports.get(viewportIndex); - - // TODO: Implement isEnabledElement in Cornerstone - // or maybe just remove the 'error' this throws? - let enabledElement; - try { - enabledElement = cornerstone.getEnabledElement(element); - } catch(error) { - continue; - } - - const promise = renderIntoViewport(measurementData, enabledElement, viewportIndex); - renderPromises.push(promise); - } - - // Wait for all viewports to be rendered then sync them - Promise.all(renderPromises).then(() => syncViewports(activatedViewportIndexes)); - }); -}; diff --git a/Packages/ohif-measurements/client/lib/navigateOverLesions.js b/Packages/ohif-measurements/client/lib/navigateOverLesions.js deleted file mode 100644 index f41863ec5..000000000 --- a/Packages/ohif-measurements/client/lib/navigateOverLesions.js +++ /dev/null @@ -1,30 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Method to go select the next or previous lesion on measurements table - * - * @param {Boolean} isNextLesion Determine if it will navigate to the next or previous lesion - */ -OHIF.measurements.navigateOverLesions = isNextLesion => { - const $table = $('#measurementTableContainer'); - if (!$table.length) return; - - const $lesions = $table.find('.measurementTableRow'); - if (!$lesions.length) return; - - const $activeLesion = $lesions.filter('.active'); - const activeIndex = $lesions.index($activeLesion); - - const step = isNextLesion ? 1 : -1; - let newIndex = 0; - if (activeIndex !== -1) { - newIndex = activeIndex + step; - if (newIndex >= $lesions.length) { - newIndex = 0; - } else if (newIndex < 0) { - newIndex = $lesions.length - 1; - } - } - - $lesions.eq(newIndex).find('.measurementRowSidebar').trigger('click'); -}; diff --git a/Packages/ohif-measurements/client/lib/openLocationModal.js b/Packages/ohif-measurements/client/lib/openLocationModal.js deleted file mode 100644 index 9ce7a5639..000000000 --- a/Packages/ohif-measurements/client/lib/openLocationModal.js +++ /dev/null @@ -1,61 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.measurements.openLocationModal = options => { - let { toolType } = options.measurement; - const { tool } = OHIF.measurements.getToolConfiguration(toolType); - - if (!tool) return; - - toolType = (tool && tool.parentTool) || toolType; - - const measurementId = options.measurement._id; - let buttonView = null; - - const removeButtonView = () => { - Blaze.remove(buttonView); - buttonView = null; - }; - - if (buttonView) { - removeButtonView(); - } - - const measurementApi = options.measurementApi; - const toolCollection = measurementApi.tools[toolType]; - const measurement = toolCollection.findOne(measurementId); - - const data = { - measurement, - position: options.position, - direction: options.direction, - threeColumns: true, - hideCommon: true, - autoClick: options.autoClick, - doneCallback: removeButtonView, - updateCallback(location) { - const groupId = measurementApi.toolsGroupsMap[toolType]; - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - const group = _.findWhere(config.measurementTools, { id: groupId }); - group.childTools.forEach(tool => { - measurementApi.tools[tool.id].update({ - measurementNumber: measurement.measurementNumber, - patientId: measurement.patientId - }, { - $set: { - location - } - }, { - multi: true - }); - }); - options.measurement.location = location; - - // Notify that viewer suffered changes - OHIF.measurements.triggerTimepointUnsavedChanges('relabel'); - } - }; - buttonView = Blaze.renderWithData(Template.measurementRelabel, data, document.body); -}; diff --git a/Packages/ohif-measurements/client/lib/saveMeasurements.js b/Packages/ohif-measurements/client/lib/saveMeasurements.js deleted file mode 100644 index 996da8a60..000000000 --- a/Packages/ohif-measurements/client/lib/saveMeasurements.js +++ /dev/null @@ -1,33 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.measurements.saveMeasurements = (measurementApi, timepointId) => { - const { unsavedChanges, notifications, showDialog } = OHIF.ui; - const basePath = `viewer.studyViewer.measurements.${timepointId}`; - - // Prevent saving if it's disabled - if (OHIF.measurements.isSaveDisabled(timepointId)) { - return; - } - - // Clear unsaved changes state and display success message - const successHandler = () => { - unsavedChanges.clear(basePath, true); - notifications.success({ text: 'The measurement data was successfully saved' }); - }; - - // Display the error messages - const errorHandler = data => { - showDialog('dialogInfo', Object.assign({ class: 'themed' }, data)); - }; - - // Call the storage method and display a loading overlay - const promise = measurementApi.storeMeasurements(timepointId); - promise.then(successHandler).catch(errorHandler); - showDialog('dialogLoading', { - promise, - text: 'Saving measurement data' - }); - - // Return the save promise - return promise; -}; diff --git a/Packages/ohif-measurements/client/lib/syncMeasurementAndToolData.js b/Packages/ohif-measurements/client/lib/syncMeasurementAndToolData.js deleted file mode 100644 index c61e18dbd..000000000 --- a/Packages/ohif-measurements/client/lib/syncMeasurementAndToolData.js +++ /dev/null @@ -1,82 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { cornerstoneTools } from 'meteor/ohif:cornerstone'; - -OHIF.measurements.syncMeasurementAndToolData = measurement => { - OHIF.log.info('syncMeasurementAndToolData'); - - const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.saveToolState(); - - // Stop here if the metadata for the measurement's study is not loaded yet - const { studyInstanceUid } = measurement; - const metadata = OHIF.viewer.StudyMetadataList.findBy({ "studyInstanceUID": studyInstanceUid }); - if (!metadata) return; - - // Iterate each child tool if the current tool has children - const { getImageIdForImagePath } = OHIF.viewerbase; - const toolType = measurement.toolType; - const { tool } = OHIF.measurements.getToolConfiguration(toolType); - if (Array.isArray(tool.childTools)) { - tool.childTools.forEach(childToolKey => { - const childMeasurement = measurement[childToolKey]; - if (!childMeasurement) return; - childMeasurement._id = measurement._id; - childMeasurement.measurementNumber = measurement.measurementNumber; - - OHIF.measurements.syncMeasurementAndToolData(childMeasurement); - }); - - return; - } - - const imageId = getImageIdForImagePath(measurement.imagePath); - - // If no tool state exists for this imageId, create an empty object to store it - if (!toolState[imageId]) { - toolState[imageId] = {}; - } - - const currentToolState = toolState[imageId][toolType]; - const toolData = currentToolState && currentToolState.data; - - // Check if we already have toolData for this imageId and toolType - if (toolData && toolData.length) { - // If we have toolData, we should search it for any data related to the current Measurement - const toolData = toolState[imageId][toolType].data; - - // Create a flag so we know if we've successfully updated the Measurement in the toolData - let alreadyExists = false; - - // Loop through the toolData to search for this Measurement - toolData.forEach(tool => { - // Break the loop if this isn't the Measurement we are looking for - if (tool._id !== measurement._id) { - return; - } - - // If we have found the Measurement, set the flag to True - alreadyExists = true; - - // Update the toolData from the Measurement data - Object.assign(tool, measurement); - return false; - }); - - // If we have found the Measurement we intended to update, we can stop this function here - if (alreadyExists === true) { - return; - } - } else { - // If no toolData exists for this toolType, create an empty array to hold some - toolState[imageId][toolType] = { - data: [] - }; - } - - // If we have reached this point, it means we haven't found the Measurement we are looking for - // in the current toolData. This means we need to add it. - - // Add the MeasurementData into the toolData for this imageId - toolState[imageId][toolType].data.push(measurement); - - cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(toolState); -}; diff --git a/Packages/ohif-measurements/client/lib/toggleLabelButton.js b/Packages/ohif-measurements/client/lib/toggleLabelButton.js deleted file mode 100644 index a6bcadf5d..000000000 --- a/Packages/ohif-measurements/client/lib/toggleLabelButton.js +++ /dev/null @@ -1,67 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Blaze } from 'meteor/blaze'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -OHIF.measurements.toggleLabelButton = options => { - let { toolType } = options.measurement; - const { tool } = OHIF.measurements.getToolConfiguration(toolType); - - if (!tool) return; - - toolType = (tool && tool.parentTool) || toolType; - - const measurementId = options.measurement._id; - let buttonView = null; - - const removeButtonView = () => { - if (!buttonView) { - return; - } - - Blaze.remove(buttonView); - buttonView = null; - }; - - if (buttonView) { - removeButtonView(); - } - - const measurementApi = options.measurementApi; - const toolCollection = measurementApi.tools[toolType]; - const measurement = toolCollection.findOne(measurementId); - - const data = { - measurement, - position: options.position, - direction: options.direction, - threeColumns: true, - hideCommon: true, - autoClick: options.autoClick, - doneCallback: removeButtonView, - updateCallback(location, description) { - const groupId = measurementApi.toolsGroupsMap[toolType]; - const config = OHIF.measurements.MeasurementApi.getConfiguration(); - const group = _.findWhere(config.measurementTools, { id: groupId }); - group.childTools.forEach(tool => { - measurementApi.tools[tool.id].update({ - measurementNumber: measurement.measurementNumber, - patientId: measurement.patientId - }, { - $set: { - location, - description - } - }, { - multi: true - }); - }); - options.measurement.location = location; - options.measurement.description = description; - - // Notify that viewer suffered changes - OHIF.measurements.triggerTimepointUnsavedChanges('relabel'); - } - }; - buttonView = Blaze.renderWithData(Template.measureFlow, data, document.body); -}; diff --git a/Packages/ohif-measurements/client/lib/triggerTimepointUnsavedChanges.js b/Packages/ohif-measurements/client/lib/triggerTimepointUnsavedChanges.js deleted file mode 100644 index c14375431..000000000 --- a/Packages/ohif-measurements/client/lib/triggerTimepointUnsavedChanges.js +++ /dev/null @@ -1,15 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Extensible method to trigger unsaved changes on the active timepoint - * - * @param {String} subpath - The unsaved changes subpath that will come after the timepoint ID - */ -OHIF.measurements.triggerTimepointUnsavedChanges = (subpath='changed') => { - const basePath = 'viewer.studyViewer.measurements'; - const activeTimepoint = OHIF.measurements.getActiveTimepoint(); - if (!activeTimepoint) return; - const { timepointId } = activeTimepoint; - const timepointPath = timepointId ? `.${timepointId}` : ''; - OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.${subpath}`); -}; diff --git a/Packages/ohif-measurements/client/lib/updateMeasurementsDescription.js b/Packages/ohif-measurements/client/lib/updateMeasurementsDescription.js deleted file mode 100644 index cf14ff837..000000000 --- a/Packages/ohif-measurements/client/lib/updateMeasurementsDescription.js +++ /dev/null @@ -1,23 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Updates the measurements' description for a measurement number across all timepoints - * - * @param measurementData base measurement data that must contain toolType and measurementNumber - * @param description measurement description that will be used - */ -OHIF.measurements.updateMeasurementsDescription = (measurementData, description) => { - const { toolType, measurementNumber } = measurementData; - measurementData.description = description; - const filter = { measurementNumber }; - const operator = { $set: { description } }; - const options = { multi: true }; - const { toolGroup } = OHIF.measurements.getToolConfiguration(toolType); - toolGroup.childTools.forEach(childTool => { - const collection = OHIF.viewer.measurementApi.tools[childTool.id]; - collection.update(filter, operator, options); - }); - - // Notify that viewer suffered changes - OHIF.measurements.triggerTimepointUnsavedChanges('relabel'); -}; diff --git a/Packages/ohif-measurements/client/reports/base.js b/Packages/ohif-measurements/client/reports/base.js deleted file mode 100644 index e2851303a..000000000 --- a/Packages/ohif-measurements/client/reports/base.js +++ /dev/null @@ -1,83 +0,0 @@ -import jsPDF from 'jspdf'; -import { _ } from 'meteor/underscore'; - -export class BaseReport { - constructor(options) { - const defaultOptions = { - width: 595.28, - height: 841.89, - marginTop: 30, - marginLeft: 40, - marginRight: 40, - marginBottom: 30, - showPageNumber: true - }; - - this.options = _.extend(defaultOptions, options); - this.init(); - } - - init() { - this.doc = new jsPDF('portrait', 'pt', [this.options.width, this.options.height]); - this.options.width = Math.floor(this.options.width); - this.options.height = Math.floor(this.options.height); - this.currentPage = 1; - this.printStatic(); - } - - printStatic() { - this.x = this.options.marginLeft; - this.y = this.options.marginTop; - this.printHeader(); - if (this.options.showPageNumber) { - this.printPageNumber(); - } - } - - newPage() { - this.doc.addPage(); - this.currentPage++; - this.printStatic(); - } - - printHeader() { - const { marginLeft, marginRight, width } = this.options; - const doc = this.doc; - let y = this.y; - - // Print the logo strokes - doc.setDrawColor(0).setLineWidth(1); - doc.roundedRect(marginLeft + 0.5, y + 0.5, 8, 8, 0.5, 0.5, 'D'); - doc.roundedRect(marginLeft + 11, y + 0.5, 8, 8, 0.5, 0.5, 'D'); - doc.roundedRect(marginLeft + 0.5, y + 11, 8, 8, 0.5, 0.5, 'D'); - doc.roundedRect(marginLeft + 11, y + 11, 8, 8, 0.5, 0.5, 'D'); - - // Print the logo text - doc.setFont('Serif').setFontSize(16).setFontStyle('normal').setTextColor(0); - doc.text('Open Health Imaging Foundation', 66, y + 14); - y += 24; - - // Print header horizontal line - doc.setDrawColor(0).setLineWidth(0.5); - doc.line(marginLeft, y, width - marginRight, y); - y += 1; - - this.y = y; - } - - printPageNumber() { - const doc = this.doc; - const { marginBottom, marginRight, width, height } = this.options; - doc.setFont('Verdana'); - doc.setFontSize(8); - doc.setFontStyle('normal'); - doc.setTextColor(0); - const text = `PAGE ${this.currentPage}`; - const size = doc.getTextDimensions(text); - doc.text(text, width - marginRight - size.w, height - marginBottom + (size.h / 2)); - } - - save(fileName) { - this.doc.save(fileName || 'report.pdf'); - } -} diff --git a/Packages/ohif-measurements/client/reports/measurement.js b/Packages/ohif-measurements/client/reports/measurement.js deleted file mode 100644 index 6e1a276c8..000000000 --- a/Packages/ohif-measurements/client/reports/measurement.js +++ /dev/null @@ -1,104 +0,0 @@ -import { BaseReport } from './base'; - -export class MeasurementReport extends BaseReport { - constructor(options) { - super(options); - } - - printHeader() { - super.printHeader(); - - const { marginLeft, marginRight, width, header } = this.options; - const doc = this.doc; - let y = this.y; - - // don't print the header if not given - if (!header) return; - - // Print trial label - y += 10; - doc.setFont('verdana'); - doc.setFontSize(8); - doc.setFontStyle('bold'); - doc.setTextColor(255); - doc.setFillColor(16); - const trialLabel = header.trial; - const trialLabelWidth = doc.getTextWidth(trialLabel) + 8; - doc.roundedRect(marginLeft, y, trialLabelWidth, 15, 3, 3, 'F'); - doc.text(trialLabel, marginLeft + 4, y + 10.5); - - // Print patient information - doc.setFont('verdana'); - doc.setFontSize(10); - doc.setFontStyle('normal'); - doc.setTextColor(0); - doc.text(`${header.patientName}\t${header.mrn}`, marginLeft + trialLabelWidth + 10, y + 11); - y += 25; - - // Print timepoint header - doc.setFillColor(229); - doc.rect(marginLeft, y, width - marginLeft - marginRight, 18, 'F'); - doc.setFont('verdana'); - doc.setFontSize(9); - doc.setFontStyle('normal'); - doc.setTextColor(0); - doc.text(header.timepoint.toUpperCase(), marginLeft + 4, y + 12.5); - y += 18; - - this.y = y; - } - - printMeasurement(measurementData) { - const { marginLeft, marginRight, marginBottom, width, height } = this.options; - const infoHeight = 28; - const rectSize = Math.round((width - marginLeft - marginRight - 3) / 2); - const doc = this.doc; - let { x, y } = this; - const { image, location, info } = measurementData; - const type = measurementData.type.toUpperCase(); - const number = measurementData.number.toString(); - - if (y + rectSize + infoHeight > height - marginBottom) { - this.newPage(); - x = this.x; - y = this.y; - } - - // Print the image - doc.setFillColor(0); - doc.rect(x, y, rectSize, rectSize, 'F'); - doc.addImage(image, 'JPEG', x + 1, y + 1, rectSize - 2, rectSize - 2); - y += rectSize; - - // Print the measurement type - doc.setFont('verdana').setFontSize(10).setFontStyle('bold').setTextColor(255); - const typeWidth = Math.round(doc.getTextWidth(type)); - const typeX = x + rectSize - typeWidth; - doc.setFillColor(64); - doc.rect(typeX - 8, y - 16, typeWidth + 8, 16, 'F'); - doc.text(type, typeX - 4, y - 5); - - // Print the measurement number - doc.setFillColor(224); - doc.circle(x + 9, y - 10, 7, 'F'); - doc.setFont('courier').setTextColor(0); - const numberHalfWidth = doc.getTextWidth(number) / 2; - doc.text(number, x + 9 - numberHalfWidth, y - 7); - - // Print the measurement location and info - doc.setFillColor(240); - doc.rect(x, y, rectSize, infoHeight, 'F'); - doc.setFont('verdana').setFontSize(9); - doc.text(location, x + 4, y + 11); - doc.setFontStyle('normal'); - doc.text(info, x + 4, y + 24); - y += infoHeight; - - if (x === marginLeft) { - this.x = width - marginRight - rectSize; - } else { - this.x = marginLeft; - this.y = y; - } - } -} diff --git a/Packages/ohif-measurements/client/reports/reportMeasurementData.js b/Packages/ohif-measurements/client/reports/reportMeasurementData.js deleted file mode 100644 index 2798abe2e..000000000 --- a/Packages/ohif-measurements/client/reports/reportMeasurementData.js +++ /dev/null @@ -1,58 +0,0 @@ -import { moment } from 'meteor/momentjs:moment'; -import { OHIF } from 'meteor/ohif:core'; - -export const getExportMeasurementData = async (measurementApi, timepointApi) => { - const currentTimepoint = timepointApi.current(); - const { timepointId } = currentTimepoint; - const study = OHIF.viewer.Studies.findBy({ - studyInstanceUid: currentTimepoint.studyInstanceUids[0] - }); - const { studyDescription, patientId, studyDate } = study; - const patientName = OHIF.viewerbase.helpers.formatPN(study.patientName); - - // All headers - const measurementData = { - patientName, - mrn: patientId, - studyDate: moment(studyDate).format('MMM DD YYYY'), - studyDescription, - data: [] - }; - - const addNewMeasurement = async (measurement) => { - const imageId = OHIF.viewerbase.getImageIdForImagePath(measurement.imagePath); - const { seriesDescription, seriesDate, modality, seriesInstanceUid } = cornerstone.metaData.get('series', imageId); - const meanStdDev = measurement.meanStdDev || {}; - - measurementData.data.push({ - seriesModality: modality, - seriesDate: moment(seriesDate).format('MMM DD YYYY'), - seriesDescription, - seriesInstanceUid, - measurementTool: measurement.toolType, - measurementDescription: OHIF.measurements.getLocationLabel(measurement.location) || 'No description', - number: measurement.measurementNumber, - length: measurement.length || '-', - mean: meanStdDev.mean || '-', - stdDev: meanStdDev.stdDev || '-', - area: measurement.area || '-' - }); - }; - - let allMeasurements = []; - Object.keys(measurementApi.toolGroups).forEach( toolGroup => { - let measurements = measurementApi.fetch(toolGroup, { timepointId }); - allMeasurements = allMeasurements.concat(measurements); - }); - const iterator = allMeasurements[Symbol.iterator](); - - let measurement; - let current = iterator.next(); - while (!current.done) { - measurement = current.value; - await addNewMeasurement(measurement); - current = iterator.next(); - } - - return measurementData; -}; diff --git a/Packages/ohif-measurements/client/reports/reportMeasurementDataToCSV.js b/Packages/ohif-measurements/client/reports/reportMeasurementDataToCSV.js deleted file mode 100644 index 75e8f3747..000000000 --- a/Packages/ohif-measurements/client/reports/reportMeasurementDataToCSV.js +++ /dev/null @@ -1,51 +0,0 @@ -import { getExportMeasurementData } from "./reportMeasurementData"; - -const columnDelimiter = ','; -const lineDelimiter = '\n'; -const headers = { - patientName: 'Patient Name', - mrn: 'MRN', - studyDate: 'Study Date', - seriesModality: 'Series Modality', - seriesDate: 'Series Date', - seriesDescription: 'Series Description', - seriesInstanceUid: 'Series InstanceUid', - measurementTool: 'Measurement Tool', - measurementDescription: 'Measurement Description', - length: 'Length', - mean: 'Mean', - stdDev: 'stdDev', - area: 'area' -}; - -export const getCSVMeasurementData = async (measurementApi, timepointApi) => { - let lineData = []; - let csvData = ''; - const dataObject = await getExportMeasurementData(measurementApi, timepointApi); - - for(header in headers) { - lineData.push(headers[header]); - } - csvData += lineData.join(columnDelimiter) + lineDelimiter; - - for(measurementLine of dataObject.data) { - lineData = [ - dataObject.patientName, - dataObject.mrn, - dataObject.studyDate, - measurementLine.seriesModality, - measurementLine.seriesDate, - measurementLine.seriesDescription, - measurementLine.seriesInstanceUid, - measurementLine.measurementTool, - measurementLine.measurementDescription, - measurementLine.length, - measurementLine.mean, - measurementLine.stdDev, - measurementLine.area - ]; - csvData += lineData.join(columnDelimiter) + lineDelimiter; - } - - return csvData; -}; \ No newline at end of file diff --git a/Packages/ohif-measurements/package.js b/Packages/ohif-measurements/package.js deleted file mode 100644 index 220b754ed..000000000 --- a/Packages/ohif-measurements/package.js +++ /dev/null @@ -1,48 +0,0 @@ -Npm.depends({ - ajv: '4.10.4', - url: '0.11.0', - jspdf: '1.3.3' -}); - -Package.describe({ - name: 'ohif:measurements', - summary: 'OHIF Measurement Tools', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('standard-app-packages'); - api.use('jquery'); - api.use('stylus'); - api.use('random'); - - api.use('momentjs:moment'); - - // Schema for Data Models - api.use('aldeed:simple-schema'); - api.use('aldeed:collection2'); - - // Template overriding - api.use('aldeed:template-extension@4.0.0'); - - // Our custom packages - api.use('ohif:cornerstone'); - api.use('ohif:design'); - api.use('ohif:core'); - api.use('ohif:select-tree'); - api.use('ohif:log'); - api.use('ohif:studies'); - api.use('ohif:hanging-protocols'); - api.use('ohif:viewerbase'); - - // Client and server imports - api.addFiles('both/index.js', ['client', 'server']); - - // Client imports - api.addFiles('client/index.js', 'client'); - - api.export('MeasurementSchemaTypes', ['client', 'server']); -}); diff --git a/Packages/ohif-metadata/client/OHIFInstanceMetadata.js b/Packages/ohif-metadata/client/OHIFInstanceMetadata.js deleted file mode 100644 index cc73cca70..000000000 --- a/Packages/ohif-metadata/client/OHIFInstanceMetadata.js +++ /dev/null @@ -1,119 +0,0 @@ -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -const InstanceMetadata = Viewerbase.metadata.InstanceMetadata; -const DICOMTagDescriptions = Viewerbase.DICOMTagDescriptions; - -export class OHIFInstanceMetadata extends InstanceMetadata { - - /** - * @param {Object} Instance object. - */ - constructor(data, series, study, uid) { - super(data, uid); - this.init(series, study); - } - - init(series, study) { - const instance = this.getData(); - - // Initialize Private Properties - Object.defineProperties(this, { - _sopInstanceUID: { - configurable: false, - enumerable: false, - writable: false, - value: instance.sopInstanceUid - }, - _study: { - configurable: false, - enumerable: false, - writable: false, - value: study - }, - _series: { - configurable: false, - enumerable: false, - writable: false, - value: series - }, - _instance: { - configurable: false, - enumerable: false, - writable: false, - value: instance - }, - _cache: { - configurable: false, - enumerable: false, - writable: false, - value: Object.create(null) - } - }); - } - - // Override - getTagValue(tagOrProperty, defaultValue, bypassCache) { - - // check if this property has been cached... - if (tagOrProperty in this._cache && bypassCache !== true) { - return this._cache[tagOrProperty]; - } - - const propertyName = OHIFInstanceMetadata.getPropertyName(tagOrProperty); - - // Search property value in the whole study metadata chain... - let rawValue; - if (propertyName in this._instance) { - rawValue = this._instance[propertyName]; - } else if (propertyName in this._series) { - rawValue = this._series[propertyName]; - } else if (propertyName in this._study) { - rawValue = this._study[propertyName]; - } - - if (rawValue !== void 0) { - // if rawValue value is not undefined, cache result... - this._cache[tagOrProperty] = rawValue; - return rawValue; - } - - return defaultValue; - } - - // Override - tagExists(tagOrProperty) { - const propertyName = OHIFInstanceMetadata.getPropertyName(tagOrProperty); - - return (propertyName in this._instance || propertyName in this._series || propertyName in this._study); - } - - // Override - getImageId(frame, thumbnail) { - // If _imageID is not cached, create it - if (this._imageId === null) { - this._imageId = Viewerbase.getImageId(this.getData(), frame, thumbnail); - } - - return this._imageId; - } - - /** - * Static methods - */ - - // @TODO: The current mapping of standard DICOM property names to local property names is not optimal. - // The inconsistency in property naming makes this function increasingly complex. - // A possible solution to improve this would be adapt retriveMetadata names to use DICOM standard names as in dicomTagDescriptions.js - static getPropertyName(tagOrProperty) { - let propertyName; - const tagInfo = DICOMTagDescriptions.find(tagOrProperty); - - if (tagInfo !== void 0) { - // This function tries to translate standard DICOM property names into local naming convention. - propertyName = tagInfo.keyword.replace(/^SOP/, 'sop').replace(/UID$/, 'Uid').replace(/ID$/, 'Id'); - propertyName = propertyName.charAt(0).toLowerCase() + propertyName.substr(1); - } - - return propertyName; - } -} diff --git a/Packages/ohif-metadata/client/OHIFSeriesMetadata.js b/Packages/ohif-metadata/client/OHIFSeriesMetadata.js deleted file mode 100644 index 8028815fa..000000000 --- a/Packages/ohif-metadata/client/OHIFSeriesMetadata.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Viewerbase } from 'meteor/ohif:viewerbase'; -import { OHIFInstanceMetadata } from './OHIFInstanceMetadata'; - -export class OHIFSeriesMetadata extends Viewerbase.metadata.SeriesMetadata { - - /** - * @param {Object} Series object. - */ - constructor(data, study, uid) { - super(data, uid); - this.init(study); - } - - init(study) { - const series = this.getData(); - - // define "_seriesInstanceUID" protected property... - Object.defineProperty(this, '_seriesInstanceUID', { - configurable: false, - enumerable: false, - writable: false, - value: series.seriesInstanceUid - }); - - // populate internal list of instances... - series.instances.forEach(instance => { - this.addInstance(new OHIFInstanceMetadata(instance, series, study)); - }); - } - -} - diff --git a/Packages/ohif-metadata/client/OHIFStudyMetadata.js b/Packages/ohif-metadata/client/OHIFStudyMetadata.js deleted file mode 100644 index 4c0894633..000000000 --- a/Packages/ohif-metadata/client/OHIFStudyMetadata.js +++ /dev/null @@ -1,31 +0,0 @@ -import { Viewerbase } from 'meteor/ohif:viewerbase'; -import { OHIFSeriesMetadata } from './OHIFSeriesMetadata'; - -export class OHIFStudyMetadata extends Viewerbase.metadata.StudyMetadata { - - /** - * @param {Object} Study object. - */ - constructor(data, uid) { - super(data, uid); - this.init(); - } - - init() { - const study = this.getData(); - - // define "_studyInstanceUID" protected property - Object.defineProperty(this, '_studyInstanceUID', { - configurable: false, - enumerable: false, - writable: false, - value: study.studyInstanceUid - }); - - // populate internal list of series - study.seriesList.forEach(series => { - this.addSeries(new OHIFSeriesMetadata(series, study)); - }); - } - -} diff --git a/Packages/ohif-metadata/client/index.js b/Packages/ohif-metadata/client/index.js deleted file mode 100644 index 1ccd601e1..000000000 --- a/Packages/ohif-metadata/client/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import { Metadata } from '../namespace'; - -// OHIFStudyMetadata, OHIFSeriesMetadata, OHIFInstanceMetadata -import { OHIFStudyMetadata } from './OHIFStudyMetadata'; -import { OHIFSeriesMetadata } from './OHIFSeriesMetadata'; -import { OHIFInstanceMetadata } from './OHIFInstanceMetadata'; - -Metadata.StudyMetadata = OHIFStudyMetadata; -Metadata.SeriesMetadata = OHIFSeriesMetadata; -Metadata.InstanceMetadata = OHIFInstanceMetadata; \ No newline at end of file diff --git a/Packages/ohif-metadata/main.js b/Packages/ohif-metadata/main.js deleted file mode 100644 index 4456cc3a4..000000000 --- a/Packages/ohif-metadata/main.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Import namespace... - */ - -import { OHIF, Metadata } from './namespace.js'; - -/** - * Import scripts that will populate the Metadata namespace as a side effect only import. This is effectively the public API... - */ - -import './client/'; // which is actually: import './client/index.js'; - -/** - * Export relevant objects... - * - * With the following export it becomes possible to import "OHIF" from "ohif:core" and "Metadata" - * from "ohif:metadata" using a single import (a shorthand), like this: - * - * import { OHIF } from 'meteor/ohif:metadata'; - * - * Which is equivalent to: - * - * import { OHIF } from 'meteor/ohif:core'; - * import 'meteor/ohif:metadata'; - * - * The second (extended) format should be used when other OHIF packages are also to be used within - * the current module. This makes it explicit that the following imports will populate their - * respective namespaces within the to "OHIF" namespace. Example: - * - * import { OHIF } from 'meteor/ohif:core'; - * import 'meteor/ohif:metadata'; - * import 'meteor/ohif:hanging-protocols'; - * [ ... ] - * OHIF.metadata.setActiveViewport(...); - * OHIF.hangingprotocols.doSomething(...); - * - */ - -export { OHIF, Metadata }; diff --git a/Packages/ohif-metadata/namespace.js b/Packages/ohif-metadata/namespace.js deleted file mode 100644 index a17212475..000000000 --- a/Packages/ohif-metadata/namespace.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Import main dependency... - */ - -import { OHIF } from 'meteor/ohif:core'; - -/** - * Create Metadata namespace... - */ - -const Metadata = {}; - -/** - * Append Metadata namespace to OHIF namespace... - */ - -OHIF.metadata = Metadata; - -/** - * Export relevant objects... - */ - -export { OHIF, Metadata }; diff --git a/Packages/ohif-metadata/package.js b/Packages/ohif-metadata/package.js deleted file mode 100644 index 13a0e2ac7..000000000 --- a/Packages/ohif-metadata/package.js +++ /dev/null @@ -1,16 +0,0 @@ -Package.describe({ - name: 'ohif:metadata', - summary: 'OHIF Metadata classes', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - - api.use('ohif:core'); - api.use('ohif:viewerbase'); - - api.mainModule('main.js', 'client'); -}); diff --git a/Packages/ohif-polyfill/README.md b/Packages/ohif-polyfill/README.md deleted file mode 100644 index 7439093ce..000000000 --- a/Packages/ohif-polyfill/README.md +++ /dev/null @@ -1,21 +0,0 @@ -## ohif:polyfill - -This package provides polyfills for older browsers which make them compatible with the application. - -#### Creating assets - -Every polyfill shall be added as an asset JS file in the Meteor package definition file (**package.js**) and its file shall be placed inside the **public/js** directory. Adding these files as assets will prevent them from being loaded on all browsers without need. -These files are exposed to the client and can be accessed through the application's **/packages/ohif_polyfill/public/js/** URI. - -#### Enabling polyfills - -In order to enable a polyfill for a specific browser, a JS file shall be created inside the package's **client** directory with the browser name. -We must check the current browser to include the polyfills, and to enable a polyfill we need something like this: -````js -import { absoluteUrl } from './lib/absoluteUrl'; - -if (navigator && /BrowserID/.test(navigator.userAgent)) { - const src = absoluteUrl('/packages/ohif_polyfill/public/js/mypolyfill.min.js'); - document.write(` - - - diff --git a/Packages/ohif-viewerbase/.coverage.json b/Packages/ohif-viewerbase/.coverage.json deleted file mode 100644 index 61f434b07..000000000 --- a/Packages/ohif-viewerbase/.coverage.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "include": [ - "server/*.js", - "client/*.js", - "both/*.js" - ], - "exclude": { - "general": [], - "server": [ - "**/node_modules/**/*.json", - "**/.?*/**", - "**/packages/!(local-test_?*.js)", - "**/+([^:]):+([^:])/**", - "**/@(test|tests|spec|specs)/**", - "**/?(*.)test?(s).?*", - "**/?(*.)spec?(s).?*", - "**/?(*.)app-test?(s).?*", - "**/?(*.)app-spec?(s).?*" - ], - "client": [ - "**/client/stylesheets/**", - "**/.npm/package/node_modules/**", - "**/web.browser/packages/**", - "**/.?*/**", - "**/packages/!(local-test_?*.js)", - "**/+([^:]):+([^:])/**", - "**/@(test|tests|spec|specs)/**", - "**/?(*.)test?(s).?*", - "**/?(*.)spec?(s).?*", - "**/?(*.)app-test?(s).?*", - "**/?(*.)app-spec?(s).?*" - ] - }, - "remapFormat": [ - "html", - "cobertura", - "clover", - "json", - "json-summary", - "lcovonly", - "teamcity", - "text", - "text-summary" - ], - "output": "./.coverage" -} \ No newline at end of file diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin-ext.woff deleted file mode 100644 index 14ec1ac29..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin-ext.woff2 deleted file mode 100644 index db112b9b4..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin.woff deleted file mode 100644 index 3e6b63144..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin.woff2 deleted file mode 100644 index 597552fd3..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Black-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff deleted file mode 100644 index 8fd9362f5..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff2 deleted file mode 100644 index e43487291..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff deleted file mode 100644 index 8197f9342..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff2 deleted file mode 100644 index 6c5a14f2f..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff deleted file mode 100644 index 1a790369d..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff2 deleted file mode 100644 index 14bc6fefe..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin.woff deleted file mode 100644 index 42a130ccb..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin.woff2 deleted file mode 100644 index a0b681726..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Bold-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff deleted file mode 100644 index a1582d92c..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff2 deleted file mode 100644 index a1cb65d86..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff deleted file mode 100644 index 073e92049..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff2 deleted file mode 100644 index 988a8fb08..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff deleted file mode 100644 index 623f96814..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff2 deleted file mode 100644 index d00cbf12b..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin.woff deleted file mode 100644 index 3e3965cf2..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin.woff2 deleted file mode 100644 index 9417001f5..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Italic-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin-ext.woff deleted file mode 100644 index 1e3a3f3f7..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin-ext.woff2 deleted file mode 100644 index d41bd8fc7..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin.woff deleted file mode 100644 index 806617a3a..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin.woff2 deleted file mode 100644 index d1eb5837a..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Light-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff deleted file mode 100644 index 209bb9692..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff2 deleted file mode 100644 index 21a0c0123..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin.woff deleted file mode 100644 index 23a171a76..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin.woff2 deleted file mode 100644 index 6684623a9..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-LightItalic-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff deleted file mode 100644 index 02ad2bf48..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff2 deleted file mode 100644 index 482d8c374..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin.woff deleted file mode 100644 index 438079137..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin.woff2 deleted file mode 100644 index ede6bf463..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Medium-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff deleted file mode 100644 index 43bfb98b1..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff2 deleted file mode 100644 index 11368b27d..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff deleted file mode 100644 index a6cb6c7c4..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff2 deleted file mode 100644 index 33796e610..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff deleted file mode 100644 index cbaabcd82..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff2 deleted file mode 100644 index 60beafe51..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin.woff deleted file mode 100644 index 59490056f..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin.woff2 deleted file mode 100644 index 425224723..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Regular-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff deleted file mode 100644 index ef8fb4f06..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff2 deleted file mode 100644 index 3fbb20cd5..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin.woff deleted file mode 100644 index 696aebab0..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin.woff2 deleted file mode 100644 index d4f6045b9..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-Thin-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff deleted file mode 100644 index d3a17a254..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff2 deleted file mode 100644 index badbee76b..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff deleted file mode 100644 index 212b51b31..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff2 deleted file mode 100644 index 1be5d2cbe..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff b/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff deleted file mode 100644 index 6044e2a5d..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff2 b/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff2 deleted file mode 100644 index 1c46d15ec..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin.woff b/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin.woff deleted file mode 100644 index afd08ed23..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin.woff and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin.woff2 b/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin.woff2 deleted file mode 100644 index c580134e3..000000000 Binary files a/Packages/ohif-viewerbase/assets/fonts/Sanchez-Regular-latin.woff2 and /dev/null differ diff --git a/Packages/ohif-viewerbase/assets/icons.svg b/Packages/ohif-viewerbase/assets/icons.svg deleted file mode 100644 index 9b935e9bc..000000000 --- a/Packages/ohif-viewerbase/assets/icons.svg +++ /dev/null @@ -1,274 +0,0 @@ - - - HUD - - - - - - - - - Additional Measurements - - - - - - Lesions - - - - - - Settings - - - - Complete - - - - - - Locked - - - - Studies - - - - - - Window / Level - - - - - - - Link - - - - - - - Non-Target Measurement - - - - - - - - Target Measurement - - - - - - - Target CR Measurement - - CR - - - - - Target UN Measurement - - UN - - - - - Temporary Measurement - - - - - - - - More - - - - - - Pan - - - - - - - - - - - Zoom - - - - - - - Invert - - - - Stack Scroll - - - - Elliptical ROI - - - - Magnify - - - - Reset - - - - Rotate - - - - Rotate Right - - - - Cineplay Toggle - - - - Vertical - - - - Horizontal - - - - Trial Information - - - - - - Expand - - - - Add - - - - Close - - - - - - Comment - - - - - Capture Screen - - - - - - - - Warning - - - - - - - Viewport Link - - - - - - - Theme - - - - Log - - - - Server - - - - Study List - - - - Logout - - - - Password - - - - Structured Report - - - - - - - - - - - Presentation State - - - - - - - - - - - - - - Google icon - - - - - - - - - - - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/assets/user-menu-icons.svg b/Packages/ohif-viewerbase/assets/user-menu-icons.svg deleted file mode 100644 index 94ab5818c..000000000 --- a/Packages/ohif-viewerbase/assets/user-menu-icons.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - Theme - - - - Log - - - - Server - - - - Study List - - - - Logout - - - - Password - - - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/collections.js b/Packages/ohif-viewerbase/client/collections.js deleted file mode 100644 index 016c23866..000000000 --- a/Packages/ohif-viewerbase/client/collections.js +++ /dev/null @@ -1,18 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from '../namespace'; -import { TypeSafeCollection } from './lib/classes/TypeSafeCollection'; - -// Create main Studies collection which will be used across the entire viewer... -const Studies = new TypeSafeCollection(); - -// Make it publicly available on "OHIF.viewer" namespace... -OHIF.viewer.Studies = Studies; - -// Create main StudyMetadataList collection which will be used across the entire viewer... -const StudyMetadataList = new TypeSafeCollection(); - -// Make it publicly available on "OHIF.viewer" namespace... -OHIF.viewer.StudyMetadataList = StudyMetadataList; - -// Subscriptions... -Meteor.subscribe('studyImportStatus'); diff --git a/Packages/ohif-viewerbase/client/compatibility/dialogPolyfill.js b/Packages/ohif-viewerbase/client/compatibility/dialogPolyfill.js deleted file mode 100644 index a7b88abf3..000000000 --- a/Packages/ohif-viewerbase/client/compatibility/dialogPolyfill.js +++ /dev/null @@ -1,412 +0,0 @@ -var dialogPolyfill = (function() { - - var supportCustomEvent = window.CustomEvent; - if (!supportCustomEvent || typeof supportCustomEvent == "object") { - supportCustomEvent = function CustomEvent(event, x) { - x = x || {}; - var ev = document.createEvent('CustomEvent'); - ev.initCustomEvent(event, !!x.bubbles, !!x.cancelable, x.detail || null); - return ev; - }; - supportCustomEvent.prototype = window.Event.prototype; - } - - /** - * Finds the nearest from the passed element. - * - * @param {Element} el to search from - * @param {HTMLDialogElement} dialog found - */ - function findNearestDialog(el) { - while (el) { - if (el.nodeName == 'DIALOG') { - return el; - } - el = el.parentElement; - } - return null; - } - - var dialogPolyfill = {}; - - dialogPolyfill.reposition = function(element) { - var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; - var topValue = scrollTop + (window.innerHeight - element.offsetHeight) / 2; - element.style.top = Math.max(0, topValue) + 'px'; - element.dialogPolyfillInfo.isTopOverridden = true; - }; - - dialogPolyfill.inNodeList = function(nodeList, node) { - for (var i = 0; i < nodeList.length; ++i) { - if (nodeList[i] == node) - return true; - } - return false; - }; - - dialogPolyfill.isInlinePositionSetByStylesheet = function(element) { - for (var i = 0; i < document.styleSheets.length; ++i) { - var styleSheet = document.styleSheets[i]; - var cssRules = null; - // Some browsers throw on cssRules. - try { - cssRules = styleSheet.cssRules; - } catch (e) {} - if (!cssRules) - continue; - for (var j = 0; j < cssRules.length; ++j) { - var rule = cssRules[j]; - var selectedNodes = null; - // Ignore errors on invalid selector texts. - try { - selectedNodes = document.querySelectorAll(rule.selectorText); - } catch(e) {} - if (!selectedNodes || !dialogPolyfill.inNodeList(selectedNodes, element)) - continue; - var cssTop = rule.style.getPropertyValue('top'); - var cssBottom = rule.style.getPropertyValue('bottom'); - if ((cssTop && cssTop != 'auto') || (cssBottom && cssBottom != 'auto')) - return true; - } - } - return false; - }; - - dialogPolyfill.needsCentering = function(dialog) { - var computedStyle = window.getComputedStyle(dialog); - if (computedStyle.position != 'absolute') { - return false; - } - - // We must determine whether the top/bottom specified value is non-auto. In - // WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but - // Firefox returns the used value. So we do this crazy thing instead: check - // the inline style and then go through CSS rules. - if ((dialog.style.top != 'auto' && dialog.style.top != '') || - (dialog.style.bottom != 'auto' && dialog.style.bottom != '')) - return false; - return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog); - }; - - dialogPolyfill.showDialog = function(isModal) { - if (this.open) { - throw 'InvalidStateError: showDialog called on open dialog'; - } - this.open = true; // TODO: should be a getter mapped to attribute - this.setAttribute('open', 'open'); - - if (isModal) { - // Find element with `autofocus` attribute or first form control - var first_form_ctrl = null; - var autofocus = null; - var findElementToFocus = function(root) { - if (!root.children) { - return; - } - for (var i = 0; i < root.children.length; i++) { - var elem = root.children[i]; - if (first_form_ctrl === null && !elem.disabled && ( - elem.nodeName == 'BUTTON' || - elem.nodeName == 'INPUT' || - elem.nodeName == 'KEYGEN' || - elem.nodeName == 'SELECT' || - elem.nodeName == 'TEXTAREA')) { - first_form_ctrl = elem; - } - if (elem.autofocus) { - autofocus = elem; - return; - } - findElementToFocus(elem); - if (autofocus !== null) return; - } - }; - - findElementToFocus(this); - - if (autofocus !== null) { - autofocus.focus(); - } else if (first_form_ctrl !== null) { - first_form_ctrl.focus(); - } - } - - if (dialogPolyfill.needsCentering(this)) - dialogPolyfill.reposition(this); - if (isModal) { - this.dialogPolyfillInfo.modal = true; - dialogPolyfill.dm.pushDialog(this); - } - - // IE sometimes complains when calling .focus() that it - // "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus." - try { - if (autofocus !== null) { - autofocus.focus(); - } else if (first_form_ctrl !== null) { - first_form_ctrl.focus(); - } - } catch(e) {} - this.style.zoom = 1; - }; - - dialogPolyfill.close = function(retval) { - if (!this.open && !window.HTMLDialogElement) { - // Native implementations will set .open to false, so ignore this error. - throw 'InvalidStateError: close called on closed dialog'; - } - this.open = false; - this.removeAttribute('open'); - - // Leave returnValue untouched in case it was set directly on the element - if (typeof retval != 'undefined') { - this.returnValue = retval; - } - - // This won't match the native exactly because if the user sets top - // on a centered polyfill dialog, that top gets thrown away when the dialog is - // closed. Not sure it's possible to polyfill this perfectly. - if (this.dialogPolyfillInfo.isTopOverridden) { - this.style.top = 'auto'; - } - - if (this.dialogPolyfillInfo.modal) { - dialogPolyfill.dm.removeDialog(this); - } - - // Triggering "close" event for any attached listeners on the - var event; - if (document.createEvent) { - event = document.createEvent('HTMLEvents'); - event.initEvent('close', true, true); - } else { - event = new Event('close'); - } - this.dispatchEvent(event); - - return this.returnValue; - }; - - dialogPolyfill.registerDialog = function(element) { - if (element.show) { - // console.warn("This browser already supports , the polyfill " + - // "may not work correctly."); - } - element.show = dialogPolyfill.showDialog.bind(element, false); - element.showModal = dialogPolyfill.showDialog.bind(element, true); - element.close = dialogPolyfill.close.bind(element); - element.dialogPolyfillInfo = {}; - element.open = false; - }; - - // The overlay is used to simulate how a modal dialog blocks the document. The - // blocking dialog is positioned on top of the overlay, and the rest of the - // dialogs on the pending dialog stack are positioned below it. In the actual - // implementation, the modal dialog stacking is controlled by the top layer, - // where z-index has no effect. - var TOP_LAYER_ZINDEX = 100000; - var MAX_PENDING_DIALOGS = 100000; - - dialogPolyfill.DialogManager = function() { - this.pendingDialogStack = []; - this.overlay = document.createElement('div'); - this.overlay.style.width = '100%'; - this.overlay.style.height = '100%'; - this.overlay.style.position = 'fixed'; - this.overlay.style.left = '0px'; - this.overlay.style.top = '0px'; - this.overlay.style.backgroundColor = 'rgba(0,0,0,0.0)'; - - this.focusPageLast = this.createFocusable(); - this.overlay.appendChild(this.focusPageLast); - - this.overlay.addEventListener('click', function(e) { - var redirectedEvent = document.createEvent('MouseEvents'); - redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window, - e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, - e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget); - document.body.dispatchEvent(redirectedEvent); - }); - - // TODO: Only install when any dialogs are open. - document.addEventListener('submit', function(ev) { - var method = ev.target.getAttribute('method'); - method = method ? method.toLowerCase() : ''; - if (method != 'dialog') { return; } - ev.preventDefault(); - - var dialog = findNearestDialog(ev.target); - if (!dialog) { return; } - - // FIXME: The original event doesn't contain the INPUT element used to - // submit the form (if any). Look in some possible places. - var returnValue; - var cands = [document.activeElement, ev.explicitOriginalTarget]; - cands.some(function(cand) { - if (cand && cand.nodeName == 'INPUT' && cand.form == ev.target) { - returnValue = cand.value; - return true; - } - }); - dialog.close(returnValue); - }, true); - }; - - dialogPolyfill.DialogManager.prototype.createFocusable = function(tabIndex) { - var span = document.createElement('span'); - span.tabIndex = tabIndex || 0; - span.style.opacity = 0; - span.style.position = 'static'; - return span; - }; - - dialogPolyfill.DialogManager.prototype.blockDocument = function() { - if (!document.body.contains(this.overlay)) { - document.body.appendChild(this.overlay); - - // On Safari/Mac (and possibly other browsers), the documentElement is - // not focusable. This is required for modal dialogs as it is the first - // element to be hit by a tab event, and further tabs are redirected to - // the most visible dialog. - if (this.needsDocumentElementFocus === undefined) { - document.documentElement.focus(); - this.needsDocumentElementFocus = - (document.activeElement != document.documentElement); - } - if (this.needsDocumentElementFocus) { - document.documentElement.tabIndex = 1; - } - } - }; - - dialogPolyfill.DialogManager.prototype.unblockDocument = function() { - document.body.removeChild(this.overlay); - if (this.needsDocumentElementFocus) { - // TODO: Restore the previous tabIndex, rather than clearing it. - document.documentElement.tabIndex = ''; - } - }; - - dialogPolyfill.DialogManager.prototype.updateStacking = function() { - if (this.pendingDialogStack.length == 0) { - this.unblockDocument(); - return; - } - this.blockDocument(); - - var zIndex = TOP_LAYER_ZINDEX; - for (var i = 0; i < this.pendingDialogStack.length; i++) { - if (i == this.pendingDialogStack.length - 1) - this.overlay.style.zIndex = zIndex++; - var dialog = this.pendingDialogStack[i]; - dialog.dialogPolyfillInfo.backdrop.style.zIndex = zIndex++; - dialog.style.zIndex = zIndex++; - } - }; - - dialogPolyfill.DialogManager.prototype.handleKey = function(event) { - var dialogCount = this.pendingDialogStack.length; - if (dialogCount == 0) { - return; - } - var dialog = this.pendingDialogStack[dialogCount - 1]; - var pfi = dialog.dialogPolyfillInfo; - - switch (event.keyCode) { - case 9: /* tab */ - var activeElement = document.activeElement; - var forward = !event.shiftKey; - if (forward) { - // Tab forward, so look for document or fake last focus element. - if (activeElement == document.documentElement || - activeElement == document.body || - activeElement == pfi.backdrop) { - pfi.focusFirst.focus(); - } else if (activeElement == pfi.focusLast) { - // TODO: Instead of wrapping to focusFirst, escape to browser chrome. - pfi.focusFirst.focus(); - } - } else { - // Tab backwards, so look for fake first focus element. - if (activeElement == pfi.focusFirst) { - // TODO: Instead of wrapping to focusLast, escape to browser chrome. - pfi.focusLast.focus(); - } else if (activeElement == this.focusPageLast) { - // The focus element is at the end of the page (e.g., shift-tab from - // the window chrome): move current focus to the last element in the - // dialog instead. - pfi.focusLast.focus(); - } - } - break; - - case 27: /* esc */ - event.preventDefault(); - event.stopPropagation(); - var cancelEvent = new supportCustomEvent('cancel', { - bubbles: false, - cancelable: true - }); - if (dialog.dispatchEvent(cancelEvent)) { - dialog.close(); - } - break; - - } - }; - - dialogPolyfill.DialogManager.prototype.pushDialog = function(dialog) { - if (this.pendingDialogStack.length >= MAX_PENDING_DIALOGS) { - throw "Too many modal dialogs"; - } - - var backdrop = document.createElement('div'); - backdrop.className = 'backdrop'; - var clickEventListener = function(e) { - var redirectedEvent = document.createEvent('MouseEvents'); - redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window, - e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, - e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget); - dialog.dispatchEvent(redirectedEvent); - }; - backdrop.addEventListener('click', clickEventListener); - dialog.parentNode.insertBefore(backdrop, dialog.nextSibling); - dialog.dialogPolyfillInfo.backdrop = backdrop; - dialog.dialogPolyfillInfo.clickEventListener = clickEventListener; - this.pendingDialogStack.push(dialog); - this.updateStacking(); - - dialog.dialogPolyfillInfo.focusFirst = this.createFocusable(); - dialog.dialogPolyfillInfo.focusLast = this.createFocusable(); - dialog.appendChild(dialog.dialogPolyfillInfo.focusLast); - dialog.insertBefore( - dialog.dialogPolyfillInfo.focusFirst, dialog.firstChild); - }; - - dialogPolyfill.DialogManager.prototype.removeDialog = function(dialog) { - var index = this.pendingDialogStack.indexOf(dialog); - if (index == -1) { - return; - } - this.pendingDialogStack.splice(index, 1); - var backdrop = dialog.dialogPolyfillInfo.backdrop; - var clickEventListener = dialog.dialogPolyfillInfo.clickEventListener; - backdrop.removeEventListener('click', clickEventListener); - backdrop.parentNode.removeChild(backdrop); - dialog.dialogPolyfillInfo.backdrop = null; - dialog.dialogPolyfillInfo.clickEventListener = null; - this.updateStacking(); - - dialog.removeChild(dialog.dialogPolyfillInfo.focusFirst); - dialog.removeChild(dialog.dialogPolyfillInfo.focusLast); - dialog.dialogPolyfillInfo.focusFirst = null; - dialog.dialogPolyfillInfo.focusLast = null; - }; - - dialogPolyfill.dm = new dialogPolyfill.DialogManager(); - - document.addEventListener('keydown', - dialogPolyfill.dm.handleKey.bind(dialogPolyfill.dm)); - - return dialogPolyfill; -})(); diff --git a/Packages/ohif-viewerbase/client/compatibility/dialogPolyfill.styl b/Packages/ohif-viewerbase/client/compatibility/dialogPolyfill.styl deleted file mode 100644 index fc571789a..000000000 --- a/Packages/ohif-viewerbase/client/compatibility/dialogPolyfill.styl +++ /dev/null @@ -1,34 +0,0 @@ -dialog - position: absolute - left: 0 - right: 0 - width: -moz-fit-content - width: -webkit-fit-content - width: fit-content - height: -moz-fit-content - height: -webkit-fit-content - height: fit-content - margin: auto - border: solid - padding: 1em - background: white - color: black - display: none - -dialog[open] - display: block - -dialog + .backdrop - position: fixed - top: 0 - right: 0 - bottom: 0 - left: 0 - background: rgba(0,0,0,0.1) - -/* for small devices, modal dialogs go full-screen */ -@media screen and (max-width: 540px) - dialog[_polyfill_modal] - top: 0 - width: auto - margin: 1em \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.html b/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.html deleted file mode 100644 index 3b2b696f9..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.html +++ /dev/null @@ -1,77 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.js b/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.js deleted file mode 100644 index d6393a190..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.js +++ /dev/null @@ -1,5 +0,0 @@ -Template.aboutModal.helpers({ - githubUrl() { - return 'https://github.com/OHIF/Viewers'; - } -}); diff --git a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.styl b/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.styl deleted file mode 100644 index b15492da4..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/aboutModal/aboutModal.styl +++ /dev/null @@ -1,24 +0,0 @@ -@import "{ohif:design}/app" - -#aboutModal - .logo - .logoText - display: inline-block - font-family: $logoFontFamily - font-weight: $logoFontWeight - theme('color', '$textPrimaryColor') - font-size: 20pt - line-height: 45px - text-decoration: none - - .logoImage - width: 45px - height: 45px - margin: 0 1rem - - .forkOnGithub - position: absolute - top: 0 - right: 0 - border: 0 - cursor: pointer diff --git a/Packages/ohif-viewerbase/client/components/basic/errorText/errorText.html b/Packages/ohif-viewerbase/client/components/basic/errorText/errorText.html deleted file mode 100644 index 449ef9ce1..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/errorText/errorText.html +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/basic/errorText/errorText.styl b/Packages/ohif-viewerbase/client/components/basic/errorText/errorText.styl deleted file mode 100644 index afd22a155..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/errorText/errorText.styl +++ /dev/null @@ -1,5 +0,0 @@ -.errorTextDiv - font-weight: 300 - padding: 30px - text-align: center - color: #ffffff diff --git a/Packages/ohif-viewerbase/client/components/basic/layout/layout.html b/Packages/ohif-viewerbase/client/components/basic/layout/layout.html deleted file mode 100644 index b023d9c9a..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/layout/layout.html +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/basic/layout/layout.styl b/Packages/ohif-viewerbase/client/components/basic/layout/layout.styl deleted file mode 100644 index 0726cdd00..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/layout/layout.styl +++ /dev/null @@ -1,269 +0,0 @@ -/* - Fonts files: - - Used fonts: - - Sanchez and Roboto from Google Font - - woff2 and woff (to support IE11) files - - latin and latin extended subsets -*/ - -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 100; - src: local('Roboto Thin'), local('Roboto-Thin'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Thin-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 100; - src: local('Roboto Thin'), local('Roboto-Thin'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Thin-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Thin-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - src: local('Roboto Light'), local('Roboto-Light'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Light-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Light-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 300; - src: local('Roboto Light'), local('Roboto-Light'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Light-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Light-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Regular-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: local('Roboto'), local('Roboto-Regular'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Regular-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Regular-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: local('Roboto Medium'), local('Roboto-Medium'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Medium-latin-ext.woff') format('woff');; - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: local('Roboto Medium'), local('Roboto-Medium'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Medium-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Medium-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - src: local('Roboto Bold'), local('Roboto-Bold'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Bold-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 700; - src: local('Roboto Bold'), local('Roboto-Bold'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Bold-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Bold-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 900; - src: local('Roboto Black'), local('Roboto-Black'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Black-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Black-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 900; - src: local('Roboto Black'), local('Roboto-Black'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Black-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Black-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 100; - src: local('Roboto Thin Italic'), local('Roboto-ThinItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-ThinItalic-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 100; - src: local('Roboto Thin Italic'), local('Roboto-ThinItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-ThinItalic-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - src: local('Roboto Light Italic'), local('Roboto-LightItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-LightItalic-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 300; - src: local('Roboto Light Italic'), local('Roboto-LightItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-LightItalic-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-LightItalic-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - src: local('Roboto Italic'), local('Roboto-Italic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Italic-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 400; - src: local('Roboto Italic'), local('Roboto-Italic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Italic-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-Italic-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 500; - src: local('Roboto Medium Italic'), local('Roboto-MediumItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-MediumItalic-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 500; - src: local('Roboto Medium Italic'), local('Roboto-MediumItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-MediumItalic-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - src: local('Roboto Bold Italic'), local('Roboto-BoldItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BoldItalic-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 700; - src: local('Roboto Bold Italic'), local('Roboto-BoldItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BoldItalic-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} -/* latin-ext */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 900; - src: local('Roboto Black Italic'), local('Roboto-BlackItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BlackItalic-latin-ext.woff') format('woff'); - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Roboto'; - font-style: italic; - font-weight: 900; - src: local('Roboto Black Italic'), local('Roboto-BlackItalic'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Roboto-BlackItalic-latin.woff') format('woff'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} - -/* latin-ext */ -@font-face { - font-family: 'Sanchez'; - font-style: normal; - font-weight: 400; - src: local('Sanchez'), local('Sanchez-Regular'), - url('/packages/ohif_viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Sanchez-Regular-latin-ext.woff') format('woff') - unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; -} -/* latin */ -@font-face { - font-family: 'Sanchez'; - font-style: normal; - font-weight: 400; - src: local('Sanchez'), local('Sanchez-Regular'), - url('/packages/ohif_viewerbase/assets/fonts/Sanchez-Regular-latin.woff2') format('woff2'), - url('/packages/ohif_viewerbase/assets/fonts/Sanchez-Regular-latin.woff') format('woff') - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; -} \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/basic/loadingText/loadingText.html b/Packages/ohif-viewerbase/client/components/basic/loadingText/loadingText.html deleted file mode 100644 index 246376ed8..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/loadingText/loadingText.html +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/basic/loadingText/loadingText.styl b/Packages/ohif-viewerbase/client/components/basic/loadingText/loadingText.styl deleted file mode 100644 index 62b0c5f89..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/loadingText/loadingText.styl +++ /dev/null @@ -1,4 +0,0 @@ -.loadingTextDiv - font-weight: 300 - padding: 30px - text-align: center diff --git a/Packages/ohif-viewerbase/client/components/basic/removableBackdrop/removableBackdrop.html b/Packages/ohif-viewerbase/client/components/basic/removableBackdrop/removableBackdrop.html deleted file mode 100644 index 4a02a21f0..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/removableBackdrop/removableBackdrop.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/basic/removableBackdrop/removableBackdrop.styl b/Packages/ohif-viewerbase/client/components/basic/removableBackdrop/removableBackdrop.styl deleted file mode 100644 index 06a5d3a7b..000000000 --- a/Packages/ohif-viewerbase/client/components/basic/removableBackdrop/removableBackdrop.styl +++ /dev/null @@ -1,9 +0,0 @@ -.removableBackdrop - position: fixed - top: 0 - right: 0 - bottom: 0 - left: 0 - z-index: 50 - background-color: transparent - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.html b/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.html deleted file mode 100644 index 5f9386a58..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.html +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.js b/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.js deleted file mode 100644 index 0831da598..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.js +++ /dev/null @@ -1,144 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; - -/** - * Asynchronous wrapper around Cornerstone's renderToCanvas method. - * - * @param {HTMLElement} canvasElement An HTML element - * @param {Image} image A Cornerstone Image - * - * @return {Promise} A promise tracking the progress of the rendering. Resolves empty. - */ -function renderAsync(canvasElement, image) { - return new Promise((resolve, reject) => { - try { - cornerstone.renderToCanvas(canvasElement, image); - resolve(); - } catch(error) { - reject(error); - } - }); -} - -Template.imageThumbnail.onCreated(() => { - const instance = Template.instance(); - - instance.isLoading = new ReactiveVar(false); - instance.hasLoadingError = new ReactiveVar(false); - - // Get the image ID for current thumbnail - instance.getThumbnailImageId = () => { - const settingPath = 'public.ui.useMiddleSeriesInstanceAsThumbnail'; - const useMiddleFrame = OHIF.utils.ObjectPath.get(Meteor.settings, settingPath); - const stack = instance.data.thumbnail.stack; - const lastIndex = (stack.numImageFrames || stack.images.length || 1) - 1; - let imageIndex = useMiddleFrame ? Math.floor(lastIndex / 2) : 0; - let imageInstance; - - if (stack.isMultiFrame) { - imageInstance = stack.images[0]; - } else { - imageInstance = stack.images[imageIndex]; - imageIndex = undefined; - } - - return imageInstance.getImageId(imageIndex, true); - }; -}); - -Template.imageThumbnail.onRendered(() => { - const instance = Template.instance(); - - // Declare DOM and jQuery objects - const $parent = instance.$('.imageThumbnail'); - const $thumbnailElement = $parent.find('.imageThumbnailCanvas'); - - instance.refreshImage = () => { - const staticImageCanvasElement = $thumbnailElement.find('canvas').get(0); - - // Activate the loading state - instance.isLoading.set(true); - instance.hasLoadingError.set(false); - - // Define a handler for success on image load - const loadSuccess = image => { - staticImageCanvasElement.width = 193; - staticImageCanvasElement.height = 123; - - // Render the image to the static image canvas - renderAsync(staticImageCanvasElement, image).then(() => { - instance.isLoading.set(false); - }); - }; - - // Define a handler for error on image load - const loadError = () => { - instance.isLoading.set(false); - instance.hasLoadingError.set(true); - }; - - // Call cornerstone image loader with the defined handlers - cornerstone.loadAndCacheImage(instance.imageId).then(loadSuccess, loadError); - }; - - // Run this computation every time the current study is changed - instance.autorun(() => { - // Check if there is a reactive var set for current study - if (instance.data.currentStudy) { - // Register a dependency from this computation on current study - instance.data.currentStudy.dep.depend(); - } - - // Depend on external data and re-run this computation when it changes - Template.currentData(); - - // Get the image ID. If it is the same as the currently rendered imageId, - // refresh the image. - const imageId = instance.getThumbnailImageId(); - if (imageId !== instance.imageId) { - instance.imageId = imageId; - - instance.refreshImage(); - } - }); -}); - -Template.imageThumbnail.helpers({ - // Executed every time the thumbnail image loading progress is changed - percentComplete() { - const instance = Template.instance(); - - // Get the encoded image ID for thumbnail - const encodedImageId = OHIF.string.encodeId(instance.imageId); - - // Register a dependency from this computation on Session key - const percentComplete = Session.get('CornerstoneThumbnailLoadProgress' + encodedImageId); - - // Return the complete percent amount of the image loading - if (percentComplete && percentComplete !== 100) { - return percentComplete + '%'; - } - }, - - // Return how much the stack has already loaded - stackPercentComplete() { - const stack = Template.instance().data.thumbnail.stack; - const progress = Session.get(`StackProgress:${stack.displaySetInstanceUid}`); - return progress && progress.percentComplete; - }, - - showStackLoadingProgressBar() { - return OHIF.uiSettings.showStackLoadingProgressBar; - }, - - isLoading() { - return Template.instance().isLoading.get(); - }, - - hasLoadingError() { - return Template.instance().hasLoadingError.get(); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.styl b/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.styl deleted file mode 100644 index 91c67ec86..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/imageThumbnail/imageThumbnail.styl +++ /dev/null @@ -1,67 +0,0 @@ -@import "{ohif:design}/app" - -.thumbnailEntry.active .imageThumbnail - theme('border-color', '$activeColor') - box-shadow: none - transition($sidebarTransition) - -.imageThumbnail - theme('box-shadow', 'inset 0 0 0 1px $uiBorderColorDark') - theme('background-color', '$primaryBackgroundColor') - border: 5px solid transparent - border-radius: 12px - height: 135px - margin: 0 auto - padding 1px 7px - position: relative - transition($sidebarTransition) - width: 217px - -moz-background-clip: padding - -webkit-background-clip: padding - background-clip: padding-box - -.imageThumbnailClone - margin: 0 !important - - &:hover - theme('border-color', '$hoverColor') - box-shadow: none - -.imageThumbnailCanvas - height: 100% - overflow: hidden - - img - -webkit-user-drag: none - -.thumbnailLoadingIndicator - display: none - pointer-events: none - theme('color', '$textSecondaryColor') - height: 20px - width: 100% - top: 0 - left: 0 - right: 0 - bottom: 0 - margin: auto - position: absolute - - &.d-block - display: block; - - p - text-align: center - font-size: 10pt - -.imageThumbnailProgressBar - position: relative - width: 100% - height: 3px - top: -5px - - .imageThumbnailProgressBarInner - height: 100% - width: 0 - border-radius: 5px - theme('background-color', '$activeColor') diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.html b/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.html deleted file mode 100644 index 16b7dab1f..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.js b/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.js deleted file mode 100644 index a45226d3e..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.js +++ /dev/null @@ -1,11 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -Template.studyBrowser.helpers({ - studies() { - // @TypeSafeStudies - return OHIF.viewer.Studies.findAllBy({ - selected: true - }); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.styl b/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.styl deleted file mode 100644 index 856a833f3..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/studyBrowser/studyBrowser.styl +++ /dev/null @@ -1,19 +0,0 @@ -.studyBrowser - float: left - height: 100% - width: 100% - overflow: hidden - background-color: black - padding-bottom: 20px - - .scrollableStudyThumbnails - height: 100% - overflow-y: auto - overflow-x: hidden - padding-bottom: 50px - padding-right: 16px - padding-left: 4px - margin-right: -16px - - &::-webkit-scrollbar - display: none \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.html b/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.html deleted file mode 100644 index 5b61401bc..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.html +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.js b/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.js deleted file mode 100644 index c1b65193c..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.js +++ /dev/null @@ -1,105 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { Session } from 'meteor/session'; - -import { OHIF } from 'meteor/ohif:core'; -import { thumbnailDragHandlers } from '../../../lib/thumbnailDragHandlers'; - -Template.thumbnailEntry.onCreated(() => { - const instance = Template.instance(); - - // Check if the thumbnails will be draggable or clickable - const isIndexUndefined = _.isUndefined(instance.data.viewportIndex); - instance.isDragAndDrop = isIndexUndefined && OHIF.uiSettings.leftSidebarDragAndDrop !== false; -}); - -Template.thumbnailEntry.events({ - // Event handlers for drag and drop - 'mousedown .thumbnailEntry'(event, instance) { - const data = instance.data.thumbnail.stack; - if (!instance.isDragAndDrop || event.button !== 0) return; - thumbnailDragHandlers.thumbnailDragStartHandler(event, data); - }, - - 'touchstart .thumbnailEntry'(event, instance) { - const data = instance.data.thumbnail.stack; - if (!instance.isDragAndDrop) return; - thumbnailDragHandlers.thumbnailDragStartHandler(event, data); - }, - - 'touchmove .thumbnailEntry'(event, instance) { - if (!instance.isDragAndDrop) return; - thumbnailDragHandlers.thumbnailDragHandler(event); - }, - - 'touchend .thumbnailEntry'(event, instance) { - const data = instance.data.thumbnail.stack; - if (!instance.isDragAndDrop) return; - thumbnailDragHandlers.thumbnailDragEndHandler(event, data); - }, - - // Event handlers for click (quick switch) - 'click .thumbnailEntry'(event, instance) { - if (instance.isDragAndDrop) return; - - // Get the thumbnail stack data - const data = instance.data.thumbnail.stack; - - // Get the viewport index - let { viewportIndex } = instance.data; - if (_.isUndefined(viewportIndex)) { - viewportIndex = Session.get('activeViewport') || 0; - } - - // Rerender the viewport using the clicked thumbnail data - OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, data); - }, - - // Event handlers for double click - 'dblclick .thumbnailEntry'(event, instance) { - if (!instance.isDragAndDrop) return; - - // Get the active viewport index and total number of viewports... - const viewportCount = OHIF.viewerbase.layoutManager.getNumberOfViewports(); - let viewportIndex = Session.get('activeViewport') || 0; - if (viewportIndex >= viewportCount) { - viewportIndex = viewportCount > 0 ? viewportCount - 1 : 0; - } - - // Get the thumbnail stack data - const data = instance.data.thumbnail.stack; - - // Rerender the viewport using the clicked thumbnail data - OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, data); - } -}); - -Template.thumbnailEntry.helpers({ - draggableClass() { - return Template.instance().isDragAndDrop ? 'draggable' : ''; - }, - - instanceNumber() { - const thumbnail = Template.instance().data.thumbnail; - if (!thumbnail) { - return; - } - - const stack = thumbnail.stack; - if (!stack) { - return; - } - - // No need to show instance number for single-frame images - if (!stack.isMultiFrame) { - return; - } - - const firstImage = stack.images[0]; - if (!firstImage) { - return; - } - - return firstImage.instanceNumber; - } -}); diff --git a/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.styl b/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.styl deleted file mode 100644 index 2f796a166..000000000 --- a/Packages/ohif-viewerbase/client/components/studyBrowser/thumbnailEntry/thumbnailEntry.styl +++ /dev/null @@ -1,95 +0,0 @@ -@import "{ohif:design}/app" - -$seriesCountBackgroundColor = #678696 - -.thumbnailEntry - cursor: pointer - display: table - margin: 0 auto - - &.draggable - cursor: copy - cursor: -webkit-grab - cursor: -moz-grab - - .seriesDetails - theme('color', '$textPrimaryColor') - font-size: 14px - line-height: 1.3em - margin-top: 5px - max-width: 217px - min-height: 36px - position: relative - word-wrap: break-word - - &.info-only - - .seriesDescription - display: none - - .seriesInformation - display: flex - flex-grow: 1 - float: none - max-width: none - padding-right: 0 - - .item - flex: 1 - text-align: center - - .icon, .value - display: inline - float: none - line-height: 25px - - .value - margin-left: 0 - width: auto - - .seriesInformation - padding-right: 4px - max-width: 50px - - .item-frames .icon - height: 18px - - .value - theme('color', '$textSecondaryColor') - display: inline-block - float: right - font-size: 12px - margin-left: 4px - overflow: hidden - text-overflow: ellipsis - white-space: nowrap - width: calc(100% - 15px) - - .icon - theme('color', '$activeColor') - display: inline-block - float: left - font-size: 10px - font-weight: 900 - text-align: right - width: 11px - - div - background-color: $seriesCountBackgroundColor - margin-top: 6px - position: relative - - &:after - theme('background-color', '$activeColor') - box-shadow: 1px 1px rgba(0, 0, 0, .115) - left: -5px - position: absolute - top: -5px - - & - &:after - theme('border', '1px solid $primaryBackgroundColor') - content: '' - display: inline-block - height: 11px - width: 11px diff --git a/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.html b/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.html deleted file mode 100644 index abfa54231..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.html +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.js b/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.js deleted file mode 100644 index e5e3e5a77..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.js +++ /dev/null @@ -1,11 +0,0 @@ -Template.annotationDialogs.onRendered(() => { - const instance = Template.instance(); - const dialogIds = ['annotationDialog', 'relabelAnnotationDialog']; - - dialogIds.forEach(id => { - const dialog = instance.$('#' + id); - dialog.draggable(); - dialogPolyfill.registerDialog(dialog.get(0)); - }); -}); - diff --git a/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.styl b/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.styl deleted file mode 100644 index 72c99abd3..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/annotationDialogs/annotationDialogs.styl +++ /dev/null @@ -1,30 +0,0 @@ -@import "{ohif:design}/app" - -.annotationDialog - theme('border', '1px solid $uiBorderColor', 0.95) - theme('background', '$uiGrayDarkest', 0.95) - theme('color', '$textSecondaryColor') - z-index: 1000 - position: absolute - top: 0 - bottom: 0 - left: 0 - right: 0 - margin: auto - overflow: hidden - padding: 10px - width: 300px - height: 140px - border-radius: 8px - - h5, label - font-weight: 400 - - .annotationTextInputOptions - padding: 10px 0 - - .annotationTextInput - margin-left: 5px - - .annotationDialogConfirm - float: right diff --git a/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.html b/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.html deleted file mode 100644 index d808fb045..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.html +++ /dev/null @@ -1,50 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.js b/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.js deleted file mode 100644 index 719da8371..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.js +++ /dev/null @@ -1,310 +0,0 @@ -import { Template } from 'meteor/templating'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { Session } from 'meteor/session'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { viewportUtils } from '../../../lib/viewportUtils'; -import { switchToImageRelative } from '../../../lib/switchToImageRelative'; -import { switchToImageByIndex } from '../../../lib/switchToImageByIndex'; - -Template.cineDialog.onCreated(() => { - const instance = Template.instance(); - - // Create the data schema for CINE controls - instance.schema = new SimpleSchema({ - intervalId: { - type: Number, - optional: true - }, - loop: { - type: Boolean, - label: 'Loop', - defaultValue: true - }, - framesPerSecond: { - type: Number, - label: '', - defaultValue: 24, - min: 1, - max: 90, - optional: true - } - }); - - // Update the current viewport frame rate - instance.updateFramerate = rate => { - OHIF.viewer.cine.framesPerSecond = rate; - - // Update playClip toolData for this imageId - const element = viewportUtils.getActiveViewportElement(); - if (!element) { - return; - } - - let playClipData = cornerstoneTools.getToolState(element, 'playClip'); - if (!playClipData || !playClipData.data || !playClipData.data.length) { - return; - } - - // A valid playClip data object is available. - playClipData = playClipData.data[0]; - - // If the movie is playing, stop/start to update the framerate - if (playClipData.intervalId !== void 0) { - cornerstoneTools.stopClip(element); - cornerstoneTools.playClip(element, OHIF.viewer.cine.framesPerSecond); - } else { - playClipData.framesPerSecond = OHIF.viewer.cine.framesPerSecond; - } - - Session.set('UpdateCINE', Math.random()); - }; - - // Define the actions API - instance.api = { - displaySetPrevious: () => OHIF.viewerbase.layoutManager.moveDisplaySets(false), - displaySetNext: () => OHIF.viewerbase.layoutManager.moveDisplaySets(true), - cineToggle: () => viewportUtils.toggleCinePlay(), - cineFirst: () => switchToImageByIndex(0), - cineLast: () => switchToImageByIndex(-1), - cinePrevious: () => switchToImageRelative(-1), - cineNext: () => switchToImageRelative(1), - cineSlowDown: () => { - const newValue = OHIF.viewer.cine.framesPerSecond - 1; - if (newValue > 0) { - instance.updateFramerate(newValue); - } - }, - cineSpeedUp: () => { - const newValue = OHIF.viewer.cine.framesPerSecond + 1; - if (newValue <= 90) { - instance.updateFramerate(newValue); - } - } - }; - - // Run this computation every time the active viewport is changed - instance.autorun(() => { - Session.get('activeViewport'); - - Tracker.afterFlush(() => { - // Get the active viewportElement - const element = viewportUtils.getActiveViewportElement(); - if (!element) { - return; - } - - // check if playClip tool has been initialized... - const playClipData = cornerstoneTools.getToolState(element, 'playClip'); - if (!playClipData) { - return; - } - - // Get the cornerstone playClip tool data - const toolData = playClipData.data[0]; - - // Get the cine object - const cine = OHIF.viewer.cine; - - // replace the cine values with the tool data - _.extend(cine, toolData); - - // Set the defaults - cine.framesPerSecond = cine.framesPerSecond || 24; - cine.loop = _.isUndefined(cine.loop) ? true : cine.loop; - - // Set the updated data on the form inputs - const elementComponent = instance.$('form:first').data('component'); - if (elementComponent) { - elementComponent.value(cine); - } - - // Update the session to refresh the framerate text - Session.set('UpdateCINE', Math.random()); - }); - }); - - /** - * Set/Reset Window resize handler. This function is a replacement for - * ... jQuery's on('resize', func) version which, for some unkown reason - * ... is currently not working for this portion of code. - * ... Further investigation is necessary. - * - * This happens because when an event is attached using jQuery's - * you can't get it using vanilla JavaScript, it returns null. - * You need to use jQuery for that. So, either you use vanilla JS or jQuery - * to get an element's event handler. See viewerMain for more details. - */ - - instance.setResizeHandler = handler => { - if (typeof handler === 'function') { - const origHandler = window.onresize; - instance.origWindowResizeHandler = typeof origHandler === 'function' ? origHandler : null; - window.onresize = event => { - if (typeof origHandler === 'function') { - origHandler.call(window, event); - } - - handler.call(window, event); - }; - } else { - window.onresize = instance.origWindowResizeHandler || null; - window.origWindowResizeHandler = null; - } - }; - - /** - * Set optimal position for Cine dialog. - */ - - instance.setOptimalPosition = (event, options) => { - const $viewer = $('#viewer'); - const $toolbarElement = $('.toolbarSection .toolbarSectionTools:first'); - const $cineDialog = $('#cineDialog'); - $cineDialog.width($('#cineDialogForm').outerWidth()); - - if ($toolbarElement.length < 1 || $cineDialog.length < 1) { - return; - } - - if ($cineDialog.data('wasDragged') || $cineDialog.data('wasBounded')) { - // restore original handler... - instance.setResizeHandler(null); - return; - } - - const cineDialogSize = { - width: $cineDialog.outerWidth() || 0, - height: $cineDialog.outerHeight() || 0 - }; - - const topLeftCoords = { - top: 0, - left: 0 - }; - - const toolbarRect = { - offset: $toolbarElement.offset() || topLeftCoords, - width: $toolbarElement.outerWidth() || 0, - height: $toolbarElement.outerHeight() || 0 - }; - - const cineDialogCoords = { - left: toolbarRect.offset.left + toolbarRect.width + 20, - top: toolbarRect.offset.top + toolbarRect.height - cineDialogSize.height - }; - - if (options) { - if (options.left) { - cineDialogCoords.left = options.left; - } - - if (options.top) { - cineDialogCoords.top = options.top; - } - } - - // Check if it is out of screen - if (cineDialogCoords.top < 0) { - cineDialogCoords.top = 0; - } else if (cineDialogCoords.top + cineDialogSize.height > $viewer.height()) { - cineDialogCoords.top -= (cineDialogCoords.top + cineDialogSize.height) - $viewer.height(); - } - - if (cineDialogCoords.left < 0) { - cineDialogCoords.left = 0; - } else if (cineDialogCoords.left + cineDialogSize.width > $viewer.width()) { - cineDialogCoords.left -= (cineDialogCoords.left + cineDialogSize.width) - $viewer.width(); - } - - $cineDialog.css(cineDialogCoords); - }; -}); - -Template.cineDialog.onRendered(() => { - const instance = Template.instance(); - const $dialog = instance.$('#cineDialog'); - const singleRowLayout = OHIF.uiSettings.displayEchoUltrasoundWorkflow; - - // set dialog in optimal position and make sure it continues in a optimal position... - // ... when the window has been resized - instance.setOptimalPosition(null, { top: singleRowLayout ? 47 : 26 }); - - // The jQuery method does not seem to be working... - // ... $(window).resize(instance.setOptimalPosition) - // This requires additional investigation. - instance.setResizeHandler(instance.setOptimalPosition); - - // Make the CINE dialog bounded and draggable - $dialog.draggable({ defaultElementCursor: 'move' }).bounded(); - - // Polyfill for older browsers - window.dialogPolyfill.registerDialog($dialog.get(0)); - - // Prevent dialog from being dragged when user clicks any button - const $controls = $dialog.find('.cine-navigation, .cine-controls, .cine-options'); - $controls.on('mousedown touchstart', event => event.stopPropagation()); -}); - -Template.cineDialog.onDestroyed(() => { - const instance = Template.instance(); - // remove resize handler... - instance.setResizeHandler(null); -}); - -Template.cineDialog.events({ - 'change [data-key=loop] input'(event, instance) { - const element = viewportUtils.getActiveViewportElement(); - OHIF.viewer.cine.loop = $(event.currentTarget).is(':checked'); - // Update playClip tool data if available. - let playClipData = cornerstoneTools.getToolState(element, 'playClip'); - if (playClipData && playClipData.data && playClipData.data.length > 0) { - playClipData.data[0].loop = OHIF.viewer.cine.loop; - } - }, - - 'input [data-key=framesPerSecond] input, change [data-key=framesPerSecond] input'(event, instance) { - // Update the FPS text onscreen - const rate = parseFloat($(event.currentTarget).val()); - instance.updateFramerate(rate); - }, - - 'click .button-close'(event, instance) { - OHIF.commands.run('toggleCineDialog'); - } -}); - -Template.cineDialog.helpers({ - isPlaying() { - return viewportUtils.isPlaying(); - }, - - framerate() { - Session.get('UpdateCINE'); - return OHIF.viewer.cine.framesPerSecond.toFixed(1); - }, - - displaySetDisabled(isNext) { - Session.get('LayoutManagerUpdated'); - - // @TODO: Investigate why this is running while OHIF.viewerbase.layoutManager is undefined - if (!OHIF.viewerbase.layoutManager) { - return; - } - - return !OHIF.viewerbase.layoutManager.canMoveDisplaySets(isNext) ? 'disabled' : ''; - }, - - buttonDisabled() { - return viewportUtils.hasMultipleFrames(); - }, - - getClassNames(baseClass) { - const style = OHIF.uiSettings.displayEchoUltrasoundWorkflow ? 'single' : 'double'; - return `${baseClass} ${style}-row-style`; - } - -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.styl b/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.styl deleted file mode 100644 index b4294fd3e..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/cineDialog/cineDialog.styl +++ /dev/null @@ -1,162 +0,0 @@ -@require '{ohif:design}/app' - -#cineDialog - theme('background', '$uiGrayDarkest', 0.85) - theme('color', '$textSecondaryColor') - filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.85)) - border: none - border-radius: 8px - cursor: move - padding: 0 - position: absolute - z-index: 1000 - - .button-close-container - theme('background', '$uiGrayDarkest') - border-radius(16px) - cursor: pointer - height: 32px - position: absolute - right: -8px - top: -10px - width: 32px - - .button-close - left: 50% - position: absolute - top: 50% - transform(translateX(-50%) translateY(-50%)) - - h5 - font-size: 20px - line-height: 35px - margin: 0 - - h5, label - font-weight: 400 - - .btn - theme('color', '$textSecondaryColor') - background-color: transparent - - &:hover - theme('color', '$hoverColor') - - &:active, &.active - theme('color', '$activeColor') - - &[disabled] - &:hover - color: inherit - &:active - theme('color', '$textSecondaryColor') - - .cine-navigation, .cine-controls, .cine-options - cursor: default - - .fps-section - input[type="range"] - background-color: transparent - border: 0 none - outline: 0 none - - &::-ms-tooltip - display: none - - .double-row-style - box-sizing: border-box - width: 290px - height: 80px - padding: 10px - top: 2% - left: 35% - - .cine-navigation - position: absolute - right: 16px - top: 10px - - .btn - padding: 0 4px - - i - font-size: 32px - line-height: 32px - - .cine-controls - left: 0px - - .cine-options - padding: 0px 0 - - .fps-section - width: 175px - float: left - - #fps - float: right - margin: 5px 20px 0 0 - - - .single-row-style - box-sizing: content-box - width: 425px - height: 45px - padding: 4px 8px - top: 2% - left: 35% - - .cine-navigation - float: right - overflow: hidden - padding-right: 12px - position: relative - - .btn - padding: 0 2px - margin: 0 0 0 2px - border: 0 none - &:first-of-type - margin-left: 0 - - i - font-size: 32px - line-height: 45px - - .cine-controls - position: relative - float: left - overflow: hidden - .btn - font-size: 22px - line-height: 45px - min-width: 28px - padding: 0 0px - margin: 0 4px - border: 0 none - - .cine-options - display: block - position: relative - width: 150px - float: left - overflow: hidden - padding: 0 - margin: 0 0 0 10px - - .fps-section - display: block - float: left - width: 80px - input[type="range"] - line-height: 45px - height: 45px - - #fps - display: block - width: 68px - float: left - padding: 0 - margin: 0 0 0 2px - text-align: center - line-height: 45px diff --git a/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.html b/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.html deleted file mode 100644 index 23fb5ba9e..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.html +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.js b/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.js deleted file mode 100644 index 291ae5006..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.js +++ /dev/null @@ -1,37 +0,0 @@ -import { Template } from 'meteor/templating'; - -import { dialogUtils } from '../../../lib/dialogUtils'; - -// Global object of key names (TODO: put this somewhere else) -const keys = { - ESC: 27, - ENTER: 13 -}; - -Template.confirmDeleteDialog.events({ - 'click #cancel, click #close'() { - // Action canceled, just close dialog without calling callback - dialogUtils.closeHandler(false); - }, - 'click #confirm'() { - // Action confirmed, close dialog and calls callback, if exists - dialogUtils.closeHandler(); - }, - 'keydown #confirmDeleteDialog'(e) { - // Action canceled, just close dialog without calling callback - if (e.which === keys.ESC) { - dialogUtils.closeHandler(false); - return false; - } - - if (this.keyPressAllowed === false) { - return; - } - - // If Enter is pressed - if (e.which === keys.ENTER) { - // Action confirmed, close dialog and calls callback, if exists - dialogUtils.closeHandler(); - } - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.styl b/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.styl deleted file mode 100644 index 96fc8581b..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.styl +++ /dev/null @@ -1,25 +0,0 @@ -#confirmDeleteDialog - position: absolute - top: 0 - bottom: 0 - left: 0 - right: 0 - z-index: 100 - width: 300px - min-height: 145px - max-height: 300px - height: fit-content - margin: auto - border-radius: 5px - padding: 10px 20px 10px 20px - background-color: rgba(255,255,255,1) - outline: none - - .btn - text-decoration: none - - #cancel - float: left - - #confirm - float: right diff --git a/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.html b/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.html deleted file mode 100644 index eee1238b5..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.html +++ /dev/null @@ -1,66 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.js b/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.js deleted file mode 100644 index cf3bcd056..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.js +++ /dev/null @@ -1,233 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Tracker } from 'meteor/tracker'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { SimpleSchema } from 'meteor/aldeed:simple-schema'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; - -OHIF.viewerbase.getImageDownloadDialogAnnotationTools = () => { - return ['length', 'probe', 'simpleAngle', 'arrowAnnotate', 'ellipticalRoi', 'rectangleRoi']; -}; - -/** - * Converts a base64 data to a blob. This is needed to enabled JPEG images downloading on IE11. - * Source: https://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript/16245768 - */ -const b64toBlob = (b64Data, contentType='', sliceSize=512) => { - const byteCharacters = atob(b64Data); - const byteArrays = []; - - for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) { - const slice = byteCharacters.slice(offset, offset + sliceSize); - - const byteNumbers = new Array(slice.length); - for (let i = 0; i < slice.length; i++) { - byteNumbers[i] = slice.charCodeAt(i); - } - - const byteArray = new Uint8Array(byteNumbers); - - byteArrays.push(byteArray); - } - - const blob = new Blob(byteArrays, { type: contentType }); - return blob; -}; - -Template.imageDownloadDialog.onCreated(() => { - const instance = Template.instance(); - - instance.schema = new SimpleSchema({ - width: { type: Number }, - height: { type: Number }, - name: { - type: String, - defaultValue: 'image' - }, - type: { - type: String, - allowedValues: ['jpeg', 'png'], - valuesLabels: ['JPEG', 'PNG'], - defaultValue: 'jpeg' - }, - showAnnotations: { - type: Boolean, - label: 'Show Annotations', - defaultValue: true - } - }); - - instance.changeObserver = new Tracker.Dependency(); - - instance.keepAspect = new ReactiveVar(true); - instance.showAnnotations = new ReactiveVar(false); - - instance.lastImage = {}; - - instance.getConfirmCallback = () => () => { - return instance.downloadImage(); - }; -}); - -Template.imageDownloadDialog.onRendered(() => { - const instance = Template.instance(); - const { viewportUtils } = OHIF.viewerbase; - - instance.$viewportElement = instance.$('.viewport-element'); - instance.viewportElement = instance.$viewportElement[0]; - instance.$viewportPreview = instance.$('.viewport-preview'); - instance.viewportPreview = instance.$viewportPreview[0]; - - cornerstone.enable(instance.viewportElement); - instance.downloadCanvas = $(instance.viewportElement).find('canvas')[0]; - - instance.form = instance.$('form').data('component'); - - instance.setElementSize = (element, canvas, size, value) => { - $(element)[size](value); - canvas[size] = value; - canvas.style[size] = `${value}px`; - - instance.form.item(size).$element.val(value); - }; - - instance.toggleAnnotations = toggle => { - const action = toggle ? 'enable' : 'disable'; - const annotationTools = OHIF.viewerbase.getImageDownloadDialogAnnotationTools(); - annotationTools.forEach(tool => cornerstoneTools[tool][action](instance.viewportElement)); - }; - - instance.updateViewportPreview = () => { - instance.$viewportElement.one('cornerstoneimagerendered', event => { - // Wait for the tools to handle CornerstoneImageRendered event - Tracker.afterFlush(() => { - const enabledElement = cornerstone.getEnabledElement(event.currentTarget); - const formData = instance.form.value(); - const image = instance.viewportPreview; - const type = 'image/' + formData.type; - const dataUrl = instance.downloadCanvas.toDataURL(type, 1); - image.src = dataUrl; - - const $element = $(enabledElement.element); - let width = $element.width(); - let height = $element.height(); - if (width > 512 || height > 512) { - const multiplier = 512 / Math.max(width, height); - height *= multiplier; - width *= multiplier; - } - - image.width = width; - image.height = height; - }); - }); - }; - - instance.downloadImage = () => { - const formData = instance.form.value(); - const filename = `${formData.name}.${formData.type}`; - const mimetype = `image/${formData.type}`; - - // Handles JPEG images for IE11 - if (instance.downloadCanvas.msToBlob && formData.type === 'jpeg') { - const image = instance.downloadCanvas.toDataURL(mimetype, 1); - const blob = b64toBlob(image.replace('data:image/jpeg;base64,', ''), mimetype); - return window.navigator.msSaveBlob(blob, filename); - } - - return cornerstoneTools.saveAs(instance.viewportElement, filename, mimetype); - }; - - instance.autorun(() => { - instance.changeObserver.depend(); - Session.get('UpdateDownloadViewport'); - const activeViewport = viewportUtils.getActiveViewportElement(); - - if (activeViewport) { - const enabledElement = cornerstone.getEnabledElement(activeViewport); - - const viewport = Object.assign({}, enabledElement.viewport); - delete viewport.scale; - viewport.translation = { - x: 0, - y: 0 - }; - - cornerstone.loadImage(enabledElement.image.imageId).then(image => { - instance.lastImage = image; - const { viewportElement, downloadCanvas } = instance; - const formData = instance.form.value(); - - cornerstone.displayImage(viewportElement, image); - cornerstone.setViewport(viewportElement, viewport); - cornerstone.resize(viewportElement, true); - - instance.toggleAnnotations(formData.showAnnotations); - - const width = Math.min(formData.width || image.width, 16384); - const height = Math.min(formData.height || image.height, 16384); - instance.setElementSize(viewportElement, downloadCanvas, 'width', width); - instance.setElementSize(viewportElement, downloadCanvas, 'height', height); - - cornerstone.fitToWindow(viewportElement); - instance.updateViewportPreview(); - }); - } - }); -}); - -Template.imageDownloadDialog.onDestroyed(() => { - const instance = Template.instance(); - - cornerstone.disable(instance.viewportElement); -}); - -Template.imageDownloadDialog.events({ - 'click .js-keep-aspect'(event, instance) { - const currentState = instance.keepAspect.get(); - instance.keepAspect.set(!currentState); - instance.$('[data-key=width]').trigger('input'); - }, - - 'change [data-key=showAnnotations], change [data-key=type]'(event, instance) { - instance.changeObserver.changed(); - }, - - 'input [data-key=width]'(event, instance) { - const { viewportElement, downloadCanvas } = instance; - const formData = instance.form.value(); - const { width, height } = instance.lastImage; - const newWidth = formData.width; - instance.setElementSize(viewportElement, downloadCanvas, 'width', newWidth); - if (instance.keepAspect.get()) { - const multiplier = newWidth / width; - const newHeight = Math.round(height * multiplier); - instance.setElementSize(viewportElement, downloadCanvas, 'height', newHeight); - } - - instance.changeObserver.changed(); - }, - - 'input [data-key=height]'(event, instance) { - const { viewportElement, downloadCanvas } = instance; - const formData = instance.form.value(); - const { width, height } = instance.lastImage; - const newHeight = formData.height; - instance.setElementSize(viewportElement, downloadCanvas, 'height', newHeight); - if (instance.keepAspect.get()) { - const multiplier = newHeight / height; - const newWidth = Math.round(width * multiplier); - instance.setElementSize(viewportElement, downloadCanvas, 'width', newWidth); - } - - instance.changeObserver.changed(); - } -}); - -Template.imageDownloadDialog.helpers({ - keepAspect() { - return Template.instance().keepAspect.get(); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.styl b/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.styl deleted file mode 100644 index d2d48760f..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/downloadDialog/downloadDialog.styl +++ /dev/null @@ -1,17 +0,0 @@ -@require '{ohif:design}/app' - -#imageDownloadDialog - - .image-preview - display: table - margin: 0 auto - - h3 - white-space: nowrap - - .viewport-preview - max-width: 512px - max-height: 512px - - .wrapperLabel - display: block diff --git a/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.html b/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.html deleted file mode 100644 index 9c5dbb36c..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.html +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.js b/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.js deleted file mode 100644 index b937980b8..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.js +++ /dev/null @@ -1,78 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; - -const TOP_CLASS = 'top'; -const BOTTOM_CLASS = 'bottom'; -const MIDDLE_CLASS = 'middle'; - -Template.gridLayout.helpers({ - // Get the height percentage for each viewport - height() { - const instance = Template.instance(); - const rows = instance.data.rows || 1; - return 100 / rows; - }, - - // Get the width percentage for each viewport - width() { - const instance = Template.instance(); - const columns = instance.data.columns || 1; - return 100 / columns; - }, - - // Get class for each viewport, so each app - // using ohif-viewerbase can style on their own - getClass(index) { - const { rows, columns } = this; - - if (rows === 1) { - return `${TOP_CLASS} ${BOTTOM_CLASS}`; - } - - const actualRow = Math.floor(index / columns); - - if ( actualRow === 0 ) { - return TOP_CLASS; - } - if ( actualRow + 1 === rows ) { - return BOTTOM_CLASS; - } - - return MIDDLE_CLASS; - }, - - activeClass(index) { - if (Session.get('activeViewport') === index) { - return 'active'; - }; - }, - - // Return the viewports list - viewports() { - const instance = Template.instance(); - const rows = instance.data.rows; - const columns = instance.data.columns; - const numViewports = rows * columns; - const viewportData = instance.data.viewportData; - const numViewportsWithData = viewportData.length; - - // Check if the viewportData length is different from the given - if (numViewportsWithData < numViewports) { - // Add the missing viewports - var difference = numViewports - numViewportsWithData; - for (var i = 0; i < difference; i++) { - viewportData.push({ - viewportIndex: numViewportsWithData + i + 1, - rows, - columns - }); - } - } else if (numViewportsWithData > numViewports) { - // Remove the additional viewports - return viewportData.slice(0, numViewports); - } - - // Return the viewports - return viewportData; - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.styl b/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.styl deleted file mode 100644 index affbac38a..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/gridLayout/gridLayout.styl +++ /dev/null @@ -1,9 +0,0 @@ -@import "{ohif:design}/app" - -#imageViewerViewports - height: 100% - padding-bottom: 1px - width: 100% - -.mainContent - theme('background-color', '$primaryBackgroundColor') diff --git a/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.html b/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.html deleted file mode 100644 index 0264889e4..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.js b/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.js deleted file mode 100644 index 14eb94f2f..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.js +++ /dev/null @@ -1,79 +0,0 @@ -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { setActiveViewport } from '../../../lib/setActiveViewport'; -import { switchToImageByIndex } from '../../../lib/switchToImageByIndex'; - -const slideTimeoutTime = 40; -let slideTimeout; - -Template.imageControls.onRendered(() => { - const instance = Template.instance(); - - // Set the current imageSlider width to its parent's height - // (because webkit is stupid and can't style vertical sliders) - const $slider = instance.$('.imageSlider'); - const $viewport = $slider.closest('.imageViewerViewportOverlay').siblings('.imageViewerViewport'); - - instance.handleResize = _.throttle(() => { - const viewportHeight = $viewport.height(); - $slider.width(viewportHeight - 20); - }, 150); - - instance.handleResize(); - - $(window).on('resize', instance.handleResize); -}); - -Template.imageControls.onDestroyed(() => { - const instance = Template.instance(); - if (instance.handleResize) { - $(window).off('resize', instance.handleResize); - } -}); - -Template.imageControls.events({ - 'rescale .scrollbar'(event, instance) { - instance.handleResize(); - }, - - 'keydown input[type=range]'(event) { - // We don't allow direct keyboard up/down input on the - // image sliders since the natural direction is reversed (0 is at the top) - - // Store the KeyCodes in an object for readability - const keys = { - DOWN: 40, - UP: 38 - }; - - if (event.which === keys.DOWN) { - OHIF.commands.run('scrollDown'); - event.preventDefault(); - } else if (event.which === keys.UP) { - OHIF.commands.run('scrollUp'); - event.preventDefault(); - } - }, - - 'input input[type=range], change input[type=range]'(event) { - // Note that we throttle requests to prevent the - // user's ultrafast scrolling from firing requests too quickly. - clearTimeout(slideTimeout); - slideTimeout = setTimeout(() => { - // Using the slider in an inactive viewport - // should cause that viewport to become active - const $slider = $(event.currentTarget); - const viewportContainer = $slider.parents('.viewportContainer'); - setActiveViewport(viewportContainer); - - // Subtract 1 here since the slider goes from 1 to N images - // But the stack indexing starts at 0 - const newImageIdIndex = parseInt($slider.val(), 10) - 1; - switchToImageByIndex(newImageIdIndex); - }, slideTimeoutTime); - - return false; - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.styl b/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.styl deleted file mode 100644 index 8eb4a372b..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/imageControls/imageControls.styl +++ /dev/null @@ -1,123 +0,0 @@ -@import "{ohif:design}/app" - -$imageSliderBorderRadius = 57px -$imageSliderTrackColor = rgba(0,0,0,0) -$imageSliderBorder = none - -// Note that these are backwards due to the magic needed to make a cross-browser vertical slider -$imageSliderWidth = 12px -$imageSliderHeight = 39px - -.imageControls - height: 100% - padding: 5px - position: absolute - right: 0 - top: 0 - - .scrollbar - height: calc(100% - 20px) - margin-top: 5px - position: relative - width: 12px - - .imageSlider - height: $imageSliderWidth - left: 12px - padding: 0 - position: absolute - top: 0 - - vendorize(transform, rotate(90deg)) - vendorize(transform-origin, top left) - - -webkit-appearance: none - background-color: $imageSliderTrackColor - - // Remove focus highlights on range input - &:focus - outline: none - vendorize(box-shadow, none) - - // Remove focus border in Firefox - &::-moz-focus-outer - border: none - - // --- Style the range track --- // - &::-webkit-slider-runnable-track - background-color: $imageSliderTrackColor - border: none - cursor: pointer - height: 5px - z-index: 6 - - &::-moz-range-track - background-color: $imageSliderTrackColor - border: none - cursor: pointer - height: 2px - z-index: 6 - - &::-ms-track - animate: 0.2s - background: transparent - border: none - border-width: 15px 0 - color: $imageSliderTrackColor - cursor: pointer - height: $imageSliderWidth - width: 100% - - // Hide any fill IE tries to add - &::-ms-fill-lower - background: $imageSliderTrackColor - - &::-ms-fill-upper - background: $imageSliderTrackColor - - // --- Style the range thumb --- // - &::-webkit-slider-thumb - -webkit-appearance: none !important - theme('background-color', '$imageSliderColor') - border: $imageSliderBorder - border-radius: $imageSliderBorderRadius - cursor: -webkit-grab - height: $imageSliderWidth - margin-top: -4px - width: $imageSliderHeight - - &:active - theme('background-color', '$activeColor') - cursor: -webkit-grabbing - - &::-moz-range-thumb - theme('background-color', '$imageSliderColor') - border: $imageSliderBorder - border-radius: $imageSliderBorderRadius - cursor: -moz-grab - height: $imageSliderWidth - width: $imageSliderHeight - z-index: 7 - - &:active - theme('background-color', '$activeColor') - cursor: -moz-grabbing - - &::-ms-thumb - theme('background-color', '$imageSliderColor') - border: $imageSliderBorder - border-radius: $imageSliderBorderRadius - cursor: ns-resize - height: $imageSliderWidth - width: $imageSliderHeight - - &:active - theme('background-color', '$activeColor') - - &::-ms-tooltip - display: none - -// Set left position in IE, border-width attribute breaks left position of imageSlider -@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) - .imageSlider - left: 50px diff --git a/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.html b/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.html deleted file mode 100644 index be3b47692..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.js b/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.js deleted file mode 100644 index ab8fac6bb..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.js +++ /dev/null @@ -1,702 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Tracker } from 'meteor/tracker'; -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -// OHIF Modules -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -// Local Modules -import { StackManager } from '../../../lib/StackManager'; -import { setActiveViewport } from '../../../lib/setActiveViewport'; -import { imageViewerViewportData } from '../../../lib/imageViewerViewportData'; -import { updateCrosshairsSynchronizer } from '../../../lib/updateCrosshairsSynchronizer'; -import { toolManager } from '../../../lib/toolManager'; -import { updateOrientationMarkers } from '../../../lib/updateOrientationMarkers'; -import { getInstanceClassDefaultViewport } from '../../../lib/instanceClassSpecificViewport'; -import { OHIFError } from '../../../lib/classes/OHIFError'; - -const allCornerstoneEvents = ['click', 'cornerstonetoolsmousedown', 'cornerstonetoolsmousedownactivate', - 'cornerstonetoolsmouseclick', 'cornerstonetoolsmousedrag', 'cornerstonetoolsmouseup', - 'cornerstonetoolsmousewheel', 'cornerstonetoolsdoubletap', 'cornerstonetoolstouchpress', - 'cornerstonetoolsmultitouchstart', 'cornerstonetoolsmultitouchstartactive', 'cornerstonetoolsmultitouchdrag']; - -const PLUGIN_CORNERSTONE = 'cornerstone'; - -// Create a way to add hooks to be executed every time a cornerstone element is enabled -OHIF.viewer.cornerstoneElementHooks = []; - -/** - * This function loads a study series into a viewport element. - * - * @param data {object} Object containing the study, series, and viewport element to be used - */ -const loadDisplaySetIntoViewport = (data, templateData) => { - const wlPresets = OHIF.viewerbase.wlPresets; - - OHIF.log.info('imageViewerViewport loadDisplaySetIntoViewport'); - - // Make sure we have all the data required to render the series - if (!data.study || !data.displaySet || !data.element) { - OHIF.log.warn('loadDisplaySetIntoViewport: No Study, Display Set, or Element provided'); - return; - } - - // Get the current element and it's index in the list of all viewports - // The viewport index is often used to store information about a viewport element - const element = data.element; - const viewportIndex = templateData.viewportIndex; - - const layoutManager = OHIF.viewerbase.layoutManager; - layoutManager.viewportData = layoutManager.viewportData || {}; - layoutManager.viewportData[viewportIndex] = layoutManager.viewportData[viewportIndex] || {}; - layoutManager.viewportData[viewportIndex].viewportIndex = viewportIndex; - - // Stop here if no data was defined for the viewer - if (!OHIF.viewer.data) return; - - // This data will be saved so that the viewport can be reloaded to the same state later - OHIF.viewer.data.loadedSeriesData[viewportIndex] = {}; - - // Create shortcut to displaySet - const displaySet = data.displaySet; - - // Get stack from Stack Manager - let stack = StackManager.findOrCreateStack(data.study, displaySet); - - // If is a clip, updates the global FPS for cine dialog - if (stack.isClip && stack.frameRate > 0) { - // Sets the global variable - OHIF.viewer.cine.framesPerSecond = parseFloat(stack.frameRate); - // Update the cine dialog FPS - Session.set('UpdateCINE', Math.random()); - } - - // Shortcut for array with image IDs - const imageIds = stack.imageIds; - - // Define the current image stack using the newly created image IDs - stack = { - currentImageIdIndex: data.currentImageIdIndex > 0 && data.currentImageIdIndex < imageIds.length ? data.currentImageIdIndex : 0, - imageIds: imageIds, - displaySetInstanceUid: data.displaySetInstanceUid - }; - - // Get the current image ID for the stack that will be rendered - const imageId = imageIds[stack.currentImageIdIndex]; - - // Save the current image ID inside the template data so it can be - // retrieved from the template helpers - templateData.imageId = imageId; - - // Save the current image ID inside the ViewportLoading object. - // - // The ViewportLoading object relates the viewport elements with whichever - // image is currently being loaded into them. This is useful so that we can - // place progress (download %) for each image inside the proper viewports. - window.ViewportLoading[viewportIndex] = imageId; - - // Enable Cornerstone for the viewport element - const options = { - renderer: OHIF.cornerstone.renderer - }; - cornerstone.enable(element, options); - - // Call every defined hook - OHIF.viewer.cornerstoneElementHooks.forEach(hook => { - if (typeof hook === 'function') { - hook(element); - } - }); - - // Get the handler functions that will run when loading has finished or thrown - // an error. These are used to show/hide loading / error text boxes on each viewport. - const endLoadingHandler = cornerstoneTools.loadHandlerManager.getEndLoadHandler(); - const errorLoadingHandler = cornerstoneTools.loadHandlerManager.getErrorLoadingHandler(); - - // Get the current viewport settings - const viewport = cornerstone.getViewport(element); - - const { studyInstanceUid, seriesInstanceUid, displaySetInstanceUid, currentImageIdIndex } = data; - - // Store the current series data inside the Layout Manager - layoutManager.viewportData[viewportIndex] = { - imageId, - studyInstanceUid, - seriesInstanceUid, - displaySetInstanceUid, - currentImageIdIndex, - viewport: viewport || data.viewport, - viewportIndex, - plugin: PLUGIN_CORNERSTONE - }; - - // Handle the case where the imageId isn't loaded correctly and the - // imagePromise returns undefined - // To test, uncomment the next line - // data.imageId = 'AfileThatDoesntWork'; // For testing only! - - let imagePromise; - try { - imagePromise = cornerstone.loadAndCacheImage(imageId); - } catch (error) { - OHIF.log.info(error); - if (!imagePromise) { - errorLoadingHandler(element, imageId, error); - return; - } - } - - // Additional tasks for metadata provider. If using your own - // metadata provider, this may not be necessary. - // updateMetadata is important, though, to update image metadata that - // for any reason was missing some information such as rows, columns, - // sliceThickness, etc (See MetadataProvider class from ohif-cornerstone package) - const metadataProvider = OHIF.viewer.metadataProvider; - const isUpdateMetadataDefined = metadataProvider && typeof metadataProvider.updateMetadata === 'function'; - - // loadAndCacheImage configurable callbacks - const callbacks = imageViewerViewportData.callbacks; - - // Check if it has before loadAndCacheImage callback - if (typeof callbacks.before === 'function') { - OHIF.log.info('imageViewerViewport before loadAndCacheImage callback'); - callbacks.before(imagePromise, templateData); - } - - // Start loading the image. - imagePromise.then(image => { - let enabledElement; - try { - enabledElement = cornerstone.getEnabledElement(element); - } - catch (error) { - OHIF.log.warn('Viewport destroyed before loaded image could be displayed'); - return; - } - - // Caches element's jQuery object - const $element = $(element); - - // Update the enabled element with the image and viewport data - // This is not usually necessary, but we need them stored in case - // a sopClassUid-specific viewport setting is present. - enabledElement.image = image; - enabledElement.viewport = cornerstone.getDefaultViewport(enabledElement.canvas, image); - - if (isUpdateMetadataDefined) { - // Update the metaData for missing fields - metadataProvider.updateMetadata(image); - } - - // Check if there are default viewport settings for this sopClassUid - if (!displaySet.images || !displaySet.images.length) { - return; - } - - const instance = displaySet.images[0]; - const instanceClassViewport = getInstanceClassDefaultViewport(instance, enabledElement, image.imageId); - - // If there are sopClassUid-specific viewport settings, apply them - if (instanceClassViewport) { - cornerstone.displayImage(element, image, instanceClassViewport); - - // Mark that this element should not be fit to the window in the resize listeners - // TODO: Find another way to do this? - enabledElement.fitToWindow = false; - - // Resize the canvas to fit the current viewport element size. - cornerstone.resize(element, false); - } else if (data.viewport) { - // If there is a saved object containing Cornerstone viewport data - // (e.g. scale, invert, window settings) in the input data, apply it now. - cornerstone.displayImage(element, image, data.viewport); - - // Resize the canvas to fit the current viewport element size. Fit the displayed - // image to the canvas dimensions. - cornerstone.resize(element, true); - } else { - // If no saved viewport settings or modality-specific settings exists, - // display the loaded image in the viewport element with no loaded viewport - // settings. - cornerstone.displayImage(element, image); - - // Resize the canvas to fit the current viewport element size. Fit the displayed - // image to the canvas dimensions. - cornerstone.resize(element, true); - } - - // Set/store W/L preset data to Default on first display - wlPresets.updateElementWLPresetData(element); - - // Remove the data for this viewport from the ViewportLoading object - // This will stop the loading percentage complete from being displayed. - delete window.ViewportLoading[viewportIndex]; - - // Call the handler function that represents the end of the image loading phase - // (e.g. hide the progress text box) - endLoadingHandler(element, image); - - // Remove the 'empty' class from the viewport to hide any instruction text - element.classList.remove('empty'); - - // Hide the viewport instructions (i.e. 'Drag a stack here') and show - // the viewport overlay data. - $element.siblings('.viewportInstructions').hide(); - $element.siblings('.imageViewerViewportOverlay').show(); - - // Add stack state managers for the stack tool, CINE tool, and reference lines - cornerstoneTools.addStackStateManager(element, ['stack', 'playClip', 'referenceLines']); - - // Enable orientation markers, if applicable - updateOrientationMarkers(element); - - // Clear any old stack data - cornerstoneTools.clearToolState(element, 'stack'); - cornerstoneTools.addToolState(element, 'stack', stack); - - // Set the default CINE settings - const multiframeMetadata = instance.getDataProperty('multiframeMetadata'); - - let fps; - if (multiframeMetadata && multiframeMetadata.averageFrameRate > 0) { - fps = multiframeMetadata.averageFrameRate; - } else { - fps = OHIF.viewer.cine.framesPerSecond; - } - - const cineToolData = { - loop: OHIF.viewer.cine.loop, - framesPerSecond: fps - }; - - cornerstoneTools.addToolState(element, 'playClip', cineToolData); - - // Autoplay datasets that have framerates set - if (multiframeMetadata && multiframeMetadata.isMultiframeImage && multiframeMetadata.averageFrameRate > 0) { - cornerstoneTools.playClip(element); - } - - // Enable mouse, mouseWheel, touch, and keyboard input on the element - cornerstoneTools.mouseInput.enable(element); - cornerstoneTools.touchInput.enable(element); - cornerstoneTools.mouseWheelInput.enable(element); - cornerstoneTools.keyboardInput.enable(element); - - // Use the tool manager to enable the currently active tool for this - // newly rendered element - const activeTool = toolManager.getActiveTool(); - toolManager.setActiveTool(activeTool, [element]); - - // Define a function to run whenever the Cornerstone viewport is rendered - // (e.g. following a change of window or zoom) - const onImageRendered = (event) => { - const eventData = event.detail; - const { viewport, element } = eventData; - - // Attention: Adding OHIF.log.info in this function may decrease the performance - // since this callback function is called multiple times (eg: when a tool is - // enabled/disabled -> cornerstone[toolName].tool.enable) - - if (!layoutManager.viewportData[viewportIndex]) { - OHIF.log.warn(`onImageRendered: LayoutManager has no viewport data for this viewport index?: ${viewportIndex}`); - } - - // Use Session to trigger reactive updates in the viewportOverlay helper functions - // This lets the viewport overlay always display correct window / zoom values - Session.set('CornerstoneImageRendered' + viewportIndex, Math.random()); - - // Save the current viewport into the OHIF.viewer.data global variable - layoutManager.viewportData[viewportIndex].viewport = viewport; - OHIF.viewer.data.loadedSeriesData[viewportIndex].viewport = viewport; - - // Update the W/L Preset data, if necessary - wlPresets.updateElementWLPresetData(element); - - // Check if it has onImageRendered loadAndCacheImage callback - if (typeof callbacks.onImageRendered === 'function') { - callbacks.onImageRendered(event, eventData, viewportIndex, templateData); - } - }; - - // Attach the onImageRendered callback to the CornerstoneImageRendered event - element.removeEventListener('cornerstoneimagerendered', onImageRendered); - element.addEventListener('cornerstoneimagerendered', onImageRendered); - - // Set a random value for the Session variable in order to trigger an overlay update - Session.set('CornerstoneImageRendered' + viewportIndex, Math.random()); - - // Define a function to run whenever the Cornerstone viewport changes images - // (e.g. during scrolling) - const onNewImage = (event) => { - const eventData = event.detail; - - // Attention: Adding OHIF.log.info in this function may decrease the performance - // since this callback function is called multiple times (eg: when a tool is - // enabled/disabled -> cornerstone[toolName].tool.enable) - - if (isUpdateMetadataDefined) { - // Update the metaData for missing fields - metadataProvider.updateMetadata(eventData.enabledElement.image); - } - - // Update the templateData with the new imageId - // This allows the template helpers to update reactively - templateData.imageId = eventData.enabledElement.image.imageId; - Session.set('CornerstoneNewImage' + viewportIndex, Math.random()); - layoutManager.viewportData[viewportIndex].imageId = eventData.enabledElement.image.imageId; - - // Get the element and stack data - const element = event.target; - const toolData = cornerstoneTools.getToolState(element, 'stack'); - if (!toolData || !toolData.data || !toolData.data.length) { - return; - } - - // Update orientation markers in case new slices don't have the same orientation - // as the first slice - updateOrientationMarkers(element); - - // If this viewport is displaying a stack of images, save the current image - // index in the stack to the global OHIF.viewer.data object. - const stack = cornerstoneTools.getToolState(element, 'stack'); - if (stack && stack.data.length && stack.data[0].imageIds.length > 1) { - const imageIdIndex = stack.data[0].imageIds.indexOf(templateData.imageId); - layoutManager.viewportData[viewportIndex].currentImageIdIndex = imageIdIndex; - OHIF.viewer.data.loadedSeriesData[viewportIndex].currentImageIdIndex = imageIdIndex; - } - - const wlPresetData = cornerstone.getElementData(element, 'wlPreset'); - const wlPresetDataName = wlPresetData && wlPresetData.name; - wlPresets.applyWLPreset(wlPresetDataName, element); - - // Check if it has onNewImage loadAndCacheImage callback - if (typeof callbacks.onNewImage === 'function') { - callbacks.onNewImage(event, eventData, viewportIndex, templateData); - } - }; - - // Attach the onNewImage callback to the CornerstoneNewImage event - element.removeEventListener('cornerstonenewimage', onNewImage); - element.addEventListener('cornerstonenewimage', onNewImage); - - // Set a random value for the Session variable in order to trigger an overlay update - Session.set('CornerstoneNewImage' + viewportIndex, Math.random()); - - const onStackScroll = () => { - // Attention: Adding OHIF.log.info in this function may decrease the performance - // since this callback function is called multiple times (eg: when a tool is - // enabled/disabled -> cornerstone[toolName].tool.enable) - - // Update the imageSlider value - Session.set('CornerstoneNewImage' + viewportIndex, Math.random()); - }; - - element.removeEventListener('cornerstonestackscroll', onStackScroll); - if (stack.imageIds.length > 1) { - element.addEventListener('cornerstonestackscroll', onStackScroll); - } - - // Define a function to trigger an event whenever a new viewport is being used - // This is used to update the value of the "active viewport", when the user interacts - // with a new viewport element - const sendActivationTrigger = (event) => { - const eventData = event && event.detail; - // Attention: Adding OHIF.log.info in this function decrease the performance - // since this callback function is called multiple times (eg: when a tool is - // enabled/disabled -> cornerstone[toolName].tool.enable) - - // Reset the focus, even if we don't need to re-enable reference lines or prefetching - const element = (eventData && eventData.element) || (event && event.currentTarget); - if (!element) return; - const $element = $(element); - - // Stop here if we don't have eventData set - if (!eventData) return; - - // Check if the current active viewport in the Meteor Session - // Is the same as the viewport in which the activation event was fired. - // If it was, no changes are necessary, so stop here. - const activeViewportIndex = Session.get('activeViewport'); - if (viewportIndex === activeViewportIndex) return; - - $element.focus(); - - OHIF.log.info('imageViewerViewport sendActivationTrigger'); - - // Otherwise, trigger an 'OHIFActivateViewport' event to be handled by the Template event - // handler - eventData.viewportIndex = viewportIndex; - const customEvent = $.Event('OHIFActivateViewport', eventData); - - // Need to overwrite the type set in the original event - customEvent.type = 'OHIFActivateViewport'; - $element.trigger(customEvent, eventData); - }; - - // Handle mouseenter event to send viewport activation trigger only if there is no focused dropdown - const onMouseEnter = () => { - if ($(':focus').closest('.dropdown').length) return; - - sendActivationTrigger(); - }; - - // Attach the sendActivationTrigger function to all of the Cornerstone interaction events - allCornerstoneEvents.forEach(eventType => { - element.removeEventListener(eventType, sendActivationTrigger); - element.addEventListener(eventType, sendActivationTrigger); - }); - $element.off('mouseenter', onMouseEnter); - $element.on('mouseenter', onMouseEnter); - - OHIF.viewer.data.loadedSeriesData = layoutManager.viewportData; - - // Check if image plane (orientation / location) data is present for the current image - const imagePlane = cornerstone.metaData.get('imagePlane', image.imageId); - if (imagePlane && imagePlane.frameOfReferenceUID) { - // If it is, add this element to the global synchronizer... - OHIF.viewer.updateImageSynchronizer.add(element); - - if (OHIF.viewer.refLinesEnabled) { - // ... and if reference lines are globally enabled, let cornerstoneTools know. - cornerstoneTools.referenceLines.tool.enable(element, OHIF.viewer.updateImageSynchronizer); - } - - // If the crosshairs tool is active, update the synchronizer - // that is used for its synchronized viewport updating. - // This is necessary if this new image shares a frame of reference - // with currently displayed images - if (activeTool === 'crosshairs') { - updateCrosshairsSynchronizer(imagePlane.frameOfReferenceUID); - } - } - - // Set the active viewport based on the Session variable - // This is done to ensure that the active element has the current - // focus, so that keyboard events are triggered. - if (viewportIndex === Session.get('activeViewport')) { - const viewportContainer = $element.parents('.viewportContainer'); - - setActiveViewport(viewportContainer); - } - - // Run any renderedCallback that exists in the data context - if (data.renderedCallback && typeof data.renderedCallback === 'function') { - data.renderedCallback(element); - } - - // Check if it has after loadAndCacheImage callback - if (typeof callbacks.after === 'function') { - OHIF.log.info('imageViewerViewport after callback'); - callbacks.after(image, templateData, element); - } - }, error => { - // If something goes wrong while loading the image, fire the error handler. - errorLoadingHandler(element, imageId, error); - }); -}; - -/** - * This function sets the display set for the study and calls LoadDisplaySetIntoViewport function - * - * @param data includes study data - * @param displaySetInstanceUid Display set information which is loaded in Template - * @param templateData currentData of Template - * - */ -const setDisplaySet = (data, displaySetInstanceUid, templateData) => { - const study = data.study; - - if (!study) { - throw new OHIFError('Study does not exist'); - } - - let displaySets = study.displaySets; - if (!displaySets.length) { - displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(study); - study.displaySets = displaySets; - study.setDisplaySets(displaySets); - - study.forEachDisplaySet(displaySet => { - OHIF.viewerbase.stackManager.makeAndAddStack(study, displaySet); - }); - } - - if (!displaySets) { - throw new OHIFError('Study has no display sets'); - } - - displaySets.every(displaySet => { - if (displaySet.displaySetInstanceUid === displaySetInstanceUid) { - data.displaySet = displaySet; - return false; - } - - return true; - }); - - // If we didn't find anything, stop here - if (!data.displaySet) { - data.displaySet = displaySets[0]; - // throw new OHIFError('Display set not found in specified study!'); - } - - // Otherwise, load pass the data object into loadSeriesIntoViewport - loadDisplaySetIntoViewport(data, templateData); -}; - -Meteor.startup(() => { - window.ViewportLoading = window.ViewportLoading || {}; - toolManager.configureLoadProcess(); -}); - -Template.imageViewerViewport.onRendered(function() { - const templateData = Template.currentData(); - OHIF.log.info('imageViewerViewport onRendered'); - - // When the imageViewerViewport template is rendered - const element = this.find('.imageViewerViewport'); - this.element = element; - this.$element = $(element); - - // Display the loading indicator for this element - this.$element.siblings('.imageViewerLoadingIndicator').css('display', 'block'); - - // Get the current active viewport index, if this viewport has the same index, - // add the CSS 'active' class to highlight this viewport. - const activeViewport = Session.get('activeViewport'); - - // Focus the viewport if it's the active one - if (templateData.viewportIndex === activeViewport) { - this.$element.focus(); - } - - let { currentImageIdIndex } = templateData; - const { viewport, studyInstanceUid, seriesInstanceUid, renderedCallback, displaySetInstanceUid } = templateData; - - if (!currentImageIdIndex) { - currentImageIdIndex = 0; - } - - // Calls extendData function to provide flexibility between systems - imageViewerViewportData.extendData(templateData); - - // Create a data object to pass to the series loading function (loadSeriesIntoViewport) - const data = { - element, - viewport, - currentImageIdIndex, - displaySetInstanceUid, - studyInstanceUid, - seriesInstanceUid, - renderedCallback, - activeViewport - }; - - // If no displaySetInstanceUid was supplied, display the drag/drop - // instructions and then stop here since we don't know what to display in the viewport. - if (!displaySetInstanceUid) { - element.classList.add('empty'); - this.$element.siblings('.imageViewerLoadingIndicator').css('display', 'none'); - this.$element.siblings('.viewportInstructions').show(); - return; - } - - // @TypeSafeStudies - const study = OHIF.viewer.Studies.findBy({ studyInstanceUid }); - - data.study = study; - setDisplaySet(data, displaySetInstanceUid, templateData); - - // Double click event handlers to handle viewport enlargement - function doubleClickHandler (event) { - const $element = $(this); - const { layoutManager } = OHIF.viewerbase; - const $viewports = $('.imageViewerViewport'); - - $element.trigger('ohif.viewer.viewport.toggleEnlargement'); - - // Get the double clicked viewport index - const viewportIndex = $viewports.index(event.currentTarget); - - // Stop here if there's only one viewport - if (!layoutManager.isZoomed && $viewports.length <= 1) return; - - // Enlarge the double clicked viewport - layoutManager.toggleEnlargement(viewportIndex); - - // Wait for DOM re-rendering and update the active viewport - Tracker.afterFlush(() => { - let viewportIndexToZoom; - // Check if the viewer is zoomed - if (layoutManager.isZoomed) { - // Set the active viewport as the only one visible - viewportIndexToZoom = 0; - } else { - // Set the active viewport as the previous zoomed viewport - viewportIndexToZoom = layoutManager.zoomedViewportIndex || 0; - } - // Set zoomed viewport as active... - const viewportContainer = $('.viewportContainer').get(viewportIndexToZoom); - setActiveViewport(viewportContainer); - }); - } - - const doubleClickEvents = ['cornerstonetoolsmousedoubleclick', 'cornerstonetoolsdoubletap']; - doubleClickEvents.forEach(eventType => { - element.removeEventListener(eventType, doubleClickHandler); - element.addEventListener(eventType, doubleClickHandler); - }); -}); - -Template.imageViewerViewport.onDestroyed(function() { - OHIF.log.info('imageViewerViewport onDestroyed'); - - // When a viewport element is being destroyed - const element = this.find('.imageViewerViewport'); - const $element = $(element); - if (!element || $element.hasClass('empty') || !$element.find('canvas').length) { - return; - } - - // Disable mouse functions - cornerstoneTools.mouseInput.disable(element); - cornerstoneTools.touchInput.disable(element); - cornerstoneTools.mouseWheelInput.disable(element); - - OHIF.viewer.updateImageSynchronizer.remove(element); - - // Clear the stack prefetch data - let stackPrefetchData = cornerstoneTools.getToolState(element, 'stackPrefetch'); - stackPrefetchData = []; - cornerstoneTools.stackPrefetch.disable(element); - - // Try to stop any currently playing clips - // Otherwise the interval will continuously throw errors - try { - const enabledElement = cornerstone.getEnabledElement(element); - if (enabledElement) { - cornerstoneTools.stopClip(element); - } - } catch (error) { - OHIF.log.warn(error); - } - - // Trigger custom Destroy Viewport event - // for compatibility with other systems - $element.trigger('OHIFDestroyedViewport'); - - // Disable the viewport element with Cornerstone - // This also triggers the removal of the element from all available - // synchronizers, such as the one used for reference lines. - cornerstone.disable(element); -}); - -Template.imageViewerViewport.events({ - 'OHIFActivateViewport .imageViewerViewport'(event) { - OHIF.log.info('imageViewerViewport OHIFActivateViewport'); - - const viewportContainer = $(event.currentTarget).parents('.viewportContainer').get(0); - setActiveViewport(viewportContainer); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.styl b/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.styl deleted file mode 100644 index 389e0c189..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/imageViewerViewport/imageViewerViewport.styl +++ /dev/null @@ -1,37 +0,0 @@ -@import "{ohif:design}/app" - -.imageViewerViewport - width: 100% - height: 100% - background-color: black - - // Prevent the blue outline in Chrome when a viewport is selected - outline: 0 !important - - // Prevents the entire page from getting larger - // when the magnify tool is near the sides/corners of the page - overflow: hidden - -.viewportInstructions - display: none - font-size: 13px - theme('color', '$textSecondaryColor') - line-height: 18px - pointer-events: none // Necessary for drag/drop through to cornerstone element below - text-align: center - position: absolute - top: 0 - bottom: 0 - right: 0 - left: 0 - margin: auto - height: 20px - -/* These are some good CSS settings for a circular magnifying glass - Try removing the border-radius to make a square magnifying glass */ -.magnifyTool - border: 4px white solid - box-shadow: 2px 2px 10px #1e1e1e - border-radius: 50% - display: none - cursor: none \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/viewer/layoutButton/layoutButton.html b/Packages/ohif-viewerbase/client/components/viewer/layoutButton/layoutButton.html deleted file mode 100644 index 92b6ca57f..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/layoutButton/layoutButton.html +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/layoutButton/layoutButton.js b/Packages/ohif-viewerbase/client/components/viewer/layoutButton/layoutButton.js deleted file mode 100644 index 65c726be6..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/layoutButton/layoutButton.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; -import { viewportUtils } from '../../../lib/viewportUtils'; - -Template.layoutButton.events({ - // TODO: Check why 'click' event won't fire? - 'mousedown .js-dropdown-toggle'(event) { - // Select the button and it's target dropdown menu - const $button = $(event.currentTarget); - const $dropdown = $($button.data('target')); - - // Adjust the dropdown's CSS to properly place it on the page - $dropdown.css({ - top: $button.offset().top + $button.outerHeight() + 'px', - left: $button.offset().left + 'px' - }); - - // Open or close the layout chooser dialog - viewportUtils.toggleDialog($dropdown); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.html b/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.html deleted file mode 100644 index 962639bb4..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.html +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.js b/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.js deleted file mode 100644 index 892cf296c..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.js +++ /dev/null @@ -1,93 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; -import { viewportUtils } from '../../../lib/viewportUtils'; - -Template.layoutChooser.onRendered(() => { - const instance = Template.instance(); - - /** - * Adds the 'hover' class to cells above and to the left of the current cell - * This is used to "fill in" the grid that the user will change the layout to, - * if they click on a specific table cell. - * - * @param currentCell - */ - instance.highlightCells = currentCell => { - const cells = this.$('.layoutChooser table td'); - cells.removeClass('hover'); - - currentCell = this.$(currentCell); - const table = currentCell.parents('.layoutChooser table').get(0); - const rowIndex = currentCell.closest('tr').index(); - const columnIndex = currentCell.index(); - - // Loop through the table row by row - // and cell by cell to apply the highlighting - for (let i = table.rows.length - 1; i >= 0; i--) { - const row = table.rows[i]; - if (i <= rowIndex) { - for (let j = row.cells.length - 1; j >= 0; j--) { - if (j <= columnIndex) { - const cell = row.cells[j]; - cell.classList.add('hover'); - } - } - } - } - }; - - // Refresh layout chooser highlighting based on current viewports state - instance.refreshHighlights = () => { - // Stop here if layoutManager is not defined yet - if (!OHIF.viewerbase.layoutManager) { - return; - } - - // Get the layout rows and columns amount - const info = OHIF.viewerbase.layoutManager.layoutProps; - - // get the limiter cell - const cell = instance.$('tr').eq(info.rows - 1).children().eq(info.columns - 1); - - // Highlight all cells before the limiter - instance.highlightCells(cell); - }; - - instance.autorun(() => { - // Run this computation every time the viewer layout is changed - Session.get('LayoutManagerUpdated'); - - instance.refreshHighlights(); - }); -}); - -Template.layoutChooser.events({ - 'touchstart .layoutChooser table td, mouseenter .layoutChooser table td'(event, instance) { - instance.highlightCells(event.currentTarget); - }, - - 'mouseleave .layoutChooser'(event, instance) { - instance.refreshHighlights(); - }, - - 'click .layoutChooser table td'(event, instance) { - const $currentCell = instance.$(event.currentTarget); - const rowIndex = $currentCell.closest('tr').index(); - const columnIndex = $currentCell.index(); - - // Add 1 because the indices start from zero - const layoutProps = { - rows: rowIndex + 1, - columns: columnIndex + 1 - }; - - OHIF.viewerbase.layoutManager.layoutTemplateName = 'gridLayout'; - OHIF.viewerbase.layoutManager.layoutProps = layoutProps; - OHIF.viewerbase.layoutManager.updateViewports(); - - const $dropdown = instance.$('.layoutChooser'); - viewportUtils.toggleDialog($dropdown); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.styl b/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.styl deleted file mode 100644 index 2901114b4..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/layoutChooser/layoutChooser.styl +++ /dev/null @@ -1,28 +0,0 @@ -@import "{ohif:design}/app" - -$borderColor = rgba(77, 99, 110, 0.81) - -.layoutChooser - theme('background', '$uiGrayDarkest', 0.95) - border: 1px solid $borderColor; - border-radius: 8px - height: 92px - min-height: 92px - min-width: 92px // to override bootstrap's dropdown-menu class - padding: 5px 0; - position: absolute; - width: 92px - z-index: 5000 - - table - margin: 0 auto - - td - theme('border', '1px solid $uiBorderColorDark') - cursor: pointer - height: 20px - transition(background-color 0.1s ease) - width: 20px - - &:hover, &.hover // Add the hover class here to be triggered by mouseenter/mouseleave - theme('background-color', '$activeColor') diff --git a/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.html b/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.html deleted file mode 100644 index bf01c5656..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.html +++ /dev/null @@ -1,14 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.js b/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.js deleted file mode 100644 index d20aefcf8..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.js +++ /dev/null @@ -1,79 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -Meteor.startup(() => { - // This checking is necessary because cornerstoneTools may not have some tools available. - // Example: when an app defines its own cornerstone's lib versions, so it - // uses only ohif-viewerbase and not ohif-cornerstone and those libs are added later. - if (cornerstoneTools.loadHandlerManager) { - cornerstoneTools.loadHandlerManager.setStartLoadHandler(startLoadingHandler); - cornerstoneTools.loadHandlerManager.setEndLoadHandler(doneLoadingHandler); - cornerstoneTools.loadHandlerManager.setErrorLoadingHandler(errorLoadingHandler); - } -}); - -let loadHandlerTimeout; - -const startLoadingHandler = element => { - clearTimeout(loadHandlerTimeout); - loadHandlerTimeout = setTimeout(() => { - console.log('startLoading'); - const elem = $(element); - elem.siblings('.imageViewerErrorLoadingIndicator').css('display', 'none'); - elem.find('canvas').not('.magnifyTool').addClass('faded'); - elem.siblings('.imageViewerLoadingIndicator').css('display', 'block'); - }, OHIF.viewer.loadIndicatorDelay); -}; - -const doneLoadingHandler = element => { - clearTimeout(loadHandlerTimeout); - const elem = $(element); - elem.siblings('.imageViewerErrorLoadingIndicator').css('display', 'none'); - elem.find('canvas').not('.magnifyTool').removeClass('faded'); - elem.siblings('.imageViewerLoadingIndicator').css('display', 'none'); -}; - -const errorLoadingHandler = (element, imageId, error, source) => { - clearTimeout(loadHandlerTimeout); - const elem = $(element); - - // Could probably chain all of these, but this is more readable - elem.find('canvas').not('.magnifyTool').removeClass('faded'); - elem.siblings('.imageViewerLoadingIndicator').css('display', 'none'); - - // Don't display errors from the stackPrefetch tool - if (source === 'stackPrefetch') { - return; - } - - const errorLoadingIndicator = elem.siblings('.imageViewerErrorLoadingIndicator'); - errorLoadingIndicator.css('display', 'block'); - - // This is just used to expand upon some error messages that are sent - // when things fail. An example is a network error throwing the error - // which is only described as "network". - const errorDetails = { - network: 'A network error has occurred' - // We need to expand this further when we see more obscure error messages - }; - - if (errorDetails.hasOwnProperty(error)) { - error = errorDetails[error]; - } - - errorLoadingIndicator.find('.description').text(`An error has occurred while loading image: ${imageId}`); - if (error) { - errorLoadingIndicator.find('.details').text(`Details: ${error}`); - } -}; - -Template.loadingIndicator.helpers({ - 'percentComplete'() { - const percentComplete = Session.get('CornerstoneLoadProgress' + this.viewportIndex); - if (percentComplete && percentComplete !== 100) { - return `${percentComplete}%`; - } - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.styl b/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.styl deleted file mode 100644 index 190d139c1..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/loadingIndicator/loadingIndicator.styl +++ /dev/null @@ -1,39 +0,0 @@ -@import "{ohif:design}/app" - -.imageViewerLoadingIndicator - theme('color', '$textSecondaryColor') - -.faded - opacity: 0.5 - -.imageViewerErrorLoadingIndicator - theme('color', '$uiYellow') - - p, h4 - padding: 4px 0 - text-align: center - word-wrap: break-word - - p - font-size: 11pt - -.loadingIndicator - background-color: rgba(0,0,0,0.75) - display: none - font-size: 18px - height: 100% - overflow: hidden - pointer-events: none // Necessary for click-through to cornerstone element below - position: absolute - top: 0 - width: 100% - z-index: 1 - - .indicatorContents - font-size: 30px - font-weight: 300 - position: absolute - text-align: center - top: 50% - transform(translateY(-50%)) - width: 100% diff --git a/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.html b/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.html deleted file mode 100644 index 451151d80..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.html +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.js b/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.js deleted file mode 100644 index 994e65486..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.js +++ /dev/null @@ -1,146 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -Template.seriesQuickSwitch.onCreated(() => { - const instance = Template.instance(); - - // Defines the study being shown in the current viewport - instance.currentStudy = new ReactiveVar(); - - // Gets the viewport data for the given viewport index - instance.getViewportData = viewportIndex => { - const layoutManager = OHIF.viewerbase.layoutManager; - return layoutManager && layoutManager.viewportData && layoutManager.viewportData[viewportIndex]; - }; - - // Gets the current viewport data - const viewportIndex = instance.data.viewportIndex; - - instance.study = {}; - instance.lastStudy = {}; - - instance.autorun(() => { - OHIF.viewerbase.layoutManager.observer.depend(); - - const viewportData = instance.getViewportData(viewportIndex); - - // @TypeSafeStudies - if (viewportData) { - // Finds the current study and return it - instance.study = OHIF.viewer.Studies.findBy({ - studyInstanceUid: viewportData.studyInstanceUid - }); - } - - if (!instance.study) { - instance.study = OHIF.viewer.Studies.getElementByIndex(0); - } - - if (!instance.study) { - return; - } - - if (instance.study.studyInstanceUid !== instance.lastStudy.studyInstanceUid) { - // Change the current study to update the thumbnails - instance.currentStudy.set(instance.study); - - instance.lastStudy = instance.study; - } - }); -}); - -Template.seriesQuickSwitch.helpers({ - shallDisplay() { - const instance = Template.instance(); - const { rows, columns } = instance.data; - return OHIF.viewer.displaySeriesQuickSwitch && rows === 1 && columns <= 2; - }, - - side() { - const instance = Template.instance(); - const { columns, viewportIndex } = instance.data; - if (columns === 1) return ''; - return viewportIndex === 0 ? 'left' : 'right'; - }, - - seriesItems() { - const instance = Template.instance(); - - OHIF.viewerbase.layoutManager.observer.depend(); - const { viewportIndex } = instance.data; - const viewportData = OHIF.viewerbase.layoutManager.viewportData[viewportIndex]; - const study = instance.currentStudy.get(); - - const seriesItems = []; - - let displaySets = study.displaySets; - if (!displaySets.length) { - displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(study); - study.displaySets = displaySets; - study.setDisplaySets(displaySets); - - study.forEachDisplaySet(displaySet => { - OHIF.viewerbase.stackManager.makeAndAddStack(study, displaySet); - }); - } - - const items = displaySets.length; - for (let i = 0; i < items; i++) { - const displaySet = displaySets[i]; - const item = { class: '' }; - seriesItems.push(item); - if (i === 8 && items !== 9) { - item.class += ' count'; - item.value = items; - break; - } - - if (displaySet.displaySetInstanceUid === viewportData.displaySetInstanceUid) { - item.class += ' active'; - } - } - - return seriesItems; - }, - - studyBrowserTemplate() { - return OHIF.viewer.quickSwitchStudyBrowserTemplate || 'studyBrowserQuickSwitch'; - } -}); - -Template.seriesQuickSwitch.events({ - 'mouseenter .series-switch, rescale .series-switch'(event, instance) { - // Control the width of the series browser - const $switch = $(event.currentTarget); - const $seriesBrowser = $switch.find('.series-browser'); - const $seriesQuickSwitch = $switch.closest('.series-quick-switch'); - - const isRight = $seriesQuickSwitch.hasClass('right'); - const switchOffsetLeft = $switch.offset().left; - const switchOuterWidth = $switch.outerWidth(); - - let browserWidth; - if (isRight) { - browserWidth = $(window).width() - switchOffsetLeft; - } else { - browserWidth = switchOffsetLeft + switchOuterWidth; - } - - $seriesBrowser.width(browserWidth - (browserWidth % 240)); - - const $quickSwitch = instance.$('.series-quick-switch'); - if ($quickSwitch.is(':hover')) { - $quickSwitch.addClass('series-triggered'); - } - }, - - 'mouseleave .series-browser'(event, instance) { - $(event.currentTarget).children('.scrollable').stop().animate({ scrollTop: 0 }, 300, 'swing'); - }, - - 'mouseleave .series-quick-switch'(event, instance) { - $(event.currentTarget).removeClass('series-triggered'); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.styl b/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.styl deleted file mode 100644 index 35673b965..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.styl +++ /dev/null @@ -1,202 +0,0 @@ -@require '{ohif:design}/app' - -.series-quick-switch - position: absolute - top: calc(100% - 100vh) - - &:before - box-shadow(0 0 0 5000px rgba(0, 0, 0, 0.8)) - transition(opacity 0.3s ease) - opacity: 0 - - &:hover - z-index: 2 - - &:before - opacity: 1 - - &:not(.left):not(.right) - left: 50% - transform(translateX(-50%)) - - &.left - theme('border-right', '1px solid $uiBorderColor') - right: 0 - - &.right - left: 0 - - .series-switch - float: right - - .study-switch - float: left - - .study-browser - left: auto - right: 0 - transform-origin(calc(100% - 1em) calc(1em + 17px)) - - .series-browser - left: 0 - right: auto - transform-origin(1em calc(1em + 15px)) - - .thumbnails-wrapper - transform-origin(0% 0%) - - .thumbnailEntry - float: left - - .series-item - float: left - - .title-label - theme('color', '$textSecondaryColor') - font-size: 12px - font-weight: 500 - line-height: 12px - opacity: 1 - padding-bottom: 3px - text-align: center - transition(opacity 0.3s ease) - - .series-switch, - .study-switch - float: left - position: relative - - .study-switch:hover:after - content: '' - display: block - height: 100px - left: 0 - position: absolute - top: 0 - width: 300px - - .study-browser - left: 0 - margin-top: 100px - max-height: calc(100% - 100px) - transform-origin(1em calc(1em + 17px)) - width: 300px - - .study-browser-list - padding: 0 10px - - .series-browser - max-height: 100% - max-width: 720px - right: 0 - transform-origin(calc(100% - 1em) calc(1em + 15px)) - - .thumbnails-wrapper - transition(transform 0.3s ease) - transform-origin(100% 0%) - - .thumbnailEntry - float: right - - .seriesDetails - opacity: 0 - transform(translateY(-100%)) - transition(transform 0.3s ease\, opacity 0.3s ease) - - .scrollable - padding-top: 15px - transition(padding-bottom 0.3s ease) - - .series-browser, - .study-browser - min-height: 120px - opacity: 0 - position: absolute - top: 0 - transform(scale(0)) - transition(transform 0.3s ease\, opacity 0.3s ease) - z-index: 3 - - .series-box, - .study-box - height: 57px - width: 57px - - .study-box - theme('background-color', '$uiGrayDark') - theme('border', 'solid 2px $uiBorderColorDark') - border-radius(11px) - - .series-item - theme('background-color', '$boxBackgroundColor') - border-radius(3px) - float: right - height: 15px - margin: 2px - transition(opacity 0.3s ease) - width: 15px - - &.count - theme('color', '$textPrimaryColor') - background-color: transparent - font-size: 12px - font-weight: 500 - line-height: 17px - text-align: center - - &.active - theme('background-color', '$activeColor') - - &.series-triggered .series-browser, - .series-switch:hover .series-browser, - .study-switch:hover .study-browser - opacity: 1 - transform(scale(1)) - - &.series-triggered .series-item, - .series-switch:hover .title-label - opacity: 0 - - &.series-triggered - .thumbnails-wrapper - transform(scale(0.9) translateY(80px)) - - .series-browser:not(:hover) - &>.scrollable - padding-bottom: 80px - - &>.scroll-nav - opacity: 0 - - .series-switch:hover .series-browser - .thumbnails-wrapper - transform(scale(1) translateY(0)) - - .thumbnailEntry .seriesDetails - opacity: 1 - transform(translateY(0)) - transition-delay(0.3s) - - .study-browser-item.active .study-item-box - theme('box-shadow', 'inset 0 0 0 3px $activeColor') - -@media screen and (max-width: 1599px) - .series-quick-switch - - .series-box, - .study-box - width: 36px - height: 36px - - .study-box - border-radius(7px) - - .series-item - height: 10px - margin: 1px - width: 10px - - &.count - font-size: 10px - font-weight: 300 - line-height: 10px diff --git a/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.html b/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.html deleted file mode 100644 index 7d6b9f935..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.html +++ /dev/null @@ -1,42 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.js b/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.js deleted file mode 100644 index 78ecdb537..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.js +++ /dev/null @@ -1,120 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; - -import { OHIF } from 'meteor/ohif:core'; - -Template.studySeriesQuickSwitch.onCreated(() => { - const instance = Template.instance(); - - // Defines the study being shown in the current viewport - instance.data.currentStudy = new ReactiveVar(); - - // Gets the viewport data for the given viewport index - instance.getViewportData = viewportIndex => { - const layoutManager = OHIF.viewerbase.layoutManager; - return layoutManager && layoutManager.viewportData && layoutManager.viewportData[viewportIndex]; - }; - - // Gets the current viewport data - const viewportIndex = instance.data.viewportIndex; - - instance.study = {}; - instance.lastStudy = {}; - - instance.autorun(() => { - Session.get('LayoutManagerUpdated'); - - const viewportData = instance.getViewportData(viewportIndex); - - // @TypeSafeStudies - if (viewportData) { - // Finds the current study and return it - instance.study = OHIF.viewer.Studies.findBy({ - studyInstanceUid: viewportData.studyInstanceUid - }); - } else { - instance.study = OHIF.viewer.Studies.getElementByIndex(0); - } - - if (!instance.study) { - return; - } - - if (instance.study.studyInstanceUid !== instance.lastStudy.studyInstanceUid) { - // Change the current study to update the thumbnails - instance.data.currentStudy.set(instance.study); - - instance.lastStudy = instance.study; - } - }); -}); - -const checkScrollArea = element => { - const { scrollHeight, offsetHeight, scrollTop } = element; - - const matrix = $(element).find('.thumbnailsWrapper').css('transform'); - - let translateY = 0; - - if(matrix && matrix !== 'none') { - translateY = parseInt(matrix.match(/-?[\d\.]+/g)[5]); - } - - if(scrollHeight > offsetHeight + scrollTop + translateY) { - element.classList.add('show-scroll-indicator-down'); - } - else { - element.classList.remove('show-scroll-indicator-down'); - } - - if(scrollTop > 0) { - element.classList.add('show-scroll-indicator-up'); - } - else { - element.classList.remove('show-scroll-indicator-up'); - } -}; - -Template.studySeriesQuickSwitch.events({ - 'mouseenter .js-quick-switch, mouseenter .js-quick-switch .switchSectionSeries'(event, instance) { - instance.$('.quickSwitchWrapper').addClass('overlay'); - $(event.currentTarget).addClass('hover'); - instance.$('.scrollArea').each((index, scrollAreaElement) => checkScrollArea(scrollAreaElement)); - }, - 'mouseleave .js-quick-switch'(event, instance) { - instance.$('.js-quick-switch, .switchSectionSeries').removeClass('hover'); - instance.$('.quickSwitchWrapper').removeClass('overlay'); - }, - 'click .thumbnailEntry'(event, instance) { - // Close the quick switch if we have selected a series - instance.$('.js-quick-switch, .switchSectionSeries').removeClass('hover'); - instance.$('.quickSwitchWrapper').removeClass('overlay'); - }, - 'click .study-browser-item'(event, instance) { - instance.$('.switchSectionSeries').addClass('hover'); - }, - 'scroll .scrollArea'(event) { - checkScrollArea(event.currentTarget); - } -}); - -Template.studySeriesQuickSwitch.helpers({ - // Get the current study - currentStudy() { - return Template.instance().data.currentStudy.get(); - }, - // Check if is Mac OS - // This is necessary due to fix scrollbar space only in browsers in Mac OS: - // Since Lion version, the scrollbar is visible only when user scrolls a div - // As scrollbar is hidden, the space added to hide it in Windows browsers - // is not enough in Mac OS. For WebKit (Safari and Chrome in Mac OS) there is a CSS - // solution using ::-webkit-scrollbar, but unfortunately doesn't work for Firefox - // JS seems to be the only solution for now: - // - http://stackoverflow.com/questions/6165472/custom-css-scrollbar-for-firefox/6165489#6165489 - // - http://stackoverflow.com/questions/18317634/force-visible-scrollbar-in-firefox-on-mac-os-x/18318273 - isMac() { - return window.navigator.appVersion.indexOf('Mac'); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.styl b/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.styl deleted file mode 100644 index 8be78d686..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.styl +++ /dev/null @@ -1,279 +0,0 @@ -@require '{ohif:design}/app' - -$switchSize = 55px -$seriesSpacing = 2px - -.quickSwitchWrapper - position: fixed - top: 0 - z-index: 1 - - &.middle - left: 50% - - .quickSwitch - transform(translateX(-50%)) - - &.left - theme('border-right', '1px solid $uiBorderColor') - right: 50% - &.right-sidebar-only - .seriesHover - .scrollArea - padding-left: 200px; - - &.right - left: 50% - &.left-sidebar-only - .seriesHover - .scrollArea - padding-right: 200px; - - &.overlay .quickSwitch - transition(z-index 0s linear 0s) - z-index: 3 - - &:before - theme('background-color', '$primaryBackgroundColor') - bottom: 0 - content: '' - left: 0 - opacity: 0 - position: fixed - right: 0 - top: 0 - transition(opacity 0.3s ease\, visibility 0s linear 0.3s) - visibility: hidden - z-index: 2 - - &.overlay:before - opacity: 0.8 - transition(opacity 0.3s ease\, visibility 0s linear 0s) - visibility: visible - -.quickSwitch - position: relative - transition(z-index 0s linear 0.3s) - z-index: 1 - - .switchSection - display: inline-block - float: left - height: 100% - position: relative - - &.switchSectionSeries.hover, &.switchSectionStudy:hover - .seriesSwitch .seriesItem - opacity: 0 - .switchHover - opacity: 1 - .studyHover - height: auto - padding-top: $switchSize - transition(padding-top 0.3s ease\, visibility 0s linear 0s) - visibility: visible - - &.switchSectionSeries.hover - .seriesHover - .thumbnailsWrapper - transform(scale(0.9) translateY($switchSize)) - transition(all 0.3s ease) - .thumbnailEntry .seriesDetails - opacity: 0 - visibility: hidden - - &:hover .seriesHover - .thumbnailsWrapper - transform(scale(1) translateY(0)) - .thumbnailEntry .seriesDetails - opacity: 1 - transform(translateY(0)) - transition(all 0.3s ease) - transition-delay(0.3s) - visibility: visible - - .seriesHover .thumbnailEntry .seriesDetails - opacity: 0 - transform(translateY(-36px)) - - .seriesSwitch .seriesItem - transition(opacity 0.3s ease) - - .studySwitch, .seriesSwitch - position: relative - - .studySwitch - padding: 2px 1px 0 - - .studyTimepointBrowser - background-color: transparent - - .study-browser-item.active .study-item-box - theme('box-shadow', 'inset 0 0 0 3px $activeColor') - - .studyBox - theme('background-color', '$uiGrayDark') - theme('border', 'solid 2px $uiBorderColorDark') - border-radius: 11px - display: block - height: $switchSize - width: $switchSize - - .seriesSwitch - display: block - height: $switchSize + $seriesSpacing - width: $switchSize + $seriesSpacing - - .seriesItem - theme('background-color', '$boxBackgroundColor') - border-radius: 3px - height: 15px - margin: $seriesSpacing - width: 15px - - &.count - background-color: transparent - theme('color', '$textPrimaryColor') - font-size: 12px - font-weight: 500 - line-height: 17px - text-align: center - - &.active - theme('background-color', '$activeColor') - - .label - theme('color', '$textSecondaryColor') - display: block - font-size: 12px - font-weight: 500 - line-height: 12px - padding: 0 - padding-bottom: 3px - text-align: center - -.switchHover - border: 10px solid transparent - border-radius: 5px - margin: -10px - opacity: 0 - overflow: hidden - position: absolute - top: 0 - z-index: 10000 - - .scrollArea - margin-right: -22px; - max-height: 610px - overflow-x: hidden - overflow-y: scroll - width: calc(100% + 22px) - - &.is-mac - padding-right: 22px - - &.show-scroll-indicator-up:before - &.show-scroll-indicator-down:after - font-family: FontAwesome - display: block - theme('color', '$activeColor') - font-size: 2em - width: 100% - height: 10px - position: absolute - z-index: 1 - text-align: center - left: 0 - - &.show-scroll-indicator-up:before - top: -10px - content: '\f102' - - &.show-scroll-indicator-down:after - bottom: 18px - content: '\f103' - -.studyHover - height: 0 - padding-top: 0 - transition(padding-top 0.3s ease\, visibility 0s linear 0.3s) - visibility: hidden - width: 320px - - .scrollArea - height: 500px - -.seriesHover - transform(scale(0)) - transition(all 0.3s ease) - width: 731px - - .thumbnailEntry - margin: 0 - -.quickSwitchWrapper.left, .quickSwitchWrapper.middle - .seriesHover .thumbnailEntry - float: right - .studyHover - left: 0 - .seriesHover, .thumbnailsWrapper - right: 0 - transform-origin(100% 0%) - -.quickSwitchWrapper.right - .seriesHover .thumbnailEntry - float: left - .studyHover - right: 0 - .seriesHover, .thumbnailsWrapper - left: 0 - transform-origin(0% 0%) - -// Responsive layout -$switchSmallSize = 35px -$seriesSmallSpacing = 1px - -@media screen and (max-width: 1023px) - .switchSectionSeries.hover .seriesHover - transform(scale(0.5)) -@media screen and (min-width: 1024px) and (max-width: 1151px) - .switchSectionSeries.hover .seriesHover - transform(scale(0.61)) -@media screen and (min-width: 1152px) and (max-width: 1279px) - .switchSectionSeries.hover .seriesHover - transform(scale(0.69)) -@media screen and (min-width: 1280px) and (max-width: 1359px) - .switchSectionSeries.hover .seriesHover - transform(scale(0.77)) -@media screen and (min-width: 1360px) and (max-width: 1439px) - .switchSectionSeries.hover .seriesHover - transform(scale(0.82)) -@media screen and (min-width: 1440px) and (max-width: 1599px) - .switchSectionSeries.hover .seriesHover - transform(scale(0.87)) -@media screen and (min-width: 1600px) and (max-width: 1919px) - .switchSectionSeries.hover .seriesHover - transform(scale(0.97)) -@media screen and (min-width: 1920px) - .switchSectionSeries.hover .seriesHover - transform(scale(1)) - -@media screen and (max-width: 1599px) - .quickSwitch - .switchSection - .studySwitch .studyBox - border-radius: 7px - height: $switchSmallSize - width: $switchSmallSize - .seriesSwitch - height: $switchSmallSize + $seriesSmallSpacing - width: $switchSmallSize + $seriesSmallSpacing - .seriesItem - border-radius: 2px - height: 10px - margin: $seriesSmallSpacing - width: 10px - &.count - font-size: 10px - font-weight: 300 - line-height: 10px diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.html b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.html deleted file mode 100644 index cd27b5221..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.html +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.js b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.js deleted file mode 100644 index eab6cf0b5..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.js +++ /dev/null @@ -1,98 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; - -Template.studyTimepoint.onCreated(() => { - const instance = Template.instance(); - const data = instance.data; - - instance.isActive = {}; - if (data.isUnassociatedStudy === true && data.studyInstanceUids.length === 1) { - instance.isActive[data.studyInstanceUids[0]] = true; - } -}); - -// Initialize the timepoint wrapper max-height to enable CSS transition -Template.studyTimepoint.onRendered(() => { - const instance = Template.instance(); - - const $studies = instance.$('.studyTimepoint'); - const $wrapper = $studies.closest('.studyTimepointWrapper'); - const $timepoint = $wrapper.closest('.timepoint-item'); - const studiesVisible = $studies.is(':visible'); - - if (!studiesVisible) { - $timepoint.addClass('active'); - } - - // Recalculates the timepoint height to make CSS transition smoother - $studies.trigger('displayStateChanged'); - - if (!studiesVisible) { - $timepoint.removeClass('active'); - } -}); - -Template.studyTimepoint.events({ - // Changes the selected study - 'selectionChanged .studyTimepoint'(event, instance, changed) { - const $selection = $(changed.selection); - - // Defines where will be the studies searched - let $studiesTarget = instance.$('.studyTimepoint'); - - // @TypeSafeStudies - if (changed.isQuickSwitch) { - // Changes the current quick switch study - const study = OHIF.viewer.Studies.findBy({ - studyInstanceUid: changed.studyInstanceUid - }); - instance.data.currentStudy.set(study); - - // Changes the target to toggle the selection in all the studies - $studiesTarget = $studiesTarget.closest('.studyTimepointBrowser'); - } - - // Removes selected state from all studies but the triggered study - $studiesTarget.find('.study-browser-item').not($selection).removeClass('active'); - - if (changed.isQuickSwitch) { - // Reset active studies map to allow only one active study - instance.isActive = {}; - // Add selected state for the triggered study - $selection.addClass('active'); - } else { - const $timepoint = instance.$('.studyTimepoint'); - // Set the max-height to inherit to be able to expand the wrapper on its full height - instance.$('.studyTimepointWrapper').css('max-height', 'inherit'); - // Toggle selected state for the triggered study - $selection.removeClass('loading'); - $selection.toggleClass('active'); - // Recalculates the timepoint height to make CSS transition smoother - const $thumbnails = $selection.find('.study-browser-series'); - $thumbnails.one('transitionend', () => $timepoint.trigger('displayStateChanged')); - } - - // Set the current study as active - instance.isActive[changed.studyInstanceUid] = $selection.hasClass('active'); - }, - // It should be triggered when the timepoint height is changed - 'displayStateChanged .studyTimepoint'(event, instance) { - const $timepoint = $(event.currentTarget); - const $wrapper = $timepoint.closest('.studyTimepointWrapper'); - - // Set the max-height for the wrapper to make CSS transition smoother - $wrapper.css('max-height', $timepoint.height()); - } -}); - -Template.studyTimepoint.helpers({ - isActive(study) { - const instance = Template.instance(); - - if (!study.studyInstanceUid) { - return; - } - - return instance.isActive[study.studyInstanceUid]; - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.styl b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.styl deleted file mode 100644 index ab78bc3f0..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepoint.styl +++ /dev/null @@ -1,8 +0,0 @@ -@import "{ohif:design}/app" - -.studyTimepointWrapper - overflow: hidden - transition($sidebarTransition) - -.timepoint-item:not(.active) .studyTimepointWrapper - max-height: 0 !important diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.html b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.html deleted file mode 100644 index cc93aa501..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.html +++ /dev/null @@ -1,44 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.js b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.js deleted file mode 100644 index b19d827a6..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.js +++ /dev/null @@ -1,211 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { OHIFError } from '../../../lib/classes/OHIFError'; - -Template.studyTimepointBrowser.onCreated(() => { - const instance = Template.instance(); - - // Reactive variable to control the view type for all or key timepoints - instance.timepointViewType = new ReactiveVar(instance.data.timepointViewType); - - // Defines whether to show all key timepoints or only the current one - instance.showAdditionalTimepoints = new ReactiveVar(true); - - // Return the current study if it's defined - instance.getCurrentStudy = () => { - return instance.data.currentStudy && instance.data.currentStudy.get(); - }; - - // Get the studies for a specific timepoint - instance.getStudies = timepoint => { - // @TypeSafeStudies - - if (!timepoint) { - return OHIF.viewer.Studies.all(); - } - - return timepoint.studyInstanceUids.map(studyInstanceUid => { - const query = { studyInstanceUid }; - - const loadedStudy = OHIF.viewer.Studies.findBy(query); - if (loadedStudy) return loadedStudy; - - const notYetLoaded = OHIF.studylist.collections.Studies.findOne(query); - if (notYetLoaded) return notYetLoaded; - - // const studyData = _.findWhere(timepoint.studiesData, query); - // if (studyData) return studyData; - - throw new OHIFError(`No study data available for Study: ${studyInstanceUid}`); - }); - }; -}); - -Template.studyTimepointBrowser.onRendered(() => { - const instance = Template.instance(); - - // Collapse all timepoints but first when timepoint view type changes - instance.autorun(() => { - // Runs this computation every time the timepointViewType is changed - const type = instance.timepointViewType.get(); - - // Removes all active classes to collapse the timepoints and studies - instance.$('.timepoint-item, .study-browser-item').removeClass('active'); - if (type === 'key' && !instance.data.currentStudy) { - // Show only first timepoint expanded for key timepoints - instance.$('.timepoint-item:first').addClass('active'); - } - }); - - // Expand only the timepoints with loaded studies in viewports - let lastStudy; - let activeStudiesUids = []; - - // Wait for rerendering and set the timepoint as active - instance.refreshActiveStudies = () => Tracker.afterFlush(() => { - _.each(activeStudiesUids, studyInstanceUid => { - instance.$(`.study-browser-item[data-uid='${studyInstanceUid}']`).addClass('active'); - }); - // Show only first timepoint expanded for key timepoints - instance.$('.timepoint-item:first').addClass('active'); - }); - - instance.autorun(() => { - // Runs this computation every time the current study is changed - const currentStudy = instance.data.currentStudy && instance.data.currentStudy.get(); - - // Stop here if there's no current study set - if (!currentStudy) { - return; - } - - // Check if the study really changed and update the last study - if (currentStudy !== lastStudy) { - instance.showAdditionalTimepoints.set(false); - lastStudy = currentStudy; - activeStudiesUids = [currentStudy.studyInstanceUid]; - } - - instance.refreshActiveStudies(); - }); -}); - -Template.studyTimepointBrowser.events({ - 'click .timepointHeader'(event, instance) { - const $timepoint = $(event.currentTarget).closest('.timepoint-item'); - - // Recalculates the timepoint height to make CSS transition smoother - $timepoint.find('.studyTimepoint').trigger('displayStateChanged'); - - // Toggle active class to group/ungroup timepoint studies - $timepoint.toggleClass('active'); - }, - - 'click .study-item-box.additional'(event, instance) { - // Show all key timepoints - instance.showAdditionalTimepoints.set(true); - } -}); - -Template.studyTimepointBrowser.helpers({ - // Decides if the timepoint view type switch shall be shown or omitted - shallShowViewType(timepointList) { - const instance = Template.instance(); - return timepointList.length && !instance.data.timepointViewType; - }, - - // Returns the button group data for switching between timepoint view types - viewTypeButtonGroupData() { - return { - value: Template.instance().timepointViewType, - options: [{ - value: 'key', - text: 'Key Timepoints' - }, { - value: 'all', - text: 'All Timepoints' - }] - }; - }, - - // Defines whether to show all key timepoints or only the current one - showAdditionalTimepoints() { - return Template.instance().showAdditionalTimepoints.get(); - }, - - hasAdditionalTimepoints() { - const instance = Template.instance(); - const { timepointApi } = instance.data; - const allTimepoints = timepointApi && timepointApi.all(); - return allTimepoints && allTimepoints.length > 1; - }, - - // Get the timepoints to be listed - timepoints() { - const instance = Template.instance(); - // Get the current study - const currentStudy = instance.getCurrentStudy(); - // Declare the timepoints - const { timepointApi } = instance.data; - let timepoints; - if (currentStudy && !instance.showAdditionalTimepoints.get()) { - // Show only the current study's timepoint - timepoints = timepointApi.study(currentStudy.studyInstanceUid); - } else { - if (!timepointApi) { - // If there is no timepoint API defined whatsoever, this means that there is no - // current timepoint ID, so we can just display all of the currently loaded studies - // in the study sidebar - timepoints = []; - } else if (instance.timepointViewType.get() === 'all') { - // Show all timepoints - timepoints = timepointApi.all(); - } else { - // Show only key timepoints - timepoints = timepointApi.key(); - } - } - - // Filter timepoints and show only the current timepoint and previous ones - let result = []; - const currentTimepoint = timepointApi.current(); - if (currentTimepoint) { - timepoints.forEach(timepoint => { - if (timepoint.latestDate.getTime() <= currentTimepoint.latestDate.getTime()) { - result.push(timepoint); - } - }); - } - - // Returns the timepoints - return result; - }, - - // Get the studies for a specific timepoint - studies(timepoint) { - return Template.instance().getStudies(timepoint); - }, - - // Build the modalities summary for all timepoint's studies - modalitiesSummary(timepoint) { - const instance = Template.instance(); - - const studies = instance.getStudies(timepoint); - - const modalities = {}; - studies.forEach(study => { - const modality = study.modalities || 'UN'; - modalities[modality] = modalities[modality] + 1 || 1; - }); - - const result = []; - _.each(modalities, (count, modality) => { - result.push(`${count} ${modality}`); - }); - - return result.join(', '); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.styl b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.styl deleted file mode 100644 index d956cb3a2..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.styl +++ /dev/null @@ -1,41 +0,0 @@ -@require '{ohif:design}/app' - -$timepointButtonHeight = 55px - -.studyTimepointBrowser - theme('background-color', '$primaryBackgroundColor') - float: left - height: 100% - position: relative - width: 100% - - .timepointButtonContainer - theme('background-color', '$primaryBackgroundColor') - theme('border-bottom', '1px solid $uiBorderColor') - display: none - height: $timepointButtonHeight - left: 10px - position: absolute - right: 10px - top: 0 - z-index: 1 - - &.viewTypeVisible - - .timepointButtonContainer - display: block - - .studyTimepointScrollArea - padding-top: $timepointButtonHeight - - .studyTimepointScrollArea - height: 100% - overflow-x: hidden - overflow-y: auto - margin-right: -36px - padding-bottom: 20px - padding-right: 36px - -ms-overflow-style: none - - &::-webkit-scrollbar - display: none diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointStudy.html b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointStudy.html deleted file mode 100644 index a7a5da855..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointStudy.html +++ /dev/null @@ -1,31 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointStudy.js b/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointStudy.js deleted file mode 100644 index 293bbb57c..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/studyTimepointBrowser/studyTimepointStudy.js +++ /dev/null @@ -1,181 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -Template.studyTimepointStudy.onCreated(() => { - const instance = Template.instance(); - - instance.loading = new ReactiveVar(false); - - const studyMetadata = OHIF.viewerbase.getStudyMetadata(instance.data.study); - const firstInstance = studyMetadata.getFirstInstance(); - if (firstInstance) { - instance.modalities = firstInstance.getRawValue('x00080060'); - instance.studyDescription = firstInstance.getRawValue('x00081030'); - instance.studyDate = firstInstance.getRawValue('x00080020'); - } - - // Get the current study element - instance.getStudyElement = (isGlobal=false) => { - const studyInstanceUid = instance.data.study.studyInstanceUid; - const selector = `.study-browser-item[data-uid='${studyInstanceUid}']`; - return isGlobal ? $(selector) : instance.$browser.find(selector); - }; - - instance.isQuickSwitch = () => { - return !_.isUndefined(instance.data.viewportIndex); - }; - - // Set the current study as selected in the studies list - instance.select = (isQuickSwitch=false) => { - const studyInstanceUid = instance.data.study.studyInstanceUid; - - const $study = instance.getStudyElement(); - const $timepoint = $study.closest('.studyTimepoint'); - - const selectionChanged = { - selection: [$study[0]], - studyInstanceUid, - isQuickSwitch - }; - - $timepoint.trigger('selectionChanged', selectionChanged); - }; - - instance.initializeStudyWrapper = () => { - // Stop here if it's a quick switch - if (instance.isQuickSwitch()) { - return; - } - - const $study = instance.getStudyElement(); - const $thumbnails = $study.find('.study-browser-series'); - $study.addClass('active'); - // If element already has max-height property set, .height() - // will return that value, so remove it to recalculate - $thumbnails.css('max-height', ''); - $thumbnails.css('max-height', $thumbnails.height()); - $study.removeClass('active'); - - // Here we add, remove, and add the active class again because this way - // the max-height animation appears smooth to the user. - if (instance.data.active) { - Meteor.setTimeout(() => $study.addClass('active'), 1); - } - }; -}); - -// Initialize the study wrapper max-height to enable CSS transition -Template.studyTimepointStudy.onRendered(() => { - const instance = Template.instance(); - - // Keep the study timepoint browser element to manipulate elements even after DOM is removed - instance.$browser = instance.$('.study-browser-item').closest('.studyTimepointBrowser'); - - instance.initializeStudyWrapper(); -}); - -Template.studyTimepointStudy.events({ - // Recalculates the timepoint height to make CSS transition smoother - 'transitionend .study-browser-series'(event, instance) { - if (event.target === event.currentTarget) { - $(event.currentTarget).closest('.studyTimepoint').trigger('displayStateChanged'); - } - }, - - // Transfers the active state to the current study - 'click .studyQuickSwitchTimepoint .study-item-container'(event, instance) { - instance.select(true); - }, - - // Set loading state - 'loadStarted .study-browser-item'(event, instance) { - instance.loading.set(true); - }, - - // Remove loading state and fix the thumbnails wrappers height - 'loadEnded .study-browser-item'(event, instance) { - instance.loading.set(false); - instance.initializeStudyWrapper(); - }, - - // Changes the current study selection for the clicked study - 'click .study-item-box'(event, instance) { - const studyData = instance.data.study; - const { studyInstanceUid } = studyData; - const isQuickSwitch = instance.isQuickSwitch(); - - // @TypeSafeStudies - // Check if the study already has series data, - // and if not, retrieve it. - if (!studyData.seriesList) { - const alreadyLoaded = OHIF.viewer.Studies.findBy({ studyInstanceUid }); - - if (!alreadyLoaded) { - const $studies = instance.getStudyElement(true); - $studies.trigger('loadStarted'); - OHIF.studies.retrieveStudyMetadata(studyInstanceUid).then(study => { - instance.data.study = study; - OHIF.viewer.Studies.insert(study); - - Meteor.setTimeout(() => { - $studies.trigger('loadEnded'); - instance.select(isQuickSwitch); - }, 1); - }).catch(error => { - OHIF.log.error(`There was an error trying to retrieve the study\'s metadata for studyInstanceUid: ${studyInstanceUid}`); - OHIF.log.error(error.stack); - - OHIF.log.trace(); - }); - } else { - studyData.seriesList = alreadyLoaded.seriesList; - instance.select(isQuickSwitch); - } - } else { - instance.select(isQuickSwitch); - } - } -}); - -Template.studyTimepointStudy.helpers({ - isLoading() { - // @TypeSafeStudies - const instance = Template.instance(); - const studyData = instance.data.study; - const alreadyLoaded = OHIF.viewer.Studies.findBy({ studyInstanceUid: studyData.studyInstanceUid }); - return instance.loading.get() && !alreadyLoaded; - }, - - modalities() { - const instance = Template.instance(); - const modalities = instance.modalities || 'UN'; - - // Replace backslashes with spaces - return modalities.replace(/\\/g, ' '); - }, - - modalityStyle() { - // Responsively styles the Modality Acronyms for studies - // with more than one modality - const instance = Template.instance(); - const modalities = instance.modalities || 'UN'; - const numModalities = modalities.split(/\\/g).length; - - if (numModalities === 1) { - // If we have only one modality, it should take up the whole div. - return 'font-size: 1em'; - } else if (numModalities === 2) { - // If we have two, let them sit side-by-side - return 'font-size: 0.75em'; - } else { - // If we have more than two modalities, change the line height to display multiple rows, - // depending on the number of modalities we need to display. - const lineHeight = Math.ceil(numModalities / 2) * 1.2; - return 'line-height: ' + lineHeight + 'em'; - } - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.html b/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.html deleted file mode 100644 index 0bc49691a..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.html +++ /dev/null @@ -1,99 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.js b/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.js deleted file mode 100644 index 335418881..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @TODO: add this to OHIF's Viewers - */ - -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; - -import { toolManager } from '../../../lib/toolManager'; -import { viewportUtils } from '../../../lib/viewportUtils'; - -Template.textMarkerDialogs.events({ - 'change #startFrom'(e) { - const config = cornerstoneTools.textMarker.getConfiguration(); - config.current = $(e.target).val(); - //console.log("Changed starting point to: " + config.current); - }, - 'change #ascending'(e) { - const config = cornerstoneTools.textMarker.getConfiguration(); - config.ascending = $(e.target).is(':checked'); - - const currentIndex = config.markers.indexOf(config.current); - - config.current = config.markers[currentIndex]; - const nextMarker = config.current; - $('#startFrom').val(nextMarker).trigger('change'); - //console.log("Changed ascending to: " + config.ascending); - }, - 'click #clearLabels'() { - const element = viewportUtils.getActiveViewportElement(); - const toolType = 'textMarker'; - const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager; - const toolState = toolStateManager.toolState; - - // We might want to make this a convenience function in cornerstoneTools - const stack = cornerstoneTools.getToolState(element, 'stack'); - if (stack && stack.data.length && stack.data[0].imageIds.length) { - const imageIds = stack.data[0].imageIds; - - // Clear the tool data for each image in the stack - imageIds.forEach( imageId => { - if(toolState.hasOwnProperty(imageId)) { - const toolData = toolState[imageId]; - if (toolData.hasOwnProperty(toolType)) { - delete toolData[toolType]; - } - } - }); - } - - cornerstone.updateImage(element); - }, - 'click .closeTextMarkerDialogs'() { - const defaultTool = toolManager.getDefaultTool(); - toolManager.setActiveTool(defaultTool); - document.getElementById('textMarkerOptionsDialog').close(); - $('#spine').removeClass('active'); - $('#' + defaultTool).addClass('active'); - } - -}); - -Template.textMarkerDialogs.onRendered(function() { - const optionsDialog = $('#textMarkerOptionsDialog'); - optionsDialog.draggable(); - dialogPolyfill.registerDialog(optionsDialog.get(0)); - - const relabelDialog = $('#textMarkerRelabelDialog'); - relabelDialog.draggable(); - dialogPolyfill.registerDialog(relabelDialog.get(0)); - - $(document).on('click', event => { - if (!$(event.target).closest('.select2-wrapper').length) { - setTimeout(() => { - $('#startFrom, .relabelSelect').select2('close'); - }, 200); - } - }); - - $(document).on('touchmove', event => { - if (!$(event.target).closest('.select2-container').length) { - setTimeout(() => { - $('#startFrom, .relabelSelect').select2('close'); - }, 200); - } - }); - - $(() => { - - FastClick.attach(document.body); - - const $customSelects = $('#startFrom, .relabelSelect') - - $customSelects.select2({ - /** - * Adds needsclick class to all DOM elements in the Select2 results list - * so they can be accessible on iOS mobile when FastClick is initiated too. - */ - templateResult(result, container) { - if (!result.id) { - return result.text; - } - container.className += ' needsclick'; - return result.text; - }, - placeholder: 'C1', - minimumResultsForSearch: -1, - theme: 'viewerDropdown' - }); - - /** - * Additional to tweaking the templateResult option in Select2, - * add needsclick class to all DOM elements in the Select2 container, - * so they can be accessible on iOS mobile when FastClick is initiated too. - * - * More info about needsclick: - * https://github.com/ftlabs/fastclick#ignore-certain-elements-with-needsclick - * - */ - $customSelects.each( (index, el) =>{ - $(el).data('select2').$container.find('*').addClass('needsclick'); - }); - - }); -}); \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.styl b/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.styl deleted file mode 100644 index c8ad48808..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/textMarkerDialogs/textMarkerDialogs.styl +++ /dev/null @@ -1,147 +0,0 @@ -.textMarkerDialog - z-index: 1000 - width: 260px - position: absolute - top: auto - left: auto - bottom: 3px - right: 3px - margin: auto - padding:.5em - background-image: linear-gradient(#2E608D, #23557F) - box-sizing: border-box - border: 1px black solid - border-radius: 5px - height: 81px - max-height: 81px - h5 - color: #D1EDFB; - font-size: 14px; - line-height: 22px; - font-weight: 600; - cursor:default - .handle - width: 40px; - float: left; - height: 22px; - display: block; - margin-right: 10px; - position: relative; - margin-top: 1px; - margin-left: 1px; - #startFrom - margin-right:10px - #clearLabels - margin-left:10px - float:right - .optionBox - color: #d1edfb - margin-bottom: 5px - float: left - span.subLabel - width: 50px - display: block - float: left - line-height: 30px - > label - color: #d1edfb - float: left - min-width: 40px - line-height: 24px - font-size: 12px - font-weight: 600 - .closeTextMarkerDialogs - position: absolute - top: 5px - right: 4px - padding: 5px - cursor: pointer - svg - width: 19px - height: 19px - fill: #d1edfb - &:hover - svg - fill: #FFF - .dialog.arrow - left: 50% - margin-left: -11px - border-top-width: 0 - border-bottom-color: #999999 - border-bottom-color: rgba(0, 0, 0, 0.25) - border-width: 11px - bottom: -10px - position: absolute - width: 0; - height: 0; - border-left: 10px solid transparent; - border-right: 10px solid transparent; - border-top: 10px solid #23557f; - &:after - content: " " - top: 1px - margin-left: -10px - border-top-width: 0 - border-bottom-color: #23557f - border-width: 10px - - button.btn-secondary - background-color: #CFE3F5; - border: 1px solid #E5F3FF; - font-size: 12px !important; - color:#0D416D - &:hover - color:#0D416D - -#textMarkerRelabelDialog - margin: 0 - .relabelOptions - padding: 15px 0px 0px 0px - .relabelSelect - margin-left: 5px - -#textMarkerOptionsDialog - .optionsDiv - padding-top: 10px - -//Avoids Cine Play and Text Marker dialog to overlap -#textMarkerOptionsDialog[open='open'] ~ #cineDialog[open='open'] - bottom: 90px - -.relabelButtons - text-align:right - -button.viewerBtn - background-color: #5D9ACE; - border: 1px solid #6EAEE4; - font-size: 12px !important; - color:#FFF - line-height: 21px; - &:hover - color:#FFF - -.iconSwitch - margin:0px 5px - .btn - span - display: none - .on - display: none - .off - display: block - &.btn-link, &.active, &:active, &:hover, &:focus, &.active:focus - background-color: #225682; - border: 1px solid #7AB0DE; - box-shadow: none; - padding: 1px 7px; - border-radius: 4px; - color: #d1edfb; - box-shadow: none; - outline: none; - &:hover - color:#fff - &.active - .on - display:block - .off - display: none diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolContextMenu/toolContextMenu.js b/Packages/ohif-viewerbase/client/components/viewer/toolContextMenu/toolContextMenu.js deleted file mode 100644 index 069629a7e..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/toolContextMenu/toolContextMenu.js +++ /dev/null @@ -1,72 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { toolManager } from '../../../lib/toolManager'; - -const toolTypes = ['length', 'simpleAngle', 'probe', 'ellipticalRoi', 'rectangleRoi', 'arrowAnnotate']; -const TypeToLabelMap = { - length: 'Length', - simpleAngle: 'Angle', - probe: 'Probe', - ellipticalRoi: 'Elliptical ROI', - rectangleRoi: 'Rectangle ROI', - arrowAnnotate: 'Annotation' -}; -let dropdownItems = [{ - actionType: 'Delete', - action: ({ nearbyToolData, eventData }) => { - const element = eventData.element; - - cornerstoneTools.removeToolState(element, nearbyToolData.toolType, nearbyToolData.tool); - cornerstone.updateImage(element); - } -}]; - -const getTypeText = function(toolData, actionType) { - const toolType = toolData.toolType; - let message = `${TypeToLabelMap[toolType]}`; - - if (toolType === 'arrowAnnotate') { - message = `${message} "${toolData.tool.text}"`; - } - - return `${actionType} ${message}`; -}; - -const createDropdown = function(eventData, isTouchEvent = false) { - const nearbyToolData = toolManager.getNearbyToolData(eventData.element, eventData.currentPoints.canvas, toolTypes); - - // Annotate tools for touch events already have a press handle to edit it, has a better UX for deleting it - if (isTouchEvent && nearbyToolData.toolType === 'arrowAnnotate') return; - - if (nearbyToolData) { - dropdownItems.forEach(function(item) { - item.params = { - eventData, - nearbyToolData - }; - item.text = getTypeText(nearbyToolData, item.actionType); - }); - - OHIF.ui.showDropdown(dropdownItems, { - menuClasses: 'dropdown-menu-left', - event: eventData.event - }); - } -}; - -Template.viewerMain.events({ - 'cornerstonetoolsmouseclick .imageViewerViewport'(event) { - const { originalEvent } = event; - const eventData = originalEvent.detail; - if (eventData.which === 3) { - createDropdown(eventData); - } - }, - - 'cornerstonetoolstouchpress .imageViewerViewport'(event) { - const { originalEvent } = event; - const eventData = originalEvent.detail; - createDropdown(eventData, true); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.html b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.html deleted file mode 100644 index d3fd7e644..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.html +++ /dev/null @@ -1,42 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.js b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.js deleted file mode 100644 index 6d3dcadae..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.js +++ /dev/null @@ -1,130 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { _ } from 'meteor/underscore'; - -Template.toolbarSectionButton.onCreated(() => { - const instance = Template.instance(); - - instance.isActive = activeToolId => { - OHIF.commands.last.dep.depend(); - const subTools = instance.data.subTools; - const currentId = instance.data.id; - const isCurrentTool = currentId === activeToolId; - const isSubTool = subTools && _.findWhere(subTools, { id: activeToolId }); - const activeCommandButtons = Session.get('ToolManagerActiveCommandButtons') || []; - const isActiveCommandButton = activeCommandButtons.indexOf(instance.data.id) !== -1; - const isActive = typeof instance.data.active === 'function' && instance.data.active(); - - // Check if the current tool, a sub tool or a command button is active - return isActive || isCurrentTool || isSubTool || isActiveCommandButton; - }; - - instance.getActiveToolSubProperty = (propertyName, activeToolId) => { - const instance = Template.instance(); - const subTools = instance.data.subTools; - const defaultProperty = instance.data[propertyName]; - const currentId = instance.data.id; - - if (subTools && activeToolId !== currentId && instance.isActive(activeToolId)) { - const subTool = _.findWhere(subTools, { id: activeToolId }); - return subTool ? subTool[propertyName] : defaultProperty; - } else { - return defaultProperty; - } - }; - - instance.autorun(computation => { - Session.get('ToolManagerActiveToolUpdated'); - - // Get the last executed command - const lastCommand = OHIF.commands.last.get(); - - // Prevent running this computation on its first run - if (computation.firstRun) return; - - // Stop here if it's not the last command or if it's already an active tool - const { id } = instance.data; - const activeToolId = OHIF.viewerbase.toolManager.getActiveTool(); - if (lastCommand !== id || instance.isActive(activeToolId)) return; - - // Add an active class to a button for 100ms to give the impression the button was pressed - const flashButton = $element => { - $element.addClass('active'); - setTimeout(() => { - if ($element.hasClass('expandable') && $element.find('.toolbarSectionButton.active').length) return; - - const activeToolId = OHIF.viewerbase.toolManager.getActiveTool(); - const isActive = instance.isActive(activeToolId); - if (!isActive) { - $element.removeClass('active'); - } - }, 100); - }; - - // Flash the active button - const $button = instance.$('.toolbarSectionButton').first(); - flashButton($button); - - // Flash the parent button as well in case of this button is inside a drawer - const $parentButton = $button.closest('.toolbarSectionButton.expandable'); - if ($parentButton.length) { - flashButton($parentButton); - } - }); -}); - -Template.toolbarSectionButton.helpers({ - activeClass() { - Session.get('ToolManagerActiveToolUpdated'); - const instance = Template.instance(); - const activeToolId = OHIF.viewerbase.toolManager.getActiveTool(); - const isActive = instance.isActive(activeToolId); - return isActive ? 'active' : ''; - }, - - svgLink() { - Session.get('ToolManagerActiveToolUpdated'); - const instance = Template.instance(); - const activeToolId = OHIF.viewerbase.toolManager.getActiveTool(); - const svgLink = instance.getActiveToolSubProperty('svgLink', activeToolId); - return _.isFunction(svgLink) ? svgLink() : svgLink; - }, - - iconClasses() { - Session.get('ToolManagerActiveToolUpdated'); - const instance = Template.instance(); - const activeToolId = OHIF.viewerbase.toolManager.getActiveTool(); - const iconClasses = instance.getActiveToolSubProperty('iconClasses', activeToolId); - return _.isFunction(iconClasses) ? iconClasses() : iconClasses; - }, - - disableButton() { - Session.get('activeViewport'); - Session.get('LayoutManagerUpdated'); - const instance = Template.instance(); - const isCommandDisabled = OHIF.commands.isDisabled(instance.data.id); - const isFunctionDisabled = instance.data.disableFunction && instance.data.disableFunction(); - return isCommandDisabled || isFunctionDisabled; - }, - - hasSubTools() { - return this.subTools || this.subToolsTemplateName; - } -}); - -Template.toolbarSectionButton.events({ - 'click .toolbarSectionButton:not(.expandable)'(event, instance) { - // Prevent the event from bubbling to parent tools - event.stopPropagation(); - const $currentTarget = $(event.currentTarget); - - // Stop here if the button is disabled or customAction - if ($currentTarget.hasClass('disabled') || $currentTarget.hasClass('customAction')) { - return; - } - - // Run the command attached to the button - OHIF.commands.run(instance.data.id); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.styl b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.styl deleted file mode 100644 index d2606535b..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionButton/toolbarSectionButton.styl +++ /dev/null @@ -1,63 +0,0 @@ -@import "{ohif:design}/app" - -.toolbarSectionButton - theme('color', '$defaultColor') - theme('fill', '$defaultColor') - theme('stroke', '$defaultColor') - cursor: pointer - display: inline-block - min-width: 30px - outline: none - position: relative - text-align: center - - &.disabled - &>.buttonLabel, &>.svgContainer - opacity: 0.5 - cursor: not-allowed - - &:hover - &, i - theme('color', '$textSecondaryColor') - - .buttonLabel - theme('color', '$textSecondaryColor') - font-size: 12px - font-weight: 500 - - .svgContainer - margin: 0 auto - text-align: center - - i - theme('color', '$textSecondaryColor') - font-size: 18px - line-height: 30px - - svg - background-color: transparent - margin: 2px - width: 21px - height: 21px - - &:hover - &>.buttonLabel - theme('color', '$hoverColor') - - &>i - theme('color', '$hoverColor') - - &>.svgContainer>svg - theme('fill', '$hoverColor') - theme('stroke', '$hoverColor') - - &:active, &.active - &>.buttonLabel, &>.svgContainer - theme('color', '$activeColor') - - svg - theme('fill', '$activeColor') - theme('stroke', '$activeColor') - - i - theme('color', '$activeColor') diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.html b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.html deleted file mode 100644 index 77d17fe42..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.js b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.js deleted file mode 100644 index f8de09736..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.js +++ /dev/null @@ -1,67 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Meteor } from 'meteor/meteor'; - -Template.toolbarSectionTools.events({ - 'click .expandable'(event, instance) { - const $target = $(event.currentTarget); - const isExpanded = $target.hasClass('expanded'); - $target.toggleClass('expanded', !isExpanded); - - // Remove the previously set repositioning css attribute - const $box = $target.find('.toolbarSectionDrawerContainer:first'); - $box.css('left', ''); - - // Stop here if the tool group is not expanded - if (isExpanded) { - return; - } - - // Move the box left or right if it is overflowing the window - const transitionendHandler = event => { - const originalEvent = event.originalEvent; - const propertyName = originalEvent && originalEvent.propertyName; - if (propertyName && propertyName === 'transform') { - $target.off('transitionend', transitionendHandler); - } else { - return; - } - - const boxWidth = $box.outerWidth(); - const start = $box.offset().left; - const bodyWidth = $(document.body).outerWidth(); - const end = start + boxWidth; - - if (start < 0) { - $box.css('left', `calc(50% - ${start}px)`); - } else if (end > bodyWidth) { - const diff = end - bodyWidth; - $box.css('left', `calc(50% - ${diff}px)`); - } - }; - - // Attach the handler to deal with position fixing - $target.on('transitionend', transitionendHandler); - }, - - 'focusout .expandable'(event, instance) { - const target = event.target; - const currentTarget = event.currentTarget; - - // Postpone the execution to be able to get the focused element - Meteor.defer(() => { - const $focused = $(':focus'); - const $expandable = $(currentTarget).closest('.expandable'); - const focusInside = $expandable.find(':focus').length; - - // Check if the expandable lost the focus - if (!$focused.length || !focusInside) { - // Stop here if focus is going from subtool to expandable tool - if (currentTarget !== target && $focused[0] === currentTarget) { - return; - } - - $expandable.removeClass('expanded'); - } - }); - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.styl b/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.styl deleted file mode 100644 index ebbd58f20..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/toolbarSectionTools/toolbarSectionTools.styl +++ /dev/null @@ -1,45 +0,0 @@ -@import "{ohif:design}/app" - -$distance = 10px - -.toolbarSectionTools - position: relative - - .toolbarSectionButton>.buttonLabel i.expanded-status - text-align: center - transition(all 300ms ease) - width: 8px - - .toolbarSectionButton.expanded - &>.buttonLabel i.expanded-status - transform(rotateX(180deg)) - - &>.toolbarSectionDrawerContainer - opacity: 1 - transform(translateX(-50%) translateY(0) scale(1)) - - .toolbarSectionDrawerContainer - bottom: - $toolbarDrawerHeight - height: $toolbarDrawerHeight - left: 50% - min-width: 100% - opacity: 0 - padding-top: $distance - position: absolute - transition(opacity 0.3s ease\, transform 0.3s ease\, left 0.3s ease) - transform(translateX(-50%) translateY( - ($toolbarDrawerHeight + $distance)) scale(0)) - white-space: nowrap - z-index: 2 - - .toolbarSectionDrawer - theme('background', '$uiGrayDarkest', 0.95) - theme('border', '2px solid $uiBorderColor', 0.95) - border-radius: 7px - theme('color', '$textPrimaryColor') - content: '' - display: block - font-size: 18px - height: $toolbarDrawerHeight - padding-top: 6px - text-align: center - width: 100% diff --git a/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.html b/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.html deleted file mode 100644 index f248b5704..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.html +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.js b/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.js deleted file mode 100644 index 4a0366d41..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.js +++ /dev/null @@ -1,22 +0,0 @@ -import { Template } from 'meteor/templating'; -import { ReactiveVar } from 'meteor/reactive-var'; - -Template.userPreferencesDialog.onCreated(() => { - const instance = Template.instance(); - instance.activeTab = new ReactiveVar('hotkeys'); -}); - -Template.userPreferencesDialog.events({ - 'click .nav-tabs li a'(event, instance) { - const tabId = $(event.currentTarget).attr('data-id'); - instance.activeTab.set(tabId); - } -}); - -Template.userPreferencesDialog.helpers({ - tabClasses(tabId) { - const instance = Template.instance(); - const activeTab = instance.activeTab.get(); - return tabId === activeTab ? 'active' : ''; - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.styl b/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.styl deleted file mode 100644 index 939754ca9..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/userPreferences/dialog.styl +++ /dev/null @@ -1,18 +0,0 @@ -@require '{ohif:design}/app' - -.dialog-user-preferences - - .modal-body - overflow: hidden - - .form-content - border-bottom: 3px solid #000000 - margin-bottom: 20px - margin-left: -22px - margin-right: -22px - max-height: 70vh - overflow-y: auto - padding: 22px - - .popover - width: 300px diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.html b/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.html deleted file mode 100644 index dbf874b7c..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.html +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.js b/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.js deleted file mode 100644 index fea90093e..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.js +++ /dev/null @@ -1,91 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { OHIF } from 'meteor/ohif:core'; -// Local Modules -import { unloadHandlers } from '../../../lib/unloadHandlers'; -import { ResizeViewportManager } from '../../../lib/classes/ResizeViewportManager'; -import { LayoutManager } from '../../../lib/classes/LayoutManager'; -import { StudyPrefetcher } from '../../../lib/classes/StudyPrefetcher'; -import { StudyLoadingListener } from '../../../lib/classes/StudyLoadingListener'; - -Meteor.startup(() => { - window.ResizeViewportManager = window.ResizeViewportManager || new ResizeViewportManager(); - - // Set initial value for OHIFViewerMainRendered - // session variable. This can used in viewer main template - Session.set('OHIFViewerMainRendered', false); -}); - -Template.viewerMain.onCreated(() => { - // Attach the Window resize listener - // Don't use jQuery here. "window.onresize" will always be null - // If its necessary, check all the code for window.onresize getter - // and change it to jQuery._data(window, 'events')['resize']. - // Otherwise this function will be probably overrided. - // See cineDialog instance.setResizeHandler function - window.addEventListener('resize', window.ResizeViewportManager.getResizeHandler()); - - // Add beforeUnload event handler to check for unsaved changes - window.addEventListener('beforeunload', unloadHandlers.beforeUnload); - - // Set the current context - OHIF.context.set('viewer'); -}); - -Template.viewerMain.onRendered(() => { - const instance = Template.instance(); - const { studies } = instance.data; - const parentElement = instance.$('#layoutManagerTarget').get(0); - const studyPrefetcher = StudyPrefetcher.getInstance(); - instance.studyPrefetcher = studyPrefetcher; - - instance.studyLoadingListener = StudyLoadingListener.getInstance(); - instance.studyLoadingListener.clear(); - instance.studyLoadingListener.addStudies(studies); - - OHIF.viewerbase.layoutManager = new LayoutManager(parentElement, studies); - studyPrefetcher.setStudies(studies); - - Session.set('OHIFViewerMainRendered', Math.random()); -}); - -Template.viewerMain.onDestroyed(() => { - const instance = Template.instance(); - - OHIF.log.info('viewerMain onDestroyed'); - - // Remove the Window resize listener - window.removeEventListener('resize', window.ResizeViewportManager.getResizeHandler()); - - // Remove beforeUnload event handler... - window.removeEventListener('beforeunload', unloadHandlers.beforeUnload); - - // Destroy the synchronizer used to update reference lines - OHIF.viewer.updateImageSynchronizer.destroy(); - - delete OHIF.viewerbase.layoutManager; - ProtocolEngine = null; - - Session.set('OHIFViewerMainRendered', false); - - // Stop prefetching when we close the viewer - instance.studyPrefetcher.destroy(); - - // Destroy stack loading listeners when we close the viewer - instance.studyLoadingListener.clear(); - - // Clear references to all stacks in the StackManager - OHIF.viewerbase.stackManager.clearStacks(); - - // @TypeSafeStudies - // Clears OHIF.viewer.Studies collection - OHIF.viewer.Studies.removeAll(); - - // @TypeSafeStudies - // Clears OHIF.viewer.StudyMetadataList collection - OHIF.viewer.StudyMetadataList.removeAll(); - - // Reset the current context - OHIF.context.set(null); -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.styl b/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.styl deleted file mode 100644 index d0516b87c..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.styl +++ /dev/null @@ -1,42 +0,0 @@ -@import "{ohif:design}/app" - -#viewer - height: "calc(100% - %s)" % $topBarHeight - - &>.loadingTextDiv - theme('color', '$textSecondaryColor') - font-size: 30px - height: 100% - line-height: "calc(100% - %s)" % $topBarHeight - -.viewerMain - width: 100% - height: 100% - - #layoutManagerTarget - width: 100% - height: 100% - transition(all 0.3s ease) - - #imageViewerViewports - .viewportContainer - theme('border', '%s solid $uiBorderColorDark' % $viewportBorderThickness) - float: left - - outline: 0 // Prevent blue outline in Chrome - - &:hover - &.active - &:hover.active - outline: 0 // Prevent blue outline in Chrome - - &:hover - theme('border', '%s solid $uiBorderColor' % $viewportBorderThickness) - - &.active, &:hover.active - theme('border', '%s solid $uiBorderColorActive' % $viewportBorderThickness) - - .removable - width: 100% - height: 100% - position: relative // Necessary so that the viewportOverlay is on top of the viewports diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.html b/Packages/ohif-viewerbase/client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.html deleted file mode 100644 index 533199159..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.html +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.styl b/Packages/ohif-viewerbase/client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.styl deleted file mode 100644 index 740449286..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.styl +++ /dev/null @@ -1,18 +0,0 @@ -.viewportOrientationMarkers - pointer-events: none // Necessary for click-through to cornerstone element below - - font-size: 15px - color: rgb(204, 204, 204) - line-height: 18px - - .orientationMarker - position: absolute - - .topMid - top: 5px - left: 50% - - .leftMid - top: 47% - left: 5px - \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.html b/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.html deleted file mode 100644 index 590c90fac..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.html +++ /dev/null @@ -1,76 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.js b/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.js deleted file mode 100644 index d41fa7144..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.js +++ /dev/null @@ -1,280 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; -import { viewportOverlayUtils } from '../../../lib/viewportOverlayUtils'; -import { getElementIfNotEmpty } from '../../../lib/getElementIfNotEmpty'; -import { getStackDataIfNotEmpty } from '../../../lib/getStackDataIfNotEmpty'; - -Template.viewportOverlay.onCreated(() => { - const instance = Template.instance(); - - instance.getImageIndex = () => { - const stack = getStackDataIfNotEmpty(instance.data.viewportIndex); - if (!stack || stack.currentImageIdIndex === undefined) return; - - return stack.currentImageIdIndex; - }; -}); - -Template.viewportOverlay.helpers({ - wwwc() { - Session.get('CornerstoneImageRendered' + this.viewportIndex); - - const element = getElementIfNotEmpty(this.viewportIndex); - if (!element) { - return ''; - } - - const viewport = cornerstone.getViewport(element); - if (!viewport) { - return ''; - } - - return 'W ' + viewport.voi.windowWidth.toFixed(0) + ' L ' + viewport.voi.windowCenter.toFixed(0); - }, - - zoom() { - Session.get('CornerstoneImageRendered' + this.viewportIndex); - - const element = getElementIfNotEmpty(this.viewportIndex); - if (!element) { - return; - } - - const viewport = cornerstone.getViewport(element); - if (!viewport) { - return; - } - - return (viewport.scale * 100.0); - }, - - imageDimensions() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - const image = viewportOverlayUtils.getImage(this.viewportIndex); - if (!image) { - return ''; - } - - return image.width + ' x ' + image.height; - }, - - patientName() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getPatient.call(this, 'name'); - }, - - patientId() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getPatient.call(this, 'id'); - }, - - patientBirthDate() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getPatient.call(this, 'birthDate'); - }, - - patientSex() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getPatient.call(this, 'sex'); - }, - - studyDate() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getStudy.call(this, 'studyDate'); - }, - - studyTime() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getStudy.call(this, 'studyTime'); - }, - - studyDescription() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getStudy.call(this, 'studyDescription'); - }, - - seriesDescription() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getSeries.call(this, 'seriesDescription'); - }, - - frameRate() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - const frameTime = viewportOverlayUtils.getInstance.call(this, 'frameTime'); - if (!frameTime) { - return; - } - - const frameRate = 1000 / frameTime; - return frameRate.toFixed(1); - }, - - seriesNumber() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getSeries.call(this, 'seriesNumber'); - }, - - instanceNumber() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getInstance.call(this, 'instanceNumber'); - }, - - thickness() { - // Displays Slice Thickness (0018,0050) - - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getInstance.call(this, 'sliceThickness'); - }, - - location() { - // Displays Slice Location (0020,1041), if present. - // - Otherwise, displays Table Position (0018,9327) - // - TODO: Otherwise, displays a value derived from Image Position (Patient) (0020,0032) - - Session.get('CornerstoneNewImage' + this.viewportIndex); - const sliceLocation = viewportOverlayUtils.getInstance.call(this, 'sliceLocation'); - if (sliceLocation !== '') { - return sliceLocation; - } - - const tablePosition = viewportOverlayUtils.getInstance.call(this, 'tablePosition'); - if (tablePosition !== '') { - return tablePosition; - } - - return viewportOverlayUtils.getInstance.call(this, 'imagePositionPatient'); - }, - - spacingBetweenSlices() { - // Displays Spacing Between Slices (0018,0088), if present. - - // TODO: Otherwise, displays a value derived from successive values - // of Image Position (Patient) (0020,0032) perpendicular to - // the Image Orientation (Patient) (0020,0037) - - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getInstance.call(this, 'spacingBetweenSlices'); - }, - - compression() { - // Displays whether or not lossy compression has been applied: - // - // - Checks Lossy Image Compression (0028,2110) - // - If so, displays the value of Lossy Image Compression Ratio (0028,2112) - // and Lossy Image Compression Method (0028,2114) - - Session.get('CornerstoneNewImage' + this.viewportIndex); - - if (!this.imageId) { - return false; - } - - const instance = cornerstone.metaData.get('instance', this.imageId); - if (!instance) { - return ''; - } - - if (instance.lossyImageCompression === '01' && - instance.lossyImageCompressionRatio !== '') { - const compressionMethod = instance.lossyImageCompressionMethod || 'Lossy: '; - const compressionRatio = parseFloat(instance.lossyImageCompressionRatio).toFixed(2); - return compressionMethod + compressionRatio + ' : 1'; - } - - return 'Lossless / Uncompressed'; - }, - - tagDisplayLeftOnly() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getTagDisplay.call(this, 'side') === 'L'; - }, - - tagDisplayRightOnly() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getTagDisplay.call(this, 'side') === 'R'; - }, - - tagDisplaySpecified() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getTagDisplay.call(this, 'side'); - }, - - imageNumber() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - return viewportOverlayUtils.getInstance.call(this, 'number'); - }, - - imageIndex() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - const imageIndex = Template.instance().getImageIndex(); - return _.isUndefined(imageIndex) ? 0 : imageIndex + 1; - }, - - numImages() { - Session.get('CornerstoneNewImage' + this.viewportIndex); - - const stack = getStackDataIfNotEmpty(this.viewportIndex); - if (!stack || !stack.imageIds) { - return; - } - - return stack.imageIds.length; - }, - - prior() { - // This helper is updated whenever a new image is displayed in the viewport - Session.get('CornerstoneNewImage' + this.viewportIndex); - - if (!this.imageId) { - return; - } - - // @TypeSafeStudies - // Make sure there are more than two studies loaded in the viewer - const viewportStudies = OHIF.viewer.Studies.all(); - if (viewportStudies.length < 2) { - return; - } - - // Here we sort the collection in ascending order by study date, so - // that we can obtain the oldest study as the first element of the array - // - // TODO= Find out if we should encode studyDate as a Date in the OHIF.viewer.Studies Collection - const viewportStudiesArray = _.sortBy(viewportStudies, function(study) { - return viewportOverlayUtils.formatDateTime(study.studyDate, study.studyTime); - }); - - // Get study data - const study = cornerstone.metaData.get('study', this.imageId); - if (!study) { - return; - } - - const oldestStudy = viewportStudiesArray[0]; - if (viewportOverlayUtils.formatDateTime(study.studyDate, study.studyTime) <= viewportOverlayUtils.formatDateTime(oldestStudy.studyDate, oldestStudy.studyTime)) { - return 'Prior'; - } - } -}); diff --git a/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.styl b/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.styl deleted file mode 100644 index 0ca7c9173..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/viewportOverlay/viewportOverlay.styl +++ /dev/null @@ -1,56 +0,0 @@ -@import "{ohif:design}/app" - -$viewportTagPadding = 20px - -.imageViewerViewport.empty ~ .imageViewerViewportOverlay - display: none - -.imageViewerViewportOverlay - theme('color', '$textSecondaryColor') - - .dicomTag - position: absolute - font-weight: 400 - text-shadow: 1px 1px black - pointer-events: none - - .topleft - top: $viewportTagPadding - left: $viewportTagPadding - - .topcenter - top: $viewportTagPadding - padding-top: $viewportTagPadding - width: 100% - text-align: center - - .topright - top: $viewportTagPadding - right: $viewportTagPadding - text-align: right - - .bottomleft - bottom: $viewportTagPadding - left: $viewportTagPadding - - .bottomright - bottom: $viewportTagPadding - right: $viewportTagPadding - text-align: right - - .priorIndicator - font-weight: bold - color: yellow - - &.controlsVisible - .topright, .bottomright - right: "calc(%s + 19px)" % $viewportTagPadding - - svg - theme('color', '$defaultColor') - theme('fill', '$defaultColor') - theme('stroke', '$defaultColor') - background-color: transparent - margin: 2px - width: 18px - height: 18px diff --git a/Packages/ohif-viewerbase/client/components/viewer/windowLevelPresets/form.html b/Packages/ohif-viewerbase/client/components/viewer/windowLevelPresets/form.html deleted file mode 100644 index bb4934cce..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/windowLevelPresets/form.html +++ /dev/null @@ -1,31 +0,0 @@ - diff --git a/Packages/ohif-viewerbase/client/components/viewer/windowLevelPresets/form.js b/Packages/ohif-viewerbase/client/components/viewer/windowLevelPresets/form.js deleted file mode 100644 index e5c273cee..000000000 --- a/Packages/ohif-viewerbase/client/components/viewer/windowLevelPresets/form.js +++ /dev/null @@ -1,37 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -Template.windowLevelPresetsForm.onCreated(() => { - const instance = Template.instance(); - const { wlPresets } = OHIF.viewerbase; - - instance.api = { - save() { - const form = instance.$('form').first().data('component'); - const definitions = form.value(); - const promise = wlPresets.store(definitions); - promise.then(() => OHIF.ui.notifications.success({ - text: 'The Window/Levels preferences were successfully saved.' - })); - return promise; - }, - - resetDefaults() { - const dialogOptions = { - class: 'themed', - title: 'Reset Window/Levels Presets', - message: 'Are you sure you want to reset all the window level presets to their defaults?' - }; - - return OHIF.ui.showDialog('dialogConfirm', dialogOptions).then(() => wlPresets.resetDefaults()); - } - }; -}); - -Template.windowLevelPresetsForm.helpers({ - getPresetsInputInformationList() { - OHIF.viewerbase.wlPresets.changeObserver.depend(); - return _.toArray(OHIF.viewer.wlPresets); - } -}); diff --git a/Packages/ohif-viewerbase/client/index.js b/Packages/ohif-viewerbase/client/index.js deleted file mode 100644 index c3375f0dd..000000000 --- a/Packages/ohif-viewerbase/client/index.js +++ /dev/null @@ -1,247 +0,0 @@ -import { Viewerbase } from '../namespace'; - -/** - * Imports file with side effects only (files that do not export anything...) - */ - -import './collections'; -import './lib/debugReactivity'; - -/** - * Exported Functions - */ - -// getElementIfNotEmpty -import { getElementIfNotEmpty } from './lib/getElementIfNotEmpty'; -Viewerbase.getElementIfNotEmpty = getElementIfNotEmpty; - -// getStackDataIfNotEmpty -import { getStackDataIfNotEmpty } from './lib/getStackDataIfNotEmpty'; -Viewerbase.getStackDataIfNotEmpty = getStackDataIfNotEmpty; - -// switchToImageRelative -import { switchToImageRelative } from './lib/switchToImageRelative'; -Viewerbase.switchToImageRelative = switchToImageRelative; - -// switchToImageByIndex -import { switchToImageByIndex } from './lib/switchToImageByIndex'; -Viewerbase.switchToImageByIndex = switchToImageByIndex; - -// getFrameOfReferenceUID -import { getFrameOfReferenceUID } from './lib/getFrameOfReferenceUID'; -Viewerbase.getFrameOfReferenceUID = getFrameOfReferenceUID; - -// getImageIdForImagePath -import { getImageIdForImagePath } from './lib/getImageIdForImagePath'; -Viewerbase.getImageIdForImagePath = getImageIdForImagePath; - -// updateCrosshairsSynchronizer -import { updateCrosshairsSynchronizer } from './lib/updateCrosshairsSynchronizer'; -Viewerbase.updateCrosshairsSynchronizer = updateCrosshairsSynchronizer; - -// getImageId -import { getImageId } from './lib/getImageId'; -Viewerbase.getImageId = getImageId; - -// setActiveViewport -import { setActiveViewport } from './lib/setActiveViewport'; -Viewerbase.setActiveViewport = setActiveViewport; - -// setFocusToActiveViewport -import { setFocusToActiveViewport } from './lib/setFocusToActiveViewport'; -Viewerbase.setFocusToActiveViewport = setFocusToActiveViewport; - -// getWADORSImageId -import { getWADORSImageId } from './lib/getWADORSImageId'; -Viewerbase.getWADORSImageId = getWADORSImageId; - -// updateAllViewports -import { updateAllViewports } from './lib/updateAllViewports'; -Viewerbase.updateAllViewports = updateAllViewports; - -// sortStudy -import { sortStudy } from './lib/sortStudy'; -Viewerbase.sortStudy = sortStudy; - -// updateMetaDataManager -import { updateMetaDataManager } from './lib/updateMetaDataManager'; -Viewerbase.updateMetaDataManager = updateMetaDataManager; - -// updateOrientationMarkers -import { updateOrientationMarkers } from './lib/updateOrientationMarkers'; -Viewerbase.updateOrientationMarkers = updateOrientationMarkers; - -// isImage -import { isImage } from './lib/isImage'; -Viewerbase.isImage = isImage; - -// getInstanceClassDefaultViewport, setInstanceClassDefaultViewportFunction -import { getInstanceClassDefaultViewport, setInstanceClassDefaultViewportFunction } from './lib/instanceClassSpecificViewport'; -Viewerbase.getInstanceClassDefaultViewport = getInstanceClassDefaultViewport; -Viewerbase.setInstanceClassDefaultViewportFunction = setInstanceClassDefaultViewportFunction; - -// displayReferenceLines -import { displayReferenceLines } from './lib/displayReferenceLines'; -Viewerbase.displayReferenceLines = displayReferenceLines; - -// getStudyMetadata -import { getStudyMetadata } from './lib/getStudyMetadata'; -Viewerbase.getStudyMetadata = getStudyMetadata; - -/** - * Exported Namespaces (sub-namespaces) - */ - -// imageViewerViewportData.* -import { imageViewerViewportData } from './lib/imageViewerViewportData'; -Viewerbase.imageViewerViewportData = imageViewerViewportData; - -// panelNavigation.* -import { panelNavigation } from './lib/panelNavigation'; -Viewerbase.panelNavigation = panelNavigation; - -// prepareViewerData -import { prepareViewerData } from './lib/prepareViewerData'; -Viewerbase.prepareViewerData = prepareViewerData; - -// renderViewer -import { renderViewer } from './lib/renderViewer'; -Viewerbase.renderViewer = renderViewer; - -// WLPresets.* -import { WLPresets } from './lib/WLPresets'; -Viewerbase.wlPresets = WLPresets; - -// hotkeyUtils.* -import { hotkeyUtils } from './lib/hotkeyUtils'; -Viewerbase.hotkeyUtils = hotkeyUtils; - -// viewportOverlayUtils.* -import { viewportOverlayUtils } from './lib/viewportOverlayUtils'; -Viewerbase.viewportOverlayUtils = viewportOverlayUtils; - -// viewportUtils.* -import { viewportUtils } from './lib/viewportUtils'; -Viewerbase.viewportUtils = viewportUtils; - -// thumbnailDragHandlers.* -import { thumbnailDragHandlers } from './lib/thumbnailDragHandlers'; -Viewerbase.thumbnailDragHandlers = thumbnailDragHandlers; - -// dialogUtils.* -import { dialogUtils } from './lib/dialogUtils'; -Viewerbase.dialogUtils = dialogUtils; - -// unloadHandlers.* -import { unloadHandlers } from './lib/unloadHandlers'; -Viewerbase.unloadHandlers = unloadHandlers; - -// sortingManager.* -import { sortingManager } from './lib/sortingManager'; -Viewerbase.sortingManager = sortingManager; - -// crosshairsSynchronizers.* -import { crosshairsSynchronizers } from './lib/crosshairsSynchronizers'; -Viewerbase.crosshairsSynchronizers = crosshairsSynchronizers; - -// annotateTextUtils.* -import { annotateTextUtils } from './lib/annotateTextUtils'; -Viewerbase.annotateTextUtils = annotateTextUtils; - -// textMarkerUtils.* -import { textMarkerUtils } from './lib/textMarkerUtils'; -Viewerbase.textMarkerUtils = textMarkerUtils; - -// createStacks.* -import { createStacks } from './lib/createStacks'; -Viewerbase.createStacks = createStacks; - - -/** - * Exported Singletons - */ - -// StackManager as "stackManager" (since it's a plain object instance, the exported name starts with a lowercase letter) -import { StackManager } from './lib/StackManager'; -Viewerbase.stackManager = StackManager; - -// toolManager -import { toolManager } from './lib/toolManager'; -Viewerbase.toolManager = toolManager; - -/** - * Exported Helpers - */ - -import { helpers } from './lib/helpers/'; -Viewerbase.helpers = helpers; - -/** - * Exported Collections - */ - -// sopClassDictionary -import { sopClassDictionary } from './lib/sopClassDictionary'; -Viewerbase.sopClassDictionary = sopClassDictionary; - -// dicomTagDescriptions -import { DICOMTagDescriptions } from './lib/DICOMTagDescriptions'; -Viewerbase.DICOMTagDescriptions = DICOMTagDescriptions; - -/** - * Exported Classes - */ - -// ImageSet -import { ImageSet } from './lib/classes/ImageSet'; -Viewerbase.ImageSet = ImageSet; - -// LayoutManager -import { LayoutManager } from './lib/classes/LayoutManager'; -Viewerbase.LayoutManager = LayoutManager; - -// StudyPrefetcher -import { StudyPrefetcher } from './lib/classes/StudyPrefetcher'; -Viewerbase.StudyPrefetcher = StudyPrefetcher; - -// ResizeViewportManager -import { ResizeViewportManager } from './lib/classes/ResizeViewportManager'; -Viewerbase.ResizeViewportManager = ResizeViewportManager; - -// StudyLoadingListener -import { StudyLoadingListener } from './lib/classes/StudyLoadingListener'; -Viewerbase.StudyLoadingListener = StudyLoadingListener; - -// StackLoadingListener -import { StackLoadingListener } from './lib/classes/StudyLoadingListener'; -Viewerbase.StackLoadingListener = StackLoadingListener; - -// DICOMFileLoadingListener -import { DICOMFileLoadingListener } from './lib/classes/StudyLoadingListener'; -Viewerbase.DICOMFileLoadingListener = DICOMFileLoadingListener; - -// StudyMetadata, SeriesMetadata, InstanceMetadata -import { StudyMetadata } from './lib/classes/metadata/StudyMetadata'; -import { SeriesMetadata } from './lib/classes/metadata/SeriesMetadata'; -import { InstanceMetadata } from './lib/classes/metadata/InstanceMetadata'; -import { StudySummary } from './lib/classes/metadata/StudySummary'; -Viewerbase.metadata = { StudyMetadata, SeriesMetadata, InstanceMetadata, StudySummary }; - -import { plugins } from './lib/classes/plugins/'; -Viewerbase.plugins = plugins; - -// TypeSafeCollection -import { TypeSafeCollection } from './lib/classes/TypeSafeCollection'; -Viewerbase.TypeSafeCollection = TypeSafeCollection; - -// OHIFError -import { OHIFError } from './lib/classes/OHIFError'; -Viewerbase.OHIFError = OHIFError; - -// StackImagePositionOffsetSynchronizer -import { StackImagePositionOffsetSynchronizer } from './lib/classes/StackImagePositionOffsetSynchronizer'; -Viewerbase.StackImagePositionOffsetSynchronizer = StackImagePositionOffsetSynchronizer; - -// StudyMetadataSource -import { StudyMetadataSource } from './lib/classes/StudyMetadataSource'; -Viewerbase.StudyMetadataSource = StudyMetadataSource; diff --git a/Packages/ohif-viewerbase/client/lib/DICOMTagDescriptions.js b/Packages/ohif-viewerbase/client/lib/DICOMTagDescriptions.js deleted file mode 100644 index 507b109b6..000000000 --- a/Packages/ohif-viewerbase/client/lib/DICOMTagDescriptions.js +++ /dev/null @@ -1,3260 +0,0 @@ - -const NUMBER = 'number'; -const STRING = 'string'; -const REGEX_TAG = /^x[0-9a-fx]{8}$/; - -const DICOMTagDescriptions = Object.create(Object.prototype, { - _descriptions: { - configurable: false, - enumerable: false, - writable: false, - value: Object.create(null) - }, - tagNumberToString: { - configurable: false, - enumerable: true, - writable: false, - value: function tagNumberToString(tag) { - let string; // by default, undefined is returned... - if (this.isValidTagNumber(tag)) { - // if it's a number, build its hexadecimal representation... - string = 'x' + ('00000000' + tag.toString(16)).substr(-8); - } - return string; - } - }, - isValidTagNumber: { - configurable: false, - enumerable: true, - writable: false, - value: function isValidTagNumber(tag) { - return (typeof tag === NUMBER && tag >= 0 && tag <= 0xFFFFFFFF); - } - }, - isValidTag: { - configurable: false, - enumerable: true, - writable: false, - value: function isValidTag(tag) { - return (typeof tag === STRING ? REGEX_TAG.test(tag) : this.isValidTagNumber(tag)); - } - }, - find: { - configurable: false, - enumerable: true, - writable: false, - value: function find(name) { - let description; // by default, undefined is returned... - if (typeof name !== STRING) { - // if it's a number, a tag string will be returned... - name = this.tagNumberToString(name); - } - if (typeof name === STRING) { - description = this._descriptions[name]; - } - return description; - } - }, - init: { - configurable: false, - enumerable: true, - writable: false, - value: function init(descriptionMap) { - const _hasOwn = Object.prototype.hasOwnProperty; - const _descriptions = this._descriptions; - for (let tag in descriptionMap) { - if (_hasOwn.call(descriptionMap, tag)) { - if (!this.isValidTag(tag)) { - // Skip in case tag is not valid... - console.info(`DICOMTagDescriptions: Invalid tag "${tag}"...`); - continue; - } - if (tag in _descriptions) { - // Skip in case the tag is duplicated... - console.info(`DICOMTagDescriptions: Duplicated tag "${tag}"...`); - continue; - } - // Save keyword... - const keyword = descriptionMap[tag]; - // Create a description entry and freeze it... - const entry = Object.create(null); - entry.tag = tag; - entry.keyword = keyword; - Object.freeze(entry); - // Add tag references to entry... - _descriptions[tag] = entry; - // Add keyword references to entry (if not present already)... - if (keyword in _descriptions) { - const currentEntry = _descriptions[keyword]; - console.info(`DICOMTagDescriptions: Using <${currentEntry.tag},${currentEntry.keyword}> instead of <${entry.tag},${entry.keyword}> for keyword "${keyword}"...`); - } else { - _descriptions[keyword] = entry; - } - } - } - // Freeze internal description map... - Object.freeze(_descriptions); - // Freeze itself... - Object.freeze(this); - } - }, -}); - -/** - * Map with DICOM Tag Descriptions - */ -let initialTagDescriptionMap = { - x00020000: 'FileMetaInfoGroupLength', - x00020001: 'FileMetaInfoVersion', - x00020002: 'MediaStorageSOPClassUID', - x00020003: 'MediaStorageSOPInstanceUID', - x00020010: 'TransferSyntaxUID', - x00020012: 'ImplementationClassUID', - x00020013: 'ImplementationVersionName', - x00020016: 'SourceApplicationEntityTitle', - x00020100: 'PrivateInformationCreatorUID', - x00020102: 'PrivateInformation', - x00041130: 'FileSetID', - x00041141: 'FileSetDescriptorFileID', - x00041142: 'SpecificCharacterSetOfFile', - x00041200: 'FirstDirectoryRecordOffset', - x00041202: 'LastDirectoryRecordOffset', - x00041212: 'FileSetConsistencyFlag', - x00041220: 'DirectoryRecordSequence', - x00041400: 'OffsetOfNextDirectoryRecord', - x00041410: 'RecordInUseFlag', - x00041420: 'LowerLevelDirectoryEntityOffset', - x00041430: 'DirectoryRecordType', - x00041432: 'PrivateRecordUID', - x00041500: 'ReferencedFileID', - x00041504: 'MRDRDirectoryRecordOffset', - x00041510: 'ReferencedSOPClassUIDInFile', - x00041511: 'ReferencedSOPInstanceUIDInFile', - x00041512: 'ReferencedTransferSyntaxUIDInFile', - x0004151a: 'ReferencedRelatedSOPClassUIDInFile', - x00041600: 'NumberOfReferences', - x00080000: 'IdentifyingGroupLength', - x00080001: 'LengthToEnd', - x00080005: 'SpecificCharacterSet', - x00080006: 'LanguageCodeSequence', - x00080008: 'ImageType', - x00080010: 'RecognitionCode', - x00080012: 'InstanceCreationDate', - x00080013: 'InstanceCreationTime', - x00080014: 'InstanceCreatorUID', - x00080016: 'SOPClassUID', - x00080018: 'SOPInstanceUID', - x0008001a: 'RelatedGeneralSOPClassUID', - x0008001b: 'OriginalSpecializedSOPClassUID', - x00080020: 'StudyDate', - x00080021: 'SeriesDate', - x00080022: 'AcquisitionDate', - x00080023: 'ContentDate', - x00080024: 'OverlayDate', - x00080025: 'CurveDate', - x0008002a: 'AcquisitionDateTime', - x00080030: 'StudyTime', - x00080031: 'SeriesTime', - x00080032: 'AcquisitionTime', - x00080033: 'ContentTime', - x00080034: 'OverlayTime', - x00080035: 'CurveTime', - x00080040: 'DataSetType', - x00080041: 'DataSetSubtype', - x00080042: 'NuclearMedicineSeriesType', - x00080050: 'AccessionNumber', - x00080052: 'QueryRetrieveLevel', - x00080054: 'RetrieveAETitle', - x00080056: 'InstanceAvailability', - x00080058: 'FailedSOPInstanceUIDList', - x00080060: 'Modality', - x00080061: 'ModalitiesInStudy', - x00080062: 'SOPClassesInStudy', - x00080064: 'ConversionType', - x00080068: 'PresentationIntentType', - x00080070: 'Manufacturer', - x00080080: 'InstitutionName', - x00080081: 'InstitutionAddress', - x00080082: 'InstitutionCodeSequence', - x00080090: 'ReferringPhysicianName', - x00080092: 'ReferringPhysicianAddress', - x00080094: 'ReferringPhysicianTelephoneNumber', - x00080096: 'ReferringPhysicianIDSequence', - x00080100: 'CodeValue', - x00080102: 'CodingSchemeDesignator', - x00080103: 'CodingSchemeVersion', - x00080104: 'CodeMeaning', - x00080105: 'MappingResource', - x00080106: 'ContextGroupVersion', - x00080107: 'ContextGroupLocalVersion', - x0008010b: 'ContextGroupExtensionFlag', - x0008010c: 'CodingSchemeUID', - x0008010d: 'ContextGroupExtensionCreatorUID', - x0008010f: 'ContextIdentifier', - x00080110: 'CodingSchemeIDSequence', - x00080112: 'CodingSchemeRegistry', - x00080114: 'CodingSchemeExternalID', - x00080115: 'CodingSchemeName', - x00080116: 'CodingSchemeResponsibleOrganization', - x00080117: 'ContextUID', - x00080201: 'TimezoneOffsetFromUTC', - x00081000: 'NetworkID', - x00081010: 'StationName', - x00081030: 'StudyDescription', - x00081032: 'ProcedureCodeSequence', - x0008103e: 'SeriesDescription', - x00081040: 'InstitutionalDepartmentName', - x00081048: 'PhysiciansOfRecord', - x00081049: 'PhysiciansOfRecordIDSequence', - x00081050: 'PerformingPhysicianName', - x00081052: 'PerformingPhysicianIDSequence', - x00081060: 'NameOfPhysicianReadingStudy', - x00081062: 'PhysicianReadingStudyIDSequence', - x00081070: 'OperatorsName', - x00081072: 'OperatorIDSequence', - x00081080: 'AdmittingDiagnosesDescription', - x00081084: 'AdmittingDiagnosesCodeSequence', - x00081090: 'ManufacturersModelName', - x00081100: 'ReferencedResultsSequence', - x00081110: 'ReferencedStudySequence', - x00081111: 'ReferencedPerformedProcedureStepSequence', - x00081115: 'ReferencedSeriesSequence', - x00081120: 'ReferencedPatientSequence', - x00081125: 'ReferencedVisitSequence', - x00081130: 'ReferencedOverlaySequence', - x0008113a: 'ReferencedWaveformSequence', - x00081140: 'ReferencedImageSequence', - x00081145: 'ReferencedCurveSequence', - x0008114a: 'ReferencedInstanceSequence', - x00081150: 'ReferencedSOPClassUID', - x00081155: 'ReferencedSOPInstanceUID', - x0008115a: 'SOPClassesSupported', - x00081160: 'ReferencedFrameNumber', - x00081161: 'SimpleFrameList', - x00081162: 'CalculatedFrameList', - x00081163: 'TimeRange', - x00081164: 'FrameExtractionSequence', - x00081195: 'TransactionUID', - x00081197: 'FailureReason', - x00081198: 'FailedSOPSequence', - x00081199: 'ReferencedSOPSequence', - x00081200: 'OtherReferencedStudiesSequence', - x00081250: 'RelatedSeriesSequence', - x00082110: 'LossyImageCompressionRetired', - x00082111: 'DerivationDescription', - x00082112: 'SourceImageSequence', - x00082120: 'StageName', - x00082122: 'StageNumber', - x00082124: 'NumberOfStages', - x00082127: 'ViewName', - x00082128: 'ViewNumber', - x00082129: 'NumberOfEventTimers', - x0008212a: 'NumberOfViewsInStage', - x00082130: 'EventElapsedTimes', - x00082132: 'EventTimerNames', - x00082133: 'EventTimerSequence', - x00082134: 'EventTimeOffset', - x00082135: 'EventCodeSequence', - x00082142: 'StartTrim', - x00082143: 'StopTrim', - x00082144: 'RecommendedDisplayFrameRate', - x00082200: 'TransducerPosition', - x00082204: 'TransducerOrientation', - x00082208: 'AnatomicStructure', - x00082218: 'AnatomicRegionSequence', - x00082220: 'AnatomicRegionModifierSequence', - x00082228: 'PrimaryAnatomicStructureSequence', - x00082229: 'AnatomicStructureOrRegionSequence', - x00082230: 'AnatomicStructureModifierSequence', - x00082240: 'TransducerPositionSequence', - x00082242: 'TransducerPositionModifierSequence', - x00082244: 'TransducerOrientationSequence', - x00082246: 'TransducerOrientationModifierSeq', - x00082253: 'AnatomicEntrancePortalCodeSeqTrial', - x00082255: 'AnatomicApproachDirCodeSeqTrial', - x00082256: 'AnatomicPerspectiveDescrTrial', - x00082257: 'AnatomicPerspectiveCodeSeqTrial', - x00083001: 'AlternateRepresentationSequence', - x00083010: 'IrradiationEventUID', - x00084000: 'IdentifyingComments', - x00089007: 'FrameType', - x00089092: 'ReferencedImageEvidenceSequence', - x00089121: 'ReferencedRawDataSequence', - x00089123: 'CreatorVersionUID', - x00089124: 'DerivationImageSequence', - x00089154: 'SourceImageEvidenceSequence', - x00089205: 'PixelPresentation', - x00089206: 'VolumetricProperties', - x00089207: 'VolumeBasedCalculationTechnique', - x00089208: 'ComplexImageComponent', - x00089209: 'AcquisitionContrast', - x00089215: 'DerivationCodeSequence', - x00089237: 'GrayscalePresentationStateSequence', - x00089410: 'ReferencedOtherPlaneSequence', - x00089458: 'FrameDisplaySequence', - x00089459: 'RecommendedDisplayFrameRateInFloat', - x00089460: 'SkipFrameRangeFlag', - // x00091001: 'FullFidelity', - // x00091002: 'SuiteID', - // x00091004: 'ProductID', - // x00091027: 'ImageActualDate', - // x00091030: 'ServiceID', - // x00091031: 'MobileLocationNumber', - // x000910e3: 'EquipmentUID', - // x000910e6: 'GenesisVersionNow', - // x000910e7: 'ExamRecordChecksum', - // x000910e9: 'ActualSeriesDataTimeStamp', - x00100000: 'PatientGroupLength', - x00100010: 'PatientName', - x00100020: 'PatientID', - x00100021: 'IssuerOfPatientID', - x00100022: 'TypeOfPatientID', - x00100030: 'PatientBirthDate', - x00100032: 'PatientBirthTime', - x00100040: 'PatientSex', - x00100050: 'PatientInsurancePlanCodeSequence', - x00100101: 'PatientPrimaryLanguageCodeSeq', - x00100102: 'PatientPrimaryLanguageCodeModSeq', - x00101000: 'OtherPatientIDs', - x00101001: 'OtherPatientNames', - x00101002: 'OtherPatientIDsSequence', - x00101005: 'PatientBirthName', - x00101010: 'PatientAge', - x00101020: 'PatientSize', - x00101030: 'PatientWeight', - x00101040: 'PatientAddress', - x00101050: 'InsurancePlanIdentification', - x00101060: 'PatientMotherBirthName', - x00101080: 'MilitaryRank', - x00101081: 'BranchOfService', - x00101090: 'MedicalRecordLocator', - x00102000: 'MedicalAlerts', - x00102110: 'Allergies', - x00102150: 'CountryOfResidence', - x00102152: 'RegionOfResidence', - x00102154: 'PatientTelephoneNumbers', - x00102160: 'EthnicGroup', - x00102180: 'Occupation', - x001021a0: 'SmokingStatus', - x001021b0: 'AdditionalPatientHistory', - x001021c0: 'PregnancyStatus', - x001021d0: 'LastMenstrualDate', - x001021f0: 'PatientReligiousPreference', - x00102201: 'PatientSpeciesDescription', - x00102202: 'PatientSpeciesCodeSequence', - x00102203: 'PatientSexNeutered', - x00102210: 'AnatomicalOrientationType', - x00102292: 'PatientBreedDescription', - x00102293: 'PatientBreedCodeSequence', - x00102294: 'BreedRegistrationSequence', - x00102295: 'BreedRegistrationNumber', - x00102296: 'BreedRegistryCodeSequence', - x00102297: 'ResponsiblePerson', - x00102298: 'ResponsiblePersonRole', - x00102299: 'ResponsibleOrganization', - x00104000: 'PatientComments', - x00109431: 'ExaminedBodyThickness', - x00111010: 'PatientStatus', - x00120010: 'ClinicalTrialSponsorName', - x00120020: 'ClinicalTrialProtocolID', - x00120021: 'ClinicalTrialProtocolName', - x00120030: 'ClinicalTrialSiteID', - x00120031: 'ClinicalTrialSiteName', - x00120040: 'ClinicalTrialSubjectID', - x00120042: 'ClinicalTrialSubjectReadingID', - x00120050: 'ClinicalTrialTimePointID', - x00120051: 'ClinicalTrialTimePointDescription', - x00120060: 'ClinicalTrialCoordinatingCenter', - x00120062: 'PatientIdentityRemoved', - x00120063: 'DeidentificationMethod', - x00120064: 'DeidentificationMethodCodeSequence', - x00120071: 'ClinicalTrialSeriesID', - x00120072: 'ClinicalTrialSeriesDescription', - x00120084: 'DistributionType', - x00120085: 'ConsentForDistributionFlag', - x00180000: 'AcquisitionGroupLength', - x00180010: 'ContrastBolusAgent', - x00180012: 'ContrastBolusAgentSequence', - x00180014: 'ContrastBolusAdministrationRoute', - x00180015: 'BodyPartExamined', - x00180020: 'ScanningSequence', - x00180021: 'SequenceVariant', - x00180022: 'ScanOptions', - x00180023: 'MRAcquisitionType', - x00180024: 'SequenceName', - x00180025: 'AngioFlag', - x00180026: 'InterventionDrugInformationSeq', - x00180027: 'InterventionDrugStopTime', - x00180028: 'InterventionDrugDose', - x00180029: 'InterventionDrugSequence', - x0018002a: 'AdditionalDrugSequence', - x00180030: 'Radionuclide', - x00180031: 'Radiopharmaceutical', - x00180032: 'EnergyWindowCenterline', - x00180033: 'EnergyWindowTotalWidth', - x00180034: 'InterventionDrugName', - x00180035: 'InterventionDrugStartTime', - x00180036: 'InterventionSequence', - x00180037: 'TherapyType', - x00180038: 'InterventionStatus', - x00180039: 'TherapyDescription', - x0018003a: 'InterventionDescription', - x00180040: 'CineRate', - x00180042: 'InitialCineRunState', - x00180050: 'SliceThickness', - x00180060: 'KVP', - x00180070: 'CountsAccumulated', - x00180071: 'AcquisitionTerminationCondition', - x00180072: 'EffectiveDuration', - x00180073: 'AcquisitionStartCondition', - x00180074: 'AcquisitionStartConditionData', - x00180075: 'AcquisitionEndConditionData', - x00180080: 'RepetitionTime', - x00180081: 'EchoTime', - x00180082: 'InversionTime', - x00180083: 'NumberOfAverages', - x00180084: 'ImagingFrequency', - x00180085: 'ImagedNucleus', - x00180086: 'EchoNumber', - x00180087: 'MagneticFieldStrength', - x00180088: 'SpacingBetweenSlices', - x00180089: 'NumberOfPhaseEncodingSteps', - x00180090: 'DataCollectionDiameter', - x00180091: 'EchoTrainLength', - x00180093: 'PercentSampling', - x00180094: 'PercentPhaseFieldOfView', - x00180095: 'PixelBandwidth', - x00181000: 'DeviceSerialNumber', - x00181002: 'DeviceUID', - x00181003: 'DeviceID', - x00181004: 'PlateID', - x00181005: 'GeneratorID', - x00181006: 'GridID', - x00181007: 'CassetteID', - x00181008: 'GantryID', - x00181010: 'SecondaryCaptureDeviceID', - x00181011: 'HardcopyCreationDeviceID', - x00181012: 'DateOfSecondaryCapture', - x00181014: 'TimeOfSecondaryCapture', - x00181016: 'SecondaryCaptureDeviceManufacturer', - x00181017: 'HardcopyDeviceManufacturer', - x00181018: 'SecondaryCaptureDeviceModelName', - x00181019: 'SecondaryCaptureDeviceSoftwareVers', - x0018101a: 'HardcopyDeviceSoftwareVersion', - x0018101b: 'HardcopyDeviceModelName', - x00181020: 'SoftwareVersion', - x00181022: 'VideoImageFormatAcquired', - x00181023: 'DigitalImageFormatAcquired', - x00181030: 'ProtocolName', - x00181040: 'ContrastBolusRoute', - x00181041: 'ContrastBolusVolume', - x00181042: 'ContrastBolusStartTime', - x00181043: 'ContrastBolusStopTime', - x00181044: 'ContrastBolusTotalDose', - x00181045: 'SyringeCounts', - x00181046: 'ContrastFlowRate', - x00181047: 'ContrastFlowDuration', - x00181048: 'ContrastBolusIngredient', - x00181049: 'ContrastBolusConcentration', - x00181050: 'SpatialResolution', - x00181060: 'TriggerTime', - x00181061: 'TriggerSourceOrType', - x00181062: 'NominalInterval', - x00181063: 'FrameTime', - x00181064: 'CardiacFramingType', - x00181065: 'FrameTimeVector', - x00181066: 'FrameDelay', - x00181067: 'ImageTriggerDelay', - x00181068: 'MultiplexGroupTimeOffset', - x00181069: 'TriggerTimeOffset', - x0018106a: 'SynchronizationTrigger', - x0018106c: 'SynchronizationChannel', - x0018106e: 'TriggerSamplePosition', - x00181070: 'RadiopharmaceuticalRoute', - x00181071: 'RadiopharmaceuticalVolume', - x00181072: 'RadiopharmaceuticalStartTime', - x00181073: 'RadiopharmaceuticalStopTime', - x00181074: 'RadionuclideTotalDose', - x00181075: 'RadionuclideHalfLife', - x00181076: 'RadionuclidePositronFraction', - x00181077: 'RadiopharmaceuticalSpecActivity', - x00181078: 'RadiopharmaceuticalStartDateTime', - x00181079: 'RadiopharmaceuticalStopDateTime', - x00181080: 'BeatRejectionFlag', - x00181081: 'LowRRValue', - x00181082: 'HighRRValue', - x00181083: 'IntervalsAcquired', - x00181084: 'IntervalsRejected', - x00181085: 'PVCRejection', - x00181086: 'SkipBeats', - x00181088: 'HeartRate', - x00181090: 'CardiacNumberOfImages', - x00181094: 'TriggerWindow', - x00181100: 'ReconstructionDiameter', - x00181110: 'DistanceSourceToDetector', - x00181111: 'DistanceSourceToPatient', - x00181114: 'EstimatedRadiographicMagnification', - x00181120: 'GantryDetectorTilt', - x00181121: 'GantryDetectorSlew', - x00181130: 'TableHeight', - x00181131: 'TableTraverse', - x00181134: 'TableMotion', - x00181135: 'TableVerticalIncrement', - x00181136: 'TableLateralIncrement', - x00181137: 'TableLongitudinalIncrement', - x00181138: 'TableAngle', - x0018113a: 'TableType', - x00181140: 'RotationDirection', - x00181141: 'AngularPosition', - x00181142: 'RadialPosition', - x00181143: 'ScanArc', - x00181144: 'AngularStep', - x00181145: 'CenterOfRotationOffset', - x00181146: 'RotationOffset', - x00181147: 'FieldOfViewShape', - x00181149: 'FieldOfViewDimensions', - x00181150: 'ExposureTime', - x00181151: 'XRayTubeCurrent', - x00181152: 'Exposure', - x00181153: 'ExposureInMicroAmpSec', - x00181154: 'AveragePulseWidth', - x00181155: 'RadiationSetting', - x00181156: 'RectificationType', - x0018115a: 'RadiationMode', - x0018115e: 'ImageAreaDoseProduct', - x00181160: 'FilterType', - x00181161: 'TypeOfFilters', - x00181162: 'IntensifierSize', - x00181164: 'ImagerPixelSpacing', - x00181166: 'Grid', - x00181170: 'GeneratorPower', - x00181180: 'CollimatorGridName', - x00181181: 'CollimatorType', - x00181182: 'FocalDistance', - x00181183: 'XFocusCenter', - x00181184: 'YFocusCenter', - x00181190: 'FocalSpots', - x00181191: 'AnodeTargetMaterial', - x001811a0: 'BodyPartThickness', - x001811a2: 'CompressionForce', - x00181200: 'DateOfLastCalibration', - x00181201: 'TimeOfLastCalibration', - x00181210: 'ConvolutionKernel', - x00181240: 'UpperLowerPixelValues', - x00181242: 'ActualFrameDuration', - x00181243: 'CountRate', - x00181244: 'PreferredPlaybackSequencing', - x00181250: 'ReceiveCoilName', - x00181251: 'TransmitCoilName', - x00181260: 'PlateType', - x00181261: 'PhosphorType', - x00181300: 'ScanVelocity', - x00181301: 'WholeBodyTechnique', - x00181302: 'ScanLength', - x00181310: 'AcquisitionMatrix', - x00181312: 'InPlanePhaseEncodingDirection', - x00181314: 'FlipAngle', - x00181315: 'VariableFlipAngleFlag', - x00181316: 'SAR', - x00181318: 'DB-Dt', - x00181400: 'AcquisitionDeviceProcessingDescr', - x00181401: 'AcquisitionDeviceProcessingCode', - x00181402: 'CassetteOrientation', - x00181403: 'CassetteSize', - x00181404: 'ExposuresOnPlate', - x00181405: 'RelativeXRayExposure', - x00181450: 'ColumnAngulation', - x00181460: 'TomoLayerHeight', - x00181470: 'TomoAngle', - x00181480: 'TomoTime', - x00181490: 'TomoType', - x00181491: 'TomoClass', - x00181495: 'NumberOfTomosynthesisSourceImages', - x00181500: 'PositionerMotion', - x00181508: 'PositionerType', - x00181510: 'PositionerPrimaryAngle', - x00181511: 'PositionerSecondaryAngle', - x00181520: 'PositionerPrimaryAngleIncrement', - x00181521: 'PositionerSecondaryAngleIncrement', - x00181530: 'DetectorPrimaryAngle', - x00181531: 'DetectorSecondaryAngle', - x00181600: 'ShutterShape', - x00181602: 'ShutterLeftVerticalEdge', - x00181604: 'ShutterRightVerticalEdge', - x00181606: 'ShutterUpperHorizontalEdge', - x00181608: 'ShutterLowerHorizontalEdge', - x00181610: 'CenterOfCircularShutter', - x00181612: 'RadiusOfCircularShutter', - x00181620: 'VerticesOfPolygonalShutter', - x00181622: 'ShutterPresentationValue', - x00181623: 'ShutterOverlayGroup', - x00181624: 'ShutterPresentationColorCIELabVal', - x00181700: 'CollimatorShape', - x00181702: 'CollimatorLeftVerticalEdge', - x00181704: 'CollimatorRightVerticalEdge', - x00181706: 'CollimatorUpperHorizontalEdge', - x00181708: 'CollimatorLowerHorizontalEdge', - x00181710: 'CenterOfCircularCollimator', - x00181712: 'RadiusOfCircularCollimator', - x00181720: 'VerticesOfPolygonalCollimator', - x00181800: 'AcquisitionTimeSynchronized', - x00181801: 'TimeSource', - x00181802: 'TimeDistributionProtocol', - x00181803: 'NTPSourceAddress', - x00182001: 'PageNumberVector', - x00182002: 'FrameLabelVector', - x00182003: 'FramePrimaryAngleVector', - x00182004: 'FrameSecondaryAngleVector', - x00182005: 'SliceLocationVector', - x00182006: 'DisplayWindowLabelVector', - x00182010: 'NominalScannedPixelSpacing', - x00182020: 'DigitizingDeviceTransportDirection', - x00182030: 'RotationOfScannedFilm', - x00183100: 'IVUSAcquisition', - x00183101: 'IVUSPullbackRate', - x00183102: 'IVUSGatedRate', - x00183103: 'IVUSPullbackStartFrameNumber', - x00183104: 'IVUSPullbackStopFrameNumber', - x00183105: 'LesionNumber', - x00184000: 'AcquisitionComments', - x00185000: 'OutputPower', - x00185010: 'TransducerData', - x00185012: 'FocusDepth', - x00185020: 'ProcessingFunction', - x00185021: 'PostprocessingFunction', - x00185022: 'MechanicalIndex', - x00185024: 'BoneThermalIndex', - x00185026: 'CranialThermalIndex', - x00185027: 'SoftTissueThermalIndex', - x00185028: 'SoftTissueFocusThermalIndex', - x00185029: 'SoftTissueSurfaceThermalIndex', - x00185030: 'DynamicRange', - x00185040: 'TotalGain', - x00185050: 'DepthOfScanField', - x00185100: 'PatientPosition', - x00185101: 'ViewPosition', - x00185104: 'ProjectionEponymousNameCodeSeq', - x00185210: 'ImageTransformationMatrix', - x00185212: 'ImageTranslationVector', - x00186000: 'Sensitivity', - x00186011: 'SequenceOfUltrasoundRegions', - x00186012: 'RegionSpatialFormat', - x00186014: 'RegionDataType', - x00186016: 'RegionFlags', - x00186018: 'RegionLocationMinX0', - x0018601a: 'RegionLocationMinY0', - x0018601c: 'RegionLocationMaxX1', - x0018601e: 'RegionLocationMaxY1', - x00186020: 'ReferencePixelX0', - x00186022: 'ReferencePixelY0', - x00186024: 'PhysicalUnitsXDirection', - x00186026: 'PhysicalUnitsYDirection', - x00186028: 'ReferencePixelPhysicalValueX', - x0018602a: 'ReferencePixelPhysicalValueY', - x0018602c: 'PhysicalDeltaX', - x0018602e: 'PhysicalDeltaY', - x00186030: 'TransducerFrequency', - x00186031: 'TransducerType', - x00186032: 'PulseRepetitionFrequency', - x00186034: 'DopplerCorrectionAngle', - x00186036: 'SteeringAngle', - x00186038: 'DopplerSampleVolumeXPosRetired', - x00186039: 'DopplerSampleVolumeXPosition', - x0018603a: 'DopplerSampleVolumeYPosRetired', - x0018603b: 'DopplerSampleVolumeYPosition', - x0018603c: 'TMLinePositionX0Retired', - x0018603d: 'TMLinePositionX0', - x0018603e: 'TMLinePositionY0Retired', - x0018603f: 'TMLinePositionY0', - x00186040: 'TMLinePositionX1Retired', - x00186041: 'TMLinePositionX1', - x00186042: 'TMLinePositionY1Retired', - x00186043: 'TMLinePositionY1', - x00186044: 'PixelComponentOrganization', - x00186046: 'PixelComponentMask', - x00186048: 'PixelComponentRangeStart', - x0018604a: 'PixelComponentRangeStop', - x0018604c: 'PixelComponentPhysicalUnits', - x0018604e: 'PixelComponentDataType', - x00186050: 'NumberOfTableBreakPoints', - x00186052: 'TableOfXBreakPoints', - x00186054: 'TableOfYBreakPoints', - x00186056: 'NumberOfTableEntries', - x00186058: 'TableOfPixelValues', - x0018605a: 'TableOfParameterValues', - x00186060: 'RWaveTimeVector', - x00187000: 'DetectorConditionsNominalFlag', - x00187001: 'DetectorTemperature', - x00187004: 'DetectorType', - x00187005: 'DetectorConfiguration', - x00187006: 'DetectorDescription', - x00187008: 'DetectorMode', - x0018700a: 'DetectorID', - x0018700c: 'DateOfLastDetectorCalibration', - x0018700e: 'TimeOfLastDetectorCalibration', - x00187010: 'DetectorExposuresSinceCalibration', - x00187011: 'DetectorExposuresSinceManufactured', - x00187012: 'DetectorTimeSinceLastExposure', - x00187014: 'DetectorActiveTime', - x00187016: 'DetectorActiveOffsetFromExposure', - x0018701a: 'DetectorBinning', - x00187020: 'DetectorElementPhysicalSize', - x00187022: 'DetectorElementSpacing', - x00187024: 'DetectorActiveShape', - x00187026: 'DetectorActiveDimensions', - x00187028: 'DetectorActiveOrigin', - x0018702a: 'DetectorManufacturerName', - x0018702b: 'DetectorManufacturersModelName', - x00187030: 'FieldOfViewOrigin', - x00187032: 'FieldOfViewRotation', - x00187034: 'FieldOfViewHorizontalFlip', - x00187040: 'GridAbsorbingMaterial', - x00187041: 'GridSpacingMaterial', - x00187042: 'GridThickness', - x00187044: 'GridPitch', - x00187046: 'GridAspectRatio', - x00187048: 'GridPeriod', - x0018704c: 'GridFocalDistance', - x00187050: 'FilterMaterial', - x00187052: 'FilterThicknessMinimum', - x00187054: 'FilterThicknessMaximum', - x00187060: 'ExposureControlMode', - x00187062: 'ExposureControlModeDescription', - x00187064: 'ExposureStatus', - x00187065: 'PhototimerSetting', - x00188150: 'ExposureTimeInMicroSec', - x00188151: 'XRayTubeCurrentInMicroAmps', - x00189004: 'ContentQualification', - x00189005: 'PulseSequenceName', - x00189006: 'MRImagingModifierSequence', - x00189008: 'EchoPulseSequence', - x00189009: 'InversionRecovery', - x00189010: 'FlowCompensation', - x00189011: 'MultipleSpinEcho', - x00189012: 'MultiPlanarExcitation', - x00189014: 'PhaseContrast', - x00189015: 'TimeOfFlightContrast', - x00189016: 'Spoiling', - x00189017: 'SteadyStatePulseSequence', - x00189018: 'EchoPlanarPulseSequence', - x00189019: 'TagAngleFirstAxis', - x00189020: 'MagnetizationTransfer', - x00189021: 'T2Preparation', - x00189022: 'BloodSignalNulling', - x00189024: 'SaturationRecovery', - x00189025: 'SpectrallySelectedSuppression', - x00189026: 'SpectrallySelectedExcitation', - x00189027: 'SpatialPresaturation', - x00189028: 'Tagging', - x00189029: 'OversamplingPhase', - x00189030: 'TagSpacingFirstDimension', - x00189032: 'GeometryOfKSpaceTraversal', - x00189033: 'SegmentedKSpaceTraversal', - x00189034: 'RectilinearPhaseEncodeReordering', - x00189035: 'TagThickness', - x00189036: 'PartialFourierDirection', - x00189037: 'CardiacSynchronizationTechnique', - x00189041: 'ReceiveCoilManufacturerName', - x00189042: 'MRReceiveCoilSequence', - x00189043: 'ReceiveCoilType', - x00189044: 'QuadratureReceiveCoil', - x00189045: 'MultiCoilDefinitionSequence', - x00189046: 'MultiCoilConfiguration', - x00189047: 'MultiCoilElementName', - x00189048: 'MultiCoilElementUsed', - x00189049: 'MRTransmitCoilSequence', - x00189050: 'TransmitCoilManufacturerName', - x00189051: 'TransmitCoilType', - x00189052: 'SpectralWidth', - x00189053: 'ChemicalShiftReference', - x00189054: 'VolumeLocalizationTechnique', - x00189058: 'MRAcquisitionFrequencyEncodeSteps', - x00189059: 'Decoupling', - x00189060: 'DecoupledNucleus', - x00189061: 'DecouplingFrequency', - x00189062: 'DecouplingMethod', - x00189063: 'DecouplingChemicalShiftReference', - x00189064: 'KSpaceFiltering', - x00189065: 'TimeDomainFiltering', - x00189066: 'NumberOfZeroFills', - x00189067: 'BaselineCorrection', - x00189069: 'ParallelReductionFactorInPlane', - x00189070: 'CardiacRRIntervalSpecified', - x00189073: 'AcquisitionDuration', - x00189074: 'FrameAcquisitionDateTime', - x00189075: 'DiffusionDirectionality', - x00189076: 'DiffusionGradientDirectionSequence', - x00189077: 'ParallelAcquisition', - x00189078: 'ParallelAcquisitionTechnique', - x00189079: 'InversionTimes', - x00189080: 'MetaboliteMapDescription', - x00189081: 'PartialFourier', - x00189082: 'EffectiveEchoTime', - x00189083: 'MetaboliteMapCodeSequence', - x00189084: 'ChemicalShiftSequence', - x00189085: 'CardiacSignalSource', - x00189087: 'DiffusionBValue', - x00189089: 'DiffusionGradientOrientation', - x00189090: 'VelocityEncodingDirection', - x00189091: 'VelocityEncodingMinimumValue', - x00189093: 'NumberOfKSpaceTrajectories', - x00189094: 'CoverageOfKSpace', - x00189095: 'SpectroscopyAcquisitionPhaseRows', - x00189096: 'ParallelReductFactorInPlaneRetired', - x00189098: 'TransmitterFrequency', - x00189100: 'ResonantNucleus', - x00189101: 'FrequencyCorrection', - x00189103: 'MRSpectroscopyFOV-GeometrySequence', - x00189104: 'SlabThickness', - x00189105: 'SlabOrientation', - x00189106: 'MidSlabPosition', - x00189107: 'MRSpatialSaturationSequence', - x00189112: 'MRTimingAndRelatedParametersSeq', - x00189114: 'MREchoSequence', - x00189115: 'MRModifierSequence', - x00189117: 'MRDiffusionSequence', - x00189118: 'CardiacTriggerSequence', - x00189119: 'MRAveragesSequence', - x00189125: 'MRFOV-GeometrySequence', - x00189126: 'VolumeLocalizationSequence', - x00189127: 'SpectroscopyAcquisitionDataColumns', - x00189147: 'DiffusionAnisotropyType', - x00189151: 'FrameReferenceDateTime', - x00189152: 'MRMetaboliteMapSequence', - x00189155: 'ParallelReductionFactorOutOfPlane', - x00189159: 'SpectroscopyOutOfPlanePhaseSteps', - x00189166: 'BulkMotionStatus', - x00189168: 'ParallelReductionFactSecondInPlane', - x00189169: 'CardiacBeatRejectionTechnique', - x00189170: 'RespiratoryMotionCompTechnique', - x00189171: 'RespiratorySignalSource', - x00189172: 'BulkMotionCompensationTechnique', - x00189173: 'BulkMotionSignalSource', - x00189174: 'ApplicableSafetyStandardAgency', - x00189175: 'ApplicableSafetyStandardDescr', - x00189176: 'OperatingModeSequence', - x00189177: 'OperatingModeType', - x00189178: 'OperatingMode', - x00189179: 'SpecificAbsorptionRateDefinition', - x00189180: 'GradientOutputType', - x00189181: 'SpecificAbsorptionRateValue', - x00189182: 'GradientOutput', - x00189183: 'FlowCompensationDirection', - x00189184: 'TaggingDelay', - x00189185: 'RespiratoryMotionCompTechDescr', - x00189186: 'RespiratorySignalSourceID', - x00189195: 'ChemicalShiftsMinIntegrateLimitHz', - x00189196: 'ChemicalShiftsMaxIntegrateLimitHz', - x00189197: 'MRVelocityEncodingSequence', - x00189198: 'FirstOrderPhaseCorrection', - x00189199: 'WaterReferencedPhaseCorrection', - x00189200: 'MRSpectroscopyAcquisitionType', - x00189214: 'RespiratoryCyclePosition', - x00189217: 'VelocityEncodingMaximumValue', - x00189218: 'TagSpacingSecondDimension', - x00189219: 'TagAngleSecondAxis', - x00189220: 'FrameAcquisitionDuration', - x00189226: 'MRImageFrameTypeSequence', - x00189227: 'MRSpectroscopyFrameTypeSequence', - x00189231: 'MRAcqPhaseEncodingStepsInPlane', - x00189232: 'MRAcqPhaseEncodingStepsOutOfPlane', - x00189234: 'SpectroscopyAcqPhaseColumns', - x00189236: 'CardiacCyclePosition', - x00189239: 'SpecificAbsorptionRateSequence', - x00189240: 'RFEchoTrainLength', - x00189241: 'GradientEchoTrainLength', - x00189295: 'ChemicalShiftsMinIntegrateLimitPPM', - x00189296: 'ChemicalShiftsMaxIntegrateLimitPPM', - x00189301: 'CTAcquisitionTypeSequence', - x00189302: 'AcquisitionType', - x00189303: 'TubeAngle', - x00189304: 'CTAcquisitionDetailsSequence', - x00189305: 'RevolutionTime', - x00189306: 'SingleCollimationWidth', - x00189307: 'TotalCollimationWidth', - x00189308: 'CTTableDynamicsSequence', - x00189309: 'TableSpeed', - x00189310: 'TableFeedPerRotation', - x00189311: 'SpiralPitchFactor', - x00189312: 'CTGeometrySequence', - x00189313: 'DataCollectionCenterPatient', - x00189314: 'CTReconstructionSequence', - x00189315: 'ReconstructionAlgorithm', - x00189316: 'ConvolutionKernelGroup', - x00189317: 'ReconstructionFieldOfView', - x00189318: 'ReconstructionTargetCenterPatient', - x00189319: 'ReconstructionAngle', - x00189320: 'ImageFilter', - x00189321: 'CTExposureSequence', - x00189322: 'ReconstructionPixelSpacing', - x00189323: 'ExposureModulationType', - x00189324: 'EstimatedDoseSaving', - x00189325: 'CTXRayDetailsSequence', - x00189326: 'CTPositionSequence', - x00189327: 'TablePosition', - x00189328: 'ExposureTimeInMilliSec', - x00189329: 'CTImageFrameTypeSequence', - x00189330: 'XRayTubeCurrentInMilliAmps', - x00189332: 'ExposureInMilliAmpSec', - x00189333: 'ConstantVolumeFlag', - x00189334: 'FluoroscopyFlag', - x00189335: 'SourceToDataCollectionCenterDist', - x00189337: 'ContrastBolusAgentNumber', - x00189338: 'ContrastBolusIngredientCodeSeq', - x00189340: 'ContrastAdministrationProfileSeq', - x00189341: 'ContrastBolusUsageSequence', - x00189342: 'ContrastBolusAgentAdministered', - x00189343: 'ContrastBolusAgentDetected', - x00189344: 'ContrastBolusAgentPhase', - x00189345: 'CTDIvol', - x00189346: 'CTDIPhantomTypeCodeSequence', - x00189351: 'CalciumScoringMassFactorPatient', - x00189352: 'CalciumScoringMassFactorDevice', - x00189353: 'EnergyWeightingFactor', - x00189360: 'CTAdditionalXRaySourceSequence', - x00189401: 'ProjectionPixelCalibrationSequence', - x00189402: 'DistanceSourceToIsocenter', - x00189403: 'DistanceObjectToTableTop', - x00189404: 'ObjectPixelSpacingInCenterOfBeam', - x00189405: 'PositionerPositionSequence', - x00189406: 'TablePositionSequence', - x00189407: 'CollimatorShapeSequence', - x00189412: 'XA-XRFFrameCharacteristicsSequence', - x00189417: 'FrameAcquisitionSequence', - x00189420: 'XRayReceptorType', - x00189423: 'AcquisitionProtocolName', - x00189424: 'AcquisitionProtocolDescription', - x00189425: 'ContrastBolusIngredientOpaque', - x00189426: 'DistanceReceptorPlaneToDetHousing', - x00189427: 'IntensifierActiveShape', - x00189428: 'IntensifierActiveDimensions', - x00189429: 'PhysicalDetectorSize', - x00189430: 'PositionOfIsocenterProjection', - x00189432: 'FieldOfViewSequence', - x00189433: 'FieldOfViewDescription', - x00189434: 'ExposureControlSensingRegionsSeq', - x00189435: 'ExposureControlSensingRegionShape', - x00189436: 'ExposureControlSensRegionLeftEdge', - x00189437: 'ExposureControlSensRegionRightEdge', - x00189440: 'CenterOfCircExposControlSensRegion', - x00189441: 'RadiusOfCircExposControlSensRegion', - x00189447: 'ColumnAngulationPatient', - x00189449: 'BeamAngle', - x00189451: 'FrameDetectorParametersSequence', - x00189452: 'CalculatedAnatomyThickness', - x00189455: 'CalibrationSequence', - x00189456: 'ObjectThicknessSequence', - x00189457: 'PlaneIdentification', - x00189461: 'FieldOfViewDimensionsInFloat', - x00189462: 'IsocenterReferenceSystemSequence', - x00189463: 'PositionerIsocenterPrimaryAngle', - x00189464: 'PositionerIsocenterSecondaryAngle', - x00189465: 'PositionerIsocenterDetRotAngle', - x00189466: 'TableXPositionToIsocenter', - x00189467: 'TableYPositionToIsocenter', - x00189468: 'TableZPositionToIsocenter', - x00189469: 'TableHorizontalRotationAngle', - x00189470: 'TableHeadTiltAngle', - x00189471: 'TableCradleTiltAngle', - x00189472: 'FrameDisplayShutterSequence', - x00189473: 'AcquiredImageAreaDoseProduct', - x00189474: 'CArmPositionerTabletopRelationship', - x00189476: 'XRayGeometrySequence', - x00189477: 'IrradiationEventIDSequence', - x00189504: 'XRay3DFrameTypeSequence', - x00189506: 'ContributingSourcesSequence', - x00189507: 'XRay3DAcquisitionSequence', - x00189508: 'PrimaryPositionerScanArc', - x00189509: 'SecondaryPositionerScanArc', - x00189510: 'PrimaryPositionerScanStartAngle', - x00189511: 'SecondaryPositionerScanStartAngle', - x00189514: 'PrimaryPositionerIncrement', - x00189515: 'SecondaryPositionerIncrement', - x00189516: 'StartAcquisitionDateTime', - x00189517: 'EndAcquisitionDateTime', - x00189524: 'ApplicationName', - x00189525: 'ApplicationVersion', - x00189526: 'ApplicationManufacturer', - x00189527: 'AlgorithmType', - x00189528: 'AlgorithmDescription', - x00189530: 'XRay3DReconstructionSequence', - x00189531: 'ReconstructionDescription', - x00189538: 'PerProjectionAcquisitionSequence', - x00189601: 'DiffusionBMatrixSequence', - x00189602: 'DiffusionBValueXX', - x00189603: 'DiffusionBValueXY', - x00189604: 'DiffusionBValueXZ', - x00189605: 'DiffusionBValueYY', - x00189606: 'DiffusionBValueYZ', - x00189607: 'DiffusionBValueZZ', - x00189701: 'DecayCorrectionDateTime', - x00189715: 'StartDensityThreshold', - x00189722: 'TerminationTimeThreshold', - x00189725: 'DetectorGeometry', - x00189727: 'AxialDetectorDimension', - x00189735: 'PETPositionSequence', - x00189739: 'NumberOfIterations', - x00189740: 'NumberOfSubsets', - x00189751: 'PETFrameTypeSequence', - x00189756: 'ReconstructionType', - x00189758: 'DecayCorrected', - x00189759: 'AttenuationCorrected', - x00189760: 'ScatterCorrected', - x00189761: 'DeadTimeCorrected', - x00189762: 'GantryMotionCorrected', - x00189763: 'PatientMotionCorrected', - x00189765: 'RandomsCorrected', - x00189767: 'SensitivityCalibrated', - x00189801: 'DepthsOfFocus', - x00189804: 'ExclusionStartDatetime', - x00189805: 'ExclusionDuration', - x00189807: 'ImageDataTypeSequence', - x00189808: 'DataType', - x0018980b: 'AliasedDataType', - x0018a001: 'ContributingEquipmentSequence', - x0018a002: 'ContributionDateTime', - x0018a003: 'ContributionDescription', - // x00191002: 'NumberOfCellsIInDetector', - // x00191003: 'CellNumberAtTheta', - // x00191004: 'CellSpacing', - // x0019100f: 'HorizFrameOfRef', - // x00191011: 'SeriesContrast', - // x00191012: 'LastPseq', - // x00191013: 'StartNumberForBaseline', - // x00191014: 'EndNumberForBaseline', - // x00191015: 'StartNumberForEnhancedScans', - // x00191016: 'EndNumberForEnhancedScans', - // x00191017: 'SeriesPlane', - // x00191018: 'FirstScanRas', - // x00191019: 'FirstScanLocation', - // x0019101a: 'LastScanRas', - // x0019101b: 'LastScanLoc', - // x0019101e: 'DisplayFieldOfView', - // x00191023: 'TableSpeed', - // x00191024: 'MidScanTime', - // x00191025: 'MidScanFlag', - // x00191026: 'DegreesOfAzimuth', - // x00191027: 'GantryPeriod', - // x0019102a: 'XRayOnPosition', - // x0019102b: 'XRayOffPosition', - // x0019102c: 'NumberOfTriggers', - // x0019102e: 'AngleOfFirstView', - // x0019102f: 'TriggerFrequency', - // x00191039: 'ScanFOVType', - // x00191040: 'StatReconFlag', - // x00191041: 'ComputeType', - // x00191042: 'SegmentNumber', - // x00191043: 'TotalSegmentsRequested', - // x00191044: 'InterscanDelay', - // x00191047: 'ViewCompressionFactor', - // x0019104a: 'TotalNoOfRefChannels', - // x0019104b: 'DataSizeForScanData', - // x00191052: 'ReconPostProcflag', - // x00191057: 'CTWaterNumber', - // x00191058: 'CTBoneNumber', - // x0019105a: 'AcquisitionDuration', - // x0019105e: 'NumberOfChannels', - // x0019105f: 'IncrementBetweenChannels', - // x00191060: 'StartingView', - // x00191061: 'NumberOfViews', - // x00191062: 'IncrementBetweenViews', - // x0019106a: 'DependantOnNoViewsProcessed', - // x0019106b: 'FieldOfViewInDetectorCells', - // x00191070: 'ValueOfBackProjectionButton', - // x00191071: 'SetIfFatqEstimatesWereUsed', - // x00191072: 'ZChanAvgOverViews', - // x00191073: 'AvgOfLeftRefChansOverViews', - // x00191074: 'MaxLeftChanOverViews', - // x00191075: 'AvgOfRightRefChansOverViews', - // x00191076: 'MaxRightChanOverViews', - // x0019107d: 'SecondEcho', - // x0019107e: 'NumberOfEchoes', - // x0019107f: 'TableDelta', - // x00191081: 'Contiguous', - // x00191084: 'PeakSAR', - // x00191085: 'MonitorSAR', - // x00191087: 'CardiacRepetitionTime', - // x00191088: 'ImagesPerCardiacCycle', - // x0019108a: 'ActualReceiveGainAnalog', - // x0019108b: 'ActualReceiveGainDigital', - // x0019108d: 'DelayAfterTrigger', - // x0019108f: 'Swappf', - // x00191090: 'PauseInterval', - // x00191091: 'PulseTime', - // x00191092: 'SliceOffsetOnFreqAxis', - // x00191093: 'CenterFrequency', - // x00191094: 'TransmitGain', - // x00191095: 'AnalogReceiverGain', - // x00191096: 'DigitalReceiverGain', - // x00191097: 'BitmapDefiningCVs', - // x00191098: 'CenterFreqMethod', - // x0019109b: 'PulseSeqMode', - // x0019109c: 'PulseSeqName', - // x0019109d: 'PulseSeqDate', - // x0019109e: 'InternalPulseSeqName', - // x0019109f: 'TransmittingCoil', - // x001910a0: 'SurfaceCoilType', - // x001910a1: 'ExtremityCoilFlag', - // x001910a2: 'RawDataRunNumber', - // x001910a3: 'CalibratedFieldStrength', - // x001910a4: 'SATFatWaterBone', - // x001910a5: 'ReceiveBandwidth', - // x001910a7: 'UserData01', - // x001910a8: 'UserData02', - // x001910a9: 'UserData03', - // x001910aa: 'UserData04', - // x001910ab: 'UserData05', - // x001910ac: 'UserData06', - // x001910ad: 'UserData07', - // x001910ae: 'UserData08', - // x001910af: 'UserData09', - // x001910b0: 'UserData10', - // x001910b1: 'UserData11', - // x001910b2: 'UserData12', - // x001910b3: 'UserData13', - // x001910b4: 'UserData14', - // x001910b5: 'UserData15', - // x001910b6: 'UserData16', - // x001910b7: 'UserData17', - // x001910b8: 'UserData18', - // x001910b9: 'UserData19', - // x001910ba: 'UserData20', - // x001910bb: 'UserData21', - // x001910bc: 'UserData22', - // x001910bd: 'UserData23', - // x001910be: 'ProjectionAngle', - // x001910c0: 'SaturationPlanes', - // x001910c1: 'SurfaceCoilIntensity', - // x001910c2: 'SATLocationR', - // x001910c3: 'SATLocationL', - // x001910c4: 'SATLocationA', - // x001910c5: 'SATLocationP', - // x001910c6: 'SATLocationH', - // x001910c7: 'SATLocationF', - // x001910c8: 'SATThicknessR-L', - // x001910c9: 'SATThicknessA-P', - // x001910ca: 'SATThicknessH-F', - // x001910cb: 'PrescribedFlowAxis', - // x001910cc: 'VelocityEncoding', - // x001910cd: 'ThicknessDisclaimer', - // x001910ce: 'PrescanType', - // x001910cf: 'PrescanStatus', - // x001910d0: 'RawDataType', - // x001910d2: 'ProjectionAlgorithm', - // x001910d3: 'ProjectionAlgorithm', - // x001910d5: 'FractionalEcho', - // x001910d6: 'PrepPulse', - // x001910d7: 'CardiacPhases', - // x001910d8: 'VariableEchoflag', - // x001910d9: 'ConcatenatedSAT', - // x001910da: 'ReferenceChannelUsed', - // x001910db: 'BackProjectorCoefficient', - // x001910dc: 'PrimarySpeedCorrectionUsed', - // x001910dd: 'OverrangeCorrectionUsed', - // x001910de: 'DynamicZAlphaValue', - // x001910df: 'UserData', - // x001910e0: 'UserData', - // x001910e2: 'VelocityEncodeScale', - // x001910f2: 'FastPhases', - // x001910f9: 'TransmissionGain', - x00200000: 'RelationshipGroupLength', - x0020000d: 'StudyInstanceUID', - x0020000e: 'SeriesInstanceUID', - x00200010: 'StudyID', - x00200011: 'SeriesNumber', - x00200012: 'AcquisitionNumber', - x00200013: 'InstanceNumber', - x00200014: 'IsotopeNumber', - x00200015: 'PhaseNumber', - x00200016: 'IntervalNumber', - x00200017: 'TimeSlotNumber', - x00200018: 'AngleNumber', - x00200019: 'ItemNumber', - x00200020: 'PatientOrientation', - x00200022: 'OverlayNumber', - x00200024: 'CurveNumber', - x00200026: 'LookupTableNumber', - x00200030: 'ImagePosition', - x00200032: 'ImagePositionPatient', - x00200035: 'ImageOrientation', - x00200037: 'ImageOrientationPatient', - x00200050: 'Location', - x00200052: 'FrameOfReferenceUID', - x00200060: 'Laterality', - x00200062: 'ImageLaterality', - x00200070: 'ImageGeometryType', - x00200080: 'MaskingImage', - x00200100: 'TemporalPositionIdentifier', - x00200105: 'NumberOfTemporalPositions', - x00200110: 'TemporalResolution', - x00200200: 'SynchronizationFrameOfReferenceUID', - x00201000: 'SeriesInStudy', - x00201001: 'AcquisitionsInSeries', - x00201002: 'ImagesInAcquisition', - x00201003: 'ImagesInSeries', - x00201004: 'AcquisitionsInStudy', - x00201005: 'ImagesInStudy', - x00201020: 'Reference', - x00201040: 'PositionReferenceIndicator', - x00201041: 'SliceLocation', - x00201070: 'OtherStudyNumbers', - x00201200: 'NumberOfPatientRelatedStudies', - x00201202: 'NumberOfPatientRelatedSeries', - x00201204: 'NumberOfPatientRelatedInstances', - x00201206: 'NumberOfStudyRelatedSeries', - x00201208: 'NumberOfStudyRelatedInstances', - x00201209: 'NumberOfSeriesRelatedInstances', - x002031xx: 'SourceImageIDs', - x00203401: 'ModifyingDeviceID', - x00203402: 'ModifiedImageID', - x00203403: 'ModifiedImageDate', - x00203404: 'ModifyingDeviceManufacturer', - x00203405: 'ModifiedImageTime', - x00203406: 'ModifiedImageDescription', - x00204000: 'ImageComments', - x00205000: 'OriginalImageIdentification', - x00205002: 'OriginalImageIdentNomenclature', - x00209056: 'StackID', - x00209057: 'InStackPositionNumber', - x00209071: 'FrameAnatomySequence', - x00209072: 'FrameLaterality', - x00209111: 'FrameContentSequence', - x00209113: 'PlanePositionSequence', - x00209116: 'PlaneOrientationSequence', - x00209128: 'TemporalPositionIndex', - x00209153: 'TriggerDelayTime', - x00209156: 'FrameAcquisitionNumber', - x00209157: 'DimensionIndexValues', - x00209158: 'FrameComments', - x00209161: 'ConcatenationUID', - x00209162: 'InConcatenationNumber', - x00209163: 'InConcatenationTotalNumber', - x00209164: 'DimensionOrganizationUID', - x00209165: 'DimensionIndexPointer', - x00209167: 'FunctionalGroupPointer', - x00209213: 'DimensionIndexPrivateCreator', - x00209221: 'DimensionOrganizationSequence', - x00209222: 'DimensionIndexSequence', - x00209228: 'ConcatenationFrameOffsetNumber', - x00209238: 'FunctionalGroupPrivateCreator', - x00209241: 'NominalPercentageOfCardiacPhase', - x00209245: 'NominalPercentOfRespiratoryPhase', - x00209246: 'StartingRespiratoryAmplitude', - x00209247: 'StartingRespiratoryPhase', - x00209248: 'EndingRespiratoryAmplitude', - x00209249: 'EndingRespiratoryPhase', - x00209250: 'RespiratoryTriggerType', - x00209251: 'RRIntervalTimeNominal', - x00209252: 'ActualCardiacTriggerDelayTime', - x00209253: 'RespiratorySynchronizationSequence', - x00209254: 'RespiratoryIntervalTime', - x00209255: 'NominalRespiratoryTriggerDelayTime', - x00209256: 'RespiratoryTriggerDelayThreshold', - x00209257: 'ActualRespiratoryTriggerDelayTime', - x00209301: 'ImagePositionVolume', - x00209302: 'ImageOrientationVolume', - x00209308: 'ApexPosition', - x00209421: 'DimensionDescriptionLabel', - x00209450: 'PatientOrientationInFrameSequence', - x00209453: 'FrameLabel', - x00209518: 'AcquisitionIndex', - x00209529: 'ContributingSOPInstancesRefSeq', - x00209536: 'ReconstructionIndex', - // x00211003: 'SeriesFromWhichPrescribed', - // x00211005: 'GenesisVersionNow', - // x00211007: 'SeriesRecordChecksum', - // x00211018: 'GenesisVersionNow', - // x00211019: 'AcqreconRecordChecksum', - // x00211020: 'TableStartLocation', - // x00211035: 'SeriesFromWhichPrescribed', - // x00211036: 'ImageFromWhichPrescribed', - // x00211037: 'ScreenFormat', - // x0021104a: 'AnatomicalReferenceForScout', - // x0021104f: 'LocationsInAcquisition', - // x00211050: 'GraphicallyPrescribed', - // x00211051: 'RotationFromSourceXRot', - // x00211052: 'RotationFromSourceYRot', - // x00211053: 'RotationFromSourceZRot', - // x00211054: 'ImagePosition', - // x00211055: 'ImageOrientation', - // x00211056: 'IntegerSlop', - // x00211057: 'IntegerSlop', - // x00211058: 'IntegerSlop', - // x00211059: 'IntegerSlop', - // x0021105a: 'IntegerSlop', - // x0021105b: 'FloatSlop', - // x0021105c: 'FloatSlop', - // x0021105d: 'FloatSlop', - // x0021105e: 'FloatSlop', - // x0021105f: 'FloatSlop', - // x00211081: 'AutoWindowLevelAlpha', - // x00211082: 'AutoWindowLevelBeta', - // x00211083: 'AutoWindowLevelWindow', - // x00211084: 'ToWindowLevelLevel', - // x00211090: 'TubeFocalSpotPosition', - // x00211091: 'BiopsyPosition', - // x00211092: 'BiopsyTLocation', - // x00211093: 'BiopsyRefLocation', - x00220001: 'LightPathFilterPassThroughWavelen', - x00220002: 'LightPathFilterPassBand', - x00220003: 'ImagePathFilterPassThroughWavelen', - x00220004: 'ImagePathFilterPassBand', - x00220005: 'PatientEyeMovementCommanded', - x00220006: 'PatientEyeMovementCommandCodeSeq', - x00220007: 'SphericalLensPower', - x00220008: 'CylinderLensPower', - x00220009: 'CylinderAxis', - x0022000a: 'EmmetropicMagnification', - x0022000b: 'IntraOcularPressure', - x0022000c: 'HorizontalFieldOfView', - x0022000d: 'PupilDilated', - x0022000e: 'DegreeOfDilation', - x00220010: 'StereoBaselineAngle', - x00220011: 'StereoBaselineDisplacement', - x00220012: 'StereoHorizontalPixelOffset', - x00220013: 'StereoVerticalPixelOffset', - x00220014: 'StereoRotation', - x00220015: 'AcquisitionDeviceTypeCodeSequence', - x00220016: 'IlluminationTypeCodeSequence', - x00220017: 'LightPathFilterTypeStackCodeSeq', - x00220018: 'ImagePathFilterTypeStackCodeSeq', - x00220019: 'LensesCodeSequence', - x0022001a: 'ChannelDescriptionCodeSequence', - x0022001b: 'RefractiveStateSequence', - x0022001c: 'MydriaticAgentCodeSequence', - x0022001d: 'RelativeImagePositionCodeSequence', - x00220020: 'StereoPairsSequence', - x00220021: 'LeftImageSequence', - x00220022: 'RightImageSequence', - x00220030: 'AxialLengthOfTheEye', - x00220031: 'OphthalmicFrameLocationSequence', - x00220032: 'ReferenceCoordinates', - x00220035: 'DepthSpatialResolution', - x00220036: 'MaximumDepthDistortion', - x00220037: 'AlongScanSpatialResolution', - x00220038: 'MaximumAlongScanDistortion', - x00220039: 'OphthalmicImageOrientation', - x00220041: 'DepthOfTransverseImage', - x00220042: 'MydriaticAgentConcUnitsSeq', - x00220048: 'AcrossScanSpatialResolution', - x00220049: 'MaximumAcrossScanDistortion', - x0022004e: 'MydriaticAgentConcentration', - x00220055: 'IlluminationWaveLength', - x00220056: 'IlluminationPower', - x00220057: 'IlluminationBandwidth', - x00220058: 'MydriaticAgentSequence', - // x00231001: 'NumberOfSeriesInStudy', - // x00231002: 'NumberOfUnarchivedSeries', - // x00231010: 'ReferenceImageField', - // x00231050: 'SummaryImage', - // x00231070: 'StartTimeSecsInFirstAxial', - // x00231074: 'NoofUpdatesToHeader', - // x0023107d: 'IndicatesIfTheStudyHasCompleteInfo', - // x00251006: 'LastPulseSequenceUsed', - // x00251007: 'ImagesInSeries', - // x00251010: 'LandmarkCounter', - // x00251011: 'NumberOfAcquisitions', - // x00251014: 'IndicatesNoofUpdatesToHeader', - // x00251017: 'SeriesCompleteFlag', - // x00251018: 'NumberOfImagesArchived', - // x00251019: 'LastImageNumberUsed', - // x0025101a: 'PrimaryReceiverSuiteAndHost', - // x00271006: 'ImageArchiveFlag', - // x00271010: 'ScoutType', - // x0027101c: 'VmaMamp', - // x0027101d: 'VmaPhase', - // x0027101e: 'VmaMod', - // x0027101f: 'VmaClip', - // x00271020: 'SmartScanOnOffFlag', - // x00271030: 'ForeignImageRevision', - // x00271031: 'ImagingMode', - // x00271032: 'PulseSequence', - // x00271033: 'ImagingOptions', - // x00271035: 'PlaneType', - // x00271036: 'ObliquePlane', - // x00271040: 'RASLetterOfImageLocation', - // x00271041: 'ImageLocation', - // x00271042: 'CenterRCoordOfPlaneImage', - // x00271043: 'CenterACoordOfPlaneImage', - // x00271044: 'CenterSCoordOfPlaneImage', - // x00271045: 'NormalRCoord', - // x00271046: 'NormalACoord', - // x00271047: 'NormalSCoord', - // x00271048: 'RCoordOfTopRightCorner', - // x00271049: 'ACoordOfTopRightCorner', - // x0027104a: 'SCoordOfTopRightCorner', - // x0027104b: 'RCoordOfBottomRightCorner', - // x0027104c: 'ACoordOfBottomRightCorner', - // x0027104d: 'SCoordOfBottomRightCorner', - // x00271050: 'TableStartLocation', - // x00271051: 'TableEndLocation', - // x00271052: 'RASLetterForSideOfImage', - // x00271053: 'RASLetterForAnteriorPosterior', - // x00271054: 'RASLetterForScoutStartLoc', - // x00271055: 'RASLetterForScoutEndLoc', - // x00271060: 'ImageDimensionX', - // x00271061: 'ImageDimensionY', - // x00271062: 'NumberOfExcitations', - x00280000: 'ImagePresentationGroupLength', - x00280002: 'SamplesPerPixel', - x00280003: 'SamplesPerPixelUsed', - x00280004: 'PhotometricInterpretation', - x00280005: 'ImageDimensions', - x00280006: 'PlanarConfiguration', - x00280008: 'NumberOfFrames', - x00280009: 'FrameIncrementPointer', - x0028000a: 'FrameDimensionPointer', - x00280010: 'Rows', - x00280011: 'Columns', - x00280012: 'Planes', - x00280014: 'UltrasoundColorDataPresent', - x00280030: 'PixelSpacing', - x00280031: 'ZoomFactor', - x00280032: 'ZoomCenter', - x00280034: 'PixelAspectRatio', - x00280040: 'ImageFormat', - x00280050: 'ManipulatedImage', - x00280051: 'CorrectedImage', - x0028005f: 'CompressionRecognitionCode', - x00280060: 'CompressionCode', - x00280061: 'CompressionOriginator', - x00280062: 'CompressionLabel', - x00280063: 'CompressionDescription', - x00280065: 'CompressionSequence', - x00280066: 'CompressionStepPointers', - x00280068: 'RepeatInterval', - x00280069: 'BitsGrouped', - x00280070: 'PerimeterTable', - x00280071: 'PerimeterValue', - x00280080: 'PredictorRows', - x00280081: 'PredictorColumns', - x00280082: 'PredictorConstants', - x00280090: 'BlockedPixels', - x00280091: 'BlockRows', - x00280092: 'BlockColumns', - x00280093: 'RowOverlap', - x00280094: 'ColumnOverlap', - x00280100: 'BitsAllocated', - x00280101: 'BitsStored', - x00280102: 'HighBit', - x00280103: 'PixelRepresentation', - x00280104: 'SmallestValidPixelValue', - x00280105: 'LargestValidPixelValue', - x00280106: 'SmallestImagePixelValue', - x00280107: 'LargestImagePixelValue', - x00280108: 'SmallestPixelValueInSeries', - x00280109: 'LargestPixelValueInSeries', - x00280110: 'SmallestImagePixelValueInPlane', - x00280111: 'LargestImagePixelValueInPlane', - x00280120: 'PixelPaddingValue', - x00280121: 'PixelPaddingRangeLimit', - x00280200: 'ImageLocation', - x00280300: 'QualityControlImage', - x00280301: 'BurnedInAnnotation', - x00280400: 'TransformLabel', - x00280401: 'TransformVersionNumber', - x00280402: 'NumberOfTransformSteps', - x00280403: 'SequenceOfCompressedData', - x00280404: 'DetailsOfCoefficients', - x002804x2: 'CoefficientCoding', - x002804x3: 'CoefficientCodingPointers', - x00280700: 'DCTLabel', - x00280701: 'DataBlockDescription', - x00280702: 'DataBlock', - x00280710: 'NormalizationFactorFormat', - x00280720: 'ZonalMapNumberFormat', - x00280721: 'ZonalMapLocation', - x00280722: 'ZonalMapFormat', - x00280730: 'AdaptiveMapFormat', - x00280740: 'CodeNumberFormat', - x002808x0: 'CodeLabel', - x002808x2: 'NumberOfTables', - x002808x3: 'CodeTableLocation', - x002808x4: 'BitsForCodeWord', - x002808x8: 'ImageDataLocation', - x00280a02: 'PixelSpacingCalibrationType', - x00280a04: 'PixelSpacingCalibrationDescription', - x00281040: 'PixelIntensityRelationship', - x00281041: 'PixelIntensityRelationshipSign', - x00281050: 'WindowCenter', - x00281051: 'WindowWidth', - x00281052: 'RescaleIntercept', - x00281053: 'RescaleSlope', - x00281054: 'RescaleType', - x00281055: 'WindowCenterAndWidthExplanation', - x00281056: 'VOI_LUTFunction', - x00281080: 'GrayScale', - x00281090: 'RecommendedViewingMode', - x00281100: 'GrayLookupTableDescriptor', - x00281101: 'RedPaletteColorTableDescriptor', - x00281102: 'GreenPaletteColorTableDescriptor', - x00281103: 'BluePaletteColorTableDescriptor', - x00281111: 'LargeRedPaletteColorTableDescr', - x00281112: 'LargeGreenPaletteColorTableDescr', - x00281113: 'LargeBluePaletteColorTableDescr', - x00281199: 'PaletteColorTableUID', - x00281200: 'GrayLookupTableData', - x00281201: 'RedPaletteColorTableData', - x00281202: 'GreenPaletteColorTableData', - x00281203: 'BluePaletteColorTableData', - x00281211: 'LargeRedPaletteColorTableData', - x00281212: 'LargeGreenPaletteColorTableData', - x00281213: 'LargeBluePaletteColorTableData', - x00281214: 'LargePaletteColorLookupTableUID', - x00281221: 'SegmentedRedColorTableData', - x00281222: 'SegmentedGreenColorTableData', - x00281223: 'SegmentedBlueColorTableData', - x00281300: 'BreastImplantPresent', - x00281350: 'PartialView', - x00281351: 'PartialViewDescription', - x00281352: 'PartialViewCodeSequence', - x0028135a: 'SpatialLocationsPreserved', - x00281402: 'DataPathAssignment', - x00281404: 'BlendingLUT1Sequence', - x00281406: 'BlendingWeightConstant', - x00281408: 'BlendingLookupTableData', - x0028140c: 'BlendingLUT2Sequence', - x0028140e: 'DataPathID', - x0028140f: 'RGBLUTTransferFunction', - x00281410: 'AlphaLUTTransferFunction', - x00282000: 'ICCProfile', - x00282110: 'LossyImageCompression', - x00282112: 'LossyImageCompressionRatio', - x00282114: 'LossyImageCompressionMethod', - x00283000: 'ModalityLUTSequence', - x00283002: 'LUTDescriptor', - x00283003: 'LUTExplanation', - x00283004: 'ModalityLUTType', - x00283006: 'LUTData', - x00283010: 'VOILUTSequence', - x00283110: 'SoftcopyVOILUTSequence', - x00284000: 'ImagePresentationComments', - x00285000: 'BiPlaneAcquisitionSequence', - x00286010: 'RepresentativeFrameNumber', - x00286020: 'FrameNumbersOfInterest', - x00286022: 'FrameOfInterestDescription', - x00286023: 'FrameOfInterestType', - x00286030: 'MaskPointers', - x00286040: 'RWavePointer', - x00286100: 'MaskSubtractionSequence', - x00286101: 'MaskOperation', - x00286102: 'ApplicableFrameRange', - x00286110: 'MaskFrameNumbers', - x00286112: 'ContrastFrameAveraging', - x00286114: 'MaskSubPixelShift', - x00286120: 'TIDOffset', - x00286190: 'MaskOperationExplanation', - x00287fe0: 'PixelDataProviderURL', - x00289001: 'DataPointRows', - x00289002: 'DataPointColumns', - x00289003: 'SignalDomainColumns', - x00289099: 'LargestMonochromePixelValue', - x00289108: 'DataRepresentation', - x00289110: 'PixelMeasuresSequence', - x00289132: 'FrameVOILUTSequence', - x00289145: 'PixelValueTransformationSequence', - x00289235: 'SignalDomainRows', - x00289411: 'DisplayFilterPercentage', - x00289415: 'FramePixelShiftSequence', - x00289416: 'SubtractionItemID', - x00289422: 'PixelIntensityRelationshipLUTSeq', - x00289443: 'FramePixelDataPropertiesSequence', - x00289444: 'GeometricalProperties', - x00289445: 'GeometricMaximumDistortion', - x00289446: 'ImageProcessingApplied', - x00289454: 'MaskSelectionMode', - x00289474: 'LUTFunction', - x00289478: 'MaskVisibilityPercentage', - x00289501: 'PixelShiftSequence', - x00289502: 'RegionPixelShiftSequence', - x00289503: 'VerticesOfTheRegion', - x00289506: 'PixelShiftFrameRange', - x00289507: 'LUTFrameRange', - x00289520: 'ImageToEquipmentMappingMatrix', - x00289537: 'EquipmentCoordinateSystemID', - // x00291004: 'LowerRangeOfPixels1a', - // x00291005: 'LowerRangeOfPixels1b', - // x00291006: 'LowerRangeOfPixels1c', - // x00291007: 'LowerRangeOfPixels1d', - // x00291008: 'LowerRangeOfPixels1e', - // x00291009: 'LowerRangeOfPixels1f', - // x0029100a: 'LowerRangeOfPixels1g', - // x00291015: 'LowerRangeOfPixels1h', - // x00291016: 'LowerRangeOfPixels1i', - // x00291017: 'LowerRangeOfPixels2', - // x00291018: 'UpperRangeOfPixels2', - // x0029101a: 'LenOfTotHdrInBytes', - // x00291026: 'VersionOfTheHdrStruct', - // x00291034: 'AdvantageCompOverflow', - // x00291035: 'AdvantageCompUnderflow', - x00320000: 'StudyGroupLength', - x0032000a: 'StudyStatusID', - x0032000c: 'StudyPriorityID', - x00320012: 'StudyIDIssuer', - x00320032: 'StudyVerifiedDate', - x00320033: 'StudyVerifiedTime', - x00320034: 'StudyReadDate', - x00320035: 'StudyReadTime', - x00321000: 'ScheduledStudyStartDate', - x00321001: 'ScheduledStudyStartTime', - x00321010: 'ScheduledStudyStopDate', - x00321011: 'ScheduledStudyStopTime', - x00321020: 'ScheduledStudyLocation', - x00321021: 'ScheduledStudyLocationAETitle', - x00321030: 'ReasonForStudy', - x00321031: 'RequestingPhysicianIDSequence', - x00321032: 'RequestingPhysician', - x00321033: 'RequestingService', - x00321040: 'StudyArrivalDate', - x00321041: 'StudyArrivalTime', - x00321050: 'StudyCompletionDate', - x00321051: 'StudyCompletionTime', - x00321055: 'StudyComponentStatusID', - x00321060: 'RequestedProcedureDescription', - x00321064: 'RequestedProcedureCodeSequence', - x00321070: 'RequestedContrastAgent', - x00324000: 'StudyComments', - x00380004: 'ReferencedPatientAliasSequence', - x00380008: 'VisitStatusID', - x00380010: 'AdmissionID', - x00380011: 'IssuerOfAdmissionID', - x00380016: 'RouteOfAdmissions', - x0038001a: 'ScheduledAdmissionDate', - x0038001b: 'ScheduledAdmissionTime', - x0038001c: 'ScheduledDischargeDate', - x0038001d: 'ScheduledDischargeTime', - x0038001e: 'ScheduledPatientInstitResidence', - x00380020: 'AdmittingDate', - x00380021: 'AdmittingTime', - x00380030: 'DischargeDate', - x00380032: 'DischargeTime', - x00380040: 'DischargeDiagnosisDescription', - x00380044: 'DischargeDiagnosisCodeSequence', - x00380050: 'SpecialNeeds', - x00380060: 'ServiceEpisodeID', - x00380061: 'IssuerOfServiceEpisodeID', - x00380062: 'ServiceEpisodeDescription', - x00380100: 'PertinentDocumentsSequence', - x00380300: 'CurrentPatientLocation', - x00380400: 'PatientInstitutionResidence', - x00380500: 'PatientState', - x00380502: 'PatientClinicalTrialParticipSeq', - x00384000: 'VisitComments', - x003a0004: 'WaveformOriginality', - x003a0005: 'NumberOfWaveformChannels', - x003a0010: 'NumberOfWaveformSamples', - x003a001a: 'SamplingFrequency', - x003a0020: 'MultiplexGroupLabel', - x003a0200: 'ChannelDefinitionSequence', - x003a0202: 'WaveformChannelNumber', - x003a0203: 'ChannelLabel', - x003a0205: 'ChannelStatus', - x003a0208: 'ChannelSourceSequence', - x003a0209: 'ChannelSourceModifiersSequence', - x003a020a: 'SourceWaveformSequence', - x003a020c: 'ChannelDerivationDescription', - x003a0210: 'ChannelSensitivity', - x003a0211: 'ChannelSensitivityUnitsSequence', - x003a0212: 'ChannelSensitivityCorrectionFactor', - x003a0213: 'ChannelBaseline', - x003a0214: 'ChannelTimeSkew', - x003a0215: 'ChannelSampleSkew', - x003a0218: 'ChannelOffset', - x003a021a: 'WaveformBitsStored', - x003a0220: 'FilterLowFrequency', - x003a0221: 'FilterHighFrequency', - x003a0222: 'NotchFilterFrequency', - x003a0223: 'NotchFilterBandwidth', - x003a0230: 'WaveformDataDisplayScale', - x003a0231: 'WaveformDisplayBkgCIELabValue', - x003a0240: 'WaveformPresentationGroupSequence', - x003a0241: 'PresentationGroupNumber', - x003a0242: 'ChannelDisplaySequence', - x003a0244: 'ChannelRecommendDisplayCIELabValue', - x003a0245: 'ChannelPosition', - x003a0246: 'DisplayShadingFlag', - x003a0247: 'FractionalChannelDisplayScale', - x003a0248: 'AbsoluteChannelDisplayScale', - x003a0300: 'MultiplexAudioChannelsDescrCodeSeq', - x003a0301: 'ChannelIdentificationCode', - x003a0302: 'ChannelMode', - x00400001: 'ScheduledStationAETitle', - x00400002: 'ScheduledProcedureStepStartDate', - x00400003: 'ScheduledProcedureStepStartTime', - x00400004: 'ScheduledProcedureStepEndDate', - x00400005: 'ScheduledProcedureStepEndTime', - x00400006: 'ScheduledPerformingPhysiciansName', - x00400007: 'ScheduledProcedureStepDescription', - x00400008: 'ScheduledProtocolCodeSequence', - x00400009: 'ScheduledProcedureStepID', - x0040000a: 'StageCodeSequence', - x0040000b: 'ScheduledPerformingPhysicianIDSeq', - x00400010: 'ScheduledStationName', - x00400011: 'ScheduledProcedureStepLocation', - x00400012: 'PreMedication', - x00400020: 'ScheduledProcedureStepStatus', - x00400031: 'LocalNamespaceEntityID', - x00400032: 'UniversalEntityID', - x00400033: 'UniversalEntityIDType', - x00400035: 'IdentifierTypeCode', - x00400036: 'AssigningFacilitySequence', - x00400100: 'ScheduledProcedureStepSequence', - x00400220: 'ReferencedNonImageCompositeSOPSeq', - x00400241: 'PerformedStationAETitle', - x00400242: 'PerformedStationName', - x00400243: 'PerformedLocation', - x00400244: 'PerformedProcedureStepStartDate', - x00400245: 'PerformedProcedureStepStartTime', - x00400250: 'PerformedProcedureStepEndDate', - x00400251: 'PerformedProcedureStepEndTime', - x00400252: 'PerformedProcedureStepStatus', - x00400253: 'PerformedProcedureStepID', - x00400254: 'PerformedProcedureStepDescription', - x00400255: 'PerformedProcedureTypeDescription', - x00400260: 'PerformedProtocolCodeSequence', - x00400261: 'PerformedProtocolType', - x00400270: 'ScheduledStepAttributesSequence', - x00400275: 'RequestAttributesSequence', - x00400280: 'CommentsOnPerformedProcedureStep', - x00400281: 'ProcStepDiscontinueReasonCodeSeq', - x00400293: 'QuantitySequence', - x00400294: 'Quantity', - x00400295: 'MeasuringUnitsSequence', - x00400296: 'BillingItemSequence', - x00400300: 'TotalTimeOfFluoroscopy', - x00400301: 'TotalNumberOfExposures', - x00400302: 'EntranceDose', - x00400303: 'ExposedArea', - x00400306: 'DistanceSourceToEntrance', - x00400307: 'DistanceSourceToSupport', - x0040030e: 'ExposureDoseSequence', - x00400310: 'CommentsOnRadiationDose', - x00400312: 'XRayOutput', - x00400314: 'HalfValueLayer', - x00400316: 'OrganDose', - x00400318: 'OrganExposed', - x00400320: 'BillingProcedureStepSequence', - x00400321: 'FilmConsumptionSequence', - x00400324: 'BillingSuppliesAndDevicesSequence', - x00400330: 'ReferencedProcedureStepSequence', - x00400340: 'PerformedSeriesSequence', - x00400400: 'CommentsOnScheduledProcedureStep', - x00400440: 'ProtocolContextSequence', - x00400441: 'ContentItemModifierSequence', - x0040050a: 'SpecimenAccessionNumber', - x00400512: 'ContainerIdentifier', - x0040051a: 'ContainerDescription', - x00400550: 'SpecimenSequence', - x00400551: 'SpecimenIdentifier', - x00400552: 'SpecimenDescriptionSequenceTrial', - x00400553: 'SpecimenDescriptionTrial', - x00400554: 'SpecimenUID', - x00400555: 'AcquisitionContextSequence', - x00400556: 'AcquisitionContextDescription', - x0040059a: 'SpecimenTypeCodeSequence', - x00400600: 'SpecimenShortDescription', - x004006fa: 'SlideIdentifier', - x0040071a: 'ImageCenterPointCoordinatesSeq', - x0040072a: 'XOffsetInSlideCoordinateSystem', - x0040073a: 'YOffsetInSlideCoordinateSystem', - x0040074a: 'ZOffsetInSlideCoordinateSystem', - x004008d8: 'PixelSpacingSequence', - x004008da: 'CoordinateSystemAxisCodeSequence', - x004008ea: 'MeasurementUnitsCodeSequence', - x004009f8: 'VitalStainCodeSequenceTrial', - x00401001: 'RequestedProcedureID', - x00401002: 'ReasonForRequestedProcedure', - x00401003: 'RequestedProcedurePriority', - x00401004: 'PatientTransportArrangements', - x00401005: 'RequestedProcedureLocation', - x00401006: 'PlacerOrderNumber-Procedure', - x00401007: 'FillerOrderNumber-Procedure', - x00401008: 'ConfidentialityCode', - x00401009: 'ReportingPriority', - x0040100a: 'ReasonForRequestedProcedureCodeSeq', - x00401010: 'NamesOfIntendedRecipientsOfResults', - x00401011: 'IntendedRecipientsOfResultsIDSeq', - x00401101: 'PersonIdentificationCodeSequence', - x00401102: 'PersonAddress', - x00401103: 'PersonTelephoneNumbers', - x00401400: 'RequestedProcedureComments', - x00402001: 'ReasonForImagingServiceRequest', - x00402004: 'IssueDateOfImagingServiceRequest', - x00402005: 'IssueTimeOfImagingServiceRequest', - x00402006: 'PlacerOrderNumberImagingServiceRequestRetired', - x00402007: 'FillerOrderNumberImagingServiceRequestRetired', - x00402008: 'OrderEnteredBy', - x00402009: 'OrderEntererLocation', - x00402010: 'OrderCallbackPhoneNumber', - x00402016: 'PlacerOrderNum-ImagingServiceReq', - x00402017: 'FillerOrderNum-ImagingServiceReq', - x00402400: 'ImagingServiceRequestComments', - x00403001: 'ConfidentialityOnPatientDataDescr', - x00404001: 'GenPurposeScheduledProcStepStatus', - x00404002: 'GenPurposePerformedProcStepStatus', - x00404003: 'GenPurposeSchedProcStepPriority', - x00404004: 'SchedProcessingApplicationsCodeSeq', - x00404005: 'SchedProcedureStepStartDateAndTime', - x00404006: 'MultipleCopiesFlag', - x00404007: 'PerformedProcessingAppsCodeSeq', - x00404009: 'HumanPerformerCodeSequence', - x00404010: 'SchedProcStepModificationDateTime', - x00404011: 'ExpectedCompletionDateAndTime', - x00404015: 'ResultingGenPurposePerfProcStepSeq', - x00404016: 'RefGenPurposeSchedProcStepSeq', - x00404018: 'ScheduledWorkitemCodeSequence', - x00404019: 'PerformedWorkitemCodeSequence', - x00404020: 'InputAvailabilityFlag', - x00404021: 'InputInformationSequence', - x00404022: 'RelevantInformationSequence', - x00404023: 'RefGenPurSchedProcStepTransUID', - x00404025: 'ScheduledStationNameCodeSequence', - x00404026: 'ScheduledStationClassCodeSequence', - x00404027: 'SchedStationGeographicLocCodeSeq', - x00404028: 'PerformedStationNameCodeSequence', - x00404029: 'PerformedStationClassCodeSequence', - x00404030: 'PerformedStationGeogLocCodeSeq', - x00404031: 'RequestedSubsequentWorkItemCodeSeq', - x00404032: 'NonDICOMOutputCodeSequence', - x00404033: 'OutputInformationSequence', - x00404034: 'ScheduledHumanPerformersSequence', - x00404035: 'ActualHumanPerformersSequence', - x00404036: 'HumanPerformersOrganization', - x00404037: 'HumanPerformerName', - x00404040: 'RawDataHandling', - x00408302: 'EntranceDoseInMilliGy', - x00409094: 'RefImageRealWorldValueMappingSeq', - x00409096: 'RealWorldValueMappingSequence', - x00409098: 'PixelValueMappingCodeSequence', - x00409210: 'LUTLabel', - x00409211: 'RealWorldValueLastValueMapped', - x00409212: 'RealWorldValueLUTData', - x00409216: 'RealWorldValueFirstValueMapped', - x00409224: 'RealWorldValueIntercept', - x00409225: 'RealWorldValueSlope', - x0040a010: 'RelationshipType', - x0040a027: 'VerifyingOrganization', - x0040a030: 'VerificationDateTime', - x0040a032: 'ObservationDateTime', - x0040a040: 'ValueType', - x0040a043: 'ConceptNameCodeSequence', - x0040a050: 'ContinuityOfContent', - x0040a073: 'VerifyingObserverSequence', - x0040a075: 'VerifyingObserverName', - x0040a078: 'AuthorObserverSequence', - x0040a07a: 'ParticipantSequence', - x0040a07c: 'CustodialOrganizationSequence', - x0040a080: 'ParticipationType', - x0040a082: 'ParticipationDateTime', - x0040a084: 'ObserverType', - x0040a088: 'VerifyingObserverIdentCodeSequence', - x0040a090: 'EquivalentCDADocumentSequence', - x0040a0b0: 'ReferencedWaveformChannels', - x0040a120: 'DateTime', - x0040a121: 'Date', - x0040a122: 'Time', - x0040a123: 'PersonName', - x0040a124: 'UID', - x0040a130: 'TemporalRangeType', - x0040a132: 'ReferencedSamplePositions', - x0040a136: 'ReferencedFrameNumbers', - x0040a138: 'ReferencedTimeOffsets', - x0040a13a: 'ReferencedDateTime', - x0040a160: 'TextValue', - x0040a168: 'ConceptCodeSequence', - x0040a170: 'PurposeOfReferenceCodeSequence', - x0040a180: 'AnnotationGroupNumber', - x0040a195: 'ModifierCodeSequence', - x0040a300: 'MeasuredValueSequence', - x0040a301: 'NumericValueQualifierCodeSequence', - x0040a30a: 'NumericValue', - x0040a353: 'AddressTrial', - x0040a354: 'TelephoneNumberTrial', - x0040a360: 'PredecessorDocumentsSequence', - x0040a370: 'ReferencedRequestSequence', - x0040a372: 'PerformedProcedureCodeSequence', - x0040a375: 'CurrentRequestedProcEvidenceSeq', - x0040a385: 'PertinentOtherEvidenceSequence', - x0040a390: 'HL7StructuredDocumentRefSeq', - x0040a491: 'CompletionFlag', - x0040a492: 'CompletionFlagDescription', - x0040a493: 'VerificationFlag', - x0040a494: 'ArchiveRequested', - x0040a496: 'PreliminaryFlag', - x0040a504: 'ContentTemplateSequence', - x0040a525: 'IdenticalDocumentsSequence', - x0040a730: 'ContentSequence', - x0040b020: 'AnnotationSequence', - x0040db00: 'TemplateIdentifier', - x0040db06: 'TemplateVersion', - x0040db07: 'TemplateLocalVersion', - x0040db0b: 'TemplateExtensionFlag', - x0040db0c: 'TemplateExtensionOrganizationUID', - x0040db0d: 'TemplateExtensionCreatorUID', - x0040db73: 'ReferencedContentItemIdentifier', - x0040e001: 'HL7InstanceIdentifier', - x0040e004: 'HL7DocumentEffectiveTime', - x0040e006: 'HL7DocumentTypeCodeSequence', - x0040e010: 'RetrieveURI', - x0040e011: 'RetrieveLocationUID', - x00420010: 'DocumentTitle', - x00420011: 'EncapsulatedDocument', - x00420012: 'MIMETypeOfEncapsulatedDocument', - x00420013: 'SourceInstanceSequence', - x00420014: 'ListOfMIMETypes', - // x00431001: 'BitmapOfPrescanOptions', - // x00431002: 'GradientOffsetInX', - // x00431003: 'GradientOffsetInY', - // x00431004: 'GradientOffsetInZ', - // x00431005: 'ImgIsOriginalOrUnoriginal', - // x00431006: 'NumberOfEPIShots', - // x00431007: 'ViewsPerSegment', - // x00431008: 'RespiratoryRateBpm', - // x00431009: 'RespiratoryTriggerPoint', - // x0043100a: 'TypeOfReceiverUsed', - // x0043100b: 'PeakRateOfChangeOfGradientField', - // x0043100c: 'LimitsInUnitsOfPercent', - // x0043100d: 'PSDEstimatedLimit', - // x0043100e: 'PSDEstimatedLimitInTeslaPerSecond', - // x0043100f: 'Saravghead', - // x00431010: 'WindowValue', - // x00431011: 'TotalInputViews', - // x00431012: 'X-RayChain', - // x00431013: 'DeconKernelParameters', - // x00431014: 'CalibrationParameters', - // x00431015: 'TotalOutputViews', - // x00431016: 'NumberOfOverranges', - // x00431017: 'IBHImageScaleFactors', - // x00431018: 'BBHCoefficients', - // x00431019: 'NumberOfBBHChainsToBlend', - // x0043101a: 'StartingChannelNumber', - // x0043101b: 'PpscanParameters', - // x0043101c: 'GEImageIntegrity', - // x0043101d: 'LevelValue', - // x0043101e: 'DeltaStartTime', - // x0043101f: 'MaxOverrangesInAView', - // x00431020: 'AvgOverrangesAllViews', - // x00431021: 'CorrectedAfterGlowTerms', - // x00431025: 'ReferenceChannels', - // x00431026: 'NoViewsRefChansBlocked', - // x00431027: 'ScanPitchRatio', - // x00431028: 'UniqueImageIden', - // x00431029: 'HistogramTables', - // x0043102a: 'UserDefinedData', - // x0043102b: 'PrivateScanOptions', - // x0043102c: 'EffectiveEchoSpacing', - // x0043102d: 'StringSlopField1', - // x0043102e: 'StringSlopField2', - // x0043102f: 'RawDataType', - // x00431030: 'RawDataType', - // x00431031: 'RACordOfTargetReconCenter', - // x00431032: 'RawDataType', - // x00431033: 'NegScanspacing', - // x00431034: 'OffsetFrequency', - // x00431035: 'UserUsageTag', - // x00431036: 'UserFillMapMSW', - // x00431037: 'UserFillMapLSW', - // x00431038: 'User25-48', - // x00431039: 'SlopInt6-9', - // x00431040: 'TriggerOnPosition', - // x00431041: 'DegreeOfRotation', - // x00431042: 'DASTriggerSource', - // x00431043: 'DASFpaGain', - // x00431044: 'DASOutputSource', - // x00431045: 'DASAdInput', - // x00431046: 'DASCalMode', - // x00431047: 'DASCalFrequency', - // x00431048: 'DASRegXm', - // x00431049: 'DASAutoZero', - // x0043104a: 'StartingChannelOfView', - // x0043104b: 'DASXmPattern', - // x0043104c: 'TGGCTriggerMode', - // x0043104d: 'StartScanToXrayOnDelay', - // x0043104e: 'DurationOfXrayOn', - // x00431060: 'SlopInt10-17', - // x00431061: 'ScannerStudyEntityUID', - // x00431062: 'ScannerStudyID', - // x0043106f: 'ScannerTableEntry', - x00440001: 'ProductPackageIdentifier', - x00440002: 'SubstanceAdministrationApproval', - x00440003: 'ApprovalStatusFurtherDescription', - x00440004: 'ApprovalStatusDateTime', - x00440007: 'ProductTypeCodeSequence', - x00440008: 'ProductName', - x00440009: 'ProductDescription', - x0044000a: 'ProductLotIdentifier', - x0044000b: 'ProductExpirationDateTime', - x00440010: 'SubstanceAdministrationDateTime', - x00440011: 'SubstanceAdministrationNotes', - x00440012: 'SubstanceAdministrationDeviceID', - x00440013: 'ProductParameterSequence', - x00440019: 'SubstanceAdminParameterSeq', - // x00451001: 'NumberOfMacroRowsInDetector', - // x00451002: 'MacroWidthAtISOCenter', - // x00451003: 'DASType', - // x00451004: 'DASGain', - // x00451005: 'DASTemperature', - // x00451006: 'TableDirectionInOrOut', - // x00451007: 'ZSmoothingFactor', - // x00451008: 'ViewWeightingMode', - // x00451009: 'SigmaRowNumberWhichRowsWereUsed', - // x0045100a: 'MinimumDasValueFoundInTheScanData', - // x0045100b: 'MaximumOffsetShiftValueUsed', - // x0045100c: 'NumberOfViewsShifted', - // x0045100d: 'ZTrackingFlag', - // x0045100e: 'MeanZError', - // x0045100f: 'ZTrackingMaximumError', - // x00451010: 'StartingViewForRow2a', - // x00451011: 'NumberOfViewsInRow2a', - // x00451012: 'StartingViewForRow1a', - // x00451013: 'SigmaMode', - // x00451014: 'NumberOfViewsInRow1a', - // x00451015: 'StartingViewForRow2b', - // x00451016: 'NumberOfViewsInRow2b', - // x00451017: 'StartingViewForRow1b', - // x00451018: 'NumberOfViewsInRow1b', - // x00451019: 'AirFilterCalibrationDate', - // x0045101a: 'AirFilterCalibrationTime', - // x0045101b: 'PhantomCalibrationDate', - // x0045101c: 'PhantomCalibrationTime', - // x0045101d: 'ZSlopeCalibrationDate', - // x0045101e: 'ZSlopeCalibrationTime', - // x0045101f: 'CrosstalkCalibrationDate', - // x00451020: 'CrosstalkCalibrationTime', - // x00451021: 'IterboneOptionFlag', - // x00451022: 'PeristalticFlagOption', - x00460012: 'LensDescription', - x00460014: 'RightLensSequence', - x00460015: 'LeftLensSequence', - x00460018: 'CylinderSequence', - x00460028: 'PrismSequence', - x00460030: 'HorizontalPrismPower', - x00460032: 'HorizontalPrismBase', - x00460034: 'VerticalPrismPower', - x00460036: 'VerticalPrismBase', - x00460038: 'LensSegmentType', - x00460040: 'OpticalTransmittance', - x00460042: 'ChannelWidth', - x00460044: 'PupilSize', - x00460046: 'CornealSize', - x00460060: 'DistancePupillaryDistance', - x00460062: 'NearPupillaryDistance', - x00460064: 'OtherPupillaryDistance', - x00460075: 'RadiusOfCurvature', - x00460076: 'KeratometricPower', - x00460077: 'KeratometricAxis', - x00460092: 'BackgroundColor', - x00460094: 'Optotype', - x00460095: 'OptotypePresentation', - x00460100: 'AddNearSequence', - x00460101: 'AddIntermediateSequence', - x00460102: 'AddOtherSequence', - x00460104: 'AddPower', - x00460106: 'ViewingDistance', - x00460125: 'ViewingDistanceType', - x00460135: 'VisualAcuityModifiers', - x00460137: 'DecimalVisualAcuity', - x00460139: 'OptotypeDetailedDefinition', - x00460146: 'SpherePower', - x00460147: 'CylinderPower', - x00500004: 'CalibrationImage', - x00500010: 'DeviceSequence', - x00500014: 'DeviceLength', - x00500015: 'ContainerComponentWidth', - x00500016: 'DeviceDiameter', - x00500017: 'DeviceDiameterUnits', - x00500018: 'DeviceVolume', - x00500019: 'InterMarkerDistance', - x0050001b: 'ContainerComponentID', - x00500020: 'DeviceDescription', - x00540010: 'EnergyWindowVector', - x00540011: 'NumberOfEnergyWindows', - x00540012: 'EnergyWindowInformationSequence', - x00540013: 'EnergyWindowRangeSequence', - x00540014: 'EnergyWindowLowerLimit', - x00540015: 'EnergyWindowUpperLimit', - x00540016: 'RadiopharmaceuticalInformationSeq', - x00540017: 'ResidualSyringeCounts', - x00540018: 'EnergyWindowName', - x00540020: 'DetectorVector', - x00540021: 'NumberOfDetectors', - x00540022: 'DetectorInformationSequence', - x00540030: 'PhaseVector', - x00540031: 'NumberOfPhases', - x00540032: 'PhaseInformationSequence', - x00540033: 'NumberOfFramesInPhase', - x00540036: 'PhaseDelay', - x00540038: 'PauseBetweenFrames', - x00540039: 'PhaseDescription', - x00540050: 'RotationVector', - x00540051: 'NumberOfRotations', - x00540052: 'RotationInformationSequence', - x00540053: 'NumberOfFramesInRotation', - x00540060: 'RRIntervalVector', - x00540061: 'NumberOfRRIntervals', - x00540062: 'GatedInformationSequence', - x00540063: 'DataInformationSequence', - x00540070: 'TimeSlotVector', - x00540071: 'NumberOfTimeSlots', - x00540072: 'TimeSlotInformationSequence', - x00540073: 'TimeSlotTime', - x00540080: 'SliceVector', - x00540081: 'NumberOfSlices', - x00540090: 'AngularViewVector', - x00540100: 'TimeSliceVector', - x00540101: 'NumberOfTimeSlices', - x00540200: 'StartAngle', - x00540202: 'TypeOfDetectorMotion', - x00540210: 'TriggerVector', - x00540211: 'NumberOfTriggersInPhase', - x00540220: 'ViewCodeSequence', - x00540222: 'ViewModifierCodeSequence', - x00540300: 'RadionuclideCodeSequence', - x00540302: 'AdministrationRouteCodeSequence', - x00540304: 'RadiopharmaceuticalCodeSequence', - x00540306: 'CalibrationDataSequence', - x00540308: 'EnergyWindowNumber', - x00540400: 'ImageID', - x00540410: 'PatientOrientationCodeSequence', - x00540412: 'PatientOrientationModifierCodeSeq', - x00540414: 'PatientGantryRelationshipCodeSeq', - x00540500: 'SliceProgressionDirection', - x00541000: 'SeriesType', - x00541001: 'Units', - x00541002: 'CountsSource', - x00541004: 'ReprojectionMethod', - x00541100: 'RandomsCorrectionMethod', - x00541101: 'AttenuationCorrectionMethod', - x00541102: 'DecayCorrection', - x00541103: 'ReconstructionMethod', - x00541104: 'DetectorLinesOfResponseUsed', - x00541105: 'ScatterCorrectionMethod', - x00541200: 'AxialAcceptance', - x00541201: 'AxialMash', - x00541202: 'TransverseMash', - x00541203: 'DetectorElementSize', - x00541210: 'CoincidenceWindowWidth', - x00541220: 'SecondaryCountsType', - x00541300: 'FrameReferenceTime', - x00541310: 'PrimaryCountsAccumulated', - x00541311: 'SecondaryCountsAccumulated', - x00541320: 'SliceSensitivityFactor', - x00541321: 'DecayFactor', - x00541322: 'DoseCalibrationFactor', - x00541323: 'ScatterFractionFactor', - x00541324: 'DeadTimeFactor', - x00541330: 'ImageIndex', - x00541400: 'CountsIncluded', - x00541401: 'DeadTimeCorrectionFlag', - x00603000: 'HistogramSequence', - x00603002: 'HistogramNumberOfBins', - x00603004: 'HistogramFirstBinValue', - x00603006: 'HistogramLastBinValue', - x00603008: 'HistogramBinWidth', - x00603010: 'HistogramExplanation', - x00603020: 'HistogramData', - x00620001: 'SegmentationType', - x00620002: 'SegmentSequence', - x00620003: 'SegmentedPropertyCategoryCodeSeq', - x00620004: 'SegmentNumber', - x00620005: 'SegmentLabel', - x00620006: 'SegmentDescription', - x00620008: 'SegmentAlgorithmType', - x00620009: 'SegmentAlgorithmName', - x0062000a: 'SegmentIdentificationSequence', - x0062000b: 'ReferencedSegmentNumber', - x0062000c: 'RecommendedDisplayGrayscaleValue', - x0062000d: 'RecommendedDisplayCIELabValue', - x0062000e: 'MaximumFractionalValue', - x0062000f: 'SegmentedPropertyTypeCodeSequence', - x00620010: 'SegmentationFractionalType', - x00640002: 'DeformableRegistrationSequence', - x00640003: 'SourceFrameOfReferenceUID', - x00640005: 'DeformableRegistrationGridSequence', - x00640007: 'GridDimensions', - x00640008: 'GridResolution', - x00640009: 'VectorGridData', - x0064000f: 'PreDeformationMatrixRegistSeq', - x00640010: 'PostDeformationMatrixRegistSeq', - x00660001: 'NumberOfSurfaces', - x00660002: 'SurfaceSequence', - x00660003: 'SurfaceNumber', - x00660004: 'SurfaceComments', - x00660009: 'SurfaceProcessing', - x0066000a: 'SurfaceProcessingRatio', - x0066000e: 'FiniteVolume', - x00660010: 'Manifold', - x00660011: 'SurfacePointsSequence', - x00660015: 'NumberOfSurfacePoints', - x00660016: 'PointCoordinatesData', - x00660017: 'PointPositionAccuracy', - x00660018: 'MeanPointDistance', - x00660019: 'MaximumPointDistance', - x0066001b: 'AxisOfRotation', - x0066001c: 'CenterOfRotation', - x0066001e: 'NumberOfVectors', - x0066001f: 'VectorDimensionality', - x00660020: 'VectorAccuracy', - x00660021: 'VectorCoordinateData', - x00660023: 'TrianglePointIndexList', - x00660024: 'EdgePointIndexList', - x00660025: 'VertexPointIndexList', - x00660026: 'TriangleStripSequence', - x00660027: 'TriangleFanSequence', - x00660028: 'LineSequence', - x00660029: 'PrimitivePointIndexList', - x0066002a: 'SurfaceCount', - x0066002f: 'AlgorithmFamilyCodeSequ', - x00660031: 'AlgorithmVersion', - x00660032: 'AlgorithmParameters', - x00660034: 'FacetSequence', - x00660036: 'AlgorithmName', - x00700001: 'GraphicAnnotationSequence', - x00700002: 'GraphicLayer', - x00700003: 'BoundingBoxAnnotationUnits', - x00700004: 'AnchorPointAnnotationUnits', - x00700005: 'GraphicAnnotationUnits', - x00700006: 'UnformattedTextValue', - x00700008: 'TextObjectSequence', - x00700009: 'GraphicObjectSequence', - x00700010: 'BoundingBoxTopLeftHandCorner', - x00700011: 'BoundingBoxBottomRightHandCorner', - x00700012: 'BoundingBoxTextHorizJustification', - x00700014: 'AnchorPoint', - x00700015: 'AnchorPointVisibility', - x00700020: 'GraphicDimensions', - x00700021: 'NumberOfGraphicPoints', - x00700022: 'GraphicData', - x00700023: 'GraphicType', - x00700024: 'GraphicFilled', - x00700040: 'ImageRotationRetired', - x00700041: 'ImageHorizontalFlip', - x00700042: 'ImageRotation', - x00700050: 'DisplayedAreaTopLeftTrial', - x00700051: 'DisplayedAreaBottomRightTrial', - x00700052: 'DisplayedAreaTopLeft', - x00700053: 'DisplayedAreaBottomRight', - x0070005a: 'DisplayedAreaSelectionSequence', - x00700060: 'GraphicLayerSequence', - x00700062: 'GraphicLayerOrder', - x00700066: 'GraphicLayerRecDisplayGraysclValue', - x00700067: 'GraphicLayerRecDisplayRGBValue', - x00700068: 'GraphicLayerDescription', - x00700080: 'ContentLabel', - x00700081: 'ContentDescription', - x00700082: 'PresentationCreationDate', - x00700083: 'PresentationCreationTime', - x00700084: 'ContentCreatorName', - x00700086: 'ContentCreatorIDCodeSequence', - x00700100: 'PresentationSizeMode', - x00700101: 'PresentationPixelSpacing', - x00700102: 'PresentationPixelAspectRatio', - x00700103: 'PresentationPixelMagRatio', - x00700306: 'ShapeType', - x00700308: 'RegistrationSequence', - x00700309: 'MatrixRegistrationSequence', - x0070030a: 'MatrixSequence', - x0070030c: 'FrameOfRefTransformationMatrixType', - x0070030d: 'RegistrationTypeCodeSequence', - x0070030f: 'FiducialDescription', - x00700310: 'FiducialIdentifier', - x00700311: 'FiducialIdentifierCodeSequence', - x00700312: 'ContourUncertaintyRadius', - x00700314: 'UsedFiducialsSequence', - x00700318: 'GraphicCoordinatesDataSequence', - x0070031a: 'FiducialUID', - x0070031c: 'FiducialSetSequence', - x0070031e: 'FiducialSequence', - x00700401: 'GraphicLayerRecomDisplayCIELabVal', - x00700402: 'BlendingSequence', - x00700403: 'RelativeOpacity', - x00700404: 'ReferencedSpatialRegistrationSeq', - x00700405: 'BlendingPosition', - x00720002: 'HangingProtocolName', - x00720004: 'HangingProtocolDescription', - x00720006: 'HangingProtocolLevel', - x00720008: 'HangingProtocolCreator', - x0072000a: 'HangingProtocolCreationDateTime', - x0072000c: 'HangingProtocolDefinitionSequence', - x0072000e: 'HangingProtocolUserIDCodeSequence', - x00720010: 'HangingProtocolUserGroupName', - x00720012: 'SourceHangingProtocolSequence', - x00720014: 'NumberOfPriorsReferenced', - x00720020: 'ImageSetsSequence', - x00720022: 'ImageSetSelectorSequence', - x00720024: 'ImageSetSelectorUsageFlag', - x00720026: 'SelectorAttribute', - x00720028: 'SelectorValueNumber', - x00720030: 'TimeBasedImageSetsSequence', - x00720032: 'ImageSetNumber', - x00720034: 'ImageSetSelectorCategory', - x00720038: 'RelativeTime', - x0072003a: 'RelativeTimeUnits', - x0072003c: 'AbstractPriorValue', - x0072003e: 'AbstractPriorCodeSequence', - x00720040: 'ImageSetLabel', - x00720050: 'SelectorAttributeVR', - x00720052: 'SelectorSequencePointer', - x00720054: 'SelectorSeqPointerPrivateCreator', - x00720056: 'SelectorAttributePrivateCreator', - x00720060: 'SelectorATValue', - x00720062: 'SelectorCSValue', - x00720064: 'SelectorISValue', - x00720066: 'SelectorLOValue', - x00720068: 'SelectorLTValue', - x0072006a: 'SelectorPNValue', - x0072006c: 'SelectorSHValue', - x0072006e: 'SelectorSTValue', - x00720070: 'SelectorUTValue', - x00720072: 'SelectorDSValue', - x00720074: 'SelectorFDValue', - x00720076: 'SelectorFLValue', - x00720078: 'SelectorULValue', - x0072007a: 'SelectorUSValue', - x0072007c: 'SelectorSLValue', - x0072007e: 'SelectorSSValue', - x00720080: 'SelectorCodeSequenceValue', - x00720100: 'NumberOfScreens', - x00720102: 'NominalScreenDefinitionSequence', - x00720104: 'NumberOfVerticalPixels', - x00720106: 'NumberOfHorizontalPixels', - x00720108: 'DisplayEnvironmentSpatialPosition', - x0072010a: 'ScreenMinimumGrayscaleBitDepth', - x0072010c: 'ScreenMinimumColorBitDepth', - x0072010e: 'ApplicationMaximumRepaintTime', - x00720200: 'DisplaySetsSequence', - x00720202: 'DisplaySetNumber', - x00720203: 'DisplaySetLabel', - x00720204: 'DisplaySetPresentationGroup', - x00720206: 'DisplaySetPresentationGroupDescr', - x00720208: 'PartialDataDisplayHandling', - x00720210: 'SynchronizedScrollingSequence', - x00720212: 'DisplaySetScrollingGroup', - x00720214: 'NavigationIndicatorSequence', - x00720216: 'NavigationDisplaySet', - x00720218: 'ReferenceDisplaySets', - x00720300: 'ImageBoxesSequence', - x00720302: 'ImageBoxNumber', - x00720304: 'ImageBoxLayoutType', - x00720306: 'ImageBoxTileHorizontalDimension', - x00720308: 'ImageBoxTileVerticalDimension', - x00720310: 'ImageBoxScrollDirection', - x00720312: 'ImageBoxSmallScrollType', - x00720314: 'ImageBoxSmallScrollAmount', - x00720316: 'ImageBoxLargeScrollType', - x00720318: 'ImageBoxLargeScrollAmount', - x00720320: 'ImageBoxOverlapPriority', - x00720330: 'CineRelativeToRealTime', - x00720400: 'FilterOperationsSequence', - x00720402: 'FilterByCategory', - x00720404: 'FilterByAttributePresence', - x00720406: 'FilterByOperator', - x00720432: 'SynchronizedImageBoxList', - x00720434: 'TypeOfSynchronization', - x00720500: 'BlendingOperationType', - x00720510: 'ReformattingOperationType', - x00720512: 'ReformattingThickness', - x00720514: 'ReformattingInterval', - x00720516: 'ReformattingOpInitialViewDir', - x00720520: 'RenderingType3D', - x00720600: 'SortingOperationsSequence', - x00720602: 'SortByCategory', - x00720604: 'SortingDirection', - x00720700: 'DisplaySetPatientOrientation', - x00720702: 'VOIType', - x00720704: 'PseudoColorType', - x00720706: 'ShowGrayscaleInverted', - x00720710: 'ShowImageTrueSizeFlag', - x00720712: 'ShowGraphicAnnotationFlag', - x00720714: 'ShowPatientDemographicsFlag', - x00720716: 'ShowAcquisitionTechniquesFlag', - x00720717: 'DisplaySetHorizontalJustification', - x00720718: 'DisplaySetVerticalJustification', - x00741000: 'UnifiedProcedureStepState', - x00741002: 'UPSProgressInformationSequence', - x00741004: 'UnifiedProcedureStepProgress', - x00741006: 'UnifiedProcedureStepProgressDescr', - x00741008: 'UnifiedProcedureStepComURISeq', - x0074100a: 'ContactURI', - x0074100c: 'ContactDisplayName', - x00741020: 'BeamTaskSequence', - x00741022: 'BeamTaskType', - x00741024: 'BeamOrderIndex', - x00741030: 'DeliveryVerificationImageSequence', - x00741032: 'VerificationImageTiming', - x00741034: 'DoubleExposureFlag', - x00741036: 'DoubleExposureOrdering', - x00741038: 'DoubleExposureMeterset', - x0074103a: 'DoubleExposureFieldDelta', - x00741040: 'RelatedReferenceRTImageSequence', - x00741042: 'GeneralMachineVerificationSequence', - x00741044: 'ConventionalMachineVerificationSeq', - x00741046: 'IonMachineVerificationSequence', - x00741048: 'FailedAttributesSequence', - x0074104a: 'OverriddenAttributesSequence', - x0074104c: 'ConventionalControlPointVerifySeq', - x0074104e: 'IonControlPointVerificationSeq', - x00741050: 'AttributeOccurrenceSequence', - x00741052: 'AttributeOccurrencePointer', - x00741054: 'AttributeItemSelector', - x00741056: 'AttributeOccurrencePrivateCreator', - x00741200: 'ScheduledProcedureStepPriority', - x00741202: 'StudyListLabel', - x00741204: 'ProcedureStepLabel', - x00741210: 'ScheduledProcessingParametersSeq', - x00741212: 'PerformedProcessingParametersSeq', - x00741216: 'UPSPerformedProcedureSequence', - x00741220: 'RelatedProcedureStepSequence', - x00741222: 'ProcedureStepRelationshipType', - x00741230: 'DeletionLock', - x00741234: 'ReceivingAE', - x00741236: 'RequestingAE', - x00741238: 'ReasonForCancellation', - x00741242: 'SCPStatus', - x00741244: 'SubscriptionListStatus', - x00741246: 'UPSListStatus', - x00880130: 'StorageMediaFileSetID', - x00880140: 'StorageMediaFileSetUID', - x00880200: 'IconImageSequence', - x00880904: 'TopicTitle', - x00880906: 'TopicSubject', - x00880910: 'TopicAuthor', - x00880912: 'TopicKeywords', - x01000410: 'SOPInstanceStatus', - x01000420: 'SOPAuthorizationDateAndTime', - x01000424: 'SOPAuthorizationComment', - x01000426: 'AuthorizationEquipmentCertNumber', - x04000005: 'MACIDNumber', - x04000010: 'MACCalculationTransferSyntaxUID', - x04000015: 'MACAlgorithm', - x04000020: 'DataElementsSigned', - x04000100: 'DigitalSignatureUID', - x04000105: 'DigitalSignatureDateTime', - x04000110: 'CertificateType', - x04000115: 'CertificateOfSigner', - x04000120: 'Signature', - x04000305: 'CertifiedTimestampType', - x04000310: 'CertifiedTimestamp', - x04000401: 'DigitalSignaturePurposeCodeSeq', - x04000402: 'ReferencedDigitalSignatureSeq', - x04000403: 'ReferencedSOPInstanceMACSeq', - x04000404: 'MAC', - x04000500: 'EncryptedAttributesSequence', - x04000510: 'EncryptedContentTransferSyntaxUID', - x04000520: 'EncryptedContent', - x04000550: 'ModifiedAttributesSequence', - x04000561: 'OriginalAttributesSequence', - x04000562: 'AttributeModificationDateTime', - x04000563: 'ModifyingSystem', - x04000564: 'SourceOfPreviousValues', - x04000565: 'ReasonForTheAttributeModification', - x1000xxx0: 'EscapeTriplet', - x1000xxx1: 'RunLengthTriplet', - x1000xxx2: 'HuffmanTableSize', - x1000xxx3: 'HuffmanTableTriplet', - x1000xxx4: 'ShiftTableSize', - x1000xxx5: 'ShiftTableTriplet', - x1010xxxx: 'ZonalMap', - x20000010: 'NumberOfCopies', - x2000001e: 'PrinterConfigurationSequence', - x20000020: 'PrintPriority', - x20000030: 'MediumType', - x20000040: 'FilmDestination', - x20000050: 'FilmSessionLabel', - x20000060: 'MemoryAllocation', - x20000061: 'MaximumMemoryAllocation', - x20000062: 'ColorImagePrintingFlag', - x20000063: 'CollationFlag', - x20000065: 'AnnotationFlag', - x20000067: 'ImageOverlayFlag', - x20000069: 'PresentationLUTFlag', - x2000006a: 'ImageBoxPresentationLUTFlag', - x200000a0: 'MemoryBitDepth', - x200000a1: 'PrintingBitDepth', - x200000a2: 'MediaInstalledSequence', - x200000a4: 'OtherMediaAvailableSequence', - x200000a8: 'SupportedImageDisplayFormatSeq', - x20000500: 'ReferencedFilmBoxSequence', - x20000510: 'ReferencedStoredPrintSequence', - x20100010: 'ImageDisplayFormat', - x20100030: 'AnnotationDisplayFormatID', - x20100040: 'FilmOrientation', - x20100050: 'FilmSizeID', - x20100052: 'PrinterResolutionID', - x20100054: 'DefaultPrinterResolutionID', - x20100060: 'MagnificationType', - x20100080: 'SmoothingType', - x201000a6: 'DefaultMagnificationType', - x201000a7: 'OtherMagnificationTypesAvailable', - x201000a8: 'DefaultSmoothingType', - x201000a9: 'OtherSmoothingTypesAvailable', - x20100100: 'BorderDensity', - x20100110: 'EmptyImageDensity', - x20100120: 'MinDensity', - x20100130: 'MaxDensity', - x20100140: 'Trim', - x20100150: 'ConfigurationInformation', - x20100152: 'ConfigurationInformationDescr', - x20100154: 'MaximumCollatedFilms', - x2010015e: 'Illumination', - x20100160: 'ReflectedAmbientLight', - x20100376: 'PrinterPixelSpacing', - x20100500: 'ReferencedFilmSessionSequence', - x20100510: 'ReferencedImageBoxSequence', - x20100520: 'ReferencedBasicAnnotationBoxSeq', - x20200010: 'ImageBoxPosition', - x20200020: 'Polarity', - x20200030: 'RequestedImageSize', - x20200040: 'RequestedDecimate-CropBehavior', - x20200050: 'RequestedResolutionID', - x202000a0: 'RequestedImageSizeFlag', - x202000a2: 'DecimateCropResult', - x20200110: 'BasicGrayscaleImageSequence', - x20200111: 'BasicColorImageSequence', - x20200130: 'ReferencedImageOverlayBoxSequence', - x20200140: 'ReferencedVOILUTBoxSequence', - x20300010: 'AnnotationPosition', - x20300020: 'TextString', - x20400010: 'ReferencedOverlayPlaneSequence', - x20400011: 'ReferencedOverlayPlaneGroups', - x20400020: 'OverlayPixelDataSequence', - x20400060: 'OverlayMagnificationType', - x20400070: 'OverlaySmoothingType', - x20400072: 'OverlayOrImageMagnification', - x20400074: 'MagnifyToNumberOfColumns', - x20400080: 'OverlayForegroundDensity', - x20400082: 'OverlayBackgroundDensity', - x20400090: 'OverlayMode', - x20400100: 'ThresholdDensity', - x20400500: 'ReferencedImageBoxSequenceRetired', - x20500010: 'PresentationLUTSequence', - x20500020: 'PresentationLUTShape', - x20500500: 'ReferencedPresentationLUTSequence', - x21000010: 'PrintJobID', - x21000020: 'ExecutionStatus', - x21000030: 'ExecutionStatusInfo', - x21000040: 'CreationDate', - x21000050: 'CreationTime', - x21000070: 'Originator', - x21000140: 'DestinationAE', - x21000160: 'OwnerID', - x21000170: 'NumberOfFilms', - x21000500: 'ReferencedPrintJobSequencePullStoredPrint', - x21100010: 'PrinterStatus', - x21100020: 'PrinterStatusInfo', - x21100030: 'PrinterName', - x21100099: 'PrintQueueID', - x21200010: 'QueueStatus', - x21200050: 'PrintJobDescriptionSequence', - x21200070: 'ReferencedPrintJobSequence', - x21300010: 'PrintManagementCapabilitiesSeq', - x21300015: 'PrinterCharacteristicsSequence', - x21300030: 'FilmBoxContentSequence', - x21300040: 'ImageBoxContentSequence', - x21300050: 'AnnotationContentSequence', - x21300060: 'ImageOverlayBoxContentSequence', - x21300080: 'PresentationLUTContentSequence', - x213000a0: 'ProposedStudySequence', - x213000c0: 'OriginalImageSequence', - x22000001: 'LabelFromInfoExtractedFromInstance', - x22000002: 'LabelText', - x22000003: 'LabelStyleSelection', - x22000004: 'MediaDisposition', - x22000005: 'BarcodeValue', - x22000006: 'BarcodeSymbology', - x22000007: 'AllowMediaSplitting', - x22000008: 'IncludeNonDICOMObjects', - x22000009: 'IncludeDisplayApplication', - x2200000a: 'SaveCompInstancesAfterMediaCreate', - x2200000b: 'TotalNumberMediaPiecesCreated', - x2200000c: 'RequestedMediaApplicationProfile', - x2200000d: 'ReferencedStorageMediaSequence', - x2200000e: 'FailureAttributes', - x2200000f: 'AllowLossyCompression', - x22000020: 'RequestPriority', - x30020002: 'RTImageLabel', - x30020003: 'RTImageName', - x30020004: 'RTImageDescription', - x3002000a: 'ReportedValuesOrigin', - x3002000c: 'RTImagePlane', - x3002000d: 'XRayImageReceptorTranslation', - x3002000e: 'XRayImageReceptorAngle', - x30020010: 'RTImageOrientation', - x30020011: 'ImagePlanePixelSpacing', - x30020012: 'RTImagePosition', - x30020020: 'RadiationMachineName', - x30020022: 'RadiationMachineSAD', - x30020024: 'RadiationMachineSSD', - x30020026: 'RTImageSID', - x30020028: 'SourceToReferenceObjectDistance', - x30020029: 'FractionNumber', - x30020030: 'ExposureSequence', - x30020032: 'MetersetExposure', - x30020034: 'DiaphragmPosition', - x30020040: 'FluenceMapSequence', - x30020041: 'FluenceDataSource', - x30020042: 'FluenceDataScale', - x30020051: 'FluenceMode', - x30020052: 'FluenceModeID', - x30040001: 'DVHType', - x30040002: 'DoseUnits', - x30040004: 'DoseType', - x30040006: 'DoseComment', - x30040008: 'NormalizationPoint', - x3004000a: 'DoseSummationType', - x3004000c: 'GridFrameOffsetVector', - x3004000e: 'DoseGridScaling', - x30040010: 'RTDoseROISequence', - x30040012: 'DoseValue', - x30040014: 'TissueHeterogeneityCorrection', - x30040040: 'DVHNormalizationPoint', - x30040042: 'DVHNormalizationDoseValue', - x30040050: 'DVHSequence', - x30040052: 'DVHDoseScaling', - x30040054: 'DVHVolumeUnits', - x30040056: 'DVHNumberOfBins', - x30040058: 'DVHData', - x30040060: 'DVHReferencedROISequence', - x30040062: 'DVHROIContributionType', - x30040070: 'DVHMinimumDose', - x30040072: 'DVHMaximumDose', - x30040074: 'DVHMeanDose', - x30060002: 'StructureSetLabel', - x30060004: 'StructureSetName', - x30060006: 'StructureSetDescription', - x30060008: 'StructureSetDate', - x30060009: 'StructureSetTime', - x30060010: 'ReferencedFrameOfReferenceSequence', - x30060012: 'RTReferencedStudySequence', - x30060014: 'RTReferencedSeriesSequence', - x30060016: 'ContourImageSequence', - x30060020: 'StructureSetROISequence', - x30060022: 'ROINumber', - x30060024: 'ReferencedFrameOfReferenceUID', - x30060026: 'ROIName', - x30060028: 'ROIDescription', - x3006002a: 'ROIDisplayColor', - x3006002c: 'ROIVolume', - x30060030: 'RTRelatedROISequence', - x30060033: 'RTROIRelationship', - x30060036: 'ROIGenerationAlgorithm', - x30060038: 'ROIGenerationDescription', - x30060039: 'ROIContourSequence', - x30060040: 'ContourSequence', - x30060042: 'ContourGeometricType', - x30060044: 'ContourSlabThickness', - x30060045: 'ContourOffsetVector', - x30060046: 'NumberOfContourPoints', - x30060048: 'ContourNumber', - x30060049: 'AttachedContours', - x30060050: 'ContourData', - x30060080: 'RTROIObservationsSequence', - x30060082: 'ObservationNumber', - x30060084: 'ReferencedROINumber', - x30060085: 'ROIObservationLabel', - x30060086: 'RTROIIdentificationCodeSequence', - x30060088: 'ROIObservationDescription', - x300600a0: 'RelatedRTROIObservationsSequence', - x300600a4: 'RTROIInterpretedType', - x300600a6: 'ROIInterpreter', - x300600b0: 'ROIPhysicalPropertiesSequence', - x300600b2: 'ROIPhysicalProperty', - x300600b4: 'ROIPhysicalPropertyValue', - x300600b6: 'ROIElementalCompositionSequence', - x300600b7: 'ROIElementalCompAtomicNumber', - x300600b8: 'ROIElementalCompAtomicMassFraction', - x300600c0: 'FrameOfReferenceRelationshipSeq', - x300600c2: 'RelatedFrameOfReferenceUID', - x300600c4: 'FrameOfReferenceTransformType', - x300600c6: 'FrameOfReferenceTransformMatrix', - x300600c8: 'FrameOfReferenceTransformComment', - x30080010: 'MeasuredDoseReferenceSequence', - x30080012: 'MeasuredDoseDescription', - x30080014: 'MeasuredDoseType', - x30080016: 'MeasuredDoseValue', - x30080020: 'TreatmentSessionBeamSequence', - x30080021: 'TreatmentSessionIonBeamSequence', - x30080022: 'CurrentFractionNumber', - x30080024: 'TreatmentControlPointDate', - x30080025: 'TreatmentControlPointTime', - x3008002a: 'TreatmentTerminationStatus', - x3008002b: 'TreatmentTerminationCode', - x3008002c: 'TreatmentVerificationStatus', - x30080030: 'ReferencedTreatmentRecordSequence', - x30080032: 'SpecifiedPrimaryMeterset', - x30080033: 'SpecifiedSecondaryMeterset', - x30080036: 'DeliveredPrimaryMeterset', - x30080037: 'DeliveredSecondaryMeterset', - x3008003a: 'SpecifiedTreatmentTime', - x3008003b: 'DeliveredTreatmentTime', - x30080040: 'ControlPointDeliverySequence', - x30080041: 'IonControlPointDeliverySequence', - x30080042: 'SpecifiedMeterset', - x30080044: 'DeliveredMeterset', - x30080045: 'MetersetRateSet', - x30080046: 'MetersetRateDelivered', - x30080047: 'ScanSpotMetersetsDelivered', - x30080048: 'DoseRateDelivered', - x30080050: 'TreatmentSummaryCalcDoseRefSeq', - x30080052: 'CumulativeDoseToDoseReference', - x30080054: 'FirstTreatmentDate', - x30080056: 'MostRecentTreatmentDate', - x3008005a: 'NumberOfFractionsDelivered', - x30080060: 'OverrideSequence', - x30080061: 'ParameterSequencePointer', - x30080062: 'OverrideParameterPointer', - x30080063: 'ParameterItemIndex', - x30080064: 'MeasuredDoseReferenceNumber', - x30080065: 'ParameterPointer', - x30080066: 'OverrideReason', - x30080068: 'CorrectedParameterSequence', - x3008006a: 'CorrectionValue', - x30080070: 'CalculatedDoseReferenceSequence', - x30080072: 'CalculatedDoseReferenceNumber', - x30080074: 'CalculatedDoseReferenceDescription', - x30080076: 'CalculatedDoseReferenceDoseValue', - x30080078: 'StartMeterset', - x3008007a: 'EndMeterset', - x30080080: 'ReferencedMeasuredDoseReferenceSeq', - x30080082: 'ReferencedMeasuredDoseReferenceNum', - x30080090: 'ReferencedCalculatedDoseRefSeq', - x30080092: 'ReferencedCalculatedDoseRefNumber', - x300800a0: 'BeamLimitingDeviceLeafPairsSeq', - x300800b0: 'RecordedWedgeSequence', - x300800c0: 'RecordedCompensatorSequence', - x300800d0: 'RecordedBlockSequence', - x300800e0: 'TreatmentSummaryMeasuredDoseRefSeq', - x300800f0: 'RecordedSnoutSequence', - x300800f2: 'RecordedRangeShifterSequence', - x300800f4: 'RecordedLateralSpreadingDeviceSeq', - x300800f6: 'RecordedRangeModulatorSequence', - x30080100: 'RecordedSourceSequence', - x30080105: 'SourceSerialNumber', - x30080110: 'TreatmentSessionAppSetupSeq', - x30080116: 'ApplicationSetupCheck', - x30080120: 'RecordedBrachyAccessoryDeviceSeq', - x30080122: 'ReferencedBrachyAccessoryDeviceNum', - x30080130: 'RecordedChannelSequence', - x30080132: 'SpecifiedChannelTotalTime', - x30080134: 'DeliveredChannelTotalTime', - x30080136: 'SpecifiedNumberOfPulses', - x30080138: 'DeliveredNumberOfPulses', - x3008013a: 'SpecifiedPulseRepetitionInterval', - x3008013c: 'DeliveredPulseRepetitionInterval', - x30080140: 'RecordedSourceApplicatorSequence', - x30080142: 'ReferencedSourceApplicatorNumber', - x30080150: 'RecordedChannelShieldSequence', - x30080152: 'ReferencedChannelShieldNumber', - x30080160: 'BrachyControlPointDeliveredSeq', - x30080162: 'SafePositionExitDate', - x30080164: 'SafePositionExitTime', - x30080166: 'SafePositionReturnDate', - x30080168: 'SafePositionReturnTime', - x30080200: 'CurrentTreatmentStatus', - x30080202: 'TreatmentStatusComment', - x30080220: 'FractionGroupSummarySequence', - x30080223: 'ReferencedFractionNumber', - x30080224: 'FractionGroupType', - x30080230: 'BeamStopperPosition', - x30080240: 'FractionStatusSummarySequence', - x30080250: 'TreatmentDate', - x30080251: 'TreatmentTime', - x300a0002: 'RTPlanLabel', - x300a0003: 'RTPlanName', - x300a0004: 'RTPlanDescription', - x300a0006: 'RTPlanDate', - x300a0007: 'RTPlanTime', - x300a0009: 'TreatmentProtocols', - x300a000a: 'PlanIntent', - x300a000b: 'TreatmentSites', - x300a000c: 'RTPlanGeometry', - x300a000e: 'PrescriptionDescription', - x300a0010: 'DoseReferenceSequence', - x300a0012: 'DoseReferenceNumber', - x300a0013: 'DoseReferenceUID', - x300a0014: 'DoseReferenceStructureType', - x300a0015: 'NominalBeamEnergyUnit', - x300a0016: 'DoseReferenceDescription', - x300a0018: 'DoseReferencePointCoordinates', - x300a001a: 'NominalPriorDose', - x300a0020: 'DoseReferenceType', - x300a0021: 'ConstraintWeight', - x300a0022: 'DeliveryWarningDose', - x300a0023: 'DeliveryMaximumDose', - x300a0025: 'TargetMinimumDose', - x300a0026: 'TargetPrescriptionDose', - x300a0027: 'TargetMaximumDose', - x300a0028: 'TargetUnderdoseVolumeFraction', - x300a002a: 'OrganAtRiskFullVolumeDose', - x300a002b: 'OrganAtRiskLimitDose', - x300a002c: 'OrganAtRiskMaximumDose', - x300a002d: 'OrganAtRiskOverdoseVolumeFraction', - x300a0040: 'ToleranceTableSequence', - x300a0042: 'ToleranceTableNumber', - x300a0043: 'ToleranceTableLabel', - x300a0044: 'GantryAngleTolerance', - x300a0046: 'BeamLimitingDeviceAngleTolerance', - x300a0048: 'BeamLimitingDeviceToleranceSeq', - x300a004a: 'BeamLimitingDevicePositionTol', - x300a004b: 'SnoutPositionTolerance', - x300a004c: 'PatientSupportAngleTolerance', - x300a004e: 'TableTopEccentricAngleTolerance', - x300a004f: 'TableTopPitchAngleTolerance', - x300a0050: 'TableTopRollAngleTolerance', - x300a0051: 'TableTopVerticalPositionTolerance', - x300a0052: 'TableTopLongitudinalPositionTol', - x300a0053: 'TableTopLateralPositionTolerance', - x300a0055: 'RTPlanRelationship', - x300a0070: 'FractionGroupSequence', - x300a0071: 'FractionGroupNumber', - x300a0072: 'FractionGroupDescription', - x300a0078: 'NumberOfFractionsPlanned', - x300a0079: 'NumberFractionPatternDigitsPerDay', - x300a007a: 'RepeatFractionCycleLength', - x300a007b: 'FractionPattern', - x300a0080: 'NumberOfBeams', - x300a0082: 'BeamDoseSpecificationPoint', - x300a0084: 'BeamDose', - x300a0086: 'BeamMeterset', - x300a0088: 'BeamDosePointDepth', - x300a0089: 'BeamDosePointEquivalentDepth', - x300a008a: 'BeamDosePointSSD', - x300a00a0: 'NumberOfBrachyApplicationSetups', - x300a00a2: 'BrachyAppSetupDoseSpecPoint', - x300a00a4: 'BrachyApplicationSetupDose', - x300a00b0: 'BeamSequence', - x300a00b2: 'TreatmentMachineName', - x300a00b3: 'PrimaryDosimeterUnit', - x300a00b4: 'SourceAxisDistance', - x300a00b6: 'BeamLimitingDeviceSequence', - x300a00b8: 'RTBeamLimitingDeviceType', - x300a00ba: 'SourceToBeamLimitingDeviceDistance', - x300a00bb: 'IsocenterToBeamLimitingDeviceDist', - x300a00bc: 'NumberOfLeafJawPairs', - x300a00be: 'LeafPositionBoundaries', - x300a00c0: 'BeamNumber', - x300a00c2: 'BeamName', - x300a00c3: 'BeamDescription', - x300a00c4: 'BeamType', - x300a00c6: 'RadiationType', - x300a00c7: 'HighDoseTechniqueType', - x300a00c8: 'ReferenceImageNumber', - x300a00ca: 'PlannedVerificationImageSequence', - x300a00cc: 'ImagingDeviceSpecificAcqParams', - x300a00ce: 'TreatmentDeliveryType', - x300a00d0: 'NumberOfWedges', - x300a00d1: 'WedgeSequence', - x300a00d2: 'WedgeNumber', - x300a00d3: 'WedgeType', - x300a00d4: 'WedgeID', - x300a00d5: 'WedgeAngle', - x300a00d6: 'WedgeFactor', - x300a00d7: 'TotalWedgeTrayWaterEquivThickness', - x300a00d8: 'WedgeOrientation', - x300a00d9: 'IsocenterToWedgeTrayDistance', - x300a00da: 'SourceToWedgeTrayDistance', - x300a00db: 'WedgeThinEdgePosition', - x300a00dc: 'BolusID', - x300a00dd: 'BolusDescription', - x300a00e0: 'NumberOfCompensators', - x300a00e1: 'MaterialID', - x300a00e2: 'TotalCompensatorTrayFactor', - x300a00e3: 'CompensatorSequence', - x300a00e4: 'CompensatorNumber', - x300a00e5: 'CompensatorID', - x300a00e6: 'SourceToCompensatorTrayDistance', - x300a00e7: 'CompensatorRows', - x300a00e8: 'CompensatorColumns', - x300a00e9: 'CompensatorPixelSpacing', - x300a00ea: 'CompensatorPosition', - x300a00eb: 'CompensatorTransmissionData', - x300a00ec: 'CompensatorThicknessData', - x300a00ed: 'NumberOfBoli', - x300a00ee: 'CompensatorType', - x300a00f0: 'NumberOfBlocks', - x300a00f2: 'TotalBlockTrayFactor', - x300a00f3: 'TotalBlockTrayWaterEquivThickness', - x300a00f4: 'BlockSequence', - x300a00f5: 'BlockTrayID', - x300a00f6: 'SourceToBlockTrayDistance', - x300a00f7: 'IsocenterToBlockTrayDistance', - x300a00f8: 'BlockType', - x300a00f9: 'AccessoryCode', - x300a00fa: 'BlockDivergence', - x300a00fb: 'BlockMountingPosition', - x300a00fc: 'BlockNumber', - x300a00fe: 'BlockName', - x300a0100: 'BlockThickness', - x300a0102: 'BlockTransmission', - x300a0104: 'BlockNumberOfPoints', - x300a0106: 'BlockData', - x300a0107: 'ApplicatorSequence', - x300a0108: 'ApplicatorID', - x300a0109: 'ApplicatorType', - x300a010a: 'ApplicatorDescription', - x300a010c: 'CumulativeDoseReferenceCoefficient', - x300a010e: 'FinalCumulativeMetersetWeight', - x300a0110: 'NumberOfControlPoints', - x300a0111: 'ControlPointSequence', - x300a0112: 'ControlPointIndex', - x300a0114: 'NominalBeamEnergy', - x300a0115: 'DoseRateSet', - x300a0116: 'WedgePositionSequence', - x300a0118: 'WedgePosition', - x300a011a: 'BeamLimitingDevicePositionSequence', - x300a011c: 'LeafJawPositions', - x300a011e: 'GantryAngle', - x300a011f: 'GantryRotationDirection', - x300a0120: 'BeamLimitingDeviceAngle', - x300a0121: 'BeamLimitingDeviceRotateDirection', - x300a0122: 'PatientSupportAngle', - x300a0123: 'PatientSupportRotationDirection', - x300a0124: 'TableTopEccentricAxisDistance', - x300a0125: 'TableTopEccentricAngle', - x300a0126: 'TableTopEccentricRotateDirection', - x300a0128: 'TableTopVerticalPosition', - x300a0129: 'TableTopLongitudinalPosition', - x300a012a: 'TableTopLateralPosition', - x300a012c: 'IsocenterPosition', - x300a012e: 'SurfaceEntryPoint', - x300a0130: 'SourceToSurfaceDistance', - x300a0134: 'CumulativeMetersetWeight', - x300a0140: 'TableTopPitchAngle', - x300a0142: 'TableTopPitchRotationDirection', - x300a0144: 'TableTopRollAngle', - x300a0146: 'TableTopRollRotationDirection', - x300a0148: 'HeadFixationAngle', - x300a014a: 'GantryPitchAngle', - x300a014c: 'GantryPitchRotationDirection', - x300a014e: 'GantryPitchAngleTolerance', - x300a0180: 'PatientSetupSequence', - x300a0182: 'PatientSetupNumber', - x300a0183: 'PatientSetupLabel', - x300a0184: 'PatientAdditionalPosition', - x300a0190: 'FixationDeviceSequence', - x300a0192: 'FixationDeviceType', - x300a0194: 'FixationDeviceLabel', - x300a0196: 'FixationDeviceDescription', - x300a0198: 'FixationDevicePosition', - x300a0199: 'FixationDevicePitchAngle', - x300a019a: 'FixationDeviceRollAngle', - x300a01a0: 'ShieldingDeviceSequence', - x300a01a2: 'ShieldingDeviceType', - x300a01a4: 'ShieldingDeviceLabel', - x300a01a6: 'ShieldingDeviceDescription', - x300a01a8: 'ShieldingDevicePosition', - x300a01b0: 'SetupTechnique', - x300a01b2: 'SetupTechniqueDescription', - x300a01b4: 'SetupDeviceSequence', - x300a01b6: 'SetupDeviceType', - x300a01b8: 'SetupDeviceLabel', - x300a01ba: 'SetupDeviceDescription', - x300a01bc: 'SetupDeviceParameter', - x300a01d0: 'SetupReferenceDescription', - x300a01d2: 'TableTopVerticalSetupDisplacement', - x300a01d4: 'TableTopLongitudinalSetupDisplace', - x300a01d6: 'TableTopLateralSetupDisplacement', - x300a0200: 'BrachyTreatmentTechnique', - x300a0202: 'BrachyTreatmentType', - x300a0206: 'TreatmentMachineSequence', - x300a0210: 'SourceSequence', - x300a0212: 'SourceNumber', - x300a0214: 'SourceType', - x300a0216: 'SourceManufacturer', - x300a0218: 'ActiveSourceDiameter', - x300a021a: 'ActiveSourceLength', - x300a0222: 'SourceEncapsulationNomThickness', - x300a0224: 'SourceEncapsulationNomTransmission', - x300a0226: 'SourceIsotopeName', - x300a0228: 'SourceIsotopeHalfLife', - x300a0229: 'SourceStrengthUnits', - x300a022a: 'ReferenceAirKermaRate', - x300a022b: 'SourceStrength', - x300a022c: 'SourceStrengthReferenceDate', - x300a022e: 'SourceStrengthReferenceTime', - x300a0230: 'ApplicationSetupSequence', - x300a0232: 'ApplicationSetupType', - x300a0234: 'ApplicationSetupNumber', - x300a0236: 'ApplicationSetupName', - x300a0238: 'ApplicationSetupManufacturer', - x300a0240: 'TemplateNumber', - x300a0242: 'TemplateType', - x300a0244: 'TemplateName', - x300a0250: 'TotalReferenceAirKerma', - x300a0260: 'BrachyAccessoryDeviceSequence', - x300a0262: 'BrachyAccessoryDeviceNumber', - x300a0263: 'BrachyAccessoryDeviceID', - x300a0264: 'BrachyAccessoryDeviceType', - x300a0266: 'BrachyAccessoryDeviceName', - x300a026a: 'BrachyAccessoryDeviceNomThickness', - x300a026c: 'BrachyAccessoryDevNomTransmission', - x300a0280: 'ChannelSequence', - x300a0282: 'ChannelNumber', - x300a0284: 'ChannelLength', - x300a0286: 'ChannelTotalTime', - x300a0288: 'SourceMovementType', - x300a028a: 'NumberOfPulses', - x300a028c: 'PulseRepetitionInterval', - x300a0290: 'SourceApplicatorNumber', - x300a0291: 'SourceApplicatorID', - x300a0292: 'SourceApplicatorType', - x300a0294: 'SourceApplicatorName', - x300a0296: 'SourceApplicatorLength', - x300a0298: 'SourceApplicatorManufacturer', - x300a029c: 'SourceApplicatorWallNomThickness', - x300a029e: 'SourceApplicatorWallNomTrans', - x300a02a0: 'SourceApplicatorStepSize', - x300a02a2: 'TransferTubeNumber', - x300a02a4: 'TransferTubeLength', - x300a02b0: 'ChannelShieldSequence', - x300a02b2: 'ChannelShieldNumber', - x300a02b3: 'ChannelShieldID', - x300a02b4: 'ChannelShieldName', - x300a02b8: 'ChannelShieldNominalThickness', - x300a02ba: 'ChannelShieldNominalTransmission', - x300a02c8: 'FinalCumulativeTimeWeight', - x300a02d0: 'BrachyControlPointSequence', - x300a02d2: 'ControlPointRelativePosition', - x300a02d4: 'ControlPoint3DPosition', - x300a02d6: 'CumulativeTimeWeight', - x300a02e0: 'CompensatorDivergence', - x300a02e1: 'CompensatorMountingPosition', - x300a02e2: 'SourceToCompensatorDistance', - x300a02e3: 'TotalCompTrayWaterEquivThickness', - x300a02e4: 'IsocenterToCompensatorTrayDistance', - x300a02e5: 'CompensatorColumnOffset', - x300a02e6: 'IsocenterToCompensatorDistances', - x300a02e7: 'CompensatorRelStoppingPowerRatio', - x300a02e8: 'CompensatorMillingToolDiameter', - x300a02ea: 'IonRangeCompensatorSequence', - x300a02eb: 'CompensatorDescription', - x300a0302: 'RadiationMassNumber', - x300a0304: 'RadiationAtomicNumber', - x300a0306: 'RadiationChargeState', - x300a0308: 'ScanMode', - x300a030a: 'VirtualSourceAxisDistances', - x300a030c: 'SnoutSequence', - x300a030d: 'SnoutPosition', - x300a030f: 'SnoutID', - x300a0312: 'NumberOfRangeShifters', - x300a0314: 'RangeShifterSequence', - x300a0316: 'RangeShifterNumber', - x300a0318: 'RangeShifterID', - x300a0320: 'RangeShifterType', - x300a0322: 'RangeShifterDescription', - x300a0330: 'NumberOfLateralSpreadingDevices', - x300a0332: 'LateralSpreadingDeviceSequence', - x300a0334: 'LateralSpreadingDeviceNumber', - x300a0336: 'LateralSpreadingDeviceID', - x300a0338: 'LateralSpreadingDeviceType', - x300a033a: 'LateralSpreadingDeviceDescription', - x300a033c: 'LateralSpreadingDevWaterEquivThick', - x300a0340: 'NumberOfRangeModulators', - x300a0342: 'RangeModulatorSequence', - x300a0344: 'RangeModulatorNumber', - x300a0346: 'RangeModulatorID', - x300a0348: 'RangeModulatorType', - x300a034a: 'RangeModulatorDescription', - x300a034c: 'BeamCurrentModulationID', - x300a0350: 'PatientSupportType', - x300a0352: 'PatientSupportID', - x300a0354: 'PatientSupportAccessoryCode', - x300a0356: 'FixationLightAzimuthalAngle', - x300a0358: 'FixationLightPolarAngle', - x300a035a: 'MetersetRate', - x300a0360: 'RangeShifterSettingsSequence', - x300a0362: 'RangeShifterSetting', - x300a0364: 'IsocenterToRangeShifterDistance', - x300a0366: 'RangeShifterWaterEquivThickness', - x300a0370: 'LateralSpreadingDeviceSettingsSeq', - x300a0372: 'LateralSpreadingDeviceSetting', - x300a0374: 'IsocenterToLateralSpreadingDevDist', - x300a0380: 'RangeModulatorSettingsSequence', - x300a0382: 'RangeModulatorGatingStartValue', - x300a0384: 'RangeModulatorGatingStopValue', - x300a038a: 'IsocenterToRangeModulatorDistance', - x300a0390: 'ScanSpotTuneID', - x300a0392: 'NumberOfScanSpotPositions', - x300a0394: 'ScanSpotPositionMap', - x300a0396: 'ScanSpotMetersetWeights', - x300a0398: 'ScanningSpotSize', - x300a039a: 'NumberOfPaintings', - x300a03a0: 'IonToleranceTableSequence', - x300a03a2: 'IonBeamSequence', - x300a03a4: 'IonBeamLimitingDeviceSequence', - x300a03a6: 'IonBlockSequence', - x300a03a8: 'IonControlPointSequence', - x300a03aa: 'IonWedgeSequence', - x300a03ac: 'IonWedgePositionSequence', - x300a0401: 'ReferencedSetupImageSequence', - x300a0402: 'SetupImageComment', - x300a0410: 'MotionSynchronizationSequence', - x300a0412: 'ControlPointOrientation', - x300a0420: 'GeneralAccessorySequence', - x300a0421: 'GeneralAccessoryID', - x300a0422: 'GeneralAccessoryDescription', - x300a0423: 'GeneralAccessoryType', - x300a0424: 'GeneralAccessoryNumber', - x300c0002: 'ReferencedRTPlanSequence', - x300c0004: 'ReferencedBeamSequence', - x300c0006: 'ReferencedBeamNumber', - x300c0007: 'ReferencedReferenceImageNumber', - x300c0008: 'StartCumulativeMetersetWeight', - x300c0009: 'EndCumulativeMetersetWeight', - x300c000a: 'ReferencedBrachyAppSetupSeq', - x300c000c: 'ReferencedBrachyAppSetupNumber', - x300c000e: 'ReferencedSourceNumber', - x300c0020: 'ReferencedFractionGroupSequence', - x300c0022: 'ReferencedFractionGroupNumber', - x300c0040: 'ReferencedVerificationImageSeq', - x300c0042: 'ReferencedReferenceImageSequence', - x300c0050: 'ReferencedDoseReferenceSequence', - x300c0051: 'ReferencedDoseReferenceNumber', - x300c0055: 'BrachyReferencedDoseReferenceSeq', - x300c0060: 'ReferencedStructureSetSequence', - x300c006a: 'ReferencedPatientSetupNumber', - x300c0080: 'ReferencedDoseSequence', - x300c00a0: 'ReferencedToleranceTableNumber', - x300c00b0: 'ReferencedBolusSequence', - x300c00c0: 'ReferencedWedgeNumber', - x300c00d0: 'ReferencedCompensatorNumber', - x300c00e0: 'ReferencedBlockNumber', - x300c00f0: 'ReferencedControlPointIndex', - x300c00f2: 'ReferencedControlPointSequence', - x300c00f4: 'ReferencedStartControlPointIndex', - x300c00f6: 'ReferencedStopControlPointIndex', - x300c0100: 'ReferencedRangeShifterNumber', - x300c0102: 'ReferencedLateralSpreadingDevNum', - x300c0104: 'ReferencedRangeModulatorNumber', - x300e0002: 'ApprovalStatus', - x300e0004: 'ReviewDate', - x300e0005: 'ReviewTime', - x300e0008: 'ReviewerName', - x40000000: 'TextGroupLength', - x40000010: 'Arbitrary', - x40004000: 'TextComments', - x40080040: 'ResultsID', - x40080042: 'ResultsIDIssuer', - x40080050: 'ReferencedInterpretationSequence', - x40080100: 'InterpretationRecordedDate', - x40080101: 'InterpretationRecordedTime', - x40080102: 'InterpretationRecorder', - x40080103: 'ReferenceToRecordedSound', - x40080108: 'InterpretationTranscriptionDate', - x40080109: 'InterpretationTranscriptionTime', - x4008010a: 'InterpretationTranscriber', - x4008010b: 'InterpretationText', - x4008010c: 'InterpretationAuthor', - x40080111: 'InterpretationApproverSequence', - x40080112: 'InterpretationApprovalDate', - x40080113: 'InterpretationApprovalTime', - x40080114: 'PhysicianApprovingInterpretation', - x40080115: 'InterpretationDiagnosisDescription', - x40080117: 'InterpretationDiagnosisCodeSeq', - x40080118: 'ResultsDistributionListSequence', - x40080119: 'DistributionName', - x4008011a: 'DistributionAddress', - x40080200: 'InterpretationID', - x40080202: 'InterpretationIDIssuer', - x40080210: 'InterpretationTypeID', - x40080212: 'InterpretationStatusID', - x40080300: 'Impressions', - x40084000: 'ResultsComments', - x4ffe0001: 'MACParametersSequence', - x50xx0005: 'CurveDimensions', - x50xx0010: 'NumberOfPoints', - x50xx0020: 'TypeOfData', - x50xx0022: 'CurveDescription', - x50xx0030: 'AxisUnits', - x50xx0040: 'AxisLabels', - x50xx0103: 'DataValueRepresentation', - x50xx0104: 'MinimumCoordinateValue', - x50xx0105: 'MaximumCoordinateValue', - x50xx0106: 'CurveRange', - x50xx0110: 'CurveDataDescriptor', - x50xx0112: 'CoordinateStartValue', - x50xx0114: 'CoordinateStepValue', - x50xx1001: 'CurveActivationLayer', - x50xx2000: 'AudioType', - x50xx2002: 'AudioSampleFormat', - x50xx2004: 'NumberOfChannels', - x50xx2006: 'NumberOfSamples', - x50xx2008: 'SampleRate', - x50xx200a: 'TotalTime', - x50xx200c: 'AudioSampleData', - x50xx200e: 'AudioComments', - x50xx2500: 'CurveLabel', - x50xx2600: 'CurveReferencedOverlaySequence', - x50xx2610: 'ReferencedOverlayGroup', - x50xx3000: 'CurveData', - x52009229: 'SharedFunctionalGroupsSequence', - x52009230: 'PerFrameFunctionalGroupsSequence', - x54000100: 'WaveformSequence', - x54000110: 'ChannelMinimumValue', - x54000112: 'ChannelMaximumValue', - x54001004: 'WaveformBitsAllocated', - x54001006: 'WaveformSampleInterpretation', - x5400100a: 'WaveformPaddingValue', - x54001010: 'WaveformData', - x56000010: 'FirstOrderPhaseCorrectionAngle', - x56000020: 'SpectroscopyData', - x60000000: 'OverlayGroupLength', - x60xx0010: 'OverlayRows', - x60xx0011: 'OverlayColumns', - x60xx0012: 'OverlayPlanes', - x60xx0015: 'NumberOfFramesInOverlay', - x60xx0022: 'OverlayDescription', - x60xx0040: 'OverlayType', - x60xx0045: 'OverlaySubtype', - x60xx0050: 'OverlayOrigin', - x60xx0051: 'ImageFrameOrigin', - x60xx0052: 'OverlayPlaneOrigin', - x60xx0060: 'OverlayCompressionCode', - x60xx0061: 'OverlayCompressionOriginator', - x60xx0062: 'OverlayCompressionLabel', - x60xx0063: 'OverlayCompressionDescription', - x60xx0066: 'OverlayCompressionStepPointers', - x60xx0068: 'OverlayRepeatInterval', - x60xx0069: 'OverlayBitsGrouped', - x60xx0100: 'OverlayBitsAllocated', - x60xx0102: 'OverlayBitPosition', - x60xx0110: 'OverlayFormat', - x60xx0200: 'OverlayLocation', - x60xx0800: 'OverlayCodeLabel', - x60xx0802: 'OverlayNumberOfTables', - x60xx0803: 'OverlayCodeTableLocation', - x60xx0804: 'OverlayBitsForCodeWord', - x60xx1001: 'OverlayActivationLayer', - x60xx1100: 'OverlayDescriptorGray', - x60xx1101: 'OverlayDescriptorRed', - x60xx1102: 'OverlayDescriptorGreen', - x60xx1103: 'OverlayDescriptorBlue', - x60xx1200: 'OverlaysGray', - x60xx1201: 'OverlaysRed', - x60xx1202: 'OverlaysGreen', - x60xx1203: 'OverlaysBlue', - x60xx1301: 'ROIArea', - x60xx1302: 'ROIMean', - x60xx1303: 'ROIStandardDeviation', - x60xx1500: 'OverlayLabel', - x60xx3000: 'OverlayData', - x60xx4000: 'OverlayComments', - x7fxx0000: 'PixelDataGroupLength', - x7fxx0010: 'PixelData', - x7fxx0011: 'VariableNextDataGroup', - x7fxx0020: 'VariableCoefficientsSDVN', - x7fxx0030: 'VariableCoefficientsSDHN', - x7fxx0040: 'VariableCoefficientsSDDN', - xfffafffa: 'DigitalSignaturesSequence', - xfffcfffc: 'DataSetTrailingPadding', - xfffee000: 'StartOfItem', - xfffee00d: 'EndOfItems', - xfffee0dd: 'EndOfSequence' -}; - -DICOMTagDescriptions.init(initialTagDescriptionMap); - -// Discard original map... -initialTagDescriptionMap = null; - -export { DICOMTagDescriptions }; diff --git a/Packages/ohif-viewerbase/client/lib/StackManager.js b/Packages/ohif-viewerbase/client/lib/StackManager.js deleted file mode 100644 index 21b0245cb..000000000 --- a/Packages/ohif-viewerbase/client/lib/StackManager.js +++ /dev/null @@ -1,148 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; -import { getImageId } from './getImageId'; -import { OHIFError } from './classes/OHIFError'; - -let stackMap = {}; -let configuration = {}; -const stackUpdatedCallbacks = []; - -/** - * Loop through the current series and add metadata to the - * Cornerstone meta data provider. This will be used to fill information - * into the viewport overlays, and to calculate reference lines and orientation markers - * @param {Object} stackMap stackMap object - * @param {Object} study Study object - * @param {Object} displaySet The set of images to make the stack from - * @return {Array} Array with image IDs - */ -function createAndAddStack(stackMap, study, displaySet) { - const metadataProvider = OHIF.viewer.metadataProvider; - const numImages = displaySet.images.length; - const imageIds = []; - let imageId; - - displaySet.images.forEach((instance, imageIndex) => { - const image = instance.getData(); - const metaData = { - instance: image, // in this context, instance will be the data of the InstanceMetadata object... - series: displaySet, // TODO: Check this - study, - numImages, - imageIndex: imageIndex + 1 - }; - - const numberOfFrames = image.numberOfFrames; - if (numberOfFrames > 1) { - OHIF.log.info('Multiframe image detected'); - for (let i = 0; i < numberOfFrames; i++) { - metaData.frameNumber = i; - imageId = getImageId(image, i); - imageIds.push(imageId); - metadataProvider.addMetadata(imageId, metaData); - } - } else { - metaData.frameNumber = 1; - imageId = getImageId(image); - imageIds.push(imageId); - metadataProvider.addMetadata(imageId, metaData); - } - }); - - const stack = { - displaySetInstanceUid: displaySet.displaySetInstanceUid, - imageIds, - frameRate: displaySet.frameRate, - isClip: displaySet.isClip - }; - - stackMap[displaySet.displaySetInstanceUid] = stack; - - return stack; -} - -configuration = { - createAndAddStack -}; - -/** - * This object contains all the functions needed for interacting with the stack manager. - * Generally, findStack is the only function used. If you want to know when new stacks - * come in, you can register a callback with addStackUpdatedCallback. - */ -const StackManager = { - /** - * Removes all current stacks - */ - clearStacks() { - stackMap = {}; - }, - /** - * Create a stack from an image set, as well as add in the metadata on a per image bases. - * @param study The study who's metadata will be added - * @param displaySet The set of images to make the stack from - * @return {Array} Array with image IDs - */ - makeAndAddStack(study, displaySet) { - return configuration.createAndAddStack(stackMap, study, displaySet, stackUpdatedCallbacks); - }, - /** - * Find a stack from the currently created stacks. - * @param displaySetInstanceUid The UID of the stack to find. - * @returns {*} undefined if not found, otherwise the stack object is returned. - */ - findStack(displaySetInstanceUid) { - return stackMap[displaySetInstanceUid]; - }, - /** - * Find a stack or reate one if it has not been created yet - * @param study The study who's metadata will be added - * @param displaySet The set of images to make the stack from - * @return {Array} Array with image IDs - */ - findOrCreateStack(study, displaySet) { - let stack = this.findStack(displaySet.displaySetInstanceUid); - - if (!stack || !stack.imageIds) { - stack = this.makeAndAddStack(study, displaySet); - } - - return stack; - }, - /** - * Gets the underlying map of displaySetInstanceUid to stack object. - * WARNING: Do not change this object. It directly affects the manager. - * @returns {{}} map of displaySetInstanceUid -> stack. - */ - getAllStacks() { - return stackMap; - }, - /** - * Adds in a callback to be called on a stack being added / updated. - * @param callback must accept at minimum one argument, - * which is the stack that was added / updated. - */ - addStackUpdatedCallback(callback) { - if (typeof callback !== 'function') { - throw new OHIFError('callback must be provided as a function'); - } - stackUpdatedCallbacks.push(callback); - }, - /** - * Return configuration - */ - getConfiguration() { - return configuration; - }, - /** - * Set configuration, in order to provide compatibility - * with other systems by overriding this functions - * @param {Object} config object with functions to be overrided - * - * For now, only makeAndAddStack can be overrided - */ - setConfiguration(config) { - configuration = config; - } -}; - -export { StackManager }; diff --git a/Packages/ohif-viewerbase/client/lib/WLPresets.js b/Packages/ohif-viewerbase/client/lib/WLPresets.js deleted file mode 100644 index 37ebc452f..000000000 --- a/Packages/ohif-viewerbase/client/lib/WLPresets.js +++ /dev/null @@ -1,225 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Session } from 'meteor/session'; -import { Tracker } from 'meteor/tracker'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone } from 'meteor/ohif:cornerstone'; -import { viewportUtils } from './viewportUtils'; - -const WL_PRESET_CUSTOM = 'WL_PRESET_CUSTOM'; -const WL_PRESET_DEFAULT = 'WL_PRESET_DEFAULT'; -const WL_STORAGE_KEY = `WindowLevelPresetsDefinitions`; - -OHIF.viewer.defaultWLPresets = { - 0: { - id: 'Soft Tissue', - wc: 40, - ww: 400 - }, - 1: { - id: 'Lung', - wc: -600, - ww: 1500 - }, - 2: { - id: 'Liver', - wc: 90, - ww: 150 - }, - 3: { - id: 'Bone', - wc: 480, - ww: 2500 - }, - 4: { - id: 'Brain', - wc: 40, - ww: 80 - }, - 5: {}, - 6: {}, - 7: {}, - 8: {}, - 9: {} -}; - -class WindowLevelPresetsManager { - constructor() { - this.defaults = {}; - this.retrieveFunction = null; - this.storeFunction = null; - this.changeObserver = new Tracker.Dependency(); - } - - setRetrieveFunction(retrieveFunction) { - this.retrieveFunction = retrieveFunction; - } - - setStoreFunction(storeFunction) { - this.storeFunction = storeFunction; - } - - /** - * Updates the enabledElement data for the Cornerstone element - * to reflect the current W/L preset which is applied. - * - * @param {HTMLElement} element - */ - updateElementWLPresetData(element) { - const wlPresetData = cornerstone.getElementData(element, 'wlPreset'); - const enabledElement = cornerstone.getEnabledElement(element); - const { viewport, image } = enabledElement; - const { windowCenter, windowWidth } = viewport.voi; - let presetName; - - if (windowWidth === image.windowWidth && windowCenter === image.windowCenter) { - presetName = WL_PRESET_DEFAULT; - } else { - const WLPresets = OHIF.viewer.wlPresets; - - const currentPreset = Object.values(WLPresets).find(currentPreset => { - return (windowCenter === currentPreset.wc && - windowWidth === currentPreset.ww); - }); - - if (currentPreset) { - presetName = currentPreset.id; - } else { - presetName = WL_PRESET_CUSTOM; - } - } - - wlPresetData.name = presetName; - wlPresetData.ww = windowWidth; - wlPresetData.wc = windowCenter; - - if (wlPresetData.name === WL_PRESET_CUSTOM) { - const custom = wlPresetData.custom || (wlPresetData.custom = Object.create(null)); - custom.ww = windowWidth; - custom.wc = windowCenter; - } - } - - /** - * Set specified W/L preset on given element on fallback to default W/L preset if the specified preset is not valid. - * @param {String} presetName The desired W/L preset to be applied - * @param {HTMLElement} element An enabled viewport DOM Element. - */ - applyWLPreset(presetName, element) { - const wlPresets = OHIF.viewer.wlPresets; - const wlPresetData = cornerstone.getElementData(element, 'wlPreset'); - const viewport = cornerstone.getViewport(element); - - const preset = wlPresets[presetName] || _.findWhere(wlPresets, { id: presetName }); - if (presetName === WL_PRESET_CUSTOM && wlPresetData.custom) { - viewport.voi.windowWidth = wlPresetData.custom.ww; - viewport.voi.windowCenter = wlPresetData.custom.wc; - } else if (preset && !_.isEmpty(preset) && preset.id) { - presetName = preset.id; - viewport.voi.windowWidth = preset.ww; - viewport.voi.windowCenter = preset.wc; - } else { - const enabledElement = cornerstone.getEnabledElement(element); - viewport.voi.windowWidth = enabledElement.image.windowWidth; - viewport.voi.windowCenter = enabledElement.image.windowCenter; - presetName = WL_PRESET_DEFAULT; - } - - wlPresetData.name = presetName; - wlPresetData.ww = viewport.voi.windowWidth; - wlPresetData.wc = viewport.voi.windowCenter; - - // Update the viewport - cornerstone.setViewport(element, viewport); - - // Notify other components about W/L Preset changes - Session.set('OHIFWlPresetApplied', presetName); - } - - store(wlPresets) { - return new Promise((resolve, reject) => { - if (this.storeFunction) { - this.storeFunction.call(this, WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject); - } else if (OHIF.user.userLoggedIn()) { - OHIF.user.setData(WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject); - } else { - Session.setPersistent(WL_STORAGE_KEY, wlPresets); - resolve(); - } - }).then(() => this.setOHIFWLPresets.call(this, wlPresets)); - } - - retrieve() { - return new Promise((resolve, reject) => { - if (this.retrieveFunction) { - this.retrieveFunction.call(this).then(resolve).catch(reject); - } else if (OHIF.user.userLoggedIn()) { - try { - resolve(OHIF.user.getData(WL_STORAGE_KEY)); - } catch(error) { - reject(error); - } - } else { - resolve(Session.get(WL_STORAGE_KEY)); - } - }); - } - - load() { - return new Promise((resolve, reject) => { - this.retrieve().then(wlPresets => { - if (wlPresets) { - this.setOHIFWLPresets.call(this, wlPresets); - } else { - this.loadDefaults.call(this); - } - }).catch(() => this.loadDefaults.call(this)); - }); - } - - applyWLPresetToActiveElement(presetName) { - const element = viewportUtils.getActiveViewportElement(); - if (!element) { - return; - } - - this.applyWLPreset(presetName, element); - } - - /** - * Overrides OHIF's wlPresets - * @param {Object} wlPresets Object with wlPresets mapping - */ - setOHIFWLPresets(wlPresets) { - const hasOwn = Object.prototype.hasOwnProperty; - const presetMap = Object.create(null); // Objects without prototype have much faster lookup times - for (let index in wlPresets) { - if (hasOwn.call(wlPresets, index)) { - presetMap[index] = wlPresets[index]; - } - } - - OHIF.viewer.wlPresets = presetMap; - this.changeObserver.changed(); - } - - loadDefaults() { - this.setOHIFWLPresets(OHIF.viewer.defaultWLPresets); - } - - resetDefaults() { - return this.store(OHIF.viewer.defaultWLPresets); - } -} - -/** - * Export functions inside WLPresets namespace. - */ -const WLPresets = new WindowLevelPresetsManager(); - -Meteor.startup(() => { - WLPresets.loadDefaults(); - WLPresets.load(); -}); - -export { WLPresets }; diff --git a/Packages/ohif-viewerbase/client/lib/annotateTextUtils.js b/Packages/ohif-viewerbase/client/lib/annotateTextUtils.js deleted file mode 100644 index bd7679c0e..000000000 --- a/Packages/ohif-viewerbase/client/lib/annotateTextUtils.js +++ /dev/null @@ -1,124 +0,0 @@ -import { viewportUtils } from './viewportUtils'; - -const getTextCallback = doneChangingTextCallback => { - // This handles the text entry for the annotation tool - const keyPressHandler = e => { - // If Enter or Esc are pressed, close the dialog - if (e.which === 13 || e.which === 27) { - closeHandler(); - } - }; - - const closeHandler = () => { - dialog.get(0).close(); - doneChangingTextCallback(getTextInput.val()); - // Reset the text value - getTextInput.val(''); - - // Reset the focus to the active viewport element - // This makes the mobile Safari keyboard close - const element = viewportUtils.getActiveViewportElement(); - $(element).focus(); - }; - - const dialog = $('#annotationDialog'); - if (dialog.get(0).open === true) { - return; - } - - const getTextInput = $('.annotationTextInput'); - - // Focus on the text input to open the Safari keyboard - getTextInput.focus(); - - dialog.get(0).showModal(); - - const confirm = dialog.find('.annotationDialogConfirm'); - confirm.off('click'); - confirm.on('click', () => { - closeHandler(); - }); - - // Use keydown since keypress doesn't handle ESC in Chrome - dialog.off('keydown'); - dialog.on('keydown', keyPressHandler); -}; - -const changeTextCallback = (data, eventData, doneChangingTextCallback) => { - const dialog = $('#relabelAnnotationDialog'); - if (dialog.get(0).open === true) { - return; - } - - // Is necessary to use Blaze object to not create - // circular depencency with helper object (./helpers) - if (Blaze._globalHelpers.isTouchDevice()) { - // Center the dialog on screen on touch devices - dialog.css({ - top: 0, - left: 0, - right: 0, - bottom: 0, - margin: 'auto' - }); - } else { - // Place the dialog above the tool that is being relabelled - dialog.css({ - top: eventData.currentPoints.page.y - dialog.outerHeight() - 20, - left: eventData.currentPoints.page.x - dialog.outerWidth() / 2 - }); - } - - const getTextInput = dialog.find('.annotationTextInput'); - const confirm = dialog.find('.relabelConfirm'); - const remove = dialog.find('.relabelRemove'); - - getTextInput.val(data.text); - - // Focus on the text input to open the Safari keyboard - getTextInput.focus(); - - dialog.get(0).showModal(); - - confirm.off('click'); - confirm.on('click', () => { - dialog.get(0).close(); - doneChangingTextCallback(data, getTextInput.val()); - }); - - // If the remove button is clicked, delete this marker - remove.off('click'); - remove.on('click', () => { - dialog.get(0).close(); - doneChangingTextCallback(data, undefined, true); - }); - - dialog.off('keydown'); - dialog.on('keydown', keyPressHandler); - - const keyPressHandler = e => { - // If Enter is pressed, close the dialog - if (e.which === 13) { - closeHandler(); - } - }; - - const closeHandler = () => { - dialog.get(0).close(); - doneChangingTextCallback(data, getTextInput.val()); - // Reset the text value - getTextInput.val(''); - - // Reset the focus to the active viewport element - // This makes the mobile Safari keyboard close - const element = viewportUtils.getActiveViewportElement(); - $(element).focus(); - }; -}; - -const annotateTextUtils = { - getTextCallback, - changeTextCallback -}; - -export { annotateTextUtils }; \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/lib/classes/ImageSet.js b/Packages/ohif-viewerbase/client/lib/classes/ImageSet.js deleted file mode 100644 index 48f788ce4..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/ImageSet.js +++ /dev/null @@ -1,69 +0,0 @@ -import { Random } from 'meteor/random'; -import { OHIFError } from './OHIFError'; - -const OBJECT = 'object'; - -/** - * This class defines an ImageSet object which will be used across the viewer. This object represents - * a list of images that are associated by any arbitrary criteria being thus content agnostic. Besides the - * main attributes (images and uid) it allows additional attributes to be appended to it (currently - * indiscriminately, but this should be changed). - */ -export class ImageSet { - - constructor(images) { - - if (Array.isArray(images) !== true) { - throw new OHIFError('ImageSet expects an array of images'); - } - - // @property "images" - Object.defineProperty(this, 'images', { - enumerable: false, - configurable: false, - writable: false, - value: images - }); - - // @property "uid" - Object.defineProperty(this, 'uid', { - enumerable: false, - configurable: false, - writable: false, - value: Random.id() // Unique ID of the instance - }); - - } - - getUID() { - return this.uid; - } - - setAttribute(attribute, value) { - this[attribute] = value; - } - - getAttribute(attribute) { - return this[attribute]; - } - - setAttributes(attributes) { - if (typeof attributes === OBJECT && attributes !== null) { - const imageSet = this, hasOwn = Object.prototype.hasOwnProperty; - for (let attribute in attributes) { - if (hasOwn.call(attributes, attribute)) { - imageSet[attribute] = attributes[attribute]; - } - } - } - } - - getImage(index) { - return this.images[index]; - } - - sortBy(sortingCallback) { - return this.images.sort(sortingCallback); - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/LayoutManager.js b/Packages/ohif-viewerbase/client/lib/classes/LayoutManager.js deleted file mode 100644 index 34d6785c1..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/LayoutManager.js +++ /dev/null @@ -1,755 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Blaze } from 'meteor/blaze'; -import { Session } from 'meteor/session'; -import { Tracker } from 'meteor/tracker'; -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; -import { $ } from 'meteor/jquery'; - -import { OHIF } from 'meteor/ohif:core'; - -const PLUGIN_CORNERSTONE = 'cornerstone'; - -let isInteractingWithViewport = false; -Meteor.startup(() => { - const setInteracting = flag => { - isInteractingWithViewport = flag; - }; - - const $body = $('body'); - $body.on('mousedown', '.imageViewerViewport', () => setInteracting(true)); - $body.on('mouseup', () => setInteracting(false)); -}); - -// Displays Series in Viewports given a Protocol and list of Studies -export class LayoutManager { - /** - * Constructor: initializes a Layout Manager object. - * @param {DOM element} parentNode DOM element representing the parent node, which wraps the Layout Manager content - * @param {Array} studies Array of studies objects that will be rendered in the Viewer. Each object will be rendered in a div.imageViewerViewport - */ - constructor(parentNode, studies) { - OHIF.log.info('LayoutManager constructor'); - - this.observer = new Tracker.Dependency(); - this.parentNode = parentNode; - this.studies = studies; - this.viewportData = []; - this.layoutTemplateName = 'gridLayout'; - this.layoutProps = { - rows: 1, - columns: 1 - }; - this.layoutClassName = this.getLayoutClass(); - - this.isZoomed = false; - - const updateSessionFn = () => { - const random = Math.random(); - Session.set('LayoutManagerUpdated', random); - this.observer.changed(); - }; - - this.updateSession = _.throttle(updateSessionFn, 300, { - leading: true, - trailing: false - }); - } - - /** - * Returns the number of viewports rendered, based on layoutProps - * @return {integer} number of viewports - */ - getNumberOfViewports() { - return this.layoutProps.rows * this.layoutProps.columns; - } - - /** - * It creates a new viewport data. This is useful for the first rendering when no viewportData is set yet. - */ - setDefaultViewportData() { - OHIF.log.info('LayoutManager setDefaultViewportData'); - - const self = this; - - // Get the number of viewports to be rendered - const viewportsAmount = this.getNumberOfViewports(); - - // Store the old viewport data and reset the current - const oldViewportData = self.viewportData; - - // Get the studies and display sets sequence map - const sequenceMap = this.getDisplaySetSequenceMap(); - - // Check if the display sets are sequenced - const isSequenced = this.isDisplaySetsSequenced(sequenceMap); - - // Define the current viewport index and the viewport data array - let currentViewportIndex = 0; - if (viewportsAmount > oldViewportData.length && oldViewportData.length && isSequenced) { - // Keep the displayed display sets - self.viewportData = oldViewportData; - currentViewportIndex = oldViewportData.length; - } else if (viewportsAmount <= oldViewportData.length) { - // Reduce the original displayed display sets - self.viewportData = oldViewportData.slice(0, viewportsAmount); - return; - } else { - // Reset all display sets - self.viewportData = []; - } - - // Get all the display sets for the viewer studies - let displaySets = []; - this.studies.forEach(study => { - study.displaySets.forEach(dSet => dSet.images.length && displaySets.push(dSet)); - }); - - // Get the display sets that will be appended to the current ones - let appendix; - const currentLength = self.viewportData.length; - if (currentLength) { - // TODO: isolate displaySets array by study (maybe a map?) - const beginIndex = sequenceMap.values().next().value[0].displaySetIndex + currentLength; - const endIndex = beginIndex + (viewportsAmount - currentLength); - appendix = displaySets.slice(beginIndex, endIndex); - } else { - // Get available display sets from the first to the grid size - appendix = displaySets.slice(0, viewportsAmount); - } - - // Generate the additional data based on the appendix - const additionalData = []; - appendix.forEach((displaySet, index) => { - const { images, studyInstanceUid, seriesInstanceUid, displaySetInstanceUid } = displaySet; - const sopInstanceUid = images[0] && images[0].getSOPInstanceUID ? images[0].getSOPInstanceUID() : ''; - const viewportIndex = currentViewportIndex + index; - const data = { - viewportIndex, - studyInstanceUid, - seriesInstanceUid, - displaySetInstanceUid, - sopInstanceUid, - plugin: PLUGIN_CORNERSTONE - }; - - additionalData.push(data); - }); - - // Append the additional data with the viewport data - self.viewportData = self.viewportData.concat(additionalData); - - // Push empty objects if the amount is lesser than the grid size - while (self.viewportData.length < viewportsAmount) { - self.viewportData.push({}); - } - } - - /** - * Returns the name of the class to be added to the parentNode - * @return {string} class name following the pattern layout--. Ex: layout-1-1, layout-2-2 - */ - getLayoutClass() { - const { rows, columns } = this.layoutProps; - const layoutClass = `layout-${rows}-${columns}`; - - return layoutClass; - } - - /** - * Add a class to the parentNode based on the layout configuration. - * This function is helpful to style the layout of viewports. - * Besides that, each inner div.viewportContainer will have helpful classes - * as well. See viewer/components/gridLayout/ component in this ohif-viewerbase package. - */ - updateLayoutClass() { - const newLayoutClass = this.getLayoutClass(); - - // If layout has changed, change its class - if (this.layoutClassName !== newLayoutClass) { - this.parentNode.classList.remove(this.layoutClassName); - } - - this.layoutClassName = newLayoutClass; - - this.parentNode.classList.add(newLayoutClass); - } - - /** - * Updates the grid with the new layout props. - * It iterates over all viewportData to render the studies - * in the viewports. - * If no viewportData or no viewports defined, it renders the default viewport data. - */ - updateViewports() { - OHIF.log.info('LayoutManager updateViewports'); - - if (!this.viewportData || - !this.viewportData.length || - this.viewportData.length !== this.getNumberOfViewports()) { - this.setDefaultViewportData(); - } - - this.viewportData.forEach(data => { - if (!data.plugin) { - data.plugin = PLUGIN_CORNERSTONE; - } - }) - - // imageViewerViewports occasionally needs relevant layout data in order to set - // the element style of the viewport in question - const layoutProps = this.layoutProps; - const data = $.extend({ - viewportData: [] - }, layoutProps); - - this.viewportData.forEach(viewportData => { - const viewportDataAndLayoutProps = $.extend(viewportData, layoutProps); - - data.viewportData.push(viewportDataAndLayoutProps); - }); - - const layoutTemplate = Template[this.layoutTemplateName]; - - this.removeViewportContainers(); - this.parentNode.innerHTML = ''; - this.updateLayoutClass(); - Blaze.renderWithData(layoutTemplate, data, this.parentNode); - - this.updateSession(); - - this.isZoomed = false; - } - - /** - * This function destroys and re-renders the imageViewerViewport template. - * It uses the data provided to load a new display set into the produced viewport. - * @param {integer} viewportIndex index of the viewport to be re-rendered - * @param {Object} data instance data object - */ - rerenderViewportWithNewDisplaySet(viewportIndex, viewportData) { - // Clone the data to prevent changing the original object - const data = _.clone(viewportData); - - OHIF.log.info(`LayoutManager rerenderViewportWithNewDisplaySet: ${viewportIndex}`); - - // The parent container is identified because it is later removed from the DOM - const container = $('.viewportContainer').get(viewportIndex); - - // Record the current viewportIndex so this can be passed into the re-rendering call - data.viewportIndex = viewportIndex; - - // If we have been provided with a plugin to use, use it. - // Otherwise, use whichever plugin is currently in use in this viewport. - const plugin = data.plugin || this.viewportData[viewportIndex].plugin; - const pluginData = data.pluginData || this.viewportData[viewportIndex].pluginData; - - // Update the dictionary of loaded displaySet for the specified viewport - this.viewportData[viewportIndex] = { - viewportIndex, - displaySetInstanceUid: data.displaySetInstanceUid, - seriesInstanceUid: data.seriesInstanceUid, - studyInstanceUid: data.studyInstanceUid, - renderedCallback: data.renderedCallback, - currentImageIdIndex: data.currentImageIdIndex || 0, - plugin, - pluginData, - }; - - const newViewportContainer = document.createElement('div'); - - // Render and insert the template - if (plugin === PLUGIN_CORNERSTONE) { - // Remove the hover styling - const element = $(container).find('.imageViewerViewport'); - - element.find('canvas').not('.magnifyTool').removeClass('faded'); - - // Remove the whole template, add in the new one - const viewportContainer = element.parents('.removable'); - - newViewportContainer.className = 'removable'; - - // Remove the parent element of the template - // This is a workaround since otherwise Blaze UI onDestroyed doesn't fire - viewportContainer.remove(); - - container.appendChild(newViewportContainer); - - Blaze.renderWithData(Template.imageViewerViewport, data, newViewportContainer); - } else { - newViewportContainer.className = `viewport-plugin-${plugin}`; - newViewportContainer.style.width = '100%'; - newViewportContainer.style.height = '100%'; - - container.innerHTML = ''; - container.appendChild(newViewportContainer); - } - - this.updateSession(); - } - - /** - * Enlarge a single viewport. Useful when the layout has more than one viewport - * @param {integer} viewportIndex Index of the viewport to be enlarged - */ - enlargeViewport(viewportIndex) { - OHIF.log.info(`LayoutManager enlargeViewport: ${viewportIndex}`); - - if (!this.viewportData || - !this.viewportData.length) { - return; - } - - // Clone the array for later - this.previousViewportData = this.viewportData.slice(0); - - const singleViewportData = $.extend({}, this.viewportData[viewportIndex]); - singleViewportData.rows = 1; - singleViewportData.columns = 1; - singleViewportData.viewportIndex = 0; - - const data = { - viewportData: [singleViewportData], - rows: 1, - columns: 1 - }; - - const layoutTemplate = Template.gridLayout; - - this.removeViewportContainers(); - this.parentNode.innerHTML = ''; - Blaze.renderWithData(layoutTemplate, data, this.parentNode); - - this.isZoomed = true; - this.zoomedViewportIndex = viewportIndex; - this.viewportData = data.viewportData; - - this.updateSession(); - } - - /** - * Resets to the previous layout configuration. - * Useful after enlarging a single viewport. - */ - resetPreviousLayout() { - OHIF.log.info('LayoutManager resetPreviousLayout'); - - if (!this.isZoomed) { - return; - } - - this.previousViewportData[this.zoomedViewportIndex] = $.extend({}, this.viewportData[0]); - this.previousViewportData[this.zoomedViewportIndex].viewportIndex = this.zoomedViewportIndex; - this.viewportData = this.previousViewportData; - this.updateViewports(); - } - - /** - * Toogle viewport enlargement. - * Useful for user to enlarge or going back to previous layout configurations - * @param {integer} viewportIndex Index of the viewport to be toggled - */ - toggleEnlargement(viewportIndex) { - OHIF.log.info(`LayoutManager toggleEnlargement: ${viewportIndex}`); - - if (this.isZoomed) { - this.resetPreviousLayout(); - } else { - // Don't enlarge the viewport if we only have one Viewport - // to begin with - if (this.getNumberOfViewports() > 1) { - this.enlargeViewport(viewportIndex); - } - } - } - - /** - * Return the display sets map sequence of display sets and viewports - */ - getDisplaySetSequenceMap() { - OHIF.log.info('LayoutManager getDisplaySetSequenceMap'); - - // Get the viewport data list - const viewportDataList = this.viewportData; - - // Create a map to control the display set sequence - const sequenceMap = new Map(); - - // Iterate over each viewport and register its details on the sequence map - viewportDataList.forEach((viewportData, viewportIndex) => { - // Get the current study - const currentStudy = _.findWhere(this.studies, { - studyInstanceUid: viewportData.studyInstanceUid - }) || this.studies[0]; - - // Get the display sets - const displaySets = currentStudy.displaySets; - - // Get the current display set - const displaySet = _.findWhere(displaySets, { - displaySetInstanceUid: viewportData.displaySetInstanceUid - }); - - // Get the current instance index (using 9999 to sort greater than -1) - let displaySetIndex = _.indexOf(displaySets, displaySet); - displaySetIndex = displaySetIndex < 0 ? 9999 : displaySetIndex; - - // Try to get a map entry for current study or create it if not present - let studyViewports = sequenceMap.get(currentStudy); - if (!studyViewports) { - studyViewports = []; - sequenceMap.set(currentStudy, studyViewports); - } - - // Register the viewport index and the display set index on the map - studyViewports.push({ - viewportIndex, - displaySetIndex - }); - }); - - // Return the generated sequence map - return sequenceMap; - } - - /** - * Check if all the display sets and viewports are sequenced - * @param {Array} definedSequenceMap Array of display set sequence map - * @return {Boolean} Returns if the display set sequence map is sequenced or not - */ - isDisplaySetsSequenced(definedSequenceMap) { - OHIF.log.info('LayoutManager isDisplaySetsSequenced'); - - let isSequenced = true; - - // Get the studies and display sets sequence map - const sequenceMap = definedSequenceMap || this.getDisplaySetSequenceMap(); - - sequenceMap.forEach((studyViewports, study) => { - let lastDisplaySetIndex = null; - let lastViewportIndex = null; - studyViewports.forEach(({ viewportIndex, displaySetIndex }, index) => { - // Check if the sequence is wrong - if ( - displaySetIndex !== 9999 && - lastViewportIndex !== null && - lastDisplaySetIndex !== null && - displaySetIndex !== null && - (viewportIndex - 1 !== lastViewportIndex || - displaySetIndex - 1 !== lastDisplaySetIndex) - ) { - // Set the sequenced flag as false; - isSequenced = false; - } - - // Update the last viewport index - lastViewportIndex = viewportIndex; - - // Update the last display set index - lastDisplaySetIndex = displaySetIndex; - }); - }); - - return isSequenced; - } - - /** - * Check if is possible to move display sets on a specific direction. - * It checks if looping is allowed by OHIF.uiSettings.displaySetNavigationLoopOverSeries - * @param {Boolean} isNext Represents the direction - * @return {Boolean} Returns if display sets can be moved - */ - canMoveDisplaySets(isNext) { - OHIF.log.info('LayoutManager canMoveDisplaySets'); - - // Get the setting that defines if the display set navigation is multiple - const isMultiple = OHIF.uiSettings.displaySetNavigationMultipleViewports; - - // Get the setting that allow display set navigation looping over series - const allowLooping = OHIF.uiSettings.displaySetNavigationLoopOverSeries; - - // Get the studies and display sets sequence map - const sequenceMap = this.getDisplaySetSequenceMap(); - - // Check if the display sets are sequenced - const isSequenced = this.isDisplaySetsSequenced(sequenceMap); - - // Get Active Viewport Index if isMultiple is false - const activeViewportIndex = !isMultiple ? Session.get('activeViewport') : null; - - // Check if is next and looping is blocked - if (isNext && !allowLooping) { - // Check if the end was reached - let endReached = true; - - sequenceMap.forEach((studyViewports, study) => { - // Get active viewport index if isMultiple is false ortherwise get last - const studyViewport = studyViewports[activeViewportIndex !== null ? activeViewportIndex : studyViewports.length - 1]; - if (!studyViewport) { - return; - } - - const viewportIndex = studyViewport.displaySetIndex; - const layoutViewports = studyViewports.length; - const amount = study.displaySets.length; - const move = !isMultiple ? 1 : ((amount % layoutViewports) || layoutViewports); - const lastStepIndex = amount - move; - - // 9999 for index means empty viewport, see getDisplaySetSequenceMap function - if (viewportIndex !== 9999 && viewportIndex !== lastStepIndex) { - endReached = false; - } - }); - - // Return false if end is not reached yet - if ((!isMultiple || isSequenced) && endReached) { - return false; - } - } - - // Check if is previous and looping is blocked - if (!isNext && !allowLooping) { - // Check if the begin was reached - let beginReached = true; - - if (activeViewportIndex >= 0) { - sequenceMap.forEach((studyViewports, study) => { - // Get active viewport index if isMultiple is false ortherwise get first - const studyViewport = studyViewports[activeViewportIndex !== null ? activeViewportIndex : 0]; - if (!studyViewport) { - return; - } - - const viewportIndex = studyViewport.displaySetIndex; - const layoutViewports = studyViewports.length; - - // 9999 for index means empty viewport, see getDisplaySetSequenceMap function - if (viewportIndex !== 9999 && viewportIndex - layoutViewports !== -layoutViewports) { - beginReached = false; - } - }); - } - - // Return false if begin is not reached yet - if ((!isMultiple || isSequenced) && beginReached) { - return false; - } - } - - return true; - } - - /** - * Move display sets forward or backward in the given viewport index - * @param {integer} viewportIndex Index of the viewport to be moved - * @param {Boolean} isNext Represents the direction (true = forward, false = backward) - */ - moveSingleViewportDisplaySets(viewportIndex, isNext) { - OHIF.log.info(`LayoutManager moveSingleViewportDisplaySets: ${viewportIndex}`); - - // Get the setting that allow display set navigation looping over series - const allowLooping = OHIF.uiSettings.displaySetNavigationLoopOverSeries; - - // Get the selected viewport data - const viewportData = this.viewportData[viewportIndex]; - - // Get the current study - const currentStudy = _.findWhere(this.studies, { - studyInstanceUid: viewportData.studyInstanceUid - }) || this.studies[0]; - - // Get the display sets - const displaySets = currentStudy.displaySets; - - // Get the current display set - const currentDisplaySet = _.findWhere(displaySets, { - displaySetInstanceUid: viewportData.displaySetInstanceUid - }); - - // Get the new index and ensure that it will exists in display sets - let newIndex = _.indexOf(displaySets, currentDisplaySet); - if (isNext) { - newIndex++; - if (newIndex >= displaySets.length) { - // Stop here if looping is not allowed - if (!allowLooping) { - return; - } - - newIndex = 0; - } - } else { - newIndex--; - if (newIndex < 0) { - // Stop here if looping is not allowed - if (!allowLooping) { - return; - } - - newIndex = displaySets.length - 1; - } - } - - // Get the display set data for the new index - const newDisplaySetData = displaySets[newIndex]; - - // Rerender the viewport using the new display set data - this.rerenderViewportWithNewDisplaySet(viewportIndex, newDisplaySetData); - } - - /** - * Move multiple display sets forward or backward in all viewports - * @param {Boolean} isNext Represents the direction (true = forward, false = backward) - */ - moveMultipleViewportDisplaySets(isNext) { - OHIF.log.info('LayoutManager moveMultipleViewportDisplaySets'); - - // Get the setting that allow display set navigation looping over series - const allowLooping = OHIF.uiSettings.displaySetNavigationLoopOverSeries; - - // Create a map to control the display set sequence - const sequenceMap = this.getDisplaySetSequenceMap(); - - // Check if the display sets are sequenced - const isSequenced = this.isDisplaySetsSequenced(sequenceMap); - - const displaySetsToRender = []; - - // Iterate over the studies map and move its display sets - sequenceMap.forEach((studyViewports, study) => { - // Sort the viewports on the study by the display set index - studyViewports.sort((a, b) => a.displaySetIndex > b.displaySetIndex); - - // Get the study display sets - const displaySets = study.displaySets; - - // Calculate the base index - const firstIndex = studyViewports[0].displaySetIndex; - const steps = studyViewports.length; - const rest = firstIndex % steps; - let baseIndex = rest ? firstIndex - rest : firstIndex; - const direction = isNext ? 1 : -1; - baseIndex += steps * direction; - - const amount = displaySets.length; - - // Check if the indexes are sequenced or will overflow the array bounds - if (baseIndex >= amount) { - const move = (amount % steps) || steps; - const lastStepIndex = amount - move; - if (firstIndex + steps !== lastStepIndex + steps) { - // Reset the index if the display sets are sequenced but shifted - baseIndex = lastStepIndex; - } else if (!allowLooping) { - // Stop here if looping is not allowed - return; - } else { - // Start over the series if looping is allowed - baseIndex = 0; - } - } else if (baseIndex < 0) { - if (firstIndex > 0) { - // Reset the index if the display sets are sequenced but shifted - baseIndex = 0; - } else if (!allowLooping) { - // Stop here if looping is not allowed - return; - } else { - // Go to the series' end if looping is allowed - baseIndex = (amount - 1) - ((amount - 1) % steps); - } - } else if (!isSequenced) { - // Reset the sequence if indexes are not sequenced - baseIndex = 0; - } - - // Iterate over the current study viewports - studyViewports.forEach(({ viewportIndex }, index) => { - // Get the new displaySet index to be rendered in viewport - const newIndex = baseIndex + index; - - // Get the display set data for the new index - const displaySetData = displaySets[newIndex] || {}; - - // Add the current display set that on the render list - displaySetsToRender.push(displaySetData); - }); - }); - - // Sort the display sets - const sortingFunction = OHIF.utils.sortBy({ - name: 'studyInstanceUid' - }, { - name: 'instanceNumber' - }, { - name: 'seriesNumber' - }); - displaySetsToRender.sort((a, b) => sortingFunction(a, b)); - - // Iterate over each display set data and render on its respective viewport - displaySetsToRender.forEach((data, index) => { - this.rerenderViewportWithNewDisplaySet(index, data); - }); - } - - /** - * Move display sets forward or backward - * @param {Boolean} isNext Represents the direction (true = forward, false = backward) - */ - moveDisplaySets(isNext) { - // Prevent display sets navigation while interacting with any cornerstone tool - if (isInteractingWithViewport) return; - - OHIF.log.info('LayoutManager moveDisplaySets'); - - //Check if navigation is on a single or multiple viewports - if (OHIF.uiSettings.displaySetNavigationMultipleViewports) { - // Move display sets on multiple viewports - this.moveMultipleViewportDisplaySets(isNext); - } else { - // Get the selected viewport index - const viewportIndex = Session.get('activeViewport'); - - // Move display sets on a single viewport - this.moveSingleViewportDisplaySets(viewportIndex, isNext); - } - } - - /** - * Check if a study is loaded into a viewport - * @param {string} studyInstanceUid Study instance Uid string - * @param {integer} viewportIndex Index of the viewport to be checked - * @return {Boolean} Returns if the given study is in the given viewport or not - */ - isStudyLoadedIntoViewport(studyInstanceUid, viewportIndex) { - return (this.viewportData.find(item => item.studyInstanceUid === studyInstanceUid && item.viewportIndex === viewportIndex) !== void 0); - } - - /** - * Check if the layout has multiple rows and columns - * @return {Boolean} Return if the layout has multiple rows and columns or not - */ - isMultipleLayout() { - return this.layoutProps.row !== 1 && this.layoutProps.columns !== 1; - } - - /** - * removeViewportContainers - Removes viewport containers. Required to - * cause onDestroyed to trigger before rendering the layout manager with - * new data. - * - * @return {null} - */ - removeViewportContainers() { - const containers = $('.viewportContainer'); - - // NOTE: Trawl through object backwards, as we remove elements as we go. - for (let i = containers.length - 1; i >= 0; i--) { - const container = containers.get(i); - const removable = $(container).find('.removable'); - $(removable).remove(); - } - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/OHIFError.js b/Packages/ohif-viewerbase/client/lib/classes/OHIFError.js deleted file mode 100644 index 1e3f4ed43..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/OHIFError.js +++ /dev/null @@ -1,14 +0,0 @@ -// @TODO: improve this object -/** - * Objects to be used to throw errors, specially - * in Trackers functions (afterFlush, Flush). - */ -export class OHIFError extends Error { - - constructor(message) { - super(); - this.message = message; - this.stack = (new Error()).stack; - this.name = this.constructor.name; - } -} \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/lib/classes/README.md b/Packages/ohif-viewerbase/client/lib/classes/README.md deleted file mode 100644 index 1367e14b7..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/README.md +++ /dev/null @@ -1,167 +0,0 @@ -# Table of contents -In this document, some important objects are described. In the files there are comments that can help better undestand their methods and properties. - - [ResizeViewportManager object](#the-resize-viewport-manager-object) - - [ImageSet object](#the-image-set-object) - - [Layout Manager](#the-layout-manager-object) - - [Type Safe Collections](#the-type-safe-collections) - -# The Resize Viewport Manager object -This object has multiple functions to manage window resize event. It relocates Dialogs, resizes viewport elements and scrollbars and some other UI components such as Study and Series Quick Switch, when available. - -## Usage -It's only necessary to bind **handleResize** function to the window resize event as follows. The **ohif:viewerbase** package needs to be imported by the referring code as well. -```javascript -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -const ResizeViewportManager = new Viewerbase.ResizeViewportManager(); -window.addEventListener('resize', ResizeViewportManager.getResizeHandler()); -``` -An example os its usage can be found in **ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.js**. - -# The Image Set object -An object that represents a list of images that are associated by any arbitrary criteria being thus content agnostic. Besides the main attributes (**images** and **uid**) it allows additional attributes to be appended to it (currently indiscriminately, but this should be changed). - -## Usage -ImageSet constructor requires an array of SOP instances like in the example below. It's necessary to import **ohif:viewerbase**. - -```javascript -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -const imageSet = new Viewerbase.ImageSet(sopInstances); - -imageSet.setAttributes({ - displaySetInstanceUid: imageSet.uid, - seriesInstanceUid: seriesData.seriesInstanceUid, - seriesNumber: seriesData.seriesNumber, - seriesDescription: seriesData.seriesDescription, - numImageFrames: instances.length, - frameRate: instance.getRawValue('x00181063'), - modality: seriesData.modality, - isMultiFrame: isMultiFrame(instance) -}); - -// Sort instances by InstanceNumber (0020,0013) -imageSet.sortBy((a, b) => { - return (parseInt(a.getRawValue('x00200013', 0)) || 0) - (parseInt(b.getRawValue('x00200013', 0)) || 0); -}); -``` -Each SOP instance in this example is an instance of **OHIFInstanceMetadata** object, which is a specialization of **InstanceMetadata**. To read more about the **Metadata API** click [here](metadata/). - -# The Layout Manager object -Objects of this class are responsible for creating, organizing and maintaining (manage) viewport rendering. It creates a grid, positioning viewports accordingly to it's configuration keeping all viewports data (in **viewportData** property) for easy access from other components. It support many layout configurations and some of them were fully tested: 1x1, 1x2, 1x3, 2x1, 2x2, 2x3, 3x1, 3x2, 3x3. Other configurations may work as well. -Finally it provides some useful functions to move through viewports and zoom it. - -## Usage -In order to use _LayoutManager_ the **ohif:viewerbase** package needs to be imported by the referring code and instantiated as follows. An example os its usage is in **ohif-viewerbase/client/components/viewer/viewerMain/viewerMain.js**. - -```javascript -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -// Get an array of studies object. This function needs to be implemented, it does not exist. -const studies = getArrayOfStudiesObjects(); -const parentElement = document.getElementById('layoutManagerTarget'); -const LayoutManager = new Viewerbase.LayoutManager(parentElement, studies); -``` - -The default configuration is 1x1, and to change it just set **layoutProps** and call **updateViewports** to update the layout as follows. - -```javascript -import { Viewerbase } from 'meteor/ohif:viewerbase'; - -// Get an array of studies object. This function needs to be implemented, it does not exist. -const studies = getArrayOfStudiesObjects(); -const parentElement = document.getElementById('layoutManagerTarget'); -const LayoutManager = new LayoutManager(parentElement, studies); - -// Set the layout proprerties to 2x2 layout -LayoutManager.layoutProps = { - rows: 2, - columns: 2 -}; - -// It will render four viewports: two in each row. -LayoutManager.updateViewports(); -``` - -The layoutManagerTarget element will have a new class **layout-2-2** (to allow further styling) and it's inner content will a new div#imageViewerViewports that has four inner elements like the following (some elements and attributes were removed for example purpose): -```html -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -``` - -Each of this _div.viewportContainer_ will have some classes to help CSS specific styling accordingly to the element's position in the grid: **top**, **middle** and **bottom**. This classes are added by **viewer/components/gridLayout/** component in ohif-viewerbase package. - -# The Type Safe Collections - -With the introduction of the new _Study Metadata API_ in which study metadata is represented by class hierarchies (using prototype-based inheritance), the usage of standard _Minimongo_ collections as a central client-side storage for this data became no longer an option. Standard _Mongo_ and _Minimongo_ collections internally _flatten_ data (in other words, data gets serialized) before storage hence no functions or prototype chains are preserved. In that scenario, when an object is restored (fetched), what is returned is actually a flattened copy of the original object with no functions or prototype (it's no longer an instance of it's original class). As an attempt to overcome this limitation a new type of collection was intruduced: the *TypeSafeCollection*. - -The `TypeSafeCollection` is a simple list-like collection which tries to implement an API _similar_ but not compatible with _Mongo_'s API. It supports basic features like search by attribute map and ID, retrieval by index, sorting of result sets, insertion, removal and reactive operations but, unlike _Mongo_'s API, it (still) lacks support to advanced functionality like complex search criterea or flexible sorting options. - -## Implementation - -The `TypeSafeCollection` is implemented on top of the _JavaScript_ `Array` object. Each element inserted in the collection is appended to the end of its internal array as a _key-value pair (KVP)_ object where the _key_ is a unique randomly generated ID string and the _value_ is the element itself. Once the object has been successfully stored, the generated ID (its ID) is returned to the client code and can later be used to access that specific element. At this point, an important difference to the _Minimongo_ API can be highlighted: a _TypeSafeCollection_ instance will never make any changes to the stored element (e.g., no "\_id" property will ever be assigned to the original object). Another relevant feature that is supported by this design decision is that _not only objects_ can be stored in this collections, but literally _anything_. - -Inside the codebase, the _value_ attribute of each _KVP_ entry in the collection is refered to as _the **payload** of the entry_ since it's what really matters to the user. Hence, this term will also be used here to refer to the _value that has been stored in the collection_. That being said, we can approach another important feature of these collections: A single _payload_ cannot be stored more than once in a given collection. When an attempt of inserting a _payload_ which is already present in the collection is detected, the insert operation will fail and `null` will be returned. In that regard, the collection behaves like `Set` object not permitting a payload to be stored more than once. Strict equality is used when comparing payloads, thus cloned objects are not considered the same. This feature adds an additional garantee that a given study/series/instance will not be listed more than once (it was designed as a replacement for central study collections which were always checked for duplicates). - -Please refer to the codebase for the full `TypeSafeCollection` API. - -## Usage - -In order to use the `TypeSafeCollection` class, the **ohif:viewerbase** package needs to be imported by the referring code and instantiated as follows: - -```javascript -import { Viewerbase } from 'meteor/ohif:viewerbase'; // i.e., Viewerbase.TypeSafeCollection -OR -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; // i.e., OHIF.viewerbase.TypeSafeCollection -// The later is preferred when the client code already makes use of the "OHIF" namespace making the second -// "import" a garantee that the ".viewerbase" namespace has been properly loaded. -``` - -A few usage examples: - -```javascript - -const Users = new OHIF.viewerbase.TypeSafeCollection(); - -[[ ... ]] - -// Insert a User object... -let userId = Users.insert({ - data: { - firstName: 'John', - lastName: 'Doe', - age: 45 - }, - getFullName() { - return `${this.data.firstName} ${this.data.lastName}`; - }, - getAge() { - return this.data.age; - } -}); - -[[ ... ]] - -let theUserWeJustStored = Users.findById(userId); // ;-) - -[[ ... ]] - -// Retrieve a single user with "Doe" as `lastName`... -let myUser = Users.findBy({ 'data.lastName': 'Doe' }); -// Or all users with "Doe" as `lastName`, sorted by `firstName` in ascending -// order and using the `age` attribute to break ties in descending order... -let myUsers = Users.findAllBy({ 'data.lastName': 'Doe' }, { - sort: [ [ 'data.firstName', 'asc' ], [ 'data.age', 'desc' ] ] -}); - -``` diff --git a/Packages/ohif-viewerbase/client/lib/classes/ResizeViewportManager.js b/Packages/ohif-viewerbase/client/lib/classes/ResizeViewportManager.js deleted file mode 100644 index 57a8509bd..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/ResizeViewportManager.js +++ /dev/null @@ -1,151 +0,0 @@ -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { getInstanceClassDefaultViewport } from '../instanceClassSpecificViewport'; - -// Manage resizing viewports triggered by window resize -export class ResizeViewportManager { - constructor() { - this._resizeHandler = null; - } - - // Reposition Study Series Quick Switch based whether side bars are opened or not - repositionStudySeriesQuickSwitch() { - OHIF.log.info('ResizeViewportManager repositionStudySeriesQuickSwitch'); - - // Stop here if viewer is not displayed - const isViewer = Session.get('ViewerOpened'); - if (!isViewer) return; - - // Stop here if there is no one or only one viewport - const nViewports = OHIF.viewerbase.layoutManager.viewportData.length; - if (!nViewports || nViewports <= 1) return; - - const $viewer = $('#viewer'); - const leftSidebar = $viewer.find('.sidebar-left.sidebar-open'); - const rightSidebar = $viewer.find('.sidebar-right.sidebar-open'); - - const $leftQuickSwitch = $('.quickSwitchWrapper.left'); - const $rightQuickSwitch = $('.quickSwitchWrapper.right'); - - const hasLeftSidebar = leftSidebar.length > 0; - const hasRightSidebar = rightSidebar.length > 0; - - $rightQuickSwitch.removeClass('left-sidebar-only'); - $leftQuickSwitch.removeClass('right-sidebar-only'); - - let leftOffset = 0; - - if (hasLeftSidebar) { - leftOffset = (leftSidebar.width() / $(window).width()) * 100; - - if (!hasRightSidebar) { - $rightQuickSwitch.addClass('left-sidebar-only'); - } - } - - if (hasRightSidebar && !hasLeftSidebar) { - $leftQuickSwitch.addClass('right-sidebar-only'); - } - - const leftPosition = (($('#imageViewerViewports').width() / nViewports) / $(window).width()) * 100 + leftOffset; - const rightPosition = 100 - leftPosition; - - $leftQuickSwitch.css('right', rightPosition + '%'); - $rightQuickSwitch.css('left', leftPosition + '%'); - } - - // Relocate dialogs positions - relocateDialogs(){ - OHIF.log.info('ResizeViewportManager relocateDialogs'); - - const $bottomRightDialogs = $('#annotationDialog, #textMarkerOptionsDialog'); - $bottomRightDialogs.css({ - top: '', // This removes the CSS property completely - left: '', - bottom: 0, - right: 0 - }); - - const centerDialogs = $('.draggableDialog').not($bottomRightDialogs); - - centerDialogs.css({ - top: 0, - left: 0, - bottom: 0, - right: 0 - }); - } - - // Resize viewport scrollbars - resizeScrollbars(element) { - OHIF.log.info('ResizeViewportManager resizeScrollbars'); - - const $currentOverlay = $(element).siblings('.imageViewerViewportOverlay'); - $currentOverlay.find('.scrollbar').trigger('rescale'); - } - - // Resize a single viewport element - resizeViewportElement(element, fitToWindow = true) { - let enabledElement; - try { - enabledElement = cornerstone.getEnabledElement(element); - } catch(error) { - return; - } - - cornerstone.resize(element, fitToWindow); - - if (enabledElement.fitToWindow === false) { - const imageId = enabledElement.image.imageId; - const instance = cornerstone.metaData.get('instance', imageId); - const instanceClassViewport = getInstanceClassDefaultViewport(instance, enabledElement, imageId); - cornerstone.setViewport(element, instanceClassViewport); - } - } - - // Resize each viewport element - resizeViewportElements() { - this.relocateDialogs(); - - setTimeout(() => { - this.repositionStudySeriesQuickSwitch(); - - const elements = $('.imageViewerViewport').not('.empty'); - elements.each((index, element) => { - this.resizeViewportElement(element); - this.resizeScrollbars(element); - }); - }, 1); - } - - // Function to override resizeViewportElements function - setResizeViewportElement(resizeViewportElements) { - this.resizeViewportElements = resizeViewportElements; - } - - // Avoid doing DOM manipulation during the resize handler - // because it is fired very often. - // Resizing is therefore performed 100 ms after the resize event stops. - handleResize() { - clearTimeout(this.resizeTimer); - this.resizeTimer = setTimeout(() => { - OHIF.log.info('ResizeViewportManager resizeViewportElements'); - this.resizeViewportElements(); - }, 100); - } - - /** - * Returns a unique event handler function associated with a given instance using lazy assignment. - * @return {function} Returns a unique copy of the event handler of this class. - */ - getResizeHandler() { - let resizeHandler = this._resizeHandler; - if (resizeHandler === null) { - resizeHandler = this.handleResize.bind(this); - this._resizeHandler = resizeHandler; - } - - return resizeHandler; - } -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/StackImagePositionOffsetSynchronizer.js b/Packages/ohif-viewerbase/client/lib/classes/StackImagePositionOffsetSynchronizer.js deleted file mode 100644 index e63286e9d..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/StackImagePositionOffsetSynchronizer.js +++ /dev/null @@ -1,218 +0,0 @@ -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { toolManager } from '../toolManager'; - -export class StackImagePositionOffsetSynchronizer { - constructor() { - this.active = false; - this.syncedViewports = []; - this.synchronizer = new cornerstoneTools.Synchronizer('cornerstonenewimage', cornerstoneTools.stackImagePositionOffsetSynchronizer); - } - - static get ELEMENT_DISABLED_EVENT() { - return 'cornerstoneelementdisabled.StackImagePositionOffsetSynchronizer'; - } - - isActive() { - return this.active; - } - - activate() { - const viewports = this.getLinkableViewports(); - this.syncViewports(viewports); - } - - activateByViewportIndexes(viewportIndexes) { - const viewports = this.getViewportByIndexes(viewportIndexes); - this.syncViewports(viewports); - } - - deactivate() { - if (!this.isActive()) { - return; - } - - while (this.syncedViewports.length) { - const viewport = this.syncedViewports[0]; - this.removeViewport(viewport); - } - - this.active = false; - toolManager.deactivateCommandButton('linkStackScroll'); - } - - update() { - if (!this.isActive()) { - return; - } - - const activeViewportElement = this.getActiveViewportElement(); - - if (this.isViewportSynced(activeViewportElement)) { - return; - } - - this.deactivate(); - this.activate(); - } - - syncViewports(viewports) { - const viewportIndexes = []; - - if (this.isActive() || (viewports.length <= 1)) { - return; - } - - viewports.forEach((viewport, index) => { - this.synchronizer.add(viewport.element); - this.syncedViewports.push(viewport); - viewportIndexes.push(viewport.index); - if (!this.disabledListener) { - this.disabledListener = this.elementDisabledHandler(this); - } - - viewport.element.addEventListener(StackImagePositionOffsetSynchronizer.ELEMENT_DISABLED_EVENT, this.disabledListener); - }); - - this.active = true; - toolManager.activateCommandButton('linkStackScroll'); - Session.set('StackImagePositionOffsetSynchronizerLinkedViewports', viewportIndexes); - } - - isViewportSynced(viewportElement) { - return !!this.getViewportByElement(viewportElement); - } - - getActiveViewportElement() { - const viewportIndex = Session.get('activeViewport') || 0; - return $('.imageViewerViewport').get(viewportIndex); - } - - removeViewport(viewport) { - const index = this.syncedViewports.indexOf(viewport); - - if (index === -1) { - return; - } - - this.syncedViewports.splice(index, 1); - this.synchronizer.remove(viewport.element); - this.removeLinkedViewportFromSession(viewport); - viewport.element.removeEventListener(StackImagePositionOffsetSynchronizer.ELEMENT_DISABLED_EVENT, this.disabledListener); - } - - getViewportByElement(viewportElement) { - const length = this.syncedViewports.length; - - for (let i = 0; i < length; i++) { - const viewport = this.syncedViewports[i]; - - if (viewport.element === viewportElement) { - return viewport; - } - } - } - - removeViewportByElement(viewportElement) { - let viewport = this.getViewportByElement(viewportElement); - - if (viewport) { - this.removeViewport(viewport); - } - } - - removeLinkedViewportFromSession(viewport) { - const linkedViewports = Session.get('StackImagePositionOffsetSynchronizerLinkedViewports'); - const index = linkedViewports.indexOf(viewport.index); - - if (index !== -1) { - linkedViewports.splice(index, 1); - Session.set('StackImagePositionOffsetSynchronizerLinkedViewports', linkedViewports); - } - } - - elementDisabledHandler(context) { - return e => context.removeViewportByElement(e.detail.element); - } - - getViewportByIndexes(viewportIndexes) { - const viewports = []; - const $viewportElements = $('.imageViewerViewport'); - - viewportIndexes.forEach(index => { - const element = $viewportElements.get(index); - - if (!element) { - return; - } - - viewports.push({ - index, - element - }); - }); - - return viewports; - } - - isViewportsLinkable(viewportElementA, viewportElementB) { - const viewportAImageNormal = this.getViewportImageNormal(viewportElementA); - const viewportBImageNormal = this.getViewportImageNormal(viewportElementB); - - if (viewportAImageNormal && viewportBImageNormal) { - const angleInRadians = viewportBImageNormal.angleTo(viewportAImageNormal); - - // Pi / 12 radians = 15 degrees - // If the angle between two vectors is Pi, it means they are just inverted - return angleInRadians < Math.PI / 12 || angleInRadians === Math.PI; - } - - return false; - } - - getLinkableViewports() { - const activeViewportElement = this.getActiveViewportElement(); - const viewports = []; - - $('.imageViewerViewport').each((index, viewportElement) => { - if (this.isViewportsLinkable(activeViewportElement, viewportElement)) { - viewports.push({ - index: index, - element: viewportElement - }); - } - }); - - return viewports; - } - - getViewportImageNormal(element) { - if (!element) { - return; - } - - element = $(element).get(0); - - try { - const enabledElement = cornerstone.getEnabledElement(element); - - if (!enabledElement.image) { - return; - } - - const imageId = enabledElement.image.imageId; - const imagePlane = cornerstone.metaData.get('imagePlane', imageId); - - if (!imagePlane || !imagePlane.rowCosines || !imagePlane.columnCosines) { - return; - } - - return imagePlane.rowCosines.clone().cross(imagePlane.columnCosines); - } catch(error) { - const errorMessage = error.message || error; - OHIF.log.info(`StackImagePositionOffsetSynchronizer getViewportImageNormal: ${errorMessage}`); - } - } -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/StudyLoadingListener.js b/Packages/ohif-viewerbase/client/lib/classes/StudyLoadingListener.js deleted file mode 100644 index f5a840cfe..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/StudyLoadingListener.js +++ /dev/null @@ -1,400 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { Session } from 'meteor/session'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone'; - -class BaseLoadingListener { - constructor(stack, options) { - options = options || {}; - - this.id = BaseLoadingListener.getNewId(); - this.stack = stack; - this.startListening(); - this.statsItemsLimit = options.statsItemsLimit || 2; - this.stats = { - items: [], - total: 0, - elapsedTime: 0, - speed: 0 - }; - - // Register the start point to make it possible to calculate - // bytes/s or frames/s when the first byte or frame is received - this._addStatsData(0); - - // Update the progress before starting the download - // to make it possible to update the UI - this._updateProgress(); - } - - _addStatsData(value) { - const date = new Date(); - const stats = this.stats; - const items = stats.items; - const newItem = { - value, - date - }; - - items.push(newItem); - stats.total += newItem.value; - - // Remove items until it gets below the limit - while (items.length > this.statsItemsLimit) { - const item = items.shift(); - stats.total -= item.value; - } - - // Update the elapsedTime (seconds) based on first and last - // elements and recalculate the speed (bytes/s or frames/s) - if (items.length > 1) { - const oldestItem = items[0]; - stats.elapsedTime = (newItem.date.getTime() - oldestItem.date.getTime()) / 1000; - stats.speed = (stats.total - oldestItem.value) / stats.elapsedTime; - } - } - - _getProgressSessionId() { - const displaySetInstanceUid = this.stack.displaySetInstanceUid; - return 'StackProgress:' + displaySetInstanceUid; - } - - _clearSession() { - const progressSessionId = this._getProgressSessionId(); - Session.set(progressSessionId, undefined); - delete Session.keys.progressSessionId; - } - - startListening() { - throw new Error('`startListening` must be implemented by child clases'); - } - - stopListening() { - throw new Error('`stopListening` must be implemented by child clases'); - } - - destroy() { - this.stopListening(); - this._clearSession(); - } - - static getNewId() { - const timeSlice = (new Date()).getTime().toString().slice(-8); - const randomNumber = parseInt(Math.random() * 1000000000); - - return timeSlice.toString() + randomNumber.toString(); - } -} - -class DICOMFileLoadingListener extends BaseLoadingListener { - constructor(stack) { - super(stack); - this._dataSetUrl = this._getDataSetUrl(stack); - this._lastLoaded = 0; - - // Check how many instances has already been download (cached) - this._checkCachedData(); - } - - _checkCachedData() { - const dataSet = cornerstoneWADOImageLoader.wadouri.dataSetCacheManager.get(this._dataSetUrl); - - if (dataSet) { - const dataSetLength = dataSet.byteArray.length; - - this._updateProgress({ - percentComplete: 100, - loaded: dataSetLength, - total: dataSetLength - }); - } - } - - _getImageLoadProgressEventName() { - return 'cornerstoneimageloadprogress.' + this.id; - } - - startListening() { - const imageLoadProgressEventName = this._getImageLoadProgressEventName(); - const imageLoadProgressEventHandle = this._imageLoadProgressEventHandle.bind(this); - - this.stopListening(); - - cornerstone.events.addEventListener(imageLoadProgressEventName, imageLoadProgressEventHandle); - } - - stopListening() { - const imageLoadProgressEventName = this._getImageLoadProgressEventName(); - cornerstone.events.removeEventListener(imageLoadProgressEventName); - } - - _imageLoadProgressEventHandle(e) { - const eventData = e.detail; - const dataSetUrl = this._convertImageIdToDataSetUrl(eventData.imageId); - const bytesDiff = eventData.loaded - this._lastLoaded; - - if (!this._dataSetUrl === dataSetUrl) { - return; - } - - // Add the bytes downloaded to the stats - this._addStatsData(bytesDiff); - - // Update the download progress - this._updateProgress(eventData); - - // Cache the last eventData.loaded value - this._lastLoaded = eventData.loaded; - } - - _updateProgress(eventData) { - const progressSessionId = this._getProgressSessionId(); - eventData = eventData || {}; - - Session.set(progressSessionId, { - multiFrame: false, - percentComplete: eventData.percentComplete, - bytesLoaded: eventData.loaded, - bytesTotal: eventData.total, - bytesPerSecond: this.stats.speed - }); - } - - _convertImageIdToDataSetUrl(imageId) { - // Remove the prefix ("dicomweb:" or "wadouri:"") - imageId = imageId.replace(/^(dicomweb:|wadouri:)/i, ''); - - // Remove "frame=999&" from the imageId - imageId = imageId.replace(/frame=\d+&?/i, ''); - - // Remove the last "&" like in "http://...?foo=1&bar=2&" - imageId = imageId.replace(/&$/, ''); - - return imageId; - } - - _getDataSetUrl(stack) { - const imageId = stack.imageIds[0]; - return this._convertImageIdToDataSetUrl(imageId); - } -} - -class StackLoadingListener extends BaseLoadingListener { - constructor(stack) { - super(stack, { statsItemsLimit: 20 }); - this.imageDataMap = this._convertImageIdsArrayToMap(stack.imageIds); - this.framesStatus = this._createArray(stack.imageIds.length, false); - this.loadedCount = 0; - - // Check how many instances has already been download (cached) - this._checkCachedData(); - } - - _convertImageIdsArrayToMap(imageIds) { - const imageIdsMap = new Map(); - - for (let i = 0; i < imageIds.length; i++) { - imageIdsMap.set(imageIds[i], { - index: i, - loaded: false - }); - } - - return imageIdsMap; - } - - _createArray(length, defaultValue) { - // `new Array(length)` is an anti-pattern in javascript because its - // funny API. Otherwise I would go for `new Array(length).fill(false)` - const array = []; - - for (let i = 0; i < length; i++) { - array[i] = defaultValue; - } - - return array; - } - - _checkCachedData() { - // const imageIds = this.stack.imageIds; - - // TODO: No way to check status of Promise. - /*for(let i = 0; i < imageIds.length; i++) { - const imageId = imageIds[i]; - - const imagePromise = cornerstone.imageCache.getImageLoadObject(imageId).promise; - - if (imagePromise && (imagePromise.state() === 'resolved')) { - this._updateFrameStatus(imageId, true); - } - }*/ - } - - _getImageLoadedEventName() { - return 'cornerstoneimageloaded.' + this.id; - } - - _getImageCachePromiseRemoveEventName() { - return 'cornerstoneimagecachepromiseremoved.' + this.id; - } - - startListening() { - const imageLoadedEventName = this._getImageLoadedEventName(); - const imageCachePromiseRemovedEventName = this._getImageCachePromiseRemoveEventName(); - const imageLoadedEventHandle = this._imageLoadedEventHandle.bind(this); - const imageCachePromiseRemovedEventHandle = this._imageCachePromiseRemovedEventHandle.bind(this); - - this.stopListening(); - - cornerstone.events.addEventListener(imageLoadedEventName, imageLoadedEventHandle); - cornerstone.events.addEventListener(imageCachePromiseRemovedEventName, imageCachePromiseRemovedEventHandle); - } - - stopListening() { - const imageLoadedEventName = this._getImageLoadedEventName(); - const imageCachePromiseRemovedEventName = this._getImageCachePromiseRemoveEventName(); - - cornerstone.events.removeEventListener(imageLoadedEventName); - cornerstone.events.removeEventListener(imageCachePromiseRemovedEventName); - } - - _updateFrameStatus(imageId, loaded) { - const imageData = this.imageDataMap.get(imageId); - - if (!imageData || (imageData.loaded === loaded)) { - return; - } - - // Add one more frame to the stats - if (loaded) { - this._addStatsData(1); - } - - imageData.loaded = loaded; - this.framesStatus[imageData.index] = loaded; - this.loadedCount += loaded ? 1 : -1; - this._updateProgress(); - } - - _imageLoadedEventHandle(e) { - this._updateFrameStatus(e.detail.image.imageId, true); - } - - _imageCachePromiseRemovedEventHandle(e) { - this._updateFrameStatus(e.detail.imageId, false); - } - - _updateProgress() { - const totalFramesCount = this.stack.imageIds.length; - const loadedFramesCount = this.loadedCount; - const loadingFramesCount = totalFramesCount - loadedFramesCount; - const percentComplete = Math.round(loadedFramesCount / totalFramesCount * 100); - const progressSessionId = this._getProgressSessionId(); - - Session.set(progressSessionId, { - multiFrame: true, - totalFramesCount, - loadedFramesCount, - loadingFramesCount, - percentComplete, - framesPerSecond: this.stats.speed, - framesStatus: this.framesStatus - }); - } - - _logProgress() { - const totalFramesCount = this.stack.imageIds.length; - const displaySetInstanceUid = this.stack.displaySetInstanceUid; - let progressBar = '['; - - for (let i = 0; i < totalFramesCount; i++) { - const ch = this.framesStatus[i] ? '|' : '.'; - progressBar += `${ch}`; - } - - progressBar += ']'; - OHIF.log.info(`${displaySetInstanceUid}: ${progressBar}`); - } -} - -class StudyLoadingListener { - constructor() { - this.listeners = {}; - } - - addStack(stack, stackMetaData) { - const displaySetInstanceUid = stack.displaySetInstanceUid; - - if (!this.listeners[displaySetInstanceUid]) { - const listener = this._createListener(stack, stackMetaData); - if (listener) { - this.listeners[displaySetInstanceUid] = listener; - } - } - } - - addStudy(study) { - study.displaySets.forEach(displaySet => { - const stack = OHIF.viewerbase.stackManager.findOrCreateStack(study, displaySet); - this.addStack(stack, { - isMultiFrame: displaySet.isMultiFrame - }); - }); - } - - addStudies(studies) { - if (!studies || !studies.length) { - return; - } - - for (let i = 0; i < studies.length; i++) { - this.addStudy(studies[i]); - } - } - - clear() { - const displaySetInstanceUids = Object.keys(this.listeners); - const length = displaySetInstanceUids.length; - - for (let i = 0; i < length; i++) { - const displaySetInstanceUid = displaySetInstanceUids[i]; - const displaySet = this.listeners[displaySetInstanceUid]; - - displaySet.destroy(); - } - - this.listeners = {}; - } - - _createListener(stack, stackMetaData) { - const schema = this._getSchema(stack); - - // A StackLoadingListener can be created if it's wadors or not a multiframe - // wadouri instance (single file) that means "N" files will have to be - // downloaded where "N" is the number of frames. DICOMFileLoadingListener - // is created only if it's a single DICOM file and there's no way to know - // how many frames has already been loaded (bytes/s instead of frames/s). - if ((schema === 'wadors') || !stackMetaData.isMultiFrame) { - return new StackLoadingListener(stack); - } else { - return new DICOMFileLoadingListener(stack); - } - } - - _getSchema(stack) { - const imageId = stack.imageIds[0]; - const colonIndex = imageId.indexOf(':'); - return imageId.substring(0, colonIndex); - } - - // Singleton - static getInstance() { - if (!StudyLoadingListener._instance) { - StudyLoadingListener._instance = new StudyLoadingListener(); - } - - return StudyLoadingListener._instance; - } -} - -export { StudyLoadingListener, StackLoadingListener, DICOMFileLoadingListener }; diff --git a/Packages/ohif-viewerbase/client/lib/classes/StudyMetadataSource.js b/Packages/ohif-viewerbase/client/lib/classes/StudyMetadataSource.js deleted file mode 100644 index c8a09eec1..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/StudyMetadataSource.js +++ /dev/null @@ -1,30 +0,0 @@ -import { OHIFError } from './OHIFError'; - -/** - * Abstract class to fetch study metadata. - */ -export class StudyMetadataSource { - - /** - * Get study metadata for a study with given study InstanceUID. - * @param {String} studyInstanceUID Study InstanceUID. - */ - getByInstanceUID(studyInstanceUID) { - /** - * Please override this method on a specialized class. - */ - throw new OHIFError('StudyMetadataSource::getByInstanceUID is not overriden. Please, override it in a specialized class. See OHIFStudyMetadataSource for example'); - } - - /** - * Load study info and study metadata for a given study into the viewer. - * @param {StudySummary|StudyMetadata} study of StudySummary or StudyMetadata object. - */ - loadStudy(study) { - /** - * Please override this method on a specialized class. - */ - throw new OHIFError('StudyMetadataSource::loadStudy is not overriden. Please, override it in a specialized class. See OHIFStudyMetadataSource for example'); - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/StudyPrefetcher.js b/Packages/ohif-viewerbase/client/lib/classes/StudyPrefetcher.js deleted file mode 100644 index 98184b50b..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/StudyPrefetcher.js +++ /dev/null @@ -1,330 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { OHIFError } from './OHIFError'; -import { StackManager } from '../StackManager.js'; -import { getImageId } from '../getImageId.js'; - -export class StudyPrefetcher { - - constructor(studies) { - this.studies = studies || []; - this.prefetchDisplaySetsTimeout = 300; - this.lastActiveViewportElement = null; - this.cacheFullHandlerBound = _.bind(this.cacheFullHandler, this); - - cornerstone.events.addEventListener('cornerstoneimagecachefull.StudyPrefetcher', this.cacheFullHandlerBound); - } - - destroy() { - this.stopPrefetching(); - cornerstone.events.removeEventListener('cornerstoneimagecachefull.StudyPrefetcher', this.cacheFullHandlerBound); - } - - static getInstance() { - if (!StudyPrefetcher.instance) { - StudyPrefetcher.instance = new StudyPrefetcher(); - } - - return StudyPrefetcher.instance; - } - - setStudies(studies) { - this.stopPrefetching(); - this.studies = studies; - } - - prefetch() { - if (!this.studies || !this.studies.length) { - return; - } - - this.stopPrefetching(); - this.prefetchActiveViewport(); - this.prefetchDisplaySets(); - } - - stopPrefetching() { - this.disableViewportPrefetch(); - cornerstoneTools.requestPoolManager.clearRequestStack('prefetch'); - } - - prefetchActiveViewport() { - const activeViewportElement = OHIF.viewerbase.viewportUtils.getActiveViewportElement(); - this.enablePrefetchOnElement(activeViewportElement); - this.attachActiveViewportListeners(activeViewportElement); - } - - disableViewportPrefetch() { - $('.imageViewerViewport').each(function() { - if (!$(this).find('canvas').length) { - return; - } - - cornerstoneTools.stackPrefetch.disable(this); - }); - } - - hasStack(element) { - const stack = cornerstoneTools.getToolState(element, 'stack'); - return stack && stack.data.length && (stack.data[0].imageIds.length > 1); - } - - /** - * This function enables stack prefetching for a specified element (viewport) - * It first disables any prefetching currently occurring on any other viewports. - * - * @param element {node} DOM Node representing the viewport element - */ - enablePrefetchOnElement(element) { - if (!$(element).find('canvas').length) { - return; - } - - // Make sure there is a stack to fetch - if (this.hasStack(element)) { - // Check if this is a clip or not - const activeViewportIndex = Session.get('activeViewport'); - const displaySetInstanceUid = OHIF.viewer.data.loadedSeriesData[activeViewportIndex].displaySetInstanceUid; - - const stack = StackManager.findStack(displaySetInstanceUid); - - if (!stack) { - throw new OHIFError(`Requested stack ${displaySetInstanceUid} was not created`); - } - - cornerstoneTools.stackPrefetch.enable(element); - } - } - - attachActiveViewportListeners(activeViewportElement) { - function newImageHandler() { - // It needs to be called asynchronously because cornerstone does it at the same way. - // All instance urls to be prefetched will be removed again if we add them before - // Cornerstone callback (see stackPrefetch.onImageUpdated). - StudyPrefetcher.prefetchDisplaySetsAsync(); - } - - if (this.lastActiveViewportElement) { - this.lastActiveViewportElement.removeEventListener('cornerstonenewimage.StudyPrefetcher', newImageHandler); - } - - activeViewportElement.removeEventListener('cornerstonenewimage.StudyPrefetcher', newImageHandler); - - // Cornerstone will not attach an event listener if the element doesn't have a stack - if (this.hasStack(activeViewportElement)) { - activeViewportElement.addEventListener('cornerstonenewimage.StudyPrefetcher', newImageHandler); - } - - this.lastActiveViewportElement = activeViewportElement; - } - - prefetchDisplaySetsAsync(timeout) { - timeout = timeout || this.prefetchDisplaySetsTimeout; - - clearTimeout(this.prefetchDisplaySetsHandler); - this.prefetchDisplaySetsHandler = setTimeout(() => { - this.prefetchDisplaySets(); - }, timeout); - } - - prefetchDisplaySets() { - let config; - if (Meteor.settings && - Meteor.settings.public && - Meteor.settings.prefetch) { - config = Meteor.settings.public.prefetch; - } else { - config = { - order: 'closest', - displaySetCount: 1 - }; - } - - const displaySetsToPrefetch = this.getDisplaySetsToPrefetch(config); - const imageIds = this.getImageIdsFromDisplaySets(displaySetsToPrefetch); - - this.prefetchImageIds(imageIds); - } - - prefetchImageIds(imageIds) { - const nonCachedImageIds = this.filterCachedImageIds(imageIds); - const requestPoolManager = cornerstoneTools.requestPoolManager; - const requestType = 'prefetch'; - const preventCache = false; - const noop = () => {}; - - nonCachedImageIds.forEach(imageId => { - requestPoolManager.addRequest({}, imageId, requestType, preventCache, noop, noop); - }); - - requestPoolManager.startGrabbing(); - } - - getActiveViewportImage() { - const element = OHIF.viewerbase.viewportUtils.getActiveViewportElement(); - - if (!element) { - return; - } - - const enabledElement = cornerstone.getEnabledElement(element); - const image = enabledElement.image; - - return image; - } - - getStudy(image) { - const studyMetadata = cornerstone.metaData.get('study', image.imageId); - return OHIF.viewer.Studies.find(study => study.studyInstanceUid === studyMetadata.studyInstanceUid); - } - - getSeries(study, image) { - const seriesMetadata = cornerstone.metaData.get('series', image.imageId); - const studyMetadata = OHIF.viewerbase.getStudyMetadata(study); - - return studyMetadata.getSeriesByUID(seriesMetadata.seriesInstanceUid); - } - - getInstance(series, image) { - const instanceMetadata = cornerstone.metaData.get('instance', image.imageId); - return series.getInstanceByUID(instanceMetadata.sopInstanceUid); - } - - getActiveDisplaySet(displaySets, instance) { - return _.find(displaySets, displaySet => { - return _.some(displaySet.images, displaySetImage => { - return displaySetImage.sopInstanceUid === instance.sopInstanceUid; - }); - }); - } - - getDisplaySetsToPrefetch(config) { - const image = this.getActiveViewportImage(); - - if (!image || !config || !config.displaySetCount) { - return []; - } - - const study = this.getStudy(image); - const series = this.getSeries(study, image); - const instance = this.getInstance(series, image); - const displaySets = study.displaySets; - const activeDisplaySet = this.getActiveDisplaySet(displaySets, instance); - const prefetchMethodMap = { - topdown: 'getFirstDisplaySets', - downward: 'getNextDisplaySets', - closest: 'getClosestDisplaySets' - }; - - const prefetchOrder = config.order; - const methodName = prefetchMethodMap[prefetchOrder]; - const getDisplaySets = this[methodName]; - - if (!getDisplaySets) { - if (prefetchOrder) { - OHIF.log.warn(`Invalid prefetch order configuration (${prefetchOrder})`); - } - - return []; - } - - return getDisplaySets.call(this, displaySets, activeDisplaySet, config.displaySetCount); - } - - getFirstDisplaySets(displaySets, activeDisplaySet, displaySetCount) { - const length = displaySets.length; - const selectedDisplaySets = []; - - for (let i = 0; (i < length) && displaySetCount; i++) { - const displaySet = displaySets[i]; - - if (displaySet !== activeDisplaySet) { - selectedDisplaySets.push(displaySet); - displaySetCount--; - } - } - - return selectedDisplaySets; - } - - getNextDisplaySets(displaySets, activeDisplaySet, displaySetCount) { - const activeDisplaySetIndex = displaySets.indexOf(activeDisplaySet); - const begin = activeDisplaySetIndex + 1; - const end = Math.min(begin + displaySetCount, displaySets.length); - - return displaySets.slice(begin, end); - } - - getClosestDisplaySets(displaySets, activeDisplaySet, displaySetCount) { - const activeDisplaySetIndex = displaySets.indexOf(activeDisplaySet); - const length = displaySets.length; - const selectedDisplaySets = []; - let left = activeDisplaySetIndex - 1; - let right = activeDisplaySetIndex + 1; - - while (((left >= 0) || (right < length)) && displaySetCount) { - if (left >= 0) { - selectedDisplaySets.push(displaySets[left]); - displaySetCount--; - left--; - } - - if ((right < length) && displaySetCount) { - selectedDisplaySets.push(displaySets[right]); - displaySetCount--; - right++; - } - } - - return selectedDisplaySets; - } - - getImageIdsFromDisplaySets(displaySets) { - let imageIds = []; - - displaySets.forEach(displaySet => { - imageIds = imageIds.concat(this.getImageIdsFromDisplaySet(displaySet)); - }); - - return imageIds; - } - - getImageIdsFromDisplaySet(displaySet) { - const imageIds = []; - - displaySet.images.forEach(image => { - const numFrames = image.numFrames; - if (numFrames > 1) { - for (let i = 0; i < numFrames; i++) { - let imageId = getImageId(image, i); - imageIds.push(imageId); - } - } else { - let imageId = getImageId(image); - imageIds.push(imageId); - } - }); - - return imageIds; - } - - filterCachedImageIds(imageIds) { - return _.filter(imageIds, imageId => { - return !this.isImageCached(imageId); - }); - } - - isImageCached(imageId) { - const image = cornerstone.imageCache.imageCache[imageId]; - return image && image.sizeInBytes; - } - - cacheFullHandler() { - OHIF.log.warn('Cache full'); - this.stopPrefetching(); - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/TypeSafeCollection.js b/Packages/ohif-viewerbase/client/lib/classes/TypeSafeCollection.js deleted file mode 100644 index 556be08f8..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/TypeSafeCollection.js +++ /dev/null @@ -1,498 +0,0 @@ -import { Random } from 'meteor/random'; -import { ReactiveVar } from 'meteor/reactive-var'; - -/** - * Constants - */ - -const PROPERTY_SEPARATOR = '.'; -const ORDER_ASC = 'asc'; -const ORDER_DESC = 'desc'; -const MIN_COUNT = 0x00000000; -const MAX_COUNT = 0x7FFFFFFF; - -/** - * Class Definition - */ - -export class TypeSafeCollection { - - constructor() { - this._operationCount = new ReactiveVar(MIN_COUNT); - this._elementList = []; - this._handlers = Object.create(null); - } - - /** - * Private Methods - */ - - _invalidate() { - let count = this._operationCount.get(); - this._operationCount.set(count < MAX_COUNT ? count + 1 : MIN_COUNT); - } - - _elements(silent) { - (silent === true || this._operationCount.get()); - return this._elementList; - } - - _elementWithPayload(payload, silent) { - return this._elements(silent).find(item => item.payload === payload); - } - - _elementWithId(id, silent) { - return this._elements(silent).find(item => item.id === id); - } - - _trigger(event, data) { - let handlers = this._handlers; - if (event in handlers) { - handlers = handlers[event]; - if (!(handlers instanceof Array)) { - return; - } - for (let i = 0, limit = handlers.length; i < limit; ++i) { - let handler = handlers[i]; - if (_isFunction(handler)) { - handler.call(null, data); - } - } - } - } - - /** - * Public Methods - */ - - onInsert(callback) { - if (_isFunction(callback)) { - let handlers = this._handlers.insert; - if (!(handlers instanceof Array)) { - handlers = []; - this._handlers.insert = handlers; - } - handlers.push(callback); - } - } - - /** - * Update the payload associated with the given ID to be the new supplied payload. - * @param {string} id The ID of the entry that will be updated. - * @param {any} payload The element that will replace the previous payload. - * @returns {boolean} Returns true if the given ID is present in the collection, false otherwise. - */ - updateById(id, payload) { - let result = false, - found = this._elementWithPayload(payload, true); - if (found) { - // nothing to do since the element is already in the collection... - if (found.id === id) { - // set result to true since the ids match... - result = true; - this._invalidate(); - } - } else { - found = this._elementWithId(id, true); - if (found) { - found.payload = payload; - result = true; - this._invalidate(); - } - } - return result; - } - - /** - * Signal that the given element has been changed by notifying reactive data-source observers. - * This method is basically a means to invalidate the inernal reactive data-source. - * @param {any} payload The element that has been altered. - * @returns {boolean} Returns true if the element is present in the collection, false otherwise. - */ - update(payload) { - let result = false, - found = this._elementWithPayload(payload, true); - if (found) { - // nothing to do since the element is already in the collection... - result = true; - this._invalidate(); - } - return result; - } - - /** - * Insert an element in the collection. On success, the element ID (a unique string) is returned. On failure, returns null. - * A failure scenario only happens when the given payload is already present in the collection. Note that NO exceptions are thrown! - * @param {any} payload The element to be stored. - * @returns {string} The ID of the inserted element or null if the element already exists... - */ - insert(payload) { - let id = null, - found = this._elementWithPayload(payload, true); - if (!found) { - id = Random.id(); - this._elements(true).push({ id, payload }); - this._invalidate(); - this._trigger('insert', { id, data: payload }); - } - return id; - } - - /** - * Remove all elements from the collection. - * @returns {void} No meaningful value is returned. - */ - removeAll() { - let all = this._elements(true), - length = all.length; - for (let i = length - 1; i >= 0; i--) { - let item = all[i]; - delete item.id; - delete item.payload; - all[i] = null; - } - all.splice(0, length); - this._invalidate(); - } - - /** - * Remove elements from the collection that match the criteria given in the property map. - * @param {Object} propertyMap A property map that will be macthed against all collection elements. - * @returns {Array} A list with all removed elements. - */ - remove(propertyMap) { - let found = this.findAllEntriesBy(propertyMap), - foundCount = found.length, - removed = []; - if (foundCount > 0) { - const all = this._elements(true); - for (let i = foundCount - 1; i >= 0; i--) { - let item = found[i]; - all.splice(item[2], 1); - removed.push(item[0]); - } - this._invalidate(); - } - return removed; - } - - /** - * Provides the ID of the given element inside the collection. - * @param {any} payload The element being searched for. - * @returns {string} The ID of the given element or undefined if the element is not present. - */ - getElementId(payload) { - let found = this._elementWithPayload(payload); - return found && found.id; - } - - /** - * Provides the position of the given element in the internal list returning -1 if the element is not present. - * @param {any} payload The element being searched for. - * @returns {number} The position of the given element in the internal list. If the element is not present -1 is returned. - */ - findById(id) { - let found = this._elementWithId(id); - return found && found.payload; - } - - /** - * Provides the position of the given element in the internal list returning -1 if the element is not present. - * @param {any} payload The element being searched for. - * @returns {number} The position of the given element in the internal list. If the element is not present -1 is returned. - */ - indexOfElement(payload) { - return this._elements().indexOf(this._elementWithPayload(payload, true)); - } - - /** - * Provides the position of the element associated with the given ID in the internal list returning -1 if the element is not present. - * @param {string} id The index of the element. - * @returns {number} The position of the element associated with the given ID in the internal list. If the element is not present -1 is returned. - */ - indexOfId(id) { - return this._elements().indexOf(this._elementWithId(id, true)); - } - - /** - * Provides a list-like approach to the collection returning an element by index. - * @param {number} index The index of the element. - * @returns {any} If out of bounds, undefined is returned. Otherwise the element in the given position is returned. - */ - getElementByIndex(index) { - let found = ((this._elements())[index >= 0 ? index : -1]); - return found && found.payload; - } - - /** - * Find an element by a criteria defined by the given callback function. - * Attention!!! The reactive source will not be notified if no valid callback is supplied... - * @param {function} callback A callback function which will define the search criteria. The callback - * function will be passed the collection element, its ID and its index in this very order. The callback - * shall return true when its criterea has been fulfilled. - * @returns {any} The matched element or undefined if not match was found. - */ - find(callback) { - let found; - if (_isFunction(callback)) { - found = this._elements().find((item, index) => { - return callback.call(this, item.payload, item.id, index); - }); - } - return found && found.payload; - } - - /** - * Find the first element that strictly matches the specified property map. - * @param {Object} propertyMap A property map that will be macthed against all collection elements. - * @param {Object} options A set of options. Currently only "options.sort" option is supported. - * @param {Object.SortingSpecifier} options.sort An optional sorting specifier. If a sorting specifier is supplied - * but is not valid, an exception will be thrown. - * @returns {Any} The matched element or undefined if not match was found. - */ - findBy(propertyMap, options) { - let found; - if (_isObject(options)) { - // if the "options" argument is provided and is a valid object, - // it must be applied to the dataset before search... - const all = this.all(options); - if (all.length > 0) { - if (_isObject(propertyMap)) { - found = all.find(item => _compareToPropertyMapStrict(propertyMap, item)); - } else { - found = all[0]; // simply extract the first element... - } - } - } else if (_isObject(propertyMap)) { - found = this._elements().find(item => _compareToPropertyMapStrict(propertyMap, item.payload)); - if (found) { - found = found.payload; - } - } - return found; - } - - /** - * Find all elements that strictly match the specified property map. - * Attention!!! The reactive source will not be notified if no valid property map is supplied... - * @param {Object} propertyMap A property map that will be macthed against all collection elements. - * @returns {Array} An array of entries of all elements that match the given criteria. Each set in - * in the array has the following format: [ elementData, elementId, elementIndex ]. - */ - findAllEntriesBy(propertyMap) { - const found = []; - if (_isObject(propertyMap)) { - this._elements().forEach((item, index) => { - if (_compareToPropertyMapStrict(propertyMap, item.payload)) { - // Match! Add it to the found list... - found.push([ item.payload, item.id, index ]); - } - }); - } - return found; - } - - /** - * Find all elements that match a specified property map. - * Attention!!! The reactive source will not be notified if no valid property map is supplied... - * @param {Object} propertyMap A property map that will be macthed against all collection elements. - * @param {Object} options A set of options. Currently only "options.sort" option is supported. - * @param {Object.SortingSpecifier} options.sort An optional sorting specifier. If a sorting specifier is supplied - * but is not valid, an exception will be thrown. - * @returns {Array} An array with all elements that match the given criteria and sorted in the specified sorting order. - */ - findAllBy(propertyMap, options) { - const found = this.findAllEntriesBy(propertyMap).map(item => item[0]); // Only payload is relevant... - if (_isObject(options)) { - if ('sort' in options) { - _sortListBy(found, options.sort); - } - } - return found; - } - - /** - * Executes the supplied callback function for each element of the collection. - * Attention!!! The reactive source will not be notified if no valid property map is supplied... - * @param {function} callback The callback function to be executed. The callback is passed the element, - * its ID and its index in this very order. - * @returns {void} Nothing is returned. - */ - forEach(callback) { - if (_isFunction(callback)) { - this._elements().forEach((item, index) => { - callback.call(this, item.payload, item.id, index); - }); - } - } - - /** - * Count the number of elements currently in the collection. - * @returns {number} The current number of elements in the collection. - */ - count() { - return this._elements().length; - } - - /** - * Returns a list with all elements of the collection optionally sorted by a sorting specifier criteria. - * @param {Object} options A set of options. Currently only "options.sort" option is supported. - * @param {Object.SortingSpecifier} options.sort An optional sorting specifier. If a sorting specifier is supplied - * but is not valid, an exception will be thrown. - * @returns {Array} An array with all elements stored in the collection. - */ - all(options) { - let list = this._elements().map(item => item.payload); - if (_isObject(options)) { - if ('sort' in options) { - _sortListBy(list, options.sort); - } - } - return list; - } - -} - -/** - * Utility Functions - */ - -/** - * Test if supplied argument is a valid object for current class purposes. - * Atention! The underscore version of this function should not be used for performance reasons. - */ -function _isObject(subject) { - return subject instanceof Object || typeof subject === 'object' && subject !== null; -} - -/** - * Test if supplied argument is a valid string for current class purposes. - * Atention! The underscore version of this function should not be used for performance reasons. - */ -function _isString(subject) { - return typeof subject === 'string'; -} - -/** - * Test if supplied argument is a valid function for current class purposes. - * Atention! The underscore version of this function should not be used for performance reasons. - */ -function _isFunction(subject) { - return typeof subject === 'function'; -} - -/** - * Shortcut for Object's prototype "hasOwnProperty" method. - */ -const _hasOwnProperty = Object.prototype.hasOwnProperty; - -/** - * Retrieve an object's property value by name. Composite property names (e.g., 'address.country.name') are accepted. - * @param {Object} targetObject The object we want read the property from... - * @param {String} propertyName The property to be read (e.g., 'address.street.name' or 'address.street.number' - * to read object.address.street.name or object.address.street.number, respectively); - * @returns {Any} Returns whatever the property holds or undefined if the property cannot be read or reached. - */ -function _getPropertyValue(targetObject, propertyName) { - let propertyValue; // undefined (the default return value) - if (_isObject(targetObject) && _isString(propertyName)) { - const fragments = propertyName.split(PROPERTY_SEPARATOR); - const fragmentCount = fragments.length; - if (fragmentCount > 0) { - const firstFragment = fragments[0]; - const remainingFragments = fragmentCount > 1 ? fragments.slice(1).join(PROPERTY_SEPARATOR) : null; - propertyValue = targetObject[firstFragment]; - if (remainingFragments !== null) { - propertyValue = _getPropertyValue(propertyValue, remainingFragments); - } - } - } - return propertyValue; -} - -/** - * Compare a property map with a target object using strict comparison. - * @param {Object} propertyMap The property map whose properties will be used for comparison. Composite - * property names (e.g., 'address.country.name') will be tested against the "resolved" properties from the target object. - * @param {Object} targetObject The target object whose properties will be tested. - * @returns {boolean} Returns true if the properties match, false otherwise. - */ -function _compareToPropertyMapStrict(propertyMap, targetObject) { - let result = false; - // "for in" loops do not thown exceptions for invalid data types... - for (let propertyName in propertyMap) { - if (_hasOwnProperty.call(propertyMap, propertyName)) { - if (propertyMap[propertyName] !== _getPropertyValue(targetObject, propertyName)) { - result = false; - break; - } else if (result !== true) { - result = true; - } - } - } - return result; -} - -/** - * Checks if a sorting specifier is valid. - * A valid sorting specifier consists of an array of arrays being each subarray a pair - * in the format ["property name", "sorting order"]. - * The following exemple can be used to sort studies by "date"" and use "time" to break ties in descending order. - * [ [ 'study.date', 'desc' ], [ 'study.time', 'desc' ] ] - * @param {Array} specifiers The sorting specifier to be tested. - * @returns {boolean} Returns true if the specifiers are valid, false otherwise. - */ -function _isValidSortingSpecifier(specifiers) { - let result = true; - if (specifiers instanceof Array && specifiers.length > 0) { - for (let i = specifiers.length - 1; i >= 0; i--) { - const item = specifiers[i]; - if (item instanceof Array) { - const property = item[0]; - const order = item[1]; - if (_isString(property) && (order === ORDER_ASC || order === ORDER_DESC)) { - continue; - } - } - result = false; - break; - } - } - return result; -} - -/** - * Sorts an array based on sorting specifier options. - * @param {Array} list The that needs to be sorted. - * @param {Array} specifiers An array of specifiers. Please read isValidSortingSpecifier method definition for further details. - * @returns {void} No value is returned. The array is sorted in place. - */ -function _sortListBy(list, specifiers) { - if (list instanceof Array && _isValidSortingSpecifier(specifiers)) { - const specifierCount = specifiers.length; - list.sort(function _sortListByCallback(a, b) { // callback name for stack traces... - let index = 0; - while (index < specifierCount) { - const specifier = specifiers[index]; - const property = specifier[0]; - const order = specifier[1] === ORDER_DESC ? -1 : 1; - const aValue = _getPropertyValue(a, property); - const bValue = _getPropertyValue(b, property); - // @TODO: should we check for the types being compared, like: - // ~~ if (typeof aValue !== typeof bValue) continue; - // Not sure because dates, for example, can be correctly compared to numbers... - if (aValue < bValue) { - return order * -1; - } - if (aValue > bValue) { - return order * 1; - } - if (++index >= specifierCount) { - return 0; - } - } - }); - } else { - throw new Error('Invalid Arguments'); - } -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/metadata/InstanceMetadata.js b/Packages/ohif-viewerbase/client/lib/classes/metadata/InstanceMetadata.js deleted file mode 100644 index c1e424a85..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/metadata/InstanceMetadata.js +++ /dev/null @@ -1,227 +0,0 @@ -import { Metadata } from './Metadata'; -import { OHIFError } from '../OHIFError'; - -/** - * ATTENTION! This class should never depend on StudyMetadata or SeriesMetadata classes as this could - * possibly cause circular dependency issues. - */ - -const UNDEFINED = 'undefined'; -const NUMBER = 'number'; -const STRING = 'string'; -const STUDY_INSTANCE_UID = 'x0020000d'; -const SERIES_INSTANCE_UID = 'x0020000e'; - -export class InstanceMetadata extends Metadata { - - constructor(data, uid) { - super(data, uid); - // Initialize Private Properties - Object.defineProperties(this, { - _sopInstanceUID: { - configurable: true, // configurable so that it can be redefined in sub-classes... - enumerable: false, - writable: true, - value: null - }, - _imageId: { - configurable: true, // configurable so that it can be redefined in sub-classes... - enumerable: false, - writable: true, - value: null - } - }); - // Initialize Public Properties - this._definePublicProperties(); - } - - /** - * Private Methods - */ - - /** - * Define Public Properties - * This method should only be called during initialization (inside the class constructor) - */ - _definePublicProperties() { - - /** - * Property: this.sopInstanceUID - * Same as this.getSOPInstanceUID() - * It's specially useful in contexts where a method call is not suitable like in search criteria. For example: - * sopInstanceCollection.findBy({ - * sopInstanceUID: '1.2.3.4.5.6.77777.8888888.99999999999.0' - * }); - */ - Object.defineProperty(this, 'sopInstanceUID', { - configurable: false, - enumerable: false, - get: function() { - return this.getSOPInstanceUID(); - } - }); - - } - - /** - * Public Methods - */ - - /** - * Returns the StudyInstanceUID of the current instance. This method is basically a shorthand the full "getTagValue" method call. - */ - getStudyInstanceUID() { - return this.getTagValue(STUDY_INSTANCE_UID, null); - } - - /** - * Returns the SeriesInstanceUID of the current instance. This method is basically a shorthand the full "getTagValue" method call. - */ - getSeriesInstanceUID() { - return this.getTagValue(SERIES_INSTANCE_UID, null); - } - - /** - * Returns the SOPInstanceUID of the current instance. - */ - getSOPInstanceUID() { - return this._sopInstanceUID; - } - - // @TODO: Improve this... (E.g.: blob data) - getStringValue(tagOrProperty, index, defaultValue) { - let value = this.getTagValue(tagOrProperty, defaultValue); - - if (typeof value !== STRING && typeof value !== UNDEFINED) { - value = value.toString(); - } - - return InstanceMetadata.getIndexedValue(value, index, defaultValue); - } - - // @TODO: Improve this... (E.g.: blob data) - getFloatValue(tagOrProperty, index, defaultValue) { - let value = this.getTagValue(tagOrProperty, defaultValue); - value = InstanceMetadata.getIndexedValue(value, index, defaultValue); - - if(value instanceof Array) { - value.forEach( (val, idx) => { - value[idx] = parseFloat(val); - }); - - return value; - } - - return typeof value === STRING ? parseFloat(value) : value; - } - - // @TODO: Improve this... (E.g.: blob data) - getIntValue(tagOrProperty, index, defaultValue) { - let value = this.getTagValue(tagOrProperty, defaultValue); - value = InstanceMetadata.getIndexedValue(value, index, defaultValue); - - if(value instanceof Array) { - value.forEach( (val, idx) => { - value[idx] = parseFloat(val); - }); - - return value; - } - - return typeof value === STRING ? parseInt(value) : value; - } - - /** - * @deprecated Please use getTagValue instead. - */ - getRawValue(tagOrProperty, defaultValue) { - return this.getTagValue(tagOrProperty, defaultValue); - } - - /** - * This function should be overriden by specialized classes in order to allow client libraries or viewers to take advantage of the Study Metadata API. - */ - getTagValue(tagOrProperty, defaultValue) { - /** - * Please override this method on a specialized class. - */ - throw new OHIFError('InstanceMetadata::getTagValue is not overriden. Please, override it in a specialized class. See OHIFInstanceMetadata for example'); - } - - /** - * Compares the current instance with another one. - * @param {InstanceMetadata} instance An instance of the InstanceMetadata class. - * @returns {boolean} Returns true if both instances refer to the same instance. - */ - equals(instance) { - const self = this; - return ( - instance === self || - ( - instance instanceof InstanceMetadata && - instance.getSOPInstanceUID() === self.getSOPInstanceUID() - ) - ); - } - - /** - * Check if the tagOrProperty exists - * @param {String} tagOrProperty tag or property be checked - * @return {Boolean} True if the tag or property exists or false if doesn't - */ - tagExists(tagOrProperty) { - /** - * Please override this method - */ - throw new OHIFError('InstanceMetadata::tagExists is not overriden. Please, override it in a specialized class. See OHIFInstanceMetadata for example'); - } - - /** - * Get custom image id of a sop instance - * @return {Any} sop instance image id - */ - getImageId(frame) { - /** - * Please override this method - */ - throw new OHIFError('InstanceMetadata::getImageId is not overriden. Please, override it in a specialized class. See OHIFInstanceMetadata for example'); - } - - /** - * Static Methods - */ - - /** - * Get an value based that can be index based. This function is called by all getters. See above functions. - * - If value is a String and has indexes: - * - If undefined index: returns an array of the split values. - * - If defined index: - * - If invalid: returns defaultValue - * - If valid: returns the indexed value - * - If value is not a String, returns default value. - */ - static getIndexedValue(value, index, defaultValue) { - let result = defaultValue; - - if (typeof value === STRING) { - const hasIndexValues = value.indexOf('\\') !== -1; - - result = value; - - if(hasIndexValues) { - const splitValues = value.split('\\'); - if (Metadata.isValidIndex(index)) { - const indexedValue = splitValues[index]; - - result = typeof indexedValue !== STRING ? defaultValue : indexedValue; - } - else { - result = splitValues; - } - } - } - - return result; - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/metadata/Metadata.js b/Packages/ohif-viewerbase/client/lib/classes/metadata/Metadata.js deleted file mode 100644 index 796c61782..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/metadata/Metadata.js +++ /dev/null @@ -1,127 +0,0 @@ - -/** - * Constants - */ - -const STRING = 'string'; -const NUMBER = 'number'; -const FUNCTION = 'function'; -const OBJECT = 'object'; - -/** - * Class Definition - */ - -export class Metadata { - - /** - * Constructor and Instance Methods - */ - - constructor(data, uid) { - // Define the main "_data" private property as an immutable property. - // IMPORTANT: This property can only be set during instance construction. - Object.defineProperty(this, '_data', { - configurable: false, - enumerable: false, - writable: false, - value: data - }); - - // Define the main "_uid" private property as an immutable property. - // IMPORTANT: This property can only be set during instance construction. - Object.defineProperty(this, '_uid', { - configurable: false, - enumerable: false, - writable: false, - value: uid - }); - - // Define "_custom" properties as an immutable property. - // IMPORTANT: This property can only be set during instance construction. - Object.defineProperty(this, '_custom', { - configurable: false, - enumerable: false, - writable: false, - value: Object.create(null) - }); - } - - getData() { - return this._data; - } - - getDataProperty(propertyName) { - let propertyValue; - const _data = this._data; - if (_data instanceof Object || typeof _data === OBJECT && _data !== null) { - propertyValue = _data[propertyName]; - } - return propertyValue; - } - - /** - * Get unique object ID - */ - getObjectID() { - return this._uid; - } - - /** - * Set custom attribute value - * @param {String} attribute Custom attribute name - * @param {Any} value Custom attribute value - */ - setCustomAttribute(attribute, value) { - this._custom[attribute] = value; - } - - /** - * Get custom attribute value - * @param {String} attribute Custom attribute name - * @return {Any} Custom attribute value - */ - getCustomAttribute(attribute) { - return this._custom[attribute]; - } - - /** - * Check if a custom attribute exists - * @param {String} attribute Custom attribute name - * @return {Boolean} True if custom attribute exists or false if not - */ - customAttributeExists(attribute) { - return attribute in this._custom; - } - - /** - * Set custom attributes in batch mode. - * @param {Object} attributeMap An object whose own properties will be used as custom attributes. - */ - setCustomAttributes(attributeMap) { - const _hasOwn = Object.prototype.hasOwnProperty; - const _custom = this._custom; - for (let attribute in attributeMap) { - if (_hasOwn.call(attributeMap, attribute)) { - _custom[attribute] = attributeMap[attribute]; - } - } - } - - /** - * Static Methods - */ - - static isValidUID(uid) { - return typeof uid === STRING && uid.length > 0; - } - - static isValidIndex(index) { - return typeof index === NUMBER && index >= 0 && (index | 0) === index; - } - - static isValidCallback(callback) { - return typeof callback === FUNCTION; - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/metadata/README.md b/Packages/ohif-viewerbase/client/lib/classes/metadata/README.md deleted file mode 100644 index af0451a8c..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/metadata/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# Study Metadata Module - -This module defines the API/Data-Model by which OHIF Viewerbase package and possibly distinct viewer -implementations can access studies metadata. This module does not attempt to define any means of -*loading* study metadata from any data end-point but only how the data that has been previously -loaded into the application context will be accessed by any of the routines or algorithm implementations -that need the data. - -## Intro - -For various reasons like sorting, grouping or simply rendering study information, OHIF Viewerbase package -and applications depending on it usualy have the need to access study metadata. Before the current -initiative there was no uniform way of achieving that since each implementation provides study metadata -on its own specific ways. The application and the package itself needed to have a deep knowledge of the -data structures provided by the data endpoint to perform any of the operations mentioned above, meaning -that any data access code needed to be adapted or rewritten. - -The intent of the current module is to provide a fairly consistent and flexible API/Data-Model by which -OHIF Viewerbase package (and different viewer implementations that depend on it) can manipulate DICOM matadata -retrieved from distinct data end points (e.g., a proprietary back end servers) in uniform ways with minor -to no modifications needed. - -## Implementation - -The current API implementation defines three classes of objects: `StudyMetadata`, `SeriesMetadata` -and `InstanceMetadata`. Inside OHIF Viewerbase package, every access to Study, Series or SOP Instance -metadata is achieved by the interface exposed by these three classes. By inheriting from them and -overriding or extending their methods, different applications with different data models can adapt -even the most peculiar data structures to the uniform interface defined by those classes. Together -these classes define a flexible and extensible data manipulation layer leaving routines and -algorithms that depend on that data untouched. - -## Design Decisions & "*Protected*" Members - -In order to provide for good programming practices, attributes and methods meant to be used exclusevily by -the classes themselves (for internal purposes only) were written with an initial '_' character, being thus treated -as "*protected*" members. The idea behind this practice was never to hide them from the programmers -(what makes debugging tasks painful) but only advise for something that's not part of the official public API -and thus should not be relied on. Usage of "protected" members makes the code less readable and prone to -compatibility issues. - -As an example, the initial implementation of the `StudyMetadata` class defined the attribute `_studyInstanceUID` -and the method `getStudyInstanceUID`. This implies that whenever the *StudyInstanceUID* of a given study needs -to be retrieved the `getStudyInstanceUID` method should be called instead of directly accessing the -attribute `_studyInstanceUID` (which might not even be populated since `getStudyInstanceUID` can be possiblity -overriden by a subclass to satisfy specific implementation needs, leaving the attribute `_studyInstanceUID` unused). - -Ex: - -```javascript -let studyUID = myStudy.getStudyInstanceUID(); // GOOD! :-) -[ ... ] -let otherStudyUID = anotherStudy._studyInstanceUID; // BAD... :-( -``` - -Another important topic is the preference of *methods* over *attributes* on the public API. This design -decision was made to ensure extensibility and flexibility (methods are extensible while standalone -attributes are not, and can be adapted – through overrides, for example – to support even the most -peculiar data models) even though the overhead a few additional function calls may incur. - -## Abstract Classes - -Some classes defined in this module are "*abstract*" classes (even though JavaScript does not *officially* -support such programming facility). They are *abstract* in the sense that a few methods (very important ones, -by the way) were left "*blank*" (unimplemented, or more precisely implemented as empty NOP functions) in -order to be implemented by specialized subclasses. Methods believed to be more generic were implemented in -an attempt to satify most implementation needs but nothing prevents a subclass from overriding them as well -(again, flexibility and extensibility are design goals). Most implemented methods rely on the implementation -of an unimplemented method. For example, the method `getStringValue` from `InstanceMetadata` class, which -has indeed been implemented and is meant to retrieve a metadata value as a string, internally calls the -`getRawValue` method which *was NOT implemented* and is meant to query the internal data structures for the -requested metadata value and return it *as is*. Used in that way, an application would not benefit much -from the already implemented methods. On the other hand, by simply overriding the `getRawValue` method -on a specialized class to deal with the intrinsics of its internal data structures, this very application -would now benefit from all already implemented methods. - -The following code snippet tries to illustrate the idea: - -```javascript - -// -- InstanceMetadata.js - -class InstanceMetadata { - [ ... ] - getRawValue(tagOrProperty, defaultValue) { - // Please implement this method in a specialized subclass... - } - [ ... ] - getStringValue(tagOrProperty, index, defaultValue) { - let rawValue = this.getRawValue(tagOrProperty, ''); - // parse the returned value into a string... - [ ... ] - return stringValue; - } - [ ... ] -} - -// -- MyFancyAppInstanceMetadata.js - -class MyFancyAppInstanceMetadata extends InstanceMetadata { - // Overriding this method will make all methods implemented in the super class - // that rely on it to be immediately available... - getRawValue(tagOrProperty, defaultValue) { - let rawValue; - // retrieve raw value from internal data structures... - [ ... ] - return rawValue; - } -} - -// -- main.js - -[ ... ] -let sopInstaceMetadata = new MyFancyAppInstanceMetadata(myInternalData); -if (sopInstaceMetadata instanceof MyFancyAppInstanceMetadata) { // true - // this code will be executed... -} -if (sopInstaceMetadata instanceof InstanceMetadata) { // also true - // this code will also be executed... -} -// The following will also work since the internal "getRawValue" call inside -// "getStringValue" method will now be satisfied... (thanks to the override) -let patientName = sopInstaceMetadata.getStringValue('PatientName', ''); -[ ... ] - -``` - -_Copyright © 2016 nucleushealth™. All rights reserved_ diff --git a/Packages/ohif-viewerbase/client/lib/classes/metadata/SeriesMetadata.js b/Packages/ohif-viewerbase/client/lib/classes/metadata/SeriesMetadata.js deleted file mode 100644 index 121bf8403..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/metadata/SeriesMetadata.js +++ /dev/null @@ -1,195 +0,0 @@ -import { Metadata } from './Metadata'; -import { InstanceMetadata } from './InstanceMetadata'; - -export class SeriesMetadata extends Metadata { - - constructor(data, uid) { - super(data, uid); - // Initialize Private Properties - Object.defineProperties(this, { - _seriesInstanceUID: { - configurable: true, // configurable so that it can be redefined in sub-classes... - enumerable: false, - writable: true, - value: null - }, - _instances: { - configurable: false, - enumerable: false, - writable: false, - value: [] - }, - _firstInstance: { - configurable: false, - enumerable: false, - writable: true, - value: null - } - }); - // Initialize Public Properties - this._definePublicProperties(); - } - - /** - * Private Methods - */ - - /** - * Define Public Properties - * This method should only be called during initialization (inside the class constructor) - */ - _definePublicProperties() { - - /** - * Property: this.seriesInstanceUID - * Same as this.getSeriesInstanceUID() - * It's specially useful in contexts where a method call is not suitable like in search criteria. For example: - * seriesCollection.findBy({ - * seriesInstanceUID: '1.2.3.4.5.6.77777.8888888.99999999999.0' - * }); - */ - Object.defineProperty(this, 'seriesInstanceUID', { - configurable: false, - enumerable: false, - get: function() { - return this.getSeriesInstanceUID(); - } - }); - - } - - /** - * Public Methods - */ - - /** - * Returns the SeriesInstanceUID of the current series. - */ - getSeriesInstanceUID() { - return this._seriesInstanceUID; - } - - /** - * Append an instance to the current series. - * @param {InstanceMetadata} instance The instance to be added to the current series. - * @returns {boolean} Returns true on success, false otherwise. - */ - addInstance(instance) { - let result = false; - if (instance instanceof InstanceMetadata && this.getInstanceByUID(instance.getSOPInstanceUID()) === void 0) { - this._instances.push(instance); - result = true; - } - return result; - } - - /** - * Get the first instance of the current series retaining a consistent result across multiple calls. - * @return {InstanceMetadata} An instance of the InstanceMetadata class or null if it does not exist. - */ - getFirstInstance() { - let instance = this._firstInstance; - if (!(instance instanceof InstanceMetadata)) { - instance = null; - const found = this.getInstanceByIndex(0); - if (found instanceof InstanceMetadata) { - this._firstInstance = found; - instance = found; - } - } - return instance; - } - - /** - * Find an instance by index. - * @param {number} index An integer representing a list index. - * @returns {InstanceMetadata} Returns a InstanceMetadata instance when found or undefined otherwise. - */ - getInstanceByIndex(index) { - let found; // undefined by default... - if (Metadata.isValidIndex(index)) { - found = this._instances[index]; - } - return found; - } - - /** - * Find an instance by SOPInstanceUID. - * @param {string} uid An UID string. - * @returns {InstanceMetadata} Returns a InstanceMetadata instance when found or undefined otherwise. - */ - getInstanceByUID(uid) { - let found; // undefined by default... - if (Metadata.isValidUID(uid)) { - found = this._instances.find(instance => { - return instance.getSOPInstanceUID() === uid; - }); - } - return found; - } - - /** - * Retrieve the number of instances within the current series. - * @returns {number} The number of instances in the current series. - */ - getInstanceCount() { - return this._instances.length; - } - - /** - * Invokes the supplied callback for each instance in the current series passing - * two arguments: instance (an InstanceMetadata instance) and index (the integer - * index of the instance within the current series) - * @param {function} callback The callback function which will be invoked for each instance in the series. - * @returns {undefined} Nothing is returned. - */ - forEachInstance(callback) { - if (Metadata.isValidCallback(callback)) { - this._instances.forEach((instance, index) => { - callback.call(null, instance, index); - }); - } - } - - /** - * Find the index of an instance inside the series. - * @param {InstanceMetadata} instance An instance of the SeriesMetadata class. - * @returns {number} The index of the instance inside the series or -1 if not found. - */ - indexOfInstance(instance) { - return this._instances.indexOf(instance); - } - - /** - * Search the associated instances using the supplied callback as criteria. The callback is passed - * two arguments: instance (a InstanceMetadata instance) and index (the integer - * index of the instance within its series) - * @param {function} callback The callback function which will be invoked for each instance. - * @returns {InstanceMetadata|undefined} If an instance is found based on callback criteria it - * returns a InstanceMetadata. "undefined" is returned otherwise - */ - findInstance(callback) { - if (Metadata.isValidCallback(callback)) { - return this._instances.find((instance, index) => { - return callback.call(null, instance, index); - }); - } - } - - /** - * Compares the current series with another one. - * @param {SeriesMetadata} series An instance of the SeriesMetadata class. - * @returns {boolean} Returns true if both instances refer to the same series. - */ - equals(series) { - const self = this; - return ( - series === self || - ( - series instanceof SeriesMetadata && - series.getSeriesInstanceUID() === self.getSeriesInstanceUID() - ) - ); - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/metadata/StudyMetadata.js b/Packages/ohif-viewerbase/client/lib/classes/metadata/StudyMetadata.js deleted file mode 100644 index ea2d82c88..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/metadata/StudyMetadata.js +++ /dev/null @@ -1,402 +0,0 @@ -import { Metadata } from './Metadata'; -import { SeriesMetadata } from './SeriesMetadata'; -import { InstanceMetadata } from './InstanceMetadata'; -import { ImageSet } from '../ImageSet'; -import { OHIFError } from '../OHIFError'; - -export class StudyMetadata extends Metadata { - - constructor(data, uid) { - super(data, uid); - // Initialize Private Properties - Object.defineProperties(this, { - _studyInstanceUID: { - configurable: true, // configurable so that it can be redefined in sub-classes... - enumerable: false, - writable: true, - value: null - }, - _series: { - configurable: false, - enumerable: false, - writable: false, - value: [] - }, - _displaySets: { - configurable: false, - enumerable: false, - writable: false, - value: [] - }, - _firstSeries: { - configurable: false, - enumerable: false, - writable: true, - value: null - }, - _firstInstance: { - configurable: false, - enumerable: false, - writable: true, - value: null - } - }); - // Initialize Public Properties - this._definePublicProperties(); - } - - /** - * Private Methods - */ - - /** - * Define Public Properties - * This method should only be called during initialization (inside the class constructor) - */ - _definePublicProperties() { - - /** - * Property: this.studyInstanceUID - * Same as this.getStudyInstanceUID() - * It's specially useful in contexts where a method call is not suitable like in search criteria. For example: - * studyCollection.findBy({ - * studyInstanceUID: '1.2.3.4.5.6.77777.8888888.99999999999.0' - * }); - */ - Object.defineProperty(this, 'studyInstanceUID', { - configurable: false, - enumerable: false, - get: function() { - return this.getStudyInstanceUID(); - } - }); - - } - - /** - * Public Methods - */ - - /** - * Getter for displaySets - * @return {Array} Array of display set object - */ - getDisplaySets() { - return this._displaySets.slice(); - } - - /** - * Set display sets - * @param {Array} displaySets Array of display sets (ImageSet[]) - */ - setDisplaySets(displaySets) { - displaySets.forEach(displaySet => this.addDisplaySet(displaySet)); - } - - /** - * Add a single display set to the list - * @param {Object} displaySet Display set object - * @returns {boolean} True on success, false on failure. - */ - addDisplaySet(displaySet) { - if (displaySet instanceof ImageSet) { - this._displaySets.push(displaySet); - return true; - } - return false; - } - - /** - * Invokes the supplied callback for each display set in the current study passing - * two arguments: display set (a ImageSet instance) and index (the integer - * index of the display set within the current study) - * @param {function} callback The callback function which will be invoked for each display set instance. - * @returns {undefined} Nothing is returned. - */ - forEachDisplaySet(callback) { - if (Metadata.isValidCallback(callback)) { - this._displaySets.forEach((displaySet, index) => { - callback.call(null, displaySet, index); - }); - } - } - - /** - * Search the associated display sets using the supplied callback as criteria. The callback is passed - * two arguments: display set (a ImageSet instance) and index (the integer - * index of the display set within the current study) - * @param {function} callback The callback function which will be invoked for each display set instance. - * @returns {undefined} Nothing is returned. - */ - findDisplaySet(callback) { - if (Metadata.isValidCallback(callback)) { - return this._displaySets.find((displaySet, index) => { - return callback.call(null, displaySet, index); - }); - } - } - - /** - * Retrieve the number of display sets within the current study. - * @returns {number} The number of display sets in the current study. - */ - getDisplaySetCount() { - return this._displaySets.length; - } - - /** - * Returns the StudyInstanceUID of the current study. - */ - getStudyInstanceUID() { - return this._studyInstanceUID; - } - - /** - * Getter for series - * @return {Array} Array of SeriesMetadata object - */ - getSeries() { - return this._series.slice(); - } - - /** - * Append a series to the current study. - * @param {SeriesMetadata} series The series to be added to the current study. - * @returns {boolean} Returns true on success, false otherwise. - */ - addSeries(series) { - let result = false; - if (series instanceof SeriesMetadata && this.getSeriesByUID(series.getSeriesInstanceUID()) === void 0) { - this._series.push(series); - result = true; - } - return result; - } - - /** - * Find a series by index. - * @param {number} index An integer representing a list index. - * @returns {SeriesMetadata} Returns a SeriesMetadata instance when found or undefined otherwise. - */ - getSeriesByIndex(index) { - let found; // undefined by default... - if (Metadata.isValidIndex(index)) { - found = this._series[index]; - } - return found; - } - - /** - * Find a series by SeriesInstanceUID. - * @param {string} uid An UID string. - * @returns {SeriesMetadata} Returns a SeriesMetadata instance when found or undefined otherwise. - */ - getSeriesByUID(uid) { - let found; // undefined by default... - if (Metadata.isValidUID(uid)) { - found = this._series.find(series => { - return series.getSeriesInstanceUID() === uid; - }); - } - return found; - } - - /** - * Retrieve the number of series within the current study. - * @returns {number} The number of series in the current study. - */ - getSeriesCount() { - return this._series.length; - } - - /** - * Retrieve the number of instances within the current study. - * @returns {number} The number of instances in the current study. - */ - getInstanceCount() { - return this._series.reduce((sum, series) => { - return sum + series.getInstanceCount(); - }, 0); - } - - /** - * Invokes the supplied callback for each series in the current study passing - * two arguments: series (a SeriesMetadata instance) and index (the integer - * index of the series within the current study) - * @param {function} callback The callback function which will be invoked for each series instance. - * @returns {undefined} Nothing is returned. - */ - forEachSeries(callback) { - if (Metadata.isValidCallback(callback)) { - this._series.forEach((series, index) => { - callback.call(null, series, index); - }); - } - } - - /** - * Find the index of a series inside the study. - * @param {SeriesMetadata} series An instance of the SeriesMetadata class. - * @returns {number} The index of the series inside the study or -1 if not found. - */ - indexOfSeries(series) { - return this._series.indexOf(series); - } - - /** - * It sorts the series based on display sets order. Each series must be an instance - * of SeriesMetadata and each display sets must be an instance of ImageSet. - * Useful example of usage: - * Study data provided by backend does not sort series at all and client-side - * needs series sorted by the same criteria used for sorting display sets. - */ - sortSeriesByDisplaySets() { - - // Object for mapping display sets' index by seriesInstanceUid - const displaySetsMapping = {}; - - // Loop through each display set to create the mapping - this.forEachDisplaySet( (displaySet, index) => { - - if (!(displaySet instanceof ImageSet)) { - throw new OHIFError(`StudyMetadata::sortSeriesByDisplaySets display set at index ${index} is not an instance of ImageSet`); - } - - // In case of multiframe studies, just get the first index occurence - if (displaySetsMapping[displaySet.seriesInstanceUid] === void 0) { - displaySetsMapping[displaySet.seriesInstanceUid] = index; - } - }); - - // Clone of actual series - const actualSeries = this.getSeries(); - - actualSeries.forEach( (series, index) => { - - if (!(series instanceof SeriesMetadata)) { - throw new OHIFError(`StudyMetadata::sortSeriesByDisplaySets series at index ${index} is not an instance of SeriesMetadata`); - } - - // Get the new series index - const seriesIndex = displaySetsMapping[series.getSeriesInstanceUID()]; - - // Update the series object with the new series position - this._series[seriesIndex] = series; - }); - } - - /** - * Compares the current study instance with another one. - * @param {StudyMetadata} study An instance of the StudyMetadata class. - * @returns {boolean} Returns true if both instances refer to the same study. - */ - equals(study) { - const self = this; - return ( - study === self || - ( - study instanceof StudyMetadata && - study.getStudyInstanceUID() === self.getStudyInstanceUID() - ) - ); - } - - /** - * Get the first series of the current study retaining a consistent result across multiple calls. - * @return {SeriesMetadata} An instance of the SeriesMetadata class or null if it does not exist. - */ - getFirstSeries() { - let series = this._firstSeries; - if (!(series instanceof SeriesMetadata)) { - series = null; - const found = this.getSeriesByIndex(0); - if (found instanceof SeriesMetadata) { - this._firstSeries = found; - series = found; - } - } - return series; - } - - /** - * Get the first instance of the current study retaining a consistent result across multiple calls. - * @return {InstanceMetadata} An instance of the InstanceMetadata class or null if it does not exist. - */ - getFirstInstance() { - let instance = this._firstInstance; - if (!(instance instanceof InstanceMetadata)) { - instance = null; - const firstSeries = this.getFirstSeries(); - if (firstSeries instanceof SeriesMetadata) { - const found = firstSeries.getFirstInstance(); - if (found instanceof InstanceMetadata) { - this._firstInstance = found; - instance = found; - } - } - } - return instance; - } - - /** - * Search the associated series to find an specific instance using the supplied callback as criteria. - * The callback is passed two arguments: instance (a InstanceMetadata instance) and index (the integer - * index of the instance within the current series) - * @param {function} callback The callback function which will be invoked for each instance instance. - * @returns {Object} Result object containing series (SeriesMetadata) and instance (InstanceMetadata) - * objects or an empty object if not found. - */ - findSeriesAndInstanceByInstance(callback) { - let result; - - if (Metadata.isValidCallback(callback)) { - let instance; - - const series = this._series.find(series => { - instance = series.findInstance(callback); - return instance instanceof InstanceMetadata; - }); - - // No series found - if (series instanceof SeriesMetadata) { - result = { - series, - instance - }; - } - } - - return result || {}; - } - - /** - * Find series by instance using the supplied callback as criteria. The callback is passed - * two arguments: instance (a InstanceMetadata instance) and index (the integer index of - * the instance within its series) - * @param {function} callback The callback function which will be invoked for each instance. - * @returns {SeriesMetadata|undefined} If a series is found based on callback criteria it - * returns a SeriesMetadata. "undefined" is returned otherwise - */ - findSeriesByInstance(callback) { - const result = this.findSeriesAndInstanceByInstance(callback); - - return result.series; - } - - /** - * Find an instance using the supplied callback as criteria. The callback is passed - * two arguments: instance (a InstanceMetadata instance) and index (the integer index of - * the instance within its series) - * @param {function} callback The callback function which will be invoked for each instance. - * @returns {InstanceMetadata|undefined} If an instance is found based on callback criteria it - * returns a InstanceMetadata. "undefined" is returned otherwise - */ - findInstance(callback) { - const result = this.findSeriesAndInstanceByInstance(callback); - - return result.instance; - } - - - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/metadata/StudySummary.js b/Packages/ohif-viewerbase/client/lib/classes/metadata/StudySummary.js deleted file mode 100644 index c88f0ccb2..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/metadata/StudySummary.js +++ /dev/null @@ -1,78 +0,0 @@ -import { Metadata } from './Metadata'; -import { OHIFError } from '../OHIFError'; -import { DICOMTagDescriptions } from '../../DICOMTagDescriptions'; - -/** - * Constants - */ - -const STUDY_INSTANCE_UID = 'x0020000d'; - -/** - * Class Definition - */ - -export class StudySummary extends Metadata { - - constructor(tagMap, attributeMap, uid) { - - // Call the superclass constructor passing an plain object with no prototype to be used as the main "_data" attribute. - const _data = Object.create(null); - super(_data, uid); - - // Initialize internal tag map if first argument is given. - if (tagMap !== void 0) { - this.addTags(tagMap); - } - - // Initialize internal property map if second argument is given. - if (attributeMap !== void 0) { - this.setCustomAttributes(attributeMap); - } - - } - - getStudyInstanceUID() { - // This method should return null if StudyInstanceUID is not available to keep compatibility StudyMetadata API - return this.getTagValue(STUDY_INSTANCE_UID) || null; - } - - /** - * Append tags to internal tag map. - * @param {Object} tagMap An object whose own properties will be used as tag values and appended to internal tag map. - */ - addTags(tagMap) { - const _hasOwn = Object.prototype.hasOwnProperty; - const _data = this._data; - for (let tag in tagMap) { - if (_hasOwn.call(tagMap, tag)) { - const description = DICOMTagDescriptions.find(tag); - // When a description is available, use its tag as internal key... - if (description) { - _data[description.tag] = tagMap[tag]; - } else { - _data[tag] = tagMap[tag]; - } - } - } - } - - tagExists(tagName) { - const _data = this._data; - const description = DICOMTagDescriptions.find(tagName); - if (description) { - return (description.tag in _data); - } - return (tagName in _data); - } - - getTagValue(tagName) { - const _data = this._data; - const description = DICOMTagDescriptions.find(tagName); - if (description) { - return _data[description.tag]; - } - return _data[tagName]; - } - -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/metadata/WadoRsMetaDataBuilder.js b/Packages/ohif-viewerbase/client/lib/classes/metadata/WadoRsMetaDataBuilder.js deleted file mode 100644 index 98d158b2e..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/metadata/WadoRsMetaDataBuilder.js +++ /dev/null @@ -1,48 +0,0 @@ -export class WadoRsMetaDataBuilder { - constructor() { - this.tags = {}; - } - - addTag(tag, value, multi) { - this.tags[tag] = { - tag, - value, - multi - }; - - return this; - } - - toJSON() { - const json = {}; - const keys = Object.keys(this.tags); - - keys.forEach(key => { - if (!this.tags.hasOwnProperty(key)) { - return; - } - - const tag = this.tags[key]; - const multi = !!tag.multi; - let value = tag.value; - - if ((value == null) || ((value.length === 1) && (value[0] == null))) { - return; - } - - if ((typeof value === 'string') && multi) { - value = value.split('\\'); - } - - if (!_.isArray(value)) { - value = [value]; - } - - json[key] = { - Value: value - }; - }); - - return json; - } -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/plugins/OHIFPlugin.js b/Packages/ohif-viewerbase/client/lib/classes/plugins/OHIFPlugin.js deleted file mode 100644 index c31408edc..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/plugins/OHIFPlugin.js +++ /dev/null @@ -1,75 +0,0 @@ -export class OHIFPlugin { - // TODO: this class is still under development and will - // likely change in the near future - constructor () { - this.name = "Unnamed plugin"; - this.description = "No description available"; - } - - // load an individual script URL - static loadScript(scriptURL, type = "text/javascript") { - return new Promise((resolve, reject) => { - const head = document.getElementsByTagName("head")[0]; - const script = document.createElement("script"); - - script.onload = () => { - head.removeChild(script); - resolve(); - }; - - script.onerror = reject; - - script.src = scriptURL; - script.type = type; - script.async = false; - - head.appendChild(script); - }); - } - - // reload all the dependency scripts and also - // the main plugin script url. - static reloadPlugin(plugin) { - if (plugin.scriptURLs && plugin.scriptURLs.length) { - plugin.scriptURLs.forEach(scriptURL => { - this.loadScript(scriptURL); - }); - } - - // TODO: Later we should probably merge script and module URLs - if (plugin.moduleURLs && plugin.moduleURLs.length) { - plugin.moduleURLs.forEach(moduleURLs => { - this.loadScript(moduleURLs, "module"); - }); - } - - if (plugin.styleURLs && plugin.styleURLs.length) { - plugin.styleURLs.forEach(styleURLs => { - this.loadScript(styleURLs, "text/css"); - }); - } - - let scriptURL = plugin.url; - - if (plugin.allowCaching === false) { - scriptURL += "?" + performance.now(); - } - - const type = plugin.module === true ? 'module' : 'text/javascript' - - console.warn(`Calling loadScript for ${plugin.name}`); - console.time(`loadScript ${plugin.name}`); - this.loadScript(scriptURL, type).then((script) => { - console.timeEnd(`loadScript ${plugin.name}`); - const entryPointFunction = OHIF.plugins.entryPoints[plugin.name]; - - if (entryPointFunction) { - entryPointFunction(); - } else { - throw new Error(`No entry point found for ${plugin.name}`); - } - }, error => { - throw new Error(error); - }); - } -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/plugins/ViewportPlugin.js b/Packages/ohif-viewerbase/client/lib/classes/plugins/ViewportPlugin.js deleted file mode 100644 index ef33a6175..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/plugins/ViewportPlugin.js +++ /dev/null @@ -1,170 +0,0 @@ -import { Session } from 'meteor/session'; -import { Tracker } from 'meteor/tracker'; - -import { OHIF } from 'meteor/ohif:core'; - -import { OHIFPlugin } from "./OHIFPlugin"; - -export class ViewportPlugin extends OHIFPlugin { - constructor(name) { - super(); - - this.name = name; - this._destroyed = false; - - this._setupListeners(); - } - - /** - * Retrieve a Display Set for a specific viewport by viewport index, - * if one is already displayed in the viewport. - * - * @static - * @param {Number} viewportIndex - * @return {undefined|ImageSet} - */ - static getDisplaySet(viewportIndex) { - // TODO: Move layoutManager from viewerbase to viewer - const { layoutManager } = OHIF.viewerbase; - const viewportData = layoutManager.viewportData[viewportIndex]; - const { studyInstanceUid, displaySetInstanceUid } = viewportData; - const studyMetadata = OHIF.viewer.StudyMetadataList.findBy({ studyInstanceUID: studyInstanceUid }); - - return studyMetadata.findDisplaySet(displaySet => { - return displaySet.displaySetInstanceUid === displaySetInstanceUid; - }); - } - - /** - * Set up the viewport using the plugin. - * - * This should be implemented by the child class. - * - * @abstract - * - * @param {HTMLElement} div - * @param {ImageSet} displaySet - * @param {Object} viewportDetails - */ - setupViewport(div, displaySet, viewportDetails) { - throw new Error('You must override this method!'); - } - - /** - * Switch a single viewport to use the current ViewportPlugin - * - * @param {Number} viewportIndex The viewport to switch to the current plugin type - */ - setViewportToPlugin(viewportIndex) { - if (!this.name) { - throw new Error('ViewportPlugin subclasses must have a name'); - } - - const { layoutManager } = OHIF.viewerbase; - const viewportData = layoutManager.viewportData[viewportIndex]; - if (viewportData.plugin === this.name) { - OHIF.log.info(`setViewportToPlugin: Viewport ${viewportIndex} already set to plugin ${this.name}`); - } - - viewportData.plugin = this.name; - - layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, viewportData); - } - - /** - * Runs 'setupViewport' for the ViewportPlugin on all viewports which should - * be rendered by this plugin, but have not yet been initialized. Viewports - * which already contain contents are skipped. - * - * @private - */ - _initEmptyPluginViewports() { - if (!this.name) { - throw new Error('ViewportPlugin subclasses must have a name'); - } - - // Find all Viewport HTMLElements currently using this plugin - const pluginDivs = Array.from(document.querySelectorAll(`.viewport-plugin-${this.name}`)); - - // If there are no Viewports using this plugin, stop here - if (!pluginDivs.length) { - return; - } - - const emptyPluginDivs = pluginDivs.filter(div => { - // Keep only divs owned by the plugin which have no contents - return div.innerHTML.trim() === ''; - }); - - OHIF.log.info(`${this.name}: Initializing ${emptyPluginDivs.length} viewports`); - - // Retrieve the list of all viewports, so we can figure out the viewport details - const allViewports = Array.from(document.querySelectorAll('.viewportContainer')); - - const { layoutManager } = OHIF.viewerbase; - - emptyPluginDivs.forEach(div => { - // Identify the Viewport index, and any display set that is currently - // hung in the viewport - const viewportIndex = allViewports.indexOf(div.parentNode); - const viewportData = layoutManager.viewportData[viewportIndex]; - const displaySet = ViewportPlugin.getDisplaySet(viewportIndex); - - // Use the plugin's setupViewport function to render the contents - // of this viewport. - this.setupViewport(div, viewportData, displaySet); - }); - } - - /** - * Listen for changes to the viewport layout which would necessitate a - * rerendering of the viewports. When this happens, re-render all viewports - * which are using this plugin. - * - * @private - */ - _setupListeners() { - if (!this.name) { - throw new Error('ViewportPlugin subclasses must have a name'); - } - - console.warn(`_setupListeners: ${this.name}`); - - // TODO: Stop using Meteor's reactivity here - Tracker.autorun((computation) => { - const random = Session.get('LayoutManagerUpdated'); - console.warn(`LayoutManagerUpdated: ${this.name}: ${random}`); - - // Bail out if this is the first time the autorun - // executes (i.e. when it is being defined). - // - // Note: This has to be checked after the dependency on the - // Session variable above, or the reactive dependency will not - // be established. - if (computation.firstRun === true) { - return; - } - - // In case we need to disable the use - // of this plugin, we can also stop the - // reactive computation by setting - // this.destroyed to true. - if (this._destroyed === true) { - computation.stop(); - } - - // Identify all viewports which should be - // rendered by the ViewportPlugin, and render - // them. - this._initEmptyPluginViewports(); - }); - } - - /** - * Stop listening for changes to the viewport layout in order to - * automatically rerender viewports setup for use by this plugin. - */ - stopListeners() { - this._destroyed = true; - } -} diff --git a/Packages/ohif-viewerbase/client/lib/classes/plugins/index.js b/Packages/ohif-viewerbase/client/lib/classes/plugins/index.js deleted file mode 100644 index d77b077a0..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/plugins/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -import { OHIFPlugin } from './OHIFPlugin'; -import { ViewportPlugin } from './ViewportPlugin'; - -// Each plugin registers an entry point function to be called -// when the loading is complete. - -const plugins = { - OHIFPlugin, - ViewportPlugin, - entryPoints: {} -}; - -// TODO: When we reorganize the packages, we should figure out where to put this. -OHIF.plugins = plugins; - -export default plugins; diff --git a/Packages/ohif-viewerbase/client/lib/createStacks.js b/Packages/ohif-viewerbase/client/lib/createStacks.js deleted file mode 100644 index 6c7414961..000000000 --- a/Packages/ohif-viewerbase/client/lib/createStacks.js +++ /dev/null @@ -1,128 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { ImageSet } from './classes/ImageSet'; -import { isImage } from './isImage'; -import { OHIF } from 'meteor/ohif:core'; - -const isMultiFrame = instance => { - // NumberOfFrames (0028,0008) - return instance.getRawValue('x00280008') > 1; -}; - -const makeDisplaySet = (series, instances) => { - const instance = instances[0]; - - const imageSet = new ImageSet(instances); - const seriesData = series.getData(); - - // set appropriate attributes to image set... - imageSet.setAttributes({ - displaySetInstanceUid: imageSet.uid, // create a local alias for the imageSet UID - seriesDate: seriesData.seriesDate, - seriesTime: seriesData.seriesTime, - seriesInstanceUid: series.getSeriesInstanceUID(), - seriesNumber: instance.getRawValue('x00200011'), - seriesDescription: instance.getRawValue('x0008103e'), - numImageFrames: instances.length, - frameRate: instance.getRawValue('x00181063'), - modality: instance.getRawValue('x00080060'), - isMultiFrame: isMultiFrame(instance) - }); - - // Sort the images in this series if needed - const shallSort = !OHIF.utils.ObjectPath.get(Meteor, 'settings.public.ui.sortSeriesByIncomingOrder'); - if (shallSort) { - imageSet.sortBy((a, b) => { - // Sort by InstanceNumber (0020,0013) - return (parseInt(a.getRawValue('x00200013', 0)) || 0) - (parseInt(b.getRawValue('x00200013', 0)) || 0); - }); - } - - // Include the first image instance number (after sorted) - imageSet.setAttribute('instanceNumber', imageSet.getImage(0).getRawValue('x00200013')); - - return imageSet; -}; - -const isSingleImageModality = modality => { - return (modality === 'CR' || - modality === 'MG' || - modality === 'DX'); -}; - -/** - * Creates a set of series to be placed in the Study Metadata - * The series that appear in the Study Metadata must represent - * imaging modalities. - * - * Furthermore, for drag/drop functionality, - * it is easiest if the stack objects also contain information about - * which study they are linked to. - * - * @param study The study instance metadata to be used - * @returns {Array} An array of series to be placed in the Study Metadata - */ -const createStacks = study => { - // Define an empty array of display sets - const displaySets = []; - - if (!study || !study.getSeriesCount()) { - return displaySets; - } - - // Loop through the series (SeriesMetadata) - study.forEachSeries(series => { - // If the series has no instances, skip it - if (!series.getInstanceCount()) { - return; - } - - // Search through the instances (InstanceMedatada object) of this series - // Split Multi-frame instances and Single-image modalities - // into their own specific display sets. Place the rest of each - // series into another display set. - const stackableInstances = []; - series.forEachInstance(instance => { - // All imaging modalities must have a valid value for sopClassUid (x00080016) or rows (x00280010) - if (!isImage(instance.getRawValue('x00080016')) && !instance.getRawValue('x00280010')) { - return; - } - - let displaySet; - if (isMultiFrame(instance)) { - displaySet = makeDisplaySet(series, [ instance ]); - displaySet.setAttributes({ - isClip: true, - studyInstanceUid: study.getStudyInstanceUID(), // Include the study instance Uid for drag/drop purposes - numImageFrames: instance.getRawValue('x00280008'), // Override the default value of instances.length - instanceNumber: instance.getRawValue('x00200013'), // Include the instance number - acquisitionDatetime: instance.getRawValue('x0008002a') // Include the acquisition datetime - }); - displaySets.push(displaySet); - } else if (isSingleImageModality(instance.modality)) { - displaySet = makeDisplaySet(series, [ instance ]); - displaySet.setAttributes({ - studyInstanceUid: study.getStudyInstanceUID(), // Include the study instance Uid - instanceNumber: instance.getRawValue('x00200013'), // Include the instance number - acquisitionDatetime: instance.getRawValue('x0008002a') // Include the acquisition datetime - }); - displaySets.push(displaySet); - } else { - stackableInstances.push(instance); - } - }); - - if (stackableInstances.length) { - const displaySet = makeDisplaySet(series, stackableInstances); - displaySet.setAttribute('studyInstanceUid', study.getStudyInstanceUID()); - displaySets.push(displaySet); - } - }); - - return displaySets; -}; - -/** - * Expose "createStacks"... - */ - -export { createStacks }; diff --git a/Packages/ohif-viewerbase/client/lib/crosshairsSynchronizers.js b/Packages/ohif-viewerbase/client/lib/crosshairsSynchronizers.js deleted file mode 100644 index a02bbb7f6..000000000 --- a/Packages/ohif-viewerbase/client/lib/crosshairsSynchronizers.js +++ /dev/null @@ -1,4 +0,0 @@ - -export const crosshairsSynchronizers = { - synchronizers: {} -}; diff --git a/Packages/ohif-viewerbase/client/lib/debugReactivity.js b/Packages/ohif-viewerbase/client/lib/debugReactivity.js deleted file mode 100644 index 25e1e6d79..000000000 --- a/Packages/ohif-viewerbase/client/lib/debugReactivity.js +++ /dev/null @@ -1,70 +0,0 @@ -import { Meteor } from 'meteor/meteor'; - -Meteor.startup(function() { - var debug = false; - - if (debug === true) { - // http://www.meteorpedia.com/read/Debugging_Reactivity - - Meteor.autorun(function(computation) { - computation.onInvalidate(function() { - console.trace(); - }); - }); - - var wrappedFind = Meteor.Collection.prototype.find; - - Meteor.Collection.prototype.find = function() { - var cursor = wrappedFind.apply(this, arguments); - var collectionName = this._name || this._debugName; - - /*cursor.observeChanges({ - added: function(id, fields) { - console.log(collectionName, 'added', id, fields); - }, - changed: function(id, fields) { - console.log(collectionName, 'changed', id, fields); - }, - movedBefore: function(id, before) { - console.log(collectionName, 'movedBefore', id, before); - }, - removed: function(id) { - console.log(collectionName, 'removed', id); - } - });*/ - - cursor.observe({ - added: function(data) { - console.log(collectionName, 'added', data); - }, - changed: function(data) { - console.log(collectionName, 'changed', data); - }, - removed: function(data) { - console.log(collectionName, 'removed', data); - } - }); - - return cursor; - }; - - function logRenders() { - Object.keys(Template).forEach(function(name) { - if (name.indexOf('_') > -1) { - return; - } - - var template = Template[name]; - var oldRender = template.rendered; - var counter = 0; - - template.rendered = function() { - console.log(name, 'render count: ', ++counter); - oldRender && oldRender.apply(this, arguments); - }; - }); - } - - logRenders(); - } -}); diff --git a/Packages/ohif-viewerbase/client/lib/dialogUtils.js b/Packages/ohif-viewerbase/client/lib/dialogUtils.js deleted file mode 100644 index d39e0d0b7..000000000 --- a/Packages/ohif-viewerbase/client/lib/dialogUtils.js +++ /dev/null @@ -1,72 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { Template } from 'meteor/templating'; -import { $ } from 'meteor/jquery'; - -import { setFocusToActiveViewport } from './setFocusToActiveViewport'; - -let doneCallbackFunction; - -/** - * Removes the backdrop abd closes opened dialog - * and focus to the active viewport. If a done callback is set, - * it's called before - * @param {Boolean} runCallback Indicate if callback function needs to be called. Default: true - */ -const closeHandler = (runCallback = true) => { - // Check if callback function exists - if (runCallback && typeof doneCallbackFunction === 'function') { - doneCallbackFunction(); - } - - // Hide the lesion dialog - $('#confirmDeleteDialog').css('display', 'none'); - - // Remove the backdrop - $('.removableBackdrop').remove(); - - // Remove the callback - doneCallbackFunction = undefined; - - // Restore the focus to the active viewport - setFocusToActiveViewport(); -}; - -/** - * Displays the confirmation dialog template and the removable backdrop element - * - * @param doneCallback A callback - * @param options - */ -const showConfirmDialog = (doneCallback, options) => { - // Show the backdrop - options = options || {}; - Blaze.renderWithData(Template.removableBackdrop, options, document.body); - - let confirmDeleteDialog = $('#confirmDeleteDialog'); - confirmDeleteDialog.remove(); - - const viewer = document.getElementById('viewer'); - Blaze.renderWithData(Template.confirmDeleteDialog, options, viewer); - - // Make sure the context menu is closed when the user clicks away - $('.removableBackdrop').one('mousedown touchstart', () => { - // Close dialog without calling callback - closeHandler(false); - }); - - confirmDeleteDialog = $('#confirmDeleteDialog'); - confirmDeleteDialog.css('display', 'block'); - confirmDeleteDialog.focus(); - - // If callback function is defined, save it for closeHandler - if (doneCallback && typeof doneCallback === 'function') { - doneCallbackFunction = doneCallback; - } -}; - -const dialogUtils = { - showConfirmDialog, - closeHandler -}; - -export { dialogUtils }; \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/lib/displayReferenceLines.js b/Packages/ohif-viewerbase/client/lib/displayReferenceLines.js deleted file mode 100644 index 2fafd7db5..000000000 --- a/Packages/ohif-viewerbase/client/lib/displayReferenceLines.js +++ /dev/null @@ -1,52 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * This function disables reference lines for a specific viewport element. - * It also enables reference lines for all other viewports with the - * class .imageViewerViewport. - * - * @param element {node} DOM Node representing the viewport element - */ -export function displayReferenceLines(element) { - - // Check if image plane (orientation / loction) data is present for the current image - const enabledElement = cornerstone.getEnabledElement(element); - - // Check if element is already enabled and it's image was rendered - if(!enabledElement || !enabledElement.image) { - OHIF.log.info('displayReferenceLines enabled element is undefined or it\'s image is not rendered'); - return; - } - - const imageId = enabledElement.image.imageId; - const imagePlane = cornerstone.metaData.get('imagePlane', imageId); - - // Disable reference lines for the current element - cornerstoneTools.referenceLines.tool.disable(element); - - if (!OHIF.viewer.refLinesEnabled || !imagePlane || !imagePlane.frameOfReferenceUID) { - OHIF.log.info('displayReferenceLines refLinesEnabled is not enabled, no imagePlane or no frameOfReferenceUID'); - return; - } - - OHIF.log.info(`displayReferenceLines for image with id: ${imageId}`); - - // Loop through all other viewport elements and enable reference lines - $('.imageViewerViewport').not(element).each((index, viewportElement) => { - let imageId; - if($(viewportElement).find('canvas').length) { - try { - const enabledElement = cornerstone.getEnabledElement(viewportElement); - imageId = enabledElement.image.imageId; - } catch(error) { - return; - } - - if (!imageId) { - return; - } - - cornerstoneTools.referenceLines.tool.enable(viewportElement, OHIF.viewer.updateImageSynchronizer); - } - }); -} diff --git a/Packages/ohif-viewerbase/client/lib/getElementIfNotEmpty.js b/Packages/ohif-viewerbase/client/lib/getElementIfNotEmpty.js deleted file mode 100644 index 2e4d61162..000000000 --- a/Packages/ohif-viewerbase/client/lib/getElementIfNotEmpty.js +++ /dev/null @@ -1,27 +0,0 @@ -import { $ } from 'meteor/jquery'; - -export function getElementIfNotEmpty(viewportIndex) { - // Meteor template helpers run more often than expected - // They often seem to run just before the whole template is rendered - // This meant that the onRendered event hadn't fired yet, so the - // element wasn't enabled / set empty yet. The check here - // for canvases under the 'enabled' element div is to prevent - // 'undefined' errors from the helper functions - - var imageViewerViewports = $('.imageViewerViewport'), - element = imageViewerViewports.get(viewportIndex), - canvases = imageViewerViewports.eq(viewportIndex).find('canvas'); - - if (!element || $(element).hasClass('empty') || canvases.length === 0) { - return; - } - - // Check to make sure the element is enabled. - try { - var enabledElement = cornerstone.getEnabledElement(element); - } catch(error) { - return; - } - - return element; -} diff --git a/Packages/ohif-viewerbase/client/lib/getFrameOfReferenceUID.js b/Packages/ohif-viewerbase/client/lib/getFrameOfReferenceUID.js deleted file mode 100644 index fedcd4577..000000000 --- a/Packages/ohif-viewerbase/client/lib/getFrameOfReferenceUID.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Helper function to quickly obtain the frameOfReferenceUID - * for a given element from the enabled image's metadata. - * - * If no image, imagePlane, or frameOfReferenceUID is available, - * the function will return undefined. - * - * @param element - * @returns {string} - */ -export function getFrameOfReferenceUID(element) { - var enabledElement; - try { - enabledElement = cornerstone.getEnabledElement(element); - } catch(error) { - return; - } - - if (!enabledElement || !enabledElement.image) { - return; - } - - var imageId = enabledElement.image.imageId; - var imagePlane = cornerstone.metaData.get('imagePlane', imageId); - if (!imagePlane || !imagePlane.frameOfReferenceUID) { - return; - } - - return imagePlane.frameOfReferenceUID; -} diff --git a/Packages/ohif-viewerbase/client/lib/getImageId.js b/Packages/ohif-viewerbase/client/lib/getImageId.js deleted file mode 100644 index 1f14d0d20..000000000 --- a/Packages/ohif-viewerbase/client/lib/getImageId.js +++ /dev/null @@ -1,51 +0,0 @@ -import { getWADORSImageId } from './getWADORSImageId'; - -// https://stackoverflow.com/a/6021027/3895126 -function updateQueryStringParameter(uri, key, value) { - const regex = new RegExp('([?&])' + key + '=.*?(&|$)', 'i'); - const separator = uri.indexOf('?') !== -1 ? '&' : '?'; - if (uri.match(regex)) { - return uri.replace(regex, '$1' + key + '=' + value + '$2'); - } else { - return uri + separator + key + '=' + value; - } -} - -/** - * Obtain an imageId for Cornerstone from an image instance - * - * @param instance - * @param frame - * @param thumbnail - * @returns {string} The imageId to be used by Cornerstone - */ -export function getImageId(instance, frame, thumbnail=false) { - if (!instance) { - return; - } - - if (typeof instance.getImageId === 'function') { - return instance.getImageId(); - } - - if (instance.url) { - if (frame !== undefined) { - instance.url = updateQueryStringParameter(instance.url, 'frame', frame); - } - - return instance.url; - } - - const renderingAttr = thumbnail ? 'thumbnailRendering' : 'imageRendering'; - - if (!instance[renderingAttr] || instance[renderingAttr] === 'wadouri' || !instance.wadorsuri) { - let imageId = 'dicomweb:' + instance.wadouri; - if (frame !== undefined) { - imageId += '&frame=' + frame; - } - - return imageId; - } else { - return getWADORSImageId(instance, frame, thumbnail); // WADO-RS Retrieve Frame - } -} diff --git a/Packages/ohif-viewerbase/client/lib/getImageIdForImagePath.js b/Packages/ohif-viewerbase/client/lib/getImageIdForImagePath.js deleted file mode 100644 index 4c02c7cbd..000000000 --- a/Packages/ohif-viewerbase/client/lib/getImageIdForImagePath.js +++ /dev/null @@ -1,18 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Obtain an imageId for the given imagePath - * - * @param {String} imagePath Path containing study, series and instance UIDs and frame index - * @returns {String} The resulting imageId for the given imagePath - */ - -export const getImageIdForImagePath = (imagePath, thumbnail=false) => { - const [studyInstanceUid, seriesInstanceUid, sopInstanceUid, frameIndex] = imagePath.split('_'); - const study = OHIF.viewer.Studies.findBy({ studyInstanceUid }); - const studyMetadata = OHIF.viewerbase.getStudyMetadata(study); - const series = studyMetadata.getSeriesByUID(seriesInstanceUid); - const instance = series.getInstanceByUID(sopInstanceUid); - const imageId = OHIF.viewerbase.getImageId(instance, frameIndex, thumbnail); - return imageId; -}; diff --git a/Packages/ohif-viewerbase/client/lib/getStackDataIfNotEmpty.js b/Packages/ohif-viewerbase/client/lib/getStackDataIfNotEmpty.js deleted file mode 100644 index c5e1c4d81..000000000 --- a/Packages/ohif-viewerbase/client/lib/getStackDataIfNotEmpty.js +++ /dev/null @@ -1,22 +0,0 @@ -import { getElementIfNotEmpty } from './getElementIfNotEmpty.js'; - -export function getStackDataIfNotEmpty(viewportIndex) { - const element = getElementIfNotEmpty(viewportIndex); - if (!element) { - return; - } - - const stackToolData = cornerstoneTools.getToolState(element, 'stack'); - if (!stackToolData || - !stackToolData.data || - !stackToolData.data.length) { - return; - } - - const stack = stackToolData.data[0]; - if (!stack) { - return; - } - - return stack; -} diff --git a/Packages/ohif-viewerbase/client/lib/getStudyMetadata.js b/Packages/ohif-viewerbase/client/lib/getStudyMetadata.js deleted file mode 100644 index 5419bc179..000000000 --- a/Packages/ohif-viewerbase/client/lib/getStudyMetadata.js +++ /dev/null @@ -1,12 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -const getStudyMetadata = study => { - let studyMetadata = study; - if (study && !(studyMetadata instanceof OHIF.viewerbase.metadata.StudyMetadata)) { - studyMetadata = new OHIF.metadata.StudyMetadata(study, study.studyInstanceUid); - } - - return studyMetadata; -}; - -export { getStudyMetadata }; diff --git a/Packages/ohif-viewerbase/client/lib/getWADORSImageId.js b/Packages/ohif-viewerbase/client/lib/getWADORSImageId.js deleted file mode 100644 index 0f312631a..000000000 --- a/Packages/ohif-viewerbase/client/lib/getWADORSImageId.js +++ /dev/null @@ -1,19 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -import { getWADORSImageUrl } from './getWADORSImageUrl'; - -/** - * Obtain an imageId for Cornerstone based on the WADO-RS scheme - * - * @param {object} instanceMetada metadata object (InstanceMetadata) - * @returns {string} The imageId to be used by Cornerstone - */ -export function getWADORSImageId(instance, frame) { - const uri = getWADORSImageUrl(instance, frame); - - if (!uri) { - return; - } - - return `wadors:${uri}`; -}; diff --git a/Packages/ohif-viewerbase/client/lib/getWADORSImageUrl.js b/Packages/ohif-viewerbase/client/lib/getWADORSImageUrl.js deleted file mode 100644 index bc40b549a..000000000 --- a/Packages/ohif-viewerbase/client/lib/getWADORSImageUrl.js +++ /dev/null @@ -1,15 +0,0 @@ -export function getWADORSImageUrl(instance, frame) { - let wadorsuri = instance.wadorsuri; - - if (!wadorsuri) { - return; - } - - // We need to sum 1 because WADO-RS frame number is 1-based - frame = (frame || 0) + 1; - - // Replaces /frame/1 by /frame/{frame} - wadorsuri = wadorsuri.replace(/(\/frames\/)(\d+)/, `$1${frame}`); - - return wadorsuri; -} diff --git a/Packages/ohif-viewerbase/client/lib/helpers/capitalizeFirstLetter.js b/Packages/ohif-viewerbase/client/lib/helpers/capitalizeFirstLetter.js deleted file mode 100644 index 3e7378898..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/capitalizeFirstLetter.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -/** - * A global Blaze UI helper to capitalizes the first letter of an input String - * - * Credit to: - * - * http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript - */ -Blaze.registerHelper('capitalizeFirstLetter', function (context) { - if (!context) { - return; - } - - return context.charAt(0).toUpperCase() + context.slice(1); -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/formatDA.js b/Packages/ohif-viewerbase/client/lib/helpers/formatDA.js deleted file mode 100644 index d516f510b..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/formatDA.js +++ /dev/null @@ -1,25 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { moment } from 'meteor/momentjs:moment'; - -/** - * A global Blaze UI helper function to format DICOM Dates using the Moment library - */ - -const formatDA = (context, format, options) => { - if (!context) { - return undefined; - } - var dateAsMoment = moment(context, "YYYYMMDD"); - var strFormat = "MMM D, YYYY"; - if (options) { - strFormat = format; - } - return dateAsMoment.format(strFormat); -}; - -// Check if global helper already exists to not override it -if (!Blaze._getGlobalHelper('formatDA')) { - Blaze.registerHelper('formatDA', formatDA); -} - -export { formatDA }; diff --git a/Packages/ohif-viewerbase/client/lib/helpers/formatJSDate.js b/Packages/ohif-viewerbase/client/lib/helpers/formatJSDate.js deleted file mode 100644 index e8fb9cc84..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/formatJSDate.js +++ /dev/null @@ -1,19 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { moment } from 'meteor/momentjs:moment'; - -/** - * A global Blaze UI helper function to format JavaScript Dates using the Moment library - */ -Blaze.registerHelper('formatJSDate', function(context, format, options) { - if (!context) { - return; - } - - var dateAsMoment = moment(new Date(context)); - var strFormat = 'MMM D, YYYY'; - if (options) { - strFormat = format; - } - - return dateAsMoment.format(strFormat); -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/formatNumberPrecision.js b/Packages/ohif-viewerbase/client/lib/helpers/formatNumberPrecision.js deleted file mode 100644 index 80e19f5eb..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/formatNumberPrecision.js +++ /dev/null @@ -1,10 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -/** - * A global Blaze UI helper to format a float value to a specified precision - */ -Blaze.registerHelper('formatNumberPrecision', function(context, precision) { - if (context != null) { - return parseFloat(context).toFixed(precision); - } -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/formatPN.js b/Packages/ohif-viewerbase/client/lib/helpers/formatPN.js deleted file mode 100644 index b32378114..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/formatPN.js +++ /dev/null @@ -1,52 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -/** - * Formats a patient name for display purposes - */ -const formatPN = context => { - if (!context) { - return; - } - - // Convert the first ^ to a ', '. String.replace() only affects - // the first appearance of the character. - //const commaBetweenFirstAndLast = context.replace('^', ', '); - - // Replace any remaining '^' characters with spaces - //const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' '); - - // for cloud healthcare replace all ^ with ', ' - const cleaned = context.replace(/\^/g, ', '); - - // Trim any extraneous whitespace - return cleaned.trim(); -}; - -/** - * Formats a patient name for display purposes - */ -const reverseFormatPN = context => { - if (!context) { - context; - } - - // Replace any remaining '^' characters with spaces - const cleaned = context.replace(/, /g, '^'); - - // Trim any extraneous whitespace - return cleaned.trim(); -}; - -/** - * A global Blaze UI helper to format a patient name for display purposes - */ - -// Check if global helper already exists to not override it -if (!Blaze._getGlobalHelper('formatPN')) { - Blaze.registerHelper('formatPN', formatPN); -} - -if (!Blaze._getGlobalHelper('reverseFormatPN')) { - Blaze.registerHelper('reverseFormatPN', reverseFormatPN); -} - -export { formatPN, reverseFormatPN }; diff --git a/Packages/ohif-viewerbase/client/lib/helpers/formatTM.js b/Packages/ohif-viewerbase/client/lib/helpers/formatTM.js deleted file mode 100644 index f81b5b980..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/formatTM.js +++ /dev/null @@ -1,35 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { moment } from 'meteor/momentjs:moment'; - -/** - * A global Blaze UI helper to format a DICOM Time for display using the Moment library - */ - -const formatTM = (context, options) => { - if (!context) { - return; - } - - // DICOM Time is stored as HHmmss.SSS, where: - // HH 24 hour time: - // m mm 0..59 Minutes - // s ss 0..59 Seconds - // S SS SSS 0..999 Fractional seconds - // - // See MomentJS: http://momentjs.com/docs/#/parsing/string-format/ - var dateTime = moment(context, 'HHmmss.SSS'); - - var format = "HH:mm:ss"; - if (options && options.format) { - format = options.format; - } - - return dateTime.format(format); -}; - -// Check if global helper already exists to not override it -if (!Blaze._getGlobalHelper('formatTM')) { - Blaze.registerHelper('formatTM', formatTM); -} - -export { formatTM }; diff --git a/Packages/ohif-viewerbase/client/lib/helpers/getUsername.js b/Packages/ohif-viewerbase/client/lib/helpers/getUsername.js deleted file mode 100644 index 6140398c6..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/getUsername.js +++ /dev/null @@ -1,15 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Blaze } from 'meteor/blaze'; - -/** - * Helper for retrieving username given userId - */ -Blaze.registerHelper('getUsername', function(userId) { - var user = Meteor.users.findOne({ - userId: userId - }); - - if (user && user.name) { - return user.name; - } -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/ifTypeIs.js b/Packages/ohif-viewerbase/client/lib/helpers/ifTypeIs.js deleted file mode 100644 index 8637da5e8..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/ifTypeIs.js +++ /dev/null @@ -1,12 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -/** - * Helper for checking datatype of a variable - */ -Blaze.registerHelper('ifTypeIs', function(value, match, attributeName) { - if (typeof(value) === match) { - return attributeName; - } - - return ''; -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/inc.js b/Packages/ohif-viewerbase/client/lib/helpers/inc.js deleted file mode 100644 index 00330094b..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/inc.js +++ /dev/null @@ -1,5 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -Blaze.registerHelper('inc', function(value) { - return parseInt(value) + 1; -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/index.js b/Packages/ohif-viewerbase/client/lib/helpers/index.js deleted file mode 100644 index f2ef53ea8..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Helpers with exposed symbols... - */ - -import { isTouchDevice } from './isTouchDevice'; -import { formatPN, reverseFormatPN } from './formatPN'; -import { formatDA } from './formatDA'; -import { formatTM } from './formatTM'; - -/** - * Helpers with side effects only... - */ - -import './formatJSDate'; -import './jsDateFromNow'; -import './formatNumberPrecision'; -import './inc'; -import './isDisplaySetActive'; -import './getUsername'; -import './capitalizeFirstLetter'; -import './objectToPairs'; -import './objectEach'; -import './ifTypeIs'; -import './prettyPrintStringify'; -import './sorting'; -import './studyThumbnails'; - -/** - * Exposed interface... - */ - -const helpers = { - isTouchDevice, - formatPN, - formatDA, - formatTM, - reverseFormatPN -}; - -export { helpers }; diff --git a/Packages/ohif-viewerbase/client/lib/helpers/isDisplaySetActive.js b/Packages/ohif-viewerbase/client/lib/helpers/isDisplaySetActive.js deleted file mode 100644 index e4409593d..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/isDisplaySetActive.js +++ /dev/null @@ -1,57 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; - -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; - -/** - * Boolean helper to identify if a series instance is active in some viewport - */ -Template.registerHelper('isDisplaySetActive', (displaySetInstanceUid, viewportIndex) => { - // Run this computation every time the viewports are updated - Session.get('LayoutManagerUpdated'); - - // Stop here if layoutManager is not defined yet - if (!OHIF.viewerbase.layoutManager) { - return; - } - - // Check if the display set is current visible in any of the layout - // manager's displayed viewports. Note that we have to check the - // onscreen number of viewports here, since the layout manager will - // keep the viewport data of old viewports, even after the layout is changed. - // - // This behaviour is intentional. If the user displays four viewports, then assigns - // display sets to them, and then switches to / from another layout configuration, - // we don't want them to lose their specified viewports. - let result = false; - if (_.isUndefined(viewportIndex)) { - // Get the number of viewports that are currently displayed - // (Note, viewportData may have more entries!) - const currentNumberOfViewports = OHIF.viewerbase.layoutManager.getNumberOfViewports(); - - // Loop through the viewport data up until the currently displayed - // number of viewports - const viewportData = OHIF.viewerbase.layoutManager.viewportData; - for (let i = 0; i < currentNumberOfViewports; i++) { - const data = viewportData[i]; - - // If the display set is displayed in this viewport and is active, stop here - if (data && data.displaySetInstanceUid === displaySetInstanceUid) { - result = true; - break; - } - } - } else { - const data = OHIF.viewerbase.layoutManager.viewportData[viewportIndex]; - - // If the display set is displayed in this viewport, stop here - if (data && data.displaySetInstanceUid === displaySetInstanceUid) { - result = true; - } - } - - return result; -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/isTouchDevice.js b/Packages/ohif-viewerbase/client/lib/helpers/isTouchDevice.js deleted file mode 100644 index 4711f6137..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/isTouchDevice.js +++ /dev/null @@ -1,24 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -/** - * Helper function to determine if the current client devices - * is touch-capable. This can be used to modify certain aspects of the UI. - * - * The check may not work on all devices! - * - * @returns {boolean} true if the client device is touch-capable, false otherwise - */ -const isTouchDevice = () => { - return (('ontouchstart' in window) || - (navigator.MaxTouchPoints > 0) || - (navigator.msMaxTouchPoints > 0)); -}; - -/** - * Blaze helper for checking if the current device is touch capable - * - * @returns {boolean} true if the client device is touch-capable, false otherwise - */ -Blaze.registerHelper('isTouchDevice', isTouchDevice); - -export { isTouchDevice }; diff --git a/Packages/ohif-viewerbase/client/lib/helpers/jsDateFromNow.js b/Packages/ohif-viewerbase/client/lib/helpers/jsDateFromNow.js deleted file mode 100644 index c5dac044d..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/jsDateFromNow.js +++ /dev/null @@ -1,17 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { Session } from 'meteor/session'; -import { moment } from 'meteor/momentjs:moment'; - -/** - * A global Blaze UI helper function to format JavaScript Dates using the Moment library - */ -Blaze.registerHelper('jsDateFromNow', function(context, format, options) { - if (!context) { - return; - } - - Session.get('timeAgoVariable'); - - var dateAsMoment = moment(new Date(context)); - return dateAsMoment.fromNow(); -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/objectEach.js b/Packages/ohif-viewerbase/client/lib/helpers/objectEach.js deleted file mode 100644 index a29185307..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/objectEach.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { _ } from 'meteor/underscore'; - -Blaze.registerHelper('objectEach', function(object) { - // http://stackoverflow.com/questions/30234732/how-to-print-key-and-values-in-meteor-template - return _.map(object, function(value, key) { - return _.extend({key: key}, value); - }); -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/objectToPairs.js b/Packages/ohif-viewerbase/client/lib/helpers/objectToPairs.js deleted file mode 100644 index ff71343f0..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/objectToPairs.js +++ /dev/null @@ -1,12 +0,0 @@ -import { Blaze } from 'meteor/blaze'; -import { _ } from 'meteor/underscore'; - -Blaze.registerHelper('objectToPairs', function(object) { - // http://stackoverflow.com/questions/30234732/how-to-print-key-and-values-in-meteor-template - return _.map(object, function(value, key) { - return { - key: key, - value: value - }; - }); -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/prettyPrintStringify.js b/Packages/ohif-viewerbase/client/lib/helpers/prettyPrintStringify.js deleted file mode 100644 index b2a65229b..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/prettyPrintStringify.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -/** - * A global Blaze UI helper to Stringify a JavaScript object - * - * Credit to: - * - * http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript - */ -Blaze.registerHelper('prettyPrintStringify', function(context) { - if (!context) { - return; - } - - var string = JSON.stringify(context, null, 2); - string = string.replace(/['"]+/g, ''); - string = string.replace('{', ''); - string = string.replace('}', ''); - string = string.replace(',', '\n'); - return string; -}); diff --git a/Packages/ohif-viewerbase/client/lib/helpers/sorting.js b/Packages/ohif-viewerbase/client/lib/helpers/sorting.js deleted file mode 100644 index fbd3ca62e..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/sorting.js +++ /dev/null @@ -1,57 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; - -/** - * Global Blaze UI helper to sort array elements - * by an array element's property (property) or deep object property (property.childProperty) - * Sorts ascending as default - */ -Template.registerHelper('sort', (array, sortBy, sortType) => { - if (!sortBy) { - return array; - } - - // To keep the order for the same values of the field which is used to sort: - // 1. Group the array by the field - // 2. Sort the grouped array - // 3. Ungroup the sorted array - - const groupedArray = _.groupBy(array, (element) => { - if (sortBy) { - var groupingElement = getKeyValue(element, sortBy); - if (groupingElement) { - return groupingElement; - } - } - return element; - }); - - const sortedArray = _.sortBy(groupedArray, (element) => { - if (sortBy) { - var sortingElement = getKeyValue(element[0], sortBy); - if (sortingElement) { - return sortingElement; - } - } - return element; - }); - - if (sortType === 'desc') { - return _.flatten(sortedArray.reverse(), true); - } - - return _.flatten(sortedArray, true); -}); - -function getKeyValue(object, keyPath) { - keyPath = keyPath.split('.'); - for (var i = 0; i < keyPath.length; i++) { - if (object && _.has(object, keyPath[i])) { - object = object[keyPath[i]]; - } - else { - return undefined; - } - } - return object; -} diff --git a/Packages/ohif-viewerbase/client/lib/helpers/studyThumbnails.js b/Packages/ohif-viewerbase/client/lib/helpers/studyThumbnails.js deleted file mode 100644 index ab79fee6a..000000000 --- a/Packages/ohif-viewerbase/client/lib/helpers/studyThumbnails.js +++ /dev/null @@ -1,27 +0,0 @@ -import { Template } from 'meteor/templating'; -import { _ } from 'meteor/underscore'; - -/** - * A global Blaze UI helper to get the thumbnails for the given study - */ -Template.registerHelper('studyThumbnails', study => { - if (!study) { - return; - } - - // Find the study's stacks - const stacks = study.displaySets; - - // Defines the resulting thumbnails list - const thumbnails = []; - - // Iterate over the stacks and add one by one with its index - _.each(stacks, (stack, thumbnailIndex) => { - thumbnails.push({ - thumbnailIndex, - stack - }); - }); - - return thumbnails; -}); diff --git a/Packages/ohif-viewerbase/client/lib/hotkeyUtils.js b/Packages/ohif-viewerbase/client/lib/hotkeyUtils.js deleted file mode 100644 index ed9abe3e1..000000000 --- a/Packages/ohif-viewerbase/client/lib/hotkeyUtils.js +++ /dev/null @@ -1,284 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; -import { toolManager } from './toolManager'; -import { switchToImageRelative } from './switchToImageRelative'; -import { switchToImageByIndex } from './switchToImageByIndex'; -import { viewportUtils } from './viewportUtils'; -import { panelNavigation } from './panelNavigation'; -import { WLPresets } from './WLPresets'; - -// TODO: add this to namespace definitions -Meteor.startup(function() { - OHIF.viewer.loadIndicatorDelay = 200; - OHIF.viewer.defaultTool = 'wwwc'; - OHIF.viewer.refLinesEnabled = true; - OHIF.viewer.isPlaying = {}; - OHIF.viewer.cine = { - framesPerSecond: 24, - loop: true - }; - - OHIF.viewer.defaultHotkeys = { - // Tool hotkeys - defaultTool: 'ESC', - zoom: 'Z', - wwwc: 'W', - pan: 'P', - angle: 'A', - stackScroll: 'S', - magnify: 'M', - length: '', - annotate: '', - dragProbe: '', - ellipticalRoi: '', - rectangleRoi: '', - - // Viewport hotkeys - flipH: 'H', - flipV: 'V', - rotateR: 'R', - rotateL: 'L', - invert: 'I', - zoomIn: '', - zoomOut: '', - zoomToFit: '', - resetViewport: '', - clearTools: '', - - // Viewport navigation hotkeys - scrollDown: 'DOWN', - scrollUp: 'UP', - scrollLastImage: 'END', - scrollFirstImage: 'HOME', - previousDisplaySet: 'PAGEUP', - nextDisplaySet: 'PAGEDOWN', - nextPanel: 'RIGHT', - previousPanel: 'LEFT', - - // Miscellaneous hotkeys - toggleOverlayTags: 'O', - toggleCinePlay: 'SPACE', - toggleCineDialog: '', - toggleDownloadDialog: '', - - // Preset hotkeys - WLPreset0: '1', - WLPreset1: '2', - WLPreset2: '3', - WLPreset3: '4', - WLPreset4: '5', - WLPreset5: '6', - WLPreset6: '7', - WLPreset7: '8', - WLPreset8: '9', - WLPreset9: '0' - }; - - // For now - OHIF.viewer.hotkeys = OHIF.viewer.defaultHotkeys; - - // Create commands context for viewer - const contextName = 'viewer'; - OHIF.commands.createContext(contextName); - - // Create a function that returns true if the active viewport is empty - const isActiveViewportEmpty = () => { - const activeViewport = Session.get('activeViewport') || 0; - return $('.imageViewerViewport').eq(activeViewport).hasClass('empty'); - }; - - // Functions to register the tool switching commands - const registerToolCommands = map => _.each(map, (commandName, toolId) => { - OHIF.commands.register(contextName, toolId, { - name: commandName, - action: toolManager.setActiveTool, - params: toolId - }); - }); - - // Register the default tool command - OHIF.commands.register(contextName, 'defaultTool', { - name: 'Default Tool', - action: () => toolManager.setActiveTool(toolManager.getDefaultTool()) - }); - - // Register the tool switching commands - registerToolCommands({ - wwwc: 'W/L', - zoom: 'Zoom', - angle: 'Angle Measurement', - dragProbe: 'Pixel Probe', - ellipticalRoi: 'Elliptical ROI', - rectangleRoi: 'Rectangle ROI', - magnify: 'Magnify', - annotate: 'Annotate', - stackScroll: 'Scroll Stack', - pan: 'Pan', - length: 'Length Measurement', - wwwcRegion: 'W/L by Region', - crosshairs: 'Crosshairs' - }); - - // Functions to register the viewport commands - const registerViewportCommands = map => _.each(map, (commandName, commandId) => { - OHIF.commands.register(contextName, commandId, { - name: commandName, - action: viewportUtils[commandId], - disabled: isActiveViewportEmpty - }); - }); - - // Register the viewport commands - registerViewportCommands({ - zoomIn: 'Zoom In', - zoomOut: 'Zoom Out', - zoomToFit: 'Zoom to Fit', - invert: 'Invert', - flipH: 'Flip Horizontally', - flipV: 'Flip Vertically', - rotateR: 'Rotate Right', - rotateL: 'Rotate Left', - resetViewport: 'Reset', - clearTools: 'Clear Tools' - }); - - // Register the preset switching commands - const applyPreset = presetName => WLPresets.applyWLPresetToActiveElement(presetName); - for (let i = 0; i < 10; i++) { - OHIF.commands.register(contextName, `WLPreset${i}`, { - name: `W/L Preset ${i + 1}`, - action: applyPreset, - params: i - }); - } - - // Check if display sets can be moved - const canMoveDisplaySets = isNext => { - if (!OHIF.viewerbase.layoutManager) { - return false; - } else { - return OHIF.viewerbase.layoutManager.canMoveDisplaySets(isNext); - } - }; - - // Register viewport navigation commands - OHIF.commands.set(contextName, { - scrollDown: { - name: 'Scroll Down', - action: () => !isActiveViewportEmpty() && switchToImageRelative(1) - }, - scrollUp: { - name: 'Scroll Up', - action: () => !isActiveViewportEmpty() && switchToImageRelative(-1) - }, - scrollFirstImage: { - name: 'Scroll to First Image', - action: () => !isActiveViewportEmpty() && switchToImageByIndex(0) - }, - scrollLastImage: { - name: 'Scroll to Last Image', - action: () => !isActiveViewportEmpty() && switchToImageByIndex(-1) - }, - previousDisplaySet: { - name: 'Previous Series', - action: () => OHIF.viewerbase.layoutManager.moveDisplaySets(false), - disabled: () => !canMoveDisplaySets(false) - }, - nextDisplaySet: { - name: 'Next Series', - action: () => OHIF.viewerbase.layoutManager.moveDisplaySets(true), - disabled: () => !canMoveDisplaySets(true) - }, - nextPanel: { - name: 'Next Image Viewport', - action: () => panelNavigation.loadNextActivePanel() - }, - previousPanel: { - name: 'Previous Image Viewport', - action: () => panelNavigation.loadPreviousActivePanel() - } - }, true); - - // Register miscellaneous commands - OHIF.commands.set(contextName, { - toggleOverlayTags: { - name: 'Toggle Image Info Overlay', - action() { - const $dicomTags = $('.imageViewerViewportOverlay .dicomTag'); - $dicomTags.toggle($dicomTags.eq(0).css('display') === 'none'); - } - }, - toggleCinePlay: { - name: 'Play/Pause Cine', - action: viewportUtils.toggleCinePlay, - disabled: OHIF.viewerbase.viewportUtils.hasMultipleFrames - }, - toggleCineDialog: { - name: 'Show/Hide Cine Controls', - action: viewportUtils.toggleCineDialog, - disabled: OHIF.viewerbase.viewportUtils.hasMultipleFrames - }, - toggleDownloadDialog: { - name: 'Show/Hide Download Dialog', - action: viewportUtils.toggleDownloadDialog, - disabled: () => !viewportUtils.isDownloadEnabled() - }, - sr: { - name: 'Show/Hide Structured Report', - action: () => OHIF.ui.showDialog('structuredReportModal'), - disabled: () => false - } - }, true); - - OHIF.viewer.hotkeyFunctions = {}; - - OHIF.viewer.loadedSeriesData = {}; - - // Enable hotkeys - hotkeyUtils.enableHotkeys(); -}); - -// Define a jQuery reverse function -$.fn.reverse = [].reverse; - -/** - * Overrides OHIF's refLinesEnabled - * @param {Boolean} refLinesEnabled True to enable and False to disable - */ -function setOHIFRefLines(refLinesEnabled) { - OHIF.viewer.refLinesEnabled = refLinesEnabled; -} - -/** - * Overrides OHIF's hotkeys - * @param {Object} hotkeys Object with hotkeys mapping - */ -function setOHIFHotkeys(hotkeys) { - OHIF.viewer.hotkeys = hotkeys; -} - -/** - * Binds all hotkeys keydown events to the tasks defined in - * OHIF.viewer.hotkeys or a given param - * @param {Object} hotkeys hotkey and task mapping (not required). If not given, uses OHIF.viewer.hotkeys - */ -function enableHotkeys(hotkeys) { - const definitions = hotkeys || OHIF.viewer.hotkeys; - OHIF.hotkeys.set('viewer', definitions, true); - OHIF.context.set('viewer'); -} - -/** - * Export functions inside hotkeyUtils namespace. - */ - -const hotkeyUtils = { - setOHIFRefLines, /* @TODO: find a better place for this... */ - setOHIFHotkeys, - enableHotkeys -}; - -export { hotkeyUtils }; diff --git a/Packages/ohif-viewerbase/client/lib/imageViewerViewportData.js b/Packages/ohif-viewerbase/client/lib/imageViewerViewportData.js deleted file mode 100644 index a6f8d35f1..000000000 --- a/Packages/ohif-viewerbase/client/lib/imageViewerViewportData.js +++ /dev/null @@ -1,7 +0,0 @@ - -export const imageViewerViewportData = { - callbacks: {}, - extendData() { - // No-Op function... - } -}; diff --git a/Packages/ohif-viewerbase/client/lib/instanceClassSpecificViewport.js b/Packages/ohif-viewerbase/client/lib/instanceClassSpecificViewport.js deleted file mode 100644 index febd314f4..000000000 --- a/Packages/ohif-viewerbase/client/lib/instanceClassSpecificViewport.js +++ /dev/null @@ -1,18 +0,0 @@ - -const instanceClassViewportSettingsFunctions = {}; - -const getInstanceClassDefaultViewport = (series, enabledElement, imageId) => { - let instanceClass = series.sopClassUid; - - if (!instanceClassViewportSettingsFunctions[instanceClass]) { - return; - } - - return instanceClassViewportSettingsFunctions[instanceClass](series, enabledElement, imageId); -}; - -const setInstanceClassDefaultViewportFunction = (instanceClass, fn) => { - instanceClassViewportSettingsFunctions[instanceClass] = fn; -}; - -export { getInstanceClassDefaultViewport, setInstanceClassDefaultViewportFunction }; diff --git a/Packages/ohif-viewerbase/client/lib/isImage.js b/Packages/ohif-viewerbase/client/lib/isImage.js deleted file mode 100644 index f90d26ce5..000000000 --- a/Packages/ohif-viewerbase/client/lib/isImage.js +++ /dev/null @@ -1,61 +0,0 @@ -import { sopClassDictionary } from './sopClassDictionary'; - -/** - * Checks whether dicom files with specified SOP Class UID have image data - * @param {string} sopClassUid - SOP Class UID to be checked - * @returns {boolean} - true if it has image data - */ -export function isImage(sopClassUid) { - if (sopClassUid === sopClassDictionary.ComputedRadiographyImageStorage - || sopClassUid === sopClassDictionary.DigitalXRayImageStorageForPresentation - || sopClassUid === sopClassDictionary.DigitalXRayImageStorageForProcessing - || sopClassUid === sopClassDictionary.DigitalMammographyXRayImageStorageForPresentation - || sopClassUid === sopClassDictionary.DigitalMammographyXRayImageStorageForProcessing - || sopClassUid === sopClassDictionary.DigitalIntraOralXRayImageStorageForPresentation - || sopClassUid === sopClassDictionary.DigitalIntraOralXRayImageStorageForProcessing - || sopClassUid === sopClassDictionary.CTImageStorage - || sopClassUid === sopClassDictionary.EnhancedCTImageStorage - || sopClassUid === sopClassDictionary.LegacyConvertedEnhancedCTImageStorage - || sopClassUid === sopClassDictionary.UltrasoundMultiframeImageStorage - || sopClassUid === sopClassDictionary.MRImageStorage - || sopClassUid === sopClassDictionary.EnhancedMRImageStorage - || sopClassUid === sopClassDictionary.EnhancedMRColorImageStorage - || sopClassUid === sopClassDictionary.LegacyConvertedEnhancedMRImageStorage - || sopClassUid === sopClassDictionary.UltrasoundImageStorage - || sopClassUid === sopClassDictionary.SecondaryCaptureImageStorage - || sopClassUid === sopClassDictionary.MultiframeSingleBitSecondaryCaptureImageStorage - || sopClassUid === sopClassDictionary.MultiframeGrayscaleByteSecondaryCaptureImageStorage - || sopClassUid === sopClassDictionary.MultiframeGrayscaleWordSecondaryCaptureImageStorage - || sopClassUid === sopClassDictionary.MultiframeTrueColorSecondaryCaptureImageStorage - || sopClassUid === sopClassDictionary.XRayAngiographicImageStorage - || sopClassUid === sopClassDictionary.EnhancedXAImageStorage - || sopClassUid === sopClassDictionary.XRayRadiofluoroscopicImageStorage - || sopClassUid === sopClassDictionary.EnhancedXRFImageStorage - || sopClassUid === sopClassDictionary.XRay3DAngiographicImageStorage - || sopClassUid === sopClassDictionary.XRay3DCraniofacialImageStorage - || sopClassUid === sopClassDictionary.BreastTomosynthesisImageStorage - || sopClassUid === sopClassDictionary.BreastProjectionXRayImageStorageForPresentation - || sopClassUid === sopClassDictionary.BreastProjectionXRayImageStorageForProcessing - || sopClassUid === sopClassDictionary.IntravascularOpticalCoherenceTomographyImageStorageForPresentation - || sopClassUid === sopClassDictionary.IntravascularOpticalCoherenceTomographyImageStorageForProcessing - || sopClassUid === sopClassDictionary.NuclearMedicineImageStorage - || sopClassUid === sopClassDictionary.VLEndoscopicImageStorage - || sopClassUid === sopClassDictionary.VideoEndoscopicImageStorage - || sopClassUid === sopClassDictionary.VLMicroscopicImageStorage - || sopClassUid === sopClassDictionary.VideoMicroscopicImageStorage - || sopClassUid === sopClassDictionary.VLSlideCoordinatesMicroscopicImageStorage - || sopClassUid === sopClassDictionary.VLPhotographicImageStorage - || sopClassUid === sopClassDictionary.VideoPhotographicImageStorage - || sopClassUid === sopClassDictionary.OphthalmicPhotography8BitImageStorage - || sopClassUid === sopClassDictionary.OphthalmicPhotography16BitImageStorage - || sopClassUid === sopClassDictionary.OphthalmicTomographyImageStorage - || sopClassUid === sopClassDictionary.VLWholeSlideMicroscopyImageStorage - || sopClassUid === sopClassDictionary.PositronEmissionTomographyImageStorage - || sopClassUid === sopClassDictionary.EnhancedPETImageStorage - || sopClassUid === sopClassDictionary.LegacyConvertedEnhancedPETImageStorage - || sopClassUid === sopClassDictionary.RTImageStorage) { - return true; - } - - return false; -} diff --git a/Packages/ohif-viewerbase/client/lib/panelNavigation.js b/Packages/ohif-viewerbase/client/lib/panelNavigation.js deleted file mode 100644 index dbe9feaf6..000000000 --- a/Packages/ohif-viewerbase/client/lib/panelNavigation.js +++ /dev/null @@ -1,53 +0,0 @@ -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { setActiveViewport } from './setActiveViewport'; - -const loadPreviousActivePanel = () => { - OHIF.log.info('nextActivePanel'); - let currentIndex = Session.get('activeViewport'); - currentIndex--; - - const $viewports = $('.viewportContainer'); - const numViewports = $viewports.length; - if (currentIndex < 0) { - currentIndex = numViewports - 1; - } - - const viewportContainer = $viewports.get(currentIndex); - if (!viewportContainer) { - return; - } - - setActiveViewport(viewportContainer); -}; - -const loadNextActivePanel = () => { - OHIF.log.info('nextActivePanel'); - let currentIndex = Session.get('activeViewport'); - currentIndex++; - - const $viewports = $('.viewportContainer'); - const numViewports = $viewports.length; - if (currentIndex >= numViewports) { - currentIndex = 0; - } - - const viewportContainer = $viewports.get(currentIndex); - if (!viewportContainer) { - return; - } - - setActiveViewport(viewportContainer); -}; - -/** - * Export functions inside panelNavigation namespace. - */ - -const panelNavigation = { - loadPreviousActivePanel, - loadNextActivePanel -}; - -export { panelNavigation }; diff --git a/Packages/ohif-viewerbase/client/lib/prepareViewerData.js b/Packages/ohif-viewerbase/client/lib/prepareViewerData.js deleted file mode 100644 index 32bc7f681..000000000 --- a/Packages/ohif-viewerbase/client/lib/prepareViewerData.js +++ /dev/null @@ -1,137 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { OHIF } from 'meteor/ohif:core'; - -/** - * Prepare the studies data to render the viewer template - * - * @param {Array} studyInstanceUids List of studies that will be loaded into viewer - * @param {Array} seriesInstanceUids List of series that will be loaded into viewer. If it is not defined, all series will be loaded - * @param {String} timepointId ID of the current timepoint to get the studies from - * @param {Object} timepointsFilter An object containing the filter to retrieve the timepoints - * @return {Promise} Promise that will be resolved with the studies when the metadata is loaded - */ -export const prepareViewerData = ({ studyInstanceUids, seriesInstanceUids, timepointId, timepointsFilter={} }) => { - // Clear the cornerstone tool data to sync the measurements with the measurements API - cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState({}); - - // Retrieve the studies metadata - const promise = new Promise((resolve, reject) => { - const processData = viewerData => { - OHIF.studies.retrieveStudiesMetadata(viewerData.studyInstanceUids, viewerData.seriesInstanceUids).then(studies => { - // Add additional metadata to our study from the studylist - studies.forEach(study => { - const studylistStudy = OHIF.studylist.collections.Studies.findOne({ - studyInstanceUid: study.studyInstanceUid - }); - - if (!studylistStudy) { - return; - } - - Object.assign(study, studylistStudy); - }); - - resolve({ - studies, - viewerData - }); - }).catch(reject); - }; - - // Check if the studies are already given and ignore the timepoint ID if so - if (studyInstanceUids && studyInstanceUids.length) { - const viewerData = { - studyInstanceUids, - seriesInstanceUids, - }; - processData(viewerData); - } else { - // Find the timepoint by ID and load the studies from it - OHIF.studylist.timepointApi.retrieveTimepoints(timepointsFilter).then(() => { - const viewerData = buildViewerDataFromTimepointId(timepointId); - processData(viewerData); - }).catch(reject); - } - }); - - return promise; -}; - -const buildViewerDataFromTimepointId = timepointId => { - const timepoint = OHIF.studylist.timepointApi.timepoints.findOne({ timepointId }); - if (!timepoint) { - throw new Error('Unable to find a time point with the given ID'); - } - - // Get the relevant studyInstanceUids given the timepoints - const data = getDataFromTimepoint(timepoint); - if (!data.studyInstanceUids) { - throw new Error('No studies found that are related to this timepoint'); - } - - // Build the viewer data and return it - return Object.assign(data, { currentTimepointId: timepointId }); -}; - -/** - * Retrieves related studies given a Baseline or Follow-up Timepoint - * - * @param {Object} timepoint A document from the Timepoints Collection - * @returns {Object} An object containing the related studies UIDs and timepoint IDs - */ -const getDataFromTimepoint = timepoint => { - let relatedStudies = _.clone(timepoint.studyInstanceUids); - - // If this is the baseline, we should stop here and return the relevant studies - if (isBaseline(timepoint)) { - return { - studyInstanceUids: relatedStudies, - timepointIds: [timepoint.timepointId] - }; - } - - // Otherwise, this is a follow-up exam, so we should also find the baseline timepoint, - // and all studies related to it. We also enforce that the Baseline should have a studyDate - // prior to the latest studyDate in the current (Follow-up) Timepoint. - const Timepoints = OHIF.studylist.timepointApi.timepoints; - const baseline = Timepoints.findOne({ - timepointType: 'baseline', - patientId: timepoint.patientId, - latestDate: { - $lte: timepoint.latestDate - } - }); - - let timepointIds = []; - if (baseline) { - relatedStudies = relatedStudies.concat(baseline.studyInstanceUids); - timepointIds.push(baseline.timepointId); - } else { - OHIF.log.warn('No Baseline found while opening a Follow-up Timepoint'); - } - - const priorFilter = { latestDate: { $lt: timepoint.latestDate } }; - const priorSorting = { sort: { latestDate: -1 } }; - const prior = OHIF.studylist.timepointApi.timepoints.findOne(priorFilter, priorSorting); - if (prior && prior.timepointId !== baseline.timepointId) { - relatedStudies = relatedStudies.concat(prior.studyInstanceUids); - timepointIds.push(prior.timepointId); - } - - relatedStudies = _.uniq(relatedStudies); - - timepointIds.push(timepoint.timepointId); - - return { - studyInstanceUids: relatedStudies, - timepointIds - }; -}; - -/** - * Checks if a Timepoints is a baseline or not - * - * @param {Object} timepoint A document from the Timepoints Collection - * @returns {boolean} Whether or not the timepoint is stored as a Baseline - */ -const isBaseline = timepoint => timepoint.timepointType === 'baseline'; diff --git a/Packages/ohif-viewerbase/client/lib/renderViewer.js b/Packages/ohif-viewerbase/client/lib/renderViewer.js deleted file mode 100644 index 7276e46ae..000000000 --- a/Packages/ohif-viewerbase/client/lib/renderViewer.js +++ /dev/null @@ -1,33 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -/** - * Render the viewer with the given routing context and parameters - * - * @param {Context} context Context of the router - * @param {Object} params Parameters that will be used to prepare the viewer data - */ -export const renderViewer = (context, params, layoutTemplate='app') => { - // Wait until the viewer data is ready to render it - const promise = OHIF.viewerbase.prepareViewerData(params); - - // Show loading state while preparing the viewer data - OHIF.ui.showDialog('dialogLoading', { promise }); - - // Render the viewer when the data is ready - promise.then(({ studies, viewerData }) => { - OHIF.viewer.data = viewerData; - context.render(layoutTemplate, { - data: { - template: 'viewer', - studies - } - }); - }).catch(error => { - context.render(layoutTemplate, { - data: { - template: 'errorText', - error - } - }); - }); -}; diff --git a/Packages/ohif-viewerbase/client/lib/setActiveViewport.js b/Packages/ohif-viewerbase/client/lib/setActiveViewport.js deleted file mode 100644 index 838e0d439..000000000 --- a/Packages/ohif-viewerbase/client/lib/setActiveViewport.js +++ /dev/null @@ -1,66 +0,0 @@ -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; -import { Random } from 'meteor/random'; - -import { OHIF } from 'meteor/ohif:core'; -import { StudyPrefetcher } from './classes/StudyPrefetcher'; -import { displayReferenceLines } from './displayReferenceLines'; - -const PLUGIN_CORNERSTONE = 'cornerstone'; - -/** - * Sets a viewport element active - * @param {node} element DOM element to be activated or viewportIndex - */ -export function setActiveViewport(element) { - const $viewports = $('.viewportContainer'); - const viewportIndex = $viewports.index(element); - - const $element = $viewports.eq(viewportIndex); - if (!$element.length) { - OHIF.log.info('setActiveViewport element does not exist'); - return; - } - - OHIF.log.info(`setActiveViewport setting viewport index: ${viewportIndex}`); - - // If viewport is not active - if (!$element.parents('.viewportContainer').hasClass('active')) { - // Trigger an event for compatibility with other systems - $element.trigger('OHIFBeforeActivateViewport'); - } - - // When an OHIFActivateViewport event is fired, update the Meteor Session - // with the viewport index that it was fired from. - Session.set('activeViewport', viewportIndex); - - // Finally, enable stack prefetching and hide the reference lines from - // the newly activated viewport that has a canvas - const { layoutManager } = OHIF.viewerbase; - const viewportData = layoutManager.viewportData[viewportIndex]; - - if (viewportData.plugin === PLUGIN_CORNERSTONE && - $element.find('canvas').length) { - // Cornerstone Tools compare DOM elements (check getEnabledElement cornerstone function) - // so we can't pass a jQuery object as an argument, otherwise it throws an excepetion - const domElement = $element.find('.imageViewerViewport').get(0); - displayReferenceLines(domElement); - StudyPrefetcher.getInstance().prefetch(); - - // @TODO Add this to OHIFAfterActivateViewport handler... - const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer; - if (!synchronizer) { return; } - - synchronizer.update(); - } - - // Set the div to focused, so keypress events are handled - //$(element).focus(); - //.focus() event breaks in FF&IE - $element.triggerHandler('focus'); - - // Trigger OHIFAfterActivateViewport event on activated instance - // for compatibility with other systems - $element.trigger('OHIFAfterActivateViewport'); - -} diff --git a/Packages/ohif-viewerbase/client/lib/setFocusToActiveViewport.js b/Packages/ohif-viewerbase/client/lib/setFocusToActiveViewport.js deleted file mode 100644 index ff27a270c..000000000 --- a/Packages/ohif-viewerbase/client/lib/setFocusToActiveViewport.js +++ /dev/null @@ -1,24 +0,0 @@ -import { Session } from 'meteor/session'; -import { $ } from 'meteor/jquery'; - -/** - * Restores the browser focus to the currently specified active viewport - * as determined from Meteor's Session variable. - * - * This is allows keydown events to be captured on the focused element. - */ -const setFocusToActiveViewport = () => { - // Get the list of viewports - const viewports = $('.imageViewerViewport'); - - // Get the current active viewport index from Session - const activeViewportIndex = Session.get('activeViewport'); - - // Find the div from the list of viewports - const activeViewport = viewports.eq(activeViewportIndex); - - // Set the browser focus to this div - activeViewport.focus(); -}; - -export { setFocusToActiveViewport }; \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/lib/setMammogramViewportAlignment.js b/Packages/ohif-viewerbase/client/lib/setMammogramViewportAlignment.js deleted file mode 100644 index c49de7b86..000000000 --- a/Packages/ohif-viewerbase/client/lib/setMammogramViewportAlignment.js +++ /dev/null @@ -1,72 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { $ } from 'meteor/jquery'; - -import { OHIF } from 'meteor/ohif:core'; -import { setInstanceClassDefaultViewportFunction } from './instanceClassSpecificViewport'; - -const setMammogramViewportAlignment = (series, enabledElement, imageId) => { - // Don't apply the MG viewport alignment to other series types - const viewTypes = ['MLO', 'CC', 'LM', 'ML', 'XCCL']; - const requiresInversion = ['LM']; // Tomo series are flipped - - const instance = cornerstone.metaData.get('instance', imageId); - if (!instance) { - return; - } - - const element = enabledElement.element; - - const left = $(enabledElement.canvas).offset().left; - const right = left + enabledElement.canvas.width; - - const metadataProvider = OHIF.viewer.metadataProvider; - - let laterality = instance.laterality; - let position; - - if (viewTypes.indexOf(instance.viewPosition) < 0) { - return; - } - - // Check if we should flip the laterality - if (requiresInversion.indexOf(instance.viewPosition) > -1) { - if (laterality === 'R') { - laterality = 'L'; - } else if (laterality === 'L') { - laterality = 'R'; - } - } - - if (laterality === 'R') { - // Set X translation to Canvas max in image pixels - image width - // This places it on the right side of the screen - position = cornerstone.pageToPixel(element, right, 0); - if (position.x !== enabledElement.image.width) { - enabledElement.viewport.translation.x += position.x - enabledElement.image.width; - } - - metadataProvider.addSpecificMetadata(imageId, 'tagDisplay', { - side: 'L' - }); - - } else if (laterality === 'L') { - // Use pageToPixel to and jQuery to find pixel coordinates of leftmost - // side of the current canvas - position = cornerstone.pageToPixel(element, left, 0); - if (position.x !== 0) { - enabledElement.viewport.translation.x += position.x; - } - - metadataProvider.addSpecificMetadata(imageId, 'tagDisplay', { - side: 'R' - }); - } - - return enabledElement.viewport; -}; - -Meteor.startup(function() { - setInstanceClassDefaultViewportFunction('1.2.840.10008.5.1.4.1.1.1.2', setMammogramViewportAlignment); -}); - -export { setMammogramViewportAlignment }; diff --git a/Packages/ohif-viewerbase/client/lib/sopClassDictionary.js b/Packages/ohif-viewerbase/client/lib/sopClassDictionary.js deleted file mode 100644 index db851d0b5..000000000 --- a/Packages/ohif-viewerbase/client/lib/sopClassDictionary.js +++ /dev/null @@ -1,116 +0,0 @@ - -export const sopClassDictionary = { - ComputedRadiographyImageStorage: "1.2.840.10008.5.1.4.1.1.1", - DigitalXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.1", - DigitalXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.1.1", - DigitalMammographyXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.2", - DigitalMammographyXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.2.1", - DigitalIntraOralXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.3", - DigitalIntraOralXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.3.1", - CTImageStorage: "1.2.840.10008.5.1.4.1.1.2", - EnhancedCTImageStorage: "1.2.840.10008.5.1.4.1.1.2.1", - LegacyConvertedEnhancedCTImageStorage: "1.2.840.10008.5.1.4.1.1.2.2", - UltrasoundMultiframeImageStorage: "1.2.840.10008.5.1.4.1.1.3.1", - MRImageStorage: "1.2.840.10008.5.1.4.1.1.4", - EnhancedMRImageStorage: "1.2.840.10008.5.1.4.1.1.4.1", - MRSpectroscopyStorage: "1.2.840.10008.5.1.4.1.1.4.2", - EnhancedMRColorImageStorage: "1.2.840.10008.5.1.4.1.1.4.3", - LegacyConvertedEnhancedMRImageStorage: "1.2.840.10008.5.1.4.1.1.4.4", - UltrasoundImageStorage: "1.2.840.10008.5.1.4.1.1.6.1", - EnhancedUSVolumeStorage: "1.2.840.10008.5.1.4.1.1.6.2", - SecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7", - MultiframeSingleBitSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.1", - MultiframeGrayscaleByteSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.2", - MultiframeGrayscaleWordSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.3", - MultiframeTrueColorSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.4", - Sop12LeadECGWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.1.1", - GeneralECGWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.1.2", - AmbulatoryECGWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.1.3", - HemodynamicWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.2.1", - CardiacElectrophysiologyWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.3.1", - BasicVoiceAudioWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.4.1", - GeneralAudioWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.4.2", - ArterialPulseWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.5.1", - RespiratoryWaveformStorage: "1.2.840.10008.5.1.4.1.1.9.6.1", - GrayscaleSoftcopyPresentationStateStorage: "1.2.840.10008.5.1.4.1.1.11.1", - ColorSoftcopyPresentationStateStorage: "1.2.840.10008.5.1.4.1.1.11.2", - PseudoColorSoftcopyPresentationStateStorage: "1.2.840.10008.5.1.4.1.1.11.3", - BlendingSoftcopyPresentationStateStorage: "1.2.840.10008.5.1.4.1.1.11.4", - XAXRFGrayscaleSoftcopyPresentationStateStorage: "1.2.840.10008.5.1.4.1.1.11.5", - XRayAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.12.1", - EnhancedXAImageStorage: "1.2.840.10008.5.1.4.1.1.12.1.1", - XRayRadiofluoroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.12.2", - EnhancedXRFImageStorage: "1.2.840.10008.5.1.4.1.1.12.2.1", - XRay3DAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.1", - XRay3DCraniofacialImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.2", - BreastTomosynthesisImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.3", - BreastProjectionXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.13.1.4", - BreastProjectionXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.13.1.5", - IntravascularOpticalCoherenceTomographyImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.14.1", - IntravascularOpticalCoherenceTomographyImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.14.2", - NuclearMedicineImageStorage: "1.2.840.10008.5.1.4.1.1.20", - RawDataStorage: "1.2.840.10008.5.1.4.1.1.66", - SpatialRegistrationStorage: "1.2.840.10008.5.1.4.1.1.66.1", - SpatialFiducialsStorage: "1.2.840.10008.5.1.4.1.1.66.2", - DeformableSpatialRegistrationStorage: "1.2.840.10008.5.1.4.1.1.66.3", - SegmentationStorage: "1.2.840.10008.5.1.4.1.1.66.4", - SurfaceSegmentationStorage: "1.2.840.10008.5.1.4.1.1.66.5", - RealWorldValueMappingStorage: "1.2.840.10008.5.1.4.1.1.67", - SurfaceScanMeshStorage: "1.2.840.10008.5.1.4.1.1.68.1", - SurfaceScanPointCloudStorage: "1.2.840.10008.5.1.4.1.1.68.2", - VLEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1", - VideoEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1.1", - VLMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2", - VideoMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2.1", - VLSlideCoordinatesMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.3", - VLPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4", - VideoPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4.1", - OphthalmicPhotography8BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.1", - OphthalmicPhotography16BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.2", - StereometricRelationshipStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.3", - OphthalmicTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.4", - VLWholeSlideMicroscopyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.6", - LensometryMeasurementsStorage: "1.2.840.10008.5.1.4.1.1.78.1", - AutorefractionMeasurementsStorage: "1.2.840.10008.5.1.4.1.1.78.2", - KeratometryMeasurementsStorage: "1.2.840.10008.5.1.4.1.1.78.3", - SubjectiveRefractionMeasurementsStorage: "1.2.840.10008.5.1.4.1.1.78.4", - VisualAcuityMeasurementsStorage: "1.2.840.10008.5.1.4.1.1.78.5", - SpectaclePrescriptionReportStorage: "1.2.840.10008.5.1.4.1.1.78.6", - OphthalmicAxialMeasurementsStorage: "1.2.840.10008.5.1.4.1.1.78.7", - IntraocularLensCalculationsStorage: "1.2.840.10008.5.1.4.1.1.78.8", - MacularGridThicknessandVolumeReport: "1.2.840.10008.5.1.4.1.1.79.1", - OphthalmicVisualFieldStaticPerimetryMeasurementsStorage: "1.2.840.10008.5.1.4.1.1.80.1", - OphthalmicThicknessMapStorage: "1.2.840.10008.5.1.4.1.1.81.1", - CornealTopographyMapStorage: "1.2.840.10008.5.1.4.1.1.82.1", - BasicTextSR: "1.2.840.10008.5.1.4.1.1.88.11", - EnhancedSR: "1.2.840.10008.5.1.4.1.1.88.22", - ComprehensiveSR: "1.2.840.10008.5.1.4.1.1.88.33", - Comprehensive3DSR: "1.2.840.10008.5.1.4.1.1.88.34", - ProcedureLog: "1.2.840.10008.5.1.4.1.1.88.40", - MammographyCADSR: "1.2.840.10008.5.1.4.1.1.88.50", - KeyObjectSelection: "1.2.840.10008.5.1.4.1.1.88.59", - ChestCADSR: "1.2.840.10008.5.1.4.1.1.88.65", - XRayRadiationDoseSR: "1.2.840.10008.5.1.4.1.1.88.67", - RadiopharmaceuticalRadiationDoseSR: "1.2.840.10008.5.1.4.1.1.88.68", - ColonCADSR: "1.2.840.10008.5.1.4.1.1.88.69", - ImplantationPlanSRDocumentStorage: "1.2.840.10008.5.1.4.1.1.88.70", - EncapsulatedPDFStorage: "1.2.840.10008.5.1.4.1.1.104.1", - EncapsulatedCDAStorage: "1.2.840.10008.5.1.4.1.1.104.2", - PositronEmissionTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.128", - EnhancedPETImageStorage: "1.2.840.10008.5.1.4.1.1.130", - LegacyConvertedEnhancedPETImageStorage: "1.2.840.10008.5.1.4.1.1.128.1", - BasicStructuredDisplayStorage: "1.2.840.10008.5.1.4.1.1.131", - RTImageStorage: "1.2.840.10008.5.1.4.1.1.481.1", - RTDoseStorage: "1.2.840.10008.5.1.4.1.1.481.2", - RTStructureSetStorage: "1.2.840.10008.5.1.4.1.1.481.3", - RTBeamsTreatmentRecordStorage: "1.2.840.10008.5.1.4.1.1.481.4", - RTPlanStorage: "1.2.840.10008.5.1.4.1.1.481.5", - RTBrachyTreatmentRecordStorage: "1.2.840.10008.5.1.4.1.1.481.6", - RTTreatmentSummaryRecordStorage: "1.2.840.10008.5.1.4.1.1.481.7", - RTIonPlanStorage: "1.2.840.10008.5.1.4.1.1.481.8", - RTIonBeamsTreatmentRecordStorage: "1.2.840.10008.5.1.4.1.1.481.9", - RTBeamsDeliveryInstructionStorage: "1.2.840.10008.5.1.4.34.7", - GenericImplantTemplateStorage: "1.2.840.10008.5.1.4.43.1", - ImplantAssemblyTemplateStorage: "1.2.840.10008.5.1.4.44.1", - ImplantTemplateGroupStorage: "1.2.840.10008.5.1.4.45.1" -}; diff --git a/Packages/ohif-viewerbase/client/lib/sortStudy.js b/Packages/ohif-viewerbase/client/lib/sortStudy.js deleted file mode 100644 index cc928798e..000000000 --- a/Packages/ohif-viewerbase/client/lib/sortStudy.js +++ /dev/null @@ -1,19 +0,0 @@ -import { OHIFError } from './classes/OHIFError'; - -/** - * Sorts the series and instances inside a study instance by their series - * and instance numbers in ascending order. - * - * @param {Object} study The study instance - */ -export function sortStudy(study) { - if (!study || !study.seriesList) { - throw new OHIFError('Insufficient study data was provided to sortStudy'); - } - - study.seriesList.sort((a, b) => a.seriesNumber - b.seriesNumber); - - study.seriesList.forEach(series => { - series.instances.sort((a, b) => a.instanceNumber - b.instanceNumber); - }); -} diff --git a/Packages/ohif-viewerbase/client/lib/sortingManager.js b/Packages/ohif-viewerbase/client/lib/sortingManager.js deleted file mode 100644 index 801d041fb..000000000 --- a/Packages/ohif-viewerbase/client/lib/sortingManager.js +++ /dev/null @@ -1,13 +0,0 @@ -import { createStacks } from './createStacks'; - -const getDisplaySets = (studyMetadata, seriesNumber, iteratorFunction) => { - const iteratorFn = typeof iteratorFunction !== 'function' ? createStacks : iteratorFunction; - - return iteratorFn(studyMetadata, seriesNumber); -}; - -const sortingManager = { - getDisplaySets -}; - -export { sortingManager }; \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/lib/switchToImageByIndex.js b/Packages/ohif-viewerbase/client/lib/switchToImageByIndex.js deleted file mode 100644 index 753b3519d..000000000 --- a/Packages/ohif-viewerbase/client/lib/switchToImageByIndex.js +++ /dev/null @@ -1,15 +0,0 @@ -import { viewportUtils } from './viewportUtils'; - -/** - * This function switches to an image given an element and the index of the image in the current stack - * Note: Negative indexing is supported: - * - * e.g. switchToImageByIndex(element, -1) to switch to the last image of the stack - * - * @param element - * @param {number} [newImageIdIndex] The image index in the stack to switch to. - */ -export function switchToImageByIndex(newImageIdIndex) { - var element = viewportUtils.getActiveViewportElement(); - cornerstoneTools.scrollToIndex(element, newImageIdIndex); -} diff --git a/Packages/ohif-viewerbase/client/lib/switchToImageRelative.js b/Packages/ohif-viewerbase/client/lib/switchToImageRelative.js deleted file mode 100644 index 92e4845cb..000000000 --- a/Packages/ohif-viewerbase/client/lib/switchToImageRelative.js +++ /dev/null @@ -1,15 +0,0 @@ -import { viewportUtils } from './viewportUtils'; - -/** - * This function switches to an image given an element and - * the relative distance from the current image in the stack - * - * e.g. switchToImageRelative(element, -1) to switch to currentImageIdIndex - 1 - * - * @param element - * @param {number} [distanceFromCurrentIndex] The image index in the stack to switch to. - */ -export function switchToImageRelative(distanceFromCurrentIndex) { - var element = viewportUtils.getActiveViewportElement(); - cornerstoneTools.scroll(element, distanceFromCurrentIndex); -} diff --git a/Packages/ohif-viewerbase/client/lib/textMarkerUtils.js b/Packages/ohif-viewerbase/client/lib/textMarkerUtils.js deleted file mode 100644 index 6efc29e8a..000000000 --- a/Packages/ohif-viewerbase/client/lib/textMarkerUtils.js +++ /dev/null @@ -1,87 +0,0 @@ -import { Blaze } from 'meteor/blaze'; - -import { toolManager } from './toolManager'; -import { viewportUtils } from './viewportUtils'; - -const changeTextCallback = (data, eventData, doneChangingTextCallback) => { - // This handles the double-click/long-press event on Spine text marker labels - const keyPressHandler = e => { - // If Enter or Esc are pressed, close the dialog - if (e.which === 13 || e.which === 27) { - closeHandler(); - } - }; - - // Deactivate textMarker tool after editing a spine label & if spine is not active tool - const deactivateAfterEdit = () => { - if (toolManager.getActiveTool() !== 'spine') { - const element = viewportUtils.getActiveViewportElement(); - cornerstoneTools.textMarker.deactivate(element, 1); - } - }; - - const closeHandler = () => { - dialog.get(0).close(); - doneChangingTextCallback(data, select.val()); - deactivateAfterEdit(); - // Reset the focus to the active viewport element - // This makes the mobile Safari keyboard close - const element = viewportUtils.getActiveViewportElement(); - $(element).focus(); - }; - - const dialog = $('#textMarkerRelabelDialog'); - - // Is necessary to use Blaze object to not create - // circular depencency with helper object (./helpers) - if (Blaze._globalHelpers.isTouchDevice()) { - // Center the dialog on screen on touch devices - dialog.css({ - top: 0, - left: 0, - right: 0, - bottom: 0, - margin: 'auto' - }); - dialog.find('.dialog.arrow').hide(); - } else { - // Place the dialog above the tool that is being relabelled - // TODO = Switch this to the tool coordinates, but put back into - // page coordinates. - dialog.css({ - top: eventData.currentPoints.page.y - dialog.outerHeight() - 20, - left: eventData.currentPoints.page.x - dialog.outerWidth() / 2 - }); - dialog.find('.dialog.arrow').show(); - } - - const select = dialog.find('.relabelSelect'); - const confirm = dialog.find('.relabelConfirm'); - const remove = dialog.find('.relabelRemove'); - - // If the remove button is clicked, delete this marker - remove.off('click'); - remove.on('click', () => { - dialog.get(0).close(); - doneChangingTextCallback(data, undefined, true); - deactivateAfterEdit(); - }); - - dialog.get(0).showModal(); - $('.relabelSelect').val(data.text).trigger('change'); //Update selector to the current - - confirm.off('click'); - confirm.on('click', () => { - closeHandler(); - }); - - // Use keydown since keypress doesn't handle ESC in Chrome - dialog.off('keydown'); - dialog.on('keydown', keyPressHandler); -}; - -const textMarkerUtils = { - changeTextCallback -}; - -export { textMarkerUtils }; \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/lib/thumbnailDragHandlers.js b/Packages/ohif-viewerbase/client/lib/thumbnailDragHandlers.js deleted file mode 100644 index dadfb87d8..000000000 --- a/Packages/ohif-viewerbase/client/lib/thumbnailDragHandlers.js +++ /dev/null @@ -1,255 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; - -const cloneElement = (element, targetId) => { - // Clone the DOM element - const clone = element.cloneNode(true); - - // Find any canvas children to clone - const clonedCanvases = $(clone).find('canvas'); - clonedCanvases.each((canvasIndex, clonedCanvas) => { - // Draw from the original canvas to the cloned canvas - const context = clonedCanvas.getContext('2d'); - const thumbnailCanvas = $(element).find('canvas').get(canvasIndex); - context.drawImage(thumbnailCanvas, 0, 0); - }); - - // Update the clone with the targetId - clone.id = targetId; - clone.style.visibility = 'hidden'; - - return clone; -}; - -const thumbnailDragStartHandler = (event, data) => { - // Prevent any scrolling behaviour normally caused by the original event - event.originalEvent.preventDefault(); - - // Identify the current study and series index from the thumbnail's DOM position - const targetThumbnail = event.currentTarget; - const $imageThumbnail = $(targetThumbnail); - - // Force to hardware acceleration to move element - // if browser supports translate property - const useTransform = OHIF.ui.styleProperty.check('transform', 'translate(1px, 1px)'); - - // Clone the image thumbnail - const targetId = 'DragClone'; - const clone = cloneElement(targetThumbnail, targetId); - const $clone = $(clone); - $clone.addClass('imageThumbnailClone'); - - // Set pointerEvents to pass through the clone DOM element - // This is necessary in order to identify what is below it - // when using document.elementFromPoint - clone.style.pointerEvents = 'none'; - - // Append the clone to the body - document.body.appendChild(clone); - - // Set the cursor x and y positions from the current touch/mouse coordinates - let cursorX; - let cursorY; - // Handle touchStart cases - if (event.type === 'touchstart') { - cursorX = event.originalEvent.touches[0].pageX; - cursorY = event.originalEvent.touches[0].pageY; - } else { - cursorX = event.pageX; - cursorY = event.pageY; - - // Also hook up event handlers for mouse events - const handlers = {}; - handlers.mousemove = event => thumbnailDragHandler(event); - handlers.mouseup = event => thumbnailDragEndHandler(event, data, handlers); - - $(document).on('mousemove', handlers.mousemove); - $(document).on('mouseup', handlers.mouseup); - } - - // This block gets the current offset of the touch/mouse - // relative to the window - // - // i.e. Where did the user grab it from? - const offset = $imageThumbnail.offset(); - const { left, top } = offset; - - // This difference is saved for later so the element movement looks normal - const diff = { - x: cursorX - left, - y: cursorY - top - }; - $clone.data('diff', diff); - - $clone.css({ - visibility: 'hidden', - 'z-index': 100000 - }); - - // This sets the default style properties of the cloned element so it is - // ready to be dragged around the page - if (useTransform) { - const viewerHeight = $('#viewer').height(); - const headerHeight = $('.header').outerHeight(); - const heightDiff = viewerHeight + headerHeight; - - // Save height difference for later to set top position of the element during movement - $clone.data('heightDiff', heightDiff); - - const positionX = cursorX - diff.x; - const positionY = cursorY - diff.y - heightDiff; - - const translation = `translate(${positionX}px, ${positionY}px)`; - OHIF.ui.styleProperty.set($clone.get(0), 'transform', translation); - } else { - $clone.css({ - left: cursorX - diff.x, - position: 'fixed', - top: cursorY - diff.y, - }); - } -}; - -const thumbnailDragHandler = event => { - // Get the touch/mouse coordinates from the event - let cursorX; - let cursorY; - if (event.type === 'touchmove') { - cursorX = event.originalEvent.changedTouches[0].pageX; - cursorY = event.originalEvent.changedTouches[0].pageY; - } else { - cursorX = event.pageX; - cursorY = event.pageY; - } - - // Find the clone element and update it's position on the page - const $clone = $('#DragClone'); - const diff = $clone.data('diff'); - - // Force to hardware acceleration to move element - // if browser supports translate property - const useTransform = OHIF.ui.styleProperty.check('transform', 'translate(1px, 1px)'); - - $clone.css({ - visibility: 'visible', - 'z-index': 100000 - }); - - // This sets the default style properties of the cloned element so it is - // ready to be dragged around the page - if (useTransform) { - const heightDiff = $clone.data('heightDiff'); - const positionX = cursorX - diff.x; - const positionY = cursorY - diff.y - heightDiff; - - const translation = `translate(${positionX}px, ${positionY}px)`; - OHIF.ui.styleProperty.set($clone.get(0), 'transform', translation); - } else { - $clone.css({ - left: cursorX - diff.x, - position: 'fixed', - top: cursorY - diff.y, - }); - } - - // Identify the element below the current cursor position - const elemBelow = document.elementFromPoint(cursorX, cursorY); - - // If none exists, stop here - if (!elemBelow) { - return; - } - - // Remove any current faded effects on viewports - $('.viewportContainer canvas').removeClass('faded'); - - // Figure out what to do depending on what we're dragging over - const $viewportsDraggedOver = $(elemBelow).parents('.viewportContainer'); - if ($viewportsDraggedOver.length) { - // If we're dragging over a non-empty viewport, fade it and change the cursor style - $viewportsDraggedOver.find('canvas').not('.magnifyTool').addClass('faded'); - document.body.style.cursor = 'copy'; - } else if (elemBelow.classList.contains('viewportContainer') && elemBelow.classList.contains('empty')) { - // If we're dragging over an empty viewport, just change the cursor style - document.body.style.cursor = 'copy'; - } else { - // Otherwise, keep the cursor as no-drop style - document.body.style.cursor = 'no-drop'; - } -}; - -const thumbnailDragEndHandler = (event, data, handlers) => { - // Remove the mouse event listeners - if (handlers) { - $(document).off('mousemove', handlers.mousemove); - $(document).off('mouseup', handlers.mouseup); - } - - // Reset the cursor style to the default - document.body.style.cursor = 'auto'; - - // Get the cloned element - const $clone = $('#DragClone'); - - // If it doesn't exist, stop here - if (!$clone.length) { - return; - } - - const offset = $clone.offset(); - const { top, left } = offset; - const diff = $clone.data('diff'); - - // Identify the element below the cloned element position - const elemBelow = document.elementFromPoint(left + diff.x, top + diff.y); - - // Remove all cloned elements from the page - $('.imageThumbnailClone').remove(); - - // Remove any current faded effects on viewports - $('.viewportContainer canvas').removeClass('faded'); - - // If none exists, stop here - if (!elemBelow) { - return; - } - - // Remove any fade effects on the element below - elemBelow.classList.remove('faded'); - - let element; - const $viewportsDraggedOver = $(elemBelow).closest('.viewportContainer'); - - if ($viewportsDraggedOver.length) { - // If we're dragging over a non-empty viewport, retrieve it - element = $viewportsDraggedOver.get(0); - } else if (elemBelow.classList.contains('viewportContainer') && - elemBelow.classList.contains('empty')) { - // If we're dragging over an empty viewport, retrieve that instead - element = elemBelow; - } else { - // Otherwise, stop here - return false; - } - - // If there is no stored drag and drop data, stop here - if (!data) { - return false; - } - - // Get the dropped viewport index - const viewportIndex = $('.viewportContainer').index(element); - - // Rerender the viewport using the dragged thumbnail data - OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, data); - - return false; -}; - -const thumbnailDragHandlers = { - thumbnailDragEndHandler, - thumbnailDragStartHandler, - thumbnailDragHandler -}; - -export { thumbnailDragHandlers }; diff --git a/Packages/ohif-viewerbase/client/lib/toolManager.js b/Packages/ohif-viewerbase/client/lib/toolManager.js deleted file mode 100644 index 2418e8b6b..000000000 --- a/Packages/ohif-viewerbase/client/lib/toolManager.js +++ /dev/null @@ -1,695 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Session } from 'meteor/session'; -import { Random } from 'meteor/random'; -import { $ } from 'meteor/jquery'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { getFrameOfReferenceUID } from './getFrameOfReferenceUID'; -import { updateCrosshairsSynchronizer } from './updateCrosshairsSynchronizer'; -import { crosshairsSynchronizers } from './crosshairsSynchronizers'; -import { annotateTextUtils } from './annotateTextUtils'; -import { textMarkerUtils } from './textMarkerUtils'; -import { isTouchDevice } from './helpers/isTouchDevice'; - -let defaultTool = { - left: 'wwwc', - right: 'zoom', - middle: 'pan' -}; -let activeTool; -let defaultMouseButtonTools; - -let tools = {}; - -let gestures = { - zoomTouchPinch: { - enabled: true - }, - panMultiTouch: { - enabled: true, - numPointers: 2 - }, - stackScrollMultiTouch: { - enabled: true, - numPointers: 3 - }, - doubleTapZoom: { - enabled: true - } -}; - -let toolDefaultStates = { - activate: [], - deactivate: ['length', 'angle', 'annotate', 'ellipticalRoi', 'rectangleRoi', 'spine'], - enable: [], - disable: [], - disabledToolButtons: [], - shadowConfig: { - shadow: false, - shadowColor: '#000000', - shadowOffsetX: 0, - shadowOffsetY: 0 - }, - textBoxConfig: { - centering: { - x: true, - y: true - } - } -}; - -let initialized = false; - -/** - * Exported "toolManager" Singleton - */ -export const toolManager = { - init() { - toolManager.addTool('wwwc', { - mouse: cornerstoneTools.wwwc, - touch: cornerstoneTools.wwwcTouchDrag - }); - toolManager.addTool('zoom', { - mouse: cornerstoneTools.zoom, - touch: cornerstoneTools.zoomTouchDrag - }); - toolManager.addTool('wwwcRegion', { - mouse: cornerstoneTools.wwwcRegion, - touch: cornerstoneTools.wwwcRegionTouch - }); - toolManager.addTool('dragProbe', { - mouse: cornerstoneTools.dragProbe, - touch: cornerstoneTools.dragProbeTouch - }); - toolManager.addTool('pan', { - mouse: cornerstoneTools.pan, - touch: cornerstoneTools.panTouchDrag, - multiTouch: cornerstoneTools.panMultiTouch - }); - toolManager.addTool('stackScroll', { - mouse: cornerstoneTools.stackScroll, - touch: cornerstoneTools.stackScrollTouchDrag, - multiTouch: cornerstoneTools.stackScrollMultiTouch - }); - toolManager.addTool('length', { - mouse: cornerstoneTools.length, - touch: cornerstoneTools.lengthTouch - }); - toolManager.addTool('angle', { - mouse: cornerstoneTools.simpleAngle, - touch: cornerstoneTools.simpleAngleTouch - }); - toolManager.addTool('magnify', { - mouse: cornerstoneTools.magnify, - touch: cornerstoneTools.magnifyTouchDrag - }); - toolManager.addTool('ellipticalRoi', { - mouse: cornerstoneTools.ellipticalRoi, - touch: cornerstoneTools.ellipticalRoiTouch - }); - toolManager.addTool('rectangleRoi', { - mouse: cornerstoneTools.rectangleRoi, - touch: cornerstoneTools.rectangleRoiTouch - }); - toolManager.addTool('annotate', { - mouse: cornerstoneTools.arrowAnnotate, - touch: cornerstoneTools.arrowAnnotateTouch - }); - toolManager.addTool('rotate', { - mouse: cornerstoneTools.rotate, - touch: cornerstoneTools.rotateTouchDrag - }); - toolManager.addTool('spine', { - mouse: cornerstoneTools.textMarker, - touch: cornerstoneTools.textMarkerTouch - }); - toolManager.addTool('crosshairs', { - mouse: cornerstoneTools.crosshairs, - touch: cornerstoneTools.crosshairsTouch - }); - - toolManager.addTool('scaleOverlayTool', { - mouse: cornerstoneTools.scaleOverlayTool, - }); - - // if a default tool is globally defined, make it the default tool... - if (OHIF.viewer.defaultTool) { - this.setDefaultTool(OHIF.viewer.defaultTool); - } - - defaultMouseButtonTools = Meteor.settings && Meteor.settings.public && Meteor.settings.public.defaultMouseButtonTools; - - // Override default tool if defined in settings - if (defaultMouseButtonTools) { - if (defaultMouseButtonTools.left) { - this.setDefaultTool(defaultMouseButtonTools.left); - } - if (defaultMouseButtonTools.right) { - this.setDefaultTool(defaultMouseButtonTools.right, 'right'); - } - if (defaultMouseButtonTools.middle) { - this.setDefaultTool(defaultMouseButtonTools.middle, 'middle'); - } - } - - this.configureTools(); - initialized = true; - }, - - configureTools() { - // Get Cornerstone Tools - const { textStyle, toolStyle, toolColors, - length, arrowAnnotate, zoom, ellipticalRoi, - textMarker, magnify } = cornerstoneTools; - - // Set text box background color - textStyle.setBackgroundColor('transparent'); - - // Set the tool font and font size - // context.font = "[style] [variant] [weight] [size]/[line height] [font family]"; - const fontFamily = 'Roboto, OpenSans, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif'; - textStyle.setFont('15px ' + fontFamily); - - // Set the tool width - toolStyle.setToolWidth(2); - - // Set color for inactive tools - toolColors.setToolColor('rgb(255, 255, 0)'); // yellow - - // Set color for active tools - toolColors.setActiveColor('rgb(50, 205, 50)'); // limegreen - - // Set shadow configuration - const shadowConfig = toolManager.getToolDefaultStates().shadowConfig; - - // Get some tools config to not override them - const lengthConfig = length.getConfiguration(); - const ellipticalRoiConfig = ellipticalRoi.getConfiguration(); - - // Add shadow to length tool - length.setConfiguration(Object.assign({}, lengthConfig, shadowConfig, { drawHandlesOnHover: true })); - - // Add shadow to length tool - ellipticalRoi.setConfiguration(Object.assign({}, ellipticalRoiConfig, shadowConfig)); - - // Set the configuration values for the Text Marker (Spine Labelling) tool - const $startFrom = $('#startFrom'); - const $ascending = $('#ascending'); - const textMarkerConfig = { - markers: [ 'L5', 'L4', 'L3', 'L2', 'L1', // Lumbar spine - 'T12', 'T11', 'T10', 'T9', 'T8', 'T7', // Thoracic spine - 'T6', 'T5', 'T4', 'T3', 'T2', 'T1', - 'C7', 'C6', 'C5', 'C4', 'C3', 'C2', 'C1', // Cervical spine - ], - current: $startFrom.val(), - ascending: $ascending.is(':checked'), - loop: true, - changeTextCallback: textMarkerUtils.changeTextCallback, - shadow: shadowConfig.shadow, - shadowColor: shadowConfig.shadowColor, - shadowOffsetX: shadowConfig.shadowOffsetX, - shadowOffsetY: shadowConfig.shadowOffsetY - }; - textMarker.setConfiguration(textMarkerConfig); - - // Set the configuration values for the text annotation (Arrow) tool - const annotateConfig = { - getTextCallback: annotateTextUtils.getTextCallback, - changeTextCallback: annotateTextUtils.changeTextCallback, - drawHandles: false, - arrowFirst: true - }; - arrowAnnotate.setConfiguration(annotateConfig); - - const zoomConfig = { - minScale: 0.05, - maxScale: 10 - }; - zoom.setConfiguration(zoomConfig); - - const magnifyConfig = { - magnifySize: 300, - magnificationLevel: 3 - }; - magnify.setConfiguration(magnifyConfig); - - if (Meteor.settings && Meteor.settings.public && Meteor.settings.public.defaultGestures) { - gestures.zoomTouchPinch = Meteor.settings.public.defaultGestures.zoomTouchPinch || gestures.zoomTouchPinch; - gestures.stackScrollMultiTouch = Meteor.settings.public.defaultGestures.stackScrollMultiTouch || gestures.stackScrollMultiTouch; - gestures.panMultiTouch = Meteor.settings.public.defaultGestures.panMultiTouch || gestures.panMultiTouch; - gestures.doubleTapZoom = Meteor.settings.public.defaultGestures.doubleTapZoom || gestures.doubleTapZoom; - } - - // Set number of fingers to stack scroll - if (gestures.stackScrollMultiTouch.enabled === true && gestures.stackScrollMultiTouch.numPointers) { - const stackScrollMultiTouchConfig = { - testPointers(eventData) { - return (eventData.numPointers === gestures.stackScrollMultiTouch.numPointers); - } - }; - cornerstoneTools.stackScrollMultiTouch.setConfiguration(stackScrollMultiTouchConfig); - } - - // Set number of fingers to pan - if (gestures.panMultiTouch.enabled === true && gestures.panMultiTouch.numPointers) { - const panMultiTouchConfig = { - testPointers(eventData) { - return (eventData.numPointers === gestures.panMultiTouch.numPointers); - } - }; - cornerstoneTools.panMultiTouch.setConfiguration(panMultiTouchConfig); - } - }, - /** - * This function searches an object to return the keys that contain a specific value - * - * @param object {object} The object to be searched - * @param value The value to be found - * - * @returns {array} The keys for which the object has the specified value - */ - getKeysByValue(object, value) { - // http://stackoverflow.com/questions/9907419/javascript-object-get-key-by-value - return Object.keys(object).filter(key => object[key] === value); - }, - - configureLoadProcess() { - // Whenever CornerstoneImageLoadProgress is fired, identify which viewports - // the "in-progress" image is to be displayed in. Then pass the percent complete - // via the Meteor Session to the other templates to be displayed in the relevant viewports. - - function handleLoadProgress (e) { - const eventData = e.detail; - const viewportIndices = toolManager.getKeysByValue(window.ViewportLoading, eventData.imageId); - viewportIndices.forEach(viewportIndex => { - Session.set('CornerstoneLoadProgress' + viewportIndex, eventData.percentComplete); - }); - - const encodedId = OHIF.string.encodeId(eventData.imageId); - Session.set('CornerstoneThumbnailLoadProgress' + encodedId, eventData.percentComplete); - } - - cornerstone.events.removeEventListener('cornerstoneimageloadprogress', handleLoadProgress); - cornerstone.events.addEventListener('cornerstoneimageloadprogress', handleLoadProgress); - }, - - setGestures(newGestures) { - gestures = newGestures; - }, - - getGestures() { - return gestures; - }, - - addTool(name, base) { - tools[name] = base; - }, - - getTools() { - return tools; - }, - - setToolDefaultStates(states) { - toolDefaultStates = states; - }, - - getToolDefaultStates() { - return toolDefaultStates; - }, - - setActiveToolForElement(toolId, element, button) { - const canvases = $(element).find('canvas'); - if (element.classList.contains('empty') || !canvases.length) { - return; - } - - // If button is not defined, we should consider it left - if (!button) { - button = 'left'; - } - - // First, deactivate the current active tool - tools[activeTool.left].mouse.deactivate(element, 1); // 1 means left mouse button - tools[activeTool.middle].mouse.deactivate(element, 2); // 2 means middle mouse button - tools[activeTool.right].mouse.deactivate(element, 4); // 3 means right mouse button - - if (tools[activeTool.left].touch) { - tools[activeTool.left].touch.deactivate(element); - } - - if (tools[activeTool.right].multiTouch) { - tools[activeTool.right].multiTouch.disable(element); - } - - // Enable tools based on their default states - Object.keys(toolDefaultStates).forEach(action => { - const relevantTools = toolDefaultStates[action]; - if (!relevantTools || !relevantTools.length || action === 'disabledToolButtons') return; - relevantTools.forEach(toolType => { - // the currently active tool has already been deactivated and can be skipped - if (action === 'deactivate' && - (toolType === activeTool.left || - toolType === activeTool.middle || - toolType === activeTool.right)) { - return; - } - - tools[toolType].mouse[action]( - element, - (action === 'activate' || action === 'deactivate' ? 1 : void 0) - ); - - if (tools[toolType].touch) { - tools[toolType].touch[action](element); - } - - if (tools[toolType].multiTouch) { - tools[toolType].multiTouch[action](element); - } - }); - }); - - // Get the stack toolData - const toolData = cornerstoneTools.getToolState(element, 'stack'); - if (!toolData || !toolData.data || !toolData.data.length) { - return; - } - - // Get the imageIds for this element - const imageIds = toolData.data[0].imageIds; - - // Get the mouse button tools - let newToolIdLeft = activeTool.left; - if (button === 'left') { - newToolIdLeft = toolId; - } - - const newCornerstoneToolLeft = tools[newToolIdLeft]; // left mouse tool is used for touch as well - - let newToolIdMiddle = activeTool.middle; - if (button === 'middle') { - newToolIdMiddle = toolId; - } - - const newCornerstoneToolMiddle = cornerstoneTools[newToolIdMiddle]; - - let newToolIdRight = activeTool.right; - if (button === 'right') { - newToolIdRight = toolId; - } - - const newCornerstoneToolRight = tools[newToolIdRight]; // right mouse tool is used for multi-touch as well - - // Deactivate scroll wheel tools - cornerstoneTools.zoomWheel.deactivate(element); - cornerstoneTools.stackScrollWheel.deactivate(element); - cornerstoneTools.panMultiTouch.disable(element); - cornerstoneTools.zoomTouchPinch.disable(element); - cornerstoneTools.stackScrollMultiTouch.disable(element); - cornerstoneTools.doubleTapZoom.disable(element); - - // Reactivate the relevant scrollwheel tool for this element - if (imageIds.length > 1) { - // scroll is the default tool for middle mouse wheel for stacks - cornerstoneTools.stackScrollWheel.activate(element); - - // 3 or more finger stack scroll - if (gestures.stackScrollMultiTouch.enabled === true && gestures.stackScrollMultiTouch.numPointers >= 3) { - const stackScrollMultiTouchConfig = { - testPointers(eventData) { - return (eventData.numPointers === gestures.stackScrollMultiTouch.numPointers); - } - }; - cornerstoneTools.stackScrollMultiTouch.setConfiguration(stackScrollMultiTouchConfig); - cornerstoneTools.stackScrollMultiTouch.activate(element); - } - } else { - // zoom is the default tool for middle mouse wheel for single images (non stacks) - cornerstoneTools.zoomWheel.activate(element); - } - - // 3 or more finger pan - if (gestures.panMultiTouch.enabled === true && gestures.panMultiTouch.numPointers >= 3) { - const panMultiTouchConfig = { - testPointers(eventData) { - return (eventData.numPointers === gestures.panMultiTouch.numPointers); - } - }; - cornerstoneTools.panMultiTouch.setConfiguration(panMultiTouchConfig); - cornerstoneTools.panMultiTouch.activate(element); - } - - // TODO: Remove this messy approach for adding synchronizer when necessary. - let leftToolSynchronizer; - if (newToolIdLeft === 'crosshairs') { - const currentFrameOfReferenceUID = getFrameOfReferenceUID(element); - if (currentFrameOfReferenceUID) { - updateCrosshairsSynchronizer(currentFrameOfReferenceUID); - leftToolSynchronizer = crosshairsSynchronizers.synchronizers[currentFrameOfReferenceUID]; - } - - if (newToolIdLeft === newToolIdMiddle && newToolIdMiddle === newToolIdRight) { - newCornerstoneToolRight.mouse.activate(element, 7); // 7 means left mouse button, right mouse button and middle mouse button - } else if (newToolIdLeft === newToolIdMiddle) { - newCornerstoneToolMiddle.activate(element, 3); // 3 means left mouse button and middle mouse button - newCornerstoneToolRight.mouse.activate(element, 4); // 4 means right mouse button - } else if (newToolIdMiddle === newToolIdRight) { - newCornerstoneToolRight.mouse.activate(element, 6); // 6 means right mouse button and middle mouse button - newCornerstoneToolLeft.mouse.activate(element, 1, leftToolSynchronizer); // 1 means left mouse button - } else if (newToolIdLeft === newToolIdRight) { - newCornerstoneToolMiddle.activate(element, 2); // 2 means middle mouse button - newCornerstoneToolRight.mouse.activate(element, 5); // 5 means left mouse button and right mouse button - } else { - newCornerstoneToolLeft.mouse.activate(element, 1, leftToolSynchronizer); // 1 means left mouse button - newCornerstoneToolMiddle.activate(element, 2); // 2 means middle mouse button - newCornerstoneToolRight.mouse.activate(element, 4); // 4 means right mouse button - } - } else { - // This block ensures that all mouse button tools keep working - if (newToolIdLeft === newToolIdMiddle && newToolIdMiddle === newToolIdRight) { - newCornerstoneToolRight.mouse.activate(element, 7); // 7 means left mouse button, right mouse button and middle mouse button - } else if (newToolIdLeft === newToolIdMiddle) { - newCornerstoneToolMiddle.activate(element, 3); // 3 means left mouse button and middle mouse button - newCornerstoneToolRight.mouse.activate(element, 4); // 4 means right mouse button - } else if (newToolIdMiddle === newToolIdRight) { - newCornerstoneToolRight.mouse.activate(element, 6); // 6 means right mouse button and middle mouse button - newCornerstoneToolLeft.mouse.activate(element, 1); // 1 means left mouse button - } else if (newToolIdLeft === newToolIdRight) { - newCornerstoneToolMiddle.activate(element, 2); // 2 means middle mouse button - newCornerstoneToolRight.mouse.activate(element, 5); // 5 means left mouse button and right mouse button - } else { - setTimeout(() => newCornerstoneToolLeft.mouse.activate(element, 1)); - // >>>> TODO Find out why it's working only with a timeout - // newCornerstoneToolLeft.mouse.activate(element, 1); // 1 means left mouse button - newCornerstoneToolMiddle.activate(element, 2); // 2 means middle mouse button - newCornerstoneToolRight.mouse.activate(element, 4); // 4 means right mouse button - } - } - - // One finger touch - if (newCornerstoneToolLeft.touch) { - if (leftToolSynchronizer) { - newCornerstoneToolLeft.touch.activate(element, leftToolSynchronizer); - } else { - newCornerstoneToolLeft.touch.activate(element); - } - } - - // Two finger swipe - const twoFingerMultiTouchConfig = { - testPointers(eventData) { - return (eventData.numPointers === 2); - } - }; - if (newCornerstoneToolRight.multiTouch) { - newCornerstoneToolRight.multiTouch.setConfiguration(twoFingerMultiTouchConfig); - newCornerstoneToolRight.multiTouch.activate(element); - } else if (gestures.panMultiTouch.enabled === true && gestures.panMultiTouch.numPointers === 2) { - cornerstoneTools.panMultiTouch.setConfiguration(twoFingerMultiTouchConfig); - cornerstoneTools.panMultiTouch.activate(element); - } else if (gestures.stackScrollMultiTouch.enabled === true && gestures.stackScrollMultiTouch.numPointers === 2) { - cornerstoneTools.stackScrollMultiTouch.setConfiguration(twoFingerMultiTouchConfig); - cornerstoneTools.stackScrollMultiTouch.activate(element); - } - - // Two finger pinch - if (gestures.zoomTouchPinch.enabled === true) { - cornerstoneTools.zoomTouchPinch.activate(element); - } - - // Double Tap - if (gestures.doubleTapZoom.enabled === true) { - cornerstoneTools.doubleTapZoom.activate(element); - } - }, - - setActiveTool(toolId, elements, button) { - if (!initialized) { - toolManager.init(); - } - - let $elements; - if (!elements || !elements.length) { - $elements = $('.imageViewerViewport'); - } else { - $elements = $(elements); - } - - const checkElementEnabled = function(allElementsEnabled, element) { - try { - cornerstone.getEnabledElement(element); - - return allElementsEnabled; - } catch (error) { - return true; - } - }; - - if (!activeTool) { - activeTool = defaultTool; - } - - // If button is not defined, we should consider it left - if (!button) { - button = 'left'; - } - - const activeToolId = activeTool[button]; - - /** - * TODO: Add textMarkerDialogs template to OHIF's - */ - const dialog = document.getElementById('textMarkerOptionsDialog'); - if (dialog) { - if (toolId === 'spine' && activeToolId !== 'spine' && dialog.getAttribute('open') !== 'open') { - dialog.show(); - } else if (activeToolId !== 'spine' && dialog.getAttribute('open') === 'open') { - dialog.close(); - } - } - - if (!toolId) { - toolId = this.getDefaultTool(button); - } - - // Otherwise, set the active tool for all viewport elements - $elements.each((index, element) => { - if (checkElementEnabled(element) === false) { - return; - } - - toolManager.setActiveToolForElement(toolId, element, button); - }); - - activeTool[button] = toolId; - - // Enable reactivity - Session.set('ToolManagerActiveToolUpdated', Random.id()); - }, - - getNearbyToolData(element, coords, toolTypes) { - const allTools = this.getTools(); - const touchDevice = isTouchDevice(); - const nearbyTool = {}; - let pointNearTool = false; - - toolTypes.forEach(function(toolType) { - const toolData = cornerstoneTools.getToolState(element, toolType); - if (!toolData) { - return; - } - - toolData.data.forEach(function(data, index) { - let toolInterfaceName = toolType; - let toolInterface; - - // Edge cases where the tool is not the same as the typeName - if (toolType === 'simpleAngle') { - toolInterfaceName = 'angle'; - } else if (toolType === 'arrowAnnotate') { - toolInterfaceName = 'annotate'; - } - - if (touchDevice) { - toolInterface = allTools[toolInterfaceName].touch; - } else { - toolInterface = allTools[toolInterfaceName].mouse; - } - - if (toolInterface.pointNearTool(element, data, coords)) { - pointNearTool = true; - nearbyTool.tool = data; - nearbyTool.index = index; - nearbyTool.toolType = toolType; - } - }); - - if (pointNearTool) { - return false; - } - }); - - return pointNearTool ? nearbyTool : undefined; - }, - - getActiveTool(button) { - if (!initialized) { - toolManager.init(); - } - - // If activeTool is not defined, we should set as defaultTool - if (!activeTool) { - activeTool = defaultTool; - } - - // If button is not defined, we should consider it left - if (!button) { - button = 'left'; - } - - return activeTool[button]; - }, - - setDefaultTool(tool, button) { - // If button is not defined, we should consider it left - if (!button) { - button = 'left'; - } - - defaultTool[button] = tool; - }, - - getDefaultTool(button) { - // If button is not defined, we should consider it left - if (!button) { - button = 'left'; - } - - return defaultTool[button]; - }, - - setConfigureTools(configureTools) { - if (typeof configureTools === 'function') { - this.configureTools = configureTools; - } - }, - - activateCommandButton(button) { - const activeCommandButtons = Session.get('ToolManagerActiveCommandButtons') || []; - - if (activeCommandButtons.indexOf(button) === -1) { - activeCommandButtons.push(button); - Session.set('ToolManagerActiveCommandButtons', activeCommandButtons); - } - }, - - deactivateCommandButton(button) { - const activeCommandButtons = Session.get('ToolManagerActiveCommandButtons') || []; - const index = activeCommandButtons.indexOf(button); - - if (index !== -1) { - activeCommandButtons.splice(index, 1); - Session.set('ToolManagerActiveCommandButtons', activeCommandButtons); - } - } -}; diff --git a/Packages/ohif-viewerbase/client/lib/unloadHandlers.js b/Packages/ohif-viewerbase/client/lib/unloadHandlers.js deleted file mode 100644 index f84f21b2c..000000000 --- a/Packages/ohif-viewerbase/client/lib/unloadHandlers.js +++ /dev/null @@ -1,12 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -export const unloadHandlers = { - beforeUnload: function(event) { - // Check for any unsaved changes on viewer namespace... - if (OHIF.ui.unsavedChanges.probe('viewer.*') > 0) { - let confirmationMessage = 'You have unsaved changes!'; - event.returnValue = confirmationMessage; - return confirmationMessage; - } - } -}; diff --git a/Packages/ohif-viewerbase/client/lib/updateAllViewports.js b/Packages/ohif-viewerbase/client/lib/updateAllViewports.js deleted file mode 100644 index c0afe2179..000000000 --- a/Packages/ohif-viewerbase/client/lib/updateAllViewports.js +++ /dev/null @@ -1,8 +0,0 @@ -import { $ } from 'meteor/jquery'; - -export function updateAllViewports() { - var viewports = $('.imageViewerViewport').not('.empty'); - viewports.each(function(index, element) { - cornerstone.updateImage(element); - }); -} diff --git a/Packages/ohif-viewerbase/client/lib/updateCrosshairsSynchronizer.js b/Packages/ohif-viewerbase/client/lib/updateCrosshairsSynchronizer.js deleted file mode 100644 index cc19cad4e..000000000 --- a/Packages/ohif-viewerbase/client/lib/updateCrosshairsSynchronizer.js +++ /dev/null @@ -1,36 +0,0 @@ -import { $ } from 'meteor/jquery'; -import { getFrameOfReferenceUID } from './getFrameOfReferenceUID'; -import { crosshairsSynchronizers } from './crosshairsSynchronizers'; - -/** - * This function is used to maintain the updateImageSynchronizers - * that are using in the Crosshair tool. The function creates - * (and destroys any currently existing) a new synchronizer for the given - * frame of reference. It then searches for other viewports that share the same - * frame of reference, and adds those to the synchronizer. These viewports - * will now function together when the Crosshair tool is used. - * - * @param currentFrameOfReferenceUID - */ - export function updateCrosshairsSynchronizer(currentFrameOfReferenceUID) { - // Check if an old synchronizer exists, and if it does, destroy it - // If not, create a new one - let synchronizer = crosshairsSynchronizers.synchronizers[currentFrameOfReferenceUID]; - if (synchronizer) { - // If it already exists, remove all source & target elements - synchronizer.destroy(); - } else { - // Create a new synchronizer - crosshairsSynchronizers.synchronizers[currentFrameOfReferenceUID] = new cornerstoneTools.Synchronizer('cornerstonenewimage', cornerstoneTools.updateImageSynchronizer); - synchronizer = crosshairsSynchronizers.synchronizers[currentFrameOfReferenceUID]; - } - - // Add all elements that stem from the same frame of reference - $('.imageViewerViewport').each((index, element) => { - const frameOfReferenceUID = getFrameOfReferenceUID(element); - if (currentFrameOfReferenceUID !== frameOfReferenceUID) { - return; - } - synchronizer.add(element); - }); -} diff --git a/Packages/ohif-viewerbase/client/lib/updateMetaDataManager.js b/Packages/ohif-viewerbase/client/lib/updateMetaDataManager.js deleted file mode 100644 index c9731a790..000000000 --- a/Packages/ohif-viewerbase/client/lib/updateMetaDataManager.js +++ /dev/null @@ -1,86 +0,0 @@ -import { _ } from 'meteor/underscore'; -import { getWADORSImageId } from './getWADORSImageId'; -import { WadoRsMetaDataBuilder } from './classes/metadata/WadoRsMetaDataBuilder'; - -function getRadiopharmaceuticalInfoMetaData(instance) { - const radiopharmaceuticalInfo = instance.radiopharmaceuticalInfo; - - if ((instance.modality !== 'PT') || !radiopharmaceuticalInfo) { - return; - } - - return new WadoRsMetaDataBuilder() - .addTag('00181072', radiopharmaceuticalInfo.radiopharmaceuticalStartTime) - .addTag('00181074', radiopharmaceuticalInfo.radionuclideTotalDose) - .addTag('00181075', radiopharmaceuticalInfo.radionuclideHalfLife) - .toJSON(); -} - -const getWadoRsInstanceMetaData = (study, series, instance) => { - return new WadoRsMetaDataBuilder() - .addTag('00080016', instance.sopClassUid) - .addTag('00080018', instance.sopInstanceUid) - .addTag('00080021', series.seriesDate) - .addTag('00080031', series.seriesTime) - .addTag('00080060', instance.modality) - .addTag('00101010', study.patientAge) - .addTag('00101020', study.patientSize) - .addTag('00101030', study.patientWeight) - .addTag('00180050', instance.sliceThickness) - .addTag('0020000e', series.seriesInstanceUid) - .addTag('00200011', series.seriesNumber) - .addTag('0020000d', study.studyInstanceUid) - .addTag('00200013', instance.instanceNumber) - .addTag('00200032', instance.imagePositionPatient, true) - .addTag('00200037', instance.imageOrientationPatient, true) - .addTag('00200052', instance.frameOfReferenceUID) - .addTag('00201041', instance.sliceLocation) - .addTag('00280002', instance.samplesPerPixel) - .addTag('00280004', instance.photometricInterpretation) - .addTag('00280006', instance.planarConfiguration) - .addTag('00280010', instance.rows) - .addTag('00280011', instance.columns) - .addTag('00280030', instance.pixelSpacing, true) - .addTag('00280034', instance.pixelAspectRatio, true) - .addTag('00280100', instance.bitsAllocated) - .addTag('00280101', instance.bitsStored) - .addTag('00280102', instance.highBit) - .addTag('00280103', instance.pixelRepresentation) - .addTag('00280106', instance.smallestPixelValue) - .addTag('00280107', instance.largestPixelValue) - .addTag('00281050', instance.windowCenter, true) - .addTag('00281051', instance.windowWidth, true) - .addTag('00281052', instance.rescaleIntercept) - .addTag('00281053', instance.rescaleSlope) - .addTag('00281054', instance.rescaleType) - .addTag('00281101', instance.redPaletteColorLookupTableDescriptor) - .addTag('00281102', instance.greenPaletteColorLookupTableDescriptor) - .addTag('00281103', instance.bluePaletteColorLookupTableDescriptor) - .addTag('00281201', instance.redPaletteColorLookupTableData) - .addTag('00281202', instance.greenPaletteColorLookupTableData) - .addTag('00281203', instance.bluePaletteColorLookupTableData) - .addTag('00540016', getRadiopharmaceuticalInfoMetaData(instance)) - .toJSON(); -}; - -export function updateMetaDataManager(study) { - study.seriesList.forEach(series => { - series.instances.forEach(instance => { - // Cache just images that are going to be loaded via WADO-RS - if ((instance.imageRendering !== 'wadors') && (instance.thumbnailRendering !== 'wadors')) { - return; - } - - const metaData = getWadoRsInstanceMetaData(study, series, instance); - const numberOfFrames = instance.numberOfFrames || 1; - - // We can share the same metaData with all frames because it doesn't have - // any frame specific data, such as frameNumber, pixelData, offset, etc. - // WADO-RS frame number is 1-based - for (let frameNumber = 0; frameNumber < numberOfFrames; frameNumber++) { - const imageId = getWADORSImageId(instance, frameNumber); - cornerstoneWADOImageLoader.wadors.metaDataManager.add(imageId, metaData); - } - }); - }); -} diff --git a/Packages/ohif-viewerbase/client/lib/updateOrientationMarkers.js b/Packages/ohif-viewerbase/client/lib/updateOrientationMarkers.js deleted file mode 100644 index 9cd14a2d6..000000000 --- a/Packages/ohif-viewerbase/client/lib/updateOrientationMarkers.js +++ /dev/null @@ -1,65 +0,0 @@ -import { $ } from 'meteor/jquery'; - -/** - * Updates the orientation labels on a Cornerstone-enabled Viewport element - * when the viewport settings change (e.g. when a horizontal flip or a rotation occurs) - * - * @param element The DOM element of the Cornerstone viewport - * optional - * @param viewport The current viewport - */ -export function updateOrientationMarkers(element, viewport) { - // Get the current viewport settings - if(!viewport) { - viewport = cornerstone.getViewport(element); - } - - // Updates the orientation labels on the viewport - const enabledElement = cornerstone.getEnabledElement(element); - const imagePlane = cornerstone.metaData.get('imagePlane', enabledElement.image.imageId); - - if (!imagePlane || !imagePlane.rowCosines || !imagePlane.columnCosines) { - return; - } - - const rowString = cornerstoneTools.orientation.getOrientationString(imagePlane.rowCosines); - const columnString = cornerstoneTools.orientation.getOrientationString(imagePlane.columnCosines); - const oppositeRowString = cornerstoneTools.orientation.invertOrientationString(rowString); - const oppositeColumnString = cornerstoneTools.orientation.invertOrientationString(columnString); - - const markers = { - top: oppositeColumnString, - left: oppositeRowString - }; - - // If any vertical or horizontal flips are applied, change the orientation strings ahead of - // the rotation applications - if (viewport.vflip) { - markers.top = cornerstoneTools.orientation.invertOrientationString(markers.top); - } - - if (viewport.hflip) { - markers.left = cornerstoneTools.orientation.invertOrientationString(markers.left); - } - - // Get the viewport orientation marker DOM elements - const viewportOrientationMarkers = $(element).siblings('.viewportOrientationMarkers'); - const topMarker = viewportOrientationMarkers.find('.topMid'); - const leftMarker = viewportOrientationMarkers.find('.leftMid'); - - // Swap the labels accordingly if the viewport has been rotated - // This could be done in a more complex way for intermediate rotation values (e.g. 45 degrees) - if (viewport.rotation === 90 || viewport.rotation === -270) { - topMarker.text(markers.left); - leftMarker.text(cornerstoneTools.orientation.invertOrientationString(markers.top)); - } else if (viewport.rotation === -90 || viewport.rotation === 270) { - topMarker.text(cornerstoneTools.orientation.invertOrientationString(markers.left)); - leftMarker.text(markers.top); - } else if (viewport.rotation === 180 || viewport.rotation === -180) { - topMarker.text(cornerstoneTools.orientation.invertOrientationString(markers.top)); - leftMarker.text(cornerstoneTools.orientation.invertOrientationString(markers.left)); - } else { - topMarker.text(markers.top); - leftMarker.text(markers.left); - } -} diff --git a/Packages/ohif-viewerbase/client/lib/viewportOverlayUtils.js b/Packages/ohif-viewerbase/client/lib/viewportOverlayUtils.js deleted file mode 100644 index 62c3a3e95..000000000 --- a/Packages/ohif-viewerbase/client/lib/viewportOverlayUtils.js +++ /dev/null @@ -1,101 +0,0 @@ -import { cornerstone } from 'meteor/ohif:cornerstone'; -import { getElementIfNotEmpty } from './getElementIfNotEmpty'; - -const getPatient = function(property) { - if (!this.imageId) { - return false; - } - - const patient = cornerstone.metaData.get('patient', this.imageId); - if (!patient) { - return ''; - } - - return patient[property]; -}; - -const getStudy = function(property) { - if (!this.imageId) { - return false; - } - - const study = cornerstone.metaData.get('study', this.imageId); - if (!study) { - return ''; - } - - return study[property]; -}; - -const getSeries = function(property) { - if (!this.imageId) { - return false; - } - - const series = cornerstone.metaData.get('series', this.imageId); - if (!series) { - return ''; - } - - return series[property]; -}; - -const getInstance = function(property) { - if (!this.imageId) { - return false; - } - - const instance = cornerstone.metaData.get('instance', this.imageId); - if (!instance) { - return ''; - } - - return instance[property]; -}; - -const getTagDisplay = function(property) { - if (!this.imageId) { - return false; - } - - const instance = cornerstone.metaData.get('tagDisplay', this.imageId); - if (!instance) { - return ''; - } - - return instance[property]; -}; - -const getImage = function(viewportIndex) { - const element = getElementIfNotEmpty(viewportIndex); - if (!element) { - return false; - } - - let enabledElement; - try { - enabledElement = cornerstone.getEnabledElement(element); - } catch(error) { - return false; - } - - if (!enabledElement || !enabledElement.image) { - return false; - } - - return enabledElement.image; -}; - -const formatDateTime = (date, time) => `${date} ${time}`; - -const viewportOverlayUtils = { - getPatient, - getStudy, - getSeries, - getInstance, - getTagDisplay, - getImage, - formatDateTime -}; - -export { viewportOverlayUtils }; diff --git a/Packages/ohif-viewerbase/client/lib/viewportUtils.js b/Packages/ohif-viewerbase/client/lib/viewportUtils.js deleted file mode 100644 index f0507925e..000000000 --- a/Packages/ohif-viewerbase/client/lib/viewportUtils.js +++ /dev/null @@ -1,413 +0,0 @@ -import { Session } from 'meteor/session'; -import { Random } from 'meteor/random'; -import { $ } from 'meteor/jquery'; -import { _ } from 'meteor/underscore'; -// Local Modules -import { OHIF } from 'meteor/ohif:core'; -import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone'; -import { updateOrientationMarkers } from './updateOrientationMarkers'; -import { getInstanceClassDefaultViewport } from './instanceClassSpecificViewport'; - -/** - * Get a cornerstone enabledElement for a DOM Element - * @param {DOMElement} element Element to get the enabledElement from Cornerstone - * @return {Object} Cornerstone's enabledElement object for the given - * element or undefined if the element is not enabled - */ -const getEnabledElement = element => { - let enabledElement; - - try { - enabledElement = cornerstone.getEnabledElement(element); - } catch(error) { - OHIF.log.warn(error); - } - - return enabledElement; -}; - -/** - * Get the active viewport element. It uses activeViewport Session Variable - * @return {DOMElement} DOMElement of the current active viewport - */ -const getActiveViewportElement = () => { - const viewportIndex = Session.get('activeViewport') || 0; - return $('.imageViewerViewport').get(viewportIndex); -}; - -/** - * Get a cornerstone enabledElement for the Active Viewport Element - * @return {Object} Cornerstone's enabledElement object for the active - * viewport element or undefined if the element - * is not enabled - */ -const getEnabledElementForActiveElement = () => { - const activeViewportElement = getActiveViewportElement(); - const enabledElement = getEnabledElement(activeViewportElement); - - return enabledElement; -}; - -const zoomIn = () => { - const element = getActiveViewportElement(); - if (!element) { - return; - } - - const viewport = cornerstone.getViewport(element); - const scaleIncrement = 0.15; - const maximumScale = 10; - viewport.scale = Math.min(viewport.scale + scaleIncrement, maximumScale); - cornerstone.setViewport(element, viewport); -}; - -const zoomOut = () => { - const element = getActiveViewportElement(); - if (!element) { - return; - } - - const viewport = cornerstone.getViewport(element); - const scaleIncrement = 0.15; - const minimumScale = 0.05; - viewport.scale = Math.max(viewport.scale - scaleIncrement, minimumScale); - cornerstone.setViewport(element, viewport); -}; - -const zoomToFit = () => { - const element = getActiveViewportElement(); - if (!element) { - return; - } - - cornerstone.fitToWindow(element); -}; - -const rotateL = () => { - const element = getActiveViewportElement(); - if (!element) { - return; - } - - const viewport = cornerstone.getViewport(element); - viewport.rotation -= 90; - cornerstone.setViewport(element, viewport); - updateOrientationMarkers(element, viewport); -}; - -const rotateR = () => { - const element = getActiveViewportElement(); - if (!element) { - return; - } - - const viewport = cornerstone.getViewport(element); - viewport.rotation += 90; - cornerstone.setViewport(element, viewport); - updateOrientationMarkers(element, viewport); -}; - -const invert = () => { - const element = getActiveViewportElement(); - if (!element) { - return; - } - - const viewport = cornerstone.getViewport(element); - viewport.invert = (viewport.invert === false); - cornerstone.setViewport(element, viewport); -}; - -const flipV = () => { - const element = getActiveViewportElement(); - const viewport = cornerstone.getViewport(element); - viewport.vflip = (viewport.vflip === false); - cornerstone.setViewport(element, viewport); - updateOrientationMarkers(element, viewport); -}; - -const flipH = () => { - const element = getActiveViewportElement(); - const viewport = cornerstone.getViewport(element); - viewport.hflip = (viewport.hflip === false); - cornerstone.setViewport(element, viewport); - updateOrientationMarkers(element, viewport); -}; - -const resetViewportWithElement = element => { - const enabledElement = cornerstone.getEnabledElement(element); - if (enabledElement.fitToWindow === false) { - const imageId = enabledElement.image.imageId; - const instance = cornerstone.metaData.get('instance', imageId); - - enabledElement.viewport = cornerstone.getDefaultViewport(enabledElement.canvas, enabledElement.image); - - const instanceClassDefaultViewport = getInstanceClassDefaultViewport(instance, enabledElement, imageId); - cornerstone.setViewport(element, instanceClassDefaultViewport); - } else { - cornerstone.reset(element); - } -}; - -const resetViewport = (viewportIndex=null) => { - if (viewportIndex === null) { - resetViewportWithElement(getActiveViewportElement()); - } else if (viewportIndex === 'all') { - $('.imageViewerViewport').each((index, element) => { - resetViewportWithElement(element); - }); - } else { - resetViewportWithElement($('.imageViewerViewport').get(viewportIndex)); - } -}; - -const clearTools = () => { - const element = getActiveViewportElement(); - const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager; - toolStateManager.clear(element); - cornerstone.updateImage(element); -}; -const hideTools = () => { - const element = getActiveViewportElement(); - const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager; - toolStateManager.hide(element); - cornerstone.updateImage(element); -}; -const unhideTools = () => { - const element = getActiveViewportElement(); - const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager; - toolStateManager.unhide(element); - cornerstone.updateImage(element); -}; - -const linkStackScroll = () => { - const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer; - - if (!synchronizer) { return; } - - if (synchronizer.isActive()) { - synchronizer.deactivate(); - } else { - synchronizer.activate(); - } -}; - -// This function was originally defined alone inside client/lib/toggleDialog.js -// and has been moved here to avoid circular dependency issues. -const toggleDialog = (element, closeAction) => { - const $element = $(element); - if ($element.is('dialog')) { - if (element.hasAttribute('open')) { - if (closeAction) { - closeAction(); - } - - element.close(); - } else { - element.show(); - } - } else { - const isClosed = $element.hasClass('dialog-open'); - $element.toggleClass('dialog-closed', isClosed); - $element.toggleClass('dialog-open', !isClosed); - } -}; - -// Toggle the play/stop state for the cornerstone clip tool -const toggleCinePlay = () => { - // Get the active viewport element - const element = getActiveViewportElement(); - - // Check if it's playing the clip to toggle it - if (isPlaying()) { - cornerstoneTools.stopClip(element); - } else { - cornerstoneTools.playClip(element); - } - - // Update the UpdateCINE session property - Session.set('UpdateCINE', Math.random()); -}; - -// Show/hide the CINE dialog -const toggleCineDialog = () => { - const dialog = document.getElementById('cineDialog'); - - toggleDialog(dialog, stopAllClips); - Session.set('UpdateCINE', Random.id()); -}; - -const toggleDownloadDialog = () => { - stopActiveClip(); - const $dialog = $('#imageDownloadDialog'); - if ($dialog.length) { - $dialog.find('.close:first').click(); - } else { - OHIF.ui.showDialog('imageDownloadDialog'); - } -}; - -const isDownloadEnabled = () => { - const activeViewport = getActiveViewportElement(); - - return activeViewport ? true : false; -}; - -// Check if the clip is playing on the active viewport -const isPlaying = () => { - // Create a dependency on LayoutManagerUpdated and UpdateCINE session - Session.get('UpdateCINE'); - Session.get('LayoutManagerUpdated'); - - // Get the viewport element and its current playClip tool state - const element = getActiveViewportElement(); - // Empty Elements throws cornerstore exception - if (!element || !$(element).find('canvas').length) { - return; - } - - const toolState = cornerstoneTools.getToolState(element, 'playClip'); - - // Stop here if the tool state is not defined yet - if (!toolState) { - return false; - } - - // Get the clip state - const clipState = toolState.data[0]; - - if (clipState) { - // Return true if the clip is playing - return !_.isUndefined(clipState.intervalId); - } - - return false; -}; - -// Check if a study has multiple frames -const hasMultipleFrames = () => { - // Its called everytime active viewport and/or layout change - Session.get('activeViewport'); - Session.get('LayoutManagerUpdated'); - - const activeViewport = getActiveViewportElement(); - - // No active viewport yet: disable button - if (!activeViewport || !$(activeViewport).find('canvas').length) { - return true; - } - - // Get images in the stack - const stackToolData = cornerstoneTools.getToolState(activeViewport, 'stack'); - - // No images in the stack, so disable button - if (!stackToolData || !stackToolData.data || !stackToolData.data.length) { - return true; - } - - // Get number of images in the stack - const stackData = stackToolData.data[0]; - const nImages = stackData.imageIds && stackData.imageIds.length ? stackData.imageIds.length : 1; - - // Stack has just one image, so disable button - if (nImages === 1) { - return true; - } - - return false; -}; - -// Stop clips on all non-empty elements -const stopAllClips = () => { - const elements = $('.imageViewerViewport').not('.empty'); - elements.each((index, element) => { - if ($(element).find('canvas').length) { - cornerstoneTools.stopClip(element); - } - }); -}; - -const stopActiveClip = () => { - const activeElement = getActiveViewportElement(); - - if ($(activeElement).find('canvas').length) { - cornerstoneTools.stopClip(activeElement); - } -}; - -const isStackScrollLinkingDisabled = () => { - let linkableViewportsCount = 0; - - // Its called everytime active viewport and/or layout change - Session.get('activeViewport'); - Session.get('LayoutManagerUpdated'); - - const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer; - if (synchronizer) { - const linkableViewports = synchronizer.getLinkableViewports(); - linkableViewportsCount = linkableViewports.length; - } - - return linkableViewportsCount <= 1; -}; - -const isStackScrollLinkingActive = () => { - let isActive = true; - - // Its called everytime active viewport layout changes - Session.get('LayoutManagerUpdated'); - - const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer; - - if (!synchronizer) { return; } - - const syncedElements = _.pluck(synchronizer.syncedViewports, 'element'); - const $renderedViewports = $('.imageViewerViewport'); - $renderedViewports.each((index, element) => { - if (!_.contains(syncedElements, element)) { - isActive = false; - } - }); - - return isActive; -}; - -// Create an event listener to update playing state when a clip stops playing -window.addEventListener('cornerstonetoolsclipstopped', () => { - Session.set('UpdateCINE', Math.random()); -}); - -/** - * Export functions inside viewportUtils namespace. - */ - -const viewportUtils = { - getEnabledElementForActiveElement, - getEnabledElement, - getActiveViewportElement, - zoomIn, - zoomOut, - zoomToFit, - rotateL, - rotateR, - invert, - flipV, - flipH, - resetViewport, - clearTools, - hideTools, - unhideTools, - linkStackScroll, - toggleDialog, - toggleCinePlay, - toggleCineDialog, - toggleDownloadDialog, - isPlaying, - isDownloadEnabled, - hasMultipleFrames, - stopAllClips, - isStackScrollLinkingDisabled, - isStackScrollLinkingActive -}; - -export { viewportUtils }; diff --git a/Packages/ohif-viewerbase/main.js b/Packages/ohif-viewerbase/main.js deleted file mode 100644 index 1d43f543d..000000000 --- a/Packages/ohif-viewerbase/main.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Import namespace... - */ - -import { OHIF, Viewerbase } from './namespace.js'; - -/** - * Import scripts that will populate the Viewerbase namespace as a side effect only import. This is effectively the public API... - */ - -import './client/'; // which is actually: import './client/index.js'; - -/** - * Export relevant objects... - * - * With the following export it becomes possible to import "OHIF" from "ohif:core" and "Viewerbase" - * from "ohif:viewerbase" using a single import (a shorthand), like this: - * - * import { OHIF } from 'meteor/ohif:viewerbase'; - * - * Which is equivalent to: - * - * import { OHIF } from 'meteor/ohif:core'; - * import 'meteor/ohif:viewerbase'; - * - * The second (extended) format should be used when other OHIF packages are also to be used within - * the current module. This makes it explicit that the following imports will populate their - * respective namespaces within the to "OHIF" namespace. Example: - * - * import { OHIF } from 'meteor/ohif:core'; - * import 'meteor/ohif:viewerbase'; - * import 'meteor/ohif:hanging-protocols'; - * [ ... ] - * OHIF.viewerbase.setActiveViewport(...); - * OHIF.hangingprotocols.doSomething(...); - * - */ - -export { OHIF, Viewerbase }; diff --git a/Packages/ohif-viewerbase/namespace.js b/Packages/ohif-viewerbase/namespace.js deleted file mode 100644 index 21e3568a0..000000000 --- a/Packages/ohif-viewerbase/namespace.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Import main dependency - */ - -import { OHIF } from 'meteor/ohif:core'; - -/** - * Create Viewerbase namespace - */ - -const Viewerbase = {}; - -/** - * Append Viewerbase namespace to OHIF namespace - */ - -OHIF.viewerbase = Viewerbase; - -/** - * Export relevant objects - */ - -export { OHIF, Viewerbase }; diff --git a/Packages/ohif-viewerbase/package.js b/Packages/ohif-viewerbase/package.js deleted file mode 100644 index 82e4dbc5b..000000000 --- a/Packages/ohif-viewerbase/package.js +++ /dev/null @@ -1,263 +0,0 @@ -Package.describe({ - name: 'ohif:viewerbase', - summary: 'Shared components and functions for Meteor DICOM Viewers', - version: '0.0.1' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use(['ecmascript', - 'standard-app-packages', - 'http', - 'jquery', - 'stylus', - 'momentjs:moment', - 'cultofcoders:persistent-session' - ]); - - // OHIF dependencies - api.use([ - 'ohif:design', - 'ohif:cornerstone', - 'ohif:core', - 'ohif:cornerstone-settings', - 'ohif:hotkeys', - 'ohif:log' - ]); - - const assets = [ - 'assets/icons.svg', - 'assets/user-menu-icons.svg', - 'assets/fonts/Roboto-Black-latin-ext.woff', - 'assets/fonts/Roboto-Black-latin-ext.woff2', - 'assets/fonts/Roboto-Black-latin.woff', - 'assets/fonts/Roboto-Black-latin.woff2', - 'assets/fonts/Roboto-BlackItalic-latin-ext.woff', - 'assets/fonts/Roboto-BlackItalic-latin-ext.woff2', - 'assets/fonts/Roboto-BlackItalic-latin.woff', - 'assets/fonts/Roboto-BlackItalic-latin.woff2', - 'assets/fonts/Roboto-Bold-latin-ext.woff', - 'assets/fonts/Roboto-Bold-latin-ext.woff2', - 'assets/fonts/Roboto-Bold-latin.woff', - 'assets/fonts/Roboto-Bold-latin.woff2', - 'assets/fonts/Roboto-BoldItalic-latin-ext.woff', - 'assets/fonts/Roboto-BoldItalic-latin-ext.woff2', - 'assets/fonts/Roboto-BoldItalic-latin.woff', - 'assets/fonts/Roboto-BoldItalic-latin.woff2', - 'assets/fonts/Roboto-Italic-latin-ext.woff', - 'assets/fonts/Roboto-Italic-latin-ext.woff2', - 'assets/fonts/Roboto-Italic-latin.woff', - 'assets/fonts/Roboto-Italic-latin.woff2', - 'assets/fonts/Roboto-Light-latin-ext.woff', - 'assets/fonts/Roboto-Light-latin-ext.woff2', - 'assets/fonts/Roboto-Light-latin.woff', - 'assets/fonts/Roboto-Light-latin.woff2', - 'assets/fonts/Roboto-LightItalic-latin-ext.woff', - 'assets/fonts/Roboto-LightItalic-latin-ext.woff2', - 'assets/fonts/Roboto-LightItalic-latin.woff', - 'assets/fonts/Roboto-LightItalic-latin.woff2', - 'assets/fonts/Roboto-Medium-latin-ext.woff', - 'assets/fonts/Roboto-Medium-latin-ext.woff2', - 'assets/fonts/Roboto-Medium-latin.woff', - 'assets/fonts/Roboto-Medium-latin.woff2', - 'assets/fonts/Roboto-MediumItalic-latin-ext.woff', - 'assets/fonts/Roboto-MediumItalic-latin-ext.woff2', - 'assets/fonts/Roboto-MediumItalic-latin.woff', - 'assets/fonts/Roboto-MediumItalic-latin.woff2', - 'assets/fonts/Roboto-Regular-latin-ext.woff', - 'assets/fonts/Roboto-Regular-latin-ext.woff2', - 'assets/fonts/Roboto-Regular-latin.woff', - 'assets/fonts/Roboto-Regular-latin.woff2', - 'assets/fonts/Roboto-Thin-latin-ext.woff', - 'assets/fonts/Roboto-Thin-latin-ext.woff2', - 'assets/fonts/Roboto-Thin-latin.woff', - 'assets/fonts/Roboto-Thin-latin.woff2', - 'assets/fonts/Roboto-ThinItalic-latin-ext.woff', - 'assets/fonts/Roboto-ThinItalic-latin-ext.woff2', - 'assets/fonts/Roboto-ThinItalic-latin.woff', - 'assets/fonts/Roboto-ThinItalic-latin.woff2', - 'assets/fonts/Sanchez-Regular-latin-ext.woff', - 'assets/fonts/Sanchez-Regular-latin-ext.woff2', - 'assets/fonts/Sanchez-Regular-latin.woff', - 'assets/fonts/Sanchez-Regular-latin.woff2' - ]; - - api.addAssets(assets, 'client'); - - api.addFiles('client/compatibility/dialogPolyfill.js', 'client', { - bare: true - }); - api.addFiles('client/compatibility/dialogPolyfill.styl', 'client'); - - // ---------- Components ---------- - - // Basic components - api.addFiles('client/components/basic/layout/layout.html', 'client'); - api.addFiles('client/components/basic/layout/layout.styl', 'client'); - api.addFiles('client/components/basic/loadingText/loadingText.html', 'client'); - api.addFiles('client/components/basic/loadingText/loadingText.styl', 'client'); - api.addFiles('client/components/basic/errorText/errorText.html', 'client'); - api.addFiles('client/components/basic/errorText/errorText.styl', 'client'); - - api.addFiles('client/components/basic/removableBackdrop/removableBackdrop.html', 'client'); - api.addFiles('client/components/basic/removableBackdrop/removableBackdrop.styl', 'client'); - - api.addFiles('client/components/basic/aboutModal/aboutModal.html', 'client'); - api.addFiles('client/components/basic/aboutModal/aboutModal.js', 'client'); - api.addFiles('client/components/basic/aboutModal/aboutModal.styl', 'client'); - - // Study Browser components - api.addFiles('client/components/studyBrowser/studyBrowser/studyBrowser.html', 'client'); - api.addFiles('client/components/studyBrowser/studyBrowser/studyBrowser.js', 'client'); - api.addFiles('client/components/studyBrowser/studyBrowser/studyBrowser.styl', 'client'); - - api.addFiles('client/components/studyBrowser/thumbnailEntry/thumbnailEntry.html', 'client'); - api.addFiles('client/components/studyBrowser/thumbnailEntry/thumbnailEntry.js', 'client'); - api.addFiles('client/components/studyBrowser/thumbnailEntry/thumbnailEntry.styl', 'client'); - - api.addFiles('client/components/studyBrowser/imageThumbnail/imageThumbnail.html', 'client'); - api.addFiles('client/components/studyBrowser/imageThumbnail/imageThumbnail.js', 'client'); - api.addFiles('client/components/studyBrowser/imageThumbnail/imageThumbnail.styl', 'client'); - - // Viewer components - api.addFiles('client/components/viewer/imageViewerViewport/imageViewerViewport.html', 'client'); - api.addFiles('client/components/viewer/imageViewerViewport/imageViewerViewport.js', 'client'); - api.addFiles('client/components/viewer/imageViewerViewport/imageViewerViewport.styl', 'client'); - - api.addFiles('client/components/viewer/gridLayout/gridLayout.html', 'client'); - api.addFiles('client/components/viewer/gridLayout/gridLayout.js', 'client'); - api.addFiles('client/components/viewer/gridLayout/gridLayout.styl', 'client'); - - api.addFiles('client/components/viewer/loadingIndicator/loadingIndicator.html', 'client'); - api.addFiles('client/components/viewer/loadingIndicator/loadingIndicator.js', 'client'); - api.addFiles('client/components/viewer/loadingIndicator/loadingIndicator.styl', 'client'); - - api.addFiles('client/components/viewer/annotationDialogs/annotationDialogs.html', 'client'); - api.addFiles('client/components/viewer/annotationDialogs/annotationDialogs.js', 'client'); - api.addFiles('client/components/viewer/annotationDialogs/annotationDialogs.styl', 'client'); - - api.addFiles('client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.html', 'client'); - api.addFiles('client/components/viewer/viewportOrientationMarkers/viewportOrientationMarkers.styl', 'client'); - - api.addFiles('client/components/viewer/viewportOverlay/viewportOverlay.html', 'client'); - api.addFiles('client/components/viewer/viewportOverlay/viewportOverlay.js', 'client'); - api.addFiles('client/components/viewer/viewportOverlay/viewportOverlay.styl', 'client'); - - api.addFiles('client/components/viewer/viewerMain/viewerMain.html', 'client'); - api.addFiles('client/components/viewer/viewerMain/viewerMain.js', 'client'); - api.addFiles('client/components/viewer/viewerMain/viewerMain.styl', 'client'); - - api.addFiles('client/components/viewer/toolContextMenu/toolContextMenu.js', 'client'); - - api.addFiles('client/components/viewer/imageControls/imageControls.html', 'client'); - api.addFiles('client/components/viewer/imageControls/imageControls.js', 'client'); - api.addFiles('client/components/viewer/imageControls/imageControls.styl', 'client'); - - api.addFiles('client/components/viewer/layoutButton/layoutButton.html', 'client'); - api.addFiles('client/components/viewer/layoutButton/layoutButton.js', 'client'); - - api.addFiles('client/components/viewer/layoutChooser/layoutChooser.html', 'client'); - api.addFiles('client/components/viewer/layoutChooser/layoutChooser.js', 'client'); - api.addFiles('client/components/viewer/layoutChooser/layoutChooser.styl', 'client'); - - api.addFiles('client/components/viewer/cineDialog/cineDialog.html', 'client'); - api.addFiles('client/components/viewer/cineDialog/cineDialog.js', 'client'); - api.addFiles('client/components/viewer/cineDialog/cineDialog.styl', 'client'); - - api.addFiles('client/components/viewer/downloadDialog/downloadDialog.html', 'client'); - api.addFiles('client/components/viewer/downloadDialog/downloadDialog.js', 'client'); - api.addFiles('client/components/viewer/downloadDialog/downloadDialog.styl', 'client'); - - api.addFiles('client/components/viewer/toolbarSectionButton/toolbarSectionButton.html', 'client'); - api.addFiles('client/components/viewer/toolbarSectionButton/toolbarSectionButton.js', 'client'); - api.addFiles('client/components/viewer/toolbarSectionButton/toolbarSectionButton.styl', 'client'); - - api.addFiles('client/components/viewer/toolbarSectionTools/toolbarSectionTools.html', 'client'); - api.addFiles('client/components/viewer/toolbarSectionTools/toolbarSectionTools.js', 'client'); - api.addFiles('client/components/viewer/toolbarSectionTools/toolbarSectionTools.styl', 'client'); - - api.addFiles('client/components/viewer/userPreferences/dialog.html', 'client'); - api.addFiles('client/components/viewer/userPreferences/dialog.js', 'client'); - api.addFiles('client/components/viewer/userPreferences/dialog.styl', 'client'); - - api.addFiles('client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.html', 'client'); - api.addFiles('client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.js', 'client'); - api.addFiles('client/components/viewer/confirmDeleteDialog/confirmDeleteDialog.styl', 'client'); - - api.addFiles('client/components/viewer/textMarkerDialogs/textMarkerDialogs.html', 'client'); - api.addFiles('client/components/viewer/textMarkerDialogs/textMarkerDialogs.js', 'client'); - api.addFiles('client/components/viewer/textMarkerDialogs/textMarkerDialogs.styl', 'client'); - - api.addFiles('client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.html', 'client'); - api.addFiles('client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.styl', 'client'); - api.addFiles('client/components/viewer/seriesQuickSwitch/seriesQuickSwitch.js', 'client'); - - api.addFiles('client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.html', 'client'); - api.addFiles('client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.styl', 'client'); - api.addFiles('client/components/viewer/studySeriesQuickSwitch/studySeriesQuickSwitch.js', 'client'); - - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepoint.html', 'client'); - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepoint.styl', 'client'); - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepoint.js', 'client'); - - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.html', 'client'); - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.styl', 'client'); - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepointBrowser.js', 'client'); - - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepointStudy.html', 'client'); - api.addFiles('client/components/viewer/studyTimepointBrowser/studyTimepointStudy.js', 'client'); - - api.addFiles('client/components/viewer/windowLevelPresets/form.html', 'client'); - api.addFiles('client/components/viewer/windowLevelPresets/form.js', 'client'); - - api.export('dialogPolyfill', 'client'); - - api.mainModule('main.js', 'client'); - -}); - -Package.onTest(function(api) { - api.versionsFrom('1.7'); - - /* - * Really important dependencies to the project - */ - api.use(['ecmascript', - 'standard-app-packages', - 'http', - 'jquery', - 'mongo', - 'momentjs:moment', - 'cultofcoders:persistent-session' - ], 'client'); - - // OHIF dependencies - api.use([ - 'lookback:logger', - 'aldeed:simple-schema@1.5.3', - 'ohif:design', - 'ohif:core', - 'ohif:hotkeys', - 'ohif:log' - ], 'client'); - - /* - * Our custom packages - */ - api.use('ohif:viewerbase', 'client'); - - /* - * Tests framework components - */ - api.use('cultofcoders:mocha'); - api.use('practicalmeteor:sinon'); - api.use('practicalmeteor:chai'); - api.use('lmieulet:meteor-coverage@1.1.4'); - api.use('xolvio:template-isolator'); - - /* - * Adding all our tests files - */ - api.addFiles('./tests/client/components/viewer/gridLayout/gridLayout.tests.js', 'client'); -}); diff --git a/Packages/ohif-viewerbase/tests/client/components/viewer/gridLayout/gridLayout.tests.js b/Packages/ohif-viewerbase/tests/client/components/viewer/gridLayout/gridLayout.tests.js deleted file mode 100644 index 047df3c52..000000000 --- a/Packages/ohif-viewerbase/tests/client/components/viewer/gridLayout/gridLayout.tests.js +++ /dev/null @@ -1,77 +0,0 @@ -import { Template } from 'meteor/templating'; -import '../../../../../client/components/viewer/gridLayout/gridLayout.html'; -import '../../../../../client/components/viewer/gridLayout/gridLayout.js'; -import { Session } from 'meteor/session'; -import { sinon } from 'meteor/practicalmeteor:sinon'; -chai.should(); - -describe('GridLayout', function() { - describe('Helpers', function() { - before(function() { - Template.instance = function() { - return { - data: { - rows: 2, - columns: 2, - viewportData: [] - } - } - } - }); - - it('should get the height percentage of each viewport', function() { - const percentage = Template.gridLayout.__helpers[' height'](); - - percentage.should.be.eq(50); - }); - - it('should get the width percentage of each viewport', function() { - const percentage = Template.gridLayout.__helpers[' height'](); - - percentage.should.be.eq(50); - }); - }) - - after(function() { - Meteor.sendCoverage(function() { }); - }); - - // describe('Testing getClass() Helper', function () { - // it('should return priorDropdown', function () { - // Session.set('isPrior', true); - // Template.priorDropdown.__helpers.get('getClass')() - // .should.equal('priorDropdown'); - // }); - - // it('should return empty string', function () { - // Session.set('isPrior', false); - // Template.priorDropdown.__helpers.get('getClass')() - // .should.equal(''); - // }); - // }); - - // describe('Testing dropdown change event', function () { - - // let openPriorStudyWindowStub; - // let test; - - // before(function () { - - // Template.instance = function () { return { openPriorStudyWindow: sinon.spy() } }; - - // $.fn.select2 = function () { - // return [{ - // selectedIndex: 0, - // options: [{ - // text: 'Attrial Septum' - // }] - // }] - // }; - // }); - - // it('should return priorDropdown', function () { - // Template.priorDropdown.fireEvent('change #studySelect'); - // // TODO: spy is not working - // }); - // }); -}); \ No newline at end of file diff --git a/Packages/ohif-viewerbase/tests/coverage/exportCoverageReport.js b/Packages/ohif-viewerbase/tests/coverage/exportCoverageReport.js deleted file mode 100644 index ef72d2199..000000000 --- a/Packages/ohif-viewerbase/tests/coverage/exportCoverageReport.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { chai } from 'meteor/practicalmeteor:chai'; -import ReportService from 'meteor/lmieulet:meteor-coverage' - -chai.should(); - -describe('Exporting coverage report', function() { - it('Generating coverage report', function() { }); - - after(function() { - const reportService = new ReportService.ReportService(); - const mockRes = { end: () => { }, writeHead: () => { } }; - - // The possible reports - // Check https://github.com/serut/meteor-coverage - reportService.generateReport(mockRes, 'text-summary', {}); - reportService.generateReport(mockRes, 'html', {}); - reportService.generateReport(mockRes, 'json-summary', {}); - reportService.generateReport(mockRes, 'lcovonly', {}); - }); -}); \ No newline at end of file diff --git a/Packages/ohif-wadoproxy/both/convertURL.js b/Packages/ohif-wadoproxy/both/convertURL.js deleted file mode 100644 index 50e105da1..000000000 --- a/Packages/ohif-wadoproxy/both/convertURL.js +++ /dev/null @@ -1,22 +0,0 @@ -import queryString from 'query-string'; - -WADOProxy.convertURL = (url, serverConfiguration) => { - if (!url) { - return null; - } - - if (serverConfiguration.requestOptions && - serverConfiguration.requestOptions.requestFromBrowser === true) { - return url; - } - - const { settings } = WADOProxy; - if (!settings.enabled) { - return url; - } - - const serverId = serverConfiguration._id; - const query = queryString.stringify({url, serverId}); - - return `${settings.uri}?${query}`; -} diff --git a/Packages/ohif-wadoproxy/both/initialize.js b/Packages/ohif-wadoproxy/both/initialize.js deleted file mode 100755 index 3ff419f95..000000000 --- a/Packages/ohif-wadoproxy/both/initialize.js +++ /dev/null @@ -1,6 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; - -WADOProxy.settings = Object.assign({ - uri : OHIF.utils.absoluteUrl("/__wado_proxy"), -}, (Meteor.settings && Meteor.settings.proxy) ? Meteor.settings.proxy : {}); diff --git a/Packages/ohif-wadoproxy/both/namespace.js b/Packages/ohif-wadoproxy/both/namespace.js deleted file mode 100755 index 88b012705..000000000 --- a/Packages/ohif-wadoproxy/both/namespace.js +++ /dev/null @@ -1 +0,0 @@ -WADOProxy = {}; diff --git a/Packages/ohif-wadoproxy/package.js b/Packages/ohif-wadoproxy/package.js deleted file mode 100755 index 26e9fa51a..000000000 --- a/Packages/ohif-wadoproxy/package.js +++ /dev/null @@ -1,28 +0,0 @@ -Package.describe({ - name: 'ohif:wadoproxy', - summary: 'WADO-URI Proxy', - version: '0.0.1' -}); - -Npm.depends({ - 'query-string': '5.1.1', - 'performance-now': '2.1.0' -}); - -Package.onUse(function(api) { - api.versionsFrom('1.7'); - - api.use('ecmascript'); - api.use('clinical:router@2.0.19'); - - api.use('ohif:core'); - api.use('ohif:servers'); - - api.addFiles('both/namespace.js', ['client', 'server']); - api.addFiles('both/convertURL.js', ['client', 'server']); - api.addFiles('both/initialize.js', ['client', 'server']); - api.addFiles('server/routes.js', 'server'); - - // Global exports - api.export('WADOProxy'); -}); diff --git a/Packages/ohif-wadoproxy/server/routes.js b/Packages/ohif-wadoproxy/server/routes.js deleted file mode 100755 index 0e91e9dfb..000000000 --- a/Packages/ohif-wadoproxy/server/routes.js +++ /dev/null @@ -1,166 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Router } from 'meteor/clinical:router'; -import { OHIF } from 'meteor/ohif:core'; -import { Servers } from 'meteor/ohif:servers/both/collections'; - -const url = require('url'); -const http = require('http'); -const https = require('https'); -const now = require('performance-now'); - -// The WADO Proxy can perform user authentication if desired. -// In order to use this, create a function to override -// OHIF.user.authenticateUser(request), which returns a Boolean. -let doAuth = false; -let authenticateUser = null; - -if (OHIF.user && - OHIF.user.authenticateUser) { - doAuth = true; - authenticateUser = OHIF.user.authenticateUser; -} - -const handleRequest = function() { - const request = this.request; - const response = this.response; - const params = this.params; - - let start = now(); - let user; - if (doAuth) { - user = authenticateUser(request); - if (!user) { - response.writeHead(401); - response.end('Error: You must be logged in to perform this action.\n'); - return; - } - } - - let end = now(); - const authenticationTime = end - start; - - start = now(); - - const server = Servers.findOne(params.query.serverId); - if (!server) { - response.writeHead(500); - response.end('Error: No Server with the specified Server ID was found.\n'); - return; - } - - const requestOpt = server.requestOptions; - - // If no Web Access to DICOM Objects (WADO) Service URL is provided - // return an error for the request. - const wadoUrl = params.query.url; - if (!wadoUrl) { - response.writeHead(500); - response.end('Error: No WADO URL was provided.\n'); - return; - } - - if (requestOpt.logRequests) { - console.log(request.url); - } - - start = now(); - if (requestOpt.logTiming) { - console.time(request.url); - } - - // Use Node's URL parse to decode the query URL - const parsed = url.parse(wadoUrl); - - // Create an object to hold the information required - // for the request to the PACS. - let options = { - headers: {}, - method: request.method, - hostname: parsed.hostname, - path: parsed.path - }; - - let requester; - if (parsed.protocol === 'https:') { - requester = https.request; - - const allowUnauthorizedAgent = new https.Agent({ rejectUnauthorized: false }); - options.agent = allowUnauthorizedAgent; - } else { - requester = http.request; - } - - if (parsed.port) { - options.port = parsed.port; - } - - Object.keys(request.headers).forEach(entry => { - const value = request.headers[entry]; - if (entry) { - options.headers[entry] = value; - } - }); - - // Retrieve the authorization user:password string for the PACS, - // if one is required, and include it in the request to the PACS. - if (requestOpt.auth) { - options.auth = requestOpt.auth; - } - - end = now(); - const prepRequestTime = end - start; - - // Use Node's HTTP API to send a request to the PACS - const proxyRequest = requester(options, proxyResponse => { - // When we receive data from the PACS, stream it as the - // response to the original request. - // console.log(`Got response: ${proxyResponse.statusCode}`); - end = now(); - const proxyReqTime = end - start; - const totalProxyTime = authenticationTime + prepRequestTime + proxyReqTime; - const serverTimingHeaders = ` - auth;dur=${authenticationTime};desc="Authenticate User";, - prep-req;dur=${prepRequestTime};desc="Prepare Request Headers", - proxy-req;dur=${proxyReqTime};desc="Request to WADO server", - total-proxy;dur=${totalProxyTime};desc="Total" - `.replace(/\n/g, '') - - proxyResponse.headers['Server-Timing'] = serverTimingHeaders; - - response.writeHead(proxyResponse.statusCode, proxyResponse.headers); - - if (requestOpt.logTiming) { - console.timeEnd(request.url); - } - - return proxyResponse.pipe(response, { end: true }); - }); - - // If our request to the PACS fails, log the error message - proxyRequest.on('error', error => { - end = now(); - const proxyReqTime = end - start; - const totalProxyTime = authenticationTime + prepRequestTime + proxyReqTime; - console.timeEnd(request.url); - - const serverTimingHeaders = { - 'Server-Timing': ` - auth;dur=${authenticationTime};desc="Authenticate User";, - prep-req;dur=${prepRequestTime};desc="Prepare Request Headers", - proxy-req;dur=${proxyReqTime};desc="Request to WADO server", - total-proxy;dur=${totalProxyTime};desc="Total" - `.replace(/\n/g, '') - }; - - response.writeHead(500, serverTimingHeaders); - response.end(`Error: Problem with request to PACS: ${error.message}\n`); - }); - - // Stream the original request information into the request - // to the PACS - request.pipe(proxyRequest); -} - -// Setup a Route using Iron Router to avoid Cross-origin resource sharing -// (CORS) errors. We only handle this route on the Server. -Router.route(WADOProxy.settings.uri.replace(OHIF.utils.absoluteUrl(), ''), handleRequest, { where: 'server' }); diff --git a/README.md b/README.md index c8b295b95..a77995015 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,190 @@ -# Viewers -This repo contains the OHIF DICOM Viewer and Lesion Tracker, and various shared meteor packages. + + +
    +

    ohif-viewer

    +

    ohif-viewer is a zero-footprint medical image viewer. It is a configurable and exstensible progressive web application with out of the box support for PACS like orthanc, dcm4che, and Google's Healthcare API.

    +
    -Documentation is available here: http://docs.ohif.org/ -### Demos -[OHIF Viewer](http://viewer.ohif.org/) - A general-purpose radiology viewer with a variety of tools exposed. + -[Lesion Tracker](http://lesiontracker.ohif.org/) - A prototype viewer focused on oncology metrics. -Community ---------- +
    -Have questions? Try posting on our [google groups forum](https://groups.google.com/forum/#!forum/cornerstone-platform). +[![CircleCI][circleci-image]][circleci-url] +[![codecov][codecov-image]][codecov-url] +[![All Contributors][all-contributors-image]][contributing-url] +[![code style: prettier][prettier-image]][prettier-url] +[![semantic-release][semantic-image]][semantic-url] -### Docker usage -Following the instructions below, the docker image will listen for DICOM connections on port 4242, and for web traffic on port 8042. The default username for the web interface is `orthanc`, and the password is `orthanc`. -#### Temporary data storage -```` -docker run --rm -p 4242:4242 -p 8042:8042 jodogne/orthanc-plugins -```` +[![NPM version][npm-version-image]][npm-url] +[![NPM downloads][npm-downloads-image]][npm-url] +[![MIT License][license-image]][license-url] + + -#### Persistent data storage -1. Create a persistant data volume for Orthanc to use +## Why? - ```` - docker create --name sampledata -v /sampledata jodogne/orthanc-plugins - ```` - - **Note: On Windows, you need to use an absolute path for the data volume, like so:** - - ```` - docker create --name sampledata -v '//C/Users/erik/sampledata' jodogne/orthanc-plugins - ```` +Building a web based medical imaging viewer from scratch is time intensive, hard +to get right, and expensive. Instead of re-inventing the wheel, you can use the +OHIF Viewer as a rock solid platform to build on top of. The Viewer is a +[React][react-url] [Progressive Web Application][pwa-url] that can be embedded +in existing applications via it's [packaged source +(ohif-viewer)][ohif-viewer-url] or hosted stand-alone. The Viewer exposes +[configuration][configuration-url] and [extensions][extensions-url] to support +workflow customization and advanced functionality at common integration points. -2. Run Orthanc from Docker with the data volume attached +If you're interested in using the OHIF Viewer, but you're not sure it supports +your use case +[check out our docs](https://deploy-preview-398--ohif.netlify.com/). Still not +sure, or you would like to propose new features? Don't hesitate to +[create an issue](https://github.com/OHIF/Viewers/issues) or open a pull request +^\_^ - ```` - docker run --volumes-from sampledata -p 4242:4242 -p 8042:8042 jodogne/orthanc-plugins - ```` +## Getting Started -3. Upload your data and it will be persisted +This readme is specific to testing and developing locally. If you're more +interested in production deployment strategies, +[you can check out our documentation on publishing](https://deploy-preview-398--ohif.netlify.com/). + +Want to play around before you dig in? +[Check out our LIVE Demo](https://viewer.ohif.org/) + +### Setup + +_Requirements:_ + +- [NodeJS & NPM](https://nodejs.org/en/download/) +- [Yarn](https://yarnpkg.com/lang/en/docs/install/) + +_Steps:_ + +1. Fork this repository +2. Clone your forked repository (your `origin`) + +- `git clone git@github.com:YOUR_GITHUB_USERNAME/Viewers.git` + +3. Add `OHIF/Viewers` as a `remote` repository (the `upstream`) + +- `git remote add upstream git@github.com:OHIF/Viewers.git` + +### Developing Locally + +In your cloned repository's root folder, run: + +```js +// Restore dependencies +yarn install + +// Stands up local server to host Viewer. +// Viewer connects to our public cloud PACS by default +yarn start +``` + +For more advanced local development scenarios, like using your own locally +hosted PACS and test data, +[check out our Essential: Getting Started](https://deploy-preview-398--ohif.netlify.com/essentials/getting-started.html) +guide. + +### Contributing + +> Large portions of the Viewer's functionality are maintained in other +> repositories. To get a better understanding of the Viewer's architecture and +> "where things live", read +> [our docs on the Viewer's architecture](https://deploy-preview-398--ohif.netlify.com/advanced/architecture.html#diagram) + +It is notoriously difficult to setup multiple dependent repositories for +end-to-end testing and development. That's why we recommend writing and running +unit tests when adding and modifying features. This allows us to program in +isolation without a complex setup, and has the added benefit of producing +well-tested business logic. + +1. Clone this repository +2. Navigate to the project directory, and `yarn install` +3. To begin making changes, `yarn run dev` +4. To commit changes, run `yarn run cm` + +When creating tests, place the test file "next to" the file you're testing. +[For example](https://github.com/OHIF/Viewers/blob/react/src/index.test.js): + +```js +// File +index.js + +// Test for file +index.test.js +``` + +As you add and modify code, `jest` will watch for uncommitted changes and run +your tests, reporting the results to your terminal. Make a pull request with +your changes to `master`, and a core team member will review your work. If you +have any questions, please don't hesitate to reach out via a GitHub issue. + +## Issues + +_Looking to contribute? Look for the [Good First Issue][good-first-issue] +label._ + +### 🐛 Bugs + +Please file an issue for bugs, missing documentation, or unexpected behavior. + +[**See Bugs**][bugs] + +### 💡 Feature Requests + +Please file an issue to suggest new features. Vote on feature requests by adding +a 👍. This helps maintainers prioritize what to work on. + +[**See Feature Requests**][requests-feature] + +### ❓ Questions + +For questions related to using the library, please visit our support community, +or file an issue on GitHub. + +[Google Group][google-group] + +## License + +MIT © [OHIF](https://github.com/OHIF) + + + + + +[all-contributors-image]: https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square +[contributing-url]: https://github.com/OHIF/Viewers/blob/react/CONTRIBUTING.md +[circleci-image]: https://circleci.com/gh/OHIF/Viewers.svg?style=svg +[circleci-url]: https://circleci.com/gh/OHIF/Viewers +[codecov-image]: https://codecov.io/gh/OHIF/Viewers/branch/react/graph/badge.svg +[codecov-url]: https://codecov.io/gh/OHIF/Viewers/branch/react +[prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square +[prettier-url]: https://github.com/prettier/prettier +[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg +[semantic-url]: https://github.com/semantic-release/semantic-release + +[npm-url]: https://npmjs.org/package/ohif-viewer +[npm-downloads-image]: https://img.shields.io/npm/dm/ohif-viewer.svg?style=flat-square +[npm-version-image]: https://img.shields.io/npm/v/ohif-viewer.svg?style=flat-square +[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square +[license-url]: LICENSE + +[react-url]: https://reactjs.org/ +[pwa-url]: https://developers.google.com/web/progressive-web-apps/ +[ohif-viewer-url]: https://www.npmjs.com/package/ohif-viewer +[configuration-url]: https://deploy-preview-398--ohif.netlify.com/essentials/configuration.html +[extensions-url]: https://deploy-preview-398--ohif.netlify.com/advanced/extensions.html + +[react-viewer]: https://github.com/OHIF/Viewers/tree/react + +[bugs]: https://github.com/OHIF/Viewers/labels/bug +[requests-feature]: https://github.com/OHIF/Viewers/labels/enhancement +[good-first-issue]: https://github.com/OHIF/Viewers/labels/good%20first%20issue +[google-group]: https://groups.google.com/forum/#!forum/cornerstone-platform + diff --git a/StandaloneViewer/.gitignore b/StandaloneViewer/.gitignore deleted file mode 100644 index 049dde087..000000000 --- a/StandaloneViewer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -myOutputFolder/ \ No newline at end of file diff --git a/StandaloneViewer/SampleClientOnlyBuild/00a3252f025c3b436cda09bf88f5ead9f975d4be.js b/StandaloneViewer/SampleClientOnlyBuild/00a3252f025c3b436cda09bf88f5ead9f975d4be.js deleted file mode 100644 index 063f1cad4..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/00a3252f025c3b436cda09bf88f5ead9f975d4be.js +++ /dev/null @@ -1,224 +0,0 @@ -!function(){var t,e,n;(function(){t=this}).call(this),function(){e=__meteor_runtime_config__.meteorEnv,n={isProduction:"production"===e.NODE_ENV,isDevelopment:"production"!==e.NODE_ENV,isClient:!0,isServer:!1,isCordova:!1},"object"==typeof __meteor_runtime_config__&&__meteor_runtime_config__.PUBLIC_SETTINGS&&(n.settings={public:__meteor_runtime_config__.PUBLIC_SETTINGS})}.call(this),function(){function t(t){if(t)return n._debug("Exception in callback of async function",t.stack?t.stack:t)}if(n.isServer)var e=Npm.require("fibers/future");"object"==typeof __meteor_runtime_config__&&__meteor_runtime_config__.meteorRelease&&(n.release=__meteor_runtime_config__.meteorRelease),n._get=function(t){for(var e=1;e=0;r--){var o=arguments[r+1];if(n)n=!1;else for(var i in e[r][o])return;delete e[r][o]}},n.wrapAsync=function(r,o){return function(){for(var i=o||this,a=Array.prototype.slice.call(arguments),s,u=a.length-1;u>=0;--u){var c=a[u],l=typeof c;if("undefined"!==l){"function"===l&&(s=c);break}}if(!s){if(n.isClient)s=t;else{var f=new e;s=f.resolver()}++u}a[u]=n.bindEnvironment(s);var p=r.apply(i,a);return f?f.wait():p}};var r=Object.prototype.hasOwnProperty;n._inherits=function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);var o=function(){this.constructor=t};return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};var o=!1;n._wrapAsync=function(t,e){return o||(n._debug("Meteor._wrapAsync has been renamed to Meteor.wrapAsync"),o=!0),n.wrapAsync.apply(n,arguments)}}.call(this),function(){"use strict";function t(){if(o.setImmediate){var t=function(t){o.setImmediate(t)};return t.implementation="setImmediate",t}return null}function e(){function t(t,e){return"string"==typeof t&&t.substring(0,e.length)===e}function e(e){if(e.source===o&&t(e.data,s)){var n=e.data.substring(s.length);try{a[n]&&a[n]()}finally{delete a[n]}}}if(!o.postMessage||o.importScripts)return null;var n=!0,r=o.onmessage;if(o.onmessage=function(){n=!1},o.postMessage("","*"),o.onmessage=r,!n)return null;var i=0,a={},s="Meteor._setImmediate."+Math.random()+".";o.addEventListener?o.addEventListener("message",e,!1):o.attachEvent("onmessage",e);var u=function(t){a[++i]=t,o.postMessage(s+i,"*")};return u.implementation="postMessage",u}function r(){var t=function(t){o.setTimeout(t,0)};return t.implementation="setTimeout",t}var o=this;n._setImmediate=t()||e()||r()}.call(this),function(){function t(t){if(Package.ddp){var e=Package.ddp.DDP,n=e._CurrentMethodInvocation||e._CurrentInvocation,r=n.get();if(r&&r.isSimulation)throw new Error("Can't set timers inside simulations");return function(){n.withValue(null,t)}}return t}function e(e,r){return n.bindEnvironment(t(r),e)}n.setTimeout=function(t,n){return setTimeout(e("setTimeout callback",t),n)},n.setInterval=function(t,n){return setInterval(e("setInterval callback",t),n)},n.clearInterval=function(t){return clearInterval(t)},n.clearTimeout=function(t){return clearTimeout(t)},n.defer=function(t){n._setImmediate(e("defer callback",t))}}.call(this),function(){n.makeErrorType=function(t,e){var r=function(){Error.captureStackTrace?Error.captureStackTrace(this,r):this.stack=(new Error).stack,e.apply(this,arguments),this.errorType=t};return n._inherits(r,Error),r},n.Error=n.makeErrorType("Meteor.Error",function(t,e,n){var r=this;r.isClientSafe=!0,r.error=t,r.reason=e,r.details=n,r.reason?r.message=r.reason+" ["+r.error+"]":r.message="["+r.error+"]"}),n.Error.prototype.clone=function(){var t=this;return new n.Error(t.error,t.reason,t.details)}}.call(this),function(){n._noYieldsAllowed=function(t){return t()},n._SynchronousQueue=function(){var t=this;t._tasks=[],t._running=!1,t._runTimeout=null};var t=n._SynchronousQueue.prototype;t.runTask=function(t){var e=this;if(!e.safeToRunTask())throw new Error("Could not synchronously run a task from a running task");e._tasks.push(t);var r=e._tasks;e._tasks=[],e._running=!0,e._runTimeout&&(clearTimeout(e._runTimeout),e._runTimeout=null);try{for(;r.length>0;){var o=r.shift();try{o()}catch(t){if(0===r.length)throw t;n._debug("Exception in queued task: "+(t.stack||t))}}}finally{e._running=!1}},t.queueTask=function(t){var e=this;e._tasks.push(t),e._runTimeout||(e._runTimeout=setTimeout(function(){return e.flush.apply(e,arguments)},0))},t.flush=function(){this.runTask(function(){})},t.drain=function(){var t=this;if(t.safeToRunTask())for(;t._tasks.length>0;)t.flush()},t.safeToRunTask=function(){return!this._running}}.call(this),function(){var t=[],e=!1,r=!1,o=0,i=function(){o++},a=function(){o--,s()},s=function(){if(!(r||!e||o>0)){for(r=!0;t.length;)t.shift()();n.isCordova&&WebAppLocalServer.startupDidComplete()}},u=function(){e||(e=!0,s())};n.isCordova&&(i(),document.addEventListener("deviceready",a,!1)),"complete"===document.readyState||"loaded"===document.readyState?window.setTimeout(u):document.addEventListener?(document.addEventListener("DOMContentLoaded",u,!1),window.addEventListener("load",u,!1)):(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&u()}),window.attachEvent("load",u)),n.startup=function(e){var o=!document.addEventListener&&document.documentElement.doScroll;if(o&&window===top){try{o("left")}catch(t){return void setTimeout(function(){n.startup(e)},50)}e()}else r?e():t.push(e)}}.call(this),function(){var t=0;n._debug=function(){if(t)t--;else if("undefined"!=typeof console&&void 0!==console.log)if(0==arguments.length)console.log("");else if("function"==typeof console.log.apply){for(var e=!0,n=0;n2;if(null==n&&(n=[]),v&&n.reduce===v)return e&&(t=A.bind(t,e)),i?n.reduce(t,r):n.reduce(t);if(E(n,function(n,u,a){i?r=t.call(e,r,n,u,a):(r=n,i=!0)}),!i)throw new TypeError(F);return r},A.reduceRight=A.foldr=function(n,t,r,e){var i=arguments.length>2;if(null==n&&(n=[]),y&&n.reduceRight===y)return e&&(t=A.bind(t,e)),i?n.reduceRight(t,r):n.reduceRight(t);var u=n.length;if(!O(n)){var a=A.keys(n);u=a.length}if(E(n,function(c,o,l){o=a?a[--u]:--u,i?r=t.call(e,r,n[o],o,l):(r=n[o],i=!0)}),!i)throw new TypeError(F);return r},A.find=A.detect=function(n,t,r){var e;return M(n,function(n,i,u){if(t.call(r,n,i,u))return e=n,!0}),e},A.filter=A.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(E(n,function(n,i,u){t.call(r,n,i,u)&&e.push(n)}),e)},A.reject=function(n,t,r){return A.filter(n,function(n,e,i){return!t.call(r,n,e,i)},r)},A.every=A.all=function(n,t,r){t||(t=A.identity);var i=!0;return null==n?i:g&&n.every===g?n.every(t,r):(E(n,function(n,u,a){if(!(i=i&&t.call(r,n,u,a)))return e}),!!i)};var M=A.some=A.any=function(n,t,r){t||(t=A.identity);var i=!1;return null==n?i:m&&n.some===m?n.some(t,r):(E(n,function(n,u,a){if(i||(i=t.call(r,n,u,a)))return e}),!!i)};A.contains=A.include=function(n,t){return null!=n&&(b&&n.indexOf===b?-1!=n.indexOf(t):M(n,function(n){return n===t}))},A.invoke=function(n,t){var r=o.call(arguments,2),e=A.isFunction(t);return A.map(n,function(n){return(e?t:n[t]).apply(n,r)})},A.pluck=function(n,t){return A.map(n,function(n){return n[t]})},A.where=function(n,t,r){return A.isEmpty(t)?r?void 0:[]:A[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},A.findWhere=function(n,t){return A.where(n,t,!0)},A.max=function(n,t,r){if(!t&&A.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&A.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return E(n,function(n,i,u){var a=t?t.call(r,n,i,u):n;a>e.computed&&(e={value:n,computed:a})}),e.value},A.min=function(n,t,r){if(!t&&A.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&A.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return E(n,function(n,i,u){var a=t?t.call(r,n,i,u):n;ae||void 0===r)return 1;if(r>>1;r.call(e,n[c])=0})})},A.difference=function(n){var t=l.apply(i,o.call(arguments,1));return A.filter(n,function(n){return!A.contains(t,n)})},A.zip=function(){for(var n=A.max(A.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;r=0;r--)t=[n[r].apply(this,t)];return t[0]}},A.after=function(n,t){return function(){if(--n<1)return t.apply(this,arguments)}},A.keys=x||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)A.has(n,r)&&t.push(r);return t},A.values=function(n){for(var t=A.keys(n),r=t.length,e=new Array(r),i=0;i":">",'"':""","'":"'"}};q.unescape=A.invert(q.escape);var B={escape:new RegExp("["+A.keys(q.escape).join("")+"]","g"),unescape:new RegExp("("+A.keys(q.unescape).join("|")+")","g")};A.each(["escape","unescape"],function(n){A[n]=function(t){return null==t?"":(""+t).replace(B[n],function(t){return q[n][t]})}}),A.result=function(n,t){if(null!=n){var r=n[t];return A.isFunction(r)?r.call(n):r}},A.mixin=function(n){E(A.functions(n),function(t){var r=A[t]=n[t];A.prototype[t]=function(){var n=[this._wrapped];return c.apply(n,arguments),U.call(this,r.apply(A,n))}})};var D=0;A.uniqueId=function(n){var t=++D+"";return n?n+t:t},A.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},C=/\\|'|\r|\n|\t|\u2028|\u2029/g;A.template=function(n,t,r){var e;r=A.defaults({},r,A.templateSettings);var i=new RegExp([(r.escape||P).source,(r.interpolate||P).source,(r.evaluate||P).source].join("|")+"|$","g"),u=0,a="__p+='";n.replace(i,function(t,r,e,i,c){return a+=n.slice(u,c).replace(C,function(n){return"\\"+z[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),i&&(a+="';\n"+i+"\n__p+='"),u=c+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(n){throw n.source=a,n}if(t)return e(t,A);var c=function(n){return e.call(this,n,A)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},A.chain=function(n){return A(n).chain()};var U=function(n){return this._chain?A(n).chain():n};A.mixin(A),E(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=i[n];A.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],U.call(this,r)}}),E(["concat","join","slice"],function(n){var t=i[n];A.prototype[n]=function(){return U.call(this,t.apply(this._wrapped,arguments))}}),A.extend(A.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)}.call(this),function(){t=n._}.call(this),"undefined"==typeof Package&&(Package={}),function(n,t){for(var r in t)r in n||(n[r]=t[r])}(Package.underscore={},{_:t})}(); - -!function(){var r=Package.meteor.Meteor,n=Package.meteor.global,e=Package.meteor.meteorEnv,a;(function(){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={},e=0;e255)throw new Error("Not ascii. Base64.encode can only take ascii strings.");r[e]=l}}for(var u=[],i=null,o=null,c=null,f=null,e=0;e>2&63,o=(3&r[e])<<4;break;case 1:o|=r[e]>>4&15,c=(15&r[e])<<2;break;case 2:c|=r[e]>>6&3,f=63&r[e],u.push(t(i)),u.push(t(o)),u.push(t(c)),u.push(t(f)),i=null,o=null,c=null,f=null;break}return null!=i&&(u.push(t(i)),u.push(t(o)),null==c?u.push("="):u.push(t(c)),null==f&&u.push("=")),u.join("")};var t=function(n){return r.charAt(n)},l=function(r){return"="===r?-1:n[r]};a.newBinary=function(r){if("undefined"==typeof Uint8Array||"undefined"==typeof ArrayBuffer){for(var n=[],e=0;e>4,e[o++]=t,u=(15&s)<<4;break;case 2:s>=0&&(u|=s>>2,e[o++]=u,i=(3&s)<<6);break;case 3:s>=0&&(e[o++]=i|s);break}}return e}}).call(this),"undefined"==typeof Package&&(Package={}),function(r,n){for(var e in n)e in r||(r[e]=n[e])}(Package.base64={},{Base64:a})}(); - -!function(){var n=Package.meteor.Meteor,e=Package.meteor.global,r=Package.meteor.meteorEnv,t,o,i;t=function(n){"use strict";function e(n,e){return o(n)&&(p(A,n,e),i(k)&&k(B)),B}function r(n){this.id=n,this.children=[],this.childrenById={}}function t(n,e){return O.call(n,e)&&n[e]}function o(n){return"object"==typeof n&&null!==n}function i(n){return"function"==typeof n}function u(n){return"string"==typeof n}function c(n){return new Error("Cannot find module '"+n+"'")}function s(n){function e(e){var r=w(n,e);if(r)return l(r,n.module);var t=c(e);if(i(E))return E(e,n.module.id,t);throw t}return i(x)&&(e=x(e,n.module)),e.extensions=h(n).slice(0),e.resolve=function(e){var r=w(n,e);if(r)return r.module.id;var t=c(e);if(E&&i(E.resolve))return E.resolve(e,n.module.id,t);throw t},e}function f(n,e){var t=this;t.parent=e=e||null,t.module=new r(n),q[n]=t,t.contents=null,t.deps={}}function l(n,e){var r=n.module;if(!O.call(r,"exports")){var t=n.contents;if(!t){if(n.stub)return n.stub;throw c(r.id)}if(e){r.parent=e;var o=e.children;Array.isArray(o)&&o.push(r)}i(r.useNode)&&r.useNode()||t(r.require=r.require||s(n),r.exports=n.stub||{},r,n.module.id,n.parent.module.id),r.loaded=!0}var u=r.runSetters||r.runModuleSetters;return i(u)&&u.call(r),r.exports}function a(n){return n&&o(n.contents)}function d(n){return n&&null===n.contents}function p(n,e,r){Array.isArray(e)?(e.forEach(function(r){u(r)?n.deps[r]=n.module.id:i(r)?e=r:o(r)&&(n.stub=n.stub||{},v(r,function(e,r){n.stub[r]=e}))}),i(e)||(e=null)):i(e)||u(e)||o(e)||(e=null),e&&(n.contents=n.contents||(o(e)?{}:e),o(e)&&a(n)&&v(e,function(e,o){if(".."===o)i=n.parent;else{var i=t(n.contents,o);i||((i=n.contents[o]=new f(n.module.id.replace(/\/*$/,"/")+o,n)).options=r)}p(i,e,r)}))}function v(n,e,r){Object.keys(n).forEach(function(r){e.call(this,n[r],r)},r)}function h(n){return n.options&&n.options.extensions||P}function m(n,e,r){for(;n&&!a(n);)n=n.parent;if(!n||!e||"."===e)return n;if(".."===e)return n.parent;var o=t(n.contents,e);if(r&&(!o||a(o)))for(var i=0;i=0&&t.splice(n,1),t}function a(e,t){var n=!1;d.getESModule(e.exports)||(e.namespace.default=e.exports,n=!0),d.isObjectLike(e.exports)&&((void 0===t||t.indexOf("*")>=0)&&(t=Object.keys(e.exports)),t.forEach(function(t){g.call(e.getters,t)||n&&"default"===t||!g.call(e.exports,t)||d.copyKey(t,e.namespace,e.exports)}))}function s(e,t,n,r){function o(t,n){var r=n;return r!==r?r=h:void 0===r&&(r=m),e.last[t]!==r&&(e.last[t]=r,!0)}if("__esModule"!==t){var a=!1;if(void 0===e.last&&(e.last=Object.create(null),a=!0),"*"===t)for(var s=i(n),u=s.length,c=0;c0&&m.constant&&delete u[p]}}}function c(e,t){if("*"===t)return e.namespace;if(g.call(e.namespace,t))return e.namespace[t];var n=e.exports;if("default"===t&&!(d.getESModule(n)&&"default"in n))return n;if(null!=n)return n[t]}function l(){return Math.random().toString(36).replace("0.",++v+"$")}function f(e,t){var n=e.getters[t];try{var r=n();return++n.runCount,r}catch(e){}return p}var d=e("./utils.js"),p={},h={},m={},g=Object.prototype.hasOwnProperty,v=0,y=d.setPrototypeOf(r.prototype,null),b="function"==typeof WeakMap?new WeakMap:new function e(){var t=[],n=[];this.get=function(e){var r=t.indexOf(e);if(r>=0)return n[r]},this.set=function(e,r){var o=t.indexOf(e);o>=0?n[o]=r:(t.push(e),n.push(r))}};r.get=function(e){if(d.isObjectLike(e)){var t=b.get(e);if(void 0!==t)return t}return null},r.getOrCreate=function(e,t){var n=o(e);return d.isObject(t)&&(n.ownerModules[t.id]=t),n},y.addGetters=function(e,t){var n=i(e),r=n.length;t=!!t;for(var o=0;o=0)&&(e=Object.keys(this.getters));for(var t=e.length,n=0;n1&&void 0!==arguments[1]&&arguments[1],n=(0,r.getEnabledElement)(e);if(void 0===n.image)throw new Error("updateImage: image has not been loaded yet");(0,o.default)(n,t)};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(2))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){e.needsRedraw=!0,t&&(e.invalid=!0)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(void 0===e)throw new Error("getDefaultViewport: parameter canvas must not be undefined");if(void 0===t)throw new Error("getDefaultViewport: parameter image must not be undefined");var n={scale:1,translation:{x:0,y:0},voi:{windowWidth:t.windowWidth,windowCenter:t.windowCenter},invert:t.invert,pixelReplication:!1,rotation:0,hflip:!1,vflip:!1,modalityLUT:t.modalityLUT,voiLUT:t.voiLUT},r=e.height/t.rows,o=e.width/t.columns;return n.scale=Math.min(o,r),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,o,i,a){if(i||a)return(0,r.default)(e,t,n,o,i,a);if(void 0===e.cachedLut){var s=e.maxPixelValue-Math.min(e.minPixelValue,0)+1;e.cachedLut={},e.cachedLut.lutArray=new Uint8ClampedArray(s)}var u=e.cachedLut.lutArray,c=e.maxPixelValue,l=e.minPixelValue,f=e.slope,d=e.intercept,p=void 0,h=void 0,m=0;if(l<0&&(m=l),!0===o)for(var g=e.minPixelValue;g<=c;g++)p=g*f+d,h=255*((p-n)/t+.5),u[g+-m]=255-h;else for(var v=e.minPixelValue;v<=c;v++)p=v*f+d,h=255*((p-n)/t+.5),u[v+-m]=h;return u};var r=function(e){return e&&e.__esModule?e:{default:e}}(n(11))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=e.renderingTools.colorRenderCanvas;n.width=t.width,n.height=t.height;var r=n.getContext("2d");r.fillStyle="white",r.fillRect(0,0,n.width,n.height);var o=r.getImageData(0,0,t.width,t.height);e.renderingTools.colorRenderCanvasContext=r,e.renderingTools.colorRenderCanvasData=o}function i(e,t){return void 0!==e.cachedLut&&e.cachedLut.windowCenter===t.voi.windowCenter&&e.cachedLut.windowWidth===t.voi.windowWidth&&e.cachedLut.invert===t.invert?e.cachedLut.lutArray:((0,c.default)(e,t.voi.windowWidth,t.voi.windowCenter,t.invert),e.cachedLut.windowWidth=t.voi.windowWidth,e.cachedLut.windowCenter=t.voi.windowCenter,e.cachedLut.invert=t.invert,e.cachedLut.lutArray)}function a(e,t){var n=e.renderingTools.lastRenderedImageId,r=e.renderingTools.lastRenderedViewport;return t.imageId!==n||r.windowCenter!==e.viewport.voi.windowCenter||r.windowWidth!==e.viewport.voi.windowWidth||r.invert!==e.viewport.invert||r.rotation!==e.viewport.rotation||r.hflip!==e.viewport.hflip||r.vflip!==e.viewport.vflip}function s(e,t,n){e.renderingTools.colorRenderCanvas||(e.renderingTools.colorRenderCanvas=document.createElement("canvas"));var r=e.renderingTools.colorRenderCanvas;if(255===e.viewport.voi.windowWidth&&128===e.viewport.voi.windowCenter&&!1===e.viewport.invert&&t.getCanvas&&t.getCanvas())return t.getCanvas();if(!1===a(e,t)&&!0!==n)return r;r.width===t.width&&r.height===t.height||o(e,t);var s=window.performance?performance.now():Date.now(),u=i(t,e.viewport);t.stats.lastLutGenerateTime=(window.performance?performance.now():Date.now())-s;var c=e.renderingTools.colorRenderCanvasData,f=e.renderingTools.colorRenderCanvasContext;return(0,l.default)(t,u,c.data),s=window.performance?performance.now():Date.now(),f.putImageData(c,0,0),t.stats.lastPutImageDataTime=(window.performance?performance.now():Date.now())-s,r}function u(e,t){if(void 0===e)throw new Error("drawImage: enabledElement parameter must not be undefined");var n=e.image;if(void 0===n)throw new Error("drawImage: image must be loaded before it can be drawn");var r=e.canvas.getContext("2d");r.setTransform(1,0,0,1,0,0),r.fillStyle="black",r.fillRect(0,0,e.canvas.width,e.canvas.height),!0===e.viewport.pixelReplication?(r.imageSmoothingEnabled=!1,r.mozImageSmoothingEnabled=!1):(r.imageSmoothingEnabled=!0,r.mozImageSmoothingEnabled=!0),r.save(),(0,f.default)(e,r),e.renderingTools||(e.renderingTools={});var o=void 0;o=e.options&&e.options.renderer&&"webgl"===e.options.renderer.toLowerCase()?d.default.renderer.render(e):s(e,n,t),r.drawImage(o,0,0,n.width,n.height,0,0,n.width,n.height),r.restore(),e.renderingTools.lastRenderedImageId=n.imageId;var i={};i.windowCenter=e.viewport.voi.windowCenter,i.windowWidth=e.viewport.voi.windowWidth,i.invert=e.viewport.invert,i.rotation=e.viewport.rotation,i.hflip=e.viewport.hflip,i.vflip=e.viewport.vflip,e.renderingTools.lastRenderedViewport=i}Object.defineProperty(t,"__esModule",{value:!0}),t.renderColorImage=u;var c=r(n(4)),l=r(n(13)),f=r(n(6)),d=r(n(7))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){if(void 0===e)throw new Error("setToPixelCoordinateSystem: parameter enabledElement must not be undefined");if(void 0===t)throw new Error("setToPixelCoordinateSystem: parameter context must not be undefined");var o=(0,r.default)(e,n);t.setTransform(o.m[0],o.m[1],o.m[2],o.m[3],o.m[4],o.m[5])};var r=function(e){return e&&e.__esModule?e:{default:e}}(n(16))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(54),i=r(n(28)),a=r(n(29));t.default={createProgramFromString:i.default,renderer:{render:o.render,initRenderer:o.initRenderer,getRenderCanvas:o.getRenderCanvas,isWebGLAvailable:o.isWebGLAvailable},textureCache:a.default,isWebGLInitialized:o.isWebGLInitialized}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,r.default)(e)};var r=function(e){return e&&e.__esModule?e:{default:e}}(n(16))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return window.performance?performance.now():Date.now()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={name:"cornerstone-core"};t.default=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,r,a,s){if(void 0===e.cachedLut){var u=e.maxPixelValue-Math.min(e.minPixelValue,0)+1;e.cachedLut={},e.cachedLut.lutArray=new Uint8ClampedArray(u)}var c=e.cachedLut.lutArray,l=e.maxPixelValue,f=e.minPixelValue,d=(0,o.default)(e.slope,e.intercept,a),p=(0,i.default)(t,n,s),h=0;if(f<0&&(h=f),!0===r)for(var m=e.minPixelValue;m<=l;m++)c[m+-h]=255-p(d(m));else for(var g=e.minPixelValue;g<=l;g++)c[g+-h]=p(d(g));return c};var o=r(n(26)),i=r(n(53))},function(e,t,n){"use strict";function r(e){window.setTimeout(e,1e3/60)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return window.requestAnimationFrame(e)||window.webkitRequestAnimationFrame(e)||window.mozRequestAnimationFrame(e)||window.oRequestAnimationFrame(e)||window.msRequestAnimationFrame(e)||r(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){var o=(0,r.default)(),i=e.getPixelData();e.stats.lastGetPixelDataTime=(0,r.default)()-o;var a=e.minPixelValue,s=0,u=0,c=i.length;if(o=(0,r.default)(),a<0)for(;ut.timeStamp?-1:e.timeStampp;){var t=g[g.length-1].imageId;s(t),$(d.default).trigger("CornerstoneImageCachePromiseRemoved",{imageId:t})}var n=u();$(d.default).trigger("CornerstoneImageCacheFull",n)}}function i(e,t){if(void 0===e)throw new Error("getImagePromise: imageId must not be undefined");if(void 0===t)throw new Error("getImagePromise: imagePromise must not be undefined");if(!0===m.hasOwnProperty(e))throw new Error("putImagePromise: imageId already in cache");var n={loaded:!1,imageId:e,sharedCacheKey:void 0,imagePromise:t,timeStamp:new Date,sizeInBytes:0};m[e]=n,g.push(n),t.then(function(e){if(n.loaded=!0,n.image=e,void 0===e.sizeInBytes)throw new Error("putImagePromise: sizeInBytes must not be undefined");if(void 0===e.sizeInBytes.toFixed)throw new Error("putImagePromise: image.sizeInBytes is not a number");n.sizeInBytes=e.sizeInBytes,h+=n.sizeInBytes,n.sharedCacheKey=e.sharedCacheKey,o()})}function a(e){if(void 0===e)throw new Error("getImagePromise: imageId must not be undefined");var t=m[e];if(void 0!==t)return t.timeStamp=new Date,t.imagePromise}function s(e){if(void 0===e)throw new Error("removeImagePromise: imageId must not be undefined");var t=m[e];if(void 0===t)throw new Error("removeImagePromise: imageId was not present in imageCache");t.imagePromise.reject(),g.splice(g.indexOf(t),1),h-=t.sizeInBytes,c(t.imagePromise,t.imageId),delete m[e]}function u(){return{maximumSizeInBytes:p,cacheSizeInBytes:h,numberOfImagesCached:g.length}}function c(e,t){e.then(function(e){e.decache&&e.decache()}).always(function(){delete m[t]})}function l(){for(;g.length>0;)s(g[0].imageId)}function f(e,t){var n=m[e];n&&n.imagePromise.then(function(e){var r=t-e.sizeInBytes;e.sizeInBytes=t,n.sizeInBytes=t,h+=r})}Object.defineProperty(t,"__esModule",{value:!0}),t.cachedImages=void 0,t.setMaximumSizeBytes=r,t.putImagePromise=i,t.getImagePromise=a,t.removeImagePromise=s,t.getCacheInfo=u,t.purgeCache=l,t.changeImageIdCacheSize=f;var d=function(e){return e&&e.__esModule?e:{default:e}}(n(10)),p=1073741824,h=0,m={},g=t.cachedImages=[];t.default={imageCache:m,cachedImages:g,setMaximumSizeBytes:r,putImagePromise:i,getImagePromise:a,removeImagePromise:s,getCacheInfo:u,purgeCache:l,changeImageIdCacheSize:f}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(e.color&&!e.falseColor)throw new Error("Color transforms are not implemented yet");var n=e.minPixelValue,o=0,i=0,a=e.width*e.height,s=e.origPixelData||e.getPixelData(),u=new Uint8Array(4*a),c=t,l=void 0,f=void 0;if(e.color=!0,e.falseColor=!0,e.origPixelData=s,t instanceof r.default.LookupTable)for(t.build();i0;)o.push(e),e+=r;return o[o.length-1]=t,o}function o(e,t){for(var n=0,r=e.length-1;n<=r;){var o=n+Math.floor((r-n)/2),i=e[o];if(i===t)return o;t=0&&e1)throw new Error("HSVToRGB expects hue < 1");var r=[];if(0===t)return r[0]=n,r[1]=n,r[2]=n,r;var o=Math.floor(6*e),i=6*e-o,a=n*(1-t),s=n*(1-t*i),u=n*(1-t*(1-i));switch(o){case 0:case 6:r[0]=n,r[1]=u,r[2]=a;break;case 1:r[0]=s,r[1]=n,r[2]=a;break;case 2:r[0]=a,r[1]=n,r[2]=u;break;case 3:r[0]=a,r[1]=s,r[2]=n;break;case 4:r[0]=u,r[1]=a,r[2]=n;break;case 5:r[0]=n,r[1]=a,r[2]=s}return r},this.build=function(e){if(!(this.Table.length>1)||e){this.Table=[];var t=this.NumberOfColors-1,n=void 0,r=void 0,o=void 0,i=void 0;t?(n=(this.HueRange[1]-this.HueRange[0])/t,r=(this.SaturationRange[1]-this.SaturationRange[0])/t,o=(this.ValueRange[1]-this.ValueRange[0])/t,i=(this.AlphaRange[1]-this.AlphaRange[0])/t):n=r=o=i=0;for(var a=0;a<=t;a++){var s=this.HueRange[0]+a*n,u=this.SaturationRange[0]+a*r,c=this.ValueRange[0]+a*o,l=this.AlphaRange[0]+a*i,f=this.HSVToRGB(s,u,c),d=[];switch(this.Ramp){case"scurve":d[0]=Math.floor(127.5*(1+Math.cos((1-f[0])*Math.PI))),d[1]=Math.floor(127.5*(1+Math.cos((1-f[1])*Math.PI))),d[2]=Math.floor(127.5*(1+Math.cos((1-f[2])*Math.PI))),d[3]=Math.floor(255*l);break;case"linear":d[0]=Math.floor(255*f[0]+.5),d[1]=Math.floor(255*f[1]+.5),d[2]=Math.floor(255*f[2]+.5),d[3]=Math.floor(255*l+.5);break;case"sqrt":d[0]=Math.floor(255*Math.sqrt(f[0])+.5),d[1]=Math.floor(255*Math.sqrt(f[1])+.5),d[2]=Math.floor(255*Math.sqrt(f[2])+.5),d[3]=Math.floor(255*Math.sqrt(l)+.5);break;default:throw new Error("Invalid Ramp value ("+this.Ramp+")")}this.Table.push(d)}this.buildSpecialColors()}},this.buildSpecialColors=function(){var e=this.NumberOfColors,t=e+o,n=e+i,r=e+a;this.UseBelowRangeColor||0===e?this.Table[t]=this.BelowRangeColor:this.Table[t]=this.Table[0],this.UseAboveRangeColor||0===e?this.Table[n]=this.AboveRangeColor:this.Table[n]=this.Table[e-1],this.Table[r]=this.NaNColor},this.mapValue=function(e){var t=this.getIndex(e);if(t<0)return this.NaNColor;if(0===t){if(this.UseBelowRangeColor&&ethis.TableRange[1])return this.AboveRangeColor;return this.Table[t]},this.linearIndexLookupMain=function(e,t){var n=void 0;return n=et.Range[1]?t.MaxIndex+i+1.5:(e+t.Shift)*t.Scale,Math.round(n)},this.getIndex=function(e){var t={};if(t.Range=[],t.MaxIndex=this.NumberOfColors-1,t.Shift=-this.TableRange[0],this.TableRange[1]<=this.TableRange[0]?t.Scale=Number.MAX_VALUE:t.Scale=t.MaxIndex/(this.TableRange[1]-this.TableRange[0]),t.Range[0]=this.TableRange[0],t.Range[1]=this.TableRange[1],isNaN(e))return-1;var n=this.linearIndexLookupMain(e,t);return n===this.NumberOfColors+o?n=0:n===this.NumberOfColors+i&&(n=this.NumberOfColors-1),n},this.setTableValue=function(e,t){if(5===arguments.length&&(t=Array.prototype.slice.call(arguments,1)),e<0)throw new Error("Can't set the table value for negative index ("+e+")");e>=this.NumberOfColors&&new Error("Index "+e+" is greater than the number of colors "+this.NumberOfColors),this.Table[e]=t,0!==e&&e!==this.NumberOfColors-1||this.buildSpecialColors()}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=0,i=1,a=2},function(e,t,n){"use strict";function r(e,t){var n=e,r=t;return function(e){return e*n+r}}function o(e){var t=e.lut[0],n=e.lut[e.lut.length-1],r=e.firstValueMapped+e.lut.length;return function(o){return o=r?n:e.lut[o]}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){return n?o(n):r(e,t)}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;nt.timeStamp?-1:e.timeStampd;){var t=f[f.length-1];p-=t.sizeInBytes,delete l[t.imageId],f.pop(),$(cornerstone).trigger("CornerstoneWebGLTextureRemoved",{imageId:t.imageId})}var n=r();$(cornerstone).trigger("CornerstoneWebGLTextureCacheFull",n)}}function i(e){if(void 0===e)throw new Error("setMaximumSizeBytes: parameter numBytes must not be undefined");if(void 0===e.toFixed)throw new Error("setMaximumSizeBytes: parameter numBytes must be a number");d=e,o()}function a(e,t){var n=e.imageId;if(void 0===e)throw new Error("putImageTexture: image must not be undefined");if(void 0===n)throw new Error("putImageTexture: imageId must not be undefined");if(void 0===t)throw new Error("putImageTexture: imageTexture must not be undefined");if(!0===Object.prototype.hasOwnProperty.call(l,n))throw new Error("putImageTexture: imageId already in cache");var r={imageId:n,imageTexture:t,timeStamp:new Date,sizeInBytes:t.sizeInBytes};if(l[n]=r,f.push(r),void 0===t.sizeInBytes)throw new Error("putImageTexture: imageTexture.sizeInBytes must not be undefined");if(void 0===t.sizeInBytes.toFixed)throw new Error("putImageTexture: imageTexture.sizeInBytes is not a number");p+=r.sizeInBytes,o()}function s(e){if(void 0===e)throw new Error("getImageTexture: imageId must not be undefined");var t=l[e];if(void 0!==t)return t.timeStamp=new Date,t.imageTexture}function u(e){if(void 0===e)throw new Error("removeImageTexture: imageId must not be undefined");var t=l[e];if(void 0===t)throw new Error("removeImageTexture: imageId must not be undefined");return f.splice(f.indexOf(t),1),p-=t.sizeInBytes,delete l[e],t.imageTexture}function c(){for(;f.length>0;){var e=f.pop();delete l[e.imageId]}p=0}Object.defineProperty(t,"__esModule",{value:!0});var l={},f=[],d=268435456,p=0;t.default={purgeCache:c,getImageTexture:s,putImageTexture:a,removeImageTexture:u,setMaximumSizeBytes:i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,r.getEnabledElement)(e),i=(0,o.default)(n);return i.invert(),i.transformPoint(t.x,t.y)};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(8))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(void 0===e)throw new Error("disable: element must not be undefined");for(var t=(0,r.getEnabledElements)(),n=0;no?n:o;return{minPixelValue:t,maxPixelValue:n}}function i(e){if(e.restore)return e.restore;var t=e.color,n=e.rgba,r=e.lut,o=e.slope,i=e.windowWidth,a=e.windowCenter,s=e.minPixelValue,u=e.maxPixelValue;return function(){if(e.color=t,e.rgba=n,e.lut=r,e.slope=o,e.windowWidth=i,e.windowCenter=a,e.minPixelValue=s,e.maxPixelValue=u,e.origPixelData){var c=e.origPixelData;e.getPixelData=function(){return c}}delete e.origPixelData,delete e.colormapId,delete e.falseColor}}function a(e){return e&&"string"==typeof e&&(e=(0,p.getColormap)(e)),e}function s(e){return!(!e.restore||"function"!=typeof e.restore||(e.restore(),0))}function u(e,t){if(e.color&&!e.falseColor)throw new Error("Color transforms are not implemented yet");var n=(t=a(t)).getId();if(e.colormapId===n)return!1;if(s(e),n){var r=e.minPixelValue||0,u=e.maxPixelValue||255;e.restore=i(e);var c=t.createLookupTable();c.setTableRange(r,u),(0,d.default)(e,c);var l=o(e.getPixelData());e.minPixelValue=l.minPixelValue,e.maxPixelValue=l.maxPixelValue,e.colormapId=n}return!0}function c(e,t){u((0,l.getEnabledElement)(e).image,t)&&(0,f.default)(e,!0)}Object.defineProperty(t,"__esModule",{value:!0}),t.restoreImage=t.convertToFalseColorImage=t.convertImageToFalseColorImage=void 0;var l=n(0),f=r(n(1)),d=r(n(21)),p=n(24);t.convertImageToFalseColorImage=u,t.convertToFalseColorImage=c,t.restoreImage=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,r.getEnabledElement)(e);return(0,o.default)(n.canvas,t)};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(3))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,r.getEnabledElement)(e).image};var r=n(0)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,r,s){var u=(0,i.default)(e,t,n,r,s),c=(0,o.getEnabledElement)(e),l=(0,a.default)(c.image.slope,c.image.intercept,c.viewport.modalityLUT);return u.map(l)};var o=n(0),i=r(n(19)),a=r(n(26))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=(0,r.getEnabledElement)(e).viewport;if(void 0!==t)return{scale:t.scale,translation:{x:t.translation.x,y:t.translation.y},voi:{windowWidth:t.voi.windowWidth,windowCenter:t.voi.windowCenter},invert:t.invert,pixelReplication:t.pixelReplication,rotation:t.rotation,hflip:t.hflip,vflip:t.vflip,modalityLUT:t.modalityLUT,voiLUT:t.voiLUT}};var r=n(0)},function(e,t,n){"use strict";function r(e,t){var n=e.indexOf(":"),r=e.substring(0,n),o=l[r],i=void 0;if(void 0===o||null===o){if(void 0!==f)return i=f(e);throw new Error("loadImageFromImageLoader: no image loader for imageId")}return(i=o(e,t)).then(function(e){$(c.default).trigger("CornerstoneImageLoaded",{image:e})}),i}function o(e,t){if(void 0===e)throw new Error("loadImage: parameter imageId must not be undefined");var n=(0,u.getImagePromise)(e);return void 0!==n?n:n=r(e,t)}function i(e,t){if(void 0===e)throw new Error("loadAndCacheImage: parameter imageId must not be undefined");var n=(0,u.getImagePromise)(e);return void 0!==n?n:(n=r(e,t),(0,u.putImagePromise)(e,n),n)}function a(e,t){l[e]=t}function s(e){var t=f;return f=e,t}Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=o,t.loadAndCacheImage=i,t.registerImageLoader=a,t.registerUnknownImageLoader=s;var u=n(20),c=function(e){return e&&e.__esModule?e:{default:e}}(n(10)),l={},f=void 0},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(2)),i=r(n(4)),a=r(n(11)),s=r(n(3)),u=r(n(12)),c=r(n(14)),l=r(n(13)),f=r(n(8)),d=r(n(16)),p=n(27);t.default={drawImage:o.default,generateLut:i.default,generateLutNew:a.default,getDefaultViewport:s.default,requestAnimationFrame:u.default,storedPixelDataToCanvasImageData:c.default,storedColorPixelDataToCanvasImageData:l.default,getTransform:f.default,calculateTransform:d.default,Transform:p.Transform}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=(0,r.getEnabledElement)(e);t.invalid=!0,t.needsRedraw=!0;var n={element:e};$(e).trigger("CornerstoneInvalidated",n)};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){(0,r.getEnabledElementsByImageId)(e).forEach(function(e){(0,o.default)(e,!0)})};var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n(2))},function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=void 0;for(n=0;n>t,r=e.lut[e.lut.length-1]>>t,o=e.firstValueMapped+e.lut.length-1;return function(i){return i=o?r:e.lut[i-e.firstValueMapped]>>t}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){return n?o(n):r(e,t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(){return j}function i(){for(var e in b.shaders){var t=b.shaders[e];t.attributes={},t.uniforms={},t.vert=_.vertexShader,t.program=(0,x.default)(E,t.vert,t.frag),t.attributes.texCoordLocation=E.getAttribLocation(t.program,"a_texCoord"),E.enableVertexAttribArray(t.attributes.texCoordLocation),t.attributes.positionLocation=E.getAttribLocation(t.program,"a_position"),E.enableVertexAttribArray(t.attributes.positionLocation),t.uniforms.resolutionLocation=E.getUniformLocation(t.program,"u_resolution")}}function a(){!0!==C&&l(j)&&(m(),i(),t.isWebGLInitialized=C=!0)}function s(e,t,n){e.bufferData(e.ARRAY_BUFFER,new Float32Array([t,n,0,n,t,0,0,0]),e.STATIC_DRAW)}function u(e){e.preventDefault(),console.warn("WebGL Context Lost!")}function c(e){e.preventDefault(),t.isWebGLInitialized=C=!1,w.default.purgeCache(),a()}function l(e){E=null;try{var t={preserveDrawingBuffer:!0};E=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),e.removeEventListener("webglcontextlost",u,!1),e.addEventListener("webglcontextlost",u,!1),e.removeEventListener("webglcontextrestored",c,!1),e.addEventListener("webglcontextrestored",c,!1)}catch(e){throw new Error("Error creating WebGL context")}return E||(console.error("Unable to initialize WebGL. Your browser may not support it."),E=null),E}function f(e){if(e.color)return"rgb";var t="int";return e.minPixelValue>=0&&(t="u"+t),e.maxPixelValue>255?t+="16":t+="8",t}function d(e){var t=f(e);return b.shaders.hasOwnProperty(t)?b.shaders[t]:b.shaders.rgb}function p(e){var t={uint8:E.LUMINANCE,int8:E.LUMINANCE_ALPHA,uint16:E.LUMINANCE_ALPHA,int16:E.RGB,rgb:E.RGB},n={int8:1,uint16:2,int16:3,rgb:3},r=f(e),o=t[r],i=E.createTexture();E.bindTexture(E.TEXTURE_2D,i),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.NEAREST),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,E.NEAREST),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.pixelStorei(E.UNPACK_ALIGNMENT,1);var a=b.dataUtilities[r].storedPixelDataToImageData(e,e.width,e.height);return E.texImage2D(E.TEXTURE_2D,0,o,e.width,e.height,0,o,E.UNSIGNED_BYTE,a),{texture:i,sizeInBytes:e.width*e.height*n[r]}}function h(e){var t=w.default.getImageTexture(e.imageId);return t||(t=p(e),w.default.putImageTexture(e,t)),t.texture}function m(){S=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,S),E.bufferData(E.ARRAY_BUFFER,new Float32Array([1,1,0,1,1,0,0,0]),E.STATIC_DRAW),T=E.createBuffer(),E.bindBuffer(E.ARRAY_BUFFER,T),E.bufferData(E.ARRAY_BUFFER,new Float32Array([1,1,0,1,1,0,0,0]),E.STATIC_DRAW)}function g(e,t,n,r,o){E.clearColor(1,0,0,1),E.viewport(0,0,r,o),E.clear(E.COLOR_BUFFER_BIT|E.DEPTH_BUFFER_BIT),E.useProgram(e.program),E.bindBuffer(E.ARRAY_BUFFER,T),E.vertexAttribPointer(e.attributes.texCoordLocation,2,E.FLOAT,!1,0,0),E.bindBuffer(E.ARRAY_BUFFER,S),E.vertexAttribPointer(e.attributes.positionLocation,2,E.FLOAT,!1,0,0);for(var i in t){var a=E.getUniformLocation(e.program,i);if(a){var u=t[i],c=u.type,l=u.value;"i"===c?E.uniform1i(a,l):"f"===c?E.uniform1f(a,l):"2f"===c&&E.uniform2f(a,l[0],l[1])}}s(E,r,o),E.activeTexture(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,n),E.drawArrays(E.TRIANGLE_STRIP,0,4)}function v(e){var t=e.image;j.width=t.width,j.height=t.height;var n=e.viewport,r=d(t),o=h(t);return g(r,{u_resolution:{type:"2f",value:[t.width,t.height]},wc:{type:"f",value:n.voi.windowCenter},ww:{type:"f",value:n.voi.windowWidth},slope:{type:"f",value:t.slope},intercept:{type:"f",value:t.intercept},minPixelValue:{type:"f",value:t.minPixelValue},invert:{type:"i",value:n.invert?1:0}},o,t.width,t.height),j}function y(){var e={failIfMajorPerformanceCaveat:!0};try{var t=document.createElement("canvas");return Boolean(window.WebGLRenderingContext)&&(t.getContext("webgl",e)||t.getContext("experimental-webgl",e))}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.isWebGLInitialized=void 0,t.getRenderCanvas=o,t.initRenderer=a,t.render=v,t.isWebGLAvailable=y;var b=n(55),_=n(61),w=r(n(29)),x=r(n(28)),j=document.createElement("canvas"),E=void 0,T=void 0,S=void 0,C=!1;t.isWebGLInitialized=C},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dataUtilities=t.shaders=void 0;var r=n(56),o=n(57),i=n(58),a=n(59),s=n(60),u={int16:r.int16Shader,int8:o.int8Shader,rgb:i.rgbShader,uint16:a.uint16Shader,uint8:s.uint8Shader},c={int16:r.int16DataUtilities,int8:o.int8DataUtilities,rgb:i.rgbDataUtilities,uint16:a.uint16DataUtilities,uint8:s.uint8DataUtilities};t.shaders=u,t.dataUtilities=c},function(e,t,n){"use strict";function r(e){for(var t=e.getPixelData(),n=new Uint8Array(e.width*e.height*3),r=0,o=0;o>8,10),n[r++]=t[o]<0?0:1}return n}Object.defineProperty(t,"__esModule",{value:!0});var o={};t.int16DataUtilities={storedPixelDataToImageData:r},o.frag="precision mediump float;uniform sampler2D u_image;uniform float ww;uniform float wc;uniform float slope;uniform float intercept;uniform int invert;varying vec2 v_texCoord;void main() {vec4 color = texture2D(u_image, v_texCoord);float intensity = color.r*256.0 + color.g*65536.0;if (color.b == 0.0)intensity = -intensity;intensity = intensity * slope + intercept;float center0 = wc - 0.5;float width0 = max(ww, 1.0);intensity = (intensity - center0) / width0 + 0.5;intensity = clamp(intensity, 0.0, 1.0);gl_FragColor = vec4(intensity, intensity, intensity, 1.0);if (invert == 1)gl_FragColor.rgb = 1.0 - gl_FragColor.rgb;}",t.int16Shader=o},function(e,t,n){"use strict";function r(e){for(var t=e.getPixelData(),n=new Uint8Array(e.width*e.height*2),r=0,o=0;o>8,10)}return n}Object.defineProperty(t,"__esModule",{value:!0});var o={};t.uint16DataUtilities={storedPixelDataToImageData:r},o.frag="precision mediump float;uniform sampler2D u_image;uniform float ww;uniform float wc;uniform float slope;uniform float intercept;uniform int invert;varying vec2 v_texCoord;void main() {vec4 color = texture2D(u_image, v_texCoord);float intensity = color.r*256.0 + color.a*65536.0;intensity = intensity * slope + intercept;float center0 = wc - 0.5;float width0 = max(ww, 1.0);intensity = (intensity - center0) / width0 + 0.5;intensity = clamp(intensity, 0.0, 1.0);gl_FragColor = vec4(intensity, intensity, intensity, 1.0);if (invert == 1)gl_FragColor.rgb = 1.0 - gl_FragColor.rgb;}",t.uint16Shader=o},function(e,t,n){"use strict";function r(e){for(var t=e.getPixelData(),n=new Uint8Array(t.length),r=0;r1)for(var n=1;n0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,i,s;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,r=-1,n===t||o(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],o(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}}},"tty-browserify":{"package.json":function(e,t){t.name="tty-browserify",t.version="0.0.0",t.main="index.js"},"index.js":function(e,t){function n(){throw new Error("tty.ReadStream is not implemented")}function r(){throw new Error("tty.ReadStream is not implemented")}t.isatty=function(){return!1},t.ReadStream=n,t.WriteStream=r}}}},"babel-runtime":{regenerator:{"index.js":function(e,t,n){n.exports=e("regenerator-runtime")}},helpers:{"typeof.js":function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(e("../core-js/symbol/iterator")),o=n(e("../core-js/symbol")),i="function"==typeof o.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":typeof e};t.default="function"==typeof o.default&&"symbol"===i(r.default)?function(e){return void 0===e?"undefined":i(e)}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":void 0===e?"undefined":i(e)}},"toConsumableArray.js":function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(e("../core-js/array/from"));t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=0,a=i&&o.regeneratorRuntime;if(o.regeneratorRuntime=void 0,r.exports=e("./runtime"),i)o.regeneratorRuntime=a;else try{delete o.regeneratorRuntime}catch(e){o.regeneratorRuntime=void 0}},"runtime.js":function(e,n,r){!function(e){"use strict";function t(e,t,n,r){var i=t&&t.prototype instanceof o?t:o,a=Object.create(i.prototype),s=new p(r||[]);return a._invoke=c(e,n,s),a}function n(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function i(){}function a(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function u(t){function r(e,o,i,a){var s=n(t[e],t,o);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&v.call(c,"__await")?Promise.resolve(c.__await).then(function(e){r("next",e,i,a)},function(e){r("throw",e,i,a)}):Promise.resolve(c).then(function(e){u.value=e,i(u)},a)}a(s.arg)}function o(e,t){function n(){return new Promise(function(n,o){r(e,t,n,o)})}return i=i?i.then(n,n):n()}"object"==typeof e.process&&e.process.domain&&(r=e.process.domain.bind(r));var i;this._invoke=o}function c(e,t,r){var o=T;return function i(a,s){if(o===C)throw new Error("Generator is already running");if(o===O){if("throw"===a)throw s;return m()}for(r.method=a,r.arg=s;;){var u=r.delegate;if(u){var c=l(u,r);if(c){if(c===P)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===T)throw o=O,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=C;var f=n(e,t,r);if("normal"===f.type){if(o=r.done?O:S,f.arg===P)continue;return{value:f.arg,done:r.done}}"throw"===f.type&&(o=O,r.method="throw",r.arg=f.arg)}}}function l(e,t){var r=e.iterator[t.method];if(r===y){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=y,l(e,t),"throw"===t.method))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var o=n(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,P;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=y),t.delegate=null,P):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P)}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function d(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function p(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function h(e){if(e){var t=e[_];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=v.call(o,"catchLoc"),s=v.call(o,"finallyLoc");if(a&&s){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),d(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;d(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=y),P}}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}},"core-js":{modules:{"es6.symbol.js":function(e){"use strict";var t=e("./_global"),n=e("./_has"),r=e("./_descriptors"),o=e("./_export"),i=e("./_redefine"),a=e("./_meta").KEY,s=e("./_fails"),u=e("./_shared"),c=e("./_set-to-string-tag"),l=e("./_uid"),f=e("./_wks"),d=e("./_wks-ext"),p=e("./_wks-define"),h=e("./_keyof"),m=e("./_enum-keys"),g=e("./_is-array"),v=e("./_an-object"),y=e("./_to-iobject"),b=e("./_to-primitive"),_=e("./_property-desc"),w=e("./_object-create"),x=e("./_object-gopn-ext"),j=e("./_object-gopd"),E=e("./_object-dp"),T=e("./_object-keys"),S=j.f,C=E.f,O=x.f,P=t.Symbol,k=t.JSON,I=k&&k.stringify,M="prototype",A=f("_hidden"),L=f("toPrimitive"),R={}.propertyIsEnumerable,D=u("symbol-registry"),N=u("symbols"),F=u("op-symbols"),W=Object[M],q="function"==typeof P,B=t.QObject,U=!B||!B[M]||!B[M].findChild,H=r&&s(function(){return 7!=w(C({},"a",{get:function(){return C(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=S(W,t);r&&delete W[t],C(e,t,n),r&&e!==W&&C(W,t,r)}:C,z=function(e){var t=N[e]=w(P[M]);return t._k=e,t},V=q&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},G=function e(t,r,o){return t===W&&G(F,r,o),v(t),r=b(r,!0),v(o),n(N,r)?(o.enumerable?(n(t,A)&&t[A][r]&&(t[A][r]=!1),o=w(o,{enumerable:_(0,!1)})):(n(t,A)||C(t,A,_(1,{})),t[A][r]=!0),H(t,r,o)):C(t,r,o)},$=function e(t,n){v(t);for(var r=m(n=y(n)),o=0,i=r.length,a;i>o;)G(t,a=r[o++],n[a]);return t},X=function e(t,n){return void 0===n?w(t):$(w(t),n)},Y=function e(t){var r=R.call(this,t=b(t,!0));return!(this===W&&n(N,t)&&!n(F,t))&&(!(r||!n(this,t)||!n(N,t)||n(this,A)&&this[A][t])||r)},K=function e(t,r){if(t=y(t),r=b(r,!0),t!==W||!n(N,r)||n(F,r)){var o=S(t,r);return!o||!n(N,r)||n(t,A)&&t[A][r]||(o.enumerable=!0),o}},J=function e(t){for(var r=O(y(t)),o=[],i=0,s;r.length>i;)n(N,s=r[i++])||s==A||s==a||o.push(s);return o},Q=function e(t){for(var r=t===W,o=O(r?F:y(t)),i=[],a=0,s;o.length>a;)!n(N,s=o[a++])||r&&!n(W,s)||i.push(N[s]);return i};q||(i((P=function e(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var t=l(arguments.length>0?arguments[0]:void 0),o=function(e){this===W&&o.call(F,e),n(this,A)&&n(this[A],t)&&(this[A][t]=!1),H(this,t,_(1,e))};return r&&U&&H(W,t,{configurable:!0,set:o}),z(t)})[M],"toString",function e(){return this._k}),j.f=K,E.f=G,e("./_object-gopn").f=x.f=J,e("./_object-pie").f=Y,e("./_object-gops").f=Q,r&&!e("./_library")&&i(W,"propertyIsEnumerable",Y,!0),d.f=function(e){return z(f(e))}),o(o.G+o.W+o.F*!q,{Symbol:P});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;Z.length>ee;)f(Z[ee++]);for(var Z=T(f.store),ee=0;Z.length>ee;)p(Z[ee++]);o(o.S+o.F*!q,"Symbol",{for:function(e){return n(D,e+="")?D[e]:D[e]=P(e)},keyFor:function e(t){if(V(t))return h(D,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){U=!0},useSimple:function(){U=!1}}),o(o.S+o.F*!q,"Object",{create:X,defineProperty:G,defineProperties:$,getOwnPropertyDescriptor:K,getOwnPropertyNames:J,getOwnPropertySymbols:Q}),k&&o(o.S+o.F*(!q||s(function(){var e=P();return"[null]"!=I([e])||"{}"!=I({a:e})||"{}"!=I(Object(e))})),"JSON",{stringify:function e(t){if(void 0!==t&&!V(t)){for(var n=[t],r=1,o,i;arguments.length>r;)n.push(arguments[r++]);return"function"==typeof(o=n[1])&&(i=o),!i&&g(o)||(o=function(e,t){if(i&&(t=i.call(this,e,t)),!V(t))return t}),n[1]=o,I.apply(k,n)}}}),P[M][L]||e("./_hide")(P[M],L,P[M].valueOf),c(P,"Symbol"),c(Math,"Math",!0),c(t.JSON,"JSON",!0)},"_global.js":function(e,t,n){var r=n.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},"_has.js":function(e,t,n){var r={}.hasOwnProperty;n.exports=function(e,t){return r.call(e,t)}},"_descriptors.js":function(e,t,n){n.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},"_fails.js":function(e,t,n){n.exports=function(e){try{return!!e()}catch(e){return!0}}},"_export.js":function(e,t,n){var r=e("./_global"),o=e("./_core"),i=e("./_hide"),a=e("./_redefine"),s=e("./_ctx"),u="prototype",c=function(e,t,n){var l=e&c.F,f=e&c.G,d=e&c.S,p=e&c.P,h=e&c.B,m=f?r:d?r[t]||(r[t]={}):(r[t]||{})[u],g=f?o:o[t]||(o[t]={}),v=g[u]||(g[u]={}),y,b,_,w;f&&(n=t);for(y in n)_=((b=!l&&m&&void 0!==m[y])?m:n)[y],w=h&&b?s(_,r):p&&"function"==typeof _?s(Function.call,_):_,m&&a(m,y,_,e&c.U),g[y]!=_&&i(g,y,w),p&&v[y]!=_&&(v[y]=_)};r.core=o,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,n.exports=c},"_core.js":function(e,t,n){var r=n.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)},"_hide.js":function(e,t,n){var r=e("./_object-dp"),o=e("./_property-desc");n.exports=e("./_descriptors")?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},"_object-dp.js":function(e,t){var n=e("./_an-object"),r=e("./_ie8-dom-define"),o=e("./_to-primitive"),i=Object.defineProperty;t.f=e("./_descriptors")?Object.defineProperty:function e(t,a,s){if(n(t),a=o(a,!0),n(s),r)try{return i(t,a,s)}catch(e){}if("get"in s||"set"in s)throw TypeError("Accessors not supported!");return"value"in s&&(t[a]=s.value),t}},"_an-object.js":function(e,t,n){var r=e("./_is-object");n.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},"_is-object.js":function(e,t,n){n.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},"_ie8-dom-define.js":function(e,t,n){n.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},"_dom-create.js":function(e,t,n){var r=e("./_is-object"),o=e("./_global").document,i=r(o)&&r(o.createElement);n.exports=function(e){return i?o.createElement(e):{}}},"_to-primitive.js":function(e,t,n){var r=e("./_is-object");n.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},"_property-desc.js":function(e,t,n){n.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"_redefine.js":function(e,t,n){var r=e("./_global"),o=e("./_hide"),i=e("./_has"),a=e("./_uid")("src"),s="toString",u=Function[s],c=(""+u).split(s);e("./_core").inspectSource=function(e){return u.call(e)},(n.exports=function(e,t,n,s){var u="function"==typeof n;u&&(i(n,"name")||o(n,"name",t)),e[t]!==n&&(u&&(i(n,a)||o(n,a,e[t]?""+e[t]:c.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:o(e,t,n):(delete e[t],o(e,t,n)))})(Function.prototype,s,function e(){return"function"==typeof this&&this[a]||u.call(this)})},"_uid.js":function(e,t,n){var r=0,o=Math.random();n.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+o).toString(36))}},"_ctx.js":function(e,t,n){var r=e("./_a-function");n.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},"_a-function.js":function(e,t,n){n.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},"_meta.js":function(e,t,n){var r=e("./_uid")("meta"),o=e("./_is-object"),i=e("./_has"),a=e("./_object-dp").f,s=0,u=Object.isExtensible||function(){return!0},c=!e("./_fails")(function(){return u(Object.preventExtensions({}))}),l=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},f=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!u(e))return"F";if(!t)return"E";l(e)}return e[r].i},d=function(e,t){if(!i(e,r)){if(!u(e))return!0;if(!t)return!1;l(e)}return e[r].w},p=function(e){return c&&h.NEED&&u(e)&&!i(e,r)&&l(e),e},h=n.exports={KEY:r,NEED:!1,fastKey:f,getWeak:d,onFreeze:p}},"_shared.js":function(e,t,n){var r=e("./_global"),o="__core-js_shared__",i=r[o]||(r[o]={});n.exports=function(e){return i[e]||(i[e]={})}},"_set-to-string-tag.js":function(e,t,n){var r=e("./_object-dp").f,o=e("./_has"),i=e("./_wks")("toStringTag");n.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},"_wks.js":function(e,t,n){var r=e("./_shared")("wks"),o=e("./_uid"),i=e("./_global").Symbol,a="function"==typeof i;(n.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))}).store=r},"_wks-ext.js":function(e,t){t.f=e("./_wks")},"_wks-define.js":function(e,t,n){var r=e("./_global"),o=e("./_core"),i=e("./_library"),a=e("./_wks-ext"),s=e("./_object-dp").f;n.exports=function(e){var t=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},"_library.js":function(e,t,n){n.exports=!1},"_keyof.js":function(e,t,n){var r=e("./_object-keys"),o=e("./_to-iobject");n.exports=function(e,t){for(var n=o(e),i=r(n),a=i.length,s=0,u;a>s;)if(n[u=i[s++]]===t)return u}},"_object-keys.js":function(e,t,n){var r=e("./_object-keys-internal"),o=e("./_enum-bug-keys");n.exports=Object.keys||function e(t){return r(t,o)}},"_object-keys-internal.js":function(e,t,n){var r=e("./_has"),o=e("./_to-iobject"),i=e("./_array-includes")(!1),a=e("./_shared-key")("IE_PROTO");n.exports=function(e,t){var n=o(e),s=0,u=[],c;for(c in n)c!=a&&r(n,c)&&u.push(c);for(;t.length>s;)r(n,c=t[s++])&&(~i(u,c)||u.push(c));return u}},"_to-iobject.js":function(e,t,n){var r=e("./_iobject"),o=e("./_defined");n.exports=function(e){return r(o(e))}},"_iobject.js":function(e,t,n){var r=e("./_cof");n.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},"_cof.js":function(e,t,n){var r={}.toString;n.exports=function(e){return r.call(e).slice(8,-1)}},"_defined.js":function(e,t,n){n.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},"_array-includes.js":function(e,t,n){var r=e("./_to-iobject"),o=e("./_to-length"),i=e("./_to-index");n.exports=function(e){return function(t,n,a){var s=r(t),u=o(s.length),c=i(a,u),l;if(e&&n!=n){for(;u>c;)if((l=s[c++])!=l)return!0}else for(;u>c;c++)if((e||c in s)&&s[c]===n)return e||c||0;return!e&&-1}}},"_to-length.js":function(e,t,n){var r=e("./_to-integer"),o=Math.min;n.exports=function(e){return e>0?o(r(e),9007199254740991):0}},"_to-integer.js":function(e,t,n){var r=Math.ceil,o=Math.floor;n.exports=function(e){return isNaN(e=+e)?0:(e>0?o:r)(e)}},"_to-index.js":function(e,t,n){var r=e("./_to-integer"),o=Math.max,i=Math.min;n.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},"_shared-key.js":function(e,t,n){var r=e("./_shared")("keys"),o=e("./_uid");n.exports=function(e){return r[e]||(r[e]=o(e))}},"_enum-bug-keys.js":function(e,t,n){n.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"_enum-keys.js":function(e,t,n){var r=e("./_object-keys"),o=e("./_object-gops"),i=e("./_object-pie");n.exports=function(e){var t=r(e),n=o.f;if(n)for(var a=n(e),s=i.f,u=0,c;a.length>u;)s.call(e,c=a[u++])&&t.push(c);return t}},"_object-gops.js":function(e,t){t.f=Object.getOwnPropertySymbols},"_object-pie.js":function(e,t){t.f={}.propertyIsEnumerable},"_is-array.js":function(e,t,n){var r=e("./_cof");n.exports=Array.isArray||function e(t){return"Array"==r(t)}},"_object-create.js":function(e,t,n){var r=e("./_an-object"),o=e("./_object-dps"),i=e("./_enum-bug-keys"),a=e("./_shared-key")("IE_PROTO"),s=function(){},u="prototype",c=function(){var t=e("./_dom-create")("iframe"),n=i.length,r="<",o=">",a;for(t.style.display="none",e("./_html").appendChild(t),t.src="javascript:",(a=t.contentWindow.document).open(),a.write(" - - - - OHIF DICOM Viewer - - - - - - - - - - - \ No newline at end of file diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/FontAwesome.otf b/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/FontAwesome.otf deleted file mode 100644 index 401ec0f36..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/FontAwesome.otf and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.eot b/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.eot deleted file mode 100644 index e9f60ca95..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.eot and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.svg b/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.svg deleted file mode 100644 index 855c845e5..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.svg +++ /dev/null @@ -1,2671 +0,0 @@ - - - - -Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 - By ,,, -Copyright Dave Gandy 2016. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.ttf b/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.ttf deleted file mode 100644 index 35acda2fa..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.woff b/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.woff deleted file mode 100644 index 400014a4b..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.woff2 b/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 4d13fc604..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/fortawesome_fontawesome/upstream/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js b/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js deleted file mode 100644 index 3c62e3cde..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! CharLS.js - v2.0.1 - 2016-06-08 | (c) 2016 Chris Hafey | https://github.com/chafey/charls */ -var CharLS=function(Module){Module=Module||{};var Module;if(!Module)Module=(typeof CharLS!=="undefined"?CharLS:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"](filename)){filename=path.join(__dirname,"..","src",filename);ret=nodeFS["readFileSync"](filename)}if(ret&&!binary)ret=ret.toString();return ret};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available (jsc?)"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.log(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?function(x){dump(x)}:function(x){}}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=function(title){document.title=title}}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=function(){}}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}var Runtime={setTempRet0:function(value){tempRet0=value},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(stackTop){STACKTOP=stackTop},getNativeTypeSize:function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}},getNativeFieldSize:function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr},getAlignSize:function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)},dynCall:function(sig,ptr,args){if(args&&args.length){if(!args.splice)args=Array.prototype.slice.call(args);args.splice(0,0,ptr);return Module["dynCall_"+sig].apply(null,args)}else{return Module["dynCall_"+sig].call(null,ptr)}},functionPointers:[],addFunction:function(func){for(var i=0;i=TOTAL_MEMORY){var success=enlargeMemory();if(!success){DYNAMICTOP=ret;return 0}}return ret},alignMemory:function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret},makeBigInt:function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;var __THREW__=0;var ABORT=false;var EXITSTATUS=0;var undef=0;var tempValue,tempInt,tempBigInt,tempInt2,tempBigInt2,tempPair,tempBigIntI,tempBigIntR,tempBigIntS,tempBigIntP,tempBigIntD,tempDouble,tempFloat;var tempI64,tempI64b;var tempRet0,tempRet1,tempRet2,tempRet3,tempRet4,tempRet5,tempRet6,tempRet7,tempRet8,tempRet9;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var globalScope=this;function getCFunc(ident){var func=Module["_"+ident];if(!func){try{func=eval("_"+ident)}catch(e){}}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;(function(){var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret},stringToC:function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=Runtime.stackAlloc((str.length<<2)+1);writeStringToMemory(str,ret)}return ret}};var toC={string:JSfuncs["stringToC"],array:JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}Module["Pointer_stringify"]=Pointer_stringify;function AsciiToString(ptr){var str="";while(1){var ch=HEAP8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;function UTF8ArrayToString(u8Array,idx){var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}Module["UTF8ArrayToString"]=UTF8ArrayToString;function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}Module["UTF8ToString"]=UTF8ToString;function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}Module["stringToUTF8Array"]=stringToUTF8Array;function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}Module["stringToUTF8"]=stringToUTF8;function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}Module["lengthBytesUTF8"]=lengthBytesUTF8;function UTF16ToString(ptr){var i=0;var str="";while(1){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)return str;++i;str+=String.fromCharCode(codeUnit)}}Module["UTF16ToString"]=UTF16ToString;function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}Module["stringToUTF16"]=stringToUTF16;function lengthBytesUTF16(str){return str.length*2}Module["lengthBytesUTF16"]=lengthBytesUTF16;function UTF32ToString(ptr){var i=0;var str="";while(1){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)return str;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}}Module["UTF32ToString"]=UTF32ToString;function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}Module["stringToUTF32"]=stringToUTF32;function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}Module["lengthBytesUTF32"]=lengthBytesUTF32;function demangle(func){var hasLibcxxabi=!!Module["___cxa_demangle"];if(hasLibcxxabi){try{var buf=_malloc(func.length);writeStringToMemory(func.substr(1),buf);var status=_malloc(4);var ret=Module["___cxa_demangle"](buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}}var i=3;var basicTypes={v:"void",b:"bool",c:"char",s:"short",i:"int",l:"long",f:"float",d:"double",w:"wchar_t",a:"signed char",h:"unsigned char",t:"unsigned short",j:"unsigned int",m:"unsigned long",x:"long long",y:"unsigned long long",z:"..."};var subs=[];var first=true;function dump(x){if(x)Module.print(x);Module.print(func);var pre="";for(var a=0;a"}else{ret=name}paramLoop:while(i0){var c=func[i++];if(c in basicTypes){list.push(basicTypes[c])}else{switch(c){case"P":list.push(parse(true,1,true)[0]+"*");break;case"R":list.push(parse(true,1,true)[0]+"&");break;case"L":{i++;var end=func.indexOf("E",i);var size=end-i;list.push(func.substr(i,size));i+=size+2;break};case"A":{var size=parseInt(func.substr(i));i+=size.toString().length;if(func[i]!=="_")throw"?";i++;list.push(parse(true,1,true)[0]+" ["+size+"]");break};case"E":break paramLoop;default:ret+="?"+c;break paramLoop}}}if(!allowVoid&&list.length===1&&list[0]==="void")list=[];if(rawList){if(ret){list.push(ret+"?")}return list}else{return ret+flushList()}}var parsed=func;try{if(func=="Object._main"||func=="_main"){return"main()"}if(typeof func==="number")func=Pointer_stringify(func);if(func[0]!=="_")return func;if(func[1]!=="_")return func;if(func[2]!=="Z")return func;switch(func[3]){case"n":return"operator new()";case"d":return"operator delete()"}parsed=parse()}catch(e){parsed+="?"}if(parsed.indexOf("?")>=0&&!hasLibcxxabi){Runtime.warnOnce("warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling")}return parsed}function demangleAll(text){return text.replace(/__Z[\w\d_]+/g,function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"})}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){return demangleAll(jsStackTrace())}Module["stackTrace"]=stackTrace;var PAGE_SIZE=4096;function alignMemoryPage(x){if(x%4096>0){x+=4096-x%4096}return x}var HEAP;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var STATIC_BASE=0,STATICTOP=0,staticSealed=false;var STACK_BASE=0,STACKTOP=0,STACK_MAX=0;var DYNAMIC_BASE=0,DYNAMICTOP=0;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||4e8;var totalMemory=64*1024;while(totalMemory0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Runtime.dynCall("v",func)}else{Runtime.dynCall("vi",func,[callback.arg])}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){var array=intArrayFromString(string,dontAddNull);var i=0;while(i>0]=chr;i=i+1}}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){for(var i=0;i>0]=array[i]}}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=half&&(bits<=32||value>half)){value=-2*half+value}return value}if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32};Math.clz32=Math["clz32"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_min=Math.min;var Math_clz32=Math.clz32;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var memoryInitializer=null;var ASM_CONSTS=[];STATIC_BASE=8;STATICTOP=STATIC_BASE+59744;__ATINIT__.push({func:function(){__GLOBAL__I_000101()}},{func:function(){__GLOBAL__sub_I_jpegls_cpp()}},{func:function(){__GLOBAL__sub_I_iostream_cpp()}});allocate([0,0,0,0,0,0,0,0,84,144,0,0,31,194,0,0,216,0,0,0,0,0,0,0,84,144,0,0,237,191,0,0,48,0,0,0,0,0,0,0,44,144,0,0,41,192,0,0,84,144,0,0,55,192,0,0,48,0,0,0,0,0,0,0,84,144,0,0,115,192,0,0,48,0,0,0,0,0,0,0,84,144,0,0,175,192,0,0,152,3,0,0,0,0,0,0,84,144,0,0,241,192,0,0,216,3,0,0,0,0,0,0,84,144,0,0,55,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,95,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,135,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,175,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,216,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,241,193,0,0,48,0,0,0,0,0,0,0,44,144,0,0,13,194,0,0,84,144,0,0,80,194,0,0,216,0,0,0,0,0,0,0,84,144,0,0,44,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,139,194,0,0,48,0,0,0,0,0,0,0,84,144,0,0,179,194,0,0,48,0,0,0,0,0,0,0,84,144,0,0,219,194,0,0,48,0,0,0,0,0,0,0,84,144,0,0,3,195,0,0,48,0,0,0,0,0,0,0,84,144,0,0,103,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,157,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,211,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,8,196,0,0,216,0,0,0,0,0,0,0,84,144,0,0,71,196,0,0,216,0,0,0,0,0,0,0,84,144,0,0,138,196,0,0,160,1,0,0,0,0,0,0,44,144,0,0,120,196,0,0,84,144,0,0,187,196,0,0,160,1,0,0,0,0,0,0,84,144,0,0,246,196,0,0,160,1,0,0,0,0,0,0,84,144,0,0,49,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,103,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,157,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,210,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,17,198,0,0,160,1,0,0,0,0,0,0,84,144,0,0,86,198,0,0,72,3,0,0,0,0,0,0,84,144,0,0,162,198,0,0,56,2,0,0,0,0,0,0,44,144,0,0,182,198,0,0,84,144,0,0,196,198,0,0,56,2,0,0,0,0,0,0,84,144,0,0,112,199,0,0,96,2,0,0,0,0,0,0,44,144,0,0,125,199,0,0,84,144,0,0,138,199,0,0,96,2,0,0,0,0,0,0,44,144,0,0,156,199,0,0,84,144,0,0,169,199,0,0,96,2,0,0,0,0,0,0,84,144,0,0,181,199,0,0,120,2,0,0,0,0,0,0,84,144,0,0,214,199,0,0,144,2,0,0,0,0,0,0,84,144,0,0,28,200,0,0,144,2,0,0,0,0,0,0,84,144,0,0,248,199,0,0,176,2,0,0,0,0,0,0,84,144,0,0,62,200,0,0,160,2,0,0,0,0,0,0,84,144,0,0,99,200,0,0,160,2,0,0,0,0,0,0,84,144,0,0,182,221,0,0,160,3,0,0,0,0,0,0,84,144,0,0,245,221,0,0,160,3,0,0,0,0,0,0,84,144,0,0,13,222,0,0,152,3,0,0,0,0,0,0,84,144,0,0,38,222,0,0,152,3,0,0,0,0,0,0,44,144,0,0,62,222,0,0,84,144,0,0,87,222,0,0,104,2,0,0,0,0,0,0,44,144,0,0,110,222,0,0,84,144,0,0,135,222,0,0,72,3,0,0,0,0,0,0,84,144,0,0,161,222,0,0,56,3,0,0,0,0,0,0,44,144,0,0,187,222,0,0,84,144,0,0,205,222,0,0,112,3,0,0,0,0,0,0,84,144,0,0,247,222,0,0,112,3,0,0,0,0,0,0,44,144,0,0,33,223,0,0,44,144,0,0,82,223,0,0,124,144,0,0,131,223,0,0,0,0,0,0,1,0,0,0,120,3,0,0,3,244,255,255,124,144,0,0,178,223,0,0,0,0,0,0,1,0,0,0,136,3,0,0,3,244,255,255,124,144,0,0,225,223,0,0,0,0,0,0,1,0,0,0,120,3,0,0,3,244,255,255,124,144,0,0,16,224,0,0,0,0,0,0,1,0,0,0,136,3,0,0,3,244,255,255,84,144,0,0,63,224,0,0,80,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,144,0,0,187,224,0,0,48,3,0,0,0,0,0,0,124,144,0,0,209,224,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,64,10,0,0,2,0,0,0,124,144,0,0,227,224,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,124,144,0,0,5,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,124,144,0,0,40,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,84,144,0,0,75,225,0,0,144,4,0,0,0,0,0,0,84,144,0,0,109,225,0,0,144,4,0,0,0,0,0,0,124,144,0,0,144,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,84,144,0,0,178,225,0,0,32,4,0,0,0,0,0,0,84,144,0,0,200,225,0,0,32,4,0,0,0,0,0,0,84,144,0,0,220,225,0,0,32,4,0,0,0,0,0,0,124,144,0,0,240,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,64,10,0,0,2,0,0,0,84,144,0,0,2,226,0,0,32,4,0,0,0,0,0,0,84,144,0,0,23,226,0,0,32,4,0,0,0,0,0,0,124,144,0,0,44,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,80,10,0,0,0,0,0,0,124,144,0,0,112,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,104,10,0,0,0,0,0,0,124,144,0,0,180,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,128,10,0,0,0,0,0,0,124,144,0,0,248,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,152,10,0,0,0,0,0,0,124,144,0,0,60,227,0,0,0,0,0,0,3,0,0,0,32,4,0,0,2,0,0,0,176,10,0,0,2,0,0,0,184,10,0,0,0,8,0,0,124,144,0,0,129,227,0,0,0,0,0,0,3,0,0,0,32,4,0,0,2,0,0,0,176,10,0,0,2,0,0,0,192,10,0,0,0,8,0,0,124,144,0,0,198,227,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,200,10,0,0,0,8,0,0,124,144,0,0,11,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,200,10,0,0,0,8,0,0,124,144,0,0,80,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,108,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,136,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,164,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,192,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,216,10,0,0,0,0,0,0,124,144,0,0,6,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,224,10,0,0,0,0,0,0,124,144,0,0,76,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,232,10,0,0,0,0,0,0,124,144,0,0,146,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,240,10,0,0,0,0,0,0,124,144,0,0,216,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,248,10,0,0,2,0,0,0,124,144,0,0,237,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,248,10,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,144,0,0,73,233,0,0,44,144,0,0,50,233,0,0,124,144,0,0,28,233,0,0,0,0,0,0,1,0,0,0,8,11,0,0,0,0,0,0,124,144,0,0,237,232,0,0,0,0,0,0,1,0,0,0,8,11,0,0,0,0,0,0,124,144,0,0,215,232,0,0,0,0,0,0,1,0,0,0,0,11,0,0,0,0,0,0,124,144,0,0,168,232,0,0,0,0,0,0,1,0,0,0,0,11,0,0,0,0,0,0,44,144,0,0,149,232,0,0,44,144,0,0,115,232,0,0,44,144,0,0,81,232,0,0,44,144,0,0,60,232,0,0,44,144,0,0,39,232,0,0,44,144,0,0,14,232,0,0,44,144,0,0,245,231,0,0,44,144,0,0,220,231,0,0,44,144,0,0,195,231,0,0,44,144,0,0,171,231,0,0,44,144,0,0,190,232,0,0,44,144,0,0,3,233],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([156,143,0,0,0,0,0,0,8,2,0,0,1,0,0,0,2,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,248,1,0,0,3,0,0,0,4,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,232,1,0,0,5,0,0,0,6,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,216,1,0,0,7,0,0,0,8,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,0,0,0,0,200,1,0,0,9,0,0,0,10,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,0,0,0,0,184,1,0,0,11,0,0,0,12,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,168,1,0,0,13,0,0,0,14,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,144,1,0,0,15,0,0,0,16,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,128,1,0,0,17,0,0,0,18,0,0,0,9,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,112,1,0,0,19,0,0,0,20,0,0,0,10,0,0,0,2,0,0,0,10,0,0,0,0,0,0,0,96,1,0,0,21,0,0,0,22,0,0,0,11,0,0,0,3,0,0,0,11,0,0,0,0,0,0,0,80,1,0,0,23,0,0,0,24,0,0,0,12,0,0,0,4,0,0,0,12,0,0,0,0,0,0,0,64,1,0,0,25,0,0,0,26,0,0,0,13,0,0,0,5,0,0,0,13,0,0,0,0,0,0,0,240,0,0,0,27,0,0,0,28,0,0,0,14,0,0,0,6,0,0,0,14,0,0,0,0,0,0,0,224,0,0,0,29,0,0,0,30,0,0,0,15,0,0,0,7,0,0,0,15,0,0,0,0,0,0,0,16,0,0,0,31,0,0,0,32,0,0,0,16,0,0,0,8,0,0,0,16,0,0,0,0,0,0,0,200,0,0,0,33,0,0,0,34,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,184,0,0,0,33,0,0,0,35,0,0,0,3,0,0,0,4,0,0,0,56,0,0,0,0,0,0,0,216,3,0,0,36,0,0,0,37,0,0,0,200,255,255,255,200,255,255,255,216,3,0,0,38,0,0,0,39,0,0,0,56,0,0,0,0,0,0,0,104,0,0,0,40,0,0,0,41,0,0,0,200,255,255,255,200,255,255,255,104,0,0,0,42,0,0,0,43,0,0,0,0,0,0,0,88,0,0,0,44,0,0,0,45,0,0,0,17,0,0,0,1,0,0,0,1,0,0,0,5,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,17,0,0,0,3,0,0,0,18,0,0,0,104,141,0,0,64,141,0,0,84,141,0,0,124,141,0,0,0,0,0,0,32,0,0,0,46,0,0,0,47,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,56,0,0,0,48,0,0,0,49,0,0,0,8,0,0,0,9,0,0,0,0,0,0,0,72,0,0,0,50,0,0,0,51,0,0,0,10,0,0,0,11,0,0,0,0,0,0,0,120,0,0,0,52,0,0,0,53,0,0,0,12,0,0,0,13,0,0,0,0,0,0,0,136,0,0,0,54,0,0,0,55,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,152,0,0,0,56,0,0,0,57,0,0,0,16,0,0,0,17,0,0,0,0,0,0,0,168,0,0,0,58,0,0,0,59,0,0,0,18,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,216,0,0,0,60,0,0,0,61,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,62,0,0,0,63,0,0,0,20,0,0,0,21,0,0,0,0,0,0,0,16,1,0,0,64,0,0,0,65,0,0,0,22,0,0,0,23,0,0,0,0,0,0,0,32,1,0,0,66,0,0,0,67,0,0,0,24,0,0,0,25,0,0,0,0,0,0,0,48,1,0,0,68,0,0,0,69,0,0,0,26,0,0,0,27,0,0,0,0,0,0,0,160,1,0,0,70,0,0,0,71,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,24,2,0,0,72,0,0,0,73,0,0,0,5,0,0,0,1,0,0,0,4,0,0,0,5,0,0,0,2,0,0,0,0,0,0,0,40,2,0,0,74,0,0,0,75,0,0,0,18,0,0,0,0,0,0,0,64,2,0,0,76,0,0,0,77,0,0,0,19,0,0,0,2,0,0,0,0,0,0,0,80,2,0,0,78,0,0,0,79,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,104,2,0,0,80,0,0,0,81,0,0,0,7,0,0,0,0,0,0,0,128,2,0,0,82,0,0,0,83,0,0,0,8,0,0,0,0,0,0,0,160,2,0,0,84,0,0,0,85,0,0,0,86,0,0,0,87,0,0,0,6,0,0,0,2,0,0,0,9,0,0,0,28,0,0,0,0,0,0,0,208,2,0,0,84,0,0,0,88,0,0,0,86,0,0,0,87,0,0,0,6,0,0,0,3,0,0,0,10,0,0,0,29,0,0,0,0,0,0,0,224,2,0,0,84,0,0,0,89,0,0,0,86,0,0,0,87,0,0,0,6,0,0,0,4,0,0,0,11,0,0,0,30,0,0,0,0,0,0,0,0,0,0,0,1,203,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,192,3,0,0,192,4,0,0,192,5,0,0,192,6,0,0,192,7,0,0,192,8,0,0,192,9,0,0,192,10,0,0,192,11,0,0,192,12,0,0,192,13,0,0,192,14,0,0,192,15,0,0,192,16,0,0,192,17,0,0,192,18,0,0,192,19,0,0,192,20,0,0,192,21,0,0,192,22,0,0,192,23,0,0,192,24,0,0,192,25,0,0,192,26,0,0,192,27,0,0,192,28,0,0,192,29,0,0,192,30,0,0,192,31,0,0,192,0,0,0,179,1,0,0,195,2,0,0,195,3,0,0,195,4,0,0,195,5,0,0,195,6,0,0,195,7,0,0,195,8,0,0,195,9,0,0,195,10,0,0,195,11,0,0,195,12,0,0,195,13,0,0,211,14,0,0,195,15,0,0,195,0,0,12,187,1,0,12,195,2,0,12,195,3,0,12,195,4,0,12,211,88,146,0,0,200,146,0,0,56,147,0,0,56,147,0,0,120,187,0,0,168,155,0,0,168,149,0,0,0,0,0,0,10,0,0,0,100,0,0,0,232,3,0,0,16,39,0,0,160,134,1,0,64,66,15,0,128,150,152,0,0,225,245,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,9,0,0,0,159,219,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,9,0,0,0,151,215,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,9,0,0,0,143,211,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,20,0,0,0,21,0,0,0,22,0,0,0,23,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,38,0,0,0,39,0,0,0,40,0,0,0,41,0,0,0,42,0,0,0,43,0,0,0,44,0,0,0,45,0,0,0,46,0,0,0,47,0,0,0,48,0,0,0,49,0,0,0,50,0,0,0,51,0,0,0,52,0,0,0,53,0,0,0,54,0,0,0,55,0,0,0,56,0,0,0,57,0,0,0,58,0,0,0,59,0,0,0,60,0,0,0,61,0,0,0,62,0,0,0,63,0,0,0,64,0,0,0,65,0,0,0,66,0,0,0,67,0,0,0,68,0,0,0,69,0,0,0,70,0,0,0,71,0,0,0,72,0,0,0,73,0,0,0,74,0,0,0,75,0,0,0,76,0,0,0,77,0,0,0,78,0,0,0,79,0,0,0,80,0,0,0,81,0,0,0,82,0,0,0,83,0,0,0,84,0,0,0,85,0,0,0,86,0,0,0,87,0,0,0,88,0,0,0,89,0,0,0,90,0,0,0,91,0,0,0,92,0,0,0,93,0,0,0,94,0,0,0,95,0,0,0,96,0,0,0,65,0,0,0,66,0,0,0,67,0,0,0,68,0,0,0,69,0,0,0,70,0,0,0,71,0,0,0,72,0,0,0,73,0,0,0,74,0,0,0,75,0,0,0,76,0,0,0,77,0,0,0,78,0,0,0,79,0,0,0,80,0,0,0,81,0,0,0,82,0,0,0,83,0,0,0,84,0,0,0,85,0,0,0,86,0,0,0,87,0,0,0,88,0,0,0,89,0,0,0,90,0,0,0,123,0,0,0,124,0,0,0,125,0,0,0,126,0,0,0,127],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+35640);allocate([1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,20,0,0,0,21,0,0,0,22,0,0,0,23,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,38,0,0,0,39,0,0,0,40,0,0,0,41,0,0,0,42,0,0,0,43,0,0,0,44,0,0,0,45,0,0,0,46,0,0,0,47,0,0,0,48,0,0,0,49,0,0,0,50,0,0,0,51,0,0,0,52,0,0,0,53,0,0,0,54,0,0,0,55,0,0,0,56,0,0,0,57,0,0,0,58,0,0,0,59,0,0,0,60,0,0,0,61,0,0,0,62,0,0,0,63,0,0,0,64,0,0,0,97,0,0,0,98,0,0,0,99,0,0,0,100,0,0,0,101,0,0,0,102,0,0,0,103,0,0,0,104,0,0,0,105,0,0,0,106,0,0,0,107,0,0,0,108,0,0,0,109,0,0,0,110,0,0,0,111,0,0,0,112,0,0,0,113,0,0,0,114,0,0,0,115,0,0,0,116,0,0,0,117,0,0,0,118,0,0,0,119,0,0,0,120,0,0,0,121,0,0,0,122,0,0,0,91,0,0,0,92,0,0,0,93,0,0,0,94,0,0,0,95,0,0,0,96,0,0,0,97,0,0,0,98,0,0,0,99,0,0,0,100,0,0,0,101,0,0,0,102,0,0,0,103,0,0,0,104,0,0,0,105,0,0,0,106,0,0,0,107,0,0,0,108,0,0,0,109,0,0,0,110,0,0,0,111,0,0,0,112,0,0,0,113,0,0,0,114,0,0,0,115,0,0,0,116,0,0,0,117,0,0,0,118,0,0,0,119,0,0,0,120,0,0,0,121,0,0,0,122,0,0,0,123,0,0,0,124,0,0,0,125,0,0,0,126,0,0,0,127],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+39844);allocate([240,2,0,0,90,0,0,0,91,0,0,0,20,0,0,0,12,0,0,0,5,0,0,0,31,0,0,0,10,0,0,0,11,0,0,0,13,0,0,0,12,0,0,0,13,0,0,0,19,0,0,0,14,0,0,0,20,0,0,0,0,0,0,0,0,3,0,0,90,0,0,0,92,0,0,0,21,0,0,0,12,0,0,0,5,0,0,0,31,0,0,0,14,0,0,0,11,0,0,0,13,0,0,0,15,0,0,0,16,0,0,0,21,0,0,0,15,0,0,0,22,0,0,0,0,0,0,0,16,3,0,0,93,0,0,0,94,0,0,0,22,0,0,0,1,0,0,0,6,0,0,0,32,0,0,0,17,0,0,0,2,0,0,0,2,0,0,0,18,0,0,0,4,0,0,0,23,0,0,0,16,0,0,0,24,0,0,0,0,0,0,0,32,3,0,0,93,0,0,0,95,0,0,0,23,0,0,0,1,0,0,0,6,0,0,0,32,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,19,0,0,0,20,0,0,0,25,0,0,0,3,0,0,0,26,0,0,0,0,0,0,0,56,3,0,0,96,0,0,0,97,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,3,0,0,93,0,0,0,98,0,0,0,17,0,0,0,1,0,0,0,6,0,0,0,32,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,18,0,0,0,4,0,0,0,23,0,0,0,3,0,0,0,26,0,0,0,0,0,0,0,160,3,0,0,90,0,0,0,99,0,0,0,24,0,0,0,12,0,0,0,5,0,0,0,31,0,0,0,14,0,0,0,11,0,0,0,13,0,0,0,12,0,0,0,13,0,0,0,19,0,0,0,15,0,0,0,22,0,0,0,8,0,0,0,0,0,0,0,168,3,0,0,100,0,0,0,101,0,0,0,248,255,255,255,248,255,255,255,168,3,0,0,102,0,0,0,103,0,0,0,8,0,0,0,0,0,0,0,192,3,0,0,104,0,0,0,105,0,0,0,248,255,255,255,248,255,255,255,192,3,0,0,106,0,0,0,107,0,0,0,4,0,0,0,0,0,0,0,216,3,0,0,36,0,0,0,37,0,0,0,252,255,255,255,252,255,255,255,216,3,0,0,38,0,0,0,39,0,0,0,4,0,0,0,0,0,0,0,240,3,0,0,108,0,0,0,109,0,0,0,252,255,255,255,252,255,255,255,240,3,0,0,110,0,0,0,111,0,0,0,0,0,0,0,96,3,0,0,112,0,0,0,113,0,0,0,7,0,0,0,0,0,0,0,112,3,0,0,114,0,0,0,115,0,0,0,0,0,0,0,8,4,0,0,72,0,0,0,116,0,0,0,21,0,0,0,1,0,0,0,4,0,0,0,5,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,117,0,0,0,118,0,0,0,119,0,0,0,1,0,0,0,33,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,5,0,0,120,0,0,0,121,0,0,0,119,0,0,0,2,0,0,0,34,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,5,0,0,122,0,0,0,123,0,0,0,119,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,5,0,0,124,0,0,0,125,0,0,0,119,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,20,0,0,0,21,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,5,0,0,126,0,0,0,127,0,0,0,119,0,0,0,3,0,0,0,4,0,0,0,23,0,0,0,5,0,0,0,24,0,0,0,1,0,0,0,2,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,5,0,0,128,0,0,0,129,0,0,0,119,0,0,0,7,0,0,0,8,0,0,0,25,0,0,0,9,0,0,0,26,0,0,0,3,0,0,0,4,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,5,0,0,130,0,0,0,131,0,0,0,119,0,0,0,22,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,1,0,0,0,248,255,255,255,224,5,0,0,23,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,132,0,0,0,133,0,0,0,119,0,0,0,30,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,2,0,0,0,248,255,255,255,8,6,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,6,0,0,134,0,0,0,135,0,0,0,119,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,6,0,0,136,0,0,0,137,0,0,0,119,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,6,0,0,138,0,0,0,139,0,0,0,119,0,0,0,38,0,0,0,39,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,40,0,0,0,29,0,0,0,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,6,0,0,140,0,0,0,141,0,0,0,119,0,0,0,41,0,0,0,42,0,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,43,0,0,0,35,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,6,0,0,142,0,0,0,143,0,0,0,119,0,0,0,44,0,0,0,45,0,0,0,37,0,0,0,38,0,0,0,39,0,0,0,40,0,0,0,46,0,0,0,41,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,6,0,0,144,0,0,0,145,0,0,0,119,0,0,0,47,0,0,0,48,0,0,0,43,0,0,0,44,0,0,0,45,0,0,0,46,0,0,0,49,0,0,0,47,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,6,0,0,146,0,0,0,147,0,0,0,119,0,0,0,3,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,7,0,0,148,0,0,0,149,0,0,0,119,0,0,0,5,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,7,0,0,150,0,0,0,151,0,0,0,119,0,0,0,1,0,0,0,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,7,0,0,152,0,0,0,153,0,0,0,119,0,0,0,2,0,0,0,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,7,0,0,154,0,0,0,155,0,0,0,119,0,0,0,19,0,0,0,7,0,0,0,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,7,0,0,156,0,0,0,157,0,0,0,119,0,0,0,20,0,0,0,8,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,4,0,0,158,0,0,0,159,0,0,0,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,5,0,0,160,0,0,0,161,0,0,0,119,0,0,0,27,0,0,0,21,0,0,0,28,0,0,0,22,0,0,0,29,0,0,0,9,0,0,0,23,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,4,0,0,162,0,0,0,163,0,0,0,119,0,0,0,3,0,0,0,4,0,0,0,12,0,0,0,50,0,0,0,51,0,0,0,13,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,5,0,0,164,0,0,0,165,0,0,0,119,0,0,0,53,0,0,0,54,0,0,0,51,0,0,0,52,0,0,0,53,0,0,0,0,0,0,0,80,5,0,0,166,0,0,0,167,0,0,0,119,0,0,0,55,0,0,0,56,0,0,0,54,0,0,0,55,0,0,0,56,0,0,0,0,0,0,0,32,4,0,0,168,0,0,0,169,0,0,0,119,0,0,0,0,0,0,0,48,4,0,0,168,0,0,0,170,0,0,0,119,0,0,0,24,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,30,0,0,0,25,0,0,0,31,0,0,0,26,0,0,0,32,0,0,0,13,0,0,0,27,0,0,0,14,0,0,0,0,0,0,0,80,4,0,0,168,0,0,0,171,0,0,0,119,0,0,0,5,0,0,0,6,0,0,0,15,0,0,0,57,0,0,0,58,0,0,0,16,0,0,0,59,0,0,0,0,0,0,0,112,4,0,0,168,0,0,0,172,0,0,0,119,0,0,0,7,0,0,0,8,0,0,0,17,0,0,0,60,0,0,0,61,0,0,0,18,0,0,0,62,0,0,0,0,0,0,0,144,4,0,0,168,0,0,0,173,0,0,0,119,0,0,0,9,0,0,0,10,0,0,0,19,0,0,0,63,0,0,0,64,0,0,0,20,0,0,0,65,0,0,0,0,0,0,0,176,4,0,0,168,0,0,0,174,0,0,0,119,0,0,0,9,0,0,0,10,0,0,0,19,0,0,0,63,0,0,0,64,0,0,0,20,0,0,0,65,0,0,0,0,0,0,0,192,4,0,0,168,0,0,0,175,0,0,0,119,0,0,0,9,0,0,0,10,0,0,0,19,0,0,0,63,0,0,0,64,0,0,0,20,0,0,0,65,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,37,0,0,0,89,0,0,0,45,0,0,0,37,0,0,0,109,0,0,0,45,0,0,0,37,0,0,0,100,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,0,0,0,114,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,102,0,0,0,97,0,0,0,108,0,0,0,115,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,110,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,114,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,117,0,0,0,114,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,114,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,99,0,0,0,104,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,105,0,0,0,108,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,101,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,121,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,117,0,0,0,115,0,0,0,116,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,116,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,111,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,0,0,0,77,0,0,0,0,0,0,0,80,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,97,0,0,0,32,0,0,0,37,0,0,0,98,0,0,0,32,0,0,0,37,0,0,0,100,0,0,0,32,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,3,32,2,32,2,32,2,32,2,32,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1,96,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,8,216,8,216,8,216,8,216,8,216,8,216,8,216,8,216,8,216,8,216,4,192,4,192,4,192,4,192,4,192,4,192,4,192,8,213,8,213,8,213,8,213,8,213,8,213,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,4,192,4,192,4,192,4,192,4,192,4,192,8,214,8,214,8,214,8,214,8,214,8,214,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,4,192,4,192,4,192,4,192,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,97,119,83,116,114,101,97,109,32,111,114,32,114,97,119,68,97,116,97,32,110,101,101,100,115,32,116,111,32,114,101,102,101,114,101,110,99,101,32,116,111,32,115,111,109,101,116,104,105,110,103,0,119,105,100,116,104,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,49,44,32,54,53,53,51,53,93,0,104,101,105,103,104,116,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,49,44,32,54,53,53,51,53,93,0,98,105,116,115,112,101,114,115,97,109,112,108,101,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,50,44,32,49,54,93,0,105,110,116,101,114,108,101,97,118,101,77,111,100,101,32,110,101,101,100,115,32,116,111,32,98,101,32,115,101,116,32,116,111,32,97,32,118,97,108,117,101,32,111,102,32,123,78,111,110,101,44,32,83,97,109,112,108,101,44,32,76,105,110,101,125,0,99,111,109,112,111,110,101,110,116,115,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,49,44,32,50,53,53,93,0,117,110,99,111,109,112,114,101,115,115,101,100,32,115,105,122,101,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,119,105,116,104,32,116,104,101,32,111,116,104,101,114,32,112,97,114,97,109,101,116,101,114,115,0,105,110,116,101,114,108,101,97,118,101,77,111,100,101,32,99,97,110,110,111,116,32,98,101,32,115,101,116,32,116,111,32,83,97,109,112,108,101,32,105,110,32,99,111,109,98,105,110,97,116,105,111,110,32,119,105,116,104,32,99,111,109,112,111,110,101,110,116,115,32,61,32,52,0,105,110,116,101,114,108,101,97,118,101,77,111,100,101,32,99,97,110,32,111,110,108,121,32,98,101,32,115,101,116,32,116,111,32,78,111,110,101,32,105,110,32,99,111,109,98,105,110,97,116,105,111,110,32,119,105,116,104,32,99,111,109,112,111,110,101,110,116,115,32,61,32,49,0,67,111,108,111,114,32,116,114,97,110,115,102,111,114,109,97,116,105,111,110,32,0,78,111,32,109,111,114,101,32,98,121,116,101,115,32,97,118,97,105,108,97,98,108,101,32,105,110,32,105,110,112,117,116,32,98,117,102,102,101,114,44,32,115,116,105,108,108,32,110,101,101,100,101,100,105,110,103,32,0,65,110,32,111,100,100,32,110,117,109,98,101,114,32,111,102,32,98,121,116,101,115,32,40,0,41,32,99,97,110,110,111,116,32,98,101,32,115,119,97,112,112,101,100,46,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,54,84,114,97,110,115,102,111,114,109,83,104,105,102,116,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,51,73,116,69,69,69,0,49,49,80,114,111,99,101,115,115,76,105,110,101,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,54,84,114,97,110,115,102,111,114,109,83,104,105,102,116,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,50,73,116,69,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,54,84,114,97,110,115,102,111,114,109,83,104,105,102,116,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,49,73,116,69,69,69,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,105,110,103,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,57,98,97,115,105,99,95,111,115,116,114,105,110,103,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,51,73,116,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,50,73,116,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,49,73,116,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,51,84,114,97,110,115,102,111,114,109,78,111,110,101,73,116,69,69,0,50,50,80,111,115,116,80,114,111,99,101,115,83,105,110,103,108,101,83,116,114,101,97,109,0,50,53,80,111,115,116,80,114,111,99,101,115,83,105,110,103,108,101,67,111,109,112,111,110,101,110,116,0,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,116,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,55,84,114,105,112,108,101,116,73,116,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,51,73,104,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,50,73,104,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,49,73,104,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,51,84,114,97,110,115,102,111,114,109,78,111,110,101,73,104,69,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,55,84,114,105,112,108,101,116,73,104,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,54,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,50,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,104,76,105,56,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,55,84,114,105,112,108,101,116,73,104,69,76,105,56,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,104,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,116,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,55,84,114,105,112,108,101,116,73,116,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,55,84,114,105,112,108,101,116,73,104,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,54,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,50,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,104,76,105,56,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,55,84,114,105,112,108,101,116,73,104,69,76,105,56,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,104,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,67,104,97,114,76,83,32,101,114,114,111,114,0,99,104,97,114,108,115,0,49,53,99,104,97,114,108,115,95,99,97,116,101,103,111,114,121,0,112,97,114,97,109,115,46,88,116,104,117,109,98,110,97,105,108,32,105,115,32,62,32,48,32,98,117,116,32,112,97,114,97,109,115,46,116,104,117,109,98,110,97,105,108,32,61,61,32,110,117,108,108,95,112,116,114,0,49,55,74,112,101,103,77,97,114,107,101,114,83,101,103,109,101,110,116,0,49,49,74,112,101,103,83,101,103,109,101,110,116,0,50,48,74,112,101,103,73,109,97,103,101,68,97,116,97,83,101,103,109,101,110,116,0,69,120,112,101,99,116,101,100,32,74,80,69,71,32,77,97,114,107,101,114,32,115,116,97,114,116,32,98,121,116,101,32,48,120,70,70,32,98,117,116,32,116,104,101,32,98,121,116,101,32,118,97,108,117,101,32,119,97,115,32,48,120,0,74,80,69,71,32,101,110,99,111,100,105,110,103,32,119,105,116,104,32,109,97,114,107,101,114,32,0,32,105,115,32,110,111,116,32,115,117,112,112,111,114,116,101,100,46,0,85,110,107,110,111,119,110,32,74,80,69,71,32,109,97,114,107,101,114,32,0,32,101,110,99,111,117,110,116,101,114,101,100,46,0,109,114,102,120,0,83,116,57,98,97,100,95,97,108,108,111,99,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,49,51,114,117,110,116,105,109,101,95,101,114,114,111,114,0,83,116,57,116,121,112,101,95,105,110,102,111,0,83,116,56,98,97,100,95,99,97,115,116,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,33,34,98,97,115,105,99,95,115,116,114,105,110,103,32,108,101,110,103,116,104,95,101,114,114,111,114,34,0,47,85,115,101,114,115,47,99,104,97,102,101,121,47,101,109,115,100,107,95,112,111,114,116,97,98,108,101,47,101,109,115,99,114,105,112,116,101,110,47,49,46,51,53,46,48,47,115,121,115,116,101,109,47,105,110,99,108,117,100,101,47,108,105,98,99,120,120,47,115,116,114,105,110,103,0,95,95,116,104,114,111,119,95,108,101,110,103,116,104,95,101,114,114,111,114,0,33,34,118,101,99,116,111,114,32,108,101,110,103,116,104,95,101,114,114,111,114,34,0,47,85,115,101,114,115,47,99,104,97,102,101,121,47,101,109,115,100,107,95,112,111,114,116,97,98,108,101,47,101,109,115,99,114,105,112,116,101,110,47,49,46,51,53,46,48,47,115,121,115,116,101,109,47,105,110,99,108,117,100,101,47,108,105,98,99,120,120,47,118,101,99,116,111,114,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,116,104,114,101,119,32,97,110,32,101,120,99,101,112,116,105,111,110,0,115,116,100,58,58,98,97,100,95,99,97,115,116,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+42396);allocate([32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,105,110,102,105,110,105,116,121,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,255,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,4,7,3,6,5,0,80,79,83,73,88],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+52636);allocate([17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,119,69,69,0,117,110,115,117,112,112,111,114,116,101,100,32,108,111,99,97,108,101,32,102,111,114,32,115,116,97,110,100,97,114,100,32,105,110,112,117,116,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,119,69,69,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,99,69,69,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,99,69,69,0,78,83,116,51,95,95,49,49,52,95,95,115,104,97,114,101,100,95,99,111,117,110,116,69,0,78,83,116,51,95,95,49,49,50,115,121,115,116,101,109,95,101,114,114,111,114,69,0,78,83,116,51,95,95,49,49,52,101,114,114,111,114,95,99,97,116,101,103,111,114,121,69,0,78,83,116,51,95,95,49,49,50,95,95,100,111,95,109,101,115,115,97,103,101,69,0,58,32,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,55,102,97,105,108,117,114,101,69,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,57,95,95,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,69,0,105,111,115,95,98,97,115,101,58,58,99,108,101,97,114,0,105,111,115,116,114,101,97,109,0,117,110,115,112,101,99,105,102,105,101,100,32,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,32,101,114,114,111,114,0,48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,65,66,67,68,69,70,120,88,43,45,112,80,105,73,110,78,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,102,97,99,101,116,69,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,119,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,99,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,115,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,105,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,49,54,95,95,110,97,114,114,111,119,95,116,111,95,117,116,102,56,73,76,106,51,50,69,69,69,0,78,83,116,51,95,95,49,49,55,95,95,119,105,100,101,110,95,102,114,111,109,95,117,116,102,56,73,76,106,51,50,69,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,119,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,95,95,105,109,112,69,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,99,69,69,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,119,69,69,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,99,69,69,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,99,69,69,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,119,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,48,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,49,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,48,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,49,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,99,69,69,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,119,69,69,0,37,112,0,67,0,37,0,0,0,0,0,108,0,108,108,0,0,76,0,37,112,0,0,0,0,37,72,58,37,77,58,37,83,37,109,47,37,100,47,37,121,37,89,45,37,109,45,37,100,37,73,58,37,77,58,37,83,32,37,112,37,72,58,37,77,37,72,58,37,77,58,37,83,108,111,99,97,108,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,48,49,50,51,52,53,54,55,56,57,0,37,76,102,0,109,111,110,101,121,95,103,101,116,32,101,114,114,111,114,0,48,49,50,51,52,53,54,55,56,57,0,37,46,48,76,102,0,116,114,117,101,0,102,97,108,115,101,0,83,117,110,100,97,121,0,77,111,110,100,97,121,0,84,117,101,115,100,97,121,0,87,101,100,110,101,115,100,97,121,0,84,104,117,114,115,100,97,121,0,70,114,105,100,97,121,0,83,97,116,117,114,100,97,121,0,83,117,110,0,77,111,110,0,84,117,101,0,87,101,100,0,84,104,117,0,70,114,105,0,83,97,116,0,74,97,110,117,97,114,121,0,70,101,98,114,117,97,114,121,0,77,97,114,99,104,0,65,112,114,105,108,0,77,97,121,0,74,117,110,101,0,74,117,108,121,0,65,117,103,117,115,116,0,83,101,112,116,101,109,98,101,114,0,79,99,116,111,98,101,114,0,78,111,118,101,109,98,101,114,0,68,101,99,101,109,98,101,114,0,74,97,110,0,70,101,98,0,77,97,114,0,65,112,114,0,74,117,110,0,74,117,108,0,65,117,103,0,83,101,112,0,79,99,116,0,78,111,118,0,68,101,99,0,65,77,0,80,77,0,37,109,47,37,100,47,37,121,0,37,72,58,37,77,58,37,83,0,37,97,32,37,98,32,37,100,32,37,72,58,37,77,58,37,83,32,37,89,0,37,73,58,37,77,58,37,83,32,37,112,0,78,83,116,51,95,95,49,49,51,109,101,115,115,97,103,101,115,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,119,69,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,99,69,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,119,69,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,99,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,48,95,95,116,105,109,101,95,112,117,116,69,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,119,69,69,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,99,69,69,0,78,83,116,51,95,95,49,57,116,105,109,101,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,119,69,69,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,112,117,116,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,99,69,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,119,69,69,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,103,101,116,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,99,69,69,0,78,83,116,51,95,95,49,49,50,99,111,100,101,99,118,116,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,48,99,116,121,112,101,95,98,97,115,101,69,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+56215);var tempDoublePtr=Runtime.alignMemory(allocate(12,"i8",ALLOC_STATIC),8);assert(tempDoublePtr%8==0);function copyTempFloat(ptr){HEAP8[tempDoublePtr]=HEAP8[ptr];HEAP8[tempDoublePtr+1]=HEAP8[ptr+1];HEAP8[tempDoublePtr+2]=HEAP8[ptr+2];HEAP8[tempDoublePtr+3]=HEAP8[ptr+3]}function copyTempDouble(ptr){HEAP8[tempDoublePtr]=HEAP8[ptr];HEAP8[tempDoublePtr+1]=HEAP8[ptr+1];HEAP8[tempDoublePtr+2]=HEAP8[ptr+2];HEAP8[tempDoublePtr+3]=HEAP8[ptr+3];HEAP8[tempDoublePtr+4]=HEAP8[ptr+4];HEAP8[tempDoublePtr+5]=HEAP8[ptr+5];HEAP8[tempDoublePtr+6]=HEAP8[ptr+6];HEAP8[tempDoublePtr+7]=HEAP8[ptr+7]}function _atexit(func,arg){__ATEXIT__.unshift({func:func,arg:arg})}function ___cxa_atexit(){return _atexit.apply(null,arguments)}Module["_i64Subtract"]=_i64Subtract;function ___assert_fail(condition,filename,line,func){ABORT=true;throw"Assertion failed: "+Pointer_stringify(condition)+", at: "+[filename?Pointer_stringify(filename):"unknown filename",line,func?Pointer_stringify(func):"unknown function"]+" at "+stackTrace()}function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}var EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:function(adjusted){if(!adjusted||EXCEPTIONS.infos[adjusted])return adjusted;for(var ptr in EXCEPTIONS.infos){var info=EXCEPTIONS.infos[ptr];if(info.adjusted===adjusted){return ptr}}return adjusted},addRef:function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount++},decRef:function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];assert(info.refcount>0);info.refcount--;if(info.refcount===0){if(info.destructor){Runtime.dynCall("vi",info.destructor,[ptr])}delete EXCEPTIONS.infos[ptr];___cxa_free_exception(ptr)}},clearRef:function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount=0}};function ___resumeException(ptr){if(!EXCEPTIONS.last){EXCEPTIONS.last=ptr}EXCEPTIONS.clearRef(EXCEPTIONS.deAdjust(ptr));throw ptr}function ___cxa_find_matching_catch(){var thrown=EXCEPTIONS.last;if(!thrown){return(asm["setTempRet0"](0),0)|0}var info=EXCEPTIONS.infos[thrown];var throwntype=info.type;if(!throwntype){return(asm["setTempRet0"](0),thrown)|0}var typeArray=Array.prototype.slice.call(arguments);var pointer=Module["___cxa_is_pointer_type"](throwntype);if(!___cxa_find_matching_catch.buffer)___cxa_find_matching_catch.buffer=_malloc(4);HEAP32[___cxa_find_matching_catch.buffer>>2]=thrown;thrown=___cxa_find_matching_catch.buffer;for(var i=0;i>2];info.adjusted=thrown;return(asm["setTempRet0"](typeArray[i]),thrown)|0}}thrown=HEAP32[thrown>>2];return(asm["setTempRet0"](throwntype),thrown)|0}function ___cxa_throw(ptr,type,destructor){EXCEPTIONS.infos[ptr]={ptr:ptr,adjusted:ptr,type:type,destructor:destructor,refcount:0};EXCEPTIONS.last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr}Module["_memset"]=_memset;var _BDtoILow=true;var _emscripten_resume=true;function ___gxx_personality_v0(){}var _emscripten_landingpad=true;function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]);return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?Pointer_stringify(tm_zone):""};var pattern=Pointer_stringify(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){return leadingNulls(date.tm_hour<13?date.tm_hour:date.tm_hour-12,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>0&&date.tm_hour<13){return"AM"}else{return"PM"}},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){var day=new Date(date.tm_year+1900,date.tm_mon+1,date.tm_mday,0,0,0,0);return day.getDay()||7},"%U":function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"},"%V":function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};for(var rule in EXPANSION_RULES_2){if(pattern.indexOf(rule)>=0){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}function _abort(){Module["abort"]()}function _free(){}Module["_free"]=_free;function ___cxa_free_exception(ptr){try{return _free(ptr)}catch(e){}}function ___cxa_end_catch(){if(___cxa_end_catch.rethrown){___cxa_end_catch.rethrown=false;return}asm["setThrew"](0);var ptr=EXCEPTIONS.caught.pop();if(ptr){EXCEPTIONS.decRef(EXCEPTIONS.deAdjust(ptr));EXCEPTIONS.last=0}}function _pthread_once(ptr,func){if(!_pthread_once.seen)_pthread_once.seen={};if(ptr in _pthread_once.seen)return;Runtime.dynCall("v",func);_pthread_once.seen[ptr]=1}function ___lock(){}function ___unlock(){}var PTHREAD_SPECIFIC={};function _pthread_getspecific(key){return PTHREAD_SPECIFIC[key]||0}function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function _sysconf(name){switch(name){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator==="object")return navigator["hardwareConcurrency"]||1;return 1}}___setErrNo(ERRNO_CODES.EINVAL);return-1}var _fabs=Math_abs;var PTHREAD_SPECIFIC_NEXT_KEY=1;function _pthread_key_create(key,destructor){if(key==0){return ERRNO_CODES.EINVAL}HEAP32[key>>2]=PTHREAD_SPECIFIC_NEXT_KEY;PTHREAD_SPECIFIC[PTHREAD_SPECIFIC_NEXT_KEY]=0;PTHREAD_SPECIFIC_NEXT_KEY++;return 0}var PATH=undefined;function _emscripten_set_main_loop_timing(mode,value){Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){setTimeout(Browser.mainLoop.runner,value)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(!window["setImmediate"]){var setImmediates=[];var emscriptenMainLoopMessageId="__emcc";function Browser_setImmediate_messageHandler(event){if(event.source===window&&event.data===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}}window.addEventListener("message",Browser_setImmediate_messageHandler,true);window["setImmediate"]=function Browser_emulated_setImmediate(func){setImmediates.push(func);window.postMessage(emscriptenMainLoopMessageId,"*")}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){window["setImmediate"](Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0}function _emscripten_set_main_loop(func,fps,simulateInfiniteLoop,arg,noSetTiming){Module["noExitRuntime"]=true;assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=func;Browser.mainLoop.arg=arg;var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;Browser.mainLoop.runner=function Browser_mainLoop_runner(){if(ABORT)return;if(Browser.mainLoop.queue.length>0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}console.log('main loop blocker "'+blocker.name+'" took '+(Date.now()-start)+" ms");Browser.mainLoop.updateStatus();setTimeout(Browser.mainLoop.runner,0);return}if(thisMainLoopId1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}if(Browser.mainLoop.method==="timeout"&&Module.ctx){Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!");Browser.mainLoop.method=""}Browser.mainLoop.runIter(function(){if(typeof arg!=="undefined"){Runtime.dynCall("vi",func,[arg])}else{Runtime.dynCall("v",func)}});if(thisMainLoopId0)_emscripten_set_main_loop_timing(0,1e3/fps);else _emscripten_set_main_loop_timing(1,1);Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"SimulateInfiniteLoop"}}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;_emscripten_set_main_loop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus:function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;Browser.safeSetTimeout(function(){finish(audio)},1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);var canvas=Module["canvas"];function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===canvas||document["mozPointerLockElement"]===canvas||document["webkitPointerLockElement"]===canvas||document["msPointerLockElement"]===canvas}if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||function(){};canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||function(){};canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",function(ev){if(!Browser.pointerLock&&canvas.requestPointerLock){canvas.requestPointerLock();ev.preventDefault()}},false)}}},createContext:function(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}canvas.style.backgroundColor="black"}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx==="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});Browser.init()}return ctx},destroyContext:function(canvas,useWebGL,setInModule){},fullScreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullScreen:function(lockPointer,resizeCanvas,vrDevice){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;Browser.vrDevice=vrDevice;if(typeof Browser.lockPointer==="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas==="undefined")Browser.resizeCanvas=false;if(typeof Browser.vrDevice==="undefined")Browser.vrDevice=null;var canvas=Module["canvas"];function fullScreenChange(){Browser.isFullScreen=false;var canvasContainer=canvas.parentNode;if((document["webkitFullScreenElement"]||document["webkitFullscreenElement"]||document["mozFullScreenElement"]||document["mozFullscreenElement"]||document["fullScreenElement"]||document["fullscreenElement"]||document["msFullScreenElement"]||document["msFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.cancelFullScreen=document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["webkitCancelFullScreen"]||document["msExitFullscreen"]||document["exitFullscreen"]||function(){};canvas.cancelFullScreen=canvas.cancelFullScreen.bind(document);if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullScreen=true;if(Browser.resizeCanvas)Browser.setFullScreenCanvasSize()}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas)Browser.setWindowedCanvasSize()}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullScreen);Browser.updateCanvasDimensions(canvas)}if(!Browser.fullScreenHandlersInstalled){Browser.fullScreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullScreenChange,false);document.addEventListener("mozfullscreenchange",fullScreenChange,false);document.addEventListener("webkitfullscreenchange",fullScreenChange,false);document.addEventListener("MSFullscreenChange",fullScreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullScreen=canvasContainer["requestFullScreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullScreen"]?function(){canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"])}:null);if(vrDevice){canvasContainer.requestFullScreen({vrDisplay:vrDevice})}else{canvasContainer.requestFullScreen()}},nextRAF:0,fakeRequestAnimationFrame:function(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame:function requestAnimationFrame(func){if(typeof window==="undefined"){Browser.fakeRequestAnimationFrame(func)}else{if(!window.requestAnimationFrame){window.requestAnimationFrame=window["requestAnimationFrame"]||window["mozRequestAnimationFrame"]||window["webkitRequestAnimationFrame"]||window["msRequestAnimationFrame"]||window["oRequestAnimationFrame"]||Browser.fakeRequestAnimationFrame}window.requestAnimationFrame(func)}},safeCallback:function(func){return function(){if(!ABORT)return func.apply(null,arguments)}},allowAsyncCallbacks:true,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=false},resumeAsyncCallbacks:function(){Browser.allowAsyncCallbacks=true;if(Browser.queuedAsyncCallbacks.length>0){var callbacks=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[];callbacks.forEach(function(func){func()})}},safeRequestAnimationFrame:function(func){return Browser.requestAnimationFrame(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}else{Browser.queuedAsyncCallbacks.push(func)}})},safeSetTimeout:function(func,timeout){Module["noExitRuntime"]=true;return setTimeout(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}else{Browser.queuedAsyncCallbacks.push(func)}},timeout)},safeSetInterval:function(func,timeout){Module["noExitRuntime"]=true;return setInterval(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}},timeout)},getMimetype:function(name){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia:function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)},getMovementX:function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY:function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta:function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail;break;case"mousewheel":delta=event.wheelDelta;break;case"wheel":delta=event["deltaY"];break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!=="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!=="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];if(!last)last=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}},xhrLoad:function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)},asyncLoad:function(url,onload,onerror,noRunDep){Browser.xhrLoad(url,function(arrayBuffer){assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(!noRunDep)removeRunDependency("al "+url)},function(event){if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(!noRunDep)addRunDependency("al "+url)},resizeListeners:[],updateResizeListeners:function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(function(listener){listener(canvas.width,canvas.height)})},setCanvasSize:function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];flags=flags|8388608;HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=flags}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];flags=flags&~8388608;HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=flags}Browser.updateResizeListeners()},updateCanvasDimensions:function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h>2];return ret},getStr:function(){var ret=Pointer_stringify(SYSCALLS.get());return ret},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["_i64Add"]=_i64Add;Module["_bitshift64Lshr"]=_bitshift64Lshr;function ___cxa_pure_virtual(){ABORT=true;throw"Pure virtual function called!"}var _BDtoIHigh=true;function _pthread_cleanup_push(routine,arg){__ATEXIT__.push(function(){Runtime.dynCall("vi",routine,[arg])});_pthread_cleanup_push.level=__ATEXIT__.length}function _pthread_cond_broadcast(){return 0}function ___cxa_guard_acquire(variable){if(!HEAP8[variable>>0]){HEAP8[variable>>0]=1;return 1}return 0}function _pthread_cleanup_pop(){assert(_pthread_cleanup_push.level==__ATEXIT__.length,"cannot pop if something else added meanwhile!");__ATEXIT__.pop();_pthread_cleanup_push.level=__ATEXIT__.length}function ___cxa_guard_release(){}function ___cxa_begin_catch(ptr){__ZSt18uncaught_exceptionv.uncaught_exception--;EXCEPTIONS.caught.push(ptr);EXCEPTIONS.addRef(EXCEPTIONS.deAdjust(ptr));return ptr}function _llvm_eh_typeid_for(type){return type}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _pthread_mutex_lock(){}var _emscripten_postinvoke=true;function _sbrk(bytes){var self=_sbrk;if(!self.called){DYNAMICTOP=alignMemoryPage(DYNAMICTOP);self.called=true;assert(Runtime.dynamicAlloc);self.alloc=Runtime.dynamicAlloc;Runtime.dynamicAlloc=function(){abort("cannot dynamically allocate, sbrk now has control")}}var ret=DYNAMICTOP;if(bytes!=0){var success=self.alloc(bytes);if(!success)return-1>>>0}return ret}Module["_bitshift64Shl"]=_bitshift64Shl;function ___cxa_guard_abort(){}Module["_memmove"]=_memmove;var _emscripten_preinvoke=true;var _BItoD=true;function _pthread_cond_wait(){return 0}function ___cxa_rethrow(){___cxa_end_catch.rethrown=true;var ptr=EXCEPTIONS.caught.pop();EXCEPTIONS.last=ptr;throw ptr}function _pthread_mutex_unlock(){}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){HEAP32[ptr>>2]=ret}return ret}function _pthread_self(){return 0}function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;assert(offset_high===0);FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;if(!___syscall146.buffer)___syscall146.buffer=[];var buffer=___syscall146.buffer;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0]}function $b(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0];a[k+4>>0]=a[b+4>>0];a[k+5>>0]=a[b+5>>0];a[k+6>>0]=a[b+6>>0];a[k+7>>0]=a[b+7>>0]}function ac(a){a=a|0;D=a}function bc(){return D|0}function cc(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+128|0;p=w+44|0;s=w+8|0;l=w+4|0;n=w;q=e+4|0;r=e+8|0;o=0;Aa(35,c[e>>2]|0,c[q>>2]|0,c[r>>2]|0,f|0);m=o;o=0;if(!(m&1)){j=p;h=j+84|0;do{c[j>>2]=c[f>>2];j=j+4|0;f=f+4|0}while((j|0)<(h|0));f=p+12|0;if((c[f>>2]|0)==0?(k=$(((c[p+8>>2]|0)+7|0)/8|0,c[p>>2]|0)|0,c[f>>2]=k,(c[p+24>>2]|0)!=0):0)c[f>>2]=$(c[p+16>>2]|0,k)|0;o=0;ha(176,s|0);m=o;o=0;if(!(m&1)){f=p+56|0;do{if(c[f>>2]|0){o=0;f=ka(66,f|0)|0;m=o;o=0;if(!(m&1)){c[l>>2]=f;h=s+28|0;j=c[h>>2]|0;if(j>>>0<(c[s+32>>2]|0)>>>0){c[j>>2]=f;c[h>>2]=j+4;c[l>>2]=0;t=19;break}o=0;ia(57,s+24|0,l|0);m=o;o=0;if(m&1){h=Na(824,0)|0;f=D;j=c[l>>2]|0;c[l>>2]=0;if(!j)break;Bb[c[(c[j>>2]|0)+4>>2]&255](j);break}else{f=c[l>>2]|0;c[l>>2]=0;if(!f){t=19;break}Bb[c[(c[f>>2]|0)+4>>2]&255](f);t=19;break}}else t=15}else t=19}while(0);a:do{if((t|0)==19){j=p+4|0;k=p+8|0;l=p+16|0;o=0;f=va(14,c[p>>2]|0,c[j>>2]|0,c[k>>2]|0,c[l>>2]|0)|0;m=o;o=0;if(!(m&1)){c[n>>2]=f;m=s+28|0;h=c[m>>2]|0;do{if(h>>>0>=(c[s+32>>2]|0)>>>0){o=0;ia(57,s+24|0,n|0);h=o;o=0;if(h&1){h=Na(824,0)|0;f=D;j=c[n>>2]|0;c[n>>2]=0;if(!j)break a;Bb[c[(c[j>>2]|0)+4>>2]&255](j);break a}else{f=c[n>>2]|0;c[n>>2]=0;if(!f)break;Bb[c[(c[f>>2]|0)+4>>2]&255](f);break}}else{c[h>>2]=f;c[m>>2]=h+4;c[n>>2]=0}}while(0);f=c[p+28>>2]|0;if((f|0)!=0?(o=0,ia(58,s|0,f|0),t=o,o=0,t&1):0){t=15;break}b:do{if(!(c[p+24>>2]|0)){f=$(c[j>>2]|0,c[p>>2]|0)|0;f=$(f,((c[k>>2]|0)+7|0)/8|0)|0;if((c[l>>2]|0)>0){j=0;while(1){o=0;wa(4,s|0,e|0,p|0);t=o;o=0;if(t&1)break;h=c[q>>2]|0;if(h){c[q>>2]=h+f;c[r>>2]=(c[r>>2]|0)-f}j=j+1|0;if((j|0)>=(c[l>>2]|0))break b}h=Na(824,0)|0;f=D;t=16;break a}}else{o=0;wa(4,s|0,e|0,p|0);t=o;o=0;if(t&1){t=15;break a}}}while(0);o=0;ra(33,s|0,b|0)|0;t=o;o=0;if(!(t&1)){c[d>>2]=c[s+16>>2];if(g)a[g>>0]=0;j=s+24|0;f=c[j>>2]|0;if(f){h=c[m>>2]|0;if((h|0)!=(f|0)){do{g=h+-4|0;c[m>>2]=g;h=c[g>>2]|0;c[g>>2]=0;if(h)Bb[c[(c[h>>2]|0)+4>>2]&255](h);h=c[m>>2]|0}while((h|0)!=(f|0));f=c[j>>2]|0}cj(f)}g=0;i=w;return g|0}else t=15}else t=15}}while(0);if((t|0)==15){h=Na(824,0)|0;f=D;t=16}m=s+24|0;j=c[m>>2]|0;if(j){l=s+28|0;k=c[l>>2]|0;if((k|0)!=(j|0)){do{s=k+-4|0;c[l>>2]=s;k=c[s>>2]|0;c[s>>2]=0;if(k)Bb[c[(c[k>>2]|0)+4>>2]&255](k);k=c[l>>2]|0}while((k|0)!=(j|0));j=c[m>>2]|0}cj(j)}}else t=5}else t=5;if((t|0)==5){h=Na(824,0)|0;f=D}s=(f|0)==(Ta(824)|0);k=Va(h|0)|0;f=(g|0)==0;if(!s){if(!f)a[g>>0]=0;Xa();g=14;i=w;return g|0}j=k+12|0;do{if(!f){f=c[j>>2]|0;o=0;h=ua(1)|0;s=o;o=0;if(!(s&1))if((f|0)==(h|0)){ml(g,Eb[c[(c[k>>2]|0)+8>>2]&127](k)|0)|0;t=60;break}else{a[g>>0]=0;t=60;break}}else t=60}while(0);if((t|0)==60?(u=c[j>>2]|0,o=0,v=ua(1)|0,g=o,o=0,!(g&1)):0){g=(u|0)==(v|0)?c[k+8>>2]|0:13;Xa();i=w;return g|0}f=Na()|0;o=0;xa(3);w=o;o=0;if(w&1){w=Na(0)|0;ec(w)}else Ya(f|0);return 0}function dc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0;l=i;i=i+112|0;g=l+96|0;k=l+84|0;m=l+72|0;n=l+60|0;p=l+48|0;q=l+36|0;r=l+24|0;s=l+12|0;t=l;j=(b|0)==0;if((a|0)==0&j){f=Ma(16)|0;o=0;wa(5,g|0,48504,52);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,g|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(g);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}h=c[e>>2]|0;if((h+-1|0)>>>0>65534){f=Ma(16)|0;o=0;wa(5,k|0,48557,41);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,k|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(k);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}g=c[e+4>>2]|0;if((g+-1|0)>>>0>65534){f=Ma(16)|0;o=0;wa(5,m|0,48599,42);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,m|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(m);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}f=c[e+8>>2]|0;if((f+-2|0)>>>0>14){f=Ma(16)|0;o=0;wa(5,n|0,48642,46);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,n|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(n);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}a=c[e+24>>2]|0;if(a>>>0>=3){f=Ma(16)|0;o=0;wa(5,p|0,48689,65);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,p|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(p);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}b=c[e+16>>2]|0;if((b+-1|0)>>>0>254){f=Ma(16)|0;o=0;wa(5,q|0,48755,44);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,q|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(q);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}if(!j?(q=$(g,h)|0,($($(q,(f|0)>8?2:1)|0,b)|0)>>>0>d>>>0):0){f=Ma(16)|0;o=0;wa(5,r|0,48800,58);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,r|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(r);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}switch(b|0){case 4:{if((a|0)!=2){i=l;return}f=Ma(16)|0;o=0;wa(5,s|0,48859,73);t=o;o=0;if(!(t&1)){o=0;b=ua(1)|0;t=o;o=0;if(!(t&1)?(o=0,Aa(36,f|0,1,b|0,s|0),t=o,o=0,!(t&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(s);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}case 3:{i=l;return}default:{if(!a){i=l;return}f=Ma(16)|0;o=0;wa(5,t|0,48933,73);s=o;o=0;if(!(s&1)){o=0;b=ua(1)|0;s=o;o=0;if(!(s&1)?(o=0,Aa(36,f|0,1,b|0,t|0),s=o,o=0,!(s&1)):0){o=0;wa(6,f|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(t);if(!a){t=b;Ya(t|0)}}else b=Na()|0;La(f|0);t=b;Ya(t|0)}}}function ec(a){a=a|0;Va(a|0)|0;jj()}function fc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+128|0;h=n+116|0;j=n;o=0;c[h>>2]=c[d>>2];c[h+4>>2]=c[d+4>>2];c[h+8>>2]=c[d+8>>2];ia(59,j|0,h|0);g=o;o=0;if(!(g&1)){if(e){g=j+16|0;d=g+84|0;do{c[g>>2]=c[e>>2];g=g+4|0;e=e+4|0}while((g|0)<(d|0))}o=0;c[h>>2]=c[b>>2];c[h+4>>2]=c[b+4>>2];c[h+8>>2]=c[b+8>>2];ia(60,j|0,h|0);j=o;o=0;if(!(j&1)){if(f)a[f>>0]=0;m=0;i=n;return m|0}}b=Na(824,0)|0;j=D;j=(j|0)==(Ta(824)|0);b=Va(b|0)|0;d=(f|0)==0;if(!j){if(!d)a[f>>0]=0;Xa();m=14;i=n;return m|0}g=b+12|0;do{if(!d){d=c[g>>2]|0;o=0;e=ua(1)|0;j=o;o=0;if(!(j&1))if((d|0)==(e|0)){ml(f,Eb[c[(c[b>>2]|0)+8>>2]&127](b)|0)|0;m=10;break}else{a[f>>0]=0;m=10;break}}else m=10}while(0);if((m|0)==10?(k=c[g>>2]|0,o=0,l=ua(1)|0,m=o,o=0,!(m&1)):0){m=(k|0)==(l|0)?c[b+8>>2]|0:13;Xa();i=n;return m|0}d=Na()|0;o=0;xa(3);n=o;o=0;if(n&1){n=Na(0)|0;ec(n)}else Ya(d|0);return 0}function gc(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;l=i;i=i+128|0;g=l+116|0;f=l;o=0;c[g>>2]=c[b>>2];c[g+4>>2]=c[b+4>>2];c[g+8>>2]=c[b+8>>2];ia(59,f|0,g|0);g=o;o=0;if((!(g&1)?(o=0,ha(177,f|0),g=o,o=0,!(g&1)):0)?(o=0,ia(61,f|0,1),g=o,o=0,!(g&1)):0){b=f+16|0;f=d+84|0;do{c[d>>2]=c[b>>2];d=d+4|0;b=b+4|0}while((d|0)<(f|0));if(e)a[e>>0]=0;e=0;i=l;return e|0}g=Na(824,0)|0;d=D;d=(d|0)==(Ta(824)|0);g=Va(g|0)|0;b=(e|0)==0;if(!d){if(!b)a[e>>0]=0;Xa();e=14;i=l;return e|0}d=g+12|0;do{if(!b){b=c[d>>2]|0;o=0;f=ua(1)|0;m=o;o=0;if(!(m&1))if((b|0)==(f|0)){ml(e,Eb[c[(c[g>>2]|0)+8>>2]&127](g)|0)|0;k=13;break}else{a[e>>0]=0;k=13;break}}else k=13}while(0);if((k|0)==13?(h=c[d>>2]|0,o=0,j=ua(1)|0,m=o,o=0,!(m&1)):0){m=(h|0)==(j|0)?c[g+8>>2]|0:13;Xa();i=l;return m|0}b=Na()|0;o=0;xa(3);m=o;o=0;if(m&1){m=Na(0)|0;ec(m)}else Ya(b|0);return 0}function hc(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0;n=i;i=i+48|0;k=n+36|0;j=n+24|0;l=n+12|0;m=n;if(!((a|0)!=0&(d|0)!=0&(e|0)!=0&(g|0)!=0)){f=1;i=n;return f|0}c[l>>2]=0;c[l+4>>2]=a;c[l+8>>2]=b;c[m>>2]=0;c[m+4>>2]=e;c[m+8>>2]=f;c[j>>2]=c[l>>2];c[j+4>>2]=c[l+4>>2];c[j+8>>2]=c[l+8>>2];c[k>>2]=c[m>>2];c[k+4>>2]=c[m+4>>2];c[k+8>>2]=c[m+8>>2];f=cc(j,d,k,g,h)|0;i=n;return f|0}function ic(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;i=i+32|0;g=f+12|0;h=f;j=h;c[j>>2]=0;c[j+4>>2]=0;c[h+4>>2]=a;c[h+8>>2]=b;c[g>>2]=c[h>>2];c[g+4>>2]=c[h+4>>2];c[g+8>>2]=c[h+8>>2];d=gc(g,d,e)|0;i=f;return d|0}function jc(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+48|0;j=h+36|0;k=h+24|0;m=h+12|0;l=h;c[m>>2]=0;c[m+4>>2]=a;c[m+8>>2]=b;c[l>>2]=0;c[l+4>>2]=d;c[l+8>>2]=e;c[k>>2]=c[m>>2];c[k+4>>2]=c[m+4>>2];c[k+8>>2]=c[m+8>>2];c[j>>2]=c[l>>2];c[j+4>>2]=c[l+4>>2];c[j+8>>2]=c[l+8>>2];e=fc(k,j,f,g)|0;i=h;return e|0}function kc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;k=a+4|0;d=c[a>>2]|0;f=((c[k>>2]|0)-d>>2)+1|0;if(f>>>0>1073741823){$i(a);d=c[a>>2]|0}l=a+8|0;e=(c[l>>2]|0)-d|0;if(e>>2>>>0<536870911){e=e>>1;e=e>>>0>>0?f:e;d=(c[k>>2]|0)-d>>2;if(!e){g=0;h=0}else i=6}else{e=1073741823;d=(c[k>>2]|0)-d>>2;i=6}if((i|0)==6){g=e;h=bj(e<<2)|0}f=h+(d<<2)|0;e=f;j=h+(g<<2)|0;i=c[b>>2]|0;c[b>>2]=0;c[f>>2]=i;i=h+(d+1<<2)|0;h=c[a>>2]|0;d=c[k>>2]|0;if((d|0)==(h|0)){f=a;g=k}else{do{d=d+-4|0;b=c[d>>2]|0;c[d>>2]=0;c[f+-4>>2]=b;f=e+-4|0;e=f}while((d|0)!=(h|0));d=e;f=a;g=k;e=d;h=c[a>>2]|0;d=c[k>>2]|0}c[f>>2]=e;c[g>>2]=i;c[l>>2]=j;f=h;if((d|0)!=(f|0))do{d=d+-4|0;e=c[d>>2]|0;c[d>>2]=0;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e)}while((d|0)!=(f|0));if(!h)return;cj(h);return}function lc(){if(a[8]|0)return 35648;if(!(Ha(8)|0))return 35648;kb(72,35648,n|0)|0;Pa(8);return 35648}function mc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;l=n;Ei(l,(1<>2]|0;m=h+1|0;e=m<<1;c[b>>2]=0;j=b+4|0;c[j>>2]=0;c[b+8>>2]=0;a:do{if(m){if(!((h|0)<-1?(o=0,ha(178,b|0),k=o,o=0,k&1):0))f=4;if((f|0)==4?(o=0,g=ka(67,e|0)|0,k=o,o=0,!(k&1)):0){c[j>>2]=g;c[b>>2]=g;c[b+8>>2]=g+e;d=g;while(1){a[d>>0]=0;d=(c[j>>2]|0)+1|0;c[j>>2]=d;e=e+-1|0;if(!e)break a}}e=Na()|0;d=c[b>>2]|0;if(!d)Ya(e|0);if((c[j>>2]|0)!=(d|0))c[j>>2]=d;cj(d);Ya(e|0)}}while(0);d=~h;if((h|0)<(d|0)){i=n;return}j=l+12|0;k=l+8|0;h=l+4|0;g=d;do{d=c[j>>2]|0;if((g|0)>(0-d|0)){e=c[k>>2]|0;if((g|0)>(0-e|0)){f=c[h>>2]|0;if((g|0)>(0-f|0))if((g|0)>=0)if((g|0)>0)if((f|0)<=(g|0))if((e|0)>(g|0))d=2;else d=(d|0)>(g|0)?3:4;else d=1;else d=0;else d=-1;else d=-2}else d=-3}else d=-4;a[(c[b>>2]|0)+(g+m)>>0]=d;g=g+1|0}while((g|0)<(m|0));i=n;return}function nc(d,e,f){d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;q=c[f+16>>2]|0;switch(q|0){case 64:case 0:{o=0;d=ra(34,d|0,e|0)|0;e=o;o=0;if(e&1)r=16;else g=d;break}default:{h=(1<>2])+-1|0;p=c[e+20>>2]|0;n=p<<1;n=((n+h|0)/(n|1|0)|0)+1|0;d=0;while(1)if((1<>2]|0;o=0;g=ka(67,4624)|0;m=o;o=0;if(m&1)r=16;else{i=((j|0)<8?8:j)+j<<1;k=g+4|0;l=e;m=k+84|0;do{c[k>>2]=c[l>>2];k=k+4|0;l=l+4|0}while((k|0)<(m|0));k=g+88|0;m=k+40|0;do{c[k>>2]=0;k=k+4|0}while((k|0)<(m|0));c[g>>2]=35660;c[g+128>>2]=h;c[g+132>>2]=n;c[g+136>>2]=p;c[g+140>>2]=d;c[g+144>>2]=j;c[g+148>>2]=i;c[g+152>>2]=q;d=g+156|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+172>>2]=c[e>>2];c[g+176>>2]=0;c[g+180>>2]=0;c[g+184>>2]=0;d=g+4568|0;h=g+188|0;do{c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;b[h+10>>1]=1;h=h+12|0}while((h|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4580|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4592|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+28>>2]|0))c[g+20>>2]=1}}}if((r|0)==16){r=Na()|0;Ya(r|0)}if(!g)return g|0;o=0;ia(c[(c[g>>2]|0)+12>>2]|0,g|0,f|0);r=o;o=0;if(!(r&1))return g|0;d=Na()|0;if(!g){r=d;Ya(r|0)}Bb[c[(c[g>>2]|0)+4>>2]&255](g);r=d;Ya(r|0);return 0}function oc(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=(c[e+24>>2]|0)==2;if(f?(c[e+16>>2]|0)!=3:0){e=0;return e|0}n=c[e+20>>2]|0;d=c[e+8>>2]|0;a:do{if(!n){if(f){if((d|0)!=8)break;g=bj(4600)|0;j=g+4|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=g+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[g>>2]=35688;d=g+132|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+148>>2]=c[e>>2];c[g+152>>2]=0;c[g+156>>2]=0;c[g+160>>2]=0;d=g+4544|0;f=g+164|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4556|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4568|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+28>>2]|0))c[g+20>>2]=1;e=g;return e|0}switch(d|0){case 8:{g=bj(4600)|0;j=g+4|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=g+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[g>>2]=35716;d=g+132|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+148>>2]=c[e>>2];c[g+152>>2]=0;c[g+156>>2]=0;c[g+160>>2]=0;d=g+4544|0;f=g+164|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4556|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4568|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+28>>2]|0))c[g+20>>2]=1;e=g;return e|0}case 12:{g=bj(4600)|0;j=g+4|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=g+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[g>>2]=35744;d=g+132|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+148>>2]=c[e>>2];c[g+152>>2]=0;c[g+156>>2]=0;c[g+160>>2]=0;d=g+4544|0;f=g+164|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4556|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4568|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+28>>2]|0))c[g+20>>2]=1;e=g;return e|0}case 16:{g=bj(4600)|0;j=g+4|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=g+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[g>>2]=35772;d=g+132|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+148>>2]=c[e>>2];c[g+152>>2]=0;c[g+156>>2]=0;c[g+160>>2]=0;d=g+4544|0;f=g+164|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4556|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4568|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+28>>2]|0))c[g+20>>2]=1;e=g;return e|0}default:break a}}}while(0);m=(1<>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=h+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[h>>2]=35800;c[h+128>>2]=m;c[h+132>>2]=i;c[h+136>>2]=n;c[h+140>>2]=d;c[h+144>>2]=f;c[h+148>>2]=g;c[h+152>>2]=64;d=h+156|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+172>>2]=c[e>>2];c[h+176>>2]=0;c[h+180>>2]=0;c[h+184>>2]=0;d=h+4568|0;f=h+188|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4580|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4592|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+28>>2]|0))c[h+20>>2]=1;e=h;return e|0}else{d=0;while(1)if((1<>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=h+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[h>>2]=35660;c[h+128>>2]=m;c[h+132>>2]=i;c[h+136>>2]=n;c[h+140>>2]=d;c[h+144>>2]=f;c[h+148>>2]=g;c[h+152>>2]=64;d=h+156|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+172>>2]=c[e>>2];c[h+176>>2]=0;c[h+180>>2]=0;c[h+184>>2]=0;d=h+4568|0;f=h+188|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4580|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4592|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+28>>2]|0))c[h+20>>2]=1;e=h;return e|0}}if((d|0)>=17){e=0;return e|0}i=n<<1;i=((i+m|0)/(i|1|0)|0)+1|0;if(f){d=0;while(1)if((1<>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=h+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[h>>2]=35828;c[h+128>>2]=m;c[h+132>>2]=i;c[h+136>>2]=n;c[h+140>>2]=d;c[h+144>>2]=f;c[h+148>>2]=g;c[h+152>>2]=64;d=h+156|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+172>>2]=c[e>>2];c[h+176>>2]=0;c[h+180>>2]=0;c[h+184>>2]=0;d=h+4568|0;f=h+188|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4580|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4592|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+28>>2]|0))c[h+20>>2]=1;e=h;return e|0}else{d=0;while(1)if((1<>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));j=h+88|0;l=j+40|0;do{c[j>>2]=0;j=j+4|0}while((j|0)<(l|0));c[h>>2]=35856;c[h+128>>2]=m;c[h+132>>2]=i;c[h+136>>2]=n;c[h+140>>2]=d;c[h+144>>2]=f;c[h+148>>2]=g;c[h+152>>2]=64;d=h+156|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+172>>2]=c[e>>2];c[h+176>>2]=0;c[h+180>>2]=0;c[h+184>>2]=0;d=h+4568|0;f=h+188|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4580|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4592|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+28>>2]|0))c[h+20>>2]=1;e=h;return e|0}return 0}function pc(d,e,f){d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;q=c[f+16>>2]|0;switch(q|0){case 64:case 0:{o=0;d=ra(35,d|0,e|0)|0;e=o;o=0;if(e&1)r=16;else g=d;break}default:{h=(1<>2])+-1|0;p=c[e+20>>2]|0;n=p<<1;n=((n+h|0)/(n|1|0)|0)+1|0;d=0;while(1)if((1<>2]|0;o=0;g=ka(67,4632)|0;m=o;o=0;if(m&1)r=16;else{i=((j|0)<8?8:j)+j<<1;c[g+4>>2]=0;k=g+8|0;l=e;m=k+84|0;do{c[k>>2]=c[l>>2];k=k+4|0;l=l+4|0}while((k|0)<(m|0));c[g+92>>2]=0;c[g+96>>2]=0;c[g+100>>2]=32;c[g+104>>2]=0;c[g+108>>2]=0;a[g+112>>0]=0;m=g+116|0;c[m>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;c[m+12>>2]=0;c[m+16>>2]=0;c[g>>2]=35884;c[g+136>>2]=h;c[g+140>>2]=n;c[g+144>>2]=p;c[g+148>>2]=d;c[g+152>>2]=j;c[g+156>>2]=i;c[g+160>>2]=q;d=g+164|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+180>>2]=c[e>>2];c[g+184>>2]=0;c[g+188>>2]=0;c[g+192>>2]=0;d=g+4576|0;h=g+196|0;do{c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;b[h+10>>1]=1;h=h+12|0}while((h|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4588|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4600|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+32>>2]|0))c[g+24>>2]=1}}}if((r|0)==16){r=Na()|0;Ya(r|0)}if(!g)return g|0;o=0;ia(c[(c[g>>2]|0)+8>>2]|0,g|0,f|0);r=o;o=0;if(!(r&1))return g|0;d=Na()|0;if(!g){r=d;Ya(r|0)}Bb[c[(c[g>>2]|0)+4>>2]&255](g);r=d;Ya(r|0);return 0}function qc(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=(c[e+24>>2]|0)==2;if(f?(c[e+16>>2]|0)!=3:0){e=0;return e|0}n=c[e+20>>2]|0;d=c[e+8>>2]|0;a:do{if(!n){if(f){if((d|0)!=8)break;g=bj(4608)|0;c[g+4>>2]=0;j=g+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[g+92>>2]=0;c[g+96>>2]=0;c[g+100>>2]=32;c[g+104>>2]=0;c[g+108>>2]=0;a[g+112>>0]=0;d=g+116|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[d+16>>2]=0;c[g>>2]=35912;d=g+140|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+156>>2]=c[e>>2];c[g+160>>2]=0;c[g+164>>2]=0;c[g+168>>2]=0;d=g+4552|0;f=g+172|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4564|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4576|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+32>>2]|0))c[g+24>>2]=1;e=g;return e|0}switch(d|0){case 8:{g=bj(4608)|0;c[g+4>>2]=0;j=g+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[g+92>>2]=0;c[g+96>>2]=0;c[g+100>>2]=32;c[g+104>>2]=0;c[g+108>>2]=0;a[g+112>>0]=0;d=g+116|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[d+16>>2]=0;c[g>>2]=35940;d=g+140|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+156>>2]=c[e>>2];c[g+160>>2]=0;c[g+164>>2]=0;c[g+168>>2]=0;d=g+4552|0;f=g+172|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4564|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4576|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+32>>2]|0))c[g+24>>2]=1;e=g;return e|0}case 12:{g=bj(4608)|0;c[g+4>>2]=0;j=g+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[g+92>>2]=0;c[g+96>>2]=0;c[g+100>>2]=32;c[g+104>>2]=0;c[g+108>>2]=0;a[g+112>>0]=0;d=g+116|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[d+16>>2]=0;c[g>>2]=35968;d=g+140|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+156>>2]=c[e>>2];c[g+160>>2]=0;c[g+164>>2]=0;c[g+168>>2]=0;d=g+4552|0;f=g+172|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4564|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4576|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+32>>2]|0))c[g+24>>2]=1;e=g;return e|0}case 16:{g=bj(4608)|0;c[g+4>>2]=0;j=g+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[g+92>>2]=0;c[g+96>>2]=0;c[g+100>>2]=32;c[g+104>>2]=0;c[g+108>>2]=0;a[g+112>>0]=0;d=g+116|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[d+16>>2]=0;c[g>>2]=35996;d=g+140|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[g+156>>2]=c[e>>2];c[g+160>>2]=0;c[g+164>>2]=0;c[g+168>>2]=0;d=g+4552|0;f=g+172|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=g+4564|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=g+4576|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[g+32>>2]|0))c[g+24>>2]=1;e=g;return e|0}default:break a}}}while(0);m=(1<>2]=0;j=h+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[h+92>>2]=0;c[h+96>>2]=0;c[h+100>>2]=32;c[h+104>>2]=0;c[h+108>>2]=0;a[h+112>>0]=0;l=h+116|0;c[l>>2]=0;c[l+4>>2]=0;c[l+8>>2]=0;c[l+12>>2]=0;c[l+16>>2]=0;c[h>>2]=36024;c[h+136>>2]=m;c[h+140>>2]=i;c[h+144>>2]=n;c[h+148>>2]=d;c[h+152>>2]=f;c[h+156>>2]=g;c[h+160>>2]=64;d=h+164|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+180>>2]=c[e>>2];c[h+184>>2]=0;c[h+188>>2]=0;c[h+192>>2]=0;d=h+4576|0;f=h+196|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4588|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4600|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+32>>2]|0))c[h+24>>2]=1;e=h;return e|0}else{d=0;while(1)if((1<>2]=0;j=h+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[h+92>>2]=0;c[h+96>>2]=0;c[h+100>>2]=32;c[h+104>>2]=0;c[h+108>>2]=0;a[h+112>>0]=0;l=h+116|0;c[l>>2]=0;c[l+4>>2]=0;c[l+8>>2]=0;c[l+12>>2]=0;c[l+16>>2]=0;c[h>>2]=35884;c[h+136>>2]=m;c[h+140>>2]=i;c[h+144>>2]=n;c[h+148>>2]=d;c[h+152>>2]=f;c[h+156>>2]=g;c[h+160>>2]=64;d=h+164|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+180>>2]=c[e>>2];c[h+184>>2]=0;c[h+188>>2]=0;c[h+192>>2]=0;d=h+4576|0;f=h+196|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4588|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4600|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+32>>2]|0))c[h+24>>2]=1;e=h;return e|0}}if((d|0)>=17){e=0;return e|0}i=n<<1;i=((i+m|0)/(i|1|0)|0)+1|0;if(f){d=0;while(1)if((1<>2]=0;j=h+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[h+92>>2]=0;c[h+96>>2]=0;c[h+100>>2]=32;c[h+104>>2]=0;c[h+108>>2]=0;a[h+112>>0]=0;l=h+116|0;c[l>>2]=0;c[l+4>>2]=0;c[l+8>>2]=0;c[l+12>>2]=0;c[l+16>>2]=0;c[h>>2]=36052;c[h+136>>2]=m;c[h+140>>2]=i;c[h+144>>2]=n;c[h+148>>2]=d;c[h+152>>2]=f;c[h+156>>2]=g;c[h+160>>2]=64;d=h+164|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+180>>2]=c[e>>2];c[h+184>>2]=0;c[h+188>>2]=0;c[h+192>>2]=0;d=h+4576|0;f=h+196|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4588|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4600|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+32>>2]|0))c[h+24>>2]=1;e=h;return e|0}else{d=0;while(1)if((1<>2]=0;j=h+8|0;k=e;l=j+84|0;do{c[j>>2]=c[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));c[h+92>>2]=0;c[h+96>>2]=0;c[h+100>>2]=32;c[h+104>>2]=0;c[h+108>>2]=0;a[h+112>>0]=0;l=h+116|0;c[l>>2]=0;c[l+4>>2]=0;c[l+8>>2]=0;c[l+12>>2]=0;c[l+16>>2]=0;c[h>>2]=36080;c[h+136>>2]=m;c[h+140>>2]=i;c[h+144>>2]=n;c[h+148>>2]=d;c[h+152>>2]=f;c[h+156>>2]=g;c[h+160>>2]=64;d=h+164|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[h+180>>2]=c[e>>2];c[h+184>>2]=0;c[h+188>>2]=0;c[h+192>>2]=0;d=h+4576|0;f=h+196|0;do{c[f>>2]=0;c[f+4>>2]=0;b[f+8>>1]=0;b[f+10>>1]=1;f=f+12|0}while((f|0)!=(d|0));c[d>>2]=0;c[d+4>>2]=0;b[d+8>>1]=0;a[d+10>>0]=0;e=h+4588|0;c[e>>2]=0;c[e+4>>2]=0;b[e+8>>1]=0;a[e+10>>0]=0;e=h+4600|0;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;c[e+12>>2]=0;c[e+16>>2]=0;c[e+20>>2]=0;c[e+24>>2]=0;a[e+28>>0]=0;if(!(c[h+32>>2]|0))c[h+24>>2]=1;e=h;return e|0}return 0}function rc(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0;a=2832;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=4880);iw(2832,0,2048)|0;a=0;do{h=2832+(a+128<<3)|0;c[h>>2]=0;c[h+4>>2]=1;a=a+1|0}while((a|0)!=128);a=3088;c[a>>2]=1;c[a+4>>2]=3;a=3096;c[a>>2]=1;c[a+4>>2]=3;a=3104;c[a>>2]=1;c[a+4>>2]=3;a=3112;c[a>>2]=1;c[a+4>>2]=3;a=3120;c[a>>2]=1;c[a+4>>2]=3;a=3128;c[a>>2]=1;c[a+4>>2]=3;a=3136;c[a>>2]=1;c[a+4>>2]=3;a=3144;c[a>>2]=1;c[a+4>>2]=3;a=3152;c[a>>2]=1;c[a+4>>2]=3;a=3160;c[a>>2]=1;c[a+4>>2]=3;a=3168;c[a>>2]=1;c[a+4>>2]=3;a=3176;c[a>>2]=1;c[a+4>>2]=3;a=3184;c[a>>2]=1;c[a+4>>2]=3;a=3192;c[a>>2]=1;c[a+4>>2]=3;a=3200;c[a>>2]=1;c[a+4>>2]=3;a=3208;c[a>>2]=1;c[a+4>>2]=3;a=3216;c[a>>2]=1;c[a+4>>2]=3;a=3224;c[a>>2]=1;c[a+4>>2]=3;a=3232;c[a>>2]=1;c[a+4>>2]=3;a=3240;c[a>>2]=1;c[a+4>>2]=3;a=3248;c[a>>2]=1;c[a+4>>2]=3;a=3256;c[a>>2]=1;c[a+4>>2]=3;a=3264;c[a>>2]=1;c[a+4>>2]=3;a=3272;c[a>>2]=1;c[a+4>>2]=3;a=3280;c[a>>2]=1;c[a+4>>2]=3;a=3288;c[a>>2]=1;c[a+4>>2]=3;a=3296;c[a>>2]=1;c[a+4>>2]=3;a=3304;c[a>>2]=1;c[a+4>>2]=3;a=3312;c[a>>2]=1;c[a+4>>2]=3;a=3320;c[a>>2]=1;c[a+4>>2]=3;a=3328;c[a>>2]=1;c[a+4>>2]=3;a=3336;c[a>>2]=1;c[a+4>>2]=3;a=2896;c[a>>2]=2;c[a+4>>2]=5;a=2904;c[a>>2]=2;c[a+4>>2]=5;a=2912;c[a>>2]=2;c[a+4>>2]=5;a=2920;c[a>>2]=2;c[a+4>>2]=5;a=2928;c[a>>2]=2;c[a+4>>2]=5;a=2936;c[a>>2]=2;c[a+4>>2]=5;a=2944;c[a>>2]=2;c[a+4>>2]=5;a=2952;c[a>>2]=2;c[a+4>>2]=5;a=2848;c[a>>2]=3;c[a+4>>2]=7;a=2856;c[a>>2]=3;c[a+4>>2]=7;a=0;do{h=2832+(a+64<<3)|0;c[h>>2]=-1;c[h+4>>2]=2;a=a+1|0}while((a|0)!=64);a=2960;c[a>>2]=-2;c[a+4>>2]=4;a=2968;c[a>>2]=-2;c[a+4>>2]=4;a=2976;c[a>>2]=-2;c[a+4>>2]=4;a=2984;c[a>>2]=-2;c[a+4>>2]=4;a=2992;c[a>>2]=-2;c[a+4>>2]=4;a=3e3;c[a>>2]=-2;c[a+4>>2]=4;a=3008;c[a>>2]=-2;c[a+4>>2]=4;a=3016;c[a>>2]=-2;c[a+4>>2]=4;a=3024;c[a>>2]=-2;c[a+4>>2]=4;a=3032;c[a>>2]=-2;c[a+4>>2]=4;a=3040;c[a>>2]=-2;c[a+4>>2]=4;a=3048;c[a>>2]=-2;c[a+4>>2]=4;a=3056;c[a>>2]=-2;c[a+4>>2]=4;a=3064;c[a>>2]=-2;c[a+4>>2]=4;a=3072;c[a>>2]=-2;c[a+4>>2]=4;a=3080;c[a>>2]=-2;c[a+4>>2]=4;a=2864;c[a>>2]=-3;c[a+4>>2]=6;a=2872;c[a>>2]=-3;c[a+4>>2]=6;a=2880;c[a>>2]=-3;c[a+4>>2]=6;a=2888;c[a>>2]=-3;c[a+4>>2]=6;a=2840;c[a>>2]=-4;c[a+4>>2]=8;a=4880;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=6928);iw(4880,0,2048)|0;d=2;a=0;f=0;g=0;while(1){d=d<<16>>16;b=8-d|0;e=1<>2]=f;c[h+4>>2]=d;b=b+1|0}while((b|0)<(e|0))}b=(g<<16)+65536|0;a=b>>31^b>>15;g=g+1|0;if((g|0)==7){b=2;f=1;g=-1;h=-1;break}else{d=(a>>1)+2|0;f=b>>16}}while(1){d=b<<16>>16;a=8-d|0;e=1<>2]=g;c[f+4>>2]=d;b=b+1|0}while((b|0)<(e|0))}a=(h<<16)+-65536|0;f=a>>31^a>>15;b=(f>>1)+2|0;if((b|0)>8){a=6928;break}else{g=a>>16;h=h+-1|0}}do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=8976);iw(6928,0,2048)|0;f=3;a=0;e=0;g=0;while(1){b=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}b=(g<<16)+65536|0;a=b>>31^b>>15;g=g+1|0;if((g|0)==12){f=3;b=1;e=-1;g=-1;break}else{f=(a>>2)+3|0;e=b>>16}}while(1){a=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}a=(g<<16)+-65536|0;b=a>>31^a>>15;f=(b>>2)+3|0;if((f|0)>8){a=8976;break}else{e=a>>16;g=g+-1|0}}do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=11024);iw(8976,0,2048)|0;f=4;a=0;e=0;g=0;while(1){b=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}b=(g<<16)+65536|0;a=b>>31^b>>15;g=g+1|0;if((g|0)==20){f=4;b=1;e=-1;g=-1;break}else{f=(a>>3)+4|0;e=b>>16}}while(1){a=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}a=(g<<16)+-65536|0;b=a>>31^a>>15;f=(b>>3)+4|0;if((f|0)>8){a=11024;break}else{e=a>>16;g=g+-1|0}}do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=13072);iw(11024,0,2048)|0;f=5;a=0;e=0;g=0;while(1){b=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}b=(g<<16)+65536|0;a=b>>31^b>>15;g=g+1|0;if((g|0)==32){f=5;b=1;e=-1;g=-1;break}else{f=(a>>4)+5|0;e=b>>16}}while(1){a=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}a=(g<<16)+-65536|0;b=a>>31^a>>15;f=(b>>4)+5|0;if((f|0)>8){a=13072;break}else{e=a>>16;g=g+-1|0}}do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=15120);iw(13072,0,2048)|0;f=6;a=0;e=0;g=0;while(1){b=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}b=(g<<16)+65536|0;a=b>>31^b>>15;g=g+1|0;if((g|0)==48){f=6;b=1;e=-1;g=-1;break}else{f=(a>>5)+6|0;e=b>>16}}while(1){a=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}a=(g<<16)+-65536|0;b=a>>31^a>>15;f=(b>>5)+6|0;if((f|0)>8){a=15120;break}else{e=a>>16;g=g+-1|0}}do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=17168);iw(15120,0,2048)|0;f=7;a=0;e=0;g=0;while(1){b=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}b=(g<<16)+65536|0;a=b>>31^b>>15;g=g+1|0;if((g|0)==64){f=7;b=1;e=-1;g=-1;break}else{f=(a>>6)+7|0;e=b>>16}}while(1){a=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}a=(g<<16)+-65536|0;b=a>>31^a>>15;f=(b>>6)+7|0;if((f|0)>8){a=17168;break}else{e=a>>16;g=g+-1|0}}do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=19216);iw(17168,0,2048)|0;f=8;a=0;e=0;g=0;while(1){b=8-f|0;d=1<>2]=e;c[h+4>>2]=f;b=b+1|0}while((b|0)<(d|0))}b=(g<<16)+65536|0;a=b>>31^b>>15;g=g+1|0;if((g|0)==64){g=8;e=1;f=-1;h=-1;break}else{f=(a>>7)+8|0;e=b>>16}}while(1){a=8-g|0;d=1<>2]=f;c[e+4>>2]=g;b=b+1|0}while((b|0)<(d|0))}b=(h<<16)+-65536|0;e=b>>31^b>>15;a=e>>7;if((a|0)>0){a=19216;break}else{g=a+8|0;f=b>>16;h=h+-1|0}}do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=21264);iw(19216,0,2048)|0;a=21264;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=23312);iw(21264,0,2048)|0;a=23312;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=25360);iw(23312,0,2048)|0;a=25360;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=27408);iw(25360,0,2048)|0;a=27408;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=29456);iw(27408,0,2048)|0;a=29456;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=31504);iw(29456,0,2048)|0;a=31504;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=33552);iw(31504,0,2048)|0;a=33552;do{c[a>>2]=0;c[a+4>>2]=0;a=a+8|0}while((a|0)!=35600);iw(33552,0,2048)|0;mc(35600,8);kb(179,35600,n|0)|0;mc(35612,10);kb(179,35612,n|0)|0;mc(35624,12);kb(179,35624,n|0)|0;mc(35636,16);kb(179,35636,n|0)|0;return}function sc(a){a=a|0;var b=0;b=c[a>>2]|0;if(!b)return;a=a+4|0;if((c[a>>2]|0)!=(b|0))c[a>>2]=b;cj(b);return}function tc(a){a=a|0;var b=0,d=0;c[a>>2]=36080;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function uc(a){a=a|0;var b=0,d=0;c[a>>2]=36080;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function vc(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+136>>2]|0,c[d+144>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+184>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+188>>2]=j;c[d+192>>2]=h;he(d);h=d+140|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+196+(j*12|0)>>2]=e;c[d+196+(j*12|0)+4>>2]=0;b[d+196+(j*12|0)+8>>1]=0;b[d+196+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4576>>2]=l;c[d+4580>>2]=0;a[d+4584>>0]=m;a[d+4585>>0]=1;a[d+4586>>0]=0;c[d+4588>>2]=l;c[d+4592>>2]=1;a[d+4596>>0]=m;a[d+4597>>0]=1;a[d+4598>>0]=0;c[d+4600>>2]=0;i=k;return}function wc(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4624)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35856;c[e+128>>2]=c[d+136>>2];c[e+132>>2]=c[d+140>>2];c[e+136>>2]=c[d+144>>2];c[e+140>>2]=c[d+148>>2];c[e+144>>2]=c[d+152>>2];c[e+148>>2]=c[d+156>>2];c[e+152>>2]=c[d+160>>2];h=e+156|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+172>>2]=c[g>>2];c[e+176>>2]=0;c[e+180>>2]=0;c[e+184>>2]=0;h=e+4568|0;g=e+188|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4580|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4592|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];Yd(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;Yd(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function xc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function yc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0;c[b>>2]=36460;c[b+4>>2]=e;n=b+8|0;h=c[e>>2]|0;l=e+16|0;f=c[l>>2]|0;i=$(f,h)|0;c[n>>2]=0;p=b+12|0;c[p>>2]=0;c[b+16>>2]=0;do{if(i){if(!((i|0)<0?(o=0,ha(178,n|0),h=o,o=0,h&1):0))m=4;if((m|0)==4?(j=i<<1,o=0,k=ka(67,j|0)|0,h=o,o=0,!(h&1)):0){c[n>>2]=k;h=k+(i<<1)|0;c[b+16>>2]=h;iw(k|0,0,j|0)|0;c[p>>2]=h;h=c[e>>2]|0;f=c[l>>2]|0;break}i=Na()|0;g=c[n>>2]|0;f=g;if(g){h=c[p>>2]|0;if((h|0)!=(g|0))c[p>>2]=h+(~((h+-2-f|0)>>>1)<<1);cj(g)}p=i;Ya(p|0)}}while(0);i=b+20|0;f=$(h<<1,f)|0;c[i>>2]=0;j=b+24|0;c[j>>2]=0;c[b+28>>2]=0;if(!f){p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))m=13;if((m|0)==13?(o=0,g=ka(67,f|0)|0,m=o,o=0,!(m&1)):0){c[j>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[j>>2]|0)+1|0;c[j>>2]=g;f=f+-1|0}while((f|0)!=0);p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}h=Na()|0;g=c[i>>2]|0;if(g){if((c[j>>2]|0)!=(g|0))c[j>>2]=g;cj(g)}g=c[n>>2]|0;if(!g){p=h;Ya(p|0)}f=c[p>>2]|0;if((f|0)!=(g|0))c[p>>2]=f+(~((f+-2-g|0)>>>1)<<1);cj(g);p=h;Ya(p|0)}function zc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0;c[b>>2]=36436;c[b+4>>2]=e;n=b+8|0;h=c[e>>2]|0;l=e+16|0;f=c[l>>2]|0;i=$(f,h)|0;c[n>>2]=0;p=b+12|0;c[p>>2]=0;c[b+16>>2]=0;do{if(i){if(!((i|0)<0?(o=0,ha(178,n|0),h=o,o=0,h&1):0))m=4;if((m|0)==4?(j=i<<1,o=0,k=ka(67,j|0)|0,h=o,o=0,!(h&1)):0){c[n>>2]=k;h=k+(i<<1)|0;c[b+16>>2]=h;iw(k|0,0,j|0)|0;c[p>>2]=h;h=c[e>>2]|0;f=c[l>>2]|0;break}i=Na()|0;g=c[n>>2]|0;f=g;if(g){h=c[p>>2]|0;if((h|0)!=(g|0))c[p>>2]=h+(~((h+-2-f|0)>>>1)<<1);cj(g)}p=i;Ya(p|0)}}while(0);i=b+20|0;f=$(h<<1,f)|0;c[i>>2]=0;j=b+24|0;c[j>>2]=0;c[b+28>>2]=0;if(!f){p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))m=13;if((m|0)==13?(o=0,g=ka(67,f|0)|0,m=o,o=0,!(m&1)):0){c[j>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[j>>2]|0)+1|0;c[j>>2]=g;f=f+-1|0}while((f|0)!=0);p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}h=Na()|0;g=c[i>>2]|0;if(g){if((c[j>>2]|0)!=(g|0))c[j>>2]=g;cj(g)}g=c[n>>2]|0;if(!g){p=h;Ya(p|0)}f=c[p>>2]|0;if((f|0)!=(g|0))c[p>>2]=f+(~((f+-2-g|0)>>>1)<<1);cj(g);p=h;Ya(p|0)}function Ac(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0;c[b>>2]=36412;c[b+4>>2]=e;n=b+8|0;h=c[e>>2]|0;l=e+16|0;f=c[l>>2]|0;i=$(f,h)|0;c[n>>2]=0;p=b+12|0;c[p>>2]=0;c[b+16>>2]=0;do{if(i){if(!((i|0)<0?(o=0,ha(178,n|0),h=o,o=0,h&1):0))m=4;if((m|0)==4?(j=i<<1,o=0,k=ka(67,j|0)|0,h=o,o=0,!(h&1)):0){c[n>>2]=k;h=k+(i<<1)|0;c[b+16>>2]=h;iw(k|0,0,j|0)|0;c[p>>2]=h;h=c[e>>2]|0;f=c[l>>2]|0;break}i=Na()|0;g=c[n>>2]|0;f=g;if(g){h=c[p>>2]|0;if((h|0)!=(g|0))c[p>>2]=h+(~((h+-2-f|0)>>>1)<<1);cj(g)}p=i;Ya(p|0)}}while(0);i=b+20|0;f=$(h<<1,f)|0;c[i>>2]=0;j=b+24|0;c[j>>2]=0;c[b+28>>2]=0;if(!f){p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))m=13;if((m|0)==13?(o=0,g=ka(67,f|0)|0,m=o,o=0,!(m&1)):0){c[j>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[j>>2]|0)+1|0;c[j>>2]=g;f=f+-1|0}while((f|0)!=0);p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}h=Na()|0;g=c[i>>2]|0;if(g){if((c[j>>2]|0)!=(g|0))c[j>>2]=g;cj(g)}g=c[n>>2]|0;if(!g){p=h;Ya(p|0)}f=c[p>>2]|0;if((f|0)!=(g|0))c[p>>2]=f+(~((f+-2-g|0)>>>1)<<1);cj(g);p=h;Ya(p|0)}function Bc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0;c[b>>2]=36388;c[b+4>>2]=e;n=b+8|0;h=c[e>>2]|0;l=e+16|0;f=c[l>>2]|0;i=$(f,h)|0;c[n>>2]=0;p=b+12|0;c[p>>2]=0;c[b+16>>2]=0;do{if(i){if(!((i|0)<0?(o=0,ha(178,n|0),h=o,o=0,h&1):0))m=4;if((m|0)==4?(j=i<<1,o=0,k=ka(67,j|0)|0,h=o,o=0,!(h&1)):0){c[n>>2]=k;h=k+(i<<1)|0;c[b+16>>2]=h;iw(k|0,0,j|0)|0;c[p>>2]=h;h=c[e>>2]|0;f=c[l>>2]|0;break}i=Na()|0;g=c[n>>2]|0;f=g;if(g){h=c[p>>2]|0;if((h|0)!=(g|0))c[p>>2]=h+(~((h+-2-f|0)>>>1)<<1);cj(g)}p=i;Ya(p|0)}}while(0);i=b+20|0;f=$(h<<1,f)|0;c[i>>2]=0;j=b+24|0;c[j>>2]=0;c[b+28>>2]=0;if(!f){p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))m=13;if((m|0)==13?(o=0,g=ka(67,f|0)|0,m=o,o=0,!(m&1)):0){c[j>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[j>>2]|0)+1|0;c[j>>2]=g;f=f+-1|0}while((f|0)!=0);p=b+36|0;c[p>>2]=c[d>>2];c[p+4>>2]=c[d+4>>2];c[p+8>>2]=c[d+8>>2];return}h=Na()|0;g=c[i>>2]|0;if(g){if((c[j>>2]|0)!=(g|0))c[j>>2]=g;cj(g)}g=c[n>>2]|0;if(!g){p=h;Ya(p|0)}f=c[p>>2]|0;if((f|0)!=(g|0))c[p>>2]=f+(~((f+-2-g|0)>>>1)<<1);cj(g);p=h;Ya(p|0)}function Cc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;i=b+32|0;Jm(i,d)|0;h=b+44|0;c[h>>2]=0;j=b+48|0;g=c[j>>2]|0;if(g&8){d=a[i>>0]|0;if(!(d&1)){d=((d&255)>>>1)+(i+1)|0;c[h>>2]=d;e=i+1|0;f=i+1|0}else{d=(c[b+40>>2]|0)+(c[b+36>>2]|0)|0;c[h>>2]=d;f=c[b+40>>2]|0;e=f}c[b+8>>2]=e;c[b+12>>2]=f;c[b+16>>2]=d}if(!(g&16))return;d=a[i>>0]|0;if(!(d&1)){g=(d&255)>>>1;c[h>>2]=i+1+g;d=10;h=g}else{g=c[b+36>>2]|0;c[h>>2]=(c[b+40>>2]|0)+g;d=(c[i>>2]&-2)+-1|0;h=g}Mm(i,d,0);d=a[i>>0]|0;if(!(d&1)){g=i+1|0;f=(d&255)>>>1;e=i+1|0}else{e=c[b+40>>2]|0;g=e;f=c[b+36>>2]|0}d=b+24|0;c[d>>2]=e;c[b+20>>2]=e;c[b+28>>2]=g+f;if(!(c[j>>2]&3))return;c[d>>2]=e+h;return}function Dc(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;q=i;i=i+32|0;j=q+16|0;p=q+8|0;k=q;o=0;ia(65,p|0,b|0);m=o;o=0;a:do{if(m&1){e=Na(0)|0;f=b;g=b}else{do{if(a[p>>0]|0){f=c[(c[b>>2]|0)+-12>>2]|0;c[k>>2]=c[b+(f+24)>>2];l=b+f|0;m=c[b+(f+4)>>2]|0;g=d+e|0;f=b+(f+76)|0;e=c[f>>2]|0;do{if((e|0)==-1){o=0;e=ka(68,l|0)|0;r=o;o=0;if(r&1)n=13;else{c[j>>2]=e;o=0;e=ra(37,j|0,44220)|0;r=o;o=0;if(!(r&1)?(o=0,h=ra(c[(c[e>>2]|0)+28>>2]|0,e|0,32)|0,r=o,o=0,!(r&1)):0){Gs(j);e=h<<24>>24;c[f>>2]=e;n=9;break}e=Na(0)|0;Gs(j)}}else n=9}while(0);if((n|0)==9){o=0;c[j>>2]=c[k>>2];e=ja(39,j|0,d|0,((m&176|0)==32?g:d)|0,g|0,l|0,e&255|0)|0;r=o;o=0;if(!(r&1)){if(e)break;r=c[(c[b>>2]|0)+-12>>2]|0;o=0;ia(66,b+r|0,c[b+(r+16)>>2]|5|0);r=o;o=0;if(!(r&1))break;else n=13}else n=13}if((n|0)==13)e=Na(0)|0;ho(p);f=b;g=b;break a}}while(0);ho(p);i=q;return b|0}}while(0);Va(e|0)|0;o=0;ha(181,f+(c[(c[g>>2]|0)+-12>>2]|0)|0);r=o;o=0;if(!(r&1)){Xa();i=q;return b|0}e=Na()|0;o=0;xa(3);r=o;o=0;if(r&1){r=Na(0)|0;ec(r)}else Ya(e|0);return 0}function Ec(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=c[d+48>>2]|0;if(e&16){e=d+44|0;f=c[e>>2]|0;g=c[d+24>>2]|0;if(f>>>0>>0)c[e>>2]=g;else g=f;f=c[d+20>>2]|0;h=g-f|0;if(h>>>0>4294967279)_i(b);if(h>>>0<11){a[b>>0]=h<<1;e=b+1|0}else{d=h+16&-16;e=bj(d)|0;c[b+8>>2]=e;c[b>>2]=d|1;c[b+4>>2]=h}if((f|0)!=(g|0)){d=e;while(1){a[d>>0]=a[f>>0]|0;f=f+1|0;if((f|0)==(g|0))break;else d=d+1|0}e=e+h|0}a[e>>0]=0;return}if(!(e&8)){c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;return}f=c[d+8>>2]|0;d=c[d+16>>2]|0;h=d-f|0;if(h>>>0>4294967279)_i(b);if(h>>>0<11){a[b>>0]=h<<1;e=b+1|0}else{g=h+16&-16;e=bj(g)|0;c[b+8>>2]=e;c[b>>2]=g|1;c[b+4>>2]=h}if((f|0)!=(d|0)){g=e;while(1){a[g>>0]=a[f>>0]|0;f=f+1|0;if((f|0)==(d|0))break;else g=g+1|0}e=e+h|0}a[e>>0]=0;return}function Fc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0;c[b>>2]=36364;c[b+4>>2]=e;p=b+8|0;i=c[e>>2]|0;m=e+16|0;h=c[m>>2]|0;l=$(h,i)|0;c[p>>2]=0;q=b+12|0;c[q>>2]=0;c[b+16>>2]=0;do{if(l){if(!((l|0)<0?(o=0,ha(178,p|0),i=o,o=0,i&1):0))n=4;if((n|0)==4?(j=l<<1,o=0,k=ka(67,j|0)|0,i=o,o=0,!(i&1)):0){c[p>>2]=k;i=k+(l<<1)|0;c[b+16>>2]=i;iw(k|0,0,j|0)|0;c[q>>2]=i;i=c[e>>2]|0;h=c[m>>2]|0;break}j=Na()|0;g=c[p>>2]|0;h=g;if(g){i=c[q>>2]|0;if((i|0)!=(g|0))c[q>>2]=i+(~((i+-2-h|0)>>>1)<<1);cj(g)}q=j;Ya(q|0)}}while(0);j=b+20|0;h=$(i<<1,h)|0;c[j>>2]=0;k=b+24|0;c[k>>2]=0;c[b+28>>2]=0;if(!h){q=b+32|0;p=f;p=c[p>>2]|0;f=f+4|0;f=c[f>>2]|0;n=q;c[n>>2]=p;q=q+4|0;c[q>>2]=f;q=b+40|0;c[q>>2]=p;q=b+48|0;c[q>>2]=c[d>>2];c[q+4>>2]=c[d+4>>2];c[q+8>>2]=c[d+8>>2];return}if(!((h|0)<0?(o=0,ha(178,j|0),m=o,o=0,m&1):0))n=13;if((n|0)==13?(o=0,g=ka(67,h|0)|0,n=o,o=0,!(n&1)):0){c[k>>2]=g;c[j>>2]=g;c[b+28>>2]=g+h;do{a[g>>0]=0;g=(c[k>>2]|0)+1|0;c[k>>2]=g;h=h+-1|0}while((h|0)!=0);q=b+32|0;p=f;p=c[p>>2]|0;f=f+4|0;f=c[f>>2]|0;n=q;c[n>>2]=p;q=q+4|0;c[q>>2]=f;q=b+40|0;c[q>>2]=p;q=b+48|0;c[q>>2]=c[d>>2];c[q+4>>2]=c[d+4>>2];c[q+8>>2]=c[d+8>>2];return}i=Na()|0;g=c[j>>2]|0;if(g){if((c[k>>2]|0)!=(g|0))c[k>>2]=g;cj(g)}g=c[p>>2]|0;if(!g){q=i;Ya(q|0)}h=c[q>>2]|0;if((h|0)!=(g|0))c[q>>2]=h+(~((h+-2-g|0)>>>1)<<1);cj(g);q=i;Ya(q|0)}function Gc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0;c[b>>2]=36340;c[b+4>>2]=e;p=b+8|0;i=c[e>>2]|0;m=e+16|0;h=c[m>>2]|0;l=$(h,i)|0;c[p>>2]=0;q=b+12|0;c[q>>2]=0;c[b+16>>2]=0;do{if(l){if(!((l|0)<0?(o=0,ha(178,p|0),i=o,o=0,i&1):0))n=4;if((n|0)==4?(j=l<<1,o=0,k=ka(67,j|0)|0,i=o,o=0,!(i&1)):0){c[p>>2]=k;i=k+(l<<1)|0;c[b+16>>2]=i;iw(k|0,0,j|0)|0;c[q>>2]=i;i=c[e>>2]|0;h=c[m>>2]|0;break}j=Na()|0;g=c[p>>2]|0;h=g;if(g){i=c[q>>2]|0;if((i|0)!=(g|0))c[q>>2]=i+(~((i+-2-h|0)>>>1)<<1);cj(g)}q=j;Ya(q|0)}}while(0);j=b+20|0;h=$(i<<1,h)|0;c[j>>2]=0;k=b+24|0;c[k>>2]=0;c[b+28>>2]=0;if(!h){q=b+32|0;p=f;p=c[p>>2]|0;f=f+4|0;f=c[f>>2]|0;n=q;c[n>>2]=p;q=q+4|0;c[q>>2]=f;q=b+40|0;c[q>>2]=p;q=b+48|0;c[q>>2]=c[d>>2];c[q+4>>2]=c[d+4>>2];c[q+8>>2]=c[d+8>>2];return}if(!((h|0)<0?(o=0,ha(178,j|0),m=o,o=0,m&1):0))n=13;if((n|0)==13?(o=0,g=ka(67,h|0)|0,n=o,o=0,!(n&1)):0){c[k>>2]=g;c[j>>2]=g;c[b+28>>2]=g+h;do{a[g>>0]=0;g=(c[k>>2]|0)+1|0;c[k>>2]=g;h=h+-1|0}while((h|0)!=0);q=b+32|0;p=f;p=c[p>>2]|0;f=f+4|0;f=c[f>>2]|0;n=q;c[n>>2]=p;q=q+4|0;c[q>>2]=f;q=b+40|0;c[q>>2]=p;q=b+48|0;c[q>>2]=c[d>>2];c[q+4>>2]=c[d+4>>2];c[q+8>>2]=c[d+8>>2];return}i=Na()|0;g=c[j>>2]|0;if(g){if((c[k>>2]|0)!=(g|0))c[k>>2]=g;cj(g)}g=c[p>>2]|0;if(!g){q=i;Ya(q|0)}h=c[q>>2]|0;if((h|0)!=(g|0))c[q>>2]=h+(~((h+-2-g|0)>>>1)<<1);cj(g);q=i;Ya(q|0)}function Hc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0;c[b>>2]=36316;c[b+4>>2]=e;p=b+8|0;i=c[e>>2]|0;m=e+16|0;h=c[m>>2]|0;l=$(h,i)|0;c[p>>2]=0;q=b+12|0;c[q>>2]=0;c[b+16>>2]=0;do{if(l){if(!((l|0)<0?(o=0,ha(178,p|0),i=o,o=0,i&1):0))n=4;if((n|0)==4?(j=l<<1,o=0,k=ka(67,j|0)|0,i=o,o=0,!(i&1)):0){c[p>>2]=k;i=k+(l<<1)|0;c[b+16>>2]=i;iw(k|0,0,j|0)|0;c[q>>2]=i;i=c[e>>2]|0;h=c[m>>2]|0;break}j=Na()|0;g=c[p>>2]|0;h=g;if(g){i=c[q>>2]|0;if((i|0)!=(g|0))c[q>>2]=i+(~((i+-2-h|0)>>>1)<<1);cj(g)}q=j;Ya(q|0)}}while(0);j=b+20|0;h=$(i<<1,h)|0;c[j>>2]=0;k=b+24|0;c[k>>2]=0;c[b+28>>2]=0;if(!h){q=b+32|0;p=f;p=c[p>>2]|0;f=f+4|0;f=c[f>>2]|0;n=q;c[n>>2]=p;q=q+4|0;c[q>>2]=f;q=b+40|0;c[q>>2]=p;q=b+48|0;c[q>>2]=c[d>>2];c[q+4>>2]=c[d+4>>2];c[q+8>>2]=c[d+8>>2];return}if(!((h|0)<0?(o=0,ha(178,j|0),m=o,o=0,m&1):0))n=13;if((n|0)==13?(o=0,g=ka(67,h|0)|0,n=o,o=0,!(n&1)):0){c[k>>2]=g;c[j>>2]=g;c[b+28>>2]=g+h;do{a[g>>0]=0;g=(c[k>>2]|0)+1|0;c[k>>2]=g;h=h+-1|0}while((h|0)!=0);q=b+32|0;p=f;p=c[p>>2]|0;f=f+4|0;f=c[f>>2]|0;n=q;c[n>>2]=p;q=q+4|0;c[q>>2]=f;q=b+40|0;c[q>>2]=p;q=b+48|0;c[q>>2]=c[d>>2];c[q+4>>2]=c[d+4>>2];c[q+8>>2]=c[d+8>>2];return}i=Na()|0;g=c[j>>2]|0;if(g){if((c[k>>2]|0)!=(g|0))c[k>>2]=g;cj(g)}g=c[p>>2]|0;if(!g){q=i;Ya(q|0)}h=c[q>>2]|0;if((h|0)!=(g|0))c[q>>2]=h+(~((h+-2-g|0)>>>1)<<1);cj(g);q=i;Ya(q|0)}function Ic(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36316;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e)return;b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);return}function Jc(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36316;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e){cj(a);return}b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);cj(a);return}function Kc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=b+48|0;if(!(c[g>>2]|0)){j=b+52|0;Pc(b,d,c[j>>2]|0,e,f);c[j>>2]=(c[j>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}k=b+4|0;h=e<<1;i=$(h,c[(c[k>>2]|0)+16>>2]|0)|0;j=b+20|0;Pc(b,d,c[j>>2]|0,e,f);d=c[k>>2]|0;if((c[d+28>>2]|0)==536870912)Oc(c[j>>2]|0,$(h,c[d+16>>2]|0)|0);k=c[g>>2]|0;if((Gb[c[(c[k>>2]|0)+48>>2]&63](k,c[j>>2]|0,i)|0)==(i|0))return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,3,35648);k=o;o=0;if(k&1){k=Na()|0;La(d|0);Ya(k|0)}else lb(d|0,824,96)}function Lc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+48>>2]|0;if(!f){f=a+52|0;Mc(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{Nc(a,f,b,d,e);return}}function Mc(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0;m=d+4|0;j=c[m>>2]|0;do{if(!(a[j+32>>0]|0))n=f;else{k=d+8|0;lw(c[k>>2]|0,f|0,h*6|0)|0;j=c[m>>2]|0;l=c[j+16>>2]|0;if((h|0)<=0){n=c[k>>2]|0;break}f=c[k>>2]|0;j=f;k=0;while(1){n=j+4|0;o=b[j>>1]|0;b[j>>1]=b[n>>1]|0;b[n>>1]=o;k=k+1|0;if((k|0)==(h|0))break;else j=j+(l<<1)|0}n=f;j=c[m>>2]|0}}while(0);switch(c[j+16>>2]|0){case 3:if((c[j+24>>2]|0)==2){if((h|0)<=0)return;j=d+32|0;f=0;do{o=c[j>>2]|0;m=e[n+(f*6|0)+2>>1]<>1]<>1]<>1]=(m+49152+((d+i|0)>>>2)&65535)>>>o;b[g+(f*6|0)+2>>1]=d>>>o;b[g+(f*6|0)+4>>1]=i>>>o;f=f+1|0}while((f|0)!=(h|0));return}else{k=(i|0)<(h|0)?i:h;if((k|0)<=0)return;l=i<<1;j=c[d+32>>2]|0;f=0;do{h=e[n+(f*6|0)+2>>1]<>1]<>1]<>1]=(h+49152+((d+o|0)>>>2)&65535)>>>j;b[g+(f+i<<1)>>1]=d>>>j;b[g+(f+l<<1)>>1]=o>>>j;f=f+1|0}while((f|0)!=(k|0));return}case 4:{if((c[j+24>>2]|0)!=1)return;k=(i|0)<(h|0)?i:h;if((k|0)<=0)return;l=i<<1;m=i*3|0;j=c[d+32>>2]|0;f=0;do{o=b[n+(f<<3)+6>>1]|0;p=e[n+(f<<3)+2>>1]<>1]<>1]<>1]=(p+49152+((h+d|0)>>>2)&65535)>>>j;b[g+(f+i<<1)>>1]=h>>>j;b[g+(f+l<<1)>>1]=d>>>j;b[g+(f+m<<1)>>1]=o;f=f+1|0}while((f|0)!=(k|0));return}default:return}}function Nc(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;q=i;i=i+176|0;r=q+152|0;t=q+16|0;s=q;l=b+4|0;h=c[l>>2]|0;p=f<<1;j=$(p,c[h+16>>2]|0)|0;do{if(j){k=b+20|0;while(1){h=Gb[c[(c[d>>2]|0)+32>>2]&63](d,c[k>>2]|0,j)|0;if(!h)break;if((j|0)==(h|0)){m=26;break}else j=j-h|0}if((m|0)==26){h=c[l>>2]|0;break}m=t+56|0;l=t+4|0;c[t>>2]=36160;c[m>>2]=36180;o=0;ia(62,t+56|0,l|0);q=o;o=0;if(q&1){t=Na()|0;fn(m);Ya(t|0)}c[t+128>>2]=0;c[t+132>>2]=-1;c[t>>2]=36200;c[t+56>>2]=36220;o=0;ha(180,l|0);q=o;o=0;do{if(q&1)h=Na()|0;else{c[l>>2]=36236;d=t+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[t+52>>2]=16;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;o=0;ia(63,l|0,r|0);q=o;o=0;if(q&1){h=Na()|0;Im(r);Im(d);nn(l);break}Im(r);o=0;h=ma(28,t|0,49029,57)|0;r=o;o=0;if(!(r&1)?(o=0,ra(36,h|0,0)|0,r=o,o=0,!(r&1)):0){k=Ma(16)|0;o=0;ia(64,s|0,l|0);r=o;o=0;if(!(r&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,s|0);r=o;o=0;if(r&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(s);if(!j){s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}else h=Na()|0;La(k|0);s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}s=Na()|0;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}while(0);t=h;fn(m);Ya(t|0)}}while(0);j=b+20|0;if((c[h+28>>2]|0)!=536870912){t=c[j>>2]|0;Mc(b,t,e,f,g);i=q;return}Oc(c[j>>2]|0,$(p,c[h+16>>2]|0)|0);t=c[j>>2]|0;Mc(b,t,e,f,g);i=q;return}function Oc(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;g=i;i=i+176|0;e=g+152|0;l=g+16|0;j=g;if(!(d&1)){e=(d|0)/4|0;if((d|0)>3){f=0;do{l=b+(f<<2)|0;k=c[l>>2]|0;c[l>>2]=k>>>8&16711935|k<<8&-16711936;f=f+1|0}while((f|0)<(e|0))}if(!(d&3)){i=g;return}j=b+(d+-2)|0;l=b+(d+-1)|0;k=a[j>>0]|0;a[j>>0]=a[l>>0]|0;a[l>>0]=k;i=g;return}k=l+56|0;h=l+4|0;c[l>>2]=36160;c[k>>2]=36180;o=0;ia(62,l+56|0,h|0);g=o;o=0;if(g&1){l=Na()|0;fn(k);Ya(l|0)}c[l+128>>2]=0;c[l+132>>2]=-1;c[l>>2]=36200;c[l+56>>2]=36220;o=0;ha(180,h|0);g=o;o=0;do{if(g&1)e=Na()|0;else{c[h>>2]=36236;g=l+36|0;c[g>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[l+52>>2]=16;c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;o=0;ia(63,h|0,e|0);b=o;o=0;if(b&1){l=Na()|0;Im(e);Im(g);nn(h);e=l;break}Im(e);o=0;e=ma(28,l|0,49087,24)|0;b=o;o=0;if((!(b&1)?(o=0,f=ra(36,e|0,d|0)|0,d=o,o=0,!(d&1)):0)?(o=0,ma(28,f|0,49112,20)|0,d=o,o=0,!(d&1)):0){b=Ma(16)|0;o=0;ia(64,j|0,h|0);d=o;o=0;if(!(d&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,b|0,1,35648,j|0);d=o;o=0;if(d&1)f=1;else{o=0;wa(6,b|0,824,96);o=0;f=0}e=Na()|0;Im(j);if(!f){j=e;c[l>>2]=36200;c[k>>2]=36220;c[h>>2]=36236;Im(g);nn(h);fn(k);Ya(j|0)}}else e=Na()|0;La(b|0);j=e;c[l>>2]=36200;c[k>>2]=36220;c[h>>2]=36236;Im(g);nn(h);fn(k);Ya(j|0)}j=Na()|0;c[l>>2]=36200;c[k>>2]=36220;c[h>>2]=36236;Im(g);nn(h);fn(k);Ya(j|0)}}while(0);l=e;fn(k);Ya(l|0)}function Pc(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;n=d+4|0;j=c[n>>2]|0;a:do{switch(c[j+16>>2]|0){case 3:{if((c[j+24>>2]|0)==2){if((h|0)<=0)break a;j=d+40|0;d=0;do{i=c[j>>2]|0;l=e[f+(d*6|0)+2>>1]<>1]<>1]<>2)+16384|0;b[g+(d*6|0)>>1]=(k+32768+m&65535)>>>i;b[g+(d*6|0)+2>>1]=(m&65535)>>>i;b[g+(d*6|0)+4>>1]=(l+32768+m&65535)>>>i;d=d+1|0}while((d|0)!=(h|0))}else{k=(h|0)<(i|0)?h:i;if((k|0)<=0)break a;l=i<<1;j=d+40|0;d=0;do{m=c[j>>2]|0;p=e[f+(d+i<<1)>>1]<>1]<>1]<>2)+16384|0;b[g+(d*6|0)>>1]=(q+32768+o&65535)>>>m;b[g+(d*6|0)+2>>1]=(o&65535)>>>m;b[g+(d*6|0)+4>>1]=(p+32768+o&65535)>>>m;d=d+1|0}while((d|0)!=(k|0))}break}case 4:{if((c[j+24>>2]|0)==1?(m=(h|0)<(i|0)?h:i,(m|0)>0):0){l=i<<1;j=d+40|0;d=i*3|0;k=0;do{q=c[j>>2]|0;p=e[f+(k+i<<1)>>1]<>1]<>1]<>2)+16384|0;r=b[f+(k+d<<1)>>1]|0;t=mw((o&65535)>>>q&65535|0,0,16)|0;p=(p+32768+o&65535)>>>q|D;r=mw(r&65535|0,0,48)|0;r=t|(s+32768+o&65535)>>>q&65535|r;p=p&65535|D;q=g+(k<<3)|0;o=q;b[o>>1]=r;b[o+2>>1]=r>>>16;q=q+4|0;b[q>>1]=p;b[q+2>>1]=p>>>16;k=k+1|0}while((k|0)!=(m|0))}break}default:{}}}while(0);j=c[n>>2]|0;if(!(a[j+32>>0]|0))return;k=c[j+16>>2]|0;if((h|0)<=0)return;j=g;d=0;while(1){t=j+4|0;s=b[j>>1]|0;b[j>>1]=b[t>>1]|0;b[t>>1]=s;d=d+1|0;if((d|0)==(h|0))break;else j=j+(k<<1)|0}return}function Qc(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36340;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e)return;b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);return}function Rc(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36340;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e){cj(a);return}b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);cj(a);return}function Sc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=b+48|0;if(!(c[g>>2]|0)){j=b+52|0;Wc(b,d,c[j>>2]|0,e,f);c[j>>2]=(c[j>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}k=b+4|0;h=e<<1;i=$(h,c[(c[k>>2]|0)+16>>2]|0)|0;j=b+20|0;Wc(b,d,c[j>>2]|0,e,f);d=c[k>>2]|0;if((c[d+28>>2]|0)==536870912)Oc(c[j>>2]|0,$(h,c[d+16>>2]|0)|0);k=c[g>>2]|0;if((Gb[c[(c[k>>2]|0)+48>>2]&63](k,c[j>>2]|0,i)|0)==(i|0))return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,3,35648);k=o;o=0;if(k&1){k=Na()|0;La(d|0);Ya(k|0)}else lb(d|0,824,96)}function Tc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+48>>2]|0;if(!f){f=a+52|0;Uc(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{Vc(a,f,b,d,e);return}}function Uc(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0;m=d+4|0;j=c[m>>2]|0;do{if(!(a[j+32>>0]|0))n=f;else{k=d+8|0;lw(c[k>>2]|0,f|0,h*6|0)|0;j=c[m>>2]|0;l=c[j+16>>2]|0;if((h|0)<=0){n=c[k>>2]|0;break}f=c[k>>2]|0;j=f;k=0;while(1){n=j+4|0;o=b[j>>1]|0;b[j>>1]=b[n>>1]|0;b[n>>1]=o;k=k+1|0;if((k|0)==(h|0))break;else j=j+(l<<1)|0}n=f;j=c[m>>2]|0}}while(0);switch(c[j+16>>2]|0){case 3:if((c[j+24>>2]|0)==2){if((h|0)<=0)return;j=d+32|0;f=0;do{i=c[j>>2]|0;m=e[n+(f*6|0)>>1]<>1]<>1]<>>1)&65535)>>>i&65535;b[g+(f*6|0)>>1]=(m+32768-d&65535)>>>i;b[g+(f*6|0)+2>>1]=(d&65535)>>>i;b[g+(f*6|0)+4>>1]=o;f=f+1|0}while((f|0)!=(h|0));return}else{k=(i|0)<(h|0)?i:h;if((k|0)<=0)return;l=i<<1;j=c[d+32>>2]|0;f=0;do{h=e[n+(f*6|0)>>1]<>1]<>1]<>>1)&65535)>>>j&65535;b[g+(f<<1)>>1]=(h+32768-d&65535)>>>j;b[g+(f+i<<1)>>1]=(d&65535)>>>j;b[g+(f+l<<1)>>1]=o;f=f+1|0}while((f|0)!=(k|0));return}case 4:{if((c[j+24>>2]|0)!=1)return;k=(i|0)<(h|0)?i:h;if((k|0)<=0)return;l=i<<1;m=i*3|0;j=c[d+32>>2]|0;f=0;do{o=b[n+(f<<3)+6>>1]|0;p=e[n+(f<<3)>>1]<>1]<>1]<>>1)&65535)>>>j&65535;b[g+(f<<1)>>1]=(p+32768-h&65535)>>>j;b[g+(f+i<<1)>>1]=(h&65535)>>>j;b[g+(f+l<<1)>>1]=d;b[g+(f+m<<1)>>1]=o;f=f+1|0}while((f|0)!=(k|0));return}default:return}}function Vc(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;q=i;i=i+176|0;r=q+152|0;t=q+16|0;s=q;l=b+4|0;h=c[l>>2]|0;p=f<<1;j=$(p,c[h+16>>2]|0)|0;do{if(j){k=b+20|0;while(1){h=Gb[c[(c[d>>2]|0)+32>>2]&63](d,c[k>>2]|0,j)|0;if(!h)break;if((j|0)==(h|0)){m=26;break}else j=j-h|0}if((m|0)==26){h=c[l>>2]|0;break}m=t+56|0;l=t+4|0;c[t>>2]=36160;c[m>>2]=36180;o=0;ia(62,t+56|0,l|0);q=o;o=0;if(q&1){t=Na()|0;fn(m);Ya(t|0)}c[t+128>>2]=0;c[t+132>>2]=-1;c[t>>2]=36200;c[t+56>>2]=36220;o=0;ha(180,l|0);q=o;o=0;do{if(q&1)h=Na()|0;else{c[l>>2]=36236;d=t+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[t+52>>2]=16;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;o=0;ia(63,l|0,r|0);q=o;o=0;if(q&1){h=Na()|0;Im(r);Im(d);nn(l);break}Im(r);o=0;h=ma(28,t|0,49029,57)|0;r=o;o=0;if(!(r&1)?(o=0,ra(36,h|0,0)|0,r=o,o=0,!(r&1)):0){k=Ma(16)|0;o=0;ia(64,s|0,l|0);r=o;o=0;if(!(r&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,s|0);r=o;o=0;if(r&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(s);if(!j){s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}else h=Na()|0;La(k|0);s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}s=Na()|0;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}while(0);t=h;fn(m);Ya(t|0)}}while(0);j=b+20|0;if((c[h+28>>2]|0)!=536870912){t=c[j>>2]|0;Uc(b,t,e,f,g);i=q;return}Oc(c[j>>2]|0,$(p,c[h+16>>2]|0)|0);t=c[j>>2]|0;Uc(b,t,e,f,g);i=q;return}function Wc(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;n=d+4|0;j=c[n>>2]|0;a:do{switch(c[j+16>>2]|0){case 3:{if((c[j+24>>2]|0)==2){if((h|0)<=0)break a;j=d+40|0;d=0;do{m=c[j>>2]|0;l=e[f+(d*6|0)+2>>1]<>1]<>1]<>>1)&65535)>>>m&65535;b[g+(d*6|0)>>1]=k>>>m;b[g+(d*6|0)+2>>1]=l>>>m;b[g+(d*6|0)+4>>1]=i;d=d+1|0}while((d|0)!=(h|0))}else{k=(h|0)<(i|0)?h:i;if((k|0)<=0)break a;l=i<<1;j=d+40|0;d=0;do{o=c[j>>2]|0;p=e[f+(d+i<<1)>>1]<>1]<>1]<>>1)&65535)>>>o&65535;b[g+(d*6|0)>>1]=q>>>o;b[g+(d*6|0)+2>>1]=p>>>o;b[g+(d*6|0)+4>>1]=m;d=d+1|0}while((d|0)!=(k|0))}break}case 4:{if((c[j+24>>2]|0)==1?(m=(h|0)<(i|0)?h:i,(m|0)>0):0){l=i<<1;j=d+40|0;d=i*3|0;k=0;do{o=c[j>>2]|0;q=e[f+(k+i<<1)>>1]<>1]<>1]<>>1)&65535)>>>o;r=b[f+(k+d<<1)>>1]|0;q=mw(q>>>o&65535|0,0,16)|0;p=D|p;r=mw(r&65535|0,0,48)|0;r=s>>>o&65535|q|r;p=p&65535|D;q=g+(k<<3)|0;o=q;b[o>>1]=r;b[o+2>>1]=r>>>16;q=q+4|0;b[q>>1]=p;b[q+2>>1]=p>>>16;k=k+1|0}while((k|0)!=(m|0))}break}default:{}}}while(0);j=c[n>>2]|0;if(!(a[j+32>>0]|0))return;k=c[j+16>>2]|0;if((h|0)<=0)return;j=g;d=0;while(1){s=j+4|0;r=b[j>>1]|0;b[j>>1]=b[s>>1]|0;b[s>>1]=r;d=d+1|0;if((d|0)==(h|0))break;else j=j+(k<<1)|0}return}function Xc(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36364;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e)return;b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);return}function Yc(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36364;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e){cj(a);return}b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);cj(a);return}function Zc(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=b+48|0;if(!(c[g>>2]|0)){j=b+52|0;bd(b,d,c[j>>2]|0,e,f);c[j>>2]=(c[j>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}k=b+4|0;h=e<<1;i=$(h,c[(c[k>>2]|0)+16>>2]|0)|0;j=b+20|0;bd(b,d,c[j>>2]|0,e,f);d=c[k>>2]|0;if((c[d+28>>2]|0)==536870912)Oc(c[j>>2]|0,$(h,c[d+16>>2]|0)|0);k=c[g>>2]|0;if((Gb[c[(c[k>>2]|0)+48>>2]&63](k,c[j>>2]|0,i)|0)==(i|0))return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,3,35648);k=o;o=0;if(k&1){k=Na()|0;La(d|0);Ya(k|0)}else lb(d|0,824,96)}function _c(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+48>>2]|0;if(!f){f=a+52|0;$c(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{ad(a,f,b,d,e);return}}function $c(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0;m=d+4|0;j=c[m>>2]|0;do{if(!(a[j+32>>0]|0))n=f;else{k=d+8|0;lw(c[k>>2]|0,f|0,h*6|0)|0;j=c[m>>2]|0;l=c[j+16>>2]|0;if((h|0)<=0){n=c[k>>2]|0;break}f=c[k>>2]|0;j=f;k=0;while(1){n=j+4|0;o=b[j>>1]|0;b[j>>1]=b[n>>1]|0;b[n>>1]=o;k=k+1|0;if((k|0)==(h|0))break;else j=j+(l<<1)|0}n=f;j=c[m>>2]|0}}while(0);switch(c[j+16>>2]|0){case 3:if((c[j+24>>2]|0)==2){if((h|0)<=0)return;j=d+32|0;f=0;do{i=c[j>>2]|0;d=e[n+(f*6|0)+2>>1]<>1]<>>i&65535;b[g+(f*6|0)>>1]=((e[n+(f*6|0)>>1]<>>i;b[g+(f*6|0)+2>>1]=(d&65535)>>>i;b[g+(f*6|0)+4>>1]=o;f=f+1|0}while((f|0)!=(h|0));return}else{k=(i|0)<(h|0)?i:h;if((k|0)<=0)return;l=i<<1;j=c[d+32>>2]|0;f=0;do{d=e[n+(f*6|0)+2>>1]<>1]<>>j&65535;b[g+(f<<1)>>1]=((e[n+(f*6|0)>>1]<>>j;b[g+(f+i<<1)>>1]=(d&65535)>>>j;b[g+(f+l<<1)>>1]=o;f=f+1|0}while((f|0)!=(k|0));return}case 4:{if((c[j+24>>2]|0)!=1)return;l=(i|0)<(h|0)?i:h;if((l|0)<=0)return;m=i<<1;k=i*3|0;j=c[d+32>>2]|0;f=0;do{o=b[n+(f<<3)+6>>1]|0;h=e[n+(f<<3)+2>>1]<>1]<>>j&65535;b[g+(f<<1)>>1]=((e[n+(f<<3)>>1]<>>j;b[g+(f+i<<1)>>1]=(h&65535)>>>j;b[g+(f+m<<1)>>1]=d;b[g+(f+k<<1)>>1]=o;f=f+1|0}while((f|0)!=(l|0));return}default:return}}function ad(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;q=i;i=i+176|0;r=q+152|0;t=q+16|0;s=q;l=b+4|0;h=c[l>>2]|0;p=f<<1;j=$(p,c[h+16>>2]|0)|0;do{if(j){k=b+20|0;while(1){h=Gb[c[(c[d>>2]|0)+32>>2]&63](d,c[k>>2]|0,j)|0;if(!h)break;if((j|0)==(h|0)){m=26;break}else j=j-h|0}if((m|0)==26){h=c[l>>2]|0;break}m=t+56|0;l=t+4|0;c[t>>2]=36160;c[m>>2]=36180;o=0;ia(62,t+56|0,l|0);q=o;o=0;if(q&1){t=Na()|0;fn(m);Ya(t|0)}c[t+128>>2]=0;c[t+132>>2]=-1;c[t>>2]=36200;c[t+56>>2]=36220;o=0;ha(180,l|0);q=o;o=0;do{if(q&1)h=Na()|0;else{c[l>>2]=36236;d=t+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[t+52>>2]=16;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;o=0;ia(63,l|0,r|0);q=o;o=0;if(q&1){h=Na()|0;Im(r);Im(d);nn(l);break}Im(r);o=0;h=ma(28,t|0,49029,57)|0;r=o;o=0;if(!(r&1)?(o=0,ra(36,h|0,0)|0,r=o,o=0,!(r&1)):0){k=Ma(16)|0;o=0;ia(64,s|0,l|0);r=o;o=0;if(!(r&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,s|0);r=o;o=0;if(r&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(s);if(!j){s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}else h=Na()|0;La(k|0);s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}s=Na()|0;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}while(0);t=h;fn(m);Ya(t|0)}}while(0);j=b+20|0;if((c[h+28>>2]|0)!=536870912){t=c[j>>2]|0;$c(b,t,e,f,g);i=q;return}Oc(c[j>>2]|0,$(p,c[h+16>>2]|0)|0);t=c[j>>2]|0;$c(b,t,e,f,g);i=q;return}function bd(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;n=d+4|0;j=c[n>>2]|0;a:do{switch(c[j+16>>2]|0){case 3:{if((c[j+24>>2]|0)==2){if((h|0)<=0)break a;j=d+40|0;d=0;do{m=c[j>>2]|0;l=e[f+(d*6|0)+2>>1]<>1]<>>m&65535;b[g+(d*6|0)>>1]=((e[f+(d*6|0)>>1]<>>m;b[g+(d*6|0)+2>>1]=(l&65535)>>>m;b[g+(d*6|0)+4>>1]=i;d=d+1|0}while((d|0)!=(h|0))}else{k=(h|0)<(i|0)?h:i;if((k|0)<=0)break a;l=i<<1;j=d+40|0;d=0;do{o=c[j>>2]|0;p=e[f+(d+i<<1)>>1]<>1]<>>o&65535;b[g+(d*6|0)>>1]=((e[f+(d<<1)>>1]<>>o;b[g+(d*6|0)+2>>1]=(p&65535)>>>o;b[g+(d*6|0)+4>>1]=m;d=d+1|0}while((d|0)!=(k|0))}break}case 4:{if((c[j+24>>2]|0)==1?(m=(h|0)<(i|0)?h:i,(m|0)>0):0){l=i<<1;j=d+40|0;d=i*3|0;k=0;do{q=c[j>>2]|0;s=e[f+(k+i<<1)>>1]<>1]<>>q;o=(s+32768+(e[f+(k+l<<1)>>1]<>>q;r=b[f+(k+d<<1)>>1]|0;q=mw((s&65535)>>>q&65535|0,0,16)|0;o=o|D;r=mw(r&65535|0,0,48)|0;r=q|p&65535|r;o=o&65535|D;p=g+(k<<3)|0;q=p;b[q>>1]=r;b[q+2>>1]=r>>>16;p=p+4|0;b[p>>1]=o;b[p+2>>1]=o>>>16;k=k+1|0}while((k|0)!=(m|0))}break}default:{}}}while(0);j=c[n>>2]|0;if(!(a[j+32>>0]|0))return;k=c[j+16>>2]|0;if((h|0)<=0)return;j=g;d=0;while(1){s=j+4|0;r=b[j>>1]|0;b[j>>1]=b[s>>1]|0;b[s>>1]=r;d=d+1|0;if((d|0)==(h|0))break;else j=j+(k<<1)|0}return}function cd(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0;p=i;i=i+16|0;m=p;n=c[b>>2]|0;if(!n){b=0;i=p;return b|0}q=d;k=f-q|0;l=g+12|0;j=c[l>>2]|0;k=(j|0)>(k|0)?j-k|0:0;j=e;g=j-q|0;if((g|0)>0?(Gb[c[(c[n>>2]|0)+48>>2]&63](n,d,g)|0)!=(g|0):0){c[b>>2]=0;q=0;i=p;return q|0}do{if((k|0)>0){Hm(m,k,h);o=0;g=ma(c[(c[n>>2]|0)+48>>2]|0,n|0,((a[m>>0]&1)==0?m+1|0:c[m+8>>2]|0)|0,k|0)|0;q=o;o=0;if(q&1){q=Na()|0;Im(m);Ya(q|0)}if((g|0)==(k|0)){Im(m);break}c[b>>2]=0;Im(m);q=0;i=p;return q|0}}while(0);f=f-j|0;if((f|0)>0?(Gb[c[(c[n>>2]|0)+48>>2]&63](n,e,f)|0)!=(f|0):0){c[b>>2]=0;q=0;i=p;return q|0}c[l>>2]=0;q=n;i=p;return q|0}function dd(a){a=a|0;c[a>>2]=36236;Im(a+32|0);nn(a);return}function ed(a){a=a|0;c[a>>2]=36236;Im(a+32|0);nn(a);cj(a);return}function fd(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0;i=d+44|0;j=c[i>>2]|0;l=d+24|0;m=c[l>>2]|0;if(j>>>0>>0){c[i>>2]=m;j=m}k=j;i=h&24;if(!i){d=b;c[d>>2]=0;c[d+4>>2]=0;d=b+8|0;c[d>>2]=-1;c[d+4>>2]=-1;return}if((g|0)==1&(i|0)==24){d=b;c[d>>2]=0;c[d+4>>2]=0;d=b+8|0;c[d>>2]=-1;c[d+4>>2]=-1;return}a:do{switch(g|0){case 0:{i=0;g=0;break}case 1:if(!(h&8)){g=m-(c[d+20>>2]|0)|0;i=g;g=((g|0)<0)<<31>>31;break a}else{g=(c[d+12>>2]|0)-(c[d+8>>2]|0)|0;i=g;g=((g|0)<0)<<31>>31;break a}case 2:{i=d+32|0;if(!(a[i>>0]&1))i=i+1|0;else i=c[d+40>>2]|0;g=j-i|0;i=g;g=((g|0)<0)<<31>>31;break}default:{d=b;c[d>>2]=0;c[d+4>>2]=0;d=b+8|0;c[d>>2]=-1;c[d+4>>2]=-1;return}}}while(0);g=jw(i|0,g|0,e|0,f|0)|0;e=D;if((e|0)>=0){i=d+32|0;if(!(a[i>>0]&1))i=i+1|0;else i=c[d+40>>2]|0;f=j-i|0;j=((f|0)<0)<<31>>31;if(!((j|0)<(e|0)|(j|0)==(e|0)&f>>>0>>0)){i=h&8;if(!((g|0)==0&(e|0)==0)){if((i|0)!=0?(c[d+12>>2]|0)==0:0){d=b;c[d>>2]=0;c[d+4>>2]=0;d=b+8|0;c[d>>2]=-1;c[d+4>>2]=-1;return}if((h&16|0)!=0&(m|0)==0){d=b;c[d>>2]=0;c[d+4>>2]=0;d=b+8|0;c[d>>2]=-1;c[d+4>>2]=-1;return}}if(i){c[d+12>>2]=(c[d+8>>2]|0)+g;c[d+16>>2]=k}if(h&16)c[l>>2]=(c[d+20>>2]|0)+g;d=b;c[d>>2]=0;c[d+4>>2]=0;d=b+8|0;c[d>>2]=g;c[d+4>>2]=e;return}}d=b;c[d>>2]=0;c[d+4>>2]=0;d=b+8|0;c[d>>2]=-1;c[d+4>>2]=-1;return}function gd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;d=d+8|0;Ib[c[(c[b>>2]|0)+16>>2]&15](a,b,c[d>>2]|0,c[d+4>>2]|0,0,e);return}function hd(a){a=a|0;var b=0,e=0,f=0,g=0;b=a+44|0;e=c[b>>2]|0;f=c[a+24>>2]|0;if(e>>>0>>0){c[b>>2]=f;e=f}if(!(c[a+48>>2]&8)){a=-1;return a|0}g=a+16|0;b=c[g>>2]|0;f=a+12|0;if(b>>>0>>0){f=c[f>>2]|0;c[g>>2]=e;b=e}else f=c[f>>2]|0;if(f>>>0>=b>>>0){a=-1;return a|0}a=d[f>>0]|0;return a|0}function id(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;f=b+44|0;e=c[f>>2]|0;g=c[b+24>>2]|0;if(e>>>0>>0){c[f>>2]=g;e=g}j=b+8|0;f=c[j>>2]|0;k=b+12|0;h=c[k>>2]|0;i=f;if(f>>>0>=h>>>0){b=-1;return b|0}if((d|0)==-1){c[j>>2]=f;c[k>>2]=h+-1;c[b+16>>2]=e;b=0;return b|0}if(!(c[b+48>>2]&16)){g=d&255;f=h+-1|0;if(g<<24>>24!=(a[f>>0]|0)){b=-1;return b|0}}else{g=d&255;f=h+-1|0}c[j>>2]=i;c[k>>2]=f;c[b+16>>2]=e;a[f>>0]=g;b=d;return b|0}function jd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0;t=i;i=i+16|0;n=t;if((d|0)==-1){b=0;i=t;return b|0}p=b+12|0;q=b+8|0;r=(c[p>>2]|0)-(c[q>>2]|0)|0;s=b+24|0;e=c[s>>2]|0;m=b+28|0;f=c[m>>2]|0;do{if((e|0)==(f|0)){k=b+48|0;if(!(c[k>>2]&16)){b=-1;i=t;return b|0}l=b+20|0;j=c[l>>2]|0;g=e-j|0;h=b+44|0;j=(c[h>>2]|0)-j|0;f=b+32|0;o=0;ia(67,f|0,0);e=o;o=0;if(!(e&1)){if(!(a[f>>0]&1))e=10;else e=(c[f>>2]&-2)+-1|0;o=0;wa(8,f|0,e|0,0);e=o;o=0;if(!(e&1)){e=a[f>>0]|0;if(!(e&1)){f=f+1|0;e=(e&255)>>>1}else{f=c[b+40>>2]|0;e=c[b+36>>2]|0}u=f+e|0;c[l>>2]=f;c[m>>2]=u;l=f+g|0;c[s>>2]=l;e=f+j|0;c[h>>2]=e;f=u;break}}u=Na(0)|0;Va(u|0)|0;Xa();u=-1;i=t;return u|0}else{u=b+44|0;k=b+48|0;h=u;l=e;e=c[u>>2]|0}}while(0);j=l+1|0;c[n>>2]=j;g=c[(j>>>0>>0?h:n)>>2]|0;c[h>>2]=g;if(c[k>>2]&8){e=b+32|0;if(!(a[e>>0]&1))e=e+1|0;else e=c[b+40>>2]|0;c[q>>2]=e;c[p>>2]=e+r;c[b+16>>2]=g}if((l|0)==(f|0)){u=Lb[c[(c[b>>2]|0)+52>>2]&63](b,d&255)|0;i=t;return u|0}else{c[s>>2]=j;a[l>>0]=d;u=d&255;i=t;return u|0}return 0}function kd(a){a=a|0;var b=0,d=0;c[a>>2]=36200;b=a+56|0;c[b>>2]=36220;d=a+4|0;c[d>>2]=36236;Im(a+36|0);nn(d);fn(b);return}function ld(a){a=a|0;var b=0,d=0;c[a>>2]=36200;b=a+56|0;c[b>>2]=36220;d=a+4|0;c[d>>2]=36236;Im(a+36|0);nn(d);fn(b);cj(a);return}function md(a){a=a|0;var b=0,d=0,e=0,f=0;f=c[(c[a>>2]|0)+-12>>2]|0;b=a+f|0;c[b>>2]=36200;d=a+(f+56)|0;c[d>>2]=36220;e=a+(f+4)|0;c[e>>2]=36236;Im(a+(f+36)|0);nn(e);fn(d);cj(b);return}function nd(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36388;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e)return;b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);return}function od(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36388;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e){cj(a);return}b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);cj(a);return}function pd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=b+36|0;if(!(c[g>>2]|0)){j=b+40|0;td(b,d,c[j>>2]|0,e,f);c[j>>2]=(c[j>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}k=b+4|0;h=e<<1;i=$(h,c[(c[k>>2]|0)+16>>2]|0)|0;j=b+20|0;td(b,d,c[j>>2]|0,e,f);d=c[k>>2]|0;if((c[d+28>>2]|0)==536870912)Oc(c[j>>2]|0,$(h,c[d+16>>2]|0)|0);k=c[g>>2]|0;if((Gb[c[(c[k>>2]|0)+48>>2]&63](k,c[j>>2]|0,i)|0)==(i|0))return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,3,35648);k=o;o=0;if(k&1){k=Na()|0;La(d|0);Ya(k|0)}else lb(d|0,824,96)}function qd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;rd(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{sd(a,f,b,d,e);return}}function rd(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0;l=d+4|0;j=c[l>>2]|0;do{if(!(a[j+32>>0]|0))m=f;else{d=d+8|0;lw(c[d>>2]|0,f|0,h*6|0)|0;j=c[l>>2]|0;k=c[j+16>>2]|0;if((h|0)<=0){m=c[d>>2]|0;break}d=c[d>>2]|0;j=d;f=0;while(1){m=j+4|0;n=b[j>>1]|0;b[j>>1]=b[m>>1]|0;b[m>>1]=n;f=f+1|0;if((f|0)==(h|0))break;else j=j+(k<<1)|0}m=d;j=c[l>>2]|0}}while(0);switch(c[j+16>>2]|0){case 3:{if((c[j+24>>2]|0)==2){if((h|0)>0)j=0;else return;do{l=e[m+(j*6|0)+2>>1]|0;i=32768-l+(e[m+(j*6|0)+4>>1]|0)|0;n=(e[m+(j*6|0)>>1]|0)-l+32768|0;b[g+(j*6|0)>>1]=l+49152+(((i&65535)+(n&65535)|0)>>>2);b[g+(j*6|0)+2>>1]=i;b[g+(j*6|0)+4>>1]=n;j=j+1|0}while((j|0)!=(h|0));return}j=(i|0)<(h|0)?i:h;if((j|0)<=0)return;d=i<<1;f=0;do{l=e[m+(f*6|0)+2>>1]|0;h=32768-l+(e[m+(f*6|0)+4>>1]|0)|0;n=(e[m+(f*6|0)>>1]|0)-l+32768|0;b[g+(f<<1)>>1]=l+49152+(((h&65535)+(n&65535)|0)>>>2);b[g+(f+i<<1)>>1]=h;b[g+(f+d<<1)>>1]=n;f=f+1|0}while((f|0)!=(j|0));return}case 4:{if((c[j+24>>2]|0)!=1)return;j=(i|0)<(h|0)?i:h;if((j|0)<=0)return;d=i<<1;f=i*3|0;k=0;do{n=b[m+(k<<3)+6>>1]|0;o=e[m+(k<<3)+2>>1]|0;l=32768-o+(e[m+(k<<3)+4>>1]|0)|0;h=(e[m+(k<<3)>>1]|0)-o+32768|0;b[g+(k<<1)>>1]=o+49152+(((l&65535)+(h&65535)|0)>>>2);b[g+(k+i<<1)>>1]=l;b[g+(k+d<<1)>>1]=h;b[g+(k+f<<1)>>1]=n;k=k+1|0}while((k|0)!=(j|0));return}default:return}}function sd(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;q=i;i=i+176|0;r=q+152|0;t=q+16|0;s=q;l=b+4|0;h=c[l>>2]|0;p=f<<1;j=$(p,c[h+16>>2]|0)|0;do{if(j){k=b+20|0;while(1){h=Gb[c[(c[d>>2]|0)+32>>2]&63](d,c[k>>2]|0,j)|0;if(!h)break;if((j|0)==(h|0)){m=26;break}else j=j-h|0}if((m|0)==26){h=c[l>>2]|0;break}m=t+56|0;l=t+4|0;c[t>>2]=36160;c[m>>2]=36180;o=0;ia(62,t+56|0,l|0);q=o;o=0;if(q&1){t=Na()|0;fn(m);Ya(t|0)}c[t+128>>2]=0;c[t+132>>2]=-1;c[t>>2]=36200;c[t+56>>2]=36220;o=0;ha(180,l|0);q=o;o=0;do{if(q&1)h=Na()|0;else{c[l>>2]=36236;d=t+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[t+52>>2]=16;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;o=0;ia(63,l|0,r|0);q=o;o=0;if(q&1){h=Na()|0;Im(r);Im(d);nn(l);break}Im(r);o=0;h=ma(28,t|0,49029,57)|0;r=o;o=0;if(!(r&1)?(o=0,ra(36,h|0,0)|0,r=o,o=0,!(r&1)):0){k=Ma(16)|0;o=0;ia(64,s|0,l|0);r=o;o=0;if(!(r&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,s|0);r=o;o=0;if(r&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(s);if(!j){s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}else h=Na()|0;La(k|0);s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}s=Na()|0;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}while(0);t=h;fn(m);Ya(t|0)}}while(0);j=b+20|0;if((c[h+28>>2]|0)!=536870912){t=c[j>>2]|0;rd(b,t,e,f,g);i=q;return}Oc(c[j>>2]|0,$(p,c[h+16>>2]|0)|0);t=c[j>>2]|0;rd(b,t,e,f,g);i=q;return}function td(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;m=d+4|0;d=c[m>>2]|0;a:do{switch(c[d+16>>2]|0){case 3:{if((c[d+24>>2]|0)==2){if((h|0)>0)d=0;else break a;while(1){l=e[f+(d*6|0)+2>>1]|0;k=e[f+(d*6|0)+4>>1]|0;i=(e[f+(d*6|0)>>1]|0)-((k+l|0)>>>2)+16384|0;b[g+(d*6|0)>>1]=k+32768+i;b[g+(d*6|0)+2>>1]=i;b[g+(d*6|0)+4>>1]=l+32768+i;d=d+1|0;if((d|0)==(h|0))break a}}d=(h|0)<(i|0)?h:i;if((d|0)>0){j=i<<1;k=0;do{n=e[f+(k+i<<1)>>1]|0;o=e[f+(k+j<<1)>>1]|0;l=(e[f+(k<<1)>>1]|0)-((o+n|0)>>>2)+16384|0;b[g+(k*6|0)>>1]=o+32768+l;b[g+(k*6|0)+2>>1]=l;b[g+(k*6|0)+4>>1]=n+32768+l;k=k+1|0}while((k|0)!=(d|0))}break}case 4:{if((c[d+24>>2]|0)==1?(l=(h|0)<(i|0)?h:i,(l|0)>0):0){d=i<<1;j=i*3|0;k=0;do{n=e[f+(k+i<<1)>>1]|0;p=e[f+(k+d<<1)>>1]|0;o=(e[f+(k<<1)>>1]|0)-((p+n|0)>>>2)+16384|0;q=b[f+(k+j<<1)>>1]|0;r=mw(o&65535|0,0,16)|0;n=n+32768+o|D;q=mw(q&65535|0,0,48)|0;q=r|p+32768+o&65535|q;n=n&65535|D;o=g+(k<<3)|0;p=o;b[p>>1]=q;b[p+2>>1]=q>>>16;o=o+4|0;b[o>>1]=n;b[o+2>>1]=n>>>16;k=k+1|0}while((k|0)!=(l|0))}break}default:{}}}while(0);d=c[m>>2]|0;if(!(a[d+32>>0]|0))return;k=c[d+16>>2]|0;if((h|0)<=0)return;d=g;j=0;while(1){r=d+4|0;q=b[d>>1]|0;b[d>>1]=b[r>>1]|0;b[r>>1]=q;j=j+1|0;if((j|0)==(h|0))break;else d=d+(k<<1)|0}return}function ud(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36412;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e)return;b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);return}function vd(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36412;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e){cj(a);return}b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);cj(a);return}function wd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=b+36|0;if(!(c[g>>2]|0)){j=b+40|0;Ad(b,d,c[j>>2]|0,e,f);c[j>>2]=(c[j>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}k=b+4|0;h=e<<1;i=$(h,c[(c[k>>2]|0)+16>>2]|0)|0;j=b+20|0;Ad(b,d,c[j>>2]|0,e,f);d=c[k>>2]|0;if((c[d+28>>2]|0)==536870912)Oc(c[j>>2]|0,$(h,c[d+16>>2]|0)|0);k=c[g>>2]|0;if((Gb[c[(c[k>>2]|0)+48>>2]&63](k,c[j>>2]|0,i)|0)==(i|0))return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,3,35648);k=o;o=0;if(k&1){k=Na()|0;La(d|0);Ya(k|0)}else lb(d|0,824,96)}function xd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;yd(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{zd(a,f,b,d,e);return}}function yd(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=d+4|0;j=c[l>>2]|0;do{if(!(a[j+32>>0]|0))m=f;else{d=d+8|0;lw(c[d>>2]|0,f|0,h*6|0)|0;j=c[l>>2]|0;k=c[j+16>>2]|0;if((h|0)<=0){m=c[d>>2]|0;break}d=c[d>>2]|0;j=d;f=0;while(1){m=j+4|0;n=b[j>>1]|0;b[j>>1]=b[m>>1]|0;b[m>>1]=n;f=f+1|0;if((f|0)==(h|0))break;else j=j+(k<<1)|0}m=d;j=c[l>>2]|0}}while(0);switch(c[j+16>>2]|0){case 3:{if((c[j+24>>2]|0)==2){if((h|0)>0)j=0;else return;do{k=e[m+(j*6|0)>>1]|0;i=b[m+(j*6|0)+2>>1]|0;l=i&65535;n=(e[m+(j*6|0)+4>>1]|0)+32768-((l+k|0)>>>1)&65535;b[g+(j*6|0)>>1]=k+32768-l;b[g+(j*6|0)+2>>1]=i;b[g+(j*6|0)+4>>1]=n;j=j+1|0}while((j|0)!=(h|0));return}j=(i|0)<(h|0)?i:h;if((j|0)<=0)return;d=i<<1;f=0;do{h=b[m+(f*6|0)+2>>1]|0;k=e[m+(f*6|0)>>1]|0;l=h&65535;n=(e[m+(f*6|0)+4>>1]|0)+32768-((l+k|0)>>>1)&65535;b[g+(f<<1)>>1]=k+32768-l;b[g+(f+i<<1)>>1]=h;b[g+(f+d<<1)>>1]=n;f=f+1|0}while((f|0)!=(j|0));return}case 4:{if((c[j+24>>2]|0)!=1)return;j=(i|0)<(h|0)?i:h;if((j|0)<=0)return;d=i<<1;f=i*3|0;k=0;do{l=b[m+(k<<3)+2>>1]|0;n=b[m+(k<<3)+6>>1]|0;p=e[m+(k<<3)>>1]|0;o=l&65535;h=(e[m+(k<<3)+4>>1]|0)+32768-((o+p|0)>>>1)&65535;b[g+(k<<1)>>1]=p+32768-o;b[g+(k+i<<1)>>1]=l;b[g+(k+d<<1)>>1]=h;b[g+(k+f<<1)>>1]=n;k=k+1|0}while((k|0)!=(j|0));return}default:return}}function zd(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;q=i;i=i+176|0;r=q+152|0;t=q+16|0;s=q;l=b+4|0;h=c[l>>2]|0;p=f<<1;j=$(p,c[h+16>>2]|0)|0;do{if(j){k=b+20|0;while(1){h=Gb[c[(c[d>>2]|0)+32>>2]&63](d,c[k>>2]|0,j)|0;if(!h)break;if((j|0)==(h|0)){m=26;break}else j=j-h|0}if((m|0)==26){h=c[l>>2]|0;break}m=t+56|0;l=t+4|0;c[t>>2]=36160;c[m>>2]=36180;o=0;ia(62,t+56|0,l|0);q=o;o=0;if(q&1){t=Na()|0;fn(m);Ya(t|0)}c[t+128>>2]=0;c[t+132>>2]=-1;c[t>>2]=36200;c[t+56>>2]=36220;o=0;ha(180,l|0);q=o;o=0;do{if(q&1)h=Na()|0;else{c[l>>2]=36236;d=t+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[t+52>>2]=16;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;o=0;ia(63,l|0,r|0);q=o;o=0;if(q&1){h=Na()|0;Im(r);Im(d);nn(l);break}Im(r);o=0;h=ma(28,t|0,49029,57)|0;r=o;o=0;if(!(r&1)?(o=0,ra(36,h|0,0)|0,r=o,o=0,!(r&1)):0){k=Ma(16)|0;o=0;ia(64,s|0,l|0);r=o;o=0;if(!(r&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,s|0);r=o;o=0;if(r&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(s);if(!j){s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}else h=Na()|0;La(k|0);s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}s=Na()|0;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}while(0);t=h;fn(m);Ya(t|0)}}while(0);j=b+20|0;if((c[h+28>>2]|0)!=536870912){t=c[j>>2]|0;yd(b,t,e,f,g);i=q;return}Oc(c[j>>2]|0,$(p,c[h+16>>2]|0)|0);t=c[j>>2]|0;yd(b,t,e,f,g);i=q;return}function Ad(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;m=d+4|0;d=c[m>>2]|0;a:do{switch(c[d+16>>2]|0){case 3:{if((c[d+24>>2]|0)==2){if((h|0)>0)d=0;else break a;while(1){l=b[f+(d*6|0)+2>>1]|0;i=l&65535;k=(e[f+(d*6|0)>>1]|0)+32768+i|0;i=(e[f+(d*6|0)+4>>1]|0)+32768+(((k&65535)+i|0)>>>1)&65535;b[g+(d*6|0)>>1]=k;b[g+(d*6|0)+2>>1]=l;b[g+(d*6|0)+4>>1]=i;d=d+1|0;if((d|0)==(h|0))break a}}d=(h|0)<(i|0)?h:i;if((d|0)>0){j=i<<1;k=0;do{n=b[f+(k+i<<1)>>1]|0;l=n&65535;o=(e[f+(k<<1)>>1]|0)+32768+l|0;l=(e[f+(k+j<<1)>>1]|0)+32768+(((o&65535)+l|0)>>>1)&65535;b[g+(k*6|0)>>1]=o;b[g+(k*6|0)+2>>1]=n;b[g+(k*6|0)+4>>1]=l;k=k+1|0}while((k|0)!=(d|0))}break}case 4:{if((c[d+24>>2]|0)==1?(l=(h|0)<(i|0)?h:i,(l|0)>0):0){d=i<<1;j=i*3|0;k=0;do{o=b[f+(k+i<<1)>>1]|0;n=o&65535;p=(e[f+(k<<1)>>1]|0)+32768+n&65535;n=(e[f+(k+d<<1)>>1]|0)+32768+((p+n|0)>>>1)|0;q=b[f+(k+j<<1)>>1]|0;o=mw(o&65535|0,0,16)|0;n=D|n;q=mw(q&65535|0,0,48)|0;q=p|o|q;n=n&65535|D;o=g+(k<<3)|0;p=o;b[p>>1]=q;b[p+2>>1]=q>>>16;o=o+4|0;b[o>>1]=n;b[o+2>>1]=n>>>16;k=k+1|0}while((k|0)!=(l|0))}break}default:{}}}while(0);d=c[m>>2]|0;if(!(a[d+32>>0]|0))return;k=c[d+16>>2]|0;if((h|0)<=0)return;d=g;j=0;while(1){q=d+4|0;p=b[d>>1]|0;b[d>>1]=b[q>>1]|0;b[q>>1]=p;j=j+1|0;if((j|0)==(h|0))break;else d=d+(k<<1)|0}return}function Bd(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36436;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e)return;b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);return}function Cd(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36436;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e){cj(a);return}b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);cj(a);return}function Dd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=b+36|0;if(!(c[g>>2]|0)){j=b+40|0;Hd(b,d,c[j>>2]|0,e,f);c[j>>2]=(c[j>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}k=b+4|0;h=e<<1;i=$(h,c[(c[k>>2]|0)+16>>2]|0)|0;j=b+20|0;Hd(b,d,c[j>>2]|0,e,f);d=c[k>>2]|0;if((c[d+28>>2]|0)==536870912)Oc(c[j>>2]|0,$(h,c[d+16>>2]|0)|0);k=c[g>>2]|0;if((Gb[c[(c[k>>2]|0)+48>>2]&63](k,c[j>>2]|0,i)|0)==(i|0))return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,3,35648);k=o;o=0;if(k&1){k=Na()|0;La(d|0);Ya(k|0)}else lb(d|0,824,96)}function Ed(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;Fd(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{Gd(a,f,b,d,e);return}}function Fd(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0;l=d+4|0;j=c[l>>2]|0;do{if(!(a[j+32>>0]|0))m=f;else{d=d+8|0;lw(c[d>>2]|0,f|0,h*6|0)|0;j=c[l>>2]|0;k=c[j+16>>2]|0;if((h|0)<=0){m=c[d>>2]|0;break}d=c[d>>2]|0;j=d;f=0;while(1){m=j+4|0;n=b[j>>1]|0;b[j>>1]=b[m>>1]|0;b[m>>1]=n;f=f+1|0;if((f|0)==(h|0))break;else j=j+(k<<1)|0}m=d;j=c[l>>2]|0}}while(0);switch(c[j+16>>2]|0){case 3:{if((c[j+24>>2]|0)==2){if((h|0)>0)j=0;else return;do{i=b[m+(j*6|0)+2>>1]|0;l=i&65535;n=32768-l+(e[m+(j*6|0)+4>>1]|0)&65535;b[g+(j*6|0)>>1]=(e[m+(j*6|0)>>1]|0)+32768-l;b[g+(j*6|0)+2>>1]=i;b[g+(j*6|0)+4>>1]=n;j=j+1|0}while((j|0)!=(h|0));return}j=(i|0)<(h|0)?i:h;if((j|0)<=0)return;d=i<<1;f=0;do{h=b[m+(f*6|0)+2>>1]|0;l=h&65535;n=32768-l+(e[m+(f*6|0)+4>>1]|0)&65535;b[g+(f<<1)>>1]=(e[m+(f*6|0)>>1]|0)+32768-l;b[g+(f+i<<1)>>1]=h;b[g+(f+d<<1)>>1]=n;f=f+1|0}while((f|0)!=(j|0));return}case 4:{if((c[j+24>>2]|0)!=1)return;j=(i|0)<(h|0)?i:h;if((j|0)<=0)return;d=i<<1;f=i*3|0;k=0;do{l=b[m+(k<<3)+2>>1]|0;n=b[m+(k<<3)+6>>1]|0;o=l&65535;h=32768-o+(e[m+(k<<3)+4>>1]|0)&65535;b[g+(k<<1)>>1]=(e[m+(k<<3)>>1]|0)+32768-o;b[g+(k+i<<1)>>1]=l;b[g+(k+d<<1)>>1]=h;b[g+(k+f<<1)>>1]=n;k=k+1|0}while((k|0)!=(j|0));return}default:return}}function Gd(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;q=i;i=i+176|0;r=q+152|0;t=q+16|0;s=q;l=b+4|0;h=c[l>>2]|0;p=f<<1;j=$(p,c[h+16>>2]|0)|0;do{if(j){k=b+20|0;while(1){h=Gb[c[(c[d>>2]|0)+32>>2]&63](d,c[k>>2]|0,j)|0;if(!h)break;if((j|0)==(h|0)){m=26;break}else j=j-h|0}if((m|0)==26){h=c[l>>2]|0;break}m=t+56|0;l=t+4|0;c[t>>2]=36160;c[m>>2]=36180;o=0;ia(62,t+56|0,l|0);q=o;o=0;if(q&1){t=Na()|0;fn(m);Ya(t|0)}c[t+128>>2]=0;c[t+132>>2]=-1;c[t>>2]=36200;c[t+56>>2]=36220;o=0;ha(180,l|0);q=o;o=0;do{if(q&1)h=Na()|0;else{c[l>>2]=36236;d=t+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[t+52>>2]=16;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;o=0;ia(63,l|0,r|0);q=o;o=0;if(q&1){h=Na()|0;Im(r);Im(d);nn(l);break}Im(r);o=0;h=ma(28,t|0,49029,57)|0;r=o;o=0;if(!(r&1)?(o=0,ra(36,h|0,0)|0,r=o,o=0,!(r&1)):0){k=Ma(16)|0;o=0;ia(64,s|0,l|0);r=o;o=0;if(!(r&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,s|0);r=o;o=0;if(r&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(s);if(!j){s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}else h=Na()|0;La(k|0);s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}s=Na()|0;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}while(0);t=h;fn(m);Ya(t|0)}}while(0);j=b+20|0;if((c[h+28>>2]|0)!=536870912){t=c[j>>2]|0;Fd(b,t,e,f,g);i=q;return}Oc(c[j>>2]|0,$(p,c[h+16>>2]|0)|0);t=c[j>>2]|0;Fd(b,t,e,f,g);i=q;return}function Hd(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;m=d+4|0;d=c[m>>2]|0;a:do{switch(c[d+16>>2]|0){case 3:{if((c[d+24>>2]|0)==2){if((h|0)>0)d=0;else break a;while(1){l=b[f+(d*6|0)+2>>1]|0;k=l&65535;i=k+32768+(e[f+(d*6|0)+4>>1]|0)&65535;b[g+(d*6|0)>>1]=(e[f+(d*6|0)>>1]|0)+32768+k;b[g+(d*6|0)+2>>1]=l;b[g+(d*6|0)+4>>1]=i;d=d+1|0;if((d|0)==(h|0))break a}}d=(h|0)<(i|0)?h:i;if((d|0)>0){j=i<<1;k=0;do{n=b[f+(k+i<<1)>>1]|0;o=n&65535;l=o+32768+(e[f+(k+j<<1)>>1]|0)&65535;b[g+(k*6|0)>>1]=(e[f+(k<<1)>>1]|0)+32768+o;b[g+(k*6|0)+2>>1]=n;b[g+(k*6|0)+4>>1]=l;k=k+1|0}while((k|0)!=(d|0))}break}case 4:{if((c[d+24>>2]|0)==1?(l=(h|0)<(i|0)?h:i,(l|0)>0):0){d=i<<1;j=i*3|0;k=0;do{o=b[f+(k+i<<1)>>1]|0;n=o&65535;p=(e[f+(k<<1)>>1]|0)+32768+n|0;n=n+32768+(e[f+(k+d<<1)>>1]|0)|0;q=b[f+(k+j<<1)>>1]|0;o=mw(o&65535|0,0,16)|0;n=D|n;q=mw(q&65535|0,0,48)|0;q=p&65535|o|q;n=n&65535|D;o=g+(k<<3)|0;p=o;b[p>>1]=q;b[p+2>>1]=q>>>16;o=o+4|0;b[o>>1]=n;b[o+2>>1]=n>>>16;k=k+1|0}while((k|0)!=(l|0))}break}default:{}}}while(0);d=c[m>>2]|0;if(!(a[d+32>>0]|0))return;k=c[d+16>>2]|0;if((h|0)<=0)return;d=g;j=0;while(1){q=d+4|0;p=b[d>>1]|0;b[d>>1]=b[q>>1]|0;b[q>>1]=p;j=j+1|0;if((j|0)==(h|0))break;else d=d+(k<<1)|0}return}function Id(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36460;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e)return;b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);return}function Jd(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=36460;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}e=c[a+8>>2]|0;if(!e){cj(a);return}b=a+12|0;d=c[b>>2]|0;if((d|0)!=(e|0))c[b>>2]=d+(~((d+-2-e|0)>>>1)<<1);cj(e);cj(a);return}function Kd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;g=b+36|0;if(!(c[g>>2]|0)){j=b+40|0;Od(b,d,c[j>>2]|0,e,f);c[j>>2]=(c[j>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}k=b+4|0;h=e<<1;i=$(h,c[(c[k>>2]|0)+16>>2]|0)|0;j=b+20|0;Od(b,d,c[j>>2]|0,e,f);d=c[k>>2]|0;if((c[d+28>>2]|0)==536870912)Oc(c[j>>2]|0,$(h,c[d+16>>2]|0)|0);k=c[g>>2]|0;if((Gb[c[(c[k>>2]|0)+48>>2]&63](k,c[j>>2]|0,i)|0)==(i|0))return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,3,35648);k=o;o=0;if(k&1){k=Na()|0;La(d|0);Ya(k|0)}else lb(d|0,824,96)}function Ld(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;Md(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{Nd(a,f,b,d,e);return}}function Md(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0;k=d+4|0;i=c[k>>2]|0;do{if(!(a[i+32>>0]|0))l=e;else{d=d+8|0;lw(c[d>>2]|0,e|0,g*6|0)|0;i=c[k>>2]|0;j=c[i+16>>2]|0;if((g|0)<=0){l=c[d>>2]|0;break}d=c[d>>2]|0;i=d;e=0;while(1){l=i+4|0;m=b[i>>1]|0;b[i>>1]=b[l>>1]|0;b[l>>1]=m;e=e+1|0;if((e|0)==(g|0))break;else i=i+(j<<1)|0}l=d;i=c[k>>2]|0}}while(0);switch(c[i+16>>2]|0){case 3:{if((c[i+24>>2]|0)==2){if((g|0)>0)i=0;else return;do{h=b[l+(i*6|0)+2>>1]|0;m=b[l+(i*6|0)+4>>1]|0;b[f+(i*6|0)>>1]=b[l+(i*6|0)>>1]|0;b[f+(i*6|0)+2>>1]=h;b[f+(i*6|0)+4>>1]=m;i=i+1|0}while((i|0)!=(g|0));return}i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;d=h<<1;e=0;do{g=b[l+(e*6|0)+2>>1]|0;m=b[l+(e*6|0)+4>>1]|0;b[f+(e<<1)>>1]=b[l+(e*6|0)>>1]|0;b[f+(e+h<<1)>>1]=g;b[f+(e+d<<1)>>1]=m;e=e+1|0}while((e|0)!=(i|0));return}case 4:{if((c[i+24>>2]|0)!=1)return;i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;d=h<<1;e=h*3|0;j=0;do{k=b[l+(j<<3)+2>>1]|0;g=b[l+(j<<3)+4>>1]|0;m=b[l+(j<<3)+6>>1]|0;b[f+(j<<1)>>1]=b[l+(j<<3)>>1]|0;b[f+(j+h<<1)>>1]=k;b[f+(j+d<<1)>>1]=g;b[f+(j+e<<1)>>1]=m;j=j+1|0}while((j|0)!=(i|0));return}default:return}}function Nd(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;q=i;i=i+176|0;r=q+152|0;t=q+16|0;s=q;l=b+4|0;h=c[l>>2]|0;p=f<<1;j=$(p,c[h+16>>2]|0)|0;do{if(j){k=b+20|0;while(1){h=Gb[c[(c[d>>2]|0)+32>>2]&63](d,c[k>>2]|0,j)|0;if(!h)break;if((j|0)==(h|0)){m=26;break}else j=j-h|0}if((m|0)==26){h=c[l>>2]|0;break}m=t+56|0;l=t+4|0;c[t>>2]=36160;c[m>>2]=36180;o=0;ia(62,t+56|0,l|0);q=o;o=0;if(q&1){t=Na()|0;fn(m);Ya(t|0)}c[t+128>>2]=0;c[t+132>>2]=-1;c[t>>2]=36200;c[t+56>>2]=36220;o=0;ha(180,l|0);q=o;o=0;do{if(q&1)h=Na()|0;else{c[l>>2]=36236;d=t+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[t+52>>2]=16;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;o=0;ia(63,l|0,r|0);q=o;o=0;if(q&1){h=Na()|0;Im(r);Im(d);nn(l);break}Im(r);o=0;h=ma(28,t|0,49029,57)|0;r=o;o=0;if(!(r&1)?(o=0,ra(36,h|0,0)|0,r=o,o=0,!(r&1)):0){k=Ma(16)|0;o=0;ia(64,s|0,l|0);r=o;o=0;if(!(r&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,s|0);r=o;o=0;if(r&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(s);if(!j){s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}else h=Na()|0;La(k|0);s=h;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}s=Na()|0;c[t>>2]=36200;c[m>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(m);Ya(s|0)}}while(0);t=h;fn(m);Ya(t|0)}}while(0);j=b+20|0;if((c[h+28>>2]|0)!=536870912){t=c[j>>2]|0;Md(b,t,e,f,g);i=q;return}Oc(c[j>>2]|0,$(p,c[h+16>>2]|0)|0);t=c[j>>2]|0;Md(b,t,e,f,g);i=q;return}function Od(d,f,g,h,i){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;m=d+4|0;d=c[m>>2]|0;a:do{switch(c[d+16>>2]|0){case 3:{if((c[d+24>>2]|0)==2){if((h|0)>0)d=0;else break a;while(1){l=b[f+(d*6|0)+2>>1]|0;i=b[f+(d*6|0)+4>>1]|0;b[g+(d*6|0)>>1]=b[f+(d*6|0)>>1]|0;b[g+(d*6|0)+2>>1]=l;b[g+(d*6|0)+4>>1]=i;d=d+1|0;if((d|0)==(h|0))break a}}d=(h|0)<(i|0)?h:i;if((d|0)>0){j=i<<1;k=0;do{n=b[f+(k+i<<1)>>1]|0;l=b[f+(k+j<<1)>>1]|0;b[g+(k*6|0)>>1]=b[f+(k<<1)>>1]|0;b[g+(k*6|0)+2>>1]=n;b[g+(k*6|0)+4>>1]=l;k=k+1|0}while((k|0)!=(d|0))}break}case 4:{if((c[d+24>>2]|0)==1?(l=(h|0)<(i|0)?h:i,(l|0)>0):0){d=i<<1;j=i*3|0;k=0;do{n=b[f+(k<<1)>>1]|0;q=b[f+(k+j<<1)>>1]|0;o=e[f+(k+d<<1)>>1]|0;p=mw(e[f+(k+i<<1)>>1]|0,0,16)|0;o=D|o;q=mw(q&65535|0,0,48)|0;q=p|n&65535|q;o=o&65535|D;n=g+(k<<3)|0;p=n;b[p>>1]=q;b[p+2>>1]=q>>>16;n=n+4|0;b[n>>1]=o;b[n+2>>1]=o>>>16;k=k+1|0}while((k|0)!=(l|0))}break}default:{}}}while(0);d=c[m>>2]|0;if(!(a[d+32>>0]|0))return;k=c[d+16>>2]|0;if((h|0)<=0)return;d=g;j=0;while(1){q=d+4|0;p=b[d>>1]|0;b[d>>1]=b[q>>1]|0;b[q>>1]=p;j=j+1|0;if((j|0)==(h|0))break;else d=d+(k<<1)|0}return}function Pd(a){a=a|0;return}function Qd(a){a=a|0;cj(a);return}function Rd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;e=$(c[b+8>>2]|0,e)|0;b=c[b+4>>2]|0;if((Gb[c[(c[b>>2]|0)+48>>2]&63](b,d,e)|0)==(e|0))return;f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,3,35648);b=o;o=0;if(b&1){b=Na()|0;La(f|0);Ya(b|0)}else lb(f|0,824,96)}function Sd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,p=0;p=i;i=i+16|0;m=p;l=b+8|0;g=c[l>>2]|0;f=$(g,e)|0;do{if(f){j=b+4|0;h=f;while(1){g=c[j>>2]|0;g=Gb[c[(c[g>>2]|0)+32>>2]&63](g,d,h)|0;if(!g)break;f=h-g|0;if((h|0)==(g|0)){k=11;break}else h=f}if((k|0)==11){g=c[l>>2]|0;h=f;break}f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,3,35648);b=o;o=0;if(b&1){b=Na()|0;La(f|0);Ya(b|0)}else lb(f|0,824,96)}else h=0}while(0);if((g|0)==2){Oc(d,e<<1);g=c[l>>2]|0}f=c[b+12>>2]|0;if((f|0)<=($(g,e)|0)){i=p;return}b=c[b+4>>2]|0;Ib[c[(c[b>>2]|0)+16>>2]&15](m,b,f-h|0,0,1,24);i=p;return}function Td(a){a=a|0;cj(a);return}function Ud(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=a+4|0;lw(c[e>>2]|0,b|0,$(c[a+8>>2]|0,d)|0)|0;c[e>>2]=(c[e>>2]|0)+(c[a+12>>2]|0);return}function Vd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;e=a+4|0;lw(b|0,c[e>>2]|0,$(c[a+8>>2]|0,d)|0)|0;c[e>>2]=(c[e>>2]|0)+(c[a+12>>2]|0);return}function Wd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c[b+112>>2]=0;c[b+108>>2]=0;l=c[d>>2]|0;g=l;do{if(l){i=b+92|0;l=b+96|0;j=c[l>>2]|0;k=c[i>>2]|0;e=k;f=j-e|0;if(f>>>0>=4e4)if(f>>>0>4e4?(h=k+4e4|0,(j|0)!=(h|0)):0){c[l>>2]=h;h=e}else h=e;else{Xd(i,4e4-f|0);h=c[i>>2]|0;g=c[d>>2]|0}e=b+116|0;c[e>>2]=h;j=b+124|0;c[j>>2]=h;k=b+104|0;c[k>>2]=g;f=g;if(g){if((c[f+12>>2]|0)==(c[f+16>>2]|0)){d=(Eb[c[(c[g>>2]|0)+36>>2]&127](f)|0)==-1;f=c[j>>2]|0;if(d)break;g=c[e>>2]|0}else{f=h;g=h}i=f-g|0;if(i>>>0<=64){h=b+92|0;if((f|0)==(g|0))f=g;else{f=g;g=0;do{a[(c[h>>2]|0)+g>>0]=a[f+g>>0]|0;g=g+1|0;f=c[e>>2]|0}while(g>>>0>>0);g=c[j>>2]|0}h=c[h>>2]|0;d=h;m=d-f|0;c[e>>2]=h;f=g+m|0;c[j>>2]=f;h=b+120|0;c[h>>2]=(c[h>>2]|0)+m;k=c[k>>2]|0;f=Gb[c[(c[k>>2]|0)+32>>2]&63](k,f,(c[l>>2]|0)-(d+i)|0)|0;f=(c[j>>2]|0)+f|0;c[j>>2]=f}}else f=h}else{c[b+104>>2]=0;f=c[d+4>>2]|0;e=b+116|0;c[e>>2]=f;f=f+(c[d+8>>2]|0)|0;c[b+124>>2]=f}}while(0);e=c[e>>2]|0;if(e>>>0>=f>>>0){l=e;m=b+120|0;c[m>>2]=l;ge(b);return}while(1){if((a[e>>0]|0)==-1){f=20;break}e=e+1|0;if(e>>>0>=f>>>0){f=20;break}}if((f|0)==20){m=b+120|0;c[m>>2]=e;ge(b);return}}function Xd(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;k=b+8|0;g=c[k>>2]|0;l=b+4|0;e=c[l>>2]|0;f=e;if((g-f|0)>>>0>=d>>>0){do{a[e>>0]=0;e=(c[l>>2]|0)+1|0;c[l>>2]=e;d=d+-1|0}while((d|0)!=0);return}e=c[b>>2]|0;h=f-e+d|0;if((h|0)<0){$i(b);g=c[k>>2]|0;e=c[b>>2]|0}f=g-e|0;if(f>>>0<1073741823){f=f<<1;f=f>>>0>>0?h:f;e=(c[l>>2]|0)-e|0;if(!f){g=0;i=0;h=e}else j=8}else{f=2147483647;e=(c[l>>2]|0)-e|0;j=8}if((j|0)==8){g=f;i=bj(f)|0;h=e}e=i+h|0;g=i+g|0;f=e;do{a[f>>0]=0;f=e+1|0;e=f;d=d+-1|0}while((d|0)!=0);d=c[b>>2]|0;f=(c[l>>2]|0)-d|0;j=i+(h-f)|0;lw(j|0,d|0,f|0)|0;c[b>>2]=j;c[l>>2]=e;c[k>>2]=g;if(!d)return;cj(d);return}function Yd(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;v=i;i=i+32|0;x=v+12|0;u=v;r=a+180|0;s=(c[r>>2]|0)+4|0;if((c[a+32>>2]|0)==1)t=c[a+24>>2]|0;else t=1;d=$(t<<1,s)|0;c[x>>2]=0;y=x+4|0;c[y>>2]=0;c[x+8>>2]=0;do{if(d){if(!((d|0)<0?(o=0,ha(178,x|0),w=o,o=0,w&1):0))j=6;if((j|0)==6?(e=d<<1,o=0,f=ka(67,e|0)|0,w=o,o=0,!(w&1)):0){c[x>>2]=f;w=f+(d<<1)|0;c[x+8>>2]=w;iw(f|0,0,e|0)|0;c[y>>2]=w;break}f=Na()|0;d=c[x>>2]|0;if(!d)Ya(f|0);e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}}while(0);c[u>>2]=0;w=u+4|0;c[w>>2]=0;c[u+8>>2]=0;do{if(!t)j=18;else{if(!(t>>>0>1073741823?(o=0,ha(178,u|0),q=o,o=0,q&1):0))j=16;if((j|0)==16?(g=t<<2,o=0,h=ka(67,g|0)|0,q=o,o=0,!(q&1)):0){c[u>>2]=h;j=h+(t<<2)|0;c[u+8>>2]=j;iw(h|0,0,g|0)|0;c[w>>2]=j;j=18;break}f=Na()|0;d=c[u>>2]|0;e=d;if(d){g=c[w>>2]|0;if((g|0)!=(d|0))c[w>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==18){h=a+12|0;a:do{if((c[h>>2]|0)>0){j=a+4604|0;k=($(t,s)|0)+1|0;l=a+4608|0;m=a+92|0;n=(t|0)>0;p=a+4600|0;q=0;b:while(1){e=c[x>>2]|0;d=e+2|0;c[j>>2]=d;e=e+(k<<1)|0;c[l>>2]=e;if(!(q&1))d=e;else{c[j>>2]=e;c[l>>2]=d}g=c[m>>2]|0;o=0;Aa(c[(c[g>>2]|0)+12>>2]|0,g|0,d|0,c[r>>2]|0,s|0);g=o;o=0;if(g&1){j=28;break}if(n){d=c[j>>2]|0;e=c[l>>2]|0;f=c[u>>2]|0;g=0;do{c[p>>2]=c[f+(g<<2)>>2];f=c[r>>2]|0;b[d+(f<<1)>>1]=b[d+(f+-1<<1)>>1]|0;b[e+-2>>1]=b[d>>1]|0;o=0;ia(68,a|0,0);f=o;o=0;if(f&1){j=27;break b}f=c[u>>2]|0;c[f+(g<<2)>>2]=c[p>>2];d=(c[j>>2]|0)+(s<<1)|0;c[j>>2]=d;e=(c[l>>2]|0)+(s<<1)|0;c[l>>2]=e;g=g+1|0}while((g|0)<(t|0))}q=q+1|0;if((q|0)>=(c[h>>2]|0)){j=40;break a}}if((j|0)==27){f=Na()|0;break}else if((j|0)==28){f=Na()|0;break}}else j=40}while(0);do{if((j|0)==40){o=0;ha(182,a|0);a=o;o=0;if(a&1){f=Na()|0;break}d=c[u>>2]|0;e=d;if(d){f=c[w>>2]|0;if((f|0)!=(d|0))c[w>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[x>>2]|0;if(!d){i=v;return}e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);i=v;return}}while(0);d=c[u>>2]|0;e=d;if(d){g=c[w>>2]|0;if((g|0)!=(d|0))c[w>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[x>>2]|0;if(!d)Ya(f|0);e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}function Zd(d,f){d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;p=d+4604|0;f=c[p>>2]|0;s=d+180|0;if((c[s>>2]|0)<=0)return;q=d+4608|0;r=d+4612|0;i=f;j=e[f+-2>>1]|0;f=e[f>>1]|0;o=0;while(1){n=c[q>>2]|0;m=e[n+(o+-1<<1)>>1]|0;h=o+1|0;g=e[i+(h<<1)>>1]|0;l=c[r>>2]|0;k=f-j|0;i=j-m|0;l=((((a[l+(g-f)>>0]|0)*9|0)+(a[l+k>>0]|0)|0)*9|0)+(a[l+i>>0]|0)|0;if(!l){h=(ce(d,o,0)|0)+o|0;g=c[p>>2]|0;f=e[g+(h+-1<<1)>>1]|0;g=e[g+(h<<1)>>1]|0}else{j=f-m>>31;if((j^i|0)<0)i=f;else i=m+((j^k|0)<0?0:k)|0;n=be(d,l,e[n+(o<<1)>>1]|0,i,0)|0;b[(c[q>>2]|0)+(o<<1)>>1]=n}if((h|0)>=(c[s>>2]|0))break;i=c[p>>2]|0;j=f;f=g;o=h}return}function _d(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=b+104|0;if((c[g>>2]|0)>>>0<4)$d(b);h=b+100|0;i=b+112|0;j=b+96|0;k=b+108|0;l=b+116|0;d=c[h>>2]|0;f=0;do{e=a[i>>0]|0;if((d|0)>31)break;d=c[j>>2]|0;if(!(e<<24>>24)){a[c[k>>2]>>0]=d>>>24;c[j>>2]=c[j>>2]<<8;d=(c[h>>2]|0)+8|0}else{a[c[k>>2]>>0]=d>>>25;c[j>>2]=c[j>>2]<<7;d=(c[h>>2]|0)+7|0}c[h>>2]=d;m=c[k>>2]|0;e=(a[m>>0]|0)==-1&1;a[i>>0]=e;c[k>>2]=m+1;c[g>>2]=(c[g>>2]|0)+-1;c[l>>2]=(c[l>>2]|0)+1;f=f+1|0}while((f|0)<4);if(!(e<<24>>24))ae(b,0,(d|0)%8|0);else ae(b,0,(d+-1|0)%8|0);if((c[g>>2]|0)>>>0<4)$d(b);d=c[h>>2]|0;e=0;do{if((d|0)>31)break;d=c[j>>2]|0;if(!(a[i>>0]|0)){a[c[k>>2]>>0]=d>>>24;c[j>>2]=c[j>>2]<<8;d=(c[h>>2]|0)+8|0}else{a[c[k>>2]>>0]=d>>>25;c[j>>2]=c[j>>2]<<7;d=(c[h>>2]|0)+7|0}c[h>>2]=d;m=c[k>>2]|0;a[i>>0]=(a[m>>0]|0)==-1&1;c[k>>2]=m+1;c[g>>2]=(c[g>>2]|0)+-1;c[l>>2]=(c[l>>2]|0)+1;e=e+1|0}while((e|0)<4);if(!(c[b+132>>2]|0))return;$d(b);return}function $d(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;d=c[b+132>>2]|0;if(!d){d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,4,35648);b=o;o=0;if(!(b&1))lb(d|0,824,96);b=Na()|0;La(d|0);Ya(b|0)}e=b+108|0;f=b+120|0;h=c[f>>2]|0;g=(c[e>>2]|0)-h|0;if((Gb[c[(c[d>>2]|0)+48>>2]&63](d,h,g)|0)==(g|0)){h=c[f>>2]|0;c[e>>2]=h;c[b+104>>2]=(c[b+124>>2]|0)-h;return}d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,4,35648);h=o;o=0;if(!(h&1))lb(d|0,824,96);h=Na()|0;La(d|0);Ya(h|0)}function ae(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;l=b+100|0;e=(c[l>>2]|0)-e|0;c[l>>2]=e;if((e|0)>-1){m=b+96|0;c[m>>2]=c[m>>2]|d<>2]=c[m>>2]|d>>0-e;k=b+104|0;if((c[k>>2]|0)>>>0<4){$d(b);e=c[l>>2]|0}h=b+112|0;i=b+108|0;j=b+116|0;f=0;while(1){if((e|0)>31)break;e=c[m>>2]|0;if(!(a[h>>0]|0)){a[c[i>>2]>>0]=e>>>24;c[m>>2]=c[m>>2]<<8;e=(c[l>>2]|0)+8|0}else{a[c[i>>2]>>0]=e>>>25;c[m>>2]=c[m>>2]<<7;e=(c[l>>2]|0)+7|0}c[l>>2]=e;n=c[i>>2]|0;a[h>>0]=(a[n>>0]|0)==-1&1;c[i>>2]=n+1;c[k>>2]=(c[k>>2]|0)+-1;c[j>>2]=(c[j>>2]|0)+1;f=f+1|0;if((f|0)>=4){g=11;break}}a:do{if((g|0)==11)if((e|0)<0){c[m>>2]=c[m>>2]|d>>0-e;if((c[k>>2]|0)>>>0<4){$d(b);e=c[l>>2]|0;f=0}else f=0;do{if((e|0)>31)break a;e=c[m>>2]|0;if(!(a[h>>0]|0)){a[c[i>>2]>>0]=e>>>24;c[m>>2]=c[m>>2]<<8;e=(c[l>>2]|0)+8|0}else{a[c[i>>2]>>0]=e>>>25;c[m>>2]=c[m>>2]<<7;e=(c[l>>2]|0)+7|0}c[l>>2]=e;n=c[i>>2]|0;a[h>>0]=(a[n>>0]|0)==-1&1;c[i>>2]=n+1;c[k>>2]=(c[k>>2]|0)+-1;c[j>>2]=(c[j>>2]|0)+1;f=f+1|0}while((f|0)<4)}}while(0);c[m>>2]=c[m>>2]|d<>31;h=(r^d)-r|0;p=a+196+(h*12|0)+10|0;i=b[p>>1]|0;o=a+196+(h*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){d=5;while(1)if((i<>1]^r)-r+f|0;q=a+136|0;f=c[q>>2]|0;if((g&f|0)==(g|0))l=g;else l=f&~(g>>31);g=(e-l^r)-r|0;k=a+144|0;f=c[k>>2]|0;if((g|0)>0)g=(g+f|0)/(f<<1|1|0)|0;else g=(g-f|0)/(f<<1|1|0)|0;n=a+140|0;j=c[n>>2]|0;e=((g|0)<0?j:0)+g|0;j=e-((e|0)<((j+1|0)/2|0|0)?0:j)|0;h=a+196+(h*12|0)+4|0;if(!(f|d))g=(c[h>>2]<<1)+-1+i>>31;else g=0;f=g^j;fe(a,d,f>>30^f<<1,c[a+156>>2]|0);f=c[a+160>>2]|0;d=(c[o>>2]|0)+((j|0)>-1?j:0-j|0)|0;g=(c[h>>2]|0)+($(c[k>>2]<<1|1,j)|0)|0;e=b[p>>1]|0;if((e|0)==(f|0)){d=d>>1;g=g>>1;e=f>>1}c[o>>2]=d;f=e+1|0;b[p>>1]=f;d=f+g|0;if((d|0)>=1){if((g|0)>0){g=g-f|0;p=b[m>>1]|0;b[m>>1]=(p<<16>>16<127&1)+(p&65535);g=(g|0)>0?0:g}}else{g=b[m>>1]|0;b[m>>1]=(g&65535)-(g<<16>>16>-128&1);g=(d|0)>(~e|0)?d:0-e|0}c[h>>2]=g;f=c[k>>2]|0;e=f<<1|1;d=($(e,(j^r)-r|0)|0)+l|0;if((d|0)>=(0-f|0)){g=c[q>>2]|0;if((g+f|0)<(d|0))d=d-($(c[n>>2]|0,e)|0)|0}else{d=($(c[n>>2]|0,e)|0)+d|0;g=c[q>>2]|0}if((d&g|0)==(d|0)){r=d;r=r&65535;return r|0}r=g&~(d>>31);r=r&65535;return r|0}function ce(a,d,f){a=a|0;d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;l=(c[a+180>>2]|0)-d|0;m=c[a+4608>>2]|0;n=c[a+4604>>2]|0;h=b[m+(d+-1<<1)>>1]|0;k=h&65535;f=c[a+144>>2]|0;i=0;while(1){g=m+(i+d<<1)|0;j=(e[g>>1]|0)-k|0;if((((j|0)>-1?j:0-j|0)|0)>(f|0))break;b[g>>1]=h;i=i+1|0;if((i|0)==(l|0)){i=l;break}}h=(i|0)==(l|0);j=a+4600|0;g=c[36476+(c[j>>2]<<2)>>2]|0;if((1<(i|0))f=i;else{f=i;do{ae(a,1,1);g=c[j>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[j>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>1]=de(a,e[d>>1]|0,k,e[n+(l<<1)>>1]|0)|0;a=c[j>>2]|0;c[j>>2]=(a|0)<1?0:a+-1|0;a=i+1|0;return a|0}if(!f){a=l;return a|0}ae(a,1,1);a=l;return a|0}function de(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;i=d-e|0;j=a+136|0;h=a+144|0;f=c[h>>2]|0;if((((i|0)>-1?i:0-i|0)|0)>(f|0)){g=e-d>>31|1;b=$(g,b-e|0)|0;if((b|0)>0)b=(f+b|0)/(f<<1|1|0)|0;else b=(b-f|0)/(f<<1|1|0)|0;i=a+140|0;f=c[i>>2]|0;d=((b|0)<0?f:0)+b|0;f=d-((d|0)<((f+1|0)/2|0|0)?0:f)|0;ee(a,a+4576|0,f);f=$(f,g)|0;g=c[h>>2]|0;h=g<<1|1;f=($(f,h)|0)+e|0;if((f|0)>=(0-g|0)){b=c[j>>2]|0;if((b+g|0)<(f|0))f=f-($(c[i>>2]|0,h)|0)|0}else{f=($(c[i>>2]|0,h)|0)+f|0;b=c[j>>2]|0}if((f&b|0)==(f|0)){j=f;j=j&65535;return j|0}j=b&~(f>>31);j=j&65535;return j|0}else{b=b-d|0;if((b|0)>0)b=(f+b|0)/(f<<1|1|0)|0;else b=(b-f|0)/(f<<1|1|0)|0;i=a+140|0;f=c[i>>2]|0;g=((b|0)<0?f:0)+b|0;f=g-((g|0)<((f+1|0)/2|0|0)?0:f)|0;ee(a,a+4588|0,f);g=c[h>>2]|0;h=g<<1|1;f=($(h,f)|0)+d|0;if((f|0)>=(0-g|0)){b=c[j>>2]|0;if((b+g|0)<(f|0))f=f-($(c[i>>2]|0,h)|0)|0}else{f=($(c[i>>2]|0,h)|0)+f|0;b=c[j>>2]|0}if((f&b|0)==(f|0)){j=f;j=j&65535;return j|0}j=b&~(f>>31);j=j&65535;return j|0}return 0}function ee(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;fe(b,h,g,(c[b+156>>2]|0)+-1-(c[36476+(c[b+4600>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function fe(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=d>>b;g=a+148|0;h=e-(c[g>>2]|0)|0;if((f|0)<(h+-1|0)){if((f|0)>30){e=(f|0)/2|0;ae(a,0,e);f=f-e|0}ae(a,1,f+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,e+-31-(c[g>>2]|0)|0)}else ae(a,1,h);b=c[g>>2]|0;ae(a,(1<>2]|0;l=b+120|0;if(e>>>0<((c[l>>2]|0)+-3|0)>>>0){l=b+112|0;j=c[l>>2]|0;b=b+108|0;c[b>>2]=(d[e+1>>0]<<16|d[e>>0]<<24|d[e+2>>0]<<8|d[e+3>>0])>>>j|c[b>>2];b=32-j>>3;c[k>>2]=e+b;c[l>>2]=(b<<3)+j;return}j=b+104|0;f=c[j>>2]|0;do{if(f){if((c[f+12>>2]|0)==(c[f+16>>2]|0)){if((Eb[c[(c[f>>2]|0)+36>>2]&127](f)|0)==-1)break;e=c[k>>2]|0}h=b+124|0;f=c[h>>2]|0;i=f-e|0;if(i>>>0<=64){g=b+92|0;if((f|0)==(e|0))f=e;else{f=0;do{a[(c[g>>2]|0)+f>>0]=a[e+f>>0]|0;f=f+1|0;e=c[k>>2]|0}while(f>>>0>>0);f=e;e=c[h>>2]|0}p=c[g>>2]|0;g=p;m=g-f|0;c[k>>2]=p;f=e+m|0;c[h>>2]=f;c[l>>2]=(c[l>>2]|0)+m;j=c[j>>2]|0;j=Gb[c[(c[j>>2]|0)+32>>2]&63](j,f,(c[b+96>>2]|0)-(g+i)|0)|0;c[h>>2]=(c[h>>2]|0)+j}}}while(0);j=b+112|0;i=b+108|0;b=c[b+124>>2]|0;h=b+-1|0;e=c[k>>2]|0;while(1){if(e>>>0>=b>>>0){f=14;break}g=a[e>>0]|0;f=g&255;g=g<<24>>24==-1;if(g){if((e|0)==(h|0)){f=25;break}e=e+1|0;if((a[e>>0]|0)<0){f=25;break}}else e=e+1|0;p=c[j>>2]|0;c[i>>2]=f<<24-p|c[i>>2];c[k>>2]=e;p=p+(g?7:8)|0;c[j>>2]=p;if((p|0)>=24){f=33;break}}if((f|0)==14){if((c[j>>2]|0)>=1)return;e=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,e|0,5,35648);p=o;o=0;if(!(p&1))lb(e|0,824,96);p=Na()|0;La(e|0);Ya(p|0)}else if((f|0)==25){if((c[j>>2]|0)>=1)return;e=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,e|0,5,35648);p=o;o=0;if(!(p&1))lb(e|0,824,96);p=Na()|0;La(e|0);Ya(p|0)}else if((f|0)==33){a:do{if(e>>>0>>0)do{if((a[e>>0]|0)==-1)break a;e=e+1|0}while(e>>>0>>0)}while(0);c[l>>2]=e;return}}function he(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;f=p;o=b+144|0;a:do{if(!(c[o>>2]|0)){e=c[b+136>>2]|0;d=b+152|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+184>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+188>>2]|0):0)?(c[f+12>>2]|0)==(c[b+192>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4612>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4612>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4612>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4612>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+152|0}while(0);n=1<>2];e=b+4616|0;f=n<<1;g=b+4620|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4612|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+192|0;l=b+188|0;j=b+184|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function ie(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;k=b+8|0;g=c[k>>2]|0;l=b+4|0;e=c[l>>2]|0;f=e;if((g-f|0)>>>0>=d>>>0){do{a[e>>0]=0;e=(c[l>>2]|0)+1|0;c[l>>2]=e;d=d+-1|0}while((d|0)!=0);return}e=c[b>>2]|0;h=f-e+d|0;if((h|0)<0){$i(b);g=c[k>>2]|0;e=c[b>>2]|0}f=g-e|0;if(f>>>0<1073741823){f=f<<1;f=f>>>0>>0?h:f;e=(c[l>>2]|0)-e|0;if(!f){g=0;i=0;h=e}else j=8}else{f=2147483647;e=(c[l>>2]|0)-e|0;j=8}if((j|0)==8){g=f;i=bj(f)|0;h=e}e=i+h|0;g=i+g|0;f=e;do{a[f>>0]=0;f=e+1|0;e=f;d=d+-1|0}while((d|0)!=0);d=c[b>>2]|0;f=(c[l>>2]|0)-d|0;j=i+(h-f)|0;lw(j|0,d|0,f|0)|0;c[b>>2]=j;c[l>>2]=e;c[k>>2]=g;if(!d)return;cj(d);return}function je(a){a=a|0;var b=0,d=0;c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function ke(a){a=a|0;var b=0,d=0;c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function le(a){a=a|0;var b=0,d=0;c[a>>2]=36052;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function me(a){a=a|0;var b=0,d=0;c[a>>2]=36052;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function ne(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+136>>2]|0,c[d+144>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+184>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+188>>2]=j;c[d+192>>2]=h;xe(d);h=d+140|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+196+(j*12|0)>>2]=e;c[d+196+(j*12|0)+4>>2]=0;b[d+196+(j*12|0)+8>>1]=0;b[d+196+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4576>>2]=l;c[d+4580>>2]=0;a[d+4584>>0]=m;a[d+4585>>0]=1;a[d+4586>>0]=0;c[d+4588>>2]=l;c[d+4592>>2]=1;a[d+4596>>0]=m;a[d+4597>>0]=1;a[d+4598>>0]=0;c[d+4600>>2]=0;i=k;return}function oe(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4624)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35828;c[e+128>>2]=c[d+136>>2];c[e+132>>2]=c[d+140>>2];c[e+136>>2]=c[d+144>>2];c[e+140>>2]=c[d+148>>2];c[e+144>>2]=c[d+152>>2];c[e+148>>2]=c[d+156>>2];c[e+152>>2]=c[d+160>>2];h=e+156|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+172>>2]=c[g>>2];c[e+176>>2]=0;c[e+180>>2]=0;c[e+184>>2]=0;h=e+4568|0;g=e+188|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4580|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4592|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];qe(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;qe(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function pe(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=6;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=6;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function qe(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;u=i;i=i+32|0;w=u+12|0;t=u;q=a+180|0;r=(c[q>>2]|0)+4|0;if((c[a+32>>2]|0)==1)s=c[a+24>>2]|0;else s=1;d=$(s<<1,r)|0;c[w>>2]=0;x=w+4|0;c[x>>2]=0;c[w+8>>2]=0;do{if(d){if(!(d>>>0>715827882?(o=0,ha(178,w|0),v=o,o=0,v&1):0))j=6;if((j|0)==6?(o=0,e=ka(67,d*6|0)|0,v=o,o=0,!(v&1)):0){c[x>>2]=e;c[w>>2]=e;f=e+(d*6|0)|0;c[w+8>>2]=f;while(1){b[e>>1]=0;b[e+2>>1]=0;b[e+4>>1]=0;d=d+-1|0;if(!d)break;else e=e+6|0}c[x>>2]=f;break}f=Na()|0;d=c[w>>2]|0;if(!d)Ya(f|0);e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-6-d|0)>>>0)/6|0)*6|0);cj(d);Ya(f|0)}}while(0);c[t>>2]=0;v=t+4|0;c[v>>2]=0;c[t+8>>2]=0;do{if(!s)j=20;else{if(!(s>>>0>1073741823?(o=0,ha(178,t|0),p=o,o=0,p&1):0))j=18;if((j|0)==18?(g=s<<2,o=0,h=ka(67,g|0)|0,p=o,o=0,!(p&1)):0){c[t>>2]=h;j=h+(s<<2)|0;c[t+8>>2]=j;iw(h|0,0,g|0)|0;c[v>>2]=j;j=20;break}f=Na()|0;d=c[t>>2]|0;e=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==20){g=a+12|0;a:do{if((c[g>>2]|0)>0){h=a+4604|0;j=($(s,r)|0)+1|0;k=a+4608|0;l=a+92|0;m=(s|0)>0;n=a+4600|0;p=0;b:while(1){e=c[w>>2]|0;d=e+6|0;c[h>>2]=d;e=e+(j*6|0)|0;c[k>>2]=e;if(!(p&1))d=e;else{c[h>>2]=e;c[k>>2]=d}f=c[l>>2]|0;o=0;Aa(c[(c[f>>2]|0)+12>>2]|0,f|0,d|0,c[q>>2]|0,r|0);f=o;o=0;if(f&1){j=30;break}if(m){d=c[t>>2]|0;e=c[h>>2]|0;f=0;do{c[n>>2]=c[d+(f<<2)>>2];y=c[q>>2]|0;d=e+(y*6|0)|0;e=e+((y+-1|0)*6|0)|0;b[d>>1]=b[e>>1]|0;b[d+2>>1]=b[e+2>>1]|0;b[d+4>>1]=b[e+4>>1]|0;e=(c[k>>2]|0)+-6|0;d=c[h>>2]|0;b[e>>1]=b[d>>1]|0;b[e+2>>1]=b[d+2>>1]|0;b[e+4>>1]=b[d+4>>1]|0;o=0;ia(69,a|0,0);e=o;o=0;if(e&1){j=29;break b}d=c[t>>2]|0;c[d+(f<<2)>>2]=c[n>>2];e=(c[h>>2]|0)+(r*6|0)|0;c[h>>2]=e;c[k>>2]=(c[k>>2]|0)+(r*6|0);f=f+1|0}while((f|0)<(s|0))}p=p+1|0;if((p|0)>=(c[g>>2]|0)){j=42;break a}}if((j|0)==29){f=Na()|0;break}else if((j|0)==30){f=Na()|0;break}}else j=42}while(0);do{if((j|0)==42){o=0;ha(182,a|0);y=o;o=0;if(y&1){f=Na()|0;break}d=c[t>>2]|0;e=d;if(d){f=c[v>>2]|0;if((f|0)!=(d|0))c[v>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[w>>2]|0;if(!d){i=u;return}e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-6-d|0)>>>0)/6|0)*6|0);cj(d);i=u;return}}while(0);d=c[t>>2]|0;e=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[w>>2]|0;if(!d)Ya(f|0);e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-6-d|0)>>>0)/6|0)*6|0);cj(d);Ya(f|0)}function re(d,f){d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;B=d+180|0;if((c[B>>2]|0)<=0)return;C=d+4608|0;D=d+4604|0;E=d+4612|0;A=0;while(1){x=A+-1|0;j=c[C>>2]|0;k=c[D>>2]|0;f=A+1|0;i=e[k+(A*6|0)>>1]|0;z=c[E>>2]|0;l=e[k+(x*6|0)>>1]|0;m=i-l|0;n=e[j+(x*6|0)>>1]|0;o=l-n|0;p=((((a[z+((e[k+(f*6|0)>>1]|0)-i)>>0]|0)*9|0)+(a[z+m>>0]|0)|0)*9|0)+(a[z+o>>0]|0)|0;h=e[k+(A*6|0)+2>>1]|0;q=e[k+(x*6|0)+2>>1]|0;r=h-q|0;s=e[j+(x*6|0)+2>>1]|0;t=q-s|0;u=((((a[z+((e[k+(f*6|0)+2>>1]|0)-h)>>0]|0)*9|0)+(a[z+r>>0]|0)|0)*9|0)+(a[z+t>>0]|0)|0;g=e[k+(A*6|0)+4>>1]|0;v=e[k+(x*6|0)+4>>1]|0;w=g-v|0;x=e[j+(x*6|0)+4>>1]|0;y=v-x|0;z=((((a[z+((e[k+(f*6|0)+4>>1]|0)-g)>>0]|0)*9|0)+(a[z+w>>0]|0)|0)*9|0)+(a[z+y>>0]|0)|0;if(!(u|p|z))f=(se(d,A,0)|0)+A|0;else{k=e[j+(A*6|0)>>1]|0;j=i-n>>31;if((j^o|0)>=0)if((j^m|0)<0)i=n;else i=n-l+i|0;k=te(d,p,k,i,0)|0;j=e[(c[C>>2]|0)+(A*6|0)+2>>1]|0;i=h-s>>31;if((i^t|0)>=0)if((i^r|0)<0)h=s;else h=s-q+h|0;i=te(d,u,j,h,0)|0;j=e[(c[C>>2]|0)+(A*6|0)+4>>1]|0;h=g-x>>31;if((h^y|0)>=0)if((h^w|0)<0)g=x;else g=x-v+g|0;y=te(d,z,j,g,0)|0;z=c[C>>2]|0;b[z+(A*6|0)>>1]=k;b[z+(A*6|0)+2>>1]=i;b[z+(A*6|0)+4>>1]=y}if((f|0)<(c[B>>2]|0))A=f;else break}return}function se(a,d,f){a=a|0;d=d|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;B=i;i=i+48|0;r=B+30|0;q=B+24|0;p=B+18|0;s=B+12|0;x=B+6|0;y=B;z=(c[a+180>>2]|0)-d|0;A=c[a+4608>>2]|0;t=c[a+4604>>2]|0;w=d+-1|0;u=b[A+(w*6|0)>>1]|0;v=b[A+(w*6|0)+2>>1]|0;w=b[A+(w*6|0)+4>>1]|0;f=u&65535;g=a+144|0;h=v&65535;j=w&65535;o=0;while(1){m=o+d|0;k=A+(m*6|0)|0;l=A+(m*6|0)+2|0;m=A+(m*6|0)+4|0;C=(e[k>>1]|0)-f|0;n=c[g>>2]|0;if((((C|0)>-1?C:0-C|0)|0)>(n|0))break;C=(e[l>>1]|0)-h|0;if((((C|0)>-1?C:0-C|0)|0)>(n|0))break;C=(e[m>>1]|0)-j|0;if((((C|0)>-1?C:0-C|0)|0)>(n|0))break;b[k>>1]=u;b[l>>1]=v;b[m>>1]=w;o=o+1|0;if((o|0)==(z|0)){o=z;break}}h=(o|0)==(z|0);j=a+4600|0;g=c[36476+(c[j>>2]<<2)>>2]|0;if((1<(o|0))f=o;else{f=o;do{ae(a,1,1);g=c[j>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[j>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>1]=b[C>>1]|0;b[x+2>>1]=b[C+2>>1]|0;b[x+4>>1]=b[C+4>>1]|0;b[y>>1]=u;b[y+2>>1]=v;b[y+4>>1]=w;d=t+(d*6|0)|0;b[p>>1]=b[x>>1]|0;b[p+2>>1]=b[x+2>>1]|0;b[p+4>>1]=b[x+4>>1]|0;b[q>>1]=b[y>>1]|0;b[q+2>>1]=b[y+2>>1]|0;b[q+4>>1]=b[y+4>>1]|0;b[r>>1]=b[d>>1]|0;b[r+2>>1]=b[d+2>>1]|0;b[r+4>>1]=b[d+4>>1]|0;ve(s,a,p,q,r);b[C>>1]=b[s>>1]|0;b[C+2>>1]=b[s+2>>1]|0;b[C+4>>1]=b[s+4>>1]|0;C=c[j>>2]|0;c[j>>2]=(C|0)<1?0:C+-1|0;C=o+1|0;i=B;return C|0}if(!f){C=z;i=B;return C|0}ae(a,1,1);C=z;i=B;return C|0}function te(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=d>>31;h=(r^d)-r|0;p=a+196+(h*12|0)+10|0;i=b[p>>1]|0;o=a+196+(h*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){d=5;while(1)if((i<>1]^r)-r+f|0;q=a+136|0;f=c[q>>2]|0;if((g&f|0)==(g|0))l=g;else l=f&~(g>>31);g=(e-l^r)-r|0;k=a+144|0;f=c[k>>2]|0;if((g|0)>0)g=(g+f|0)/(f<<1|1|0)|0;else g=(g-f|0)/(f<<1|1|0)|0;n=a+140|0;j=c[n>>2]|0;e=((g|0)<0?j:0)+g|0;j=e-((e|0)<((j+1|0)/2|0|0)?0:j)|0;h=a+196+(h*12|0)+4|0;if(!(f|d))g=(c[h>>2]<<1)+-1+i>>31;else g=0;f=g^j;ue(a,d,f>>30^f<<1,c[a+156>>2]|0);f=c[a+160>>2]|0;d=(c[o>>2]|0)+((j|0)>-1?j:0-j|0)|0;g=(c[h>>2]|0)+($(c[k>>2]<<1|1,j)|0)|0;e=b[p>>1]|0;if((e|0)==(f|0)){d=d>>1;g=g>>1;e=f>>1}c[o>>2]=d;f=e+1|0;b[p>>1]=f;d=f+g|0;if((d|0)>=1){if((g|0)>0){g=g-f|0;p=b[m>>1]|0;b[m>>1]=(p<<16>>16<127&1)+(p&65535);g=(g|0)>0?0:g}}else{g=b[m>>1]|0;b[m>>1]=(g&65535)-(g<<16>>16>-128&1);g=(d|0)>(~e|0)?d:0-e|0}c[h>>2]=g;f=c[k>>2]|0;e=f<<1|1;d=($(e,(j^r)-r|0)|0)+l|0;if((d|0)>=(0-f|0)){g=c[q>>2]|0;if((g+f|0)<(d|0))d=d-($(c[n>>2]|0,e)|0)|0}else{d=($(c[n>>2]|0,e)|0)+d|0;g=c[q>>2]|0}if((d&g|0)==(d|0)){r=d;r=r&65535;return r|0}r=g&~(d>>31);r=r&65535;return r|0}function ue(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=d>>b;g=a+148|0;h=e-(c[g>>2]|0)|0;if((f|0)<(h+-1|0)){if((f|0)>30){e=(f|0)/2|0;ae(a,0,e);f=f-e|0}ae(a,1,f+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,e+-31-(c[g>>2]|0)|0)}else ae(a,1,h);b=c[g>>2]|0;ae(a,(1<>1]|0;p=o-(e[g>>1]|0)>>31|1;i=$(p,(e[f>>1]|0)-o|0)|0;m=d+144|0;j=c[m>>2]|0;if((i|0)>0)i=(i+j|0)/(j<<1|1|0)|0;else i=(i-j|0)/(j<<1|1|0)|0;w=d+140|0;l=c[w>>2]|0;k=((i|0)<0?l:0)+i|0;l=k-((k|0)<((l+1|0)/2|0|0)?0:l)|0;k=d+4576|0;we(d,k,l);t=e[h+2>>1]|0;u=t-(e[g+2>>1]|0)>>31|1;i=$(u,(e[f+2>>1]|0)-t|0)|0;j=c[m>>2]|0;if((i|0)>0)i=(i+j|0)/(j<<1|1|0)|0;else i=(i-j|0)/(j<<1|1|0)|0;q=c[w>>2]|0;v=((i|0)<0?q:0)+i|0;q=v-((v|0)<((q+1|0)/2|0|0)?0:q)|0;we(d,k,q);v=e[h+4>>1]|0;s=v-(e[g+4>>1]|0)>>31|1;i=$(s,(e[f+4>>1]|0)-v|0)|0;j=c[m>>2]|0;if((i|0)>0)i=(i+j|0)/(j<<1|1|0)|0;else i=(i-j|0)/(j<<1|1|0)|0;n=c[w>>2]|0;i=((i|0)<0?n:0)+i|0;n=i-((i|0)<((n+1|0)/2|0|0)?0:n)|0;we(d,k,n);k=c[m>>2]|0;m=k<<1|1;i=($($(m,l)|0,p)|0)+o|0;f=0-k|0;if((i|0)>=(f|0)){j=c[r>>2]|0;if((j+k|0)<(i|0)){i=i-($(c[w>>2]|0,m)|0)|0;g=j}else g=j}else{i=($(c[w>>2]|0,m)|0)+i|0;g=c[r>>2]|0}if((i&g|0)!=(i|0))i=g&~(i>>31);h=i&65535;i=($($(m,q)|0,u)|0)+t|0;if((i|0)>=(f|0)){if((g+k|0)<(i|0))i=i-($(c[w>>2]|0,m)|0)|0}else i=($(c[w>>2]|0,m)|0)+i|0;if((i&g|0)!=(i|0))i=g&~(i>>31);j=i&65535;i=($($(m,n)|0,s)|0)+v|0;if((i|0)>=(f|0)){if((g+k|0)<(i|0))i=i-($(c[w>>2]|0,m)|0)|0}else i=($(c[w>>2]|0,m)|0)+i|0;if((i&g|0)==(i|0)){w=i;w=w&65535;b[a>>1]=h;v=a+2|0;b[v>>1]=j;a=a+4|0;b[a>>1]=w;return}w=g&~(i>>31);w=w&65535;b[a>>1]=h;v=a+2|0;b[v>>1]=j;a=a+4|0;b[a>>1]=w;return}function we(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;ue(b,h,g,(c[b+156>>2]|0)+-1-(c[36476+(c[b+4600>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function xe(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;f=p;o=b+144|0;a:do{if(!(c[o>>2]|0)){e=c[b+136>>2]|0;d=b+152|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+184>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+188>>2]|0):0)?(c[f+12>>2]|0)==(c[b+192>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4612>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4612>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4612>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4612>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+152|0}while(0);n=1<>2];e=b+4616|0;f=n<<1;g=b+4620|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4612|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+192|0;l=b+188|0;j=b+184|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function ye(a){a=a|0;var b=0,d=0;c[a>>2]=36024;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function ze(a){a=a|0;var b=0,d=0;c[a>>2]=36024;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function Ae(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+136>>2]|0,c[d+144>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+184>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+188>>2]=j;c[d+192>>2]=h;pf(d);h=d+140|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+196+(j*12|0)>>2]=e;c[d+196+(j*12|0)+4>>2]=0;b[d+196+(j*12|0)+8>>1]=0;b[d+196+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4576>>2]=l;c[d+4580>>2]=0;a[d+4584>>0]=m;a[d+4585>>0]=1;a[d+4586>>0]=0;c[d+4588>>2]=l;c[d+4592>>2]=1;a[d+4596>>0]=m;a[d+4597>>0]=1;a[d+4598>>0]=0;c[d+4600>>2]=0;i=k;return}function Be(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4624)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35800;c[e+128>>2]=c[d+136>>2];c[e+132>>2]=c[d+140>>2];c[e+136>>2]=c[d+144>>2];c[e+140>>2]=c[d+148>>2];c[e+144>>2]=c[d+152>>2];c[e+148>>2]=c[d+156>>2];c[e+152>>2]=c[d+160>>2];h=e+156|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+172>>2]=c[g>>2];c[e+176>>2]=0;c[e+180>>2]=0;c[e+184>>2]=0;h=e+4568|0;g=e+188|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4580|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4592|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];hf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;hf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function Ce(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function De(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c[b>>2]=36712;c[b+4>>2]=e;m=b+8|0;f=c[e>>2]|0;k=e+16|0;i=c[k>>2]|0;h=$(i,f)|0;c[m>>2]=0;n=b+12|0;c[n>>2]=0;c[b+16>>2]=0;do{if(!h)h=i;else{if(!((h|0)<0?(o=0,ha(178,m|0),i=o,o=0,i&1):0))l=4;if((l|0)==4?(o=0,j=ka(67,h|0)|0,i=o,o=0,!(i&1)):0){c[n>>2]=j;c[m>>2]=j;c[b+16>>2]=j+h;f=j;do{a[f>>0]=0;f=(c[n>>2]|0)+1|0;c[n>>2]=f;h=h+-1|0}while((h|0)!=0);h=c[k>>2]|0;f=c[e>>2]|0;break}f=Na()|0;g=c[m>>2]|0;if(g){if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g)}n=f;Ya(n|0)}}while(0);i=b+20|0;f=$(h,f)|0;c[i>>2]=0;h=b+24|0;c[h>>2]=0;c[b+28>>2]=0;if(!f){n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))l=15;if((l|0)==15?(o=0,g=ka(67,f|0)|0,l=o,o=0,!(l&1)):0){c[h>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[h>>2]|0)+1|0;c[h>>2]=g;f=f+-1|0}while((f|0)!=0);n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}f=Na()|0;g=c[i>>2]|0;if(g){if((c[h>>2]|0)!=(g|0))c[h>>2]=g;cj(g)}g=c[m>>2]|0;if(!g){n=f;Ya(n|0)}if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g);n=f;Ya(n|0)}function Ee(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c[b>>2]=36688;c[b+4>>2]=e;m=b+8|0;f=c[e>>2]|0;k=e+16|0;i=c[k>>2]|0;h=$(i,f)|0;c[m>>2]=0;n=b+12|0;c[n>>2]=0;c[b+16>>2]=0;do{if(!h)h=i;else{if(!((h|0)<0?(o=0,ha(178,m|0),i=o,o=0,i&1):0))l=4;if((l|0)==4?(o=0,j=ka(67,h|0)|0,i=o,o=0,!(i&1)):0){c[n>>2]=j;c[m>>2]=j;c[b+16>>2]=j+h;f=j;do{a[f>>0]=0;f=(c[n>>2]|0)+1|0;c[n>>2]=f;h=h+-1|0}while((h|0)!=0);h=c[k>>2]|0;f=c[e>>2]|0;break}f=Na()|0;g=c[m>>2]|0;if(g){if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g)}n=f;Ya(n|0)}}while(0);i=b+20|0;f=$(h,f)|0;c[i>>2]=0;h=b+24|0;c[h>>2]=0;c[b+28>>2]=0;if(!f){n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))l=15;if((l|0)==15?(o=0,g=ka(67,f|0)|0,l=o,o=0,!(l&1)):0){c[h>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[h>>2]|0)+1|0;c[h>>2]=g;f=f+-1|0}while((f|0)!=0);n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}f=Na()|0;g=c[i>>2]|0;if(g){if((c[h>>2]|0)!=(g|0))c[h>>2]=g;cj(g)}g=c[m>>2]|0;if(!g){n=f;Ya(n|0)}if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g);n=f;Ya(n|0)}function Fe(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c[b>>2]=36664;c[b+4>>2]=e;m=b+8|0;f=c[e>>2]|0;k=e+16|0;i=c[k>>2]|0;h=$(i,f)|0;c[m>>2]=0;n=b+12|0;c[n>>2]=0;c[b+16>>2]=0;do{if(!h)h=i;else{if(!((h|0)<0?(o=0,ha(178,m|0),i=o,o=0,i&1):0))l=4;if((l|0)==4?(o=0,j=ka(67,h|0)|0,i=o,o=0,!(i&1)):0){c[n>>2]=j;c[m>>2]=j;c[b+16>>2]=j+h;f=j;do{a[f>>0]=0;f=(c[n>>2]|0)+1|0;c[n>>2]=f;h=h+-1|0}while((h|0)!=0);h=c[k>>2]|0;f=c[e>>2]|0;break}f=Na()|0;g=c[m>>2]|0;if(g){if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g)}n=f;Ya(n|0)}}while(0);i=b+20|0;f=$(h,f)|0;c[i>>2]=0;h=b+24|0;c[h>>2]=0;c[b+28>>2]=0;if(!f){n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))l=15;if((l|0)==15?(o=0,g=ka(67,f|0)|0,l=o,o=0,!(l&1)):0){c[h>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[h>>2]|0)+1|0;c[h>>2]=g;f=f+-1|0}while((f|0)!=0);n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}f=Na()|0;g=c[i>>2]|0;if(g){if((c[h>>2]|0)!=(g|0))c[h>>2]=g;cj(g)}g=c[m>>2]|0;if(!g){n=f;Ya(n|0)}if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g);n=f;Ya(n|0)}function Ge(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c[b>>2]=36640;c[b+4>>2]=e;m=b+8|0;f=c[e>>2]|0;k=e+16|0;i=c[k>>2]|0;h=$(i,f)|0;c[m>>2]=0;n=b+12|0;c[n>>2]=0;c[b+16>>2]=0;do{if(!h)h=i;else{if(!((h|0)<0?(o=0,ha(178,m|0),i=o,o=0,i&1):0))l=4;if((l|0)==4?(o=0,j=ka(67,h|0)|0,i=o,o=0,!(i&1)):0){c[n>>2]=j;c[m>>2]=j;c[b+16>>2]=j+h;f=j;do{a[f>>0]=0;f=(c[n>>2]|0)+1|0;c[n>>2]=f;h=h+-1|0}while((h|0)!=0);h=c[k>>2]|0;f=c[e>>2]|0;break}f=Na()|0;g=c[m>>2]|0;if(g){if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g)}n=f;Ya(n|0)}}while(0);i=b+20|0;f=$(h,f)|0;c[i>>2]=0;h=b+24|0;c[h>>2]=0;c[b+28>>2]=0;if(!f){n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}if(!((f|0)<0?(o=0,ha(178,i|0),e=o,o=0,e&1):0))l=15;if((l|0)==15?(o=0,g=ka(67,f|0)|0,l=o,o=0,!(l&1)):0){c[h>>2]=g;c[i>>2]=g;c[b+28>>2]=g+f;do{a[g>>0]=0;g=(c[h>>2]|0)+1|0;c[h>>2]=g;f=f+-1|0}while((f|0)!=0);n=b+36|0;c[n>>2]=c[d>>2];c[n+4>>2]=c[d+4>>2];c[n+8>>2]=c[d+8>>2];return}f=Na()|0;g=c[i>>2]|0;if(g){if((c[h>>2]|0)!=(g|0))c[h>>2]=g;cj(g)}g=c[m>>2]|0;if(!g){n=f;Ya(n|0)}if((c[n>>2]|0)!=(g|0))c[n>>2]=g;cj(g);n=f;Ya(n|0)}function He(a){a=a|0;var b=0,d=0;c[a>>2]=36640;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=c[a+8>>2]|0;if(!d)return;b=a+12|0;if((c[b>>2]|0)!=(d|0))c[b>>2]=d;cj(d);return}function Ie(a){a=a|0;var b=0,d=0;c[a>>2]=36640;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}b=c[a+8>>2]|0;if(!b){cj(a);return}d=a+12|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b);cj(a);return}function Je(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;g=b+36|0;if(!(c[g>>2]|0)){g=b+40|0;Ne(b,d,c[g>>2]|0,e,f);c[g>>2]=(c[g>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}h=$(c[(c[b+4>>2]|0)+16>>2]|0,e)|0;i=b+20|0;Ne(b,d,c[i>>2]|0,e,f);b=c[g>>2]|0;if((Gb[c[(c[b>>2]|0)+48>>2]&63](b,c[i>>2]|0,h)|0)==(h|0))return;g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,3,35648);i=o;o=0;if(i&1){i=Na()|0;La(g|0);Ya(i|0)}else lb(g|0,824,96)}function Ke(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;Le(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{Me(a,f,b,d,e);return}}function Le(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0;k=b+4|0;i=c[k>>2]|0;if(!(a[i+32>>0]|0))k=e;else{j=b+8|0;lw(c[j>>2]|0,e|0,g*3|0)|0;i=c[k>>2]|0;e=c[i+16>>2]|0;if((g|0)>0){i=c[j>>2]|0;b=0;while(1){l=i+2|0;m=a[i>>0]|0;a[i>>0]=a[l>>0]|0;a[l>>0]=m;b=b+1|0;if((b|0)==(g|0))break;else i=i+e|0}i=c[k>>2]|0}k=c[j>>2]|0}switch(c[i+16>>2]|0){case 3:{if((c[i+24>>2]|0)==2){if((g|0)>0)i=0;else return;do{j=d[k+(i*3|0)+1>>0]|0;h=128-j+(d[k+(i*3|0)+2>>0]|0)|0;l=(d[k+(i*3|0)>>0]|0)-j+128|0;m=f+(i*3|0)|0;a[m>>0]=j+192+(((h&255)+(l&255)|0)>>>2);a[m+1>>0]=h;a[m+2>>0]=l;i=i+1|0}while((i|0)!=(g|0));return}i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;b=h<<1;e=0;do{g=d[k+(e*3|0)+1>>0]|0;l=128-g+(d[k+(e*3|0)+2>>0]|0)|0;m=(d[k+(e*3|0)>>0]|0)-g+128|0;a[f+e>>0]=g+192+(((l&255)+(m&255)|0)>>>2);a[f+(e+h)>>0]=l;a[f+(e+b)>>0]=m;e=e+1|0}while((e|0)!=(i|0));return}case 4:{if((c[i+24>>2]|0)!=1)return;i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;b=h<<1;e=h*3|0;j=0;do{m=a[k+(j<<2)+3>>0]|0;n=d[k+(j<<2)+1>>0]|0;g=128-n+(d[k+(j<<2)+2>>0]|0)|0;l=(d[k+(j<<2)>>0]|0)-n+128|0;a[f+j>>0]=n+192+(((g&255)+(l&255)|0)>>>2);a[f+(j+h)>>0]=g;a[f+(j+b)>>0]=l;a[f+(j+e)>>0]=m;j=j+1|0}while((j|0)!=(i|0));return}default:return}}function Me(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;p=i;i=i+176|0;q=p+152|0;s=p+16|0;r=p;j=$(c[(c[b+4>>2]|0)+16>>2]|0,f)|0;l=b+20|0;h=c[l>>2]|0;if(!j){s=h;Le(b,s,e,f,g);i=p;return}while(1){k=Gb[c[(c[d>>2]|0)+32>>2]&63](d,h,j)|0;if(!k)break;h=c[l>>2]|0;if((j|0)==(k|0)){m=26;break}else j=j-k|0}if((m|0)==26){Le(b,h,e,f,g);i=p;return}e=s+56|0;l=s+4|0;c[s>>2]=36160;c[e>>2]=36180;o=0;ia(62,s+56|0,l|0);p=o;o=0;if(p&1){s=Na()|0;fn(e);Ya(s|0)}c[s+128>>2]=0;c[s+132>>2]=-1;c[s>>2]=36200;c[s+56>>2]=36220;o=0;ha(180,l|0);p=o;o=0;do{if(p&1)h=Na()|0;else{c[l>>2]=36236;d=s+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[s+52>>2]=16;c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;o=0;ia(63,l|0,q|0);p=o;o=0;if(p&1){h=Na()|0;Im(q);Im(d);nn(l);break}Im(q);o=0;h=ma(28,s|0,49029,57)|0;q=o;o=0;if(!(q&1)?(o=0,ra(36,h|0,0)|0,q=o,o=0,!(q&1)):0){k=Ma(16)|0;o=0;ia(64,r|0,l|0);q=o;o=0;if(!(q&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,r|0);q=o;o=0;if(q&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(r);if(!j){r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}else h=Na()|0;La(k|0);r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}r=Na()|0;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}while(0);s=h;fn(e);Ya(s|0)}function Ne(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=b+4|0;b=c[l>>2]|0;a:do{switch(c[b+16>>2]|0){case 3:{if((c[b+24>>2]|0)==2){if((g|0)>0)b=0;else break a;while(1){j=d[e+(b*3|0)+1>>0]|0;i=d[e+(b*3|0)+2>>0]|0;k=(d[e+(b*3|0)>>0]|0)-((i+j|0)>>>2)+64|0;h=f+(b*3|0)|0;a[h>>0]=i+128+k;a[h+1>>0]=k;a[h+2>>0]=j+128+k;b=b+1|0;if((b|0)==(g|0))break a}}b=(g|0)<(h|0)?g:h;if((b|0)>0){i=h<<1;j=0;do{n=d[e+(j+h)>>0]|0;o=d[e+(j+i)>>0]|0;m=(d[e+j>>0]|0)-((o+n|0)>>>2)+64|0;k=f+(j*3|0)|0;a[k>>0]=o+128+m;a[k+1>>0]=m;a[k+2>>0]=n+128+m;j=j+1|0}while((j|0)!=(b|0))}break}case 4:{if((c[b+24>>2]|0)==1?(k=(g|0)<(h|0)?g:h,(k|0)>0):0){b=h<<1;i=h*3|0;j=0;do{m=d[e+(j+h)>>0]|0;p=d[e+(j+b)>>0]|0;n=(d[e+j>>0]|0)-((p+m|0)>>>2)+64|0;o=f+(j<<2)|0;n=n<<8&65280|d[e+(j+i)>>0]<<24|p+128+n&255|m+128+n<<16&16711680;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24;j=j+1|0}while((j|0)!=(k|0))}break}default:{}}}while(0);b=c[l>>2]|0;if(!(a[b+32>>0]|0))return;j=c[b+16>>2]|0;if((g|0)>0){b=f;i=0}else return;while(1){p=b+2|0;o=a[b>>0]|0;a[b>>0]=a[p>>0]|0;a[p>>0]=o;i=i+1|0;if((i|0)==(g|0))break;else b=b+j|0}return}function Oe(a){a=a|0;var b=0,d=0;c[a>>2]=36664;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=c[a+8>>2]|0;if(!d)return;b=a+12|0;if((c[b>>2]|0)!=(d|0))c[b>>2]=d;cj(d);return}function Pe(a){a=a|0;var b=0,d=0;c[a>>2]=36664;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}b=c[a+8>>2]|0;if(!b){cj(a);return}d=a+12|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b);cj(a);return}function Qe(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;g=b+36|0;if(!(c[g>>2]|0)){g=b+40|0;Ue(b,d,c[g>>2]|0,e,f);c[g>>2]=(c[g>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}h=$(c[(c[b+4>>2]|0)+16>>2]|0,e)|0;i=b+20|0;Ue(b,d,c[i>>2]|0,e,f);b=c[g>>2]|0;if((Gb[c[(c[b>>2]|0)+48>>2]&63](b,c[i>>2]|0,h)|0)==(h|0))return;g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,3,35648);i=o;o=0;if(i&1){i=Na()|0;La(g|0);Ya(i|0)}else lb(g|0,824,96)}function Re(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;Se(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{Te(a,f,b,d,e);return}}function Se(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0;k=b+4|0;i=c[k>>2]|0;if(!(a[i+32>>0]|0))k=e;else{j=b+8|0;lw(c[j>>2]|0,e|0,g*3|0)|0;i=c[k>>2]|0;e=c[i+16>>2]|0;if((g|0)>0){i=c[j>>2]|0;b=0;while(1){l=i+2|0;m=a[i>>0]|0;a[i>>0]=a[l>>0]|0;a[l>>0]=m;b=b+1|0;if((b|0)==(g|0))break;else i=i+e|0}i=c[k>>2]|0}k=c[j>>2]|0}switch(c[i+16>>2]|0){case 3:{if((c[i+24>>2]|0)==2){if((g|0)>0)i=0;else return;do{e=d[k+(i*3|0)>>0]|0;h=a[k+(i*3|0)+1>>0]|0;j=h&255;l=(d[k+(i*3|0)+2>>0]|0)+128-((j+e|0)>>>1)&255;m=f+(i*3|0)|0;a[m>>0]=e+128-j;a[m+1>>0]=h;a[m+2>>0]=l;i=i+1|0}while((i|0)!=(g|0));return}i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;b=h<<1;e=0;do{l=a[k+(e*3|0)+1>>0]|0;j=d[k+(e*3|0)>>0]|0;g=l&255;m=(d[k+(e*3|0)+2>>0]|0)+128-((g+j|0)>>>1)&255;a[f+e>>0]=j+128-g;a[f+(e+h)>>0]=l;a[f+(e+b)>>0]=m;e=e+1|0}while((e|0)!=(i|0));return}case 4:{if((c[i+24>>2]|0)!=1)return;i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;b=h<<1;e=h*3|0;j=0;do{g=a[k+(j<<2)+1>>0]|0;m=a[k+(j<<2)+3>>0]|0;o=d[k+(j<<2)>>0]|0;n=g&255;l=(d[k+(j<<2)+2>>0]|0)+128-((n+o|0)>>>1)&255;a[f+j>>0]=o+128-n;a[f+(j+h)>>0]=g;a[f+(j+b)>>0]=l;a[f+(j+e)>>0]=m;j=j+1|0}while((j|0)!=(i|0));return}default:return}}function Te(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;p=i;i=i+176|0;q=p+152|0;s=p+16|0;r=p;j=$(c[(c[b+4>>2]|0)+16>>2]|0,f)|0;l=b+20|0;h=c[l>>2]|0;if(!j){s=h;Se(b,s,e,f,g);i=p;return}while(1){k=Gb[c[(c[d>>2]|0)+32>>2]&63](d,h,j)|0;if(!k)break;h=c[l>>2]|0;if((j|0)==(k|0)){m=26;break}else j=j-k|0}if((m|0)==26){Se(b,h,e,f,g);i=p;return}e=s+56|0;l=s+4|0;c[s>>2]=36160;c[e>>2]=36180;o=0;ia(62,s+56|0,l|0);p=o;o=0;if(p&1){s=Na()|0;fn(e);Ya(s|0)}c[s+128>>2]=0;c[s+132>>2]=-1;c[s>>2]=36200;c[s+56>>2]=36220;o=0;ha(180,l|0);p=o;o=0;do{if(p&1)h=Na()|0;else{c[l>>2]=36236;d=s+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[s+52>>2]=16;c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;o=0;ia(63,l|0,q|0);p=o;o=0;if(p&1){h=Na()|0;Im(q);Im(d);nn(l);break}Im(q);o=0;h=ma(28,s|0,49029,57)|0;q=o;o=0;if(!(q&1)?(o=0,ra(36,h|0,0)|0,q=o,o=0,!(q&1)):0){k=Ma(16)|0;o=0;ia(64,r|0,l|0);q=o;o=0;if(!(q&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,r|0);q=o;o=0;if(q&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(r);if(!j){r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}else h=Na()|0;La(k|0);r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}r=Na()|0;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}while(0);s=h;fn(e);Ya(s|0)}function Ue(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0;l=b+4|0;b=c[l>>2]|0;a:do{switch(c[b+16>>2]|0){case 3:{if((c[b+24>>2]|0)==2){if((g|0)>0)b=0;else break a;while(1){j=a[e+(b*3|0)+1>>0]|0;k=j&255;i=(d[e+(b*3|0)>>0]|0)+128+k|0;k=(d[e+(b*3|0)+2>>0]|0)+128+(((i&255)+k|0)>>>1)&255;h=f+(b*3|0)|0;a[h>>0]=i;a[h+1>>0]=j;a[h+2>>0]=k;b=b+1|0;if((b|0)==(g|0))break a}}b=(g|0)<(h|0)?g:h;if((b|0)>0){i=h<<1;j=0;do{n=a[e+(j+h)>>0]|0;m=n&255;o=(d[e+j>>0]|0)+128+m|0;m=(d[e+(j+i)>>0]|0)+128+(((o&255)+m|0)>>>1)&255;k=f+(j*3|0)|0;a[k>>0]=o;a[k+1>>0]=n;a[k+2>>0]=m;j=j+1|0}while((j|0)!=(b|0))}break}case 4:{if((c[b+24>>2]|0)==1?(k=(g|0)<(h|0)?g:h,(k|0)>0):0){b=h<<1;i=h*3|0;j=0;do{n=d[e+(j+h)>>0]|0;m=(d[e+j>>0]|0)+128+n&255;o=f+(j<<2)|0;n=m|n<<8|d[e+(j+i)>>0]<<24|(d[e+(j+b)>>0]|0)+128+((m+n|0)>>>1)<<16&16711680;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24;j=j+1|0}while((j|0)!=(k|0))}break}default:{}}}while(0);b=c[l>>2]|0;if(!(a[b+32>>0]|0))return;j=c[b+16>>2]|0;if((g|0)>0){b=f;i=0}else return;while(1){o=b+2|0;n=a[b>>0]|0;a[b>>0]=a[o>>0]|0;a[o>>0]=n;i=i+1|0;if((i|0)==(g|0))break;else b=b+j|0}return}function Ve(a){a=a|0;var b=0,d=0;c[a>>2]=36688;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=c[a+8>>2]|0;if(!d)return;b=a+12|0;if((c[b>>2]|0)!=(d|0))c[b>>2]=d;cj(d);return}function We(a){a=a|0;var b=0,d=0;c[a>>2]=36688;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}b=c[a+8>>2]|0;if(!b){cj(a);return}d=a+12|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b);cj(a);return}function Xe(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;g=b+36|0;if(!(c[g>>2]|0)){g=b+40|0;$e(b,d,c[g>>2]|0,e,f);c[g>>2]=(c[g>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}h=$(c[(c[b+4>>2]|0)+16>>2]|0,e)|0;i=b+20|0;$e(b,d,c[i>>2]|0,e,f);b=c[g>>2]|0;if((Gb[c[(c[b>>2]|0)+48>>2]&63](b,c[i>>2]|0,h)|0)==(h|0))return;g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,3,35648);i=o;o=0;if(i&1){i=Na()|0;La(g|0);Ya(i|0)}else lb(g|0,824,96)}function Ye(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;Ze(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{_e(a,f,b,d,e);return}}function Ze(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0;k=b+4|0;i=c[k>>2]|0;if(!(a[i+32>>0]|0))k=e;else{j=b+8|0;lw(c[j>>2]|0,e|0,g*3|0)|0;i=c[k>>2]|0;e=c[i+16>>2]|0;if((g|0)>0){i=c[j>>2]|0;b=0;while(1){l=i+2|0;m=a[i>>0]|0;a[i>>0]=a[l>>0]|0;a[l>>0]=m;b=b+1|0;if((b|0)==(g|0))break;else i=i+e|0}i=c[k>>2]|0}k=c[j>>2]|0}switch(c[i+16>>2]|0){case 3:{if((c[i+24>>2]|0)==2){if((g|0)>0)i=0;else return;do{h=a[k+(i*3|0)+1>>0]|0;j=h&255;l=128-j+(d[k+(i*3|0)+2>>0]|0)&255;m=f+(i*3|0)|0;a[m>>0]=(d[k+(i*3|0)>>0]|0)+128-j;a[m+1>>0]=h;a[m+2>>0]=l;i=i+1|0}while((i|0)!=(g|0));return}i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;b=h<<1;e=0;do{l=a[k+(e*3|0)+1>>0]|0;g=l&255;m=128-g+(d[k+(e*3|0)+2>>0]|0)&255;a[f+e>>0]=(d[k+(e*3|0)>>0]|0)+128-g;a[f+(e+h)>>0]=l;a[f+(e+b)>>0]=m;e=e+1|0}while((e|0)!=(i|0));return}case 4:{if((c[i+24>>2]|0)!=1)return;i=(h|0)<(g|0)?h:g;if((i|0)<=0)return;b=h<<1;e=h*3|0;j=0;do{g=a[k+(j<<2)+1>>0]|0;m=a[k+(j<<2)+3>>0]|0;n=g&255;l=128-n+(d[k+(j<<2)+2>>0]|0)&255;a[f+j>>0]=(d[k+(j<<2)>>0]|0)+128-n;a[f+(j+h)>>0]=g;a[f+(j+b)>>0]=l;a[f+(j+e)>>0]=m;j=j+1|0}while((j|0)!=(i|0));return}default:return}}function _e(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;p=i;i=i+176|0;q=p+152|0;s=p+16|0;r=p;j=$(c[(c[b+4>>2]|0)+16>>2]|0,f)|0;l=b+20|0;h=c[l>>2]|0;if(!j){s=h;Ze(b,s,e,f,g);i=p;return}while(1){k=Gb[c[(c[d>>2]|0)+32>>2]&63](d,h,j)|0;if(!k)break;h=c[l>>2]|0;if((j|0)==(k|0)){m=26;break}else j=j-k|0}if((m|0)==26){Ze(b,h,e,f,g);i=p;return}e=s+56|0;l=s+4|0;c[s>>2]=36160;c[e>>2]=36180;o=0;ia(62,s+56|0,l|0);p=o;o=0;if(p&1){s=Na()|0;fn(e);Ya(s|0)}c[s+128>>2]=0;c[s+132>>2]=-1;c[s>>2]=36200;c[s+56>>2]=36220;o=0;ha(180,l|0);p=o;o=0;do{if(p&1)h=Na()|0;else{c[l>>2]=36236;d=s+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[s+52>>2]=16;c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;o=0;ia(63,l|0,q|0);p=o;o=0;if(p&1){h=Na()|0;Im(q);Im(d);nn(l);break}Im(q);o=0;h=ma(28,s|0,49029,57)|0;q=o;o=0;if(!(q&1)?(o=0,ra(36,h|0,0)|0,q=o,o=0,!(q&1)):0){k=Ma(16)|0;o=0;ia(64,r|0,l|0);q=o;o=0;if(!(q&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,r|0);q=o;o=0;if(q&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(r);if(!j){r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}else h=Na()|0;La(k|0);r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}r=Na()|0;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}while(0);s=h;fn(e);Ya(s|0)}function $e(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0;l=b+4|0;b=c[l>>2]|0;a:do{switch(c[b+16>>2]|0){case 3:{if((c[b+24>>2]|0)==2){if((g|0)>0)b=0;else break a;while(1){j=a[e+(b*3|0)+1>>0]|0;i=j&255;k=i+128+(d[e+(b*3|0)+2>>0]|0)&255;h=f+(b*3|0)|0;a[h>>0]=(d[e+(b*3|0)>>0]|0)+128+i;a[h+1>>0]=j;a[h+2>>0]=k;b=b+1|0;if((b|0)==(g|0))break a}}b=(g|0)<(h|0)?g:h;if((b|0)>0){i=h<<1;j=0;do{n=a[e+(j+h)>>0]|0;o=n&255;m=o+128+(d[e+(j+i)>>0]|0)&255;k=f+(j*3|0)|0;a[k>>0]=(d[e+j>>0]|0)+128+o;a[k+1>>0]=n;a[k+2>>0]=m;j=j+1|0}while((j|0)!=(b|0))}break}case 4:{if((c[b+24>>2]|0)==1?(k=(g|0)<(h|0)?g:h,(k|0)>0):0){b=h<<1;i=h*3|0;j=0;do{n=d[e+(j+h)>>0]|0;o=f+(j<<2)|0;n=(d[e+j>>0]|0)+128+n&255|n<<8|d[e+(j+i)>>0]<<24|n+128+(d[e+(j+b)>>0]|0)<<16&16711680;a[o>>0]=n;a[o+1>>0]=n>>8;a[o+2>>0]=n>>16;a[o+3>>0]=n>>24;j=j+1|0}while((j|0)!=(k|0))}break}default:{}}}while(0);b=c[l>>2]|0;if(!(a[b+32>>0]|0))return;j=c[b+16>>2]|0;if((g|0)>0){b=f;i=0}else return;while(1){o=b+2|0;n=a[b>>0]|0;a[b>>0]=a[o>>0]|0;a[o>>0]=n;i=i+1|0;if((i|0)==(g|0))break;else b=b+j|0}return}function af(a){a=a|0;var b=0,d=0;c[a>>2]=36712;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=c[a+8>>2]|0;if(!d)return;b=a+12|0;if((c[b>>2]|0)!=(d|0))c[b>>2]=d;cj(d);return}function bf(a){a=a|0;var b=0,d=0;c[a>>2]=36712;b=c[a+20>>2]|0;if(b){d=a+24|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}b=c[a+8>>2]|0;if(!b){cj(a);return}d=a+12|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b);cj(a);return}function cf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;g=b+36|0;if(!(c[g>>2]|0)){g=b+40|0;gf(b,d,c[g>>2]|0,e,f);c[g>>2]=(c[g>>2]|0)+(c[(c[b+4>>2]|0)+12>>2]|0);return}h=$(c[(c[b+4>>2]|0)+16>>2]|0,e)|0;i=b+20|0;gf(b,d,c[i>>2]|0,e,f);b=c[g>>2]|0;if((Gb[c[(c[b>>2]|0)+48>>2]&63](b,c[i>>2]|0,h)|0)==(h|0))return;g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,3,35648);i=o;o=0;if(i&1){i=Na()|0;La(g|0);Ya(i|0)}else lb(g|0,824,96)}function df(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=c[a+36>>2]|0;if(!f){f=a+40|0;ef(a,c[f>>2]|0,b,d,e);c[f>>2]=(c[f>>2]|0)+(c[(c[a+4>>2]|0)+12>>2]|0);return}else{ff(a,f,b,d,e);return}}function ef(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0;j=b+4|0;h=c[j>>2]|0;if(!(a[h+32>>0]|0))j=d;else{i=b+8|0;lw(c[i>>2]|0,d|0,f*3|0)|0;h=c[j>>2]|0;d=c[h+16>>2]|0;if((f|0)>0){h=c[i>>2]|0;b=0;while(1){k=h+2|0;l=a[h>>0]|0;a[h>>0]=a[k>>0]|0;a[k>>0]=l;b=b+1|0;if((b|0)==(f|0))break;else h=h+d|0}h=c[j>>2]|0}j=c[i>>2]|0}switch(c[h+16>>2]|0){case 3:{if((c[h+24>>2]|0)==2){if((f|0)>0)h=0;else return;do{g=a[j+(h*3|0)+1>>0]|0;k=a[j+(h*3|0)+2>>0]|0;l=e+(h*3|0)|0;a[l>>0]=a[j+(h*3|0)>>0]|0;a[l+1>>0]=g;a[l+2>>0]=k;h=h+1|0}while((h|0)!=(f|0));return}h=(g|0)<(f|0)?g:f;if((h|0)<=0)return;b=g<<1;d=0;do{k=a[j+(d*3|0)+1>>0]|0;l=a[j+(d*3|0)+2>>0]|0;a[e+d>>0]=a[j+(d*3|0)>>0]|0;a[e+(d+g)>>0]=k;a[e+(d+b)>>0]=l;d=d+1|0}while((d|0)!=(h|0));return}case 4:{if((c[h+24>>2]|0)!=1)return;h=(g|0)<(f|0)?g:f;if((h|0)<=0)return;b=g<<1;d=g*3|0;i=0;do{f=a[j+(i<<2)+1>>0]|0;k=a[j+(i<<2)+2>>0]|0;l=a[j+(i<<2)+3>>0]|0;a[e+i>>0]=a[j+(i<<2)>>0]|0;a[e+(i+g)>>0]=f;a[e+(i+b)>>0]=k;a[e+(i+d)>>0]=l;i=i+1|0}while((i|0)!=(h|0));return}default:return}}function ff(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;p=i;i=i+176|0;q=p+152|0;s=p+16|0;r=p;j=$(c[(c[b+4>>2]|0)+16>>2]|0,f)|0;l=b+20|0;h=c[l>>2]|0;if(!j){s=h;ef(b,s,e,f,g);i=p;return}while(1){k=Gb[c[(c[d>>2]|0)+32>>2]&63](d,h,j)|0;if(!k)break;h=c[l>>2]|0;if((j|0)==(k|0)){m=26;break}else j=j-k|0}if((m|0)==26){ef(b,h,e,f,g);i=p;return}e=s+56|0;l=s+4|0;c[s>>2]=36160;c[e>>2]=36180;o=0;ia(62,s+56|0,l|0);p=o;o=0;if(p&1){s=Na()|0;fn(e);Ya(s|0)}c[s+128>>2]=0;c[s+132>>2]=-1;c[s>>2]=36200;c[s+56>>2]=36220;o=0;ha(180,l|0);p=o;o=0;do{if(p&1)h=Na()|0;else{c[l>>2]=36236;d=s+36|0;c[d>>2]=0;c[d+4>>2]=0;c[d+8>>2]=0;c[d+12>>2]=0;c[s+52>>2]=16;c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;o=0;ia(63,l|0,q|0);p=o;o=0;if(p&1){h=Na()|0;Im(q);Im(d);nn(l);break}Im(q);o=0;h=ma(28,s|0,49029,57)|0;q=o;o=0;if(!(q&1)?(o=0,ra(36,h|0,0)|0,q=o,o=0,!(q&1)):0){k=Ma(16)|0;o=0;ia(64,r|0,l|0);q=o;o=0;if(!(q&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,k|0,3,35648,r|0);q=o;o=0;if(q&1)j=1;else{o=0;wa(6,k|0,824,96);o=0;j=0}h=Na()|0;Im(r);if(!j){r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}else h=Na()|0;La(k|0);r=h;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}r=Na()|0;c[s>>2]=36200;c[e>>2]=36220;c[l>>2]=36236;Im(d);nn(l);fn(e);Ya(r|0)}}while(0);s=h;fn(e);Ya(s|0)}function gf(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0;l=b+4|0;b=c[l>>2]|0;a:do{switch(c[b+16>>2]|0){case 3:{if((c[b+24>>2]|0)==2){if((g|0)>0)b=0;else break a;while(1){j=a[e+(b*3|0)+1>>0]|0;k=a[e+(b*3|0)+2>>0]|0;h=f+(b*3|0)|0;a[h>>0]=a[e+(b*3|0)>>0]|0;a[h+1>>0]=j;a[h+2>>0]=k;b=b+1|0;if((b|0)==(g|0))break a}}b=(g|0)<(h|0)?g:h;if((b|0)>0){i=h<<1;j=0;do{n=a[e+(j+h)>>0]|0;m=a[e+(j+i)>>0]|0;k=f+(j*3|0)|0;a[k>>0]=a[e+j>>0]|0;a[k+1>>0]=n;a[k+2>>0]=m;j=j+1|0}while((j|0)!=(b|0))}break}case 4:{if((c[b+24>>2]|0)==1?(k=(g|0)<(h|0)?g:h,(k|0)>0):0){b=h<<1;i=h*3|0;j=0;do{n=f+(j<<2)|0;m=d[e+(j+h)>>0]<<8|d[e+j>>0]|d[e+(j+b)>>0]<<16|d[e+(j+i)>>0]<<24;a[n>>0]=m;a[n+1>>0]=m>>8;a[n+2>>0]=m>>16;a[n+3>>0]=m>>24;j=j+1|0}while((j|0)!=(k|0))}break}default:{}}}while(0);b=c[l>>2]|0;if(!(a[b+32>>0]|0))return;j=c[b+16>>2]|0;if((g|0)>0){b=f;i=0}else return;while(1){n=b+2|0;m=a[b>>0]|0;a[b>>0]=a[n>>0]|0;a[n>>0]=m;i=i+1|0;if((i|0)==(g|0))break;else b=b+j|0}return}function hf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;u=i;i=i+32|0;w=u+12|0;t=u;q=b+180|0;r=(c[q>>2]|0)+4|0;if((c[b+32>>2]|0)==1)s=c[b+24>>2]|0;else s=1;d=$(s<<1,r)|0;c[w>>2]=0;x=w+4|0;c[x>>2]=0;c[w+8>>2]=0;a:do{if(d){if(!(d>>>0>1431655765?(o=0,ha(178,w|0),v=o,o=0,v&1):0))h=6;if((h|0)==6?(o=0,e=ka(67,d*3|0)|0,v=o,o=0,!(v&1)):0){c[x>>2]=e;c[w>>2]=e;c[w+8>>2]=e+(d*3|0);while(1){a[e>>0]=0;a[e+1>>0]=0;a[e+2>>0]=0;e=(c[x>>2]|0)+3|0;c[x>>2]=e;d=d+-1|0;if(!d)break a}}f=Na()|0;d=c[w>>2]|0;if(!d)Ya(f|0);e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}}while(0);c[t>>2]=0;v=t+4|0;c[v>>2]=0;c[t+8>>2]=0;do{if(!s)h=19;else{if(!(s>>>0>1073741823?(o=0,ha(178,t|0),p=o,o=0,p&1):0))h=17;if((h|0)==17?(f=s<<2,o=0,g=ka(67,f|0)|0,p=o,o=0,!(p&1)):0){c[t>>2]=g;h=g+(s<<2)|0;c[t+8>>2]=h;iw(g|0,0,f|0)|0;c[v>>2]=h;h=19;break}f=Na()|0;d=c[t>>2]|0;e=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((h|0)==19){g=b+12|0;b:do{if((c[g>>2]|0)>0){h=b+4604|0;j=($(s,r)|0)+1|0;k=b+4608|0;l=b+92|0;m=(s|0)>0;n=b+4600|0;p=0;c:while(1){f=c[w>>2]|0;d=f+3|0;c[h>>2]=d;e=f+(j*3|0)|0;c[k>>2]=e;if(!(p&1))d=j;else{c[h>>2]=e;c[k>>2]=d;d=1}e=c[l>>2]|0;o=0;Aa(c[(c[e>>2]|0)+12>>2]|0,e|0,f+(d*3|0)|0,c[q>>2]|0,r|0);f=o;o=0;if(f&1){h=29;break}if(m){d=c[t>>2]|0;e=c[h>>2]|0;f=0;do{c[n>>2]=c[d+(f<<2)>>2];y=c[q>>2]|0;d=e+(y*3|0)|0;e=e+((y+-1|0)*3|0)|0;a[d>>0]=a[e>>0]|0;a[d+1>>0]=a[e+1>>0]|0;a[d+2>>0]=a[e+2>>0]|0;d=c[h>>2]|0;e=(c[k>>2]|0)+-3|0;a[e>>0]=a[d>>0]|0;a[e+1>>0]=a[d+1>>0]|0;a[e+2>>0]=a[d+2>>0]|0;o=0;ia(70,b|0,0);e=o;o=0;if(e&1){h=28;break c}d=c[t>>2]|0;c[d+(f<<2)>>2]=c[n>>2];e=(c[h>>2]|0)+(r*3|0)|0;c[h>>2]=e;c[k>>2]=(c[k>>2]|0)+(r*3|0);f=f+1|0}while((f|0)<(s|0))}p=p+1|0;if((p|0)>=(c[g>>2]|0)){h=41;break b}}if((h|0)==28){f=Na()|0;break}else if((h|0)==29){f=Na()|0;break}}else h=41}while(0);do{if((h|0)==41){o=0;ha(182,b|0);y=o;o=0;if(y&1){f=Na()|0;break}d=c[t>>2]|0;e=d;if(d){f=c[v>>2]|0;if((f|0)!=(d|0))c[v>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[w>>2]|0;if(!d){i=u;return}e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);i=u;return}}while(0);d=c[t>>2]|0;e=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[w>>2]|0;if(!d)Ya(f|0);e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}function jf(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=b+180|0;if((c[A>>2]|0)<=0)return;B=b+4608|0;C=b+4604|0;D=b+4612|0;z=0;while(1){w=z+-1|0;i=c[B>>2]|0;j=c[C>>2]|0;e=z+1|0;h=d[j+(z*3|0)>>0]|0;y=c[D>>2]|0;k=d[j+(w*3|0)>>0]|0;l=h-k|0;m=d[i+(w*3|0)>>0]|0;n=k-m|0;o=((((a[y+((d[j+(e*3|0)>>0]|0)-h)>>0]|0)*9|0)+(a[y+l>>0]|0)|0)*9|0)+(a[y+n>>0]|0)|0;g=d[j+(z*3|0)+1>>0]|0;p=d[j+(w*3|0)+1>>0]|0;q=g-p|0;r=d[i+(w*3|0)+1>>0]|0;s=p-r|0;t=((((a[y+((d[j+(e*3|0)+1>>0]|0)-g)>>0]|0)*9|0)+(a[y+q>>0]|0)|0)*9|0)+(a[y+s>>0]|0)|0;f=d[j+(z*3|0)+2>>0]|0;u=d[j+(w*3|0)+2>>0]|0;v=f-u|0;w=d[i+(w*3|0)+2>>0]|0;x=u-w|0;y=((((a[y+((d[j+(e*3|0)+2>>0]|0)-f)>>0]|0)*9|0)+(a[y+v>>0]|0)|0)*9|0)+(a[y+x>>0]|0)|0;if(!(t|o|y))e=(kf(b,z,0)|0)+z|0;else{j=d[i+(z*3|0)>>0]|0;i=h-m>>31;if((i^n|0)>=0)if((i^l|0)<0)h=m;else h=m-k+h|0;j=lf(b,o,j,h,0)|0;i=d[(c[B>>2]|0)+(z*3|0)+1>>0]|0;h=g-r>>31;if((h^s|0)>=0)if((h^q|0)<0)g=r;else g=r-p+g|0;h=lf(b,t,i,g,0)|0;i=d[(c[B>>2]|0)+(z*3|0)+2>>0]|0;g=f-w>>31;if((g^x|0)>=0)if((g^v|0)<0)f=w;else f=w-u+f|0;y=lf(b,y,i,f,0)|0;z=(c[B>>2]|0)+(z*3|0)|0;a[z>>0]=j;a[z+1>>0]=h;a[z+2>>0]=y}if((e|0)<(c[A>>2]|0))z=e;else break}return}function kf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;B=i;i=i+32|0;A=B+15|0;q=B+12|0;p=B+9|0;r=B+6|0;w=B+3|0;x=B;y=(c[b+180>>2]|0)-e|0;z=c[b+4608>>2]|0;s=c[b+4604>>2]|0;v=z+((e+-1|0)*3|0)|0;t=a[v>>0]|0;u=a[v+1>>0]|0;v=a[v+2>>0]|0;f=t&255;g=b+144|0;h=u&255;j=v&255;o=0;while(1){k=z+((o+e|0)*3|0)|0;l=k+1|0;m=k+2|0;C=(d[k>>0]|0)-f|0;n=c[g>>2]|0;if((((C|0)>-1?C:0-C|0)|0)>(n|0))break;C=(d[l>>0]|0)-h|0;if((((C|0)>-1?C:0-C|0)|0)>(n|0))break;C=(d[m>>0]|0)-j|0;if((((C|0)>-1?C:0-C|0)|0)>(n|0))break;a[k>>0]=t;a[l>>0]=u;a[m>>0]=v;o=o+1|0;if((o|0)==(y|0)){o=y;break}}h=(o|0)==(y|0);j=b+4600|0;g=c[36476+(c[j>>2]<<2)>>2]|0;if((1<(o|0))f=o;else{f=o;do{ae(b,1,1);g=c[j>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[j>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>0]=a[C>>0]|0;a[w+1>>0]=a[C+1>>0]|0;a[w+2>>0]=a[C+2>>0]|0;a[x>>0]=t;a[x+1>>0]=u;a[x+2>>0]=v;e=s+(e*3|0)|0;a[p>>0]=a[w>>0]|0;a[p+1>>0]=a[w+1>>0]|0;a[p+2>>0]=a[w+2>>0]|0;a[q>>0]=a[x>>0]|0;a[q+1>>0]=a[x+1>>0]|0;a[q+2>>0]=a[x+2>>0]|0;a[A>>0]=a[e>>0]|0;a[A+1>>0]=a[e+1>>0]|0;a[A+2>>0]=a[e+2>>0]|0;nf(r,b,p,q,A);a[C>>0]=a[r>>0]|0;a[C+1>>0]=a[r+1>>0]|0;a[C+2>>0]=a[r+2>>0]|0;C=c[j>>2]|0;c[j>>2]=(C|0)<1?0:C+-1|0;C=o+1|0;i=B;return C|0}if(!f){C=y;i=B;return C|0}ae(b,1,1);C=y;i=B;return C|0}function lf(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=d>>31;h=(r^d)-r|0;p=a+196+(h*12|0)+10|0;i=b[p>>1]|0;o=a+196+(h*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){d=5;while(1)if((i<>1]^r)-r+f|0;q=a+136|0;f=c[q>>2]|0;if((g&f|0)==(g|0))l=g;else l=f&~(g>>31);g=(e-l^r)-r|0;k=a+144|0;f=c[k>>2]|0;if((g|0)>0)g=(g+f|0)/(f<<1|1|0)|0;else g=(g-f|0)/(f<<1|1|0)|0;n=a+140|0;j=c[n>>2]|0;e=((g|0)<0?j:0)+g|0;j=e-((e|0)<((j+1|0)/2|0|0)?0:j)|0;h=a+196+(h*12|0)+4|0;if(!(f|d))g=(c[h>>2]<<1)+-1+i>>31;else g=0;f=g^j;mf(a,d,f>>30^f<<1,c[a+156>>2]|0);f=c[a+160>>2]|0;d=(c[o>>2]|0)+((j|0)>-1?j:0-j|0)|0;g=(c[h>>2]|0)+($(c[k>>2]<<1|1,j)|0)|0;e=b[p>>1]|0;if((e|0)==(f|0)){d=d>>1;g=g>>1;e=f>>1}c[o>>2]=d;f=e+1|0;b[p>>1]=f;d=f+g|0;if((d|0)>=1){if((g|0)>0){g=g-f|0;p=b[m>>1]|0;b[m>>1]=(p<<16>>16<127&1)+(p&65535);g=(g|0)>0?0:g}}else{g=b[m>>1]|0;b[m>>1]=(g&65535)-(g<<16>>16>-128&1);g=(d|0)>(~e|0)?d:0-e|0}c[h>>2]=g;f=c[k>>2]|0;e=f<<1|1;d=($(e,(j^r)-r|0)|0)+l|0;if((d|0)>=(0-f|0)){g=c[q>>2]|0;if((g+f|0)<(d|0))d=d-($(c[n>>2]|0,e)|0)|0}else{d=($(c[n>>2]|0,e)|0)+d|0;g=c[q>>2]|0}if((d&g|0)==(d|0)){r=d;r=r&255;return r|0}r=g&~(d>>31);r=r&255;return r|0}function mf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=d>>b;g=a+148|0;h=e-(c[g>>2]|0)|0;if((f|0)<(h+-1|0)){if((f|0)>30){e=(f|0)/2|0;ae(a,0,e);f=f-e|0}ae(a,1,f+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,e+-31-(c[g>>2]|0)|0)}else ae(a,1,h);b=c[g>>2]|0;ae(a,(1<>0]|0;p=o-(d[g>>0]|0)>>31|1;i=$(p,(d[f>>0]|0)-o|0)|0;m=e+144|0;j=c[m>>2]|0;if((i|0)>0)i=(i+j|0)/(j<<1|1|0)|0;else i=(i-j|0)/(j<<1|1|0)|0;w=e+140|0;l=c[w>>2]|0;k=((i|0)<0?l:0)+i|0;l=k-((k|0)<((l+1|0)/2|0|0)?0:l)|0;k=e+4576|0;of(e,k,l);t=d[h+1>>0]|0;u=t-(d[g+1>>0]|0)>>31|1;i=$(u,(d[f+1>>0]|0)-t|0)|0;j=c[m>>2]|0;if((i|0)>0)i=(i+j|0)/(j<<1|1|0)|0;else i=(i-j|0)/(j<<1|1|0)|0;q=c[w>>2]|0;v=((i|0)<0?q:0)+i|0;q=v-((v|0)<((q+1|0)/2|0|0)?0:q)|0;of(e,k,q);v=d[h+2>>0]|0;s=v-(d[g+2>>0]|0)>>31|1;i=$(s,(d[f+2>>0]|0)-v|0)|0;j=c[m>>2]|0;if((i|0)>0)i=(i+j|0)/(j<<1|1|0)|0;else i=(i-j|0)/(j<<1|1|0)|0;n=c[w>>2]|0;i=((i|0)<0?n:0)+i|0;n=i-((i|0)<((n+1|0)/2|0|0)?0:n)|0;of(e,k,n);k=c[m>>2]|0;m=k<<1|1;i=($($(m,l)|0,p)|0)+o|0;f=0-k|0;if((i|0)>=(f|0)){j=c[r>>2]|0;if((j+k|0)<(i|0)){i=i-($(c[w>>2]|0,m)|0)|0;g=j}else g=j}else{i=($(c[w>>2]|0,m)|0)+i|0;g=c[r>>2]|0}if((i&g|0)!=(i|0))i=g&~(i>>31);h=i&255;i=($($(m,q)|0,u)|0)+t|0;if((i|0)>=(f|0)){if((g+k|0)<(i|0))i=i-($(c[w>>2]|0,m)|0)|0}else i=($(c[w>>2]|0,m)|0)+i|0;if((i&g|0)!=(i|0))i=g&~(i>>31);j=i&255;i=($($(m,n)|0,s)|0)+v|0;if((i|0)>=(f|0)){if((g+k|0)<(i|0))i=i-($(c[w>>2]|0,m)|0)|0}else i=($(c[w>>2]|0,m)|0)+i|0;if((i&g|0)==(i|0)){w=i;w=w&255;a[b>>0]=h;v=b+1|0;a[v>>0]=j;b=b+2|0;a[b>>0]=w;return}w=g&~(i>>31);w=w&255;a[b>>0]=h;v=b+1|0;a[v>>0]=j;b=b+2|0;a[b>>0]=w;return}function of(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;mf(b,h,g,(c[b+156>>2]|0)+-1-(c[36476+(c[b+4600>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function pf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;f=p;o=b+144|0;a:do{if(!(c[o>>2]|0)){e=c[b+136>>2]|0;d=b+152|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+184>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+188>>2]|0):0)?(c[f+12>>2]|0)==(c[b+192>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4612>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4612>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4612>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4612>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+152|0}while(0);n=1<>2];e=b+4616|0;f=n<<1;g=b+4620|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4612|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+192|0;l=b+188|0;j=b+184|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function qf(a){a=a|0;var b=0,d=0;c[a>>2]=35996;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function rf(a){a=a|0;var b=0,d=0;c[a>>2]=35996;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function sf(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,65535,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+160>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+164>>2]=j;c[d+168>>2]=g;Bf(d);g=0;do{c[d+172+(g*12|0)>>2]=1024;c[d+172+(g*12|0)+4>>2]=0;b[d+172+(g*12|0)+8>>1]=0;b[d+172+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4552>>2]=1024;c[d+4556>>2]=0;a[d+4560>>0]=l;a[d+4561>>0]=1;a[d+4562>>0]=0;c[d+4564>>2]=1024;c[d+4568>>2]=1;a[d+4572>>0]=l;a[d+4573>>0]=1;a[d+4574>>0]=0;c[d+4576>>2]=0;i=h;return}function tf(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4600)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35772;h=e+132|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+148>>2]=c[g>>2];c[e+152>>2]=0;c[e+156>>2]=0;c[e+160>>2]=0;h=e+4544|0;g=e+164|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4556|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4568|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];vf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;vf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function uf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function vf(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;v=i;i=i+32|0;x=v+12|0;u=v;r=a+156|0;s=(c[r>>2]|0)+4|0;if((c[a+32>>2]|0)==1)t=c[a+24>>2]|0;else t=1;d=$(t<<1,s)|0;c[x>>2]=0;y=x+4|0;c[y>>2]=0;c[x+8>>2]=0;do{if(d){if(!((d|0)<0?(o=0,ha(178,x|0),w=o,o=0,w&1):0))j=6;if((j|0)==6?(e=d<<1,o=0,f=ka(67,e|0)|0,w=o,o=0,!(w&1)):0){c[x>>2]=f;w=f+(d<<1)|0;c[x+8>>2]=w;iw(f|0,0,e|0)|0;c[y>>2]=w;break}f=Na()|0;d=c[x>>2]|0;if(!d)Ya(f|0);e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}}while(0);c[u>>2]=0;w=u+4|0;c[w>>2]=0;c[u+8>>2]=0;do{if(!t)j=18;else{if(!(t>>>0>1073741823?(o=0,ha(178,u|0),q=o,o=0,q&1):0))j=16;if((j|0)==16?(g=t<<2,o=0,h=ka(67,g|0)|0,q=o,o=0,!(q&1)):0){c[u>>2]=h;j=h+(t<<2)|0;c[u+8>>2]=j;iw(h|0,0,g|0)|0;c[w>>2]=j;j=18;break}f=Na()|0;d=c[u>>2]|0;e=d;if(d){g=c[w>>2]|0;if((g|0)!=(d|0))c[w>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==18){h=a+12|0;a:do{if((c[h>>2]|0)>0){j=a+4580|0;k=($(t,s)|0)+1|0;l=a+4584|0;m=a+92|0;n=(t|0)>0;p=a+4576|0;q=0;b:while(1){e=c[x>>2]|0;d=e+2|0;c[j>>2]=d;e=e+(k<<1)|0;c[l>>2]=e;if(!(q&1))d=e;else{c[j>>2]=e;c[l>>2]=d}g=c[m>>2]|0;o=0;Aa(c[(c[g>>2]|0)+12>>2]|0,g|0,d|0,c[r>>2]|0,s|0);g=o;o=0;if(g&1){j=28;break}if(n){d=c[j>>2]|0;e=c[l>>2]|0;f=c[u>>2]|0;g=0;do{c[p>>2]=c[f+(g<<2)>>2];f=c[r>>2]|0;b[d+(f<<1)>>1]=b[d+(f+-1<<1)>>1]|0;b[e+-2>>1]=b[d>>1]|0;o=0;ia(71,a|0,0);f=o;o=0;if(f&1){j=27;break b}f=c[u>>2]|0;c[f+(g<<2)>>2]=c[p>>2];d=(c[j>>2]|0)+(s<<1)|0;c[j>>2]=d;e=(c[l>>2]|0)+(s<<1)|0;c[l>>2]=e;g=g+1|0}while((g|0)<(t|0))}q=q+1|0;if((q|0)>=(c[h>>2]|0)){j=40;break a}}if((j|0)==27){f=Na()|0;break}else if((j|0)==28){f=Na()|0;break}}else j=40}while(0);do{if((j|0)==40){o=0;ha(182,a|0);a=o;o=0;if(a&1){f=Na()|0;break}d=c[u>>2]|0;e=d;if(d){f=c[w>>2]|0;if((f|0)!=(d|0))c[w>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[x>>2]|0;if(!d){i=v;return}e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);i=v;return}}while(0);d=c[u>>2]|0;e=d;if(d){g=c[w>>2]|0;if((g|0)!=(d|0))c[w>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[x>>2]|0;if(!d)Ya(f|0);e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}function wf(d,f){d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;p=d+4580|0;f=c[p>>2]|0;s=d+156|0;if((c[s>>2]|0)<=0)return;q=d+4584|0;r=d+4588|0;i=f;j=e[f+-2>>1]|0;f=e[f>>1]|0;o=0;while(1){n=c[q>>2]|0;m=e[n+(o+-1<<1)>>1]|0;h=o+1|0;g=e[i+(h<<1)>>1]|0;l=c[r>>2]|0;k=f-j|0;i=j-m|0;l=((((a[l+(g-f)>>0]|0)*9|0)+(a[l+k>>0]|0)|0)*9|0)+(a[l+i>>0]|0)|0;if(!l){h=(yf(d,o,0)|0)+o|0;g=c[p>>2]|0;f=e[g+(h+-1<<1)>>1]|0;g=e[g+(h<<1)>>1]|0}else{j=f-m>>31;if((j^i|0)<0)i=f;else i=m+((j^k|0)<0?0:k)|0;n=xf(d,l,e[n+(o<<1)>>1]|0,i,0)|0;b[(c[q>>2]|0)+(o<<1)>>1]=n}if((h|0)>=(c[s>>2]|0))break;i=c[p>>2]|0;j=f;f=g;o=h}return}function xf(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=d>>31;k=(q^d)-q|0;p=a+172+(k*12|0)+10|0;i=b[p>>1]|0;o=a+172+(k*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){h=5;while(1)if((i<>1]^q)-q+f|0;if((g&65535|0)==(g|0))m=g;else m=g>>31&65535^65535;j=(e-m^q)-q<<16;l=j>>16;if(!h)g=(c[a+172+(k*12|0)+4>>2]<<1)+-1+i>>31;else g=0;f=g^l;f=f>>30^f<<1;g=f>>h;if((g|0)<47){if((g|0)>30){i=(g|0)/2|0;ae(a,0,i);g=g-i|0}ae(a,1,g+1|0);ae(a,f&(1<>1]|0;g=i<<16>>16==64;h=g&1;e=(c[f>>2]|0)+l>>h;i=g?32:i<<16>>16;c[o>>2]=(c[o>>2]|0)+((j|0)>-65536?l:0-l|0)>>h;h=i+1|0;b[p>>1]=h;g=h+e|0;if((g|0)<1){p=b[n>>1]|0;b[n>>1]=(p&65535)-(p<<16>>16>-128&1);p=(g|0)>(~i|0)?g:0-i|0;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&65535;return d|0}if((e|0)<=0){p=e;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&65535;return d|0}p=e-h|0;o=b[n>>1]|0;b[n>>1]=(o<<16>>16<127&1)+(o&65535);p=(p|0)>0?0:p;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&65535;return d|0}function yf(a,d,f){a=a|0;d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;j=(c[a+156>>2]|0)-d|0;k=c[a+4584>>2]|0;m=c[a+4580>>2]|0;h=b[k+(d+-1<<1)>>1]|0;g=0;while(1){f=k+(g+d<<1)|0;if((b[f>>1]|0)!=h<<16>>16){n=g;break}b[f>>1]=h;g=g+1|0;if((g|0)==(j|0)){n=j;break}}i=h&65535;h=(n|0)==(j|0);l=a+4576|0;g=c[36476+(c[l>>2]<<2)>>2]|0;if((1<(n|0))f=n;else{f=n;do{ae(a,1,1);g=c[l>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[l>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>1]|0;f=e[m+(f<<1)>>1]|0;m=i-f|0;if((((m|0)>-1?m:0-m|0)|0)<1){f=g-i<<16>>16;zf(a,a+4564|0,f);f=f+i|0}else{m=f-i>>31|1;d=($(g-f<<16,m)|0)>>16;zf(a,a+4552|0,d);f=($(d,m)|0)+f|0}b[h>>1]=f;a=c[l>>2]|0;c[l>>2]=(a|0)<1?0:a+-1|0;a=n+1|0;return a|0}function zf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;Af(b,h,g,63-(c[36476+(c[b+4576>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function Af(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=c>>b;f=d+-16|0;if((e|0)<(d+-17|0)){if((e|0)>30){d=(e|0)/2|0;ae(a,0,d);e=e-d|0}ae(a,1,e+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,d+-47|0)}else ae(a,1,f);ae(a,c+65535&65535,16);return}function Bf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,65535,0);l=b+160|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+164>>2]|0):0)?(c[k+12>>2]|0)==(c[b+168>>2]|0):0){l=c[8909]|0;c[b+4588>>2]=l+(((c[8910]|0)-l|0)>>>1);i=m;return}e=b+4592|0;f=b+4596|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=131072){if(h>>>0>131072?(j=d+131072|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,131072-h|0);d=c[e>>2]|0}k=b+4588|0;c[k>>2]=d+65536;j=b+168|0;g=b+164|0;h=-65536;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==65536)break}i=m;return}function Cf(a){a=a|0;var b=0,d=0;c[a>>2]=35968;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function Df(a){a=a|0;var b=0,d=0;c[a>>2]=35968;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function Ef(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,4095,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+160>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+164>>2]=j;c[d+168>>2]=g;Nf(d);g=0;do{c[d+172+(g*12|0)>>2]=64;c[d+172+(g*12|0)+4>>2]=0;b[d+172+(g*12|0)+8>>1]=0;b[d+172+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4552>>2]=64;c[d+4556>>2]=0;a[d+4560>>0]=l;a[d+4561>>0]=1;a[d+4562>>0]=0;c[d+4564>>2]=64;c[d+4568>>2]=1;a[d+4572>>0]=l;a[d+4573>>0]=1;a[d+4574>>0]=0;c[d+4576>>2]=0;i=h;return}function Ff(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4600)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35744;h=e+132|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+148>>2]=c[g>>2];c[e+152>>2]=0;c[e+156>>2]=0;c[e+160>>2]=0;h=e+4544|0;g=e+164|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4556|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4568|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];Hf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;Hf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function Gf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function Hf(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;v=i;i=i+32|0;x=v+12|0;u=v;r=a+156|0;s=(c[r>>2]|0)+4|0;if((c[a+32>>2]|0)==1)t=c[a+24>>2]|0;else t=1;d=$(t<<1,s)|0;c[x>>2]=0;y=x+4|0;c[y>>2]=0;c[x+8>>2]=0;do{if(d){if(!((d|0)<0?(o=0,ha(178,x|0),w=o,o=0,w&1):0))j=6;if((j|0)==6?(e=d<<1,o=0,f=ka(67,e|0)|0,w=o,o=0,!(w&1)):0){c[x>>2]=f;w=f+(d<<1)|0;c[x+8>>2]=w;iw(f|0,0,e|0)|0;c[y>>2]=w;break}f=Na()|0;d=c[x>>2]|0;if(!d)Ya(f|0);e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}}while(0);c[u>>2]=0;w=u+4|0;c[w>>2]=0;c[u+8>>2]=0;do{if(!t)j=18;else{if(!(t>>>0>1073741823?(o=0,ha(178,u|0),q=o,o=0,q&1):0))j=16;if((j|0)==16?(g=t<<2,o=0,h=ka(67,g|0)|0,q=o,o=0,!(q&1)):0){c[u>>2]=h;j=h+(t<<2)|0;c[u+8>>2]=j;iw(h|0,0,g|0)|0;c[w>>2]=j;j=18;break}f=Na()|0;d=c[u>>2]|0;e=d;if(d){g=c[w>>2]|0;if((g|0)!=(d|0))c[w>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==18){h=a+12|0;a:do{if((c[h>>2]|0)>0){j=a+4580|0;k=($(t,s)|0)+1|0;l=a+4584|0;m=a+92|0;n=(t|0)>0;p=a+4576|0;q=0;b:while(1){e=c[x>>2]|0;d=e+2|0;c[j>>2]=d;e=e+(k<<1)|0;c[l>>2]=e;if(!(q&1))d=e;else{c[j>>2]=e;c[l>>2]=d}g=c[m>>2]|0;o=0;Aa(c[(c[g>>2]|0)+12>>2]|0,g|0,d|0,c[r>>2]|0,s|0);g=o;o=0;if(g&1){j=28;break}if(n){d=c[j>>2]|0;e=c[l>>2]|0;f=c[u>>2]|0;g=0;do{c[p>>2]=c[f+(g<<2)>>2];f=c[r>>2]|0;b[d+(f<<1)>>1]=b[d+(f+-1<<1)>>1]|0;b[e+-2>>1]=b[d>>1]|0;o=0;ia(72,a|0,0);f=o;o=0;if(f&1){j=27;break b}f=c[u>>2]|0;c[f+(g<<2)>>2]=c[p>>2];d=(c[j>>2]|0)+(s<<1)|0;c[j>>2]=d;e=(c[l>>2]|0)+(s<<1)|0;c[l>>2]=e;g=g+1|0}while((g|0)<(t|0))}q=q+1|0;if((q|0)>=(c[h>>2]|0)){j=40;break a}}if((j|0)==27){f=Na()|0;break}else if((j|0)==28){f=Na()|0;break}}else j=40}while(0);do{if((j|0)==40){o=0;ha(182,a|0);a=o;o=0;if(a&1){f=Na()|0;break}d=c[u>>2]|0;e=d;if(d){f=c[w>>2]|0;if((f|0)!=(d|0))c[w>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[x>>2]|0;if(!d){i=v;return}e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);i=v;return}}while(0);d=c[u>>2]|0;e=d;if(d){g=c[w>>2]|0;if((g|0)!=(d|0))c[w>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[x>>2]|0;if(!d)Ya(f|0);e=c[y>>2]|0;if((e|0)!=(d|0))c[y>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}function If(d,f){d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;p=d+4580|0;f=c[p>>2]|0;s=d+156|0;if((c[s>>2]|0)<=0)return;q=d+4584|0;r=d+4588|0;i=f;j=e[f+-2>>1]|0;f=e[f>>1]|0;o=0;while(1){n=c[q>>2]|0;m=e[n+(o+-1<<1)>>1]|0;h=o+1|0;g=e[i+(h<<1)>>1]|0;l=c[r>>2]|0;k=f-j|0;i=j-m|0;l=((((a[l+(g-f)>>0]|0)*9|0)+(a[l+k>>0]|0)|0)*9|0)+(a[l+i>>0]|0)|0;if(!l){h=(Kf(d,o,0)|0)+o|0;g=c[p>>2]|0;f=e[g+(h+-1<<1)>>1]|0;g=e[g+(h<<1)>>1]|0}else{j=f-m>>31;if((j^i|0)<0)i=f;else i=m+((j^k|0)<0?0:k)|0;n=Jf(d,l,e[n+(o<<1)>>1]|0,i,0)|0;b[(c[q>>2]|0)+(o<<1)>>1]=n}if((h|0)>=(c[s>>2]|0))break;i=c[p>>2]|0;j=f;f=g;o=h}return}function Jf(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=d>>31;k=(q^d)-q|0;p=a+172+(k*12|0)+10|0;i=b[p>>1]|0;o=a+172+(k*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){h=5;while(1)if((i<>1]^q)-q+f|0;if((g&4095|0)==(g|0))m=g;else m=g>>31&4095^4095;j=(e-m^q)-q<<20;l=j>>20;if(!h)g=(c[a+172+(k*12|0)+4>>2]<<1)+-1+i>>31;else g=0;f=g^l;f=f>>30^f<<1;g=f>>h;if((g|0)<35){if((g|0)>30){i=(g|0)/2|0;ae(a,0,i);g=g-i|0}ae(a,1,g+1|0);ae(a,f&(1<>1]|0;g=i<<16>>16==64;h=g&1;e=(c[f>>2]|0)+l>>h;i=g?32:i<<16>>16;c[o>>2]=(c[o>>2]|0)+((j|0)>-1048576?l:0-l|0)>>h;h=i+1|0;b[p>>1]=h;g=h+e|0;if((g|0)<1){p=b[n>>1]|0;b[n>>1]=(p&65535)-(p<<16>>16>-128&1);p=(g|0)>(~i|0)?g:0-i|0;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&4095;d=d&65535;return d|0}if((e|0)<=0){p=e;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&4095;d=d&65535;return d|0}p=e-h|0;o=b[n>>1]|0;b[n>>1]=(o<<16>>16<127&1)+(o&65535);p=(p|0)>0?0:p;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&4095;d=d&65535;return d|0}function Kf(a,d,f){a=a|0;d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;j=(c[a+156>>2]|0)-d|0;k=c[a+4584>>2]|0;m=c[a+4580>>2]|0;h=b[k+(d+-1<<1)>>1]|0;g=0;while(1){f=k+(g+d<<1)|0;if((b[f>>1]|0)!=h<<16>>16){n=g;break}b[f>>1]=h;g=g+1|0;if((g|0)==(j|0)){n=j;break}}i=h&65535;h=(n|0)==(j|0);l=a+4576|0;g=c[36476+(c[l>>2]<<2)>>2]|0;if((1<(n|0))f=n;else{f=n;do{ae(a,1,1);g=c[l>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[l>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>1]|0;f=e[m+(f<<1)>>1]|0;m=i-f|0;if((((m|0)>-1?m:0-m|0)|0)<1){f=g-i<<20>>20;Lf(a,a+4564|0,f);f=f+i|0}else{m=f-i>>31|1;d=($(g-f<<20,m)|0)>>20;Lf(a,a+4552|0,d);f=($(d,m)|0)+f|0}b[h>>1]=f&4095;a=c[l>>2]|0;c[l>>2]=(a|0)<1?0:a+-1|0;a=n+1|0;return a|0}function Lf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;Mf(b,h,g,47-(c[36476+(c[b+4576>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function Mf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=c>>b;f=d+-12|0;if((e|0)<(d+-13|0)){if((e|0)>30){d=(e|0)/2|0;ae(a,0,d);e=e-d|0}ae(a,1,e+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,d+-43|0)}else ae(a,1,f);ae(a,c+4095&4095,12);return}function Nf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,4095,0);l=b+160|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+164>>2]|0):0)?(c[k+12>>2]|0)==(c[b+168>>2]|0):0){l=c[8906]|0;c[b+4588>>2]=l+(((c[8907]|0)-l|0)>>>1);i=m;return}e=b+4592|0;f=b+4596|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=8192){if(h>>>0>8192?(j=d+8192|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,8192-h|0);d=c[e>>2]|0}k=b+4588|0;c[k>>2]=d+4096;j=b+168|0;g=b+164|0;h=-4096;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==4096)break}i=m;return}function Of(a){a=a|0;var b=0,d=0;c[a>>2]=35940;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function Pf(a){a=a|0;var b=0,d=0;c[a>>2]=35940;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function Qf(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,255,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+160>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+164>>2]=j;c[d+168>>2]=g;Zf(d);g=0;do{c[d+172+(g*12|0)>>2]=4;c[d+172+(g*12|0)+4>>2]=0;b[d+172+(g*12|0)+8>>1]=0;b[d+172+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4552>>2]=4;c[d+4556>>2]=0;a[d+4560>>0]=l;a[d+4561>>0]=1;a[d+4562>>0]=0;c[d+4564>>2]=4;c[d+4568>>2]=1;a[d+4572>>0]=l;a[d+4573>>0]=1;a[d+4574>>0]=0;c[d+4576>>2]=0;i=h;return}function Rf(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4600)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35716;h=e+132|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+148>>2]=c[g>>2];c[e+152>>2]=0;c[e+156>>2]=0;c[e+160>>2]=0;h=e+4544|0;g=e+164|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4556|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4568|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];Tf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;Tf(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function Sf(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function Tf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;u=i;i=i+32|0;w=u+12|0;t=u;q=b+156|0;r=(c[q>>2]|0)+4|0;if((c[b+32>>2]|0)==1)s=c[b+24>>2]|0;else s=1;d=$(s<<1,r)|0;c[w>>2]=0;x=w+4|0;c[x>>2]=0;c[w+8>>2]=0;a:do{if(d){if(!((d|0)<0?(o=0,ha(178,w|0),v=o,o=0,v&1):0))h=6;if((h|0)==6?(o=0,e=ka(67,d|0)|0,v=o,o=0,!(v&1)):0){c[x>>2]=e;c[w>>2]=e;c[w+8>>2]=e+d;while(1){a[e>>0]=0;e=(c[x>>2]|0)+1|0;c[x>>2]=e;d=d+-1|0;if(!d)break a}}e=Na()|0;d=c[w>>2]|0;if(!d)Ya(e|0);if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);Ya(e|0)}}while(0);c[t>>2]=0;v=t+4|0;c[v>>2]=0;c[t+8>>2]=0;do{if(!s)h=19;else{if(!(s>>>0>1073741823?(o=0,ha(178,t|0),p=o,o=0,p&1):0))h=17;if((h|0)==17?(f=s<<2,o=0,g=ka(67,f|0)|0,p=o,o=0,!(p&1)):0){c[t>>2]=g;h=g+(s<<2)|0;c[t+8>>2]=h;iw(g|0,0,f|0)|0;c[v>>2]=h;h=19;break}e=Na()|0;d=c[t>>2]|0;f=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}}while(0);if((h|0)==19){g=b+12|0;b:do{if((c[g>>2]|0)>0){h=b+4580|0;j=($(s,r)|0)+1|0;k=b+4584|0;l=b+92|0;m=(s|0)>0;n=b+4576|0;p=0;c:while(1){e=c[w>>2]|0;d=e+1|0;c[h>>2]=d;e=e+j|0;c[k>>2]=e;if(!(p&1))d=e;else{c[h>>2]=e;c[k>>2]=d}f=c[l>>2]|0;o=0;Aa(c[(c[f>>2]|0)+12>>2]|0,f|0,d|0,c[q>>2]|0,r|0);f=o;o=0;if(f&1){h=29;break}if(m){d=c[h>>2]|0;e=c[t>>2]|0;f=0;do{c[n>>2]=c[e+(f<<2)>>2];e=c[q>>2]|0;a[d+e>>0]=a[d+(e+-1)>>0]|0;a[(c[k>>2]|0)+-1>>0]=a[c[h>>2]>>0]|0;o=0;ia(73,b|0,0);e=o;o=0;if(e&1){h=28;break c}e=c[t>>2]|0;c[e+(f<<2)>>2]=c[n>>2];d=(c[h>>2]|0)+r|0;c[h>>2]=d;c[k>>2]=(c[k>>2]|0)+r;f=f+1|0}while((f|0)<(s|0))}p=p+1|0;if((p|0)>=(c[g>>2]|0)){h=41;break b}}if((h|0)==28){e=Na()|0;break}else if((h|0)==29){e=Na()|0;break}}else h=41}while(0);do{if((h|0)==41){o=0;ha(182,b|0);b=o;o=0;if(b&1){e=Na()|0;break}d=c[t>>2]|0;e=d;if(d){f=c[v>>2]|0;if((f|0)!=(d|0))c[v>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[w>>2]|0;if(!d){i=u;return}if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);i=u;return}}while(0);d=c[t>>2]|0;f=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}d=c[w>>2]|0;if(!d)Ya(e|0);if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);Ya(e|0)}function Uf(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;o=b+4580|0;e=c[o>>2]|0;r=b+156|0;if((c[r>>2]|0)<=0)return;p=b+4584|0;q=b+4588|0;h=e;i=d[e+-1>>0]|0;e=d[e>>0]|0;n=0;while(1){m=c[p>>2]|0;l=d[m+(n+-1)>>0]|0;g=n+1|0;f=d[h+g>>0]|0;k=c[q>>2]|0;j=e-i|0;h=i-l|0;k=((((a[k+(f-e)>>0]|0)*9|0)+(a[k+j>>0]|0)|0)*9|0)+(a[k+h>>0]|0)|0;if(!k){g=(Wf(b,n,0)|0)+n|0;f=c[o>>2]|0;e=d[f+(g+-1)>>0]|0;f=d[f+g>>0]|0}else{i=e-l>>31;if((i^h|0)<0)h=e;else h=l+((i^j|0)<0?0:j)|0;m=Vf(b,k,d[m+n>>0]|0,h,0)|0;a[(c[p>>2]|0)+n>>0]=m}if((g|0)>=(c[r>>2]|0))break;h=c[o>>2]|0;i=e;e=f;n=g}return}function Vf(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=d>>31;k=(q^d)-q|0;p=a+172+(k*12|0)+10|0;i=b[p>>1]|0;o=a+172+(k*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){h=5;while(1)if((i<>1]^q)-q+f|0;if((g&255|0)==(g|0))m=g;else m=g>>31&255^255;j=(e-m^q)-q<<24;l=j>>24;if(!h)g=(c[a+172+(k*12|0)+4>>2]<<1)+-1+i>>31;else g=0;g=g^l;g=g>>30^g<<1;f=g>>h;if((f|0)<23){ae(a,1,f+1|0);ae(a,g&(1<>1]|0;g=i<<16>>16==64;h=g&1;e=(c[f>>2]|0)+l>>h;i=g?32:i<<16>>16;c[o>>2]=(c[o>>2]|0)+((j|0)>-16777216?l:0-l|0)>>h;h=i+1|0;b[p>>1]=h;g=h+e|0;if((g|0)<1){p=b[n>>1]|0;b[n>>1]=(p&65535)-(p<<16>>16>-128&1);p=(g|0)>(~i|0)?g:0-i|0;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&255;return d|0}if((e|0)<=0){p=e;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&255;return d|0}p=e-h|0;o=b[n>>1]|0;b[n>>1]=(o<<16>>16<127&1)+(o&65535);p=(p|0)>0?0:p;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&255;return d|0}function Wf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;j=(c[b+156>>2]|0)-e|0;k=c[b+4584>>2]|0;m=c[b+4580>>2]|0;h=a[k+(e+-1)>>0]|0;g=0;while(1){f=k+(g+e)|0;if((a[f>>0]|0)!=h<<24>>24){n=g;break}a[f>>0]=h;g=g+1|0;if((g|0)==(j|0)){n=j;break}}i=h&255;h=(n|0)==(j|0);l=b+4576|0;g=c[36476+(c[l>>2]<<2)>>2]|0;if((1<(n|0))f=n;else{f=n;do{ae(b,1,1);g=c[l>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[l>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>0]|0;f=d[m+f>>0]|0;m=i-f|0;if((((m|0)>-1?m:0-m|0)|0)<1){f=g-i<<24>>24;Xf(b,b+4564|0,f);f=f+i|0}else{m=f-i>>31|1;e=($(g-f<<24,m)|0)>>24;Xf(b,b+4552|0,e);f=($(e,m)|0)+f|0}a[h>>0]=f;b=c[l>>2]|0;c[l>>2]=(b|0)<1?0:b+-1|0;b=n+1|0;return b|0}function Xf(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;Yf(b,h,g,31-(c[36476+(c[b+4576>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function Yf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=c>>b;f=d+-8|0;if((e|0)<(d+-9|0)){if((e|0)>30){d=(e|0)/2|0;ae(a,0,d);e=e-d|0}ae(a,1,e+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,d+-39|0)}else ae(a,1,f);ae(a,c+255&255,8);return}function Zf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,255,0);l=b+160|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+164>>2]|0):0)?(c[k+12>>2]|0)==(c[b+168>>2]|0):0){l=c[8900]|0;c[b+4588>>2]=l+(((c[8901]|0)-l|0)>>>1);i=m;return}e=b+4592|0;f=b+4596|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=512){if(h>>>0>512?(j=d+512|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,512-h|0);d=c[e>>2]|0}k=b+4588|0;c[k>>2]=d+256;j=b+168|0;g=b+164|0;h=-256;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==256)break}i=m;return}function _f(a){a=a|0;var b=0,d=0;c[a>>2]=35912;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function $f(a){a=a|0;var b=0,d=0;c[a>>2]=35912;b=c[a+4592>>2]|0;if(b){d=a+4596|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function ag(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,255,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+160>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+164>>2]=j;c[d+168>>2]=g;jg(d);g=0;do{c[d+172+(g*12|0)>>2]=4;c[d+172+(g*12|0)+4>>2]=0;b[d+172+(g*12|0)+8>>1]=0;b[d+172+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4552>>2]=4;c[d+4556>>2]=0;a[d+4560>>0]=l;a[d+4561>>0]=1;a[d+4562>>0]=0;c[d+4564>>2]=4;c[d+4568>>2]=1;a[d+4572>>0]=l;a[d+4573>>0]=1;a[d+4574>>0]=0;c[d+4576>>2]=0;i=h;return}function bg(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4600)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35688;h=e+132|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+148>>2]=c[g>>2];c[e+152>>2]=0;c[e+156>>2]=0;c[e+160>>2]=0;h=e+4544|0;g=e+164|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4556|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4568|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];dg(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;dg(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function cg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function dg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;u=i;i=i+32|0;w=u+12|0;t=u;q=b+156|0;r=(c[q>>2]|0)+4|0;if((c[b+32>>2]|0)==1)s=c[b+24>>2]|0;else s=1;d=$(s<<1,r)|0;c[w>>2]=0;x=w+4|0;c[x>>2]=0;c[w+8>>2]=0;a:do{if(d){if(!(d>>>0>1431655765?(o=0,ha(178,w|0),v=o,o=0,v&1):0))h=6;if((h|0)==6?(o=0,e=ka(67,d*3|0)|0,v=o,o=0,!(v&1)):0){c[x>>2]=e;c[w>>2]=e;c[w+8>>2]=e+(d*3|0);while(1){a[e>>0]=0;a[e+1>>0]=0;a[e+2>>0]=0;e=(c[x>>2]|0)+3|0;c[x>>2]=e;d=d+-1|0;if(!d)break a}}f=Na()|0;d=c[w>>2]|0;if(!d)Ya(f|0);e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}}while(0);c[t>>2]=0;v=t+4|0;c[v>>2]=0;c[t+8>>2]=0;do{if(!s)h=19;else{if(!(s>>>0>1073741823?(o=0,ha(178,t|0),p=o,o=0,p&1):0))h=17;if((h|0)==17?(f=s<<2,o=0,g=ka(67,f|0)|0,p=o,o=0,!(p&1)):0){c[t>>2]=g;h=g+(s<<2)|0;c[t+8>>2]=h;iw(g|0,0,f|0)|0;c[v>>2]=h;h=19;break}f=Na()|0;d=c[t>>2]|0;e=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((h|0)==19){g=b+12|0;b:do{if((c[g>>2]|0)>0){h=b+4580|0;j=($(s,r)|0)+1|0;k=b+4584|0;l=b+92|0;m=(s|0)>0;n=b+4576|0;p=0;c:while(1){f=c[w>>2]|0;d=f+3|0;c[h>>2]=d;e=f+(j*3|0)|0;c[k>>2]=e;if(!(p&1))d=j;else{c[h>>2]=e;c[k>>2]=d;d=1}e=c[l>>2]|0;o=0;Aa(c[(c[e>>2]|0)+12>>2]|0,e|0,f+(d*3|0)|0,c[q>>2]|0,r|0);f=o;o=0;if(f&1){h=29;break}if(m){d=c[t>>2]|0;e=c[h>>2]|0;f=0;do{c[n>>2]=c[d+(f<<2)>>2];y=c[q>>2]|0;d=e+(y*3|0)|0;e=e+((y+-1|0)*3|0)|0;a[d>>0]=a[e>>0]|0;a[d+1>>0]=a[e+1>>0]|0;a[d+2>>0]=a[e+2>>0]|0;d=c[h>>2]|0;e=(c[k>>2]|0)+-3|0;a[e>>0]=a[d>>0]|0;a[e+1>>0]=a[d+1>>0]|0;a[e+2>>0]=a[d+2>>0]|0;o=0;ia(74,b|0,0);e=o;o=0;if(e&1){h=28;break c}d=c[t>>2]|0;c[d+(f<<2)>>2]=c[n>>2];e=(c[h>>2]|0)+(r*3|0)|0;c[h>>2]=e;c[k>>2]=(c[k>>2]|0)+(r*3|0);f=f+1|0}while((f|0)<(s|0))}p=p+1|0;if((p|0)>=(c[g>>2]|0)){h=41;break b}}if((h|0)==28){f=Na()|0;break}else if((h|0)==29){f=Na()|0;break}}else h=41}while(0);do{if((h|0)==41){o=0;ha(182,b|0);y=o;o=0;if(y&1){f=Na()|0;break}d=c[t>>2]|0;e=d;if(d){f=c[v>>2]|0;if((f|0)!=(d|0))c[v>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[w>>2]|0;if(!d){i=u;return}e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);i=u;return}}while(0);d=c[t>>2]|0;e=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[w>>2]|0;if(!d)Ya(f|0);e=c[x>>2]|0;if((e|0)!=(d|0))c[x>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}function eg(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=b+156|0;if((c[A>>2]|0)<=0)return;B=b+4584|0;C=b+4580|0;D=b+4588|0;z=0;while(1){w=z+-1|0;i=c[B>>2]|0;j=c[C>>2]|0;e=z+1|0;h=d[j+(z*3|0)>>0]|0;y=c[D>>2]|0;k=d[j+(w*3|0)>>0]|0;l=h-k|0;m=d[i+(w*3|0)>>0]|0;n=k-m|0;o=((((a[y+((d[j+(e*3|0)>>0]|0)-h)>>0]|0)*9|0)+(a[y+l>>0]|0)|0)*9|0)+(a[y+n>>0]|0)|0;g=d[j+(z*3|0)+1>>0]|0;p=d[j+(w*3|0)+1>>0]|0;q=g-p|0;r=d[i+(w*3|0)+1>>0]|0;s=p-r|0;t=((((a[y+((d[j+(e*3|0)+1>>0]|0)-g)>>0]|0)*9|0)+(a[y+q>>0]|0)|0)*9|0)+(a[y+s>>0]|0)|0;f=d[j+(z*3|0)+2>>0]|0;u=d[j+(w*3|0)+2>>0]|0;v=f-u|0;w=d[i+(w*3|0)+2>>0]|0;x=u-w|0;y=((((a[y+((d[j+(e*3|0)+2>>0]|0)-f)>>0]|0)*9|0)+(a[y+v>>0]|0)|0)*9|0)+(a[y+x>>0]|0)|0;if(!(t|o|y))e=(fg(b,z,0)|0)+z|0;else{j=d[i+(z*3|0)>>0]|0;i=h-m>>31;if((i^n|0)>=0)if((i^l|0)<0)h=m;else h=m-k+h|0;j=gg(b,o,j,h,0)|0;i=d[(c[B>>2]|0)+(z*3|0)+1>>0]|0;h=g-r>>31;if((h^s|0)>=0)if((h^q|0)<0)g=r;else g=r-p+g|0;h=gg(b,t,i,g,0)|0;i=d[(c[B>>2]|0)+(z*3|0)+2>>0]|0;g=f-w>>31;if((g^x|0)>=0)if((g^v|0)<0)f=w;else f=w-u+f|0;y=gg(b,y,i,f,0)|0;z=(c[B>>2]|0)+(z*3|0)|0;a[z>>0]=j;a[z+1>>0]=h;a[z+2>>0]=y}if((e|0)<(c[A>>2]|0))z=e;else break}return}function fg(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;m=(c[b+156>>2]|0)-e|0;n=c[b+4584>>2]|0;o=c[b+4580>>2]|0;l=n+((e+-1|0)*3|0)|0;p=a[l>>0]|0;k=a[l+1>>0]|0;l=a[l+2>>0]|0;i=0;while(1){f=n+((i+e|0)*3|0)|0;g=f+1|0;h=f+2|0;if(!(((a[f>>0]|0)==p<<24>>24?(a[g>>0]|0)==k<<24>>24:0)&(a[h>>0]|0)==l<<24>>24))break;a[f>>0]=p;a[g>>0]=k;a[h>>0]=l;i=i+1|0;if((i|0)==(m|0)){i=m;break}}h=(i|0)==(m|0);j=b+4576|0;g=c[36476+(c[j>>2]<<2)>>2]|0;if((1<(i|0))f=i;else{f=i;do{ae(b,1,1);g=c[j>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[j>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>0]|0;e=m+2|0;f=a[e>>0]|0;o=o+(q*3|0)|0;q=a[o+1>>0]|0;t=a[o+2>>0]|0;o=d[o>>0]|0;h=o-(p&255)>>31|1;g=($((d[m>>0]|0)-o<<24,h)|0)>>24;s=b+4552|0;hg(b,s,g);p=q&255;q=p-(k&255)>>31|1;r=($((r&255)-p<<24,q)|0)>>24;hg(b,s,r);k=t&255;l=k-(l&255)>>31|1;f=($((f&255)-k<<24,l)|0)>>24;hg(b,s,f);p=($(r,q)|0)+p&255;b=($(f,l)|0)+k&255;a[m>>0]=($(g,h)|0)+o;a[n>>0]=p;a[e>>0]=b;b=c[j>>2]|0;c[j>>2]=(b|0)<1?0:b+-1|0;b=i+1|0;return b|0}if(!f){t=m;return t|0}ae(b,1,1);t=m;return t|0}function gg(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=d>>31;k=(q^d)-q|0;p=a+172+(k*12|0)+10|0;i=b[p>>1]|0;o=a+172+(k*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){h=5;while(1)if((i<>1]^q)-q+f|0;if((g&255|0)==(g|0))m=g;else m=g>>31&255^255;j=(e-m^q)-q<<24;l=j>>24;if(!h)g=(c[a+172+(k*12|0)+4>>2]<<1)+-1+i>>31;else g=0;g=g^l;g=g>>30^g<<1;f=g>>h;if((f|0)<23){ae(a,1,f+1|0);ae(a,g&(1<>1]|0;g=i<<16>>16==64;h=g&1;e=(c[f>>2]|0)+l>>h;i=g?32:i<<16>>16;c[o>>2]=(c[o>>2]|0)+((j|0)>-16777216?l:0-l|0)>>h;h=i+1|0;b[p>>1]=h;g=h+e|0;if((g|0)<1){p=b[n>>1]|0;b[n>>1]=(p&65535)-(p<<16>>16>-128&1);p=(g|0)>(~i|0)?g:0-i|0;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&255;return d|0}if((e|0)<=0){p=e;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&255;return d|0}p=e-h|0;o=b[n>>1]|0;b[n>>1]=(o<<16>>16<127&1)+(o&65535);p=(p|0)>0?0:p;c[f>>2]=p;q=l^q;d=d>>>31;d=m+d|0;d=d+q|0;d=d&255;return d|0}function hg(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;ig(b,h,g,31-(c[36476+(c[b+4576>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function ig(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=c>>b;f=d+-8|0;if((e|0)<(d+-9|0)){if((e|0)>30){d=(e|0)/2|0;ae(a,0,d);e=e-d|0}ae(a,1,e+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,d+-39|0)}else ae(a,1,f);ae(a,c+255&255,8);return}function jg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,255,0);l=b+160|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+164>>2]|0):0)?(c[k+12>>2]|0)==(c[b+168>>2]|0):0){l=c[8900]|0;c[b+4588>>2]=l+(((c[8901]|0)-l|0)>>>1);i=m;return}e=b+4592|0;f=b+4596|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=512){if(h>>>0>512?(j=d+512|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,512-h|0);d=c[e>>2]|0}k=b+4588|0;c[k>>2]=d+256;j=b+168|0;g=b+164|0;h=-256;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==256)break}i=m;return}function kg(a){a=a|0;var b=0,d=0;c[a>>2]=35884;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);a=a+4|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function lg(a){a=a|0;var b=0,d=0;c[a>>2]=35884;b=c[a+4616>>2]|0;if(b){d=a+4620|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36612;b=c[a+120>>2]|0;if(b){d=a+124|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+92|0;b=c[d>>2]|0;c[d>>2]=0;if(b)Bb[c[(c[b>>2]|0)+4>>2]&255](b);d=a+4|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function mg(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+136>>2]|0,c[d+144>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+184>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+188>>2]=j;c[d+192>>2]=h;wg(d);h=d+140|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+196+(j*12|0)>>2]=e;c[d+196+(j*12|0)+4>>2]=0;b[d+196+(j*12|0)+8>>1]=0;b[d+196+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4576>>2]=l;c[d+4580>>2]=0;a[d+4584>>0]=m;a[d+4585>>0]=1;a[d+4586>>0]=0;c[d+4588>>2]=l;c[d+4592>>2]=1;a[d+4596>>0]=m;a[d+4597>>0]=1;a[d+4598>>0]=0;c[d+4600>>2]=0;i=k;return}function ng(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+16|0;m=o;l=d+92|0;k=c[e>>2]|0;c[e>>2]=0;e=c[l>>2]|0;c[l>>2]=k;if(e)Bb[c[(c[e>>2]|0)+4>>2]&255](e);c[m>>2]=0;c[m+4>>2]=g;l=f+8|0;c[m+8>>2]=c[l>>2];if(g){e=bj(4624)|0;g=d+8|0;h=e+4|0;j=g;k=h+84|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));h=e+88|0;k=h+40|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(k|0));c[e>>2]=35660;c[e+128>>2]=c[d+136>>2];c[e+132>>2]=c[d+140>>2];c[e+136>>2]=c[d+144>>2];c[e+140>>2]=c[d+148>>2];c[e+144>>2]=c[d+152>>2];c[e+148>>2]=c[d+156>>2];c[e+152>>2]=c[d+160>>2];h=e+156|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[e+172>>2]=c[g>>2];c[e+176>>2]=0;c[e+180>>2]=0;c[e+184>>2]=0;h=e+4568|0;g=e+188|0;do{c[g>>2]=0;c[g+4>>2]=0;b[g+8>>1]=0;b[g+10>>1]=1;g=g+12|0}while((g|0)!=(h|0));j=d+4|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;a[h+10>>0]=0;k=e+4580|0;c[k>>2]=0;c[k+4>>2]=0;b[k+8>>1]=0;a[k+10>>0]=0;k=e+4592|0;c[k>>2]=0;c[k+4>>2]=0;c[k+8>>2]=0;c[k+12>>2]=0;c[k+16>>2]=0;c[k+20>>2]=0;c[k+24>>2]=0;a[k+28>>0]=0;if(!(c[e+28>>2]|0))c[e+20>>2]=1;g=c[j>>2]|0;c[j>>2]=e;if(g){Bb[c[(c[g>>2]|0)+4>>2]&255](g);e=c[j>>2]|0}Wd(e,m)}m=d+100|0;c[m>>2]=32;c[d+96>>2]=0;e=c[f>>2]|0;if(!e){c[d+108>>2]=c[f+4>>2];c[d+104>>2]=c[l>>2];pg(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}c[d+132>>2]=e;h=d+120|0;l=d+124|0;g=c[l>>2]|0;e=c[h>>2]|0;j=e;k=g-j|0;if(k>>>0>=4e3){if(k>>>0>4e3?(n=e+4e3|0,(g|0)!=(n|0)):0){c[l>>2]=n;g=n}}else{Xd(h,4e3-k|0);e=c[h>>2]|0;j=e;g=c[l>>2]|0}c[d+108>>2]=j;c[d+104>>2]=g-e;pg(d);n=d+116|0;n=c[n>>2]|0;d=c[m>>2]|0;d=d+-32|0;d=(d|0)/8|0;d=n-d|0;i=o;return d|0}function og(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+32>>2]|0)!=0?(c[b+24>>2]|0)!=1:0){s=b+8|0;u=b+36|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+16>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+20>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function pg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;u=i;i=i+32|0;w=u+12|0;t=u;r=b+180|0;s=(c[r>>2]|0)+4|0;if((c[b+32>>2]|0)==1)p=c[b+24>>2]|0;else p=1;d=$(p<<1,s)|0;c[w>>2]=0;x=w+4|0;c[x>>2]=0;c[w+8>>2]=0;a:do{if(d){if(!((d|0)<0?(o=0,ha(178,w|0),v=o,o=0,v&1):0))q=6;if((q|0)==6?(o=0,e=ka(67,d|0)|0,v=o,o=0,!(v&1)):0){c[x>>2]=e;c[w>>2]=e;c[w+8>>2]=e+d;while(1){a[e>>0]=0;e=(c[x>>2]|0)+1|0;c[x>>2]=e;d=d+-1|0;if(!d)break a}}e=Na()|0;d=c[w>>2]|0;if(!d)Ya(e|0);if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);Ya(e|0)}}while(0);c[t>>2]=0;v=t+4|0;c[v>>2]=0;c[t+8>>2]=0;do{if(!p)q=19;else{if(!(p>>>0>1073741823?(o=0,ha(178,t|0),n=o,o=0,n&1):0))q=17;if((q|0)==17?(f=p<<2,o=0,g=ka(67,f|0)|0,n=o,o=0,!(n&1)):0){c[t>>2]=g;q=g+(p<<2)|0;c[t+8>>2]=q;iw(g|0,0,f|0)|0;c[v>>2]=q;q=19;break}e=Na()|0;d=c[t>>2]|0;f=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}}while(0);if((q|0)==19){j=b+12|0;b:do{if((c[j>>2]|0)>0){k=b+4604|0;l=($(p,s)|0)+1|0;m=b+4608|0;n=b+92|0;h=b+4600|0;if((p|0)>0)g=0;else{f=0;while(1){e=c[w>>2]|0;d=e+1|0;c[k>>2]=d;e=e+l|0;c[m>>2]=e;if(!(f&1))d=e;else{c[k>>2]=e;c[m>>2]=d}p=c[n>>2]|0;o=0;Aa(c[(c[p>>2]|0)+12>>2]|0,p|0,d|0,c[r>>2]|0,s|0);p=o;o=0;if(p&1)break;f=f+1|0;if((f|0)>=(c[j>>2]|0)){q=45;break b}}e=Na()|0;break}c:while(1){e=c[w>>2]|0;d=e+1|0;c[k>>2]=d;e=e+l|0;c[m>>2]=e;if(!(g&1))d=e;else{c[k>>2]=e;c[m>>2]=d}q=c[n>>2]|0;o=0;Aa(c[(c[q>>2]|0)+12>>2]|0,q|0,d|0,c[r>>2]|0,s|0);q=o;o=0;if(q&1){q=28;break}d=c[t>>2]|0;e=c[k>>2]|0;f=0;do{c[h>>2]=c[d+(f<<2)>>2];q=c[r>>2]|0;a[e+q>>0]=a[e+(q+-1)>>0]|0;a[(c[m>>2]|0)+-1>>0]=a[c[k>>2]>>0]|0;o=0;ia(75,b|0,0);q=o;o=0;if(q&1){q=36;break c}d=c[t>>2]|0;c[d+(f<<2)>>2]=c[h>>2];e=(c[k>>2]|0)+s|0;c[k>>2]=e;c[m>>2]=(c[m>>2]|0)+s;f=f+1|0}while((f|0)<(p|0));g=g+1|0;if((g|0)>=(c[j>>2]|0)){q=45;break b}}if((q|0)==28){e=Na()|0;break}else if((q|0)==36){e=Na()|0;break}}else q=45}while(0);do{if((q|0)==45){o=0;ha(182,b|0);b=o;o=0;if(b&1){e=Na()|0;break}d=c[t>>2]|0;e=d;if(d){f=c[v>>2]|0;if((f|0)!=(d|0))c[v>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[w>>2]|0;if(!d){i=u;return}if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);i=u;return}}while(0);d=c[t>>2]|0;f=d;if(d){g=c[v>>2]|0;if((g|0)!=(d|0))c[v>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}d=c[w>>2]|0;if(!d)Ya(e|0);if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);Ya(e|0)}function qg(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;o=b+4604|0;e=c[o>>2]|0;r=b+180|0;if((c[r>>2]|0)<=0)return;p=b+4608|0;q=b+4612|0;h=e;i=d[e+-1>>0]|0;e=d[e>>0]|0;n=0;while(1){m=c[p>>2]|0;l=d[m+(n+-1)>>0]|0;g=n+1|0;f=d[h+g>>0]|0;k=c[q>>2]|0;j=e-i|0;h=i-l|0;k=((((a[k+(f-e)>>0]|0)*9|0)+(a[k+j>>0]|0)|0)*9|0)+(a[k+h>>0]|0)|0;if(!k){g=(sg(b,n,0)|0)+n|0;f=c[o>>2]|0;e=d[f+(g+-1)>>0]|0;f=d[f+g>>0]|0}else{i=e-l>>31;if((i^h|0)<0)h=e;else h=l+((i^j|0)<0?0:j)|0;m=rg(b,k,d[m+n>>0]|0,h,0)|0;a[(c[p>>2]|0)+n>>0]=m}if((g|0)>=(c[r>>2]|0))break;h=c[o>>2]|0;i=e;e=f;n=g}return}function rg(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=d>>31;h=(r^d)-r|0;p=a+196+(h*12|0)+10|0;i=b[p>>1]|0;o=a+196+(h*12|0)|0;g=c[o>>2]|0;if((i|0)<(g|0))if((i<<1|0)<(g|0))if((i<<2|0)<(g|0))if((i<<3|0)<(g|0))if((i<<4|0)<(g|0)){d=5;while(1)if((i<>1]^r)-r+f|0;q=a+136|0;f=c[q>>2]|0;if((g&f|0)==(g|0))l=g;else l=f&~(g>>31);g=(e-l^r)-r|0;k=a+144|0;f=c[k>>2]|0;if((g|0)>0)g=(g+f|0)/(f<<1|1|0)|0;else g=(g-f|0)/(f<<1|1|0)|0;n=a+140|0;j=c[n>>2]|0;e=((g|0)<0?j:0)+g|0;j=e-((e|0)<((j+1|0)/2|0|0)?0:j)|0;h=a+196+(h*12|0)+4|0;if(!(f|d))g=(c[h>>2]<<1)+-1+i>>31;else g=0;f=g^j;vg(a,d,f>>30^f<<1,c[a+156>>2]|0);f=c[a+160>>2]|0;d=(c[o>>2]|0)+((j|0)>-1?j:0-j|0)|0;g=(c[h>>2]|0)+($(c[k>>2]<<1|1,j)|0)|0;e=b[p>>1]|0;if((e|0)==(f|0)){d=d>>1;g=g>>1;e=f>>1}c[o>>2]=d;f=e+1|0;b[p>>1]=f;d=f+g|0;if((d|0)>=1){if((g|0)>0){g=g-f|0;p=b[m>>1]|0;b[m>>1]=(p<<16>>16<127&1)+(p&65535);g=(g|0)>0?0:g}}else{g=b[m>>1]|0;b[m>>1]=(g&65535)-(g<<16>>16>-128&1);g=(d|0)>(~e|0)?d:0-e|0}c[h>>2]=g;f=c[k>>2]|0;e=f<<1|1;d=($(e,(j^r)-r|0)|0)+l|0;if((d|0)>=(0-f|0)){g=c[q>>2]|0;if((g+f|0)<(d|0))d=d-($(c[n>>2]|0,e)|0)|0}else{d=($(c[n>>2]|0,e)|0)+d|0;g=c[q>>2]|0}if((d&g|0)==(d|0)){r=d;r=r&255;return r|0}r=g&~(d>>31);r=r&255;return r|0}function sg(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;l=(c[b+180>>2]|0)-e|0;m=c[b+4608>>2]|0;n=c[b+4604>>2]|0;h=a[m+(e+-1)>>0]|0;k=h&255;f=b+144|0;i=0;while(1){g=m+(i+e)|0;j=(d[g>>0]|0)-k|0;if((((j|0)>-1?j:0-j|0)|0)>(c[f>>2]|0))break;a[g>>0]=h;i=i+1|0;if((i|0)==(l|0)){i=l;break}}h=(i|0)==(l|0);j=b+4600|0;g=c[36476+(c[j>>2]<<2)>>2]|0;if((1<(i|0))f=i;else{f=i;do{ae(b,1,1);g=c[j>>2]|0;f=f-(1<>2])|0;g=(g|0)>30?31:g+1|0;c[j>>2]=g;g=c[36476+(g<<2)>>2]|0}while((f|0)>=(1<>0]=tg(b,d[e>>0]|0,k,d[n+l>>0]|0)|0;b=c[j>>2]|0;c[j>>2]=(b|0)<1?0:b+-1|0;b=i+1|0;return b|0}if(!f){b=l;return b|0}ae(b,1,1);b=l;return b|0}function tg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;i=d-e|0;j=a+136|0;h=a+144|0;f=c[h>>2]|0;if((((i|0)>-1?i:0-i|0)|0)>(f|0)){g=e-d>>31|1;b=$(g,b-e|0)|0;if((b|0)>0)b=(f+b|0)/(f<<1|1|0)|0;else b=(b-f|0)/(f<<1|1|0)|0;i=a+140|0;f=c[i>>2]|0;d=((b|0)<0?f:0)+b|0;f=d-((d|0)<((f+1|0)/2|0|0)?0:f)|0;ug(a,a+4576|0,f);f=$(f,g)|0;g=c[h>>2]|0;h=g<<1|1;f=($(f,h)|0)+e|0;if((f|0)>=(0-g|0)){b=c[j>>2]|0;if((b+g|0)<(f|0))f=f-($(c[i>>2]|0,h)|0)|0}else{f=($(c[i>>2]|0,h)|0)+f|0;b=c[j>>2]|0}if((f&b|0)==(f|0)){j=f;j=j&255;return j|0}j=b&~(f>>31);j=j&255;return j|0}else{b=b-d|0;if((b|0)>0)b=(f+b|0)/(f<<1|1|0)|0;else b=(b-f|0)/(f<<1|1|0)|0;i=a+140|0;f=c[i>>2]|0;g=((b|0)<0?f:0)+b|0;f=g-((g|0)<((f+1|0)/2|0|0)?0:f)|0;ug(a,a+4588|0,f);g=c[h>>2]|0;h=g<<1|1;f=($(h,f)|0)+d|0;if((f|0)>=(0-g|0)){b=c[j>>2]|0;if((b+g|0)<(f|0))f=f-($(c[i>>2]|0,h)|0)|0}else{f=($(c[i>>2]|0,h)|0)+f|0;b=c[j>>2]|0}if((f&b|0)==(f|0)){j=f;j=j&255;return j|0}j=b&~(f>>31);j=j&255;return j|0}return 0}function ug(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=e+9|0;j=d[n>>0]|0;m=e+4|0;l=c[m>>2]|0;h=($(j>>>1,l)|0)+(c[e>>2]|0)|0;if((j|0)<(h|0)){i=j;g=0;do{i=i<<1;g=g+1|0}while((i|0)<(h|0));h=g}else h=0;if((f|0)>0&(h|0)==0?d[e+10>>0]<<1>>>0>>0:0)g=1;else k=5;do{if((k|0)==5){g=(f|0)<0;if(g?d[e+10>>0]<<1>>>0>=j>>>0:0){g=1;break}g=g&(h|0)!=0}}while(0);g=(((f|0)>-1?f:0-f|0)<<1)-l+(g<<31>>31)|0;vg(b,h,g,(c[b+156>>2]|0)+-1-(c[36476+(c[b+4600>>2]<<2)>>2]|0)|0);if((f|0)<0){b=e+10|0;a[b>>0]=(d[b>>0]|0)+1}g=(g+1-(c[m>>2]|0)>>1)+(c[e>>2]|0)|0;c[e>>2]=g;h=a[n>>0]|0;if(h<<24>>24!=(a[e+8>>0]|0)){e=h;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}c[e>>2]=g>>1;b=(h&255)>>>1;a[n>>0]=b;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=b;e=e&255;e=e+1|0;e=e&255;a[n>>0]=e;return}function vg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=d>>b;g=a+148|0;h=e-(c[g>>2]|0)|0;if((f|0)<(h+-1|0)){if((f|0)>30){e=(f|0)/2|0;ae(a,0,e);f=f-e|0}ae(a,1,f+1|0);ae(a,(1<31){ae(a,0,31);ae(a,1,e+-31-(c[g>>2]|0)|0)}else ae(a,1,h);b=c[g>>2]|0;ae(a,(1<>2]|0)){e=c[b+136>>2]|0;d=b+152|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+184>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+188>>2]|0):0)?(c[f+12>>2]|0)==(c[b+192>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4612>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4612>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4612>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4612>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+152|0}while(0);n=1<>2];e=b+4616|0;f=n<<1;g=b+4620|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4612|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+192|0;l=b+188|0;j=b+184|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function xg(a){a=a|0;var b=0,d=0;c[a>>2]=35856;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function yg(a){a=a|0;var b=0,d=0;c[a>>2]=35856;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function zg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function Ag(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+128>>2]|0,c[d+136>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+176>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+180>>2]=j;c[d+184>>2]=h;Lg(d);h=d+132|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+188+(j*12|0)>>2]=e;c[d+188+(j*12|0)+4>>2]=0;b[d+188+(j*12|0)+8>>1]=0;b[d+188+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4568>>2]=l;c[d+4572>>2]=0;a[d+4576>>0]=m;a[d+4577>>0]=1;a[d+4578>>0]=0;c[d+4580>>2]=l;c[d+4584>>2]=1;a[d+4588>>0]=m;a[d+4589>>0]=1;a[d+4590>>0]=0;c[d+4592>>2]=0;i=k;return}function Bg(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4620>>0]=g&1;d=b+156|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);Cg(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function Cg(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;w=a+172|0;x=(c[w>>2]|0)+4|0;if((c[a+28>>2]|0)==1)y=c[a+20>>2]|0;else y=1;d=$(y<<1,x)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;do{if(d){if(!((d|0)<0?(o=0,ha(178,C|0),B=o,o=0,B&1):0))j=6;if((j|0)==6?(e=d<<1,o=0,f=ka(67,e|0)|0,B=o,o=0,!(B&1)):0){c[C>>2]=f;B=f+(d<<1)|0;c[C+8>>2]=B;iw(f|0,0,e|0)|0;c[D>>2]=B;break}f=Na()|0;d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!y)j=18;else{if(!(y>>>0>1073741823?(o=0,ha(178,z|0),v=o,o=0,v&1):0))j=16;if((j|0)==16?(g=y<<2,o=0,h=ka(67,g|0)|0,v=o,o=0,!(v&1)):0){c[z>>2]=h;j=h+(y<<2)|0;c[z+8>>2]=j;iw(h|0,0,g|0)|0;c[B>>2]=j;j=18;break}f=Na()|0;d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==18){h=a+8|0;a:do{if((c[h>>2]|0)>0){j=a+4596|0;k=$(y,x)|0;l=k+1|0;m=a+4600|0;n=(y|0)>0;p=a+160|0;q=a+168|0;r=a+164|0;s=a+156|0;t=a+88|0;u=a+4592|0;v=0;b:while(1){f=c[C>>2]|0;e=f+2|0;c[j>>2]=e;f=f+(l<<1)|0;c[m>>2]=f;if(!(v&1))d=f;else{c[j>>2]=f;c[m>>2]=e;d=e;e=f}if(n){g=c[z>>2]|0;f=0;do{c[u>>2]=c[g+(f<<2)>>2];g=c[w>>2]|0;b[e+(g<<1)>>1]=b[e+(g+-1<<1)>>1]|0;b[d+-2>>1]=b[e>>1]|0;o=0;ia(76,a|0,0);g=o;o=0;if(g&1){j=29;break b}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[u>>2];e=(c[j>>2]|0)+(x<<1)|0;c[j>>2]=e;d=(c[m>>2]|0)+(x<<1)|0;c[m>>2]=d;f=f+1|0}while((f|0)<(y|0))}g=c[p>>2]|0;if(((g|0)<=(v|0)?(v|0)<((c[q>>2]|0)+g|0):0)?(g=c[t>>2]|0,o=0,Aa(c[(c[g>>2]|0)+8>>2]|0,g|0,d+((c[s>>2]|0)-k<<1)|0,c[r>>2]|0,x|0),g=o,o=0,g&1):0){j=30;break}v=v+1|0;if((v|0)>=(c[h>>2]|0)){j=42;break a}}if((j|0)==29){f=Na()|0;break}else if((j|0)==30){f=Na()|0;break}}else j=42}while(0);do{if((j|0)==42){o=0;ha(183,a|0);a=o;o=0;if(a&1){f=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);i=A;return}}while(0);d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}function Dg(d,f){d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;q=d+4596|0;g=c[q>>2]|0;u=d+172|0;f=c[u>>2]|0;if((f|0)<=0)return;r=d+4600|0;s=d+4604|0;t=d+4592|0;l=g;j=e[g+-2>>1]|0;g=e[g>>1]|0;p=0;while(1){n=c[r>>2]|0;k=b[n+(p+-1<<1)>>1]|0;o=k&65535;i=p+1|0;h=e[l+(i<<1)>>1]|0;m=c[s>>2]|0;l=g-j|0;j=j-o|0;m=((((a[m+(h-g)>>0]|0)*9|0)+(a[m+l>>0]|0)|0)*9|0)+(a[m+j>>0]|0)|0;n=n+(p<<1)|0;if(!m){f=Gg(d,k,n,f-p|0)|0;g=f+p|0;if((g|0)!=(c[u>>2]|0)){o=Hg(d,o,e[(c[q>>2]|0)+(g<<1)>>1]|0)|0;b[(c[r>>2]|0)+(g<<1)>>1]=o;o=c[t>>2]|0;c[t>>2]=(o|0)<1?0:o+-1|0;f=f+1|0}i=f+p|0;h=c[q>>2]|0;g=e[h+(i+-1<<1)>>1]|0;h=e[h+(i<<1)>>1]|0}else{f=g-o>>31;if((f^j|0)<0)f=g;else f=o+((f^l|0)<0?0:l)|0;o=Fg(d,m,e[n>>1]|0,f,0)|0;b[(c[r>>2]|0)+(p<<1)>>1]=o}f=c[u>>2]|0;if((f|0)<=(i|0))break;l=c[q>>2]|0;j=g;g=h;p=i}return}function Eg(b){b=b|0;var d=0,e=0,f=0,g=0;f=b+116|0;e=c[f>>2]|0;if((a[e>>0]|0)!=-1){g=b+112|0;d=c[g>>2]|0;if((d|0)<1){ge(b);d=c[g>>2]|0;e=c[f>>2]|0}b=b+108|0;f=c[b>>2]|0;c[g>>2]=d+-1;d=f<<1;c[b>>2]=d;if((a[e>>0]|0)!=-1){d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,6,35648);b=o;o=0;if(!(b&1))lb(d|0,824,96);b=Na()|0;La(d|0);Ya(b|0)}}else d=c[b+108>>2]|0;if(!d)return;d=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,d|0,6,35648);b=o;o=0;if(!(b&1))lb(d|0,824,96);b=Na()|0;La(d|0);Ya(b|0)}function Fg(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;t=e>>31;l=(t^e)-t|0;r=d+188+(l*12|0)+10|0;f=b[r>>1]|0;q=d+188+(l*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){e=5;while(1)if((f<>1]^t)-t+g|0;s=d+128|0;h=c[s>>2]|0;if((f&h|0)==(f|0))m=f;else m=h&~(f>>31);f=d+112|0;if((c[f>>2]|0)<8)ge(d);h=d+108|0;g=c[h>>2]|0;i=g>>>24;j=c[2832+(e<<11)+(i<<3)+4>>2]|0;if(!j){k=c[d+148>>2]|0;h=c[d+140>>2]|0;f=Jg(d)|0;if((f|0)<(k+-1-h|0)){if(e)f=(Kg(d,e)|0)+(f<>31^f>>1;if((((f|0)>-1?f:0-f|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);d=o;o=0;if(d&1){d=Na()|0;La(f|0);Ya(d|0)}else lb(f|0,824,96)}}else{c[f>>2]=(c[f>>2]|0)-j;c[h>>2]=g<>2]|0}k=d+136|0;g=c[k>>2]|0;if(!e){if(!g)h=(c[d+188+(l*12|0)+4>>2]<<1)+-1+(b[r>>1]|0)>>31;else h=0;j=h^f}else j=f;e=c[d+152>>2]|0;h=(c[q>>2]|0)+((j|0)>-1?j:0-j|0)|0;i=d+188+(l*12|0)+4|0;f=(c[i>>2]|0)+($(g<<1|1,j)|0)|0;g=b[r>>1]|0;if((g|0)==(e|0)){h=h>>1;f=f>>1;g=e>>1}c[q>>2]=h;e=g+1|0;b[r>>1]=e;h=e+f|0;if((h|0)>=1){if((f|0)>0){f=f-e|0;r=b[p>>1]|0;b[p>>1]=(r<<16>>16<127&1)+(r&65535);f=(f|0)>0?0:f}}else{f=b[p>>1]|0;b[p>>1]=(f&65535)-(f<<16>>16>-128&1);f=(h|0)>(~g|0)?h:0-g|0}c[i>>2]=f;e=c[k>>2]|0;g=e<<1|1;h=($(g,(j^t)-t|0)|0)+m|0;if((h|0)>=(0-e|0)){f=c[s>>2]|0;if((f+e|0)<(h|0))h=h-($(c[d+132>>2]|0,g)|0)|0}else{h=($(c[d+132>>2]|0,g)|0)+h|0;f=c[s>>2]|0}if((h&f|0)==(h|0)){d=h;d=d&65535;return d|0}d=f&~(h>>31);d=d&65535;return d|0}function Gg(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0;k=d+112|0;l=d+108|0;m=d+4592|0;h=c[k>>2]|0;i=0;while(1){if((h|0)<1){ge(d);h=c[k>>2]|0}j=c[l>>2]|0;h=h+-1|0;c[k>>2]=h;c[l>>2]=j<<1;if((j|0)>=0){p=8;break}j=c[m>>2]|0;q=1<>2];r=g-i|0;r=(q|0)<(r|0)?q:r;i=r+i|0;if((r|0)==(q|0))c[m>>2]=(j|0)>30?31:j+1|0;if((i|0)==(g|0)){h=g;break}}if((p|0)==8)if((i|0)!=(g|0)){h=c[m>>2]|0;if((h+-4|0)>>>0<28)h=Kg(d,c[36476+(h<<2)>>2]|0)|0;else h=0;h=h+i|0;if((h|0)>(g|0)){h=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,h|0,5,35648);r=o;o=0;if(r&1){r=Na()|0;La(h|0);Ya(r|0)}else lb(h|0,824,96)}}else h=g;if((h|0)>0)i=0;else return h|0;do{b[f+(i<<1)>>1]=e;i=i+1|0}while((i|0)!=(h|0));return h|0}function Hg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;g=b-d|0;h=a+128|0;e=a+136|0;if((((g|0)>-1?g:0-g|0)|0)>(c[e>>2]|0)){b=$(Ig(a,a+4568|0)|0,d-b>>31|1)|0;f=c[e>>2]|0;g=f<<1|1;b=($(b,g)|0)+d|0;if((b|0)>=(0-f|0)){e=c[h>>2]|0;if((e+f|0)<(b|0))b=b-($(c[a+132>>2]|0,g)|0)|0}else{b=($(c[a+132>>2]|0,g)|0)+b|0;e=c[h>>2]|0}if((b&e|0)==(b|0)){a=b;a=a&65535;return a|0}a=e&~(b>>31);a=a&65535;return a|0}else{d=Ig(a,a+4580|0)|0;g=c[e>>2]|0;f=g<<1|1;b=($(f,d)|0)+b|0;if((b|0)>=(0-g|0)){e=c[h>>2]|0;if((e+g|0)<(b|0))b=b-($(c[a+132>>2]|0,f)|0)|0}else{b=($(c[a+132>>2]|0,f)|0)+b|0;e=c[h>>2]|0}if((b&e|0)==(b|0)){a=b;a=a&65535;return a|0}a=e&~(b>>31);a=a&65535;return a|0}return 0}function Ig(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;m=e+9|0;f=d[m>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;j=c[b+148>>2]|0;k=c[36476+(c[b+4592>>2]<<2)>>2]|0;f=c[b+140>>2]|0;h=Jg(b)|0;do{if((h|0)<(j+-2-k-f|0))if(!g){g=c[i>>2]|0;b=g+h|0;f=b&1;b=(f+b|0)/2|0;l=8;break}else{k=(Kg(b,g)|0)+(h<>2]|0;h=k+g|0;j=h&1;f=j;i=1;h=(j+h|0)/2|0;break}else{h=(Kg(b,f)|0)+1|0;j=c[i>>2]|0;b=h+j|0;f=b&1;b=(f+b|0)/2|0;if(!g){g=j;l=8}else{k=h;i=1;h=b;g=j}}}while(0);if((l|0)==8){k=h;i=d[e+10>>0]<<1>>>0>=(d[m>>0]|0)>>>0;h=b}h=(f|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(k+1-g>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[m>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){e=g;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[m>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=l;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}function Jg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;g=a+112|0;if((c[g>>2]|0)<16)ge(a);h=a+108|0;d=c[h>>2]|0;if((d|0)>=0)if(!(d&1073741824))if(!(d&536870912))if(!(d&268435456))if(!(d&134217728))if(!(d&67108864))if(!(d&33554432))if(!(d&16777216))if(!(d&8388608))if(!(d&4194304))if(!(d&2097152))if(!(d&1048576))if(!(d&524288))if(!(d&262144))if(!(d&131072)){f=d>>>12&16;b=f+-1|0;if(!f){b=(c[g>>2]|0)+-15|0;c[g>>2]=b;e=d<<15;c[h>>2]=e;d=b;b=15;while(1){if((d|0)<1){ge(a);f=c[h>>2]|0;d=c[g>>2]|0}else f=e;d=d+-1|0;c[g>>2]=d;e=f<<1;c[h>>2]=e;if((f|0)<0)break;else b=b+1|0}return b|0}}else b=14;else b=13;else b=12;else b=11;else b=10;else b=9;else b=8;else b=7;else b=6;else b=5;else b=4;else b=3;else b=2;else b=1;else b=0;a=b+1|0;c[g>>2]=(c[g>>2]|0)-a;c[h>>2]=d<>2]|0;if((e|0)<(d|0)){ge(b);e=c[f>>2]|0;if((e|0)<(d|0)){e=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,e|0,5,35648);b=o;o=0;if(b&1){b=Na()|0;La(e|0);Ya(b|0)}else lb(e|0,824,96)}}g=b+108|0;b=c[g>>2]|0;c[f>>2]=e-d;c[g>>2]=b<>>(32-d|0)|0}function Lg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;f=p;o=b+136|0;a:do{if(!(c[o>>2]|0)){e=c[b+128>>2]|0;d=b+144|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+176>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+180>>2]|0):0)?(c[f+12>>2]|0)==(c[b+184>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4604>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4604>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4604>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4604>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+144|0}while(0);n=1<>2];e=b+4608|0;f=n<<1;g=b+4612|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4604|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+184|0;l=b+180|0;j=b+176|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function Mg(a){a=a|0;var b=0,d=0;c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function Ng(a){a=a|0;var b=0,d=0;c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function Og(a){a=a|0;var b=0,d=0;c[a>>2]=35828;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function Pg(a){a=a|0;var b=0,d=0;c[a>>2]=35828;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function Qg(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=6;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=6;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function Rg(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+128>>2]|0,c[d+136>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+176>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+180>>2]=j;c[d+184>>2]=h;Zg(d);h=d+132|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+188+(j*12|0)>>2]=e;c[d+188+(j*12|0)+4>>2]=0;b[d+188+(j*12|0)+8>>1]=0;b[d+188+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4568>>2]=l;c[d+4572>>2]=0;a[d+4576>>0]=m;a[d+4577>>0]=1;a[d+4578>>0]=0;c[d+4580>>2]=l;c[d+4584>>2]=1;a[d+4588>>0]=m;a[d+4589>>0]=1;a[d+4590>>0]=0;c[d+4592>>2]=0;i=k;return}function Sg(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4620>>0]=g&1;d=b+156|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);Tg(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function Tg(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;w=a+172|0;x=(c[w>>2]|0)+4|0;if((c[a+28>>2]|0)==1)y=c[a+20>>2]|0;else y=1;d=$(y<<1,x)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;do{if(d){if(!(d>>>0>715827882?(o=0,ha(178,C|0),B=o,o=0,B&1):0))j=6;if((j|0)==6?(o=0,e=ka(67,d*6|0)|0,B=o,o=0,!(B&1)):0){c[D>>2]=e;c[C>>2]=e;f=e+(d*6|0)|0;c[C+8>>2]=f;while(1){b[e>>1]=0;b[e+2>>1]=0;b[e+4>>1]=0;d=d+-1|0;if(!d)break;else e=e+6|0}c[D>>2]=f;break}f=Na()|0;d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-6-d|0)>>>0)/6|0)*6|0);cj(d);Ya(f|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!y)j=20;else{if(!(y>>>0>1073741823?(o=0,ha(178,z|0),v=o,o=0,v&1):0))j=18;if((j|0)==18?(g=y<<2,o=0,h=ka(67,g|0)|0,v=o,o=0,!(v&1)):0){c[z>>2]=h;j=h+(y<<2)|0;c[z+8>>2]=j;iw(h|0,0,g|0)|0;c[B>>2]=j;j=20;break}f=Na()|0;d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==20){h=a+8|0;a:do{if((c[h>>2]|0)>0){j=a+4596|0;k=$(y,x)|0;l=k+1|0;m=a+4600|0;n=(y|0)>0;p=a+160|0;q=a+168|0;r=a+164|0;s=a+156|0;t=a+88|0;u=a+4592|0;v=0;b:while(1){f=c[C>>2]|0;e=f+6|0;c[j>>2]=e;f=f+(l*6|0)|0;c[m>>2]=f;if(!(v&1))d=f;else{c[j>>2]=f;c[m>>2]=e;d=e;e=f}if(n){g=c[z>>2]|0;f=0;do{c[u>>2]=c[g+(f<<2)>>2];d=c[w>>2]|0;g=e+(d*6|0)|0;e=e+((d+-1|0)*6|0)|0;b[g>>1]=b[e>>1]|0;b[g+2>>1]=b[e+2>>1]|0;b[g+4>>1]=b[e+4>>1]|0;g=(c[m>>2]|0)+-6|0;e=c[j>>2]|0;b[g>>1]=b[e>>1]|0;b[g+2>>1]=b[e+2>>1]|0;b[g+4>>1]=b[e+4>>1]|0;o=0;ia(77,a|0,0);g=o;o=0;if(g&1){j=31;break b}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[u>>2];e=(c[j>>2]|0)+(x*6|0)|0;c[j>>2]=e;d=(c[m>>2]|0)+(x*6|0)|0;c[m>>2]=d;f=f+1|0}while((f|0)<(y|0))}g=c[p>>2]|0;if(((g|0)<=(v|0)?(v|0)<((c[q>>2]|0)+g|0):0)?(g=c[t>>2]|0,o=0,Aa(c[(c[g>>2]|0)+8>>2]|0,g|0,d+(((c[s>>2]|0)-k|0)*6|0)|0,c[r>>2]|0,x|0),g=o,o=0,g&1):0){j=32;break}v=v+1|0;if((v|0)>=(c[h>>2]|0)){j=44;break a}}if((j|0)==31){f=Na()|0;break}else if((j|0)==32){f=Na()|0;break}}else j=44}while(0);do{if((j|0)==44){o=0;ha(183,a|0);a=o;o=0;if(a&1){f=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-6-d|0)>>>0)/6|0)*6|0);cj(d);i=A;return}}while(0);d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-6-d|0)>>>0)/6|0)*6|0);cj(d);Ya(f|0)}function Ug(d,f){d=d|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;N=i;i=i+32|0;D=N+24|0;M=N+18|0;L=N+12|0;E=N+6|0;F=N;G=d+172|0;f=c[G>>2]|0;if((f|0)<=0){i=N;return}H=d+4600|0;I=d+4596|0;J=d+4604|0;K=d+4592|0;C=0;while(1){h=C+-1|0;j=c[H>>2]|0;O=c[I>>2]|0;g=C+1|0;k=e[O+(C*6|0)>>1]|0;B=c[J>>2]|0;l=e[O+(h*6|0)>>1]|0;m=k-l|0;n=e[j+(h*6|0)>>1]|0;o=l-n|0;p=((((a[B+((e[O+(g*6|0)>>1]|0)-k)>>0]|0)*9|0)+(a[B+m>>0]|0)|0)*9|0)+(a[B+o>>0]|0)|0;q=e[O+(C*6|0)+2>>1]|0;r=e[O+(h*6|0)+2>>1]|0;s=q-r|0;t=e[j+(h*6|0)+2>>1]|0;u=r-t|0;v=((((a[B+((e[O+(g*6|0)+2>>1]|0)-q)>>0]|0)*9|0)+(a[B+s>>0]|0)|0)*9|0)+(a[B+u>>0]|0)|0;w=e[O+(C*6|0)+4>>1]|0;x=e[O+(h*6|0)+4>>1]|0;y=w-x|0;z=e[j+(h*6|0)+4>>1]|0;A=x-z|0;B=((((a[B+((e[O+(g*6|0)+4>>1]|0)-w)>>0]|0)*9|0)+(a[B+y>>0]|0)|0)*9|0)+(a[B+A>>0]|0)|0;if(!(v|p|B)){g=j+(h*6|0)|0;b[L>>1]=b[g>>1]|0;b[L+2>>1]=b[g+2>>1]|0;b[L+4>>1]=b[g+4>>1]|0;b[D>>1]=b[g>>1]|0;b[D+2>>1]=b[g+2>>1]|0;b[D+4>>1]=b[g+4>>1]|0;f=Vg(d,D,j+(C*6|0)|0,f-C|0)|0;g=f+C|0;if((g|0)!=(c[G>>2]|0)){O=(c[I>>2]|0)+(g*6|0)|0;b[F>>1]=b[O>>1]|0;b[F+2>>1]=b[O+2>>1]|0;b[F+4>>1]=b[O+4>>1]|0;O=(c[H>>2]|0)+(g*6|0)|0;b[M>>1]=b[L>>1]|0;b[M+2>>1]=b[L+2>>1]|0;b[M+4>>1]=b[L+4>>1]|0;b[D>>1]=b[F>>1]|0;b[D+2>>1]=b[F+2>>1]|0;b[D+4>>1]=b[F+4>>1]|0;Wg(E,d,M,D);b[O>>1]=b[E>>1]|0;b[O+2>>1]=b[E+2>>1]|0;b[O+4>>1]=b[E+4>>1]|0;O=c[K>>2]|0;c[K>>2]=(O|0)<1?0:O+-1|0;f=f+1|0}g=f+C|0}else{h=e[j+(C*6|0)>>1]|0;f=k-n>>31;if((f^o|0)>=0)if((f^m|0)<0)f=n;else f=n-l+k|0;else f=k;k=Xg(d,p,h,f,0)|0;h=e[(c[H>>2]|0)+(C*6|0)+2>>1]|0;f=q-t>>31;if((f^u|0)>=0)if((f^s|0)<0)f=t;else f=t-r+q|0;else f=q;h=Xg(d,v,h,f,0)|0;j=e[(c[H>>2]|0)+(C*6|0)+4>>1]|0;f=w-z>>31;if((f^A|0)>=0)if((f^y|0)<0)f=z;else f=z-x+w|0;else f=w;B=Xg(d,B,j,f,0)|0;O=c[H>>2]|0;b[O+(C*6|0)>>1]=k;b[O+(C*6|0)+2>>1]=h;b[O+(C*6|0)+4>>1]=B}f=c[G>>2]|0;if((g|0)>=(f|0))break;else C=g}i=N;return}function Vg(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0;k=d+112|0;l=d+108|0;m=d+4592|0;h=c[k>>2]|0;i=0;while(1){if((h|0)<1){ge(d);h=c[k>>2]|0}j=c[l>>2]|0;h=h+-1|0;c[k>>2]=h;c[l>>2]=j<<1;if((j|0)>=0){p=8;break}j=c[m>>2]|0;q=1<>2];r=g-i|0;r=(q|0)<(r|0)?q:r;i=r+i|0;if((r|0)==(q|0))c[m>>2]=(j|0)>30?31:j+1|0;if((i|0)==(g|0)){h=g;break}}if((p|0)==8)if((i|0)!=(g|0)){h=c[m>>2]|0;if((h+-4|0)>>>0<28)h=Kg(d,c[36476+(h<<2)>>2]|0)|0;else h=0;h=h+i|0;if((h|0)>(g|0)){h=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,h|0,5,35648);r=o;o=0;if(r&1){r=Na()|0;La(h|0);Ya(r|0)}else lb(h|0,824,96)}}else h=g;if((h|0)<=0)return h|0;i=0;do{r=f+(i*6|0)|0;b[r>>1]=b[e>>1]|0;b[r+2>>1]=b[e+2>>1]|0;b[r+4>>1]=b[e+4>>1]|0;i=i+1|0}while((i|0)!=(h|0));return h|0}function Wg(a,d,f,g){a=a|0;d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;l=d+4568|0;o=Yg(d,l)|0;j=Yg(d,l)|0;l=Yg(d,l)|0;i=d+128|0;h=e[g>>1]|0;m=c[d+136>>2]|0;n=m<<1|1;h=($($(n,o)|0,h-(e[f>>1]|0)>>31|1)|0)+h|0;o=0-m|0;if((h|0)>=(o|0)){i=c[i>>2]|0;if((i+m|0)<(h|0))h=h-($(c[d+132>>2]|0,n)|0)|0}else{h=($(c[d+132>>2]|0,n)|0)+h|0;i=c[i>>2]|0}if((h&i|0)!=(h|0))h=i&~(h>>31);k=h&65535;h=e[g+2>>1]|0;h=($($(n,j)|0,h-(e[f+2>>1]|0)>>31|1)|0)+h|0;if((h|0)>=(o|0)){if((i+m|0)<(h|0))h=h-($(c[d+132>>2]|0,n)|0)|0}else h=($(c[d+132>>2]|0,n)|0)+h|0;if((h&i|0)!=(h|0))h=i&~(h>>31);j=h&65535;h=e[g+4>>1]|0;h=($($(n,l)|0,h-(e[f+4>>1]|0)>>31|1)|0)+h|0;if((h|0)>=(o|0)){if((i+m|0)<(h|0))h=h-($(c[d+132>>2]|0,n)|0)|0}else h=($(c[d+132>>2]|0,n)|0)+h|0;if((h&i|0)==(h|0)){d=h;d=d&65535;b[a>>1]=k;o=a+2|0;b[o>>1]=j;a=a+4|0;b[a>>1]=d;return}d=i&~(h>>31);d=d&65535;b[a>>1]=k;o=a+2|0;b[o>>1]=j;a=a+4|0;b[a>>1]=d;return}function Xg(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;t=e>>31;l=(t^e)-t|0;r=d+188+(l*12|0)+10|0;f=b[r>>1]|0;q=d+188+(l*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){e=5;while(1)if((f<>1]^t)-t+g|0;s=d+128|0;h=c[s>>2]|0;if((f&h|0)==(f|0))m=f;else m=h&~(f>>31);f=d+112|0;if((c[f>>2]|0)<8)ge(d);h=d+108|0;g=c[h>>2]|0;i=g>>>24;j=c[2832+(e<<11)+(i<<3)+4>>2]|0;if(!j){k=c[d+148>>2]|0;h=c[d+140>>2]|0;f=Jg(d)|0;if((f|0)<(k+-1-h|0)){if(e)f=(Kg(d,e)|0)+(f<>31^f>>1;if((((f|0)>-1?f:0-f|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);d=o;o=0;if(d&1){d=Na()|0;La(f|0);Ya(d|0)}else lb(f|0,824,96)}}else{c[f>>2]=(c[f>>2]|0)-j;c[h>>2]=g<>2]|0}k=d+136|0;g=c[k>>2]|0;if(!e){if(!g)h=(c[d+188+(l*12|0)+4>>2]<<1)+-1+(b[r>>1]|0)>>31;else h=0;j=h^f}else j=f;e=c[d+152>>2]|0;h=(c[q>>2]|0)+((j|0)>-1?j:0-j|0)|0;i=d+188+(l*12|0)+4|0;f=(c[i>>2]|0)+($(g<<1|1,j)|0)|0;g=b[r>>1]|0;if((g|0)==(e|0)){h=h>>1;f=f>>1;g=e>>1}c[q>>2]=h;e=g+1|0;b[r>>1]=e;h=e+f|0;if((h|0)>=1){if((f|0)>0){f=f-e|0;r=b[p>>1]|0;b[p>>1]=(r<<16>>16<127&1)+(r&65535);f=(f|0)>0?0:f}}else{f=b[p>>1]|0;b[p>>1]=(f&65535)-(f<<16>>16>-128&1);f=(h|0)>(~g|0)?h:0-g|0}c[i>>2]=f;e=c[k>>2]|0;g=e<<1|1;h=($(g,(j^t)-t|0)|0)+m|0;if((h|0)>=(0-e|0)){f=c[s>>2]|0;if((f+e|0)<(h|0))h=h-($(c[d+132>>2]|0,g)|0)|0}else{h=($(c[d+132>>2]|0,g)|0)+h|0;f=c[s>>2]|0}if((h&f|0)==(h|0)){d=h;d=d&65535;return d|0}d=f&~(h>>31);d=d&65535;return d|0}function Yg(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;m=e+9|0;f=d[m>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;j=c[b+148>>2]|0;k=c[36476+(c[b+4592>>2]<<2)>>2]|0;f=c[b+140>>2]|0;h=Jg(b)|0;do{if((h|0)<(j+-2-k-f|0))if(!g){g=c[i>>2]|0;b=g+h|0;f=b&1;b=(f+b|0)/2|0;l=8;break}else{k=(Kg(b,g)|0)+(h<>2]|0;h=k+g|0;j=h&1;f=j;i=1;h=(j+h|0)/2|0;break}else{h=(Kg(b,f)|0)+1|0;j=c[i>>2]|0;b=h+j|0;f=b&1;b=(f+b|0)/2|0;if(!g){g=j;l=8}else{k=h;i=1;h=b;g=j}}}while(0);if((l|0)==8){k=h;i=d[e+10>>0]<<1>>>0>=(d[m>>0]|0)>>>0;h=b}h=(f|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(k+1-g>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[m>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){e=g;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[m>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=l;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}function Zg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;f=p;o=b+136|0;a:do{if(!(c[o>>2]|0)){e=c[b+128>>2]|0;d=b+144|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+176>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+180>>2]|0):0)?(c[f+12>>2]|0)==(c[b+184>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4604>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4604>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4604>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4604>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+144|0}while(0);n=1<>2];e=b+4608|0;f=n<<1;g=b+4612|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4604|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+184|0;l=b+180|0;j=b+176|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function _g(a){a=a|0;var b=0,d=0;c[a>>2]=35800;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function $g(a){a=a|0;var b=0,d=0;c[a>>2]=35800;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function ah(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function bh(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+128>>2]|0,c[d+136>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+176>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+180>>2]=j;c[d+184>>2]=h;jh(d);h=d+132|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+188+(j*12|0)>>2]=e;c[d+188+(j*12|0)+4>>2]=0;b[d+188+(j*12|0)+8>>1]=0;b[d+188+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4568>>2]=l;c[d+4572>>2]=0;a[d+4576>>0]=m;a[d+4577>>0]=1;a[d+4578>>0]=0;c[d+4580>>2]=l;c[d+4584>>2]=1;a[d+4588>>0]=m;a[d+4589>>0]=1;a[d+4590>>0]=0;c[d+4592>>2]=0;i=k;return}function ch(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4620>>0]=g&1;d=b+156|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);dh(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function dh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;w=b+172|0;x=(c[w>>2]|0)+4|0;if((c[b+28>>2]|0)==1)y=c[b+20>>2]|0;else y=1;d=$(y<<1,x)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;a:do{if(d){if(!(d>>>0>1431655765?(o=0,ha(178,C|0),B=o,o=0,B&1):0))h=6;if((h|0)==6?(o=0,e=ka(67,d*3|0)|0,B=o,o=0,!(B&1)):0){c[D>>2]=e;c[C>>2]=e;c[C+8>>2]=e+(d*3|0);while(1){a[e>>0]=0;a[e+1>>0]=0;a[e+2>>0]=0;e=(c[D>>2]|0)+3|0;c[D>>2]=e;d=d+-1|0;if(!d)break a}}f=Na()|0;d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!y)h=19;else{if(!(y>>>0>1073741823?(o=0,ha(178,z|0),v=o,o=0,v&1):0))h=17;if((h|0)==17?(f=y<<2,o=0,g=ka(67,f|0)|0,v=o,o=0,!(v&1)):0){c[z>>2]=g;h=g+(y<<2)|0;c[z+8>>2]=h;iw(g|0,0,f|0)|0;c[B>>2]=h;h=19;break}f=Na()|0;d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((h|0)==19){h=b+8|0;b:do{if((c[h>>2]|0)>0){j=b+4596|0;k=$(y,x)|0;l=k+1|0;m=b+4600|0;n=(y|0)>0;p=b+160|0;q=b+168|0;r=b+164|0;s=b+156|0;t=b+88|0;u=b+4592|0;v=0;c:while(1){f=c[C>>2]|0;e=f+3|0;c[j>>2]=e;f=f+(l*3|0)|0;c[m>>2]=f;if(!(v&1))d=f;else{c[j>>2]=f;c[m>>2]=e;d=e;e=f}if(n){g=c[z>>2]|0;f=0;do{c[u>>2]=c[g+(f<<2)>>2];d=c[w>>2]|0;g=e+(d*3|0)|0;e=e+((d+-1|0)*3|0)|0;a[g>>0]=a[e>>0]|0;a[g+1>>0]=a[e+1>>0]|0;a[g+2>>0]=a[e+2>>0]|0;e=c[j>>2]|0;g=(c[m>>2]|0)+-3|0;a[g>>0]=a[e>>0]|0;a[g+1>>0]=a[e+1>>0]|0;a[g+2>>0]=a[e+2>>0]|0;o=0;ia(78,b|0,0);g=o;o=0;if(g&1){h=30;break c}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[u>>2];e=(c[j>>2]|0)+(x*3|0)|0;c[j>>2]=e;d=(c[m>>2]|0)+(x*3|0)|0;c[m>>2]=d;f=f+1|0}while((f|0)<(y|0))}g=c[p>>2]|0;if(((g|0)<=(v|0)?(v|0)<((c[q>>2]|0)+g|0):0)?(g=c[t>>2]|0,o=0,Aa(c[(c[g>>2]|0)+8>>2]|0,g|0,d+(((c[s>>2]|0)-k|0)*3|0)|0,c[r>>2]|0,x|0),g=o,o=0,g&1):0){h=31;break}v=v+1|0;if((v|0)>=(c[h>>2]|0)){h=43;break b}}if((h|0)==30){f=Na()|0;break}else if((h|0)==31){f=Na()|0;break}}else h=43}while(0);do{if((h|0)==43){o=0;ha(183,b|0);b=o;o=0;if(b&1){f=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);i=A;return}}while(0);d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}function eh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;M=i;i=i+16|0;C=M+12|0;L=M+9|0;K=M+6|0;D=M+3|0;E=M;F=b+172|0;e=c[F>>2]|0;if((e|0)<=0){i=M;return}G=b+4600|0;H=b+4596|0;I=b+4604|0;J=b+4592|0;B=0;while(1){y=B+-1|0;g=c[G>>2]|0;h=g+(y*3|0)|0;N=c[H>>2]|0;f=B+1|0;j=d[N+(B*3|0)>>0]|0;A=c[I>>2]|0;k=d[N+(y*3|0)>>0]|0;l=j-k|0;m=d[h>>0]|0;n=k-m|0;o=((((a[A+((d[N+(f*3|0)>>0]|0)-j)>>0]|0)*9|0)+(a[A+l>>0]|0)|0)*9|0)+(a[A+n>>0]|0)|0;p=d[N+(B*3|0)+1>>0]|0;q=d[N+(y*3|0)+1>>0]|0;r=p-q|0;s=d[g+(y*3|0)+1>>0]|0;t=q-s|0;u=((((a[A+((d[N+(f*3|0)+1>>0]|0)-p)>>0]|0)*9|0)+(a[A+r>>0]|0)|0)*9|0)+(a[A+t>>0]|0)|0;v=d[N+(B*3|0)+2>>0]|0;w=d[N+(y*3|0)+2>>0]|0;x=v-w|0;y=d[g+(y*3|0)+2>>0]|0;z=w-y|0;A=((((a[A+((d[N+(f*3|0)+2>>0]|0)-v)>>0]|0)*9|0)+(a[A+x>>0]|0)|0)*9|0)+(a[A+z>>0]|0)|0;if(!(u|o|A)){a[K>>0]=a[h>>0]|0;a[K+1>>0]=a[h+1>>0]|0;a[K+2>>0]=a[h+2>>0]|0;a[C>>0]=a[h>>0]|0;a[C+1>>0]=a[h+1>>0]|0;a[C+2>>0]=a[h+2>>0]|0;e=fh(b,C,g+(B*3|0)|0,e-B|0)|0;f=e+B|0;if((f|0)!=(c[F>>2]|0)){N=(c[H>>2]|0)+(f*3|0)|0;a[E>>0]=a[N>>0]|0;a[E+1>>0]=a[N+1>>0]|0;a[E+2>>0]=a[N+2>>0]|0;N=c[G>>2]|0;a[L>>0]=a[K>>0]|0;a[L+1>>0]=a[K+1>>0]|0;a[L+2>>0]=a[K+2>>0]|0;a[C>>0]=a[E>>0]|0;a[C+1>>0]=a[E+1>>0]|0;a[C+2>>0]=a[E+2>>0]|0;gh(D,b,L,C);N=N+(f*3|0)|0;a[N>>0]=a[D>>0]|0;a[N+1>>0]=a[D+1>>0]|0;a[N+2>>0]=a[D+2>>0]|0;N=c[J>>2]|0;c[J>>2]=(N|0)<1?0:N+-1|0;e=e+1|0}f=e+B|0}else{g=d[g+(B*3|0)>>0]|0;e=j-m>>31;if((e^n|0)>=0)if((e^l|0)<0)e=m;else e=m-k+j|0;else e=j;j=hh(b,o,g,e,0)|0;g=d[(c[G>>2]|0)+(B*3|0)+1>>0]|0;e=p-s>>31;if((e^t|0)>=0)if((e^r|0)<0)e=s;else e=s-q+p|0;else e=p;g=hh(b,u,g,e,0)|0;h=d[(c[G>>2]|0)+(B*3|0)+2>>0]|0;e=v-y>>31;if((e^z|0)>=0)if((e^x|0)<0)e=y;else e=y-w+v|0;else e=v;A=hh(b,A,h,e,0)|0;N=(c[G>>2]|0)+(B*3|0)|0;a[N>>0]=j;a[N+1>>0]=g;a[N+2>>0]=A}e=c[F>>2]|0;if((f|0)>=(e|0))break;else B=f}i=M;return}function fh(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0;j=b+112|0;k=b+108|0;l=b+4592|0;g=c[j>>2]|0;h=0;while(1){if((g|0)<1){ge(b);g=c[j>>2]|0}i=c[k>>2]|0;g=g+-1|0;c[j>>2]=g;c[k>>2]=i<<1;if((i|0)>=0){m=8;break}i=c[l>>2]|0;p=1<>2];q=f-h|0;q=(p|0)<(q|0)?p:q;h=q+h|0;if((q|0)==(p|0))c[l>>2]=(i|0)>30?31:i+1|0;if((h|0)==(f|0)){g=f;break}}if((m|0)==8)if((h|0)!=(f|0)){g=c[l>>2]|0;if((g+-4|0)>>>0<28)g=Kg(b,c[36476+(g<<2)>>2]|0)|0;else g=0;g=g+h|0;if((g|0)>(f|0)){g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,5,35648);q=o;o=0;if(q&1){q=Na()|0;La(g|0);Ya(q|0)}else lb(g|0,824,96)}}else g=f;if((g|0)<=0)return g|0;h=0;do{q=e+(h*3|0)|0;a[q>>0]=a[d>>0]|0;a[q+1>>0]=a[d+1>>0]|0;a[q+2>>0]=a[d+2>>0]|0;h=h+1|0}while((h|0)!=(g|0));return g|0}function gh(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;l=e+4568|0;o=ih(e,l)|0;j=ih(e,l)|0;l=ih(e,l)|0;i=e+128|0;h=d[g>>0]|0;m=c[e+136>>2]|0;n=m<<1|1;h=($($(n,o)|0,h-(d[f>>0]|0)>>31|1)|0)+h|0;o=0-m|0;if((h|0)>=(o|0)){i=c[i>>2]|0;if((i+m|0)<(h|0))h=h-($(c[e+132>>2]|0,n)|0)|0}else{h=($(c[e+132>>2]|0,n)|0)+h|0;i=c[i>>2]|0}if((h&i|0)!=(h|0))h=i&~(h>>31);k=h&255;h=d[g+1>>0]|0;h=($($(n,j)|0,h-(d[f+1>>0]|0)>>31|1)|0)+h|0;if((h|0)>=(o|0)){if((i+m|0)<(h|0))h=h-($(c[e+132>>2]|0,n)|0)|0}else h=($(c[e+132>>2]|0,n)|0)+h|0;if((h&i|0)!=(h|0))h=i&~(h>>31);j=h&255;h=d[g+2>>0]|0;h=($($(n,l)|0,h-(d[f+2>>0]|0)>>31|1)|0)+h|0;if((h|0)>=(o|0)){if((i+m|0)<(h|0))h=h-($(c[e+132>>2]|0,n)|0)|0}else h=($(c[e+132>>2]|0,n)|0)+h|0;if((h&i|0)==(h|0)){e=h;e=e&255;a[b>>0]=k;o=b+1|0;a[o>>0]=j;b=b+2|0;a[b>>0]=e;return}e=i&~(h>>31);e=e&255;a[b>>0]=k;o=b+1|0;a[o>>0]=j;b=b+2|0;a[b>>0]=e;return}function hh(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;t=e>>31;l=(t^e)-t|0;r=d+188+(l*12|0)+10|0;f=b[r>>1]|0;q=d+188+(l*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){e=5;while(1)if((f<>1]^t)-t+g|0;s=d+128|0;h=c[s>>2]|0;if((f&h|0)==(f|0))m=f;else m=h&~(f>>31);f=d+112|0;if((c[f>>2]|0)<8)ge(d);h=d+108|0;g=c[h>>2]|0;i=g>>>24;j=c[2832+(e<<11)+(i<<3)+4>>2]|0;if(!j){k=c[d+148>>2]|0;h=c[d+140>>2]|0;f=Jg(d)|0;if((f|0)<(k+-1-h|0)){if(e)f=(Kg(d,e)|0)+(f<>31^f>>1;if((((f|0)>-1?f:0-f|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);d=o;o=0;if(d&1){d=Na()|0;La(f|0);Ya(d|0)}else lb(f|0,824,96)}}else{c[f>>2]=(c[f>>2]|0)-j;c[h>>2]=g<>2]|0}k=d+136|0;g=c[k>>2]|0;if(!e){if(!g)h=(c[d+188+(l*12|0)+4>>2]<<1)+-1+(b[r>>1]|0)>>31;else h=0;j=h^f}else j=f;e=c[d+152>>2]|0;h=(c[q>>2]|0)+((j|0)>-1?j:0-j|0)|0;i=d+188+(l*12|0)+4|0;f=(c[i>>2]|0)+($(g<<1|1,j)|0)|0;g=b[r>>1]|0;if((g|0)==(e|0)){h=h>>1;f=f>>1;g=e>>1}c[q>>2]=h;e=g+1|0;b[r>>1]=e;h=e+f|0;if((h|0)>=1){if((f|0)>0){f=f-e|0;r=b[p>>1]|0;b[p>>1]=(r<<16>>16<127&1)+(r&65535);f=(f|0)>0?0:f}}else{f=b[p>>1]|0;b[p>>1]=(f&65535)-(f<<16>>16>-128&1);f=(h|0)>(~g|0)?h:0-g|0}c[i>>2]=f;e=c[k>>2]|0;g=e<<1|1;h=($(g,(j^t)-t|0)|0)+m|0;if((h|0)>=(0-e|0)){f=c[s>>2]|0;if((f+e|0)<(h|0))h=h-($(c[d+132>>2]|0,g)|0)|0}else{h=($(c[d+132>>2]|0,g)|0)+h|0;f=c[s>>2]|0}if((h&f|0)==(h|0)){d=h;d=d&255;return d|0}d=f&~(h>>31);d=d&255;return d|0}function ih(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;m=e+9|0;f=d[m>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;j=c[b+148>>2]|0;k=c[36476+(c[b+4592>>2]<<2)>>2]|0;f=c[b+140>>2]|0;h=Jg(b)|0;do{if((h|0)<(j+-2-k-f|0))if(!g){g=c[i>>2]|0;b=g+h|0;f=b&1;b=(f+b|0)/2|0;l=8;break}else{k=(Kg(b,g)|0)+(h<>2]|0;h=k+g|0;j=h&1;f=j;i=1;h=(j+h|0)/2|0;break}else{h=(Kg(b,f)|0)+1|0;j=c[i>>2]|0;b=h+j|0;f=b&1;b=(f+b|0)/2|0;if(!g){g=j;l=8}else{k=h;i=1;h=b;g=j}}}while(0);if((l|0)==8){k=h;i=d[e+10>>0]<<1>>>0>=(d[m>>0]|0)>>>0;h=b}h=(f|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(k+1-g>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[m>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){e=g;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[m>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=l;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}function jh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;f=p;o=b+136|0;a:do{if(!(c[o>>2]|0)){e=c[b+128>>2]|0;d=b+144|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+176>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+180>>2]|0):0)?(c[f+12>>2]|0)==(c[b+184>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4604>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4604>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4604>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4604>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+144|0}while(0);n=1<>2];e=b+4608|0;f=n<<1;g=b+4612|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4604|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+184|0;l=b+180|0;j=b+176|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function kh(a){a=a|0;var b=0,d=0;c[a>>2]=35772;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function lh(a){a=a|0;var b=0,d=0;c[a>>2]=35772;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function mh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function nh(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,65535,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+152>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+156>>2]=j;c[d+160>>2]=g;vh(d);g=0;do{c[d+164+(g*12|0)>>2]=1024;c[d+164+(g*12|0)+4>>2]=0;b[d+164+(g*12|0)+8>>1]=0;b[d+164+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4544>>2]=1024;c[d+4548>>2]=0;a[d+4552>>0]=l;a[d+4553>>0]=1;a[d+4554>>0]=0;c[d+4556>>2]=1024;c[d+4560>>2]=1;a[d+4564>>0]=l;a[d+4565>>0]=1;a[d+4566>>0]=0;c[d+4568>>2]=0;i=h;return}function oh(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4596>>0]=g&1;d=b+132|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);ph(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function ph(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;w=a+148|0;x=(c[w>>2]|0)+4|0;if((c[a+28>>2]|0)==1)y=c[a+20>>2]|0;else y=1;d=$(y<<1,x)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;do{if(d){if(!((d|0)<0?(o=0,ha(178,C|0),B=o,o=0,B&1):0))j=6;if((j|0)==6?(e=d<<1,o=0,f=ka(67,e|0)|0,B=o,o=0,!(B&1)):0){c[C>>2]=f;B=f+(d<<1)|0;c[C+8>>2]=B;iw(f|0,0,e|0)|0;c[D>>2]=B;break}f=Na()|0;d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!y)j=18;else{if(!(y>>>0>1073741823?(o=0,ha(178,z|0),v=o,o=0,v&1):0))j=16;if((j|0)==16?(g=y<<2,o=0,h=ka(67,g|0)|0,v=o,o=0,!(v&1)):0){c[z>>2]=h;j=h+(y<<2)|0;c[z+8>>2]=j;iw(h|0,0,g|0)|0;c[B>>2]=j;j=18;break}f=Na()|0;d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==18){h=a+8|0;a:do{if((c[h>>2]|0)>0){j=a+4572|0;k=$(y,x)|0;l=k+1|0;m=a+4576|0;n=(y|0)>0;p=a+136|0;q=a+144|0;r=a+140|0;s=a+132|0;t=a+88|0;u=a+4568|0;v=0;b:while(1){f=c[C>>2]|0;e=f+2|0;c[j>>2]=e;f=f+(l<<1)|0;c[m>>2]=f;if(!(v&1))d=f;else{c[j>>2]=f;c[m>>2]=e;d=e;e=f}if(n){g=c[z>>2]|0;f=0;do{c[u>>2]=c[g+(f<<2)>>2];g=c[w>>2]|0;b[e+(g<<1)>>1]=b[e+(g+-1<<1)>>1]|0;b[d+-2>>1]=b[e>>1]|0;o=0;ia(79,a|0,0);g=o;o=0;if(g&1){j=29;break b}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[u>>2];e=(c[j>>2]|0)+(x<<1)|0;c[j>>2]=e;d=(c[m>>2]|0)+(x<<1)|0;c[m>>2]=d;f=f+1|0}while((f|0)<(y|0))}g=c[p>>2]|0;if(((g|0)<=(v|0)?(v|0)<((c[q>>2]|0)+g|0):0)?(g=c[t>>2]|0,o=0,Aa(c[(c[g>>2]|0)+8>>2]|0,g|0,d+((c[s>>2]|0)-k<<1)|0,c[r>>2]|0,x|0),g=o,o=0,g&1):0){j=30;break}v=v+1|0;if((v|0)>=(c[h>>2]|0)){j=42;break a}}if((j|0)==29){f=Na()|0;break}else if((j|0)==30){f=Na()|0;break}}else j=42}while(0);do{if((j|0)==42){o=0;ha(183,a|0);a=o;o=0;if(a&1){f=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);i=A;return}}while(0);d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}function qh(d,f){d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;p=d+4572|0;f=c[p>>2]|0;s=d+148|0;if((c[s>>2]|0)<=0)return;q=d+4576|0;r=d+4580|0;i=f;j=e[f+-2>>1]|0;f=e[f>>1]|0;o=0;while(1){n=c[q>>2]|0;m=e[n+(o+-1<<1)>>1]|0;h=o+1|0;g=e[i+(h<<1)>>1]|0;l=c[r>>2]|0;k=f-j|0;i=j-m|0;l=((((a[l+(g-f)>>0]|0)*9|0)+(a[l+k>>0]|0)|0)*9|0)+(a[l+i>>0]|0)|0;if(!l){h=(sh(d,o,0)|0)+o|0;g=c[p>>2]|0;f=e[g+(h+-1<<1)>>1]|0;g=e[g+(h<<1)>>1]|0}else{j=f-m>>31;if((j^i|0)<0)i=f;else i=m+((j^k|0)<0?0:k)|0;n=rh(d,l,e[n+(o<<1)>>1]|0,i,0)|0;b[(c[q>>2]|0)+(o<<1)>>1]=n}if((h|0)>=(c[s>>2]|0))break;i=c[p>>2]|0;j=f;f=g;o=h}return}function rh(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;s=e>>31;m=(s^e)-s|0;r=d+164+(m*12|0)+10|0;f=b[r>>1]|0;q=d+164+(m*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){i=5;while(1)if((f<>1]^s)-s+g|0;if((f&65535|0)!=(f|0))f=f>>31&65535^65535;h=d+112|0;if((c[h>>2]|0)<8)ge(d);g=d+108|0;j=c[g>>2]|0;k=j>>>24;l=c[2832+(i<<11)+(k<<3)+4>>2]|0;if(!l){h=Jg(d)|0;if((h|0)<47){if(i)h=(Kg(d,i)|0)+(h<>31^h>>1;if((((h|0)>-1?h:0-h|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);e=o;o=0;if(e&1){e=Na()|0;La(f|0);Ya(e|0)}else lb(f|0,824,96)}}else{c[h>>2]=(c[h>>2]|0)-l;c[g>>2]=j<>2]|0}l=d+164+(m*12|0)+4|0;g=c[l>>2]|0;if(!i){d=b[r>>1]|0;i=d;h=(g<<1)+-1+(d<<16>>16)>>31^h}else i=b[r>>1]|0;j=i<<16>>16==64;d=j&1;k=g+h>>d;j=j?32:i<<16>>16;c[q>>2]=((h|0)>-1?h:0-h|0)+(c[q>>2]|0)>>d;g=j+1|0;b[r>>1]=g;i=g+k|0;if((i|0)<1){r=b[p>>1]|0;b[p>>1]=(r&65535)-(r<<16>>16>-128&1);r=(i|0)>(~j|0)?i:0-j|0;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&65535;return e|0}if((k|0)<=0){r=k;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&65535;return e|0}r=k-g|0;q=b[p>>1]|0;b[p>>1]=(q<<16>>16<127&1)+(q&65535);r=(r|0)>0?0:r;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&65535;return e|0}function sh(a,d,f){a=a|0;d=d|0;f=f|0;var g=0,h=0,i=0,j=0;i=a+4576|0;h=c[i>>2]|0;f=b[h+(d+-1<<1)>>1]|0;j=a+148|0;h=th(a,f,h+(d<<1)|0,(c[j>>2]|0)-d|0)|0;g=h+d|0;if((g|0)==(c[j>>2]|0)){j=h;return j|0}f=f&65535;d=e[(c[a+4572>>2]|0)+(g<<1)>>1]|0;j=f-d|0;if((((j|0)>-1?j:0-j|0)|0)<1)f=(uh(a,a+4556|0)|0)+f|0;else f=($(uh(a,a+4544|0)|0,d-f>>31|1)|0)+d|0;b[(c[i>>2]|0)+(g<<1)>>1]=f;j=a+4568|0;a=c[j>>2]|0;c[j>>2]=(a|0)<1?0:a+-1|0;j=h+1|0;return j|0}function th(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0;k=d+112|0;l=d+108|0;m=d+4568|0;h=c[k>>2]|0;i=0;while(1){if((h|0)<1){ge(d);h=c[k>>2]|0}j=c[l>>2]|0;h=h+-1|0;c[k>>2]=h;c[l>>2]=j<<1;if((j|0)>=0){p=8;break}j=c[m>>2]|0;q=1<>2];r=g-i|0;r=(q|0)<(r|0)?q:r;i=r+i|0;if((r|0)==(q|0))c[m>>2]=(j|0)>30?31:j+1|0;if((i|0)==(g|0)){h=g;break}}if((p|0)==8)if((i|0)!=(g|0)){h=c[m>>2]|0;if((h+-4|0)>>>0<28)h=Kg(d,c[36476+(h<<2)>>2]|0)|0;else h=0;h=h+i|0;if((h|0)>(g|0)){h=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,h|0,5,35648);r=o;o=0;if(r&1){r=Na()|0;La(h|0);Ya(r|0)}else lb(h|0,824,96)}}else h=g;if((h|0)>0)i=0;else return h|0;do{b[f+(i<<1)>>1]=e;i=i+1|0}while((i|0)!=(h|0));return h|0}function uh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;k=e+9|0;f=d[k>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;h=c[36476+(c[b+4568>>2]<<2)>>2]|0;f=Jg(b)|0;do{if((f|0)<(46-h|0))if(!g){b=c[i>>2]|0;h=b+f|0;g=h&1;h=(g+h|0)/2|0;j=8;break}else{f=(Kg(b,g)|0)+(f<>2]|0;h=f+b|0;l=h&1;g=l;i=1;h=(l+h|0)/2|0;break}else{f=(Kg(b,16)|0)+1|0;b=c[i>>2]|0;h=f+b|0;i=h&1;h=(i+h|0)/2|0;if(!g){g=i;j=8}else{g=i;i=1}}}while(0);if((j|0)==8)i=d[e+10>>0]<<1>>>0>=(d[k>>0]|0)>>>0;h=(g|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(f+1-b>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[k>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){l=g;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[k>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}function vh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,65535,0);l=b+152|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+156>>2]|0):0)?(c[k+12>>2]|0)==(c[b+160>>2]|0):0){l=c[8909]|0;c[b+4580>>2]=l+(((c[8910]|0)-l|0)>>>1);i=m;return}e=b+4584|0;f=b+4588|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=131072){if(h>>>0>131072?(j=d+131072|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,131072-h|0);d=c[e>>2]|0}k=b+4580|0;c[k>>2]=d+65536;j=b+160|0;g=b+156|0;h=-65536;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==65536)break}i=m;return}function wh(a){a=a|0;var b=0,d=0;c[a>>2]=35744;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function xh(a){a=a|0;var b=0,d=0;c[a>>2]=35744;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function yh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(37,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==16)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(38,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(39,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(40,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=2;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function zh(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,4095,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+152>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+156>>2]=j;c[d+160>>2]=g;Hh(d);g=0;do{c[d+164+(g*12|0)>>2]=64;c[d+164+(g*12|0)+4>>2]=0;b[d+164+(g*12|0)+8>>1]=0;b[d+164+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4544>>2]=64;c[d+4548>>2]=0;a[d+4552>>0]=l;a[d+4553>>0]=1;a[d+4554>>0]=0;c[d+4556>>2]=64;c[d+4560>>2]=1;a[d+4564>>0]=l;a[d+4565>>0]=1;a[d+4566>>0]=0;c[d+4568>>2]=0;i=h;return}function Ah(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4596>>0]=g&1;d=b+132|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);Bh(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function Bh(a){a=a|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;w=a+148|0;x=(c[w>>2]|0)+4|0;if((c[a+28>>2]|0)==1)y=c[a+20>>2]|0;else y=1;d=$(y<<1,x)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;do{if(d){if(!((d|0)<0?(o=0,ha(178,C|0),B=o,o=0,B&1):0))j=6;if((j|0)==6?(e=d<<1,o=0,f=ka(67,e|0)|0,B=o,o=0,!(B&1)):0){c[C>>2]=f;B=f+(d<<1)|0;c[C+8>>2]=B;iw(f|0,0,e|0)|0;c[D>>2]=B;break}f=Na()|0;d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!y)j=18;else{if(!(y>>>0>1073741823?(o=0,ha(178,z|0),v=o,o=0,v&1):0))j=16;if((j|0)==16?(g=y<<2,o=0,h=ka(67,g|0)|0,v=o,o=0,!(v&1)):0){c[z>>2]=h;j=h+(y<<2)|0;c[z+8>>2]=j;iw(h|0,0,g|0)|0;c[B>>2]=j;j=18;break}f=Na()|0;d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((j|0)==18){h=a+8|0;a:do{if((c[h>>2]|0)>0){j=a+4572|0;k=$(y,x)|0;l=k+1|0;m=a+4576|0;n=(y|0)>0;p=a+136|0;q=a+144|0;r=a+140|0;s=a+132|0;t=a+88|0;u=a+4568|0;v=0;b:while(1){f=c[C>>2]|0;e=f+2|0;c[j>>2]=e;f=f+(l<<1)|0;c[m>>2]=f;if(!(v&1))d=f;else{c[j>>2]=f;c[m>>2]=e;d=e;e=f}if(n){g=c[z>>2]|0;f=0;do{c[u>>2]=c[g+(f<<2)>>2];g=c[w>>2]|0;b[e+(g<<1)>>1]=b[e+(g+-1<<1)>>1]|0;b[d+-2>>1]=b[e>>1]|0;o=0;ia(80,a|0,0);g=o;o=0;if(g&1){j=29;break b}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[u>>2];e=(c[j>>2]|0)+(x<<1)|0;c[j>>2]=e;d=(c[m>>2]|0)+(x<<1)|0;c[m>>2]=d;f=f+1|0}while((f|0)<(y|0))}g=c[p>>2]|0;if(((g|0)<=(v|0)?(v|0)<((c[q>>2]|0)+g|0):0)?(g=c[t>>2]|0,o=0,Aa(c[(c[g>>2]|0)+8>>2]|0,g|0,d+((c[s>>2]|0)-k<<1)|0,c[r>>2]|0,x|0),g=o,o=0,g&1):0){j=30;break}v=v+1|0;if((v|0)>=(c[h>>2]|0)){j=42;break a}}if((j|0)==29){f=Na()|0;break}else if((j|0)==30){f=Na()|0;break}}else j=42}while(0);do{if((j|0)==42){o=0;ha(183,a|0);a=o;o=0;if(a&1){f=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);i=A;return}}while(0);d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~((e+-2-d|0)>>>1)<<1);cj(d);Ya(f|0)}function Ch(d,f){d=d|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;p=d+4572|0;f=c[p>>2]|0;s=d+148|0;if((c[s>>2]|0)<=0)return;q=d+4576|0;r=d+4580|0;i=f;j=e[f+-2>>1]|0;f=e[f>>1]|0;o=0;while(1){n=c[q>>2]|0;m=e[n+(o+-1<<1)>>1]|0;h=o+1|0;g=e[i+(h<<1)>>1]|0;l=c[r>>2]|0;k=f-j|0;i=j-m|0;l=((((a[l+(g-f)>>0]|0)*9|0)+(a[l+k>>0]|0)|0)*9|0)+(a[l+i>>0]|0)|0;if(!l){h=(Eh(d,o,0)|0)+o|0;g=c[p>>2]|0;f=e[g+(h+-1<<1)>>1]|0;g=e[g+(h<<1)>>1]|0}else{j=f-m>>31;if((j^i|0)<0)i=f;else i=m+((j^k|0)<0?0:k)|0;n=Dh(d,l,e[n+(o<<1)>>1]|0,i,0)|0;b[(c[q>>2]|0)+(o<<1)>>1]=n}if((h|0)>=(c[s>>2]|0))break;i=c[p>>2]|0;j=f;f=g;o=h}return}function Dh(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;s=e>>31;m=(s^e)-s|0;r=d+164+(m*12|0)+10|0;f=b[r>>1]|0;q=d+164+(m*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){i=5;while(1)if((f<>1]^s)-s+g|0;if((f&4095|0)!=(f|0))f=f>>31&4095^4095;h=d+112|0;if((c[h>>2]|0)<8)ge(d);g=d+108|0;j=c[g>>2]|0;k=j>>>24;l=c[2832+(i<<11)+(k<<3)+4>>2]|0;if(!l){h=Jg(d)|0;if((h|0)<35){if(i)h=(Kg(d,i)|0)+(h<>31^h>>1;if((((h|0)>-1?h:0-h|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);e=o;o=0;if(e&1){e=Na()|0;La(f|0);Ya(e|0)}else lb(f|0,824,96)}}else{c[h>>2]=(c[h>>2]|0)-l;c[g>>2]=j<>2]|0}l=d+164+(m*12|0)+4|0;g=c[l>>2]|0;if(!i){d=b[r>>1]|0;i=d;h=(g<<1)+-1+(d<<16>>16)>>31^h}else i=b[r>>1]|0;j=i<<16>>16==64;d=j&1;k=g+h>>d;j=j?32:i<<16>>16;c[q>>2]=((h|0)>-1?h:0-h|0)+(c[q>>2]|0)>>d;g=j+1|0;b[r>>1]=g;i=g+k|0;if((i|0)<1){r=b[p>>1]|0;b[p>>1]=(r&65535)-(r<<16>>16>-128&1);r=(i|0)>(~j|0)?i:0-j|0;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&4095;e=e&65535;return e|0}if((k|0)<=0){r=k;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&4095;e=e&65535;return e|0}r=k-g|0;q=b[p>>1]|0;b[p>>1]=(q<<16>>16<127&1)+(q&65535);r=(r|0)>0?0:r;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&4095;e=e&65535;return e|0}function Eh(a,d,f){a=a|0;d=d|0;f=f|0;var g=0,h=0,i=0,j=0;i=a+4576|0;h=c[i>>2]|0;f=b[h+(d+-1<<1)>>1]|0;j=a+148|0;h=Fh(a,f,h+(d<<1)|0,(c[j>>2]|0)-d|0)|0;g=h+d|0;if((g|0)==(c[j>>2]|0)){j=h;return j|0}f=f&65535;d=e[(c[a+4572>>2]|0)+(g<<1)>>1]|0;j=f-d|0;if((((j|0)>-1?j:0-j|0)|0)<1)f=(Gh(a,a+4556|0)|0)+f|0;else f=($(Gh(a,a+4544|0)|0,d-f>>31|1)|0)+d|0;b[(c[i>>2]|0)+(g<<1)>>1]=f&4095;j=a+4568|0;a=c[j>>2]|0;c[j>>2]=(a|0)<1?0:a+-1|0;j=h+1|0;return j|0}function Fh(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0;k=d+112|0;l=d+108|0;m=d+4568|0;h=c[k>>2]|0;i=0;while(1){if((h|0)<1){ge(d);h=c[k>>2]|0}j=c[l>>2]|0;h=h+-1|0;c[k>>2]=h;c[l>>2]=j<<1;if((j|0)>=0){p=8;break}j=c[m>>2]|0;q=1<>2];r=g-i|0;r=(q|0)<(r|0)?q:r;i=r+i|0;if((r|0)==(q|0))c[m>>2]=(j|0)>30?31:j+1|0;if((i|0)==(g|0)){h=g;break}}if((p|0)==8)if((i|0)!=(g|0)){h=c[m>>2]|0;if((h+-4|0)>>>0<28)h=Kg(d,c[36476+(h<<2)>>2]|0)|0;else h=0;h=h+i|0;if((h|0)>(g|0)){h=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,h|0,5,35648);r=o;o=0;if(r&1){r=Na()|0;La(h|0);Ya(r|0)}else lb(h|0,824,96)}}else h=g;if((h|0)>0)i=0;else return h|0;do{b[f+(i<<1)>>1]=e;i=i+1|0}while((i|0)!=(h|0));return h|0}function Gh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;k=e+9|0;f=d[k>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;h=c[36476+(c[b+4568>>2]<<2)>>2]|0;f=Jg(b)|0;do{if((f|0)<(34-h|0))if(!g){b=c[i>>2]|0;h=b+f|0;g=h&1;h=(g+h|0)/2|0;j=8;break}else{f=(Kg(b,g)|0)+(f<>2]|0;h=f+b|0;l=h&1;g=l;i=1;h=(l+h|0)/2|0;break}else{f=(Kg(b,12)|0)+1|0;b=c[i>>2]|0;h=f+b|0;i=h&1;h=(i+h|0)/2|0;if(!g){g=i;j=8}else{g=i;i=1}}}while(0);if((j|0)==8)i=d[e+10>>0]<<1>>>0>=(d[k>>0]|0)>>>0;h=(g|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(f+1-b>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[k>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){l=g;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[k>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}function Hh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,4095,0);l=b+152|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+156>>2]|0):0)?(c[k+12>>2]|0)==(c[b+160>>2]|0):0){l=c[8906]|0;c[b+4580>>2]=l+(((c[8907]|0)-l|0)>>>1);i=m;return}e=b+4584|0;f=b+4588|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=8192){if(h>>>0>8192?(j=d+8192|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,8192-h|0);d=c[e>>2]|0}k=b+4580|0;c[k>>2]=d+4096;j=b+160|0;g=b+156|0;h=-4096;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==4096)break}i=m;return}function Ih(a){a=a|0;var b=0,d=0;c[a>>2]=35716;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function Jh(a){a=a|0;var b=0,d=0;c[a>>2]=35716;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function Kh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function Lh(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,255,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+152>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+156>>2]=j;c[d+160>>2]=g;Th(d);g=0;do{c[d+164+(g*12|0)>>2]=4;c[d+164+(g*12|0)+4>>2]=0;b[d+164+(g*12|0)+8>>1]=0;b[d+164+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4544>>2]=4;c[d+4548>>2]=0;a[d+4552>>0]=l;a[d+4553>>0]=1;a[d+4554>>0]=0;c[d+4556>>2]=4;c[d+4560>>2]=1;a[d+4564>>0]=l;a[d+4565>>0]=1;a[d+4566>>0]=0;c[d+4568>>2]=0;i=h;return}function Mh(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4596>>0]=g&1;d=b+132|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);Nh(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function Nh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;w=b+148|0;x=(c[w>>2]|0)+4|0;if((c[b+28>>2]|0)==1)y=c[b+20>>2]|0;else y=1;d=$(y<<1,x)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;a:do{if(d){if(!((d|0)<0?(o=0,ha(178,C|0),B=o,o=0,B&1):0))h=6;if((h|0)==6?(o=0,e=ka(67,d|0)|0,B=o,o=0,!(B&1)):0){c[D>>2]=e;c[C>>2]=e;c[C+8>>2]=e+d;while(1){a[e>>0]=0;e=(c[D>>2]|0)+1|0;c[D>>2]=e;d=d+-1|0;if(!d)break a}}e=Na()|0;d=c[C>>2]|0;if(!d)Ya(e|0);if((c[D>>2]|0)!=(d|0))c[D>>2]=d;cj(d);Ya(e|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!y)h=19;else{if(!(y>>>0>1073741823?(o=0,ha(178,z|0),v=o,o=0,v&1):0))h=17;if((h|0)==17?(f=y<<2,o=0,g=ka(67,f|0)|0,v=o,o=0,!(v&1)):0){c[z>>2]=g;h=g+(y<<2)|0;c[z+8>>2]=h;iw(g|0,0,f|0)|0;c[B>>2]=h;h=19;break}e=Na()|0;d=c[z>>2]|0;f=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}}while(0);if((h|0)==19){h=b+8|0;b:do{if((c[h>>2]|0)>0){j=b+4572|0;k=$(y,x)|0;l=k+1|0;m=b+4576|0;n=(y|0)>0;p=b+136|0;q=b+144|0;r=b+140|0;s=b+132|0;t=b+88|0;u=b+4568|0;v=0;c:while(1){f=c[C>>2]|0;e=f+1|0;c[j>>2]=e;f=f+l|0;c[m>>2]=f;if(!(v&1))d=f;else{c[j>>2]=f;c[m>>2]=e;d=e;e=f}if(n){g=c[z>>2]|0;f=0;do{c[u>>2]=c[g+(f<<2)>>2];g=c[w>>2]|0;a[e+g>>0]=a[e+(g+-1)>>0]|0;a[(c[m>>2]|0)+-1>>0]=a[c[j>>2]>>0]|0;o=0;ia(81,b|0,0);g=o;o=0;if(g&1){h=30;break c}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[u>>2];e=(c[j>>2]|0)+x|0;c[j>>2]=e;d=(c[m>>2]|0)+x|0;c[m>>2]=d;f=f+1|0}while((f|0)<(y|0))}g=c[p>>2]|0;if(((g|0)<=(v|0)?(v|0)<((c[q>>2]|0)+g|0):0)?(g=c[t>>2]|0,o=0,Aa(c[(c[g>>2]|0)+8>>2]|0,g|0,d+((c[s>>2]|0)-k)|0,c[r>>2]|0,x|0),g=o,o=0,g&1):0){h=31;break}v=v+1|0;if((v|0)>=(c[h>>2]|0)){h=43;break b}}if((h|0)==30){e=Na()|0;break}else if((h|0)==31){e=Na()|0;break}}else h=43}while(0);do{if((h|0)==43){o=0;ha(183,b|0);b=o;o=0;if(b&1){e=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}if((c[D>>2]|0)!=(d|0))c[D>>2]=d;cj(d);i=A;return}}while(0);d=c[z>>2]|0;f=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(e|0);if((c[D>>2]|0)!=(d|0))c[D>>2]=d;cj(d);Ya(e|0)}function Oh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;o=b+4572|0;e=c[o>>2]|0;r=b+148|0;if((c[r>>2]|0)<=0)return;p=b+4576|0;q=b+4580|0;h=e;i=d[e+-1>>0]|0;e=d[e>>0]|0;n=0;while(1){m=c[p>>2]|0;l=d[m+(n+-1)>>0]|0;g=n+1|0;f=d[h+g>>0]|0;k=c[q>>2]|0;j=e-i|0;h=i-l|0;k=((((a[k+(f-e)>>0]|0)*9|0)+(a[k+j>>0]|0)|0)*9|0)+(a[k+h>>0]|0)|0;if(!k){g=(Qh(b,n,0)|0)+n|0;f=c[o>>2]|0;e=d[f+(g+-1)>>0]|0;f=d[f+g>>0]|0}else{i=e-l>>31;if((i^h|0)<0)h=e;else h=l+((i^j|0)<0?0:j)|0;m=Ph(b,k,d[m+n>>0]|0,h,0)|0;a[(c[p>>2]|0)+n>>0]=m}if((g|0)>=(c[r>>2]|0))break;h=c[o>>2]|0;i=e;e=f;n=g}return}function Ph(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;s=e>>31;m=(s^e)-s|0;r=d+164+(m*12|0)+10|0;f=b[r>>1]|0;q=d+164+(m*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){i=5;while(1)if((f<>1]^s)-s+g|0;if((f&255|0)!=(f|0))f=f>>31&255^255;h=d+112|0;if((c[h>>2]|0)<8)ge(d);g=d+108|0;j=c[g>>2]|0;k=j>>>24;l=c[2832+(i<<11)+(k<<3)+4>>2]|0;if(!l){h=Jg(d)|0;if((h|0)<23){if(i)h=(Kg(d,i)|0)+(h<>31^h>>1;if((((h|0)>-1?h:0-h|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);e=o;o=0;if(e&1){e=Na()|0;La(f|0);Ya(e|0)}else lb(f|0,824,96)}}else{c[h>>2]=(c[h>>2]|0)-l;c[g>>2]=j<>2]|0}l=d+164+(m*12|0)+4|0;g=c[l>>2]|0;if(!i){d=b[r>>1]|0;i=d;h=(g<<1)+-1+(d<<16>>16)>>31^h}else i=b[r>>1]|0;j=i<<16>>16==64;d=j&1;k=g+h>>d;j=j?32:i<<16>>16;c[q>>2]=((h|0)>-1?h:0-h|0)+(c[q>>2]|0)>>d;g=j+1|0;b[r>>1]=g;i=g+k|0;if((i|0)<1){r=b[p>>1]|0;b[p>>1]=(r&65535)-(r<<16>>16>-128&1);r=(i|0)>(~j|0)?i:0-j|0;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&255;return e|0}if((k|0)<=0){r=k;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&255;return e|0}r=k-g|0;q=b[p>>1]|0;b[p>>1]=(q<<16>>16<127&1)+(q&65535);r=(r|0)>0?0:r;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&255;return e|0}function Qh(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;i=b+4576|0;h=c[i>>2]|0;f=a[h+(e+-1)>>0]|0;j=b+148|0;h=Rh(b,f,h+e|0,(c[j>>2]|0)-e|0)|0;g=h+e|0;if((g|0)==(c[j>>2]|0)){j=h;return j|0}f=f&255;e=d[(c[b+4572>>2]|0)+g>>0]|0;j=f-e|0;if((((j|0)>-1?j:0-j|0)|0)<1)f=(Sh(b,b+4556|0)|0)+f|0;else f=($(Sh(b,b+4544|0)|0,e-f>>31|1)|0)+e|0;a[(c[i>>2]|0)+g>>0]=f;j=b+4568|0;b=c[j>>2]|0;c[j>>2]=(b|0)<1?0:b+-1|0;j=h+1|0;return j|0}function Rh(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0;j=b+112|0;k=b+108|0;l=b+4568|0;g=c[j>>2]|0;h=0;while(1){if((g|0)<1){ge(b);g=c[j>>2]|0}i=c[k>>2]|0;g=g+-1|0;c[j>>2]=g;c[k>>2]=i<<1;if((i|0)>=0){m=8;break}i=c[l>>2]|0;p=1<>2];q=f-h|0;q=(p|0)<(q|0)?p:q;h=q+h|0;if((q|0)==(p|0))c[l>>2]=(i|0)>30?31:i+1|0;if((h|0)==(f|0)){g=f;break}}if((m|0)==8)if((h|0)!=(f|0)){g=c[l>>2]|0;if((g+-4|0)>>>0<28)g=Kg(b,c[36476+(g<<2)>>2]|0)|0;else g=0;g=g+h|0;if((g|0)>(f|0)){g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,5,35648);q=o;o=0;if(q&1){q=Na()|0;La(g|0);Ya(q|0)}else lb(g|0,824,96)}}else g=f;if((g|0)<=0)return g|0;iw(e|0,d|0,g|0)|0;return g|0}function Sh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;k=e+9|0;f=d[k>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;h=c[36476+(c[b+4568>>2]<<2)>>2]|0;f=Jg(b)|0;do{if((f|0)<(22-h|0))if(!g){b=c[i>>2]|0;h=b+f|0;g=h&1;h=(g+h|0)/2|0;j=8;break}else{f=(Kg(b,g)|0)+(f<>2]|0;h=f+b|0;l=h&1;g=l;i=1;h=(l+h|0)/2|0;break}else{f=(Kg(b,8)|0)+1|0;b=c[i>>2]|0;h=f+b|0;i=h&1;h=(i+h|0)/2|0;if(!g){g=i;j=8}else{g=i;i=1}}}while(0);if((j|0)==8)i=d[e+10>>0]<<1>>>0>=(d[k>>0]|0)>>>0;h=(g|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(f+1-b>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[k>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){l=g;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[k>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}function Th(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,255,0);l=b+152|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+156>>2]|0):0)?(c[k+12>>2]|0)==(c[b+160>>2]|0):0){l=c[8900]|0;c[b+4580>>2]=l+(((c[8901]|0)-l|0)>>>1);i=m;return}e=b+4584|0;f=b+4588|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=512){if(h>>>0>512?(j=d+512|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,512-h|0);d=c[e>>2]|0}k=b+4580|0;c[k>>2]=d+256;j=b+160|0;g=b+156|0;h=-256;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==256)break}i=m;return}function Uh(a){a=a|0;var b=0,d=0;c[a>>2]=35688;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function Vh(a){a=a|0;var b=0,d=0;c[a>>2]=35688;b=c[a+4584>>2]|0;if(b){d=a+4588|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function Wh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=3;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function Xh(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;h=i;i=i+32|0;l=h;Ei(l,255,0);k=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[l+8>>2]|0:j;g=c[e+12>>2]|0;g=(g|0)==0?c[l+12>>2]|0:g;e=c[e+16>>2]|0;f=c[l+16>>2]|0;c[d+152>>2]=(k|0)==0?c[l+4>>2]|0:k;c[d+156>>2]=j;c[d+160>>2]=g;di(d);g=0;do{c[d+164+(g*12|0)>>2]=4;c[d+164+(g*12|0)+4>>2]=0;b[d+164+(g*12|0)+8>>1]=0;b[d+164+(g*12|0)+10>>1]=1;g=g+1|0}while((g|0)!=365);l=((e|0)==0?f:e)&255;c[d+4544>>2]=4;c[d+4548>>2]=0;a[d+4552>>0]=l;a[d+4553>>0]=1;a[d+4554>>0]=0;c[d+4556>>2]=4;c[d+4560>>2]=1;a[d+4564>>0]=l;a[d+4565>>0]=1;a[d+4566>>0]=0;c[d+4568>>2]=0;i=h;return}function Yh(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4596>>0]=g&1;d=b+132|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);Zh(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function Zh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;w=b+148|0;x=(c[w>>2]|0)+4|0;if((c[b+28>>2]|0)==1)y=c[b+20>>2]|0;else y=1;d=$(y<<1,x)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;a:do{if(d){if(!(d>>>0>1431655765?(o=0,ha(178,C|0),B=o,o=0,B&1):0))h=6;if((h|0)==6?(o=0,e=ka(67,d*3|0)|0,B=o,o=0,!(B&1)):0){c[D>>2]=e;c[C>>2]=e;c[C+8>>2]=e+(d*3|0);while(1){a[e>>0]=0;a[e+1>>0]=0;a[e+2>>0]=0;e=(c[D>>2]|0)+3|0;c[D>>2]=e;d=d+-1|0;if(!d)break a}}f=Na()|0;d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!y)h=19;else{if(!(y>>>0>1073741823?(o=0,ha(178,z|0),v=o,o=0,v&1):0))h=17;if((h|0)==17?(f=y<<2,o=0,g=ka(67,f|0)|0,v=o,o=0,!(v&1)):0){c[z>>2]=g;h=g+(y<<2)|0;c[z+8>>2]=h;iw(g|0,0,f|0)|0;c[B>>2]=h;h=19;break}f=Na()|0;d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}}while(0);if((h|0)==19){h=b+8|0;b:do{if((c[h>>2]|0)>0){j=b+4572|0;k=$(y,x)|0;l=k+1|0;m=b+4576|0;n=(y|0)>0;p=b+136|0;q=b+144|0;r=b+140|0;s=b+132|0;t=b+88|0;u=b+4568|0;v=0;c:while(1){f=c[C>>2]|0;e=f+3|0;c[j>>2]=e;f=f+(l*3|0)|0;c[m>>2]=f;if(!(v&1))d=f;else{c[j>>2]=f;c[m>>2]=e;d=e;e=f}if(n){g=c[z>>2]|0;f=0;do{c[u>>2]=c[g+(f<<2)>>2];d=c[w>>2]|0;g=e+(d*3|0)|0;e=e+((d+-1|0)*3|0)|0;a[g>>0]=a[e>>0]|0;a[g+1>>0]=a[e+1>>0]|0;a[g+2>>0]=a[e+2>>0]|0;e=c[j>>2]|0;g=(c[m>>2]|0)+-3|0;a[g>>0]=a[e>>0]|0;a[g+1>>0]=a[e+1>>0]|0;a[g+2>>0]=a[e+2>>0]|0;o=0;ia(82,b|0,0);g=o;o=0;if(g&1){h=30;break c}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[u>>2];e=(c[j>>2]|0)+(x*3|0)|0;c[j>>2]=e;d=(c[m>>2]|0)+(x*3|0)|0;c[m>>2]=d;f=f+1|0}while((f|0)<(y|0))}g=c[p>>2]|0;if(((g|0)<=(v|0)?(v|0)<((c[q>>2]|0)+g|0):0)?(g=c[t>>2]|0,o=0,Aa(c[(c[g>>2]|0)+8>>2]|0,g|0,d+(((c[s>>2]|0)-k|0)*3|0)|0,c[r>>2]|0,x|0),g=o,o=0,g&1):0){h=31;break}v=v+1|0;if((v|0)>=(c[h>>2]|0)){h=43;break b}}if((h|0)==30){f=Na()|0;break}else if((h|0)==31){f=Na()|0;break}}else h=43}while(0);do{if((h|0)==43){o=0;ha(183,b|0);b=o;o=0;if(b&1){f=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);i=A;return}}while(0);d=c[z>>2]|0;e=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-e|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(f|0);e=c[D>>2]|0;if((e|0)!=(d|0))c[D>>2]=e+(~(((e+-3-d|0)>>>0)/3|0)*3|0);cj(d);Ya(f|0)}function _h(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=b+148|0;if((c[A>>2]|0)<=0)return;B=b+4576|0;C=b+4572|0;D=b+4580|0;z=0;while(1){w=z+-1|0;i=c[B>>2]|0;j=c[C>>2]|0;e=z+1|0;h=d[j+(z*3|0)>>0]|0;y=c[D>>2]|0;k=d[j+(w*3|0)>>0]|0;l=h-k|0;m=d[i+(w*3|0)>>0]|0;n=k-m|0;o=((((a[y+((d[j+(e*3|0)>>0]|0)-h)>>0]|0)*9|0)+(a[y+l>>0]|0)|0)*9|0)+(a[y+n>>0]|0)|0;g=d[j+(z*3|0)+1>>0]|0;p=d[j+(w*3|0)+1>>0]|0;q=g-p|0;r=d[i+(w*3|0)+1>>0]|0;s=p-r|0;t=((((a[y+((d[j+(e*3|0)+1>>0]|0)-g)>>0]|0)*9|0)+(a[y+q>>0]|0)|0)*9|0)+(a[y+s>>0]|0)|0;f=d[j+(z*3|0)+2>>0]|0;u=d[j+(w*3|0)+2>>0]|0;v=f-u|0;w=d[i+(w*3|0)+2>>0]|0;x=u-w|0;y=((((a[y+((d[j+(e*3|0)+2>>0]|0)-f)>>0]|0)*9|0)+(a[y+v>>0]|0)|0)*9|0)+(a[y+x>>0]|0)|0;if(!(t|o|y))e=($h(b,z,0)|0)+z|0;else{j=d[i+(z*3|0)>>0]|0;i=h-m>>31;if((i^n|0)>=0)if((i^l|0)<0)h=m;else h=m-k+h|0;j=ai(b,o,j,h,0)|0;i=d[(c[B>>2]|0)+(z*3|0)+1>>0]|0;h=g-r>>31;if((h^s|0)>=0)if((h^q|0)<0)g=r;else g=r-p+g|0;h=ai(b,t,i,g,0)|0;i=d[(c[B>>2]|0)+(z*3|0)+2>>0]|0;g=f-w>>31;if((g^x|0)>=0)if((g^v|0)<0)f=w;else f=w-u+f|0;y=ai(b,y,i,f,0)|0;z=(c[B>>2]|0)+(z*3|0)|0;a[z>>0]=j;a[z+1>>0]=h;a[z+2>>0]=y}if((e|0)<(c[A>>2]|0))z=e;else break}return}function $h(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;l=i;i=i+16|0;n=l+3|0;o=l;h=b+4576|0;e=c[h>>2]|0;f=e+((d+-1|0)*3|0)|0;j=a[f>>0]|0;k=a[f+1>>0]|0;f=a[f+2>>0]|0;a[o>>0]=j;a[o+1>>0]=k;a[o+2>>0]=f;m=b+148|0;g=(c[m>>2]|0)-d|0;a[n>>0]=a[o>>0]|0;a[n+1>>0]=a[o+1>>0]|0;a[n+2>>0]=a[o+2>>0]|0;g=bi(b,n,e+(d*3|0)|0,g)|0;e=g+d|0;if((e|0)==(c[m>>2]|0)){o=g;i=l;return o|0}n=(c[b+4572>>2]|0)+(e*3|0)|0;d=a[n>>0]|0;m=a[n+1>>0]|0;n=a[n+2>>0]|0;o=c[h>>2]|0;p=b+4544|0;h=ci(b,p)|0;q=ci(b,p)|0;d=d&255;m=m&255;m=($(m-(k&255)>>31|1,q)|0)+m&255;n=n&255;n=($(n-(f&255)>>31|1,ci(b,p)|0)|0)+n&255;o=o+(e*3|0)|0;a[o>>0]=($(d-(j&255)>>31|1,h)|0)+d;a[o+1>>0]=m;a[o+2>>0]=n;o=b+4568|0;n=c[o>>2]|0;c[o>>2]=(n|0)<1?0:n+-1|0;o=g+1|0;i=l;return o|0}function ai(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0;s=e>>31;m=(s^e)-s|0;r=d+164+(m*12|0)+10|0;f=b[r>>1]|0;q=d+164+(m*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){i=5;while(1)if((f<>1]^s)-s+g|0;if((f&255|0)!=(f|0))f=f>>31&255^255;h=d+112|0;if((c[h>>2]|0)<8)ge(d);g=d+108|0;j=c[g>>2]|0;k=j>>>24;l=c[2832+(i<<11)+(k<<3)+4>>2]|0;if(!l){h=Jg(d)|0;if((h|0)<23){if(i)h=(Kg(d,i)|0)+(h<>31^h>>1;if((((h|0)>-1?h:0-h|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);e=o;o=0;if(e&1){e=Na()|0;La(f|0);Ya(e|0)}else lb(f|0,824,96)}}else{c[h>>2]=(c[h>>2]|0)-l;c[g>>2]=j<>2]|0}l=d+164+(m*12|0)+4|0;g=c[l>>2]|0;if(!i){d=b[r>>1]|0;i=d;h=(g<<1)+-1+(d<<16>>16)>>31^h}else i=b[r>>1]|0;j=i<<16>>16==64;d=j&1;k=g+h>>d;j=j?32:i<<16>>16;c[q>>2]=((h|0)>-1?h:0-h|0)+(c[q>>2]|0)>>d;g=j+1|0;b[r>>1]=g;i=g+k|0;if((i|0)<1){r=b[p>>1]|0;b[p>>1]=(r&65535)-(r<<16>>16>-128&1);r=(i|0)>(~j|0)?i:0-j|0;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&255;return e|0}if((k|0)<=0){r=k;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&255;return e|0}r=k-g|0;q=b[p>>1]|0;b[p>>1]=(q<<16>>16<127&1)+(q&65535);r=(r|0)>0?0:r;c[l>>2]=r;s=h^s;e=e>>>31;e=f+e|0;e=e+s|0;e=e&255;return e|0}function bi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0;j=b+112|0;k=b+108|0;l=b+4568|0;g=c[j>>2]|0;h=0;while(1){if((g|0)<1){ge(b);g=c[j>>2]|0}i=c[k>>2]|0;g=g+-1|0;c[j>>2]=g;c[k>>2]=i<<1;if((i|0)>=0){m=8;break}i=c[l>>2]|0;p=1<>2];q=f-h|0;q=(p|0)<(q|0)?p:q;h=q+h|0;if((q|0)==(p|0))c[l>>2]=(i|0)>30?31:i+1|0;if((h|0)==(f|0)){g=f;break}}if((m|0)==8)if((h|0)!=(f|0)){g=c[l>>2]|0;if((g+-4|0)>>>0<28)g=Kg(b,c[36476+(g<<2)>>2]|0)|0;else g=0;g=g+h|0;if((g|0)>(f|0)){g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,5,35648);q=o;o=0;if(q&1){q=Na()|0;La(g|0);Ya(q|0)}else lb(g|0,824,96)}}else g=f;if((g|0)<=0)return g|0;h=0;do{q=e+(h*3|0)|0;a[q>>0]=a[d>>0]|0;a[q+1>>0]=a[d+1>>0]|0;a[q+2>>0]=a[d+2>>0]|0;h=h+1|0}while((h|0)!=(g|0));return g|0}function ci(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;k=e+9|0;f=d[k>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;h=c[36476+(c[b+4568>>2]<<2)>>2]|0;f=Jg(b)|0;do{if((f|0)<(22-h|0))if(!g){b=c[i>>2]|0;h=b+f|0;g=h&1;h=(g+h|0)/2|0;j=8;break}else{f=(Kg(b,g)|0)+(f<>2]|0;h=f+b|0;l=h&1;g=l;i=1;h=(l+h|0)/2|0;break}else{f=(Kg(b,8)|0)+1|0;b=c[i>>2]|0;h=f+b|0;i=h&1;h=(i+h|0)/2|0;if(!g){g=i;j=8}else{g=i;i=1}}}while(0);if((j|0)==8)i=d[e+10>>0]<<1>>>0>=(d[k>>0]|0)>>>0;h=(g|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(f+1-b>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[k>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){l=g;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[k>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;l=l&255;l=l+1|0;l=l&255;a[k>>0]=l;return h|0}function Lp(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;n=i;i=i+128|0;h=n;q=n+116|0;r=n+104|0;k=n+20|0;m=n+16|0;l=n+12|0;p=n+8|0;j=n+4|0;a[q>>0]=a[58887]|0;a[q+1>>0]=a[58888]|0;a[q+2>>0]=a[58889]|0;a[q+3>>0]=a[58890]|0;a[q+4>>0]=a[58891]|0;a[q+5>>0]=a[58892]|0;up(q+1|0,58893,0,c[e+4>>2]|0);b=Xo()|0;c[h>>2]=g;g=r+(Su(r,12,b,q,h)|0)|0;q=vp(r,g,e)|0;b=jn(e)|0;c[p>>2]=b;o=0;pa(3,r|0,q|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){r=Na()|0;pm(b)|0;Ya(r|0)}else{pm(b)|0;c[j>>2]=c[d>>2];q=c[m>>2]|0;r=c[l>>2]|0;c[h>>2]=c[j>>2];r=Uu(h,k,q,r,e,f)|0;i=n;return r|0}return 0}function Mp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0;n=i;i=i+240|0;h=n+8|0;a=n;q=n+204|0;k=n+32|0;m=n+28|0;l=n+24|0;p=n+20|0;j=n+16|0;r=a;c[r>>2]=37;c[r+4>>2]=0;up(a+1|0,58895,0,c[d+4>>2]|0);r=Xo()|0;s=h;c[s>>2]=f;c[s+4>>2]=g;g=q+(Su(q,23,r,a,h)|0)|0;f=vp(q,g,d)|0;a=jn(d)|0;c[p>>2]=a;o=0;pa(3,q|0,f|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){s=Na()|0;pm(a)|0;Ya(s|0)}else{pm(a)|0;c[j>>2]=c[b>>2];r=c[m>>2]|0;s=c[l>>2]|0;c[h>>2]=c[j>>2];s=Uu(h,k,r,s,d,e)|0;i=n;return s|0}return 0}function Np(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;var g=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;z=i;i=i+352|0;u=z+312|0;q=z+48|0;p=z+32|0;l=z+24|0;g=z+8|0;n=z;s=z+316|0;t=z+80|0;k=z+84|0;y=z+76|0;x=z+72|0;v=z+68|0;w=z+64|0;m=n;c[m>>2]=37;c[m+4>>2]=0;m=Bp(n+1|0,58898,c[d+4>>2]|0)|0;c[t>>2]=s;a=Xo()|0;if(m){c[g>>2]=c[d+8>>2];h[g+8>>3]=f;g=Su(s,30,a,n,g)|0}else{h[l>>3]=f;g=Su(s,30,a,n,l)|0}a:do{if((g|0)>29){o=0;a=ua(3)|0;g=o;o=0;g=g&1;if(m){if(!g?(o=0,c[p>>2]=c[d+8>>2],h[p+8>>3]=f,j=va(17,t|0,a|0,n|0,p|0)|0,r=o,o=0,!(r&1)):0)A=12}else if(!g?(o=0,c[q>>2]=c[d+8>>2],h[q+8>>3]=f,r=va(17,t|0,a|0,n|0,q|0)|0,q=o,o=0,!(q&1)):0){j=r;A=12}do{if((A|0)==12){a=c[t>>2]|0;if(!a){o=0;xa(6);r=o;o=0;if(r&1)break;g=c[t>>2]|0}else g=a;a=g;n=g;A=16;break a}}while(0);a=Na()|0}else{a=c[t>>2]|0;n=0;j=g;A=16}}while(0);if((A|0)==16){l=a+j|0;m=vp(a,l,d)|0;do{if((a|0)==(s|0)){a=s;g=0;A=22}else{j=Fl(j<<3)|0;if(!j){o=0;xa(6);A=o;o=0;if(A&1){g=0;A=20;break}a=c[t>>2]|0}g=j;k=j;A=22}}while(0);do{if((A|0)==22){o=0;j=ka(68,d|0)|0;t=o;o=0;if(!(t&1)){c[v>>2]=j;o=0;pa(4,a|0,m|0,l|0,k|0,y|0,x|0,v|0);v=o;o=0;if(v&1){a=Na()|0;pm(j)|0;break}pm(j)|0;c[w>>2]=c[b>>2];A=c[y>>2]|0;a=c[x>>2]|0;o=0;c[u>>2]=c[w>>2];a=ja(40,u|0,k|0,A|0,a|0,d|0,e|0)|0;A=o;o=0;if(!(A&1)){c[b>>2]=a;if(g)Gl(g);if(n)Gl(n);i=z;return a|0}else A=20}else A=20}}while(0);if((A|0)==20)a=Na()|0;if(g)Gl(g);if(n)Gl(n)}Ya(a|0);return 0}function Op(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;y=i;i=i+16|0;z=y;x=Is(j,44212)|0;v=Is(j,44368)|0;Cb[c[(c[v>>2]|0)+20>>2]&127](z,v);c[h>>2]=f;j=a[b>>0]|0;switch(j<<24>>24){case 43:case 45:{o=0;j=ra(c[(c[x>>2]|0)+44>>2]|0,x|0,j|0)|0;w=o;o=0;if(w&1)u=8;else{m=c[h>>2]|0;c[h>>2]=m+4;c[m>>2]=j;m=b+1|0;u=10}break}default:{m=b;u=10}}a:do{if((u|0)==10){w=e;b:do{if((w-m|0)>1?(a[m>>0]|0)==48:0){k=m+1|0;switch(a[k>>0]|0){case 88:case 120:break;default:{u=11;break b}}o=0;j=ra(c[(c[x>>2]|0)+44>>2]|0,x|0,48)|0;t=o;o=0;if(t&1){u=8;break a}t=c[h>>2]|0;c[h>>2]=t+4;c[t>>2]=j;m=m+2|0;o=0;j=ra(c[(c[x>>2]|0)+44>>2]|0,x|0,a[k>>0]|0)|0;t=o;o=0;if(t&1){u=8;break a}t=c[h>>2]|0;c[h>>2]=t+4;c[t>>2]=j;if(m>>>0>>0){j=m;while(1){k=a[j>>0]|0;o=0;l=ua(3)|0;t=o;o=0;if(t&1)break;o=0;k=ra(39,k<<24>>24|0,l|0)|0;t=o;o=0;if(t&1)break;if(!k){t=m;break b}j=j+1|0;if(j>>>0>=e>>>0){t=m;break b}}j=Na()|0;break a}else{t=m;j=m}}else u=11}while(0);c:do{if((u|0)==11)if(m>>>0>>0){j=m;while(1){k=a[j>>0]|0;o=0;l=ua(3)|0;t=o;o=0;if(t&1)break;o=0;k=ra(40,k<<24>>24|0,l|0)|0;t=o;o=0;if(t&1)break;if(!k){t=m;break c}j=j+1|0;if(j>>>0>=e>>>0){t=m;break c}}j=Na()|0;break a}else{t=m;j=m}}while(0);r=a[z>>0]|0;s=z+4|0;if(((r&1)==0?(r&255)>>>1:c[s>>2]|0)|0){if((t|0)!=(j|0)?(n=j+-1|0,t>>>0>>0):0){l=t;k=n;do{r=a[l>>0]|0;a[l>>0]=a[k>>0]|0;a[k>>0]=r;l=l+1|0;k=k+-1|0}while(l>>>0>>0)}o=0;n=ka(c[(c[v>>2]|0)+16>>2]|0,v|0)|0;r=o;o=0;if(r&1){u=8;break}p=z+8|0;q=z+1|0;d:do{if(t>>>0>>0){k=0;l=0;r=t;while(1){m=a[((a[z>>0]&1)==0?q:c[p>>2]|0)+l>>0]|0;if(m<<24>>24>0&(k|0)==(m<<24>>24|0)){k=c[h>>2]|0;c[h>>2]=k+4;c[k>>2]=n;k=a[z>>0]|0;m=0;l=(l>>>0<(((k&1)==0?(k&255)>>>1:c[s>>2]|0)+-1|0)>>>0&1)+l|0}else m=k;o=0;k=ra(c[(c[x>>2]|0)+44>>2]|0,x|0,a[r>>0]|0)|0;A=o;o=0;if(A&1)break;A=c[h>>2]|0;c[h>>2]=A+4;c[A>>2]=k;r=r+1|0;if(r>>>0>=j>>>0)break d;else k=m+1|0}j=Na()|0;break a}}while(0);k=f+(t-b<<2)|0;m=c[h>>2]|0;if((k|0)!=(m|0)){l=m+-4|0;if(k>>>0>>0){do{A=c[k>>2]|0;c[k>>2]=c[l>>2];c[l>>2]=A;k=k+4|0;l=l+-4|0}while(k>>>0>>0);n=x;k=m}else{n=x;k=m}}else n=x}else{o=0;va(c[(c[x>>2]|0)+48>>2]|0,x|0,t|0,j|0,c[h>>2]|0)|0;A=o;o=0;if(A&1){u=8;break}k=(c[h>>2]|0)+(j-t<<2)|0;c[h>>2]=k;n=x}e:do{if(j>>>0>>0){while(1){k=a[j>>0]|0;if(k<<24>>24==46){l=j;break}o=0;l=ra(c[(c[n>>2]|0)+44>>2]|0,x|0,k|0)|0;A=o;o=0;if(A&1){u=4;break}A=c[h>>2]|0;k=A+4|0;c[h>>2]=k;c[A>>2]=l;j=j+1|0;if(j>>>0>=e>>>0)break e}if((u|0)==4){j=Na()|0;break a}o=0;j=ka(c[(c[v>>2]|0)+12>>2]|0,v|0)|0;A=o;o=0;if(A&1){u=8;break a}A=c[h>>2]|0;k=A+4|0;c[h>>2]=k;c[A>>2]=j;j=l+1|0}}while(0);o=0;va(c[(c[x>>2]|0)+48>>2]|0,x|0,j|0,e|0,k|0)|0;A=o;o=0;if(A&1)u=8;else{A=(c[h>>2]|0)+(w-j<<2)|0;c[h>>2]=A;c[g>>2]=(d|0)==(e|0)?A:f+(d-b<<2)|0;Im(z);i=y;return}}}while(0);if((u|0)==8)j=Na()|0;Im(z);Ya(j|0)}function Pp(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;var g=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;z=i;i=i+352|0;u=z+304|0;q=z+48|0;p=z+32|0;l=z+24|0;g=z+8|0;n=z;s=z+308|0;t=z+72|0;k=z+76|0;y=z+68|0;x=z+64|0;v=z+60|0;w=z+56|0;m=n;c[m>>2]=37;c[m+4>>2]=0;m=Bp(n+1|0,58899,c[d+4>>2]|0)|0;c[t>>2]=s;a=Xo()|0;if(m){c[g>>2]=c[d+8>>2];h[g+8>>3]=f;g=Su(s,30,a,n,g)|0}else{h[l>>3]=f;g=Su(s,30,a,n,l)|0}a:do{if((g|0)>29){o=0;a=ua(3)|0;g=o;o=0;g=g&1;if(m){if(!g?(o=0,c[p>>2]=c[d+8>>2],h[p+8>>3]=f,j=va(17,t|0,a|0,n|0,p|0)|0,r=o,o=0,!(r&1)):0)A=12}else if(!g?(o=0,h[q>>3]=f,r=va(17,t|0,a|0,n|0,q|0)|0,q=o,o=0,!(q&1)):0){j=r;A=12}do{if((A|0)==12){a=c[t>>2]|0;if(!a){o=0;xa(6);r=o;o=0;if(r&1)break;g=c[t>>2]|0}else g=a;a=g;n=g;A=16;break a}}while(0);a=Na()|0}else{a=c[t>>2]|0;n=0;j=g;A=16}}while(0);if((A|0)==16){l=a+j|0;m=vp(a,l,d)|0;do{if((a|0)==(s|0)){a=s;g=0;A=22}else{j=Fl(j<<3)|0;if(!j){o=0;xa(6);A=o;o=0;if(A&1){g=0;A=20;break}a=c[t>>2]|0}g=j;k=j;A=22}}while(0);do{if((A|0)==22){o=0;j=ka(68,d|0)|0;t=o;o=0;if(!(t&1)){c[v>>2]=j;o=0;pa(4,a|0,m|0,l|0,k|0,y|0,x|0,v|0);v=o;o=0;if(v&1){a=Na()|0;pm(j)|0;break}pm(j)|0;c[w>>2]=c[b>>2];A=c[y>>2]|0;a=c[x>>2]|0;o=0;c[u>>2]=c[w>>2];a=ja(40,u|0,k|0,A|0,a|0,d|0,e|0)|0;A=o;o=0;if(!(A&1)){c[b>>2]=a;if(g)Gl(g);if(n)Gl(n);i=z;return a|0}else A=20}else A=20}}while(0);if((A|0)==20)a=Na()|0;if(g)Gl(g);if(n)Gl(n)}Ya(a|0);return 0}function Qp(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;q=i;i=i+192|0;l=q;b=q+180|0;n=q+160|0;p=q+12|0;k=q+8|0;m=q+4|0;a[b>>0]=a[58901]|0;a[b+1>>0]=a[58902]|0;a[b+2>>0]=a[58903]|0;a[b+3>>0]=a[58904]|0;a[b+4>>0]=a[58905]|0;a[b+5>>0]=a[58906]|0;h=Xo()|0;c[l>>2]=g;b=Su(n,20,h,b,l)|0;g=n+b|0;h=vp(n,g,e)|0;j=jn(e)|0;c[k>>2]=j;o=0;k=ra(37,k|0,44212)|0;r=o;o=0;if(r&1){r=Na()|0;pm(j)|0;Ya(r|0)}else{pm(j)|0;Pb[c[(c[k>>2]|0)+48>>2]&31](k,n,g,p)|0;r=p+(b<<2)|0;c[m>>2]=c[d>>2];c[l>>2]=c[m>>2];r=Uu(l,p,(h|0)==(g|0)?r:p+(h-n<<2)|0,r,e,f)|0;i=q;return r|0}return 0}function Rp(e,f,g,h,j,k,l,m){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=i;i=i+32|0;w=C+16|0;v=C+12|0;z=C+8|0;x=C+4|0;y=C;n=jn(h)|0;c[z>>2]=n;o=0;z=ra(37,z|0,44220)|0;u=o;o=0;if(u&1){C=Na()|0;pm(n)|0;Ya(C|0)}pm(n)|0;c[j>>2]=0;u=z+8|0;n=c[f>>2]|0;a:do{if((l|0)!=(m|0)){b:while(1){p=n;if(n){if((c[n+12>>2]|0)==(c[n+16>>2]|0)?(Eb[c[(c[n>>2]|0)+36>>2]&127](n)|0)==-1:0){c[f>>2]=0;n=0;p=0}}else n=0;s=(n|0)==0;r=c[g>>2]|0;q=r;do{if(r){if((c[r+12>>2]|0)==(c[r+16>>2]|0)?(Eb[c[(c[r>>2]|0)+36>>2]&127](r)|0)==-1:0){c[g>>2]=0;q=0;B=12;break}if(!s){B=13;break b}}else B=12}while(0);if((B|0)==12){B=0;if(s){B=13;break}else r=0}c:do{if((Gb[c[(c[z>>2]|0)+36>>2]&63](z,a[l>>0]|0,0)|0)<<24>>24==37){r=l+1|0;if((r|0)==(m|0)){B=17;break b}t=Gb[c[(c[z>>2]|0)+36>>2]&63](z,a[r>>0]|0,0)|0;switch(t<<24>>24){case 48:case 69:{s=l+2|0;if((s|0)==(m|0)){B=20;break b}l=r;r=Gb[c[(c[z>>2]|0)+36>>2]&63](z,a[s>>0]|0,0)|0;n=t;break}default:{r=t;n=0}}t=c[(c[e>>2]|0)+36>>2]|0;c[x>>2]=p;c[y>>2]=q;c[v>>2]=c[x>>2];c[w>>2]=c[y>>2];c[f>>2]=Sb[t&15](e,v,w,h,j,k,r,n)|0;l=l+2|0}else{p=a[l>>0]|0;if(p<<24>>24>-1?(A=c[u>>2]|0,(b[A+(p<<24>>24<<1)>>1]&8192)!=0):0){do{l=l+1|0;if((l|0)==(m|0)){l=m;break}p=a[l>>0]|0;if(p<<24>>24<=-1)break}while((b[A+(p<<24>>24<<1)>>1]&8192)!=0);p=r;while(1){if(n){if((c[n+12>>2]|0)==(c[n+16>>2]|0)?(Eb[c[(c[n>>2]|0)+36>>2]&127](n)|0)==-1:0){c[f>>2]=0;n=0}}else n=0;q=(n|0)==0;do{if(r){if((c[r+12>>2]|0)!=(c[r+16>>2]|0))if(q){t=p;break}else break c;if((Eb[c[(c[r>>2]|0)+36>>2]&127](r)|0)!=-1)if(q^(p|0)==0){t=p;r=p;break}else break c;else{c[g>>2]=0;p=0;B=39;break}}else B=39}while(0);if((B|0)==39){B=0;if(q)break c;else{t=p;r=0}}q=n+12|0;p=c[q>>2]|0;s=n+16|0;if((p|0)==(c[s>>2]|0))p=Eb[c[(c[n>>2]|0)+36>>2]&127](n)|0;else p=d[p>>0]|0;if((p&255)<<24>>24<=-1)break c;if(!(b[(c[u>>2]|0)+(p<<24>>24<<1)>>1]&8192))break c;p=c[q>>2]|0;if((p|0)==(c[s>>2]|0)){Eb[c[(c[n>>2]|0)+40>>2]&127](n)|0;p=t;continue}else{c[q>>2]=p+1;p=t;continue}}}q=n+12|0;p=c[q>>2]|0;r=n+16|0;if((p|0)==(c[r>>2]|0))p=Eb[c[(c[n>>2]|0)+36>>2]&127](n)|0;else p=d[p>>0]|0;t=Lb[c[(c[z>>2]|0)+12>>2]&63](z,p&255)|0;if(t<<24>>24!=(Lb[c[(c[z>>2]|0)+12>>2]&63](z,a[l>>0]|0)|0)<<24>>24){B=57;break b}p=c[q>>2]|0;if((p|0)==(c[r>>2]|0))Eb[c[(c[n>>2]|0)+40>>2]&127](n)|0;else c[q>>2]=p+1;l=l+1|0}}while(0);n=c[f>>2]|0;if(!((l|0)!=(m|0)&(c[j>>2]|0)==0))break a}if((B|0)==13){c[j>>2]=4;break}else if((B|0)==17){c[j>>2]=4;break}else if((B|0)==20){c[j>>2]=4;break}else if((B|0)==57){c[j>>2]=4;n=c[f>>2]|0;break}}}while(0);if(n){if((c[n+12>>2]|0)==(c[n+16>>2]|0)?(Eb[c[(c[n>>2]|0)+36>>2]&127](n)|0)==-1:0){c[f>>2]=0;n=0}}else n=0;l=(n|0)==0;p=c[g>>2]|0;do{if(p){if((c[p+12>>2]|0)==(c[p+16>>2]|0)?(Eb[c[(c[p>>2]|0)+36>>2]&127](p)|0)==-1:0){c[g>>2]=0;B=67;break}if(!l)B=68}else B=67}while(0);if((B|0)==67?l:0)B=68;if((B|0)==68)c[j>>2]=c[j>>2]|2;i=C;return n|0}function Sp(a){a=a|0;return}function Tp(a){a=a|0;cj(a);return}function Up(a){a=a|0;return 2}function Vp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Rp(a,k,j,e,f,g,58907,58915)|0;i=h;return a|0}function Wp(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=i;i=i+16|0;k=j+12|0;l=j+8|0;n=j+4|0;m=j;o=b+8|0;o=Eb[c[(c[o>>2]|0)+20>>2]&127](o)|0;c[n>>2]=c[d>>2];c[m>>2]=c[e>>2];e=a[o>>0]|0;p=(e&1)==0;d=p?o+1|0:c[o+8>>2]|0;e=d+(p?(e&255)>>>1:c[o+4>>2]|0)|0;c[l>>2]=c[n>>2];c[k>>2]=c[m>>2];b=Rp(b,l,k,f,g,h,d,e)|0;i=j;return b|0}function Xp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l+4|0;k=l;e=jn(e)|0;c[h>>2]=e;o=0;h=ra(37,h|0,44220)|0;m=o;o=0;if(m&1){m=Na()|0;pm(e)|0;Ya(m|0)}else{pm(e)|0;c[k>>2]=c[d>>2];c[j>>2]=c[k>>2];Yp(a,g+24|0,b,j,f,h);i=l;return c[b>>2]|0}return 0}function Yp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0;h=i;i=i+16|0;j=h+4|0;k=h;a=a+8|0;a=Eb[c[c[a>>2]>>2]&127](a)|0;c[k>>2]=c[e>>2];c[j>>2]=c[k>>2];d=(xu(d,j,a,a+168|0,g,f,0)|0)-a|0;if((d|0)<168)c[b>>2]=((d|0)/12|0|0)%7|0;i=h;return}function Zp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l+4|0;k=l;e=jn(e)|0;c[h>>2]=e;o=0;h=ra(37,h|0,44220)|0;m=o;o=0;if(m&1){m=Na()|0;pm(e)|0;Ya(m|0)}else{pm(e)|0;c[k>>2]=c[d>>2];c[j>>2]=c[k>>2];_p(a,g+16|0,b,j,f,h);i=l;return c[b>>2]|0}return 0}function _p(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0;h=i;i=i+16|0;j=h+4|0;k=h;a=a+8|0;a=Eb[c[(c[a>>2]|0)+4>>2]&127](a)|0;c[k>>2]=c[e>>2];c[j>>2]=c[k>>2];d=(xu(d,j,a,a+288|0,g,f,0)|0)-a|0;if((d|0)<288)c[b>>2]=((d|0)/12|0|0)%12|0;i=h;return}function $p(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l+4|0;k=l;e=jn(e)|0;c[h>>2]=e;o=0;h=ra(37,h|0,44220)|0;m=o;o=0;if(m&1){m=Na()|0;pm(e)|0;Ya(m|0)}else{pm(e)|0;c[k>>2]=c[d>>2];c[j>>2]=c[k>>2];aq(a,g+20|0,b,j,f,h);i=l;return c[b>>2]|0}return 0}function aq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,4)|0;if(!(c[f>>2]&4)){if((a|0)<69)a=a+2e3|0;else a=(a+-69|0)>>>0<31?a+1900|0:a;c[b>>2]=a+-1900}i=h;return}function bq(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0;U=i;i=i+144|0;l=U+132|0;k=U+116|0;N=U+128|0;x=U+124|0;I=U+120|0;O=U+112|0;P=U+108|0;Q=U+104|0;R=U+100|0;S=U+96|0;T=U+92|0;m=U+88|0;n=U+84|0;p=U+80|0;q=U+76|0;r=U+72|0;s=U+68|0;t=U+64|0;u=U+60|0;v=U+56|0;w=U+52|0;y=U+48|0;z=U+44|0;A=U+40|0;B=U+36|0;C=U+32|0;D=U+28|0;E=U+24|0;F=U+20|0;G=U+16|0;H=U+12|0;J=U+8|0;K=U+4|0;L=U;c[g>>2]=0;M=jn(f)|0;c[N>>2]=M;o=0;N=ra(37,N|0,44220)|0;W=o;o=0;if(W&1){W=Na()|0;pm(M)|0;Ya(W|0)}pm(M)|0;do{switch(j<<24>>24|0){case 65:case 97:{c[x>>2]=c[e>>2];c[l>>2]=c[x>>2];Yp(b,h+24|0,d,l,g,N);V=28;break}case 104:case 66:case 98:{c[I>>2]=c[e>>2];c[l>>2]=c[I>>2];_p(b,h+16|0,d,l,g,N);V=28;break}case 99:{V=b+8|0;V=Eb[c[(c[V>>2]|0)+12>>2]&127](V)|0;c[O>>2]=c[d>>2];c[P>>2]=c[e>>2];j=a[V>>0]|0;e=(j&1)==0;W=e?V+1|0:c[V+8>>2]|0;V=W+(e?(j&255)>>>1:c[V+4>>2]|0)|0;c[k>>2]=c[O>>2];c[l>>2]=c[P>>2];c[d>>2]=Rp(b,k,l,f,g,h,W,V)|0;V=28;break}case 101:case 100:{c[Q>>2]=c[e>>2];c[l>>2]=c[Q>>2];cq(b,h+12|0,d,l,g,N);V=28;break}case 68:{c[R>>2]=c[d>>2];c[S>>2]=c[e>>2];c[k>>2]=c[R>>2];c[l>>2]=c[S>>2];c[d>>2]=Rp(b,k,l,f,g,h,58915,58923)|0;V=28;break}case 70:{c[T>>2]=c[d>>2];c[m>>2]=c[e>>2];c[k>>2]=c[T>>2];c[l>>2]=c[m>>2];c[d>>2]=Rp(b,k,l,f,g,h,58923,58931)|0;V=28;break}case 72:{c[n>>2]=c[e>>2];c[l>>2]=c[n>>2];dq(b,h+8|0,d,l,g,N);V=28;break}case 73:{c[p>>2]=c[e>>2];c[l>>2]=c[p>>2];eq(b,h+8|0,d,l,g,N);V=28;break}case 106:{c[q>>2]=c[e>>2];c[l>>2]=c[q>>2];fq(b,h+28|0,d,l,g,N);V=28;break}case 109:{c[r>>2]=c[e>>2];c[l>>2]=c[r>>2];gq(b,h+16|0,d,l,g,N);V=28;break}case 77:{c[s>>2]=c[e>>2];c[l>>2]=c[s>>2];hq(b,h+4|0,d,l,g,N);V=28;break}case 116:case 110:{c[t>>2]=c[e>>2];c[l>>2]=c[t>>2];iq(b,d,l,g,N);V=28;break}case 112:{c[u>>2]=c[e>>2];c[l>>2]=c[u>>2];jq(b,h+8|0,d,l,g,N);V=28;break}case 114:{c[v>>2]=c[d>>2];c[w>>2]=c[e>>2];c[k>>2]=c[v>>2];c[l>>2]=c[w>>2];c[d>>2]=Rp(b,k,l,f,g,h,58931,58942)|0;V=28;break}case 82:{c[y>>2]=c[d>>2];c[z>>2]=c[e>>2];c[k>>2]=c[y>>2];c[l>>2]=c[z>>2];c[d>>2]=Rp(b,k,l,f,g,h,58942,58947)|0;V=28;break}case 83:{c[A>>2]=c[e>>2];c[l>>2]=c[A>>2];kq(b,h,d,l,g,N);V=28;break}case 84:{c[B>>2]=c[d>>2];c[C>>2]=c[e>>2];c[k>>2]=c[B>>2];c[l>>2]=c[C>>2];c[d>>2]=Rp(b,k,l,f,g,h,58947,58955)|0;V=28;break}case 119:{c[D>>2]=c[e>>2];c[l>>2]=c[D>>2];lq(b,h+24|0,d,l,g,N);V=28;break}case 120:{W=c[(c[b>>2]|0)+20>>2]|0;c[E>>2]=c[d>>2];c[F>>2]=c[e>>2];c[k>>2]=c[E>>2];c[l>>2]=c[F>>2];k=Db[W&63](b,k,l,f,g,h)|0;break}case 88:{V=b+8|0;V=Eb[c[(c[V>>2]|0)+24>>2]&127](V)|0;c[G>>2]=c[d>>2];c[H>>2]=c[e>>2];j=a[V>>0]|0;e=(j&1)==0;W=e?V+1|0:c[V+8>>2]|0;V=W+(e?(j&255)>>>1:c[V+4>>2]|0)|0;c[k>>2]=c[G>>2];c[l>>2]=c[H>>2];c[d>>2]=Rp(b,k,l,f,g,h,W,V)|0;V=28;break}case 121:{c[J>>2]=c[e>>2];c[l>>2]=c[J>>2];aq(b,h+20|0,d,l,g,N);V=28;break}case 89:{c[K>>2]=c[e>>2];c[l>>2]=c[K>>2];mq(b,h+20|0,d,l,g,N);V=28;break}case 37:{c[L>>2]=c[e>>2];c[l>>2]=c[L>>2];nq(b,d,l,g,N);V=28;break}default:{c[g>>2]=c[g>>2]|4;V=28}}}while(0);if((V|0)==28)k=c[d>>2]|0;i=U;return k|0}function cq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a+-1|0)>>>0<31&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function dq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<24&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function eq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a+-1|0)>>>0<12&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function fq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,3)|0;d=c[f>>2]|0;if((a|0)<366&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function gq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<13&(d&4|0)==0)c[b>>2]=a+-1;else c[f>>2]=d|4;i=h;return}function hq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<60&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function iq(a,e,f,g,h){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0;j=h+8|0;a:while(1){h=c[e>>2]|0;do{if(h){if((c[h+12>>2]|0)==(c[h+16>>2]|0))if((Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1){c[e>>2]=0;h=0;break}else{h=c[e>>2]|0;break}}else h=0}while(0);h=(h|0)==0;a=c[f>>2]|0;do{if(a){if((c[a+12>>2]|0)!=(c[a+16>>2]|0))if(h)break;else break a;if((Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0)!=-1)if(h)break;else break a;else{c[f>>2]=0;k=12;break}}else k=12}while(0);if((k|0)==12){k=0;if(h){a=0;break}else a=0}h=c[e>>2]|0;i=c[h+12>>2]|0;if((i|0)==(c[h+16>>2]|0))h=Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0;else h=d[i>>0]|0;if((h&255)<<24>>24<=-1)break;if(!(b[(c[j>>2]|0)+(h<<24>>24<<1)>>1]&8192))break;h=c[e>>2]|0;a=h+12|0;i=c[a>>2]|0;if((i|0)==(c[h+16>>2]|0)){Eb[c[(c[h>>2]|0)+40>>2]&127](h)|0;continue}else{c[a>>2]=i+1;continue}}h=c[e>>2]|0;do{if(h){if((c[h+12>>2]|0)==(c[h+16>>2]|0))if((Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1){c[e>>2]=0;h=0;break}else{h=c[e>>2]|0;break}}else h=0}while(0);h=(h|0)==0;do{if(a){if((c[a+12>>2]|0)==(c[a+16>>2]|0)?(Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1:0){c[f>>2]=0;k=32;break}if(!h)k=33}else k=32}while(0);if((k|0)==32?h:0)k=33;if((k|0)==33)c[g>>2]=c[g>>2]|2;return}function jq(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0;n=i;i=i+16|0;k=n+4|0;l=n;m=b+8|0;m=Eb[c[(c[m>>2]|0)+8>>2]&127](m)|0;b=a[m>>0]|0;if(!(b&1))j=(b&255)>>>1;else j=c[m+4>>2]|0;b=a[m+12>>0]|0;if(!(b&1))b=(b&255)>>>1;else b=c[m+16>>2]|0;do{if((j|0)!=(0-b|0)){c[l>>2]=c[f>>2];c[k>>2]=c[l>>2];b=xu(e,k,m,m+24|0,h,g,0)|0;j=c[d>>2]|0;if((b|0)==(m|0)&(j|0)==12){c[d>>2]=0;break}if((j|0)<12&(b-m|0)==12)c[d>>2]=j+12}else c[g>>2]=c[g>>2]|4}while(0);i=n;return}function kq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<61&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function lq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,1)|0;d=c[f>>2]|0;if((a|0)<7&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function mq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Vu(d,a,f,g,4)|0;if(!(c[f>>2]&4))c[b>>2]=a+-1900;i=h;return}function nq(a,b,e,f,g){a=a|0;b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;a=c[b>>2]|0;do{if(a){if((c[a+12>>2]|0)==(c[a+16>>2]|0))if((Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1){c[b>>2]=0;a=0;break}else{a=c[b>>2]|0;break}}else a=0}while(0);h=(a|0)==0;a=c[e>>2]|0;do{if(a){if((c[a+12>>2]|0)==(c[a+16>>2]|0)?(Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1:0){c[e>>2]=0;j=11;break}if(h){i=a;j=13}else j=12}else j=11}while(0);if((j|0)==11)if(h)j=12;else{i=0;j=13}a:do{if((j|0)==12)c[f>>2]=c[f>>2]|6;else if((j|0)==13){a=c[b>>2]|0;h=c[a+12>>2]|0;if((h|0)==(c[a+16>>2]|0))a=Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0;else a=d[h>>0]|0;if((Gb[c[(c[g>>2]|0)+36>>2]&63](g,a&255,0)|0)<<24>>24!=37){c[f>>2]=c[f>>2]|4;break}a=c[b>>2]|0;h=a+12|0;g=c[h>>2]|0;if((g|0)==(c[a+16>>2]|0)){Eb[c[(c[a>>2]|0)+40>>2]&127](a)|0;a=c[b>>2]|0;if(!a)a=0;else j=21}else{c[h>>2]=g+1;j=21}do{if((j|0)==21)if((c[a+12>>2]|0)==(c[a+16>>2]|0))if((Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1){c[b>>2]=0;a=0;break}else{a=c[b>>2]|0;break}}while(0);a=(a|0)==0;do{if(i){if((c[i+12>>2]|0)==(c[i+16>>2]|0)?(Eb[c[(c[i>>2]|0)+36>>2]&127](i)|0)==-1:0){c[e>>2]=0;j=30;break}if(a)break a}else j=30}while(0);if((j|0)==30?!a:0)break;c[f>>2]=c[f>>2]|2}}while(0);return}function oq(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=i;i=i+32|0;s=x+16|0;r=x+12|0;v=x+8|0;t=x+4|0;u=x;k=jn(e)|0;c[v>>2]=k;o=0;v=ra(37,v|0,44212)|0;q=o;o=0;if(q&1){x=Na()|0;pm(k)|0;Ya(x|0)}pm(k)|0;c[f>>2]=0;k=c[b>>2]|0;a:do{if((h|0)!=(j|0)){b:while(1){m=k;if(k){l=c[k+12>>2]|0;if((l|0)==(c[k+16>>2]|0))l=Eb[c[(c[k>>2]|0)+36>>2]&127](k)|0;else l=c[l>>2]|0;if((l|0)==-1){c[b>>2]=0;k=0;p=1;q=0}else{p=0;q=m}}else{k=0;p=1;q=m}n=c[d>>2]|0;l=n;do{if(n){m=c[n+12>>2]|0;if((m|0)==(c[n+16>>2]|0))m=Eb[c[(c[n>>2]|0)+36>>2]&127](n)|0;else m=c[m>>2]|0;if((m|0)!=-1)if(p)break;else{w=17;break b}else{c[d>>2]=0;l=0;w=15;break}}else w=15}while(0);if((w|0)==15){w=0;if(p){w=17;break}else n=0}c:do{if((Gb[c[(c[v>>2]|0)+52>>2]&63](v,c[h>>2]|0,0)|0)<<24>>24==37){m=h+4|0;if((m|0)==(j|0)){w=21;break b}p=Gb[c[(c[v>>2]|0)+52>>2]&63](v,c[m>>2]|0,0)|0;switch(p<<24>>24){case 48:case 69:{n=h+8|0;if((n|0)==(j|0)){w=24;break b}h=m;m=Gb[c[(c[v>>2]|0)+52>>2]&63](v,c[n>>2]|0,0)|0;k=p;break}default:{m=p;k=0}}p=c[(c[a>>2]|0)+36>>2]|0;c[t>>2]=q;c[u>>2]=l;c[r>>2]=c[t>>2];c[s>>2]=c[u>>2];c[b>>2]=Sb[p&15](a,r,s,e,f,g,m,k)|0;h=h+8|0}else{if(!(Gb[c[(c[v>>2]|0)+12>>2]&63](v,8192,c[h>>2]|0)|0)){m=k+12|0;l=c[m>>2]|0;n=k+16|0;if((l|0)==(c[n>>2]|0))l=Eb[c[(c[k>>2]|0)+36>>2]&127](k)|0;else l=c[l>>2]|0;q=Lb[c[(c[v>>2]|0)+28>>2]&63](v,l)|0;if((q|0)!=(Lb[c[(c[v>>2]|0)+28>>2]&63](v,c[h>>2]|0)|0)){w=61;break b}l=c[m>>2]|0;if((l|0)==(c[n>>2]|0))Eb[c[(c[k>>2]|0)+40>>2]&127](k)|0;else c[m>>2]=l+4;h=h+4|0;break}do{h=h+4|0;if((h|0)==(j|0)){h=j;break}}while(Gb[c[(c[v>>2]|0)+12>>2]&63](v,8192,c[h>>2]|0)|0);l=n;p=n;while(1){if(k){m=c[k+12>>2]|0;if((m|0)==(c[k+16>>2]|0))m=Eb[c[(c[k>>2]|0)+36>>2]&127](k)|0;else m=c[m>>2]|0;if((m|0)==-1){c[b>>2]=0;n=1;k=0}else n=0}else{n=1;k=0}do{if(p){m=c[p+12>>2]|0;if((m|0)==(c[p+16>>2]|0))m=Eb[c[(c[p>>2]|0)+36>>2]&127](p)|0;else m=c[m>>2]|0;if((m|0)!=-1)if(n^(l|0)==0){q=l;p=l;break}else break c;else{c[d>>2]=0;l=0;w=44;break}}else w=44}while(0);if((w|0)==44){w=0;if(n)break c;else{q=l;p=0}}m=k+12|0;l=c[m>>2]|0;n=k+16|0;if((l|0)==(c[n>>2]|0))l=Eb[c[(c[k>>2]|0)+36>>2]&127](k)|0;else l=c[l>>2]|0;if(!(Gb[c[(c[v>>2]|0)+12>>2]&63](v,8192,l)|0))break c;l=c[m>>2]|0;if((l|0)==(c[n>>2]|0)){Eb[c[(c[k>>2]|0)+40>>2]&127](k)|0;l=q;continue}else{c[m>>2]=l+4;l=q;continue}}}}while(0);k=c[b>>2]|0;if(!((h|0)!=(j|0)&(c[f>>2]|0)==0))break a}if((w|0)==17){c[f>>2]=4;break}else if((w|0)==21){c[f>>2]=4;break}else if((w|0)==24){c[f>>2]=4;break}else if((w|0)==61){c[f>>2]=4;k=c[b>>2]|0;break}}}while(0);if(k){h=c[k+12>>2]|0;if((h|0)==(c[k+16>>2]|0))h=Eb[c[(c[k>>2]|0)+36>>2]&127](k)|0;else h=c[h>>2]|0;if((h|0)==-1){c[b>>2]=0;k=0;m=1}else m=0}else{k=0;m=1}h=c[d>>2]|0;do{if(h){l=c[h+12>>2]|0;if((l|0)==(c[h+16>>2]|0))h=Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0;else h=c[l>>2]|0;if((h|0)!=-1)if(m)break;else{w=76;break}else{c[d>>2]=0;w=74;break}}else w=74}while(0);if((w|0)==74?m:0)w=76;if((w|0)==76)c[f>>2]=c[f>>2]|2;i=x;return k|0}function pq(a){a=a|0;return}function qq(a){a=a|0;cj(a);return}function rq(a){a=a|0;return 2}function sq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=oq(a,k,j,e,f,g,44788,44820)|0;i=h;return a|0}function tq(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;j=i;i=i+16|0;k=j+12|0;l=j+8|0;n=j+4|0;m=j;q=b+8|0;q=Eb[c[(c[q>>2]|0)+20>>2]&127](q)|0;c[n>>2]=c[d>>2];c[m>>2]=c[e>>2];o=a[q>>0]|0;p=(o&1)==0;e=q+4|0;d=p?e:c[q+8>>2]|0;e=d+((p?(o&255)>>>1:c[e>>2]|0)<<2)|0;c[l>>2]=c[n>>2];c[k>>2]=c[m>>2];b=oq(b,l,k,f,g,h,d,e)|0;i=j;return b|0}function uq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l+4|0;k=l;e=jn(e)|0;c[h>>2]=e;o=0;h=ra(37,h|0,44212)|0;m=o;o=0;if(m&1){m=Na()|0;pm(e)|0;Ya(m|0)}else{pm(e)|0;c[k>>2]=c[d>>2];c[j>>2]=c[k>>2];vq(a,g+24|0,b,j,f,h);i=l;return c[b>>2]|0}return 0}function vq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0;h=i;i=i+16|0;j=h+4|0;k=h;a=a+8|0;a=Eb[c[c[a>>2]>>2]&127](a)|0;c[k>>2]=c[e>>2];c[j>>2]=c[k>>2];d=(Iu(d,j,a,a+168|0,g,f,0)|0)-a|0;if((d|0)<168)c[b>>2]=((d|0)/12|0|0)%7|0;i=h;return}function wq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l+4|0;k=l;e=jn(e)|0;c[h>>2]=e;o=0;h=ra(37,h|0,44212)|0;m=o;o=0;if(m&1){m=Na()|0;pm(e)|0;Ya(m|0)}else{pm(e)|0;c[k>>2]=c[d>>2];c[j>>2]=c[k>>2];xq(a,g+16|0,b,j,f,h);i=l;return c[b>>2]|0}return 0}function xq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0;h=i;i=i+16|0;j=h+4|0;k=h;a=a+8|0;a=Eb[c[(c[a>>2]|0)+4>>2]&127](a)|0;c[k>>2]=c[e>>2];c[j>>2]=c[k>>2];d=(Iu(d,j,a,a+288|0,g,f,0)|0)-a|0;if((d|0)<288)c[b>>2]=((d|0)/12|0|0)%12|0;i=h;return}function yq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l+4|0;k=l;e=jn(e)|0;c[h>>2]=e;o=0;h=ra(37,h|0,44212)|0;m=o;o=0;if(m&1){m=Na()|0;pm(e)|0;Ya(m|0)}else{pm(e)|0;c[k>>2]=c[d>>2];c[j>>2]=c[k>>2];zq(a,g+20|0,b,j,f,h);i=l;return c[b>>2]|0}return 0}function zq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,4)|0;if(!(c[f>>2]&4)){if((a|0)<69)a=a+2e3|0;else a=(a+-69|0)>>>0<31?a+1900|0:a;c[b>>2]=a+-1900}i=h;return}function Aq(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0;U=i;i=i+144|0;l=U+132|0;k=U+116|0;N=U+128|0;x=U+124|0;I=U+120|0;O=U+112|0;P=U+108|0;Q=U+104|0;R=U+100|0;S=U+96|0;T=U+92|0;m=U+88|0;n=U+84|0;p=U+80|0;q=U+76|0;r=U+72|0;s=U+68|0;t=U+64|0;u=U+60|0;v=U+56|0;w=U+52|0;y=U+48|0;z=U+44|0;A=U+40|0;B=U+36|0;C=U+32|0;D=U+28|0;E=U+24|0;F=U+20|0;G=U+16|0;H=U+12|0;J=U+8|0;K=U+4|0;L=U;c[g>>2]=0;M=jn(f)|0;c[N>>2]=M;o=0;N=ra(37,N|0,44212)|0;W=o;o=0;if(W&1){W=Na()|0;pm(M)|0;Ya(W|0)}pm(M)|0;do{switch(j<<24>>24|0){case 65:case 97:{c[x>>2]=c[e>>2];c[l>>2]=c[x>>2];vq(b,h+24|0,d,l,g,N);V=28;break}case 104:case 66:case 98:{c[I>>2]=c[e>>2];c[l>>2]=c[I>>2];xq(b,h+16|0,d,l,g,N);V=28;break}case 99:{W=b+8|0;W=Eb[c[(c[W>>2]|0)+12>>2]&127](W)|0;c[O>>2]=c[d>>2];c[P>>2]=c[e>>2];j=a[W>>0]|0;e=(j&1)==0;V=W+4|0;W=e?V:c[W+8>>2]|0;V=W+((e?(j&255)>>>1:c[V>>2]|0)<<2)|0;c[k>>2]=c[O>>2];c[l>>2]=c[P>>2];c[d>>2]=oq(b,k,l,f,g,h,W,V)|0;V=28;break}case 101:case 100:{c[Q>>2]=c[e>>2];c[l>>2]=c[Q>>2];Bq(b,h+12|0,d,l,g,N);V=28;break}case 68:{c[R>>2]=c[d>>2];c[S>>2]=c[e>>2];c[k>>2]=c[R>>2];c[l>>2]=c[S>>2];c[d>>2]=oq(b,k,l,f,g,h,44820,44852)|0;V=28;break}case 70:{c[T>>2]=c[d>>2];c[m>>2]=c[e>>2];c[k>>2]=c[T>>2];c[l>>2]=c[m>>2];c[d>>2]=oq(b,k,l,f,g,h,44852,44884)|0;V=28;break}case 72:{c[n>>2]=c[e>>2];c[l>>2]=c[n>>2];Cq(b,h+8|0,d,l,g,N);V=28;break}case 73:{c[p>>2]=c[e>>2];c[l>>2]=c[p>>2];Dq(b,h+8|0,d,l,g,N);V=28;break}case 106:{c[q>>2]=c[e>>2];c[l>>2]=c[q>>2];Eq(b,h+28|0,d,l,g,N);V=28;break}case 109:{c[r>>2]=c[e>>2];c[l>>2]=c[r>>2];Fq(b,h+16|0,d,l,g,N);V=28;break}case 77:{c[s>>2]=c[e>>2];c[l>>2]=c[s>>2];Gq(b,h+4|0,d,l,g,N);V=28;break}case 116:case 110:{c[t>>2]=c[e>>2];c[l>>2]=c[t>>2];Hq(b,d,l,g,N);V=28;break}case 112:{c[u>>2]=c[e>>2];c[l>>2]=c[u>>2];Iq(b,h+8|0,d,l,g,N);V=28;break}case 114:{c[v>>2]=c[d>>2];c[w>>2]=c[e>>2];c[k>>2]=c[v>>2];c[l>>2]=c[w>>2];c[d>>2]=oq(b,k,l,f,g,h,44884,44928)|0;V=28;break}case 82:{c[y>>2]=c[d>>2];c[z>>2]=c[e>>2];c[k>>2]=c[y>>2];c[l>>2]=c[z>>2];c[d>>2]=oq(b,k,l,f,g,h,44928,44948)|0;V=28;break}case 83:{c[A>>2]=c[e>>2];c[l>>2]=c[A>>2];Jq(b,h,d,l,g,N);V=28;break}case 84:{c[B>>2]=c[d>>2];c[C>>2]=c[e>>2];c[k>>2]=c[B>>2];c[l>>2]=c[C>>2];c[d>>2]=oq(b,k,l,f,g,h,44948,44980)|0;V=28;break}case 119:{c[D>>2]=c[e>>2];c[l>>2]=c[D>>2];Kq(b,h+24|0,d,l,g,N);V=28;break}case 120:{W=c[(c[b>>2]|0)+20>>2]|0;c[E>>2]=c[d>>2];c[F>>2]=c[e>>2];c[k>>2]=c[E>>2];c[l>>2]=c[F>>2];k=Db[W&63](b,k,l,f,g,h)|0;break}case 88:{W=b+8|0;W=Eb[c[(c[W>>2]|0)+24>>2]&127](W)|0;c[G>>2]=c[d>>2];c[H>>2]=c[e>>2];j=a[W>>0]|0;e=(j&1)==0;V=W+4|0;W=e?V:c[W+8>>2]|0;V=W+((e?(j&255)>>>1:c[V>>2]|0)<<2)|0;c[k>>2]=c[G>>2];c[l>>2]=c[H>>2];c[d>>2]=oq(b,k,l,f,g,h,W,V)|0;V=28;break}case 121:{c[J>>2]=c[e>>2];c[l>>2]=c[J>>2];zq(b,h+20|0,d,l,g,N);V=28;break}case 89:{c[K>>2]=c[e>>2];c[l>>2]=c[K>>2];Lq(b,h+20|0,d,l,g,N);V=28;break}case 37:{c[L>>2]=c[e>>2];c[l>>2]=c[L>>2];Mq(b,d,l,g,N);V=28;break}default:{c[g>>2]=c[g>>2]|4;V=28}}}while(0);if((V|0)==28)k=c[d>>2]|0;i=U;return k|0}function Bq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a+-1|0)>>>0<31&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function Cq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<24&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function Dq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a+-1|0)>>>0<12&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function Eq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,3)|0;d=c[f>>2]|0;if((a|0)<366&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function Fq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<13&(d&4|0)==0)c[b>>2]=a+-1;else c[f>>2]=d|4;i=h;return}function Gq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<60&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function Hq(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;a:while(1){a=c[b>>2]|0;do{if(a){g=c[a+12>>2]|0;if((g|0)==(c[a+16>>2]|0))a=Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0;else a=c[g>>2]|0;if((a|0)==-1){c[b>>2]=0;h=1;break}else{h=(c[b>>2]|0)==0;break}}else h=1}while(0);g=c[d>>2]|0;do{if(g){a=c[g+12>>2]|0;if((a|0)==(c[g+16>>2]|0))a=Eb[c[(c[g>>2]|0)+36>>2]&127](g)|0;else a=c[a>>2]|0;if((a|0)!=-1)if(h){h=g;break}else{h=g;break a}else{c[d>>2]=0;i=15;break}}else i=15}while(0);if((i|0)==15){i=0;if(h){h=0;break}else h=0}a=c[b>>2]|0;g=c[a+12>>2]|0;if((g|0)==(c[a+16>>2]|0))a=Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0;else a=c[g>>2]|0;if(!(Gb[c[(c[f>>2]|0)+12>>2]&63](f,8192,a)|0))break;a=c[b>>2]|0;g=a+12|0;h=c[g>>2]|0;if((h|0)==(c[a+16>>2]|0)){Eb[c[(c[a>>2]|0)+40>>2]&127](a)|0;continue}else{c[g>>2]=h+4;continue}}a=c[b>>2]|0;do{if(a){g=c[a+12>>2]|0;if((g|0)==(c[a+16>>2]|0))a=Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0;else a=c[g>>2]|0;if((a|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}else g=1}while(0);do{if(h){a=c[h+12>>2]|0;if((a|0)==(c[h+16>>2]|0))a=Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0;else a=c[a>>2]|0;if((a|0)!=-1)if(g)break;else{i=39;break}else{c[d>>2]=0;i=37;break}}else i=37}while(0);if((i|0)==37?g:0)i=39;if((i|0)==39)c[e>>2]=c[e>>2]|2;return}function Iq(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0;n=i;i=i+16|0;k=n+4|0;l=n;m=b+8|0;m=Eb[c[(c[m>>2]|0)+8>>2]&127](m)|0;b=a[m>>0]|0;if(!(b&1))j=(b&255)>>>1;else j=c[m+4>>2]|0;b=a[m+12>>0]|0;if(!(b&1))b=(b&255)>>>1;else b=c[m+16>>2]|0;do{if((j|0)!=(0-b|0)){c[l>>2]=c[f>>2];c[k>>2]=c[l>>2];b=Iu(e,k,m,m+24|0,h,g,0)|0;j=c[d>>2]|0;if((b|0)==(m|0)&(j|0)==12){c[d>>2]=0;break}if((j|0)<12&(b-m|0)==12)c[d>>2]=j+12}else c[g>>2]=c[g>>2]|4}while(0);i=n;return}function Jq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,2)|0;d=c[f>>2]|0;if((a|0)<61&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function Kq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,1)|0;d=c[f>>2]|0;if((a|0)<7&(d&4|0)==0)c[b>>2]=a;else c[f>>2]=d|4;i=h;return}function Lq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;h=i;i=i+16|0;a=h+4|0;j=h;c[j>>2]=c[e>>2];c[a>>2]=c[j>>2];a=Wu(d,a,f,g,4)|0;if(!(c[f>>2]&4))c[b>>2]=a+-1900;i=h;return}function Mq(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;a=c[b>>2]|0;do{if(a){g=c[a+12>>2]|0;if((g|0)==(c[a+16>>2]|0))a=Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0;else a=c[g>>2]|0;if((a|0)==-1){c[b>>2]=0;h=1;break}else{h=(c[b>>2]|0)==0;break}}else h=1}while(0);g=c[d>>2]|0;do{if(g){a=c[g+12>>2]|0;if((a|0)==(c[g+16>>2]|0))a=Eb[c[(c[g>>2]|0)+36>>2]&127](g)|0;else a=c[a>>2]|0;if((a|0)!=-1)if(h){i=g;j=17;break}else{j=16;break}else{c[d>>2]=0;j=14;break}}else j=14}while(0);if((j|0)==14)if(h)j=16;else{i=0;j=17}a:do{if((j|0)==16)c[e>>2]=c[e>>2]|6;else if((j|0)==17){a=c[b>>2]|0;g=c[a+12>>2]|0;if((g|0)==(c[a+16>>2]|0))a=Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0;else a=c[g>>2]|0;if((Gb[c[(c[f>>2]|0)+52>>2]&63](f,a,0)|0)<<24>>24!=37){c[e>>2]=c[e>>2]|4;break}a=c[b>>2]|0;g=a+12|0;h=c[g>>2]|0;if((h|0)==(c[a+16>>2]|0)){Eb[c[(c[a>>2]|0)+40>>2]&127](a)|0;a=c[b>>2]|0;if(!a)g=1;else j=25}else{c[g>>2]=h+4;j=25}do{if((j|0)==25){g=c[a+12>>2]|0;if((g|0)==(c[a+16>>2]|0))a=Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0;else a=c[g>>2]|0;if((a|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}}while(0);do{if(i){a=c[i+12>>2]|0;if((a|0)==(c[i+16>>2]|0))a=Eb[c[(c[i>>2]|0)+36>>2]&127](i)|0;else a=c[a>>2]|0;if((a|0)!=-1)if(g)break a;else break;else{c[d>>2]=0;j=37;break}}else j=37}while(0);if((j|0)==37?!g:0)break;c[e>>2]=c[e>>2]|2}}while(0);return}function Nq(a){a=a|0;Oq(a+8|0);return}function Oq(a){a=a|0;var b=0,d=0,e=0;b=c[a>>2]|0;o=0;d=ua(3)|0;e=o;o=0;do{if(!(e&1)){if((b|0)!=(d|0)?(o=0,ha(188,c[a>>2]|0),e=o,o=0,e&1):0)break;return}}while(0);e=Na(0)|0;ec(e)}function Pq(a){a=a|0;Oq(a+8|0);cj(a);return}function Qq(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0;l=i;i=i+112|0;k=l+4|0;e=l;c[e>>2]=k+100;Rq(b+8|0,k,e,g,h,j);g=c[e>>2]|0;e=c[d>>2]|0;if((k|0)!=(g|0))do{j=a[k>>0]|0;do{if(e){f=e+24|0;h=c[f>>2]|0;if((h|0)==(c[e+28>>2]|0)){d=(Lb[c[(c[e>>2]|0)+52>>2]&63](e,j&255)|0)==-1;e=d?0:e;break}else{c[f>>2]=h+1;a[h>>0]=j;break}}else e=0}while(0);k=k+1|0}while((k|0)!=(g|0));i=l;return e|0}function Rq(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0;m=i;i=i+16|0;l=m;a[l>>0]=37;j=l+1|0;a[j>>0]=g;k=l+2|0;a[k>>0]=h;a[l+3>>0]=0;if(h<<24>>24){a[j>>0]=h;a[k>>0]=g}c[e>>2]=d+(Ra(d|0,(c[e>>2]|0)-d|0,l|0,f|0,c[b>>2]|0)|0);i=m;return}function Sq(a){a=a|0;Oq(a+8|0);return}function Tq(a){a=a|0;Oq(a+8|0);cj(a);return}function Uq(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0;j=i;i=i+416|0;e=j+8|0;d=j;c[d>>2]=e+400;Vq(a+8|0,e,d,f,g,h);a=c[d>>2]|0;d=c[b>>2]|0;if((e|0)!=(a|0)){f=e;do{e=c[f>>2]|0;if(!d)d=0;else{g=d+24|0;h=c[g>>2]|0;if((h|0)==(c[d+28>>2]|0))e=Lb[c[(c[d>>2]|0)+52>>2]&63](d,e)|0;else{c[g>>2]=h+4;c[h>>2]=e}d=(e|0)==-1?0:d}f=f+4|0}while((f|0)!=(a|0))}i=j;return d|0}function Vq(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+128|0;l=h+16|0;m=h+12|0;j=h;k=h+8|0;c[m>>2]=l+100;Rq(a,l,m,e,f,g);f=j;c[f>>2]=0;c[f+4>>2]=0;c[k>>2]=l;f=(c[d>>2]|0)-b>>2;g=qk(c[a>>2]|0)|0;o=0;f=va(18,b|0,k|0,f|0,j|0)|0;a=o;o=0;if(a&1){f=Na()|0;if((g|0)!=0?(o=0,ka(75,g|0)|0,m=o,o=0,m&1):0){m=Na(0)|0;ec(m)}Ya(f|0)}if((g|0)!=0?(o=0,ka(75,g|0)|0,m=o,o=0,m&1):0){m=Na(0)|0;ec(m)}if((f|0)==-1)Rr(58955);else{c[d>>2]=b+(f<<2);i=h;return}}function Wq(a){a=a|0;return}function Xq(a){a=a|0;cj(a);return}function Yq(a){a=a|0;return 127}function Zq(a){a=a|0;return 127}function _q(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function $q(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function ar(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function br(a,b){a=a|0;b=b|0;Hm(a,1,45);return}function cr(a){a=a|0;return 0}function dr(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function er(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function fr(a){a=a|0;return}function gr(a){a=a|0;cj(a);return}function hr(a){a=a|0;return 127}function ir(a){a=a|0;return 127}function jr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function kr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function lr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function mr(a,b){a=a|0;b=b|0;Hm(a,1,45);return}function nr(a){a=a|0;return 0}function or(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function pr(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function qr(a){a=a|0;return}function rr(a){a=a|0;cj(a);return}function sr(a){a=a|0;return 2147483647}function tr(a){a=a|0;return 2147483647}function ur(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function vr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function wr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function xr(a,b){a=a|0;b=b|0;Vm(a,1,45);return}function yr(a){a=a|0;return 0}function zr(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function Ar(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function Br(a){a=a|0;return}function Cr(a){a=a|0;cj(a);return}function Dr(a){a=a|0;return 2147483647}function Er(a){a=a|0;return 2147483647}function Fr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function Gr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function Hr(a,b){a=a|0;b=b|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function Ir(a,b){a=a|0;b=b|0;Vm(a,1,45);return}function Jr(a){a=a|0;return 0}function Kr(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function Lr(b,c){b=b|0;c=c|0;a[b>>0]=2;a[b+1>>0]=3;a[b+2>>0]=0;a[b+3>>0]=4;return}function Mr(a){a=a|0;return}function Nr(a){a=a|0;cj(a);return}function Or(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;B=i;i=i+240|0;z=B+24|0;A=B;b=B+136|0;D=B+16|0;y=B+12|0;C=B+8|0;p=B+134|0;l=B+4|0;x=B+124|0;c[D>>2]=b;E=D+4|0;c[E>>2]=189;m=b+100|0;o=0;k=ka(68,g|0)|0;w=o;o=0;if(!(w&1)){c[C>>2]=k;o=0;b=ra(37,C|0,44220)|0;w=o;o=0;a:do{if(!(w&1)?(a[p>>0]=0,c[l>>2]=c[e>>2],n=c[g+4>>2]|0,o=0,c[z>>2]=c[l>>2],n=la(1,d|0,z|0,f|0,C|0,n|0,h|0,p|0,b|0,D|0,y|0,m|0)|0,w=o,o=0,!(w&1)):0){b:do{if(n){o=0;va(c[(c[b>>2]|0)+32>>2]|0,b|0,58976,58986,x|0)|0;w=o;o=0;if(w&1){G=10;break a}l=c[y>>2]|0;m=c[D>>2]|0;b=l-m|0;if((b|0)>98){b=Fl(b+2|0)|0;k=b;if(!b){o=0;xa(6);w=o;o=0;if(!(w&1)){b=0;G=13}}else G=13}else{k=0;b=z;G=13}do{if((G|0)==13){if(a[p>>0]|0){a[b>>0]=45;b=b+1|0}v=x+10|0;w=x;if(m>>>0>>0){n=x+1|0;f=n+1|0;g=f+1|0;p=g+1|0;q=p+1|0;r=q+1|0;s=r+1|0;t=s+1|0;u=t+1|0;do{l=a[m>>0]|0;do{if((a[x>>0]|0)!=l<<24>>24)if((a[n>>0]|0)!=l<<24>>24)if((a[f>>0]|0)!=l<<24>>24)if((a[g>>0]|0)!=l<<24>>24)if((a[p>>0]|0)==l<<24>>24)l=p;else{if((a[q>>0]|0)==l<<24>>24){l=q;break}if((a[r>>0]|0)==l<<24>>24){l=r;break}if((a[s>>0]|0)==l<<24>>24){l=s;break}if((a[t>>0]|0)==l<<24>>24){l=t;break}l=(a[u>>0]|0)==l<<24>>24?u:v}else l=g;else l=f;else l=n;else l=x}while(0);a[b>>0]=a[58976+(l-w)>>0]|0;m=m+1|0;b=b+1|0}while(m>>>0<(c[y>>2]|0)>>>0)}a[b>>0]=0;c[A>>2]=j;if(($k(z,58987,A)|0)!=1?(o=0,ha(190,58991),j=o,o=0,j&1):0)break;if(k)Gl(k);break b}}while(0);b=Na()|0;if(!k){l=b;k=D;break a}Gl(k);l=b;k=D;break a}}while(0);b=c[d>>2]|0;do{if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;b=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;j=o;o=0;if(j&1){G=10;break a}if((b|0)==-1){c[d>>2]=0;b=0;break}else{b=c[d>>2]|0;break}}}else b=0}while(0);k=(b|0)==0;b=c[e>>2]|0;do{if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;b=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;j=o;o=0;if(j&1){G=10;break a}if((b|0)==-1){c[e>>2]=0;G=37;break}}if(!k)G=38}else G=37}while(0);if((G|0)==37?k:0)G=38;if((G|0)==38)c[h>>2]=c[h>>2]|2;k=c[d>>2]|0;pm(c[C>>2]|0)|0;b=c[D>>2]|0;c[D>>2]=0;if((b|0)!=0?(o=0,ha(c[E>>2]|0,b|0),G=o,o=0,G&1):0){G=Na(0)|0;ec(G)}i=B;return k|0}else G=10}while(0);if((G|0)==10){l=Na()|0;k=D}pm(c[C>>2]|0)|0;b=c[k>>2]|0;c[k>>2]=0;if(!b)F=l;else{k=c[E>>2]|0;G=45}}else{l=Na()|0;c[D>>2]=0;k=189;G=45}if((G|0)==45){o=0;ha(k|0,b|0);G=o;o=0;if(G&1){G=Na(0)|0;ec(G)}else F=l}Ya(F|0);return 0}function Pr(a){a=a|0;return}function Qr(e,f,g,h,j,k,l,m,n,p,q){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;p=p|0;q=q|0;var r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0;ba=i;i=i+512|0;P=ba+88|0;u=ba+96|0;da=ba+80|0;T=ba+72|0;S=ba+68|0;U=ba+500|0;Q=ba+497|0;V=ba+496|0;Y=ba+56|0;aa=ba+44|0;_=ba+32|0;Z=ba+20|0;$=ba+8|0;R=ba+4|0;X=ba;c[P>>2]=q;c[da>>2]=u;ca=da+4|0;c[ca>>2]=189;c[T>>2]=u;c[S>>2]=u+400;c[Y>>2]=0;c[Y+4>>2]=0;c[Y+8>>2]=0;c[aa>>2]=0;c[aa+4>>2]=0;c[aa+8>>2]=0;c[_>>2]=0;c[_+4>>2]=0;c[_+8>>2]=0;c[Z>>2]=0;c[Z+4>>2]=0;c[Z+8>>2]=0;c[$>>2]=0;c[$+4>>2]=0;c[$+8>>2]=0;o=0;qa(1,g|0,h|0,U|0,Q|0,V|0,Y|0,aa|0,_|0,Z|0,R|0);O=o;o=0;a:do{if(O&1)m=Na()|0;else{c[p>>2]=c[n>>2];I=m+8|0;J=_+4|0;K=Z+4|0;L=Z+8|0;M=Z+1|0;N=_+8|0;O=_+1|0;z=(j&512|0)!=0;A=aa+8|0;B=aa+1|0;C=aa+4|0;D=$+4|0;E=$+8|0;F=$+1|0;G=U+3|0;H=Y+4|0;y=0;t=0;b:while(1){q=c[e>>2]|0;do{if(q){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}if((q|0)==-1){c[e>>2]=0;q=0;break}else{q=c[e>>2]|0;break}}}else q=0}while(0);q=(q|0)==0;m=c[f>>2]|0;do{if(m){if((c[m+12>>2]|0)!=(c[m+16>>2]|0))if(q){x=m;break}else{W=235;break b}o=0;g=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;x=o;o=0;if(x&1){W=24;break b}if((g|0)!=-1)if(q){x=m;break}else{W=235;break b}else{c[f>>2]=0;W=15;break}}else W=15}while(0);if((W|0)==15){W=0;if(q){W=235;break}else x=0}c:do{switch(a[U+y>>0]|0){case 1:{if((y|0)!=3){q=c[e>>2]|0;m=c[q+12>>2]|0;if((m|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;W=o;o=0;if(W&1){W=24;break b}}else q=d[m>>0]|0;if((q&255)<<24>>24<=-1){W=40;break b}if(!(b[(c[I>>2]|0)+(q<<24>>24<<1)>>1]&8192)){W=40;break b}q=c[e>>2]|0;m=q+12|0;g=c[m>>2]|0;if((g|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+40>>2]|0,q|0)|0;W=o;o=0;if(W&1){W=24;break b}}else{c[m>>2]=g+1;q=d[g>>0]|0}o=0;ia(67,$|0,q&255|0);W=o;o=0;if(W&1){W=24;break b}else{q=x;h=x;W=42}}break}case 0:{if((y|0)!=3){q=x;h=x;W=42}break}case 3:{m=a[_>>0]|0;q=(m&1)==0?(m&255)>>>1:c[J>>2]|0;g=a[Z>>0]|0;h=(g&1)==0?(g&255)>>>1:c[K>>2]|0;if((q|0)!=(0-h|0)){if(!q){q=c[e>>2]|0;m=c[q+12>>2]|0;if((m|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}m=a[Z>>0]|0}else{q=d[m>>0]|0;m=g}if((q&255)<<24>>24!=(a[((m&1)==0?M:c[L>>2]|0)>>0]|0))break c;q=c[e>>2]|0;m=q+12|0;g=c[m>>2]|0;if((g|0)==(c[q+16>>2]|0)){o=0;ka(c[(c[q>>2]|0)+40>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}}else c[m>>2]=g+1;a[l>>0]=1;x=a[Z>>0]|0;t=((x&1)==0?(x&255)>>>1:c[K>>2]|0)>>>0>1?Z:t;break c}j=c[e>>2]|0;r=c[j+12>>2]|0;g=c[j+16>>2]|0;q=(r|0)==(g|0);if(!h){if(q){o=0;q=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;x=o;o=0;if(x&1){W=24;break b}m=a[_>>0]|0}else q=d[r>>0]|0;if((q&255)<<24>>24!=(a[((m&1)==0?O:c[N>>2]|0)>>0]|0)){a[l>>0]=1;break c}q=c[e>>2]|0;m=q+12|0;g=c[m>>2]|0;if((g|0)==(c[q+16>>2]|0)){o=0;ka(c[(c[q>>2]|0)+40>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}}else c[m>>2]=g+1;x=a[_>>0]|0;t=((x&1)==0?(x&255)>>>1:c[J>>2]|0)>>>0>1?_:t;break c}if(q){o=0;q=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;x=o;o=0;if(x&1){W=24;break b}g=c[e>>2]|0;m=a[_>>0]|0;j=g;r=c[g+12>>2]|0;g=c[g+16>>2]|0}else q=d[r>>0]|0;h=j+12|0;g=(r|0)==(g|0);if((q&255)<<24>>24==(a[((m&1)==0?O:c[N>>2]|0)>>0]|0)){if(g){o=0;ka(c[(c[j>>2]|0)+40>>2]|0,j|0)|0;x=o;o=0;if(x&1){W=24;break b}}else c[h>>2]=r+1;x=a[_>>0]|0;t=((x&1)==0?(x&255)>>>1:c[J>>2]|0)>>>0>1?_:t;break c}if(g){o=0;q=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;x=o;o=0;if(x&1){W=24;break b}}else q=d[r>>0]|0;if((q&255)<<24>>24!=(a[((a[Z>>0]&1)==0?M:c[L>>2]|0)>>0]|0)){W=104;break b}q=c[e>>2]|0;m=q+12|0;g=c[m>>2]|0;if((g|0)==(c[q+16>>2]|0)){o=0;ka(c[(c[q>>2]|0)+40>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}}else c[m>>2]=g+1;a[l>>0]=1;x=a[Z>>0]|0;t=((x&1)==0?(x&255)>>>1:c[K>>2]|0)>>>0>1?Z:t}break}case 2:{if(!(y>>>0<2|(t|0)!=0)?!(z|(y|0)==2&(a[G>>0]|0)!=0):0){t=0;break c}v=a[aa>>0]|0;q=(v&1)==0;w=c[A>>2]|0;g=q?B:w;s=g;d:do{if((y|0)!=0?(d[U+(y+-1)>>0]|0)<2:0){r=q?(v&255)>>>1:c[C>>2]|0;h=g+r|0;j=c[I>>2]|0;e:do{if(!r)m=s;else{r=g;m=s;do{q=a[r>>0]|0;if(q<<24>>24<=-1)break e;if(!(b[j+(q<<24>>24<<1)>>1]&8192))break e;r=r+1|0;m=r}while((r|0)!=(h|0))}}while(0);h=m-s|0;j=a[$>>0]|0;q=(j&1)==0;j=q?(j&255)>>>1:c[D>>2]|0;if(j>>>0>=h>>>0){q=q?F:c[E>>2]|0;r=q+j|0;if((m|0)!=(s|0)){q=q+(j-h)|0;while(1){if((a[q>>0]|0)!=(a[g>>0]|0)){m=s;break d}q=q+1|0;if((q|0)==(r|0))break;else g=g+1|0}}}else m=s}else m=s}while(0);q=(v&1)==0;q=(q?B:w)+(q?(v&255)>>>1:c[C>>2]|0)|0;f:do{if((m|0)!=(q|0)){j=x;h=x;q=m;while(1){m=c[e>>2]|0;do{if(m){if((c[m+12>>2]|0)==(c[m+16>>2]|0)){o=0;m=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;x=o;o=0;if(x&1){W=21;break b}if((m|0)==-1){c[e>>2]=0;m=0;break}else{m=c[e>>2]|0;break}}}else m=0}while(0);g=(m|0)==0;do{if(h){if((c[h+12>>2]|0)!=(c[h+16>>2]|0))if(g){m=j;r=h;break}else break f;o=0;m=ka(c[(c[h>>2]|0)+36>>2]|0,h|0)|0;x=o;o=0;if(x&1){W=21;break b}if((m|0)!=-1)if(g^(j|0)==0){m=j;r=j;break}else break f;else{c[f>>2]=0;m=0;W=131;break}}else{m=j;W=131}}while(0);if((W|0)==131){W=0;if(g)break f;else r=0}g=c[e>>2]|0;h=c[g+12>>2]|0;if((h|0)==(c[g+16>>2]|0)){o=0;g=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;x=o;o=0;if(x&1){W=21;break b}}else g=d[h>>0]|0;if((g&255)<<24>>24!=(a[q>>0]|0))break f;g=c[e>>2]|0;h=g+12|0;j=c[h>>2]|0;if((j|0)==(c[g+16>>2]|0)){o=0;ka(c[(c[g>>2]|0)+40>>2]|0,g|0)|0;x=o;o=0;if(x&1){W=21;break b}}else c[h>>2]=j+1;q=q+1|0;g=a[aa>>0]|0;x=(g&1)==0;g=(x?B:c[A>>2]|0)+(x?(g&255)>>>1:c[C>>2]|0)|0;if((q|0)==(g|0)){q=g;break}else{j=m;h=r}}}}while(0);if(z?(x=a[aa>>0]|0,w=(x&1)==0,(q|0)!=((w?B:c[A>>2]|0)+(w?(x&255)>>>1:c[C>>2]|0)|0)):0){W=143;break b}break}case 4:{s=a[V>>0]|0;m=x;j=x;q=0;g:while(1){g=c[e>>2]|0;do{if(g){if((c[g+12>>2]|0)==(c[g+16>>2]|0)){o=0;g=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;x=o;o=0;if(x&1){W=23;break b}if((g|0)==-1){c[e>>2]=0;g=0;break}else{g=c[e>>2]|0;break}}}else g=0}while(0);h=(g|0)==0;do{if(j){if((c[j+12>>2]|0)!=(c[j+16>>2]|0))if(h){r=m;break}else{h=m;break g}o=0;g=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;x=o;o=0;if(x&1){W=23;break b}if((g|0)!=-1)if(h^(m|0)==0){r=m;j=m;break}else{h=m;break g}else{c[f>>2]=0;m=0;W=156;break}}else W=156}while(0);if((W|0)==156){W=0;if(h){h=m;break}else{r=m;j=0}}m=c[e>>2]|0;g=c[m+12>>2]|0;if((g|0)==(c[m+16>>2]|0)){o=0;m=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;x=o;o=0;if(x&1){W=23;break b}}else m=d[g>>0]|0;g=m&255;if(g<<24>>24>-1?(b[(c[I>>2]|0)+(m<<24>>24<<1)>>1]&2048)!=0:0){m=c[p>>2]|0;if((m|0)==(c[P>>2]|0)){o=0;wa(12,n|0,p|0,P|0);x=o;o=0;if(x&1){W=23;break b}m=c[p>>2]|0}c[p>>2]=m+1;a[m>>0]=g;q=q+1|0}else{x=a[Y>>0]|0;if(!(g<<24>>24==s<<24>>24&((q|0)!=0?(((x&1)==0?(x&255)>>>1:c[H>>2]|0)|0)!=0:0))){h=r;break}if((u|0)==(c[S>>2]|0)){o=0;wa(13,da|0,T|0,S|0);x=o;o=0;if(x&1){W=23;break b}u=c[T>>2]|0}x=u+4|0;c[T>>2]=x;c[u>>2]=q;u=x;q=0}m=c[e>>2]|0;g=m+12|0;h=c[g>>2]|0;if((h|0)==(c[m+16>>2]|0)){o=0;ka(c[(c[m>>2]|0)+40>>2]|0,m|0)|0;x=o;o=0;if(x&1){W=23;break b}else{m=r;continue}}else{c[g>>2]=h+1;m=r;continue}}if((q|0)!=0?(c[da>>2]|0)!=(u|0):0){if((u|0)==(c[S>>2]|0)){o=0;wa(13,da|0,T|0,S|0);x=o;o=0;if(x&1){W=24;break b}u=c[T>>2]|0}x=u+4|0;c[T>>2]=x;c[u>>2]=q;u=x}r=c[R>>2]|0;if((r|0)>0){q=c[e>>2]|0;do{if(q){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}if((q|0)==-1){c[e>>2]=0;q=0;break}else{q=c[e>>2]|0;break}}}else q=0}while(0);q=(q|0)==0;do{if(h){if((c[h+12>>2]|0)==(c[h+16>>2]|0)){o=0;m=ka(c[(c[h>>2]|0)+36>>2]|0,h|0)|0;x=o;o=0;if(x&1){W=24;break b}if((m|0)==-1){c[f>>2]=0;W=193;break}}if(!q){W=198;break b}}else W=193}while(0);if((W|0)==193){W=0;if(q){W=198;break b}else h=0}q=c[e>>2]|0;m=c[q+12>>2]|0;if((m|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}}else q=d[m>>0]|0;if((q&255)<<24>>24!=(a[Q>>0]|0)){W=198;break b}q=c[e>>2]|0;m=q+12|0;g=c[m>>2]|0;if((g|0)==(c[q+16>>2]|0)){o=0;ka(c[(c[q>>2]|0)+40>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=24;break b}}else c[m>>2]=g+1;if((r|0)>0){j=h;g=h;s=r;while(1){q=c[e>>2]|0;do{if(q){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=22;break b}if((q|0)==-1){c[e>>2]=0;q=0;break}else{q=c[e>>2]|0;break}}}else q=0}while(0);m=(q|0)==0;do{if(g){if((c[g+12>>2]|0)!=(c[g+16>>2]|0))if(m){q=j;r=g;break}else{W=222;break b}o=0;q=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;x=o;o=0;if(x&1){W=22;break b}if((q|0)!=-1)if(m^(j|0)==0){q=j;r=j;break}else{W=222;break b}else{c[f>>2]=0;q=0;W=215;break}}else{q=j;W=215}}while(0);if((W|0)==215){W=0;if(m){W=222;break b}else r=0}m=c[e>>2]|0;g=c[m+12>>2]|0;if((g|0)==(c[m+16>>2]|0)){o=0;m=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;x=o;o=0;if(x&1){W=22;break b}}else m=d[g>>0]|0;if((m&255)<<24>>24<=-1){W=222;break b}if(!(b[(c[I>>2]|0)+(m<<24>>24<<1)>>1]&2048)){W=222;break b}if((c[p>>2]|0)==(c[P>>2]|0)?(o=0,wa(12,n|0,p|0,P|0),x=o,o=0,x&1):0){W=22;break b}m=c[e>>2]|0;g=c[m+12>>2]|0;if((g|0)==(c[m+16>>2]|0)){o=0;m=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;x=o;o=0;if(x&1){W=22;break b}}else m=d[g>>0]|0;g=c[p>>2]|0;c[p>>2]=g+1;a[g>>0]=m;m=s;s=s+-1|0;c[R>>2]=s;g=c[e>>2]|0;h=g+12|0;j=c[h>>2]|0;if((j|0)==(c[g+16>>2]|0)){o=0;ka(c[(c[g>>2]|0)+40>>2]|0,g|0)|0;x=o;o=0;if(x&1){W=22;break b}}else c[h>>2]=j+1;if((m|0)<=1)break;else{j=q;g=r}}}}if((c[p>>2]|0)==(c[n>>2]|0)){W=233;break b}break}default:{}}}while(0);h:do{if((W|0)==42)while(1){W=0;m=c[e>>2]|0;do{if(m){if((c[m+12>>2]|0)==(c[m+16>>2]|0)){o=0;m=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;x=o;o=0;if(x&1){W=20;break b}if((m|0)==-1){c[e>>2]=0;m=0;break}else{m=c[e>>2]|0;break}}}else m=0}while(0);g=(m|0)==0;do{if(h){if((c[h+12>>2]|0)!=(c[h+16>>2]|0))if(g){j=q;break}else break h;o=0;m=ka(c[(c[h>>2]|0)+36>>2]|0,h|0)|0;x=o;o=0;if(x&1){W=20;break b}if((m|0)!=-1)if(g^(q|0)==0){j=q;h=q;break}else break h;else{c[f>>2]=0;q=0;W=54;break}}else W=54}while(0);if((W|0)==54){W=0;if(g)break h;else{j=q;h=0}}q=c[e>>2]|0;m=c[q+12>>2]|0;if((m|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;x=o;o=0;if(x&1){W=20;break b}}else q=d[m>>0]|0;if((q&255)<<24>>24<=-1)break h;if(!(b[(c[I>>2]|0)+(q<<24>>24<<1)>>1]&8192))break h;q=c[e>>2]|0;m=q+12|0;g=c[m>>2]|0;if((g|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+40>>2]|0,q|0)|0;W=o;o=0;if(W&1){W=20;break b}}else{c[m>>2]=g+1;q=d[g>>0]|0}o=0;ia(67,$|0,q&255|0);W=o;o=0;if(W&1){W=20;break b}else{q=j;W=42}}}while(0);y=y+1|0;if(y>>>0>=4){W=235;break}}i:switch(W|0){case 20:{m=Na()|0;break a}case 21:{m=Na()|0;break a}case 22:{m=Na()|0;break a}case 23:{m=Na()|0;break a}case 24:{m=Na()|0;break a}case 40:{c[k>>2]=c[k>>2]|4;m=0;break}case 104:{c[k>>2]=c[k>>2]|4;m=0;break}case 143:{c[k>>2]=c[k>>2]|4;m=0;break}case 198:{c[k>>2]=c[k>>2]|4;m=0;break}case 222:{c[k>>2]=c[k>>2]|4;m=0;break}case 233:{c[k>>2]=c[k>>2]|4;m=0;break}case 235:{j:do{if(t){j=t+1|0;r=t+8|0;s=t+4|0;g=1;k:while(1){q=a[t>>0]|0;if(!(q&1))q=(q&255)>>>1;else q=c[s>>2]|0;if(g>>>0>=q>>>0)break j;q=c[e>>2]|0;do{if(q){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;p=o;o=0;if(p&1){W=19;break k}if((q|0)==-1){c[e>>2]=0;q=0;break}else{q=c[e>>2]|0;break}}}else q=0}while(0);m=(q|0)==0;q=c[f>>2]|0;do{if(q){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;p=o;o=0;if(p&1){W=19;break k}if((q|0)==-1){c[f>>2]=0;W=253;break}}if(!m){W=260;break k}}else W=253}while(0);if((W|0)==253?(W=0,m):0){W=260;break}q=c[e>>2]|0;m=c[q+12>>2]|0;if((m|0)==(c[q+16>>2]|0)){o=0;q=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;p=o;o=0;if(p&1){W=19;break}}else q=d[m>>0]|0;if(!(a[t>>0]&1))m=j;else m=c[r>>2]|0;if((q&255)<<24>>24!=(a[m+g>>0]|0)){W=260;break}q=g+1|0;m=c[e>>2]|0;g=m+12|0;h=c[g>>2]|0;if((h|0)==(c[m+16>>2]|0)){o=0;ka(c[(c[m>>2]|0)+40>>2]|0,m|0)|0;p=o;o=0;if(p&1){W=19;break}else{g=q;continue}}else{c[g>>2]=h+1;g=q;continue}}if((W|0)==19){m=Na()|0;break a}else if((W|0)==260){c[k>>2]=c[k>>2]|4;m=0;break i}}}while(0);q=c[da>>2]|0;if((q|0)!=(u|0)?(c[X>>2]=0,Ur(Y,q,u,X),(c[X>>2]|0)!=0):0){c[k>>2]=c[k>>2]|4;m=0}else m=1;break}}Im($);Im(Z);Im(_);Im(aa);Im(Y);q=c[da>>2]|0;c[da>>2]=0;if((q|0)!=0?(o=0,ha(c[ca>>2]|0,q|0),da=o,o=0,da&1):0){da=Na(0)|0;ec(da)}i=ba;return m|0}}while(0);Im($);Im(Z);Im(_);Im(aa);Im(Y);q=c[da>>2]|0;c[da>>2]=0;if((q|0)!=0?(o=0,ha(c[ca>>2]|0,q|0),da=o,o=0,da&1):0){da=Na(0)|0;ec(da)}Ya(m|0);return 0}function Rr(a){a=a|0;var b=0;b=Ma(8)|0;o=0;ia(90,b|0,a|0);a=o;o=0;if(a&1){a=Na()|0;La(b|0);Ya(a|0)}else lb(b|0,616,80)}function Sr(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;w=i;i=i+144|0;k=w+24|0;b=w+32|0;x=w+16|0;s=w+8|0;p=w+4|0;q=w+28|0;l=w;c[x>>2]=b;A=x+4|0;c[A>>2]=189;m=b+100|0;o=0;v=ka(68,g|0)|0;n=o;o=0;if(!(n&1)){c[p>>2]=v;o=0;n=ra(37,p|0,44220)|0;b=o;o=0;a:do{if(!(b&1)?(a[q>>0]=0,t=c[e>>2]|0,c[l>>2]=t,r=c[g+4>>2]|0,u=t,o=0,c[k>>2]=c[l>>2],r=la(1,d|0,k|0,f|0,p|0,r|0,h|0,q|0,n|0,x|0,s|0,m|0)|0,g=o,o=0,!(g&1)):0){if(r){if(!(a[j>>0]&1)){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}if(a[q>>0]|0){o=0;b=ra(c[(c[n>>2]|0)+28>>2]|0,n|0,45)|0;g=o;o=0;if(g&1)break;o=0;ia(67,j|0,b|0);g=o;o=0;if(g&1)break}o=0;l=ra(c[(c[n>>2]|0)+28>>2]|0,n|0,48)|0;g=o;o=0;if(g&1)break;b=c[x>>2]|0;m=c[s>>2]|0;k=m+-1|0;b:do{if(b>>>0>>0)do{if((a[b>>0]|0)!=l<<24>>24)break b;b=b+1|0}while(b>>>0>>0)}while(0);o=0;ma(32,j|0,b|0,m|0)|0;j=o;o=0;if(j&1)break}b=c[d>>2]|0;do{if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;b=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;j=o;o=0;if(j&1)break a;if((b|0)==-1){c[d>>2]=0;b=0;break}else{b=c[d>>2]|0;break}}}else b=0}while(0);k=(b|0)==0;do{if(t){if((c[u+12>>2]|0)==(c[u+16>>2]|0)){o=0;b=ka(c[(c[t>>2]|0)+36>>2]|0,u|0)|0;u=o;o=0;if(u&1)break a;if((b|0)==-1){c[e>>2]=0;z=29;break}}if(!k)z=30}else z=29}while(0);if((z|0)==29?k:0)z=30;if((z|0)==30)c[h>>2]=c[h>>2]|2;k=c[d>>2]|0;pm(v)|0;b=c[x>>2]|0;c[x>>2]=0;if((b|0)!=0?(o=0,ha(c[A>>2]|0,b|0),A=o,o=0,A&1):0){A=Na(0)|0;ec(A)}i=w;return k|0}}while(0);k=Na()|0;pm(v)|0;b=c[x>>2]|0;c[x>>2]=0;if(!b)y=k;else z=36}else{k=Na()|0;c[x>>2]=0;z=36}if((z|0)==36){o=0;ha(c[A>>2]|0,b|0);A=o;o=0;if(A&1){A=Na(0)|0;ec(A)}else y=k}Ya(y|0);return 0}function Tr(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=i;i=i+112|0;n=z+100|0;p=z+88|0;q=z+76|0;r=z+64|0;s=z+52|0;t=z+48|0;u=z+36|0;v=z+24|0;w=z+12|0;x=z;do{if(b){b=Is(d,43828)|0;Cb[c[(c[b>>2]|0)+44>>2]&127](n,b);x=c[n>>2]|0;a[e>>0]=x;a[e+1>>0]=x>>8;a[e+2>>0]=x>>16;a[e+3>>0]=x>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](p,b);if(!(a[l>>0]&1)){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}o=0;ia(91,l|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[l>>2]=c[p>>2];c[l+4>>2]=c[p+4>>2];c[l+8>>2]=c[p+8>>2];c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;Im(p);Cb[c[(c[b>>2]|0)+28>>2]&127](q,b);if(!(a[k>>0]&1)){a[k+1>>0]=0;a[k>>0]=0}else{a[c[k+8>>2]>>0]=0;c[k+4>>2]=0}o=0;ia(91,k|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[k>>2]=c[q>>2];c[k+4>>2]=c[q+4>>2];c[k+8>>2]=c[q+8>>2];c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;Im(q);a[f>>0]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;a[g>>0]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[b>>2]|0)+20>>2]&127](r,b);if(!(a[h>>0]&1)){a[h+1>>0]=0;a[h>>0]=0}else{a[c[h+8>>2]>>0]=0;c[h+4>>2]=0}o=0;ia(91,h|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}c[h>>2]=c[r>>2];c[h+4>>2]=c[r+4>>2];c[h+8>>2]=c[r+8>>2];c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;Im(r);Cb[c[(c[b>>2]|0)+24>>2]&127](s,b);if(!(a[j>>0]&1)){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}o=0;ia(91,j|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}else{c[j>>2]=c[s>>2];c[j+4>>2]=c[s+4>>2];c[j+8>>2]=c[s+8>>2];c[s>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0;Im(s);y=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}else{b=Is(d,43764)|0;Cb[c[(c[b>>2]|0)+44>>2]&127](t,b);t=c[t>>2]|0;a[e>>0]=t;a[e+1>>0]=t>>8;a[e+2>>0]=t>>16;a[e+3>>0]=t>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](u,b);if(!(a[l>>0]&1)){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}o=0;ia(91,l|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[l>>2]=c[u>>2];c[l+4>>2]=c[u+4>>2];c[l+8>>2]=c[u+8>>2];c[u>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;Im(u);Cb[c[(c[b>>2]|0)+28>>2]&127](v,b);if(!(a[k>>0]&1)){a[k+1>>0]=0;a[k>>0]=0}else{a[c[k+8>>2]>>0]=0;c[k+4>>2]=0}o=0;ia(91,k|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[k>>2]=c[v>>2];c[k+4>>2]=c[v+4>>2];c[k+8>>2]=c[v+8>>2];c[v>>2]=0;c[v+4>>2]=0;c[v+8>>2]=0;Im(v);a[f>>0]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;a[g>>0]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[b>>2]|0)+20>>2]&127](w,b);if(!(a[h>>0]&1)){a[h+1>>0]=0;a[h>>0]=0}else{a[c[h+8>>2]>>0]=0;c[h+4>>2]=0}o=0;ia(91,h|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}c[h>>2]=c[w>>2];c[h+4>>2]=c[w+4>>2];c[h+8>>2]=c[w+8>>2];c[w>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;Im(w);Cb[c[(c[b>>2]|0)+24>>2]&127](x,b);if(!(a[j>>0]&1)){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}o=0;ia(91,j|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}else{c[j>>2]=c[x>>2];c[j+4>>2]=c[x+4>>2];c[j+8>>2]=c[x+8>>2];c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;Im(x);y=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}}while(0);c[m>>2]=y;i=z;return}function Ur(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0;g=a[b>>0]|0;i=b+4|0;h=c[i>>2]|0;a:do{if(((g&1)==0?(g&255)>>>1:h)|0){if((d|0)!=(e|0)){g=e+-4|0;if(g>>>0>d>>>0){h=d;do{j=c[h>>2]|0;c[h>>2]=c[g>>2];c[g>>2]=j;h=h+4|0;g=g+-4|0}while(h>>>0>>0)}g=a[b>>0]|0;h=c[i>>2]|0}j=(g&1)==0;i=j?b+1|0:c[b+8>>2]|0;e=e+-4|0;b=i+(j?(g&255)>>>1:h)|0;h=a[i>>0]|0;g=h<<24>>24<1|h<<24>>24==127;b:do{if(e>>>0>d>>>0){while(1){if(!g?(h<<24>>24|0)!=(c[d>>2]|0):0)break;i=(b-i|0)>1?i+1|0:i;d=d+4|0;h=a[i>>0]|0;g=h<<24>>24<1|h<<24>>24==127;if(d>>>0>=e>>>0)break b}c[f>>2]=4;break a}}while(0);if(!g?((c[e>>2]|0)+-1|0)>>>0>=h<<24>>24>>>0:0)c[f>>2]=4}}while(0);return}function Vr(a){a=a|0;return}function Wr(a){a=a|0;cj(a);return}function Xr(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;B=i;i=i+576|0;x=B+424|0;A=B;b=B+24|0;D=B+16|0;y=B+12|0;C=B+8|0;p=B+464|0;l=B+4|0;z=B+468|0;c[D>>2]=b;F=D+4|0;c[F>>2]=189;m=b+400|0;o=0;k=ka(68,g|0)|0;w=o;o=0;if(!(w&1)){c[C>>2]=k;o=0;b=ra(37,C|0,44212)|0;w=o;o=0;a:do{if(!(w&1)?(a[p>>0]=0,c[l>>2]=c[e>>2],n=c[g+4>>2]|0,o=0,c[x>>2]=c[l>>2],n=la(2,d|0,x|0,f|0,C|0,n|0,h|0,p|0,b|0,D|0,y|0,m|0)|0,w=o,o=0,!(w&1)):0){b:do{if(n){o=0;va(c[(c[b>>2]|0)+48>>2]|0,b|0,59007,59017,x|0)|0;w=o;o=0;if(w&1){G=10;break a}l=c[y>>2]|0;m=c[D>>2]|0;b=l-m|0;if((b|0)>392){b=Fl((b>>2)+2|0)|0;k=b;if(!b){o=0;xa(6);w=o;o=0;if(!(w&1)){b=0;G=13}}else G=13}else{k=0;b=z;G=13}do{if((G|0)==13){if(a[p>>0]|0){a[b>>0]=45;b=b+1|0}v=x+40|0;w=x;if(m>>>0>>0){n=x+4|0;f=n+4|0;g=f+4|0;p=g+4|0;q=p+4|0;r=q+4|0;s=r+4|0;t=s+4|0;u=t+4|0;do{l=c[m>>2]|0;do{if((c[x>>2]|0)!=(l|0))if((c[n>>2]|0)!=(l|0))if((c[f>>2]|0)!=(l|0))if((c[g>>2]|0)!=(l|0))if((c[p>>2]|0)==(l|0))l=p;else{if((c[q>>2]|0)==(l|0)){l=q;break}if((c[r>>2]|0)==(l|0)){l=r;break}if((c[s>>2]|0)==(l|0)){l=s;break}if((c[t>>2]|0)==(l|0)){l=t;break}l=(c[u>>2]|0)==(l|0)?u:v}else l=g;else l=f;else l=n;else l=x}while(0);a[b>>0]=a[59007+(l-w>>2)>>0]|0;m=m+4|0;b=b+1|0}while(m>>>0<(c[y>>2]|0)>>>0)}a[b>>0]=0;c[A>>2]=j;if(($k(z,58987,A)|0)!=1?(o=0,ha(190,58991),j=o,o=0,j&1):0)break;if(k)Gl(k);break b}}while(0);b=Na()|0;if(!k){l=b;k=D;break a}Gl(k);l=b;k=D;break a}}while(0);b=c[d>>2]|0;do{if(b){k=c[b+12>>2]|0;if((k|0)==(c[b+16>>2]|0)){o=0;b=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;j=o;o=0;if(j&1){G=10;break a}}else b=c[k>>2]|0;if((b|0)==-1){c[d>>2]=0;l=1;break}else{l=(c[d>>2]|0)==0;break}}else l=1}while(0);b=c[e>>2]|0;do{if(b){k=c[b+12>>2]|0;if((k|0)==(c[b+16>>2]|0)){o=0;b=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;j=o;o=0;if(j&1){G=10;break a}}else b=c[k>>2]|0;if((b|0)!=-1)if(l)break;else{G=40;break}else{c[e>>2]=0;G=38;break}}else G=38}while(0);if((G|0)==38?l:0)G=40;if((G|0)==40)c[h>>2]=c[h>>2]|2;k=c[d>>2]|0;pm(c[C>>2]|0)|0;b=c[D>>2]|0;c[D>>2]=0;if((b|0)!=0?(o=0,ha(c[F>>2]|0,b|0),G=o,o=0,G&1):0){G=Na(0)|0;ec(G)}i=B;return k|0}else G=10}while(0);if((G|0)==10){l=Na()|0;k=D}pm(c[C>>2]|0)|0;b=c[k>>2]|0;c[k>>2]=0;if(!b)E=l;else{k=c[F>>2]|0;G=47}}else{l=Na()|0;c[D>>2]=0;k=189;G=47}if((G|0)==47){o=0;ha(k|0,b|0);G=o;o=0;if(G&1){G=Na(0)|0;ec(G)}else E=l}Ya(E|0);return 0}function Yr(b,e,f,g,h,j,k,l,m,n,p){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;p=p|0;var q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;Y=i;i=i+512|0;K=Y+96|0;q=Y+104|0;_=Y+88|0;O=Y+80|0;N=Y+76|0;P=Y+504|0;L=Y+72|0;Q=Y+68|0;T=Y+56|0;X=Y+44|0;V=Y+32|0;U=Y+20|0;W=Y+8|0;M=Y+4|0;S=Y;c[K>>2]=p;c[_>>2]=q;Z=_+4|0;c[Z>>2]=189;c[O>>2]=q;c[N>>2]=q+400;c[T>>2]=0;c[T+4>>2]=0;c[T+8>>2]=0;c[X>>2]=0;c[X+4>>2]=0;c[X+8>>2]=0;c[V>>2]=0;c[V+4>>2]=0;c[V+8>>2]=0;c[U>>2]=0;c[U+4>>2]=0;c[U+8>>2]=0;c[W>>2]=0;c[W+4>>2]=0;c[W+8>>2]=0;o=0;qa(2,f|0,g|0,P|0,L|0,Q|0,T|0,X|0,V|0,U|0,M|0);J=o;o=0;a:do{if(J&1)f=Na()|0;else{c[n>>2]=c[m>>2];G=V+4|0;H=U+4|0;I=U+8|0;J=V+8|0;z=(h&512|0)!=0;A=X+8|0;B=X+4|0;C=W+4|0;D=W+8|0;E=P+3|0;F=T+4|0;y=0;s=0;b:while(1){p=c[b>>2]|0;do{if(p){f=c[p+12>>2]|0;if((f|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;x=o;o=0;if(x&1){R=26;break b}}else p=c[f>>2]|0;if((p|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}else g=1}while(0);f=c[e>>2]|0;do{if(f){p=c[f+12>>2]|0;if((p|0)==(c[f+16>>2]|0)){o=0;p=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;x=o;o=0;if(x&1){R=26;break b}}else p=c[p>>2]|0;if((p|0)!=-1)if(g){x=f;break}else{t=q;R=244;break b}else{c[e>>2]=0;R=16;break}}else R=16}while(0);if((R|0)==16){R=0;if(g){t=q;R=244;break}else x=0}c:do{switch(a[P+y>>0]|0){case 1:{if((y|0)!=3){p=c[b>>2]|0;f=c[p+12>>2]|0;if((f|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;R=o;o=0;if(R&1){R=26;break b}}else p=c[f>>2]|0;o=0;p=ma(c[(c[l>>2]|0)+12>>2]|0,l|0,8192,p|0)|0;R=o;o=0;if(R&1){R=26;break b}if(!p){R=42;break b}p=c[b>>2]|0;f=p+12|0;g=c[f>>2]|0;if((g|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+40>>2]|0,p|0)|0;R=o;o=0;if(R&1){R=26;break b}}else{c[f>>2]=g+4;p=c[g>>2]|0}o=0;ia(92,W|0,p|0);R=o;o=0;if(R&1){R=26;break b}else{p=x;h=x;R=44}}else p=q;break}case 0:{if((y|0)==3)p=q;else{p=x;h=x;R=44}break}case 3:{f=a[V>>0]|0;p=(f&1)==0?(f&255)>>>1:c[G>>2]|0;g=a[U>>0]|0;h=(g&1)==0?(g&255)>>>1:c[H>>2]|0;if((p|0)==(0-h|0))p=q;else{if(!p){p=c[b>>2]|0;f=c[p+12>>2]|0;if((f|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;x=o;o=0;if(x&1){R=26;break b}f=a[U>>0]|0}else{p=c[f>>2]|0;f=g}if((p|0)!=(c[((f&1)==0?H:c[I>>2]|0)>>2]|0)){p=q;break c}p=c[b>>2]|0;f=p+12|0;g=c[f>>2]|0;if((g|0)==(c[p+16>>2]|0)){o=0;ka(c[(c[p>>2]|0)+40>>2]|0,p|0)|0;x=o;o=0;if(x&1){R=26;break b}}else c[f>>2]=g+4;a[k>>0]=1;x=a[U>>0]|0;p=q;s=((x&1)==0?(x&255)>>>1:c[H>>2]|0)>>>0>1?U:s;break c}r=c[b>>2]|0;t=c[r+12>>2]|0;g=c[r+16>>2]|0;p=(t|0)==(g|0);if(!h){if(p){o=0;p=ka(c[(c[r>>2]|0)+36>>2]|0,r|0)|0;x=o;o=0;if(x&1){R=26;break b}f=a[V>>0]|0}else p=c[t>>2]|0;if((p|0)!=(c[((f&1)==0?G:c[J>>2]|0)>>2]|0)){a[k>>0]=1;p=q;break c}p=c[b>>2]|0;f=p+12|0;g=c[f>>2]|0;if((g|0)==(c[p+16>>2]|0)){o=0;ka(c[(c[p>>2]|0)+40>>2]|0,p|0)|0;x=o;o=0;if(x&1){R=26;break b}}else c[f>>2]=g+4;x=a[V>>0]|0;p=q;s=((x&1)==0?(x&255)>>>1:c[G>>2]|0)>>>0>1?V:s;break c}if(p){o=0;p=ka(c[(c[r>>2]|0)+36>>2]|0,r|0)|0;x=o;o=0;if(x&1){R=26;break b}g=c[b>>2]|0;f=a[V>>0]|0;r=g;t=c[g+12>>2]|0;g=c[g+16>>2]|0}else p=c[t>>2]|0;h=r+12|0;g=(t|0)==(g|0);if((p|0)==(c[((f&1)==0?G:c[J>>2]|0)>>2]|0)){if(g){o=0;ka(c[(c[r>>2]|0)+40>>2]|0,r|0)|0;x=o;o=0;if(x&1){R=26;break b}}else c[h>>2]=t+4;x=a[V>>0]|0;p=q;s=((x&1)==0?(x&255)>>>1:c[G>>2]|0)>>>0>1?V:s;break c}if(g){o=0;p=ka(c[(c[r>>2]|0)+36>>2]|0,r|0)|0;x=o;o=0;if(x&1){R=26;break b}}else p=c[t>>2]|0;if((p|0)!=(c[((a[U>>0]&1)==0?H:c[I>>2]|0)>>2]|0)){R=107;break b}p=c[b>>2]|0;f=p+12|0;g=c[f>>2]|0;if((g|0)==(c[p+16>>2]|0)){o=0;ka(c[(c[p>>2]|0)+40>>2]|0,p|0)|0;x=o;o=0;if(x&1){R=26;break b}}else c[f>>2]=g+4;a[k>>0]=1;x=a[U>>0]|0;p=q;s=((x&1)==0?(x&255)>>>1:c[H>>2]|0)>>>0>1?U:s}break}case 2:{if(!(y>>>0<2|(s|0)!=0)?!(z|(y|0)==2&(a[E>>0]|0)!=0):0){p=q;s=0;break c}h=a[X>>0]|0;g=c[A>>2]|0;f=(h&1)==0?B:g;p=f;d:do{if((y|0)!=0?(d[P+(y+-1)>>0]|0)<2:0){w=(h&1)==0;e:do{if((f|0)!=((w?B:g)+((w?(h&255)>>>1:c[B>>2]|0)<<2)|0)){h=f;while(1){o=0;f=ma(c[(c[l>>2]|0)+12>>2]|0,l|0,8192,c[h>>2]|0)|0;w=o;o=0;if(w&1){R=23;break b}if(!f)break;h=h+4|0;p=h;f=a[X>>0]|0;g=c[A>>2]|0;w=(f&1)==0;if((h|0)==((w?B:g)+((w?(f&255)>>>1:c[B>>2]|0)<<2)|0)){h=f;break e}}h=a[X>>0]|0;g=c[A>>2]|0}}while(0);t=(h&1)==0?B:g;f=t;u=p-f>>2;v=a[W>>0]|0;r=(v&1)==0;v=r?(v&255)>>>1:c[C>>2]|0;if(v>>>0>=u>>>0){r=r?C:c[D>>2]|0;w=r+(v<<2)|0;if(!u)f=p;else{r=r+(v-u<<2)|0;while(1){if((c[r>>2]|0)!=(c[t>>2]|0))break d;r=r+4|0;if((r|0)==(w|0)){f=p;break}else t=t+4|0}}}}else f=p}while(0);p=(h&1)==0;p=(p?B:g)+((p?(h&255)>>>1:c[B>>2]|0)<<2)|0;f:do{if((f|0)!=(p|0)){r=x;h=x;p=f;while(1){f=c[b>>2]|0;do{if(f){g=c[f+12>>2]|0;if((g|0)==(c[f+16>>2]|0)){o=0;f=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;x=o;o=0;if(x&1){R=22;break b}}else f=c[g>>2]|0;if((f|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}else g=1}while(0);do{if(h){f=c[h+12>>2]|0;if((f|0)==(c[h+16>>2]|0)){o=0;f=ka(c[(c[h>>2]|0)+36>>2]|0,h|0)|0;x=o;o=0;if(x&1){R=22;break b}}else f=c[f>>2]|0;if((f|0)!=-1)if(g^(r|0)==0){f=r;t=r;break}else break f;else{c[e>>2]=0;f=0;R=136;break}}else{f=r;R=136}}while(0);if((R|0)==136){R=0;if(g)break f;else t=0}g=c[b>>2]|0;h=c[g+12>>2]|0;if((h|0)==(c[g+16>>2]|0)){o=0;g=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;x=o;o=0;if(x&1){R=22;break b}}else g=c[h>>2]|0;if((g|0)!=(c[p>>2]|0))break f;g=c[b>>2]|0;h=g+12|0;r=c[h>>2]|0;if((r|0)==(c[g+16>>2]|0)){o=0;ka(c[(c[g>>2]|0)+40>>2]|0,g|0)|0;x=o;o=0;if(x&1){R=22;break b}}else c[h>>2]=r+4;p=p+4|0;g=a[X>>0]|0;x=(g&1)==0;g=(x?B:c[A>>2]|0)+((x?(g&255)>>>1:c[B>>2]|0)<<2)|0;if((p|0)==(g|0)){p=g;break}else{r=f;h=t}}}}while(0);if(z?(x=a[X>>0]|0,w=(x&1)==0,(p|0)!=((w?B:c[A>>2]|0)+((w?(x&255)>>>1:c[B>>2]|0)<<2)|0)):0){R=148;break b}else p=q;break}case 4:{v=c[Q>>2]|0;u=x;r=x;p=q;f=0;g:while(1){g=c[b>>2]|0;do{if(g){h=c[g+12>>2]|0;if((h|0)==(c[g+16>>2]|0)){o=0;g=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;x=o;o=0;if(x&1){R=25;break b}}else g=c[h>>2]|0;if((g|0)==-1){c[b>>2]=0;h=1;break}else{h=(c[b>>2]|0)==0;break}}else h=1}while(0);do{if(r){g=c[r+12>>2]|0;if((g|0)==(c[r+16>>2]|0)){o=0;g=ka(c[(c[r>>2]|0)+36>>2]|0,r|0)|0;x=o;o=0;if(x&1){R=25;break b}}else g=c[g>>2]|0;if((g|0)!=-1)if(h^(u|0)==0){g=u;t=u;break}else{q=u;break g}else{c[e>>2]=0;g=0;R=162;break}}else{g=u;R=162}}while(0);if((R|0)==162){R=0;if(h){q=g;break}else t=0}h=c[b>>2]|0;q=c[h+12>>2]|0;if((q|0)==(c[h+16>>2]|0)){o=0;h=ka(c[(c[h>>2]|0)+36>>2]|0,h|0)|0;x=o;o=0;if(x&1){R=25;break b}}else h=c[q>>2]|0;o=0;q=ma(c[(c[l>>2]|0)+12>>2]|0,l|0,2048,h|0)|0;x=o;o=0;if(x&1){R=25;break b}if(q){q=c[n>>2]|0;if((q|0)==(c[K>>2]|0)){o=0;wa(14,m|0,n|0,K|0);x=o;o=0;if(x&1){R=25;break b}q=c[n>>2]|0}c[n>>2]=q+4;c[q>>2]=h;f=f+1|0}else{x=a[T>>0]|0;if(!((h|0)==(v|0)&((f|0)!=0?(((x&1)==0?(x&255)>>>1:c[F>>2]|0)|0)!=0:0))){q=g;break}if((p|0)==(c[N>>2]|0)){o=0;wa(13,_|0,O|0,N|0);x=o;o=0;if(x&1){R=25;break b}p=c[O>>2]|0}x=p+4|0;c[O>>2]=x;c[p>>2]=f;p=x;f=0}h=c[b>>2]|0;q=h+12|0;r=c[q>>2]|0;if((r|0)==(c[h+16>>2]|0)){o=0;ka(c[(c[h>>2]|0)+40>>2]|0,h|0)|0;x=o;o=0;if(x&1){R=25;break b}else{u=g;r=t;continue}}else{c[q>>2]=r+4;u=g;r=t;continue}}if((f|0)!=0?(c[_>>2]|0)!=(p|0):0){if((p|0)==(c[N>>2]|0)){o=0;wa(13,_|0,O|0,N|0);x=o;o=0;if(x&1){R=26;break b}p=c[O>>2]|0}x=p+4|0;c[O>>2]=x;c[p>>2]=f;p=x}t=c[M>>2]|0;if((t|0)>0){f=c[b>>2]|0;do{if(f){g=c[f+12>>2]|0;if((g|0)==(c[f+16>>2]|0)){o=0;f=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;x=o;o=0;if(x&1){R=26;break b}}else f=c[g>>2]|0;if((f|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}else g=1}while(0);do{if(q){f=c[q+12>>2]|0;if((f|0)==(c[q+16>>2]|0)){o=0;f=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;x=o;o=0;if(x&1){R=26;break b}}else f=c[f>>2]|0;if((f|0)!=-1)if(g)break;else{R=206;break b}else{c[e>>2]=0;R=200;break}}else R=200}while(0);if((R|0)==200){R=0;if(g){R=206;break b}else q=0}f=c[b>>2]|0;g=c[f+12>>2]|0;if((g|0)==(c[f+16>>2]|0)){o=0;f=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;x=o;o=0;if(x&1){R=26;break b}}else f=c[g>>2]|0;if((f|0)!=(c[L>>2]|0)){R=206;break b}f=c[b>>2]|0;g=f+12|0;h=c[g>>2]|0;if((h|0)==(c[f+16>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;x=o;o=0;if(x&1){R=26;break b}}else c[g>>2]=h+4;if((t|0)>0){r=q;h=q;u=t;while(1){f=c[b>>2]|0;do{if(f){g=c[f+12>>2]|0;if((g|0)==(c[f+16>>2]|0)){o=0;f=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;x=o;o=0;if(x&1){R=24;break b}}else f=c[g>>2]|0;if((f|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}else g=1}while(0);do{if(h){f=c[h+12>>2]|0;if((f|0)==(c[h+16>>2]|0)){o=0;f=ka(c[(c[h>>2]|0)+36>>2]|0,h|0)|0;x=o;o=0;if(x&1){R=24;break b}}else f=c[f>>2]|0;if((f|0)!=-1)if(g^(r|0)==0){f=r;t=r;break}else{R=231;break b}else{c[e>>2]=0;f=0;R=224;break}}else{f=r;R=224}}while(0);if((R|0)==224){R=0;if(g){R=231;break b}else t=0}g=c[b>>2]|0;h=c[g+12>>2]|0;if((h|0)==(c[g+16>>2]|0)){o=0;g=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;x=o;o=0;if(x&1){R=24;break b}}else g=c[h>>2]|0;o=0;g=ma(c[(c[l>>2]|0)+12>>2]|0,l|0,2048,g|0)|0;x=o;o=0;if(x&1){R=24;break b}if(!g){R=231;break b}if((c[n>>2]|0)==(c[K>>2]|0)?(o=0,wa(14,m|0,n|0,K|0),x=o,o=0,x&1):0){R=24;break b}g=c[b>>2]|0;h=c[g+12>>2]|0;if((h|0)==(c[g+16>>2]|0)){o=0;g=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;x=o;o=0;if(x&1){R=24;break b}}else g=c[h>>2]|0;h=c[n>>2]|0;c[n>>2]=h+4;c[h>>2]=g;g=u;u=u+-1|0;c[M>>2]=u;h=c[b>>2]|0;q=h+12|0;r=c[q>>2]|0;if((r|0)==(c[h+16>>2]|0)){o=0;ka(c[(c[h>>2]|0)+40>>2]|0,h|0)|0;x=o;o=0;if(x&1){R=24;break b}}else c[q>>2]=r+4;if((g|0)<=1)break;else{r=f;h=t}}}}if((c[n>>2]|0)==(c[m>>2]|0)){R=242;break b}break}default:p=q}}while(0);h:do{if((R|0)==44)while(1){R=0;f=c[b>>2]|0;do{if(f){g=c[f+12>>2]|0;if((g|0)==(c[f+16>>2]|0)){o=0;f=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;x=o;o=0;if(x&1){R=21;break b}}else f=c[g>>2]|0;if((f|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}else g=1}while(0);do{if(h){f=c[h+12>>2]|0;if((f|0)==(c[h+16>>2]|0)){o=0;f=ka(c[(c[h>>2]|0)+36>>2]|0,h|0)|0;x=o;o=0;if(x&1){R=21;break b}}else f=c[f>>2]|0;if((f|0)!=-1)if(g^(p|0)==0){r=p;h=p;break}else{p=q;break h}else{c[e>>2]=0;p=0;R=57;break}}else R=57}while(0);if((R|0)==57){R=0;if(g){p=q;break h}else{r=p;h=0}}p=c[b>>2]|0;f=c[p+12>>2]|0;if((f|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;x=o;o=0;if(x&1){R=21;break b}}else p=c[f>>2]|0;o=0;p=ma(c[(c[l>>2]|0)+12>>2]|0,l|0,8192,p|0)|0;x=o;o=0;if(x&1){R=21;break b}if(!p){p=q;break h}p=c[b>>2]|0;f=p+12|0;g=c[f>>2]|0;if((g|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+40>>2]|0,p|0)|0;R=o;o=0;if(R&1){R=21;break b}}else{c[f>>2]=g+4;p=c[g>>2]|0}o=0;ia(92,W|0,p|0);R=o;o=0;if(R&1){R=21;break b}else{p=r;R=44}}}while(0);y=y+1|0;if(y>>>0>=4){t=p;R=244;break}else q=p}i:switch(R|0){case 21:{f=Na()|0;break a}case 22:{f=Na()|0;break a}case 23:{f=Na()|0;break a}case 24:{f=Na()|0;break a}case 25:{f=Na()|0;break a}case 26:{f=Na()|0;break a}case 42:{c[j>>2]=c[j>>2]|4;f=0;break}case 107:{c[j>>2]=c[j>>2]|4;f=0;break}case 148:{c[j>>2]=c[j>>2]|4;f=0;break}case 206:{c[j>>2]=c[j>>2]|4;f=0;break}case 231:{c[j>>2]=c[j>>2]|4;f=0;break}case 242:{c[j>>2]=c[j>>2]|4;f=0;break}case 244:{j:do{if(s){q=s+4|0;r=s+8|0;h=1;k:while(1){p=a[s>>0]|0;if(!(p&1))p=(p&255)>>>1;else p=c[q>>2]|0;if(h>>>0>=p>>>0)break j;p=c[b>>2]|0;do{if(p){f=c[p+12>>2]|0;if((f|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;n=o;o=0;if(n&1){R=20;break k}}else p=c[f>>2]|0;if((p|0)==-1){c[b>>2]=0;g=1;break}else{g=(c[b>>2]|0)==0;break}}else g=1}while(0);p=c[e>>2]|0;do{if(p){f=c[p+12>>2]|0;if((f|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;n=o;o=0;if(n&1){R=20;break k}}else p=c[f>>2]|0;if((p|0)!=-1)if(g)break;else{R=271;break k}else{c[e>>2]=0;R=263;break}}else R=263}while(0);if((R|0)==263?(R=0,g):0){R=271;break}p=c[b>>2]|0;f=c[p+12>>2]|0;if((f|0)==(c[p+16>>2]|0)){o=0;p=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;n=o;o=0;if(n&1){R=20;break}}else p=c[f>>2]|0;if(!(a[s>>0]&1))f=q;else f=c[r>>2]|0;if((p|0)!=(c[f+(h<<2)>>2]|0)){R=271;break}p=h+1|0;f=c[b>>2]|0;g=f+12|0;h=c[g>>2]|0;if((h|0)==(c[f+16>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;n=o;o=0;if(n&1){R=20;break}else{h=p;continue}}else{c[g>>2]=h+4;h=p;continue}}if((R|0)==20){f=Na()|0;break a}else if((R|0)==271){c[j>>2]=c[j>>2]|4;f=0;break i}}}while(0);p=c[_>>2]|0;if((p|0)!=(t|0)?(c[S>>2]=0,Ur(T,p,t,S),(c[S>>2]|0)!=0):0){c[j>>2]=c[j>>2]|4;f=0}else f=1;break}}Wm(W);Wm(U);Wm(V);Wm(X);Im(T);p=c[_>>2]|0;c[_>>2]=0;if((p|0)!=0?(o=0,ha(c[Z>>2]|0,p|0),_=o,o=0,_&1):0){_=Na(0)|0;ec(_)}i=Y;return f|0}}while(0);Wm(W);Wm(U);Wm(V);Wm(X);Im(T);p=c[_>>2]|0;c[_>>2]=0;if((p|0)!=0?(o=0,ha(c[Z>>2]|0,p|0),_=o,o=0,_&1):0){_=Na(0)|0;ec(_)}Ya(f|0);return 0}function Zr(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;w=i;i=i+432|0;k=w+424|0;b=w+24|0;y=w+16|0;s=w+8|0;p=w+4|0;q=w+428|0;l=w;c[y>>2]=b;A=y+4|0;c[A>>2]=189;m=b+400|0;o=0;v=ka(68,g|0)|0;n=o;o=0;if(!(n&1)){c[p>>2]=v;o=0;n=ra(37,p|0,44212)|0;b=o;o=0;a:do{if(!(b&1)?(a[q>>0]=0,t=c[e>>2]|0,c[l>>2]=t,r=c[g+4>>2]|0,u=t,o=0,c[k>>2]=c[l>>2],r=la(2,d|0,k|0,f|0,p|0,r|0,h|0,q|0,n|0,y|0,s|0,m|0)|0,g=o,o=0,!(g&1)):0){if(r){if(!(a[j>>0]&1))a[j>>0]=0;else c[c[j+8>>2]>>2]=0;c[j+4>>2]=0;if(a[q>>0]|0){o=0;b=ra(c[(c[n>>2]|0)+44>>2]|0,n|0,45)|0;g=o;o=0;if(g&1)break;o=0;ia(92,j|0,b|0);g=o;o=0;if(g&1)break}o=0;l=ra(c[(c[n>>2]|0)+44>>2]|0,n|0,48)|0;g=o;o=0;if(g&1)break;b=c[y>>2]|0;m=c[s>>2]|0;k=m+-4|0;b:do{if(b>>>0>>0)do{if((c[b>>2]|0)!=(l|0))break b;b=b+4|0}while(b>>>0>>0)}while(0);o=0;ma(33,j|0,b|0,m|0)|0;j=o;o=0;if(j&1)break}b=c[d>>2]|0;do{if(b){k=c[b+12>>2]|0;if((k|0)==(c[b+16>>2]|0)){o=0;b=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;j=o;o=0;if(j&1)break a}else b=c[k>>2]|0;if((b|0)==-1){c[d>>2]=0;k=1;break}else{k=(c[d>>2]|0)==0;break}}else k=1}while(0);do{if(t){b=c[u+12>>2]|0;if((b|0)==(c[u+16>>2]|0)){o=0;b=ka(c[(c[t>>2]|0)+36>>2]|0,u|0)|0;u=o;o=0;if(u&1)break a}else b=c[b>>2]|0;if((b|0)!=-1)if(k)break;else{z=32;break}else{c[e>>2]=0;z=30;break}}else z=30}while(0);if((z|0)==30?k:0)z=32;if((z|0)==32)c[h>>2]=c[h>>2]|2;k=c[d>>2]|0;pm(v)|0;b=c[y>>2]|0;c[y>>2]=0;if((b|0)!=0?(o=0,ha(c[A>>2]|0,b|0),A=o,o=0,A&1):0){A=Na(0)|0;ec(A)}i=w;return k|0}}while(0);k=Na()|0;pm(v)|0;b=c[y>>2]|0;c[y>>2]=0;if(!b)x=k;else z=38}else{k=Na()|0;c[y>>2]=0;z=38}if((z|0)==38){o=0;ha(c[A>>2]|0,b|0);A=o;o=0;if(A&1){A=Na(0)|0;ec(A)}else x=k}Ya(x|0);return 0}function _r(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=i;i=i+112|0;n=z+100|0;p=z+88|0;q=z+76|0;r=z+64|0;s=z+52|0;t=z+48|0;u=z+36|0;v=z+24|0;w=z+12|0;x=z;do{if(b){b=Is(d,43956)|0;Cb[c[(c[b>>2]|0)+44>>2]&127](n,b);x=c[n>>2]|0;a[e>>0]=x;a[e+1>>0]=x>>8;a[e+2>>0]=x>>16;a[e+3>>0]=x>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](p,b);if(!(a[l>>0]&1))a[l>>0]=0;else c[c[l+8>>2]>>2]=0;c[l+4>>2]=0;o=0;ia(93,l|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[l>>2]=c[p>>2];c[l+4>>2]=c[p+4>>2];c[l+8>>2]=c[p+8>>2];c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;Wm(p);Cb[c[(c[b>>2]|0)+28>>2]&127](q,b);if(!(a[k>>0]&1))a[k>>0]=0;else c[c[k+8>>2]>>2]=0;c[k+4>>2]=0;o=0;ia(93,k|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[k>>2]=c[q>>2];c[k+4>>2]=c[q+4>>2];c[k+8>>2]=c[q+8>>2];c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;Wm(q);c[f>>2]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;c[g>>2]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[b>>2]|0)+20>>2]&127](r,b);if(!(a[h>>0]&1)){a[h+1>>0]=0;a[h>>0]=0}else{a[c[h+8>>2]>>0]=0;c[h+4>>2]=0}o=0;ia(91,h|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}c[h>>2]=c[r>>2];c[h+4>>2]=c[r+4>>2];c[h+8>>2]=c[r+8>>2];c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;Im(r);Cb[c[(c[b>>2]|0)+24>>2]&127](s,b);if(!(a[j>>0]&1))a[j>>0]=0;else c[c[j+8>>2]>>2]=0;c[j+4>>2]=0;o=0;ia(93,j|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}else{c[j>>2]=c[s>>2];c[j+4>>2]=c[s+4>>2];c[j+8>>2]=c[s+8>>2];c[s>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0;Wm(s);y=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}else{b=Is(d,43892)|0;Cb[c[(c[b>>2]|0)+44>>2]&127](t,b);t=c[t>>2]|0;a[e>>0]=t;a[e+1>>0]=t>>8;a[e+2>>0]=t>>16;a[e+3>>0]=t>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](u,b);if(!(a[l>>0]&1))a[l>>0]=0;else c[c[l+8>>2]>>2]=0;c[l+4>>2]=0;o=0;ia(93,l|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[l>>2]=c[u>>2];c[l+4>>2]=c[u+4>>2];c[l+8>>2]=c[u+8>>2];c[u>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;Wm(u);Cb[c[(c[b>>2]|0)+28>>2]&127](v,b);if(!(a[k>>0]&1))a[k>>0]=0;else c[c[k+8>>2]>>2]=0;c[k+4>>2]=0;o=0;ia(93,k|0,0);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}c[k>>2]=c[v>>2];c[k+4>>2]=c[v+4>>2];c[k+8>>2]=c[v+8>>2];c[v>>2]=0;c[v+4>>2]=0;c[v+8>>2]=0;Wm(v);c[f>>2]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;c[g>>2]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[b>>2]|0)+20>>2]&127](w,b);if(!(a[h>>0]&1)){a[h+1>>0]=0;a[h>>0]=0}else{a[c[h+8>>2]>>0]=0;c[h+4>>2]=0}o=0;ia(91,h|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}c[h>>2]=c[w>>2];c[h+4>>2]=c[w+4>>2];c[h+8>>2]=c[w+8>>2];c[w>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;Im(w);Cb[c[(c[b>>2]|0)+24>>2]&127](x,b);if(!(a[j>>0]&1))a[j>>0]=0;else c[c[j+8>>2]>>2]=0;c[j+4>>2]=0;o=0;ia(93,j|0,0);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}else{c[j>>2]=c[x>>2];c[j+4>>2]=c[x+4>>2];c[j+8>>2]=c[x+8>>2];c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;Wm(x);y=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}}while(0);c[m>>2]=y;i=z;return}function $r(a){a=a|0;return}function as(a){a=a|0;cj(a);return}function bs(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=+j;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;D=i;i=i+384|0;v=D+8|0;k=D;m=D+284|0;n=D+72|0;l=D+184|0;F=D+68|0;A=D+80|0;x=D+77|0;B=D+76|0;G=D+56|0;I=D+44|0;H=D+32|0;p=D+28|0;u=D+84|0;z=D+24|0;y=D+20|0;w=D+16|0;c[n>>2]=m;h[v>>3]=j;m=_k(m,100,59018,v)|0;do{if(m>>>0>99){o=0;b=ua(3)|0;C=o;o=0;if(!(C&1)?(o=0,h[k>>3]=j,s=va(17,n|0,b|0,59018,k|0)|0,C=o,o=0,!(C&1)):0){b=c[n>>2]|0;if(!b){o=0;xa(6);C=o;o=0;if(C&1){b=0;k=0;C=7;break}b=c[n>>2]|0}l=Fl(s)|0;k=l;if(!l){o=0;xa(6);C=o;o=0;if(C&1)C=7;else{t=0;C=10}}else{t=l;C=10}}else{b=0;k=0;C=7}}else{k=0;b=0;t=l;s=m;C=10}}while(0);if((C|0)==10){o=0;l=ka(68,f|0)|0;r=o;o=0;if(r&1)C=7;else{c[F>>2]=l;o=0;r=ra(37,F|0,44220)|0;q=o;o=0;if(!(q&1)?(q=c[n>>2]|0,o=0,va(c[(c[r>>2]|0)+32>>2]|0,r|0,q|0,q+s|0,t|0)|0,q=o,o=0,!(q&1)):0){if(!s)q=0;else q=(a[c[n>>2]>>0]|0)==45;c[G>>2]=0;c[G+4>>2]=0;c[G+8>>2]=0;c[I>>2]=0;c[I+4>>2]=0;c[I+8>>2]=0;c[H>>2]=0;c[H+4>>2]=0;c[H+8>>2]=0;o=0;qa(3,e|0,q|0,F|0,A|0,x|0,B|0,G|0,I|0,H|0,p|0);e=o;o=0;if(!(e&1)){p=c[p>>2]|0;if((s|0)>(p|0)){e=a[H>>0]|0;m=a[I>>0]|0;m=(s-p<<1|1)+p+((e&1)==0?(e&255)>>>1:c[H+4>>2]|0)+((m&1)==0?(m&255)>>>1:c[I+4>>2]|0)|0}else{e=a[H>>0]|0;m=a[I>>0]|0;m=p+2+((e&1)==0?(e&255)>>>1:c[H+4>>2]|0)+((m&1)==0?(m&255)>>>1:c[I+4>>2]|0)|0}if(m>>>0>100){m=Fl(m)|0;n=m;if(!m){o=0;xa(6);u=o;o=0;if(!(u&1)){m=0;C=26}}else C=26}else{n=0;m=u;C=26}if((C|0)==26){o=0;na(1,m|0,z|0,y|0,c[f+4>>2]|0,t|0,t+s|0,r|0,q|0,A|0,a[x>>0]|0,a[B>>0]|0,G|0,I|0,H|0,p|0);B=o;o=0;if(!(B&1)?(c[w>>2]=c[d>>2],d=c[z>>2]|0,E=c[y>>2]|0,o=0,c[v>>2]=c[w>>2],E=ja(39,v|0,m|0,d|0,E|0,f|0,g|0)|0,d=o,o=0,!(d&1)):0){if(n){Gl(n);l=c[F>>2]|0}Im(H);Im(I);Im(G);pm(l)|0;if(k)Gl(k);if(b)Gl(b);i=D;return E|0}}m=Na()|0;if(n){Gl(n);l=c[F>>2]|0}}else m=Na()|0;Im(H);Im(I);Im(G)}else m=Na()|0;pm(l)|0}}if((C|0)==7)m=Na()|0;if(k)Gl(k);if(b)Gl(b);Ya(m|0);return 0}function cs(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;D=i;i=i+112|0;q=D+108|0;r=D+96|0;u=D+92|0;v=D+80|0;w=D+68|0;x=D+56|0;y=D+52|0;z=D+40|0;A=D+36|0;B=D+24|0;s=D+12|0;t=D;do{if(b){b=Is(e,43828)|0;e=c[b>>2]|0;do{if(d){Cb[c[e+44>>2]&127](q,b);d=c[q>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](r,b);if(!(a[l>>0]&1)){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}o=0;ia(91,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[r>>2];c[l+4>>2]=c[r+4>>2];c[l+8>>2]=c[r+8>>2];c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;Im(r);p=b;break}}else{Cb[c[e+40>>2]&127](u,b);d=c[u>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+28>>2]&127](v,b);if(!(a[l>>0]&1)){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}o=0;ia(91,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[v>>2];c[l+4>>2]=c[v+4>>2];c[l+8>>2]=c[v+8>>2];c[v>>2]=0;c[v+4>>2]=0;c[v+8>>2]=0;Im(v);p=b;break}}}while(0);a[g>>0]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;a[h>>0]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[p>>2]|0)+20>>2]&127](w,b);if(!(a[j>>0]&1)){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}o=0;ia(91,j|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}c[j>>2]=c[w>>2];c[j+4>>2]=c[w+4>>2];c[j+8>>2]=c[w+8>>2];c[w>>2]=0;c[w+4>>2]=0;c[w+8>>2]=0;Im(w);Cb[c[(c[p>>2]|0)+24>>2]&127](x,b);if(!(a[k>>0]&1)){a[k+1>>0]=0;a[k>>0]=0}else{a[c[k+8>>2]>>0]=0;c[k+4>>2]=0}o=0;ia(91,k|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}else{c[k>>2]=c[x>>2];c[k+4>>2]=c[x+4>>2];c[k+8>>2]=c[x+8>>2];c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;Im(x);C=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}else{b=Is(e,43764)|0;e=c[b>>2]|0;do{if(d){Cb[c[e+44>>2]&127](y,b);d=c[y>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](z,b);if(!(a[l>>0]&1)){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}o=0;ia(91,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[z>>2];c[l+4>>2]=c[z+4>>2];c[l+8>>2]=c[z+8>>2];c[z>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;Im(z);n=b;break}}else{Cb[c[e+40>>2]&127](A,b);d=c[A>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+28>>2]&127](B,b);if(!(a[l>>0]&1)){a[l+1>>0]=0;a[l>>0]=0}else{a[c[l+8>>2]>>0]=0;c[l+4>>2]=0}o=0;ia(91,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[B>>2];c[l+4>>2]=c[B+4>>2];c[l+8>>2]=c[B+8>>2];c[B>>2]=0;c[B+4>>2]=0;c[B+8>>2]=0;Im(B);n=b;break}}}while(0);a[g>>0]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;a[h>>0]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[n>>2]|0)+20>>2]&127](s,b);if(!(a[j>>0]&1)){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}o=0;ia(91,j|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}c[j>>2]=c[s>>2];c[j+4>>2]=c[s+4>>2];c[j+8>>2]=c[s+8>>2];c[s>>2]=0;c[s+4>>2]=0;c[s+8>>2]=0;Im(s);Cb[c[(c[n>>2]|0)+24>>2]&127](t,b);if(!(a[k>>0]&1)){a[k+1>>0]=0;a[k>>0]=0}else{a[c[k+8>>2]>>0]=0;c[k+4>>2]=0}o=0;ia(91,k|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}else{c[k>>2]=c[t>>2];c[k+4>>2]=c[t+4>>2];c[k+8>>2]=c[t+8>>2];c[t>>2]=0;c[t+4>>2]=0;c[t+8>>2]=0;Im(t);C=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}}while(0);c[m>>2]=C;i=D;return}function ds(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;var s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0;c[f>>2]=d;N=q+4|0;O=q+8|0;P=q+1|0;H=p+4|0;I=(g&512|0)==0;J=p+8|0;K=p+1|0;L=j+8|0;M=(r|0)>0;A=o+4|0;B=o+8|0;C=o+1|0;D=r+1|0;F=-2-r-((r|0)<0?~r:-1)|0;G=(r|0)>0;z=0;do{switch(a[l+z>>0]|0){case 0:{c[e>>2]=c[f>>2];break}case 1:{c[e>>2]=c[f>>2];x=Lb[c[(c[j>>2]|0)+28>>2]&63](j,32)|0;y=c[f>>2]|0;c[f>>2]=y+1;a[y>>0]=x;break}case 3:{y=a[q>>0]|0;s=(y&1)==0;if((s?(y&255)>>>1:c[N>>2]|0)|0){x=a[(s?P:c[O>>2]|0)>>0]|0;y=c[f>>2]|0;c[f>>2]=y+1;a[y>>0]=x}break}case 2:{u=a[p>>0]|0;s=(u&1)==0;u=s?(u&255)>>>1:c[H>>2]|0;if(!(I|(u|0)==0)){t=s?K:c[J>>2]|0;v=t+u|0;s=c[f>>2]|0;if(u)do{a[s>>0]=a[t>>0]|0;t=t+1|0;s=s+1|0}while((t|0)!=(v|0));c[f>>2]=s}break}case 4:{s=c[f>>2]|0;h=k?h+1|0:h;w=h;v=c[L>>2]|0;a:do{if(h>>>0>>0){t=h;do{u=a[t>>0]|0;if(u<<24>>24<=-1)break a;if(!(b[v+(u<<24>>24<<1)>>1]&2048))break a;t=t+1|0}while(t>>>0>>0)}else t=h}while(0);u=t;if(M){x=-2-u-~(u>>>0>w>>>0?w:u)|0;x=F>>>0>x>>>0?F:x;if(t>>>0>h>>>0&G){u=t;w=r;while(1){u=u+-1|0;y=a[u>>0]|0;v=c[f>>2]|0;c[f>>2]=v+1;a[v>>0]=y;v=(w|0)>1;if(!(u>>>0>h>>>0&v))break;else w=w+-1|0}}else v=G;y=D+x|0;u=t+(x+1)|0;if(v)w=Lb[c[(c[j>>2]|0)+28>>2]&63](j,48)|0;else w=0;t=c[f>>2]|0;c[f>>2]=t+1;if((y|0)>0){v=y;while(1){a[t>>0]=w;t=c[f>>2]|0;c[f>>2]=t+1;if((v|0)>1)v=v+-1|0;else break}}a[t>>0]=m}else u=t;if((u|0)!=(h|0)){y=a[o>>0]|0;t=(y&1)==0;if(!((t?(y&255)>>>1:c[A>>2]|0)|0))t=-1;else t=a[(t?C:c[B>>2]|0)>>0]|0;if((u|0)!=(h|0)){v=0;w=0;while(1){if((w|0)==(t|0)){y=c[f>>2]|0;c[f>>2]=y+1;a[y>>0]=n;v=v+1|0;y=a[o>>0]|0;t=(y&1)==0;if(v>>>0<(t?(y&255)>>>1:c[A>>2]|0)>>>0){t=a[(t?C:c[B>>2]|0)+v>>0]|0;t=t<<24>>24==127?-1:t<<24>>24;w=0}else{t=w;w=0}}u=u+-1|0;x=a[u>>0]|0;y=c[f>>2]|0;c[f>>2]=y+1;a[y>>0]=x;if((u|0)==(h|0))break;else w=w+1|0}}}else{x=Lb[c[(c[j>>2]|0)+28>>2]&63](j,48)|0;y=c[f>>2]|0;c[f>>2]=y+1;a[y>>0]=x}t=c[f>>2]|0;if((s|0)!=(t|0)?(E=t+-1|0,s>>>0>>0):0){t=E;do{y=a[s>>0]|0;a[s>>0]=a[t>>0]|0;a[t>>0]=y;s=s+1|0;t=t+-1|0}while(s>>>0>>0)}break}default:{}}z=z+1|0}while((z|0)!=4);t=a[q>>0]|0;h=(t&1)==0;t=h?(t&255)>>>1:c[N>>2]|0;if(t>>>0>1){s=h?P:c[O>>2]|0;u=s+t|0;h=c[f>>2]|0;if((t|0)!=1){s=s+1|0;do{a[h>>0]=a[s>>0]|0;h=h+1|0;s=s+1|0}while((s|0)!=(u|0))}c[f>>2]=h}switch(g&176|0){case 32:{c[e>>2]=c[f>>2];break}case 16:break;default:c[e>>2]=d}return}function es(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;z=i;i=i+176|0;r=z+56|0;B=z+52|0;x=z+64|0;u=z+61|0;y=z+60|0;C=z+40|0;E=z+28|0;D=z+16|0;m=z+12|0;q=z+68|0;w=z+8|0;v=z+4|0;s=z;b=jn(f)|0;c[B>>2]=b;o=0;t=ra(37,B|0,44220)|0;p=o;o=0;do{if(p&1)F=13;else{n=a[h>>0]|0;j=(n&1)==0;p=h+4|0;if(!((j?(n&255)>>>1:c[p>>2]|0)|0))n=0;else{j=a[(j?h+1|0:c[h+8>>2]|0)>>0]|0;o=0;k=ra(c[(c[t>>2]|0)+28>>2]|0,t|0,45)|0;n=o;o=0;if(n&1){F=13;break}n=j<<24>>24==k<<24>>24}c[C>>2]=0;c[C+4>>2]=0;c[C+8>>2]=0;c[E>>2]=0;c[E+4>>2]=0;c[E+8>>2]=0;c[D>>2]=0;c[D+4>>2]=0;c[D+8>>2]=0;o=0;qa(3,e|0,n|0,B|0,x|0,u|0,y|0,C|0,E|0,D|0,m|0);l=o;o=0;if(!(l&1)){l=a[h>>0]|0;e=c[p>>2]|0;j=(l&1)==0?(l&255)>>>1:e;m=c[m>>2]|0;if((j|0)>(m|0)){G=a[D>>0]|0;k=a[E>>0]|0;j=(j-m<<1|1)+m+((G&1)==0?(G&255)>>>1:c[D+4>>2]|0)+((k&1)==0?(k&255)>>>1:c[E+4>>2]|0)|0}else{G=a[D>>0]|0;j=a[E>>0]|0;j=m+2+((G&1)==0?(G&255)>>>1:c[D+4>>2]|0)+((j&1)==0?(j&255)>>>1:c[E+4>>2]|0)|0}if(j>>>0>100){j=Fl(j)|0;k=j;if(!j){o=0;xa(6);G=o;o=0;if(!(G&1)){l=a[h>>0]|0;e=c[p>>2]|0;j=0;F=17}}else F=17}else{k=0;j=q;F=17}if((F|0)==17){G=(l&1)==0;h=G?h+1|0:c[h+8>>2]|0;o=0;na(1,j|0,w|0,v|0,c[f+4>>2]|0,h|0,h+(G?(l&255)>>>1:e)|0,t|0,n|0,x|0,a[u>>0]|0,a[y>>0]|0,C|0,E|0,D|0,m|0);G=o;o=0;if(!(G&1)?(c[s>>2]=c[d>>2],G=c[w>>2]|0,A=c[v>>2]|0,o=0,c[r>>2]=c[s>>2],A=ja(39,r|0,j|0,G|0,A|0,f|0,g|0)|0,G=o,o=0,!(G&1)):0){if(k){Gl(k);b=c[B>>2]|0}Im(D);Im(E);Im(C);pm(b)|0;i=z;return A|0}}j=Na()|0;if(k){Gl(k);b=c[B>>2]|0}}else j=Na()|0;Im(D);Im(E);Im(C)}}while(0);if((F|0)==13)j=Na()|0;pm(b)|0;Ya(j|0);return 0}function fs(a){a=a|0;return}function gs(a){a=a|0;cj(a);return}function hs(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=+j;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;D=i;i=i+992|0;v=D+8|0;k=D;m=D+888|0;n=D+880|0;l=D+480|0;F=D+76|0;A=D+884|0;x=D+72|0;B=D+68|0;G=D+56|0;I=D+44|0;H=D+32|0;p=D+28|0;u=D+80|0;z=D+24|0;y=D+20|0;w=D+16|0;c[n>>2]=m;h[v>>3]=j;m=_k(m,100,59018,v)|0;do{if(m>>>0>99){o=0;b=ua(3)|0;C=o;o=0;if(!(C&1)?(o=0,h[k>>3]=j,s=va(17,n|0,b|0,59018,k|0)|0,C=o,o=0,!(C&1)):0){b=c[n>>2]|0;if(!b){o=0;xa(6);C=o;o=0;if(C&1){b=0;k=0;C=7;break}b=c[n>>2]|0}l=Fl(s<<2)|0;k=l;if(!l){o=0;xa(6);C=o;o=0;if(C&1)C=7;else{t=0;C=10}}else{t=l;C=10}}else{b=0;k=0;C=7}}else{k=0;b=0;t=l;s=m;C=10}}while(0);if((C|0)==10){o=0;l=ka(68,f|0)|0;r=o;o=0;if(r&1)C=7;else{c[F>>2]=l;o=0;r=ra(37,F|0,44212)|0;q=o;o=0;if(!(q&1)?(q=c[n>>2]|0,o=0,va(c[(c[r>>2]|0)+48>>2]|0,r|0,q|0,q+s|0,t|0)|0,q=o,o=0,!(q&1)):0){if(!s)q=0;else q=(a[c[n>>2]>>0]|0)==45;c[G>>2]=0;c[G+4>>2]=0;c[G+8>>2]=0;c[I>>2]=0;c[I+4>>2]=0;c[I+8>>2]=0;c[H>>2]=0;c[H+4>>2]=0;c[H+8>>2]=0;o=0;qa(4,e|0,q|0,F|0,A|0,x|0,B|0,G|0,I|0,H|0,p|0);e=o;o=0;if(!(e&1)){p=c[p>>2]|0;if((s|0)>(p|0)){e=a[H>>0]|0;m=a[I>>0]|0;m=(s-p<<1|1)+p+((e&1)==0?(e&255)>>>1:c[H+4>>2]|0)+((m&1)==0?(m&255)>>>1:c[I+4>>2]|0)|0}else{e=a[H>>0]|0;m=a[I>>0]|0;m=p+2+((e&1)==0?(e&255)>>>1:c[H+4>>2]|0)+((m&1)==0?(m&255)>>>1:c[I+4>>2]|0)|0}if(m>>>0>100){m=Fl(m<<2)|0;n=m;if(!m){o=0;xa(6);u=o;o=0;if(!(u&1)){m=0;C=26}}else C=26}else{n=0;m=u;C=26}if((C|0)==26){o=0;na(2,m|0,z|0,y|0,c[f+4>>2]|0,t|0,t+(s<<2)|0,r|0,q|0,A|0,c[x>>2]|0,c[B>>2]|0,G|0,I|0,H|0,p|0);B=o;o=0;if(!(B&1)?(c[w>>2]=c[d>>2],d=c[z>>2]|0,E=c[y>>2]|0,o=0,c[v>>2]=c[w>>2],E=ja(40,v|0,m|0,d|0,E|0,f|0,g|0)|0,d=o,o=0,!(d&1)):0){if(n){Gl(n);l=c[F>>2]|0}Wm(H);Wm(I);Im(G);pm(l)|0;if(k)Gl(k);if(b)Gl(b);i=D;return E|0}}m=Na()|0;if(n){Gl(n);l=c[F>>2]|0}}else m=Na()|0;Wm(H);Wm(I);Im(G)}else m=Na()|0;pm(l)|0}}if((C|0)==7)m=Na()|0;if(k)Gl(k);if(b)Gl(b);Ya(m|0);return 0}function is(b,d,e,f,g,h,j,k,l,m){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;B=i;i=i+112|0;n=B+108|0;p=B+96|0;s=B+92|0;t=B+80|0;u=B+68|0;v=B+56|0;w=B+52|0;x=B+40|0;y=B+36|0;z=B+24|0;q=B+12|0;r=B;do{if(b){b=Is(e,43956)|0;e=c[b>>2]|0;do{if(d){Cb[c[e+44>>2]&127](n,b);d=c[n>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](p,b);if(!(a[l>>0]&1))a[l>>0]=0;else c[c[l+8>>2]>>2]=0;c[l+4>>2]=0;o=0;ia(93,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[p>>2];c[l+4>>2]=c[p+4>>2];c[l+8>>2]=c[p+8>>2];c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;Wm(p);break}}else{Cb[c[e+40>>2]&127](s,b);d=c[s>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+28>>2]&127](t,b);if(!(a[l>>0]&1))a[l>>0]=0;else c[c[l+8>>2]>>2]=0;c[l+4>>2]=0;o=0;ia(93,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[t>>2];c[l+4>>2]=c[t+4>>2];c[l+8>>2]=c[t+8>>2];c[t>>2]=0;c[t+4>>2]=0;c[t+8>>2]=0;Wm(t);break}}}while(0);c[g>>2]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;c[h>>2]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[b>>2]|0)+20>>2]&127](u,b);if(!(a[j>>0]&1)){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}o=0;ia(91,j|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}c[j>>2]=c[u>>2];c[j+4>>2]=c[u+4>>2];c[j+8>>2]=c[u+8>>2];c[u>>2]=0;c[u+4>>2]=0;c[u+8>>2]=0;Im(u);Cb[c[(c[b>>2]|0)+24>>2]&127](v,b);if(!(a[k>>0]&1))a[k>>0]=0;else c[c[k+8>>2]>>2]=0;c[k+4>>2]=0;o=0;ia(93,k|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}else{c[k>>2]=c[v>>2];c[k+4>>2]=c[v+4>>2];c[k+8>>2]=c[v+8>>2];c[v>>2]=0;c[v+4>>2]=0;c[v+8>>2]=0;Wm(v);A=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}else{b=Is(e,43892)|0;e=c[b>>2]|0;do{if(d){Cb[c[e+44>>2]&127](w,b);d=c[w>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+32>>2]&127](x,b);if(!(a[l>>0]&1))a[l>>0]=0;else c[c[l+8>>2]>>2]=0;c[l+4>>2]=0;o=0;ia(93,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[x>>2];c[l+4>>2]=c[x+4>>2];c[l+8>>2]=c[x+8>>2];c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;Wm(x);break}}else{Cb[c[e+40>>2]&127](y,b);d=c[y>>2]|0;a[f>>0]=d;a[f+1>>0]=d>>8;a[f+2>>0]=d>>16;a[f+3>>0]=d>>24;Cb[c[(c[b>>2]|0)+28>>2]&127](z,b);if(!(a[l>>0]&1))a[l>>0]=0;else c[c[l+8>>2]>>2]=0;c[l+4>>2]=0;o=0;ia(93,l|0,0);f=o;o=0;if(f&1){l=Na(0)|0;ec(l)}else{c[l>>2]=c[z>>2];c[l+4>>2]=c[z+4>>2];c[l+8>>2]=c[z+8>>2];c[z>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;Wm(z);break}}}while(0);c[g>>2]=Eb[c[(c[b>>2]|0)+12>>2]&127](b)|0;c[h>>2]=Eb[c[(c[b>>2]|0)+16>>2]&127](b)|0;Cb[c[(c[b>>2]|0)+20>>2]&127](q,b);if(!(a[j>>0]&1)){a[j+1>>0]=0;a[j>>0]=0}else{a[c[j+8>>2]>>0]=0;c[j+4>>2]=0}o=0;ia(91,j|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}c[j>>2]=c[q>>2];c[j+4>>2]=c[q+4>>2];c[j+8>>2]=c[q+8>>2];c[q>>2]=0;c[q+4>>2]=0;c[q+8>>2]=0;Im(q);Cb[c[(c[b>>2]|0)+24>>2]&127](r,b);if(!(a[k>>0]&1))a[k>>0]=0;else c[c[k+8>>2]>>2]=0;c[k+4>>2]=0;o=0;ia(93,k|0,0);h=o;o=0;if(h&1){h=Na(0)|0;ec(h)}else{c[k>>2]=c[r>>2];c[k+4>>2]=c[r+4>>2];c[k+8>>2]=c[r+8>>2];c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;Wm(r);A=Eb[c[(c[b>>2]|0)+36>>2]&127](b)|0;break}}}while(0);c[m>>2]=A;i=B;return}function js(b,d,e,f,g,h,i,j,k,l,m,n,o,p,q){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;var r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0;c[e>>2]=b;J=p+4|0;K=p+8|0;C=o+4|0;D=(f&512|0)==0;E=o+8|0;F=(q|0)>0;G=n+4|0;H=n+8|0;I=n+1|0;A=(q|0)>0;z=0;do{switch(a[k+z>>0]|0){case 0:{c[d>>2]=c[e>>2];break}case 1:{c[d>>2]=c[e>>2];x=Lb[c[(c[i>>2]|0)+44>>2]&63](i,32)|0;y=c[e>>2]|0;c[e>>2]=y+4;c[y>>2]=x;break}case 3:{y=a[p>>0]|0;r=(y&1)==0;if((r?(y&255)>>>1:c[J>>2]|0)|0){x=c[(r?J:c[K>>2]|0)>>2]|0;y=c[e>>2]|0;c[e>>2]=y+4;c[y>>2]=x}break}case 2:{v=a[o>>0]|0;r=(v&1)==0;v=r?(v&255)>>>1:c[C>>2]|0;if(!(D|(v|0)==0)){r=r?C:c[E>>2]|0;t=r+(v<<2)|0;u=c[e>>2]|0;if(v){s=u;while(1){c[s>>2]=c[r>>2];r=r+4|0;if((r|0)==(t|0))break;else s=s+4|0}}c[e>>2]=u+(v<<2)}break}case 4:{r=c[e>>2]|0;g=j?g+4|0:g;a:do{if(g>>>0>>0){s=g;do{if(!(Gb[c[(c[i>>2]|0)+12>>2]&63](i,2048,c[s>>2]|0)|0))break a;s=s+4|0}while(s>>>0>>0)}else s=g}while(0);if(F){if(s>>>0>g>>>0&A){v=c[e>>2]|0;u=q;while(1){s=s+-4|0;t=v+4|0;c[v>>2]=c[s>>2];w=u+-1|0;u=(u|0)>1;if(s>>>0>g>>>0&u){v=t;u=w}else{v=w;break}}c[e>>2]=t;t=v}else{u=A;t=q}if(u)w=Lb[c[(c[i>>2]|0)+44>>2]&63](i,48)|0;else w=0;x=c[e>>2]|0;u=t+((t|0)<0?~t:-1)|0;if((t|0)>0){v=x;while(1){c[v>>2]=w;if((t|0)>1){v=v+4|0;t=t+-1|0}else break}}c[e>>2]=x+(u+2<<2);c[x+(u+1<<2)>>2]=l}if((s|0)==(g|0)){x=Lb[c[(c[i>>2]|0)+44>>2]&63](i,48)|0;y=c[e>>2]|0;s=y+4|0;c[e>>2]=s;c[y>>2]=x}else{x=a[n>>0]|0;t=(x&1)==0;y=c[G>>2]|0;if(!((t?(x&255)>>>1:y)|0))t=-1;else t=a[(t?I:c[H>>2]|0)>>0]|0;if((s|0)!=(g|0)){w=0;x=0;while(1){u=c[e>>2]|0;if((x|0)==(t|0)){v=u+4|0;c[e>>2]=v;c[u>>2]=m;w=w+1|0;u=a[n>>0]|0;t=(u&1)==0;if(w>>>0<(t?(u&255)>>>1:y)>>>0){t=a[(t?I:c[H>>2]|0)+w>>0]|0;u=v;t=t<<24>>24==127?-1:t<<24>>24;v=0}else{u=v;t=x;v=0}}else v=x;s=s+-4|0;x=c[s>>2]|0;c[e>>2]=u+4;c[u>>2]=x;if((s|0)==(g|0))break;else x=v+1|0}}s=c[e>>2]|0}if((r|0)!=(s|0)?(B=s+-4|0,r>>>0>>0):0){s=B;do{y=c[r>>2]|0;c[r>>2]=c[s>>2];c[s>>2]=y;r=r+4|0;s=s+-4|0}while(r>>>0>>0)}break}default:{}}z=z+1|0}while((z|0)!=4);r=a[p>>0]|0;g=(r&1)==0;r=g?(r&255)>>>1:c[J>>2]|0;if(r>>>0>1){s=g?J:c[K>>2]|0;g=s+4|0;s=s+(r<<2)|0;t=c[e>>2]|0;u=s-g|0;if((r|0)!=1){r=t;while(1){c[r>>2]=c[g>>2];g=g+4|0;if((g|0)==(s|0))break;else r=r+4|0}}c[e>>2]=t+(u>>>2<<2)}switch(f&176|0){case 32:{c[d>>2]=c[e>>2];break}case 16:break;default:c[d>>2]=b}return}function ks(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;z=i;i=i+480|0;q=z+468|0;B=z+464|0;x=z+472|0;u=z+56|0;y=z+52|0;C=z+40|0;E=z+28|0;D=z+16|0;m=z+12|0;p=z+64|0;w=z+8|0;v=z+4|0;r=z;b=jn(f)|0;c[B>>2]=b;o=0;s=ra(37,B|0,44212)|0;t=o;o=0;do{if(t&1)F=13;else{n=a[h>>0]|0;j=(n&1)==0;t=h+4|0;if(!((j?(n&255)>>>1:c[t>>2]|0)|0))n=0;else{j=c[(j?t:c[h+8>>2]|0)>>2]|0;o=0;k=ra(c[(c[s>>2]|0)+44>>2]|0,s|0,45)|0;n=o;o=0;if(n&1){F=13;break}n=(j|0)==(k|0)}c[C>>2]=0;c[C+4>>2]=0;c[C+8>>2]=0;c[E>>2]=0;c[E+4>>2]=0;c[E+8>>2]=0;c[D>>2]=0;c[D+4>>2]=0;c[D+8>>2]=0;o=0;qa(4,e|0,n|0,B|0,x|0,u|0,y|0,C|0,E|0,D|0,m|0);l=o;o=0;if(!(l&1)){l=a[h>>0]|0;e=c[t>>2]|0;j=(l&1)==0?(l&255)>>>1:e;m=c[m>>2]|0;if((j|0)>(m|0)){G=a[D>>0]|0;k=a[E>>0]|0;j=(j-m<<1|1)+m+((G&1)==0?(G&255)>>>1:c[D+4>>2]|0)+((k&1)==0?(k&255)>>>1:c[E+4>>2]|0)|0}else{G=a[D>>0]|0;j=a[E>>0]|0;j=m+2+((G&1)==0?(G&255)>>>1:c[D+4>>2]|0)+((j&1)==0?(j&255)>>>1:c[E+4>>2]|0)|0}if(j>>>0>100){j=Fl(j<<2)|0;k=j;if(!j){o=0;xa(6);G=o;o=0;if(!(G&1)){l=a[h>>0]|0;e=c[t>>2]|0;j=0;F=17}}else F=17}else{k=0;j=p;F=17}if((F|0)==17){G=(l&1)==0;h=G?t:c[h+8>>2]|0;o=0;na(2,j|0,w|0,v|0,c[f+4>>2]|0,h|0,h+((G?(l&255)>>>1:e)<<2)|0,s|0,n|0,x|0,c[u>>2]|0,c[y>>2]|0,C|0,E|0,D|0,m|0);G=o;o=0;if(!(G&1)?(c[r>>2]=c[d>>2],G=c[w>>2]|0,A=c[v>>2]|0,o=0,c[q>>2]=c[r>>2],A=ja(40,q|0,j|0,G|0,A|0,f|0,g|0)|0,G=o,o=0,!(G&1)):0){if(k){Gl(k);b=c[B>>2]|0}Wm(D);Wm(E);Im(C);pm(b)|0;i=z;return A|0}}j=Na()|0;if(k){Gl(k);b=c[B>>2]|0}}else j=Na()|0;Wm(D);Wm(E);Im(C)}}while(0);if((F|0)==13)j=Na()|0;pm(b)|0;Ya(j|0);return 0}function ls(a){a=a|0;return}function ms(a){a=a|0;cj(a);return}function ns(b,d,e){b=b|0;d=d|0;e=e|0;b=lk((a[d>>0]&1)==0?d+1|0:c[d+8>>2]|0,1)|0;return b>>>((b|0)!=(-1|0)&1)|0}function os(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0;k=i;i=i+16|0;l=k;c[l>>2]=0;c[l+4>>2]=0;c[l+8>>2]=0;j=a[h>>0]|0;m=(j&1)==0;d=m?h+1|0:c[h+8>>2]|0;j=m?(j&255)>>>1:c[h+4>>2]|0;h=d+j|0;a:do{if((j|0)>0){while(1){o=0;ia(67,l|0,a[d>>0]|0);m=o;o=0;if(m&1)break;d=d+1|0;if(d>>>0>=h>>>0){j=4;break a}}d=Na()|0;j=7}else j=4}while(0);b:do{if((j|0)==4){o=0;d=va(19,((e|0)==-1?-1:e<<1)|0,f|0,g|0,((a[l>>0]&1)==0?l+1|0:c[l+8>>2]|0)|0)|0;m=o;o=0;if(m&1){d=Na()|0;j=7;break}c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;m=nl(d)|0;h=d+m|0;c:do{if((m|0)>0){while(1){o=0;ia(67,b|0,a[d>>0]|0);m=o;o=0;if(m&1)break;d=d+1|0;if(d>>>0>=h>>>0)break c}d=Na()|0;Im(b);break b}}while(0);Im(l);i=k;return}}while(0);Im(l);Ya(d|0)}function ps(a,b){a=a|0;b=b|0;return}function qs(a){a=a|0;return}function rs(a){a=a|0;cj(a);return}function ss(b,d,e){b=b|0;d=d|0;e=e|0;b=lk((a[d>>0]&1)==0?d+1|0:c[d+8>>2]|0,1)|0;return b>>>((b|0)!=(-1|0)&1)|0}function ts(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;w=i;i=i+224|0;p=w+184|0;n=w+192|0;m=w+180|0;q=w+176|0;u=w+168|0;t=w+40|0;s=w+32|0;v=w+28|0;x=w+16|0;l=w+8|0;r=w;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;c[l+4>>2]=0;c[l>>2]=44696;k=a[h>>0]|0;y=(k&1)==0;j=h+4|0;d=y?j:c[h+8>>2]|0;h=y?(k&255)>>>1:c[j>>2]|0;j=d+(h<<2)|0;k=n+32|0;a:do{if((h|0)>0){b:while(1){c[q>>2]=d;o=0;h=ya(c[(c[l>>2]|0)+12>>2]|0,l|0,p|0,d|0,j|0,q|0,n|0,k|0,m|0)|0;y=o;o=0;if(y&1){h=12;break}if((h|0)==2?1:(c[q>>2]|0)==(d|0)){h=5;break}if(n>>>0<(c[m>>2]|0)>>>0){d=n;do{o=0;ia(67,x|0,a[d>>0]|0);y=o;o=0;if(y&1){h=11;break b}d=d+1|0}while(d>>>0<(c[m>>2]|0)>>>0)}d=c[q>>2]|0;if(!((h|0)!=2&d>>>0>>0)){h=9;break a}}if((h|0)==5){o=0;ha(190,58955);o=0;d=Na()|0}else if((h|0)==11)d=Na()|0;else if((h|0)==12)d=Na()|0}else h=9}while(0);c:do{if((h|0)==9){o=0;d=va(19,((e|0)==-1?-1:e<<1)|0,f|0,g|0,((a[x>>0]&1)==0?x+1|0:c[x+8>>2]|0)|0)|0;y=o;o=0;if(y&1){d=Na()|0;break}c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[r+4>>2]=0;c[r>>2]=44744;y=nl(d)|0;j=d+y|0;k=j;l=t+128|0;d:do{if((y|0)>0){e:while(1){c[v>>2]=d;o=0;h=ya(c[(c[r>>2]|0)+16>>2]|0,r|0,u|0,d|0,((k-d|0)>32?d+32|0:j)|0,v|0,t|0,l|0,s|0)|0;y=o;o=0;if(y&1){h=24;break}if((h|0)==2?1:(c[v>>2]|0)==(d|0)){h=18;break}if(t>>>0<(c[s>>2]|0)>>>0){d=t;do{o=0;ia(92,b|0,c[d>>2]|0);y=o;o=0;if(y&1){h=23;break e}d=d+4|0}while(d>>>0<(c[s>>2]|0)>>>0)}d=c[v>>2]|0;if(!((h|0)!=2&d>>>0>>0))break d}if((h|0)==18){o=0;ha(190,58955);o=0;d=Na()|0}else if((h|0)==23)d=Na()|0;else if((h|0)==24)d=Na()|0;Wm(b);break c}}while(0);Im(x);i=w;return}}while(0);Im(x);Ya(d|0)}function us(a,b){a=a|0;b=b|0;return}function vs(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;c[b+4>>2]=d+-1;c[b>>2]=44196;h=b+8|0;o=0;ia(94,h|0,28);g=o;o=0;if(g&1)d=Na()|0;else{g=b+144|0;o=0;wa(5,g|0,58885,1);f=o;o=0;if(f&1)d=Na()|0;else{e=c[h>>2]|0;f=b+12|0;d=c[f>>2]|0;if((d|0)!=(e|0)){do{d=d+-4|0}while((d|0)!=(e|0));c[f>>2]=d}c[495]=0;c[494]=43124;o=0;ia(95,b|0,1976);f=o;o=0;do{if(((((((((((((!(f&1)?(c[497]=0,c[496]=43164,o=0,ia(96,b|0,1984),f=o,o=0,!(f&1)):0)?(c[499]=0,c[498]=44236,c[500]=0,a[2004]=0,c[500]=Os()|0,o=0,ia(97,b|0,1992),f=o,o=0,!(f&1)):0)?(c[503]=0,c[502]=44484,o=0,ia(98,b|0,2008),f=o,o=0,!(f&1)):0)?(c[505]=0,c[504]=44552,o=0,ia(99,b|0,2016),f=o,o=0,!(f&1)):0)?(o=0,ia(100,2024,1),f=o,o=0,!(f&1)):0)?(o=0,ia(101,b|0,2024),f=o,o=0,!(f&1)):0)?(c[511]=0,c[510]=44600,o=0,ia(102,b|0,2040),f=o,o=0,!(f&1)):0)?(c[513]=0,c[512]=44648,o=0,ia(103,b|0,2048),f=o,o=0,!(f&1)):0)?(Tt(2056,1),o=0,ia(104,b|0,2056),f=o,o=0,!(f&1)):0)?(Ut(2080,1),o=0,ia(105,b|0,2080),f=o,o=0,!(f&1)):0)?(c[529]=0,c[528]=43204,o=0,ia(106,b|0,2112),f=o,o=0,!(f&1)):0)?(c[531]=0,c[530]=43276,o=0,ia(107,b|0,2120),f=o,o=0,!(f&1)):0)?(c[533]=0,c[532]=43348,o=0,ia(108,b|0,2128),f=o,o=0,!(f&1)):0){c[535]=0;c[534]=43408;o=0;ia(109,b|0,2136);f=o;o=0;if(f&1){i=42;break}c[537]=0;c[536]=43716;o=0;ia(110,b|0,2144);f=o;o=0;if(f&1){i=42;break}c[539]=0;c[538]=43780;o=0;ia(111,b|0,2152);f=o;o=0;if(f&1){i=42;break}c[541]=0;c[540]=43844;o=0;ia(112,b|0,2160);f=o;o=0;if(f&1){i=42;break}c[543]=0;c[542]=43908;o=0;ia(113,b|0,2168);f=o;o=0;if(f&1){i=42;break}c[545]=0;c[544]=43972;o=0;ia(114,b|0,2176);f=o;o=0;if(f&1){i=42;break}c[547]=0;c[546]=44008;o=0;ia(115,b|0,2184);f=o;o=0;if(f&1){i=42;break}c[549]=0;c[548]=44044;o=0;ia(116,b|0,2192);f=o;o=0;if(f&1){i=42;break}c[551]=0;c[550]=44080;o=0;ia(117,b|0,2200);f=o;o=0;if(f&1){i=42;break}c[553]=0;c[552]=43468;c[554]=43516;o=0;ia(118,b|0,2208);f=o;o=0;if(f&1){i=42;break}c[557]=0;c[556]=43560;c[558]=43608;o=0;ia(119,b|0,2224);f=o;o=0;if(f&1){i=42;break}c[561]=0;c[560]=44464;o=0;d=ua(3)|0;f=o;o=0;if(f&1){d=Na()|0;break}c[562]=d;c[560]=43652;o=0;ia(120,b|0,2240);f=o;o=0;if(f&1){i=42;break}c[565]=0;c[564]=44464;o=0;d=ua(3)|0;f=o;o=0;if(f&1){d=Na()|0;break}c[566]=d;c[564]=43684;o=0;ia(121,b|0,2256);i=o;o=0;if(i&1){i=42;break}c[569]=0;c[568]=44116;o=0;ia(122,b|0,2272);i=o;o=0;if(i&1){i=42;break}c[571]=0;c[570]=44156;o=0;ia(123,b|0,2280);i=o;o=0;if(i&1){i=42;break}return}else i=42}while(0);if((i|0)==42)d=Na()|0;Im(g)}Dv(h)}Ya(d|0)}function ws(){var b=0;do{if((a[2288]|0)==0?(Ha(2288)|0)!=0:0){o=0;ua(4)|0;b=o;o=0;if(b&1){b=Na()|0;sb(2288);Ya(b|0)}else{c[11246]=44980;Pa(2288);break}}}while(0);return c[11246]|0}function xs(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;om(b);f=a+8|0;e=c[f>>2]|0;do{if((c[a+12>>2]|0)-e>>2>>>0<=d>>>0){o=0;ia(124,f|0,d+1|0);a=o;o=0;if(!(a&1)){e=c[f>>2]|0;break}e=Na()|0;if(b)pm(b)|0;Ya(e|0)}}while(0);a=c[e+(d<<2)>>2]|0;if(a){pm(a)|0;e=c[f>>2]|0}c[e+(d<<2)>>2]=b;return}function ys(a){a=a|0;var b=0,d=0,e=0,f=0;c[a>>2]=44196;e=a+8|0;f=a+12|0;b=c[e>>2]|0;if((c[f>>2]|0)!=(b|0)){d=0;do{b=c[b+(d<<2)>>2]|0;if(b)pm(b)|0;d=d+1|0;b=c[e>>2]|0}while(d>>>0<(c[f>>2]|0)-b>>2>>>0)}Im(a+144|0);Dv(e);return}function zs(a){a=a|0;ys(a);cj(a);return}function As(a,b){a=a|0;b=b|0;if(Fv(a,b)|0)return c[(c[a+8>>2]|0)+(b<<2)>>2]|0;else{a=Ma(4)|0;qj(a);lb(a|0,640,82)}return 0}function Bs(){vs(2296,1);c[11245]=2296;return 44980}function Cs(){var a=0;a=c[(ws()|0)>>2]|0;c[11247]=a;om(a);return 44988}function Ds(){var b=0;do{if((a[2456]|0)==0?(Ha(2456)|0)!=0:0){o=0;ua(5)|0;b=o;o=0;if(b&1){b=Na()|0;sb(2456);Ya(b|0)}else{c[11248]=44988;Pa(2456);break}}}while(0);return c[11248]|0}function Es(a){a=a|0;var b=0,d=0;o=0;b=ua(6)|0;d=o;o=0;if(d&1){d=Na(0)|0;ec(d)}else{d=c[b>>2]|0;c[a>>2]=d;om(d);return}}function Fs(a,b){a=a|0;b=b|0;b=c[b>>2]|0;c[a>>2]=b;om(b);return}function Gs(a){a=a|0;pm(c[a>>2]|0)|0;return}function Hs(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;if((c[a>>2]|0)!=-1){c[b>>2]=a;c[b+4>>2]=191;c[b+8>>2]=0;Em(a,b,192)}i=d;return(c[a+4>>2]|0)+-1|0}function Is(a,b){a=a|0;b=b|0;a=c[a>>2]|0;return As(a,Hs(b)|0)|0}function Js(a){a=a|0;cj(a);return}function Ks(a){a=a|0;if(a)Bb[c[(c[a>>2]|0)+4>>2]&255](a);return}function Ls(a){a=a|0;var b=0;b=c[11052]|0;c[11052]=b+1;c[a+4>>2]=b+1;return}function Ms(a){a=a|0;cj(a);return}function Ns(a,c,d){a=a|0;c=c|0;d=d|0;if(d>>>0<128)d=(b[(Os()|0)+(d<<1)>>1]&c)<<16>>16!=0;else d=0;return d|0}function Os(){var a=0,b=0;o=0;a=ua(7)|0;b=o;o=0;if(b&1){b=Na(0)|0;ec(b)}else return c[a>>2]|0;return 0}function Ps(a,d,f,g){a=a|0;d=d|0;f=f|0;g=g|0;var h=0,i=0;i=(f-d|0)>>>2;if((d|0)!=(f|0)){h=d;while(1){a=c[h>>2]|0;if(a>>>0<128)a=e[(Os()|0)+(a<<1)>>1]|0;else a=0;b[g>>1]=a;h=h+4|0;if((h|0)==(f|0))break;else g=g+2|0}}return d+(i<<2)|0}function Qs(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;a:do{if((e|0)==(f|0))e=f;else while(1){a=c[e>>2]|0;if(a>>>0<128?(b[(Os()|0)+(a<<1)>>1]&d)<<16>>16!=0:0)break a;e=e+4|0;if((e|0)==(f|0)){e=f;break}}}while(0);return e|0}function Rs(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;a:do{if((e|0)==(f|0))e=f;else while(1){a=c[e>>2]|0;if(a>>>0>=128)break a;if(!((b[(Os()|0)+(a<<1)>>1]&d)<<16>>16))break a;e=e+4|0;if((e|0)==(f|0)){e=f;break}}}while(0);return e|0}function Ss(a,b){a=a|0;b=b|0;if(b>>>0<128)b=c[(Ts()|0)+(b<<2)>>2]|0;return b|0}function Ts(){var a=0,b=0;o=0;a=ua(8)|0;b=o;o=0;if(b&1){b=Na(0)|0;ec(b)}else return c[a>>2]|0;return 0}function Us(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=(d-b|0)>>>2;if((b|0)!=(d|0)){e=b;do{a=c[e>>2]|0;if(a>>>0<128)a=c[(Ts()|0)+(a<<2)>>2]|0;c[e>>2]=a;e=e+4|0}while((e|0)!=(d|0))}return b+(f<<2)|0}function Vs(a,b){a=a|0;b=b|0;if(b>>>0<128)b=c[(Ws()|0)+(b<<2)>>2]|0;return b|0}function Ws(){var a=0,b=0;o=0;a=ua(9)|0;b=o;o=0;if(b&1){b=Na(0)|0;ec(b)}else return c[a>>2]|0;return 0}function Xs(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=(d-b|0)>>>2;if((b|0)!=(d|0)){e=b;do{a=c[e>>2]|0;if(a>>>0<128)a=c[(Ws()|0)+(a<<2)>>2]|0;c[e>>2]=a;e=e+4|0}while((e|0)!=(d|0))}return b+(f<<2)|0}function Ys(a,b){a=a|0;b=b|0;return b<<24>>24|0}function Zs(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;if((d|0)!=(e|0))while(1){c[f>>2]=a[d>>0];d=d+1|0;if((d|0)==(e|0))break;else f=f+4|0}return e|0}function _s(a,b,c){a=a|0;b=b|0;c=c|0;return(b>>>0<128?b&255:c)|0}function $s(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=(e-d|0)>>>2;if((d|0)!=(e|0)){h=d;b=g;while(1){g=c[h>>2]|0;a[b>>0]=g>>>0<128?g&255:f;h=h+4|0;if((h|0)==(e|0))break;else b=b+1|0}}return d+(i<<2)|0}function at(b){b=b|0;var d=0;c[b>>2]=44236;d=c[b+8>>2]|0;if((d|0)!=0?(a[b+12>>0]|0)!=0:0)dj(d);return}function bt(a){a=a|0;at(a);cj(a);return}function ct(a,b){a=a|0;b=b|0;if(b<<24>>24>-1)b=c[(Ts()|0)+((b&255)<<2)>>2]&255;return b|0}function dt(b,d,e){b=b|0;d=d|0;e=e|0;if((d|0)!=(e|0)){b=d;do{d=a[b>>0]|0;if(d<<24>>24>-1)d=c[(Ts()|0)+(d<<24>>24<<2)>>2]&255;a[b>>0]=d;b=b+1|0}while((b|0)!=(e|0))}return e|0}function et(a,b){a=a|0;b=b|0;if(b<<24>>24>-1)b=c[(Ws()|0)+(b<<24>>24<<2)>>2]&255;return b|0}function ft(b,d,e){b=b|0;d=d|0;e=e|0;if((d|0)!=(e|0)){b=d;do{d=a[b>>0]|0;if(d<<24>>24>-1)d=c[(Ws()|0)+(d<<24>>24<<2)>>2]&255;a[b>>0]=d;b=b+1|0}while((b|0)!=(e|0))}return e|0}function gt(a,b){a=a|0;b=b|0;return b|0}function ht(b,c,d,e){b=b|0;c=c|0;d=d|0;e=e|0;if((c|0)!=(d|0))while(1){a[e>>0]=a[c>>0]|0;c=c+1|0;if((c|0)==(d|0))break;else e=e+1|0}return d|0}function it(a,b,c){a=a|0;b=b|0;c=c|0;return(b<<24>>24>-1?b:c)|0}function jt(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if((c|0)!=(d|0))while(1){b=a[c>>0]|0;a[f>>0]=b<<24>>24>-1?b:e;c=c+1|0;if((c|0)==(d|0))break;else f=f+1|0}return d|0}function kt(a){a=a|0;cj(a);return}function lt(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;c[f>>2]=d;c[i>>2]=g;return 3}function mt(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;c[f>>2]=d;c[i>>2]=g;return 3}function nt(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;c[f>>2]=d;return 3}function ot(a){a=a|0;return 1}function pt(a){a=a|0;return 1}function qt(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;a=d-c|0;return(a>>>0>>0?a:e)|0}function rt(a){a=a|0;return 1}function st(a,b){a=a|0;b=b|0;var d=0;c[a+4>>2]=b+-1;c[a>>2]=44304;o=0;b=ua(3)|0;d=o;o=0;if(d&1){d=Na()|0;Ya(d|0)}else{c[a+8>>2]=b;return}}function tt(a){a=a|0;wu(a);cj(a);return}function xl(e,f,g,j,l){e=e|0;f=f|0;g=g|0;j=j|0;l=l|0;var m=0,n=0,o=0,p=0,q=0.0,r=0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0;ha=i;i=i+624|0;ca=ha+24|0;ea=ha+16|0;da=ha+588|0;Y=ha+576|0;ba=ha;V=ha+536|0;ga=ha+8|0;fa=ha+528|0;M=(e|0)!=0;N=V+40|0;U=N;V=V+39|0;W=ga+4|0;X=Y+12|0;Y=Y+11|0;Z=da;_=X;aa=_-Z|0;O=-2-Z|0;P=_+2|0;Q=ca+288|0;R=da+9|0;S=R;T=da+8|0;m=0;w=f;n=0;f=0;a:while(1){do{if((m|0)>-1)if((n|0)>(2147483647-m|0)){c[(ck()|0)>>2]=75;m=-1;break}else{m=n+m|0;break}}while(0);n=a[w>>0]|0;if(!(n<<24>>24)){L=245;break}else o=w;b:while(1){switch(n<<24>>24){case 37:{n=o;L=9;break b}case 0:{n=o;break b}default:{}}K=o+1|0;n=a[K>>0]|0;o=K}c:do{if((L|0)==9)while(1){L=0;if((a[n+1>>0]|0)!=37)break c;o=o+1|0;n=n+2|0;if((a[n>>0]|0)==37)L=9;else break}}while(0);y=o-w|0;if(M?(c[e>>2]&32|0)==0:0)Xk(w,y,e)|0;if((o|0)!=(w|0)){w=n;n=y;continue}r=n+1|0;o=a[r>>0]|0;p=(o<<24>>24)+-48|0;if(p>>>0<10){K=(a[n+2>>0]|0)==36;r=K?n+3|0:r;o=a[r>>0]|0;u=K?p:-1;f=K?1:f}else u=-1;n=o<<24>>24;d:do{if((n&-32|0)==32){p=0;while(1){if(!(1<>24)+-32|p;r=r+1|0;o=a[r>>0]|0;n=o<<24>>24;if((n&-32|0)!=32){s=p;n=r;break}}}else{s=0;n=r}}while(0);do{if(o<<24>>24==42){p=n+1|0;o=(a[p>>0]|0)+-48|0;if(o>>>0<10?(a[n+2>>0]|0)==36:0){c[l+(o<<2)>>2]=10;f=1;n=n+3|0;o=c[j+((a[p>>0]|0)+-48<<3)>>2]|0}else{if(f){m=-1;break a}if(!M){x=s;n=p;f=0;K=0;break}f=(c[g>>2]|0)+(4-1)&~(4-1);o=c[f>>2]|0;c[g>>2]=f+4;f=0;n=p}if((o|0)<0){x=s|8192;K=0-o|0}else{x=s;K=o}}else{p=(o<<24>>24)+-48|0;if(p>>>0<10){o=0;do{o=(o*10|0)+p|0;n=n+1|0;p=(a[n>>0]|0)+-48|0}while(p>>>0<10);if((o|0)<0){m=-1;break a}else{x=s;K=o}}else{x=s;K=0}}}while(0);e:do{if((a[n>>0]|0)==46){p=n+1|0;o=a[p>>0]|0;if(o<<24>>24!=42){r=(o<<24>>24)+-48|0;if(r>>>0<10){n=p;o=0}else{n=p;r=0;break}while(1){o=(o*10|0)+r|0;n=n+1|0;r=(a[n>>0]|0)+-48|0;if(r>>>0>=10){r=o;break e}}}p=n+2|0;o=(a[p>>0]|0)+-48|0;if(o>>>0<10?(a[n+3>>0]|0)==36:0){c[l+(o<<2)>>2]=10;n=n+4|0;r=c[j+((a[p>>0]|0)+-48<<3)>>2]|0;break}if(f){m=-1;break a}if(M){n=(c[g>>2]|0)+(4-1)&~(4-1);r=c[n>>2]|0;c[g>>2]=n+4;n=p}else{n=p;r=0}}else r=-1}while(0);t=0;while(1){o=(a[n>>0]|0)+-65|0;if(o>>>0>57){m=-1;break a}p=n+1|0;o=a[56223+(t*58|0)+o>>0]|0;s=o&255;if((s+-1|0)>>>0<8){n=p;t=s}else{J=p;break}}if(!(o<<24>>24)){m=-1;break}p=(u|0)>-1;do{if(o<<24>>24==19)if(p){m=-1;break a}else L=52;else{if(p){c[l+(u<<2)>>2]=s;H=j+(u<<3)|0;I=c[H+4>>2]|0;L=ba;c[L>>2]=c[H>>2];c[L+4>>2]=I;L=52;break}if(!M){m=0;break a}Cl(ba,s,g)}}while(0);if((L|0)==52?(L=0,!M):0){w=J;n=y;continue}u=a[n>>0]|0;u=(t|0)!=0&(u&15|0)==3?u&-33:u;p=x&-65537;I=(x&8192|0)==0?x:p;f:do{switch(u|0){case 110:switch(t|0){case 0:{c[c[ba>>2]>>2]=m;w=J;n=y;continue a}case 1:{c[c[ba>>2]>>2]=m;w=J;n=y;continue a}case 2:{w=c[ba>>2]|0;c[w>>2]=m;c[w+4>>2]=((m|0)<0)<<31>>31;w=J;n=y;continue a}case 3:{b[c[ba>>2]>>1]=m;w=J;n=y;continue a}case 4:{a[c[ba>>2]>>0]=m;w=J;n=y;continue a}case 6:{c[c[ba>>2]>>2]=m;w=J;n=y;continue a}case 7:{w=c[ba>>2]|0;c[w>>2]=m;c[w+4>>2]=((m|0)<0)<<31>>31;w=J;n=y;continue a}default:{w=J;n=y;continue a}}case 112:{t=I|8;r=r>>>0>8?r:8;u=120;L=64;break}case 88:case 120:{t=I;L=64;break}case 111:{p=ba;o=c[p>>2]|0;p=c[p+4>>2]|0;if((o|0)==0&(p|0)==0)n=N;else{n=N;do{n=n+-1|0;a[n>>0]=o&7|48;o=kw(o|0,p|0,3)|0;p=D}while(!((o|0)==0&(p|0)==0))}if(!(I&8)){o=I;t=0;s=56703;L=77}else{t=U-n+1|0;o=I;r=(r|0)<(t|0)?t:r;t=0;s=56703;L=77}break}case 105:case 100:{o=ba;n=c[o>>2]|0;o=c[o+4>>2]|0;if((o|0)<0){n=hw(0,0,n|0,o|0)|0;o=D;p=ba;c[p>>2]=n;c[p+4>>2]=o;p=1;s=56703;L=76;break f}if(!(I&2048)){s=I&1;p=s;s=(s|0)==0?56703:56705;L=76}else{p=1;s=56704;L=76}break}case 117:{o=ba;n=c[o>>2]|0;o=c[o+4>>2]|0;p=0;s=56703;L=76;break}case 99:{a[V>>0]=c[ba>>2];w=V;o=1;t=0;u=56703;n=N;break}case 109:{n=dk(c[(ck()|0)>>2]|0)|0;L=82;break}case 115:{n=c[ba>>2]|0;n=(n|0)!=0?n:56713;L=82;break}case 67:{c[ga>>2]=c[ba>>2];c[W>>2]=0;c[ba>>2]=ga;r=-1;L=86;break}case 83:{if(!r){El(e,32,K,0,I);n=0;L=98}else L=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{q=+h[ba>>3];c[ea>>2]=0;h[k>>3]=q;if((c[k+4>>2]|0)>=0)if(!(I&2048)){H=I&1;G=H;H=(H|0)==0?56721:56726}else{G=1;H=56723}else{q=-q;G=1;H=56720}h[k>>3]=q;F=c[k+4>>2]&2146435072;do{if(F>>>0<2146435072|(F|0)==2146435072&0<0){v=+wk(q,ea)*2.0;o=v!=0.0;if(o)c[ea>>2]=(c[ea>>2]|0)+-1;C=u|32;if((C|0)==97){w=u&32;y=(w|0)==0?H:H+9|0;x=G|2;n=12-r|0;do{if(!(r>>>0>11|(n|0)==0)){q=8.0;do{n=n+-1|0;q=q*16.0}while((n|0)!=0);if((a[y>>0]|0)==45){q=-(q+(-v-q));break}else{q=v+q-q;break}}else q=v}while(0);o=c[ea>>2]|0;n=(o|0)<0?0-o|0:o;n=Dl(n,((n|0)<0)<<31>>31,X)|0;if((n|0)==(X|0)){a[Y>>0]=48;n=Y}a[n+-1>>0]=(o>>31&2)+43;t=n+-2|0;a[t>>0]=u+15;s=(r|0)<1;p=(I&8|0)==0;o=da;while(1){H=~~q;n=o+1|0;a[o>>0]=d[56687+H>>0]|w;q=(q-+(H|0))*16.0;do{if((n-Z|0)==1){if(p&(s&q==0.0))break;a[n>>0]=46;n=o+2|0}}while(0);if(!(q!=0.0))break;else o=n}r=(r|0)!=0&(O+n|0)<(r|0)?P+r-t|0:aa-t+n|0;p=r+x|0;El(e,32,K,p,I);if(!(c[e>>2]&32))Xk(y,x,e)|0;El(e,48,K,p,I^65536);n=n-Z|0;if(!(c[e>>2]&32))Xk(da,n,e)|0;o=_-t|0;El(e,48,r-(n+o)|0,0,0);if(!(c[e>>2]&32))Xk(t,o,e)|0;El(e,32,K,p,I^8192);n=(p|0)<(K|0)?K:p;break}n=(r|0)<0?6:r;if(o){o=(c[ea>>2]|0)+-28|0;c[ea>>2]=o;q=v*268435456.0}else{q=v;o=c[ea>>2]|0}F=(o|0)<0?ca:Q;E=F;o=F;do{B=~~q>>>0;c[o>>2]=B;o=o+4|0;q=(q-+(B>>>0))*1.0e9}while(q!=0.0);p=o;o=c[ea>>2]|0;if((o|0)>0){s=F;while(1){t=(o|0)>29?29:o;r=p+-4|0;do{if(r>>>0>>0)r=s;else{o=0;do{B=mw(c[r>>2]|0,0,t|0)|0;B=jw(B|0,D|0,o|0,0)|0;o=D;A=vw(B|0,o|0,1e9,0)|0;c[r>>2]=A;o=uw(B|0,o|0,1e9,0)|0;r=r+-4|0}while(r>>>0>=s>>>0);if(!o){r=s;break}r=s+-4|0;c[r>>2]=o}}while(0);while(1){if(p>>>0<=r>>>0)break;o=p+-4|0;if(!(c[o>>2]|0))p=o;else break}o=(c[ea>>2]|0)-t|0;c[ea>>2]=o;if((o|0)>0)s=r;else break}}else r=F;if((o|0)<0){y=((n+25|0)/9|0)+1|0;z=(C|0)==102;w=r;while(1){x=0-o|0;x=(x|0)>9?9:x;do{if(w>>>0

    >>0){o=(1<>>x;r=0;t=w;do{B=c[t>>2]|0;c[t>>2]=(B>>>x)+r;r=$(B&o,s)|0;t=t+4|0}while(t>>>0

    >>0);o=(c[w>>2]|0)==0?w+4|0:w;if(!r){r=o;break}c[p>>2]=r;r=o;p=p+4|0}else r=(c[w>>2]|0)==0?w+4|0:w}while(0);o=z?F:r;p=(p-o>>2|0)>(y|0)?o+(y<<2)|0:p;o=(c[ea>>2]|0)+x|0;c[ea>>2]=o;if((o|0)>=0){w=r;break}else w=r}}else w=r;do{if(w>>>0

    >>0){o=(E-w>>2)*9|0;s=c[w>>2]|0;if(s>>>0<10)break;else r=10;do{r=r*10|0;o=o+1|0}while(s>>>0>=r>>>0)}else o=0}while(0);A=(C|0)==103;B=(n|0)!=0;r=n-((C|0)!=102?o:0)+((B&A)<<31>>31)|0;if((r|0)<(((p-E>>2)*9|0)+-9|0)){t=r+9216|0;z=(t|0)/9|0;r=F+(z+-1023<<2)|0;t=((t|0)%9|0)+1|0;if((t|0)<9){s=10;do{s=s*10|0;t=t+1|0}while((t|0)!=9)}else s=10;x=c[r>>2]|0;y=(x>>>0)%(s>>>0)|0;if((y|0)==0?(F+(z+-1022<<2)|0)==(p|0):0)s=w;else L=163;do{if((L|0)==163){L=0;v=(((x>>>0)/(s>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;t=(s|0)/2|0;do{if(y>>>0>>0)q=.5;else{if((y|0)==(t|0)?(F+(z+-1022<<2)|0)==(p|0):0){q=1.0;break}q=1.5}}while(0);do{if(G){if((a[H>>0]|0)!=45)break;v=-v;q=-q}}while(0);t=x-y|0;c[r>>2]=t;if(!(v+q!=v)){s=w;break}C=t+s|0;c[r>>2]=C;if(C>>>0>999999999){o=w;while(1){s=r+-4|0;c[r>>2]=0;if(s>>>0>>0){o=o+-4|0;c[o>>2]=0}C=(c[s>>2]|0)+1|0;c[s>>2]=C;if(C>>>0>999999999)r=s;else{w=o;r=s;break}}}o=(E-w>>2)*9|0;t=c[w>>2]|0;if(t>>>0<10){s=w;break}else s=10;do{s=s*10|0;o=o+1|0}while(t>>>0>=s>>>0);s=w}}while(0);C=r+4|0;w=s;p=p>>>0>C>>>0?C:p}y=0-o|0;while(1){if(p>>>0<=w>>>0){z=0;C=p;break}r=p+-4|0;if(!(c[r>>2]|0))p=r;else{z=1;C=p;break}}do{if(A){n=(B&1^1)+n|0;if((n|0)>(o|0)&(o|0)>-5){u=u+-1|0;n=n+-1-o|0}else{u=u+-2|0;n=n+-1|0}p=I&8;if(p)break;do{if(z){p=c[C+-4>>2]|0;if(!p){r=9;break}if(!((p>>>0)%10|0)){s=10;r=0}else{r=0;break}do{s=s*10|0;r=r+1|0}while(((p>>>0)%(s>>>0)|0|0)==0)}else r=9}while(0);p=((C-E>>2)*9|0)+-9|0;if((u|32|0)==102){p=p-r|0;p=(p|0)<0?0:p;n=(n|0)<(p|0)?n:p;p=0;break}else{p=p+o-r|0;p=(p|0)<0?0:p;n=(n|0)<(p|0)?n:p;p=0;break}}else p=I&8}while(0);x=n|p;s=(x|0)!=0&1;t=(u|32|0)==102;if(t){o=(o|0)>0?o:0;u=0}else{r=(o|0)<0?y:o;r=Dl(r,((r|0)<0)<<31>>31,X)|0;if((_-r|0)<2)do{r=r+-1|0;a[r>>0]=48}while((_-r|0)<2);a[r+-1>>0]=(o>>31&2)+43;E=r+-2|0;a[E>>0]=u;o=_-E|0;u=E}y=G+1+n+s+o|0;El(e,32,K,y,I);if(!(c[e>>2]&32))Xk(H,G,e)|0;El(e,48,K,y,I^65536);do{if(t){r=w>>>0>F>>>0?F:w;o=r;do{p=Dl(c[o>>2]|0,0,R)|0;do{if((o|0)==(r|0)){if((p|0)!=(R|0))break;a[T>>0]=48;p=T}else{if(p>>>0<=da>>>0)break;do{p=p+-1|0;a[p>>0]=48}while(p>>>0>da>>>0)}}while(0);if(!(c[e>>2]&32))Xk(p,S-p|0,e)|0;o=o+4|0}while(o>>>0<=F>>>0);do{if(x){if(c[e>>2]&32)break;Xk(56755,1,e)|0}}while(0);if((n|0)>0&o>>>0>>0){p=o;while(1){o=Dl(c[p>>2]|0,0,R)|0;if(o>>>0>da>>>0)do{o=o+-1|0;a[o>>0]=48}while(o>>>0>da>>>0);if(!(c[e>>2]&32))Xk(o,(n|0)>9?9:n,e)|0;p=p+4|0;o=n+-9|0;if(!((n|0)>9&p>>>0>>0)){n=o;break}else n=o}}El(e,48,n+9|0,9,0)}else{t=z?C:w+4|0;if((n|0)>-1){s=(p|0)==0;r=w;do{o=Dl(c[r>>2]|0,0,R)|0;if((o|0)==(R|0)){a[T>>0]=48;o=T}do{if((r|0)==(w|0)){p=o+1|0;if(!(c[e>>2]&32))Xk(o,1,e)|0;if(s&(n|0)<1){o=p;break}if(c[e>>2]&32){o=p;break}Xk(56755,1,e)|0;o=p}else{if(o>>>0<=da>>>0)break;do{o=o+-1|0;a[o>>0]=48}while(o>>>0>da>>>0)}}while(0);p=S-o|0;if(!(c[e>>2]&32))Xk(o,(n|0)>(p|0)?p:n,e)|0;n=n-p|0;r=r+4|0}while(r>>>0>>0&(n|0)>-1)}El(e,48,n+18|0,18,0);if(c[e>>2]&32)break;Xk(u,_-u|0,e)|0}}while(0);El(e,32,K,y,I^8192);n=(y|0)<(K|0)?K:y}else{t=(u&32|0)!=0;s=q!=q|0.0!=0.0;o=s?0:G;r=o+3|0;El(e,32,K,r,p);n=c[e>>2]|0;if(!(n&32)){Xk(H,o,e)|0;n=c[e>>2]|0}if(!(n&32))Xk(s?t?56747:56751:t?56739:56743,3,e)|0;El(e,32,K,r,I^8192);n=(r|0)<(K|0)?K:r}}while(0);w=J;continue a}default:{p=I;o=r;t=0;u=56703;n=N}}}while(0);g:do{if((L|0)==64){p=ba;o=c[p>>2]|0;p=c[p+4>>2]|0;s=u&32;if(!((o|0)==0&(p|0)==0)){n=N;do{n=n+-1|0;a[n>>0]=d[56687+(o&15)>>0]|s;o=kw(o|0,p|0,4)|0;p=D}while(!((o|0)==0&(p|0)==0));L=ba;if((t&8|0)==0|(c[L>>2]|0)==0&(c[L+4>>2]|0)==0){o=t;t=0;s=56703;L=77}else{o=t;t=2;s=56703+(u>>4)|0;L=77}}else{n=N;o=t;t=0;s=56703;L=77}}else if((L|0)==76){n=Dl(n,o,N)|0;o=I;t=p;L=77}else if((L|0)==82){L=0;I=jl(n,0,r)|0;H=(I|0)==0;w=n;o=H?r:I-n|0;t=0;u=56703;n=H?n+r|0:I}else if((L|0)==86){L=0;o=0;n=0;s=c[ba>>2]|0;while(1){p=c[s>>2]|0;if(!p)break;n=Ik(fa,p)|0;if((n|0)<0|n>>>0>(r-o|0)>>>0)break;o=n+o|0;if(r>>>0>o>>>0)s=s+4|0;else break}if((n|0)<0){m=-1;break a}El(e,32,K,o,I);if(!o){n=0;L=98}else{p=0;r=c[ba>>2]|0;while(1){n=c[r>>2]|0;if(!n){n=o;L=98;break g}n=Ik(fa,n)|0;p=n+p|0;if((p|0)>(o|0)){n=o;L=98;break g}if(!(c[e>>2]&32))Xk(fa,n,e)|0;if(p>>>0>=o>>>0){n=o;L=98;break}else r=r+4|0}}}}while(0);if((L|0)==98){L=0;El(e,32,K,n,I^8192);w=J;n=(K|0)>(n|0)?K:n;continue}if((L|0)==77){L=0;p=(r|0)>-1?o&-65537:o;o=ba;o=(c[o>>2]|0)!=0|(c[o+4>>2]|0)!=0;if((r|0)!=0|o){o=(o&1^1)+(U-n)|0;w=n;o=(r|0)>(o|0)?r:o;u=s;n=N}else{w=N;o=0;u=s;n=N}}s=n-w|0;o=(o|0)<(s|0)?s:o;r=t+o|0;n=(K|0)<(r|0)?r:K;El(e,32,n,r,p);if(!(c[e>>2]&32))Xk(u,t,e)|0;El(e,48,n,r,p^65536);El(e,48,o,s,0);if(!(c[e>>2]&32))Xk(w,s,e)|0;El(e,32,n,r,p^8192);w=J}h:do{if((L|0)==245)if(!e)if(f){m=1;while(1){f=c[l+(m<<2)>>2]|0;if(!f)break;Cl(j+(m<<3)|0,f,g);m=m+1|0;if((m|0)>=10){m=1;break h}}if((m|0)<10)while(1){if(c[l+(m<<2)>>2]|0){m=-1;break h}m=m+1|0;if((m|0)>=10){m=1;break}}else m=1}else m=0}while(0);i=ha;return m|0}function yl(a,b,c){a=a|0;b=b|0;c=c|0;return Rk(a,b,c)|0}function zl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0.0,f=0,g=0,h=0,j=0;j=i;i=i+112|0;h=j;f=h;g=f+112|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));f=h+4|0;c[f>>2]=a;g=h+8|0;c[g>>2]=-1;c[h+44>>2]=a;c[h+76>>2]=-1;gk(h,0);e=+ek(h,d,1);d=(c[f>>2]|0)-(c[g>>2]|0)+(c[h+108>>2]|0)|0;if(b)c[b>>2]=(d|0)!=0?a+d|0:a;i=j;return+e}function Al(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0;k=i;i=i+112|0;j=k;c[j>>2]=0;g=j+4|0;c[g>>2]=a;c[j+44>>2]=a;h=j+8|0;c[h>>2]=(a|0)<0?-1:a+2147483647|0;c[j+76>>2]=-1;gk(j,0);e=fk(j,d,1,e,f)|0;if(b)c[b>>2]=a+((c[g>>2]|0)+(c[j+108>>2]|0)-(c[h>>2]|0));i=k;return e|0}function Bl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=a+20|0;f=c[e>>2]|0;a=(c[a+16>>2]|0)-f|0;a=a>>>0>d>>>0?d:a;lw(f|0,b|0,a|0)|0;c[e>>2]=(c[e>>2]|0)+a;return d|0}function Cl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0.0;a:do{if(b>>>0<=20)do{switch(b|0){case 9:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=b;break a}case 10:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=b;c[e+4>>2]=((b|0)<0)<<31>>31;break a}case 11:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=b;c[e+4>>2]=0;break a}case 12:{e=(c[d>>2]|0)+(8-1)&~(8-1);b=e;f=c[b>>2]|0;b=c[b+4>>2]|0;c[d>>2]=e+8;e=a;c[e>>2]=f;c[e+4>>2]=b;break a}case 13:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;e=(e&65535)<<16>>16;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a}case 14:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e&65535;c[f+4>>2]=0;break a}case 15:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;e=(e&255)<<24>>24;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a}case 16:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e&255;c[f+4>>2]=0;break a}case 17:{f=(c[d>>2]|0)+(8-1)&~(8-1);g=+h[f>>3];c[d>>2]=f+8;h[a>>3]=g;break a}case 18:{f=(c[d>>2]|0)+(8-1)&~(8-1);g=+h[f>>3];c[d>>2]=f+8;h[a>>3]=g;break a}default:break a}}while(0)}while(0);return}function Dl(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if(c>>>0>0|(c|0)==0&b>>>0>4294967295)while(1){e=vw(b|0,c|0,10,0)|0;d=d+-1|0;a[d>>0]=e|48;e=uw(b|0,c|0,10,0)|0;if(c>>>0>9|(c|0)==9&b>>>0>4294967295){b=e;c=D}else{b=e;break}}if(b)while(1){d=d+-1|0;a[d>>0]=(b>>>0)%10|0|48;if(b>>>0<10)break;else b=(b>>>0)/10|0}return d|0}function El(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0;j=i;i=i+256|0;h=j;do{if((d|0)>(e|0)&(f&73728|0)==0){f=d-e|0;iw(h|0,b|0,(f>>>0>256?256:f)|0)|0;b=c[a>>2]|0;g=(b&32|0)==0;if(f>>>0>255){e=d-e|0;do{if(g){Xk(h,256,a)|0;b=c[a>>2]|0}f=f+-256|0;g=(b&32|0)==0}while(f>>>0>255);if(g)f=e&255;else break}else if(!g)break;Xk(h,f,a)|0}}while(0);i=j;return}function Fl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;do{if(a>>>0<245){o=a>>>0<11?16:a+11&-8;a=o>>>3;i=c[10218]|0;d=i>>>a;if(d&3){a=(d&1^1)+a|0;e=a<<1;d=40912+(e<<2)|0;e=40912+(e+2<<2)|0;f=c[e>>2]|0;g=f+8|0;h=c[g>>2]|0;do{if((d|0)!=(h|0)){if(h>>>0<(c[10222]|0)>>>0)Ga();b=h+12|0;if((c[b>>2]|0)==(f|0)){c[b>>2]=d;c[e>>2]=h;break}else Ga()}else c[10218]=i&~(1<>2]=M|3;M=f+(M|4)|0;c[M>>2]=c[M>>2]|1;M=g;return M|0}h=c[10220]|0;if(o>>>0>h>>>0){if(d){e=2<>>12&16;e=e>>>j;f=e>>>5&8;e=e>>>f;g=e>>>2&4;e=e>>>g;d=e>>>1&2;e=e>>>d;a=e>>>1&1;a=(f|j|g|d|a)+(e>>>a)|0;e=a<<1;d=40912+(e<<2)|0;e=40912+(e+2<<2)|0;g=c[e>>2]|0;j=g+8|0;f=c[j>>2]|0;do{if((d|0)!=(f|0)){if(f>>>0<(c[10222]|0)>>>0)Ga();b=f+12|0;if((c[b>>2]|0)==(g|0)){c[b>>2]=d;c[e>>2]=f;k=c[10220]|0;break}else Ga()}else{c[10218]=i&~(1<>2]=o|3;i=g+o|0;c[g+(o|4)>>2]=h|1;c[g+M>>2]=h;if(k){f=c[10223]|0;d=k>>>3;b=d<<1;e=40912+(b<<2)|0;a=c[10218]|0;d=1<>2]|0;if(b>>>0<(c[10222]|0)>>>0)Ga();else{l=a;m=b}}else{c[10218]=a|d;l=40912+(b+2<<2)|0;m=e}c[l>>2]=f;c[m+12>>2]=f;c[f+8>>2]=m;c[f+12>>2]=e}c[10220]=h;c[10223]=i;M=j;return M|0}a=c[10219]|0;if(a){d=(a&0-a)+-1|0;L=d>>>12&16;d=d>>>L;K=d>>>5&8;d=d>>>K;M=d>>>2&4;d=d>>>M;a=d>>>1&2;d=d>>>a;e=d>>>1&1;e=c[41176+((K|L|M|a|e)+(d>>>e)<<2)>>2]|0;d=(c[e+4>>2]&-8)-o|0;a=e;while(1){b=c[a+16>>2]|0;if(!b){b=c[a+20>>2]|0;if(!b){j=d;break}}a=(c[b+4>>2]&-8)-o|0;M=a>>>0>>0;d=M?a:d;a=b;e=M?b:e}g=c[10222]|0;if(e>>>0>>0)Ga();i=e+o|0;if(e>>>0>=i>>>0)Ga();h=c[e+24>>2]|0;d=c[e+12>>2]|0;do{if((d|0)==(e|0)){a=e+20|0;b=c[a>>2]|0;if(!b){a=e+16|0;b=c[a>>2]|0;if(!b){n=0;break}}while(1){d=b+20|0;f=c[d>>2]|0;if(f){b=f;a=d;continue}d=b+16|0;f=c[d>>2]|0;if(!f)break;else{b=f;a=d}}if(a>>>0>>0)Ga();else{c[a>>2]=0;n=b;break}}else{f=c[e+8>>2]|0;if(f>>>0>>0)Ga();b=f+12|0;if((c[b>>2]|0)!=(e|0))Ga();a=d+8|0;if((c[a>>2]|0)==(e|0)){c[b>>2]=d;c[a>>2]=f;n=d;break}else Ga()}}while(0);do{if(h){b=c[e+28>>2]|0;a=41176+(b<<2)|0;if((e|0)==(c[a>>2]|0)){c[a>>2]=n;if(!n){c[10219]=c[10219]&~(1<>>0<(c[10222]|0)>>>0)Ga();b=h+16|0;if((c[b>>2]|0)==(e|0))c[b>>2]=n;else c[h+20>>2]=n;if(!n)break}a=c[10222]|0;if(n>>>0>>0)Ga();c[n+24>>2]=h;b=c[e+16>>2]|0;do{if(b)if(b>>>0>>0)Ga();else{c[n+16>>2]=b;c[b+24>>2]=n;break}}while(0);b=c[e+20>>2]|0;if(b)if(b>>>0<(c[10222]|0)>>>0)Ga();else{c[n+20>>2]=b;c[b+24>>2]=n;break}}}while(0);if(j>>>0<16){M=j+o|0;c[e+4>>2]=M|3;M=e+(M+4)|0;c[M>>2]=c[M>>2]|1}else{c[e+4>>2]=o|3;c[e+(o|4)>>2]=j|1;c[e+(j+o)>>2]=j;b=c[10220]|0;if(b){g=c[10223]|0;d=b>>>3;b=d<<1;f=40912+(b<<2)|0;a=c[10218]|0;d=1<>2]|0;if(a>>>0<(c[10222]|0)>>>0)Ga();else{p=b;q=a}}else{c[10218]=a|d;p=40912+(b+2<<2)|0;q=f}c[p>>2]=g;c[q+12>>2]=g;c[g+8>>2]=q;c[g+12>>2]=f}c[10220]=j;c[10223]=i}M=e+8|0;return M|0}else q=o}else q=o}else if(a>>>0<=4294967231){a=a+11|0;m=a&-8;l=c[10219]|0;if(l){d=0-m|0;a=a>>>8;if(a)if(m>>>0>16777215)k=31;else{q=(a+1048320|0)>>>16&8;v=a<>>16&4;v=v<>>16&2;k=14-(p|q|k)+(v<>>15)|0;k=m>>>(k+7|0)&1|k<<1}else k=0;a=c[41176+(k<<2)>>2]|0;a:do{if(!a){f=0;a=0;v=86}else{h=d;f=0;i=m<<((k|0)==31?0:25-(k>>>1)|0);j=a;a=0;while(1){g=c[j+4>>2]&-8;d=g-m|0;if(d>>>0>>0)if((g|0)==(m|0)){g=j;a=j;v=90;break a}else a=j;else d=h;v=c[j+20>>2]|0;j=c[j+16+(i>>>31<<2)>>2]|0;f=(v|0)==0|(v|0)==(j|0)?f:v;if(!j){v=86;break}else{h=d;i=i<<1}}}}while(0);if((v|0)==86){if((f|0)==0&(a|0)==0){a=2<>>12&16;a=a>>>n;l=a>>>5&8;a=a>>>l;p=a>>>2&4;a=a>>>p;q=a>>>1&2;a=a>>>q;f=a>>>1&1;f=c[41176+((l|n|p|q|f)+(a>>>f)<<2)>>2]|0;a=0}if(!f){i=d;j=a}else{g=f;v=90}}if((v|0)==90)while(1){v=0;q=(c[g+4>>2]&-8)-m|0;f=q>>>0>>0;d=f?q:d;a=f?g:a;f=c[g+16>>2]|0;if(f){g=f;v=90;continue}g=c[g+20>>2]|0;if(!g){i=d;j=a;break}else v=90}if((j|0)!=0?i>>>0<((c[10220]|0)-m|0)>>>0:0){f=c[10222]|0;if(j>>>0>>0)Ga();h=j+m|0;if(j>>>0>=h>>>0)Ga();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do{if((d|0)==(j|0)){a=j+20|0;b=c[a>>2]|0;if(!b){a=j+16|0;b=c[a>>2]|0;if(!b){o=0;break}}while(1){d=b+20|0;e=c[d>>2]|0;if(e){b=e;a=d;continue}d=b+16|0;e=c[d>>2]|0;if(!e)break;else{b=e;a=d}}if(a>>>0>>0)Ga();else{c[a>>2]=0;o=b;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)Ga();b=e+12|0;if((c[b>>2]|0)!=(j|0))Ga();a=d+8|0;if((c[a>>2]|0)==(j|0)){c[b>>2]=d;c[a>>2]=e;o=d;break}else Ga()}}while(0);do{if(g){b=c[j+28>>2]|0;a=41176+(b<<2)|0;if((j|0)==(c[a>>2]|0)){c[a>>2]=o;if(!o){c[10219]=c[10219]&~(1<>>0<(c[10222]|0)>>>0)Ga();b=g+16|0;if((c[b>>2]|0)==(j|0))c[b>>2]=o;else c[g+20>>2]=o;if(!o)break}a=c[10222]|0;if(o>>>0>>0)Ga();c[o+24>>2]=g;b=c[j+16>>2]|0;do{if(b)if(b>>>0>>0)Ga();else{c[o+16>>2]=b;c[b+24>>2]=o;break}}while(0);b=c[j+20>>2]|0;if(b)if(b>>>0<(c[10222]|0)>>>0)Ga();else{c[o+20>>2]=b;c[b+24>>2]=o;break}}}while(0);b:do{if(i>>>0>=16){c[j+4>>2]=m|3;c[j+(m|4)>>2]=i|1;c[j+(i+m)>>2]=i;b=i>>>3;if(i>>>0<256){a=b<<1;e=40912+(a<<2)|0;d=c[10218]|0;b=1<>2]|0;if(a>>>0<(c[10222]|0)>>>0)Ga();else{s=b;t=a}}else{c[10218]=d|b;s=40912+(a+2<<2)|0;t=e}c[s>>2]=h;c[t+12>>2]=h;c[j+(m+8)>>2]=t;c[j+(m+12)>>2]=e;break}b=i>>>8;if(b)if(i>>>0>16777215)e=31;else{L=(b+1048320|0)>>>16&8;M=b<>>16&4;M=M<>>16&2;e=14-(K|L|e)+(M<>>15)|0;e=i>>>(e+7|0)&1|e<<1}else e=0;b=41176+(e<<2)|0;c[j+(m+28)>>2]=e;c[j+(m+20)>>2]=0;c[j+(m+16)>>2]=0;a=c[10219]|0;d=1<>2]=h;c[j+(m+24)>>2]=b;c[j+(m+12)>>2]=h;c[j+(m+8)>>2]=h;break}b=c[b>>2]|0;c:do{if((c[b+4>>2]&-8|0)!=(i|0)){e=i<<((e|0)==31?0:25-(e>>>1)|0);while(1){a=b+16+(e>>>31<<2)|0;d=c[a>>2]|0;if(!d)break;if((c[d+4>>2]&-8|0)==(i|0)){y=d;break c}else{e=e<<1;b=d}}if(a>>>0<(c[10222]|0)>>>0)Ga();else{c[a>>2]=h;c[j+(m+24)>>2]=b;c[j+(m+12)>>2]=h;c[j+(m+8)>>2]=h;break b}}else y=b}while(0);b=y+8|0;a=c[b>>2]|0;M=c[10222]|0;if(a>>>0>=M>>>0&y>>>0>=M>>>0){c[a+12>>2]=h;c[b>>2]=h;c[j+(m+8)>>2]=a;c[j+(m+12)>>2]=y;c[j+(m+24)>>2]=0;break}else Ga()}else{M=i+m|0;c[j+4>>2]=M|3;M=j+(M+4)|0;c[M>>2]=c[M>>2]|1}}while(0);M=j+8|0;return M|0}else q=m}else q=m}else q=-1}while(0);d=c[10220]|0;if(d>>>0>=q>>>0){b=d-q|0;a=c[10223]|0;if(b>>>0>15){c[10223]=a+q;c[10220]=b;c[a+(q+4)>>2]=b|1;c[a+d>>2]=b;c[a+4>>2]=q|3}else{c[10220]=0;c[10223]=0;c[a+4>>2]=d|3;M=a+(d+4)|0;c[M>>2]=c[M>>2]|1}M=a+8|0;return M|0}a=c[10221]|0;if(a>>>0>q>>>0){L=a-q|0;c[10221]=L;M=c[10224]|0;c[10224]=M+q;c[M+(q+4)>>2]=L|1;c[M+4>>2]=q|3;M=M+8|0;return M|0}do{if(!(c[10336]|0)){a=_a(30)|0;if(!(a+-1&a)){c[10338]=a;c[10337]=a;c[10339]=-1;c[10340]=-1;c[10341]=0;c[10329]=0;c[10336]=(qb(0)|0)&-16^1431655768;break}else Ga()}}while(0);j=q+48|0;i=c[10338]|0;k=q+47|0;h=i+k|0;i=0-i|0;l=h&i;if(l>>>0<=q>>>0){M=0;return M|0}a=c[10328]|0;if((a|0)!=0?(t=c[10326]|0,y=t+l|0,y>>>0<=t>>>0|y>>>0>a>>>0):0){M=0;return M|0}d:do{if(!(c[10329]&4)){a=c[10224]|0;e:do{if(a){f=41320;while(1){d=c[f>>2]|0;if(d>>>0<=a>>>0?(r=f+4|0,(d+(c[r>>2]|0)|0)>>>0>a>>>0):0){g=f;a=r;break}f=c[f+8>>2]|0;if(!f){v=174;break e}}d=h-(c[10221]|0)&i;if(d>>>0<2147483647){f=Ua(d|0)|0;y=(f|0)==((c[g>>2]|0)+(c[a>>2]|0)|0);a=y?d:0;if(y){if((f|0)!=(-1|0)){w=f;p=a;v=194;break d}}else v=184}else a=0}else v=174}while(0);do{if((v|0)==174){g=Ua(0)|0;if((g|0)!=(-1|0)){a=g;d=c[10337]|0;f=d+-1|0;if(!(f&a))d=l;else d=l-a+(f+a&0-d)|0;a=c[10326]|0;f=a+d|0;if(d>>>0>q>>>0&d>>>0<2147483647){y=c[10328]|0;if((y|0)!=0?f>>>0<=a>>>0|f>>>0>y>>>0:0){a=0;break}f=Ua(d|0)|0;y=(f|0)==(g|0);a=y?d:0;if(y){w=g;p=a;v=194;break d}else v=184}else a=0}else a=0}}while(0);f:do{if((v|0)==184){g=0-d|0;do{if(j>>>0>d>>>0&(d>>>0<2147483647&(f|0)!=(-1|0))?(u=c[10338]|0,u=k-d+u&0-u,u>>>0<2147483647):0)if((Ua(u|0)|0)==(-1|0)){Ua(g|0)|0;break f}else{d=u+d|0;break}}while(0);if((f|0)!=(-1|0)){w=f;p=d;v=194;break d}}}while(0);c[10329]=c[10329]|4;v=191}else{a=0;v=191}}while(0);if((((v|0)==191?l>>>0<2147483647:0)?(w=Ua(l|0)|0,x=Ua(0)|0,w>>>0>>0&((w|0)!=(-1|0)&(x|0)!=(-1|0))):0)?(z=x-w|0,A=z>>>0>(q+40|0)>>>0,A):0){p=A?z:a;v=194}if((v|0)==194){a=(c[10326]|0)+p|0;c[10326]=a;if(a>>>0>(c[10327]|0)>>>0)c[10327]=a;h=c[10224]|0;g:do{if(h){g=41320;do{a=c[g>>2]|0;d=g+4|0;f=c[d>>2]|0;if((w|0)==(a+f|0)){B=a;C=d;D=f;E=g;v=204;break}g=c[g+8>>2]|0}while((g|0)!=0);if(((v|0)==204?(c[E+12>>2]&8|0)==0:0)?h>>>0>>0&h>>>0>=B>>>0:0){c[C>>2]=D+p;M=(c[10221]|0)+p|0;L=h+8|0;L=(L&7|0)==0?0:0-L&7;K=M-L|0;c[10224]=h+L;c[10221]=K;c[h+(L+4)>>2]=K|1;c[h+(M+4)>>2]=40;c[10225]=c[10340];break}a=c[10222]|0;if(w>>>0>>0){c[10222]=w;a=w}d=w+p|0;g=41320;while(1){if((c[g>>2]|0)==(d|0)){f=g;d=g;v=212;break}g=c[g+8>>2]|0;if(!g){d=41320;break}}if((v|0)==212)if(!(c[d+12>>2]&8)){c[f>>2]=w;n=d+4|0;c[n>>2]=(c[n>>2]|0)+p;n=w+8|0;n=(n&7|0)==0?0:0-n&7;k=w+(p+8)|0;k=(k&7|0)==0?0:0-k&7;b=w+(k+p)|0;m=n+q|0;o=w+m|0;l=b-(w+n)-q|0;c[w+(n+4)>>2]=q|3;h:do{if((b|0)!=(h|0)){if((b|0)==(c[10223]|0)){M=(c[10220]|0)+l|0;c[10220]=M;c[10223]=o;c[w+(m+4)>>2]=M|1;c[w+(M+m)>>2]=M;break}i=p+4|0;d=c[w+(i+k)>>2]|0;if((d&3|0)==1){j=d&-8;g=d>>>3;i:do{if(d>>>0>=256){h=c[w+((k|24)+p)>>2]|0;e=c[w+(p+12+k)>>2]|0;do{if((e|0)==(b|0)){f=k|16;e=w+(i+f)|0;d=c[e>>2]|0;if(!d){e=w+(f+p)|0;d=c[e>>2]|0;if(!d){J=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)Ga();else{c[e>>2]=0;J=d;break}}else{f=c[w+((k|8)+p)>>2]|0;if(f>>>0>>0)Ga();a=f+12|0;if((c[a>>2]|0)!=(b|0))Ga();d=e+8|0;if((c[d>>2]|0)==(b|0)){c[a>>2]=e;c[d>>2]=f;J=e;break}else Ga()}}while(0);if(!h)break;a=c[w+(p+28+k)>>2]|0;d=41176+(a<<2)|0;do{if((b|0)!=(c[d>>2]|0)){if(h>>>0<(c[10222]|0)>>>0)Ga();a=h+16|0;if((c[a>>2]|0)==(b|0))c[a>>2]=J;else c[h+20>>2]=J;if(!J)break i}else{c[d>>2]=J;if(J)break;c[10219]=c[10219]&~(1<>>0>>0)Ga();c[J+24>>2]=h;b=k|16;a=c[w+(b+p)>>2]|0;do{if(a)if(a>>>0>>0)Ga();else{c[J+16>>2]=a;c[a+24>>2]=J;break}}while(0);b=c[w+(i+b)>>2]|0;if(!b)break;if(b>>>0<(c[10222]|0)>>>0)Ga();else{c[J+20>>2]=b;c[b+24>>2]=J;break}}else{e=c[w+((k|8)+p)>>2]|0;f=c[w+(p+12+k)>>2]|0;d=40912+(g<<1<<2)|0;do{if((e|0)!=(d|0)){if(e>>>0>>0)Ga();if((c[e+12>>2]|0)==(b|0))break;Ga()}}while(0);if((f|0)==(e|0)){c[10218]=c[10218]&~(1<>>0>>0)Ga();a=f+8|0;if((c[a>>2]|0)==(b|0)){F=a;break}Ga()}}while(0);c[e+12>>2]=f;c[F>>2]=e}}while(0);b=w+((j|k)+p)|0;f=j+l|0}else f=l;b=b+4|0;c[b>>2]=c[b>>2]&-2;c[w+(m+4)>>2]=f|1;c[w+(f+m)>>2]=f;b=f>>>3;if(f>>>0<256){a=b<<1;e=40912+(a<<2)|0;d=c[10218]|0;b=1<>2]|0;if(a>>>0>=(c[10222]|0)>>>0){K=b;L=a;break}Ga()}}while(0);c[K>>2]=o;c[L+12>>2]=o;c[w+(m+8)>>2]=L;c[w+(m+12)>>2]=e;break}b=f>>>8;do{if(!b)e=0;else{if(f>>>0>16777215){e=31;break}K=(b+1048320|0)>>>16&8;L=b<>>16&4;L=L<>>16&2;e=14-(J|K|e)+(L<>>15)|0;e=f>>>(e+7|0)&1|e<<1}}while(0);b=41176+(e<<2)|0;c[w+(m+28)>>2]=e;c[w+(m+20)>>2]=0;c[w+(m+16)>>2]=0;a=c[10219]|0;d=1<>2]=o;c[w+(m+24)>>2]=b;c[w+(m+12)>>2]=o;c[w+(m+8)>>2]=o;break}b=c[b>>2]|0;j:do{if((c[b+4>>2]&-8|0)!=(f|0)){e=f<<((e|0)==31?0:25-(e>>>1)|0);while(1){a=b+16+(e>>>31<<2)|0;d=c[a>>2]|0;if(!d)break;if((c[d+4>>2]&-8|0)==(f|0)){M=d;break j}else{e=e<<1;b=d}}if(a>>>0<(c[10222]|0)>>>0)Ga();else{c[a>>2]=o;c[w+(m+24)>>2]=b;c[w+(m+12)>>2]=o;c[w+(m+8)>>2]=o;break h}}else M=b}while(0);b=M+8|0;a=c[b>>2]|0;L=c[10222]|0;if(a>>>0>=L>>>0&M>>>0>=L>>>0){c[a+12>>2]=o;c[b>>2]=o;c[w+(m+8)>>2]=a;c[w+(m+12)>>2]=M;c[w+(m+24)>>2]=0;break}else Ga()}else{M=(c[10221]|0)+l|0;c[10221]=M;c[10224]=o;c[w+(m+4)>>2]=M|1}}while(0);M=w+(n|8)|0;return M|0}else d=41320;while(1){a=c[d>>2]|0;if(a>>>0<=h>>>0?(b=c[d+4>>2]|0,e=a+b|0,e>>>0>h>>>0):0)break;d=c[d+8>>2]|0}f=a+(b+-39)|0;a=a+(b+-47+((f&7|0)==0?0:0-f&7))|0;f=h+16|0;a=a>>>0>>0?h:a;b=a+8|0;d=w+8|0;d=(d&7|0)==0?0:0-d&7;M=p+-40-d|0;c[10224]=w+d;c[10221]=M;c[w+(d+4)>>2]=M|1;c[w+(p+-36)>>2]=40;c[10225]=c[10340];d=a+4|0;c[d>>2]=27;c[b>>2]=c[10330];c[b+4>>2]=c[10331];c[b+8>>2]=c[10332];c[b+12>>2]=c[10333];c[10330]=w;c[10331]=p;c[10333]=0;c[10332]=b;b=a+28|0;c[b>>2]=7;if((a+32|0)>>>0>>0)do{M=b;b=b+4|0;c[b>>2]=7}while((M+8|0)>>>0>>0);if((a|0)!=(h|0)){g=a-h|0;c[d>>2]=c[d>>2]&-2;c[h+4>>2]=g|1;c[a>>2]=g;b=g>>>3;if(g>>>0<256){a=b<<1;e=40912+(a<<2)|0;d=c[10218]|0;b=1<>2]|0;if(a>>>0<(c[10222]|0)>>>0)Ga();else{G=b;H=a}}else{c[10218]=d|b;G=40912+(a+2<<2)|0;H=e}c[G>>2]=h;c[H+12>>2]=h;c[h+8>>2]=H;c[h+12>>2]=e;break}b=g>>>8;if(b)if(g>>>0>16777215)e=31;else{L=(b+1048320|0)>>>16&8;M=b<>>16&4;M=M<>>16&2;e=14-(K|L|e)+(M<>>15)|0;e=g>>>(e+7|0)&1|e<<1}else e=0;d=41176+(e<<2)|0;c[h+28>>2]=e;c[h+20>>2]=0;c[f>>2]=0;b=c[10219]|0;a=1<>2]=h;c[h+24>>2]=d;c[h+12>>2]=h;c[h+8>>2]=h;break}b=c[d>>2]|0;k:do{if((c[b+4>>2]&-8|0)!=(g|0)){e=g<<((e|0)==31?0:25-(e>>>1)|0);while(1){a=b+16+(e>>>31<<2)|0;d=c[a>>2]|0;if(!d)break;if((c[d+4>>2]&-8|0)==(g|0)){I=d;break k}else{e=e<<1;b=d}}if(a>>>0<(c[10222]|0)>>>0)Ga();else{c[a>>2]=h;c[h+24>>2]=b;c[h+12>>2]=h;c[h+8>>2]=h;break g}}else I=b}while(0);b=I+8|0;a=c[b>>2]|0;M=c[10222]|0;if(a>>>0>=M>>>0&I>>>0>=M>>>0){c[a+12>>2]=h;c[b>>2]=h;c[h+8>>2]=a;c[h+12>>2]=I;c[h+24>>2]=0;break}else Ga()}}else{M=c[10222]|0;if((M|0)==0|w>>>0>>0)c[10222]=w;c[10330]=w;c[10331]=p;c[10333]=0;c[10227]=c[10336];c[10226]=-1;b=0;do{M=b<<1;L=40912+(M<<2)|0;c[40912+(M+3<<2)>>2]=L;c[40912+(M+2<<2)>>2]=L;b=b+1|0}while((b|0)!=32);M=w+8|0;M=(M&7|0)==0?0:0-M&7;L=p+-40-M|0;c[10224]=w+M;c[10221]=L;c[w+(M+4)>>2]=L|1;c[w+(p+-36)>>2]=40;c[10225]=c[10340]}}while(0);b=c[10221]|0;if(b>>>0>q>>>0){L=b-q|0;c[10221]=L;M=c[10224]|0;c[10224]=M+q;c[M+(q+4)>>2]=L|1;c[M+4>>2]=q|3;M=M+8|0;return M|0}}c[(ck()|0)>>2]=12;M=0;return M|0}function Gl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if(!a)return;b=a+-8|0;i=c[10222]|0;if(b>>>0>>0)Ga();d=c[a+-4>>2]|0;e=d&3;if((e|0)==1)Ga();o=d&-8;q=a+(o+-8)|0;do{if(!(d&1)){b=c[b>>2]|0;if(!e)return;j=-8-b|0;l=a+j|0;m=b+o|0;if(l>>>0>>0)Ga();if((l|0)==(c[10223]|0)){b=a+(o+-4)|0;d=c[b>>2]|0;if((d&3|0)!=3){u=l;g=m;break}c[10220]=m;c[b>>2]=d&-2;c[a+(j+4)>>2]=m|1;c[q>>2]=m;return}f=b>>>3;if(b>>>0<256){e=c[a+(j+8)>>2]|0;d=c[a+(j+12)>>2]|0;b=40912+(f<<1<<2)|0;if((e|0)!=(b|0)){if(e>>>0>>0)Ga();if((c[e+12>>2]|0)!=(l|0))Ga()}if((d|0)==(e|0)){c[10218]=c[10218]&~(1<>>0>>0)Ga();b=d+8|0;if((c[b>>2]|0)==(l|0))h=b;else Ga()}else h=d+8|0;c[e+12>>2]=d;c[h>>2]=e;u=l;g=m;break}h=c[a+(j+24)>>2]|0;e=c[a+(j+12)>>2]|0;do{if((e|0)==(l|0)){d=a+(j+20)|0;b=c[d>>2]|0;if(!b){d=a+(j+16)|0;b=c[d>>2]|0;if(!b){k=0;break}}while(1){e=b+20|0;f=c[e>>2]|0;if(f){b=f;d=e;continue}e=b+16|0;f=c[e>>2]|0;if(!f)break;else{b=f;d=e}}if(d>>>0>>0)Ga();else{c[d>>2]=0;k=b;break}}else{f=c[a+(j+8)>>2]|0;if(f>>>0>>0)Ga();b=f+12|0;if((c[b>>2]|0)!=(l|0))Ga();d=e+8|0;if((c[d>>2]|0)==(l|0)){c[b>>2]=e;c[d>>2]=f;k=e;break}else Ga()}}while(0);if(h){b=c[a+(j+28)>>2]|0;d=41176+(b<<2)|0;if((l|0)==(c[d>>2]|0)){c[d>>2]=k;if(!k){c[10219]=c[10219]&~(1<>>0<(c[10222]|0)>>>0)Ga();b=h+16|0;if((c[b>>2]|0)==(l|0))c[b>>2]=k;else c[h+20>>2]=k;if(!k){u=l;g=m;break}}d=c[10222]|0;if(k>>>0>>0)Ga();c[k+24>>2]=h;b=c[a+(j+16)>>2]|0;do{if(b)if(b>>>0>>0)Ga();else{c[k+16>>2]=b;c[b+24>>2]=k;break}}while(0);b=c[a+(j+20)>>2]|0;if(b)if(b>>>0<(c[10222]|0)>>>0)Ga();else{c[k+20>>2]=b;c[b+24>>2]=k;u=l;g=m;break}else{u=l;g=m}}else{u=l;g=m}}else{u=b;g=o}}while(0);if(u>>>0>=q>>>0)Ga();b=a+(o+-4)|0;d=c[b>>2]|0;if(!(d&1))Ga();if(!(d&2)){if((q|0)==(c[10224]|0)){t=(c[10221]|0)+g|0;c[10221]=t;c[10224]=u;c[u+4>>2]=t|1;if((u|0)!=(c[10223]|0))return;c[10223]=0;c[10220]=0;return}if((q|0)==(c[10223]|0)){t=(c[10220]|0)+g|0;c[10220]=t;c[10223]=u;c[u+4>>2]=t|1;c[u+t>>2]=t;return}g=(d&-8)+g|0;f=d>>>3;do{if(d>>>0>=256){h=c[a+(o+16)>>2]|0;b=c[a+(o|4)>>2]|0;do{if((b|0)==(q|0)){d=a+(o+12)|0;b=c[d>>2]|0;if(!b){d=a+(o+8)|0;b=c[d>>2]|0;if(!b){p=0;break}}while(1){e=b+20|0;f=c[e>>2]|0;if(f){b=f;d=e;continue}e=b+16|0;f=c[e>>2]|0;if(!f)break;else{b=f;d=e}}if(d>>>0<(c[10222]|0)>>>0)Ga();else{c[d>>2]=0;p=b;break}}else{d=c[a+o>>2]|0;if(d>>>0<(c[10222]|0)>>>0)Ga();e=d+12|0;if((c[e>>2]|0)!=(q|0))Ga();f=b+8|0;if((c[f>>2]|0)==(q|0)){c[e>>2]=b;c[f>>2]=d;p=b;break}else Ga()}}while(0);if(h){b=c[a+(o+20)>>2]|0;d=41176+(b<<2)|0;if((q|0)==(c[d>>2]|0)){c[d>>2]=p;if(!p){c[10219]=c[10219]&~(1<>>0<(c[10222]|0)>>>0)Ga();b=h+16|0;if((c[b>>2]|0)==(q|0))c[b>>2]=p;else c[h+20>>2]=p;if(!p)break}d=c[10222]|0;if(p>>>0>>0)Ga();c[p+24>>2]=h;b=c[a+(o+8)>>2]|0;do{if(b)if(b>>>0>>0)Ga();else{c[p+16>>2]=b;c[b+24>>2]=p;break}}while(0);b=c[a+(o+12)>>2]|0;if(b)if(b>>>0<(c[10222]|0)>>>0)Ga();else{c[p+20>>2]=b;c[b+24>>2]=p;break}}}else{e=c[a+o>>2]|0;d=c[a+(o|4)>>2]|0;b=40912+(f<<1<<2)|0;if((e|0)!=(b|0)){if(e>>>0<(c[10222]|0)>>>0)Ga();if((c[e+12>>2]|0)!=(q|0))Ga()}if((d|0)==(e|0)){c[10218]=c[10218]&~(1<>>0<(c[10222]|0)>>>0)Ga();b=d+8|0;if((c[b>>2]|0)==(q|0))n=b;else Ga()}else n=d+8|0;c[e+12>>2]=d;c[n>>2]=e}}while(0);c[u+4>>2]=g|1;c[u+g>>2]=g;if((u|0)==(c[10223]|0)){c[10220]=g;return}}else{c[b>>2]=d&-2;c[u+4>>2]=g|1;c[u+g>>2]=g}b=g>>>3;if(g>>>0<256){d=b<<1;f=40912+(d<<2)|0;e=c[10218]|0;b=1<>2]|0;if(d>>>0<(c[10222]|0)>>>0)Ga();else{r=b;s=d}}else{c[10218]=e|b;r=40912+(d+2<<2)|0;s=f}c[r>>2]=u;c[s+12>>2]=u;c[u+8>>2]=s;c[u+12>>2]=f;return}b=g>>>8;if(b)if(g>>>0>16777215)f=31;else{r=(b+1048320|0)>>>16&8;s=b<>>16&4;s=s<>>16&2;f=14-(q|r|f)+(s<>>15)|0;f=g>>>(f+7|0)&1|f<<1}else f=0;b=41176+(f<<2)|0;c[u+28>>2]=f;c[u+20>>2]=0;c[u+16>>2]=0;d=c[10219]|0;e=1<>2]|0;b:do{if((c[b+4>>2]&-8|0)!=(g|0)){f=g<<((f|0)==31?0:25-(f>>>1)|0);while(1){d=b+16+(f>>>31<<2)|0;e=c[d>>2]|0;if(!e)break;if((c[e+4>>2]&-8|0)==(g|0)){t=e;break b}else{f=f<<1;b=e}}if(d>>>0<(c[10222]|0)>>>0)Ga();else{c[d>>2]=u;c[u+24>>2]=b;c[u+12>>2]=u;c[u+8>>2]=u;break a}}else t=b}while(0);b=t+8|0;d=c[b>>2]|0;s=c[10222]|0;if(d>>>0>=s>>>0&t>>>0>=s>>>0){c[d+12>>2]=u;c[b>>2]=u;c[u+8>>2]=d;c[u+12>>2]=t;c[u+24>>2]=0;break}else Ga()}else{c[10219]=d|e;c[b>>2]=u;c[u+24>>2]=b;c[u+12>>2]=u;c[u+8>>2]=u}}while(0);u=(c[10226]|0)+-1|0;c[10226]=u;if(!u)b=41328;else return;while(1){b=c[b>>2]|0;if(!b)break;else b=b+8|0}c[10226]=-1;return}function Hl(a,b){a=a|0;b=b|0;var d=0;if(a){d=$(b,a)|0;if((b|a)>>>0>65535)d=((d>>>0)/(a>>>0)|0|0)==(b|0)?d:-1}else d=0;b=Fl(d)|0;if(!b)return b|0;if(!(c[b+-4>>2]&3))return b|0;iw(b|0,0,d|0)|0;return b|0}function Il(a,b){a=a|0;b=b|0;var d=0,e=0;if(!a){a=Fl(b)|0;return a|0}if(b>>>0>4294967231){c[(ck()|0)>>2]=12;a=0;return a|0}d=Jl(a+-8|0,b>>>0<11?16:b+11&-8)|0;if(d){a=d+8|0;return a|0}d=Fl(b)|0;if(!d){a=0;return a|0}e=c[a+-4>>2]|0;e=(e&-8)-((e&3|0)==0?8:4)|0;lw(d|0,a|0,(e>>>0>>0?e:b)|0)|0;Gl(a);a=d;return a|0}function Jl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;o=a+4|0;p=c[o>>2]|0;j=p&-8;l=a+j|0;i=c[10222]|0;d=p&3;if(!((d|0)!=1&a>>>0>=i>>>0&a>>>0>>0))Ga();e=a+(j|4)|0;f=c[e>>2]|0;if(!(f&1))Ga();if(!d){if(b>>>0<256){a=0;return a|0}if(j>>>0>=(b+4|0)>>>0?(j-b|0)>>>0<=c[10338]<<1>>>0:0)return a|0;a=0;return a|0}if(j>>>0>=b>>>0){d=j-b|0;if(d>>>0<=15)return a|0;c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=d|3;c[e>>2]=c[e>>2]|1;Kl(a+b|0,d);return a|0}if((l|0)==(c[10224]|0)){d=(c[10221]|0)+j|0;if(d>>>0<=b>>>0){a=0;return a|0}n=d-b|0;c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=n|1;c[10224]=a+b;c[10221]=n;return a|0}if((l|0)==(c[10223]|0)){e=(c[10220]|0)+j|0;if(e>>>0>>0){a=0;return a|0}d=e-b|0;if(d>>>0>15){c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=d|1;c[a+e>>2]=d;e=a+(e+4)|0;c[e>>2]=c[e>>2]&-2;e=a+b|0}else{c[o>>2]=p&1|e|2;e=a+(e+4)|0;c[e>>2]=c[e>>2]|1;e=0;d=0}c[10220]=d;c[10223]=e;return a|0}if(f&2){a=0;return a|0}m=(f&-8)+j|0;if(m>>>0>>0){a=0;return a|0}n=m-b|0;g=f>>>3;do{if(f>>>0>=256){h=c[a+(j+24)>>2]|0;g=c[a+(j+12)>>2]|0;do{if((g|0)==(l|0)){e=a+(j+20)|0;d=c[e>>2]|0;if(!d){e=a+(j+16)|0;d=c[e>>2]|0;if(!d){k=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)Ga();else{c[e>>2]=0;k=d;break}}else{f=c[a+(j+8)>>2]|0;if(f>>>0>>0)Ga();d=f+12|0;if((c[d>>2]|0)!=(l|0))Ga();e=g+8|0;if((c[e>>2]|0)==(l|0)){c[d>>2]=g;c[e>>2]=f;k=g;break}else Ga()}}while(0);if(h){d=c[a+(j+28)>>2]|0;e=41176+(d<<2)|0;if((l|0)==(c[e>>2]|0)){c[e>>2]=k;if(!k){c[10219]=c[10219]&~(1<>>0<(c[10222]|0)>>>0)Ga();d=h+16|0;if((c[d>>2]|0)==(l|0))c[d>>2]=k;else c[h+20>>2]=k;if(!k)break}e=c[10222]|0;if(k>>>0>>0)Ga();c[k+24>>2]=h;d=c[a+(j+16)>>2]|0;do{if(d)if(d>>>0>>0)Ga();else{c[k+16>>2]=d;c[d+24>>2]=k;break}}while(0);d=c[a+(j+20)>>2]|0;if(d)if(d>>>0<(c[10222]|0)>>>0)Ga();else{c[k+20>>2]=d;c[d+24>>2]=k;break}}}else{f=c[a+(j+8)>>2]|0;e=c[a+(j+12)>>2]|0;d=40912+(g<<1<<2)|0;if((f|0)!=(d|0)){if(f>>>0>>0)Ga();if((c[f+12>>2]|0)!=(l|0))Ga()}if((e|0)==(f|0)){c[10218]=c[10218]&~(1<>>0>>0)Ga();d=e+8|0;if((c[d>>2]|0)==(l|0))h=d;else Ga()}else h=e+8|0;c[f+12>>2]=e;c[h>>2]=f}}while(0);if(n>>>0<16){c[o>>2]=m|p&1|2;b=a+(m|4)|0;c[b>>2]=c[b>>2]|1;return a|0}else{c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=n|3;p=a+(m|4)|0;c[p>>2]=c[p>>2]|1;Kl(a+b|0,n);return a|0}return 0}function Kl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;q=a+b|0;d=c[a+4>>2]|0;do{if(!(d&1)){k=c[a>>2]|0;if(!(d&3))return;n=a+(0-k)|0;m=k+b|0;j=c[10222]|0;if(n>>>0>>0)Ga();if((n|0)==(c[10223]|0)){e=a+(b+4)|0;d=c[e>>2]|0;if((d&3|0)!=3){t=n;h=m;break}c[10220]=m;c[e>>2]=d&-2;c[a+(4-k)>>2]=m|1;c[q>>2]=m;return}g=k>>>3;if(k>>>0<256){f=c[a+(8-k)>>2]|0;e=c[a+(12-k)>>2]|0;d=40912+(g<<1<<2)|0;if((f|0)!=(d|0)){if(f>>>0>>0)Ga();if((c[f+12>>2]|0)!=(n|0))Ga()}if((e|0)==(f|0)){c[10218]=c[10218]&~(1<>>0>>0)Ga();d=e+8|0;if((c[d>>2]|0)==(n|0))i=d;else Ga()}else i=e+8|0;c[f+12>>2]=e;c[i>>2]=f;t=n;h=m;break}i=c[a+(24-k)>>2]|0;f=c[a+(12-k)>>2]|0;do{if((f|0)==(n|0)){f=16-k|0;e=a+(f+4)|0;d=c[e>>2]|0;if(!d){e=a+f|0;d=c[e>>2]|0;if(!d){l=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)Ga();else{c[e>>2]=0;l=d;break}}else{g=c[a+(8-k)>>2]|0;if(g>>>0>>0)Ga();d=g+12|0;if((c[d>>2]|0)!=(n|0))Ga();e=f+8|0;if((c[e>>2]|0)==(n|0)){c[d>>2]=f;c[e>>2]=g;l=f;break}else Ga()}}while(0);if(i){d=c[a+(28-k)>>2]|0;e=41176+(d<<2)|0;if((n|0)==(c[e>>2]|0)){c[e>>2]=l;if(!l){c[10219]=c[10219]&~(1<>>0<(c[10222]|0)>>>0)Ga();d=i+16|0;if((c[d>>2]|0)==(n|0))c[d>>2]=l;else c[i+20>>2]=l;if(!l){t=n;h=m;break}}f=c[10222]|0;if(l>>>0>>0)Ga();c[l+24>>2]=i;d=16-k|0;e=c[a+d>>2]|0;do{if(e)if(e>>>0>>0)Ga();else{c[l+16>>2]=e;c[e+24>>2]=l;break}}while(0);d=c[a+(d+4)>>2]|0;if(d)if(d>>>0<(c[10222]|0)>>>0)Ga();else{c[l+20>>2]=d;c[d+24>>2]=l;t=n;h=m;break}else{t=n;h=m}}else{t=n;h=m}}else{t=a;h=b}}while(0);j=c[10222]|0;if(q>>>0>>0)Ga();d=a+(b+4)|0;e=c[d>>2]|0;if(!(e&2)){if((q|0)==(c[10224]|0)){s=(c[10221]|0)+h|0;c[10221]=s;c[10224]=t;c[t+4>>2]=s|1;if((t|0)!=(c[10223]|0))return;c[10223]=0;c[10220]=0;return}if((q|0)==(c[10223]|0)){s=(c[10220]|0)+h|0;c[10220]=s;c[10223]=t;c[t+4>>2]=s|1;c[t+s>>2]=s;return}h=(e&-8)+h|0;g=e>>>3;do{if(e>>>0>=256){i=c[a+(b+24)>>2]|0;f=c[a+(b+12)>>2]|0;do{if((f|0)==(q|0)){e=a+(b+20)|0;d=c[e>>2]|0;if(!d){e=a+(b+16)|0;d=c[e>>2]|0;if(!d){p=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)Ga();else{c[e>>2]=0;p=d;break}}else{g=c[a+(b+8)>>2]|0;if(g>>>0>>0)Ga();d=g+12|0;if((c[d>>2]|0)!=(q|0))Ga();e=f+8|0;if((c[e>>2]|0)==(q|0)){c[d>>2]=f;c[e>>2]=g;p=f;break}else Ga()}}while(0);if(i){d=c[a+(b+28)>>2]|0;e=41176+(d<<2)|0;if((q|0)==(c[e>>2]|0)){c[e>>2]=p;if(!p){c[10219]=c[10219]&~(1<>>0<(c[10222]|0)>>>0)Ga();d=i+16|0;if((c[d>>2]|0)==(q|0))c[d>>2]=p;else c[i+20>>2]=p;if(!p)break}e=c[10222]|0;if(p>>>0>>0)Ga();c[p+24>>2]=i;d=c[a+(b+16)>>2]|0;do{if(d)if(d>>>0>>0)Ga();else{c[p+16>>2]=d;c[d+24>>2]=p;break}}while(0);d=c[a+(b+20)>>2]|0;if(d)if(d>>>0<(c[10222]|0)>>>0)Ga();else{c[p+20>>2]=d;c[d+24>>2]=p;break}}}else{f=c[a+(b+8)>>2]|0;e=c[a+(b+12)>>2]|0;d=40912+(g<<1<<2)|0;if((f|0)!=(d|0)){if(f>>>0>>0)Ga();if((c[f+12>>2]|0)!=(q|0))Ga()}if((e|0)==(f|0)){c[10218]=c[10218]&~(1<>>0>>0)Ga();d=e+8|0;if((c[d>>2]|0)==(q|0))o=d;else Ga()}else o=e+8|0;c[f+12>>2]=e;c[o>>2]=f}}while(0);c[t+4>>2]=h|1;c[t+h>>2]=h;if((t|0)==(c[10223]|0)){c[10220]=h;return}}else{c[d>>2]=e&-2;c[t+4>>2]=h|1;c[t+h>>2]=h}d=h>>>3;if(h>>>0<256){e=d<<1;g=40912+(e<<2)|0;f=c[10218]|0;d=1<>2]|0;if(e>>>0<(c[10222]|0)>>>0)Ga();else{r=d;s=e}}else{c[10218]=f|d;r=40912+(e+2<<2)|0;s=g}c[r>>2]=t;c[s+12>>2]=t;c[t+8>>2]=s;c[t+12>>2]=g;return}d=h>>>8;if(d)if(h>>>0>16777215)g=31;else{r=(d+1048320|0)>>>16&8;s=d<>>16&4;s=s<>>16&2;g=14-(q|r|g)+(s<>>15)|0;g=h>>>(g+7|0)&1|g<<1}else g=0;d=41176+(g<<2)|0;c[t+28>>2]=g;c[t+20>>2]=0;c[t+16>>2]=0;e=c[10219]|0;f=1<>2]=t;c[t+24>>2]=d;c[t+12>>2]=t;c[t+8>>2]=t;return}d=c[d>>2]|0;a:do{if((c[d+4>>2]&-8|0)!=(h|0)){g=h<<((g|0)==31?0:25-(g>>>1)|0);while(1){e=d+16+(g>>>31<<2)|0;f=c[e>>2]|0;if(!f)break;if((c[f+4>>2]&-8|0)==(h|0)){d=f;break a}else{g=g<<1;d=f}}if(e>>>0<(c[10222]|0)>>>0)Ga();c[e>>2]=t;c[t+24>>2]=d;c[t+12>>2]=t;c[t+8>>2]=t;return}}while(0);e=d+8|0;f=c[e>>2]|0;s=c[10222]|0;if(!(f>>>0>=s>>>0&d>>>0>=s>>>0))Ga();c[f+12>>2]=t;c[e>>2]=t;c[t+8>>2]=f;c[t+12>>2]=d;c[t+24>>2]=0;return}function Ll(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;e=c[9321]|0;Pl(42048,e,42104);c[10342]=42892;c[10344]=42912;c[10343]=0;a=c[10720]|0;o=0;ia(62,41368+a|0,42048);g=o;o=0;if(g&1){g=Na()|0;fn(41376);Ya(g|0)}c[41368+(a+72)>>2]=0;c[41368+(a+76)>>2]=-1;f=c[9322]|0;Ql(42152,f,42112);c[10364]=42972;c[10365]=42992;d=c[10740]|0;o=0;ia(62,41456+d|0,42152);g=o;o=0;if(g&1){g=Na()|0;fn(41460);Ya(g|0)}a=d+72|0;c[41456+a>>2]=0;b=d+76|0;c[41456+b>>2]=-1;g=c[9320]|0;Ql(42200,g,42120);c[10385]=42972;c[10386]=42992;o=0;ia(62,41540+d|0,42200);h=o;o=0;if(h&1){h=Na()|0;fn(41544);Ya(h|0)}c[41540+a>>2]=0;c[41540+b>>2]=-1;h=c[41540+((c[(c[10385]|0)+-12>>2]|0)+24)>>2]|0;c[10406]=42972;c[10407]=42992;o=0;ia(62,41624+d|0,h|0);h=o;o=0;if(h&1){h=Na()|0;fn(41628);Ya(h|0)}c[41624+a>>2]=0;c[41624+b>>2]=-1;c[41368+((c[(c[10342]|0)+-12>>2]|0)+72)>>2]=41456;a=41540+((c[(c[10385]|0)+-12>>2]|0)+4)|0;c[a>>2]=c[a>>2]|8192;c[41540+((c[(c[10385]|0)+-12>>2]|0)+72)>>2]=41456;Rl(42248,e,42128);c[10427]=42932;c[10429]=42952;c[10428]=0;a=c[10730]|0;o=0;ia(62,41708+a|0,42248);h=o;o=0;if(h&1){h=Na()|0;ln(41716);Ya(h|0)}c[41708+(a+72)>>2]=0;c[41708+(a+76)>>2]=-1;Sl(42304,f,42136);c[10449]=43012;c[10450]=43032;d=c[10750]|0;o=0;ia(62,41796+d|0,42304);h=o;o=0;if(h&1){h=Na()|0;ln(41800);Ya(h|0)}a=d+72|0;c[41796+a>>2]=0;b=d+76|0;c[41796+b>>2]=-1;Sl(42352,g,42144);c[10470]=43012;c[10471]=43032;o=0;ia(62,41880+d|0,42352);h=o;o=0;if(h&1){h=Na()|0;ln(41884);Ya(h|0)}c[41880+a>>2]=0;c[41880+b>>2]=-1;h=c[41880+((c[(c[10470]|0)+-12>>2]|0)+24)>>2]|0;c[10491]=43012;c[10492]=43032;o=0;ia(62,41964+d|0,h|0);h=o;o=0;if(h&1){h=Na()|0;ln(41968);Ya(h|0)}else{c[41964+a>>2]=0;c[41964+b>>2]=-1;c[41708+((c[(c[10427]|0)+-12>>2]|0)+72)>>2]=41796;h=41880+((c[(c[10470]|0)+-12>>2]|0)+4)|0;c[h>>2]=c[h>>2]|8192;c[41880+((c[(c[10470]|0)+-12>>2]|0)+72)>>2]=41796;return}}function Ml(a){a=a|0;o=0;ka(70,41456)|0;a=o;o=0;if(((!(a&1)?(o=0,ka(70,41624)|0,a=o,o=0,!(a&1)):0)?(o=0,ka(71,41796)|0,a=o,o=0,!(a&1)):0)?(o=0,ka(71,41964)|0,a=o,o=0,!(a&1)):0)return;a=Na(0)|0;ec(a)}function Nl(){Ll(0);kb(187,56757,n|0)|0;return}function Ol(){return}function Pl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;g=i;i=i+16|0;h=g+4|0;f=g;pn(b);c[b>>2]=42600;c[b+32>>2]=d;c[b+40>>2]=e;c[b+48>>2]=-1;a[b+52>>0]=0;Fs(h,b+4|0);c[f>>2]=c[h>>2];o=0;ia(23,b|0,f|0);e=o;o=0;if(e&1){h=Na()|0;Gs(f);nn(b);Ya(h|0)}else{Gs(f);i=g;return}}function Ql(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;g=i;i=i+16|0;h=g+4|0;f=g;pn(b);c[b>>2]=42536;c[b+32>>2]=d;Fs(h,b+4|0);c[f>>2]=c[h>>2];o=0;d=ra(37,f|0,44280)|0;h=o;o=0;if(h&1){h=Na()|0;Gs(f);nn(b);Ya(h|0)}else{Gs(f);c[b+36>>2]=d;c[b+40>>2]=e;a[b+44>>0]=(Eb[c[(c[d>>2]|0)+28>>2]&127](d)|0)&1;i=g;return}}function Rl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;g=i;i=i+16|0;h=g+4|0;f=g;En(b);c[b>>2]=42472;c[b+32>>2]=d;c[b+40>>2]=e;c[b+48>>2]=-1;a[b+52>>0]=0;Fs(h,b+4|0);c[f>>2]=c[h>>2];o=0;ia(21,b|0,f|0);e=o;o=0;if(e&1){h=Na()|0;Gs(f);Cn(b);Ya(h|0)}else{Gs(f);i=g;return}}function Sl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;g=i;i=i+16|0;h=g+4|0;f=g;En(b);c[b>>2]=42408;c[b+32>>2]=d;Fs(h,b+4|0);c[f>>2]=c[h>>2];o=0;d=ra(37,f|0,44288)|0;h=o;o=0;if(h&1){h=Na()|0;Gs(f);Cn(b);Ya(h|0)}else{Gs(f);c[b+36>>2]=d;c[b+40>>2]=e;a[b+44>>0]=(Eb[c[(c[d>>2]|0)+28>>2]&127](d)|0)&1;i=g;return}}function Tl(a){a=a|0;Cn(a);cj(a);return}function Ul(b,d){b=b|0;d=d|0;Eb[c[(c[b>>2]|0)+24>>2]&127](b)|0;d=Is(d,44288)|0;c[b+36>>2]=d;a[b+44>>0]=(Eb[c[(c[d>>2]|0)+28>>2]&127](d)|0)&1;return}function Vl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l;d=a+36|0;e=a+40|0;f=j+8|0;g=j;b=a+32|0;a:while(1){a=c[d>>2]|0;a=Mb[c[(c[a>>2]|0)+20>>2]&31](a,c[e>>2]|0,j,f,h)|0;m=(c[h>>2]|0)-g|0;if((Yk(j,1,m,c[b>>2]|0)|0)!=(m|0)){a=-1;break}switch(a|0){case 1:break;case 2:{a=-1;break a}default:{k=4;break a}}}if((k|0)==4)a=((Vk(c[b>>2]|0)|0)!=0)<<31>>31;i=l;return a|0}function Wl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;a:do{if(!(a[b+44>>0]|0))if((e|0)>0){f=d;d=0;while(1){if((Lb[c[(c[b>>2]|0)+52>>2]&63](b,c[f>>2]|0)|0)==-1)break a;d=d+1|0;if((d|0)<(e|0))f=f+4|0;else break}}else d=0;else d=Yk(d,4,e,c[b+32>>2]|0)|0}while(0);return d|0}function Xl(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+32|0;p=s+16|0;e=s+8|0;o=s+4|0;n=s;q=(d|0)==-1;a:do{if(!q){c[e>>2]=d;if(a[b+44>>0]|0)if((Yk(e,4,1,c[b+32>>2]|0)|0)==1){r=11;break}else{e=-1;break}c[o>>2]=p;l=e+4|0;m=b+36|0;g=b+40|0;h=p+8|0;j=p;k=b+32|0;while(1){b=c[m>>2]|0;b=Sb[c[(c[b>>2]|0)+12>>2]&15](b,c[g>>2]|0,e,l,n,p,h,o)|0;if((c[n>>2]|0)==(e|0)){e=-1;break a}if((b|0)==3)break;f=(b|0)==1;if(b>>>0>=2){e=-1;break a}b=(c[o>>2]|0)-j|0;if((Yk(p,1,b,c[k>>2]|0)|0)!=(b|0)){e=-1;break a}if(f)e=f?c[n>>2]|0:e;else{r=11;break a}}if((Yk(e,1,1,c[k>>2]|0)|0)!=1)e=-1;else r=11}else r=11}while(0);if((r|0)==11)e=q?0:d;i=s;return e|0}function Yl(b,d){b=b|0;d=d|0;var e=0,f=0;f=Is(d,44288)|0;e=b+36|0;c[e>>2]=f;d=b+44|0;c[d>>2]=Eb[c[(c[f>>2]|0)+24>>2]&127](f)|0;e=c[e>>2]|0;a[b+53>>0]=(Eb[c[(c[e>>2]|0)+28>>2]&127](e)|0)&1;if((c[d>>2]|0)>8)Rr(56783);return}function Zl(a){a=a|0;Cn(a);cj(a);return}function _l(a){a=a|0;return bm(a,0)|0}function $l(a){a=a|0;return bm(a,1)|0}function am(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;l=m+16|0;k=m+8|0;f=m+4|0;g=m;h=b+52|0;e=(a[h>>0]|0)!=0;a:do{if((d|0)==-1)if(e)d=-1;else{d=c[b+48>>2]|0;a[h>>0]=(d|0)!=-1&1}else{j=b+48|0;b:do{if(e){c[f>>2]=c[j>>2];e=c[b+36>>2]|0;switch(Sb[c[(c[e>>2]|0)+12>>2]&15](e,c[b+40>>2]|0,f,f+4|0,g,l,l+8|0,k)|0){case 1:case 2:{d=-1;break a}case 3:{a[l>>0]=c[j>>2];c[k>>2]=l+1;break}default:{}}e=b+32|0;while(1){f=c[k>>2]|0;if(f>>>0<=l>>>0)break b;b=f+-1|0;c[k>>2]=b;if((al(a[b>>0]|0,c[e>>2]|0)|0)==-1){d=-1;break a}}}}while(0);c[j>>2]=d;a[h>>0]=1}}while(0);i=m;return d|0}function bm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;r=i;i=i+32|0;q=r+16|0;p=r+8|0;m=r+4|0;n=r;g=b+52|0;a:do{if(a[g>>0]|0){f=b+48|0;e=c[f>>2]|0;if(d){c[f>>2]=-1;a[g>>0]=0}}else{e=c[b+44>>2]|0;e=(e|0)>1?e:1;o=b+32|0;if((e|0)>0){g=0;do{f=Zk(c[o>>2]|0)|0;if((f|0)==-1){e=-1;break a}a[q+g>>0]=f;g=g+1|0}while((g|0)<(e|0))}b:do{if(!(a[b+53>>0]|0)){j=b+40|0;k=b+36|0;l=p+4|0;c:while(1){s=c[j>>2]|0;g=s;f=c[g>>2]|0;g=c[g+4>>2]|0;t=c[k>>2]|0;h=q+e|0;switch(Sb[c[(c[t>>2]|0)+16>>2]&15](t,s,q,h,m,p,l,n)|0){case 2:{e=-1;break a}case 3:break c;case 1:break;default:break b}t=c[j>>2]|0;c[t>>2]=f;c[t+4>>2]=g;if((e|0)==8){e=-1;break a}f=Zk(c[o>>2]|0)|0;if((f|0)==-1){e=-1;break a}a[h>>0]=f;e=e+1|0}c[p>>2]=a[q>>0]}else c[p>>2]=a[q>>0]}while(0);if(d){e=c[p>>2]|0;c[b+48>>2]=e;break}while(1){if((e|0)<=0)break;e=e+-1|0;if((al(a[q+e>>0]|0,c[o>>2]|0)|0)==-1){e=-1;break a}}e=c[p>>2]|0}}while(0);i=r;return e|0}function cm(a){a=a|0;nn(a);cj(a);return}function dm(b,d){b=b|0;d=d|0;Eb[c[(c[b>>2]|0)+24>>2]&127](b)|0;d=Is(d,44280)|0;c[b+36>>2]=d;a[b+44>>0]=(Eb[c[(c[d>>2]|0)+28>>2]&127](d)|0)&1;return}function em(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;j=l+8|0;h=l;d=a+36|0;e=a+40|0;f=j+8|0;g=j;b=a+32|0;a:while(1){a=c[d>>2]|0;a=Mb[c[(c[a>>2]|0)+20>>2]&31](a,c[e>>2]|0,j,f,h)|0;m=(c[h>>2]|0)-g|0;if((Yk(j,1,m,c[b>>2]|0)|0)!=(m|0)){a=-1;break}switch(a|0){case 1:break;case 2:{a=-1;break a}default:{k=4;break a}}}if((k|0)==4)a=((Vk(c[b>>2]|0)|0)!=0)<<31>>31;i=l;return a|0}function fm(b,e,f){b=b|0;e=e|0;f=f|0;var g=0;a:do{if(!(a[b+44>>0]|0))if((f|0)>0){g=e;e=0;while(1){if((Lb[c[(c[b>>2]|0)+52>>2]&63](b,d[g>>0]|0)|0)==-1)break a;e=e+1|0;if((e|0)<(f|0))g=g+1|0;else break}}else e=0;else e=Yk(e,1,f,c[b+32>>2]|0)|0}while(0);return e|0}function gm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+32|0;p=s+16|0;e=s+8|0;o=s+4|0;n=s;q=(d|0)==-1;a:do{if(!q){a[e>>0]=d;if(a[b+44>>0]|0)if((Yk(e,1,1,c[b+32>>2]|0)|0)==1){r=11;break}else{e=-1;break}c[o>>2]=p;m=e+1|0;g=b+36|0;h=b+40|0;j=p+8|0;k=p;l=b+32|0;while(1){b=c[g>>2]|0;b=Sb[c[(c[b>>2]|0)+12>>2]&15](b,c[h>>2]|0,e,m,n,p,j,o)|0;if((c[n>>2]|0)==(e|0)){e=-1;break a}if((b|0)==3)break;f=(b|0)==1;if(b>>>0>=2){e=-1;break a}b=(c[o>>2]|0)-k|0;if((Yk(p,1,b,c[l>>2]|0)|0)!=(b|0)){e=-1;break a}if(f)e=f?c[n>>2]|0:e;else{r=11;break a}}if((Yk(e,1,1,c[l>>2]|0)|0)!=1)e=-1;else r=11}else r=11}while(0);if((r|0)==11)e=q?0:d;i=s;return e|0}function hm(b,d){b=b|0;d=d|0;var e=0,f=0;f=Is(d,44280)|0;e=b+36|0;c[e>>2]=f;d=b+44|0;c[d>>2]=Eb[c[(c[f>>2]|0)+24>>2]&127](f)|0;e=c[e>>2]|0;a[b+53>>0]=(Eb[c[(c[e>>2]|0)+28>>2]&127](e)|0)&1;if((c[d>>2]|0)>8)Rr(56783);return}function im(a){a=a|0;nn(a);cj(a);return}function jm(a){a=a|0;return mm(a,0)|0}function km(a){a=a|0;return mm(a,1)|0}function lm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;l=m+16|0;k=m+4|0;f=m+8|0;g=m;h=b+52|0;e=(a[h>>0]|0)!=0;a:do{if((d|0)==-1)if(e)d=-1;else{d=c[b+48>>2]|0;a[h>>0]=(d|0)!=-1&1}else{j=b+48|0;b:do{if(e){a[f>>0]=c[j>>2];e=c[b+36>>2]|0;switch(Sb[c[(c[e>>2]|0)+12>>2]&15](e,c[b+40>>2]|0,f,f+1|0,g,l,l+8|0,k)|0){case 1:case 2:{d=-1;break a}case 3:{a[l>>0]=c[j>>2];c[k>>2]=l+1;break}default:{}}e=b+32|0;while(1){f=c[k>>2]|0;if(f>>>0<=l>>>0)break b;b=f+-1|0;c[k>>2]=b;if((al(a[b>>0]|0,c[e>>2]|0)|0)==-1){d=-1;break a}}}}while(0);c[j>>2]=d;a[h>>0]=1}}while(0);i=m;return d|0}function mm(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;s=i;i=i+32|0;r=s+16|0;q=s+8|0;n=s+4|0;o=s;h=b+52|0;a:do{if(a[h>>0]|0){g=b+48|0;f=c[g>>2]|0;if(e){c[g>>2]=-1;a[h>>0]=0}}else{f=c[b+44>>2]|0;f=(f|0)>1?f:1;p=b+32|0;if((f|0)>0){h=0;do{g=Zk(c[p>>2]|0)|0;if((g|0)==-1){f=-1;break a}a[r+h>>0]=g;h=h+1|0}while((h|0)<(f|0))}b:do{if(!(a[b+53>>0]|0)){k=b+40|0;l=b+36|0;m=q+1|0;c:while(1){t=c[k>>2]|0;h=t;g=c[h>>2]|0;h=c[h+4>>2]|0;u=c[l>>2]|0;j=r+f|0;switch(Sb[c[(c[u>>2]|0)+16>>2]&15](u,t,r,j,n,q,m,o)|0){case 2:{f=-1;break a}case 3:break c;case 1:break;default:break b}u=c[k>>2]|0;c[u>>2]=g;c[u+4>>2]=h;if((f|0)==8){f=-1;break a}g=Zk(c[p>>2]|0)|0;if((g|0)==-1){f=-1;break a}a[j>>0]=g;f=f+1|0}a[q>>0]=a[r>>0]|0}else a[q>>0]=a[r>>0]|0}while(0);if(e){f=a[q>>0]|0;c[b+48>>2]=f&255}else{while(1){if((f|0)<=0)break;f=f+-1|0;if((al(d[r+f>>0]|0,c[p>>2]|0)|0)==-1){f=-1;break a}}f=a[q>>0]|0}f=f&255}}while(0);i=s;return f|0}function nm(a){a=a|0;return}function om(a){a=a|0;a=a+4|0;c[a>>2]=(c[a>>2]|0)+1;return}function pm(a){a=a|0;var b=0,d=0;d=a+4|0;b=c[d>>2]|0;c[d>>2]=b+-1;if(!b){Bb[c[(c[a>>2]|0)+8>>2]&255](a);a=1}else a=0;return a|0}function qm(b,d){b=b|0;d=d|0;c[b>>2]=36868;o=0;ia(86,b+4|0,((a[d>>0]&1)==0?d+1|0:c[d+8>>2]|0)|0);b=o;o=0;if(b&1){b=Na()|0;Ya(b|0)}else return}function rm(a,b){a=a|0;b=b|0;c[a>>2]=36868;o=0;ia(86,a+4|0,b|0);a=o;o=0;if(a&1){a=Na()|0;Ya(a|0)}else return}function sm(a,b){a=a|0;b=b|0;var d=0,e=0;e=nl(b)|0;d=bj(e+13|0)|0;c[d>>2]=e;c[d+4>>2]=e;c[d+8>>2]=0;d=d+12|0;lw(d|0,b|0,e+1|0)|0;c[a>>2]=d;return}function tm(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=d;c[a+4>>2]=b;return}function um(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=i;i=i+16|0;e=f;Qb[c[(c[a>>2]|0)+12>>2]&15](e,a,b);if((c[e+4>>2]|0)==(c[d+4>>2]|0))e=(c[e>>2]|0)==(c[d>>2]|0);else e=0;i=f;return e|0}function vm(a,b,d){a=a|0;b=b|0;d=d|0;return((c[b>>2]|0)==(d|0)?(c[b+4>>2]|0)==(a|0):0)|0}function wm(a,b,c){a=a|0;b=b|0;c=c|0;b=dk(c)|0;Gm(a,b,nl(b)|0);return}function xm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;j=i;i=i+16|0;h=j;f=c[d>>2]|0;do{if(f){g=a[e>>0]|0;if(!(g&1))g=(g&255)>>>1;else g=c[e+4>>2]|0;if(g){Pm(e,56990)|0;f=c[d>>2]|0}d=c[d+4>>2]|0;Qb[c[(c[d>>2]|0)+24>>2]&15](h,d,f);d=a[h>>0]|0;g=(d&1)==0;o=0;ma(30,e|0,(g?h+1|0:c[h+8>>2]|0)|0,(g?(d&255)>>>1:c[h+4>>2]|0)|0)|0;d=o;o=0;if(d&1){j=Na()|0;Im(h);Ya(j|0)}else{Im(h);break}}}while(0);c[b>>2]=c[e>>2];c[b+4>>2]=c[e+4>>2];c[b+8>>2]=c[e+8>>2];c[e>>2]=0;c[e+4>>2]=0;c[e+8>>2]=0;i=j;return}function ym(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;f=i;i=i+32|0;e=f+12|0;g=f;Gm(g,d,nl(d)|0);o=0;wa(10,e|0,b|0,g|0);d=o;o=0;do{if(!(d&1)){o=0;ia(87,a|0,e|0);d=o;o=0;if(d&1){f=Na()|0;Im(e);e=f;break}else{Im(e);Im(g);c[a>>2]=42664;d=c[b+4>>2]|0;g=a+8|0;c[g>>2]=c[b>>2];c[g+4>>2]=d;i=f;return}}else e=Na()|0}while(0);Im(g);Ya(e|0)}function zm(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;g=i;i=i+48|0;f=g+24|0;j=g+16|0;h=g;c[j>>2]=b;c[j+4>>2]=d;Fm(h,e);o=0;wa(10,f|0,j|0,h|0);e=o;o=0;do{if(!(e&1)){o=0;ia(87,a|0,f|0);j=o;o=0;if(j&1){j=Na()|0;Im(f);f=j;break}else{Im(f);Im(h);c[a>>2]=42664;c[a+8>>2]=b;c[a+12>>2]=d;i=g;return}}else f=Na()|0}while(0);Im(h);Ya(f|0)}function Am(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;f=i;i=i+48|0;e=f+24|0;h=f+16|0;g=f;c[h>>2]=b;c[h+4>>2]=d;Gm(g,58898,0);o=0;wa(10,e|0,h|0,g|0);h=o;o=0;do{if(!(h&1)){o=0;ia(87,a|0,e|0);h=o;o=0;if(h&1){h=Na()|0;Im(e);e=h;break}else{Im(e);Im(g);c[a>>2]=42664;c[a+8>>2]=b;c[a+12>>2]=d;i=f;return}}else e=Na()|0}while(0);Im(g);Ya(e|0)}function Bm(a){a=a|0;mj(a);return}function Cm(a){a=a|0;mj(a);cj(a);return}function Dm(a){a=a|0;return}function Em(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;rb(42676)|0;if((c[a>>2]|0)==1)do{Da(42704,42676)|0}while((c[a>>2]|0)==1);do{if(!(c[a>>2]|0)){c[a>>2]=1;o=0;ka(72,42676)|0;e=o;o=0;if((((!(e&1)?(o=0,ha(d|0,b|0),e=o,o=0,!(e&1)):0)?(o=0,ka(73,42676)|0,e=o,o=0,!(e&1)):0)?(c[a>>2]=-1,o=0,ka(72,42676)|0,e=o,o=0,!(e&1)):0)?(o=0,ka(74,42704)|0,e=o,o=0,!(e&1)):0)break;e=Na(0)|0;Va(e|0)|0;o=0;ka(73,42676)|0;e=o;o=0;if((!(e&1)?(c[a>>2]=0,o=0,ka(72,42676)|0,e=o,o=0,!(e&1)):0)?(o=0,ka(74,42704)|0,e=o,o=0,!(e&1)):0){o=0;xa(5);o=0}b=Na()|0;o=0;xa(3);e=o;o=0;if(e&1){e=Na(0)|0;ec(e)}else Ya(b|0)}else cb(42676)|0}while(0);return}function Fm(b,d){b=b|0;d=d|0;if(!(a[d>>0]&1)){c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=c[d+8>>2]}else Gm(b,c[d+8>>2]|0,c[d+4>>2]|0);return}function Gm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;if(e>>>0>4294967279)_i(b);if(e>>>0<11){a[b>>0]=e<<1;b=b+1|0}else{g=e+16&-16;f=bj(g)|0;c[b+8>>2]=f;c[b>>2]=g|1;c[b+4>>2]=e;b=f}lw(b|0,d|0,e|0)|0;a[b+e>>0]=0;return}function Hm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;if(d>>>0>4294967279)_i(b);if(d>>>0<11){a[b>>0]=d<<1;b=b+1|0}else{g=d+16&-16;f=bj(g)|0;c[b+8>>2]=f;c[b>>2]=g|1;c[b+4>>2]=d;b=f}iw(b|0,e|0,d|0)|0;a[b+d>>0]=0;return}function Im(b){b=b|0;if(a[b>>0]&1)cj(c[b+8>>2]|0);return}function Jm(b,d){b=b|0;d=d|0;var e=0,f=0;if((b|0)!=(d|0)){e=a[d>>0]|0;f=(e&1)==0;Lm(b,f?d+1|0:c[d+8>>2]|0,f?(e&255)>>>1:c[d+4>>2]|0)|0}return b|0}function Km(a,b){a=a|0;b=b|0;return Lm(a,b,nl(b)|0)|0}function Lm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=a[b>>0]|0;if(!(f&1))h=10;else{f=c[b>>2]|0;h=(f&-2)+-1|0;f=f&255}g=(f&1)==0;do{if(h>>>0>=e>>>0){if(g)f=b+1|0;else f=c[b+8>>2]|0;nw(f|0,d|0,e|0)|0;a[f+e>>0]=0;if(!(a[b>>0]&1)){a[b>>0]=e<<1;break}else{c[b+4>>2]=e;break}}else{if(g)f=(f&255)>>>1;else f=c[b+4>>2]|0;Sm(b,h,e-h|0,f,0,f,e,d)}}while(0);return b|0}function Mm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;f=a[b>>0]|0;g=(f&1)==0;if(g)f=(f&255)>>>1;else f=c[b+4>>2]|0;do{if(f>>>0>=d>>>0)if(g){a[b+1+d>>0]=0;a[b>>0]=d<<1;break}else{a[(c[b+8>>2]|0)+d>>0]=0;c[b+4>>2]=d;break}else Nm(b,d-f|0,e)|0}while(0);return}function Nm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;if(d){f=a[b>>0]|0;if(!(f&1))g=10;else{f=c[b>>2]|0;g=(f&-2)+-1|0;f=f&255}if(!(f&1))h=(f&255)>>>1;else h=c[b+4>>2]|0;if((g-h|0)>>>0>>0){Tm(b,g,d-g+h|0,h,h,0,0);f=a[b>>0]|0}if(!(f&1))g=b+1|0;else g=c[b+8>>2]|0;iw(g+h|0,e|0,d|0)|0;f=h+d|0;if(!(a[b>>0]&1))a[b>>0]=f<<1;else c[b+4>>2]=f;a[g+f>>0]=0}return b|0}function Om(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(d>>>0>4294967279)_i(b);e=a[b>>0]|0;if(!(e&1))f=10;else{e=c[b>>2]|0;f=(e&-2)+-1|0;e=e&255}if(!(e&1))j=(e&255)>>>1;else j=c[b+4>>2]|0;d=j>>>0>d>>>0?j:d;if(d>>>0<11)i=10;else i=(d+16&-16)+-1|0;a:do{if((i|0)!=(f|0)){do{if((i|0)!=10){d=i+1|0;if(i>>>0<=f>>>0){o=0;d=ka(67,d|0)|0;h=o;o=0;if(h&1){b=Na(0)|0;Va(b|0)|0;Xa();break a}}else d=bj(d)|0;if(!(e&1)){f=1;g=b+1|0;h=0;break}else{f=1;g=c[b+8>>2]|0;h=1;break}}else{d=b+1|0;f=0;g=c[b+8>>2]|0;h=1}}while(0);if(!(e&1))e=(e&255)>>>1;else e=c[b+4>>2]|0;lw(d|0,g|0,e+1|0)|0;if(h)cj(g);if(f){c[b>>2]=i+1|1;c[b+4>>2]=j;c[b+8>>2]=d;break}else{a[b>>0]=j<<1;break}}}while(0);return}function Pm(a,b){a=a|0;b=b|0;return Rm(a,b,nl(b)|0)|0}function Qm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=a[b>>0]|0;f=(e&1)!=0;if(f){g=(c[b>>2]&-2)+-1|0;h=c[b+4>>2]|0}else{g=10;h=(e&255)>>>1}if((h|0)==(g|0)){Tm(b,g,1,g,g,0,0);if(!(a[b>>0]&1))g=7;else g=8}else if(f)g=8;else g=7;if((g|0)==7){a[b>>0]=(h<<1)+2;e=b+1|0;f=h+1|0}else if((g|0)==8){e=c[b+8>>2]|0;f=h+1|0;c[b+4>>2]=f}a[e+h>>0]=d;a[e+f>>0]=0;return}function Rm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=a[b>>0]|0;if(!(f&1))g=10;else{f=c[b>>2]|0;g=(f&-2)+-1|0;f=f&255}if(!(f&1))h=(f&255)>>>1;else h=c[b+4>>2]|0;if((g-h|0)>>>0>=e>>>0){if(e){if(!(f&1))g=b+1|0;else g=c[b+8>>2]|0;lw(g+h|0,d|0,e|0)|0;f=h+e|0;if(!(a[b>>0]&1))a[b>>0]=f<<1;else c[b+4>>2]=f;a[g+f>>0]=0}}else Sm(b,g,e-g+h|0,h,h,0,e,d);return b|0}function Sm(b,d,e,f,g,h,i,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0;if((-18-d|0)>>>0>>0)_i(b);if(!(a[b>>0]&1))m=b+1|0;else m=c[b+8>>2]|0;if(d>>>0<2147483623){k=e+d|0;l=d<<1;k=k>>>0>>0?l:k;k=k>>>0<11?11:k+16&-16}else k=-17;l=bj(k)|0;if(g)lw(l|0,m|0,g|0)|0;if(i)lw(l+g|0,j|0,i|0)|0;e=f-h|0;if((e|0)!=(g|0))lw(l+(i+g)|0,m+(h+g)|0,e-g|0)|0;if((d|0)!=10)cj(m);c[b+8>>2]=l;c[b>>2]=k|1;d=e+i|0;c[b+4>>2]=d;a[l+d>>0]=0;return}function Tm(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0;if((-17-d|0)>>>0>>0)_i(b);if(!(a[b>>0]&1))l=b+1|0;else l=c[b+8>>2]|0;if(d>>>0<2147483623){j=e+d|0;k=d<<1;j=j>>>0>>0?k:j;j=j>>>0<11?11:j+16&-16}else j=-17;k=bj(j)|0;if(g)lw(k|0,l|0,g|0)|0;e=f-h|0;if((e|0)!=(g|0))lw(k+(i+g)|0,l+(h+g)|0,e-g|0)|0;if((d|0)!=10)cj(l);c[b+8>>2]=k;c[b>>2]=j|1;return}function Um(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;if(e>>>0>1073741807)_i(b);if(e>>>0<2){a[b>>0]=e<<1;b=b+4|0}else{g=e+4&-4;f=bj(g<<2)|0;c[b+8>>2]=f;c[b>>2]=g|1;c[b+4>>2]=e;b=f}ql(b,d,e)|0;c[b+(e<<2)>>2]=0;return}function Vm(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;if(d>>>0>1073741807)_i(b);if(d>>>0<2){a[b>>0]=d<<1;b=b+4|0}else{g=d+4&-4;f=bj(g<<2)|0;c[b+8>>2]=f;c[b>>2]=g|1;c[b+4>>2]=d;b=f}sl(b,e,d)|0;c[b+(d<<2)>>2]=0;return}function Wm(b){b=b|0;if(a[b>>0]&1)cj(c[b+8>>2]|0);return}function Xm(a,b){a=a|0;b=b|0;return Ym(a,b,pl(b)|0)|0}function Ym(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=a[b>>0]|0;if(!(f&1))h=1;else{f=c[b>>2]|0;h=(f&-2)+-1|0;f=f&255}g=(f&1)==0;do{if(h>>>0>=e>>>0){if(g)f=b+4|0;else f=c[b+8>>2]|0;rl(f,d,e)|0;c[f+(e<<2)>>2]=0;if(!(a[b>>0]&1)){a[b>>0]=e<<1;break}else{c[b+4>>2]=e;break}}else{if(g)f=(f&255)>>>1;else f=c[b+4>>2]|0;$m(b,h,e-h|0,f,0,f,e,d)}}while(0);return b|0}function Zm(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(d>>>0>1073741807)_i(b);e=a[b>>0]|0;if(!(e&1))f=1;else{e=c[b>>2]|0;f=(e&-2)+-1|0;e=e&255}if(!(e&1))j=(e&255)>>>1;else j=c[b+4>>2]|0;d=j>>>0>d>>>0?j:d;if(d>>>0<2)i=1;else i=(d+4&-4)+-1|0;a:do{if((i|0)!=(f|0)){do{if((i|0)!=1){d=(i<<2)+4|0;if(i>>>0<=f>>>0){o=0;d=ka(67,d|0)|0;h=o;o=0;if(h&1){b=Na(0)|0;Va(b|0)|0;Xa();break a}}else d=bj(d)|0;if(!(e&1)){f=1;g=b+4|0;h=0;break}else{f=1;g=c[b+8>>2]|0;h=1;break}}else{d=b+4|0;f=0;g=c[b+8>>2]|0;h=1}}while(0);if(!(e&1))e=(e&255)>>>1;else e=c[b+4>>2]|0;ql(d,g,e+1|0)|0;if(h)cj(g);if(f){c[b>>2]=i+1|1;c[b+4>>2]=j;c[b+8>>2]=d;break}else{a[b>>0]=j<<1;break}}}while(0);return}function _m(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=a[b>>0]|0;f=(e&1)!=0;if(f){g=(c[b>>2]&-2)+-1|0;h=c[b+4>>2]|0}else{g=1;h=(e&255)>>>1}if((h|0)==(g|0)){an(b,g,1,g,g,0,0);if(!(a[b>>0]&1))g=7;else g=8}else if(f)g=8;else g=7;if((g|0)==7){a[b>>0]=(h<<1)+2;e=b+4|0;f=h+1|0}else if((g|0)==8){e=c[b+8>>2]|0;f=h+1|0;c[b+4>>2]=f}c[e+(h<<2)>>2]=d;c[e+(f<<2)>>2]=0;return}function $m(b,d,e,f,g,h,i,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0;if((1073741806-d|0)>>>0>>0)_i(b);if(!(a[b>>0]&1))m=b+4|0;else m=c[b+8>>2]|0;if(d>>>0<536870887){k=e+d|0;l=d<<1;k=k>>>0>>0?l:k;k=k>>>0<2?2:k+4&-4}else k=1073741807;l=bj(k<<2)|0;if(g)ql(l,m,g)|0;if(i)ql(l+(g<<2)|0,j,i)|0;e=f-h|0;if((e|0)!=(g|0))ql(l+(i+g<<2)|0,m+(h+g<<2)|0,e-g|0)|0;if((d|0)!=1)cj(m);c[b+8>>2]=l;c[b>>2]=k|1;d=e+i|0;c[b+4>>2]=d;c[l+(d<<2)>>2]=0;return}function an(b,d,e,f,g,h,i){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0;if((1073741807-d|0)>>>0>>0)_i(b);if(!(a[b>>0]&1))l=b+4|0;else l=c[b+8>>2]|0;if(d>>>0<536870887){j=e+d|0;k=d<<1;j=j>>>0>>0?k:j;j=j>>>0<2?2:j+4&-4}else j=1073741807;k=bj(j<<2)|0;if(g)ql(k,l,g)|0;e=f-h|0;if((e|0)!=(g|0))ql(k+(i+g<<2)|0,l+(h+g<<2)|0,e-g|0)|0;if((d|0)!=1)cj(l);c[b+8>>2]=k;c[b>>2]=j|1;return}function bn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;g=d;f=e-g|0;if(f>>>0>4294967279)_i(b);if(f>>>0<11){a[b>>0]=f<<1;h=b+1|0}else{i=f+16&-16;h=bj(i)|0;c[b+8>>2]=h;c[b>>2]=i|1;c[b+4>>2]=f}b=e-g|0;if((d|0)!=(e|0)){f=h;while(1){a[f>>0]=a[d>>0]|0;d=d+1|0;if((d|0)==(e|0))break;else f=f+1|0}}a[h+b>>0]=0;return}function cn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;h=d;f=e-h|0;g=f>>2;if(g>>>0>1073741807)_i(b);if(g>>>0<2){a[b>>0]=f>>>1;b=b+4|0}else{i=g+4&-4;f=bj(i<<2)|0;c[b+8>>2]=f;c[b>>2]=i|1;c[b+4>>2]=g;b=f}g=(e-h|0)>>>2;if((d|0)!=(e|0)){f=b;while(1){c[f>>2]=c[d>>2];d=d+4|0;if((d|0)==(e|0))break;else f=f+4|0}}c[b+(g<<2)>>2]=0;return}function dn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=i;i=i+16|0;e=d;f=(c[a+24>>2]|0)==0;c[a+16>>2]=f&1|b;if(!((f&1|b)&c[a+20>>2])){i=d;return}b=Ma(16)|0;so()|0;c[e>>2]=1;c[e+4>>2]=43112;o=0;wa(11,b|0,57437,e|0);f=o;o=0;if(f&1){f=Na()|0;La(b|0);Ya(f|0)}else lb(b|0,864,112)}function en(a){a=a|0;var b=0;c[a>>2]=43068;o=0;ia(88,a|0,0);b=o;o=0;if(b&1){b=Na(0)|0;ec(b)}else{Gs(a+28|0);Gl(c[a+32>>2]|0);Gl(c[a+36>>2]|0);Gl(c[a+48>>2]|0);Gl(c[a+60>>2]|0);return}}function fn(a){a=a|0;en(a);return}function gn(a){a=a|0;en(a);cj(a);return}function hn(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;d=c[a+40>>2]|0;e=a+32|0;f=a+36|0;if(d)do{d=d+-1|0;Qb[c[(c[e>>2]|0)+(d<<2)>>2]&15](b,a,c[(c[f>>2]|0)+(d<<2)>>2]|0)}while((d|0)!=0);return}function jn(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;Fs(b,a+28|0);i=d;return c[b>>2]|0}function kn(a,b){a=a|0;b=b|0;var d=0;c[a+24>>2]=b;c[a+16>>2]=(b|0)==0&1;c[a+20>>2]=0;c[a+4>>2]=4098;c[a+12>>2]=0;c[a+8>>2]=6;d=a+28|0;b=a+32|0;a=b+40|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(a|0));Es(d);return}function ln(a){a=a|0;en(a);return}function mn(a){a=a|0;en(a);cj(a);return}function nn(a){a=a|0;c[a>>2]=42760;Gs(a+4|0);return}function on(a){a=a|0;c[a>>2]=42760;Gs(a+4|0);cj(a);return}function pn(a){a=a|0;c[a>>2]=42760;Es(a+4|0);a=a+8|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;return}function qn(a,b){a=a|0;b=b|0;return}function rn(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function sn(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;return}function tn(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;return}function un(a){a=a|0;return 0}function vn(a){a=a|0;return 0}function wn(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;h=b+12|0;i=b+16|0;a:do{if((e|0)>0){g=d;d=0;while(1){f=c[h>>2]|0;if(f>>>0<(c[i>>2]|0)>>>0){c[h>>2]=f+1;f=a[f>>0]|0}else{f=Eb[c[(c[b>>2]|0)+40>>2]&127](b)|0;if((f|0)==-1)break a;f=f&255}a[g>>0]=f;d=d+1|0;if((d|0)<(e|0))g=g+1|0;else break}}else d=0}while(0);return d|0}function xn(a){a=a|0;return-1}function yn(a){a=a|0;var b=0;if((Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1)a=-1;else{b=a+12|0;a=c[b>>2]|0;c[b>>2]=a+1;a=d[a>>0]|0}return a|0}function zn(a,b){a=a|0;b=b|0;return-1}function An(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0;i=b+24|0;j=b+28|0;a:do{if((f|0)>0){h=e;e=0;while(1){g=c[i>>2]|0;if(g>>>0>=(c[j>>2]|0)>>>0){if((Lb[c[(c[b>>2]|0)+52>>2]&63](b,d[h>>0]|0)|0)==-1)break a}else{k=a[h>>0]|0;c[i>>2]=g+1;a[g>>0]=k}e=e+1|0;if((e|0)<(f|0))h=h+1|0;else break}}else e=0}while(0);return e|0}function Bn(a,b){a=a|0;b=b|0;return-1}function Cn(a){a=a|0;c[a>>2]=42824;Gs(a+4|0);return}function Dn(a){a=a|0;c[a>>2]=42824;Gs(a+4|0);cj(a);return}function En(a){a=a|0;c[a>>2]=42824;Es(a+4|0);a=a+8|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;c[a+16>>2]=0;c[a+20>>2]=0;return}function Fn(a,b){a=a|0;b=b|0;return}function Gn(a,b,c){a=a|0;b=b|0;c=c|0;return a|0}function Hn(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;return}function In(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;b=a;c[b>>2]=0;c[b+4>>2]=0;b=a+8|0;c[b>>2]=-1;c[b+4>>2]=-1;return}function Jn(a){a=a|0;return 0}function Kn(a){a=a|0;return 0}function Ln(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;g=a+12|0;h=a+16|0;a:do{if((d|0)>0){f=b;b=0;while(1){e=c[g>>2]|0;if(e>>>0>=(c[h>>2]|0)>>>0){e=Eb[c[(c[a>>2]|0)+40>>2]&127](a)|0;if((e|0)==-1)break a}else{c[g>>2]=e+4;e=c[e>>2]|0}c[f>>2]=e;b=b+1|0;if((b|0)<(d|0))f=f+4|0;else break}}else b=0}while(0);return b|0}function Mn(a){a=a|0;return-1}function Nn(a){a=a|0;var b=0;if((Eb[c[(c[a>>2]|0)+36>>2]&127](a)|0)==-1)a=-1;else{b=a+12|0;a=c[b>>2]|0;c[b>>2]=a+4;a=c[a>>2]|0}return a|0}function On(a,b){a=a|0;b=b|0;return-1}function Pn(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;g=a+24|0;h=a+28|0;a:do{if((d|0)>0){f=b;b=0;while(1){e=c[g>>2]|0;if(e>>>0>=(c[h>>2]|0)>>>0){if((Lb[c[(c[a>>2]|0)+52>>2]&63](a,c[f>>2]|0)|0)==-1)break a}else{i=c[f>>2]|0;c[g>>2]=e+4;c[e>>2]=i}b=b+1|0;if((b|0)<(d|0))f=f+4|0;else break}}else b=0}while(0);return b|0}function Qn(a,b){a=a|0;b=b|0;return-1}function Rn(a){a=a|0;en(a+8|0);return}function Sn(a){a=a|0;en(a+((c[(c[a>>2]|0)+-12>>2]|0)+8)|0);return}function Tn(a){a=a|0;en(a+8|0);cj(a);return}function Un(a){a=a|0;Tn(a+(c[(c[a>>2]|0)+-12>>2]|0)|0);return}function Vn(b){b=b|0;var d=0,e=0,f=0,g=0;f=i;i=i+16|0;e=f;a:do{if(c[b+((c[(c[b>>2]|0)+-12>>2]|0)+24)>>2]|0){o=0;ia(65,e|0,b|0);d=o;o=0;b:do{if(d&1)d=Na(0)|0;else{do{if(a[e>>0]|0){d=c[b+((c[(c[b>>2]|0)+-12>>2]|0)+24)>>2]|0;o=0;d=ka(c[(c[d>>2]|0)+24>>2]|0,d|0)|0;g=o;o=0;if(!(g&1)){if((d|0)!=-1)break;g=c[(c[b>>2]|0)+-12>>2]|0;o=0;ia(66,b+g|0,c[b+(g+16)>>2]|1|0);g=o;o=0;if(!(g&1))break}d=Na(0)|0;ho(e);break b}}while(0);ho(e);break a}}while(0);Va(d|0)|0;o=0;ha(181,b+(c[(c[b>>2]|0)+-12>>2]|0)|0);g=o;o=0;if(!(g&1)){Xa();break}d=Na()|0;o=0;xa(3);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}else Ya(d|0)}}while(0);i=f;return b|0}function Wn(a){a=a|0;var b=0;b=a+16|0;c[b>>2]=c[b>>2]|1;if(!(c[a+20>>2]&1))return;else mb()}function Xn(a){a=a|0;en(a+8|0);return}function Yn(a){a=a|0;en(a+((c[(c[a>>2]|0)+-12>>2]|0)+8)|0);return}function Zn(a){a=a|0;en(a+8|0);cj(a);return}function _n(a){a=a|0;Zn(a+(c[(c[a>>2]|0)+-12>>2]|0)|0);return}function $n(b){b=b|0;var d=0,e=0,f=0,g=0;f=i;i=i+16|0;e=f;a:do{if(c[b+((c[(c[b>>2]|0)+-12>>2]|0)+24)>>2]|0){o=0;ia(89,e|0,b|0);d=o;o=0;b:do{if(d&1)d=Na(0)|0;else{do{if(a[e>>0]|0){d=c[b+((c[(c[b>>2]|0)+-12>>2]|0)+24)>>2]|0;o=0;d=ka(c[(c[d>>2]|0)+24>>2]|0,d|0)|0;g=o;o=0;if(!(g&1)){if((d|0)!=-1)break;g=c[(c[b>>2]|0)+-12>>2]|0;o=0;ia(66,b+g|0,c[b+(g+16)>>2]|1|0);g=o;o=0;if(!(g&1))break}d=Na(0)|0;po(e);break b}}while(0);po(e);break a}}while(0);Va(d|0)|0;o=0;ha(181,b+(c[(c[b>>2]|0)+-12>>2]|0)|0);g=o;o=0;if(!(g&1)){Xa();break}d=Na()|0;o=0;xa(3);g=o;o=0;if(g&1){g=Na(0)|0;ec(g)}else Ya(d|0)}}while(0);i=f;return b|0}function ao(a,b){a=a|0;b=b|0;return}function bo(a){a=a|0;en(a+4|0);return}function co(a){a=a|0;en(a+((c[(c[a>>2]|0)+-12>>2]|0)+4)|0);return}function eo(a){a=a|0;en(a+4|0);cj(a);return}function fo(a){a=a|0;eo(a+(c[(c[a>>2]|0)+-12>>2]|0)|0);return}function go(b,d){b=b|0;d=d|0;var e=0;a[b>>0]=0;c[b+4>>2]=d;e=c[(c[d>>2]|0)+-12>>2]|0;if(!(c[d+(e+16)>>2]|0)){e=c[d+(e+72)>>2]|0;if(e)Vn(e)|0;a[b>>0]=1}return}function ho(a){a=a|0;var b=0,d=0;a=a+4|0;d=c[a>>2]|0;b=c[(c[d>>2]|0)+-12>>2]|0;do{if((((c[d+(b+24)>>2]|0)!=0?(c[d+(b+16)>>2]|0)==0:0)?(c[d+(b+4)>>2]&8192|0)!=0:0)?!(Za()|0):0){b=c[a>>2]|0;b=c[b+((c[(c[b>>2]|0)+-12>>2]|0)+24)>>2]|0;o=0;b=ka(c[(c[b>>2]|0)+24>>2]|0,b|0)|0;d=o;o=0;if(!(d&1)){if((b|0)!=-1)break;b=c[a>>2]|0;d=c[(c[b>>2]|0)+-12>>2]|0;o=0;ia(66,b+d|0,c[b+(d+16)>>2]|1|0);d=o;o=0;if(!(d&1))break}d=Na(0)|0;Va(d|0)|0;o=0;xa(3);d=o;o=0;if(d&1){d=Na(0)|0;ec(d)}}}while(0);return}function io(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;q=i;i=i+32|0;k=q+20|0;l=q+16|0;n=q+8|0;e=q;o=0;ia(65,n|0,b|0);m=o;o=0;a:do{if(m&1){e=Na(0)|0;f=b;g=b;p=19}else{do{if(a[n>>0]|0){c[e>>2]=jn(b+(c[(c[b>>2]|0)+-12>>2]|0)|0)|0;o=0;m=ra(37,e|0,43392)|0;j=o;o=0;if(j&1){p=Na(0)|0;Gs(e);e=p}else{Gs(e);g=c[(c[b>>2]|0)+-12>>2]|0;j=c[b+(g+24)>>2]|0;f=b+g|0;g=b+(g+76)|0;e=c[g>>2]|0;do{if((e|0)==-1){c[k>>2]=jn(f)|0;o=0;e=ra(37,k|0,44220)|0;r=o;o=0;if(!(r&1)?(o=0,h=ra(c[(c[e>>2]|0)+28>>2]|0,e|0,32)|0,r=o,o=0,!(r&1)):0){Gs(k);e=h<<24>>24;c[g>>2]=e;p=10;break}e=Na(0)|0;Gs(k)}else p=10}while(0);if((p|0)==10){r=c[(c[m>>2]|0)+16>>2]|0;c[l>>2]=j;o=0;c[k>>2]=c[l>>2];e=sa(r|0,m|0,k|0,f|0,e&255|0,d|0)|0;r=o;o=0;if(!(r&1)){if(e)break;r=c[(c[b>>2]|0)+-12>>2]|0;o=0;ia(66,b+r|0,c[b+(r+16)>>2]|5|0);r=o;o=0;if(!(r&1))break}e=Na(0)|0}}ho(n);f=b;g=b;p=19;break a}}while(0);ho(n)}}while(0);do{if((p|0)==19){Va(e|0)|0;o=0;ha(181,f+(c[(c[g>>2]|0)+-12>>2]|0)|0);r=o;o=0;if(!(r&1)){Xa();break}e=Na()|0;o=0;xa(3);r=o;o=0;if(r&1){r=Na(0)|0;ec(r)}else Ya(e|0)}}while(0);i=q;return b|0}function jo(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;q=i;i=i+32|0;k=q+20|0;l=q+16|0;n=q+8|0;e=q;o=0;ia(65,n|0,b|0);m=o;o=0;a:do{if(m&1){e=Na(0)|0;f=b;g=b;p=19}else{do{if(a[n>>0]|0){c[e>>2]=jn(b+(c[(c[b>>2]|0)+-12>>2]|0)|0)|0;o=0;m=ra(37,e|0,43392)|0;j=o;o=0;if(j&1){p=Na(0)|0;Gs(e);e=p}else{Gs(e);g=c[(c[b>>2]|0)+-12>>2]|0;j=c[b+(g+24)>>2]|0;f=b+g|0;g=b+(g+76)|0;e=c[g>>2]|0;do{if((e|0)==-1){c[k>>2]=jn(f)|0;o=0;e=ra(37,k|0,44220)|0;r=o;o=0;if(!(r&1)?(o=0,h=ra(c[(c[e>>2]|0)+28>>2]|0,e|0,32)|0,r=o,o=0,!(r&1)):0){Gs(k);e=h<<24>>24;c[g>>2]=e;p=10;break}e=Na(0)|0;Gs(k)}else p=10}while(0);if((p|0)==10){r=c[(c[m>>2]|0)+24>>2]|0;c[l>>2]=j;o=0;c[k>>2]=c[l>>2];e=sa(r|0,m|0,k|0,f|0,e&255|0,d|0)|0;r=o;o=0;if(!(r&1)){if(e)break;r=c[(c[b>>2]|0)+-12>>2]|0;o=0;ia(66,b+r|0,c[b+(r+16)>>2]|5|0);r=o;o=0;if(!(r&1))break}e=Na(0)|0}}ho(n);f=b;g=b;p=19;break a}}while(0);ho(n)}}while(0);do{if((p|0)==19){Va(e|0)|0;o=0;ha(181,f+(c[(c[g>>2]|0)+-12>>2]|0)|0);r=o;o=0;if(!(r&1)){Xa();break}e=Na()|0;o=0;xa(3);r=o;o=0;if(r&1){r=Na(0)|0;ec(r)}else Ya(e|0)}}while(0);i=q;return b|0}function ko(a){a=a|0;en(a+4|0);return}function lo(a){a=a|0;en(a+((c[(c[a>>2]|0)+-12>>2]|0)+4)|0);return}function mo(a){a=a|0;en(a+4|0);cj(a);return}function no(a){a=a|0;mo(a+(c[(c[a>>2]|0)+-12>>2]|0)|0);return}function oo(b,d){b=b|0;d=d|0;var e=0;a[b>>0]=0;c[b+4>>2]=d;e=c[(c[d>>2]|0)+-12>>2]|0;if(!(c[d+(e+16)>>2]|0)){e=c[d+(e+72)>>2]|0;if(e)$n(e)|0;a[b>>0]=1}return}function po(a){a=a|0;var b=0,d=0;a=a+4|0;d=c[a>>2]|0;b=c[(c[d>>2]|0)+-12>>2]|0;do{if((((c[d+(b+24)>>2]|0)!=0?(c[d+(b+16)>>2]|0)==0:0)?(c[d+(b+4)>>2]&8192|0)!=0:0)?!(Za()|0):0){b=c[a>>2]|0;b=c[b+((c[(c[b>>2]|0)+-12>>2]|0)+24)>>2]|0;o=0;b=ka(c[(c[b>>2]|0)+24>>2]|0,b|0)|0;d=o;o=0;if(!(d&1)){if((b|0)!=-1)break;b=c[a>>2]|0;d=c[(c[b>>2]|0)+-12>>2]|0;o=0;ia(66,b+d|0,c[b+(d+16)>>2]|1|0);d=o;o=0;if(!(d&1))break}d=Na(0)|0;Va(d|0)|0;o=0;xa(3);d=o;o=0;if(d&1){d=Na(0)|0;ec(d)}}}while(0);return}function qo(a){a=a|0;return 57453}function ro(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)!=1&(c|0)<257)wm(a,b,c);else Gm(a,57462,35);return}function so(){if((a[1048]|0)==0?(Ha(1048)|0)!=0:0){c[10778]=43084;kb(72,43112,n|0)|0;Pa(1048)}return 43112}function to(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;e=i;i=i+16|0;f=e+8|0;g=e;j=d;h=c[j+4>>2]|0;d=g;c[d>>2]=c[j>>2];c[d+4>>2]=h;c[f>>2]=c[g>>2];c[f+4>>2]=c[g+4>>2];ym(a,f,b);c[a>>2]=43048;i=e;return}function uo(a){a=a|0;Bm(a);return}function vo(a){a=a|0;Bm(a);cj(a);return}function wo(a){a=a|0;en(a);cj(a);return}function xo(a){a=a|0;cj(a);return}function yo(a){a=a|0;return}function zo(a){a=a|0;return}function Ao(a){a=a|0;cj(a);return}function Bo(b,c,d,e,f){b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;a:do{if((e|0)==(f|0))h=6;else while(1){if((c|0)==(d|0)){c=-1;break a}b=a[c>>0]|0;g=a[e>>0]|0;if(b<<24>>24>24){c=-1;break a}if(g<<24>>24>24){c=1;break a}c=c+1|0;e=e+1|0;if((e|0)==(f|0)){h=6;break}}}while(0);if((h|0)==6)c=(c|0)!=(d|0)&1;return c|0}function Co(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;bn(a,c,d);return}function Do(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)==(d|0))b=0;else{b=0;do{b=(a[c>>0]|0)+(b<<4)|0;e=b&-268435456;b=(e>>>24|e)^b;c=c+1|0}while((c|0)!=(d|0))}return b|0}function Eo(a){a=a|0;return}function Fo(a){a=a|0;cj(a);return}function Go(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;a:do{if((e|0)==(f|0))h=6;else while(1){if((b|0)==(d|0)){b=-1;break a}a=c[b>>2]|0;g=c[e>>2]|0;if((a|0)<(g|0)){b=-1;break a}if((g|0)<(a|0)){b=1;break a}b=b+4|0;e=e+4|0;if((e|0)==(f|0)){h=6;break}}}while(0);if((h|0)==6)b=(b|0)!=(d|0)&1;return b|0}function Ho(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;cn(a,c,d);return}function Io(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((b|0)==(d|0))a=0;else{a=0;do{a=(c[b>>2]|0)+(a<<4)|0;e=a&-268435456;a=(e>>>24|e)^a;b=b+4|0}while((b|0)!=(d|0))}return a|0}function Jo(a){a=a|0;return}function Ko(a){a=a|0;cj(a);return}function Lo(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0;s=i;i=i+64|0;q=s+56|0;j=s+52|0;n=s+48|0;k=s+44|0;l=s+40|0;m=s+36|0;p=s+32|0;t=s+8|0;r=s;a:do{if(!(c[f+4>>2]&1)){c[n>>2]=-1;t=c[(c[b>>2]|0)+16>>2]|0;c[k>>2]=c[d>>2];c[l>>2]=c[e>>2];c[j>>2]=c[k>>2];c[q>>2]=c[l>>2];j=Db[t&63](b,j,q,f,g,n)|0;c[d>>2]=j;switch(c[n>>2]|0){case 0:{a[h>>0]=0;break a}case 1:{a[h>>0]=1;break a}default:{a[h>>0]=1;c[g>>2]=4;break a}}}else{j=jn(f)|0;c[m>>2]=j;o=0;b=ra(37,m|0,44220)|0;n=o;o=0;do{if(!(n&1)){pm(j)|0;j=jn(f)|0;c[p>>2]=j;o=0;l=ra(37,p|0,44360)|0;p=o;o=0;if(p&1){t=Na()|0;pm(j)|0;j=t;break}pm(j)|0;o=0;ia(c[(c[l>>2]|0)+24>>2]|0,t|0,l|0);p=o;o=0;if(!(p&1)){k=t+12|0;o=0;ia(c[(c[l>>2]|0)+28>>2]|0,k|0,l|0);p=o;o=0;if(!(p&1)){c[r>>2]=c[e>>2];o=0;c[q>>2]=c[r>>2];j=ea(7,d|0,q|0,t|0,t+24|0,b|0,g|0,1)|0;g=o;o=0;if(g&1){j=Na()|0;Im(t+12|0);Im(t);break}else{a[h>>0]=(j|0)==(t|0)&1;j=c[d>>2]|0;Im(t+12|0);Im(t);break a}}}else k=t;j=Na()|0;l=D;if((t|0)!=(k|0))do{k=k+-12|0;Im(k)}while((k|0)!=(t|0))}else{t=Na()|0;pm(j)|0;j=t}}while(0);Ya(j|0)}}while(0);i=s;return j|0}function Mo(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=yu(a,k,j,e,f,g)|0;i=h;return a|0}function No(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=zu(a,k,j,e,f,g)|0;i=h;return a|0}function Oo(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Au(a,k,j,e,f,g)|0;i=h;return a|0}function Po(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Bu(a,k,j,e,f,g)|0;i=h;return a|0}function Qo(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Cu(a,k,j,e,f,g)|0;i=h;return a|0}function Ro(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Du(a,k,j,e,f,g)|0;i=h;return a|0}function So(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Eu(a,k,j,e,f,g)|0;i=h;return a|0}function To(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Fu(a,k,j,e,f,g)|0;i=h;return a|0}function Uo(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Gu(a,k,j,e,f,g)|0;i=h;return a|0}function Vo(b,e,f,g,h,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;C=i;i=i+240|0;x=C;s=C+208|0;E=C+32|0;b=C+28|0;D=C+16|0;w=C+12|0;u=C+48|0;v=C+8|0;t=C+4|0;c[E>>2]=0;c[E+4>>2]=0;c[E+8>>2]=0;o=0;g=ka(68,g|0)|0;r=o;o=0;do{if(r&1)b=Na()|0;else{c[b>>2]=g;o=0;b=ra(37,b|0,44220)|0;r=o;o=0;if(!(r&1)?(o=0,va(c[(c[b>>2]|0)+32>>2]|0,b|0,57498,57524,s|0)|0,r=o,o=0,!(r&1)):0){pm(g)|0;c[D>>2]=0;c[D+4>>2]=0;c[D+8>>2]=0;if(!(a[D>>0]&1))b=10;else b=(c[D>>2]&-2)+-1|0;o=0;wa(8,D|0,b|0,0);r=o;o=0;a:do{if(!(r&1)){q=D+8|0;r=D+1|0;g=(a[D>>0]&1)==0?r:c[q>>2]|0;c[w>>2]=g;c[v>>2]=u;c[t>>2]=0;p=D+4|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;n=o;o=0;if(n&1){F=29;break}if((k|0)==-1){c[e>>2]=0;b=0}}}else b=0;l=(b|0)==0;k=c[f>>2]|0;do{if(k){if((c[k+12>>2]|0)!=(c[k+16>>2]|0))if(l)break;else break b;o=0;m=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;n=o;o=0;if(n&1){F=29;break b}if((m|0)!=-1)if(l)break;else break b;else{c[f>>2]=0;F=19;break}}else F=19}while(0);if((F|0)==19){F=0;if(l){k=0;break}else k=0}l=a[D>>0]|0;l=(l&1)==0?(l&255)>>>1:c[p>>2]|0;if((c[w>>2]|0)==(g+l|0)){o=0;wa(8,D|0,l<<1|0,0);n=o;o=0;if(n&1){F=29;break}if(!(a[D>>0]&1))g=10;else g=(c[D>>2]&-2)+-1|0;o=0;wa(8,D|0,g|0,0);n=o;o=0;if(n&1){F=29;break}g=(a[D>>0]&1)==0?r:c[q>>2]|0;c[w>>2]=g+l}m=b+12|0;l=c[m>>2]|0;n=b+16|0;if((l|0)==(c[n>>2]|0)){o=0;l=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;G=o;o=0;if(G&1){F=29;break}}else l=d[l>>0]|0;if(Wo(l&255,16,g,w,t,0,E,u,v,s)|0)break;k=c[m>>2]|0;if((k|0)==(c[n>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;G=o;o=0;if(G&1){F=29;break}else continue}else{c[m>>2]=k+1;continue}}if((F|0)==29){b=Na()|0;break}o=0;wa(8,D|0,(c[w>>2]|0)-g|0,0);G=o;o=0;if((!(G&1)?(y=a[D>>0]|0,z=c[q>>2]|0,o=0,A=ua(3)|0,G=o,o=0,!(G&1)):0)?(o=0,c[x>>2]=j,B=va(16,((y&1)==0?r:z)|0,A|0,58882,x|0)|0,G=o,o=0,!(G&1)):0){if((B|0)!=1)c[h>>2]=4;if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;G=o;o=0;if(G&1){F=30;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(k){if((c[k+12>>2]|0)==(c[k+16>>2]|0)){o=0;b=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;G=o;o=0;if(G&1){F=30;break a}if((b|0)==-1){c[f>>2]=0;F=55;break}}if(!g)F=56}else F=55}while(0);if((F|0)==55?g:0)F=56;if((F|0)==56)c[h>>2]=c[h>>2]|2;G=c[e>>2]|0;Im(D);Im(E);i=C;return G|0}else F=30}else F=30}while(0);if((F|0)==30)b=Na()|0;Im(D);break}b=Na()|0;pm(g)|0}}while(0);Im(E);Ya(b|0);return 0}function Wo(b,d,e,f,g,h,i,j,k,l){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0;o=c[f>>2]|0;p=(o|0)==(e|0);do{if(p){m=(a[l+24>>0]|0)==b<<24>>24;if(!m?(a[l+25>>0]|0)!=b<<24>>24:0){n=5;break}c[f>>2]=e+1;a[e>>0]=m?43:45;c[g>>2]=0;m=0}else n=5}while(0);a:do{if((n|0)==5){n=a[i>>0]|0;if(b<<24>>24==h<<24>>24?(((n&1)==0?(n&255)>>>1:c[i+4>>2]|0)|0)!=0:0){m=c[k>>2]|0;if((m-j|0)>=160){m=0;break}d=c[g>>2]|0;c[k>>2]=m+4;c[m>>2]=d;c[g>>2]=0;m=0;break}i=l+26|0;m=l;while(1){if((a[m>>0]|0)==b<<24>>24)break;m=m+1|0;if((m|0)==(i|0)){m=i;break}}m=m-l|0;if((m|0)>23)m=-1;else{switch(d|0){case 10:case 8:{if((m|0)>=(d|0)){m=-1;break a}break}case 16:{if((m|0)>=22){if(p){m=-1;break a}if((o-e|0)>=3){m=-1;break a}if((a[o+-1>>0]|0)!=48){m=-1;break a}c[g>>2]=0;m=a[57498+m>>0]|0;c[f>>2]=o+1;a[o>>0]=m;m=0;break a}break}default:{}}m=a[57498+m>>0]|0;c[f>>2]=o+1;a[o>>0]=m;c[g>>2]=(c[g>>2]|0)+1;m=0}}}while(0);return m|0}function Xo(){var b=0,d=0;do{if((a[1968]|0)==0?(Ha(1968)|0)!=0:0){o=0;b=ma(31,2147483647,58885,0)|0;d=o;o=0;if(d&1){d=Na()|0;sb(1968);Ya(d|0)}else{c[11196]=b;Pa(1968);break}}}while(0);return c[11196]|0}function Yo(a){a=a|0;return}function Zo(a){a=a|0;cj(a);return}function _o(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0;s=i;i=i+64|0;q=s+56|0;j=s+52|0;n=s+48|0;k=s+44|0;l=s+40|0;m=s+36|0;p=s+32|0;t=s+8|0;r=s;a:do{if(!(c[f+4>>2]&1)){c[n>>2]=-1;t=c[(c[b>>2]|0)+16>>2]|0;c[k>>2]=c[d>>2];c[l>>2]=c[e>>2];c[j>>2]=c[k>>2];c[q>>2]=c[l>>2];j=Db[t&63](b,j,q,f,g,n)|0;c[d>>2]=j;switch(c[n>>2]|0){case 0:{a[h>>0]=0;break a}case 1:{a[h>>0]=1;break a}default:{a[h>>0]=1;c[g>>2]=4;break a}}}else{j=jn(f)|0;c[m>>2]=j;o=0;b=ra(37,m|0,44212)|0;n=o;o=0;do{if(!(n&1)){pm(j)|0;j=jn(f)|0;c[p>>2]=j;o=0;l=ra(37,p|0,44368)|0;p=o;o=0;if(p&1){t=Na()|0;pm(j)|0;j=t;break}pm(j)|0;o=0;ia(c[(c[l>>2]|0)+24>>2]|0,t|0,l|0);p=o;o=0;if(!(p&1)){k=t+12|0;o=0;ia(c[(c[l>>2]|0)+28>>2]|0,k|0,l|0);p=o;o=0;if(!(p&1)){c[r>>2]=c[e>>2];o=0;c[q>>2]=c[r>>2];j=ea(8,d|0,q|0,t|0,t+24|0,b|0,g|0,1)|0;g=o;o=0;if(g&1){j=Na()|0;Wm(t+12|0);Wm(t);break}else{a[h>>0]=(j|0)==(t|0)&1;j=c[d>>2]|0;Wm(t+12|0);Wm(t);break a}}}else k=t;j=Na()|0;l=D;if((t|0)!=(k|0))do{k=k+-12|0;Wm(k)}while((k|0)!=(t|0))}else{t=Na()|0;pm(j)|0;j=t}}while(0);Ya(j|0)}}while(0);i=s;return j|0}function $o(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Ju(a,k,j,e,f,g)|0;i=h;return a|0}function ap(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Ku(a,k,j,e,f,g)|0;i=h;return a|0}function bp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Lu(a,k,j,e,f,g)|0;i=h;return a|0}function cp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Mu(a,k,j,e,f,g)|0;i=h;return a|0}function dp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Nu(a,k,j,e,f,g)|0;i=h;return a|0}function ep(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Ou(a,k,j,e,f,g)|0;i=h;return a|0}function fp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Pu(a,k,j,e,f,g)|0;i=h;return a|0}function gp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Qu(a,k,j,e,f,g)|0;i=h;return a|0}function hp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;h=i;i=i+16|0;j=h+12|0;k=h+8|0;m=h+4|0;l=h;c[m>>2]=c[b>>2];c[l>>2]=c[d>>2];c[k>>2]=c[m>>2];c[j>>2]=c[l>>2];a=Ru(a,k,j,e,f,g)|0;i=h;return a|0}function ip(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;B=i;i=i+320|0;w=B;r=B+208|0;D=B+32|0;b=B+28|0;C=B+16|0;v=B+12|0;t=B+48|0;u=B+8|0;s=B+4|0;c[D>>2]=0;c[D+4>>2]=0;c[D+8>>2]=0;o=0;f=ka(68,f|0)|0;q=o;o=0;do{if(q&1)b=Na()|0;else{c[b>>2]=f;o=0;b=ra(37,b|0,44212)|0;q=o;o=0;if(!(q&1)?(o=0,va(c[(c[b>>2]|0)+48>>2]|0,b|0,57498,57524,r|0)|0,q=o,o=0,!(q&1)):0){pm(f)|0;c[C>>2]=0;c[C+4>>2]=0;c[C+8>>2]=0;if(!(a[C>>0]&1))b=10;else b=(c[C>>2]&-2)+-1|0;o=0;wa(8,C|0,b|0,0);q=o;o=0;a:do{if(!(q&1)){p=C+8|0;q=C+1|0;b=(a[C>>0]&1)==0?q:c[p>>2]|0;c[v>>2]=b;c[u>>2]=t;c[s>>2]=0;n=C+4|0;j=c[d>>2]|0;b:while(1){if(j){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;m=o;o=0;if(m&1){E=30;break}}else f=c[f>>2]|0;if((f|0)==-1){c[d>>2]=0;f=0;k=1}else{f=j;k=0}}else{f=0;k=1}l=c[e>>2]|0;do{if(l){j=c[l+12>>2]|0;if((j|0)==(c[l+16>>2]|0)){o=0;j=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;m=o;o=0;if(m&1){E=30;break b}}else j=c[j>>2]|0;if((j|0)!=-1)if(k){j=l;break}else{j=l;break b}else{c[e>>2]=0;E=20;break}}else E=20}while(0);if((E|0)==20){E=0;if(k){j=0;break}else j=0}k=a[C>>0]|0;k=(k&1)==0?(k&255)>>>1:c[n>>2]|0;if((c[v>>2]|0)==(b+k|0)){o=0;wa(8,C|0,k<<1|0,0);m=o;o=0;if(m&1){E=30;break}if(!(a[C>>0]&1))b=10;else b=(c[C>>2]&-2)+-1|0;o=0;wa(8,C|0,b|0,0);m=o;o=0;if(m&1){E=30;break}b=(a[C>>0]&1)==0?q:c[p>>2]|0;c[v>>2]=b+k}l=f+12|0;k=c[l>>2]|0;m=f+16|0;if((k|0)==(c[m>>2]|0)){o=0;k=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;F=o;o=0;if(F&1){E=30;break}}else k=c[k>>2]|0;if(jp(k,16,b,v,s,0,D,t,u,r)|0)break;j=c[l>>2]|0;if((j|0)==(c[m>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;F=o;o=0;if(F&1){E=30;break}else{j=f;continue}}else{c[l>>2]=j+4;j=f;continue}}if((E|0)==30){b=Na()|0;break}o=0;wa(8,C|0,(c[v>>2]|0)-b|0,0);F=o;o=0;if((!(F&1)?(x=a[C>>0]|0,y=c[p>>2]|0,o=0,z=ua(3)|0,F=o,o=0,!(F&1)):0)?(o=0,c[w>>2]=h,A=va(16,((x&1)==0?q:y)|0,z|0,58882,w|0)|0,F=o,o=0,!(F&1)):0){if((A|0)!=1)c[g>>2]=4;if(f){b=c[f+12>>2]|0;if((b|0)==(c[f+16>>2]|0)){o=0;b=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;F=o;o=0;if(F&1){E=31;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(j){b=c[j+12>>2]|0;if((b|0)==(c[j+16>>2]|0)){o=0;b=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;F=o;o=0;if(F&1){E=31;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{E=59;break}else{c[e>>2]=0;E=57;break}}else E=57}while(0);if((E|0)==57?f:0)E=59;if((E|0)==59)c[g>>2]=c[g>>2]|2;F=c[d>>2]|0;Im(C);Im(D);i=B;return F|0}else E=31}else E=31}while(0);if((E|0)==31)b=Na()|0;Im(C);break}b=Na()|0;pm(f)|0}}while(0);Im(D);Ya(b|0);return 0}function jp(b,d,e,f,g,h,i,j,k,l){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0;o=c[f>>2]|0;p=(o|0)==(e|0);do{if(p){m=(c[l+96>>2]|0)==(b|0);if(!m?(c[l+100>>2]|0)!=(b|0):0){n=5;break}c[f>>2]=e+1;a[e>>0]=m?43:45;c[g>>2]=0;m=0}else n=5}while(0);a:do{if((n|0)==5){n=a[i>>0]|0;if((b|0)==(h|0)?(((n&1)==0?(n&255)>>>1:c[i+4>>2]|0)|0)!=0:0){m=c[k>>2]|0;if((m-j|0)>=160){m=0;break}d=c[g>>2]|0;c[k>>2]=m+4;c[m>>2]=d;c[g>>2]=0;m=0;break}i=l+104|0;m=l;while(1){if((c[m>>2]|0)==(b|0))break;m=m+4|0;if((m|0)==(i|0)){m=i;break}}m=m-l|0;i=m>>2;if((m|0)>92)m=-1;else{switch(d|0){case 10:case 8:{if((i|0)>=(d|0)){m=-1;break a}break}case 16:{if((m|0)>=88){if(p){m=-1;break a}if((o-e|0)>=3){m=-1;break a}if((a[o+-1>>0]|0)!=48){m=-1;break a}c[g>>2]=0;m=a[57498+i>>0]|0;c[f>>2]=o+1;a[o>>0]=m;m=0;break a}break}default:{}}m=a[57498+i>>0]|0;c[f>>2]=o+1;a[o>>0]=m;c[g>>2]=(c[g>>2]|0)+1;m=0}}}while(0);return m|0}function kp(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;k=l;d=jn(d)|0;c[k>>2]=d;o=0;g=ra(37,k|0,44220)|0;m=o;o=0;if((((!(m&1)?(o=0,va(c[(c[g>>2]|0)+32>>2]|0,g|0,57498,57524,e|0)|0,m=o,o=0,!(m&1)):0)?(o=0,j=ra(37,k|0,44360)|0,m=o,o=0,!(m&1)):0)?(o=0,h=ka(c[(c[j>>2]|0)+16>>2]|0,j|0)|0,m=o,o=0,!(m&1)):0)?(a[f>>0]=h,o=0,ia(c[(c[j>>2]|0)+20>>2]|0,b|0,j|0),m=o,o=0,!(m&1)):0){pm(d)|0;i=l;return}m=Na()|0;pm(d)|0;Ya(m|0)}function lp(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0;n=i;i=i+16|0;m=n;d=jn(d)|0;c[m>>2]=d;o=0;h=ra(37,m|0,44220)|0;p=o;o=0;if(((((!(p&1)?(o=0,va(c[(c[h>>2]|0)+32>>2]|0,h|0,57498,57530,e|0)|0,p=o,o=0,!(p&1)):0)?(o=0,l=ra(37,m|0,44360)|0,p=o,o=0,!(p&1)):0)?(o=0,j=ka(c[(c[l>>2]|0)+12>>2]|0,l|0)|0,p=o,o=0,!(p&1)):0)?(a[f>>0]=j,o=0,k=ka(c[(c[l>>2]|0)+16>>2]|0,l|0)|0,p=o,o=0,!(p&1)):0)?(a[g>>0]=k,o=0,ia(c[(c[l>>2]|0)+20>>2]|0,b|0,l|0),p=o,o=0,!(p&1)):0){pm(d)|0;i=n;return}p=Na()|0;pm(d)|0;Ya(p|0)}function mp(b,e,f,g,h,i,j,k,l,m,n,o){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0;a:do{if(b<<24>>24==i<<24>>24)if(a[e>>0]|0){a[e>>0]=0;f=c[h>>2]|0;c[h>>2]=f+1;a[f>>0]=46;f=a[k>>0]|0;if((((f&1)==0?(f&255)>>>1:c[k+4>>2]|0)|0)!=0?(p=c[m>>2]|0,(p-l|0)<160):0){l=c[n>>2]|0;c[m>>2]=p+4;c[p>>2]=l;p=0}else p=0}else p=-1;else{if(b<<24>>24==j<<24>>24?(j=a[k>>0]|0,(((j&1)==0?(j&255)>>>1:c[k+4>>2]|0)|0)!=0):0){if(!(a[e>>0]|0)){p=-1;break}p=c[m>>2]|0;if((p-l|0)>=160){p=0;break}l=c[n>>2]|0;c[m>>2]=p+4;c[p>>2]=l;c[n>>2]=0;p=0;break}i=o+32|0;p=o;while(1){if((a[p>>0]|0)==b<<24>>24)break;p=p+1|0;if((p|0)==(i|0)){p=i;break}}i=p-o|0;if((i|0)>31)p=-1;else{j=a[57498+i>>0]|0;switch(i|0){case 24:case 25:{p=c[h>>2]|0;if((p|0)!=(g|0)?(d[p+-1>>0]&95|0)!=(d[f>>0]&127|0):0){p=-1;break a}c[h>>2]=p+1;a[p>>0]=j;p=0;break a}case 23:case 22:{a[f>>0]=80;p=c[h>>2]|0;c[h>>2]=p+1;a[p>>0]=j;p=0;break a}default:{p=j&95;if((((p|0)==(a[f>>0]|0)?(a[f>>0]=p|128,(a[e>>0]|0)!=0):0)?(a[e>>0]=0,f=a[k>>0]|0,(((f&1)==0?(f&255)>>>1:c[k+4>>2]|0)|0)!=0):0)?(q=c[m>>2]|0,(q-l|0)<160):0){l=c[n>>2]|0;c[m>>2]=q+4;c[q>>2]=l}m=c[h>>2]|0;c[h>>2]=m+1;a[m>>0]=j;if((i|0)>21){p=0;break a}c[n>>2]=(c[n>>2]|0)+1;p=0;break a}}}}}while(0);return p|0}function np(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;j=k;b=jn(b)|0;c[j>>2]=b;o=0;f=ra(37,j|0,44212)|0;l=o;o=0;if((((!(l&1)?(o=0,va(c[(c[f>>2]|0)+48>>2]|0,f|0,57498,57524,d|0)|0,l=o,o=0,!(l&1)):0)?(o=0,h=ra(37,j|0,44368)|0,l=o,o=0,!(l&1)):0)?(o=0,g=ka(c[(c[h>>2]|0)+16>>2]|0,h|0)|0,l=o,o=0,!(l&1)):0)?(c[e>>2]=g,o=0,ia(c[(c[h>>2]|0)+20>>2]|0,a|0,h|0),l=o,o=0,!(l&1)):0){pm(b)|0;i=k;return}l=Na()|0;pm(b)|0;Ya(l|0)}function op(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+16|0;l=m;b=jn(b)|0;c[l>>2]=b;o=0;g=ra(37,l|0,44212)|0;n=o;o=0;if(((((!(n&1)?(o=0,va(c[(c[g>>2]|0)+48>>2]|0,g|0,57498,57530,d|0)|0,n=o,o=0,!(n&1)):0)?(o=0,k=ra(37,l|0,44368)|0,n=o,o=0,!(n&1)):0)?(o=0,h=ka(c[(c[k>>2]|0)+12>>2]|0,k|0)|0,n=o,o=0,!(n&1)):0)?(c[e>>2]=h,o=0,j=ka(c[(c[k>>2]|0)+16>>2]|0,k|0)|0,n=o,o=0,!(n&1)):0)?(c[f>>2]=j,o=0,ia(c[(c[k>>2]|0)+20>>2]|0,a|0,k|0),n=o,o=0,!(n&1)):0){pm(b)|0;i=m;return}n=Na()|0;pm(b)|0;Ya(n|0)}function pp(b,e,f,g,h,i,j,k,l,m,n,o){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0;a:do{if((b|0)==(i|0))if(a[e>>0]|0){a[e>>0]=0;f=c[h>>2]|0;c[h>>2]=f+1;a[f>>0]=46;f=a[k>>0]|0;if((((f&1)==0?(f&255)>>>1:c[k+4>>2]|0)|0)!=0?(p=c[m>>2]|0,(p-l|0)<160):0){l=c[n>>2]|0;c[m>>2]=p+4;c[p>>2]=l;p=0}else p=0}else p=-1;else{if((b|0)==(j|0)?(j=a[k>>0]|0,(((j&1)==0?(j&255)>>>1:c[k+4>>2]|0)|0)!=0):0){if(!(a[e>>0]|0)){p=-1;break}p=c[m>>2]|0;if((p-l|0)>=160){p=0;break}l=c[n>>2]|0;c[m>>2]=p+4;c[p>>2]=l;c[n>>2]=0;p=0;break}i=o+128|0;p=o;while(1){if((c[p>>2]|0)==(b|0))break;p=p+4|0;if((p|0)==(i|0)){p=i;break}}i=p-o|0;p=i>>2;if((i|0)<=124){j=a[57498+p>>0]|0;switch(p|0){case 24:case 25:{p=c[h>>2]|0;if((p|0)!=(g|0)?(d[p+-1>>0]&95|0)!=(d[f>>0]&127|0):0){p=-1;break a}c[h>>2]=p+1;a[p>>0]=j;p=0;break a}case 23:case 22:{a[f>>0]=80;break}default:{p=j&95;if((((p|0)==(a[f>>0]|0)?(a[f>>0]=p|128,(a[e>>0]|0)!=0):0)?(a[e>>0]=0,f=a[k>>0]|0,(((f&1)==0?(f&255)>>>1:c[k+4>>2]|0)|0)!=0):0)?(q=c[m>>2]|0,(q-l|0)<160):0){l=c[n>>2]|0;c[m>>2]=q+4;c[q>>2]=l}}}m=c[h>>2]|0;c[h>>2]=m+1;a[m>>0]=j;if((i|0)>84)p=0;else{c[n>>2]=(c[n>>2]|0)+1;p=0}}else p=-1}}while(0);return p|0}function qp(a){a=a|0;return}function rp(a){a=a|0;cj(a);return}function sp(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;h=n+20|0;j=n+16|0;k=n+12|0;m=n;a:do{if(!(c[e+4>>2]&1)){m=c[(c[b>>2]|0)+24>>2]|0;c[j>>2]=c[d>>2];c[h>>2]=c[j>>2];h=Mb[m&31](b,h,e,f,g&1)|0}else{h=jn(e)|0;c[k>>2]=h;o=0;j=ra(37,k|0,44360)|0;l=o;o=0;b:do{if(l&1){n=Na()|0;pm(h)|0;h=n}else{pm(h)|0;h=c[j>>2]|0;if(g)Cb[c[h+24>>2]&127](m,j);else Cb[c[h+28>>2]&127](m,j);b=a[m>>0]|0;l=(b&1)==0;h=m+1|0;g=m+8|0;k=l?h:m+1|0;h=l?h:c[m+8>>2]|0;l=m+4|0;e=(b&1)==0;c:do{if((h|0)!=((e?k:c[g>>2]|0)+(e?(b&255)>>>1:c[l>>2]|0)|0)){d:while(1){j=a[h>>0]|0;f=c[d>>2]|0;do{if(f){e=f+24|0;b=c[e>>2]|0;if((b|0)!=(c[f+28>>2]|0)){c[e>>2]=b+1;a[b>>0]=j;break}o=0;j=ra(c[(c[f>>2]|0)+52>>2]|0,f|0,j&255|0)|0;b=o;o=0;if(b&1)break d;if((j|0)==-1)c[d>>2]=0}}while(0);h=h+1|0;b=a[m>>0]|0;e=(b&1)==0;if((h|0)==((e?k:c[g>>2]|0)+(e?(b&255)>>>1:c[l>>2]|0)|0))break c}h=Na()|0;Im(m);break b}}while(0);h=c[d>>2]|0;Im(m);break a}}while(0);Ya(h|0)}}while(0);i=n;return h|0}function tp(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;n=i;i=i+64|0;h=n;q=n+56|0;r=n+44|0;k=n+20|0;m=n+16|0;l=n+12|0;p=n+8|0;j=n+4|0;a[q>>0]=a[58887]|0;a[q+1>>0]=a[58888]|0;a[q+2>>0]=a[58889]|0;a[q+3>>0]=a[58890]|0;a[q+4>>0]=a[58891]|0;a[q+5>>0]=a[58892]|0;up(q+1|0,58893,1,c[e+4>>2]|0);b=Xo()|0;c[h>>2]=g;g=r+(Su(r,12,b,q,h)|0)|0;q=vp(r,g,e)|0;b=jn(e)|0;c[p>>2]=b;o=0;pa(1,r|0,q|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){r=Na()|0;pm(b)|0;Ya(r|0)}else{pm(b)|0;c[j>>2]=c[d>>2];q=c[m>>2]|0;r=c[l>>2]|0;c[h>>2]=c[j>>2];r=cd(h,k,q,r,e,f)|0;i=n;return r|0}return 0}function up(b,c,d,e){b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;if(e&2048){a[b>>0]=43;b=b+1|0}if(e&512){a[b>>0]=35;b=b+1|0}f=a[c>>0]|0;if(f<<24>>24){g=c;while(1){g=g+1|0;c=b+1|0;a[b>>0]=f;f=a[g>>0]|0;if(!(f<<24>>24)){b=c;break}else b=c}}a:do{switch(e&74|0){case 64:{a[b>>0]=111;break}case 8:if(!(e&16384)){a[b>>0]=120;break a}else{a[b>>0]=88;break a}default:if(d){a[b>>0]=100;break a}else{a[b>>0]=117;break a}}}while(0);return}function vp(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;a:do{switch(c[e+4>>2]&176|0){case 16:{e=a[b>>0]|0;switch(e<<24>>24){case 43:case 45:{b=b+1|0;break a}default:{}}if((d-b|0)>1&e<<24>>24==48){switch(a[b+1>>0]|0){case 88:case 120:break;default:{f=7;break a}}b=b+2|0}else f=7;break}case 32:{b=d;break}default:f=7}}while(0);return b|0}function wp(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;v=i;i=i+16|0;w=v;t=Is(j,44220)|0;m=Is(j,44360)|0;Cb[c[(c[m>>2]|0)+20>>2]&127](w,m);r=a[w>>0]|0;s=w+4|0;a:do{if(!(((r&1)==0?(r&255)>>>1:c[s>>2]|0)|0)){o=0;va(c[(c[t>>2]|0)+32>>2]|0,t|0,b|0,e|0,f|0)|0;u=o;o=0;if(u&1)u=5;else{j=f+(e-b)|0;c[h>>2]=j;u=29}}else{c[h>>2]=f;j=a[b>>0]|0;switch(j<<24>>24){case 43:case 45:{o=0;j=ra(c[(c[t>>2]|0)+28>>2]|0,t|0,j|0)|0;r=o;o=0;if(r&1){u=5;break a}l=c[h>>2]|0;c[h>>2]=l+1;a[l>>0]=j;l=b+1|0;break}default:l=b}b:do{if((e-l|0)>1?(a[l>>0]|0)==48:0){j=l+1|0;switch(a[j>>0]|0){case 88:case 120:break;default:break b}o=0;k=ra(c[(c[t>>2]|0)+28>>2]|0,t|0,48)|0;r=o;o=0;if(r&1){u=5;break a}r=c[h>>2]|0;c[h>>2]=r+1;a[r>>0]=k;o=0;j=ra(c[(c[t>>2]|0)+28>>2]|0,t|0,a[j>>0]|0)|0;r=o;o=0;if(r&1){u=5;break a}r=c[h>>2]|0;c[h>>2]=r+1;a[r>>0]=j;l=l+2|0}}while(0);if((l|0)!=(e|0)?(n=e+-1|0,l>>>0>>0):0){k=l;j=n;do{r=a[k>>0]|0;a[k>>0]=a[j>>0]|0;a[j>>0]=r;k=k+1|0;j=j+-1|0}while(k>>>0>>0)}o=0;n=ka(c[(c[m>>2]|0)+16>>2]|0,m|0)|0;r=o;o=0;if(!(r&1)){p=w+8|0;q=w+1|0;c:do{if(l>>>0>>0){j=0;k=0;r=l;while(1){m=a[((a[w>>0]&1)==0?q:c[p>>2]|0)+k>>0]|0;if(m<<24>>24!=0&(j|0)==(m<<24>>24|0)){j=c[h>>2]|0;c[h>>2]=j+1;a[j>>0]=n;j=a[w>>0]|0;m=0;k=(k>>>0<(((j&1)==0?(j&255)>>>1:c[s>>2]|0)+-1|0)>>>0&1)+k|0}else m=j;o=0;j=ra(c[(c[t>>2]|0)+28>>2]|0,t|0,a[r>>0]|0)|0;x=o;o=0;if(x&1)break;x=c[h>>2]|0;c[h>>2]=x+1;a[x>>0]=j;r=r+1|0;if(r>>>0>=e>>>0)break c;else j=m+1|0}j=Na()|0;break a}}while(0);k=b;j=f+(l-k)|0;b=c[h>>2]|0;if((j|0)==(b|0)){b=k;u=29}else{b=b+-1|0;if(j>>>0>>0)do{x=a[j>>0]|0;a[j>>0]=a[b>>0]|0;a[b>>0]=x;j=j+1|0;b=b+-1|0}while(j>>>0>>0);b=k;j=c[h>>2]|0;u=29}}else u=5}}while(0);if((u|0)==5)j=Na()|0;else if((u|0)==29){c[g>>2]=(d|0)==(e|0)?j:f+(d-b)|0;Im(w);i=v;return}Im(w);Ya(j|0)}function xp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0;n=i;i=i+96|0;h=n+8|0;a=n;q=n+74|0;k=n+32|0;m=n+28|0;l=n+24|0;p=n+20|0;j=n+16|0;r=a;c[r>>2]=37;c[r+4>>2]=0;up(a+1|0,58895,1,c[d+4>>2]|0);r=Xo()|0;s=h;c[s>>2]=f;c[s+4>>2]=g;g=q+(Su(q,22,r,a,h)|0)|0;f=vp(q,g,d)|0;a=jn(d)|0;c[p>>2]=a;o=0;pa(1,q|0,f|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){s=Na()|0;pm(a)|0;Ya(s|0)}else{pm(a)|0;c[j>>2]=c[b>>2];r=c[m>>2]|0;s=c[l>>2]|0;c[h>>2]=c[j>>2];s=cd(h,k,r,s,d,e)|0;i=n;return s|0}return 0}function yp(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;n=i;i=i+64|0;h=n;q=n+56|0;r=n+44|0;k=n+20|0;m=n+16|0;l=n+12|0;p=n+8|0;j=n+4|0;a[q>>0]=a[58887]|0;a[q+1>>0]=a[58888]|0;a[q+2>>0]=a[58889]|0;a[q+3>>0]=a[58890]|0;a[q+4>>0]=a[58891]|0;a[q+5>>0]=a[58892]|0;up(q+1|0,58893,0,c[e+4>>2]|0);b=Xo()|0;c[h>>2]=g;g=r+(Su(r,12,b,q,h)|0)|0;q=vp(r,g,e)|0;b=jn(e)|0;c[p>>2]=b;o=0;pa(1,r|0,q|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){r=Na()|0;pm(b)|0;Ya(r|0)}else{pm(b)|0;c[j>>2]=c[d>>2];q=c[m>>2]|0;r=c[l>>2]|0;c[h>>2]=c[j>>2];r=cd(h,k,q,r,e,f)|0;i=n;return r|0}return 0}function zp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0;n=i;i=i+112|0;h=n+8|0;a=n;q=n+75|0;k=n+32|0;m=n+28|0;l=n+24|0;p=n+20|0;j=n+16|0;r=a;c[r>>2]=37;c[r+4>>2]=0;up(a+1|0,58895,0,c[d+4>>2]|0);r=Xo()|0;s=h;c[s>>2]=f;c[s+4>>2]=g;g=q+(Su(q,23,r,a,h)|0)|0;f=vp(q,g,d)|0;a=jn(d)|0;c[p>>2]=a;o=0;pa(1,q|0,f|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){s=Na()|0;pm(a)|0;Ya(s|0)}else{pm(a)|0;c[j>>2]=c[b>>2];r=c[m>>2]|0;s=c[l>>2]|0;c[h>>2]=c[j>>2];s=cd(h,k,r,s,d,e)|0;i=n;return s|0}return 0}function Ap(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;var g=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;z=i;i=i+176|0;u=z+84|0;q=z+48|0;p=z+32|0;l=z+24|0;g=z+8|0;n=z;s=z+88|0;t=z+80|0;k=z+118|0;y=z+76|0;x=z+72|0;v=z+68|0;w=z+64|0;m=n;c[m>>2]=37;c[m+4>>2]=0;m=Bp(n+1|0,58898,c[d+4>>2]|0)|0;c[t>>2]=s;a=Xo()|0;if(m){c[g>>2]=c[d+8>>2];h[g+8>>3]=f;g=Su(s,30,a,n,g)|0}else{h[l>>3]=f;g=Su(s,30,a,n,l)|0}a:do{if((g|0)>29){o=0;a=ua(3)|0;g=o;o=0;g=g&1;if(m){if(!g?(o=0,c[p>>2]=c[d+8>>2],h[p+8>>3]=f,j=va(17,t|0,a|0,n|0,p|0)|0,r=o,o=0,!(r&1)):0)A=12}else if(!g?(o=0,c[q>>2]=c[d+8>>2],h[q+8>>3]=f,r=va(17,t|0,a|0,n|0,q|0)|0,q=o,o=0,!(q&1)):0){j=r;A=12}do{if((A|0)==12){a=c[t>>2]|0;if(!a){o=0;xa(6);r=o;o=0;if(r&1)break;g=c[t>>2]|0}else g=a;a=g;n=g;A=16;break a}}while(0);a=Na()|0}else{a=c[t>>2]|0;n=0;j=g;A=16}}while(0);if((A|0)==16){l=a+j|0;m=vp(a,l,d)|0;do{if((a|0)==(s|0)){a=s;g=0;A=22}else{j=Fl(j<<1)|0;if(!j){o=0;xa(6);A=o;o=0;if(A&1){g=0;A=20;break}a=c[t>>2]|0}g=j;k=j;A=22}}while(0);do{if((A|0)==22){o=0;j=ka(68,d|0)|0;t=o;o=0;if(!(t&1)){c[v>>2]=j;o=0;pa(2,a|0,m|0,l|0,k|0,y|0,x|0,v|0);v=o;o=0;if(v&1){a=Na()|0;pm(j)|0;break}pm(j)|0;c[w>>2]=c[b>>2];A=c[y>>2]|0;a=c[x>>2]|0;o=0;c[u>>2]=c[w>>2];a=ja(39,u|0,k|0,A|0,a|0,d|0,e|0)|0;A=o;o=0;if(!(A&1)){c[b>>2]=a;if(g)Gl(g);if(n)Gl(n);i=z;return a|0}else A=20}else A=20}}while(0);if((A|0)==20)a=Na()|0;if(g)Gl(g);if(n)Gl(n)}Ya(a|0);return 0}function Bp(b,c,d){b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;if(d&2048){a[b>>0]=43;b=b+1|0}if(d&1024){a[b>>0]=35;b=b+1|0}h=d&260;f=d>>>14;i=(h|0)==260;if(i)g=0;else{a[b>>0]=46;a[b+1>>0]=42;b=b+2|0;g=1}d=a[c>>0]|0;if(d<<24>>24){e=b;while(1){c=c+1|0;b=e+1|0;a[e>>0]=d;d=a[c>>0]|0;if(!(d<<24>>24))break;else e=b}}a:do{switch(h|0){case 4:if(!(f&1)){a[b>>0]=102;break a}else{a[b>>0]=70;break a}case 256:if(!(f&1)){a[b>>0]=101;break a}else{a[b>>0]=69;break a}default:{d=(f&1|0)!=0;if(i)if(d){a[b>>0]=65;break a}else{a[b>>0]=97;break a}else if(d){a[b>>0]=71;break a}else{a[b>>0]=103;break a}}}}while(0);return g|0}function Cp(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;z=i;i=i+16|0;A=z;y=Is(j,44220)|0;w=Is(j,44360)|0;Cb[c[(c[w>>2]|0)+20>>2]&127](A,w);c[h>>2]=f;j=a[b>>0]|0;switch(j<<24>>24){case 43:case 45:{o=0;j=ra(c[(c[y>>2]|0)+28>>2]|0,y|0,j|0)|0;x=o;o=0;if(x&1)v=8;else{n=c[h>>2]|0;c[h>>2]=n+1;a[n>>0]=j;n=b+1|0;v=10}break}default:{n=b;v=10}}a:do{if((v|0)==10){x=e;b:do{if((x-n|0)>1?(a[n>>0]|0)==48:0){l=n+1|0;switch(a[l>>0]|0){case 88:case 120:break;default:{v=11;break b}}o=0;j=ra(c[(c[y>>2]|0)+28>>2]|0,y|0,48)|0;u=o;o=0;if(u&1){v=8;break a}u=c[h>>2]|0;c[h>>2]=u+1;a[u>>0]=j;n=n+2|0;o=0;j=ra(c[(c[y>>2]|0)+28>>2]|0,y|0,a[l>>0]|0)|0;u=o;o=0;if(u&1){v=8;break a}u=c[h>>2]|0;c[h>>2]=u+1;a[u>>0]=j;if(n>>>0>>0){j=n;while(1){l=a[j>>0]|0;o=0;m=ua(3)|0;u=o;o=0;if(u&1)break;o=0;l=ra(39,l<<24>>24|0,m|0)|0;u=o;o=0;if(u&1)break;if(!l){u=n;break b}j=j+1|0;if(j>>>0>=e>>>0){u=n;break b}}j=Na()|0;break a}else{u=n;j=n}}else v=11}while(0);c:do{if((v|0)==11)if(n>>>0>>0){j=n;while(1){l=a[j>>0]|0;o=0;m=ua(3)|0;u=o;o=0;if(u&1)break;o=0;l=ra(40,l<<24>>24|0,m|0)|0;u=o;o=0;if(u&1)break;if(!l){u=n;break c}j=j+1|0;if(j>>>0>=e>>>0){u=n;break c}}j=Na()|0;break a}else{u=n;j=n}}while(0);s=a[A>>0]|0;t=A+4|0;if(((s&1)==0?(s&255)>>>1:c[t>>2]|0)|0){if((u|0)!=(j|0)?(p=j+-1|0,u>>>0

    >>0):0){m=u;l=p;do{s=a[m>>0]|0;a[m>>0]=a[l>>0]|0;a[l>>0]=s;m=m+1|0;l=l+-1|0}while(m>>>0>>0)}o=0;p=ka(c[(c[w>>2]|0)+16>>2]|0,w|0)|0;s=o;o=0;if(s&1){v=8;break}q=A+8|0;r=A+1|0;d:do{if(u>>>0>>0){l=0;m=0;s=u;while(1){n=a[((a[A>>0]&1)==0?r:c[q>>2]|0)+m>>0]|0;if(n<<24>>24>0&(l|0)==(n<<24>>24|0)){l=c[h>>2]|0;c[h>>2]=l+1;a[l>>0]=p;l=a[A>>0]|0;n=0;m=(m>>>0<(((l&1)==0?(l&255)>>>1:c[t>>2]|0)+-1|0)>>>0&1)+m|0}else n=l;o=0;l=ra(c[(c[y>>2]|0)+28>>2]|0,y|0,a[s>>0]|0)|0;B=o;o=0;if(B&1)break;B=c[h>>2]|0;c[h>>2]=B+1;a[B>>0]=l;s=s+1|0;if(s>>>0>=j>>>0)break d;else l=n+1|0}j=Na()|0;break a}}while(0);l=f+(u-b)|0;m=c[h>>2]|0;if((l|0)!=(m|0)?(k=m+-1|0,l>>>0>>0):0){do{B=a[l>>0]|0;a[l>>0]=a[k>>0]|0;a[k>>0]=B;l=l+1|0;k=k+-1|0}while(l>>>0>>0);l=y}else l=y}else{o=0;va(c[(c[y>>2]|0)+32>>2]|0,y|0,u|0,j|0,c[h>>2]|0)|0;B=o;o=0;if(B&1){v=8;break}c[h>>2]=(c[h>>2]|0)+(j-u);l=y}e:do{if(j>>>0>>0){while(1){k=a[j>>0]|0;if(k<<24>>24==46)break;o=0;k=ra(c[(c[l>>2]|0)+28>>2]|0,y|0,k|0)|0;B=o;o=0;if(B&1){v=4;break}B=c[h>>2]|0;c[h>>2]=B+1;a[B>>0]=k;j=j+1|0;if(j>>>0>=e>>>0)break e}if((v|0)==4){j=Na()|0;break a}o=0;k=ka(c[(c[w>>2]|0)+12>>2]|0,w|0)|0;B=o;o=0;if(B&1){v=8;break a}B=c[h>>2]|0;c[h>>2]=B+1;a[B>>0]=k;j=j+1|0}}while(0);o=0;va(c[(c[y>>2]|0)+32>>2]|0,y|0,j|0,e|0,c[h>>2]|0)|0;B=o;o=0;if(B&1)v=8;else{B=(c[h>>2]|0)+(x-j)|0;c[h>>2]=B;c[g>>2]=(d|0)==(e|0)?B:f+(d-b)|0;Im(A);i=z;return}}}while(0);if((v|0)==8)j=Na()|0;Im(A);Ya(j|0)}function Dp(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;var g=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;z=i;i=i+176|0;u=z+76|0;q=z+48|0;p=z+32|0;l=z+24|0;g=z+8|0;n=z;s=z+80|0;t=z+72|0;k=z+110|0;y=z+68|0;x=z+64|0;v=z+60|0;w=z+56|0;m=n;c[m>>2]=37;c[m+4>>2]=0;m=Bp(n+1|0,58899,c[d+4>>2]|0)|0;c[t>>2]=s;a=Xo()|0;if(m){c[g>>2]=c[d+8>>2];h[g+8>>3]=f;g=Su(s,30,a,n,g)|0}else{h[l>>3]=f;g=Su(s,30,a,n,l)|0}a:do{if((g|0)>29){o=0;a=ua(3)|0;g=o;o=0;g=g&1;if(m){if(!g?(o=0,c[p>>2]=c[d+8>>2],h[p+8>>3]=f,j=va(17,t|0,a|0,n|0,p|0)|0,r=o,o=0,!(r&1)):0)A=12}else if(!g?(o=0,h[q>>3]=f,r=va(17,t|0,a|0,n|0,q|0)|0,q=o,o=0,!(q&1)):0){j=r;A=12}do{if((A|0)==12){a=c[t>>2]|0;if(!a){o=0;xa(6);r=o;o=0;if(r&1)break;g=c[t>>2]|0}else g=a;a=g;n=g;A=16;break a}}while(0);a=Na()|0}else{a=c[t>>2]|0;n=0;j=g;A=16}}while(0);if((A|0)==16){l=a+j|0;m=vp(a,l,d)|0;do{if((a|0)==(s|0)){a=s;g=0;A=22}else{j=Fl(j<<1)|0;if(!j){o=0;xa(6);A=o;o=0;if(A&1){g=0;A=20;break}a=c[t>>2]|0}g=j;k=j;A=22}}while(0);do{if((A|0)==22){o=0;j=ka(68,d|0)|0;t=o;o=0;if(!(t&1)){c[v>>2]=j;o=0;pa(2,a|0,m|0,l|0,k|0,y|0,x|0,v|0);v=o;o=0;if(v&1){a=Na()|0;pm(j)|0;break}pm(j)|0;c[w>>2]=c[b>>2];A=c[y>>2]|0;a=c[x>>2]|0;o=0;c[u>>2]=c[w>>2];a=ja(39,u|0,k|0,A|0,a|0,d|0,e|0)|0;A=o;o=0;if(!(A&1)){c[b>>2]=a;if(g)Gl(g);if(n)Gl(n);i=z;return a|0}else A=20}else A=20}}while(0);if((A|0)==20)a=Na()|0;if(g)Gl(g);if(n)Gl(n)}Ya(a|0);return 0}function Ep(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;q=i;i=i+80|0;l=q;b=q+70|0;n=q+12|0;p=q+32|0;k=q+8|0;m=q+4|0;a[b>>0]=a[58901]|0;a[b+1>>0]=a[58902]|0;a[b+2>>0]=a[58903]|0;a[b+3>>0]=a[58904]|0;a[b+4>>0]=a[58905]|0;a[b+5>>0]=a[58906]|0;h=Xo()|0;c[l>>2]=g;b=Su(n,20,h,b,l)|0;g=n+b|0;h=vp(n,g,e)|0;j=jn(e)|0;c[k>>2]=j;o=0;k=ra(37,k|0,44220)|0;r=o;o=0;if(r&1){r=Na()|0;pm(j)|0;Ya(r|0)}else{pm(j)|0;Pb[c[(c[k>>2]|0)+32>>2]&31](k,n,g,p)|0;r=p+b|0;c[m>>2]=c[d>>2];c[l>>2]=c[m>>2];r=cd(l,p,(h|0)==(g|0)?r:p+(h-n)|0,r,e,f)|0;i=q;return r|0}return 0}function Fp(a){a=a|0;return}function Gp(a){a=a|0;cj(a);return}function Hp(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;h=m+20|0;j=m+16|0;k=m+12|0;l=m;a:do{if(!(c[e+4>>2]&1)){l=c[(c[b>>2]|0)+24>>2]|0;c[j>>2]=c[d>>2];c[h>>2]=c[j>>2];h=Mb[l&31](b,h,e,f,g&1)|0}else{h=jn(e)|0;c[k>>2]=h;o=0;j=ra(37,k|0,44368)|0;k=o;o=0;b:do{if(k&1){m=Na()|0;pm(h)|0;h=m}else{pm(h)|0;h=c[j>>2]|0;if(g)Cb[c[h+24>>2]&127](l,j);else Cb[c[h+28>>2]&127](l,j);b=a[l>>0]|0;e=(b&1)==0;h=l+4|0;g=l+8|0;k=e?h:l+4|0;h=e?h:c[l+8>>2]|0;e=(b&1)==0;c:do{if((h|0)!=((e?k:c[g>>2]|0)+((e?(b&255)>>>1:c[k>>2]|0)<<2)|0)){while(1){j=c[h>>2]|0;f=c[d>>2]|0;if(f){e=f+24|0;b=c[e>>2]|0;if((b|0)==(c[f+28>>2]|0)){o=0;j=ra(c[(c[f>>2]|0)+52>>2]|0,f|0,j|0)|0;b=o;o=0;if(b&1)break}else{c[e>>2]=b+4;c[b>>2]=j}if((j|0)==-1)c[d>>2]=0}h=h+4|0;b=a[l>>0]|0;e=(b&1)==0;if((h|0)==((e?k:c[g>>2]|0)+((e?(b&255)>>>1:c[k>>2]|0)<<2)|0))break c}h=Na()|0;Wm(l);break b}}while(0);h=c[d>>2]|0;Wm(l);break a}}while(0);Ya(h|0)}}while(0);i=m;return h|0}function Ip(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0;n=i;i=i+128|0;h=n;q=n+116|0;r=n+104|0;k=n+20|0;m=n+16|0;l=n+12|0;p=n+8|0;j=n+4|0;a[q>>0]=a[58887]|0;a[q+1>>0]=a[58888]|0;a[q+2>>0]=a[58889]|0;a[q+3>>0]=a[58890]|0;a[q+4>>0]=a[58891]|0;a[q+5>>0]=a[58892]|0;up(q+1|0,58893,1,c[e+4>>2]|0);b=Xo()|0;c[h>>2]=g;g=r+(Su(r,12,b,q,h)|0)|0;q=vp(r,g,e)|0;b=jn(e)|0;c[p>>2]=b;o=0;pa(3,r|0,q|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){r=Na()|0;pm(b)|0;Ya(r|0)}else{pm(b)|0;c[j>>2]=c[d>>2];q=c[m>>2]|0;r=c[l>>2]|0;c[h>>2]=c[j>>2];r=Uu(h,k,q,r,e,f)|0;i=n;return r|0}return 0}function Jp(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;v=i;i=i+16|0;w=v;t=Is(j,44212)|0;m=Is(j,44368)|0;Cb[c[(c[m>>2]|0)+20>>2]&127](w,m);r=a[w>>0]|0;s=w+4|0;a:do{if(!(((r&1)==0?(r&255)>>>1:c[s>>2]|0)|0)){o=0;va(c[(c[t>>2]|0)+48>>2]|0,t|0,b|0,e|0,f|0)|0;u=o;o=0;if(u&1)u=5;else{j=f+(e-b<<2)|0;c[h>>2]=j;u=28}}else{c[h>>2]=f;j=a[b>>0]|0;switch(j<<24>>24){case 43:case 45:{o=0;j=ra(c[(c[t>>2]|0)+44>>2]|0,t|0,j|0)|0;r=o;o=0;if(r&1){u=5;break a}l=c[h>>2]|0;c[h>>2]=l+4;c[l>>2]=j;l=b+1|0;break}default:l=b}b:do{if((e-l|0)>1?(a[l>>0]|0)==48:0){j=l+1|0;switch(a[j>>0]|0){case 88:case 120:break;default:{r=l;break b}}o=0;k=ra(c[(c[t>>2]|0)+44>>2]|0,t|0,48)|0;r=o;o=0;if(r&1){u=5;break a}r=c[h>>2]|0;c[h>>2]=r+4;c[r>>2]=k;o=0;j=ra(c[(c[t>>2]|0)+44>>2]|0,t|0,a[j>>0]|0)|0;r=o;o=0;if(r&1){u=5;break a}r=c[h>>2]|0;c[h>>2]=r+4;c[r>>2]=j;r=l+2|0}else r=l}while(0);if((r|0)!=(e|0)?(n=e+-1|0,r>>>0>>0):0){k=r;j=n;do{q=a[k>>0]|0;a[k>>0]=a[j>>0]|0;a[j>>0]=q;k=k+1|0;j=j+-1|0}while(k>>>0>>0)}o=0;m=ka(c[(c[m>>2]|0)+16>>2]|0,m|0)|0;q=o;o=0;if(!(q&1)){n=w+8|0;p=w+1|0;c:do{if(r>>>0>>0){j=0;k=0;q=r;while(1){l=a[((a[w>>0]&1)==0?p:c[n>>2]|0)+k>>0]|0;if(l<<24>>24!=0&(j|0)==(l<<24>>24|0)){j=c[h>>2]|0;c[h>>2]=j+4;c[j>>2]=m;j=a[w>>0]|0;l=0;k=(k>>>0<(((j&1)==0?(j&255)>>>1:c[s>>2]|0)+-1|0)>>>0&1)+k|0}else l=j;o=0;j=ra(c[(c[t>>2]|0)+44>>2]|0,t|0,a[q>>0]|0)|0;x=o;o=0;if(x&1)break;x=c[h>>2]|0;c[h>>2]=x+4;c[x>>2]=j;q=q+1|0;if(q>>>0>=e>>>0)break c;else j=l+1|0}j=Na()|0;break a}}while(0);l=b;j=f+(r-l<<2)|0;k=c[h>>2]|0;if((j|0)!=(k|0)){b=k+-4|0;if(j>>>0>>0){do{x=c[j>>2]|0;c[j>>2]=c[b>>2];c[b>>2]=x;j=j+4|0;b=b+-4|0}while(j>>>0>>0);b=l;j=k;u=28}else{b=l;j=k;u=28}}else{b=l;u=28}}else u=5}}while(0);if((u|0)==5)j=Na()|0;else if((u|0)==28){c[g>>2]=(d|0)==(e|0)?j:f+(d-b<<2)|0;Im(w);i=v;return}Im(w);Ya(j|0)}function Kp(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0;n=i;i=i+224|0;h=n+8|0;a=n;q=n+196|0;k=n+32|0;m=n+28|0;l=n+24|0;p=n+20|0;j=n+16|0;r=a;c[r>>2]=37;c[r+4>>2]=0;up(a+1|0,58895,1,c[d+4>>2]|0);r=Xo()|0;s=h;c[s>>2]=f;c[s+4>>2]=g;g=q+(Su(q,22,r,a,h)|0)|0;f=vp(q,g,d)|0;a=jn(d)|0;c[p>>2]=a;o=0;pa(3,q|0,f|0,g|0,k|0,m|0,l|0,p|0);g=o;o=0;if(g&1){s=Na()|0;pm(a)|0;Ya(s|0)}else{pm(a)|0;c[j>>2]=c[b>>2];r=c[m>>2]|0;s=c[l>>2]|0;c[h>>2]=c[j>>2];s=Uu(h,k,r,s,d,e)|0;i=n;return s|0}return 0}function ut(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;u=i;i=i+16|0;s=u;q=u+8|0;a:do{if((e|0)==(f|0))l=f;else{l=e;while(1){if(!(c[l>>2]|0))break a;l=l+4|0;if((l|0)==(f|0)){l=f;break}}}}while(0);c[k>>2]=h;c[g>>2]=e;n=j;r=b+8|0;b:do{if(!((h|0)==(j|0)|(e|0)==(f|0))){b=h;m=l;c:while(1){w=d;h=c[w+4>>2]|0;l=s;c[l>>2]=c[w>>2];c[l+4>>2]=h;l=qk(c[r>>2]|0)|0;o=0;h=sa(21,b|0,g|0,m-e>>2|0,n-b|0,d|0)|0;w=o;o=0;if(w&1){v=9;break}if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){v=8;break}switch(h|0){case 0:{p=1;break b}case-1:{l=b;v=14;break c}default:{}}l=(c[k>>2]|0)+h|0;c[k>>2]=l;if((l|0)==(j|0)){v=27;break}if((m|0)==(f|0)){e=c[g>>2]|0;b=l;l=f}else{l=qk(c[r>>2]|0)|0;o=0;e=ma(34,q|0,0,d|0)|0;w=o;o=0;if(w&1){v=35;break}if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){v=34;break}if((e|0)==-1){p=2;break b}if(e>>>0>(n-(c[k>>2]|0)|0)>>>0){p=1;break b}if(e){l=q;while(1){m=a[l>>0]|0;w=c[k>>2]|0;c[k>>2]=w+1;a[w>>0]=m;e=e+-1|0;if(!e)break;else l=l+1|0}}e=(c[g>>2]|0)+4|0;c[g>>2]=e;d:do{if((e|0)==(f|0))l=f;else{l=e;while(1){if(!(c[l>>2]|0))break d;l=l+4|0;if((l|0)==(f|0)){l=f;break}}}}while(0);b=c[k>>2]|0}if((b|0)==(j|0)|(e|0)==(f|0)){v=47;break b}else m=l}if((v|0)==8){w=Na(0)|0;ec(w)}else if((v|0)==9){e=Na()|0;if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){w=Na(0)|0;ec(w)}Ya(e|0)}else if((v|0)==14){c[k>>2]=l;e:do{if((e|0)!=(c[g>>2]|0)){while(1){w=c[e>>2]|0;b=qk(c[r>>2]|0)|0;o=0;l=ma(34,l|0,w|0,s|0)|0;w=o;o=0;if(w&1){t=b;break}if((b|0)!=0?(o=0,ka(75,b|0)|0,w=o,o=0,w&1):0){v=18;break}if((l|0)==-1)break e;l=(c[k>>2]|0)+l|0;c[k>>2]=l;e=e+4|0;if((e|0)==(c[g>>2]|0))break e}if((v|0)==18){w=Na(0)|0;ec(w)}e=Na()|0;if((t|0)!=0?(o=0,ka(75,t|0)|0,w=o,o=0,w&1):0){w=Na(0)|0;ec(w)}Ya(e|0)}}while(0);c[g>>2]=e;p=2;break}else if((v|0)==27){e=c[g>>2]|0;v=47;break}else if((v|0)==34){w=Na(0)|0;ec(w)}else if((v|0)==35){e=Na()|0;if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){w=Na(0)|0;ec(w)}Ya(e|0)}}else v=47}while(0);if((v|0)==47)p=(e|0)!=(f|0)&1;i=u;return p|0}function vt(b,d,e,f,g,h,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;u=i;i=i+16|0;t=u;a:do{if((e|0)==(f|0))l=f;else{l=e;while(1){if(!(a[l>>0]|0))break a;l=l+1|0;if((l|0)==(f|0)){l=f;break}}}}while(0);c[k>>2]=h;c[g>>2]=e;p=j;r=b+8|0;b:do{if(!((h|0)==(j|0)|(e|0)==(f|0))){b=h;n=l;c:while(1){m=d;l=c[m+4>>2]|0;h=t;c[h>>2]=c[m>>2];c[h+4>>2]=l;h=n;l=qk(c[r>>2]|0)|0;o=0;m=sa(22,b|0,g|0,h-e|0,p-b>>2|0,d|0)|0;w=o;o=0;if(w&1){v=9;break}if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){v=8;break}switch(m|0){case 0:{q=2;break b}case-1:{l=b;v=14;break c}default:{}}b=(c[k>>2]|0)+(m<<2)|0;c[k>>2]=b;if((b|0)==(j|0)){v=31;break}e=c[g>>2]|0;if((n|0)==(f|0))l=f;else{l=qk(c[r>>2]|0)|0;o=0;e=va(20,b|0,e|0,1,d|0)|0;w=o;o=0;if(w&1){v=38;break}if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){v=37;break}if(e){q=2;break b}c[k>>2]=(c[k>>2]|0)+4;e=(c[g>>2]|0)+1|0;c[g>>2]=e;d:do{if((e|0)==(f|0))l=f;else{l=e;while(1){if(!(a[l>>0]|0))break d;l=l+1|0;if((l|0)==(f|0)){l=f;break}}}}while(0);b=c[k>>2]|0}if((b|0)==(j|0)|(e|0)==(f|0)){v=47;break b}else n=l}if((v|0)==8){w=Na(0)|0;ec(w)}else if((v|0)==9){e=Na()|0;if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){w=Na(0)|0;ec(w)}Ya(e|0)}else if((v|0)==14){c[k>>2]=l;e:do{if((e|0)!=(c[g>>2]|0)){b=l;f:while(1){l=qk(c[r>>2]|0)|0;o=0;b=va(20,b|0,e|0,h-e|0,t|0)|0;w=o;o=0;if(w&1){v=19;break}if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){v=18;break}switch(b|0){case-1:{v=25;break f}case-2:{v=26;break f}case 0:{e=e+1|0;break}default:e=e+b|0}b=(c[k>>2]|0)+4|0;c[k>>2]=b;if((e|0)==(c[g>>2]|0)){s=e;break e}}if((v|0)==18){w=Na(0)|0;ec(w)}else if((v|0)==19){e=Na()|0;if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){w=Na(0)|0;ec(w)}Ya(e|0)}else if((v|0)==25){c[g>>2]=e;q=2;break b}else if((v|0)==26){c[g>>2]=e;q=1;break b}}else s=e}while(0);c[g>>2]=s;q=(s|0)!=(f|0)&1;break}else if((v|0)==31){e=c[g>>2]|0;v=47;break}else if((v|0)==37){w=Na(0)|0;ec(w)}else if((v|0)==38){e=Na()|0;if((l|0)!=0?(o=0,ka(75,l|0)|0,w=o,o=0,w&1):0){w=Na(0)|0;ec(w)}Ya(e|0)}}else v=47}while(0);if((v|0)==47)q=(e|0)!=(f|0)&1;i=u;return q|0}function wt(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0;j=i;i=i+16|0;h=j;c[g>>2]=e;e=qk(c[b+8>>2]|0)|0;o=0;b=ma(34,h|0,0,d|0)|0;d=o;o=0;if(d&1){h=Na()|0;if((e|0)!=0?(o=0,ka(75,e|0)|0,j=o,o=0,j&1):0){j=Na(0)|0;ec(j)}Ya(h|0)}if((e|0)!=0?(o=0,ka(75,e|0)|0,d=o,o=0,d&1):0){d=Na(0)|0;ec(d)}switch(b|0){case 0:case-1:{h=2;break}default:{b=b+-1|0;if(b>>>0<=(f-(c[g>>2]|0)|0)>>>0)if(!b)h=0;else while(1){d=a[h>>0]|0;f=c[g>>2]|0;c[g>>2]=f+1;a[f>>0]=d;b=b+-1|0;if(!b){h=0;break}else h=h+1|0}else h=1}}i=j;return h|0}function xt(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=a+8|0;o=0;d=ka(75,c[b>>2]|0)|0;e=o;o=0;do{if(e&1)f=16;else{o=0;e=ma(35,0,0,4)|0;a=o;o=0;if(a&1){a=Na(0)|0;if(!d)break;o=0;ka(75,d|0)|0;h=o;o=0;if(!(h&1))break;h=Na(0)|0;ec(h)}if((d|0)!=0?(o=0,ka(75,d|0)|0,h=o,o=0,h&1):0){h=Na(0)|0;ec(h)}if(!e){a=c[b>>2]|0;if(a){o=0;a=ka(75,a|0)|0;h=o;o=0;if(h&1){f=16;break}if((a|0)!=0?(o=0,ka(75,a|0)|0,h=o,o=0,h&1):0){h=Na(0)|0;ec(h)}else g=0}else g=1}else g=-1;return g|0}}while(0);if((f|0)==16)a=Na(0)|0;ec(a);return 0}function yt(a){a=a|0;return 0}function zt(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;k=e;j=a+8|0;a:do{if((d|0)==(e|0)|(f|0)==0)a=0;else{a=0;i=0;while(1){h=qk(c[j>>2]|0)|0;o=0;g=ma(36,d|0,k-d|0,b|0)|0;n=o;o=0;if(n&1){m=h;break}if((h|0)!=0?(o=0,ka(75,h|0)|0,n=o,o=0,n&1):0){l=5;break}switch(g|0){case-2:case-1:break a;case 0:{d=d+1|0;g=1;break}default:d=d+g|0}a=g+a|0;i=i+1|0;if((d|0)==(e|0)|i>>>0>=f>>>0)break a}if((l|0)==5){n=Na(0)|0;ec(n)}a=Na()|0;if((m|0)!=0?(o=0,ka(75,m|0)|0,n=o,o=0,n&1):0){n=Na(0)|0;ec(n)}Ya(a|0)}}while(0);return a|0}function At(a){a=a|0;var b=0,d=0;a=c[a+8>>2]|0;if(a){o=0;a=ka(75,a|0)|0;d=o;o=0;if(d&1){d=Na(0)|0;ec(d)}if((a|0)!=0?(o=0,ka(75,a|0)|0,d=o,o=0,d&1):0){d=Na(0)|0;ec(d)}else b=4}else b=1;return b|0}function Bt(a){a=a|0;cj(a);return}function Ct(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0;a=i;i=i+16|0;k=a+4|0;b=a;c[k>>2]=d;c[b>>2]=g;h=Hv(d,e,k,g,h,b,1114111,0)|0;c[f>>2]=c[k>>2];c[j>>2]=c[b>>2];i=a;return h|0}function Dt(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0;a=i;i=i+16|0;k=a+4|0;b=a;c[k>>2]=d;c[b>>2]=g;h=Iv(d,e,k,g,h,b,1114111,0)|0;c[f>>2]=c[k>>2];c[j>>2]=c[b>>2];i=a;return h|0}function Et(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;c[f>>2]=d;return 3}function Ft(a){a=a|0;return 0}function Gt(a){a=a|0;return 0}function Ht(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Jv(c,d,e,1114111,0)|0}function It(a){a=a|0;return 4}function Jt(a){a=a|0;cj(a);return}function Kt(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0;a=i;i=i+16|0;k=a+4|0;b=a;c[k>>2]=d;c[b>>2]=g;h=Kv(d,e,k,g,h,b,1114111,0)|0;c[f>>2]=c[k>>2];c[j>>2]=c[b>>2];i=a;return h|0}function Lt(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0;a=i;i=i+16|0;k=a+4|0;b=a;c[k>>2]=d;c[b>>2]=g;h=Lv(d,e,k,g,h,b,1114111,0)|0;c[f>>2]=c[k>>2];c[j>>2]=c[b>>2];i=a;return h|0}function Mt(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;c[f>>2]=d;return 3}function Nt(a){a=a|0;return 0}function Ot(a){a=a|0;return 0}function Pt(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Mv(c,d,e,1114111,0)|0}function Qt(a){a=a|0;return 4}function Rt(a){a=a|0;cj(a);return}function St(a){a=a|0;cj(a);return}function Tt(b,d){b=b|0;d=d|0;c[b+4>>2]=d+-1;c[b>>2]=44384;a[b+8>>0]=46;a[b+9>>0]=44;b=b+12|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;return}function Ut(a,b){a=a|0;b=b|0;c[a+4>>2]=b+-1;c[a>>2]=44424;c[a+8>>2]=46;c[a+12>>2]=44;a=a+16|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;return}function Vt(a){a=a|0;c[a>>2]=44384;Im(a+12|0);return}function Wt(a){a=a|0;Vt(a);cj(a);return}function Xt(a){a=a|0;c[a>>2]=44424;Im(a+16|0);return}function Yt(a){a=a|0;Xt(a);cj(a);return}function Zt(b){b=b|0;return a[b+8>>0]|0}function _t(a){a=a|0;return c[a+8>>2]|0}function $t(b){b=b|0;return a[b+9>>0]|0}function au(a){a=a|0;return c[a+12>>2]|0}function bu(a,b){a=a|0;b=b|0;Fm(a,b+12|0);return}function cu(a,b){a=a|0;b=b|0;Fm(a,b+16|0);return}function du(a,b){a=a|0;b=b|0;Gm(a,59024,4);return}function eu(a,b){a=a|0;b=b|0;Um(a,44996,pl(44996)|0);return}function fu(a,b){a=a|0;b=b|0;Gm(a,59029,5);return}function gu(a,b){a=a|0;b=b|0;Um(a,45016,pl(45016)|0);return}function hu(a){a=a|0;switch(c[a+4>>2]&74|0){case 64:{a=8;break}case 8:{a=16;break}case 0:{a=0;break}default:a=10}return a|0}function iu(b){b=b|0;do{if((a[2464]|0)==0?(Ha(2464)|0)!=0:0){if((a[2472]|0)==0?(Ha(2472)|0)!=0:0){b=45040;do{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;b=b+12|0}while((b|0)!=45208);kb(193,0,n|0)|0;Pa(2472)}o=0;ra(41,45040,59035)|0;b=o;o=0;if(((((((((((((!(b&1)?(o=0,ra(41,45052,59042)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45064,59049)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45076,59057)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45088,59067)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45100,59076)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45112,59083)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45124,59092)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45136,59096)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45148,59100)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45160,59104)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45172,59108)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45184,59112)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45196,59116)|0,b=o,o=0,!(b&1)):0){c[11302]=45040;Pa(2464);break}b=Na()|0;sb(2464);Ya(b|0)}}while(0);return c[11302]|0}function ju(b){b=b|0;do{if((a[2480]|0)==0?(Ha(2480)|0)!=0:0){if((a[2488]|0)==0?(Ha(2488)|0)!=0:0){b=45212;do{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;b=b+12|0}while((b|0)!=45380);kb(194,0,n|0)|0;Pa(2488)}o=0;ra(42,45212,45380)|0;b=o;o=0;if(((((((((((((!(b&1)?(o=0,ra(42,45224,45408)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45236,45436)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45248,45468)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45260,45508)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45272,45544)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45284,45572)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45296,45608)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45308,45624)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45320,45640)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45332,45656)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45344,45672)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45356,45688)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,45368,45704)|0,b=o,o=0,!(b&1)):0){c[11430]=45212;Pa(2480);break}b=Na()|0;sb(2480);Ya(b|0)}}while(0);return c[11430]|0}function ku(b){b=b|0;a:do{if((a[2496]|0)==0?(Ha(2496)|0)!=0:0){if((a[2504]|0)==0?(Ha(2504)|0)!=0:0){b=45724;do{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;b=b+12|0}while((b|0)!=46012);kb(195,0,n|0)|0;Pa(2504)}o=0;ra(41,45724,59120)|0;b=o;o=0;do{if((((((((((((((!(b&1)?(o=0,ra(41,45736,59128)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45748,59137)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45760,59143)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45772,59149)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45784,59153)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45796,59158)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45808,59163)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45820,59170)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45832,59180)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45844,59188)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45856,59197)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45868,59206)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45880,59210)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(41,45892,59214)|0,b=o,o=0,!(b&1)):0){o=0;ra(41,45904,59218)|0;b=o;o=0;if(b&1)break;o=0;ra(41,45916,59149)|0;b=o;o=0;if(b&1)break;o=0;ra(41,45928,59222)|0;b=o;o=0;if(b&1)break;o=0;ra(41,45940,59226)|0;b=o;o=0;if(b&1)break;o=0;ra(41,45952,59230)|0;b=o;o=0;if(b&1)break;o=0;ra(41,45964,59234)|0;b=o;o=0;if(b&1)break;o=0;ra(41,45976,59238)|0;b=o;o=0;if(b&1)break;o=0;ra(41,45988,59242)|0;b=o;o=0;if(b&1)break;o=0;ra(41,46e3,59246)|0;b=o;o=0;if(b&1)break;c[11503]=45724;Pa(2496);break a}}while(0);b=Na()|0;sb(2496);Ya(b|0)}}while(0);return c[11503]|0}function lu(b){b=b|0;a:do{if((a[2512]|0)==0?(Ha(2512)|0)!=0:0){if((a[2520]|0)==0?(Ha(2520)|0)!=0:0){b=46016;do{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;b=b+12|0}while((b|0)!=46304);kb(196,0,n|0)|0;Pa(2520)}o=0;ra(42,46016,46304)|0;b=o;o=0;do{if((((((((((((((!(b&1)?(o=0,ra(42,46028,46336)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46040,46372)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46052,46396)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46064,46420)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46076,46436)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46088,46456)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46100,46476)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46112,46504)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46124,46544)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46136,46576)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46148,46612)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46160,46648)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46172,46664)|0,b=o,o=0,!(b&1)):0)?(o=0,ra(42,46184,46680)|0,b=o,o=0,!(b&1)):0){o=0;ra(42,46196,46696)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46208,46420)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46220,46712)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46232,46728)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46244,46744)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46256,46760)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46268,46776)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46280,46792)|0;b=o;o=0;if(b&1)break;o=0;ra(42,46292,46808)|0;b=o;o=0;if(b&1)break;c[11706]=46016;Pa(2512);break a}}while(0);b=Na()|0;sb(2512);Ya(b|0)}}while(0);return c[11706]|0}function mu(b){b=b|0;do{if((a[2528]|0)==0?(Ha(2528)|0)!=0:0){if((a[2536]|0)==0?(Ha(2536)|0)!=0:0){b=46828;do{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;b=b+12|0}while((b|0)!=47116);kb(197,0,n|0)|0;Pa(2536)}o=0;ra(41,46828,59250)|0;b=o;o=0;if(!(b&1)?(o=0,ra(41,46840,59253)|0,b=o,o=0,!(b&1)):0){c[11779]=46828;Pa(2528);break}b=Na()|0;sb(2528);Ya(b|0)}}while(0);return c[11779]|0}function nu(b){b=b|0;do{if((a[2544]|0)==0?(Ha(2544)|0)!=0:0){if((a[2552]|0)==0?(Ha(2552)|0)!=0:0){b=47120;do{c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;b=b+12|0}while((b|0)!=47408);kb(198,0,n|0)|0;Pa(2552)}o=0;ra(42,47120,47408)|0;b=o;o=0;if(!(b&1)?(o=0,ra(42,47132,47420)|0,b=o,o=0,!(b&1)):0){c[11858]=47120;Pa(2544);break}b=Na()|0;sb(2544);Ya(b|0)}}while(0);return c[11858]|0}function ou(b){b=b|0;do{if((a[2560]|0)==0?(Ha(2560)|0)!=0:0){o=0;wa(5,47436,59256,8);b=o;o=0;if(b&1){b=Na()|0;sb(2560);Ya(b|0)}else{kb(199,47436,n|0)|0;Pa(2560);break}}}while(0);return 47436}function pu(b){b=b|0;var c=0;do{if((a[2568]|0)==0?(Ha(2568)|0)!=0:0){o=0;b=ka(76,47448)|0;c=o;o=0;if(!(c&1)?(o=0,wa(15,47484,47448,b|0),c=o,o=0,!(c&1)):0){kb(200,47484,n|0)|0;Pa(2568);break}c=Na()|0;sb(2568);Ya(c|0)}}while(0);return 47484}function qu(b){b=b|0;do{if((a[2576]|0)==0?(Ha(2576)|0)!=0:0){o=0;wa(5,47496,59265,8);b=o;o=0;if(b&1){b=Na()|0;sb(2576);Ya(b|0)}else{kb(199,47496,n|0)|0;Pa(2576);break}}}while(0);return 47496}function ru(b){b=b|0;var c=0;do{if((a[2584]|0)==0?(Ha(2584)|0)!=0:0){o=0;b=ka(76,47508)|0;c=o;o=0;if(!(c&1)?(o=0,wa(15,47544,47508,b|0),c=o,o=0,!(c&1)):0){kb(200,47544,n|0)|0;Pa(2584);break}c=Na()|0;sb(2584);Ya(c|0)}}while(0);return 47544}function su(b){b=b|0;do{if((a[2592]|0)==0?(Ha(2592)|0)!=0:0){o=0;wa(5,47556,59274,20);b=o;o=0;if(b&1){b=Na()|0;sb(2592);Ya(b|0)}else{kb(199,47556,n|0)|0;Pa(2592);break}}}while(0);return 47556}function tu(b){b=b|0;var c=0;do{if((a[2600]|0)==0?(Ha(2600)|0)!=0:0){o=0;b=ka(76,47568)|0;c=o;o=0;if(!(c&1)?(o=0,wa(15,47652,47568,b|0),c=o,o=0,!(c&1)):0){kb(200,47652,n|0)|0;Pa(2600);break}c=Na()|0;sb(2600);Ya(c|0)}}while(0);return 47652}function uu(b){b=b|0;do{if((a[2608]|0)==0?(Ha(2608)|0)!=0:0){o=0;wa(5,47664,59295,11);b=o;o=0;if(b&1){b=Na()|0;sb(2608);Ya(b|0)}else{kb(199,47664,n|0)|0;Pa(2608);break}}}while(0);return 47664}function vu(b){b=b|0;var c=0;do{if((a[2616]|0)==0?(Ha(2616)|0)!=0:0){o=0;b=ka(76,47676)|0;c=o;o=0;if(!(c&1)?(o=0,wa(15,47724,47676,b|0),c=o,o=0,!(c&1)):0){kb(200,47724,n|0)|0;Pa(2616);break}c=Na()|0;sb(2616);Ya(c|0)}}while(0);return 47724}function wu(a){a=a|0;var b=0,d=0,e=0;c[a>>2]=44304;a=a+8|0;b=c[a>>2]|0;o=0;d=ua(3)|0;e=o;o=0;do{if(!(e&1)){if((b|0)!=(d|0)?(o=0,ha(188,c[a>>2]|0),e=o,o=0,e&1):0)break;return}}while(0);e=Na(0)|0;ec(e)}function xu(b,e,f,g,h,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;z=i;i=i+112|0;m=z;p=(g-f|0)/12|0;do{if(p>>>0>100){m=Fl(p)|0;if((m|0)==0?(o=0,xa(6),y=o,o=0,y&1):0){l=0;s=6;break}l=m;s=11}else{l=0;s=11}}while(0);a:do{if((s|0)==11){if((f|0)==(g|0))n=0;else{s=f;q=0;r=m;while(1){n=a[s>>0]|0;if(!(n&1))n=(n&255)>>>1;else n=c[s+4>>2]|0;if(!n){a[r>>0]=2;n=q+1|0;p=p+-1|0}else{a[r>>0]=1;n=q}s=s+12|0;if((s|0)==(g|0))break;else{q=n;r=r+1|0}}}x=(f|0)==(g|0);y=(f|0)==(g|0);w=0;t=n;b:while(1){n=c[b>>2]|0;do{if(n){if((c[n+12>>2]|0)==(c[n+16>>2]|0)){o=0;n=ka(c[(c[n>>2]|0)+36>>2]|0,n|0)|0;v=o;o=0;if(v&1){s=5;break b}if((n|0)==-1){c[b>>2]=0;n=0;break}else{n=c[b>>2]|0;break}}}else n=0}while(0);s=(n|0)==0;q=c[e>>2]|0;if(q){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){o=0;n=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;v=o;o=0;if(v&1){s=5;break}if((n|0)==-1){c[e>>2]=0;q=0}}}else q=0;r=(q|0)==0;n=c[b>>2]|0;if(!((p|0)!=0&(s^r))){s=64;break}q=c[n+12>>2]|0;if((q|0)==(c[n+16>>2]|0)){o=0;n=ka(c[(c[n>>2]|0)+36>>2]|0,n|0)|0;v=o;o=0;if(v&1){s=5;break}}else n=d[q>>0]|0;n=n&255;if(!k){o=0;n=ra(c[(c[h>>2]|0)+12>>2]|0,h|0,n|0)|0;v=o;o=0;if(v&1){s=5;break}}v=w+1|0;if(x){n=0;s=t}else{r=0;u=f;s=t;t=m;while(1){do{if((a[t>>0]|0)==1){if(!(a[u>>0]&1))q=u+1|0;else q=c[u+8>>2]|0;q=a[q+w>>0]|0;if(!k){o=0;q=ra(c[(c[h>>2]|0)+12>>2]|0,h|0,q|0)|0;A=o;o=0;if(A&1){s=4;break b}}if(n<<24>>24!=q<<24>>24){a[t>>0]=0;q=r;p=p+-1|0;break}q=a[u>>0]|0;if(!(q&1))q=(q&255)>>>1;else q=c[u+4>>2]|0;if((q|0)==(v|0)){a[t>>0]=2;q=1;s=s+1|0;p=p+-1|0}else q=1}else q=r}while(0);u=u+12|0;if((u|0)==(g|0)){n=q;break}else{r=q;t=t+1|0}}}if(!n){w=v;t=s;continue}n=c[b>>2]|0;q=n+12|0;r=c[q>>2]|0;if((r|0)==(c[n+16>>2]|0)){o=0;ka(c[(c[n>>2]|0)+40>>2]|0,n|0)|0;A=o;o=0;if(A&1){s=5;break}}else c[q>>2]=r+1;if((s+p|0)>>>0<2|y){w=v;t=s;continue}else{n=f;r=s;s=m}while(1){if((a[s>>0]|0)==2){q=a[n>>0]|0;if(!(q&1))q=(q&255)>>>1;else q=c[n+4>>2]|0;if((q|0)!=(v|0)){a[s>>0]=0;r=r+-1|0}}n=n+12|0;if((n|0)==(g|0)){w=v;t=r;continue b}else s=s+1|0}}if((s|0)==4){f=Na()|0;break}else if((s|0)==5){f=Na()|0;break}else if((s|0)==64){do{if(n){if((c[n+12>>2]|0)==(c[n+16>>2]|0)){o=0;n=ka(c[(c[n>>2]|0)+36>>2]|0,n|0)|0;A=o;o=0;if(A&1){s=6;break a}if((n|0)==-1){c[b>>2]=0;n=0;break}else{n=c[b>>2]|0;break}}}else n=0}while(0);p=(n|0)==0;do{if(!r){if((c[q+12>>2]|0)==(c[q+16>>2]|0)){o=0;n=ka(c[(c[q>>2]|0)+36>>2]|0,q|0)|0;A=o;o=0;if(A&1){s=6;break a}if((n|0)==-1){c[e>>2]=0;s=76;break}}if(!p)s=77}else s=76}while(0);if((s|0)==76?p:0)s=77;if((s|0)==77)c[j>>2]=c[j>>2]|2;c:do{if((f|0)==(g|0))s=81;else while(1){if((a[m>>0]|0)==2)break c;f=f+12|0;if((f|0)==(g|0)){s=81;break}else m=m+1|0}}while(0);if((s|0)==81){c[j>>2]=c[j>>2]|4;f=g}if(l)Gl(l);i=z;return f|0}}}while(0);if((s|0)==6)f=Na()|0;if(l)Gl(l);Ya(f|0);return 0}function yu(b,e,f,g,h,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;A=i;i=i+240|0;t=A+202|0;k=A+200|0;C=A+24|0;B=A+12|0;v=A+8|0;y=A+40|0;z=A+4|0;w=A;u=hu(g)|0;kp(C,g,t,k);c[B>>2]=0;c[B+4>>2]=0;c[B+8>>2]=0;if(!(a[B>>0]&1))b=10;else b=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,b|0,0);s=o;o=0;a:do{if(!(s&1)){q=B+8|0;r=B+1|0;g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g;c[z>>2]=y;c[w>>2]=0;s=B+4|0;p=a[k>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;n=o;o=0;if(n&1){D=24;break}if((k|0)==-1){c[e>>2]=0;b=0}}}else b=0;l=(b|0)==0;k=c[f>>2]|0;do{if(k){if((c[k+12>>2]|0)!=(c[k+16>>2]|0))if(l)break;else break b;o=0;m=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;n=o;o=0;if(n&1){D=24;break b}if((m|0)!=-1)if(l)break;else break b;else{c[f>>2]=0;D=16;break}}else D=16}while(0);if((D|0)==16){D=0;if(l){k=0;break}else k=0}l=a[B>>0]|0;l=(l&1)==0?(l&255)>>>1:c[s>>2]|0;if((c[v>>2]|0)==(g+l|0)){o=0;wa(8,B|0,l<<1|0,0);n=o;o=0;if(n&1){D=24;break}if(!(a[B>>0]&1))g=10;else g=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,g|0,0);n=o;o=0;if(n&1){D=24;break}g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g+l}m=b+12|0;l=c[m>>2]|0;n=b+16|0;if((l|0)==(c[n>>2]|0)){o=0;l=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=24;break}}else l=d[l>>0]|0;if(Wo(l&255,u,g,v,w,p,C,y,z,t)|0)break;k=c[m>>2]|0;if((k|0)==(c[n>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=24;break}else continue}else{c[m>>2]=k+1;continue}}if((D|0)==24){b=Na()|0;break}E=a[C>>0]|0;if((((E&1)==0?(E&255)>>>1:c[C+4>>2]|0)|0)!=0?(x=c[z>>2]|0,(x-y|0)<160):0){E=c[w>>2]|0;c[z>>2]=x+4;c[x>>2]=E}o=0;g=va(21,g|0,c[v>>2]|0,h|0,u|0)|0;E=o;o=0;if(!(E&1)){c[j>>2]=g;Ur(C,y,c[z>>2]|0,h);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=25;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(k){if((c[k+12>>2]|0)==(c[k+16>>2]|0)){o=0;b=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;E=o;o=0;if(E&1){D=25;break a}if((b|0)==-1){c[f>>2]=0;D=49;break}}if(!g)D=50}else D=49}while(0);if((D|0)==49?g:0)D=50;if((D|0)==50)c[h>>2]=c[h>>2]|2;E=c[e>>2]|0;Im(B);Im(C);i=A;return E|0}else D=25}else D=25}while(0);if((D|0)==25)b=Na()|0;Im(B);Im(C);Ya(b|0);return 0}function zu(b,e,f,g,h,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0;A=i;i=i+240|0;t=A+202|0;k=A+200|0;C=A+24|0;B=A+12|0;v=A+8|0;y=A+40|0;z=A+4|0;w=A;u=hu(g)|0;kp(C,g,t,k);c[B>>2]=0;c[B+4>>2]=0;c[B+8>>2]=0;if(!(a[B>>0]&1))b=10;else b=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,b|0,0);s=o;o=0;a:do{if(!(s&1)){q=B+8|0;r=B+1|0;g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g;c[z>>2]=y;c[w>>2]=0;s=B+4|0;p=a[k>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;n=o;o=0;if(n&1){E=24;break}if((k|0)==-1){c[e>>2]=0;b=0}}}else b=0;k=(b|0)==0;l=c[f>>2]|0;do{if(l){if((c[l+12>>2]|0)!=(c[l+16>>2]|0))if(k)break;else break b;o=0;m=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;n=o;o=0;if(n&1){E=24;break b}if((m|0)!=-1)if(k)break;else break b;else{c[f>>2]=0;E=16;break}}else E=16}while(0);if((E|0)==16){E=0;if(k){l=0;break}else l=0}k=a[B>>0]|0;k=(k&1)==0?(k&255)>>>1:c[s>>2]|0;if((c[v>>2]|0)==(g+k|0)){o=0;wa(8,B|0,k<<1|0,0);n=o;o=0;if(n&1){E=24;break}if(!(a[B>>0]&1))g=10;else g=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,g|0,0);n=o;o=0;if(n&1){E=24;break}g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g+k}m=b+12|0;k=c[m>>2]|0;n=b+16|0;if((k|0)==(c[n>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;F=o;o=0;if(F&1){E=24;break}}else k=d[k>>0]|0;if(Wo(k&255,u,g,v,w,p,C,y,z,t)|0)break;k=c[m>>2]|0;if((k|0)==(c[n>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;F=o;o=0;if(F&1){E=24;break}else continue}else{c[m>>2]=k+1;continue}}if((E|0)==24){b=Na()|0;break}F=a[C>>0]|0;if((((F&1)==0?(F&255)>>>1:c[C+4>>2]|0)|0)!=0?(x=c[z>>2]|0,(x-y|0)<160):0){F=c[w>>2]|0;c[z>>2]=x+4;c[x>>2]=F}o=0;g=va(22,g|0,c[v>>2]|0,h|0,u|0)|0;k=D;F=o;o=0;if(!(F&1)){F=j;c[F>>2]=g;c[F+4>>2]=k;Ur(C,y,c[z>>2]|0,h);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;F=o;o=0;if(F&1){E=25;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(l){if((c[l+12>>2]|0)==(c[l+16>>2]|0)){o=0;b=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;F=o;o=0;if(F&1){E=25;break a}if((b|0)==-1){c[f>>2]=0;E=49;break}}if(!g)E=50}else E=49}while(0);if((E|0)==49?g:0)E=50;if((E|0)==50)c[h>>2]=c[h>>2]|2;F=c[e>>2]|0;Im(B);Im(C);i=A;return F|0}else E=25}else E=25}while(0);if((E|0)==25)b=Na()|0;Im(B);Im(C);Ya(b|0);return 0}function Au(e,f,g,h,j,k){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;B=i;i=i+240|0;u=B+202|0;l=B+200|0;D=B+24|0;C=B+12|0;w=B+8|0;z=B+40|0;A=B+4|0;x=B;v=hu(h)|0;kp(D,h,u,l);c[C>>2]=0;c[C+4>>2]=0;c[C+8>>2]=0;if(!(a[C>>0]&1))e=10;else e=(c[C>>2]&-2)+-1|0;o=0;wa(8,C|0,e|0,0);t=o;o=0;a:do{if(!(t&1)){r=C+8|0;s=C+1|0;h=(a[C>>0]&1)==0?s:c[r>>2]|0;c[w>>2]=h;c[A>>2]=z;c[x>>2]=0;t=C+4|0;q=a[l>>0]|0;e=c[f>>2]|0;b:while(1){if(e){if((c[e+12>>2]|0)==(c[e+16>>2]|0)){o=0;l=ka(c[(c[e>>2]|0)+36>>2]|0,e|0)|0;p=o;o=0;if(p&1){E=24;break}if((l|0)==-1){c[f>>2]=0;e=0}}}else e=0;m=(e|0)==0;l=c[g>>2]|0;do{if(l){if((c[l+12>>2]|0)!=(c[l+16>>2]|0))if(m)break;else break b;o=0;n=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;p=o;o=0;if(p&1){E=24;break b}if((n|0)!=-1)if(m)break;else break b;else{c[g>>2]=0;E=16;break}}else E=16}while(0);if((E|0)==16){E=0;if(m){l=0;break}else l=0}m=a[C>>0]|0;m=(m&1)==0?(m&255)>>>1:c[t>>2]|0;if((c[w>>2]|0)==(h+m|0)){o=0;wa(8,C|0,m<<1|0,0);p=o;o=0;if(p&1){E=24;break}if(!(a[C>>0]&1))h=10;else h=(c[C>>2]&-2)+-1|0;o=0;wa(8,C|0,h|0,0);p=o;o=0;if(p&1){E=24;break}h=(a[C>>0]&1)==0?s:c[r>>2]|0;c[w>>2]=h+m}n=e+12|0;m=c[n>>2]|0;p=e+16|0;if((m|0)==(c[p>>2]|0)){o=0;m=ka(c[(c[e>>2]|0)+36>>2]|0,e|0)|0;F=o;o=0;if(F&1){E=24;break}}else m=d[m>>0]|0;if(Wo(m&255,v,h,w,x,q,D,z,A,u)|0)break;l=c[n>>2]|0;if((l|0)==(c[p>>2]|0)){o=0;ka(c[(c[e>>2]|0)+40>>2]|0,e|0)|0;F=o;o=0;if(F&1){E=24;break}else continue}else{c[n>>2]=l+1;continue}}if((E|0)==24){e=Na()|0;break}F=a[D>>0]|0;if((((F&1)==0?(F&255)>>>1:c[D+4>>2]|0)|0)!=0?(y=c[A>>2]|0,(y-z|0)<160):0){F=c[x>>2]|0;c[A>>2]=y+4;c[y>>2]=F}o=0;h=va(23,h|0,c[w>>2]|0,j|0,v|0)|0;F=o;o=0;if(!(F&1)){b[k>>1]=h;Ur(D,z,c[A>>2]|0,j);if(e){if((c[e+12>>2]|0)==(c[e+16>>2]|0)){o=0;h=ka(c[(c[e>>2]|0)+36>>2]|0,e|0)|0;F=o;o=0;if(F&1){E=25;break}if((h|0)==-1){c[f>>2]=0;e=0}}}else e=0;h=(e|0)==0;do{if(l){if((c[l+12>>2]|0)==(c[l+16>>2]|0)){o=0;e=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;F=o;o=0;if(F&1){E=25;break a}if((e|0)==-1){c[g>>2]=0;E=49;break}}if(!h)E=50}else E=49}while(0);if((E|0)==49?h:0)E=50;if((E|0)==50)c[j>>2]=c[j>>2]|2;F=c[f>>2]|0;Im(C);Im(D);i=B;return F|0}else E=25}else E=25}while(0);if((E|0)==25)e=Na()|0;Im(C);Im(D);Ya(e|0);return 0}function Bu(b,e,f,g,h,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;A=i;i=i+240|0;t=A+202|0;k=A+200|0;C=A+24|0;B=A+12|0;v=A+8|0;y=A+40|0;z=A+4|0;w=A;u=hu(g)|0;kp(C,g,t,k);c[B>>2]=0;c[B+4>>2]=0;c[B+8>>2]=0;if(!(a[B>>0]&1))b=10;else b=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,b|0,0);s=o;o=0;a:do{if(!(s&1)){q=B+8|0;r=B+1|0;g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g;c[z>>2]=y;c[w>>2]=0;s=B+4|0;p=a[k>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;n=o;o=0;if(n&1){D=24;break}if((k|0)==-1){c[e>>2]=0;b=0}}}else b=0;l=(b|0)==0;k=c[f>>2]|0;do{if(k){if((c[k+12>>2]|0)!=(c[k+16>>2]|0))if(l)break;else break b;o=0;m=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;n=o;o=0;if(n&1){D=24;break b}if((m|0)!=-1)if(l)break;else break b;else{c[f>>2]=0;D=16;break}}else D=16}while(0);if((D|0)==16){D=0;if(l){k=0;break}else k=0}l=a[B>>0]|0;l=(l&1)==0?(l&255)>>>1:c[s>>2]|0;if((c[v>>2]|0)==(g+l|0)){o=0;wa(8,B|0,l<<1|0,0);n=o;o=0;if(n&1){D=24;break}if(!(a[B>>0]&1))g=10;else g=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,g|0,0);n=o;o=0;if(n&1){D=24;break}g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g+l}m=b+12|0;l=c[m>>2]|0;n=b+16|0;if((l|0)==(c[n>>2]|0)){o=0;l=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=24;break}}else l=d[l>>0]|0;if(Wo(l&255,u,g,v,w,p,C,y,z,t)|0)break;k=c[m>>2]|0;if((k|0)==(c[n>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=24;break}else continue}else{c[m>>2]=k+1;continue}}if((D|0)==24){b=Na()|0;break}E=a[C>>0]|0;if((((E&1)==0?(E&255)>>>1:c[C+4>>2]|0)|0)!=0?(x=c[z>>2]|0,(x-y|0)<160):0){E=c[w>>2]|0;c[z>>2]=x+4;c[x>>2]=E}o=0;g=va(24,g|0,c[v>>2]|0,h|0,u|0)|0;E=o;o=0;if(!(E&1)){c[j>>2]=g;Ur(C,y,c[z>>2]|0,h);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=25;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(k){if((c[k+12>>2]|0)==(c[k+16>>2]|0)){o=0;b=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;E=o;o=0;if(E&1){D=25;break a}if((b|0)==-1){c[f>>2]=0;D=49;break}}if(!g)D=50}else D=49}while(0);if((D|0)==49?g:0)D=50;if((D|0)==50)c[h>>2]=c[h>>2]|2;E=c[e>>2]|0;Im(B);Im(C);i=A;return E|0}else D=25}else D=25}while(0);if((D|0)==25)b=Na()|0;Im(B);Im(C);Ya(b|0);return 0}function Cu(b,e,f,g,h,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;A=i;i=i+240|0;t=A+202|0;k=A+200|0;C=A+24|0;B=A+12|0;v=A+8|0;y=A+40|0;z=A+4|0;w=A;u=hu(g)|0;kp(C,g,t,k);c[B>>2]=0;c[B+4>>2]=0;c[B+8>>2]=0;if(!(a[B>>0]&1))b=10;else b=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,b|0,0);s=o;o=0;a:do{if(!(s&1)){q=B+8|0;r=B+1|0;g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g;c[z>>2]=y;c[w>>2]=0;s=B+4|0;p=a[k>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;n=o;o=0;if(n&1){D=24;break}if((k|0)==-1){c[e>>2]=0;b=0}}}else b=0;l=(b|0)==0;k=c[f>>2]|0;do{if(k){if((c[k+12>>2]|0)!=(c[k+16>>2]|0))if(l)break;else break b;o=0;m=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;n=o;o=0;if(n&1){D=24;break b}if((m|0)!=-1)if(l)break;else break b;else{c[f>>2]=0;D=16;break}}else D=16}while(0);if((D|0)==16){D=0;if(l){k=0;break}else k=0}l=a[B>>0]|0;l=(l&1)==0?(l&255)>>>1:c[s>>2]|0;if((c[v>>2]|0)==(g+l|0)){o=0;wa(8,B|0,l<<1|0,0);n=o;o=0;if(n&1){D=24;break}if(!(a[B>>0]&1))g=10;else g=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,g|0,0);n=o;o=0;if(n&1){D=24;break}g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g+l}m=b+12|0;l=c[m>>2]|0;n=b+16|0;if((l|0)==(c[n>>2]|0)){o=0;l=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=24;break}}else l=d[l>>0]|0;if(Wo(l&255,u,g,v,w,p,C,y,z,t)|0)break;k=c[m>>2]|0;if((k|0)==(c[n>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=24;break}else continue}else{c[m>>2]=k+1;continue}}if((D|0)==24){b=Na()|0;break}E=a[C>>0]|0;if((((E&1)==0?(E&255)>>>1:c[C+4>>2]|0)|0)!=0?(x=c[z>>2]|0,(x-y|0)<160):0){E=c[w>>2]|0;c[z>>2]=x+4;c[x>>2]=E}o=0;g=va(25,g|0,c[v>>2]|0,h|0,u|0)|0;E=o;o=0;if(!(E&1)){c[j>>2]=g;Ur(C,y,c[z>>2]|0,h);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;E=o;o=0;if(E&1){D=25;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(k){if((c[k+12>>2]|0)==(c[k+16>>2]|0)){o=0;b=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;E=o;o=0;if(E&1){D=25;break a}if((b|0)==-1){c[f>>2]=0;D=49;break}}if(!g)D=50}else D=49}while(0);if((D|0)==49?g:0)D=50;if((D|0)==50)c[h>>2]=c[h>>2]|2;E=c[e>>2]|0;Im(B);Im(C);i=A;return E|0}else D=25}else D=25}while(0);if((D|0)==25)b=Na()|0;Im(B);Im(C);Ya(b|0);return 0}function Du(b,e,f,g,h,j){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0;A=i;i=i+240|0;t=A+202|0;k=A+200|0;C=A+24|0;B=A+12|0;v=A+8|0;y=A+40|0;z=A+4|0;w=A;u=hu(g)|0;kp(C,g,t,k);c[B>>2]=0;c[B+4>>2]=0;c[B+8>>2]=0;if(!(a[B>>0]&1))b=10;else b=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,b|0,0);s=o;o=0;a:do{if(!(s&1)){q=B+8|0;r=B+1|0;g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g;c[z>>2]=y;c[w>>2]=0;s=B+4|0;p=a[k>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;n=o;o=0;if(n&1){E=24;break}if((k|0)==-1){c[e>>2]=0;b=0}}}else b=0;k=(b|0)==0;l=c[f>>2]|0;do{if(l){if((c[l+12>>2]|0)!=(c[l+16>>2]|0))if(k)break;else break b;o=0;m=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;n=o;o=0;if(n&1){E=24;break b}if((m|0)!=-1)if(k)break;else break b;else{c[f>>2]=0;E=16;break}}else E=16}while(0);if((E|0)==16){E=0;if(k){l=0;break}else l=0}k=a[B>>0]|0;k=(k&1)==0?(k&255)>>>1:c[s>>2]|0;if((c[v>>2]|0)==(g+k|0)){o=0;wa(8,B|0,k<<1|0,0);n=o;o=0;if(n&1){E=24;break}if(!(a[B>>0]&1))g=10;else g=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,g|0,0);n=o;o=0;if(n&1){E=24;break}g=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=g+k}m=b+12|0;k=c[m>>2]|0;n=b+16|0;if((k|0)==(c[n>>2]|0)){o=0;k=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;F=o;o=0;if(F&1){E=24;break}}else k=d[k>>0]|0;if(Wo(k&255,u,g,v,w,p,C,y,z,t)|0)break;k=c[m>>2]|0;if((k|0)==(c[n>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;F=o;o=0;if(F&1){E=24;break}else continue}else{c[m>>2]=k+1;continue}}if((E|0)==24){b=Na()|0;break}F=a[C>>0]|0;if((((F&1)==0?(F&255)>>>1:c[C+4>>2]|0)|0)!=0?(x=c[z>>2]|0,(x-y|0)<160):0){F=c[w>>2]|0;c[z>>2]=x+4;c[x>>2]=F}o=0;g=va(26,g|0,c[v>>2]|0,h|0,u|0)|0;k=D;F=o;o=0;if(!(F&1)){F=j;c[F>>2]=g;c[F+4>>2]=k;Ur(C,y,c[z>>2]|0,h);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;F=o;o=0;if(F&1){E=25;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(l){if((c[l+12>>2]|0)==(c[l+16>>2]|0)){o=0;b=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;F=o;o=0;if(F&1){E=25;break a}if((b|0)==-1){c[f>>2]=0;E=49;break}}if(!g)E=50}else E=49}while(0);if((E|0)==49?g:0)E=50;if((E|0)==50)c[h>>2]=c[h>>2]|2;F=c[e>>2]|0;Im(B);Im(C);i=A;return F|0}else E=25}else E=25}while(0);if((E|0)==25)b=Na()|0;Im(B);Im(C);Ya(b|0);return 0}function Eu(b,e,f,h,j,k){b=b|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0.0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;E=i;i=i+240|0;w=E+208|0;m=E+203|0;n=E+202|0;G=E+24|0;F=E+12|0;y=E+8|0;C=E+40|0;D=E+4|0;z=E;A=E+201|0;x=E+200|0;lp(G,h,w,m,n);c[F>>2]=0;c[F+4>>2]=0;c[F+8>>2]=0;if(!(a[F>>0]&1))b=10;else b=(c[F>>2]&-2)+-1|0;o=0;wa(8,F|0,b|0,0);v=o;o=0;a:do{if(!(v&1)){t=F+8|0;u=F+1|0;h=(a[F>>0]&1)==0?u:c[t>>2]|0;c[y>>2]=h;c[D>>2]=C;c[z>>2]=0;a[A>>0]=1;a[x>>0]=69;v=F+4|0;s=a[m>>0]|0;r=a[n>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;m=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;q=o;o=0;if(q&1){H=24;break}if((m|0)==-1){c[e>>2]=0;b=0}}}else b=0;n=(b|0)==0;m=c[f>>2]|0;do{if(m){if((c[m+12>>2]|0)!=(c[m+16>>2]|0))if(n)break;else break b;o=0;p=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;q=o;o=0;if(q&1){H=24;break b}if((p|0)!=-1)if(n)break;else break b;else{c[f>>2]=0;H=16;break}}else H=16}while(0);if((H|0)==16){H=0;if(n){m=0;break}else m=0}n=a[F>>0]|0;n=(n&1)==0?(n&255)>>>1:c[v>>2]|0;if((c[y>>2]|0)==(h+n|0)){o=0;wa(8,F|0,n<<1|0,0);q=o;o=0;if(q&1){H=24;break}if(!(a[F>>0]&1))h=10;else h=(c[F>>2]&-2)+-1|0;o=0;wa(8,F|0,h|0,0);q=o;o=0;if(q&1){H=24;break}h=(a[F>>0]&1)==0?u:c[t>>2]|0;c[y>>2]=h+n}p=b+12|0;n=c[p>>2]|0;q=b+16|0;if((n|0)==(c[q>>2]|0)){o=0;n=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=24;break}}else n=d[n>>0]|0;if(mp(n&255,A,x,h,y,s,r,G,C,D,z,w)|0)break;m=c[p>>2]|0;if((m|0)==(c[q>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=24;break}else continue}else{c[p>>2]=m+1;continue}}if((H|0)==24){b=Na()|0;break}I=a[G>>0]|0;if(!((a[A>>0]|0)==0?1:(((I&1)==0?(I&255)>>>1:c[G+4>>2]|0)|0)==0)?(B=c[D>>2]|0,(B-C|0)<160):0){I=c[z>>2]|0;c[D>>2]=B+4;c[B>>2]=I}o=0;l=+ta(1,h|0,c[y>>2]|0,j|0);I=o;o=0;if(!(I&1)){g[k>>2]=l;Ur(G,C,c[D>>2]|0,j);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;h=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=25;break}if((h|0)==-1){c[e>>2]=0;b=0}}}else b=0;h=(b|0)==0;do{if(m){if((c[m+12>>2]|0)==(c[m+16>>2]|0)){o=0;b=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;I=o;o=0;if(I&1){H=25;break a}if((b|0)==-1){c[f>>2]=0;H=49;break}}if(!h)H=50}else H=49}while(0);if((H|0)==49?h:0)H=50;if((H|0)==50)c[j>>2]=c[j>>2]|2;I=c[e>>2]|0;Im(F);Im(G);i=E;return I|0}else H=25}else H=25}while(0);if((H|0)==25)b=Na()|0;Im(F);Im(G);Ya(b|0);return 0}function Fu(b,e,f,g,j,k){b=b|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;var l=0.0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;E=i;i=i+240|0;w=E+208|0;m=E+203|0;n=E+202|0;G=E+24|0;F=E+12|0;y=E+8|0;C=E+40|0;D=E+4|0;z=E;A=E+201|0;x=E+200|0;lp(G,g,w,m,n);c[F>>2]=0;c[F+4>>2]=0;c[F+8>>2]=0;if(!(a[F>>0]&1))b=10;else b=(c[F>>2]&-2)+-1|0;o=0;wa(8,F|0,b|0,0);v=o;o=0;a:do{if(!(v&1)){t=F+8|0;u=F+1|0;g=(a[F>>0]&1)==0?u:c[t>>2]|0;c[y>>2]=g;c[D>>2]=C;c[z>>2]=0;a[A>>0]=1;a[x>>0]=69;v=F+4|0;s=a[m>>0]|0;r=a[n>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;m=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;q=o;o=0;if(q&1){H=24;break}if((m|0)==-1){c[e>>2]=0;b=0}}}else b=0;n=(b|0)==0;m=c[f>>2]|0;do{if(m){if((c[m+12>>2]|0)!=(c[m+16>>2]|0))if(n)break;else break b;o=0;p=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;q=o;o=0;if(q&1){H=24;break b}if((p|0)!=-1)if(n)break;else break b;else{c[f>>2]=0;H=16;break}}else H=16}while(0);if((H|0)==16){H=0;if(n){m=0;break}else m=0}n=a[F>>0]|0;n=(n&1)==0?(n&255)>>>1:c[v>>2]|0;if((c[y>>2]|0)==(g+n|0)){o=0;wa(8,F|0,n<<1|0,0);q=o;o=0;if(q&1){H=24;break}if(!(a[F>>0]&1))g=10;else g=(c[F>>2]&-2)+-1|0;o=0;wa(8,F|0,g|0,0);q=o;o=0;if(q&1){H=24;break}g=(a[F>>0]&1)==0?u:c[t>>2]|0;c[y>>2]=g+n}p=b+12|0;n=c[p>>2]|0;q=b+16|0;if((n|0)==(c[q>>2]|0)){o=0;n=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=24;break}}else n=d[n>>0]|0;if(mp(n&255,A,x,g,y,s,r,G,C,D,z,w)|0)break;m=c[p>>2]|0;if((m|0)==(c[q>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=24;break}else continue}else{c[p>>2]=m+1;continue}}if((H|0)==24){b=Na()|0;break}I=a[G>>0]|0;if(!((a[A>>0]|0)==0?1:(((I&1)==0?(I&255)>>>1:c[G+4>>2]|0)|0)==0)?(B=c[D>>2]|0,(B-C|0)<160):0){I=c[z>>2]|0;c[D>>2]=B+4;c[B>>2]=I}o=0;l=+ta(2,g|0,c[y>>2]|0,j|0);I=o;o=0;if(!(I&1)){h[k>>3]=l;Ur(G,C,c[D>>2]|0,j);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=25;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(m){if((c[m+12>>2]|0)==(c[m+16>>2]|0)){o=0;b=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;I=o;o=0;if(I&1){H=25;break a}if((b|0)==-1){c[f>>2]=0;H=49;break}}if(!g)H=50}else H=49}while(0);if((H|0)==49?g:0)H=50;if((H|0)==50)c[j>>2]=c[j>>2]|2;I=c[e>>2]|0;Im(F);Im(G);i=E;return I|0}else H=25}else H=25}while(0);if((H|0)==25)b=Na()|0;Im(F);Im(G);Ya(b|0);return 0}function Gu(b,e,f,g,j,k){b=b|0;e=e|0;f=f|0;g=g|0;j=j|0;k=k|0;var l=0.0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;E=i;i=i+240|0;w=E+208|0;m=E+203|0;n=E+202|0;G=E+24|0;F=E+12|0;y=E+8|0;C=E+40|0;D=E+4|0;z=E;A=E+201|0;x=E+200|0;lp(G,g,w,m,n);c[F>>2]=0;c[F+4>>2]=0;c[F+8>>2]=0;if(!(a[F>>0]&1))b=10;else b=(c[F>>2]&-2)+-1|0;o=0;wa(8,F|0,b|0,0);v=o;o=0;a:do{if(!(v&1)){t=F+8|0;u=F+1|0;g=(a[F>>0]&1)==0?u:c[t>>2]|0;c[y>>2]=g;c[D>>2]=C;c[z>>2]=0;a[A>>0]=1;a[x>>0]=69;v=F+4|0;s=a[m>>0]|0;r=a[n>>0]|0;b=c[e>>2]|0;b:while(1){if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;m=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;q=o;o=0;if(q&1){H=24;break}if((m|0)==-1){c[e>>2]=0;b=0}}}else b=0;n=(b|0)==0;m=c[f>>2]|0;do{if(m){if((c[m+12>>2]|0)!=(c[m+16>>2]|0))if(n)break;else break b;o=0;p=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;q=o;o=0;if(q&1){H=24;break b}if((p|0)!=-1)if(n)break;else break b;else{c[f>>2]=0;H=16;break}}else H=16}while(0);if((H|0)==16){H=0;if(n){m=0;break}else m=0}n=a[F>>0]|0;n=(n&1)==0?(n&255)>>>1:c[v>>2]|0;if((c[y>>2]|0)==(g+n|0)){o=0;wa(8,F|0,n<<1|0,0);q=o;o=0;if(q&1){H=24;break}if(!(a[F>>0]&1))g=10;else g=(c[F>>2]&-2)+-1|0;o=0;wa(8,F|0,g|0,0);q=o;o=0;if(q&1){H=24;break}g=(a[F>>0]&1)==0?u:c[t>>2]|0;c[y>>2]=g+n}p=b+12|0;n=c[p>>2]|0;q=b+16|0;if((n|0)==(c[q>>2]|0)){o=0;n=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=24;break}}else n=d[n>>0]|0;if(mp(n&255,A,x,g,y,s,r,G,C,D,z,w)|0)break;m=c[p>>2]|0;if((m|0)==(c[q>>2]|0)){o=0;ka(c[(c[b>>2]|0)+40>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=24;break}else continue}else{c[p>>2]=m+1;continue}}if((H|0)==24){b=Na()|0;break}I=a[G>>0]|0;if(!((a[A>>0]|0)==0?1:(((I&1)==0?(I&255)>>>1:c[G+4>>2]|0)|0)==0)?(B=c[D>>2]|0,(B-C|0)<160):0){I=c[z>>2]|0;c[D>>2]=B+4;c[B>>2]=I}o=0;l=+ta(3,g|0,c[y>>2]|0,j|0);I=o;o=0;if(!(I&1)){h[k>>3]=l;Ur(G,C,c[D>>2]|0,j);if(b){if((c[b+12>>2]|0)==(c[b+16>>2]|0)){o=0;g=ka(c[(c[b>>2]|0)+36>>2]|0,b|0)|0;I=o;o=0;if(I&1){H=25;break}if((g|0)==-1){c[e>>2]=0;b=0}}}else b=0;g=(b|0)==0;do{if(m){if((c[m+12>>2]|0)==(c[m+16>>2]|0)){o=0;b=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;I=o;o=0;if(I&1){H=25;break a}if((b|0)==-1){c[f>>2]=0;H=49;break}}if(!g)H=50}else H=49}while(0);if((H|0)==49?g:0)H=50;if((H|0)==50)c[j>>2]=c[j>>2]|2;I=c[e>>2]|0;Im(F);Im(G);i=E;return I|0}else H=25}else H=25}while(0);if((H|0)==25)b=Na()|0;Im(F);Im(G);Ya(b|0);return 0}function Hu(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=i;i=i+16|0;g=f;c[g>>2]=e;e=qk(b)|0;b=fl(a,d,g)|0;if((e|0)!=0?(o=0,ka(75,e|0)|0,g=o,o=0,g&1):0){g=Na(0)|0;ec(g)}i=f;return b|0}function Iu(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;y=i;i=i+112|0;l=y;n=(f-e|0)/12|0;do{if(n>>>0>100){l=Fl(n)|0;if((l|0)==0?(o=0,xa(6),x=o,o=0,x&1):0){k=0;q=6;break}k=l;q=11}else{k=0;q=11}}while(0);a:do{if((q|0)==11){if((e|0)==(f|0))m=0;else{r=e;p=0;q=l;while(1){m=a[r>>0]|0;if(!(m&1))m=(m&255)>>>1;else m=c[r+4>>2]|0;if(!m){a[q>>0]=2;m=p+1|0;n=n+-1|0}else{a[q>>0]=1;m=p}r=r+12|0;if((r|0)==(f|0))break;else{p=m;q=q+1|0}}}w=(e|0)==(f|0);x=(e|0)==(f|0);v=0;s=n;b:while(1){n=c[b>>2]|0;do{if(n){p=c[n+12>>2]|0;if((p|0)==(c[n+16>>2]|0)){o=0;n=ka(c[(c[n>>2]|0)+36>>2]|0,n|0)|0;u=o;o=0;if(u&1){q=5;break b}}else n=c[p>>2]|0;if((n|0)==-1){c[b>>2]=0;r=1;break}else{r=(c[b>>2]|0)==0;break}}else r=1}while(0);p=c[d>>2]|0;if(p){n=c[p+12>>2]|0;if((n|0)==(c[p+16>>2]|0)){o=0;n=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;u=o;o=0;if(u&1){q=5;break}}else n=c[n>>2]|0;if((n|0)==-1){c[d>>2]=0;p=0;q=1}else q=0}else{p=0;q=1}n=c[b>>2]|0;if(!((s|0)!=0&(r^q))){q=66;break}p=c[n+12>>2]|0;if((p|0)==(c[n+16>>2]|0)){o=0;n=ka(c[(c[n>>2]|0)+36>>2]|0,n|0)|0;u=o;o=0;if(u&1){q=5;break}}else n=c[p>>2]|0;if(!j){o=0;n=ra(c[(c[g>>2]|0)+28>>2]|0,g|0,n|0)|0;u=o;o=0;if(u&1){q=5;break}}u=v+1|0;if(w){n=0;r=s}else{r=0;t=e;q=s;s=l;while(1){do{if((a[s>>0]|0)==1){if(!(a[t>>0]&1))p=t+4|0;else p=c[t+8>>2]|0;p=c[p+(v<<2)>>2]|0;if(!j){o=0;p=ra(c[(c[g>>2]|0)+28>>2]|0,g|0,p|0)|0;z=o;o=0;if(z&1){q=4;break b}}if((n|0)!=(p|0)){a[s>>0]=0;p=r;q=q+-1|0;break}p=a[t>>0]|0;if(!(p&1))p=(p&255)>>>1;else p=c[t+4>>2]|0;if((p|0)==(u|0)){a[s>>0]=2;p=1;m=m+1|0;q=q+-1|0}else p=1}else p=r}while(0);t=t+12|0;if((t|0)==(f|0)){n=p;r=q;break}else{r=p;s=s+1|0}}}if(!n){v=u;s=r;continue}n=c[b>>2]|0;p=n+12|0;q=c[p>>2]|0;if((q|0)==(c[n+16>>2]|0)){o=0;ka(c[(c[n>>2]|0)+40>>2]|0,n|0)|0;z=o;o=0;if(z&1){q=5;break}}else c[p>>2]=q+4;if((m+r|0)>>>0<2|x){v=u;s=r;continue}else{n=e;q=l}while(1){if((a[q>>0]|0)==2){p=a[n>>0]|0;if(!(p&1))p=(p&255)>>>1;else p=c[n+4>>2]|0;if((p|0)!=(u|0)){a[q>>0]=0;m=m+-1|0}}n=n+12|0;if((n|0)==(f|0)){v=u;s=r;continue b}else q=q+1|0}}if((q|0)==4){e=Na()|0;break}else if((q|0)==5){e=Na()|0;break}else if((q|0)==66){do{if(n){m=c[n+12>>2]|0;if((m|0)==(c[n+16>>2]|0)){o=0;m=ka(c[(c[n>>2]|0)+36>>2]|0,n|0)|0;z=o;o=0;if(z&1){q=6;break a}}else m=c[m>>2]|0;if((m|0)==-1){c[b>>2]=0;n=1;break}else{n=(c[b>>2]|0)==0;break}}else n=1}while(0);do{if(p){m=c[p+12>>2]|0;if((m|0)==(c[p+16>>2]|0)){o=0;m=ka(c[(c[p>>2]|0)+36>>2]|0,p|0)|0;z=o;o=0;if(z&1){q=6;break a}}else m=c[m>>2]|0;if((m|0)!=-1)if(n)break;else{q=81;break}else{c[d>>2]=0;q=79;break}}else q=79}while(0);if((q|0)==79?n:0)q=81;if((q|0)==81)c[h>>2]=c[h>>2]|2;c:do{if((e|0)==(f|0))q=85;else while(1){if((a[l>>0]|0)==2)break c;e=e+12|0;if((e|0)==(f|0)){q=85;break}else l=l+1|0}}while(0);if((q|0)==85){c[h>>2]=c[h>>2]|4;e=f}if(k)Gl(k);i=y;return e|0}}}while(0);if((q|0)==6)e=Na()|0;if(k)Gl(k);Ya(e|0);return 0}function Ju(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;z=i;i=i+320|0;s=z+208|0;j=z+200|0;B=z+24|0;A=z+12|0;u=z+8|0;x=z+40|0;y=z+4|0;v=z;t=hu(f)|0;np(B,f,s,j);c[A>>2]=0;c[A+4>>2]=0;c[A+8>>2]=0;if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);r=o;o=0;a:do{if(!(r&1)){p=A+8|0;q=A+1|0;b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b;c[y>>2]=x;c[v>>2]=0;r=A+4|0;n=c[j>>2]|0;j=c[d>>2]|0;b:while(1){if(j){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;m=o;o=0;if(m&1){C=25;break}}else f=c[f>>2]|0;if((f|0)==-1){c[d>>2]=0;f=0;k=1}else{f=j;k=0}}else{f=0;k=1}l=c[e>>2]|0;do{if(l){j=c[l+12>>2]|0;if((j|0)==(c[l+16>>2]|0)){o=0;j=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;m=o;o=0;if(m&1){C=25;break b}}else j=c[j>>2]|0;if((j|0)!=-1)if(k)break;else{j=l;break b}else{c[e>>2]=0;C=17;break}}else C=17}while(0);if((C|0)==17){C=0;if(k){j=0;break}else l=0}j=a[A>>0]|0;j=(j&1)==0?(j&255)>>>1:c[r>>2]|0;if((c[u>>2]|0)==(b+j|0)){o=0;wa(8,A|0,j<<1|0,0);m=o;o=0;if(m&1){C=25;break}if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);m=o;o=0;if(m&1){C=25;break}b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b+j}k=f+12|0;j=c[k>>2]|0;m=f+16|0;if((j|0)==(c[m>>2]|0)){o=0;j=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=25;break}}else j=c[j>>2]|0;if(jp(j,t,b,u,v,n,B,x,y,s)|0){j=l;break}j=c[k>>2]|0;if((j|0)==(c[m>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=25;break}else{j=f;continue}}else{c[k>>2]=j+4;j=f;continue}}if((C|0)==25){b=Na()|0;break}D=a[B>>0]|0;if((((D&1)==0?(D&255)>>>1:c[B+4>>2]|0)|0)!=0?(w=c[y>>2]|0,(w-x|0)<160):0){D=c[v>>2]|0;c[y>>2]=w+4;c[w>>2]=D}o=0;b=va(21,b|0,c[u>>2]|0,g|0,t|0)|0;D=o;o=0;if(!(D&1)){c[h>>2]=b;Ur(B,x,c[y>>2]|0,g);if(f){b=c[f+12>>2]|0;if((b|0)==(c[f+16>>2]|0)){o=0;b=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(j){b=c[j+12>>2]|0;if((b|0)==(c[j+16>>2]|0)){o=0;b=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;D=o;o=0;if(D&1){C=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{C=53;break}else{c[e>>2]=0;C=51;break}}else C=51}while(0);if((C|0)==51?f:0)C=53;if((C|0)==53)c[g>>2]=c[g>>2]|2;D=c[d>>2]|0;Im(A);Im(B);i=z;return D|0}else C=26}else C=26}while(0);if((C|0)==26)b=Na()|0;Im(A);Im(B);Ya(b|0);return 0}function Ku(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0;z=i;i=i+320|0;s=z+208|0;j=z+200|0;B=z+24|0;A=z+12|0;u=z+8|0;x=z+40|0;y=z+4|0;v=z;t=hu(f)|0;np(B,f,s,j);c[A>>2]=0;c[A+4>>2]=0;c[A+8>>2]=0;if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);r=o;o=0;a:do{if(!(r&1)){p=A+8|0;q=A+1|0;b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b;c[y>>2]=x;c[v>>2]=0;r=A+4|0;n=c[j>>2]|0;j=c[d>>2]|0;b:while(1){if(j){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;m=o;o=0;if(m&1){C=25;break}}else f=c[f>>2]|0;if((f|0)==-1){c[d>>2]=0;j=0;l=1}else l=0}else{j=0;l=1}k=c[e>>2]|0;do{if(k){f=c[k+12>>2]|0;if((f|0)==(c[k+16>>2]|0)){o=0;f=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;m=o;o=0;if(m&1){C=25;break b}}else f=c[f>>2]|0;if((f|0)!=-1)if(l)break;else break b;else{c[e>>2]=0;C=17;break}}else C=17}while(0);if((C|0)==17){C=0;if(l){k=0;break}else k=0}f=a[A>>0]|0;f=(f&1)==0?(f&255)>>>1:c[r>>2]|0;if((c[u>>2]|0)==(b+f|0)){o=0;wa(8,A|0,f<<1|0,0);m=o;o=0;if(m&1){C=25;break}if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);m=o;o=0;if(m&1){C=25;break}b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b+f}l=j+12|0;f=c[l>>2]|0;m=j+16|0;if((f|0)==(c[m>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;E=o;o=0;if(E&1){C=25;break}}else f=c[f>>2]|0;if(jp(f,t,b,u,v,n,B,x,y,s)|0)break;f=c[l>>2]|0;if((f|0)==(c[m>>2]|0)){o=0;ka(c[(c[j>>2]|0)+40>>2]|0,j|0)|0;E=o;o=0;if(E&1){C=25;break}else continue}else{c[l>>2]=f+4;continue}}if((C|0)==25){b=Na()|0;break}E=a[B>>0]|0;if((((E&1)==0?(E&255)>>>1:c[B+4>>2]|0)|0)!=0?(w=c[y>>2]|0,(w-x|0)<160):0){E=c[v>>2]|0;c[y>>2]=w+4;c[w>>2]=E}o=0;b=va(22,b|0,c[u>>2]|0,g|0,t|0)|0;f=D;E=o;o=0;if(!(E&1)){E=h;c[E>>2]=b;c[E+4>>2]=f;Ur(B,x,c[y>>2]|0,g);if(j){b=c[j+12>>2]|0;if((b|0)==(c[j+16>>2]|0)){o=0;b=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;E=o;o=0;if(E&1){C=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(k){b=c[k+12>>2]|0;if((b|0)==(c[k+16>>2]|0)){o=0;b=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;E=o;o=0;if(E&1){C=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{C=53;break}else{c[e>>2]=0;C=51;break}}else C=51}while(0);if((C|0)==51?f:0)C=53;if((C|0)==53)c[g>>2]=c[g>>2]|2;E=c[d>>2]|0;Im(A);Im(B);i=z;return E|0}else C=26}else C=26}while(0);if((C|0)==26)b=Na()|0;Im(A);Im(B);Ya(b|0);return 0}function Lu(d,e,f,g,h,j){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;A=i;i=i+320|0;t=A+208|0;k=A+200|0;C=A+24|0;B=A+12|0;v=A+8|0;y=A+40|0;z=A+4|0;w=A;u=hu(g)|0;np(C,g,t,k);c[B>>2]=0;c[B+4>>2]=0;c[B+8>>2]=0;if(!(a[B>>0]&1))d=10;else d=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,d|0,0);s=o;o=0;a:do{if(!(s&1)){q=B+8|0;r=B+1|0;d=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=d;c[z>>2]=y;c[w>>2]=0;s=B+4|0;p=c[k>>2]|0;k=c[e>>2]|0;b:while(1){if(k){g=c[k+12>>2]|0;if((g|0)==(c[k+16>>2]|0)){o=0;g=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;n=o;o=0;if(n&1){D=25;break}}else g=c[g>>2]|0;if((g|0)==-1){c[e>>2]=0;g=0;l=1}else{g=k;l=0}}else{g=0;l=1}m=c[f>>2]|0;do{if(m){k=c[m+12>>2]|0;if((k|0)==(c[m+16>>2]|0)){o=0;k=ka(c[(c[m>>2]|0)+36>>2]|0,m|0)|0;n=o;o=0;if(n&1){D=25;break b}}else k=c[k>>2]|0;if((k|0)!=-1)if(l)break;else{k=m;break b}else{c[f>>2]=0;D=17;break}}else D=17}while(0);if((D|0)==17){D=0;if(l){k=0;break}else m=0}k=a[B>>0]|0;k=(k&1)==0?(k&255)>>>1:c[s>>2]|0;if((c[v>>2]|0)==(d+k|0)){o=0;wa(8,B|0,k<<1|0,0);n=o;o=0;if(n&1){D=25;break}if(!(a[B>>0]&1))d=10;else d=(c[B>>2]&-2)+-1|0;o=0;wa(8,B|0,d|0,0);n=o;o=0;if(n&1){D=25;break}d=(a[B>>0]&1)==0?r:c[q>>2]|0;c[v>>2]=d+k}l=g+12|0;k=c[l>>2]|0;n=g+16|0;if((k|0)==(c[n>>2]|0)){o=0;k=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;E=o;o=0;if(E&1){D=25;break}}else k=c[k>>2]|0;if(jp(k,u,d,v,w,p,C,y,z,t)|0){k=m;break}k=c[l>>2]|0;if((k|0)==(c[n>>2]|0)){o=0;ka(c[(c[g>>2]|0)+40>>2]|0,g|0)|0;E=o;o=0;if(E&1){D=25;break}else{k=g;continue}}else{c[l>>2]=k+4;k=g;continue}}if((D|0)==25){d=Na()|0;break}E=a[C>>0]|0;if((((E&1)==0?(E&255)>>>1:c[C+4>>2]|0)|0)!=0?(x=c[z>>2]|0,(x-y|0)<160):0){E=c[w>>2]|0;c[z>>2]=x+4;c[x>>2]=E}o=0;d=va(23,d|0,c[v>>2]|0,h|0,u|0)|0;E=o;o=0;if(!(E&1)){b[j>>1]=d;Ur(C,y,c[z>>2]|0,h);if(g){d=c[g+12>>2]|0;if((d|0)==(c[g+16>>2]|0)){o=0;d=ka(c[(c[g>>2]|0)+36>>2]|0,g|0)|0;E=o;o=0;if(E&1){D=26;break}}else d=c[d>>2]|0;if((d|0)==-1){c[e>>2]=0;g=1}else g=0}else g=1;do{if(k){d=c[k+12>>2]|0;if((d|0)==(c[k+16>>2]|0)){o=0;d=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;E=o;o=0;if(E&1){D=26;break a}}else d=c[d>>2]|0;if((d|0)!=-1)if(g)break;else{D=53;break}else{c[f>>2]=0;D=51;break}}else D=51}while(0);if((D|0)==51?g:0)D=53;if((D|0)==53)c[h>>2]=c[h>>2]|2;E=c[e>>2]|0;Im(B);Im(C);i=A;return E|0}else D=26}else D=26}while(0);if((D|0)==26)d=Na()|0;Im(B);Im(C);Ya(d|0);return 0}function Mu(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;z=i;i=i+320|0;s=z+208|0;j=z+200|0;B=z+24|0;A=z+12|0;u=z+8|0;x=z+40|0;y=z+4|0;v=z;t=hu(f)|0;np(B,f,s,j);c[A>>2]=0;c[A+4>>2]=0;c[A+8>>2]=0;if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);r=o;o=0;a:do{if(!(r&1)){p=A+8|0;q=A+1|0;b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b;c[y>>2]=x;c[v>>2]=0;r=A+4|0;n=c[j>>2]|0;j=c[d>>2]|0;b:while(1){if(j){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;m=o;o=0;if(m&1){C=25;break}}else f=c[f>>2]|0;if((f|0)==-1){c[d>>2]=0;f=0;k=1}else{f=j;k=0}}else{f=0;k=1}l=c[e>>2]|0;do{if(l){j=c[l+12>>2]|0;if((j|0)==(c[l+16>>2]|0)){o=0;j=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;m=o;o=0;if(m&1){C=25;break b}}else j=c[j>>2]|0;if((j|0)!=-1)if(k)break;else{j=l;break b}else{c[e>>2]=0;C=17;break}}else C=17}while(0);if((C|0)==17){C=0;if(k){j=0;break}else l=0}j=a[A>>0]|0;j=(j&1)==0?(j&255)>>>1:c[r>>2]|0;if((c[u>>2]|0)==(b+j|0)){o=0;wa(8,A|0,j<<1|0,0);m=o;o=0;if(m&1){C=25;break}if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);m=o;o=0;if(m&1){C=25;break}b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b+j}k=f+12|0;j=c[k>>2]|0;m=f+16|0;if((j|0)==(c[m>>2]|0)){o=0;j=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=25;break}}else j=c[j>>2]|0;if(jp(j,t,b,u,v,n,B,x,y,s)|0){j=l;break}j=c[k>>2]|0;if((j|0)==(c[m>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=25;break}else{j=f;continue}}else{c[k>>2]=j+4;j=f;continue}}if((C|0)==25){b=Na()|0;break}D=a[B>>0]|0;if((((D&1)==0?(D&255)>>>1:c[B+4>>2]|0)|0)!=0?(w=c[y>>2]|0,(w-x|0)<160):0){D=c[v>>2]|0;c[y>>2]=w+4;c[w>>2]=D}o=0;b=va(24,b|0,c[u>>2]|0,g|0,t|0)|0;D=o;o=0;if(!(D&1)){c[h>>2]=b;Ur(B,x,c[y>>2]|0,g);if(f){b=c[f+12>>2]|0;if((b|0)==(c[f+16>>2]|0)){o=0;b=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(j){b=c[j+12>>2]|0;if((b|0)==(c[j+16>>2]|0)){o=0;b=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;D=o;o=0;if(D&1){C=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{C=53;break}else{c[e>>2]=0;C=51;break}}else C=51}while(0);if((C|0)==51?f:0)C=53;if((C|0)==53)c[g>>2]=c[g>>2]|2;D=c[d>>2]|0;Im(A);Im(B);i=z;return D|0}else C=26}else C=26}while(0);if((C|0)==26)b=Na()|0;Im(A);Im(B);Ya(b|0);return 0}function Nu(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;z=i;i=i+320|0;s=z+208|0;j=z+200|0;B=z+24|0;A=z+12|0;u=z+8|0;x=z+40|0;y=z+4|0;v=z;t=hu(f)|0;np(B,f,s,j);c[A>>2]=0;c[A+4>>2]=0;c[A+8>>2]=0;if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);r=o;o=0;a:do{if(!(r&1)){p=A+8|0;q=A+1|0;b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b;c[y>>2]=x;c[v>>2]=0;r=A+4|0;n=c[j>>2]|0;j=c[d>>2]|0;b:while(1){if(j){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;m=o;o=0;if(m&1){C=25;break}}else f=c[f>>2]|0;if((f|0)==-1){c[d>>2]=0;f=0;k=1}else{f=j;k=0}}else{f=0;k=1}l=c[e>>2]|0;do{if(l){j=c[l+12>>2]|0;if((j|0)==(c[l+16>>2]|0)){o=0;j=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;m=o;o=0;if(m&1){C=25;break b}}else j=c[j>>2]|0;if((j|0)!=-1)if(k)break;else{j=l;break b}else{c[e>>2]=0;C=17;break}}else C=17}while(0);if((C|0)==17){C=0;if(k){j=0;break}else l=0}j=a[A>>0]|0;j=(j&1)==0?(j&255)>>>1:c[r>>2]|0;if((c[u>>2]|0)==(b+j|0)){o=0;wa(8,A|0,j<<1|0,0);m=o;o=0;if(m&1){C=25;break}if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);m=o;o=0;if(m&1){C=25;break}b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b+j}k=f+12|0;j=c[k>>2]|0;m=f+16|0;if((j|0)==(c[m>>2]|0)){o=0;j=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=25;break}}else j=c[j>>2]|0;if(jp(j,t,b,u,v,n,B,x,y,s)|0){j=l;break}j=c[k>>2]|0;if((j|0)==(c[m>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=25;break}else{j=f;continue}}else{c[k>>2]=j+4;j=f;continue}}if((C|0)==25){b=Na()|0;break}D=a[B>>0]|0;if((((D&1)==0?(D&255)>>>1:c[B+4>>2]|0)|0)!=0?(w=c[y>>2]|0,(w-x|0)<160):0){D=c[v>>2]|0;c[y>>2]=w+4;c[w>>2]=D}o=0;b=va(25,b|0,c[u>>2]|0,g|0,t|0)|0;D=o;o=0;if(!(D&1)){c[h>>2]=b;Ur(B,x,c[y>>2]|0,g);if(f){b=c[f+12>>2]|0;if((b|0)==(c[f+16>>2]|0)){o=0;b=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;D=o;o=0;if(D&1){C=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(j){b=c[j+12>>2]|0;if((b|0)==(c[j+16>>2]|0)){o=0;b=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;D=o;o=0;if(D&1){C=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{C=53;break}else{c[e>>2]=0;C=51;break}}else C=51}while(0);if((C|0)==51?f:0)C=53;if((C|0)==53)c[g>>2]=c[g>>2]|2;D=c[d>>2]|0;Im(A);Im(B);i=z;return D|0}else C=26}else C=26}while(0);if((C|0)==26)b=Na()|0;Im(A);Im(B);Ya(b|0);return 0}function Ou(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0;z=i;i=i+320|0;s=z+208|0;j=z+200|0;B=z+24|0;A=z+12|0;u=z+8|0;x=z+40|0;y=z+4|0;v=z;t=hu(f)|0;np(B,f,s,j);c[A>>2]=0;c[A+4>>2]=0;c[A+8>>2]=0;if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);r=o;o=0;a:do{if(!(r&1)){p=A+8|0;q=A+1|0;b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b;c[y>>2]=x;c[v>>2]=0;r=A+4|0;n=c[j>>2]|0;j=c[d>>2]|0;b:while(1){if(j){f=c[j+12>>2]|0;if((f|0)==(c[j+16>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;m=o;o=0;if(m&1){C=25;break}}else f=c[f>>2]|0;if((f|0)==-1){c[d>>2]=0;j=0;l=1}else l=0}else{j=0;l=1}k=c[e>>2]|0;do{if(k){f=c[k+12>>2]|0;if((f|0)==(c[k+16>>2]|0)){o=0;f=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;m=o;o=0;if(m&1){C=25;break b}}else f=c[f>>2]|0;if((f|0)!=-1)if(l)break;else break b;else{c[e>>2]=0;C=17;break}}else C=17}while(0);if((C|0)==17){C=0;if(l){k=0;break}else k=0}f=a[A>>0]|0;f=(f&1)==0?(f&255)>>>1:c[r>>2]|0;if((c[u>>2]|0)==(b+f|0)){o=0;wa(8,A|0,f<<1|0,0);m=o;o=0;if(m&1){C=25;break}if(!(a[A>>0]&1))b=10;else b=(c[A>>2]&-2)+-1|0;o=0;wa(8,A|0,b|0,0);m=o;o=0;if(m&1){C=25;break}b=(a[A>>0]&1)==0?q:c[p>>2]|0;c[u>>2]=b+f}l=j+12|0;f=c[l>>2]|0;m=j+16|0;if((f|0)==(c[m>>2]|0)){o=0;f=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;E=o;o=0;if(E&1){C=25;break}}else f=c[f>>2]|0;if(jp(f,t,b,u,v,n,B,x,y,s)|0)break;f=c[l>>2]|0;if((f|0)==(c[m>>2]|0)){o=0;ka(c[(c[j>>2]|0)+40>>2]|0,j|0)|0;E=o;o=0;if(E&1){C=25;break}else continue}else{c[l>>2]=f+4;continue}}if((C|0)==25){b=Na()|0;break}E=a[B>>0]|0;if((((E&1)==0?(E&255)>>>1:c[B+4>>2]|0)|0)!=0?(w=c[y>>2]|0,(w-x|0)<160):0){E=c[v>>2]|0;c[y>>2]=w+4;c[w>>2]=E}o=0;b=va(26,b|0,c[u>>2]|0,g|0,t|0)|0;f=D;E=o;o=0;if(!(E&1)){E=h;c[E>>2]=b;c[E+4>>2]=f;Ur(B,x,c[y>>2]|0,g);if(j){b=c[j+12>>2]|0;if((b|0)==(c[j+16>>2]|0)){o=0;b=ka(c[(c[j>>2]|0)+36>>2]|0,j|0)|0;E=o;o=0;if(E&1){C=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(k){b=c[k+12>>2]|0;if((b|0)==(c[k+16>>2]|0)){o=0;b=ka(c[(c[k>>2]|0)+36>>2]|0,k|0)|0;E=o;o=0;if(E&1){C=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{C=53;break}else{c[e>>2]=0;C=51;break}}else C=51}while(0);if((C|0)==51?f:0)C=53;if((C|0)==53)c[g>>2]=c[g>>2]|2;E=c[d>>2]|0;Im(A);Im(B);i=z;return E|0}else C=26}else C=26}while(0);if((C|0)==26)b=Na()|0;Im(A);Im(B);Ya(b|0);return 0}function Pu(b,d,e,f,h,j){b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;var k=0.0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;D=i;i=i+352|0;v=D+208|0;l=D+40|0;m=D+36|0;F=D+24|0;E=D+12|0;x=D+8|0;B=D+48|0;C=D+4|0;y=D;z=D+337|0;w=D+336|0;op(F,f,v,l,m);c[E>>2]=0;c[E+4>>2]=0;c[E+8>>2]=0;if(!(a[E>>0]&1))b=10;else b=(c[E>>2]&-2)+-1|0;o=0;wa(8,E|0,b|0,0);u=o;o=0;a:do{if(!(u&1)){s=E+8|0;t=E+1|0;b=(a[E>>0]&1)==0?t:c[s>>2]|0;c[x>>2]=b;c[C>>2]=B;c[y>>2]=0;a[z>>0]=1;a[w>>0]=69;u=E+4|0;r=c[l>>2]|0;q=c[m>>2]|0;f=c[d>>2]|0;b:while(1){if(f){l=c[f+12>>2]|0;if((l|0)==(c[f+16>>2]|0)){o=0;l=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;p=o;o=0;if(p&1){G=25;break}}else l=c[l>>2]|0;if((l|0)==-1){c[d>>2]=0;f=0;n=1}else n=0}else{f=0;n=1}l=c[e>>2]|0;do{if(l){m=c[l+12>>2]|0;if((m|0)==(c[l+16>>2]|0)){o=0;m=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;p=o;o=0;if(p&1){G=25;break b}}else m=c[m>>2]|0;if((m|0)!=-1)if(n)break;else break b;else{c[e>>2]=0;G=17;break}}else G=17}while(0);if((G|0)==17){G=0;if(n){l=0;break}else l=0}m=a[E>>0]|0;m=(m&1)==0?(m&255)>>>1:c[u>>2]|0;if((c[x>>2]|0)==(b+m|0)){o=0;wa(8,E|0,m<<1|0,0);p=o;o=0;if(p&1){G=25;break}if(!(a[E>>0]&1))b=10;else b=(c[E>>2]&-2)+-1|0;o=0;wa(8,E|0,b|0,0);p=o;o=0;if(p&1){G=25;break}b=(a[E>>0]&1)==0?t:c[s>>2]|0;c[x>>2]=b+m}n=f+12|0;m=c[n>>2]|0;p=f+16|0;if((m|0)==(c[p>>2]|0)){o=0;m=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=25;break}}else m=c[m>>2]|0;if(pp(m,z,w,b,x,r,q,F,B,C,y,v)|0)break;l=c[n>>2]|0;if((l|0)==(c[p>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=25;break}else continue}else{c[n>>2]=l+4;continue}}if((G|0)==25){b=Na()|0;break}H=a[F>>0]|0;if(!((a[z>>0]|0)==0?1:(((H&1)==0?(H&255)>>>1:c[F+4>>2]|0)|0)==0)?(A=c[C>>2]|0,(A-B|0)<160):0){H=c[y>>2]|0;c[C>>2]=A+4;c[A>>2]=H}o=0;k=+ta(1,b|0,c[x>>2]|0,h|0);H=o;o=0;if(!(H&1)){g[j>>2]=k;Ur(F,B,c[C>>2]|0,h);if(f){b=c[f+12>>2]|0;if((b|0)==(c[f+16>>2]|0)){o=0;b=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(l){b=c[l+12>>2]|0;if((b|0)==(c[l+16>>2]|0)){o=0;b=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;H=o;o=0;if(H&1){G=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{G=53;break}else{c[e>>2]=0;G=51;break}}else G=51}while(0);if((G|0)==51?f:0)G=53;if((G|0)==53)c[h>>2]=c[h>>2]|2;H=c[d>>2]|0;Im(E);Im(F);i=D;return H|0}else G=26}else G=26}while(0);if((G|0)==26)b=Na()|0;Im(E);Im(F);Ya(b|0);return 0}function Qu(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;var k=0.0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;D=i;i=i+352|0;v=D+208|0;l=D+40|0;m=D+36|0;F=D+24|0;E=D+12|0;x=D+8|0;B=D+48|0;C=D+4|0;y=D;z=D+337|0;w=D+336|0;op(F,f,v,l,m);c[E>>2]=0;c[E+4>>2]=0;c[E+8>>2]=0;if(!(a[E>>0]&1))b=10;else b=(c[E>>2]&-2)+-1|0;o=0;wa(8,E|0,b|0,0);u=o;o=0;a:do{if(!(u&1)){s=E+8|0;t=E+1|0;b=(a[E>>0]&1)==0?t:c[s>>2]|0;c[x>>2]=b;c[C>>2]=B;c[y>>2]=0;a[z>>0]=1;a[w>>0]=69;u=E+4|0;r=c[l>>2]|0;q=c[m>>2]|0;f=c[d>>2]|0;b:while(1){if(f){l=c[f+12>>2]|0;if((l|0)==(c[f+16>>2]|0)){o=0;l=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;p=o;o=0;if(p&1){G=25;break}}else l=c[l>>2]|0;if((l|0)==-1){c[d>>2]=0;f=0;n=1}else n=0}else{f=0;n=1}l=c[e>>2]|0;do{if(l){m=c[l+12>>2]|0;if((m|0)==(c[l+16>>2]|0)){o=0;m=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;p=o;o=0;if(p&1){G=25;break b}}else m=c[m>>2]|0;if((m|0)!=-1)if(n)break;else break b;else{c[e>>2]=0;G=17;break}}else G=17}while(0);if((G|0)==17){G=0;if(n){l=0;break}else l=0}m=a[E>>0]|0;m=(m&1)==0?(m&255)>>>1:c[u>>2]|0;if((c[x>>2]|0)==(b+m|0)){o=0;wa(8,E|0,m<<1|0,0);p=o;o=0;if(p&1){G=25;break}if(!(a[E>>0]&1))b=10;else b=(c[E>>2]&-2)+-1|0;o=0;wa(8,E|0,b|0,0);p=o;o=0;if(p&1){G=25;break}b=(a[E>>0]&1)==0?t:c[s>>2]|0;c[x>>2]=b+m}n=f+12|0;m=c[n>>2]|0;p=f+16|0;if((m|0)==(c[p>>2]|0)){o=0;m=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=25;break}}else m=c[m>>2]|0;if(pp(m,z,w,b,x,r,q,F,B,C,y,v)|0)break;l=c[n>>2]|0;if((l|0)==(c[p>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=25;break}else continue}else{c[n>>2]=l+4;continue}}if((G|0)==25){b=Na()|0;break}H=a[F>>0]|0;if(!((a[z>>0]|0)==0?1:(((H&1)==0?(H&255)>>>1:c[F+4>>2]|0)|0)==0)?(A=c[C>>2]|0,(A-B|0)<160):0){H=c[y>>2]|0;c[C>>2]=A+4;c[A>>2]=H}o=0;k=+ta(2,b|0,c[x>>2]|0,g|0);H=o;o=0;if(!(H&1)){h[j>>3]=k;Ur(F,B,c[C>>2]|0,g);if(f){b=c[f+12>>2]|0;if((b|0)==(c[f+16>>2]|0)){o=0;b=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(l){b=c[l+12>>2]|0;if((b|0)==(c[l+16>>2]|0)){o=0;b=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;H=o;o=0;if(H&1){G=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{G=53;break}else{c[e>>2]=0;G=51;break}}else G=51}while(0);if((G|0)==51?f:0)G=53;if((G|0)==53)c[g>>2]=c[g>>2]|2;H=c[d>>2]|0;Im(E);Im(F);i=D;return H|0}else G=26}else G=26}while(0);if((G|0)==26)b=Na()|0;Im(E);Im(F);Ya(b|0);return 0}function Ru(b,d,e,f,g,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;j=j|0;var k=0.0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;D=i;i=i+352|0;v=D+208|0;l=D+40|0;m=D+36|0;F=D+24|0;E=D+12|0;x=D+8|0;B=D+48|0;C=D+4|0;y=D;z=D+337|0;w=D+336|0;op(F,f,v,l,m);c[E>>2]=0;c[E+4>>2]=0;c[E+8>>2]=0;if(!(a[E>>0]&1))b=10;else b=(c[E>>2]&-2)+-1|0;o=0;wa(8,E|0,b|0,0);u=o;o=0;a:do{if(!(u&1)){s=E+8|0;t=E+1|0;b=(a[E>>0]&1)==0?t:c[s>>2]|0;c[x>>2]=b;c[C>>2]=B;c[y>>2]=0;a[z>>0]=1;a[w>>0]=69;u=E+4|0;r=c[l>>2]|0;q=c[m>>2]|0;f=c[d>>2]|0;b:while(1){if(f){l=c[f+12>>2]|0;if((l|0)==(c[f+16>>2]|0)){o=0;l=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;p=o;o=0;if(p&1){G=25;break}}else l=c[l>>2]|0;if((l|0)==-1){c[d>>2]=0;f=0;n=1}else n=0}else{f=0;n=1}l=c[e>>2]|0;do{if(l){m=c[l+12>>2]|0;if((m|0)==(c[l+16>>2]|0)){o=0;m=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;p=o;o=0;if(p&1){G=25;break b}}else m=c[m>>2]|0;if((m|0)!=-1)if(n)break;else break b;else{c[e>>2]=0;G=17;break}}else G=17}while(0);if((G|0)==17){G=0;if(n){l=0;break}else l=0}m=a[E>>0]|0;m=(m&1)==0?(m&255)>>>1:c[u>>2]|0;if((c[x>>2]|0)==(b+m|0)){o=0;wa(8,E|0,m<<1|0,0);p=o;o=0;if(p&1){G=25;break}if(!(a[E>>0]&1))b=10;else b=(c[E>>2]&-2)+-1|0;o=0;wa(8,E|0,b|0,0);p=o;o=0;if(p&1){G=25;break}b=(a[E>>0]&1)==0?t:c[s>>2]|0;c[x>>2]=b+m}n=f+12|0;m=c[n>>2]|0;p=f+16|0;if((m|0)==(c[p>>2]|0)){o=0;m=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=25;break}}else m=c[m>>2]|0;if(pp(m,z,w,b,x,r,q,F,B,C,y,v)|0)break;l=c[n>>2]|0;if((l|0)==(c[p>>2]|0)){o=0;ka(c[(c[f>>2]|0)+40>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=25;break}else continue}else{c[n>>2]=l+4;continue}}if((G|0)==25){b=Na()|0;break}H=a[F>>0]|0;if(!((a[z>>0]|0)==0?1:(((H&1)==0?(H&255)>>>1:c[F+4>>2]|0)|0)==0)?(A=c[C>>2]|0,(A-B|0)<160):0){H=c[y>>2]|0;c[C>>2]=A+4;c[A>>2]=H}o=0;k=+ta(3,b|0,c[x>>2]|0,g|0);H=o;o=0;if(!(H&1)){h[j>>3]=k;Ur(F,B,c[C>>2]|0,g);if(f){b=c[f+12>>2]|0;if((b|0)==(c[f+16>>2]|0)){o=0;b=ka(c[(c[f>>2]|0)+36>>2]|0,f|0)|0;H=o;o=0;if(H&1){G=26;break}}else b=c[b>>2]|0;if((b|0)==-1){c[d>>2]=0;f=1}else f=0}else f=1;do{if(l){b=c[l+12>>2]|0;if((b|0)==(c[l+16>>2]|0)){o=0;b=ka(c[(c[l>>2]|0)+36>>2]|0,l|0)|0;H=o;o=0;if(H&1){G=26;break a}}else b=c[b>>2]|0;if((b|0)!=-1)if(f)break;else{G=53;break}else{c[e>>2]=0;G=51;break}}else G=51}while(0);if((G|0)==51?f:0)G=53;if((G|0)==53)c[g>>2]=c[g>>2]|2;H=c[d>>2]|0;Im(E);Im(F);i=D;return H|0}else G=26}else G=26}while(0);if((G|0)==26)b=Na()|0;Im(E);Im(F);Ya(b|0);return 0}function Su(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=i;i=i+16|0;h=g;c[h>>2]=f;f=qk(d)|0;d=el(a,b,e,h)|0;if((f|0)!=0?(o=0,ka(75,f|0)|0,h=o,o=0,h&1):0){h=Na(0)|0;ec(h)}i=g;return d|0}function Tu(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=i;i=i+16|0;g=f;c[g>>2]=e;e=qk(b)|0;o=0;b=ma(37,a|0,d|0,g|0)|0;a=o;o=0;if(a&1){b=Na()|0;if((e|0)!=0?(o=0,ka(75,e|0)|0,g=o,o=0,g&1):0){g=Na(0)|0;ec(g)}Ya(b|0)}else{if((e|0)!=0?(o=0,ka(75,e|0)|0,g=o,o=0,g&1):0){g=Na(0)|0;ec(g)}i=f;return b|0}return 0}function Uu(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,p=0,q=0;p=i;i=i+16|0;n=p;j=c[b>>2]|0;a:do{if(!j)j=0;else{q=d;l=f-q>>2;m=g+12|0;k=c[m>>2]|0;l=(k|0)>(l|0)?k-l|0:0;k=e;q=k-q|0;g=q>>2;if((q|0)>0?(Gb[c[(c[j>>2]|0)+48>>2]&63](j,d,g)|0)!=(g|0):0){c[b>>2]=0;j=0;break}do{if((l|0)>0){Vm(n,l,h);o=0;g=ma(c[(c[j>>2]|0)+48>>2]|0,j|0,((a[n>>0]&1)==0?n+4|0:c[n+8>>2]|0)|0,l|0)|0;q=o;o=0;if(q&1){q=Na()|0;Wm(n);Ya(q|0)}if((g|0)==(l|0)){Wm(n);break}else{c[b>>2]=0;Wm(n);j=0;break a}}}while(0);q=f-k|0;f=q>>2;if((q|0)>0?(Gb[c[(c[j>>2]|0)+48>>2]&63](j,e,f)|0)!=(f|0):0){c[b>>2]=0;j=0;break}c[m>>2]=0}}while(0);i=p;return j|0}function Vu(a,e,f,g,h){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;i=c[a>>2]|0;do{if(i){if((c[i+12>>2]|0)==(c[i+16>>2]|0))if((Eb[c[(c[i>>2]|0)+36>>2]&127](i)|0)==-1){c[a>>2]=0;i=0;break}else{i=c[a>>2]|0;break}}else i=0}while(0);j=(i|0)==0;i=c[e>>2]|0;do{if(i){if((c[i+12>>2]|0)==(c[i+16>>2]|0)?(Eb[c[(c[i>>2]|0)+36>>2]&127](i)|0)==-1:0){c[e>>2]=0;r=11;break}if(j)r=13;else r=12}else r=11}while(0);if((r|0)==11)if(j)r=12;else{i=0;r=13}a:do{if((r|0)==12){c[f>>2]=c[f>>2]|6;i=0}else if((r|0)==13){j=c[a>>2]|0;k=c[j+12>>2]|0;if((k|0)==(c[j+16>>2]|0))j=Eb[c[(c[j>>2]|0)+36>>2]&127](j)|0;else j=d[k>>0]|0;k=j&255;if(k<<24>>24>-1?(q=g+8|0,(b[(c[q>>2]|0)+(j<<24>>24<<1)>>1]&2048)!=0):0){m=(Gb[c[(c[g>>2]|0)+36>>2]&63](g,k,0)|0)<<24>>24;j=c[a>>2]|0;k=j+12|0;l=c[k>>2]|0;if((l|0)==(c[j+16>>2]|0)){Eb[c[(c[j>>2]|0)+40>>2]&127](j)|0;o=h;n=i;h=i;i=m}else{c[k>>2]=l+1;o=h;n=i;h=i;i=m}while(1){i=i+-48|0;p=o+-1|0;j=c[a>>2]|0;do{if(j){if((c[j+12>>2]|0)==(c[j+16>>2]|0))if((Eb[c[(c[j>>2]|0)+36>>2]&127](j)|0)==-1){c[a>>2]=0;j=0;break}else{j=c[a>>2]|0;break}}else j=0}while(0);l=(j|0)==0;if(h)if((c[h+12>>2]|0)==(c[h+16>>2]|0))if((Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0)==-1){c[e>>2]=0;k=0;h=0}else{k=n;h=n}else k=n;else{k=n;h=0}j=c[a>>2]|0;if(!((o|0)>1&(l^(h|0)==0)))break;l=c[j+12>>2]|0;if((l|0)==(c[j+16>>2]|0))j=Eb[c[(c[j>>2]|0)+36>>2]&127](j)|0;else j=d[l>>0]|0;l=j&255;if(l<<24>>24<=-1)break a;if(!(b[(c[q>>2]|0)+(j<<24>>24<<1)>>1]&2048))break a;i=((Gb[c[(c[g>>2]|0)+36>>2]&63](g,l,0)|0)<<24>>24)+(i*10|0)|0;j=c[a>>2]|0;l=j+12|0;m=c[l>>2]|0;if((m|0)==(c[j+16>>2]|0)){Eb[c[(c[j>>2]|0)+40>>2]&127](j)|0;o=p;n=k;continue}else{c[l>>2]=m+1;o=p;n=k;continue}}do{if(j){if((c[j+12>>2]|0)==(c[j+16>>2]|0))if((Eb[c[(c[j>>2]|0)+36>>2]&127](j)|0)==-1){c[a>>2]=0;j=0;break}else{j=c[a>>2]|0;break}}else j=0}while(0);j=(j|0)==0;do{if(k){if((c[k+12>>2]|0)==(c[k+16>>2]|0)?(Eb[c[(c[k>>2]|0)+36>>2]&127](k)|0)==-1:0){c[e>>2]=0;r=50;break}if(j)break a}else r=50}while(0);if((r|0)==50?!j:0)break;c[f>>2]=c[f>>2]|2;break}c[f>>2]=c[f>>2]|4;i=0}}while(0);return i|0}function Wu(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=c[a>>2]|0;do{if(g){h=c[g+12>>2]|0;if((h|0)==(c[g+16>>2]|0))g=Eb[c[(c[g>>2]|0)+36>>2]&127](g)|0;else g=c[h>>2]|0;if((g|0)==-1){c[a>>2]=0;i=1;break}else{i=(c[a>>2]|0)==0;break}}else i=1}while(0);h=c[b>>2]|0;do{if(h){g=c[h+12>>2]|0;if((g|0)==(c[h+16>>2]|0))g=Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0;else g=c[g>>2]|0;if((g|0)!=-1)if(i){o=17;break}else{o=16;break}else{c[b>>2]=0;o=14;break}}else o=14}while(0);if((o|0)==14)if(i)o=16;else{h=0;o=17}a:do{if((o|0)==16){c[d>>2]=c[d>>2]|6;g=0}else if((o|0)==17){g=c[a>>2]|0;i=c[g+12>>2]|0;if((i|0)==(c[g+16>>2]|0))g=Eb[c[(c[g>>2]|0)+36>>2]&127](g)|0;else g=c[i>>2]|0;if(!(Gb[c[(c[e>>2]|0)+12>>2]&63](e,2048,g)|0)){c[d>>2]=c[d>>2]|4;g=0;break}g=(Gb[c[(c[e>>2]|0)+52>>2]&63](e,g,0)|0)<<24>>24;i=c[a>>2]|0;j=i+12|0;k=c[j>>2]|0;if((k|0)==(c[i+16>>2]|0)){Eb[c[(c[i>>2]|0)+40>>2]&127](i)|0;m=f;l=h;j=h}else{c[j>>2]=k+4;m=f;l=h;j=h}while(1){g=g+-48|0;n=m+-1|0;h=c[a>>2]|0;do{if(h){i=c[h+12>>2]|0;if((i|0)==(c[h+16>>2]|0))h=Eb[c[(c[h>>2]|0)+36>>2]&127](h)|0;else h=c[i>>2]|0;if((h|0)==-1){c[a>>2]=0;k=1;break}else{k=(c[a>>2]|0)==0;break}}else k=1}while(0);do{if(j){h=c[j+12>>2]|0;if((h|0)==(c[j+16>>2]|0))h=Eb[c[(c[j>>2]|0)+36>>2]&127](j)|0;else h=c[h>>2]|0;if((h|0)==-1){c[b>>2]=0;j=0;f=0;h=1;break}else{j=l;f=l;h=(l|0)==0;break}}else{j=l;f=0;h=1}}while(0);i=c[a>>2]|0;if(!((m|0)>1&(k^h)))break;h=c[i+12>>2]|0;if((h|0)==(c[i+16>>2]|0))h=Eb[c[(c[i>>2]|0)+36>>2]&127](i)|0;else h=c[h>>2]|0;if(!(Gb[c[(c[e>>2]|0)+12>>2]&63](e,2048,h)|0))break a;g=((Gb[c[(c[e>>2]|0)+52>>2]&63](e,h,0)|0)<<24>>24)+(g*10|0)|0;h=c[a>>2]|0;i=h+12|0;k=c[i>>2]|0;if((k|0)==(c[h+16>>2]|0)){Eb[c[(c[h>>2]|0)+40>>2]&127](h)|0;m=n;l=j;j=f;continue}else{c[i>>2]=k+4;m=n;l=j;j=f;continue}}do{if(i){h=c[i+12>>2]|0;if((h|0)==(c[i+16>>2]|0))h=Eb[c[(c[i>>2]|0)+36>>2]&127](i)|0;else h=c[h>>2]|0;if((h|0)==-1){c[a>>2]=0;i=1;break}else{i=(c[a>>2]|0)==0;break}}else i=1}while(0);do{if(j){h=c[j+12>>2]|0;if((h|0)==(c[j+16>>2]|0))h=Eb[c[(c[j>>2]|0)+36>>2]&127](j)|0;else h=c[h>>2]|0;if((h|0)!=-1)if(i)break a;else break;else{c[b>>2]=0;o=60;break}}else o=60}while(0);if((o|0)==60?!i:0)break;c[d>>2]=c[d>>2]|2}}while(0);return g|0}function Xu(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;g=a+4|0;e=(c[g>>2]|0)!=189;i=c[a>>2]|0;h=i;f=(c[d>>2]|0)-h|0;f=f>>>0<2147483647?f<<1:-1;h=(c[b>>2]|0)-h|0;i=Il(e?i:0,f)|0;if(!i)Sj();do{if(!e){e=c[a>>2]|0;c[a>>2]=i;if(e){o=0;ha(c[g>>2]|0,e|0);i=o;o=0;if(i&1){i=Na(0)|0;ec(i)}else{j=c[a>>2]|0;break}}else j=i}else{c[a>>2]=i;j=i}}while(0);c[g>>2]=201;c[b>>2]=j+h;c[d>>2]=(c[a>>2]|0)+f;return}function Yu(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;g=a+4|0;e=(c[g>>2]|0)!=189;i=c[a>>2]|0;h=i;f=(c[d>>2]|0)-h|0;f=f>>>0<2147483647?f<<1:-1;h=(c[b>>2]|0)-h>>2;i=Il(e?i:0,f)|0;if(!i)Sj();do{if(!e){e=c[a>>2]|0;c[a>>2]=i;if(e){o=0;ha(c[g>>2]|0,e|0);i=o;o=0;if(i&1){i=Na(0)|0;ec(i)}else{j=c[a>>2]|0;break}}else j=i}else{c[a>>2]=i;j=i}}while(0);c[g>>2]=201;c[b>>2]=j+(h<<2);c[d>>2]=(c[a>>2]|0)+(f>>>2<<2);return}function Zu(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;h=d;f=a[b>>0]|0;if(!(f&1)){g=10;k=(f&255)>>>1}else{f=c[b>>2]|0;g=(f&-2)+-1|0;k=c[b+4>>2]|0;f=f&255}j=e-h|0;do{if((e|0)!=(d|0)){if((g-k|0)>>>0>>0){Tm(b,g,k+j-g|0,k,k,0,0);f=a[b>>0]|0}if(!(f&1))i=b+1|0;else i=c[b+8>>2]|0;h=e+(k-h)|0;if((d|0)!=(e|0)){f=d;g=i+k|0;while(1){a[g>>0]=a[f>>0]|0;f=f+1|0;if((f|0)==(e|0))break;else g=g+1|0}}a[i+h>>0]=0;f=k+j|0;if(!(a[b>>0]&1)){a[b>>0]=f<<1;break}else{c[b+4>>2]=f;break}}}while(0);return b|0}function _u(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;g=a+4|0;e=(c[g>>2]|0)!=189;i=c[a>>2]|0;h=i;f=(c[d>>2]|0)-h|0;f=f>>>0<2147483647?f<<1:-1;h=(c[b>>2]|0)-h>>2;i=Il(e?i:0,f)|0;if(!i)Sj();do{if(!e){e=c[a>>2]|0;c[a>>2]=i;if(e){o=0;ha(c[g>>2]|0,e|0);i=o;o=0;if(i&1){i=Na(0)|0;ec(i)}else{j=c[a>>2]|0;break}}else j=i}else{c[a>>2]=i;j=i}}while(0);c[g>>2]=201;c[b>>2]=j+(h<<2);c[d>>2]=(c[a>>2]|0)+(f>>>2<<2);return}function $u(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;h=d;f=a[b>>0]|0;if(!(f&1)){g=1;k=(f&255)>>>1}else{f=c[b>>2]|0;g=(f&-2)+-1|0;k=c[b+4>>2]|0;f=f&255}j=e-h>>2;do{if(j){if((g-k|0)>>>0>>0){an(b,g,k+j-g|0,k,k,0,0);f=a[b>>0]|0}if(!(f&1))i=b+4|0;else i=c[b+8>>2]|0;h=k+((e-h|0)>>>2)|0;if((d|0)!=(e|0)){f=d;g=i+(k<<2)|0;while(1){c[g>>2]=c[f>>2];f=f+4|0;if((f|0)==(e|0))break;else g=g+4|0}}c[i+(h<<2)>>2]=0;f=k+j|0;if(!(a[b>>0]&1)){a[b>>0]=f<<1;break}else{c[b+4>>2]=f;break}}}while(0);return b|0}function av(b,d){b=b|0;d=d|0;var e=0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;a[b+128>>0]=0;do{if(d){o=0;ia(125,b|0,d|0);e=o;o=0;if(e&1){e=Na()|0;Dv(b);Ya(e|0)}else{Uv(b,d);break}}}while(0);return}function bv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43148)|0);return}function cv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43188)|0);return}function dv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44220)|0);return}function ev(a,b){a=a|0;b=b|0;xs(a,b,Hs(44212)|0);return}function fv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44280)|0);return}function gv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44288)|0);return}function hv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44344)|0);return}function iv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44352)|0);return}function jv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44360)|0);return}function kv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44368)|0);return}function lv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43260)|0);return}function mv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43332)|0);return}function nv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43392)|0);return}function ov(a,b){a=a|0;b=b|0;xs(a,b,Hs(43452)|0);return}function pv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43764)|0);return}function qv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43828)|0);return}function rv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43892)|0);return}function sv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43956)|0);return}function tv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43992)|0);return}function uv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44028)|0);return}function vv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44064)|0);return}function wv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44100)|0);return}function xv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43544)|0);return}function yv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43636)|0);return}function zv(a,b){a=a|0;b=b|0;xs(a,b,Hs(43668)|0);return}function Av(a,b){a=a|0;b=b|0;xs(a,b,Hs(43700)|0);return}function Bv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44140)|0);return}function Cv(a,b){a=a|0;b=b|0;xs(a,b,Hs(44180)|0);return}function Dv(b){b=b|0;var d=0,e=0,f=0;e=c[b>>2]|0;do{if(e){f=b+4|0;d=c[f>>2]|0;if((d|0)!=(e|0)){do{d=d+-4|0}while((d|0)!=(e|0));c[f>>2]=d}if((b+16|0)==(e|0)){a[b+128>>0]=0;break}else{cj(e);break}}}while(0);return}function Ev(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;h=a+4|0;d=c[h>>2]|0;e=c[a>>2]|0;f=d-e>>2;if(f>>>0>=b>>>0){if(f>>>0>b>>>0?(g=e+(b<<2)|0,(d|0)!=(g|0)):0){do{d=d+-4|0}while((d|0)!=(g|0));c[h>>2]=d}}else Tv(a,b-f|0);return}function Fv(a,b){a=a|0;b=b|0;var d=0;d=c[a+8>>2]|0;if((c[a+12>>2]|0)-d>>2>>>0>b>>>0)d=(c[d+(b<<2)>>2]|0)!=0;else d=0;return d|0}function Gv(a){a=a|0;var b=0,d=0;d=a+4|0;b=c[d>>2]|0;d=c[d+4>>2]|0;a=(c[a>>2]|0)+(d>>1)|0;if(d&1)b=c[(c[a>>2]|0)+b>>2]|0;Bb[b&255](a);return}function Hv(d,f,g,h,i,j,k,l){d=d|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0;c[g>>2]=d;c[j>>2]=h;if(l&2)if((i-h|0)<3)d=1;else{c[j>>2]=h+1;a[h>>0]=-17;m=c[j>>2]|0;c[j>>2]=m+1;a[m>>0]=-69;m=c[j>>2]|0;c[j>>2]=m+1;a[m>>0]=-65;m=4}else m=4;a:do{if((m|0)==4){n=f;d=c[g>>2]|0;if(d>>>0>>0)while(1){l=b[d>>1]|0;m=l&65535;if(m>>>0>k>>>0){d=2;break a}do{if((l&65535)<128){d=c[j>>2]|0;if((i-d|0)<1){d=1;break a}c[j>>2]=d+1;a[d>>0]=l}else{if((l&65535)<2048){d=c[j>>2]|0;if((i-d|0)<2){d=1;break a}c[j>>2]=d+1;a[d>>0]=m>>>6|192;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=m&63|128;break}if((l&65535)<55296){d=c[j>>2]|0;if((i-d|0)<3){d=1;break a}c[j>>2]=d+1;a[d>>0]=m>>>12|224;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=m>>>6&63|128;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=m&63|128;break}if((l&65535)>=56320){if((l&65535)<57344){d=2;break a}d=c[j>>2]|0;if((i-d|0)<3){d=1;break a}c[j>>2]=d+1;a[d>>0]=m>>>12|224;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=m>>>6&63|128;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=m&63|128;break}if((n-d|0)<4){d=1;break a}d=d+2|0;l=e[d>>1]|0;if((l&64512|0)!=56320){d=2;break a}if((i-(c[j>>2]|0)|0)<4){d=1;break a}h=m&960;if(((h<<10)+65536|m<<10&64512|l&1023)>>>0>k>>>0){d=2;break a}c[g>>2]=d;d=(h>>>6)+1|0;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=d>>>2|240;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=m>>>2&15|d<<4&48|128;h=c[j>>2]|0;c[j>>2]=h+1;a[h>>0]=m<<4&48|l>>>6&15|128;m=c[j>>2]|0;c[j>>2]=m+1;a[m>>0]=l&63|128}}while(0);d=(c[g>>2]|0)+2|0;c[g>>2]=d;if(d>>>0>=f>>>0){d=0;break}}else d=0}}while(0);return d|0}function Iv(e,f,g,h,i,j,k,l){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0;c[g>>2]=e;c[j>>2]=h;if(l&4){e=c[g>>2]|0;l=f;if((((l-e|0)>2?(a[e>>0]|0)==-17:0)?(a[e+1>>0]|0)==-69:0)?(a[e+2>>0]|0)==-65:0){c[g>>2]=e+3;m=c[j>>2]|0}else m=h}else{m=h;l=f}q=i;h=c[g>>2]|0;e=h>>>0>>0;a:do{if(e&m>>>0>>0)while(1){e=a[h>>0]|0;o=e&255;if(o>>>0>k>>>0){e=2;break a}do{if(e<<24>>24>-1){b[m>>1]=e&255;c[g>>2]=h+1}else{if((e&255)<194){e=2;break a}if((e&255)<224){if((l-h|0)<2){e=1;break a}e=d[h+1>>0]|0;if((e&192|0)!=128){e=2;break a}e=e&63|o<<6&1984;if(e>>>0>k>>>0){e=2;break a}b[m>>1]=e;c[g>>2]=h+2;break}if((e&255)<240){if((l-h|0)<3){e=1;break a}n=a[h+1>>0]|0;e=a[h+2>>0]|0;switch(o|0){case 224:{if((n&-32)<<24>>24!=-96){e=2;break a}break}case 237:{if((n&-32)<<24>>24!=-128){e=2;break a}break}default:if((n&-64)<<24>>24!=-128){e=2;break a}}e=e&255;if((e&192|0)!=128){e=2;break a}e=(n&255)<<6&4032|o<<12|e&63;if((e&65535)>>>0>k>>>0){e=2;break a}b[m>>1]=e;c[g>>2]=h+3;break}if((e&255)>=245){e=2;break a}if((l-h|0)<4){e=1;break a}n=a[h+1>>0]|0;e=a[h+2>>0]|0;h=a[h+3>>0]|0;switch(o|0){case 240:{if((n+112&255)>=48){e=2;break a}break}case 244:{if((n&-16)<<24>>24!=-128){e=2;break a}break}default:if((n&-64)<<24>>24!=-128){e=2;break a}}p=e&255;if((p&192|0)!=128){e=2;break a}e=h&255;if((e&192|0)!=128){e=2;break a}if((q-m|0)<4){e=1;break a}o=o&7;h=n&255;n=p<<6;e=e&63;if((h<<12&258048|o<<18|n&4032|e)>>>0>k>>>0){e=2;break a}b[m>>1]=h<<2&60|p>>>4&3|((h>>>4&3|o<<2)<<6)+16320|55296;p=m+2|0;c[j>>2]=p;b[p>>1]=e|n&960|56320;c[g>>2]=(c[g>>2]|0)+4}}while(0);m=(c[j>>2]|0)+2|0;c[j>>2]=m;h=c[g>>2]|0;e=h>>>0>>0;if(!(e&m>>>0>>0)){r=39;break}}else r=39}while(0);if((r|0)==39)e=e&1;return e|0}function Jv(b,c,e,f,g){b=b|0;c=c|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=c;if((((g&4|0)!=0?(n-b|0)>2:0)?(a[b>>0]|0)==-17:0)?(a[b+1>>0]|0)==-69:0)g=(a[b+2>>0]|0)==-65?b+3|0:b;else g=b;a:do{if((e|0)!=0&g>>>0>>0){m=g;h=0;b:while(1){g=a[m>>0]|0;l=g&255;if(l>>>0>f>>>0){g=m;h=42;break a}do{if(g<<24>>24>-1)g=m+1|0;else{if((g&255)<194){g=m;h=42;break a}if((g&255)<224){if((n-m|0)<2){g=m;h=42;break a}g=d[m+1>>0]|0;if((g&192|0)!=128){g=m;h=42;break a}if((g&63|l<<6&1984)>>>0>f>>>0){g=m;h=42;break a}g=m+2|0;break}if((g&255)<240){g=m;if((n-g|0)<3){g=m;h=42;break a}j=a[m+1>>0]|0;i=a[m+2>>0]|0;switch(l|0){case 224:{if((j&-32)<<24>>24!=-96){h=20;break b}break}case 237:{if((j&-32)<<24>>24!=-128){h=22;break b}break}default:if((j&-64)<<24>>24!=-128){h=24;break b}}g=i&255;if((g&192|0)!=128){g=m;h=42;break a}if(((j&255)<<6&4032|l<<12&61440|g&63)>>>0>f>>>0){g=m;h=42;break a}g=m+3|0;break}if((g&255)>=245){g=m;h=42;break a}g=m;if((e-h|0)>>>0<2|(n-g|0)<4){g=m;h=42;break a}k=a[m+1>>0]|0;i=a[m+2>>0]|0;j=a[m+3>>0]|0;switch(l|0){case 240:{if((k+112&255)>=48){h=32;break b}break}case 244:{if((k&-16)<<24>>24!=-128){h=34;break b}break}default:if((k&-64)<<24>>24!=-128){h=36;break b}}i=i&255;if((i&192|0)!=128){g=m;h=42;break a}g=j&255;if((g&192|0)!=128){g=m;h=42;break a}if(((k&255)<<12&258048|l<<18&1835008|i<<6&4032|g&63)>>>0>f>>>0){g=m;h=42;break a}g=m+4|0;h=h+1|0}}while(0);h=h+1|0;if(!(h>>>0>>0&g>>>0>>0)){h=42;break a}else m=g}if((h|0)==20){g=g-b|0;break}else if((h|0)==22){g=g-b|0;break}else if((h|0)==24){g=g-b|0;break}else if((h|0)==32){g=g-b|0;break}else if((h|0)==34){g=g-b|0;break}else if((h|0)==36){g=g-b|0;break}}else h=42}while(0);if((h|0)==42)g=g-b|0;return g|0}function Kv(b,d,e,f,g,h,i,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0;c[e>>2]=b;c[h>>2]=f;l=g;if(j&2)if((l-f|0)<3)b=1;else{c[h>>2]=f+1;a[f>>0]=-17;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=-69;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=-65;k=4}else k=4;a:do{if((k|0)==4){b=c[e>>2]|0;if(b>>>0>>0)while(1){j=c[b>>2]|0;if(j>>>0>i>>>0|(j&-2048|0)==55296){b=2;break a}do{if(j>>>0>=128){if(j>>>0<2048){b=c[h>>2]|0;if((l-b|0)<2){b=1;break a}c[h>>2]=b+1;a[b>>0]=j>>>6|192;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=j&63|128;break}b=c[h>>2]|0;g=l-b|0;if(j>>>0<65536){if((g|0)<3){b=1;break a}c[h>>2]=b+1;a[b>>0]=j>>>12|224;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=j>>>6&63|128;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=j&63|128;break}else{if((g|0)<4){b=1;break a}c[h>>2]=b+1;a[b>>0]=j>>>18|240;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=j>>>12&63|128;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=j>>>6&63|128;k=c[h>>2]|0;c[h>>2]=k+1;a[k>>0]=j&63|128;break}}else{b=c[h>>2]|0;if((l-b|0)<1){b=1;break a}c[h>>2]=b+1;a[b>>0]=j}}while(0);b=(c[e>>2]|0)+4|0;c[e>>2]=b;if(b>>>0>=d>>>0){b=0;break}}else b=0}}while(0);return b|0}function Lv(b,e,f,g,h,i,j,k){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0;c[f>>2]=b;c[i>>2]=g;if(k&4){b=c[f>>2]|0;k=e;if((((k-b|0)>2?(a[b>>0]|0)==-17:0)?(a[b+1>>0]|0)==-69:0)?(a[b+2>>0]|0)==-65:0){c[f>>2]=b+3;g=c[i>>2]|0;p=k}else p=k}else p=e;k=c[f>>2]|0;b=k>>>0>>0;a:do{if(b&g>>>0>>0)while(1){b=a[k>>0]|0;o=b&255;do{if(b<<24>>24>-1){if(o>>>0>j>>>0){b=2;break a}c[g>>2]=o;c[f>>2]=k+1}else{if((b&255)<194){b=2;break a}if((b&255)<224){if((p-k|0)<2){b=1;break a}b=d[k+1>>0]|0;if((b&192|0)!=128){b=2;break a}b=b&63|o<<6&1984;if(b>>>0>j>>>0){b=2;break a}c[g>>2]=b;c[f>>2]=k+2;break}if((b&255)<240){if((p-k|0)<3){b=1;break a}l=a[k+1>>0]|0;b=a[k+2>>0]|0;switch(o|0){case 224:{if((l&-32)<<24>>24!=-96){b=2;break a}break}case 237:{if((l&-32)<<24>>24!=-128){b=2;break a}break}default:if((l&-64)<<24>>24!=-128){b=2;break a}}b=b&255;if((b&192|0)!=128){b=2;break a}b=(l&255)<<6&4032|o<<12&61440|b&63;if(b>>>0>j>>>0){b=2;break a}c[g>>2]=b;c[f>>2]=k+3;break}if((b&255)>=245){b=2;break a}if((p-k|0)<4){b=1;break a}n=a[k+1>>0]|0;b=a[k+2>>0]|0;l=a[k+3>>0]|0;switch(o|0){case 240:{if((n+112&255)>=48){b=2;break a}break}case 244:{if((n&-16)<<24>>24!=-128){b=2;break a}break}default:if((n&-64)<<24>>24!=-128){b=2;break a}}m=b&255;if((m&192|0)!=128){b=2;break a}b=l&255;if((b&192|0)!=128){b=2;break a}b=(n&255)<<12&258048|o<<18&1835008|m<<6&4032|b&63;if(b>>>0>j>>>0){b=2;break a}c[g>>2]=b;c[f>>2]=k+4}}while(0);g=(c[i>>2]|0)+4|0;c[i>>2]=g;k=c[f>>2]|0;b=k>>>0>>0;if(!(b&g>>>0>>0)){q=38;break}}else q=38}while(0);if((q|0)==38)b=b&1;return b|0}function Mv(b,c,e,f,g){b=b|0;c=c|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;n=c;if((((g&4|0)!=0?(n-b|0)>2:0)?(a[b>>0]|0)==-17:0)?(a[b+1>>0]|0)==-69:0)g=(a[b+2>>0]|0)==-65?b+3|0:b;else g=b;a:do{if((e|0)!=0&g>>>0>>0){l=g;m=0;b:while(1){g=a[l>>0]|0;k=g&255;do{if(g<<24>>24>-1){if(k>>>0>f>>>0){g=l;h=42;break a}g=l+1|0}else{if((g&255)<194){g=l;h=42;break a}if((g&255)<224){if((n-l|0)<2){g=l;h=42;break a}g=d[l+1>>0]|0;if((g&192|0)!=128){g=l;h=42;break a}if((g&63|k<<6&1984)>>>0>f>>>0){g=l;h=42;break a}g=l+2|0;break}if((g&255)<240){g=l;if((n-g|0)<3){g=l;h=42;break a}i=a[l+1>>0]|0;h=a[l+2>>0]|0;switch(k|0){case 224:{if((i&-32)<<24>>24!=-96){h=20;break b}break}case 237:{if((i&-32)<<24>>24!=-128){h=22;break b}break}default:if((i&-64)<<24>>24!=-128){h=24;break b}}g=h&255;if((g&192|0)!=128){g=l;h=42;break a}if(((i&255)<<6&4032|k<<12&61440|g&63)>>>0>f>>>0){g=l;h=42;break a}g=l+3|0;break}if((g&255)>=245){g=l;h=42;break a}g=l;if((n-g|0)<4){g=l;h=42;break a}j=a[l+1>>0]|0;h=a[l+2>>0]|0;i=a[l+3>>0]|0;switch(k|0){case 240:{if((j+112&255)>=48){h=32;break b}break}case 244:{if((j&-16)<<24>>24!=-128){h=34;break b}break}default:if((j&-64)<<24>>24!=-128){h=36;break b}}h=h&255;if((h&192|0)!=128){g=l;h=42;break a}g=i&255;if((g&192|0)!=128){g=l;h=42;break a}if(((j&255)<<12&258048|k<<18&1835008|h<<6&4032|g&63)>>>0>f>>>0){g=l;h=42;break a}g=l+4|0}}while(0);m=m+1|0;if(!(m>>>0>>0&g>>>0>>0)){h=42;break a}else l=g}if((h|0)==20){g=g-b|0;break}else if((h|0)==22){g=g-b|0;break}else if((h|0)==24){g=g-b|0;break}else if((h|0)==32){g=g-b|0;break}else if((h|0)==34){g=g-b|0;break}else if((h|0)==36){g=g-b|0;break}}else h=42}while(0);if((h|0)==42)g=g-b|0;return g|0}function Nv(a){a=a|0;Im(45196);Im(45184);Im(45172);Im(45160);Im(45148);Im(45136);Im(45124);Im(45112);Im(45100);Im(45088);Im(45076);Im(45064);Im(45052);Im(45040);return}function Ov(a){a=a|0;Wm(45368);Wm(45356);Wm(45344);Wm(45332);Wm(45320);Wm(45308);Wm(45296);Wm(45284);Wm(45272);Wm(45260);Wm(45248);Wm(45236);Wm(45224);Wm(45212);return}function Pv(a){a=a|0;Im(46e3);Im(45988);Im(45976);Im(45964);Im(45952);Im(45940);Im(45928);Im(45916);Im(45904);Im(45892);Im(45880);Im(45868);Im(45856);Im(45844);Im(45832);Im(45820);Im(45808);Im(45796);Im(45784);Im(45772);Im(45760);Im(45748);Im(45736);Im(45724);return}function Qv(a){a=a|0;Wm(46292);Wm(46280);Wm(46268);Wm(46256);Wm(46244);Wm(46232);Wm(46220);Wm(46208);Wm(46196);Wm(46184);Wm(46172);Wm(46160);Wm(46148);Wm(46136);Wm(46124);Wm(46112);Wm(46100);Wm(46088);Wm(46076);Wm(46064);Wm(46052);Wm(46040);Wm(46028);Wm(46016);return}function Rv(a){a=a|0;Im(47104);Im(47092);Im(47080);Im(47068);Im(47056);Im(47044);Im(47032);Im(47020);Im(47008);Im(46996);Im(46984);Im(46972);Im(46960);Im(46948);Im(46936);Im(46924);Im(46912);Im(46900);Im(46888);Im(46876);Im(46864);Im(46852);Im(46840);Im(46828);return}function Sv(a){a=a|0;Wm(47396);Wm(47384);Wm(47372);Wm(47360);Wm(47348);Wm(47336);Wm(47324);Wm(47312);Wm(47300);Wm(47288);Wm(47276);Wm(47264);Wm(47252);Wm(47240);Wm(47228);Wm(47216);Wm(47204);Wm(47192);Wm(47180);Wm(47168);Wm(47156);Wm(47144);Wm(47132);Wm(47120);return}function Tv(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;j=k;g=c[a+8>>2]|0;d=c[a+4>>2]|0;if(g-d>>2>>>0>>0){e=c[a>>2]|0;h=d-e>>2;f=h+b|0;if(f>>>0>1073741823)$i(a);d=g-e|0;if(d>>2>>>0<536870911){d=d>>1;d=d>>>0>>0?f:d}else d=1073741823;Vv(j,d,h,a+16|0);h=j+8|0;g=c[h>>2]|0;iw(g|0,0,b<<2|0)|0;c[h>>2]=g+(b<<2);Wv(a,j);Xv(j)}else Uv(a,b);i=k;return}function Uv(a,b){a=a|0;b=b|0;var d=0;d=a+4|0;a=b;b=c[d>>2]|0;do{c[b>>2]=0;b=(c[d>>2]|0)+4|0;c[d>>2]=b;a=a+-1|0}while((a|0)!=0);return}function Vv(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;c[b+12>>2]=0;c[b+16>>2]=f;do{if(d){g=f+112|0;if(d>>>0<29&(a[g>>0]|0)==0){a[g>>0]=1;break}else{f=bj(d<<2)|0;break}}else f=0}while(0);c[b>>2]=f;e=f+(e<<2)|0;c[b+8>>2]=e;c[b+4>>2]=e;c[b+12>>2]=f+(d<<2);return}function Wv(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;e=c[a>>2]|0;g=a+4|0;d=b+4|0;f=(c[g>>2]|0)-e|0;h=(c[d>>2]|0)+(0-(f>>2)<<2)|0;c[d>>2]=h;lw(h|0,e|0,f|0)|0;f=c[a>>2]|0;c[a>>2]=c[d>>2];c[d>>2]=f;f=b+8|0;e=c[g>>2]|0;c[g>>2]=c[f>>2];c[f>>2]=e;f=a+8|0;a=b+12|0;e=c[f>>2]|0;c[f>>2]=c[a>>2];c[a>>2]=e;c[b>>2]=c[d>>2];return}function Xv(b){b=b|0;var d=0,e=0,f=0;e=c[b+4>>2]|0;f=b+8|0;d=c[f>>2]|0;if((d|0)!=(e|0)){do{d=d+-4|0}while((d|0)!=(e|0));c[f>>2]=d}e=c[b>>2]|0;do{if(e){d=c[b+16>>2]|0;if((d|0)==(e|0)){a[d+112>>0]=0;break}else{cj(e);break}}}while(0);return}function Yv(b,d){b=b|0;d=d|0;var e=0;if(d>>>0>1073741823)$i(b);e=b+128|0;if(d>>>0<29&(a[e>>0]|0)==0){a[e>>0]=1;e=b+16|0}else e=bj(d<<2)|0;c[b+4>>2]=e;c[b>>2]=e;c[b+8>>2]=e+(d<<2);return}function Zv(a,b,d){a=a|0;b=b|0;d=d|0;var e=0.0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;h=j;do{if((a|0)!=(b|0)){f=ck()|0;g=c[f>>2]|0;c[f>>2]=0;e=+gl(a,h,Xo()|0);a=c[f>>2]|0;if(!a)c[f>>2]=g;if((c[h>>2]|0)!=(b|0)){c[d>>2]=4;e=0.0;break}if((a|0)==34)c[d>>2]=4}else{c[d>>2]=4;e=0.0}}while(0);i=j;return+e}function _v(a,b,d){a=a|0;b=b|0;d=d|0;var e=0.0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;h=j;do{if((a|0)!=(b|0)){f=ck()|0;g=c[f>>2]|0;c[f>>2]=0;e=+gl(a,h,Xo()|0);a=c[f>>2]|0;if(!a)c[f>>2]=g;if((c[h>>2]|0)!=(b|0)){c[d>>2]=4;e=0.0;break}if((a|0)==34)c[d>>2]=4}else{c[d>>2]=4;e=0.0}}while(0);i=j;return+e}function $v(a,b,d){a=a|0;b=b|0;d=d|0;var e=0.0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;h=j;do{if((a|0)==(b|0)){c[d>>2]=4;e=0.0}else{f=ck()|0;g=c[f>>2]|0;c[f>>2]=0;e=+gl(a,h,Xo()|0);a=c[f>>2]|0;if(!a)c[f>>2]=g;if((c[h>>2]|0)!=(b|0)){c[d>>2]=4;e=0.0;break}if((a|0)==34)c[d>>2]=4}}while(0);i=j;return+e}function aw(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0;k=i;i=i+16|0;j=k;do{if((b|0)!=(d|0)){if((a[b>>0]|0)==45){c[e>>2]=4;f=0;b=0;break}g=ck()|0;h=c[g>>2]|0;c[g>>2]=0;b=Xj(b,j,f,Xo()|0)|0;f=c[g>>2]|0;if(!f)c[g>>2]=h;if((c[j>>2]|0)!=(d|0)){c[e>>2]=4;f=0;b=0;break}if((f|0)==34){c[e>>2]=4;f=-1;b=-1}else f=D}else{c[e>>2]=4;f=0;b=0}}while(0);D=f;i=k;return b|0}function bw(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;k=l;do{if((b|0)!=(d|0)){if((a[b>>0]|0)==45){c[e>>2]=4;b=0;break}h=ck()|0;j=c[h>>2]|0;c[h>>2]=0;b=Xj(b,k,f,Xo()|0)|0;f=D;g=c[h>>2]|0;if(!g)c[h>>2]=j;if((c[k>>2]|0)!=(d|0)){c[e>>2]=4;b=0;break}if(f>>>0>0|(f|0)==0&b>>>0>4294967295|(g|0)==34){c[e>>2]=4;b=-1;break}else break}else{c[e>>2]=4;b=0}}while(0);i=l;return b|0}function cw(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;k=l;do{if((b|0)!=(d|0)){if((a[b>>0]|0)==45){c[e>>2]=4;b=0;break}h=ck()|0;j=c[h>>2]|0;c[h>>2]=0;b=Xj(b,k,f,Xo()|0)|0;f=D;g=c[h>>2]|0;if(!g)c[h>>2]=j;if((c[k>>2]|0)!=(d|0)){c[e>>2]=4;b=0;break}if(f>>>0>0|(f|0)==0&b>>>0>4294967295|(g|0)==34){c[e>>2]=4;b=-1;break}else break}else{c[e>>2]=4;b=0}}while(0);i=l;return b|0}function dw(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;k=l;do{if((b|0)!=(d|0)){if((a[b>>0]|0)==45){c[e>>2]=4;b=0;break}h=ck()|0;j=c[h>>2]|0;c[h>>2]=0;b=Xj(b,k,f,Xo()|0)|0;f=D;g=c[h>>2]|0;if(!g)c[h>>2]=j;if((c[k>>2]|0)!=(d|0)){c[e>>2]=4;b=0;break}if(f>>>0>0|(f|0)==0&b>>>0>65535|(g|0)==34){c[e>>2]=4;b=-1;break}else{b=b&65535;break}}else{c[e>>2]=4;b=0}}while(0);i=l;return b|0}function ew(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;k=i;i=i+16|0;j=k;do{if((a|0)!=(b|0)){g=ck()|0;h=c[g>>2]|0;c[g>>2]=0;a=Yj(a,j,e,Xo()|0)|0;e=D;f=c[g>>2]|0;if(!f)c[g>>2]=h;if((c[j>>2]|0)!=(b|0)){c[d>>2]=4;e=0;a=0;break}if((f|0)==34){c[d>>2]=4;j=(e|0)>0|(e|0)==0&a>>>0>0;D=j?2147483647:-2147483648;i=k;return(j?-1:0)|0}}else{c[d>>2]=4;e=0;a=0}}while(0);D=e;i=k;return a|0}function fw(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;k=i;i=i+16|0;j=k;a:do{if((a|0)==(b|0)){c[d>>2]=4;a=0}else{g=ck()|0;h=c[g>>2]|0;c[g>>2]=0;a=Yj(a,j,e,Xo()|0)|0;e=D;f=c[g>>2]|0;if(!f)c[g>>2]=h;if((c[j>>2]|0)!=(b|0)){c[d>>2]=4;a=0;break}do{if((f|0)==34){c[d>>2]=4;if((e|0)>0|(e|0)==0&a>>>0>0){a=2147483647;break a}}else{if((e|0)<-1|(e|0)==-1&a>>>0<2147483648){c[d>>2]=4;break}if((e|0)>0|(e|0)==0&a>>>0>2147483647){c[d>>2]=4;a=2147483647;break a}else break a}}while(0);a=-2147483648}}while(0);i=k;return a|0}function gw(){}function hw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return(D=d,a-c>>>0|0)|0}function iw(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;if((e|0)>=20){d=d&255;h=b&3;i=d|d<<8|d<<16|d<<24;g=f&~3;if(h){h=b+4-h|0;while((b|0)<(h|0)){a[b>>0]=d;b=b+1|0}}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return b-e|0}function jw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;c=a+c>>>0;return(D=b+d+(c>>>0>>0|0)>>>0,c|0)|0}function kw(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>>c;return a>>>c|(b&(1<>>c-32|0}function lw(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;if((e|0)>=4096)return Wa(b|0,d|0,e|0)|0;f=b|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}while((e|0)>=4){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0;e=e-4|0}}while((e|0)>0){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}return f|0}function mw(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b<>>32-c;return a<0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else lw(b,c,d)|0;return b|0}function ow(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){D=b>>c;return a>>>c|(b&(1<>c-32|0}function pw(b){b=b|0;var c=0;c=a[m+(b&255)>>0]|0;if((c|0)<8)return c|0;c=a[m+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[m+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return(a[m+(b>>>24)>>0]|0)+24|0}function qw(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;e=b&65535;c=$(e,f)|0;d=a>>>16;a=(c>>>16)+($(e,d)|0)|0;e=b>>>16;b=$(e,f)|0;return(D=(a>>>16)+($(e,d)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|c&65535|0)|0}function rw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=hw(j^a,i^b,j,i)|0;g=D;a=f^j;b=e^i;return hw((ww(h,g,hw(f^c,e^d,f,e)|0,D,0)|0)^a,D^b,a,b)|0}function sw(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;f=i;i=i+16|0;j=f|0;h=b>>31|((b|0)<0?-1:0)<<1;g=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;l=e>>31|((e|0)<0?-1:0)<<1;k=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;a=hw(h^a,g^b,h,g)|0;b=D;ww(a,b,hw(l^d,k^e,l,k)|0,D,j)|0;e=hw(c[j>>2]^h,c[j+4>>2]^g,h,g)|0;d=D;i=f;return(D=d,e)|0}function tw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;c=qw(e,f)|0;a=D;return(D=($(b,f)|0)+($(d,e)|0)+a|a&0,c|0|0)|0}function uw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return ww(a,b,c,d,0)|0}function vw(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+16|0;f=g|0;ww(a,b,d,e,f)|0;i=g;return(D=c[f+4>>2]|0,c[f>>2]|0)|0}function ww(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=a;j=b;k=j;h=d;n=e;i=n;if(!k){g=(f|0)!=0;if(!i){if(g){c[f>>2]=(l>>>0)%(h>>>0);c[f+4>>2]=0}n=0;f=(l>>>0)/(h>>>0)>>>0;return(D=n,f)|0}else{if(!g){n=0;f=0;return(D=n,f)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;f=0;return(D=n,f)|0}}g=(i|0)==0;do{if(h){if(!g){g=(ba(i|0)|0)-(ba(k|0)|0)|0;if(g>>>0<=31){m=g+1|0;i=31-g|0;b=g-31>>31;h=m;a=l>>>(m>>>0)&b|k<>>(m>>>0)&b;g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;n=0;f=0;return(D=n,f)|0}g=h-1|0;if(g&h){i=(ba(h|0)|0)+33-(ba(k|0)|0)|0;p=64-i|0;m=32-i|0;j=m>>31;o=i-32|0;b=o>>31;h=i;a=m-1>>31&k>>>(o>>>0)|(k<>>(i>>>0))&b;b=b&k>>>(i>>>0);g=l<>>(o>>>0))&j|l<>31;break}if(f){c[f>>2]=g&l;c[f+4>>2]=0}if((h|0)==1){o=j|b&0;p=a|0|0;return(D=o,p)|0}else{p=pw(h|0)|0;o=k>>>(p>>>0)|0;p=k<<32-p|l>>>(p>>>0)|0;return(D=o,p)|0}}else{if(g){if(f){c[f>>2]=(k>>>0)%(h>>>0);c[f+4>>2]=0}o=0;p=(k>>>0)/(h>>>0)>>>0;return(D=o,p)|0}if(!l){if(f){c[f>>2]=0;c[f+4>>2]=(k>>>0)%(i>>>0)}o=0;p=(k>>>0)/(i>>>0)>>>0;return(D=o,p)|0}g=i-1|0;if(!(g&i)){if(f){c[f>>2]=a|0;c[f+4>>2]=g&k|b&0}o=0;p=k>>>((pw(i|0)|0)>>>0);return(D=o,p)|0}g=(ba(i|0)|0)-(ba(k|0)|0)|0;if(g>>>0<=30){b=g+1|0;i=31-g|0;h=b;a=k<>>(b>>>0);b=k>>>(b>>>0);g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;o=0;p=0;return(D=o,p)|0}}while(0);if(!h){k=i;j=0;i=0}else{m=d|0|0;l=n|e&0;k=jw(m|0,l|0,-1,-1)|0;d=D;j=i;i=0;do{e=j;j=g>>>31|j<<1;g=i|g<<1;e=a<<1|e>>>31|0;n=a>>>31|b<<1|0;hw(k,d,e,n)|0;p=D;o=p>>31|((p|0)<0?-1:0)<<1;i=o&1;a=hw(e,n,o&m,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&l)|0;b=D;h=h-1|0}while((h|0)!=0);k=j;j=0}h=0;if(f){c[f>>2]=a;c[f+4>>2]=b}o=(g|0)>>>31|(k|h)<<1|(h<<1|g>>>31)&0|j;p=(g<<1|0>>>31)&-2|i;return(D=o,p)|0}function xw(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return yb[a&15](b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function yw(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;zb[a&15](b|0,c|0,d|0,e|0,f|0)}function zw(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=+g;return Ab[a&3](b|0,c|0,d|0,e|0,f|0,+g)|0}function Aw(a,b){a=a|0;b=b|0;Bb[a&255](b|0)}function Bw(a,b,c){a=a|0;b=b|0;c=c|0;Cb[a&127](b|0,c|0)}function Cw(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return Db[a&63](b|0,c|0,d|0,e|0,f|0,g|0)|0}function Dw(a,b){a=a|0;b=b|0;return Eb[a&127](b|0)|0}function Ew(a,b,c,d,e,f,g,h,i,j,k,l){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;return Fb[a&3](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0,j|0,k|0,l|0)|0}function Fw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Gb[a&63](b|0,c|0,d|0)|0}function Gw(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;Hb[a&3](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0,j|0,k|0,l|0,m|0,n|0,o|0,p|0)}function Hw(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;Ib[a&15](b|0,c|0,d|0,e|0,f|0,g|0)}function Iw(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;Jb[a&7](b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Jw(a,b,c,d,e,f,g,h,i,j,k){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;Kb[a&7](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0,j|0,k|0)}function Kw(a,b,c){a=a|0;b=b|0;c=c|0;return Lb[a&63](b|0,c|0)|0}function Lw(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Mb[a&31](b|0,c|0,d|0,e|0,f|0)|0}function Mw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return+Nb[a&3](b|0,c|0,d|0)}function Nw(a){a=a|0;return Ob[a&15]()|0}function Ow(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Pb[a&31](b|0,c|0,d|0,e|0)|0}function Pw(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Qb[a&15](b|0,c|0,d|0)}function Qw(a){a=a|0;Rb[a&7]()}function Rw(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;return Sb[a&15](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0)|0}function Sw(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;return Tb[a&7](b|0,c|0,d|0,e|0,+f)|0}function Tw(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;Ub[a&63](b|0,c|0,d|0,e|0)}function Uw(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ca(0);return 0}function Vw(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ca(1)}function Ww(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;ca(2);return 0}function Xw(a){a=a|0;ca(3)}function Yw(a,b){a=a|0;b=b|0;ca(4)}function Zw(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ca(5);return 0}function _w(a){a=a|0;ca(6);return 0}function $w(a){a=a|0;return cb(a|0)|0}function ax(a){a=a|0;return rb(a|0)|0}function bx(a){a=a|0;return hb(a|0)|0}function cx(a,b,c,d,e,f,g,h,i,j,k){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;ca(7);return 0}function dx(a,b,c){a=a|0;b=b|0;c=c|0;ca(8);return 0}function ex(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;ca(9)}function fx(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ca(10)}function gx(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ca(11)}function hx(a,b,c,d,e,f,g,h,i,j){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;ca(12)}function ix(a,b){a=a|0;b=b|0;ca(13);return 0}function jx(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ca(14);return 0}function kx(a,b,c){a=a|0;b=b|0;c=c|0;ca(15);return 0.0}function lx(){ca(16);return 0}function mx(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ca(17);return 0}function nx(a,b,c){a=a|0;b=b|0;c=c|0;ca(18)}function ox(a,b,c){a=a|0;b=b|0;c=c|0;lb(a|0,b|0,c|0)}function px(){ca(19)}function qx(){pb()}function rx(){Xa()}function sx(){mb()}function tx(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ca(20);return 0}function ux(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=+e;ca(21);return 0}function vx(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ca(22)}function di(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+32|0;k=m;Ei(k,255,0);l=b+152|0;if(((c[k+4>>2]|0)==(c[l>>2]|0)?(c[k+8>>2]|0)==(c[b+156>>2]|0):0)?(c[k+12>>2]|0)==(c[b+160>>2]|0):0){l=c[8900]|0;c[b+4580>>2]=l+(((c[8901]|0)-l|0)>>>1);i=m;return}e=b+4584|0;f=b+4588|0;g=c[f>>2]|0;d=c[e>>2]|0;h=g-d|0;if(h>>>0>=512){if(h>>>0>512?(j=d+512|0,(g|0)!=(j|0)):0)c[f>>2]=j}else{ie(e,512-h|0);d=c[e>>2]|0}k=b+4580|0;c[k>>2]=d+256;j=b+160|0;g=b+156|0;h=-256;while(1){d=c[j>>2]|0;if((h|0)>(0-d|0)){e=c[g>>2]|0;if((h|0)>(0-e|0)){f=c[l>>2]|0;if((h|0)>(0-f|0))if((h|0)>=0){if((h|0)<1){a[(c[k>>2]|0)+h>>0]=0;h=1;continue}if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1}else d=-1;else d=-2}else d=-3}else d=-4;a[(c[k>>2]|0)+h>>0]=d;h=h+1|0;if((h|0)==256)break}i=m;return}function ei(a){a=a|0;var b=0,d=0;c[a>>2]=35660;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}a=a+88|0;b=c[a>>2]|0;c[a>>2]=0;if(!b)return;Bb[c[(c[b>>2]|0)+4>>2]&255](b);return}function fi(a){a=a|0;var b=0,d=0;c[a>>2]=35660;b=c[a+4608>>2]|0;if(b){d=a+4612|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}c[a>>2]=36736;b=c[a+92>>2]|0;if(b){d=a+96|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b)}d=a+88|0;b=c[d>>2]|0;c[d>>2]=0;if(!b){cj(a);return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);cj(a);return}function gi(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;w=i;i=i+352|0;x=w+328|0;y=w+192|0;e=w+343|0;f=w+342|0;g=w+341|0;h=w+340|0;r=w+176|0;k=w+168|0;l=w+160|0;m=w+152|0;v=w;t=w+136|0;if((c[b+28>>2]|0)!=0?(c[b+20>>2]|0)!=1:0){s=b+4|0;u=b+32|0;j=c[u>>2]|0;if(!j){b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[e>>0]|0;Aa(44,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}b=c[b+12>>2]|0;if((b|0)==8)switch(j|0){case 1:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[f>>0]|0;Aa(45,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[g>>0]|0;Aa(46,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(48)|0;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];a[x>>0]=a[h>>0]|0;Aa(47,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=y+56|0;g=y+4|0;c[y>>2]=36160;c[j>>2]=36180;o=0;ia(62,y+56|0,g|0);w=o;o=0;if(w&1){z=Na()|0;fn(j);Ya(z|0)}c[y+128>>2]=0;c[y+132>>2]=-1;c[y>>2]=36200;c[y+56>>2]=36220;o=0;ha(180,g|0);w=o;o=0;do{if(w&1)b=Na()|0;else{c[g>>2]=36236;h=y+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[y+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);w=o;o=0;if(w&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,y|0,49007,21)|0;x=o;o=0;do{if((!(x&1)?(o=0,p=ra(36,b|0,c[u>>2]|0)|0,x=o,o=0,!(x&1)):0)?(o=0,ma(28,p|0,50997,18)|0,x=o,o=0,!(x&1)):0){f=Ma(16)|0;o=0;ia(64,r|0,g|0);x=o;o=0;if(!(x&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,r|0);x=o;o=0;if(x&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(r);if(!e)break}else b=Na()|0;La(f|0)}else z=34}while(0);if((z|0)==34)b=Na()|0;c[y>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}if((b|0)<=8){b=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,b|0,8,35648);z=o;o=0;if(!(z&1))lb(b|0,824,96);z=Na()|0;La(b|0);Ya(z|0)}e=16-b|0;switch(j|0){case 1:{b=bj(60)|0;c[k>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[k>>2];c[x+4>>2]=c[k+4>>2];Aa(41,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 2:{b=bj(60)|0;c[l>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[l>>2];c[x+4>>2]=c[l+4>>2];Aa(42,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}case 3:{b=bj(60)|0;c[m>>2]=e;o=0;c[y>>2]=c[d>>2];c[y+4>>2]=c[d+4>>2];c[y+8>>2]=c[d+8>>2];c[x>>2]=c[m>>2];c[x+4>>2]=c[m+4>>2];Aa(43,b|0,y|0,s|0,x|0);z=o;o=0;if(!(z&1)){z=b;i=w;return z|0}z=Na()|0;cj(b);Ya(z|0)}default:{j=v+56|0;g=v+4|0;c[v>>2]=36160;c[j>>2]=36180;o=0;ia(62,v+56|0,g|0);y=o;o=0;if(y&1){z=Na()|0;fn(j);Ya(z|0)}c[v+128>>2]=0;c[v+132>>2]=-1;c[v>>2]=36200;c[v+56>>2]=36220;o=0;ha(180,g|0);y=o;o=0;do{if(y&1)b=Na()|0;else{c[g>>2]=36236;h=v+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[v+52>>2]=16;c[x>>2]=0;c[x+4>>2]=0;c[x+8>>2]=0;o=0;ia(63,g|0,x|0);y=o;o=0;if(y&1){b=Na()|0;Im(x);Im(h);nn(g);break}Im(x);o=0;b=ma(28,v|0,49007,21)|0;y=o;o=0;do{if((!(y&1)?(o=0,q=ra(36,b|0,c[u>>2]|0)|0,y=o,o=0,!(y&1)):0)?(o=0,ma(28,q|0,50997,18)|0,y=o,o=0,!(y&1)):0){f=Ma(16)|0;o=0;ia(64,t|0,g|0);y=o;o=0;if(!(y&1)){if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;Aa(36,f|0,9,35648,t|0);y=o;o=0;if(y&1)e=1;else{o=0;wa(6,f|0,824,96);o=0;e=0}b=Na()|0;Im(t);if(!e)break}else b=Na()|0;La(f|0)}else z=64}while(0);if((z|0)==64)b=Na()|0;c[v>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(j);z=b;Ya(z|0)}}while(0);z=b;fn(j);Ya(z|0)}}}e=c[d+4>>2]|0;f=bj(16)|0;b=c[b+16>>2]|0;if(!e){z=c[d>>2]|0;c[f>>2]=36132;c[f+4>>2]=z;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}else{c[f>>2]=36108;c[f+4>>2]=e;c[f+8>>2]=1;c[f+12>>2]=b;z=f;i=w;return z|0}return 0}function hi(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;k=i;i=i+32|0;m=k;Ei(m,c[d+128>>2]|0,c[d+136>>2]|0);l=c[e+4>>2]|0;j=c[e+8>>2]|0;j=(j|0)==0?c[m+8>>2]|0:j;h=c[e+12>>2]|0;h=(h|0)==0?c[m+12>>2]|0:h;f=c[e+16>>2]|0;g=c[m+16>>2]|0;c[d+176>>2]=(l|0)==0?c[m+4>>2]|0:l;c[d+180>>2]=j;c[d+184>>2]=h;pi(d);h=d+132|0;e=(c[h>>2]|0)+32|0;e=(e|0)<128?2:(e|0)/64|0;j=0;do{c[d+188+(j*12|0)>>2]=e;c[d+188+(j*12|0)+4>>2]=0;b[d+188+(j*12|0)+8>>1]=0;b[d+188+(j*12|0)+10>>1]=1;j=j+1|0}while((j|0)!=365);l=(c[h>>2]|0)+32|0;l=(l|0)<128?2:(l|0)/64|0;m=((f|0)==0?g:f)&255;c[d+4568>>2]=l;c[d+4572>>2]=0;a[d+4576>>0]=m;a[d+4577>>0]=1;a[d+4578>>0]=0;c[d+4580>>2]=l;c[d+4584>>2]=1;a[d+4588>>0]=m;a[d+4589>>0]=1;a[d+4590>>0]=0;c[d+4592>>2]=0;i=k;return}function ii(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=b+88|0;h=c[d>>2]|0;c[d>>2]=0;d=c[i>>2]|0;c[i>>2]=h;if(d)Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=f+4|0;h=c[i>>2]|0;a[b+4620>>0]=g&1;d=b+156|0;c[d>>2]=c[e>>2];c[d+4>>2]=c[e+4>>2];c[d+8>>2]=c[e+8>>2];c[d+12>>2]=c[e+12>>2];Wd(b,f);ji(b);d=c[b+116>>2]|0;b=c[b+112>>2]|0;while(1){g=d+-1|0;e=(a[g>>0]|0)==-1?7:8;if((b|0)<(e|0))break;else{d=g;b=b-e|0}}d=d-h|0;g=c[i>>2]|0;if(!g)return;c[i>>2]=g+d;f=f+8|0;c[f>>2]=(c[f>>2]|0)-d;return}function ji(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;A=i;i=i+32|0;C=A+12|0;z=A;k=b+172|0;y=(c[k>>2]|0)+4|0;if((c[b+28>>2]|0)==1)l=c[b+20>>2]|0;else l=1;d=$(l<<1,y)|0;c[C>>2]=0;D=C+4|0;c[D>>2]=0;c[C+8>>2]=0;a:do{if(d){if(!((d|0)<0?(o=0,ha(178,C|0),B=o,o=0,B&1):0))x=6;if((x|0)==6?(o=0,e=ka(67,d|0)|0,B=o,o=0,!(B&1)):0){c[D>>2]=e;c[C>>2]=e;c[C+8>>2]=e+d;while(1){a[e>>0]=0;e=(c[D>>2]|0)+1|0;c[D>>2]=e;d=d+-1|0;if(!d)break a}}e=Na()|0;d=c[C>>2]|0;if(!d)Ya(e|0);if((c[D>>2]|0)!=(d|0))c[D>>2]=d;cj(d);Ya(e|0)}}while(0);c[z>>2]=0;B=z+4|0;c[B>>2]=0;c[z+8>>2]=0;do{if(!l)x=19;else{if(!(l>>>0>1073741823?(o=0,ha(178,z|0),w=o,o=0,w&1):0))x=17;if((x|0)==17?(f=l<<2,o=0,g=ka(67,f|0)|0,w=o,o=0,!(w&1)):0){c[z>>2]=g;x=g+(l<<2)|0;c[z+8>>2]=x;iw(g|0,0,f|0)|0;c[B>>2]=x;x=19;break}e=Na()|0;d=c[z>>2]|0;f=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}}while(0);if((x|0)==19){m=b+8|0;d=c[m>>2]|0;b:do{if((d|0)>0){n=b+4596|0;p=$(l,y)|0;q=p+1|0;r=b+4600|0;s=b+160|0;t=b+168|0;u=b+164|0;v=b+156|0;w=b+88|0;j=b+4592|0;if((l|0)>0)h=0;else{h=0;while(1){g=c[C>>2]|0;e=g+1|0;c[n>>2]=e;f=g+q|0;c[r>>2]=f;if(!(h&1))e=q;else{c[n>>2]=f;c[r>>2]=e;e=1}l=c[s>>2]|0;if((l|0)<=(h|0)?(h|0)<((c[t>>2]|0)+l|0):0){l=c[w>>2]|0;o=0;Aa(c[(c[l>>2]|0)+8>>2]|0,l|0,g+(e+((c[v>>2]|0)-p))|0,c[u>>2]|0,y|0);l=o;o=0;if(l&1)break;d=c[m>>2]|0}h=h+1|0;if((h|0)>=(d|0)){x=50;break b}}e=Na()|0;break}c:while(1){e=c[C>>2]|0;d=e+1|0;c[n>>2]=d;e=e+q|0;c[r>>2]=e;if(h&1){c[n>>2]=e;c[r>>2]=d;d=e}g=c[z>>2]|0;e=d;f=0;do{c[j>>2]=c[g+(f<<2)>>2];x=c[k>>2]|0;a[e+x>>0]=a[e+(x+-1)>>0]|0;a[(c[r>>2]|0)+-1>>0]=a[c[n>>2]>>0]|0;o=0;ia(83,b|0,0);x=o;o=0;if(x&1){x=38;break c}g=c[z>>2]|0;c[g+(f<<2)>>2]=c[j>>2];e=(c[n>>2]|0)+y|0;c[n>>2]=e;d=c[r>>2]|0;c[r>>2]=d+y;f=f+1|0}while((f|0)<(l|0));x=c[s>>2]|0;if(((x|0)<=(h|0)?(h|0)<((c[t>>2]|0)+x|0):0)?(x=c[w>>2]|0,o=0,Aa(c[(c[x>>2]|0)+8>>2]|0,x|0,d+(y+((c[v>>2]|0)-p))|0,c[u>>2]|0,y|0),x=o,o=0,x&1):0){x=30;break}h=h+1|0;if((h|0)>=(c[m>>2]|0)){x=50;break b}}if((x|0)==30){e=Na()|0;break}else if((x|0)==38){e=Na()|0;break}}else x=50}while(0);do{if((x|0)==50){o=0;ha(183,b|0);b=o;o=0;if(b&1){e=Na()|0;break}d=c[z>>2]|0;e=d;if(d){f=c[B>>2]|0;if((f|0)!=(d|0))c[B>>2]=f+(~((f+-4-e|0)>>>2)<<2);cj(d)}d=c[C>>2]|0;if(!d){i=A;return}if((c[D>>2]|0)!=(d|0))c[D>>2]=d;cj(d);i=A;return}}while(0);d=c[z>>2]|0;f=d;if(d){g=c[B>>2]|0;if((g|0)!=(d|0))c[B>>2]=g+(~((g+-4-f|0)>>>2)<<2);cj(d)}}d=c[C>>2]|0;if(!d)Ya(e|0);if((c[D>>2]|0)!=(d|0))c[D>>2]=d;cj(d);Ya(e|0)}function ki(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;p=b+4596|0;f=c[p>>2]|0;t=b+172|0;e=c[t>>2]|0;if((e|0)<=0)return;q=b+4600|0;r=b+4604|0;s=b+4592|0;k=f;i=d[f+-1>>0]|0;f=d[f>>0]|0;o=0;while(1){m=c[q>>2]|0;j=a[m+(o+-1)>>0]|0;n=j&255;h=o+1|0;g=d[k+h>>0]|0;l=c[r>>2]|0;k=f-i|0;i=i-n|0;l=((((a[l+(g-f)>>0]|0)*9|0)+(a[l+k>>0]|0)|0)*9|0)+(a[l+i>>0]|0)|0;m=m+o|0;if(!l){e=mi(b,j,m,e-o|0)|0;f=e+o|0;if((f|0)!=(c[t>>2]|0)){n=ni(b,n,d[(c[p>>2]|0)+f>>0]|0)|0;a[(c[q>>2]|0)+f>>0]=n;n=c[s>>2]|0;c[s>>2]=(n|0)<1?0:n+-1|0;e=e+1|0}h=e+o|0;g=c[p>>2]|0;f=d[g+(h+-1)>>0]|0;g=d[g+h>>0]|0}else{e=f-n>>31;if((e^i|0)<0)e=f;else e=n+((e^k|0)<0?0:k)|0;n=li(b,l,d[m>>0]|0,e,0)|0;a[(c[q>>2]|0)+o>>0]=n}e=c[t>>2]|0;if((e|0)<=(h|0))break;k=c[p>>2]|0;i=f;f=g;o=h}return}function li(d,e,f,g,h){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,p=0,q=0,r=0,s=0,t=0;t=e>>31;l=(t^e)-t|0;r=d+188+(l*12|0)+10|0;f=b[r>>1]|0;q=d+188+(l*12|0)|0;h=c[q>>2]|0;if((f|0)<(h|0))if((f<<1|0)<(h|0))if((f<<2|0)<(h|0))if((f<<3|0)<(h|0))if((f<<4|0)<(h|0)){e=5;while(1)if((f<>1]^t)-t+g|0;s=d+128|0;h=c[s>>2]|0;if((f&h|0)==(f|0))m=f;else m=h&~(f>>31);f=d+112|0;if((c[f>>2]|0)<8)ge(d);h=d+108|0;g=c[h>>2]|0;i=g>>>24;j=c[2832+(e<<11)+(i<<3)+4>>2]|0;if(!j){k=c[d+148>>2]|0;h=c[d+140>>2]|0;f=Jg(d)|0;if((f|0)<(k+-1-h|0)){if(e)f=(Kg(d,e)|0)+(f<>31^f>>1;if((((f|0)>-1?f:0-f|0)|0)>65535){f=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,f|0,5,35648);d=o;o=0;if(d&1){d=Na()|0;La(f|0);Ya(d|0)}else lb(f|0,824,96)}}else{c[f>>2]=(c[f>>2]|0)-j;c[h>>2]=g<>2]|0}k=d+136|0;g=c[k>>2]|0;if(!e){if(!g)h=(c[d+188+(l*12|0)+4>>2]<<1)+-1+(b[r>>1]|0)>>31;else h=0;j=h^f}else j=f;e=c[d+152>>2]|0;h=(c[q>>2]|0)+((j|0)>-1?j:0-j|0)|0;i=d+188+(l*12|0)+4|0;f=(c[i>>2]|0)+($(g<<1|1,j)|0)|0;g=b[r>>1]|0;if((g|0)==(e|0)){h=h>>1;f=f>>1;g=e>>1}c[q>>2]=h;e=g+1|0;b[r>>1]=e;h=e+f|0;if((h|0)>=1){if((f|0)>0){f=f-e|0;r=b[p>>1]|0;b[p>>1]=(r<<16>>16<127&1)+(r&65535);f=(f|0)>0?0:f}}else{f=b[p>>1]|0;b[p>>1]=(f&65535)-(f<<16>>16>-128&1);f=(h|0)>(~g|0)?h:0-g|0}c[i>>2]=f;e=c[k>>2]|0;g=e<<1|1;h=($(g,(j^t)-t|0)|0)+m|0;if((h|0)>=(0-e|0)){f=c[s>>2]|0;if((f+e|0)<(h|0))h=h-($(c[d+132>>2]|0,g)|0)|0}else{h=($(c[d+132>>2]|0,g)|0)+h|0;f=c[s>>2]|0}if((h&f|0)==(h|0)){d=h;d=d&255;return d|0}d=f&~(h>>31);d=d&255;return d|0}function mi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,p=0,q=0;j=b+112|0;k=b+108|0;l=b+4592|0;g=c[j>>2]|0;h=0;while(1){if((g|0)<1){ge(b);g=c[j>>2]|0}i=c[k>>2]|0;g=g+-1|0;c[j>>2]=g;c[k>>2]=i<<1;if((i|0)>=0){m=8;break}i=c[l>>2]|0;p=1<>2];q=f-h|0;q=(p|0)<(q|0)?p:q;h=q+h|0;if((q|0)==(p|0))c[l>>2]=(i|0)>30?31:i+1|0;if((h|0)==(f|0)){g=f;break}}if((m|0)==8)if((h|0)!=(f|0)){g=c[l>>2]|0;if((g+-4|0)>>>0<28)g=Kg(b,c[36476+(g<<2)>>2]|0)|0;else g=0;g=g+h|0;if((g|0)>(f|0)){g=Ma(16)|0;if((a[8]|0)==0?(Ha(8)|0)!=0:0){kb(72,35648,n|0)|0;Pa(8)}o=0;wa(7,g|0,5,35648);q=o;o=0;if(q&1){q=Na()|0;La(g|0);Ya(q|0)}else lb(g|0,824,96)}}else g=f;if((g|0)<=0)return g|0;iw(e|0,d|0,g|0)|0;return g|0}function ni(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;g=b-d|0;h=a+128|0;e=a+136|0;if((((g|0)>-1?g:0-g|0)|0)>(c[e>>2]|0)){b=$(oi(a,a+4568|0)|0,d-b>>31|1)|0;f=c[e>>2]|0;g=f<<1|1;b=($(b,g)|0)+d|0;if((b|0)>=(0-f|0)){e=c[h>>2]|0;if((e+f|0)<(b|0))b=b-($(c[a+132>>2]|0,g)|0)|0}else{b=($(c[a+132>>2]|0,g)|0)+b|0;e=c[h>>2]|0}if((b&e|0)==(b|0)){a=b;a=a&255;return a|0}a=e&~(b>>31);a=a&255;return a|0}else{d=oi(a,a+4580|0)|0;g=c[e>>2]|0;f=g<<1|1;b=($(f,d)|0)+b|0;if((b|0)>=(0-g|0)){e=c[h>>2]|0;if((e+g|0)<(b|0))b=b-($(c[a+132>>2]|0,f)|0)|0}else{b=($(c[a+132>>2]|0,f)|0)+b|0;e=c[h>>2]|0}if((b&e|0)==(b|0)){a=b;a=a&255;return a|0}a=e&~(b>>31);a=a&255;return a|0}return 0}function oi(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;m=e+9|0;f=d[m>>0]|0;i=e+4|0;h=($(f>>>1,c[i>>2]|0)|0)+(c[e>>2]|0)|0;if((f|0)<(h|0)){g=0;do{f=f<<1;g=g+1|0}while((f|0)<(h|0))}else g=0;j=c[b+148>>2]|0;k=c[36476+(c[b+4592>>2]<<2)>>2]|0;f=c[b+140>>2]|0;h=Jg(b)|0;do{if((h|0)<(j+-2-k-f|0))if(!g){g=c[i>>2]|0;b=g+h|0;f=b&1;b=(f+b|0)/2|0;l=8;break}else{k=(Kg(b,g)|0)+(h<>2]|0;h=k+g|0;j=h&1;f=j;i=1;h=(j+h|0)/2|0;break}else{h=(Kg(b,f)|0)+1|0;j=c[i>>2]|0;b=h+j|0;f=b&1;b=(f+b|0)/2|0;if(!g){g=j;l=8}else{k=h;i=1;h=b;g=j}}}while(0);if((l|0)==8){k=h;i=d[e+10>>0]<<1>>>0>=(d[m>>0]|0)>>>0;h=b}h=(f|0)!=0^i?h:0-h|0;if((h|0)<0){l=e+10|0;a[l>>0]=(d[l>>0]|0)+1}f=(k+1-g>>1)+(c[e>>2]|0)|0;c[e>>2]=f;g=a[m>>0]|0;if(g<<24>>24!=(a[e+8>>0]|0)){e=g;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}c[e>>2]=f>>1;l=(g&255)>>>1;a[m>>0]=l;e=e+10|0;a[e>>0]=(d[e>>0]|0)>>>1;e=l;e=e&255;e=e+1|0;e=e&255;a[m>>0]=e;return h|0}function pi(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;f=p;o=b+136|0;a:do{if(!(c[o>>2]|0)){e=c[b+128>>2]|0;d=b+144|0;if((((e|0)==((1<>2])+-1|0)?(Ei(f,e,0),(c[f+4>>2]|0)==(c[b+176>>2]|0)):0)?(c[f+8>>2]|0)==(c[b+180>>2]|0):0)?(c[f+12>>2]|0)==(c[b+184>>2]|0):0)switch(c[d>>2]|0){case 8:{o=c[8900]|0;c[b+4604>>2]=o+(((c[8901]|0)-o|0)>>>1);i=p;return}case 10:{o=c[8903]|0;c[b+4604>>2]=o+(((c[8904]|0)-o|0)>>>1);i=p;return}case 12:{o=c[8906]|0;c[b+4604>>2]=o+(((c[8907]|0)-o|0)>>>1);i=p;return}case 16:{o=c[8909]|0;c[b+4604>>2]=o+(((c[8910]|0)-o|0)>>>1);i=p;return}default:break a}}else d=b+144|0}while(0);n=1<>2];e=b+4608|0;f=n<<1;g=b+4612|0;h=c[g>>2]|0;d=c[e>>2]|0;j=h-d|0;if(f>>>0<=j>>>0){if(f>>>0>>0?(k=d+f|0,(h|0)!=(k|0)):0)c[g>>2]=k}else{ie(e,f-j|0);d=c[e>>2]|0}m=b+4604|0;c[m>>2]=d+n;d=0-n|0;if((n|0)<=(d|0)){i=p;return}k=b+184|0;l=b+180|0;j=b+176|0;h=d;do{d=c[k>>2]|0;if((h|0)>(0-d|0)){e=c[l>>2]|0;if((h|0)>(0-e|0)){f=c[j>>2]|0;if((h|0)>(0-f|0)){g=c[o>>2]|0;if((h|0)>=(0-g|0))if((g|0)<(h|0))if((f|0)<=(h|0))if((e|0)>(h|0))d=2;else d=(d|0)>(h|0)?3:4;else d=1;else d=0;else d=-1}else d=-2}else d=-3}else d=-4;a[(c[m>>2]|0)+h>>0]=d;h=h+1|0}while((h|0)!=(n|0));i=p;return}function qi(a){a=a|0;cj(a);return}function ri(a){a=a|0;return 50767}function si(a,b,c){a=a|0;b=b|0;c=c|0;Gm(a,50754,12);return}function ti(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0;s=i;i=i+16|0;t=s;c[t>>2]=0;u=t+4|0;c[u>>2]=0;c[t+8>>2]=0;q=t+8|0;o=0;g=ka(67,1)|0;p=o;o=0;a:do{if((!(p&1)?(p=g+1|0,a[g>>0]=e,c[t>>2]=g,c[u>>2]=p,c[q>>2]=p,o=0,ia(84,t|0,d&65535|0),p=o,o=0,!(p&1)):0)?(o=0,ia(84,t|0,b&65535|0),p=o,o=0,!(p&1)):0){m=f&255;g=c[u>>2]|0;e=c[q>>2]|0;if(g>>>0>=e>>>0){d=c[t>>2]|0;b=d;j=g-b+1|0;if((j|0)<0){o=0;ha(178,t|0);p=o;o=0;if(p&1){r=52;break}b=c[t>>2]|0;e=c[q>>2]|0;d=b}l=d;g=e-l|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?j:g;e=c[u>>2]|0;k=e-l|0;if(!g){g=0;j=0}else r=12}else{k=c[u>>2]|0;g=2147483647;e=k;k=k-l|0;r=12}if((r|0)==12){o=0;j=ka(67,g|0)|0;p=o;o=0;if(p&1){r=52;break}}a[j+k>>0]=m;n=e-l|0;p=j+(k-n)|0;lw(p|0,d|0,n|0)|0;c[t>>2]=p;c[u>>2]=j+(k+1);c[q>>2]=j+g;if(b)cj(b)}else{a[g>>0]=m;c[u>>2]=(c[u>>2]|0)+1}b:do{if((f|0)>0){p=0;while(1){p=p+1|0;n=p&255;g=c[u>>2]|0;d=c[q>>2]|0;if(g>>>0>=d>>>0){b=c[t>>2]|0;e=b;j=g-e+1|0;if((j|0)<0){o=0;ha(178,t|0);m=o;o=0;if(m&1)break;b=c[t>>2]|0;e=b;d=c[q>>2]|0}m=b;g=d-m|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?j:g;d=c[u>>2]|0;k=d-m|0;if(!g){l=0;j=0}else r=25}else{k=c[u>>2]|0;g=2147483647;d=k;k=k-m|0;r=25}if((r|0)==25){r=0;o=0;j=ka(67,g|0)|0;l=o;o=0;if(l&1)break;else l=g}a[j+k>>0]=n;g=j+(k+1)|0;m=d-m|0;n=j+(k-m)|0;lw(n|0,b|0,m|0)|0;c[t>>2]=n;c[u>>2]=g;c[q>>2]=j+l;if(e){cj(e);g=c[u>>2]|0}}else{a[g>>0]=n;g=(c[u>>2]|0)+1|0;c[u>>2]=g}e=c[q>>2]|0;if(g>>>0>=e>>>0){d=c[t>>2]|0;b=d;j=g-b+1|0;if((j|0)<0){o=0;ha(178,t|0);n=o;o=0;if(n&1)break;b=c[t>>2]|0;e=c[q>>2]|0;d=b}m=d;g=e-m|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?j:g;j=c[u>>2]|0;k=j-m|0;if(!g){l=0;e=0}else r=36}else{k=c[u>>2]|0;g=2147483647;j=k;k=k-m|0;r=36}if((r|0)==36){r=0;o=0;e=ka(67,g|0)|0;n=o;o=0;if(n&1)break;else l=g}a[e+k>>0]=17;g=e+(k+1)|0;m=j-m|0;n=e+(k-m)|0;lw(n|0,d|0,m|0)|0;c[t>>2]=n;c[u>>2]=g;c[q>>2]=e+l;if(b){cj(b);g=c[u>>2]|0}}else{a[g>>0]=17;g=(c[u>>2]|0)+1|0;c[u>>2]=g}e=c[q>>2]|0;if(g>>>0>=e>>>0){d=c[t>>2]|0;b=d;j=g-b+1|0;if((j|0)<0){o=0;ha(178,t|0);n=o;o=0;if(n&1)break;b=c[t>>2]|0;e=c[q>>2]|0;d=b}l=d;g=e-l|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?j:g;e=c[u>>2]|0;k=e-l|0;if(!g){g=0;j=0}else r=48}else{k=c[u>>2]|0;g=2147483647;e=k;k=k-l|0;r=48}if((r|0)==48){r=0;o=0;j=ka(67,g|0)|0;n=o;o=0;if(n&1)break}a[j+k>>0]=0;m=e-l|0;n=j+(k-m)|0;lw(n|0,d|0,m|0)|0;c[t>>2]=n;c[u>>2]=j+(k+1);c[q>>2]=j+g;if(b)cj(b)}else{a[g>>0]=0;c[u>>2]=(c[u>>2]|0)+1}if((p|0)>=(f|0))break b}h=Na()|0;break a}}while(0);o=0;k=ka(67,20)|0;f=o;o=0;if(!(f&1)){c[k>>2]=36800;a[k+4>>0]=-9;b=k+8|0;c[b>>2]=0;j=k+12|0;c[j>>2]=0;e=k+16|0;c[e>>2]=0;g=c[u>>2]|0;f=c[t>>2]|0;d=g-f|0;do{if((g|0)!=(f|0)){if(!((d|0)<0?(o=0,ha(178,b|0),f=o,o=0,f&1):0))r=62;if((r|0)==62?(o=0,h=ka(67,d|0)|0,f=o,o=0,!(f&1)):0){c[j>>2]=h;c[b>>2]=h;c[e>>2]=h+d;g=c[t>>2]|0;e=c[u>>2]|0;if((g|0)==(e|0))break;do{a[h>>0]=a[g>>0]|0;h=(c[j>>2]|0)+1|0;c[j>>2]=h;g=g+1|0}while((g|0)!=(e|0));g=c[t>>2]|0;break}h=Na()|0;g=c[b>>2]|0;if(g){if((c[j>>2]|0)!=(g|0))c[j>>2]=g;cj(g)}cj(k);break a}}while(0);if(!g){i=s;return k|0}if((c[u>>2]|0)!=(g|0))c[u>>2]=g;cj(g);i=s;return k|0}else r=52}else r=52}while(0);if((r|0)==52)h=Na()|0;g=c[t>>2]|0;if(!g)Ya(h|0);if((c[u>>2]|0)!=(g|0))c[u>>2]=g;cj(g);Ya(h|0);return 0}function ui(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;u=i;i=i+32|0;r=u+28|0;w=u+16|0;t=u+4|0;s=u;c[w>>2]=0;x=w+4|0;c[x>>2]=0;c[w+8>>2]=0;p=bj(5)|0;c[w>>2]=p;q=w+8|0;c[q>>2]=p+5;a[p>>0]=74;a[p+1>>0]=70;a[p+2>>0]=73;a[p+3>>0]=70;a[p+4>>0]=0;c[x>>2]=p+5;o=0;ia(84,w|0,c[b>>2]&65535|0);p=o;o=0;a:do{if(!(p&1)){m=c[b+4>>2]&255;d=c[x>>2]|0;f=c[q>>2]|0;if(d>>>0>=f>>>0){g=c[w>>2]|0;h=g;j=d-h+1|0;if((j|0)<0){o=0;ha(178,w|0);p=o;o=0;if(p&1){v=43;break}h=c[w>>2]|0;f=c[q>>2]|0;g=h}l=g;d=f-l|0;if(d>>>0<1073741823){d=d<<1;d=d>>>0>>0?j:d;f=c[x>>2]|0;k=f-l|0;if(!d){d=0;j=0}else v=10}else{k=c[x>>2]|0;d=2147483647;f=k;k=k-l|0;v=10}if((v|0)==10){o=0;j=ka(67,d|0)|0;p=o;o=0;if(p&1){v=43;break}}a[j+k>>0]=m;n=f-l|0;p=j+(k-n)|0;lw(p|0,g|0,n|0)|0;c[w>>2]=p;c[x>>2]=j+(k+1);c[q>>2]=j+d;if(h)cj(h)}else{a[d>>0]=m;c[x>>2]=(c[x>>2]|0)+1}o=0;ia(84,w|0,c[b+8>>2]&65535|0);p=o;o=0;if(!(p&1)?(o=0,ia(84,w|0,c[b+12>>2]&65535|0),p=o,o=0,!(p&1)):0){p=b+16|0;n=c[p>>2]&255;d=c[x>>2]|0;g=c[q>>2]|0;if(d>>>0>=g>>>0){h=c[w>>2]|0;f=h;j=d-f+1|0;if((j|0)<0){o=0;ha(178,w|0);m=o;o=0;if(m&1){v=43;break}h=c[w>>2]|0;f=h;g=c[q>>2]|0}m=h;d=g-m|0;if(d>>>0<1073741823){d=d<<1;d=d>>>0>>0?j:d;j=c[x>>2]|0;k=j-m|0;if(!d){l=0;g=0}else v=23}else{k=c[x>>2]|0;d=2147483647;j=k;k=k-m|0;v=23}if((v|0)==23){o=0;g=ka(67,d|0)|0;l=o;o=0;if(l&1){v=43;break}else l=d}a[g+k>>0]=n;d=g+(k+1)|0;m=j-m|0;n=g+(k-m)|0;lw(n|0,h|0,m|0)|0;c[w>>2]=n;c[x>>2]=d;c[q>>2]=g+l;if(f){cj(f);d=c[x>>2]|0}}else{a[d>>0]=n;d=(c[x>>2]|0)+1|0;c[x>>2]=d}n=b+20|0;m=c[n>>2]&255;f=c[q>>2]|0;if(d>>>0>=f>>>0){g=c[w>>2]|0;h=g;j=d-h+1|0;if((j|0)<0){o=0;ha(178,w|0);l=o;o=0;if(l&1){v=43;break}h=c[w>>2]|0;f=c[q>>2]|0;g=h}l=g;d=f-l|0;if(d>>>0<1073741823){d=d<<1;d=d>>>0>>0?j:d;f=c[x>>2]|0;k=f-l|0;if(!d){d=0;j=0}else v=34}else{k=c[x>>2]|0;d=2147483647;f=k;k=k-l|0;v=34}if((v|0)==34){o=0;j=ka(67,d|0)|0;y=o;o=0;if(y&1){v=43;break}}a[j+k>>0]=m;m=f-l|0;y=j+(k-m)|0;lw(y|0,g|0,m|0)|0;c[w>>2]=y;c[x>>2]=j+(k+1);c[q>>2]=j+d;if(h)cj(h)}else{a[d>>0]=m;c[x>>2]=(c[x>>2]|0)+1}d=c[p>>2]|0;do{if((d|0)>0){if(!(c[b+24>>2]|0)){c[s>>2]=c[x>>2];y=0+($(d*3|0,c[n>>2]|0)|0)|0;o=0;c[r>>2]=c[s>>2];va(15,w|0,r|0,0,y|0)|0;y=o;o=0;if(y&1){v=43;break a}else break}f=Ma(16)|0;o=0;wa(5,t|0,50792,57);y=o;o=0;if(!(y&1)){o=0;d=ua(1)|0;y=o;o=0;if(!(y&1)?(o=0,Aa(36,f|0,1,d|0,t|0),y=o,o=0,!(y&1)):0){o=0;wa(6,f|0,824,96);o=0;e=0}else e=1;d=Na()|0;Im(t);if(!e){e=d;break a}}else d=Na()|0;La(f|0);e=d;break a}}while(0);o=0;k=ka(67,20)|0;y=o;o=0;if(!(y&1)){c[k>>2]=36800;a[k+4>>0]=-32;h=k+8|0;c[h>>2]=0;j=k+12|0;c[j>>2]=0;f=k+16|0;c[f>>2]=0;d=c[x>>2]|0;y=c[w>>2]|0;g=d-y|0;do{if((d|0)!=(y|0)){if(!((g|0)<0?(o=0,ha(178,h|0),y=o,o=0,y&1):0))v=53;if((v|0)==53?(o=0,e=ka(67,g|0)|0,y=o,o=0,!(y&1)):0){c[j>>2]=e;c[h>>2]=e;c[f>>2]=e+g;d=c[w>>2]|0;f=c[x>>2]|0;if((d|0)==(f|0))break;do{a[e>>0]=a[d>>0]|0;e=(c[j>>2]|0)+1|0;c[j>>2]=e;d=d+1|0}while((d|0)!=(f|0));d=c[w>>2]|0;break}d=Na()|0;e=c[h>>2]|0;if(e){if((c[j>>2]|0)!=(e|0))c[j>>2]=e;cj(e)}cj(k);v=44;break a}}while(0);if(!d){i=u;return k|0}if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);i=u;return k|0}else v=43}else v=43}else v=43}while(0);if((v|0)==43){d=Na()|0;v=44}if((v|0)==44)e=d;d=c[w>>2]|0;if(!d)Ya(e|0);if((c[x>>2]|0)!=(d|0))c[x>>2]=d;cj(d);Ya(e|0);return 0}function vi(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0;k=i;i=i+16|0;m=k;c[m>>2]=0;n=m+4|0;c[n>>2]=0;c[m+8>>2]=0;o=0;d=ka(67,1)|0;j=o;o=0;a:do{if((((((!(j&1)?(j=d+1|0,a[d>>0]=1,c[m>>2]=d,c[n>>2]=j,c[m+8>>2]=j,o=0,ia(84,m|0,c[b>>2]&65535|0),j=o,o=0,!(j&1)):0)?(o=0,ia(84,m|0,c[b+4>>2]&65535|0),j=o,o=0,!(j&1)):0)?(o=0,ia(84,m|0,c[b+8>>2]&65535|0),j=o,o=0,!(j&1)):0)?(o=0,ia(84,m|0,c[b+12>>2]&65535|0),j=o,o=0,!(j&1)):0)?(o=0,ia(84,m|0,c[b+16>>2]&65535|0),j=o,o=0,!(j&1)):0)?(o=0,l=ka(67,20)|0,j=o,o=0,!(j&1)):0){c[l>>2]=36800;a[l+4>>0]=-8;g=l+8|0;c[g>>2]=0;j=l+12|0;c[j>>2]=0;b=l+16|0;c[b>>2]=0;d=c[n>>2]|0;p=c[m>>2]|0;f=d-p|0;do{if((d|0)!=(p|0)){if(!((f|0)<0?(o=0,ha(178,g|0),p=o,o=0,p&1):0))h=11;if((h|0)==11?(o=0,e=ka(67,f|0)|0,p=o,o=0,!(p&1)):0){c[j>>2]=e;c[g>>2]=e;c[b>>2]=e+f;d=c[m>>2]|0;b=c[n>>2]|0;if((d|0)==(b|0))break;do{a[e>>0]=a[d>>0]|0;e=(c[j>>2]|0)+1|0;c[j>>2]=e;d=d+1|0}while((d|0)!=(b|0));d=c[m>>2]|0;break}e=Na()|0;d=c[g>>2]|0;if(d){if((c[j>>2]|0)!=(d|0))c[j>>2]=d;cj(d)}cj(l);break a}}while(0);if(!d){i=k;return l|0}if((c[n>>2]|0)!=(d|0))c[n>>2]=d;cj(d);i=k;return l|0}else h=25}while(0);if((h|0)==25)e=Na()|0;d=c[m>>2]|0;if(!d)Ya(e|0);if((c[n>>2]|0)!=(d|0))c[n>>2]=d;cj(d);Ya(e|0);return 0}function wi(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;h=bj(5)|0;a[h>>0]=109;a[h+1>>0]=114;a[h+2>>0]=102;a[h+3>>0]=120;a[h+4>>0]=b;o=0;g=ka(67,20)|0;f=o;o=0;if(f&1){g=Na()|0;cj(h);Ya(g|0)}c[g>>2]=36800;a[g+4>>0]=-24;b=g+8|0;c[b>>2]=0;d=g+12|0;c[d>>2]=0;e=g+16|0;c[e>>2]=0;o=0;f=ka(67,5)|0;i=o;o=0;if(!(i&1)){c[d>>2]=f;c[b>>2]=f;c[e>>2]=f+5;a[f>>0]=109;i=(c[d>>2]|0)+1|0;c[d>>2]=i;f=h+1|0;a[i>>0]=a[f>>0]|0;i=(c[d>>2]|0)+1|0;c[d>>2]=i;f=f+1|0;a[i>>0]=a[f>>0]|0;i=(c[d>>2]|0)+1|0;c[d>>2]=i;f=f+1|0;a[i>>0]=a[f>>0]|0;i=(c[d>>2]|0)+1|0;c[d>>2]=i;a[i>>0]=a[f+1>>0]|0;c[d>>2]=(c[d>>2]|0)+1;cj(h);return g|0}i=Na()|0;cj(g);cj(h);Ya(i|0);return 0}function xi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;v=i;i=i+16|0;w=v;c[w>>2]=0;x=w+4|0;c[x>>2]=0;c[w+8>>2]=0;t=w+8|0;o=0;g=ka(67,1)|0;s=o;o=0;a:do{if(!(s&1)){k=g+1|0;s=k;a[g>>0]=d;c[w>>2]=g;c[x>>2]=s;c[t>>2]=s;if((d|0)>0){j=k;s=0;do{r=s+b&255;if(j>>>0>=k>>>0){g=c[w>>2]|0;l=g;j=j-l+1|0;if((j|0)<0){o=0;ha(178,w|0);q=o;o=0;if(q&1){u=28;break}l=c[w>>2]|0;k=c[t>>2]|0;q=l}else q=g;p=q;g=k-p|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?j:g;k=c[x>>2]|0;m=k-p|0;if(!g){n=0;j=0}else u=13}else{m=c[x>>2]|0;g=2147483647;k=m;m=m-p|0;u=13}if((u|0)==13){u=0;o=0;j=ka(67,g|0)|0;n=o;o=0;if(n&1){u=28;break}else n=g}a[j+m>>0]=r;g=j+(m+1)|0;p=k-p|0;r=j+(m-p)|0;lw(r|0,q|0,p|0)|0;c[w>>2]=r;c[x>>2]=g;c[t>>2]=j+n;if(l){cj(l);g=c[x>>2]|0}}else{a[j>>0]=r;g=(c[x>>2]|0)+1|0;c[x>>2]=g}k=c[t>>2]|0;if(g>>>0>=k>>>0){l=c[w>>2]|0;j=l;m=g-j+1|0;if((m|0)<0){o=0;ha(178,w|0);r=o;o=0;if(r&1){u=28;break}l=c[w>>2]|0;j=l;k=c[t>>2]|0}p=l;g=k-p|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?m:g;m=c[x>>2]|0;k=m-p|0;if(!g){g=0;n=0}else u=24}else{k=c[x>>2]|0;g=2147483647;m=k;k=k-p|0;u=24}if((u|0)==24){u=0;o=0;n=ka(67,g|0)|0;r=o;o=0;if(r&1){u=28;break}}a[n+k>>0]=0;q=m-p|0;r=n+(k-q)|0;lw(r|0,l|0,q|0)|0;c[w>>2]=r;c[x>>2]=n+(k+1);c[t>>2]=n+g;if(j)cj(j)}else{a[g>>0]=0;c[x>>2]=(c[x>>2]|0)+1}s=s+1|0;j=c[x>>2]|0;k=c[t>>2]|0}while((s|0)<(d|0));if((u|0)==28){h=Na()|0;break}g=e&255;if(j>>>0>>0){a[j>>0]=g;j=(c[x>>2]|0)+1|0;c[x>>2]=j}else u=37}else{j=k;g=e&255;u=37}if((u|0)==37){l=c[w>>2]|0;m=l;n=j-m+1|0;if((n|0)<0){o=0;ha(178,w|0);e=o;o=0;if(e&1){u=29;break}m=c[w>>2]|0;k=c[t>>2]|0;l=m}r=l;j=k-r|0;if(j>>>0<1073741823){j=j<<1;j=j>>>0>>0?n:j;n=c[x>>2]|0;p=n-r|0;if(!j){q=0;k=0}else u=43}else{p=c[x>>2]|0;j=2147483647;n=p;p=p-r|0;u=43}if((u|0)==43){o=0;k=ka(67,j|0)|0;e=o;o=0;if(e&1){u=29;break}else q=j}a[k+p>>0]=g;j=k+(p+1)|0;b=n-r|0;e=k+(p-b)|0;lw(e|0,l|0,b|0)|0;c[w>>2]=e;c[x>>2]=j;c[t>>2]=k+q;if(m){cj(m);j=c[x>>2]|0}}r=f&255;g=c[t>>2]|0;if(j>>>0>=g>>>0){k=c[w>>2]|0;l=k;j=j-l+1|0;if((j|0)<0){o=0;ha(178,w|0);f=o;o=0;if(f&1){u=29;break}l=c[w>>2]|0;g=c[t>>2]|0;k=l}q=k;g=g-q|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?j:g;m=c[x>>2]|0;n=m-q|0;if(!g){p=0;j=0}else u=54}else{n=c[x>>2]|0;g=2147483647;m=n;n=n-q|0;u=54}if((u|0)==54){o=0;j=ka(67,g|0)|0;f=o;o=0;if(f&1){u=29;break}else p=g}a[j+n>>0]=r;g=j+(n+1)|0;e=m-q|0;f=j+(n-e)|0;lw(f|0,k|0,e|0)|0;c[w>>2]=f;c[x>>2]=g;c[t>>2]=j+p;if(l){cj(l);g=c[x>>2]|0}}else{a[j>>0]=r;g=(c[x>>2]|0)+1|0;c[x>>2]=g}j=c[t>>2]|0;if(g>>>0>=j>>>0){k=c[w>>2]|0;l=k;m=g-l+1|0;if((m|0)<0){o=0;ha(178,w|0);f=o;o=0;if(f&1){u=29;break}l=c[w>>2]|0;j=c[t>>2]|0;k=l}p=k;g=j-p|0;if(g>>>0<1073741823){g=g<<1;g=g>>>0>>0?m:g;j=c[x>>2]|0;n=j-p|0;if(!g){g=0;m=0}else u=65}else{n=c[x>>2]|0;g=2147483647;j=n;n=n-p|0;u=65}if((u|0)==65){o=0;m=ka(67,g|0)|0;f=o;o=0;if(f&1){u=29;break}}a[m+n>>0]=0;e=j-p|0;f=m+(n-e)|0;lw(f|0,k|0,e|0)|0;c[w>>2]=f;c[x>>2]=m+(n+1);c[t>>2]=m+g;if(l)cj(l)}else{a[g>>0]=0;c[x>>2]=(c[x>>2]|0)+1}o=0;n=ka(67,20)|0;t=o;o=0;if(!(t&1)){c[n>>2]=36800;a[n+4>>0]=-38;l=n+8|0;c[l>>2]=0;m=n+12|0;c[m>>2]=0;j=n+16|0;c[j>>2]=0;g=c[x>>2]|0;t=c[w>>2]|0;k=g-t|0;do{if((g|0)!=(t|0)){if(!((k|0)<0?(o=0,ha(178,l|0),t=o,o=0,t&1):0))u=72;if((u|0)==72?(o=0,h=ka(67,k|0)|0,t=o,o=0,!(t&1)):0){c[m>>2]=h;c[l>>2]=h;c[j>>2]=h+k;g=c[w>>2]|0;j=c[x>>2]|0;if((g|0)==(j|0))break;do{a[h>>0]=a[g>>0]|0;h=(c[m>>2]|0)+1|0;c[m>>2]=h;g=g+1|0}while((g|0)!=(j|0));g=c[w>>2]|0;break}h=Na()|0;g=c[l>>2]|0;if(g){if((c[m>>2]|0)!=(g|0))c[m>>2]=g;cj(g)}cj(n);break a}}while(0);if(!g){i=v;return n|0}if((c[x>>2]|0)!=(g|0))c[x>>2]=g;cj(g);i=v;return n|0}else u=29}else u=29}while(0);if((u|0)==29)h=Na()|0;g=c[w>>2]|0;if(!g)Ya(h|0);if((c[x>>2]|0)!=(g|0))c[x>>2]=g;cj(g);Ya(h|0);return 0}function yi(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;n=(d&65535)>>>8&255;o=b+4|0;e=c[o>>2]|0;p=b+8|0;f=c[p>>2]|0;if(e>>>0>=f>>>0){g=c[b>>2]|0;h=g;i=e-h+1|0;if((i|0)<0){$i(b);h=c[b>>2]|0;f=c[p>>2]|0;g=h}m=g;e=f-m|0;if(e>>>0<1073741823){e=e<<1;e=e>>>0>>0?i:e;i=c[o>>2]|0;f=i-m|0;if(!e){l=0;k=0;j=f;e=i}else q=8}else{f=c[o>>2]|0;e=2147483647;i=f;f=f-m|0;q=8}if((q|0)==8){l=e;k=bj(e)|0;j=f;e=i}a[k+j>>0]=n;f=k+(j+1)|0;m=e-m|0;n=k+(j-m)|0;lw(n|0,g|0,m|0)|0;c[b>>2]=n;c[o>>2]=f;c[p>>2]=k+l;if(h){cj(h);f=c[o>>2]|0}}else{a[e>>0]=n;f=(c[o>>2]|0)+1|0;c[o>>2]=f}m=d&255;e=c[p>>2]|0;if(f>>>0>>0){a[f>>0]=m;c[o>>2]=(c[o>>2]|0)+1;return}g=c[b>>2]|0;h=g;f=f-h+1|0;if((f|0)<0){$i(b);h=c[b>>2]|0;e=c[p>>2]|0;g=h}l=g;e=e-l|0;if(e>>>0<1073741823){e=e<<1;e=e>>>0>>0?f:e;i=c[o>>2]|0;f=i-l|0;if(!e){k=0;j=0;e=i}else q=18}else{f=c[o>>2]|0;e=2147483647;i=f;f=f-l|0;q=18}if((q|0)==18){k=e;j=bj(e)|0;e=i}a[j+f>>0]=m;d=e-l|0;q=j+(f-d)|0;lw(q|0,g|0,d|0)|0;c[b>>2]=q;c[o>>2]=j+(f+1);c[p>>2]=j+k;if(!h)return;cj(h);return}function zi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;g=c[b>>2]|0;q=c[d>>2]|0;p=q;k=g;n=e;l=f-n|0;if((l|0)<=0){r=q;return r|0}o=b+8|0;d=c[o>>2]|0;r=b+4|0;m=c[r>>2]|0;h=m;if((l|0)<=(d-h|0)){j=h-p|0;if((l|0)>(j|0)){i=e+j|0;if((i|0)==(f|0))d=m;else{h=i;d=m;do{a[d>>0]=a[h>>0]|0;d=(c[r>>2]|0)+1|0;c[r>>2]=d;h=h+1|0}while((h|0)!=(f|0))}if((j|0)>0)j=d;else{r=q;return r|0}}else{j=m;i=f}g=j-(g+(l-k+p))|0;d=q+g|0;if(d>>>0>>0){h=j;do{a[h>>0]=a[d>>0]|0;d=d+1|0;h=(c[r>>2]|0)+1|0;c[r>>2]=h}while((d|0)!=(m|0))}nw(j+(0-g)|0,q|0,g|0)|0;nw(q|0,e|0,i-n|0)|0;r=q;return r|0}h=h-k+l|0;if((h|0)<0){$i(b);d=c[o>>2]|0;g=c[b>>2]|0}i=g;d=d-i|0;if(d>>>0<1073741823){d=d<<1;d=d>>>0>>0?h:d;h=p-i|0;if(!d){i=0;l=0}else j=15}else{d=2147483647;h=p-i|0;j=15}if((j|0)==15){i=d;l=bj(d)|0}k=l+h|0;d=k;j=l+i|0;if((e|0)!=(f|0)){g=e;i=k;do{a[i>>0]=a[g>>0]|0;i=d+1|0;d=i;g=g+1|0}while((g|0)!=(f|0));g=c[b>>2]|0}e=p-g|0;f=l+(h-e)|0;lw(f|0,g|0,e|0)|0;p=(c[r>>2]|0)-p|0;e=d;lw(e|0,q|0,p|0)|0;d=c[b>>2]|0;c[b>>2]=f;c[r>>2]=e+p;c[o>>2]=j;if(!d){r=k;return r|0}cj(d);r=k;return r|0}function Ai(a){a=a|0;var b=0;c[a>>2]=36800;b=c[a+8>>2]|0;if(!b)return;a=a+12|0;if((c[a>>2]|0)!=(b|0))c[a>>2]=b;cj(b);return}function Bi(a){a=a|0;var b=0,d=0;c[a>>2]=36800;b=c[a+8>>2]|0;if(!b){cj(a);return}d=a+12|0;if((c[d>>2]|0)!=(b|0))c[d>>2]=b;cj(b);cj(a);return}function Ci(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;Di(d,-1);Di(d,a[b+4>>0]|0);g=b+12|0;f=b+8|0;b=(c[g>>2]|0)-(c[f>>2]|0)+2|0;Di(d,(b&65535)>>>8&255);Di(d,b&255);b=c[f>>2]|0;if((c[g>>2]|0)==(b|0))return;else e=0;do{Di(d,a[b+e>>0]|0);e=e+1|0;b=c[f>>2]|0}while(e>>>0<((c[g>>2]|0)-b|0)>>>0);return}function Di(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;g=c[b+4>>2]|0;if(g){e=g+24|0;f=c[e>>2]|0;if((f|0)==(c[g+28>>2]|0)){Lb[c[(c[g>>2]|0)+52>>2]&63](g,d&255)|0;return}else{c[e>>2]=f+1;a[f>>0]=d;return}}e=b+16|0;f=c[e>>2]|0;if(f>>>0<(c[b+12>>2]|0)>>>0){c[e>>2]=f+1;a[(c[b+8>>2]|0)+f>>0]=d;return}e=Ma(16)|0;o=0;f=ua(1)|0;d=o;o=0;if(d&1){d=Na()|0;La(e|0);Ya(d|0)}o=0;wa(7,e|0,4,f|0);d=o;o=0;if(d&1){d=Na()|0;La(e|0);Ya(d|0)}else lb(e|0,824,96)}function Ei(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=0;f=(b|0)<4095?(b+128|0)/256|0:16;g=(d*3|0)+2+f|0;e=d+1|0;g=(g|0)<(e|0)|(g|0)>(b|0)?e:g;c[a+4>>2]=g;e=(f<<2|3)+(d*5|0)|0;e=(e|0)>(b|0)|(e|0)<(g|0)?g:e;c[a+8>>2]=e;d=(d*7|0)+4+(f*17|0)|0;c[a+12>>2]=(d|0)>(b|0)|(d|0)<(e|0)?e:d;c[a>>2]=b;c[a+16>>2]=64;return}function Fi(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+128|0;k=m+100|0;f=m+16|0;e=m+112|0;l=m+4|0;n=m;g=f;h=b+20|0;j=g+84|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));c[f+16>>2]=c[b+4>>2];h=pc(e,f,b+56|0)|0;e=c[(c[h>>2]|0)+16>>2]|0;b=b+8|0;o=0;c[k>>2]=c[b>>2];c[k+4>>2]=c[b+4>>2];c[k+8>>2]=c[b+8>>2];e=ra(e|0,h|0,k|0)|0;b=o;o=0;do{if(b&1)e=Na()|0;else{g=d+4|0;c[l>>2]=c[g>>2];c[l+4>>2]=c[g+4>>2];c[l+8>>2]=c[g+8>>2];g=d+16|0;b=c[g>>2]|0;k=l+8|0;c[k>>2]=(c[k>>2]|0)-b;k=l+4|0;c[k>>2]=(c[k>>2]|0)+b;k=c[(c[h>>2]|0)+12>>2]|0;c[n>>2]=e;o=0;e=va(k|0,h|0,n|0,l|0,((a[d>>0]|0)==0?0:(c[d+8>>2]|0)+b|0)|0)|0;l=o;o=0;if(l&1){e=Na()|0;f=c[n>>2]|0;c[n>>2]=0;if(!f)break;Bb[c[(c[f>>2]|0)+4>>2]&255](f);break}f=c[n>>2]|0;c[n>>2]=0;if(f)Bb[c[(c[f>>2]|0)+4>>2]&255](f);if(!(c[d+4>>2]|0))c[g>>2]=(c[g>>2]|0)+e;if(!h){i=m;return}Bb[c[(c[h>>2]|0)+4>>2]&255](h);i=m;return}}while(0);if(!h)Ya(e|0);Bb[c[(c[h>>2]|0)+4>>2]&255](h);Ya(e|0)}function Gi(b,d){b=b|0;d=d|0;c[b>>2]=c[d>>2];c[b+4>>2]=c[d+4>>2];c[b+8>>2]=c[d+8>>2];a[b+12>>0]=0;d=b+16|0;b=d+100|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(b|0));return}function Hi(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;v=i;i=i+32|0;u=v+4|0;q=v+16|0;w=v;Ii(b);r=b+16|0;g=c[b+24>>2]|0;a:do{if((g+-2|0)>>>0<=14){s=b+40|0;e=c[s>>2]|0;if(e>>>0>2)e=5;else{t=b+32|0;h=c[t>>2]|0;switch(h|0){case 0:{e=1;break a}case 4:{if((e|0)==2){e=2;break a}break}case 3:break;default:if(e){e=2;break a}}p=b+100|0;e=b+108|0;f=c[e>>2]|0;if((f|0)<1){f=c[r>>2]|0;c[e>>2]=f;e=c[b+20>>2]|0;c[b+112>>2]=e}else e=c[b+112>>2]|0;l=tw(e|0,((e|0)<0)<<31>>31|0,f|0,((f|0)<0)<<31>>31|0)|0;k=(g+7|0)/8|0;k=tw(l|0,D|0,k|0,((k|0)<0)<<31>>31|0)|0;l=d+4|0;e=c[l>>2]|0;j=d+8|0;if((e|0)!=0?(m=c[j>>2]|0,n=tw(h|0,((h|0)<0)<<31>>31|0,k|0,D|0)|0,g=D,0<(g|0)|0==(g|0)&m>>>0>>0):0){e=Ma(16)|0;o=0;f=ua(1)|0;w=o;o=0;if(!(w&1)?(o=0,wa(7,e|0,3,f|0),w=o,o=0,!(w&1)):0)lb(e|0,824,96);w=Na()|0;La(e|0);Ya(w|0)}m=b+52|0;n=b+12|0;if((h|0)>0)h=0;else{i=v;return}while(1){Ji(b,(h|0)==0);f=nc(q,r,m)|0;g=c[(c[f>>2]|0)+8>>2]|0;o=0;c[u>>2]=c[d>>2];c[u+4>>2]=c[d+4>>2];c[u+8>>2]=c[d+8>>2];g=ra(g|0,f|0,u|0)|0;x=o;o=0;if(x&1){g=32;break}x=c[(c[f>>2]|0)+16>>2]|0;c[w>>2]=g;o=0;fa(x|0,f|0,w|0,p|0,b|0,(a[n>>0]|0)!=0|0);x=o;o=0;if(x&1){g=30;break}g=c[w>>2]|0;c[w>>2]=0;if(g)Bb[c[(c[g>>2]|0)+4>>2]&255](g);if(!e)e=0;else{e=e+k|0;c[l>>2]=e;c[j>>2]=(c[j>>2]|0)-k}g=(c[s>>2]|0)==0;h=(g&1)+h|0;if(f)Bb[c[(c[f>>2]|0)+4>>2]&255](f);if(!g){g=34;break}if((h|0)>=(c[t>>2]|0)){g=34;break}}if((g|0)==30){e=Na()|0;g=c[w>>2]|0;c[w>>2]=0;if(g)Bb[c[(c[g>>2]|0)+4>>2]&255](g)}else if((g|0)==32){e=Na()|0;if(!f){x=e;Ya(x|0)}}else if((g|0)==34){i=v;return}Bb[c[(c[f>>2]|0)+4>>2]&255](f);x=e;Ya(x|0)}}else e=2}while(0);f=Ma(16)|0;o=0;g=ua(1)|0;x=o;o=0;if(!(x&1)?(o=0,wa(7,f|0,e|0,g|0),x=o,o=0,!(x&1)):0)lb(f|0,824,96);x=Na()|0;La(f|0);Ya(x|0)}function Ii(a){a=a|0;var b=0,c=0,d=0,e=0;if((Mi(a)|0)<<24>>24!=-40){b=Ma(16)|0;o=0;c=ua(1)|0;e=o;o=0;if(!(e&1)?(o=0,wa(7,b|0,5,c|0),e=o,o=0,!(e&1)):0)lb(b|0,824,96);e=Na()|0;La(b|0);Ya(e|0)}b=Mi(a)|0;if(b<<24>>24==-38)return;while(1){d=((Li(a)|0)&255)<<8;d=d|(Li(a)|0)&255;b=Ni(a,b)|0;c=-2-b+d|0;if((c|0)<0)break;if((c|0)>0){b=d+-2-b|0;c=0;do{Li(a)|0;c=c+1|0}while((c|0)!=(b|0))}b=Mi(a)|0;if(b<<24>>24==-38){e=8;break}}if((e|0)==8)return;b=Ma(16)|0;o=0;c=ua(1)|0;e=o;o=0;if(!(e&1)?(o=0,wa(7,b|0,5,c|0),e=o,o=0,!(e&1)):0)lb(b|0,824,96);e=Na()|0;La(b|0);Ya(e|0)}function Ji(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;if(!b){if((Li(a)|0)<<24>>24!=-1){b=Ma(16)|0;o=0;d=ua(1)|0;a=o;o=0;if(!(a&1)?(o=0,wa(7,b|0,12,d|0),a=o,o=0,!(a&1)):0)lb(b|0,824,96);a=Na()|0;La(b|0);Ya(a|0)}if((Li(a)|0)<<24>>24!=-38){b=Ma(16)|0;o=0;d=ua(1)|0;a=o;o=0;if(!(a&1)?(o=0,wa(7,b|0,5,d|0),a=o,o=0,!(a&1)):0)lb(b|0,824,96);a=Na()|0;La(b|0);Ya(a|0)}}Li(a)|0;Li(a)|0;d=Li(a)|0;e=d&255;do{if(d<<24>>24==1){Li(a)|0;d=0;f=20}else{if((e|0)==(c[a+32>>2]|0)){b=Li(a)|0;if(!(d<<24>>24))break;else{d=0;f=20;break}}b=Ma(16)|0;o=0;d=ua(1)|0;a=o;o=0;if(!(a&1)?(o=0,wa(7,b|0,2,d|0),a=o,o=0,!(a&1)):0)lb(b|0,824,96);a=Na()|0;La(b|0);Ya(a|0)}}while(0);if((f|0)==20)while(1){Li(a)|0;d=d+1|0;b=Li(a)|0;if((d|0)==(e|0))break;else f=20}c[a+36>>2]=b&255;f=Li(a)|0;d=a+40|0;c[d>>2]=f&255;if((f&255)>=3){b=Ma(16)|0;o=0;d=ua(1)|0;a=o;o=0;if(!(a&1)?(o=0,wa(7,b|0,5,d|0),a=o,o=0,!(a&1)):0)lb(b|0,824,96);a=Na()|0;La(b|0);Ya(a|0)}if((Li(a)|0)<<24>>24){b=Ma(16)|0;o=0;d=ua(1)|0;a=o;o=0;if(!(a&1)?(o=0,wa(7,b|0,5,d|0),a=o,o=0,!(a&1)):0)lb(b|0,824,96);a=Na()|0;La(b|0);Ya(a|0)}e=a+28|0;if(c[e>>2]|0)return;b=c[a+108>>2]|0;if(!b)b=c[a+16>>2]|0;if(!(c[d>>2]|0))d=1;else d=c[a+32>>2]|0;f=$(d,b)|0;c[e>>2]=$(f,((c[a+24>>2]|0)+7|0)/8|0)|0;return}function Ki(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;if((e|0)<=0)return;n=d+4|0;o=d+8|0;q=0;do{p=Li(b)|0;f=c[n>>2]|0;g=c[o>>2]|0;if(f>>>0>=g>>>0){h=c[d>>2]|0;i=h;j=f-i+1|0;if((j|0)<0){$i(d);i=c[d>>2]|0;g=c[o>>2]|0;h=i}m=h;f=g-m|0;if(f>>>0<1073741823){f=f<<1;f=f>>>0>>0?j:f;j=c[n>>2]|0;g=j-m|0;if(!f){l=0;k=0;f=j}else r=10}else{g=c[n>>2]|0;f=2147483647;j=g;g=g-m|0;r=10}if((r|0)==10){r=0;l=f;k=bj(f)|0;f=j}a[k+g>>0]=p;m=f-m|0;p=k+(g-m)|0;lw(p|0,h|0,m|0)|0;c[d>>2]=p;c[n>>2]=k+(g+1);c[o>>2]=k+l;if(i)cj(i)}else{a[f>>0]=p;c[n>>2]=(c[n>>2]|0)+1}q=q+1|0}while((q|0)!=(e|0));return}function Li(b){b=b|0;var e=0,f=0,g=0,h=0;f=c[b>>2]|0;if(f){b=f+12|0;e=c[b>>2]|0;if((e|0)==(c[f+16>>2]|0))b=Eb[c[(c[f>>2]|0)+40>>2]&127](f)|0;else{c[b>>2]=e+1;b=d[e>>0]|0}h=b&255;return h|0}g=b+8|0;h=c[g>>2]|0;if(h){b=b+4|0;e=c[b>>2]|0;f=a[e>>0]|0;if(!e){h=f;return h|0}c[b>>2]=e+1;c[g>>2]=h+-1;h=f;return h|0}b=Ma(16)|0;o=0;e=ua(1)|0;h=o;o=0;if(h&1){h=Na()|0;La(b|0);Ya(h|0)}o=0;wa(7,b|0,4,e|0);h=o;o=0;if(h&1){h=Na()|0;La(b|0);Ya(h|0)}else lb(b|0,824,96);return 0}function Mi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0;d=i;i=i+176|0;b=d+152|0;k=d+16|0;h=d;j=Li(a)|0;e=j&255;if(j<<24>>24==-1){do{b=Li(a)|0}while(b<<24>>24==-1);i=d;return b|0}j=k+56|0;g=k+4|0;c[k>>2]=36160;c[j>>2]=36180;o=0;ia(62,k+56|0,g|0);f=o;o=0;if(f&1){k=Na()|0;fn(j);Ya(k|0)}c[k+128>>2]=0;c[k+132>>2]=-1;c[k>>2]=36200;c[k+56>>2]=36220;o=0;ha(180,g|0);f=o;o=0;do{if(f&1)b=Na()|0;else{c[g>>2]=36236;f=k+36|0;c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[f+12>>2]=0;c[k+52>>2]=16;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;o=0;ia(63,g|0,b|0);d=o;o=0;if(d&1){k=Na()|0;Im(b);Im(f);nn(g);b=k;break}Im(b);c[k+((c[(c[k>>2]|0)+-12>>2]|0)+76)>>2]=48;o=0;b=ma(28,k|0,50907,62)|0;d=o;o=0;if(!(d&1)?(d=b+((c[(c[b>>2]|0)+-12>>2]|0)+4)|0,c[d>>2]=c[d>>2]&-75|8,d=b+((c[(c[b>>2]|0)+-12>>2]|0)+4)|0,c[d>>2]=c[d>>2]|16384,c[b+((c[(c[b>>2]|0)+-12>>2]|0)+12)>>2]=2,o=0,ra(38,b|0,e|0)|0,e=o,o=0,!(e&1)):0){d=Ma(16)|0;o=0;ia(64,h|0,g|0);e=o;o=0;if(!(e&1)){o=0;b=ua(1)|0;e=o;o=0;if(!(e&1)?(o=0,Aa(36,d|0,12,b|0,h|0),e=o,o=0,!(e&1)):0){o=0;wa(6,d|0,824,96);o=0;a=0}else a=1;b=Na()|0;Im(h);if(!a){h=b;c[k>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(f);nn(g);fn(j);Ya(h|0)}}else b=Na()|0;La(d|0);h=b;c[k>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(f);nn(g);fn(j);Ya(h|0)}h=Na()|0;c[k>>2]=36200;c[j>>2]=36220;c[g>>2]=36236;Im(f);nn(g);fn(j);Ya(h|0)}}while(0);k=b;fn(j);Ya(k|0);return 0}function Ni(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0;d=i;i=i+320|0;j=d+300|0;m=d+152|0;k=d+288|0;n=d+16|0;l=d;switch(b<<24>>24){case-9:{c[a+24>>2]=(Li(a)|0)&255;p=((Li(a)|0)&255)<<8|(Li(a)|0)&255;c[a+16>>2]=((Li(a)|0)&255)<<8|(Li(a)|0)&255;c[a+20>>2]=p;c[a+32>>2]=(Li(a)|0)&255;p=6;i=d;return p|0}case-8:{p=Oi(a)|0;i=d;return p|0}case-24:{p=Pi(a)|0;i=d;return p|0}case-53:case-54:case-55:case-57:case-58:case-59:case-61:case-62:case-63:case-64:{h=m+56|0;f=m+4|0;c[m>>2]=36160;c[h>>2]=36180;o=0;ia(62,m+56|0,f|0);n=o;o=0;if(n&1){p=Na()|0;fn(h);Ya(p|0)}c[m+128>>2]=0;c[m+132>>2]=-1;c[m>>2]=36200;c[m+56>>2]=36220;o=0;ha(180,f|0);n=o;o=0;do{if(n&1)a=Na()|0;else{c[f>>2]=36236;g=m+36|0;c[g>>2]=0;c[g+4>>2]=0;c[g+8>>2]=0;c[g+12>>2]=0;c[m+52>>2]=16;c[j>>2]=0;c[j+4>>2]=0;c[j+8>>2]=0;o=0;ia(63,f|0,j|0);n=o;o=0;if(n&1){a=Na()|0;Im(j);Im(g);nn(f);break}Im(j);o=0;a=ma(28,m|0,50970,26)|0;n=o;o=0;do{if((!(n&1)?(o=0,e=ra(38,a|0,b&255|0)|0,n=o,o=0,!(n&1)):0)?(o=0,ma(28,e|0,50997,18)|0,n=o,o=0,!(n&1)):0){e=Ma(16)|0;o=0;ia(64,k|0,f|0);n=o;o=0;if(!(n&1)){o=0;a=ua(1)|0;n=o;o=0;if(!(n&1)?(o=0,Aa(36,e|0,10,a|0,k|0),n=o,o=0,!(n&1)):0){o=0;wa(6,e|0,824,96);o=0;d=0}else d=1;a=Na()|0;Im(k);if(!d)break}else a=Na()|0;La(e|0)}else p=20}while(0);if((p|0)==20)a=Na()|0;c[m>>2]=36200;c[h>>2]=36220;c[f>>2]=36236;Im(g);nn(f);fn(h);p=a;Ya(p|0)}}while(0);p=a;fn(h);Ya(p|0)}case-25:case-32:case-2:{p=0;i=d;return p|0}default:{k=n+56|0;g=n+4|0;c[n>>2]=36160;c[k>>2]=36180;o=0;ia(62,n+56|0,g|0);m=o;o=0;if(m&1){p=Na()|0;fn(k);Ya(p|0)}c[n+128>>2]=0;c[n+132>>2]=-1;c[n>>2]=36200;c[n+56>>2]=36220;o=0;ha(180,g|0);m=o;o=0;do{if(m&1)a=Na()|0;else{c[g>>2]=36236;h=n+36|0;c[h>>2]=0;c[h+4>>2]=0;c[h+8>>2]=0;c[h+12>>2]=0;c[n+52>>2]=16;c[j>>2]=0;c[j+4>>2]=0;c[j+8>>2]=0;o=0;ia(63,g|0,j|0);m=o;o=0;if(m&1){a=Na()|0;Im(j);Im(h);nn(g);break}Im(j);o=0;a=ma(28,n|0,51016,20)|0;m=o;o=0;do{if((!(m&1)?(o=0,f=ra(38,a|0,b&255|0)|0,m=o,o=0,!(m&1)):0)?(o=0,ma(28,f|0,51037,13)|0,m=o,o=0,!(m&1)):0){e=Ma(16)|0;o=0;ia(64,l|0,g|0);m=o;o=0;if(!(m&1)){o=0;a=ua(1)|0;m=o;o=0;if(!(m&1)?(o=0,Aa(36,e|0,11,a|0,l|0),m=o,o=0,!(m&1)):0){o=0;wa(6,e|0,824,96);o=0;d=0}else d=1;a=Na()|0;Im(l);if(!d)break}else a=Na()|0;La(e|0)}else p=40}while(0);if((p|0)==40)a=Na()|0;c[n>>2]=36200;c[k>>2]=36220;c[g>>2]=36236;Im(h);nn(g);fn(k);p=a;Ya(p|0)}}while(0);p=a;fn(k);Ya(p|0)}}return 0}function Oi(a){a=a|0;var b=0;if((Li(a)|0)<<24>>24!=1){a=1;return a|0}b=((Li(a)|0)&255)<<8;c[a+52>>2]=b|(Li(a)|0)&255;b=((Li(a)|0)&255)<<8;c[a+56>>2]=b|(Li(a)|0)&255;b=((Li(a)|0)&255)<<8;c[a+60>>2]=b|(Li(a)|0)&255;b=((Li(a)|0)&255)<<8;c[a+64>>2]=b|(Li(a)|0)&255;b=((Li(a)|0)&255)<<8;c[a+68>>2]=b|(Li(a)|0)&255;a=11;return a|0}function Pi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;d=i;i=i+16|0;f=d;c[f>>2]=0;g=f+4|0;c[g>>2]=0;c[f+8>>2]=0;o=0;wa(9,a|0,f|0,4);b=o;o=0;a:do{if(b&1)e=3;else{b=c[f>>2]|0;b:do{if(!(ol(b,51051,4)|0)){o=0;b=ka(69,a|0)|0;h=o;o=0;if(h&1){e=3;break a}b=b&255;switch(b|0){case 3:case 2:case 1:case 0:{c[a+44>>2]=b;a=5;b=c[f>>2]|0;break b}case 5:case 4:{b=Ma(16)|0;o=0;a=ua(1)|0;h=o;o=0;if(!(h&1)?(o=0,wa(7,b|0,7,a|0),h=o,o=0,!(h&1)):0){o=0;wa(6,b|0,824,96);o=0;e=3;break a}a=Na()|0;La(b|0);break a}default:{b=Ma(16)|0;o=0;a=ua(1)|0;h=o;o=0;if(!(h&1)?(o=0,wa(7,b|0,5,a|0),h=o,o=0,!(h&1)):0){o=0;wa(6,b|0,824,96);o=0;e=3;break a}a=Na()|0;La(b|0);break a}}}else a=4}while(0);if(!b){i=d;return a|0}if((c[g>>2]|0)!=(b|0))c[g>>2]=b;cj(b);i=d;return a|0}}while(0);if((e|0)==3)a=Na()|0;b=c[f>>2]|0;if(!b)Ya(a|0);if((c[g>>2]|0)!=(b|0))c[g>>2]=b;cj(b);Ya(a|0);return 0}function Qi(a){a=a|0;var b=0,d=0,e=0;e=c[(c[a>>2]|0)+-12>>2]|0;c[a+e>>2]=36200;b=a+(e+56)|0;c[b>>2]=36220;d=a+(e+4)|0;c[d>>2]=36236;Im(a+(e+36)|0);nn(d);fn(b);return}function Ri(a){a=a|0;return}function Si(a){a=a|0;cj(a);return}function Ti(b){b=b|0;a[b>>0]=0;b=b+4|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;c[b+16>>2]=0;c[b+20>>2]=0;c[b+24>>2]=0;c[b+28>>2]=0;return}function Ui(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;f=i;i=i+16|0;g=f;b=wi(b)|0;c[g>>2]=b;d=a+28|0;e=c[d>>2]|0;if(e>>>0<(c[a+32>>2]|0)>>>0){c[e>>2]=b;c[d>>2]=e+4;c[g>>2]=0;i=f;return}o=0;ia(57,a+24|0,g|0);a=o;o=0;if(a&1){b=Na()|0;d=c[g>>2]|0;c[g>>2]=0;if(!d)Ya(b|0);Bb[c[(c[d>>2]|0)+4>>2]&255](d);Ya(b|0)}else{b=c[g>>2]|0;c[g>>2]=0;if(!b){i=f;return}Bb[c[(c[b>>2]|0)+4>>2]&255](b);i=f;return}}function Vi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;e=a+4|0;c[e>>2]=c[b>>2];c[e+4>>2]=c[b+4>>2];c[e+8>>2]=c[b+8>>2];Di(a,-1);Di(a,-40);e=a+28|0;f=a+24|0;b=c[f>>2]|0;if((c[e>>2]|0)==(b|0)){Di(a,-1);Di(a,-39);a=a+16|0;a=c[a>>2]|0;return a|0}else d=0;do{g=c[b+(d<<2)>>2]|0;Cb[c[(c[g>>2]|0)+8>>2]&127](g,a);d=d+1|0;b=c[f>>2]|0}while(d>>>0<(c[e>>2]|0)-b>>2>>>0);Di(a,-1);Di(a,-39);g=a+16|0;g=c[g>>2]|0;return g|0}function Wi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,p=0;n=i;i=i+48|0;j=n+32|0;f=n+12|0;k=n+8|0;m=n+4|0;p=n;e=d+36|0;do{if(((((c[e>>2]|0)==0?(c[d+40>>2]|0)==0:0)?(c[d+44>>2]|0)==0:0)?(c[d+48>>2]|0)==0:0)?(c[d+52>>2]|0)==0:0){e=c[d+8>>2]|0;if((e|0)<=12){g=a+28|0;h=a+32|0;break}Ei(f,(1<>2]|0);e=vi(f)|0;c[k>>2]=e;g=a+28|0;f=c[g>>2]|0;h=a+32|0;if(f>>>0<(c[h>>2]|0)>>>0){c[f>>2]=e;c[g>>2]=f+4;c[k>>2]=0;break}o=0;ia(57,a+24|0,k|0);j=o;o=0;if(!(j&1)){e=c[k>>2]|0;c[k>>2]=0;if(!e)break;Bb[c[(c[e>>2]|0)+4>>2]&255](e);break}d=Na()|0;e=c[k>>2]|0;c[k>>2]=0;if(!e){p=d;Ya(p|0)}Bb[c[(c[e>>2]|0)+4>>2]&255](e);p=d;Ya(p|0)}else l=6}while(0);do{if((l|0)==6){e=vi(e)|0;c[j>>2]=e;g=a+28|0;f=c[g>>2]|0;h=a+32|0;if(f>>>0<(c[h>>2]|0)>>>0){c[f>>2]=e;c[g>>2]=f+4;c[j>>2]=0;break}o=0;ia(57,a+24|0,j|0);l=o;o=0;if(!(l&1)){e=c[j>>2]|0;c[j>>2]=0;if(!e)break;Bb[c[(c[e>>2]|0)+4>>2]&255](e);break}d=Na()|0;e=c[j>>2]|0;c[j>>2]=0;if(!e){p=d;Ya(p|0)}Bb[c[(c[e>>2]|0)+4>>2]&255](e);p=d;Ya(p|0)}}while(0);e=a+20|0;f=(c[e>>2]|0)+1|0;c[e>>2]=f;e=c[d+24>>2]|0;j=(e|0)==0?1:c[d+16>>2]|0;e=xi(f,j,c[d+20>>2]|0,e)|0;c[m>>2]=e;f=c[g>>2]|0;do{if(f>>>0<(c[h>>2]|0)>>>0){c[f>>2]=e;c[g>>2]=f+4;c[m>>2]=0}else{o=0;ia(57,a+24|0,m|0);l=o;o=0;if(!(l&1)){e=c[m>>2]|0;c[m>>2]=0;if(!e)break;Bb[c[(c[e>>2]|0)+4>>2]&255](e);break}d=Na()|0;e=c[m>>2]|0;c[m>>2]=0;if(!e){p=d;Ya(p|0)}Bb[c[(c[e>>2]|0)+4>>2]&255](e);p=d;Ya(p|0)}}while(0);k=bj(104)|0;c[k>>2]=36820;c[k+4>>2]=j;f=k+8|0;c[f>>2]=c[b>>2];c[f+4>>2]=c[b+4>>2];c[f+8>>2]=c[b+8>>2];f=k+20|0;e=f+84|0;do{c[f>>2]=c[d>>2];f=f+4|0;d=d+4|0}while((f|0)<(e|0));c[p>>2]=k;d=c[g>>2]|0;if(d>>>0<(c[h>>2]|0)>>>0){c[d>>2]=k;c[g>>2]=d+4;c[p>>2]=0;i=n;return}o=0;ia(57,a+24|0,p|0);a=o;o=0;if(a&1){d=Na()|0;e=c[p>>2]|0;c[p>>2]=0;if(!e){p=d;Ya(p|0)}Bb[c[(c[e>>2]|0)+4>>2]&255](e);p=d;Ya(p|0)}else{d=c[p>>2]|0;c[p>>2]=0;if(!d){i=n;return}Bb[c[(c[d>>2]|0)+4>>2]&255](d);i=n;return}}function Xi(b,d,e,f,g,h,j,k,l,m,n){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;var o=0,p=0,q=0,r=0,s=0,t=0,u=0;q=i;i=i+96|0;p=q;o=ic(b,d,p,0)|0;if(o){g=o;i=q;return g|0}a[p+32>>0]=0;s=c[p+8>>2]|0;u=c[p>>2]|0;t=c[p+4>>2]|0;o=$(t,u)|0;r=c[p+16>>2]|0;o=$($(o,(s|0)<9?1:2)|0,r)|0;c[f>>2]=o;o=Fl(o)|0;c[e>>2]=o;c[g>>2]=u;c[h>>2]=t;c[j>>2]=s;c[k>>2]=c[p+12>>2];c[l>>2]=r;c[m>>2]=c[p+20>>2];c[n>>2]=c[p+24>>2];g=jc(o,c[f>>2]|0,b,d,0,0)|0;i=q;return g|0}function Yi(a,b,d,e,f,g,h,j,k){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0;n=i;i=i+96|0;l=n+4|0;h=n;m=l;o=m+84|0;do{c[m>>2]=0;m=m+4|0}while((m|0)<(o|0));c[l+16>>2]=g;c[l+8>>2]=f;c[l>>2]=d;c[l+4>>2]=e;c[j>>2]=Fl(b)|0;c[h>>2]=0;d=hc(j,b,h,a,b,l,0)|0;c[k>>2]=c[h>>2];i=n;return d|0}function Zi(a,b){a=a|0;b=b|0;var d=0;d=i;i=i+16|0;c[d>>2]=b;b=c[9320]|0;cl(b,a,d)|0;Wk(10,b)|0;Ga()}function _i(a){a=a|0;Ka(51337,51366,1164,51442)}function $i(a){a=a|0;Ka(51463,51486,303,51442)}function aj(){var a=0,b=0;a=i;i=i+16|0;if(!(db(37024,4)|0)){b=$a(c[9255]|0)|0;i=a;return b|0}else Zi(51562,a);return 0}function bj(a){a=a|0;var b=0;b=(a|0)==0?1:a;a=Fl(b)|0;a:do{if(!a){while(1){a=kj()|0;if(!a)break;Rb[a&7]();a=Fl(b)|0;if(a)break a}b=Ma(4)|0;c[b>>2]=36844;lb(b|0,592,78)}}while(0);return a|0}function cj(a){a=a|0;Gl(a);return}function dj(a){a=a|0;cj(a);return}function ej(a){a=a|0;c[a>>2]=36844;return}function fj(a){a=a|0;return}function gj(a){a=a|0;cj(a);return}function hj(a){a=a|0;return 51611}function ij(a){a=a|0;var b=0;b=i;i=i+16|0;o=0;xa(a|0);a=o;o=0;if(!(a&1)){o=0;ia(85,51626,b|0);o=0}a=Na(0)|0;Va(a|0)|0;o=0;ia(85,51666,b+8|0);o=0;a=Na(0)|0;o=0;xa(3);b=o;o=0;if(b&1){b=Na(0)|0;ec(b)}else ec(a)}function jj(){var a=0,b=0,d=0;o=0;a=ua(2)|0;d=o;o=0;if(d&1){d=Na(0)|0;ec(d)}if(((a|0)!=0?(b=c[a>>2]|0,(b|0)!=0):0)?(d=b+48|0,(c[d>>2]&-256|0)==1126902528?(c[d+4>>2]|0)==1129074247:0):0)ij(c[b+12>>2]|0);d=c[9208]|0;c[9208]=d+0;ij(d)}function kj(){var a=0;a=c[9214]|0;c[9214]=a+0;return a|0}function lj(a){a=a|0;return}function mj(a){a=a|0;c[a>>2]=36868;Vj(a+4|0);return}function nj(a){a=a|0;mj(a);cj(a);return}function oj(a){a=a|0;return c[a+4>>2]|0}function pj(a){a=a|0;return}function qj(a){a=a|0;c[a>>2]=36888;return}function rj(a){a=a|0;return}function sj(a){a=a|0;cj(a);return}function tj(a){a=a|0;return 51716}function uj(a){a=a|0;return}function vj(a){a=a|0;return}function wj(a){a=a|0;return}function xj(a){a=a|0;cj(a);return}function yj(a){a=a|0;cj(a);return}function zj(a){a=a|0;cj(a);return}function Aj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=i;i=i+64|0;g=h;if((a|0)!=(b|0))if((b|0)!=0?(f=Gj(b,656,672,0)|0,(f|0)!=0):0){b=g;e=b+56|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(e|0));c[g>>2]=f;c[g+8>>2]=a;c[g+12>>2]=-1;c[g+48>>2]=1;Ub[c[(c[f>>2]|0)+28>>2]&63](f,g,c[d>>2]|0,1);if((c[g+24>>2]|0)==1){c[d>>2]=c[g+16>>2];b=1}else b=0}else b=0;else b=1;i=h;return b|0}function Bj(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;b=d+16|0;g=c[b>>2]|0;do{if(g){if((g|0)!=(e|0)){f=d+36|0;c[f>>2]=(c[f>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;break}b=d+24|0;if((c[b>>2]|0)==2)c[b>>2]=f}else{c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1}}while(0);return}function Cj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;if((a|0)==(c[b+8>>2]|0))Bj(0,b,d,e);return}function Dj(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;if((a|0)==(c[b+8>>2]|0))Bj(0,b,d,e);else{a=c[a+8>>2]|0;Ub[c[(c[a>>2]|0)+28>>2]&63](a,b,d,e)}return}function Ej(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=c[a+4>>2]|0;f=g>>8;if(g&1)f=c[(c[d>>2]|0)+f>>2]|0;a=c[a>>2]|0;Ub[c[(c[a>>2]|0)+28>>2]&63](a,b,d+f|0,(g&2|0)!=0?e:2);return}function Fj(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;a:do{if((b|0)!=(c[d+8>>2]|0)){h=c[b+12>>2]|0;g=b+16+(h<<3)|0;Ej(b+16|0,d,e,f);if((h|0)>1){h=d+54|0;b=b+24|0;do{Ej(b,d,e,f);if(a[h>>0]|0)break a;b=b+8|0}while(b>>>0>>0)}}else Bj(0,d,e,f)}while(0);return}function Gj(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+64|0;q=r;p=c[d>>2]|0;o=d+(c[p+-8>>2]|0)|0;p=c[p+-4>>2]|0;c[q>>2]=f;c[q+4>>2]=d;c[q+8>>2]=e;c[q+12>>2]=g;g=q+16|0;d=q+20|0;e=q+24|0;h=q+28|0;j=q+32|0;k=q+40|0;l=(p|0)==(f|0);m=g;n=m+36|0;do{c[m>>2]=0;m=m+4|0}while((m|0)<(n|0));b[g+36>>1]=0;a[g+38>>0]=0;a:do{if(l){c[q+48>>2]=1;Ib[c[(c[f>>2]|0)+20>>2]&15](f,q,o,o,1,0);g=(c[e>>2]|0)==1?o:0}else{zb[c[(c[p>>2]|0)+24>>2]&15](p,q,o,1,0);switch(c[q+36>>2]|0){case 0:{g=(c[k>>2]|0)==1&(c[h>>2]|0)==1&(c[j>>2]|0)==1?c[d>>2]|0:0;break a}case 1:break;default:{g=0;break a}}if((c[e>>2]|0)!=1?!((c[k>>2]|0)==0&(c[h>>2]|0)==1&(c[j>>2]|0)==1):0){g=0;break}g=c[g>>2]|0}}while(0);i=r;return g|0}function Hj(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;a[d+53>>0]=1;do{if((c[d+4>>2]|0)==(f|0)){a[d+52>>0]=1;f=d+16|0;b=c[f>>2]|0;if(!b){c[f>>2]=e;c[d+24>>2]=g;c[d+36>>2]=1;if(!((g|0)==1?(c[d+48>>2]|0)==1:0))break;a[d+54>>0]=1;break}if((b|0)!=(e|0)){g=d+36|0;c[g>>2]=(c[g>>2]|0)+1;a[d+54>>0]=1;break}b=d+24|0;f=c[b>>2]|0;if((f|0)==2){c[b>>2]=g;f=g}if((f|0)==1?(c[d+48>>2]|0)==1:0)a[d+54>>0]=1}}while(0);return}function Ij(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;a:do{if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(h=d+28|0,(c[h>>2]|0)!=1):0)c[h>>2]=f}else{if((b|0)!=(c[d>>2]|0)){q=c[b+12>>2]|0;j=b+16+(q<<3)|0;Kj(b+16|0,d,e,f,g);h=b+24|0;if((q|0)<=1)break;i=c[b+8>>2]|0;if((i&2|0)==0?(k=d+36|0,(c[k>>2]|0)!=1):0){if(!(i&1)){i=d+54|0;while(1){if(a[i>>0]|0)break a;if((c[k>>2]|0)==1)break a;Kj(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}i=d+24|0;b=d+54|0;while(1){if(a[b>>0]|0)break a;if((c[k>>2]|0)==1?(c[i>>2]|0)==1:0)break a;Kj(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}i=d+54|0;while(1){if(a[i>>0]|0)break a;Kj(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}if((c[d+16>>2]|0)!=(e|0)?(p=d+20|0,(c[p>>2]|0)!=(e|0)):0){c[d+32>>2]=f;m=d+44|0;if((c[m>>2]|0)==4)break;i=c[b+12>>2]|0;j=b+16+(i<<3)|0;k=d+52|0;f=d+53|0;n=d+54|0;l=b+8|0;o=d+24|0;b:do{if((i|0)>0){i=0;h=0;b=b+16|0;while(1){a[k>>0]=0;a[f>>0]=0;Jj(b,d,e,e,1,g);if(a[n>>0]|0){q=20;break b}do{if(a[f>>0]|0){if(!(a[k>>0]|0))if(!(c[l>>2]&1)){h=1;q=20;break b}else{h=1;break}if((c[o>>2]|0)==1)break b;if(!(c[l>>2]&2))break b;else{i=1;h=1}}}while(0);b=b+8|0;if(b>>>0>=j>>>0){q=20;break}}}else{i=0;h=0;q=20}}while(0);do{if((q|0)==20){if((!i?(c[p>>2]=e,e=d+40|0,c[e>>2]=(c[e>>2]|0)+1,(c[d+36>>2]|0)==1):0)?(c[o>>2]|0)==2:0){a[n>>0]=1;if(h)break}else q=24;if((q|0)==24?h:0)break;c[m>>2]=4;break a}}while(0);c[m>>2]=3;break}if((f|0)==1)c[d+32>>2]=1}}while(0);return}function Jj(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=c[a+4>>2]|0;h=i>>8;if(i&1)h=c[(c[e>>2]|0)+h>>2]|0;a=c[a>>2]|0;Ib[c[(c[a>>2]|0)+20>>2]&15](a,b,d,e+h|0,(i&2|0)!=0?f:2,g);return}function Kj(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;h=c[a+4>>2]|0;g=h>>8;if(h&1)g=c[(c[d>>2]|0)+g>>2]|0;a=c[a>>2]|0;zb[c[(c[a>>2]|0)+24>>2]&15](a,b,d+g|0,(h&2|0)!=0?e:2,f);return}function Lj(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0;a:do{if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(h=d+28|0,(c[h>>2]|0)!=1):0)c[h>>2]=f}else{if((b|0)!=(c[d>>2]|0)){j=c[b+8>>2]|0;zb[c[(c[j>>2]|0)+24>>2]&15](j,d,e,f,g);break}if((c[d+16>>2]|0)!=(e|0)?(i=d+20|0,(c[i>>2]|0)!=(e|0)):0){c[d+32>>2]=f;f=d+44|0;if((c[f>>2]|0)==4)break;h=d+52|0;a[h>>0]=0;k=d+53|0;a[k>>0]=0;b=c[b+8>>2]|0;Ib[c[(c[b>>2]|0)+20>>2]&15](b,d,e,e,1,g);if(a[k>>0]|0){if(!(a[h>>0]|0)){h=1;j=13}}else{h=0;j=13}do{if((j|0)==13){c[i>>2]=e;k=d+40|0;c[k>>2]=(c[k>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0){a[d+54>>0]=1;if(h)break}else j=16;if((j|0)==16?h:0)break;c[f>>2]=4;break a}}while(0);c[f>>2]=3;break}if((f|0)==1)c[d+32>>2]=1}}while(0);return}function Mj(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;do{if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(i=d+28|0,(c[i>>2]|0)!=1):0)c[i>>2]=f}else if((b|0)==(c[d>>2]|0)){if((c[d+16>>2]|0)!=(e|0)?(h=d+20|0,(c[h>>2]|0)!=(e|0)):0){c[d+32>>2]=f;c[h>>2]=e;g=d+40|0;c[g>>2]=(c[g>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0)a[d+54>>0]=1;c[d+44>>2]=4;break}if((f|0)==1)c[d+32>>2]=1}}while(0);return}function Nj(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if((b|0)==(c[d+8>>2]|0))Hj(0,d,e,f,g);else{m=d+52|0;n=a[m>>0]|0;o=d+53|0;p=a[o>>0]|0;l=c[b+12>>2]|0;i=b+16+(l<<3)|0;a[m>>0]=0;a[o>>0]=0;Jj(b+16|0,d,e,f,g,h);a:do{if((l|0)>1){j=d+24|0;k=b+8|0;l=d+54|0;b=b+24|0;do{if(a[l>>0]|0)break a;if(!(a[m>>0]|0)){if((a[o>>0]|0)!=0?(c[k>>2]&1|0)==0:0)break a}else{if((c[j>>2]|0)==1)break a;if(!(c[k>>2]&2))break a}a[m>>0]=0;a[o>>0]=0;Jj(b,d,e,f,g,h);b=b+8|0}while(b>>>0>>0)}}while(0);a[m>>0]=n;a[o>>0]=p}return}function Oj(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;if((a|0)==(c[b+8>>2]|0))Hj(0,b,d,e,f);else{a=c[a+8>>2]|0;Ib[c[(c[a>>2]|0)+20>>2]&15](a,b,d,e,f,g)}return}function Pj(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;if((a|0)==(c[b+8>>2]|0))Hj(0,b,d,e,f);return}function Qj(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=i;i=i+16|0;e=f;c[e>>2]=c[d>>2];a=Gb[c[(c[a>>2]|0)+16>>2]&63](a,b,e)|0;if(a)c[d>>2]=c[e>>2];i=f;return a&1|0}function Rj(a){a=a|0;if(!a)a=0;else a=(Gj(a,656,704,0)|0)!=0;return a&1|0}function Sj(){var a=0;a=Ma(4)|0;ej(a);lb(a|0,592,78)}function Tj(){var a=0,b=0,d=0,e=0,f=0,g=0,h=0,j=0;f=i;i=i+48|0;h=f+32|0;d=f+24|0;j=f+16|0;g=f;f=f+36|0;a=aj()|0;if((a|0)!=0?(e=c[a>>2]|0,(e|0)!=0):0){a=e+48|0;b=c[a>>2]|0;a=c[a+4>>2]|0;if(!((b&-256|0)==1126902528&(a|0)==1129074247)){c[d>>2]=c[9257];Zi(51919,d)}if((b|0)==1126902529&(a|0)==1129074247)a=c[e+44>>2]|0;else a=e+80|0;c[f>>2]=a;e=c[e>>2]|0;a=c[e+4>>2]|0;if(Gb[c[(c[608>>2]|0)+16>>2]&63](608,e,f)|0){j=c[f>>2]|0;f=c[9257]|0;j=Eb[c[(c[j>>2]|0)+8>>2]&127](j)|0;c[g>>2]=f;c[g+4>>2]=a;c[g+8>>2]=j;Zi(51833,g)}else{c[j>>2]=c[9257];c[j+4>>2]=a;Zi(51878,j)}}Zi(51957,h)}function Uj(){var a=0;a=i;i=i+16|0;if(!(Fa(37020,184)|0)){i=a;return}else Zi(51730,a)}function Vj(a){a=a|0;var b=0,d=0;d=(c[a>>2]|0)+-4|0;b=c[d>>2]|0;c[d>>2]=b+-1;if((b+-1|0)<0)cj((c[a>>2]|0)+-12|0);return}function Wj(a){a=a|0;var b=0;b=i;i=i+16|0;Gl(a);if(!(jb(c[9255]|0,0)|0)){i=b;return}else Zi(51780,b)}function Xj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;a=hl(a,b,c)|0;return a|0}function Yj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;a=il(a,b,c)|0;return a|0}function Zj(){return 37296}function _j(){return 37300}function $j(){return 37304}function ak(a){a=a|0;return((a|0)==32|(a+-9|0)>>>0<5)&1|0}function bk(a){a=a|0;if((a+-48|0)>>>0<10)a=1;else a=((a|32)+-97|0)>>>0<6;return a&1|0}function ck(){var a=0;if(!(c[9258]|0))a=37308;else a=c[(bb()|0)+60>>2]|0;return a|0}function dk(b){b=b|0;var c=0,e=0;c=0;while(1){if((d[51978+c>>0]|0)==(b|0)){e=2;break}c=c+1|0;if((c|0)==87){c=87;b=52066;e=5;break}}if((e|0)==2)if(!c)b=52066;else{b=52066;e=5}if((e|0)==5)while(1){e=b;while(1){b=e+1|0;if(!(a[e>>0]|0))break;else e=b}c=c+-1|0;if(!c)break;else e=5}return b|0}function ek(b,e,f){b=b|0;e=e|0;f=f|0;var g=0.0,h=0,j=0.0,k=0,l=0,m=0.0,n=0,o=0,p=0,q=0.0,r=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0.0;L=i;i=i+512|0;H=L;switch(e|0){case 0:{K=24;J=-149;A=4;break}case 1:{K=53;J=-1074;A=4;break}case 2:{K=53;J=-1074;A=4;break}default:g=0.0}a:do{if((A|0)==4){E=b+4|0;C=b+100|0;do{e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0}while((ak(e)|0)!=0);b:do{switch(e|0){case 43:case 45:{h=1-(((e|0)==45&1)<<1)|0;e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0;I=h;break b}else{e=hk(b)|0;I=h;break b}}default:I=1}}while(0);h=e;e=0;do{if((h|32|0)!=(a[53870+e>>0]|0))break;do{if(e>>>0<7){h=c[E>>2]|0;if(h>>>0<(c[C>>2]|0)>>>0){c[E>>2]=h+1;h=d[h>>0]|0;break}else{h=hk(b)|0;break}}}while(0);e=e+1|0}while(e>>>0<8);c:do{switch(e|0){case 8:break;case 3:{A=23;break}default:{k=(f|0)!=0;if(k&e>>>0>3)if((e|0)==8)break c;else{A=23;break c}d:do{if(!e){e=0;do{if((h|32|0)!=(a[56747+e>>0]|0))break d;do{if(e>>>0<2){h=c[E>>2]|0;if(h>>>0<(c[C>>2]|0)>>>0){c[E>>2]=h+1;h=d[h>>0]|0;break}else{h=hk(b)|0;break}}}while(0);e=e+1|0}while(e>>>0<3)}}while(0);switch(e|0){case 3:{e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0;if((e|0)==40)e=1;else{if(!(c[C>>2]|0)){g=s;break a}c[E>>2]=(c[E>>2]|0)+-1;g=s;break a}while(1){h=c[E>>2]|0;if(h>>>0<(c[C>>2]|0)>>>0){c[E>>2]=h+1;h=d[h>>0]|0}else h=hk(b)|0;if(!((h+-48|0)>>>0<10|(h+-65|0)>>>0<26)?!((h|0)==95|(h+-97|0)>>>0<26):0)break;e=e+1|0}if((h|0)==41){g=s;break a}h=(c[C>>2]|0)==0;if(!h)c[E>>2]=(c[E>>2]|0)+-1;if(!k){c[(ck()|0)>>2]=22;gk(b,0);g=0.0;break a}if(!e){g=s;break a}while(1){e=e+-1|0;if(!h)c[E>>2]=(c[E>>2]|0)+-1;if(!e){g=s;break a}}}case 0:{do{if((h|0)==48){e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0;if((e|32|0)!=120){if(!(c[C>>2]|0)){e=48;break}c[E>>2]=(c[E>>2]|0)+-1;e=48;break}e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0;k=0}else{e=hk(b)|0;k=0}e:while(1){switch(e|0){case 46:{A=74;break e}case 48:break;default:{y=0;l=0;x=0;h=0;n=k;o=0;w=0;m=1.0;k=0;g=0.0;break e}}e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0;k=1;continue}else{e=hk(b)|0;k=1;continue}}if((A|0)==74){e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0;if((e|0)==48){k=0;h=0;do{e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0;k=jw(k|0,h|0,-1,-1)|0;h=D}while((e|0)==48);y=0;l=0;x=k;n=1;o=1;w=0;m=1.0;k=0;g=0.0}else{y=0;l=0;x=0;h=0;n=k;o=1;w=0;m=1.0;k=0;g=0.0}}while(1){u=e+-48|0;p=e|32;if(u>>>0>=10){v=(e|0)==46;if(!(v|(p+-97|0)>>>0<6)){p=x;u=y;break}if(v)if(!o){v=l;h=y;u=y;o=1;p=w;j=m}else{p=x;u=y;e=46;break}else A=86}else A=86;if((A|0)==86){A=0;e=(e|0)>57?p+-87|0:u;do{if(!((y|0)<0|(y|0)==0&l>>>0<8)){if((y|0)<0|(y|0)==0&l>>>0<14){r=m*.0625;p=w;j=r;g=g+r*+(e|0);break}if((w|0)!=0|(e|0)==0){p=w;j=m}else{p=1;j=m;g=g+m*.5}}else{p=w;j=m;k=e+(k<<4)|0}}while(0);l=jw(l|0,y|0,1,0)|0;v=x;u=D;n=1}e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;y=u;x=v;e=d[e>>0]|0;w=p;m=j;continue}else{y=u;x=v;e=hk(b)|0;w=p;m=j;continue}}if(!n){e=(c[C>>2]|0)==0;if(!e)c[E>>2]=(c[E>>2]|0)+-1;if(f){if(!e?(z=c[E>>2]|0,c[E>>2]=z+-1,(o|0)!=0):0)c[E>>2]=z+-2}else gk(b,0);g=+(I|0)*0.0;break a}n=(o|0)==0;o=n?l:p;n=n?u:h;if((u|0)<0|(u|0)==0&l>>>0<8){h=u;do{k=k<<4;l=jw(l|0,h|0,1,0)|0;h=D}while((h|0)<0|(h|0)==0&l>>>0<8)}if((e|32|0)==112){h=tl(b,f)|0;e=D;if((h|0)==0&(e|0)==-2147483648){if(!f){gk(b,0);g=0.0;break a}if(!(c[C>>2]|0)){h=0;e=0}else{c[E>>2]=(c[E>>2]|0)+-1;h=0;e=0}}}else if(!(c[C>>2]|0)){h=0;e=0}else{c[E>>2]=(c[E>>2]|0)+-1;h=0;e=0}H=mw(o|0,n|0,2)|0;H=jw(H|0,D|0,-32,-1)|0;e=jw(H|0,D|0,h|0,e|0)|0;h=D;if(!k){g=+(I|0)*0.0;break a}if((h|0)>0|(h|0)==0&e>>>0>(0-J|0)>>>0){c[(ck()|0)>>2]=34;g=+(I|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break a}H=J+-106|0;G=((H|0)<0)<<31>>31;if((h|0)<(G|0)|(h|0)==(G|0)&e>>>0>>0){c[(ck()|0)>>2]=34;g=+(I|0)*2.2250738585072014e-308*2.2250738585072014e-308;break a}if((k|0)>-1){do{G=!(g>=.5);H=G&1|k<<1;k=H^1;g=g+(G?g:g+-1.0);e=jw(e|0,h|0,-1,-1)|0;h=D}while((H|0)>-1);l=e;m=g}else{l=e;m=g}e=hw(32,0,J|0,((J|0)<0)<<31>>31|0)|0;e=jw(l|0,h|0,e|0,D|0)|0;J=D;if(0>(J|0)|0==(J|0)&K>>>0>e>>>0)if((e|0)<0){e=0;A=127}else A=125;else{e=K;A=125}if((A|0)==125)if((e|0)<53)A=127;else{h=e;j=+(I|0);g=0.0}if((A|0)==127){g=+(I|0);h=e;j=g;g=+sk(+xk(1.0,84-e|0),g)}K=(k&1|0)==0&(m!=0.0&(h|0)<32);g=j*(K?0.0:m)+(g+j*+(((K&1)+k|0)>>>0))-g;if(!(g!=0.0))c[(ck()|0)>>2]=34;g=+yk(g,l);break a}else e=h}while(0);F=J+K|0;G=0-F|0;k=0;f:while(1){switch(e|0){case 46:{A=138;break f}case 48:break;default:{h=0;p=0;o=0;break f}}e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0;k=1;continue}else{e=hk(b)|0;k=1;continue}}if((A|0)==138){e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0;if((e|0)==48){h=0;e=0;while(1){h=jw(h|0,e|0,-1,-1)|0;k=D;e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0;if((e|0)==48)e=k;else{p=k;k=1;o=1;break}}}else{h=0;p=0;o=1}}c[H>>2]=0;n=e+-48|0;l=(e|0)==46;g:do{if(l|n>>>0<10){B=H+496|0;y=0;v=0;w=l;A=p;u=k;z=o;k=0;l=0;o=0;h:while(1){do{if(w)if(!z){h=y;p=v;z=1}else{p=A;e=y;n=v;break h}else{w=jw(y|0,v|0,1,0)|0;v=D;x=(e|0)!=48;if((l|0)>=125){if(!x){p=A;y=w;break}c[B>>2]=c[B>>2]|1;p=A;y=w;break}p=H+(l<<2)|0;if(k)n=e+-48+((c[p>>2]|0)*10|0)|0;c[p>>2]=n;k=k+1|0;n=(k|0)==9;p=A;y=w;u=1;k=n?0:k;l=(n&1)+l|0;o=x?w:o}}while(0);e=c[E>>2]|0;if(e>>>0<(c[C>>2]|0)>>>0){c[E>>2]=e+1;e=d[e>>0]|0}else e=hk(b)|0;n=e+-48|0;w=(e|0)==46;if(!(w|n>>>0<10)){n=z;A=161;break g}else A=p}u=(u|0)!=0;A=169}else{y=0;v=0;u=k;n=o;k=0;l=0;o=0;A=161}}while(0);do{if((A|0)==161){B=(n|0)==0;h=B?y:h;p=B?v:p;u=(u|0)!=0;if(!((e|32|0)==101&u))if((e|0)>-1){e=y;n=v;A=169;break}else{e=y;n=v;A=171;break}n=tl(b,f)|0;e=D;if((n|0)==0&(e|0)==-2147483648){if(!f){gk(b,0);g=0.0;break}if(!(c[C>>2]|0)){n=0;e=0}else{c[E>>2]=(c[E>>2]|0)+-1;n=0;e=0}}h=jw(n|0,e|0,h|0,p|0)|0;u=y;p=D;n=v;A=173}}while(0);if((A|0)==169)if(c[C>>2]|0){c[E>>2]=(c[E>>2]|0)+-1;if(u){u=e;A=173}else A=172}else A=171;if((A|0)==171)if(u){u=e;A=173}else A=172;do{if((A|0)==172){c[(ck()|0)>>2]=22;gk(b,0);g=0.0}else if((A|0)==173){e=c[H>>2]|0;if(!e){g=+(I|0)*0.0;break}if(((n|0)<0|(n|0)==0&u>>>0<10)&((h|0)==(u|0)&(p|0)==(n|0))?K>>>0>30|(e>>>K|0)==0:0){g=+(I|0)*+(e>>>0);break}b=(J|0)/-2|0;E=((b|0)<0)<<31>>31;if((p|0)>(E|0)|(p|0)==(E|0)&h>>>0>b>>>0){c[(ck()|0)>>2]=34;g=+(I|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}b=J+-106|0;E=((b|0)<0)<<31>>31;if((p|0)<(E|0)|(p|0)==(E|0)&h>>>0>>0){c[(ck()|0)>>2]=34;g=+(I|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if(k){if((k|0)<9){n=H+(l<<2)|0;e=c[n>>2]|0;do{e=e*10|0;k=k+1|0}while((k|0)!=9);c[n>>2]=e}l=l+1|0}if((o|0)<9?(o|0)<=(h|0)&(h|0)<18:0){if((h|0)==9){g=+(I|0)*+((c[H>>2]|0)>>>0);break}if((h|0)<9){g=+(I|0)*+((c[H>>2]|0)>>>0)/+(c[37312+(8-h<<2)>>2]|0);break}b=K+27+($(h,-3)|0)|0;e=c[H>>2]|0;if((b|0)>30|(e>>>b|0)==0){g=+(I|0)*+(e>>>0)*+(c[37312+(h+-10<<2)>>2]|0);break}}e=(h|0)%9|0;if(!e){k=0;e=0}else{u=(h|0)>-1?e:e+9|0;n=c[37312+(8-u<<2)>>2]|0;if(l){o=1e9/(n|0)|0;k=0;e=0;p=0;do{C=H+(p<<2)|0;E=c[C>>2]|0;b=((E>>>0)/(n>>>0)|0)+e|0;c[C>>2]=b;e=$((E>>>0)%(n>>>0)|0,o)|0;b=(p|0)==(k|0)&(b|0)==0;p=p+1|0;h=b?h+-9|0:h;k=b?p&127:k}while((p|0)!=(l|0));if(e){c[H+(l<<2)>>2]=e;l=l+1|0}}else{k=0;l=0}e=0;h=9-u+h|0}i:while(1){v=(h|0)<18;w=(h|0)==18;x=H+(k<<2)|0;do{if(!v){if(!w)break i;if((c[x>>2]|0)>>>0>=9007199){h=18;break i}}n=0;o=l+127|0;while(1){u=o&127;p=H+(u<<2)|0;o=mw(c[p>>2]|0,0,29)|0;o=jw(o|0,D|0,n|0,0)|0;n=D;if(n>>>0>0|(n|0)==0&o>>>0>1e9){b=uw(o|0,n|0,1e9,0)|0;o=vw(o|0,n|0,1e9,0)|0;n=b}else n=0;c[p>>2]=o;b=(u|0)==(k|0);l=(u|0)!=(l+127&127|0)|b?l:(o|0)==0?u:l;if(b)break;else o=u+-1|0}e=e+-29|0}while((n|0)==0);k=k+127&127;if((k|0)==(l|0)){b=l+127&127;l=H+((l+126&127)<<2)|0;c[l>>2]=c[l>>2]|c[H+(b<<2)>>2];l=b}c[H+(k<<2)>>2]=n;h=h+9|0}j:while(1){y=l+1&127;x=H+((l+127&127)<<2)|0;while(1){v=(h|0)==18;w=(h|0)>27?9:1;u=v^1;while(1){o=k&127;p=(o|0)==(l|0);do{if(!p){n=c[H+(o<<2)>>2]|0;if(n>>>0<9007199){A=219;break}if(n>>>0>9007199)break;n=k+1&127;if((n|0)==(l|0)){A=219;break}n=c[H+(n<<2)>>2]|0;if(n>>>0<254740991){A=219;break}if(!(n>>>0>254740991|u)){h=o;break j}}else A=219}while(0);if((A|0)==219?(A=0,v):0){A=220;break j}e=e+w|0;if((k|0)==(l|0))k=l;else break}u=(1<>>w;o=k;n=0;p=k;while(1){E=H+(p<<2)|0;b=c[E>>2]|0;k=(b>>>w)+n|0;c[E>>2]=k;n=$(b&u,v)|0;k=(p|0)==(o|0)&(k|0)==0;p=p+1&127;h=k?h+-9|0:h;k=k?p:o;if((p|0)==(l|0))break;else o=k}if(!n)continue;if((y|0)!=(k|0))break;c[x>>2]=c[x>>2]|1}c[H+(l<<2)>>2]=n;l=y}if((A|0)==220)if(p){c[H+(y+-1<<2)>>2]=0;h=l;l=y}else h=o;g=+((c[H+(h<<2)>>2]|0)>>>0);h=k+1&127;if((h|0)==(l|0)){l=k+2&127;c[H+(l+-1<<2)>>2]=0}r=+(I|0);j=r*(g*1.0e9+ +((c[H+(h<<2)>>2]|0)>>>0));v=e+53|0;p=v-J|0;u=(p|0)<(K|0);h=u&1;o=u?(p|0)<0?0:p:K;if((o|0)<53){M=+sk(+xk(1.0,105-o|0),j);m=+uk(j,+xk(1.0,53-o|0));q=M;g=m;m=M+(j-m)}else{q=0.0;g=0.0;m=j}n=k+2&127;do{if((n|0)==(l|0))j=g;else{n=c[H+(n<<2)>>2]|0;do{if(n>>>0>=5e8){if(n>>>0>5e8){g=r*.75+g;break}if((k+3&127|0)==(l|0)){g=r*.5+g;break}else{g=r*.75+g;break}}else{if((n|0)==0?(k+3&127|0)==(l|0):0)break;g=r*.25+g}}while(0);if((53-o|0)<=1){j=g;break}if(+uk(g,1.0)!=0.0){j=g;break}j=g+1.0}}while(0);g=m+j-q;do{if((v&2147483647|0)>(-2-F|0)){if(+O(+g)>=9007199254740992.0){h=u&(o|0)==(p|0)?0:h;e=e+1|0;g=g*.5}if((e+50|0)<=(G|0)?!(j!=0.0&(h|0)!=0):0)break;c[(ck()|0)>>2]=34}}while(0);g=+yk(g,e)}}while(0);break a}default:{if(c[C>>2]|0)c[E>>2]=(c[E>>2]|0)+-1;c[(ck()|0)>>2]=22;gk(b,0);g=0.0;break a}}}}}while(0);if((A|0)==23){h=(c[C>>2]|0)==0;if(!h)c[E>>2]=(c[E>>2]|0)+-1;if((f|0)!=0&e>>>0>3)do{if(!h)c[E>>2]=(c[E>>2]|0)+-1;e=e+-1|0}while(e>>>0>3)}g=+(I|0)*t}}while(0);i=L;return+g}function fk(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;a:do{if(e>>>0>36){c[(ck()|0)>>2]=22;h=0;g=0}else{r=b+4|0;q=b+100|0;do{i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0}while((ak(i)|0)!=0);b:do{switch(i|0){case 43:case 45:{j=((i|0)==45)<<31>>31;i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0;p=j;break b}else{i=hk(b)|0;p=j;break b}}default:p=0}}while(0);j=(e|0)==0;do{if((e&-17|0)==0&(i|0)==48){i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0;if((i|32|0)!=120)if(j){e=8;n=46;break}else{n=32;break}e=c[r>>2]|0;if(e>>>0<(c[q>>2]|0)>>>0){c[r>>2]=e+1;i=d[e>>0]|0}else i=hk(b)|0;if((d[53879+(i+1)>>0]|0)>15){g=(c[q>>2]|0)==0;if(!g)c[r>>2]=(c[r>>2]|0)+-1;if(!f){gk(b,0);h=0;g=0;break a}if(g){h=0;g=0;break a}c[r>>2]=(c[r>>2]|0)+-1;h=0;g=0;break a}else{e=16;n=46}}else{e=j?10:e;if((d[53879+(i+1)>>0]|0)>>>0>>0)n=32;else{if(c[q>>2]|0)c[r>>2]=(c[r>>2]|0)+-1;gk(b,0);c[(ck()|0)>>2]=22;h=0;g=0;break a}}}while(0);if((n|0)==32)if((e|0)==10){e=i+-48|0;if(e>>>0<10){i=0;while(1){j=(i*10|0)+e|0;e=c[r>>2]|0;if(e>>>0<(c[q>>2]|0)>>>0){c[r>>2]=e+1;i=d[e>>0]|0}else i=hk(b)|0;e=i+-48|0;if(!(e>>>0<10&j>>>0<429496729)){e=j;break}else i=j}j=0}else{e=0;j=0}f=i+-48|0;if(f>>>0<10){while(1){k=tw(e|0,j|0,10,0)|0;l=D;m=((f|0)<0)<<31>>31;o=~m;if(l>>>0>o>>>0|(l|0)==(o|0)&k>>>0>~f>>>0){k=e;break}e=jw(k|0,l|0,f|0,m|0)|0;j=D;i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0;f=i+-48|0;if(!(f>>>0<10&(j>>>0<429496729|(j|0)==429496729&e>>>0<2576980378))){k=e;break}}if(f>>>0>9){i=k;e=p}else{e=10;n=72}}else{i=e;e=p}}else n=46;c:do{if((n|0)==46){if(!(e+-1&e)){n=a[54136+((e*23|0)>>>5&7)>>0]|0;j=a[53879+(i+1)>>0]|0;f=j&255;if(f>>>0>>0){i=0;while(1){k=f|i<>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0;j=a[53879+(i+1)>>0]|0;f=j&255;if(!(k>>>0<134217728&f>>>0>>0))break;else i=k}f=0}else{f=0;k=0}l=kw(-1,-1,n|0)|0;m=D;if((j&255)>>>0>=e>>>0|(f>>>0>m>>>0|(f|0)==(m|0)&k>>>0>l>>>0)){j=f;n=72;break}else i=f;while(1){k=mw(k|0,i|0,n|0)|0;f=D;k=j&255|k;i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0;j=a[53879+(i+1)>>0]|0;if((j&255)>>>0>=e>>>0|(f>>>0>m>>>0|(f|0)==(m|0)&k>>>0>l>>>0)){j=f;n=72;break c}else i=f}}j=a[53879+(i+1)>>0]|0;f=j&255;if(f>>>0>>0){i=0;while(1){k=f+($(i,e)|0)|0;i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0;j=a[53879+(i+1)>>0]|0;f=j&255;if(!(k>>>0<119304647&f>>>0>>0))break;else i=k}f=0}else{k=0;f=0}if((j&255)>>>0>>0){n=uw(-1,-1,e|0,0)|0;o=D;m=f;while(1){if(m>>>0>o>>>0|(m|0)==(o|0)&k>>>0>n>>>0){j=m;n=72;break c}f=tw(k|0,m|0,e|0,0)|0;l=D;j=j&255;if(l>>>0>4294967295|(l|0)==-1&f>>>0>~j>>>0){j=m;n=72;break c}k=jw(j|0,0,f|0,l|0)|0;f=D;i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0;j=a[53879+(i+1)>>0]|0;if((j&255)>>>0>=e>>>0){j=f;n=72;break}else m=f}}else{j=f;n=72}}}while(0);if((n|0)==72)if((d[53879+(i+1)>>0]|0)>>>0>>0){do{i=c[r>>2]|0;if(i>>>0<(c[q>>2]|0)>>>0){c[r>>2]=i+1;i=d[i>>0]|0}else i=hk(b)|0}while((d[53879+(i+1)>>0]|0)>>>0>>0);c[(ck()|0)>>2]=34;j=h;i=g;e=(g&1|0)==0&0==0?p:0}else{i=k;e=p}if(c[q>>2]|0)c[r>>2]=(c[r>>2]|0)+-1;if(!(j>>>0>>0|(j|0)==(h|0)&i>>>0>>0)){if(!((g&1|0)!=0|0!=0|(e|0)!=0)){c[(ck()|0)>>2]=34;g=jw(g|0,h|0,-1,-1)|0;h=D;break}if(j>>>0>h>>>0|(j|0)==(h|0)&i>>>0>g>>>0){c[(ck()|0)>>2]=34;break}}g=((e|0)<0)<<31>>31;g=hw(i^e|0,j^g|0,e|0,g|0)|0;h=D}}while(0);D=h;return g|0}function gk(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;c[a+104>>2]=b;d=c[a+4>>2]|0;e=c[a+8>>2]|0;f=e-d|0;c[a+108>>2]=f;if((b|0)!=0&(f|0)>(b|0))c[a+100>>2]=d+b;else c[a+100>>2]=e;return}function hk(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0;f=b+104|0;i=c[f>>2]|0;if((i|0)!=0?(c[b+108>>2]|0)>=(i|0):0)j=4;else{e=Uk(b)|0;if((e|0)>=0){h=c[f>>2]|0;f=b+8|0;if(h){g=c[f>>2]|0;i=c[b+4>>2]|0;f=g;h=h-(c[b+108>>2]|0)+-1|0;if((f-i|0)>(h|0))c[b+100>>2]=i+h;else j=9}else{g=c[f>>2]|0;f=g;j=9}if((j|0)==9)c[b+100>>2]=f;f=c[b+4>>2]|0;if(g){b=b+108|0;c[b>>2]=g+1-f+(c[b>>2]|0)}f=f+-1|0;if((d[f>>0]|0|0)!=(e|0))a[f>>0]=e}else j=4}if((j|0)==4){c[b+100>>2]=0;e=-1}return e|0}function ik(a){a=a|0;if(a>>>0>4294963200){c[(ck()|0)>>2]=0-a;a=-1}return a|0}function jk(a){a=a|0;return 0}function kk(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return d|0}function lk(a,b){a=a|0;b=b|0;return-1|0}function mk(a){a=a|0;Gl(a);return}function nk(a,b){a=a|0;b=b|0;return(a+-48|0)>>>0<10|0}function ok(a,b){a=a|0;b=b|0;return bk(a)|0}function pk(b,c,d){b=b|0;c=c|0;d=d|0;if(((a[c>>0]|0)!=0?(ll(c,58885)|0)!=0:0)?(ll(c,54145)|0)!=0:0)d=0;else if(!d)d=Hl(1,4)|0;return d|0}function qk(a){a=a|0;var b=0,d=0;b=(bb()|0)+176|0;d=c[b>>2]|0;if(a)c[b>>2]=a;return d|0}function rk(a,b){a=+a;b=+b;var d=0,e=0;h[k>>3]=a;e=c[k>>2]|0;d=c[k+4>>2]|0;h[k>>3]=b;d=c[k+4>>2]&-2147483648|d&2147483647;c[k>>2]=e;c[k+4>>2]=d;return+ +h[k>>3]}function sk(a,b){a=+a;b=+b;return+ +rk(a,b)}function tk(a,b){a=+a;b=+b;var d=0,e=0,f=0,g=0,i=0,j=0,l=0,m=0,n=0,o=0,p=0,q=0;h[k>>3]=a;d=c[k>>2]|0;m=c[k+4>>2]|0;h[k>>3]=b;n=c[k>>2]|0;o=c[k+4>>2]|0;e=kw(d|0,m|0,52)|0;e=e&2047;j=kw(n|0,o|0,52)|0;j=j&2047;p=m&-2147483648;i=mw(n|0,o|0,1)|0;l=D;a:do{if(!((i|0)==0&(l|0)==0)?(g=o&2147483647,!(g>>>0>2146435072|(g|0)==2146435072&n>>>0>0|(e|0)==2047)):0){f=mw(d|0,m|0,1)|0;g=D;if(!(g>>>0>l>>>0|(g|0)==(l|0)&f>>>0>i>>>0))return+((f|0)==(i|0)&(g|0)==(l|0)?a*0.0:a);if(!e){e=mw(d|0,m|0,12)|0;f=D;if((f|0)>-1|(f|0)==-1&e>>>0>4294967295){g=e;e=0;do{e=e+-1|0;g=mw(g|0,f|0,1)|0;f=D}while((f|0)>-1|(f|0)==-1&g>>>0>4294967295)}else e=0;d=mw(d|0,m|0,1-e|0)|0;f=D}else f=m&1048575|1048576;if(!j){g=mw(n|0,o|0,12)|0;i=D;if((i|0)>-1|(i|0)==-1&g>>>0>4294967295){j=0;do{j=j+-1|0;g=mw(g|0,i|0,1)|0;i=D}while((i|0)>-1|(i|0)==-1&g>>>0>4294967295)}else j=0;n=mw(n|0,o|0,1-j|0)|0;m=D}else m=o&1048575|1048576;l=hw(d|0,f|0,n|0,m|0)|0;i=D;g=(i|0)>-1|(i|0)==-1&l>>>0>4294967295;b:do{if((e|0)>(j|0)){while(1){if(g)if((d|0)==(n|0)&(f|0)==(m|0))break;else{d=l;f=i}d=mw(d|0,f|0,1)|0;f=D;e=e+-1|0;l=hw(d|0,f|0,n|0,m|0)|0;i=D;g=(i|0)>-1|(i|0)==-1&l>>>0>4294967295;if((e|0)<=(j|0))break b}b=a*0.0;break a}}while(0);if(g)if((d|0)==(n|0)&(f|0)==(m|0)){b=a*0.0;break}else{f=i;d=l}if(f>>>0<1048576|(f|0)==1048576&d>>>0<0)do{d=mw(d|0,f|0,1)|0;f=D;e=e+-1|0}while(f>>>0<1048576|(f|0)==1048576&d>>>0<0);if((e|0)>0){o=jw(d|0,f|0,0,-1048576)|0;d=D;e=mw(e|0,0,52)|0;d=d|D;e=o|e}else{e=kw(d|0,f|0,1-e|0)|0;d=D}c[k>>2]=e;c[k+4>>2]=d|p;b=+h[k>>3]}else q=3}while(0);if((q|0)==3){b=a*b;b=b/b}return+b}function uk(a,b){a=+a;b=+b;return+ +tk(a,b)}function vk(a,b){a=+a;b=b|0;var d=0,e=0,f=0;h[k>>3]=a;d=c[k>>2]|0;e=c[k+4>>2]|0;f=kw(d|0,e|0,52)|0;f=f&2047;switch(f|0){case 0:{if(a!=0.0){a=+vk(a*18446744073709551616.0,b);d=(c[b>>2]|0)+-64|0}else d=0;c[b>>2]=d;break}case 2047:break;default:{c[b>>2]=f+-1022;c[k>>2]=d;c[k+4>>2]=e&-2146435073|1071644672;a=+h[k>>3]}}return+a}function wk(a,b){a=+a;b=b|0;return+ +vk(a,b)}function xk(a,b){a=+a;b=b|0;var d=0;if((b|0)>1023){a=a*8988465674311579538646525.0e283;d=b+-1023|0;if((d|0)>1023){d=b+-2046|0;d=(d|0)>1023?1023:d;a=a*8988465674311579538646525.0e283}}else if((b|0)<-1022){a=a*2.2250738585072014e-308;d=b+1022|0;if((d|0)<-1022){d=b+2044|0;d=(d|0)<-1022?-1022:d;a=a*2.2250738585072014e-308}}else d=b;d=mw(d+1023|0,0,52)|0;b=D;c[k>>2]=d;c[k+4>>2]=b;return+(a*+h[k>>3])}function yk(a,b){a=+a;b=b|0;return+ +xk(a,b)}function zk(a,b,c){a=a|0;b=b|0;c=c|0;return Ak(0,a,b,(c|0)!=0?c:37344)|0}function Ak(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;l=i;i=i+16|0;g=l;j=(f|0)==0?37348:f;f=c[j>>2]|0;a:do{if(!d)if(!f)f=0;else k=15;else{h=(b|0)==0?g:b;if(!e)f=-2;else{if(!f){f=a[d>>0]|0;g=f&255;if(f<<24>>24>-1){c[h>>2]=g;f=f<<24>>24!=0&1;break}f=g+-194|0;if(f>>>0>50){k=15;break}f=c[37076+(f<<2)>>2]|0;g=e+-1|0;if(g){d=d+1|0;k=9}}else{g=e;k=9}b:do{if((k|0)==9){b=a[d>>0]|0;m=(b&255)>>>3;if((m+-16|m+(f>>26))>>>0>7){k=15;break a}while(1){d=d+1|0;f=(b&255)+-128|f<<6;g=g+-1|0;if((f|0)>=0)break;if(!g)break b;b=a[d>>0]|0;if((b&-64)<<24>>24!=-128){k=15;break a}}c[j>>2]=0;c[h>>2]=f;f=e-g|0;break a}}while(0);c[j>>2]=f;f=-2}}}while(0);if((k|0)==15){c[j>>2]=0;c[(ck()|0)>>2]=84;f=-1}i=l;return f|0}function Bk(a){a=a|0;if(!a)a=1;else a=(c[a>>2]|0)==0;return a&1|0}function Ck(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;o=i;i=i+1040|0;l=o+8|0;n=o;k=c[b>>2]|0;c[n>>2]=k;m=(a|0)!=0;e=m?e:256;a=m?a:l;g=k;a:do{if((e|0)!=0&(k|0)!=0){j=e;k=g;e=0;while(1){g=d>>>2;h=g>>>0>=j>>>0;if(!(d>>>0>131|h)){g=k;break a}g=h?j:g;d=d-g|0;g=Dk(a,n,g,f)|0;if((g|0)==-1){e=d;break}p=(a|0)==(l|0);k=p?0:g;h=j-k|0;a=p?a:a+(g<<2)|0;e=g+e|0;g=c[n>>2]|0;if((j|0)!=(k|0)&(g|0)!=0){j=h;k=g}else{j=h;break a}}d=e;j=0;g=c[n>>2]|0;e=-1}else{j=e;e=0}}while(0);b:do{if((g|0)!=0?(j|0)!=0&(d|0)!=0:0){h=g;g=a;while(1){a=Ak(g,h,d,f)|0;if((a+2|0)>>>0<3)break;h=(c[n>>2]|0)+a|0;c[n>>2]=h;j=j+-1|0;e=e+1|0;if(!((j|0)!=0&(d|0)!=(a|0)))break b;else{d=d-a|0;g=g+4|0}}switch(a|0){case-1:{e=-1;break b}case 0:{c[n>>2]=0;break b}default:{c[f>>2]=0;break b}}}}while(0);if(m)c[b>>2]=c[n>>2];i=o;return e|0}function Dk(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0;h=c[e>>2]|0;if((g|0)!=0?(i=c[g>>2]|0,(i|0)!=0):0)if(!b){g=f;j=h;m=16}else{c[g>>2]=0;l=b;g=f;k=i;m=37}else if(!b){g=f;m=7}else{i=b;g=f;m=6}a:while(1)if((m|0)==6){if(!g){m=26;break}else b=i;while(1){i=a[h>>0]|0;do{if(((i&255)+-1|0)>>>0<127?g>>>0>4&(h&3|0)==0:0){j=h;while(1){h=c[j>>2]|0;if((h+-16843009|h)&-2139062144){i=h;h=j;m=32;break}c[b>>2]=h&255;c[b+4>>2]=d[j+1>>0];c[b+8>>2]=d[j+2>>0];h=j+4|0;i=b+16|0;c[b+12>>2]=d[j+3>>0];g=g+-4|0;if(g>>>0>4){b=i;j=h}else{m=31;break}}if((m|0)==31){b=i;i=a[h>>0]|0;break}else if((m|0)==32){i=i&255;break}}}while(0);i=i&255;if((i+-1|0)>>>0>=127)break;h=h+1|0;c[b>>2]=i;g=g+-1|0;if(!g){m=26;break a}else b=b+4|0}i=i+-194|0;if(i>>>0>50){m=48;break}l=b;k=c[37076+(i<<2)>>2]|0;h=h+1|0;m=37;continue}else if((m|0)==7){i=a[h>>0]|0;if(((i&255)+-1|0)>>>0<127?(h&3|0)==0:0){i=c[h>>2]|0;if(!((i+-16843009|i)&-2139062144))do{h=h+4|0;g=g+-4|0;i=c[h>>2]|0}while(((i+-16843009|i)&-2139062144|0)==0);i=i&255}i=i&255;if((i+-1|0)>>>0<127){g=g+-1|0;h=h+1|0;m=7;continue}i=i+-194|0;if(i>>>0>50){m=48;break}i=c[37076+(i<<2)>>2]|0;j=h+1|0;m=16;continue}else if((m|0)==16){m=(d[j>>0]|0)>>>3;if((m+-16|m+(i>>26))>>>0>7){m=17;break}h=j+1|0;if(i&33554432){if((a[h>>0]&-64)<<24>>24!=-128){m=20;break}h=j+2|0;if(i&524288){if((a[h>>0]&-64)<<24>>24!=-128){m=23;break}h=j+3|0}}g=g+-1|0;m=7;continue}else if((m|0)==37){i=d[h>>0]|0;m=i>>>3;if((m+-16|m+(k>>26))>>>0>7){m=38;break}j=h+1|0;b=i+-128|k<<6;if((b|0)<0){i=d[j>>0]|0;if((i&192|0)!=128){m=41;break}j=h+2|0;b=i+-128|b<<6;if((b|0)<0){i=d[j>>0]|0;if((i&192|0)!=128){m=44;break}b=i+-128|b<<6;h=h+3|0}else h=j}else h=j;c[l>>2]=b;i=l+4|0;g=g+-1|0;m=6;continue}if((m|0)==17){h=j+-1|0;m=47}else if((m|0)==20){h=j+-1|0;m=47}else if((m|0)==23){h=j+-1|0;m=47}else if((m|0)==26)c[e>>2]=h;else if((m|0)==38){b=l;i=k;h=h+-1|0;m=47}else if((m|0)==41){g=l;f=h+-1|0;m=52}else if((m|0)==44){g=l;f=h+-1|0;m=52}if((m|0)==47)if(!i)m=48;else{g=b;f=h;m=52}if((m|0)==48)if(!(a[h>>0]|0)){if(b){c[b>>2]=0;c[e>>2]=0}f=f-g|0}else{g=b;f=h;m=52}if((m|0)==52){c[(ck()|0)>>2]=84;if(!g)f=-1;else{c[e>>2]=f;f=-1}}return f|0}function Ek(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0;k=i;i=i+16|0;g=k;a:do{if(!e)g=0;else{do{if(f){j=(b|0)==0?g:b;g=a[e>>0]|0;b=g&255;if(g<<24>>24>-1){c[j>>2]=b;g=g<<24>>24!=0&1;break a}g=b+-194|0;if(g>>>0<=50){b=e+1|0;h=c[37076+(g<<2)>>2]|0;if(f>>>0<4?(h&-2147483648>>>((f*6|0)+-6|0)|0)!=0:0)break;g=d[b>>0]|0;f=g>>>3;if((f+-16|f+(h>>26))>>>0<=7){g=g+-128|h<<6;if((g|0)>=0){c[j>>2]=g;g=2;break a}b=d[e+2>>0]|0;if((b&192|0)==128){b=b+-128|g<<6;if((b|0)>=0){c[j>>2]=b;g=3;break a}g=d[e+3>>0]|0;if((g&192|0)==128){c[j>>2]=g+-128|b<<6;g=4;break a}}}}}}while(0);c[(ck()|0)>>2]=84;g=-1}}while(0);i=k;return g|0}function Fk(b,d,e){b=b|0;d=d|0;e=e|0;do{if(b){if(d>>>0<128){a[b>>0]=d;b=1;break}if(d>>>0<2048){a[b>>0]=d>>>6|192;a[b+1>>0]=d&63|128;b=2;break}if(d>>>0<55296|(d&-8192|0)==57344){a[b>>0]=d>>>12|224;a[b+1>>0]=d>>>6&63|128;a[b+2>>0]=d&63|128;b=3;break}if((d+-65536|0)>>>0<1048576){a[b>>0]=d>>>18|240;a[b+1>>0]=d>>>12&63|128;a[b+2>>0]=d>>>6&63|128;a[b+3>>0]=d&63|128;b=4;break}else{c[(ck()|0)>>2]=84;b=-1;break}}else b=1}while(0);return b|0}function Gk(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;m=i;i=i+272|0;j=m+8|0;l=m;h=c[b>>2]|0;c[l>>2]=h;k=(a|0)!=0;f=k?e:256;e=k?a:j;a=h;a:do{if((f|0)!=0&(h|0)!=0){h=f;g=a;f=0;while(1){a=d>>>0>=h>>>0;if(!(a|d>>>0>32)){a=g;break a}a=a?h:d;d=d-a|0;a=Hk(e,l,a,0)|0;if((a|0)==-1){f=d;break}o=(e|0)==(j|0);n=o?0:a;g=h-n|0;e=o?e:e+a|0;f=a+f|0;a=c[l>>2]|0;if((h|0)!=(n|0)&(a|0)!=0){h=g;g=a}else{h=g;break a}}d=f;h=0;a=c[l>>2]|0;f=-1}else{h=f;f=0}}while(0);b:do{if((a|0)!=0?(h|0)!=0&(d|0)!=0:0){g=a;a=e;while(1){e=Fk(a,c[g>>2]|0,0)|0;if((e+1|0)>>>0<2)break;g=(c[l>>2]|0)+4|0;c[l>>2]=g;d=d+-1|0;f=f+1|0;if(!((h|0)!=(e|0)&(d|0)!=0))break b;else{h=h-e|0;a=a+e|0}}if(!e)c[l>>2]=0;else f=-1}}while(0);if(k)c[b>>2]=c[l>>2];i=m;return f|0}function Hk(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0;k=i;i=i+16|0;j=k;a:do{if(!b){b=c[d>>2]|0;f=c[b>>2]|0;if(!f)e=0;else{e=0;do{if(f>>>0>127){f=Fk(j,f,0)|0;if((f|0)==-1){e=-1;break a}}else f=1;e=f+e|0;b=b+4|0;f=c[b>>2]|0}while((f|0)!=0)}}else{b:do{if(e>>>0>3){f=e;g=c[d>>2]|0;while(1){h=c[g>>2]|0;if((h+-1|0)>>>0>126){if(!h)break;h=Fk(b,h,0)|0;if((h|0)==-1){e=-1;break a}b=b+h|0;f=f-h|0}else{a[b>>0]=h;b=b+1|0;f=f+-1|0;g=c[d>>2]|0}g=g+4|0;c[d>>2]=g;if(f>>>0<=3)break b}a[b>>0]=0;c[d>>2]=0;e=e-f|0;break a}else f=e}while(0);if(f){g=c[d>>2]|0;while(1){h=c[g>>2]|0;if((h+-1|0)>>>0>126){if(!h){g=19;break}h=Fk(j,h,0)|0;if((h|0)==-1){e=-1;break a}if(f>>>0>>0){g=22;break}Fk(b,c[g>>2]|0,0)|0;b=b+h|0;f=f-h|0}else{a[b>>0]=h;b=b+1|0;f=f+-1|0;g=c[d>>2]|0}g=g+4|0;c[d>>2]=g;if(!f)break a}if((g|0)==19){a[b>>0]=0;c[d>>2]=0;e=e-f|0;break}else if((g|0)==22){e=e-f|0;break}}}}while(0);i=k;return e|0}function Ik(a,b){a=a|0;b=b|0;if(!a)a=0;else a=Fk(a,b,0)|0;return a|0}function Jk(a){a=a|0;return 0}function Kk(a){a=a|0;return}function Lk(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;l=m;k=e&255;a[l>>0]=k;g=b+16|0;h=c[g>>2]|0;if(!h)if(!(Tk(b)|0)){h=c[g>>2]|0;j=4}else f=-1;else j=4;do{if((j|0)==4){g=b+20|0;j=c[g>>2]|0;if(j>>>0>>0?(f=e&255,(f|0)!=(a[b+75>>0]|0)):0){c[g>>2]=j+1;a[j>>0]=k;break}if((Gb[c[b+36>>2]&63](b,l,1)|0)==1)f=d[l>>0]|0;else f=-1}}while(0);i=m;return f|0}function Mk(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=c[a+60>>2];a=ik(nb(6,d|0)|0)|0;i=b;return a|0}function Nk(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+48|0;h=m+16|0;g=m;f=m+32|0;c[f>>2]=d;j=f+4|0;l=b+48|0;n=c[l>>2]|0;c[j>>2]=e-((n|0)!=0&1);k=b+44|0;c[f+8>>2]=c[k>>2];c[f+12>>2]=n;if(!(c[9258]|0)){c[h>>2]=c[b+60>>2];c[h+4>>2]=f;c[h+8>>2]=2;f=ik(vb(145,h|0)|0)|0}else{ob(185,b|0);c[g>>2]=c[b+60>>2];c[g+4>>2]=f;c[g+8>>2]=2;f=ik(vb(145,g|0)|0)|0;gb(0)}if((f|0)>=1){j=c[j>>2]|0;if(f>>>0>j>>>0){h=c[k>>2]|0;g=b+4|0;c[g>>2]=h;c[b+8>>2]=h+(f-j);if(!(c[l>>2]|0))f=e;else{c[g>>2]=h+1;a[d+(e+-1)>>0]=a[h>>0]|0;f=e}}}else{c[b>>2]=c[b>>2]|f&48^16;c[b+8>>2]=0;c[b+4>>2]=0}i=m;return f|0}function Ok(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;f=i;i=i+32|0;g=f;e=f+20|0;c[g>>2]=c[a+60>>2];c[g+4>>2]=0;c[g+8>>2]=b;c[g+12>>2]=e;c[g+16>>2]=d;if((ik(ub(140,g|0)|0)|0)<0){c[e>>2]=-1;a=-1}else a=c[e>>2]|0;i=f;return a|0}function Pk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+48|0;n=q+16|0;m=q;e=q+32|0;o=a+28|0;f=c[o>>2]|0;c[e>>2]=f;p=a+20|0;f=(c[p>>2]|0)-f|0;c[e+4>>2]=f;c[e+8>>2]=b;c[e+12>>2]=d;k=a+60|0;l=a+44|0;b=2;f=f+d|0;while(1){if(!(c[9258]|0)){c[n>>2]=c[k>>2];c[n+4>>2]=e;c[n+8>>2]=b;h=ik(wb(146,n|0)|0)|0}else{ob(186,a|0);c[m>>2]=c[k>>2];c[m+4>>2]=e;c[m+8>>2]=b;h=ik(wb(146,m|0)|0)|0;gb(0)}if((f|0)==(h|0)){f=6;break}if((h|0)<0){f=8;break}f=f-h|0;g=c[e+4>>2]|0;if(h>>>0<=g>>>0)if((b|0)==2){c[o>>2]=(c[o>>2]|0)+h;j=g;b=2}else j=g;else{j=c[l>>2]|0;c[o>>2]=j;c[p>>2]=j;j=c[e+12>>2]|0;h=h-g|0;e=e+8|0;b=b+-1|0}c[e>>2]=(c[e>>2]|0)+h;c[e+4>>2]=j-h}if((f|0)==6){n=c[l>>2]|0;c[a+16>>2]=n+(c[a+48>>2]|0);a=n;c[o>>2]=a;c[p>>2]=a}else if((f|0)==8){c[a+16>>2]=0;c[o>>2]=0;c[p>>2]=0;c[a>>2]=c[a>>2]|32;if((b|0)==2)d=0;else d=d-(c[e+4>>2]|0)|0}i=q;return d|0}function Qk(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+80|0;f=g;c[b+36>>2]=8;if((c[b>>2]&64|0)==0?(c[f>>2]=c[b+60>>2],c[f+4>>2]=21505,c[f+8>>2]=g+12,(eb(54,f|0)|0)!=0):0)a[b+75>>0]=-1;f=Pk(b,d,e)|0;i=g;return f|0}function Rk(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;e=a+84|0;g=c[e>>2]|0;h=d+256|0;f=jl(g,0,h)|0;f=(f|0)==0?h:f-g|0;d=f>>>0>>0?f:d;lw(b|0,g|0,d|0)|0;c[a+4>>2]=g+d;b=g+f|0;c[a+8>>2]=b;c[e>>2]=b;return d|0}function Sk(b){b=b|0;var d=0,e=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;d=b+20|0;e=b+44|0;if((c[d>>2]|0)>>>0>(c[e>>2]|0)>>>0)Gb[c[b+36>>2]&63](b,0,0)|0;c[b+16>>2]=0;c[b+28>>2]=0;c[d>>2]=0;d=c[b>>2]|0;if(d&20)if(!(d&4))d=-1;else{c[b>>2]=d|32;d=-1}else{d=c[e>>2]|0;c[b+8>>2]=d;c[b+4>>2]=d;d=0}return d|0}function Tk(b){b=b|0;var d=0,e=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;d=c[b>>2]|0;if(!(d&8)){c[b+8>>2]=0;c[b+4>>2]=0;d=c[b+44>>2]|0;c[b+28>>2]=d;c[b+20>>2]=d;c[b+16>>2]=d+(c[b+48>>2]|0);d=0}else{c[b>>2]=d|32;d=-1}return d|0}function Uk(a){a=a|0;var b=0,e=0;e=i;i=i+16|0;b=e;if((c[a+8>>2]|0)==0?(Sk(a)|0)!=0:0)b=-1;else if((Gb[c[a+32>>2]&63](a,b,1)|0)==1)b=d[b>>0]|0;else b=-1;i=e;return b|0}function Vk(a){a=a|0;var b=0,d=0;do{if(a){if((c[a+76>>2]|0)<=-1){b=wl(a)|0;break}d=(Jk(a)|0)==0;b=wl(a)|0;if(!d)Kk(a)}else{if(!(c[9323]|0))b=0;else b=Vk(c[9323]|0)|0;Ea(37060);a=c[9264]|0;if(a)do{if((c[a+76>>2]|0)>-1)d=Jk(a)|0;else d=0;if((c[a+20>>2]|0)>>>0>(c[a+28>>2]|0)>>>0)b=wl(a)|0|b;if(d)Kk(a);a=c[a+56>>2]|0}while((a|0)!=0);fb(37060)}}while(0);return b|0}function Wk(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;if((c[d+76>>2]|0)>=0?(Jk(d)|0)!=0:0){if((a[d+75>>0]|0)!=(b|0)?(f=d+20|0,g=c[f>>2]|0,g>>>0<(c[d+16>>2]|0)>>>0):0){c[f>>2]=g+1;a[g>>0]=b;e=b&255}else e=Lk(d,b)|0;Kk(d)}else i=3;do{if((i|0)==3){if((a[d+75>>0]|0)!=(b|0)?(h=d+20|0,e=c[h>>2]|0,e>>>0<(c[d+16>>2]|0)>>>0):0){c[h>>2]=e+1;a[e>>0]=b;e=b&255;break}e=Lk(d,b)|0}}while(0);return e|0}function Xk(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=e+16|0;g=c[f>>2]|0;if(!g)if(!(Tk(e)|0)){g=c[f>>2]|0;h=4}else f=0;else h=4;a:do{if((h|0)==4){i=e+20|0;h=c[i>>2]|0;if((g-h|0)>>>0>>0){f=Gb[c[e+36>>2]&63](e,b,d)|0;break}b:do{if((a[e+75>>0]|0)>-1){f=d;while(1){if(!f){g=h;f=0;break b}g=f+-1|0;if((a[b+g>>0]|0)==10)break;else f=g}if((Gb[c[e+36>>2]&63](e,b,f)|0)>>>0>>0)break a;d=d-f|0;b=b+f|0;g=c[i>>2]|0}else{g=h;f=0}}while(0);lw(g|0,b|0,d|0)|0;c[i>>2]=(c[i>>2]|0)+d;f=f+d|0}}while(0);return f|0}function Yk(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=$(d,b)|0;if((c[e+76>>2]|0)>-1){g=(Jk(e)|0)==0;a=Xk(a,f,e)|0;if(!g)Kk(e)}else a=Xk(a,f,e)|0;if((a|0)!=(f|0))d=(a>>>0)/(b>>>0)|0;return d|0}function Zk(a){a=a|0;var b=0,e=0,f=0;if((c[a+76>>2]|0)>=0?(Jk(a)|0)!=0:0){b=a+4|0;e=c[b>>2]|0;if(e>>>0<(c[a+8>>2]|0)>>>0){c[b>>2]=e+1;b=d[e>>0]|0}else b=Uk(a)|0}else f=3;do{if((f|0)==3){b=a+4|0;e=c[b>>2]|0;if(e>>>0<(c[a+8>>2]|0)>>>0){c[b>>2]=e+1;b=d[e>>0]|0;break}else{b=Uk(a)|0;break}}}while(0);return b|0}function _k(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=i;i=i+16|0;g=f;c[g>>2]=e;e=el(a,b,d,g)|0;i=f;return e|0}function $k(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=i;i=i+16|0;f=e;c[f>>2]=d;d=fl(a,b,f)|0;i=e;return d|0}function al(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;do{if((b|0)!=-1){if((c[d+76>>2]|0)>-1)g=Jk(d)|0;else g=0;if(!((c[d+8>>2]|0)==0?(Sk(d)|0)!=0:0))h=6;if((h|0)==6?(e=d+4|0,f=c[e>>2]|0,f>>>0>((c[d+44>>2]|0)+-8|0)>>>0):0){h=f+-1|0;c[e>>2]=h;a[h>>0]=b;c[d>>2]=c[d>>2]&-17;if(!g)break;Kk(d);break}if(g){Kk(d);b=-1}else b=-1}else b=-1}while(0);return b|0}function bl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;e=j;f=Fl(240)|0;do{if(f){c[e>>2]=c[d>>2];e=el(f,240,b,e)|0;if(e>>>0<240){b=Il(f,e+1|0)|0;c[a>>2]=(b|0)!=0?b:f;break}Gl(f);if((e|0)>=0?(h=e+1|0,g=Fl(h)|0,c[a>>2]=g,(g|0)!=0):0)e=el(g,h,b,d)|0;else e=-1}else e=-1}while(0);i=j;return e|0}function cl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+224|0;o=s+80|0;r=s+96|0;q=s;p=s+136|0;f=r;g=f+40|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));c[o>>2]=c[e>>2];if((xl(0,d,o,q,r)|0)<0)e=-1;else{if((c[b+76>>2]|0)>-1)m=Jk(b)|0;else m=0;e=c[b>>2]|0;n=e&32;if((a[b+74>>0]|0)<1)c[b>>2]=e&-33;e=b+48|0;if(!(c[e>>2]|0)){g=b+44|0;h=c[g>>2]|0;c[g>>2]=p;j=b+28|0;c[j>>2]=p;k=b+20|0;c[k>>2]=p;c[e>>2]=80;l=b+16|0;c[l>>2]=p+80;f=xl(b,d,o,q,r)|0;if(h){Gb[c[b+36>>2]&63](b,0,0)|0;f=(c[k>>2]|0)==0?-1:f;c[g>>2]=h;c[e>>2]=0;c[l>>2]=0;c[j>>2]=0;c[k>>2]=0}}else f=xl(b,d,o,q,r)|0;e=c[b>>2]|0;c[b>>2]=e|n;if(m)Kk(b);e=(e&32|0)==0?f:-1}i=s;return e|0}function dl(e,f,j){e=e|0;f=f|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0.0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;P=i;i=i+304|0;H=P+16|0;J=P+8|0;I=P+33|0;K=P;y=P+32|0;if((c[e+76>>2]|0)>-1)O=Jk(e)|0;else O=0;k=a[f>>0]|0;a:do{if(k<<24>>24){L=e+4|0;M=e+100|0;G=e+108|0;z=e+8|0;A=I+10|0;B=I+33|0;C=J+4|0;E=I+46|0;F=I+94|0;m=k;k=0;n=f;s=0;l=0;f=0;b:while(1){c:do{if(!(ak(m&255)|0)){m=(a[n>>0]|0)==37;d:do{if(m){q=n+1|0;o=a[q>>0]|0;e:do{switch(o<<24>>24){case 37:break d;case 42:{x=0;o=n+2|0;break}default:{o=(o&255)+-48|0;if(o>>>0<10?(a[n+2>>0]|0)==36:0){c[H>>2]=c[j>>2];while(1){x=(c[H>>2]|0)+(4-1)&~(4-1);m=c[x>>2]|0;c[H>>2]=x+4;if(o>>>0>1)o=o+-1|0;else break}x=m;o=n+3|0;break e}o=(c[j>>2]|0)+(4-1)&~(4-1);x=c[o>>2]|0;c[j>>2]=o+4;o=q}}}while(0);m=a[o>>0]|0;n=m&255;if((n+-48|0)>>>0<10){m=0;while(1){q=(m*10|0)+-48+n|0;o=o+1|0;m=a[o>>0]|0;n=m&255;if((n+-48|0)>>>0>=10)break;else m=q}}else q=0;if(m<<24>>24==109){o=o+1|0;r=a[o>>0]|0;m=(x|0)!=0&1;l=0;f=0}else{r=m;m=0}n=o+1|0;switch(r&255|0){case 104:{w=(a[n>>0]|0)==104;n=w?o+2|0:n;o=w?-2:-1;break}case 108:{w=(a[n>>0]|0)==108;n=w?o+2|0:n;o=w?3:1;break}case 106:{o=3;break}case 116:case 122:{o=1;break}case 76:{o=2;break}case 110:case 112:case 67:case 83:case 91:case 99:case 115:case 88:case 71:case 70:case 69:case 65:case 103:case 102:case 101:case 97:case 120:case 117:case 111:case 105:case 100:{n=o;o=0;break}default:{N=152;break b}}r=d[n>>0]|0;t=(r&47|0)==3;r=t?r|32:r;t=t?1:o;switch(r|0){case 99:{w=s;v=(q|0)<1?1:q;break}case 91:{w=s;v=q;break}case 110:{if(!x){o=s;break c}switch(t|0){case-2:{a[x>>0]=s;o=s;break c}case-1:{b[x>>1]=s;o=s;break c}case 0:{c[x>>2]=s;o=s;break c}case 1:{c[x>>2]=s;o=s;break c}case 3:{o=x;c[o>>2]=s;c[o+4>>2]=((s|0)<0)<<31>>31;o=s;break c}default:{o=s;break c}}}default:{gk(e,0);do{o=c[L>>2]|0;if(o>>>0<(c[M>>2]|0)>>>0){c[L>>2]=o+1;o=d[o>>0]|0}else o=hk(e)|0}while((ak(o)|0)!=0);o=c[L>>2]|0;if(c[M>>2]|0){o=o+-1|0;c[L>>2]=o}w=(c[G>>2]|0)+s+o-(c[z>>2]|0)|0;v=q}}gk(e,v);o=c[L>>2]|0;q=c[M>>2]|0;if(o>>>0>>0)c[L>>2]=o+1;else{if((hk(e)|0)<0){N=152;break b}q=c[M>>2]|0}if(q)c[L>>2]=(c[L>>2]|0)+-1;f:do{switch(r|0){case 91:case 99:case 115:{u=(r|0)==99;g:do{if((r&239|0)==99){iw(I|0,-1,257)|0;a[I>>0]=0;if((r|0)==115){a[B>>0]=0;a[A>>0]=0;a[A+1>>0]=0;a[A+2>>0]=0;a[A+3>>0]=0;a[A+4>>0]=0}}else{Q=n+1|0;s=(a[Q>>0]|0)==94;o=s&1;r=s?Q:n;n=s?n+2|0:Q;iw(I|0,s&1|0,257)|0;a[I>>0]=0;switch(a[n>>0]|0){case 45:{s=(o^1)&255;a[E>>0]=s;n=r+2|0;break}case 93:{s=(o^1)&255;a[F>>0]=s;n=r+2|0;break}default:s=(o^1)&255}while(1){o=a[n>>0]|0;h:do{switch(o<<24>>24){case 0:{N=152;break b}case 93:break g;case 45:{r=n+1|0;o=a[r>>0]|0;switch(o<<24>>24){case 93:case 0:{o=45;break h}default:{}}n=a[n+-1>>0]|0;if((n&255)<(o&255)){n=n&255;do{n=n+1|0;a[I+n>>0]=s;o=a[r>>0]|0}while((n|0)<(o&255|0));n=r}else n=r;break}default:{}}}while(0);a[I+((o&255)+1)>>0]=s;n=n+1|0}}}while(0);r=u?v+1|0:31;s=(t|0)==1;t=(m|0)!=0;i:do{if(s){if(t){f=Fl(r<<2)|0;if(!f){l=0;N=152;break b}}else f=x;c[J>>2]=0;c[C>>2]=0;l=0;j:while(1){q=(f|0)==0;do{k:while(1){o=c[L>>2]|0;if(o>>>0<(c[M>>2]|0)>>>0){c[L>>2]=o+1;o=d[o>>0]|0}else o=hk(e)|0;if(!(a[I+(o+1)>>0]|0))break j;a[y>>0]=o;switch(Ak(K,y,1,J)|0){case-1:{l=0;N=152;break b}case-2:break;default:break k}}if(!q){c[f+(l<<2)>>2]=c[K>>2];l=l+1|0}}while(!(t&(l|0)==(r|0)));l=r<<1|1;o=Il(f,l<<2)|0;if(!o){l=0;N=152;break b}Q=r;r=l;f=o;l=Q}if(!(Bk(J)|0)){l=0;N=152;break b}else{q=l;l=0}}else{if(t){l=Fl(r)|0;if(!l){l=0;f=0;N=152;break b}else o=0;while(1){do{f=c[L>>2]|0;if(f>>>0<(c[M>>2]|0)>>>0){c[L>>2]=f+1;f=d[f>>0]|0}else f=hk(e)|0;if(!(a[I+(f+1)>>0]|0)){q=o;f=0;break i}a[l+o>>0]=f;o=o+1|0}while((o|0)!=(r|0));f=r<<1|1;o=Il(l,f)|0;if(!o){f=0;N=152;break b}else{Q=r;r=f;l=o;o=Q}}}if(!x){l=q;while(1){f=c[L>>2]|0;if(f>>>0>>0){c[L>>2]=f+1;f=d[f>>0]|0}else f=hk(e)|0;if(!(a[I+(f+1)>>0]|0)){q=0;l=0;f=0;break i}l=c[M>>2]|0}}else{l=0;while(1){f=c[L>>2]|0;if(f>>>0>>0){c[L>>2]=f+1;f=d[f>>0]|0}else f=hk(e)|0;if(!(a[I+(f+1)>>0]|0)){q=l;l=x;f=0;break i}a[x+l>>0]=f;q=c[M>>2]|0;l=l+1|0}}}}while(0);o=c[L>>2]|0;if(c[M>>2]|0){o=o+-1|0;c[L>>2]=o}o=o-(c[z>>2]|0)+(c[G>>2]|0)|0;if(!o)break b;if(!((o|0)==(v|0)|u^1))break b;do{if(t)if(s){c[x>>2]=f;break}else{c[x>>2]=l;break}}while(0);if(!u){if(f)c[f+(q<<2)>>2]=0;if(!l){l=0;break f}a[l+q>>0]=0}break}case 120:case 88:case 112:{o=16;N=134;break}case 111:{o=8;N=134;break}case 117:case 100:{o=10;N=134;break}case 105:{o=0;N=134;break}case 71:case 103:case 70:case 102:case 69:case 101:case 65:case 97:{p=+ek(e,t,0);if((c[G>>2]|0)==((c[z>>2]|0)-(c[L>>2]|0)|0))break b;if(x)switch(t|0){case 0:{g[x>>2]=p;break f}case 1:{h[x>>3]=p;break f}case 2:{h[x>>3]=p;break f}default:break f}break}default:{}}}while(0);l:do{if((N|0)==134){N=0;o=fk(e,o,0,-1,-1)|0;if((c[G>>2]|0)==((c[z>>2]|0)-(c[L>>2]|0)|0))break b;if((x|0)!=0&(r|0)==112){c[x>>2]=o;break}if(x)switch(t|0){case-2:{a[x>>0]=o;break l}case-1:{b[x>>1]=o;break l}case 0:{c[x>>2]=o;break l}case 1:{c[x>>2]=o;break l}case 3:{Q=x;c[Q>>2]=o;c[Q+4>>2]=D;break l}default:break l}}}while(0);k=((x|0)!=0&1)+k|0;o=(c[G>>2]|0)+w+(c[L>>2]|0)-(c[z>>2]|0)|0;break c}}while(0);n=n+(m&1)|0;gk(e,0);m=c[L>>2]|0;if(m>>>0<(c[M>>2]|0)>>>0){c[L>>2]=m+1;m=d[m>>0]|0}else m=hk(e)|0;if((m|0)!=(d[n>>0]|0)){N=21;break b}o=s+1|0}else{while(1){m=n+1|0;if(!(ak(d[m>>0]|0)|0))break;else n=m}gk(e,0);do{m=c[L>>2]|0;if(m>>>0<(c[M>>2]|0)>>>0){c[L>>2]=m+1;m=d[m>>0]|0}else m=hk(e)|0}while((ak(m)|0)!=0);m=c[L>>2]|0;if(c[M>>2]|0){m=m+-1|0;c[L>>2]=m}o=(c[G>>2]|0)+s+m-(c[z>>2]|0)|0}}while(0);n=n+1|0;m=a[n>>0]|0;if(!(m<<24>>24))break a;else s=o}if((N|0)==21){if(c[M>>2]|0)c[L>>2]=(c[L>>2]|0)+-1;if((k|0)!=0|(m|0)>-1)break;else{k=0;N=153}}else if((N|0)==152)if(!k){k=m;N=153}if((N|0)==153){m=k;k=-1}if(m){Gl(l);Gl(f)}}else k=0}while(0);if(O)Kk(e);i=P;return k|0}function el(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+128|0;g=n+112|0;m=n;h=m;j=37352;k=h+112|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));if((d+-1|0)>>>0>2147483646)if(!d){d=1;l=4}else{c[(ck()|0)>>2]=75;d=-1}else{g=b;l=4}if((l|0)==4){l=-2-g|0;l=d>>>0>l>>>0?l:d;c[m+48>>2]=l;b=m+20|0;c[b>>2]=g;c[m+44>>2]=g;d=g+l|0;g=m+16|0;c[g>>2]=d;c[m+28>>2]=d;d=cl(m,e,f)|0;if(l){e=c[b>>2]|0;a[e+(((e|0)==(c[g>>2]|0))<<31>>31)>>0]=0}}i=n;return d|0}function fl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;g=i;i=i+112|0;e=g;f=e;h=f+112|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(h|0));c[e+32>>2]=29;c[e+44>>2]=a;c[e+76>>2]=-1;c[e+84>>2]=a;h=dl(e,b,d)|0;i=g;return h|0}function gl(a,b,c){a=a|0;b=b|0;c=c|0;return+ +zl(a,b,2)}function hl(a,b,c){a=a|0;b=b|0;c=c|0;a=Al(a,b,c,-1,-1)|0;return a|0}function il(a,b,c){a=a|0;b=b|0;c=c|0;a=Al(a,b,c,0,-2147483648)|0;return a|0}function jl(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;h=d&255;f=(e|0)!=0;a:do{if(f&(b&3|0)!=0){g=d&255;while(1){if((a[b>>0]|0)==g<<24>>24){i=6;break a}b=b+1|0;e=e+-1|0;f=(e|0)!=0;if(!(f&(b&3|0)!=0)){i=5;break}}}else i=5}while(0);if((i|0)==5)if(f)i=6;else e=0;b:do{if((i|0)==6){g=d&255;if((a[b>>0]|0)!=g<<24>>24){f=$(h,16843009)|0;c:do{if(e>>>0>3)while(1){h=c[b>>2]^f;if((h&-2139062144^-2139062144)&h+-16843009)break;b=b+4|0;e=e+-4|0;if(e>>>0<=3){i=11;break c}}else i=11}while(0);if((i|0)==11)if(!e){e=0;break}while(1){if((a[b>>0]|0)==g<<24>>24)break b;b=b+1|0;e=e+-1|0;if(!e){e=0;break}}}}}while(0);return((e|0)!=0?b:0)|0}function kl(b,d){b=b|0;d=d|0;var e=0,f=0;e=d;a:do{if(!((e^b)&3)){if(e&3)do{e=a[d>>0]|0;a[b>>0]=e;if(!(e<<24>>24))break a;d=d+1|0;b=b+1|0}while((d&3|0)!=0);e=c[d>>2]|0;if(!((e&-2139062144^-2139062144)&e+-16843009)){f=b;while(1){d=d+4|0;b=f+4|0;c[f>>2]=e;e=c[d>>2]|0;if((e&-2139062144^-2139062144)&e+-16843009)break;else f=b}}f=8}else f=8}while(0);if((f|0)==8){f=a[d>>0]|0;a[b>>0]=f;if(f<<24>>24)do{d=d+1|0;b=b+1|0;f=a[d>>0]|0;a[b>>0]=f}while(f<<24>>24!=0)}return b|0}function ll(b,c){b=b|0;c=c|0;var d=0,e=0;e=a[b>>0]|0;d=a[c>>0]|0;if(e<<24>>24==0?1:e<<24>>24!=d<<24>>24)c=e;else{do{b=b+1|0;c=c+1|0;e=a[b>>0]|0;d=a[c>>0]|0}while(!(e<<24>>24==0?1:e<<24>>24!=d<<24>>24));c=e}return(c&255)-(d&255)|0}function ml(a,b){a=a|0;b=b|0;kl(a,b)|0;return a|0}function nl(b){b=b|0;var d=0,e=0,f=0;f=b;a:do{if(!(f&3))e=4;else{d=b;b=f;while(1){if(!(a[d>>0]|0))break a;d=d+1|0;b=d;if(!(b&3)){b=d;e=4;break}}}}while(0);if((e|0)==4){while(1){d=c[b>>2]|0;if(!((d&-2139062144^-2139062144)&d+-16843009))b=b+4|0;else break}if((d&255)<<24>>24)do{b=b+1|0}while((a[b>>0]|0)!=0)}return b-f|0}function ol(b,c,e){b=b|0;c=c|0;e=e|0;var f=0,g=0;if(!e)c=0;else{f=a[b>>0]|0;a:do{if(!(f<<24>>24))f=0;else while(1){e=e+-1|0;g=a[c>>0]|0;if(!(f<<24>>24==g<<24>>24&((e|0)!=0&g<<24>>24!=0)))break a;b=b+1|0;c=c+1|0;f=a[b>>0]|0;if(!(f<<24>>24)){f=0;break}}}while(0);c=(f&255)-(d[c>>0]|0)|0}return c|0}function pl(a){a=a|0;var b=0;b=a;while(1)if(!(c[b>>2]|0))break;else b=b+4|0;return b-a>>2|0}function ql(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if(d){e=a;while(1){d=d+-1|0;c[e>>2]=c[b>>2];if(!d)break;else{b=b+4|0;e=e+4|0}}}return a|0}function rl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=(d|0)==0;if(a-b>>2>>>0>>0){if(!e)do{d=d+-1|0;c[a+(d<<2)>>2]=c[b+(d<<2)>>2]}while((d|0)!=0)}else if(!e){e=b;b=a;while(1){d=d+-1|0;c[b>>2]=c[e>>2];if(!d)break;else{e=e+4|0;b=b+4|0}}}return a|0}function sl(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if(d){e=a;while(1){d=d+-1|0;c[e>>2]=b;if(!d)break;else e=e+4|0}}return a|0}function tl(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0;i=a+4|0;e=c[i>>2]|0;j=a+100|0;if(e>>>0<(c[j>>2]|0)>>>0){c[i>>2]=e+1;e=d[e>>0]|0}else e=hk(a)|0;switch(e|0){case 43:case 45:{f=(e|0)==45&1;e=c[i>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){c[i>>2]=e+1;e=d[e>>0]|0}else e=hk(a)|0;if((b|0)!=0&(e+-48|0)>>>0>9?(c[j>>2]|0)!=0:0){c[i>>2]=(c[i>>2]|0)+-1;h=f}else h=f;break}default:h=0}if((e+-48|0)>>>0>9)if(!(c[j>>2]|0)){f=-2147483648;e=0}else{c[i>>2]=(c[i>>2]|0)+-1;f=-2147483648;e=0}else{f=0;do{f=e+-48+(f*10|0)|0;e=c[i>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){c[i>>2]=e+1;e=d[e>>0]|0}else e=hk(a)|0}while((e+-48|0)>>>0<10&(f|0)<214748364);b=((f|0)<0)<<31>>31;if((e+-48|0)>>>0<10){do{b=tw(f|0,b|0,10,0)|0;f=D;e=jw(e|0,((e|0)<0)<<31>>31|0,-48,-1)|0;f=jw(e|0,D|0,b|0,f|0)|0;b=D;e=c[i>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){c[i>>2]=e+1;e=d[e>>0]|0}else e=hk(a)|0}while((e+-48|0)>>>0<10&((b|0)<21474836|(b|0)==21474836&f>>>0<2061584302));g=f}else g=f;if((e+-48|0)>>>0<10)do{e=c[i>>2]|0;if(e>>>0<(c[j>>2]|0)>>>0){c[i>>2]=e+1;e=d[e>>0]|0}else e=hk(a)|0}while((e+-48|0)>>>0<10);if(c[j>>2]|0)c[i>>2]=(c[i>>2]|0)+-1;a=(h|0)!=0;e=hw(0,0,g|0,b|0)|0;f=a?D:b;e=a?e:g}D=f;return e|0}function ul(a){a=a|0;if(!(c[a+68>>2]|0))Kk(a);return}function vl(a){a=a|0;if(!(c[a+68>>2]|0))Kk(a);return}function wl(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=a+20|0;g=a+28|0;if((c[b>>2]|0)>>>0>(c[g>>2]|0)>>>0?(Gb[c[a+36>>2]&63](a,0,0)|0,(c[b>>2]|0)==0):0)b=-1;else{h=a+4|0;d=c[h>>2]|0;e=a+8|0;f=c[e>>2]|0;if(d>>>0>>0)Gb[c[a+40>>2]&63](a,d-f|0,1)|0;c[a+16>>2]=0;c[g>>2]=0;c[b>>2]=0;c[e>>2]=0;c[h>>2]=0;b=0}return b|0}var yb=[Uw,Qq,Uq,Or,Sr,Xr,Zr,xu,Iu,Uw,Uw,Uw,Uw,Uw,Uw,Uw];var zb=[Vw,ii,Yh,Mh,Ah,oh,ch,Sg,Bg,Mj,Lj,Ij,Vw,Vw,Vw,Vw];var Ab=[Ww,bs,hs,Ww];var Bb=[Xw,ei,fi,Uh,Vh,Ih,Jh,wh,xh,kh,lh,_g,$g,Og,Pg,xg,yg,kg,lg,_f,$f,Of,Pf,Cf,Df,qf,rf,ye,ze,le,me,tc,uc,Pd,Td,Qd,bo,eo,co,fo,kd,ld,Qi,md,dd,ed,Ic,Jc,Qc,Rc,Xc,Yc,nd,od,ud,vd,Bd,Cd,Id,Jd,je,ke,He,Ie,Oe,Pe,Ve,We,af,bf,Mg,Ng,Dm,qi,Ai,Bi,Ri,Si,fj,gj,mj,nj,rj,sj,uj,xj,vj,wj,yj,zj,Cn,Tl,Zl,nn,cm,im,Bm,Cm,on,Dn,Rn,Tn,Sn,Un,Xn,Zn,Yn,_n,ko,mo,lo,no,uo,vo,en,wo,xo,yo,Ao,Ks,Eo,Fo,Jo,Ko,Yo,Zo,qp,rp,Fp,Gp,Sp,Tp,pq,qq,Nq,Pq,Sq,Tq,Wq,Xq,fr,gr,qr,rr,Br,Cr,Mr,Nr,Vr,Wr,$r,as,fs,gs,ls,ms,qs,rs,ys,zs,at,bt,wu,tt,Vt,Wt,Xt,Yt,zo,Js,Ms,kt,Bt,Jt,Rt,St,Ti,Ii,$i,sc,pn,Wn,_d,Eg,Wj,ul,vl,Ml,mk,Pr,Rr,Ls,Gv,Nv,Ov,Pv,Qv,Rv,Sv,Im,Wm,Gl,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw,Xw];var Cb=[Yw,hi,Xh,Lh,zh,nh,bh,Rg,Ag,mg,ag,Qf,Ef,sf,Ae,ne,vc,qn,Ci,Fi,Ul,Yl,dm,hm,Fn,_q,$q,ar,br,dr,er,jr,kr,lr,mr,or,pr,ur,vr,wr,xr,zr,Ar,Fr,Gr,Hr,Ir,Kr,Lr,ps,us,bu,du,fu,cu,eu,gu,kc,Ui,Gi,Hi,Ji,kn,Cc,Ec,go,dn,Qm,Zd,re,jf,wf,If,Uf,eg,qg,Dg,Ug,eh,qh,Ch,Oh,_h,ki,yi,Zi,sm,qm,hn,oo,rm,Om,_m,Zm,av,bv,cv,dv,ev,fv,st,gv,hv,iv,jv,kv,lv,mv,nv,ov,pv,qv,rv,sv,tv,uv,vv,wv,xv,yv,zv,Av,Bv,Cv,Ev,Yv,Yw,Yw];var Db=[Zw,Lo,Mo,No,Oo,Po,Qo,Ro,So,To,Uo,Vo,_o,$o,ap,bp,cp,dp,ep,fp,gp,hp,ip,xp,zp,Kp,Mp,Vp,Wp,Xp,Zp,$p,sq,tq,uq,wq,yq,es,ks,cd,Uu,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw,Zw];var Eb=[_w,un,vn,hd,yn,ri,hj,oj,tj,Mk,Vl,Kn,Mn,Nn,Jn,_l,$l,em,xn,jm,km,qo,Up,iu,ku,mu,su,uu,ou,qu,rq,ju,lu,nu,tu,vu,pu,ru,Yq,Zq,cr,hr,ir,nr,sr,tr,yr,Dr,Er,Jr,xt,yt,At,Zt,$t,_t,au,ot,pt,rt,Ft,Gt,It,Nt,Ot,Qt,ui,bj,jn,Li,Vn,$n,$w,ax,bx,qk,pl,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w,_w];var Fb=[cx,Qr,Yr,cx];var Gb=[dx,rn,wn,An,um,vm,Aj,Bl,Pk,Ok,Nk,Qk,Gn,Ln,Wl,Pn,fm,Do,Io,ns,ss,dt,ft,it,Ns,Us,Xs,_s,Dc,yl,Rm,pk,Zu,$u,Fk,Ek,zk,bl,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx,dx];var Hb=[ex,ds,js,ex];var Ib=[fx,fd,Pj,Oj,Nj,Hn,sn,os,ts,fx,fx,fx,fx,fx,fx,fx];var Jb=[gx,wp,Cp,Jp,Op,gx,gx,gx];var Kb=[hx,Tr,_r,cs,is,hx,hx,hx];var Lb=[ix,gi,Wh,Kh,yh,mh,ah,Qg,zg,og,cg,Sf,Gf,uf,Ce,pe,xc,id,jd,On,Xl,am,Qn,zn,gm,lm,Bn,ct,et,gt,Ss,Vs,Ys,Vi,oc,qc,io,Is,jo,ok,nk,Km,Xm,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix,ix];var Mb=[jx,Bo,Go,sp,tp,yp,Ep,Hp,Ip,Lp,Qp,jt,wt,zt,$s,nt,qt,Et,Ht,Mt,Pt,Gk,Ck,jx,jx,jx,jx,jx,jx,jx,jx,jx];var Nb=[kx,$v,_v,Zv];var Ob=[lx,lc,aj,Xo,Bs,Cs,Ds,Zj,$j,_j,lx,lx,lx,lx,lx,lx];var Pb=[mx,ng,bg,Rf,Ff,tf,Be,oe,wc,ht,Ps,Qs,Rs,Zs,ti,zi,Hu,Tu,Dk,kk,Ak,fw,ew,dw,cw,bw,aw,mx,mx,mx,mx,mx];var Qb=[nx,tm,si,ro,Wi,Gm,ox,Am,Mm,Ki,xm,to,Xu,Yu,_u,Um];var Rb=[px,qx,Tj,rx,Uj,sx,Sj,px];var Sb=[tx,bq,Aq,ut,vt,lt,mt,Ct,Dt,Kt,Lt,tx,tx,tx,tx,tx];var Tb=[ux,Ap,Dp,Np,Pp,ux,ux,ux];var Ub=[vx,Ud,Vd,Rd,Sd,gd,Kc,Lc,Sc,Tc,Zc,_c,pd,qd,wd,xd,Dd,Ed,Kd,Ld,Je,Ke,Qe,Re,Xe,Ye,cf,df,Cj,Dj,Fj,In,tn,Co,Ho,dc,zm,yc,zc,Ac,Bc,Fc,Gc,Hc,De,Ee,Fe,Ge,vx,vx,vx,vx,vx,vx,vx,vx,vx,vx,vx,vx,vx,vx,vx,vx];return{_jpegls_encode:Yi,___cxa_can_catch:Qj,_free:Gl,_jpegls_decode:Xi,___cxa_is_pointer_type:Rj,_i64Add:jw,_memmove:nw,_i64Subtract:hw,_memset:iw,_malloc:Fl,_memcpy:lw,_bitshift64Lshr:kw,_bitshift64Shl:mw,__GLOBAL__I_000101:Nl,__GLOBAL__sub_I_jpegls_cpp:rc,__GLOBAL__sub_I_iostream_cpp:Ol,runPostSets:gw,stackAlloc:Vb,stackSave:Wb,stackRestore:Xb,establishStackSpace:Yb,setThrew:Zb,setTempRet0:ac,getTempRet0:bc,dynCall_iiiiiiii:xw,dynCall_viiiii:yw,dynCall_iiiiiid:zw,dynCall_vi:Aw,dynCall_vii:Bw,dynCall_iiiiiii:Cw,dynCall_ii:Dw,dynCall_iiiiiiiiiiii:Ew,dynCall_iiii:Fw,dynCall_viiiiiiiiiiiiiii:Gw,dynCall_viiiiii:Hw,dynCall_viiiiiii:Iw,dynCall_viiiiiiiiii:Jw,dynCall_iii:Kw,dynCall_iiiiii:Lw,dynCall_diii:Mw,dynCall_i:Nw,dynCall_iiiii:Ow,dynCall_viii:Pw,dynCall_v:Qw,dynCall_iiiiiiiii:Rw,dynCall_iiiiid:Sw,dynCall_viiii:Tw}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var _jpegls_encode=Module["_jpegls_encode"]=asm["_jpegls_encode"];var ___cxa_can_catch=Module["___cxa_can_catch"]=asm["___cxa_can_catch"];var _free=Module["_free"]=asm["_free"];var _jpegls_decode=Module["_jpegls_decode"]=asm["_jpegls_decode"];var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=asm["___cxa_is_pointer_type"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _memmove=Module["_memmove"]=asm["_memmove"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _memset=Module["_memset"]=asm["_memset"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var __GLOBAL__sub_I_iostream_cpp=Module["__GLOBAL__sub_I_iostream_cpp"]=asm["__GLOBAL__sub_I_iostream_cpp"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var __GLOBAL__sub_I_jpegls_cpp=Module["__GLOBAL__sub_I_jpegls_cpp"]=asm["__GLOBAL__sub_I_jpegls_cpp"];var __GLOBAL__I_000101=Module["__GLOBAL__I_000101"]=asm["__GLOBAL__I_000101"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var dynCall_iiiiiiii=Module["dynCall_iiiiiiii"]=asm["dynCall_iiiiiiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_iiiiiid=Module["dynCall_iiiiiid"]=asm["dynCall_iiiiiid"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=asm["dynCall_iiiiiii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_iiiiiiiiiiii=Module["dynCall_iiiiiiiiiiii"]=asm["dynCall_iiiiiiiiiiii"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_viiiiiiiiiiiiiii=Module["dynCall_viiiiiiiiiiiiiii"]=asm["dynCall_viiiiiiiiiiiiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];var dynCall_viiiiiii=Module["dynCall_viiiiiii"]=asm["dynCall_viiiiiii"];var dynCall_viiiiiiiiii=Module["dynCall_viiiiiiiiii"]=asm["dynCall_viiiiiiiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];var dynCall_diii=Module["dynCall_diii"]=asm["dynCall_diii"];var dynCall_i=Module["dynCall_i"]=asm["dynCall_i"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_iiiiiiiii=Module["dynCall_iiiiiiiii"]=asm["dynCall_iiiiiiiii"];var dynCall_iiiiid=Module["dynCall_iiiiid"]=asm["dynCall_iiiiid"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];Runtime.stackAlloc=asm["stackAlloc"];Runtime.stackSave=asm["stackSave"];Runtime.stackRestore=asm["stackRestore"];Runtime.establishStackSpace=asm["establishStackSpace"];Runtime.setTempRet0=asm["setTempRet0"];Runtime.getTempRet0=asm["getTempRet0"];function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){assert(runDependencies==0,"cannot call main when async dependencies remain! (listen on __ATMAIN__)");assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["stdout"]["once"]("drain",function(){process["exit"](status)});console.log(" ");setTimeout(function(){process["exit"](status)},500)}else if(ENVIRONMENT_IS_SHELL&&typeof quit==="function"){quit(status)}throw new ExitStatus(status)}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"]){shouldRunNow=false}run();return Module};var ColorSpace={Unkown:0,Grayscale:1,AdobeRGB:2,RGB:3,CYMK:4};var JpegImage=function jpegImage(){"use strict";var dctZigZag=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);var dctCos1=4017;var dctSin1=799;var dctCos3=3406;var dctSin3=2276;var dctCos6=1567;var dctSin6=3784;var dctSqrt2=5793;var dctSqrt1d2=2896;function constructor(){}function buildHuffmanTable(codeLengths,values){var k=0,code=[],i,j,length=16;while(length>0&&!codeLengths[length-1])length--;code.push({children:[],index:0});var p=code[0],q;for(i=0;i0){p=code.pop()}p.index++;code.push(p);while(code.length<=i){code.push(q={children:[],index:0});p.children[p.index]=q.children;p=q}k++}if(i+10){bitsCount--;return bitsData>>bitsCount&1}bitsData=data[offset++];if(bitsData==255){var nextByte=data[offset++];if(nextByte){throw"unexpected marker: "+(bitsData<<8|nextByte).toString(16)}}bitsCount=7;return bitsData>>>7}function decodeHuffman(tree){var node=tree;var bit;while((bit=readBit())!==null){node=node[bit];if(typeof node==="number")return node;if(typeof node!=="object")throw"invalid huffman sequence"}return null}function receive(length){var n=0;while(length>0){var bit=readBit();if(bit===null)return;n=n<<1|bit;length--}return n}function receiveAndExtend(length){var n=receive(length);if(n>=1<>4;if(s===0){if(r<15)break;k+=16;continue}k+=r;var z=dctZigZag[k];component.blockData[offset+z]=receiveAndExtend(s);k++}}function decodeDCFirst(component,offset){var t=decodeHuffman(component.huffmanTableDC);var diff=t===0?0:receiveAndExtend(t)<0){eobrun--;return}var k=spectralStart,e=spectralEnd;while(k<=e){var rs=decodeHuffman(component.huffmanTableAC);var s=rs&15,r=rs>>4;if(s===0){if(r<15){eobrun=receive(r)+(1<>4;if(s===0){if(r<15){eobrun=receive(r)+(1<=65488&&marker<=65495){offset+=2}else{break}}return offset-startOffset}function quantizeAndInverse(component,blockBufferOffset,p){var qt=component.quantizationTable;var v0,v1,v2,v3,v4,v5,v6,v7,t;var i;for(i=0;i<64;i++){p[i]=component.blockData[blockBufferOffset+i]*qt[i]}for(i=0;i<8;++i){var row=8*i;if(p[1+row]===0&&p[2+row]===0&&p[3+row]===0&&p[4+row]===0&&p[5+row]===0&&p[6+row]===0&&p[7+row]===0){t=dctSqrt2*p[0+row]+512>>10;p[0+row]=t;p[1+row]=t;p[2+row]=t;p[3+row]=t;p[4+row]=t;p[5+row]=t;p[6+row]=t;p[7+row]=t;continue}v0=dctSqrt2*p[0+row]+128>>8;v1=dctSqrt2*p[4+row]+128>>8;v2=p[2+row];v3=p[6+row];v4=dctSqrt1d2*(p[1+row]-p[7+row])+128>>8;v7=dctSqrt1d2*(p[1+row]+p[7+row])+128>>8;v5=p[3+row]<<4;v6=p[5+row]<<4;t=v0-v1+1>>1;v0=v0+v1+1>>1;v1=t;t=v2*dctSin6+v3*dctCos6+128>>8;v2=v2*dctCos6-v3*dctSin6+128>>8;v3=t;t=v4-v6+1>>1;v4=v4+v6+1>>1;v6=t;t=v7+v5+1>>1;v5=v7-v5+1>>1;v7=t;t=v0-v3+1>>1;v0=v0+v3+1>>1;v3=t;t=v1-v2+1>>1;v1=v1+v2+1>>1;v2=t;t=v4*dctSin3+v7*dctCos3+2048>>12;v4=v4*dctCos3-v7*dctSin3+2048>>12;v7=t;t=v5*dctSin1+v6*dctCos1+2048>>12;v5=v5*dctCos1-v6*dctSin1+2048>>12;v6=t;p[0+row]=v0+v7;p[7+row]=v0-v7;p[1+row]=v1+v6;p[6+row]=v1-v6;p[2+row]=v2+v5;p[5+row]=v2-v5;p[3+row]=v3+v4;p[4+row]=v3-v4}for(i=0;i<8;++i){var col=i;if(p[1*8+col]===0&&p[2*8+col]===0&&p[3*8+col]===0&&p[4*8+col]===0&&p[5*8+col]===0&&p[6*8+col]===0&&p[7*8+col]===0){t=dctSqrt2*p[i+0]+8192>>14;p[0*8+col]=t;p[1*8+col]=t;p[2*8+col]=t;p[3*8+col]=t;p[4*8+col]=t;p[5*8+col]=t;p[6*8+col]=t;p[7*8+col]=t;continue}v0=dctSqrt2*p[0*8+col]+2048>>12;v1=dctSqrt2*p[4*8+col]+2048>>12;v2=p[2*8+col];v3=p[6*8+col];v4=dctSqrt1d2*(p[1*8+col]-p[7*8+col])+2048>>12;v7=dctSqrt1d2*(p[1*8+col]+p[7*8+col])+2048>>12;v5=p[3*8+col];v6=p[5*8+col];t=v0-v1+1>>1;v0=v0+v1+1>>1;v1=t;t=v2*dctSin6+v3*dctCos6+2048>>12;v2=v2*dctCos6-v3*dctSin6+2048>>12;v3=t;t=v4-v6+1>>1;v4=v4+v6+1>>1;v6=t;t=v7+v5+1>>1;v5=v7-v5+1>>1;v7=t;t=v0-v3+1>>1;v0=v0+v3+1>>1;v3=t;t=v1-v2+1>>1;v1=v1+v2+1>>1;v2=t;t=v4*dctSin3+v7*dctCos3+2048>>12;v4=v4*dctCos3-v7*dctSin3+2048>>12;v7=t;t=v5*dctSin1+v6*dctCos1+2048>>12;v5=v5*dctCos1-v6*dctSin1+2048>>12;v6=t;p[0*8+col]=v0+v7;p[7*8+col]=v0-v7;p[1*8+col]=v1+v6;p[6*8+col]=v1-v6;p[2*8+col]=v2+v5;p[5*8+col]=v2-v5;p[3*8+col]=v3+v4;p[4*8+col]=v3-v4}for(i=0;i<64;++i){var index=blockBufferOffset+i;var q=p[i];q=q<=-2056/component.bitConversion?0:q>=2024/component.bitConversion?255/component.bitConversion:q+2056/component.bitConversion>>4;component.blockData[index]=q}}function buildComponentData(frame,component){var lines=[];var blocksPerLine=component.blocksPerLine;var blocksPerColumn=component.blocksPerColumn;var samplesPerLine=blocksPerLine<<3;var computationBuffer=new Int32Array(64);var i,j,ll=0;for(var blockRow=0;blockRow=255?255:a|0}constructor.prototype={load:function load(path){var handleData=function(data){this.parse(data);if(this.onload)this.onload()}.bind(this);if(path.indexOf("data:")>-1){var offset=path.indexOf("base64,")+7;var data=atob(path.substring(offset));var arr=new Uint8Array(data.length);for(var i=data.length-1;i>=0;i--){arr[i]=data.charCodeAt(i)}handleData(data)}else{var xhr=new XMLHttpRequest;xhr.open("GET",path,true);xhr.responseType="arraybuffer";xhr.onload=function(){var data=new Uint8Array(xhr.response);handleData(data)}.bind(this);xhr.send(null)}},parse:function parse(data){function readUint16(){var value=data[offset]<<8|data[offset+1];offset+=2;return value}function readDataBlock(){var length=readUint16();var array=data.subarray(offset,offset+length-2);offset+=array.length;return array}function prepareComponents(frame){var mcusPerLine=Math.ceil(frame.samplesPerLine/8/frame.maxH);var mcusPerColumn=Math.ceil(frame.scanLines/8/frame.maxV);for(var i=0;i>4===0){for(j=0;j<64;j++){var z=dctZigZag[j];tableData[z]=data[offset++]}}else if(quantizationTableSpec>>4===1){for(j=0;j<64;j++){var zz=dctZigZag[j];tableData[zz]=readUint16()}}else throw"DQT: invalid table spec";quantizationTables[quantizationTableSpec&15]=tableData}break;case 65472:case 65473:case 65474:if(frame){throw"Only single frame JPEGs supported"}readUint16();frame={};frame.extended=fileMarker===65473;frame.progressive=fileMarker===65474;frame.precision=data[offset++];frame.scanLines=readUint16();frame.samplesPerLine=readUint16();frame.components=[];frame.componentIds={};var componentsCount=data[offset++],componentId;var maxH=0,maxV=0;for(i=0;i>4;var v=data[offset+1]&15;if(maxH>4===0?huffmanTablesDC:huffmanTablesAC)[huffmanTableSpec&15]=buildHuffmanTable(codeLengths,huffmanValues)}break;case 65501:readUint16();resetInterval=readUint16();break;case 65498:var scanLength=readUint16();var selectorsCount=data[offset++];var components=[],component;for(i=0;i>4];component.huffmanTableAC=huffmanTablesAC[tableSpec&15];components.push(component)}var spectralStart=data[offset++];var spectralEnd=data[offset++];var successiveApproximation=data[offset++];var processed=decodeScan(data,offset,frame,components,resetInterval,spectralStart,spectralEnd,successiveApproximation>>4,successiveApproximation&15);offset+=processed;break;default:if(data[offset-3]==255&&data[offset-2]>=192&&data[offset-2]<=254){offset-=3;break}throw"unknown JPEG marker "+fileMarker.toString(16)}fileMarker=readUint16()}this.width=frame.samplesPerLine;this.height=frame.scanLines;this.jfif=jfif;this.adobe=adobe;this.components=[];switch(frame.components.length){case 1:this.colorspace=ColorSpace.Grayscale;break;case 3:if(this.adobe)this.colorspace=ColorSpace.AdobeRGB;else this.colorspace=ColorSpace.RGB;break;case 4:this.colorspace=ColorSpace.CYMK;break;default:this.colorspace=ColorSpace.Unknown}for(var i=0;i>4!==4092||current===65476){switch(current){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,jpeg.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(current>>8!==255){throw new Error("ERROR: format throw new IOException! (decode)")}}current=this.stream.get16()}if(current<65472||current>65479){throw new Error("ERROR: could not handle arithmetic code!")}this.frame.read(this.stream);current=this.stream.get16();do{while(current!==65498){switch(current){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,jpeg.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(current>>8!==255){throw new Error("ERROR: format throw new IOException! (Parser.decode)")}}current=this.stream.get16()}this.precision=this.frame.precision;this.components=this.frame.components;if(!this.numBytes){this.numBytes=parseInt(Math.ceil(this.precision/8))}if(this.numBytes==1){this.mask=255}else{this.mask=65535}this.scan.read(this.stream);this.numComp=this.scan.numComp;this.selection=this.scan.selection;if(this.numBytes===1){if(this.numComp===3){this.getter=this.getValueRGB;this.setter=this.setValueRGB;this.output=this.outputRGB}else{this.getter=this.getValue8;this.setter=this.setValue8;this.output=this.outputSingle}}else{this.getter=this.getValue16;this.setter=this.setValue16;this.output=this.outputSingle}switch(this.selection){case 2:this.selector=this.select2;break;case 3:this.selector=this.select3;break;case 4:this.selector=this.select4;break;case 5:this.selector=this.select5;break;case 6:this.selector=this.select6;break;case 7:this.selector=this.select7;break;default:this.selector=this.select1;break}this.scanComps=this.scan.components;this.quantTables=this.quantTable.quantTables;for(i=0;i=jpeg.lossless.Decoder.RESTART_MARKER_BEGIN&¤t<=jpeg.lossless.Decoder.RESTART_MARKER_END)){break}}if(current===65500&&scanNum===1){this.readNumber();current=this.stream.get16()}}while(current!==65497&&(this.xLoc>1)};jpeg.lossless.Decoder.prototype.select6=function(compOffset){return this.getPreviousY(compOffset)+(this.getPreviousX(compOffset)-this.getPreviousXY(compOffset)>>1)};jpeg.lossless.Decoder.prototype.select7=function(compOffset){return(this.getPreviousX(compOffset)+this.getPreviousY(compOffset))/2};jpeg.lossless.Decoder.prototype.decodeRGB=function(prev,temp,index){var value,actab,dctab,qtab,ctrC,i,k,j;prev[0]=this.selector(0);prev[1]=this.selector(1);prev[2]=this.selector(2);for(ctrC=0;ctrC=65280){return value}prev[ctrC]=this.IDCT_Source[0]=prev[ctrC]+this.getn(index,value,temp,index);this.IDCT_Source[0]*=qtab[0];for(j=1;j<64;j+=1){value=this.getHuffmanValue(actab,temp,index);if(value>=65280){return value}j+=value>>4;if((value&15)===0){if(value>>4===0){break}}else{this.IDCT_Source[jpeg.lossless.Decoder.IDCT_P[j]]=this.getn(index,value&15,temp,index)*qtab[j]}}}}return 0};jpeg.lossless.Decoder.prototype.decodeSingle=function(prev,temp,index){var value,i,n,nRestart;if(this.restarting){this.restarting=false;prev[0]=1<=65280){return value}n=this.getn(prev,value,temp,index);nRestart=n>>8;if(nRestart>=jpeg.lossless.Decoder.RESTART_MARKER_BEGIN&&nRestart<=jpeg.lossless.Decoder.RESTART_MARKER_END){return nRestart}prev[0]+=n}return 0};jpeg.lossless.Decoder.prototype.getHuffmanValue=function(table,temp,index){var code,input,mask;mask=65535;if(index[0]<8){temp[0]<<=8;input=this.stream.get8();if(input===255){this.marker=this.stream.get8();if(this.marker!==0){this.markerIndex=9}}temp[0]|=input}else{index[0]-=8}code=table[temp[0]>>index[0]];if((code&jpeg.lossless.Decoder.MSB)!==0){if(this.markerIndex!==0){this.markerIndex=0;return 65280|this.marker}temp[0]&=mask>>16-index[0];temp[0]<<=8;input=this.stream.get8();if(input===255){this.marker=this.stream.get8();if(this.marker!==0){this.markerIndex=9}}temp[0]|=input;code=table[(code&255)*256+(temp[0]>>index[0])];index[0]+=8}index[0]+=8-(code>>8);if(index[0]<0){throw new Error("index="+index[0]+" temp="+temp[0]+" code="+code+" in HuffmanValue()")}if(index[0]>16-index[0];return code&255};jpeg.lossless.Decoder.prototype.getn=function(PRED,n,temp,index){var result,one,n_one,mask,input;one=1;n_one=-1;mask=65535;if(n===0){return 0}if(n===16){if(PRED[0]>=0){return-32768}else{return 32768}}index[0]-=n;if(index[0]>=0){if(index[0]>index[0];temp[0]&=mask>>16-index[0]}else{temp[0]<<=8;input=this.stream.get8();if(input===255){this.marker=this.stream.get8();if(this.marker!==0){this.markerIndex=9}}temp[0]|=input;index[0]+=8;if(index[0]<0){if(this.markerIndex!==0){this.markerIndex=0;return(65280|this.marker)<<8}temp[0]<<=8;input=this.stream.get8();if(input===255){this.marker=this.stream.get8();if(this.marker!==0){this.markerIndex=9}}temp[0]|=input;index[0]+=8}if(index[0]<0){throw new Error("index="+index[0]+" in getn()")}if(index[0]>index[0];temp[0]&=mask>>16-index[0]}if(result0){return this.getter(this.yLoc*this.xDim+this.xLoc-1,compOffset)}else if(this.yLoc>0){return this.getPreviousY(compOffset)}else{return 1<0&&this.yLoc>0){return this.getter((this.yLoc-1)*this.xDim+this.xLoc-1,compOffset)}else{return this.getPreviousY(compOffset)}};jpeg.lossless.Decoder.prototype.getPreviousY=function(compOffset){if(this.yLoc>0){return this.getter((this.yLoc-1)*this.xDim+this.xLoc,compOffset)}else{return this.getPreviousX(compOffset)}};jpeg.lossless.Decoder.prototype.isLastPixel=function(){return this.xLoc===this.xDim-1&&this.yLoc===this.yDim-1};jpeg.lossless.Decoder.prototype.outputSingle=function(PRED){if(this.xLoc=this.xDim){this.yLoc+=1;this.xLoc=0}}};jpeg.lossless.Decoder.prototype.outputRGB=function(PRED){var offset=this.yLoc*this.xDim+this.xLoc;if(this.xLoc=this.xDim){this.yLoc+=1;this.xLoc=0}}};jpeg.lossless.Decoder.prototype.setValue8=function(index,val){this.outputData[index]=val};jpeg.lossless.Decoder.prototype.getValue8=function(index){return this.outputData[index]};var littleEndian=function(){var buffer=new ArrayBuffer(2);new DataView(buffer).setInt16(0,256,true);return new Int16Array(buffer)[0]===256}();if(littleEndian){jpeg.lossless.Decoder.prototype.setValue16=jpeg.lossless.Decoder.prototype.setValue8;jpeg.lossless.Decoder.prototype.getValue16=jpeg.lossless.Decoder.prototype.getValue8}else{jpeg.lossless.Decoder.prototype.setValue16=function(index,val){this.outputData[index]=(val&255)<<8|val>>8&255};jpeg.lossless.Decoder.prototype.getValue16=function(index){var val=this.outputData[index];return(val&255)<<8|val>>8&255}}jpeg.lossless.Decoder.prototype.setValueRGB=function(index,val,compOffset){this.outputData[index*3+compOffset]=val};jpeg.lossless.Decoder.prototype.getValueRGB=function(index,compOffset){return this.outputData[index*3+compOffset]};jpeg.lossless.Decoder.prototype.readApp=function(){var count=0,length=this.stream.get16();count+=2;while(countlength){throw new Error("ERROR: frame format error")}c=data.get8();count+=1;if(count>=length){throw new Error("ERROR: frame format error [c>=Lf]")}temp=data.get8();count+=1;if(!this.components[c]){this.components[c]=new jpeg.lossless.ComponentSpec}this.components[c].hSamp=temp>>4;this.components[c].vSamp=temp&15;this.components[c].quantTableSel=data.get8();count+=1}if(count!==length){throw new Error("ERROR: frame format error [Lf!=count]")}return 1};var moduleType=typeof module;if(moduleType!=="undefined"&&module.exports){module.exports=jpeg.lossless.FrameHeader}},{"./component-spec.js":1,"./data-stream.js":2}],5:[function(require,module,exports){"use strict";var jpeg=jpeg||{};jpeg.lossless=jpeg.lossless||{};jpeg.lossless.DataStream=jpeg.lossless.DataStream||(typeof require!=="undefined"?require("./data-stream.js"):null);jpeg.lossless.Utils=jpeg.lossless.Utils||(typeof require!=="undefined"?require("./utils.js"):null);jpeg.lossless.HuffmanTable=jpeg.lossless.HuffmanTable||function(){this.l=jpeg.lossless.Utils.createArray(4,2,16);this.th=[];this.v=jpeg.lossless.Utils.createArray(4,2,16,200);this.tc=jpeg.lossless.Utils.createArray(4,2);this.tc[0][0]=0;this.tc[1][0]=0;this.tc[2][0]=0;this.tc[3][0]=0;this.tc[0][1]=0;this.tc[1][1]=0;this.tc[2][1]=0;this.tc[3][1]=0;this.th[0]=0;this.th[1]=0;this.th[2]=0;this.th[3]=0};jpeg.lossless.HuffmanTable.MSB=2147483648;jpeg.lossless.HuffmanTable.prototype.read=function(data,HuffTab){var count=0,length,temp,t,c,i,j;length=data.get16();count+=2;while(count3){throw new Error("ERROR: Huffman table ID > 3")}c=temp>>4;if(c>2){throw new Error("ERROR: Huffman table [Table class > 2 ]")}this.th[t]=1;this.tc[t][c]=1;for(i=0;i<16;i+=1){this.l[t][c][i]=data.get8();count+=1}for(i=0;i<16;i+=1){for(j=0;jlength){throw new Error("ERROR: Huffman table format error [count>Lh]")}this.v[t][c][i][j]=data.get8();count+=1}}}if(count!==length){throw new Error("ERROR: Huffman table format error [count!=Lf]")}for(i=0;i<4;i+=1){for(j=0;j<2;j+=1){if(this.tc[i][j]!==0){this.buildHuffTable(HuffTab[i][j],this.l[i][j],this.v[i][j])}}}return 1};jpeg.lossless.HuffmanTable.prototype.buildHuffTable=function(tab,L,V){var currentTable,temp,k,i,j,n;temp=256;k=0;for(i=0;i<8;i+=1){for(j=0;j>i+1;n+=1){tab[k]=V[i][j]|i+1<<8;k+=1}}}for(i=1;k<256;i+=1,k+=1){tab[k]=i|jpeg.lossless.HuffmanTable.MSB}currentTable=1;k=0;for(i=8;i<16;i+=1){for(j=0;j>i-7;n+=1){tab[currentTable*256+k]=V[i][j]|i+1<<8;k+=1}if(k>=256){if(k>256){throw new Error("ERROR: Huffman table error(1)!")}k=0;currentTable+=1}}}};var moduleType=typeof module;if(moduleType!=="undefined"&&module.exports){module.exports=jpeg.lossless.HuffmanTable}},{"./data-stream.js":2,"./utils.js":10}],6:[function(require,module,exports){"use strict";var jpeg=jpeg||{};jpeg.lossless=jpeg.lossless||{};jpeg.lossless.ComponentSpec=jpeg.lossless.ComponentSpec||(typeof require!=="undefined"?require("./component-spec.js"):null);jpeg.lossless.DataStream=jpeg.lossless.DataStream||(typeof require!=="undefined"?require("./data-stream.js"):null);jpeg.lossless.Decoder=jpeg.lossless.Decoder||(typeof require!=="undefined"?require("./decoder.js"):null);jpeg.lossless.FrameHeader=jpeg.lossless.FrameHeader||(typeof require!=="undefined"?require("./frame-header.js"):null);jpeg.lossless.HuffmanTable=jpeg.lossless.HuffmanTable||(typeof require!=="undefined"?require("./huffman-table.js"):null);jpeg.lossless.QuantizationTable=jpeg.lossless.QuantizationTable||(typeof require!=="undefined"?require("./quantization-table.js"):null);jpeg.lossless.ScanComponent=jpeg.lossless.ScanComponent||(typeof require!=="undefined"?require("./scan-component.js"):null);jpeg.lossless.ScanHeader=jpeg.lossless.ScanHeader||(typeof require!=="undefined"?require("./scan-header.js"):null);jpeg.lossless.Utils=jpeg.lossless.Utils||(typeof require!=="undefined"?require("./utils.js"):null);var moduleType=typeof module;if(moduleType!=="undefined"&&module.exports){module.exports=jpeg}},{"./component-spec.js":1,"./data-stream.js":2,"./decoder.js":3,"./frame-header.js":4,"./huffman-table.js":5,"./quantization-table.js":7,"./scan-component.js":8,"./scan-header.js":9,"./utils.js":10}],7:[function(require,module,exports){"use strict";var jpeg=jpeg||{};jpeg.lossless=jpeg.lossless||{};jpeg.lossless.DataStream=jpeg.lossless.DataStream||(typeof require!=="undefined"?require("./data-stream.js"):null);jpeg.lossless.Utils=jpeg.lossless.Utils||(typeof require!=="undefined"?require("./utils.js"):null);jpeg.lossless.QuantizationTable=jpeg.lossless.QuantizationTable||function(){this.precision=[];this.tq=[];this.quantTables=jpeg.lossless.Utils.createArray(4,64);this.tq[0]=0;this.tq[1]=0;this.tq[2]=0;this.tq[3]=0};jpeg.lossless.QuantizationTable.enhanceQuantizationTable=function(qtab,table){var i;for(i=0;i<8;i+=1){qtab[table[0*8+i]]*=90;qtab[table[4*8+i]]*=90;qtab[table[2*8+i]]*=118;qtab[table[6*8+i]]*=49;qtab[table[5*8+i]]*=71;qtab[table[1*8+i]]*=126;qtab[table[7*8+i]]*=25;qtab[table[3*8+i]]*=106}for(i=0;i<8;i+=1){qtab[table[0+8*i]]*=90;qtab[table[4+8*i]]*=90;qtab[table[2+8*i]]*=118;qtab[table[6+8*i]]*=49;qtab[table[5+8*i]]*=71;qtab[table[1+8*i]]*=126;qtab[table[7+8*i]]*=25;qtab[table[3+8*i]]*=106}for(i=0;i<64;i+=1){qtab[i]>>=6}};jpeg.lossless.QuantizationTable.prototype.read=function(data,table){var count=0,length,temp,t,i;length=data.get16();count+=2;while(count3){throw new Error("ERROR: Quantization table ID > 3")}this.precision[t]=temp>>4;if(this.precision[t]===0){this.precision[t]=8}else if(this.precision[t]===1){this.precision[t]=16}else{throw new Error("ERROR: Quantization table precision error")}this.tq[t]=1;if(this.precision[t]===8){for(i=0;i<64;i+=1){if(count>length){throw new Error("ERROR: Quantization table format error")}this.quantTables[t][i]=data.get8();count+=1}jpeg.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[t],table)}else{for(i=0;i<64;i+=1){if(count>length){throw new Error("ERROR: Quantization table format error")}this.quantTables[t][i]=data.get16();count+=2}jpeg.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[t],table)}}if(count!==length){throw new Error("ERROR: Quantization table error [count!=Lq]")}return 1};var moduleType=typeof module;if(moduleType!=="undefined"&&module.exports){module.exports=jpeg.lossless.QuantizationTable}},{"./data-stream.js":2,"./utils.js":10}],8:[function(require,module,exports){"use strict";var jpeg=jpeg||{};jpeg.lossless=jpeg.lossless||{};jpeg.lossless.ScanComponent=jpeg.lossless.ScanComponent||function(){this.acTabSel=0;this.dcTabSel=0;this.scanCompSel=0};var moduleType=typeof module;if(moduleType!=="undefined"&&module.exports){module.exports=jpeg.lossless.ScanComponent}},{}],9:[function(require,module,exports){"use strict";var jpeg=jpeg||{};jpeg.lossless=jpeg.lossless||{};jpeg.lossless.DataStream=jpeg.lossless.DataStream||(typeof require!=="undefined"?require("./data-stream.js"):null);jpeg.lossless.ScanComponent=jpeg.lossless.ScanComponent||(typeof require!=="undefined"?require("./scan-component.js"):null);jpeg.lossless.ScanHeader=jpeg.lossless.ScanHeader||function(){this.ah=0;this.al=0;this.numComp=0;this.selection=0;this.spectralEnd=0;this.components=[]};jpeg.lossless.ScanHeader.prototype.read=function(data){var count=0,length,i,temp;length=data.get16();count+=2;this.numComp=data.get8();count+=1;for(i=0;ilength){throw new Error("ERROR: scan header format error")}this.components[i].scanCompSel=data.get8();count+=1;temp=data.get8();count+=1;this.components[i].dcTabSel=temp>>4;this.components[i].acTabSel=temp&15}this.selection=data.get8();count+=1;this.spectralEnd=data.get8();count+=1;temp=data.get8();this.ah=temp>>4;this.al=temp&15;count+=1;if(count!==length){throw new Error("ERROR: scan header format error [count!=Ns]")}return 1};var moduleType=typeof module;if(moduleType!=="undefined"&&module.exports){module.exports=jpeg.lossless.ScanHeader}},{"./data-stream.js":2,"./scan-component.js":8}],10:[function(require,module,exports){"use strict";var jpeg=jpeg||{};jpeg.lossless=jpeg.lossless||{};jpeg.lossless.Utils=jpeg.lossless.Utils||{};jpeg.lossless.Utils.createArray=function(length){var arr=new Array(length||0),i=length;if(arguments.length>1){var args=Array.prototype.slice.call(arguments,1);while(i--)arr[length-1-i]=jpeg.lossless.Utils.createArray.apply(this,args)}return arr};jpeg.lossless.Utils.makeCRCTable=function(){var c;var crcTable=[];for(var n=0;n<256;n++){c=n;for(var k=0;k<8;k++){c=c&1?3988292384^c>>>1:c>>>1}crcTable[n]=c}return crcTable};jpeg.lossless.Utils.crc32=function(dataView){var uint8view=new Uint8Array(dataView.buffer);var crcTable=jpeg.lossless.Utils.crcTable||(jpeg.lossless.Utils.crcTable=jpeg.lossless.Utils.makeCRCTable());var crc=0^-1;for(var i=0;i>>8^crcTable[(crc^uint8view[i])&255]}return(crc^-1)>>>0};var moduleType=typeof module;if(moduleType!=="undefined"&&module.exports){module.exports=jpeg.lossless.Utils}},{}]},{},[6])(6)});/*! image-JPEG2000 - v0.3.1 - 2015-08-26 | https://github.com/OHIF/image-JPEG2000 */ -"use strict";function info(a){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.infos&&console.log("Info: "+a)}function warn(a){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.warnings&&console.log("Warning: "+a)}function error(a){if(arguments.length>1){var b=["Error:"];b.push.apply(b,arguments),console.log.apply(console,b),a=[].join.call(arguments," ")}else console.log("Error: "+a);throw console.log(backtrace()),UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown),new Error(a)}function backtrace(){try{throw new Error}catch(a){return a.stack?a.stack.split("\n").slice(2).join("\n"):""}}function assert(a,b){a||error(b)}function combineUrl(a,b){if(!b)return a;if(/^[a-z][a-z0-9+\-.]*:/i.test(b))return b;var c;if("/"===b.charAt(0))return c=a.indexOf("://"),"/"===b.charAt(1)?++c:c=a.indexOf("/",c+3),a.substring(0,c)+b;var d=a.length;c=a.lastIndexOf("#"),d=c>=0?c:d,c=a.lastIndexOf("?",d),d=c>=0?c:d;var e=a.lastIndexOf("/",d);return a.substring(0,e+1)+b}function isValidUrl(a,b){if(!a)return!1;var c=/^[a-z][a-z0-9+\-.]*(?=:)/i.exec(a);if(!c)return b;switch(c=c[0].toLowerCase()){case"http":case"https":case"ftp":case"mailto":case"tel":return!0;default:return!1}}function shadow(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!1}),c}function bytesToString(a){assert(null!==a&&"object"==typeof a&&void 0!==a.length,"Invalid argument for bytesToString");var b=a.length,c=8192;if(c>b)return String.fromCharCode.apply(null,a);for(var d=[],e=0;b>e;e+=c){var f=Math.min(e+c,b),g=a.subarray(e,f);d.push(String.fromCharCode.apply(null,g))}return d.join("")}function stringToBytes(a){assert("string"==typeof a,"Invalid argument for stringToBytes");for(var b=a.length,c=new Uint8Array(b),d=0;b>d;++d)c[d]=255&a.charCodeAt(d);return c}function string32(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a)}function log2(a){for(var b=1,c=0;a>b;)b<<=1,c++;return c}function readInt8(a,b){return a[b]<<24>>24}function readUint16(a,b){return a[b]<<8|a[b+1]}function readUint32(a,b){return(a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3])>>>0}function isLittleEndian(){var a=new Uint8Array(2);a[0]=1;var b=new Uint16Array(a.buffer);return 1===b[0]}function hasCanvasTypedArrays(){var a=document.createElement("canvas");a.width=a.height=1;var b=a.getContext("2d"),c=b.createImageData(1,1);return"undefined"!=typeof c.data.buffer}function stringToPDFString(a){var b,c=a.length,d=[];if("þ"===a[0]&&"ÿ"===a[1])for(b=2;c>b;b+=2)d.push(String.fromCharCode(a.charCodeAt(b)<<8|a.charCodeAt(b+1)));else for(b=0;c>b;++b){var e=PDFStringTranslateTable[a.charCodeAt(b)];d.push(e?String.fromCharCode(e):a.charAt(b))}return d.join("")}function stringToUTF8String(a){return decodeURIComponent(escape(a))}function isEmptyObj(a){for(var b in a)return!1;return!0}function isBool(a){return"boolean"==typeof a}function isInt(a){return"number"==typeof a&&(0|a)===a}function isNum(a){return"number"==typeof a}function isString(a){return"string"==typeof a}function isNull(a){return null===a}function isName(a){return a instanceof Name}function isCmd(a,b){return a instanceof Cmd&&(void 0===b||a.cmd===b)}function isDict(a,b){if(!(a instanceof Dict))return!1;if(!b)return!0;var c=a.get("Type");return isName(c)&&c.name===b}function isArray(a){return a instanceof Array}function isStream(a){return"object"==typeof a&&null!==a&&void 0!==a.getBytes}function isArrayBuffer(a){return"object"==typeof a&&null!==a&&void 0!==a.byteLength}function isRef(a){return a instanceof Ref}function createPromiseCapability(){var a={};return a.promise=new Promise(function(b,c){a.resolve=b,a.reject=c}),a}function MessageHandler(a,b){this.name=a,this.comObj=b,this.callbackIndex=1,this.postMessageTransfers=!0;var c=this.callbacksCapabilities={},d=this.actionHandler={};d.console_log=[function(a){console.log.apply(console,a)}],d.console_error=[function(a){console.error.apply(console,a)}],d._unsupported_feature=[function(a){UnsupportedManager.notify(a)}],b.onmessage=function(a){var e=a.data;if(e.isReply){var f=e.callbackId;if(e.callbackId in c){var g=c[f];delete c[f],"error"in e?g.reject(e.error):g.resolve(e.data)}else error("Cannot resolve callback "+f)}else if(e.action in d){var h=d[e.action];e.callbackId?Promise.resolve().then(function(){return h[0].call(h[1],e.data)}).then(function(a){b.postMessage({isReply:!0,callbackId:e.callbackId,data:a})},function(a){b.postMessage({isReply:!0,callbackId:e.callbackId,error:a})}):h[0].call(h[1],e.data)}else error("Unknown action from worker: "+e.action)}}function loadJpegStream(a,b,c){var d=new Image;d.onload=function(){c.resolve(a,d)},d.onerror=function(){c.resolve(a,null),warn("Error during JPEG image loading")},d.src=b}var JpxImage=function(){function a(){this.failOnCorruptedImage=!1}function b(a,b){a.x0=Math.ceil(b.XOsiz/a.XRsiz),a.x1=Math.ceil(b.Xsiz/a.XRsiz),a.y0=Math.ceil(b.YOsiz/a.YRsiz),a.y1=Math.ceil(b.Ysiz/a.YRsiz),a.width=a.x1-a.x0,a.height=a.y1-a.y0}function c(a,b){for(var c,d=a.SIZ,e=[],f=Math.ceil((d.Xsiz-d.XTOsiz)/d.XTsiz),g=Math.ceil((d.Ysiz-d.YTOsiz)/d.YTsiz),h=0;g>h;h++)for(var i=0;f>i;i++)c={},c.tx0=Math.max(d.XTOsiz+i*d.XTsiz,d.XOsiz),c.ty0=Math.max(d.YTOsiz+h*d.YTsiz,d.YOsiz),c.tx1=Math.min(d.XTOsiz+(i+1)*d.XTsiz,d.Xsiz),c.ty1=Math.min(d.YTOsiz+(h+1)*d.YTsiz,d.Ysiz),c.width=c.tx1-c.tx0,c.height=c.ty1-c.ty0,c.components=[],e.push(c);a.tiles=e;for(var j=d.Csiz,k=0,l=j;l>k;k++)for(var m=b[k],n=0,o=e.length;o>n;n++){var p={};c=e[n],p.tcx0=Math.ceil(c.tx0/m.XRsiz),p.tcy0=Math.ceil(c.ty0/m.YRsiz),p.tcx1=Math.ceil(c.tx1/m.XRsiz),p.tcy1=Math.ceil(c.ty1/m.YRsiz),p.width=p.tcx1-p.tcx0,p.height=p.tcy1-p.tcy0,c.components[k]=p}}function d(a,b,c){var d=b.codingStyleParameters,e={};return d.entropyCoderWithCustomPrecincts?(e.PPx=d.precinctsSizes[c].PPx,e.PPy=d.precinctsSizes[c].PPy):(e.PPx=15,e.PPy=15),e.xcb_=c>0?Math.min(d.xcb,e.PPx-1):Math.min(d.xcb,e.PPx),e.ycb_=c>0?Math.min(d.ycb,e.PPy-1):Math.min(d.ycb,e.PPy),e}function e(a,b,c){var d=1<b.trx0?Math.ceil(b.trx1/d)-Math.floor(b.trx0/d):0,j=b.try1>b.try0?Math.ceil(b.try1/e)-Math.floor(b.try0/e):0,k=i*j;b.precinctParameters={precinctWidth:d,precinctHeight:e,numprecinctswide:i,numprecinctshigh:j,numprecincts:k,precinctWidthInSubband:g,precinctHeightInSubband:h}}function f(a,b,c){var d,e,f,g,h=c.xcb_,i=c.ycb_,j=1<>h,m=b.tby0>>i,n=b.tbx1+j-1>>h,o=b.tby1+k-1>>i,p=b.resolution.precinctParameters,q=[],r=[];for(e=m;o>e;e++)for(d=l;n>d;d++){f={cbx:d,cby:e,tbx0:j*d,tby0:k*e,tbx1:j*(d+1),tby1:k*(e+1)},f.tbx0_=Math.max(b.tbx0,f.tbx0),f.tby0_=Math.max(b.tby0,f.tby0),f.tbx1_=Math.min(b.tbx1,f.tbx1),f.tby1_=Math.min(b.tby1,f.tby1);var s=Math.floor((f.tbx0_-b.tbx0)/p.precinctWidthInSubband),t=Math.floor((f.tby0_-b.tby0)/p.precinctHeightInSubband);if(g=s+t*p.numprecinctswide,f.precinctNumber=g,f.subbandType=b.type,f.Lblock=3,!(f.tbx1_<=f.tbx0_||f.tby1_<=f.tby0_)){q.push(f);var u=r[g];void 0!==u?(du.cbxMax&&(u.cbxMax=d),eu.cbyMax&&(u.cbyMax=e)):r[g]=u={cbxMin:d,cbyMin:e,cbxMax:d,cbyMax:e},f.precinct=u}}b.codeblockParameters={codeblockWidth:h,codeblockHeight:i,numcodeblockwide:n-l+1,numcodeblockhigh:o-m+1},b.codeblocks=q,b.precincts=r}function g(a,b,c){for(var d=[],e=a.subbands,f=0,g=e.length;g>f;f++)for(var h=e[f],i=h.codeblocks,j=0,k=i.length;k>j;j++){var l=i[j];l.precinctNumber===b&&d.push(l)}return{layerNumber:c,codeblocks:d}}function h(a){for(var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,h=0,i=0;f>i;i++)h=Math.max(h,d.components[i].codingStyleParameters.decompositionLevelsCount);var j=0,k=0,l=0,m=0;this.nextPacket=function(){for(;e>j;j++){for(;h>=k;k++){for(;f>l;l++){var a=d.components[l];if(!(k>a.codingStyleParameters.decompositionLevelsCount)){for(var b=a.resolutions[k],c=b.precinctParameters.numprecincts;c>m;){var i=g(b,m,j);return m++,i}m=0}}l=0}k=0}}}function i(a){for(var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,h=0,i=0;f>i;i++)h=Math.max(h,d.components[i].codingStyleParameters.decompositionLevelsCount);var j=0,k=0,l=0,m=0;this.nextPacket=function(){for(;h>=j;j++){for(;e>k;k++){for(;f>l;l++){var a=d.components[l];if(!(j>a.codingStyleParameters.decompositionLevelsCount)){for(var b=a.resolutions[j],c=b.precinctParameters.numprecincts;c>m;){var i=g(b,m,k);return m++,i}m=0}}l=0}k=0}}}function j(a){var b,c,d,e,f=a.SIZ,h=a.currentTile.index,i=a.tiles[h],j=i.codingStyleDefaultParameters.layersCount,k=f.Csiz,l=0;for(d=0;k>d;d++){var m=i.components[d];l=Math.max(l,m.codingStyleParameters.decompositionLevelsCount)}var n=new Int32Array(l+1);for(c=0;l>=c;++c){var o=0;for(d=0;k>d;++d){var p=i.components[d].resolutions;c=c;c++){for(;ed;d++){var a=i.components[d];if(!(c>a.codingStyleParameters.decompositionLevelsCount)){var f=a.resolutions[c],h=f.precinctParameters.numprecincts;if(!(e>=h)){for(;j>b;){var m=g(f,e,b);return b++,m}b=0}}}d=0}e=0}}}function k(a){var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,h=n(d),i=h,j=0,k=0,l=0,o=0,p=0;this.nextPacket=function(){for(;pl;l++){for(var a=d.components[l],b=a.codingStyleParameters.decompositionLevelsCount;b>=k;k++){var c=a.resolutions[k],n=h.components[l].resolutions[k],q=m(o,p,n,i,c);if(null!==q){for(;e>j;){var r=g(c,q,j);return j++,r}j=0}}k=0}l=0}o=0}}}function l(a){var b=a.SIZ,c=a.currentTile.index,d=a.tiles[c],e=d.codingStyleDefaultParameters.layersCount,f=b.Csiz,h=n(d),i=0,j=0,k=0,l=0,o=0;this.nextPacket=function(){for(;f>k;++k){for(var a=d.components[k],b=h.components[k],c=a.codingStyleParameters.decompositionLevelsCount;o=j;j++){var n=a.resolutions[j],p=b.resolutions[j],q=m(l,o,p,b,n);if(null!==q){for(;e>i;){var r=g(n,q,i);return i++,r}i=0}}j=0}l=0}o=0}}}function m(a,b,c,d,e){var f=a*d.minWidth,g=b*d.minHeight;if(f%c.width!==0||g%c.height!==0)return null;var h=g/c.width*e.precinctParameters.numprecinctswide;return f/c.height+h}function n(a){for(var b=a.components.length,c=Number.MAX_VALUE,d=Number.MAX_VALUE,e=0,f=0,g=new Array(b),h=0;b>h;h++){for(var i=a.components[h],j=i.codingStyleParameters.decompositionLevelsCount,k=new Array(j+1),l=Number.MAX_VALUE,m=Number.MAX_VALUE,n=0,o=0,p=1,q=j;q>=0;--q){var r=i.resolutions[q],s=p*r.precinctParameters.precinctWidth,t=p*r.precinctParameters.precinctHeight;l=Math.min(l,s),m=Math.min(m,t),n=Math.max(n,r.precinctParameters.numprecinctswide),o=Math.max(o,r.precinctParameters.numprecinctshigh),k[q]={width:s,height:t},p<<=1}c=Math.min(c,l),d=Math.min(d,m),e=Math.max(e,n),f=Math.max(f,o),g[h]={resolutions:k,minWidth:l,minHeight:m,maxNumWide:n,maxNumHigh:o}}return{components:g,minWidth:c,minHeight:d,maxNumWide:e,maxNumHigh:f}}function o(a){for(var b=a.SIZ,c=a.currentTile.index,g=a.tiles[c],m=b.Csiz,n=0;m>n;n++){for(var o=g.components[n],p=o.codingStyleParameters.decompositionLevelsCount,q=[],r=[],s=0;p>=s;s++){var t=d(a,o,s),u={},v=1<l;){if(c+k>=b.length)throw new Error("Unexpected EOF");var d=b[c+k];k++,m?(j=j<<7|d,l+=7,m=!1):(j=j<<8|d,l+=8),255===d&&(m=!0)}return l-=a,j>>>l&(1<a?a+3:(a=e(5),31>a?a+6:(a=e(7),a+37))}for(var j,k=0,l=0,m=!1,n=a.currentTile.index,o=a.tiles[n],p=a.COD.sopMarkerUsed,q=a.COD.ephMarkerUsed,r=o.packetsIterator;d>k;)try{h(),p&&f(145)&&g(4);var s=r.nextPacket();if(void 0===s)return;if(!e(1))continue;for(var t,u=s.layerNumber,x=[],y=0,z=s.codeblocks.length;z>y;y++){t=s.codeblocks[y];var A,B=t.precinct,C=t.cbx-B.cbxMin,D=t.cby-B.cbyMin,E=!1,F=!1;if(void 0!==t.included)E=!!e(1);else{B=t.precinct;var G,H;if(void 0!==B.inclusionTree)G=B.inclusionTree;else{var I=B.cbxMax-B.cbxMin+1,J=B.cbyMax-B.cbyMin+1;G=new w(I,J),H=new v(I,J),B.inclusionTree=G,B.zeroBitPlanesTree=H}for(G.reset(C,D,u);;){if(k>=b.length)return;if(G.isAboveThreshold())break;if(G.isKnown())G.nextLevel();else if(e(1)){if(G.setKnown(),G.isLeaf()){t.included=!0,E=F=!0;break}G.nextLevel()}else G.incrementValue()}}if(E){if(F){for(H=B.zeroBitPlanesTree,H.reset(C,D);;){if(k>=b.length)return;if(e(1)){if(A=!H.nextLevel())break}else H.incrementValue()}t.zeroBitPlanes=H.value}for(var K=i();e(1);)t.Lblock++;var L=log2(K),M=(1<K?L-1:L)+t.Lblock,N=e(M);x.push({codeblock:t,codingpasses:K,dataLength:N})}}for(h(),q&&f(146);x.length>0;){var O=x.shift();t=O.codeblock,void 0===t.data&&(t.data=[]),t.data.push({data:b,start:c+k,end:c+k+O.dataLength,codingpasses:O.codingpasses}),k+=O.dataLength}}catch(P){return}return k}function q(a,b,c,d,e,f,g,h){for(var i=d.tbx0,j=d.tby0,k=d.tbx1-d.tbx0,l=d.codeblocks,m="H"===d.type.charAt(0)?1:0,n="H"===d.type.charAt(1)?b:0,o=0,p=l.length;p>o;++o){var q=l[o],r=q.tbx1_-q.tbx0_,s=q.tby1_-q.tby0_;if(0!==r&&0!==s&&void 0!==q.data){var t,u;t=new x(r,s,q.subbandType,q.zeroBitPlanes,f),u=2;var v,w,y,z=q.data,A=0,B=0;for(v=0,w=z.length;w>v;v++)y=z[v],A+=y.end-y.start,B+=y.codingpasses;var C=new Int16Array(A),D=0;for(v=0,w=z.length;w>v;v++){y=z[v];var E=y.data.subarray(y.start,y.end);C.set(E,D),D+=E.length}var F=new ArithmeticDecoder(C,0,A);for(t.setDecoder(F),v=0;B>v;v++){switch(u){case 0:t.runSignificancePropogationPass();break;case 1:t.runMagnitudeRefinementPass();break;case 2:t.runCleanupPass(),h&&t.checkSegmentationSymbol()}u=(u+1)%3}var G,H,I,J=q.tbx0_-i+(q.tby0_-j)*k,K=t.coefficentsSign,L=t.coefficentsMagnitude,M=t.bitsDecoded,N=g?0:.5;D=0;var O="LL"!==d.type;for(v=0;s>v;v++){var P=J/k|0,Q=2*P*(b-k)+m+n;for(G=0;r>G;G++){if(H=L[D],0!==H){H=(H+N)*e,0!==K[D]&&(H=-H),I=M[D];var R=O?Q+(J<<1):J;g&&I>=f?a[R]=H:a[R]=H*(1<=r;r++){for(var s=d.resolutions[r],t=s.trx1-s.trx0,v=s.try1-s.try0,w=new Float32Array(t*v),x=0,y=s.subbands.length;y>x;x++){var B,C;i?(B=h[p].mu,C=h[p].epsilon,p++):(B=h[0].mu,C=h[0].epsilon+(r>0?1-r:0));var D=s.subbands[x],E=u[D.type],F=m?1:Math.pow(2,l+E-C)*(1+B/2048),G=j+C-1;q(w,t,v,D,F,G,m,k)}o.push({width:t,height:v,items:w})}var H=n.calculate(o,d.tcx0,d.tcy0);return{left:d.tcx0,top:d.tcy0,width:H.width,height:H.height,items:H.items}}function s(a){for(var b=a.SIZ,c=a.components,d=b.Csiz,e=[],f=0,g=a.tiles.length;g>f;f++){var h,i=a.tiles[f],j=[];for(h=0;d>h;h++)j[h]=r(a,i,h);var k=j[0],l=c[0].isSigned;if(l)var m=new Int16Array(k.items.length*d);else var m=new Uint16Array(k.items.length*d);var n,o,p,q,s,t,u,v,w,x,y,z,A,B,C,D={left:k.left,top:k.top,width:k.width,height:k.height,items:m},E=0;if(i.codingStyleDefaultParameters.multipleComponentTransform){var F=4===d,G=j[0].items,H=j[1].items,I=j[2].items,J=F?j[3].items:null;n=c[0].precision-8,o=(128<t;t++,E+=L)v=G[t]+o,w=H[t],x=I[t],z=v-(x+w>>2),y=z+x,A=z+w,m[E++]=0>=y?0:y>=p?255:y>>n,m[E++]=0>=z?0:z>=p?255:z>>n,m[E++]=0>=A?0:A>=p?255:A>>n;else for(t=0;u>t;t++,E+=L)v=G[t]+o,w=H[t],x=I[t],y=v+1.402*x,z=v-.34413*w-.71414*x,A=v+1.772*w,m[E++]=0>=y?0:y>=p?255:y>>n,m[E++]=0>=z?0:z>=p?255:z>>n,m[E++]=0>=A?0:A>=p?255:A>>n;if(F)for(t=0,E=3;u>t;t++,E+=4)B=J[t],m[E]=q>=B?0:B>=s?255:B+o>>n}else for(h=0;d>h;h++)if(8===c[h].precision){var M=j[h].items;for(n=c[h].precision-8,o=(128<t;t++)C=M[t],m[E]=q>=C?0:C>=p?255:C+o>>n,E+=d}else{var l=c[h].isSigned,M=j[h].items;if(l)for(E=h,t=0,u=M.length;u>t;t++)m[E]=M[t],E+=d;else{n=c[h].precision-8,o=(128<t;t++)C=M[t],m[E]=Math.max(Math.min(C+o,N),0),E+=d}}e.push(D)}return e}function t(a,b){for(var c=a.SIZ,d=c.Csiz,e=a.tiles[b],f=0;d>f;f++){var g=e.components[f],h=void 0!==a.currentTile.QCC[f]?a.currentTile.QCC[f]:a.currentTile.QCD;g.quantizationParameters=h;var i=void 0!==a.currentTile.COC[f]?a.currentTile.COC[f]:a.currentTile.COD;g.codingStyleParameters=i}e.codingStyleDefaultParameters=a.currentTile.COD}var u={LL:0,LH:1,HL:1,HH:2};a.prototype={parse:function(a){var b=readUint16(a,0);if(65359===b)return void this.parseCodestream(a,0,a.length);for(var c=0,d=a.length;d>c;){var e=8,f=readUint32(a,c),g=readUint32(a,c+4);if(c+=e,1===f&&(f=4294967296*readUint32(a,c)+readUint32(a,c+4),c+=8,e+=8),0===f&&(f=d-c+e),e>f)throw new Error("JPX Error: Invalid box field size");var h=f-e,i=!0;switch(g){case 1785737832:i=!1;break;case 1668246642:var j=a[c];a[c+1],a[c+2];if(1===j){var k=readUint32(a,c+3);switch(k){case 16:case 17:case 18:break;default:warn("Unknown colorspace "+k)}}else 2===j&&info("ICC profile not supported");break;case 1785737827:this.parseCodestream(a,c,c+h);break;case 1783636e3:218793738!==readUint32(a,c)&&warn("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var l=String.fromCharCode(g>>24&255,g>>16&255,g>>8&255,255&g);warn("Unsupported header type "+g+" ("+l+")")}i&&(c+=h)}},parseImageProperties:function(a){for(var b=a.getByte();b>=0;){var c=b;b=a.getByte();var d=c<<8|b;if(65361===d){a.skip(4);var e=a.getInt32()>>>0,f=a.getInt32()>>>0,g=a.getInt32()>>>0,h=a.getInt32()>>>0;a.skip(16);var i=a.getUint16();return this.width=e-g,this.height=f-h,this.componentsCount=i,void(this.bitsPerComponent=8)}}throw new Error("JPX Error: No size marker found in JPX stream")},parseCodestream:function(a,d,e){var f={};try{for(var g=!1,h=d;e>h+1;){var i=readUint16(a,h);h+=2;var j,k,l,m,n,q,r=0;switch(i){case 65359:f.mainHeader=!0;break;case 65497:break;case 65361:r=readUint16(a,h);var u={};u.Xsiz=readUint32(a,h+4),u.Ysiz=readUint32(a,h+8),u.XOsiz=readUint32(a,h+12),u.YOsiz=readUint32(a,h+16),u.XTsiz=readUint32(a,h+20),u.YTsiz=readUint32(a,h+24),u.XTOsiz=readUint32(a,h+28),u.YTOsiz=readUint32(a,h+32);var v=readUint16(a,h+36);u.Csiz=v;var w=[];j=h+38;for(var x=0;v>x;x++){var y={precision:(127&a[j])+1,isSigned:!!(128&a[j]),XRsiz:a[j+1],YRsiz:a[j+1]};b(y,u),w.push(y)}f.SIZ=u,f.components=w,c(f,w),f.QCC=[],f.COC=[];break;case 65372:r=readUint16(a,h);var z={};switch(j=h+2,k=a[j++],31&k){case 0:m=8,n=!0;break;case 1:m=16,n=!1;break;case 2:m=16,n=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+k)}for(z.noQuantization=8===m,z.scalarExpounded=n,z.guardBits=k>>5,l=[];r+h>j;){var A={};8===m?(A.epsilon=a[j++]>>3,A.mu=0):(A.epsilon=a[j]>>3,A.mu=(7&a[j])<<8|a[j+1],j+=2),l.push(A)}z.SPqcds=l,f.mainHeader?f.QCD=z:(f.currentTile.QCD=z,f.currentTile.QCC=[]);break;case 65373:r=readUint16(a,h);var B={};j=h+2;var C;switch(f.SIZ.Csiz<257?C=a[j++]:(C=readUint16(a,j),j+=2),k=a[j++],31&k){case 0:m=8,n=!0;break;case 1:m=16,n=!1;break;case 2:m=16,n=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+k)}for(B.noQuantization=8===m,B.scalarExpounded=n,B.guardBits=k>>5,l=[];r+h>j;)A={},8===m?(A.epsilon=a[j++]>>3,A.mu=0):(A.epsilon=a[j]>>3,A.mu=(7&a[j])<<8|a[j+1],j+=2),l.push(A);B.SPqcds=l,f.mainHeader?f.QCC[C]=B:f.currentTile.QCC[C]=B;break;case 65362:r=readUint16(a,h);var D={};j=h+2;var E=a[j++];D.entropyCoderWithCustomPrecincts=!!(1&E),D.sopMarkerUsed=!!(2&E),D.ephMarkerUsed=!!(4&E),D.progressionOrder=a[j++],D.layersCount=readUint16(a,j),j+=2,D.multipleComponentTransform=a[j++],D.decompositionLevelsCount=a[j++],D.xcb=(15&a[j++])+2,D.ycb=(15&a[j++])+2;var F=a[j++];if(D.selectiveArithmeticCodingBypass=!!(1&F),D.resetContextProbabilities=!!(2&F),D.terminationOnEachCodingPass=!!(4&F),D.verticalyStripe=!!(8&F),D.predictableTermination=!!(16&F),D.segmentationSymbolUsed=!!(32&F),D.reversibleTransformation=a[j++],D.entropyCoderWithCustomPrecincts){for(var G=[];r+h>j;){var H=a[j++];G.push({PPx:15&H,PPy:H>>4})}D.precinctsSizes=G}var I=[];if(D.selectiveArithmeticCodingBypass&&I.push("selectiveArithmeticCodingBypass"),D.resetContextProbabilities&&I.push("resetContextProbabilities"),D.terminationOnEachCodingPass&&I.push("terminationOnEachCodingPass"),D.verticalyStripe&&I.push("verticalyStripe"),D.predictableTermination&&I.push("predictableTermination"),I.length>0)throw g=!0,new Error("JPX Error: Unsupported COD options ("+I.join(", ")+")");f.mainHeader?f.COD=D:(f.currentTile.COD=D,f.currentTile.COC=[]);break;case 65424:r=readUint16(a,h),q={},q.index=readUint16(a,h+2),q.length=readUint32(a,h+4),q.dataEnd=q.length+h-2,q.partIndex=a[h+8],q.partsCount=a[h+9],f.mainHeader=!1,0===q.partIndex&&(q.COD=f.COD,q.COC=f.COC.slice(0),q.QCD=f.QCD,q.QCC=f.QCC.slice(0)),f.currentTile=q;break;case 65427:q=f.currentTile,0===q.partIndex&&(t(f,q.index),o(f)),r=q.dataEnd-h,p(f,a,h,r);break;case 65365:case 65367:case 65368:case 65380:r=readUint16(a,h);break;case 65363:throw new Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("JPX Error: Unknown codestream code: "+i.toString(16))}h+=r}}catch(J){if(g||this.failOnCorruptedImage)throw J;warn("Trying to recover from "+J.message)}this.tiles=s(f),this.width=f.SIZ.Xsiz-f.SIZ.XOsiz,this.height=f.SIZ.Ysiz-f.SIZ.YOsiz,this.componentsCount=f.SIZ.Csiz}};var v=function(){function a(a,b){var c=log2(Math.max(a,b))+1;this.levels=[];for(var d=0;c>d;d++){var e={width:a,height:b,items:[]};this.levels.push(e),a=Math.ceil(a/2),b=Math.ceil(b/2)}}return a.prototype={reset:function(a,b){for(var c,d=0,e=0;d>=1,b>>=1,d++}d--,c=this.levels[d],c.items[c.index]=e,this.currentLevel=d,delete this.value},incrementValue:function(){var a=this.levels[this.currentLevel];a.items[a.index]++},nextLevel:function(){var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];return a--,0>a?(this.value=c,!1):(this.currentLevel=a,b=this.levels[a],b.items[b.index]=c,!0)}},a}(),w=function(){function a(a,b){var c=log2(Math.max(a,b))+1;this.levels=[];for(var d=0;c>d;d++){for(var e=new Uint8Array(a*b),f=new Uint8Array(a*b),g=0,h=e.length;h>g;g++)e[g]=0,f[g]=0;var i={width:a,height:b,items:e,status:f};this.levels.push(i),a=Math.ceil(a/2),b=Math.ceil(b/2)}}return a.prototype={reset:function(a,b,c){this.currentStopValue=c;for(var d=0;d>=1,b>>=1,d++}this.currentLevel=this.levels.length-1,this.minValue=this.levels[this.currentLevel].items[0]},incrementValue:function(){var a=this.levels[this.currentLevel];a.items[a.index]=a.items[a.index]+1,a.items[a.index]>this.minValue&&(this.minValue=a.items[a.index])},nextLevel:function(){var a=this.currentLevel;if(a--,0>a)return!1;this.currentLevel=a;var b=this.levels[a];return b.items[b.index]this.minValue&&(this.minValue=b.items[b.index]),!0},isLeaf:function(){return 0===this.currentLevel},isAboveThreshold:function(){var a=this.currentLevel,b=this.levels[a];return b.items[b.index]>this.currentStopValue},isKnown:function(){var a=this.currentLevel,b=this.levels[a];return b.status[b.index]>0},setKnown:function(){var a=this.currentLevel,b=this.levels[a];b.status[b.index]=1}},a}(),x=function(){function a(a,b,c,g,h){this.width=a,this.height=b,this.contextLabelTable="HH"===c?f:"HL"===c?e:d;var i=a*b;this.neighborsSignificance=new Uint8Array(i),this.coefficentsSign=new Uint8Array(i),this.coefficentsMagnitude=h>14?new Uint32Array(i):h>6?new Uint16Array(i):new Uint8Array(i),this.processingFlags=new Uint8Array(i);var j=new Uint8Array(i);if(0!==g)for(var k=0;i>k;k++)j[k]=g;this.bitsDecoded=j,this.reset()}var b=17,c=18,d=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),e=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),f=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);return a.prototype={setDecoder:function(a){this.decoder=a},reset:function(){this.contexts=new Int8Array(19),this.contexts[0]=8,this.contexts[b]=92,this.contexts[c]=6},setNeighborsSignificance:function(a,b,c){var d,e=this.neighborsSignificance,f=this.width,g=this.height,h=b>0,i=f>b+1;a>0&&(d=c-f,h&&(e[d-1]+=16),i&&(e[d+1]+=16),e[d]+=4),g>a+1&&(d=c+f,h&&(e[d-1]+=16),i&&(e[d+1]+=16),e[d]+=4),h&&(e[c-1]+=1),i&&(e[c+1]+=1),e[c]|=128},runSignificancePropogationPass:function(){for(var a=this.decoder,b=this.width,c=this.height,d=this.coefficentsMagnitude,e=this.coefficentsSign,f=this.neighborsSignificance,g=this.processingFlags,h=this.contexts,i=this.contextLabelTable,j=this.bitsDecoded,k=-2,l=1,m=2,n=0;c>n;n+=4)for(var o=0;b>o;o++)for(var p=n*b+o,q=0;4>q;q++,p+=b){var r=n+q;if(r>=c)break;if(g[p]&=k,!d[p]&&f[p]){var s=i[f[p]],t=a.readBit(h,s);if(t){var u=this.decodeSignBit(r,o,p);e[p]=u,d[p]=1,this.setNeighborsSignificance(r,o,p),g[p]|=m}j[p]++,g[p]|=l}}},decodeSignBit:function(a,b,c){var d,e,f,g,h,i,j=this.width,k=this.height,l=this.coefficentsMagnitude,m=this.coefficentsSign;g=b>0&&0!==l[c-1],j>b+1&&0!==l[c+1]?(f=m[c+1],g?(e=m[c-1],d=1-f-e):d=1-f-f):g?(e=m[c-1],d=1-e-e):d=0;var n=3*d;return g=a>0&&0!==l[c-j],k>a+1&&0!==l[c+j]?(f=m[c+j],g?(e=m[c-j],d=1-f-e+n):d=1-f-f+n):g?(e=m[c-j],d=1-e-e+n):d=n,d>=0?(h=9+d,i=this.decoder.readBit(this.contexts,h)):(h=9-d,i=1^this.decoder.readBit(this.contexts,h)),i},runMagnitudeRefinementPass:function(){for(var a,b=this.decoder,c=this.width,d=this.height,e=this.coefficentsMagnitude,f=this.neighborsSignificance,g=this.contexts,h=this.bitsDecoded,i=this.processingFlags,j=1,k=2,l=c*d,m=4*c,n=0;l>n;n=a){a=Math.min(l,n+m);for(var o=0;c>o;o++)for(var p=n+o;a>p;p+=c)if(e[p]&&0===(i[p]&j)){var q=16;if(0!==(i[p]&k)){i[p]^=k;var r=127&f[p];q=0===r?15:14}var s=b.readBit(g,q);e[p]=e[p]<<1|s,h[p]++,i[p]|=j}}},runCleanupPass:function(){for(var a,d=this.decoder,e=this.width,f=this.height,g=this.neighborsSignificance,h=this.coefficentsMagnitude,i=this.coefficentsSign,j=this.contexts,k=this.contextLabelTable,l=this.bitsDecoded,m=this.processingFlags,n=1,o=2,p=e,q=2*e,r=3*e,s=0;f>s;s=a){a=Math.min(s+4,f);for(var t=s*e,u=f>s+3,v=0;e>v;v++){var w,x=t+v,y=u&&0===m[x]&&0===m[x+p]&&0===m[x+q]&&0===m[x+r]&&0===g[x]&&0===g[x+p]&&0===g[x+q]&&0===g[x+r],z=0,A=x,B=s;if(y){var C=d.readBit(j,c);if(!C){l[x]++,l[x+p]++,l[x+q]++,l[x+r]++;continue}z=d.readBit(j,b)<<1|d.readBit(j,b),0!==z&&(B=s+z,A+=z*e),w=this.decodeSignBit(B,v,A),i[A]=w,h[A]=1,this.setNeighborsSignificance(B,v,A),m[A]|=o,A=x;for(var D=s;B>=D;D++,A+=e)l[A]++;z++}for(B=s+z;a>B;B++,A+=e)if(!h[A]&&0===(m[A]&n)){var E=k[g[A]],F=d.readBit(j,E);1===F&&(w=this.decodeSignBit(B,v,A),i[A]=w,h[A]=1,this.setNeighborsSignificance(B,v,A),m[A]|=o),l[A]++}}}},checkSegmentationSymbol:function(){var a=this.decoder,c=this.contexts,d=a.readBit(c,b)<<3|a.readBit(c,b)<<2|a.readBit(c,b)<<1|a.readBit(c,b);if(10!==d)throw new Error("JPX Error: Invalid segmentation symbol")}},a}(),y=function(){function a(){}return a.prototype.calculate=function(a,b,c){for(var d=a[0],e=1,f=a.length;f>e;e++)d=this.iterate(d,a[e],b,c);return d},a.prototype.extend=function(a,b,c){var d=b-1,e=b+1,f=b+c-2,g=b+c;a[d--]=a[e++],a[g++]=a[f--],a[d--]=a[e++],a[g++]=a[f--],a[d--]=a[e++],a[g++]=a[f--],a[d]=a[e],a[g]=a[f]},a.prototype.iterate=function(a,b,c,d){var e,f,g,h,i,j,k=a.width,l=a.height,m=a.items,n=b.width,o=b.height,p=b.items;for(g=0,e=0;l>e;e++)for(h=2*e*n,f=0;k>f;f++,g++,h+=2)p[h]=m[g];m=a.items=null;var q=4,r=new Float32Array(n+2*q);if(1===n){if(0!==(1&c))for(j=0,g=0;o>j;j++,g+=n)p[g]*=.5}else for(j=0,g=0;o>j;j++,g+=n)r.set(p.subarray(g,g+n),q),this.extend(r,q,n),this.filter(r,q,n),p.set(r.subarray(q,q+n),g);var s=16,t=[];for(e=0;s>e;e++)t.push(new Float32Array(o+2*q));var u,v=0;if(a=q+o,1===o){if(0!==(1&d))for(i=0;n>i;i++)p[i]*=.5}else for(i=0;n>i;i++){if(0===v){for(s=Math.min(n-i,s),g=i,h=q;a>h;g+=n,h++)for(u=0;s>u;u++)t[u][h]=p[g+u];v=s}v--;var w=t[v];if(this.extend(w,q,o),this.filter(w,q,o),0===v)for(g=i-s+1,h=q;a>h;g+=n,h++)for(u=0;s>u;u++)p[g+u]=t[u][h]}return{width:n,height:o,items:p}},a}(),z=function(){function a(){y.call(this)}return a.prototype=Object.create(y.prototype),a.prototype.filter=function(a,b,c){var d=c>>1;b=0|b;var e,f,g,h,i=-1.586134342059924,j=-.052980118572961,k=.882911075530934,l=.443506852043971,m=1.230174104914001,n=1/m;for(e=b-3,f=d+4;f--;e+=2)a[e]*=n;for(e=b-2,g=l*a[e-1],f=d+3;f--&&(h=l*a[e+1],a[e]=m*a[e]-g-h,f--);e+=2)e+=2,g=l*a[e+1],a[e]=m*a[e]-g-h;for(e=b-1,g=k*a[e-1],f=d+2;f--&&(h=k*a[e+1],a[e]-=g+h,f--);e+=2)e+=2,g=k*a[e+1],a[e]-=g+h;for(e=b,g=j*a[e-1],f=d+1;f--&&(h=j*a[e+1],a[e]-=g+h,f--);e+=2)e+=2,g=j*a[e+1],a[e]-=g+h;if(0!==d)for(e=b+1,g=i*a[e-1],f=d;f--&&(h=i*a[e+1],a[e]-=g+h,f--);e+=2)e+=2,g=i*a[e+1],a[e]-=g+h},a}(),A=function(){function a(){y.call(this)}return a.prototype=Object.create(y.prototype),a.prototype.filter=function(a,b,c){var d=c>>1;b=0|b;var e,f;for(e=b,f=d+1;f--;e+=2)a[e]-=a[e-1]+a[e+1]+2>>2;for(e=b+1,f=d;f--;e+=2)a[e]+=a[e-1]+a[e+1]>>1},a}();return a}(),ArithmeticDecoder=function(){function a(a,b,c){this.data=a,this.bp=b,this.dataEnd=c,this.chigh=a[b],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}var b=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];return a.prototype={byteIn:function(){var a=this.data,b=this.bp;if(255===a[b]){var c=a[b+1];c>143?(this.clow+=65280,this.ct=8):(b++,this.clow+=a[b]<<9,this.ct=7,this.bp=b)}else b++,this.clow+=b65535&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(a,c){var d,e=a[c]>>1,f=1&a[c],g=b[e],h=g.qe,i=this.a-h;if(this.chighi?(i=h,d=f,e=g.nmps):(i=h,d=1^f,1===g.switchFlag&&(f=d),e=g.nlps);else{if(this.chigh-=h,0!==(32768&i))return this.a=i,f;h>i?(d=1^f,1===g.switchFlag&&(f=d),e=g.nlps):(d=f,e=g.nmps)}do{0===this.ct&&this.byteIn(),i<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--}while(0===(32768&i));return this.a=i,a[c]=e<<1|f,d}},a}(),globalScope="undefined"==typeof window?this:window,isWorker="undefined"==typeof window,FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},AnnotationType={WIDGET:1,TEXT:2,LINK:3},StreamType={UNKNOWN:0,FLATE:1,LZW:2,DCT:3,JPX:4,JBIG:5,A85:6,AHX:7,CCF:8,RL:9},FontType={UNKNOWN:0,TYPE1:1,TYPE1C:2,CIDFONTTYPE0:3,CIDFONTTYPE0C:4,TRUETYPE:5,CIDFONTTYPE2:6,TYPE3:7,OPENTYPE:8,TYPE0:9,MMTYPE1:10};globalScope.PDFJS||(globalScope.PDFJS={}),globalScope.PDFJS.pdfBug=!1,PDFJS.VERBOSITY_LEVELS={errors:0,warnings:1,infos:5};var OPS=PDFJS.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},UNSUPPORTED_FEATURES=PDFJS.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},UnsupportedManager=PDFJS.UnsupportedManager=function(){var a=[];return{listen:function(b){a.push(b)},notify:function(b){warn('Unsupported feature "'+b+'"');for(var c=0,d=a.length;d>c;c++)a[c](b)}}}();PDFJS.isValidUrl=isValidUrl,PDFJS.shadow=shadow;var PasswordResponses=PDFJS.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},PasswordException=function(){function a(a,b){this.name="PasswordException",this.message=a,this.code=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.PasswordException=PasswordException;var UnknownErrorException=function(){function a(a,b){this.name="UnknownErrorException",this.message=a,this.details=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.UnknownErrorException=UnknownErrorException;var InvalidPDFException=function(){function a(a){this.name="InvalidPDFException",this.message=a}return a.prototype=new Error,a.constructor=a,a}();PDFJS.InvalidPDFException=InvalidPDFException;var MissingPDFException=function(){function a(a){this.name="MissingPDFException",this.message=a}return a.prototype=new Error,a.constructor=a,a}();PDFJS.MissingPDFException=MissingPDFException;var UnexpectedResponseException=function(){function a(a,b){this.name="UnexpectedResponseException",this.message=a,this.status=b}return a.prototype=new Error,a.constructor=a,a}();PDFJS.UnexpectedResponseException=UnexpectedResponseException;var NotImplementedException=function(){function a(a){this.message=a}return a.prototype=new Error,a.prototype.name="NotImplementedException",a.constructor=a,a}(),MissingDataException=function(){function a(a,b){this.begin=a,this.end=b,this.message="Missing data ["+a+", "+b+")"}return a.prototype=new Error,a.prototype.name="MissingDataException",a.constructor=a,a}(),XRefParseException=function(){function a(a){this.message=a}return a.prototype=new Error,a.prototype.name="XRefParseException",a.constructor=a,a}();Object.defineProperty(PDFJS,"isLittleEndian",{configurable:!0,get:function(){return shadow(PDFJS,"isLittleEndian",isLittleEndian())}}),Object.defineProperty(PDFJS,"hasCanvasTypedArrays",{configurable:!0,get:function(){return shadow(PDFJS,"hasCanvasTypedArrays",hasCanvasTypedArrays())}});var Uint32ArrayView=function(){function a(a,b){this.buffer=a,this.byteLength=a.length,this.length=void 0===b?this.byteLength>>2:b,c(this.length)}function b(a){return{get:function(){var b=this.buffer,c=a<<2;return(b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24)>>>0},set:function(b){var c=this.buffer,d=a<<2;c[d]=255&b,c[d+1]=b>>8&255,c[d+2]=b>>16&255,c[d+3]=b>>>24&255}}}function c(c){for(;c>d;)Object.defineProperty(a.prototype,d,b(d)),d++}a.prototype=Object.create(null);var d=0;return a}(),IDENTITY_MATRIX=[1,0,0,1,0,0],Util=PDFJS.Util=function(){function a(){}var b=["rgb(",0,",",0,",",0,")"];return a.makeCssRgb=function(a,c,d){return b[1]=a,b[3]=c,b[5]=d,b.join("")},a.transform=function(a,b){return[a[0]*b[0]+a[2]*b[1],a[1]*b[0]+a[3]*b[1],a[0]*b[2]+a[2]*b[3],a[1]*b[2]+a[3]*b[3],a[0]*b[4]+a[2]*b[5]+a[4],a[1]*b[4]+a[3]*b[5]+a[5]]},a.applyTransform=function(a,b){var c=a[0]*b[0]+a[1]*b[2]+b[4],d=a[0]*b[1]+a[1]*b[3]+b[5];return[c,d]},a.applyInverseTransform=function(a,b){var c=b[0]*b[3]-b[1]*b[2],d=(a[0]*b[3]-a[1]*b[2]+b[2]*b[5]-b[4]*b[3])/c,e=(-a[0]*b[1]+a[1]*b[0]+b[4]*b[1]-b[5]*b[0])/c;return[d,e]},a.getAxialAlignedBoundingBox=function(b,c){var d=a.applyTransform(b,c),e=a.applyTransform(b.slice(2,4),c),f=a.applyTransform([b[0],b[3]],c),g=a.applyTransform([b[2],b[1]],c);return[Math.min(d[0],e[0],f[0],g[0]),Math.min(d[1],e[1],f[1],g[1]),Math.max(d[0],e[0],f[0],g[0]),Math.max(d[1],e[1],f[1],g[1])]},a.inverseTransform=function(a){var b=a[0]*a[3]-a[1]*a[2];return[a[3]/b,-a[1]/b,-a[2]/b,a[0]/b,(a[2]*a[5]-a[4]*a[3])/b,(a[4]*a[1]-a[5]*a[0])/b]},a.apply3dTransform=function(a,b){return[a[0]*b[0]+a[1]*b[1]+a[2]*b[2],a[3]*b[0]+a[4]*b[1]+a[5]*b[2],a[6]*b[0]+a[7]*b[1]+a[8]*b[2]]},a.singularValueDecompose2dScale=function(a){var b=[a[0],a[2],a[1],a[3]],c=a[0]*b[0]+a[1]*b[2],d=a[0]*b[1]+a[1]*b[3],e=a[2]*b[0]+a[3]*b[2],f=a[2]*b[1]+a[3]*b[3],g=(c+f)/2,h=Math.sqrt((c+f)*(c+f)-4*(c*f-e*d))/2,i=g+h||1,j=g-h||1;return[Math.sqrt(i),Math.sqrt(j)]},a.normalizeRect=function(a){var b=a.slice(0);return a[0]>a[2]&&(b[0]=a[2],b[2]=a[0]),a[1]>a[3]&&(b[1]=a[3],b[3]=a[1]),b},a.intersect=function(b,c){function d(a,b){return a-b}var e=[b[0],b[2],c[0],c[2]].sort(d),f=[b[1],b[3],c[1],c[3]].sort(d),g=[];return b=a.normalizeRect(b),c=a.normalizeRect(c),e[0]===b[0]&&e[1]===c[0]||e[0]===c[0]&&e[1]===b[0]?(g[0]=e[1],g[2]=e[2],f[0]===b[1]&&f[1]===c[1]||f[0]===c[1]&&f[1]===b[1]?(g[1]=f[1],g[3]=f[2],g):!1):!1},a.sign=function(a){return 0>a?-1:1},a.appendToArray=function(a,b){Array.prototype.push.apply(a,b)},a.prependToArray=function(a,b){Array.prototype.unshift.apply(a,b)},a.extendObj=function(a,b){for(var c in b)a[c]=b[c]},a.getInheritableProperty=function(a,b){for(;a&&!a.has(b);)a=a.get("Parent");return a?a.get(b):null},a.inherit=function(a,b,c){a.prototype=Object.create(b.prototype),a.prototype.constructor=a;for(var d in c)a.prototype[d]=c[d]},a.loadScript=function(a,b){var c=document.createElement("script"),d=!1;c.setAttribute("src",a),b&&(c.onload=function(){d||b(),d=!0}),document.getElementsByTagName("head")[0].appendChild(c)},a}(),PageViewport=PDFJS.PageViewport=function(){function a(a,b,c,d,e,f){this.viewBox=a,this.scale=b,this.rotation=c,this.offsetX=d,this.offsetY=e;var g,h,i,j,k=(a[2]+a[0])/2,l=(a[3]+a[1])/2;switch(c%=360,c=0>c?c+360:c){case 180:g=-1,h=0,i=0,j=1;break;case 90:g=0,h=1,i=1,j=0;break;case 270:g=0,h=-1,i=-1,j=0;break;default:g=1,h=0,i=0,j=-1}f&&(i=-i,j=-j);var m,n,o,p;0===g?(m=Math.abs(l-a[1])*b+d,n=Math.abs(k-a[0])*b+e,o=Math.abs(a[3]-a[1])*b,p=Math.abs(a[2]-a[0])*b):(m=Math.abs(k-a[0])*b+d,n=Math.abs(l-a[1])*b+e,o=Math.abs(a[2]-a[0])*b,p=Math.abs(a[3]-a[1])*b),this.transform=[g*b,h*b,i*b,j*b,m-g*b*k-i*b*l,n-h*b*k-j*b*l],this.width=o,this.height=p,this.fontScale=b}return a.prototype={clone:function(b){b=b||{};var c="scale"in b?b.scale:this.scale,d="rotation"in b?b.rotation:this.rotation;return new a(this.viewBox.slice(),c,d,this.offsetX,this.offsetY,b.dontFlip)},convertToViewportPoint:function(a,b){return Util.applyTransform([a,b],this.transform)},convertToViewportRectangle:function(a){var b=Util.applyTransform([a[0],a[1]],this.transform),c=Util.applyTransform([a[2],a[3]],this.transform);return[b[0],b[1],c[0],c[1]]},convertToPdfPoint:function(a,b){return Util.applyInverseTransform([a,b],this.transform)}},a}(),PDFStringTranslateTable=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];PDFJS.createPromiseCapability=createPromiseCapability,function(){function a(a){this._status=b,this._handlers=[];try{a.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(c){this._reject(c)}}if(globalScope.Promise)return"function"!=typeof globalScope.Promise.all&&(globalScope.Promise.all=function(a){var b,c,d=0,e=[],f=new globalScope.Promise(function(a,d){b=a,c=d});return a.forEach(function(a,f){d++,a.then(function(a){e[f]=a,d--,0===d&&b(e)},c)}),0===d&&b(e),f}),"function"!=typeof globalScope.Promise.resolve&&(globalScope.Promise.resolve=function(a){return new globalScope.Promise(function(b){b(a)})}),"function"!=typeof globalScope.Promise.reject&&(globalScope.Promise.reject=function(a){return new globalScope.Promise(function(b,c){c(a)})}),void("function"!=typeof globalScope.Promise.prototype["catch"]&&(globalScope.Promise.prototype["catch"]=function(a){return globalScope.Promise.prototype.then(void 0,a)}));var b=0,c=1,d=2,e=500,f={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(a){a._status!==b&&(this.handlers=this.handlers.concat(a._handlers),a._handlers=[],this.running||(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var a=1,b=Date.now()+a;this.handlers.length>0;){var e=this.handlers.shift(),f=e.thisPromise._status,g=e.thisPromise._value;try{f===c?"function"==typeof e.onResolve&&(g=e.onResolve(g)):"function"==typeof e.onReject&&(g=e.onReject(g),f=c,e.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(e.thisPromise))}catch(h){f=d,g=h}if(e.nextPromise._updateStatus(f,g),Date.now()>=b)break}return this.handlers.length>0?void setTimeout(this.runHandlers.bind(this),0):void(this.running=!1)},addUnhandledRejection:function(a){this.unhandledRejections.push({promise:a,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(a){a._unhandledRejection=!1;for(var b=0;be){var c=this.unhandledRejections[b].promise._value,d="Unhandled rejection: "+c;c.stack&&(d+="\n"+c.stack),warn(d),this.unhandledRejections.splice(b),b--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}.bind(this),e))}};a.all=function(b){function c(a){g._status!==d&&(i=[],f(a))}var e,f,g=new a(function(a,b){e=a,f=b}),h=b.length,i=[];if(0===h)return e(i),g;for(var j=0,k=b.length;k>j;++j){var l=b[j],m=function(a){return function(b){g._status!==d&&(i[a]=b,h--,0===h&&e(i))}}(j);a.isPromise(l)?l.then(m,c):m(l)}return g},a.isPromise=function(a){return a&&"function"==typeof a.then},a.resolve=function(b){return new a(function(a){a(b)})},a.reject=function(b){return new a(function(a,c){c(b)})},a.prototype={_status:null,_value:null,_handlers:null,_unhandledRejection:null,_updateStatus:function(b,e){if(this._status!==c&&this._status!==d){if(b===c&&a.isPromise(e))return void e.then(this._updateStatus.bind(this,c),this._updateStatus.bind(this,d));this._status=b,this._value=e,b===d&&0===this._handlers.length&&(this._unhandledRejection=!0,f.addUnhandledRejection(this)),f.scheduleHandlers(this)}},_resolve:function(a){this._updateStatus(c,a)},_reject:function(a){this._updateStatus(d,a)},then:function(b,c){var d=new a(function(a,b){this.resolve=a,this.reject=b});return this._handlers.push({thisPromise:this,onResolve:b,onReject:c,nextPromise:d}),f.scheduleHandlers(this),d},catch:function(a){return this.then(void 0,a)}},globalScope.Promise=a}();var StatTimer=function(){function a(a,b,c){for(;a.lengthb;++b){var g=d[b].name;g.length>f&&(f=g.length)}for(b=0,c=d.length;c>b;++b){var h=d[b],i=h.end-h.start;e+=a(h.name," ",f)+" "+i+"ms\n"}return e}},b}();PDFJS.createBlob=function(a,b){if("undefined"!=typeof Blob)return new Blob([a],{type:b});var c=new MozBlobBuilder;return c.append(a),c.getBlob(b)},PDFJS.createObjectURL=function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function(b,c){if(!PDFJS.disableCreateObjectURL&&"undefined"!=typeof URL&&URL.createObjectURL){var d=PDFJS.createBlob(b,c);return URL.createObjectURL(d)}for(var e="data:"+c+";base64,",f=0,g=b.length;g>f;f+=3){var h=255&b[f],i=255&b[f+1],j=255&b[f+2],k=h>>2,l=(3&h)<<4|i>>4,m=g>f+1?(15&i)<<2|j>>6:64,n=g>f+2?63&j:64;e+=a[k]+a[l]+a[m]+a[n]}return e}}(),MessageHandler.prototype={on:function(a,b,c){var d=this.actionHandler;d[a]&&error('There is already an actionName called "'+a+'"'),d[a]=[b,c]},send:function(a,b,c){var d={action:a,data:b};this.postMessage(d,c)},sendWithPromise:function(a,b,c){var d=this.callbackIndex++,e={action:a,data:b,callbackId:d},f=createPromiseCapability();this.callbacksCapabilities[d]=f;try{this.postMessage(e,c)}catch(g){f.reject(g)}return f.promise},postMessage:function(a,b){b&&this.postMessageTransfers?this.comObj.postMessage(a,b):this.comObj.postMessage(a)}};/*! OpenJPEG.js - v0.2.0 - 2016-06-07 | (c) 2016 Chris Hafey | https://github.com/chafey/openjpeg */ -var OpenJPEG=function(Module){Module=Module||{};var Module;if(!Module)Module=(typeof OpenJPEG!=="undefined"?OpenJPEG:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"](filename)){filename=path.join(__dirname,"..","src",filename);ret=nodeFS["readFileSync"](filename)}if(ret&&!binary)ret=ret.toString();return ret};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available (jsc?)"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.log(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?function(x){dump(x)}:function(x){}}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=function(title){document.title=title}}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=function(){}}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}var Runtime={setTempRet0:function(value){tempRet0=value},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(stackTop){STACKTOP=stackTop},getNativeTypeSize:function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}},getNativeFieldSize:function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr},getAlignSize:function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)},dynCall:function(sig,ptr,args){if(args&&args.length){if(!args.splice)args=Array.prototype.slice.call(args);args.splice(0,0,ptr);return Module["dynCall_"+sig].apply(null,args)}else{return Module["dynCall_"+sig].call(null,ptr)}},functionPointers:[],addFunction:function(func){for(var i=0;i=TOTAL_MEMORY){var success=enlargeMemory();if(!success){DYNAMICTOP=ret;return 0}}return ret},alignMemory:function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret},makeBigInt:function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module["Runtime"]=Runtime;var __THREW__=0;var ABORT=false;var EXITSTATUS=0;var undef=0;var tempValue,tempInt,tempBigInt,tempInt2,tempBigInt2,tempPair,tempBigIntI,tempBigIntR,tempBigIntS,tempBigIntP,tempBigIntD,tempDouble,tempFloat;var tempI64,tempI64b;var tempRet0,tempRet1,tempRet2,tempRet3,tempRet4,tempRet5,tempRet6,tempRet7,tempRet8,tempRet9;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var globalScope=this;function getCFunc(ident){var func=Module["_"+ident];if(!func){try{func=eval("_"+ident)}catch(e){}}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var cwrap,ccall;(function(){var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret},stringToC:function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=Runtime.stackAlloc((str.length<<2)+1);writeStringToMemory(str,ret)}return ret}};var toC={string:JSfuncs["stringToC"],array:JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STACK=1;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;Module["ALLOC_NORMAL"]=ALLOC_NORMAL;Module["ALLOC_STACK"]=ALLOC_STACK;Module["ALLOC_STATIC"]=ALLOC_STATIC;Module["ALLOC_DYNAMIC"]=ALLOC_DYNAMIC;Module["ALLOC_NONE"]=ALLOC_NONE;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}Module["Pointer_stringify"]=Pointer_stringify;function AsciiToString(ptr){var str="";while(1){var ch=HEAP8[ptr++>>0];if(!ch)return str;str+=String.fromCharCode(ch)}}Module["AsciiToString"]=AsciiToString;function stringToAscii(str,outPtr){return writeAsciiToMemory(str,outPtr,false)}Module["stringToAscii"]=stringToAscii;function UTF8ArrayToString(u8Array,idx){var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}Module["UTF8ArrayToString"]=UTF8ArrayToString;function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}Module["UTF8ToString"]=UTF8ToString;function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}Module["stringToUTF8Array"]=stringToUTF8Array;function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}Module["stringToUTF8"]=stringToUTF8;function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}Module["lengthBytesUTF8"]=lengthBytesUTF8;function UTF16ToString(ptr){var i=0;var str="";while(1){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)return str;++i;str+=String.fromCharCode(codeUnit)}}Module["UTF16ToString"]=UTF16ToString;function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}Module["stringToUTF16"]=stringToUTF16;function lengthBytesUTF16(str){return str.length*2}Module["lengthBytesUTF16"]=lengthBytesUTF16;function UTF32ToString(ptr){var i=0;var str="";while(1){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)return str;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}}Module["UTF32ToString"]=UTF32ToString;function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}Module["stringToUTF32"]=stringToUTF32;function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}Module["lengthBytesUTF32"]=lengthBytesUTF32;function demangle(func){var hasLibcxxabi=!!Module["___cxa_demangle"];if(hasLibcxxabi){try{var buf=_malloc(func.length);writeStringToMemory(func.substr(1),buf);var status=_malloc(4);var ret=Module["___cxa_demangle"](buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}}var i=3;var basicTypes={v:"void",b:"bool",c:"char",s:"short",i:"int",l:"long",f:"float",d:"double",w:"wchar_t",a:"signed char",h:"unsigned char",t:"unsigned short",j:"unsigned int",m:"unsigned long",x:"long long",y:"unsigned long long",z:"..."};var subs=[];var first=true;function dump(x){if(x)Module.print(x);Module.print(func);var pre="";for(var a=0;a"}else{ret=name}paramLoop:while(i0){var c=func[i++];if(c in basicTypes){list.push(basicTypes[c])}else{switch(c){case"P":list.push(parse(true,1,true)[0]+"*");break;case"R":list.push(parse(true,1,true)[0]+"&");break;case"L":{i++;var end=func.indexOf("E",i);var size=end-i;list.push(func.substr(i,size));i+=size+2;break};case"A":{var size=parseInt(func.substr(i));i+=size.toString().length;if(func[i]!=="_")throw"?";i++;list.push(parse(true,1,true)[0]+" ["+size+"]");break};case"E":break paramLoop;default:ret+="?"+c;break paramLoop}}}if(!allowVoid&&list.length===1&&list[0]==="void")list=[];if(rawList){if(ret){list.push(ret+"?")}return list}else{return ret+flushList()}}var parsed=func;try{if(func=="Object._main"||func=="_main"){return"main()"}if(typeof func==="number")func=Pointer_stringify(func);if(func[0]!=="_")return func;if(func[1]!=="_")return func;if(func[2]!=="Z")return func;switch(func[3]){case"n":return"operator new()";case"d":return"operator delete()"}parsed=parse()}catch(e){parsed+="?"}if(parsed.indexOf("?")>=0&&!hasLibcxxabi){Runtime.warnOnce("warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling")}return parsed}function demangleAll(text){return text.replace(/__Z[\w\d_]+/g,function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"})}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){return demangleAll(jsStackTrace())}Module["stackTrace"]=stackTrace;var PAGE_SIZE=4096;function alignMemoryPage(x){if(x%4096>0){x+=4096-x%4096}return x}var HEAP;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var STATIC_BASE=0,STATICTOP=0,staticSealed=false;var STACK_BASE=0,STACKTOP=0,STACK_MAX=0;var DYNAMIC_BASE=0,DYNAMICTOP=0;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||4e8;var totalMemory=64*1024;while(totalMemory0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Runtime.dynCall("v",func)}else{Runtime.dynCall("vi",func,[callback.arg])}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}Module["addOnPreRun"]=addOnPreRun;function addOnInit(cb){__ATINIT__.unshift(cb)}Module["addOnInit"]=addOnInit;function addOnPreMain(cb){__ATMAIN__.unshift(cb)}Module["addOnPreMain"]=addOnPreMain;function addOnExit(cb){__ATEXIT__.unshift(cb)}Module["addOnExit"]=addOnExit;function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}Module["addOnPostRun"]=addOnPostRun;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}Module["intArrayFromString"]=intArrayFromString;function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}Module["intArrayToString"]=intArrayToString;function writeStringToMemory(string,buffer,dontAddNull){var array=intArrayFromString(string,dontAddNull);var i=0;while(i>0]=chr;i=i+1}}Module["writeStringToMemory"]=writeStringToMemory;function writeArrayToMemory(array,buffer){for(var i=0;i>0]=array[i]}}Module["writeArrayToMemory"]=writeArrayToMemory;function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}Module["writeAsciiToMemory"]=writeAsciiToMemory;function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=half&&(bits<=32||value>half)){value=-2*half+value}return value}if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32};Math.clz32=Math["clz32"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_min=Math.min;var Math_clz32=Math.clz32;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}Module["addRunDependency"]=addRunDependency;function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["removeRunDependency"]=removeRunDependency;Module["preloadedImages"]={};Module["preloadedAudios"]={};var memoryInitializer=null;var ASM_CONSTS=[];STATIC_BASE=8;STATICTOP=STATIC_BASE+25664;__ATINIT__.push();allocate([131,192,202,161,69,182,251,63,127,251,58,112,206,136,234,63,127,251,58,112,206,136,234,63,131,192,202,161,69,182,251,63,225,122,20,174,71,225,252,63,94,186,73,12,2,43,249,63,0,0,0,0,0,0,240,63,0,0,0,0,0,0,248,63,0,0,0,0,0,0,6,64,0,0,0,0,0,128,21,64,92,143,194,245,40,92,37,64,215,163,112,61,10,87,53,64,246,40,92,143,194,85,69,64,133,235,81,184,30,85,85,64,102,102,102,102,102,86,101,64,205,204,204,204,204,84,117,64,207,247,83,227,165,155,240,63,70,182,243,253,212,120,249,63,39,49,8,172,28,90,7,64,29,90,100,59,223,207,22,64,41,92,143,194,245,168,38,64,164,112,61,10,215,163,54,64,0,0,0,0,0,160,70,64,31,133,235,81,184,158,86,64,205,204,204,204,204,156,102,64,0,0,0,0,0,0,0,0,207,247,83,227,165,155,240,63,70,182,243,253,212,120,249,63,39,49,8,172,28,90,7,64,29,90,100,59,223,207,22,64,41,92,143,194,245,168,38,64,164,112,61,10,215,163,54,64,0,0,0,0,0,160,70,64,31,133,235,81,184,158,86,64,205,204,204,204,204,156,102,64,0,0,0,0,0,0,0,0,173,250,92,109,197,254,230,63,86,125,174,182,98,127,237,63,199,75,55,137,65,96,249,63,242,210,77,98,16,88,8,64,250,126,106,188,116,19,24,64,133,235,81,184,30,5,40,64,0,0,0,0,0,0,56,64,92,143,194,245,40,252,71,64,236,81,184,30,133,251,87,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,63,113,61,10,215,163,112,255,63,104,145,237,124,63,181,16,64,117,147,24,4,86,206,32,64,102,102,102,102,102,230,48,64,236,81,184,30,133,235,64,64,92,143,194,245,40,236,80,64,154,153,153,153,153,233,96,64,154,153,153,153,153,233,112,64,51,51,51,51,51,231,128,64,147,24,4,86,14,45,0,64,182,243,253,212,120,233,15,64,246,40,92,143,194,181,32,64,10,215,163,112,61,10,49,64,195,245,40,92,143,34,65,64,184,30,133,235,81,40,81,64,154,153,153,153,153,41,97,64,154,153,153,153,153,41,113,64,0,0,0,0,0,40,129,64,0,0,0,0,0,0,0,0,147,24,4,86,14,45,0,64,182,243,253,212,120,233,15,64,246,40,92,143,194,181,32,64,10,215,163,112,61,10,49,64,195,245,40,92,143,34,65,64,184,30,133,235,81,40,81,64,154,153,153,153,153,41,97,64,154,153,153,153,153,41,113,64,0,0,0,0,0,40,129,64,0,0,0,0,0,0,0,0,164,112,61,10,215,163,0,64,236,81,184,30,133,235,14,64,119,190,159,26,47,157,32,64,174,71,225,122,20,46,49,64,123,20,174,71,225,90,65,64,246,40,92,143,194,101,81,64,154,153,153,153,153,105,97,64,154,153,153,153,153,105,113,64,154,153,153,153,153,105,129,64,0,0,0,0,0,0,0,0,4,0,0,0,67,80,82,76,0,0,0,0,0,0,0,0,76,82,67,80,0,0,0,0,3,0,0,0,80,67,82,76,0,0,0,0,1,0,0,0,82,76,67,80,0,0,0,0,2,0,0,0,82,80,67,76,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,144,255,0,0,12,0,0,0,1,0,0,0,82,255,0,0,20,0,0,0,2,0,0,0,83,255,0,0,20,0,0,0,3,0,0,0,94,255,0,0,20,0,0,0,4,0,0,0,92,255,0,0,20,0,0,0,5,0,0,0,93,255,0,0,20,0,0,0,6,0,0,0,95,255,0,0,20,0,0,0,7,0,0,0,81,255,0,0,2,0,0,0,8,0,0,0,85,255,0,0,4,0,0,0,9,0,0,0,87,255,0,0,4,0,0,0,10,0,0,0,88,255,0,0,16,0,0,0,11,0,0,0,96,255,0,0,4,0,0,0,12,0,0,0,97,255,0,0,16,0,0,0,13,0,0,0,145,255,0,0,0,0,0,0,0,0,0,0,99,255,0,0,4,0,0,0,14,0,0,0,100,255,0,0,20,0,0,0,15,0,0,0,116,255,0,0,20,0,0,0,16,0,0,0,120,255,0,0,4,0,0,0,17,0,0,0,117,255,0,0,20,0,0,0,18,0,0,0,119,255,0,0,20,0,0,0,19,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,4,0,0,0,8,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,32,32,80,106,20,0,0,0,112,121,116,102,21,0,0,0,104,50,112,106,22,0,0,0,114,100,104,105,23,0,0,0,114,108,111,99,24,0,0,0,99,99,112,98,25,0,0,0,114,108,99,112,26,0,0,0,112,97,109,99,27,0,0,0,102,101,100,99,28,0,0,0,1,86,0,0,0,0,0,0,164,4,0,0,180,4,0,0,1,86,0,0,1,0,0,0,180,4,0,0,164,4,0,0,1,52,0,0,0,0,0,0,196,4,0,0,68,5,0,0,1,52,0,0,1,0,0,0,212,4,0,0,84,5,0,0,1,24,0,0,0,0,0,0,228,4,0,0,164,5,0,0,1,24,0,0,1,0,0,0,244,4,0,0,180,5,0,0,193,10,0,0,0,0,0,0,4,5,0,0,4,6,0,0,193,10,0,0,1,0,0,0,20,5,0,0,20,6,0,0,33,5,0,0,0,0,0,0,36,5,0,0,36,8,0,0,33,5,0,0,1,0,0,0,52,5,0,0,52,8,0,0,33,2,0,0,0,0,0,0,68,9,0,0,164,8,0,0,33,2,0,0,1,0,0,0,84,9,0,0,180,8,0,0,1,86,0,0,0,0,0,0,100,5,0,0,84,5,0,0,1,86,0,0,1,0,0,0,116,5,0,0,68,5,0,0,1,84,0,0,0,0,0,0,132,5,0,0,68,6,0,0,1,84,0,0,1,0,0,0,148,5,0,0,84,6,0,0,1,72,0,0,0,0,0,0,164,5,0,0,68,6,0,0,1,72,0,0,1,0,0,0,180,5,0,0,84,6,0,0,1,56,0,0,0,0,0,0,196,5,0,0,68,6,0,0,1,56,0,0,1,0,0,0,212,5,0,0,84,6,0,0,1,48,0,0,0,0,0,0,228,5,0,0,164,6,0,0,1,48,0,0,1,0,0,0,244,5,0,0,180,6,0,0,1,36,0,0,0,0,0,0,4,6,0,0,196,6,0,0,1,36,0,0,1,0,0,0,20,6,0,0,212,6,0,0,1,28,0,0,0,0,0,0,36,6,0,0,4,7,0,0,1,28,0,0,1,0,0,0,52,6,0,0,20,7,0,0,1,22,0,0,0,0,0,0,36,8,0,0,36,7,0,0,1,22,0,0,1,0,0,0,52,8,0,0,52,7,0,0,1,86,0,0,0,0,0,0,100,6,0,0,84,6,0,0,1,86,0,0,1,0,0,0,116,6,0,0,68,6,0,0,1,84,0,0,0,0,0,0,132,6,0,0,68,6,0,0,1,84,0,0,1,0,0,0,148,6,0,0,84,6,0,0,1,81,0,0,0,0,0,0,164,6,0,0,100,6,0,0,1,81,0,0,1,0,0,0,180,6,0,0,116,6,0,0,1,72,0,0,0,0,0,0,196,6,0,0,132,6,0,0,1,72,0,0,1,0,0,0,212,6,0,0,148,6,0,0,1,56,0,0,0,0,0,0,228,6,0,0,164,6,0,0,1,56,0,0,1,0,0,0,244,6,0,0,180,6,0,0,1,52,0,0,0,0,0,0,4,7,0,0,196,6,0,0,1,52,0,0,1,0,0,0,20,7,0,0,212,6,0,0,1,48,0,0,0,0,0,0,36,7,0,0,228,6,0,0,1,48,0,0,1,0,0,0,52,7,0,0,244,6,0,0,1,40,0,0,0,0,0,0,68,7,0,0,228,6,0,0,1,40,0,0,1,0,0,0,84,7,0,0,244,6,0,0,1,36,0,0,0,0,0,0,100,7,0,0,4,7,0,0,1,36,0,0,1,0,0,0,116,7,0,0,20,7,0,0,1,34,0,0,0,0,0,0,132,7,0,0,36,7,0,0,1,34,0,0,1,0,0,0,148,7,0,0,52,7,0,0,1,28,0,0,0,0,0,0,164,7,0,0,68,7,0,0,1,28,0,0,1,0,0,0,180,7,0,0,84,7,0,0,1,24,0,0,0,0,0,0,196,7,0,0,100,7,0,0,1,24,0,0,1,0,0,0,212,7,0,0,116,7,0,0,1,22,0,0,0,0,0,0,228,7,0,0,132,7,0,0,1,22,0,0,1,0,0,0,244,7,0,0,148,7,0,0,1,20,0,0,0,0,0,0,4,8,0,0,164,7,0,0,1,20,0,0,1,0,0,0,20,8,0,0,180,7,0,0,1,18,0,0,0,0,0,0,36,8,0,0,196,7,0,0,1,18,0,0,1,0,0,0,52,8,0,0,212,7,0,0,1,17,0,0,0,0,0,0,68,8,0,0,228,7,0,0,1,17,0,0,1,0,0,0,84,8,0,0,244,7,0,0,193,10,0,0,0,0,0,0,100,8,0,0,4,8,0,0,193,10,0,0,1,0,0,0,116,8,0,0,20,8,0,0,193,9,0,0,0,0,0,0,132,8,0,0,36,8,0,0,193,9,0,0,1,0,0,0,148,8,0,0,52,8,0,0,161,8,0,0,0,0,0,0,164,8,0,0,68,8,0,0,161,8,0,0,1,0,0,0,180,8,0,0,84,8,0,0,33,5,0,0,0,0,0,0,196,8,0,0,100,8,0,0,33,5,0,0,1,0,0,0,212,8,0,0,116,8,0,0,65,4,0,0,0,0,0,0,228,8,0,0,132,8,0,0,65,4,0,0,1,0,0,0,244,8,0,0,148,8,0,0,161,2,0,0,0,0,0,0,4,9,0,0,164,8,0,0,161,2,0,0,1,0,0,0,20,9,0,0,180,8,0,0,33,2,0,0,0,0,0,0,36,9,0,0,196,8,0,0,33,2,0,0,1,0,0,0,52,9,0,0,212,8,0,0,65,1,0,0,0,0,0,0,68,9,0,0,228,8,0,0,65,1,0,0,1,0,0,0,84,9,0,0,244,8,0,0,17,1,0,0,0,0,0,0,100,9,0,0,4,9,0,0,17,1,0,0,1,0,0,0,116,9,0,0,20,9,0,0,133,0,0,0,0,0,0,0,132,9,0,0,36,9,0,0,133,0,0,0,1,0,0,0,148,9,0,0,52,9,0,0,73,0,0,0,0,0,0,0,164,9,0,0,68,9,0,0,73,0,0,0,1,0,0,0,180,9,0,0,84,9,0,0,37,0,0,0,0,0,0,0,196,9,0,0,100,9,0,0,37,0,0,0,1,0,0,0,212,9,0,0,116,9,0,0,21,0,0,0,0,0,0,0,228,9,0,0,132,9,0,0,21,0,0,0,1,0,0,0,244,9,0,0,148,9,0,0,9,0,0,0,0,0,0,0,4,10,0,0,164,9,0,0,9,0,0,0,1,0,0,0,20,10,0,0,180,9,0,0,5,0,0,0,0,0,0,0,36,10,0,0,196,9,0,0,5,0,0,0,1,0,0,0,52,10,0,0,212,9,0,0,1,0,0,0,0,0,0,0,36,10,0,0,228,9,0,0,1,0,0,0,1,0,0,0,52,10,0,0,244,9,0,0,1,86,0,0,0,0,0,0,68,10,0,0,68,10,0,0,1,86,0,0,1,0,0,0,84,10,0,0,84,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,11,0,0,12,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,38,94,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,64,4,32,0,32,2,128,0,128,8,16,0,16,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,1,0,3,128,4,0,6,128,7,0,9,128,10,0,12,128,13,0,15,128,16,0,18,128,19,0,21,128,22,0,24,128,25,0,27,128,28,0,30,128,31,0,33,128,34,0,36,128,37,0,39,128,40,0,42,128,43,0,45,128,46,0,48,128,49,0,51,128,52,0,54,128,55,0,57,128,58,0,60,128,61,0,63,128,64,0,66,128,67,0,69,128,70,0,72,128,73,0,75,128,76,0,78,128,79,0,81,128,82,0,84,128,85,0,87,128,88,0,90,128,91,0,93,128,94,0,96,128,97,0,99,128,100,0,102,128,103,0,105,128,106,0,108,128,109,0,111,128,112,0,114,128,115,0,117,128,118,0,0,0,0,0,0,0,0,0,0,0,0,128,0,128,0,128,0,128,0,0,1,0,1,0,1,128,1,128,1,0,2,0,2,128,2,128,2,0,3,0,3,128,3,0,4,0,4,128,4,0,5,128,5,128,5,0,6,128,6,0,7,128,7,0,8,128,8,0,9,128,9,0,10,128,10,128,11,0,12,128,12,0,13,0,14,128,14,0,15,0,16,128,16,128,17,0,18,0,19,128,19,128,20,0,21,0,22,0,23,128,23,128,24,128,25,128,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,128,38,128,39,128,40,128,41,0,43,0,44,0,45,128,46,128,47,0,49,0,50,128,51,128,52,0,54,0,55,128,56,0,58,0,59,128,60,0,62,128,63,128,64,0,66,128,67,0,69,128,70,0,72,128,73,0,75,128,76,0,78,128,79,128,81,0,83,128,84,0,86,0,88,128,89,0,91,0,93,128,94,128,96,0,98,0,100,128,101,128,103,0,105,0,107,0,109,128,110,128,112,128,114,128,116,0,118,0,120,0,122,0,124,0,126,0,24,128,23,0,23,128,22,0,22,128,21,0,21,128,20,0,20,128,19,0,19,128,18,0,18,128,17,0,17,128,16,0,16,128,15,0,15,128,14,0,14,128,13,0,13,128,12,0,12,128,11,0,11,128,10,0,10,128,9,0,9,128,8,0,8,128,7,0,7,128,6,0,6,128,5,0,5,128,4,0,4,128,3,0,3,128,2,0,2,128,1,0,1,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,1,128,1,0,2,128,2,0,3,128,3,0,4,128,4,0,5,128,5,0,6,128,6,0,7,128,7,0,8,128,8,0,9,128,9,0,10,128,10,0,11,128,11,0,12,128,12,0,13,128,13,0,14,128,14,0,15,128,15,0,16,128,16,0,17,128,17,0,18,128,18,0,19,128,19,0,20,128,20,0,21,128,21,0,22,128,22,0,23,128,23,0,32,0,31,0,30,0,29,0,28,0,27,128,26,128,25,128,24,128,23,0,23,0,22,0,21,128,20,128,19,0,19,0,18,128,17,128,16,0,16,0,15,128,14,0,14,0,13,128,12,0,12,128,11,128,10,0,10,128,9,0,9,128,8,0,8,128,7,0,7,128,6,0,6,128,5,128,5,0,5,128,4,0,4,0,4,128,3,0,3,0,3,128,2,128,2,0,2,0,2,128,1,128,1,0,1,0,1,0,1,128,0,128,0,128,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,128,0,128,0,128,0,0,1,0,1,0,1,128,1,128,1,0,2,0,2,128,2,128,2,0,3,0,3,128,3,0,4,0,4,128,4,0,5,128,5,128,5,0,6,128,6,0,7,128,7,0,8,128,8,0,9,128,9,0,10,128,10,128,11,0,12,128,12,0,13,0,14,128,14,0,15,0,16,128,16,128,17,0,18,0,19,128,19,128,20,0,21,0,22,0,23,128,23,128,24,128,25,128,26,0,27,0,28,0,29,0,30,0,31,91,69,82,82,79,82,93,32,111,112,106,95,100,101,99,111,109,112,114,101,115,115,58,32,102,97,105,108,101,100,32,116,111,32,115,101,116,117,112,32,116,104,101,32,100,101,99,111,100,101,114,0,91,69,82,82,79,82,93,32,111,112,106,95,100,101,99,111,109,112,114,101,115,115,58,32,102,97,105,108,101,100,32,116,111,32,114,101,97,100,32,116,104,101,32,104,101,97,100,101,114,0,91,69,82,82,79,82,93,32,111,112,106,95,100,101,99,111,109,112,114,101,115,115,58,32,102,97,105,108,101,100,32,116,111,32,100,101,99,111,100,101,32,116,105,108,101,33,0,91,69,82,82,79,82,93,32,37,115,0,83,116,114,101,97,109,32,114,101,97,99,104,101,100,32,105,116,115,32,101,110,100,32,33,10,0,69,114,114,111,114,32,111,110,32,119,114,105,116,105,110,103,32,115,116,114,101,97,109,33,10,0,83,116,114,101,97,109,32,101,114,114,111,114,33,10,0,50,46,49,46,48,0,67,111,100,101,99,32,112,114,111,118,105,100,101,100,32,116,111,32,116,104,101,32,111,112,106,95,115,101,116,117,112,95,100,101,99,111,100,101,114,32,102,117,110,99,116,105,111,110,32,105,115,32,110,111,116,32,97,32,100,101,99,111,109,112,114,101,115,115,111,114,32,104,97,110,100,108,101,114,46,10,0,67,111,100,101,99,32,112,114,111,118,105,100,101,100,32,116,111,32,116,104,101,32,111,112,106,95,114,101,97,100,95,104,101,97,100,101,114,32,102,117,110,99,116,105,111,110,32,105,115,32,110,111,116,32,97,32,100,101,99,111,109,112,114,101,115,115,111,114,32,104,97,110,100,108,101,114,46,10,0,119,98,0,114,98,0,73,110,118,97,108,105,100,32,110,117,109,98,101,114,32,111,102,32,114,101,115,111,108,117,116,105,111,110,115,32,58,32,37,100,32,110,111,116,32,105,110,32,114,97,110,103,101,32,91,49,44,37,100,93,10,0,68,101,112,114,101,99,97,116,101,100,32,102,105,101,108,100,115,32,99,112,95,99,105,110,101,109,97,32,111,114,32,99,112,95,114,115,105,122,32,97,114,101,32,117,115,101,100,10,80,108,101,97,115,101,32,99,111,110,115,105,100,101,114,32,117,115,105,110,103,32,111,110,108,121,32,116,104,101,32,114,115,105,122,32,102,105,101,108,100,10,83,101,101,32,111,112,101,110,106,112,101,103,46,104,32,100,111,99,117,109,101,110,116,97,116,105,111,110,32,102,111,114,32,109,111,114,101,32,100,101,116,97,105,108,115,10,0,84,104,101,32,100,101,115,105,114,101,100,32,109,97,120,105,109,117,109,32,99,111,100,101,115,116,114,101,97,109,32,115,105,122,101,32,104,97,115,32,108,105,109,105,116,101,100,10,97,116,32,108,101,97,115,116,32,111,110,101,32,111,102,32,116,104,101,32,100,101,115,105,114,101,100,32,113,117,97,108,105,116,121,32,108,97,121,101,114,115,10,0,74,80,69,71,32,50,48,48,48,32,83,99,97,108,97,98,108,101,32,68,105,103,105,116,97,108,32,67,105,110,101,109,97,32,112,114,111,102,105,108,101,115,32,110,111,116,32,121,101,116,32,115,117,112,112,111,114,116,101,100,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,97,110,100,32,52,32,40,50,107,47,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,49,32,115,105,110,103,108,101,32,113,117,97,108,105,116,121,32,108,97,121,101,114,45,62,32,78,117,109,98,101,114,32,111,102,32,108,97,121,101,114,115,32,102,111,114,99,101,100,32,116,111,32,49,32,40,114,97,116,104,101,114,32,116,104,97,110,32,37,100,41,10,45,62,32,82,97,116,101,32,111,102,32,116,104,101,32,108,97,115,116,32,108,97,121,101,114,32,40,37,51,46,49,102,41,32,119,105,108,108,32,98,101,32,117,115,101,100,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,40,50,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,78,117,109,98,101,114,32,111,102,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,108,101,118,101,108,115,32,60,61,32,53,10,45,62,32,78,117,109,98,101,114,32,111,102,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,108,101,118,101,108,115,32,102,111,114,99,101,100,32,116,111,32,53,32,40,114,97,116,104,101,114,32,116,104,97,110,32,37,100,41,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,52,32,40,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,78,117,109,98,101,114,32,111,102,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,108,101,118,101,108,115,32,62,61,32,49,32,38,38,32,60,61,32,54,10,45,62,32,78,117,109,98,101,114,32,111,102,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,108,101,118,101,108,115,32,102,111,114,99,101,100,32,116,111,32,49,32,40,114,97,116,104,101,114,32,116,104,97,110,32,37,100,41,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,52,32,40,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,78,117,109,98,101,114,32,111,102,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,108,101,118,101,108,115,32,62,61,32,49,32,38,38,32,60,61,32,54,10,45,62,32,78,117,109,98,101,114,32,111,102,32,100,101,99,111,109,112,111,115,105,116,105,111,110,32,108,101,118,101,108,115,32,102,111,114,99,101,100,32,116,111,32,54,32,40,114,97,116,104,101,114,32,116,104,97,110,32,37,100,41,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,97,110,100,32,52,32,40,50,107,47,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,77,97,120,105,109,117,109,32,49,51,48,50,48,56,51,32,99,111,109,112,114,101,115,115,101,100,32,98,121,116,101,115,32,64,32,50,52,102,112,115,10,65,115,32,110,111,32,114,97,116,101,32,104,97,115,32,98,101,101,110,32,103,105,118,101,110,44,32,116,104,105,115,32,108,105,109,105,116,32,119,105,108,108,32,98,101,32,117,115,101,100,46,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,97,110,100,32,52,32,40,50,107,47,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,77,97,120,105,109,117,109,32,49,51,48,50,48,56,51,32,99,111,109,112,114,101,115,115,101,100,32,98,121,116,101,115,32,64,32,50,52,102,112,115,10,45,62,32,83,112,101,99,105,102,105,101,100,32,114,97,116,101,32,101,120,99,101,101,100,115,32,116,104,105,115,32,108,105,109,105,116,46,32,82,97,116,101,32,119,105,108,108,32,98,101,32,102,111,114,99,101,100,32,116,111,32,49,51,48,50,48,56,51,32,98,121,116,101,115,46,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,97,110,100,32,52,32,40,50,107,47,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,77,97,120,105,109,117,109,32,49,48,52,49,54,54,54,32,99,111,109,112,114,101,115,115,101,100,32,98,121,116,101,115,32,64,32,50,52,102,112,115,10,65,115,32,110,111,32,114,97,116,101,32,104,97,115,32,98,101,101,110,32,103,105,118,101,110,44,32,116,104,105,115,32,108,105,109,105,116,32,119,105,108,108,32,98,101,32,117,115,101,100,46,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,97,110,100,32,52,32,40,50,107,47,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,77,97,120,105,109,117,109,32,49,48,52,49,54,54,54,32,99,111,109,112,114,101,115,115,101,100,32,98,121,116,101,115,32,64,32,50,52,102,112,115,10,45,62,32,83,112,101,99,105,102,105,101,100,32,114,97,116,101,32,101,120,99,101,101,100,115,32,116,104,105,115,32,108,105,109,105,116,46,32,82,97,116,101,32,119,105,108,108,32,98,101,32,102,111,114,99,101,100,32,116,111,32,49,48,52,49,54,54,54,32,98,121,116,101,115,46,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,40,50,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,51,32,99,111,109,112,111,110,101,110,116,115,45,62,32,78,117,109,98,101,114,32,111,102,32,99,111,109,112,111,110,101,110,116,115,32,111,102,32,105,110,112,117,116,32,105,109,97,103,101,32,40,37,100,41,32,105,115,32,110,111,116,32,99,111,109,112,108,105,97,110,116,10,45,62,32,78,111,110,45,112,114,111,102,105,108,101,45,51,32,99,111,100,101,115,116,114,101,97,109,32,119,105,108,108,32,98,101,32,103,101,110,101,114,97,116,101,100,10,0,115,105,103,110,101,100,0,117,110,115,105,103,110,101,100,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,40,50,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,80,114,101,99,105,115,105,111,110,32,111,102,32,101,97,99,104,32,99,111,109,112,111,110,101,110,116,32,115,104,97,108,108,32,98,101,32,49,50,32,98,105,116,115,32,117,110,115,105,103,110,101,100,45,62,32,65,116,32,108,101,97,115,116,32,99,111,109,112,111,110,101,110,116,32,37,100,32,111,102,32,105,110,112,117,116,32,105,109,97,103,101,32,40,37,100,32,98,105,116,115,44,32,37,115,41,32,105,115,32,110,111,116,32,99,111,109,112,108,105,97,110,116,10,45,62,32,78,111,110,45,112,114,111,102,105,108,101,45,51,32,99,111,100,101,115,116,114,101,97,109,32,119,105,108,108,32,98,101,32,103,101,110,101,114,97,116,101,100,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,51,32,40,50,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,119,105,100,116,104,32,60,61,32,50,48,52,56,32,97,110,100,32,104,101,105,103,104,116,32,60,61,32,49,48,56,48,10,45,62,32,73,110,112,117,116,32,105,109,97,103,101,32,115,105,122,101,32,37,100,32,120,32,37,100,32,105,115,32,110,111,116,32,99,111,109,112,108,105,97,110,116,10,45,62,32,78,111,110,45,112,114,111,102,105,108,101,45,51,32,99,111,100,101,115,116,114,101,97,109,32,119,105,108,108,32,98,101,32,103,101,110,101,114,97,116,101,100,10,0,74,80,69,71,32,50,48,48,48,32,80,114,111,102,105,108,101,45,52,32,40,52,107,32,100,99,32,112,114,111,102,105,108,101,41,32,114,101,113,117,105,114,101,115,58,10,119,105,100,116,104,32,60,61,32,52,48,57,54,32,97,110,100,32,104,101,105,103,104,116,32,60,61,32,50,49,54,48,10,45,62,32,73,109,97,103,101,32,115,105,122,101,32,37,100,32,120,32,37,100,32,105,115,32,110,111,116,32,99,111,109,112,108,105,97,110,116,10,45,62,32,78,111,110,45,112,114,111,102,105,108,101,45,52,32,99,111,100,101,115,116,114,101,97,109,32,119,105,108,108,32,98,101,32,103,101,110,101,114,97,116,101,100,10,0,74,80,69,71,32,50,48,48,48,32,76,111,110,103,32,84,101,114,109,32,83,116,111,114,97,103,101,32,112,114,111,102,105,108,101,32,110,111,116,32,121,101,116,32,115,117,112,112,111,114,116,101,100,10,0,74,80,69,71,32,50,48,48,48,32,66,114,111,97,100,99,97,115,116,32,112,114,111,102,105,108,101,115,32,110,111,116,32,121,101,116,32,115,117,112,112,111,114,116,101,100,10,0,74,80,69,71,32,50,48,48,48,32,73,77,70,32,112,114,111,102,105,108,101,115,32,110,111,116,32,121,101,116,32,115,117,112,112,111,114,116,101,100,10,0,74,80,69,71,32,50,48,48,48,32,80,97,114,116,45,50,32,112,114,111,102,105,108,101,32,100,101,102,105,110,101,100,10,98,117,116,32,110,111,32,80,97,114,116,45,50,32,101,120,116,101,110,115,105,111,110,32,101,110,97,98,108,101,100,46,10,80,114,111,102,105,108,101,32,115,101,116,32,116,111,32,78,79,78,69,46,10,0,85,110,115,117,112,112,111,114,116,101,100,32,80,97,114,116,45,50,32,101,120,116,101,110,115,105,111,110,32,101,110,97,98,108,101,100,10,80,114,111,102,105,108,101,32,115,101,116,32,116,111,32,78,79,78,69,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,99,111,112,121,32,111,102,32,117,115,101,114,32,101,110,99,111,100,105,110,103,32,112,97,114,97,109,101,116,101,114,115,32,109,97,116,114,105,120,32,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,99,111,112,121,32,111,102,32,99,111,109,109,101,110,116,32,115,116,114,105,110,103,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,99,111,109,109,101,110,116,32,115,116,114,105,110,103,10,0,37,115,37,115,0,67,114,101,97,116,101,100,32,98,121,32,79,112,101,110,74,80,69,71,32,118,101,114,115,105,111,110,32,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,116,105,108,101,32,99,111,100,105,110,103,32,112,97,114,97,109,101,116,101,114,115,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,102,111,114,32,99,104,101,99,107,105,110,103,32,116,104,101,32,112,111,99,32,118,97,108,117,101,115,46,10,0,77,105,115,115,105,110,103,32,112,97,99,107,101,116,115,32,112,111,115,115,105,98,108,101,32,108,111,115,115,32,111,102,32,100,97,116,97,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,116,105,108,101,32,99,111,109,112,111,110,101,110,116,32,99,111,100,105,110,103,32,112,97,114,97,109,101,116,101,114,115,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,116,101,109,112,32,98,117,102,102,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,101,110,99,111,100,101,114,32,77,67,84,32,99,111,100,105,110,103,32,109,97,116,114,105,120,32,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,101,110,99,111,100,101,114,32,77,67,84,32,100,101,99,111,100,105,110,103,32,109,97,116,114,105,120,32,10,0,70,97,105,108,101,100,32,116,111,32,105,110,118,101,114,115,101,32,101,110,99,111,100,101,114,32,77,67,84,32,100,101,99,111,100,105,110,103,32,109,97,116,114,105,120,32,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,108,108,111,99,97,116,101,32,101,110,99,111,100,101,114,32,77,67,84,32,110,111,114,109,115,32,10,0,70,97,105,108,101,100,32,116,111,32,115,101,116,117,112,32,106,50,107,32,109,99,116,32,101,110,99,111,100,105,110,103,10,0,67,97,110,110,111,116,32,112,101,114,102,111,114,109,32,77,67,84,32,111,110,32,99,111,109,112,111,110,101,110,116,115,32,119,105,116,104,32,100,105,102,102,101,114,101,110,116,32,115,105,122,101,115,46,32,68,105,115,97,98,108,105,110,103,32,77,67,84,46,10,0,83,116,114,101,97,109,32,116,111,111,32,115,104,111,114,116,10,0,73,110,99,111,110,115,105,115,116,101,110,116,32,109,97,114,107,101,114,32,115,105,122,101,10,0,77,97,114,107,101,114,32,105,115,32,110,111,116,32,99,111,109,112,108,105,97,110,116,32,119,105,116,104,32,105,116,115,32,112,111,115,105,116,105,111,110,10,0,77,97,114,107,101,114,32,115,105,122,101,32,105,110,99,111,110,115,105,115,116,101,110,116,32,119,105,116,104,32,115,116,114,101,97,109,32,108,101,110,103,116,104,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,114,101,97,100,32,104,101,97,100,101,114,10,0,78,111,116,32,115,117,114,101,32,104,111,119,32,116,104,97,116,32,104,97,112,112,101,110,101,100,46,10,0,70,97,105,108,32,116,111,32,114,101,97,100,32,116,104,101,32,99,117,114,114,101,110,116,32,109,97,114,107,101,114,32,115,101,103,109,101,110,116,32,40,37,35,120,41,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,100,100,32,116,108,32,109,97,114,107,101,114,10,0,84,105,108,101,32,112,97,114,116,32,108,101,110,103,116,104,32,115,105,122,101,32,105,110,99,111,110,115,105,115,116,101,110,116,32,119,105,116,104,32,115,116,114,101,97,109,32,108,101,110,103,116,104,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,100,101,99,111,100,101,32,116,105,108,101,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,83,79,84,32,109,97,114,107,101,114,10,0,111,112,106,95,106,50,107,95,97,112,112,108,121,95,110,98,95,116,105,108,101,95,112,97,114,116,115,95,99,111,114,114,101,99,116,105,111,110,32,101,114,114,111,114,10,0,78,111,110,32,99,111,110,102,111,114,109,97,110,116,32,99,111,100,101,115,116,114,101,97,109,32,84,80,115,111,116,61,61,84,78,115,111,116,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,114,101,97,100,32,80,80,84,32,109,97,114,107,101,114,10,0,70,97,105,108,101,100,32,116,111,32,109,101,114,103,101,32,80,80,84,32,100,97,116,97,10,0,67,97,110,110,111,116,32,100,101,99,111,100,101,32,116,105,108,101,44,32,109,101,109,111,114,121,32,101,114,114,111,114,10,0,72,101,97,100,101,114,32,111,102,32,116,105,108,101,32,37,100,32,47,32,37,100,32,104,97,115,32,98,101,101,110,32,114,101,97,100,46,10,0,70,97,105,108,101,100,32,116,111,32,100,101,99,111,100,101,46,10,0,78,111,32,69,79,67,32,109,97,114,107,101,114,46,32,80,111,115,115,105,98,108,121,32,97,32,116,114,117,110,99,97,116,101,100,32,115,116,114,101,97,109,10,0,83,116,114,101,97,109,32,100,111,101,115,32,110,111,116,32,101,110,100,32,119,105,116,104,32,69,79,67,10,0,83,116,114,101,97,109,32,116,111,111,32,115,104,111,114,116,44,32,101,120,112,101,99,116,101,100,32,83,79,84,10,0,78,101,101,100,32,116,111,32,100,101,99,111,100,101,32,116,104,101,32,109,97,105,110,32,104,101,97,100,101,114,32,98,101,102,111,114,101,32,98,101,103,105,110,32,116,111,32,100,101,99,111,100,101,32,116,104,101,32,114,101,109,97,105,110,105,110,103,32,99,111,100,101,115,116,114,101,97,109,0,78,111,32,100,101,99,111,100,101,100,32,97,114,101,97,32,112,97,114,97,109,101,116,101,114,115,44,32,115,101,116,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,116,111,32,116,104,101,32,119,104,111,108,101,32,105,109,97,103,101,10,0,76,101,102,116,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,120,48,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,88,115,105,122,61,37,100,41,46,10,0,76,101,102,116,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,120,48,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,88,79,115,105,122,61,37,100,41,46,10,0,85,112,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,121,48,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,89,115,105,122,61,37,100,41,46,10,0,85,112,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,121,48,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,89,79,115,105,122,61,37,100,41,46,10,0,82,105,103,104,116,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,120,49,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,88,79,115,105,122,61,37,100,41,46,10,0,82,105,103,104,116,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,120,49,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,88,115,105,122,61,37,100,41,46,10,0,66,111,116,116,111,109,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,121,49,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,89,79,115,105,122,61,37,100,41,46,10,0,66,111,116,116,111,109,32,112,111,115,105,116,105,111,110,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,97,114,101,97,32,40,114,101,103,105,111,110,95,121,49,61,37,100,41,32,105,115,32,111,117,116,115,105,100,101,32,116,104,101,32,105,109,97,103,101,32,97,114,101,97,32,40,89,115,105,122,61,37,100,41,46,10,0,83,105,122,101,32,120,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,99,111,109,112,111,110,101,110,116,32,105,109,97,103,101,32,105,115,32,105,110,99,111,114,114,101,99,116,32,40,99,111,109,112,91,37,100,93,46,119,61,37,100,41,46,10,0,83,105,122,101,32,121,32,111,102,32,116,104,101,32,100,101,99,111,100,101,100,32,99,111,109,112,111,110,101,110,116,32,105,109,97,103,101,32,105,115,32,105,110,99,111,114,114,101,99,116,32,40,99,111,109,112,91,37,100,93,46,104,61,37,100,41,46,10,0,83,101,116,116,105,110,103,32,100,101,99,111,100,105,110,103,32,97,114,101,97,32,116,111,32,37,100,44,37,100,44,37,100,44,37,100,10,0,87,114,111,110,103,32,102,108,97,103,10,0,67,111,100,101,115,116,114,101,97,109,32,105,110,102,111,32,102,114,111,109,32,109,97,105,110,32,104,101,97,100,101,114,58,32,123,10,0,9,32,116,120,48,61,37,100,44,32,116,121,48,61,37,100,10,0,9,32,116,100,120,61,37,100,44,32,116,100,121,61,37,100,10,0,9,32,116,119,61,37,100,44,32,116,104,61,37,100,10,0,125,10,0,67,111,100,101,115,116,114,101,97,109,32,105,110,100,101,120,32,102,114,111,109,32,109,97,105,110,32,104,101,97,100,101,114,58,32,123,10,0,9,32,77,97,105,110,32,104,101,97,100,101,114,32,115,116,97,114,116,32,112,111,115,105,116,105,111,110,61,37,108,108,105,10,9,32,77,97,105,110,32,104,101],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([97,100,101,114,32,101,110,100,32,112,111,115,105,116,105,111,110,61,37,108,108,105,10,0,9,32,77,97,114,107,101,114,32,108,105,115,116,58,32,123,10,0,9,9,32,116,121,112,101,61,37,35,120,44,32,112,111,115,61,37,108,108,105,44,32,108,101,110,61,37,100,10,0,9,32,125,10,0,9,32,84,105,108,101,32,105,110,100,101,120,58,32,123,10,0,9,9,32,110,98,32,111,102,32,116,105,108,101,45,112,97,114,116,32,105,110,32,116,105,108,101,32,91,37,100,93,61,37,100,10,0,9,9,9,32,116,105,108,101,45,112,97,114,116,91,37,100,93,58,32,115,116,97,114,95,112,111,115,61,37,108,108,105,44,32,101,110,100,95,104,101,97,100,101,114,61,37,108,108,105,44,32,101,110,100,95,112,111,115,61,37,108,108,105,46,10,0,91,68,69,86,93,32,68,117,109,112,32,97,110,32,105,109,97,103,101,95,104,101,97,100,101,114,32,115,116,114,117,99,116,32,123,10,0,73,109,97,103,101,32,105,110,102,111,32,123,10,0,37,115,32,120,48,61,37,100,44,32,121,48,61,37,100,10,0,37,115,32,120,49,61,37,100,44,32,121,49,61,37,100,10,0,37,115,32,110,117,109,99,111,109,112,115,61,37,100,10,0,37,115,9,32,99,111,109,112,111,110,101,110,116,32,37,100,32,123,10,0,37,115,125,10,0,91,68,69,86,93,32,68,117,109,112,32,97,110,32,105,109,97,103,101,95,99,111,109,112,95,104,101,97,100,101,114,32,115,116,114,117,99,116,32,123,10,0,37,115,32,100,120,61,37,100,44,32,100,121,61,37,100,10,0,37,115,32,112,114,101,99,61,37,100,10,0,37,115,32,115,103,110,100,61,37,100,10,0,87,101,32,110,101,101,100,32,97,110,32,105,109,97,103,101,32,112,114,101,118,105,111,117,115,108,121,32,99,114,101,97,116,101,100,46,10,0,84,105,108,101,32,105,110,100,101,120,32,112,114,111,118,105,100,101,100,32,98,121,32,116,104,101,32,117,115,101,114,32,105,115,32,105,110,99,111,114,114,101,99,116,32,37,100,32,40,109,97,120,32,61,32,37,100,41,32,10,0,82,101,115,111,108,117,116,105,111,110,32,102,97,99,116,111,114,32,105,115,32,103,114,101,97,116,101,114,32,116,104,97,110,32,116,104,101,32,109,97,120,105,109,117,109,32,114,101,115,111,108,117,116,105,111,110,32,105,110,32,116,104,101,32,99,111,109,112,111,110,101,110,116,46,10,0,84,104,101,32,103,105,118,101,110,32,116,105,108,101,32,105,110,100,101,120,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,46,0,116,105,108,101,32,110,117,109,98,101,114,32,37,100,32,47,32,37,100,10,0,69,114,114,111,114,32,97,108,108,111,99,97,116,105,110,103,32,116,105,108,101,32,99,111,109,112,111,110,101,110,116,32,100,97,116,97,46,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,101,110,99,111,100,101,32,97,108,108,32,116,105,108,101,115,10,0,83,105,122,101,32,109,105,115,109,97,116,99,104,32,98,101,116,119,101,101,110,32,116,105,108,101,32,100,97,116,97,32,97,110,100,32,115,101,110,116,32,100,97,116,97,46,0,70,97,105,108,101,100,32,116,111,32,97,108,108,111,99,97,116,101,32,105,109,97,103,101,32,104,101,97,100,101,114,46,0,69,114,114,111,114,32,119,104,105,108,101,32,111,112,106,95,106,50,107,95,112,114,101,95,119,114,105,116,101,95,116,105,108,101,32,119,105,116,104,32,116,105,108,101,32,105,110,100,101,120,32,61,32,37,100,10,0,69,114,114,111,114,32,119,104,105,108,101,32,111,112,106,95,106,50,107,95,112,111,115,116,95,119,114,105,116,101,95,116,105,108,101,32,119,105,116,104,32,116,105,108,101,32,105,110,100,101,120,32,61,32,37,100,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,99,114,101,97,116,101,32,84,105,108,101,32,67,111,100,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,67,66,68,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,77,67,84,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,77,67,67,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,77,67,79,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,116,104,101,32,67,79,77,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,80,79,67,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,84,76,77,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,81,67,67,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,119,114,105,116,105,110,103,32,83,81,99,100,32,83,81,99,99,32,101,108,101,109,101,110,116,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,67,79,67,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,119,114,105,116,105,110,103,32,83,80,67,111,100,32,83,80,67,111,99,32,101,108,101,109,101,110,116,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,81,67,68,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,119,114,105,116,105,110,103,32,81,67,68,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,119,114,105,116,101,32,67,79,68,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,119,114,105,116,105,110,103,32,67,79,68,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,102,111,114,32,116,104,101,32,83,73,90,32,109,97,114,107,101,114,10,0,78,117,109,98,101,114,32,111,102,32,114,101,115,111,108,117,116,105,111,110,115,32,105,115,32,116,111,111,32,104,105,103,104,32,105,110,32,99,111,109,112,97,114,105,115,111,110,32,116,111,32,116,104,101,32,115,105,122,101,32,111,102,32,116,105,108,101,115,10,0,67,97,110,110,111,116,32,101,110,99,111,100,101,32,116,105,108,101,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,100,101,99,111,100,101,32,111,110,101,32,116,105,108,101,10,0,80,114,111,98,108,101,109,32,119,105,116,104,32,115,101,101,107,32,102,117,110,99,116,105,111,110,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,100,101,99,111,100,101,32,116,105,108,101,32,37,100,47,37,100,10,0,84,105,108,101,32,37,100,47,37,100,32,104,97,115,32,98,101,101,110,32,100,101,99,111,100,101,100,46,10,0,73,109,97,103,101,32,100,97,116,97,32,104,97,115,32,98,101,101,110,32,117,112,100,97,116,101,100,32,119,105,116,104,32,116,105,108,101,32,37,100,46,10,10,0,84,105,108,101,32,114,101,97,100,44,32,100,101,99,111,100,101,100,32,97,110,100,32,117,112,100,97,116,101,100,32,105,115,32,110,111,116,32,116,104,101,32,100,101,115,105,114,101,100,32,111,110,101,32,40,37,100,32,118,115,32,37,100,41,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,100,101,99,111,100,101,32,116,105,108,101,115,10,0,70,97,105,108,101,100,32,116,111,32,100,101,99,111,100,101,32,116,105,108,101,32,37,100,47,37,100,10,0,9,32,100,101,102,97,117,108,116,32,116,105,108,101,32,123,10,0,9,9,32,99,115,116,121,61,37,35,120,10,0,9,9,32,112,114,103,61,37,35,120,10,0,9,9,32,110,117,109,108,97,121,101,114,115,61,37,100,10,0,9,9,32,109,99,116,61,37,120,10,0,9,9,32,99,111,109,112,32,37,100,32,123,10,0,9,9,9,32,99,115,116,121,61,37,35,120,10,0,9,9,9,32,110,117,109,114,101,115,111,108,117,116,105,111,110,115,61,37,100,10,0,9,9,9,32,99,98,108,107,119,61,50,94,37,100,10,0,9,9,9,32,99,98,108,107,104,61,50,94,37,100,10,0,9,9,9,32,99,98,108,107,115,116,121,61,37,35,120,10,0,9,9,9,32,113,109,102,98,105,100,61,37,100,10,0,9,9,9,32,112,114,101,99,99,105,110,116,115,105,122,101,32,40,119,44,104,41,61,0,40,37,100,44,37,100,41,32,0,9,9,9,32,113,110,116,115,116,121,61,37,100,10,0,9,9,9,32,110,117,109,103,98,105,116,115,61,37,100,10,0,9,9,9,32,115,116,101,112,115,105,122,101,115,32,40,109,44,101,41,61,0,9,9,9,32,114,111,105,115,104,105,102,116,61,37,100,10,0,9,9,32,125,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,77,67,79,32,109,97,114,107,101,114,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,109,117,108,116,105,112,108,101,32,116,114,97,110,115,102,111,114,109,97,116,105,111,110,32,115,116,97,103,101,115,46,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,77,67,67,32,109,97,114,107,101,114,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,109,117,108,116,105,112,108,101,32,100,97,116,97,32,115,112,97,110,110,105,110,103,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,114,101,97,100,32,77,67,67,32,109,97,114,107,101,114,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,109,117,108,116,105,112,108,101,32,99,111,108,108,101,99,116,105,111,110,115,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,99,111,108,108,101,99,116,105,111,110,115,32,111,116,104,101,114,32,116,104,97,110,32,97,114,114,97,121,32,100,101,99,111,114,114,101,108,97,116,105,111,110,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,99,111,108,108,101,99,116,105,111,110,115,32,119,105,116,104,32,105,110,100,105,120,32,115,104,117,102,102,108,101,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,99,111,108,108,101,99,116,105,111,110,115,32,119,105,116,104,111,117,116,32,115,97,109,101,32,110,117,109,98,101,114,32,111,102,32,105,110,100,105,120,101,115,10,0,67,114,114,111,114,32,114,101,97,100,105,110,103,32,67,66,68,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,77,67,84,32,109,97,114,107,101,114,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,109,99,116,32,100,97,116,97,32,119,105,116,104,105,110,32,109,117,108,116,105,112,108,101,32,77,67,84,32,114,101,99,111,114,100,115,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,114,101,97,100,32,77,67,84,32,109,97,114,107,101,114,10,0,67,97,110,110,111,116,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,109,117,108,116,105,112,108,101,32,77,67,84,32,109,97,114,107,101,114,115,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,67,82,71,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,80,80,84,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,80,80,84,32,109,97,114,107,101,114,58,32,112,97,99,107,101,116,32,104,101,97,100,101,114,32,104,97,118,101,32,98,101,101,110,32,112,114,101,118,105,111,117,115,108,121,32,102,111,117,110,100,32,105,110,32,116,104,101,32,109,97,105,110,32,104,101,97,100,101,114,32,40,80,80,77,32,109,97,114,107,101,114,41,46,10,0,90,112,112,116,32,37,117,32,97,108,114,101,97,100,121,32,114,101,97,100,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,80,80,77,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,114,101,97,100,32,80,80,77,32,109,97,114,107,101,114,10,0,90,112,112,109,32,37,117,32,97,108,114,101,97,100,121,32,114,101,97,100,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,80,76,84,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,80,76,77,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,84,76,77,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,119,105,116,104,32,83,73,90,32,109,97,114,107,101,114,32,115,105,122,101,10,0,69,114,114,111,114,32,119,105,116,104,32,83,73,90,32,109,97,114,107,101,114,58,32,110,117,109,98,101,114,32,111,102,32,99,111,109,112,111,110,101,110,116,32,105,115,32,105,108,108,101,103,97,108,32,45,62,32,37,100,10,0,69,114,114,111,114,32,119,105,116,104,32,83,73,90,32,109,97,114,107,101,114,58,32,110,117,109,98,101,114,32,111,102,32,99,111,109,112,111,110,101,110,116,32,105,115,32,110,111,116,32,99,111,109,112,97,116,105,98,108,101,32,119,105,116,104,32,116,104,101,32,114,101,109,97,105,110,105,110,103,32,110,117,109,98,101,114,32,111,102,32,112,97,114,97,109,101,116,101,114,115,32,40,32,37,100,32,118,115,32,37,100,41,10,0,69,114,114,111,114,32,119,105,116,104,32,83,73,90,32,109,97,114,107,101,114,58,32,110,101,103,97,116,105,118,101,32,111,114,32,122,101,114,111,32,105,109,97,103,101,32,115,105,122,101,32,40,37,100,32,120,32,37,100,41,10,0,69,114,114,111,114,32,119,105,116,104,32,83,73,90,32,109,97,114,107,101,114,58,32,105,110,118,97,108,105,100,32,116,105,108,101,32,115,105,122,101,32,40,116,100,120,58,32,37,100,44,32,116,100,121,58,32,37,100,41,10,0,80,114,101,118,101,110,116,32,98,117,102,102,101,114,32,111,118,101,114,102,108,111,119,32,40,120,49,58,32,37,100,44,32,121,49,58,32,37,100,41,10,0,69,114,114,111,114,32,119,105,116,104,32,83,73,90,32,109,97,114,107,101,114,58,32,105,108,108,101,103,97,108,32,116,105,108,101,32,111,102,102,115,101,116,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,116,97,107,101,32,105,110,32,99,104,97,114,103,101,32,83,73,90,32,109,97,114,107,101,114,10,0,73,110,118,97,108,105,100,32,118,97,108,117,101,115,32,102,111,114,32,99,111,109,112,32,61,32,37,100,32,58,32,100,120,61,37,117,32,100,121,61,37,117,10,32,40,115,104,111,117,108,100,32,98,101,32,98,101,116,119,101,101,110,32,49,32,97,110,100,32,50,53,53,32,97,99,99,111,114,100,105,110,103,32,116,104,101,32,74,80,69,71,50,48,48,48,32,110,111,114,109,41,0,73,110,118,97,108,105,100,32,110,117,109,98,101,114,32,111,102,32,116,105,108,101,115,32,58,32,37,117,32,120,32,37,117,32,40,109,97,120,105,109,117,109,32,102,105,120,101,100,32,98,121,32,106,112,101,103,50,48,48,48,32,110,111,114,109,32,105,115,32,54,53,53,51,53,32,116,105,108,101,115,41,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,80,79,67,32,109,97,114,107,101,114,10,0,84,111,111,32,109,97,110,121,32,80,79,67,115,32,37,100,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,81,67,67,32,109,97,114,107,101,114,10,0,73,110,118,97,108,105,100,32,99,111,109,112,111,110,101,110,116,32,110,117,109,98,101,114,58,32,37,100,44,32,114,101,103,97,114,100,105,110,103,32,116,104,101,32,110,117,109,98,101,114,32,111,102,32,99,111,109,112,111,110,101,110,116,115,32,37,100,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,83,81,99,100,32,111,114,32,83,81,99,99,32,101,108,101,109,101,110,116,10,0,87,104,105,108,101,32,114,101,97,100,105,110,103,32,67,67,80,95,81,78,84,83,84,89,32,101,108,101,109,101,110,116,32,105,110,115,105,100,101,32,81,67,68,32,111,114,32,81,67,67,32,109,97,114,107,101,114,32,115,101,103,109,101,110,116,44,32,110,117,109,98,101,114,32,111,102,32,115,117,98,98,97,110,100,115,32,40,37,100,41,32,105,115,32,103,114,101,97,116,101,114,32,116,111,32,79,80,74,95,74,50,75,95,77,65,88,66,65,78,68,83,32,40,37,100,41,46,32,83,111,32,119,101,32,108,105,109,105,116,32,116,104,101,32,110,117,109,98,101,114,32,111,102,32,101,108,101,109,101,110,116,115,32,115,116,111,114,101,100,32,116,111,32,79,80,74,95,74,50,75,95,77,65,88,66,65,78,68,83,32,40,37,100,41,32,97,110,100,32,115,107,105,112,32,116,104,101,32,114,101,115,116,46,32,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,81,67,68,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,82,71,78,32,109,97,114,107,101,114,10,0,98,97,100,32,99,111,109,112,111,110,101,110,116,32,110,117,109,98,101,114,32,105,110,32,82,71,78,32,40,37,100,32,119,104,101,110,32,116,104,101,114,101,32,97,114,101,32,111,110,108,121,32,37,100,41,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,67,79,67,32,109,97,114,107,101,114,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,67,79,67,32,109,97,114,107,101,114,32,40,98,97,100,32,110,117,109,98,101,114,32,111,102,32,99,111,109,112,111,110,101,110,116,115,41,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,83,80,67,111,100,32,83,80,67,111,99,32,101,108,101,109,101,110,116,10,0,73,110,118,97,108,105,100,32,118,97,108,117,101,32,102,111,114,32,110,117,109,114,101,115,111,108,117,116,105,111,110,115,32,58,32,37,100,44,32,109,97,120,32,118,97,108,117,101,32,105,115,32,115,101,116,32,105,110,32,111,112,101,110,106,112,101,103,46,104,32,97,116,32,37,100,10,0,69,114,114,111,114,32,100,101,99,111,100,105,110,103,32,99,111,109,112,111,110,101,110,116,32,37,100,46,10,84,104,101,32,110,117,109,98,101,114,32,111,102,32,114,101,115,111,108,117,116,105,111,110,115,32,116,111,32,114,101,109,111,118,101,32,105,115,32,104,105,103,104,101,114,32,116,104,97,110,32,116,104,101,32,110,117,109,98,101,114,32,111,102,32,114,101,115,111,108,117,116,105,111,110,115,32,111,102,32,116,104,105,115,32,99,111,109,112,111,110,101,110,116,10,77,111,100,105,102,121,32,116,104,101,32,99,112,95,114,101,100,117,99,101,32,112,97,114,97,109,101,116,101,114,46,10,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,83,80,67,111,100,32,83,80,67,111,99,32,101,108,101,109,101,110,116,44,32,73,110,118,97,108,105,100,32,99,98,108,107,119,47,99,98,108,107,104,32,99,111,109,98,105,110,97,116,105,111,110,10,0,73,110,118,97,108,105,100,32,112,114,101,99,105,110,99,116,32,115,105,122,101,10,0,67,79,68,32,109,97,114,107,101,114,32,97,108,114,101,97,100,121,32,114,101,97,100,46,32,78,111,32,109,111,114,101,32,116,104,97,110,32,111,110,101,32,67,79,68,32,109,97,114,107,101,114,32,112,101,114,32,116,105,108,101,46,10,0,69,114,114,111,114,32,114,101,97,100,105,110,103,32,67,79,68,32,109,97,114,107,101,114,10,0,85,110,107,110,111,119,110,32,83,99,111,100,32,118,97,108,117,101,32,105,110,32,67,79,68,32,109,97,114,107,101,114,10,0,85,110,107,110,111,119,110,32,112,114,111,103,114,101,115,115,105,111,110,32,111,114,100,101,114,32,105,110,32,67,79,68,32,109,97,114,107,101,114,10,0,73,110,118,97,108,105,100,32,110,117,109,98,101,114,32,111,102,32,108,97,121,101,114,115,32,105,110,32,67,79,68,32,109,97,114,107,101,114,32,58,32,37,100,32,110,111,116,32,105,110,32,114,97,110,103,101,32,91,49,45,54,53,53,51,53,93,10,0,73,110,118,97,108,105,100,32,116,105,108,101,32,110,117,109,98,101,114,32,37,100,10,0,69,109,112,116,121,32,83,79,84,32,109,97,114,107,101,114,32,100,101,116,101,99,116,101,100,58,32,80,115,111,116,61,37,100,46,10,0,80,115,111,116,32,118,97,108,117,101,32,105,115,32,110,111,116,32,99,111,114,114,101,99,116,32,114,101,103,97,114,100,115,32,116,111,32,116,104,101,32,74,80,69,71,50,48,48,48,32,110,111,114,109,58,32,37,100,46,10,0,80,115,111,116,32,118,97,108,117,101,32,111,102,32,116,104,101,32,99,117,114,114,101,110,116,32,116,105,108,101,45,112,97,114,116,32,105,115,32,101,113,117,97,108,32,116,111,32,122,101,114,111,44,32,119,101,32,97,115,115,117,109,105,110,103,32,105,116,32,105,115,32,116,104,101,32,108,97,115,116,32,116,105,108,101,45,112,97,114,116,32,111,102,32,116,104,101,32,99,111,100,101,115,116,114,101,97,109,46,10,0,73,110,32,83,79,84,32,109,97,114,107,101,114,44,32,84,80,83,111,116,32,40,37,100,41,32,105,115,32,110,111,116,32,118,97,108,105,100,32,114,101,103,97,114,100,115,32,116,111,32,116,104,101,32,99,117,114,114,101,110,116,32,110,117,109,98,101,114,32,111,102,32,116,105,108,101,45,112,97,114,116,32,40,37,100,41,44,32,103,105,118,105,110,103,32,117,112,10,0,73,110,32,83,79,84,32,109,97,114,107,101,114,44,32,84,80,83,111,116,32,40,37,100,41,32,105,115,32,110,111,116,32,118,97,108,105,100,32,114,101,103,97,114,100,115,32,116,111,32,116,104,101,32,99,117,114,114,101,110,116,32,110,117,109,98,101,114,32,111,102,32,116,105,108,101,45,112,97,114,116,32,40,104,101,97,100,101,114,41,32,40,37,100,41,44,32,103,105,118,105,110,103,32,117,112,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,114,101,97,100,32,83,79,84,32,109,97,114,107,101,114,46,32,84,105,108,101,32,105,110,100,101,120,32,97,108,108,111,99,97,116,105,111,110,32,102,97,105,108,101,100,10,0,83,116,97,114,116,32,116,111,32,114,101,97,100,32,106,50,107,32,109,97,105,110,32,104,101,97,100,101,114,32,40,37,100,41,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,100,100,32,109,104,32,109,97,114,107,101,114,10,0,69,120,112,101,99,116,101,100,32,97,32,83,79,67,32,109,97,114,107,101,114,32,10,0,65,32,109,97,114,107,101,114,32,73,68,32,119,97,115,32,101,120,112,101,99,116,101,100,32,40,48,120,102,102,45,45,41,32,105,110,115,116,101,97,100,32,111,102,32,37,46,56,120,10,0,85,110,107,110,111,119,110,32,109,97,114,107,101,114,10,0,85,110,107,110,111,119,32,109,97,114,107,101,114,32,104,97,118,101,32,98,101,101,110,32,100,101,116,101,99,116,101,100,32,97,110,100,32,103,101,110,101,114,97,116,101,100,32,101,114,114,111,114,46,10,0,77,97,114,107,101,114,32,104,97,110,100,108,101,114,32,102,117,110,99,116,105,111,110,32,102,97,105,108,101,100,32,116,111,32,114,101,97,100,32,116,104,101,32,109,97,114,107,101,114,32,115,101,103,109,101,110,116,10,0,114,101,113,117,105,114,101,100,32,83,73,90,32,109,97,114,107,101,114,32,110,111,116,32,102,111,117,110,100,32,105,110,32,109,97,105,110,32,104,101,97,100,101,114,10,0,114,101,113,117,105,114,101,100,32,67,79,68,32,109,97,114,107,101,114,32,110,111,116,32,102,111,117,110,100,32,105,110,32,109,97,105,110,32,104,101,97,100,101,114,10,0,114,101,113,117,105,114,101,100,32,81,67,68,32,109,97,114,107,101,114,32,110,111,116,32,102,111,117,110,100,32,105,110,32,109,97,105,110,32,104,101,97,100,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,98,121,116,101,115,32,116,111,32,114,101,97,100,32,78,112,112,109,10,0,67,111,114,114,117,112,116,101,100,32,80,80,77,32,109,97,114,107,101,114,115,10,0,70,97,105,108,101,100,32,116,111,32,109,101,114,103,101,32,80,80,77,32,100,97,116,97,10,0,77,97,105,110,32,104,101,97,100,101,114,32,104,97,115,32,98,101,101,110,32,99,111,114,114,101,99,116,108,121,32,100,101,99,111,100,101,100,46,10,0,70,97,105,108,101,100,32,116,111,32,100,101,99,111,100,101,32,116,104,101,32,99,111,100,101,115,116,114,101,97,109,32,105,110,32,116,104,101,32,74,80,50,32,102,105,108,101,10,0,73,110,118,97,108,105,100,32,110,117,109,98,101,114,32,111,102,32,99,111,109,112,111,110,101,110,116,115,32,115,112,101,99,105,102,105,101,100,32,119,104,105,108,101,32,115,101,116,116,105,110,103,32,117,112,32,74,80,50,32,101,110,99,111,100,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,119,104,101,110,32,115,101,116,117,112,32,116,104,101,32,74,80,50,32,101,110,99,111,100,101,114,10,0,65,108,112,104,97,32,99,104,97,110,110,101,108,32,115,112,101,99,105,102,105,101,100,32,98,117,116,32,117,110,107,110,111,119,110,32,101,110,117,109,99,115,46,32,78,111,32,99,100,101,102,32,98,111,120,32,119,105,108,108,32,98,101,32,99,114,101,97,116,101,100,46,10,0,65,108,112,104,97,32,99,104,97,110,110,101,108,32,115,112,101,99,105,102,105,101,100,32,98,117,116,32,110,111,116,32,101,110,111,117,103,104,32,105,109,97,103,101,32,99,111,109,112,111,110,101,110,116,115,32,102,111,114,32,97,110,32,97,117,116,111,109,97,116,105,99,32,99,100,101,102,32,98,111,120,32,99,114,101,97,116,105,111,110,46,10,0,65,108,112,104,97,32,99,104,97,110,110,101,108,32,112,111,115,105,116,105,111,110,32,99,111,110,102,108,105,99,116,115,32,119,105,116,104,32,99,111,108,111,114,32,99,104,97,110,110,101,108,46,32,78,111,32,99,100,101,102,32,98,111,120,32,119,105,108,108,32,98,101,32,99,114,101,97,116,101,100,46,10,0,77,117,108,116,105,112,108,101,32,97,108,112,104,97,32,99,104,97,110,110,101,108,115,32,115,112,101,99,105,102,105,101,100,46,32,78,111,32,99,100,101,102,32,98,111,120,32,119,105,108,108,32,98,101,32,99,114,101,97,116,101,100,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,115,101,116,117,112,32,116,104,101,32,74,80,50,32,101,110,99,111,100,101,114,10,0,74,80,50,32,98,111,120,32,119,104,105,99,104,32,97,114,101,32,97,102,116,101,114,32,116,104,101,32,99,111,100,101,115,116,114,101,97,109,32,119,105,108,108,32,110,111,116,32,98,101,32,114,101,97,100,32,98,121,32,116,104,105,115,32,102,117,110,99,116,105,111,110,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,104,111,108,100,32,74,80,50,32,72,101,97,100,101,114,32,100,97,116,97,10,0,83,116,114,101,97,109,32,101,114,114,111,114,32,119,104,105,108,101,32,119,114,105,116,105,110,103,32,74,80,50,32,72,101,97,100,101,114,32,98,111,120,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,104,97,110,100,108,101,32,102,116,121,112,32,100,97,116,97,10,0,69,114,114,111,114,32,119,104,105,108,101,32,119,114,105,116,105,110,103,32,102,116,121,112,32,100,97,116,97,32,116,111,32,115,116,114,101,97,109,10,0,70,97,105,108,101,100,32,116,111,32,115,101,101,107,32,105,110,32,116,104,101,32,115,116,114,101,97,109,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,104,97,110,100,108,101,32,106,112,101,103,50,48,48,48,32,102,105,108,101,32,104,101,97,100,101,114,10,0,67,97,110,110,111,116,32,104,97,110,100,108,101,32,98,111,120,32,115,105,122,101,115,32,104,105,103,104,101,114,32,116,104,97,110,32,50,94,51,50,10,0,98,97,100,32,112,108,97,99,101,100,32,106,112,101,103,32,99,111,100,101,115,116,114,101,97,109,10,0,67,97,110,110,111,116,32,104,97,110,100,108,101,32,98,111,120,32,111,102,32,117,110,100,101,102,105,110,101,100,32,115,105,122,101,115,10,0,105,110,118,97,108,105,100,32,98,111,120,32,115,105,122,101,32,37,100,32,40,37,120,41,10,0,70,111,117,110,100,32,97,32,109,105,115,112,108,97,99,101,100,32,39,37,99,37,99,37,99,37,99,39,32,98,111,120,32,111,117,116,115,105,100,101,32,106,112,50,104,32,98,111,120,10,0,74,80,69,71,50,48,48,48,32,72,101,97,100,101,114,32,98,111,120,32,110,111,116,32,114,101,97,100,32,121,101,116,44,32,39,37,99,37,99,37,99,37,99,39,32,98,111,120,32,119,105,108,108,32,98,101,32,105,103,110,111,114,101,100,10,0,80,114,111,98,108,101,109,32,119,105,116,104,32,115,107,105,112,112,105,110,103,32,74,80,69,71,50,48,48,48,32,98,111,120,44,32,115,116,114,101,97,109,32,101,114,114,111,114,10,0,73,110,118,97,108,105,100,32,98,111,120,32,115,105,122,101,32,37,100,32,102,111,114,32,98,111,120,32,39,37,99,37,99,37,99,37,99,39,46,32,78,101,101,100,32,37,100,32,98,121,116,101,115,44,32,37,100,32,98,121,116,101,115,32,114,101,109,97,105,110,105,110,103,32,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,104,97,110,100,108,101,32,106,112,101,103,50,48,48,48,32,98,111,120,10,0,80,114,111,98,108,101,109,32,119,105,116,104,32,114,101,97,100,105,110,103,32,74,80,69,71,50,48,48,48,32,98,111,120,44,32,115,116,114,101,97,109,32,101,114,114,111,114,10,0,77,97,108,102,111,114,109,101,100,32,74,80,50,32,102,105,108,101,32,102,111,114,109,97,116,58,32,102,105,114,115,116,32,98,111,120,32,109,117,115,116,32,98,101,32,74,80,69,71,32,50,48,48,48,32,115,105,103,110,97,116,117,114,101,32,98,111,120,10,0,77,97,108,102,111,114,109,101,100,32,74,80,50,32,102,105,108,101,32,102,111,114,109,97,116,58,32,115,101,99,111,110,100,32,98,111,120,32,109,117,115,116,32,98,101,32,102,105,108,101,32,116,121,112,101,32,98,111,120,10,0,73,110,115,117,102,102,105,99,105,101,110,116,32,100,97,116,97,32,102,111,114,32,67,68,69,70,32,98,111,120,46,10,0,78,117,109,98,101,114,32,111,102,32,99,104,97,110,110,101,108,32,100,101,115,99,114,105,112,116,105,111,110,32,105,115,32,101,113,117,97,108,32,116,111,32,122,101,114,111,32,105,110,32,67,68,69,70,32,98,111,120,46,10,0,78,101,101,100,32,116,111,32,114,101,97,100,32,97,32,80,67,76,82,32,98,111,120,32,98,101,102,111,114,101,32,116,104,101,32,67,77,65,80,32,98,111,120,46,10,0,79,110,108,121,32,111,110,101,32,67,77,65,80,32,98,111,120,32,105,115,32,97,108,108,111,119,101,100,46,10,0,73,110,115,117,102,102,105,99,105,101,110,116,32,100,97,116,97,32,102,111,114,32,67,77,65,80,32,98,111,120,46,10,0,73,110,118,97,108,105,100,32,80,67,76,82,32,98,111,120,46,32,82,101,112,111,114,116,115,32,37,100,32,101,110,116,114,105,101,115,10,0,73,110,118,97,108,105,100,32,80,67,76,82,32,98,111,120,46,32,82,101,112,111,114,116,115,32,48,32,112,97,108,101,116,116,101,32,99,111,108,117,109,110,115,10,0,65,32,66,80,67,67,32,104,101,97,100,101,114,32,98,111,120,32,105,115,32,97,118,97,105,108,97,98,108,101,32,97,108,116,104,111,117,103,104,32,66,80,67,32,103,105,118,101,110,32,98,121,32,116,104,101,32,73,72,68,82,32,98,111,120,32,40,37,100,41,32,105,110,100,105,99,97,116,101,32,99,111,109,112,111,110,101,110,116,115,32,98,105,116,32,100,101,112,116,104,32,105,115,32,99,111,110,115,116,97,110,116,10,0,66,97,100,32,66,80,67,67,32,104,101,97,100,101,114,32,98,111,120,32,40,98,97,100,32,115,105,122,101,41,10,0,66,97,100,32,67,79,76,82,32,104,101,97,100,101,114,32,98,111,120,32,40,98,97,100,32,115,105,122,101,41,10,0,65,32,99,111,110,102,111,114,109,105,110,103,32,74,80,50,32,114,101,97,100,101,114,32,115,104,97,108,108,32,105,103,110,111,114,101,32,97,108,108,32,67,111,108,111,117,114,32,83,112,101,99,105,102,105,99,97,116,105,111,110,32,98,111,120,101,115,32,97,102,116,101,114,32,116,104,101,32,102,105,114,115,116,44,32,115,111,32,119,101,32,105,103,110,111,114,101,32,116,104,105,115,32,111,110,101,46,10,0,66,97,100,32,67,79,76,82,32,104,101,97,100,101,114,32,98,111,120,32,40,98,97,100,32,115,105,122,101,58,32,37,100,41,10,0,66,97,100,32,67,79,76,82,32,104,101,97,100,101,114,32,98,111,120,32,40,67,73,69,76,97,98,44,32,98,97,100,32,115,105,122,101,58,32,37,100,41,10,0,67,79,76,82,32,66,79,88,32,109,101,116,104,32,118,97,108,117,101,32,105,115,32,110,111,116,32,97,32,114,101,103,117,108,97,114,32,118,97,108,117,101,32,40,37,100,41,44,32,115,111,32,119,101,32,119,105,108,108,32,105,103,110,111,114,101,32,116,104,101,32,101,110,116,105,114,101,32,67,111,108,111,117,114,32,83,112,101,99,105,102,105,99,97,116,105,111,110,32,98,111,120,46,32,10,0,66,97,100,32,105,109,97,103,101,32,104,101,97,100,101,114,32,98,111,120,32,40,98,97,100,32,115,105,122,101,41,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,104,97,110,100,108,101,32,105,109,97,103,101,32,104,101,97,100,101,114,32,40,105,104,100,114,41,10,0,74,80,50,32,73,72,68,82,32,98,111,120,58,32,99,111,109,112,114,101,115,115,105,111,110,32,116,121,112,101,32,105,110,100,105,99,97,116,101,32,116,104,97,116,32,116,104,101,32,102,105,108,101,32,105,115,32,110,111,116,32,97,32,99,111,110,102,111,114,109,105,110,103,32,74,80,50,32,102,105,108,101,32,40,37,100,41,32,10,0,84,104,101,32,32,98,111,120,32,109,117,115,116,32,98,101,32,116,104,101,32,102,105,114,115,116,32,98,111,120,32,105,110,32,116,104,101,32,102,105,108,101,46,10,0,67,97,110,110,111,116,32,104,97,110,100,108,101,32,98,111,120,32,111,102,32,108,101,115,115,32,116,104,97,110,32,56,32,98,121,116,101,115,10,0,67,97,110,110,111,116,32,104,97,110,100,108,101,32,88,76,32,98,111,120,32,111,102,32,108,101,115,115,32,116,104,97,110,32,49,54,32,98,121,116,101,115,10,0,66,111,120,32,108,101,110,103,116,104,32,105,115,32,105,110,99,111,110,115,105,115,116,101,110,116,46,10,0,83,116,114,101,97,109,32,101,114,114,111,114,32,119,104,105,108,101,32,114,101,97,100,105,110,103,32,74,80,50,32,72,101,97,100,101,114,32,98,111,120,10,0,83,116,114,101,97,109,32,101,114,114,111,114,32,119,104,105,108,101,32,114,101,97,100,105,110,103,32,74,80,50,32,72,101,97,100,101,114,32,98,111,120,58,32,98,111,120,32,108,101,110,103,116,104,32,105,115,32,105,110,99,111,110,115,105,115,116,101,110,116,46,10,0,83,116,114,101,97,109,32,101,114,114,111,114,32,119,104,105,108,101,32,114,101,97,100,105,110,103,32,74,80,50,32,72,101,97,100,101,114,32,98,111,120,58,32,110,111,32,39,105,104,100,114,39,32,98,111,120,46,10,0,84,104,101,32,102,116,121,112,32,98,111,120,32,109,117,115,116,32,98,101,32,116,104,101,32,115,101,99,111,110,100,32,98,111,120,32,105,110,32,116,104,101,32,102,105,108,101,46,10,0,69,114,114,111,114,32,119,105,116,104,32,70,84,89,80,32,115,105,103,110,97,116,117,114,101,32,66,111,120,32,115,105,122,101,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,119,105,116,104,32,70,84,89,80,32,66,111,120,10,0,84,104,101,32,115,105,103,110,97,116,117,114,101,32,98,111,120,32,109,117,115,116,32,98,101,32,116,104,101,32,102,105,114,115,116,32,98,111,120,32,105,110,32,116,104,101,32,102,105,108,101,46,10,0,69,114,114,111,114,32,119,105,116,104,32,74,80,32,115,105,103,110,97,116,117,114,101,32,66,111,120,32,115,105,122,101,10,0,69,114,114,111,114,32,119,105,116,104,32,74,80,32,83,105,103,110,97,116,117,114,101,32,58,32,98,97,100,32,109,97,103,105,99,32,110,117,109,98,101,114,10,0,111,112,106,95,106,112,50,95,97,112,112,108,121,95,99,100,101,102,58,32,99,110,61,37,100,44,32,110,117,109,99,111,109,112,115,61,37,100,10,0,111,112,106,95,106,112,50,95,97,112,112,108,121,95,99,100,101,102,58,32,97,99,110,61,37,100,44,32,110,117,109,99,111,109,112,115,61,37,100,10,0,73,110,118,97,108,105,100,32,99,111,109,112,111,110,101,110,116,32,105,110,100,101,120,32,37,100,32,40,62,61,32,37,100,41,46,10,0,73,110,99,111,109,112,108,101,116,101,32,99,104,97,110,110,101,108,32,100,101,102,105,110,105,116,105,111,110,115,46,10,0,85,110,101,120,112,101,99,116,101,100,32,79,79,77,46,10,0,73,110,118,97,108,105,100,32,99,111,109,112,111,110,101,110,116,47,112,97,108,101,116,116,101,32,105,110,100,101,120,32,102,111,114,32,100,105,114,101,99,116,32,109,97,112,112,105,110,103,32,37,100,46,10,0,67,111,109,112,111,110,101,110,116,32,37,100,32,105,115,32,109,97,112,112,101,100,32,116,119,105,99,101,46,10,0,68,105,114,101,99,116,32,117,115,101,32,97,116,32,35,37,100,32,104,111,119,101,118,101,114,32,112,99,111,108,61,37,100,46,10,0,67,111,109,112,111,110,101,110,116,32,37,100,32,100,111,101,115,110,39,116,32,104,97,118,101,32,97,32,109,97,112,112,105,110,103,46,10,0,67,111,109,112,111,110,101,110,116,32,109,97,112,112,105,110,103,32,115,101,101,109,115,32,119,114,111,110,103,46,32,84,114,121,105,110,103,32,116,111,32,99,111,114,114,101,99,116,46,10,0,84,105,108,101,115,32,100,111,110,39,116,32,97,108,108,32,104,97,118,101,32,116,104,101,32,115,97,109,101,32,100,105,109,101,110,115,105,111,110,46,32,83,107,105,112,32,116,104,101,32,77,67,84,32,115,116,101,112,46,10,0,78,117,109,98,101,114,32,111,102,32,99,111,109,112,111,110,101,110,116,115,32,40,37,100,41,32,105,115,32,105,110,99,111,110,115,105,115,116,101,110,116,32,119,105,116,104,32,97,32,77,67,84,46,32,83,107,105,112,32,116,104,101,32,77,67,84,32,115,116,101,112,46,10,0,116,105,108,101,115,32,114,101,113,117,105,114,101,32,97,116,32,108,101,97,115,116,32,111,110,101,32,114,101,115,111,108,117,116,105,111,110,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,102,111,114,32,116,105,108,101,32,100,97,116,97,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,102,111,114,32,116,105,108,101,32,114,101,115,111,108,117,116,105,111,110,115,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,104,97,110,100,108,101,32,98,97,110,100,32,112,114,101,99,105,110,116,115,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,102,111,114,32,99,117,114,114,101,110,116,32,112,114,101,99,105,110,99,116,32,99,111,100,101,98,108,111,99,107,32,101,108,101,109,101,110,116,10,0,78,111,32,105,110,99,108,116,114,101,101,32,99,114,101,97,116,101,100,46,10,0,78,111,32,105,109,115,98,116,114,101,101,32,99,114,101,97,116,101,100,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,99,114,101,97,116,101,32,84,97,103,45,116,114,101,101,10,0,116,103,116,95,99,114,101,97,116,101,32,116,114,101,101,45,62,110,117,109,110,111,100,101,115,32,61,61,32,48,44,32,110,111,32,116,114,101,101,32,99,114,101,97,116,101,100,46,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,99,114,101,97,116,101,32,84,97,103,45,116,114,101,101,32,110,111,100,101,115,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,114,101,105,110,105,116,105,97,108,105,122,101,32,116,104,101,32,116,97,103,32,116,114,101,101,10,0,78,111,116,32,101,110,111,117,103,104,32,109,101,109,111,114,121,32,116,111,32,97,100,100,32,97,32,110,101,119,32,118,97,108,105,100,97,116,105,111,110,32,112,114,111,99,101,100,117,114,101,10,0,0,1,1,2,1,2,2,2,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240);allocate([7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,1,1,2,1,2,2,2,1,2,2,2,2,2,2,2,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,1,1,2,1,2,2,2,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,3,3,6,3,6,6,8,3,6,6,8,6,8,8,8,1,4,4,7,4,7,7,8,4,7,7,8,7,8,8,8,1,4,4,7,4,7,7,8,4,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,1,4,4,7,4,7,7,8,4,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,1,4,4,7,4,7,7,8,4,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,2,5,5,7,5,7,7,8,5,7,7,8,7,8,8,8,9,10,12,13,10,10,13,13,12,13,12,13,13,13,13,13,9,10,12,11,10,9,13,12,12,11,12,11,13,12,13,12,9,10,12,11,10,10,11,11,12,13,9,10,13,13,10,10,9,10,12,13,10,9,11,12,12,11,9,10,13,12,10,9,9,10,12,13,10,9,11,12,12,13,12,13,11,12,11,12,9,10,12,11,10,10,11,11,12,11,12,11,11,11,11,11,9,10,12,11,10,9,13,12,12,13,9,10,11,12,10,9,9,10,12,13,10,10,13,13,12,11,9,10,11,11,10,10,9,10,12,13,10,10,13,13,12,11,9,10,11,11,10,10,9,10,12,11,10,9,13,12,12,13,9,10,11,12,10,9,9,10,12,11,10,10,11,11,12,11,12,11,11,11,11,11,9,10,12,13,10,9,11,12,12,13,12,13,11,12,11,12,9,10,12,13,10,9,11,12,12,11,9,10,13,12,10,9,9,10,12,11,10,10,11,11,12,13,9,10,13,13,10,10,9,10,12,11,10,9,13,12,12,11,12,11,13,12,13,12,9,10,12,13,10,10,13,13,12,13,12,13,13,13,13,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,114,101,97,100,58,32,115,101,103,109,101,110,116,32,116,111,111,32,108,111,110,103,32,40,37,100,41,32,119,105,116,104,32,109,97,120,32,40,37,100,41,32,102,111,114,32,99,111,100,101,98,108,111,99,107,32,37,100,32,40,112,61,37,100,44,32,98,61,37,100,44,32,114,61,37,100,44,32,99,61,37,100,41,10,0,114,101,97,100,58,32,115,101,103,109,101,110,116,32,116,111,111,32,108,111,110,103,32,40,37,100,41,32,119,105,116,104,32,99,117,114,114,101,110,116,32,115,105,122,101,32,40,37,100,32,62,32,37,100,41,32,102,111,114,32,99,111,100,101,98,108,111,99,107,32,37,100,32,40,112,61,37,100,44,32,98,61,37,100,44,32,114,61,37,100,44,32,99,61,37,100,41,10,0,115,107,105,112,58,32,115,101,103,109,101,110,116,32,116,111,111,32,108,111,110,103,32,40,37,100,41,32,119,105,116,104,32,109,97,120,32,40,37,100,41,32,102,111,114,32,99,111,100,101,98,108,111,99,107,32,37,100,32,40,112,61,37,100,44,32,98,61,37,100,44,32,114,61,37,100,44,32,99,61,37,100,41,10,0,78,111,116,32,101,110,111,117,103,104,32,115,112,97,99,101,32,102,111,114,32,101,120,112,101,99,116,101,100,32,83,79,80,32,109,97,114,107,101,114,10,0,69,120,112,101,99,116,101,100,32,83,79,80,32,109,97,114,107,101,114,10,0,78,111,116,32,101,110,111,117,103,104,32,115,112,97,99,101,32,102,111,114,32,101,120,112,101,99,116,101,100,32,69,80,72,32,109,97,114,107,101,114,10,0,69,120,112,101,99,116,101,100,32,69,80,72,32,109,97,114,107,101,114,10,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,114,119,97],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480);allocate([17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+25118);var tempDoublePtr=Runtime.alignMemory(allocate(12,"i8",ALLOC_STATIC),8);assert(tempDoublePtr%8==0);function copyTempFloat(ptr){HEAP8[tempDoublePtr]=HEAP8[ptr];HEAP8[tempDoublePtr+1]=HEAP8[ptr+1];HEAP8[tempDoublePtr+2]=HEAP8[ptr+2];HEAP8[tempDoublePtr+3]=HEAP8[ptr+3]}function copyTempDouble(ptr){HEAP8[tempDoublePtr]=HEAP8[ptr];HEAP8[tempDoublePtr+1]=HEAP8[ptr+1];HEAP8[tempDoublePtr+2]=HEAP8[ptr+2];HEAP8[tempDoublePtr+3]=HEAP8[ptr+3];HEAP8[tempDoublePtr+4]=HEAP8[ptr+4];HEAP8[tempDoublePtr+5]=HEAP8[ptr+5];HEAP8[tempDoublePtr+6]=HEAP8[ptr+6];HEAP8[tempDoublePtr+7]=HEAP8[ptr+7]}Module["_i64Subtract"]=_i64Subtract;var _floorf=Math_floor;Module["_bitshift64Ashr"]=_bitshift64Ashr;var _SItoF=true;Module["_memset"]=_memset;var _BDtoILow=true;var _ceilf=Math_ceil;Module["_bitshift64Shl"]=_bitshift64Shl;function _abort(){Module["abort"]()}function ___lock(){}function ___unlock(){}Module["_i64Add"]=_i64Add;var _floor=Math_floor;var _sqrt=Math_sqrt;var PATH=undefined;function _emscripten_set_main_loop_timing(mode,value){Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){setTimeout(Browser.mainLoop.runner,value)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(!window["setImmediate"]){var setImmediates=[];var emscriptenMainLoopMessageId="__emcc";function Browser_setImmediate_messageHandler(event){if(event.source===window&&event.data===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}}window.addEventListener("message",Browser_setImmediate_messageHandler,true);window["setImmediate"]=function Browser_emulated_setImmediate(func){setImmediates.push(func);window.postMessage(emscriptenMainLoopMessageId,"*")}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){window["setImmediate"](Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0}function _emscripten_set_main_loop(func,fps,simulateInfiniteLoop,arg,noSetTiming){Module["noExitRuntime"]=true;assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=func;Browser.mainLoop.arg=arg;var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;Browser.mainLoop.runner=function Browser_mainLoop_runner(){if(ABORT)return;if(Browser.mainLoop.queue.length>0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}console.log('main loop blocker "'+blocker.name+'" took '+(Date.now()-start)+" ms");Browser.mainLoop.updateStatus();setTimeout(Browser.mainLoop.runner,0);return}if(thisMainLoopId1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}if(Browser.mainLoop.method==="timeout"&&Module.ctx){Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!");Browser.mainLoop.method=""}Browser.mainLoop.runIter(function(){if(typeof arg!=="undefined"){Runtime.dynCall("vi",func,[arg])}else{Runtime.dynCall("v",func)}});if(thisMainLoopId0)_emscripten_set_main_loop_timing(0,1e3/fps);else _emscripten_set_main_loop_timing(1,1);Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"SimulateInfiniteLoop"}}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;_emscripten_set_main_loop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus:function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;Browser.safeSetTimeout(function(){finish(audio)},1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);var canvas=Module["canvas"];function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===canvas||document["mozPointerLockElement"]===canvas||document["webkitPointerLockElement"]===canvas||document["msPointerLockElement"]===canvas}if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||function(){};canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||function(){};canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",function(ev){if(!Browser.pointerLock&&canvas.requestPointerLock){canvas.requestPointerLock();ev.preventDefault()}},false)}}},createContext:function(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}canvas.style.backgroundColor="black"}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx==="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});Browser.init()}return ctx},destroyContext:function(canvas,useWebGL,setInModule){},fullScreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullScreen:function(lockPointer,resizeCanvas,vrDevice){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;Browser.vrDevice=vrDevice;if(typeof Browser.lockPointer==="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas==="undefined")Browser.resizeCanvas=false;if(typeof Browser.vrDevice==="undefined")Browser.vrDevice=null;var canvas=Module["canvas"];function fullScreenChange(){Browser.isFullScreen=false;var canvasContainer=canvas.parentNode;if((document["webkitFullScreenElement"]||document["webkitFullscreenElement"]||document["mozFullScreenElement"]||document["mozFullscreenElement"]||document["fullScreenElement"]||document["fullscreenElement"]||document["msFullScreenElement"]||document["msFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.cancelFullScreen=document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["webkitCancelFullScreen"]||document["msExitFullscreen"]||document["exitFullscreen"]||function(){};canvas.cancelFullScreen=canvas.cancelFullScreen.bind(document);if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullScreen=true;if(Browser.resizeCanvas)Browser.setFullScreenCanvasSize()}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas)Browser.setWindowedCanvasSize()}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullScreen);Browser.updateCanvasDimensions(canvas)}if(!Browser.fullScreenHandlersInstalled){Browser.fullScreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullScreenChange,false);document.addEventListener("mozfullscreenchange",fullScreenChange,false);document.addEventListener("webkitfullscreenchange",fullScreenChange,false);document.addEventListener("MSFullscreenChange",fullScreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullScreen=canvasContainer["requestFullScreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullScreen"]?function(){canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"])}:null);if(vrDevice){canvasContainer.requestFullScreen({vrDisplay:vrDevice})}else{canvasContainer.requestFullScreen()}},nextRAF:0,fakeRequestAnimationFrame:function(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame:function requestAnimationFrame(func){if(typeof window==="undefined"){Browser.fakeRequestAnimationFrame(func)}else{if(!window.requestAnimationFrame){window.requestAnimationFrame=window["requestAnimationFrame"]||window["mozRequestAnimationFrame"]||window["webkitRequestAnimationFrame"]||window["msRequestAnimationFrame"]||window["oRequestAnimationFrame"]||Browser.fakeRequestAnimationFrame}window.requestAnimationFrame(func)}},safeCallback:function(func){return function(){if(!ABORT)return func.apply(null,arguments)}},allowAsyncCallbacks:true,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=false},resumeAsyncCallbacks:function(){Browser.allowAsyncCallbacks=true;if(Browser.queuedAsyncCallbacks.length>0){var callbacks=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[];callbacks.forEach(function(func){func()})}},safeRequestAnimationFrame:function(func){return Browser.requestAnimationFrame(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}else{Browser.queuedAsyncCallbacks.push(func)}})},safeSetTimeout:function(func,timeout){Module["noExitRuntime"]=true;return setTimeout(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}else{Browser.queuedAsyncCallbacks.push(func)}},timeout)},safeSetInterval:function(func,timeout){Module["noExitRuntime"]=true;return setInterval(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}},timeout)},getMimetype:function(name){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia:function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)},getMovementX:function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY:function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta:function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail;break;case"mousewheel":delta=event.wheelDelta;break;case"wheel":delta=event["deltaY"];break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!=="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!=="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];if(!last)last=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}},xhrLoad:function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)},asyncLoad:function(url,onload,onerror,noRunDep){Browser.xhrLoad(url,function(arrayBuffer){assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(!noRunDep)removeRunDependency("al "+url)},function(event){if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(!noRunDep)addRunDependency("al "+url)},resizeListeners:[],updateResizeListeners:function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(function(listener){listener(canvas.width,canvas.height)})},setCanvasSize:function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];flags=flags|8388608;HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=flags}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];flags=flags&~8388608;HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=flags}Browser.updateResizeListeners()},updateCanvasDimensions:function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h>2];return ret},getStr:function(){var ret=Pointer_stringify(SYSCALLS.get());return ret},get64:function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function _sysconf(name){switch(name){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator==="object")return navigator["hardwareConcurrency"]||1;return 1}}___setErrNo(ERRNO_CODES.EINVAL);return-1}Module["_bitshift64Lshr"]=_bitshift64Lshr;var _BDtoIHigh=true;function _pthread_cleanup_push(routine,arg){__ATEXIT__.push(function(){Runtime.dynCall("vi",routine,[arg])});_pthread_cleanup_push.level=__ATEXIT__.length}function _pthread_cleanup_pop(){assert(_pthread_cleanup_push.level==__ATEXIT__.length,"cannot pop if something else added meanwhile!");__ATEXIT__.pop();_pthread_cleanup_push.level=__ATEXIT__.length}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}var _llvm_pow_f64=Math_pow;function _sbrk(bytes){var self=_sbrk;if(!self.called){DYNAMICTOP=alignMemoryPage(DYNAMICTOP);self.called=true;assert(Runtime.dynamicAlloc);self.alloc=Runtime.dynamicAlloc;Runtime.dynamicAlloc=function(){abort("cannot dynamically allocate, sbrk now has control")}}var ret=DYNAMICTOP;if(bytes!=0){var success=self.alloc(bytes);if(!success)return-1>>>0}return ret}var _BItoD=true;function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){HEAP32[ptr>>2]=ret}return ret}function _pthread_self(){return 0}function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;assert(offset_high===0);FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;if(!___syscall146.buffer)___syscall146.buffer=[];var buffer=___syscall146.buffer;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>1]=2;return 0};case 13:case 14:case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}Module["requestFullScreen"]=function Module_requestFullScreen(lockPointer,resizeCanvas,vrDevice){Browser.requestFullScreen(lockPointer,resizeCanvas,vrDevice)};Module["requestAnimationFrame"]=function Module_requestAnimationFrame(func){Browser.requestAnimationFrame(func)};Module["setCanvasSize"]=function Module_setCanvasSize(width,height,noUpdates){Browser.setCanvasSize(width,height,noUpdates)};Module["pauseMainLoop"]=function Module_pauseMainLoop(){Browser.mainLoop.pause()};Module["resumeMainLoop"]=function Module_resumeMainLoop(){Browser.mainLoop.resume()};Module["getUserMedia"]=function Module_getUserMedia(){Browser.getUserMedia()};Module["createContext"]=function Module_createContext(canvas,useWebGL,setInModule,webGLContextAttributes){return Browser.createContext(canvas,useWebGL,setInModule,webGLContextAttributes)};STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP);staticSealed=true;STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=DYNAMICTOP=Runtime.alignMemory(STACK_MAX);assert(DYNAMIC_BASE>2]=d;if((c[a+8>>2]|0)==16)k=(c[a+164>>2]|0)+((c[a+200>>2]|0)*5640|0)|0;else k=c[a+12>>2]|0;g=(c[a+80>>2]|0)+16|0;h=(c[g>>2]|0)>>>0<257?1:2;j=h+1|0;if(j>>>0>d>>>0){Ub(e,1,14585,m)|0;e=0;i=m;return e|0}c[f>>2]=d-j;qb(b,l,h);d=c[l>>2]|0;if(d>>>0>=(c[g>>2]|0)>>>0){Ub(e,1,14611,m+8|0)|0;e=0;i=m;return e|0}qb(b+h|0,(c[k+5584>>2]|0)+(d*1080|0)|0,1);if(!(Fe(a,c[l>>2]|0,b+j|0,f,e)|0)){Ub(e,1,14585,m+16|0)|0;e=0;i=m;return e|0}if(!(c[f>>2]|0)){e=1;i=m;return e|0}Ub(e,1,14585,m+24|0)|0;e=0;i=m;return e|0}function ge(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;j=k+8|0;f=k+20|0;h=c[(c[a+80>>2]|0)+16>>2]|0;g=h>>>0<257?1:2;if((g+2|0)!=(d|0)){Ub(e,1,14502,k)|0;j=0;i=k;return j|0}if((c[a+8>>2]|0)==16)a=(c[a+164>>2]|0)+((c[a+200>>2]|0)*5640|0)|0;else a=c[a+12>>2]|0;qb(b,f,g);qb(b+g|0,k+16|0,1);d=c[f>>2]|0;if(d>>>0>>0){qb(b+(g+1)|0,(c[a+5584>>2]|0)+(d*1080|0)+808|0,1);j=1;i=k;return j|0}else{c[j>>2]=d;c[j+4>>2]=h;Ub(e,1,14528,j)|0;j=0;i=k;return j|0}return 0}function he(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;h=i;i=i+16|0;f=h+12|0;c[f>>2]=d;if(!(Ee(a,0,b,f,e)|0)){Ub(e,1,14476,h)|0;g=0;i=h;return g|0}if(c[f>>2]|0){Ub(e,1,14476,h+8|0)|0;g=0;i=h;return g|0}if((c[a+8>>2]|0)==16)f=(c[a+164>>2]|0)+((c[a+200>>2]|0)*5640|0)|0;else f=c[a+12>>2]|0;f=c[f+5584>>2]|0;d=a+80|0;if((c[(c[d>>2]|0)+16>>2]|0)>>>0<=1){g=1;i=h;return g|0}e=f+24|0;a=f+804|0;g=f+28|0;b=1;while(1){c[f+1104>>2]=c[e>>2];c[f+1884>>2]=c[a>>2];Ui(f+1108|0,g|0,776)|0;b=b+1|0;if(b>>>0>=(c[(c[d>>2]|0)+16>>2]|0)>>>0){f=1;break}else f=f+1080|0}i=h;return f|0}function ie(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+48|0;n=o+32|0;m=o+24|0;l=o+16|0;g=o+8|0;f=o;k=o+40|0;h=o+36|0;c[k>>2]=d;j=a+80|0;do{if((c[(c[j>>2]|0)+16>>2]|0)>>>0<257){if(d){qb(b,h,1);g=b+1|0;b=d+-1|0;break}Ub(e,1,14129,f)|0;n=0;i=o;return n|0}else{if(d>>>0>=2){qb(b,h,2);g=b+2|0;b=d+-2|0;break}Ub(e,1,14129,g)|0;n=0;i=o;return n|0}}while(0);c[k>>2]=b;f=c[h>>2]|0;b=c[(c[j>>2]|0)+16>>2]|0;if(f>>>0>=b>>>0){c[l>>2]=f;c[l+4>>2]=b;Ub(e,1,14155,l)|0;n=0;i=o;return n|0}if(!(Ee(a,f,g,k,e)|0)){Ub(e,1,14129,m)|0;n=0;i=o;return n|0}if(!(c[k>>2]|0)){n=1;i=o;return n|0}Ub(e,1,14129,n)|0;n=0;i=o;return n|0}function je(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;t=i;i=i+16|0;h=t+8|0;s=t+12|0;r=c[(c[b+80>>2]|0)+16>>2]|0;q=r>>>0<257?1:2;p=(q<<1)+5|0;g=(e>>>0)/(p>>>0)|0;if((g|0)==0|((e>>>0)%(p>>>0)|0|0)!=0){Ub(f,1,14085,t)|0;s=0;i=t;return s|0}if((c[b+8>>2]|0)==16)p=(c[b+164>>2]|0)+((c[b+200>>2]|0)*5640|0)|0;else p=c[b+12>>2]|0;e=p+5636|0;b=a[e>>0]|0;if(!(b&4))o=0;else o=(c[p+420>>2]|0)+1|0;n=o+g|0;if(n>>>0>31){c[h>>2]=n;Ub(f,1,14111,h)|0;s=0;i=t;return s|0}a[e>>0]=b|4;if(o>>>0>>0){f=q+1|0;m=p+8|0;h=q+3|0;j=q|4;k=j+q|0;l=k+1|0;b=d;g=o;e=p+424+(o*148|0)|0;while(1){qb(b,e,1);qb(b+1|0,e+4|0,q);d=e+8|0;qb(b+f|0,d,2);u=c[d>>2]|0;o=c[m>>2]|0;c[d>>2]=u>>>0>>0?u:o;qb(b+h|0,e+12|0,1);d=e+16|0;qb(b+j|0,d,q);qb(b+k|0,s,1);c[e+36>>2]=c[s>>2];o=c[d>>2]|0;c[d>>2]=o>>>0>>0?o:r;g=g+1|0;if(g>>>0>=n>>>0)break;else{b=b+l|0;e=e+148|0}}}c[p+420>>2]=n+-1;u=1;i=t;return u|0}function ke(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;M=i;i=i+144|0;L=M+128|0;H=M+120|0;G=M+112|0;F=M+104|0;E=M+96|0;D=M+88|0;A=M+72|0;t=M+64|0;r=M+56|0;q=M+48|0;p=M+40|0;s=M+32|0;l=M+24|0;j=M+16|0;h=M+136|0;w=M+132|0;J=c[d+80>>2]|0;K=d+88|0;if(f>>>0<36){Ub(g,1,13440,M)|0;g=0;i=M;return g|0}I=f+-36|0;o=(I>>>0)/3|0;if((I>>>0)%3|0){Ub(g,1,13440,M+8|0)|0;g=0;i=M;return g|0}qb(e,h,2);b[K>>1]=c[h>>2];x=J+8|0;qb(e+2|0,x,4);B=J+12|0;qb(e+6|0,B,4);qb(e+10|0,J,4);n=J+4|0;qb(e+14|0,n,4);v=d+100|0;qb(e+18|0,v,4);z=d+104|0;qb(e+22|0,z,4);u=d+92|0;qb(e+26|0,u,4);y=d+96|0;qb(e+30|0,y,4);qb(e+34|0,h,2);k=e+36|0;f=c[h>>2]|0;if(f>>>0>=16385){c[j>>2]=f;Ub(g,1,13468,j)|0;g=0;i=M;return g|0}f=f&65535;I=J+16|0;c[I>>2]=f;if((f|0)!=(o|0)){c[l>>2]=f;c[l+4>>2]=o;Ub(g,1,13529,l)|0;g=0;i=M;return g|0}l=c[J>>2]|0;m=c[x>>2]|0;if(m>>>0>l>>>0){f=c[n>>2]|0;e=c[B>>2]|0;if(f>>>0>>0){h=c[v>>2]|0;j=c[z>>2]|0;if(!(_(j,h)|0)){c[p>>2]=h;c[p+4>>2]=j;Ub(g,1,13705,p)|0;g=0;i=M;return g|0}s=Zi(e|0,0,m|0,0)|0;if(!((s|0)==(_(e,m)|0)&(C|0)==0)){c[q>>2]=m;c[q+4>>2]=e;Ub(g,1,13766,q)|0;g=0;i=M;return g|0}m=c[u>>2]|0;p=Si(m|0,0,h|0,0)|0;q=C;n=c[y>>2]|0;s=Si(n|0,0,j|0,0)|0;if(m>>>0<=l>>>0?n>>>0<=f>>>0&(p|0-q)>>>0>l>>>0&(s|0-C)>>>0>f>>>0:0){e=Qc(o,52)|0;o=J+24|0;c[o>>2]=e;if(!e){c[I>>2]=0;Ub(g,1,13852,t)|0;g=0;i=M;return g|0}a:do{if(c[I>>2]|0){l=d+168|0;f=0;j=e;while(1){qb(k,w,1);c[j+24>>2]=(c[w>>2]&127)+1;c[j+32>>2]=(c[w>>2]|0)>>>7;qb(k+1|0,w,1);c[j>>2]=c[w>>2];qb(k+2|0,w,1);h=c[w>>2]|0;c[j+4>>2]=h;e=c[j>>2]|0;if((h+-1|0)>>>0>254|(e+-1|0)>>>0>254)break;c[j+36>>2]=0;c[j+40>>2]=c[l>>2];f=f+1|0;if(f>>>0>=(c[I>>2]|0)>>>0)break a;else{k=k+3|0;j=j+52|0}}c[A>>2]=f;c[A+4>>2]=e;c[A+8>>2]=h;Ub(g,1,13900,A)|0;g=0;i=M;return g|0}}while(0);m=c[u>>2]|0;l=c[v>>2]|0;k=((c[x>>2]|0)+-1-m+l|0)/(l|0)|0;c[d+112>>2]=k;j=c[y>>2]|0;h=c[z>>2]|0;e=((c[B>>2]|0)+-1-j+h|0)/(h|0)|0;c[d+116>>2]=e;if(!((e|0)==0|(k|0)==0)?k>>>0<=(65535/(e>>>0)|0)>>>0:0){n=_(k,e)|0;f=d+28|0;if(!(a[d+76>>0]&2)){c[f>>2]=0;c[d+32>>2]=0;c[d+36>>2]=k;c[d+40>>2]=e}else{c[f>>2]=(((c[f>>2]|0)-m|0)>>>0)/(l>>>0)|0;D=d+32|0;c[D>>2]=(((c[D>>2]|0)-j|0)>>>0)/(h>>>0)|0;D=d+36|0;c[D>>2]=((c[D>>2]|0)+-1-m+l|0)/(l|0)|0;D=d+40|0;c[D>>2]=((c[D>>2]|0)+-1-j+h|0)/(h|0)|0}D=Qc(n,5640)|0;k=d+164|0;c[k>>2]=D;if(!D){Ub(g,1,13852,E)|0;g=0;i=M;return g|0}E=Qc(c[I>>2]|0,1080)|0;e=d+12|0;c[(c[e>>2]|0)+5584>>2]=E;if(!E){Ub(g,1,13852,F)|0;g=0;i=M;return g|0}F=Qc(10,20)|0;f=c[e>>2]|0;c[f+5612>>2]=F;if(!F){Ub(g,1,13852,G)|0;g=0;i=M;return g|0}c[f+5620>>2]=10;G=Qc(10,20)|0;f=c[e>>2]|0;c[f+5624>>2]=G;if(!G){Ub(g,1,13852,H)|0;g=0;i=M;return g|0}c[f+5632>>2]=10;j=c[I>>2]|0;if(j){h=c[o>>2]|0;f=f+5584|0;e=0;do{if(!(c[h+(e*52|0)+32>>2]|0))c[(c[f>>2]|0)+(e*1080|0)+1076>>2]=1<<(c[h+(e*52|0)+24>>2]|0)+-1;e=e+1|0}while(e>>>0>>0)}b:do{if(n){f=c[k>>2]|0;H=Qc(j,1080)|0;c[f+5584>>2]=H;if(H){e=0;while(1){e=e+1|0;if(e>>>0>=n>>>0)break b;H=Qc(c[I>>2]|0,1080)|0;c[f+11224>>2]=H;if(!H)break;else f=f+5640|0}}Ub(g,1,13852,L)|0;g=0;i=M;return g|0}}while(0);c[d+8>>2]=4;_b(J,K);g=1;i=M;return g|0}c[D>>2]=k;c[D+4>>2]=e;Ub(g,1,14002,D)|0;g=0;i=M;return g|0}Ub(g,1,13808,r)|0;g=0;i=M;return g|0}}else{e=c[B>>2]|0;f=c[n>>2]|0}c[s>>2]=m-l;c[s+4>>2]=e-f;Ub(g,1,13643,s)|0;g=0;i=M;return g|0}function le(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0;f=i;i=i+32|0;a=f+12|0;if(d>>>0<2){Ub(e,1,13414,f)|0;e=0;i=f;return e|0}qb(b,f+16|0,1);qb(b+1|0,a,1);b=c[a>>2]|0;if(!(((d+-2|0)>>>0)%(((b>>>5&2)+2+(b>>>4&3)|0)>>>0)|0)){e=1;i=f;return e|0}Ub(e,1,13414,f+8|0)|0;e=0;i=f;return e|0}function me(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;a=i;i=i+16|0;if(!c){Ub(d,1,13388,a)|0;b=0}else b=1;i=a;return b|0}function ne(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;k=i;i=i+32|0;j=k+8|0;h=k+12|0;if(!d){Ub(e,1,13362,k)|0;e=0;i=k;return e|0}qb(b,k+16|0,1);f=d+-1|0;if(!f){e=1;i=k;return e|0}else{g=0;a=0}do{b=b+1|0;qb(b,h,1);d=c[h>>2]|0;if(!(d&128))a=0;else a=(d&127|a)<<7;g=g+1|0}while((g|0)!=(f|0));if(!a){e=1;i=k;return e|0}Ub(e,1,13362,j)|0;e=0;i=k;return e|0}function oe(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+48|0;o=p+32|0;l=p+24|0;h=p+16|0;g=p+8|0;n=p+36|0;if(e>>>0<2){Ub(f,1,13276,p)|0;o=0;i=p;return o|0}m=b+184|0;a[m>>0]=a[m>>0]|1;qb(d,n,1);m=d+1|0;k=e+-1|0;j=b+124|0;e=c[j>>2]|0;do{if(e){g=b+120|0;d=c[n>>2]|0;if((c[g>>2]|0)>>>0<=d>>>0){b=d+1|0;d=Tc(e,b<<3)|0;if(d){c[j>>2]=d;e=c[g>>2]|0;Qi(d+(e<<3)|0,0,b-e<<3|0)|0;c[g>>2]=b;e=c[j>>2]|0;break}Ub(f,1,13302,h)|0;o=0;i=p;return o|0}}else{d=(c[n>>2]|0)+1|0;e=Qc(d,8)|0;c[j>>2]=e;if(e){c[b+120>>2]=d;break}Ub(f,1,13302,g)|0;o=0;i=p;return o|0}}while(0);d=c[n>>2]|0;if(c[e+(d<<3)>>2]|0){c[l>>2]=d;Ub(f,1,13340,l)|0;o=0;i=p;return o|0}l=Pc(k)|0;e=c[n>>2]|0;d=c[j>>2]|0;c[d+(e<<3)>>2]=l;if(!l){Ub(f,1,13302,o)|0;o=0;i=p;return o|0}else{c[d+(e<<3)+4>>2]=k;Ui(c[d+(c[n>>2]<<3)>>2]|0,m|0,k|0)|0;o=1;i=p;return o|0}return 0}function pe(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+48|0;q=r+40|0;o=r+32|0;k=r+24|0;j=r+16|0;p=r+44|0;if(e>>>0<2){Ub(f,1,13127,r)|0;q=0;i=r;return q|0}if(a[b+184>>0]&1){Ub(f,1,13153,r+8|0)|0;q=0;i=r;return q|0}h=c[b+200>>2]|0;g=c[b+164>>2]|0;n=g+(h*5640|0)+5636|0;a[n>>0]=a[n>>0]|2;qb(d,p,1);n=d+1|0;m=e+-1|0;l=g+(h*5640|0)+5164|0;d=c[l>>2]|0;do{if(d){g=g+(h*5640|0)+5160|0;b=c[p>>2]|0;if((c[g>>2]|0)>>>0<=b>>>0){e=b+1|0;b=Tc(d,e<<3)|0;if(b){c[l>>2]=b;d=c[g>>2]|0;Qi(b+(d<<3)|0,0,e-d<<3|0)|0;c[g>>2]=e;d=c[l>>2]|0;break}Ub(f,1,8775,k)|0;q=0;i=r;return q|0}}else{b=(c[p>>2]|0)+1|0;d=Qc(b,8)|0;c[l>>2]=d;if(d){c[g+(h*5640|0)+5160>>2]=b;break}Ub(f,1,8775,j)|0;q=0;i=r;return q|0}}while(0);b=c[p>>2]|0;if(c[d+(b<<3)>>2]|0){c[o>>2]=b;Ub(f,1,13254,o)|0;q=0;i=r;return q|0}o=Pc(m)|0;d=c[p>>2]|0;b=c[l>>2]|0;c[b+(d<<3)>>2]=o;if(!o){Ub(f,1,8775,q)|0;q=0;i=r;return q|0}else{c[b+(d<<3)+4>>2]=m;Ui(c[b+(c[p>>2]<<3)>>2]|0,n|0,m|0)|0;q=1;i=r;return q|0}return 0}function qe(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;b=i;i=i+16|0;if((c[(c[a+80>>2]|0)+16>>2]<<2|0)==(d|0)){e=1;i=b;return e|0}Ub(e,1,13101,b)|0;e=0;i=b;return e|0}function re(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return 1}function se(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+48|0;r=s+40|0;q=s+32|0;l=s+24|0;p=s+44|0;if((c[a+8>>2]|0)==16)j=(c[a+164>>2]|0)+((c[a+200>>2]|0)*5640|0)|0;else j=c[a+12>>2]|0;if(d>>>0<2){Ub(e,1,12933,s)|0;r=0;i=s;return r|0}qb(b,p,2);if(c[p>>2]|0){Ub(e,2,12959,s+8|0)|0;r=1;i=s;return r|0}if(d>>>0<7){Ub(e,1,12933,s+16|0)|0;r=0;i=s;return r|0}qb(b+2|0,p,2);n=b+4|0;o=c[p>>2]&255;k=j+5612|0;f=c[k>>2]|0;m=j+5616|0;a=c[m>>2]|0;a:do{if(!a){g=0;h=f}else{g=0;h=f;do{if((c[h+8>>2]|0)==(o|0))break a;h=h+20|0;g=g+1|0}while(g>>>0>>0)}}while(0);if((g|0)==(a|0)){g=j+5620|0;do{if((a|0)==(c[g>>2]|0)){a=a+10|0;c[g>>2]=a;a=Tc(f,a*20|0)|0;if(a){c[k>>2]=a;f=c[m>>2]|0;Qi(a+(f*20|0)|0,0,((c[g>>2]|0)-f|0)*20|0)|0;f=c[k>>2]|0;a=c[m>>2]|0;break}Uc(c[k>>2]|0);c[k>>2]=0;c[g>>2]=0;c[m>>2]=0;Ub(e,1,13019,l)|0;r=0;i=s;return r|0}}while(0);c[m>>2]=a+1;h=f+(a*20|0)|0}g=h+12|0;a=c[g>>2]|0;if(a){Uc(a);c[g>>2]=0}c[h+8>>2]=o;o=c[p>>2]|0;c[h+4>>2]=o>>>8&3;c[h>>2]=o>>>10&3;qb(n,p,2);if(c[p>>2]|0){Ub(e,2,13057,q)|0;r=1;i=s;return r|0}a=d+-6|0;f=Pc(a)|0;c[g>>2]=f;if(!f){Ub(e,1,12933,r)|0;r=0;i=s;return r|0}else{Ui(f|0,b+6|0,a|0)|0;c[h+16>>2]=a;r=1;i=s;return r|0}return 0}function te(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;j=i;i=i+32|0;f=j+16|0;h=j+12|0;a=a+80|0;g=c[(c[a>>2]|0)+16>>2]|0;if((g+2|0)!=(d|0)){Ub(e,1,12907,j)|0;h=0;i=j;return h|0}qb(b,f,2);if((c[f>>2]|0)!=(g|0)){Ub(e,1,12907,j+8|0)|0;h=0;i=j;return h|0}if(!g){h=1;i=j;return h|0}f=b+2|0;b=0;a=c[(c[a>>2]|0)+24>>2]|0;while(1){qb(f,h,1);c[a+32>>2]=(c[h>>2]|0)>>>7&1;c[a+24>>2]=(c[h>>2]&127)+1;b=b+1|0;if((b|0)==(g|0)){a=1;break}else{f=f+1|0;a=a+52|0}}i=j;return a|0}function ue(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;J=i;i=i+144|0;I=J+120|0;H=J+112|0;G=J+104|0;F=J+96|0;E=J+88|0;D=J+80|0;C=J+72|0;B=J+64|0;A=J+56|0;z=J+48|0;p=J+40|0;o=J+32|0;m=J+24|0;x=J+136|0;u=J+132|0;v=J+128|0;w=J+124|0;if((c[b+8>>2]|0)==16)q=(c[b+164>>2]|0)+((c[b+200>>2]|0)*5640|0)|0;else q=c[b+12>>2]|0;if(e>>>0<2){Ub(f,1,12567,J)|0;I=0;i=J;return I|0}qb(d,x,2);if(c[x>>2]|0){Ub(f,2,12593,J+8|0)|0;I=1;i=J;return I|0}if(e>>>0<7){Ub(f,1,12567,J+16|0)|0;I=0;i=J;return I|0}qb(d+2|0,u,1);n=d+3|0;l=q+5624|0;g=c[l>>2]|0;y=q+5628|0;b=c[y>>2]|0;a:do{if(!b){j=0;h=g}else{k=c[u>>2]|0;j=0;h=g;do{if((c[h>>2]|0)==(k|0))break a;h=h+20|0;j=j+1|0}while(j>>>0>>0)}}while(0);if((j|0)==(b|0)){h=q+5632|0;do{if((b|0)==(c[h>>2]|0)){b=b+10|0;c[h>>2]=b;b=Tc(g,b*20|0)|0;if(b){c[l>>2]=b;g=c[y>>2]|0;Qi(b+(g*20|0)|0,0,((c[h>>2]|0)-g|0)*20|0)|0;g=c[l>>2]|0;b=c[y>>2]|0;break}Uc(c[l>>2]|0);c[l>>2]=0;c[h>>2]=0;c[y>>2]=0;Ub(f,1,12639,m)|0;I=0;i=J;return I|0}}while(0);h=g+(b*20|0)|0}c[h>>2]=c[u>>2];qb(n,x,2);if(c[x>>2]|0){Ub(f,2,12593,o)|0;I=1;i=J;return I|0}qb(d+5|0,v,2);g=c[v>>2]|0;if(g>>>0>1){Ub(f,2,12677,p)|0;I=1;i=J;return I|0}b=e+-7|0;b:do{if(g){r=h+4|0;s=h+16|0;t=h+8|0;e=h+12|0;p=q+5612|0;o=q+5616|0;m=d+7|0;n=0;c:while(1){if(b>>>0<3){g=27;break}qb(m,x,1);if((c[x>>2]|0)!=1){g=29;break}qb(m+1|0,w,2);g=b+-3|0;j=c[w>>2]|0;k=(j>>>15)+1|0;j=j&32767;c[r>>2]=j;h=(_(k,j)|0)+2|0;if(g>>>0>>0){g=31;break}b=m+3|0;l=g-h|0;if(j){g=0;do{qb(b,x,k);if((c[x>>2]|0)!=(g|0)){g=34;break c}b=b+k|0;g=g+1|0}while(g>>>0<(c[r>>2]|0)>>>0)}qb(b,w,2);g=b+2|0;h=c[w>>2]|0;j=(h>>>15)+1|0;h=h&32767;c[w>>2]=h;if((h|0)!=(c[r>>2]|0)){g=37;break}b=(_(j,h)|0)+3|0;if(l>>>0>>0){g=39;break}b=l-b|0;if(h){h=0;do{qb(g,x,j);if((c[x>>2]|0)!=(h|0)){g=42;break c}g=g+j|0;h=h+1|0}while(h>>>0<(c[r>>2]|0)>>>0)}qb(g,x,3);m=g+3|0;a[s>>0]=((c[x>>2]|0)>>>16^1)&1|a[s>>0]&-2;c[t>>2]=0;c[e>>2]=0;l=c[x>>2]|0;h=l&255;c[u>>2]=h;if(h){j=c[o>>2]|0;if(!j){g=50;break}k=0;g=c[p>>2]|0;while(1){if((c[g+8>>2]|0)==(h|0))break;k=k+1|0;if(k>>>0>=j>>>0){g=50;break c}else g=g+20|0}c[t>>2]=g}h=l>>>8&255;c[u>>2]=h;if(h){j=c[o>>2]|0;if(!j){g=57;break}k=0;g=c[p>>2]|0;while(1){if((c[g+8>>2]|0)==(h|0))break;k=k+1|0;if(k>>>0>=j>>>0){g=57;break c}else g=g+20|0}c[e>>2]=g}n=n+1|0;if(n>>>0>=(c[v>>2]|0)>>>0)break b}if((g|0)==27){Ub(f,1,12567,z)|0;I=0;i=J;return I|0}else if((g|0)==29){Ub(f,2,12721,A)|0;I=1;i=J;return I|0}else if((g|0)==31){Ub(f,1,12567,B)|0;I=0;i=J;return I|0}else if((g|0)==34){Ub(f,2,12787,C)|0;I=1;i=J;return I|0}else if((g|0)==37){Ub(f,2,12841,D)|0;I=1;i=J;return I|0}else if((g|0)==39){Ub(f,1,12567,E)|0;I=0;i=J;return I|0}else if((g|0)==42){Ub(f,2,12787,F)|0;I=1;i=J;return I|0}else if((g|0)==50){Ub(f,1,12567,G)|0;I=0;i=J;return I|0}else if((g|0)==57){Ub(f,1,12567,H)|0;I=0;i=J;return I|0}}}while(0);if(!b){c[y>>2]=(c[y>>2]|0)+1;I=1;i=J;return I|0}else{Ub(f,1,12567,I)|0;I=0;i=J;return I|0}return 0}function ve(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+32|0;r=s+24|0;q=s+20|0;n=a+80|0;f=c[n>>2]|0;if((c[a+8>>2]|0)==16)g=(c[a+164>>2]|0)+((c[a+200>>2]|0)*5640|0)|0;else g=c[a+12>>2]|0;if(!d){Ub(e,1,12486,s)|0;r=0;i=s;return r|0}qb(b,q,1);a=c[q>>2]|0;if(a>>>0>1){Ub(e,2,12512,s+8|0)|0;r=1;i=s;return r|0}if((a+1|0)!=(d|0)){Ub(e,2,12486,s+16|0)|0;r=0;i=s;return r|0}m=g+5584|0;a=c[f+16>>2]|0;if(a){d=0;e=c[m>>2]|0;while(1){c[e+1076>>2]=0;d=d+1|0;if(d>>>0>=a>>>0)break;else e=e+1080|0}}l=g+5604|0;a=c[l>>2]|0;if(a){Uc(a);c[l>>2]=0}if(!(c[q>>2]|0)){r=1;i=s;return r|0}k=g+5624|0;h=g+5628|0;j=0;while(1){b=b+1|0;qb(b,r,1);a=c[n>>2]|0;f=c[k>>2]|0;g=c[h>>2]|0;if(((g|0)!=0?!((g|0)==0?1:(c[f>>2]|0)!=(c[r>>2]|0)):0)?(o=c[f+4>>2]|0,p=a+16|0,(o|0)==(c[p>>2]|0)):0){a=c[f+8>>2]|0;if(a){d=_(o,o)|0;g=_(c[1036+(c[a>>2]<<2)>>2]|0,d)|0;if((c[a+16>>2]|0)!=(g|0)){a=0;d=32;break}e=Pc(d<<2)|0;c[l>>2]=e;if(!e){a=0;d=32;break}Xa[c[1052+(c[a>>2]<<2)>>2]&15](c[a+12>>2]|0,e,d)}a=c[f+12>>2]|0;if(a){d=c[p>>2]|0;g=_(d,c[1036+(c[a>>2]<<2)>>2]|0)|0;if((c[a+16>>2]|0)!=(g|0)){a=0;d=32;break}g=Pc(d<<2)|0;if(!g){a=0;d=32;break}Xa[c[1068+(c[a>>2]<<2)>>2]&15](c[a+12>>2]|0,g,d);a=c[p>>2]|0;if(a){d=0;e=g;f=c[m>>2]|0;while(1){c[f+1076>>2]=c[e>>2];d=d+1|0;if((d|0)==(a|0))break;else{e=e+4|0;f=f+1080|0}}}Uc(g)}}j=j+1|0;if(j>>>0>=(c[q>>2]|0)>>>0){a=1;d=32;break}}if((d|0)==32){i=s;return a|0}return 0}function we(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=i;i=i+16|0;f=g;if(!d){i=g;return}e=0;while(1){qb(a,f,2);c[b>>2]=c[f>>2];e=e+1|0;if((e|0)==(d|0))break;else{b=b+4|0;a=a+2|0}}i=g;return}function xe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=i;i=i+16|0;f=g;if(!d){i=g;return}e=0;while(1){qb(a,f,4);c[b>>2]=c[f>>2];e=e+1|0;if((e|0)==(d|0))break;else{b=b+4|0;a=a+4|0}}i=g;return}function ye(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0;h=i;i=i+16|0;f=h;if(!d){i=h;return}e=0;while(1){ub(a,f);c[b>>2]=~~+g[f>>2];e=e+1|0;if((e|0)==(d|0))break;else{b=b+4|0;a=a+4|0}}i=h;return}function ze(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=i;i=i+16|0;f=g;if(!d){i=g;return}e=0;while(1){sb(a,f);c[b>>2]=~~+h[f>>3];e=e+1|0;if((e|0)==(d|0))break;else{b=b+4|0;a=a+8|0}}i=g;return}function Ae(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0;h=i;i=i+16|0;f=h;if(!d){i=h;return}e=0;while(1){qb(a,f,2);g[b>>2]=+((c[f>>2]|0)>>>0);e=e+1|0;if((e|0)==(d|0))break;else{b=b+4|0;a=a+2|0}}i=h;return}function Be(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0;h=i;i=i+16|0;f=h;if(!d){i=h;return}e=0;while(1){qb(a,f,4);g[b>>2]=+((c[f>>2]|0)>>>0);e=e+1|0;if((e|0)==(d|0))break;else{b=b+4|0;a=a+4|0}}i=h;return}function Ce(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=i;i=i+16|0;f=g;if(!d){i=g;return}e=0;while(1){ub(a,f);c[b>>2]=c[f>>2];e=e+1|0;if((e|0)==(d|0))break;else{b=b+4|0;a=a+4|0}}i=g;return}function De(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;f=i;i=i+16|0;e=f;if(!c){i=f;return}d=0;while(1){sb(a,e);g[b>>2]=+h[e>>3];d=d+1|0;if((d|0)==(c|0))break;else{b=b+4|0;a=a+8|0}}i=f;return}function Ee(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+32|0;h=n+8|0;k=n+20|0;if((c[a+8>>2]|0)==16)a=(c[a+164>>2]|0)+((c[a+200>>2]|0)*5640|0)|0;else a=c[a+12>>2]|0;m=c[a+5584>>2]|0;a=c[e>>2]|0;if(!a){Ub(f,1,14224,n)|0;b=0;i=n;return b|0}c[e>>2]=a+-1;qb(d,k,1);d=d+1|0;g=c[k>>2]&31;j=m+(b*1080|0)+24|0;c[j>>2]=g;c[m+(b*1080|0)+804>>2]=(c[k>>2]|0)>>>5;do{if((g|0)==1){a=1;l=8}else{a=(c[e>>2]|0)>>>((g|0)!=0&1);if(a>>>0>97){c[h>>2]=a;c[h+4>>2]=97;c[h+8>>2]=97;Ub(f,2,14260,h)|0;g=c[j>>2]|0}f=(a|0)==0;if(g)if(f){a=0;l=20;break}else{l=8;break}if(!f){g=0;while(1){qb(d,k,1);if(g>>>0<97){c[m+(b*1080|0)+28+(g<<3)>>2]=(c[k>>2]|0)>>>3;c[m+(b*1080|0)+28+(g<<3)+4>>2]=0}g=g+1|0;if((g|0)==(a|0))break;else d=d+1|0}}a=(c[e>>2]|0)-a|0}}while(0);if((l|0)==8){g=0;while(1){qb(d,k,2);if(g>>>0<97){c[m+(b*1080|0)+28+(g<<3)>>2]=(c[k>>2]|0)>>>11;c[m+(b*1080|0)+28+(g<<3)+4>>2]=c[k>>2]&2047}g=g+1|0;if((g|0)==(a|0)){l=20;break}else d=d+2|0}}if((l|0)==20)a=(c[e>>2]|0)-(a<<1)|0;c[e>>2]=a;if((c[j>>2]|0)!=1){b=1;i=n;return b|0}a=m+(b*1080|0)+28|0;d=m+(b*1080|0)+32|0;g=1;do{e=(c[a>>2]|0)-(((g+-1|0)>>>0)/3|0)|0;c[m+(b*1080|0)+28+(g<<3)>>2]=(e|0)>0?e:0;c[m+(b*1080|0)+28+(g<<3)+4>>2]=c[d>>2];g=g+1|0}while((g|0)!=97);a=1;i=n;return a|0}function Fe(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+48|0;p=r+40|0;l=r+32|0;k=r+16|0;j=r+8|0;o=r+44|0;h=a+8|0;if((c[h>>2]|0)==16)g=(c[a+164>>2]|0)+((c[a+200>>2]|0)*5640|0)|0;else g=c[a+12>>2]|0;m=c[g+5584>>2]|0;if((c[e>>2]|0)>>>0<5){Ub(f,1,14664,r)|0;e=0;i=r;return e|0}n=m+(b*1080|0)+4|0;qb(d,n,1);g=(c[n>>2]|0)+1|0;c[n>>2]=g;if(g>>>0>33){c[j>>2]=g;c[j+4>>2]=33;Ub(f,1,14699,j)|0;e=0;i=r;return e|0}if((c[a+168>>2]|0)>>>0>=g>>>0){c[k>>2]=b;Ub(f,1,14776,k)|0;c[h>>2]=c[h>>2]|32768;e=0;i=r;return e|0}j=m+(b*1080|0)+8|0;qb(d+1|0,j,1);c[j>>2]=(c[j>>2]|0)+2;a=m+(b*1080|0)+12|0;qb(d+2|0,a,1);k=(c[a>>2]|0)+2|0;c[a>>2]=k;j=c[j>>2]|0;if(j>>>0>10|k>>>0>10|(j+k|0)>>>0>12){Ub(f,1,14934,r+24|0)|0;e=0;i=r;return e|0}qb(d+3|0,m+(b*1080|0)+16|0,1);qb(d+4|0,m+(b*1080|0)+20|0,1);h=(c[e>>2]|0)+-5|0;c[e>>2]=h;g=c[n>>2]|0;if(!(c[m+(b*1080|0)>>2]&1)){if(!g){e=1;i=r;return e|0}else g=0;do{c[m+(b*1080|0)+812+(g<<2)>>2]=15;c[m+(b*1080|0)+944+(g<<2)>>2]=15;g=g+1|0}while(g>>>0<(c[n>>2]|0)>>>0);g=1;i=r;return g|0}if(h>>>0>>0){Ub(f,1,14664,l)|0;e=0;i=r;return e|0}do{if(!g)g=0;else{a=0;h=d+5|0;while(1){qb(h,o,1);h=h+1|0;g=c[o>>2]|0;if((a|0)!=0?g>>>0<16|(g&15|0)==0:0)break;c[m+(b*1080|0)+812+(a<<2)>>2]=g&15;c[m+(b*1080|0)+944+(a<<2)>>2]=(c[o>>2]|0)>>>4;a=a+1|0;g=c[n>>2]|0;if(a>>>0>=g>>>0){q=22;break}}if((q|0)==22){h=c[e>>2]|0;break}Ub(f,1,15002,p)|0;e=0;i=r;return e|0}}while(0);c[e>>2]=h-g;e=1;i=r;return e|0}function Ge(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if(!c)return;d=0;while(1){pb(b,~~+g[a>>2]>>>0,2);d=d+1|0;if((d|0)==(c|0))break;else{b=b+2|0;a=a+4|0}}return}function He(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if(!c)return;d=0;while(1){pb(b,~~+g[a>>2]>>>0,4);d=d+1|0;if((d|0)==(c|0))break;else{b=b+4|0;a=a+4|0}}return}function Ie(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if(!c)return;d=0;while(1){tb(b,+g[a>>2]);d=d+1|0;if((d|0)==(c|0))break;else{b=b+4|0;a=a+4|0}}return}function Je(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if(!c)return;d=0;while(1){rb(b,+g[a>>2]);d=d+1|0;if((d|0)==(c|0))break;else{b=b+8|0;a=a+4|0}}return}function Ke(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;j=i;i=i+16|0;if(!d){d=0;i=j;return d|0}if(!(ld(c[a>>2]|0,b,d,e)|0)){Ub(e,1,16303,j)|0;d=0;i=j;return d|0}if(c[a+128>>2]|0){d=1;i=j;return d|0}h=a+108|0;if(!(bf(d,h,e)|0)){d=0;i=j;return d|0}b=c[a+48>>2]|0;a:do{switch(b|0){case 16:{c[d+20>>2]=1;break}case 17:{c[d+20>>2]=2;break}case 18:{c[d+20>>2]=3;break}case 24:{c[d+20>>2]=4;break}default:{f=d+20|0;if((b|0)==12){c[f>>2]=5;break a}else{c[f>>2]=-1;break a}}}}while(0);g=a+120|0;b=c[g>>2]|0;do{if(b){if(c[b+12>>2]|0){cf(d,h);break}Uc(c[b+4>>2]|0);Uc(c[(c[g>>2]|0)+8>>2]|0);Uc(c[c[g>>2]>>2]|0);b=c[g>>2]|0;f=c[b+12>>2]|0;if(f){Uc(f);b=c[g>>2]|0}Uc(b);c[g>>2]=0}}while(0);if(c[a+116>>2]|0)df(d,h,e);b=c[h>>2]|0;if(!b){d=1;i=j;return d|0}c[d+28>>2]=b;c[d+32>>2]=c[a+112>>2];c[h>>2]=0;d=1;i=j;return d|0}function Le(b,d){b=b|0;d=d|0;Wc(c[b>>2]|0,d);a[b+124>>0]=0;c[b+128>>2]=c[d+8248>>2]&1;return}function Me(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+80|0;v=w+64|0;s=w+56|0;o=w+48|0;r=w+40|0;q=w+32|0;p=w+24|0;if(!((a|0)!=0&(d|0)!=0&(e|0)!=0)){d=0;i=w;return d|0}t=e+16|0;if(((c[t>>2]|0)+-1|0)>>>0>16383){Ub(f,1,16352,w)|0;d=0;i=w;return d|0}if(!(Zc(c[a>>2]|0,d,e,f)|0)){d=0;i=w;return d|0}c[a+56>>2]=1785737760;c[a+60>>2]=0;c[a+64>>2]=1;g=Pc(4)|0;h=a+68|0;c[h>>2]=g;if(!g){c[h>>2]=0;Ub(f,1,16421,w+8|0)|0;d=0;i=w;return d|0}c[g>>2]=1785737760;l=c[t>>2]|0;c[a+20>>2]=l;l=Pc(l*12|0)|0;g=a+72|0;c[g>>2]=l;if(!l){c[g>>2]=0;Ub(f,1,16421,w+16|0)|0;d=0;i=w;return d|0}c[a+16>>2]=(c[e+12>>2]|0)-(c[e+4>>2]|0);c[a+12>>2]=(c[e+8>>2]|0)-(c[e>>2]|0);u=e+24|0;m=c[u>>2]|0;j=c[m+24>>2]|0;k=c[m+32>>2]|0;g=a+24|0;c[g>>2]=j+-1+(k<<7);n=c[t>>2]|0;if(n>>>0>1){h=1;do{if((j|0)!=(c[m+(h*52|0)+24>>2]|0))c[g>>2]=255;h=h+1|0}while(h>>>0>>0)}c[a+28>>2]=7;c[a+32>>2]=0;c[a+36>>2]=0;h=(n|0)==0;if(!h?(c[l+8>>2]=j+-1+(k<<7),n>>>0>1):0){g=1;do{c[l+(g*12|0)+8>>2]=(c[m+(g*52|0)+24>>2]|0)+-1+(c[m+(g*52|0)+32>>2]<<7);g=g+1|0}while(g>>>0>>0)}g=a+40|0;a:do{if(!(c[e+32>>2]|0)){c[g>>2]=1;switch(c[e+20>>2]|0){case 1:{c[a+48>>2]=16;break a}case 2:{c[a+48>>2]=17;break a}case 3:{c[a+48>>2]=18;break a}default:break a}}else{c[g>>2]=2;c[a+48>>2]=0}}while(0);b:do{if(!h){h=0;g=0;j=0;do{e=(b[m+(j*52|0)+48>>1]|0)==0;g=(e&1^1)+g|0;h=e?h:j;j=j+1|0}while(j>>>0>>0);j=h;if((g|0)!=1){if(g>>>0<=1)break;Ub(f,2,16717,o)|0;break}switch(c[a+48>>2]|0){case 18:case 16:{h=3;break}case 17:{h=1;break}default:{Ub(f,2,16467,p)|0;break b}}if(n>>>0<(h+1|0)>>>0){Ub(f,2,16541,q)|0;break}if(j>>>0>>0){Ub(f,2,16634,r)|0;break}r=Pc(8)|0;g=a+116|0;c[g>>2]=r;if(!r){Ub(f,1,16782,s)|0;d=0;i=w;return d|0}s=Pc((c[t>>2]|0)*6|0)|0;e=c[g>>2]|0;c[e>>2]=s;if(!s){Ub(f,1,16782,v)|0;d=0;i=w;return d|0}l=c[t>>2]|0;b[e+4>>1]=l;k=c[e>>2]|0;g=0;do{b[k+(g*6|0)>>1]=g;b[k+(g*6|0)+2>>1]=0;v=g;g=g+1|0;b[k+(v*6|0)+4>>1]=g}while((g|0)!=(h|0));if(h>>>0>>0){j=c[u>>2]|0;do{v=(b[j+(h*52|0)+48>>1]|0)==0;b[k+(h*6|0)>>1]=h;g=k+(h*6|0)+2|0;if(v){b[g>>1]=-1;b[k+(h*6|0)+4>>1]=-1}else{b[g>>1]=1;b[(c[e>>2]|0)+(h*6|0)+4>>1]=0}h=h+1|0}while(h>>>0>>0)}}}while(0);c[a+52>>2]=0;c[a+44>>2]=0;c[a+96>>2]=c[d+18692>>2];d=1;i=w;return d|0}function Ne(a,b,d){a=a|0;b=b|0;d=d|0;return od(c[a>>2]|0,b,d)|0}function Oe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=a+8|0;if(!(sg(c[e>>2]|0,52,d)|0)){d=0;return d|0}g=c[e>>2]|0;h=tg(g)|0;e=ug(g)|0;if(h){i=0;f=1;while(1){if(!f)f=0;else f=(Ra[c[e>>2]&63](a,b,d)|0)!=0;i=i+1|0;if((i|0)==(h|0))break;else{e=e+4|0;f=f&1}}vg(g);if(!f){d=0;return d|0}}else vg(g);d=$c(c[a>>2]|0,b,d)|0;return d|0}function Pe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=a+8|0;if(!(sg(c[e>>2]|0,53,d)|0)){d=0;return d|0}if(!(pd(c[a>>2]|0,b,d)|0)){d=0;return d|0}i=c[e>>2]|0;g=tg(i)|0;e=ug(i)|0;if(!g)e=1;else{h=0;f=e;e=1;while(1){if(!e)e=0;else e=(Ra[c[f>>2]&63](a,b,d)|0)!=0;e=e&1;h=h+1|0;if((h|0)==(g|0))break;else f=f+4|0}}vg(i);d=e;return d|0}function Qe(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=a+4|0;if(!(sg(c[f>>2]|0,54,e)|0)){b=0;return b|0}h=c[f>>2]|0;i=tg(h)|0;f=ug(h)|0;if(i){j=0;g=1;while(1){if(!g)g=0;else g=(Ra[c[f>>2]&63](a,b,e)|0)!=0;j=j+1|0;if((j|0)==(i|0))break;else{f=f+4|0;g=g&1}}vg(h);if(!g){b=0;return b|0}}else vg(h);f=a+8|0;if(!(sg(c[f>>2]|0,55,e)|0)){b=0;return b|0}if(!(sg(c[f>>2]|0,56,e)|0)){b=0;return b|0}if(!(sg(c[f>>2]|0,57,e)|0)){b=0;return b|0}if((c[a+96>>2]|0)!=0?(sg(c[f>>2]|0,58,e)|0)==0:0){b=0;return b|0}if(!(sg(c[f>>2]|0,59,e)|0)){b=0;return b|0}h=c[f>>2]|0;i=tg(h)|0;f=ug(h)|0;if(i){j=0;g=1;while(1){if(!g)g=0;else g=(Ra[c[f>>2]&63](a,b,e)|0)!=0;j=j+1|0;if((j|0)==(i|0))break;else{f=f+4|0;g=g&1}}vg(h);if(!g){b=0;return b|0}}else vg(h);b=qd(c[a>>2]|0,b,d,e)|0;return b|0}function Re(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;k=b+8|0;if(!(sg(c[k>>2]|0,52,e)|0)){a=0;return a|0}h=c[b+4>>2]|0;i=tg(h)|0;f=ug(h)|0;if(i){j=0;g=1;while(1){if(!g)g=0;else g=(Ra[c[f>>2]&63](b,a,e)|0)!=0;j=j+1|0;if((j|0)==(i|0))break;else{f=f+4|0;g=g&1}}vg(h);if(!g){a=0;return a|0}}else vg(h);h=c[k>>2]|0;i=tg(h)|0;f=ug(h)|0;if(i){j=0;g=1;while(1){if(!g)g=0;else g=(Ra[c[f>>2]&63](b,a,e)|0)!=0;j=j+1|0;if((j|0)==(i|0))break;else{f=f+4|0;g=g&1}}vg(h);if(!g){a=0;return a|0}}else vg(h);a=ad(a,c[b>>2]|0,d,e)|0;return a|0}function Se(a,b,d,e,f,g,h,i,j,k,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;return cd(c[a>>2]|0,b,d,e,f,g,h,i,j,k,l)|0}function Te(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;return rd(c[a>>2]|0,b,d,e,f,g)|0}function Ue(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;return dd(c[a>>2]|0,b,d,e,f,g)|0}function Ve(a){a=a|0;var b=0,d=0,e=0;if(!a)return;Yc(c[a>>2]|0);c[a>>2]=0;b=a+72|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}b=a+68|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}b=a+108|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}e=a+116|0;b=c[e>>2]|0;if(b){d=c[b>>2]|0;if(d){Uc(d);b=c[e>>2]|0;c[b>>2]=0}Uc(b);c[e>>2]=0}e=a+120|0;b=c[e>>2]|0;if(b){d=c[b+12>>2]|0;if(d){Uc(d);b=c[e>>2]|0;c[b+12>>2]=0}d=c[b+4>>2]|0;if(d){Uc(d);b=c[e>>2]|0;c[b+4>>2]=0}d=c[b+8>>2]|0;if(d){Uc(d);b=c[e>>2]|0;c[b+8>>2]=0}d=c[b>>2]|0;if(d){Uc(d);b=c[e>>2]|0;c[b>>2]=0}Uc(b);c[e>>2]=0}b=a+4|0;d=c[b>>2]|0;if(d){rg(d);c[b>>2]=0}b=a+8|0;d=c[b>>2]|0;if(d){rg(d);c[b>>2]=0}Uc(a);return}function We(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return ed(c[a>>2]|0,b,d,e,f,g,h)|0}function Xe(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0;j=i;i=i+16|0;if(!d){a=0;i=j;return a|0}Ub(e,2,16826,j)|0;if(!(md(c[a>>2]|0,b,d,e,f)|0)){Ub(e,1,16303,j+8|0)|0;a=0;i=j;return a|0}h=a+108|0;if(!(bf(d,h,e)|0)){a=0;i=j;return a|0}f=c[a+48>>2]|0;a:do{switch(f|0){case 16:{c[d+20>>2]=1;break}case 17:{c[d+20>>2]=2;break}case 18:{c[d+20>>2]=3;break}case 24:{c[d+20>>2]=4;break}default:{b=d+20|0;if((f|0)==12){c[b>>2]=5;break a}else{c[b>>2]=-1;break a}}}}while(0);g=a+120|0;b=c[g>>2]|0;do{if(b){if(c[b+12>>2]|0){cf(d,h);break}Uc(c[b+4>>2]|0);Uc(c[(c[g>>2]|0)+8>>2]|0);Uc(c[c[g>>2]>>2]|0);b=c[g>>2]|0;f=c[b+12>>2]|0;if(f){Uc(f);b=c[g>>2]|0}Uc(b);c[g>>2]=0}}while(0);if(c[a+116>>2]|0)df(d,h,e);b=c[h>>2]|0;if(!b){a=1;i=j;return a|0}c[d+28>>2]=b;c[d+32>>2]=c[a+112>>2];c[h>>2]=0;a=1;i=j;return a|0}function Ye(b){b=b|0;var d=0;d=Qc(1,136)|0;if(!d)return d|0;if(!b){b=Xc()|0;c[d>>2]=b}else{b=fd()|0;c[d>>2]=b}if(!b){Ve(d);d=0;return d|0}b=d+108|0;c[b>>2]=0;c[b+4>>2]=0;c[b+8>>2]=0;c[b+12>>2]=0;a[b+16>>0]=0;b=qg()|0;c[d+4>>2]=b;if(!b){Ve(d);d=0;return d|0}b=qg()|0;c[d+8>>2]=b;if(b)return d|0;Ve(d);d=0;return d|0}function Ze(a,b,d){a=a|0;b=b|0;d=d|0;gd(c[a>>2]|0,b,d);return}function _e(a){a=a|0;return kd(c[a>>2]|0)|0}function $e(a){a=a|0;return jd(c[a>>2]|0)|0}function af(a,b,d){a=a|0;b=b|0;d=d|0;return nd(c[a>>2]|0,b,d)|0}function bf(f,g,h){f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;B=i;i=i+80|0;A=B+72|0;z=B+64|0;y=B+56|0;x=B+48|0;w=B+40|0;v=B+32|0;u=B+24|0;s=B+16|0;o=B+8|0;n=B;j=c[g+8>>2]|0;a:do{if(j){r=c[j>>2]|0;q=b[j+4>>1]|0;j=c[f+16>>2]|0;p=c[g+12>>2]|0;if((p|0)!=0?(c[p+12>>2]|0)!=0:0)g=d[p+18>>0]|0;else g=j;m=q<<16>>16==0;b:do{if(!m){l=0;c:while(1){k=l&65535;j=e[r+(k*6|0)>>1]|0;if(j>>>0>=g>>>0){k=15;break}j=b[r+(k*6|0)+4>>1]|0;switch(j<<16>>16){case 0:case-1:break;default:{j=(j&65535)+-1|0;if(j>>>0>=g>>>0){k=18;break c}}}l=l+1<<16>>16;if((l&65535)>=(q&65535))break b}if((k|0)==15){c[n>>2]=j;c[n+4>>2]=g;Ub(h,1,19343,n)|0;h=0;i=B;return h|0}else if((k|0)==18){c[o>>2]=j;c[o+4>>2]=g;Ub(h,1,19343,o)|0;h=0;i=B;return h|0}}}while(0);if(!g)j=p;else{d:do{if(!m)while(1){g=g+-1|0;j=0;do{if((e[r+((j&65535)*6|0)>>1]|0)==(g|0))break;j=j+1<<16>>16}while((j&65535)<(q&65535));if(j<<16>>16==q<<16>>16)break d;if(!g){j=p;break a}}}while(0);Ub(h,1,19380,s)|0;h=0;i=B;return h|0}}else j=c[g+12>>2]|0}while(0);if(!j){h=1;i=B;return h|0}t=c[j+12>>2]|0;if(!t){h=1;i=B;return h|0}p=a[j+18>>0]|0;s=p&255;r=p<<24>>24==0;if(r)j=1;else{l=f+16|0;g=0;m=0;j=1;do{g=e[t+(g<<2)>>1]|0;k=c[l>>2]|0;if(g>>>0>=k>>>0){c[u>>2]=g;c[u+4>>2]=k;Ub(h,1,19343,u)|0;j=0}m=m+1<<16>>16;g=m&65535}while(g>>>0>>0)}q=Qc(s,4)|0;if(!q){Ub(h,1,19413,v)|0;h=0;i=B;return h|0}if(!r){n=0;o=0;do{k=a[t+(n<<2)+3>>0]|0;l=k&255;do{if((k&255)<(p&255)){m=q+(l<<2)|0;g=a[t+(n<<2)+2>>0]|0;if((c[m>>2]|0)!=0&g<<24>>24==1){c[x>>2]=l;Ub(h,1,19486,x)|0;j=0;break}if(g<<24>>24!=0|k<<24>>24==0){c[m>>2]=1;break}else{c[y>>2]=n;c[y+4>>2]=l;Ub(h,1,19517,y)|0;j=0;break}}else{c[w>>2]=l;Ub(h,1,19430,w)|0;j=0}}while(0);o=o+1<<16>>16;n=o&65535}while(n>>>0>>0);if(!r){g=0;k=0;do{if((c[q+(g<<2)>>2]|0)==0?(a[t+(g<<2)+2>>0]|0)!=0:0){c[z>>2]=g;Ub(h,1,19553,z)|0;j=0}k=k+1<<16>>16;g=k&65535}while(g>>>0>>0)}}if(!j){Uc(q);h=0;i=B;return h|0}e:do{if(!((c[f+16>>2]|0)!=1|r)){j=0;g=0;while(1){g=g+1<<16>>16;if(!(c[q+(j<<2)>>2]|0))break;j=g&65535;if(j>>>0>=s>>>0)break e}c[A>>2]=j;Ub(h,2,19591,A)|0;if(!r){j=0;g=0;do{a[t+(j<<2)+2>>0]=1;a[t+(j<<2)+3>>0]=g;g=g+1<<16>>16;j=g&65535}while(j>>>0>>0)}}}while(0);Uc(q);h=1;i=B;return h|0}function cf(f,g){f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=g+12|0;g=c[w>>2]|0;m=c[g+8>>2]|0;o=c[g+4>>2]|0;q=c[g>>2]|0;r=c[g+12>>2]|0;g=a[g+18>>0]|0;s=f+24|0;t=c[s>>2]|0;u=g&255;v=Pc(u*52|0)|0;if(!v)return;n=g<<24>>24==0;if(!n){k=0;l=0;do{g=b[r+(k<<2)>>1]|0;if(!(a[r+(k<<2)+2>>0]|0)){g=g&65535;h=v+(k*52|0)|0;i=t+(g*52|0)|0;j=h+52|0;do{c[h>>2]=c[i>>2];h=h+4|0;i=i+4|0}while((h|0)<(j|0))}else{g=g&65535;h=v+((d[r+(k<<2)+3>>0]|0)*52|0)|0;i=t+(g*52|0)|0;j=h+52|0;do{c[h>>2]=c[i>>2];h=h+4|0;i=i+4|0}while((h|0)<(j|0))}j=Pc(_(c[t+(g*52|0)+8>>2]<<2,c[t+(g*52|0)+12>>2]|0)|0)|0;c[v+(k*52|0)+44>>2]=j;if(!j){p=7;break}c[v+(k*52|0)+24>>2]=d[m+k>>0];c[v+(k*52|0)+32>>2]=d[o+k>>0];l=l+1<<16>>16;k=l&65535}while(k>>>0>>0);if((p|0)==7){Uc(v);return}m=(e[(c[w>>2]|0)+16>>1]|0)+-1|0;if(!n){g=0;l=0;do{j=c[t+((e[r+(g<<2)>>1]|0)*52|0)+44>>2]|0;i=d[r+(g<<2)+3>>0]|0;k=_(c[v+(i*52|0)+12>>2]|0,c[v+(i*52|0)+8>>2]|0)|0;if(!(a[r+(g<<2)+2>>0]|0)){g=c[v+(g*52|0)+44>>2]|0;if(k){h=0;do{c[g+(h<<2)>>2]=c[j+(h<<2)>>2];h=h+1|0}while((h|0)!=(k|0))}}else{g=c[v+(i*52|0)+44>>2]|0;if(k){h=0;do{p=c[j+(h<<2)>>2]|0;c[g+(h<<2)>>2]=c[q+((_((p|0)<0?0:(p|0)>(m|0)?m:p,u)|0)+i<<2)>>2];h=h+1|0}while((h|0)!=(k|0))}}l=l+1<<16>>16;g=l&65535}while(g>>>0>>0)}}h=f+16|0;i=c[h>>2]|0;if(i){g=0;j=0;do{g=c[t+(g*52|0)+44>>2]|0;if(g)Uc(g);j=j+1<<16>>16;g=j&65535}while(g>>>0>>0)}Uc(t);c[s>>2]=v;c[h>>2]=u;Uc(c[(c[w>>2]|0)+4>>2]|0);Uc(c[(c[w>>2]|0)+8>>2]|0);Uc(c[c[w>>2]>>2]|0);g=c[w>>2]|0;h=c[g+12>>2]|0;if(h){Uc(h);g=c[w>>2]|0}Uc(g);c[w>>2]=0;return}function df(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=i;i=i+80|0;w=y+8|0;v=y;u=y+16|0;x=d+8|0;f=c[x>>2]|0;d=c[f>>2]|0;t=b[f+4>>1]|0;if(t<<16>>16){s=a+16|0;o=a+24|0;q=1;r=0;while(1){p=b[d+(r*6|0)>>1]|0;n=p&65535;a=c[s>>2]|0;a:do{if(n>>>0>>0){f=b[d+(r*6|0)+4>>1]|0;switch(f<<16>>16){case-1:case 0:{b[(c[o>>2]|0)+(n*52|0)+48>>1]=b[d+(r*6|0)+2>>1]|0;break a}default:{}}k=(f&65535)+65535|0;m=k&65535;k=k&65535;if(k>>>0>=a>>>0){c[w>>2]=k;c[w+4>>2]=a;Ub(e,2,19302,w)|0;break}l=d+(r*6|0)+2|0;if((n|0)!=(k|0)?(b[l>>1]|0)==0:0){f=c[o>>2]|0;a=f+(n*52|0)|0;g=u;h=a;j=g+52|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));g=a;h=f+(k*52|0)|0;j=g+52|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));g=(c[o>>2]|0)+(k*52|0)|0;h=u;j=g+52|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));if((r+1&65535)<(t&65535)){g=q;do{f=d+(g*6|0)|0;a=b[f>>1]|0;if(a<<16>>16!=p<<16>>16){if(a<<16>>16==m<<16>>16)b[f>>1]=p}else b[f>>1]=m;g=g+1|0}while((g&65535)<<16>>16!=t<<16>>16)}}b[(c[o>>2]|0)+(n*52|0)+48>>1]=b[l>>1]|0}else{c[v>>2]=n;c[v+4>>2]=a;Ub(e,2,19262,v)|0}}while(0);r=r+1|0;if((r&65535)<<16>>16==t<<16>>16)break;else q=q+1|0}d=c[x>>2]|0;f=d;d=c[d>>2]|0}if(!d){w=f;Uc(w);c[x>>2]=0;i=y;return}else{Uc(d);w=c[x>>2]|0;Uc(w);c[x>>2]=0;i=y;return}}function ef(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0;I=i;i=i+192|0;y=I+152|0;x=I+144|0;w=I+136|0;v=I+128|0;u=I+120|0;E=I+88|0;s=I+80|0;q=I+64|0;p=I+48|0;G=I+40|0;z=I+32|0;F=I+24|0;t=I+16|0;r=I+8|0;n=I+176|0;o=I+168|0;D=I+156|0;e=Qc(1,1024)|0;if(!e){Ub(d,1,17098,I)|0;H=0;i=I;return H|0}m=n+4|0;A=D+4|0;B=a+100|0;l=1024;a:while(1){if((Mb(b,n,8,d)|0)!=8)break;while(1){qb(n,D,4);qb(m,A,4);switch(c[D>>2]|0){case 0:{f=Qb(b)|0;k=C;if((k|0)>0|(k|0)==0&f>>>0>4294967287){H=6;break a}c[D>>2]=f+8;j=8;break}case 1:{if((Mb(b,n,8,d)|0)!=8)break a;qb(n,o,4);if(c[o>>2]|0){H=10;break a}qb(m,D,4);j=16;break}default:j=8}g=c[A>>2]|0;if((g|0)==1785737827){H=13;break a}f=c[D>>2]|0;if(!f){H=17;break a}if(f>>>0>>0){H=19;break a}if((g|0)==1783636e3){h=1084;g=j;H=22;break}if((g|0)==1718909296){h=1092;g=j;H=22;break}k=(g|0)==1785737832;b:do{if((g|0)!=1768449138)if((g|0)!=1668246642)if((g|0)!=1651532643)if((g|0)!=1885564018)if((g|0)!=1668112752){h=(g|0)==1667523942?1148:0;f=f-j|0;if((g|0)<1785737832)switch(g|0){case 1667523942:{H=30;break b}default:{}}else switch(g|0){case 1785737832:{H=30;break b}default:{}}g=c[B>>2]|0;if(!(g&1)){H=45;break a}if(!(g&2)){H=47;break a}c[B>>2]=g|2147483647;k=Rb(b,f,0,d)|0;if(!((k|0)==(f|0)&(C|0)==0)){H=50;break a}}else{h=1140;H=28}else{h=1132;H=28}else{h=1124;H=28}else{h=1116;H=28}else{h=1108;H=28}}while(0);if((H|0)==28){f=f-j|0;H=30}if((H|0)==30){H=0;if(k){h=1100;break}c[p>>2]=g>>>24;c[p+4>>2]=g>>>16&255;c[p+8>>2]=g>>>8&255;c[p+12>>2]=g&255;Ub(d,2,17282,p)|0;if(c[B>>2]&4)break;k=c[A>>2]|0;c[q>>2]=k>>>24;c[q+4>>2]=k>>>16&255;c[q+8>>2]=k>>>8&255;c[q+12>>2]=k&255;Ub(d,2,17333,q)|0;c[B>>2]=c[B>>2]|2147483647;k=Rb(b,f,0,d)|0;if(!((k|0)==(f|0)&(C|0)==0)){H=33;break a}}if((Mb(b,n,8,d)|0)!=8)break a}if((H|0)==22){H=0;f=f-g|0}k=Qb(b)|0;j=C;if(0>(j|0)|0==(j|0)&f>>>0>k>>>0){H=35;break}if(f>>>0>l>>>0){g=Tc(e,f)|0;if(!g){H=38;break}else{e=g;g=f}}else g=l;if((Mb(b,e,f,d)|0)!=(f|0)){H=40;break}if(!(Za[c[h+4>>2]&63](a,e,f,d)|0)){H=43;break}else l=g}switch(H|0){case 6:{Ub(d,1,17148,r)|0;break}case 10:{Ub(d,1,17148,t)|0;break}case 13:{f=c[B>>2]|0;if(!(f&4)){Ub(d,1,17190,F)|0;Uc(e);H=0;i=I;return H|0}else{c[B>>2]=f|8;Uc(e);H=1;i=I;return H|0}}case 17:{Ub(d,1,17218,z)|0;Uc(e);H=0;i=I;return H|0}case 19:{c[G>>2]=f;c[G+4>>2]=g;Ub(d,1,17256,G)|0;Uc(e);H=0;i=I;return H|0}case 33:{Ub(d,1,17399,s)|0;Uc(e);H=0;i=I;return H|0}case 35:{F=c[D>>2]|0;G=c[A>>2]|0;H=Qb(b)|0;c[E>>2]=F;c[E+4>>2]=G>>>24;c[E+8>>2]=G>>>16&255;c[E+12>>2]=G>>>8&255;c[E+16>>2]=G&255;c[E+20>>2]=f;c[E+24>>2]=H;Ub(d,1,17449,E)|0;Uc(e);H=0;i=I;return H|0}case 38:{Uc(e);Ub(d,1,17525,u)|0;H=0;i=I;return H|0}case 40:{Ub(d,1,17567,v)|0;Uc(e);H=0;i=I;return H|0}case 43:{Uc(e);H=0;i=I;return H|0}case 45:{Ub(d,1,17616,w)|0;Uc(e);H=0;i=I;return H|0}case 47:{Ub(d,1,17686,x)|0;Uc(e);H=0;i=I;return H|0}case 50:{Ub(d,1,17399,y)|0;Uc(e);H=0;i=I;return H|0}}Uc(e);H=1;i=I;return H|0}function ff(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;h=i;i=i+32|0;g=h+24|0;e=Pb(b)|0;f=C;a=a+80|0;j=a;j=Oi(e|0,f|0,c[j>>2]|0,c[j+4>>2]|0)|0;pb(g,j,4);pb(g+4|0,1785737827,4);if(!(Sb(b,c[a>>2]|0,c[a+4>>2]|0,d)|0)){Ub(d,1,17067,h)|0;j=0;i=h;return j|0}if((Nb(b,g,8,d)|0)!=8){Ub(d,1,17067,h+8|0)|0;j=0;i=h;return j|0}if(Sb(b,e,f,d)|0){j=1;i=h;return j|0}Ub(d,1,17067,h+16|0)|0;j=0;i=h;return j|0}function gf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;d=((c[a>>2]|0)!=0?(c[a+104>>2]|c[a+100>>2]|0)==0:0)&(c[a+8>>2]|0)!=0&(c[a+4>>2]|0)!=0&(c[a+64>>2]|0)!=0&(c[a+16>>2]|0)!=0&(c[a+12>>2]|0)!=0&1;e=c[a+20>>2]|0;if(!e){g=d;a=a+40|0;a=c[a>>2]|0;a=a+-1|0;a=a>>>0<2;a=a&1;b=Tb(b)|0;b=b&g;a=b&a;return a|0}f=c[a+72>>2]|0;g=0;do{d=(c[f+(g*12|0)+8>>2]&126)>>>0<38&d;g=g+1|0}while(g>>>0>>0);a=a+40|0;a=c[a>>2]|0;a=a+-1|0;a=a>>>0<2;a=a&1;b=Tb(b)|0;b=b&d;a=b&a;return a|0}function hf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;a=i;i=i+16|0;d=a;pb(d,12,4);pb(d+4|0,1783636e3,4);pb(d+8|0,218793738,4);c=(Nb(b,d,12,c)|0)==12&1;i=a;return c|0}function jf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;k=l+8|0;f=a+64|0;h=(c[f>>2]<<2)+16|0;j=Qc(1,h)|0;if(!j){Ub(d,1,16987,l)|0;k=0;i=l;return k|0}pb(j,h,4);pb(j+4|0,1718909296,4);pb(j+8|0,c[a+56>>2]|0,4);pb(j+12|0,c[a+60>>2]|0,4);g=j+16|0;if(c[f>>2]|0){a=a+68|0;e=0;do{pb(g,c[(c[a>>2]|0)+(e<<2)>>2]|0,4);e=e+1|0}while(e>>>0<(c[f>>2]|0)>>>0)}a=(Nb(b,j,h,d)|0)==(h|0);if(!a)Ub(d,1,17026,k)|0;Uc(j);k=a&1;i=l;return k|0}function kf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;q=i;i=i+80|0;o=q+16|0;m=q+8|0;k=q;f=q+24|0;l=q+72|0;e=f;g=e+48|0;do{c[e>>2]=0;e=e+4|0}while((e|0)<(g|0));p=(c[a+24>>2]|0)==255;c[f>>2]=2;e=f+12|0;if(p){c[e>>2]=3;c[f+24>>2]=4;e=3}else{c[e>>2]=4;e=2}if(!(c[a+116>>2]|0))p=e;else{c[f+(e*12|0)>>2]=5;p=e+1|0}pb(l+4|0,1785737832,4);h=0;j=f;e=8;while(1){g=j+8|0;r=_a[c[j>>2]&7](a,g)|0;c[j+4>>2]=r;if(!r){n=8;break}e=(c[g>>2]|0)+e|0;h=h+1|0;if((h|0)>=(p|0))break;else j=j+12|0}if((n|0)==8){Ub(d,1,16901,k)|0;g=0;while(1){e=c[f+4>>2]|0;if(e)Uc(e);g=g+1|0;if((g|0)>=(p|0)){e=0;break}else f=f+12|0}i=q;return e|0}pb(l,e,4);a:do{if((Nb(b,l,8,d)|0)==8){e=0;g=f;while(1){r=g+8|0;n=Nb(b,c[g+4>>2]|0,c[r>>2]|0,d)|0;if((n|0)!=(c[r>>2]|0))break;e=e+1|0;if((e|0)>=(p|0)){e=1;break a}else g=g+12|0}Ub(d,1,16944,o)|0;e=0}else{Ub(d,1,16944,m)|0;e=0}}while(0);h=0;while(1){g=c[f+4>>2]|0;if(g)Uc(g);h=h+1|0;if((h|0)>=(p|0))break;else f=f+12|0}i=q;return e|0}function lf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=Pb(b)|0;a=a+88|0;c[a>>2]=e;c[a+4>>2]=C;b=Rb(b,24,0,d)|0;return(b|0)==24&(C|0)==0&1|0}function mf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=Pb(b)|0;a=a+80|0;c[a>>2]=e;c[a+4>>2]=C;b=Rb(b,8,0,d)|0;return(b|0)==8&(C|0)==0&1|0}function nf(a,b){a=a|0;b=b|0;var d=0;d=Qc(1,22)|0;if(!d){b=0;return b|0}pb(d,22,4);pb(d+4|0,1768449138,4);pb(d+8|0,c[a+16>>2]|0,4);pb(d+12|0,c[a+12>>2]|0,4);pb(d+16|0,c[a+20>>2]|0,2);pb(d+18|0,c[a+24>>2]|0,1);pb(d+19|0,c[a+28>>2]|0,1);pb(d+20|0,c[a+32>>2]|0,1);pb(d+21|0,c[a+36>>2]|0,1);c[b>>2]=22;b=d;return b|0}function of(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0;f=a+20|0;g=(c[f>>2]|0)+8|0;h=Qc(1,g)|0;if(!h){b=0;return b|0}pb(h,g,4);pb(h+4|0,1651532643,4);if(c[f>>2]|0){a=a+72|0;d=0;e=h+8|0;while(1){pb(e,c[(c[a>>2]|0)+(d*12|0)+8>>2]|0,1);d=d+1|0;if(d>>>0>=(c[f>>2]|0)>>>0)break;else e=e+1|0}}c[b>>2]=g;b=h;return b|0}function pf(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=a+40|0;switch(c[e>>2]|0){case 1:{j=15;break}case 2:{j=(c[a+112>>2]|0)+11|0;break}default:{b=0;return b|0}}i=Qc(1,j)|0;if(!i){b=0;return b|0}pb(i,j,4);pb(i+4|0,1668246642,4);pb(i+8|0,c[e>>2]|0,1);pb(i+9|0,c[a+52>>2]|0,1);pb(i+10|0,c[a+44>>2]|0,1);g=i+11|0;switch(c[e>>2]|0){case 1:{pb(g,c[a+48>>2]|0,4);break}case 2:{h=a+112|0;if(c[h>>2]|0){a=a+108|0;f=0;e=g;while(1){pb(e,d[(c[a>>2]|0)+f>>0]|0,1);f=f+1|0;if(f>>>0>=(c[h>>2]|0)>>>0)break;else e=e+1|0}}break}default:{}}c[b>>2]=j;b=i;return b|0}function qf(a,d){a=a|0;d=d|0;var f=0,g=0,h=0,i=0,j=0,k=0;i=a+116|0;j=((e[(c[i>>2]|0)+4>>1]|0)*6|0)+10|0;k=Pc(j)|0;if(!k){d=0;return d|0}pb(k,j,4);pb(k+4|0,1667523942,4);pb(k+8|0,e[(c[i>>2]|0)+4>>1]|0,2);a=c[i>>2]|0;if(b[a+4>>1]|0){g=0;f=0;h=k+10|0;while(1){pb(h,e[(c[a>>2]|0)+(g*6|0)>>1]|0,2);pb(h+2|0,e[(c[c[i>>2]>>2]|0)+(g*6|0)+2>>1]|0,2);pb(h+4|0,e[(c[c[i>>2]>>2]|0)+(g*6|0)+4>>1]|0,2);f=f+1<<16>>16;a=c[i>>2]|0;if((f&65535)>=(e[a+4>>1]|0))break;else{g=f&65535;h=h+6|0}}}c[d>>2]=j;d=k;return d|0}function rf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+32|0;f=g+16|0;if((d|0)!=14){Ub(e,1,18507,g)|0;f=0;i=g;return f|0}qb(b,a+16|0,4);qb(b+4|0,a+12|0,4);d=a+20|0;qb(b+8|0,d,2);d=Qc(c[d>>2]|0,12)|0;c[a+72>>2]=d;if(!d){Ub(e,1,18540,g+8|0)|0;f=0;i=g;return f|0}qb(b+10|0,a+24|0,1);d=a+28|0;qb(b+11|0,d,1);d=c[d>>2]|0;if((d|0)!=7){c[f>>2]=d;Ub(e,4,18589,f)|0}qb(b+12|0,a+32|0,1);qb(b+13|0,a+36|0,1);f=1;i=g;return f|0}function sf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;x=i;i=i+80|0;j=x+40|0;t=x+32|0;l=x+24|0;k=x+16|0;u=x+72|0;s=x+68|0;p=x+64|0;q=x+60|0;n=x+56|0;r=x+52|0;o=x+48|0;m=x+44|0;if(e>>>0<3){Ub(f,1,18180,x)|0;w=0;i=x;return w|0}v=b+108|0;w=b+124|0;if(a[w>>0]|0){Ub(f,4,18212,x+8|0)|0;w=1;i=x;return w|0}h=b+40|0;qb(d,h,1);qb(d+1|0,b+52|0,1);qb(d+2|0,b+44|0,1);g=d+3|0;h=c[h>>2]|0;switch(h|0){case 1:{if(e>>>0<7){c[k>>2]=e;Ub(f,1,18321,k)|0;w=0;i=x;return w|0}h=b+48|0;if(e>>>0>7?(c[h>>2]|0)!=14:0){c[l>>2]=e;Ub(f,2,18321,l)|0}qb(g,h,4);if((c[h>>2]|0)==14){g=Pc(36)|0;c[g>>2]=14;c[o>>2]=0;c[n>>2]=0;c[p>>2]=0;c[r>>2]=0;c[q>>2]=0;c[s>>2]=0;c[m>>2]=4470064;h=g+4|0;c[h>>2]=1145390592;switch(e|0){case 35:{qb(d+7|0,s,4);qb(d+11|0,p,4);qb(d+15|0,q,4);qb(d+19|0,n,4);qb(d+23|0,r,4);qb(d+27|0,o,4);qb(d+31|0,m,4);c[h>>2]=0;break}case 7:break;default:{c[t>>2]=e;Ub(f,2,18357,t)|0}}c[g+8>>2]=c[s>>2];c[g+16>>2]=c[q>>2];c[g+24>>2]=c[r>>2];c[g+12>>2]=c[p>>2];c[g+20>>2]=c[n>>2];c[g+28>>2]=c[o>>2];c[g+32>>2]=c[m>>2];c[v>>2]=g;c[b+112>>2]=0}a[w>>0]=1;w=1;i=x;return w|0}case 2:{j=e+-3|0;h=b+112|0;c[h>>2]=j;b=Qc(1,j)|0;c[v>>2]=b;if(!b){c[h>>2]=0;w=0;i=x;return w|0}if((e|0)>3){h=0;while(1){qb(g,u,1);a[(c[v>>2]|0)+h>>0]=c[u>>2];h=h+1|0;if((h|0)==(j|0))break;else g=g+1|0}}a[w>>0]=1;w=1;i=x;return w|0}default:{if(h>>>0<=2){w=1;i=x;return w|0}c[j>>2]=h;Ub(f,4,18401,j)|0;w=1;i=x;return w|0}}return 0}function tf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;j=i;i=i+16|0;g=j;f=c[a+24>>2]|0;if((f|0)!=255){c[g>>2]=f;Ub(e,2,18034,g)|0}h=a+20|0;if((c[h>>2]|0)!=(d|0)){Ub(e,1,18148,j+8|0)|0;h=0;i=j;return h|0}if(!d){h=1;i=j;return h|0}g=a+72|0;f=0;while(1){qb(b,(c[g>>2]|0)+(f*12|0)+8|0,1);f=f+1|0;if(f>>>0>=(c[h>>2]|0)>>>0){b=1;break}else b=b+1|0}i=j;return b|0}function uf(e,f,g,h){e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+16|0;j=r;q=r+12|0;k=e+120|0;if(g>>>0<3|(c[k>>2]|0)!=0){g=0;i=r;return g|0}qb(f,q,2);l=c[q>>2]|0;p=l&65535;if((p+-1|0)>>>0>1023){c[j>>2]=p;Ub(h,1,17951,j)|0;g=0;i=r;return g|0}qb(f+2|0,q,1);o=c[q>>2]&65535;if(!o){Ub(h,1,17989,r+8|0)|0;g=0;i=r;return g|0}if((o+3|0)>>>0>g>>>0){g=0;i=r;return g|0}j=Pc(_(p<<2,o)|0)|0;if(!j){g=0;i=r;return g|0}n=Pc(o)|0;if(!n){Uc(j);g=0;i=r;return g|0}m=Pc(o)|0;if(!m){Uc(j);Uc(n);g=0;i=r;return g|0}e=Pc(20)|0;if(!e){Uc(j);Uc(n);Uc(m);g=0;i=r;return g|0}c[e+4>>2]=m;c[e+8>>2]=n;c[e>>2]=j;b[e+16>>1]=l;a[e+18>>0]=c[q>>2];c[e+12>>2]=0;c[k>>2]=e;e=f+3|0;h=0;k=0;do{qb(e,q,1);e=e+1|0;a[n+h>>0]=(c[q>>2]&127)+1;a[m+h>>0]=(c[q>>2]|0)>>>7&1;k=k+1<<16>>16;h=k&65535}while(h>>>0>>0);if(!p){g=1;i=r;return g|0}h=0;a:while(1){l=0;k=j;m=0;while(1){j=((d[n+l>>0]|0)+7|0)>>>3;j=j>>>0>4?4:j;if((e-f+j|0)>(g|0)){e=0;j=22;break a}qb(e,q,j);e=e+j|0;c[k>>2]=c[q>>2];j=k+4|0;m=m+1<<16>>16;l=m&65535;if(l>>>0>=o>>>0)break;else k=j}h=h+1<<16>>16;if((h&65535)>>>0>=p>>>0){e=1;j=22;break}}if((j|0)==22){i=r;return e|0}return 0}function vf(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0;l=i;i=i+32|0;k=l+20|0;j=d+120|0;d=c[j>>2]|0;if(!d){Ub(g,1,17841,l)|0;k=0;i=l;return k|0}if(c[d+12>>2]|0){Ub(g,1,17887,l+8|0)|0;k=0;i=l;return k|0}h=a[d+18>>0]|0;d=(h&255)<<2;if(d>>>0>f>>>0){Ub(g,1,17918,l+16|0)|0;k=0;i=l;return k|0}g=Pc(d)|0;if(!g){k=0;i=l;return k|0}if(h<<24>>24){d=e;f=0;while(1){qb(d,k,2);b[g+(f<<2)>>1]=c[k>>2];qb(d+2|0,k,1);a[g+(f<<2)+2>>0]=c[k>>2];qb(d+3|0,k,1);a[g+(f<<2)+3>>0]=c[k>>2];f=f+1|0;if((f&255)<<24>>24==h<<24>>24)break;else d=d+4|0}}c[(c[j>>2]|0)+12>>2]=g;k=1;i=l;return k|0}function wf(a,d,f,g){a=a|0;d=d|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0;l=i;i=i+32|0;k=l+20|0;j=a+116|0;if(c[j>>2]|0){k=0;i=l;return k|0}if(f>>>0<2){Ub(g,1,17747,l)|0;k=0;i=l;return k|0}qb(d,k,2);a=c[k>>2]|0;h=a&65535;if(!h){Ub(g,1,17780,l+8|0)|0;k=0;i=l;return k|0}if(((h*6|0)+2|0)>>>0>f>>>0){Ub(g,1,17747,l+16|0)|0;k=0;i=l;return k|0}f=Pc(a*6|0)|0;if(!f){k=0;i=l;return k|0}a=Pc(8)|0;c[j>>2]=a;if(!a){Uc(f);k=0;i=l;return k|0}c[a>>2]=f;g=c[k>>2]&65535;b[a+4>>1]=g;if(!(g<<16>>16)){k=1;i=l;return k|0}else{h=0;a=d}do{d=h&65535;qb(a+2|0,k,2);b[f+(d*6|0)>>1]=c[k>>2];qb(a+4|0,k,2);a=a+6|0;b[f+(d*6|0)+2>>1]=c[k>>2];qb(a,k,2);b[f+(d*6|0)+4>>1]=c[k>>2];h=h+1<<16>>16}while((h&65535)<(e[(c[j>>2]|0)+4>>1]|0));a=1;i=l;return a|0}function xf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+32|0;f=g+20|0;a=a+100|0;if(c[a>>2]|0){Ub(e,1,19130,g)|0;e=0;i=g;return e|0}if((d|0)!=4){Ub(e,1,19184,g+8|0)|0;e=0;i=g;return e|0}qb(b,f,4);if((c[f>>2]|0)==218793738){c[a>>2]=c[a>>2]|1;e=1;i=g;return e|0}else{Ub(e,1,19218,g+16|0)|0;e=0;i=g;return e|0}return 0}function yf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;j=i;i=i+32|0;g=j+24|0;h=a+100|0;if((c[h>>2]|0)!=1){Ub(e,1,19011,j)|0;h=0;i=j;return h|0}if(d>>>0<8){Ub(e,1,19061,j+8|0)|0;h=0;i=j;return h|0}qb(b,a+56|0,4);qb(b+4|0,a+60|0,4);b=b+8|0;d=d+-8|0;if(d&3){Ub(e,1,19061,j+16|0)|0;h=0;i=j;return h|0}d=d>>>2;f=a+64|0;c[f>>2]=d;if(d){d=Qc(d,4)|0;c[a+68>>2]=d;if(!d){Ub(e,1,19097,g)|0;h=0;i=j;return h|0}if(c[f>>2]|0){a=a+68|0;d=0;while(1){qb(b,(c[a>>2]|0)+(d<<2)|0,4);d=d+1|0;if(d>>>0>=(c[f>>2]|0)>>>0)break;else b=b+4|0}}}c[h>>2]=c[h>>2]|2;h=1;i=j;return h|0}function zf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;A=i;i=i+96|0;y=A+72|0;s=A+64|0;r=A+56|0;q=A+48|0;w=A+40|0;v=A+32|0;u=A+24|0;t=A+16|0;p=A+8|0;n=A+80|0;o=A+76|0;x=a+100|0;if(!(c[x>>2]&2)){Ub(e,1,18679,A)|0;z=0;i=A;return z|0}m=a+104|0;c[m>>2]=0;do{if(d){k=b;b=0;a:while(1){if(d>>>0<8){z=6;break}qb(k,n,4);f=c[n>>2]|0;qb(k+4|0,n,4);j=c[n>>2]|0;switch(f|0){case 0:{z=14;break a}case 1:{if(d>>>0<16){z=9;break a}qb(k+8|0,o,4);if(c[o>>2]|0){z=11;break a}qb(k+12|0,n,4);f=c[n>>2]|0;if(!f){z=13;break a}else g=16;break}default:g=8}if(f>>>0>>0){z=16;break}if(d>>>0>>0){z=19;break}h=(j|0)==1768449138;if(!h)if((j|0)!=1668246642)if((j|0)!=1651532643)if((j|0)!=1885564018)if((j|0)!=1668112752)if((j|0)==1667523942){l=1148;z=26}else c[m>>2]=c[m>>2]|2147483647;else{l=1140;z=26}else{l=1132;z=26}else{l=1124;z=26}else{l=1116;z=26}else{l=1108;z=26}if((z|0)==26?(z=0,(Za[c[l+4>>2]&63](a,k+g|0,f-g|0,e)|0)==0):0){b=0;z=32;break}b=h?1:b;if((d|0)==(f|0)){z=29;break}else{k=k+f|0;d=d-f|0}}if((z|0)==6)Ub(e,1,18724,p)|0;else if((z|0)==9)Ub(e,1,18764,t)|0;else if((z|0)==11)Ub(e,1,17148,u)|0;else if((z|0)==13)Ub(e,1,17218,v)|0;else if((z|0)==14)Ub(e,1,17218,w)|0;else if((z|0)==16)Ub(e,1,18808,q)|0;else if((z|0)==19){Ub(e,1,18880,s)|0;z=0;i=A;return z|0}else if((z|0)==29){if(!b)break;c[x>>2]=c[x>>2]|4;z=1;i=A;return z|0}else if((z|0)==32){i=A;return b|0}Ub(e,1,18837,r)|0;z=0;i=A;return z|0}}while(0);Ub(e,1,18952,y)|0;z=0;i=A;return z|0}function Af(){return 8}function Bf(){return 32}function Cf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(!e)return;else f=0;do{l=a+(f<<2)|0;i=c[l>>2]|0;j=b+(f<<2)|0;h=c[j>>2]|0;g=d+(f<<2)|0;k=c[g>>2]|0;c[l>>2]=(h<<1)+i+k>>2;c[j>>2]=k-h;c[g>>2]=i-h;f=f+1|0}while((f|0)!=(e|0));return}function Df(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(!e)return;else f=0;do{k=a+(f<<2)|0;j=b+(f<<2)|0;h=c[j>>2]|0;g=d+(f<<2)|0;l=c[g>>2]|0;i=(c[k>>2]|0)-(l+h>>2)|0;c[k>>2]=i+l;c[j>>2]=i;c[g>>2]=i+h;f=f+1|0}while((f|0)!=(e|0));return}function Ef(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if(!e)return;else f=0;do{o=a+(f<<2)|0;u=c[o>>2]|0;k=b+(f<<2)|0;t=c[k>>2]|0;g=d+(f<<2)|0;s=c[g>>2]|0;j=((u|0)<0)<<31>>31;q=Zi(u|0,j|0,2449,0)|0;q=Si(q|0,C|0,4096,0)|0;q=Ti(q|0,C|0,13)|0;i=((t|0)<0)<<31>>31;r=Zi(t|0,i|0,4809,0)|0;r=Si(r|0,C|0,4096,0)|0;r=Ti(r|0,C|0,13)|0;h=((s|0)<0)<<31>>31;p=Zi(s|0,h|0,934,0)|0;p=Si(p|0,C|0,4096,0)|0;p=Ti(p|0,C|0,13)|0;l=Zi(u|0,j|0,1382,0)|0;l=Si(l|0,C|0,4096,0)|0;l=Ti(l|0,C|0,13)|0;m=Zi(t|0,i|0,2714,0)|0;m=Si(m|0,C|0,4096,0)|0;m=Ti(m|0,C|0,13)|0;n=Ri(s|0,h|0,12)|0;n=Si(n|0,C|0,4096,0)|0;n=Ti(n|0,C|0,13)|0;j=Ri(u|0,j|0,12)|0;j=Si(j|0,C|0,4096,0)|0;j=Ti(j|0,C|0,13)|0;i=Zi(t|0,i|0,3430,0)|0;i=Si(i|0,C|0,4096,0)|0;i=Ti(i|0,C|0,13)|0;h=Zi(s|0,h|0,666,0)|0;h=Si(h|0,C|0,4096,0)|0;h=Ti(h|0,C|0,13)|0;c[o>>2]=r+q+p;c[k>>2]=n-(m+l);c[g>>2]=j-i-h;f=f+1|0}while((f|0)!=(e|0));return}function Ff(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,h=0.0,i=0.0,j=0,k=0.0,l=0;if(!d)return;else e=0;do{l=a+(e<<2)|0;i=+g[l>>2];j=b+(e<<2)|0;h=+g[j>>2];f=c+(e<<2)|0;k=+g[f>>2];g[l>>2]=i+k*1.4019999504089355;g[j>>2]=i-h*.3441300094127655-k*.714139997959137;g[f>>2]=i+h*1.7719999551773071;e=e+1|0}while((e|0)!=(d|0));return}function Gf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=_(e,e)|0;o=Pc(h+e<<2)|0;if(!o){e=0;return e|0}if(h){i=0;f=a;while(1){c[o+(i+e<<2)>>2]=~~(+g[f>>2]*8192.0);i=i+1|0;if((i|0)==(h|0))break;else f=f+4|0}}if(b){m=(e|0)==0;n=0;do{if(!m){f=0;do{c[o+(f<<2)>>2]=c[c[d+(f<<2)>>2]>>2];f=f+1|0}while((f|0)!=(e|0));if(!m){a=0;k=o;do{k=k+(e<<2)|0;h=d+(a<<2)|0;f=c[h>>2]|0;c[f>>2]=0;i=0;j=0;l=k;while(1){p=c[l>>2]|0;q=c[o+(j<<2)>>2]|0;p=Zi(q|0,((q|0)<0)<<31>>31|0,p|0,((p|0)<0)<<31>>31|0)|0;p=Si(p|0,C|0,4096,0)|0;p=Ti(p|0,C|0,13)|0;i=p+i|0;c[f>>2]=i;j=j+1|0;if((j|0)==(e|0))break;else l=l+4|0}c[h>>2]=f+4;a=a+1|0}while((a|0)!=(e|0))}}n=n+1|0}while((n|0)!=(b|0))}Uc(o);q=1;return q|0}function Hf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0.0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;m=Pc(e<<3)|0;if(!m){e=0;return e|0}if(b){n=(e|0)==0;o=0;do{if(!n){f=0;do{c[m+(f<<2)>>2]=c[c[d+(f<<2)>>2]>>2];f=f+1|0}while((f|0)!=(e|0));if(!n){k=0;l=a;while(1){f=m+(k+e<<2)|0;g[f>>2]=0.0;h=0.0;i=0;j=l;while(1){h=h+ +g[j>>2]*+g[m+(i<<2)>>2];g[f>>2]=h;i=i+1|0;if((i|0)==(e|0))break;else j=j+4|0}i=d+(k<<2)|0;j=c[i>>2]|0;c[i>>2]=j+4;g[j>>2]=h;k=k+1|0;if((k|0)==(e|0))break;else l=l+(e<<2)|0}}}o=o+1|0}while((o|0)!=(b|0))}Uc(m);e=1;return e|0}function If(a,b,c){a=a|0;b=b|0;c=c|0;var d=0.0,e=0,f=0,i=0,j=0,k=0.0;if(!b)return;else j=0;do{i=a+(j<<3)|0;h[i>>3]=0.0;d=0.0;e=0;f=j;while(1){k=+g[c+(f<<2)>>2];d=d+k*k;e=e+1|0;if((e|0)==(b|0))break;else f=f+b|0}h[i>>3]=+O(+d);j=j+1|0}while((j|0)!=(b|0));return}function Jf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=i;i=i+32|0;B=F+28|0;w=F+24|0;x=F+20|0;y=F+16|0;z=F+12|0;A=F+8|0;k=F+4|0;l=F;f=d+76|0;D=c[f>>2]|0;C=D+(e*5640|0)+420|0;E=(c[C>>2]|0)+1|0;m=b+16|0;v=Pc((c[m>>2]|0)*528|0)|0;if(!v){E=0;i=F;return E|0}u=Pc(c[m>>2]<<2)|0;if(!u){Uc(v);E=0;i=F;return E|0}f=Pf(b,c[f>>2]|0,e)|0;if(!f){Uc(v);Uc(u);E=0;i=F;return E|0}g=c[m>>2]|0;if(g){h=0;j=v;while(1){c[u+(h<<2)>>2]=j;h=h+1|0;if(h>>>0>=g>>>0)break;else j=j+528|0}}Qf(b,d,e,x,y,z,A,k,l,w,B,u);s=c[w>>2]|0;q=_(c[m>>2]|0,s)|0;r=_(c[B>>2]|0,q)|0;t=D+(e*5640|0)+8|0;p=Qc(_((c[t>>2]|0)+1|0,r)|0,2)|0;h=f+4|0;c[h>>2]=p;if(!p){Uc(v);Uc(u);g=c[h>>2]|0;if(g){Uc(g);c[h>>2]=0}if(E){b=f;n=0;while(1){m=b+196|0;g=c[m>>2]|0;if(g){d=b+192|0;h=c[d>>2]|0;if(h){l=0;while(1){j=g+12|0;k=c[j>>2]|0;if(k){Uc(k);c[j>>2]=0;h=c[d>>2]|0}l=l+1|0;if(l>>>0>=h>>>0)break;else g=g+16|0}g=c[m>>2]|0}Uc(g);c[m>>2]=0}n=n+1|0;if((n|0)==(E|0))break;else b=b+232|0}}Uc(f);E=0;i=F;return E|0}g=c[f+196>>2]|0;p=c[b+24>>2]|0;c[f+200>>2]=c[x>>2];c[f+204>>2]=c[z>>2];c[f+208>>2]=c[y>>2];c[f+212>>2]=c[A>>2];c[f+20>>2]=1;c[f+16>>2]=s;c[f+12>>2]=q;c[f+8>>2]=r;m=c[f+192>>2]|0;if(m){b=0;d=p;while(1){j=c[g+12>>2]|0;h=c[u+(b<<2)>>2]|0;c[g>>2]=c[d>>2];c[g+4>>2]=c[d+4>>2];l=c[g+8>>2]|0;if(l){k=0;while(1){c[j>>2]=c[h>>2];c[j+4>>2]=c[h+4>>2];c[j+8>>2]=c[h+8>>2];c[j+12>>2]=c[h+12>>2];k=k+1|0;if(k>>>0>=l>>>0)break;else{h=h+16|0;j=j+16|0}}}b=b+1|0;if(b>>>0>=m>>>0)break;else{g=g+16|0;d=d+52|0}}}if(E>>>0>1){m=f;o=1;do{g=c[m+428>>2]|0;c[m+432>>2]=c[x>>2];c[m+436>>2]=c[z>>2];c[m+440>>2]=c[y>>2];c[m+444>>2]=c[A>>2];c[m+252>>2]=1;c[m+248>>2]=s;c[m+244>>2]=q;c[m+240>>2]=r;b=c[m+424>>2]|0;if(b){n=0;d=p;while(1){j=c[g+12>>2]|0;h=c[u+(n<<2)>>2]|0;c[g>>2]=c[d>>2];c[g+4>>2]=c[d+4>>2];l=c[g+8>>2]|0;if(l){k=0;while(1){c[j>>2]=c[h>>2];c[j+4>>2]=c[h+4>>2];c[j+8>>2]=c[h+8>>2];c[j+12>>2]=c[h+12>>2];k=k+1|0;if(k>>>0>=l>>>0)break;else{h=h+16|0;j=j+16|0}}}n=n+1|0;if(n>>>0>=b>>>0)break;else{g=g+16|0;d=d+52|0}}}c[m+236>>2]=c[m+4>>2];m=m+232|0;o=o+1|0}while((o|0)!=(E|0))}Uc(v);Uc(u);m=c[w>>2]|0;if(!(a[D+(e*5640|0)+5636>>0]&4)){d=c[B>>2]|0;l=(c[C>>2]|0)+1|0;if(!l){E=f;i=F;return E|0}k=c[D+(e*5640|0)+4>>2]|0;g=c[t>>2]|0;h=f;j=0;while(1){c[h+80>>2]=k;c[h+40>>2]=1;c[h+44>>2]=0;c[h+48>>2]=0;c[h+64>>2]=0;c[h+68>>2]=0;c[h+56>>2]=d;c[h+60>>2]=c[h+192>>2];c[h+52>>2]=g;c[h+72>>2]=m;j=j+1|0;if((j|0)==(l|0))break;else h=h+232|0}i=F;return f|0}else{j=(c[C>>2]|0)+1|0;if(!j){E=f;i=F;return E|0}k=f;g=D+(e*5640|0)+424|0;h=0;while(1){c[k+80>>2]=c[g+36>>2];c[k+40>>2]=1;c[k+44>>2]=c[g>>2];c[k+48>>2]=c[g+4>>2];c[k+64>>2]=0;c[k+68>>2]=0;c[k+56>>2]=c[g+12>>2];c[k+60>>2]=c[g+16>>2];c[k+52>>2]=c[g+8>>2];c[k+72>>2]=m;h=h+1|0;if((h|0)==(j|0))break;else{k=k+232|0;g=g+148|0}}i=F;return f|0}return 0}function Kf(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(!a)return;d=a+4|0;e=c[d>>2]|0;if(e){Uc(e);c[d>>2]=0}if(b){k=a;l=0;while(1){j=k+196|0;d=c[j>>2]|0;if(d){i=k+192|0;e=c[i>>2]|0;if(e){h=0;while(1){f=d+12|0;g=c[f>>2]|0;if(g){Uc(g);c[f>>2]=0;e=c[i>>2]|0}h=h+1|0;if(h>>>0>=e>>>0)break;else d=d+16|0}d=c[j>>2]|0}Uc(d);c[j>>2]=0}l=l+1|0;if((l|0)==(b|0))break;else k=k+232|0}}Uc(a);return}function Lf(e,f,g,h){e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;L=i;i=i+32|0;G=L+28|0;F=L+24|0;B=L+20|0;C=L+16|0;D=L+12|0;E=L+8|0;H=L+4|0;I=L;J=f+76|0;x=c[J>>2]|0;K=(c[x+(g*5640|0)+420>>2]|0)+1|0;A=e+16|0;z=Pc((c[A>>2]|0)*528|0)|0;if(!z){g=0;i=L;return g|0}y=Pc(c[A>>2]<<2)|0;if(!y){Uc(z);g=0;i=L;return g|0}j=Pf(e,c[J>>2]|0,g)|0;if(!j){Uc(z);Uc(y);g=0;i=L;return g|0}k=c[A>>2]|0;if(k){l=0;m=z;while(1){c[y+(l<<2)>>2]=m;l=l+1|0;if(l>>>0>=k>>>0)break;else m=m+528|0}}Qf(e,f,g,B,C,D,E,H,I,F,G,y);u=c[F>>2]|0;v=_(c[A>>2]|0,u)|0;w=_(c[G>>2]|0,v)|0;a[j>>0]=(d[f+93>>0]|0)>>>3&1;t=Qc(_(c[x+(g*5640|0)+8>>2]|0,w)|0,2)|0;l=j+4|0;c[l>>2]=t;if(!t){Uc(z);Uc(y);k=c[l>>2]|0;if(k){Uc(k);c[l>>2]=0}if(K){q=j;r=0;while(1){p=q+196|0;k=c[p>>2]|0;if(k){o=q+192|0;l=c[o>>2]|0;if(l){n=0;while(1){m=k+12|0;e=c[m>>2]|0;if(e){Uc(e);c[m>>2]=0;l=c[o>>2]|0}n=n+1|0;if(n>>>0>=l>>>0)break;else k=k+16|0}k=c[p>>2]|0}Uc(k);c[p>>2]=0}r=r+1|0;if((r|0)==(K|0))break;else q=q+232|0}}Uc(j);g=0;i=L;return g|0}k=c[j+196>>2]|0;t=c[e+24>>2]|0;c[j+200>>2]=c[B>>2];c[j+204>>2]=c[D>>2];c[j+208>>2]=c[C>>2];c[j+212>>2]=c[E>>2];c[j+224>>2]=c[H>>2];c[j+228>>2]=c[I>>2];c[j+20>>2]=1;c[j+16>>2]=u;c[j+12>>2]=v;c[j+8>>2]=w;p=c[j+192>>2]|0;if(p){q=0;o=t;while(1){m=c[k+12>>2]|0;l=c[y+(q<<2)>>2]|0;c[k>>2]=c[o>>2];c[k+4>>2]=c[o+4>>2];n=c[k+8>>2]|0;if(n){e=0;while(1){c[m>>2]=c[l>>2];c[m+4>>2]=c[l+4>>2];c[m+8>>2]=c[l+8>>2];c[m+12>>2]=c[l+12>>2];e=e+1|0;if(e>>>0>=n>>>0)break;else{l=l+16|0;m=m+16|0}}}q=q+1|0;if(q>>>0>=p>>>0)break;else{k=k+16|0;o=o+52|0}}}if(K>>>0>1){p=j;s=1;do{k=c[p+428>>2]|0;c[p+432>>2]=c[B>>2];c[p+436>>2]=c[D>>2];c[p+440>>2]=c[C>>2];c[p+444>>2]=c[E>>2];c[p+456>>2]=c[H>>2];c[p+460>>2]=c[I>>2];c[p+252>>2]=1;c[p+248>>2]=u;c[p+244>>2]=v;c[p+240>>2]=w;q=c[p+424>>2]|0;if(q){r=0;o=t;while(1){m=c[k+12>>2]|0;l=c[y+(r<<2)>>2]|0;c[k>>2]=c[o>>2];c[k+4>>2]=c[o+4>>2];n=c[k+8>>2]|0;if(n){e=0;while(1){c[m>>2]=c[l>>2];c[m+4>>2]=c[l+4>>2];c[m+8>>2]=c[l+8>>2];c[m+12>>2]=c[l+12>>2];e=e+1|0;if(e>>>0>=n>>>0)break;else{l=l+16|0;m=m+16|0}}}r=r+1|0;if(r>>>0>=q>>>0)break;else{k=k+16|0;o=o+52|0}}}c[p+236>>2]=c[p+4>>2];p=p+232|0;s=s+1|0}while((s|0)!=(K|0))}Uc(z);Uc(y);do{if(a[x+(g*5640|0)+5636>>0]&4){k=b[f>>1]|0;if((k&65535)>2){if(!((h|0)==1|(k&65535)<7))break}else if((h|0)!=1)break;Rf(c[J>>2]|0,g,c[B>>2]|0,c[C>>2]|0,c[D>>2]|0,c[E>>2]|0,c[F>>2]|0,c[H>>2]|0,c[I>>2]|0);g=j;i=L;return g|0}}while(0);w=c[A>>2]|0;v=c[B>>2]|0;u=c[C>>2]|0;t=c[D>>2]|0;s=c[E>>2]|0;r=c[F>>2]|0;q=c[G>>2]|0;p=c[H>>2]|0;o=c[I>>2]|0;k=c[J>>2]|0;m=(c[k+(g*5640|0)+420>>2]|0)+1|0;if(!m){g=j;i=L;return g|0}e=c[k+(g*5640|0)+8>>2]|0;n=c[k+(g*5640|0)+4>>2]|0;k=k+(g*5640|0)+424|0;l=0;while(1){c[k+76>>2]=0;c[k+92>>2]=w;c[k+72>>2]=0;c[k+88>>2]=q;c[k+68>>2]=0;c[k+84>>2]=e;c[k+36>>2]=n;c[k+80>>2]=0;c[k+96>>2]=r;c[k+100>>2]=v;c[k+104>>2]=u;c[k+108>>2]=t;c[k+112>>2]=s;c[k+116>>2]=p;c[k+120>>2]=o;l=l+1|0;if((l|0)==(m|0))break;else k=k+148|0}i=L;return j|0}function Mf(d,e,f,g,h,i,j){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;Q=c[e+76>>2]|0;R=Q+(f*5640|0)+424+(g*148|0)+36|0;S=Vc(c[R>>2]|0)|0;c[d+(g*232|0)+40>>2]=1;T=d+(g*232|0)+44|0;c[d+(g*232|0)+80>>2]=c[R>>2];do{if(a[e+93>>0]&8){k=b[e>>1]|0;if((k&65535)>2){if(!((j|0)==1&(k&65535)>6|(k+-3&65535)<4))break}else if(!((j|0)==1|(k+-3&65535)<4))break;k=i+1|0;a:do{if((k|0)<4){j=Q+(f*5640|0)+424+(g*148|0)+72|0;l=Q+(f*5640|0)+424+(g*148|0)+88|0;m=d+(g*232|0)+56|0;n=Q+(f*5640|0)+424+(g*148|0)+76|0;o=d+(g*232|0)+48|0;p=Q+(f*5640|0)+424+(g*148|0)+92|0;q=d+(g*232|0)+60|0;r=Q+(f*5640|0)+424+(g*148|0)+68|0;s=d+(g*232|0)+64|0;t=Q+(f*5640|0)+424+(g*148|0)+84|0;u=d+(g*232|0)+52|0;v=Q+(f*5640|0)+424+(g*148|0)+80|0;w=d+(g*232|0)+68|0;x=Q+(f*5640|0)+424+(g*148|0)+96|0;y=d+(g*232|0)+72|0;z=Q+(f*5640|0)+424+(g*148|0)+100|0;A=d+(g*232|0)+96|0;B=Q+(f*5640|0)+424+(g*148|0)+108|0;C=d+(g*232|0)+104|0;D=Q+(f*5640|0)+424+(g*148|0)+104|0;E=d+(g*232|0)+100|0;F=Q+(f*5640|0)+424+(g*148|0)+112|0;G=d+(g*232|0)+108|0;while(1){b:do{switch(a[S+k>>0]|0){case 82:{c[T>>2]=c[j>>2];c[m>>2]=c[l>>2];break}case 67:{c[o>>2]=c[n>>2];c[q>>2]=c[p>>2];break}case 76:{c[s>>2]=c[r>>2];c[u>>2]=c[t>>2];break}case 80:if((c[R>>2]|0)>>>0<2){c[w>>2]=c[v>>2];c[y>>2]=c[x>>2];break b}else{c[A>>2]=c[z>>2];c[C>>2]=c[B>>2];c[E>>2]=c[D>>2];c[G>>2]=c[F>>2];break b}default:{}}}while(0);k=k+1|0;if((k|0)==4)break a}}}while(0);k=(i|0)>-1;if(!h){if(!k)return;m=Q+(f*5640|0)+424+(g*148|0)+76|0;n=Q+(f*5640|0)+424+(g*148|0)+132|0;o=d+(g*232|0)+48|0;p=d+(g*232|0)+60|0;q=Q+(f*5640|0)+424+(g*148|0)+72|0;r=Q+(f*5640|0)+424+(g*148|0)+128|0;s=d+(g*232|0)+56|0;t=Q+(f*5640|0)+424+(g*148|0)+68|0;u=Q+(f*5640|0)+424+(g*148|0)+124|0;v=d+(g*232|0)+64|0;w=d+(g*232|0)+52|0;x=Q+(f*5640|0)+424+(g*148|0)+80|0;y=Q+(f*5640|0)+424+(g*148|0)+136|0;z=d+(g*232|0)+68|0;A=d+(g*232|0)+72|0;B=Q+(f*5640|0)+424+(g*148|0)+100|0;C=Q+(f*5640|0)+424+(g*148|0)+140|0;D=Q+(f*5640|0)+424+(g*148|0)+108|0;E=Q+(f*5640|0)+424+(g*148|0)+144|0;F=d+(g*232|0)+96|0;G=Q+(f*5640|0)+424+(g*148|0)+116|0;h=d+(g*232|0)+100|0;H=d+(g*232|0)+104|0;l=Q+(f*5640|0)+424+(g*148|0)+120|0;j=d+(g*232|0)+108|0;k=i;while(1){c:do{switch(a[S+k>>0]|0){case 67:{g=c[m>>2]|0;c[o>>2]=g;g=g+1|0;c[p>>2]=g;c[n>>2]=g;break}case 82:{g=c[q>>2]|0;c[T>>2]=g;g=g+1|0;c[s>>2]=g;c[r>>2]=g;break}case 76:{g=c[t>>2]|0;c[v>>2]=g;g=g+1|0;c[w>>2]=g;c[u>>2]=g;break}case 80:if((c[R>>2]|0)>>>0<2){g=c[x>>2]|0;c[z>>2]=g;g=g+1|0;c[A>>2]=g;c[y>>2]=g;break c}else{g=c[B>>2]|0;i=c[D>>2]|0;c[F>>2]=g;f=c[G>>2]|0;f=f+g-((g>>>0)%(f>>>0)|0)|0;c[h>>2]=f;c[H>>2]=i;g=c[l>>2]|0;g=g+i-((i>>>0)%(g>>>0)|0)|0;c[j>>2]=g;c[C>>2]=f;c[E>>2]=g;break c}default:{}}}while(0);if((k|0)>0)k=k+-1|0;else break}return}if(!k)return;L=Q+(f*5640|0)+424+(g*148|0)+128|0;M=Q+(f*5640|0)+424+(g*148|0)+88|0;N=Q+(f*5640|0)+424+(g*148|0)+72|0;O=d+(g*232|0)+56|0;P=Q+(f*5640|0)+424+(g*148|0)+132|0;p=Q+(f*5640|0)+424+(g*148|0)+92|0;q=Q+(f*5640|0)+424+(g*148|0)+76|0;r=d+(g*232|0)+48|0;s=d+(g*232|0)+60|0;t=Q+(f*5640|0)+424+(g*148|0)+124|0;u=Q+(f*5640|0)+424+(g*148|0)+84|0;v=Q+(f*5640|0)+424+(g*148|0)+68|0;w=d+(g*232|0)+64|0;x=d+(g*232|0)+52|0;y=Q+(f*5640|0)+424+(g*148|0)+136|0;z=Q+(f*5640|0)+424+(g*148|0)+96|0;A=Q+(f*5640|0)+424+(g*148|0)+80|0;B=d+(g*232|0)+68|0;C=d+(g*232|0)+72|0;D=Q+(f*5640|0)+424+(g*148|0)+140|0;E=Q+(f*5640|0)+424+(g*148|0)+104|0;F=d+(g*232|0)+96|0;G=Q+(f*5640|0)+424+(g*148|0)+116|0;h=d+(g*232|0)+100|0;H=Q+(f*5640|0)+424+(g*148|0)+144|0;I=Q+(f*5640|0)+424+(g*148|0)+112|0;J=d+(g*232|0)+104|0;K=Q+(f*5640|0)+424+(g*148|0)+120|0;n=d+(g*232|0)+108|0;o=Q+(f*5640|0)+424+(g*148|0)+100|0;m=Q+(f*5640|0)+424+(g*148|0)+108|0;l=i;k=1;while(1){j=S+l|0;d:do{switch(a[j>>0]|0){case 67:{i=c[P>>2]|0;c[r>>2]=i+-1;c[s>>2]=i;break}case 82:{i=c[L>>2]|0;c[T>>2]=i+-1;c[O>>2]=i;break}case 76:{i=c[t>>2]|0;c[w>>2]=i+-1;c[x>>2]=i;break}case 80:if((c[R>>2]|0)>>>0<2){i=c[y>>2]|0;c[B>>2]=i+-1;c[C>>2]=i;break d}else{i=c[D>>2]|0;Q=c[G>>2]|0;c[F>>2]=i-Q-((i>>>0)%(Q>>>0)|0);c[h>>2]=i;i=c[H>>2]|0;Q=c[K>>2]|0;c[J>>2]=i-Q-((i>>>0)%(Q>>>0)|0);c[n>>2]=i;break d}default:{}}}while(0);e:do{if((k|0)==1)switch(a[j>>0]|0){case 82:{k=c[L>>2]|0;if((k|0)!=(c[M>>2]|0)){c[T>>2]=k;k=k+1|0;c[O>>2]=k;c[L>>2]=k;k=0;break e}if(!(Sf(l+-1|0,e,f,g,S)|0)){k=0;break e}k=c[N>>2]|0;c[T>>2]=k;k=k+1|0;c[O>>2]=k;c[L>>2]=k;k=1;break e}case 67:{k=c[P>>2]|0;if((k|0)!=(c[p>>2]|0)){c[r>>2]=k;k=k+1|0;c[s>>2]=k;c[P>>2]=k;k=0;break e}if(!(Sf(l+-1|0,e,f,g,S)|0)){k=0;break e}k=c[q>>2]|0;c[r>>2]=k;k=k+1|0;c[s>>2]=k;c[P>>2]=k;k=1;break e}case 76:{k=c[t>>2]|0;if((k|0)!=(c[u>>2]|0)){c[w>>2]=k;k=k+1|0;c[x>>2]=k;c[t>>2]=k;k=0;break e}if(!(Sf(l+-1|0,e,f,g,S)|0)){k=0;break e}k=c[v>>2]|0;c[w>>2]=k;k=k+1|0;c[x>>2]=k;c[t>>2]=k;k=1;break e}case 80:{if((c[R>>2]|0)>>>0<2){k=c[y>>2]|0;if((k|0)!=(c[z>>2]|0)){c[B>>2]=k;k=k+1|0;c[C>>2]=k;c[y>>2]=k;k=0;break e}if(!(Sf(l+-1|0,e,f,g,S)|0)){k=0;break e}k=c[A>>2]|0;c[B>>2]=k;k=k+1|0;c[C>>2]=k;c[y>>2]=k;k=1;break e}k=c[D>>2]|0;if(k>>>0<(c[E>>2]|0)>>>0){c[F>>2]=k;i=c[G>>2]|0;k=i+k-((k>>>0)%(i>>>0)|0)|0;c[h>>2]=k;c[D>>2]=k;k=0;break e}j=c[H>>2]|0;if(j>>>0<(c[I>>2]|0)>>>0){c[J>>2]=j;i=c[K>>2]|0;k=0;j=i+j-((j>>>0)%(i>>>0)|0)|0}else{if(!(Sf(l+-1|0,e,f,g,S)|0)){k=0;break e}i=c[m>>2]|0;c[H>>2]=i;c[J>>2]=i;j=c[K>>2]|0;k=1;j=j+i-((i>>>0)%(j>>>0)|0)|0}c[n>>2]=j;c[H>>2]=j;Q=c[o>>2]|0;c[F>>2]=Q;i=c[G>>2]|0;i=i+Q-((Q>>>0)%(i>>>0)|0)|0;c[h>>2]=i;c[D>>2]=i;break e}default:{k=1;break e}}}while(0);if((l|0)>0)l=l+-1|0;else break}return}}while(0);c[T>>2]=c[Q+(f*5640|0)+424+(g*148|0)+72>>2];c[d+(g*232|0)+56>>2]=c[Q+(f*5640|0)+424+(g*148|0)+88>>2];c[d+(g*232|0)+48>>2]=c[Q+(f*5640|0)+424+(g*148|0)+76>>2];c[d+(g*232|0)+60>>2]=c[Q+(f*5640|0)+424+(g*148|0)+92>>2];c[d+(g*232|0)+64>>2]=c[Q+(f*5640|0)+424+(g*148|0)+68>>2];c[d+(g*232|0)+52>>2]=c[Q+(f*5640|0)+424+(g*148|0)+84>>2];c[d+(g*232|0)+68>>2]=c[Q+(f*5640|0)+424+(g*148|0)+80>>2];c[d+(g*232|0)+72>>2]=c[Q+(f*5640|0)+424+(g*148|0)+96>>2];c[d+(g*232|0)+96>>2]=c[Q+(f*5640|0)+424+(g*148|0)+100>>2];c[d+(g*232|0)+104>>2]=c[Q+(f*5640|0)+424+(g*148|0)+108>>2];c[d+(g*232|0)+100>>2]=c[Q+(f*5640|0)+424+(g*148|0)+104>>2];c[d+(g*232|0)+108>>2]=c[Q+(f*5640|0)+424+(g*148|0)+112>>2];return}function Nf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;I=c[d+76>>2]|0;K=c[d+24>>2]|0;N=(e>>>0)%(K>>>0)|0;K=(e>>>0)/(K>>>0)|0;L=c[d+4>>2]|0;H=c[d+12>>2]|0;G=(_(H,N)|0)+L|0;M=c[b>>2]|0;M=(G|0)>(M|0)?G:M;L=(_(H,N+1|0)|0)+L|0;N=c[b+8>>2]|0;N=(L|0)<(N|0)?L:N;L=c[d+8>>2]|0;H=c[d+16>>2]|0;G=(_(H,K)|0)+L|0;J=c[b+4>>2]|0;J=(G|0)>(J|0)?G:J;L=(_(H,K+1|0)|0)+L|0;K=c[b+12>>2]|0;K=(L|0)<(K|0)?L:K;L=c[b+16>>2]|0;if(!L){l=0;k=2147483647;j=2147483647;i=0}else{D=K+-1|0;E=N+-1|0;F=J+-1|0;G=M+-1|0;l=0;k=2147483647;j=2147483647;i=0;H=0;A=c[b+24>>2]|0;B=c[I+(e*5640|0)+5584>>2]|0;while(1){x=c[A>>2]|0;y=c[A+4>>2]|0;z=c[B+4>>2]|0;i=z>>>0>i>>>0?z:i;if(z){v=(D+y|0)/(y|0)|0;t=(E+x|0)/(x|0)|0;r=(F+y|0)/(y|0)|0;p=(G+x|0)/(x|0)|0;p=Si(p|0,((p|0)<0)<<31>>31|0,-1,-1)|0;q=C;r=Si(r|0,((r|0)<0)<<31>>31|0,-1,-1)|0;s=C;t=Si(t|0,((t|0)<0)<<31>>31|0,-1,-1)|0;u=C;v=Si(v|0,((v|0)<0)<<31>>31|0,-1,-1)|0;w=C;d=0;o=0;while(1){m=c[B+812+(o<<2)>>2]|0;n=c[B+944+(o<<2)>>2]|0;g=d+-1+z|0;h=x<>>0>>0?k:h;j=j>>>0>>0?j:O;O=Ri(1,0,g|0)|0;h=C;d=Si(p|0,q|0,O|0,h|0)|0;d=Pi(d|0,C|0,g|0)|0;f=Si(r|0,s|0,O|0,h|0)|0;f=Pi(f|0,C|0,g|0)|0;b=Si(t|0,u|0,O|0,h|0)|0;b=Pi(b|0,C|0,g|0)|0;h=Si(v|0,w|0,O|0,h|0)|0;g=Pi(h|0,C|0,g|0)|0;h=Ri(1,0,n|0)|0;h=Si(h|0,C|0,-1,-1)|0;h=Si(h|0,C|0,g|0,((g|0)<0)<<31>>31|0)|0;h=Pi(h|0,C|0,n|0)|0;if((d|0)==(b|0))d=0;else{O=Ri(1,0,m|0)|0;O=Si(O|0,C|0,-1,-1)|0;O=Si(O|0,C|0,b|0,((b|0)<0)<<31>>31|0)|0;O=Pi(O|0,C|0,m|0)|0;d=(O<>m<>m}b=_(d,(f|0)==(g|0)?0:(h<>n<>n)|0;l=b>>>0>l>>>0?b:l;b=o+1|0;if(b>>>0>>0){d=~o;o=b}else break}}H=H+1|0;if(H>>>0>=L>>>0)break;else{A=A+52|0;B=B+1080|0}}}if(a[I+(e*5640|0)+5636>>0]&4){Rf(I,e,M,N,J,K,l,k,j);return}f=(c[I+(e*5640|0)+420>>2]|0)+1|0;if(!f)return;g=c[I+(e*5640|0)+8>>2]|0;h=c[I+(e*5640|0)+4>>2]|0;d=I+(e*5640|0)+424|0;b=0;while(1){c[d+76>>2]=0;c[d+92>>2]=L;c[d+72>>2]=0;c[d+88>>2]=i;c[d+68>>2]=0;c[d+84>>2]=g;c[d+36>>2]=h;c[d+80>>2]=0;c[d+96>>2]=l;c[d+100>>2]=M;c[d+104>>2]=N;c[d+108>>2]=J;c[d+112>>2]=K;c[d+116>>2]=k;c[d+120>>2]=j;b=b+1|0;if((b|0)==(f|0))break;else d=d+148|0}return}function Of(d){d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0;switch(c[d+80>>2]|0){case 0:{e=d+40|0;if(!(c[e>>2]|0)){E=d+32|0;l=E;E=c[E>>2]|0;f=18}else{c[e>>2]=0;t=c[d+64>>2]|0;c[d+36>>2]=t;f=5}while(1){if((f|0)==5){if(t>>>0>=(c[d+52>>2]|0)>>>0){nb=0;f=153;break}z=c[d+44>>2]|0;c[d+28>>2]=z;f=7}else if((f|0)==18){j=E+1|0;c[l>>2]=j;h=l;f=14}while(1){if((f|0)==7){f=0;if(z>>>0>=(c[d+56>>2]|0)>>>0){f=21;break}A=c[d+48>>2]|0;p=d+24|0;c[p>>2]=A}else if((f|0)==14){if(j>>>0<(c[d+72>>2]|0)>>>0){f=16;break}F=d+24|0;n=F;F=c[F>>2]|0;f=19}while(1){if((f|0)==19){f=0;A=F+1|0;c[n>>2]=A;p=n}if(A>>>0>=(c[d+60>>2]|0)>>>0){f=20;break}B=c[d+196>>2]|0;C=c[d+28>>2]|0;if(C>>>0<(c[B+(A<<4)+8>>2]|0)>>>0)break;else{n=p;F=A;f=19}}if((f|0)==20){f=d+28|0;z=(c[f>>2]|0)+1|0;c[f>>2]=z;f=7;continue}e=c[B+(A<<4)+12>>2]|0;if(!(a[d>>0]|0))c[d+72>>2]=_(c[e+(C<<4)+12>>2]|0,c[e+(C<<4)+8>>2]|0)|0;j=c[d+68>>2]|0;h=d+32|0;c[h>>2]=j;f=14}if((f|0)==16){f=0;D=_(c[d+8>>2]|0,c[d+36>>2]|0)|0;D=(_(c[d+12>>2]|0,c[d+28>>2]|0)|0)+D|0;D=D+(_(c[d+16>>2]|0,c[d+24>>2]|0)|0)|0;D=D+(_(c[d+20>>2]|0,j)|0)|0;D=(c[d+4>>2]|0)+(D<<1)|0;if(!(b[D>>1]|0))break;else{l=h;E=j;f=18;continue}}else if((f|0)==21){f=d+36|0;t=(c[f>>2]|0)+1|0;c[f>>2]=t;f=5;continue}}if((f|0)==153)return nb|0;b[D>>1]=1;d=1;return d|0}case 1:{e=d+40|0;if(!(c[e>>2]|0)){x=d+32|0;k=x;x=c[x>>2]|0;f=38}else{c[e>>2]=0;G=c[d+44>>2]|0;c[d+28>>2]=G;f=25}while(1){if((f|0)==25){if(G>>>0>=(c[d+56>>2]|0)>>>0){nb=0;f=153;break}r=c[d+64>>2]|0;c[d+36>>2]=r;f=27}else if((f|0)==38){i=x+1|0;c[k>>2]=i;g=k;f=34}while(1){if((f|0)==27){f=0;if(r>>>0>=(c[d+52>>2]|0)>>>0){f=41;break}s=c[d+48>>2]|0;o=d+24|0;c[o>>2]=s}else if((f|0)==34){if(i>>>0<(c[d+72>>2]|0)>>>0){f=36;break}y=d+24|0;m=y;y=c[y>>2]|0;f=39}while(1){if((f|0)==39){f=0;s=y+1|0;c[m>>2]=s;o=m}if(s>>>0>=(c[d+60>>2]|0)>>>0){f=40;break}u=c[d+196>>2]|0;v=c[d+28>>2]|0;if(v>>>0<(c[u+(s<<4)+8>>2]|0)>>>0)break;else{m=o;y=s;f=39}}if((f|0)==40){f=d+36|0;r=(c[f>>2]|0)+1|0;c[f>>2]=r;f=27;continue}e=c[u+(s<<4)+12>>2]|0;if(!(a[d>>0]|0))c[d+72>>2]=_(c[e+(v<<4)+12>>2]|0,c[e+(v<<4)+8>>2]|0)|0;i=c[d+68>>2]|0;g=d+32|0;c[g>>2]=i;f=34}if((f|0)==36){f=0;w=_(c[d+8>>2]|0,c[d+36>>2]|0)|0;w=(_(c[d+12>>2]|0,c[d+28>>2]|0)|0)+w|0;w=w+(_(c[d+16>>2]|0,c[d+24>>2]|0)|0)|0;w=w+(_(c[d+20>>2]|0,i)|0)|0;w=(c[d+4>>2]|0)+(w<<1)|0;if(!(b[w>>1]|0))break;else{k=g;x=i;f=38;continue}}else if((f|0)==41){f=d+28|0;G=(c[f>>2]|0)+1|0;c[f>>2]=G;f=25;continue}}if((f|0)==153)return nb|0;b[w>>1]=1;d=1;return d|0}case 2:{e=d+40|0;if(!(c[e>>2]|0)){lb=d+36|0;Ta=lb;lb=c[lb>>2]|0;f=75}else{c[e>>2]=0;o=d+224|0;c[o>>2]=0;p=d+228|0;c[p>>2]=0;q=c[d+192>>2]|0;if(q){r=c[d+196>>2]|0;e=0;f=0;s=0;do{j=c[r+(s<<4)+8>>2]|0;if(j){k=c[r+(s<<4)+12>>2]|0;l=c[r+(s<<4)>>2]|0;m=c[r+(s<<4)+4>>2]|0;n=j+-1|0;g=0;i=0;while(1){h=n+g|0;Sa=l<>2]|0);h=m<<(c[k+(i<<4)+4>>2]|0)+h;e=(e|0)==0?Sa:e>>>0>>0?e:Sa;f=(f|0)==0?h:f>>>0>>0?f:h;h=i+1|0;if((h|0)==(j|0))break;else{g=~i;i=h}}c[o>>2]=e;c[p>>2]=f}s=s+1|0}while((s|0)!=(q|0))}if(!(a[d>>0]|0)){c[d+104>>2]=c[d+204>>2];c[d+96>>2]=c[d+200>>2];c[d+108>>2]=c[d+212>>2];c[d+100>>2]=c[d+208>>2]}J=c[d+44>>2]|0;c[d+28>>2]=J;f=54}while(1){if((f|0)==54){if(J>>>0>=(c[d+56>>2]|0)>>>0){nb=0;f=153;break}Xa=c[d+104>>2]|0;c[d+220>>2]=Xa;f=56}else if((f|0)==75){jb=lb+1|0;c[Ta>>2]=jb;Ua=Ta;f=71}while(1){if((f|0)==56){if((Xa|0)>=(c[d+108>>2]|0)){f=79;break}Ya=c[d+96>>2]|0;c[d+216>>2]=Ya;f=58}else if((f|0)==71){if(jb>>>0<(c[d+52>>2]|0)>>>0){f=73;break}mb=d+24|0;Va=mb;mb=c[mb>>2]|0;f=76}while(1){if((f|0)==58){if((Ya|0)>=(c[d+100>>2]|0)){f=78;break}Za=c[d+48>>2]|0;Wa=d+24|0;c[Wa>>2]=Za}else if((f|0)==76){Za=mb+1|0;c[Va>>2]=Za;Wa=Va}if(Za>>>0>=(c[d+60>>2]|0)>>>0){Ya=c[d+224>>2]|0;f=d+216|0;Sa=c[f>>2]|0;Ya=Sa+Ya-((Sa|0)%(Ya|0)|0)|0;c[f>>2]=Ya;f=58;continue}f=c[d+196>>2]|0;m=c[d+28>>2]|0;e=c[f+(Za<<4)+8>>2]|0;if(m>>>0>=e>>>0){Va=Wa;mb=Za;f=76;continue}n=c[f+(Za<<4)+12>>2]|0;i=e+~m|0;j=c[d+200>>2]|0;k=c[f+(Za<<4)>>2]|0;_a=k<>2]|0;Sa=c[f+(Za<<4)+4>>2]|0;ab=Sa<>2]|0)|0)/(_a|0)|0;db=ab+-1|0;f=(db+(c[d+212>>2]|0)|0)/(ab|0)|0;eb=c[n+(m<<4)>>2]|0;g=eb+i|0;fb=c[n+(m<<4)+4>>2]|0;h=fb+i|0;gb=c[d+220>>2]|0;if((gb|0)%(Sa<>2]|0;if((hb|0)%(k<>2]|0;if(!ib){Va=Wa;mb=Za;f=76;continue}if((bb|0)==(f|0)|(($a|0)==(e|0)?1:(c[n+(m<<4)+12>>2]|0)==0)){Va=Wa;mb=Za;f=76}else{f=70;break}}if((f|0)==70){c[d+32>>2]=(((cb+hb|0)/(_a|0)|0)>>eb)-($a>>eb)+(_((((db+gb|0)/(ab|0)|0)>>fb)-(bb>>fb)|0,ib)|0);jb=c[d+64>>2]|0;Ua=d+36|0;c[Ua>>2]=jb;f=71;continue}else if((f|0)==78){Xa=c[d+228>>2]|0;f=d+220|0;Sa=c[f>>2]|0;Xa=Sa+Xa-((Sa|0)%(Xa|0)|0)|0;c[f>>2]=Xa;f=56;continue}}if((f|0)==73){f=0;kb=_(c[d+8>>2]|0,jb)|0;kb=(_(c[d+12>>2]|0,c[d+28>>2]|0)|0)+kb|0;kb=kb+(_(c[d+16>>2]|0,c[d+24>>2]|0)|0)|0;kb=kb+(_(c[d+20>>2]|0,c[d+32>>2]|0)|0)|0;kb=(c[d+4>>2]|0)+(kb<<1)|0;if(!(b[kb>>1]|0))break;else{Ta=Ua;lb=jb;f=75;continue}}else if((f|0)==79){f=d+28|0;J=(c[f>>2]|0)+1|0;c[f>>2]=J;f=54;continue}}if((f|0)==153)return nb|0;b[kb>>1]=1;d=1;return d|0}case 3:{f=d+40|0;if(!(c[f>>2]|0)){Ra=c[d+24>>2]|0;Ka=d+36|0;pa=Ka;Ka=c[Ka>>2]|0;Na=Ra;Ra=(c[d+196>>2]|0)+(Ra<<4)|0;f=113}else{c[f>>2]=0;o=d+224|0;c[o>>2]=0;p=d+228|0;c[p>>2]=0;q=c[d+192>>2]|0;if(q){r=c[d+196>>2]|0;e=0;f=0;s=0;do{j=c[r+(s<<4)+8>>2]|0;if(j){k=c[r+(s<<4)+12>>2]|0;l=c[r+(s<<4)>>2]|0;m=c[r+(s<<4)+4>>2]|0;n=j+-1|0;g=0;i=0;while(1){h=n+g|0;mb=l<>2]|0);h=m<<(c[k+(i<<4)+4>>2]|0)+h;e=(e|0)==0?mb:e>>>0>>0?e:mb;f=(f|0)==0?h:f>>>0>>0?f:h;h=i+1|0;if((h|0)==(j|0))break;else{g=~i;i=h}}c[o>>2]=e;c[p>>2]=f}s=s+1|0}while((s|0)!=(q|0))}if(!(a[d>>0]|0)){e=c[d+204>>2]|0;c[d+104>>2]=e;c[d+96>>2]=c[d+200>>2];c[d+108>>2]=c[d+212>>2];c[d+100>>2]=c[d+208>>2]}else e=c[d+104>>2]|0;c[d+220>>2]=e;f=93}while(1){if((f|0)==93){if((e|0)>=(c[d+108>>2]|0)){nb=0;f=153;break}ta=c[d+96>>2]|0;c[d+216>>2]=ta;f=95}else if((f|0)==113){Ha=Ka+1|0;c[pa>>2]=Ha;qa=pa;Ia=Na;Qa=Ra;f=109}while(1){if((f|0)==95){if((ta|0)>=(c[d+100>>2]|0)){f=117;break}ua=c[d+48>>2]|0;c[d+24>>2]=ua;f=97}else if((f|0)==109){if(Ha>>>0<(c[d+52>>2]|0)>>>0){f=111;break}La=d+28|0;ra=La;La=c[La>>2]|0;Oa=Ia;Sa=Qa;f=114}while(1){if((f|0)==97){if(ua>>>0>=(c[d+60>>2]|0)>>>0){f=116;break}Pa=(c[d+196>>2]|0)+(ua<<4)|0;va=c[d+44>>2]|0;sa=d+28|0;c[sa>>2]=va;Ma=ua}else if((f|0)==114){va=La+1|0;c[ra>>2]=va;sa=ra;Ma=Oa;Pa=Sa}mb=c[d+56>>2]|0;f=c[Pa+8>>2]|0;if(va>>>0>=(mb>>>0>>0?mb:f)>>>0){ua=Ma+1|0;c[d+24>>2]=ua;f=97;continue}n=c[Pa+12>>2]|0;f=f+~va|0;g=c[d+200>>2]|0;h=c[Pa>>2]|0;wa=h<>2]|0;mb=c[Pa+4>>2]|0;ya=mb<>2]|0)|0)/(wa|0)|0;Ba=ya+-1|0;k=(Ba+(c[d+212>>2]|0)|0)/(ya|0)|0;Ca=c[n+(va<<4)>>2]|0;l=Ca+f|0;Da=c[n+(va<<4)+4>>2]|0;m=Da+f|0;Ea=c[d+220>>2]|0;if((Ea|0)%(mb<>2]|0;if((Fa|0)%(h<>2]|0;if(!Ga){ra=sa;La=va;Oa=Ma;Sa=Pa;f=114;continue}if((za|0)==(k|0)|((xa|0)==(j|0)?1:(c[n+(va<<4)+12>>2]|0)==0)){ra=sa;La=va;Oa=Ma;Sa=Pa;f=114}else{f=108;break}}if((f|0)==108){c[d+32>>2]=(((Aa+Fa|0)/(wa|0)|0)>>Ca)-(xa>>Ca)+(_((((Ba+Ea|0)/(ya|0)|0)>>Da)-(za>>Da)|0,Ga)|0);Ha=c[d+64>>2]|0;qa=d+36|0;c[qa>>2]=Ha;Ia=Ma;Qa=Pa;f=109;continue}else if((f|0)==116){ta=c[d+224>>2]|0;f=d+216|0;mb=c[f>>2]|0;ta=mb+ta-((mb|0)%(ta|0)|0)|0;c[f>>2]=ta;f=95;continue}}if((f|0)==111){f=0;Ja=_(c[d+8>>2]|0,Ha)|0;Ja=(_(c[d+12>>2]|0,c[d+28>>2]|0)|0)+Ja|0;Ja=Ja+(_(c[d+16>>2]|0,Ia)|0)|0;Ja=Ja+(_(c[d+20>>2]|0,c[d+32>>2]|0)|0)|0;Ja=(c[d+4>>2]|0)+(Ja<<1)|0;if(!(b[Ja>>1]|0))break;else{pa=qa;Ka=Ha;Na=Ia;Ra=Qa;f=113;continue}}else if((f|0)==117){e=c[d+228>>2]|0;f=d+220|0;mb=c[f>>2]|0;e=mb+e-((mb|0)%(e|0)|0)|0;c[f>>2]=e;f=93;continue}}if((f|0)==153)return nb|0;b[Ja>>1]=1;d=1;return d|0}case 4:{e=d+40|0;if(!(c[e>>2]|0)){na=c[d+24>>2]|0;ea=d+36|0;K=ea;ea=c[ea>>2]|0;ga=na;na=(c[d+196>>2]|0)+(na<<4)|0;f=148}else{c[e>>2]=0;O=c[d+48>>2]|0;c[d+24>>2]=O;f=121}while(1){if((f|0)==121){if(O>>>0>=(c[d+60>>2]|0)>>>0){nb=0;f=153;break}e=c[d+196>>2]|0;q=e+(O<<4)|0;o=d+224|0;c[o>>2]=0;p=d+228|0;c[p>>2]=0;l=c[e+(O<<4)+8>>2]|0;if(l){m=c[e+(O<<4)+12>>2]|0;n=c[q>>2]|0;h=c[e+(O<<4)+4>>2]|0;i=l+-1|0;f=0;e=0;g=0;k=0;while(1){j=i+g|0;mb=n<>2]|0);j=h<<(c[m+(k<<4)+4>>2]|0)+j;f=(f|0)==0?mb:f>>>0>>0?f:mb;e=(e|0)==0?j:e>>>0>>0?e:j;j=k+1|0;if((j|0)==(l|0))break;else{g=~k;k=j}}c[o>>2]=f;c[p>>2]=e}if(!(a[d>>0]|0)){e=c[d+204>>2]|0;c[d+104>>2]=e;c[d+96>>2]=c[d+200>>2];c[d+108>>2]=c[d+212>>2];c[d+100>>2]=c[d+208>>2]}else e=c[d+104>>2]|0;c[d+220>>2]=e;H=e;I=O;f=130}else if((f|0)==148){ba=ea+1|0;c[K>>2]=ba;L=K;ca=ga;ma=na;f=144}while(1){if((f|0)==130){if((H|0)>=(c[d+108>>2]|0)){f=152;break}P=c[d+96>>2]|0;c[d+216>>2]=P;ha=I;ka=q;f=132}else if((f|0)==144){if(ba>>>0<(c[d+52>>2]|0)>>>0){f=146;break}fa=d+28|0;M=fa;fa=c[fa>>2]|0;ja=ca;oa=ma;f=149}while(1){if((f|0)==132){if((P|0)>=(c[d+100>>2]|0)){f=151;break}Q=c[d+44>>2]|0;N=d+28|0;c[N>>2]=Q;ia=ha;la=ka}else if((f|0)==149){Q=fa+1|0;c[M>>2]=Q;N=M;ia=ja;la=oa}mb=c[d+56>>2]|0;e=c[la+8>>2]|0;if(Q>>>0>=(mb>>>0>>0?mb:e)>>>0){P=c[d+224>>2]|0;ha=d+216|0;ka=c[ha>>2]|0;P=ka+P-((ka|0)%(P|0)|0)|0;c[ha>>2]=P;ha=ia;ka=la;f=132;continue}m=c[la+12>>2]|0;e=e+~Q|0;f=c[d+200>>2]|0;g=c[la>>2]|0;R=g<>2]|0;mb=c[la+4>>2]|0;T=mb<>2]|0)|0)/(R|0)|0;W=T+-1|0;j=(W+(c[d+212>>2]|0)|0)/(T|0)|0;X=c[m+(Q<<4)>>2]|0;k=X+e|0;Y=c[m+(Q<<4)+4>>2]|0;l=Y+e|0;Z=c[d+220>>2]|0;if((Z|0)%(mb<>2]|0;if(($|0)%(g<>2]|0;if(!aa){M=N;fa=Q;ja=ia;oa=la;f=149;continue}if((U|0)==(j|0)|((S|0)==(i|0)?1:(c[m+(Q<<4)+12>>2]|0)==0)){M=N;fa=Q;ja=ia;oa=la;f=149}else{f=143;break}}if((f|0)==143){c[d+32>>2]=(((V+$|0)/(R|0)|0)>>X)-(S>>X)+(_((((W+Z|0)/(T|0)|0)>>Y)-(U>>Y)|0,aa)|0);ba=c[d+64>>2]|0;L=d+36|0;c[L>>2]=ba;ca=ia;ma=la;f=144;continue}else if((f|0)==151){H=c[d+228>>2]|0;I=d+220|0;q=c[I>>2]|0;H=q+H-((q|0)%(H|0)|0)|0;c[I>>2]=H;I=ha;q=ka;f=130;continue}}if((f|0)==146){f=0;da=_(c[d+8>>2]|0,ba)|0;da=(_(c[d+12>>2]|0,c[d+28>>2]|0)|0)+da|0;da=da+(_(c[d+16>>2]|0,ca)|0)|0;da=da+(_(c[d+20>>2]|0,c[d+32>>2]|0)|0)|0;da=(c[d+4>>2]|0)+(da<<1)|0;if(!(b[da>>1]|0))break;else{K=L;ea=ba;ga=ca;na=ma;f=148;continue}}else if((f|0)==152){O=I+1|0;c[d+24>>2]=O;f=121;continue}}if((f|0)==153)return nb|0;b[da>>1]=1;d=1;return d|0}default:{d=0;return d|0}}return 0}function Pf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;l=(c[b+(d*5640|0)+420>>2]|0)+1|0;e=Qc(l,232)|0;if(!e){l=0;return l|0}if(!l){l=e;return l|0}j=a+16|0;g=b+(d*5640|0)+5584|0;a=c[j>>2]|0;h=e;i=0;a:while(1){b=Qc(a,16)|0;f=h+196|0;c[f>>2]=b;if(!b){a=5;break}k=c[j>>2]|0;c[h+192>>2]=k;b:do{if(!k)a=0;else{a=(c[g>>2]|0)+4|0;k=Qc(c[a>>2]|0,16)|0;c[b+12>>2]=k;if(!k){a=18;break a}else d=0;while(1){c[b+(d<<4)+8>>2]=c[a>>2];d=d+1|0;a=c[j>>2]|0;if(d>>>0>=a>>>0)break b;b=c[f>>2]|0;a=(c[g>>2]|0)+(d*1080|0)+4|0;k=Qc(c[a>>2]|0,16)|0;c[b+(d<<4)+12>>2]=k;if(!k){a=18;break a}}}}while(0);i=i+1|0;if(i>>>0>=l>>>0){a=32;break}else h=h+232|0}if((a|0)==5){a=e+4|0;b=c[a>>2]|0;if(!b){j=e;k=0}else{Uc(b);c[a>>2]=0;j=e;k=0}while(1){i=j+196|0;a=c[i>>2]|0;if(a){h=j+192|0;b=c[h>>2]|0;if(b){g=0;while(1){d=a+12|0;f=c[d>>2]|0;if(f){Uc(f);c[d>>2]=0;b=c[h>>2]|0}g=g+1|0;if(g>>>0>=b>>>0)break;else a=a+16|0}a=c[i>>2]|0}Uc(a);c[i>>2]=0}k=k+1|0;if((k|0)==(l|0))break;else j=j+232|0}Uc(e);l=0;return l|0}else if((a|0)==18){a=e+4|0;b=c[a>>2]|0;if(!b){j=e;k=0}else{Uc(b);c[a>>2]=0;j=e;k=0}while(1){i=j+196|0;a=c[i>>2]|0;if(a){h=j+192|0;b=c[h>>2]|0;if(b){g=0;while(1){d=a+12|0;f=c[d>>2]|0;if(f){Uc(f);c[d>>2]=0;b=c[h>>2]|0}g=g+1|0;if(g>>>0>=b>>>0)break;else a=a+16|0}a=c[i>>2]|0}Uc(a);c[i>>2]=0}k=k+1|0;if((k|0)==(l|0))break;else j=j+232|0}Uc(e);l=0;return l|0}else if((a|0)==32)return e|0;return 0}function Qf(a,b,d,e,f,g,h,i,j,k,l,m){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0;o=c[(c[b+76>>2]|0)+(d*5640|0)+5584>>2]|0;n=c[a+24>>2]|0;I=c[b+24>>2]|0;H=b+12|0;G=(_(c[H>>2]|0,(d>>>0)%(I>>>0)|0)|0)+(c[b+4>>2]|0)|0;F=c[a>>2]|0;c[e>>2]=G>>>0>F>>>0?G:F;G=Si(c[H>>2]|0,0,G|0,0)|0;G=G|0-C;H=c[a+8>>2]|0;c[f>>2]=G>>>0>>0?G:H;H=b+16|0;I=(_(c[H>>2]|0,(d>>>0)/(I>>>0)|0)|0)+(c[b+8>>2]|0)|0;G=c[a+4>>2]|0;c[g>>2]=I>>>0>G>>>0?I:G;I=Si(c[H>>2]|0,0,I|0,0)|0;I=I|0-C;H=c[a+12>>2]|0;c[h>>2]=I>>>0>>0?I:H;c[k>>2]=0;c[l>>2]=0;c[i>>2]=2147483647;c[j>>2]=2147483647;H=a+16|0;if(!(c[H>>2]|0))return;else I=0;while(1){r=c[m+(I<<2)>>2]|0;p=c[n>>2]|0;a=((c[e>>2]|0)+-1+p|0)/(p|0)|0;F=n+4|0;q=c[F>>2]|0;d=((c[g>>2]|0)+-1+q|0)/(q|0)|0;p=(p+-1+(c[f>>2]|0)|0)/(p|0)|0;q=(q+-1+(c[h>>2]|0)|0)/(q|0)|0;G=o+4|0;b=c[G>>2]|0;if(b>>>0>(c[l>>2]|0)>>>0){c[l>>2]=b;b=c[G>>2]|0}if(b){D=Si(a|0,((a|0)<0)<<31>>31|0,-1,-1)|0;E=C;A=Si(d|0,((d|0)<0)<<31>>31|0,-1,-1)|0;B=C;y=Si(p|0,((p|0)<0)<<31>>31|0,-1,-1)|0;z=C;w=Si(q|0,((q|0)<0)<<31>>31|0,-1,-1)|0;x=C;v=0;while(1){b=b+-1|0;p=c[o+812+(v<<2)>>2]|0;u=c[o+944+(v<<2)>>2]|0;c[r>>2]=p;c[r+4>>2]=u;s=c[n>>2]<>2]<>2]|0;c[i>>2]=(a|0)<(s|0)?a:s;s=c[j>>2]|0;c[j>>2]=(s|0)<(J|0)?s:J;J=Ri(1,0,b|0)|0;s=C;a=Si(D|0,E|0,J|0,s|0)|0;a=Pi(a|0,C|0,b|0)|0;q=Si(A|0,B|0,J|0,s|0)|0;q=Pi(q|0,C|0,b|0)|0;d=Si(y|0,z|0,J|0,s|0)|0;d=Pi(d|0,C|0,b|0)|0;s=Si(w|0,x|0,J|0,s|0)|0;s=Pi(s|0,C|0,b|0)|0;J=Ri(1,0,u|0)|0;t=C;K=Si(s|0,((s|0)<0)<<31>>31|0,-1,-1)|0;t=Si(K|0,C|0,J|0,t|0)|0;t=Pi(t|0,C|0,u|0)|0;if((a|0)==(d|0))a=0;else{d=Si(d|0,((d|0)<0)<<31>>31|0,-1,-1)|0;J=C;K=Ri(1,0,p|0)|0;K=Si(d|0,J|0,K|0,C|0)|0;K=Pi(K|0,C|0,p|0)|0;a=(K<>p<>p}K=(q|0)==(s|0)?0:(t<>u<>u;c[r+8>>2]=a;c[r+12>>2]=K;a=_(a,K)|0;if(a>>>0>(c[k>>2]|0)>>>0)c[k>>2]=a;v=v+1|0;if(v>>>0>=(c[G>>2]|0)>>>0)break;else r=r+16|0}}I=I+1|0;if(I>>>0>=(c[H>>2]|0)>>>0)break;else{n=n+52|0;o=o+1080|0}}return}function Rf(a,b,d,e,f,g,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0;k=(c[a+(b*5640|0)+420>>2]|0)+1|0;c[a+(b*5640|0)+500>>2]=c[a+(b*5640|0)+428>>2];c[a+(b*5640|0)+516>>2]=c[a+(b*5640|0)+440>>2];c[a+(b*5640|0)+496>>2]=c[a+(b*5640|0)+424>>2];c[a+(b*5640|0)+512>>2]=c[a+(b*5640|0)+436>>2];c[a+(b*5640|0)+508>>2]=c[a+(b*5640|0)+432>>2];c[a+(b*5640|0)+492>>2]=0;c[a+(b*5640|0)+460>>2]=c[a+(b*5640|0)+456>>2];c[a+(b*5640|0)+504>>2]=0;c[a+(b*5640|0)+520>>2]=h;c[a+(b*5640|0)+524>>2]=d;c[a+(b*5640|0)+528>>2]=e;c[a+(b*5640|0)+532>>2]=f;c[a+(b*5640|0)+536>>2]=g;c[a+(b*5640|0)+540>>2]=i;c[a+(b*5640|0)+544>>2]=j;if(k>>>0<=1)return;a=a+(b*5640|0)+572|0;b=1;while(1){c[a+76>>2]=c[a+4>>2];c[a+92>>2]=c[a+16>>2];c[a+72>>2]=c[a>>2];c[a+88>>2]=c[a+12>>2];l=c[a+8>>2]|0;c[a+84>>2]=l;c[a+36>>2]=c[a+32>>2];c[a+80>>2]=0;c[a+68>>2]=l>>>0>(c[a+-64>>2]|0)>>>0?l:0;c[a+96>>2]=h;c[a+100>>2]=d;c[a+104>>2]=e;c[a+108>>2]=f;c[a+112>>2]=g;c[a+116>>2]=i;c[a+120>>2]=j;b=b+1|0;if((b|0)==(k|0))break;else a=a+148|0}return}function Sf(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;j=c[d+76>>2]|0;if((b|0)>-1)h=b;else{e=0;return e|0}a:while(1){switch(a[g+h>>0]|0){case 82:{i=3;break a}case 67:{i=5;break a}case 76:{i=7;break a}case 80:{i=9;break a}default:{}}h=h+-1|0}if((i|0)==3)if((c[j+(e*5640|0)+424+(f*148|0)+128>>2]|0)==(c[j+(e*5640|0)+424+(f*148|0)+88>>2]|0))return(Sf(b+-1|0,d,e,f,g)|0)!=0|0;else{e=1;return e|0}else if((i|0)==5)if((c[j+(e*5640|0)+424+(f*148|0)+132>>2]|0)==(c[j+(e*5640|0)+424+(f*148|0)+92>>2]|0))return(Sf(b+-1|0,d,e,f,g)|0)!=0|0;else{e=1;return e|0}else if((i|0)==7)if((c[j+(e*5640|0)+424+(f*148|0)+124>>2]|0)==(c[j+(e*5640|0)+424+(f*148|0)+84>>2]|0))return(Sf(b+-1|0,d,e,f,g)|0)!=0|0;else{e=1;return e|0}else if((i|0)==9){if((c[j+(e*5640|0)+424+(f*148|0)+36>>2]|0)>>>0<2)if((c[j+(e*5640|0)+424+(f*148|0)+136>>2]|0)==(c[j+(e*5640|0)+424+(f*148|0)+96>>2]|0))return(Sf(h+-1|0,d,e,f,g)|0)!=0|0;else{e=1;return e|0}if((c[j+(e*5640|0)+424+(f*148|0)+140>>2]|0)!=(c[j+(e*5640|0)+424+(f*148|0)+104>>2]|0)){e=1;return e|0}if((c[j+(e*5640|0)+424+(f*148|0)+144>>2]|0)==(c[j+(e*5640|0)+424+(f*148|0)+112>>2]|0))return(Sf(h+-1|0,d,e,f,g)|0)!=0|0;else{e=1;return e|0}}return 0}function Tf(b){b=b|0;var d=0,e=0;d=Qc(1,44)|0;if(!d){b=0;return b|0}e=d+40|0;a[e>>0]=a[e>>0]&-2|(b|0)!=0;b=Qc(1,4)|0;c[d+20>>2]=b;if(b){e=d;return e|0}Uc(d);e=0;return e|0}function Uf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0.0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;O=i;i=i+1200|0;N=O;e=c[c[a+20>>2]>>2]|0;M=e+16|0;f=c[M>>2]|0;if(!f){i=O;return}J=e+20|0;K=(c[a+32>>2]|0)+8|0;L=(c[a+28>>2]|0)+88|0;H=a+24|0;I=(b|0)==0;F=(d|0)==0;G=b+-1|0;e=f;E=0;do{j=c[J>>2]|0;k=c[K>>2]|0;C=c[j+(E*52|0)+16>>2]|0;if(k){if(C){a=c[L>>2]|0;g=+((c[(c[(c[H>>2]|0)+24>>2]|0)+(E*52|0)+24>>2]|0)>>>0)*.0625;f=0;do{d=_(C,f)|0;h=0;do{D=(d+h|0)*3|0;c[N+(f*120|0)+(h*12|0)>>2]=~~(+(c[a+(D<<2)>>2]|0)*g);c[N+(f*120|0)+(h*12|0)+4>>2]=~~(+(c[a+(D+1<<2)>>2]|0)*g);c[N+(f*120|0)+(h*12|0)+8>>2]=~~(+(c[a+(D+2<<2)>>2]|0)*g);h=h+1|0}while(h>>>0>>0);f=f+1|0}while(f>>>0>>0);D=9}}else D=9;if((D|0)==9){D=0;if(C){w=j+(E*52|0)+24|0;B=0;do{x=c[w>>2]|0;y=x+(B*136|0)+24|0;e=c[y>>2]|0;if(e){z=x+(B*136|0)+16|0;A=x+(B*136|0)+20|0;a=c[A>>2]|0;d=c[z>>2]|0;v=0;do{if(_(a,d)|0){s=x+(B*136|0)+28+(v*36|0)+20|0;t=N+(b*120|0)+(B*12|0)+(v<<2)|0;u=N+(G*120|0)+(B*12|0)+(v<<2)|0;r=0;do{e=c[s>>2]|0;q=_(c[e+(r*40|0)+20>>2]|0,c[e+(r*40|0)+16>>2]|0)|0;if(q){m=e+(r*40|0)+24|0;n=c[t>>2]|0;p=0;do{k=c[m>>2]|0;l=k+(p*52|0)|0;o=c[k+(p*52|0)+4>>2]|0;e=(c[(c[(c[H>>2]|0)+24>>2]|0)+(E*52|0)+24>>2]|0)-(c[k+(p*52|0)+28>>2]|0)|0;if(!I){a=c[u>>2]|0;d=n-a|0;if((a|0)<=(e|0)){d=d+(a-e)|0;d=(d|0)<0?0:d}}else{c[k+(p*52|0)+44>>2]=0;d=(n|0)>(e|0)?n-e|0:0}j=k+(p*52|0)+44|0;f=c[j>>2]|0;h=(f|0)==0;if(h)if(!d)d=0;else d=(d*3|0)+-2|0;else d=(d*3|0)+f|0;c[o+(b*24|0)>>2]=d-f;do{if((d|0)!=(f|0)){a=c[k+(p*52|0)+8>>2]|0;e=c[a+((d+-1|0)*24|0)>>2]|0;if(h)c[o+(b*24|0)+16>>2]=c[l>>2];else{k=c[a+((f+-1|0)*24|0)>>2]|0;c[o+(b*24|0)+16>>2]=(c[l>>2]|0)+k;e=e-k|0}c[o+(b*24|0)+4>>2]=e;if(F)break;c[j>>2]=d}}while(0);p=p+1|0}while(p>>>0>>0);a=c[A>>2]|0;d=c[z>>2]|0}r=r+1|0}while(r>>>0<(_(a,d)|0)>>>0);e=c[y>>2]|0}v=v+1|0}while(v>>>0>>0)}B=B+1|0}while(B>>>0>>0);e=c[M>>2]|0}}E=E+1|0}while(E>>>0>>0);i=O;return}function Vf(a,b,d,e){a=a|0;b=b|0;d=+d;e=e|0;var f=0,g=0.0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;a=c[c[a+20>>2]>>2]|0;G=a+40+(b<<3)|0;h[G>>3]=0.0;H=a+16|0;f=c[H>>2]|0;if(!f)return;E=a+20|0;F=(b|0)==0;D=(e|0)==0;a=f;C=0;do{f=c[E>>2]|0;B=c[f+(C*52|0)+16>>2]|0;if(B){v=f+(C*52|0)+24|0;A=0;do{w=c[v>>2]|0;x=w+(A*136|0)+24|0;a=c[x>>2]|0;if(a){y=w+(A*136|0)+16|0;z=w+(A*136|0)+20|0;f=c[z>>2]|0;e=c[y>>2]|0;u=0;do{if(_(f,e)|0){t=w+(A*136|0)+28+(u*36|0)+20|0;s=0;do{a=c[t>>2]|0;r=_(c[a+(s*40|0)+20>>2]|0,c[a+(s*40|0)+16>>2]|0)|0;if(r){n=a+(s*40|0)+24|0;q=0;do{k=c[n>>2]|0;l=k+(q*52|0)|0;o=c[k+(q*52|0)+4>>2]|0;p=k+(q*52|0)+44|0;if(F){c[p>>2]=0;m=0}else m=c[p>>2]|0;e=c[k+(q*52|0)+48>>2]|0;if(m>>>0>>0){i=c[k+(q*52|0)+8>>2]|0;a=m;j=m;do{f=c[i+(j*24|0)>>2]|0;g=+h[i+(j*24|0)+8>>3];if(a){J=a+-1|0;g=g-+h[i+(J*24|0)+8>>3];f=f-(c[i+(J*24|0)>>2]|0)|0}do{if(!f){if(!(g!=0.0))break;a=j+1|0}else{if(!(d-g/+(f>>>0)<2.220446049250313e-16))break;a=j+1|0}}while(0);j=j+1|0}while(j>>>0>>0);i=a;c[o+(b*24|0)>>2]=i-m;if((i|0)!=(m|0)){e=i+-1|0;f=c[k+(q*52|0)+8>>2]|0;a=c[f+(e*24|0)>>2]|0;if(!m){c[o+(b*24|0)+16>>2]=c[l>>2];g=+h[f+(e*24|0)+8>>3]}else{m=m+-1|0;J=c[f+(m*24|0)>>2]|0;c[o+(b*24|0)+16>>2]=(c[l>>2]|0)+J;g=+h[f+(e*24|0)+8>>3]-+h[f+(m*24|0)+8>>3];a=a-J|0}c[o+(b*24|0)+4>>2]=a;h[o+(b*24|0)+8>>3]=g;h[G>>3]=g+ +h[G>>3];if(!D)c[p>>2]=i}else I=26}else{c[o+(b*24|0)>>2]=0;I=26}if((I|0)==26){I=0;h[o+(b*24|0)+8>>3]=0.0}q=q+1|0}while(q>>>0>>0);f=c[z>>2]|0;e=c[y>>2]|0}s=s+1|0}while(s>>>0<(_(f,e)|0)>>>0);a=c[x>>2]|0}u=u+1|0}while(u>>>0>>0)}A=A+1|0}while(A>>>0>>0);a=c[H>>2]|0}C=C+1|0}while(C>>>0>>0);return}function Wf(d,e,f,j,k){d=d|0;e=e|0;f=f|0;j=j|0;k=k|0;var l=0,m=0,n=0.0,o=0.0,p=0.0,q=0.0,r=0.0,s=0.0,t=0,u=0,v=0,w=0,x=0.0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0.0,K=0,L=0,M=0,N=0,O=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0;W=i;i=i+800|0;V=W;S=c[d+28>>2]|0;T=c[c[d+20>>2]>>2]|0;U=c[d+32>>2]|0;O=T+24|0;c[O>>2]=0;Q=c[T+16>>2]|0;if(!Q){l=0;J=0.0;n=0.0;p=1797693134862315708145274.0e284}else{M=c[T+20>>2]|0;N=c[(c[d+24>>2]|0)+24>>2]|0;l=0;R=0;o=0.0;n=0.0;p=1797693134862315708145274.0e284;do{I=M+(R*52|0)+48|0;c[I>>2]=0;K=c[M+(R*52|0)+16>>2]|0;if(!K)m=0;else{L=c[M+(R*52|0)+24>>2]|0;m=0;H=0;do{E=c[L+(H*136|0)+24>>2]|0;if(E){F=_(c[L+(H*136|0)+20>>2]|0,c[L+(H*136|0)+16>>2]|0)|0;G=(F|0)==0;D=0;do{if(!G){C=c[L+(H*136|0)+28+(D*36|0)+20>>2]|0;B=0;do{z=_(c[C+(B*40|0)+20>>2]|0,c[C+(B*40|0)+16>>2]|0)|0;if(z){A=c[C+(B*40|0)+24>>2]|0;y=0;do{v=c[A+(y*52|0)+48>>2]|0;if(v){w=c[A+(y*52|0)+8>>2]|0;u=0;do{t=c[w+(u*24|0)>>2]|0;q=+h[w+(u*24|0)+8>>3];if(u){X=u+-1|0;q=q-+h[w+(X*24|0)+8>>3];t=t-(c[w+(X*24|0)>>2]|0)|0}do{if(t){q=q/+(t|0);p=qo))break;o=q}}while(0);u=u+1|0}while(u>>>0>>0)}X=_((c[A+(y*52|0)+24>>2]|0)-(c[A+(y*52|0)+16>>2]|0)|0,(c[A+(y*52|0)+20>>2]|0)-(c[A+(y*52|0)+12>>2]|0)|0)|0;l=X+l|0;m=X+m|0;y=y+1|0}while(y>>>0>>0);c[O>>2]=l;c[I>>2]=m}B=B+1|0}while(B>>>0>>0)}D=D+1|0}while(D>>>0>>0)}H=H+1|0}while(H>>>0>>0)}J=+(1<>2]|0)+-1.0;n=n+ +(m|0)*(J*J);R=R+1|0}while(R>>>0>>0);J=o}I=(k|0)!=0;if(I){R=c[d+36>>2]|0;Q=c[k+88>>2]|0;c[Q+(R*592|0)+552>>2]=l;h[Q+(R*592|0)+560>>3]=+h[T+32>>3];l=U+8|0;X=Pc(c[l>>2]<<3)|0;c[Q+(R*592|0)>>2]=X;if(!X){X=0;i=W;return X|0}}else l=U+8|0;if(!(c[l>>2]|0)){X=1;i=W;return X|0}z=T+32|0;A=S+93|0;B=d+36|0;C=k+88|0;D=T+40|0;E=d+24|0;F=d+8|0;G=d+16|0;H=0;while(1){o=+g[U+20+(H<<2)>>2];if(o!=0.0){w=~~+Z(+o)>>>0;w=w>>>0>>0?w:j}else w=j;s=+g[U+5184+(H<<2)>>2];x=+h[z>>3]-n/+P(10.0,+(s/10.0));X=a[A>>0]|0;if(!((X&1)!=0&o>0.0)?!((X&4)!=0&s>0.0):0)o=p;else{y=dh(c[E>>2]|0,S)|0;if(!y){l=0;m=57;break}v=H+1|0;m=V+(H+-1<<3)|0;t=T+40+(H<<3)|0;if(!H){r=J;m=0;s=p;q=0.0;do{o=(s+r)*.5;Vf(d,0,o,0);do{if(a[A>>0]&4){if(((b[S>>1]|0)+-3&65535)>=4){X=+h[D>>3]>2]|0,T,v,e,f,w,k,c[F>>2]|0,c[d>>2]|0,c[G>>2]|0,0)|0))s=o;else{X=+h[D>>3]>2]|0,T,v,e,f,w,k,c[F>>2]|0,c[d>>2]|0,c[G>>2]|0,0)|0)==0;r=X?r:o;s=X?o:s;q=X?q:o}}while(0);m=m+1|0}while((m|0)!=128)}else{r=J;u=0;s=p;q=0.0;do{o=(s+r)*.5;Vf(d,H,o,0);do{if(a[A>>0]&4){if(((b[S>>1]|0)+-3&65535)>=4){X=+h[m>>3]+ +h[t>>3]>2]|0,T,v,e,f,w,k,c[F>>2]|0,c[d>>2]|0,c[G>>2]|0,0)|0))s=o;else{X=+h[m>>3]+ +h[t>>3]>2]|0,T,v,e,f,w,k,c[F>>2]|0,c[d>>2]|0,c[G>>2]|0,0)|0)==0;r=X?r:o;s=X?o:s;q=X?q:o}}while(0);u=u+1|0}while((u|0)!=128)}eh(y);o=q==0.0?o:q}if(I)h[(c[(c[C>>2]|0)+((c[B>>2]|0)*592|0)>>2]|0)+(H<<3)>>3]=o;Vf(d,H,o,1);if(!H)o=+h[D>>3];else o=+h[V+(H+-1<<3)>>3]+ +h[T+40+(H<<3)>>3];h[V+(H<<3)>>3]=o;H=H+1|0;if(H>>>0>=(c[l>>2]|0)>>>0){l=1;m=57;break}}if((m|0)==57){i=W;return l|0}return 0}function Xf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;c[a+24>>2]=b;c[a+28>>2]=d;f=Qc(1,848)|0;e=a+20|0;c[c[e>>2]>>2]=f;if(!f){a=0;return a|0}f=b+16|0;g=Qc(c[f>>2]|0,52)|0;b=c[c[e>>2]>>2]|0;c[b+20>>2]=g;if(!g){g=0;return g|0}c[b+16>>2]=c[f>>2];c[a>>2]=c[d+84>>2];g=1;return g|0}function Yf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;if(!b)return;s=b+20|0;d=c[s>>2]|0;do{if(d){r=(a[b+40>>0]&1)==0?3:4;e=c[d>>2]|0;if(e){o=e+20|0;k=e+16|0;if(c[k>>2]|0){m=0;n=c[o>>2]|0;while(1){l=n+24|0;d=c[l>>2]|0;if(d){i=c[n+28>>2]|0;j=(i>>>0)/136|0;if(i>>>0>135){i=0;while(1){h=d+48|0;e=c[h>>2]|0;if(e){f=c[d+52>>2]|0;g=(f>>>0)/40|0;if(f>>>0>39){f=0;while(1){t=e+32|0;mg(c[t>>2]|0);c[t>>2]=0;t=e+36|0;mg(c[t>>2]|0);c[t>>2]=0;Ta[r&7](e);f=f+1|0;if(f>>>0>=g>>>0)break;else e=e+40|0}e=c[h>>2]|0}Uc(e);c[h>>2]=0}h=d+84|0;e=c[h>>2]|0;if(e){t=c[d+88>>2]|0;g=(t>>>0)/40|0;if(t>>>0>39){f=0;while(1){t=e+32|0;mg(c[t>>2]|0);c[t>>2]=0;t=e+36|0;mg(c[t>>2]|0);c[t>>2]=0;Ta[r&7](e);f=f+1|0;if(f>>>0>=g>>>0)break;else e=e+40|0}e=c[h>>2]|0}Uc(e);c[h>>2]=0}h=d+120|0;e=c[h>>2]|0;if(e){t=c[d+124>>2]|0;g=(t>>>0)/40|0;if(t>>>0>39){f=0;while(1){t=e+32|0;mg(c[t>>2]|0);c[t>>2]=0;t=e+36|0;mg(c[t>>2]|0);c[t>>2]=0;Ta[r&7](e);f=f+1|0;if(f>>>0>=g>>>0)break;else e=e+40|0}e=c[h>>2]|0}Uc(e);c[h>>2]=0}i=i+1|0;if(i>>>0>=j>>>0)break;else d=d+136|0}d=c[l>>2]|0}Uc(d);c[l>>2]=0}if((c[n+36>>2]|0)!=0?(p=n+32|0,q=c[p>>2]|0,(q|0)!=0):0){Sc(q);c[p>>2]=0;c[p+4>>2]=0;c[p+8>>2]=0;c[p+12>>2]=0}m=m+1|0;if(m>>>0>=(c[k>>2]|0)>>>0)break;else n=n+52|0}}Uc(c[o>>2]|0);c[o>>2]=0;Uc(c[c[s>>2]>>2]|0);d=c[s>>2]|0;c[d>>2]=0;if(!d)break}Uc(d);c[s>>2]=0}}while(0);Uc(b);return}function Zf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;e=a+32|0;f=c[e>>2]|0;b=a+40|0;d=c[b>>2]|0;if(f){g=a+44|0;if(d>>>0<=(c[g>>2]|0)>>>0){a=1;return a|0}if(c[a+36>>2]|0){Sc(f);f=Rc(c[b>>2]|0)|0;c[e>>2]=f;if(!f){c[g>>2]=0;c[b>>2]=0;c[a+36>>2]=0;a=0;return a|0}else{c[g>>2]=c[b>>2];c[a+36>>2]=1;a=1;return a|0}}}g=Rc(d)|0;c[e>>2]=g;if(!g){a=0;return a|0}c[a+44>>2]=c[b>>2];c[a+36>>2]=1;a=1;return a|0}function _f(a,b,c){a=a|0;b=b|0;c=c|0;return ig(a,b,1,1.0,52,c)|0}function $f(a,b,c){a=a|0;b=b|0;c=c|0;return ig(a,b,0,.5,56,c)|0}function ag(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;d=c[a+24>>2]|0;f=c[d+16>>2]|0;if(!f){g=0;return g|0}g=0;b=0;e=c[d+24>>2]|0;d=c[(c[c[a+20>>2]>>2]|0)+20>>2]|0;while(1){i=c[e+24>>2]|0;i=((i&7|0)!=0&1)+(i>>>3)|0;h=c[d+24>>2]|0;a=(c[d+20>>2]|0)+-1|0;b=(_(_((i|0)==3?4:i,(c[h+(a*136|0)+8>>2]|0)-(c[h+(a*136|0)>>2]|0)|0)|0,(c[h+(a*136|0)+12>>2]|0)-(c[h+(a*136|0)+4>>2]|0)|0)|0)+b|0;g=g+1|0;if(g>>>0>=f>>>0)break;else{e=e+52|0;d=d+52|0}}return b|0}function bg(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;y=i;i=i+16|0;w=y;if(!(c[b+8>>2]|0)){c[b+36>>2]=d;u=b+28|0;j=c[(c[u>>2]|0)+76>>2]|0;x=b+32|0;c[x>>2]=j+(d*5640|0);v=(h|0)==0;t=b+20|0;if(!v){k=c[(c[c[t>>2]>>2]|0)+20>>2]|0;o=c[j+(d*5640|0)+5584>>2]|0;p=k+16|0;if(!(c[p>>2]|0)){k=h+88|0;j=0}else{l=c[k+24>>2]|0;k=h+88|0;m=c[k>>2]|0;n=0;j=0;do{s=l+(n*136|0)+16|0;c[m+(d*592|0)+20+(n<<2)>>2]=c[s>>2];r=l+(n*136|0)+20|0;c[m+(d*592|0)+152+(n<<2)>>2]=c[r>>2];j=(_(c[r>>2]|0,c[s>>2]|0)|0)+j|0;c[m+(d*592|0)+284+(n<<2)>>2]=c[o+812+(n<<2)>>2];c[m+(d*592|0)+416+(n<<2)>>2]=c[o+944+(n<<2)>>2];n=n+1|0}while(n>>>0<(c[p>>2]|0)>>>0)}s=Qc(_(_(c[h+52>>2]|0,j)|0,c[h+56>>2]|0)|0,32)|0;c[(c[k>>2]|0)+(d*592|0)+548>>2]=s;if(!s){b=0;i=y;return b|0}}j=c[c[t>>2]>>2]|0;s=j+16|0;if(!(c[s>>2]|0)){n=c[x>>2]|0;l=0;k=c[j+20>>2]|0}else{n=c[x>>2]|0;k=c[j+20>>2]|0;d=0;q=c[n+5584>>2]|0;r=k;while(1){o=c[r+32>>2]|0;p=_((c[r+12>>2]|0)-(c[r+4>>2]|0)|0,(c[r+8>>2]|0)-(c[r>>2]|0)|0)|0;j=(p|0)==0;if((c[q+20>>2]|0)==1){if(!j){l=q+1076|0;m=0;j=o;while(1){c[j>>2]=(c[j>>2]|0)-(c[l>>2]|0);m=m+1|0;if((m|0)==(p|0))break;else j=j+4|0}}}else if(!j){l=q+1076|0;m=0;j=o;while(1){c[j>>2]=(c[j>>2]|0)-(c[l>>2]|0)<<11;m=m+1|0;if((m|0)==(p|0))break;else j=j+4|0}}d=d+1|0;l=c[s>>2]|0;if(d>>>0>=l>>>0)break;else{q=q+1080|0;r=r+52|0}}}o=_((c[k+12>>2]|0)-(c[k+4>>2]|0)|0,(c[k+8>>2]|0)-(c[k>>2]|0)|0)|0;a:do{switch(c[n+16>>2]|0){case 0:break;case 2:{if(c[n+5608>>2]|0){m=Pc(l<<2)|0;if(!m){b=0;i=y;return b|0}j=c[s>>2]|0;if(!j)j=0;else{l=0;while(1){c[m+(l<<2)>>2]=c[k+32>>2];l=l+1|0;if((l|0)==(j|0))break;else k=k+52|0}}s=(Gf(c[(c[x>>2]|0)+5608>>2]|0,o,m,j,c[(c[(c[b+24>>2]|0)+24>>2]|0)+32>>2]|0)|0)==0;Uc(m);if(s){b=0;i=y;return b|0}}break}default:{l=c[k+32>>2]|0;m=c[k+84>>2]|0;j=c[k+136>>2]|0;if(!(c[(c[n+5584>>2]|0)+20>>2]|0)){Ef(l,m,j,o);break a}else{Cf(l,m,j,o);break a}}}}while(0);j=c[c[t>>2]>>2]|0;k=j+16|0;b:do{if(c[k>>2]|0){l=0;m=c[(c[x>>2]|0)+5584>>2]|0;j=c[j+20>>2]|0;c:while(1){switch(c[m+20>>2]|0){case 1:{if(!(Fg(j)|0)){j=0;k=54;break c}break}case 0:{if(!(Jg(j)|0)){j=0;k=54;break c}break}default:{}}l=l+1|0;if(l>>>0>=(c[k>>2]|0)>>>0)break b;else{m=m+1080|0;j=j+52|0}}if((k|0)==54){i=y;return j|0}}}while(0);j=c[x>>2]|0;k=Wg(1)|0;if(!k){b=0;i=y;return b|0}do{if((c[j+16>>2]|0)==1)if(!(c[(c[j+5584>>2]|0)+20>>2]|0)){l=Bf()|0;m=3;break}else{l=Af()|0;m=3;break}else{l=c[j+5600>>2]|0;m=c[(c[b+24>>2]|0)+16>>2]|0}}while(0);t=Zg(k,c[c[t>>2]>>2]|0,j,l,m)|0;Xg(k);if(!t){b=0;i=y;return b|0}j=c[u>>2]|0;c[w>>2]=0;if(!v)c[h+12>>2]=0;if(!(a[j+93>>0]&5)){if(c[(c[x>>2]|0)+8>>2]|0){j=0;do{Uf(b,j,1);j=j+1|0}while(j>>>0<(c[(c[x>>2]|0)+8>>2]|0)>>>0)}}else if(!(Wf(b,e,w,g,h)|0)){b=0;i=y;return b|0}}if(h)c[h+12>>2]=1;j=dh(c[b+24>>2]|0,c[b+28>>2]|0)|0;if(!j)j=1;else{b=bh(j,c[b+36>>2]|0,c[c[b+20>>2]>>2]|0,c[(c[b+32>>2]|0)+8>>2]|0,e,f,g,h,c[b+4>>2]|0,c[b>>2]|0,c[b+16>>2]|0,1)|0;eh(j);j=(b|0)==0}b=j&1^1;i=y;return b|0}function cg(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+16|0;m=u+8|0;l=u;k=u+12|0;j=a+36|0;c[j>>2]=e;t=c[a+28>>2]|0;p=a+32|0;c[p>>2]=(c[t+76>>2]|0)+(e*5640|0);c[k>>2]=0;o=a+24|0;e=dh(c[o>>2]|0,t)|0;if(!e){t=0;i=u;return t|0}n=a+20|0;t=ch(e,c[j>>2]|0,c[c[n>>2]>>2]|0,b,k,d,f,h)|0;eh(e);if(!t){t=0;i=u;return t|0}e=c[c[n>>2]>>2]|0;a=c[(c[p>>2]|0)+5584>>2]|0;j=c[e+20>>2]|0;d=Wg(0)|0;if(!d){t=0;i=u;return t|0}k=e+16|0;a:do{if(c[k>>2]|0){f=0;e=j;while(1){if(!(Yg(d,e,a)|0))break;f=f+1|0;if(f>>>0>=(c[k>>2]|0)>>>0)break a;else{a=a+1080|0;e=e+52|0}}Xg(d);t=0;i=u;return t|0}}while(0);Xg(d);e=c[c[n>>2]>>2]|0;j=e+16|0;do{if(c[j>>2]|0){k=0;f=c[(c[o>>2]|0)+24>>2]|0;d=c[(c[p>>2]|0)+5584>>2]|0;a=c[e+20>>2]|0;while(1){e=(c[f+36>>2]|0)+1|0;if((c[d+20>>2]|0)==1){if(!(Gg(a,e)|0)){e=0;a=49;break}}else if(!(Ng(a,e)|0)){e=0;a=49;break}k=k+1|0;if(k>>>0>=(c[j>>2]|0)>>>0){a=14;break}else{f=f+52|0;d=d+1080|0;a=a+52|0}}if((a|0)==14){e=c[c[n>>2]>>2]|0;break}else if((a|0)==49){i=u;return e|0}}}while(0);k=c[p>>2]|0;a=c[e+20>>2]|0;j=c[k+16>>2]|0;do{if(j){b=_((c[a+12>>2]|0)-(c[a+4>>2]|0)|0,(c[a+8>>2]|0)-(c[a>>2]|0)|0)|0;d=e+16|0;e=c[d>>2]|0;if(e>>>0<=2){c[m>>2]=e;Ub(h,1,19703,m)|0;break}if((_((c[a+64>>2]|0)-(c[a+56>>2]|0)|0,(c[a+60>>2]|0)-(c[a+52>>2]|0)|0)|0)>=(b|0)?(_((c[a+116>>2]|0)-(c[a+108>>2]|0)|0,(c[a+112>>2]|0)-(c[a+104>>2]|0)|0)|0)>=(b|0):0){if((j|0)!=2){e=c[a+32>>2]|0;if((c[(c[k+5584>>2]|0)+20>>2]|0)==1){Df(e,c[a+84>>2]|0,c[a+136>>2]|0,b);break}else{Ff(e,c[a+84>>2]|0,c[a+136>>2]|0,b);break}}f=k+5604|0;if(!(c[f>>2]|0))break;k=Pc(e<<2)|0;if(!k){t=0;i=u;return t|0}e=c[d>>2]|0;if(!e)e=0;else{j=0;while(1){c[k+(j<<2)>>2]=c[a+32>>2];j=j+1|0;if((j|0)==(e|0))break;else a=a+52|0}}t=(Hf(c[f>>2]|0,b,k,e,c[(c[(c[o>>2]|0)+24>>2]|0)+32>>2]|0)|0)==0;Uc(k);if(t)e=0;else break;i=u;return e|0}Ub(h,1,19642,l)|0;t=0;i=u;return t|0}}while(0);e=c[c[n>>2]>>2]|0;s=e+16|0;if(!(c[s>>2]|0)){t=1;i=u;return t|0}t=0;r=c[(c[o>>2]|0)+24>>2]|0;q=c[(c[p>>2]|0)+5584>>2]|0;p=c[e+20>>2]|0;while(1){o=c[p+24>>2]|0;h=c[r+36>>2]|0;j=c[o+(h*136|0)+8>>2]|0;k=c[o+(h*136|0)>>2]|0;n=j-k|0;f=c[o+(h*136|0)+12>>2]|0;h=c[o+(h*136|0)+4>>2]|0;o=(c[p+8>>2]|0)-(c[p>>2]|0)-n|0;e=c[r+24>>2]|0;if(!(c[r+32>>2]|0)){e=1<>2]|0;a=(f|0)==(h|0);if((c[q+20>>2]|0)==1){if(!a){d=(j|0)==(k|0);b=q+1076|0;k=f-h|0;f=0;while(1){if(!d){a=0;j=e;while(1){h=(c[b>>2]|0)+(c[j>>2]|0)|0;c[j>>2]=(h|0)<(m|0)?m:(h|0)>(l|0)?l:h;a=a+1|0;if((a|0)==(n|0))break;else j=j+4|0}e=e+(n<<2)|0}f=f+1|0;if((f|0)==(k|0))break;else e=e+(o<<2)|0}}}else if(!a){d=(j|0)==(k|0);b=q+1076|0;k=f-h|0;f=0;while(1){if(!d){a=0;j=e;while(1){h=Hh(+g[j>>2])|0;h=(c[b>>2]|0)+h|0;c[j>>2]=(h|0)<(m|0)?m:(h|0)>(l|0)?l:h;a=a+1|0;if((a|0)==(n|0))break;else j=j+4|0}e=e+(n<<2)|0}f=f+1|0;if((f|0)==(k|0))break;else e=e+(o<<2)|0}}t=t+1|0;if(t>>>0>=(c[s>>2]|0)>>>0){e=1;break}else{r=r+52|0;q=q+1080|0;p=p+52|0}}i=u;return e|0}function dg(d,e,f){d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=d+24|0;m=c[q>>2]|0;h=c[m+16>>2]|0;l=(h|0)==0;if(l){q=1;return q|0}i=0;g=0;j=c[m+24>>2]|0;k=c[(c[c[d+20>>2]>>2]|0)+20>>2]|0;while(1){n=c[j+24>>2]|0;n=((n&7|0)!=0&1)+(n>>>3)|0;o=c[k+24>>2]|0;p=(c[k+20>>2]|0)+-1|0;g=(_(_((n|0)==3?4:n,(c[o+(p*136|0)+8>>2]|0)-(c[o+(p*136|0)>>2]|0)|0)|0,(c[o+(p*136|0)+12>>2]|0)-(c[o+(p*136|0)+4>>2]|0)|0)|0)+g|0;i=i+1|0;if((i|0)==(h|0))break;else{j=j+52|0;k=k+52|0}}g=g>>>0>f>>>0;if(g|l){q=g&1^1;return q|0}p=0;o=c[m+24>>2]|0;n=c[(c[c[d+20>>2]>>2]|0)+20>>2]|0;while(1){l=c[o+24>>2]|0;d=c[n+24>>2]|0;f=c[o+36>>2]|0;i=c[d+(f*136|0)+8>>2]|0;j=c[d+(f*136|0)>>2]|0;m=i-j|0;k=c[d+(f*136|0)+12>>2]|0;f=c[d+(f*136|0)+4>>2]|0;d=(c[n+8>>2]|0)-(c[n>>2]|0)-m|0;l=((l&7|0)!=0&1)+(l>>>3)|0;a:do{switch(((l|0)==3?4:l)|0){case 1:{g=c[n+32>>2]|0;h=(k|0)==(f|0);if(!(c[o+32>>2]|0)){if(h)break a;l=(i|0)==(j|0);k=k-f|0;f=0;while(1){if(!l){j=e+m|0;i=0;h=g;while(1){a[e>>0]=c[h>>2];i=i+1|0;if((i|0)==(m|0))break;else{e=e+1|0;h=h+4|0}}e=j;g=g+(m<<2)|0}f=f+1|0;if((f|0)==(k|0))break;else g=g+(d<<2)|0}}else{if(h)break a;l=(i|0)==(j|0);k=k-f|0;f=0;while(1){if(!l){j=e+m|0;i=0;h=g;while(1){a[e>>0]=c[h>>2];i=i+1|0;if((i|0)==(m|0))break;else{e=e+1|0;h=h+4|0}}e=j;g=g+(m<<2)|0}f=f+1|0;if((f|0)==(k|0))break;else g=g+(d<<2)|0}}break}case 2:{g=c[n+32>>2]|0;h=(k|0)==(f|0);if(!(c[o+32>>2]|0)){if(!h){l=(i|0)==(j|0);k=k-f|0;f=0;while(1){if(!l){j=e+(m<<1)|0;i=0;h=g;while(1){b[e>>1]=c[h>>2];i=i+1|0;if((i|0)==(m|0))break;else{e=e+2|0;h=h+4|0}}e=j;g=g+(m<<2)|0}f=f+1|0;if((f|0)==(k|0))break;else g=g+(d<<2)|0}}}else if(!h){l=(i|0)==(j|0);k=k-f|0;f=0;while(1){if(!l){j=e+(m<<1)|0;i=0;h=g;while(1){b[e>>1]=c[h>>2];i=i+1|0;if((i|0)==(m|0))break;else{e=e+2|0;h=h+4|0}}e=j;g=g+(m<<2)|0}f=f+1|0;if((f|0)==(k|0))break;else g=g+(d<<2)|0}}break}case 4:{if((k|0)!=(f|0)){l=(i|0)==(j|0);k=k-f|0;f=0;g=c[n+32>>2]|0;while(1){if(!l){j=e+(m<<2)|0;i=0;h=g;while(1){c[e>>2]=c[h>>2];i=i+1|0;if((i|0)==(m|0))break;else{e=e+4|0;h=h+4|0}}e=j;g=g+(m<<2)|0}f=f+1|0;if((f|0)==(k|0))break;else g=g+(d<<2)|0}}break}default:{}}}while(0);p=p+1|0;if(p>>>0>=(c[(c[q>>2]|0)+16>>2]|0)>>>0){e=1;break}else{o=o+52|0;n=n+52|0}}return e|0}function eg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;d=c[a+24>>2]|0;f=c[d+16>>2]|0;if(!f){g=0;return g|0}g=0;b=0;e=c[d+24>>2]|0;d=c[(c[c[a+20>>2]>>2]|0)+20>>2]|0;while(1){a=c[e+24>>2]|0;a=((a&7|0)!=0&1)+(a>>>3)|0;b=(_(_((c[d+12>>2]|0)-(c[d+4>>2]|0)|0,(c[d+8>>2]|0)-(c[d>>2]|0)|0)|0,(a|0)==3?4:a)|0)+b|0;g=g+1|0;if(g>>>0>=f>>>0)break;else{e=e+52|0;d=d+52|0}}return b|0}function fg(f,g,h){f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;o=c[f+24>>2]|0;q=o+16|0;j=c[q>>2]|0;n=(j|0)==0;if(n)i=0;else{k=0;i=0;l=c[o+24>>2]|0;m=c[(c[c[f+20>>2]>>2]|0)+20>>2]|0;while(1){p=c[l+24>>2]|0;p=((p&7|0)!=0&1)+(p>>>3)|0;i=(_(_((c[m+12>>2]|0)-(c[m+4>>2]|0)|0,(c[m+8>>2]|0)-(c[m>>2]|0)|0)|0,(p|0)==3?4:p)|0)+i|0;k=k+1|0;if((k|0)==(j|0))break;else{l=l+52|0;m=m+52|0}}}i=(i|0)!=(h|0);if(i|n){q=i&1^1;return q|0}p=0;n=c[o+24>>2]|0;h=c[(c[c[f+20>>2]>>2]|0)+20>>2]|0;while(1){f=c[n+24>>2]|0;i=(c[h+8>>2]|0)-(c[h>>2]|0)|0;j=(c[h+12>>2]|0)-(c[h+4>>2]|0)|0;m=_(j,i)|0;f=((f&7|0)!=0&1)+(f>>>3)|0;a:do{switch(((f|0)==3?4:f)|0){case 1:{j=c[h+32>>2]|0;i=(m|0)==0;if(!(c[n+32>>2]|0)){if(i)break a;else{k=0;i=j;j=g}while(1){c[i>>2]=d[j>>0];k=k+1|0;if((k|0)==(m|0))break;else{i=i+4|0;j=j+1|0}}g=g+m|0;break a}else{if(i)break a;else{k=0;i=j;j=g}while(1){c[i>>2]=a[j>>0];k=k+1|0;if((k|0)==(m|0))break;else{i=i+4|0;j=j+1|0}}g=g+m|0;break a}}case 2:{l=c[h+32>>2]|0;k=(m|0)==0;if(!(c[n+32>>2]|0)){if(!k){k=g+(_(j<<1,i)|0)|0;j=0;i=l;while(1){c[i>>2]=e[g>>1];j=j+1|0;if((j|0)==(m|0))break;else{i=i+4|0;g=g+2|0}}g=k}}else if(!k){k=g+(_(j<<1,i)|0)|0;j=0;i=l;while(1){c[i>>2]=b[g>>1];j=j+1|0;if((j|0)==(m|0))break;else{i=i+4|0;g=g+2|0}}g=k}break}case 4:{if(m){k=g+(_(j<<2,i)|0)|0;i=0;j=c[h+32>>2]|0;while(1){c[j>>2]=c[g>>2];i=i+1|0;if((i|0)==(m|0))break;else{j=j+4|0;g=g+4|0}}g=k}break}default:{}}}while(0);p=p+1|0;if(p>>>0>=(c[q>>2]|0)>>>0){g=1;break}else{n=n+52|0;h=h+52|0}}return g|0}function gg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;g=a+24|0;b=c[g>>2]|0;if(!b)return;f=c[a+28>>2]|0;e=(f>>>0)/52|0;if(f>>>0>51){f=0;while(1){a=c[b>>2]|0;if(a){Uc(a+-1|0);c[b>>2]=0}a=b+4|0;d=c[a>>2]|0;if(d){Uc(d);c[a>>2]=0}a=b+8|0;d=c[a>>2]|0;if(d){Uc(d);c[a>>2]=0}f=f+1|0;if(f>>>0>=e>>>0)break;else b=b+52|0}b=c[g>>2]|0}Uc(b);c[g>>2]=0;return}function hg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;g=a+24|0;b=c[g>>2]|0;if(!b)return;f=c[a+28>>2]|0;e=(f>>>0)/56|0;if(f>>>0>55){f=0;while(1){a=c[b>>2]|0;if(a){Uc(a);c[b>>2]=0}d=b+4|0;a=c[d>>2]|0;if(a){Uc(a);c[d>>2]=0}f=f+1|0;if(f>>>0>=e>>>0)break;else b=b+56|0}b=c[g>>2]|0}Uc(b);c[g>>2]=0;return}function ig(b,d,e,f,h,j){b=b|0;d=d|0;e=e|0;f=+f;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0.0;Sa=i;i=i+80|0;La=Sa+64|0;Ka=Sa+56|0;Na=Sa+48|0;Pa=Sa+40|0;Oa=Sa+32|0;Qa=Sa+24|0;Ma=Sa+16|0;Ja=Sa+8|0;k=c[b+28>>2]|0;Ia=c[c[b+20>>2]>>2]|0;p=c[(c[k+76>>2]|0)+(d*5640|0)+5584>>2]|0;q=c[Ia+20>>2]|0;n=c[b+24>>2]|0;o=c[n+24>>2]|0;Fa=c[k+24>>2]|0;m=c[k+12>>2]|0;Ha=(_(m,(d>>>0)%(Fa>>>0)|0)|0)+(c[k+4>>2]|0)|0;l=c[n>>2]|0;l=Ha>>>0>l>>>0?Ha:l;c[Ia>>2]=l;Ha=Si(m|0,0,Ha|0,0)|0;Ha=Ha|0-C;m=c[n+8>>2]|0;m=Ha>>>0>>0?Ha:m;Ha=Ia+8|0;c[Ha>>2]=m;Ga=c[k+16>>2]|0;Fa=(_(Ga,(d>>>0)/(Fa>>>0)|0)|0)+(c[k+8>>2]|0)|0;d=c[n+4>>2]|0;d=Fa>>>0>d>>>0?Fa:d;Ea=Ia+4|0;c[Ea>>2]=d;Fa=Si(Ga|0,0,Fa|0,0)|0;Fa=Fa|0-C;n=c[n+12>>2]|0;n=Fa>>>0>>0?Fa:n;Fa=Ia+12|0;c[Fa>>2]=n;if(!(c[p+4>>2]|0)){Ub(j,1,19777,Sa)|0;Ra=0;i=Sa;return Ra|0}Ga=Ia+16|0;if(!(c[Ga>>2]|0)){Ra=1;i=Sa;return Ra|0}Da=k+80|0;Ca=b+40|0;Ba=(e|0)==0;k=d;Aa=0;a:while(1){c[o+36>>2]=0;va=c[o>>2]|0;d=(l+-1+va|0)/(va|0)|0;c[q>>2]=d;wa=c[o+4>>2]|0;k=(k+-1+wa|0)/(wa|0)|0;za=q+4|0;c[za>>2]=k;va=(m+-1+va|0)/(va|0)|0;ya=q+8|0;c[ya>>2]=va;wa=(n+-1+wa|0)/(wa|0)|0;xa=q+12|0;c[xa>>2]=wa;d=va-d|0;k=wa-k|0;if((4294967295/(d>>>0)|0)>>>0>>0){Ra=6;break}d=_(k,d)|0;if(d>>>0>1073741823){Ra=8;break}m=d<<2;va=c[p+4>>2]|0;wa=q+16|0;c[wa>>2]=va;b=c[Da>>2]|0;c[q+20>>2]=va>>>0>>0?1:va-b|0;b=q+40|0;c[b>>2]=m;do{if(a[Ca>>0]&1){e=q+32|0;l=c[e>>2]|0;if(l){k=q+44|0;if(m>>>0<=(c[k>>2]|0)>>>0)break;d=q+36|0;if(c[d>>2]|0){Sc(l);va=Rc(c[b>>2]|0)|0;c[e>>2]=va;if(!va){Ra=16;break a}c[k>>2]=c[b>>2];c[d>>2]=1;break}}va=Rc(m)|0;c[e>>2]=va;if(!va)break a;c[q+44>>2]=c[b>>2];c[q+36>>2]=1}}while(0);e=(c[wa>>2]|0)*136|0;k=q+24|0;b=c[k>>2]|0;if(b){d=q+28|0;if(e>>>0>(c[d>>2]|0)>>>0){b=Tc(b,e)|0;if(!b){Ra=24;break}c[k>>2]=b;va=c[d>>2]|0;Qi(b+va|0,0,e-va|0)|0;c[d>>2]=e}}else{d=Pc(e)|0;c[k>>2]=d;if(!d){d=0;Ra=87;break}c[q+28>>2]=e;Qi(d|0,0,e|0)|0}d=c[wa>>2]|0;va=(c[p+20>>2]|0)==0?7:8;if(d){ra=p+8|0;sa=p+12|0;ta=o+24|0;ua=p+804|0;qa=c[k>>2]|0;k=p+28|0;b=0;while(1){oa=d;pa=d+-1|0;la=c[q>>2]|0;ma=Ri(1,0,pa|0)|0;ma=Si(ma|0,C|0,-1,-1)|0;na=C;la=Si(ma|0,na|0,la|0,((la|0)<0)<<31>>31|0)|0;la=Pi(la|0,C|0,pa|0)|0;c[qa>>2]=la;e=c[za>>2]|0;e=Si(ma|0,na|0,e|0,((e|0)<0)<<31>>31|0)|0;e=Pi(e|0,C|0,pa|0)|0;c[qa+4>>2]=e;d=c[ya>>2]|0;d=Si(ma|0,na|0,d|0,((d|0)<0)<<31>>31|0)|0;d=Pi(d|0,C|0,pa|0)|0;c[qa+8>>2]=d;l=c[xa>>2]|0;l=Si(ma|0,na|0,l|0,((l|0)<0)<<31>>31|0)|0;l=Pi(l|0,C|0,pa|0)|0;c[qa+12>>2]=l;r=c[p+812+(b<<2)>>2]|0;n=c[p+944+(b<<2)>>2]|0;s=la>>r<>n<>31|0)|0;m=Pi(m|0,C|0,n|0)|0;if((la|0)==(d|0))d=0;else{la=Ri(1,0,r|0)|0;la=Si(la|0,C|0,-1,-1)|0;d=Si(la|0,C|0,d|0,((d|0)<0)<<31>>31|0)|0;d=Pi(d|0,C|0,r|0)|0;d=(d<>r}la=qa+16|0;c[la>>2]=d;ia=(e|0)==(l|0)?0:(m<>n;c[qa+20>>2]=ia;ia=_(ia,d)|0;ja=ia*40|0;ka=(b|0)==0;if(ka)d=1;else{s=Si(s|0,((s|0)<0)<<31>>31|0,1,0)|0;s=Ti(s|0,C|0,1)|0;t=Si(t|0,((t|0)<0)<<31>>31|0,1,0)|0;t=Ti(t|0,C|0,1)|0;d=3;n=n+-1|0;r=r+-1|0}ha=qa+24|0;c[ha>>2]=d;S=c[ra>>2]|0;S=S>>>0>>0?S:r;T=c[sa>>2]|0;T=T>>>0>>0?T:n;U=(ia|0)!=0;V=(ia|0)==0;W=1<>2]|0;d=Si(ma|0,na|0,d|0,((d|0)<0)<<31>>31|0)|0;d=Pi(d|0,C|0,pa|0)|0;k=c[za>>2]|0;k=Si(ma|0,na|0,k|0,((k|0)<0)<<31>>31|0)|0;k=Pi(k|0,C|0,pa|0)|0;e=c[ya>>2]|0;e=Si(ma|0,na|0,e|0,((e|0)<0)<<31>>31|0)|0;e=Pi(e|0,C|0,pa|0)|0;m=c[xa>>2]|0;m=Si(ma|0,na|0,m|0,((m|0)<0)<<31>>31|0)|0;m=Pi(m|0,C|0,pa|0)|0;l=0}else{l=fa+1|0;d=c[q>>2]|0;O=Ri(l&1|0,0,pa|0)|0;O=Oi(da|0,ea|0,O|0,C|0)|0;m=C;d=Si(O|0,m|0,d|0,((d|0)<0)<<31>>31|0)|0;d=Pi(d|0,C|0,oa|0)|0;k=c[za>>2]|0;P=Ri(l>>>1|0,0,pa|0)|0;P=Oi(da|0,ea|0,P|0,C|0)|0;Q=C;k=Si(P|0,Q|0,k|0,((k|0)<0)<<31>>31|0)|0;k=Pi(k|0,C|0,oa|0)|0;e=c[ya>>2]|0;e=Si(O|0,m|0,e|0,((e|0)<0)<<31>>31|0)|0;e=Pi(e|0,C|0,oa|0)|0;m=c[xa>>2]|0;m=Si(P|0,Q|0,m|0,((m|0)<0)<<31>>31|0)|0;m=Pi(m|0,C|0,oa|0)|0}c[ga+16>>2]=l;c[ga>>2]=d;Q=ga+4|0;c[Q>>2]=k;P=ga+8|0;c[P>>2]=e;O=ga+12|0;c[O>>2]=m;k=Wa[va&15](l)|0;Ta=+(c[R+4>>2]|0)*.00048828125+1.0;g[ga+32>>2]=+Gh(1.0,(c[ta>>2]|0)+k-(c[R>>2]|0)|0)*Ta*f;c[ga+28>>2]=(c[R>>2]|0)+-1+(c[ua>>2]|0);k=ga+20|0;e=c[k>>2]|0;if(!(U&(e|0)==0)){d=ga+24|0;if((c[d>>2]|0)>>>0>>0){e=Tc(e,ja)|0;if(!e){Ra=41;break a}c[k>>2]=e;N=c[d>>2]|0;Qi(e+N|0,0,ja-N|0)|0;c[d>>2]=ja}}else{d=Pc(ja)|0;c[k>>2]=d;if(!d){d=0;Ra=87;break a}Qi(d|0,0,ja|0)|0;c[ga+24>>2]=ja}if(!V){M=c[k>>2]|0;N=0;while(1){F=c[la>>2]|0;J=(((N>>>0)%(F>>>0)|0)<>>0)/(F>>>0)|0)<>2]|0;I=(J|0)>(I|0)?J:I;c[M>>2]=I;J=c[Q>>2]|0;J=(F|0)>(J|0)?F:J;F=M+4|0;c[F>>2]=J;L=c[P>>2]|0;L=(G|0)<(L|0)?G:L;G=M+8|0;c[G>>2]=L;l=c[O>>2]|0;l=(H|0)<(l|0)?H:l;H=M+12|0;c[H>>2]=l;I=I>>S<>T<>31|0)|0;L=Pi(L|0,C|0,S|0)|0;l=Si($|0,aa|0,l|0,((l|0)<0)<<31>>31|0)|0;l=Pi(l|0,C|0,T|0)|0;L=(L<>S;K=M+16|0;c[K>>2]=L;l=(l<>T;u=M+20|0;c[u>>2]=l;L=_(l,L)|0;l=_(L,h)|0;k=M+24|0;e=c[k>>2]|0;do{if((e|0)==0&(L|0)!=0){d=Pc(l)|0;c[k>>2]=d;if(!d){d=0;Ra=87;break a}Qi(d|0,0,l|0)|0;c[M+28>>2]=l}else{d=M+28|0;if(l>>>0<=(c[d>>2]|0)>>>0)break;e=Tc(e,l)|0;if(!e){Ra=50;break a}c[k>>2]=e;E=c[d>>2]|0;Qi(e+E|0,0,l-E|0)|0;c[d>>2]=l}}while(0);m=M+32|0;d=c[m>>2]|0;e=c[K>>2]|0;l=c[u>>2]|0;if(!d)d=jg(e,l,j)|0;else d=lg(d,e,l,j)|0;c[m>>2]=d;if(!d)Ub(j,2,19990,Ka)|0;m=M+36|0;e=c[m>>2]|0;l=c[K>>2]|0;d=c[u>>2]|0;if(!e)d=jg(l,d,j)|0;else d=lg(e,l,d,j)|0;c[m>>2]=d;if(!d)Ub(j,2,20012,La)|0;if(L){E=0;do{A=c[K>>2]|0;z=(((E>>>0)%(A>>>0)|0)<>>0)/(A>>>0)|0)<>2]|0;e=d+(E*56|0)|0;l=c[e>>2]|0;if(!l){y=Pc(8192)|0;c[e>>2]=y;if(!y){d=0;Ra=87;break a}c[d+(E*56|0)+32>>2]=8192;y=Qc(10,32)|0;c[d+(E*56|0)+4>>2]=y;if(!y){d=0;Ra=87;break a}c[d+(E*56|0)+52>>2]=10}else{m=d+(E*56|0)+32|0;u=c[m>>2]|0;v=d+(E*56|0)+4|0;w=c[v>>2]|0;x=e;y=x+52|0;do{c[x>>2]=0;x=x+4|0}while((x|0)<(y|0));c[e>>2]=l;c[m>>2]=u;c[v>>2]=w}y=c[M>>2]|0;c[d+(E*56|0)+8>>2]=(z|0)>(y|0)?z:y;z=c[F>>2]|0;c[d+(E*56|0)+12>>2]=(A|0)>(z|0)?A:z;A=c[G>>2]|0;c[d+(E*56|0)+16>>2]=(B|0)<(A|0)?B:A;B=c[H>>2]|0;c[d+(E*56|0)+20>>2]=(D|0)<(B|0)?D:B}else{e=c[k>>2]|0;d=e+(E*52|0)+4|0;if((c[d>>2]|0)==0?(y=Qc(100,24)|0,c[d>>2]=y,(y|0)==0):0){d=0;Ra=87;break a}d=e+(E*52|0)+8|0;if((c[d>>2]|0)==0?(y=Qc(100,24)|0,c[d>>2]=y,(y|0)==0):0){d=0;Ra=87;break a}m=c[M>>2]|0;m=(z|0)>(m|0)?z:m;c[e+(E*52|0)+12>>2]=m;d=c[F>>2]|0;A=(A|0)>(d|0)?A:d;c[e+(E*52|0)+16>>2]=A;d=c[G>>2]|0;d=(B|0)<(d|0)?B:d;c[e+(E*52|0)+20>>2]=d;B=c[H>>2]|0;D=(D|0)<(B|0)?D:B;c[e+(E*52|0)+24>>2]=D;m=_(D-A|0,d-m<<2)|0;d=e+(E*52|0)+36|0;if(m>>>0<=(c[d>>2]|0)>>>0)break;l=e+(E*52|0)|0;e=c[l>>2]|0;if(e)Uc(e+-1|0);e=Pc(m|1)|0;c[l>>2]=e;if(!e){Ra=74;break a}c[d>>2]=m;a[e>>0]=0;c[l>>2]=(c[l>>2]|0)+1}}while(0);E=E+1|0}while(E>>>0>>0)}N=N+1|0;if(N>>>0>=ia>>>0)break;else M=M+40|0}}k=R+8|0;fa=fa+1|0;if(fa>>>0>=(c[ha>>2]|0)>>>0)break;else{ga=ga+36|0;R=k}}b=b+1|0;if(b>>>0<(c[wa>>2]|0)>>>0){d=pa;qa=qa+136|0}else break}}d=Aa+1|0;if(d>>>0>=(c[Ga>>2]|0)>>>0){d=1;Ra=87;break}l=c[Ia>>2]|0;k=c[Ea>>2]|0;m=c[Ha>>2]|0;n=c[Fa>>2]|0;Aa=d;o=o+52|0;p=p+1080|0;q=q+52|0}if((Ra|0)==6){Ub(j,1,19816,Ja)|0;Ra=0;i=Sa;return Ra|0}else if((Ra|0)==8){Ub(j,1,19816,Ma)|0;Ra=0;i=Sa;return Ra|0}else if((Ra|0)==16){c[k>>2]=0;c[b>>2]=0;c[d>>2]=0}else if((Ra|0)==24){Ub(j,1,19849,Oa)|0;Uc(c[k>>2]|0);c[k>>2]=0;c[d>>2]=0;Ra=0;i=Sa;return Ra|0}else if((Ra|0)==41){Ub(j,1,19889,Pa)|0;Uc(c[k>>2]|0);c[k>>2]=0;c[d>>2]=0;Ra=0;i=Sa;return Ra|0}else if((Ra|0)==50){Uc(c[k>>2]|0);c[k>>2]=0;c[d>>2]=0;Ub(j,1,19932,Na)|0;Ra=0;i=Sa;return Ra|0}else if((Ra|0)==74){c[d>>2]=0;Ra=0;i=Sa;return Ra|0}else if((Ra|0)==87){i=Sa;return d|0}Ub(j,1,19816,Qa)|0;Ra=0;i=Sa;return Ra|0}function jg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=i;i=i+288|0;l=v+16|0;j=v+8|0;t=v+152|0;u=v+24|0;e=Qc(1,20)|0;if(!e){Ub(d,1,20034,v)|0;u=0;i=v;return u|0}c[e>>2]=a;m=e+4|0;c[m>>2]=b;c[t>>2]=a;c[u>>2]=b;k=e+8|0;c[k>>2]=0;f=0;h=0;while(1){s=_(b,a)|0;a=(a+1|0)/2|0;g=h+1|0;c[t+(g<<2)>>2]=a;b=(b+1|0)/2|0;c[u+(g<<2)>>2]=b;f=f+s|0;if(s>>>0<=1)break;else h=g}c[k>>2]=f;if(!f){Uc(e);Ub(d,2,20072,j)|0;u=0;i=v;return u|0}f=Qc(f,16)|0;c[e+12>>2]=f;if(!f){Ub(d,1,20122,l)|0;Uc(e);u=0;i=v;return u|0}s=c[k>>2]|0;c[e+16>>2]=s<<4;b=f+((_(c[m>>2]|0,c[e>>2]|0)|0)<<4)|0;if(!h)b=f;else{r=0;g=b;a=b;b=f;do{p=c[u+(r<<2)>>2]|0;a:do{if((p|0)>0){q=c[t+(r<<2)>>2]|0;if((q|0)<=0){k=p+-1|0;d=0;while(1){o=(d&1|0)!=0|(d|0)==(k|0);j=o?g:a;a=o?g:a+(q<<4)|0;d=d+1|0;if((d|0)>=(p|0)){g=j;break a}else g=j}}o=((q+2+((q|0)<2?~q:-3)|0)>>>1)+1|0;m=p+-1|0;n=0;do{d=q;l=g;while(1){c[b>>2]=l;j=b+16|0;k=d;d=d+-2|0;if((d|0)>-1){c[j>>2]=l;b=b+32|0}else b=j;if((k|0)<=2)break;else l=l+16|0}l=g+(o<<4)|0;d=(n&1|0)!=0|(n|0)==(m|0);g=d?l:a;a=d?l:a+(q<<4)|0;n=n+1|0}while((n|0)<(p|0))}}while(0);r=r+1|0}while((r|0)!=(h|0))}c[b>>2]=0;if(!s){u=e;i=v;return u|0}else b=0;while(1){c[f+4>>2]=999;c[f+8>>2]=0;c[f+12>>2]=0;b=b+1|0;if((b|0)==(s|0))break;else f=f+16|0}i=v;return e|0}function kg(a){a=a|0;var b=0,d=0;if(!a)return;b=c[a+8>>2]|0;if(!b)return;d=0;a=c[a+12>>2]|0;while(1){c[a+4>>2]=999;c[a+8>>2]=0;c[a+12>>2]=0;d=d+1|0;if(d>>>0>=b>>>0)break;else a=a+16|0}return}function bb(a){a=a|0;var b=0;b=i;i=i+a|0;i=i+15&-16;return b|0}function cb(){return i|0}function db(a){a=a|0;i=a}function eb(a,b){a=a|0;b=b|0;i=a;j=b}function fb(a,b){a=a|0;b=b|0;if(!n){n=a;o=b}}function gb(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0]}function hb(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0];a[k+4>>0]=a[b+4>>0];a[k+5>>0]=a[b+5>>0];a[k+6>>0]=a[b+6>>0];a[k+7>>0]=a[b+7>>0]}function ib(a){a=a|0;C=a}function jb(){return C|0}function kb(a,b,d,e,f,g,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+8272|0;k=o+16|0;m=o+12|0;j=o;c[m>>2]=0;if((c[a>>2]|0)==1375686655)n=gc(0)|0;else n=gc(2)|0;bc(n,1,0)|0;cc(n,2,0)|0;dc(n,3,0)|0;hc(k);c[j>>2]=a;c[j+4>>2]=a;c[j+8>>2]=b;l=ec(j,1)|0;if(!(ic(n,k)|0)){mi(4476)|0;Fb(l);zc(n);g=1;i=o;return g|0}if(!(jc(l,n,m)|0)){mi(4528)|0;Fb(l);zc(n);Zb(c[m>>2]|0);g=1;i=o;return g|0}if(!(oc(n,l,c[m>>2]|0,c[k+8228>>2]|0)|0)){mi(4578)|0;zc(n);Fb(l);Zb(c[m>>2]|0);g=1;i=o;return g|0}j=c[m>>2]|0;c[f>>2]=c[j+8>>2];c[g>>2]=c[j+12>>2];a=c[j+16>>2]|0;c[h>>2]=a;a=_(_(a<<2,c[f>>2]|0)|0,c[g>>2]|0)|0;c[e>>2]=a;e=Fi(a)|0;c[d>>2]=e;switch(c[h>>2]|0){case 1:{Ui(e|0,c[(c[j+24>>2]|0)+44>>2]|0,a|0)|0;break}case 3:{if((_(c[g>>2]|0,c[f>>2]|0)|0)>0){b=c[j+24>>2]|0;j=c[b+44>>2]|0;a=c[b+96>>2]|0;b=c[b+148>>2]|0;k=0;do{h=k*3|0;c[e+(h<<2)>>2]=c[j+(k<<2)>>2];c[e+(h+1<<2)>>2]=c[a+(k<<2)>>2];c[e+(h+2<<2)>>2]=c[b+(k<<2)>>2];k=k+1|0}while((k|0)<(_(c[g>>2]|0,c[f>>2]|0)|0))}break}default:{}}Fb(l);zc(n);Zb(c[m>>2]|0);g=0;i=o;return g|0}function lb(){return fc()|0}function mb(a,b){a=a|0;b=b|0;return}function nb(a,b){a=a|0;b=b|0;return}function ob(a,b){a=a|0;b=b|0;var d=0;b=i;i=i+16|0;d=b;c[d>>2]=a;li(4625,d)|0;i=b;return}function pb(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0;h=i;i=i+16|0;g=h;c[g>>2]=d;if(!e){i=h;return}d=b;f=0;b=g+(e+-1)|0;while(1){a[d>>0]=a[b>>0]|0;f=f+1|0;if((f|0)==(e|0))break;else{d=d+1|0;b=b+-1|0}}i=h;return}function qb(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;c[d>>2]=0;if(!e)return;f=0;d=d+(e+-1)|0;while(1){a[d>>0]=a[b>>0]|0;f=f+1|0;if((f|0)==(e|0))break;else{b=b+1|0;d=d+-1|0}}return}function rb(b,d){b=b|0;d=+d;var e=0,f=0,g=0,j=0,l=0;e=i;i=i+16|0;j=e;h[j>>3]=d;j=j+8|0;h[k>>3]=d;f=c[k>>2]|0;g=c[k+4>>2]|0;l=Ti(f|0,g|0,56)|0;a[b>>0]=l;l=Ti(f|0,g|0,48)|0;a[b+1>>0]=l;l=Ti(f|0,g|0,40)|0;a[b+2>>0]=l;a[b+3>>0]=g;a[b+4>>0]=a[j+-5>>0]|0;a[b+5>>0]=a[j+-6>>0]|0;g=Ti(f|0,g|0,8)|0;a[b+6>>0]=g;a[b+7>>0]=f;i=e;return}function sb(b,c){b=b|0;c=c|0;var d=0;d=c+8|0;a[d+-1>>0]=a[b>>0]|0;a[d+-2>>0]=a[b+1>>0]|0;a[d+-3>>0]=a[b+2>>0]|0;a[d+-4>>0]=a[b+3>>0]|0;a[d+-5>>0]=a[b+4>>0]|0;a[d+-6>>0]=a[b+5>>0]|0;a[d+-7>>0]=a[b+6>>0]|0;a[c>>0]=a[b+7>>0]|0;return}function tb(b,d){b=b|0;d=+d;var e=0;e=(g[k>>2]=d,c[k>>2]|0);a[b>>0]=e>>>24;a[b+1>>0]=e>>>16;a[b+2>>0]=e>>>8;a[b+3>>0]=e;return}function ub(b,c){b=b|0;c=c|0;var d=0;d=c+4|0;a[d+-1>>0]=a[b>>0]|0;a[d+-2>>0]=a[b+1>>0]|0;a[d+-3>>0]=a[b+2>>0]|0;a[c>>0]=a[b+3>>0]|0;return}function vb(a,b){a=a|0;b=b|0;var d=0,e=0;e=Qc(1,72)|0;if(!e){b=0;return b|0}c[e+64>>2]=a;a=Pc(a)|0;c[e+32>>2]=a;if(!a){Uc(e);b=0;return b|0}c[e+36>>2]=a;a=e+68|0;d=c[a>>2]|0;if(!b){c[a>>2]=d|1;c[e+40>>2]=31;c[e+44>>2]=32}else{c[a>>2]=d|2;c[e+40>>2]=29;c[e+44>>2]=30}c[e+16>>2]=4;c[e+20>>2]=5;c[e+24>>2]=6;c[e+28>>2]=7;b=e;return b|0}function wb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+16|0;m=n;f=a+48|0;g=c[f>>2]|0;if(g>>>0>=b>>>0){m=a+36|0;c[m>>2]=(c[m>>2]|0)+b;c[f>>2]=g-b;m=a+56|0;a=m;a=Si(c[a>>2]|0,c[a+4>>2]|0,b|0,d|0)|0;c[m>>2]=a;c[m+4>>2]=C;m=d;a=b;C=m;i=n;return a|0}l=a+68|0;if(c[l>>2]&4){m=a+36|0;c[m>>2]=(c[m>>2]|0)+g;c[f>>2]=0;a=a+56|0;m=a;m=Si(c[m>>2]|0,c[m+4>>2]|0,g|0,0)|0;c[a>>2]=m;c[a+4>>2]=C;a=(g|0)!=0;m=a?0:-1;a=a?g:-1;C=m;i=n;return a|0}if(!g){g=0;f=0}else{c[a+36>>2]=c[a+32>>2];b=Oi(b|0,d|0,g|0,0)|0;c[f>>2]=0;f=0;d=C}a:do{if((d|0)>0|(d|0)==0&b>>>0>0){k=a+24|0;while(1){h=Ra[c[k>>2]&63](b,d,c[a>>2]|0)|0;j=C;if((h|0)==-1&(j|0)==-1)break;b=Oi(b|0,d|0,h|0,j|0)|0;d=C;g=Si(h|0,j|0,g|0,f|0)|0;f=C;if(!((d|0)>0|(d|0)==0&b>>>0>0))break a}Ub(e,4,4636,m)|0;c[l>>2]=c[l>>2]|4;a=a+56|0;m=a;m=Si(c[m>>2]|0,c[m+4>>2]|0,g|0,f|0)|0;c[a>>2]=m;c[a+4>>2]=C;a=(g|0)!=0|(f|0)!=0;m=a?f:-1;a=a?g:-1;C=m;i=n;return a|0}}while(0);m=a+56|0;a=m;a=Si(c[a>>2]|0,c[a+4>>2]|0,g|0,f|0)|0;c[m>>2]=a;c[m+4>>2]=C;m=f;a=g;C=m;i=n;return a|0}function xb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;c[a+36>>2]=c[a+32>>2];c[a+48>>2]=0;g=(Ra[c[a+28>>2]&63](b,d,c[a>>2]|0)|0)==0;e=a+68|0;f=c[e>>2]|0;if(g){c[e>>2]=f|4;g=0;return g|0}else{c[e>>2]=f&-5;g=a+56|0;c[g>>2]=b;c[g+4>>2]=d;g=1;return g|0}return 0}function yb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;r=i;i=i+16|0;q=r+8|0;m=r;p=a+68|0;if(c[p>>2]&8){q=-1;a=-1;C=q;i=r;return a|0}k=a+32|0;f=c[k>>2]|0;o=a+36|0;c[o>>2]=f;l=a+48|0;g=c[l>>2]|0;do{if(g){j=a+20|0;while(1){h=Ra[c[j>>2]&63](f,g,c[a>>2]|0)|0;if((h|0)==-1)break;f=(c[o>>2]|0)+h|0;c[o>>2]=f;s=c[l>>2]|0;g=s-h|0;c[l>>2]=g;if((s|0)==(h|0)){n=6;break}}if((n|0)==6){f=c[k>>2]|0;break}c[p>>2]=c[p>>2]|8;Ub(e,4,4662,m)|0;c[p>>2]=c[p>>2]|8;c[l>>2]=0;a=-1;s=-1;C=a;i=r;return s|0}}while(0);c[o>>2]=f;a:do{if((d|0)>0|(d|0)==0&b>>>0>0){k=a+24|0;g=0;f=0;while(1){h=Ra[c[k>>2]&63](b,d,c[a>>2]|0)|0;j=C;if((h|0)==-1&(j|0)==-1)break;b=Oi(b|0,d|0,h|0,j|0)|0;d=C;g=Si(h|0,j|0,g|0,f|0)|0;f=C;if(!((d|0)>0|(d|0)==0&b>>>0>0))break a}Ub(e,4,4688,q)|0;c[p>>2]=c[p>>2]|8;s=a+56|0;a=s;a=Si(c[a>>2]|0,c[a+4>>2]|0,g|0,f|0)|0;c[s>>2]=a;c[s+4>>2]=C;s=(g|0)!=0|(f|0)!=0;a=s?f:-1;s=s?g:-1;C=a;i=r;return s|0}else{g=0;f=0}}while(0);a=a+56|0;s=a;s=Si(c[s>>2]|0,c[s+4>>2]|0,g|0,f|0)|0;c[a>>2]=s;c[a+4>>2]=C;a=f;s=g;C=a;i=r;return s|0}function zb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;p=i;i=i+16|0;k=p;m=a+32|0;f=c[m>>2]|0;n=a+36|0;c[n>>2]=f;o=a+48|0;g=c[o>>2]|0;do{if(!g)g=a;else{j=a+20|0;while(1){h=Ra[c[j>>2]&63](f,g,c[a>>2]|0)|0;if((h|0)==-1)break;f=(c[n>>2]|0)+h|0;c[n>>2]=f;q=c[o>>2]|0;g=q-h|0;c[o>>2]=g;if((q|0)==(h|0)){l=6;break}}if((l|0)==6){g=a;f=c[m>>2]|0;break}q=a+68|0;c[q>>2]=c[q>>2]|8;Ub(e,4,4662,k)|0;c[q>>2]=c[q>>2]|8;q=0;i=p;return q|0}}while(0);c[n>>2]=f;c[o>>2]=0;if(!(Ra[c[a+28>>2]&63](b,d,c[g>>2]|0)|0)){q=a+68|0;c[q>>2]=c[q>>2]|8;q=0;i=p;return q|0}else{q=a+56|0;c[q>>2]=b;c[q+4>>2]=d;q=1;i=p;return q|0}return 0}function Ab(a,b,c){a=a|0;b=b|0;c=c|0;return-1}function Bb(a,b,c){a=a|0;b=b|0;c=c|0;return-1}function Cb(a,b,c){a=a|0;b=b|0;c=c|0;C=-1;return-1}function Db(a,b,c){a=a|0;b=b|0;c=c|0;return 0}function Eb(a){a=a|0;var b=0,d=0,e=0;e=Qc(1,72)|0;if(!e){a=0;return a|0}c[e+64>>2]=1048576;b=Pc(1048576)|0;c[e+32>>2]=b;if(!b){Uc(e);a=0;return a|0}c[e+36>>2]=b;b=e+68|0;d=c[b>>2]|0;if(!a){c[b>>2]=d|1;c[e+40>>2]=31;c[e+44>>2]=32}else{c[b>>2]=d|2;c[e+40>>2]=29;c[e+44>>2]=30}c[e+16>>2]=4;c[e+20>>2]=5;c[e+24>>2]=6;c[e+28>>2]=7;a=e;return a|0}function Fb(a){a=a|0;var b=0;if(!a)return;b=c[a+4>>2]|0;if(b)Ta[b&7](c[a>>2]|0);b=a+32|0;Uc(c[b>>2]|0);c[b>>2]=0;Uc(a);return}function Gb(a,b){a=a|0;b=b|0;if(!a)return;if(!(c[a+68>>2]&2))return;c[a+16>>2]=b;return}function Hb(a,b){a=a|0;b=b|0;if(!a)return;c[a+28>>2]=b;return}function Ib(a,b){a=a|0;b=b|0;if(!a)return;if(!(c[a+68>>2]&1))return;c[a+20>>2]=b;return}function Jb(a,b){a=a|0;b=b|0;if(!a)return;c[a+24>>2]=b;return}function Kb(a,b,d){a=a|0;b=b|0;d=d|0;if(!a)return;c[a>>2]=b;c[a+4>>2]=d;return}function Lb(a,b,d){a=a|0;b=b|0;d=d|0;if(!a)return;a=a+8|0;c[a>>2]=b;c[a+4>>2]=d;return}function Mb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+16|0;s=w+8|0;r=w;v=a+48|0;f=c[v>>2]|0;if(f>>>0>=d>>>0){u=a+36|0;Ui(b|0,c[u>>2]|0,d|0)|0;c[u>>2]=(c[u>>2]|0)+d;c[v>>2]=(c[v>>2]|0)-d;v=a+56|0;u=v;u=Si(c[u>>2]|0,c[u+4>>2]|0,d|0,0)|0;c[v>>2]=u;c[v+4>>2]=C;v=d;i=w;return v|0}t=a+68|0;if(c[t>>2]&4){u=a+36|0;Ui(b|0,c[u>>2]|0,f|0)|0;e=c[v>>2]|0;c[u>>2]=(c[u>>2]|0)+e;u=a+56|0;t=u;e=Si(c[t>>2]|0,c[t+4>>2]|0,e|0,0)|0;c[u>>2]=e;c[u+4>>2]=C;c[v>>2]=0;v=(f|0)!=0?f:-1;i=w;return v|0}if(!f){o=a+32|0;g=c[o>>2]|0;p=a+36|0;c[p>>2]=g;q=p;u=a+56|0;f=0}else{p=a+36|0;Ui(b|0,c[p>>2]|0,f|0)|0;o=a+32|0;g=c[o>>2]|0;c[p>>2]=g;q=c[v>>2]|0;u=a+56|0;m=u;m=Si(c[m>>2]|0,c[m+4>>2]|0,q|0,0)|0;n=u;c[n>>2]=m;c[n+4>>2]=C;c[v>>2]=0;d=d-q|0;b=b+q|0;q=p}m=a+64|0;n=a+16|0;l=b;h=g;while(1){b=c[m>>2]|0;g=c[n>>2]|0;if(d>>>0>>0){g=Ra[g&63](h,b,c[a>>2]|0)|0;c[v>>2]=g;if((g|0)==-1){g=11;break}if(g>>>0>=d>>>0){b=l;g=14;break}Ui(l|0,c[q>>2]|0,g|0)|0;h=c[o>>2]|0;c[p>>2]=h;b=c[v>>2]|0;j=u;j=Si(c[j>>2]|0,c[j+4>>2]|0,b|0,0)|0;k=C;f=g+f|0}else{b=Ra[g&63](l,d,c[a>>2]|0)|0;c[v>>2]=b;if((b|0)==-1){g=16;break}f=b+f|0;if(b>>>0>=d>>>0){g=20;break}h=c[o>>2]|0;c[p>>2]=h;j=u;j=Si(c[j>>2]|0,c[j+4>>2]|0,b|0,0)|0;k=C}g=u;c[g>>2]=j;c[g+4>>2]=k;c[v>>2]=0;d=d-b|0;l=l+b|0}if((g|0)==11){Ub(e,4,4636,r)|0;c[v>>2]=0;c[t>>2]=c[t>>2]|4;v=(f|0)!=0?f:-1;i=w;return v|0}else if((g|0)==14){Ui(b|0,c[q>>2]|0,d|0)|0;c[q>>2]=(c[q>>2]|0)+d;c[v>>2]=(c[v>>2]|0)-d;e=u;e=Si(c[e>>2]|0,c[e+4>>2]|0,d|0,0)|0;v=u;c[v>>2]=e;c[v+4>>2]=C;v=f+d|0;i=w;return v|0}else if((g|0)==16){Ub(e,4,4636,s)|0;c[v>>2]=0;c[t>>2]=c[t>>2]|4;v=(f|0)!=0?f:-1;i=w;return v|0}else if((g|0)==20){e=u;e=Si(c[e>>2]|0,c[e+4>>2]|0,b|0,0)|0;c[u>>2]=e;c[u+4>>2]=C;c[p>>2]=c[o>>2];c[v>>2]=0;v=f;i=w;return v|0}return 0}function Nb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;u=i;i=i+16|0;r=u;n=a+68|0;if(c[n>>2]&8){t=-1;i=u;return t|0}q=a+64|0;f=c[q>>2]|0;t=a+48|0;k=c[t>>2]|0;g=f-k|0;do{if(g>>>0>>0){o=a+32|0;h=a+36|0;p=a+20|0;j=a+56|0;l=f;m=g;f=0;a:while(1){if((l|0)==(k|0))g=c[o>>2]|0;else{Ui(c[h>>2]|0,b|0,m|0)|0;g=c[o>>2]|0;c[h>>2]=g;k=(c[t>>2]|0)+m|0;c[t>>2]=k;v=j;v=Si(c[v>>2]|0,c[v+4>>2]|0,m|0,0)|0;l=j;c[l>>2]=v;c[l+4>>2]=C;d=d-m|0;b=b+m|0;f=m+f|0}c[h>>2]=g;if(!k)k=0;else{do{l=Ra[c[p>>2]&63](g,k,c[a>>2]|0)|0;if((l|0)==-1)break a;g=(c[h>>2]|0)+l|0;c[h>>2]=g;v=c[t>>2]|0;k=v-l|0;c[t>>2]=k}while((v|0)!=(l|0));g=c[o>>2]|0}c[h>>2]=g;l=c[q>>2]|0;m=l-k|0;if(d>>>0<=m>>>0){s=5;break}}if((s|0)==5)break;c[n>>2]=c[n>>2]|8;Ub(e,4,4662,r)|0;v=-1;i=u;return v|0}else{g=a+36|0;j=a+56|0;h=g;g=c[g>>2]|0;f=0}}while(0);Ui(g|0,b|0,d|0)|0;c[h>>2]=(c[h>>2]|0)+d;c[t>>2]=(c[t>>2]|0)+d;t=j;t=Si(c[t>>2]|0,c[t+4>>2]|0,d|0,0)|0;v=j;c[v>>2]=t;c[v+4>>2]=C;v=f+d|0;i=u;return v|0}function Ob(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;n=i;i=i+16|0;k=n;g=a+32|0;d=c[g>>2]|0;m=a+36|0;c[m>>2]=d;h=a+48|0;e=c[h>>2]|0;do{if(e){j=a+20|0;while(1){f=Ra[c[j>>2]&63](d,e,c[a>>2]|0)|0;if((f|0)==-1)break;d=(c[m>>2]|0)+f|0;c[m>>2]=d;o=c[h>>2]|0;e=o-f|0;c[h>>2]=e;if((o|0)==(f|0)){l=6;break}}if((l|0)==6){d=c[g>>2]|0;break}o=a+68|0;c[o>>2]=c[o>>2]|8;Ub(b,4,4662,k)|0;o=0;i=n;return o|0}}while(0);c[m>>2]=d;o=1;i=n;return o|0}function Pb(a){a=a|0;a=a+56|0;C=c[a+4>>2]|0;return c[a>>2]|0}function Qb(a){a=a|0;var b=0,d=0;d=a+8|0;b=c[d>>2]|0;d=c[d+4>>2]|0;if((b|0)==0&(d|0)==0){d=0;a=0;C=d;return a|0}a=a+56|0;a=Oi(b|0,d|0,c[a>>2]|0,c[a+4>>2]|0)|0;d=C;C=d;return a|0}function Rb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;a=Za[c[a+40>>2]&63](a,b,d,e)|0;return a|0}function Sb(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;return Za[c[a+44>>2]&63](a,b,d,e)|0}function Tb(a){a=a|0;return(c[a+28>>2]|0)!=7|0}function Ub(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;j=i;i=i+528|0;g=j;h=j+16|0;a:do{if(a){switch(b|0){case 1:{b=a;f=a+12|0;break}case 2:{b=a+4|0;f=a+16|0;break}case 4:{b=a+8|0;f=a+20|0;break}default:{b=0;break a}}a=c[b>>2]|0;b=c[f>>2]|0;if(b)if(!d)b=1;else{Qi(h|0,0,512)|0;c[g>>2]=e;pi(h,512,d,g)|0;Ua[b&7](h,a);b=1}else b=0}else b=0}while(0);i=j;return b|0}function Vb(a){a=a|0;c[a>>2]=0;c[a+4>>2]=0;c[a+8>>2]=0;c[a+12>>2]=4;c[a+20>>2]=4;c[a+16>>2]=4;return}function Wb(a,b){a=a|0;b=b|0;return}function Xb(){return Qc(1,36)|0}function Yb(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=Qc(1,36)|0;if(!e){i=e;return i|0}c[e+20>>2]=d;h=e+16|0;c[h>>2]=a;d=Qc(1,a*52|0)|0;i=e+24|0;c[i>>2]=d;if(!d){d=c[e+28>>2]|0;if(d)Uc(d);Uc(e);i=0;return i|0}if(!a){i=e;return i|0}f=0;while(1){c[d+(f*52|0)>>2]=c[b+(f*36|0)>>2];c[d+(f*52|0)+4>>2]=c[b+(f*36|0)+4>>2];j=c[b+(f*36|0)+8>>2]|0;c[d+(f*52|0)+8>>2]=j;k=c[b+(f*36|0)+12>>2]|0;c[d+(f*52|0)+12>>2]=k;c[d+(f*52|0)+16>>2]=c[b+(f*36|0)+16>>2];c[d+(f*52|0)+20>>2]=c[b+(f*36|0)+20>>2];c[d+(f*52|0)+24>>2]=c[b+(f*36|0)+24>>2];c[d+(f*52|0)+28>>2]=c[b+(f*36|0)+28>>2];c[d+(f*52|0)+32>>2]=c[b+(f*36|0)+32>>2];j=Qc(_(k,j)|0,4)|0;c[d+(f*52|0)+44>>2]=j;f=f+1|0;if(!j)break;if(f>>>0>=a>>>0){g=22;break}d=c[i>>2]|0}if((g|0)==22)return e|0;d=c[i>>2]|0;if(d){f=c[h>>2]|0;if(f){b=0;while(1){d=c[d+(b*52|0)+44>>2]|0;if(d){Uc(d);f=c[h>>2]|0}b=b+1|0;if(b>>>0>=f>>>0)break;d=c[i>>2]|0}d=c[i>>2]|0}Uc(d)}d=c[e+28>>2]|0;if(d)Uc(d);Uc(e);k=0;return k|0}function Zb(a){a=a|0;var b=0,d=0,e=0,f=0,g=0;if(!a)return;f=a+24|0;b=c[f>>2]|0;if(b){g=a+16|0;d=c[g>>2]|0;if(d){e=0;while(1){b=c[b+(e*52|0)+44>>2]|0;if(b){Uc(b);d=c[g>>2]|0}e=e+1|0;if(e>>>0>=d>>>0)break;b=c[f>>2]|0}b=c[f>>2]|0}Uc(b)}b=c[a+28>>2]|0;if(b)Uc(b);Uc(a);return}function _b(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=c[b+4>>2]|0;e=c[a>>2]|0;g=c[b+8>>2]|0;h=c[a+4>>2]|0;f=c[b+12>>2]|0;l=(_((c[b+24>>2]|0)+-1|0,f)|0)+d|0;i=c[b+16>>2]|0;j=(_((c[b+28>>2]|0)+-1|0,i)|0)+g|0;b=Si(l|0,0,f|0,0)|0;b=b|0-C;f=c[a+8>>2]|0;i=Si(j|0,0,i|0,0)|0;i=i|0-C;j=c[a+12>>2]|0;l=c[a+16>>2]|0;if(!l)return;k=(d>>>0>e>>>0?d:e)+-1|0;g=(g>>>0>h>>>0?g:h)+-1|0;f=(b>>>0>>0?b:f)+-1|0;d=(i>>>0>>0?i:j)+-1|0;e=0;b=c[a+24>>2]|0;while(1){h=c[b>>2]|0;j=((k+h|0)>>>0)/(h>>>0)|0;o=c[b+4>>2]|0;a=((g+o|0)>>>0)/(o>>>0)|0;i=c[b+40>>2]|0;n=Ri(1,0,i|0)|0;m=C;h=Si((((f+h|0)>>>0)/(h>>>0)|0)-j|0,0,-1,-1)|0;h=Si(h|0,C|0,n|0,m|0)|0;h=Ti(h|0,C|0,i|0)|0;o=Si((((d+o|0)>>>0)/(o>>>0)|0)-a|0,0,-1,-1)|0;m=Si(o|0,C|0,n|0,m|0)|0;i=Ti(m|0,C|0,i|0)|0;c[b+8>>2]=h;c[b+12>>2]=i;c[b+16>>2]=j;c[b+20>>2]=a;e=e+1|0;if(e>>>0>=l>>>0)break;else b=b+52|0}return}function $b(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;c[b>>2]=c[a>>2];c[b+4>>2]=c[a+4>>2];c[b+8>>2]=c[a+8>>2];c[b+12>>2]=c[a+12>>2];j=b+24|0;e=c[j>>2]|0;i=b+16|0;if(!e)d=j;else{d=c[i>>2]|0;if(!d)d=j;else{f=0;while(1){e=c[e+(f*52|0)+44>>2]|0;if(e){Uc(e);d=c[i>>2]|0}f=f+1|0;if(f>>>0>=d>>>0)break;e=c[j>>2]|0}d=j;e=c[j>>2]|0}Uc(e);c[j>>2]=0}e=c[a+16>>2]|0;c[i>>2]=e;e=Pc(e*52|0)|0;c[d>>2]=e;if(!e){c[j>>2]=0;c[i>>2]=0;return}if(c[i>>2]|0){h=a+24|0;g=0;do{d=e+(g*52|0)|0;e=(c[h>>2]|0)+(g*52|0)|0;f=d+52|0;do{c[d>>2]=c[e>>2];d=d+4|0;e=e+4|0}while((d|0)<(f|0));e=c[j>>2]|0;c[e+(g*52|0)+44>>2]=0;g=g+1|0}while(g>>>0<(c[i>>2]|0)>>>0)}c[b+20>>2]=c[a+20>>2];f=a+32|0;d=c[f>>2]|0;g=b+32|0;c[g>>2]=d;if(!d){c[b+28>>2]=0;return}e=Pc(d)|0;d=b+28|0;c[d>>2]=e;if(!e){c[d>>2]=0;c[g>>2]=0;return}else{Ui(e|0,c[a+28>>2]|0,c[f>>2]|0)|0;return}}function ac(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=Qc(1,36)|0;if(!e){a=e;return a|0}c[e+20>>2]=d;c[e+16>>2]=a;d=Qc(a,52)|0;c[e+24>>2]=d;if(!d){d=c[e+28>>2]|0;if(d)Uc(d);Uc(e);a=0;return a|0}else{if(!a){a=e;return a|0}else f=0;do{c[d+(f*52|0)>>2]=c[b+(f*36|0)>>2];c[d+(f*52|0)+4>>2]=c[b+(f*36|0)+4>>2];c[d+(f*52|0)+8>>2]=c[b+(f*36|0)+8>>2];c[d+(f*52|0)+12>>2]=c[b+(f*36|0)+12>>2];c[d+(f*52|0)+16>>2]=c[b+(f*36|0)+16>>2];c[d+(f*52|0)+20>>2]=c[b+(f*36|0)+20>>2];c[d+(f*52|0)+24>>2]=c[b+(f*36|0)+24>>2];c[d+(f*52|0)+32>>2]=c[b+(f*36|0)+32>>2];c[d+(f*52|0)+44>>2]=0;f=f+1|0}while((f|0)!=(a|0));return e|0}return 0}function bc(a,b,d){a=a|0;b=b|0;d=d|0;if(!a){d=0;return d|0}c[a+64>>2]=b;c[a+52>>2]=d;d=1;return d|0}function cc(a,b,d){a=a|0;b=b|0;d=d|0;if(!a){d=0;return d|0}c[a+60>>2]=b;c[a+48>>2]=d;d=1;return d|0}function dc(a,b,d){a=a|0;b=b|0;d=d|0;if(!a){d=0;return d|0}c[a+56>>2]=b;c[a+44>>2]=d;d=1;return d|0}function ec(a,b){a=a|0;b=b|0;var d=0;if(!a){a=0;return a|0}d=Eb(b)|0;if(!d){a=0;return a|0}Kb(d,a,0);Lb(d,c[a+8>>2]|0,0);if(!b)Ib(d,9);else Gb(d,8);Jb(d,1);Hb(d,10);a=d;return a|0}function fc(){return 4703}function gc(a){a=a|0;var b=0;b=Qc(1,84)|0;if(!b){a=0;return a|0}c[b+68>>2]=1;switch(a|0){case 0:{c[b+72>>2]=13;c[b+76>>2]=2;c[b+80>>2]=3;c[b+4>>2]=33;c[b+16>>2]=11;c[b>>2]=34;c[b+20>>2]=1;c[b+24>>2]=5;c[b+8>>2]=1;c[b+12>>2]=1;c[b+28>>2]=1;c[b+32>>2]=1;c[b+36>>2]=12;a=fd()|0;c[b+40>>2]=a;if(!a){Uc(b);a=0;return a|0}break}case 2:{c[b+72>>2]=14;c[b+76>>2]=4;c[b+80>>2]=5;c[b+4>>2]=35;c[b+16>>2]=13;c[b>>2]=36;c[b+8>>2]=2;c[b+12>>2]=2;c[b+20>>2]=2;c[b+24>>2]=6;c[b+28>>2]=2;c[b+32>>2]=2;c[b+36>>2]=14;a=Ye(1)|0;c[b+40>>2]=a;if(!a){Uc(b);a=0;return a|0}break}default:{Uc(b);a=0;return a|0}}Vb(b+44|0);a=b;return a|0}function hc(a){a=a|0;if(!a)return;Qi(a|0,0,8248)|0;c[a+8200>>2]=-1;c[a+8204>>2]=-1;c[a+8248>>2]=0;return}function ic(a,b){a=a|0;b=b|0;var d=0;d=i;i=i+16|0;if(!((a|0)!=0&(b|0)!=0)){b=0;i=d;return b|0}if(!(c[a+68>>2]|0)){Ub(a+44|0,1,4709,d)|0;b=0;i=d;return b|0}else{Ua[c[a+24>>2]&7](c[a+40>>2]|0,b);b=1;i=d;return b|0}return 0}function jc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=i;i=i+16|0;if(!((a|0)!=0&(b|0)!=0)){a=0;i=e;return a|0}if(!(c[b+68>>2]|0)){Ub(b+44|0,1,4790,e)|0;a=0;i=e;return a|0}else{a=Za[c[b>>2]&63](a,c[b+40>>2]|0,d,b+44|0)|0;i=e;return a|0}return 0}function kc(a,b,d){a=a|0;b=b|0;d=d|0;if(!((a|0)!=0&(b|0)!=0)){b=0;return b|0}if(!(c[a+68>>2]|0)){b=0;return b|0}b=Za[c[a+4>>2]&63](c[a+40>>2]|0,b,d,a+44|0)|0;return b|0}function lc(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;if(!a){e=0;return e|0}if(!(c[a+68>>2]|0)){e=0;return e|0}e=Qa[c[a+28>>2]&3](c[a+40>>2]|0,b,d,e,f,g,a+44|0)|0;return e|0}function mc(a,b,d,e,f,g,h,i,j,k){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;if(!((d|0)!=0&((a|0)!=0&(b|0)!=0&(e|0)!=0))){i=0;return i|0}if(!(c[a+68>>2]|0)){i=0;return i|0}i=Ya[c[a+8>>2]&3](c[a+40>>2]|0,d,e,f,g,h,i,j,k,b,a+44|0)|0;return i|0}function nc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;if(!((a|0)!=0&(d|0)!=0&(f|0)!=0)){b=0;return b|0}if(!(c[a+68>>2]|0)){b=0;return b|0}b=Va[c[a+12>>2]&7](c[a+40>>2]|0,b,d,e,f,a+44|0)|0;return b|0}function oc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;if(!((a|0)!=0&(b|0)!=0)){e=0;return e|0}if(!(c[a+68>>2]|0)){e=0;return e|0}e=$a[c[a+32>>2]&3](c[a+40>>2]|0,b,d,a+44|0,e)|0;return e|0}function pc(a,b){a=a|0;b=b|0;if(!a){b=0;return b|0}b=Ra[c[a+36>>2]&63](c[a+40>>2]|0,b,a+44|0)|0;return b|0}function qc(a){a=a|0;var b=0;b=Qc(1,84)|0;if(!b){a=0;return a|0}c[b+68>>2]=0;switch(a|0){case 0:{c[b+4>>2]=15;c[b+12>>2]=16;c[b>>2]=37;c[b+8>>2]=3;c[b+16>>2]=1;c[b+20>>2]=38;a=Xc()|0;c[b+40>>2]=a;if(!a){Uc(b);a=0;return a|0}break}case 2:{c[b+4>>2]=17;c[b+12>>2]=18;c[b>>2]=39;c[b+8>>2]=4;c[b+16>>2]=2;c[b+20>>2]=40;a=Ye(0)|0;c[b+40>>2]=a;if(!a){Uc(b);a=0;return a|0}break}default:{Uc(b);a=0;return a|0}}Vb(b+44|0);a=b;return a|0}function rc(b){b=b|0;if(!b)return;Qi(b|0,0,18708)|0;c[b+5592>>2]=6;c[b+18684>>2]=0;c[b+5596>>2]=64;c[b+5600>>2]=64;c[b+44>>2]=0;c[b+5612>>2]=-1;c[b+18188>>2]=1;c[b+18192>>2]=1;a[b+18688>>0]=0;c[b+18196>>2]=-1;c[b+18200>>2]=-1;g[b+4792>>2]=0.0;c[b+4788>>2]=0;c[b+20>>2]=0;c[b+24>>2]=0;c[b+28>>2]=0;c[b+18692>>2]=0;return}function sc(a,b,d){a=a|0;b=b|0;d=d|0;if(!((a|0)!=0&(b|0)!=0&(d|0)!=0)){b=0;return b|0}if(c[a+68>>2]|0){b=0;return b|0}b=Za[c[a+20>>2]&63](c[a+40>>2]|0,b,d,a+44|0)|0;return b|0}function tc(a,b,d){a=a|0;b=b|0;d=d|0;if(!((a|0)!=0&(d|0)!=0)){d=0;return d|0}if(c[a+68>>2]|0){d=0;return d|0}d=Za[c[a>>2]&63](c[a+40>>2]|0,d,b,a+44|0)|0;return d|0}function uc(a,b){a=a|0;b=b|0;if(!((a|0)!=0&(b|0)!=0)){b=0;return b|0}if(c[a+68>>2]|0){b=0;return b|0}b=Ra[c[a+4>>2]&63](c[a+40>>2]|0,b,a+44|0)|0;return b|0}function vc(a,b){a=a|0;b=b|0;if(!((a|0)!=0&(b|0)!=0)){b=0;return b|0}if(c[a+68>>2]|0){b=0;return b|0}b=Ra[c[a+12>>2]&63](c[a+40>>2]|0,b,a+44|0)|0;return b|0}function wc(a,b){a=a|0;b=b|0;if(!((a|0)!=0&(b|0)!=0)){b=0;return b|0}if(!(c[a+68>>2]|0)){b=0;return b|0}b=Ra[c[a+16>>2]&63](c[a+40>>2]|0,b,a+44|0)|0;return b|0}function xc(d,f,g,h){d=d|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0;k=h<<2;i=_(k,h)|0;j=d+18704|0;h=e[j>>1]|0;b[j>>1]=(h&32768|0)==0?-32512:(h|256)&65535;c[d+5608>>2]=1;a[d+18690>>0]=2;j=Pc(i+k|0)|0;h=d+18696|0;c[h>>2]=j;if(!j){g=0;return g|0}Ui(j|0,f|0,i|0)|0;Ui((c[h>>2]|0)+i|0,g|0,k|0)|0;g=1;return g|0}function yc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;if(!((d|0)!=0&((a|0)!=0&(f|0)!=0))){b=0;return b|0}if(c[a+68>>2]|0){b=0;return b|0}b=Va[c[a+8>>2]&7](c[a+40>>2]|0,b,d,e,f,a+44|0)|0;return b|0}function zc(a){a=a|0;var b=0,d=0;if(!a)return;b=a+40|0;d=c[b>>2]|0;if(!(c[a+68>>2]|0))Ta[c[a+16>>2]&7](d);else Ta[c[a+20>>2]&7](d);c[b>>2]=0;Uc(a);return}function Ac(a,b,d){a=a|0;b=b|0;d=d|0;if(!a)return;Xa[c[a+72>>2]&15](c[a+40>>2]|0,b,d);return}function Bc(a){a=a|0;if(!a){a=0;return a|0}a=Wa[c[a+76>>2]&15](c[a+40>>2]|0)|0;return a|0}function Cc(a){a=a|0;var b=0,d=0;if(!a)return;b=c[a>>2]|0;d=c[b+48>>2]|0;if(d){Uc(d);b=c[a>>2]|0}Uc(b);c[a>>2]=0;return}function Dc(a){a=a|0;if(!a){a=0;return a|0}a=Wa[c[a+80>>2]&15](c[a+40>>2]|0)|0;return a|0}function Ec(a){a=a|0;var b=0;b=c[a>>2]|0;if(!b)return;bd(b);c[a>>2]=0;return}function Fc(a,b){a=a|0;b=b|0;return Gc(a,1048576,b)|0}function Gc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;if(!a){b=0;return b|0}d=_h(a,(c|0)==0?4869:4872)|0;if(!d){b=0;return b|0}a=vb(b,c)|0;if(!a){Yh(d)|0;b=0;return b|0}else{Kb(a,d,6);fi(d,0,2)|0;b=ii(d)|0;fi(d,0,0)|0;Lb(a,b,((b|0)<0)<<31>>31);Gb(a,19);Ib(a,20);Jb(a,21);Hb(a,22);b=a;return b|0}return 0}function Hc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;g=(c[d>>2]|0)+(c[d+8>>2]|0)|0;d=d+4|0;e=c[d>>2]|0;f=g-e|0;if((g|0)==(e|0)){g=-1;return g|0}g=f>>>0>b>>>0?b:f;Ui(a|0,e|0,g|0)|0;c[d>>2]=(c[d>>2]|0)+g;return g|0}function Ic(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;k=d+4|0;e=c[k>>2]|0;i=d+8|0;g=c[i>>2]|0;j=e-(c[d>>2]|0)|0;f=(g|0)==0?1:g;while(1)if((f-j|0)>>>0>>0)f=f<<1;else{h=f;break}if((h|0)!=(g|0)){e=Pc(h)|0;if(!e){b=-1;return b|0}f=c[d>>2]|0;if(f){Ui(e|0,f|0,j|0)|0;Uc(c[d>>2]|0)}c[d>>2]=e;e=e+j|0;c[k>>2]=e;c[i>>2]=h}Ui(e|0,a|0,b|0)|0;c[k>>2]=(c[k>>2]|0)+b;return b|0}function Jc(a,b){a=a|0;b=b|0;var d=0,e=0,f=0;f=(c[b>>2]|0)+(c[b+8>>2]|0)|0;b=b+4|0;d=c[b>>2]|0;e=f-d|0;if((f|0)==(d|0)){f=-1;return f|0}c[b>>2]=d+a;f=e>>>0>a>>>0?a:e;return f|0}function Kc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;e=c[d+8>>2]|0;c[d+4>>2]=(c[d>>2]|0)+(0>(b|0)|0==(b|0)&e>>>0>a>>>0?a:e);return 1}function Lc(a,b,c){a=a|0;b=b|0;c=c|0;b=ci(a,1,b,c)|0;return((b|0)!=0?b:-1)|0}function Mc(a,b,c){a=a|0;b=b|0;c=c|0;return ki(a,1,b,c)|0}function Nc(a,b,c){a=a|0;b=b|0;c=c|0;c=(fi(c,a,1)|0)==0;C=c?b:-1;return(c?a:-1)|0}function Oc(a,b,c){a=a|0;b=b|0;c=c|0;return(fi(c,a,0)|0)==0|0}function Pc(a){a=a|0;if(!a)a=0;else a=Fi(a)|0;return a|0}function Qc(a,b){a=a|0;b=b|0;if(!b)a=0;else a=Hi(a,b)|0;return a|0}function Rc(a){a=a|0;var b=0,d=0;d=i;i=i+16|0;b=d;do{if(a)if(!(Ji(b,16,a)|0)){b=c[b>>2]|0;break}else{c[b>>2]=0;b=0;break}else b=0}while(0);i=d;return b|0}function Sc(a){a=a|0;Gi(a);return}function Tc(a,b){a=a|0;b=b|0;if(!b)b=0;else b=Ii(a,b)|0;return b|0}function Uc(a){a=a|0;Gi(a);return}function Vc(a){a=a|0;var b=0,d=0;b=696;while(1){d=c[b>>2]|0;if((d|0)==-1|(d|0)==(a|0))break;else b=b+12|0}return b+4|0}function Wc(a,b){a=a|0;b=b|0;if(!((a|0)!=0&(b|0)!=0))return;c[a+172>>2]=c[b+4>>2];c[a+168>>2]=c[b>>2];return}function Xc(){var b=0,d=0;b=Qc(1,208)|0;if(!b){b=0;return b|0}c[b>>2]=0;d=b+184|0;a[d>>0]=a[d>>0]&-3;d=Pc(1e3)|0;c[b+44>>2]=d;if(!d){Yc(b);d=0;return d|0}c[b+48>>2]=1e3;d=qg()|0;c[b+192>>2]=d;if(!d){Yc(b);d=0;return d|0}d=qg()|0;c[b+188>>2]=d;if(d){d=b;return d|0}Yc(b);d=0;return d|0}function Yc(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;if(!b)return;if(!(c[b>>2]|0)){d=b+36|0;e=c[d>>2]|0;if(e){Uc(e);c[d>>2]=0}d=b+24|0;e=c[d>>2]|0;if(e){Uc(e);c[d>>2]=0;c[b+28>>2]=0}d=b+44|0;e=c[d>>2]|0;if(e){Uc(e);c[d>>2]=0;c[b+48>>2]=0}}else{d=b+12|0;e=c[d>>2]|0;if(e){sd(e);Uc(c[d>>2]|0);c[d>>2]=0}d=b+16|0;e=c[d>>2]|0;if(e){Uc(e);c[d>>2]=0;c[b+20>>2]=0}}Yf(c[b+204>>2]|0);d=b+88|0;h=b+164|0;e=c[h>>2]|0;if(e){f=_(c[b+112>>2]|0,c[b+116>>2]|0)|0;if(f){g=0;while(1){sd(e);g=g+1|0;if((g|0)==(f|0))break;else e=e+5640|0}e=c[h>>2]|0}Uc(e);c[h>>2]=0}h=b+124|0;e=c[h>>2]|0;if(e){i=b+120|0;f=c[i>>2]|0;if(f){g=0;while(1){e=c[e+(g<<3)>>2]|0;if(e){Uc(e);f=c[i>>2]|0}g=g+1|0;if(g>>>0>=f>>>0)break;e=c[h>>2]|0}e=c[h>>2]|0}c[i>>2]=0;Uc(e);c[h>>2]=0}i=b+144|0;Uc(c[i>>2]|0);c[i>>2]=0;c[b+128>>2]=0;i=b+108|0;Uc(c[i>>2]|0);c[i>>2]=0;if(!(a[b+184>>0]&2)){i=b+176|0;Uc(c[i>>2]|0);c[i>>2]=0}e=d+100|0;do{c[d>>2]=0;d=d+4|0}while((d|0)<(e|0));i=b+188|0;rg(c[i>>2]|0);c[i>>2]=0;rg(c[b+192>>2]|0);c[i>>2]=0;i=b+196|0;bd(c[i>>2]|0);c[i>>2]=0;i=b+80|0;Zb(c[i>>2]|0);c[i>>2]=0;i=b+84|0;Zb(c[i>>2]|0);c[i>>2]=0;Uc(b);return}function Zc(d,e,f,j){d=d|0;e=e|0;f=f|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0.0;ka=i;i=i+320|0;fa=ka+296|0;ea=ka+288|0;ja=ka+280|0;ia=ka+272|0;ha=ka+264|0;ga=ka+256|0;da=ka+248|0;ca=ka+240|0;W=ka+232|0;U=ka+224|0;T=ka+216|0;S=ka+208|0;R=ka+200|0;Q=ka+192|0;P=ka+184|0;v=ka+176|0;u=ka+168|0;t=ka+160|0;s=ka+152|0;q=ka+144|0;I=ka+136|0;H=ka+128|0;N=ka+112|0;G=ka+104|0;F=ka+96|0;E=ka+88|0;C=ka+80|0;B=ka+72|0;A=ka+64|0;z=ka+56|0;y=ka+48|0;x=ka+32|0;w=ka+24|0;p=ka+16|0;m=ka+8|0;l=ka;K=ka+309|0;L=ka+300|0;if(!((d|0)!=0&(e|0)!=0&(f|0)!=0)){j=0;i=ka;return j|0}ba=e+5592|0;k=c[ba>>2]|0;if((k+-1|0)>>>0>32){c[l>>2]=k;c[l+4>>2]=33;Ub(j,1,4875,l)|0;j=0;i=ka;return j|0}$=d+112|0;c[$>>2]=1;aa=d+116|0;c[aa>>2]=1;J=e+18704|0;do{if(!(b[J>>1]|0)){switch(c[e+18676>>2]|0){case 1:{b[J>>1]=3;c[e+18700>>2]=1302083;c[e+18680>>2]=1041666;l=1;break}case 2:{b[J>>1]=3;c[e+18700>>2]=651041;c[e+18680>>2]=520833;l=1;break}case 3:{b[J>>1]=4;c[e+18700>>2]=1302083;c[e+18680>>2]=1041666;l=1;break}default:l=0}k=c[e+18684>>2]|0;a:do{if((k|0)>=4)if((k|0)<33024){switch(k|0){case 4:break;default:{Z=13;break a}}b[J>>1]=4;break}else{switch(k|0){case 33024:break;default:{Z=13;break a}}b[J>>1]=-32512;break}else{switch(k|0){case 3:break;default:{Z=13;break a}}b[J>>1]=3}}while(0);if((Z|0)==13?(l|0)==0:0)break;Ub(j,2,4931,m)|0}}while(0);D=e+18700|0;k=c[D>>2]|0;do{if((k|0)<1){r=+g[e+4792+((c[e+4788>>2]|0)+-1<<2)>>2];if(r>0.0){X=c[f+24>>2]|0;p=_(c[X+8>>2]|0,c[f+16>>2]|0)|0;p=_(p,c[X+12>>2]|0)|0;la=+((_(p,c[X+24>>2]|0)|0)>>>0);c[D>>2]=~~+M(+(la/(r*8.0*+((c[X>>2]|0)>>>0)*+((c[X+4>>2]|0)>>>0))));break}else{c[D>>2]=0;break}}else{o=c[f+24>>2]|0;X=_(c[o+8>>2]|0,c[f+16>>2]|0)|0;X=_(X,c[o+12>>2]|0)|0;r=+((_(X,c[o+24>>2]|0)|0)>>>0);k=_(k<<3,c[o>>2]|0)|0;r=r/+((_(k,c[o+4>>2]|0)|0)>>>0);o=e+4788|0;k=c[o>>2]|0;if(k){m=k;k=0;n=0;while(1){l=e+4792+(n<<2)|0;if(+g[l>>2]>2]=r;l=c[o>>2]|0;k=1}else l=m;n=n+1|0;if(n>>>0>=l>>>0)break;else m=l}if(k)Ub(j,2,5068,p)|0}}}while(0);k=b[J>>1]|0;b:do{if((k+-3&65535)>=4){if(k<<16>>16==7){Ub(j,2,7228,q)|0;b[J>>1]=0;k=0;break}if((k+-256&65535)<524){Ub(j,2,7283,s)|0;b[J>>1]=0;k=0;break}if((k+-1024&65535)<1180){Ub(j,2,7331,t)|0;b[J>>1]=0;k=0;break}if(k<<16>>16<=-1)switch(k<<16>>16){case-32512:{k=-32512;break b}case-32768:{Ub(j,2,7373,u)|0;b[J>>1]=0;k=0;break b}default:{Ub(j,2,7461,v)|0;b[J>>1]=0;k=0;break b}}}else{if((k+-5&65535)<2){Ub(j,2,5160,w)|0;b[J>>1]=0;k=0;break}c[e>>2]=0;c[e+12>>2]=1;c[e+16>>2]=1;a[e+18689>>0]=67;a[e+18688>>0]=1;c[e+4>>2]=0;c[e+8>>2]=0;c[e+18180>>2]=0;c[e+18184>>2]=0;c[e+5596>>2]=32;c[e+5600>>2]=32;c[e+5604>>2]=0;c[e+5612>>2]=-1;c[e+18188>>2]=1;c[e+18192>>2]=1;c[e+5608>>2]=1;l=e+4788|0;m=c[l>>2]|0;if((m|0)>1){la=+g[e+4792+(m+-1<<2)>>2];c[x>>2]=m;h[x+8>>3]=la;Ub(j,2,5222,x)|0;c[e+4792>>2]=c[e+4792+((c[l>>2]|0)+-1<<2)>>2];c[l>>2]=1;k=b[J>>1]|0}c:do{switch(k&65535|0){case 3:{k=c[ba>>2]|0;if((k|0)>6){c[y>>2]=k+1;Ub(j,2,5395,y)|0;c[ba>>2]=6;k=6}break}case 4:{k=c[ba>>2]|0;if((k|0)<2){c[z>>2]=k+1;Ub(j,2,5541,z)|0;c[ba>>2]=1;k=1;break c}if((k|0)>7){c[A>>2]=k+1;Ub(j,2,5695,A)|0;c[ba>>2]=7;k=7}break}default:k=c[ba>>2]|0}}while(0);l=e+40|0;c[l>>2]=c[l>>2]|1;l=e+5620|0;c[l>>2]=k+-1;if((k|0)>1){k=0;do{c[e+5624+(k<<2)>>2]=256;c[e+5756+(k<<2)>>2]=256;k=k+1|0}while((k|0)<(c[l>>2]|0))}c[e+44>>2]=4;if((b[J>>1]|0)==4){k=c[ba>>2]|0;c[e+96>>2]=1;c[e+48>>2]=0;c[e+52>>2]=0;c[e+56>>2]=1;X=k+-1|0;c[e+60>>2]=X;c[e+64>>2]=3;c[e+80>>2]=4;c[e+244>>2]=1;c[e+196>>2]=X;c[e+200>>2]=0;c[e+204>>2]=1;c[e+208>>2]=k;c[e+212>>2]=3;c[e+228>>2]=4;k=2}else k=0;c[e+4784>>2]=k;c[e+20>>2]=1;k=c[D>>2]|0;if((k|0)>=1){if((k|0)>1302083){Ub(j,2,5998,C)|0;c[D>>2]=1302083}}else{c[D>>2]=1302083;Ub(j,2,5849,B)|0}k=e+18680|0;l=c[k>>2]|0;if((l|0)>=1){if((l|0)>1041666){Ub(j,2,6320,F)|0;c[k>>2]=1041666}}else{c[k>>2]=1041666;Ub(j,2,6171,E)|0}l=c[f+16>>2]|0;n=c[f+24>>2]|0;o=c[n+8>>2]|0;k=_(o,l)|0;p=c[n+12>>2]|0;k=_(k,p)|0;la=+((_(k,c[n+24>>2]|0)|0)>>>0);k=_(c[D>>2]<<3,c[n>>2]|0)|0;g[e+4792>>2]=la/+((_(k,c[n+4>>2]|0)|0)>>>0);k=b[J>>1]|0;d:do{if((l|0)==3){l=n+28|0;m=n+32|0;if(!((c[l>>2]|0)!=12|c[m>>2])){l=n+80|0;m=n+84|0;if(!((c[l>>2]|0)!=12|c[m>>2])){l=n+132|0;m=n+136|0;if(!((c[l>>2]|0)!=12|c[m>>2])){switch(k&65535|0){case 3:{if(p>>>0>1080|o>>>0>2048){c[H>>2]=o;c[H+4>>2]=p;Ub(j,2,6892,H)|0;break d}break}case 4:{if(p>>>0>2160|o>>>0>4096){c[I>>2]=o;c[I+4>>2]=p;Ub(j,2,7063,I)|0;break d}break}default:{}}break b}else{p=l;k=m;l=2}}else{p=l;k=m;l=1}}else{p=l;k=m;l=0}a[K>>0]=a[6659]|0;a[K+1>>0]=a[6660]|0;a[K+2>>0]=a[6661]|0;a[K+3>>0]=a[6662]|0;a[K+4>>0]=a[6663]|0;a[K+5>>0]=a[6664]|0;a[K+6>>0]=a[6665]|0;m=L;n=6666;o=m+9|0;do{a[m>>0]=a[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));X=(c[k>>2]|0)!=0?K:L;L=c[p>>2]|0;c[N>>2]=l;c[N+4>>2]=L;c[N+8>>2]=X;Ub(j,2,6675,N)|0}else{c[G>>2]=l;Ub(j,2,6493,G)|0}}while(0);b[J>>1]=0;k=0}}while(0);c[d+168>>2]=c[e+18680>>2];X=d+88|0;b[X>>1]=k;N=d+181|0;K=a[N>>0]&-2|c[e+20>>2]&1;a[N>>0]=K;L=e+24|0;K=(c[L>>2]&255)<<1&2|K&-3;a[N>>0]=K;a[N>>0]=K&-5|(c[e+28>>2]&255)<<2&4;do{if((c[L>>2]|0)!=0?(O=e+32|0,(c[O>>2]|0)!=0):0){k=_((c[e+4788>>2]|0)*12|0,c[ba>>2]|0)|0;l=Pc(k)|0;c[d+176>>2]=l;if(l){Ui(l|0,c[O>>2]|0,k|0)|0;break}Ub(j,1,7520,P)|0;j=0;i=ka;return j|0}}while(0);n=d+100|0;c[n>>2]=c[e+12>>2];o=d+104|0;c[o>>2]=c[e+16>>2];m=d+92|0;c[m>>2]=c[e+4>>2];p=d+96|0;c[p>>2]=c[e+8>>2];l=e+36|0;k=c[l>>2]|0;do{if(!k){k=fc()|0;l=Pc((wi(k)|0)+29|0)|0;c[d+108>>2]=l;if(l){c[S>>2]=7697;c[S+4>>2]=k;ni(l,7692,S)|0;break}Ub(j,1,7646,R)|0;j=0;i=ka;return j|0}else{k=Pc((wi(k)|0)+1|0)|0;c[d+108>>2]=k;if(k){vi(k,c[l>>2]|0)|0;break}Ub(j,1,7592,Q)|0;j=0;i=ka;return j|0}}while(0);k=(c[f+8>>2]|0)-(c[m>>2]|0)|0;l=c[f+12>>2]|0;if(!(c[e>>2]|0)){c[n>>2]=k;c[o>>2]=l-(c[p>>2]|0)}else{S=c[n>>2]|0;c[$>>2]=(k+-1+S|0)/(S|0)|0;S=c[o>>2]|0;c[aa>>2]=(l+-1-(c[p>>2]|0)+S|0)/(S|0)|0}if(a[e+18688>>0]|0){a[d+180>>0]=a[e+18689>>0]|0;a[N>>0]=a[N>>0]|8}S=Qc(_(c[aa>>2]|0,c[$>>2]|0)|0,5640)|0;L=d+164|0;c[L>>2]=S;if(!S){Ub(j,1,7726,T)|0;j=0;i=ka;return j|0}K=e+4784|0;A=c[K>>2]|0;do{if(A){w=e+48|0;B=c[ba>>2]|0;C=c[f+16>>2]|0;D=c[e+4788>>2]|0;E=_(C,B)|0;F=Qc(_(E,D)|0,4)|0;if(!F){Ub(j,1,7780,U)|0;break}m=c[w>>2]|0;s=e+60|0;k=c[s>>2]|0;if(m>>>0>>0){q=_(m,C)|0;t=e+52|0;u=e+64|0;v=e+56|0;l=c[u>>2]|0;while(1){n=c[t>>2]|0;if(n>>>0>>0){k=c[v>>2]|0;p=n;o=n+q|0;while(1){if(!k)k=0;else{l=o;n=0;while(1){c[F+(l<<2)>>2]=1;n=n+1|0;k=c[v>>2]|0;if(n>>>0>=k>>>0)break;else l=l+E|0}l=c[u>>2]|0}p=p+1|0;if(p>>>0>=l>>>0)break;else o=o+1|0}k=c[s>>2]|0}m=m+1|0;if(m>>>0>=k>>>0)break;else q=q+C|0}}if(A>>>0>1){z=1;do{k=w;w=w+148|0;v=c[k+8>>2]|0;u=k+156|0;n=c[u>>2]|0;v=n>>>0>v>>>0?v:0;o=c[w>>2]|0;x=k+160|0;l=c[x>>2]|0;if(o>>>0>>0){q=_(o,C)|0;y=k+152|0;s=k+164|0;t=_(v,E)|0;m=c[s>>2]|0;k=n;while(1){n=c[y>>2]|0;if(n>>>0>>0){p=n;n=n+q|0;while(1){if(v>>>0>>0){l=n+t|0;m=v;while(1){c[F+(l<<2)>>2]=1;m=m+1|0;k=c[u>>2]|0;if(m>>>0>=k>>>0)break;else l=l+E|0}m=c[s>>2]|0}p=p+1|0;if(p>>>0>=m>>>0)break;else n=n+1|0}l=c[x>>2]|0}o=o+1|0;if(o>>>0>=l>>>0)break;else q=q+C|0}}z=z+1|0}while((z|0)!=(A|0))}if((D|0)!=0?(V=(C|0)==0,(B|0)!=0):0){l=0;q=0;k=0;do{if(!V){p=l;o=0;while(1){m=0;n=p;while(1){k=(c[F+(n<<2)>>2]|0)!=1|k;m=m+1|0;if((m|0)==(C|0))break;else n=n+1|0}o=o+1|0;if((o|0)==(B|0))break;else p=p+C|0}l=E+l|0}q=q+1|0}while((q|0)!=(D|0));if(k)Ub(j,1,7828,W)|0}Uc(F)}}while(0);e:do{if(_(c[aa>>2]|0,c[$>>2]|0)|0){w=e+4788|0;x=e+40|0;y=e+44|0;z=e+18690|0;A=f+16|0;l=e+18696|0;B=f+24|0;C=e+5596|0;D=e+5600|0;E=e+5604|0;F=e+5608|0;G=e+5612|0;H=e+5616|0;I=e+5620|0;J=0;f:while(1){q=c[L>>2]|0;s=q+(J*5640|0)|0;W=c[w>>2]|0;k=q+(J*5640|0)+8|0;c[k>>2]=W;if(W){m=((b[X>>1]|0)+-3&65535)<4;o=0;do{n=(a[N>>0]&4)==0;do{if(!m)if(n){c[q+(J*5640|0)+20+(o<<2)>>2]=c[e+4792+(o<<2)>>2];break}else{c[q+(J*5640|0)+5184+(o<<2)>>2]=c[e+5192+(o<<2)>>2];break}else{if(!n)c[q+(J*5640|0)+5184+(o<<2)>>2]=c[e+5192+(o<<2)>>2];c[q+(J*5640|0)+20+(o<<2)>>2]=c[e+4792+(o<<2)>>2]}}while(0);o=o+1|0}while(o>>>0<(c[k>>2]|0)>>>0)}c[s>>2]=c[x>>2];c[q+(J*5640|0)+4>>2]=c[y>>2];p=q+(J*5640|0)+16|0;c[p>>2]=a[z>>0];k=q+(J*5640|0)+5636|0;m=a[k>>0]|0;a[k>>0]=m&-5;if(!(c[K>>2]|0))c[q+(J*5640|0)+420>>2]=0;else{a[k>>0]=m|4;m=c[K>>2]|0;if(!m)k=0;else{n=J+1|0;o=0;k=0;do{if((n|0)==(c[e+48+(o*148|0)+48>>2]|0)){c[q+(J*5640|0)+424+(k*148|0)>>2]=c[e+48+(k*148|0)>>2];c[q+(J*5640|0)+424+(k*148|0)+4>>2]=c[e+48+(k*148|0)+4>>2];c[q+(J*5640|0)+424+(k*148|0)+8>>2]=c[e+48+(k*148|0)+8>>2];c[q+(J*5640|0)+424+(k*148|0)+12>>2]=c[e+48+(k*148|0)+12>>2];c[q+(J*5640|0)+424+(k*148|0)+16>>2]=c[e+48+(k*148|0)+16>>2];c[q+(J*5640|0)+424+(k*148|0)+32>>2]=c[e+48+(k*148|0)+32>>2];c[q+(J*5640|0)+424+(k*148|0)+48>>2]=c[e+48+(k*148|0)+48>>2];k=k+1|0}o=o+1|0}while(o>>>0>>0)}c[q+(J*5640|0)+420>>2]=k+-1}W=Qc(c[A>>2]|0,1080)|0;v=q+(J*5640|0)+5584|0;c[v>>2]=W;if(!W){Z=149;break}do{if(!(c[l>>2]|0)){g:do{if((c[p>>2]|0)==1){k=c[A>>2]|0;if(k>>>0<=2){n=k;break}m=c[B>>2]|0;k=c[m>>2]|0;do{if((k|0)==(c[m+52>>2]|0)){if((k|0)!=(c[m+104>>2]|0))break;k=c[m+4>>2]|0;if((k|0)!=(c[m+56>>2]|0))break;if((k|0)==(c[m+108>>2]|0)){Z=175;break g}}}while(0);Ub(j,2,8224,fa)|0;c[p>>2]=0;Z=175}else Z=175}while(0);if((Z|0)==175){Z=0;n=c[A>>2]|0}if(!n)break;k=c[B>>2]|0;m=0;do{if(!(c[k+(m*52|0)+32>>2]|0))c[(c[v>>2]|0)+(m*1080|0)+1076>>2]=1<<(c[k+(m*52|0)+24>>2]|0)+-1;m=m+1|0}while(m>>>0>>0);Y=n;Z=166}else{n=c[A>>2]|0;n=_(n<<2,n)|0;k=Pc(n)|0;o=(c[l>>2]|0)+n|0;if(!k){Z=152;break f}c[p>>2]=2;m=Pc(n)|0;c[q+(J*5640|0)+5608>>2]=m;if(!m){Z=154;break f}Ui(m|0,c[l>>2]|0,n|0)|0;Ui(k|0,c[l>>2]|0,n|0)|0;m=Pc(n)|0;n=q+(J*5640|0)+5604|0;c[n>>2]=m;if(!m){Z=156;break f}if(!(Vg(k,m,c[A>>2]|0)|0)){Z=158;break f}m=Pc(c[A>>2]<<3)|0;c[q+(J*5640|0)+5600>>2]=m;if(!m){Z=160;break f}If(m,c[A>>2]|0,c[n>>2]|0);Uc(k);k=c[A>>2]|0;if(k){m=c[v>>2]|0;n=0;do{c[m+(n*1080|0)+1076>>2]=c[o+(n<<2)>>2];n=n+1|0}while(n>>>0>>0)}if(!(_c(s,f)|0)){Z=167;break f}Y=c[A>>2]|0;Z=166}}while(0);if((Z|0)==166?(Z=0,(Y|0)!=0):0){u=0;do{s=c[v>>2]|0;t=s+(u*1080|0)|0;c[t>>2]=c[x>>2]&1;n=c[ba>>2]|0;o=s+(u*1080|0)+4|0;c[o>>2]=n;k=c[C>>2]|0;if((k|0)>1){m=0;do{k=k>>1;m=m+1|0}while((k|0)>1);k=m}else k=0;c[s+(u*1080|0)+8>>2]=k;k=c[D>>2]|0;if((k|0)>1){m=0;do{k=k>>1;m=m+1|0}while((k|0)>1);k=m}else k=0;c[s+(u*1080|0)+12>>2]=k;c[s+(u*1080|0)+16>>2]=c[E>>2];W=c[F>>2]|0;c[s+(u*1080|0)+20>>2]=(W|0)==0&1;c[s+(u*1080|0)+24>>2]=(W|0)!=0?2:0;c[s+(u*1080|0)+804>>2]=2;if((u|0)==(c[G>>2]|0))k=c[H>>2]|0;else k=0;c[s+(u*1080|0)+808>>2]=k;do{if(!(c[x>>2]&1)){if(!n)break;else k=0;do{c[s+(u*1080|0)+812+(k<<2)>>2]=15;c[s+(u*1080|0)+944+(k<<2)>>2]=15;k=k+1|0}while(k>>>0<(c[o>>2]|0)>>>0)}else{if((n|0)>0){o=n;q=0}else break;while(1){p=o;o=o+-1|0;k=c[I>>2]|0;do{if((q|0)<(k|0)){k=c[e+5624+(q<<2)>>2]|0;if((k|0)<1)c[s+(u*1080|0)+812+(o<<2)>>2]=1;else{if((k|0)>1){m=0;do{k=k>>1;m=m+1|0}while((k|0)>1);k=m}else k=0;c[s+(u*1080|0)+812+(o<<2)>>2]=k}k=c[e+5756+(q<<2)>>2]|0;if((k|0)<1){c[s+(u*1080|0)+944+(o<<2)>>2]=1;break}if((k|0)>1){m=0;do{k=k>>1;m=m+1|0}while((k|0)>1);k=m}else k=0;c[s+(u*1080|0)+944+(o<<2)>>2]=k}else{W=k+-1|0;m=q-W|0;k=c[e+5624+(W<<2)>>2]>>m;m=c[e+5756+(W<<2)>>2]>>m;if((k|0)<1)c[s+(u*1080|0)+812+(o<<2)>>2]=1;else{if((k|0)>1){n=0;do{k=k>>1;n=n+1|0}while((k|0)>1);k=n}else k=0;c[s+(u*1080|0)+812+(o<<2)>>2]=k}if((m|0)<1){c[s+(u*1080|0)+944+(o<<2)>>2]=1;break}if((m|0)>1){k=0;do{m=m>>1;k=k+1|0}while((m|0)>1)}else k=0;c[s+(u*1080|0)+944+(o<<2)>>2]=k}}while(0);if((p|0)<=1)break;else q=q+1|0}}}while(0);Mg(t,c[(c[B>>2]|0)+(u*52|0)+24>>2]|0);u=u+1|0}while(u>>>0<(c[A>>2]|0)>>>0)}J=J+1|0;if(J>>>0>=(_(c[aa>>2]|0,c[$>>2]|0)|0)>>>0)break e}if((Z|0)==149){Ub(j,1,7867,ca)|0;j=0;i=ka;return j|0}else if((Z|0)==152){Ub(j,1,7931,da)|0;j=0;i=ka;return j|0}else if((Z|0)==154){Uc(k);Ub(j,1,7974,ga)|0;j=0;i=ka;return j|0}else if((Z|0)==156){Uc(k);Ub(j,1,8032,ha)|0;j=0;i=ka;return j|0}else if((Z|0)==158){Uc(k);Ub(j,1,8092,ia)|0;j=0;i=ka;return j|0}else if((Z|0)==160){Uc(k);Ub(j,1,8140,ja)|0;j=0;i=ka;return j|0}else if((Z|0)==167){Ub(j,1,8190,ea)|0;j=0;i=ka;return j|0}}else l=e+18696|0}while(0);k=c[l>>2]|0;if(!k){j=1;i=ka;return j|0}Uc(k);c[l>>2]=0;j=1;i=ka;return j|0}function _c(b,d){b=b|0;d=d|0;var e=0,f=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;if((c[b+16>>2]|0)!=2){b=1;return b|0}m=b+5604|0;r=b+5616|0;e=c[r>>2]|0;n=b+5620|0;do{if(c[m>>2]|0){do{if((e|0)==(c[n>>2]|0)){e=e+10|0;c[n>>2]=e;f=b+5612|0;e=Tc(c[f>>2]|0,e*20|0)|0;if(e){c[f>>2]=e;q=c[r>>2]|0;Qi(e+(q*20|0)|0,0,((c[n>>2]|0)-q|0)*20|0)|0;e=c[r>>2]|0;break}Uc(c[f>>2]|0);c[f>>2]=0;c[n>>2]=0;c[r>>2]=0;b=0;return b|0}else f=b+5612|0}while(0);k=c[f>>2]|0;i=k+(e*20|0)|0;l=k+(e*20|0)+12|0;f=c[l>>2]|0;if(f){Uc(f);c[l>>2]=0}c[k+(e*20|0)+8>>2]=1;c[k+(e*20|0)+4>>2]=1;c[i>>2]=2;f=c[d+16>>2]|0;f=_(f,f)|0;h=f<<2;j=Pc(h)|0;c[l>>2]=j;if(!j){b=0;return b|0}else{Xa[c[768+(c[i>>2]<<2)>>2]&15](c[m>>2]|0,j,f);c[k+(e*20|0)+16>>2]=h;e=(c[r>>2]|0)+1|0;c[r>>2]=e;j=2;break}}else{j=1;i=0}}while(0);do{if((e|0)==(c[n>>2]|0)){f=e+10|0;c[n>>2]=f;e=b+5612|0;f=Tc(c[e>>2]|0,f*20|0)|0;if(!f){Uc(c[e>>2]|0);c[e>>2]=0;c[n>>2]=0;c[r>>2]=0;b=0;return b|0}else{c[e>>2]=f;h=c[r>>2]|0;Qi(f+(h*20|0)|0,0,((c[n>>2]|0)-h|0)*20|0)|0;if(!i){i=0;break}i=f+((h+-1|0)*20|0)|0;break}}else e=b+5612|0}while(0);m=c[e>>2]|0;n=c[r>>2]|0;q=m+(n*20|0)|0;o=m+(n*20|0)+12|0;e=c[o>>2]|0;if(e){Uc(e);c[o>>2]=0}p=j+1|0;c[m+(n*20|0)+8>>2]=j;c[m+(n*20|0)+4>>2]=2;c[q>>2]=2;d=d+16|0;e=c[d>>2]|0;f=e<<2;l=Pc(f)|0;c[o>>2]=l;if(!l){b=0;return b|0}h=Pc(f)|0;if(!h){Uc(c[o>>2]|0);c[o>>2]=0;b=0;return b|0}if(e){j=0;k=h;l=c[b+5584>>2]|0;while(1){g[k>>2]=+(c[l+1076>>2]|0);j=j+1|0;if((j|0)==(e|0))break;else{k=k+4|0;l=l+1080|0}}}Xa[c[768+(c[q>>2]<<2)>>2]&15](h,c[o>>2]|0,e);Uc(h);c[m+(n*20|0)+16>>2]=f;c[r>>2]=(c[r>>2]|0)+1;j=b+5628|0;e=c[j>>2]|0;h=b+5632|0;do{if((e|0)==(c[h>>2]|0)){e=e+10|0;c[h>>2]=e;f=b+5624|0;e=Tc(c[f>>2]|0,e*20|0)|0;if(e){c[f>>2]=e;b=c[j>>2]|0;Qi(e+(b*20|0)|0,0,((c[h>>2]|0)-b|0)*20|0)|0;e=c[j>>2]|0;break}Uc(c[f>>2]|0);c[f>>2]=0;c[h>>2]=0;c[j>>2]=0;b=0;return b|0}else f=b+5624|0}while(0);b=c[f>>2]|0;c[b+(e*20|0)+8>>2]=i;r=b+(e*20|0)+16|0;a[r>>0]=a[r>>0]|1;c[b+(e*20|0)+4>>2]=c[d>>2];c[b+(e*20|0)>>2]=p;c[b+(e*20|0)+12>>2]=q;c[j>>2]=(c[j>>2]|0)+1;b=1;return b|0}function $c(a,b,c){a=a|0;b=b|0;c=c|0;return 1}function ad(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;j=Xb()|0;k=b+80|0;c[k>>2]=j;if(!j){k=0;return k|0}f=b+192|0;if((sg(c[f>>2]|0,23,e)|0)!=0?(sg(c[f>>2]|0,24,e)|0)!=0:0){h=c[f>>2]|0;i=tg(h)|0;f=ug(h)|0;if(i){j=0;g=1;while(1){if(!g)g=0;else g=(Ra[c[f>>2]&63](b,a,e)|0)!=0;j=j+1|0;if((j|0)==(i|0))break;else{f=f+4|0;g=g&1}}vg(h);if(!g){Zb(c[k>>2]|0);c[k>>2]=0;k=0;return k|0}}else vg(h);f=b+188|0;if((sg(c[f>>2]|0,25,e)|0)!=0?(sg(c[f>>2]|0,26,e)|0)!=0:0){h=c[f>>2]|0;i=tg(h)|0;f=ug(h)|0;if(i){j=0;g=1;while(1){if(!g)g=0;else g=(Ra[c[f>>2]&63](b,a,e)|0)!=0;j=j+1|0;if((j|0)==(i|0))break;else{f=f+4|0;g=g&1}}vg(h);if(!g){Zb(c[k>>2]|0);c[k>>2]=0;k=0;return k|0}}else vg(h);f=Xb()|0;c[d>>2]=f;if(!f){k=0;return k|0}$b(c[k>>2]|0,f);f=_(c[b+116>>2]|0,c[b+112>>2]|0)|0;i=b+196|0;c[(c[i>>2]|0)+36>>2]=f;f=Qc(f,40)|0;g=c[i>>2]|0;c[g+40>>2]=f;if(!f){k=0;return k|0}if(!(c[g+36>>2]|0)){k=1;return k|0}h=0;while(1){c[f+(h*40|0)+28>>2]=100;c[f+(h*40|0)+20>>2]=0;k=Qc(100,24)|0;g=c[i>>2]|0;f=c[g+40>>2]|0;c[f+(h*40|0)+24>>2]=k;h=h+1|0;if(!k){f=0;g=30;break}if(h>>>0>=(c[g+36>>2]|0)>>>0){f=1;g=30;break}}if((g|0)==30)return f|0}Zb(c[k>>2]|0);c[k>>2]=0;k=0;return k|0}Zb(c[k>>2]|0);c[k>>2]=0;k=0;return k|0}function bd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;if(!a)return;b=a+28|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}h=a+40|0;b=c[h>>2]|0;if(b){g=a+36|0;if(c[g>>2]|0){d=b;f=0;do{e=c[d+(f*40|0)+36>>2]|0;if(e){Uc(e);b=c[h>>2]|0;c[b+(f*40|0)+36>>2]=0;d=b}e=c[d+(f*40|0)+16>>2]|0;if(e){Uc(e);b=c[h>>2]|0;c[b+(f*40|0)+16>>2]=0;d=b}e=c[d+(f*40|0)+24>>2]|0;if(e){Uc(e);d=c[h>>2]|0;c[d+(f*40|0)+24>>2]=0;b=d}f=f+1|0}while(f>>>0<(c[g>>2]|0)>>>0)}Uc(b);c[h>>2]=0}Uc(a);return}function cd(d,e,f,g,h,j,k,l,m,n,o){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0;Da=i;i=i+256|0;Ca=Da+200|0;Ba=Da+192|0;za=Da+184|0;ya=Da+176|0;pa=Da+168|0;oa=Da+160|0;na=Da+152|0;ma=Da+144|0;la=Da+136|0;ka=Da+128|0;ia=Da+120|0;ha=Da+112|0;wa=Da+104|0;ua=Da+96|0;ga=Da+88|0;fa=Da+80|0;ea=Da+72|0;va=Da+64|0;da=Da+56|0;ca=Da+48|0;sa=Da+40|0;ra=Da+32|0;qa=Da+24|0;ja=Da+16|0;ba=Da+8|0;aa=Da;V=Da+240|0;T=Da+236|0;X=Da+232|0;Z=Da+228|0;$=Da+224|0;U=Da+220|0;Y=Da+216|0;S=Da+212|0;W=Da+208|0;c[S>>2]=65424;Aa=d+8|0;a:do{switch(c[Aa>>2]|0){case 256:{c[S>>2]=65497;p=d+76|0;xa=117;break}case 8:{ta=d+76|0;if(!(a[ta>>0]&1)){O=d+200|0;P=d+164|0;Q=d+72|0;R=d+24|0;B=d+196|0;D=d+112|0;E=d+116|0;G=V+2|0;H=V+6|0;I=V+7|0;J=d+16|0;K=d+20|0;L=d+64|0;p=65424;b:while(1){c:do{if((p|0)!=65427){while(1){A=Qb(n)|0;if((A|0)==0&(C|0)==0){xa=7;break}if((Mb(n,c[J>>2]|0,2,o)|0)!=2){xa=9;break b}qb(c[J>>2]|0,W,2);if((c[W>>2]|0)>>>0<2){xa=11;break b}if((c[S>>2]|0)==32896?(A=Qb(n)|0,(A|0)==0&(C|0)==0):0){xa=14;break}s=c[Aa>>2]|0;p=c[W>>2]|0;if(s&16)c[R>>2]=-2-p+(c[R>>2]|0);q=p+-2|0;c[W>>2]=q;p=c[S>>2]|0;r=784;while(1){A=c[r>>2]|0;if((A|0)==0|(A|0)==(p|0)){y=r;break}else r=r+12|0}if(!(c[r+4>>2]&s)){xa=20;break b}if(q>>>0>(c[K>>2]|0)>>>0){A=Qb(n)|0;z=C;if(0>(z|0)|0==(z|0)&q>>>0>A>>>0){xa=24;break b}p=Tc(c[J>>2]|0,c[W>>2]|0)|0;if(!p){xa=26;break b}c[J>>2]=p;q=c[W>>2]|0;c[K>>2]=q}else p=c[J>>2]|0;q=Mb(n,p,q,o)|0;if((q|0)!=(c[W>>2]|0)){xa=29;break b}p=c[r+8>>2]|0;if(!p){xa=31;break b}if(!(Za[p&63](d,c[J>>2]|0,q,o)|0)){xa=33;break b}r=c[O>>2]|0;q=c[B>>2]|0;v=c[y>>2]|0;w=Pb(n)|0;x=c[W>>2]|0;w=w-x+-4|0;x=x+4|0;q=q+40|0;u=c[q>>2]|0;p=c[u+(r*40|0)+20>>2]|0;s=u+(r*40|0)+28|0;t=c[s>>2]|0;if((p+1|0)>>>0>t>>>0){t=~~(+(t>>>0)+100.0)>>>0;c[s>>2]=t;s=Tc(c[u+(r*40|0)+24>>2]|0,t*24|0)|0;t=c[q>>2]|0;p=t+(r*40|0)+24|0;if(!s){xa=41;break b}c[p>>2]=s;q=t;p=c[t+(r*40|0)+20>>2]|0}else{q=u;s=c[u+(r*40|0)+24>>2]|0}b[s+(p*24|0)>>1]=v;A=s+(p*24|0)+8|0;c[A>>2]=w;c[A+4>>2]=((w|0)<0)<<31>>31;c[s+(p*24|0)+16>>2]=x;c[q+(r*40|0)+20>>2]=p+1;if((v|0)==65424?(F=c[q+(r*40|0)+16>>2]|0,(F|0)!=0):0){A=F+((c[q+(r*40|0)+12>>2]|0)*24|0)|0;c[A>>2]=w;c[A+4>>2]=0}do{if((c[y>>2]|0)==65424){p=Pb(n)|0;p=-4-(c[W>>2]|0)+p|0;A=L;z=c[A+4>>2]|0;if(!(0>(z|0)|(0==(z|0)?p>>>0>(c[A>>2]|0)>>>0:0)))break;A=L;c[A>>2]=p;c[A+4>>2]=0}}while(0);if(a[ta>>0]&4){xa=46;break}if((Mb(n,c[J>>2]|0,2,o)|0)!=2){xa=50;break b}qb(c[J>>2]|0,S,2);if((c[S>>2]|0)==65427)break c}if((xa|0)==7){xa=0;c[Aa>>2]=64;break}else if((xa|0)==14){xa=0;c[Aa>>2]=64;break}else if((xa|0)==46){xa=0;A=Rb(n,c[R>>2]|0,0,o)|0;if(!((C|0)==0?(A|0)==(c[R>>2]|0):0)){xa=47;break b}c[S>>2]=65427;break}}}while(0);A=Qb(n)|0;if((A|0)==0&(C|0)==0?(c[Aa>>2]|0)==64:0){xa=115;break}p=a[ta>>0]|0;if(!(p&4)){q=c[O>>2]|0;r=c[P>>2]|0;if(!(c[Q>>2]|0)){p=c[R>>2]|0;if(p>>>0>1){s=p+-2|0;c[R>>2]=s}else s=p}else{s=Qb(n)|0;s=Si(s|0,C|0,-2,0)|0;c[R>>2]=s}p=r+(q*5640|0)+5592|0;A=r+(q*5640|0)+5596|0;do{if(!s)z=1;else{z=Qb(n)|0;y=C;if(0>(y|0)|0==(y|0)&s>>>0>z>>>0)Ub(o,2,8573,ga)|0;q=c[p>>2]|0;if(!q){z=Pc(c[R>>2]|0)|0;c[p>>2]=z;if(!z)break b;else{z=0;break}}q=Tc(q,(c[R>>2]|0)+(c[A>>2]|0)|0)|0;if(!q){xa=65;break b}c[p>>2]=q;z=0}}while(0);q=c[B>>2]|0;if(q){w=Pb(n)|0;s=C;y=Si(w|0,s|0,-2,-1)|0;r=c[O>>2]|0;q=q+40|0;u=c[q>>2]|0;v=c[u+(r*40|0)+12>>2]|0;t=c[u+(r*40|0)+16>>2]|0;x=t+(v*24|0)+8|0;c[x>>2]=y;c[x+4>>2]=C;x=c[R>>2]|0;s=Si(x|0,0,w|0,s|0)|0;v=t+(v*24|0)+16|0;c[v>>2]=s;c[v+4>>2]=C;x=x+2|0;v=c[u+(r*40|0)+20>>2]|0;s=u+(r*40|0)+28|0;t=c[s>>2]|0;if((v+1|0)>>>0>t>>>0){t=~~(+(t>>>0)+100.0)>>>0;c[s>>2]=t;s=Tc(c[u+(r*40|0)+24>>2]|0,t*24|0)|0;t=c[q>>2]|0;u=t+(r*40|0)+24|0;if(!s){p=u;xa=74;break}c[u>>2]=s;w=t;q=c[t+(r*40|0)+20>>2]|0}else{w=u;s=c[u+(r*40|0)+24>>2]|0;q=v}b[s+(q*24|0)>>1]=-109;v=Pi(0,y|0,32)|0;y=s+(q*24|0)+8|0;c[y>>2]=v;c[y+4>>2]=C;c[s+(q*24|0)+16>>2]=x;c[w+(r*40|0)+20>>2]=q+1}if(!z)p=Mb(n,(c[p>>2]|0)+(c[A>>2]|0)|0,c[R>>2]|0,o)|0;else p=0;c[Aa>>2]=(p|0)==(c[R>>2]|0)?8:64;c[A>>2]=(c[A>>2]|0)+p;p=a[ta>>0]|0;if((p&9)==1){a[ta>>0]=p|8;q=c[O>>2]|0;do{if((Tb(n)|0)!=0?(M=Pb(n)|0,N=C,!((M|0)==-1&(N|0)==-1)):0){while(1){if((Mb(n,V,2,o)|0)!=2){xa=81;break}qb(V,T,2);if((c[T>>2]|0)!=65424){xa=83;break}if((Mb(n,V,2,o)|0)!=2){xa=85;break}qb(V,X,2);if((c[X>>2]|0)!=10){xa=87;break}c[X>>2]=8;p=Mb(n,V,8,o)|0;if((p|0)!=(c[X>>2]|0)){xa=89;break}if((p|0)!=8){xa=91;break}qb(V,Z,2);qb(G,$,4);qb(H,U,1);qb(I,Y,1);if((c[Z>>2]|0)==(q|0)){xa=97;break}p=c[$>>2]|0;if(p>>>0<14){xa=94;break}xa=p+-12|0;c[$>>2]=xa;xa=Rb(n,xa,0,o)|0;if(!((C|0)==0?(xa|0)==(c[$>>2]|0):0)){xa=96;break}}if((xa|0)==81){xa=0;p=(Sb(n,M,N,o)|0)!=0&1;q=0;break}else if((xa|0)==83){xa=0;p=(Sb(n,M,N,o)|0)!=0&1;q=0;break}else if((xa|0)==85){xa=0;Ub(o,1,8295,ha)|0;p=0;q=0;break}else if((xa|0)==87){xa=0;Ub(o,1,8313,ia)|0;p=0;q=0;break}else if((xa|0)==89){xa=0;Ub(o,1,8295,ka)|0;p=0;q=0;break}else if((xa|0)==91){xa=0;Ub(o,1,8662,la)|0;p=0;q=0;break}else if((xa|0)==94){xa=0;p=(Sb(n,M,N,o)|0)!=0&1;q=0;break}else if((xa|0)==96){xa=0;p=(Sb(n,M,N,o)|0)!=0&1;q=0;break}else if((xa|0)==97){xa=0;q=(c[U>>2]|0)==(c[Y>>2]|0)&1;p=(Sb(n,M,N,o)|0)!=0&1;break}}else{p=1;q=0}}while(0);if(!p){xa=99;break}if(q){p=_(c[E>>2]|0,c[D>>2]|0)|0;a[ta>>0]=a[ta>>0]&-18|16;if(p){q=c[P>>2]|0;t=0;do{r=q+(t*5640|0)+5588|0;s=c[r>>2]|0;if(s)c[r>>2]=s+1;t=t+1|0}while((t|0)!=(p|0))}Ub(o,2,8734,na)|0}}if(!(a[ta>>0]&1)){if((Mb(n,c[J>>2]|0,2,o)|0)!=2){xa=109;break}qb(c[J>>2]|0,S,2)}}else{a[ta>>0]=p&-6;c[Aa>>2]=8;if((Mb(n,c[J>>2]|0,2,o)|0)!=2){xa=113;break}qb(c[J>>2]|0,S,2)}p=c[S>>2]|0;if(!((p|0)!=65497&(a[ta>>0]&1)==0)){xa=116;break}}switch(xa|0){case 9:{Ub(o,1,8295,aa)|0;o=0;i=Da;return o|0}case 11:{Ub(o,1,8313,ba)|0;o=0;i=Da;return o|0}case 20:{Ub(o,1,8339,ja)|0;o=0;i=Da;return o|0}case 24:{Ub(o,1,8382,qa)|0;o=0;i=Da;return o|0}case 26:{Uc(c[J>>2]|0);c[J>>2]=0;c[K>>2]=0;Ub(o,1,8427,ra)|0;o=0;i=Da;return o|0}case 29:{Ub(o,1,8295,sa)|0;o=0;i=Da;return o|0}case 31:{Ub(o,1,8461,ca)|0;o=0;i=Da;return o|0}case 33:{c[da>>2]=c[S>>2];Ub(o,1,8490,da)|0;o=0;i=Da;return o|0}case 41:{Uc(c[p>>2]|0);Ca=c[q>>2]|0;c[Ca+(r*40|0)+24>>2]=0;c[Ca+(r*40|0)+28>>2]=0;c[Ca+(r*40|0)+20>>2]=0;Ub(o,1,8537,va)|0;o=0;i=Da;return o|0}case 47:{Ub(o,1,8295,ea)|0;o=0;i=Da;return o|0}case 50:{Ub(o,1,8295,fa)|0;o=0;i=Da;return o|0}case 65:{Uc(c[p>>2]|0);c[p>>2]=0;break}case 74:{Uc(c[p>>2]|0);Ca=c[q>>2]|0;c[Ca+(r*40|0)+24>>2]=0;c[Ca+(r*40|0)+28>>2]=0;c[Ca+(r*40|0)+20>>2]=0;Ub(o,1,8537,wa)|0;o=0;i=Da;return o|0}case 99:{Ub(o,1,8688,ma)|0;o=0;i=Da;return o|0}case 109:{Ub(o,1,8295,oa)|0;o=0;i=Da;return o|0}case 113:{Ub(o,1,8295,pa)|0;o=0;i=Da;return o|0}case 115:{p=c[S>>2]|0;xa=116;break}}if((xa|0)==116)if((p|0)==65497){p=ta;xa=117;break a}else{p=ta;break a}Ub(o,1,8628,ua)|0;o=0;i=Da;return o|0}else p=ta;break}default:{o=0;i=Da;return o|0}}}while(0);if((xa|0)==117)if((c[Aa>>2]|0)!=256){c[d+200>>2]=0;c[Aa>>2]=256}if(!(a[p>>0]&1)){s=_(c[d+112>>2]|0,c[d+116>>2]|0)|0;t=d+200|0;q=c[t>>2]|0;d:do{if(q>>>0>>0){p=q;r=(c[d+164>>2]|0)+(q*5640|0)|0;while(1){if(c[r+5592>>2]|0){q=p;break d}q=p+1|0;c[t>>2]=q;if(q>>>0>>0){p=q;r=r+5640|0}else break}}}while(0);if((q|0)==(s|0)){c[m>>2]=0;o=1;i=Da;return o|0}}else{q=d+200|0;t=q;q=c[q>>2]|0}A=c[d+164>>2]|0;if(a[A+(q*5640|0)+5636>>0]&2){B=A+(q*5640|0)+5160|0;r=c[B>>2]|0;if(!r)p=0;else{s=c[A+(q*5640|0)+5164>>2]|0;u=0;p=0;do{p=(c[s+(u<<3)+4>>2]|0)+p|0;u=u+1|0}while((u|0)!=(r|0))}xa=Pc(p)|0;z=A+(q*5640|0)+5172|0;c[z>>2]=xa;if(!xa){Ub(o,1,8775,ya)|0;Ub(o,1,8813,za)|0;o=0;i=Da;return o|0}y=A+(q*5640|0)+5180|0;c[y>>2]=p;r=c[B>>2]|0;x=A+(q*5640|0)+5164|0;if(!r)p=c[x>>2]|0;else{p=c[x>>2]|0;v=p;w=0;u=0;while(1){s=c[v+(w<<3)>>2]|0;if(!s)s=v;else{Ui((c[z>>2]|0)+u|0,s|0,c[v+(w<<3)+4>>2]|0)|0;s=c[x>>2]|0;u=(c[s+(w<<3)+4>>2]|0)+u|0;Uc(c[s+(w<<3)>>2]|0);s=c[x>>2]|0;c[s+(w<<3)>>2]=0;c[s+(w<<3)+4>>2]=0;r=c[B>>2]|0;p=s}w=w+1|0;if(w>>>0>=r>>>0)break;else v=s}}c[B>>2]=0;Uc(p);c[x>>2]=0;c[A+(q*5640|0)+5168>>2]=c[z>>2];c[A+(q*5640|0)+5176>>2]=c[y>>2];q=c[t>>2]|0}p=d+204|0;if(!($f(c[p>>2]|0,q,o)|0)){Ub(o,1,8839,Ba)|0;o=0;i=Da;return o|0}else{Ba=_(c[d+112>>2]|0,c[d+116>>2]|0)|0;c[Ca>>2]=(c[t>>2]|0)+1;c[Ca+4>>2]=Ba;Ub(o,4,8873,Ca)|0;c[e>>2]=c[t>>2];c[m>>2]=1;c[f>>2]=ag(c[p>>2]|0)|0;o=c[c[(c[p>>2]|0)+20>>2]>>2]|0;c[g>>2]=c[o>>2];c[h>>2]=c[o+4>>2];c[j>>2]=c[o+8>>2];c[k>>2]=c[o+12>>2];c[l>>2]=c[o+16>>2];c[Aa>>2]=c[Aa>>2]|128;o=1;i=Da;return o|0}return 0}function dd(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+48|0;r=t+28|0;s=t+32|0;o=b+8|0;if(!(c[o>>2]&128)){g=0;i=t;return g|0}q=b+200|0;if((c[q>>2]|0)!=(d|0)){g=0;i=t;return g|0}j=c[b+164>>2]|0;n=j+(d*5640|0)|0;p=j+(d*5640|0)+5592|0;k=c[p>>2]|0;if(!k){sd(n);g=0;i=t;return g|0}l=b+204|0;m=j+(d*5640|0)+5596|0;if(!(cg(c[l>>2]|0,k,c[m>>2]|0,d,c[b+196>>2]|0,h)|0)){sd(n);c[o>>2]=c[o>>2]|32768;Ub(h,1,8912,t)|0;g=0;i=t;return g|0}if(!(dg(c[l>>2]|0,e,f)|0)){g=0;i=t;return g|0}j=c[p>>2]|0;if(j){Uc(j);c[p>>2]=0;c[m>>2]=0}p=b+76|0;a[p>>0]=a[p>>0]&-2;c[o>>2]=c[o>>2]&-129;p=Qb(g)|0;b=c[o>>2]|0;if((b|0)==256|(p|0)==0&(C|0)==0&(b|0)==64){g=1;i=t;return g|0}if((Mb(g,s,2,h)|0)!=2){Ub(h,2,8931,t+8|0)|0;g=1;i=t;return g|0}qb(s,r,2);switch(c[r>>2]|0){case 65497:{c[q>>2]=0;c[o>>2]=256;g=1;i=t;return g|0}case 65424:{g=1;i=t;return g|0}default:if((Qb(g)|0)==0&(C|0)==0){c[o>>2]=64;Ub(h,2,8975,t+16|0)|0;g=1;i=t;return g|0}else{Ub(h,1,9005,t+24|0)|0;g=0;i=t;return g|0}}return 0}function ed(b,d,e,f,g,h,j){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=i;i=i+112|0;y=z+96|0;x=z+88|0;w=z+80|0;v=z+72|0;u=z+64|0;s=z+56|0;r=z+48|0;o=z+40|0;n=z+32|0;m=z+24|0;l=z+16|0;p=c[b+80>>2]|0;if((c[b+8>>2]|0)!=8){Ub(j,1,9037,z)|0;j=0;i=z;return j|0}if(!(f|e|g|h)){Ub(j,4,9116,z+8|0)|0;c[b+28>>2]=0;c[b+32>>2]=0;c[b+36>>2]=c[b+112>>2];c[b+40>>2]=c[b+116>>2];j=1;i=z;return j|0}t=p+8|0;k=c[t>>2]|0;if(k>>>0>>0){c[l>>2]=e;c[l+4>>2]=k;Ub(j,1,9185,l)|0;j=0;i=z;return j|0}k=c[p>>2]|0;if(k>>>0>e>>>0){c[m>>2]=e;c[m+4>>2]=k;Ub(j,2,9272,m)|0;k=0;e=c[p>>2]|0}else k=((e-(c[b+92>>2]|0)|0)>>>0)/((c[b+100>>2]|0)>>>0)|0;c[b+28>>2]=k;c[d>>2]=e;q=p+12|0;e=c[q>>2]|0;if(e>>>0>>0){c[n>>2]=f;c[n+4>>2]=e;Ub(j,1,9360,n)|0;j=0;i=z;return j|0}l=p+4|0;e=c[l>>2]|0;if(e>>>0>f>>>0){c[o>>2]=f;c[o+4>>2]=e;Ub(j,2,9445,o)|0;e=0;f=c[l>>2]|0}else e=((f-(c[b+96>>2]|0)|0)>>>0)/((c[b+104>>2]|0)>>>0)|0;c[b+32>>2]=e;m=d+4|0;c[m>>2]=f;e=c[p>>2]|0;if(e>>>0>g>>>0){c[r>>2]=g;c[r+4>>2]=e;Ub(j,1,9531,r)|0;j=0;i=z;return j|0}e=c[t>>2]|0;if(e>>>0>>0){c[s>>2]=g;c[s+4>>2]=e;Ub(j,2,9620,s)|0;e=c[b+112>>2]|0;g=c[t>>2]|0}else{e=c[b+100>>2]|0;e=(g+-1-(c[b+92>>2]|0)+e|0)/(e|0)|0}c[b+36>>2]=e;k=d+8|0;c[k>>2]=g;g=c[l>>2]|0;if(g>>>0>h>>>0){c[u>>2]=h;c[u+4>>2]=g;Ub(j,1,9708,u)|0;j=0;i=z;return j|0}g=c[q>>2]|0;if(g>>>0>>0){c[v>>2]=h;c[v+4>>2]=g;Ub(j,2,9798,v)|0;e=c[q>>2]|0;g=c[b+116>>2]|0}else{g=c[b+104>>2]|0;e=h;g=(h+-1-(c[b+96>>2]|0)+g|0)/(g|0)|0}c[b+40>>2]=g;h=d+12|0;c[h>>2]=e;v=b+76|0;a[v>>0]=a[v>>0]|2;v=c[d+16>>2]|0;b=c[d>>2]|0;a:do{if(v){f=c[m>>2]|0;t=f+-1|0;u=c[k>>2]|0;q=u+-1|0;r=b+-1|0;g=0;p=c[d+24>>2]|0;while(1){d=c[p>>2]|0;e=(r+d|0)/(d|0)|0;c[p+16>>2]=e;o=c[p+4>>2]|0;k=(t+o|0)/(o|0)|0;c[p+20>>2]=k;d=(q+d|0)/(d|0)|0;l=c[p+40>>2]|0;m=Ri(1,0,l|0)|0;n=C;d=Si(d|0,((d|0)<0)<<31>>31|0,-1,-1)|0;d=Si(d|0,C|0,m|0,n|0)|0;d=Pi(d|0,C|0,l|0)|0;e=Si(e|0,((e|0)<0)<<31>>31|0,-1,-1)|0;e=Si(e|0,C|0,m|0,n|0)|0;e=Pi(e|0,C|0,l|0)|0;e=d-e|0;if((e|0)<0){k=29;break}s=c[h>>2]|0;d=(o+-1+s|0)/(o|0)|0;c[p+8>>2]=e;d=Si(d|0,((d|0)<0)<<31>>31|0,-1,-1)|0;d=Si(d|0,C|0,m|0,n|0)|0;d=Pi(d|0,C|0,l|0)|0;e=Si(k|0,((k|0)<0)<<31>>31|0,-1,-1)|0;e=Si(e|0,C|0,m|0,n|0)|0;e=Pi(e|0,C|0,l|0)|0;e=d-e|0;if((e|0)<0){k=31;break}c[p+12>>2]=e;g=g+1|0;if(g>>>0>=v>>>0){e=u;g=s;break a}else p=p+52|0}if((k|0)==29){c[w>>2]=g;c[w+4>>2]=e;Ub(j,1,9887,w)|0;j=0;i=z;return j|0}else if((k|0)==31){c[x>>2]=g;c[x+4>>2]=e;Ub(j,1,9956,x)|0;j=0;i=z;return j|0}}else{f=c[m>>2]|0;e=c[k>>2]|0;g=c[h>>2]|0}}while(0);c[y>>2]=b;c[y+4>>2]=f;c[y+8>>2]=e;c[y+12>>2]=g;Ub(j,4,10025,y)|0;j=1;i=z;return j|0}function fd(){var b=0,d=0,e=0;b=Qc(1,208)|0;if(!b){d=0;return d|0}c[b>>2]=1;d=b+184|0;a[d>>0]=a[d>>0]|2;d=Qc(1,5640)|0;c[b+12>>2]=d;if(!d){Yc(b);d=0;return d|0}d=Qc(1,1e3)|0;c[b+16>>2]=d;if(!d){Yc(b);d=0;return d|0}c[b+20>>2]=1e3;c[b+60>>2]=-1;d=b+64|0;c[d>>2]=0;c[d+4>>2]=0;d=Qc(1,48)|0;do{if(d){c[d+32>>2]=100;c[d+24>>2]=0;e=Qc(100,24)|0;c[d+28>>2]=e;if(!e){Uc(d);break}c[d+40>>2]=0;c[b+196>>2]=d;e=qg()|0;c[b+192>>2]=e;if(!e){Yc(b);e=0;return e|0}e=qg()|0;c[b+188>>2]=e;if(e){e=b;return e|0}Yc(b);e=0;return e|0}}while(0);c[b+196>>2]=0;Yc(b);e=0;return e|0}function gd(a,b,d){a=a|0;b=b|0;d=d|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;t=i;i=i+128|0;s=t+104|0;r=t+72|0;q=t+64|0;n=t+40|0;l=t+24|0;j=t+16|0;h=t+8|0;g=t;if(b&384){ki(10063,11,1,d)|0;i=t;return}if((b&1|0)!=0?(f=c[a+80>>2]|0,(f|0)!=0):0)hd(f,0,d);if(b&2){ki(10075,36,1,d)|0;f=c[a+96>>2]|0;c[g>>2]=c[a+92>>2];c[g+4>>2]=f;$h(d,10112,g)|0;g=c[a+104>>2]|0;c[h>>2]=c[a+100>>2];c[h+4>>2]=g;$h(d,10130,h)|0;h=c[a+116>>2]|0;c[j>>2]=c[a+112>>2];c[j+4>>2]=h;$h(d,10148,j)|0;xd(c[a+12>>2]|0,c[(c[a+80>>2]|0)+16>>2]|0,d);ki(10164,2,1,d)|0}if((b&8|0)!=0?(k=_(c[a+112>>2]|0,c[a+116>>2]|0)|0,(k|0)!=0):0){f=a+80|0;g=0;h=c[a+164>>2]|0;while(1){xd(h,c[(c[f>>2]|0)+16>>2]|0,d);g=g+1|0;if((g|0)==(k|0))break;else h=h+5640|0}}if(!(b&16)){i=t;return}j=c[a+196>>2]|0;ki(10167,37,1,d)|0;k=j;b=c[k+4>>2]|0;f=j+8|0;a=c[f>>2]|0;f=c[f+4>>2]|0;h=l;c[h>>2]=c[k>>2];c[h+4>>2]=b;h=l+8|0;c[h>>2]=a;c[h+4>>2]=f;$h(d,10205,l)|0;ki(10272,17,1,d)|0;h=j+28|0;f=c[h>>2]|0;a:do{if((f|0)!=0?(m=j+24|0,(c[m>>2]|0)!=0):0){g=0;while(1){b=f+(g*24|0)+8|0;k=c[b>>2]|0;b=c[b+4>>2]|0;l=c[f+(g*24|0)+16>>2]|0;c[n>>2]=e[f+(g*24|0)>>1];a=n+8|0;c[a>>2]=k;c[a+4>>2]=b;c[n+16>>2]=l;$h(d,10290,n)|0;g=g+1|0;if(g>>>0>=(c[m>>2]|0)>>>0)break a;f=c[h>>2]|0}}}while(0);ki(10321,4,1,d)|0;b=j+40|0;h=c[b>>2]|0;if((h|0)!=0?(p=j+36|0,o=c[p>>2]|0,(o|0)!=0):0){g=0;f=0;do{f=(c[h+(g*40|0)+4>>2]|0)+f|0;g=g+1|0}while((g|0)!=(o|0));if(f){ki(10326,16,1,d)|0;if(c[p>>2]|0){f=c[b>>2]|0;k=0;do{j=c[f+(k*40|0)+4>>2]|0;c[q>>2]=k;c[q+4>>2]=j;$h(d,10343,q)|0;f=c[b>>2]|0;g=c[f+(k*40|0)+16>>2]|0;b:do{if(!((j|0)==0|(g|0)==0)){f=0;while(1){a=g+(f*24|0)|0;u=c[a>>2]|0;a=c[a+4>>2]|0;m=g+(f*24|0)+8|0;l=c[m>>2]|0;m=c[m+4>>2]|0;o=g+(f*24|0)+16|0;n=c[o>>2]|0;o=c[o+4>>2]|0;c[r>>2]=f;h=r+8|0;c[h>>2]=u;c[h+4>>2]=a;h=r+16|0;c[h>>2]=l;c[h+4>>2]=m;h=r+24|0;c[h>>2]=n;c[h+4>>2]=o;$h(d,10379,r)|0;h=f+1|0;f=c[b>>2]|0;if((h|0)==(j|0))break b;g=c[f+(k*40|0)+16>>2]|0;f=h}}}while(0);g=c[f+(k*40|0)+24>>2]|0;c:do{if((g|0)!=0?(c[f+(k*40|0)+20>>2]|0)!=0:0){f=0;while(1){o=g+(f*24|0)+8|0;n=c[o>>2]|0;o=c[o+4>>2]|0;h=c[g+(f*24|0)+16>>2]|0;c[s>>2]=e[g+(f*24|0)>>1];u=s+8|0;c[u>>2]=n;c[u+4>>2]=o;c[s+16>>2]=h;$h(d,10290,s)|0;h=f+1|0;f=c[b>>2]|0;if(h>>>0>=(c[f+(k*40|0)+20>>2]|0)>>>0)break c;g=c[f+(k*40|0)+24>>2]|0;f=h}}}while(0);k=k+1|0}while(k>>>0<(c[p>>2]|0)>>>0)}ki(10321,4,1,d)|0}}ki(10164,2,1,d)|0;i=t;return}function hd(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;n=i;i=i+64|0;m=n+48|0;l=n+40|0;j=n+32|0;h=n+16|0;g=n;k=n+52|0;if(!d){ki(10482,13,1,e)|0;a[k+1>>0]=0;f=9}else{ki(10445,36,1,c[676]|0)|0;f=0}a[k>>0]=f;o=c[b>>2]|0;f=c[b+4>>2]|0;c[g>>2]=k;c[g+4>>2]=o;c[g+8>>2]=f;$h(e,10496,g)|0;g=c[b+8>>2]|0;f=c[b+12>>2]|0;c[h>>2]=k;c[h+4>>2]=g;c[h+8>>2]=f;$h(e,10513,h)|0;h=b+16|0;f=c[h>>2]|0;c[j>>2]=k;c[j+4>>2]=f;$h(e,10530,j)|0;f=b+24|0;if(!(c[f>>2]|0)){ki(10164,2,1,e)|0;i=n;return}if(!(c[h>>2]|0)){ki(10164,2,1,e)|0;i=n;return}else g=0;do{c[l>>2]=k;c[l+4>>2]=g;$h(e,10546,l)|0;id((c[f>>2]|0)+(g*52|0)|0,d,e);c[m>>2]=k;$h(e,10566,m)|0;g=g+1|0}while(g>>>0<(c[h>>2]|0)>>>0);ki(10164,2,1,e)|0;i=n;return}function id(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;l=i;i=i+48|0;k=l+24|0;j=l+16|0;h=l;g=l+32|0;f=(d|0)!=0;if(f){ki(10571,41,1,c[676]|0)|0;d=0}else{a[g+1>>0]=9;a[g+2>>0]=0;d=9}a[g>>0]=d;m=c[b>>2]|0;d=c[b+4>>2]|0;c[h>>2]=g;c[h+4>>2]=m;c[h+8>>2]=d;$h(e,10613,h)|0;h=c[b+24>>2]|0;c[j>>2]=g;c[j+4>>2]=h;$h(e,10630,j)|0;j=c[b+32>>2]|0;c[k>>2]=g;c[k+4>>2]=j;$h(e,10642,k)|0;if(!f){i=l;return}ki(10164,2,1,e)|0;i=l;return}function jd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;e=m;b=a+80|0;k=c[(c[b>>2]|0)+16>>2]|0;d=Qc(1,56)|0;c[e>>2]=d;if(!d){l=0;i=m;return l|0}c[d+24>>2]=c[(c[b>>2]|0)+16>>2];c[d>>2]=c[a+92>>2];c[d+4>>2]=c[a+96>>2];c[d+8>>2]=c[a+100>>2];c[d+12>>2]=c[a+104>>2];c[d+16>>2]=c[a+112>>2];c[d+20>>2]=c[a+116>>2];c[d+52>>2]=0;d=c[a+12>>2]|0;b=c[e>>2]|0;c[b+32>>2]=c[d>>2];c[b+36>>2]=c[d+4>>2];c[b+40>>2]=c[d+8>>2];c[b+44>>2]=c[d+16>>2];c[b+48>>2]=Qc(c[b+24>>2]|0,1080)|0;b=c[e>>2]|0;j=b+48|0;a=c[j>>2]|0;if(!a){Cc(e);l=0;i=m;return l|0}if(!k){l=b;i=m;return l|0}h=d+5584|0;d=0;while(1){g=c[h>>2]|0;c[a+(d*1080|0)+4>>2]=c[g+(d*1080|0)>>2];e=g+(d*1080|0)+4|0;f=c[e>>2]|0;c[a+(d*1080|0)+8>>2]=f;c[a+(d*1080|0)+12>>2]=c[g+(d*1080|0)+8>>2];c[a+(d*1080|0)+16>>2]=c[g+(d*1080|0)+12>>2];c[a+(d*1080|0)+20>>2]=c[g+(d*1080|0)+16>>2];c[a+(d*1080|0)+24>>2]=c[g+(d*1080|0)+20>>2];if(f>>>0<33){Ui(a+(d*1080|0)+948|0,g+(d*1080|0)+944|0,f|0)|0;Ui(a+(d*1080|0)+816|0,g+(d*1080|0)+812|0,c[e>>2]|0)|0}f=c[g+(d*1080|0)+24>>2]|0;c[a+(d*1080|0)+28>>2]=f;c[a+(d*1080|0)+808>>2]=c[g+(d*1080|0)+804>>2];if((f|0)!=1){f=(c[e>>2]|0)*3|0;e=f+-2|0;if((e|0)<97&(f|0)>2)l=10}else{e=1;l=10}if((l|0)==10){l=0;f=0;do{c[a+(d*1080|0)+32+(f<<2)>>2]=c[g+(d*1080|0)+28+(f<<3)+4>>2];c[a+(d*1080|0)+420+(f<<2)>>2]=c[g+(d*1080|0)+28+(f<<3)>>2];f=f+1|0}while((f|0)!=(e|0))}c[a+(d*1080|0)+812>>2]=c[g+(d*1080|0)+808>>2];d=d+1|0;if((d|0)==(k|0))break;a=c[j>>2]|0}i=m;return b|0}function kd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;b=Qc(1,48)|0;if(!b){k=0;return k|0}h=a+196|0;d=c[h>>2]|0;i=d;k=c[i+4>>2]|0;a=b;c[a>>2]=c[i>>2];c[a+4>>2]=k;a=d+8|0;k=c[a+4>>2]|0;i=b+8|0;c[i>>2]=c[a>>2];c[i+4>>2]=k;i=d+16|0;k=c[i+4>>2]|0;a=b+16|0;c[a>>2]=c[i>>2];c[a+4>>2]=k;d=c[d+24>>2]|0;a=b+24|0;c[a>>2]=d;d=Pc(d*24|0)|0;k=b+28|0;c[k>>2]=d;if(!d){Uc(b);k=0;return k|0}e=c[(c[h>>2]|0)+28>>2]|0;if(!e){Uc(d);c[k>>2]=0}else Ui(d|0,e|0,(c[a>>2]|0)*24|0)|0;a=c[(c[h>>2]|0)+36>>2]|0;g=b+36|0;c[g>>2]=a;a=Qc(a,40)|0;i=b+40|0;c[i>>2]=a;if(!a){Uc(c[k>>2]|0);Uc(b);k=0;return k|0}d=c[(c[h>>2]|0)+40>>2]|0;if(!d){Uc(a);c[i>>2]=0;k=b;return k|0}if(!(c[g>>2]|0)){k=b;return k|0}d=c[d+20>>2]|0;c[a+20>>2]=d;d=Pc(d*24|0)|0;a=c[i>>2]|0;c[a+24>>2]=d;a:do{if(!d)d=0;else{f=d;d=0;while(1){e=c[(c[(c[h>>2]|0)+40>>2]|0)+(d*40|0)+24>>2]|0;if(!e){Uc(f);a=c[i>>2]|0;c[a+(d*40|0)+24>>2]=0}else{Ui(f|0,e|0,(c[a+(d*40|0)+20>>2]|0)*24|0)|0;a=c[i>>2]|0}e=c[(c[(c[h>>2]|0)+40>>2]|0)+(d*40|0)+4>>2]|0;c[a+(d*40|0)+4>>2]=e;e=Pc(e*24|0)|0;a=c[i>>2]|0;c[a+(d*40|0)+16>>2]=e;if(!e)break;f=c[(c[(c[h>>2]|0)+40>>2]|0)+(d*40|0)+16>>2]|0;if(!f){Uc(e);a=c[i>>2]|0;c[a+(d*40|0)+16>>2]=0}else{Ui(e|0,f|0,(c[a+(d*40|0)+4>>2]|0)*24|0)|0;a=c[i>>2]|0}c[a+(d*40|0)+32>>2]=0;c[a+(d*40|0)+36>>2]=0;d=d+1|0;if(d>>>0>=(c[g>>2]|0)>>>0){j=32;break}f=c[(c[(c[h>>2]|0)+40>>2]|0)+(d*40|0)+20>>2]|0;c[a+(d*40|0)+20>>2]=f;f=Pc(f*24|0)|0;a=c[i>>2]|0;c[a+(d*40|0)+24>>2]=f;if(!f)break a}if((j|0)==32)return b|0;if(d){Uc(c[a+24>>2]|0);Uc(c[(c[i>>2]|0)+16>>2]|0);if((d|0)!=1){a=1;do{Uc(c[(c[i>>2]|0)+(a*40|0)+24>>2]|0);Uc(c[(c[i>>2]|0)+(a*40|0)+16>>2]|0);a=a+1|0}while((a|0)!=(d|0))}a=c[i>>2]|0}Uc(a);Uc(c[k>>2]|0);Uc(b);k=0;return k|0}}while(0);if(d){Uc(c[a+24>>2]|0);if((d|0)!=1){a=1;do{Uc(c[(c[i>>2]|0)+(a*40|0)+24>>2]|0);a=a+1|0}while((a|0)!=(d|0))}a=c[i>>2]|0}Uc(a);Uc(c[k>>2]|0);Uc(b);k=0;return k|0}function ld(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;if(!d){d=0;return d|0}f=Xb()|0;k=a+84|0;c[k>>2]=f;if(!f){d=0;return d|0}$b(d,f);h=a+188|0;sg(c[h>>2]|0,27,e)|0;h=c[h>>2]|0;i=tg(h)|0;f=ug(h)|0;if(i){j=0;g=1;while(1){if(!g)g=0;else g=(Ra[c[f>>2]&63](a,b,e)|0)!=0;j=j+1|0;if((j|0)==(i|0))break;else{f=f+4|0;g=g&1}}vg(h);if(!g){d=a+80|0;Zb(c[d>>2]|0);c[d>>2]=0;d=0;return d|0}}else vg(h);i=c[d+16>>2]|0;if(!i){d=1;return d|0}h=c[(c[k>>2]|0)+24>>2]|0;f=c[d+24>>2]|0;g=0;do{c[f+(g*52|0)+36>>2]=c[h+(g*52|0)+36>>2];d=h+(g*52|0)+44|0;c[f+(g*52|0)+44>>2]=c[d>>2];c[d>>2]=0;g=g+1|0}while(g>>>0>>0);f=1;return f|0}function md(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;t=i;i=i+16|0;j=t+8|0;if(!d){Ub(e,1,10654,t)|0;s=0;i=t;return s|0}g=c[a+112>>2]|0;h=_(c[a+116>>2]|0,g)|0;if(h>>>0<=f>>>0){c[j>>2]=f;c[j+4>>2]=h+-1;Ub(e,1,10692,j)|0;s=0;i=t;return s|0}s=(f>>>0)%(g>>>0)|0;r=(f>>>0)/(g>>>0)|0;j=c[a+100>>2]|0;h=_(j,s)|0;k=c[a+92>>2]|0;h=h+k|0;c[d>>2]=h;q=a+80|0;g=c[q>>2]|0;l=c[g>>2]|0;h=h>>>0>>0?l:h;c[d>>2]=h;k=(_(j,s+1|0)|0)+k|0;s=d+8|0;c[s>>2]=k;j=c[g+8>>2]|0;k=k>>>0>j>>>0?j:k;c[s>>2]=k;s=c[a+104>>2]|0;j=_(s,r)|0;l=c[a+96>>2]|0;j=j+l|0;p=d+4|0;c[p>>2]=j;o=c[g+4>>2]|0;j=j>>>0>>0?o:j;c[p>>2]=j;l=(_(s,r+1|0)|0)+l|0;r=d+12|0;c[r>>2]=l;s=c[g+12>>2]|0;l=l>>>0>s>>>0?s:l;c[r>>2]=l;r=d+24|0;s=d+16|0;p=c[s>>2]|0;if(p){o=c[g+24>>2]|0;n=h+-1|0;m=j+-1|0;k=k+-1|0;g=l+-1|0;h=0;j=c[r>>2]|0;while(1){l=c[o+(h*52|0)+40>>2]|0;c[j+40>>2]=l;z=c[j>>2]|0;y=(n+z|0)/(z|0)|0;c[j+16>>2]=y;u=c[j+4>>2]|0;x=(m+u|0)/(u|0)|0;c[j+20>>2]=x;z=(k+z|0)/(z|0)|0;u=(g+u|0)/(u|0)|0;w=Ri(1,0,l|0)|0;v=C;z=Si(z|0,((z|0)<0)<<31>>31|0,-1,-1)|0;z=Si(z|0,C|0,w|0,v|0)|0;z=Pi(z|0,C|0,l|0)|0;y=Si(y|0,((y|0)<0)<<31>>31|0,-1,-1)|0;y=Si(y|0,C|0,w|0,v|0)|0;y=Pi(y|0,C|0,l|0)|0;c[j+8>>2]=z-y;u=Si(u|0,((u|0)<0)<<31>>31|0,-1,-1)|0;u=Si(u|0,C|0,w|0,v|0)|0;u=Pi(u|0,C|0,l|0)|0;x=Si(x|0,((x|0)<0)<<31>>31|0,-1,-1)|0;v=Si(x|0,C|0,w|0,v|0)|0;l=Pi(v|0,C|0,l|0)|0;c[j+12>>2]=u-l;h=h+1|0;if(h>>>0>=p>>>0)break;else j=j+52|0}}m=a+84|0;g=c[m>>2]|0;if(g)Zb(g);g=Xb()|0;c[m>>2]=g;if(!g){z=0;i=t;return z|0}$b(d,g);c[a+60>>2]=f;j=a+188|0;sg(c[j>>2]|0,28,e)|0;j=c[j>>2]|0;k=tg(j)|0;g=ug(j)|0;if(k){l=0;h=1;while(1){if(!h)h=0;else h=(Ra[c[g>>2]&63](a,b,e)|0)!=0;l=l+1|0;if((l|0)==(k|0))break;else{g=g+4|0;h=h&1}}vg(j);if(!h){Zb(c[q>>2]|0);c[q>>2]=0;z=0;i=t;return z|0}}else vg(j);g=c[s>>2]|0;if(!g){z=1;i=t;return z|0}k=c[(c[m>>2]|0)+24>>2]|0;j=c[r>>2]|0;l=0;while(1){c[j+(l*52|0)+36>>2]=c[k+(l*52|0)+36>>2];h=c[j+(l*52|0)+44>>2]|0;if(!h)h=k;else{Uc(h);h=c[(c[m>>2]|0)+24>>2]|0;j=c[r>>2]|0;g=c[s>>2]|0}z=h+(l*52|0)+44|0;c[j+(l*52|0)+44>>2]=c[z>>2];c[z>>2]=0;l=l+1|0;if(l>>>0>=g>>>0){g=1;break}else k=h}i=t;return g|0}function nd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+16|0;j=k;c[a+168>>2]=b;e=c[a+80>>2]|0;a:do{if((((e|0)!=0?(h=c[e+24>>2]|0,(h|0)!=0):0)?(f=c[a+12>>2]|0,(f|0)!=0):0)?(g=c[f+5584>>2]|0,(g|0)!=0):0){e=c[e+16>>2]|0;if(!e)e=1;else{f=0;while(1){if((c[g+(f*1080|0)+4>>2]|0)>>>0<=b>>>0)break;c[h+(f*52|0)+40>>2]=b;f=f+1|0;if(f>>>0>=e>>>0){e=1;break a}}Ub(d,1,10753,j)|0;e=0}}else e=0}while(0);i=k;return e|0}function od(d,e,f){d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;Q=i;i=i+48|0;O=Q+32|0;N=Q+24|0;M=Q+16|0;K=Q+8|0;L=Q;A=d+204|0;g=c[A>>2]|0;F=d+116|0;G=d+112|0;H=_(c[G>>2]|0,c[F>>2]|0)|0;I=(H|0)==1;if(!H){P=1;i=Q;return P|0}J=d+200|0;B=d+12|0;C=d+164|0;D=d+8|0;E=g+20|0;y=g+24|0;z=0;g=0;l=0;a:while(1){if((c[J>>2]|0)!=(z|0)){P=5;break}w=z;z=z+1|0;x=_(c[F>>2]|0,c[G>>2]|0)|0;c[K>>2]=z;c[K+4>>2]=x;Ub(f,4,10866,K)|0;c[B>>2]=0;x=c[A>>2]|0;c[x+12>>2]=c[(c[C>>2]|0)+(w*5640|0)+5588>>2];c[D>>2]=0;if(!(_f(x,c[J>>2]|0,f)|0))break;h=c[A>>2]|0;if(c[(c[h+24>>2]|0)+16>>2]|0){k=0;do{j=c[(c[c[E>>2]>>2]|0)+20>>2]|0;if(I){c[j+(k*52|0)+32>>2]=c[(c[(c[y>>2]|0)+24>>2]|0)+(k*52|0)+44>>2];c[j+(k*52|0)+36>>2]=0}else{if(!(Zf(j+(k*52|0)|0)|0)){P=14;break a}h=c[A>>2]|0}k=k+1|0}while(k>>>0<(c[(c[h+24>>2]|0)+16>>2]|0)>>>0)}x=eg(h)|0;if(!I){if(x>>>0>l>>>0){h=Tc(g,x)|0;if(!h){P=20;break}else{g=h;h=x}}else h=l;j=c[A>>2]|0;w=j+24|0;k=c[w>>2]|0;if(c[k+16>>2]|0){v=j+20|0;j=g;u=0;do{r=c[(c[c[v>>2]>>2]|0)+20>>2]|0;m=c[k+24>>2]|0;q=c[m+(u*52|0)+24>>2]|0;q=((q&7|0)!=0&1)+(q>>>3)|0;n=c[r+(u*52|0)+8>>2]|0;o=c[r+(u*52|0)>>2]|0;t=n-o|0;p=c[r+(u*52|0)+12>>2]|0;r=c[r+(u*52|0)+4>>2]|0;T=c[k>>2]|0;S=c[m+(u*52|0)>>2]|0;l=c[m+(u*52|0)+4>>2]|0;R=(S+~T+(c[k+8>>2]|0)|0)/(S|0)|0;s=R-t|0;k=o-((T+-1+S|0)/(S|0)|0)+(_(R,r-(((c[k+4>>2]|0)+-1+l|0)/(l|0)|0)|0)|0)|0;k=(c[m+(u*52|0)+44>>2]|0)+(k<<2)|0;b:do{switch(((q|0)==3?4:q)|0){case 1:{l=(p|0)==(r|0);if(!(c[m+(u*52|0)+32>>2]|0)){if(l)break b;q=(n|0)==(o|0);o=p-r|0;p=0;while(1){if(!q){l=0;m=j;n=k;while(1){a[m>>0]=c[n>>2];l=l+1|0;if((l|0)==(t|0))break;else{m=m+1|0;n=n+4|0}}j=j+t|0;k=k+(t<<2)|0}p=p+1|0;if((p|0)==(o|0))break;else k=k+(s<<2)|0}}else{if(l)break b;q=(n|0)==(o|0);o=p-r|0;p=0;while(1){if(!q){l=0;m=j;n=k;while(1){a[m>>0]=c[n>>2];l=l+1|0;if((l|0)==(t|0))break;else{m=m+1|0;n=n+4|0}}j=j+t|0;k=k+(t<<2)|0}p=p+1|0;if((p|0)==(o|0))break;else k=k+(s<<2)|0}}break}case 2:{l=(p|0)==(r|0);if(!(c[m+(u*52|0)+32>>2]|0)){if(!l){q=(n|0)==(o|0);o=p-r|0;p=0;while(1){if(!q){l=0;m=j;n=k;while(1){b[m>>1]=c[n>>2];l=l+1|0;if((l|0)==(t|0))break;else{m=m+2|0;n=n+4|0}}j=j+(t<<1)|0;k=k+(t<<2)|0}p=p+1|0;if((p|0)==(o|0))break;else k=k+(s<<2)|0}}}else if(!l){q=(n|0)==(o|0);o=p-r|0;p=0;while(1){if(!q){l=0;m=j;n=k;while(1){b[m>>1]=c[n>>2];l=l+1|0;if((l|0)==(t|0))break;else{m=m+2|0;n=n+4|0}}j=j+(t<<1)|0;k=k+(t<<2)|0}p=p+1|0;if((p|0)==(o|0))break;else k=k+(s<<2)|0}}break}case 4:{if((p|0)!=(r|0)){q=(n|0)==(o|0);o=p-r|0;p=0;while(1){if(!q){l=0;m=j;n=k;while(1){c[m>>2]=c[n>>2];l=l+1|0;if((l|0)==(t|0))break;else{m=m+4|0;n=n+4|0}}j=j+(t<<2)|0;k=k+(t<<2)|0}p=p+1|0;if((p|0)==(o|0))break;else k=k+(s<<2)|0}}break}default:{}}}while(0);u=u+1|0;k=c[w>>2]|0}while(u>>>0<(c[k+16>>2]|0)>>>0);j=c[A>>2]|0}if(!(fg(j,g,x)|0)){P=63;break}}else h=l;if(!(Ad(d,e,f)|0)){P=65;break}if(z>>>0>=H>>>0){P=67;break}else l=h}if((P|0)==5)Ub(f,1,10829,L)|0;else if((P|0)==14){Ub(f,1,10887,M)|0;if(!g){T=0;i=Q;return T|0}Uc(g);T=0;i=Q;return T|0}else if((P|0)==20){if(g)Uc(g);Ub(f,1,10925,N)|0;T=0;i=Q;return T|0}else if((P|0)==63){Ub(f,1,10964,O)|0;Uc(g);T=0;i=Q;return T|0}else if((P|0)==65){if(!g){T=0;i=Q;return T|0}Uc(g);T=0;i=Q;return T|0}else if((P|0)==67){if(!g){T=1;i=Q;return T|0}Uc(g);T=1;i=Q;return T|0}if(!g){T=0;i=Q;return T|0}Uc(g);T=0;i=Q;return T|0}function pd(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;f=a+188|0;if(!(sg(c[f>>2]|0,29,e)|0)){d=0;return d|0}if(((b[a+88>>1]|0)+-3&65535)<4?(sg(c[f>>2]|0,30,e)|0)==0:0){d=0;return d|0}if(!(sg(c[f>>2]|0,31,e)|0)){d=0;return d|0}if(!(sg(c[f>>2]|0,32,e)|0)){d=0;return d|0}if(!(sg(c[f>>2]|0,33,e)|0)){d=0;return d|0}j=c[f>>2]|0;h=tg(j)|0;f=ug(j)|0;if(!h)f=1;else{i=0;g=f;f=1;while(1){if(!f)f=0;else f=(Ra[c[g>>2]&63](a,d,e)|0)!=0;f=f&1;i=i+1|0;if((i|0)==(h|0))break;else g=g+4|0}}vg(j);d=f;return d|0}function qd(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;g=Xb()|0;k=a+80|0;c[k>>2]=g;if(!g){Ub(f,1,11011,m)|0;d=0;i=m;return d|0}$b(e,g);j=c[e+24>>2]|0;if((j|0)!=0?(l=c[e+16>>2]|0,(l|0)!=0):0){h=0;do{e=j+(h*52|0)+44|0;g=c[e>>2]|0;if(g){c[(c[(c[k>>2]|0)+24>>2]|0)+(h*52|0)+44>>2]=g;c[e>>2]=0}h=h+1|0}while(h>>>0>>0)}g=a+192|0;if(!(sg(c[g>>2]|0,34,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,35,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,36,f)|0)){d=0;i=m;return d|0}h=c[g>>2]|0;j=tg(h)|0;g=ug(h)|0;if(j){k=0;e=1;while(1){if(!e)e=0;else e=(Ra[c[g>>2]&63](a,d,f)|0)!=0;k=k+1|0;if((k|0)==(j|0))break;else{g=g+4|0;e=e&1}}vg(h);if(!e){d=0;i=m;return d|0}}else vg(h);g=a+188|0;if(!(sg(c[g>>2]|0,37,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,38,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,39,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,40,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,41,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,42,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,43,f)|0)){d=0;i=m;return d|0}e=a+88|0;if(((b[e>>1]|0)+-3&65535)<4){if(!(sg(c[g>>2]|0,44,f)|0)){d=0;i=m;return d|0}if((b[e>>1]|0)==4?(sg(c[g>>2]|0,45,f)|0)==0:0){d=0;i=m;return d|0}}if(!(sg(c[g>>2]|0,46,f)|0)){d=0;i=m;return d|0}if((c[a+108>>2]|0)!=0?(sg(c[g>>2]|0,47,f)|0)==0:0){d=0;i=m;return d|0}if((b[e>>1]&256)!=0?(sg(c[g>>2]|0,48,f)|0)==0:0){d=0;i=m;return d|0}if((c[a+196>>2]|0)!=0?(sg(c[g>>2]|0,49,f)|0)==0:0){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,50,f)|0)){d=0;i=m;return d|0}if(!(sg(c[g>>2]|0,51,f)|0)){d=0;i=m;return d|0}k=c[g>>2]|0;h=tg(k)|0;g=ug(k)|0;if(!h)g=1;else{j=0;e=g;g=1;while(1){if(!g)g=0;else g=(Ra[c[e>>2]&63](a,d,f)|0)!=0;g=g&1;j=j+1|0;if((j|0)==(h|0))break;else e=e+4|0}}vg(k);d=g;i=m;return d|0}function rd(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+48|0;o=q+40|0;p=q+32|0;n=q+24|0;l=q+16|0;j=q+8|0;h=q;k=a+200|0;if((c[k>>2]|0)==(b|0)){m=_(c[a+116>>2]|0,c[a+112>>2]|0)|0;c[j>>2]=b+1;c[j+4>>2]=m;Ub(g,4,10866,j)|0;c[a+12>>2]=0;m=a+204|0;j=c[m>>2]|0;c[j+12>>2]=c[(c[a+164>>2]|0)+(b*5640|0)+5588>>2];c[a+8>>2]=0;if(_f(j,c[k>>2]|0,g)|0){h=c[m>>2]|0;a:do{if(c[(c[h+24>>2]|0)+16>>2]|0){j=0;while(1){if(!(Zf((c[(c[c[h+20>>2]>>2]|0)+20>>2]|0)+(j*52|0)|0)|0))break;j=j+1|0;h=c[m>>2]|0;if(j>>>0>=(c[(c[h+24>>2]|0)+16>>2]|0)>>>0)break a}Ub(g,1,10887,n)|0;p=0;i=q;return p|0}}while(0);if(!(fg(h,d,e)|0)){Ub(g,1,10964,p)|0;p=0;i=q;return p|0}if(Ad(a,f,g)|0){p=1;i=q;return p|0}c[o>>2]=b;Ub(g,1,11101,o)|0;p=0;i=q;return p|0}}else Ub(g,1,10829,h)|0;c[l>>2]=b;Ub(g,1,11044,l)|0;p=0;i=q;return p|0}function sd(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0;if(!a)return;f=a+5164|0;b=c[f>>2]|0;if(b){g=a+5160|0;d=c[g>>2]|0;if(d){e=0;while(1){b=c[b+(e<<3)>>2]|0;if(b){Uc(b);d=c[g>>2]|0}e=e+1|0;if(e>>>0>=d>>>0)break;b=c[f>>2]|0}b=c[f>>2]|0}c[g>>2]=0;Uc(b);c[f>>2]=0}b=a+5172|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}b=a+5584|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}b=a+5608|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}b=a+5604|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}b=a+5624|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0;c[a+5632>>2]=0;c[a+5628>>2]=0}i=a+5612|0;b=c[i>>2]|0;if(b){h=a+5616|0;d=c[h>>2]|0;if(d){g=0;while(1){e=b+12|0;f=c[e>>2]|0;if(f){Uc(f);c[e>>2]=0;d=c[h>>2]|0}g=g+1|0;if(g>>>0>=d>>>0)break;else b=b+20|0}b=c[i>>2]|0}Uc(b);c[i>>2]=0}b=a+5600|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}b=a+5592|0;d=c[b>>2]|0;if(!d)return;Uc(d);c[b>>2]=0;c[a+5596>>2]=0;return}function td(a,b,c){a=a|0;b=b|0;c=c|0;return 1}function ud(a,b,d){a=a|0;b=b|0;d=d|0;return(c[a+8>>2]|0)==0&(c[a+188>>2]|0)!=0&(c[a+192>>2]|0)!=0&1|0}function vd(d,e,f){d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;Y=i;i=i+224|0;X=Y+200|0;U=Y+192|0;T=Y+184|0;Q=Y+176|0;P=Y+168|0;O=Y+160|0;M=Y+152|0;L=Y+144|0;K=Y+136|0;E=Y+128|0;J=Y+120|0;D=Y+112|0;B=Y+104|0;A=Y+96|0;z=Y+88|0;y=Y+80|0;I=Y+72|0;H=Y+64|0;x=Y+56|0;w=Y+48|0;v=Y+40|0;F=Y+32|0;p=Y+24|0;m=Y+16|0;l=Y+8|0;N=Y;S=Y+216|0;g=Y+204|0;G=Y+212|0;u=Y+208|0;W=d+8|0;c[W>>2]=1;a:do{if((Mb(e,S,2,f)|0)==2?(qb(S,g,2),(c[g>>2]|0)==65359):0){c[W>>2]=2;o=Pb(e)|0;o=Si(o|0,C|0,-2,-1)|0;n=C;V=d+196|0;h=c[V>>2]|0;c[h>>2]=o;c[h+4>>2]=n;h=N;c[h>>2]=o;c[h+4>>2]=n;Ub(f,4,15766,N)|0;h=c[V>>2]|0;n=c[h>>2]|0;o=h+24|0;g=c[o>>2]|0;k=h+32|0;j=c[k>>2]|0;do{if((g+1|0)>>>0>j>>>0){t=~~(+(j>>>0)+100.0)>>>0;c[k>>2]=t;g=h+28|0;h=Tc(c[g>>2]|0,t*24|0)|0;if(!h){Uc(c[g>>2]|0);c[g>>2]=0;c[k>>2]=0;c[o>>2]=0;Ub(f,1,15803,l)|0;break a}else{c[g>>2]=h;g=c[o>>2]|0;break}}else h=c[h+28>>2]|0}while(0);b[h+(g*24|0)>>1]=-177;s=Pi(0,n|0,32)|0;t=h+(g*24|0)+8|0;c[t>>2]=s;c[t+4>>2]=C;c[h+(g*24|0)+16>>2]=2;c[o>>2]=g+1;t=d+16|0;if((Mb(e,c[t>>2]|0,2,f)|0)!=2){Ub(f,1,8295,p)|0;f=0;i=Y;return f|0}qb(c[t>>2]|0,G,2);g=c[G>>2]|0;if((g|0)!=65424){s=d+20|0;q=0;j=0;r=0;b:while(1){if(g>>>0<65280){R=14;break}else l=784;while(1){h=c[l>>2]|0;k=(h|0)==0;if(k|(h|0)==(g|0))break;else l=l+12|0}if(k){Ub(f,2,15914,v)|0;m=2;c:while(1){do{if((Mb(e,c[t>>2]|0,2,f)|0)!=2){R=20;break b}qb(c[t>>2]|0,N,2);g=c[N>>2]|0}while(g>>>0<65280);l=784;while(1){h=c[l>>2]|0;if((h|0)==0|(h|0)==(g|0)){k=l;g=l;break}else l=l+12|0}if(!(c[g+4>>2]&c[W>>2])){R=25;break b}if((h|0)>=65424){R=100;break}switch(h|0){case 0:break;default:{p=k;o=m;break c}}m=m+2|0}if((R|0)==100){R=0;switch(h|0){case 65424:{h=q;g=r;R=27;break b}default:{p=k;o=m}}}l=c[V>>2]|0;n=Pb(e)|0;n=n-o|0;k=l+24|0;g=c[k>>2]|0;h=l+32|0;m=c[h>>2]|0;if((g+1|0)>>>0>m>>>0){g=~~(+(m>>>0)+100.0)>>>0;c[h>>2]=g;l=l+28|0;g=Tc(c[l>>2]|0,g*24|0)|0;if(!g){j=l;g=l;R=32;break}c[l>>2]=g;h=g;g=c[k>>2]|0}else h=c[l+28>>2]|0;b[h+(g*24|0)>>1]=0;m=h+(g*24|0)+8|0;c[m>>2]=n;c[m+4>>2]=((n|0)<0)<<31>>31;c[h+(g*24|0)+16>>2]=o;c[k>>2]=g+1;g=c[p>>2]|0;c[G>>2]=g;if((g|0)==65424){h=q;g=r;break}else k=784;while(1){h=c[k>>2]|0;if((h|0)==0|(h|0)==(g|0))break;else k=k+12|0}}else k=l;r=(h|0)==65361?1:r;q=(h|0)==65362?1:q;j=(h|0)==65372?1:j;if(!(c[k+4>>2]&c[W>>2])){R=38;break}if((Mb(e,c[t>>2]|0,2,f)|0)!=2){R=40;break}qb(c[t>>2]|0,u,2);h=(c[u>>2]|0)+-2|0;c[u>>2]=h;g=c[t>>2]|0;if(h>>>0>(c[s>>2]|0)>>>0){g=Tc(g,h)|0;if(!g){R=43;break}c[t>>2]=g;h=c[u>>2]|0;c[s>>2]=h}g=Mb(e,g,h,f)|0;if((g|0)!=(c[u>>2]|0)){R=46;break}if(!(Za[c[k+8>>2]&63](d,c[t>>2]|0,g,f)|0)){R=48;break}m=c[V>>2]|0;n=c[k>>2]|0;o=Pb(e)|0;p=c[u>>2]|0;o=-4-p+o|0;p=p+4|0;k=m+24|0;g=c[k>>2]|0;h=m+32|0;l=c[h>>2]|0;if((g+1|0)>>>0>l>>>0){g=~~(+(l>>>0)+100.0)>>>0;c[h>>2]=g;l=m+28|0;g=Tc(c[l>>2]|0,g*24|0)|0;if(!g){j=l;g=l;R=53;break}c[l>>2]=g;h=g;g=c[k>>2]|0}else h=c[m+28>>2]|0;b[h+(g*24|0)>>1]=n;n=h+(g*24|0)+8|0;c[n>>2]=o;c[n+4>>2]=((o|0)<0)<<31>>31;c[h+(g*24|0)+16>>2]=p;c[k>>2]=g+1;if((Mb(e,c[t>>2]|0,2,f)|0)!=2){R=55;break}qb(c[t>>2]|0,G,2);g=c[G>>2]|0;if((g|0)==65424){h=q;g=r;break}}switch(R|0){case 14:{c[F>>2]=g;Ub(f,1,15863,F)|0;f=0;i=Y;return f|0}case 20:{Ub(f,1,8295,w)|0;R=34;break}case 25:{Ub(f,1,8339,x)|0;R=34;break}case 27:{c[G>>2]=65424;break}case 32:{Uc(c[g>>2]|0);c[j>>2]=0;c[h>>2]=0;c[k>>2]=0;Ub(f,1,15803,H)|0;R=34;break}case 38:{Ub(f,1,8339,y)|0;f=0;i=Y;return f|0}case 40:{Ub(f,1,8295,z)|0;f=0;i=Y;return f|0}case 43:{Uc(c[t>>2]|0);c[t>>2]=0;c[s>>2]=0;Ub(f,1,8427,A)|0;f=0;i=Y;return f|0}case 46:{Ub(f,1,8295,B)|0;f=0;i=Y;return f|0}case 48:{Ub(f,1,15985,D)|0;f=0;i=Y;return f|0}case 53:{Uc(c[g>>2]|0);c[j>>2]=0;c[h>>2]=0;c[k>>2]=0;Ub(f,1,15803,J)|0;f=0;i=Y;return f|0}case 55:{Ub(f,1,8295,E)|0;f=0;i=Y;return f|0}}if((R|0)==34){Ub(f,1,15930,I)|0;f=0;i=Y;return f|0}if(g){if(!h){Ub(f,1,16090,L)|0;f=0;i=Y;return f|0}if(!j){Ub(f,1,16136,M)|0;f=0;i=Y;return f|0}d:do{if(a[d+184>>0]&1){s=d+120|0;do{if(c[s>>2]|0){n=d+124|0;o=0;g=0;h=0;e:do{j=c[n>>2]|0;k=c[j+(o<<3)>>2]|0;f:do{if(k){l=c[j+(o<<3)+4>>2]|0;j=g>>>0>>0;m=j?0:g-l|0;if((l|0)==(g|0)|j^1)g=m;else{k=j?k+g|0:k;g=l-g|0;while(1){if(g>>>0<4){R=70;break e}qb(k,N,4);j=g+-4|0;g=c[N>>2]|0;h=g+h|0;if(j>>>0>>0)break;if((j|0)==(g|0)){g=m;break f}else{k=k+(g+4)|0;g=j-g|0}}g=g-j|0}}}while(0);o=o+1|0}while(o>>>0<(c[s>>2]|0)>>>0);if((R|0)==70){Ub(f,1,16182,O)|0;break}if(!g)R=77;else Ub(f,1,16213,P)|0}else{h=0;R=77}}while(0);g:do{if((R|0)==77){j=Pc(h)|0;p=d+144|0;c[p>>2]=j;if(!j){Ub(f,1,13302,Q)|0;break}q=d+132|0;c[q>>2]=h;k=c[s>>2]|0;r=d+124|0;do{if(k){g=c[r>>2]|0;j=g;o=0;n=0;h=0;h:while(1){l=c[j+(o<<3)>>2]|0;if(!l)l=n;else{j=c[j+(o<<3)+4>>2]|0;g=(c[p>>2]|0)+h|0;i:do{if(n>>>0>>0){Ui(g|0,l|0,n|0)|0;h=h+n|0;if((j|0)==(n|0)){l=0;break}m=l+n|0;g=j-n|0;while(1){if(g>>>0<4){R=88;break h}qb(m,S,4);l=m+4|0;k=g+-4|0;j=c[S>>2]|0;g=(c[p>>2]|0)+h|0;if(k>>>0>>0){j=l;break}Ui(g|0,l|0,j|0)|0;g=c[S>>2]|0;h=g+h|0;if((k|0)==(g|0)){l=0;break i}else{m=m+(g+4)|0;g=k-g|0}}Ui(g|0,j|0,k|0)|0;l=(c[S>>2]|0)-k|0;h=k+h|0}else{Ui(g|0,l|0,j|0)|0;l=n-j|0;h=j+h|0}}while(0);Uc(c[(c[r>>2]|0)+(o<<3)>>2]|0);j=c[r>>2]|0;c[j+(o<<3)>>2]=0;c[j+(o<<3)+4>>2]=0;k=c[s>>2]|0;g=j}o=o+1|0;if(o>>>0>=k>>>0){R=94;break}else n=l}if((R|0)==88){Ub(f,1,16182,T)|0;break g}else if((R|0)==94){j=c[p>>2]|0;h=c[q>>2]|0;break}}else g=c[r>>2]|0}while(0);c[d+128>>2]=j;c[d+152>>2]=h;c[s>>2]=0;Uc(g);c[r>>2]=0;break d}}while(0);Ub(f,1,16236,U)|0;f=0;i=Y;return f|0}}while(0);Ub(f,4,16262,X)|0;X=Pb(e)|0;f=(c[V>>2]|0)+8|0;c[f>>2]=X+-2;c[f+4>>2]=0;c[W>>2]=8;f=1;i=Y;return f|0}}Ub(f,1,16044,K)|0;f=0;i=Y;return f|0}}while(0);Ub(f,1,15839,m)|0;f=0;i=Y;return f|0}function wd(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;G=i;i=i+16|0;F=G;D=c[b+80>>2]|0;E=b+88|0;A=_(c[b+112>>2]|0,c[b+116>>2]|0)|0;q=c[D+16>>2]|0;o=q*1080|0;p=c[b+12>>2]|0;q=_(q<<2,q)|0;a:do{if(A){r=p+5604|0;s=p+5620|0;t=p+5612|0;u=p+5616|0;v=p+5632|0;w=p+5624|0;x=p+5584|0;B=0;C=c[b+164>>2]|0;b:while(1){k=C+5584|0;y=c[k>>2]|0;Ui(C|0,p|0,5640)|0;d=C+5636|0;a[d>>0]=a[d>>0]&-4;c[C+5168>>2]=0;d=C+5604|0;c[d>>2]=0;l=C+5620|0;c[l>>2]=0;z=C+5612|0;c[z>>2]=0;m=C+5632|0;c[m>>2]=0;n=C+5624|0;c[n>>2]=0;c[k>>2]=y;if(c[r>>2]|0){f=Pc(q)|0;c[d>>2]=f;if(!f){d=0;f=25;break}Ui(f|0,c[r>>2]|0,q|0)|0}d=(c[s>>2]|0)*20|0;f=Pc(d)|0;c[z>>2]=f;if(!f){d=0;f=25;break}Ui(f|0,c[t>>2]|0,d|0)|0;d=c[u>>2]|0;if(d){h=0;j=c[z>>2]|0;k=c[t>>2]|0;while(1){g=k+12|0;if(c[g>>2]|0){d=k+16|0;f=Pc(c[d>>2]|0)|0;c[j+12>>2]=f;if(!f){d=0;f=25;break b}Ui(f|0,c[g>>2]|0,c[d>>2]|0)|0;d=c[u>>2]|0}c[l>>2]=(c[l>>2]|0)+1;h=h+1|0;if(h>>>0>=d>>>0)break;else{j=j+20|0;k=k+20|0}}}d=(c[v>>2]|0)*20|0;f=Pc(d)|0;c[n>>2]=f;if(!f){d=0;f=25;break}Ui(f|0,c[w>>2]|0,d|0)|0;c[m>>2]=c[v>>2];h=c[v>>2]|0;if(h){j=0;f=c[n>>2]|0;g=c[w>>2]|0;while(1){d=c[g+8>>2]|0;if(d)c[f+8>>2]=(c[z>>2]|0)+(((d-(c[t>>2]|0)|0)/20|0)*20|0);d=c[g+12>>2]|0;if(d)c[f+12>>2]=(c[z>>2]|0)+(((d-(c[t>>2]|0)|0)/20|0)*20|0);j=j+1|0;if(j>>>0>=h>>>0)break;else{f=f+20|0;g=g+20|0}}}Ui(y|0,c[x>>2]|0,o|0)|0;B=B+1|0;if(B>>>0>=A>>>0)break a;else C=C+5640|0}if((f|0)==25){i=G;return d|0}}}while(0);f=Tf(1)|0;d=b+204|0;c[d>>2]=f;if(!f){e=0;i=G;return e|0}if(Xf(f,D,E)|0){e=1;i=G;return e|0}Yf(c[d>>2]|0);c[d>>2]=0;Ub(e,1,8839,F)|0;e=0;i=G;return e|0}function xd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;w=i;i=i+128|0;u=w+120|0;t=w+112|0;s=w+104|0;r=w+96|0;q=w+88|0;p=w+80|0;o=w+72|0;n=w+64|0;m=w+56|0;l=w+48|0;k=w+40|0;j=w+32|0;h=w+24|0;g=w+16|0;f=w+8|0;e=w;if(!a){i=w;return}ki(12191,17,1,d)|0;c[e>>2]=c[a>>2];$h(d,12209,e)|0;c[f>>2]=c[a+4>>2];$h(d,12222,f)|0;c[g>>2]=c[a+8>>2];$h(d,12234,g)|0;c[h>>2]=c[a+16>>2];$h(d,12251,h)|0;if((b|0)>0){g=a+5584|0;h=0;do{f=c[g>>2]|0;c[j>>2]=h;$h(d,12262,j)|0;c[k>>2]=c[f+(h*1080|0)>>2];$h(d,12276,k)|0;a=f+(h*1080|0)+4|0;c[l>>2]=c[a>>2];$h(d,12290,l)|0;c[m>>2]=c[f+(h*1080|0)+8>>2];$h(d,12313,m)|0;c[n>>2]=c[f+(h*1080|0)+12>>2];$h(d,12329,n)|0;c[o>>2]=c[f+(h*1080|0)+16>>2];$h(d,12345,o)|0;c[p>>2]=c[f+(h*1080|0)+20>>2];$h(d,12362,p)|0;ki(12377,23,1,d)|0;if(c[a>>2]|0){e=0;do{x=c[f+(h*1080|0)+944+(e<<2)>>2]|0;c[q>>2]=c[f+(h*1080|0)+812+(e<<2)>>2];c[q+4>>2]=x;$h(d,12401,q)|0;e=e+1|0}while(e>>>0<(c[a>>2]|0)>>>0)}ai(10,d)|0;x=f+(h*1080|0)+24|0;c[r>>2]=c[x>>2];$h(d,12410,r)|0;c[s>>2]=c[f+(h*1080|0)+804>>2];$h(d,12425,s)|0;ki(12442,20,1,d)|0;if((c[x>>2]|0)!=1){a=(c[a>>2]|0)*3|0;if((a|0)>2){a=a+-2|0;v=8}}else{a=1;v=8}if((v|0)==8){v=0;e=0;do{x=c[f+(h*1080|0)+28+(e<<3)>>2]|0;c[t>>2]=c[f+(h*1080|0)+28+(e<<3)+4>>2];c[t+4>>2]=x;$h(d,12401,t)|0;e=e+1|0}while((e|0)!=(a|0))}ai(10,d)|0;c[u>>2]=c[f+(h*1080|0)+808>>2];$h(d,12463,u)|0;ki(12480,5,1,d)|0;h=h+1|0}while((h|0)!=(b|0))}ki(10321,4,1,d)|0;i=w;return}function yd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;B=i;i=i+80|0;u=B+32|0;v=B+24|0;y=B+16|0;x=B+8|0;o=B+64|0;w=B+60|0;n=B+56|0;q=B+52|0;s=B+48|0;r=B+44|0;t=B+40|0;p=B+36|0;c[o>>2]=1;e=Pc(1e3)|0;if(!e){Ub(d,1,12127,B)|0;d=0;i=B;return d|0}z=a+116|0;A=a+112|0;k=a+204|0;l=a+84|0;m=a+8|0;f=1e3;j=0;while(1){if(!(cd(a,w,n,q,s,r,t,p,o,b,d)|0)){g=5;break}if(!(c[o>>2]|0)){g=17;break}h=c[n>>2]|0;if(h>>>0>f>>>0){f=Tc(e,h)|0;if(!f){g=9;break}else{e=f;g=h}}else g=f;f=c[w>>2]|0;if(!(dd(a,f,e,h,b,d)|0)){g=11;break}f=f+1|0;h=_(c[A>>2]|0,c[z>>2]|0)|0;c[v>>2]=f;c[v+4>>2]=h;Ub(d,4,11986,v)|0;h=c[k>>2]|0;if(!(ce(c[(c[c[h+20>>2]>>2]|0)+20>>2]|0,c[h+24>>2]|0,e,c[(c[l>>2]|0)+24>>2]|0)|0)){g=13;break}c[u>>2]=f;Ub(d,4,12016,u)|0;h=Qb(b)|0;if((h|0)==0&(C|0)==0?(c[m>>2]|0)==64:0){g=17;break}j=j+1|0;if((j|0)==(_(c[A>>2]|0,c[z>>2]|0)|0)){g=17;break}else f=g}if((g|0)==5){Uc(e);d=0;i=B;return d|0}else if((g|0)==9){Uc(e);A=_(c[A>>2]|0,c[z>>2]|0)|0;c[x>>2]=(c[w>>2]|0)+1;c[x+4>>2]=A;Ub(d,1,11946,x)|0;d=0;i=B;return d|0}else if((g|0)==11){Uc(e);A=_(c[A>>2]|0,c[z>>2]|0)|0;c[y>>2]=f+1;c[y+4>>2]=A;Ub(d,1,12162,y)|0;d=0;i=B;return d|0}else if((g|0)==13){Uc(e);d=0;i=B;return d|0}else if((g|0)==17){Uc(e);d=1;i=B;return d|0}return 0}function zd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0;G=i;i=i+96|0;y=G+56|0;D=G+48|0;x=G+40|0;z=G+32|0;E=G+24|0;k=G+16|0;j=G+8|0;r=G+92|0;B=G+88|0;q=G+84|0;t=G+80|0;v=G+76|0;u=G+72|0;w=G+68|0;s=G+64|0;c[r>>2]=1;e=Pc(1e3)|0;if(!e){Ub(d,1,11880,G)|0;F=0;i=G;return F|0}A=a+196|0;g=c[A>>2]|0;f=c[g+40>>2]|0;a:do{if(!f){f=_(c[a+116>>2]|0,c[a+112>>2]|0)|0;c[g+36>>2]=f;f=Qc(f,40)|0;g=c[A>>2]|0;c[g+40>>2]=f;b:do{if(f){if(c[g+36>>2]|0){h=0;do{c[f+(h*40|0)+28>>2]=100;c[f+(h*40|0)+20>>2]=0;p=Qc(100,24)|0;g=c[A>>2]|0;f=c[g+40>>2]|0;c[f+(h*40|0)+24>>2]=p;h=h+1|0;if(!p)break b}while(h>>>0<(c[g+36>>2]|0)>>>0)}g=c[a+60>>2]|0;if(!f)break a;else{F=12;break a}}}while(0);Uc(e);F=0;i=G;return F|0}else{g=c[a+60>>2]|0;F=12}}while(0);if((F|0)==12)if(c[f+16>>2]|0){if(!(c[f+(g*40|0)+4>>2]|0)){p=a+64|0;p=Si(c[p>>2]|0,c[p+4>>2]|0,2,0)|0;if(!(xb(b,p,C,d)|0)){Ub(d,1,11918,j)|0;Uc(e);F=0;i=G;return F|0}}else{p=c[f+(g*40|0)+16>>2]|0;p=Si(c[p>>2]|0,c[p+4>>2]|0,2,0)|0;if(!(xb(b,p,C,d)|0)){Ub(d,1,11918,k)|0;Uc(e);F=0;i=G;return F|0}}f=a+8|0;if((c[f>>2]|0)==256)c[f>>2]=8}c:do{if(cd(a,B,q,t,v,u,w,s,r,b,d)|0){o=a+116|0;p=a+112|0;l=a+204|0;m=a+84|0;n=g+1|0;f=1e3;while(1){if(!(c[r>>2]|0))break;k=c[q>>2]|0;if(k>>>0>f>>>0){f=Tc(e,k)|0;if(!f){F=26;break}else{e=f;j=k}}else j=f;h=c[B>>2]|0;if(!(dd(a,h,e,k,b,d)|0)){F=28;break}f=h+1|0;k=_(c[p>>2]|0,c[o>>2]|0)|0;c[z>>2]=f;c[z+4>>2]=k;Ub(d,4,11986,z)|0;k=c[l>>2]|0;if(!(ce(c[(c[c[k+20>>2]>>2]|0)+20>>2]|0,c[k+24>>2]|0,e,c[(c[m>>2]|0)+24>>2]|0)|0)){F=30;break}c[x>>2]=f;Ub(d,4,12016,x)|0;if((h|0)==(g|0)){F=32;break}c[y>>2]=f;c[y+4>>2]=n;Ub(d,2,12060,y)|0;if(!(cd(a,B,q,t,v,u,w,s,r,b,d)|0))break c;else f=j}if((F|0)==26){Uc(e);F=_(c[p>>2]|0,c[o>>2]|0)|0;c[E>>2]=(c[B>>2]|0)+1;c[E+4>>2]=F;Ub(d,1,11946,E)|0;F=0;i=G;return F|0}else if((F|0)==28){Uc(e);F=0;i=G;return F|0}else if((F|0)==30){Uc(e);F=0;i=G;return F|0}else if((F|0)==32){F=(c[A>>2]|0)+8|0;F=Si(c[F>>2]|0,c[F+4>>2]|0,2,0)|0;if(!(xb(b,F,C,d)|0)){Ub(d,1,11918,D)|0;Uc(e);F=0;i=G;return F|0}}Uc(e);F=1;i=G;return F|0}}while(0);Uc(e);F=0;i=G;return F|0}function Ad(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;H=i;i=i+32|0;D=H+16|0;t=H+8|0;l=H;C=H+20|0;E=c[a+40>>2]|0;G=a+36|0;n=c[G>>2]|0;o=a+204|0;k=c[o>>2]|0;c[k+16>>2]=0;B=a+8|0;c[B>>2]=0;c[C>>2]=0;pb(n,65424,2);pb(n+2|0,10,2);F=a+200|0;pb(n+4|0,c[F>>2]|0,2);z=a+12|0;pb(n+10|0,c[z>>2]|0,1);A=a+164|0;pb(n+11|0,c[(c[A>>2]|0)+((c[F>>2]|0)*5640|0)+5588>>2]|0,1);c[C>>2]=12;h=n+12|0;f=E+-12|0;m=a+88|0;if(((b[m>>1]|0)+-3&65535)>=4?(g=c[F>>2]|0,j=c[A>>2]|0,(c[j+(g*5640|0)+420>>2]|0)!=0):0){c[C>>2]=0;_d(c[(c[a+80>>2]|0)+16>>2]|0,j,g,h,C);y=c[C>>2]|0;g=y+12|0;h=n+g|0;f=f-y|0}else g=12;c[C>>2]=0;pb(h,65427,2);c[k+4>>2]=c[B>>2];y=c[z>>2]|0;c[k+8>>2]=y;if(!y)c[(c[c[k+20>>2]>>2]|0)+840>>2]=0;c[C>>2]=0;if(!(bg(k,c[F>>2]|0,h+2|0,C,f+-4|0,0)|0)){Ub(e,1,11860,l)|0;d=0;i=H;return d|0}f=(c[C>>2]|0)+2|0;c[C>>2]=f;f=f+g|0;pb(n+6|0,f,4);if(((b[m>>1]|0)+-3&65535)<4){y=a+28|0;pb(c[y>>2]|0,c[F>>2]|0,1);x=(c[y>>2]|0)+1|0;c[y>>2]=x;pb(x,f,4);c[y>>2]=(c[y>>2]|0)+4}g=n+f|0;y=E-f|0;v=c[o>>2]|0;w=a+88|0;r=c[A>>2]|0;s=c[F>>2]|0;m=be(w,0,s)|0;x=a+8|0;c[z>>2]=(c[z>>2]|0)+1;a:do{if(m>>>0>1){n=v+4|0;o=v+8|0;p=v+20|0;q=a+28|0;j=g;g=y;f=0;l=1;while(1){c[x>>2]=l;c[C>>2]=0;pb(j,65424,2);pb(j+2|0,10,2);pb(j+4|0,c[F>>2]|0,2);pb(j+10|0,c[z>>2]|0,1);pb(j+11|0,c[(c[A>>2]|0)+((c[F>>2]|0)*5640|0)+5588>>2]|0,1);c[C>>2]=0;pb(j+12|0,65427,2);c[n>>2]=c[B>>2];k=c[z>>2]|0;c[o>>2]=k;if(!k)c[(c[c[p>>2]>>2]|0)+840>>2]=0;c[C>>2]=0;if(!(bg(v,c[F>>2]|0,j+14|0,C,g+-16|0,0)|0))break;I=c[C>>2]|0;J=I+2|0;c[C>>2]=J;k=I+14|0;h=j+k|0;f=f+12+J|0;g=g+-12+(-2-I)|0;pb(j+6|0,k,4);if(((b[w>>1]|0)+-3&65535)<4){pb(c[q>>2]|0,c[F>>2]|0,1);J=(c[q>>2]|0)+1|0;c[q>>2]=J;pb(J,k,4);c[q>>2]=(c[q>>2]|0)+4}c[z>>2]=(c[z>>2]|0)+1;l=l+1|0;if(l>>>0>=m>>>0){u=12;break a}else j=h}Ub(e,1,11860,t)|0}else{h=g;g=y;f=0;u=12}}while(0);b:do{if((u|0)==12){p=r+(s*5640|0)+420|0;c:do{if(c[p>>2]|0){q=v+16|0;r=v+4|0;s=v+8|0;t=v+20|0;o=a+28|0;n=1;d:while(1){c[q>>2]=n;m=be(w,n,c[F>>2]|0)|0;if(m){l=0;while(1){c[x>>2]=l;c[C>>2]=0;pb(h,65424,2);pb(h+2|0,10,2);pb(h+4|0,c[F>>2]|0,2);pb(h+10|0,c[z>>2]|0,1);pb(h+11|0,c[(c[A>>2]|0)+((c[F>>2]|0)*5640|0)+5588>>2]|0,1);c[C>>2]=0;pb(h+12|0,65427,2);c[r>>2]=c[B>>2];J=c[z>>2]|0;c[s>>2]=J;if(!J)c[(c[c[t>>2]>>2]|0)+840>>2]=0;c[C>>2]=0;if(!(bg(v,c[F>>2]|0,h+14|0,C,g+-16|0,0)|0))break d;J=c[C>>2]|0;j=J+2|0;c[C>>2]=j;f=f+12+j|0;j=J+14|0;k=h+j|0;g=g+-12+(-2-J)|0;pb(h+6|0,j,4);if(((b[w>>1]|0)+-3&65535)<4){pb(c[o>>2]|0,c[F>>2]|0,1);J=(c[o>>2]|0)+1|0;c[o>>2]=J;pb(J,j,4);c[o>>2]=(c[o>>2]|0)+4}c[z>>2]=(c[z>>2]|0)+1;l=l+1|0;if(l>>>0>=m>>>0){h=k;break}else h=k}}n=n+1|0;if(n>>>0>(c[p>>2]|0)>>>0)break c}Ub(e,1,11860,D)|0;break b}}while(0);J=f-y+E|0;if((Nb(d,c[G>>2]|0,J,e)|0)!=(J|0)){J=0;i=H;return J|0}c[F>>2]=(c[F>>2]|0)+1;J=1;i=H;return J|0}}while(0);J=0;i=H;return J|0}function Bd(a,b,d){a=a|0;b=b|0;d=d|0;a=a+44|0;pb(c[a>>2]|0,65497,2);if((Nb(b,c[a>>2]|0,2,d)|0)!=2){b=0;return b|0}b=(Ob(b,d)|0)!=0&1;return b|0}function Cd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;g=(c[a+32>>2]|0)*5|0;i=a+16|0;i=Si(c[i>>2]|0,c[i+4>>2]|0,6,0)|0;h=C;e=Pb(b)|0;f=C;if(!(Sb(b,i,h,d)|0)){i=0;return i|0}if((Nb(b,c[a+24>>2]|0,g,d)|0)!=(g|0)){i=0;return i|0}i=(Sb(b,e,f,d)|0)!=0&1;return i|0}function Dd(a,b,d){a=a|0;b=b|0;d=d|0;a=c[a+196>>2]|0;if(!a)return 1;b=Pb(b)|0;d=a;d=Oi(b|0,C|0,c[d>>2]|0,c[d+4>>2]|0)|0;b=a+16|0;c[b>>2]=d;c[b+4>>2]=C;return 1}function Ed(a,b,d){a=a|0;b=b|0;d=d|0;d=a+204|0;Yf(c[d>>2]|0);c[d>>2]=0;d=a+24|0;b=c[d>>2]|0;if(b){Uc(b);c[d>>2]=0;c[a+28>>2]=0}d=a+36|0;b=c[d>>2]|0;if(!b){a=a+40|0;c[a>>2]=0;return 1}Uc(b);c[d>>2]=0;a=a+40|0;c[a>>2]=0;return 1}function Fd(a,b,d){a=a|0;b=b|0;d=d|0;d=a+44|0;b=c[d>>2]|0;if(b){Uc(b);c[d>>2]=0}c[a+48>>2]=0;return 1}function Gd(a,b,c){a=a|0;b=b|0;c=c|0;return 1}function Hd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=i;i=i+32|0;e=(c[a+8>>2]|0)==0&(c[a+188>>2]|0)!=0&(c[a+192>>2]|0)!=0&1;b=(c[(c[(c[a+164>>2]|0)+5584>>2]|0)+4>>2]|0)+-1|0;if(b>>>0>31){Ub(d,1,11790,f)|0;d=0;i=f;return d|0}b=1<>2]|0)>>>0>>0){Ub(d,1,11790,f+8|0)|0;d=0;i=f;return d|0}if((c[a+104>>2]|0)>>>0>=b>>>0){d=e;i=f;return d|0}Ub(d,1,11790,f+16|0)|0;d=0;i=f;return d|0}function Id(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0;if((b[a+88>>1]&-32256)<<16>>16!=-32256){j=1;return j|0}i=_(c[a+112>>2]|0,c[a+116>>2]|0)|0;if(!i){j=1;return j|0}h=a+80|0;j=0;e=1;g=c[a+164>>2]|0;while(1){if((c[g+16>>2]|0)==2){e=(c[g+5608>>2]|0)!=0&e;a=c[(c[h>>2]|0)+16>>2]|0;if(a){f=0;d=c[g+5584>>2]|0;while(1){e=(c[d+20>>2]&1^1)&e;f=f+1|0;if(f>>>0>=a>>>0)break;else d=d+1080|0}}}j=j+1|0;if((j|0)==(i|0))break;else g=g+5640|0}return e|0}function Jd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;g=a+88|0;h=a+32|0;i=c[a+80>>2]|0;j=_(c[a+116>>2]|0,c[a+112>>2]|0)|0;c[h>>2]=0;if(!j)return 1;e=c[a+164>>2]|0;f=0;while(1){Nf(i,g,f);b=e+420|0;d=0;a=0;do{k=be(g,a,f)|0;c[h>>2]=(c[h>>2]|0)+k;d=k+d|0;a=a+1|0}while(a>>>0<=(c[b>>2]|0)>>>0);c[e+5588>>2]=d;f=f+1|0;if((f|0)==(j|0))break;else e=e+5640|0}return 1}function Kd(a,b,d){a=a|0;b=b|0;d=d|0;a=c[a+44>>2]|0;pb(a,65359,2);return(Nb(b,a,2,d)|0)==2|0}function Ld(a,b,d){a=a|0;b=b|0;d=d|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+16|0;j=p;k=c[a+80>>2]|0;n=k+16|0;l=(c[n>>2]|0)*3|0;o=l+40|0;f=c[k+24>>2]|0;h=a+48|0;m=a+44|0;g=c[m>>2]|0;do{if(o>>>0>(c[h>>2]|0)>>>0){g=Tc(g,o)|0;if(g){c[m>>2]=g;c[h>>2]=o;break}Uc(c[m>>2]|0);c[m>>2]=0;c[h>>2]=0;Ub(d,1,11752,j)|0;b=0;i=p;return b|0}}while(0);pb(g,65361,2);pb(g+2|0,l+38|0,2);pb(g+4|0,e[a+88>>1]|0,2);pb(g+6|0,c[k+8>>2]|0,4);pb(g+10|0,c[k+12>>2]|0,4);pb(g+14|0,c[k>>2]|0,4);pb(g+18|0,c[k+4>>2]|0,4);pb(g+22|0,c[a+100>>2]|0,4);pb(g+26|0,c[a+104>>2]|0,4);pb(g+30|0,c[a+92>>2]|0,4);pb(g+34|0,c[a+96>>2]|0,4);pb(g+38|0,c[n>>2]|0,2);if(c[n>>2]|0){h=0;g=g+40|0;while(1){pb(g,(c[f+24>>2]|0)+-1+(c[f+32>>2]<<7)|0,1);pb(g+1|0,c[f>>2]|0,1);pb(g+2|0,c[f+4>>2]|0,1);h=h+1|0;if(h>>>0>=(c[n>>2]|0)>>>0)break;else{g=g+3|0;f=f+52|0}}}b=(Nb(b,c[m>>2]|0,o,d)|0)==(o|0)&1;i=p;return b|0}function Md(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;r=i;i=i+32|0;q=r+16|0;p=r+8|0;j=r;o=r+20|0;k=a+200|0;l=c[k>>2]|0;m=a+164|0;n=c[m>>2]|0;e=c[n+(l*5640|0)+5584>>2]|0;if(!(c[e>>2]&1))g=5;else g=(c[e+4>>2]|0)+5|0;h=g+9|0;c[o>>2]=h;f=a+48|0;a=a+44|0;e=c[a>>2]|0;do{if(h>>>0>(c[f>>2]|0)>>>0){e=Tc(e,h)|0;if(e){c[a>>2]=e;c[f>>2]=h;break}Uc(c[a>>2]|0);c[a>>2]=0;c[f>>2]=0;Ub(d,1,11687,j)|0;q=0;i=r;return q|0}}while(0);pb(e,65362,2);pb(e+2|0,g+7|0,2);pb(e+4|0,c[n+(l*5640|0)>>2]|0,1);pb(e+5|0,c[n+(l*5640|0)+4>>2]|0,1);pb(e+6|0,c[n+(l*5640|0)+8>>2]|0,2);pb(e+8|0,c[n+(l*5640|0)+16>>2]|0,1);c[o>>2]=g;if(!(ae(c[m>>2]|0,c[k>>2]|0,e+9|0,o,d)|0)){Ub(d,1,11726,p)|0;q=0;i=r;return q|0}if(!(c[o>>2]|0)){q=(Nb(b,c[a>>2]|0,h,d)|0)==(h|0)&1;i=r;return q|0}else{Ub(d,1,11726,q)|0;q=0;i=r;return q|0}return 0}function Nd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;i=i+32|0;o=p+16|0;n=p+8|0;j=p;l=p+20|0;k=a+200|0;m=a+164|0;e=c[(c[m>>2]|0)+((c[k>>2]|0)*5640|0)+5584>>2]|0;f=c[e+24>>2]|0;if((f|0)==1)e=1;else e=((c[e+4>>2]|0)*3|0)+-2|0;g=(f|0)==0?e+1|0:e<<1|1;h=g+4|0;c[l>>2]=h;f=a+48|0;a=a+44|0;e=c[a>>2]|0;do{if(h>>>0>(c[f>>2]|0)>>>0){e=Tc(e,h)|0;if(e){c[a>>2]=e;c[f>>2]=h;break}Uc(c[a>>2]|0);c[a>>2]=0;c[f>>2]=0;Ub(d,1,11622,j)|0;o=0;i=p;return o|0}}while(0);pb(e,65372,2);pb(e+2|0,g+2|0,2);c[l>>2]=g;if(!($d(c[m>>2]|0,c[k>>2]|0,0,e+4|0,l,d)|0)){Ub(d,1,11661,n)|0;o=0;i=p;return o|0}if(!(c[l>>2]|0)){o=(Nb(b,c[a>>2]|0,h,d)|0)==(h|0)&1;i=p;return o|0}else{Ub(d,1,11661,o)|0;o=0;i=p;return o|0}return 0}function Od(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+16|0;u=w;r=w+4|0;o=a+80|0;e=c[(c[o>>2]|0)+16>>2]|0;if(e>>>0<=1){v=1;i=w;return v|0}s=a+164|0;t=a+200|0;q=a+48|0;n=a+44|0;m=1;while(1){h=c[s>>2]|0;k=c[t>>2]|0;g=c[h+(k*5640|0)+5584>>2]|0;j=c[g+(m*1080|0)>>2]|0;a:do{if((((((c[g>>2]|0)==(j|0)?(p=c[g+4>>2]|0,(p|0)==(c[g+(m*1080|0)+4>>2]|0)):0)?(c[g+8>>2]|0)==(c[g+(m*1080|0)+8>>2]|0):0)?(c[g+12>>2]|0)==(c[g+(m*1080|0)+12>>2]|0):0)?(c[g+16>>2]|0)==(c[g+(m*1080|0)+16>>2]|0):0)?(c[g+20>>2]|0)==(c[g+(m*1080|0)+20>>2]|0):0){if(p){a=0;do{if((c[g+812+(a<<2)>>2]|0)!=(c[g+(m*1080|0)+812+(a<<2)>>2]|0)){v=13;break a}if((c[g+944+(a<<2)>>2]|0)!=(c[g+(m*1080|0)+944+(a<<2)>>2]|0)){v=13;break a}a=a+1|0}while(a>>>0

    >>0)}}else v=13}while(0);if((v|0)==13){v=0;if(!(j&1))a=5;else a=(c[g+(m*1080|0)+4>>2]|0)+5|0;l=a+(e>>>0<257?6:7)|0;f=c[n>>2]|0;if(l>>>0>(c[q>>2]|0)>>>0){a=Tc(f,l)|0;if(!a){v=17;break}c[n>>2]=a;c[q>>2]=l;k=c[t>>2]|0;h=c[s>>2]|0;g=c[h+(k*5640|0)+5584>>2]|0;e=c[(c[o>>2]|0)+16>>2]|0;j=c[g+(m*1080|0)>>2]|0;f=a}e=e>>>0<257?1:2;if(!(j&1))a=5;else a=(c[g+(m*1080|0)+4>>2]|0)+5|0;pb(f,65363,2);pb(f+2|0,e+3+a|0,2);pb(f+4|0,m,e);j=e|4;pb(f+j|0,c[(c[h+(k*5640|0)+5584>>2]|0)+(m*1080|0)>>2]|0,1);c[r>>2]=a;ae(c[s>>2]|0,c[t>>2]|0,f+(j+1)|0,r,d)|0;if((Nb(b,c[n>>2]|0,l,d)|0)!=(l|0)){a=0;v=24;break}e=c[(c[o>>2]|0)+16>>2]|0}m=m+1|0;if(m>>>0>=e>>>0){a=1;v=24;break}}if((v|0)==17){Uc(c[n>>2]|0);c[n>>2]=0;c[q>>2]=0;Ub(d,1,11548,u)|0;v=0;i=w;return v|0}else if((v|0)==24){i=w;return a|0}return 0}function Pd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+16|0;r=t;o=t+4|0;m=a+80|0;e=c[(c[m>>2]|0)+16>>2]|0;if(e>>>0<=1){s=1;i=t;return s|0}p=a+164|0;q=a+200|0;n=a+48|0;l=a+44|0;k=1;while(1){j=c[(c[p>>2]|0)+((c[q>>2]|0)*5640|0)+5584>>2]|0;g=c[j+24>>2]|0;h=c[j+(k*1080|0)+24>>2]|0;a:do{if((g|0)==(h|0)?(c[j+804>>2]|0)==(c[j+(k*1080|0)+804>>2]|0):0){if((g|0)!=1){f=(c[j+4>>2]|0)*3|0;a=f+-2|0;if((f|0)!=((c[j+(k*1080|0)+4>>2]|0)*3|0)){s=14;break}if(!a)break}else a=1;f=0;do{if((c[j+28+(f<<3)>>2]|0)!=(c[j+(k*1080|0)+28+(f<<3)>>2]|0)){s=14;break a}f=f+1|0}while(f>>>0>>0);if(g){f=0;do{if((c[j+28+(f<<3)+4>>2]|0)!=(c[j+(k*1080|0)+28+(f<<3)+4>>2]|0)){s=14;break a}f=f+1|0}while(f>>>0>>0)}}else s=14}while(0);if((s|0)==14){s=0;if((h|0)==1)a=1;else a=((c[j+(k*1080|0)+4>>2]|0)*3|0)+-2|0;g=((h|0)==0?a+1|0:a<<1|1)+5+(e>>>0>256&1)|0;a=c[l>>2]|0;if(g>>>0>(c[n>>2]|0)>>>0){a=Tc(a,g)|0;if(!a){s=18;break}c[l>>2]=a;c[n>>2]=g;e=c[(c[p>>2]|0)+((c[q>>2]|0)*5640|0)+5584>>2]|0;f=c[e+(k*1080|0)+24>>2]|0}else{f=h;e=j}if((f|0)==1)e=1;else e=((c[e+(k*1080|0)+4>>2]|0)*3|0)+-2|0;f=(f|0)==0?e+1|0:e<<1|1;c[o>>2]=f+6;pb(a,65373,2);e=a+2|0;if((c[(c[m>>2]|0)+16>>2]|0)>>>0<257){pb(e,f+3|0,2);pb(a+4|0,k,1);a=a+5|0}else{pb(e,f+4|0,2);pb(a+4|0,k,2);a=a+6|0}c[o>>2]=f;$d(c[p>>2]|0,c[q>>2]|0,k,a,o,d)|0;if((Nb(b,c[l>>2]|0,g,d)|0)!=(g|0)){a=0;s=28;break}e=c[(c[m>>2]|0)+16>>2]|0}k=k+1|0;if(k>>>0>=e>>>0){a=1;s=28;break}}if((s|0)==18){Uc(c[l>>2]|0);c[l>>2]=0;c[n>>2]=0;Ub(d,1,11476,r)|0;s=0;i=t;return s|0}else if((s|0)==28){i=t;return a|0}return 0}function Qd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;g=l;h=(c[a+32>>2]|0)*5|0;j=h+6|0;f=a+48|0;k=a+44|0;e=c[k>>2]|0;do{if(j>>>0>(c[f>>2]|0)>>>0){e=Tc(e,j)|0;if(e){c[k>>2]=e;c[f>>2]=j;break}Uc(c[k>>2]|0);c[k>>2]=0;c[f>>2]=0;Ub(d,1,11437,g)|0;b=0;i=l;return b|0}}while(0);g=Pb(b)|0;a=a+16|0;c[a>>2]=g;c[a+4>>2]=C;pb(e,65365,2);pb(e+2|0,h+4|0,2);pb(e+4|0,0,1);pb(e+5|0,80,1);b=(Nb(b,c[k>>2]|0,j,d)|0)==(j|0)&1;i=l;return b|0}function Rd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+16|0;j=q;p=q+4|0;c[p>>2]=0;m=a+200|0;e=c[m>>2]|0;l=a+164|0;f=c[l>>2]|0;k=a+80|0;h=c[(c[k>>2]|0)+16>>2]|0;o=(_(h>>>0<257?7:9,(c[f+(e*5640|0)+420>>2]|0)+1|0)|0)+4|0;g=a+48|0;n=a+44|0;a=c[n>>2]|0;do{if(o>>>0>(c[g>>2]|0)>>>0){e=Tc(a,o)|0;if(e){c[n>>2]=e;c[g>>2]=o;g=e;a=c[(c[k>>2]|0)+16>>2]|0;f=c[l>>2]|0;e=c[m>>2]|0;break}Uc(c[n>>2]|0);c[n>>2]=0;c[g>>2]=0;Ub(d,1,11398,j)|0;b=0;i=q;return b|0}else{g=a;a=h}}while(0);_d(a,f,e,g,p);b=(Nb(b,c[n>>2]|0,o,d)|0)==(o|0)&1;i=q;return b|0}function Sd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;i=a+164|0;j=a+80|0;f=c[j>>2]|0;e=c[f+16>>2]|0;if(!e){b=1;return b|0}h=a+44|0;a=0;g=c[(c[i>>2]|0)+5584>>2]|0;while(1){if(c[g+808>>2]|0){k=c[(c[i>>2]|0)+5584>>2]|0;m=e>>>0<257?1:2;f=m+6|0;l=c[h>>2]|0;pb(l,65374,2);e=m|4;pb(l+2|0,e,2);pb(l+4|0,a,m);pb(l+e|0,0,1);pb(l+(e+1)|0,c[k+(a*1080|0)+808>>2]|0,1);if((Nb(b,c[h>>2]|0,f,d)|0)!=(f|0)){a=0;e=7;break}f=c[j>>2]|0}a=a+1|0;e=c[f+16>>2]|0;if(a>>>0>=e>>>0){a=1;e=7;break}else g=g+1080|0}if((e|0)==7)return a|0;return 0}function Td(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0;l=i;i=i+16|0;g=l;h=c[a+108>>2]|0;j=wi(h)|0;k=j+6|0;e=a+48|0;f=a+44|0;a=c[f>>2]|0;do{if(k>>>0>(c[e>>2]|0)>>>0){a=Tc(a,k)|0;if(a){c[f>>2]=a;c[e>>2]=k;break}Uc(c[f>>2]|0);c[f>>2]=0;c[e>>2]=0;Ub(d,1,11355,g)|0;b=0;i=l;return b|0}}while(0);pb(a,65380,2);pb(a+2|0,j+4|0,2);pb(a+4|0,1,2);Ui(a+6|0,h|0,j|0)|0;b=(Nb(b,c[f>>2]|0,k,d)|0)==(k|0)&1;i=l;return b|0}function Ud(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;A=i;i=i+32|0;w=A+24|0;t=A+16|0;o=A+8|0;g=A;j=c[b+80>>2]|0;k=j+16|0;h=c[k>>2]|0;l=h+6|0;v=b+48|0;z=b+44|0;f=c[z>>2]|0;do{if(l>>>0>(c[v>>2]|0)>>>0){f=Tc(f,l)|0;if(f){c[z>>2]=f;c[v>>2]=l;break}Uc(c[z>>2]|0);c[z>>2]=0;c[v>>2]=0;Ub(e,1,11199,g)|0;d=0;i=A;return d|0}}while(0);pb(f,65400,2);pb(f+2|0,h+4|0,2);pb(f+4|0,c[k>>2]|0,2);if(c[k>>2]|0){h=0;g=c[j+24>>2]|0;f=f+6|0;while(1){pb(f,(c[g+24>>2]|0)+-1|c[g+32>>2]<<7,1);h=h+1|0;if(h>>>0>=(c[k>>2]|0)>>>0)break;else{g=g+52|0;f=f+1|0}}}if((Nb(d,c[z>>2]|0,l,e)|0)!=(l|0)){d=0;i=A;return d|0}q=b+200|0;n=c[q>>2]|0;r=b+164|0;m=c[r>>2]|0;g=m+(n*5640|0)+5616|0;a:do{if(c[g>>2]|0){l=0;b=c[m+(n*5640|0)+5612>>2]|0;while(1){h=b+16|0;j=c[h>>2]|0;k=j+10|0;f=c[z>>2]|0;if(k>>>0>(c[v>>2]|0)>>>0){f=Tc(f,k)|0;if(!f)break;c[z>>2]=f;c[v>>2]=k}pb(f,65396,2);pb(f+2|0,j+8|0,2);pb(f+4|0,0,2);pb(f+6|0,c[b+4>>2]<<8|c[b+8>>2]&255|c[b>>2]<<10,2);pb(f+8|0,0,2);Ui(f+10|0,c[b+12>>2]|0,c[h>>2]|0)|0;if((Nb(d,c[z>>2]|0,k,e)|0)!=(k|0)){s=0;x=42;break}l=l+1|0;if(l>>>0>=(c[g>>2]|0)>>>0)break a;else b=b+20|0}if((x|0)==42){i=A;return s|0}Uc(c[z>>2]|0);c[z>>2]=0;c[v>>2]=0;Ub(e,1,11238,o)|0;d=0;i=A;return d|0}}while(0);o=m+(n*5640|0)+5628|0;b:do{if(c[o>>2]|0){p=0;m=c[m+(n*5640|0)+5624>>2]|0;while(1){l=m+4|0;g=c[l>>2]|0;j=g>>>0>255;k=j?2:1;j=j?32768:0;g=_(k,g<<1)|0;b=g+19|0;f=c[z>>2]|0;if(b>>>0>(c[v>>2]|0)>>>0){f=Tc(f,b)|0;if(!f)break;c[z>>2]=f;c[v>>2]=b}pb(f,65397,2);pb(f+2|0,g+17|0,2);pb(f+4|0,0,2);pb(f+6|0,c[m>>2]|0,1);pb(f+7|0,0,2);pb(f+9|0,1,2);pb(f+11|0,1,1);pb(f+12|0,c[l>>2]|j,2);f=f+14|0;if(!(c[l>>2]|0))g=0;else{h=0;do{pb(f,h,k);f=f+k|0;h=h+1|0;g=c[l>>2]|0}while(h>>>0>>0)}pb(f,g|j,2);f=f+2|0;if(!(c[l>>2]|0))h=f;else{g=0;do{pb(f,g,k);f=f+k|0;g=g+1|0}while(g>>>0<(c[l>>2]|0)>>>0);h=f}f=((a[m+16>>0]^1)&255)<<16&65536;g=c[m+8>>2]|0;if(g)f=c[g+8>>2]|f;g=c[m+12>>2]|0;if(g)f=c[g+8>>2]<<8|f;pb(h,f,3);if((Nb(d,c[z>>2]|0,b,e)|0)!=(b|0)){s=0;x=42;break}p=p+1|0;if(p>>>0>=(c[o>>2]|0)>>>0)break b;else m=m+20|0}if((x|0)==42){i=A;return s|0}Uc(c[z>>2]|0);c[z>>2]=0;c[v>>2]=0;Ub(e,1,11277,t)|0;d=0;i=A;return d|0}}while(0);k=c[q>>2]|0;j=c[r>>2]|0;l=j+(k*5640|0)+5628|0;g=c[l>>2]|0;b=g+5|0;f=c[z>>2]|0;do{if(b>>>0>(c[v>>2]|0)>>>0){f=Tc(f,b)|0;if(!f){Uc(c[z>>2]|0);c[z>>2]=0;c[v>>2]=0;Ub(e,1,11316,w)|0;u=1;break}else{c[z>>2]=f;c[v>>2]=b;y=f;x=37;break}}else{y=f;x=37}}while(0);if((x|0)==37){pb(y,65399,2);pb(y+2|0,g+3|0,2);pb(y+4|0,c[l>>2]|0,1);if(c[l>>2]|0){h=0;g=y+5|0;f=c[j+(k*5640|0)+5624>>2]|0;while(1){pb(g,c[f>>2]|0,1);h=h+1|0;if(h>>>0>=(c[l>>2]|0)>>>0)break;else{g=g+1|0;f=f+20|0}}}u=(Nb(d,c[z>>2]|0,b,e)|0)!=(b|0)}d=u&1^1;i=A;return d|0}function Vd(a,b,d){a=a|0;b=b|0;d=d|0;d=Pb(b)|0;b=(c[a+196>>2]|0)+8|0;c[b>>2]=d;c[b+4>>2]=C;return 1}function Wd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=i;i=i+16|0;b=Tf(0)|0;e=a+204|0;c[e>>2]=b;if(!b){Ub(d,1,11159,f)|0;d=0;i=f;return d|0}if(Xf(b,c[a+80>>2]|0,a+88|0)|0){d=1;i=f;return d|0}Yf(c[e>>2]|0);c[e>>2]=0;d=0;i=f;return d|0}function Xd(d,e,f){d=d|0;e=e|0;f=f|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0.0,o=0,p=0,q=0,r=0,s=0,t=0.0,u=0,v=0,w=0.0,x=0.0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0.0,H=0.0,I=0.0,J=0.0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;O=d+80|0;E=c[O>>2]|0;P=d+164|0;i=c[P>>2]|0;N=E+24|0;F=c[N>>2]|0;f=c[F>>2]|0;h=c[F+4>>2]|0;M=E+16|0;F=_(c[F+24>>2]|0,c[M>>2]|0)|0;D=Pb(e)|0;q=d+116|0;l=c[q>>2]|0;r=d+112|0;e=c[r>>2]|0;G=(+(D>>>0)+4294967296.0*+(C|0))/+((_(e,l)|0)>>>0);D=(a[d+181>>0]&8)==0?1:2;if(l){s=d+92|0;u=d+100|0;v=d+96|0;y=d+104|0;z=E+4|0;A=E+8|0;B=E+12|0;x=+((_(f<<3,h)|0)>>>0);m=e;f=e;p=0;e=i;do{o=p;p=p+1|0;if(!f)f=0;else{m=0;do{w=+Sa[D&3](e);l=c[e+8>>2]|0;w=w/+(l>>>0);Q=c[s>>2]|0;i=c[u>>2]|0;k=(_(i,m)|0)+Q|0;f=c[E>>2]|0;f=(k|0)>(f|0)?k:f;k=c[v>>2]|0;j=c[y>>2]|0;R=(_(j,o)|0)+k|0;h=c[z>>2]|0;h=(R|0)>(h|0)?R:h;m=m+1|0;Q=(_(i,m)|0)+Q|0;i=c[A>>2]|0;i=(Q|0)<(i|0)?Q:i;k=(_(j,p)|0)+k|0;j=c[B>>2]|0;j=(k|0)<(j|0)?k:j;k=e+20|0;n=+g[k>>2];if(n!=0.0)g[k>>2]=+((_(_(i-f|0,F)|0,j-h|0)|0)>>>0)/(x*n)-w;if(l>>>0>1){n=+((_(_(i-f|0,F)|0,j-h|0)|0)>>>0);f=1;h=e+24|0;while(1){t=+g[h>>2];if(t!=0.0)g[h>>2]=n/(x*t)-w;f=f+1|0;if(f>>>0>=l>>>0)break;else h=h+4|0}}e=e+5640|0;f=c[r>>2]|0}while(m>>>0>>0);l=c[q>>2]|0;m=f}}while(p>>>0>>0);if(!l)l=0;else{s=(m|0)==0;t=G+2.0;v=m>>>0>1?m:1;u=0;f=c[P>>2]|0;do{if(!s){p=f+16|0;q=0;r=f;while(1){e=r+20|0;n=+g[e>>2];if(n!=0.0?(x=n-G,g[e>>2]=x,x<30.0):0)g[e>>2]=30.0;j=r+24|0;e=c[r+8>>2]|0;o=e+-1|0;n=+g[j>>2];h=n!=0.0;if(o>>>0>1){k=p+(e<<2)|0;i=1;e=j;do{if(h?(x=n-G,g[e>>2]=x,I=+g[e+-4>>2],x>2]=I+20.0;e=e+4|0;i=i+1|0;n=+g[e>>2];h=n!=0.0}while((i|0)!=(o|0));if(h){H=n;K=k;L=29}}else if(h){H=n;K=j;L=29}if((L|0)==29?(L=0,x=H-t,g[K>>2]=x,J=+g[K+-4>>2],x>2]=J+20.0;q=q+1|0;if(q>>>0>=m>>>0)break;else{p=p+5640|0;r=r+5640|0}}f=f+(v*5640|0)|0}u=u+1|0}while(u>>>0>>0)}}else{m=e;l=0}h=c[M>>2]|0;if(!h)u=0;else{i=(c[d+100>>2]|0)+-1|0;j=(c[d+104>>2]|0)+-1|0;k=0;e=c[N>>2]|0;f=0;while(1){R=c[e>>2]|0;Q=c[e+4>>2]|0;R=_(((j+Q|0)>>>0)/(Q>>>0)|0,((i+R|0)>>>0)/(R>>>0)|0)|0;f=(_(R,c[e+24>>2]|0)|0)+f|0;k=k+1|0;if(k>>>0>=h>>>0)break;else e=e+52|0}u=~~(+(f>>>0)*.1625)>>>0}o=c[(c[O>>2]|0)+16>>2]|0;q=o+-1|0;s=_(l,m)|0;p=(s|0)==0;if(p)i=0;else{e=0;f=0;h=c[P>>2]|0;while(1){R=c[h+5588>>2]|0;f=f>>>0>R>>>0?f:R;e=e+1|0;if((e|0)==(s|0))break;else h=h+5640|0}i=f*12|0}r=d+88|0;if(((b[r>>1]|0)+-3&65535)>=4){if(p){e=0;f=0}else{m=(o|0)==0;k=0;f=0;do{if(!m){h=c[(c[P>>2]|0)+(k*5640|0)+5584>>2]|0;j=0;do{if(!(c[h+(j*1080|0)>>2]&1))e=5;else e=(c[h+(j*1080|0)+4>>2]|0)+5|0;f=f>>>0>e>>>0?f:e;j=j+1|0}while((j|0)!=(o|0))}k=k+1|0}while((k|0)!=(s|0));l=0;e=0;do{if(!m){j=c[(c[P>>2]|0)+(l*5640|0)+5584>>2]|0;k=0;do{if(!(c[j+(k*1080|0)>>2]&1))h=5;else h=(c[j+(k*1080|0)+4>>2]|0)+5|0;e=e>>>0>h>>>0?e:h;k=k+1|0}while((k|0)!=(o|0))}l=l+1|0}while((l|0)!=(s|0))}i=(_(f+12+e|0,q)|0)+i|0}if(p)f=13;else{h=0;f=0;e=c[P>>2]|0;while(1){R=c[e+420>>2]|0;f=f>>>0>R>>>0?f:R;h=h+1|0;if((h|0)==(s|0))break;else e=e+5640|0}f=(f*9|0)+13|0}R=i+u+f|0;c[d+40>>2]=R;R=Pc(R)|0;c[d+36>>2]=R;if(!R){R=0;return R|0}if(((b[r>>1]|0)+-3&65535)>=4){R=1;return R|0}f=Pc((c[d+32>>2]|0)*5|0)|0;c[d+24>>2]=f;if(!f){R=0;return R|0}c[d+28>>2]=f;R=1;return R|0}function Yd(a){a=a|0;return 0.0}function Zd(a){a=a|0;return+ +((((c[a+5588>>2]|0)*14|0)+-14|0)>>>0)}function _d(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;g=c[b+(d*5640|0)+5584>>2]|0;q=(c[b+(d*5640|0)+420>>2]|0)+1|0;j=a>>>0<257?1:2;p=_(q,(j<<1)+5|0)|0;r=p+4|0;pb(e,65375,2);pb(e+2|0,p+2|0,2);if(!q){c[f>>2]=r;return}k=j+1|0;l=j+3|0;m=j|4;n=m+j|0;o=n+1|0;p=b+(d*5640|0)+8|0;h=g+4|0;i=0;e=e+4|0;g=b+(d*5640|0)+424|0;while(1){pb(e,c[g>>2]|0,1);pb(e+1|0,c[g+4>>2]|0,j);t=g+8|0;pb(e+k|0,c[t>>2]|0,2);b=g+12|0;pb(e+l|0,c[b>>2]|0,1);d=g+16|0;pb(e+m|0,c[d>>2]|0,j);pb(e+n|0,c[g+36>>2]|0,1);u=c[t>>2]|0;s=c[p>>2]|0;c[t>>2]=(u|0)<(s|0)?u:s;t=c[b>>2]|0;s=c[h>>2]|0;c[b>>2]=(t|0)<(s|0)?t:s;b=c[d>>2]|0;c[d>>2]=(b|0)<(a|0)?b:a;i=i+1|0;if((i|0)==(q|0))break;else{e=e+o|0;g=g+148|0}}c[f>>2]=r;return}function $d(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+16|0;k=n+8|0;j=n;l=c[a+(b*5640|0)+5584>>2]|0;b=c[l+(d*1080|0)+24>>2]|0;do{if((b|0)!=1){a=(c[l+(d*1080|0)+4>>2]|0)*3|0;h=a+-2|0;if(!b){a=a+-1|0;if((c[f>>2]|0)>>>0>>0){Ub(g,1,11515,j)|0;f=0;i=n;return f|0}else{pb(e,c[l+(d*1080|0)+804>>2]<<5,1);if(!h)break;else b=0;do{e=e+1|0;pb(e,c[l+(d*1080|0)+28+(b<<3)>>2]<<3,1);b=b+1|0}while((b|0)!=(h|0))}}else m=7}else{h=1;b=1;m=7}}while(0);if((m|0)==7){a=h<<1|1;if((c[f>>2]|0)>>>0>>0){Ub(g,1,11515,k)|0;f=0;i=n;return f|0}pb(e,(c[l+(d*1080|0)+804>>2]<<5)+b|0,1);if(h){e=e+1|0;b=0;while(1){pb(e,(c[l+(d*1080|0)+28+(b<<3)>>2]<<11)+(c[l+(d*1080|0)+28+(b<<3)+4>>2]|0)|0,2);b=b+1|0;if((b|0)==(h|0))break;else e=e+2|0}}}c[f>>2]=(c[f>>2]|0)-a;f=1;i=n;return f|0}function ae(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0;j=i;i=i+16|0;g=c[a+(b*5640|0)+5584>>2]|0;if((c[e>>2]|0)>>>0<5){Ub(f,1,11587,j)|0;e=0;i=j;return e|0}h=g+4|0;pb(d,(c[h>>2]|0)+-1|0,1);pb(d+1|0,(c[g+8>>2]|0)+-2|0,1);pb(d+2|0,(c[g+12>>2]|0)+-2|0,1);pb(d+3|0,c[g+16>>2]|0,1);pb(d+4|0,c[g+20>>2]|0,1);b=(c[e>>2]|0)+-5|0;c[e>>2]=b;if(!(c[g>>2]&1)){e=1;i=j;return e|0}a=c[h>>2]|0;if(b>>>0>>0){Ub(f,1,11587,j+8|0)|0;e=0;i=j;return e|0}if(!a)a=0;else{b=d+5|0;d=0;while(1){pb(b,(c[g+944+(d<<2)>>2]<<4)+(c[g+812+(d<<2)>>2]|0)|0,1);d=d+1|0;a=c[h>>2]|0;if(d>>>0>=a>>>0)break;else b=b+1|0}b=c[e>>2]|0}c[e>>2]=b-a;e=1;i=j;return e|0}function be(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;i=c[b+76>>2]|0;g=c[i+(f*5640|0)+4>>2]|0;h=696;while(1){m=c[h>>2]|0;if((m|0)==-1|(m|0)==(g|0))break;else h=h+12|0}if(!(a[b+93>>0]&8)){b=1;return b|0}m=d[b+92>>0]|0;j=i+(f*5640|0)+424+(e*148|0)+92|0;k=i+(f*5640|0)+424+(e*148|0)+88|0;l=i+(f*5640|0)+424+(e*148|0)+96|0;e=i+(f*5640|0)+424+(e*148|0)+84|0;i=a[h+4>>0]|0;switch(i|0){case 67:{g=c[j>>2]|0;break}case 82:{g=c[k>>2]|0;break}case 80:{g=c[l>>2]|0;break}case 76:{g=c[e>>2]|0;break}default:g=1}if((m|0)!=(i|0)){i=a[h+5>>0]|0;switch(i|0){case 67:{g=_(c[j>>2]|0,g)|0;break}case 82:{g=_(c[k>>2]|0,g)|0;break}case 80:{g=_(c[l>>2]|0,g)|0;break}case 76:{g=_(c[e>>2]|0,g)|0;break}default:{}}if((m|0)!=(i|0)){i=a[h+6>>0]|0;switch(i|0){case 67:{g=_(c[j>>2]|0,g)|0;break}case 82:{g=_(c[k>>2]|0,g)|0;break}case 80:{g=_(c[l>>2]|0,g)|0;break}case 76:{g=_(c[e>>2]|0,g)|0;break}default:{}}if((m|0)!=(i|0)){h=a[h+7>>0]|0;switch(h|0){case 67:{g=_(c[j>>2]|0,g)|0;break}case 82:{g=_(c[k>>2]|0,g)|0;break}case 80:{g=_(c[l>>2]|0,g)|0;break}case 76:{g=_(c[e>>2]|0,g)|0;break}default:{}}if((m|0)==(h|0))h=3;else{b=g;return b|0}}else h=2}else h=1}else h=0;c[b+84>>2]=h;b=g;return b|0}function ce(f,g,h,i){f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0;B=g+16|0;if(!(c[B>>2]|0)){B=1;return B|0}A=0;z=c[g+24>>2]|0;while(1){k=i+44|0;j=c[k>>2]|0;l=i+8|0;if(!j){g=i+12|0;j=Qc(_(c[g>>2]|0,c[l>>2]|0)|0,4)|0;c[k>>2]=j;if(!j){h=0;i=61;break}}else g=i+12|0;q=z+36|0;c[i+36>>2]=c[q>>2];x=c[z+24>>2]|0;t=c[f+24>>2]|0;q=c[q>>2]|0;x=((x&7|0)!=0&1)+(x>>>3)|0;x=(x|0)==3?4:x;n=c[t+(q*136|0)+8>>2]|0;m=c[t+(q*136|0)>>2]|0;v=n-m|0;s=c[t+(q*136|0)+12>>2]|0;q=c[t+(q*136|0)+4>>2]|0;t=s-q|0;k=c[i+16>>2]|0;p=c[i+40>>2]|0;o=Ri(1,0,p|0)|0;w=C;k=Si(k|0,0,-1,-1)|0;k=Si(k|0,C|0,o|0,w|0)|0;k=Ti(k|0,C|0,p|0)|0;r=Si(c[i+20>>2]|0,0,-1,-1)|0;w=Si(r|0,C|0,o|0,w|0)|0;p=Ti(w|0,C|0,p|0)|0;w=c[l>>2]|0;l=k+w|0;o=c[g>>2]|0;r=p+o|0;do{if(k>>>0>>0){g=m-k|0;if(n>>>0>l>>>0){y=l-m|0;u=0;m=v-y|0;n=g}else{u=0;m=0;n=g;y=v}}else{g=k-m|0;if(n>>>0>l>>>0){u=g;m=n-l|0;n=0;y=w;break}else{u=g;m=0;n=0;y=v-g|0;break}}}while(0);do{if(p>>>0>>0){l=q-p|0;if(s>>>0>r>>>0){k=r-q|0;o=k;g=0;k=t-k|0}else{o=t;g=0;k=0}}else{g=p-q|0;if(s>>>0>r>>>0){k=s-r|0;l=0;break}else{o=t-g|0;k=0;l=0;break}}}while(0);if((u|m|y|k|g|o|0)<0){h=0;i=61;break}g=(_(g,v)|0)+u|0;q=u+m|0;r=(_(k,v)|0)-u|0;p=w-y|0;j=j+((_(w,l)|0)+n<<2)|0;switch(x|0){case 1:{h=h+g|0;g=(o|0)==0;if(!(c[z+32>>2]|0)){if(!g){m=(y|0)==0;n=0;g=j;while(1){if(!m){l=g+(y<<2)|0;k=0;j=h;while(1){c[g>>2]=d[j>>0];k=k+1|0;if((k|0)==(y|0))break;else{g=g+4|0;j=j+1|0}}g=l;h=h+y|0}h=h+q|0;n=n+1|0;if((n|0)==(o|0))break;else g=g+(p<<2)|0}}}else if(!g){m=(y|0)==0;n=0;g=j;while(1){if(!m){l=g+(y<<2)|0;k=0;j=h;while(1){c[g>>2]=a[j>>0];k=k+1|0;if((k|0)==(y|0))break;else{g=g+4|0;j=j+1|0}}g=l;h=h+y|0}h=h+q|0;n=n+1|0;if((n|0)==(o|0))break;else g=g+(p<<2)|0}}h=h+r|0;break}case 2:{h=h+(g<<1)|0;g=(o|0)==0;if(!(c[z+32>>2]|0)){if(!g){m=(y|0)==0;n=0;g=j;while(1){if(!m){l=g+(y<<2)|0;k=0;j=h;while(1){c[g>>2]=e[j>>1];k=k+1|0;if((k|0)==(y|0))break;else{g=g+4|0;j=j+2|0}}g=l;h=h+(y<<1)|0}h=h+(q<<1)|0;n=n+1|0;if((n|0)==(o|0))break;else g=g+(p<<2)|0}}}else if(!g){m=(y|0)==0;n=0;g=j;while(1){if(!m){l=g+(y<<2)|0;k=0;j=h;while(1){c[g>>2]=b[j>>1];k=k+1|0;if((k|0)==(y|0))break;else{g=g+4|0;j=j+2|0}}g=l;h=h+(y<<1)|0}h=h+(q<<1)|0;n=n+1|0;if((n|0)==(o|0))break;else g=g+(p<<2)|0}}h=h+(r<<1)|0;break}case 4:{h=h+(g<<2)|0;if(o){m=(y|0)==0;n=0;g=j;while(1){if(!m){l=g+(y<<2)|0;k=0;j=h;while(1){c[g>>2]=c[j>>2];k=k+1|0;if((k|0)==(y|0))break;else{g=g+4|0;j=j+4|0}}g=l;h=h+(y<<2)|0}h=h+(q<<2)|0;n=n+1|0;if((n|0)==(o|0))break;else g=g+(p<<2)|0}}h=h+(r<<2)|0;break}default:{}}A=A+1|0;if(A>>>0>=(c[B>>2]|0)>>>0){h=1;i=61;break}else{i=i+52|0;z=z+52|0;f=f+52|0}}if((i|0)==61)return h|0;return 0}function de(b,e,f,g){b=b|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;z=i;i=i+112|0;x=z+88|0;u=z+80|0;v=z+72|0;t=z+64|0;q=z+56|0;p=z+48|0;m=z+40|0;k=z+32|0;j=z+24|0;h=z+16|0;r=z+100|0;s=z+96|0;w=z+92|0;c[s>>2]=0;y=b+200|0;if((f|0)!=8){Ub(g,1,8662,z)|0;Ub(g,1,8662,z+8|0)|0;g=0;i=z;return g|0}qb(e,y,2);qb(e+2|0,r,4);qb(e+6|0,w,1);qb(e+7|0,s,1);l=c[y>>2]|0;e=c[b+112>>2]|0;if(l>>>0>=(_(c[b+116>>2]|0,e)|0)>>>0){c[h>>2]=l;Ub(g,1,15258,h)|0;g=0;i=z;return g|0}f=c[b+164>>2]|0;o=(l>>>0)%(e>>>0)|0;n=(l>>>0)/(e>>>0)|0;e=c[r>>2]|0;do{if((e+-1|0)>>>0<13){if((e|0)==12){c[j>>2]=12;Ub(g,2,15282,j)|0;e=c[r>>2]|0;break}c[k>>2]=e;Ub(g,1,15319,k)|0;g=0;i=z;return g|0}}while(0);if(!e){Ub(g,4,15380,m)|0;c[b+72>>2]=1}e=c[s>>2]|0;do{if(!e)e=c[f+(l*5640|0)+5588>>2]|0;else{e=((d[b+76>>0]|0)>>>4&1)+e|0;c[s>>2]=e;h=f+(l*5640|0)+5588|0;j=c[h>>2]|0;f=c[w>>2]|0;if((j+-1|0)>>>0>>0){c[p>>2]=f;c[p+4>>2]=j;Ub(g,1,15491,p)|0;c[b+72>>2]=1;g=0;i=z;return g|0}if(f>>>0>>0){c[h>>2]=e;break}c[q>>2]=f;c[q+4>>2]=e;Ub(g,1,15590,q)|0;c[b+72>>2]=1;g=0;i=z;return g|0}}while(0);if((e|0)!=0?(e|0)==((c[w>>2]|0)+1|0):0){q=b+76|0;a[q>>0]=a[q>>0]|1}c[b+24>>2]=(c[b+72>>2]|0)==0?(c[r>>2]|0)+-12|0:0;c[b+8>>2]=16;e=c[b+60>>2]|0;if((e|0)==-1){if((o>>>0>=(c[b+28>>2]|0)>>>0?o>>>0<(c[b+36>>2]|0)>>>0:0)?n>>>0>=(c[b+32>>2]|0)>>>0:0)e=(n>>>0>=(c[b+40>>2]|0)>>>0&1)<<2&255;else e=4;r=b+76|0;a[r>>0]=a[r>>0]&-5|e}else{r=b+76|0;a[r>>0]=((c[y>>2]|0)!=(e|0)&1)<<2&255|a[r>>0]&-5}k=b+196|0;e=c[k>>2]|0;if(!e){g=1;i=z;return g|0}j=c[y>>2]|0;e=c[e+40>>2]|0;c[e+(j*40|0)>>2]=j;c[e+(j*40|0)+12>>2]=c[w>>2];f=c[s>>2]|0;if(f){c[e+(j*40|0)+4>>2]=f;c[e+(j*40|0)+8>>2]=c[s>>2];e=c[e+(j*40|0)+16>>2]|0;if(!e){x=Qc(c[s>>2]|0,24)|0;c[(c[(c[k>>2]|0)+40>>2]|0)+((c[y>>2]|0)*40|0)+16>>2]=x;if(x){g=1;i=z;return g|0}Ub(g,1,15698,t)|0;g=0;i=z;return g|0}e=Tc(e,(c[s>>2]|0)*24|0)|0;f=(c[(c[k>>2]|0)+40>>2]|0)+((c[y>>2]|0)*40|0)+16|0;if(!e){Uc(c[f>>2]|0);c[(c[(c[k>>2]|0)+40>>2]|0)+((c[y>>2]|0)*40|0)+16>>2]=0;Ub(g,1,15698,v)|0;g=0;i=z;return g|0}else{c[f>>2]=e;g=1;i=z;return g|0}}if(!(c[e+(j*40|0)+16>>2]|0)){c[e+(j*40|0)+8>>2]=10;v=Qc(10,24)|0;f=c[y>>2]|0;e=c[(c[k>>2]|0)+40>>2]|0;c[e+(f*40|0)+16>>2]=v;if(!v){c[e+(f*40|0)+8>>2]=0;Ub(g,1,15698,u)|0;g=0;i=z;return g|0}else j=f}f=c[w>>2]|0;h=e+(j*40|0)+8|0;if(f>>>0<(c[h>>2]|0)>>>0){g=1;i=z;return g|0}f=f+1|0;c[h>>2]=f;e=Tc(c[e+(j*40|0)+16>>2]|0,f*24|0)|0;f=(c[(c[k>>2]|0)+40>>2]|0)+((c[y>>2]|0)*40|0)+16|0;if(!e){Uc(c[f>>2]|0);y=c[y>>2]|0;w=c[(c[k>>2]|0)+40>>2]|0;c[w+(y*40|0)+16>>2]=0;c[w+(y*40|0)+8>>2]=0;Ub(g,1,15698,x)|0;g=0;i=z;return g|0}else{c[f>>2]=e;g=1;i=z;return g|0}return 0}function ee(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+64|0;p=s+48|0;q=s+40|0;k=s+32|0;n=s+56|0;j=s+52|0;c[n>>2]=e;r=b+80|0;l=c[r>>2]|0;o=b+8|0;if((c[o>>2]|0)==16)m=(c[b+164>>2]|0)+((c[b+200>>2]|0)*5640|0)|0;else m=c[b+12>>2]|0;g=m+5636|0;h=a[g>>0]|0;if(h&1){Ub(f,1,15025,s)|0;r=0;i=s;return r|0}a[g>>0]=h|1;if(e>>>0<5){Ub(f,1,15089,s+8|0)|0;r=0;i=s;return r|0}qb(d,m,1);if((c[m>>2]|0)>>>0>7){Ub(f,1,15115,s+16|0)|0;r=0;i=s;return r|0}qb(d+1|0,j,1);j=c[j>>2]|0;g=m+4|0;c[g>>2]=j;if((j|0)>4){Ub(f,1,15149,s+24|0)|0;c[g>>2]=-1}g=m+8|0;qb(d+2|0,g,2);g=c[g>>2]|0;if((g+-1|0)>>>0>65534){c[k>>2]=g;Ub(f,1,15190,k)|0;r=0;i=s;return r|0}k=c[b+172>>2]|0;c[m+12>>2]=(k|0)==0?g:k;qb(d+4|0,m+16|0,1);k=d+5|0;c[n>>2]=e+-5;j=c[l+16>>2]|0;if(j){d=c[m>>2]&1;g=c[m+5584>>2]|0;h=0;do{c[g+(h*1080|0)>>2]=d;h=h+1|0}while(h>>>0>>0)}if(!(Fe(b,0,k,n,f)|0)){Ub(f,1,15089,q)|0;r=0;i=s;return r|0}if(c[n>>2]|0){Ub(f,1,15089,p)|0;r=0;i=s;return r|0}if((c[o>>2]|0)==16)g=(c[b+164>>2]|0)+((c[b+200>>2]|0)*5640|0)|0;else g=c[b+12>>2]|0;g=c[g+5584>>2]|0;e=g+4|0;h=c[e>>2]|0;m=h<<2;if((c[(c[r>>2]|0)+16>>2]|0)>>>0<=1){r=1;i=s;return r|0}n=g+8|0;o=g+12|0;b=g+16|0;f=g+20|0;p=g+812|0;q=g+944|0;c[g+1084>>2]=h;j=c[n>>2]|0;c[g+1088>>2]=j;d=c[o>>2]|0;c[g+1092>>2]=d;k=c[b>>2]|0;c[g+1096>>2]=k;l=c[f>>2]|0;c[g+1100>>2]=l;Ui(g+1892|0,p|0,m|0)|0;Ui(g+2024|0,q|0,m|0)|0;if((c[(c[r>>2]|0)+16>>2]|0)>>>0<=2){r=1;i=s;return r|0}c[g+2164>>2]=h;c[g+2168>>2]=j;c[g+2172>>2]=d;c[g+2176>>2]=k;c[g+2180>>2]=l;Ui(g+2972|0,p|0,m|0)|0;Ui(g+3104|0,q|0,m|0)|0;if((c[(c[r>>2]|0)+16>>2]|0)>>>0>3)h=3;else{r=1;i=s;return r|0}while(1){j=c[n>>2]|0;d=c[o>>2]|0;k=c[b>>2]|0;l=c[f>>2]|0;c[g+3244>>2]=c[e>>2];c[g+3248>>2]=j;c[g+3252>>2]=d;c[g+3256>>2]=k;c[g+3260>>2]=l;Ui(g+4052|0,p|0,m|0)|0;Ui(g+4184|0,q|0,m|0)|0;h=h+1|0;if(h>>>0>=(c[(c[r>>2]|0)+16>>2]|0)>>>0){g=1;break}else g=g+1080|0}i=s;return g|0}function lg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+272|0;n=u;s=u+136|0;t=u+8|0;if(!a){t=0;i=u;return t|0}m=a+4|0;if((c[a>>2]|0)==(b|0)?(c[m>>2]|0)==(d|0):0)f=a+8|0;else{c[a>>2]=b;c[m>>2]=d;c[s>>2]=b;c[t>>2]=d;f=a+8|0;c[f>>2]=0;g=0;j=d;k=b;l=0;while(1){r=_(j,k)|0;k=(k+1|0)/2|0;h=l+1|0;c[s+(h<<2)>>2]=k;j=(j+1|0)/2|0;c[t+(h<<2)>>2]=j;g=g+r|0;if(r>>>0<=1)break;else l=h}c[f>>2]=g;if(!g){f=a+12|0;g=c[f>>2]|0;if(g){Uc(g);c[f>>2]=0}Uc(a);t=0;i=u;return t|0}h=g<<4;j=a+16|0;k=a+12|0;do{if(h>>>0>(c[j>>2]|0)>>>0){g=Tc(c[k>>2]|0,h)|0;if(g){c[k>>2]=g;d=c[j>>2]|0;Qi(g+d|0,0,h-d|0)|0;c[j>>2]=h;d=c[m>>2]|0;b=c[a>>2]|0;break}Ub(e,1,20166,n)|0;f=c[k>>2]|0;if(f){Uc(f);c[k>>2]=0}Uc(a);t=0;i=u;return t|0}}while(0);g=c[k>>2]|0;b=g+((_(d,b)|0)<<4)|0;if(l){r=0;d=b;do{p=c[t+(r<<2)>>2]|0;a:do{if((p|0)>0){q=c[s+(r<<2)>>2]|0;if((q|0)<=0){h=p+-1|0;j=0;while(1){o=(j&1|0)!=0|(j|0)==(h|0);k=o?d:b+(q<<4)|0;d=o?d:b;j=j+1|0;if((j|0)>=(p|0)){b=k;break a}else b=k}}o=((q+2+((q|0)<2?~q:-3)|0)>>>1)+1|0;e=p+-1|0;n=0;while(1){m=q;k=d;while(1){c[g>>2]=k;h=g+16|0;j=m;m=m+-2|0;if((m|0)>-1){c[h>>2]=k;g=g+32|0}else g=h;if((j|0)<=2)break;else k=k+16|0}d=d+(o<<4)|0;m=(n&1|0)!=0|(n|0)==(e|0);h=m?d:b+(q<<4)|0;d=m?d:b;n=n+1|0;if((n|0)>=(p|0)){b=h;break}else b=h}}}while(0);r=r+1|0}while((r|0)!=(l|0))}c[g>>2]=0}f=c[f>>2]|0;if(!f){t=a;i=u;return t|0}g=0;b=c[a+12>>2]|0;while(1){c[b+4>>2]=999;c[b+8>>2]=0;c[b+12>>2]=0;g=g+1|0;if((g|0)==(f|0))break;else b=b+16|0}i=u;return a|0}function mg(a){a=a|0;var b=0,d=0;if(!a)return;b=a+12|0;d=c[b>>2]|0;if(d){Uc(d);c[b>>2]=0}Uc(a);return}function ng(a,b,d){a=a|0;b=b|0;d=d|0;b=(c[a+12>>2]|0)+(b<<4)|0;if(!b)return;while(1){a=b+4|0;if((c[a>>2]|0)<=(d|0)){b=4;break}c[a>>2]=d;b=c[b>>2]|0;if(!b){b=4;break}}if((b|0)==4)return}function og(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;k=i;i=i+128|0;j=k;d=(c[b+12>>2]|0)+(d<<4)|0;if(!(c[d>>2]|0)){f=0;g=j}else{f=d;b=j;while(1){g=b+4|0;c[b>>2]=d;d=c[f>>2]|0;if(!(c[d>>2]|0)){f=0;break}else{f=d;b=g}}}while(1){h=d+8|0;b=c[h>>2]|0;if((f|0)>(b|0)){c[h>>2]=f;b=f}a:do{if((b|0)<(e|0)){f=d+4|0;while(1){if((b|0)>=(c[f>>2]|0))break;Bg(a,0,1);b=b+1|0;if((b|0)>=(e|0)){d=b;break a}}d=d+12|0;if(!(c[d>>2]|0)){Bg(a,1,1);c[d>>2]=1;d=b}else d=b}else d=b}while(0);c[h>>2]=d;if((g|0)==(j|0))break;h=g+-4|0;f=d;d=c[h>>2]|0;g=h}i=k;return}function pg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0;k=i;i=i+128|0;j=k;d=(c[b+12>>2]|0)+(d<<4)|0;if(!(c[d>>2]|0)){b=0;g=j}else{f=d;b=j;while(1){g=b+4|0;c[b>>2]=d;d=c[f>>2]|0;if(!(c[d>>2]|0)){b=0;break}else{f=d;b=g}}}while(1){h=d+8|0;f=c[h>>2]|0;if((b|0)>(f|0))c[h>>2]=b;else b=f;d=d+4|0;a:do{if((b|0)<(e|0)){while(1){if((b|0)>=(c[d>>2]|0))break a;if(Cg(a,1)|0)break;b=b+1|0;if((b|0)>=(e|0))break a}c[d>>2]=b}}while(0);c[h>>2]=b;if((g|0)==(j|0))break;h=g+-4|0;d=c[h>>2]|0;g=h}i=k;return(c[d>>2]|0)<(e|0)|0}function qg(){var a=0,b=0;a=Qc(1,12)|0;if(!a){a=0;return a|0}c[a+4>>2]=10;b=Qc(10,4)|0;c[a+8>>2]=b;if(b){b=a;return b|0}Uc(a);b=0;return b|0}function rg(a){a=a|0;var b=0;if(!a)return;b=c[a+8>>2]|0;if(b)Uc(b);Uc(a);return}function sg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0;j=i;i=i+16|0;h=j;g=a+4|0;f=c[g>>2]|0;e=c[a>>2]|0;do{if((f|0)==(e|0)){f=f+10|0;c[g>>2]=f;e=a+8|0;f=Tc(c[e>>2]|0,f<<2)|0;if(f){c[e>>2]=f;e=c[a>>2]|0;break}Uc(c[e>>2]|0);c[g>>2]=0;c[a>>2]=0;Ub(d,1,20214,h)|0;a=0;i=j;return a|0}else f=c[a+8>>2]|0}while(0);c[f+(e<<2)>>2]=b;c[a>>2]=e+1;a=1;i=j;return a|0}function tg(a){a=a|0;return c[a>>2]|0}function ug(a){a=a|0;return c[a+8>>2]|0}function vg(a){a=a|0;c[a>>2]=0;return}function wg(){return Pc(20)|0}function xg(a){a=a|0;if(!a)return;Uc(a);return}function yg(a){a=a|0;return(c[a+8>>2]|0)-(c[a>>2]|0)|0}function zg(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=b;c[a+4>>2]=b+d;c[a+8>>2]=b;c[a+12>>2]=0;c[a+16>>2]=8;return}function Ag(a,b,d){a=a|0;b=b|0;d=d|0;c[a>>2]=b;c[a+4>>2]=b+d;c[a+8>>2]=b;c[a+12>>2]=0;c[a+16>>2]=0;return}function Bg(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;if(!e)return;k=b+16|0;l=b+12|0;m=b+8|0;h=b+4|0;b=c[k>>2]|0;j=e+-1|0;do{i=d>>>j&1;if(!b){g=c[l>>2]|0;b=g<<8&65280;c[l>>2]=b;b=(b|0)==65280?7:8;c[k>>2]=b;f=c[m>>2]|0;if(f>>>0<(c[h>>2]|0)>>>0){c[m>>2]=f+1;a[f>>0]=g;b=c[k>>2]|0}}b=b+-1|0;c[k>>2]=b;c[l>>2]=i<>2];j=j+-1|0}while(j>>>0>>0);return}function Cg(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(!b){b=0;return b|0}j=a+16|0;k=a+12|0;l=a+8|0;h=a+4|0;e=c[j>>2]|0;f=c[k>>2]|0;i=b+-1|0;a=0;do{if(!e){g=f<<8&65280;c[k>>2]=g;e=(g|0)==65280?7:8;c[j>>2]=e;f=c[l>>2]|0;if(f>>>0<(c[h>>2]|0)>>>0){c[l>>2]=f+1;f=d[f>>0]|0|g;c[k>>2]=f}else f=g}e=e+-1|0;c[j>>2]=e;a=((f>>>e&1)<>>0>>0);return a|0}function Dg(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;f=b+12|0;d=c[f>>2]|0;i=d<<8&65280;c[f>>2]=i;g=b+16|0;c[g>>2]=(i|0)==65280?7:8;i=b+8|0;e=c[i>>2]|0;h=b+4|0;if(e>>>0>=(c[h>>2]|0)>>>0){i=0;return i|0}c[i>>2]=e+1;a[e>>0]=d;if((c[g>>2]|0)!=7){i=1;return i|0}d=c[f>>2]|0;b=d<<8&65280;c[f>>2]=b;c[g>>2]=(b|0)==65280?7:8;b=c[i>>2]|0;if(b>>>0>=(c[h>>2]|0)>>>0){i=0;return i|0}c[i>>2]=b+1;a[b>>0]=d;i=1;return i|0}function Eg(a){a=a|0;var b=0,e=0,f=0,g=0,h=0;h=a+12|0;b=c[h>>2]|0;do{if((b&255|0)==255){f=b<<8&65280;c[h>>2]=f;b=a+16|0;c[b>>2]=(f|0)==65280?7:8;g=a+8|0;e=c[g>>2]|0;if(e>>>0<(c[a+4>>2]|0)>>>0){c[g>>2]=e+1;c[h>>2]=d[e>>0]|0|f;break}else{a=0;return a|0}}else b=a+16|0}while(0);c[b>>2]=0;a=1;return a|0}function Fg(a){a=a|0;return Pg(a,1)|0}function Gg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;D=i;i=i+32|0;B=D+16|0;C=D;k=c[a+24>>2]|0;j=(c[k+8>>2]|0)-(c[k>>2]|0)|0;h=(c[k+12>>2]|0)-(c[k+4>>2]|0)|0;A=(c[a+8>>2]|0)-(c[a>>2]|0)|0;if((b|0)==1){C=1;i=D;return C|0}g=b+-1|0;f=(g|0)==0;if(f)b=0;else{d=k;e=g;b=0;do{z=d;d=d+136|0;y=(c[z+144>>2]|0)-(c[d>>2]|0)|0;b=b>>>0>>0?y:b;z=(c[z+148>>2]|0)-(c[z+140>>2]|0)|0;b=b>>>0>>0?z:b;e=e+-1|0}while((e|0)!=0);b=b<<2}z=Rc(b)|0;c[B>>2]=z;if(!z){C=0;i=D;return C|0}c[C>>2]=z;if(!f){s=a+32|0;t=B+8|0;u=C+8|0;v=B+4|0;w=B+12|0;x=C+4|0;y=C+12|0;do{q=c[s>>2]|0;n=k;k=k+136|0;c[t>>2]=j;c[u>>2]=h;o=c[n+144>>2]|0;p=c[k>>2]|0;e=j;j=o-p|0;b=c[n+148>>2]|0;n=n+140|0;r=c[n>>2]|0;d=h;h=b-r|0;c[v>>2]=j-e;c[w>>2]=(p|0)%2|0;r=(b|0)==(r|0);if(!r){m=j<<2;b=0;while(1){a=_(b,A)|0;l=q+(a<<2)|0;if(e){d=l;f=z+(c[w>>2]<<2)|0;while(1){e=e+-1|0;c[f>>2]=c[d>>2];if(!e)break;else{d=d+4|0;f=f+8|0}}}d=c[v>>2]|0;if(d){e=q+((c[t>>2]|0)+a<<2)|0;f=z+(1-(c[w>>2]|0)<<2)|0;while(1){d=d+-1|0;c[f>>2]=c[e>>2];if(!d)break;else{e=e+4|0;f=f+8|0}}}Qg(B);Ui(l|0,z|0,m|0)|0;b=b+1|0;if((b|0)==(h|0))break;e=c[t>>2]|0}d=c[u>>2]|0;b=c[n>>2]|0}c[x>>2]=h-d;c[y>>2]=(b|0)%2|0;a:do{if((o|0)!=(p|0)){b=0;while(1){if(d){e=q+(b<<2)|0;f=z+(c[y>>2]<<2)|0;while(1){d=d+-1|0;c[f>>2]=c[e>>2];if(!d)break;else{e=e+(A<<2)|0;f=f+8|0}}}d=c[x>>2]|0;if(d){e=q+((_(c[u>>2]|0,A)|0)+b<<2)|0;f=z+(1-(c[y>>2]|0)<<2)|0;while(1){d=d+-1|0;c[f>>2]=c[e>>2];if(!d)break;else{e=e+(A<<2)|0;f=f+8|0}}}Qg(C);if(!r){d=0;do{c[q+((_(d,A)|0)+b<<2)>>2]=c[z+(d<<2)>>2];d=d+1|0}while((d|0)!=(h|0))}b=b+1|0;if((b|0)==(j|0))break a;d=c[u>>2]|0}}}while(0);g=g+-1|0}while((g|0)!=0)}Sc(z);C=1;i=D;return C|0}function Hg(a){a=a|0;if(!a){a=0;return a|0}a=(a+-1|0)>>>0<2?1:2;return a|0}function Ig(a,b){a=a|0;b=b|0;return+ +h[56+(b*80|0)+(a<<3)>>3]}function Jg(a){a=a|0;return Pg(a,2)|0}function Kg(a){a=a|0;return 0}function Lg(a,b){a=a|0;b=b|0;return+ +h[376+(b*80|0)+(a<<3)>>3]}function Mg(a,b){a=a|0;b=b|0;var d=0.0,e=0,f=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;k=a+4|0;l=((c[k>>2]|0)*3|0)+-2|0;if(!l)return;m=a+20|0;n=a+24|0;o=0;do{if(!o){e=0;f=0}else{f=o+-1|0;e=((f>>>0)/3|0)+1|0;f=((f>>>0)%3|0)+1|0}if((f|0)==0|(c[m>>2]|0)==0)g=0;else g=(f+-1|0)>>>0<2?1:2;if(!(c[n>>2]|0))d=1.0;else d=+(1<>2]|0)+~e<<3)>>3];j=~~+M(+(d*8192.0));i=g+b|0;if((j|0)>1){e=j;f=0;while(1){e=e>>1;if((e|0)<=1)break;else f=f+1|0}g=j;e=0;do{g=g>>1;e=e+1|0}while((g|0)>1);f=f+-12|0}else{f=-13;e=0}g=11-e|0;c[a+28+(o<<3)+4>>2]=((g|0)<0?j>>0-g:j<>2]=i-f;o=o+1|0}while((o|0)!=(l|0));return}function Ng(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;T=i;i=i+32|0;Q=T+16|0;R=T;m=c[a+24>>2]|0;n=c[m+8>>2]|0;o=c[m>>2]|0;k=c[m+12>>2]|0;l=c[m+4>>2]|0;P=a+8|0;h=c[P>>2]|0;j=c[a>>2]|0;O=h-j|0;g=b+-1|0;f=(g|0)==0;if(f)b=80;else{d=m;e=g;b=0;do{N=d;d=d+136|0;M=(c[N+144>>2]|0)-(c[d>>2]|0)|0;b=b>>>0>>0?M:b;N=(c[N+148>>2]|0)-(c[N+140>>2]|0)|0;b=b>>>0>>0?N:b;e=e+-1|0}while((e|0)!=0);b=(b<<4)+80|0}N=Rc(b)|0;c[Q>>2]=N;if(!N){S=0;i=T;return S|0}c[R>>2]=N;a:do{if(!f){y=a+32|0;z=a+12|0;A=a+4|0;B=Q+8|0;C=R+8|0;D=Q+4|0;E=Q+12|0;F=R+4|0;G=R+12|0;H=O<<1;I=O<<2;J=O*3|0;L=j<<2;M=h<<2;K=L-M|0;L=M-L|0;M=h-j<<2;b=g;d=N;g=h;e=j;r=k-l|0;f=m;h=n-o|0;while(1){s=c[y>>2]|0;e=_((c[z>>2]|0)-(c[A>>2]|0)|0,g-e|0)|0;c[B>>2]=h;c[C>>2]=r;w=f+136|0;p=c[f+144>>2]|0;q=c[w>>2]|0;x=p-q|0;u=c[f+148>>2]|0;n=f+140|0;t=c[n>>2]|0;v=u-t|0;c[D>>2]=x-h;c[E>>2]=(q|0)%2|0;if((v|0)>3){g=(x|0)>0;h=(u+-4-t|0)>>>2;m=_(K,h)|0;h=s+(L+(_(M,h)|0)<<2)|0;j=s;k=e;l=v;while(1){Sg(Q,j,O,k);Tg(Q);if(g){f=x;do{o=f;f=f+-1|0;c[j+(f<<2)>>2]=c[N+(f<<4)>>2];c[j+(f+O<<2)>>2]=c[N+(f<<4)+4>>2];c[j+(f+H<<2)>>2]=c[N+(f<<4)+8>>2];c[j+(f+J<<2)>>2]=c[N+(f<<4)+12>>2]}while((o|0)>1)}l=l+-4|0;if((l|0)<=3)break;else{j=j+(I<<2)|0;k=k-I|0}}e=K+e+m|0}else h=s;g=v&3;b:do{if(!g)S=21;else{Sg(Q,h,O,e);Tg(Q);if((x|0)>0)e=x;else{k=v-r|0;c[F>>2]=k;g=(c[n>>2]|0)%2|0;c[G>>2]=g;l=r;j=s;break}while(1){f=e;e=e+-1|0;switch(g|0){case 3:{c[h+(e+H<<2)>>2]=c[N+(e<<4)+8>>2];S=18;break}case 2:{S=18;break}case 1:{S=19;break}default:{}}if((S|0)==18){c[h+(e+O<<2)>>2]=c[N+(e<<4)+4>>2];S=19}if((S|0)==19){S=0;c[h+(e<<2)>>2]=c[N+(e<<4)>>2]}if((f|0)<=1){S=21;break b}}}}while(0);if((S|0)==21){S=0;k=v-r|0;c[F>>2]=k;g=(c[n>>2]|0)%2|0;c[G>>2]=g;if((x|0)>3){o=(u|0)==(t|0);p=p+-4-q|0;n=c[C>>2]|0;l=(n|0)>0;j=1-g|0;m=(k|0)>0;f=s;h=x;while(1){if(l){e=0;do{r=d+((e<<1)+g<<4)|0;q=f+((_(e,O)|0)<<2)|0;c[r>>2]=c[q>>2];c[r+4>>2]=c[q+4>>2];c[r+8>>2]=c[q+8>>2];c[r+12>>2]=c[q+12>>2];e=e+1|0}while((e|0)!=(n|0))}if(m){e=0;do{r=d+(j+(e<<1)<<4)|0;q=f+((_(e+n|0,O)|0)<<2)|0;c[r>>2]=c[q>>2];c[r+4>>2]=c[q+4>>2];c[r+8>>2]=c[q+8>>2];c[r+12>>2]=c[q+12>>2];e=e+1|0}while((e|0)!=(k|0))}Tg(R);if(!o){d=c[R>>2]|0;e=0;do{r=f+((_(e,O)|0)<<2)|0;q=d+(e<<4)|0;c[r>>2]=c[q>>2];c[r+4>>2]=c[q+4>>2];c[r+8>>2]=c[q+8>>2];c[r+12>>2]=c[q+12>>2];e=e+1|0}while((e|0)!=(v|0))}h=h+-4|0;if((h|0)<=3)break;else f=f+16|0}l=n;j=s+((p+4&-4)<<2)|0}else{l=r;j=s}}h=x&3;if(h){d=c[R>>2]|0;if((l|0)>0){e=h<<2;f=0;do{Ui(d+((f<<1)+g<<4)|0,j+((_(f,O)|0)<<2)|0,e|0)|0;f=f+1|0}while((f|0)!=(l|0))}e=1-g|0;if((k|0)>0){f=h<<2;g=0;do{Ui(d+(e+(g<<1)<<4)|0,j+((_(g+l|0,O)|0)<<2)|0,f|0)|0;g=g+1|0}while((g|0)!=(k|0))}Tg(R);if((u|0)!=(t|0)){e=h<<2;f=0;do{Ui(j+((_(f,O)|0)<<2)|0,d+(f<<4)|0,e|0)|0;f=f+1|0}while((f|0)!=(v|0))}}b=b+-1|0;if(!b)break a;g=c[P>>2]|0;e=c[a>>2]|0;r=v;f=w;h=x}}}while(0);Sc(N);S=1;i=T;return S|0}function Og(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;if(!e){e=(b|0)>0;if(!(e|(d|0)>1))return;if(e){e=a+((d<<1)+-2<<2)|0;f=0;do{j=f;f=f+1|0;k=a+((j<<1|1)<<2)|0;c[k>>2]=(c[k>>2]|0)-((c[((f|0)<(d|0)?a+(f<<1<<2)|0:e)>>2]|0)+(c[((j|0)<(d|0)?a+(j<<1<<2)|0:e)>>2]|0)>>1)}while((f|0)!=(b|0))}if((d|0)<=0)return;f=a+4|0;g=(b<<1)+-1|0;h=0;do{if((h|0)<1)e=f;else e=a+((((h|0)>(b|0)?b:h)<<1)+-1<<2)|0;k=a+(h<<1<<2)|0;c[k>>2]=((c[e>>2]|0)+2+(c[a+(((h|0)<(b|0)?h<<1|1:g)<<2)>>2]|0)>>2)+(c[k>>2]|0);h=h+1|0}while((h|0)!=(d|0));return}if((b|0)==1&(d|0)==0){c[a>>2]=c[a>>2]<<1;return}if((b|0)>0){f=a+4|0;g=(d<<1)+-1|0;h=a+(g<<2)|0;k=0;do{i=k<<1;j=c[a+(((k|0)<(d|0)?i|1:g)<<2)>>2]|0;if((k|0)>=1)if((k|0)>(d|0))e=h;else e=a+(i+-1<<2)|0;else e=f;i=a+(i<<2)|0;c[i>>2]=(c[i>>2]|0)-((c[e>>2]|0)+j>>1);k=k+1|0}while((k|0)!=(b|0))}if((d|0)<=0)return;e=a+((b<<1)+-2<<2)|0;f=0;do{j=f;f=f+1|0;k=a+((j<<1|1)<<2)|0;c[k>>2]=((c[((j|0)<(b|0)?a+(j<<1<<2)|0:e)>>2]|0)+2+(c[((f|0)<(b|0)?a+(f<<1<<2)|0:e)>>2]|0)>>2)+(c[k>>2]|0)}while((f|0)!=(d|0));return}function Pg(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;w=(c[a+8>>2]|0)-(c[a>>2]|0)|0;g=c[a+16>>2]|0;i=g+-1|0;x=c[a+32>>2]|0;h=c[a+24>>2]|0;f=(i|0)==0;if(f)a=0;else{d=h;e=i;a=0;do{v=d;d=d+136|0;u=(c[v+144>>2]|0)-(c[d>>2]|0)|0;a=a>>>0>>0?u:a;v=(c[v+148>>2]|0)-(c[v+140>>2]|0)|0;a=a>>>0>>0?v:a;e=e+-1|0}while((e|0)!=0);a=a<<2}v=Pc(a)|0;if(!((a|0)==0|(v|0)!=0)){b=0;return b|0}if(!f){t=g+-2|0;u=t;a=h+(i*136|0)|0;t=h+(t*136|0)|0;while(1){q=c[a>>2]|0;s=(c[a+8>>2]|0)-q|0;m=c[a+4>>2]|0;o=(c[a+12>>2]|0)-m|0;p=(c[t+8>>2]|0)-(c[t>>2]|0)|0;a=c[t+12>>2]|0;d=c[t+4>>2]|0;l=a-d|0;q=q&1;m=m&1;n=o-l|0;r=(s|0)>0;a:do{if(r){f=(a|0)==(d|0);i=(o|0)==(l|0);j=v+((m^1)<<2)|0;k=_(l,w)|0;h=v+(m<<2)|0;if((o|0)>0){g=0;while(1){d=x+(g<<2)|0;a=0;do{c[v+(a<<2)>>2]=c[x+((_(a,w)|0)+g<<2)>>2];a=a+1|0}while((a|0)!=(o|0));ab[b&3](v,n,l,m);if(!f){e=l;a=h;while(1){e=e+-1|0;c[d>>2]=c[a>>2];if(!e)break;else{d=d+(w<<2)|0;a=a+8|0}}}if(!i){a=n;d=x+(g+k<<2)|0;e=j;while(1){a=a+-1|0;c[d>>2]=c[e>>2];if(!a)break;else{d=d+(w<<2)|0;e=e+8|0}}}g=g+1|0;if((g|0)==(s|0))break a}}if(f){d=0;while(1){ab[b&3](v,n,l,m);if(!i){a=n;e=x+(d+k<<2)|0;f=j;while(1){a=a+-1|0;c[e>>2]=c[f>>2];if(!a)break;else{e=e+(w<<2)|0;f=f+8|0}}}d=d+1|0;if((d|0)==(s|0))break a}}else f=0;do{ab[b&3](v,n,l,m);a=l;d=x+(f<<2)|0;e=h;while(1){a=a+-1|0;c[d>>2]=c[e>>2];if(!a)break;else{d=d+(w<<2)|0;e=e+8|0}}if(!i){a=n;d=x+(f+k<<2)|0;e=j;while(1){a=a+-1|0;c[d>>2]=c[e>>2];if(!a)break;else{d=d+(w<<2)|0;e=e+8|0}}}f=f+1|0}while((f|0)!=(s|0))}}while(0);g=s-p|0;if((o|0)>0){h=(p|0)>0;i=v+(q<<2)|0;j=(g|0)>0;k=v+((q^1)<<2)|0;l=0;do{f=_(l,w)|0;d=x+(f<<2)|0;if(r){a=0;do{c[v+(a<<2)>>2]=c[x+(a+f<<2)>>2];a=a+1|0}while((a|0)!=(s|0))}ab[b&3](v,g,p,q);if(h){e=0;a=i;while(1){c[d>>2]=c[a>>2];e=e+1|0;if((e|0)==(p|0))break;else{d=d+4|0;a=a+8|0}}}if(j){e=0;a=x+(f+p<<2)|0;d=k;while(1){c[a>>2]=c[d>>2];e=e+1|0;if((e|0)==(g|0))break;else{a=a+4|0;d=d+8|0}}}l=l+1|0}while((l|0)!=(o|0))}if(!u)break;else{a=t;u=u+-1|0;t=t+-136|0}}}Uc(v);b=1;return b|0}function Qg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=c[a>>2]|0;j=c[a+4>>2]|0;k=c[a+8>>2]|0;if(!(c[a+12>>2]|0)){e=(j|0)>0;if(!(e|(k|0)>1))return;if((k|0)>0){b=i+4|0;d=(j<<1)+-1|0;f=0;do{if((f|0)<1)a=b;else a=i+((((f|0)>(j|0)?j:f)<<1)+-1<<2)|0;g=f<<1;h=i+(g<<2)|0;c[h>>2]=(c[h>>2]|0)-((c[a>>2]|0)+2+(c[i+(((f|0)<(j|0)?g|1:d)<<2)>>2]|0)>>2);f=f+1|0}while((f|0)!=(k|0))}if(!e)return;a=i+((k<<1)+-2<<2)|0;b=0;do{g=b<<1;f=b;b=b+1|0;h=i+((g|1)<<2)|0;c[h>>2]=((c[((b|0)<(k|0)?i+(b<<1<<2)|0:a)>>2]|0)+(c[((f|0)<(k|0)?i+(g<<2)|0:a)>>2]|0)>>1)+(c[h>>2]|0)}while((b|0)!=(j|0));return}if((j|0)==1&(k|0)==0){c[i>>2]=(c[i>>2]|0)/2|0;return}if((k|0)>0){a=i+((j<<1)+-2<<2)|0;b=0;do{g=b<<1;f=b;b=b+1|0;h=i+((g|1)<<2)|0;c[h>>2]=(c[h>>2]|0)-((c[((f|0)<(j|0)?i+(g<<2)|0:a)>>2]|0)+2+(c[((b|0)<(j|0)?i+(b<<1<<2)|0:a)>>2]|0)>>2)}while((b|0)!=(k|0))}if((j|0)<=0)return;b=i+4|0;d=(k<<1)+-1|0;e=i+(d<<2)|0;h=0;do{f=h<<1;g=c[i+(((h|0)<(k|0)?f|1:d)<<2)>>2]|0;if((h|0)>=1)if((h|0)>(k|0))a=e;else a=i+(f+-1<<2)|0;else a=b;f=i+(f<<2)|0;c[f>>2]=((c[a>>2]|0)+g>>1)+(c[f>>2]|0);h=h+1|0}while((h|0)!=(j|0));return}function Rg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;if(!e){j=(b|0)>0;if(!(j|(d|0)>1))return;if(j){e=a+((d<<1)+-2<<2)|0;f=0;do{m=f;f=f+1|0;l=(c[((f|0)<(d|0)?a+(f<<1<<2)|0:e)>>2]|0)+(c[((m|0)<(d|0)?a+(m<<1<<2)|0:e)>>2]|0)|0;l=Zi(l|0,((l|0)<0)<<31>>31|0,12993,0)|0;l=Si(l|0,C|0,4096,0)|0;l=Ti(l|0,C|0,13)|0;m=a+((m<<1|1)<<2)|0;c[m>>2]=(c[m>>2]|0)-l}while((f|0)!=(b|0))}i=(d|0)>0;if(i){f=a+4|0;g=(b<<1)+-1|0;h=0;do{if((h|0)<1)e=f;else e=a+((((h|0)>(b|0)?b:h)<<1)+-1<<2)|0;l=(c[a+(((h|0)<(b|0)?h<<1|1:g)<<2)>>2]|0)+(c[e>>2]|0)|0;l=Zi(l|0,((l|0)<0)<<31>>31|0,434,0)|0;l=Si(l|0,C|0,4096,0)|0;l=Ti(l|0,C|0,13)|0;m=a+(h<<1<<2)|0;c[m>>2]=(c[m>>2]|0)-l;h=h+1|0}while((h|0)!=(d|0))}if(j){e=a+((d<<1)+-2<<2)|0;f=0;do{m=f;f=f+1|0;l=(c[((f|0)<(d|0)?a+(f<<1<<2)|0:e)>>2]|0)+(c[((m|0)<(d|0)?a+(m<<1<<2)|0:e)>>2]|0)|0;l=Zi(l|0,((l|0)<0)<<31>>31|0,7233,0)|0;l=Si(l|0,C|0,4096,0)|0;l=Ti(l|0,C|0,13)|0;m=a+((m<<1|1)<<2)|0;c[m>>2]=l+(c[m>>2]|0)}while((f|0)!=(b|0))}if(i){f=a+4|0;g=(b<<1)+-1|0;h=0;do{if((h|0)<1)e=f;else e=a+((((h|0)>(b|0)?b:h)<<1)+-1<<2)|0;l=(c[a+(((h|0)<(b|0)?h<<1|1:g)<<2)>>2]|0)+(c[e>>2]|0)|0;l=Zi(l|0,((l|0)<0)<<31>>31|0,3633,0)|0;l=Si(l|0,C|0,4096,0)|0;l=Ti(l|0,C|0,13)|0;m=a+(h<<1<<2)|0;c[m>>2]=l+(c[m>>2]|0);h=h+1|0}while((h|0)!=(d|0))}if(j){e=0;do{m=a+((e<<1|1)<<2)|0;l=c[m>>2]|0;l=Zi(l|0,((l|0)<0)<<31>>31|0,5038,0)|0;l=Si(l|0,C|0,4096,0)|0;l=Ti(l|0,C|0,13)|0;c[m>>2]=l;e=e+1|0}while((e|0)!=(b|0))}if(i)e=0;else return;do{b=a+(e<<1<<2)|0;m=c[b>>2]|0;m=Zi(m|0,((m|0)<0)<<31>>31|0,6659,0)|0;m=Si(m|0,C|0,4096,0)|0;m=Ti(m|0,C|0,13)|0;c[b>>2]=m;e=e+1|0}while((e|0)!=(d|0));return}m=(d|0)>0;if(!((b|0)>1|m))return;l=(b|0)>0;if(l){f=a+4|0;g=(d<<1)+-1|0;h=a+(g<<2)|0;k=0;do{i=k<<1;j=c[a+(((k|0)<(d|0)?i|1:g)<<2)>>2]|0;if((k|0)>=1)if((k|0)>(d|0))e=h;else e=a+(i+-1<<2)|0;else e=f;e=(c[e>>2]|0)+j|0;e=Zi(e|0,((e|0)<0)<<31>>31|0,12993,0)|0;e=Si(e|0,C|0,4096,0)|0;e=Ti(e|0,C|0,13)|0;j=a+(i<<2)|0;c[j>>2]=(c[j>>2]|0)-e;k=k+1|0}while((k|0)!=(b|0))}if(m){e=a+((b<<1)+-2<<2)|0;f=0;do{k=f;f=f+1|0;j=(c[((f|0)<(b|0)?a+(f<<1<<2)|0:e)>>2]|0)+(c[((k|0)<(b|0)?a+(k<<1<<2)|0:e)>>2]|0)|0;j=Zi(j|0,((j|0)<0)<<31>>31|0,434,0)|0;j=Si(j|0,C|0,4096,0)|0;j=Ti(j|0,C|0,13)|0;k=a+((k<<1|1)<<2)|0;c[k>>2]=(c[k>>2]|0)-j}while((f|0)!=(d|0))}if(l){f=a+4|0;g=(d<<1)+-1|0;h=a+(g<<2)|0;k=0;do{i=k<<1;j=c[a+(((k|0)<(d|0)?i|1:g)<<2)>>2]|0;if((k|0)>=1)if((k|0)>(d|0))e=h;else e=a+(i+-1<<2)|0;else e=f;e=(c[e>>2]|0)+j|0;e=Zi(e|0,((e|0)<0)<<31>>31|0,7233,0)|0;e=Si(e|0,C|0,4096,0)|0;e=Ti(e|0,C|0,13)|0;j=a+(i<<2)|0;c[j>>2]=e+(c[j>>2]|0);k=k+1|0}while((k|0)!=(b|0))}if(m){e=a+((b<<1)+-2<<2)|0;f=0;do{k=f;f=f+1|0;j=(c[((f|0)<(b|0)?a+(f<<1<<2)|0:e)>>2]|0)+(c[((k|0)<(b|0)?a+(k<<1<<2)|0:e)>>2]|0)|0;j=Zi(j|0,((j|0)<0)<<31>>31|0,3633,0)|0;j=Si(j|0,C|0,4096,0)|0;j=Ti(j|0,C|0,13)|0;k=a+((k<<1|1)<<2)|0;c[k>>2]=j+(c[k>>2]|0)}while((f|0)!=(d|0))}if(l){e=0;do{l=a+(e<<1<<2)|0;k=c[l>>2]|0;k=Zi(k|0,((k|0)<0)<<31>>31|0,5038,0)|0;k=Si(k|0,C|0,4096,0)|0;k=Ti(k|0,C|0,13)|0;c[l>>2]=k;e=e+1|0}while((e|0)!=(b|0))}if(m)e=0;else return;do{b=a+((e<<1|1)<<2)|0;m=c[b>>2]|0;m=Zi(m|0,((m|0)<0)<<31>>31|0,6659,0)|0;m=Si(m|0,C|0,4096,0)|0;m=Ti(m|0,C|0,13)|0;c[b>>2]=m;e=e+1|0}while((e|0)!=(d|0));return}function Sg(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;m=c[a>>2]|0;i=c[a+12>>2]|0;q=c[a+8>>2]|0;n=d*3|0;l=1-i|0;k=a+4|0;j=q;a=0;while(1){h=m+(i<<4)|0;if(((j+n|0)<(e|0)?(b&15|0)==0:0)?((h|d)&15|0)==0:0){if((j|0)>0){f=0;do{h=f<<3;c[m+(i<<4)+(h<<2)>>2]=c[b+(f<<2)>>2];g=f+d|0;c[m+(i<<4)+((h|1)<<2)>>2]=c[b+(g<<2)>>2];g=g+d|0;c[m+(i<<4)+((h|2)<<2)>>2]=c[b+(g<<2)>>2];c[m+(i<<4)+((h|3)<<2)>>2]=c[b+(g+d<<2)>>2];f=f+1|0}while((f|0)!=(j|0))}}else r=3;if((r|0)==3?(r=0,(j|0)>0):0){h=0;do{f=h<<3;c[m+(i<<4)+(f<<2)>>2]=c[b+(h<<2)>>2];g=h+d|0;if(((g|0)<(e|0)?(c[m+(i<<4)+((f|1)<<2)>>2]=c[b+(g<<2)>>2],o=g+d|0,(o|0)<(e|0)):0)?(c[m+(i<<4)+((f|2)<<2)>>2]=c[b+(o<<2)>>2],p=o+d|0,(p|0)<(e|0)):0)c[m+(i<<4)+((f|3)<<2)>>2]=c[b+(p<<2)>>2];h=h+1|0}while((h|0)!=(j|0))}a=a+1|0;if((a|0)==2)break;else{b=b+(q<<2)|0;e=e-q|0;i=l;j=c[k>>2]|0}}return}function Tg(a){a=a|0;var b=0,d=0,e=0,f=0,h=0,i=0,j=0,k=0.0,l=0.0,m=0,n=0.0,o=0,p=0;do{if(!(c[a+12>>2]|0)){d=c[a+8>>2]|0;if((c[a+4>>2]|0)>0){b=c[a>>2]|0;if((d|0)>0){i=0;f=1;j=9;break}else{i=0;h=1;break}}if((d|0)>1){e=0;f=1;j=7}else return}else{d=c[a+8>>2]|0;if((d|0)<=0)if((c[a+4>>2]|0)>1){b=c[a>>2]|0;i=1;h=0;break}else return;else{e=1;f=0;j=7}}}while(0);if((j|0)==7){b=c[a>>2]|0;i=e;j=9}if((j|0)==9){e=0;do{j=e<<3;o=b+(i<<4)+(j<<2)|0;m=b+(i<<4)+((j|1)<<2)|0;n=+g[m>>2];h=b+(i<<4)+((j|2)<<2)|0;l=+g[h>>2];j=b+(i<<4)+((j|3)<<2)|0;k=+g[j>>2];g[o>>2]=+g[o>>2]*1.2301740646362305;g[m>>2]=n*1.2301740646362305;g[h>>2]=l*1.2301740646362305;g[j>>2]=k*1.2301740646362305;e=e+1|0}while((e|0)!=(d|0));h=f}e=c[a+4>>2]|0;if((e|0)>0){f=0;do{o=f<<3;j=b+(h<<4)+(o<<2)|0;a=b+(h<<4)+((o|1)<<2)|0;k=+g[a>>2];m=b+(h<<4)+((o|2)<<2)|0;l=+g[m>>2];o=b+(h<<4)+((o|3)<<2)|0;n=+g[o>>2];g[j>>2]=+g[j>>2]*1.625732421875;g[a>>2]=k*1.625732421875;g[m>>2]=l*1.625732421875;g[o>>2]=n*1.625732421875;f=f+1|0}while((f|0)!=(e|0))}p=b+(h<<4)|0;f=b+(i+1<<4)|0;j=e-i|0;j=(d|0)<(j|0)?d:j;Ug(p,f,d,j,-.4435068666934967);a=b+(i<<4)|0;m=b+(h+1<<4)|0;o=d-h|0;o=(e|0)<(o|0)?e:o;Ug(a,m,e,o,-.8829110860824585);Ug(p,f,d,j,.05298011749982834);Ug(a,m,e,o,1.5861343145370483);return}function Ug(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=+e;var f=0.0,h=0.0,i=0.0,j=0.0,k=0,l=0,m=0,n=0,o=0.0,p=0.0,q=0,r=0.0,s=0.0,t=0,u=0.0,v=0.0,w=0,x=0.0;if((d|0)>0){m=d<<1;l=m+-2|0;h=+g[a>>2];i=+g[a+4>>2];j=+g[a+8>>2];f=+g[a+12>>2];a=b;k=0;while(1){w=a+-16|0;t=a+-12|0;v=+g[t>>2];q=a+-8|0;s=+g[q>>2];n=a+-4|0;p=+g[n>>2];x=h;h=+g[a>>2];u=i;i=+g[a+4>>2];r=j;j=+g[a+8>>2];o=f;f=+g[a+12>>2];g[w>>2]=+g[w>>2]+(x+h)*e;g[t>>2]=v+(u+i)*e;g[q>>2]=s+(r+j)*e;g[n>>2]=p+(o+f)*e;k=k+1|0;if((k|0)==(d|0))break;else a=a+32|0}a=b+(l<<4)|0;b=b+(m<<4)|0}if((d|0)>=(c|0))return;f=e+e;h=f*+g[a>>2];i=f*+g[a+4>>2];j=f*+g[a+8>>2];f=f*+g[a+12>>2];while(1){n=b+-16|0;q=b+-12|0;u=+g[q>>2];t=b+-8|0;v=+g[t>>2];w=b+-4|0;x=+g[w>>2];g[n>>2]=h+ +g[n>>2];g[q>>2]=i+u;g[t>>2]=j+v;g[w>>2]=f+x;d=d+1|0;if((d|0)==(c|0))break;else b=b+32|0}return}function Vg(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0.0,i=0,j=0,k=0,l=0,m=0,n=0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;x=d<<2;y=Pc(d<<4)|0;if(!y){a=0;return a|0}z=y+x|0;Qi(y|0,0,x|0)|0;v=d+-1|0;u=(d|0)==0;if(!u){e=0;f=y;while(1){c[f>>2]=e;e=e+1|0;if((e|0)==(d|0))break;else f=f+4|0}}a:do{if(v){q=v;j=0;e=0;r=a;s=1;t=y;while(1){k=r+(j<<2)|0;if(j>>>0>>0){i=j;f=k;h=0.0}else break;while(1){o=+g[f>>2];o=o>0.0?o:-o;w=o>h;e=w?i:e;h=w?o:h;i=i+1|0;if((i|0)==(d|0))break;else f=f+(d<<2)|0}if(h==0.0)break;if((e|0)!=(j|0)){w=e-j|0;p=t+(w<<2)|0;n=c[t>>2]|0;c[t>>2]=c[p>>2];c[p>>2]=n;w=r+((_(w,d)|0)<<2)|0;Ui(z|0,w|0,x|0)|0;Ui(w|0,r|0,x|0)|0;Ui(r|0,z|0,x|0)|0}f=j;p=j+1|0;o=+g[k>>2];if(s>>>0>>0){l=r+(p<<2)|0;n=p+q|0;m=s;i=r+(f+d<<2)|0;while(1){h=+g[i>>2]/o;g[i>>2]=h;f=s;j=i;k=l;while(1){j=j+4|0;g[j>>2]=+g[j>>2]-h*+g[k>>2];f=f+1|0;if((f|0)==(d|0))break;else k=k+4|0}m=m+1|0;if((m|0)==(d|0))break;else i=i+(n<<2)|0}}if(p>>>0>>0){q=q+-1|0;j=p;r=r+(d<<2)|0;s=s+1|0;t=t+4|0}else break a}Uc(y);a=0;return a|0}}while(0);e=d<<1;w=z+(e<<2)|0;if(!u){u=z+(v+d<<2)|0;q=z+(e+v<<2)|0;r=a+((_(d,d)|0)+-1<<2)|0;s=~d;t=0;p=b;while(1){Qi(z|0,0,x|0)|0;g[z+(t<<2)>>2]=1.0;j=0;k=1;l=y;m=w;n=a;while(1){if(!j)h=0.0;else{e=1;f=w;i=n;h=0.0;while(1){h=h+ +g[i>>2]*+g[f>>2];e=e+1|0;if((e|0)==(k|0))break;else{f=f+4|0;i=i+4|0}}}g[m>>2]=+g[z+(c[l>>2]<<2)>>2]-h;j=j+1|0;if((j|0)==(d|0)){j=d;k=u;l=w;m=q;n=r;break}else{k=k+1|0;l=l+4|0;m=m+4|0;n=n+(d<<2)|0}}while(1){e=j;j=j+-1|0;o=+g[n>>2];if(e>>>0>>0){f=l;i=n;h=0.0;while(1){i=i+4|0;h=h+ +g[i>>2]*+g[f>>2];e=e+1|0;if((e|0)==(d|0))break;else f=f+4|0}}else h=0.0;l=l+-4|0;g[k>>2]=(+g[m>>2]-h)/o;if(!j){e=0;f=p;break}else{k=k+-4|0;m=m+-4|0;n=n+(s<<2)|0}}while(1){c[f>>2]=c[z+(e+d<<2)>>2];e=e+1|0;if((e|0)==(d|0))break;else f=f+(d<<2)|0}t=t+1|0;if((t|0)==(d|0))break;else p=p+4|0}}Uc(y);a=1;return a|0}function Wg(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;g=Qc(1,44)|0;if(!g){g=0;return g|0}h=hh()|0;c[g>>2]=h;if(!h){ih(0);c[g>>2]=0;h=g+4|0;yh(c[h>>2]|0);c[h>>2]=0;if((c[g+40>>2]|0)==0?(d=g+8|0,b=c[d>>2]|0,(b|0)!=0):0){Sc(b);c[d>>2]=0}b=g+12|0;d=c[b>>2]|0;if(d){Sc(d);c[b>>2]=0}Uc(g);h=0;return h|0}h=xh()|0;b=g+4|0;c[b>>2]=h;if(h){c[g+40>>2]=a;h=g;return h|0}ih(c[g>>2]|0);c[g>>2]=0;yh(c[b>>2]|0);c[b>>2]=0;if((c[g+40>>2]|0)==0?(e=g+8|0,f=c[e>>2]|0,(f|0)!=0):0){Sc(f);c[e>>2]=0}b=g+12|0;d=c[b>>2]|0;if(d){Sc(d);c[b>>2]=0}Uc(g);h=0;return h|0}function Xg(a){a=a|0;var b=0,d=0,e=0;if(!a)return;ih(c[a>>2]|0);c[a>>2]=0;e=a+4|0;yh(c[e>>2]|0);c[e>>2]=0;if((c[a+40>>2]|0)==0?(b=a+8|0,d=c[b>>2]|0,(d|0)!=0):0){Sc(d);c[b>>2]=0}b=a+12|0;d=c[b>>2]|0;if(d){Sc(d);c[b>>2]=0}Uc(a);return}function Yg(a,f,h){a=a|0;f=f|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0;ya=(c[f+8>>2]|0)-(c[f>>2]|0)|0;za=f+20|0;i=c[za>>2]|0;if(!i){a=1;return a|0}Aa=f+24|0;Ba=h+808|0;Ca=h+16|0;ta=a+4|0;va=a+8|0;wa=a+16|0;xa=a+20|0;sa=h+20|0;pa=f+32|0;qa=a+32|0;ra=a+12|0;h=i;oa=0;a:while(1){ma=c[Aa>>2]|0;na=ma+(oa*136|0)+24|0;f=c[na>>2]|0;if(f){ja=ma+(oa*136|0)+16|0;ka=ma+(oa*136|0)+20|0;la=oa+-1|0;h=c[ka>>2]|0;i=c[ja>>2]|0;ia=0;do{if(_(h,i)|0){da=ma+(oa*136|0)+28+(ia*36|0)+20|0;ea=ma+(oa*136|0)+28+(ia*36|0)+16|0;fa=ma+(oa*136|0)+28+(ia*36|0)|0;ga=ma+(oa*136|0)+28+(ia*36|0)+4|0;ha=ma+(oa*136|0)+28+(ia*36|0)+32|0;ca=0;do{f=c[da>>2]|0;aa=f+(ca*40|0)+16|0;ba=f+(ca*40|0)+20|0;if(_(c[ba>>2]|0,c[aa>>2]|0)|0){Z=f+(ca*40|0)+24|0;$=0;do{h=c[Z>>2]|0;S=c[ea>>2]|0;j=c[Ba>>2]|0;f=c[Ca>>2]|0;T=c[ta>>2]|0;U=c[a>>2]|0;V=h+($*56|0)+8|0;Y=h+($*56|0)+12|0;if(!(_g(a,(c[h+($*56|0)+16>>2]|0)-(c[V>>2]|0)|0,(c[h+($*56|0)+20>>2]|0)-(c[Y>>2]|0)|0)|0)){h=0;G=201;break a}W=h+($*56|0)+24|0;k=c[W>>2]|0;qh(U);rh(U,18,0,46);rh(U,17,0,3);rh(U,0,0,4);X=h+($*56|0)+48|0;i=c[X>>2]|0;if(i){N=h+($*56|0)+4|0;O=(f&1|0)!=0;P=(f&2|0)==0;Q=(f&8|0)==0;R=S<<8;M=(f&32|0)==0;f=k+j|0;h=2;L=0;do{k=c[N>>2]|0;K=O&(h>>>0<2?(f|0)<=((c[W>>2]|0)+-4|0):0);j=c[k+(L<<5)>>2]|0;if(j){i=(c[j>>2]|0)+(c[k+(L<<5)+4>>2]|0)|0;j=c[k+(L<<5)+16>>2]|0;if(!K){if(!(vh(U,i,j)|0)){h=0;G=201;break a}}else zh(T,i,j);I=k+(L<<5)+12|0;b:do{if(c[I>>2]|0){J=P|K;H=0;while(1){c:do{switch(h|0){case 0:{if(K){w=1<>1|w;j=c[xa>>2]|0;if(!j)break c;v=0-w|0;i=c[wa>>2]|0;u=0;while(1){t=u;u=u+4|0;if(!i)i=0;else{q=(t|0)==-4;r=t|3;s=0;do{d:do{if(!q)if(Q){o=t;do{if(o>>>0>=(c[xa>>2]|0)>>>0)break d;m=o;o=o+1|0;i=(_(c[qa>>2]|0,o)|0)+s|0;j=i+1|0;k=c[ra>>2]|0;l=k+(j<<1)|0;m=(_(c[wa>>2]|0,m)|0)+s|0;m=(c[va>>2]|0)+(m<<2)|0;n=c[ta>>2]|0;G=b[l>>1]|0;if((G&255|0)!=0&(G&20480|0)==0){if(Ah(n)|0){D=Ah(n)|0;c[m>>2]=(D|0)!=0?v:w;F=c[qa>>2]|0;G=k+(j-F<<1)|0;E=k+(F+j<<1)|0;C=k+(j+~F<<1)|0;b[C>>1]=e[C>>1]|2;b[G>>1]=b[G>>1]|b[3436+(D<<1)>>1];G=i+2|0;C=k+(G-F<<1)|0;b[C>>1]=e[C>>1]|4;C=k+(i<<1)|0;b[C>>1]=b[C>>1]|b[3436+(D+2<<1)>>1];b[l>>1]=e[l>>1]|4096;C=k+(G<<1)|0;b[C>>1]=b[C>>1]|b[3436+(D+4<<1)>>1];C=k+(F+i<<1)|0;b[C>>1]=e[C>>1]|1;b[E>>1]=b[E>>1]|b[3436+(D+6<<1)>>1];G=k+(F+G<<1)|0;b[G>>1]=e[G>>1]|8}b[l>>1]=e[l>>1]|16384}}while(o>>>0>>0)}else{p=t;do{i=c[xa>>2]|0;if(p>>>0>=i>>>0)break d;F=p;p=p+1|0;j=(_(c[qa>>2]|0,p)|0)+s|0;k=j+1|0;l=c[ra>>2]|0;m=l+(k<<1)|0;n=(_(c[wa>>2]|0,F)|0)+s|0;n=(c[va>>2]|0)+(n<<2)|0;o=c[ta>>2]|0;G=b[m>>1]|0;G=(F|0)==(r|0)|(F|0)==(i+-1|0)?G&-1095:G;if((G&255|0)!=0&(G&20480|0)==0){if(Ah(o)|0){D=Ah(o)|0;c[n>>2]=(D|0)!=0?v:w;F=c[qa>>2]|0;G=l+(k-F<<1)|0;E=l+(F+k<<1)|0;C=l+(k+~F<<1)|0;b[C>>1]=e[C>>1]|2;b[G>>1]=b[G>>1]|b[3436+(D<<1)>>1];G=j+2|0;C=l+(G-F<<1)|0;b[C>>1]=e[C>>1]|4;C=l+(j<<1)|0;b[C>>1]=b[C>>1]|b[3436+(D+2<<1)>>1];b[m>>1]=e[m>>1]|4096;C=l+(G<<1)|0;b[C>>1]=b[C>>1]|b[3436+(D+4<<1)>>1];C=l+(F+j<<1)|0;b[C>>1]=e[C>>1]|1;b[E>>1]=b[E>>1]|b[3436+(D+6<<1)>>1];G=l+(F+G<<1)|0;b[G>>1]=e[G>>1]|8}b[m>>1]=e[m>>1]|16384}}while(p>>>0>>0)}}while(0);s=s+1|0;i=c[wa>>2]|0}while(s>>>0>>0);j=c[xa>>2]|0}if(u>>>0>=j>>>0){G=163;break c}}}if(Q){k=c[va>>2]|0;l=(c[ra>>2]|0)+2|0;r=1<>1|r;i=c[xa>>2]|0;j=c[wa>>2]|0;if(i>>>0>3){o=j;n=0;while(1){if(!j){j=o;m=0}else{j=0;do{G=(c[qa>>2]|0)+j|0;$g(a,l+(G<<1)|0,k+(j<<2)|0,S,r);i=(c[wa>>2]|0)+j|0;G=(c[qa>>2]|0)+G|0;$g(a,l+(G<<1)|0,k+(i<<2)|0,S,r);i=(c[wa>>2]|0)+i|0;G=(c[qa>>2]|0)+G|0;$g(a,l+(G<<1)|0,k+(i<<2)|0,S,r);$g(a,l+((c[qa>>2]|0)+G<<1)|0,k+((c[wa>>2]|0)+i<<2)|0,S,r);j=j+1|0;i=c[wa>>2]|0}while(j>>>0>>0);j=i;m=i;i=c[xa>>2]|0}k=k+(m<<2<<2)|0;l=l+(c[qa>>2]<<2<<1)|0;n=n+4|0;if(n>>>0<(i&-4)>>>0){o=j;j=m}else{q=l;p=n;break}}}else{q=l;p=0}if(!j){G=163;break c}else o=0;while(1){if(p>>>0>>0){l=k+(o<<2)|0;m=q+(o<<1)|0;n=p;while(1){m=m+(c[qa>>2]<<1)|0;$g(a,m,l,S,r);j=c[wa>>2]|0;n=n+1|0;i=c[xa>>2]|0;if(n>>>0>=i>>>0)break;else l=l+(j<<2)|0}}o=o+1|0;if(o>>>0>=j>>>0){G=163;break c}}}w=1<>1|w;i=c[xa>>2]|0;if(!i){G=163;break c}x=0-w|0;j=c[wa>>2]|0;l=j;v=0;while(1){u=v;v=v+4|0;do{if(!j){k=l;j=0}else{t=u|3;if((u|0)==-4){k=l;j=l;break}else s=0;do{r=u;do{i=c[xa>>2]|0;if(r>>>0>=i>>>0)break;G=r;r=r+1|0;l=(_(c[qa>>2]|0,r)|0)+s|0;m=l+1|0;n=c[ra>>2]|0;o=n+(m<<1)|0;p=(_(c[wa>>2]|0,G)|0)+s|0;p=(c[va>>2]|0)+(p<<2)|0;q=c[a>>2]|0;j=b[o>>1]|0;i=(G|0)==(t|0)|(G|0)==(i+-1|0)?j&-1095:j;j=i&255;if((j|0)!=0&(i&20480|0)==0){k=q+100|0;c[k>>2]=q+24+(d[20267+(j|R)>>0]<<2);if(wh(q)|0){F=i>>>4&255;c[k>>2]=q+24+(d[21291+F>>0]<<2);G=wh(q)|0;F=d[21547+F>>0]|0;D=F^G;c[p>>2]=(G|0)!=(F|0)?x:w;F=c[qa>>2]|0;G=n+(m-F<<1)|0;E=n+(F+m<<1)|0;C=n+(m+~F<<1)|0;b[C>>1]=e[C>>1]|2;b[G>>1]=b[G>>1]|b[3436+(D<<1)>>1];G=l+2|0;C=n+(G-F<<1)|0;b[C>>1]=e[C>>1]|4;C=n+(l<<1)|0;b[C>>1]=b[C>>1]|b[3436+(D+2<<1)>>1];b[o>>1]=e[o>>1]|4096;C=n+(G<<1)|0;b[C>>1]=b[C>>1]|b[3436+(D+4<<1)>>1];C=n+(F+l<<1)|0;b[C>>1]=e[C>>1]|1;b[E>>1]=b[E>>1]|b[3436+(D+6<<1)>>1];G=n+(F+G<<1)|0;b[G>>1]=e[G>>1]|8}b[o>>1]=e[o>>1]|16384}}while(r>>>0>>0);s=s+1|0;i=c[wa>>2]|0}while(s>>>0>>0);k=i;j=i;i=c[xa>>2]|0}}while(0);if(v>>>0>=i>>>0){G=163;break}else l=k}break}case 1:{if(K){q=1<>1;r=(f|0)>0?0-q|0:-1;j=c[xa>>2]|0;if(!j)break c;k=c[wa>>2]|0;i=k;p=0;while(1){o=p;p=p+4|0;if(!k){l=i;k=0}else{n=(o|0)==-4;m=0;do{l=m;m=m+1|0;if(!n){k=o;do{if(k>>>0>=(c[xa>>2]|0)>>>0)break;j=k;k=k+1|0;i=(_(c[qa>>2]|0,k)|0)+m|0;i=(c[ra>>2]|0)+(i<<1)|0;j=(_(c[wa>>2]|0,j)|0)+l|0;j=(c[va>>2]|0)+(j<<2)|0;if((b[i>>1]&20480)==4096){F=(Ah(c[ta>>2]|0)|0)!=0;F=F?q:r;G=c[j>>2]|0;c[j>>2]=((G|0)<0?0-F|0:F)+G;b[i>>1]=e[i>>1]|8192}}while(k>>>0

    >>0);i=c[wa>>2]|0}}while(m>>>0>>0);l=i;k=i;j=c[xa>>2]|0}if(p>>>0>=j>>>0){G=163;break c}else i=l}}if(!Q){t=1<>1;u=(f|0)>0?0-t|0:-1;i=c[xa>>2]|0;if(!i){G=163;break c}j=c[wa>>2]|0;k=j;s=0;while(1){r=s;s=s+4|0;if(!j)j=0;else{p=(r|0)==-4;q=r|3;i=k;o=0;do{n=o;o=o+1|0;if(!p){l=r;do{i=c[xa>>2]|0;if(l>>>0>=i>>>0)break;F=l;l=l+1|0;j=(_(c[qa>>2]|0,l)|0)+o|0;j=(c[ra>>2]|0)+(j<<1)|0;k=(_(c[wa>>2]|0,F)|0)+n|0;k=(c[va>>2]|0)+(k<<2)|0;m=c[a>>2]|0;G=b[j>>1]|0;i=(F|0)==(q|0)|(F|0)==(i+-1|0)?G&-1095:G;if((i&20480|0)==4096){c[m+100>>2]=m+24+(((i&8192|0)!=0?16:(i&255|0)!=0?15:14)<<2);F=(wh(m)|0)!=0;F=F?t:u;G=c[k>>2]|0;c[k>>2]=((G|0)<0?0-F|0:F)+G;b[j>>1]=e[j>>1]|8192}}while(l>>>0>>0);i=c[wa>>2]|0}}while(o>>>0>>0);k=i;j=i;i=c[xa>>2]|0}if(s>>>0>=i>>>0){G=163;break c}}}k=c[va>>2]|0;l=(c[ra>>2]|0)+2|0;v=1<>1;w=(f|0)>0?0-v|0:-1;i=c[xa>>2]|0;j=c[wa>>2]|0;if(i>>>0>3){n=j;t=l;u=0;while(1){if(!j){j=n;m=0}else{i=n;s=0;do{j=k+(s<<2)|0;n=c[qa>>2]|0;p=n+s|0;l=t+(p<<1)|0;o=c[a>>2]|0;m=b[l>>1]|0;if((m&20480|0)==4096){c[o+100>>2]=o+24+(((m&8192|0)!=0?16:(m&255|0)!=0?15:14)<<2);n=(wh(o)|0)!=0;n=n?v:w;i=c[j>>2]|0;c[j>>2]=((i|0)<0?0-n|0:n)+i;b[l>>1]=e[l>>1]|8192;i=c[wa>>2]|0;j=c[qa>>2]|0;n=c[a>>2]|0}else{j=n;n=o}q=i+s|0;o=k+(q<<2)|0;r=j+p|0;l=t+(r<<1)|0;m=b[l>>1]|0;if((m&20480|0)==4096){c[n+100>>2]=n+24+(((m&8192|0)!=0?16:(m&255|0)!=0?15:14)<<2);j=(wh(n)|0)!=0;j=j?v:w;i=c[o>>2]|0;c[o>>2]=((i|0)<0?0-j|0:j)+i;b[l>>1]=e[l>>1]|8192;i=c[wa>>2]|0;j=c[qa>>2]|0;n=c[a>>2]|0}p=i+q|0;o=k+(p<<2)|0;q=j+r|0;l=t+(q<<1)|0;m=b[l>>1]|0;if((m&20480|0)==4096){c[n+100>>2]=n+24+(((m&8192|0)!=0?16:(m&255|0)!=0?15:14)<<2);j=(wh(n)|0)!=0;j=j?v:w;i=c[o>>2]|0;c[o>>2]=((i|0)<0?0-j|0:j)+i;b[l>>1]=e[l>>1]|8192;i=c[wa>>2]|0;j=c[qa>>2]|0;n=c[a>>2]|0}m=k+(i+p<<2)|0;j=t+(j+q<<1)|0;l=b[j>>1]|0;if((l&20480|0)==4096){c[n+100>>2]=n+24+(((l&8192|0)!=0?16:(l&255|0)!=0?15:14)<<2);G=(wh(n)|0)!=0;G=G?v:w;i=c[m>>2]|0;c[m>>2]=((i|0)<0?0-G|0:G)+i;b[j>>1]=e[j>>1]|8192;i=c[wa>>2]|0}s=s+1|0}while(s>>>0>>0);j=i;m=i;i=c[xa>>2]|0}k=k+(m<<2<<2)|0;l=t+(c[qa>>2]<<2<<1)|0;o=u+4|0;if(o>>>0<(i&-4)>>>0){n=j;j=m;t=l;u=o}else{s=o;break}}}else s=0;if(!j){G=163;break c}else r=0;do{if(s>>>0>>0){o=k+(r<<2)|0;p=l+(r<<1)|0;q=s;while(1){p=p+(c[qa>>2]<<1)|0;n=c[a>>2]|0;m=b[p>>1]|0;if((m&20480|0)==4096){c[n+100>>2]=n+24+(((m&8192|0)!=0?16:(m&255|0)!=0?15:14)<<2);i=(wh(n)|0)!=0;i=i?v:w;m=c[o>>2]|0;c[o>>2]=((m|0)<0?0-i|0:i)+m;b[p>>1]=e[p>>1]|8192;m=c[wa>>2]|0;i=c[xa>>2]|0}else m=j;q=q+1|0;if(q>>>0>=i>>>0){j=m;break}else{j=m;o=o+(m<<2)|0}}}r=r+1|0}while(r>>>0>>0);G=163;break}case 2:{E=c[a>>2]|0;F=1<>1|F;do{if(Q){k=c[va>>2]|0;l=(c[ra>>2]|0)+2|0;j=c[xa>>2]|0;if(j>>>0>3){w=E+92|0;x=E+100|0;y=E+96|0;z=0-F|0;m=c[wa>>2]|0;i=m;o=0;while(1){if(!m)m=0;else{r=o|1;s=r+1|0;t=o|3;u=r+3|0;v=0;do{i=c[qa>>2]|0;j=v;v=v+1|0;D=(_(i,r)|0)+v|0;G=c[ra>>2]|0;D=b[G+((_(i,s)|0)+v<<1)>>1]|b[G+(D<<1)>>1];D=D|b[G+((_(i,t)|0)+v<<1)>>1];e:do{if(!((D|b[G+((_(i,u)|0)+v<<1)>>1])&20735)){c[x>>2]=w;if(!(wh(E)|0))break;c[x>>2]=y;p=(wh(E)|0)<<1;p=p|(wh(E)|0);if(p>>>0>=4)break;q=k+((_(c[wa>>2]|0,p)|0)+j<<2)|0;j=l+((_(c[qa>>2]|0,p)|0)+j<<1)|0;n=p;while(1){if(n>>>0>=(c[xa>>2]|0)>>>0)break e;i=c[qa>>2]|0;m=j;j=j+(i<<1)|0;if((n|0)==(p|0)){G=c[a>>2]|0;D=(e[j>>1]|0)>>>4&255;c[G+100>>2]=G+24+(d[21291+D>>0]<<2);G=wh(G)|0;D=d[21547+D>>0]|0;B=D^G;c[q>>2]=(G|0)!=(D|0)?z:F;D=c[qa>>2]|0;G=m+(i-D<<1)|0;C=m+(D+i<<1)|0;A=m+(i+~D<<1)|0;b[A>>1]=e[A>>1]|2;b[G>>1]=b[G>>1]|b[3436+(B<<1)>>1];G=i+1|0;A=m+(G-D<<1)|0;b[A>>1]=e[A>>1]|4;A=i+-1|0;i=m+(A<<1)|0;b[i>>1]=b[i>>1]|b[3436+(B+2<<1)>>1];b[j>>1]=e[j>>1]|4096;i=m+(G<<1)|0;b[i>>1]=b[i>>1]|b[3436+(B+4<<1)>>1];A=m+(D+A<<1)|0;b[A>>1]=e[A>>1]|1;b[C>>1]=b[C>>1]|b[3436+(B+6<<1)>>1];G=m+(D+G<<1)|0;b[G>>1]=e[G>>1]|8;b[j>>1]=e[j>>1]&49151}else ah(a,j,q,S,F);n=n+1|0;if(n>>>0>=4)break;else q=q+(c[wa>>2]<<2)|0}}else{D=i+j|0;ah(a,l+(D<<1)|0,k+(j<<2)|0,S,F);G=(c[wa>>2]|0)+j|0;D=(c[qa>>2]|0)+D|0;ah(a,l+(D<<1)|0,k+(G<<2)|0,S,F);G=(c[wa>>2]|0)+G|0;D=(c[qa>>2]|0)+D|0;ah(a,l+(D<<1)|0,k+(G<<2)|0,S,F);ah(a,l+((c[qa>>2]|0)+D<<1)|0,k+((c[wa>>2]|0)+G<<2)|0,S,F)}}while(0);i=c[wa>>2]|0}while(v>>>0>>0);m=i;j=c[xa>>2]|0}k=k+(m<<2<<2)|0;l=l+(c[qa>>2]<<2<<1)|0;o=o+4|0;if(o>>>0>=(j&-4)>>>0){q=k;p=l;break}}}else{i=c[wa>>2]|0;q=k;p=l;o=0}if(!i)break;else n=0;do{if(o>>>0>>0){k=q+(n<<2)|0;l=p+(n<<1)|0;m=o;while(1){l=l+(c[qa>>2]<<1)|0;ah(a,l,k,S,F);i=c[wa>>2]|0;m=m+1|0;j=c[xa>>2]|0;if(m>>>0>=j>>>0)break;else k=k+(i<<2)|0}}n=n+1|0}while(n>>>0>>0)}else{i=c[xa>>2]|0;if(!i)break;A=E+92|0;B=E+100|0;C=E+96|0;D=0-F|0;j=c[wa>>2]|0;z=0;while(1){if(!j){k=z+4|0;j=0}else{v=z|3;w=z|1;x=w+1|0;y=w+3|0;k=z+4|0;u=0;while(1){do{if(v>>>0>>0){i=c[qa>>2]|0;l=u+1|0;t=(_(i,w)|0)+l|0;j=c[ra>>2]|0;if(b[j+(t<<1)>>1]&20735){t=0;i=0;G=127;break}if(b[j+((_(i,x)|0)+l<<1)>>1]&20735){t=0;i=0;G=127;break}if(b[j+((_(i,v)|0)+l<<1)>>1]&20735){t=0;i=0;G=127;break}if(b[j+((_(i,y)|0)+l<<1)>>1]&20665){t=0;i=0;G=127;break}c[B>>2]=A;if(!(wh(E)|0))break;c[B>>2]=C;i=(wh(E)|0)<<1;t=1;i=i|(wh(E)|0);G=127}else{t=0;i=0;G=127}}while(0);if((G|0)==127){G=0;l=i+z|0;f:do{if(l>>>0>>0){s=l;do{i=c[xa>>2]|0;if(s>>>0>=i>>>0)break f;Da=s;s=s+1|0;m=(_(c[qa>>2]|0,s)|0)+u|0;n=m+1|0;o=c[ra>>2]|0;p=o+(n<<1)|0;q=(_(c[wa>>2]|0,Da)|0)+u|0;q=(c[va>>2]|0)+(q<<2)|0;r=c[a>>2]|0;j=b[p>>1]|0;j=(Da|0)==(v|0)|(Da|0)==(i+-1|0)?j&-1095:j;do{if(!(t&(Da|0)==(l|0))){if(j&20480)break;i=r+100|0;c[i>>2]=r+24+(d[20267+(j&255|R)>>0]<<2);if(wh(r)|0)G=133}else{i=r+100|0;G=133}}while(0);if((G|0)==133){G=0;j=j>>>4&255;c[i>>2]=r+24+(d[21291+j>>0]<<2);Da=wh(r)|0;r=d[21547+j>>0]|0;j=r^Da;c[q>>2]=(Da|0)!=(r|0)?D:F;r=c[qa>>2]|0;Da=o+(n-r<<1)|0;q=o+(r+n<<1)|0;n=o+(n+~r<<1)|0;b[n>>1]=e[n>>1]|2;b[Da>>1]=b[Da>>1]|b[3436+(j<<1)>>1];Da=m+2|0;n=o+(Da-r<<1)|0;b[n>>1]=e[n>>1]|4;n=o+(m<<1)|0;b[n>>1]=b[n>>1]|b[3436+(j+2<<1)>>1];b[p>>1]=e[p>>1]|4096;n=o+(Da<<1)|0;b[n>>1]=b[n>>1]|b[3436+(j+4<<1)>>1];n=o+(r+m<<1)|0;b[n>>1]=e[n>>1]|1;b[q>>1]=b[q>>1]|b[3436+(j+6<<1)>>1];Da=o+(r+Da<<1)|0;b[Da>>1]=e[Da>>1]|8}b[p>>1]=e[p>>1]&49151}while(s>>>0>>0)}}while(0);l=u+1|0}j=c[wa>>2]|0;i=c[xa>>2]|0;if(l>>>0>>0)u=l;else break}}if(k>>>0>>0)z=k;else break}}}while(0);if(M){G=163;break c}c[E+100>>2]=E+96;wh(E)|0;wh(E)|0;wh(E)|0;wh(E)|0;G=163;break}default:G=163}}while(0);do{if((G|0)==163){G=0;if(J)break;qh(U);rh(U,18,0,46);rh(U,17,0,3);rh(U,0,0,4)}}while(0);h=h+1|0;Da=(h|0)==3;f=(Da<<31>>31)+f|0;h=Da?0:h;H=H+1|0;if(H>>>0>=(c[I>>2]|0)>>>0)break b}}}while(0);i=c[X>>2]|0}L=L+1|0}while(L>>>0>>0)}h=(c[V>>2]|0)-(c[fa>>2]|0)|0;f=(c[Y>>2]|0)-(c[ga>>2]|0)|0;i=c[ea>>2]|0;if(i&1){Da=c[Aa>>2]|0;h=(c[Da+(la*136|0)+8>>2]|0)+h-(c[Da+(la*136|0)>>2]|0)|0}if(i&2){Da=c[Aa>>2]|0;f=(c[Da+(la*136|0)+12>>2]|0)+f-(c[Da+(la*136|0)+4>>2]|0)|0}p=c[va>>2]|0;q=c[wa>>2]|0;r=c[xa>>2]|0;i=c[Ba>>2]|0;if((i|0)!=0?(ua=1<>2]|0;m=(l|0)>-1?l:0-l|0;if((m|0)>=(ua|0)){Da=m>>c[Ba>>2];c[k>>2]=(l|0)<0?0-Da|0:Da}n=n+1|0}while((n|0)!=(q|0))}o=o+1|0}while((o|0)!=(r|0))}n=(_(f,ya)|0)+h|0;o=c[pa>>2]|0;h=(r|0)==0;if((c[sa>>2]|0)==1){if(!h){h=(q|0)==0;k=0;do{if(!h){f=_(k,q)|0;i=(_(k,ya)|0)+n|0;j=0;do{c[o+(i+j<<2)>>2]=(c[p+(j+f<<2)>>2]|0)/2|0;j=j+1|0}while((j|0)!=(q|0))}k=k+1|0}while((k|0)!=(r|0))}}else if(!h){m=(q|0)==0;h=p;l=0;k=o+(n<<2)|0;while(1){if(!m){f=h;i=0;j=k;while(1){g[j>>2]=+(c[f>>2]|0)*+g[ha>>2];i=i+1|0;if((i|0)==(q|0))break;else{f=f+4|0;j=j+4|0}}h=h+(q<<2)|0}l=l+1|0;if((l|0)==(r|0))break;else k=k+(ya<<2)|0}}$=$+1|0}while($>>>0<(_(c[ba>>2]|0,c[aa>>2]|0)|0)>>>0);h=c[ka>>2]|0;i=c[ja>>2]|0}ca=ca+1|0}while(ca>>>0<(_(h,i)|0)>>>0);f=c[na>>2]|0}ia=ia+1|0}while(ia>>>0>>0);h=c[za>>2]|0}oa=oa+1|0;if(oa>>>0>=h>>>0){h=1;G=201;break}}if((G|0)==201)return h|0;return 0}function Zg(f,i,j,k,l){f=f|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0.0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0.0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0.0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0;Ya=i+32|0;h[Ya>>3]=0.0;Za=i+16|0;m=c[Za>>2]|0;if(!m){_a=1;return _a|0}Xa=i+20|0;Sa=j+5584|0;Ta=f+16|0;Ua=f+20|0;Va=f+8|0;Wa=f+36|0;Pa=(k|0)!=0;Qa=f+32|0;Ra=f+12|0;i=m;Oa=0;a:while(1){j=c[Xa>>2]|0;m=c[Sa>>2]|0;Ma=(c[j+(Oa*52|0)+8>>2]|0)-(c[j+(Oa*52|0)>>2]|0)|0;Na=j+(Oa*52|0)+16|0;n=c[Na>>2]|0;if(n){La=j+(Oa*52|0)+24|0;Ja=j+(Oa*52|0)+32|0;Ka=m+(Oa*1080|0)+20|0;Ga=m+(Oa*1080|0)+16|0;Ia=Pa&Oa>>>0>>0;Ha=k+(Oa<<3)|0;i=n;Fa=0;do{Da=c[La>>2]|0;Ea=Da+(Fa*136|0)+24|0;j=c[Ea>>2]|0;if(j){za=Da+(Fa*136|0)+16|0;Aa=Da+(Fa*136|0)+20|0;Ba=~Fa;Ca=Fa+-1|0;i=c[Aa>>2]|0;m=c[za>>2]|0;ya=0;do{xa=Da+(Fa*136|0)+28+(ya*36|0)+32|0;if(_(i,m)|0){ra=67108864/(~~+M(+(+g[xa>>2]*8192.0))|0)|0;sa=Da+(Fa*136|0)+28+(ya*36|0)+20|0;ta=Da+(Fa*136|0)+28+(ya*36|0)|0;ua=Da+(Fa*136|0)+28+(ya*36|0)+4|0;va=Da+(Fa*136|0)+28+(ya*36|0)+16|0;wa=((ra|0)<0)<<31>>31;qa=0;do{j=c[sa>>2]|0;oa=j+(qa*40|0)+16|0;pa=j+(qa*40|0)+20|0;if(_(c[pa>>2]|0,c[oa>>2]|0)|0){ma=j+(qa*40|0)+24|0;na=0;do{la=c[ma>>2]|0;n=c[la+(na*52|0)+12>>2]|0;i=n-(c[ta>>2]|0)|0;o=c[la+(na*52|0)+16>>2]|0;j=o-(c[ua>>2]|0)|0;m=c[va>>2]|0;if(m&1){ka=c[La>>2]|0;i=(c[ka+(Ca*136|0)+8>>2]|0)+i-(c[ka+(Ca*136|0)>>2]|0)|0}if(m&2){ka=c[La>>2]|0;j=(c[ka+(Ca*136|0)+12>>2]|0)+j-(c[ka+(Ca*136|0)+4>>2]|0)|0}if(!(_g(f,(c[la+(na*52|0)+20>>2]|0)-n|0,(c[la+(na*52|0)+24>>2]|0)-o|0)|0)){i=0;_a=173;break a}p=c[Ta>>2]|0;q=c[Ua>>2]|0;r=Ma-p|0;u=(_(j,Ma)|0)+i|0;v=c[Ja>>2]|0;c[Va>>2]=v+(u<<2);c[Wa>>2]=Ma;i=(q|0)==0;if((c[Ka>>2]|0)==1){if(!i){n=(p|0)==0;o=0;i=0;while(1){if(!n){j=0;m=i;while(1){ka=v+(m+u<<2)|0;c[ka>>2]=c[ka>>2]<<6;j=j+1|0;if((j|0)==(p|0))break;else m=m+1|0}i=p+i|0}o=o+1|0;if((o|0)==(q|0))break;else i=i+r|0}}}else if(!i){n=(p|0)==0;o=0;i=0;while(1){if(!n){j=0;m=i;while(1){ka=v+(m+u<<2)|0;ja=c[ka>>2]|0;ja=Zi(ja|0,((ja|0)<0)<<31>>31|0,ra|0,wa|0)|0;ja=Si(ja|0,C|0,4096,0)|0;ja=Ti(ja|0,C|0,18)|0;c[ka>>2]=ja;j=j+1|0;if((j|0)==(p|0))break;else m=m+1|0}i=p+i|0}o=o+1|0;if((o|0)==(q|0))break;else i=i+r|0}}ga=c[va>>2]|0;ha=(c[Na>>2]|0)+Ba|0;r=c[Ka>>2]|0;ia=+g[xa>>2];ja=c[Ga>>2]|0;ka=c[f>>2]|0;n=c[Ta>>2]|0;do{if(!n)i=0;else{o=c[Ua>>2]|0;p=(o|0)==0;q=0;i=0;do{if(!p){j=c[Wa>>2]|0;m=0;do{fa=c[v+(u+((_(m,j)|0)+q)<<2)>>2]|0;fa=(fa|0)>-1?fa:0-fa|0;i=(i|0)>(fa|0)?i:fa;m=m+1|0}while((m|0)!=(o|0))}q=q+1|0}while((q|0)!=(n|0));if(!i){i=0;break}if((i|0)>1){j=i;i=0}else{i=-5;break}while(1){j=j>>1;if((j|0)<=1)break;else i=i+1|0}i=i+-4|0}}while(0);ea=la+(na*52|0)+28|0;c[ea>>2]=i;i=i+-1|0;qh(ka);rh(ka,18,0,46);rh(ka,17,0,3);rh(ka,0,0,4);fa=la+(na*52|0)|0;kh(ka,c[fa>>2]|0);b:do{if((i|0)>-1){ca=la+(na*52|0)+8|0;W=ja&1;da=(W|0)!=0;X=(r|0)==1;Y=(ja&4|0)==0;W=(W|0)==0;Z=(ja&2|0)==0;$=(ja&8|0)==0;aa=ga<<8;ba=(ja&32|0)==0;j=0;T=i;U=0.0;i=0;V=2;while(1){S=c[ca>>2]|0;I=da&(V>>>0<2?(T|0)<((c[ea>>2]|0)+-4|0):0);c:do{switch(V|0){case 0:{G=1<>2]|0;if(!j){n=0;break c}H=(T|0)==0;o=c[Ta>>2]|0;m=o;n=0;F=0;do{E=F;F=F+4|0;if(!m)m=0;else{B=(E|0)==-4;D=E|3;m=o;A=0;do{if(!B){z=E;do{j=c[Ua>>2]|0;if(z>>>0>=j>>>0)break;do{if($)j=0;else{if((z|0)==(D|0)){j=1;break}j=(z|0)==(j+-1|0)}}while(0);p=z;z=z+1|0;u=(_(c[Qa>>2]|0,z)|0)+A|0;v=u+1|0;w=c[Ra>>2]|0;y=w+(v<<1)|0;p=(_(c[Wa>>2]|0,p)|0)+A|0;p=(c[Va>>2]|0)+(p<<2)|0;x=c[f>>2]|0;q=b[y>>1]|0;q=j?q&-1095:q;j=q&255;if((j|0)!=0&(q&20480|0)==0){m=c[p>>2]|0;m=(((m|0)<0?0-m|0:m)&G|0)!=0;o=m&1;r=x+100|0;c[r>>2]=x+24+(d[20267+(j|aa)>>0]<<2);if(I)oh(x,o);else lh(x,o);if(m){j=c[p>>2]|0;m=j>>>31;j=(j|0)<0?0-j|0:j;if(H)j=3708+((j&127)<<1)|0;else j=3452+((j>>>T&127)<<1)|0;n=(b[j>>1]|0)+n|0;j=q>>>4&255;c[r>>2]=x+24+(d[21291+j>>0]<<2);if(I)oh(x,m);else lh(x,d[21547+j>>0]^m);Q=c[Qa>>2]|0;R=w+(v-Q<<1)|0;P=w+(Q+v<<1)|0;O=w+(v+~Q<<1)|0;b[O>>1]=e[O>>1]|2;b[R>>1]=b[R>>1]|b[3436+(m<<1)>>1];R=u+2|0;O=w+(R-Q<<1)|0;b[O>>1]=e[O>>1]|4;O=w+(u<<1)|0;b[O>>1]=b[O>>1]|b[3436+((m|2)<<1)>>1];b[y>>1]=e[y>>1]|4096;O=w+(R<<1)|0;b[O>>1]=b[O>>1]|b[3436+((m|4)<<1)>>1];O=w+(Q+u<<1)|0;b[O>>1]=e[O>>1]|1;b[P>>1]=b[P>>1]|b[3436+((m|6)<<1)>>1];R=w+(Q+R<<1)|0;b[R>>1]=e[R>>1]|8}b[y>>1]=e[y>>1]|16384}}while(z>>>0>>0);m=c[Ta>>2]|0}A=A+1|0}while(A>>>0>>0);j=c[Ua>>2]|0;o=m}}while(F>>>0>>0);break}case 1:{A=1<>2]|0;if(!j){n=0;break c}B=(T|0)==0;o=c[Ta>>2]|0;m=o;n=0;z=0;do{y=z;z=z+4|0;if(!m)m=0;else{w=(y|0)==-4;x=y|3;m=o;v=0;do{u=v;v=v+1|0;if(!w){r=y;do{j=c[Ua>>2]|0;if(r>>>0>=j>>>0)break;do{if($)j=0;else{if((r|0)==(x|0)){j=1;break}j=(r|0)==(j+-1|0)}}while(0);m=r;r=r+1|0;p=(_(c[Qa>>2]|0,r)|0)+v|0;p=(c[Ra>>2]|0)+(p<<1)|0;q=c[f>>2]|0;o=b[p>>1]|0;o=j?o&-1095:o;if((o&20480|0)==4096){m=c[(c[Va>>2]|0)+((_(c[Wa>>2]|0,m)|0)+u<<2)>>2]|0;m=(m|0)<0?0-m|0:m;if(B)j=4220+((m&127)<<1)|0;else j=3964+((m>>>T&127)<<1)|0;n=(b[j>>1]|0)+n|0;j=(m&A|0)!=0&1;c[q+100>>2]=q+24+(((o&8192|0)!=0?16:(o&255|0)!=0?15:14)<<2);if(I)oh(q,j);else lh(q,j);b[p>>1]=e[p>>1]|8192}}while(r>>>0>>0);m=c[Ta>>2]|0}}while(v>>>0>>0);j=c[Ua>>2]|0;o=m}}while(z>>>0>>0);break}case 2:{L=c[f>>2]|0;N=1<>2]|0;if(!m)j=0;else{O=L+92|0;P=L+100|0;Q=L+96|0;R=(T|0)==0;n=c[Ta>>2]|0;j=0;K=0;while(1){if(!n){o=K+4|0;n=0}else{D=K|3;E=K|1;F=E+1|0;G=E+3|0;o=K+4|0;H=K+1|0;I=K+2|0;J=K+3|0;B=0;while(1){do{if(D>>>0>>0){m=c[Qa>>2]|0;q=B+1|0;p=(_(m,E)|0)+q|0;n=c[Ra>>2]|0;p=b[n+(p<<1)>>1]|0;if($){A=b[n+((_(m,F)|0)+q<<1)>>1]|p;A=A|b[n+((_(m,D)|0)+q<<1)>>1];m=((A|b[n+((_(m,G)|0)+q<<1)>>1])&20735)==0&1}else{do{if(!(p&20735)){if(b[n+((_(m,F)|0)+q<<1)>>1]&20735){m=1;break}if(b[n+((_(m,D)|0)+q<<1)>>1]&20735){m=1;break}m=(b[n+((_(m,G)|0)+q<<1)>>1]&20665)!=0}else m=1}while(0);m=m&1^1}if(!m){A=0;m=0;_a=109;break}m=c[Wa>>2]|0;n=c[Va>>2]|0;A=c[n+((_(m,K)|0)+B<<2)>>2]|0;do{if(!(((A|0)<0?0-A|0:A)&N)){A=c[n+((_(m,H)|0)+B<<2)>>2]|0;if(((A|0)<0?0-A|0:A)&N){m=1;break}A=c[n+((_(m,I)|0)+B<<2)>>2]|0;if(((A|0)<0?0-A|0:A)&N){m=2;break}m=c[n+((_(m,J)|0)+B<<2)>>2]|0;m=(((m|0)<0?0-m|0:m)&N|0)==0?4:3}else m=0}while(0);c[P>>2]=O;lh(L,(m|0)!=4&1);if((m|0)==4){p=q;break}c[P>>2]=Q;lh(L,m>>>1);lh(L,m&1);A=1;_a=109}else{A=0;m=0;_a=109}}while(0);if((_a|0)==109){_a=0;z=m+K|0;d:do{if(z>>>0>>0){y=z;do{m=c[Ua>>2]|0;if(y>>>0>=m>>>0)break d;do{if($)m=0;else{if((y|0)==(D|0)){m=1;break}m=(y|0)==(m+-1|0)}}while(0);$a=y;y=y+1|0;r=(_(c[Qa>>2]|0,y)|0)+B|0;u=r+1|0;v=c[Ra>>2]|0;x=v+(u<<1)|0;n=(_(c[Wa>>2]|0,$a)|0)+B|0;n=(c[Va>>2]|0)+(n<<2)|0;w=c[f>>2]|0;p=b[x>>1]|0;q=m?p&-1095:p;do{if(!(A&($a|0)==(z|0))){if(p&20480)break;c[w+100>>2]=w+24+(d[20267+(q&255|aa)>>0]<<2);$a=c[n>>2]|0;$a=((($a|0)<0?0-$a|0:$a)&N|0)!=0;lh(w,$a&1);if($a)_a=117}else _a=117}while(0);if((_a|0)==117){_a=0;n=c[n>>2]|0;m=(n|0)<0?0-n|0:n;if(R)m=3708+((m&127)<<1)|0;else m=3452+((m>>>T&127)<<1)|0;j=(b[m>>1]|0)+j|0;$a=q>>>4&255;c[w+100>>2]=w+24+(d[21291+$a>>0]<<2);p=n>>>31;lh(w,d[21547+$a>>0]^p);w=c[Qa>>2]|0;$a=v+(u-w<<1)|0;q=v+(w+u<<1)|0;u=v+(u+~w<<1)|0;b[u>>1]=e[u>>1]|2;b[$a>>1]=b[$a>>1]|b[3436+(p<<1)>>1];$a=r+2|0;u=v+($a-w<<1)|0;b[u>>1]=e[u>>1]|4;u=v+(r<<1)|0;b[u>>1]=b[u>>1]|b[3436+((p|2)<<1)>>1];b[x>>1]=e[x>>1]|4096;u=v+($a<<1)|0;b[u>>1]=b[u>>1]|b[3436+((p|4)<<1)>>1];u=v+(w+r<<1)|0;b[u>>1]=e[u>>1]|1;b[q>>1]=b[q>>1]|b[3436+((p|6)<<1)>>1];$a=v+(w+$a<<1)|0;b[$a>>1]=e[$a>>1]|8}b[x>>1]=e[x>>1]&49151}while(y>>>0>>0)}}while(0);p=B+1|0}n=c[Ta>>2]|0;m=c[Ua>>2]|0;if(p>>>0>>0)B=p;else break}}if(o>>>0>>0)K=o;else break}}if(ba){n=j;break c}uh(ka);n=j;break}default:n=j}}while(0);if(Ia)s=+h[Ha>>3];else s=1.0;if(X)t=+Ig(ha,ga);else t=+Lg(ha,ga);t=+(1<>3]=+h[Ya>>3]+t;do{if(Y)_a=137;else{if((T|0)<1&(V|0)==2){_a=137;break}mh(ka);m=S+(i*24|0)+20|0;j=a[m>>0]|1;a[m>>0]=j;m=1}}while(0);do{if((_a|0)==137){j=(c[ea>>2]|0)+-4|0;if((V|0)!=0&(T|0)<(j|0))if(W)_a=141;else _a=140;else if(W|((V|0)!=2|(T|0)!=(j|0)))_a=141;else _a=140;if((_a|0)==140){_a=0;mh(ka);m=S+(i*24|0)+20|0;j=a[m>>0]|1;a[m>>0]=j;m=1;break}else if((_a|0)==141){_a=0;m=S+(i*24|0)+20|0;j=a[m>>0]&-2;a[m>>0]=j;m=3;break}}}while(0);R=V+1|0;$a=(R|0)==3;V=$a?0:R;T=($a<<31>>31)+T|0;do{if((T|0)>0&(j&1)!=0)if(da&(V>>>0<2?(T|0)<((c[ea>>2]|0)+-4|0):0)){nh(ka);break}else{sh(ka);break}}while(0);h[S+(i*24|0)+8>>3]=U;c[S+(i*24|0)>>2]=(jh(ka)|0)+m;if(!Z)ph(ka);i=i+1|0;if((T|0)<=-1)break b;else j=n}}else i=0}while(0);do{if(!(ja&16)){if(ja&1)break;mh(ka)}else th(ka)}while(0);q=la+(na*52|0)+48|0;c[q>>2]=i;if(i){n=la+(na*52|0)+8|0;p=0;do{o=c[n>>2]|0;j=o+(p*24|0)|0;$a=c[j>>2]|0;if($a>>>0>(jh(ka)|0)>>>0){i=jh(ka)|0;c[j>>2]=i}else i=c[j>>2]|0;do{if(i>>>0>1){m=i+-1|0;if((a[(c[fa>>2]|0)+m>>0]|0)!=-1)break;c[j>>2]=m;i=m}}while(0);if(!p)j=0;else j=c[(c[n>>2]|0)+((p+-1|0)*24|0)>>2]|0;c[o+(p*24|0)+16>>2]=i-j;p=p+1|0}while(p>>>0<(c[q>>2]|0)>>>0)}na=na+1|0}while(na>>>0<(_(c[pa>>2]|0,c[oa>>2]|0)|0)>>>0);i=c[Aa>>2]|0;m=c[za>>2]|0}qa=qa+1|0}while(qa>>>0<(_(i,m)|0)>>>0);j=c[Ea>>2]|0}ya=ya+1|0}while(ya>>>0>>0);i=c[Na>>2]|0}Fa=Fa+1|0}while(Fa>>>0>>0);i=c[Za>>2]|0}Oa=Oa+1|0;if(Oa>>>0>=i>>>0){i=1;_a=173;break}}if((_a|0)==173)return i|0;return 0}function _g(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;g=_(d,b)|0;if(!(c[a+40>>2]|0)){h=a+24|0;i=a+8|0;e=c[i>>2]|0;do{if(g>>>0>(c[h>>2]|0)>>>0){Sc(e);f=g<<2;e=Rc(f)|0;c[i>>2]=e;if(!e){b=0;return b|0}else{c[h>>2]=g;break}}else f=g<<2}while(0);Qi(e|0,0,f|0)|0}g=b+2|0;c[a+32>>2]=g;g=_(d+2|0,g)|0;h=a+28|0;i=a+12|0;e=c[i>>2]|0;do{if(g>>>0>(c[h>>2]|0)>>>0){Sc(e);f=g<<1;e=Rc(f)|0;c[i>>2]=e;if(!e){b=0;return b|0}else{c[h>>2]=g;break}}else f=g<<1}while(0);Qi(e|0,0,f|0)|0;c[a+16>>2]=b;c[a+20>>2]=d;b=1;return b|0}function $g(a,f,g,h,i){a=a|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0;j=c[a>>2]|0;l=b[f>>1]|0;m=l&255;if(!((m|0)!=0&(l&20480|0)==0))return;k=j+100|0;c[k>>2]=j+24+(d[20267+(m|h<<8)>>0]<<2);if(wh(j)|0){h=l>>>4&255;c[k>>2]=j+24+(d[21291+h>>0]<<2);l=wh(j)|0;h=d[21547+h>>0]|0;m=h^l;c[g>>2]=(l|0)!=(h|0)?0-i|0:i;a=c[a+32>>2]|0;i=f+(0-a<<1)|0;h=f+(a<<1)|0;g=f+(~a<<1)|0;b[g>>1]=e[g>>1]|2;b[i>>1]=b[i>>1]|b[3436+(m<<1)>>1];i=f+(1-a<<1)|0;b[i>>1]=e[i>>1]|4;i=f+-2|0;b[i>>1]=b[i>>1]|b[3436+(m+2<<1)>>1];b[f>>1]=e[f>>1]|4096;i=f+2|0;b[i>>1]=b[i>>1]|b[3436+(m+4<<1)>>1];i=f+(a+-1<<1)|0;b[i>>1]=e[i>>1]|1;b[h>>1]=b[h>>1]|b[3436+(m+6<<1)>>1];a=f+(a+1<<1)|0;b[a>>1]=e[a>>1]|8}b[f>>1]=e[f>>1]|16384;return}function ah(a,f,g,h,i){a=a|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0;j=c[a>>2]|0;l=b[f>>1]|0;if(l&20480){a=b[f>>1]|0;a=a&65535;a=a&49151;a=a&65535;b[f>>1]=a;return}k=j+100|0;c[k>>2]=j+24+(d[20267+(l&255|h<<8)>>0]<<2);if(!(wh(j)|0)){a=b[f>>1]|0;a=a&65535;a=a&49151;a=a&65535;b[f>>1]=a;return}h=l>>>4&255;c[k>>2]=j+24+(d[21291+h>>0]<<2);k=wh(j)|0;h=d[21547+h>>0]|0;l=h^k;c[g>>2]=(k|0)!=(h|0)?0-i|0:i;a=c[a+32>>2]|0;i=f+(0-a<<1)|0;h=f+(a<<1)|0;g=f+(~a<<1)|0;b[g>>1]=e[g>>1]|2;b[i>>1]=b[i>>1]|b[3436+(l<<1)>>1];i=f+(1-a<<1)|0;b[i>>1]=e[i>>1]|4;i=f+-2|0;b[i>>1]=b[i>>1]|b[3436+(l+2<<1)>>1];b[f>>1]=e[f>>1]|4096;i=f+2|0;b[i>>1]=b[i>>1]|b[3436+(l+4<<1)>>1];i=f+(a+-1<<1)|0;b[i>>1]=e[i>>1]|1;b[h>>1]=b[h>>1]|b[3436+(l+6<<1)>>1];a=f+(a+1<<1)|0;b[a>>1]=e[a>>1]|8;a=b[f>>1]|0;a=a&65535;a=a&49151;a=a&65535;b[f>>1]=a;return}function bh(a,e,f,g,h,j,k,l,m,n,o,p){a=a|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0;I=i;i=i+16|0;H=I;c[H>>2]=0;q=c[a>>2]|0;D=c[a+4>>2]|0;a=c[D+76>>2]|0;F=a+(e*5640|0)|0;s=(b[D>>1]|0)==4?2:1;t=D+80|0;if(!(c[t>>2]|0))r=1;else r=c[q+16>>2]|0;G=(c[a+(e*5640|0)+420>>2]|0)+1|0;E=Lf(q,D,e,p)|0;if(!E){e=0;i=I;return e|0}c[j>>2]=0;a:do{if(!p){if(r){a=0;b:while(1){p=0;o=E;q=0;while(1){Mf(E,D,e,q,a,n,0);if((c[o+80>>2]|0)==-1){a=9;break b}m=o+36|0;c:while(1){do{if(!(Of(o)|0))break c}while((c[m>>2]|0)>>>0>=g>>>0);c[H>>2]=0;if(!(fh(e,f,F,o,h,H,k,l)|0)){a=13;break b}B=c[H>>2]|0;c[j>>2]=(c[j>>2]|0)+B;k=k-B|0;p=B+p|0;h=h+B|0}B=c[t>>2]|0;if((B|0)!=0&p>>>0>B>>>0){a=17;break b}q=q+1|0;if(q>>>0>>0)o=o+232|0;else break}a=a+1|0;if(a>>>0>=r>>>0)break a}if((a|0)==9){Kf(E,G);e=0;i=I;return e|0}else if((a|0)==13){Kf(E,G);e=0;i=I;return e|0}else if((a|0)==17){Kf(E,G);e=0;i=I;return e|0}}}else{Mf(E,D,e,o,m,n,p);z=E+(o*232|0)|0;if((c[E+(o*232|0)+80>>2]|0)==-1){Kf(E,G);e=0;i=I;return e|0}n=E+(o*232|0)+36|0;u=(l|0)==0;v=f+840|0;w=l+12|0;x=l+8|0;y=l+88|0;t=D+93|0;s=a+(e*5640|0)+5636|0;while(1){do{if(!(Of(z)|0))break a}while((c[n>>2]|0)>>>0>=g>>>0);c[H>>2]=0;if(!(fh(e,f,F,z,h,H,k,l)|0))break;r=c[H>>2]|0;h=h+r|0;k=k-r|0;c[j>>2]=(c[j>>2]|0)+r;if(!u){if(!(c[w>>2]|0))a=c[x>>2]|0;else{q=c[y>>2]|0;a=c[x>>2]|0;o=c[q+(e*592|0)+548>>2]|0;p=o+(a<<5)|0;if(!a){m=(c[q+(e*592|0)+12>>2]|0)+1|0;q=((m|0)<0)<<31>>31;D=p;c[D>>2]=m;c[D+4>>2]=q}else{if((((d[s>>0]|0)>>>2|(d[t>>0]|0)>>>3)&1)!=0?(B=p,A=c[B>>2]|0,B=c[B+4>>2]|0,!((A|0)==0&(B|0)==0)):0){m=A;q=B}else{m=o+(a+-1<<5)+16|0;m=Si(c[m>>2]|0,c[m+4>>2]|0,1,0)|0;q=C}D=p;c[D>>2]=m;c[D+4>>2]=q}p=Si(m|0,q|0,-1,-1)|0;m=C;r=Si(p|0,m|0,r|0,0)|0;D=o+(a<<5)+16|0;c[D>>2]=r;c[D+4>>2]=C;D=o+(a<<5)+8|0;r=D;r=Si(p|0,m|0,c[r>>2]|0,c[r+4>>2]|0)|0;c[D>>2]=r;c[D+4>>2]=C}c[x>>2]=a+1}c[v>>2]=(c[v>>2]|0)+1}Kf(E,G);e=0;i=I;return e|0}}while(0);Kf(E,G);e=1;i=I;return e|0}function ch(a,b,d,e,f,g,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0;$=i;i=i+112|0;W=$+64|0;X=$+32|0;S=$;R=$+96|0;Q=$+92|0;k=c[a>>2]|0;M=a+4|0;Z=c[M>>2]|0;h=c[Z+76>>2]|0;O=h+(b*5640|0)|0;P=h+(b*5640|0)+420|0;Y=(c[P>>2]|0)+1|0;Z=Jf(k,Z,b)|0;if(!Z){aa=0;i=$;return aa|0}N=k+16|0;L=h+(b*5640|0)+12|0;K=d+20|0;J=k+24|0;b=g;a=e;H=Z;I=0;a:while(1){if((c[H+80>>2]|0)==-1){aa=4;break}h=Pc(c[N>>2]<<2)|0;if(!h){aa=6;break}Qi(h|0,1,c[N>>2]<<2|0)|0;if(Of(H)|0){g=H+24|0;d=H+28|0;G=H+36|0;k=H+32|0;F=b;E=a;while(1){if((c[L>>2]|0)>>>0>(c[G>>2]|0)>>>0){b=c[g>>2]|0;a=c[K>>2]|0;if((c[d>>2]|0)>>>0<(c[a+(b*52|0)+20>>2]|0)>>>0){c[h+(b<<2)>>2]=0;D=c[M>>2]|0;c[Q>>2]=0;if(!(gh(D,a,O,H,R,E,Q,F,j)|0)){aa=45;break a}C=c[Q>>2]|0;if(!(c[R>>2]|0))a=C;else{B=F-C|0;z=E+C|0;c[Q>>2]=0;b=c[d>>2]|0;l=c[(c[K>>2]|0)+((c[g>>2]|0)*52|0)+24>>2]|0;x=l+(b*136|0)+24|0;a=c[x>>2]|0;b:do{if(!a){a=z;aa=43}else{y=E+F|0;m=a;D=0;w=l+(b*136|0)+28|0;l=z;c:while(1){a=c[k>>2]|0;b=c[w+20>>2]|0;if(((c[w+8>>2]|0)!=(c[w>>2]|0)?(c[w+12>>2]|0)!=(c[w+4>>2]|0):0)?(V=_(c[b+(a*40|0)+20>>2]|0,c[b+(a*40|0)+16>>2]|0)|0,(V|0)!=0):0){A=0;a=c[b+(a*40|0)+24>>2]|0;p=l;while(1){u=a+40|0;if(!(c[u>>2]|0))b=p;else{v=a+44|0;b=c[v>>2]|0;do{if(!b){o=c[a+4>>2]|0;c[v>>2]=1;c[a+36>>2]=0}else{l=b+-1|0;m=c[a+4>>2]|0;if((c[m+(l<<5)+8>>2]|0)!=(c[m+(l<<5)+20>>2]|0)){o=m+(l<<5)|0;break}c[v>>2]=b+1;o=m+(b<<5)|0}}while(0);t=a+36|0;b=a+32|0;s=p;n=o+28|0;l=c[n>>2]|0;if((l+s|0)>>>0>>0|(p+l|0)>>>0>y>>>0){b=D;a=A;break c}m=c[t>>2]|0;s=p;r=o;while(1){o=l+m|0;if(o>>>0>>0){b=D;a=A;aa=29;break a}p=c[a>>2]|0;if(o>>>0>(c[b>>2]|0)>>>0){l=Tc(p,o)|0;if(!l){aa=32;break a}m=c[t>>2]|0;q=c[n>>2]|0;c[b>>2]=q+m;c[a>>2]=l;p=l;l=q}Ui(p+m|0,s|0,l|0)|0;l=r+8|0;m=c[l>>2]|0;if(!m){c[r>>2]=a;o=c[t>>2]|0;c[r+4>>2]=o}else o=c[t>>2]|0;p=c[n>>2]|0;q=s;s=s+p|0;n=c[r+24>>2]|0;m=n+m|0;c[l>>2]=m;l=c[u>>2]|0;c[u>>2]=l-n;c[r+12>>2]=m;m=p+o|0;c[t>>2]=m;o=r+16|0;c[o>>2]=(c[o>>2]|0)+p;if((l|0)==(n|0)){b=s;break}c[v>>2]=(c[v>>2]|0)+1;o=s;n=r+60|0;l=c[n>>2]|0;if((l+o|0)>>>0>>0?1:(q+(l+p)|0)>>>0>y>>>0){b=D;a=A;break c}else r=r+32|0}c[a+48>>2]=c[v>>2]}A=A+1|0;if(A>>>0>=V>>>0){a=b;break}else{a=a+56|0;p=b}}b=c[x>>2]|0}else{b=m;a=l}D=D+1|0;if(D>>>0>=b>>>0){aa=43;break b}else{m=b;w=w+36|0;l=a}}z=c[k>>2]|0;A=c[d>>2]|0;D=c[g>>2]|0;c[S>>2]=l;c[S+4>>2]=B;c[S+8>>2]=a;c[S+12>>2]=z;c[S+16>>2]=b;c[S+20>>2]=A;c[S+24>>2]=D;Ub(j,2,21803,S)|0;a=c[Q>>2]|0}}while(0);if((aa|0)==43){aa=0;a=a-z|0;c[Q>>2]=a}a=a+C|0}l=c[g>>2]|0;C=c[d>>2]|0;b=(c[J>>2]|0)+(l*52|0)+36|0;D=c[b>>2]|0;c[b>>2]=C>>>0>D>>>0?C:D;b=a}else aa=47}else{a=c[K>>2]|0;aa=47}if((aa|0)==47){aa=0;D=c[M>>2]|0;c[Q>>2]=0;if(!(gh(D,a,O,H,R,E,Q,F,j)|0)){aa=69;break a}u=c[Q>>2]|0;if(!(c[R>>2]|0))a=u;else{l=F-u|0;w=c[d>>2]|0;x=c[g>>2]|0;a=c[(c[K>>2]|0)+(x*52|0)+24>>2]|0;c[Q>>2]=0;t=c[a+(w*136|0)+24>>2]|0;if(!t)a=0;else{v=c[k>>2]|0;b=0;s=a+(w*136|0)+28|0;while(1){m=c[s+20>>2]|0;if(((c[s+8>>2]|0)!=(c[s>>2]|0)?(c[s+12>>2]|0)!=(c[s+4>>2]|0):0)?(T=_(c[m+(v*40|0)+20>>2]|0,c[m+(v*40|0)+16>>2]|0)|0,(T|0)!=0):0){a=0;r=c[m+(v*40|0)+24>>2]|0;while(1){p=r+40|0;d:do{if(c[p>>2]|0){q=r+44|0;m=c[q>>2]|0;do{if(!m){o=c[r+4>>2]|0;c[q>>2]=1;c[r+36>>2]=0}else{n=m+-1|0;o=c[r+4>>2]|0;if((c[o+(n<<5)+8>>2]|0)!=(c[o+(n<<5)+20>>2]|0)){o=o+(n<<5)|0;break}c[q>>2]=m+1;o=o+(m<<5)|0}}while(0);D=c[Q>>2]|0;m=c[o+28>>2]|0;n=m+D|0;if(n>>>0>>0|n>>>0>l>>>0){g=v;d=w;k=x;aa=65;break a}while(1){c[Q>>2]=n;D=c[o+24>>2]|0;C=o+8|0;c[C>>2]=(c[C>>2]|0)+D;C=c[p>>2]|0;c[p>>2]=C-D;if((C|0)==(D|0))break d;c[q>>2]=(c[q>>2]|0)+1;D=c[Q>>2]|0;m=c[o+60>>2]|0;n=m+D|0;if(n>>>0>>0|n>>>0>l>>>0){g=v;d=w;k=x;aa=65;break a}else o=o+32|0}}}while(0);a=a+1|0;if(a>>>0>=T>>>0)break;else r=r+56|0}}b=b+1|0;if(b>>>0>=t>>>0)break;else s=s+36|0}a=c[Q>>2]|0}a=a+u|0}l=c[g>>2]|0;b=a}if((c[h+(l<<2)>>2]|0)!=0?(U=(c[J>>2]|0)+(l*52|0)+36|0,(c[U>>2]|0)==0):0)c[U>>2]=(c[(c[K>>2]|0)+(l*52|0)+20>>2]|0)+-1;a=E+b|0;b=F-b|0;if(!(Of(H)|0))break;else{F=b;E=a}}}Uc(h);I=I+1|0;if(I>>>0>(c[P>>2]|0)>>>0){h=a;aa=75;break}else H=H+232|0}if((aa|0)==4){Kf(Z,Y);aa=0;i=$;return aa|0}else if((aa|0)==6){Kf(Z,Y);aa=0;i=$;return aa|0}else if((aa|0)==29){f=c[k>>2]|0;e=c[d>>2]|0;W=c[g>>2]|0;c[X>>2]=l;c[X+4>>2]=m;c[X+8>>2]=~l;c[X+12>>2]=a;c[X+16>>2]=f;c[X+20>>2]=b;c[X+24>>2]=e;c[X+28>>2]=W;Ub(j,1,21888,X)|0;aa=45}else if((aa|0)==32){Uc(c[a>>2]|0);c[a>>2]=0;c[b>>2]=0;aa=45}else if((aa|0)==65){c[W>>2]=m;c[W+4>>2]=l;c[W+8>>2]=a;c[W+12>>2]=g;c[W+16>>2]=b;c[W+20>>2]=d;c[W+24>>2]=k;Ub(j,1,21987,W)|0;aa=69}else if((aa|0)==75){Kf(Z,Y);c[f>>2]=h-e;aa=1;i=$;return aa|0}if((aa|0)==45){Kf(Z,Y);Uc(h);aa=0;i=$;return aa|0}else if((aa|0)==69){Kf(Z,Y);Uc(h);aa=0;i=$;return aa|0}return 0}function dh(a,b){a=a|0;b=b|0;var d=0;d=Qc(1,8)|0;if(!d){a=0;return a|0}c[d>>2]=a;c[d+4>>2]=b;a=d;return a|0}function eh(a){a=a|0;if(!a)return;Uc(a);return}function fh(b,d,e,f,g,i,j,k){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;i=i|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0,K=0;s=c[f+28>>2]|0;J=c[f+32>>2]|0;K=c[f+36>>2]|0;r=c[(c[d+20>>2]|0)+((c[f+24>>2]|0)*52|0)+24>>2]|0;if(!(c[e>>2]&2))G=g;else{a[g>>0]=-1;a[g+1>>0]=-111;a[g+2>>0]=0;a[g+3>>0]=4;G=d+840|0;a[g+4>>0]=(c[G>>2]|0)>>>8;a[g+5>>0]=c[G>>2];j=j+-6|0;G=g+6|0}if((K|0)==0?(q=r+(s*136|0)+24|0,(c[q>>2]|0)!=0):0){o=r+(s*136|0)+28|0;p=0;while(1){f=c[o+20>>2]|0;kg(c[f+(J*40|0)+32>>2]|0);m=f+(J*40|0)+36|0;kg(c[m>>2]|0);n=_(c[f+(J*40|0)+20>>2]|0,c[f+(J*40|0)+16>>2]|0)|0;if(n){f=f+(J*40|0)+24|0;d=o+28|0;l=0;do{H=c[f>>2]|0;c[H+(l*52|0)+40>>2]=0;ng(c[m>>2]|0,l,(c[d>>2]|0)-(c[H+(l*52|0)+28>>2]|0)|0);l=l+1|0}while((l|0)!=(n|0))}p=p+1|0;if(p>>>0>=(c[q>>2]|0)>>>0)break;else o=o+36|0}}E=wg()|0;if(!E){i=0;return i|0}zg(E,G,j);Bg(E,1,1);F=r+(s*136|0)+28|0;H=r+(s*136|0)+24|0;if(c[H>>2]|0){A=K+1|0;C=F;D=0;while(1){n=c[C+20>>2]|0;B=_(c[n+(J*40|0)+20>>2]|0,c[n+(J*40|0)+16>>2]|0)|0;o=n+(J*40|0)+24|0;f=(B|0)==0;if(!f){d=n+(J*40|0)+32|0;l=c[o>>2]|0;m=0;while(1){if((c[l+40>>2]|0)==0?(c[(c[l+4>>2]|0)+(K*24|0)>>2]|0)!=0:0)ng(c[d>>2]|0,m,K);m=m+1|0;if((m|0)==(B|0))break;else l=l+52|0}if(!f){z=n+(J*40|0)+32|0;y=n+(J*40|0)+36|0;w=c[o>>2]|0;x=0;while(1){f=(c[w+4>>2]|0)+(K*24|0)|0;v=w+40|0;if(!(c[v>>2]|0))og(E,c[z>>2]|0,x,A);else Bg(E,(c[f>>2]|0)!=0&1,1);d=c[f>>2]|0;if(d){if(!(c[v>>2]|0)){c[w+32>>2]=3;og(E,c[y>>2]|0,x,999);d=c[f>>2]|0}a:do{switch(d|0){case 1:{Bg(E,0,1);break}case 2:{Bg(E,2,2);break}default:{if(d>>>0<6){Bg(E,d+-3|12,4);break a}if(d>>>0<37){Bg(E,d+-6|480,9);break a}if(d>>>0<165)Bg(E,d+-37|65408,16)}}}while(0);o=c[v>>2]|0;d=c[f>>2]|0;u=d+o|0;t=w+8|0;if(o>>>0>>0){s=w+32|0;q=o+-1+d|0;m=0;n=0;l=0;r=(c[t>>2]|0)+(o*24|0)|0;while(1){l=l+1|0;n=(c[r+16>>2]|0)+n|0;if((a[r+20>>0]&1)!=0|(o|0)==(q|0)){if((n|0)>1){d=0;do{n=n>>1;d=d+1|0}while((n|0)>1)}else d=0;p=c[s>>2]|0;if((l|0)>1){n=0;do{l=l>>1;n=n+1|0}while((l|0)>1);l=n}else l=0;n=d+1-p-l|0;m=(m|0)>(n|0)?m:n;n=0;l=0}o=o+1|0;if((o|0)==(u|0))break;else r=r+24|0}if((m|0)>0){d=m;while(1){Bg(E,1,1);if((d|0)>1)d=d+-1|0;else{d=n;break}}}else d=n}else{m=0;d=0;l=0}Bg(E,0,1);q=w+32|0;c[q>>2]=(c[q>>2]|0)+m;m=c[v>>2]|0;if(m>>>0>>0){p=(c[t>>2]|0)+(m*24|0)|0;while(1){l=l+1|0;n=(c[p+16>>2]|0)+d|0;if((a[p+20>>0]&1)==0?(m|0)!=((c[v>>2]|0)+-1+(c[f>>2]|0)|0):0)d=n;else{o=c[q>>2]|0;if((l|0)>1){d=0;do{l=l>>1;d=d+1|0}while((l|0)>1)}else d=0;Bg(E,n,d+o|0);d=0;l=0}m=m+1|0;if((m|0)==(u|0))break;else p=p+24|0}}}x=x+1|0;if((x|0)==(B|0))break;else w=w+52|0}}}D=D+1|0;if(D>>>0>=(c[H>>2]|0)>>>0)break;else C=C+36|0}}if(!(Dg(E)|0)){xg(E);i=0;return i|0}d=yg(E)|0;f=G+d|0;j=j-d|0;xg(E);if(c[e>>2]&4){a[f>>0]=-1;a[G+(d+1)>>0]=-110;j=j+-2|0;f=G+(d+2)|0}t=(k|0)!=0;if(t?(c[k+12>>2]|0)!=0:0){G=f-g|0;e=(c[(c[k+88>>2]|0)+(b*592|0)+548>>2]|0)+(c[k+8>>2]<<5)+8|0;c[e>>2]=G;c[e+4>>2]=((G|0)<0)<<31>>31}d=c[H>>2]|0;b:do{if(d){u=k+12|0;v=k+8|0;w=k+88|0;r=F;s=0;c:while(1){l=c[r+20>>2]|0;q=_(c[l+(J*40|0)+20>>2]|0,c[l+(J*40|0)+16>>2]|0)|0;l=c[l+(J*40|0)+24>>2]|0;if(q){if(t){p=0;while(1){o=c[l+4>>2]|0;d=o+(K*24|0)|0;if(c[d>>2]|0){m=o+(K*24|0)+4|0;n=c[m>>2]|0;if(n>>>0>j>>>0){f=0;j=81;break c}Ui(f|0,c[o+(K*24|0)+16>>2]|0,n|0)|0;e=l+40|0;c[e>>2]=(c[e>>2]|0)+(c[d>>2]|0);e=c[m>>2]|0;f=f+e|0;j=j-e|0;if((c[u>>2]|0)!=0?(e=(c[(c[w>>2]|0)+(b*592|0)+548>>2]|0)+(c[v>>2]<<5)+24|0,I=+h[o+(K*24|0)+8>>3]+ +h[e>>3],h[e>>3]=I,+h[k>>3]>3]=I}p=p+1|0;if(p>>>0>=q>>>0)break;else l=l+52|0}}else{p=0;while(1){d=c[l+4>>2]|0;m=d+(K*24|0)|0;if(c[m>>2]|0){n=d+(K*24|0)+4|0;o=c[n>>2]|0;if(o>>>0>j>>>0){f=0;j=81;break c}Ui(f|0,c[d+(K*24|0)+16>>2]|0,o|0)|0;e=l+40|0;c[e>>2]=(c[e>>2]|0)+(c[m>>2]|0);e=c[n>>2]|0;j=j-e|0;f=f+e|0}p=p+1|0;if(p>>>0>=q>>>0)break;else l=l+52|0}}d=c[H>>2]|0}s=s+1|0;if(s>>>0>=d>>>0)break b;else r=r+36|0}if((j|0)==81)return f|0}}while(0);c[i>>2]=f-g+(c[i>>2]|0);i=1;return i|0}function gh(b,d,e,f,g,h,j,k,l){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;N=i;i=i+64|0;L=N+40|0;K=N+32|0;x=N+24|0;w=N+16|0;u=N+8|0;t=N;v=N+48|0;M=N+44|0;c[M>>2]=h;z=c[f+28>>2]|0;J=f+24|0;y=c[d+((c[J>>2]|0)*52|0)+24>>2]|0;H=f+36|0;if((c[H>>2]|0)==0?(s=y+(z*136|0)+24|0,m=c[s>>2]|0,(m|0)!=0):0){r=f+32|0;p=0;q=y+(z*136|0)+28|0;while(1){d=c[r>>2]|0;n=c[q+20>>2]|0;if((c[q+8>>2]|0)!=(c[q>>2]|0)?(c[q+12>>2]|0)!=(c[q+4>>2]|0):0){kg(c[n+(d*40|0)+32>>2]|0);kg(c[n+(d*40|0)+36>>2]|0);m=_(c[n+(d*40|0)+20>>2]|0,c[n+(d*40|0)+16>>2]|0)|0;if(m){o=0;d=c[n+(d*40|0)+24>>2]|0;while(1){c[d+44>>2]=0;c[d+48>>2]=0;o=o+1|0;if((o|0)==(m|0))break;else d=d+56|0}}m=c[s>>2]|0}p=p+1|0;if(p>>>0>=m>>>0)break;else q=q+36|0}}do{if(c[e>>2]&2){if(k>>>0<6){Ub(l,2,22072,t)|0;break}d=c[M>>2]|0;if((a[d>>0]|0)==-1?(a[d+1>>0]|0)==-111:0){c[M>>2]=d+6;break}Ub(l,2,22114,u)|0}}while(0);G=wg()|0;if(!G){h=0;i=N;return h|0}do{if(!(a[b+96>>0]&1))if(!(a[e+5636>>0]&2)){E=c[M>>2]|0;c[v>>2]=h+k-E;F=M;break}else{F=e+5168|0;E=c[F>>2]|0;v=e+5180|0;break}else{F=b+40|0;E=c[F>>2]|0;v=b+44|0}}while(0);Ag(G,E,c[v>>2]|0);if(!(Cg(G,1)|0)){Eg(G)|0;m=yg(G)|0;d=E+m|0;xg(G);do{if(c[e>>2]&4){if(((c[v>>2]|0)-d+(c[F>>2]|0)|0)>>>0<2){Ub(l,2,22135,w)|0;break}if((a[d>>0]|0)==-1?(a[E+(m+1)>>0]|0)==-110:0){d=E+(m+2)|0;break}Ub(l,2,22177,x)|0}}while(0);c[v>>2]=(c[v>>2]|0)+((c[F>>2]|0)-d);c[F>>2]=d;c[g>>2]=0;c[j>>2]=(c[M>>2]|0)-h;h=1;i=N;return h|0}D=y+(z*136|0)+24|0;d=c[D>>2]|0;a:do{if(d){B=f+32|0;C=e+5584|0;A=0;y=y+(z*136|0)+28|0;b:while(1){m=c[B>>2]|0;n=c[y+20>>2]|0;if(((c[y+8>>2]|0)!=(c[y>>2]|0)?(c[y+12>>2]|0)!=(c[y+4>>2]|0):0)?(I=_(c[n+(m*40|0)+20>>2]|0,c[n+(m*40|0)+16>>2]|0)|0,(I|0)!=0):0){b=n+(m*40|0)+32|0;f=n+(m*40|0)+36|0;w=y+28|0;x=0;k=c[n+(m*40|0)+24>>2]|0;while(1){m=k+44|0;if(!(c[m>>2]|0))d=pg(G,c[b>>2]|0,x,(c[H>>2]|0)+1|0)|0;else d=Cg(G,1)|0;c:do{if(!d)c[k+40>>2]=0;else{if(!(c[m>>2]|0)){d=0;while(1)if(!(pg(G,c[f>>2]|0,x,d)|0))d=d+1|0;else break;c[k+24>>2]=1-d+(c[w>>2]|0);c[k+28>>2]=3}do{if(Cg(G,1)|0)if(Cg(G,1)|0){d=Cg(G,2)|0;if((d|0)!=3){d=d+3|0;break}d=Cg(G,5)|0;if((d|0)==31){d=(Cg(G,7)|0)+37|0;break}else{d=d+6|0;break}}else d=2;else d=1}while(0);t=k+40|0;c[t>>2]=d;d=0;while(1)if(!(Cg(G,1)|0))break;else d=d+1|0;u=k+28|0;c[u>>2]=(c[u>>2]|0)+d;m=c[m>>2]|0;do{if(!m){n=c[(c[C>>2]|0)+((c[J>>2]|0)*1080|0)+16>>2]|0;d=k+52|0;if(!(c[d>>2]|0)){c[d>>2]=10;o=k+4|0;m=Tc(c[o>>2]|0,320)|0;if(!m){m=d;n=o;d=o;o=66;break b}c[o>>2]=m}else m=c[k+4>>2]|0;c[m>>2]=0;c[m+4>>2]=0;c[m+8>>2]=0;c[m+12>>2]=0;c[m+16>>2]=0;c[m+20>>2]=0;c[m+24>>2]=0;c[m+28>>2]=0;if(n&4){c[m+20>>2]=1;m=0;break}m=m+20|0;if(!(n&1)){c[m>>2]=109;m=0;break}else{c[m>>2]=10;m=0;break}}else{q=m+-1|0;r=k+4|0;n=c[r>>2]|0;if((c[n+(q<<5)+8>>2]|0)!=(c[n+(q<<5)+20>>2]|0)){d=k+52|0;m=q;break}p=c[(c[C>>2]|0)+((c[J>>2]|0)*1080|0)+16>>2]|0;d=k+52|0;o=c[d>>2]|0;if((m+1|0)>>>0>o>>>0){z=o+10|0;c[d>>2]=z;n=Tc(n,z<<5)|0;if(!n){n=r;m=d;d=r;o=77;break b}c[r>>2]=n}z=n+(m<<5)|0;c[z>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;c[z+12>>2]=0;c[z+16>>2]=0;c[z+20>>2]=0;c[z+24>>2]=0;c[z+28>>2]=0;if(p&4){c[n+(m<<5)+20>>2]=1;break}if(!(p&1)){c[n+(m<<5)+20>>2]=109;break}else{z=c[n+(q<<5)+20>>2]|0;c[n+(m<<5)+20>>2]=(z|0)==1|(z|0)==10?2:1;break}}}while(0);s=k+4|0;q=c[t>>2]|0;while(1){p=c[s>>2]|0;n=(c[p+(m<<5)+20>>2]|0)-(c[p+(m<<5)+8>>2]|0)|0;n=(n|0)<(q|0)?n:q;c[p+(m<<5)+24>>2]=n;p=c[u>>2]|0;if(n>>>0>1){o=0;while(1){o=o+1|0;if(n>>>0>3)n=n>>>1;else{n=o;break}}}else n=0;p=Cg(G,n+p|0)|0;n=c[s>>2]|0;c[n+(m<<5)+28>>2]=p;p=q-(c[n+(m<<5)+24>>2]|0)|0;if((p|0)<=0)break c;q=m+1|0;r=c[(c[C>>2]|0)+((c[J>>2]|0)*1080|0)+16>>2]|0;o=c[d>>2]|0;if((m+2|0)>>>0>o>>>0){z=o+10|0;c[d>>2]=z;n=Tc(n,z<<5)|0;if(!n){n=s;m=s;o=90;break b}c[s>>2]=n}z=n+(q<<5)|0;c[z>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;c[z+12>>2]=0;c[z+16>>2]=0;c[z+20>>2]=0;c[z+24>>2]=0;c[z+28>>2]=0;if(r&4){c[n+(q<<5)+20>>2]=1;m=q;q=p;continue}if(!(r&1)){c[n+(q<<5)+20>>2]=109;m=q;q=p;continue}else{z=c[n+(m<<5)+20>>2]|0;c[n+(q<<5)+20>>2]=(z|0)==1|(z|0)==10?2:1;m=q;q=p;continue}}}}while(0);x=x+1|0;if(x>>>0>=I>>>0)break;else k=k+56|0}d=c[D>>2]|0}A=A+1|0;if(A>>>0>=d>>>0)break a;else y=y+36|0}if((o|0)==66){Uc(c[d>>2]|0);c[n>>2]=0;c[m>>2]=0;xg(G);h=0;i=N;return h|0}else if((o|0)==77){Uc(c[d>>2]|0);c[n>>2]=0;c[m>>2]=0;xg(G);h=0;i=N;return h|0}else if((o|0)==90){Uc(c[m>>2]|0);c[n>>2]=0;c[d>>2]=0;xg(G);h=0;i=N;return h|0}}}while(0);if(!(Eg(G)|0)){xg(G);h=0;i=N;return h|0}m=yg(G)|0;d=E+m|0;xg(G);do{if(c[e>>2]&4){if(((c[v>>2]|0)-d+(c[F>>2]|0)|0)>>>0<2){Ub(l,2,22135,K)|0;break}if((a[d>>0]|0)==-1?(a[E+(m+1)>>0]|0)==-110:0){d=E+(m+2)|0;break}Ub(l,2,22177,L)|0}}while(0);c[v>>2]=(c[v>>2]|0)+((c[F>>2]|0)-d);c[F>>2]=d;c[g>>2]=1;c[j>>2]=(c[M>>2]|0)-h;h=1;i=N;return h|0}function hh(){return Pc(104)|0}function ih(a){a=a|0;if(!a)return;Uc(a);return}function jh(a){a=a|0;return(c[a+12>>2]|0)-(c[a+16>>2]|0)|0}function kh(b,d){b=b|0;d=d|0;var e=0,f=0;c[b+100>>2]=b+24;c[b+4>>2]=32768;c[b>>2]=0;f=d+-1|0;c[b+12>>2]=f;e=b+8|0;c[e>>2]=12;c[e>>2]=(a[f>>0]|0)==-1?13:12;c[b+16>>2]=d;return}function lh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;g=c[b+100>>2]|0;h=c[g>>2]|0;j=(c[h+4>>2]|0)==(d|0);f=c[h>>2]|0;k=b+4|0;d=(c[k>>2]|0)-f|0;c[k>>2]=d;if(!j){if(d>>>0>>0){j=(c[b>>2]|0)+f|0;c[b>>2]=j;f=d;d=j;j=b}else{c[k>>2]=f;d=c[b>>2]|0;j=b}c[g>>2]=c[h+12>>2];i=b+8|0;h=b+12|0;g=d;d=c[i>>2]|0;while(1){f=f<<1;c[k>>2]=f;e=g<<1;c[j>>2]=e;d=d+-1|0;c[i>>2]=d;if(!d){d=c[h>>2]|0;f=a[d>>0]|0;do{if(f<<24>>24!=-1){if(!(e&134217728)){e=d+1|0;c[h>>2]=e;a[e>>0]=g>>>18;e=c[j>>2]&524287;c[j>>2]=e;c[i>>2]=8;d=8;break}a[d>>0]=f+1<<24>>24;d=c[h>>2]|0;if((a[d>>0]|0)==-1){b=c[j>>2]&134217727;c[j>>2]=b;e=d+1|0;c[h>>2]=e;a[e>>0]=b>>>20;e=c[j>>2]&1048575;c[j>>2]=e;c[i>>2]=7;d=7;break}else{e=d+1|0;c[h>>2]=e;a[e>>0]=(c[j>>2]|0)>>>19;e=c[j>>2]&524287;c[j>>2]=e;c[i>>2]=8;d=8;break}}else{e=d+1|0;c[h>>2]=e;a[e>>0]=g>>>19;e=c[j>>2]&1048575;c[j>>2]=e;c[i>>2]=7;d=7}}while(0);f=c[k>>2]|0}if(!(f&32768))g=e;else break}return}if(d&32768){c[b>>2]=(c[b>>2]|0)+f;return}if(d>>>0>>0){c[k>>2]=f;e=c[b>>2]|0;j=b}else{e=(c[b>>2]|0)+f|0;c[b>>2]=e;f=d;j=b}c[g>>2]=c[h+8>>2];i=b+8|0;h=b+12|0;g=e;d=c[i>>2]|0;while(1){f=f<<1;c[k>>2]=f;e=g<<1;c[j>>2]=e;d=d+-1|0;c[i>>2]=d;if(!d){d=c[h>>2]|0;f=a[d>>0]|0;do{if(f<<24>>24!=-1){if(!(e&134217728)){e=d+1|0;c[h>>2]=e;a[e>>0]=g>>>18;e=c[j>>2]&524287;c[j>>2]=e;c[i>>2]=8;d=8;break}a[d>>0]=f+1<<24>>24;d=c[h>>2]|0;if((a[d>>0]|0)==-1){b=c[j>>2]&134217727;c[j>>2]=b;e=d+1|0;c[h>>2]=e;a[e>>0]=b>>>20;e=c[j>>2]&1048575;c[j>>2]=e;c[i>>2]=7;d=7;break}else{e=d+1|0;c[h>>2]=e;a[e>>0]=(c[j>>2]|0)>>>19;e=c[j>>2]&524287;c[j>>2]=e;c[i>>2]=8;d=8;break}}else{e=d+1|0;c[h>>2]=e;a[e>>0]=g>>>19;e=c[j>>2]&1048575;c[j>>2]=e;c[i>>2]=7;d=7}}while(0);f=c[k>>2]|0}if(!(f&32768))g=e;else break}return}function mh(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;h=c[b>>2]|0;f=h|65535;g=b+8|0;f=(f>>>0<((c[b+4>>2]|0)+h|0)>>>0?f:f+-32768|0)<>2];c[b>>2]=f;h=b+12|0;d=c[h>>2]|0;e=a[d>>0]|0;do{if(e<<24>>24!=-1){if(!(f&134217728)){d=d+1|0;c[h>>2]=d;a[d>>0]=f>>>19;d=c[b>>2]&524287;c[b>>2]=d;c[g>>2]=8;e=8;break}a[d>>0]=e+1<<24>>24;d=c[h>>2]|0;if((a[d>>0]|0)==-1){e=c[b>>2]&134217727;c[b>>2]=e;d=d+1|0;c[h>>2]=d;a[d>>0]=e>>>20;d=c[b>>2]&1048575;c[b>>2]=d;c[g>>2]=7;e=7;break}else{d=d+1|0;c[h>>2]=d;a[d>>0]=(c[b>>2]|0)>>>19;d=c[b>>2]&524287;c[b>>2]=d;c[g>>2]=8;e=8;break}}else{d=d+1|0;c[h>>2]=d;a[d>>0]=f>>>20;d=c[b>>2]&1048575;c[b>>2]=d;c[g>>2]=7;e=7}}while(0);d=d<>2]=d;e=c[h>>2]|0;f=a[e>>0]|0;do{if(f<<24>>24!=-1){if(!(d&134217728)){f=e+1|0;c[h>>2]=f;a[f>>0]=d>>>19;c[b>>2]=c[b>>2]&524287;c[g>>2]=8;break}a[e>>0]=f+1<<24>>24;d=c[h>>2]|0;if((a[d>>0]|0)==-1){e=c[b>>2]&134217727;c[b>>2]=e;f=d+1|0;c[h>>2]=f;a[f>>0]=e>>>20;c[b>>2]=c[b>>2]&1048575;c[g>>2]=7;break}else{f=d+1|0;c[h>>2]=f;a[f>>0]=(c[b>>2]|0)>>>19;c[b>>2]=c[b>>2]&524287;c[g>>2]=8;break}}else{f=e+1|0;c[h>>2]=f;a[f>>0]=d>>>20;c[b>>2]=c[b>>2]&1048575;c[g>>2]=7}}while(0);d=c[h>>2]|0;if((a[d>>0]|0)==-1)return;c[h>>2]=d+1;return}function nh(a){a=a|0;c[a>>2]=0;c[a+8>>2]=8;return}function oh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;e=b+8|0;f=(c[e>>2]|0)+-1|0;c[e>>2]=f;d=(d<>2]|0)|0;c[b>>2]=d;if(f)return;f=b+12|0;g=(c[f>>2]|0)+1|0;c[f>>2]=g;a[g>>0]=d;c[e>>2]=8;c[e>>2]=(a[c[f>>2]>>0]|0)==-1?7:8;c[b>>2]=0;return}function ph(a){a=a|0;c[a+28>>2]=1156;c[a+32>>2]=1156;c[a+36>>2]=1156;c[a+40>>2]=1156;c[a+44>>2]=1156;c[a+48>>2]=1156;c[a+52>>2]=1156;c[a+56>>2]=1156;c[a+60>>2]=1156;c[a+64>>2]=1156;c[a+68>>2]=1156;c[a+72>>2]=1156;c[a+76>>2]=1156;c[a+80>>2]=1156;c[a+84>>2]=1156;c[a+88>>2]=1156;c[a+96>>2]=2628;c[a+92>>2]=1252;c[a+24>>2]=1284;return}function qh(a){a=a|0;c[a+24>>2]=1156;c[a+28>>2]=1156;c[a+32>>2]=1156;c[a+36>>2]=1156;c[a+40>>2]=1156;c[a+44>>2]=1156;c[a+48>>2]=1156;c[a+52>>2]=1156;c[a+56>>2]=1156;c[a+60>>2]=1156;c[a+64>>2]=1156;c[a+68>>2]=1156;c[a+72>>2]=1156;c[a+76>>2]=1156;c[a+80>>2]=1156;c[a+84>>2]=1156;c[a+88>>2]=1156;c[a+92>>2]=1156;c[a+96>>2]=1156;return}function rh(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;c[a+24+(b<<2)>>2]=1156+((e<<1)+d<<4);return}function sh(b){b=b|0;var d=0,e=0;c[b+100>>2]=b+24;c[b+4>>2]=32768;c[b>>2]=0;d=b+8|0;c[d>>2]=12;e=b+12|0;b=(c[e>>2]|0)+-1|0;c[e>>2]=b;if((a[b>>0]|0)!=-1)return;c[d>>2]=13;return}function th(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;i=b+8|0;d=c[i>>2]|0;f=12-d|0;if((f|0)>0){g=b+12|0;e=c[b>>2]|0;do{d=e<>2]=d;c[i>>2]=0;e=c[g>>2]|0;h=a[e>>0]|0;do{if(h<<24>>24!=-1){if(!(d&134217728)){e=e+1|0;c[g>>2]=e;a[e>>0]=d>>>19;e=c[b>>2]&524287;c[b>>2]=e;c[i>>2]=8;d=8;break}a[e>>0]=h+1<<24>>24;d=c[g>>2]|0;if((a[d>>0]|0)==-1){h=c[b>>2]&134217727;c[b>>2]=h;e=d+1|0;c[g>>2]=e;a[e>>0]=h>>>20;e=c[b>>2]&1048575;c[b>>2]=e;c[i>>2]=7;d=7;break}else{e=d+1|0;c[g>>2]=e;a[e>>0]=(c[b>>2]|0)>>>19;e=c[b>>2]&524287;c[b>>2]=e;c[i>>2]=8;d=8;break}}else{e=e+1|0;c[g>>2]=e;a[e>>0]=d>>>20;e=c[b>>2]&1048575;c[b>>2]=e;c[i>>2]=7;d=7}}while(0);f=f-d|0}while((f|0)>0)}else g=b+12|0;d=c[g>>2]|0;e=a[d>>0]|0;if(e<<24>>24==-1)return;f=c[b>>2]|0;if(!(f&134217728)){h=d+1|0;c[g>>2]=h;a[h>>0]=f>>>19;c[b>>2]=c[b>>2]&524287;c[i>>2]=8;return}a[d>>0]=e+1<<24>>24;d=c[g>>2]|0;if((a[d>>0]|0)==-1){f=c[b>>2]&134217727;c[b>>2]=f;h=d+1|0;c[g>>2]=h;a[h>>0]=f>>>20;c[b>>2]=c[b>>2]&1048575;c[i>>2]=7;return}else{h=d+1|0;c[g>>2]=h;a[h>>0]=(c[b>>2]|0)>>>19;c[b>>2]=c[b>>2]&524287;c[i>>2]=8;return}}function uh(a){a=a|0;c[a+100>>2]=a+96;lh(a,1);lh(a,0);lh(a,1);lh(a,0);return}function vh(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0;c[b+100>>2]=b+24;c[b+16>>2]=e;c[b+20>>2]=e+f;h=b+12|0;c[h>>2]=e;do{if(f){i=d[e>>0]<<16;c[b>>2]=i;g=e+1|0;if((f|0)==1)f=255;else f=d[g>>0]|0;if((a[e>>0]|0)!=-1){c[h>>2]=g;g=i|f<<8;c[b>>2]=g;f=b+8|0;c[f>>2]=8;h=b;i=1;break}if(f>>>0>143){g=i|65280;c[b>>2]=g;f=b+8|0;c[f>>2]=8;h=b;i=1;break}else{c[h>>2]=g;g=i+(f<<9)|0;c[b>>2]=g;f=b+8|0;c[f>>2]=7;h=b;i=0;break}}else{c[b>>2]=16776960;f=b+8|0;c[f>>2]=8;g=16776960;h=b;i=1}}while(0);c[h>>2]=g<<7;c[f>>2]=i;c[b+4>>2]=32768;return 1}function wh(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=c[b+100>>2]|0;g=c[f>>2]|0;j=c[g>>2]|0;n=b+4|0;i=(c[n>>2]|0)-j|0;c[n>>2]=i;h=c[b>>2]|0;if(h>>>16>>>0>>0){c[n>>2]=j;e=c[g+4>>2]|0;if(i>>>0>>0)c[f>>2]=c[g+8>>2];else{c[f>>2]=c[g+12>>2];e=1-e|0}k=b+8|0;l=b+12|0;m=b+20|0;g=c[k>>2]|0;f=h;do{do{if(!g){h=c[l>>2]|0;g=c[m>>2]|0;if((h|0)==(g|0)){f=f+65280|0;c[b>>2]=f;c[k>>2]=8;g=8;break}i=h+1|0;if((i|0)==(g|0))g=255;else g=d[i>>0]|0;if((a[h>>0]|0)!=-1){c[l>>2]=i;f=f+(g<<8)|0;c[b>>2]=f;c[k>>2]=8;g=8;break}if(g>>>0>143){f=f+65280|0;c[b>>2]=f;c[k>>2]=8;g=8;break}else{c[l>>2]=i;f=f+(g<<9)|0;c[b>>2]=f;c[k>>2]=7;g=7;break}}}while(0);j=j<<1;c[n>>2]=j;f=f<<1;c[b>>2]=f;g=g+-1|0;c[k>>2]=g}while(j>>>0<32768);return e|0}h=h-(j<<16)|0;c[b>>2]=h;if(i&32768){b=c[g+4>>2]|0;return b|0}e=c[g+4>>2]|0;if(j>>>0>i>>>0){c[f>>2]=c[g+12>>2];e=1-e|0}else c[f>>2]=c[g+8>>2];k=b+8|0;l=b+12|0;m=b+20|0;g=c[k>>2]|0;f=h;j=i;do{do{if(!g){h=c[l>>2]|0;g=c[m>>2]|0;if((h|0)==(g|0)){f=f+65280|0;c[b>>2]=f;c[k>>2]=8;g=8;break}i=h+1|0;if((i|0)==(g|0))g=255;else g=d[i>>0]|0;if((a[h>>0]|0)!=-1){c[l>>2]=i;f=f+(g<<8)|0;c[b>>2]=f;c[k>>2]=8;g=8;break}if(g>>>0>143){f=f+65280|0;c[b>>2]=f;c[k>>2]=8;g=8;break}else{c[l>>2]=i;f=f+(g<<9)|0;c[b>>2]=f;c[k>>2]=7;g=7;break}}}while(0);j=j<<1;c[n>>2]=j;f=f<<1;c[b>>2]=f;g=g+-1|0;c[k>>2]=g}while(j>>>0<32768);return e|0}function xh(){return Pc(28)|0}function yh(a){a=a|0;if(!a)return;Uc(a);return}function zh(b,d,e){b=b|0;d=d|0;e=e|0;c[b+20>>2]=d;c[b+8>>2]=e;c[b+12>>2]=0;a[b>>0]=0;c[b+4>>2]=0;return}function Ah(b){b=b|0;var d=0,e=0,f=0,g=0,h=0;g=b+4|0;d=c[g>>2]|0;do{if(!d){c[g>>2]=8;e=b+12|0;f=c[e>>2]|0;if((f|0)==(c[b+8>>2]|0)){a[b>>0]=-1;d=8;e=-1;break}if((a[b>>0]|0)==-1){c[g>>2]=7;d=7}else d=8;h=a[(c[b+20>>2]|0)+f>>0]|0;a[b>>0]=h;c[e>>2]=f+1;e=h}else e=a[b>>0]|0}while(0);h=d+-1|0;c[g>>2]=h;return(e&255)>>>h&1|0}function Bh(){var a=0;if(!(c[665]|0))a=2712;else a=c[(Ca()|0)+60>>2]|0;return a|0}function Ch(b){b=b|0;var c=0,e=0;c=0;while(1){if((d[22198+c>>0]|0)==(b|0)){e=2;break}c=c+1|0;if((c|0)==87){c=87;b=22286;e=5;break}}if((e|0)==2)if(!c)b=22286;else{b=22286;e=5}if((e|0)==5)while(1){e=b;while(1){b=e+1|0;if(!(a[e>>0]|0))break;else e=b}c=c+-1|0;if(!c)break;else e=5}return b|0}function Dh(a){a=a|0;if(a>>>0>4294963200){c[(Bh()|0)>>2]=0-a;a=-1}return a|0}function Eh(a,b){a=+a;b=b|0;var d=0,e=0,f=0;h[k>>3]=a;d=c[k>>2]|0;e=c[k+4>>2]|0;f=Ti(d|0,e|0,52)|0;f=f&2047;switch(f|0){case 0:{if(a!=0.0){a=+Eh(a*18446744073709551616.0,b);d=(c[b>>2]|0)+-64|0}else d=0;c[b>>2]=d;break}case 2047:break;default:{c[b>>2]=f+-1022;c[k>>2]=d;c[k+4>>2]=e&-2146435073|1071644672;a=+h[k>>3]}}return+a}function Fh(a,b){a=+a;b=b|0;return+ +Eh(a,b)}function Gh(a,b){a=+a;b=b|0;return+ +Jh(a,b)}function Hh(a){a=+a;return~~+Ih(a)|0}function Ih(a){a=+a;var b=0;b=(g[k>>2]=a,c[k>>2]|0);if((b&2130706432)>>>0<=1249902592){b=(b|0)<0;a=b?a+-8388608.0+8388608.0:a+8388608.0+-8388608.0;if(a==0.0)a=b?-0.0:0.0}return+a}function Jh(a,b){a=+a;b=b|0;var d=0;if((b|0)>1023){a=a*8988465674311579538646525.0e283;d=b+-1023|0;if((d|0)>1023){d=b+-2046|0;d=(d|0)>1023?1023:d;a=a*8988465674311579538646525.0e283}}else if((b|0)<-1022){a=a*2.2250738585072014e-308;d=b+1022|0;if((d|0)<-1022){d=b+2044|0;d=(d|0)<-1022?-1022:d;a=a*2.2250738585072014e-308}}else d=b;d=Ri(d+1023|0,0,52)|0;b=C;c[k>>2]=d;c[k+4>>2]=b;return+(a*+h[k>>3])}function Kh(b,d,e){b=b|0;d=d|0;e=e|0;do{if(b){if(d>>>0<128){a[b>>0]=d;b=1;break}if(d>>>0<2048){a[b>>0]=d>>>6|192;a[b+1>>0]=d&63|128;b=2;break}if(d>>>0<55296|(d&-8192|0)==57344){a[b>>0]=d>>>12|224;a[b+1>>0]=d>>>6&63|128;a[b+2>>0]=d&63|128;b=3;break}if((d+-65536|0)>>>0<1048576){a[b>>0]=d>>>18|240;a[b+1>>0]=d>>>12&63|128;a[b+2>>0]=d>>>6&63|128;a[b+3>>0]=d&63|128;b=4;break}else{c[(Bh()|0)>>2]=84;b=-1;break}}else b=1}while(0);return b|0}function Lh(a,b){a=a|0;b=b|0;if(!a)a=0;else a=Kh(a,b,0)|0;return a|0}function Mh(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0;o=i;i=i+112|0;n=o+40|0;l=o+24|0;k=o+16|0;g=o;m=o+52|0;f=a[d>>0]|0;if(ri(24090,f<<24>>24,4)|0){e=Fi(1144)|0;if(!e)e=0;else{h=e;j=h+112|0;do{c[h>>2]=0;h=h+4|0}while((h|0)<(j|0));if(!(ti(d,43)|0))c[e>>2]=f<<24>>24==114?8:4;if(ti(d,101)|0){c[g>>2]=b;c[g+4>>2]=2;c[g+8>>2]=1;ra(221,g|0)|0;f=a[d>>0]|0}if(f<<24>>24==97){c[k>>2]=b;c[k+4>>2]=3;f=ra(221,k|0)|0;if(!(f&1024)){c[l>>2]=b;c[l+4>>2]=4;c[l+8>>2]=f|1024;ra(221,l|0)|0}d=c[e>>2]|128;c[e>>2]=d}else d=c[e>>2]|0;c[e+60>>2]=b;c[e+44>>2]=e+120;c[e+48>>2]=1024;f=e+75|0;a[f>>0]=-1;if((d&8|0)==0?(c[n>>2]=b,c[n+4>>2]=21505,c[n+8>>2]=m,(Fa(54,n|0)|0)==0):0)a[f>>0]=10;c[e+32>>2]=60;c[e+36>>2]=61;c[e+40>>2]=3;c[e+12>>2]=1;if(!(c[666]|0))c[e+76>>2]=-1;Ia(2688);f=c[671]|0;c[e+56>>2]=f;if(f)c[f+52>>2]=e;c[671]=e;Ga(2688)}}else{c[(Bh()|0)>>2]=22;e=0}i=o;return e|0}function Nh(b){b=b|0;var c=0,d=0,e=0;d=(ti(b,43)|0)==0;c=a[b>>0]|0;d=d?c<<24>>24!=114&1:2;e=(ti(b,120)|0)==0;d=e?d:d|128;b=(ti(b,101)|0)==0;b=b?d:d|524288;b=c<<24>>24==114?b:b|64;b=c<<24>>24==119?b|512:b;return(c<<24>>24==97?b|1024:b)|0}function Oh(a){a=a|0;return 0}function Ph(a){a=a|0;return}function Qh(b,e){b=b|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;l=m;k=e&255;a[l>>0]=k;g=b+16|0;h=c[g>>2]|0;if(!h)if(!(Xh(b)|0)){h=c[g>>2]|0;j=4}else f=-1;else j=4;do{if((j|0)==4){g=b+20|0;j=c[g>>2]|0;if(j>>>0>>0?(f=e&255,(f|0)!=(a[b+75>>0]|0)):0){c[g>>2]=j+1;a[j>>0]=k;break}if((Ra[c[b+36>>2]&63](b,l,1)|0)==1)f=d[l>>0]|0;else f=-1}}while(0);i=m;return f|0}function Rh(a){a=a|0;var b=0,d=0;b=i;i=i+16|0;d=b;c[d>>2]=c[a+60>>2];a=Dh(Ja(6,d|0)|0)|0;i=b;return a|0}function Sh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+48|0;h=m+16|0;g=m;f=m+32|0;c[f>>2]=d;j=f+4|0;l=b+48|0;n=c[l>>2]|0;c[j>>2]=e-((n|0)!=0&1);k=b+44|0;c[f+8>>2]=c[k>>2];c[f+12>>2]=n;if(!(c[665]|0)){c[h>>2]=c[b+60>>2];c[h+4>>2]=f;c[h+8>>2]=2;f=Dh(Na(145,h|0)|0)|0}else{ua(5,b|0);c[g>>2]=c[b+60>>2];c[g+4>>2]=f;c[g+8>>2]=2;f=Dh(Na(145,g|0)|0)|0;qa(0)}if((f|0)>=1){j=c[j>>2]|0;if(f>>>0>j>>>0){h=c[k>>2]|0;g=b+4|0;c[g>>2]=h;c[b+8>>2]=h+(f-j);if(!(c[l>>2]|0))f=e;else{c[g>>2]=h+1;a[d+(e+-1)>>0]=a[h>>0]|0;f=e}}}else{c[b>>2]=c[b>>2]|f&48^16;c[b+8>>2]=0;c[b+4>>2]=0}i=m;return f|0}function Th(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;f=i;i=i+32|0;g=f;e=f+20|0;c[g>>2]=c[a+60>>2];c[g+4>>2]=0;c[g+8>>2]=b;c[g+12>>2]=e;c[g+16>>2]=d;if((Dh(Ma(140,g|0)|0)|0)<0){c[e>>2]=-1;a=-1}else a=c[e>>2]|0;i=f;return a|0}function Uh(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+48|0;n=q+16|0;m=q;e=q+32|0;o=a+28|0;f=c[o>>2]|0;c[e>>2]=f;p=a+20|0;f=(c[p>>2]|0)-f|0;c[e+4>>2]=f;c[e+8>>2]=b;c[e+12>>2]=d;k=a+60|0;l=a+44|0;b=2;f=f+d|0;while(1){if(!(c[665]|0)){c[n>>2]=c[k>>2];c[n+4>>2]=e;c[n+8>>2]=b;h=Dh(Oa(146,n|0)|0)|0}else{ua(6,a|0);c[m>>2]=c[k>>2];c[m+4>>2]=e;c[m+8>>2]=b;h=Dh(Oa(146,m|0)|0)|0;qa(0)}if((f|0)==(h|0)){f=6;break}if((h|0)<0){f=8;break}f=f-h|0;g=c[e+4>>2]|0;if(h>>>0<=g>>>0)if((b|0)==2){c[o>>2]=(c[o>>2]|0)+h;j=g;b=2}else j=g;else{j=c[l>>2]|0;c[o>>2]=j;c[p>>2]=j;j=c[e+12>>2]|0;h=h-g|0;e=e+8|0;b=b+-1|0}c[e>>2]=(c[e>>2]|0)+h;c[e+4>>2]=j-h}if((f|0)==6){n=c[l>>2]|0;c[a+16>>2]=n+(c[a+48>>2]|0);a=n;c[o>>2]=a;c[p>>2]=a}else if((f|0)==8){c[a+16>>2]=0;c[o>>2]=0;c[p>>2]=0;c[a>>2]=c[a>>2]|32;if((b|0)==2)d=0;else d=d-(c[e+4>>2]|0)|0}i=q;return d|0}function Vh(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+80|0;f=g;c[b+36>>2]=61;if((c[b>>2]&64|0)==0?(c[f>>2]=c[b+60>>2],c[f+4>>2]=21505,c[f+8>>2]=g+12,(Fa(54,f|0)|0)!=0):0)a[b+75>>0]=-1;f=Uh(b,d,e)|0;i=g;return f|0}function Wh(b){b=b|0;var d=0,e=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;d=b+20|0;e=b+44|0;if((c[d>>2]|0)>>>0>(c[e>>2]|0)>>>0)Ra[c[b+36>>2]&63](b,0,0)|0;c[b+16>>2]=0;c[b+28>>2]=0;c[d>>2]=0;d=c[b>>2]|0;if(d&20)if(!(d&4))d=-1;else{c[b>>2]=d|32;d=-1}else{d=c[e>>2]|0;c[b+8>>2]=d;c[b+4>>2]=d;d=0}return d|0}function Xh(b){b=b|0;var d=0,e=0;d=b+74|0;e=a[d>>0]|0;a[d>>0]=e+255|e;d=c[b>>2]|0;if(!(d&8)){c[b+8>>2]=0;c[b+4>>2]=0;d=c[b+44>>2]|0;c[b+28>>2]=d;c[b+20>>2]=d;c[b+16>>2]=d+(c[b+48>>2]|0);d=0}else{c[b>>2]=d|32;d=-1}return d|0}function Yh(a){a=a|0;var b=0,d=0,e=0;e=(c[a>>2]&1|0)!=0;if(!e){Ia(2688);d=c[a+52>>2]|0;b=a+56|0;if(d)c[d+56>>2]=c[b>>2];b=c[b>>2]|0;if(b)c[b+52>>2]=d;if((c[671]|0)==(a|0))c[671]=b;Ga(2688)}b=Zh(a)|0;b=Wa[c[a+12>>2]&15](a)|0|b;d=c[a+92>>2]|0;if(d)Gi(d);if(!e)Gi(a);return b|0}function Zh(a){a=a|0;var b=0,d=0;do{if(a){if((c[a+76>>2]|0)<=-1){b=zi(a)|0;break}d=(Oh(a)|0)==0;b=zi(a)|0;if(!d)Ph(a)}else{if(!(c[677]|0))b=0;else b=Zh(c[677]|0)|0;Ia(2688);a=c[671]|0;if(a)do{if((c[a+76>>2]|0)>-1)d=Oh(a)|0;else d=0;if((c[a+20>>2]|0)>>>0>(c[a+28>>2]|0)>>>0)b=zi(a)|0|b;if(d)Ph(a);a=c[a+56>>2]|0}while((a|0)!=0);Ga(2688)}}while(0);return b|0}function _h(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0;g=i;i=i+32|0;f=g+16|0;e=g;if(ri(24090,a[d>>0]|0,4)|0){h=Nh(d)|0|32768;c[e>>2]=b;c[e+4>>2]=h;c[e+8>>2]=438;e=Dh(Ka(5,e|0)|0)|0;if((e|0)>=0){b=Mh(e,d)|0;if(!b){c[f>>2]=e;Ja(6,f|0)|0;b=0}}else b=0}else{c[(Bh()|0)>>2]=22;b=0}i=g;return b|0}function $h(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=i;i=i+16|0;f=e;c[f>>2]=d;d=oi(a,b,f)|0;i=e;return d|0}function ai(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;if((c[d+76>>2]|0)>=0?(Oh(d)|0)!=0:0){if((a[d+75>>0]|0)!=(b|0)?(f=d+20|0,g=c[f>>2]|0,g>>>0<(c[d+16>>2]|0)>>>0):0){c[f>>2]=g+1;a[g>>0]=b;e=b&255}else e=Qh(d,b)|0;Ph(d)}else i=3;do{if((i|0)==3){if((a[d+75>>0]|0)!=(b|0)?(h=d+20|0,e=c[h>>2]|0,e>>>0<(c[d+16>>2]|0)>>>0):0){c[h>>2]=e+1;a[e>>0]=b;e=b&255;break}e=Qh(d,b)|0}}while(0);return e|0}function bi(a,b){a=a|0;b=b|0;return(ki(a,wi(a)|0,1,b)|0)+-1|0}function ci(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0;j=_(e,d)|0;if((c[f+76>>2]|0)>-1)k=Oh(f)|0;else k=0;g=f+74|0;h=a[g>>0]|0;a[g>>0]=h+255|h;g=f+4|0;h=c[g>>2]|0;i=(c[f+8>>2]|0)-h|0;if((i|0)>0){i=i>>>0>>0?i:j;Ui(b|0,h|0,i|0)|0;c[g>>2]=h+i;b=b+i|0;g=j-i|0}else g=j;a:do{if(!g)l=13;else{i=f+32|0;h=g;while(1){if(Wh(f)|0){e=h;break}g=Ra[c[i>>2]&63](f,b,h)|0;if((g+1|0)>>>0<2){e=h;break}if((h|0)==(g|0)){l=13;break a}else{b=b+g|0;h=h-g|0}}if(k)Ph(f);e=((j-e|0)>>>0)/(d>>>0)|0}}while(0);if((l|0)==13)if(k)Ph(f);return e|0}function di(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;if((d|0)==1)b=b-(c[a+8>>2]|0)+(c[a+4>>2]|0)|0;f=a+20|0;e=a+28|0;if((c[f>>2]|0)>>>0>(c[e>>2]|0)>>>0?(Ra[c[a+36>>2]&63](a,0,0)|0,(c[f>>2]|0)==0):0)b=-1;else{c[a+16>>2]=0;c[e>>2]=0;c[f>>2]=0;if((Ra[c[a+40>>2]&63](a,b,d)|0)<0)b=-1;else{c[a+8>>2]=0;c[a+4>>2]=0;c[a>>2]=c[a>>2]&-17;b=0}}return b|0}function ei(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;if((c[a+76>>2]|0)>-1){e=(Oh(a)|0)==0;b=di(a,b,d)|0;if(!e)Ph(a)}else b=di(a,b,d)|0;return b|0}function fi(a,b,c){a=a|0;b=b|0;c=c|0;return ei(a,b,c)|0}function gi(a){a=a|0;var b=0;if(!(c[a>>2]&128))b=1;else b=(c[a+20>>2]|0)>>>0>(c[a+28>>2]|0)>>>0?2:1;b=Ra[c[a+40>>2]&63](a,0,b)|0;if((b|0)>=0)b=b-(c[a+8>>2]|0)+(c[a+4>>2]|0)+(c[a+20>>2]|0)-(c[a+28>>2]|0)|0;return b|0}function hi(a){a=a|0;var b=0;if((c[a+76>>2]|0)>-1){b=(Oh(a)|0)==0;a=gi(a)|0}else a=gi(a)|0;return a|0}function ii(a){a=a|0;return hi(a)|0}function ji(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=e+16|0;g=c[f>>2]|0;if(!g)if(!(Xh(e)|0)){g=c[f>>2]|0;h=4}else f=0;else h=4;a:do{if((h|0)==4){i=e+20|0;h=c[i>>2]|0;if((g-h|0)>>>0>>0){f=Ra[c[e+36>>2]&63](e,b,d)|0;break}b:do{if((a[e+75>>0]|0)>-1){f=d;while(1){if(!f){g=h;f=0;break b}g=f+-1|0;if((a[b+g>>0]|0)==10)break;else f=g}if((Ra[c[e+36>>2]&63](e,b,f)|0)>>>0>>0)break a;d=d-f|0;b=b+f|0;g=c[i>>2]|0}else{g=h;f=0}}while(0);Ui(g|0,b|0,d|0)|0;c[i>>2]=(c[i>>2]|0)+d;f=f+d|0}}while(0);return f|0}function ki(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;f=_(d,b)|0;if((c[e+76>>2]|0)>-1){g=(Oh(e)|0)==0;a=ji(a,f,e)|0;if(!g)Ph(e)}else a=ji(a,f,e)|0;if((a|0)!=(f|0))d=(a>>>0)/(b>>>0)|0;return d|0}function li(a,b){a=a|0;b=b|0;var d=0,e=0;d=i;i=i+16|0;e=d;c[e>>2]=b;b=oi(c[676]|0,a,e)|0;i=d;return b|0}function mi(b){b=b|0;var d=0,e=0,f=0,g=0;f=c[676]|0;if((c[f+76>>2]|0)>-1)g=Oh(f)|0;else g=0;do{if((bi(b,f)|0)<0)d=1;else{if((a[f+75>>0]|0)!=10?(d=f+20|0,e=c[d>>2]|0,e>>>0<(c[f+16>>2]|0)>>>0):0){c[d>>2]=e+1;a[e>>0]=10;d=0;break}d=(Qh(f,10)|0)<0}}while(0);if(g)Ph(f);return d<<31>>31|0}function ni(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=i;i=i+16|0;f=e;c[f>>2]=d;d=qi(a,b,f)|0;i=e;return d|0}function oi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+224|0;o=s+80|0;r=s+96|0;q=s;p=s+136|0;f=r;g=f+40|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(g|0));c[o>>2]=c[e>>2];if((Ai(0,d,o,q,r)|0)<0)e=-1;else{if((c[b+76>>2]|0)>-1)m=Oh(b)|0;else m=0;e=c[b>>2]|0;n=e&32;if((a[b+74>>0]|0)<1)c[b>>2]=e&-33;e=b+48|0;if(!(c[e>>2]|0)){g=b+44|0;h=c[g>>2]|0;c[g>>2]=p;j=b+28|0;c[j>>2]=p;k=b+20|0;c[k>>2]=p;c[e>>2]=80;l=b+16|0;c[l>>2]=p+80;f=Ai(b,d,o,q,r)|0;if(h){Ra[c[b+36>>2]&63](b,0,0)|0;f=(c[k>>2]|0)==0?-1:f;c[g>>2]=h;c[e>>2]=0;c[l>>2]=0;c[j>>2]=0;c[k>>2]=0}}else f=Ai(b,d,o,q,r)|0;e=c[b>>2]|0;c[b>>2]=e|n;if(m)Ph(b);e=(e&32|0)==0?f:-1}i=s;return e|0}function pi(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0;n=i;i=i+128|0;g=n+112|0;m=n;h=m;j=2716;k=h+112|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));if((d+-1|0)>>>0>2147483646)if(!d){d=1;l=4}else{c[(Bh()|0)>>2]=75;d=-1}else{g=b;l=4}if((l|0)==4){l=-2-g|0;l=d>>>0>l>>>0?l:d;c[m+48>>2]=l;b=m+20|0;c[b>>2]=g;c[m+44>>2]=g;d=g+l|0;g=m+16|0;c[g>>2]=d;c[m+28>>2]=d;d=oi(m,e,f)|0;if(l){e=c[b>>2]|0;a[e+(((e|0)==(c[g>>2]|0))<<31>>31)>>0]=0}}i=n;return d|0}function qi(a,b,c){a=a|0;b=b|0;c=c|0;return pi(a,2147483647,b,c)|0}function ri(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;h=d&255;f=(e|0)!=0;a:do{if(f&(b&3|0)!=0){g=d&255;while(1){if((a[b>>0]|0)==g<<24>>24){i=6;break a}b=b+1|0;e=e+-1|0;f=(e|0)!=0;if(!(f&(b&3|0)!=0)){i=5;break}}}else i=5}while(0);if((i|0)==5)if(f)i=6;else e=0;b:do{if((i|0)==6){g=d&255;if((a[b>>0]|0)!=g<<24>>24){f=_(h,16843009)|0;c:do{if(e>>>0>3)while(1){h=c[b>>2]^f;if((h&-2139062144^-2139062144)&h+-16843009)break;b=b+4|0;e=e+-4|0;if(e>>>0<=3){i=11;break c}}else i=11}while(0);if((i|0)==11)if(!e){e=0;break}while(1){if((a[b>>0]|0)==g<<24>>24)break b;b=b+1|0;e=e+-1|0;if(!e){e=0;break}}}}}while(0);return((e|0)!=0?b:0)|0}function si(b,d){b=b|0;d=d|0;var e=0,f=0;e=d;a:do{if(!((e^b)&3)){if(e&3)do{e=a[d>>0]|0;a[b>>0]=e;if(!(e<<24>>24))break a;d=d+1|0;b=b+1|0}while((d&3|0)!=0);e=c[d>>2]|0;if(!((e&-2139062144^-2139062144)&e+-16843009)){f=b;while(1){d=d+4|0;b=f+4|0;c[f>>2]=e;e=c[d>>2]|0;if((e&-2139062144^-2139062144)&e+-16843009)break;else f=b}}f=8}else f=8}while(0);if((f|0)==8){f=a[d>>0]|0;a[b>>0]=f;if(f<<24>>24)do{d=d+1|0;b=b+1|0;f=a[d>>0]|0;a[b>>0]=f}while(f<<24>>24!=0)}return b|0}function ti(b,c){b=b|0;c=c|0;b=ui(b,c)|0;return((a[b>>0]|0)==(c&255)<<24>>24?b:0)|0}function ui(b,d){b=b|0;d=d|0;var e=0,f=0,g=0;f=d&255;a:do{if(!f)b=b+(wi(b)|0)|0;else{if(b&3){e=d&255;do{g=a[b>>0]|0;if(g<<24>>24==0?1:g<<24>>24==e<<24>>24)break a;b=b+1|0}while((b&3|0)!=0)}f=_(f,16843009)|0;e=c[b>>2]|0;b:do{if(!((e&-2139062144^-2139062144)&e+-16843009))do{g=e^f;if((g&-2139062144^-2139062144)&g+-16843009)break b;b=b+4|0;e=c[b>>2]|0}while(((e&-2139062144^-2139062144)&e+-16843009|0)==0)}while(0);e=d&255;while(1){g=a[b>>0]|0;if(g<<24>>24==0?1:g<<24>>24==e<<24>>24)break;else b=b+1|0}}}while(0);return b|0}function vi(a,b){a=a|0;b=b|0;si(a,b)|0;return a|0}function wi(b){b=b|0;var d=0,e=0,f=0;f=b;a:do{if(!(f&3))e=4;else{d=b;b=f;while(1){if(!(a[d>>0]|0))break a;d=d+1|0;b=d;if(!(b&3)){b=d;e=4;break}}}}while(0);if((e|0)==4){while(1){d=c[b>>2]|0;if(!((d&-2139062144^-2139062144)&d+-16843009))b=b+4|0;else break}if((d&255)<<24>>24)do{b=b+1|0}while((a[b>>0]|0)!=0)}return b-f|0}function xi(a){a=a|0;if(!(c[a+68>>2]|0))Ph(a);return}function yi(a){a=a|0;if(!(c[a+68>>2]|0))Ph(a);return}function zi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0;b=a+20|0;g=a+28|0;if((c[b>>2]|0)>>>0>(c[g>>2]|0)>>>0?(Ra[c[a+36>>2]&63](a,0,0)|0,(c[b>>2]|0)==0):0)b=-1;else{h=a+4|0;d=c[h>>2]|0;e=a+8|0;f=c[e>>2]|0;if(d>>>0>>0)Ra[c[a+40>>2]&63](a,d-f|0,1)|0;c[a+16>>2]=0;c[g>>2]=0;c[b>>2]=0;c[e>>2]=0;c[h>>2]=0;b=0}return b|0}function Ai(e,f,g,j,l){e=e|0;f=f|0;g=g|0;j=j|0;l=l|0;var m=0,n=0,o=0,p=0,q=0.0,r=0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0;ha=i;i=i+624|0;ca=ha+24|0;ea=ha+16|0;da=ha+588|0;Y=ha+576|0;ba=ha;V=ha+536|0;ga=ha+8|0;fa=ha+528|0;M=(e|0)!=0;N=V+40|0;U=N;V=V+39|0;W=ga+4|0;X=Y+12|0;Y=Y+11|0;Z=da;$=X;aa=$-Z|0;O=-2-Z|0;P=$+2|0;Q=ca+288|0;R=da+9|0;S=R;T=da+8|0;m=0;w=f;n=0;f=0;a:while(1){do{if((m|0)>-1)if((n|0)>(2147483647-m|0)){c[(Bh()|0)>>2]=75;m=-1;break}else{m=n+m|0;break}}while(0);n=a[w>>0]|0;if(!(n<<24>>24)){L=245;break}else o=w;b:while(1){switch(n<<24>>24){case 37:{n=o;L=9;break b}case 0:{n=o;break b}default:{}}K=o+1|0;n=a[K>>0]|0;o=K}c:do{if((L|0)==9)while(1){L=0;if((a[n+1>>0]|0)!=37)break c;o=o+1|0;n=n+2|0;if((a[n>>0]|0)==37)L=9;else break}}while(0);y=o-w|0;if(M?(c[e>>2]&32|0)==0:0)ji(w,y,e)|0;if((o|0)!=(w|0)){w=n;n=y;continue}r=n+1|0;o=a[r>>0]|0;p=(o<<24>>24)+-48|0;if(p>>>0<10){K=(a[n+2>>0]|0)==36;r=K?n+3|0:r;o=a[r>>0]|0;u=K?p:-1;f=K?1:f}else u=-1;n=o<<24>>24;d:do{if((n&-32|0)==32){p=0;while(1){if(!(1<>24)+-32|p;r=r+1|0;o=a[r>>0]|0;n=o<<24>>24;if((n&-32|0)!=32){s=p;n=r;break}}}else{s=0;n=r}}while(0);do{if(o<<24>>24==42){p=n+1|0;o=(a[p>>0]|0)+-48|0;if(o>>>0<10?(a[n+2>>0]|0)==36:0){c[l+(o<<2)>>2]=10;f=1;n=n+3|0;o=c[j+((a[p>>0]|0)+-48<<3)>>2]|0}else{if(f){m=-1;break a}if(!M){x=s;n=p;f=0;K=0;break}f=(c[g>>2]|0)+(4-1)&~(4-1);o=c[f>>2]|0;c[g>>2]=f+4;f=0;n=p}if((o|0)<0){x=s|8192;K=0-o|0}else{x=s;K=o}}else{p=(o<<24>>24)+-48|0;if(p>>>0<10){o=0;do{o=(o*10|0)+p|0;n=n+1|0;p=(a[n>>0]|0)+-48|0}while(p>>>0<10);if((o|0)<0){m=-1;break a}else{x=s;K=o}}else{x=s;K=0}}}while(0);e:do{if((a[n>>0]|0)==46){p=n+1|0;o=a[p>>0]|0;if(o<<24>>24!=42){r=(o<<24>>24)+-48|0;if(r>>>0<10){n=p;o=0}else{n=p;r=0;break}while(1){o=(o*10|0)+r|0;n=n+1|0;r=(a[n>>0]|0)+-48|0;if(r>>>0>=10){r=o;break e}}}p=n+2|0;o=(a[p>>0]|0)+-48|0;if(o>>>0<10?(a[n+3>>0]|0)==36:0){c[l+(o<<2)>>2]=10;n=n+4|0;r=c[j+((a[p>>0]|0)+-48<<3)>>2]|0;break}if(f){m=-1;break a}if(M){n=(c[g>>2]|0)+(4-1)&~(4-1);r=c[n>>2]|0;c[g>>2]=n+4;n=p}else{n=p;r=0}}else r=-1}while(0);t=0;while(1){o=(a[n>>0]|0)+-65|0;if(o>>>0>57){m=-1;break a}p=n+1|0;o=a[25126+(t*58|0)+o>>0]|0;s=o&255;if((s+-1|0)>>>0<8){n=p;t=s}else{J=p;break}}if(!(o<<24>>24)){m=-1;break}p=(u|0)>-1;do{if(o<<24>>24==19)if(p){m=-1;break a}else L=52;else{if(p){c[l+(u<<2)>>2]=s;H=j+(u<<3)|0;I=c[H+4>>2]|0;L=ba;c[L>>2]=c[H>>2];c[L+4>>2]=I;L=52;break}if(!M){m=0;break a}Ci(ba,s,g)}}while(0);if((L|0)==52?(L=0,!M):0){w=J;n=y;continue}u=a[n>>0]|0;u=(t|0)!=0&(u&15|0)==3?u&-33:u;p=x&-65537;I=(x&8192|0)==0?x:p;f:do{switch(u|0){case 110:switch(t|0){case 0:{c[c[ba>>2]>>2]=m;w=J;n=y;continue a}case 1:{c[c[ba>>2]>>2]=m;w=J;n=y;continue a}case 2:{w=c[ba>>2]|0;c[w>>2]=m;c[w+4>>2]=((m|0)<0)<<31>>31;w=J;n=y;continue a}case 3:{b[c[ba>>2]>>1]=m;w=J;n=y;continue a}case 4:{a[c[ba>>2]>>0]=m;w=J;n=y;continue a}case 6:{c[c[ba>>2]>>2]=m;w=J;n=y;continue a}case 7:{w=c[ba>>2]|0;c[w>>2]=m;c[w+4>>2]=((m|0)<0)<<31>>31;w=J;n=y;continue a}default:{w=J;n=y;continue a}}case 112:{t=I|8;r=r>>>0>8?r:8;u=120;L=64;break}case 88:case 120:{t=I;L=64;break}case 111:{p=ba;o=c[p>>2]|0;p=c[p+4>>2]|0;if((o|0)==0&(p|0)==0)n=N;else{n=N;do{n=n+-1|0;a[n>>0]=o&7|48;o=Ti(o|0,p|0,3)|0;p=C}while(!((o|0)==0&(p|0)==0))}if(!(I&8)){o=I;t=0;s=25606;L=77}else{t=U-n+1|0;o=I;r=(r|0)<(t|0)?t:r;t=0;s=25606;L=77}break}case 105:case 100:{o=ba;n=c[o>>2]|0;o=c[o+4>>2]|0;if((o|0)<0){n=Oi(0,0,n|0,o|0)|0;o=C;p=ba;c[p>>2]=n;c[p+4>>2]=o;p=1;s=25606;L=76;break f}if(!(I&2048)){s=I&1;p=s;s=(s|0)==0?25606:25608;L=76}else{p=1;s=25607;L=76}break}case 117:{o=ba;n=c[o>>2]|0;o=c[o+4>>2]|0;p=0;s=25606;L=76;break}case 99:{a[V>>0]=c[ba>>2];w=V;o=1;t=0;u=25606;n=N;break}case 109:{n=Ch(c[(Bh()|0)>>2]|0)|0;L=82;break}case 115:{n=c[ba>>2]|0;n=(n|0)!=0?n:25616;L=82;break}case 67:{c[ga>>2]=c[ba>>2];c[W>>2]=0;c[ba>>2]=ga;r=-1;L=86;break}case 83:{if(!r){Ei(e,32,K,0,I);n=0;L=98}else L=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{q=+h[ba>>3];c[ea>>2]=0;h[k>>3]=q;if((c[k+4>>2]|0)>=0)if(!(I&2048)){H=I&1;G=H;H=(H|0)==0?25624:25629}else{G=1;H=25626}else{q=-q;G=1;H=25623}h[k>>3]=q;F=c[k+4>>2]&2146435072;do{if(F>>>0<2146435072|(F|0)==2146435072&0<0){v=+Fh(q,ea)*2.0;o=v!=0.0;if(o)c[ea>>2]=(c[ea>>2]|0)+-1;D=u|32;if((D|0)==97){w=u&32;y=(w|0)==0?H:H+9|0;x=G|2;n=12-r|0;do{if(!(r>>>0>11|(n|0)==0)){q=8.0;do{n=n+-1|0;q=q*16.0}while((n|0)!=0);if((a[y>>0]|0)==45){q=-(q+(-v-q));break}else{q=v+q-q;break}}else q=v}while(0);o=c[ea>>2]|0;n=(o|0)<0?0-o|0:o;n=Di(n,((n|0)<0)<<31>>31,X)|0;if((n|0)==(X|0)){a[Y>>0]=48;n=Y}a[n+-1>>0]=(o>>31&2)+43;t=n+-2|0;a[t>>0]=u+15;s=(r|0)<1;p=(I&8|0)==0;o=da;while(1){H=~~q;n=o+1|0;a[o>>0]=d[25590+H>>0]|w;q=(q-+(H|0))*16.0;do{if((n-Z|0)==1){if(p&(s&q==0.0))break;a[n>>0]=46;n=o+2|0}}while(0);if(!(q!=0.0))break;else o=n}r=(r|0)!=0&(O+n|0)<(r|0)?P+r-t|0:aa-t+n|0;p=r+x|0;Ei(e,32,K,p,I);if(!(c[e>>2]&32))ji(y,x,e)|0;Ei(e,48,K,p,I^65536);n=n-Z|0;if(!(c[e>>2]&32))ji(da,n,e)|0;o=$-t|0;Ei(e,48,r-(n+o)|0,0,0);if(!(c[e>>2]&32))ji(t,o,e)|0;Ei(e,32,K,p,I^8192);n=(p|0)<(K|0)?K:p;break}n=(r|0)<0?6:r;if(o){o=(c[ea>>2]|0)+-28|0;c[ea>>2]=o;q=v*268435456.0}else{q=v;o=c[ea>>2]|0}F=(o|0)<0?ca:Q;E=F;o=F;do{B=~~q>>>0;c[o>>2]=B;o=o+4|0;q=(q-+(B>>>0))*1.0e9}while(q!=0.0);p=o;o=c[ea>>2]|0;if((o|0)>0){s=F;while(1){t=(o|0)>29?29:o;r=p+-4|0;do{if(r>>>0>>0)r=s;else{o=0;do{B=Ri(c[r>>2]|0,0,t|0)|0;B=Si(B|0,C|0,o|0,0)|0;o=C;A=$i(B|0,o|0,1e9,0)|0;c[r>>2]=A;o=_i(B|0,o|0,1e9,0)|0;r=r+-4|0}while(r>>>0>=s>>>0);if(!o){r=s;break}r=s+-4|0;c[r>>2]=o}}while(0);while(1){if(p>>>0<=r>>>0)break;o=p+-4|0;if(!(c[o>>2]|0))p=o;else break}o=(c[ea>>2]|0)-t|0;c[ea>>2]=o;if((o|0)>0)s=r;else break}}else r=F;if((o|0)<0){y=((n+25|0)/9|0)+1|0;z=(D|0)==102;w=r;while(1){x=0-o|0;x=(x|0)>9?9:x;do{if(w>>>0

    >>0){o=(1<>>x;r=0;t=w;do{B=c[t>>2]|0;c[t>>2]=(B>>>x)+r;r=_(B&o,s)|0;t=t+4|0}while(t>>>0

    >>0);o=(c[w>>2]|0)==0?w+4|0:w;if(!r){r=o;break}c[p>>2]=r;r=o;p=p+4|0}else r=(c[w>>2]|0)==0?w+4|0:w}while(0);o=z?F:r;p=(p-o>>2|0)>(y|0)?o+(y<<2)|0:p;o=(c[ea>>2]|0)+x|0;c[ea>>2]=o;if((o|0)>=0){w=r;break}else w=r}}else w=r;do{if(w>>>0

    >>0){o=(E-w>>2)*9|0;s=c[w>>2]|0;if(s>>>0<10)break;else r=10;do{r=r*10|0;o=o+1|0}while(s>>>0>=r>>>0)}else o=0}while(0);A=(D|0)==103;B=(n|0)!=0;r=n-((D|0)!=102?o:0)+((B&A)<<31>>31)|0;if((r|0)<(((p-E>>2)*9|0)+-9|0)){t=r+9216|0;z=(t|0)/9|0;r=F+(z+-1023<<2)|0;t=((t|0)%9|0)+1|0;if((t|0)<9){s=10;do{s=s*10|0;t=t+1|0}while((t|0)!=9)}else s=10;x=c[r>>2]|0;y=(x>>>0)%(s>>>0)|0;if((y|0)==0?(F+(z+-1022<<2)|0)==(p|0):0)s=w;else L=163;do{if((L|0)==163){L=0;v=(((x>>>0)/(s>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;t=(s|0)/2|0;do{if(y>>>0>>0)q=.5;else{if((y|0)==(t|0)?(F+(z+-1022<<2)|0)==(p|0):0){q=1.0;break}q=1.5}}while(0);do{if(G){if((a[H>>0]|0)!=45)break;v=-v;q=-q}}while(0);t=x-y|0;c[r>>2]=t;if(!(v+q!=v)){s=w;break}D=t+s|0;c[r>>2]=D;if(D>>>0>999999999){o=w;while(1){s=r+-4|0;c[r>>2]=0;if(s>>>0>>0){o=o+-4|0;c[o>>2]=0}D=(c[s>>2]|0)+1|0;c[s>>2]=D;if(D>>>0>999999999)r=s;else{w=o;r=s;break}}}o=(E-w>>2)*9|0;t=c[w>>2]|0;if(t>>>0<10){s=w;break}else s=10;do{s=s*10|0;o=o+1|0}while(t>>>0>=s>>>0);s=w}}while(0);D=r+4|0;w=s;p=p>>>0>D>>>0?D:p}y=0-o|0;while(1){if(p>>>0<=w>>>0){z=0;D=p;break}r=p+-4|0;if(!(c[r>>2]|0))p=r;else{z=1;D=p;break}}do{if(A){n=(B&1^1)+n|0;if((n|0)>(o|0)&(o|0)>-5){u=u+-1|0;n=n+-1-o|0}else{u=u+-2|0;n=n+-1|0}p=I&8;if(p)break;do{if(z){p=c[D+-4>>2]|0;if(!p){r=9;break}if(!((p>>>0)%10|0)){s=10;r=0}else{r=0;break}do{s=s*10|0;r=r+1|0}while(((p>>>0)%(s>>>0)|0|0)==0)}else r=9}while(0);p=((D-E>>2)*9|0)+-9|0;if((u|32|0)==102){p=p-r|0;p=(p|0)<0?0:p;n=(n|0)<(p|0)?n:p;p=0;break}else{p=p+o-r|0;p=(p|0)<0?0:p;n=(n|0)<(p|0)?n:p;p=0;break}}else p=I&8}while(0);x=n|p;s=(x|0)!=0&1;t=(u|32|0)==102;if(t){o=(o|0)>0?o:0;u=0}else{r=(o|0)<0?y:o;r=Di(r,((r|0)<0)<<31>>31,X)|0;if(($-r|0)<2)do{r=r+-1|0;a[r>>0]=48}while(($-r|0)<2);a[r+-1>>0]=(o>>31&2)+43;E=r+-2|0;a[E>>0]=u;o=$-E|0;u=E}y=G+1+n+s+o|0;Ei(e,32,K,y,I);if(!(c[e>>2]&32))ji(H,G,e)|0;Ei(e,48,K,y,I^65536);do{if(t){r=w>>>0>F>>>0?F:w;o=r;do{p=Di(c[o>>2]|0,0,R)|0;do{if((o|0)==(r|0)){if((p|0)!=(R|0))break;a[T>>0]=48;p=T}else{if(p>>>0<=da>>>0)break;do{p=p+-1|0;a[p>>0]=48}while(p>>>0>da>>>0)}}while(0);if(!(c[e>>2]&32))ji(p,S-p|0,e)|0;o=o+4|0}while(o>>>0<=F>>>0);do{if(x){if(c[e>>2]&32)break;ji(25658,1,e)|0}}while(0);if((n|0)>0&o>>>0>>0){p=o;while(1){o=Di(c[p>>2]|0,0,R)|0;if(o>>>0>da>>>0)do{o=o+-1|0;a[o>>0]=48}while(o>>>0>da>>>0);if(!(c[e>>2]&32))ji(o,(n|0)>9?9:n,e)|0;p=p+4|0;o=n+-9|0;if(!((n|0)>9&p>>>0>>0)){n=o;break}else n=o}}Ei(e,48,n+9|0,9,0)}else{t=z?D:w+4|0;if((n|0)>-1){s=(p|0)==0;r=w;do{o=Di(c[r>>2]|0,0,R)|0;if((o|0)==(R|0)){a[T>>0]=48;o=T}do{if((r|0)==(w|0)){p=o+1|0;if(!(c[e>>2]&32))ji(o,1,e)|0;if(s&(n|0)<1){o=p;break}if(c[e>>2]&32){o=p;break}ji(25658,1,e)|0;o=p}else{if(o>>>0<=da>>>0)break;do{o=o+-1|0;a[o>>0]=48}while(o>>>0>da>>>0)}}while(0);p=S-o|0;if(!(c[e>>2]&32))ji(o,(n|0)>(p|0)?p:n,e)|0;n=n-p|0;r=r+4|0}while(r>>>0>>0&(n|0)>-1)}Ei(e,48,n+18|0,18,0);if(c[e>>2]&32)break;ji(u,$-u|0,e)|0}}while(0);Ei(e,32,K,y,I^8192);n=(y|0)<(K|0)?K:y}else{t=(u&32|0)!=0;s=q!=q|0.0!=0.0;o=s?0:G;r=o+3|0;Ei(e,32,K,r,p);n=c[e>>2]|0;if(!(n&32)){ji(H,o,e)|0;n=c[e>>2]|0}if(!(n&32))ji(s?t?25650:25654:t?25642:25646,3,e)|0;Ei(e,32,K,r,I^8192);n=(r|0)<(K|0)?K:r}}while(0);w=J;continue a}default:{p=I;o=r;t=0;u=25606;n=N}}}while(0);g:do{if((L|0)==64){p=ba;o=c[p>>2]|0;p=c[p+4>>2]|0;s=u&32;if(!((o|0)==0&(p|0)==0)){n=N;do{n=n+-1|0;a[n>>0]=d[25590+(o&15)>>0]|s;o=Ti(o|0,p|0,4)|0;p=C}while(!((o|0)==0&(p|0)==0));L=ba;if((t&8|0)==0|(c[L>>2]|0)==0&(c[L+4>>2]|0)==0){o=t;t=0;s=25606;L=77}else{o=t;t=2;s=25606+(u>>4)|0;L=77}}else{n=N;o=t;t=0;s=25606;L=77}}else if((L|0)==76){n=Di(n,o,N)|0;o=I;t=p;L=77}else if((L|0)==82){L=0;I=ri(n,0,r)|0;H=(I|0)==0;w=n;o=H?r:I-n|0;t=0;u=25606;n=H?n+r|0:I}else if((L|0)==86){L=0;o=0;n=0;s=c[ba>>2]|0;while(1){p=c[s>>2]|0;if(!p)break;n=Lh(fa,p)|0;if((n|0)<0|n>>>0>(r-o|0)>>>0)break;o=n+o|0;if(r>>>0>o>>>0)s=s+4|0;else break}if((n|0)<0){m=-1;break a}Ei(e,32,K,o,I);if(!o){n=0;L=98}else{p=0;r=c[ba>>2]|0;while(1){n=c[r>>2]|0;if(!n){n=o;L=98;break g}n=Lh(fa,n)|0;p=n+p|0;if((p|0)>(o|0)){n=o;L=98;break g}if(!(c[e>>2]&32))ji(fa,n,e)|0;if(p>>>0>=o>>>0){n=o;L=98;break}else r=r+4|0}}}}while(0);if((L|0)==98){L=0;Ei(e,32,K,n,I^8192);w=J;n=(K|0)>(n|0)?K:n;continue}if((L|0)==77){L=0;p=(r|0)>-1?o&-65537:o;o=ba;o=(c[o>>2]|0)!=0|(c[o+4>>2]|0)!=0;if((r|0)!=0|o){o=(o&1^1)+(U-n)|0;w=n;o=(r|0)>(o|0)?r:o;u=s;n=N}else{w=N;o=0;u=s;n=N}}s=n-w|0;o=(o|0)<(s|0)?s:o;r=t+o|0;n=(K|0)<(r|0)?r:K;Ei(e,32,n,r,p);if(!(c[e>>2]&32))ji(u,t,e)|0;Ei(e,48,n,r,p^65536);Ei(e,48,o,s,0);if(!(c[e>>2]&32))ji(w,s,e)|0;Ei(e,32,n,r,p^8192);w=J}h:do{if((L|0)==245)if(!e)if(f){m=1;while(1){f=c[l+(m<<2)>>2]|0;if(!f)break;Ci(j+(m<<3)|0,f,g);m=m+1|0;if((m|0)>=10){m=1;break h}}if((m|0)<10)while(1){if(c[l+(m<<2)>>2]|0){m=-1;break h}m=m+1|0;if((m|0)>=10){m=1;break}}else m=1}else m=0}while(0);i=ha;return m|0}function Bi(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;e=a+20|0;f=c[e>>2]|0;a=(c[a+16>>2]|0)-f|0;a=a>>>0>d>>>0?d:a;Ui(f|0,b|0,a|0)|0;c[e>>2]=(c[e>>2]|0)+a;return d|0}function Ci(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0.0;a:do{if(b>>>0<=20)do{switch(b|0){case 9:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;c[a>>2]=b;break a}case 10:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=b;c[e+4>>2]=((b|0)<0)<<31>>31;break a}case 11:{e=(c[d>>2]|0)+(4-1)&~(4-1);b=c[e>>2]|0;c[d>>2]=e+4;e=a;c[e>>2]=b;c[e+4>>2]=0;break a}case 12:{e=(c[d>>2]|0)+(8-1)&~(8-1);b=e;f=c[b>>2]|0;b=c[b+4>>2]|0;c[d>>2]=e+8;e=a;c[e>>2]=f;c[e+4>>2]=b;break a}case 13:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;e=(e&65535)<<16>>16;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a}case 14:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e&65535;c[f+4>>2]=0;break a}case 15:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;e=(e&255)<<24>>24;f=a;c[f>>2]=e;c[f+4>>2]=((e|0)<0)<<31>>31;break a}case 16:{f=(c[d>>2]|0)+(4-1)&~(4-1);e=c[f>>2]|0;c[d>>2]=f+4;f=a;c[f>>2]=e&255;c[f+4>>2]=0;break a}case 17:{f=(c[d>>2]|0)+(8-1)&~(8-1);g=+h[f>>3];c[d>>2]=f+8;h[a>>3]=g;break a}case 18:{f=(c[d>>2]|0)+(8-1)&~(8-1);g=+h[f>>3];c[d>>2]=f+8;h[a>>3]=g;break a}default:break a}}while(0)}while(0);return}function Di(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if(c>>>0>0|(c|0)==0&b>>>0>4294967295)while(1){e=$i(b|0,c|0,10,0)|0;d=d+-1|0;a[d>>0]=e|48;e=_i(b|0,c|0,10,0)|0;if(c>>>0>9|(c|0)==9&b>>>0>4294967295){b=e;c=C}else{b=e;break}}if(b)while(1){d=d+-1|0;a[d>>0]=(b>>>0)%10|0|48;if(b>>>0<10)break;else b=(b>>>0)/10|0}return d|0}function Ei(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0;j=i;i=i+256|0;h=j;do{if((d|0)>(e|0)&(f&73728|0)==0){f=d-e|0;Qi(h|0,b|0,(f>>>0>256?256:f)|0)|0;b=c[a>>2]|0;g=(b&32|0)==0;if(f>>>0>255){e=d-e|0;do{if(g){ji(h,256,a)|0;b=c[a>>2]|0}f=f+-256|0;g=(b&32|0)==0}while(f>>>0>255);if(g)f=e&255;else break}else if(!g)break;ji(h,f,a)|0}}while(0);i=j;return}function Fi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;do{if(a>>>0<245){o=a>>>0<11?16:a+11&-8;a=o>>>3;i=c[735]|0;d=i>>>a;if(d&3){a=(d&1^1)+a|0;e=a<<1;d=2980+(e<<2)|0;e=2980+(e+2<<2)|0;f=c[e>>2]|0;g=f+8|0;h=c[g>>2]|0;do{if((d|0)!=(h|0)){if(h>>>0<(c[739]|0)>>>0)ta();b=h+12|0;if((c[b>>2]|0)==(f|0)){c[b>>2]=d;c[e>>2]=h;break}else ta()}else c[735]=i&~(1<>2]=M|3;M=f+(M|4)|0;c[M>>2]=c[M>>2]|1;M=g;return M|0}h=c[737]|0;if(o>>>0>h>>>0){if(d){e=2<>>12&16;e=e>>>j;f=e>>>5&8;e=e>>>f;g=e>>>2&4;e=e>>>g;d=e>>>1&2;e=e>>>d;a=e>>>1&1;a=(f|j|g|d|a)+(e>>>a)|0;e=a<<1;d=2980+(e<<2)|0;e=2980+(e+2<<2)|0;g=c[e>>2]|0;j=g+8|0;f=c[j>>2]|0;do{if((d|0)!=(f|0)){if(f>>>0<(c[739]|0)>>>0)ta();b=f+12|0;if((c[b>>2]|0)==(g|0)){c[b>>2]=d;c[e>>2]=f;k=c[737]|0;break}else ta()}else{c[735]=i&~(1<>2]=o|3;i=g+o|0;c[g+(o|4)>>2]=h|1;c[g+M>>2]=h;if(k){f=c[740]|0;d=k>>>3;b=d<<1;e=2980+(b<<2)|0;a=c[735]|0;d=1<>2]|0;if(b>>>0<(c[739]|0)>>>0)ta();else{l=a;m=b}}else{c[735]=a|d;l=2980+(b+2<<2)|0;m=e}c[l>>2]=f;c[m+12>>2]=f;c[f+8>>2]=m;c[f+12>>2]=e}c[737]=h;c[740]=i;M=j;return M|0}a=c[736]|0;if(a){d=(a&0-a)+-1|0;L=d>>>12&16;d=d>>>L;K=d>>>5&8;d=d>>>K;M=d>>>2&4;d=d>>>M;a=d>>>1&2;d=d>>>a;e=d>>>1&1;e=c[3244+((K|L|M|a|e)+(d>>>e)<<2)>>2]|0;d=(c[e+4>>2]&-8)-o|0;a=e;while(1){b=c[a+16>>2]|0;if(!b){b=c[a+20>>2]|0;if(!b){j=d;break}}a=(c[b+4>>2]&-8)-o|0;M=a>>>0>>0;d=M?a:d;a=b;e=M?b:e}g=c[739]|0;if(e>>>0>>0)ta();i=e+o|0;if(e>>>0>=i>>>0)ta();h=c[e+24>>2]|0;d=c[e+12>>2]|0;do{if((d|0)==(e|0)){a=e+20|0;b=c[a>>2]|0;if(!b){a=e+16|0;b=c[a>>2]|0;if(!b){n=0;break}}while(1){d=b+20|0;f=c[d>>2]|0;if(f){b=f;a=d;continue}d=b+16|0;f=c[d>>2]|0;if(!f)break;else{b=f;a=d}}if(a>>>0>>0)ta();else{c[a>>2]=0;n=b;break}}else{f=c[e+8>>2]|0;if(f>>>0>>0)ta();b=f+12|0;if((c[b>>2]|0)!=(e|0))ta();a=d+8|0;if((c[a>>2]|0)==(e|0)){c[b>>2]=d;c[a>>2]=f;n=d;break}else ta()}}while(0);do{if(h){b=c[e+28>>2]|0;a=3244+(b<<2)|0;if((e|0)==(c[a>>2]|0)){c[a>>2]=n;if(!n){c[736]=c[736]&~(1<>>0<(c[739]|0)>>>0)ta();b=h+16|0;if((c[b>>2]|0)==(e|0))c[b>>2]=n;else c[h+20>>2]=n;if(!n)break}a=c[739]|0;if(n>>>0>>0)ta();c[n+24>>2]=h;b=c[e+16>>2]|0;do{if(b)if(b>>>0>>0)ta();else{c[n+16>>2]=b;c[b+24>>2]=n;break}}while(0);b=c[e+20>>2]|0;if(b)if(b>>>0<(c[739]|0)>>>0)ta();else{c[n+20>>2]=b;c[b+24>>2]=n;break}}}while(0);if(j>>>0<16){M=j+o|0;c[e+4>>2]=M|3;M=e+(M+4)|0;c[M>>2]=c[M>>2]|1}else{c[e+4>>2]=o|3;c[e+(o|4)>>2]=j|1;c[e+(j+o)>>2]=j;b=c[737]|0;if(b){g=c[740]|0;d=b>>>3;b=d<<1;f=2980+(b<<2)|0;a=c[735]|0;d=1<>2]|0;if(a>>>0<(c[739]|0)>>>0)ta();else{p=b;q=a}}else{c[735]=a|d;p=2980+(b+2<<2)|0;q=f}c[p>>2]=g;c[q+12>>2]=g;c[g+8>>2]=q;c[g+12>>2]=f}c[737]=j;c[740]=i}M=e+8|0;return M|0}else q=o}else q=o}else if(a>>>0<=4294967231){a=a+11|0;m=a&-8;l=c[736]|0;if(l){d=0-m|0;a=a>>>8;if(a)if(m>>>0>16777215)k=31;else{q=(a+1048320|0)>>>16&8;v=a<>>16&4;v=v<>>16&2;k=14-(p|q|k)+(v<>>15)|0;k=m>>>(k+7|0)&1|k<<1}else k=0;a=c[3244+(k<<2)>>2]|0;a:do{if(!a){f=0;a=0;v=86}else{h=d;f=0;i=m<<((k|0)==31?0:25-(k>>>1)|0);j=a;a=0;while(1){g=c[j+4>>2]&-8;d=g-m|0;if(d>>>0>>0)if((g|0)==(m|0)){g=j;a=j;v=90;break a}else a=j;else d=h;v=c[j+20>>2]|0;j=c[j+16+(i>>>31<<2)>>2]|0;f=(v|0)==0|(v|0)==(j|0)?f:v;if(!j){v=86;break}else{h=d;i=i<<1}}}}while(0);if((v|0)==86){if((f|0)==0&(a|0)==0){a=2<>>12&16;a=a>>>n;l=a>>>5&8;a=a>>>l;p=a>>>2&4;a=a>>>p;q=a>>>1&2;a=a>>>q;f=a>>>1&1;f=c[3244+((l|n|p|q|f)+(a>>>f)<<2)>>2]|0;a=0}if(!f){i=d;j=a}else{g=f;v=90}}if((v|0)==90)while(1){v=0;q=(c[g+4>>2]&-8)-m|0;f=q>>>0>>0;d=f?q:d;a=f?g:a;f=c[g+16>>2]|0;if(f){g=f;v=90;continue}g=c[g+20>>2]|0;if(!g){i=d;j=a;break}else v=90}if((j|0)!=0?i>>>0<((c[737]|0)-m|0)>>>0:0){f=c[739]|0;if(j>>>0>>0)ta();h=j+m|0;if(j>>>0>=h>>>0)ta();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do{if((d|0)==(j|0)){a=j+20|0;b=c[a>>2]|0;if(!b){a=j+16|0;b=c[a>>2]|0;if(!b){o=0;break}}while(1){d=b+20|0;e=c[d>>2]|0;if(e){b=e;a=d;continue}d=b+16|0;e=c[d>>2]|0;if(!e)break;else{b=e;a=d}}if(a>>>0>>0)ta();else{c[a>>2]=0;o=b;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)ta();b=e+12|0;if((c[b>>2]|0)!=(j|0))ta();a=d+8|0;if((c[a>>2]|0)==(j|0)){c[b>>2]=d;c[a>>2]=e;o=d;break}else ta()}}while(0);do{if(g){b=c[j+28>>2]|0;a=3244+(b<<2)|0;if((j|0)==(c[a>>2]|0)){c[a>>2]=o;if(!o){c[736]=c[736]&~(1<>>0<(c[739]|0)>>>0)ta();b=g+16|0;if((c[b>>2]|0)==(j|0))c[b>>2]=o;else c[g+20>>2]=o;if(!o)break}a=c[739]|0;if(o>>>0>>0)ta();c[o+24>>2]=g;b=c[j+16>>2]|0;do{if(b)if(b>>>0>>0)ta();else{c[o+16>>2]=b;c[b+24>>2]=o;break}}while(0);b=c[j+20>>2]|0;if(b)if(b>>>0<(c[739]|0)>>>0)ta();else{c[o+20>>2]=b;c[b+24>>2]=o;break}}}while(0);b:do{if(i>>>0>=16){c[j+4>>2]=m|3;c[j+(m|4)>>2]=i|1;c[j+(i+m)>>2]=i;b=i>>>3;if(i>>>0<256){a=b<<1;e=2980+(a<<2)|0;d=c[735]|0;b=1<>2]|0;if(a>>>0<(c[739]|0)>>>0)ta();else{s=b;t=a}}else{c[735]=d|b;s=2980+(a+2<<2)|0;t=e}c[s>>2]=h;c[t+12>>2]=h;c[j+(m+8)>>2]=t;c[j+(m+12)>>2]=e;break}b=i>>>8;if(b)if(i>>>0>16777215)e=31;else{L=(b+1048320|0)>>>16&8;M=b<>>16&4;M=M<>>16&2;e=14-(K|L|e)+(M<>>15)|0;e=i>>>(e+7|0)&1|e<<1}else e=0;b=3244+(e<<2)|0;c[j+(m+28)>>2]=e;c[j+(m+20)>>2]=0;c[j+(m+16)>>2]=0;a=c[736]|0;d=1<>2]=h;c[j+(m+24)>>2]=b;c[j+(m+12)>>2]=h;c[j+(m+8)>>2]=h;break}b=c[b>>2]|0;c:do{if((c[b+4>>2]&-8|0)!=(i|0)){e=i<<((e|0)==31?0:25-(e>>>1)|0);while(1){a=b+16+(e>>>31<<2)|0;d=c[a>>2]|0;if(!d)break;if((c[d+4>>2]&-8|0)==(i|0)){y=d;break c}else{e=e<<1;b=d}}if(a>>>0<(c[739]|0)>>>0)ta();else{c[a>>2]=h;c[j+(m+24)>>2]=b;c[j+(m+12)>>2]=h;c[j+(m+8)>>2]=h;break b}}else y=b}while(0);b=y+8|0;a=c[b>>2]|0;M=c[739]|0;if(a>>>0>=M>>>0&y>>>0>=M>>>0){c[a+12>>2]=h;c[b>>2]=h;c[j+(m+8)>>2]=a;c[j+(m+12)>>2]=y;c[j+(m+24)>>2]=0;break}else ta()}else{M=i+m|0;c[j+4>>2]=M|3;M=j+(M+4)|0;c[M>>2]=c[M>>2]|1}}while(0);M=j+8|0;return M|0}else q=m}else q=m}else q=-1}while(0);d=c[737]|0;if(d>>>0>=q>>>0){b=d-q|0;a=c[740]|0;if(b>>>0>15){c[740]=a+q;c[737]=b;c[a+(q+4)>>2]=b|1;c[a+d>>2]=b;c[a+4>>2]=q|3}else{c[737]=0;c[740]=0;c[a+4>>2]=d|3;M=a+(d+4)|0;c[M>>2]=c[M>>2]|1}M=a+8|0;return M|0}a=c[738]|0;if(a>>>0>q>>>0){L=a-q|0;c[738]=L;M=c[741]|0;c[741]=M+q;c[M+(q+4)>>2]=L|1;c[M+4>>2]=q|3;M=M+8|0;return M|0}do{if(!(c[853]|0)){a=za(30)|0;if(!(a+-1&a)){c[855]=a;c[854]=a;c[856]=-1;c[857]=-1;c[858]=0;c[846]=0;c[853]=(La(0)|0)&-16^1431655768;break}else ta()}}while(0);j=q+48|0;i=c[855]|0;k=q+47|0;h=i+k|0;i=0-i|0;l=h&i;if(l>>>0<=q>>>0){M=0;return M|0}a=c[845]|0;if((a|0)!=0?(t=c[843]|0,y=t+l|0,y>>>0<=t>>>0|y>>>0>a>>>0):0){M=0;return M|0}d:do{if(!(c[846]&4)){a=c[741]|0;e:do{if(a){f=3388;while(1){d=c[f>>2]|0;if(d>>>0<=a>>>0?(r=f+4|0,(d+(c[r>>2]|0)|0)>>>0>a>>>0):0){g=f;a=r;break}f=c[f+8>>2]|0;if(!f){v=174;break e}}d=h-(c[738]|0)&i;if(d>>>0<2147483647){f=xa(d|0)|0;y=(f|0)==((c[g>>2]|0)+(c[a>>2]|0)|0);a=y?d:0;if(y){if((f|0)!=(-1|0)){w=f;p=a;v=194;break d}}else v=184}else a=0}else v=174}while(0);do{if((v|0)==174){g=xa(0)|0;if((g|0)!=(-1|0)){a=g;d=c[854]|0;f=d+-1|0;if(!(f&a))d=l;else d=l-a+(f+a&0-d)|0;a=c[843]|0;f=a+d|0;if(d>>>0>q>>>0&d>>>0<2147483647){y=c[845]|0;if((y|0)!=0?f>>>0<=a>>>0|f>>>0>y>>>0:0){a=0;break}f=xa(d|0)|0;y=(f|0)==(g|0);a=y?d:0;if(y){w=g;p=a;v=194;break d}else v=184}else a=0}else a=0}}while(0);f:do{if((v|0)==184){g=0-d|0;do{if(j>>>0>d>>>0&(d>>>0<2147483647&(f|0)!=(-1|0))?(u=c[855]|0,u=k-d+u&0-u,u>>>0<2147483647):0)if((xa(u|0)|0)==(-1|0)){xa(g|0)|0;break f}else{d=u+d|0;break}}while(0);if((f|0)!=(-1|0)){w=f;p=d;v=194;break d}}}while(0);c[846]=c[846]|4;v=191}else{a=0;v=191}}while(0);if((((v|0)==191?l>>>0<2147483647:0)?(w=xa(l|0)|0,x=xa(0)|0,w>>>0>>0&((w|0)!=(-1|0)&(x|0)!=(-1|0))):0)?(z=x-w|0,A=z>>>0>(q+40|0)>>>0,A):0){p=A?z:a;v=194}if((v|0)==194){a=(c[843]|0)+p|0;c[843]=a;if(a>>>0>(c[844]|0)>>>0)c[844]=a;h=c[741]|0;g:do{if(h){g=3388;do{a=c[g>>2]|0;d=g+4|0;f=c[d>>2]|0;if((w|0)==(a+f|0)){B=a;C=d;D=f;E=g;v=204;break}g=c[g+8>>2]|0}while((g|0)!=0);if(((v|0)==204?(c[E+12>>2]&8|0)==0:0)?h>>>0>>0&h>>>0>=B>>>0:0){c[C>>2]=D+p;M=(c[738]|0)+p|0;L=h+8|0;L=(L&7|0)==0?0:0-L&7;K=M-L|0;c[741]=h+L;c[738]=K;c[h+(L+4)>>2]=K|1;c[h+(M+4)>>2]=40;c[742]=c[857];break}a=c[739]|0;if(w>>>0>>0){c[739]=w;a=w}d=w+p|0;g=3388;while(1){if((c[g>>2]|0)==(d|0)){f=g;d=g;v=212;break}g=c[g+8>>2]|0;if(!g){d=3388;break}}if((v|0)==212)if(!(c[d+12>>2]&8)){c[f>>2]=w;n=d+4|0;c[n>>2]=(c[n>>2]|0)+p;n=w+8|0;n=(n&7|0)==0?0:0-n&7;k=w+(p+8)|0;k=(k&7|0)==0?0:0-k&7;b=w+(k+p)|0;m=n+q|0;o=w+m|0;l=b-(w+n)-q|0;c[w+(n+4)>>2]=q|3;h:do{if((b|0)!=(h|0)){if((b|0)==(c[740]|0)){M=(c[737]|0)+l|0;c[737]=M;c[740]=o;c[w+(m+4)>>2]=M|1;c[w+(M+m)>>2]=M;break}i=p+4|0;d=c[w+(i+k)>>2]|0;if((d&3|0)==1){j=d&-8;g=d>>>3;i:do{if(d>>>0>=256){h=c[w+((k|24)+p)>>2]|0;e=c[w+(p+12+k)>>2]|0;do{if((e|0)==(b|0)){f=k|16;e=w+(i+f)|0;d=c[e>>2]|0;if(!d){e=w+(f+p)|0;d=c[e>>2]|0;if(!d){J=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)ta();else{c[e>>2]=0;J=d;break}}else{f=c[w+((k|8)+p)>>2]|0;if(f>>>0>>0)ta();a=f+12|0;if((c[a>>2]|0)!=(b|0))ta();d=e+8|0;if((c[d>>2]|0)==(b|0)){c[a>>2]=e;c[d>>2]=f;J=e;break}else ta()}}while(0);if(!h)break;a=c[w+(p+28+k)>>2]|0;d=3244+(a<<2)|0;do{if((b|0)!=(c[d>>2]|0)){if(h>>>0<(c[739]|0)>>>0)ta();a=h+16|0;if((c[a>>2]|0)==(b|0))c[a>>2]=J;else c[h+20>>2]=J;if(!J)break i}else{c[d>>2]=J;if(J)break;c[736]=c[736]&~(1<>>0>>0)ta();c[J+24>>2]=h;b=k|16;a=c[w+(b+p)>>2]|0;do{if(a)if(a>>>0>>0)ta();else{c[J+16>>2]=a;c[a+24>>2]=J;break}}while(0);b=c[w+(i+b)>>2]|0;if(!b)break;if(b>>>0<(c[739]|0)>>>0)ta();else{c[J+20>>2]=b;c[b+24>>2]=J;break}}else{e=c[w+((k|8)+p)>>2]|0;f=c[w+(p+12+k)>>2]|0;d=2980+(g<<1<<2)|0;do{if((e|0)!=(d|0)){if(e>>>0>>0)ta();if((c[e+12>>2]|0)==(b|0))break;ta()}}while(0);if((f|0)==(e|0)){c[735]=c[735]&~(1<>>0>>0)ta();a=f+8|0;if((c[a>>2]|0)==(b|0)){F=a;break}ta()}}while(0);c[e+12>>2]=f;c[F>>2]=e}}while(0);b=w+((j|k)+p)|0;f=j+l|0}else f=l;b=b+4|0;c[b>>2]=c[b>>2]&-2;c[w+(m+4)>>2]=f|1;c[w+(f+m)>>2]=f;b=f>>>3;if(f>>>0<256){a=b<<1;e=2980+(a<<2)|0;d=c[735]|0;b=1<>2]|0;if(a>>>0>=(c[739]|0)>>>0){K=b;L=a;break}ta()}}while(0);c[K>>2]=o;c[L+12>>2]=o;c[w+(m+8)>>2]=L;c[w+(m+12)>>2]=e;break}b=f>>>8;do{if(!b)e=0;else{if(f>>>0>16777215){e=31;break}K=(b+1048320|0)>>>16&8;L=b<>>16&4;L=L<>>16&2;e=14-(J|K|e)+(L<>>15)|0;e=f>>>(e+7|0)&1|e<<1}}while(0);b=3244+(e<<2)|0;c[w+(m+28)>>2]=e;c[w+(m+20)>>2]=0;c[w+(m+16)>>2]=0;a=c[736]|0;d=1<>2]=o;c[w+(m+24)>>2]=b;c[w+(m+12)>>2]=o;c[w+(m+8)>>2]=o;break}b=c[b>>2]|0;j:do{if((c[b+4>>2]&-8|0)!=(f|0)){e=f<<((e|0)==31?0:25-(e>>>1)|0);while(1){a=b+16+(e>>>31<<2)|0;d=c[a>>2]|0;if(!d)break;if((c[d+4>>2]&-8|0)==(f|0)){M=d;break j}else{e=e<<1;b=d}}if(a>>>0<(c[739]|0)>>>0)ta();else{c[a>>2]=o;c[w+(m+24)>>2]=b;c[w+(m+12)>>2]=o;c[w+(m+8)>>2]=o;break h}}else M=b}while(0);b=M+8|0;a=c[b>>2]|0;L=c[739]|0;if(a>>>0>=L>>>0&M>>>0>=L>>>0){c[a+12>>2]=o;c[b>>2]=o;c[w+(m+8)>>2]=a;c[w+(m+12)>>2]=M;c[w+(m+24)>>2]=0;break}else ta()}else{M=(c[738]|0)+l|0;c[738]=M;c[741]=o;c[w+(m+4)>>2]=M|1}}while(0);M=w+(n|8)|0;return M|0}else d=3388;while(1){a=c[d>>2]|0;if(a>>>0<=h>>>0?(b=c[d+4>>2]|0,e=a+b|0,e>>>0>h>>>0):0)break;d=c[d+8>>2]|0}f=a+(b+-39)|0;a=a+(b+-47+((f&7|0)==0?0:0-f&7))|0;f=h+16|0;a=a>>>0>>0?h:a;b=a+8|0;d=w+8|0;d=(d&7|0)==0?0:0-d&7;M=p+-40-d|0;c[741]=w+d;c[738]=M;c[w+(d+4)>>2]=M|1;c[w+(p+-36)>>2]=40;c[742]=c[857];d=a+4|0;c[d>>2]=27;c[b>>2]=c[847];c[b+4>>2]=c[848];c[b+8>>2]=c[849];c[b+12>>2]=c[850];c[847]=w;c[848]=p;c[850]=0;c[849]=b;b=a+28|0;c[b>>2]=7;if((a+32|0)>>>0>>0)do{M=b;b=b+4|0;c[b>>2]=7}while((M+8|0)>>>0>>0);if((a|0)!=(h|0)){g=a-h|0;c[d>>2]=c[d>>2]&-2;c[h+4>>2]=g|1;c[a>>2]=g;b=g>>>3;if(g>>>0<256){a=b<<1;e=2980+(a<<2)|0;d=c[735]|0;b=1<>2]|0;if(a>>>0<(c[739]|0)>>>0)ta();else{G=b;H=a}}else{c[735]=d|b;G=2980+(a+2<<2)|0;H=e}c[G>>2]=h;c[H+12>>2]=h;c[h+8>>2]=H;c[h+12>>2]=e;break}b=g>>>8;if(b)if(g>>>0>16777215)e=31;else{L=(b+1048320|0)>>>16&8;M=b<>>16&4;M=M<>>16&2;e=14-(K|L|e)+(M<>>15)|0;e=g>>>(e+7|0)&1|e<<1}else e=0;d=3244+(e<<2)|0;c[h+28>>2]=e;c[h+20>>2]=0;c[f>>2]=0;b=c[736]|0;a=1<>2]=h;c[h+24>>2]=d;c[h+12>>2]=h;c[h+8>>2]=h;break}b=c[d>>2]|0;k:do{if((c[b+4>>2]&-8|0)!=(g|0)){e=g<<((e|0)==31?0:25-(e>>>1)|0);while(1){a=b+16+(e>>>31<<2)|0;d=c[a>>2]|0;if(!d)break;if((c[d+4>>2]&-8|0)==(g|0)){I=d;break k}else{e=e<<1;b=d}}if(a>>>0<(c[739]|0)>>>0)ta();else{c[a>>2]=h;c[h+24>>2]=b;c[h+12>>2]=h;c[h+8>>2]=h;break g}}else I=b}while(0);b=I+8|0;a=c[b>>2]|0;M=c[739]|0;if(a>>>0>=M>>>0&I>>>0>=M>>>0){c[a+12>>2]=h;c[b>>2]=h;c[h+8>>2]=a;c[h+12>>2]=I;c[h+24>>2]=0;break}else ta()}}else{M=c[739]|0;if((M|0)==0|w>>>0>>0)c[739]=w;c[847]=w;c[848]=p;c[850]=0;c[744]=c[853];c[743]=-1;b=0;do{M=b<<1;L=2980+(M<<2)|0;c[2980+(M+3<<2)>>2]=L;c[2980+(M+2<<2)>>2]=L;b=b+1|0}while((b|0)!=32);M=w+8|0;M=(M&7|0)==0?0:0-M&7;L=p+-40-M|0;c[741]=w+M;c[738]=L;c[w+(M+4)>>2]=L|1;c[w+(p+-36)>>2]=40;c[742]=c[857]}}while(0);b=c[738]|0;if(b>>>0>q>>>0){L=b-q|0;c[738]=L;M=c[741]|0;c[741]=M+q;c[M+(q+4)>>2]=L|1;c[M+4>>2]=q|3;M=M+8|0;return M|0}}c[(Bh()|0)>>2]=12;M=0;return M|0}function Gi(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;if(!a)return;b=a+-8|0;i=c[739]|0;if(b>>>0>>0)ta();d=c[a+-4>>2]|0;e=d&3;if((e|0)==1)ta();o=d&-8;q=a+(o+-8)|0;do{if(!(d&1)){b=c[b>>2]|0;if(!e)return;j=-8-b|0;l=a+j|0;m=b+o|0;if(l>>>0>>0)ta();if((l|0)==(c[740]|0)){b=a+(o+-4)|0;d=c[b>>2]|0;if((d&3|0)!=3){u=l;g=m;break}c[737]=m;c[b>>2]=d&-2;c[a+(j+4)>>2]=m|1;c[q>>2]=m;return}f=b>>>3;if(b>>>0<256){e=c[a+(j+8)>>2]|0;d=c[a+(j+12)>>2]|0;b=2980+(f<<1<<2)|0;if((e|0)!=(b|0)){if(e>>>0>>0)ta();if((c[e+12>>2]|0)!=(l|0))ta()}if((d|0)==(e|0)){c[735]=c[735]&~(1<>>0>>0)ta();b=d+8|0;if((c[b>>2]|0)==(l|0))h=b;else ta()}else h=d+8|0;c[e+12>>2]=d;c[h>>2]=e;u=l;g=m;break}h=c[a+(j+24)>>2]|0;e=c[a+(j+12)>>2]|0;do{if((e|0)==(l|0)){d=a+(j+20)|0;b=c[d>>2]|0;if(!b){d=a+(j+16)|0;b=c[d>>2]|0;if(!b){k=0;break}}while(1){e=b+20|0;f=c[e>>2]|0;if(f){b=f;d=e;continue}e=b+16|0;f=c[e>>2]|0;if(!f)break;else{b=f;d=e}}if(d>>>0>>0)ta();else{c[d>>2]=0;k=b;break}}else{f=c[a+(j+8)>>2]|0;if(f>>>0>>0)ta();b=f+12|0;if((c[b>>2]|0)!=(l|0))ta();d=e+8|0;if((c[d>>2]|0)==(l|0)){c[b>>2]=e;c[d>>2]=f;k=e;break}else ta()}}while(0);if(h){b=c[a+(j+28)>>2]|0;d=3244+(b<<2)|0;if((l|0)==(c[d>>2]|0)){c[d>>2]=k;if(!k){c[736]=c[736]&~(1<>>0<(c[739]|0)>>>0)ta();b=h+16|0;if((c[b>>2]|0)==(l|0))c[b>>2]=k;else c[h+20>>2]=k;if(!k){u=l;g=m;break}}d=c[739]|0;if(k>>>0>>0)ta();c[k+24>>2]=h;b=c[a+(j+16)>>2]|0;do{if(b)if(b>>>0>>0)ta();else{c[k+16>>2]=b;c[b+24>>2]=k;break}}while(0);b=c[a+(j+20)>>2]|0;if(b)if(b>>>0<(c[739]|0)>>>0)ta();else{c[k+20>>2]=b;c[b+24>>2]=k;u=l;g=m;break}else{u=l;g=m}}else{u=l;g=m}}else{u=b;g=o}}while(0);if(u>>>0>=q>>>0)ta();b=a+(o+-4)|0;d=c[b>>2]|0;if(!(d&1))ta();if(!(d&2)){if((q|0)==(c[741]|0)){t=(c[738]|0)+g|0;c[738]=t;c[741]=u;c[u+4>>2]=t|1;if((u|0)!=(c[740]|0))return;c[740]=0;c[737]=0;return}if((q|0)==(c[740]|0)){t=(c[737]|0)+g|0;c[737]=t;c[740]=u;c[u+4>>2]=t|1;c[u+t>>2]=t;return}g=(d&-8)+g|0;f=d>>>3;do{if(d>>>0>=256){h=c[a+(o+16)>>2]|0;b=c[a+(o|4)>>2]|0;do{if((b|0)==(q|0)){d=a+(o+12)|0;b=c[d>>2]|0;if(!b){d=a+(o+8)|0;b=c[d>>2]|0;if(!b){p=0;break}}while(1){e=b+20|0;f=c[e>>2]|0;if(f){b=f;d=e;continue}e=b+16|0;f=c[e>>2]|0;if(!f)break;else{b=f;d=e}}if(d>>>0<(c[739]|0)>>>0)ta();else{c[d>>2]=0;p=b;break}}else{d=c[a+o>>2]|0;if(d>>>0<(c[739]|0)>>>0)ta();e=d+12|0;if((c[e>>2]|0)!=(q|0))ta();f=b+8|0;if((c[f>>2]|0)==(q|0)){c[e>>2]=b;c[f>>2]=d;p=b;break}else ta()}}while(0);if(h){b=c[a+(o+20)>>2]|0;d=3244+(b<<2)|0;if((q|0)==(c[d>>2]|0)){c[d>>2]=p;if(!p){c[736]=c[736]&~(1<>>0<(c[739]|0)>>>0)ta();b=h+16|0;if((c[b>>2]|0)==(q|0))c[b>>2]=p;else c[h+20>>2]=p;if(!p)break}d=c[739]|0;if(p>>>0>>0)ta();c[p+24>>2]=h;b=c[a+(o+8)>>2]|0;do{if(b)if(b>>>0>>0)ta();else{c[p+16>>2]=b;c[b+24>>2]=p;break}}while(0);b=c[a+(o+12)>>2]|0;if(b)if(b>>>0<(c[739]|0)>>>0)ta();else{c[p+20>>2]=b;c[b+24>>2]=p;break}}}else{e=c[a+o>>2]|0;d=c[a+(o|4)>>2]|0;b=2980+(f<<1<<2)|0;if((e|0)!=(b|0)){if(e>>>0<(c[739]|0)>>>0)ta();if((c[e+12>>2]|0)!=(q|0))ta()}if((d|0)==(e|0)){c[735]=c[735]&~(1<>>0<(c[739]|0)>>>0)ta();b=d+8|0;if((c[b>>2]|0)==(q|0))n=b;else ta()}else n=d+8|0;c[e+12>>2]=d;c[n>>2]=e}}while(0);c[u+4>>2]=g|1;c[u+g>>2]=g;if((u|0)==(c[740]|0)){c[737]=g;return}}else{c[b>>2]=d&-2;c[u+4>>2]=g|1;c[u+g>>2]=g}b=g>>>3;if(g>>>0<256){d=b<<1;f=2980+(d<<2)|0;e=c[735]|0;b=1<>2]|0;if(d>>>0<(c[739]|0)>>>0)ta();else{r=b;s=d}}else{c[735]=e|b;r=2980+(d+2<<2)|0;s=f}c[r>>2]=u;c[s+12>>2]=u;c[u+8>>2]=s;c[u+12>>2]=f;return}b=g>>>8;if(b)if(g>>>0>16777215)f=31;else{r=(b+1048320|0)>>>16&8;s=b<>>16&4;s=s<>>16&2;f=14-(q|r|f)+(s<>>15)|0;f=g>>>(f+7|0)&1|f<<1}else f=0;b=3244+(f<<2)|0;c[u+28>>2]=f;c[u+20>>2]=0;c[u+16>>2]=0;d=c[736]|0;e=1<>2]|0;b:do{if((c[b+4>>2]&-8|0)!=(g|0)){f=g<<((f|0)==31?0:25-(f>>>1)|0);while(1){d=b+16+(f>>>31<<2)|0;e=c[d>>2]|0;if(!e)break;if((c[e+4>>2]&-8|0)==(g|0)){t=e;break b}else{f=f<<1;b=e}}if(d>>>0<(c[739]|0)>>>0)ta();else{c[d>>2]=u;c[u+24>>2]=b;c[u+12>>2]=u;c[u+8>>2]=u;break a}}else t=b}while(0);b=t+8|0;d=c[b>>2]|0;s=c[739]|0;if(d>>>0>=s>>>0&t>>>0>=s>>>0){c[d+12>>2]=u;c[b>>2]=u;c[u+8>>2]=d;c[u+12>>2]=t;c[u+24>>2]=0;break}else ta()}else{c[736]=d|e;c[b>>2]=u;c[u+24>>2]=b;c[u+12>>2]=u;c[u+8>>2]=u}}while(0);u=(c[743]|0)+-1|0;c[743]=u;if(!u)b=3396;else return;while(1){b=c[b>>2]|0;if(!b)break;else b=b+8|0}c[743]=-1;return}function Hi(a,b){a=a|0;b=b|0;var d=0;if(a){d=_(b,a)|0;if((b|a)>>>0>65535)d=((d>>>0)/(a>>>0)|0|0)==(b|0)?d:-1}else d=0;b=Fi(d)|0;if(!b)return b|0;if(!(c[b+-4>>2]&3))return b|0;Qi(b|0,0,d|0)|0;return b|0}function Ii(a,b){a=a|0;b=b|0;var d=0,e=0;if(!a){a=Fi(b)|0;return a|0}if(b>>>0>4294967231){c[(Bh()|0)>>2]=12;a=0;return a|0}d=Ki(a+-8|0,b>>>0<11?16:b+11&-8)|0;if(d){a=d+8|0;return a|0}d=Fi(b)|0;if(!d){a=0;return a|0}e=c[a+-4>>2]|0;e=(e&-8)-((e&3|0)==0?8:4)|0;Ui(d|0,a|0,(e>>>0>>0?e:b)|0)|0;Gi(a);a=d;return a|0}function Ji(a,b,d){a=a|0;b=b|0;d=d|0;var e=0;do{if((b|0)!=8){e=b>>>2;if((b&3|0)!=0|(e|0)==0){a=22;return a|0}if(e+1073741823&e){a=22;return a|0}if((-64-b|0)>>>0>>0){a=12;return a|0}else{e=Li(b>>>0<16?16:b,d)|0;break}}else e=Fi(d)|0}while(0);if(!e){a=12;return a|0}c[a>>2]=e;a=0;return a|0}function Ki(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;o=a+4|0;p=c[o>>2]|0;j=p&-8;l=a+j|0;i=c[739]|0;d=p&3;if(!((d|0)!=1&a>>>0>=i>>>0&a>>>0>>0))ta();e=a+(j|4)|0;f=c[e>>2]|0;if(!(f&1))ta();if(!d){if(b>>>0<256){a=0;return a|0}if(j>>>0>=(b+4|0)>>>0?(j-b|0)>>>0<=c[855]<<1>>>0:0)return a|0;a=0;return a|0}if(j>>>0>=b>>>0){d=j-b|0;if(d>>>0<=15)return a|0;c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=d|3;c[e>>2]=c[e>>2]|1;Mi(a+b|0,d);return a|0}if((l|0)==(c[741]|0)){d=(c[738]|0)+j|0;if(d>>>0<=b>>>0){a=0;return a|0}n=d-b|0;c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=n|1;c[741]=a+b;c[738]=n;return a|0}if((l|0)==(c[740]|0)){e=(c[737]|0)+j|0;if(e>>>0>>0){a=0;return a|0}d=e-b|0;if(d>>>0>15){c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=d|1;c[a+e>>2]=d;e=a+(e+4)|0;c[e>>2]=c[e>>2]&-2;e=a+b|0}else{c[o>>2]=p&1|e|2;e=a+(e+4)|0;c[e>>2]=c[e>>2]|1;e=0;d=0}c[737]=d;c[740]=e;return a|0}if(f&2){a=0;return a|0}m=(f&-8)+j|0;if(m>>>0>>0){a=0;return a|0}n=m-b|0;g=f>>>3;do{if(f>>>0>=256){h=c[a+(j+24)>>2]|0;g=c[a+(j+12)>>2]|0;do{if((g|0)==(l|0)){e=a+(j+20)|0;d=c[e>>2]|0;if(!d){e=a+(j+16)|0;d=c[e>>2]|0;if(!d){k=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)ta();else{c[e>>2]=0;k=d;break}}else{f=c[a+(j+8)>>2]|0;if(f>>>0>>0)ta();d=f+12|0;if((c[d>>2]|0)!=(l|0))ta();e=g+8|0;if((c[e>>2]|0)==(l|0)){c[d>>2]=g;c[e>>2]=f;k=g;break}else ta()}}while(0);if(h){d=c[a+(j+28)>>2]|0;e=3244+(d<<2)|0;if((l|0)==(c[e>>2]|0)){c[e>>2]=k;if(!k){c[736]=c[736]&~(1<>>0<(c[739]|0)>>>0)ta();d=h+16|0;if((c[d>>2]|0)==(l|0))c[d>>2]=k;else c[h+20>>2]=k;if(!k)break}e=c[739]|0;if(k>>>0>>0)ta();c[k+24>>2]=h;d=c[a+(j+16)>>2]|0;do{if(d)if(d>>>0>>0)ta();else{c[k+16>>2]=d;c[d+24>>2]=k;break}}while(0);d=c[a+(j+20)>>2]|0;if(d)if(d>>>0<(c[739]|0)>>>0)ta();else{c[k+20>>2]=d;c[d+24>>2]=k;break}}}else{f=c[a+(j+8)>>2]|0;e=c[a+(j+12)>>2]|0;d=2980+(g<<1<<2)|0;if((f|0)!=(d|0)){if(f>>>0>>0)ta();if((c[f+12>>2]|0)!=(l|0))ta()}if((e|0)==(f|0)){c[735]=c[735]&~(1<>>0>>0)ta();d=e+8|0;if((c[d>>2]|0)==(l|0))h=d;else ta()}else h=e+8|0;c[f+12>>2]=e;c[h>>2]=f}}while(0);if(n>>>0<16){c[o>>2]=m|p&1|2;b=a+(m|4)|0;c[b>>2]=c[b>>2]|1;return a|0}else{c[o>>2]=p&1|b|2;c[a+(b+4)>>2]=n|3;p=a+(m|4)|0;c[p>>2]=c[p>>2]|1;Mi(a+b|0,n);return a|0}return 0}function Li(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0;a=a>>>0<16?16:a;if(a+-1&a){d=16;while(1)if(d>>>0>>0)d=d<<1;else{a=d;break}}if((-64-a|0)>>>0<=b>>>0){c[(Bh()|0)>>2]=12;i=0;return i|0}h=b>>>0<11?16:b+11&-8;e=Fi(h+12+a|0)|0;if(!e){i=0;return i|0}b=e+-8|0;d=a+-1|0;do{if(e&d){f=e+d&0-a;d=f+-8|0;g=b;f=(d-g|0)>>>0>15?d:f+(a+-8)|0;g=f-g|0;a=e+-4|0;e=c[a>>2]|0;d=(e&-8)-g|0;if(!(e&3)){c[f>>2]=(c[b>>2]|0)+g;c[f+4>>2]=d;b=f;break}else{e=f+4|0;c[e>>2]=d|c[e>>2]&1|2;d=f+(d+4)|0;c[d>>2]=c[d>>2]|1;c[a>>2]=g|c[a>>2]&1|2;c[e>>2]=c[e>>2]|1;Mi(b,g);b=f;break}}}while(0);a=b+4|0;d=c[a>>2]|0;if((d&3|0)!=0?(i=d&-8,i>>>0>(h+16|0)>>>0):0){g=i-h|0;c[a>>2]=h|d&1|2;c[b+(h|4)>>2]=g|3;i=b+(i|4)|0;c[i>>2]=c[i>>2]|1;Mi(b+h|0,g)}i=b+8|0;return i|0}function Mi(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;q=a+b|0;d=c[a+4>>2]|0;do{if(!(d&1)){k=c[a>>2]|0;if(!(d&3))return;n=a+(0-k)|0;m=k+b|0;j=c[739]|0;if(n>>>0>>0)ta();if((n|0)==(c[740]|0)){e=a+(b+4)|0;d=c[e>>2]|0;if((d&3|0)!=3){t=n;h=m;break}c[737]=m;c[e>>2]=d&-2;c[a+(4-k)>>2]=m|1;c[q>>2]=m;return}g=k>>>3;if(k>>>0<256){f=c[a+(8-k)>>2]|0;e=c[a+(12-k)>>2]|0;d=2980+(g<<1<<2)|0;if((f|0)!=(d|0)){if(f>>>0>>0)ta();if((c[f+12>>2]|0)!=(n|0))ta()}if((e|0)==(f|0)){c[735]=c[735]&~(1<>>0>>0)ta();d=e+8|0;if((c[d>>2]|0)==(n|0))i=d;else ta()}else i=e+8|0;c[f+12>>2]=e;c[i>>2]=f;t=n;h=m;break}i=c[a+(24-k)>>2]|0;f=c[a+(12-k)>>2]|0;do{if((f|0)==(n|0)){f=16-k|0;e=a+(f+4)|0;d=c[e>>2]|0;if(!d){e=a+f|0;d=c[e>>2]|0;if(!d){l=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)ta();else{c[e>>2]=0;l=d;break}}else{g=c[a+(8-k)>>2]|0;if(g>>>0>>0)ta();d=g+12|0;if((c[d>>2]|0)!=(n|0))ta();e=f+8|0;if((c[e>>2]|0)==(n|0)){c[d>>2]=f;c[e>>2]=g;l=f;break}else ta()}}while(0);if(i){d=c[a+(28-k)>>2]|0;e=3244+(d<<2)|0;if((n|0)==(c[e>>2]|0)){c[e>>2]=l;if(!l){c[736]=c[736]&~(1<>>0<(c[739]|0)>>>0)ta();d=i+16|0;if((c[d>>2]|0)==(n|0))c[d>>2]=l;else c[i+20>>2]=l;if(!l){t=n;h=m;break}}f=c[739]|0;if(l>>>0>>0)ta();c[l+24>>2]=i;d=16-k|0;e=c[a+d>>2]|0;do{if(e)if(e>>>0>>0)ta();else{c[l+16>>2]=e;c[e+24>>2]=l;break}}while(0);d=c[a+(d+4)>>2]|0;if(d)if(d>>>0<(c[739]|0)>>>0)ta();else{c[l+20>>2]=d;c[d+24>>2]=l;t=n;h=m;break}else{t=n;h=m}}else{t=n;h=m}}else{t=a;h=b}}while(0);j=c[739]|0;if(q>>>0>>0)ta();d=a+(b+4)|0;e=c[d>>2]|0;if(!(e&2)){if((q|0)==(c[741]|0)){s=(c[738]|0)+h|0;c[738]=s;c[741]=t;c[t+4>>2]=s|1;if((t|0)!=(c[740]|0))return;c[740]=0;c[737]=0;return}if((q|0)==(c[740]|0)){s=(c[737]|0)+h|0;c[737]=s;c[740]=t;c[t+4>>2]=s|1;c[t+s>>2]=s;return}h=(e&-8)+h|0;g=e>>>3;do{if(e>>>0>=256){i=c[a+(b+24)>>2]|0;f=c[a+(b+12)>>2]|0;do{if((f|0)==(q|0)){e=a+(b+20)|0;d=c[e>>2]|0;if(!d){e=a+(b+16)|0;d=c[e>>2]|0;if(!d){p=0;break}}while(1){f=d+20|0;g=c[f>>2]|0;if(g){d=g;e=f;continue}f=d+16|0;g=c[f>>2]|0;if(!g)break;else{d=g;e=f}}if(e>>>0>>0)ta();else{c[e>>2]=0;p=d;break}}else{g=c[a+(b+8)>>2]|0;if(g>>>0>>0)ta();d=g+12|0;if((c[d>>2]|0)!=(q|0))ta();e=f+8|0;if((c[e>>2]|0)==(q|0)){c[d>>2]=f;c[e>>2]=g;p=f;break}else ta()}}while(0);if(i){d=c[a+(b+28)>>2]|0;e=3244+(d<<2)|0;if((q|0)==(c[e>>2]|0)){c[e>>2]=p;if(!p){c[736]=c[736]&~(1<>>0<(c[739]|0)>>>0)ta();d=i+16|0;if((c[d>>2]|0)==(q|0))c[d>>2]=p;else c[i+20>>2]=p;if(!p)break}e=c[739]|0;if(p>>>0>>0)ta();c[p+24>>2]=i;d=c[a+(b+16)>>2]|0;do{if(d)if(d>>>0>>0)ta();else{c[p+16>>2]=d;c[d+24>>2]=p;break}}while(0);d=c[a+(b+20)>>2]|0;if(d)if(d>>>0<(c[739]|0)>>>0)ta();else{c[p+20>>2]=d;c[d+24>>2]=p;break}}}else{f=c[a+(b+8)>>2]|0;e=c[a+(b+12)>>2]|0;d=2980+(g<<1<<2)|0;if((f|0)!=(d|0)){if(f>>>0>>0)ta();if((c[f+12>>2]|0)!=(q|0))ta()}if((e|0)==(f|0)){c[735]=c[735]&~(1<>>0>>0)ta();d=e+8|0;if((c[d>>2]|0)==(q|0))o=d;else ta()}else o=e+8|0;c[f+12>>2]=e;c[o>>2]=f}}while(0);c[t+4>>2]=h|1;c[t+h>>2]=h;if((t|0)==(c[740]|0)){c[737]=h;return}}else{c[d>>2]=e&-2;c[t+4>>2]=h|1;c[t+h>>2]=h}d=h>>>3;if(h>>>0<256){e=d<<1;g=2980+(e<<2)|0;f=c[735]|0;d=1<>2]|0;if(e>>>0<(c[739]|0)>>>0)ta();else{r=d;s=e}}else{c[735]=f|d;r=2980+(e+2<<2)|0;s=g}c[r>>2]=t;c[s+12>>2]=t;c[t+8>>2]=s;c[t+12>>2]=g;return}d=h>>>8;if(d)if(h>>>0>16777215)g=31;else{r=(d+1048320|0)>>>16&8;s=d<>>16&4;s=s<>>16&2;g=14-(q|r|g)+(s<>>15)|0;g=h>>>(g+7|0)&1|g<<1}else g=0;d=3244+(g<<2)|0;c[t+28>>2]=g;c[t+20>>2]=0;c[t+16>>2]=0;e=c[736]|0;f=1<>2]=t;c[t+24>>2]=d;c[t+12>>2]=t;c[t+8>>2]=t;return}d=c[d>>2]|0;a:do{if((c[d+4>>2]&-8|0)!=(h|0)){g=h<<((g|0)==31?0:25-(g>>>1)|0);while(1){e=d+16+(g>>>31<<2)|0;f=c[e>>2]|0;if(!f)break;if((c[f+4>>2]&-8|0)==(h|0)){d=f;break a}else{g=g<<1;d=f}}if(e>>>0<(c[739]|0)>>>0)ta();c[e>>2]=t;c[t+24>>2]=d;c[t+12>>2]=t;c[t+8>>2]=t;return}}while(0);e=d+8|0;f=c[e>>2]|0;s=c[739]|0;if(!(f>>>0>=s>>>0&d>>>0>=s>>>0))ta();c[f+12>>2]=t;c[e>>2]=t;c[t+8>>2]=f;c[t+12>>2]=d;c[t+24>>2]=0;return}function Ni(){}function Oi(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return(C=d,a-c>>>0|0)|0}function Pi(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>c;return a>>>c|(b&(1<>c-32|0}function Qi(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;if((e|0)>=20){d=d&255;h=b&3;i=d|d<<8|d<<16|d<<24;g=f&~3;if(h){h=b+4-h|0;while((b|0)<(h|0)){a[b>>0]=d;b=b+1|0}}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return b-e|0}function Ri(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b<>>32-c;return a<>>0;return(C=b+d+(c>>>0>>0|0)>>>0,c|0)|0}function Ti(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>>c;return a>>>c|(b&(1<>>c-32|0}function Ui(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;if((e|0)>=4096)return ya(b|0,d|0,e|0)|0;f=b|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}while((e|0)>=4){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0;e=e-4|0}}while((e|0)>0){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}return f|0}function Vi(b){b=b|0;var c=0;c=a[m+(b&255)>>0]|0;if((c|0)<8)return c|0;c=a[m+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[m+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return(a[m+(b>>>24)>>0]|0)+24|0}function Wi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;e=b&65535;c=_(e,f)|0;d=a>>>16;a=(c>>>16)+(_(e,d)|0)|0;e=b>>>16;b=_(e,f)|0;return(C=(a>>>16)+(_(e,d)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|c&65535|0)|0}function Xi(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=Oi(j^a,i^b,j,i)|0;g=C;a=f^j;b=e^i;return Oi((aj(h,g,Oi(f^c,e^d,f,e)|0,C,0)|0)^a,C^b,a,b)|0}function Yi(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;f=i;i=i+16|0;j=f|0;h=b>>31|((b|0)<0?-1:0)<<1;g=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;l=e>>31|((e|0)<0?-1:0)<<1;k=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;a=Oi(h^a,g^b,h,g)|0;b=C;aj(a,b,Oi(l^d,k^e,l,k)|0,C,j)|0;e=Oi(c[j>>2]^h,c[j+4>>2]^g,h,g)|0;d=C;i=f;return(C=d,e)|0}function Zi(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;c=Wi(e,f)|0;a=C;return(C=(_(b,f)|0)+(_(d,e)|0)+a|a&0,c|0|0)|0}function _i(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return aj(a,b,c,d,0)|0}function $i(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+16|0;f=g|0;aj(a,b,d,e,f)|0;i=g;return(C=c[f+4>>2]|0,c[f>>2]|0)|0}function aj(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=a;j=b;k=j;h=d;n=e;i=n;if(!k){g=(f|0)!=0;if(!i){if(g){c[f>>2]=(l>>>0)%(h>>>0);c[f+4>>2]=0}n=0;f=(l>>>0)/(h>>>0)>>>0;return(C=n,f)|0}else{if(!g){n=0;f=0;return(C=n,f)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;f=0;return(C=n,f)|0}}g=(i|0)==0;do{if(h){if(!g){g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=31){m=g+1|0;i=31-g|0;b=g-31>>31;h=m;a=l>>>(m>>>0)&b|k<>>(m>>>0)&b;g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;n=0;f=0;return(C=n,f)|0}g=h-1|0;if(g&h){i=(aa(h|0)|0)+33-(aa(k|0)|0)|0;p=64-i|0;m=32-i|0;j=m>>31;o=i-32|0;b=o>>31;h=i;a=m-1>>31&k>>>(o>>>0)|(k<>>(i>>>0))&b;b=b&k>>>(i>>>0);g=l<>>(o>>>0))&j|l<>31;break}if(f){c[f>>2]=g&l;c[f+4>>2]=0}if((h|0)==1){o=j|b&0;p=a|0|0;return(C=o,p)|0}else{p=Vi(h|0)|0;o=k>>>(p>>>0)|0;p=k<<32-p|l>>>(p>>>0)|0;return(C=o,p)|0}}else{if(g){if(f){c[f>>2]=(k>>>0)%(h>>>0);c[f+4>>2]=0}o=0;p=(k>>>0)/(h>>>0)>>>0;return(C=o,p)|0}if(!l){if(f){c[f>>2]=0;c[f+4>>2]=(k>>>0)%(i>>>0)}o=0;p=(k>>>0)/(i>>>0)>>>0;return(C=o,p)|0}g=i-1|0;if(!(g&i)){if(f){c[f>>2]=a|0;c[f+4>>2]=g&k|b&0}o=0;p=k>>>((Vi(i|0)|0)>>>0);return(C=o,p)|0}g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=30){b=g+1|0;i=31-g|0;h=b;a=k<>>(b>>>0);b=k>>>(b>>>0);g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;o=0;p=0;return(C=o,p)|0}}while(0);if(!h){k=i;j=0;i=0}else{m=d|0|0;l=n|e&0;k=Si(m|0,l|0,-1,-1)|0;d=C;j=i;i=0;do{e=j;j=g>>>31|j<<1;g=i|g<<1;e=a<<1|e>>>31|0;n=a>>>31|b<<1|0;Oi(k,d,e,n)|0;p=C;o=p>>31|((p|0)<0?-1:0)<<1;i=o&1;a=Oi(e,n,o&m,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&l)|0;b=C;h=h-1|0}while((h|0)!=0);k=j;j=0}h=0;if(f){c[f>>2]=a;c[f+4>>2]=b}o=(g|0)>>>31|(k|h)<<1|(h<<1|g>>>31)&0|j;p=(g<<1|0>>>31)&-2|i;return(C=o,p)|0}function bj(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;return Qa[a&3](b|0,c|0,d|0,e|0,f|0,g|0,h|0)|0}function cj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Ra[a&63](b|0,c|0,d|0)|0}function dj(a,b){a=a|0;b=b|0;return+Sa[a&3](b|0)}function ej(a,b){a=a|0;b=b|0;Ta[a&7](b|0)}function fj(a,b,c){a=a|0;b=b|0;c=c|0;Ua[a&7](b|0,c|0)}function gj(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return Va[a&7](b|0,c|0,d|0,e|0,f|0,g|0)|0}function hj(a,b){a=a|0;b=b|0;return Wa[a&15](b|0)|0}function ij(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Xa[a&15](b|0,c|0,d|0)}function jj(a,b,c,d,e,f,g,h,i,j,k,l){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;return Ya[a&3](b|0,c|0,d|0,e|0,f|0,g|0,h|0,i|0,j|0,k|0,l|0)|0}function kj(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Za[a&63](b|0,c|0,d|0,e|0)|0}function lj(a,b,c){a=a|0;b=b|0;c=c|0;return _a[a&7](b|0,c|0)|0}function mj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return $a[a&3](b|0,c|0,d|0,e|0,f|0)|0}function nj(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ab[a&3](b|0,c|0,d|0,e|0)}function oj(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ba(0);return 0}function pj(a,b,c){a=a|0;b=b|0;c=c|0;ba(1);return 0}function qj(a){a=a|0;ba(2);return 0.0}function rj(a){a=a|0;ba(3)}function sj(a,b){a=a|0;b=b|0;ba(4)}function tj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ba(5);return 0}function uj(a){a=a|0;ba(6);return 0}function vj(a,b,c){a=a|0;b=b|0;c=c|0;ba(7)}function wj(a,b,c,d,e,f,g,h,i,j,k){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;ba(8);return 0}function xj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ba(9);return 0}function yj(a,b){a=a|0;b=b|0;ba(10);return 0}function zj(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ba(11);return 0}function Aj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ba(12)}var Qa=[oj,ed,We,oj];var Ra=[pj,Bi,Vh,Th,Ab,Bb,Cb,Db,Hc,Ic,Kc,$c,nd,Oe,af,od,pd,Ne,Pe,Lc,Mc,Nc,Oc,td,ud,vd,wd,yd,zd,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Jd,Kd,Ld,Md,Nd,Od,Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,ef,ff,gf,hf,jf,kf,lf,mf,Sh,Uh,pj,pj];var Sa=[qj,Yd,Zd,qj];var Ta=[rj,Yc,Ve,gg,hg,xi,yi,rj];var Ua=[sj,mb,nb,ob,Wb,Wc,Le,sj];var Va=[tj,dd,Ue,rd,Te,tj,tj,tj];var Wa=[uj,Rh,jd,kd,$e,_e,Yh,Kg,Hg,uj,uj,uj,uj,uj,uj,uj];var Xa=[vj,Ge,He,Ie,Je,Ae,Be,Ce,De,we,xe,ye,ze,gd,Ze,vj];var Ya=[wj,cd,Se,wj];var Za=[xj,de,ee,fe,ge,he,ie,je,ke,le,me,ne,oe,pe,qe,re,se,te,ue,ve,xf,yf,zf,rf,sf,tf,uf,vf,wf,wb,xb,yb,zb,ld,ad,Ke,Re,qd,Zc,Qe,Me,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj,xj];var _a=[yj,Jc,nf,of,pf,qf,yj,yj];var $a=[zj,md,Xe,zj];var ab=[Aj,Og,Rg,Aj];return{_opj_stream_destroy:Fb,_opj_stream_set_read_function:Gb,_opj_read_tile_header:mc,_opj_set_warning_handler:cc,_opj_destroy_cstr_info:Cc,_opj_image_create:Yb,_opj_set_error_handler:dc,_opj_stream_set_user_data:Kb,_opj_end_decompress:wc,_bitshift64Lshr:Ti,_opj_stream_set_seek_function:Hb,_opj_decode:kc,_opj_set_decoded_resolution_factor:pc,_i64Add:Si,_opj_stream_create_default_file_stream:Fc,_opj_set_default_decoder_parameters:hc,_bitshift64Ashr:Pi,_opj_get_decoded_tile:oc,_memset:Qi,_opj_version:fc,_memcpy:Ui,_opj_destroy_cstr_index:Ec,_opj_stream_set_user_data_length:Lb,_opj_stream_set_skip_function:Jb,_opj_image_destroy:Zb,_opj_stream_create_file_stream:Gc,_opj_setup_encoder:sc,_opj_stream_default_create:Eb,_bitshift64Shl:Ri,_opj_stream_create:vb,_jp2_version:lb,_i64Subtract:Oi,_opj_get_cstr_index:Dc,_opj_encode:uc,_opj_read_header:jc,_opj_get_cstr_info:Bc,_opj_set_default_encoder_parameters:rc,_opj_set_decode_area:lc,_opj_stream_set_write_function:Ib,_opj_dump_codec:Ac,_opj_create_decompress:gc,_opj_decode_tile_data:nc,_free:Gi,_opj_image_tile_create:ac,_opj_set_MCT:xc,_opj_set_info_handler:bc,_opj_start_compress:tc,_opj_write_tile:yc,_opj_setup_decoder:ic,_malloc:Fi,_opj_end_compress:vc,_opj_destroy_codec:zc,_jp2_decode:kb,_opj_stream_create_buffer_stream:ec,_opj_create_compress:qc,runPostSets:Ni,stackAlloc:bb,stackSave:cb,stackRestore:db,establishStackSpace:eb,setThrew:fb,setTempRet0:ib,getTempRet0:jb,dynCall_iiiiiiii:bj,dynCall_iiii:cj,dynCall_di:dj,dynCall_vi:ej,dynCall_vii:fj,dynCall_iiiiiii:gj,dynCall_ii:hj,dynCall_viii:ij,dynCall_iiiiiiiiiiii:jj,dynCall_iiiii:kj,dynCall_iii:lj,dynCall_iiiiii:mj,dynCall_viiii:nj}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var _opj_stream_destroy=Module["_opj_stream_destroy"]=asm["_opj_stream_destroy"];var _opj_stream_set_read_function=Module["_opj_stream_set_read_function"]=asm["_opj_stream_set_read_function"];var _opj_read_tile_header=Module["_opj_read_tile_header"]=asm["_opj_read_tile_header"];var _opj_set_warning_handler=Module["_opj_set_warning_handler"]=asm["_opj_set_warning_handler"];var _opj_destroy_cstr_info=Module["_opj_destroy_cstr_info"]=asm["_opj_destroy_cstr_info"];var _opj_image_create=Module["_opj_image_create"]=asm["_opj_image_create"];var _opj_set_error_handler=Module["_opj_set_error_handler"]=asm["_opj_set_error_handler"];var _opj_image_tile_create=Module["_opj_image_tile_create"]=asm["_opj_image_tile_create"];var _opj_end_decompress=Module["_opj_end_decompress"]=asm["_opj_end_decompress"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _opj_stream_set_seek_function=Module["_opj_stream_set_seek_function"]=asm["_opj_stream_set_seek_function"];var _opj_decode=Module["_opj_decode"]=asm["_opj_decode"];var _opj_set_decoded_resolution_factor=Module["_opj_set_decoded_resolution_factor"]=asm["_opj_set_decoded_resolution_factor"];var _opj_stream_create_default_file_stream=Module["_opj_stream_create_default_file_stream"]=asm["_opj_stream_create_default_file_stream"];var _opj_encode=Module["_opj_encode"]=asm["_opj_encode"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _opj_get_decoded_tile=Module["_opj_get_decoded_tile"]=asm["_opj_get_decoded_tile"];var _memset=Module["_memset"]=asm["_memset"];var _opj_version=Module["_opj_version"]=asm["_opj_version"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _opj_destroy_cstr_index=Module["_opj_destroy_cstr_index"]=asm["_opj_destroy_cstr_index"];var _opj_stream_set_user_data_length=Module["_opj_stream_set_user_data_length"]=asm["_opj_stream_set_user_data_length"];var _opj_stream_set_skip_function=Module["_opj_stream_set_skip_function"]=asm["_opj_stream_set_skip_function"];var _opj_image_destroy=Module["_opj_image_destroy"]=asm["_opj_image_destroy"];var _opj_stream_create_file_stream=Module["_opj_stream_create_file_stream"]=asm["_opj_stream_create_file_stream"];var _opj_setup_encoder=Module["_opj_setup_encoder"]=asm["_opj_setup_encoder"];var _opj_stream_default_create=Module["_opj_stream_default_create"]=asm["_opj_stream_default_create"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _opj_stream_create=Module["_opj_stream_create"]=asm["_opj_stream_create"];var _jp2_version=Module["_jp2_version"]=asm["_jp2_version"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _opj_get_cstr_index=Module["_opj_get_cstr_index"]=asm["_opj_get_cstr_index"];var _opj_set_default_decoder_parameters=Module["_opj_set_default_decoder_parameters"]=asm["_opj_set_default_decoder_parameters"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _opj_get_cstr_info=Module["_opj_get_cstr_info"]=asm["_opj_get_cstr_info"];var _opj_set_default_encoder_parameters=Module["_opj_set_default_encoder_parameters"]=asm["_opj_set_default_encoder_parameters"];var _opj_set_decode_area=Module["_opj_set_decode_area"]=asm["_opj_set_decode_area"];var _opj_stream_set_write_function=Module["_opj_stream_set_write_function"]=asm["_opj_stream_set_write_function"];var _opj_dump_codec=Module["_opj_dump_codec"]=asm["_opj_dump_codec"];var _opj_read_header=Module["_opj_read_header"]=asm["_opj_read_header"];var _opj_create_decompress=Module["_opj_create_decompress"]=asm["_opj_create_decompress"];var _opj_decode_tile_data=Module["_opj_decode_tile_data"]=asm["_opj_decode_tile_data"];var _opj_set_info_handler=Module["_opj_set_info_handler"]=asm["_opj_set_info_handler"];var _opj_stream_set_user_data=Module["_opj_stream_set_user_data"]=asm["_opj_stream_set_user_data"];var _opj_set_MCT=Module["_opj_set_MCT"]=asm["_opj_set_MCT"];var _free=Module["_free"]=asm["_free"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var _opj_start_compress=Module["_opj_start_compress"]=asm["_opj_start_compress"];var _opj_write_tile=Module["_opj_write_tile"]=asm["_opj_write_tile"];var _opj_setup_decoder=Module["_opj_setup_decoder"]=asm["_opj_setup_decoder"];var _malloc=Module["_malloc"]=asm["_malloc"];var _opj_end_compress=Module["_opj_end_compress"]=asm["_opj_end_compress"];var _opj_destroy_codec=Module["_opj_destroy_codec"]=asm["_opj_destroy_codec"];var _jp2_decode=Module["_jp2_decode"]=asm["_jp2_decode"];var _opj_stream_create_buffer_stream=Module["_opj_stream_create_buffer_stream"]=asm["_opj_stream_create_buffer_stream"];var _opj_create_compress=Module["_opj_create_compress"]=asm["_opj_create_compress"];var dynCall_iiiiiiii=Module["dynCall_iiiiiiii"]=asm["dynCall_iiiiiiii"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_di=Module["dynCall_di"]=asm["dynCall_di"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=asm["dynCall_iiiiiii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_iiiiiiiiiiii=Module["dynCall_iiiiiiiiiiii"]=asm["dynCall_iiiiiiiiiiii"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];Runtime.stackAlloc=asm["stackAlloc"];Runtime.stackSave=asm["stackSave"];Runtime.stackRestore=asm["stackRestore"];Runtime.establishStackSpace=asm["establishStackSpace"];Runtime.setTempRet0=asm["setTempRet0"];Runtime.getTempRet0=asm["getTempRet0"];function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){assert(runDependencies==0,"cannot call main when async dependencies remain! (listen on __ATMAIN__)");assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called");args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["stdout"]["once"]("drain",function(){process["exit"](status)});console.log(" ");setTimeout(function(){process["exit"](status)},500)}else if(ENVIRONMENT_IS_SHELL&&typeof quit==="function"){quit(status)}throw new ExitStatus(status)}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"]){shouldRunNow=false}run();return Module};!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.pako=t()}}(function(){return function t(e,a,i){function n(s,o){if(!a[s]){if(!e[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(r)return r(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var d=a[s]={exports:{}};e[s][0].call(d.exports,function(t){var a=e[s][1][t];return n(a?a:t)},d,d.exports,t,e,a,i)}return a[s].exports}for(var r="function"==typeof require&&require,s=0;s0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var a=s.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==c)throw new Error(h[a]);e.header&&s.deflateSetHeader(this.strm,e.header)};v.prototype.push=function(t,e){var a,i,n=this.strm,r=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:e===!0?u:_,"string"==typeof t?n.input=l.string2buf(t):"[object ArrayBuffer]"===f.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new o.Buf8(r),n.next_out=0,n.avail_out=r),a=s.deflate(n,i),a!==b&&a!==c)return this.onEnd(a),this.ended=!0,!1;(0===n.avail_out||0===n.avail_in&&(i===u||i===g))&&this.onData("string"===this.options.to?l.buf2binstring(o.shrinkBuf(n.output,n.next_out)):o.shrinkBuf(n.output,n.next_out))}while((n.avail_in>0||0===n.avail_out)&&a!==b);return i===u?(a=s.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===c):i===g?(this.onEnd(c),n.avail_out=0,!0):!0},v.prototype.onData=function(t){this.chunks.push(t)},v.prototype.onEnd=function(t){t===c&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Deflate=v,a.deflate=i,a.deflateRaw=n,a.gzip=r},{"./utils/common":3,"./utils/strings":4,"./zlib/deflate.js":8,"./zlib/messages":13,"./zlib/zstream":15}],2:[function(t,e,a){"use strict";function i(t,e){var a=new u(e);if(a.push(t,!0),a.err)throw a.msg;return a.result}function n(t,e){return e=e||{},e.raw=!0,i(t,e)}var r=t("./zlib/inflate.js"),s=t("./utils/common"),o=t("./utils/strings"),l=t("./zlib/constants"),h=t("./zlib/messages"),d=t("./zlib/zstream"),f=t("./zlib/gzheader"),_=Object.prototype.toString,u=function(t){this.options=s.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var a=r.inflateInit2(this.strm,e.windowBits);if(a!==l.Z_OK)throw new Error(h[a]);this.header=new f,r.inflateGetHeader(this.strm,this.header)};u.prototype.push=function(t,e){var a,i,n,h,d,f=this.strm,u=this.options.chunkSize,c=!1;if(this.ended)return!1;i=e===~~e?e:e===!0?l.Z_FINISH:l.Z_NO_FLUSH,"string"==typeof t?f.input=o.binstring2buf(t):"[object ArrayBuffer]"===_.call(t)?f.input=new Uint8Array(t):f.input=t,f.next_in=0,f.avail_in=f.input.length;do{if(0===f.avail_out&&(f.output=new s.Buf8(u),f.next_out=0,f.avail_out=u),a=r.inflate(f,l.Z_NO_FLUSH),a===l.Z_BUF_ERROR&&c===!0&&(a=l.Z_OK,c=!1),a!==l.Z_STREAM_END&&a!==l.Z_OK)return this.onEnd(a),this.ended=!0,!1;f.next_out&&(0===f.avail_out||a===l.Z_STREAM_END||0===f.avail_in&&(i===l.Z_FINISH||i===l.Z_SYNC_FLUSH))&&("string"===this.options.to?(n=o.utf8border(f.output,f.next_out),h=f.next_out-n,d=o.buf2string(f.output,n),f.next_out=h,f.avail_out=u-h,h&&s.arraySet(f.output,f.output,n,h,0),this.onData(d)):this.onData(s.shrinkBuf(f.output,f.next_out))),0===f.avail_in&&0===f.avail_out&&(c=!0)}while((f.avail_in>0||0===f.avail_out)&&a!==l.Z_STREAM_END);return a===l.Z_STREAM_END&&(i=l.Z_FINISH),i===l.Z_FINISH?(a=r.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===l.Z_OK):i===l.Z_SYNC_FLUSH?(this.onEnd(l.Z_OK),f.avail_out=0,!0):!0},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===l.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Inflate=u,a.inflate=i,a.inflateRaw=n,a.ungzip=i},{"./utils/common":3,"./utils/strings":4,"./zlib/constants":6,"./zlib/gzheader":9,"./zlib/inflate.js":11,"./zlib/messages":13,"./zlib/zstream":15}],3:[function(t,e,a){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;a.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i])}}return t},a.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,a,i,n){if(e.subarray&&t.subarray)return void t.set(e.subarray(a,a+i),n);for(var r=0;i>r;r++)t[n+r]=e[a+r]},flattenChunks:function(t){var e,a,i,n,r,s;for(i=0,e=0,a=t.length;a>e;e++)i+=t[e].length;for(s=new Uint8Array(i),n=0,e=0,a=t.length;a>e;e++)r=t[e],s.set(r,n),n+=r.length;return s}},r={arraySet:function(t,e,a,i,n){for(var r=0;i>r;r++)t[n+r]=e[a+r]},flattenChunks:function(t){return[].concat.apply([],t)}};a.setTyped=function(t){t?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,n)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,r))},a.setTyped(i)},{}],4:[function(t,e,a){"use strict";function i(t,e){if(65537>e&&(t.subarray&&s||!t.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var a="",i=0;e>i;i++)a+=String.fromCharCode(t[i]);return a}var n=t("./common"),r=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(o){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(o){s=!1}for(var l=new n.Buf8(256),h=0;256>h;h++)l[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;l[254]=l[254]=1,a.string2buf=function(t){var e,a,i,r,s,o=t.length,l=0;for(r=0;o>r;r++)a=t.charCodeAt(r),55296===(64512&a)&&o>r+1&&(i=t.charCodeAt(r+1),56320===(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),r++)),l+=128>a?1:2048>a?2:65536>a?3:4;for(e=new n.Buf8(l),s=0,r=0;l>s;r++)a=t.charCodeAt(r),55296===(64512&a)&&o>r+1&&(i=t.charCodeAt(r+1),56320===(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),r++)),128>a?e[s++]=a:2048>a?(e[s++]=192|a>>>6,e[s++]=128|63&a):65536>a?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e},a.buf2binstring=function(t){return i(t,t.length)},a.binstring2buf=function(t){for(var e=new n.Buf8(t.length),a=0,i=e.length;i>a;a++)e[a]=t.charCodeAt(a);return e},a.buf2string=function(t,e){var a,n,r,s,o=e||t.length,h=new Array(2*o);for(n=0,a=0;o>a;)if(r=t[a++],128>r)h[n++]=r;else if(s=l[r],s>4)h[n++]=65533,a+=s-1;else{for(r&=2===s?31:3===s?15:7;s>1&&o>a;)r=r<<6|63&t[a++],s--;s>1?h[n++]=65533:65536>r?h[n++]=r:(r-=65536,h[n++]=55296|r>>10&1023,h[n++]=56320|1023&r)}return i(h,n)},a.utf8border=function(t,e){var a;for(e=e||t.length,e>t.length&&(e=t.length),a=e-1;a>=0&&128===(192&t[a]);)a--;return 0>a?e:0===a?e:a+l[t[a]]>e?a:e}},{"./common":3}],5:[function(t,e,a){"use strict";function i(t,e,a,i){for(var n=65535&t|0,r=t>>>16&65535|0,s=0;0!==a;){s=a>2e3?2e3:a,a-=s;do{n=n+e[i++]|0,r=r+n|0}while(--s);n%=65521,r%=65521}return n|r<<16|0}e.exports=i},{}],6:[function(t,e,a){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],7:[function(t,e,a){"use strict";function i(){for(var t,e=[],a=0;256>a;a++){t=a;for(var i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}function n(t,e,a,i){var n=r,s=i+a;t=-1^t;for(var o=i;s>o;o++)t=t>>>8^n[255&(t^e[o])];return-1^t}var r=i();e.exports=n},{}],8:[function(t,e,a){"use strict";function i(t,e){return t.msg=N[e],e}function n(t){return(t<<1)-(t>4?9:0)}function r(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(A.arraySet(t.output,e.pending_buf,e.pending_out,a,t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))}function o(t,e){Z._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,s(t.strm)}function l(t,e){t.pending_buf[t.pending++]=e}function h(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function d(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,A.arraySet(e,t.input,t.next_in,n,a),1===t.state.wrap?t.adler=R(t.adler,e,n,a):2===t.state.wrap&&(t.adler=C(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n)}function f(t,e){var a,i,n=t.max_chain_length,r=t.strstart,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-ht?t.strstart-(t.w_size-ht):0,h=t.window,d=t.w_mask,f=t.prev,_=t.strstart+lt,u=h[r+s-1],c=h[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+s]===c&&h[a+s-1]===u&&h[a]===h[r]&&h[++a]===h[r+1]){r+=2,a++;do{}while(h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&_>r);if(i=lt-(_-r),r=_-lt,i>s){if(t.match_start=e,s=i,i>=o)break;u=h[r+s-1],c=h[r+s]}}}while((e=f[e&d])>l&&0!==--n);return s<=t.lookahead?s:t.lookahead}function _(t){var e,a,i,n,r,s=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-ht)){A.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,a=t.hash_size,e=a;do{i=t.head[--e],t.head[e]=i>=s?i-s:0}while(--a);a=s,e=a;do{i=t.prev[--e],t.prev[e]=i>=s?i-s:0}while(--a);n+=s}if(0===t.strm.avail_in)break;if(a=d(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=a,t.lookahead+t.insert>=ot)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(_(t),0===t.lookahead&&e===O)return wt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+a;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,o(t,!1),0===t.strm.avail_out))return wt;if(t.strstart-t.block_start>=t.w_size-ht&&(o(t,!1),0===t.strm.avail_out))return wt}return t.insert=0,e===F?(o(t,!0),0===t.strm.avail_out?vt:kt):t.strstart>t.block_start&&(o(t,!1),0===t.strm.avail_out)?wt:wt}function c(t,e){for(var a,i;;){if(t.lookahead=ot&&(t.ins_h=(t.ins_h<=ot)if(i=Z._tr_tally(t,t.strstart-t.match_start,t.match_length-ot),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ot){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=ot&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=ot-1)),t.prev_length>=ot&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-ot,i=Z._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ot),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<=ot&&t.strstart>0&&(n=t.strstart-1,i=s[n],i===s[++n]&&i===s[++n]&&i===s[++n])){r=t.strstart+lt;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&r>n);t.match_length=lt-(r-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ot?(a=Z._tr_tally(t,1,t.match_length-ot),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=Z._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(o(t,!1),0===t.strm.avail_out))return wt}return t.insert=0,e===F?(o(t,!0),0===t.strm.avail_out?vt:kt):t.last_lit&&(o(t,!1),0===t.strm.avail_out)?wt:pt}function m(t,e){for(var a;;){if(0===t.lookahead&&(_(t),0===t.lookahead)){if(e===O)return wt;break}if(t.match_length=0,a=Z._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(o(t,!1),0===t.strm.avail_out))return wt}return t.insert=0,e===F?(o(t,!0),0===t.strm.avail_out?vt:kt):t.last_lit&&(o(t,!1),0===t.strm.avail_out)?wt:pt}function w(t){t.window_size=2*t.w_size,r(t.head),t.max_lazy_match=E[t.level].max_lazy,t.good_match=E[t.level].good_length,t.nice_match=E[t.level].nice_length,t.max_chain_length=E[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ot-1,t.match_available=0,t.ins_h=0}function p(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=J,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new A.Buf16(2*rt),this.dyn_dtree=new A.Buf16(2*(2*it+1)),this.bl_tree=new A.Buf16(2*(2*nt+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new A.Buf16(st+1),this.heap=new A.Buf16(2*at+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new A.Buf16(2*at+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function v(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=W,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?ft:gt,t.adler=2===e.wrap?0:1,e.last_flush=O,Z._tr_init(e),D):i(t,H)}function k(t){var e=v(t);return e===D&&w(t.state),e}function x(t,e){return t&&t.state?2!==t.state.wrap?H:(t.state.gzhead=e,D):H}function y(t,e,a,n,r,s){if(!t)return H;var o=1;if(e===M&&(e=6),0>n?(o=0,n=-n):n>15&&(o=2,n-=16),1>r||r>Q||a!==J||8>n||n>15||0>e||e>9||0>s||s>G)return i(t,H);8===n&&(n=9);var l=new p;return t.state=l,l.strm=t,l.wrap=o,l.gzhead=null,l.w_bits=n,l.w_size=1<>1,l.l_buf=3*l.lit_bufsize,l.level=e,l.strategy=s,l.method=a,k(t)}function z(t,e){return y(t,e,J,V,$,X)}function B(t,e){var a,o,d,f;if(!t||!t.state||e>T||0>e)return t?i(t,H):H;if(o=t.state,!t.output||!t.input&&0!==t.avail_in||o.status===mt&&e!==F)return i(t,0===t.avail_out?K:H);if(o.strm=t,a=o.last_flush,o.last_flush=e,o.status===ft)if(2===o.wrap)t.adler=0,l(o,31),l(o,139),l(o,8),o.gzhead?(l(o,(o.gzhead.text?1:0)+(o.gzhead.hcrc?2:0)+(o.gzhead.extra?4:0)+(o.gzhead.name?8:0)+(o.gzhead.comment?16:0)),l(o,255&o.gzhead.time),l(o,o.gzhead.time>>8&255),l(o,o.gzhead.time>>16&255),l(o,o.gzhead.time>>24&255),l(o,9===o.level?2:o.strategy>=Y||o.level<2?4:0),l(o,255&o.gzhead.os),o.gzhead.extra&&o.gzhead.extra.length&&(l(o,255&o.gzhead.extra.length),l(o,o.gzhead.extra.length>>8&255)),o.gzhead.hcrc&&(t.adler=C(t.adler,o.pending_buf,o.pending,0)),o.gzindex=0,o.status=_t):(l(o,0),l(o,0),l(o,0),l(o,0),l(o,0),l(o,9===o.level?2:o.strategy>=Y||o.level<2?4:0),l(o,xt),o.status=gt);else{var _=J+(o.w_bits-8<<4)<<8,u=-1;u=o.strategy>=Y||o.level<2?0:o.level<6?1:6===o.level?2:3,_|=u<<6,0!==o.strstart&&(_|=dt),_+=31-_%31,o.status=gt,h(o,_),0!==o.strstart&&(h(o,t.adler>>>16),h(o,65535&t.adler)),t.adler=1}if(o.status===_t)if(o.gzhead.extra){for(d=o.pending;o.gzindex<(65535&o.gzhead.extra.length)&&(o.pending!==o.pending_buf_size||(o.gzhead.hcrc&&o.pending>d&&(t.adler=C(t.adler,o.pending_buf,o.pending-d,d)),s(t),d=o.pending,o.pending!==o.pending_buf_size));)l(o,255&o.gzhead.extra[o.gzindex]),o.gzindex++;o.gzhead.hcrc&&o.pending>d&&(t.adler=C(t.adler,o.pending_buf,o.pending-d,d)),o.gzindex===o.gzhead.extra.length&&(o.gzindex=0,o.status=ut)}else o.status=ut;if(o.status===ut)if(o.gzhead.name){d=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>d&&(t.adler=C(t.adler,o.pending_buf,o.pending-d,d)),s(t),d=o.pending,o.pending===o.pending_buf_size)){f=1;break}f=o.gzindexd&&(t.adler=C(t.adler,o.pending_buf,o.pending-d,d)),0===f&&(o.gzindex=0,o.status=ct)}else o.status=ct;if(o.status===ct)if(o.gzhead.comment){d=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>d&&(t.adler=C(t.adler,o.pending_buf,o.pending-d,d)),s(t),d=o.pending,o.pending===o.pending_buf_size)){f=1;break}f=o.gzindexd&&(t.adler=C(t.adler,o.pending_buf,o.pending-d,d)),0===f&&(o.status=bt)}else o.status=bt;if(o.status===bt&&(o.gzhead.hcrc?(o.pending+2>o.pending_buf_size&&s(t),o.pending+2<=o.pending_buf_size&&(l(o,255&t.adler),l(o,t.adler>>8&255),t.adler=0,o.status=gt)):o.status=gt),0!==o.pending){if(s(t),0===t.avail_out)return o.last_flush=-1,D}else if(0===t.avail_in&&n(e)<=n(a)&&e!==F)return i(t,K);if(o.status===mt&&0!==t.avail_in)return i(t,K);if(0!==t.avail_in||0!==o.lookahead||e!==O&&o.status!==mt){var c=o.strategy===Y?m(o,e):o.strategy===q?g(o,e):E[o.level].func(o,e);if((c===vt||c===kt)&&(o.status=mt),c===wt||c===vt)return 0===t.avail_out&&(o.last_flush=-1),D;if(c===pt&&(e===I?Z._tr_align(o):e!==T&&(Z._tr_stored_block(o,0,0,!1),e===U&&(r(o.head),0===o.lookahead&&(o.strstart=0,o.block_start=0,o.insert=0))),s(t),0===t.avail_out))return o.last_flush=-1,D}return e!==F?D:o.wrap<=0?L:(2===o.wrap?(l(o,255&t.adler),l(o,t.adler>>8&255),l(o,t.adler>>16&255),l(o,t.adler>>24&255),l(o,255&t.total_in),l(o,t.total_in>>8&255),l(o,t.total_in>>16&255),l(o,t.total_in>>24&255)):(h(o,t.adler>>>16),h(o,65535&t.adler)),s(t),o.wrap>0&&(o.wrap=-o.wrap),0!==o.pending?D:L)}function S(t){var e;return t&&t.state?(e=t.state.status,e!==ft&&e!==_t&&e!==ut&&e!==ct&&e!==bt&&e!==gt&&e!==mt?i(t,H):(t.state=null,e===gt?i(t,j):D)):H}var E,A=t("../utils/common"),Z=t("./trees"),R=t("./adler32"),C=t("./crc32"),N=t("./messages"),O=0,I=1,U=3,F=4,T=5,D=0,L=1,H=-2,j=-3,K=-5,M=-1,P=1,Y=2,q=3,G=4,X=0,W=2,J=8,Q=9,V=15,$=8,tt=29,et=256,at=et+1+tt,it=30,nt=19,rt=2*at+1,st=15,ot=3,lt=258,ht=lt+ot+1,dt=32,ft=42,_t=69,ut=73,ct=91,bt=103,gt=113,mt=666,wt=1,pt=2,vt=3,kt=4,xt=3,yt=function(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n};E=[new yt(0,0,0,0,u),new yt(4,4,8,4,c),new yt(4,5,16,8,c),new yt(4,6,32,32,c),new yt(4,4,16,16,b),new yt(8,16,32,32,b),new yt(8,16,128,128,b),new yt(8,32,128,256,b),new yt(32,128,258,1024,b),new yt(32,258,258,4096,b)],a.deflateInit=z,a.deflateInit2=y,a.deflateReset=k,a.deflateResetKeep=v,a.deflateSetHeader=x,a.deflate=B,a.deflateEnd=S,a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":3,"./adler32":5,"./crc32":7,"./messages":13,"./trees":14}],9:[function(t,e,a){"use strict";function i(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}e.exports=i},{}],10:[function(t,e,a){"use strict";var i=30,n=12;e.exports=function(t,e){var a,r,s,o,l,h,d,f,_,u,c,b,g,m,w,p,v,k,x,y,z,B,S,E,A;a=t.state,r=t.next_in,E=t.input,s=r+(t.avail_in-5),o=t.next_out,A=t.output,l=o-(e-t.avail_out),h=o+(t.avail_out-257),d=a.dmax,f=a.wsize,_=a.whave,u=a.wnext,c=a.window,b=a.hold,g=a.bits,m=a.lencode,w=a.distcode,p=(1<g&&(b+=E[r++]<>>24,b>>>=x,g-=x,x=k>>>16&255,0===x)A[o++]=65535&k;else{if(!(16&x)){if(0===(64&x)){k=m[(65535&k)+(b&(1<g&&(b+=E[r++]<>>=x,g-=x),15>g&&(b+=E[r++]<>>24,b>>>=x,g-=x,x=k>>>16&255,!(16&x)){if(0===(64&x)){k=w[(65535&k)+(b&(1<g&&(b+=E[r++]<g&&(b+=E[r++]<d){t.msg="invalid distance too far back",a.mode=i;break t}if(b>>>=x,g-=x,x=o-l,z>x){if(x=z-x,x>_&&a.sane){t.msg="invalid distance too far back",a.mode=i;break t}if(B=0,S=c,0===u){if(B+=f-x,y>x){y-=x;do{A[o++]=c[B++]}while(--x);B=o-z,S=A}}else if(x>u){if(B+=f+u-x,x-=u,y>x){y-=x;do{A[o++]=c[B++]}while(--x);if(B=0,y>u){x=u,y-=x;do{A[o++]=c[B++]}while(--x);B=o-z,S=A}}}else if(B+=u-x,y>x){y-=x;do{A[o++]=c[B++]}while(--x);B=o-z,S=A}for(;y>2;)A[o++]=S[B++],A[o++]=S[B++],A[o++]=S[B++],y-=3;y&&(A[o++]=S[B++],y>1&&(A[o++]=S[B++]))}else{B=o-z;do{A[o++]=A[B++],A[o++]=A[B++],A[o++]=A[B++],y-=3}while(y>2);y&&(A[o++]=A[B++],y>1&&(A[o++]=A[B++]))}break}}break}}while(s>r&&h>o);y=g>>3,r-=y,g-=y<<3,b&=(1<r?5+(s-r):5-(r-s),t.avail_out=h>o?257+(h-o):257-(o-h),a.hold=b,a.bits=g}},{}],11:[function(t,e,a){"use strict";function i(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function n(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new m.Buf16(320),this.work=new m.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=F,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new m.Buf32(ct),e.distcode=e.distdyn=new m.Buf32(bt),e.sane=1,e.back=-1,A):C}function s(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,r(t)):C}function o(t,e){var a,i;return t&&t.state?(i=t.state,0>e?(a=0,e=-e):(a=(e>>4)+1,48>e&&(e&=15)),e&&(8>e||e>15)?C:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,s(t))):C}function l(t,e){var a,i;return t?(i=new n,t.state=i,i.window=null,a=o(t,e),a!==A&&(t.state=null),a):C}function h(t){return l(t,mt)}function d(t){if(wt){var e;for(b=new m.Buf32(512),g=new m.Buf32(32),e=0;144>e;)t.lens[e++]=8;for(;256>e;)t.lens[e++]=9;for(;280>e;)t.lens[e++]=7;for(;288>e;)t.lens[e++]=8;for(k(y,t.lens,0,288,b,0,t.work,{bits:9}),e=0;32>e;)t.lens[e++]=5;k(z,t.lens,0,32,g,0,t.work,{bits:5}),wt=!1}t.lencode=b,t.lenbits=9,t.distcode=g,t.distbits=5}function f(t,e,a,i){var n,r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(m.arraySet(r.window,e,a-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>i&&(n=i),m.arraySet(r.window,e,a-i,n,r.wnext),i-=n,i?(m.arraySet(r.window,e,a-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whaveu;){if(0===l)break t;l--,_+=n[s++]<>>8&255,a.check=p(a.check,Et,2,0),_=0,u=0,a.mode=T;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&_)<<8)+(_>>8))%31){t.msg="incorrect header check",a.mode=ft;break}if((15&_)!==U){t.msg="unknown compression method",a.mode=ft;break}if(_>>>=4,u-=4,xt=(15&_)+8,0===a.wbits)a.wbits=xt;else if(xt>a.wbits){t.msg="invalid window size",a.mode=ft;break}a.dmax=1<u;){if(0===l)break t;l--,_+=n[s++]<>8&1),512&a.flags&&(Et[0]=255&_,Et[1]=_>>>8&255,a.check=p(a.check,Et,2,0)),_=0,u=0,a.mode=D;case D:for(;32>u;){if(0===l)break t;l--,_+=n[s++]<>>8&255,Et[2]=_>>>16&255,Et[3]=_>>>24&255,a.check=p(a.check,Et,4,0)),_=0,u=0,a.mode=L;case L:for(;16>u;){if(0===l)break t;l--,_+=n[s++]<>8),512&a.flags&&(Et[0]=255&_,Et[1]=_>>>8&255,a.check=p(a.check,Et,2,0)),_=0,u=0,a.mode=H;case H:if(1024&a.flags){for(;16>u;){if(0===l)break t;l--,_+=n[s++]<>>8&255,a.check=p(a.check,Et,2,0)),_=0,u=0}else a.head&&(a.head.extra=null);a.mode=j;case j:if(1024&a.flags&&(g=a.length,g>l&&(g=l),g&&(a.head&&(xt=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Array(a.head.extra_len)),m.arraySet(a.head.extra,n,s,g,xt)),512&a.flags&&(a.check=p(a.check,n,g,s)),l-=g,s+=g,a.length-=g),a.length))break t;a.length=0,a.mode=K;case K:if(2048&a.flags){if(0===l)break t;g=0;do{xt=n[s+g++],a.head&&xt&&a.length<65536&&(a.head.name+=String.fromCharCode(xt))}while(xt&&l>g);if(512&a.flags&&(a.check=p(a.check,n,g,s)),l-=g,s+=g,xt)break t}else a.head&&(a.head.name=null);a.length=0,a.mode=M;case M:if(4096&a.flags){if(0===l)break t;g=0;do{xt=n[s+g++],a.head&&xt&&a.length<65536&&(a.head.comment+=String.fromCharCode(xt))}while(xt&&l>g);if(512&a.flags&&(a.check=p(a.check,n,g,s)),l-=g,s+=g,xt)break t}else a.head&&(a.head.comment=null);a.mode=P;case P:if(512&a.flags){for(;16>u;){if(0===l)break t;l--,_+=n[s++]<>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=G;break;case Y:for(;32>u;){if(0===l)break t;l--,_+=n[s++]<>>=7&u,u-=7&u,a.mode=lt;break}for(;3>u;){if(0===l)break t;l--,_+=n[s++]<>>=1,u-=1,3&_){case 0:a.mode=W;break;case 1:if(d(a),a.mode=et,e===E){_>>>=2,u-=2;break t}break;case 2:a.mode=V;break;case 3:t.msg="invalid block type",a.mode=ft}_>>>=2,u-=2;break;case W:for(_>>>=7&u,u-=7&u;32>u;){if(0===l)break t;l--,_+=n[s++]<>>16^65535)){t.msg="invalid stored block lengths",a.mode=ft;break}if(a.length=65535&_,_=0,u=0,a.mode=J,e===E)break t;case J:a.mode=Q;case Q:if(g=a.length){if(g>l&&(g=l),g>h&&(g=h),0===g)break t;m.arraySet(r,n,s,g,o),l-=g,s+=g,h-=g,o+=g,a.length-=g;break}a.mode=G;break;case V:for(;14>u;){if(0===l)break t;l--,_+=n[s++]<>>=5,u-=5,a.ndist=(31&_)+1,_>>>=5,u-=5,a.ncode=(15&_)+4,_>>>=4,u-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=ft;break}a.have=0,a.mode=$;case $:for(;a.haveu;){if(0===l)break t;l--,_+=n[s++]<>>=3,u-=3}for(;a.have<19;)a.lens[At[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,zt={bits:a.lenbits},yt=k(x,a.lens,0,19,a.lencode,0,a.work,zt),a.lenbits=zt.bits,yt){t.msg="invalid code lengths set",a.mode=ft;break}a.have=0,a.mode=tt;case tt:for(;a.have>>24,mt=St>>>16&255,wt=65535&St,!(u>=gt);){if(0===l)break t;l--,_+=n[s++]<wt)_>>>=gt,u-=gt,a.lens[a.have++]=wt;else{if(16===wt){for(Bt=gt+2;Bt>u;){if(0===l)break t;l--,_+=n[s++]<>>=gt,u-=gt,0===a.have){t.msg="invalid bit length repeat",a.mode=ft;break}xt=a.lens[a.have-1],g=3+(3&_),_>>>=2,u-=2}else if(17===wt){for(Bt=gt+3;Bt>u;){if(0===l)break t;l--,_+=n[s++]<>>=gt,u-=gt,xt=0,g=3+(7&_),_>>>=3,u-=3}else{for(Bt=gt+7;Bt>u;){if(0===l)break t;l--,_+=n[s++]<>>=gt,u-=gt,xt=0,g=11+(127&_),_>>>=7,u-=7}if(a.have+g>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=ft;break}for(;g--;)a.lens[a.have++]=xt}}if(a.mode===ft)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=ft;break}if(a.lenbits=9,zt={bits:a.lenbits},yt=k(y,a.lens,0,a.nlen,a.lencode,0,a.work,zt),a.lenbits=zt.bits,yt){t.msg="invalid literal/lengths set",a.mode=ft;break}if(a.distbits=6,a.distcode=a.distdyn,zt={bits:a.distbits},yt=k(z,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,zt),a.distbits=zt.bits,yt){t.msg="invalid distances set",a.mode=ft;break}if(a.mode=et,e===E)break t;case et:a.mode=at;case at:if(l>=6&&h>=258){t.next_out=o,t.avail_out=h,t.next_in=s,t.avail_in=l,a.hold=_,a.bits=u,v(t,b),o=t.next_out,r=t.output,h=t.avail_out,s=t.next_in,n=t.input,l=t.avail_in,_=a.hold,u=a.bits,a.mode===G&&(a.back=-1);break}for(a.back=0;St=a.lencode[_&(1<>>24,mt=St>>>16&255,wt=65535&St,!(u>=gt);){if(0===l)break t;l--,_+=n[s++]<>pt)],gt=St>>>24,mt=St>>>16&255,wt=65535&St,!(u>=pt+gt);){if(0===l)break t;l--,_+=n[s++]<>>=pt,u-=pt,a.back+=pt}if(_>>>=gt,u-=gt,a.back+=gt,a.length=wt,0===mt){a.mode=ot;break}if(32&mt){a.back=-1,a.mode=G;break}if(64&mt){t.msg="invalid literal/length code",a.mode=ft;break}a.extra=15&mt,a.mode=it;case it:if(a.extra){for(Bt=a.extra;Bt>u;){if(0===l)break t;l--,_+=n[s++]<>>=a.extra,u-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=nt;case nt:for(;St=a.distcode[_&(1<>>24,mt=St>>>16&255,wt=65535&St,!(u>=gt);){if(0===l)break t;l--,_+=n[s++]<>pt)],gt=St>>>24,mt=St>>>16&255,wt=65535&St,!(u>=pt+gt);){if(0===l)break t;l--,_+=n[s++]<>>=pt,u-=pt,a.back+=pt}if(_>>>=gt,u-=gt,a.back+=gt,64&mt){t.msg="invalid distance code",a.mode=ft;break}a.offset=wt,a.extra=15&mt,a.mode=rt;case rt:if(a.extra){for(Bt=a.extra;Bt>u;){if(0===l)break t;l--,_+=n[s++]<>>=a.extra,u-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=ft;break}a.mode=st;case st:if(0===h)break t;if(g=b-h,a.offset>g){if(g=a.offset-g,g>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=ft;break}g>a.wnext?(g-=a.wnext,ct=a.wsize-g):ct=a.wnext-g,g>a.length&&(g=a.length),bt=a.window}else bt=r,ct=o-a.offset,g=a.length;g>h&&(g=h),h-=g,a.length-=g;do{r[o++]=bt[ct++]}while(--g);0===a.length&&(a.mode=at);break;case ot:if(0===h)break t;r[o++]=a.length,h--,a.mode=at;break;case lt:if(a.wrap){for(;32>u;){if(0===l)break t;l--,_|=n[s++]<u;){if(0===l)break t;l--,_+=n[s++]<=Z;Z++)j[Z]=0;for(R=0;c>R;R++)j[e[a+R]]++;for(O=A,N=n;N>=1&&0===j[N];N--);if(O>N&&(O=N),0===N)return b[g++]=20971520,b[g++]=20971520,w.bits=1,0;for(C=1;N>C&&0===j[C];C++);for(C>O&&(O=C),F=1,Z=1;n>=Z;Z++)if(F<<=1,F-=j[Z],0>F)return-1;if(F>0&&(t===o||1!==N))return-1;for(K[1]=0,Z=1;n>Z;Z++)K[Z+1]=K[Z]+j[Z];for(R=0;c>R;R++)0!==e[a+R]&&(m[K[e[a+R]]++]=R);if(t===o?(L=M=m,z=19):t===l?(L=d,H-=257,M=f,P-=257,z=256):(L=_,M=u,z=-1),D=0,R=0,Z=C,y=g,I=O,U=0,k=-1,T=1<r||t===h&&T>s)return 1;for(var Y=0;;){Y++,B=Z-U,m[R]z?(S=M[P+m[R]],E=L[H+m[R]]):(S=96,E=0),p=1<>U)+v]=B<<24|S<<16|E|0}while(0!==v);for(p=1<>=1;if(0!==p?(D&=p-1,D+=p):D=0,R++,0===--j[Z]){if(Z===N)break;Z=e[a+m[R]]}if(Z>O&&(D&x)!==k){for(0===U&&(U=O),y+=C,I=Z-U,F=1<I+U&&(F-=j[I+U],!(0>=F));)I++,F<<=1;if(T+=1<r||t===h&&T>s)return 1;k=D&x,b[k]=O<<24|I<<16|y-g|0}}return 0!==D&&(b[y+D]=Z-U<<24|64<<16|0),w.bits=O,0}},{"../utils/common":3}],13:[function(t,e,a){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],14:[function(t,e,a){"use strict";function i(t){for(var e=t.length;--e>=0;)t[e]=0}function n(t){return 256>t?st[t]:st[256+(t>>>7)]}function r(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function s(t,e,a){t.bi_valid>G-a?(t.bi_buf|=e<>G-t.bi_valid,t.bi_valid+=a-G):(t.bi_buf|=e<>>=1,a<<=1}while(--e>0);return a>>>1}function h(t){16===t.bi_valid?(r(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function d(t,e){var a,i,n,r,s,o,l=e.dyn_tree,h=e.max_code,d=e.stat_desc.static_tree,f=e.stat_desc.has_stree,_=e.stat_desc.extra_bits,u=e.stat_desc.extra_base,c=e.stat_desc.max_length,b=0;for(r=0;q>=r;r++)t.bl_count[r]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;Y>a;a++)i=t.heap[a],r=l[2*l[2*i+1]+1]+1,r>c&&(r=c,b++),l[2*i+1]=r,i>h||(t.bl_count[r]++,s=0,i>=u&&(s=_[i-u]),o=l[2*i],t.opt_len+=o*(r+s),f&&(t.static_len+=o*(d[2*i+1]+s)));if(0!==b){do{for(r=c-1;0===t.bl_count[r];)r--;t.bl_count[r]--,t.bl_count[r+1]+=2,t.bl_count[c]--,b-=2}while(b>0);for(r=c;0!==r;r--)for(i=t.bl_count[r];0!==i;)n=t.heap[--a],n>h||(l[2*n+1]!==r&&(t.opt_len+=(r-l[2*n+1])*l[2*n],l[2*n+1]=r),i--)}}function f(t,e,a){var i,n,r=new Array(q+1),s=0;for(i=1;q>=i;i++)r[i]=s=s+a[i-1]<<1;for(n=0;e>=n;n++){var o=t[2*n+1];0!==o&&(t[2*n]=l(r[o]++,o))}}function _(){var t,e,a,i,n,r=new Array(q+1);for(a=0,i=0;H-1>i;i++)for(lt[i]=a,t=0;t<1<<$[i];t++)ot[a++]=i;for(ot[a-1]=i,n=0,i=0;16>i;i++)for(ht[i]=n,t=0;t<1<>=7;M>i;i++)for(ht[i]=n<<7,t=0;t<1<=e;e++)r[e]=0;for(t=0;143>=t;)nt[2*t+1]=8,t++,r[8]++;for(;255>=t;)nt[2*t+1]=9,t++,r[9]++;for(;279>=t;)nt[2*t+1]=7,t++,r[7]++;for(;287>=t;)nt[2*t+1]=8,t++,r[8]++;for(f(nt,K+1,r),t=0;M>t;t++)rt[2*t+1]=5,rt[2*t]=l(t,5);dt=new ut(nt,$,j+1,K,q),ft=new ut(rt,tt,0,M,q),_t=new ut(new Array(0),et,0,P,X)}function u(t){var e;for(e=0;K>e;e++)t.dyn_ltree[2*e]=0;for(e=0;M>e;e++)t.dyn_dtree[2*e]=0;for(e=0;P>e;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*W]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function c(t){t.bi_valid>8?r(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function b(t,e,a,i){c(t),i&&(r(t,a),r(t,~a)),R.arraySet(t.pending_buf,t.window,e,a,t.pending),t.pending+=a}function g(t,e,a,i){var n=2*e,r=2*a;return t[n]a;a++)0!==r[2*a]?(t.heap[++t.heap_len]=h=a,t.depth[a]=0):r[2*a+1]=0;for(;t.heap_len<2;)n=t.heap[++t.heap_len]=2>h?++h:0,r[2*n]=1,t.depth[n]=0,t.opt_len--,o&&(t.static_len-=s[2*n+1]);for(e.max_code=h,a=t.heap_len>>1;a>=1;a--)m(t,r,a);n=l;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],m(t,r,1),i=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=i,r[2*n]=r[2*a]+r[2*i],t.depth[n]=(t.depth[a]>=t.depth[i]?t.depth[a]:t.depth[i])+1,r[2*a+1]=r[2*i+1]=n,t.heap[1]=n++,m(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],d(t,e),f(r,h,t.bl_count)}function v(t,e,a){var i,n,r=-1,s=e[1],o=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;a>=i;i++)n=s,s=e[2*(i+1)+1],++oo?t.bl_tree[2*n]+=o:0!==n?(n!==r&&t.bl_tree[2*n]++,t.bl_tree[2*J]++):10>=o?t.bl_tree[2*Q]++:t.bl_tree[2*V]++,o=0,r=n,0===s?(l=138,h=3):n===s?(l=6,h=3):(l=7,h=4))}function k(t,e,a){var i,n,r=-1,l=e[1],h=0,d=7,f=4;for(0===l&&(d=138,f=3),i=0;a>=i;i++)if(n=l,l=e[2*(i+1)+1],!(++hh){do{o(t,n,t.bl_tree)}while(0!==--h)}else 0!==n?(n!==r&&(o(t,n,t.bl_tree),h--),o(t,J,t.bl_tree),s(t,h-3,2)):10>=h?(o(t,Q,t.bl_tree),s(t,h-3,3)):(o(t,V,t.bl_tree),s(t,h-11,7));h=0,r=n,0===l?(d=138,f=3):n===l?(d=6,f=3):(d=7,f=4)}}function x(t){var e;for(v(t,t.dyn_ltree,t.l_desc.max_code),v(t,t.dyn_dtree,t.d_desc.max_code),p(t,t.bl_desc),e=P-1;e>=3&&0===t.bl_tree[2*at[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function y(t,e,a,i){var n;for(s(t,e-257,5),s(t,a-1,5),s(t,i-4,4),n=0;i>n;n++)s(t,t.bl_tree[2*at[n]+1],3);k(t,t.dyn_ltree,e-1),k(t,t.dyn_dtree,a-1)}function z(t){var e,a=4093624447;for(e=0;31>=e;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return N;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return O;for(e=32;j>e;e++)if(0!==t.dyn_ltree[2*e])return O;return N}function B(t){bt||(_(),bt=!0),t.l_desc=new ct(t.dyn_ltree,dt),t.d_desc=new ct(t.dyn_dtree,ft),t.bl_desc=new ct(t.bl_tree,_t),t.bi_buf=0,t.bi_valid=0,u(t)}function S(t,e,a,i){s(t,(U<<1)+(i?1:0),3),b(t,e,a,!0)}function E(t){s(t,F<<1,3),o(t,W,nt),h(t)}function A(t,e,a,i){var n,r,o=0;t.level>0?(t.strm.data_type===I&&(t.strm.data_type=z(t)),p(t,t.l_desc),p(t,t.d_desc),o=x(t),n=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,n>=r&&(n=r)):n=r=a+5,n>=a+4&&-1!==e?S(t,e,a,i):t.strategy===C||r===n?(s(t,(F<<1)+(i?1:0),3),w(t,nt,rt)):(s(t,(T<<1)+(i?1:0),3),y(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),w(t,t.dyn_ltree,t.dyn_dtree)),u(t),i&&c(t)}function Z(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(ot[a]+j+1)]++,t.dyn_dtree[2*n(e)]++),t.last_lit===t.lit_bufsize-1}var R=t("../utils/common"),C=4,N=0,O=1,I=2,U=0,F=1,T=2,D=3,L=258,H=29,j=256,K=j+1+H,M=30,P=19,Y=2*K+1,q=15,G=16,X=7,W=256,J=16,Q=17,V=18,$=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],tt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],et=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],at=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],it=512,nt=new Array(2*(K+2));i(nt);var rt=new Array(2*M);i(rt);var st=new Array(it);i(st);var ot=new Array(L-D+1);i(ot);var lt=new Array(H);i(lt);var ht=new Array(M);i(ht);var dt,ft,_t,ut=function(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length},ct=function(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e},bt=!1;a._tr_init=B,a._tr_stored_block=S,a._tr_flush_block=A,a._tr_tally=Z,a._tr_align=E},{"../utils/common":3}],15:[function(t,e,a){"use strict";function i(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}e.exports=i},{}],"/":[function(t,e,a){"use strict";var i=t("./lib/utils/common").assign,n=t("./lib/deflate"),r=t("./lib/inflate"),s=t("./lib/zlib/constants"),o={};i(o,n,r,s),e.exports=o},{"./lib/deflate":1,"./lib/inflate":2,"./lib/utils/common":3,"./lib/zlib/constants":6}]},{},[])("/")}); \ No newline at end of file diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js b/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js deleted file mode 100644 index c78b4623f..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! cornerstone-wado-image-loader - 0.15.1 - 2017-10-26 | (c) 2016 Chris Hafey | https://github.com/chafey/cornerstoneWADOImageLoader */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cornerstoneWADOImageLoaderWebWorker",[],t):"object"==typeof exports?exports.cornerstoneWADOImageLoaderWebWorker=t():e.cornerstoneWADOImageLoaderWebWorker=t()}(this,function(){return function(e){function t(a){if(r[a])return r[a].exports;var n=r[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=55)}({2:function(e,t,r){"use strict";function a(e){for(var t=e[0],r=e[0],a=void 0,n=e.length,i=1;i1&&(e.photometricInterpretation="RGB"),e}function o(e){if(!e.usePDFJS&&"undefined"==typeof OpenJPEG)throw"OpenJPEG decoder not loaded";if(!(s||(s=OpenJPEG())&&s._jp2_decode))throw"OpenJPEG failed to initialize"}function l(e,t,r,n){return n=n||{},o(r),n.usePDFJS||r.usePDFJS?a(e,t):i(e,t)}Object.defineProperty(t,"__esModule",{value:!0});var s=void 0;t.default=l,t.initializeJPEG2000=o},38:function(e,t,r){"use strict";function a(e,t){var r=o._malloc(e.length);o.writeArrayToMemory(e,r);var a=o._malloc(4),n=o._malloc(4),i=o._malloc(4),l=o._malloc(4),s=o._malloc(4),f=o._malloc(4),u=o._malloc(4),d=o._malloc(4),c=o._malloc(4),p=o.ccall("jpegls_decode","number",["number","number","number","number","number","number","number","number","number","number","number"],[r,e.length,a,n,i,l,s,f,d,u,c]),m={result:p,width:o.getValue(i,"i32"),height:o.getValue(l,"i32"),bitsPerSample:o.getValue(s,"i32"),stride:o.getValue(f,"i32"),components:o.getValue(d,"i32"),allowedLossyError:o.getValue(u,"i32"),interleaveMode:o.getValue(c,"i32"),pixelData:void 0},g=o.getValue(a,"*");return m.bitsPerSample<=8?(m.pixelData=new Uint8Array(m.width*m.height*m.components),m.pixelData.set(new Uint8Array(o.HEAP8.buffer,g,m.pixelData.length))):t?(m.pixelData=new Int16Array(m.width*m.height*m.components),m.pixelData.set(new Int16Array(o.HEAP16.buffer,g,m.pixelData.length))):(m.pixelData=new Uint16Array(m.width*m.height*m.components),m.pixelData.set(new Uint16Array(o.HEAP16.buffer,g,m.pixelData.length))),o._free(r),o._free(g),o._free(a),o._free(n),o._free(i),o._free(l),o._free(s),o._free(f),o._free(d),o._free(c),m}function n(){if("undefined"==typeof CharLS)throw"No JPEG-LS decoder loaded";if(!(o||(o=CharLS())&&o._jpegls_decode))throw"JPEG-LS failed to initialize"}function i(e,t){n();var r=a(t,1===e.pixelRepresentation);if(0!==r.result&&6!==r.result)throw"JPEG-LS decoder failed to decode frame (error code "+r.result+")";return e.columns=r.width,e.rows=r.height,e.pixelData=r.pixelData,e}Object.defineProperty(t,"__esModule",{value:!0});var o=void 0;t.default=i,t.initializeJPEGLS=n},55:function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.version=t.registerTaskHandler=void 0;var n=r(9);Object.defineProperty(t,"version",{enumerable:!0,get:function(){return a(n).default}});var i=r(56),o=r(57),l=a(o);(0,i.registerTaskHandler)(l.default),t.registerTaskHandler=i.registerTaskHandler},56:function(e,t,r){"use strict";function a(e){if(!l){if(s=e.config,e.config.webWorkerTaskPaths)for(var t=0;t>8&255}function n(e,t){if(16===e.bitsAllocated){var r=t.buffer,n=t.byteOffset,i=t.length;n%2&&(r=r.slice(n),n=0),0===e.pixelRepresentation?e.pixelData=new Uint16Array(r,n,i/2):e.pixelData=new Int16Array(r,n,i/2);for(var o=0;o=0&&m<=127)for(var g=0;g=-127)for(var y=o[d++],b=0;b<1-m&&s=0&&m<=127)for(var g=0;g=-127)for(var y=o[d++],b=0;b<1-m&&s=0&&m<=127)for(var g=0;g=-127)for(var y=o[c++],b=0;b<1-m&&u 1) {\n imageFrame.photometricInterpretation = 'RGB';\n }\n\n return imageFrame;\n}\n\nfunction initializeJPEG2000(decodeConfig) {\n // check to make sure codec is loaded\n if (!decodeConfig.usePDFJS) {\n if (typeof OpenJPEG === 'undefined') {\n throw 'OpenJPEG decoder not loaded';\n }\n }\n\n if (!openJPEG) {\n openJPEG = OpenJPEG();\n if (!openJPEG || !openJPEG._jp2_decode) {\n throw 'OpenJPEG failed to initialize';\n }\n }\n}\n\nfunction decodeJPEG2000(imageFrame, pixelData, decodeConfig, options) {\n options = options || {};\n\n initializeJPEG2000(decodeConfig);\n\n if (options.usePDFJS || decodeConfig.usePDFJS) {\n // OHIF image-JPEG2000 https://github.com/OHIF/image-JPEG2000\n // console.log('PDFJS')\n return decodeJpx(imageFrame, pixelData);\n }\n\n // OpenJPEG2000 https://github.com/jpambrun/openjpeg\n // console.log('OpenJPEG')\n return decodeOpenJpeg2000(imageFrame, pixelData);\n}\n\nexports.default = decodeJPEG2000;\nexports.initializeJPEG2000 = initializeJPEG2000;\n\n/***/ }),\n\n/***/ 38:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n\nvar charLS = void 0;\n\nfunction jpegLSDecode(data, isSigned) {\n\n // prepare input parameters\n var dataPtr = charLS._malloc(data.length);\n\n charLS.writeArrayToMemory(data, dataPtr);\n\n // prepare output parameters\n var imagePtrPtr = charLS._malloc(4);\n var imageSizePtr = charLS._malloc(4);\n var widthPtr = charLS._malloc(4);\n var heightPtr = charLS._malloc(4);\n var bitsPerSamplePtr = charLS._malloc(4);\n var stridePtr = charLS._malloc(4);\n var allowedLossyErrorPtr = charLS._malloc(4);\n var componentsPtr = charLS._malloc(4);\n var interleaveModePtr = charLS._malloc(4);\n\n // Decode the image\n var result = charLS.ccall('jpegls_decode', 'number', ['number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number'], [dataPtr, data.length, imagePtrPtr, imageSizePtr, widthPtr, heightPtr, bitsPerSamplePtr, stridePtr, componentsPtr, allowedLossyErrorPtr, interleaveModePtr]);\n\n // Extract result values into object\n var image = {\n result: result,\n width: charLS.getValue(widthPtr, 'i32'),\n height: charLS.getValue(heightPtr, 'i32'),\n bitsPerSample: charLS.getValue(bitsPerSamplePtr, 'i32'),\n stride: charLS.getValue(stridePtr, 'i32'),\n components: charLS.getValue(componentsPtr, 'i32'),\n allowedLossyError: charLS.getValue(allowedLossyErrorPtr, 'i32'),\n interleaveMode: charLS.getValue(interleaveModePtr, 'i32'),\n pixelData: undefined\n };\n\n // Copy image from emscripten heap into appropriate array buffer type\n var imagePtr = charLS.getValue(imagePtrPtr, '*');\n\n if (image.bitsPerSample <= 8) {\n image.pixelData = new Uint8Array(image.width * image.height * image.components);\n image.pixelData.set(new Uint8Array(charLS.HEAP8.buffer, imagePtr, image.pixelData.length));\n } else if (isSigned) {\n image.pixelData = new Int16Array(image.width * image.height * image.components);\n image.pixelData.set(new Int16Array(charLS.HEAP16.buffer, imagePtr, image.pixelData.length));\n } else {\n image.pixelData = new Uint16Array(image.width * image.height * image.components);\n image.pixelData.set(new Uint16Array(charLS.HEAP16.buffer, imagePtr, image.pixelData.length));\n }\n\n // free memory and return image object\n charLS._free(dataPtr);\n charLS._free(imagePtr);\n charLS._free(imagePtrPtr);\n charLS._free(imageSizePtr);\n charLS._free(widthPtr);\n charLS._free(heightPtr);\n charLS._free(bitsPerSamplePtr);\n charLS._free(stridePtr);\n charLS._free(componentsPtr);\n charLS._free(interleaveModePtr);\n\n return image;\n}\n\nfunction initializeJPEGLS() {\n // check to make sure codec is loaded\n if (typeof CharLS === 'undefined') {\n throw 'No JPEG-LS decoder loaded';\n }\n\n // Try to initialize CharLS\n // CharLS https://github.com/chafey/charls\n if (!charLS) {\n charLS = CharLS();\n if (!charLS || !charLS._jpegls_decode) {\n throw 'JPEG-LS failed to initialize';\n }\n }\n}\n\nfunction decodeJPEGLS(imageFrame, pixelData) {\n initializeJPEGLS();\n\n var image = jpegLSDecode(pixelData, imageFrame.pixelRepresentation === 1);\n // console.log(image);\n\n // throw error if not success or too much data\n if (image.result !== 0 && image.result !== 6) {\n throw 'JPEG-LS decoder failed to decode frame (error code ' + image.result + ')';\n }\n\n imageFrame.columns = image.width;\n imageFrame.rows = image.height;\n imageFrame.pixelData = image.pixelData;\n\n return imageFrame;\n}\n\nexports.default = decodeJPEGLS;\nexports.initializeJPEGLS = initializeJPEGLS;\n\n/***/ }),\n\n/***/ 55:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.version = exports.registerTaskHandler = undefined;\n\nvar _version = __webpack_require__(9);\n\nObject.defineProperty(exports, 'version', {\n enumerable: true,\n get: function get() {\n return _interopRequireDefault(_version).default;\n }\n});\n\nvar _webWorker = __webpack_require__(56);\n\nvar _decodeTask = __webpack_require__(57);\n\nvar _decodeTask2 = _interopRequireDefault(_decodeTask);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// register our task\n(0, _webWorker.registerTaskHandler)(_decodeTask2.default);\n\nexports.registerTaskHandler = _webWorker.registerTaskHandler;\n\n/***/ }),\n\n/***/ 56:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.registerTaskHandler = registerTaskHandler;\n// an object of task handlers\nvar taskHandlers = {};\n\n// Flag to ensure web worker is only initialized once\nvar initialized = false;\n\n// the configuration object passed in when the web worker manager is initialized\nvar config = void 0;\n\n/**\n * Initialization function that loads additional web workers and initializes them\n * @param data\n */\nfunction initialize(data) {\n // console.log('web worker initialize ', data.workerIndex);\n // prevent initialization from happening more than once\n if (initialized) {\n return;\n }\n\n // save the config data\n config = data.config;\n\n // load any additional web worker tasks\n if (data.config.webWorkerTaskPaths) {\n for (var i = 0; i < data.config.webWorkerTaskPaths.length; i++) {\n self.importScripts(data.config.webWorkerTaskPaths[i]);\n }\n }\n\n // initialize each task handler\n Object.keys(taskHandlers).forEach(function (key) {\n taskHandlers[key].initialize(config.taskConfiguration);\n });\n\n // tell main ui thread that we have completed initialization\n self.postMessage({\n taskType: 'initialize',\n status: 'success',\n result: {},\n workerIndex: data.workerIndex\n });\n\n initialized = true;\n}\n\n/**\n * Function exposed to web worker tasks to register themselves\n * @param taskHandler\n */\nfunction registerTaskHandler(taskHandler) {\n if (taskHandlers[taskHandler.taskType]) {\n console.log('attempt to register duplicate task handler \"', taskHandler.taskType, '\"');\n\n return false;\n }\n taskHandlers[taskHandler.taskType] = taskHandler;\n if (initialized) {\n taskHandler.initialize(config.taskConfiguration);\n }\n}\n\n/**\n * Function to load a new web worker task with updated configuration\n * @param data\n */\nfunction loadWebWorkerTask(data) {\n config = data.config;\n self.importScripts(data.sourcePath);\n}\n\n/**\n * Web worker message handler - dispatches messages to the registered task handlers\n * @param msg\n */\nself.onmessage = function (msg) {\n // console.log('web worker onmessage', msg.data);\n\n // handle initialize message\n if (msg.data.taskType === 'initialize') {\n initialize(msg.data);\n\n return;\n }\n\n // handle loadWebWorkerTask message\n if (msg.data.taskType === 'loadWebWorkerTask') {\n loadWebWorkerTask(msg.data);\n\n return;\n }\n\n // dispatch the message if there is a handler registered for it\n if (taskHandlers[msg.data.taskType]) {\n taskHandlers[msg.data.taskType].handler(msg.data, function (result, transferList) {\n self.postMessage({\n taskType: msg.data.taskType,\n status: 'success',\n result: result,\n workerIndex: msg.data.workerIndex\n }, transferList);\n });\n\n return;\n }\n\n // not task handler registered - send a failure message back to ui thread\n console.log('no task handler for ', msg.data.taskType);\n console.log(taskHandlers);\n self.postMessage({\n taskType: msg.data.taskType,\n status: 'failed - no task handler registered',\n workerIndex: msg.data.workerIndex\n });\n};\n\n/***/ }),\n\n/***/ 57:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _decodeJPEG = __webpack_require__(37);\n\nvar _decodeJPEGLS = __webpack_require__(38);\n\nvar _getMinMax = __webpack_require__(2);\n\nvar _getMinMax2 = _interopRequireDefault(_getMinMax);\n\nvar _decodeImageFrame = __webpack_require__(58);\n\nvar _decodeImageFrame2 = _interopRequireDefault(_decodeImageFrame);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// flag to ensure codecs are loaded only once\nvar codecsLoaded = false;\n\n// the configuration object for the decodeTask\nvar decodeConfig = void 0;\n\n/**\n * Function to control loading and initializing the codecs\n * @param config\n */\nfunction loadCodecs(config) {\n // prevent loading codecs more than once\n if (codecsLoaded) {\n return;\n }\n\n // Load the codecs\n // console.time('loadCodecs');\n self.importScripts(config.decodeTask.codecsPath);\n codecsLoaded = true;\n // console.timeEnd('loadCodecs');\n\n // Initialize the codecs\n if (config.decodeTask.initializeCodecsOnStartup) {\n // console.time('initializeCodecs');\n (0, _decodeJPEG.initializeJPEG2000)(config.decodeTask);\n (0, _decodeJPEGLS.initializeJPEGLS)(config.decodeTask);\n // console.timeEnd('initializeCodecs');\n }\n}\n\n/**\n * Task initialization function\n */\nfunction decodeTaskInitialize(config) {\n decodeConfig = config;\n if (config.decodeTask.loadCodecsOnStartup) {\n loadCodecs(config);\n }\n}\n\nfunction calculateMinMax(imageFrame) {\n var minMax = (0, _getMinMax2.default)(imageFrame.pixelData);\n\n if (decodeConfig.decodeTask.strict === true) {\n if (imageFrame.smallestPixelValue !== minMax.min) {\n console.warn('Image smallestPixelValue tag is incorrect. Rendering performance will suffer considerably.');\n }\n\n if (imageFrame.largestPixelValue !== minMax.max) {\n console.warn('Image largestPixelValue tag is incorrect. Rendering performance will suffer considerably.');\n }\n } else {\n imageFrame.smallestPixelValue = minMax.min;\n imageFrame.largestPixelValue = minMax.max;\n }\n}\n\n/**\n * Task handler function\n */\nfunction decodeTaskHandler(data, doneCallback) {\n // Load the codecs if they aren't already loaded\n loadCodecs(decodeConfig);\n\n var imageFrame = data.data.imageFrame;\n\n // convert pixel data from ArrayBuffer to Uint8Array since web workers support passing ArrayBuffers but\n // not typed arrays\n var pixelData = new Uint8Array(data.data.pixelData);\n\n (0, _decodeImageFrame2.default)(imageFrame, data.data.transferSyntax, pixelData, decodeConfig.decodeTask, data.data.options);\n\n calculateMinMax(imageFrame);\n\n // convert from TypedArray to ArrayBuffer since web workers support passing ArrayBuffers but not\n // typed arrays\n imageFrame.pixelData = imageFrame.pixelData.buffer;\n\n // invoke the callback with our result and pass the pixelData in the transferList to move it to\n // UI thread without making a copy\n doneCallback(imageFrame, [imageFrame.pixelData]);\n}\n\nexports.default = {\n taskType: 'decodeTask',\n handler: decodeTaskHandler,\n initialize: decodeTaskInitialize\n};\n\n/***/ }),\n\n/***/ 58:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _decodeLittleEndian = __webpack_require__(59);\n\nvar _decodeLittleEndian2 = _interopRequireDefault(_decodeLittleEndian);\n\nvar _decodeBigEndian = __webpack_require__(60);\n\nvar _decodeBigEndian2 = _interopRequireDefault(_decodeBigEndian);\n\nvar _decodeRLE = __webpack_require__(61);\n\nvar _decodeRLE2 = _interopRequireDefault(_decodeRLE);\n\nvar _decodeJPEGBaseline = __webpack_require__(62);\n\nvar _decodeJPEGBaseline2 = _interopRequireDefault(_decodeJPEGBaseline);\n\nvar _decodeJPEGLossless = __webpack_require__(63);\n\nvar _decodeJPEGLossless2 = _interopRequireDefault(_decodeJPEGLossless);\n\nvar _decodeJPEGLS = __webpack_require__(38);\n\nvar _decodeJPEGLS2 = _interopRequireDefault(_decodeJPEGLS);\n\nvar _decodeJPEG = __webpack_require__(37);\n\nvar _decodeJPEG2 = _interopRequireDefault(_decodeJPEG);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction decodeImageFrame(imageFrame, transferSyntax, pixelData, decodeConfig, options) {\n var start = new Date().getTime();\n\n if (transferSyntax === '1.2.840.10008.1.2') {\n // Implicit VR Little Endian\n imageFrame = (0, _decodeLittleEndian2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.1') {\n // Explicit VR Little Endian\n imageFrame = (0, _decodeLittleEndian2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.2') {\n // Explicit VR Big Endian (retired)\n imageFrame = (0, _decodeBigEndian2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.1.99') {\n // Deflate transfer syntax (deflated by dicomParser)\n imageFrame = (0, _decodeLittleEndian2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.5') {\n // RLE Lossless\n imageFrame = (0, _decodeRLE2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.50') {\n // JPEG Baseline lossy process 1 (8 bit)\n imageFrame = (0, _decodeJPEGBaseline2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.51') {\n // JPEG Baseline lossy process 2 & 4 (12 bit)\n imageFrame = (0, _decodeJPEGBaseline2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.57') {\n // JPEG Lossless, Nonhierarchical (Processes 14)\n imageFrame = (0, _decodeJPEGLossless2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.70') {\n // JPEG Lossless, Nonhierarchical (Processes 14 [Selection 1])\n imageFrame = (0, _decodeJPEGLossless2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.80') {\n // JPEG-LS Lossless Image Compression\n imageFrame = (0, _decodeJPEGLS2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.81') {\n // JPEG-LS Lossy (Near-Lossless) Image Compression\n imageFrame = (0, _decodeJPEGLS2.default)(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.90') {\n // JPEG 2000 Lossless\n imageFrame = (0, _decodeJPEG2.default)(imageFrame, pixelData, decodeConfig, options);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.91') {\n // JPEG 2000 Lossy\n imageFrame = (0, _decodeJPEG2.default)(imageFrame, pixelData, decodeConfig, options);\n } else {\n if (console && console.log) {\n console.log('Image cannot be decoded due to Unsupported transfer syntax ' + transferSyntax);\n }\n\n throw 'no decoder for transfer syntax ' + transferSyntax;\n }\n\n /* Don't know if these work...\n // JPEG 2000 Part 2 Multicomponent Image Compression (Lossless Only)\n else if(transferSyntax === \"1.2.840.10008.1.2.4.92\")\n {\n return decodeJPEG2000(dataSet, frame);\n }\n // JPEG 2000 Part 2 Multicomponent Image Compression\n else if(transferSyntax === \"1.2.840.10008.1.2.4.93\")\n {\n return decodeJPEG2000(dataSet, frame);\n }\n */\n\n var end = new Date().getTime();\n\n imageFrame.decodeTimeInMS = end - start;\n\n return imageFrame;\n}\n\nexports.default = decodeImageFrame;\n\n/***/ }),\n\n/***/ 59:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nfunction decodeLittleEndian(imageFrame, pixelData) {\n if (imageFrame.bitsAllocated === 16) {\n var arrayBuffer = pixelData.buffer;\n var offset = pixelData.byteOffset;\n var length = pixelData.length;\n // if pixel data is not aligned on even boundary, shift it so we can create the 16 bit array\n // buffers on it\n\n if (offset % 2) {\n arrayBuffer = arrayBuffer.slice(offset);\n offset = 0;\n }\n\n if (imageFrame.pixelRepresentation === 0) {\n imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);\n } else {\n imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);\n }\n } else if (imageFrame.bitsAllocated === 8) {\n imageFrame.pixelData = pixelData;\n }\n\n return imageFrame;\n}\n\nexports.default = decodeLittleEndian;\n\n/***/ }),\n\n/***/ 60:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n/* eslint no-bitwise: 0 */\nfunction swap16(val) {\n return (val & 0xFF) << 8 | val >> 8 & 0xFF;\n}\n\nfunction decodeBigEndian(imageFrame, pixelData) {\n if (imageFrame.bitsAllocated === 16) {\n var arrayBuffer = pixelData.buffer;\n var offset = pixelData.byteOffset;\n var length = pixelData.length;\n // if pixel data is not aligned on even boundary, shift it so we can create the 16 bit array\n // buffers on it\n\n if (offset % 2) {\n arrayBuffer = arrayBuffer.slice(offset);\n offset = 0;\n }\n\n if (imageFrame.pixelRepresentation === 0) {\n imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);\n } else {\n imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);\n }\n // Do the byte swap\n for (var i = 0; i < imageFrame.pixelData.length; i++) {\n imageFrame.pixelData[i] = swap16(imageFrame.pixelData[i]);\n }\n } else if (imageFrame.bitsAllocated === 8) {\n imageFrame.pixelData = pixelData;\n }\n\n return imageFrame;\n}\n\nexports.default = decodeBigEndian;\n\n/***/ }),\n\n/***/ 61:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nfunction decodeRLE(imageFrame, pixelData) {\n\n if (imageFrame.bitsAllocated === 8) {\n if (imageFrame.planarConfiguration) {\n return decode8Planar(imageFrame, pixelData);\n }\n\n return decode8(imageFrame, pixelData);\n } else if (imageFrame.bitsAllocated === 16) {\n return decode16(imageFrame, pixelData);\n }\n throw 'unsupported pixel format for RLE';\n}\n\nfunction decode8(imageFrame, pixelData) {\n var frameData = pixelData;\n var frameSize = imageFrame.rows * imageFrame.columns;\n var outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);\n var header = new DataView(frameData.buffer, frameData.byteOffset);\n var data = new Int8Array(frameData.buffer, frameData.byteOffset);\n var out = new Int8Array(outFrame);\n\n var outIndex = 0;\n var numSegments = header.getInt32(0, true);\n\n for (var s = 0; s < numSegments; ++s) {\n outIndex = s;\n\n var inIndex = header.getInt32((s + 1) * 4, true);\n var maxIndex = header.getInt32((s + 2) * 4, true);\n\n if (maxIndex === 0) {\n maxIndex = frameData.length;\n }\n\n var endOfSegment = frameSize * numSegments;\n\n while (inIndex < maxIndex) {\n var n = data[inIndex++];\n\n if (n >= 0 && n <= 127) {\n // copy n bytes\n for (var i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {\n out[outIndex] = data[inIndex++];\n outIndex += imageFrame.samplesPerPixel;\n }\n } else if (n <= -1 && n >= -127) {\n var value = data[inIndex++];\n // run of n bytes\n\n for (var j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {\n out[outIndex] = value;\n outIndex += imageFrame.samplesPerPixel;\n }\n } /* else if (n === -128) {\n } // do nothing */\n }\n }\n imageFrame.pixelData = new Uint8Array(outFrame);\n\n return imageFrame;\n}\n\nfunction decode8Planar(imageFrame, pixelData) {\n var frameData = pixelData;\n var frameSize = imageFrame.rows * imageFrame.columns;\n var outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);\n var header = new DataView(frameData.buffer, frameData.byteOffset);\n var data = new Int8Array(frameData.buffer, frameData.byteOffset);\n var out = new Int8Array(outFrame);\n\n var outIndex = 0;\n var numSegments = header.getInt32(0, true);\n\n for (var s = 0; s < numSegments; ++s) {\n outIndex = s * frameSize;\n\n var inIndex = header.getInt32((s + 1) * 4, true);\n var maxIndex = header.getInt32((s + 2) * 4, true);\n\n if (maxIndex === 0) {\n maxIndex = frameData.length;\n }\n\n var endOfSegment = frameSize * numSegments;\n\n while (inIndex < maxIndex) {\n var n = data[inIndex++];\n\n if (n >= 0 && n <= 127) {\n // copy n bytes\n for (var i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {\n out[outIndex] = data[inIndex++];\n outIndex++;\n }\n } else if (n <= -1 && n >= -127) {\n var value = data[inIndex++];\n // run of n bytes\n\n for (var j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {\n out[outIndex] = value;\n outIndex++;\n }\n } /* else if (n === -128) {\n } // do nothing */\n }\n }\n imageFrame.pixelData = new Uint8Array(outFrame);\n\n return imageFrame;\n}\n\nfunction decode16(imageFrame, pixelData) {\n var frameData = pixelData;\n var frameSize = imageFrame.rows * imageFrame.columns;\n var outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel * 2);\n\n var header = new DataView(frameData.buffer, frameData.byteOffset);\n var data = new Int8Array(frameData.buffer, frameData.byteOffset);\n var out = new Int8Array(outFrame);\n\n var numSegments = header.getInt32(0, true);\n\n for (var s = 0; s < numSegments; ++s) {\n var outIndex = 0;\n var highByte = s === 0 ? 1 : 0;\n\n var inIndex = header.getInt32((s + 1) * 4, true);\n var maxIndex = header.getInt32((s + 2) * 4, true);\n\n if (maxIndex === 0) {\n maxIndex = frameData.length;\n }\n\n while (inIndex < maxIndex) {\n var n = data[inIndex++];\n\n if (n >= 0 && n <= 127) {\n for (var i = 0; i < n + 1 && outIndex < frameSize; ++i) {\n out[outIndex * 2 + highByte] = data[inIndex++];\n outIndex++;\n }\n } else if (n <= -1 && n >= -127) {\n var value = data[inIndex++];\n\n for (var j = 0; j < -n + 1 && outIndex < frameSize; ++j) {\n out[outIndex * 2 + highByte] = value;\n outIndex++;\n }\n } /* else if (n === -128) {\n } // do nothing */\n }\n }\n if (imageFrame.pixelRepresentation === 0) {\n imageFrame.pixelData = new Uint16Array(outFrame);\n } else {\n imageFrame.pixelData = new Int16Array(outFrame);\n }\n\n return imageFrame;\n}\n\nexports.default = decodeRLE;\n\n/***/ }),\n\n/***/ 62:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n\nfunction decodeJPEGBaseline(imageFrame, pixelData) {\n // check to make sure codec is loaded\n if (typeof JpegImage === 'undefined') {\n throw 'No JPEG Baseline decoder loaded';\n }\n var jpeg = new JpegImage();\n\n jpeg.parse(pixelData);\n\n // Do not use the internal jpeg.js color transformation,\n // since we will handle this afterwards\n jpeg.colorTransform = false;\n\n if (imageFrame.bitsAllocated === 8) {\n imageFrame.pixelData = jpeg.getData(imageFrame.columns, imageFrame.rows);\n\n return imageFrame;\n } else if (imageFrame.bitsAllocated === 16) {\n imageFrame.pixelData = jpeg.getData16(imageFrame.columns, imageFrame.rows);\n\n return imageFrame;\n }\n}\n\nexports.default = decodeJPEGBaseline;\n\n/***/ }),\n\n/***/ 63:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n\nfunction decodeJPEGLossless(imageFrame, pixelData) {\n // check to make sure codec is loaded\n if (typeof jpeg === 'undefined' || typeof jpeg.lossless === 'undefined' || typeof jpeg.lossless.Decoder === 'undefined') {\n throw 'No JPEG Lossless decoder loaded';\n }\n\n var byteOutput = imageFrame.bitsAllocated <= 8 ? 1 : 2;\n // console.time('jpeglossless');\n var buffer = pixelData.buffer;\n var decoder = new jpeg.lossless.Decoder();\n var decompressedData = decoder.decode(buffer, pixelData.byteOffset, pixelData.length, byteOutput);\n // console.timeEnd('jpeglossless');\n\n if (imageFrame.pixelRepresentation === 0) {\n if (imageFrame.bitsAllocated === 16) {\n imageFrame.pixelData = new Uint16Array(decompressedData.buffer);\n\n return imageFrame;\n }\n // untested!\n imageFrame.pixelData = new Uint8Array(decompressedData.buffer);\n\n return imageFrame;\n }\n imageFrame.pixelData = new Int16Array(decompressedData.buffer);\n\n return imageFrame;\n}\n\nexports.default = decodeJPEGLossless;\n\n/***/ }),\n\n/***/ 9:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = '0.15.1';\n\n/***/ })\n\n/******/ });\n});\n\n\n// WEBPACK FOOTER //\n// cornerstoneWADOImageLoaderWebWorker.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 55);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1a38b2491c8facfb2788","function getMinMax (storedPixelData) {\n // we always calculate the min max values since they are not always\n // present in DICOM and we don't want to trust them anyway as cornerstone\n // depends on us providing reliable values for these\n let min = storedPixelData[0];\n let max = storedPixelData[0];\n let storedPixel;\n const numPixels = storedPixelData.length;\n\n for (let index = 1; index < numPixels; index++) {\n storedPixel = storedPixelData[index];\n min = Math.min(min, storedPixel);\n max = Math.max(max, storedPixel);\n }\n\n return {\n min,\n max\n };\n}\n\nexport default getMinMax;\n\n\n\n// WEBPACK FOOTER //\n// ./shared/getMinMax.js","\n\nfunction decodeJpx (imageFrame, pixelData) {\n\n const jpxImage = new JpxImage();\n\n jpxImage.parse(pixelData);\n\n const tileCount = jpxImage.tiles.length;\n\n if (tileCount !== 1) {\n throw `JPEG2000 decoder returned a tileCount of ${tileCount}, when 1 is expected`;\n }\n\n imageFrame.columns = jpxImage.width;\n imageFrame.rows = jpxImage.height;\n imageFrame.pixelData = jpxImage.tiles[0].items;\n\n return imageFrame;\n}\n\nlet openJPEG;\n\nfunction decodeOpenJPEG (data, bytesPerPixel, signed) {\n const dataPtr = openJPEG._malloc(data.length);\n\n openJPEG.writeArrayToMemory(data, dataPtr);\n\n // create param outpout\n const imagePtrPtr = openJPEG._malloc(4);\n const imageSizePtr = openJPEG._malloc(4);\n const imageSizeXPtr = openJPEG._malloc(4);\n const imageSizeYPtr = openJPEG._malloc(4);\n const imageSizeCompPtr = openJPEG._malloc(4);\n\n const t0 = Date.now();\n const ret = openJPEG.ccall('jp2_decode', 'number', ['number', 'number', 'number', 'number', 'number', 'number', 'number'],\n [dataPtr, data.length, imagePtrPtr, imageSizePtr, imageSizeXPtr, imageSizeYPtr, imageSizeCompPtr]);\n // add num vomp..etc\n\n if (ret !== 0) {\n console.log('[opj_decode] decoding failed!');\n openJPEG._free(dataPtr);\n openJPEG._free(openJPEG.getValue(imagePtrPtr, '*'));\n openJPEG._free(imageSizeXPtr);\n openJPEG._free(imageSizeYPtr);\n openJPEG._free(imageSizePtr);\n openJPEG._free(imageSizeCompPtr);\n\n return undefined;\n }\n\n const imagePtr = openJPEG.getValue(imagePtrPtr, '*');\n\n const image = {\n length: openJPEG.getValue(imageSizePtr, 'i32'),\n sx: openJPEG.getValue(imageSizeXPtr, 'i32'),\n sy: openJPEG.getValue(imageSizeYPtr, 'i32'),\n nbChannels: openJPEG.getValue(imageSizeCompPtr, 'i32'), // hard coded for now\n perf_timetodecode: undefined,\n pixelData: undefined\n };\n\n // Copy the data from the EMSCRIPTEN heap into the correct type array\n const length = image.sx * image.sy * image.nbChannels;\n const src32 = new Int32Array(openJPEG.HEAP32.buffer, imagePtr, length);\n\n if (bytesPerPixel === 1) {\n if (Uint8Array.from) {\n image.pixelData = Uint8Array.from(src32);\n } else {\n image.pixelData = new Uint8Array(length);\n for (let i = 0; i < length; i++) {\n image.pixelData[i] = src32[i];\n }\n }\n } else if (signed) {\n if (Int16Array.from) {\n image.pixelData = Int16Array.from(src32);\n } else {\n image.pixelData = new Int16Array(length);\n for (let i = 0; i < length; i++) {\n image.pixelData[i] = src32[i];\n }\n }\n } else if (Uint16Array.from) {\n image.pixelData = Uint16Array.from(src32);\n } else {\n image.pixelData = new Uint16Array(length);\n for (let i = 0; i < length; i++) {\n image.pixelData[i] = src32[i];\n }\n }\n\n const t1 = Date.now();\n\n image.perf_timetodecode = t1 - t0;\n\n // free\n openJPEG._free(dataPtr);\n openJPEG._free(imagePtrPtr);\n openJPEG._free(imagePtr);\n openJPEG._free(imageSizePtr);\n openJPEG._free(imageSizeXPtr);\n openJPEG._free(imageSizeYPtr);\n openJPEG._free(imageSizeCompPtr);\n\n return image;\n}\n\nfunction decodeOpenJpeg2000 (imageFrame, pixelData) {\n const bytesPerPixel = imageFrame.bitsAllocated <= 8 ? 1 : 2;\n const signed = imageFrame.pixelRepresentation === 1;\n\n const image = decodeOpenJPEG(pixelData, bytesPerPixel, signed);\n\n imageFrame.columns = image.sx;\n imageFrame.rows = image.sy;\n imageFrame.pixelData = image.pixelData;\n if (image.nbChannels > 1) {\n imageFrame.photometricInterpretation = 'RGB';\n }\n\n return imageFrame;\n}\n\nfunction initializeJPEG2000 (decodeConfig) {\n // check to make sure codec is loaded\n if (!decodeConfig.usePDFJS) {\n if (typeof OpenJPEG === 'undefined') {\n throw 'OpenJPEG decoder not loaded';\n }\n }\n\n if (!openJPEG) {\n openJPEG = OpenJPEG();\n if (!openJPEG || !openJPEG._jp2_decode) {\n throw 'OpenJPEG failed to initialize';\n }\n }\n}\n\nfunction decodeJPEG2000 (imageFrame, pixelData, decodeConfig, options) {\n options = options || {};\n\n initializeJPEG2000(decodeConfig);\n\n if (options.usePDFJS || decodeConfig.usePDFJS) {\n // OHIF image-JPEG2000 https://github.com/OHIF/image-JPEG2000\n // console.log('PDFJS')\n return decodeJpx(imageFrame, pixelData);\n }\n\n // OpenJPEG2000 https://github.com/jpambrun/openjpeg\n // console.log('OpenJPEG')\n return decodeOpenJpeg2000(imageFrame, pixelData);\n}\n\nexport default decodeJPEG2000;\nexport { initializeJPEG2000 };\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decoders/decodeJPEG2000.js","\n\nlet charLS;\n\nfunction jpegLSDecode (data, isSigned) {\n\n // prepare input parameters\n const dataPtr = charLS._malloc(data.length);\n\n charLS.writeArrayToMemory(data, dataPtr);\n\n // prepare output parameters\n const imagePtrPtr = charLS._malloc(4);\n const imageSizePtr = charLS._malloc(4);\n const widthPtr = charLS._malloc(4);\n const heightPtr = charLS._malloc(4);\n const bitsPerSamplePtr = charLS._malloc(4);\n const stridePtr = charLS._malloc(4);\n const allowedLossyErrorPtr = charLS._malloc(4);\n const componentsPtr = charLS._malloc(4);\n const interleaveModePtr = charLS._malloc(4);\n\n // Decode the image\n const result = charLS.ccall(\n 'jpegls_decode',\n 'number',\n ['number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number', 'number'],\n [dataPtr, data.length, imagePtrPtr, imageSizePtr, widthPtr, heightPtr, bitsPerSamplePtr, stridePtr, componentsPtr, allowedLossyErrorPtr, interleaveModePtr]\n );\n\n // Extract result values into object\n const image = {\n result,\n width: charLS.getValue(widthPtr, 'i32'),\n height: charLS.getValue(heightPtr, 'i32'),\n bitsPerSample: charLS.getValue(bitsPerSamplePtr, 'i32'),\n stride: charLS.getValue(stridePtr, 'i32'),\n components: charLS.getValue(componentsPtr, 'i32'),\n allowedLossyError: charLS.getValue(allowedLossyErrorPtr, 'i32'),\n interleaveMode: charLS.getValue(interleaveModePtr, 'i32'),\n pixelData: undefined\n };\n\n // Copy image from emscripten heap into appropriate array buffer type\n const imagePtr = charLS.getValue(imagePtrPtr, '*');\n\n if (image.bitsPerSample <= 8) {\n image.pixelData = new Uint8Array(image.width * image.height * image.components);\n image.pixelData.set(new Uint8Array(charLS.HEAP8.buffer, imagePtr, image.pixelData.length));\n } else if (isSigned) {\n image.pixelData = new Int16Array(image.width * image.height * image.components);\n image.pixelData.set(new Int16Array(charLS.HEAP16.buffer, imagePtr, image.pixelData.length));\n } else {\n image.pixelData = new Uint16Array(image.width * image.height * image.components);\n image.pixelData.set(new Uint16Array(charLS.HEAP16.buffer, imagePtr, image.pixelData.length));\n }\n\n // free memory and return image object\n charLS._free(dataPtr);\n charLS._free(imagePtr);\n charLS._free(imagePtrPtr);\n charLS._free(imageSizePtr);\n charLS._free(widthPtr);\n charLS._free(heightPtr);\n charLS._free(bitsPerSamplePtr);\n charLS._free(stridePtr);\n charLS._free(componentsPtr);\n charLS._free(interleaveModePtr);\n\n return image;\n}\n\nfunction initializeJPEGLS () {\n // check to make sure codec is loaded\n if (typeof CharLS === 'undefined') {\n throw 'No JPEG-LS decoder loaded';\n }\n\n // Try to initialize CharLS\n // CharLS https://github.com/chafey/charls\n if (!charLS) {\n charLS = CharLS();\n if (!charLS || !charLS._jpegls_decode) {\n throw 'JPEG-LS failed to initialize';\n }\n }\n\n}\n\nfunction decodeJPEGLS (imageFrame, pixelData) {\n initializeJPEGLS();\n\n const image = jpegLSDecode(pixelData, imageFrame.pixelRepresentation === 1);\n // console.log(image);\n\n // throw error if not success or too much data\n if (image.result !== 0 && image.result !== 6) {\n throw `JPEG-LS decoder failed to decode frame (error code ${image.result})`;\n }\n\n imageFrame.columns = image.width;\n imageFrame.rows = image.height;\n imageFrame.pixelData = image.pixelData;\n\n return imageFrame;\n}\n\nexport default decodeJPEGLS;\nexport { initializeJPEGLS };\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decoders/decodeJPEGLS.js","import { registerTaskHandler } from './webWorker.js';\nimport decodeTask from './decodeTask/decodeTask.js';\n\n// register our task\nregisterTaskHandler(decodeTask);\n\nexport { registerTaskHandler };\nexport { default as version } from '../version.js';\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/index.js","// an object of task handlers\nconst taskHandlers = {};\n\n// Flag to ensure web worker is only initialized once\nlet initialized = false;\n\n// the configuration object passed in when the web worker manager is initialized\nlet config;\n\n/**\n * Initialization function that loads additional web workers and initializes them\n * @param data\n */\nfunction initialize (data) {\n // console.log('web worker initialize ', data.workerIndex);\n // prevent initialization from happening more than once\n if (initialized) {\n return;\n }\n\n // save the config data\n config = data.config;\n\n // load any additional web worker tasks\n if (data.config.webWorkerTaskPaths) {\n for (let i = 0; i < data.config.webWorkerTaskPaths.length; i++) {\n self.importScripts(data.config.webWorkerTaskPaths[i]);\n }\n }\n\n // initialize each task handler\n Object.keys(taskHandlers).forEach(function (key) {\n taskHandlers[key].initialize(config.taskConfiguration);\n });\n\n // tell main ui thread that we have completed initialization\n self.postMessage({\n taskType: 'initialize',\n status: 'success',\n result: {\n },\n workerIndex: data.workerIndex\n });\n\n initialized = true;\n}\n\n/**\n * Function exposed to web worker tasks to register themselves\n * @param taskHandler\n */\nexport function registerTaskHandler (taskHandler) {\n if (taskHandlers[taskHandler.taskType]) {\n console.log('attempt to register duplicate task handler \"', taskHandler.taskType, '\"');\n\n return false;\n }\n taskHandlers[taskHandler.taskType] = taskHandler;\n if (initialized) {\n taskHandler.initialize(config.taskConfiguration);\n }\n}\n\n/**\n * Function to load a new web worker task with updated configuration\n * @param data\n */\nfunction loadWebWorkerTask (data) {\n config = data.config;\n self.importScripts(data.sourcePath);\n}\n\n/**\n * Web worker message handler - dispatches messages to the registered task handlers\n * @param msg\n */\nself.onmessage = function (msg) {\n // console.log('web worker onmessage', msg.data);\n\n // handle initialize message\n if (msg.data.taskType === 'initialize') {\n initialize(msg.data);\n\n return;\n }\n\n // handle loadWebWorkerTask message\n if (msg.data.taskType === 'loadWebWorkerTask') {\n loadWebWorkerTask(msg.data);\n\n return;\n }\n\n // dispatch the message if there is a handler registered for it\n if (taskHandlers[msg.data.taskType]) {\n taskHandlers[msg.data.taskType].handler(msg.data, function (result, transferList) {\n self.postMessage({\n taskType: msg.data.taskType,\n status: 'success',\n result,\n workerIndex: msg.data.workerIndex\n }, transferList);\n });\n\n return;\n }\n\n // not task handler registered - send a failure message back to ui thread\n console.log('no task handler for ', msg.data.taskType);\n console.log(taskHandlers);\n self.postMessage({\n taskType: msg.data.taskType,\n status: 'failed - no task handler registered',\n workerIndex: msg.data.workerIndex\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/webWorker.js","import { initializeJPEG2000 } from './decoders/decodeJPEG2000.js';\nimport { initializeJPEGLS } from './decoders/decodeJPEGLS.js';\nimport getMinMax from '../../shared/getMinMax.js';\nimport decodeImageFrame from './decodeImageFrame.js';\n\n// flag to ensure codecs are loaded only once\nlet codecsLoaded = false;\n\n// the configuration object for the decodeTask\nlet decodeConfig;\n\n/**\n * Function to control loading and initializing the codecs\n * @param config\n */\nfunction loadCodecs (config) {\n // prevent loading codecs more than once\n if (codecsLoaded) {\n return;\n }\n\n // Load the codecs\n // console.time('loadCodecs');\n self.importScripts(config.decodeTask.codecsPath);\n codecsLoaded = true;\n // console.timeEnd('loadCodecs');\n\n // Initialize the codecs\n if (config.decodeTask.initializeCodecsOnStartup) {\n // console.time('initializeCodecs');\n initializeJPEG2000(config.decodeTask);\n initializeJPEGLS(config.decodeTask);\n // console.timeEnd('initializeCodecs');\n }\n}\n\n/**\n * Task initialization function\n */\nfunction decodeTaskInitialize (config) {\n decodeConfig = config;\n if (config.decodeTask.loadCodecsOnStartup) {\n loadCodecs(config);\n }\n}\n\nfunction calculateMinMax (imageFrame) {\n const minMax = getMinMax(imageFrame.pixelData);\n\n if (decodeConfig.decodeTask.strict === true) {\n if (imageFrame.smallestPixelValue !== minMax.min) {\n console.warn('Image smallestPixelValue tag is incorrect. Rendering performance will suffer considerably.');\n }\n\n if (imageFrame.largestPixelValue !== minMax.max) {\n console.warn('Image largestPixelValue tag is incorrect. Rendering performance will suffer considerably.');\n }\n } else {\n imageFrame.smallestPixelValue = minMax.min;\n imageFrame.largestPixelValue = minMax.max;\n }\n}\n\n/**\n * Task handler function\n */\nfunction decodeTaskHandler (data, doneCallback) {\n // Load the codecs if they aren't already loaded\n loadCodecs(decodeConfig);\n\n const imageFrame = data.data.imageFrame;\n\n // convert pixel data from ArrayBuffer to Uint8Array since web workers support passing ArrayBuffers but\n // not typed arrays\n const pixelData = new Uint8Array(data.data.pixelData);\n\n decodeImageFrame(\n imageFrame,\n data.data.transferSyntax,\n pixelData,\n decodeConfig.decodeTask,\n data.data.options);\n\n calculateMinMax(imageFrame);\n\n // convert from TypedArray to ArrayBuffer since web workers support passing ArrayBuffers but not\n // typed arrays\n imageFrame.pixelData = imageFrame.pixelData.buffer;\n\n // invoke the callback with our result and pass the pixelData in the transferList to move it to\n // UI thread without making a copy\n doneCallback(imageFrame, [imageFrame.pixelData]);\n}\n\nexport default {\n taskType: 'decodeTask',\n handler: decodeTaskHandler,\n initialize: decodeTaskInitialize\n};\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decodeTask.js","import decodeLittleEndian from './decoders/decodeLittleEndian.js';\nimport decodeBigEndian from './decoders/decodeBigEndian.js';\nimport decodeRLE from './decoders/decodeRLE.js';\nimport decodeJPEGBaseline from './decoders/decodeJPEGBaseline.js';\nimport decodeJPEGLossless from './decoders/decodeJPEGLossless.js';\nimport decodeJPEGLS from './decoders/decodeJPEGLS.js';\nimport decodeJPEG2000 from './decoders/decodeJPEG2000.js';\n\nfunction decodeImageFrame (imageFrame, transferSyntax, pixelData, decodeConfig, options) {\n const start = new Date().getTime();\n\n if (transferSyntax === '1.2.840.10008.1.2') {\n // Implicit VR Little Endian\n imageFrame = decodeLittleEndian(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.1') {\n // Explicit VR Little Endian\n imageFrame = decodeLittleEndian(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.2') {\n // Explicit VR Big Endian (retired)\n imageFrame = decodeBigEndian(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.1.99') {\n // Deflate transfer syntax (deflated by dicomParser)\n imageFrame = decodeLittleEndian(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.5') {\n // RLE Lossless\n imageFrame = decodeRLE(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.50') {\n // JPEG Baseline lossy process 1 (8 bit)\n imageFrame = decodeJPEGBaseline(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.51') {\n // JPEG Baseline lossy process 2 & 4 (12 bit)\n imageFrame = decodeJPEGBaseline(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.57') {\n // JPEG Lossless, Nonhierarchical (Processes 14)\n imageFrame = decodeJPEGLossless(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.70') {\n // JPEG Lossless, Nonhierarchical (Processes 14 [Selection 1])\n imageFrame = decodeJPEGLossless(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.80') {\n // JPEG-LS Lossless Image Compression\n imageFrame = decodeJPEGLS(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.81') {\n // JPEG-LS Lossy (Near-Lossless) Image Compression\n imageFrame = decodeJPEGLS(imageFrame, pixelData);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.90') {\n // JPEG 2000 Lossless\n imageFrame = decodeJPEG2000(imageFrame, pixelData, decodeConfig, options);\n } else if (transferSyntax === '1.2.840.10008.1.2.4.91') {\n // JPEG 2000 Lossy\n imageFrame = decodeJPEG2000(imageFrame, pixelData, decodeConfig, options);\n } else {\n if (console && console.log) {\n console.log(`Image cannot be decoded due to Unsupported transfer syntax ${transferSyntax}`);\n }\n\n throw `no decoder for transfer syntax ${transferSyntax}`;\n }\n\n /* Don't know if these work...\n // JPEG 2000 Part 2 Multicomponent Image Compression (Lossless Only)\n else if(transferSyntax === \"1.2.840.10008.1.2.4.92\")\n {\n return decodeJPEG2000(dataSet, frame);\n }\n // JPEG 2000 Part 2 Multicomponent Image Compression\n else if(transferSyntax === \"1.2.840.10008.1.2.4.93\")\n {\n return decodeJPEG2000(dataSet, frame);\n }\n */\n\n const end = new Date().getTime();\n\n imageFrame.decodeTimeInMS = end - start;\n\n return imageFrame;\n}\n\nexport default decodeImageFrame;\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decodeImageFrame.js","function decodeLittleEndian (imageFrame, pixelData) {\n if (imageFrame.bitsAllocated === 16) {\n let arrayBuffer = pixelData.buffer;\n let offset = pixelData.byteOffset;\n const length = pixelData.length;\n // if pixel data is not aligned on even boundary, shift it so we can create the 16 bit array\n // buffers on it\n\n if (offset % 2) {\n arrayBuffer = arrayBuffer.slice(offset);\n offset = 0;\n }\n\n if (imageFrame.pixelRepresentation === 0) {\n imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);\n } else {\n imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);\n }\n } else if (imageFrame.bitsAllocated === 8) {\n imageFrame.pixelData = pixelData;\n }\n\n return imageFrame;\n}\n\nexport default decodeLittleEndian;\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decoders/decodeLittleEndian.js","/* eslint no-bitwise: 0 */\nfunction swap16 (val) {\n return ((val & 0xFF) << 8) |\n ((val >> 8) & 0xFF);\n}\n\n\nfunction decodeBigEndian (imageFrame, pixelData) {\n if (imageFrame.bitsAllocated === 16) {\n let arrayBuffer = pixelData.buffer;\n let offset = pixelData.byteOffset;\n const length = pixelData.length;\n // if pixel data is not aligned on even boundary, shift it so we can create the 16 bit array\n // buffers on it\n\n if (offset % 2) {\n arrayBuffer = arrayBuffer.slice(offset);\n offset = 0;\n }\n\n if (imageFrame.pixelRepresentation === 0) {\n imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);\n } else {\n imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);\n }\n // Do the byte swap\n for (let i = 0; i < imageFrame.pixelData.length; i++) {\n imageFrame.pixelData[i] = swap16(imageFrame.pixelData[i]);\n }\n\n } else if (imageFrame.bitsAllocated === 8) {\n imageFrame.pixelData = pixelData;\n }\n\n return imageFrame;\n}\n\nexport default decodeBigEndian;\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decoders/decodeBigEndian.js","function decodeRLE (imageFrame, pixelData) {\n\n if (imageFrame.bitsAllocated === 8) {\n if (imageFrame.planarConfiguration) {\n return decode8Planar(imageFrame, pixelData);\n }\n\n return decode8(imageFrame, pixelData);\n } else if (imageFrame.bitsAllocated === 16) {\n return decode16(imageFrame, pixelData);\n }\n throw 'unsupported pixel format for RLE';\n\n}\n\nfunction decode8 (imageFrame, pixelData) {\n const frameData = pixelData;\n const frameSize = imageFrame.rows * imageFrame.columns;\n const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);\n const header = new DataView(frameData.buffer, frameData.byteOffset);\n const data = new Int8Array(frameData.buffer, frameData.byteOffset);\n const out = new Int8Array(outFrame);\n\n let outIndex = 0;\n const numSegments = header.getInt32(0, true);\n\n for (let s = 0; s < numSegments; ++s) {\n outIndex = s;\n\n let inIndex = header.getInt32((s + 1) * 4, true);\n let maxIndex = header.getInt32((s + 2) * 4, true);\n\n if (maxIndex === 0) {\n maxIndex = frameData.length;\n }\n\n const endOfSegment = frameSize * numSegments;\n\n while (inIndex < maxIndex) {\n const n = data[inIndex++];\n\n if (n >= 0 && n <= 127) {\n // copy n bytes\n for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {\n out[outIndex] = data[inIndex++];\n outIndex += imageFrame.samplesPerPixel;\n }\n } else if (n <= -1 && n >= -127) {\n const value = data[inIndex++];\n // run of n bytes\n\n for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {\n out[outIndex] = value;\n outIndex += imageFrame.samplesPerPixel;\n }\n }/* else if (n === -128) {\n\n } // do nothing */\n }\n }\n imageFrame.pixelData = new Uint8Array(outFrame);\n\n return imageFrame;\n}\n\nfunction decode8Planar (imageFrame, pixelData) {\n const frameData = pixelData;\n const frameSize = imageFrame.rows * imageFrame.columns;\n const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);\n const header = new DataView(frameData.buffer, frameData.byteOffset);\n const data = new Int8Array(frameData.buffer, frameData.byteOffset);\n const out = new Int8Array(outFrame);\n\n let outIndex = 0;\n const numSegments = header.getInt32(0, true);\n\n for (let s = 0; s < numSegments; ++s) {\n outIndex = s * frameSize;\n\n let inIndex = header.getInt32((s + 1) * 4, true);\n let maxIndex = header.getInt32((s + 2) * 4, true);\n\n if (maxIndex === 0) {\n maxIndex = frameData.length;\n }\n\n const endOfSegment = frameSize * numSegments;\n\n while (inIndex < maxIndex) {\n const n = data[inIndex++];\n\n if (n >= 0 && n <= 127) {\n // copy n bytes\n for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {\n out[outIndex] = data[inIndex++];\n outIndex++;\n }\n } else if (n <= -1 && n >= -127) {\n const value = data[inIndex++];\n // run of n bytes\n\n for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {\n out[outIndex] = value;\n outIndex++;\n }\n }/* else if (n === -128) {\n\n } // do nothing */\n }\n }\n imageFrame.pixelData = new Uint8Array(outFrame);\n\n return imageFrame;\n}\n\nfunction decode16 (imageFrame, pixelData) {\n const frameData = pixelData;\n const frameSize = imageFrame.rows * imageFrame.columns;\n const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel * 2);\n\n const header = new DataView(frameData.buffer, frameData.byteOffset);\n const data = new Int8Array(frameData.buffer, frameData.byteOffset);\n const out = new Int8Array(outFrame);\n\n const numSegments = header.getInt32(0, true);\n\n for (let s = 0; s < numSegments; ++s) {\n let outIndex = 0;\n const highByte = (s === 0 ? 1 : 0);\n\n let inIndex = header.getInt32((s + 1) * 4, true);\n let maxIndex = header.getInt32((s + 2) * 4, true);\n\n if (maxIndex === 0) {\n maxIndex = frameData.length;\n }\n\n while (inIndex < maxIndex) {\n const n = data[inIndex++];\n\n if (n >= 0 && n <= 127) {\n for (let i = 0; i < n + 1 && outIndex < frameSize; ++i) {\n out[(outIndex * 2) + highByte] = data[inIndex++];\n outIndex++;\n }\n } else if (n <= -1 && n >= -127) {\n const value = data[inIndex++];\n\n for (let j = 0; j < -n + 1 && outIndex < frameSize; ++j) {\n out[(outIndex * 2) + highByte] = value;\n outIndex++;\n }\n }/* else if (n === -128) {\n\n } // do nothing */\n }\n }\n if (imageFrame.pixelRepresentation === 0) {\n imageFrame.pixelData = new Uint16Array(outFrame);\n } else {\n imageFrame.pixelData = new Int16Array(outFrame);\n }\n\n return imageFrame;\n}\n\nexport default decodeRLE;\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decoders/decodeRLE.js","\n\nfunction decodeJPEGBaseline (imageFrame, pixelData) {\n // check to make sure codec is loaded\n if (typeof JpegImage === 'undefined') {\n throw 'No JPEG Baseline decoder loaded';\n }\n const jpeg = new JpegImage();\n\n jpeg.parse(pixelData);\n\n // Do not use the internal jpeg.js color transformation,\n // since we will handle this afterwards\n jpeg.colorTransform = false;\n\n if (imageFrame.bitsAllocated === 8) {\n imageFrame.pixelData = jpeg.getData(imageFrame.columns, imageFrame.rows);\n\n return imageFrame;\n } else if (imageFrame.bitsAllocated === 16) {\n imageFrame.pixelData = jpeg.getData16(imageFrame.columns, imageFrame.rows);\n\n return imageFrame;\n }\n}\n\nexport default decodeJPEGBaseline;\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decoders/decodeJPEGBaseline.js","\n\nfunction decodeJPEGLossless (imageFrame, pixelData) {\n // check to make sure codec is loaded\n if (typeof jpeg === 'undefined' ||\n typeof jpeg.lossless === 'undefined' ||\n typeof jpeg.lossless.Decoder === 'undefined') {\n throw 'No JPEG Lossless decoder loaded';\n }\n\n const byteOutput = imageFrame.bitsAllocated <= 8 ? 1 : 2;\n // console.time('jpeglossless');\n const buffer = pixelData.buffer;\n const decoder = new jpeg.lossless.Decoder();\n const decompressedData = decoder.decode(buffer, pixelData.byteOffset, pixelData.length, byteOutput);\n // console.timeEnd('jpeglossless');\n\n if (imageFrame.pixelRepresentation === 0) {\n if (imageFrame.bitsAllocated === 16) {\n imageFrame.pixelData = new Uint16Array(decompressedData.buffer);\n\n return imageFrame;\n }\n // untested!\n imageFrame.pixelData = new Uint8Array(decompressedData.buffer);\n\n return imageFrame;\n\n }\n imageFrame.pixelData = new Int16Array(decompressedData.buffer);\n\n return imageFrame;\n\n}\n\nexport default decodeJPEGLossless;\n\n\n\n// WEBPACK FOOTER //\n// ./webWorker/decodeTask/decoders/decodeJPEGLossless.js","export default '0.15.1';\n\n\n\n// WEBPACK FOOTER //\n// ./version.js"],"sourceRoot":""} \ No newline at end of file diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_design/assets/theme-icons.png b/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_design/assets/theme-icons.png deleted file mode 100644 index 098f7ed52..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_design/assets/theme-icons.png and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_hanging-protocols/assets/dots.svg b/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_hanging-protocols/assets/dots.svg deleted file mode 100644 index daf0dada2..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_hanging-protocols/assets/dots.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_polyfill/public/js/svg4everybody.min.js b/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_polyfill/public/js/svg4everybody.min.js deleted file mode 100644 index da3f6d8ca..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_polyfill/public/js/svg4everybody.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.svg4everybody=b()}):"object"==typeof module&&module.exports?module.exports=b():a.svg4everybody=b()}(this,function(){function a(a,b,c){if(c){var d=document.createDocumentFragment(),e=!b.hasAttribute("viewBox")&&c.getAttribute("viewBox");e&&b.setAttribute("viewBox",e);for(var f=c.cloneNode(!0);f.childNodes.length;)d.appendChild(f.firstChild);a.appendChild(d)}}function b(b){b.onreadystatechange=function(){if(4===b.readyState){var c=b._cachedDocument;c||(c=b._cachedDocument=document.implementation.createHTMLDocument(""),c.body.innerHTML=b.responseText,b._cachedTarget={}),b._embeds.splice(0).map(function(d){var e=b._cachedTarget[d.id];e||(e=b._cachedTarget[d.id]=c.getElementById(d.id)),a(d.parent,d.svg,e)})}},b.onreadystatechange()}function c(c){function e(){for(var c=0;c0)&&n(e,67)}var f,g=Object(c),h=/\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/,i=/\bAppleWebKit\/(\d+)\b/,j=/\bEdge\/12\.(\d+)\b/,k=/\bEdge\/.(\d+)\b/,l=window.top!==window.self;f="polyfill"in g?g.polyfill:h.test(navigator.userAgent)||(navigator.userAgent.match(j)||[])[1]<10547||(navigator.userAgent.match(i)||[])[1]<537||k.test(navigator.userAgent)&&l;var m={},n=window.requestAnimationFrame||setTimeout,o=document.getElementsByTagName("use"),p=0;f&&e()}function d(a){for(var b=a;"svg"!==b.nodeName.toLowerCase()&&(b=b.parentNode););return b}return c}); diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_polyfill/public/js/typedarray.min.js b/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_polyfill/public/js/typedarray.min.js deleted file mode 100644 index 82e7eb1de..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/packages/ohif_polyfill/public/js/typedarray.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! modernizr 3.5.0 (Custom Build) | MIT * - * https://modernizr.com/download/?-typedarrays-setclasses !*/ -!function(n,e,s){function o(n,e){return typeof n===e}function a(){var n,e,s,a,t,r,l;for(var c in f)if(f.hasOwnProperty(c)){if(n=[],e=f[c],e.name&&(n.push(e.name.toLowerCase()),e.options&&e.options.aliases&&e.options.aliases.length))for(s=0;s - - - HUD - - - - - - - - - - - Additional Measurements - - - - - - - - Lesions - - - - - - - - Settings - - - - - - Complete - - - - - - - - Locked - - - - - - Studies - - - - - - - - Window / Level - - - - - - - - - Link - - - - - - - - - Non-Target Measurement - - - - - - - - - - Target Measurement - - - - - - - - - Target CR Measurement - - - CR - - - - - - Target EX Measurement - - - EX - - - - - - Target UN Measurement - - - UN - - - - - - Temporary Measurement - - - - - - - - - - More - - - - - - - - Pan - - - - - - - - - - - - - Zoom - - - - - - - - Invert - - - - Stack Scroll - - - - Elliptical ROI - - - - Magnify - - - - Reset - - - - Rotate - - - - Rotate Right - - - - Cineplay Toggle - - - - Vertical - - - - Horizontal - - - - - Trial Information - - - - - - - - Expand - - - - - - Add - - - - - - Close - - - - - - - - Comment - - - - - - - Capture Screen - - - - - - - - - - Warning - - - - - - - - - Viewport Link - - - - - - - diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.eot b/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a4953f..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.svg b/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index 94fb5490a..000000000 --- a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.ttf b/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc609..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.woff b/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e612858f..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 b/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b54c..000000000 Binary files a/StandaloneViewer/SampleClientOnlyBuild/packages/twbs_bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ diff --git a/StandaloneViewer/StandaloneViewer/.gitignore b/StandaloneViewer/StandaloneViewer/.gitignore deleted file mode 100644 index 40b878db5..000000000 --- a/StandaloneViewer/StandaloneViewer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/.meteor/.finished-upgraders b/StandaloneViewer/StandaloneViewer/.meteor/.finished-upgraders deleted file mode 100644 index 4538749ab..000000000 --- a/StandaloneViewer/StandaloneViewer/.meteor/.finished-upgraders +++ /dev/null @@ -1,18 +0,0 @@ -# This file contains information which helps Meteor properly upgrade your -# app when you run 'meteor update'. You should check it into version control -# with your project. - -notices-for-0.9.0 -notices-for-0.9.1 -0.9.4-platform-file -notices-for-facebook-graph-api-2 -1.2.0-standard-minifiers-package -1.2.0-meteor-platform-split -1.2.0-cordova-changes -1.2.0-breaking-changes -1.3.0-split-minifiers-package -1.4.0-remove-old-dev-bundle-link -1.4.1-add-shell-server-package -1.4.3-split-account-service-packages -1.5-add-dynamic-import-package -1.7-split-underscore-from-meteor-base diff --git a/StandaloneViewer/StandaloneViewer/.meteor/.gitignore b/StandaloneViewer/StandaloneViewer/.meteor/.gitignore deleted file mode 100644 index 408303742..000000000 --- a/StandaloneViewer/StandaloneViewer/.meteor/.gitignore +++ /dev/null @@ -1 +0,0 @@ -local diff --git a/StandaloneViewer/StandaloneViewer/.meteor/.id b/StandaloneViewer/StandaloneViewer/.meteor/.id deleted file mode 100644 index 8a40384d1..000000000 --- a/StandaloneViewer/StandaloneViewer/.meteor/.id +++ /dev/null @@ -1,7 +0,0 @@ -# This file contains a token that is unique to your project. -# Check it into your repository along with the rest of this directory. -# It can be used for purposes such as: -# - ensuring you don't accidentally deploy one app on top of another -# - providing package authors with aggregated statistics - -166midj11jxxobr39vz4 diff --git a/StandaloneViewer/StandaloneViewer/.meteor/packages b/StandaloneViewer/StandaloneViewer/.meteor/packages deleted file mode 100644 index e34b01fa5..000000000 --- a/StandaloneViewer/StandaloneViewer/.meteor/packages +++ /dev/null @@ -1,42 +0,0 @@ -# Meteor packages used by this project, one per line. -# Check this file (and the other files in this directory) into your repository. -# -# 'meteor add' and 'meteor remove' will edit this file for you, -# but you can also edit it by hand. - -meteor-base@1.4.0 # Packages every Meteor app needs to have -mobile-experience@1.0.5 # Packages for a great mobile UX -mongo@1.5.0 # The database Meteor supports right now -blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views -reactive-var@1.0.11 # Reactive variable for tracker -jquery@1.11.10 # Helpful client-side library -tracker@1.2.0 # Meteor's client-side reactive programming library - -standard-minifier-css@1.4.1 # CSS minifier run for production mode -standard-minifier-js@2.3.4 # JS minifier run for production mode -ecmascript # Enable ECMAScript2015+ syntax in app code -shell-server@0.3.1 # Server-side component of the `meteor shell` command - -# OHIF Packages -ohif:polyfill -ohif:core -ohif:header -ohif:design -ohif:cornerstone -ohif:cornerstone-settings -ohif:viewerbase -ohif:metadata -ohif:study-list -ohif:measurement-table - -aldeed:template-extension -aldeed:simple-schema@1.5.3 -stylus@2.513.9 -clinical:router -session@1.1.7 -cultofcoders:persistent-session -reactive-dict@1.2.0 -fortawesome:fontawesome -mrt:moment -random@1.1.0 -underscore diff --git a/StandaloneViewer/StandaloneViewer/.meteor/platforms b/StandaloneViewer/StandaloneViewer/.meteor/platforms deleted file mode 100644 index efeba1b50..000000000 --- a/StandaloneViewer/StandaloneViewer/.meteor/platforms +++ /dev/null @@ -1,2 +0,0 @@ -server -browser diff --git a/StandaloneViewer/StandaloneViewer/.meteor/release b/StandaloneViewer/StandaloneViewer/.meteor/release deleted file mode 100644 index 04fe8b4f6..000000000 --- a/StandaloneViewer/StandaloneViewer/.meteor/release +++ /dev/null @@ -1 +0,0 @@ -METEOR@1.7.0.3 diff --git a/StandaloneViewer/StandaloneViewer/.meteor/versions b/StandaloneViewer/StandaloneViewer/.meteor/versions deleted file mode 100644 index f5b9647da..000000000 --- a/StandaloneViewer/StandaloneViewer/.meteor/versions +++ /dev/null @@ -1,125 +0,0 @@ -aldeed:collection2@2.10.0 -aldeed:collection2-core@1.2.0 -aldeed:schema-deny@1.1.0 -aldeed:schema-index@1.1.1 -aldeed:simple-schema@1.5.4 -aldeed:template-extension@4.1.0 -allow-deny@1.1.0 -amplify@1.0.0 -autoupdate@1.4.1 -babel-compiler@7.1.1 -babel-runtime@1.2.2 -base64@1.0.11 -binary-heap@1.0.10 -blaze@2.3.2 -blaze-html-templates@1.1.2 -blaze-tools@1.0.10 -boilerplate-generator@1.5.0 -caching-compiler@1.1.12 -caching-html-compiler@1.1.3 -callback-hook@1.1.0 -check@1.3.1 -clinical:router@2.0.19 -clinical:router-location@2.1.0 -clinical:router-middleware-stack@2.1.2 -clinical:router-url@2.1.0 -cultofcoders:persistent-session@0.4.5 -ddp@1.4.0 -ddp-client@2.3.3 -ddp-common@1.4.0 -ddp-server@2.2.0 -deps@1.0.12 -diff-sequence@1.1.0 -dynamic-import@0.4.1 -ecmascript@0.11.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.7.1 -ecmascript-runtime-server@0.7.0 -ejson@1.1.0 -es5-shim@4.8.0 -fastclick@1.0.13 -fortawesome:fontawesome@4.7.0 -geojson-utils@1.0.10 -hot-code-push@1.0.4 -html-tools@1.0.11 -htmljs@1.0.11 -http@1.4.1 -id-map@1.1.0 -iron:controller@1.0.12 -iron:core@1.0.11 -iron:dynamic-template@1.0.12 -iron:layout@1.0.12 -jquery@1.11.11 -launch-screen@1.1.1 -livedata@1.0.18 -logging@1.1.20 -mdg:validation-error@0.5.1 -meteor@1.9.2 -meteor-base@1.4.0 -meteor-platform@1.2.6 -minifier-css@1.3.1 -minifier-js@2.3.5 -minimongo@1.4.4 -mobile-experience@1.0.5 -mobile-status-bar@1.0.14 -modern-browsers@0.1.2 -modules@0.12.2 -modules-runtime@0.10.2 -momentjs:moment@2.18.1 -mongo@1.5.1 -mongo-dev-server@1.1.0 -mongo-id@1.0.7 -mrt:moment@2.8.1 -natestrauser:select2@4.0.3 -npm-mongo@3.0.7 -observe-sequence@1.0.16 -ohif:commands@0.0.1 -ohif:core@0.0.1 -ohif:cornerstone@0.0.1 -ohif:cornerstone-settings@0.0.1 -ohif:design@0.0.1 -ohif:hanging-protocols@0.0.1 -ohif:header@0.0.1 -ohif:hotkeys@0.0.1 -ohif:log@0.0.1 -ohif:measurement-table@0.0.1 -ohif:measurements@0.0.1 -ohif:metadata@0.0.1 -ohif:polyfill@0.0.1 -ohif:select-tree@0.0.1 -ohif:servers@0.0.1 -ohif:studies@0.0.1 -ohif:study-list@0.0.1 -ohif:themes@0.0.1 -ohif:themes-common@0.0.1 -ohif:viewerbase@0.0.1 -ohif:wadoproxy@0.0.1 -ordered-dict@1.1.0 -promise@0.11.1 -raix:eventemitter@0.1.3 -random@1.1.0 -reactive-dict@1.2.0 -reactive-var@1.0.11 -reload@1.2.0 -retry@1.1.0 -routepolicy@1.0.13 -session@1.1.7 -shell-server@0.3.1 -silentcicero:jszip@0.0.4 -socket-stream-client@0.2.2 -spacebars@1.0.15 -spacebars-compiler@1.1.3 -standard-app-packages@1.0.9 -standard-minifier-css@1.4.1 -standard-minifier-js@2.3.4 -stylus@2.513.14 -templating@1.3.2 -templating-compiler@1.3.3 -templating-runtime@1.3.2 -templating-tools@1.1.2 -tracker@1.2.0 -ui@1.0.13 -underscore@1.0.10 -url@1.2.0 -webapp@1.6.2 -webapp-hashing@1.0.9 diff --git a/StandaloneViewer/StandaloneViewer/client/body.html b/StandaloneViewer/StandaloneViewer/client/body.html deleted file mode 100644 index 7ea7fcea5..000000000 --- a/StandaloneViewer/StandaloneViewer/client/body.html +++ /dev/null @@ -1,3 +0,0 @@ - -

    - diff --git a/StandaloneViewer/StandaloneViewer/client/body.styl b/StandaloneViewer/StandaloneViewer/client/body.styl deleted file mode 100644 index 6c2ea7ef9..000000000 --- a/StandaloneViewer/StandaloneViewer/client/body.styl +++ /dev/null @@ -1,9 +0,0 @@ -html - width: 100% - height: 100% - -body - width: 100% - height: 100% - overflow: hidden - position: fixed \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.html b/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.html deleted file mode 100644 index b631a9c7e..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.js b/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.js deleted file mode 100644 index d15e0fd31..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Template } from 'meteor/templating'; - -Template.flexboxLayout.events({ - 'transitionend .sidebarMenu'(event, instance) { - if (!event.target.classList.contains('sidebarMenu')) { - return; - } - - window.ResizeViewportManager.handleResize(); - } -}); - -Template.flexboxLayout.helpers({ - leftSidebarOpen() { - return Template.instance().data.state.get('leftSidebar'); - }, - rightSidebarOpen() { - return Template.instance().data.state.get('rightSidebar'); - } -}); diff --git a/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.styl b/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.styl deleted file mode 100644 index 1617f5875..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/flexboxLayout/flexboxLayout.styl +++ /dev/null @@ -1,67 +0,0 @@ -@require '{ohif:design}/app' - -.viewerSection - display: flex - flex: 1 - flex-flow: row nowrap - align-items: stretch - height: 'calc(100% - %s)' % ($toolbarHeight) - width: 100% - - .sidebarMenu - height: 100% - // required transformation to make inner fixed elements relative to this one - transform(scale(1)) - transition($sidebarTransition) - - .sidebar-option - height: 100% - max-width: inherit - position: absolute - transform(translateX(100%)) - transition($sidebarTransition) - width: 100% - - &.active - transform(translateX(0%)) - - .sidebar-left - theme('border-right', '%s solid $uiBorderColor' % $uiBorderThickness) - flex: 1 - margin-left: - $studiesSidebarMenuWidth - max-width: $studiesSidebarMenuWidth - order: 1 - - &.sidebar-open - margin-left: 0 - - .mainContent - flex: 1 - height: 100% - order: 2 - overflow: hidden - transition($sidebarTransition) - width: 100% - - .sidebar-right - flex: 1 - margin-right: - $rightSidebarMenuWidth - max-width: $rightSidebarMenuWidth - order: 3 - position: relative - - &[data-timepoints="3"] - margin-right: - ($rightSidebarMenuWidth + 135.5px) - max-width: $rightSidebarMenuWidth + 135.5px - - &[data-timepoints="4"] - margin-right: - ($rightSidebarMenuWidth + 270px) - max-width: $rightSidebarMenuWidth + 270px - - &.sidebar-open - margin-right: 0 - - .studiesListedChanger - theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) - padding: 20px 10px - text-align: center diff --git a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewer/standaloneViewer.html b/StandaloneViewer/StandaloneViewer/client/components/standaloneViewer/standaloneViewer.html deleted file mode 100644 index 5f57125f1..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewer/standaloneViewer.html +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewer/standaloneViewer.styl b/StandaloneViewer/StandaloneViewer/client/components/standaloneViewer/standaloneViewer.styl deleted file mode 100644 index ed73f1875..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewer/standaloneViewer.styl +++ /dev/null @@ -1,39 +0,0 @@ -@import "{ohif:design}/app" - -body>.header - - .brand - height: 30px - display: inline-block - text-decoration: none - - .logo-image - display: inline-block - fill: transparent - float: left - height: 100% - margin: 0 8px 0 0 - width: 30px - - .logo-text - display: inline-block - font-family: $logoFontFamily - font-size: 14px - font-weight: $logoFontWeight - theme('color', '$textPrimaryColor') - line-height: 30px - - a.header-menu - theme('color', '$textPrimaryColor') - - .header-options - font-size: 13px - - .menu-toggle - display: inline-block - height: 18px - - .research-use - font-size: 13px - theme('color', '$textSecondaryColor') - font-weight: bold \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.html b/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.html deleted file mode 100644 index 8d3d1dd11..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.html +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.js b/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.js deleted file mode 100644 index 4e0970fb5..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.js +++ /dev/null @@ -1,67 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; - -Meteor.startup(() => { - window.ResizeViewportManager = window.ResizeViewportManager || new OHIF.viewerbase.ResizeViewportManager(); -}); - -Template.standaloneViewerMain.onCreated(() => { - // Attach the Window resize listener - window.addEventListener('resize', window.ResizeViewportManager.getResizeHandler()); - - // Create the synchronizer used to update reference lines - OHIF.viewer.updateImageSynchronizer = new cornerstoneTools.Synchronizer('cornerstonenewimage', cornerstoneTools.updateImageSynchronizer); - - OHIF.viewer.metadataProvider = new OHIF.cornerstone.MetadataProvider(); - // Metadata configuration - const metadataProvider = OHIF.viewer.metadataProvider; - cornerstone.metaData.addProvider(metadataProvider.provider.bind(metadataProvider)); - - // Set the current context - OHIF.context.set('viewer'); -}); - -Template.standaloneViewerMain.onRendered(() => { - const instance = Template.instance(); - - const studies = instance.data.studies; - const parentElement = instance.$('#layoutManagerTarget').get(0); - const studyPrefetcher = OHIF.viewerbase.StudyPrefetcher.getInstance(); - instance.studyPrefetcher = studyPrefetcher; - - instance.studyLoadingListener = OHIF.viewerbase.StudyLoadingListener.getInstance(); - instance.studyLoadingListener.clear(); - instance.studyLoadingListener.addStudies(studies); - - OHIF.viewerbase.layoutManager = new OHIF.viewerbase.LayoutManager(parentElement, studies); - OHIF.viewerbase.layoutManager.updateViewports(); - - studyPrefetcher.setStudies(studies); - - // Enable hotkeys - OHIF.viewerbase.hotkeyUtils.enableHotkeys(); -}); - -Template.standaloneViewerMain.onDestroyed(() => { - // Remove the Window resize listener - window.removeEventListener('resize', window.ResizeViewportManager.getResizeHandler()); - - // Destroy the synchronizer used to update reference lines - OHIF.viewer.updateImageSynchronizer.destroy(); - - delete OHIF.viewerbase.layoutManager; - - // Stop prefetching when we close the viewer - instance.studyPrefetcher.destroy(); - - // Destroy stack loading listeners when we close the viewer - instance.studyLoadingListener.clear(); - - // Clear references to all stacks in the StackManager - OHIF.viewerbase.stackManager.clearStacks(); - - // Reset the current context - OHIF.context.set(null); -}); diff --git a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.styl b/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.styl deleted file mode 100644 index f7aec7c0d..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/standaloneViewerMain/standaloneViewerMain.styl +++ /dev/null @@ -1,35 +0,0 @@ -@import "{ohif:design}/app" - -.viewerMain - width: 100% - height: 100% - - #layoutManagerTarget - width: 100% - height: 100% - transition(all 0.3s ease) - - #imageViewerViewports - padding-right: 0 !important // Top remove odd borders from non-existant right Sidebar - - .viewportContainer - theme('border', '%s solid $uiBorderColorDark' % $viewportBorderThickness) - float: left - - outline: 0 // Prevent blue outline in Chrome - - &:hover - &.active - &:hover.active - outline: 0 // Prevent blue outline in Chrome - - &:hover - theme('border', '%s solid $uiBorderColor' % $viewportBorderThickness) - - &.active, &:hover.active - theme('border', '%s solid $uiBorderColorActive' % $viewportBorderThickness) - - .removable - width: 100% - height: 100% - position: relative // Necessary so that the viewportOverlay is on top of the viewports diff --git a/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.html b/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.html deleted file mode 100644 index 067a9f914..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.js b/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.js deleted file mode 100644 index 8ab7face1..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.js +++ /dev/null @@ -1,278 +0,0 @@ -import { Template } from 'meteor/templating'; -import { OHIF } from 'meteor/ohif:core'; -import 'meteor/ohif:viewerbase'; - -Template.toolbarSection.onCreated(() => { - const instance = Template.instance(); - - if (OHIF.uiSettings.leftSidebarOpen) { - instance.data.state.set('leftSidebar', 'studies'); - } -}); - -Template.toolbarSection.helpers({ - leftSidebarToggleButtonData() { - const instance = Template.instance(); - return { - toggleable: true, - key: 'leftSidebar', - value: instance.data.state, - options: [{ - value: 'studies', - svgLink: 'packages/ohif_viewerbase/assets/icons.svg#icon-studies', - svgWidth: 15, - svgHeight: 13, - bottomLabel: 'Series' - }] - }; - }, - - rightSidebarToggleButtonData() { - const instance = Template.instance(); - return { - toggleable: true, - key: 'rightSidebar', - value: instance.data.state, - options: [{ - value: 'measurements', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-measurements-lesions', - svgWidth: 18, - svgHeight: 10, - bottomLabel: 'Measurements' - }] - }; - }, - - toolbarButtons() { - const extraTools = []; - - extraTools.push({ - id: 'crosshairs', - title: 'Crosshairs', - classes: 'imageViewerTool', - iconClasses: 'fa fa-crosshairs' - }); - - extraTools.push({ - id: 'magnify', - title: 'Magnify', - classes: 'imageViewerTool toolbarSectionButton', - iconClasses: 'fa fa-circle' - }); - - extraTools.push({ - id: 'wwwcRegion', - title: 'ROI Window', - classes: 'imageViewerTool', - iconClasses: 'fa fa-square' - }); - - extraTools.push({ - id: 'dragProbe', - title: 'Probe', - classes: 'imageViewerTool', - iconClasses: 'fa fa-dot-circle-o' - }); - - extraTools.push({ - id: 'ellipticalRoi', - title: 'Ellipse', - classes: 'imageViewerTool', - iconClasses: 'fa fa-circle-o' - }); - - extraTools.push({ - id: 'rectangleRoi', - title: 'Rectangle', - classes: 'imageViewerTool', - iconClasses: 'fa fa-square-o' - }); - - extraTools.push({ - id: 'invert', - title: 'Invert', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-adjust' - }); - - extraTools.push({ - id: 'rotateR', - title: 'Rotate Right', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-rotate-right' - }); - - extraTools.push({ - id: 'flipH', - title: 'Flip H', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-horizontal' - }); - - extraTools.push({ - id: 'flipV', - title: 'Flip V', - classes: 'imageViewerCommand', - svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-vertical' - }); - - extraTools.push({ - id: 'clearTools', - title: 'Clear', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-trash' - }); - - const buttonData = []; - - buttonData.push({ - id: 'stackScroll', - title: 'Stack Scroll', - classes: 'imageViewerTool', - iconClasses: 'fa fa-bars' - }); - - buttonData.push({ - id: 'zoom', - title: 'Zoom', - classes: 'imageViewerTool', - svgLink: 'packages/ohif_viewerbase/assets/icons.svg#icon-tools-zoom' - }); - - buttonData.push({ - id: 'wwwc', - title: 'Levels', - classes: 'imageViewerTool', - svgLink: 'packages/ohif_viewerbase/assets/icons.svg#icon-tools-levels' - }); - - buttonData.push({ - id: 'pan', - title: 'Pan', - classes: 'imageViewerTool', - svgLink: 'packages/ohif_viewerbase/assets/icons.svg#icon-tools-pan' - }); - - buttonData.push({ - id: 'length', - title: 'Length', - classes: 'imageViewerTool toolbarSectionButton', - svgLink: 'packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp' - }); - - buttonData.push({ - id: 'annotate', - title: 'Annotate', - classes: 'imageViewerTool', - svgLink: 'packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-non-target' - }); - - buttonData.push({ - id: 'angle', - title: 'Angle', - classes: 'imageViewerTool', - iconClasses: 'fa fa-angle-left' - }); - - buttonData.push({ - id: 'resetViewport', - title: 'Reset', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-undo' - }); - - if (!OHIF.uiSettings.displayEchoUltrasoundWorkflow) { - - buttonData.push({ - id: 'previousDisplaySet', - title: 'Previous', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-toggle-up fa-fw' - }); - - buttonData.push({ - id: 'nextDisplaySet', - title: 'Next', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-toggle-down fa-fw' - }); - - const { isPlaying } = OHIF.viewerbase.viewportUtils; - buttonData.push({ - id: 'toggleCinePlay', - title: () => isPlaying() ? 'Stop' : 'Play', - classes: 'imageViewerCommand', - iconClasses: () => ('fa fa-fw ' + (isPlaying() ? 'fa-stop' : 'fa-play')), - active: isPlaying - }); - - buttonData.push({ - id: 'toggleCineDialog', - title: 'CINE', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-youtube-play', - active: () => $('#cineDialog').is(':visible') - }); - } - - buttonData.push({ - id: 'layout', - title: 'Layout', - iconClasses: 'fa fa-th-large', - buttonTemplateName: 'layoutButton' - }); - - buttonData.push({ - id: 'toggleMore', - title: 'More', - classes: 'rp-x-1 rm-l-3', - svgLink: 'packages/ohif_viewerbase/assets/icons.svg#icon-tools-more', - subTools: extraTools - }); - - return buttonData; - }, - - hangingProtocolButtons() { - let buttonData = []; - - buttonData.push({ - id: 'previousPresentationGroup', - title: 'Prev. Stage', - iconClasses: 'fa fa-step-backward', - buttonTemplateName: 'previousPresentationGroupButton' - }); - - buttonData.push({ - id: 'nextPresentationGroup', - title: 'Next Stage', - iconClasses: 'fa fa-step-forward', - buttonTemplateName: 'nextPresentationGroupButton' - }); - - return buttonData; - } - -}); - -Template.toolbarSection.onRendered(function() { - const instance = Template.instance(); - - instance.$('#layout').dropdown(); - - // Set disabled/enabled tool buttons that are set in toolManager - const states = OHIF.viewerbase.toolManager.getToolDefaultStates(); - const disabledToolButtons = states.disabledToolButtons; - const allToolbarButtons = $('#toolbar').find('button'); - if (disabledToolButtons && disabledToolButtons.length > 0) { - for (let i = 0; i < allToolbarButtons.length; i++) { - const toolbarButton = allToolbarButtons[i]; - $(toolbarButton).prop('disabled', false); - - const index = disabledToolButtons.indexOf($(toolbarButton).attr('id')); - if (index !== -1) { - $(toolbarButton).prop('disabled', true); - } - } - } -}); diff --git a/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.styl b/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.styl deleted file mode 100644 index 36672029c..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/toolbarSection/toolbarSection.styl +++ /dev/null @@ -1,13 +0,0 @@ -@import "{ohif:design}/app" - -.toolbarSection - theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) - flex: 0 0 auto - height: $toolbarHeight - padding-top: 6px - position: relative - transition(height 300ms ease) - width: 100% - - &.expanded - height: $toolbarHeight + $toolbarDrawerHeight diff --git a/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.html b/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.html deleted file mode 100644 index f956ec30b..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.html +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.js b/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.js deleted file mode 100644 index 0fe8c5b31..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.js +++ /dev/null @@ -1,145 +0,0 @@ -import { Template } from 'meteor/templating'; -import { Session } from 'meteor/session'; -import { Tracker } from 'meteor/tracker'; -import { ReactiveDict } from 'meteor/reactive-dict'; -import { OHIF } from 'meteor/ohif:core'; -import { MeasurementTable } from 'meteor/ohif:measurement-table'; - -import 'meteor/ohif:viewerbase'; -import 'meteor/ohif:metadata'; - -const viewportUtils = OHIF.viewerbase.viewportUtils; - -OHIF.viewer.functionList = { - toggleCineDialog: viewportUtils.toggleCineDialog, - toggleCinePlay: viewportUtils.toggleCinePlay, - clearTools: viewportUtils.clearTools, - resetViewport: viewportUtils.resetViewport, - invert: viewportUtils.invert -}; - -Session.setDefault('activeViewport', false); -Session.setDefault('leftSidebar', false); -Session.setDefault('rightSidebar', false); - -/** - * Inits OHIF Hanging Protocol's onReady. - * It waits for OHIF Hanging Protocol to be ready to instantiate the ProtocolEngine - * Hanging Protocol will use OHIF LayoutManager to render viewports properly - */ -const initHangingProtocol = () => { - // When Hanging Protocol is ready - HP.ProtocolStore.onReady(() => { - - // Gets all StudyMetadata objects: necessary for Hanging Protocol to access study metadata - const studyMetadataList = OHIF.viewer.StudyMetadataList.all(); - - // Caches Layout Manager: Hanging Protocol uses it for layout management according to current protocol - const layoutManager = OHIF.viewerbase.layoutManager; - - // Instantiate StudyMetadataSource: necessary for Hanging Protocol to get study metadata - const studyMetadataSource = new OHIF.studies.classes.OHIFStudyMetadataSource(); - - // Creates Protocol Engine object with required arguments - const ProtocolEngine = new HP.ProtocolEngine(layoutManager, studyMetadataList, [], studyMetadataSource); - - // Sets up Hanging Protocol engine - HP.setEngine(ProtocolEngine); - - }); -}; - -Template.viewer.onCreated(() => { - - OHIF.viewer.measurementTable = new MeasurementTable(); - - const instance = Template.instance(); - - instance.state = new ReactiveDict(); - - instance.state.set('leftSidebar', Session.get('leftSidebar')); - instance.state.set('rightSidebar', Session.get('rightSidebar')); - - if (OHIF.viewer.data && OHIF.viewer.data.loadedSeriesData) { - OHIF.log.info('Reloading previous loadedSeriesData'); - OHIF.viewer.loadedSeriesData = OHIF.viewer.data.loadedSeriesData; - } else { - OHIF.log.info('Setting default viewer data'); - OHIF.viewer.loadedSeriesData = {}; - OHIF.viewer.data = {}; - OHIF.viewer.data.loadedSeriesData = OHIF.viewer.loadedSeriesData; - - // Update the viewer data object - OHIF.viewer.data.viewportColumns = 1; - OHIF.viewer.data.viewportRows = 1; - OHIF.viewer.data.activeViewport = 0; - } - - // Store the viewer data in session for further user - Session.setPersistent('ViewerData', OHIF.viewer.data); - - Session.set('activeViewport', OHIF.viewer.data.activeViewport || 0); - - // @TypeSafeStudies - // Update the OHIF.viewer.Studies collection with the loaded studies - OHIF.viewer.Studies.removeAll(); - - // @TypeSafeStudies - // Clears OHIF.viewer.StudyMetadataList collection - OHIF.viewer.StudyMetadataList.removeAll(); - - OHIF.viewer.data.studyInstanceUids = []; - instance.data.studies.forEach(study => { - const studyMetadata = new OHIF.metadata.StudyMetadata(study, study.studyInstanceUid); - let displaySets = study.displaySets; - - if(!study.displaySets) { - displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata); - study.displaySets = displaySets; - } - - studyMetadata.setDisplaySets(displaySets); - - study.selected = true; - OHIF.viewer.Studies.insert(study); - OHIF.viewer.StudyMetadataList.insert(studyMetadata); - OHIF.viewer.data.studyInstanceUids.push(study.studyInstanceUid); - }); - - // Call Viewer plugins onCreated functions - if(typeof OHIF.viewer.measurementTable.onCreated === 'function') { - OHIF.viewer.measurementTable.onCreated(instance); - } -}); - -Template.viewer.onRendered(function() { - const instance = Template.instance(); - this.autorun(function() { - // To make sure ohif viewerMain is rendered before initializing Hanging Protocols - const isOHIFViewerMainRendered = Session.get('OHIFViewerMainRendered'); - - // To avoid first run - if (isOHIFViewerMainRendered) { - // To run only when ViewerMainRendered dependency has changed. - // because initHangingProtocol can have other reactive components - Tracker.nonreactive(initHangingProtocol); - } - }); - - // Call Viewer plugins onRendered functions - if(typeof OHIF.viewer.measurementTable.onRendered === 'function') { - OHIF.viewer.measurementTable.onRendered(instance); - } -}); - -Template.viewer.events( Object.assign({ - // Viewer Events - }, - MeasurementTable.measurementEvents -)); - -Template.viewer.helpers({ - state() { - return Template.instance().state; - } -}); diff --git a/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.styl b/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.styl deleted file mode 100644 index 16bf01215..000000000 --- a/StandaloneViewer/StandaloneViewer/client/components/viewer/viewer.styl +++ /dev/null @@ -1,10 +0,0 @@ -@import "{ohif:design}/app" - -#viewer - background-color: black - height: "calc(100% - %s)" % $topBarHeight - width: 100% - -.loadingTextDiv - theme('color', '$textSecondaryColor') - font-size: 30px diff --git a/StandaloneViewer/StandaloneViewer/client/config.js b/StandaloneViewer/StandaloneViewer/client/config.js deleted file mode 100644 index 8a81ef8f8..000000000 --- a/StandaloneViewer/StandaloneViewer/client/config.js +++ /dev/null @@ -1,35 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { OHIF } from 'meteor/ohif:core'; -import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone'; -import * as cornerstoneWebImageLoader from 'cornerstone-web-image-loader'; - -Meteor.startup(function() { - const maxWebWorkers = Math.max(navigator.hardwareConcurrency - 1, 1); - const config = { - maxWebWorkers: maxWebWorkers, - startWebWorkersOnDemand: true, - webWorkerPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'), - taskConfiguration: { - decodeTask: { - loadCodecsOnStartup: true, - initializeCodecsOnStartup: false, - codecsPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'), - usePDFJS: false - } - } - }; - - cornerstoneWADOImageLoader.webWorkerManager.initialize(config); - cornerstoneWebImageLoader.external.cornerstone = cornerstone; - - let configureAuthorization = { - beforeSend: function(xhr){ - if (OHIF.viewer.authorizationToken) { - xhr.setRequestHeader('Authorization', OHIF.viewer.authorizationToken); - } - } - }; - - cornerstoneWADOImageLoader.configure(configureAuthorization); - cornerstoneWebImageLoader.configure(configureAuthorization); -}); diff --git a/StandaloneViewer/StandaloneViewer/client/head.html b/StandaloneViewer/StandaloneViewer/client/head.html deleted file mode 100644 index 948416d3a..000000000 --- a/StandaloneViewer/StandaloneViewer/client/head.html +++ /dev/null @@ -1,11 +0,0 @@ - - - OHIF DICOM Viewer - - - - - - - - diff --git a/StandaloneViewer/StandaloneViewer/client/headerItems.js b/StandaloneViewer/StandaloneViewer/client/headerItems.js deleted file mode 100644 index bb63de639..000000000 --- a/StandaloneViewer/StandaloneViewer/client/headerItems.js +++ /dev/null @@ -1,14 +0,0 @@ -import { OHIF } from 'meteor/ohif:core'; - -OHIF.header.dropdown.setItems([{ - action: () => OHIF.ui.showDialog('themeSelectorModal'), - text: 'Themes', - iconClasses: 'theme', - iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#theme', - separatorAfter: false -}, { - action: () => OHIF.ui.showDialog('userPreferencesDialog'), - text: 'Preferences', - icon: 'fa fa-user', - separatorAfter: false -}]); diff --git a/StandaloneViewer/StandaloneViewer/package-lock.json b/StandaloneViewer/StandaloneViewer/package-lock.json deleted file mode 100644 index 519c9eb0b..000000000 --- a/StandaloneViewer/StandaloneViewer/package-lock.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "StandaloneViewer", - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "@babel/runtime": { - "version": "7.0.0-beta.53", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0-beta.53.tgz", - "integrity": "sha1-nfIq40gjzon3kAYFlLg+5XLixdI=", - "requires": { - "core-js": "^2.5.7", - "regenerator-runtime": "^0.12.0" - } - }, - "core-js": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" - }, - "cornerstone-web-image-loader": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cornerstone-web-image-loader/-/cornerstone-web-image-loader-2.1.0.tgz", - "integrity": "sha512-RllTpe+NNDY5rPr9/8mjbFOpwYHrPZFuqT1wsLzoKnbapSXAWNy6waCjPVKGON0dLThLE7gihvuX/q7eSEmdsg==" - }, - "loglevel": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", - "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=" - }, - "regenerator-runtime": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.0.tgz", - "integrity": "sha512-SpV2LhF5Dm9UYMEprB3WwsBnWwqTrmjrm2UZb42cl2G02WVGgx7Mg8aa9pdLEKp6hZ+/abcMc2NxKA8f02EG2w==" - } - } -} diff --git a/StandaloneViewer/StandaloneViewer/package.json b/StandaloneViewer/StandaloneViewer/package.json deleted file mode 100644 index 8e0856c99..000000000 --- a/StandaloneViewer/StandaloneViewer/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "StandaloneViewer", - "private": true, - "scripts": { - "start": "meteor run" - }, - "dependencies": { - "@babel/runtime": "^7.0.0-beta.53", - "cornerstone-web-image-loader": "^2.1.0", - "loglevel": "^1.6.1" - } -} diff --git a/StandaloneViewer/StandaloneViewer/private/testData/CRStudy.json b/StandaloneViewer/StandaloneViewer/private/testData/CRStudy.json deleted file mode 100644 index d4a2dab92..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/CRStudy.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "transactionId": "CRStudy", - "studies": [ - { - "studyInstanceUid": "1.3.51.0.7.633918642.633920010109.6339100821", - "studyDescription": "pelvis", - "studyDate": "20010109", - "studyTime": "100821", - "patientName": "MISTER^CR", - "patientId": "9227465", - "seriesList": [ - { - "seriesDescription": "Lat. Pelvis", - "seriesInstanceUid": "1.3.51.5145.15142.20010109.1105752", - "seriesBodyPart": "PELVIS", - "seriesNumber": "1", - "seriesModality": "CR", - "instances": [ - { - "columns": 2040, - "rows": 2570, - "instanceNumber": "1", - "photometricInterpretation": "MONOCHROME1", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "1.14000000E-01\\1.14000000E-01", - "highBit": 11, - "rescaleSlope": "6.83760684E-01", - "rescaleIntercept": "2.00000000E+02", - "imageType": "DERIVED\\PRIMARY", - "sopInstanceUid": "1.3.51.5145.5142.20010109.1105752.1.0.1", - "url": "dicomweb://s3.amazonaws.com/lury/CRStudy/1.3.51.5145.5142.20010109.1105752.1.0.1.dcm" - } - ] - }, - { - "seriesDescription": "Pelvis", - "seriesInstanceUid": "1.3.51.5145.15142.20010109.1105627", - "seriesBodyPart": "PELVIS", - "seriesNumber": "1", - "seriesModality": "CR", - "instances": [ - { - "columns": 3730, - "rows": 3062, - "instanceNumber": "1", - "photometricInterpretation": "MONOCHROME1", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "1.14000000E-01\\1.14000000E-01", - "highBit": 11, - "rescaleSlope": "6.83760684E-01", - "rescaleIntercept": "2.00000000E+02", - "imageType": "DERIVED\\PRIMARY", - "sopInstanceUid": "1.3.51.5145.5142.20010109.1105627.1.0.1", - "url": "dicomweb://s3.amazonaws.com/lury/CRStudy/1.3.51.5145.5142.20010109.1105627.1.0.1.dcm" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/CTStudy.json b/StandaloneViewer/StandaloneViewer/private/testData/CTStudy.json deleted file mode 100644 index 432c47028..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/CTStudy.json +++ /dev/null @@ -1,2345 +0,0 @@ -{ - "transactionId": "CTStudy", - "studies": [ - { - "studyInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886", - "studyDescription": "CHEST", - "studyDate": "20010105", - "studyTime": "083501", - "patientName": "MISTER^CT", - "patientId": "2178309", - "seriesList": [ - { - "seriesDescription": "SCOUT", - "seriesInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668949.887", - "seriesNumber": "1", - "seriesDate": "20010105", - "seriesTime": "083501", - "seriesModality": "CT", - "instances": [ - { - "columns": 512, - "rows": 375, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "1.014672\\0.969483", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-248.187592\\0.000000\\ 30.000000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\LOCALIZER", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668949.888", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668949.888.dcm" - }, - { - "columns": 512, - "rows": 375, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "1.014672\\0.969483", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "0.000000\\ -1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "0.000000\\248.187592\\ 30.000000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\LOCALIZER", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668949.889", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668949.889.dcm" - } - ] - }, - { - "seriesDescription": "HELICAL CHEST", - "seriesInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668949.890", - "seriesNumber": "2", - "seriesDate": "20010105", - "seriesTime": "083709", - "seriesModality": "CT", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\4.700000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.109", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.109.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\2.200000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.110", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.110.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -2.800000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.112", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.112.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-10.299999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.115", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.115.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -5.300000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.113", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.113.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -7.800000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.114", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.114.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -0.300000", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.111", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.111.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-15.299999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.117", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.117.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-12.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.116", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.116.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-17.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.118", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.118.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-20.299999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.119", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.119.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "14", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-27.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.122", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.122.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-22.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.120", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.120.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-25.299999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.121", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.121.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "15", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-30.299997", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.123", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.123.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "16", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-32.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.124", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.124.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "17", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-35.299999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.125", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.125.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "18", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-37.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.126", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.126.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "20", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-42.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.128", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.128.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "19", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-40.299999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.127", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.127.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "21", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-45.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.129", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.129.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "22", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-47.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.130", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.130.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "23", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-50.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.131", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.131.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "24", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-52.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.132", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.132.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "25", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-55.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.133", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.133.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "26", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-57.799999", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.134", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.134.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "28", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-62.799995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.136", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.136.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "27", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-60.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.135", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.135.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "29", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-65.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.137", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.137.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "30", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-67.799995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.138", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.138.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "32", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-72.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.140", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.140.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "31", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-70.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.139", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.139.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "33", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-75.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.141", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.141.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "34", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-77.799995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.142", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.142.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "35", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-80.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.143", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.143.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "36", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-82.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.144", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.144.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "38", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-87.799995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.146", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.146.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "37", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-85.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.145", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.145.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "39", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-90.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.147", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.147.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "40", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-92.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.148", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.148.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "41", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-95.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.149", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.149.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "42", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\-97.799995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.150", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.150.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "44", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -102.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.152", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.152.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "43", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -100.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.151", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.151.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "45", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -105.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.153", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.153.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "46", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -107.799995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.154", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.154.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "47", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -110.299995", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.155", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.155.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "48", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -112.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.156", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.156.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "49", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -115.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.157", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.157.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "50", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -117.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.158", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.158.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "51", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -120.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.159", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.159.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "54", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -127.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.162", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.162.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "53", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -125.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.161", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.161.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "56", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -132.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.164", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.164.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "55", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -130.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.163", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.163.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "58", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -137.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.166", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.166.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "57", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -135.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.165", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.165.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "59", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -140.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.167", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.167.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "60", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -142.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.168", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.168.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "61", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -145.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.169", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.169.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "62", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -147.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.170", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.170.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "64", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -152.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.172", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.172.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "63", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -150.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.171", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.171.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "65", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -155.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.173", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.173.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "66", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -157.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.174", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.174.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "67", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -160.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.175", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.175.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "68", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -162.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.176", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.176.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "69", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -165.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.177", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.177.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "70", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -167.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.178", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.178.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "71", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -170.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.179", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.179.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "73", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -175.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.181", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.181.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "74", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -177.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.182", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.182.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "72", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -172.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.180", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.180.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "76", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -182.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.184", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.184.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "75", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -180.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.183", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.183.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "77", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -185.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.185", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.185.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "78", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -187.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.186", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.186.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "80", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -192.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.188", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.188.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "79", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -190.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.187", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.187.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "81", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -195.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.189", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.189.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "82", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -197.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.190", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.190.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "83", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -200.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.191", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.191.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "84", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -202.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.192", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.192.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "86", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -207.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.194", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.194.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "87", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -210.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.195", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.195.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "85", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -205.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.193", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.193.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "88", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -212.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.196", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.196.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "89", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -215.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.197", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.197.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "90", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -217.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.198", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.198.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "91", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -220.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.199", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.199.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "92", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -222.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.200", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.200.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "93", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -225.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.201", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.201.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "94", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -227.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.202", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.202.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "95", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -230.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.203", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.203.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "96", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -232.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.204", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.204.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "98", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -237.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.206", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.206.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "99", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -240.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.207", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.207.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "97", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -235.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.205", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.205.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "100", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -242.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.208", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.208.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "101", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -245.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.209", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.209.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "102", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -247.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.210", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.210.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "103", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -250.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.211", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.211.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "105", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -255.300003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.213", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.213.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "104", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -252.800003", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.212", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.212.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "106", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -257.799988", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.214", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.214.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "109", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -265.299988", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.217", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.217.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "108", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -262.799988", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.216", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.216.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "107", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.675781\\0.675781", - "highBit": 15, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-161.399994\\ -148.800003\\ -260.299988", - "frameOfReferenceUID": "1.2.840.113619.2.30.1.1762295590.1623.978668949.886.8493.0.12", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL", - "sopInstanceUid": "1.2.840.113619.2.30.1.1762295590.1623.978668950.215", - "url": "dicomweb://s3.amazonaws.com/lury/CTStudy/1.2.840.113619.2.30.1.1762295590.1623.978668950.215.dcm" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/DXStudy.json b/StandaloneViewer/StandaloneViewer/private/testData/DXStudy.json deleted file mode 100644 index ce64996b3..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/DXStudy.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "transactionId": "DXStudy", - "studies": [ - { - "studyInstanceUid": "1.2.840.113619.2.67.2158294438.15745010109084247.20000", - "studyDescription": "CHEST", - "studyDate": "20010109", - "studyTime": "084353.000000", - "patientName": "MISTER^DX", - "patientId": "3524578", - "seriesList": [ - { - "seriesDescription": "DX CHEST", - "seriesInstanceUid": "1.2.840.113619.2.67.2158294438.16113010109084403.10003", - "seriesBodyPart": "CHEST", - "seriesNumber": "28860", - "seriesDate": "20010109", - "seriesTime": "084403.000000", - "seriesModality": "DX", - "instances": [ - { - "columns": 1736, - "rows": 2022, - "instanceNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 14, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 13, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.67.2158294438.16324010109084413.245", - "url": "dicomweb://s3.amazonaws.com/lury/DXStudy/1.2.840.113619.2.67.2158294438.16324010109084413.245.dcm" - } - ] - }, - { - "seriesDescription": "DX CHEST", - "seriesInstanceUid": "1.2.840.113619.2.67.2158294438.15745010109084325.10003", - "seriesBodyPart": "CHEST", - "seriesNumber": "28858", - "seriesDate": "20010109", - "seriesTime": "084325.000000", - "seriesModality": "DX", - "instances": [ - { - "columns": 2006, - "rows": 2022, - "instanceNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 14, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 13, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.67.2158294438.16324010109084338.243", - "url": "dicomweb://s3.amazonaws.com/lury/DXStudy/1.2.840.113619.2.67.2158294438.16324010109084338.243.dcm" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/MGStudy.json b/StandaloneViewer/StandaloneViewer/private/testData/MGStudy.json deleted file mode 100644 index 3488957e3..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/MGStudy.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "transactionId": "MGStudy", - "studies": [ - { - "studyInstanceUid": "1.2.840.113619.2.66.2158408118.16050010109105933.20000", - "studyDescription": "MAMMOGRAM", - "studyDate": "20010109", - "studyTime": "105933.000000", - "patientName": "MS^MG", - "patientId": "1346269", - "seriesList": [ - { - "seriesDescription": "BILATERAL", - "seriesInstanceUid": "1.2.840.113619.2.66.2158408118.16050010109105933.10001", - "seriesBodyPart": "BREAST", - "seriesNumber": "699", - "seriesDate": "20010109", - "seriesTime": "105933.000000", - "seriesModality": "MG", - "instances": [ - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "2", - "photometricInterpretation": "MONOCHROME1", - "bitAllocated": 16, - "bitsStored": 14, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 13, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.16050010109110432.3", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.16050010109110432.3.dcm" - }, - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "3", - "photometricInterpretation": "MONOCHROME1", - "bitAllocated": 16, - "bitsStored": 14, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 13, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.16050010109110513.5", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.16050010109110513.5.dcm" - }, - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "4", - "photometricInterpretation": "MONOCHROME1", - "bitAllocated": 16, - "bitsStored": 14, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 13, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.16050010109110601.7", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.16050010109110601.7.dcm" - }, - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "1", - "photometricInterpretation": "MONOCHROME1", - "bitAllocated": 16, - "bitsStored": 14, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 13, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.16050010109110250.1", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.16050010109110250.1.dcm" - } - ] - }, - { - "seriesDescription": "BILATERAL", - "seriesInstanceUid": "1.2.840.113619.2.66.2158408118.16050010109110253.10003", - "seriesBodyPart": "BREAST", - "seriesNumber": "700", - "seriesDate": "20010109", - "seriesTime": "110253.000000", - "seriesModality": "MG", - "instances": [ - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.2683010109110300.85", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.2683010109110300.85.dcm" - }, - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.2683010109110441.87", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.2683010109110441.87.dcm" - }, - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "4", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.2683010109110610.91", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.2683010109110610.91.dcm" - }, - { - "columns": 1914, - "rows": 2294, - "instanceNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "0", - "imageType": "ORIGINAL\\PRIMARY\\", - "sopInstanceUid": "1.2.840.113619.2.66.2158408118.2683010109110523.89", - "url": "dicomweb://s3.amazonaws.com/lury/MGStudy/1.2.840.113619.2.66.2158408118.2683010109110523.89.dcm" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/MRStudy.json b/StandaloneViewer/StandaloneViewer/private/testData/MRStudy.json deleted file mode 100644 index 543de94e5..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/MRStudy.json +++ /dev/null @@ -1,2736 +0,0 @@ -{ - "transactionId": "MRStudy", - "studies": [ - { - "studyInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.78", - "studyDescription": "BRAIN SELLA", - "studyDate": "20010108", - "studyTime": "120022", - "patientName": "MISTER^MR", - "patientId": "832040", - "seriesList": [ - { - "seriesDescription": "3-PLANE LOC", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.79", - "seriesNumber": "1", - "seriesDate": "20010108", - "seriesTime": "120022", - "seriesModality": "MR", - "instances": [ - { - "columns": 256, - "rows": 256, - "instanceNumber": "24", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\ -7.500000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.103", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.103.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "25", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\-15.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.104", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.104.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "23", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\0.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.102", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.102.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "22", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\7.500000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.101", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.101.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "26", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\-22.500000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.105", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.105.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "27", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\-30.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.106", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.106.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\-30.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.80", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.80.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\-22.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.81", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.81.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\-15.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.82", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.82.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\ -7.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.83", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.83.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\7.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.85", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.85.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\0.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.84", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.84.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\ 15.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.86", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.86.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\ 22.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.87", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.87.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "30.000000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.89", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.89.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "15.000000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.91", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.91.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "22.500000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.90", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.90.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "13", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "7.500000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.92", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.92.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-120.000000\\ -120.000000\\ 30.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.88", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.88.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "15", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-7.500000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.94", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.94.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "14", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "0.000000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.93", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.93.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "17", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-22.500000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.96", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.96.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "19", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\ 30.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.98", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.98.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "16", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-15.000000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.95", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.95.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "18", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-30.000000\\ -120.000000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.97", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.97.dcm" - }, - { - "columns": 256, - "rows": 256, - "instanceNumber": "20", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.937500\\0.937500", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-120.000000\\ 22.500000\\120.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.99", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.99.dcm" - } - ] - }, - { - "seriesDescription": "SAG T-1", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.121", - "seriesNumber": "2", - "seriesDate": "20010108", - "seriesTime": "120318", - "seriesModality": "MR", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "11.600000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.124", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.124.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "14.600000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.123", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.123.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "17.600000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.122", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.122.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "8.600000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.125", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.125.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "5.600000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.126", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.126.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-6.400000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.130", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.130.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-9.400000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.131", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.131.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "2.600000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.127", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.127.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-0.400000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.128", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.128.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-3.400000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.129", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.129.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-12.400000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.132", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.132.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-15.400000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.133", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.133.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-18.400000\\-92.500000\\ 98.099998", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.134", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.134.dcm" - } - ] - }, - { - "seriesDescription": "COR T-1", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.135", - "seriesNumber": "3", - "seriesDate": "20010108", - "seriesTime": "121105", - "seriesModality": "MR", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 26.299999\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.136", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.136.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 23.000000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.137", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.137.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 16.400000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.139", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.139.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 19.700001\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.138", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.138.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\9.800000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.141", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.141.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\6.500000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.142", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.142.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 13.100000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.140", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.140.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\3.200000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.143", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.143.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -0.100000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.144", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.144.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -3.400000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.145", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.145.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-10.000000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.147", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.147.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-13.300000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.148", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.148.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "15", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-19.900000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.150", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.150.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "17", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-26.500000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.152", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.152.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "14", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-16.600000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.149", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.149.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "19", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-33.099998\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.154", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.154.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "20", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-36.400002\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.155", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.155.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "18", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-29.799999\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.153", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.153.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -6.700000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.146", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.146.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "16", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-23.200001\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.151", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.151.dcm" - } - ] - }, - { - "seriesDescription": "COR FSE T2", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.156", - "seriesNumber": "4", - "seriesDate": "20010108", - "seriesTime": "121759", - "seriesModality": "MR", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 26.299999\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.157", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.157.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 13.100000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.161", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.161.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 23.000000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.158", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.158.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\9.800000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.162", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.162.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -0.100000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.165", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.165.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\6.500000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.163", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.163.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\3.200000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.164", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.164.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 16.400000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.160", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.160.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 19.700001\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.159", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.159.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -3.400000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.166", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.166.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -6.700000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.167", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.167.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-10.000000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.168", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.168.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-13.300000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.169", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.169.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "14", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-16.600000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.170", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.170.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "15", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-19.900000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.171", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.171.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "16", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-23.200001\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.172", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.172.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "17", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-26.500000\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.173", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.173.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "19", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-33.099998\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.175", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.175.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "20", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-36.400002\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.176", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.176.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "18", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-29.799999\\102.400002", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.174", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.174.dcm" - } - ] - }, - { - "seriesDescription": "COR FLAIR", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.177", - "seriesNumber": "5", - "seriesDate": "20010108", - "seriesTime": "122200", - "seriesModality": "MR", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 10.400000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.179", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.179.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ 15.400000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.178", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.178.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\5.400000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.180", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.180.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\0.400000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.181", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.181.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -4.600000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.182", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.182.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\ -9.600000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.183", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.183.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-19.600000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.185", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.185.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-14.600000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.184", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.184.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-24.600000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.186", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.186.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-34.599998\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.188", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.188.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-29.600000\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.187", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.187.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.400002\\-39.599998\\ 98.800003", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.189", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.189.dcm" - } - ] - }, - { - "seriesDescription": "AX FSE T2", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.190", - "seriesNumber": "6", - "seriesDate": "20010108", - "seriesTime": "122515", - "seriesModality": "MR", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\-57.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.191", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.191.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\-42.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.193", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.193.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\-49.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.192", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.192.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\-34.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.194", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.194.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\-19.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.196", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.196.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\-27.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.195", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.195.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\-12.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.197", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.197.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ -4.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.198", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.198.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\3.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.199", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.199.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 10.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.200", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.200.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 18.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.201", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.201.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 25.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.202", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.202.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 33.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.203", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.203.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "15", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 48.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.205", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.205.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "14", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 40.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.204", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.204.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "18", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 70.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.208", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.208.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "16", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 55.500000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.206", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.206.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "17", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000", - "imagePositionPatient": "-100.400002\\-95.599998\\ 63.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.207", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.207.dcm" - } - ] - }, - { - "seriesDescription": "COR T-1 POST GAD", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.209", - "seriesNumber": "7", - "seriesDate": "20010108", - "seriesTime": "123259", - "seriesModality": "MR", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\6.500000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.210", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.210.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\ -0.100000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.212", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.212.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\3.200000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.211", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.211.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\ -6.700000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.214", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.214.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\ -3.400000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.213", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.213.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-10.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.215", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.215.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-13.300000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.216", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.216.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-19.900000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.218", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.218.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-16.600000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.217", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.217.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-23.200001\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.219", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.219.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-29.799999\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.221", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.221.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-26.500000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.220", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.220.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "14", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-36.400002\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.223", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.223.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-33.099998\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.222", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.222.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "15", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "1.000000\\0.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-100.000000\\-39.700001\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.224", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.224.dcm" - } - ] - }, - { - "seriesDescription": "SAG T-1 POST GAD", - "seriesInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.225", - "seriesNumber": "8", - "seriesDate": "20010108", - "seriesTime": "123814", - "seriesModality": "MR", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "17.600000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.227", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.227.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "20.600000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.226", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.226.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "14.600000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.228", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.228.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "11.600000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.229", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.229.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-0.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.233", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.233.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "8.600000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.230", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.230.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "2.600000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.232", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.232.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-3.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.234", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.234.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-6.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.235", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.235.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-12.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.237", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.237.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-9.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.236", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.236.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-15.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.238", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.238.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "14", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-18.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.239", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.239.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "15", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "-21.400000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.240", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.240.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "0", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "0.390625\\0.390625", - "highBit": 15, - "imageOrientationPatient": "0.000000\\1.000000\\0.000000\\0.000000\\0.000000\\ -1.000000", - "imagePositionPatient": "5.600000\\-93.000000\\100.000000", - "frameOfReferenceUID": "1.2.840.113619.2.5.1762583153.223134.978956938.470", - "imageType": "ORIGINAL\\PRIMARY\\OTHER", - "sopInstanceUid": "1.2.840.113619.2.5.1762583153.215519.978957063.231", - "url": "dicomweb://s3.amazonaws.com/lury/MRStudy/1.2.840.113619.2.5.1762583153.215519.978957063.231.dcm" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/PTCTStudy.json b/StandaloneViewer/StandaloneViewer/private/testData/PTCTStudy.json deleted file mode 100644 index 11bca2c08..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/PTCTStudy.json +++ /dev/null @@ -1,5508 +0,0 @@ -{ - "transactionId": "PTCTStudy", - "studies": [ - { - "studyInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.1", - "studyDescription": "Neck^HeadNeckPETCT", - "studyDate": "20100510", - "studyTime": "133352.906000", - "patientName": "Patient^Anonymous", - "patientBirthDate": "19560324", - "patientId": "12345678", - "patientSex": "M", - "seriesList": [ - { - "seriesDescription": "CT HeadNeck 5.0 H30s", - "seriesInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.2", - "seriesBodyPart": "HEAD", - "seriesNumber": "2", - "seriesDate": "20100510", - "seriesTime": "133445.765000", - "seriesModality": "CT", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "6", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-615.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.11.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "7", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-612.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.12.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "5", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-618.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.10.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "2", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-627.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.3.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "3", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-624.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.7.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-630.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.8.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "4", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-621.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032220.9.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "19", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-576.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.12.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "8", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-609.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.1.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "21", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-570.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.14.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "17", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-582.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.10.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "22", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-567.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.15.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "23", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-564.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.16.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "24", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-561.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.17.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "18", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-579.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.11.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "26", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-555.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.19", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.19.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "25", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-558.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.18", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.18.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "9", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-606.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.2.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "20", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-573.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.13.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "11", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-600.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.4.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "10", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-603.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.3.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "15", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-588.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.7.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "12", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-597.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.5.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "14", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-591.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.8.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "16", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-585.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.9.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "36", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-525.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.10.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "37", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-522.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.11.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "38", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-519.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.12.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "39", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-516.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.13.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "13", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-594.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032221.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032221.6.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "40", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-513.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.14.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "27", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-552.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.1.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "42", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-507.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.16.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "41", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-510.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.15.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "28", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-549.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.2.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "29", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-546.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.3.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "32", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-537.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.6.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "30", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-543.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.4.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "31", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-540.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.5.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "33", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-534.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.7.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "35", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-528.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.9.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "34", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-531.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032222.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032222.8.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "53", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-474.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.11.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "52", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-477.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.10.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "56", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-465.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.14.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "55", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-468.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.13.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "58", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-459.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.16.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "57", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-462.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.15.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "59", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-456.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.17.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "43", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-504.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.1.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "54", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-471.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.12.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "60", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-453.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.18", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.18.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "61", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-450.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.19", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.19.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "44", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-501.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.2.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "45", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-498.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.3.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "62", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-447.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.20", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.20.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "47", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-492.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.5.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "64", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-441.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.22", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.22.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "46", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-495.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.4.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "63", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-444.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.21", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.21.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "49", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-486.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.7.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "51", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-480.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.9.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "65", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-438.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.1.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "48", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-489.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.6.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "74", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-411.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.10.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "75", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-408.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.11.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "76", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-405.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.12.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "77", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-402.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.13.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "78", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-399.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.14.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "79", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-396.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.15.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "80", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-393.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.16.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "50", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-483.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032223.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032223.8.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "66", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-435.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.2.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "68", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-429.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.4.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "81", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-390.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.17.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "67", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-432.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.3.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "70", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-423.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.6.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "69", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-426.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.5.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "82", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-387.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.1.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "71", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-420.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.7.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "73", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-414.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.9.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "72", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-417.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032224.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032224.8.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "92", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-357.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.10.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "91", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-360.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.11.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "94", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-351.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.13.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "93", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-354.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.12.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "83", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-384.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.2.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "84", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-381.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.3.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "85", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-378.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.4.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "87", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-372.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.6.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "86", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-375.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.5.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "90", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-363.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.9.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "88", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-369.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.7.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "89", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 12, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "pixelSpacing": "0.9765625\\0.9765625", - "highBit": 11, - "rescaleSlope": "1", - "rescaleIntercept": "-1024", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-249.51172\\-460.51172\\-366.5", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032220.6", - "imageType": "ORIGINAL\\PRIMARY\\AXIAL\\CT_SOM5 SPI", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.8.dcm" - } - ] - }, - { - "seriesDescription": "PET WB-uncorrected", - "seriesInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.14", - "seriesNumber": "605", - "seriesDate": "20100510", - "seriesTime": "133645.250000", - "seriesModality": "PT", - "instances": [ - { - "columns": 128, - "rows": 128, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-351.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.15.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "3", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-358.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.18", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.18.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "4", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-361.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.19", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.19.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "2", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-354.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.17.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "8", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-375.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.23", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.23.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "6", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-368.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.21", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.21.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "9", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-378.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.24", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.24.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "7", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-371.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.22", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.22.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "5", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-364.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.20", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032225.20.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "21", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-418.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.12.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "20", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-415.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.11.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "22", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-422.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.13.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "10", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-381.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.1.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "23", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-425.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.14.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "24", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-429.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.15.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "25", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-432.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.16.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "26", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-435.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.17.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "27", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-439.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.18", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.18.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "28", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-442.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.19", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.19.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "11", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-385.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.2.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "19", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-412.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.10.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "30", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-449.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.21", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.21.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "29", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-445.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.20", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.20.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "33", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-459.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.24", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.24.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "32", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-456.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.22", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.22.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "31", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-452.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.23", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.23.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "34", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-462.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.25", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.25.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "35", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-466.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.26", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.26.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "36", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-469.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.27", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.27.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "37", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-472.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.28", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.28.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "12", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-388.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.3.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "38", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-476.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.29", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.29.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "39", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-479.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.30", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.30.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "40", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-483.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.31", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.31.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "41", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-486.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.32", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.32.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "42", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-489.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.33", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.33.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "43", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-493.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.34", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.34.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "45", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-499.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.36", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.36.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "44", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-496.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.35", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.35.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "46", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-503.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.37", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.37.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "47", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-506.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.38", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.38.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "48", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-510.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.39", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.39.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "49", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-513.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.40", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.40.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "13", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-391.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.4.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "52", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-523.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.43", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.43.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "51", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-520.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.42", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.42.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "56", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-537.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.47", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.47.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "54", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-530.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.45", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.45.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "55", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-533.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.46", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.46.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "58", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-543.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.49", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.49.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "53", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-526.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.44", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.44.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "50", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-516.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.41", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.41.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "57", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-540.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.48", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.48.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "14", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-395.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.5.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "60", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-550.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.51", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.51.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "59", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-547.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.50", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.50.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "61", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-553.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.52", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.52.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "62", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-557.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.53", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.53.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "63", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-560.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.54", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.54.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "64", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-564.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.55", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.55.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "15", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-398.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.6.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "17", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-405.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.8.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "16", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-402.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.7.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "74", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-597.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.10.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "18", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-408.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032226.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032226.9.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "75", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-601.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.11.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "76", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-604.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.12.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "65", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-567.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.1.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "78", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-611.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.14.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "79", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-614.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.15.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "77", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-607.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.13.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "81", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-621.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.17.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "80", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-618.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.16.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "82", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-624.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.18", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.18.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "66", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-570.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.2.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "83", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-628.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.19", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.19.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "67", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-574.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.3.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "69", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-580.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.5.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "71", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-587.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.7.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "72", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-591.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.8.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "70", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-584.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.6.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "73", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-594.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.9.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "68", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "0.2039322", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-577.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032225.16", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.4.dcm" - } - ] - }, - { - "seriesDescription": "PET WB", - "seriesInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.20", - "seriesNumber": "606", - "seriesDate": "20100510", - "seriesTime": "133645.250000", - "seriesModality": "PT", - "instances": [ - { - "columns": 128, - "rows": 128, - "instanceNumber": "2", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-354.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.23", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.23.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-351.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.21", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.21.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "3", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-358.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.24", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.24.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "5", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-364.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.26", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.26.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "4", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-361.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.25", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.25.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "6", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-368.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.27", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.27.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "7", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-371.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.28", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.28.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "8", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-375.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.29", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.29.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "10", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-381.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.31", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.31.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "9", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-378.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.30", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.30.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "13", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-391.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.34", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.34.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "12", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-388.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.33", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.33.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "17", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-405.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.38", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.38.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "14", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-395.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.35", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.35.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "16", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-402.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.37", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.37.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "15", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-398.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.36", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.36.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "18", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-408.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.39", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.39.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "11", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-385.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.32", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.32.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "19", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-412.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.40", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.40.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "20", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-415.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.41", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.41.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "21", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-418.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.42", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.42.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "23", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-425.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.44", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.44.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "22", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-422.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.43", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032227.43.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "24", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-429.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.1.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "33", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-459.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.10.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "34", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-462.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.12.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "35", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-466.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.11.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "36", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-469.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.13.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "37", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-472.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.14.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "38", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-476.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.15.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "40", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-483.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.17.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "39", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-479.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.16.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "44", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-496.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.21", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.21.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "41", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-486.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.18", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.18.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "43", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-493.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.20", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.20.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "25", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-432.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.2.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "45", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-499.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.22", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.22.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "46", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-503.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.23", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.23.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "47", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-506.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.24", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.24.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "48", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-510.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.25", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.25.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "49", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-513.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.26", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.26.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "42", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-489.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.19", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.19.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "51", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-520.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.28", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.28.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "50", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-516.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.27", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.27.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "52", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-523.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.29", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.29.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "26", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-435.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.3.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "53", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-526.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.30", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.30.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "56", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-537.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.33", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.33.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "54", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-530.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.31", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.31.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "57", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-540.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.34", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.34.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "59", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-547.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.36", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.36.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "58", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-543.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.35", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.35.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "60", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-550.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.37", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.37.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "28", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-442.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.5.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "27", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-439.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.4.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "29", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-445.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.6.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "55", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-533.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.32", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.32.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "30", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-449.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.7.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "31", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-452.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.8.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "32", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-456.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032228.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032228.9.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "70", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-584.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.10", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.10.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "72", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-591.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.12", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.12.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "61", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-553.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.1", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.1.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "71", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-587.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.11", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.11.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "73", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-594.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.13", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.13.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "75", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-601.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.15", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.15.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "74", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-597.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.14", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.14.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "76", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-604.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.16", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.16.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "78", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-611.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.18", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.18.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "79", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-614.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.19", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.19.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "77", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-607.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.17", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.17.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "62", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-557.33", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.2", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.2.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "80", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-618.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.20", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.20.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "82", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-624.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.22", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.22.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "81", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-621.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.21", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.21.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "63", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-560.705", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.3", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.3.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "83", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-628.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.23", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.23.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "66", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-570.83", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.6", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.6.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "64", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-564.08", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.4", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.4.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "65", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-567.455", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.5", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.5.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "68", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-577.58", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.8", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.8.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "69", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-580.955", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.9", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.9.dcm" - }, - { - "columns": 128, - "rows": 128, - "instanceNumber": "67", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 16, - "bitsStored": 16, - "pixelRepresentation": 1, - "samplesPerPixel": 1, - "pixelSpacing": "2.6533637\\2.6533637", - "highBit": 15, - "rescaleSlope": "1.0643264", - "rescaleIntercept": "0", - "imageOrientationPatient": "1\\0\\0\\0\\1\\0", - "imagePositionPatient": "-170.31829\\-379.29324\\-574.205", - "frameOfReferenceUID": "1.3.6.1.4.1.25403.52237031786.3872.20100510032227.22", - "imageType": "ORIGINAL\\PRIMARY", - "sopInstanceUid": "1.3.6.1.4.1.25403.52237031786.3872.20100510032229.7", - "url": "dicomweb://s3.amazonaws.com/lury/PTCTStudy/1.3.6.1.4.1.25403.52237031786.3872.20100510032229.7.dcm" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/RFStudy.json b/StandaloneViewer/StandaloneViewer/private/testData/RFStudy.json deleted file mode 100644 index 212430a5e..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/RFStudy.json +++ /dev/null @@ -1,771 +0,0 @@ -{ - "transactionId": "RFStudy", - "studies": [ - { - "studyInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909203006", - "studyDescription": "ESOPH", - "studyDate": "20010109", - "studyTime": "093223", - "patientName": "MISTER^RF", - "patientId": "5702887", - "seriesList": [ - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322343", - "seriesNumber": "1", - "seriesDate": "20010109", - "seriesTime": "093223", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "4", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322347", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322347.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "8", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322451", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322451.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "5", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322348", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322348.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "10", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322453", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322453.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "11", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322454", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322454.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "6", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322349", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322349.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "7", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322350", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322350.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "13", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322456", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322456.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "12", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322455", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322455.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "9", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909322452", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909322452.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324560", - "seriesNumber": "2", - "seriesDate": "20010109", - "seriesTime": "093245", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324663", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324663.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324562", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324562.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "4", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324664", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324664.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "6", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324666", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324666.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "7", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324667", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324667.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "8", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324668", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324668.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "9", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324669", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324669.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "5", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324665", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324665.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "10", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324670", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324670.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909325572", - "seriesNumber": "3", - "seriesDate": "20010109", - "seriesTime": "093247", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909324771", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909324771.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909334975", - "seriesNumber": "4", - "seriesDate": "20010109", - "seriesTime": "093350", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909335076", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909335076.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909340484", - "seriesNumber": "7", - "seriesDate": "20010109", - "seriesTime": "093405", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909340585", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909340585.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909341890", - "seriesNumber": "9", - "seriesDate": "20010109", - "seriesTime": "093419", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909341991", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909341991.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909342393", - "seriesNumber": "10", - "seriesDate": "20010109", - "seriesTime": "093424", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909342494", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909342494.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909341087", - "seriesNumber": "8", - "seriesDate": "20010109", - "seriesTime": "093411", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909341188", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909341188.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909335781", - "seriesNumber": "6", - "seriesDate": "20010109", - "seriesTime": "093358", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909335882", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909335882.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909342896", - "seriesNumber": "11", - "seriesDate": "20010109", - "seriesTime": "093429", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909342997", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909342997.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360500", - "seriesNumber": "12", - "seriesDate": "20010109", - "seriesTime": "093605", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360501", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360501.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "3", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360503", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360503.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "2", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360502", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360502.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "4", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360504", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360504.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "5", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360605", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360605.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "6", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360606", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360606.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "8", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360708", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360708.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "7", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360607", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360607.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "11", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360711", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360711.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "12", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360812", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360812.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "10", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360710", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360710.dcm" - }, - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "9", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360709", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360709.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909361217", - "seriesNumber": "14", - "seriesDate": "20010109", - "seriesTime": "093613", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909361318", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909361318.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360814", - "seriesNumber": "13", - "seriesDate": "20010109", - "seriesTime": "093609", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909360915", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909360915.dcm" - } - ] - }, - { - "seriesInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909364723", - "seriesNumber": "15", - "seriesDate": "20010109", - "seriesTime": "093648", - "seriesModality": "RF", - "instances": [ - { - "columns": 512, - "rows": 512, - "instanceNumber": "1", - "acquisitionNumber": "1", - "photometricInterpretation": "MONOCHROME2", - "bitAllocated": 8, - "bitsStored": 8, - "pixelRepresentation": 0, - "samplesPerPixel": 1, - "highBit": 7, - "imageType": "ORIGINAL\\PRIMARY\\SINGLE PLANE", - "sopInstanceUid": "1.3.46.670589.6.1.0.98511171.2001010909364824", - "url": "dicomweb://s3.amazonaws.com/lury/RFStudy/1.3.46.670589.6.1.0.98511171.2001010909364824.dcm" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/sample.json b/StandaloneViewer/StandaloneViewer/private/testData/sample.json deleted file mode 100644 index 1603c172d..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/sample.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "transactionId": "testId", - "studies": [{ - "studyInstanceUid": "23.23.21.3.32", - "patientName": "Patient Name", - "seriesList": [{ - "seriesInstanceUid": "1.23.2.32.1.2.1.3.2", - "seriesDescription": "Wikipedia Samples", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.8", - "rows": 1, - "url": "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg" - }, { - "sopInstanceUid": "1.2.3.2.32.18.9", - "rows": 1, - "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Sample_Floorplan.jpg/800px-Sample_Floorplan.jpg" - } - ] - }, { - "seriesInstanceUid": "1.33.2.32.1.2.1.3.2", - "seriesDescription": "JPS-sample", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.10", - "rows": 1, - "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/JPS-sample.jpg/800px-JPS-sample.jpg" - } - ] - }] - }] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/private/testData/testDICOMs.json b/StandaloneViewer/StandaloneViewer/private/testData/testDICOMs.json deleted file mode 100644 index c6c4b6940..000000000 --- a/StandaloneViewer/StandaloneViewer/private/testData/testDICOMs.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "transactionId": "testDICOMs", - "studies": [{ - "studyInstanceUid": "23.23.21.3.32", - "patientName": "Patient Name", - "seriesList": [{ - "seriesInstanceUid": "1.23.2.32.1.2.1.3.2", - "seriesDescription": "T-1", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.8", - "rows": 1, - "url": "dicomweb://rawgit.com/chafey/byozfwv/master/sampleData/1.2.840.113619.2.5.1762583153.215519.978957063.80.dcm" - }, { - "sopInstanceUid": "1.2.3.2.32.18.9", - "rows": 1, - "url": "dicomweb://rawgit.com/chafey/byozfwv/master/sampleData/1.2.840.113619.2.5.1762583153.215519.978957063.81.dcm" - } - ] - }, { - "seriesInstanceUid": "1.33.2.32.1.2.1.3.2", - "seriesDescription": "COR T-1", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.10", - "rows": 1, - "url": "dicomweb://rawgit.com/chafey/byozfwv/master/sampleData/1.2.840.113619.2.5.1762583153.215519.978957063.136.dcm" - } - ] - }] - }] -} \ No newline at end of file diff --git a/StandaloneViewer/StandaloneViewer/public/DICOMCloud_public.json b/StandaloneViewer/StandaloneViewer/public/DICOMCloud_public.json deleted file mode 100644 index 273ddc906..000000000 --- a/StandaloneViewer/StandaloneViewer/public/DICOMCloud_public.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "servers": { - "dicomWeb": [ - { - "name": "DICOMCloud Public Server", - "wadoUriRoot": "https://dicomcloud.azurewebsites.net/WadoUri", - "qidoRoot": "https://dicomcloud.azurewebsites.net/qidors", - "wadoRoot": "https://dicomcloud.azurewebsites.net/wadors", - "qidoSupportsIncludeField": false, - "imageRendering": "wadouri", - "thumbnailRendering": "wadouri", - "requestOptions": { - "requestFromBrowser": true, - "logRequests": true, - "logResponses": false, - "logTiming": true - } - }] - }, - "defaultServiceType": "dicomWeb" -} diff --git a/StandaloneViewer/StandaloneViewer/routes.js b/StandaloneViewer/StandaloneViewer/routes.js deleted file mode 100644 index e47bd1d7d..000000000 --- a/StandaloneViewer/StandaloneViewer/routes.js +++ /dev/null @@ -1,150 +0,0 @@ -import { Meteor } from 'meteor/meteor'; -import { Router } from 'meteor/clinical:router'; -import { OHIF } from 'meteor/ohif:core'; - -if (Meteor.isClient) { - // Disconnect from the Meteor Server since we don't need it - OHIF.log.info('Disconnecting from the Meteor server'); - Meteor.disconnect(); - - Router.configure({ - loadingTemplate: 'loading' - }); - - Router.onBeforeAction('loading'); - - Router.route('/:id?', { - onRun: function() { - console.warn('onRun'); - // Retrieve the query from the URL the user has entered - const query = this.params.query; - const id = this.params.id; - - if (!id && !query.url) { - console.log('No URL was specified. Use ?url=${yourURL}'); - return; - } - - const next = this.next; - const idUrl = `/api/${id}`; - const url = query.url || idUrl; - - // Define a request to the server to retrieve the study data - // as JSON, given a URL that was in the Route - const oReq = new XMLHttpRequest(); - - // Add event listeners for request failure - oReq.addEventListener('error', () => { - OHIF.log.warn('An error occurred while retrieving the JSON data'); - next(); - }); - - // When the JSON has been returned, parse it into a JavaScript Object - // and render the OHIF Viewer with this data - oReq.addEventListener('load', () => { - // Parse the response content - // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText - if (!oReq.responseText) { - OHIF.log.warn('Response was undefined'); - return; - } - - OHIF.log.info(JSON.stringify(oReq.responseText, null, 2)); - this.data = JSON.parse(oReq.responseText); - - if (this.data.servers && query.studyInstanceUids) { - console.warn('Using Server Definition!'); - - const server = this.data.servers.dicomWeb[0]; - server.type = 'dicomWeb'; - - const serverId = OHIF.servers.collections.servers.insert(server); - - OHIF.servers.collections.currentServer.insert({ - serverId - }); - - studyInstanceUids = query.studyInstanceUids.split(';'); - const seriesInstanceUids = []; - - const viewerData = { - studyInstanceUids, - seriesInstanceUids - }; - - OHIF.studies.retrieveStudiesMetadata(studyInstanceUids, seriesInstanceUids).then(studies => { - this.data = { - studies, - viewerData - }; - - next(); - }); - - return; - } - - next(); - }); - - // Open the Request to the server for the JSON data - // In this case we have a server-side route called /api/ - // which responds to GET requests with the study data - OHIF.log.info(`Sending Request to: ${url}`); - oReq.open('GET', url); - oReq.setRequestHeader('Accept', 'application/json') - - // Add token in the request authorization header - // if a token fragment parameter is present - const tokenParam = this.params.hash ? this.params.hash.match(/(?:token)=(.*?)(?:&|$)/) : null; - if (tokenParam) { - OHIF.viewer.authorizationToken = "Bearer " + tokenParam[1]; - oReq.setRequestHeader('Authorization', OHIF.viewer.authorizationToken); - } - - // Fire the request to the server - oReq.send(); - }, - action() { - // Render the Viewer with this data - this.render('standaloneViewer', { - data: () => this.data - }); - } - }); -} - -// This is ONLY for demo purposes. -if (Meteor.isServer) { - // You can test this with: - // curl -v -H "Content-Type: application/json" -X GET 'http://localhost:3000/getData/testId' - // - // Or by going to: - // http://localhost:3000/api/testId - - Router.route('/api/:id', { where: 'server' }).get(function() { - // "this" is the RouteController instance. - // "this.response" is the Connect response object - // "this.request" is the Connect request object - const id = this.params.id; - - // Find the relevant study data from the Collection given the ID - const data = RequestStudies.findOne({ transactionId: id }); - - // Set the response headers to return JSON to any server - this.response.setHeader('Content-Type', 'application/json'); - this.response.setHeader('Access-Control-Allow-Origin', '*'); - this.response.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); - - // Change the response text depending on the available study data - if (!data) { - this.response.write('No Data Found'); - } else { - // Stringify the JavaScript object to JSON for the response - this.response.write(JSON.stringify(data)); - } - - // Finalize the response - this.response.end(); - }); -} diff --git a/StandaloneViewer/StandaloneViewer/server/collections.js b/StandaloneViewer/StandaloneViewer/server/collections.js deleted file mode 100644 index 4e615e9fe..000000000 --- a/StandaloneViewer/StandaloneViewer/server/collections.js +++ /dev/null @@ -1,31 +0,0 @@ -import { Meteor } from 'meteor/meteor'; - -// Create a Collection to store data -RequestStudies = new Meteor.Collection('requestStudies'); - -// Remove all previous data -RequestStudies.remove({}); - -const testDataFiles = [ - 'sample.json', - 'testDICOMs.json', - 'CRStudy.json', - 'CTStudy.json', - 'DXStudy.json', - 'MGStudy.json', - 'MRStudy.json', - 'PTCTStudy.json', - 'RFStudy.json' -]; - -testDataFiles.forEach(file => { - if (file.indexOf('.json') === -1) { - return; - } - - // Read JSON files and save the content in the database - const jsonData = Assets.getText(`testData/${file}`); - const data = JSON.parse(jsonData); - - RequestStudies.insert(data); -}); diff --git a/StandaloneViewer/etc/redirectingSimpleServer.py b/StandaloneViewer/etc/redirectingSimpleServer.py deleted file mode 100644 index 2d83cb42c..000000000 --- a/StandaloneViewer/etc/redirectingSimpleServer.py +++ /dev/null @@ -1,43 +0,0 @@ -import SimpleHTTPServer, SocketServer -import urlparse, os - -PORT = 3000 - -## Note: If you set this parameter, you can try to serve files -# at a subdirectory. You should use -# -u http://localhost:3000/subdirectory -# when building the application, which will set this as your -# ROOT_URL. -#URL_PATH="/subdirectory" -URL_PATH="" - -class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): - def do_GET(self): - - # Strip the subdirectory from the PATH - # e.g. localhost:3000/subdirectory/packages/ohif_polyfill/svg4everybody.min.js - # is interpreted by this script as localhost:3000/packages/ohif_polyfill/svg4everybody.min.js - # so the file is found properly. - self.path = self.path.replace(URL_PATH, "") - - # Parse query data to find out what was requested - parsedParams = urlparse.urlparse(self.path) - - # See if the file requested exists - if os.access('.' + os.sep + parsedParams.path, os.R_OK): - # File exists, serve it up - SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self); - else: - # send index.html - self.send_response(200) - self.send_header('Content-Type', 'text/html') - self.end_headers() - with open('index.html', 'r') as fin: - self.copyfile(fin, self.wfile) - -Handler = MyHandler - -httpd = SocketServer.TCPServer(("", PORT), Handler) - -print "serving at port", PORT -httpd.serve_forever() diff --git a/StandaloneViewer/etc/sampleDICOM.json b/StandaloneViewer/etc/sampleDICOM.json deleted file mode 100644 index 2461c6d2f..000000000 --- a/StandaloneViewer/etc/sampleDICOM.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "transactionId": "testDICOMs", - "studies": [{ - "studyInstanceUid": "23.23.21.3.32", - "patientName": "Patient Name", - "seriesList": [{ - "seriesInstanceUid": "1.23.2.32.1.2.1.3.2", - "seriesDescription": "T-1", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.8", - "columns": 256, - "rows": 256, - "url": "dicomweb://rawgit.com/chafey/byozfwv/master/sampleData/1.2.840.113619.2.5.1762583153.215519.978957063.80.dcm" - }, { - "sopInstanceUid": "1.2.3.2.32.18.9", - "rows": 256, - "columns": 256, - "frameOfReferenceUID": "1.2.3.4.5", - "imagePositionPatient": "-100\\-13\\98", - "imageOrientationPatient": "1\\0\\0\\0\\0\\-1", - "url": "dicomweb://rawgit.com/chafey/byozfwv/master/sampleData/1.2.840.113619.2.5.1762583153.215519.978957063.81.dcm", - "pixelSpacing": "0.78\\0.78" - } - ] - }, { - "seriesInstanceUid": "1.33.2.32.1.2.1.3.2", - "seriesDescription": "COR T-1", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.10", - "rows": 256, - "columns": 256, - "url": "dicomweb://rawgit.com/chafey/byozfwv/master/sampleData/1.2.840.113619.2.5.1762583153.215519.978957063.136.dcm" - } - ] - }] - }] -} \ No newline at end of file diff --git a/StandaloneViewer/etc/sampleJpeg.json b/StandaloneViewer/etc/sampleJpeg.json deleted file mode 100644 index 35f461a35..000000000 --- a/StandaloneViewer/etc/sampleJpeg.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "studies": [{ - "studyInstanceUid": "23.23.21.3.32", - "patientName": "Patient Name", - "seriesList": [{ - "seriesInstanceUid": "1.23.2.32.1.2.1.3.2", - "seriesDescription": "Wikipedia Samples", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.8", - "rows": 1, - "url": "https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg" - }, { - "sopInstanceUid": "1.2.3.2.32.18.9", - "rows": 1, - "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Sample_Floorplan.jpg/800px-Sample_Floorplan.jpg" - } - ] - }, { - "seriesInstanceUid": "1.33.2.32.1.2.1.3.2", - "seriesDescription": "JPS-sample", - "instances": [ - { - "sopInstanceUid": "1.2.3.2.32.18.10", - "rows": 1, - "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/JPS-sample.jpg/800px-JPS-sample.jpg" - } - ] - }] - }] -} \ No newline at end of file diff --git a/conf.json b/conf.json deleted file mode 100644 index 58c525cea..000000000 --- a/conf.json +++ /dev/null @@ -1,37 +0,0 @@ -// Run with jsdoc . -r -c conf.json -d docs -{ - "tags": { - "allowUnknownTags": true, - "dictionaries": ["jsdoc"] - }, - "source": { - "include": ["Packages", "OHIFViewer", "LesionTracker"], - "includePattern": ".+\\.js(doc)?$", - "excludePattern": "(^|\\/|\\\\)_", - "exclude": ["Packages/cornerstone/", "node_modules", "docs", "etc"] - }, - "plugins": ["plugins/markdown"], - "templates": { - "logoFile": "", - "cleverLinks": false, - "monospaceLinks": false, - "dateFormat": "ddd MMM Do YYYY", - "outputSourceFiles": false, - "outputSourcePath": false, - "systemName": "OHIF Meteor Packages", - "footer": "OHIF", - "copyright": "Copyright © 2015 Open Health Imaging Foundation", - "navType": "vertical", - "theme": "flatly", - "linenums": true, - "collapseSymbols": false, - "inverseNav": true, - "highlightTutorialCode": true, - "protocol": "html://", - "methodHeadingReturns": false - }, - "markdown": { - "parser": "gfm", - "hardwrap": true - } -} \ No newline at end of file diff --git a/conf/conf.d/default.conf b/conf/conf.d/default.conf new file mode 100644 index 000000000..c6a436aa1 --- /dev/null +++ b/conf/conf.d/default.conf @@ -0,0 +1,12 @@ +server { + listen 80; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/config/ccc.js b/config/ccc.js new file mode 100644 index 000000000..a8766db8c --- /dev/null +++ b/config/ccc.js @@ -0,0 +1,36 @@ +dicomWebServers = { + servers: { + dicomWeb: [ + { + name: "DCM4CHEE", + wadoUriRoot: + "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/wado", + qidoRoot: + "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/rs", + wadoRoot: + "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/rs", + qidoSupportsIncludeField: true, + imageRendering: "wadors", + thumbnailRendering: "wadors", + requestOptions: { + requestFromBrowser: true + } + } + ] + }, + oidc: [ + { + authServerUrl: "https://cancer.crowds-cure.org/auth/realms/dcm4che", + authRedirectUri: "http://localhost:5000/callback", + clientId: "crowds-cure-cancer", + postLogoutRedirectUri: "http://localhost:5000/logout-redirect.html", + responseType: "id_token token", + scope: "email profile openid", + revokeAccessTokenOnSignout: true, + extraQueryParams: { + kc_idp_hint: "crowds-cure-cancer-auth0-oidc", + client_id: "crowds-cure-cancer" + } + } + ] +} diff --git a/config/dcm4chee-dicomweb-clientonly.json b/config/dcm4chee-dicomweb-clientonly.json new file mode 100644 index 000000000..1ee67a179 --- /dev/null +++ b/config/dcm4chee-dicomweb-clientonly.json @@ -0,0 +1,37 @@ +{ + "public": { + "clientOnly": true, + "ui": { + "studyListFunctionsEnabled": true, + "studyListDateFilterNumDays": 10000 + }, + "servers": { + "dicomWeb": [ + { + "name": "Orthanc", + "wadoUriRoot": "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/wado", + "qidoRoot": "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs", + "wadoRoot": "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs", + "qidoSupportsIncludeField": true, + "imageRendering": "wadors", + "thumbnailRendering": "wadors", + "requestOptions": { + "requestFromBrowser": true, + "logRequests": true, + "logResponses": false, + "logTiming": true, + "auth": "admin:admin" + } + }] + }, + "custom": { + "oidc": [{ + "authServerUrl": "https://cancer.crowds-cure.org/auth/realms/dcm4che", + "authRedirectUri": "/studylist", + "postLogoutRedirectUri": "/", + "clientId": "ohif-viewer" + }] + }, + "userAuthenticationRoutesEnabled": false + } +} diff --git a/config/dcm4cheeDICOMWeb.json b/config/dcm4cheeDICOMWeb.json index 43b8ecb27..70cfdf39c 100644 --- a/config/dcm4cheeDICOMWeb.json +++ b/config/dcm4cheeDICOMWeb.json @@ -50,8 +50,5 @@ "studyListFunctionsEnabled": true, "studyListDateFilterNumDays": 1 } - }, - "proxy": { - "enabled": true } } diff --git a/config/local_dcm4chee.js b/config/local_dcm4chee.js new file mode 100644 index 000000000..b4d887fc3 --- /dev/null +++ b/config/local_dcm4chee.js @@ -0,0 +1,19 @@ +dicomWebServers = { + servers: { + dicomWeb: [ + { + name: "DCM4CHEE", + wadoUriRoot: "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/wado", + qidoRoot: "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs", + wadoRoot: "http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs", + qidoSupportsIncludeField: true, + imageRendering: "wadors", + thumbnailRendering: "wadors", + requestOptions: { + requestFromBrowser: true, + auth: "admin:admin" + } + } + ] + } +} diff --git a/config/local_orthanc.js b/config/local_orthanc.js new file mode 100644 index 000000000..2aacadfd5 --- /dev/null +++ b/config/local_orthanc.js @@ -0,0 +1,21 @@ +dicomWebServers = { + servers: { + dicomWeb: [ + { + name: "Orthanc", + wadoUriRoot: "http://localhost:8899/wado", + qidoRoot: "http://localhost:8899/dicom-web", + wadoRoot: "http://localhost:8899/dicom-web", + qidoSupportsIncludeField: false, + imageRendering: "wadors", + thumbnailRendering: "wadors", + requestOptions: { + auth: "orthanc:orthanc", + logRequests: true, + logResponses: false, + logTiming: true + } + } + ] + } +} diff --git a/config/oidc-demo.json b/config/oidc-demo.json deleted file mode 100644 index 710cdc771..000000000 --- a/config/oidc-demo.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "public": { - "clientOnly": true, - "googleCloud": true, - "ui": { - "studyListFunctionsEnabled": true, - "studyListDateFilterNumDays": false - }, - "servers": { - "dicomWeb": [{ - "name": "dcm4chee-oidc-Client", - "qidoSupportsIncludeField": false, - "imageRendering": "wadors", - "thumbnailRendering": "wadors", - "metadataSource": "wado", - "requestOptions": { - "requestFromBrowser": true, - "logRequests": true, - "logResponses": false, - "logTiming": true - } - }, - { - "name": "demo-dcm4chee", - "wadoUriRoot": "https://dcm4che.ohif.club/dcm4chee-arc/aets/DCM4CHEE/wado", - "qidoRoot": "https://dcm4che.ohif.club/dcm4chee-arc/aets/DCM4CHEE/rs", - "wadoRoot": "https://dcm4che.ohif.club/dcm4chee-arc/aets/DCM4CHEE/rs", - "qidoSupportsIncludeField": false, - "imageRendering": "wadouri", - "thumbnailRendering": "wadors", - "requestOptions": { - "auth": "cloud:healthcare", - "requestFromBrowser": true, - "logRequests": true, - "logResponses": false, - "logTiming": true - } - }] - }, - "custom": { - "oidc": [{ - "authServerUrl": "https://accounts.google.com", - "authRedirectUri": "/_oauth/google", - "postLogoutRedirectUri": "/", - "clientId": "570420945968-pmtd0sjm7mmf3i5m7ld09aos1op3qva1.apps.googleusercontent.com", - "scope": "email profile openid https://www.googleapis.com/auth/cloud-platform.read-only https://www.googleapis.com/auth/cloud-healthcare", - "revokeUrl": "https://accounts.google.com/o/oauth2/revoke?token=" - }] - }, - "userAuthenticationRoutesEnabled": true, - "demoMode": true - } -} \ No newline at end of file diff --git a/config/oidc-dev.json b/config/oidc-dev.json deleted file mode 100644 index 710cdc771..000000000 --- a/config/oidc-dev.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "public": { - "clientOnly": true, - "googleCloud": true, - "ui": { - "studyListFunctionsEnabled": true, - "studyListDateFilterNumDays": false - }, - "servers": { - "dicomWeb": [{ - "name": "dcm4chee-oidc-Client", - "qidoSupportsIncludeField": false, - "imageRendering": "wadors", - "thumbnailRendering": "wadors", - "metadataSource": "wado", - "requestOptions": { - "requestFromBrowser": true, - "logRequests": true, - "logResponses": false, - "logTiming": true - } - }, - { - "name": "demo-dcm4chee", - "wadoUriRoot": "https://dcm4che.ohif.club/dcm4chee-arc/aets/DCM4CHEE/wado", - "qidoRoot": "https://dcm4che.ohif.club/dcm4chee-arc/aets/DCM4CHEE/rs", - "wadoRoot": "https://dcm4che.ohif.club/dcm4chee-arc/aets/DCM4CHEE/rs", - "qidoSupportsIncludeField": false, - "imageRendering": "wadouri", - "thumbnailRendering": "wadors", - "requestOptions": { - "auth": "cloud:healthcare", - "requestFromBrowser": true, - "logRequests": true, - "logResponses": false, - "logTiming": true - } - }] - }, - "custom": { - "oidc": [{ - "authServerUrl": "https://accounts.google.com", - "authRedirectUri": "/_oauth/google", - "postLogoutRedirectUri": "/", - "clientId": "570420945968-pmtd0sjm7mmf3i5m7ld09aos1op3qva1.apps.googleusercontent.com", - "scope": "email profile openid https://www.googleapis.com/auth/cloud-platform.read-only https://www.googleapis.com/auth/cloud-healthcare", - "revokeUrl": "https://accounts.google.com/o/oauth2/revoke?token=" - }] - }, - "userAuthenticationRoutesEnabled": true, - "demoMode": true - } -} \ No newline at end of file diff --git a/config/oidc-googleCloud.json b/config/oidc-googleCloud.json deleted file mode 100644 index d8e2acc84..000000000 --- a/config/oidc-googleCloud.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "public": { - "clientOnly": true, - "googleCloud": true, - "ui": { - "studyListFunctionsEnabled": true, - "studyListDateFilterNumDays": false - }, - "servers": { - "dicomWeb": [] - }, - "custom": { - "oidc": [{ - "authServerUrl": "https://accounts.google.com", - "authRedirectUri": "/_oauth/google", - "postLogoutRedirectUri": "/", - "clientId": "YOURCLIENTID.apps.googleusercontent.com", - "scope": "email profile openid https://www.googleapis.com/auth/cloud-platform.read-only https://www.googleapis.com/auth/cloud-healthcare", - "revokeUrl": "https://accounts.google.com/o/oauth2/revoke?token=" - }] - }, - "userAuthenticationRoutesEnabled": false, - "demoMode": false - } -} diff --git a/config/oidc.json b/config/oidc.json deleted file mode 100644 index cf0c42f5e..000000000 --- a/config/oidc.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "public": { - "clientOnly": true, - "googleCloud": true, - "ui": { - "studyListFunctionsEnabled": true, - "studyListDateFilterNumDays": false - }, - "servers": { - "dicomWeb": [{ - "name": "dcm4chee-oidc-Client", - "qidoSupportsIncludeField": false, - "imageRendering": "wadors", - "thumbnailRendering": "wadors", - "metadataSource": "wado", - "requestOptions": { - "requestFromBrowser": true, - "logRequests": true, - "logResponses": false, - "logTiming": true - } - }] - }, - "custom": { - "oidc": [{ - "authServerUrl": "https://accounts.google.com", - "authRedirectUri": "/_oauth/google", - "postLogoutRedirectUri": "/", - "scope": "email profile openid https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/cloud-healthcare", - "revokeUrl": "https://accounts.google.com/o/oauth2/revoke?token=" - }] - }, - "userAuthenticationRoutesEnabled": true, - "demoMode": false - } -} diff --git a/config/orthancDIMSE.json b/config/orthancDIMSE.json index cd4acb29d..7f77cbcd6 100644 --- a/config/orthancDIMSE.json +++ b/config/orthancDIMSE.json @@ -20,7 +20,7 @@ { "host": "0.0.0.0", "port": 11112, - "aeTitle": "ORTHANC", + "aeTitle": "OHIFDCM", "default": true, "server": true } @@ -37,7 +37,7 @@ "displaySetNavigationLoopOverSeries": false, "displaySetNavigationMultipleViewports": true, "autoPositionMeasurementsTextCallOuts": "TRLB", - "studyListDateFilterNumDays": 1 + "studyListDateFilterNumDays": 10000 } } } diff --git a/config/publicOrthancDICOMWeb.json b/config/publicOrthancDICOMWeb.json index 50faf31ab..c187fdad1 100644 --- a/config/publicOrthancDICOMWeb.json +++ b/config/publicOrthancDICOMWeb.json @@ -1,7 +1,26 @@ { + "servers": { + "dicomWeb": [ + { + "name": "Orthanc", + "wadoUriRoot": "http://dicomweb.ohif.org/wado", + "qidoRoot": "http://dicomweb.ohif.org/dicom-web", + "wadoRoot": "http://dicomweb.ohif.org/dicom-web", + "qidoSupportsIncludeField": false, + "imageRendering": "wadouri", + "thumbnailRendering": "wadouri", + "requestOptions": { + "auth": "orthanc:orthanc", + "logRequests": true, + "logResponses": false, + "logTiming": true + } + } + ] + }, + "defaultServiceType": "dicomWeb", "dropCollections": true, "public": { - "clientOnly": true, "verifyEmail": false, "ui": { "studyListFunctionsEnabled": true, @@ -10,25 +29,6 @@ "displaySetNavigationMultipleViewports": true, "autoPositionMeasurementsTextCallOuts": "TRLB", "studyListDateFilterNumDays": 1 - }, - "servers": { - "dicomWeb": [ - { - "name": "Orthanc", - "wadoUriRoot": "https://server.dcmjs.org//dcm4chee-arc/aets/DCM4CHEE/wado", - "qidoRoot": "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", - "wadoRoot": "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", - "qidoSupportsIncludeField": true, - "imageRendering": "wadors", - "thumbnailRendering": "wadors", - "requestOptions": { - "requestFromBrowser": true, - "logRequests": true, - "logResponses": false, - "logTiming": true - } - } - ] } }, "proxy": { diff --git a/config/public_dicomweb.js b/config/public_dicomweb.js new file mode 100644 index 000000000..4bde53033 --- /dev/null +++ b/config/public_dicomweb.js @@ -0,0 +1,18 @@ +dicomWebServers = { + servers: { + dicomWeb: [ + { + name: "DCM4CHEE", + wadoUriRoot: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado", + qidoRoot: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", + wadoRoot: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs", + qidoSupportsIncludeField: true, + imageRendering: "wadors", + thumbnailRendering: "wadors", + requestOptions: { + requestFromBrowser: true + } + } + ] + } +}; diff --git a/development.Dockerfile b/development.Dockerfile deleted file mode 100644 index 95987fe87..000000000 --- a/development.Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# First stage of multi-stage build -# Installs Meteor and builds node.js version -# This stage is named 'builder' -# The data for this intermediary image is not included -# in the final image. -FROM node:8.10.0-slim as builder - -# Fix build now that jessie-updates has been archived -RUN sed -i '/jessie-updates/d' /etc/apt/sources.list -RUN apt-get update && apt-get install -y \ - curl \ - g++ \ - git \ - python \ - build-essential - -RUN curl https://install.meteor.com/ | sh - -# Create a non-root user -RUN useradd -ms /bin/bash user -USER user -RUN mkdir /home/user/Viewers -COPY OHIFViewer/package.json /home/user/Viewers/OHIFViewer/ -ADD --chown=user:user . /home/user/Viewers - -WORKDIR /home/user/Viewers/OHIFViewer - -ENV METEOR_PACKAGE_DIRS=../Packages -RUN meteor npm install -COPY dockersupport/settings.json . - -EXPOSE 3000 - -CMD ["meteor", "--settings", "settings.json"] diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 2bd375676..000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: '3.6' -services: - mongo: - image: "mongo:latest" - ports: - - "27017:27017" - - viewer: - image: ohif/viewer:latest - ports: - - "3000:3000" - links: - - mongo - environment: - - MONGO_URL=mongodb://mongo:27017/ohif - extra_hosts: - - "pacsIP:192.168.0.2" - volumes: - - ./dockersupport/app.json:/app/app.json \ No newline at end of file diff --git a/docker/Nginx-Dcm4che/docker-compose-dcm4che.env b/docker/Nginx-Dcm4che/docker-compose-dcm4che.env new file mode 100644 index 000000000..54961c376 --- /dev/null +++ b/docker/Nginx-Dcm4che/docker-compose-dcm4che.env @@ -0,0 +1,4 @@ +STORAGE_DIR=/storage/fs1 +POSTGRES_DB=pacsdb +POSTGRES_USER=pacs +POSTGRES_PASSWORD=pacs diff --git a/docker/Nginx-Dcm4che/docker-compose-dcm4che.yml b/docker/Nginx-Dcm4che/docker-compose-dcm4che.yml new file mode 100644 index 000000000..5a34ff182 --- /dev/null +++ b/docker/Nginx-Dcm4che/docker-compose-dcm4che.yml @@ -0,0 +1,77 @@ +version: '3.5' + +services: + ldap: + image: dcm4che/slapd-dcm4chee:2.4.44-15.0 + logging: + driver: json-file + options: + max-size: '10m' + ports: + - '389:389' + env_file: ./dcm4che/docker-compose-dcm4che.env + volumes: + - ./dcm4che/etc/localtime:/etc/localtime:ro + - ./dcm4che/etc/timezone:/etc/timezone:ro + - ./dcm4che/dcm4che-arc/ldap:/var/lib/ldap + - ./dcm4che/dcm4che-arc/slapd.d:/etc/ldap/slapd.d + networks: + - dcm4che_default + db: + image: dcm4che/postgres-dcm4chee:11.1-15 + logging: + driver: json-file + options: + max-size: '10m' + ports: + - '5432:5432' + env_file: ./dcm4che/docker-compose-dcm4che.env + volumes: + - ./dcm4che/etc/localtime:/etc/localtime:ro + - ./dcm4che/etc/timezone:/etc/timezone:ro + - ./dcm4che/dcm4che-arc/db:/var/lib/postgresql/data + networks: + - dcm4che_default + arc: + image: dcm4che/dcm4chee-arc-psql:5.15.0 + logging: + driver: json-file + options: + max-size: '10m' + ports: + - '8080:8080' + - '8443:8443' + - '9990:9990' + - '11112:11112' + - '2575:2575' + env_file: ./dcm4che/docker-compose-dcm4che.env + environment: + WILDFLY_CHOWN: /opt/wildfly/standalone /storage + WILDFLY_WAIT_FOR: ldap:389 db:5432 + depends_on: + - ldap + - db + volumes: + - ./dcm4che/etc/localtime:/etc/localtime:ro + - ./dcm4che/etc/timezone:/etc/timezone:ro + - ./dcm4che/dcm4che-arc/wildfly:/opt/wildfly/standalone + - ./dcm4che/dcm4che-arc/storage:/storage + networks: + - dcm4che_default + viewer: + container_name: ohif-viewer + build: + context: ../ + dockerfile: Dockerfile + ports: + - '80:80' + # depends_on: + # - orthanc + environment: + - NODE_ENV=production + - REACT_APP_CONFIG=config/local_dcm4chee + restart: always + networks: + - dcm4che_default + +networks: dcm4che_default: diff --git a/docker/Nginx-Dcm4che/etc/localtime b/docker/Nginx-Dcm4che/etc/localtime new file mode 100644 index 000000000..e69de29bb diff --git a/docker/Nginx-Dcm4che/etc/timezone b/docker/Nginx-Dcm4che/etc/timezone new file mode 100644 index 000000000..27f725e77 --- /dev/null +++ b/docker/Nginx-Dcm4che/etc/timezone @@ -0,0 +1 @@ +America/New_York \ No newline at end of file diff --git a/docker/Nginx-Dcm4che/nginx-proxy/conf/nginx.conf b/docker/Nginx-Dcm4che/nginx-proxy/conf/nginx.conf new file mode 100644 index 000000000..de38c7f00 --- /dev/null +++ b/docker/Nginx-Dcm4che/nginx-proxy/conf/nginx.conf @@ -0,0 +1,49 @@ +events { + worker_connections 4096; ## Default: 1024 +} + +http { + server { + listen 80 default_server; + server_name localhost; + + # + # Wide-open CORS config for nginx + # + location / { + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + # + # Custom headers and headers various browsers *should* be OK with but aren't + # + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + # + # Tell client that this pre-flight info is valid for 20 days + # + add_header 'Access-Control-Allow-Headers' 'Authorization'; + add_header 'Access-Control-Allow-Credentials' true; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Length' 0; + return 204; + } + if ($request_method = 'POST') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; + } + if ($request_method = 'GET') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; + add_header 'Access-Control-Allow-Headers' 'Authorization'; + add_header 'Access-Control-Allow-Credentials' true; + } + + proxy_pass http://orthanc:8042; + } + + } +} \ No newline at end of file diff --git a/docker/Nginx-Orthanc/config/nginx.conf b/docker/Nginx-Orthanc/config/nginx.conf new file mode 100644 index 000000000..c38ee5813 --- /dev/null +++ b/docker/Nginx-Orthanc/config/nginx.conf @@ -0,0 +1,48 @@ +worker_processes 1; + +events { worker_connections 1024; } + +http { + + upstream orthanc-server { + server orthanc:8042; + } + + server { + listen [::]:80 default_server; + listen 80; + + # CORS Magic + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow_Credentials' 'true'; + add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; + + location / { + + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow_Credentials' 'true'; + add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + + proxy_pass http://orthanc:8042; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + + # CORS Magic + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow_Credentials' 'true'; + add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; + add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; + } + } +} diff --git a/docker/Nginx-Orthanc/config/orthanc.json b/docker/Nginx-Orthanc/config/orthanc.json new file mode 100644 index 000000000..2e10723c0 --- /dev/null +++ b/docker/Nginx-Orthanc/config/orthanc.json @@ -0,0 +1,89 @@ +{ + "Name": "Orthanc inside Docker", + "StorageDirectory": "/var/lib/orthanc/db", + "IndexDirectory": "/var/lib/orthanc/db", + "StorageCompression": false, + "MaximumStorageSize": 0, + "MaximumPatientCount": 0, + "LuaScripts": [], + "Plugins": ["/usr/share/orthanc/plugins", "/usr/local/share/orthanc/plugins"], + "ConcurrentJobs": 2, + "HttpServerEnabled": true, + "HttpPort": 8042, + "HttpDescribeErrors": true, + "HttpCompressionEnabled": true, + "DicomServerEnabled": true, + "DicomAet": "ORTHANC", + "DicomCheckCalledAet": false, + "DicomPort": 4242, + "DefaultEncoding": "Latin1", + "DeflatedTransferSyntaxAccepted": true, + "JpegTransferSyntaxAccepted": true, + "Jpeg2000TransferSyntaxAccepted": true, + "JpegLosslessTransferSyntaxAccepted": true, + "JpipTransferSyntaxAccepted": true, + "Mpeg2TransferSyntaxAccepted": true, + "RleTransferSyntaxAccepted": true, + "UnknownSopClassAccepted": false, + "DicomScpTimeout": 30, + + "RemoteAccessAllowed": true, + "SslEnabled": false, + "SslCertificate": "certificate.pem", + "AuthenticationEnabled": false, + "RegisteredUsers": { + "test": "test" + }, + "DicomModalities": {}, + "DicomModalitiesInDatabase": false, + "DicomAlwaysAllowEcho": true, + "DicomAlwaysAllowStore": true, + "DicomCheckModalityHost": false, + "DicomScuTimeout": 10, + "OrthancPeers": {}, + "OrthancPeersInDatabase": false, + "HttpProxy": "", + + "HttpVerbose": true, + + "HttpTimeout": 10, + "HttpsVerifyPeers": true, + "HttpsCACertificates": "", + "UserMetadata": {}, + "UserContentType": {}, + "StableAge": 60, + "StrictAetComparison": false, + "StoreMD5ForAttachments": true, + "LimitFindResults": 0, + "LimitFindInstances": 0, + "LimitJobs": 10, + "LogExportedResources": false, + "KeepAlive": true, + "TcpNoDelay": true, + "HttpThreadsCount": 50, + "StoreDicom": true, + "DicomAssociationCloseDelay": 5, + "QueryRetrieveSize": 10, + "CaseSensitivePN": false, + "LoadPrivateDictionary": true, + "Dictionary": {}, + "SynchronousCMove": true, + "JobsHistorySize": 10, + "SaveJobs": true, + "OverwriteInstances": false, + "MediaArchiveSize": 1, + "StorageAccessOnFind": "Always", + "MetricsEnabled": true, + + "DicomWeb": { + "Enable": true, + "Root": "/dicom-web/", + "EnableWado": true, + "WadoRoot": "/wado", + "Host": "127.0.0.1", + "Ssl": false, + "StowMaxInstances": 10, + "StowMaxSize": 10, + "QidoCaseSensitive": false + } +} diff --git a/docker/Nginx-Orthanc/docker-compose.yml b/docker/Nginx-Orthanc/docker-compose.yml new file mode 100644 index 000000000..26e797514 --- /dev/null +++ b/docker/Nginx-Orthanc/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.5' + +services: + proxy: + image: nginx:1.15-alpine + ports: + - 8899:80 + volumes: + - ./config/nginx.conf:/etc/nginx/nginx.conf:ro + restart: unless-stopped + + # LINK: https://hub.docker.com/r/jodogne/orthanc-plugins/ + # TODO: Update to use Postgres + # https://github.com/mrts/docker-postgresql-multiple-databases + orthanc: + image: jodogne/orthanc-plugins:1.5.6 + hostname: orthanc + volumes: + # Config + - ./config/orthanc.json:/etc/orthanc/orthanc.json:ro + # Persist data + - ./volumes/orthanc-db/:/var/lib/orthanc/db/ + # ports: + # - '4242:4242' # DICOM + # - '8042:8042' # Web + restart: unless-stopped diff --git a/docker/Nginx-Orthanc/volumes/orthanc-db/.githold b/docker/Nginx-Orthanc/volumes/orthanc-db/.githold new file mode 100644 index 000000000..e69de29bb diff --git a/docker/Nginx-Orthanc/volumes/orthanc-db/.gitignore b/docker/Nginx-Orthanc/volumes/orthanc-db/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/docker/Nginx-Orthanc/volumes/orthanc-db/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/docker/OpenResty-Orthanc-Keycloak/.dockerignore b/docker/OpenResty-Orthanc-Keycloak/.dockerignore new file mode 100644 index 000000000..67f1b2e98 --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/.dockerignore @@ -0,0 +1,16 @@ +# Output +dist/ + +# Dependencies +node_modules/ + +# Root +README.md +Dockerfile + +# Misc. Config +.git +.DS_Store +.gitignore +.vscode +.circleci diff --git a/docker/OpenResty-Orthanc-Keycloak/.env b/docker/OpenResty-Orthanc-Keycloak/.env new file mode 100644 index 000000000..6989ff3fc --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/.env @@ -0,0 +1,5 @@ +# Docker ENV and ARG Variables +# ---------------------------- +# https://vsupalov.com/docker-arg-env-variable-guide/ +# +# diff --git a/docker/OpenResty-Orthanc-Keycloak/config/nginx.conf b/docker/OpenResty-Orthanc-Keycloak/config/nginx.conf new file mode 100644 index 000000000..7360c3361 --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/config/nginx.conf @@ -0,0 +1,259 @@ +worker_processes 2; +error_log /var/logs/nginx/mydomain.error.log; +pid /var/run/nginx.pid; +include /usr/share/nginx/modules/*.conf; # See /usr/share/doc/nginx/README.dynamic. + +events { + worker_connections 1024; ## Default: 1024 + use epoll; # http://nginx.org/en/docs/events.html + multi_accept on; # http://nginx.org/en/docs/ngx_core_module.html#multi_accept +} + +# Core Modules Docs: +# http://nginx.org/en/docs/http/ngx_http_core_module.html +http { + include '/usr/local/openresty/nginx/conf/mime.types'; + default_type application/octet-stream; + + keepalive_timeout 65; + keepalive_requests 100000; + tcp_nopush on; + tcp_nodelay on; + + # lua_ settings + # + lua_package_path '/usr/local/openresty/lualib/?.lua;;'; + lua_shared_dict discovery 1m; # cache for discovery metadata documents + lua_shared_dict jwks 1m; # cache for JWKs + # lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt; + + variables_hash_max_size 2048; + server_names_hash_bucket_size 128; + server_tokens off; + + resolver 8.8.8.8 valid=30s ipv6=off; + resolver_timeout 11s; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + # No idea what this is doing + # https://stackoverflow.com/a/5877989/1867984 + # upstream upstream_server { + # # server 10.100.4.200:1010 max_fails=3 fail_timeout=30s; + # server 127.0.0.1: + # } + + # Nginx `listener` block + server { + listen [::]:80 default_server; + listen 80; + # listen 443 ssl; + access_log /var/logs/nginx/mydomain.access.log; + + # Domain to protect + server_name 127.0.0.1 localhost; # mydomain.com; + proxy_intercept_errors off; + # ssl_certificate /etc/letsencrypt/live/mydomain.co.uk/fullchain.pem; + # ssl_certificate_key /etc/letsencrypt/live/mydomain.co.uk/privkey.pem; + gzip on; + gzip_types text/css application/javascript application/json image/svg+xml; + gzip_comp_level 9; + etag on; + + # https://github.com/bungle/lua-resty-session/issues/15 + set $session_check_ssi off; + lua_code_cache off; + set $session_secret Eeko7aeb6iu5Wohch9Loo1aitha0ahd1; + set $session_storage cookie; + + server_tokens off; # Hides server version num + + # [PROTECTED] Reverse Proxy for `orthanc` admin + # + location /pacs-admin/ { + access_by_lua_block { + local opts = { + redirect_uri = "http://127.0.0.1/pacs-admin/admin", + discovery = "http://127.0.0.1/auth/realms/ohif/.well-known/openid-configuration", + token_endpoint_auth_method = "client_secret_basic", + client_id = "pacs", + client_secret = "66279641-eba6-47f5-9fdb-70c4ac74d548", + client_jwt_assertion_expires_in = 60 * 60, + ssl_verify = "no", + scope = "openid email profile", + refresh_session_interval = 900, + redirect_uri_scheme = "http", + redirect_after_logout_uri = "/", + session_contents = {id_token=true} + } + + -- call authenticate for OpenID Connect user authentication + local res, err = require("resty.openidc").authenticate(opts) + + if err or not res then + ngx.print(err) + ngx.status = 200 + ngx.say(err and err or "no access_token provided") + ngx.exit(ngx.HTTP_FORBIDDEN) + end + + -- Or set cookie? + -- ngx.req.set_header("Authorization", "Bearer " .. res.access_token) + ngx.req.set_header("X-USER", res.id_token.sub) + } + + + proxy_http_version 1.1; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + expires 0; + add_header Cache-Control private; + + proxy_pass http://orthanc:8042/; + } + + # [PROTECTED] Reverse Proxy for `orthanc` APIs (including DICOMWeb) + # + location /pacs/ { + access_by_lua_block { + local opts = { + discovery = "http://127.0.0.1/auth/realms/ohif/.well-known/openid-configuration", + } + + -- call bearer_jwt_verify for OAuth 2.0 JWT validation + local res, err = require("resty.openidc").bearer_jwt_verify(opts) + + if err or not res then + ngx.status = 403 + ngx.say(err and err or "no access_token provided") + ngx.exit(ngx.HTTP_FORBIDDEN) + end + } + + proxy_http_version 1.1; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; +# proxy_set_header Upgrade $http_upgrade; +# proxy_set_header Connection "upgrade"; + + expires 0; + add_header Cache-Control private; + + proxy_pass http://orthanc:8042/; + + # By default, this endpoint is protected by CORS (cross-origin-resource-sharing) + # You can add headers to allow other domains to request this resource. + # See the "Updating CORS Settings" example below + } + + # Keycloak + # + location /auth/ { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + + proxy_pass http://keycloak:8080/auth/; + } + + # Do not cache sw.js, required for offline-first updates. + location /sw.js { + add_header Cache-Control "no-cache"; + proxy_cache_bypass $http_pragma; + proxy_cache_revalidate on; + expires off; + access_log off; + } + + # Single Page App + # Try files, fallback to index.html + # + location / { + alias /var/www/html/; + index index.html; + try_files $uri $uri/ /index.html; + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + # EXAMPLE: Reverse Proxy, no auth + # [UNPROTECTED] reverse proxy for `orthanc` + # + # location /pacs/ { + # proxy_set_header X-Real-IP $remote_addr; + # proxy_set_header X-Forwarded-For $remote_addr; + # proxy_set_header Host $host; + # + # proxy_pass http://orthanc:8042/; + # + # # OR + # # rewrite ^/pacs(.*) /$1 break; + # # proxy_pass http://orthanc:8042; + # } + + # EXAMPLE: Modifying headers to allow requests from other domains + # IE. Updating CORS settings + # + # location / { + # if ($request_method = 'OPTIONS') { + # add_header 'Access-Control-Allow-Origin' '*'; + # add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + # # + # # Custom headers and headers various browsers *should* be OK with but aren't + # # + # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + # # + # # Tell client that this pre-flight info is valid for 20 days + # # + # add_header 'Access-Control-Allow-Headers' 'Authorization'; + # add_header 'Access-Control-Allow-Credentials' true; + # add_header 'Access-Control-Max-Age' 1728000; + # add_header 'Content-Length' 0; + # return 204; + # } + # if ($request_method = 'POST') { + # add_header 'Access-Control-Allow-Origin' '*'; + # add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + # add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; + # } + # if ($request_method = 'GET') { + # add_header 'Access-Control-Allow-Origin' '*'; + # add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + # add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; + # add_header 'Access-Control-Allow-Headers' 'Authorization'; + # add_header 'Access-Control-Allow-Credentials' true; + # } + # + # # proxy_http_version 1.1; + # + # # proxy_set_header Host $host; + # # proxy_set_header X-Real-IP $remote_addr; + # # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # # proxy_set_header X-Forwarded-Proto $scheme; + # + # proxy_pass http://orthanc:8042; + # } + + # EXAMPLE: Redirect server error pages to the static page /40x.html + # + # error_page 404 /404.html; + # location = /40x.html { + # } + + # EXAMPLE: Redirect server error pages to the static page /50x.html + # + # error_page 500 502 503 504 /50x.html; + # location = /50x.html { + # } + } +} diff --git a/docker/OpenResty-Orthanc-Keycloak/config/ohif-keycloak-realm.json b/docker/OpenResty-Orthanc-Keycloak/config/ohif-keycloak-realm.json new file mode 100644 index 000000000..3f0e6118a --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/config/ohif-keycloak-realm.json @@ -0,0 +1,1876 @@ +{ + "id": "ohif", + "realm": "ohif", + "displayName": "OHIF", + "displayNameHtml": "
    OHIF
    ", + "notBefore": 0, + "revokeRefreshToken": false, + "refreshTokenMaxReuse": 0, + "accessTokenLifespan": 300, + "accessTokenLifespanForImplicitFlow": 900, + "ssoSessionIdleTimeout": 1800, + "ssoSessionMaxLifespan": 36000, + "ssoSessionIdleTimeoutRememberMe": 0, + "ssoSessionMaxLifespanRememberMe": 0, + "offlineSessionIdleTimeout": 2592000, + "offlineSessionMaxLifespanEnabled": false, + "offlineSessionMaxLifespan": 5184000, + "accessCodeLifespan": 60, + "accessCodeLifespanUserAction": 300, + "accessCodeLifespanLogin": 1800, + "actionTokenGeneratedByAdminLifespan": 43200, + "actionTokenGeneratedByUserLifespan": 300, + "enabled": true, + "sslRequired": "external", + "registrationAllowed": false, + "registrationEmailAsUsername": false, + "rememberMe": false, + "verifyEmail": false, + "loginWithEmailAllowed": true, + "duplicateEmailsAllowed": false, + "resetPasswordAllowed": false, + "editUsernameAllowed": false, + "bruteForceProtected": false, + "permanentLockout": false, + "maxFailureWaitSeconds": 900, + "minimumQuickLoginWaitSeconds": 60, + "waitIncrementSeconds": 60, + "quickLoginCheckMilliSeconds": 1000, + "maxDeltaTimeSeconds": 43200, + "failureFactor": 30, + "roles": { + "realm": [ + { + "id": "6c3af6bd-09e5-41ab-a997-ecb926e06a9c", + "name": "offline_access", + "description": "${role_offline-access}", + "composite": false, + "clientRole": false, + "containerId": "ohif", + "attributes": {} + }, + { + "id": "eb61ea0f-059d-4aeb-8179-6d223882be4e", + "name": "uma_authorization", + "description": "${role_uma_authorization}", + "composite": false, + "clientRole": false, + "containerId": "ohif", + "attributes": {} + } + ], + "client": { + "realm-management": [ + { + "id": "20b8764b-3db0-47bf-80f3-fdc5e2a80651", + "name": "view-events", + "description": "${role_view-events}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "b85a57ed-b33a-41b2-8748-d02f9f334b42", + "name": "realm-admin", + "description": "${role_realm-admin}", + "composite": true, + "composites": { + "client": { + "realm-management": [ + "view-events", + "query-realms", + "query-groups", + "manage-clients", + "query-clients", + "impersonation", + "manage-identity-providers", + "view-identity-providers", + "query-users", + "manage-realm", + "manage-authorization", + "view-authorization", + "view-realm", + "manage-users", + "view-clients", + "manage-events", + "create-client", + "view-users" + ] + } + }, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "5fdc7311-003e-4644-b497-3b88f0fd2771", + "name": "query-realms", + "description": "${role_query-realms}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "cb1ebb2f-7772-417e-8ed6-9f144e53aa66", + "name": "query-groups", + "description": "${role_query-groups}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "0c2b9722-d7cb-49c1-9eba-216b8485f0a9", + "name": "manage-clients", + "description": "${role_manage-clients}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "e60cd69e-6ebb-4e2b-aefc-7529f62bd410", + "name": "query-clients", + "description": "${role_query-clients}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "003085ed-b327-4dc2-bcfe-b97f25dbfdb2", + "name": "impersonation", + "description": "${role_impersonation}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "97678c0b-a333-443b-af67-39be0c9b9656", + "name": "manage-identity-providers", + "description": "${role_manage-identity-providers}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "f96be28a-ed19-4e0c-a2cc-85ba3daed401", + "name": "view-identity-providers", + "description": "${role_view-identity-providers}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "081be3e8-f3a9-4d2a-94ee-ec357082d019", + "name": "query-users", + "description": "${role_query-users}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "376fec14-86c7-4986-8f09-9d4b93880c57", + "name": "manage-realm", + "description": "${role_manage-realm}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "1c105710-6a0e-40bb-8e45-924017eff426", + "name": "manage-authorization", + "description": "${role_manage-authorization}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "6f0f4bad-7761-487d-babd-62500ca02380", + "name": "view-authorization", + "description": "${role_view-authorization}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "089145da-eb3c-4a06-a623-01f1c0278710", + "name": "view-realm", + "description": "${role_view-realm}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "59cf0f7d-0ccc-4b2d-ab23-dd00a95727d2", + "name": "manage-users", + "description": "${role_manage-users}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "bbf8231a-f92c-4c7d-a962-f1ffc3a77486", + "name": "view-clients", + "description": "${role_view-clients}", + "composite": true, + "composites": { + "client": { + "realm-management": ["query-clients"] + } + }, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "b76f0563-eb1a-4e85-853d-2c5fd41820ab", + "name": "manage-events", + "description": "${role_manage-events}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "bc00ccc2-f675-4649-a1fc-0138da85c2ef", + "name": "create-client", + "description": "${role_create-client}", + "composite": false, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + }, + { + "id": "982241da-f30d-4a9b-a425-d69fb5f1b0ee", + "name": "view-users", + "description": "${role_view-users}", + "composite": true, + "composites": { + "client": { + "realm-management": ["query-groups", "query-users"] + } + }, + "clientRole": true, + "containerId": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "attributes": {} + } + ], + "pacs": [ + { + "id": "46283d0b-9b8b-46f2-a111-dfa460103f2f", + "name": "uma_protection", + "composite": false, + "clientRole": true, + "containerId": "3785434d-2af8-478c-b135-f0b11d1d3205", + "attributes": {} + } + ], + "security-admin-console": [], + "admin-cli": [], + "broker": [ + { + "id": "49b1694a-21f5-4eb0-a9c4-4f847313d722", + "name": "read-token", + "description": "${role_read-token}", + "composite": false, + "clientRole": true, + "containerId": "f7f76add-411b-420d-9be1-bd120ed99918", + "attributes": {} + } + ], + "ohif-viewer": [], + "account": [ + { + "id": "6ae38e13-39e5-4000-962f-ef0175f57c60", + "name": "manage-account-links", + "description": "${role_manage-account-links}", + "composite": false, + "clientRole": true, + "containerId": "e6bee9db-9634-4cd2-93d3-cdaa1f011dd8", + "attributes": {} + }, + { + "id": "368522c4-b8f0-40af-ac53-b96496c4a44a", + "name": "manage-account", + "description": "${role_manage-account}", + "composite": true, + "composites": { + "client": { + "account": ["manage-account-links"] + } + }, + "clientRole": true, + "containerId": "e6bee9db-9634-4cd2-93d3-cdaa1f011dd8", + "attributes": {} + }, + { + "id": "af2a7fbc-38da-49cd-8495-c798530fe251", + "name": "view-profile", + "description": "${role_view-profile}", + "composite": false, + "clientRole": true, + "containerId": "e6bee9db-9634-4cd2-93d3-cdaa1f011dd8", + "attributes": {} + } + ] + } + }, + "groups": [], + "defaultRoles": ["offline_access", "uma_authorization"], + "requiredCredentials": ["password"], + "otpPolicyType": "totp", + "otpPolicyAlgorithm": "HmacSHA1", + "otpPolicyInitialCounter": 0, + "otpPolicyDigits": 6, + "otpPolicyLookAheadWindow": 1, + "otpPolicyPeriod": 30, + "otpSupportedApplications": ["FreeOTP", "Google Authenticator"], + "scopeMappings": [ + { + "clientScope": "offline_access", + "roles": ["offline_access"] + } + ], + "clients": [ + { + "id": "315fbb4d-f9c8-46f6-888e-d6c69d415ee0", + "clientId": "admin-cli", + "name": "${client_admin-cli}", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": [], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": false, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "84e7b84d-ab74-452e-8a24-a0e657f100ea", + "clientId": "realm-management", + "name": "${client_realm-management}", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": [], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": true, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "f7dd8587-4035-4590-a1c0-ebf576c4dfe3", + "clientId": "security-admin-console", + "name": "${client_security-admin-console}", + "baseUrl": "/auth/admin/ohif/console/index.html", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": ["/auth/admin/ohif/console/*"], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "protocolMappers": [ + { + "id": "3c48b046-72a2-4779-abb5-760c58fe2c19", + "name": "locale", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "locale", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "locale", + "jsonType.label": "String" + } + } + ], + "defaultClientScopes": [ + "web-origins", + "role_list", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "f7f76add-411b-420d-9be1-bd120ed99918", + "clientId": "broker", + "name": "${client_broker}", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": [], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "3785434d-2af8-478c-b135-f0b11d1d3205", + "clientId": "pacs", + "rootUrl": "http://127.0.0.1", + "baseUrl": "/pacs-admin", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "66279641-eba6-47f5-9fdb-70c4ac74d548", + "redirectUris": ["*"], + "webOrigins": ["*"], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": true, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": true, + "authorizationServicesEnabled": true, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": { + "saml.assertion.signature": "false", + "saml.force.post.binding": "false", + "saml.multivalued.roles": "false", + "saml.encrypt": "false", + "saml.server.signature": "false", + "saml.server.signature.keyinfo.ext": "false", + "exclude.session.state.from.auth.response": "false", + "saml_force_name_id_format": "false", + "saml.client.signature": "false", + "tls.client.certificate.bound.access.tokens": "false", + "saml.authnstatement": "false", + "display.on.consent.screen": "false", + "saml.onetimeuse.condition": "false" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": true, + "nodeReRegistrationTimeout": -1, + "protocolMappers": [ + { + "id": "6aad2e40-2917-4549-a823-b8765ea4b13f", + "name": "Client IP Address", + "protocol": "openid-connect", + "protocolMapper": "oidc-usersessionmodel-note-mapper", + "consentRequired": false, + "config": { + "user.session.note": "clientAddress", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "clientAddress", + "jsonType.label": "String" + } + }, + { + "id": "560fea50-208a-487a-82ff-de6edd81eb80", + "name": "Client Host", + "protocol": "openid-connect", + "protocolMapper": "oidc-usersessionmodel-note-mapper", + "consentRequired": false, + "config": { + "user.session.note": "clientHost", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "clientHost", + "jsonType.label": "String" + } + }, + { + "id": "248bf04e-057a-46f4-be6c-1a64728e0203", + "name": "Client ID", + "protocol": "openid-connect", + "protocolMapper": "oidc-usersessionmodel-note-mapper", + "consentRequired": false, + "config": { + "user.session.note": "clientId", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "clientId", + "jsonType.label": "String" + } + } + ], + "defaultClientScopes": [ + "web-origins", + "role_list", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ], + "authorizationSettings": { + "allowRemoteResourceManagement": true, + "policyEnforcementMode": "ENFORCING", + "resources": [ + { + "name": "Default Resource", + "type": "urn:pacs:resources:default", + "ownerManagedAccess": false, + "attributes": {}, + "_id": "0ba897de-b178-44e6-8dd6-dec09b066808", + "uris": ["/*"] + } + ], + "policies": [ + { + "id": "4b79719f-ed30-451b-8ad1-7ba516a2b3f2", + "name": "Default Policy", + "description": "A policy that grants access only for users within this realm", + "type": "js", + "logic": "POSITIVE", + "decisionStrategy": "AFFIRMATIVE", + "config": { + "code": "// by default, grants any permission associated with this policy\n$evaluation.grant();\n" + } + }, + { + "id": "4071a9c3-5eec-417f-898e-cb0e7fe11f85", + "name": "Default Permission", + "description": "A permission that applies to the default resource type", + "type": "resource", + "logic": "POSITIVE", + "decisionStrategy": "UNANIMOUS", + "config": { + "defaultResourceType": "urn:pacs:resources:default", + "applyPolicies": "[\"Default Policy\"]" + } + } + ], + "scopes": [] + } + }, + { + "id": "e6bee9db-9634-4cd2-93d3-cdaa1f011dd8", + "clientId": "account", + "name": "${client_account}", + "baseUrl": "/auth/realms/ohif/account", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "defaultRoles": ["view-profile", "manage-account"], + "redirectUris": ["/auth/realms/ohif/account/*"], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "53d51818-e1bf-4fc2-aa20-5541f2646f12", + "clientId": "ohif-viewer", + "rootUrl": "http://127.0.0.1", + "adminUrl": "http://127.0.0.1", + "baseUrl": "/", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": ["*"], + "webOrigins": ["http://127.0.0.1"], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": { + "saml.assertion.signature": "false", + "saml.force.post.binding": "false", + "saml.multivalued.roles": "false", + "saml.encrypt": "false", + "login_theme": "ohif", + "saml.server.signature": "false", + "saml.server.signature.keyinfo.ext": "false", + "exclude.session.state.from.auth.response": "false", + "saml_force_name_id_format": "false", + "saml.client.signature": "false", + "tls.client.certificate.bound.access.tokens": "false", + "saml.authnstatement": "false", + "display.on.consent.screen": "false", + "saml.onetimeuse.condition": "false" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": true, + "nodeReRegistrationTimeout": -1, + "defaultClientScopes": [ + "web-origins", + "role_list", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + } + ], + "clientScopes": [ + { + "id": "6ae5b114-291d-4265-826a-59d66c7257c4", + "name": "microprofile-jwt", + "description": "Microprofile - JWT built-in scope", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "false" + }, + "protocolMappers": [ + { + "id": "53f31712-86fe-429a-897f-56f6a68ff04a", + "name": "upn", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "username", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "upn", + "jsonType.label": "String" + } + }, + { + "id": "400bbe92-0c89-42a5-9deb-846465f37832", + "name": "groups", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-realm-role-mapper", + "consentRequired": false, + "config": { + "multivalued": "true", + "user.attribute": "foo", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "groups", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "bf928a3a-12bd-4fcc-9c8c-a7302161af9c", + "name": "web-origins", + "description": "OpenID Connect scope for add allowed web origins to the access token", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "false", + "display.on.consent.screen": "false", + "consent.screen.text": "" + }, + "protocolMappers": [ + { + "id": "47ff8af3-462d-450d-b72e-ed8c280f2df7", + "name": "allowed web origins", + "protocol": "openid-connect", + "protocolMapper": "oidc-allowed-origins-mapper", + "consentRequired": false, + "config": {} + } + ] + }, + { + "id": "3a2f720d-06aa-4a21-bb8b-a2fe8ff740ba", + "name": "roles", + "description": "OpenID Connect scope for add user roles to the access token", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "false", + "display.on.consent.screen": "true", + "consent.screen.text": "${rolesScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "f312bcba-a892-4fa1-ab66-a784cb3359f7", + "name": "client roles", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-client-role-mapper", + "consentRequired": false, + "config": { + "multivalued": "true", + "user.attribute": "foo", + "access.token.claim": "true", + "claim.name": "resource_access.${client_id}.roles", + "jsonType.label": "String" + } + }, + { + "id": "a9ab2bd5-835d-4f5f-aa07-2845ccd3d361", + "name": "audience resolve", + "protocol": "openid-connect", + "protocolMapper": "oidc-audience-resolve-mapper", + "consentRequired": false, + "config": {} + }, + { + "id": "cf2ec6d5-ac10-4d67-9c10-1cf6f83d1ba5", + "name": "realm roles", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-realm-role-mapper", + "consentRequired": false, + "config": { + "multivalued": "true", + "user.attribute": "foo", + "access.token.claim": "true", + "claim.name": "realm_access.roles", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "09747e03-0974-4937-a444-2170c1185842", + "name": "phone", + "description": "OpenID Connect built-in scope: phone", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${phoneScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "6e91d83d-746b-499a-9f1c-76d821f2c51d", + "name": "phone number", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "phoneNumber", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "phone_number", + "jsonType.label": "String" + } + }, + { + "id": "b185e72e-0fef-43ed-971b-a8e4c420c8b9", + "name": "phone number verified", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "phoneNumberVerified", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "phone_number_verified", + "jsonType.label": "boolean" + } + } + ] + }, + { + "id": "775a0614-070f-4ee3-9eb5-7dace1a3ee9f", + "name": "address", + "description": "OpenID Connect built-in scope: address", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${addressScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "5e9c8afa-e924-4378-b957-391c204dfa97", + "name": "address", + "protocol": "openid-connect", + "protocolMapper": "oidc-address-mapper", + "consentRequired": false, + "config": { + "user.attribute.formatted": "formatted", + "user.attribute.country": "country", + "user.attribute.postal_code": "postal_code", + "userinfo.token.claim": "true", + "user.attribute.street": "street", + "id.token.claim": "true", + "user.attribute.region": "region", + "access.token.claim": "true", + "user.attribute.locality": "locality" + } + } + ] + }, + { + "id": "7361627f-bb6e-4ddf-ba05-9f2e449fd636", + "name": "email", + "description": "OpenID Connect built-in scope: email", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${emailScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "99f6051f-a4dc-46fc-bc46-8fdb224028cb", + "name": "email verified", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "emailVerified", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "email_verified", + "jsonType.label": "boolean" + } + }, + { + "id": "4401b7fa-7a4a-416e-91dd-bd94835bcd05", + "name": "email", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "email", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "email", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "ee4aefa7-398a-4ced-b9fb-f25ad83a1e4e", + "name": "profile", + "description": "OpenID Connect built-in scope: profile", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${profileScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "fddd6ec8-99d1-4654-af68-5a08285845a7", + "name": "nickname", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "nickname", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "nickname", + "jsonType.label": "String" + } + }, + { + "id": "4d70b18c-6ac1-4210-be64-3d975d127eeb", + "name": "username", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "username", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "preferred_username", + "jsonType.label": "String" + } + }, + { + "id": "e60ad476-a109-4f6d-8b8f-638ea737d641", + "name": "given name", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "firstName", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "given_name", + "jsonType.label": "String" + } + }, + { + "id": "1ecac05a-a740-4f49-bdde-66df4b57fdab", + "name": "middle name", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "middleName", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "middle_name", + "jsonType.label": "String" + } + }, + { + "id": "7adb553b-e335-412d-8633-21b1e68fbf5c", + "name": "zoneinfo", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "zoneinfo", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "zoneinfo", + "jsonType.label": "String" + } + }, + { + "id": "b51200b1-ffb2-4222-989d-c78af76318d4", + "name": "family name", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "lastName", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "family_name", + "jsonType.label": "String" + } + }, + { + "id": "cd73c78e-5e78-422d-8f68-818ef766529d", + "name": "picture", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "picture", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "picture", + "jsonType.label": "String" + } + }, + { + "id": "7242207c-dd96-4932-8914-2f36e2d91689", + "name": "full name", + "protocol": "openid-connect", + "protocolMapper": "oidc-full-name-mapper", + "consentRequired": false, + "config": { + "id.token.claim": "true", + "access.token.claim": "true", + "userinfo.token.claim": "true" + } + }, + { + "id": "237dace9-0b8e-4e4c-82c7-b3d588630009", + "name": "website", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "website", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "website", + "jsonType.label": "String" + } + }, + { + "id": "88c56ac7-47a8-45e2-8774-1757b0df8d87", + "name": "updated at", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "updatedAt", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "updated_at", + "jsonType.label": "String" + } + }, + { + "id": "ec68ab29-95cd-476c-a528-fa8d0ca97ae9", + "name": "locale", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "locale", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "locale", + "jsonType.label": "String" + } + }, + { + "id": "0245d1ab-f14b-4bb2-97d2-6f0e1bab41fe", + "name": "birthdate", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "birthdate", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "birthdate", + "jsonType.label": "String" + } + }, + { + "id": "0d95b1c0-85d9-4dfa-b269-e07a890b023d", + "name": "profile", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "profile", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "profile", + "jsonType.label": "String" + } + }, + { + "id": "7c391683-f6a1-4cd7-aca9-2f6690f1700d", + "name": "gender", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "gender", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "gender", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "532b1821-92bf-4ff7-95b6-cba1f2ca3545", + "name": "role_list", + "description": "SAML role list", + "protocol": "saml", + "attributes": { + "consent.screen.text": "${samlRoleListScopeConsentText}", + "display.on.consent.screen": "true" + }, + "protocolMappers": [ + { + "id": "e606a1b0-6772-441e-9799-44ec896ca13d", + "name": "role list", + "protocol": "saml", + "protocolMapper": "saml-role-list-mapper", + "consentRequired": false, + "config": { + "single": "false", + "attribute.nameformat": "Basic", + "attribute.name": "Role" + } + } + ] + }, + { + "id": "28c9327f-b38d-4dd8-81f7-3a5bc95c019f", + "name": "offline_access", + "description": "OpenID Connect built-in scope: offline_access", + "protocol": "openid-connect", + "attributes": { + "consent.screen.text": "${offlineAccessScopeConsentText}", + "display.on.consent.screen": "true" + } + } + ], + "defaultDefaultClientScopes": [ + "role_list", + "profile", + "email", + "roles", + "web-origins" + ], + "defaultOptionalClientScopes": [ + "offline_access", + "address", + "phone", + "microprofile-jwt" + ], + "browserSecurityHeaders": { + "contentSecurityPolicyReportOnly": "", + "xContentTypeOptions": "nosniff", + "xRobotsTag": "none", + "xFrameOptions": "SAMEORIGIN", + "xXSSProtection": "1; mode=block", + "contentSecurityPolicy": "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", + "strictTransportSecurity": "max-age=31536000; includeSubDomains" + }, + "smtpServer": {}, + "eventsEnabled": false, + "eventsListeners": ["jboss-logging"], + "enabledEventTypes": [], + "adminEventsEnabled": false, + "adminEventsDetailsEnabled": false, + "components": { + "org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy": [ + { + "id": "abc1fcf9-610c-4682-a68c-f2786d19ca2f", + "name": "Allowed Protocol Mapper Types", + "providerId": "allowed-protocol-mappers", + "subType": "anonymous", + "subComponents": {}, + "config": { + "allowed-protocol-mapper-types": [ + "saml-user-attribute-mapper", + "oidc-usermodel-attribute-mapper", + "oidc-usermodel-property-mapper", + "saml-user-property-mapper", + "oidc-sha256-pairwise-sub-mapper", + "saml-role-list-mapper", + "oidc-full-name-mapper", + "oidc-address-mapper" + ] + } + }, + { + "id": "ce5e7488-00e2-4ce5-99b4-b77ea86a1470", + "name": "Allowed Client Scopes", + "providerId": "allowed-client-templates", + "subType": "anonymous", + "subComponents": {}, + "config": { + "allow-default-scopes": ["true"] + } + }, + { + "id": "73fcfae3-4890-4c85-becf-f43b29b24db9", + "name": "Max Clients Limit", + "providerId": "max-clients", + "subType": "anonymous", + "subComponents": {}, + "config": { + "max-clients": ["200"] + } + }, + { + "id": "5faf17f3-6b8f-40ed-9bdc-ae74a638a197", + "name": "Full Scope Disabled", + "providerId": "scope", + "subType": "anonymous", + "subComponents": {}, + "config": {} + }, + { + "id": "fe7ccadb-4534-4944-a245-bd78633144af", + "name": "Consent Required", + "providerId": "consent-required", + "subType": "anonymous", + "subComponents": {}, + "config": {} + }, + { + "id": "483b67ab-fe56-4ba9-ab65-3b9ac59bf048", + "name": "Trusted Hosts", + "providerId": "trusted-hosts", + "subType": "anonymous", + "subComponents": {}, + "config": { + "host-sending-registration-request-must-match": ["true"], + "client-uris-must-match": ["true"] + } + }, + { + "id": "ebf46274-4329-40c7-8342-7a9c2d3181e5", + "name": "Allowed Protocol Mapper Types", + "providerId": "allowed-protocol-mappers", + "subType": "authenticated", + "subComponents": {}, + "config": { + "allowed-protocol-mapper-types": [ + "saml-role-list-mapper", + "saml-user-property-mapper", + "oidc-usermodel-property-mapper", + "oidc-usermodel-attribute-mapper", + "oidc-sha256-pairwise-sub-mapper", + "saml-user-attribute-mapper", + "oidc-full-name-mapper", + "oidc-address-mapper" + ] + } + }, + { + "id": "4a34d375-8480-4368-8eb7-516e382e5f28", + "name": "Allowed Client Scopes", + "providerId": "allowed-client-templates", + "subType": "authenticated", + "subComponents": {}, + "config": { + "allow-default-scopes": ["true"] + } + } + ], + "org.keycloak.keys.KeyProvider": [ + { + "id": "527b473f-81bf-4bc1-8c41-667bcefa7414", + "name": "aes-generated", + "providerId": "aes-generated", + "subComponents": {}, + "config": { + "priority": ["100"] + } + }, + { + "id": "ad0ab7c0-d4e0-470c-a43c-f4c4d71d5f9e", + "name": "rsa-generated", + "providerId": "rsa-generated", + "subComponents": {}, + "config": { + "priority": ["100"] + } + }, + { + "id": "6f1171b4-22eb-4a94-ae64-7c33ed2b8817", + "name": "hmac-generated", + "providerId": "hmac-generated", + "subComponents": {}, + "config": { + "priority": ["100"], + "algorithm": ["HS256"] + } + } + ] + }, + "internationalizationEnabled": false, + "supportedLocales": [], + "authenticationFlows": [ + { + "id": "0131114f-fc73-4b02-aa5e-bbf7502229e2", + "alias": "Handle Existing Account", + "description": "Handle what to do if there is existing account with same email/username like authenticated identity provider", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "idp-confirm-link", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "idp-email-verification", + "requirement": "ALTERNATIVE", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 30, + "flowAlias": "Verify Existing Account by Re-authentication", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "0c5dd2e0-f444-4406-a8f7-88248808bc2e", + "alias": "Verify Existing Account by Re-authentication", + "description": "Reauthentication of existing account", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "idp-username-password-form", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-otp-form", + "requirement": "OPTIONAL", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "d212c8b1-e4dc-4e19-8ed1-d564406885af", + "alias": "browser", + "description": "browser based authentication", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "auth-cookie", + "requirement": "ALTERNATIVE", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-spnego", + "requirement": "DISABLED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "identity-provider-redirector", + "requirement": "ALTERNATIVE", + "priority": 25, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 30, + "flowAlias": "forms", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "1d9bc1ff-3b71-4730-ac2c-fae8e1babcdd", + "alias": "clients", + "description": "Base authentication for clients", + "providerId": "client-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "client-secret", + "requirement": "ALTERNATIVE", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "client-jwt", + "requirement": "ALTERNATIVE", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "client-secret-jwt", + "requirement": "ALTERNATIVE", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "client-x509", + "requirement": "ALTERNATIVE", + "priority": 40, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "9a4f37bf-d5d8-41e9-ac3e-ed41575b9ec9", + "alias": "direct grant", + "description": "OpenID Connect Resource Owner Grant", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "direct-grant-validate-username", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "direct-grant-validate-password", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "direct-grant-validate-otp", + "requirement": "OPTIONAL", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "898f145d-bb61-49d2-9304-43f42a482199", + "alias": "docker auth", + "description": "Used by Docker clients to authenticate against the IDP", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "docker-http-basic-authenticator", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "9445cbe0-4307-490e-b996-026391c5064b", + "alias": "first broker login", + "description": "Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticatorConfig": "review profile config", + "authenticator": "idp-review-profile", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticatorConfig": "create unique user config", + "authenticator": "idp-create-user-if-unique", + "requirement": "ALTERNATIVE", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 30, + "flowAlias": "Handle Existing Account", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "fcb61660-2e54-4434-be96-ce0b5e5bae13", + "alias": "forms", + "description": "Username, password, otp and other auth forms.", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "auth-username-password-form", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-otp-form", + "requirement": "OPTIONAL", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "5af7f92b-06d6-4aa4-861d-edbeb917ad8f", + "alias": "http challenge", + "description": "An authentication flow based on challenge-response HTTP Authentication Schemes", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "no-cookie-redirect", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "basic-auth", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "basic-auth-otp", + "requirement": "DISABLED", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-spnego", + "requirement": "DISABLED", + "priority": 40, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "3829b8aa-55c8-401a-8684-88c36b74502a", + "alias": "registration", + "description": "registration flow", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "registration-page-form", + "requirement": "REQUIRED", + "priority": 10, + "flowAlias": "registration form", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "618d1456-42bb-4737-aa06-f5bde16480fc", + "alias": "registration form", + "description": "registration form", + "providerId": "form-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "registration-user-creation", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "registration-profile-action", + "requirement": "REQUIRED", + "priority": 40, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "registration-password-action", + "requirement": "REQUIRED", + "priority": 50, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "registration-recaptcha-action", + "requirement": "DISABLED", + "priority": 60, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "bdd6828c-026b-4a31-9b20-88c1816c7f08", + "alias": "reset credentials", + "description": "Reset credentials for a user if they forgot their password or something", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "reset-credentials-choose-user", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "reset-credential-email", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "reset-password", + "requirement": "REQUIRED", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "reset-otp", + "requirement": "OPTIONAL", + "priority": 40, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "98ff3c64-bf5e-4101-b218-6dc3b7717f2c", + "alias": "saml ecp", + "description": "SAML ECP Profile Authentication Flow", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "http-basic-authenticator", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + } + ], + "authenticatorConfig": [ + { + "id": "f0446a79-4b15-4c18-abe7-a316f984ece4", + "alias": "create unique user config", + "config": { + "require.password.update.after.registration": "false" + } + }, + { + "id": "3a38d4a4-dc5b-4020-9a94-64b61ad9c997", + "alias": "review profile config", + "config": { + "update.profile.on.first.login": "missing" + } + } + ], + "requiredActions": [ + { + "alias": "CONFIGURE_TOTP", + "name": "Configure OTP", + "providerId": "CONFIGURE_TOTP", + "enabled": true, + "defaultAction": false, + "priority": 10, + "config": {} + }, + { + "alias": "terms_and_conditions", + "name": "Terms and Conditions", + "providerId": "terms_and_conditions", + "enabled": false, + "defaultAction": false, + "priority": 20, + "config": {} + }, + { + "alias": "UPDATE_PASSWORD", + "name": "Update Password", + "providerId": "UPDATE_PASSWORD", + "enabled": true, + "defaultAction": false, + "priority": 30, + "config": {} + }, + { + "alias": "UPDATE_PROFILE", + "name": "Update Profile", + "providerId": "UPDATE_PROFILE", + "enabled": true, + "defaultAction": false, + "priority": 40, + "config": {} + }, + { + "alias": "VERIFY_EMAIL", + "name": "Verify Email", + "providerId": "VERIFY_EMAIL", + "enabled": true, + "defaultAction": false, + "priority": 50, + "config": {} + } + ], + "browserFlow": "browser", + "registrationFlow": "registration", + "directGrantFlow": "direct grant", + "resetCredentialsFlow": "reset credentials", + "clientAuthenticationFlow": "clients", + "dockerAuthenticationFlow": "docker auth", + "attributes": { + "_browser_header.xXSSProtection": "1; mode=block", + "_browser_header.xFrameOptions": "SAMEORIGIN", + "_browser_header.strictTransportSecurity": "max-age=31536000; includeSubDomains", + "permanentLockout": "false", + "quickLoginCheckMilliSeconds": "1000", + "displayName": "OHIF", + "_browser_header.xRobotsTag": "none", + "maxFailureWaitSeconds": "900", + "minimumQuickLoginWaitSeconds": "60", + "displayNameHtml": "
    OHIF
    ", + "failureFactor": "30", + "actionTokenGeneratedByUserLifespan": "300", + "maxDeltaTimeSeconds": "43200", + "_browser_header.xContentTypeOptions": "nosniff", + "offlineSessionMaxLifespan": "5184000", + "actionTokenGeneratedByAdminLifespan": "43200", + "_browser_header.contentSecurityPolicyReportOnly": "", + "bruteForceProtected": "false", + "_browser_header.contentSecurityPolicy": "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", + "waitIncrementSeconds": "60", + "offlineSessionMaxLifespanEnabled": "false" + }, + "keycloakVersion": "6.0.1", + "userManagedAccessAllowed": false +} diff --git a/docker/OpenResty-Orthanc-Keycloak/config/orthanc.json b/docker/OpenResty-Orthanc-Keycloak/config/orthanc.json new file mode 100644 index 000000000..2e10723c0 --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/config/orthanc.json @@ -0,0 +1,89 @@ +{ + "Name": "Orthanc inside Docker", + "StorageDirectory": "/var/lib/orthanc/db", + "IndexDirectory": "/var/lib/orthanc/db", + "StorageCompression": false, + "MaximumStorageSize": 0, + "MaximumPatientCount": 0, + "LuaScripts": [], + "Plugins": ["/usr/share/orthanc/plugins", "/usr/local/share/orthanc/plugins"], + "ConcurrentJobs": 2, + "HttpServerEnabled": true, + "HttpPort": 8042, + "HttpDescribeErrors": true, + "HttpCompressionEnabled": true, + "DicomServerEnabled": true, + "DicomAet": "ORTHANC", + "DicomCheckCalledAet": false, + "DicomPort": 4242, + "DefaultEncoding": "Latin1", + "DeflatedTransferSyntaxAccepted": true, + "JpegTransferSyntaxAccepted": true, + "Jpeg2000TransferSyntaxAccepted": true, + "JpegLosslessTransferSyntaxAccepted": true, + "JpipTransferSyntaxAccepted": true, + "Mpeg2TransferSyntaxAccepted": true, + "RleTransferSyntaxAccepted": true, + "UnknownSopClassAccepted": false, + "DicomScpTimeout": 30, + + "RemoteAccessAllowed": true, + "SslEnabled": false, + "SslCertificate": "certificate.pem", + "AuthenticationEnabled": false, + "RegisteredUsers": { + "test": "test" + }, + "DicomModalities": {}, + "DicomModalitiesInDatabase": false, + "DicomAlwaysAllowEcho": true, + "DicomAlwaysAllowStore": true, + "DicomCheckModalityHost": false, + "DicomScuTimeout": 10, + "OrthancPeers": {}, + "OrthancPeersInDatabase": false, + "HttpProxy": "", + + "HttpVerbose": true, + + "HttpTimeout": 10, + "HttpsVerifyPeers": true, + "HttpsCACertificates": "", + "UserMetadata": {}, + "UserContentType": {}, + "StableAge": 60, + "StrictAetComparison": false, + "StoreMD5ForAttachments": true, + "LimitFindResults": 0, + "LimitFindInstances": 0, + "LimitJobs": 10, + "LogExportedResources": false, + "KeepAlive": true, + "TcpNoDelay": true, + "HttpThreadsCount": 50, + "StoreDicom": true, + "DicomAssociationCloseDelay": 5, + "QueryRetrieveSize": 10, + "CaseSensitivePN": false, + "LoadPrivateDictionary": true, + "Dictionary": {}, + "SynchronousCMove": true, + "JobsHistorySize": 10, + "SaveJobs": true, + "OverwriteInstances": false, + "MediaArchiveSize": 1, + "StorageAccessOnFind": "Always", + "MetricsEnabled": true, + + "DicomWeb": { + "Enable": true, + "Root": "/dicom-web/", + "EnableWado": true, + "WadoRoot": "/wado", + "Host": "127.0.0.1", + "Ssl": false, + "StowMaxInstances": 10, + "StowMaxSize": 10, + "QidoCaseSensitive": false + } +} diff --git a/docker/OpenResty-Orthanc-Keycloak/docker-compose.yml b/docker/OpenResty-Orthanc-Keycloak/docker-compose.yml new file mode 100644 index 000000000..771737f3c --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/docker-compose.yml @@ -0,0 +1,95 @@ +# Reference: +# - https://docs.docker.com/compose/compose-file +# - https://eclipsesource.com/blogs/2018/01/11/authenticating-reverse-proxy-with-keycloak/ + +version: '3.5' + +services: + # Exposed server that's handling incoming web requests + # Underlying image: openresty/openresty:alpine-fat + ohif_viewer: + build: + # Project root + context: ./../../ + # Relative to context + dockerfile: ./docker/OpenResty-Orthanc-Keycloak/dockerfile + image: webapp:latest + container_name: webapp + volumes: + # Nginx config + - ./config/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro + # Logs + - ./logs/nginx:/var/logs/nginx + # Let's Encrypt + # - letsencrypt_certificates:/etc/letsencrypt + # - letsencrypt_challenges:/var/www/letsencrypt + ports: + - '443:443' # SSL + - '80:80' # Web + depends_on: + - keycloak + - orthanc + restart: on-failure + + # LINK: https://hub.docker.com/r/jodogne/orthanc-plugins/ + # TODO: Update to use Postgres + # https://github.com/mrts/docker-postgresql-multiple-databases + orthanc: + image: jodogne/orthanc-plugins:1.5.6 + hostname: orthanc + container_name: orthanc + volumes: + # Config + - ./config/orthanc.json:/etc/orthanc/orthanc.json:ro + # Persist data + - ./volumes/orthanc-db/:/var/lib/orthanc/db/ + restart: unless-stopped + + # LINK: https://hub.docker.com/r/jboss/keycloak + keycloak: + image: jboss/keycloak:6.0.1 + hostname: keycloak + container_name: keycloak + volumes: + # Theme: https://www.keycloak.org/docs/latest/server_development/index.html#_themes + - ./volumes/keycloak-themes/ohif:/opt/jboss/keycloak/themes/ohif + # Previous Realm Config + - ./config/ohif-keycloak-realm.json:/tmp/ohif-keycloak-realm.json + environment: + # Database + DB_VENDOR: postgres + DB_ADDR: postgres + DB_PORT: 5432 + DB_DATABASE: keycloak + DB_SCHEMA: public + DB_USER: keycloak + DB_PASSWORD: password + # Keycloak + KEYCLOAK_USER: admin + KEYCLOAK_PASSWORD: password + KEYCLOAK_IMPORT: /tmp/ohif-keycloak-realm.json + # KEYCLOAK_WELCOME_THEME: + # KEYCLOAK_DEFAULT_THEME: + # KEYCLOAK_HOSTNAME: (recommended in prod) + # KEYCLOAK_LOGLEVEL: DEBUG + PROXY_ADDRESS_FORWARDING: 'true' + depends_on: + - postgres + restart: unless-stopped + + # LINK: https://hub.docker.com/_/postgres/ + postgres: + image: postgres:11.2 + hostname: postgres + container_name: postgres + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + POSTGRES_DB: keycloak + POSTGRES_USER: keycloak + POSTGRES_PASSWORD: password + restart: unless-stopped + +volumes: + postgres_data: + driver: local diff --git a/docker/OpenResty-Orthanc-Keycloak/dockerfile b/docker/OpenResty-Orthanc-Keycloak/dockerfile new file mode 100644 index 000000000..6019d6790 --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/dockerfile @@ -0,0 +1,65 @@ +# docker-compose +# -------------- +# This dockerfile is used by the `docker-compose.yml` adjacent file. When +# running `docker-compose build`, this dockerfile helps build the "webapp" image. +# All paths are relative to the `context`, which is the project root directory. +# +# docker build +# -------------- +# If you would like to use this dockerfile to build and tag an image, make sure +# you set the context to the project's root directory: +# https://docs.docker.com/engine/reference/commandline/build/ +# +# +# SUMMARY +# -------------- +# This dockerfile has two stages: +# +# 1. Building the React application for production +# 2. Setting up our Nginx (OpenResty*) image w/ step one's output +# +# * OpenResty is functionally identical to Nginx with the addition of Lua out of +# the box. + + +# Stage 1: Build the application +FROM node:11.2.0-slim as builder + +RUN mkdir /usr/src/app +WORKDIR /usr/src/app + +ENV REACT_APP_CONFIG=config/docker_openresty-orthanc-keycloak.js +ENV PATH /usr/src/app/node_modules/.bin:$PATH + +COPY package.json /usr/src/app/package.json +COPY yarn.lock /usr/src/app/yarn.lock + +ADD . /usr/src/app/ +RUN yarn install +RUN yarn run build:web + +# Stage 2: Bundle the built application into a Docker container +# which runs openresty (nginx) using Alpine Linux +# LINK: https://hub.docker.com/r/openresty/openresty +FROM openresty/openresty:1.15.8.1rc1-0-alpine-fat + +RUN mkdir /var/log/nginx +RUN apk add --no-cache openssl +RUN apk add --no-cache openssl-dev +RUN apk add --no-cache git +RUN apk add --no-cache gcc +# !!! +RUN luarocks install lua-resty-openidc + +# +RUN luarocks install lua-resty-jwt +RUN luarocks install lua-resty-session +RUN luarocks install lua-resty-http +# !!! +RUN luarocks install lua-resty-openidc +RUN luarocks install luacrypto + +# Copy build output to image +COPY --from=builder /usr/src/app/build /var/www/html + +ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"] diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/account/.githold b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/account/.githold new file mode 100644 index 000000000..e69de29bb diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/admin/.githold b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/admin/.githold new file mode 100644 index 000000000..e69de29bb diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/email/.githold b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/email/.githold new file mode 100644 index 000000000..e69de29bb diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/resources/css/styles.css b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/resources/css/styles.css new file mode 100644 index 000000000..5b5f0b9be --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/resources/css/styles.css @@ -0,0 +1,212 @@ +body { + background-color: #040507; + background-image: url('../img/background.jpg'); + background-size: cover; + background-repeat: no-repeat; + + width: 100vw; + height: 100vh; + overflow: hidden; + + color: #fff; + font-family: sans-serif; + text-shadow: 0px 0px 10px #000; +} + +a { + color: #fff; +} + +div#kc-content { + position: absolute; + top: 20%; + left: 50%; + width: 550px; + margin-left: -180px; +} + +div#kc-form { + float: left; + width: 350px; +} + +div#kc-form label { + display: block; + font-size: 16px; +} + +div#info-area { + position: fixed; + bottom: 0; + left: 0; + margin-top: 40px; + background-color: rgba(0, 0, 0, 0.4); + padding: 20px; + width: 100%; +} + +div#info-area p { + margin-right: 30px; + display: inline; + text-shadow: none; +} + +input[type='text'], +input[type='password'] { + color: #333; + font-size: 18px; + margin-bottom: 20px; + background-color: rgba(256, 256, 256, 0.7); + border: 0px solid rgba(0, 0, 0, 0.2); + box-shadow: inset 0 0 2px 2px rgba(0, 0, 0, 0.15); + padding: 10px; + width: 296px; +} + +input[type='text']:hover, +input[type='password']:hover { + background-color: rgba(256, 256, 256, 0.9); +} + +input[type='submit'] { + border: none; + + background: -webkit-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ); + background: -moz-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ); + background: -ms-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ); + background: -o-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ); + + box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.5); + + color: rgba(0, 0, 0, 0.6); + + font-size: 14px; + font-weight: bold; + + padding: 10px; + margin-top: 20px; + margin-right: 10px; + width: 150px; +} + +input[type='submit']:hover { + background-color: rgba(255, 255, 255, 0.8); +} + +div#kc-form-options div { + display: inline-block; + margin-right: 20px; + font-size: 12px; +} + +div#kc-form-options div label { + font-size: 12px; +} + +div#kc-feedback { + box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.5); + position: fixed; + top: 0; + left: 0; + width: 100%; + text-align: center; +} + +div#kc-feedback-wrapper { + padding: 1em; +} + +div.feedback-success { + background-color: rgba(155, 155, 255, 0.1); +} + +div.feedback-warning { + background-color: rgba(255, 175, 0, 0.1); +} + +div.feedback-error { + background-color: rgba(255, 0, 0, 0.1); +} + +div#kc-header { + display: none; +} + +div#kc-registration { + margin-bottom: 20px; +} + +div#social-login { + border-left: 1px solid rgba(255, 255, 255, 0.2); + float: right; + width: 150px; + padding: 20px 0 200px 40px; +} + +div.social-login span { + display: none; +} + +div#kc-social-providers ul { + list-style: none; + margin: 0; + padding: 0; +} + +div#kc-social-providers ul li { + margin-bottom: 20px; +} + +div#kc-social-providers ul li span { + display: inline; + width: 100px; +} + +a.zocial { + border: none; + background: -webkit-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ) !important; + background: -moz-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ) !important; + background: -ms-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ) !important; + background: -o-linear-gradient( + top, + rgba(255, 255, 255, 0.8), + rgba(255, 255, 255, 0.1) + ) !important; + box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.5); + color: rgba(0, 0, 0, 0.6); + width: 130px; + text-shadow: none; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + padding-top: 0.2em; + padding-bottom: 0.2em; +} diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/resources/img/background.jpg b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/resources/img/background.jpg new file mode 100644 index 000000000..9d4f940bd Binary files /dev/null and b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/resources/img/background.jpg differ diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/theme.properties b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/theme.properties new file mode 100644 index 000000000..512f13be2 --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/login/theme.properties @@ -0,0 +1,3 @@ +parent=base +import=common/keycloak +styles=lib/zocial/zocial.css css/styles.css diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/welcome/.githold b/docker/OpenResty-Orthanc-Keycloak/volumes/keycloak-themes/ohif/welcome/.githold new file mode 100644 index 000000000..e69de29bb diff --git a/docker/OpenResty-Orthanc-Keycloak/volumes/orthanc-db/.gitignore b/docker/OpenResty-Orthanc-Keycloak/volumes/orthanc-db/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/docker/OpenResty-Orthanc-Keycloak/volumes/orthanc-db/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/docker/OpenResty-Orthanc/.dockerignore b/docker/OpenResty-Orthanc/.dockerignore new file mode 100644 index 000000000..67f1b2e98 --- /dev/null +++ b/docker/OpenResty-Orthanc/.dockerignore @@ -0,0 +1,16 @@ +# Output +dist/ + +# Dependencies +node_modules/ + +# Root +README.md +Dockerfile + +# Misc. Config +.git +.DS_Store +.gitignore +.vscode +.circleci diff --git a/docker/OpenResty-Orthanc/.env b/docker/OpenResty-Orthanc/.env new file mode 100644 index 000000000..6989ff3fc --- /dev/null +++ b/docker/OpenResty-Orthanc/.env @@ -0,0 +1,5 @@ +# Docker ENV and ARG Variables +# ---------------------------- +# https://vsupalov.com/docker-arg-env-variable-guide/ +# +# diff --git a/docker/OpenResty-Orthanc/config/nginx.conf b/docker/OpenResty-Orthanc/config/nginx.conf new file mode 100644 index 000000000..777e49703 --- /dev/null +++ b/docker/OpenResty-Orthanc/config/nginx.conf @@ -0,0 +1,135 @@ +worker_processes 2; +error_log /var/logs/nginx/mydomain.error.log; +pid /var/run/nginx.pid; +include /usr/share/nginx/modules/*.conf; # See /usr/share/doc/nginx/README.dynamic. + +events { + worker_connections 1024; ## Default: 1024 + use epoll; # http://nginx.org/en/docs/events.html + multi_accept on; # http://nginx.org/en/docs/ngx_core_module.html#multi_accept +} + +# Core Modules Docs: +# http://nginx.org/en/docs/http/ngx_http_core_module.html +http { + include '/usr/local/openresty/nginx/conf/mime.types'; + default_type application/octet-stream; + + keepalive_timeout 65; + keepalive_requests 100000; + tcp_nopush on; + tcp_nodelay on; + + # lua_ settings + # + lua_package_path '/usr/local/openresty/lualib/?.lua;;'; + lua_shared_dict discovery 1m; # cache for discovery metadata documents + lua_shared_dict jwks 1m; # cache for JWKs + # lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt; + + variables_hash_max_size 2048; + server_names_hash_bucket_size 128; + server_tokens off; + + resolver 8.8.8.8 valid=30s ipv6=off; + resolver_timeout 11s; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + # Nginx `listener` block + server { + listen [::]:80 default_server; + listen 80; + # listen 443 ssl; + access_log /var/logs/nginx/mydomain.access.log; + + # Domain to protect + server_name 127.0.0.1 localhost; # mydomain.com; + proxy_intercept_errors off; + # ssl_certificate /etc/letsencrypt/live/mydomain.co.uk/fullchain.pem; + # ssl_certificate_key /etc/letsencrypt/live/mydomain.co.uk/privkey.pem; + gzip on; + gzip_types text/css application/javascript application/json image/svg+xml; + gzip_comp_level 9; + etag on; + + # https://github.com/bungle/lua-resty-session/issues/15 + set $session_check_ssi off; + lua_code_cache off; + set $session_secret Eeko7aeb6iu5Wohch9Loo1aitha0ahd1; + set $session_storage cookie; + + server_tokens off; # Hides server version num + + # Reverse Proxy for `orthanc` admin + # + location /pacs-admin/ { + + proxy_http_version 1.1; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + expires 0; + add_header Cache-Control private; + + proxy_pass http://orthanc:8042/; + } + + # Reverse Proxy for `orthanc` APIs (including DICOMWeb) + # + location /pacs/ { + + proxy_http_version 1.1; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + expires 0; + add_header Cache-Control private; + + proxy_pass http://orthanc:8042/; + + # By default, this endpoint is protected by CORS (cross-origin-resource-sharing) + # You can add headers to allow other domains to request this resource. + # See the "Updating CORS Settings" example below + } + + # Do not cache sw.js, required for offline-first updates. + location /sw.js { + add_header Cache-Control "no-cache"; + proxy_cache_bypass $http_pragma; + proxy_cache_revalidate on; + expires off; + access_log off; + } + + # Single Page App + # Try files, fallback to index.html + # + location / { + alias /var/www/html/; + index index.html; + try_files $uri $uri/ /index.html; + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + # EXAMPLE: Redirect server error pages to the static page /40x.html + # + # error_page 404 /404.html; + # location = /40x.html { + # } + + # EXAMPLE: Redirect server error pages to the static page /50x.html + # + # error_page 500 502 503 504 /50x.html; + # location = /50x.html { + # } + } +} diff --git a/docker/OpenResty-Orthanc/config/orthanc.json b/docker/OpenResty-Orthanc/config/orthanc.json new file mode 100644 index 000000000..2e10723c0 --- /dev/null +++ b/docker/OpenResty-Orthanc/config/orthanc.json @@ -0,0 +1,89 @@ +{ + "Name": "Orthanc inside Docker", + "StorageDirectory": "/var/lib/orthanc/db", + "IndexDirectory": "/var/lib/orthanc/db", + "StorageCompression": false, + "MaximumStorageSize": 0, + "MaximumPatientCount": 0, + "LuaScripts": [], + "Plugins": ["/usr/share/orthanc/plugins", "/usr/local/share/orthanc/plugins"], + "ConcurrentJobs": 2, + "HttpServerEnabled": true, + "HttpPort": 8042, + "HttpDescribeErrors": true, + "HttpCompressionEnabled": true, + "DicomServerEnabled": true, + "DicomAet": "ORTHANC", + "DicomCheckCalledAet": false, + "DicomPort": 4242, + "DefaultEncoding": "Latin1", + "DeflatedTransferSyntaxAccepted": true, + "JpegTransferSyntaxAccepted": true, + "Jpeg2000TransferSyntaxAccepted": true, + "JpegLosslessTransferSyntaxAccepted": true, + "JpipTransferSyntaxAccepted": true, + "Mpeg2TransferSyntaxAccepted": true, + "RleTransferSyntaxAccepted": true, + "UnknownSopClassAccepted": false, + "DicomScpTimeout": 30, + + "RemoteAccessAllowed": true, + "SslEnabled": false, + "SslCertificate": "certificate.pem", + "AuthenticationEnabled": false, + "RegisteredUsers": { + "test": "test" + }, + "DicomModalities": {}, + "DicomModalitiesInDatabase": false, + "DicomAlwaysAllowEcho": true, + "DicomAlwaysAllowStore": true, + "DicomCheckModalityHost": false, + "DicomScuTimeout": 10, + "OrthancPeers": {}, + "OrthancPeersInDatabase": false, + "HttpProxy": "", + + "HttpVerbose": true, + + "HttpTimeout": 10, + "HttpsVerifyPeers": true, + "HttpsCACertificates": "", + "UserMetadata": {}, + "UserContentType": {}, + "StableAge": 60, + "StrictAetComparison": false, + "StoreMD5ForAttachments": true, + "LimitFindResults": 0, + "LimitFindInstances": 0, + "LimitJobs": 10, + "LogExportedResources": false, + "KeepAlive": true, + "TcpNoDelay": true, + "HttpThreadsCount": 50, + "StoreDicom": true, + "DicomAssociationCloseDelay": 5, + "QueryRetrieveSize": 10, + "CaseSensitivePN": false, + "LoadPrivateDictionary": true, + "Dictionary": {}, + "SynchronousCMove": true, + "JobsHistorySize": 10, + "SaveJobs": true, + "OverwriteInstances": false, + "MediaArchiveSize": 1, + "StorageAccessOnFind": "Always", + "MetricsEnabled": true, + + "DicomWeb": { + "Enable": true, + "Root": "/dicom-web/", + "EnableWado": true, + "WadoRoot": "/wado", + "Host": "127.0.0.1", + "Ssl": false, + "StowMaxInstances": 10, + "StowMaxSize": 10, + "QidoCaseSensitive": false + } +} diff --git a/docker/OpenResty-Orthanc/docker-compose.yml b/docker/OpenResty-Orthanc/docker-compose.yml new file mode 100644 index 000000000..0b6487c8a --- /dev/null +++ b/docker/OpenResty-Orthanc/docker-compose.yml @@ -0,0 +1,45 @@ +# Reference: +# - https://docs.docker.com/compose/compose-file +# - https://eclipsesource.com/blogs/2018/01/11/authenticating-reverse-proxy-with-keycloak/ + +version: '3.5' + +services: + # Exposed server that's handling incoming web requests + # Underlying image: openresty/openresty:alpine-fat + ohif_viewer: + build: + # Project root + context: ./../../ + # Relative to context + dockerfile: ./docker/OpenResty-Orthanc/dockerfile + image: webapp:latest + container_name: webapp + volumes: + # Nginx config + - ./config/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro + # Logs + - ./logs/nginx:/var/logs/nginx + # Let's Encrypt + # - letsencrypt_certificates:/etc/letsencrypt + # - letsencrypt_challenges:/var/www/letsencrypt + ports: + - '443:443' # SSL + - '80:80' # Web + depends_on: + - orthanc + restart: on-failure + + # LINK: https://hub.docker.com/r/jodogne/orthanc-plugins/ + # TODO: Update to use Postgres + # https://github.com/mrts/docker-postgresql-multiple-databases + orthanc: + image: jodogne/orthanc-plugins:1.5.6 + hostname: orthanc + container_name: orthanc + volumes: + # Config + - ./config/orthanc.json:/etc/orthanc/orthanc.json:ro + # Persist data + - ./volumes/orthanc-db/:/var/lib/orthanc/db/ + restart: unless-stopped diff --git a/docker/OpenResty-Orthanc/dockerfile b/docker/OpenResty-Orthanc/dockerfile new file mode 100644 index 000000000..6b96885cf --- /dev/null +++ b/docker/OpenResty-Orthanc/dockerfile @@ -0,0 +1,65 @@ +# docker-compose +# -------------- +# This dockerfile is used by the `docker-compose.yml` adjacent file. When +# running `docker-compose build`, this dockerfile helps build the "webapp" image. +# All paths are relative to the `context`, which is the project root directory. +# +# docker build +# -------------- +# If you would like to use this dockerfile to build and tag an image, make sure +# you set the context to the project's root directory: +# https://docs.docker.com/engine/reference/commandline/build/ +# +# +# SUMMARY +# -------------- +# This dockerfile has two stages: +# +# 1. Building the React application for production +# 2. Setting up our Nginx (OpenResty*) image w/ step one's output +# +# * OpenResty is functionally identical to Nginx with the addition of Lua out of +# the box. + + +# Stage 1: Build the application +FROM node:11.2.0-slim as builder + +RUN mkdir /usr/src/app +WORKDIR /usr/src/app + +ENV REACT_APP_CONFIG=config/docker_openresty-orthanc.js +ENV PATH /usr/src/app/node_modules/.bin:$PATH + +COPY package.json /usr/src/app/package.json +COPY yarn.lock /usr/src/app/yarn.lock + +ADD . /usr/src/app/ +RUN yarn install +RUN yarn run build:web + +# Stage 2: Bundle the built application into a Docker container +# which runs openresty (nginx) using Alpine Linux +# LINK: https://hub.docker.com/r/openresty/openresty +FROM openresty/openresty:1.15.8.1rc1-0-alpine-fat + +RUN mkdir /var/log/nginx +RUN apk add --no-cache openssl +RUN apk add --no-cache openssl-dev +RUN apk add --no-cache git +RUN apk add --no-cache gcc +# !!! +RUN luarocks install lua-resty-openidc + +# +RUN luarocks install lua-resty-jwt +RUN luarocks install lua-resty-session +RUN luarocks install lua-resty-http +# !!! +RUN luarocks install lua-resty-openidc +RUN luarocks install luacrypto + +# Copy build output to image +COPY --from=builder /usr/src/app/build /var/www/html + +ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"] diff --git a/docker/OpenResty-Orthanc/volumes/orthanc-db/.gitignore b/docker/OpenResty-Orthanc/volumes/orthanc-db/.gitignore new file mode 100644 index 000000000..d6b7ef32c --- /dev/null +++ b/docker/OpenResty-Orthanc/volumes/orthanc-db/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..260bd7d57 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,53 @@ +# Docker compose files + +This folder contains docker-compose files used to spin up OHIF-Viewer with +differnt options such as locally or with any PAS you desire to + +## Public Server + +#### build + +`$ docker-compose -f docker-compose-publicserver.yml build` + +#### run + +`$ docker-compose -f docker-compose-publicserver.yml up -d` + +then, access the application at [http://localhost](http://localhost) + +## Local Orthanc + +### Build + +`$ docker-compose -f docker-compose-orthanc.yml build` + +### Run + +Starts containers and leaves them running in the background. + +`$ docker-compose -f docker-compose-orthanc.yml up -d` + +then, access the application at [http://localhost](http://localhost) + +**remember that you have to access orthanc application and include your studies +there** + +## Local Dcm4chee + +#### build + +`$ docker-compose -f docker-compose-dcm4chee.yml build` + +#### run + +`$ docker-compose -f docker-compose-dcm4chee.yml up -d` + +then, access the application at [http://localhost](http://localhost) + +**remember that you have to access dcm4chee application and include your studies +there** You can use the following command to import your studies into dcm4che + +`$ docker run -v {YOUR_STUDY_FOLDER}:/tmp --rm --network=docker_dcm4che_default dcm4che/dcm4che-tools:5.14.0 storescu -cDCM4CHEE@arc:11112 /tmp` + +**make sure that your Docker network name is docker_dcm4chee_default or change +it to the right one** diff --git a/dockerfile b/dockerfile deleted file mode 100644 index 90be9c616..000000000 --- a/dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -# First stage of multi-stage build -# Installs Meteor and builds node.js version -# This stage is named 'builder' -# The data for this intermediary image is not included -# in the final image. -FROM node:8.10.0-slim as builder - -# Fix build now that jessie-updates has been archived -RUN sed -i '/jessie-updates/d' /etc/apt/sources.list -RUN apt-get update && apt-get install -y \ - curl \ - g++ \ - git \ - python \ - build-essential - -RUN curl https://install.meteor.com/ | sh - -# Create a non-root user -RUN useradd -ms /bin/bash user -USER user -RUN mkdir /home/user/Viewers -COPY OHIFViewer/package.json /home/user/Viewers/OHIFViewer/ -ADD --chown=user:user . /home/user/Viewers - -WORKDIR /home/user/Viewers/OHIFViewer - -ENV METEOR_PACKAGE_DIRS=../Packages -ENV METEOR_PROFILE=1 -RUN meteor npm install -RUN meteor build --directory /home/user/app -WORKDIR /home/user/app/bundle/programs/server -RUN npm install --production - -# Second stage of multi-stage build -# Creates a slim production image for the node.js application -FROM node:8.10.0-slim - -RUN npm install -g pm2 - -WORKDIR /app -COPY --from=builder /home/user/app . -COPY dockersupport/app.json . - -ENV ROOT_URL http://localhost:3000 -ENV PORT 3000 -ENV NODE_ENV production - -EXPOSE 3000 - -CMD ["pm2-runtime", "app.json"] diff --git a/dockerfile-web b/dockerfile-web new file mode 100644 index 000000000..23c027cfe --- /dev/null +++ b/dockerfile-web @@ -0,0 +1,25 @@ +# Stage 1: Build the application +# docker build -t ohif/viewer:latest . +FROM node:11.2.0-slim as builder + +# RUN apt-get update && apt-get install -y git yarn +RUN mkdir /usr/src/app +WORKDIR /usr/src/app + +ENV PATH /usr/src/app/node_modules/.bin:$PATH + +COPY package.json /usr/src/app/package.json +COPY yarn.lock /usr/src/app/yarn.lock + +ADD . /usr/src/app/ +RUN yarn install +RUN yarn run build:web + +# # Stage 2: Bundle the built application into a Docker container +# # which runs Nginx using Alpine Linux +FROM nginx:1.15.5-alpine +RUN rm -rf /etc/nginx/conf.d +COPY conf /etc/nginx +COPY --from=builder /usr/src/app/build /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/dockersupport/app.json b/dockersupport/app.json deleted file mode 100644 index 1d5ab185c..000000000 --- a/dockersupport/app.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "apps" : [{ - "name" : "ohif-viewer", - "script" : "main.js", - "watch" : true, - "merge_logs" : true, - "cwd" : "/app/bundle/", - "env": { - "METEOR_SETTINGS": { - "servers": { - "dicomWeb": [ - { - "name": "Orthanc", - "wadoUriRoot": "http://pacsIP:8042/wado", - "qidoRoot": "http://pacsIP:8042/dicom-web", - "wadoRoot": "http://pacsIP:8042/dicom-web", - "qidoSupportsIncludeField": false, - "imageRendering": "wadouri", - "thumbnailRendering": "wadouri", - "requestOptions": { - "auth": "orthanc:orthanc", - "logRequests": true, - "logResponses": false, - "logTiming": true - } - } - ] - }, - "defaultServiceType": "dicomWeb", - "public": { - "ui": { - "studyListDateFilterNumDays": 1 - } - }, - "proxy": { - "enabled": true - } - } - } - }] -} \ No newline at end of file diff --git a/dockersupport/settings.json b/dockersupport/settings.json deleted file mode 100644 index c54e5c5d6..000000000 --- a/dockersupport/settings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ -"servers": { - "dicomWeb": [ - { - "name": "Orthanc", - "wadoUriRoot": "http://pacsIP:8042/wado", - "qidoRoot": "http://pacsIP:8042/dicom-web", - "wadoRoot": "http://pacsIP:8042/dicom-web", - "qidoSupportsIncludeField": false, - "imageRendering": "wadouri", - "thumbnailRendering": "wadouri", - "requestOptions": { - "auth": "orthanc:orthanc", - "logRequests": true, - "logResponses": false, - "logTiming": true - } - } - ] - }, - "defaultServiceType": "dicomWeb", - "public": { - "ui": { - "studyListDateFilterNumDays": 1 - } - }, - "proxy": { - "enabled": true - } -} \ No newline at end of file diff --git a/dockersupport/viewer-google-cloud/Dockerfile b/dockersupport/viewer-google-cloud/Dockerfile deleted file mode 100644 index 9b925ad81..000000000 --- a/dockersupport/viewer-google-cloud/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM nginx:stable-alpine-perl -COPY nginx.conf /etc/nginx/nginx.conf -COPY build /usr/share/nginx/html/ diff --git a/dockersupport/viewer-google-cloud/README.md b/dockersupport/viewer-google-cloud/README.md deleted file mode 100644 index 0180ca4d9..000000000 --- a/dockersupport/viewer-google-cloud/README.md +++ /dev/null @@ -1,34 +0,0 @@ -This folder contains the instructions for building the ohif/viewer-google-cloud Docker container. - -1. [Install Meteor](https://www.meteor.com/install) -1. Clone the repository -```bash -git clone https://github.com/OHIF/Viewers.git -cd Viewers -``` - -1. Install meteor-build-client-fixed2 so you can build the Standalone Viewer - -```bash -npm install -g meteor-build-client-fixed2 -``` - -1. Build the Standalone client-only OHIF Viewer - -```bash -cd OHIFViewer/ -METEOR_PACKAGE_DIRS="../Packages" meteor-build-client ../dockersupport/viewer-google-cloud/build -s ../config/oidc.json -``` - -1. Build the Docker image - -```bash -cd ../dockersupport/viewer-google-cloud -docker build -t ohif/viewer-google-cloud . -``` - -1. Run the Docker image using an OAuth Client ID - -```bash -docker run --env CLIENT_ID={$someID}.apps.googleusercontent.com --publish 3000:80 ohif/viewer-google-cloud -``` diff --git a/dockersupport/viewer-google-cloud/nginx.conf b/dockersupport/viewer-google-cloud/nginx.conf deleted file mode 100644 index db5518a7f..000000000 --- a/dockersupport/viewer-google-cloud/nginx.conf +++ /dev/null @@ -1,44 +0,0 @@ -worker_processes 1; -load_module modules/ngx_http_perl_module.so; -events { - worker_connections 1024; -} -env CLIENT_ID; -http { - include mime.types; - default_type application/octet-stream; - perl_set $client_id 'sub { return $ENV{"CLIENT_ID"}; }'; - - sendfile on; - keepalive_timeout 65; - - access_log off; - error_log off; - - server { - listen 80; - root /usr/share/nginx/html; - - location / { - try_files $uri @index; - } - - location @index { - add_header Cache-Control no-cache; - expires 0; - try_files /index.html =404; - } - - location ~ /(favicon.ico|favicon.png|robots.txt)$ { - expires 1y; - access_log off; - log_not_found off; - } - - location /gcloud-client-id { - return 200 '${client_id}'; - } - } -} - - diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 000000000..8bec8ec32 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +_book/ \ No newline at end of file diff --git a/docs/assets/CNAME b/docs/CNAME similarity index 100% rename from docs/assets/CNAME rename to docs/CNAME diff --git a/docs/README.md b/docs/README.md index e5ba8e9aa..1d31fbe36 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,28 +1,46 @@ -##### Looking for your Deploy Preview? -
    Deploy Preview for Viewer +# How To: Documentation Step-by-Step -# Introduction +We use [GitBook](https://www.gitbook.com/) to create our documentation. It primarily uses markdown, html, css, js, misc. plugins, and configuration to generate high quality, easy to read, and easy to maintain documentation. -The [Open Health Imaging Foundation](https://www.ohif.org) is developing an open source framework for constructing web-based medical imaging applications. The application framework is built using modern HTML / CSS / JavaScript and uses [Cornerstone](https://cornerstonejs.org/) at its core to display and manipulate medical images. It is built with Meteor, a Node.js-based full-stack JavaScript platform. +## Getting Started -This documentation concerns the OHIF framework itself and its three example applications: the OHIF Viewer, Lesion Tracker, and the Standalone Viewer. +_Requirements:_ -## The **OHIF Viewer**: A general purpose DICOM Viewer ([demo](http://viewer.ohif.org/)) +Make sure you have the [`gitbook-cli`](https://www.npmjs.com/package/gitbook-cli) installed globally: -![OHIF Viewer Screenshot](../assets/img/viewer.png) +> `npm install -g gitbook-cli` -The Open Health Imaging Foundation intends to provide a simple general purpose DICOM Viewer which can be easily extended for specific uses. The primary purpose of the OHIF Viewer is to serve as a testing ground for the underlying packages and the [Cornerstone](https://cornerstonejs.org/) family of libraries. +### Editing and Previewing Changes -## **Lesion Tracker**: An oncology-focused imaging application ([demo](http://lesiontracker.ohif.org/)) +Currently, you can only edit and preview a single "book" at a time. We maintain one "book" per API major version. You can find each version's book at: -![Lesion Tracker Screenshot](../assets/img/lesionTracker.png) +_Past Versions:_ -The Lesion Tracker is designed to facilitate quantitative assessments of tumour burden over time. It is similar in scope to the ePAD Imaging Platform (https://epad.stanford.edu/), developed at Stanford Medicine. +- Template: + - `/docs/v` +- Examples: + - `/docs/v1` + - `/docs/v2` -## Study List & DICOM Connectivity -![Study List Screenshot](../assets/img/worklist.png) +_Latest Version:_ -The solution provides a study list and other resources for connecting to PACS and other Image Archives through standard communication approaches (DICOM Web, DICOM Messages). +The latest version will always be located in `/docs/latest` -## Standalone Viewer ([demo](ohif-viewer.s3-website.eu-central-1.amazonaws.com/?url=https://raw.githubusercontent.com/OHIF/Viewers/master/StandaloneViewer/etc/sampleDICOM.json)) +_Live Preview:_ -The Standalone Viewer offers only the client-side portions of the OHIF Viewer with the Study List pages removed. This single-page viewer can be hosted as a static site (e.g. on Amazon S3, Azure Blob Storage, or Github Pages), and easily integrated with existing back-end DICOM storage systems. Alternative [Cornerstone](https://cornerstonejs.org/) Image Loaders can be included to allow your viewer to support non-DICOM objects (e.g. PNG, JPEG). +In your terminal / command prompt: + +```bash +cd /docs/latest +gitbook install +gitbook serve +``` + +Which should generate output like: + +> starting server... +> serving book on http://localhost:4000 + +Navigating to the the provided URL will show a preview of what the generated book should look like. Any edits you make to the book's markdown files should automatically update in your browser. + +### Publishing diff --git a/docs/latest/README.md b/docs/latest/README.md new file mode 100644 index 000000000..e97410df6 --- /dev/null +++ b/docs/latest/README.md @@ -0,0 +1,44 @@ +##### Looking for a Deploy Preview? - Deploy Preview for Viewer + +> ATTENTION! You are looking at the docs for the `React` version of the OHIF +> Viewer. If you're looking for the `Meteor` version's documentation (now +> deprecated), select it's version from the dropdown box in the top left corner +> of this page. + +# Introduction + +The [Open Health Imaging Foundation][ohif-org] (OHIF) Viewer is an open source, +web-based, medical imaging viewer. It can be configured to connect to Image +Archives that support [DicomWeb][dicom-web], and offers support for mapping to +proprietary API formats. OHIF maintained extensions add support for viewing, +annotating, and reporting on DICOM images in 2D (slices) and 3D (volumes). + +![OHIF Viewer Screenshot](../assets/img/viewer.png) + +
    The OHIF Viewer: A general purpose DICOM Viewer (Live Demo)
    + +The Open Health Imaging Foundation intends to provide a simple general purpose +DICOM Viewer which can be easily extended for specific uses. If you find +yourself unable to extend the viewer for your purposes, please reach out via our +[GitHub issues][gh-issues]. We are actively seeking feedback on ways to improve +our integration and extension points. + +## Where to Next? + +Check out these helpful links: + +- Ready to dive into some code? Check out our + [Getting Started Guide](./essentials/getting-started.md). +- We're an active, vibrant community. + [Learn how you can be more involved.](./contributing.md) +- Feeling lost? Read our [help page](./help.md). + + + + +[ohif-org]: https://www.ohif.org +[dicom-web]: https://en.wikipedia.org/wiki/DICOMweb +[gh-issues]: https://github.com/OHIF/Viewers/issues + diff --git a/docs/latest/SUMMARY.md b/docs/latest/SUMMARY.md new file mode 100644 index 000000000..7534de5f6 --- /dev/null +++ b/docs/latest/SUMMARY.md @@ -0,0 +1,49 @@ +# OHIF Viewers + +- Essentials + - [Getting Started](essentials/getting-started.md) + - [Installation](essentials/installation.md) + - [Data Source](essentials/data-source.md) + - [Configuration](essentials/configuration.md) + - [Themeing](essentials/themeing.md) + - [Troubleshooting](essentials/troubleshooting.md) +- [Scope of Project](essentials/scope-of-project.md) + +--- + +- [Advanced](advanced/index.md) +- [Architecture](advanced/architecture.md) + - [Overview](advanced/architecture.md#overview) + - [Business Logic](advanced/architecture.md#business-logic) + - [Component Library](advanced/architecture.md#react-component-library) + - [Extensions](advanced/architecture.md#misc-extensions) + - [Diagram](advanced/architecture.md#diagram) + - [Common Questions](advanced/architecture.md#common-questions) +- [Extensions](advanced/extensions.md) + - [Overview](advanced/extensions.md#overview) + - [Modules](advanced/extensions.md#modules) + - [Registering](advanced/extensions.md#registering-extensions) + - [OHIF Maintained](advanced/extensions.md#ohif-maintained-extensions) +- [Custom Tools](advanced/custom-tools.md) + +--- + +- [Deployment](deployment/index.md) + - [Embedded](deployment/index.md#embedded-viewer) + - [Stand-alone](deployment/index.md#stand-alone-viewer) + - [Data](deployment/index.md#data) +- Recipes + - Script Include + - [Embedding the Viewer](deployment/recipes/embedded-viewer.md) + - Stand-Alone + - [Build for Production](deployment/recipes/build-for-production.md) + - [Static](deployment/recipes/static-assets.md) + - [Nginx + Image Archive](deployment/recipes/nginx--image-archive.md) + - [User Account Control](deployment/recipes/user-account-control.md) + - [Google Cloud Healthcare](connecting-to-image-archives/google-cloud-healthcare.md) + +--- + +- [Contributing](contributing.md) +- [FAQ](frequently-asked-questions.md) +- [Help](help.md) diff --git a/docs/latest/advanced/_maintained-extensions-table.md b/docs/latest/advanced/_maintained-extensions-table.md new file mode 100644 index 000000000..41c0c60f7 --- /dev/null +++ b/docs/latest/advanced/_maintained-extensions-table.md @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ExtensionDescriptionModules
    + + Cornerstone + + + A viewport powered by cornerstone.js. Adds support for 2D DICOM rendering and manipulation, as well as support for the tools features in cornerstone-tools. Also adds "CINE Dialog" to the Toolbar. + Viewport, Toolbar
    + + VTK.js + + + A viewport powered by vtk.js. Adds support for volume renderings and advanced features like MPR. Also adds "3D Rotate" to the Toolbar. + Viewport, Toolbar
    + HTML + + Renders text and HTML content for specific SopClassUIDs. + Viewport, SopClassHandler
    + PDF + + Renders PDFs for a specific SopClassUID. + Viewport, SopClassHandler
    + Microscopy + + Renders Microscopy images for a specific SopClassUID. + Viewport, SopClassHandler
    \ No newline at end of file diff --git a/docs/latest/advanced/architecture.md b/docs/latest/advanced/architecture.md new file mode 100644 index 000000000..0d7e6007d --- /dev/null +++ b/docs/latest/advanced/architecture.md @@ -0,0 +1,100 @@ +# Architecture + +Looking to extend your instance of the OHIF Viewer? Want learn how to reuse _a +portion_ of the Viewer in your own application? Or maybe you want to get +involved and draft or suggest a new feature? Regardless, you're in the right +place! + +The OHIF Viewer aims to be decoupled, configurable, and extensible; while this +allows our code to be used in more ways, it also increases complexity. Below, we +aim to demistify that complexity by providing insight into how our Viewer is +architected, and the role each of it's dependent libraries plays. + +## Overview + +The [`OHIF/Viewers`](https://github.com/OHIF/Viewers/tree/react) repository +contains the source code for the OHIF Medical Imaging Viewer. It is effectively +a React +[progressive web app](https://developers.google.com/web/progressive-web-apps/) +(PWA) that combines the business logic housed in +[`OHIF/ohif-core`](https://github.com/OHIF/ohif-core) and the components in our +React Component library +[`OHIF/react-viewerbase`](https://github.com/OHIF/react-viewerbase). It provides +customization for common use cases through +[configuration](../essentials/configuration.md) and for adding functionality via +[extensions](./extensions.md). + +### Business Logic + +Our goal is to maintain the majority of our business logic in +[`OHIF/ohif-core`](https://github.com/OHIF/ohif-core). `ohif-core` offers +pre-packaged solutions for features common to Web-based medical imaging viewers. +For example: + +- Hotkeys +- DICOM Web +- Hanging Protocols +- Managing a study's measurements +- Managing a study's DICOM metadata +- A flexible pattern for extensions +- [And many others](https://github.com/OHIF/ohif-core/blob/master/src/index.js#L49-L69) + +It does this while remaining decoupled from any particular view library or +rendering logic. While we use it to power our React Viewer, it can be used with +Vue, React, Vanilla JS, or any number of other frameworks. + +### React Component Library + +[`OHIF/react-viewerbase`](https://github.com/OHIF/react-viewerbase) is a React +Component library that contains the reusable components that power the OHIF +Viewer. It allows us to build, compose, and test components in isolation; easing +the development process by reducing the need to stand-up a local PACS with test +case data. + +[Check out our component library!](https://react.ohif.org/) + +### Misc. Extensions + +Want to add custom logic or UI Components to the OHIF Viewer, but don't want to +maintain a fork? We expose common integration points via +[extensions](./extensions.md) to make that possible. For a list of extensions +maintained by OHIF, +[check out this helpful table](./extensions.html#ohif-maintained-extensions). + +If you find yourself thinking "I wish the Viewer could do X", and you can't +accomplish it with an extension today, create a GitHub issue! We're actively +looking for ways to improve our extensibility ^\_^ + +[Click here to read more about extensions!](./extensions.md) + +### Diagram + +This diagram is a conceptual illustration of how the Viewer is architected. + +0. (optional) `extensions` can be registered with `ohif-core`'s extension + manager +1. `ohif-core` provides bussiness logic and a way for `viewer` to access + registered extensions +1. The `viewer` composes and provides data to components from our component + library (`react-viewerbase`) +1. The `viewer` can be built and served as a stand-alone PWA, or as an + embeddable package + ([`ohif-viewer`](https://www.npmjs.com/package/ohif-viewer)) + +![Architecture Diagram](../assets/img/architecture-diagram.png) + +
    architecture diagram
    + +## Common Questions + +> When should I use the packaged source `ohif-viewer` versus building a PWA from +> the source? + +... + +> Can I create my own Viewer using Vue.js or Angular.js? + +You can, but you will not be able to leverage as much of the existing code and +components. `ohif-core` could still be used for business logic, and to provide a +model for extensions. `react-viewerbase` would then become a guide for the +components you would need to recreate. diff --git a/docs/latest/advanced/custom-tools.md b/docs/latest/advanced/custom-tools.md new file mode 100644 index 000000000..bed6c344f --- /dev/null +++ b/docs/latest/advanced/custom-tools.md @@ -0,0 +1,8 @@ +# Tool Management + +This is not yet exposed in an easy/convenient way. Most tools are currently +added by creating new Viewport, Toolbar, and SOPInstanceHandler extension +modules. You can read more about that approach in [extensions](./extensions.md). + +In the near future, we intend to improve the extensibility of tools for existing +Viewports (like our Cornerstone.js and VTK.js viewports). diff --git a/docs/latest/advanced/extensions.md b/docs/latest/advanced/extensions.md new file mode 100644 index 000000000..634fe5bd8 --- /dev/null +++ b/docs/latest/advanced/extensions.md @@ -0,0 +1,113 @@ +# Extensions + +Extensions add new functionality to the viewer by registering one or more modules. They go one step further than configuration in that they allow us to inject custom React components, so long as they adhere to the module's interface. This can be something as simple as adding a new button to the toolbar, or as complex as a new viewport capable of rendering volumes in 3D. + +## Overview + +At a glance, an extension is a class or object that has a `getExtensionId()` method, and one or more "module" methods. You can find an abbreviated extension below, or [view the source](https://github.com/OHIF/Viewers/blob/react/extensions/ohif-cornerstone-extension/src/OHIFCornerstoneExtension.js#L32-L65) of our `cornerstone` viewport extension. + +```js +class myCustomExtension { + + /** Required */ + getExtensionId: () => 'my-extension-id'; + + /** React component that receives props from ConnectLayoutManager + * If more than one viewport module is registered, SopClassHandler + * is used to help determine which component is used */ + getViewportModule: () => reactViewportComponent; + + /** React component that adds buttons/behavior to the viewer Toolbar */ + getToolbarModule: () => reactToolbarComponent; + + /** Provides a whitelist of SOPClassUIDs the viewport is capable of rendering. + * Can modify default behavior for methods like `getDisplaySetFromSeries` */ + getSopClassHandler: () => { + id: 'some-other-unique-id', + type: PLUGIN_TYPES.SOP_CLASS_HANDLER, + sopClassUids: ['string'], + getDisplaySetFromSeries: (series, study, dicomWebClient, authorizationHeaders) => ... + }; + + // Not yet used + getPanelModule: () => null; +} +``` + +### Modules + +There are a few different kinds of modules. Each kind of module allows us to extend the viewer in a different way, and provides a consistent API for us to do so. You can find a full list of the [different types of modules `in ohif-core`](https://github.com/OHIF/ohif-core/blob/43c08a29eff3fb646a0e83a03a236ddd84f4a6e8/src/plugins.js#L1-L6). Information on each type of module, it's API, and how we determine when/where it should be used is included below: + +#### Viewport + +An extension can register a Viewport Module by providing a `getViewportModule()` method that returns a React Component. The React component will receive the following props: + +```js +children: PropTypes.arrayOf(PropTypes.element) +studies: PropTypes.object, +displaySet: PropTypes.object, +viewportData: PropTypes.object, // { studies, displaySet } +viewportIndex: PropTypes.number, +children: PropTypes.node, +customProps: PropTypes.object +``` + +Viewport components are managed by the `LayoutManager`. Which Viewport component is used depends on: + +- The Layout Configuration +- Registered SopClassHandlers +- The SopClassUID for visible/selected datasets + +![Cornerstone Viewport](../assets/img/extensions-viewport.png) + +
    An example of three Viewports
    + +For a complete example implementation, [check out the OHIFCornerstoneViewport](https://github.com/OHIF/Viewers/blob/react/extensions/ohif-cornerstone-extension/src/OHIFCornerstoneViewport.js). + +#### Toolbar + +An extension can register a Toolbar Module by providing a `getToolbarModule()` method that returns a React Component. The component does not receive any props. If you want to modify or react to state, you will need to connect to the redux store. + +![Toolbar Extension](../assets/img/extensions-toolbar.gif) + +
    A toolbar extension example
    + +Toolbar components are rendered in the `ToolbarRow` component. + +For a complete example implementation, [check out the OHIFCornerstoneViewport's Toolbar Module](https://github.com/OHIF/Viewers/blob/react/extensions/ohif-cornerstone-extension/src/ToolbarModule.js). + +#### SopClassHandler + +... + +#### Panel + +> The panel module is not yet in use. + +### Registering Extensions + +Extensions are registered for the application at startup. The `ExtensionManager`, exposed by `ohif-core`, registers a list of extensions with our application's store. Each module provided by the extension becomes available via `state.plugins.availablePlugins`, and consists of three parts: id, type ([PLUGIN_TYPE](https://github.com/OHIF/ohif-core/blob/43c08a29eff3fb646a0e83a03a236ddd84f4a6e8/src/plugins.js#L1-L6)), and the return value of the module method. + +In a future version, we will likely expose a way to provide the extensions you would like included at startup. + +_app.js_ + +```js +import { createStore, combineReducers } from "redux"; +import OHIF from "ohif-core"; +import OHIFCornerstoneExtension from "ohif-cornerstone-extension"; + +const combined = combineReducers(OHIF.redux.reducers); +const store = createStore(combined); +const extensions = [new OHIFCornerstoneExtension()]; + +// Dispatches the `addPlugin` action to the store +// Adding extension modules to `state.plugins.availablePlugins` +ExtensionManager.registerExtensions(store, extensions); +``` + +## OHIF Maintained Extensions + +A small number of powerful extensions for popular use cases are maintained by OHIF. They're co-located in the [`OHIF/Viewers`](https://github.com/OHIF/Viewers/tree/react/) repository, in the top level [`extensions/`](https://github.com/OHIF/Viewers/tree/react/extensions) directory. + +{% include "./_maintained-extensions-table.md" %} diff --git a/docs/latest/advanced/index.md b/docs/latest/advanced/index.md new file mode 100644 index 000000000..c882d000e --- /dev/null +++ b/docs/latest/advanced/index.md @@ -0,0 +1,3 @@ +# Advanced + +Advanced topics go beyond basic configuration and deployment. Their goal is to provide insight into this project's architecture and guidance on leveraging extensions. \ No newline at end of file diff --git a/docs/latest/assets/designs/architecture-diagram b/docs/latest/assets/designs/architecture-diagram new file mode 100644 index 000000000..bbf6cf58b Binary files /dev/null and b/docs/latest/assets/designs/architecture-diagram differ diff --git a/docs/latest/assets/designs/cloud.svg b/docs/latest/assets/designs/cloud.svg new file mode 100644 index 000000000..ad04389c6 --- /dev/null +++ b/docs/latest/assets/designs/cloud.svg @@ -0,0 +1,14 @@ + + + + + + diff --git a/docs/latest/assets/designs/embedded-viewer-diagram b/docs/latest/assets/designs/embedded-viewer-diagram new file mode 100644 index 000000000..182ad2323 Binary files /dev/null and b/docs/latest/assets/designs/embedded-viewer-diagram differ diff --git a/docs/latest/assets/designs/nginx-image-archive.fig b/docs/latest/assets/designs/nginx-image-archive.fig new file mode 100644 index 000000000..625066aa9 Binary files /dev/null and b/docs/latest/assets/designs/nginx-image-archive.fig differ diff --git a/docs/latest/assets/designs/npm-logo-red.svg b/docs/latest/assets/designs/npm-logo-red.svg new file mode 100644 index 000000000..8e4aac5d2 --- /dev/null +++ b/docs/latest/assets/designs/npm-logo-red.svg @@ -0,0 +1,9 @@ + + + + + diff --git a/docs/latest/assets/designs/scope-of-project.fig b/docs/latest/assets/designs/scope-of-project.fig new file mode 100644 index 000000000..1a3c9033d Binary files /dev/null and b/docs/latest/assets/designs/scope-of-project.fig differ diff --git a/docs/latest/assets/designs/user-access-control-request-flow.fig b/docs/latest/assets/designs/user-access-control-request-flow.fig new file mode 100644 index 000000000..17d278d90 Binary files /dev/null and b/docs/latest/assets/designs/user-access-control-request-flow.fig differ diff --git a/docs/latest/assets/img/architecture-diagram.png b/docs/latest/assets/img/architecture-diagram.png new file mode 100644 index 000000000..1c43d0108 Binary files /dev/null and b/docs/latest/assets/img/architecture-diagram.png differ diff --git a/docs/latest/assets/img/embedded-viewer-diagram.png b/docs/latest/assets/img/embedded-viewer-diagram.png new file mode 100644 index 000000000..426cb7ab8 Binary files /dev/null and b/docs/latest/assets/img/embedded-viewer-diagram.png differ diff --git a/docs/latest/assets/img/extensions-toolbar.gif b/docs/latest/assets/img/extensions-toolbar.gif new file mode 100644 index 000000000..88c313f3d Binary files /dev/null and b/docs/latest/assets/img/extensions-toolbar.gif differ diff --git a/docs/latest/assets/img/extensions-viewport.png b/docs/latest/assets/img/extensions-viewport.png new file mode 100644 index 000000000..0ecffda06 Binary files /dev/null and b/docs/latest/assets/img/extensions-viewport.png differ diff --git a/docs/latest/assets/img/homePage.png b/docs/latest/assets/img/homePage.png new file mode 100644 index 000000000..9ae0624cc Binary files /dev/null and b/docs/latest/assets/img/homePage.png differ diff --git a/docs/latest/assets/img/jwt-explained.png b/docs/latest/assets/img/jwt-explained.png new file mode 100644 index 000000000..f26509a16 Binary files /dev/null and b/docs/latest/assets/img/jwt-explained.png differ diff --git a/docs/latest/assets/img/keycloak-default-theme.png b/docs/latest/assets/img/keycloak-default-theme.png new file mode 100644 index 000000000..0ea77f965 Binary files /dev/null and b/docs/latest/assets/img/keycloak-default-theme.png differ diff --git a/docs/latest/assets/img/keycloak-ohif-theme.png b/docs/latest/assets/img/keycloak-ohif-theme.png new file mode 100644 index 000000000..ad060f262 Binary files /dev/null and b/docs/latest/assets/img/keycloak-ohif-theme.png differ diff --git a/docs/assets/img/lesionTracker.png b/docs/latest/assets/img/lesionTracker.png similarity index 100% rename from docs/assets/img/lesionTracker.png rename to docs/latest/assets/img/lesionTracker.png diff --git a/docs/latest/assets/img/loading-study.gif b/docs/latest/assets/img/loading-study.gif new file mode 100644 index 000000000..c010830ee Binary files /dev/null and b/docs/latest/assets/img/loading-study.gif differ diff --git a/docs/latest/assets/img/netlify-drop.gif b/docs/latest/assets/img/netlify-drop.gif new file mode 100644 index 000000000..98634e088 Binary files /dev/null and b/docs/latest/assets/img/netlify-drop.gif differ diff --git a/docs/latest/assets/img/nginx-image-archive.png b/docs/latest/assets/img/nginx-image-archive.png new file mode 100644 index 000000000..bd7547965 Binary files /dev/null and b/docs/latest/assets/img/nginx-image-archive.png differ diff --git a/docs/latest/assets/img/scope-of-project.png b/docs/latest/assets/img/scope-of-project.png new file mode 100644 index 000000000..6daac8bee Binary files /dev/null and b/docs/latest/assets/img/scope-of-project.png differ diff --git a/docs/latest/assets/img/surge-deploy.gif b/docs/latest/assets/img/surge-deploy.gif new file mode 100644 index 000000000..545f06863 Binary files /dev/null and b/docs/latest/assets/img/surge-deploy.gif differ diff --git a/docs/latest/assets/img/user-access-control-request-flow.png b/docs/latest/assets/img/user-access-control-request-flow.png new file mode 100644 index 000000000..573c83503 Binary files /dev/null and b/docs/latest/assets/img/user-access-control-request-flow.png differ diff --git a/docs/assets/img/viewer.png b/docs/latest/assets/img/viewer.png similarity index 100% rename from docs/assets/img/viewer.png rename to docs/latest/assets/img/viewer.png diff --git a/docs/assets/img/worklist.png b/docs/latest/assets/img/worklist.png similarity index 100% rename from docs/assets/img/worklist.png rename to docs/latest/assets/img/worklist.png diff --git a/docs/book.json b/docs/latest/book.json similarity index 60% rename from docs/book.json rename to docs/latest/book.json index 084331971..e133fb02b 100644 --- a/docs/book.json +++ b/docs/latest/book.json @@ -9,7 +9,8 @@ "github", "ga", "sitemap", - "anchors" + "anchors", + "versions" ], "pluginsConfig": { "edit-link": { @@ -24,6 +25,20 @@ }, "sitemap": { "hostname": "https://docs.ohif.org" + }, + "versions": { + "gitbookConfigURL": "https://raw.githubusercontent.com/OHIF/Viewers/master/docs/book.json", + "options": [ + { + "value": "https://docs.ohif.org/history/v1/", + "text": "Version 1.0.0 (Meteor)" + }, + { + "value": "https://docs.ohif.org/", + "text": "Version 2.0.0", + "selected": true + } + ] } }, "links": { diff --git a/docs/latest/connecting-to-image-archives/google-cloud-healthcare.md b/docs/latest/connecting-to-image-archives/google-cloud-healthcare.md new file mode 100644 index 000000000..9948fb021 --- /dev/null +++ b/docs/latest/connecting-to-image-archives/google-cloud-healthcare.md @@ -0,0 +1,124 @@ +# Google Cloud Healthcare + +> ATTENTION: The original documentation for this integration lives in the legacy +> `version 1` Meteor documentation. You can +> [find it here](/history/v1/connecting-to-image-archives/google-cloud-healthcare.html). +> These docs will mirror the Meteor documentation until our `React` +> implementation has been updated to work with Goolg Cloud Healthcare. + +> The [Google Cloud Healthcare API](https://cloud.google.com/healthcare/) is a +> powerful option for storing medical imaging data in the cloud. + +An alternative to deploying your own PACS is to use a software-as-a-service +provider such as Google Cloud. The Cloud Healthcare API promises to be a +scalable, secure, cost effective image storage solution for those willing to +store their data in the cloud. It offers an +[almost-entirely complete DICOMWeb API](https://cloud.google.com/healthcare/docs/dicom) +which requires tokens generated via the +[OAuth 2.0 Sign In flow](https://developers.google.com/identity/sign-in/web/sign-in). +Images can even be transcoded on the fly if this is desired. The Cloud +Healthcare API is a very attractive option because it allows us to avoid +deploying the Meteor server entirely. We can just deploy OHIF as a client-only +static site application. + +## Setup a Google Cloud Healthcare Project + +- Create a Google Cloud account +- Create a project in Google Cloud +- Enable the [Cloud Healthcare API](https://cloud.google.com/healthcare/) for + your project. + - (Optional): Create a Dataset and Data Store for storing your DICOM data +- Enable the + [Cloud Resource Manager API](https://cloud.google.com/resource-manager/) for + your project. + - _Note:_ If you are having trouble finding the APIs, use the search box at + the top of the Cloud console. +- Go to APIs & Services > Credentials to create an OAuth Consent screen and fill + in your application details. + - Under Scopes for Google APIs, click "manually paste scopes". + - Add the following scopes: + - `https://www.googleapis.com/auth/cloudplatformprojects.readonly` + - `https://www.googleapis.com/auth/cloud-healthcare` +- Go to APIs & Services > Credentials to create a new set of credentials: + + - Choose the "Web Application" type + - Set up an + [OAuth 2.0 Client ID](https://support.google.com/cloud/answer/6158849?hl=en) + - Add your domain (e.g. `http://localhost:3000`) to Authorized JavaScript + origins. + - Add your domain, plus `_oauth/google` (e.g. + `http://localhost:3000/_oauth/google`) to Authorized Redirect URIs. + - Save your Client ID for later. + +- (Optional): Enable Public Datasets that are being hosted by Google: + https://cloud.google.com/healthcare/docs/resources/public-datasets/ + +## Run the viewer with your OAuth Client ID + +1. Open the `config/oidc-googleCloud.json` file and change `YOURCLIENTID` to + your Client ID value. +1. Run the OHIF Viewer using the oidc-googleCloud.json configuration file + +```bash +cd OHIFViewer +METEOR_PACKAGE_DIRS="../Packages" meteor npm install +METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/oidc-googleCloud.json +``` + +## Running via Docker + +OHIF is also providing a Docker container which can connect to Google Cloud +Healthcare with a Client ID which is provided at runtime. This is a very simple +method to get up and running. Internally, the container is running +[Nginx](https://nginx.org/) to serve the +[Standalone Viewer](../standalone-viewer/usage.md). + +1. Install Docker (https://www.docker.com/) +1. Run the Docker container, providing a Client ID as an environment variable. + Client IDs look like `xyz.apps.googleusercontent.com`. + +```bash +docker run --env CLIENT_ID=$CLIENT_ID --publish 3000:80 ohif/viewer-google-cloud:latest +``` + +## Building the ohif/viewer-google-cloud Docker Image + +The +[ohif/viewer-google-cloud](https://cloud.docker.com/u/ohif/repository/docker/ohif/viewer-google-cloud) +Docker image is built as follows. The Dockerfile and nginx.conf are in the +`/dockersupport/viewer-google-cloud` folder. + +1. [Install Meteor](https://www.meteor.com/install) +1. Clone the repository + +```bash +git clone https://github.com/OHIF/Viewers.git +cd Viewers +``` + +1. Install meteor-build-client-fixed2 so you can build the Standalone Viewer + +```bash +npm install -g meteor-build-client-fixed2 +``` + +1. Build the Standalone client-only OHIF Viewer + +```bash +cd OHIFViewer/ +METEOR_PACKAGE_DIRS="../Packages" meteor npm install +METEOR_PACKAGE_DIRS="../Packages" meteor-build-client-fixed2 ../dockersupport/viewer-google-cloud/build -s ../config/oidc.json +``` + +1. Build the Docker image + +```bash +cd ../dockersupport/viewer-google-cloud +docker build -t ohif/viewer-google-cloud . +``` + +1. Run the Docker image using an OAuth Client ID + +```bash +docker run --env CLIENT_ID={$someID}.apps.googleusercontent.com --publish 3000:80 ohif/viewer-google-cloud +``` diff --git a/docs/latest/contributing.md b/docs/latest/contributing.md new file mode 100644 index 000000000..f0bd63732 --- /dev/null +++ b/docs/latest/contributing.md @@ -0,0 +1,63 @@ +# Contributing + +## I would like to contribute code - how do I do this? + +Fork the repository, make your change and submit a pull request. + +- The OHIF Viewer consists of code from three different repositories. Make sure + your change is modifying the appropriate one: + - `ohif-core`: Business Logic + - `react-viewerbase`: Reusable React Component Library + - `Viewers`: The glue, PWA, and primary extension point +- At a minimum, you may want to read the following documentation: + - [Essentials: Getting Started](./essentials/getting-started.md) + - [Advanced: Architecture](./advanced/architecture.md) + +## Any guidance on submitting changes? + +While we do appreciate code contributions, triaging and integrating contributed +code changes can be very time consuming. Please consider the following tips when +working on your pull requests: + +- Functionality is appropriate for the repository. Consider creating a GitHub + issue to discuss your suggested changes. +- The scope of the pull request is not too large. Please consider separate pull + requests for each feature as big pull requests are very time consuming to + understand. + +We will provide feedback on your pull requests as soon as possible. Following +the tips above will help ensure your changes are reviewed. + +## Testing contribution pull requests + +OHIF uses [netlify](netlify.com) so that pull requests are autogenerated and +available for testing. + +For example, [this url][example-url] allows you to test [pull request 237, the +request that created this FAQ entry,][pr-237] using data pulled from Amazon S3. + +Replacing the number 237 in the link below with your pull request number should +let you test it as well and you can use this link for discussions on github +without requiring reviewers to download and build your branch. + +```bash +https://deploy-preview-237--ohif.netlify.com/viewer/?url=https://s3.eu-central-1.amazonaws.com/ohif-viewer/sampleDICOM.json +``` + +If you have made a documentation change, a link like this will let you preview +the gitbook generated by the pull request: + +```bash +https://deploy-preview-237--ohif.netlify.com/contributing.html +``` + + + + + +[example-url]: https://deploy-preview-237--ohif.netlify.com/viewer/?url=https://s3.eu-central-1.amazonaws.com/ohif-viewer/sampleDICOM.json +[pr-237]: https://github.com/OHIF/Viewers/pull/237 + + diff --git a/docs/latest/deployment/_embedded-viewer-diagram.md b/docs/latest/deployment/_embedded-viewer-diagram.md new file mode 100644 index 000000000..6af9e0a30 --- /dev/null +++ b/docs/latest/deployment/_embedded-viewer-diagram.md @@ -0,0 +1,4 @@ +
    + Embedded Viewer Diagram +
    embedded viewer diagram
    +
    diff --git a/docs/latest/deployment/_nginx-image-archive-diagram.md b/docs/latest/deployment/_nginx-image-archive-diagram.md new file mode 100644 index 000000000..780e4f766 --- /dev/null +++ b/docs/latest/deployment/_nginx-image-archive-diagram.md @@ -0,0 +1,4 @@ +
    + request flow example +
    simplified request flow diagram
    +
    diff --git a/docs/latest/deployment/_user-account-control-flow-diagram.md b/docs/latest/deployment/_user-account-control-flow-diagram.md new file mode 100644 index 000000000..b6937cd6b --- /dev/null +++ b/docs/latest/deployment/_user-account-control-flow-diagram.md @@ -0,0 +1,4 @@ +
    + request flow example +
    simplified request flow diagram
    +
    diff --git a/docs/latest/deployment/index.md b/docs/latest/deployment/index.md new file mode 100644 index 000000000..324a27c44 --- /dev/null +++ b/docs/latest/deployment/index.md @@ -0,0 +1,210 @@ +# Deployment + +The OHIF Viewer can be embedded in other web applications via it's [packaged +script source][ohif-viewer-npm], or served up as a stand-alone PWA ([progressive +web application][pwa-url]) by building and hosting a collection of static +assets. In either case, you will need to configure your instance of the Viewer +so that it can connect to your data source (the database or PACS that provides +the data your Viewer will display). + +## Overview + +Our goal is to make deployment as simple and painless as possible; however, +there is an inherent amount of complexity in customizing, optimizing, and +deploying web applications. If you find yourself a little lost, please don't +hesitate to [reach out for help](/help.md) + +## Deployment Scenarios + +### Embedded Viewer + +The quickest and easiest way to get the OHIF Viewer up and running is to embed +it into an existing web application. It allows us to forego a "build step", and +add a powerful medical imaging viewer to an existing web page using only a few +include tags. + +- Read more about it here: [Embedded Viewer](./recipes/embedded-viewer.md) +- And check out our + [live demo on CodeSandbox](https://codesandbox.io/s/lrjoo3znxm) + +{% include "./_embedded-viewer-diagram.md" %} + +### Stand-alone Viewer + +Deploying the OHIF Viewer as a stand-alone web application provides many +benefits, but comes at the cost of time and complexity. Some benefits include: + +_Today:_ + +- Leverage [extensions](/advanced/extensions.md) to drop-in powerful new + features +- Add routes and customize the viewer's workflow +- Finer control over styling and whitelabeling + +_In the future:_ + +- The ability to package the viewer for [App Store distribution][app-store] +- Leverage `service-workers` for offline support and speed benefits from caching + +#### Hosted Static Assets + +At the end of the day, a production OHIF Viewer instance is a collection of +HTML, CSS, JS, Font Files, and Images. We "build" those files from our +`source code` with configuration specific to our project. We then make those +files publicly accessible by hosting them on a Web Server. + +If you have not deployed a web application before, this may be a good time to +[reach out for help](/help.md), as these steps assume prior web development and +deployment experience. + +##### Part 1 - Build Production Assets + +"Building", or creating, the files you will need is the same regardless of the +web host you choose. You can find detailed instructions on how to configure and +build the OHIF Viewer in our +["Build for Production" guide](./recipes/build-for-production.md). + +##### Part 2 - Host Your App + +There are a lot of [benefits to hosting static assets][host-static-assets] over +dynamic content. You can find instructions on how to host your build's output +via one of these guides: + +_Drag-n-drop_ + +- [Netlify: Drop](/deployment/recipes/static-assets.md#netlify-drop) + +_Easy_ + +- [Surge.sh](/deployment/recipes/static-assets.md#surgesh) +- [GitHub Pages](/deployment/recipes/static-assets.md#github-pages) + +_Advanced_ + +- [AWS S3 + Cloudfront](/deployment/recipes/static-assets.md#aws-s3--cloudfront) +- [GCP + Cloudflare](/deployment/recipes/static-assets.md#gcp--cloudflare) +- [Azure](/deployment/recipes/static-assets.md#azure) + +## Data + +The OHIF Viewer is able to connect to any data source that implements the [DICOM +Web Standard][dicom-web-standard]. [DICOM Web][dicom-web] refers to RESTful +DICOM Services -- a recently standardized set of guidelines for exchanging +medical images and imaging metadata over the internet. Not all archives fully +support it yet, but it is gaining wider adoption. + +### Configure Connection + +If you have an existing archive and intend to host the OHIF Viewer at the same +domain name as your archive, then connecting the two is as simple as following +the steps layed out in our +[Configuration Essentials Guide](./../essentials/configuration.md). + +#### What if I don't have an imaging archive? + +We provide some guidance on configuring a local image archive in our +[Data Source Essentials](./../essentials/data-source.md) guide. Hosting an +archive remotely is a little trickier. You can check out some of our +[advanced recipes](#recipes) for modeled setups that may work for you. + +#### What if I intend to host the OHIF Viewer at a different domain? + +There are two important steps to making sure this setup works: + +1. Your Image Archive needs to be exposed, in some way, to the open web. This + can be directly, or through a `reverse proxy`, but the Viewer needs _some + way_ to request it's data. +2. \* Your Image Archive needs to have appropriate CORS (Cross-Origin Resource + Sharing) Headers + +> \* Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional +> HTTP headers to tell a browser to let a web application running at one origin +> (domain) have permission to access selected resources from a server at a +> different origin. - [MDN Web Docs: Web - Http - CORS][cors] + +Most image archives do not provide either of these features "out of the box". +It's common to use IIS, Nginx, or Apache to route incoming requests and append +appropriate headers. You can find an example of this setup in our +[Nginx + Image Archive Deployment Recipe](deployment/recipes/nginx--image-archive.md). + +#### What if my archive doesn't support DicomWeb? + +> This is possible to do with the OHIF Viewer, but not as straightforward. Look +> out for documentation on this subject in the near future. + +... + +### Securing Your Data + +> Feeling lost? Securing your data is important, and it can be hard to tell if +> you've gotten it right. Don't hesitate to work with professional auditors, or +> [enlist help from experts](./../help.md). + +The OHIF Viewer can be configured to work with authorization servers that +support one or more of the OpenID-Connect authorization flows. The Viewer finds +it's OpenID-Connect settings on the `oidc` configuration key. You can set these +values following the instructions laid out in the +[Configuration Essentials Guide](./../essentials/configuration.md). + +_Example OpenID-Connect Settings:_ + +```js +window.config = { + ... + oidc: [ + { + // ~ REQUIRED + // Authorization Server URL + authority: 'http://127.0.0.1/auth/realms/ohif', + client_id: 'ohif-viewer', + redirect_uri: 'http://127.0.0.1/callback', // `OHIFStandaloneViewer.js` + response_type: 'code', // "Authorization Code Flow" + scope: 'openid', // email profile openid + // ~ OPTIONAL + post_logout_redirect_uri: '/logout-redirect.html', + }, + ], +} +``` + +You can find an example of this setup in our +[User Account Control Deployment Recipe](deployment/recipes/user-account-control.md). + +#### Choosing a Flow for the Viewer + +In general, we recommend using the "Authorization Code Flow" ( [see +`response_type=code` here][code-flows]); however, the "Implicit Flow" ( [see +`response_type=token` here][code-flows]) can work if additonal precautions are +taken. If the flow you've chosen produces a JWT Token, it's validity can be used +to secure access to your Image Archive as well. + +### Recipes + +We've included a few recipes for common deployment scenarios. There are many, +many possible configurations, so please don't feel limited to these setups. +Please feel free to suggest or contribute your own recipes. + +- Script Include + - [Embedding the Viewer](deployment/recipes/embedded-viewer.md) +- Stand-Alone + - [Build for Production](deployment/recipes/build-for-production.md) + - [Static](deployment/recipes/static-assets.md) + - [Nginx + Image Archive](deployment/recipes/nginx--image-archive.md) + - [User Account Control](deployment/recipes/user-account-control.md) + + + + + +[ohif-viewer-npm]: https://www.npmjs.com/package/ohif-viewer +[pwa-url]: https://developers.google.com/web/progressive-web-apps/ +[static-assets-url]: https://www.maxcdn.com/one/visual-glossary/static-content/ +[app-store]: https://medium.freecodecamp.org/i-built-a-pwa-and-published-it-in-3-app-stores-heres-what-i-learned-7cb3f56daf9b +[dicom-web-standard]: https://www.dicomstandard.org/dicomweb/ +[dicom-web]: https://en.wikipedia.org/wiki/DICOMweb +[host-static-assets]: https://www.netlify.com/blog/2016/05/18/9-reasons-your-site-should-be-static/ +[cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS +[code-flows]: https://medium.com/@darutk/diagrams-of-all-the-openid-connect-flows-6968e3990660 + diff --git a/docs/latest/deployment/recipes/build-for-production.md b/docs/latest/deployment/recipes/build-for-production.md new file mode 100644 index 000000000..19dc5563a --- /dev/null +++ b/docs/latest/deployment/recipes/build-for-production.md @@ -0,0 +1,183 @@ +# Build for Production + +> If you've already followed the +> ["Getting Started" Guide](/essentials/getting-started.md), you can skip ahead +> to [Configuration](#configuration) + +## Overview + +### Build Machine Requirements + +- [Node.js & NPM](https://nodejs.org/en/download/) +- [Yarn](https://yarnpkg.com/lang/en/docs/install/) +- [Git](https://www.atlassian.com/git/tutorials/install-git) + +### Getting the Code + +_With Git:_ + +```bash +# Clone the remote repository to your local machine +git clone https://github.com/OHIF/Viewers.git + +# Make sure the local code reflects the `react` version of the OHIF Viewer +git checkout react +``` + +More on: _[`git clone`](https://git-scm.com/docs/git-clone), +[`git checkout`](https://git-scm.com/docs/git-checkout)_ + +_From .zip:_ + +[OHIF/Viewers: react.zip](https://github.com/OHIF/Viewers/archive/react.zip) + +### Restore Dependencies & Build + +Open your terminal, and navigate to the directory containing the source files. +Next run these commands: + +```js +// Restore dependencies +yarn install + +// Build source code for production +yarn run build:web +``` + +If everything worked as expected, you should have a new `build/` directory in +the project's folder. It should roughly resemble the following: + +```bash +build +├── config/ +├── static/ +├── index.html +├── manifest.json +├── service-worker.js +└── ... +``` + +By default, the build output will connect to OHIF's publicly accessible PACS. If +this is your first time setting up the OHIF Viewer, it is recommended that you +test with these default settings. After testing, you can find instructions on +how to configure the project for your own imaging archive below. + +### Configuration + +> This step assumes you have an imaging archive. If you need assistance setting +> one up, check out the [`Data Source` Guide](./../../essentials/data-source.md) +> or a deployment recipe that contains an open source Image Archive + +#### How it Works + +The configuration for our project is in the `/public/config` directory. Our +build process knows which configuration file to use based on the +`REACT_APP_CONFIG` environment variable. By default, its value is +[`default.js`](https://github.com/OHIF/Viewers/blob/react/public/config/default.js). +When we build, the `%REACT_APP_CONFIG%` value in +our[`/public/index.html`](https://github.com/OHIF/Viewers/blob/react/public/index.html#L12-L15) +file is substituted for the correct configuration file's name. This sets +the`window.config` equal to our configuration file's value. + +#### How do I configure my project? + +The simplest way is to update the existing default config: + +_/public/config/default.js_ + +```js +window.config = { + routerBasename: '/', + relativeWebWorkerScriptsPath: '', + servers: { + dicomWeb: [ + { + name: 'DCM4CHEE', + wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado', + qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', + wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', + qidoSupportsIncludeField: true, + imageRendering: 'wadors', + thumbnailRendering: 'wadors', + requestOptions: { + requestFromBrowser: true, + }, + }, + ], + }, +} +``` + +You can also create a new config file and specify its path relative to the build +output's root by setting the `REACT_APP_CONFIG` environment variable. You can +set the value of this environment variable a few different ways: + +- [Add a temporary environment variable in your shell](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-temporary-environment-variables-in-your-shell) +- [Add environment specific variables in `.env` file(s)](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env) +- Using the `cross-env` package in an npm script: + - `"build": "cross-env REACT_APP_CONFIG=config/my-config.js react-scripts build"` + +After updating the configuration, `yarn run build:web` to generate updated build +output. + +## Next Steps + +### Deploying Build Output + +_Drag-n-drop_ + +- [Netlify: Drop](/deployment/recipes/static-assets.md#netlify-drop) + +_Easy_ + +- [Surge.sh](/deployment/recipes/static-assets.md#surgesh) +- [GitHub Pages](/deployment/recipes/static-assets.md#github-pages) + +_Advanced_ + +- [AWS S3 + Cloudfront](/deployment/recipes/static-assets.md#aws-s3--cloudfront) +- [GCP + Cloudflare](/deployment/recipes/static-assets.md#gcp--cloudflare) +- [Azure](/deployment/recipes/static-assets.md#azure) + +### Testing Build Output Locally + +A quick way to test your build output locally is to spin up a small webserver. +You can do this by running the following commands in the `build/` output +directory: + +```js +// Install http-server as a globally available package +yarn global add http-server + +// Serve the files in our current directory +// Accessible at: `http://localhost:8080` +http-server +``` + +### Automating Builds and Deployments + +If you found setting up your environmnent and running all of these steps to be a +bit tedious, then you are in good company. Thankfully, there are a large number +of tools available to assist with automating tasks like building and deploying +web application. For a starting point, check out this repository's own use of: + +- [CircleCI][circleci]: [config.yaml][circleci-config] +- [Netlify][netlify]: [netlify.toml][netlify.toml] | + [generateStaticSite.sh][generatestaticsite.sh] +- [Semantic-Release][semantic-release]: [.releaserc][releaserc] + +## Troubleshooting + +> Issues and resolutions for common GitHub issues will be summarized here + +... + + +[circleci]: https://circleci.com/gh/OHIF/Viewers +[circleci-config]: https://github.com/OHIF/Viewers/blob/react/.circleci/config.yml +[netlify]: https://app.netlify.com/sites/ohif/deploys +[netlify.toml]: https://github.com/OHIF/Viewers/blob/react/netlify.toml +[generateStaticSite.sh]: https://github.com/OHIF/Viewers/blob/react/generateStaticSite.sh +[semantic-release]: https://semantic-release.gitbook.io/semantic-release/ +[releaserc]: https://github.com/OHIF/Viewers/blob/react/.releaserc + diff --git a/docs/latest/deployment/recipes/embedded-viewer.md b/docs/latest/deployment/recipes/embedded-viewer.md new file mode 100644 index 000000000..3e7427f5c --- /dev/null +++ b/docs/latest/deployment/recipes/embedded-viewer.md @@ -0,0 +1,109 @@ +# Embedded Viewer + +The quickest and easiest way to get the OHIF Viewer up and running is to embed +it into an existing web application. It allows us to forego a "build step", and +add a powerful medical imaging viewer to an existing web page using only a few +include tags. Here's how it works: + +{% include "./../_embedded-viewer-diagram.md" %} + +1. Create a new web page or template that includes the following external + dependencies: + + + +
      +
    1. the HTML base tag
    2. +
    3. The WADO Image Loader Codecs and Web Worker source code + should be accessible from your server's root
    4. +
    5. Create a JS Object to hold the OHIF Viewer's configuration. Here are some + example values that would allow the viewer to hit our public PACS:
    6. +
    + +```js +var props = { + // Directory your application runs in (e.g. /viewer/) + routerBasename: '/', + rootUrl: 'https://lrjoo3znxm.codesandbox.io', + servers: { + dicomWeb: [ + { + name: 'DCM4CHEE', + wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado', + qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', + wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', + qidoSupportsIncludeField: true, + imageRendering: 'wadors', + thumbnailRendering: 'wadors', + requestOptions: { + requestFromBrowser: true, + }, + }, + ], + }, +} +``` + +
    1. + Render the viewer in the web page's target div +
    + +```js +// Made available by the `ohif-viewer` script included in step 1 +var Viewer = window.OHIFStandaloneViewer.App +var app = React.createElement(Viewer, props, null) + +ReactDOM.render(app, document.getElementById('ohif-viewer-target')) +``` + +#### Tips & Tricks + +> I'm having trouble getting this to work. Where can I go for help? + +First, check out this fully functional +[CodeSandbox](https://codesandbox.io/s/lrjoo3znxm) example. If you're still +having trouble, feel free to search or GitHub issues. Can't find anything +related your problem? Create a new one. + +> When I include bootstrap, other styles on my page no longer work correctly. +> What can I do? + +When we include `bootsrap` (and the other dependencies), they are added +globally. This has the potential of causing conflicts with other scripts and +styles on the page. To prevent this, `embed` the viewer in a new/empty web page. +Have that working? Good. Now `embed` that new page using an +[`